@mui/system 5.10.14 → 5.10.15
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 +62 -0
- package/Container/Container.d.ts +13 -13
- package/Container/ContainerProps.d.ts +40 -40
- package/Container/containerClasses.d.ts +22 -22
- package/Container/createContainer.d.ts +18 -18
- package/Stack/Stack.d.ts +13 -13
- package/Stack/StackProps.d.ts +42 -42
- package/Stack/createStack.d.ts +21 -21
- package/Stack/index.d.ts +5 -5
- package/Stack/stackClasses.d.ts +8 -8
- package/Unstable_Grid/Grid.d.ts +12 -12
- package/Unstable_Grid/GridProps.d.ts +162 -162
- package/Unstable_Grid/createGrid.d.ts +11 -11
- package/Unstable_Grid/gridClasses.d.ts +20 -20
- package/Unstable_Grid/gridGenerator.d.ts +29 -29
- package/Unstable_Grid/index.d.ts +5 -5
- package/createBox.spec.d.ts +1 -1
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.js +9 -2
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +65 -65
- package/cssVars/getInitColorSchemeScript.d.ts +42 -42
- package/cssVars/index.d.ts +3 -3
- package/cssVars/useCurrentColorScheme.d.ts +53 -53
- package/esm/cssVars/createCssVarsProvider.js +9 -2
- package/esm/index.js +2 -1
- package/esm/style.js +3 -3
- package/index.d.ts +2 -0
- package/index.js +16 -1
- package/index.spec.d.ts +1 -1
- package/legacy/cssVars/createCssVarsProvider.js +8 -1
- package/legacy/index.js +3 -2
- package/legacy/style.js +3 -3
- package/modern/cssVars/createCssVarsProvider.js +9 -2
- package/modern/index.js +3 -2
- package/modern/style.js +3 -3
- package/package.json +3 -3
- package/responsivePropType.d.ts +3 -0
- package/spacing.d.ts +14 -0
- package/style.d.ts +6 -0
- package/style.js +4 -3
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
|
@@ -1,65 +1,65 @@
|
|
|
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: <T extends string | Record<string, any> | null | undefined = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => 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, arrayKeys: Array<string>) => 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
|
-
* shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
|
|
41
|
-
* }} options.
|
|
42
|
-
* `prefix`: The prefix of the generated CSS variables. This function does not change the value.
|
|
43
|
-
*
|
|
44
|
-
* @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.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* const { css, vars, parsedTheme } = parser({
|
|
48
|
-
* fontSize: 12,
|
|
49
|
-
* lineHeight: 1.2,
|
|
50
|
-
* palette: { primary: { 500: 'var(--color)' } }
|
|
51
|
-
* }, { prefix: 'foo' })
|
|
52
|
-
*
|
|
53
|
-
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
|
|
54
|
-
* console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
|
|
55
|
-
* console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
|
|
56
|
-
*/
|
|
57
|
-
export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
|
|
58
|
-
prefix?: string;
|
|
59
|
-
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
60
|
-
}): {
|
|
61
|
-
css: Record<string, string | number>;
|
|
62
|
-
vars: NestedRecord<string>;
|
|
63
|
-
parsedTheme: T;
|
|
64
|
-
};
|
|
65
|
-
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: <T extends string | Record<string, any> | null | undefined = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => 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, arrayKeys: Array<string>) => 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
|
+
* shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
|
|
41
|
+
* }} options.
|
|
42
|
+
* `prefix`: The prefix of the generated CSS variables. This function does not change the value.
|
|
43
|
+
*
|
|
44
|
+
* @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.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const { css, vars, parsedTheme } = parser({
|
|
48
|
+
* fontSize: 12,
|
|
49
|
+
* lineHeight: 1.2,
|
|
50
|
+
* palette: { primary: { 500: 'var(--color)' } }
|
|
51
|
+
* }, { prefix: 'foo' })
|
|
52
|
+
*
|
|
53
|
+
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
|
|
54
|
+
* console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
|
|
55
|
+
* console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--color)' } } }
|
|
56
|
+
*/
|
|
57
|
+
export default function cssVarsParser<T extends Record<string, any>>(theme: T, options?: {
|
|
58
|
+
prefix?: string;
|
|
59
|
+
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
60
|
+
}): {
|
|
61
|
+
css: Record<string, string | number>;
|
|
62
|
+
vars: NestedRecord<string>;
|
|
63
|
+
parsedTheme: T;
|
|
64
|
+
};
|
|
65
|
+
export {};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
|
|
3
|
-
export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
|
|
4
|
-
export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
|
|
5
|
-
export interface GetInitColorSchemeScriptOptions {
|
|
6
|
-
/**
|
|
7
|
-
* The mode to be used for the first visit
|
|
8
|
-
* @default 'light'
|
|
9
|
-
*/
|
|
10
|
-
defaultMode?: 'light' | 'dark' | 'system';
|
|
11
|
-
/**
|
|
12
|
-
* The default color scheme to be used on the light mode
|
|
13
|
-
* @default 'light'
|
|
14
|
-
*/
|
|
15
|
-
defaultLightColorScheme?: string;
|
|
16
|
-
/**
|
|
17
|
-
* The default color scheme to be used on the dark mode
|
|
18
|
-
* * @default 'dark'
|
|
19
|
-
*/
|
|
20
|
-
defaultDarkColorScheme?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The node (provided as string) used to attach the color-scheme attribute
|
|
23
|
-
* @default 'document.documentElement'
|
|
24
|
-
*/
|
|
25
|
-
colorSchemeNode?: string;
|
|
26
|
-
/**
|
|
27
|
-
* localStorage key used to store `mode`
|
|
28
|
-
* @default 'mode'
|
|
29
|
-
*/
|
|
30
|
-
modeStorageKey?: string;
|
|
31
|
-
/**
|
|
32
|
-
* localStorage key used to store `colorScheme`
|
|
33
|
-
* @default 'color-scheme'
|
|
34
|
-
*/
|
|
35
|
-
colorSchemeStorageKey?: string;
|
|
36
|
-
/**
|
|
37
|
-
* DOM attribute for applying color scheme
|
|
38
|
-
* @default 'data-color-scheme'
|
|
39
|
-
*/
|
|
40
|
-
attribute?: string;
|
|
41
|
-
}
|
|
42
|
-
export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
|
|
3
|
+
export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
|
|
4
|
+
export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
|
|
5
|
+
export interface GetInitColorSchemeScriptOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The mode to be used for the first visit
|
|
8
|
+
* @default 'light'
|
|
9
|
+
*/
|
|
10
|
+
defaultMode?: 'light' | 'dark' | 'system';
|
|
11
|
+
/**
|
|
12
|
+
* The default color scheme to be used on the light mode
|
|
13
|
+
* @default 'light'
|
|
14
|
+
*/
|
|
15
|
+
defaultLightColorScheme?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The default color scheme to be used on the dark mode
|
|
18
|
+
* * @default 'dark'
|
|
19
|
+
*/
|
|
20
|
+
defaultDarkColorScheme?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The node (provided as string) used to attach the color-scheme attribute
|
|
23
|
+
* @default 'document.documentElement'
|
|
24
|
+
*/
|
|
25
|
+
colorSchemeNode?: string;
|
|
26
|
+
/**
|
|
27
|
+
* localStorage key used to store `mode`
|
|
28
|
+
* @default 'mode'
|
|
29
|
+
*/
|
|
30
|
+
modeStorageKey?: string;
|
|
31
|
+
/**
|
|
32
|
+
* localStorage key used to store `colorScheme`
|
|
33
|
+
* @default 'color-scheme'
|
|
34
|
+
*/
|
|
35
|
+
colorSchemeStorageKey?: string;
|
|
36
|
+
/**
|
|
37
|
+
* DOM attribute for applying color scheme
|
|
38
|
+
* @default 'data-color-scheme'
|
|
39
|
+
*/
|
|
40
|
+
attribute?: string;
|
|
41
|
+
}
|
|
42
|
+
export default function getInitColorSchemeScript(options?: GetInitColorSchemeScriptOptions): JSX.Element;
|
package/cssVars/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from './createCssVarsProvider';
|
|
2
|
-
export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
|
|
3
|
-
export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
|
|
1
|
+
export { default } from './createCssVarsProvider';
|
|
2
|
+
export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
|
|
3
|
+
export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
|
|
@@ -1,53 +1,53 @@
|
|
|
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
|
-
interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
|
|
44
|
-
defaultLightColorScheme: SupportedColorScheme;
|
|
45
|
-
defaultDarkColorScheme: SupportedColorScheme;
|
|
46
|
-
supportedColorSchemes: Array<SupportedColorScheme>;
|
|
47
|
-
defaultMode?: Mode;
|
|
48
|
-
modeStorageKey?: string;
|
|
49
|
-
colorSchemeStorageKey?: string;
|
|
50
|
-
storageWindow?: Window | null;
|
|
51
|
-
}
|
|
52
|
-
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
|
|
53
|
-
export {};
|
|
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
|
+
interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
|
|
44
|
+
defaultLightColorScheme: SupportedColorScheme;
|
|
45
|
+
defaultDarkColorScheme: SupportedColorScheme;
|
|
46
|
+
supportedColorSchemes: Array<SupportedColorScheme>;
|
|
47
|
+
defaultMode?: Mode;
|
|
48
|
+
modeStorageKey?: string;
|
|
49
|
+
colorSchemeStorageKey?: string;
|
|
50
|
+
storageWindow?: Window | null;
|
|
51
|
+
}
|
|
52
|
+
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
|
|
53
|
+
export {};
|
|
@@ -114,7 +114,7 @@ export default function createCssVarsProvider(options) {
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// 3. Start composing the theme object
|
|
117
|
-
|
|
117
|
+
const theme = _extends({}, parsedTheme, {
|
|
118
118
|
components,
|
|
119
119
|
colorSchemes,
|
|
120
120
|
cssVarPrefix,
|
|
@@ -139,7 +139,14 @@ export default function createCssVarsProvider(options) {
|
|
|
139
139
|
theme.vars = deepmerge(theme.vars, vars);
|
|
140
140
|
if (key === calculatedColorScheme) {
|
|
141
141
|
// 4.1 Merge the selected color scheme to the theme
|
|
142
|
-
|
|
142
|
+
Object.keys(parsedScheme).forEach(schemeKey => {
|
|
143
|
+
if (parsedScheme[schemeKey] && typeof parsedScheme[schemeKey] === 'object') {
|
|
144
|
+
// shallow merge the 1st level structure of the theme.
|
|
145
|
+
theme[schemeKey] = _extends({}, theme[schemeKey], parsedScheme[schemeKey]);
|
|
146
|
+
} else {
|
|
147
|
+
theme[schemeKey] = parsedScheme[schemeKey];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
143
150
|
if (theme.palette) {
|
|
144
151
|
theme.palette.colorScheme = key;
|
|
145
152
|
}
|
package/esm/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export { default as sizing } from './sizing';
|
|
|
18
18
|
export * from './sizing';
|
|
19
19
|
export { default as spacing } from './spacing';
|
|
20
20
|
export * from './spacing';
|
|
21
|
-
export { default as style, getPath } from './style';
|
|
21
|
+
export { default as style, getPath, getStyleValue } from './style';
|
|
22
22
|
export { default as typography } from './typography';
|
|
23
23
|
export * from './typography';
|
|
24
24
|
export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp } from './styleFunctionSx';
|
|
@@ -40,6 +40,7 @@ export * from './colorManipulator';
|
|
|
40
40
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
41
41
|
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
42
42
|
export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
|
|
43
|
+
export { default as responsivePropType } from './responsivePropType';
|
|
43
44
|
|
|
44
45
|
/** ----------------- */
|
|
45
46
|
/** Layout components */
|
package/esm/style.js
CHANGED
|
@@ -20,7 +20,7 @@ export function getPath(obj, path, checkVars = true) {
|
|
|
20
20
|
return null;
|
|
21
21
|
}, obj);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
export function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
|
24
24
|
let value;
|
|
25
25
|
if (typeof themeMapping === 'function') {
|
|
26
26
|
value = themeMapping(propValueFinal);
|
|
@@ -49,10 +49,10 @@ function style(options) {
|
|
|
49
49
|
const theme = props.theme;
|
|
50
50
|
const themeMapping = getPath(theme, themeKey) || {};
|
|
51
51
|
const styleFromPropValue = propValueFinal => {
|
|
52
|
-
let value =
|
|
52
|
+
let value = getStyleValue(themeMapping, transform, propValueFinal);
|
|
53
53
|
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
|
54
54
|
// Haven't found value
|
|
55
|
-
value =
|
|
55
|
+
value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
|
|
56
56
|
}
|
|
57
57
|
if (cssProperty === false) {
|
|
58
58
|
return value;
|
package/index.d.ts
CHANGED
|
@@ -165,6 +165,8 @@ export { default as unstable_createCssVarsProvider, CreateCssVarsProviderResult
|
|
|
165
165
|
export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
|
|
166
166
|
export * from './cssVars';
|
|
167
167
|
|
|
168
|
+
export { default as responsivePropType } from './responsivePropType';
|
|
169
|
+
|
|
168
170
|
export { default as createContainer } from './Container/createContainer';
|
|
169
171
|
export * from './Container/createContainer';
|
|
170
172
|
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.10.
|
|
1
|
+
/** @license MUI v5.10.15
|
|
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.
|
|
@@ -30,6 +30,7 @@ var _exportNames = {
|
|
|
30
30
|
spacing: true,
|
|
31
31
|
style: true,
|
|
32
32
|
getPath: true,
|
|
33
|
+
getStyleValue: true,
|
|
33
34
|
typography: true,
|
|
34
35
|
unstable_styleFunctionSx: true,
|
|
35
36
|
unstable_createStyleFunctionSx: true,
|
|
@@ -51,6 +52,7 @@ var _exportNames = {
|
|
|
51
52
|
ThemeProvider: true,
|
|
52
53
|
unstable_createCssVarsProvider: true,
|
|
53
54
|
unstable_createGetCssVar: true,
|
|
55
|
+
responsivePropType: true,
|
|
54
56
|
createContainer: true,
|
|
55
57
|
Container: true,
|
|
56
58
|
Unstable_Grid: true,
|
|
@@ -182,6 +184,12 @@ Object.defineProperty(exports, "getPath", {
|
|
|
182
184
|
return _style.getPath;
|
|
183
185
|
}
|
|
184
186
|
});
|
|
187
|
+
Object.defineProperty(exports, "getStyleValue", {
|
|
188
|
+
enumerable: true,
|
|
189
|
+
get: function () {
|
|
190
|
+
return _style.getStyleValue;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
185
193
|
Object.defineProperty(exports, "getThemeProps", {
|
|
186
194
|
enumerable: true,
|
|
187
195
|
get: function () {
|
|
@@ -224,6 +232,12 @@ Object.defineProperty(exports, "positions", {
|
|
|
224
232
|
return _positions.default;
|
|
225
233
|
}
|
|
226
234
|
});
|
|
235
|
+
Object.defineProperty(exports, "responsivePropType", {
|
|
236
|
+
enumerable: true,
|
|
237
|
+
get: function () {
|
|
238
|
+
return _responsivePropType.default;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
227
241
|
Object.defineProperty(exports, "shadows", {
|
|
228
242
|
enumerable: true,
|
|
229
243
|
get: function () {
|
|
@@ -468,6 +482,7 @@ Object.keys(_colorManipulator).forEach(function (key) {
|
|
|
468
482
|
var _ThemeProvider = _interopRequireDefault(require("./ThemeProvider"));
|
|
469
483
|
var _createCssVarsProvider = _interopRequireDefault(require("./cssVars/createCssVarsProvider"));
|
|
470
484
|
var _createGetCssVar = _interopRequireDefault(require("./cssVars/createGetCssVar"));
|
|
485
|
+
var _responsivePropType = _interopRequireDefault(require("./responsivePropType"));
|
|
471
486
|
var _createContainer = _interopRequireDefault(require("./Container/createContainer"));
|
|
472
487
|
var _Container = _interopRequireWildcard(require("./Container"));
|
|
473
488
|
Object.keys(_Container).forEach(function (key) {
|
package/index.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -156,7 +156,14 @@ export default function createCssVarsProvider(options) {
|
|
|
156
156
|
theme.vars = deepmerge(theme.vars, vars);
|
|
157
157
|
if (key === calculatedColorScheme) {
|
|
158
158
|
// 4.1 Merge the selected color scheme to the theme
|
|
159
|
-
|
|
159
|
+
Object.keys(parsedScheme).forEach(function (schemeKey) {
|
|
160
|
+
if (parsedScheme[schemeKey] && _typeof(parsedScheme[schemeKey]) === 'object') {
|
|
161
|
+
// shallow merge the 1st level structure of the theme.
|
|
162
|
+
theme[schemeKey] = _extends({}, theme[schemeKey], parsedScheme[schemeKey]);
|
|
163
|
+
} else {
|
|
164
|
+
theme[schemeKey] = parsedScheme[schemeKey];
|
|
165
|
+
}
|
|
166
|
+
});
|
|
160
167
|
if (theme.palette) {
|
|
161
168
|
theme.palette.colorScheme = key;
|
|
162
169
|
}
|
package/legacy/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.10.
|
|
1
|
+
/** @license MUI v5.10.15
|
|
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.
|
|
@@ -23,7 +23,7 @@ export { default as sizing } from './sizing';
|
|
|
23
23
|
export * from './sizing';
|
|
24
24
|
export { default as spacing } from './spacing';
|
|
25
25
|
export * from './spacing';
|
|
26
|
-
export { default as style, getPath } from './style';
|
|
26
|
+
export { default as style, getPath, getStyleValue } from './style';
|
|
27
27
|
export { default as typography } from './typography';
|
|
28
28
|
export * from './typography';
|
|
29
29
|
export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp } from './styleFunctionSx';
|
|
@@ -45,6 +45,7 @@ export * from './colorManipulator';
|
|
|
45
45
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
46
46
|
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
47
47
|
export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
|
|
48
|
+
export { default as responsivePropType } from './responsivePropType';
|
|
48
49
|
|
|
49
50
|
/** ----------------- */
|
|
50
51
|
/** Layout components */
|
package/legacy/style.js
CHANGED
|
@@ -24,7 +24,7 @@ export function getPath(obj, path) {
|
|
|
24
24
|
return null;
|
|
25
25
|
}, obj);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
export function getStyleValue(themeMapping, transform, propValueFinal) {
|
|
28
28
|
var userValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : propValueFinal;
|
|
29
29
|
var value;
|
|
30
30
|
if (typeof themeMapping === 'function') {
|
|
@@ -53,10 +53,10 @@ function style(options) {
|
|
|
53
53
|
var theme = props.theme;
|
|
54
54
|
var themeMapping = getPath(theme, themeKey) || {};
|
|
55
55
|
var styleFromPropValue = function styleFromPropValue(propValueFinal) {
|
|
56
|
-
var value =
|
|
56
|
+
var value = getStyleValue(themeMapping, transform, propValueFinal);
|
|
57
57
|
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
|
58
58
|
// Haven't found value
|
|
59
|
-
value =
|
|
59
|
+
value = getStyleValue(themeMapping, transform, "".concat(prop).concat(propValueFinal === 'default' ? '' : capitalize(propValueFinal)), propValueFinal);
|
|
60
60
|
}
|
|
61
61
|
if (cssProperty === false) {
|
|
62
62
|
return value;
|
|
@@ -114,7 +114,7 @@ export default function createCssVarsProvider(options) {
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// 3. Start composing the theme object
|
|
117
|
-
|
|
117
|
+
const theme = _extends({}, parsedTheme, {
|
|
118
118
|
components,
|
|
119
119
|
colorSchemes,
|
|
120
120
|
cssVarPrefix,
|
|
@@ -139,7 +139,14 @@ export default function createCssVarsProvider(options) {
|
|
|
139
139
|
theme.vars = deepmerge(theme.vars, vars);
|
|
140
140
|
if (key === calculatedColorScheme) {
|
|
141
141
|
// 4.1 Merge the selected color scheme to the theme
|
|
142
|
-
|
|
142
|
+
Object.keys(parsedScheme).forEach(schemeKey => {
|
|
143
|
+
if (parsedScheme[schemeKey] && typeof parsedScheme[schemeKey] === 'object') {
|
|
144
|
+
// shallow merge the 1st level structure of the theme.
|
|
145
|
+
theme[schemeKey] = _extends({}, theme[schemeKey], parsedScheme[schemeKey]);
|
|
146
|
+
} else {
|
|
147
|
+
theme[schemeKey] = parsedScheme[schemeKey];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
143
150
|
if (theme.palette) {
|
|
144
151
|
theme.palette.colorScheme = key;
|
|
145
152
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.10.
|
|
1
|
+
/** @license MUI v5.10.15
|
|
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.
|
|
@@ -23,7 +23,7 @@ export { default as sizing } from './sizing';
|
|
|
23
23
|
export * from './sizing';
|
|
24
24
|
export { default as spacing } from './spacing';
|
|
25
25
|
export * from './spacing';
|
|
26
|
-
export { default as style, getPath } from './style';
|
|
26
|
+
export { default as style, getPath, getStyleValue } from './style';
|
|
27
27
|
export { default as typography } from './typography';
|
|
28
28
|
export * from './typography';
|
|
29
29
|
export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp } from './styleFunctionSx';
|
|
@@ -45,6 +45,7 @@ export * from './colorManipulator';
|
|
|
45
45
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
46
46
|
export { default as unstable_createCssVarsProvider } from './cssVars/createCssVarsProvider';
|
|
47
47
|
export { default as unstable_createGetCssVar } from './cssVars/createGetCssVar';
|
|
48
|
+
export { default as responsivePropType } from './responsivePropType';
|
|
48
49
|
|
|
49
50
|
/** ----------------- */
|
|
50
51
|
/** Layout components */
|
package/modern/style.js
CHANGED
|
@@ -20,7 +20,7 @@ export function getPath(obj, path, checkVars = true) {
|
|
|
20
20
|
return null;
|
|
21
21
|
}, obj);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
export function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
|
24
24
|
let value;
|
|
25
25
|
if (typeof themeMapping === 'function') {
|
|
26
26
|
value = themeMapping(propValueFinal);
|
|
@@ -49,10 +49,10 @@ function style(options) {
|
|
|
49
49
|
const theme = props.theme;
|
|
50
50
|
const themeMapping = getPath(theme, themeKey) || {};
|
|
51
51
|
const styleFromPropValue = propValueFinal => {
|
|
52
|
-
let value =
|
|
52
|
+
let value = getStyleValue(themeMapping, transform, propValueFinal);
|
|
53
53
|
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
|
54
54
|
// Haven't found value
|
|
55
|
-
value =
|
|
55
|
+
value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
|
|
56
56
|
}
|
|
57
57
|
if (cssProperty === false) {
|
|
58
58
|
return value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.10.
|
|
3
|
+
"version": "5.10.15",
|
|
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.20.1",
|
|
47
|
-
"@mui/private-theming": "^5.10.
|
|
47
|
+
"@mui/private-theming": "^5.10.15",
|
|
48
48
|
"@mui/styled-engine": "^5.10.14",
|
|
49
49
|
"@mui/types": "^7.2.1",
|
|
50
|
-
"@mui/utils": "^5.10.
|
|
50
|
+
"@mui/utils": "^5.10.15",
|
|
51
51
|
"clsx": "^1.2.1",
|
|
52
52
|
"csstype": "^3.1.1",
|
|
53
53
|
"prop-types": "^15.8.1"
|
package/spacing.d.ts
CHANGED
|
@@ -10,6 +10,20 @@ export function createUnarySpacing<Spacing>(theme: { spacing: Spacing }): Spacin
|
|
|
10
10
|
: // warns in Dev
|
|
11
11
|
() => undefined;
|
|
12
12
|
|
|
13
|
+
export function createUnaryUnit<Spacing>(
|
|
14
|
+
theme: { spacing: Spacing },
|
|
15
|
+
themeKey: string,
|
|
16
|
+
defaultValue: Spacing,
|
|
17
|
+
propName: string,
|
|
18
|
+
): Spacing extends number
|
|
19
|
+
? (abs: number | string) => number | number
|
|
20
|
+
: Spacing extends any[]
|
|
21
|
+
? <Index extends number>(abs: Index | string) => Spacing[Index] | string
|
|
22
|
+
: Spacing extends (...args: unknown[]) => unknown
|
|
23
|
+
? Spacing
|
|
24
|
+
: // warns in Dev
|
|
25
|
+
() => undefined;
|
|
26
|
+
|
|
13
27
|
export const margin: SimpleStyleFunction<
|
|
14
28
|
| 'm'
|
|
15
29
|
| 'mt'
|