mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-11 16:59:09 +00:00
Replace use of codex-styles in beta feature with CodexModule ResourceLoader
- Add new module 'skins.vector.search.codex.styles' to skin.json - Added 'skins.vector.search.codex.styles' to bundlesize.config.json - Replace the old styles module 'codex-search-styles' with the new one 'skins.vector.search.codex.styles' in skin.js Bug: T353844 Change-Id: If3cbcac64242c403b42811159882741fda132555
This commit is contained in:
parent
91ba3dec6d
commit
a8eb85f3d5
|
@ -18,6 +18,10 @@
|
||||||
"resourceModule": "codex-search-styles",
|
"resourceModule": "codex-search-styles",
|
||||||
"maxSize": "4.2 kB"
|
"maxSize": "4.2 kB"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceModule": "skins.vector.search.codex.styles",
|
||||||
|
"maxSize": "5.4 kB"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceModule": "skins.vector.styles",
|
"resourceModule": "skins.vector.styles",
|
||||||
"maxSize": "11.4 kB"
|
"maxSize": "11.4 kB"
|
||||||
|
|
|
@ -73,14 +73,9 @@ function main( window ) {
|
||||||
const clientPreferenceSelector = '#vector-client-prefs';
|
const clientPreferenceSelector = '#vector-client-prefs';
|
||||||
const clientPreferenceExists = document.querySelectorAll( clientPreferenceSelector ).length > 0;
|
const clientPreferenceExists = document.querySelectorAll( clientPreferenceSelector ).length > 0;
|
||||||
if ( clientPreferenceExists ) {
|
if ( clientPreferenceExists ) {
|
||||||
mw.loader.using( [ 'skins.vector.clientPreferences', 'codex-styles' ] ).then( () => {
|
mw.loader.using( [ 'skins.vector.clientPreferences', 'skins.vector.search.codex.styles' ] ).then( () => {
|
||||||
const clientPreferences = require( /** @type {string} */ ( 'skins.vector.clientPreferences' ) );
|
const clientPreferences = require( /** @type {string} */ ( 'skins.vector.clientPreferences' ) );
|
||||||
const clientPreferenceConfig = ( require( './clientPreferences.json' ) );
|
const clientPreferenceConfig = ( require( './clientPreferences.json' ) );
|
||||||
// FIXME: Loading codex-styles is a performance problem.
|
|
||||||
// This is only acceptable for logged in users so guard against unexpected use.
|
|
||||||
if ( mw.user.isAnon() ) {
|
|
||||||
throw new Error( 'T335317: Unexpected state expected. This will cause a performance problem.' );
|
|
||||||
}
|
|
||||||
// Can be removed once wgVectorNightMode is removed.
|
// Can be removed once wgVectorNightMode is removed.
|
||||||
if ( document.documentElement.classList.contains( 'vector-feature-night-mode-disabled' ) ) {
|
if ( document.documentElement.classList.contains( 'vector-feature-night-mode-disabled' ) ) {
|
||||||
// @ts-ignore issues relating to delete operator are not relevant here.
|
// @ts-ignore issues relating to delete operator are not relevant here.
|
||||||
|
|
11
skin.json
11
skin.json
|
@ -198,6 +198,17 @@
|
||||||
"skins.vector.user.styles": {
|
"skins.vector.user.styles": {
|
||||||
"class": "MediaWiki\\Skins\\Vector\\ResourceLoader\\VectorResourceLoaderUserStylesModule"
|
"class": "MediaWiki\\Skins\\Vector\\ResourceLoader\\VectorResourceLoaderUserStylesModule"
|
||||||
},
|
},
|
||||||
|
"skins.vector.search.codex.styles": {
|
||||||
|
"class": "MediaWiki\\ResourceLoader\\CodexModule",
|
||||||
|
"codexStyleOnly": true,
|
||||||
|
"codexComponents": [
|
||||||
|
"CdxTypeaheadSearch",
|
||||||
|
"CdxSearchInput",
|
||||||
|
"CdxButton",
|
||||||
|
"CdxRadio",
|
||||||
|
"CdxMessage"
|
||||||
|
]
|
||||||
|
},
|
||||||
"skins.vector.search": {
|
"skins.vector.search": {
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"mediawiki.Uri",
|
"mediawiki.Uri",
|
||||||
|
|
Loading…
Reference in a new issue