3 * https://www.mediawiki.org/wiki/OOUI
5 * Copyright 2011–2024 OOUI Team and other contributors.
6 * Released under the MIT license
7 * http://oojs.mit-license.org
9 * Date: 2024-12-05T17:34:41Z
17 * @extends OO.ui.Theme
21 OO.ui.WikimediaUITheme = function OoUiWikimediaUITheme() {
23 OO.ui.WikimediaUITheme.super.call( this );
28 OO.inheritClass( OO.ui.WikimediaUITheme, OO.ui.Theme );
35 OO.ui.WikimediaUITheme.prototype.getElementClasses = function ( element ) {
46 classes = OO.ui.WikimediaUITheme.super.prototype.getElementClasses.call( this, element );
49 element instanceof OO.ui.IconWidget &&
50 // eslint-disable-next-line no-jquery/no-class-state
51 element.$element.hasClass( 'oo-ui-checkboxInputWidget-checkIcon' )
53 // Icon on CheckboxInputWidget
54 variants.invert = true;
55 } else if ( element.supports( 'hasFlag' ) ) {
56 const isFramed = element.supports( 'isFramed' ) && element.isFramed();
57 const isActive = element.supports( 'isActive' ) && element.isActive();
59 // Check if the class exists, as classes that are not in the 'core' module may
61 ( OO.ui.Tool && element instanceof OO.ui.Tool ) ||
62 ( OO.ui.ToolGroup && element instanceof OO.ui.ToolGroup );
64 // Button with a dark background.
65 isFramed && ( isActive || element.isDisabled() || element.hasFlag( 'primary' ) ) ||
66 // Toolbar with a dark background.
67 isToolOrGroup && element.hasFlag( 'primary' )
69 // … use white icon / indicator, regardless of other flags
70 variants.invert = true;
71 } else if ( !isFramed && element.isDisabled() && !element.hasFlag( 'invert' ) ) {
72 // Frameless disabled button, always use black icon / indicator regardless of
74 variants.invert = false;
75 } else if ( !element.isDisabled() ) {
76 // Any other kind of button, use the right colored icon / indicator if available.
77 variants.progressive = element.hasFlag( 'progressive' ) ||
78 // Active tools/toolgroups
79 ( isToolOrGroup && isActive ) ||
80 // Pressed or selected outline/menu option widgets
83 element instanceof OO.ui.MenuOptionWidget ||
84 // Check if the class exists, as classes that are not in the 'core' module
87 OO.ui.OutlineOptionWidget &&
88 element instanceof OO.ui.OutlineOptionWidget
91 ( element.isPressed() || element.isSelected() )
94 variants.destructive = element.hasFlag( 'destructive' );
95 variants.invert = element.hasFlag( 'invert' );
96 variants.error = element.hasFlag( 'error' );
97 variants.warning = element.hasFlag( 'warning' );
98 variants.success = element.hasFlag( 'success' );
102 for ( const variant in variants ) {
103 classes[ variants[ variant ] ? 'on' : 'off' ].push( 'oo-ui-image-' + variant );
112 OO.ui.WikimediaUITheme.prototype.getDialogTransitionDuration = function () {
118 OO.ui.theme = new OO.ui.WikimediaUITheme();
122 //# sourceMappingURL=oojs-ui-wikimediaui.js.map.json