@mui/system 5.2.3 → 5.2.4
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 +72 -0
- package/createBox.spec.d.ts +1 -1
- package/createTheme/createBreakpoints.d.ts +6 -0
- package/createTheme/createBreakpoints.js +16 -0
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.js +4 -1
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/cssVarsParser.d.ts +68 -68
- package/cssVars/getInitColorSchemeScript.d.ts +12 -12
- package/cssVars/index.d.ts +2 -2
- package/cssVars/useCurrentColorScheme.d.ts +50 -50
- package/esm/createTheme/createBreakpoints.js +16 -0
- package/esm/cssVars/createCssVarsProvider.js +4 -1
- package/index.js +1 -1
- package/index.spec.d.ts +1 -1
- package/legacy/createTheme/createBreakpoints.js +16 -0
- package/legacy/cssVars/createCssVarsProvider.js +4 -1
- package/legacy/index.js +1 -1
- package/modern/createTheme/createBreakpoints.js +16 -0
- package/modern/cssVars/createCssVarsProvider.js +4 -1
- package/modern/index.js +1 -1
- package/package.json +2 -2
- 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,77 @@
|
|
|
1
1
|
### [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.2.4
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.2.3..master -->
|
|
6
|
+
|
|
7
|
+
_Dec 14, 2021_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 16 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- ✨ Add `not` operator to `theme.breakpoints` (#29311) @Philipp000
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
const styles = (theme) => ({
|
|
15
|
+
root: {
|
|
16
|
+
backgroundColor: 'blue',
|
|
17
|
+
// Match [xs, md) and [md + 1, ∞)
|
|
18
|
+
// [xs, md) and [lg, ∞)
|
|
19
|
+
// [0px, 900px) and [1200px, ∞)
|
|
20
|
+
[theme.breakpoints.not('md')]: {
|
|
21
|
+
backgroundColor: 'red',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- And many more 🐛 bug fixes and 📚 improvements.
|
|
28
|
+
|
|
29
|
+
### `@mui/material@5.2.4`
|
|
30
|
+
|
|
31
|
+
- ​<!-- 14 -->[esm] Correct a styles imports (#29976) @Janpot
|
|
32
|
+
- ​<!-- 12 -->[GlobalStyles] Fix `theme` type (#30072) @mnajdova
|
|
33
|
+
- ​<!-- 11 -->[Grid] Fix grid items to respond to the container's responsive columns (#29715) @kkorach
|
|
34
|
+
- ​<!-- 04 -->[TextField] Fix missing space before asterisk in `OutlinedInput`'s label (#29630) @alisasanib
|
|
35
|
+
- ​<!-- 03 -->[Transition] Allow any valid HTML attribute to be passed (#29888) @Janpot
|
|
36
|
+
- ​<!-- 02 -->[types] Fix discrepancy between core and system `ThemeOptions` (#30095) @fmeum
|
|
37
|
+
- ​<!-- 09 -->[InputBase] Add prop for disabling global styles (#29213) @bryan-hunter
|
|
38
|
+
- ​<!-- 08 -->[Select] Improve multiple logic (#30135) @ladygo93
|
|
39
|
+
|
|
40
|
+
### `@mui/system@5.2.4`
|
|
41
|
+
|
|
42
|
+
- ​<!-- 06 -->[system] Don't transition when re-appearing (#30108) @eps1lon
|
|
43
|
+
- ​<!-- 05 -->[system] Add `not` operator to `breakpoints` (#29311) @Philipp000
|
|
44
|
+
|
|
45
|
+
### `@mui/base@5.0.0-alpha.60`
|
|
46
|
+
|
|
47
|
+
- ​<!-- 25 -->[BadgeUnstyled] Make it conformant with other base components (#30141) @mnajdova
|
|
48
|
+
|
|
49
|
+
### `@mui/icons-material@5.2.4`
|
|
50
|
+
|
|
51
|
+
- ​<!-- 10 -->[icons] Correct location of icon download folder (#29839) @yaboi
|
|
52
|
+
|
|
53
|
+
### Docs
|
|
54
|
+
|
|
55
|
+
- ​<!-- 22 -->[docs] Explain the use of Select's label in FormControl (#30189) @michaldudak
|
|
56
|
+
- ​<!-- 21 -->[docs] Don't run nprogress on shallow routing (#30087) @Janpot
|
|
57
|
+
- ​<!-- 20 -->[docs] Add Data Driven Forms to related projects (#30078) @rvsia
|
|
58
|
+
- ​<!-- 19 -->[docs] Sync translations with Crowdin (#30067) @l10nbot
|
|
59
|
+
- ​<!-- 18 -->[docs] Fix link on "Custom variables" section in the Theming page #30100 @danilo-leal
|
|
60
|
+
- ​<!-- 17 -->[docs] Fix justifyContent option in the Grid interactive demo (#30117) @danilo-leal
|
|
61
|
+
- ​<!-- 16 -->[docs] Add tip to help access the docs of a previous version when finding answers in StackOverflow (#30101) @danilo-leal
|
|
62
|
+
- ​<!-- 15 -->[docs] Fix import example inside Unstyled Backdrop section (#30098) @TheodosiouTh
|
|
63
|
+
- ​<!-- 01 -->[website] Column pinning and Tree data are out (#30136) @oliviertassinari
|
|
64
|
+
- ​<!-- 07 -->[survey] Remove survey promotion items (#30122) @danilo-leal
|
|
65
|
+
|
|
66
|
+
### Core
|
|
67
|
+
|
|
68
|
+
- ​<!-- 23 -->[core] Fix link to Open Collective @oliviertassinari
|
|
69
|
+
- ​<!-- 26 -->[core] Update snapshots and s3 fallback (#30134) @Janpot
|
|
70
|
+
- ​<!-- 24 -->[ci] Update CI bucket (#30080) @Janpot
|
|
71
|
+
- ​<!-- 13 -->[fix] size:snapshot for mui-material-next and mui-joy components (#30106) @Janpot
|
|
72
|
+
|
|
73
|
+
All contributors of this release in alphabetical order: @alisasanib, @bryan-hunter, @danilo-leal, @eps1lon, @fmeum, @Janpot, @kkorach, @l10nbot, @ladygo93, @michaldudak, @mnajdova, @oliviertassinari, @Philipp000, @rvsia, @TheodosiouTh, @yaboi
|
|
74
|
+
|
|
3
75
|
## 5.2.3
|
|
4
76
|
|
|
5
77
|
<!-- generated comparing v5.2.2..master -->
|
package/createBox.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -55,6 +55,12 @@ export interface Breakpoints {
|
|
|
55
55
|
* @see [API documentation](https://mui.com/customization/breakpoints/#theme-breakpoints-only-key-media-query)
|
|
56
56
|
*/
|
|
57
57
|
only: (key: Breakpoint) => string;
|
|
58
|
+
/**
|
|
59
|
+
* @param key - A breakpoint key (`xs`, `sm`, etc.).
|
|
60
|
+
* @returns A media query string ready to be used with most styling solutions, which matches screen widths stopping at
|
|
61
|
+
* the screen size given by the breakpoint key (exclusive) and starting at the screen size given by the next breakpoint key (inclusive).
|
|
62
|
+
*/
|
|
63
|
+
not: (key: Breakpoint) => string;
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
export interface BreakpointsOptions extends Partial<Breakpoints> {
|
|
@@ -64,6 +64,21 @@ function createBreakpoints(breakpoints) {
|
|
|
64
64
|
return up(key);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
function not(key) {
|
|
68
|
+
// handle first and last key separately, for better readability
|
|
69
|
+
const keyIndex = keys.indexOf(key);
|
|
70
|
+
|
|
71
|
+
if (keyIndex === 0) {
|
|
72
|
+
return up(keys[1]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (keyIndex === keys.length - 1) {
|
|
76
|
+
return down(keys[keyIndex]);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
80
|
+
}
|
|
81
|
+
|
|
67
82
|
return (0, _extends2.default)({
|
|
68
83
|
keys,
|
|
69
84
|
values,
|
|
@@ -71,6 +86,7 @@ function createBreakpoints(breakpoints) {
|
|
|
71
86
|
down,
|
|
72
87
|
between,
|
|
73
88
|
only,
|
|
89
|
+
not,
|
|
74
90
|
unit
|
|
75
91
|
}, other);
|
|
76
92
|
}
|
|
@@ -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;
|
|
@@ -96,7 +96,7 @@ function createCssVarsProvider(options) {
|
|
|
96
96
|
colorSchemes: colorSchemesProp = {}
|
|
97
97
|
} = themeProp,
|
|
98
98
|
restThemeProp = (0, _objectWithoutPropertiesLoose2.default)(themeProp, _excluded2);
|
|
99
|
-
const hasMounted = React.useRef(
|
|
99
|
+
const hasMounted = React.useRef(false); // eslint-disable-next-line prefer-const
|
|
100
100
|
|
|
101
101
|
let _deepmerge = (0, _utils.deepmerge)(restBaseTheme, restThemeProp),
|
|
102
102
|
{
|
|
@@ -228,6 +228,9 @@ function createCssVarsProvider(options) {
|
|
|
228
228
|
}, [colorScheme]);
|
|
229
229
|
React.useEffect(() => {
|
|
230
230
|
hasMounted.current = true;
|
|
231
|
+
return () => {
|
|
232
|
+
hasMounted.current = false;
|
|
233
|
+
};
|
|
231
234
|
}, []);
|
|
232
235
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ColorSchemeContext.Provider, {
|
|
233
236
|
value: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,68 +1,68 @@
|
|
|
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
|
-
* This function also mutate the string value of theme input by replacing `basePrefix` (if existed) with `prefix`
|
|
47
|
-
*
|
|
48
|
-
* @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme)
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* const { css, vars } = parser({
|
|
52
|
-
* fontSize: 12,
|
|
53
|
-
* lineHeight: 1.2,
|
|
54
|
-
* palette: { primary: { 500: '#000000' } }
|
|
55
|
-
* })
|
|
56
|
-
*
|
|
57
|
-
* console.log(css) // { '--fontSize': '12px', '--lineHeight': 1.2, '--palette-primary-500': '#000000' }
|
|
58
|
-
* console.log(vars) // { fontSize: '--fontSize', lineHeight: '--lineHeight', palette: { primary: { 500: 'var(--palette-primary-500)' } } }
|
|
59
|
-
*/
|
|
60
|
-
export default function cssVarsParser(theme: Record<string, any>, options?: {
|
|
61
|
-
prefix?: string;
|
|
62
|
-
basePrefix?: string;
|
|
63
|
-
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
64
|
-
}): {
|
|
65
|
-
css: NestedRecord<string>;
|
|
66
|
-
vars: NestedRecord<string>;
|
|
67
|
-
};
|
|
68
|
-
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
|
+
* This function also mutate the string value of theme input by replacing `basePrefix` (if existed) with `prefix`
|
|
47
|
+
*
|
|
48
|
+
* @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme)
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const { css, vars } = parser({
|
|
52
|
+
* fontSize: 12,
|
|
53
|
+
* lineHeight: 1.2,
|
|
54
|
+
* palette: { primary: { 500: '#000000' } }
|
|
55
|
+
* })
|
|
56
|
+
*
|
|
57
|
+
* console.log(css) // { '--fontSize': '12px', '--lineHeight': 1.2, '--palette-primary-500': '#000000' }
|
|
58
|
+
* console.log(vars) // { fontSize: '--fontSize', lineHeight: '--lineHeight', palette: { primary: { 500: 'var(--palette-primary-500)' } } }
|
|
59
|
+
*/
|
|
60
|
+
export default function cssVarsParser(theme: Record<string, any>, options?: {
|
|
61
|
+
prefix?: string;
|
|
62
|
+
basePrefix?: string;
|
|
63
|
+
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
64
|
+
}): {
|
|
65
|
+
css: NestedRecord<string>;
|
|
66
|
+
vars: NestedRecord<string>;
|
|
67
|
+
};
|
|
68
|
+
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,2 +1,2 @@
|
|
|
1
|
-
export { default } from './createCssVarsProvider';
|
|
2
|
-
export type { BuildCssVarsTheme } from './createCssVarsProvider';
|
|
1
|
+
export { default } from './createCssVarsProvider';
|
|
2
|
+
export type { BuildCssVarsTheme } 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>;
|
|
@@ -51,6 +51,21 @@ export default function createBreakpoints(breakpoints) {
|
|
|
51
51
|
return up(key);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function not(key) {
|
|
55
|
+
// handle first and last key separately, for better readability
|
|
56
|
+
const keyIndex = keys.indexOf(key);
|
|
57
|
+
|
|
58
|
+
if (keyIndex === 0) {
|
|
59
|
+
return up(keys[1]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (keyIndex === keys.length - 1) {
|
|
63
|
+
return down(keys[keyIndex]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
return _extends({
|
|
55
70
|
keys,
|
|
56
71
|
values,
|
|
@@ -58,6 +73,7 @@ export default function createBreakpoints(breakpoints) {
|
|
|
58
73
|
down,
|
|
59
74
|
between,
|
|
60
75
|
only,
|
|
76
|
+
not,
|
|
61
77
|
unit
|
|
62
78
|
}, other);
|
|
63
79
|
}
|
|
@@ -71,7 +71,7 @@ export default function createCssVarsProvider(options) {
|
|
|
71
71
|
} = themeProp,
|
|
72
72
|
restThemeProp = _objectWithoutPropertiesLoose(themeProp, _excluded2);
|
|
73
73
|
|
|
74
|
-
const hasMounted = React.useRef(
|
|
74
|
+
const hasMounted = React.useRef(false); // eslint-disable-next-line prefer-const
|
|
75
75
|
|
|
76
76
|
let _deepmerge = deepmerge(restBaseTheme, restThemeProp),
|
|
77
77
|
{
|
|
@@ -203,6 +203,9 @@ export default function createCssVarsProvider(options) {
|
|
|
203
203
|
}, [colorScheme]);
|
|
204
204
|
React.useEffect(() => {
|
|
205
205
|
hasMounted.current = true;
|
|
206
|
+
return () => {
|
|
207
|
+
hasMounted.current = false;
|
|
208
|
+
};
|
|
206
209
|
}, []);
|
|
207
210
|
return /*#__PURE__*/_jsxs(ColorSchemeContext.Provider, {
|
|
208
211
|
value: {
|
package/index.js
CHANGED
package/index.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -49,6 +49,21 @@ export default function createBreakpoints(breakpoints) {
|
|
|
49
49
|
return up(key);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
function not(key) {
|
|
53
|
+
// handle first and last key separately, for better readability
|
|
54
|
+
var keyIndex = keys.indexOf(key);
|
|
55
|
+
|
|
56
|
+
if (keyIndex === 0) {
|
|
57
|
+
return up(keys[1]);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (keyIndex === keys.length - 1) {
|
|
61
|
+
return down(keys[keyIndex]);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
65
|
+
}
|
|
66
|
+
|
|
52
67
|
return _extends({
|
|
53
68
|
keys: keys,
|
|
54
69
|
values: values,
|
|
@@ -56,6 +71,7 @@ export default function createBreakpoints(breakpoints) {
|
|
|
56
71
|
down: down,
|
|
57
72
|
between: between,
|
|
58
73
|
only: only,
|
|
74
|
+
not: not,
|
|
59
75
|
unit: unit
|
|
60
76
|
}, other);
|
|
61
77
|
}
|
|
@@ -78,7 +78,7 @@ export default function createCssVarsProvider(options) {
|
|
|
78
78
|
colorSchemesProp = _themeProp$colorSchem === void 0 ? {} : _themeProp$colorSchem,
|
|
79
79
|
restThemeProp = _objectWithoutProperties(themeProp, ["colorSchemes"]);
|
|
80
80
|
|
|
81
|
-
var hasMounted = React.useRef(
|
|
81
|
+
var hasMounted = React.useRef(false); // eslint-disable-next-line prefer-const
|
|
82
82
|
|
|
83
83
|
var _deepmerge = deepmerge(restBaseTheme, restThemeProp),
|
|
84
84
|
_deepmerge$components = _deepmerge.components,
|
|
@@ -215,6 +215,9 @@ export default function createCssVarsProvider(options) {
|
|
|
215
215
|
}, [colorScheme]);
|
|
216
216
|
React.useEffect(function () {
|
|
217
217
|
hasMounted.current = true;
|
|
218
|
+
return function () {
|
|
219
|
+
hasMounted.current = false;
|
|
220
|
+
};
|
|
218
221
|
}, []);
|
|
219
222
|
return /*#__PURE__*/_jsxs(ColorSchemeContext.Provider, {
|
|
220
223
|
value: {
|
package/legacy/index.js
CHANGED
|
@@ -51,6 +51,21 @@ export default function createBreakpoints(breakpoints) {
|
|
|
51
51
|
return up(key);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function not(key) {
|
|
55
|
+
// handle first and last key separately, for better readability
|
|
56
|
+
const keyIndex = keys.indexOf(key);
|
|
57
|
+
|
|
58
|
+
if (keyIndex === 0) {
|
|
59
|
+
return up(keys[1]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (keyIndex === keys.length - 1) {
|
|
63
|
+
return down(keys[keyIndex]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
return _extends({
|
|
55
70
|
keys,
|
|
56
71
|
values,
|
|
@@ -58,6 +73,7 @@ export default function createBreakpoints(breakpoints) {
|
|
|
58
73
|
down,
|
|
59
74
|
between,
|
|
60
75
|
only,
|
|
76
|
+
not,
|
|
61
77
|
unit
|
|
62
78
|
}, other);
|
|
63
79
|
}
|
|
@@ -69,7 +69,7 @@ export default function createCssVarsProvider(options) {
|
|
|
69
69
|
} = themeProp,
|
|
70
70
|
restThemeProp = _objectWithoutPropertiesLoose(themeProp, _excluded2);
|
|
71
71
|
|
|
72
|
-
const hasMounted = React.useRef(
|
|
72
|
+
const hasMounted = React.useRef(false); // eslint-disable-next-line prefer-const
|
|
73
73
|
|
|
74
74
|
let _deepmerge = deepmerge(restBaseTheme, restThemeProp),
|
|
75
75
|
{
|
|
@@ -201,6 +201,9 @@ export default function createCssVarsProvider(options) {
|
|
|
201
201
|
}, [colorScheme]);
|
|
202
202
|
React.useEffect(() => {
|
|
203
203
|
hasMounted.current = true;
|
|
204
|
+
return () => {
|
|
205
|
+
hasMounted.current = false;
|
|
206
|
+
};
|
|
204
207
|
}, []);
|
|
205
208
|
return /*#__PURE__*/_jsxs(ColorSchemeContext.Provider, {
|
|
206
209
|
value: {
|
package/modern/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.16.3",
|
|
47
47
|
"@mui/private-theming": "^5.2.3",
|
|
48
|
-
"@mui/styled-engine": "^5.2.
|
|
48
|
+
"@mui/styled-engine": "^5.2.4",
|
|
49
49
|
"@mui/types": "^7.1.0",
|
|
50
50
|
"@mui/utils": "^5.2.3",
|
|
51
51
|
"clsx": "^1.1.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|