Additional release note for I495683
[mediawiki.git] / resources / ResourcesOOUI.php
blobd3b74f27c92796c3e0acc1b12c550cdcdfc28e27
1 <?php
2 /**
3 * Definition of OOjs UI ResourceLoader modules.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
23 if ( !defined( 'MEDIAWIKI' ) ) {
24 die( 'Not an entry point.' );
27 // WARNING: OOjs-UI is NOT TESTED with older browsers and is likely to break
28 // if loaded in browsers that don't support ES5
29 return call_user_func( function () {
30 $themes = ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' );
31 // We only use the theme names for file names, and they are lowercase
32 $themes = array_map( 'strtolower', $themes );
33 $themes['default'] = 'mediawiki';
35 $modules = array();
36 $modules['oojs-ui'] = array(
37 'scripts' => array(
38 'resources/lib/oojs-ui/oojs-ui.js',
39 'resources/src/oojs-ui-local.js',
41 'skinScripts' => array_combine(
42 array_keys( $themes ),
43 array_map( function ( $theme ) {
44 // TODO Allow extensions to specify this path somehow
45 return "resources/lib/oojs-ui/oojs-ui-$theme.js";
46 }, array_values( $themes ) )
48 'dependencies' => array(
49 'es5-shim',
50 'oojs',
51 'oojs-ui.styles',
52 'oojs-ui.styles.icons',
53 'oojs-ui.styles.indicators',
54 'oojs-ui.styles.textures',
55 'mediawiki.language',
57 'messages' => array(
58 'ooui-dialog-message-accept',
59 'ooui-dialog-message-reject',
60 'ooui-dialog-process-continue',
61 'ooui-dialog-process-dismiss',
62 'ooui-dialog-process-error',
63 'ooui-dialog-process-retry',
64 'ooui-outline-control-move-down',
65 'ooui-outline-control-move-up',
66 'ooui-outline-control-remove',
67 'ooui-selectfile-button-select',
68 'ooui-selectfile-dragdrop-placeholder',
69 'ooui-selectfile-not-supported',
70 'ooui-selectfile-placeholder',
71 'ooui-toolbar-more',
72 'ooui-toolgroup-collapse',
73 'ooui-toolgroup-expand',
75 'targets' => array( 'desktop', 'mobile' ),
77 $modules['oojs-ui.styles'] = array(
78 'position' => 'top',
79 'styles' => 'resources/src/oojs-ui-local.css', // HACK, see inside the file
80 'skinStyles' => array_combine(
81 array_keys( $themes ),
82 array_map( function ( $theme ) {
83 // TODO Allow extensions to specify this path somehow
84 return "resources/lib/oojs-ui/oojs-ui-$theme-noimages.css";
85 }, array_values( $themes ) )
87 'targets' => array( 'desktop', 'mobile' ),
90 $imageSets = array(
91 // Comments for greppability
92 'icons', // oojs-ui.styles.icons
93 'indicators', // oojs-ui.styles.indicators
94 'textures', // oojs-ui.styles.textures
95 'icons-accessibility', // oojs-ui.styles.icons-accessibility
96 'icons-alerts', // oojs-ui.styles.icons-alerts
97 'icons-content', // oojs-ui.styles.icons-content
98 'icons-editing-advanced', // oojs-ui.styles.icons-editing-advanced
99 'icons-editing-core', // oojs-ui.styles.icons-editing-core
100 'icons-editing-list', // oojs-ui.styles.icons-editing-list
101 'icons-editing-styling', // oojs-ui.styles.icons-editing-styling
102 'icons-interactions', // oojs-ui.styles.icons-interactions
103 'icons-layout', // oojs-ui.styles.icons-layout
104 'icons-location', // oojs-ui.styles.icons-location
105 'icons-media', // oojs-ui.styles.icons-media
106 'icons-moderation', // oojs-ui.styles.icons-moderation
107 'icons-movement', // oojs-ui.styles.icons-movement
108 'icons-user', // oojs-ui.styles.icons-user
109 'icons-wikimedia', // oojs-ui.styles.icons-wikimedia
111 $rootPath = 'resources/lib/oojs-ui/themes';
113 foreach ( $imageSets as $name ) {
114 $module = array(
115 'position' => 'top',
116 'class' => 'ResourceLoaderOOUIImageModule',
117 'name' => $name,
118 'rootPath' => $rootPath,
121 if ( substr( $name, 0, 5 ) === 'icons' ) {
122 $module['selectorWithoutVariant'] = '.oo-ui-icon-{name}, .mw-ui-icon-{name}:before';
123 $module['selectorWithVariant'] = '
124 .oo-ui-image-{variant}.oo-ui-icon-{name}, .mw-ui-icon-{name}-{variant}:before,
125 /* Hack for Flow, see T110051 */
126 .mw-ui-hovericon:hover .mw-ui-icon-{name}-{variant}-hover:before,
127 .mw-ui-hovericon.mw-ui-icon-{name}-{variant}-hover:hover:before';
130 $modules["oojs-ui.styles.$name"] = $module;
133 return $modules;
134 } );