Remove skins.minerva.icons.images.variants module

This module produces 6 icons:

["clock", "profile"] * ["black", "gray", "white"]

of which only 3 are needed: clock-gray, clock-white, profile-gray.

This patch removes the module and moves the "clock" and "profile"
icons into `skins.minerva.icons.images`. Since that module
does not inline SVG's, the additional cost of adding these icons,
which are loaded at startup, is minimal.

The editLocked.svg icon has also been edited to correct its color.

Bug: T218807
Change-Id: Ib54960eb556dfe0c1ae06d2f73d4f350e519e20f
This commit is contained in:
Jan Drewniak 2019-03-21 15:50:23 +01:00 committed by jdlrobson
parent 6ed4d4557c
commit 6d34e401ff
10 changed files with 22 additions and 34 deletions

View File

@ -160,7 +160,6 @@ class MinervaHooks {
switch ( $name ) {
case 'MobileMenu':
$out->addModuleStyles( [
'skins.minerva.icons.images.variants',
'skins.minerva.mainMenu.icons',
'skins.minerva.mainMenu.styles',
] );

View File

@ -114,7 +114,7 @@ class MinervaTemplate extends BaseTemplate {
$action = Action::getActionName( RequestContext::getMain() );
if ( isset( $data['historyLink'] ) && $action === 'view' ) {
$args = [
'clockIconClass' => MinervaUI::iconClass( 'clock-gray', 'before' ),
'clockIconClass' => MinervaUI::iconClass( 'clock', 'before' ),
'arrowIconClass' => MinervaUI::iconClass(
'arrow-gray', 'element', 'mw-ui-icon-small mf-mw-ui-icon-rotate-anti-clockwise indicator',
// Uses icon in MobileFrontend so must be prefixed mf.

View File

@ -730,7 +730,7 @@ class SkinMinerva extends SkinTemplate {
->addComponent(
$username,
Title::newFromText( $username, NS_USER )->getLocalUrl(),
MinervaUI::iconClass( 'profile-gray', 'before', 'truncated-text primary-action' ),
MinervaUI::iconClass( 'profile', 'before', 'truncated-text primary-action' ),
[ 'data-event-name' => 'profile' ]
)
->addComponent(
@ -1279,7 +1279,7 @@ class SkinMinerva extends SkinTemplate {
*/
protected function getHistoryPageAction() {
return [
'class' => MinervaUI::iconClass( 'clock-gray' ),
'class' => MinervaUI::iconClass( 'clock' ),
'text' => $this->msg( 'mobile-frontend-history' ),
'href' => $this->getHistoryUrl( $this->getTitle() )
];
@ -1459,7 +1459,7 @@ class SkinMinerva extends SkinTemplate {
'mediawiki.hlist',
'mediawiki.ui.icon',
'mediawiki.ui.button',
'skins.minerva.icons.images',
'skins.minerva.icons.images'
];
if ( $title->isMainPage() ) {
$styles[] = 'skins.minerva.mainPage.styles';

View File

@ -1 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 -407 24 24"><path d="M21.348-401.268q.94 0 1.61.668l.92.922-11.858 11.86L.198-399.66l.922-.94q.65-.686 1.59-.686.94 0 1.61.668l7.718 7.7 7.7-7.682q.67-.668 1.61-.668z"/></svg>

Before

Width:  |  Height:  |  Size: 287 B

View File

@ -1 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 13c-5.9 0-8 3-8 5v3h16v-3c0-2-2.1-5-8-5z"/><circle cx="12" cy="7.5" r="4.5"/></svg>

Before

Width:  |  Height:  |  Size: 217 B

View File

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 489 B

View File

@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g id="Page-1" fill="none" fill-rule="evenodd"><g id="edit-locked" fill="#72777d"><path d="M14 15h.75l-7 7H3v-4.75l9-9V13a2 2 0 0 0 2 2zm7.036-8c.532 0 .964.432.964.964v4.072a.965.965 0 0 1-.964.964h-6.072a.965.965 0 0 1-.964-.964V7.964c0-.532.432-.964.964-.964h.536V5.5S15.5 3 18 3s2.5 2.5 2.5 2.5V7h.536zM19.5 7V5.75C19.5 5 19.5 4 18 4s-1.5 1-1.5 1.75V7h3zM18 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></g></g></svg>
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g id="Page-1" fill="none" fill-rule="evenodd"><g id="edit-locked" fill="#54595d"><path d="M14 15h.75l-7 7H3v-4.75l9-9V13a2 2 0 0 0 2 2zm7.036-8c.532 0 .964.432.964.964v4.072a.965.965 0 0 1-.964.964h-6.072a.965.965 0 0 1-.964-.964V7.964c0-.532.432-.964.964-.964h.536V5.5S15.5 3 18 3s2.5 2.5 2.5 2.5V7h.536zM19.5 7V5.75C19.5 5 19.5 4 18 4s-1.5 1-1.5 1.75V7h3zM18 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></g></g></svg>

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 531 B

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#54595d" d="M12 13c-5.9 0-8 3-8 5v3h16v-3c0-2-2.1-5-8-5z"/><circle fill="#54595d" cx="12" cy="7.5" r="4.5"/></svg>

After

Width:  |  Height:  |  Size: 247 B

View File

@ -169,10 +169,8 @@
if ( time.isRecent( delta ) ) {
$bar = $lastModifiedLink.closest( '.last-modified-bar' );
$bar.addClass( 'active' );
// in beta update icons to be inverted
$bar.find( '.mw-ui-icon' ).each( function () {
$( this ).attr( 'class', $( this ).attr( 'class' ).replace( '-gray', '-invert' ) );
} );
$bar.find( '.mw-ui-icon-minerva-clock' ).addClass( 'mw-ui-icon-minerva-clock-invert' );
$bar.find( '.mw-ui-icon-mf-arrow-gray' ).addClass( 'mw-ui-icon-mf-arrow-invert' );
}
msg = time.getLastModifiedMessage( ts, username, gender, historyUrl );
$lastModifiedLink.replaceWith( msg );

View File

@ -228,8 +228,16 @@
},
"skins.minerva.icons.images": {
"class": "ResourceLoaderImageModule",
"selector": ".mw-ui-icon-minerva-{name}:before",
"selectorWithoutVariant": ".mw-ui-icon-minerva-{name}:before",
"selectorWithVariant": ".mw-ui-icon-minerva-{name}-{variant}:before",
"useDataURI": false,
"defaultColor": "#54595d",
"variants": {
"invert": {
"color": "#fff",
"global": false
}
},
"images": {
"watch": "resources/skins.minerva.icons.images/watch.svg",
"watched": "resources/skins.minerva.icons.images/watched.svg",
@ -237,26 +245,12 @@
"mainmenu": "resources/skins.minerva.icons.images/hamburger.svg",
"edit": "resources/skins.minerva.icons.images/editLocked.svg",
"edit-enabled": "resources/skins.minerva.icons.images/edit.svg",
"language-switcher": "resources/skins.minerva.icons.images/languageSwitcher.svg"
}
},
"skins.minerva.icons.images.variants": {
"selectorWithoutVariant": ".mw-ui-icon-minerva-{name}:before",
"selectorWithVariant": ".mw-ui-icon-minerva-{name}-{variant}:before",
"class": "ResourceLoaderImageModule",
"variants": {
"gray": {
"color": "#54595d",
"global": true
},
"invert": {
"color": "#fff",
"global": true
"language-switcher": "resources/skins.minerva.icons.images/languageSwitcher.svg",
"profile": "resources/skins.minerva.icons.images/profile.svg",
"clock": {
"file": "resources/skins.minerva.icons.images/clock.svg",
"variants": [ "invert" ]
}
},
"images": {
"profile": "resources/skins.minerva.icons.images.variants/profile.svg",
"clock": "resources/skins.minerva.icons.images.variants/clock.svg"
}
},
"skins.minerva.icons.images.scripts": {
@ -372,7 +366,6 @@
"desktop"
],
"dependencies": [
"skins.minerva.icons.images.variants",
"skins.minerva.mainMenu.icons",
"skins.minerva.mainMenu.styles",
"jquery.cookie",
@ -533,7 +526,6 @@
],
"dependencies": [
"mobile.startup",
"skins.minerva.icons.images.variants",
"skins.minerva.scripts"
],
"scripts": [