Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Constants
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2namespace MediaWiki\Skins\Vector;
3
4use MediaWiki\Exception\FatalError;
5
6/**
7 * A namespace for Vector constants for internal Vector usage only. **Do not rely on this file as an
8 * API as it may change without warning at any time.**
9 * @package Vector
10 * @internal
11 */
12final class Constants {
13    /**
14     * This is tightly coupled to the ValidSkinNames field in skin.json.
15     * @var string
16     */
17    public const SKIN_NAME_MODERN = 'vector-2022';
18
19    /**
20     * This is tightly coupled to the ValidSkinNames field in skin.json.
21     * @var string
22     */
23    public const SKIN_NAME_LEGACY = 'vector';
24
25    // These are used to provide different default skin for new users.
26    /**
27     * @var string
28     */
29    public const SKIN_VERSION_LEGACY = '1';
30    /**
31     * @var string
32     */
33    public const SKIN_VERSION_LATEST = '2';
34
35    // These are tightly coupled to skin.json's configs. See skin.json for documentation.
36    /**
37     * @var string
38     */
39    public const CONFIG_KEY_DEFAULT_SKIN_VERSION_FOR_NEW_ACCOUNTS =
40        'VectorDefaultSkinVersionForNewAccounts';
41
42    /**
43     * @var string
44     */
45    public const PREF_KEY_SKIN = 'skin';
46
47    // These are used in the Feature Management System.
48    /**
49     * Also known as `$wgFullyInitialised`. Set to true in core/includes/Setup.php.
50     * @var string
51     */
52    public const CONFIG_KEY_FULLY_INITIALISED = 'FullyInitialised';
53
54    /**
55     * @var string
56     */
57    public const REQUIREMENT_FULLY_INITIALISED = 'FullyInitialised';
58
59    /**
60     * @var string
61     */
62    public const REQUIREMENT_LOGGED_IN = 'LoggedIn';
63
64    /**
65     * @var string
66     */
67    public const FEATURE_LANGUAGE_IN_HEADER = 'LanguageInHeader';
68
69    /**
70     * @var string
71     */
72    public const CONFIG_KEY_LANGUAGE_IN_HEADER = 'VectorLanguageInHeader';
73
74    /**
75     * @var string
76     */
77    public const REQUIREMENT_LANGUAGE_IN_HEADER = 'LanguageInHeader';
78
79    /**
80     * The `mediawiki.searchSuggest` protocol piece of the SearchSatisfaction instrumention reads
81     * the value of an element with the "data-search-loc" attribute and set the event's
82     * `inputLocation` property accordingly.
83     *
84     * When the search widget is moved as part of the "Search 1: Search widget move" feature, the
85     * "data-search-loc" attribute is set to this value.
86     *
87     * See also:
88     * - https://www.mediawiki.org/wiki/Reading/Web/Desktop_Improvements/Features#Search_1:_Search_widget_move
89     * - https://phabricator.wikimedia.org/T261636 and https://phabricator.wikimedia.org/T256100
90     * - https://gerrit.wikimedia.org/g/mediawiki/core/+/61d36def2d7adc15c88929c824b444f434a0511a/resources/src/mediawiki.searchSuggest/searchSuggest.js#106
91     *
92     * @var string
93     */
94    public const SEARCH_BOX_INPUT_LOCATION_MOVED = 'header-moved';
95
96    /**
97     * Similar to `Constants::SEARCH_BOX_INPUT_LOCATION_MOVED`, when the search widget hasn't been
98     * moved, the "data-search-loc" attribute is set to this value.
99     *
100     * @var string
101     */
102    public const SEARCH_BOX_INPUT_LOCATION_DEFAULT = 'header-navigation';
103
104    /**
105     * @var string
106     */
107    public const REQUIREMENT_IS_MAIN_PAGE = 'IsMainPage';
108
109    /**
110     * @var string
111     */
112    public const REQUIREMENT_LANGUAGE_IN_MAIN_PAGE_HEADER = 'LanguageInMainPageHeader';
113
114    /**
115     * @var string
116     */
117    public const CONFIG_LANGUAGE_IN_MAIN_PAGE_HEADER = 'VectorLanguageInMainPageHeader';
118
119    /**
120     * @var string
121     */
122    public const FEATURE_LANGUAGE_IN_MAIN_PAGE_HEADER = 'LanguageInMainPageHeader';
123
124    /**
125     * @var string
126     */
127    public const FEATURE_PAGE_TOOLS_PINNED = 'PageToolsPinned';
128
129    /**
130     * @var string
131     */
132    public const REQUIREMENT_PAGE_TOOLS_PINNED = 'PageToolsPinned';
133
134    /**
135     * @var string
136     */
137    public const PREF_KEY_PAGE_TOOLS_PINNED = 'vector-page-tools-pinned';
138
139    /**
140     * @var string
141     */
142    public const REQUIREMENT_TOC_PINNED = 'TOCPinned';
143
144    /**
145     * @var string
146     */
147    public const PREF_KEY_TOC_PINNED = 'vector-toc-pinned';
148
149    /**
150     * @var string
151     */
152    public const FEATURE_TOC_PINNED = 'TOCPinned';
153
154    /**
155     * @var string
156     */
157    public const FEATURE_MAIN_MENU_PINNED = 'MainMenuPinned';
158
159    /**
160     * @var string
161     */
162    public const REQUIREMENT_MAIN_MENU_PINNED = 'MainMenuPinned';
163
164    /**
165     * @var string
166     */
167    public const PREF_KEY_MAIN_MENU_PINNED = 'vector-main-menu-pinned';
168
169    /**
170     * @var string
171     */
172    public const FEATURE_LIMITED_WIDTH = 'LimitedWidth';
173
174    /**
175     * @var string
176     */
177    public const REQUIREMENT_LIMITED_WIDTH = 'LimitedWidth';
178
179    /**
180     * @var string
181     */
182    public const PREF_KEY_LIMITED_WIDTH = 'vector-limited-width';
183
184    /**
185     * @var string
186     */
187    public const FEATURE_LIMITED_WIDTH_CONTENT = 'LimitedWidthContent';
188
189    /**
190     * @var string
191     */
192    public const REQUIREMENT_LIMITED_WIDTH_CONTENT = 'LimitedWidthContent';
193
194    /**
195     * @var bool
196     */
197    public const CONFIG_DEFAULT_LIMITED_WIDTH = 1;
198
199    /**
200     * @var string
201     */
202    public const PREF_KEY_FONT_SIZE = 'vector-font-size';
203
204    /**
205     * @var string
206     */
207    public const FEATURE_FONT_SIZE = 'CustomFontSize';
208
209    /**
210     * @var string
211     */
212    public const REQUIREMENT_FONT_SIZE = 'CustomFontSize';
213
214    /**
215     * @var string
216     */
217    public const FEATURE_APPEARANCE_PINNED = 'AppearancePinned';
218
219    /**
220     * @var string
221     */
222    public const REQUIREMENT_APPEARANCE_PINNED = 'AppearancePinned';
223
224    /**
225     * @var string
226     */
227    public const PREF_KEY_APPEARANCE_PINNED = 'vector-appearance-pinned';
228
229    /**
230     * @var string
231     */
232    public const CONFIG_KEY_NIGHT_MODE = 'VectorNightMode';
233
234    /**
235     * @var string
236     */
237    public const FEATURE_NIGHT_MODE = 'NightMode';
238
239    /**
240     * @var string
241     */
242    public const REQUIREMENT_NIGHT_MODE = 'NightMode';
243
244    /**
245     * @var string
246     */
247    public const PREF_KEY_NIGHT_MODE = 'vector-theme';
248
249    /**
250     * @var string
251     */
252    public const REQUIREMENT_PREF_NIGHT_MODE = 'PrefNightMode';
253
254    /**
255     * @var string
256     */
257    public const PREF_NIGHT_MODE = 'PrefNightMode';
258
259    /**
260     * @var string
261     */
262    public const VECTOR_2022_BETA_KEY = 'vector-2022-beta-feature';
263
264    /**
265     * @var array
266     */
267    public const VECTOR_BETA_FEATURES = [
268        self::CONFIG_KEY_NIGHT_MODE,
269    ];
270
271    /**
272     * This class is for namespacing constants only. Forbid construction.
273     * @throws FatalError
274     * @return never
275     */
276    private function __construct() {
277        throw new FatalError( "Cannot construct a utility class." );
278    }
279}