Commit graph

375 commits

Author SHA1 Message Date
Umherirrender f8ffcd20d2 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements done manually

Change-Id: I9b8f447ea4d715bc815cc782184bca288ee001a0
2024-01-02 20:54:08 +01:00
Fomafix 981555e528 Use MediaWiki\ResourceLoader\Context instead of ResourceLoaderContext
ResourceLoaderContext is deprecated since 1.39.

Change-Id: I466cd4d0c9dcd17fe7de95959a64db5459e288e1
2024-01-02 10:44:10 +00:00
gerritbot 51a0275250 Update UserOptionsManager's FQN
User-options related classes are being moved to
the MediaWiki\User\Options namespace in MediaWiki Core;
reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: Ie1ab46338a660686394c79f49f21e6c1e0fa4a0a
2023-11-29 14:39:54 +00:00
gerritbot febf3e635e Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: I084e01a29884f338fae22d7239d068823a2657c3
2023-11-29 12:42:02 +00:00
Moh'd Khier Abualruz e480bfa2b5 Update theme icon for client preferences in user links
- Add appearance.svg file and classes
- Update the icon name in php
- Update icon name in test data and Snapshot

To test: change return value of
  isClientPreferencesPinned() from SkinVector22
  PHP Class to false

Bug: T351142
Change-Id: If61f3019430be3cb9c926b09bc397e27d8e636f2
2023-11-24 15:01:35 +00:00
bwang d2b413a721 Make client prefs fully pinnable
Bug: T351141
Change-Id: Ic4a166fb3234b27dbf3d37891abfdf15781c8867
2023-11-22 14:39:28 -06:00
Jon Robson 845a0ab71d Make the limited width and font size controls work for logged in users
For time being manage classes inside Vector. Document with FIXME and a
test.

Bug: T351447
Change-Id: Icc084a59a0141ec2b7c772cf92e8cc58c11f15b1
2023-11-21 02:16:52 +00:00
Jon Robson 9d054339db PerformanceBudget: Remove FlaggedRevisions workaround
With I1e45d0dacf58b2e03886d3b986309e13e754e324 this should no
longer be needed as the styles are now restricted to reviewers and
the default user is not a reviewer

After merging this change, please confirm that any open
FlaggedRevisions patches pass Jenkins CI.

Change-Id: I53e3f2c15ad6797f39747e5bc00039582edb8f61
2023-11-14 17:25:56 +00:00
Jon Robson 07a26a9448 Refactor VectorComponentUserLinks to not use hooks
Bug: T350195
Change-Id: I6cbf45587475f0477657a7ce9309b2cd42da33c1
2023-11-09 17:32:10 -08:00
Moh'd Khier Abualruz 9f35fd8d56 Vector PerformanceBudgetTest::testTotalModulesSize CI break
- Account for 10 Kbs in the case wikibase is enabled for scripts budget
- Message generation centralised function
- Added bundlesize.config.json file path to message.
- Update the message to show in Kbs

Bug: T350338
Change-Id: I8490cd7aa4468b54bab05960c8c594093167cb72
2023-11-07 17:15:59 +00:00
Leszek Manicki 72ec5037cf Skip PerformanceBudgetTest::testTotalModulesSize
The tests breaks CI for multiple extensions.

Bug: T350338
Change-Id: Id4879c3a8f53f7e59b9c04bfae3af11fe42a307c
2023-11-07 10:12:44 +01:00
Jon Robson b7dcd8ffa8 Restore test and increase budget with debug information
*. Current budget didn't take into account:
** RelatedArticles
** FlaggedRevisions
** VisualEditor
* Vector legacy budget is set to Vector 2022 to ensure both skins
have similar performance demands.
* Adds workaround for T350514

Bug: T346813
Bug: T350338
Change-Id: I3377bec5e1c368d30e77e22e93b2e44bbfe883bd
2023-11-03 21:27:39 +00:00
Moh'd Khier Abualruz bcc71fc459 Performance budget Test message update
Followup to Id5c28ecec20c4a74a113dd8781b6a022391ae443

- Make the message more readable

Bug: T350292
Change-Id: I299bcca61b8df30024ad70c17ca33bf0f6c322fe
2023-11-03 13:35:38 +01:00
jenkins-bot cb9bf63924 Merge "PerformanceBudgetTest: Use existing title" 2023-11-02 11:56:01 +00:00
Jon Robson dcf343e1c7 PerformanceBudgetTest: Use existing title
Follow up to Id5c28ecec20c4a74a113dd8781b6a022391ae443
Certain modules may only load if a page exists, so using an existing
title may catch more issues in CI.

Bug: T346813
Change-Id: I399f97720702c038ade6394f0193c27feb4a3bc8
2023-11-02 11:53:02 +01:00
Gergő Tisza 160fc79bc1
Skip PerformanceBudgetTest::testTotalModulesSize
Broke CI.

Follows up Id5c28ecec20c4a74a113dd8781b6a022391ae443.

Bug: T350338
Change-Id: Ief89f9dbc10b51d4eab238484e3b7f546c40c769
2023-11-01 22:03:00 -07:00
Moh'd Khier Abualruz 20b9d04b2f Performance budget's should consider modules added by hooks
- Add ModulesSizeTest.php that checks the total loaded scripts and styles budget sizes and checks if they exceed the budgets assigned in bundlesize.config.json.
- Changed the json structure of bundlesize.config.json to support both ModulesSizeTest.php and BundleSizeTest.php.
- Handled the new data structure in the BundleSizeTest.php so the dataProvider gets proper data.

Bug: T346813
Change-Id: Id5c28ecec20c4a74a113dd8781b6a022391ae443
2023-11-01 20:50:48 +00:00
Jon Robson 329d91c99c Vector 2022: Support dropdown creation via addPortlet
Vector 2022:
mw.util.addPortlet('p-twinkle', 'TW', '#p-cactions');
mw.util.addPortletLink('p-twinkle','#', 'Hello world');

Or if preferred it can be added to the pinned menu
mw.util.addPortlet('p-twinkle-pinnable', 'TW', '#p-tb');
mw.util.addPortletLink('p-twinkle-pinnable','#', 'Hello world');

Bug: T342815
Change-Id: Id58515e72bfbd5f700aa573a122529c6efdfea9d
2023-10-25 15:44:45 +00:00
jenkins-bot 1eb75ab7b1 Merge "Vector legacy: Support dropdown creation via addPortlet" 2023-10-25 10:15:05 +00:00
Jon Robson cb8a500e7a Vector legacy: Support dropdown creation via addPortlet
Vector:
    mw.util.addPortlet('p-twinkle', 'TW', '#p-cactions');
    mw.util.addPortletLink('p-twinkle','#', 'Hello world');

Additional changes:
* Add aria labels to gadget created menus

Additional changes to template
* Remove self closing tag on input[checkbox] in template
* Rearrange vector-menu and vector-menu-dropdown classes
for consistency between two approaches

Bug: T342815
Change-Id: I938928c3625099ad49bec8aafb11f91190a9f494
2023-10-25 10:39:30 +02:00
Moh'd Khier Abualruz 173c91a0f5 Make Vector feature flags compatible with beta features
- Added Key 'beta' to features config in skin.json. As usual this also supported by global configs.
- Added feature management logic to check for beta feature enabled status and the user's selection of utilising the vector beta features.
- Added VECTOR_BETA_FEATURES to Constants.php which is an array that holds features names that would be enabled.
- Removed final from class declaration of OverridableConfigRequirement class, as it does interfere with the mocking in the current setup

Remaining Work:
- Missing images to be added in the hook to show in beta features under Special:Preferences -- this will be added in a followup

Bug: T347772
Change-Id: I7bf8284e328c66c019c392f57207cab21ce0d4f6
2023-10-19 18:22:57 +02:00
Jon Robson 411f9ce69a Allow user preferences to be overriden by query string parameter
Currently only features that are associated with LocalSettings configuration
can be overriden by query string. Going forward we'd like to expand this to apply
to user preference too.

A generic OverrideableRequirement is created.
The existing OverridableConfigRequirement is refactored to extend OverrideableRequirement
The /UserPreferenceRequirement now extends it

This allows http://localhost:8888/wiki/Spain?vectortypographysurvey=1
to work

Bug: T347900
Change-Id: I11efd6b07192d5d2333f4506e9d87a8c0638d657
2023-10-12 19:05:10 +00:00
Jon Robson 735dad995b Preferences set to "disabled" return false when isEnabled is called
The font size preference sets a preference to disabled rather than 0.

Rather than save this as 0, it would be useful to store this as a string
given in future it will evolve to have values small, medium, large

Change logic in UserPreferenceRequirement to support non-binary options.

Bug: T346987
Change-Id: I399aa1b1be4a45cab0aa3b8addb482e5af6c5bf3
2023-10-04 00:34:16 +00:00
James D. Forrester 507de0f4e2 VectorComponentTableOfContentsTest: Add mocks for Message:: escaped() and rawParams()
Needed for new security patch.

Change-Id: I9295a8e0f9f00b62d5206f6d7e40bb657f436510
2023-09-28 20:30:48 -04:00
Ed Sanders 1aec6764ad build: Use wikimedia/server for root folder eslint config
Change-Id: I8b6938f2ac935724cf80e01096591e6a4c0cbbe0
2023-09-04 18:13:32 +01:00
Umherirrender 7adf4575a5 Use namespaced MediaWiki\Request\FauxRequest
Bug: T321681
Change-Id: Ib4e07d560062caf562aa99c493d53eb8c67a0f2e
2023-08-20 01:54:58 +02:00
Umherirrender 3640c7e390 Use namespaced Title
Bug: T321681
Change-Id: I45a13ec69f114538fd7c0047c3fce0e81f197b50
2023-08-19 20:19:12 +02:00
bwang 54b620042a Remove wmf-a11y dependency and tests
Change-Id: Ib3a61615af634ad7dc94fa09d521b90bc5db3e0d
2023-08-17 12:38:55 -05:00
jenkins-bot cd45d2938f Merge "Avoid DB access in SkinVectorTest" 2023-08-06 06:06:24 +00:00
Daimona Eaytoy 473dc07eb4 Avoid DB access in SkinVectorTest
The test is not in the Database group and it shouldn't be, so avoid
(unintentionally) making DB queries.

Change-Id: I68de8806e58b9ebef9c31d6d66ab9b9c95b08fa7
2023-08-06 02:22:42 +02:00
bwang eb64a09a7d Separate dropdown/menu references in PHP and templates
- VectorComponentMenuVariants.php is renamed to VectorComponentVariants.php, and returns menu and dropdown data
- Remove TabsMenuContents.mustache in favor of MenuContents.mustache
- Fix the variants dropdown to use the full Menu template

Follow-up: Idf05c1664c026f58487ba34af5ede8a11e695baf
Change-Id: I0e9b1ab3306b04ee0d226048c6885beab4f310c6
2023-07-31 14:03:12 -05:00
Moh'd Khier Abualruz 4b4fc6c6c9 Add hook support for mw.util.addPortlet method
- Hooking into mw.util.addPortlet
- merged in tests from: I3258388d74c103515e3f0680304f9a376e439a35

possible follow-ups:
- tooltips support
- custom attributes support
- Adapting portlets of types dropdown, tab to vector skin. Check patch set 10 for a starting point

Depends-on: I79bad8661e34e653d41e6cb1cd4462ac5c6bc3b1
Bug: T303488
Change-Id: I35a51df6ece2e48e086e722337d4c6bba427eeb4
2023-07-26 13:37:09 +03:00
bwang e0eeb1a8c9 Update html-label to use label-class
Follow-up: I64e4780102a743c5ace332a562b4f9d73ea10d16
Change-Id: I255e12f22436b567ec01fafe667138ffd981afed
2023-07-11 16:49:40 +00:00
bwang ecd221fe37 Add option for html label in Menu template
Bug: T340217
Change-Id: I64e4780102a743c5ace332a562b4f9d73ea10d16
2023-07-10 16:42:58 -07:00
bwang 2eb8fe89ea Remove unecessary whitespace and new lines from HTML
Change-Id: I8fe04d458da292e2990543afa232a91b6dd4db59
2023-07-06 14:07:29 -05:00
Moh'd Khier Abualruz 288b802d45 Vector 22 has some missing whitespace internal to HTML elements
Bug: T338691
Change-Id: Ic4657505ff92027d3c83373c7000e452f00ac07e
2023-07-04 19:05:36 +02:00
bwang 6a57506ae8 Separate vector-menu classes from Dropdowns
Bug: T319358
Change-Id: Idf05c1664c026f58487ba34af5ede8a11e695baf
2023-06-27 10:14:29 -05:00
Jon Robson 1e6b647971 Add new classes for dropdown component
Bug: T319358
Change-Id: Iab55dc190aa2ebc48eb9c8b34cf10baae8a89914
2023-06-26 15:31:01 -07:00
bwang 153c6f2668 Remove references to heading in dropdown PHP
Bug: T319358
Change-Id: I9830a4b4b55fdb205c479c09ef807de4f6d68713
2023-06-26 12:49:00 -05:00
jenkins-bot 84864d21de Merge "Drop styles for cached HTML" 2023-06-16 16:32:31 +00:00
daniel c8f785d7bb Clean up hook handler registration
Bug: T339167
Needed-By: I83bc81d1b3033c38b9313884a9c70a187fdde227
Change-Id: I980f2d45e6bb8c6a04058e68c758f71bbcf709de
2023-06-14 22:03:19 +02:00
Jon Robson 24d69726f3 Drop styles for cached HTML
Performance: This reclaims 1.3kb of CSS.

Bug: T336526
Change-Id: I6c1ed1523df8cc9e2f2ca09506f12a595b8b013d
2023-06-14 10:52:44 -07:00
Jon Robson 68239ae344 Use Codex for button styles, start transitioning icons to use Codex icon mixins
Changes:
- mw-ui-button to cdx-button
- mw-ui-quiet to cdx-button--weight-quiet
- mw-ui-icon-element to cdx-button--icon-only
- mw-ui-icon to vector-icon
- mw-ui-icon-flush-right/left to vector-button-flush-right/left
- Removes $isSmallIcon param in Hooks.php

85 Visual Changes
- ~36 changes from minor pixel changes from the new button classes in the main menu, language button
- 22 from standardizing the padding of the TOC in page title
- ~10 changes from addition of .cdx-button to the TOC toggle buttons

PERFORMANCE:
This will result in an overall increase of 2.7kb of render blocking
CSS, 1kb will be reclaimed when
I6c1ed1523df8cc9e2f2ca09506f12a595b8b013d is merged.

Co-author: Bernard Wang <bwang@wikimedia.org>
Bug: T336526
Change-Id: Ibd558238a41a0d3edb981e441638f9564f43d226
2023-06-12 16:26:28 -07:00
Ed Sanders fe6720c7f8 Remove config and AB test code for edit buttons in sticky header
Bug: T337955
Change-Id: I8ebeeca1712e335d886faa498849fcb3f7f6e1ab
2023-06-01 18:00:07 +01:00
jenkins-bot ef47d485d7 Merge "Cleanup skin.json and ToC template" 2023-05-21 10:04:36 +00:00
Umherirrender 0583639a6a tests: Make PHPUnit data providers static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: Ia03ad50ac5d34e9c012a8fad068adabd2e5d8669
2023-05-20 11:11:30 +02:00
Func 8c578a984e Cleanup skin.json and ToC template
The ConfigRegistry was removed as unused but somehow reintroduced
mistakenly in the commit 80b60c15.

The fallback to anchor for old parser cache should be good to drop.

Change-Id: I0b6effd0fd4c535298fa280da734b13d26a5d968
2023-05-17 22:15:37 +08:00
Jon Robson 0acb55fc8e Run A/B test enrollment code for any A/B test
Currently the A/B test enrollment code is limited to the
sticky header experiment. Instead of doing that, always check it
inside skin.js and run it if necessary.

Now it's possible for this to run twice, keep track of whether
the init function has been called and make sure it doesn't get called
more than once.

Bug: T335309
Change-Id: Icfef13b019319d07686a06e06846789faf790ed6
2023-05-11 14:36:42 -07:00
bwang 6f13caa775 Remove VectorTableOfContentsBeginning flag
Bug: T334969
Change-Id: I9e931b7cdc443e73a41c92f5368f81b35285437e
2023-05-08 22:25:03 +00:00
bwang d8bcb73647 Update user menu and watchstar buttons to be consistent with spec
Depends-on: Ibd762c810e1d89047e39ce3af792b43689bf11e3
Bug: T335909
Change-Id: I5b42780416b466cc3fc33d29220aef2979ac3239
2023-05-03 15:47:00 -07:00