@mui/system 5.2.5 → 5.2.6
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 +57 -0
- package/createBox.spec.d.ts +1 -1
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.js +4 -1
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetThemeVar.d.ts +1 -0
- package/cssVars/createGetThemeVar.js +22 -0
- 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/cssVars/createCssVarsProvider.js +3 -1
- package/esm/cssVars/createGetThemeVar.js +15 -0
- package/esm/index.js +2 -1
- package/index.d.ts +1 -0
- package/index.js +11 -2
- package/index.spec.d.ts +1 -1
- package/legacy/cssVars/createCssVarsProvider.js +3 -1
- package/legacy/cssVars/createGetThemeVar.js +26 -0
- package/legacy/index.js +3 -2
- package/modern/cssVars/createCssVarsProvider.js +3 -1
- package/modern/cssVars/createGetThemeVar.js +15 -0
- package/modern/index.js +3 -2
- 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,62 @@
|
|
|
1
1
|
### [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.2.6
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.2.5..master -->
|
|
6
|
+
|
|
7
|
+
_Dec 27, 2021_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 📓 The Norwegian Bokmål (nb-NO) locale was added (#27520) @wogsland
|
|
12
|
+
- 🛠 Introduced a new `useBadge` hook in the `@mui/base` package (#30246) @mnajdova
|
|
13
|
+
- And more 🐛 bug fixes and 📚 documentation improvements.
|
|
14
|
+
|
|
15
|
+
### `@mui/material@5.2.6`
|
|
16
|
+
|
|
17
|
+
- ​<!-- 24 -->[ButtonGroup] Fix typo in ButtonGroupContext's interface (#30376) @kealjones-wk
|
|
18
|
+
- ​<!-- 03 -->[l10n] Add Norwegian Bokmål (nb-NO) locale (#27520) @wogsland
|
|
19
|
+
|
|
20
|
+
### `@mui/base@5.0.0-alpha.62`
|
|
21
|
+
|
|
22
|
+
- ​<!-- 26 -->[BadgeUnstyled] Add useBadge hook (#30246) @mnajdova
|
|
23
|
+
|
|
24
|
+
### `@mui/joy@5.0.0-alpha.8`
|
|
25
|
+
|
|
26
|
+
- ​<!-- 04 -->[Joy] Button API (#29962) @siriwatknp
|
|
27
|
+
|
|
28
|
+
### Docs
|
|
29
|
+
|
|
30
|
+
- ​<!-- 27 -->[docs] Fix color coercion (#30319) @Janpot
|
|
31
|
+
- ​<!-- 25 -->[blog] Fix file import conflict resolution (#30391) @oliviertassinari
|
|
32
|
+
- ​<!-- 21 -->[docs] Fix crash on Safari because of unsupported lookahead feature (#30345) @cherniavskii
|
|
33
|
+
- ​<!-- 20 -->[docs] Update to new website domain (#30396) @ryota-murakami
|
|
34
|
+
- ​<!-- 19 -->[docs] Fix text from material-ui to @mui to reflect v5 name changes (#30393) @pupudu
|
|
35
|
+
- ​<!-- 18 -->[docs] Fix a11y in Menu demos (#30378) @ZeeshanTamboli
|
|
36
|
+
- ​<!-- 17 -->[docs] Document how to unmount transition child (#30382) @oliviertassinari
|
|
37
|
+
- ​<!-- 16 -->[docs] The current standard for quotes is QUOTATION MARK @oliviertassinari
|
|
38
|
+
- ​<!-- 15 -->[docs] Fix 404 links (#30380) @oliviertassinari
|
|
39
|
+
- ​<!-- 14 -->[docs] Fix Breadcrumb description (#30307) @jamesmelzer
|
|
40
|
+
- ​<!-- 13 -->[docs] Modify injection order for Gatsby and SSR examples (#30358) @ShuPink
|
|
41
|
+
- ​<!-- 12 -->[docs] Improve the translation experience (#30373) @oliviertassinari
|
|
42
|
+
- ​<!-- 11 -->[docs] Sync translations with Crowdin (#30176) @l10nbot
|
|
43
|
+
- ​<!-- 10 -->[docs] Fix link to /size-snapshot (#30363) @oliviertassinari
|
|
44
|
+
- ​<!-- 09 -->[docs] Fix incorrect aria label in SpeedDial demo (#30354) @chwallen
|
|
45
|
+
- ​<!-- 08 -->[docs] Fix incorrect number of breakpoint helpers (#30353) @chwallen
|
|
46
|
+
- ​<!-- 07 -->[docs] Update outdated links (#30260) @oliviertassinari
|
|
47
|
+
- ​<!-- 06 -->[docs] Support redirects from old urls to /material/\* (#30286) @siriwatknp
|
|
48
|
+
- ​<!-- 05 -->[examples] Fix CSS modules integration (#30381) @oliviertassinari
|
|
49
|
+
- ​<!-- 02 -->[website] Fix SEO issues (#30372) @oliviertassinari
|
|
50
|
+
- ​<!-- 01 -->[website] Sync sponsors (#30259) @oliviertassinari
|
|
51
|
+
|
|
52
|
+
### Core
|
|
53
|
+
|
|
54
|
+
- ​<!-- 28 -->[core] Rename Material-UI to MUI (#30338) @ZeeshanTamboli
|
|
55
|
+
- ​<!-- 23 -->[core] Fix warning in dev mode (#30368) @oliviertassinari
|
|
56
|
+
- ​<!-- 22 -->[core] Update `buildApi` script to support new structure (#30245) @siriwatknp
|
|
57
|
+
|
|
58
|
+
All contributors of this release in alphabetical order: @cherniavskii, @chwallen, @jamesmelzer, @Janpot, @kealjones-wk, @l10nbot, @mnajdova, @oliviertassinari, @pupudu, @ryota-murakami, @ShuPink, @siriwatknp, @wogsland, @ZeeshanTamboli
|
|
59
|
+
|
|
3
60
|
## 5.2.5
|
|
4
61
|
|
|
5
62
|
<!-- generated comparing v5.2.4..master -->
|
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;
|
|
@@ -32,6 +32,8 @@ var _getInitColorSchemeScript = _interopRequireWildcard(require("./getInitColorS
|
|
|
32
32
|
|
|
33
33
|
var _useCurrentColorScheme = _interopRequireDefault(require("./useCurrentColorScheme"));
|
|
34
34
|
|
|
35
|
+
var _createGetThemeVar = _interopRequireDefault(require("./createGetThemeVar"));
|
|
36
|
+
|
|
35
37
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
36
38
|
|
|
37
39
|
const _excluded = ["colorSchemes"],
|
|
@@ -151,7 +153,8 @@ function createCssVarsProvider(options) {
|
|
|
151
153
|
colorSchemes,
|
|
152
154
|
vars: rootVars,
|
|
153
155
|
spacing: themeProp.spacing ? (0, _createSpacing.default)(themeProp.spacing) : systemSpacing,
|
|
154
|
-
breakpoints: themeProp.breakpoints ? (0, _createBreakpoints.default)(themeProp.breakpoints) : systemBreakpoints
|
|
156
|
+
breakpoints: themeProp.breakpoints ? (0, _createBreakpoints.default)(themeProp.breakpoints) : systemBreakpoints,
|
|
157
|
+
getThemeVar: (0, _createGetThemeVar.default)(prefix)
|
|
155
158
|
});
|
|
156
159
|
const styleSheet = {};
|
|
157
160
|
Object.entries(colorSchemes).forEach(([key, scheme]) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function createGetThemeVar<T extends string = string>(prefix?: string): (field: T, ...vars: T[]) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = createGetThemeVar;
|
|
7
|
+
|
|
8
|
+
function createGetThemeVar(prefix = '') {
|
|
9
|
+
function appendVar(...vars) {
|
|
10
|
+
if (!vars.length) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return `, var(--${prefix ? `${prefix}-` : ''}${vars[0]}${appendVar(...vars.slice(1))})`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const getThemeVar = (field, ...vars) => {
|
|
18
|
+
return `var(--${prefix ? `${prefix}-` : ''}${field}${appendVar(...vars)})`;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return getThemeVar;
|
|
22
|
+
}
|
|
@@ -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>;
|
|
@@ -14,6 +14,7 @@ import cssVarsParser from './cssVarsParser';
|
|
|
14
14
|
import ThemeProvider from '../ThemeProvider';
|
|
15
15
|
import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
|
|
16
16
|
import useCurrentColorScheme from './useCurrentColorScheme';
|
|
17
|
+
import createGetThemeVar from './createGetThemeVar';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
export const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
|
|
@@ -126,7 +127,8 @@ export default function createCssVarsProvider(options) {
|
|
|
126
127
|
colorSchemes,
|
|
127
128
|
vars: rootVars,
|
|
128
129
|
spacing: themeProp.spacing ? createSpacing(themeProp.spacing) : systemSpacing,
|
|
129
|
-
breakpoints: themeProp.breakpoints ? createBreakpoints(themeProp.breakpoints) : systemBreakpoints
|
|
130
|
+
breakpoints: themeProp.breakpoints ? createBreakpoints(themeProp.breakpoints) : systemBreakpoints,
|
|
131
|
+
getThemeVar: createGetThemeVar(prefix)
|
|
130
132
|
});
|
|
131
133
|
const styleSheet = {};
|
|
132
134
|
Object.entries(colorSchemes).forEach(([key, scheme]) => {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function createGetThemeVar(prefix = '') {
|
|
2
|
+
function appendVar(...vars) {
|
|
3
|
+
if (!vars.length) {
|
|
4
|
+
return '';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
return `, var(--${prefix ? `${prefix}-` : ''}${vars[0]}${appendVar(...vars.slice(1))})`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const getThemeVar = (field, ...vars) => {
|
|
11
|
+
return `var(--${prefix ? `${prefix}-` : ''}${field}${appendVar(...vars)})`;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return getThemeVar;
|
|
15
|
+
}
|
package/esm/index.js
CHANGED
|
@@ -38,4 +38,5 @@ export { default as useTheme } from './useTheme';
|
|
|
38
38
|
export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
|
|
39
39
|
export * from './colorManipulator';
|
|
40
40
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
41
|
-
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
41
|
+
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
42
|
+
export { default as unstable_createGetThemeVar } from './cssVars/createGetThemeVar';
|
package/index.d.ts
CHANGED
|
@@ -161,4 +161,5 @@ export { default as ThemeProvider } from './ThemeProvider';
|
|
|
161
161
|
export * from './ThemeProvider';
|
|
162
162
|
|
|
163
163
|
export { default as unstable_createCssVarsProvider } from './cssVars';
|
|
164
|
+
export { default as unstable_createGetThemeVar } from './cssVars/createGetThemeVar';
|
|
164
165
|
export * from './cssVars';
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.2.
|
|
1
|
+
/** @license MUI v5.2.6
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -49,7 +49,8 @@ var _exportNames = {
|
|
|
49
49
|
useTheme: true,
|
|
50
50
|
useThemeWithoutDefault: true,
|
|
51
51
|
ThemeProvider: true,
|
|
52
|
-
unstable_createCssVarsProvider: true
|
|
52
|
+
unstable_createCssVarsProvider: true,
|
|
53
|
+
unstable_createGetThemeVar: true
|
|
53
54
|
};
|
|
54
55
|
Object.defineProperty(exports, "Box", {
|
|
55
56
|
enumerable: true,
|
|
@@ -243,6 +244,12 @@ Object.defineProperty(exports, "unstable_createCssVarsProvider", {
|
|
|
243
244
|
return _createCssVarsProvider.default;
|
|
244
245
|
}
|
|
245
246
|
});
|
|
247
|
+
Object.defineProperty(exports, "unstable_createGetThemeVar", {
|
|
248
|
+
enumerable: true,
|
|
249
|
+
get: function () {
|
|
250
|
+
return _createGetThemeVar.default;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
246
253
|
Object.defineProperty(exports, "unstable_extendSxProp", {
|
|
247
254
|
enumerable: true,
|
|
248
255
|
get: function () {
|
|
@@ -468,6 +475,8 @@ var _ThemeProvider = _interopRequireDefault(require("./ThemeProvider"));
|
|
|
468
475
|
|
|
469
476
|
var _createCssVarsProvider = _interopRequireDefault(require("./cssVars/createCssVarsProvider"));
|
|
470
477
|
|
|
478
|
+
var _createGetThemeVar = _interopRequireDefault(require("./cssVars/createGetThemeVar"));
|
|
479
|
+
|
|
471
480
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
472
481
|
|
|
473
482
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/index.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -13,6 +13,7 @@ import cssVarsParser from './cssVarsParser';
|
|
|
13
13
|
import ThemeProvider from '../ThemeProvider';
|
|
14
14
|
import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
|
|
15
15
|
import useCurrentColorScheme from './useCurrentColorScheme';
|
|
16
|
+
import createGetThemeVar from './createGetThemeVar';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export var DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
|
|
@@ -132,7 +133,8 @@ export default function createCssVarsProvider(options) {
|
|
|
132
133
|
colorSchemes: colorSchemes,
|
|
133
134
|
vars: rootVars,
|
|
134
135
|
spacing: themeProp.spacing ? createSpacing(themeProp.spacing) : systemSpacing,
|
|
135
|
-
breakpoints: themeProp.breakpoints ? createBreakpoints(themeProp.breakpoints) : systemBreakpoints
|
|
136
|
+
breakpoints: themeProp.breakpoints ? createBreakpoints(themeProp.breakpoints) : systemBreakpoints,
|
|
137
|
+
getThemeVar: createGetThemeVar(prefix)
|
|
136
138
|
});
|
|
137
139
|
var styleSheet = {};
|
|
138
140
|
Object.entries(colorSchemes).forEach(function (_ref2) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
export default function createGetThemeVar() {
|
|
3
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
4
|
+
|
|
5
|
+
function appendVar() {
|
|
6
|
+
for (var _len = arguments.length, vars = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7
|
+
vars[_key] = arguments[_key];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (!vars.length) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return ", var(--".concat(prefix ? "".concat(prefix, "-") : '').concat(vars[0]).concat(appendVar.apply(void 0, _toConsumableArray(vars.slice(1))), ")");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var getThemeVar = function getThemeVar(field) {
|
|
18
|
+
for (var _len2 = arguments.length, vars = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
19
|
+
vars[_key2 - 1] = arguments[_key2];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return "var(--".concat(prefix ? "".concat(prefix, "-") : '').concat(field).concat(appendVar.apply(void 0, vars), ")");
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return getThemeVar;
|
|
26
|
+
}
|
package/legacy/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.2.
|
|
1
|
+
/** @license MUI v5.2.6
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -43,4 +43,5 @@ export { default as useTheme } from './useTheme';
|
|
|
43
43
|
export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
|
|
44
44
|
export * from './colorManipulator';
|
|
45
45
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
46
|
-
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
46
|
+
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
47
|
+
export { default as unstable_createGetThemeVar } from './cssVars/createGetThemeVar';
|
|
@@ -14,6 +14,7 @@ import cssVarsParser from './cssVarsParser';
|
|
|
14
14
|
import ThemeProvider from '../ThemeProvider';
|
|
15
15
|
import getInitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_MODE_STORAGE_KEY } from './getInitColorSchemeScript';
|
|
16
16
|
import useCurrentColorScheme from './useCurrentColorScheme';
|
|
17
|
+
import createGetThemeVar from './createGetThemeVar';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
export const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
|
|
@@ -124,7 +125,8 @@ export default function createCssVarsProvider(options) {
|
|
|
124
125
|
colorSchemes,
|
|
125
126
|
vars: rootVars,
|
|
126
127
|
spacing: themeProp.spacing ? createSpacing(themeProp.spacing) : systemSpacing,
|
|
127
|
-
breakpoints: themeProp.breakpoints ? createBreakpoints(themeProp.breakpoints) : systemBreakpoints
|
|
128
|
+
breakpoints: themeProp.breakpoints ? createBreakpoints(themeProp.breakpoints) : systemBreakpoints,
|
|
129
|
+
getThemeVar: createGetThemeVar(prefix)
|
|
128
130
|
});
|
|
129
131
|
const styleSheet = {};
|
|
130
132
|
Object.entries(colorSchemes).forEach(([key, scheme]) => {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function createGetThemeVar(prefix = '') {
|
|
2
|
+
function appendVar(...vars) {
|
|
3
|
+
if (!vars.length) {
|
|
4
|
+
return '';
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
return `, var(--${prefix ? `${prefix}-` : ''}${vars[0]}${appendVar(...vars.slice(1))})`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const getThemeVar = (field, ...vars) => {
|
|
11
|
+
return `var(--${prefix ? `${prefix}-` : ''}${field}${appendVar(...vars)})`;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return getThemeVar;
|
|
15
|
+
}
|
package/modern/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.2.
|
|
1
|
+
/** @license MUI v5.2.6
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -43,4 +43,5 @@ export { default as useTheme } from './useTheme';
|
|
|
43
43
|
export { default as useThemeWithoutDefault } from './useThemeWithoutDefault';
|
|
44
44
|
export * from './colorManipulator';
|
|
45
45
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
46
|
-
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
46
|
+
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
47
|
+
export { default as unstable_createGetThemeVar } from './cssVars/createGetThemeVar';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.6",
|
|
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.6",
|
|
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 {};
|