Commit graph

788 commits

Author SHA1 Message Date
Jon Robson 530b7fd900 Main menu should link to EditWatchlist by default for users that haven't edited
This moves poorly documented logic from MobileFrontend to Minerva.

Bug: T362338
Change-Id: I7d73044ad26b089c7225a4a5be6772398946b9f8
2024-04-17 23:31:31 +00:00
Fomafix 3bae52817b Fix HTML errors reported by Firefox view-source
* Add missing spaces between attributes.
* Remove duplicate attributes.
* Remove unnecessary spaces and newlines.

Change-Id: Ia688234712f24f20cb1b45496f4736a98e69b00f
2024-04-15 22:51:21 +00:00
jenkins-bot 1f0a94241c Merge "Replace WebRequest::getText and ::getVal by ::getRawVal or ::getCheck" 2024-04-09 22:36:34 +00:00
Moh'd Khier Abualruz cd95f34687 Replace codex-search-styles with CodexModule
Enhance MinervaNeue Skin with Codex Integration and Style Refinements. This update to the MinervaNeue skin introduces enhancements aimed at integrating with Codex UI components and the optimisation of skin-specific styles. These changes are in direct response to the objectives set forth in Phabricator task T356678, focusing on modernising the skin's aesthetics and functionality.

Changes:
- Enhanced skin.json to include new 'scripts' and 'styles' configurations, incorporating Codex UI components such as 'CdxButton' and a variety of Minerva-specific styles like 'skins.minerva.base.styles' and 'skins.minerva.content.styles.images'.
- Refined `includes/Skins/SkinMinerva.php` by restructuring the method of loading skin and feature-specific styles. The update simplifies style management, allowing for a more granular approach to style application. This includes separating page-specific styles from feature-specific styles.

Rationale:
The implementation of Codex UI components within the MinervaNeue skin is to leverage modern web design principles, enhancing usability and aesthetic appeal. By refining the skin's style loading mechanism, we aim to at least maintain if not reduce the overhead, improve page load times, and offer a more customisable appearance, ultimately benefiting both end-users and developers.

Bug: T356678
Change-Id: Ia96f58397c23126e940cc9263b30e0da88c90a29
2024-04-03 13:28:02 +00:00
Fomafix 6f30044448 Replace WebRequest::getText and ::getVal by ::getRawVal or ::getCheck
The Unicode and line break normalizations are not needed here.

Change-Id: I4aebc32c938fde8e1b086325d18d72df66ca870f
2024-03-29 12:59:20 +00:00
Fomafix 05eb2ac47d Integrate service 'Minerva.Menu.MainDirector' into SkinMinerva
The service 'Minerva.Menu.MainDirector' is bad because it depends
on the global state.

Change-Id: I170653006356932ecdd909b14c193f42c4a5f511
2024-03-28 17:33:18 +00:00
Fomafix c50069252d Integrate service 'Minerva.Menu.UserMenuDirector' into SkinMinerva
The service 'Minerva.Menu.UserMenuDirector' is bad because it depends
on the global state.

Change-Id: Ife13188745b39844356e7976379582d5f451f5a3
2024-03-28 17:32:42 +00:00
Fomafix 5027a28fc1 Definitions: Remove global state parameter from constructor
Move global state parameter to new method setContext.

Change-Id: I07833f60e2796396c3c35776bd7d788d93eb114b
2024-03-28 17:31:13 +00:00
Fomafix 0dbe920285 Remove unused service UserOptionsLookup from Definitions
Also use typed properties instead of @var types.

And rename $factory to $specialPageFactory.

Change-Id: I7fe5a8ad96e619019c1bbbb9143ad09174a9de5e
2024-03-28 17:30:45 +00:00
Fomafix 86fb2a8d18 Inject service 'Minerva.SkinUserPageHelper'
Change-Id: I91d8066ea860bd4aa5f19f4c326fad032be5b9d0
2024-03-28 17:30:01 +00:00
Fomafix 0adbe80280 Use service 'Minerva.SkinUserPageHelper' in SkinOptions
Change-Id: I014e61c6692adbbe449f1e6aa9c6ae73dbcff925
2024-03-28 17:27:45 +00:00
Fomafix f8b8a83dc5 SkinUserPageHelper: Use alphabetical order of the parameters
Change-Id: I2bce7abfa2740ca7f3fb87968462cdc8eacbde7d
2024-03-28 15:20:36 +00:00
Fomafix 1c26798431 SkinUserPageHelper: Remove global state from constructor
* Move global state parameters to new methods setContext and setTitle.

This change solves the circular dependency error for service
'SkinUserPageHelper'. The service will used in SkinOptions in the
follow-up change I014e61c6692adbbe449f1e6aa9c6ae73dbcff925.

Change-Id: I80342e5168435c5318c378e2ac8a9a3c7a28eb4c
2024-03-28 13:10:48 +00:00
Fomafix 220bf6ff89 Inject service 'Minerva.LanguagesHelper' into SkinMinerva
Change-Id: Ie81195f31194bab819491576681b02660ec057b4
2024-03-25 22:36:07 +00:00
Fomafix f68b218076 LanguagesHelper: Move $out from contructor to doesTitleHasLanguagesOrVariants
Services MUST NOT vary their behaviour on global state, especially not
WebRequest, RequestContext (T218555).

Change-Id: I4b73ef713166d8b254023c1eebbb45c963880a99
2024-03-25 22:34:37 +00:00
Fomafix 57d1f15d64 Inject service 'Minerva.Permissions' into SkinMinerva
Change-Id: Ie68691d7030ea622f2bc232fea2df49b70484e19
2024-03-25 21:44:13 +00:00
Fomafix 11c0e6966b Avoid setContext in ServiceWiring for Minerva.Permissions
This change avoids a duplicate setContext in SkinMinerva.

Change-Id: I4b716a645bb2b6a5c05aa6e9a463640a2d87ab41
2024-03-25 21:43:50 +00:00
Fomafix 999f04c366 Inject service 'Minerva.SkinOptions' into SkinMinerva
Change-Id: Ia7e7660c55e16731366bdf6332d5237188e9bbb1
2024-03-25 13:17:32 +00:00
Fomafix 1f3fc12bb4 Improve variables
* Remove unused private properties.
* Remove unused variable.
* Inline variable used only once.

Change-Id: I7fcab8328264384335371a152c3f3cd4548c4210
2024-03-25 13:09:17 +00:00
Fomafix 5d27b4ff3e Use Html::element instead of Html::rawElement and htmlspecialchars
Remove the comment about the reason for output encoding. Output
encoding is standard and doesn't require an explanation.

Change-Id: Ia2df4c95dca8aedca70be2f3b3827498de1f2030
2024-03-25 09:32:30 +00:00
Jon Robson c2623ed44f Add soft dependency on Minerva to Vector
Bug: T359607
Change-Id: If293689999a54f067792d172441c7c47d0992ed9
2024-03-21 21:05:47 +00:00
Moh'd Khier Abualruz 5d6b866890 Rename the skin night mode classes to more readable classes
The classes:
- skin-night-mode-clientpref-0
- skin-night-mode-clientpref-1
- skin-night-mode-clientpref-2
is being replaced with
- skin-theme-clientpref-day
- skin-theme-clientpref-night
- skin-theme-clientpref-os
- Moved $forceNightMode to be a text parameter (dat|night|os)
- Keep adding the old classes to the html element, to give the ability of gradual deployment

The preference is renamed from minerva-night-mode to minerva-theme (a follow up to consider
migrating existing values will follow).

The query string minervanightmode continues to behave the same but now
accepts other values such as day, night and os.

Bug: T359983
Change-Id: Ia253de68f94236e7fe2219b736dd6084c64ce838
2024-03-19 23:12:59 +00:00
jenkins-bot f2fc042b7e Merge "Fix Issue with localization of special page titles in exclusion logic" 2024-03-13 14:59:39 +00:00
Jon Robson 06463592b4 Fix Issue with localization of special page titles in exclusion logic
The fixSpecialName function does the opposite of what we want - it takes
a special page and converts it to the local name using getLocalNameFor
Instead of doing that map canonicalTitle to a Title created using the canonical
name.

This requires less computation than localizing every title in the pagetitles array.

Bug: T359958
Change-Id: Ied3ed927202dd9356ebeb7e404230f571a1d910d
2024-03-13 15:33:52 +01:00
Fomafix 3fc7f0d542 Inject service Minerva.SkinOptions into Hooks and MobileFrontendHooks
Change-Id: Id343ae4cb8d1a73cfb647bfe440f2909e3835037
2024-03-12 19:44:53 +00:00
Fomafix b9eca74ff0 Use "optional_services" in skin.json
Change-Id: Idab8a934e4c8f547d018907cb427effcab1d0f3f
2024-03-12 19:44:06 +00:00
jenkins-bot 5b9fcf1260 Merge "Move Hooks::setMinervaSkinOptions to class SkinOptions" 2024-03-11 23:15:42 +00:00
jenkins-bot df7c22088c Merge "Fix casing of dropdown-related less file" 2024-03-11 13:41:03 +00:00
Umherirrender 88b78b247c build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: I693651564cc544b881e1a45ea8abeff8d58d8fb6
2024-03-11 00:34:07 +01:00
Fomafix 52dd233f5e Move Hooks::setMinervaSkinOptions to class SkinOptions
This allows to inject the services.

Change-Id: If091c7c5df2d498cdb7d82db89876dab8a82c3fc
2024-03-09 22:34:28 +00:00
Umherirrender e82d8e7121 Fix casing of dropdown-related less file
Follow-Up: Ifda13ba9dee316709c424636ec3b285de8d0e9b1
Change-Id: I4c310770af6039cfa7931f4319571c77d35b9ef6
2024-03-09 15:45:32 +01:00
jenkins-bot 201cad0f66 Merge "Inject service LanguageConverterFactory in LanguagesHelper" 2024-03-08 20:44:55 +00:00
Fomafix fd0e6d4e4c Implement PreferencesGetLayoutHook
Change-Id: Iccf0fa1ba5b4c547a221f2d152f0f387f04848a2
2024-03-03 14:40:39 +00:00
Fomafix 52583a336d Inject service LanguageConverterFactory in LanguagesHelper
Change-Id: I2fd1b4c3b25a94cca59d08216390652759859a62
2024-03-03 13:00:31 +00:00
jenkins-bot a46ac64378 Merge "Inject services in SkinMinerva" 2024-03-01 19:24:58 +00:00
jenkins-bot 1067ea5a2c Merge "Inject service UserIdentityUtils in DefaultMainMenuBuilder" 2024-03-01 19:01:43 +00:00
jenkins-bot ff82ad0428 Merge "Inject services in Hooks and MobileFrontendHooks" 2024-03-01 18:58:40 +00:00
Fomafix 4e6c1a87b3 Inject services in SkinMinerva
Change-Id: I17ae52ab9bb251a501d9de38f8a7051118f9622e
2024-02-29 21:34:15 +00:00
Fomafix e812a6b727 Improve PHP code style
* Remove phpcs rule exception
  MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment.
* Update or remove the comments not matching the rule.
* Fix double tab indention.

Change-Id: I68c43fe0db9384edfaaf64a155e904d629c7ade1
2024-02-28 08:59:17 +00:00
Fomafix 2d65be33ab Inject service UserIdentityUtils in DefaultMainMenuBuilder
Change-Id: I5f21dac80707a0dbc81ee8910feee74108363624
2024-02-27 14:48:47 +00:00
Fomafix 0f8800ac42 Inject services in Hooks and MobileFrontendHooks
Change-Id: I8e0673689c2dbe14a385bbd1fe1725d203386bde
2024-02-27 10:15:03 +00:00
Fomafix 3bb9611497 Replace global variable by config
Use $this->overrideConfigValues instead of $this->setMwGlobals in the
test.

Change-Id: I1ae238235476a001683ea81d2b65d209a2774549
2024-02-27 06:45:34 +00:00
Fomafix 248180ef03 Inject service WatchlistManager into MinervaPagePermissions
Change-Id: Id41c85c8e119efbf9814be25ba659f1da1151eb4
2024-02-26 07:53:03 +00:00
Jon Robson b079031b0a Send a toast notification if night mode is not available
Add a skin-night-mode-page-disabled class to the HTML element when
a page was disabled by the new MinervaNightModeOptions configuration
flag.

Bug: T356653
Change-Id: I7a6582ef8f66e78cc6f07da06bc4d2a3277cfcf0
2024-02-14 01:51:23 +00:00
libraryupgrader b7cc09b4a3 build: Updating mediawiki/mediawiki-phan-config to 0.14.0
Change-Id: Ib3c5f368f8205728cec4e28c3b832fdc6060a093
2024-02-10 16:03:06 +00:00
jenkins-bot 8dbb6d0be6 Allow pages to not appear in night mode
- Add config to skin.json
- Add the function in SkinMinerva.php to check exclusion of pages and namespaces.

Bug: T355705
Change-Id: I0fa0eab3bfa57cc6864dbdd2d6aeaa5582767c3c
2024-02-08 21:28:14 +01:00
Steph Toyofuku 573ac59dc5 Query params can set night mode value
Whereas previously, the value of the query param would simply determine
whether or not night mode was enabled, we would like to be able to
control the actual night mode setting off of the query param

Now, it functions as an option to force the user into a particular
setting, be it automatic, night, or day.  If the query param is not set
(if night mode is enabled via config), we will default to the user
option as before

Bug: T355118
Change-Id: I38ed94bfc1b80d0a827c63c6dbdd92eb6f1bf531
2024-02-05 14:45:49 -08:00
Steph Toyofuku ef46f238a7 Set up user option for night mode
Add a new user option, `minerva-night-mode`, and configure it with a
default value of 2 (automatic based on OS).  Rework the code in
`getHtmlElementAttributes` to set the initial class value according to
the user option, which will be set and saved inside of MobileFrontend

Bug: T355118
Change-Id: I4b0d63a186f490ba10b7655b3af4dcb8b64bd400
2024-02-02 13:28:35 -08:00
Jan Drewniak 59fd0cd5dc Convert all color related Less variables to CSS custom properties
All colors used in Minerva are converted from Less variables
into CSS custom properties. A new file called CSSCustomProperties.less
is created in the skins.minerva.base.styles module to store
these custom properties and an ADR is provided on the rationale for
dropping support for browsers that don't support custom properties.

The new CSS custom properties follow Codex design token conventions
where possible (and noted when not).

Link colors are unique because their styles are defined in core,
so in that case the Less variables values are set to custom properties.
Those values are then fed back into MediaWiki core for core link
styling.

Also adds a temporary night-mode color palette under the
.skin-nightmode-1 class on the <html> element.

Bug: T356074
Change-Id: Ida1f14138f12bd3c600c264bde7b5100f9dbf4ff
2024-02-02 17:57:27 +00:00
Jan Drewniak be0b43042e Convert Less variable names from camelCase to snake-case
Converts all Less variable names from CamelCase to snake-case
per the MediaWiki coding conventions.

Removes the following unused Less variables, mostly
related to icons, since those were converted to Codex:
- @icon-touch-area-sm
- @icon-touch-area-md
- @min-size-icon (replaced with @size-icon-medium)
- @icon-glyph-size-sm
- @icon-size-sm
- @icon-padding-sm
- @icon-glyph-size-md
- @icon-size-md
- @margin-icon-md-labelled

Bug: T350581
Change-Id: I1b16e77942d9bea20dcc5636a63d64aa2325a173
2024-01-31 15:24:31 -08:00