@mui/system 5.10.6 → 5.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -0
- package/colorManipulator.js +1 -1
- package/createTheme/shape.d.ts +1 -1
- package/cssVars/createCssVarsProvider.d.ts +8 -0
- package/cssVars/createCssVarsProvider.js +11 -1
- package/cssVars/cssVarsParser.d.ts +1 -1
- package/cssVars/getInitColorSchemeScript.d.ts +5 -3
- package/cssVars/getInitColorSchemeScript.js +3 -3
- package/esm/colorManipulator.js +1 -1
- package/esm/cssVars/createCssVarsProvider.js +11 -1
- package/esm/cssVars/getInitColorSchemeScript.js +3 -3
- package/index.js +1 -1
- package/legacy/colorManipulator.js +1 -1
- package/legacy/cssVars/createCssVarsProvider.js +11 -1
- package/legacy/cssVars/getInitColorSchemeScript.js +3 -3
- package/legacy/index.js +1 -1
- package/modern/colorManipulator.js +1 -1
- package/modern/cssVars/createCssVarsProvider.js +11 -1
- package/modern/cssVars/getInitColorSchemeScript.js +3 -3
- package/modern/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.10.7
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.10.6..master -->
|
|
6
|
+
|
|
7
|
+
_Sep 26, 2022_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 21 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🚀 [Divider](https://mui.com/joy-ui/react-divider/) component is added to Joy UI (#34403) @siriwatknp
|
|
12
|
+
|
|
13
|
+
### `@mui/material@5.10.7`
|
|
14
|
+
|
|
15
|
+
- [CssVarsProvider] Exclude dark mode variables from `:root` stylesheet (#34131) @siriwatknp
|
|
16
|
+
- [Chip] Add chip classes (#33801) @pratikkarad
|
|
17
|
+
- [Slider] Fix typo in the comments in the source (#34452) @HexM7
|
|
18
|
+
- [SvgIcon] Fix passing an ownerState to SvgIcon changes the font size (#34429) @ZeeshanTamboli
|
|
19
|
+
- [Stepper] Fix optional label is not centered when `alternativeLabel` is used (#34335) @ZeeshanTamboli
|
|
20
|
+
- [Tooltip] Add undefined, null or false in `title` (#34289) @abhinav-22-tech
|
|
21
|
+
- Make @emotion/\* fully supported in all Material UI components (#34451) @garronej
|
|
22
|
+
|
|
23
|
+
### `@mui/system@5.10.7`
|
|
24
|
+
|
|
25
|
+
- [system] Fix parsing of hsla colors in getLuminance (#34437) @ptrfrncsmrph
|
|
26
|
+
- [system] Fix incorrect type of `shape.borderRadius` in theme (#34076) @ZeeshanTamboli
|
|
27
|
+
- [system] Replace `enableSystem` with `defaultMode` (#33960) @siriwatknp
|
|
28
|
+
|
|
29
|
+
### `@mui/material@5.0.0-alpha.101`
|
|
30
|
+
|
|
31
|
+
- [deps] Move @mui/types to dependencies (#34384) @Methuselah96
|
|
32
|
+
|
|
33
|
+
### `@mui/base@5.0.0-alpha.99`
|
|
34
|
+
|
|
35
|
+
#### Breaking changes
|
|
36
|
+
|
|
37
|
+
- [TrapFocus] Rename TrapFocus to FocusTrap (#34216) @kabernardes
|
|
38
|
+
|
|
39
|
+
```diff
|
|
40
|
+
- import TrapFocus from ‘@mui/base/TrapFocus’;
|
|
41
|
+
+ import FocusTrap from ‘@mui/base/FocusTrap’;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Changes
|
|
45
|
+
|
|
46
|
+
- [MultiSelect] Require a single tap to select an item on mobile Chrome (#33932) @michaldudak
|
|
47
|
+
|
|
48
|
+
### `@mui/joy@5.0.0-alpha.47`
|
|
49
|
+
|
|
50
|
+
- [Checkbox] spread `value`, `required`, and `readOnly` to input (#34477) @siriwatknp
|
|
51
|
+
- [Chip] Fix unbinded `onClick` prop (#34455) @HexM7
|
|
52
|
+
- [Divider] Add `Divider` component (#34403) @siriwatknp
|
|
53
|
+
- [Radio] spread `readOnly` and `required` to input (#34478) @siriwatknp
|
|
54
|
+
|
|
55
|
+
### Docs
|
|
56
|
+
|
|
57
|
+
- [blog] MUI Base announcement typo fixed (#34409) @prakhargupta1
|
|
58
|
+
- [blog] Fix typo in date-pickers v5 stable (#34386) @alexfauquette
|
|
59
|
+
- [blog] Update date on date pickers v5 release blog post (#34406) @joserodolfofreitas
|
|
60
|
+
- [docs] Update `useMenu` and `useMenuItem` hooks demo (#34166) @ZeeshanTamboli
|
|
61
|
+
- [docs] Update the guide for migrating to TSS (#34417) @garronej
|
|
62
|
+
- [docs] Fix typo in `Grid` docs (#34475) @Dustin-Digitar
|
|
63
|
+
- [docs] Fix typo in `Back to top` section in AppBar docs (#34479) @Dustin-Digitar
|
|
64
|
+
- [docs] Standardize all MUI Core "Installation" pages (#34168) @samuelsycamore
|
|
65
|
+
- [docs] Fix webpack file name to the standard: `webpack.config.js` (#34446) @CodingItWrong
|
|
66
|
+
- [docs] Fix Select `onChange` call (#34408) @siriwatknp
|
|
67
|
+
- [docs] Notification for pickers blog - v5 stable (#34400) @joserodolfofreitas
|
|
68
|
+
- [docs] Improve social sharing of docs pages (#34346) @oliviertassinari
|
|
69
|
+
- [docs] Refine the use of MUI vs. Material UI (#34345) @oliviertassinari
|
|
70
|
+
- [docs] Send feedback directly to a dedicated slack channel (#34196) @alexfauquette
|
|
71
|
+
- [website] Adds Bilal to about page (#34412) @MBilalShafi
|
|
72
|
+
- [website] Add date range picker to pricing table (#34399) @joserodolfofreitas
|
|
73
|
+
|
|
74
|
+
### Core
|
|
75
|
+
|
|
76
|
+
- [core] Document some types in @mui/styled-engine-sc (#34413) @mnajdova
|
|
77
|
+
- [core] Add yml support to prettier (#33980) @Janpot
|
|
78
|
+
|
|
79
|
+
All contributors of this release in alphabetical order: @abhinav-22-tech, @alexfauquette, @CodingItWrong, @Dustin-Digitar, @garronej, @HexM7, @howlettt, @Janpot, @joserodolfofreitas, @kabernardes, @MBilalShafi, @Methuselah96, @michaldudak, @mnajdova, @oliviertassinari, @prakhargupta1, @pratikkarad, @ptrfrncsmrph, @samuelsycamore, @siriwatknp, @ZeeshanTamboli
|
|
80
|
+
|
|
3
81
|
## 5.10.6
|
|
4
82
|
|
|
5
83
|
<!-- generated comparing v5.10.5..master -->
|
package/colorManipulator.js
CHANGED
|
@@ -222,7 +222,7 @@ function hslToRgb(color) {
|
|
|
222
222
|
|
|
223
223
|
function getLuminance(color) {
|
|
224
224
|
color = decomposeColor(color);
|
|
225
|
-
let rgb = color.type === 'hsl' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
225
|
+
let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
226
226
|
rgb = rgb.map(val => {
|
|
227
227
|
if (color.type !== 'color') {
|
|
228
228
|
val /= 255; // normalized
|
package/createTheme/shape.d.ts
CHANGED
|
@@ -124,6 +124,14 @@ export default function createCssVarsProvider<ColorScheme extends string>(
|
|
|
124
124
|
* variants from those tokens.
|
|
125
125
|
*/
|
|
126
126
|
resolveTheme?: (theme: any) => any; // the type is any because it depends on the design system.
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
* A function that returns a list of variables that will be excluded from the `colorSchemeSelector` (:root by default)
|
|
130
|
+
*
|
|
131
|
+
* Some variables are intended to be used in a specific color scheme only. They should be excluded when the default mode is set to the color scheme.
|
|
132
|
+
* This is introduced to fix https://github.com/mui/material-ui/issues/34084
|
|
133
|
+
*/
|
|
134
|
+
excludeVariablesFromRoot?: (cssVarPrefix: string) => string[];
|
|
127
135
|
},
|
|
128
136
|
): CreateCssVarsProviderResult<ColorScheme>;
|
|
129
137
|
|
|
@@ -50,7 +50,8 @@ function createCssVarsProvider(options) {
|
|
|
50
50
|
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
|
51
51
|
enableColorScheme: designSystemEnableColorScheme = true,
|
|
52
52
|
shouldSkipGeneratingVar: designSystemShouldSkipGeneratingVar,
|
|
53
|
-
resolveTheme
|
|
53
|
+
resolveTheme,
|
|
54
|
+
excludeVariablesFromRoot
|
|
54
55
|
} = options;
|
|
55
56
|
|
|
56
57
|
if (!defaultTheme.colorSchemes || typeof designSystemColorScheme === 'string' && !defaultTheme.colorSchemes[designSystemColorScheme] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.light] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.dark]) {
|
|
@@ -179,6 +180,15 @@ function createCssVarsProvider(options) {
|
|
|
179
180
|
})();
|
|
180
181
|
|
|
181
182
|
if (key === resolvedDefaultColorScheme) {
|
|
183
|
+
if (excludeVariablesFromRoot) {
|
|
184
|
+
const excludedVariables = {};
|
|
185
|
+
excludeVariablesFromRoot(cssVarPrefix).forEach(cssVar => {
|
|
186
|
+
excludedVariables[cssVar] = css[cssVar];
|
|
187
|
+
delete css[cssVar];
|
|
188
|
+
});
|
|
189
|
+
defaultColorSchemeStyleSheet[`[${attribute}="${key}"]`] = excludedVariables;
|
|
190
|
+
}
|
|
191
|
+
|
|
182
192
|
defaultColorSchemeStyleSheet[`${colorSchemeSelector}, [${attribute}="${key}"]`] = css;
|
|
183
193
|
} else {
|
|
184
194
|
otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
|
|
@@ -58,7 +58,7 @@ export default function cssVarsParser<T extends Record<string, any>>(theme: T, o
|
|
|
58
58
|
prefix?: string;
|
|
59
59
|
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
60
60
|
}): {
|
|
61
|
-
css:
|
|
61
|
+
css: Record<string, string | number>;
|
|
62
62
|
vars: NestedRecord<string>;
|
|
63
63
|
parsedTheme: T;
|
|
64
64
|
};
|
|
@@ -9,16 +9,18 @@ export interface GetInitColorSchemeScriptOptions {
|
|
|
9
9
|
*/
|
|
10
10
|
enableColorScheme?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @default
|
|
12
|
+
* The mode to be used for the first visit
|
|
13
|
+
* @default 'light'
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
defaultMode?: 'light' | 'dark' | 'system';
|
|
16
16
|
/**
|
|
17
17
|
* The default color scheme to be used on the light mode
|
|
18
|
+
* @default 'light'
|
|
18
19
|
*/
|
|
19
20
|
defaultLightColorScheme?: string;
|
|
20
21
|
/**
|
|
21
22
|
* The default color scheme to be used on the dark mode
|
|
23
|
+
* * @default 'dark'
|
|
22
24
|
*/
|
|
23
25
|
defaultDarkColorScheme?: string;
|
|
24
26
|
/**
|
|
@@ -24,7 +24,7 @@ exports.DEFAULT_ATTRIBUTE = DEFAULT_ATTRIBUTE;
|
|
|
24
24
|
function getInitColorSchemeScript(options) {
|
|
25
25
|
const {
|
|
26
26
|
enableColorScheme = true,
|
|
27
|
-
|
|
27
|
+
defaultMode = 'light',
|
|
28
28
|
defaultLightColorScheme = 'light',
|
|
29
29
|
defaultDarkColorScheme = 'dark',
|
|
30
30
|
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
@@ -36,10 +36,10 @@ function getInitColorSchemeScript(options) {
|
|
|
36
36
|
// eslint-disable-next-line react/no-danger
|
|
37
37
|
dangerouslySetInnerHTML: {
|
|
38
38
|
__html: `(function() { try {
|
|
39
|
-
var mode = localStorage.getItem('${modeStorageKey}');
|
|
39
|
+
var mode = localStorage.getItem('${modeStorageKey}') || '${defaultMode}';
|
|
40
40
|
var cssColorScheme = mode;
|
|
41
41
|
var colorScheme = '';
|
|
42
|
-
if (mode === 'system'
|
|
42
|
+
if (mode === 'system') {
|
|
43
43
|
// handle system mode
|
|
44
44
|
var mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
45
45
|
if (mql.matches) {
|
package/esm/colorManipulator.js
CHANGED
|
@@ -197,7 +197,7 @@ export function hslToRgb(color) {
|
|
|
197
197
|
|
|
198
198
|
export function getLuminance(color) {
|
|
199
199
|
color = decomposeColor(color);
|
|
200
|
-
let rgb = color.type === 'hsl' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
200
|
+
let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
201
201
|
rgb = rgb.map(val => {
|
|
202
202
|
if (color.type !== 'color') {
|
|
203
203
|
val /= 255; // normalized
|
|
@@ -24,7 +24,8 @@ export default function createCssVarsProvider(options) {
|
|
|
24
24
|
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
|
25
25
|
enableColorScheme: designSystemEnableColorScheme = true,
|
|
26
26
|
shouldSkipGeneratingVar: designSystemShouldSkipGeneratingVar,
|
|
27
|
-
resolveTheme
|
|
27
|
+
resolveTheme,
|
|
28
|
+
excludeVariablesFromRoot
|
|
28
29
|
} = options;
|
|
29
30
|
|
|
30
31
|
if (!defaultTheme.colorSchemes || typeof designSystemColorScheme === 'string' && !defaultTheme.colorSchemes[designSystemColorScheme] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.light] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.dark]) {
|
|
@@ -155,6 +156,15 @@ export default function createCssVarsProvider(options) {
|
|
|
155
156
|
})();
|
|
156
157
|
|
|
157
158
|
if (key === resolvedDefaultColorScheme) {
|
|
159
|
+
if (excludeVariablesFromRoot) {
|
|
160
|
+
const excludedVariables = {};
|
|
161
|
+
excludeVariablesFromRoot(cssVarPrefix).forEach(cssVar => {
|
|
162
|
+
excludedVariables[cssVar] = css[cssVar];
|
|
163
|
+
delete css[cssVar];
|
|
164
|
+
});
|
|
165
|
+
defaultColorSchemeStyleSheet[`[${attribute}="${key}"]`] = excludedVariables;
|
|
166
|
+
}
|
|
167
|
+
|
|
158
168
|
defaultColorSchemeStyleSheet[`${colorSchemeSelector}, [${attribute}="${key}"]`] = css;
|
|
159
169
|
} else {
|
|
160
170
|
otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
|
|
@@ -6,7 +6,7 @@ export const DEFAULT_ATTRIBUTE = 'data-color-scheme';
|
|
|
6
6
|
export default function getInitColorSchemeScript(options) {
|
|
7
7
|
const {
|
|
8
8
|
enableColorScheme = true,
|
|
9
|
-
|
|
9
|
+
defaultMode = 'light',
|
|
10
10
|
defaultLightColorScheme = 'light',
|
|
11
11
|
defaultDarkColorScheme = 'dark',
|
|
12
12
|
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
@@ -18,10 +18,10 @@ export default function getInitColorSchemeScript(options) {
|
|
|
18
18
|
// eslint-disable-next-line react/no-danger
|
|
19
19
|
dangerouslySetInnerHTML: {
|
|
20
20
|
__html: `(function() { try {
|
|
21
|
-
var mode = localStorage.getItem('${modeStorageKey}');
|
|
21
|
+
var mode = localStorage.getItem('${modeStorageKey}') || '${defaultMode}';
|
|
22
22
|
var cssColorScheme = mode;
|
|
23
23
|
var colorScheme = '';
|
|
24
|
-
if (mode === 'system'
|
|
24
|
+
if (mode === 'system') {
|
|
25
25
|
// handle system mode
|
|
26
26
|
var mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
27
27
|
if (mql.matches) {
|
package/index.js
CHANGED
|
@@ -206,7 +206,7 @@ export function hslToRgb(color) {
|
|
|
206
206
|
|
|
207
207
|
export function getLuminance(color) {
|
|
208
208
|
color = decomposeColor(color);
|
|
209
|
-
var rgb = color.type === 'hsl' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
209
|
+
var rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
210
210
|
rgb = rgb.map(function (val) {
|
|
211
211
|
if (color.type !== 'color') {
|
|
212
212
|
val /= 255; // normalized
|
|
@@ -32,7 +32,8 @@ export default function createCssVarsProvider(options) {
|
|
|
32
32
|
_options$enableColorS = options.enableColorScheme,
|
|
33
33
|
designSystemEnableColorScheme = _options$enableColorS === void 0 ? true : _options$enableColorS,
|
|
34
34
|
designSystemShouldSkipGeneratingVar = options.shouldSkipGeneratingVar,
|
|
35
|
-
resolveTheme = options.resolveTheme
|
|
35
|
+
resolveTheme = options.resolveTheme,
|
|
36
|
+
excludeVariablesFromRoot = options.excludeVariablesFromRoot;
|
|
36
37
|
|
|
37
38
|
if (!defaultTheme.colorSchemes || typeof designSystemColorScheme === 'string' && !defaultTheme.colorSchemes[designSystemColorScheme] || _typeof(designSystemColorScheme) === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.light] || _typeof(designSystemColorScheme) === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme == null ? void 0 : designSystemColorScheme.dark]) {
|
|
38
39
|
console.error("MUI: `".concat(designSystemColorScheme, "` does not exist in `theme.colorSchemes`."));
|
|
@@ -181,6 +182,15 @@ export default function createCssVarsProvider(options) {
|
|
|
181
182
|
}();
|
|
182
183
|
|
|
183
184
|
if (key === resolvedDefaultColorScheme) {
|
|
185
|
+
if (excludeVariablesFromRoot) {
|
|
186
|
+
var excludedVariables = {};
|
|
187
|
+
excludeVariablesFromRoot(cssVarPrefix).forEach(function (cssVar) {
|
|
188
|
+
excludedVariables[cssVar] = css[cssVar];
|
|
189
|
+
delete css[cssVar];
|
|
190
|
+
});
|
|
191
|
+
defaultColorSchemeStyleSheet["[".concat(attribute, "=\"").concat(key, "\"]")] = excludedVariables;
|
|
192
|
+
}
|
|
193
|
+
|
|
184
194
|
defaultColorSchemeStyleSheet["".concat(colorSchemeSelector, ", [").concat(attribute, "=\"").concat(key, "\"]")] = css;
|
|
185
195
|
} else {
|
|
186
196
|
otherColorSchemesStyleSheet["".concat(colorSchemeSelector === ':root' ? '' : colorSchemeSelector, "[").concat(attribute, "=\"").concat(key, "\"]")] = css;
|
|
@@ -7,8 +7,8 @@ export default function getInitColorSchemeScript(options) {
|
|
|
7
7
|
var _ref = options || {},
|
|
8
8
|
_ref$enableColorSchem = _ref.enableColorScheme,
|
|
9
9
|
enableColorScheme = _ref$enableColorSchem === void 0 ? true : _ref$enableColorSchem,
|
|
10
|
-
_ref$
|
|
11
|
-
|
|
10
|
+
_ref$defaultMode = _ref.defaultMode,
|
|
11
|
+
defaultMode = _ref$defaultMode === void 0 ? 'light' : _ref$defaultMode,
|
|
12
12
|
_ref$defaultLightColo = _ref.defaultLightColorScheme,
|
|
13
13
|
defaultLightColorScheme = _ref$defaultLightColo === void 0 ? 'light' : _ref$defaultLightColo,
|
|
14
14
|
_ref$defaultDarkColor = _ref.defaultDarkColorScheme,
|
|
@@ -25,7 +25,7 @@ export default function getInitColorSchemeScript(options) {
|
|
|
25
25
|
return /*#__PURE__*/_jsx("script", {
|
|
26
26
|
// eslint-disable-next-line react/no-danger
|
|
27
27
|
dangerouslySetInnerHTML: {
|
|
28
|
-
__html: "(function() { try {\n var mode = localStorage.getItem('".concat(modeStorageKey, "');\n var cssColorScheme = mode;\n var colorScheme = '';\n if (mode === 'system'
|
|
28
|
+
__html: "(function() { try {\n var mode = localStorage.getItem('".concat(modeStorageKey, "') || '").concat(defaultMode, "';\n var cssColorScheme = mode;\n var colorScheme = '';\n if (mode === 'system') {\n // handle system mode\n var mql = window.matchMedia('(prefers-color-scheme: dark)');\n if (mql.matches) {\n cssColorScheme = 'dark';\n colorScheme = localStorage.getItem('").concat(colorSchemeStorageKey, "-dark') || '").concat(defaultDarkColorScheme, "';\n } else {\n cssColorScheme = 'light';\n colorScheme = localStorage.getItem('").concat(colorSchemeStorageKey, "-light') || '").concat(defaultLightColorScheme, "';\n }\n }\n if (mode === 'light') {\n colorScheme = localStorage.getItem('").concat(colorSchemeStorageKey, "-light') || '").concat(defaultLightColorScheme, "';\n }\n if (mode === 'dark') {\n colorScheme = localStorage.getItem('").concat(colorSchemeStorageKey, "-dark') || '").concat(defaultDarkColorScheme, "';\n }\n if (colorScheme) {\n ").concat(colorSchemeNode, ".setAttribute('").concat(attribute, "', colorScheme);\n }\n if (").concat(enableColorScheme, " && !!cssColorScheme) {\n ").concat(colorSchemeNode, ".style.setProperty('color-scheme', cssColorScheme);\n }\n } catch (e) {} })();")
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
package/legacy/index.js
CHANGED
|
@@ -197,7 +197,7 @@ export function hslToRgb(color) {
|
|
|
197
197
|
|
|
198
198
|
export function getLuminance(color) {
|
|
199
199
|
color = decomposeColor(color);
|
|
200
|
-
let rgb = color.type === 'hsl' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
200
|
+
let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
201
201
|
rgb = rgb.map(val => {
|
|
202
202
|
if (color.type !== 'color') {
|
|
203
203
|
val /= 255; // normalized
|
|
@@ -24,7 +24,8 @@ export default function createCssVarsProvider(options) {
|
|
|
24
24
|
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
|
25
25
|
enableColorScheme: designSystemEnableColorScheme = true,
|
|
26
26
|
shouldSkipGeneratingVar: designSystemShouldSkipGeneratingVar,
|
|
27
|
-
resolveTheme
|
|
27
|
+
resolveTheme,
|
|
28
|
+
excludeVariablesFromRoot
|
|
28
29
|
} = options;
|
|
29
30
|
|
|
30
31
|
if (!defaultTheme.colorSchemes || typeof designSystemColorScheme === 'string' && !defaultTheme.colorSchemes[designSystemColorScheme] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme?.light] || typeof designSystemColorScheme === 'object' && !defaultTheme.colorSchemes[designSystemColorScheme?.dark]) {
|
|
@@ -155,6 +156,15 @@ export default function createCssVarsProvider(options) {
|
|
|
155
156
|
})();
|
|
156
157
|
|
|
157
158
|
if (key === resolvedDefaultColorScheme) {
|
|
159
|
+
if (excludeVariablesFromRoot) {
|
|
160
|
+
const excludedVariables = {};
|
|
161
|
+
excludeVariablesFromRoot(cssVarPrefix).forEach(cssVar => {
|
|
162
|
+
excludedVariables[cssVar] = css[cssVar];
|
|
163
|
+
delete css[cssVar];
|
|
164
|
+
});
|
|
165
|
+
defaultColorSchemeStyleSheet[`[${attribute}="${key}"]`] = excludedVariables;
|
|
166
|
+
}
|
|
167
|
+
|
|
158
168
|
defaultColorSchemeStyleSheet[`${colorSchemeSelector}, [${attribute}="${key}"]`] = css;
|
|
159
169
|
} else {
|
|
160
170
|
otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
|
|
@@ -6,7 +6,7 @@ export const DEFAULT_ATTRIBUTE = 'data-color-scheme';
|
|
|
6
6
|
export default function getInitColorSchemeScript(options) {
|
|
7
7
|
const {
|
|
8
8
|
enableColorScheme = true,
|
|
9
|
-
|
|
9
|
+
defaultMode = 'light',
|
|
10
10
|
defaultLightColorScheme = 'light',
|
|
11
11
|
defaultDarkColorScheme = 'dark',
|
|
12
12
|
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
@@ -18,10 +18,10 @@ export default function getInitColorSchemeScript(options) {
|
|
|
18
18
|
// eslint-disable-next-line react/no-danger
|
|
19
19
|
dangerouslySetInnerHTML: {
|
|
20
20
|
__html: `(function() { try {
|
|
21
|
-
var mode = localStorage.getItem('${modeStorageKey}');
|
|
21
|
+
var mode = localStorage.getItem('${modeStorageKey}') || '${defaultMode}';
|
|
22
22
|
var cssColorScheme = mode;
|
|
23
23
|
var colorScheme = '';
|
|
24
|
-
if (mode === 'system'
|
|
24
|
+
if (mode === 'system') {
|
|
25
25
|
// handle system mode
|
|
26
26
|
var mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
27
27
|
if (mql.matches) {
|
package/modern/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.10.
|
|
3
|
+
"version": "5.10.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.19.0",
|
|
47
47
|
"@mui/private-theming": "^5.10.6",
|
|
48
|
-
"@mui/styled-engine": "^5.10.
|
|
48
|
+
"@mui/styled-engine": "^5.10.8",
|
|
49
49
|
"@mui/types": "^7.2.0",
|
|
50
50
|
"@mui/utils": "^5.10.6",
|
|
51
51
|
"clsx": "^1.2.1",
|
|
52
|
-
"csstype": "^3.1.
|
|
52
|
+
"csstype": "^3.1.1",
|
|
53
53
|
"prop-types": "^15.8.1"
|
|
54
54
|
},
|
|
55
55
|
"sideEffects": false,
|