@mui/system 7.0.0-beta.3 → 7.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/borders/borders.d.ts +3 -2
- package/colorManipulator/colorManipulator.js +3 -3
- package/cssContainerQueries/cssContainerQueries.js +2 -2
- package/cssGrid/cssGrid.d.ts +15 -2
- package/cssVars/createCssVarsProvider.d.ts +6 -0
- package/cssVars/createCssVarsProvider.js +14 -4
- package/display/display.d.ts +2 -1
- package/esm/borders/borders.d.ts +3 -2
- package/esm/colorManipulator/colorManipulator.js +3 -3
- package/esm/cssContainerQueries/cssContainerQueries.js +2 -2
- package/esm/cssGrid/cssGrid.d.ts +15 -2
- package/esm/cssVars/createCssVarsProvider.d.ts +6 -0
- package/esm/cssVars/createCssVarsProvider.js +14 -4
- package/esm/display/display.d.ts +2 -1
- package/esm/flexbox/flexbox.d.ts +2 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +3 -3
- package/esm/palette/palette.d.ts +2 -1
- package/esm/positions/positions.d.ts +2 -1
- package/esm/shadows/shadows.d.ts +2 -1
- package/esm/sizing/sizing.d.ts +2 -1
- package/esm/spacing/spacing.d.ts +2 -1
- package/esm/spacing/spacing.js +9 -0
- package/esm/style/style.d.ts +4 -4
- package/esm/typography/typography.d.ts +2 -1
- package/esm/version/index.js +2 -2
- package/flexbox/flexbox.d.ts +2 -1
- package/index.d.ts +1 -0
- package/index.js +3 -3
- package/modern/borders/borders.d.ts +3 -2
- package/modern/colorManipulator/colorManipulator.js +3 -3
- package/modern/cssContainerQueries/cssContainerQueries.js +2 -2
- package/modern/cssGrid/cssGrid.d.ts +15 -2
- package/modern/cssVars/createCssVarsProvider.d.ts +6 -0
- package/modern/cssVars/createCssVarsProvider.js +14 -4
- package/modern/display/display.d.ts +2 -1
- package/modern/flexbox/flexbox.d.ts +2 -1
- package/modern/index.d.ts +1 -0
- package/modern/index.js +3 -3
- package/modern/palette/palette.d.ts +2 -1
- package/modern/positions/positions.d.ts +2 -1
- package/modern/shadows/shadows.d.ts +2 -1
- package/modern/sizing/sizing.d.ts +2 -1
- package/modern/spacing/spacing.d.ts +2 -1
- package/modern/spacing/spacing.js +9 -0
- package/modern/style/style.d.ts +4 -4
- package/modern/typography/typography.d.ts +2 -1
- package/modern/version/index.js +2 -2
- package/package.json +6 -6
- package/palette/palette.d.ts +2 -1
- package/positions/positions.d.ts +2 -1
- package/shadows/shadows.d.ts +2 -1
- package/sizing/sizing.d.ts +2 -1
- package/spacing/spacing.d.ts +2 -1
- package/spacing/spacing.js +9 -0
- package/style/style.d.ts +4 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/typography/typography.d.ts +2 -1
- package/version/index.js +2 -2
|
@@ -35,6 +35,12 @@ export interface CssVarsProviderConfig<ColorScheme extends string> {
|
|
|
35
35
|
* @default false
|
|
36
36
|
*/
|
|
37
37
|
disableTransitionOnChange?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* If `true`, theme values are recalculated when the mode changes.
|
|
40
|
+
* The `theme.colorSchemes.{mode}.*` nodes will be shallow merged to the top-level of the theme.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
forceThemeRerender?: boolean;
|
|
38
44
|
}
|
|
39
45
|
type Identify<I extends string | undefined, T> = I extends string ? T | { [k in I]: T } : T;
|
|
40
46
|
export interface CreateCssVarsProviderResult<ColorScheme extends string, Identifier extends string | undefined = undefined> {
|
|
@@ -57,6 +57,7 @@ export default function createCssVarsProvider(options) {
|
|
|
57
57
|
disableNestedContext = false,
|
|
58
58
|
disableStyleSheetGeneration = false,
|
|
59
59
|
defaultMode: initialMode = 'system',
|
|
60
|
+
forceThemeRerender = false,
|
|
60
61
|
noSsr
|
|
61
62
|
} = props;
|
|
62
63
|
const hasMounted = React.useRef(false);
|
|
@@ -108,10 +109,15 @@ export default function createCssVarsProvider(options) {
|
|
|
108
109
|
mode = ctx.mode;
|
|
109
110
|
colorScheme = ctx.colorScheme;
|
|
110
111
|
}
|
|
112
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
113
|
+
if (forceThemeRerender && !restThemeProp.vars) {
|
|
114
|
+
console.warn(['MUI: The `forceThemeRerender` prop should only be used with CSS theme variables.', 'Note that it will slow down the app when changing between modes, so only do this when you cannot find a better solution.'].join('\n'));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const calculatedColorScheme = forceThemeRerender && restThemeProp.vars ?
|
|
118
|
+
// `colorScheme` is undefined on the server and hydration phase
|
|
119
|
+
colorScheme || restThemeProp.defaultColorScheme : restThemeProp.defaultColorScheme;
|
|
111
120
|
const memoTheme = React.useMemo(() => {
|
|
112
|
-
// `colorScheme` is undefined on the server and hydration phase
|
|
113
|
-
const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
|
|
114
|
-
|
|
115
121
|
// 2. get the `vars` object that refers to the CSS custom properties
|
|
116
122
|
const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
|
|
117
123
|
|
|
@@ -146,7 +152,7 @@ export default function createCssVarsProvider(options) {
|
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
154
|
return resolveTheme ? resolveTheme(theme) : theme;
|
|
149
|
-
}, [restThemeProp,
|
|
155
|
+
}, [restThemeProp, calculatedColorScheme, components, colorSchemes, cssVarPrefix]);
|
|
150
156
|
|
|
151
157
|
// 5. Declaring effects
|
|
152
158
|
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
|
@@ -284,6 +290,10 @@ export default function createCssVarsProvider(options) {
|
|
|
284
290
|
* The document to attach the attribute to.
|
|
285
291
|
*/
|
|
286
292
|
documentNode: PropTypes.any,
|
|
293
|
+
/**
|
|
294
|
+
* If `true`, theme values are recalculated when the mode changes.
|
|
295
|
+
*/
|
|
296
|
+
forceThemeRerender: PropTypes.bool,
|
|
287
297
|
/**
|
|
288
298
|
* The key in the local storage used to store current color scheme.
|
|
289
299
|
*/
|
package/modern/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { css, keyframes, StyledEngineProvider, Interpolation, CSSInterpolation,
|
|
|
27
27
|
export { default as GlobalStyles } from "./GlobalStyles/index.js";
|
|
28
28
|
export type { GlobalStylesProps } from "./GlobalStyles/index.js";
|
|
29
29
|
export * from "./style/index.js";
|
|
30
|
+
export { default as style } from "./style/index.js";
|
|
30
31
|
export * from "./spacing/index.js";
|
|
31
32
|
export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig } from "./styleFunctionSx/index.js";
|
|
32
33
|
export * from "./styleFunctionSx/index.js";
|
package/modern/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/system v7.0.0-
|
|
2
|
+
* @mui/system v7.0.0-rc.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
8
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
9
9
|
export { css, keyframes, StyledEngineProvider } from '@mui/styled-engine';
|
|
10
10
|
export { default as GlobalStyles } from "./GlobalStyles/index.js";
|
|
11
11
|
export { default as borders } from "./borders/index.js";
|
|
@@ -35,7 +35,7 @@ export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, ex
|
|
|
35
35
|
// TODO: Remove this function in v6
|
|
36
36
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
37
37
|
export function experimental_sx() {
|
|
38
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' :
|
|
38
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : _formatErrorMessage(19));
|
|
39
39
|
}
|
|
40
40
|
export { default as unstable_getThemeValue } from "./getThemeValue/index.js";
|
|
41
41
|
export { default as Box } from "./Box/index.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropsFor, SimpleStyleFunction, palette } from "../Box/index.js";
|
|
2
2
|
export const color: SimpleStyleFunction<'color'>;
|
|
3
3
|
export const bgcolor: SimpleStyleFunction<'bgcolor'>;
|
|
4
|
-
export type PaletteProps = PropsFor<typeof palette>;
|
|
4
|
+
export type PaletteProps = PropsFor<typeof palette>;
|
|
5
|
+
export default palette;
|
|
@@ -8,4 +8,5 @@ export const minHeight: SimpleStyleFunction<'minHeight'>;
|
|
|
8
8
|
export const sizeWidth: SimpleStyleFunction<'sizeWidth'>;
|
|
9
9
|
export const sizeHeight: SimpleStyleFunction<'sizeHeight'>;
|
|
10
10
|
export const boxSizing: SimpleStyleFunction<'boxSizing'>;
|
|
11
|
-
export type SizingProps = PropsFor<typeof sizing>;
|
|
11
|
+
export type SizingProps = PropsFor<typeof sizing>;
|
|
12
|
+
export default sizing;
|
|
@@ -15,4 +15,5 @@ export const margin: SimpleStyleFunction<'m' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx'
|
|
|
15
15
|
export type MarginProps = PropsFor<typeof margin>;
|
|
16
16
|
export const padding: SimpleStyleFunction<'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingX' | 'paddingY' | 'paddingInline' | 'paddingInlineStart' | 'paddingInlineEnd' | 'paddingBlock' | 'paddingBlockStart' | 'paddingBlockEnd'>;
|
|
17
17
|
export function getValue(transformer: (prop: SpacingValueType) => SpacingValueType, propValue: SpacingValueType): SpacingValueType;
|
|
18
|
-
export type PaddingProps = PropsFor<typeof padding>;
|
|
18
|
+
export type PaddingProps = PropsFor<typeof padding>;
|
|
19
|
+
export default spacing;
|
|
@@ -55,6 +55,12 @@ export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
if (typeof themeSpacing === 'string') {
|
|
58
|
+
if (themeSpacing.startsWith('var(') && val === 0) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
if (themeSpacing.startsWith('var(') && val === 1) {
|
|
62
|
+
return themeSpacing;
|
|
63
|
+
}
|
|
58
64
|
return `calc(${val} * ${themeSpacing})`;
|
|
59
65
|
}
|
|
60
66
|
return themeSpacing * val;
|
|
@@ -80,6 +86,9 @@ export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
|
80
86
|
if (typeof transformed === 'number') {
|
|
81
87
|
return -transformed;
|
|
82
88
|
}
|
|
89
|
+
if (typeof transformed === 'string' && transformed.startsWith('var(')) {
|
|
90
|
+
return `calc(-1 * ${transformed})`;
|
|
91
|
+
}
|
|
83
92
|
return `-${transformed}`;
|
|
84
93
|
};
|
|
85
94
|
}
|
package/modern/style/style.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export interface StyleOptions<PropKey> {
|
|
|
10
10
|
themeKey?: string;
|
|
11
11
|
transform?: TransformFunction;
|
|
12
12
|
}
|
|
13
|
-
export function
|
|
13
|
+
export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
|
|
14
|
+
export function getStyleValue(themeMapping: object | ((arg: any) => any), transform: TransformFunction | null, propValueFinal: unknown, userValue?: unknown): any;
|
|
15
|
+
export default function style<PropKey extends string, Theme extends object>(options: StyleOptions<PropKey>): StyleFunction<{ [K in PropKey]?: unknown } & {
|
|
14
16
|
theme?: Theme;
|
|
15
17
|
}> & {
|
|
16
18
|
filterProps: string[];
|
|
17
|
-
};
|
|
18
|
-
export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
|
|
19
|
-
export function getStyleValue(themeMapping: object | ((arg: any) => any), transform: TransformFunction | null, propValueFinal: unknown, userValue?: unknown): any;
|
|
19
|
+
};
|
|
@@ -8,4 +8,5 @@ export const letterSpacing: SimpleStyleFunction<'letterSpacing'>;
|
|
|
8
8
|
export const lineHeight: SimpleStyleFunction<'lineHeight'>;
|
|
9
9
|
export const textAlign: SimpleStyleFunction<'textAlign'>;
|
|
10
10
|
export const textTransform: SimpleStyleFunction<'textTransform'>;
|
|
11
|
-
export type TypographyProps = PropsFor<typeof typography>;
|
|
11
|
+
export type TypographyProps = PropsFor<typeof typography>;
|
|
12
|
+
export default typography;
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "7.0.0-
|
|
1
|
+
export const version = "7.0.0-rc.0";
|
|
2
2
|
export const major = Number("7");
|
|
3
3
|
export const minor = Number("0");
|
|
4
4
|
export const patch = Number("0");
|
|
5
|
-
export const prerelease = "
|
|
5
|
+
export const prerelease = "rc.0";
|
|
6
6
|
export default version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-rc.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "MUI System is a set of CSS utilities to help you build custom designs more efficiently. It makes it possible to rapidly lay out custom designs.",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"url": "https://opencollective.com/mui-org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@babel/runtime": "^7.26.
|
|
29
|
+
"@babel/runtime": "^7.26.10",
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
31
|
"csstype": "^3.1.3",
|
|
32
32
|
"prop-types": "^15.8.1",
|
|
33
|
-
"@mui/
|
|
34
|
-
"@mui/private-theming": "7.0.0-
|
|
35
|
-
"@mui/
|
|
36
|
-
"@mui/utils": "7.0.0-
|
|
33
|
+
"@mui/styled-engine": "7.0.0-rc.0",
|
|
34
|
+
"@mui/private-theming": "7.0.0-rc.0",
|
|
35
|
+
"@mui/types": "^7.3.1",
|
|
36
|
+
"@mui/utils": "7.0.0-rc.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@emotion/react": "^11.5.0",
|
package/palette/palette.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropsFor, SimpleStyleFunction, palette } from "../Box/index.js";
|
|
2
2
|
export const color: SimpleStyleFunction<'color'>;
|
|
3
3
|
export const bgcolor: SimpleStyleFunction<'bgcolor'>;
|
|
4
|
-
export type PaletteProps = PropsFor<typeof palette>;
|
|
4
|
+
export type PaletteProps = PropsFor<typeof palette>;
|
|
5
|
+
export default palette;
|
package/positions/positions.d.ts
CHANGED
package/shadows/shadows.d.ts
CHANGED
package/sizing/sizing.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export const minHeight: SimpleStyleFunction<'minHeight'>;
|
|
|
8
8
|
export const sizeWidth: SimpleStyleFunction<'sizeWidth'>;
|
|
9
9
|
export const sizeHeight: SimpleStyleFunction<'sizeHeight'>;
|
|
10
10
|
export const boxSizing: SimpleStyleFunction<'boxSizing'>;
|
|
11
|
-
export type SizingProps = PropsFor<typeof sizing>;
|
|
11
|
+
export type SizingProps = PropsFor<typeof sizing>;
|
|
12
|
+
export default sizing;
|
package/spacing/spacing.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ export const margin: SimpleStyleFunction<'m' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx'
|
|
|
15
15
|
export type MarginProps = PropsFor<typeof margin>;
|
|
16
16
|
export const padding: SimpleStyleFunction<'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingX' | 'paddingY' | 'paddingInline' | 'paddingInlineStart' | 'paddingInlineEnd' | 'paddingBlock' | 'paddingBlockStart' | 'paddingBlockEnd'>;
|
|
17
17
|
export function getValue(transformer: (prop: SpacingValueType) => SpacingValueType, propValue: SpacingValueType): SpacingValueType;
|
|
18
|
-
export type PaddingProps = PropsFor<typeof padding>;
|
|
18
|
+
export type PaddingProps = PropsFor<typeof padding>;
|
|
19
|
+
export default spacing;
|
package/spacing/spacing.js
CHANGED
|
@@ -70,6 +70,12 @@ function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
if (typeof themeSpacing === 'string') {
|
|
73
|
+
if (themeSpacing.startsWith('var(') && val === 0) {
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
if (themeSpacing.startsWith('var(') && val === 1) {
|
|
77
|
+
return themeSpacing;
|
|
78
|
+
}
|
|
73
79
|
return `calc(${val} * ${themeSpacing})`;
|
|
74
80
|
}
|
|
75
81
|
return themeSpacing * val;
|
|
@@ -95,6 +101,9 @@ function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
|
95
101
|
if (typeof transformed === 'number') {
|
|
96
102
|
return -transformed;
|
|
97
103
|
}
|
|
104
|
+
if (typeof transformed === 'string' && transformed.startsWith('var(')) {
|
|
105
|
+
return `calc(-1 * ${transformed})`;
|
|
106
|
+
}
|
|
98
107
|
return `-${transformed}`;
|
|
99
108
|
};
|
|
100
109
|
}
|
package/style/style.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export interface StyleOptions<PropKey> {
|
|
|
10
10
|
themeKey?: string;
|
|
11
11
|
transform?: TransformFunction;
|
|
12
12
|
}
|
|
13
|
-
export function
|
|
13
|
+
export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
|
|
14
|
+
export function getStyleValue(themeMapping: object | ((arg: any) => any), transform: TransformFunction | null, propValueFinal: unknown, userValue?: unknown): any;
|
|
15
|
+
export default function style<PropKey extends string, Theme extends object>(options: StyleOptions<PropKey>): StyleFunction<{ [K in PropKey]?: unknown } & {
|
|
14
16
|
theme?: Theme;
|
|
15
17
|
}> & {
|
|
16
18
|
filterProps: string[];
|
|
17
|
-
};
|
|
18
|
-
export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
|
|
19
|
-
export function getStyleValue(themeMapping: object | ((arg: any) => any), transform: TransformFunction | null, propValueFinal: unknown, userValue?: unknown): any;
|
|
19
|
+
};
|