@mui/system 5.5.2 → 5.5.3
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/Box/Box.spec.d.ts +1 -1
- package/CHANGELOG.md +98 -0
- package/colorManipulator.js +2 -2
- package/createBox.spec.d.ts +1 -1
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +70 -70
- package/cssVars/getInitColorSchemeScript.d.ts +12 -12
- package/cssVars/index.d.ts +1 -1
- package/cssVars/useCurrentColorScheme.d.ts +50 -50
- package/esm/colorManipulator.js +2 -2
- package/index.js +1 -1
- package/index.spec.d.ts +1 -1
- package/legacy/colorManipulator.js +2 -2
- package/legacy/index.js +1 -1
- package/modern/colorManipulator.js +2 -2
- package/modern/index.js +1 -1
- package/package.json +3 -3
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
package/Box/Box.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,103 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.5.3
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.5.2..master -->
|
|
6
|
+
|
|
7
|
+
_Mar 28, 2022_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 17 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- ♿️ improved the a11y on some docs demos
|
|
12
|
+
- Several 🐛 bug fixes and 📚 documentation improvements
|
|
13
|
+
|
|
14
|
+
### `@mui/material@5.5.3`
|
|
15
|
+
|
|
16
|
+
- ​<!-- 32 -->[ButtonBase] Start ripple only after mount (#31950) @m4theushw
|
|
17
|
+
- ​<!-- 11 -->[FormControlLabel] Fix label prop type to be in-line with other label prop types (#31139) @jannes-io
|
|
18
|
+
- ​<!-- 10 -->[Grow] Add a workaround for Safari 15.4 CSS transition bug (#31975) @igordanchenko
|
|
19
|
+
|
|
20
|
+
### `@mui/codemod@5.5.3`
|
|
21
|
+
|
|
22
|
+
- ​<!-- 31 -->[codemod] Fix variant prop placement (#31990) @ryancogswell
|
|
23
|
+
|
|
24
|
+
### `@mui/utils@5.5.3`
|
|
25
|
+
|
|
26
|
+
- ​<!-- 02 -->[utils] Improve type inference of useForkRef (#31845) @eps1lon
|
|
27
|
+
|
|
28
|
+
### `@mui/base@5.0.0-alpha.74`
|
|
29
|
+
|
|
30
|
+
#### Breaking changes
|
|
31
|
+
|
|
32
|
+
- ​<!-- 34 -->[base] Remove `BackdropUnstyled` component (#31923) @mnajdova
|
|
33
|
+
|
|
34
|
+
The `BackdropUnstyled` component was removed from the `@mui/base` package, as it did not have any specific logic, except adding an `aria-hidden` attribute on the div it rendered. This is not enough to justify it's existence in the base package. Here is an example alternative component you can use:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
const BackdropUnstyled = React.forwardRef<HTMLDivElement, { open?: boolean; className: string }>(
|
|
38
|
+
(props, ref) => {
|
|
39
|
+
const { open, className, ...other } = props;
|
|
40
|
+
return <div className={clsx({ 'MuiBackdrop-open': open }, className)} ref={ref} {...other} />;
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- ​<!-- 03 -->[TrapFocus] Move docs to Base and drop the Unstyled prefix (#31954) @michaldudak
|
|
46
|
+
|
|
47
|
+
Removed the `Unstyled_` prefix from the Base export (it remains in the Material UI export, though).
|
|
48
|
+
|
|
49
|
+
```diff
|
|
50
|
+
-import { Unstyled_TrapFocus } from '@mui/base';
|
|
51
|
+
+import { TrapFocus } from '@mui/base';
|
|
52
|
+
|
|
53
|
+
// or
|
|
54
|
+
|
|
55
|
+
-import TrapFocus from '@mui/base/Unstyled_TrapFocus';
|
|
56
|
+
+import TrapFocus from '@mui/base/TrapFocus';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Changes
|
|
60
|
+
|
|
61
|
+
- ​<!-- 33 -->[base] Add @mui/types to dependencies (#31951) @bicstone
|
|
62
|
+
|
|
63
|
+
### `@mui/joy@5.0.0-alpha.21`
|
|
64
|
+
|
|
65
|
+
- ​<!-- 09 -->[Joy] Add `AvatarGroup` component (#31980) @siriwatknp
|
|
66
|
+
- ​<!-- 07 -->[Joy] Miscellaneous fixes (#31873) @siriwatknp
|
|
67
|
+
- ​<!-- 08 -->[Joy] Miscellaneous fixes 2 (#31971) @siriwatknp
|
|
68
|
+
|
|
69
|
+
### Docs
|
|
70
|
+
|
|
71
|
+
- ​<!-- 27 -->[docs] Improve the a11y on the hover rating demo (#31970) @mnajdova
|
|
72
|
+
- ​<!-- 26 -->[docs] Improve a11y on the `SplitButton` demo (#31969) @mnajdova
|
|
73
|
+
- ​<!-- 25 -->[docs] Improve the color description in the API pages (#30976) @mnajdova
|
|
74
|
+
- ​<!-- 24 -->[docs] Add docs page for unstyled Modal (#31417) @mnajdova
|
|
75
|
+
- ​<!-- 23 -->[docs] Add InputUnstyled docs (#31881) @mnajdova
|
|
76
|
+
- ​<!-- 22 -->[docs] Remove "Work in biotech" from the showcase (#31942) @oliviertassinari
|
|
77
|
+
- ​<!-- 21 -->[docs] Fix in-house ad for the design kits (#31965) @oliviertassinari
|
|
78
|
+
- ​<!-- 20 -->[docs] Fix the documentation for filterOptions in Autocomplete API page (#31416) @santhoshbala0178
|
|
79
|
+
- ​<!-- 19 -->[docs] Update href for 'TypeScript guide on theme customization' (#31880) @NickFoden
|
|
80
|
+
- ​<!-- 18 -->[docs] Fix the CSS modules example in the Interoperability page (#31935) @WilsonNet
|
|
81
|
+
- ​<!-- 17 -->[docs] Fix small typo in the `styled()` utility page (#31967) @jason1985
|
|
82
|
+
- ​<!-- 16 -->[docs] Update mui-x on material-ui navigation (#31810) @siriwatknp
|
|
83
|
+
- ​<!-- 15 -->[docs] Copy ClickAwayListener docs to Base (#31878) @michaldudak
|
|
84
|
+
- ​<!-- 14 -->[docs] Refine the redirects (#31939) @siriwatknp
|
|
85
|
+
- ​<!-- 13 -->[docs] Fix TOC layout for large screen (#31953) @siriwatknp
|
|
86
|
+
- ​<!-- 12 -->[examples] Update remix example to not use NODE_ENV guard for `LiveReload` (#31269) @eswarclynn
|
|
87
|
+
- ​<!-- 06 -->[NoSsr] Copy docs to the Base space (#31956) @michaldudak
|
|
88
|
+
- ​<!-- 05 -->[Portal] Copy Portal docs to the Base space (#31959) @michaldudak
|
|
89
|
+
- ​<!-- 01 -->[website] Remove X-Frame-Options @oliviertassinari
|
|
90
|
+
- ​<!-- 35 -->Revert "[website] Remove X-Frame-Options" @oliviertassinari
|
|
91
|
+
|
|
92
|
+
### Core
|
|
93
|
+
|
|
94
|
+
- ​<!-- 30 -->[core] Fixes error in changelog generator for item sorting/padding (#30088) @dimitropoulos
|
|
95
|
+
- ​<!-- 29 -->[core] Fix typo in issue template @oliviertassinari
|
|
96
|
+
- ​<!-- 28 -->[core] Replace deprecated String.prototype.substr() (#31806) @CommanderRoot
|
|
97
|
+
- ​<!-- 04 -->[test] Add tests for component using `StandardProps` and polymorphic components (#31945) @mnajdova
|
|
98
|
+
|
|
99
|
+
All contributors of this release in alphabetical order: @bicstone, @CommanderRoot, @dimitropoulos, @eps1lon, @eswarclynn, @igordanchenko, @jannes-io, @jason1985, @m4theushw, @michaldudak, @mnajdova, @NickFoden, @oliviertassinari, @ryancogswell, @santhoshbala0178, @siriwatknp, @WilsonNet
|
|
100
|
+
|
|
3
101
|
## 5.5.2
|
|
4
102
|
|
|
5
103
|
<!-- generated comparing v5.5.1..master -->
|
package/colorManipulator.js
CHANGED
|
@@ -41,7 +41,7 @@ function clamp(value, min = 0, max = 1) {
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
function hexToRgb(color) {
|
|
44
|
-
color = color.
|
|
44
|
+
color = color.slice(1);
|
|
45
45
|
const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');
|
|
46
46
|
let colors = color.match(re);
|
|
47
47
|
|
|
@@ -93,7 +93,7 @@ The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
|
|
|
93
93
|
colorSpace = values.shift();
|
|
94
94
|
|
|
95
95
|
if (values.length === 4 && values[3].charAt(0) === '/') {
|
|
96
|
-
values[3] = values[3].
|
|
96
|
+
values[3] = values[3].slice(1);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {
|
package/createBox.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare type SpacingOptions = number | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
|
|
2
|
-
export declare type SpacingArgument = number | string;
|
|
3
|
-
export interface Spacing {
|
|
4
|
-
(): string;
|
|
5
|
-
(value: number): string;
|
|
6
|
-
(topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
|
|
7
|
-
(top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
|
|
8
|
-
(top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
|
|
9
|
-
}
|
|
10
|
-
export default function createSpacing(spacingInput?: SpacingOptions): Spacing;
|
|
1
|
+
export declare type SpacingOptions = number | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
|
|
2
|
+
export declare type SpacingArgument = number | string;
|
|
3
|
+
export interface Spacing {
|
|
4
|
+
(): string;
|
|
5
|
+
(value: number): string;
|
|
6
|
+
(topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
|
|
7
|
+
(top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
|
|
8
|
+
(top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
|
|
9
|
+
}
|
|
10
|
+
export default function createSpacing(spacingInput?: SpacingOptions): Spacing;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
|
|
3
|
-
* and they does not need to remember the prefix (defined once).
|
|
4
|
-
*/
|
|
5
|
-
export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...vars: (T | AdditionalVars)[]) => string;
|
|
1
|
+
/**
|
|
2
|
+
* The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
|
|
3
|
+
* and they does not need to remember the prefix (defined once).
|
|
4
|
+
*/
|
|
5
|
+
export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...vars: (T | AdditionalVars)[]) => string;
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
declare type NestedRecord<V = any> = {
|
|
2
|
-
[k: string | number]: NestedRecord<V> | V;
|
|
3
|
-
};
|
|
4
|
-
/**
|
|
5
|
-
* This function create an object from keys, value and then assign to target
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} obj : the target object to be assigned
|
|
8
|
-
* @param {string[]} keys
|
|
9
|
-
* @param {string | number} value
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const source = {}
|
|
13
|
-
* assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
|
|
14
|
-
* console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* const source = { palette: { primary: 'var(--palette-primary)' } }
|
|
18
|
-
* assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
|
|
19
|
-
* console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
|
|
20
|
-
*/
|
|
21
|
-
export declare const assignNestedKeys: <Object_1 = NestedRecord<any>, Value = any>(obj: Object_1, keys: Array<string>, value: Value) => void;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param {Object} obj : source object
|
|
25
|
-
* @param {Function} callback : a function that will be called when
|
|
26
|
-
* - the deepest key in source object is reached
|
|
27
|
-
* - the value of the deepest key is NOT `undefined` | `null`
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
|
|
31
|
-
* // ['palette', 'primary', 'main'] '#000000'
|
|
32
|
-
*/
|
|
33
|
-
export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, scope: Record<string, string | number>) => void, shouldSkipPaths?: ((keys: Array<string>) => boolean) | undefined) => void;
|
|
34
|
-
/**
|
|
35
|
-
* a function that parse theme and return { css, vars }
|
|
36
|
-
*
|
|
37
|
-
* @param {Object} theme
|
|
38
|
-
* @param {{
|
|
39
|
-
* prefix?: string,
|
|
40
|
-
* basePrefix?: string,
|
|
41
|
-
* shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
|
|
42
|
-
* }} options.
|
|
43
|
-
* `basePrefix`: defined by design system.
|
|
44
|
-
* `prefix`: defined by application
|
|
45
|
-
*
|
|
46
|
-
* the CSS variable value will be adjusted based on the provided `basePrefix` & `prefix` which can be found in `parsedTheme`.
|
|
47
|
-
*
|
|
48
|
-
* @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* const { css, vars, parsedTheme } = parser({
|
|
52
|
-
* fontSize: 12,
|
|
53
|
-
* lineHeight: 1.2,
|
|
54
|
-
* palette: { primary: { 500: 'var(--color)' } }
|
|
55
|
-
* }, { prefix: 'foo' })
|
|
56
|
-
*
|
|
57
|
-
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--foo-color)' }
|
|
58
|
-
* console.log(vars) // { fontSize: '--foo-fontSize', lineHeight: '--foo-lineHeight', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
|
|
59
|
-
* console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--foo-color)' } } }
|
|
60
|
-
*/
|
|
61
|
-
export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
|
|
62
|
-
prefix?: string;
|
|
63
|
-
basePrefix?: string;
|
|
64
|
-
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
65
|
-
}): {
|
|
66
|
-
css: NestedRecord<string>;
|
|
67
|
-
vars: NestedRecord<string>;
|
|
68
|
-
parsedTheme: T;
|
|
69
|
-
};
|
|
70
|
-
export {};
|
|
1
|
+
declare type NestedRecord<V = any> = {
|
|
2
|
+
[k: string | number]: NestedRecord<V> | V;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* This function create an object from keys, value and then assign to target
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} obj : the target object to be assigned
|
|
8
|
+
* @param {string[]} keys
|
|
9
|
+
* @param {string | number} value
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const source = {}
|
|
13
|
+
* assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
|
|
14
|
+
* console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const source = { palette: { primary: 'var(--palette-primary)' } }
|
|
18
|
+
* assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
|
|
19
|
+
* console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
|
|
20
|
+
*/
|
|
21
|
+
export declare const assignNestedKeys: <Object_1 = NestedRecord<any>, Value = any>(obj: Object_1, keys: Array<string>, value: Value) => void;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} obj : source object
|
|
25
|
+
* @param {Function} callback : a function that will be called when
|
|
26
|
+
* - the deepest key in source object is reached
|
|
27
|
+
* - the value of the deepest key is NOT `undefined` | `null`
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
|
|
31
|
+
* // ['palette', 'primary', 'main'] '#000000'
|
|
32
|
+
*/
|
|
33
|
+
export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, scope: Record<string, string | number>) => void, shouldSkipPaths?: ((keys: Array<string>) => boolean) | undefined) => void;
|
|
34
|
+
/**
|
|
35
|
+
* a function that parse theme and return { css, vars }
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} theme
|
|
38
|
+
* @param {{
|
|
39
|
+
* prefix?: string,
|
|
40
|
+
* basePrefix?: string,
|
|
41
|
+
* shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
|
|
42
|
+
* }} options.
|
|
43
|
+
* `basePrefix`: defined by design system.
|
|
44
|
+
* `prefix`: defined by application
|
|
45
|
+
*
|
|
46
|
+
* the CSS variable value will be adjusted based on the provided `basePrefix` & `prefix` which can be found in `parsedTheme`.
|
|
47
|
+
*
|
|
48
|
+
* @returns {{ css: Object, vars: Object, parsedTheme: typeof theme }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme), and `parsedTheme` is the cloned version of theme.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const { css, vars, parsedTheme } = parser({
|
|
52
|
+
* fontSize: 12,
|
|
53
|
+
* lineHeight: 1.2,
|
|
54
|
+
* palette: { primary: { 500: 'var(--color)' } }
|
|
55
|
+
* }, { prefix: 'foo' })
|
|
56
|
+
*
|
|
57
|
+
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--foo-color)' }
|
|
58
|
+
* console.log(vars) // { fontSize: '--foo-fontSize', lineHeight: '--foo-lineHeight', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
|
|
59
|
+
* console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--foo-color)' } } }
|
|
60
|
+
*/
|
|
61
|
+
export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
|
|
62
|
+
prefix?: string;
|
|
63
|
+
basePrefix?: string;
|
|
64
|
+
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
65
|
+
}): {
|
|
66
|
+
css: NestedRecord<string>;
|
|
67
|
+
vars: NestedRecord<string>;
|
|
68
|
+
parsedTheme: T;
|
|
69
|
+
};
|
|
70
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const DEFAULT_MODE_STORAGE_KEY = "mui-mode";
|
|
3
|
-
export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "mui-color-scheme";
|
|
4
|
-
export declare const DEFAULT_ATTRIBUTE = "data-mui-color-scheme";
|
|
5
|
-
export default function getInitColorSchemeScript(options?: {
|
|
6
|
-
enableSystem?: boolean;
|
|
7
|
-
defaultLightColorScheme?: string;
|
|
8
|
-
defaultDarkColorScheme?: string;
|
|
9
|
-
modeStorageKey?: string;
|
|
10
|
-
colorSchemeStorageKey?: string;
|
|
11
|
-
attribute?: string;
|
|
12
|
-
}): JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DEFAULT_MODE_STORAGE_KEY = "mui-mode";
|
|
3
|
+
export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "mui-color-scheme";
|
|
4
|
+
export declare const DEFAULT_ATTRIBUTE = "data-mui-color-scheme";
|
|
5
|
+
export default function getInitColorSchemeScript(options?: {
|
|
6
|
+
enableSystem?: boolean;
|
|
7
|
+
defaultLightColorScheme?: string;
|
|
8
|
+
defaultDarkColorScheme?: string;
|
|
9
|
+
modeStorageKey?: string;
|
|
10
|
+
colorSchemeStorageKey?: string;
|
|
11
|
+
attribute?: string;
|
|
12
|
+
}): JSX.Element;
|
package/cssVars/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './createCssVarsProvider';
|
|
1
|
+
export { default } from './createCssVarsProvider';
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
export declare type Mode = 'light' | 'dark' | 'system';
|
|
2
|
-
export declare type SystemMode = Exclude<Mode, 'system'>;
|
|
3
|
-
export interface State<SupportedColorScheme extends string> {
|
|
4
|
-
/**
|
|
5
|
-
* User selected mode.
|
|
6
|
-
* Note: on the server, mode is always undefined
|
|
7
|
-
*/
|
|
8
|
-
mode: Mode | undefined;
|
|
9
|
-
/**
|
|
10
|
-
* Only valid if `mode: 'system'`, either 'light' | 'dark'.
|
|
11
|
-
*/
|
|
12
|
-
systemMode: SystemMode | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* The color scheme for the light mode.
|
|
15
|
-
*/
|
|
16
|
-
lightColorScheme: SupportedColorScheme;
|
|
17
|
-
/**
|
|
18
|
-
* The color scheme for the dark mode.
|
|
19
|
-
*/
|
|
20
|
-
darkColorScheme: SupportedColorScheme;
|
|
21
|
-
}
|
|
22
|
-
export declare type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
|
|
23
|
-
/**
|
|
24
|
-
* The current application color scheme. It is always `undefined` on the server.
|
|
25
|
-
*/
|
|
26
|
-
colorScheme: SupportedColorScheme | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* `mode` is saved to internal state and localStorage
|
|
29
|
-
* If `mode` is null, it will be reset to the defaultMode
|
|
30
|
-
*/
|
|
31
|
-
setMode: (mode: Mode | null) => void;
|
|
32
|
-
/**
|
|
33
|
-
* `colorScheme` is saved to internal state and localStorage
|
|
34
|
-
* If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
|
|
35
|
-
*/
|
|
36
|
-
setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
|
|
37
|
-
light: SupportedColorScheme | null;
|
|
38
|
-
dark: SupportedColorScheme | null;
|
|
39
|
-
}> | null) => void;
|
|
40
|
-
};
|
|
41
|
-
export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
|
|
42
|
-
export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
|
|
43
|
-
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: {
|
|
44
|
-
defaultLightColorScheme: SupportedColorScheme;
|
|
45
|
-
defaultDarkColorScheme: SupportedColorScheme;
|
|
46
|
-
supportedColorSchemes: Array<SupportedColorScheme>;
|
|
47
|
-
defaultMode?: Mode;
|
|
48
|
-
modeStorageKey?: string;
|
|
49
|
-
colorSchemeStorageKey?: string;
|
|
50
|
-
}): Result<SupportedColorScheme>;
|
|
1
|
+
export declare type Mode = 'light' | 'dark' | 'system';
|
|
2
|
+
export declare type SystemMode = Exclude<Mode, 'system'>;
|
|
3
|
+
export interface State<SupportedColorScheme extends string> {
|
|
4
|
+
/**
|
|
5
|
+
* User selected mode.
|
|
6
|
+
* Note: on the server, mode is always undefined
|
|
7
|
+
*/
|
|
8
|
+
mode: Mode | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Only valid if `mode: 'system'`, either 'light' | 'dark'.
|
|
11
|
+
*/
|
|
12
|
+
systemMode: SystemMode | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The color scheme for the light mode.
|
|
15
|
+
*/
|
|
16
|
+
lightColorScheme: SupportedColorScheme;
|
|
17
|
+
/**
|
|
18
|
+
* The color scheme for the dark mode.
|
|
19
|
+
*/
|
|
20
|
+
darkColorScheme: SupportedColorScheme;
|
|
21
|
+
}
|
|
22
|
+
export declare type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
|
|
23
|
+
/**
|
|
24
|
+
* The current application color scheme. It is always `undefined` on the server.
|
|
25
|
+
*/
|
|
26
|
+
colorScheme: SupportedColorScheme | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* `mode` is saved to internal state and localStorage
|
|
29
|
+
* If `mode` is null, it will be reset to the defaultMode
|
|
30
|
+
*/
|
|
31
|
+
setMode: (mode: Mode | null) => void;
|
|
32
|
+
/**
|
|
33
|
+
* `colorScheme` is saved to internal state and localStorage
|
|
34
|
+
* If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
|
|
35
|
+
*/
|
|
36
|
+
setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
|
|
37
|
+
light: SupportedColorScheme | null;
|
|
38
|
+
dark: SupportedColorScheme | null;
|
|
39
|
+
}> | null) => void;
|
|
40
|
+
};
|
|
41
|
+
export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
|
|
42
|
+
export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
|
|
43
|
+
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: {
|
|
44
|
+
defaultLightColorScheme: SupportedColorScheme;
|
|
45
|
+
defaultDarkColorScheme: SupportedColorScheme;
|
|
46
|
+
supportedColorSchemes: Array<SupportedColorScheme>;
|
|
47
|
+
defaultMode?: Mode;
|
|
48
|
+
modeStorageKey?: string;
|
|
49
|
+
colorSchemeStorageKey?: string;
|
|
50
|
+
}): Result<SupportedColorScheme>;
|
package/esm/colorManipulator.js
CHANGED
|
@@ -24,7 +24,7 @@ function clamp(value, min = 0, max = 1) {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
export function hexToRgb(color) {
|
|
27
|
-
color = color.
|
|
27
|
+
color = color.slice(1);
|
|
28
28
|
const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');
|
|
29
29
|
let colors = color.match(re);
|
|
30
30
|
|
|
@@ -76,7 +76,7 @@ The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
|
|
|
76
76
|
colorSpace = values.shift();
|
|
77
77
|
|
|
78
78
|
if (values.length === 4 && values[3].charAt(0) === '/') {
|
|
79
|
-
values[3] = values[3].
|
|
79
|
+
values[3] = values[3].slice(1);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {
|
package/index.js
CHANGED
package/index.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -27,7 +27,7 @@ function clamp(value) {
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
export function hexToRgb(color) {
|
|
30
|
-
color = color.
|
|
30
|
+
color = color.slice(1);
|
|
31
31
|
var re = new RegExp(".{1,".concat(color.length >= 6 ? 2 : 1, "}"), 'g');
|
|
32
32
|
var colors = color.match(re);
|
|
33
33
|
|
|
@@ -80,7 +80,7 @@ export function decomposeColor(color) {
|
|
|
80
80
|
colorSpace = values.shift();
|
|
81
81
|
|
|
82
82
|
if (values.length === 4 && values[3].charAt(0) === '/') {
|
|
83
|
-
values[3] = values[3].
|
|
83
|
+
values[3] = values[3].slice(1);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {
|
package/legacy/index.js
CHANGED
|
@@ -24,7 +24,7 @@ function clamp(value, min = 0, max = 1) {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
export function hexToRgb(color) {
|
|
27
|
-
color = color.
|
|
27
|
+
color = color.slice(1);
|
|
28
28
|
const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');
|
|
29
29
|
let colors = color.match(re);
|
|
30
30
|
|
|
@@ -76,7 +76,7 @@ The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
|
|
|
76
76
|
colorSpace = values.shift();
|
|
77
77
|
|
|
78
78
|
if (values.length === 4 && values[3].charAt(0) === '/') {
|
|
79
|
-
values[3] = values[3].
|
|
79
|
+
values[3] = values[3].slice(1);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {
|
package/modern/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.17.2",
|
|
47
|
-
"@mui/private-theming": "^5.
|
|
47
|
+
"@mui/private-theming": "^5.5.3",
|
|
48
48
|
"@mui/styled-engine": "^5.5.2",
|
|
49
49
|
"@mui/types": "^7.1.3",
|
|
50
|
-
"@mui/utils": "^5.
|
|
50
|
+
"@mui/utils": "^5.5.3",
|
|
51
51
|
"clsx": "^1.1.1",
|
|
52
52
|
"csstype": "^3.0.11",
|
|
53
53
|
"prop-types": "^15.7.2"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|