@mui/system 5.4.2 → 5.5.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/Box/Box.spec.d.ts +1 -1
- package/CHANGELOG.md +196 -2
- package/createBox.spec.d.ts +1 -1
- package/createStyled.js +5 -1
- package/createTheme/createSpacing.d.ts +10 -10
- package/cssVars/createCssVarsProvider.d.ts +59 -102
- package/cssVars/createCssVarsProvider.js +28 -13
- package/cssVars/createCssVarsProvider.spec.d.ts +1 -1
- package/cssVars/createGetCssVar.d.ts +5 -5
- package/cssVars/cssVarsParser.d.ts +70 -68
- package/cssVars/cssVarsParser.js +17 -17
- package/cssVars/getInitColorSchemeScript.d.ts +12 -12
- package/cssVars/index.d.ts +1 -2
- package/cssVars/useCurrentColorScheme.d.ts +50 -50
- package/esm/createStyled.js +5 -1
- package/esm/cssVars/createCssVarsProvider.js +28 -14
- package/esm/cssVars/cssVarsParser.js +17 -17
- package/index.js +1 -1
- package/index.spec.d.ts +1 -1
- package/legacy/createStyled.js +5 -1
- package/legacy/cssVars/createCssVarsProvider.js +31 -16
- package/legacy/cssVars/cssVarsParser.js +23 -23
- package/legacy/index.js +1 -1
- package/modern/createStyled.js +5 -1
- package/modern/cssVars/createCssVarsProvider.js +28 -14
- package/modern/cssVars/cssVarsParser.js +17 -17
- package/modern/index.js +1 -1
- package/package.json +6 -6
- package/styleFunctionSx/styleFunctionSx.d.ts +13 -2
- package/styleFunctionSx/styleFunctionSx.spec.d.ts +1 -1
|
@@ -26,9 +26,9 @@ export default function createCssVarsProvider(options) {
|
|
|
26
26
|
desisgnSystemMode = _options$defaultMode === void 0 ? 'light' : _options$defaultMode,
|
|
27
27
|
designSystemColorScheme = options.defaultColorScheme,
|
|
28
28
|
_options$disableTrans = options.disableTransitionOnChange,
|
|
29
|
-
|
|
29
|
+
designSystemTransitionOnChange = _options$disableTrans === void 0 ? false : _options$disableTrans,
|
|
30
30
|
_options$enableColorS = options.enableColorScheme,
|
|
31
|
-
|
|
31
|
+
designSystemEnableColorScheme = _options$enableColorS === void 0 ? true : _options$enableColorS,
|
|
32
32
|
_options$prefix = options.prefix,
|
|
33
33
|
designSystemPrefix = _options$prefix === void 0 ? '' : _options$prefix,
|
|
34
34
|
shouldSkipGeneratingVar = options.shouldSkipGeneratingVar,
|
|
@@ -65,16 +65,15 @@ export default function createCssVarsProvider(options) {
|
|
|
65
65
|
_ref$defaultMode = _ref.defaultMode,
|
|
66
66
|
defaultMode = _ref$defaultMode === void 0 ? desisgnSystemMode : _ref$defaultMode,
|
|
67
67
|
_ref$defaultColorSche = _ref.defaultColorScheme,
|
|
68
|
-
defaultColorScheme = _ref$defaultColorSche === void 0 ? designSystemColorScheme : _ref$defaultColorSche
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}, []);
|
|
68
|
+
defaultColorScheme = _ref$defaultColorSche === void 0 ? designSystemColorScheme : _ref$defaultColorSche,
|
|
69
|
+
_ref$disableTransitio = _ref.disableTransitionOnChange,
|
|
70
|
+
disableTransitionOnChange = _ref$disableTransitio === void 0 ? designSystemTransitionOnChange : _ref$disableTransitio,
|
|
71
|
+
_ref$enableColorSchem = _ref.enableColorScheme,
|
|
72
|
+
enableColorScheme = _ref$enableColorSchem === void 0 ? designSystemEnableColorScheme : _ref$enableColorSchem;
|
|
74
73
|
|
|
75
|
-
var
|
|
76
|
-
baseColorSchemes =
|
|
77
|
-
restBaseTheme = _objectWithoutProperties(
|
|
74
|
+
var _baseTheme$colorSchem = baseTheme.colorSchemes,
|
|
75
|
+
baseColorSchemes = _baseTheme$colorSchem === void 0 ? {} : _baseTheme$colorSchem,
|
|
76
|
+
restBaseTheme = _objectWithoutProperties(baseTheme, ["colorSchemes"]);
|
|
78
77
|
|
|
79
78
|
var _themeProp$colorSchem = themeProp.colorSchemes,
|
|
80
79
|
colorSchemesProp = _themeProp$colorSchem === void 0 ? {} : _themeProp$colorSchem,
|
|
@@ -127,9 +126,10 @@ export default function createCssVarsProvider(options) {
|
|
|
127
126
|
shouldSkipGeneratingVar: shouldSkipGeneratingVar
|
|
128
127
|
}),
|
|
129
128
|
rootCss = _cssVarsParser.css,
|
|
130
|
-
rootVars = _cssVarsParser.vars
|
|
129
|
+
rootVars = _cssVarsParser.vars,
|
|
130
|
+
parsedTheme = _cssVarsParser.parsedTheme;
|
|
131
131
|
|
|
132
|
-
mergedTheme = _extends({},
|
|
132
|
+
mergedTheme = _extends({}, parsedTheme, {
|
|
133
133
|
components: components,
|
|
134
134
|
colorSchemes: colorSchemes,
|
|
135
135
|
prefix: prefix,
|
|
@@ -150,10 +150,15 @@ export default function createCssVarsProvider(options) {
|
|
|
150
150
|
shouldSkipGeneratingVar: shouldSkipGeneratingVar
|
|
151
151
|
}),
|
|
152
152
|
css = _cssVarsParser2.css,
|
|
153
|
-
vars = _cssVarsParser2.vars
|
|
153
|
+
vars = _cssVarsParser2.vars,
|
|
154
|
+
parsedScheme = _cssVarsParser2.parsedTheme;
|
|
154
155
|
|
|
155
156
|
mergedTheme.vars = deepmerge(mergedTheme.vars, vars);
|
|
156
157
|
|
|
158
|
+
if (key === resolvedColorScheme) {
|
|
159
|
+
mergedTheme = _extends({}, mergedTheme, parsedScheme);
|
|
160
|
+
}
|
|
161
|
+
|
|
157
162
|
var resolvedDefaultColorScheme = function () {
|
|
158
163
|
if (typeof defaultColorScheme === 'string') {
|
|
159
164
|
return defaultColorScheme;
|
|
@@ -194,7 +199,7 @@ export default function createCssVarsProvider(options) {
|
|
|
194
199
|
return function () {
|
|
195
200
|
document.documentElement.style.setProperty('color-scheme', priorColorScheme);
|
|
196
201
|
};
|
|
197
|
-
}, [mode, systemMode]);
|
|
202
|
+
}, [mode, systemMode, enableColorScheme]);
|
|
198
203
|
React.useEffect(function () {
|
|
199
204
|
var timer;
|
|
200
205
|
|
|
@@ -216,7 +221,7 @@ export default function createCssVarsProvider(options) {
|
|
|
216
221
|
return function () {
|
|
217
222
|
clearTimeout(timer);
|
|
218
223
|
};
|
|
219
|
-
}, [colorScheme]);
|
|
224
|
+
}, [colorScheme, disableTransitionOnChange]);
|
|
220
225
|
React.useEffect(function () {
|
|
221
226
|
hasMounted.current = true;
|
|
222
227
|
return function () {
|
|
@@ -267,6 +272,16 @@ export default function createCssVarsProvider(options) {
|
|
|
267
272
|
*/
|
|
268
273
|
defaultMode: PropTypes.string,
|
|
269
274
|
|
|
275
|
+
/**
|
|
276
|
+
* Disable CSS transitions when switching between modes or color schemes
|
|
277
|
+
*/
|
|
278
|
+
disableTransitionOnChange: PropTypes.bool,
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Indicate to the browser which color scheme is used (light or dark) for rendering built-in UI
|
|
282
|
+
*/
|
|
283
|
+
enableColorScheme: PropTypes.bool,
|
|
284
|
+
|
|
270
285
|
/**
|
|
271
286
|
* The key in the local storage used to store current color scheme.
|
|
272
287
|
*/
|
|
@@ -98,19 +98,20 @@ var getCssValue = function getCssValue(keys, value) {
|
|
|
98
98
|
* `basePrefix`: defined by design system.
|
|
99
99
|
* `prefix`: defined by application
|
|
100
100
|
*
|
|
101
|
-
*
|
|
101
|
+
* the CSS variable value will be adjusted based on the provided `basePrefix` & `prefix` which can be found in `parsedTheme`.
|
|
102
102
|
*
|
|
103
|
-
* @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme)
|
|
103
|
+
* @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.
|
|
104
104
|
*
|
|
105
105
|
* @example
|
|
106
|
-
* const { css, vars } = parser({
|
|
106
|
+
* const { css, vars, parsedTheme } = parser({
|
|
107
107
|
* fontSize: 12,
|
|
108
108
|
* lineHeight: 1.2,
|
|
109
|
-
* palette: { primary: { 500: '
|
|
110
|
-
* })
|
|
109
|
+
* palette: { primary: { 500: 'var(--color)' } }
|
|
110
|
+
* }, { prefix: 'foo' })
|
|
111
111
|
*
|
|
112
|
-
* console.log(css) // { '--fontSize': '12px', '--lineHeight': 1.2, '--palette-primary-500': '
|
|
113
|
-
* console.log(vars) // { fontSize: '--fontSize', lineHeight: '--lineHeight', palette: { primary: { 500: 'var(--palette-primary-500)' } } }
|
|
112
|
+
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--foo-color)' }
|
|
113
|
+
* console.log(vars) // { fontSize: '--foo-fontSize', lineHeight: '--foo-lineHeight', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
|
|
114
|
+
* console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--foo-color)' } } }
|
|
114
115
|
*/
|
|
115
116
|
|
|
116
117
|
|
|
@@ -123,38 +124,37 @@ export default function cssVarsParser(theme, options) {
|
|
|
123
124
|
|
|
124
125
|
var css = {};
|
|
125
126
|
var vars = {};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
// replace the value of the `scope` object with the prefix or remove basePrefix from the value
|
|
127
|
+
var parsedTheme = {};
|
|
128
|
+
walkObjectDeep(theme, function (keys, value) {
|
|
129
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
130
|
+
if (typeof value === 'string' && value.match(/var\(\s*--/)) {
|
|
131
|
+
// for CSS variable, apply prefix or remove basePrefix from the variable
|
|
132
132
|
if (!basePrefix && prefix) {
|
|
133
|
-
|
|
133
|
+
value = value.replace(/var\(\s*--/g, "var(--".concat(prefix, "-"));
|
|
134
134
|
} else {
|
|
135
|
-
|
|
136
|
-
:
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
scope[keys.slice(-1)[0]] = _value;
|
|
135
|
+
value = prefix ? value.replace(new RegExp("var\\(\\s*--".concat(basePrefix), 'g'), "var(--".concat(prefix)) // removing spaces
|
|
136
|
+
: value.replace(new RegExp("var\\(\\s*--".concat(basePrefix, "-"), 'g'), 'var(--');
|
|
137
|
+
}
|
|
141
138
|
}
|
|
142
139
|
|
|
143
|
-
if (!shouldSkipGeneratingVar || shouldSkipGeneratingVar && !shouldSkipGeneratingVar(keys,
|
|
140
|
+
if (!shouldSkipGeneratingVar || shouldSkipGeneratingVar && !shouldSkipGeneratingVar(keys, value)) {
|
|
144
141
|
// only create css & var if `shouldSkipGeneratingVar` return false
|
|
145
142
|
var cssVar = "--".concat(prefix ? "".concat(prefix, "-") : '').concat(keys.join('-'));
|
|
146
143
|
|
|
147
|
-
_extends(css, _defineProperty({}, cssVar, getCssValue(keys,
|
|
144
|
+
_extends(css, _defineProperty({}, cssVar, getCssValue(keys, value)));
|
|
148
145
|
|
|
149
146
|
assignNestedKeys(vars, keys, "var(".concat(cssVar, ")"));
|
|
150
147
|
}
|
|
151
148
|
}
|
|
149
|
+
|
|
150
|
+
assignNestedKeys(parsedTheme, keys, value);
|
|
152
151
|
}, function (keys) {
|
|
153
152
|
return keys[0] === 'vars';
|
|
154
153
|
} // skip 'vars/*' paths
|
|
155
154
|
);
|
|
156
155
|
return {
|
|
157
156
|
css: css,
|
|
158
|
-
vars: vars
|
|
157
|
+
vars: vars,
|
|
158
|
+
parsedTheme: parsedTheme
|
|
159
159
|
};
|
|
160
160
|
}
|
package/legacy/index.js
CHANGED
package/modern/createStyled.js
CHANGED
|
@@ -172,7 +172,11 @@ export default function createStyled(input = {}) {
|
|
|
172
172
|
|
|
173
173
|
transformedStyleArg = [...styleArg, ...placeholders];
|
|
174
174
|
transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
|
|
175
|
-
} else if (typeof styleArg === 'function'
|
|
175
|
+
} else if (typeof styleArg === 'function' && // On the server emotion doesn't use React.forwardRef for creating components, so the created
|
|
176
|
+
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
177
|
+
// which are basically components used as a selectors.
|
|
178
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
179
|
+
styleArg.__emotion_real !== styleArg) {
|
|
176
180
|
// If the type is function, we need to define the default theme.
|
|
177
181
|
transformedStyleArg = _ref2 => {
|
|
178
182
|
let {
|
|
@@ -23,8 +23,8 @@ export default function createCssVarsProvider(options) {
|
|
|
23
23
|
theme: baseTheme = {},
|
|
24
24
|
defaultMode: desisgnSystemMode = 'light',
|
|
25
25
|
defaultColorScheme: designSystemColorScheme,
|
|
26
|
-
disableTransitionOnChange = false,
|
|
27
|
-
enableColorScheme = true,
|
|
26
|
+
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
|
27
|
+
enableColorScheme: designSystemEnableColorScheme = true,
|
|
28
28
|
prefix: designSystemPrefix = '',
|
|
29
29
|
shouldSkipGeneratingVar,
|
|
30
30
|
resolveTheme
|
|
@@ -55,16 +55,14 @@ export default function createCssVarsProvider(options) {
|
|
|
55
55
|
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
|
56
56
|
attribute = DEFAULT_ATTRIBUTE,
|
|
57
57
|
defaultMode = desisgnSystemMode,
|
|
58
|
-
defaultColorScheme = designSystemColorScheme
|
|
58
|
+
defaultColorScheme = designSystemColorScheme,
|
|
59
|
+
disableTransitionOnChange = designSystemTransitionOnChange,
|
|
60
|
+
enableColorScheme = designSystemEnableColorScheme
|
|
59
61
|
}) {
|
|
60
|
-
// make sure that baseTheme is always independent of each <CssVarsProvider /> call.
|
|
61
|
-
// JSON.parse(JSON.stringify(...)) is okay to be used as long as the baseTheme is a plain object.
|
|
62
|
-
const clonedBaseTheme = React.useMemo(() => JSON.parse(JSON.stringify(baseTheme)), []);
|
|
63
|
-
|
|
64
62
|
const {
|
|
65
63
|
colorSchemes: baseColorSchemes = {}
|
|
66
|
-
} =
|
|
67
|
-
restBaseTheme = _objectWithoutPropertiesLoose(
|
|
64
|
+
} = baseTheme,
|
|
65
|
+
restBaseTheme = _objectWithoutPropertiesLoose(baseTheme, _excluded);
|
|
68
66
|
|
|
69
67
|
const {
|
|
70
68
|
colorSchemes: colorSchemesProp = {}
|
|
@@ -115,13 +113,14 @@ export default function createCssVarsProvider(options) {
|
|
|
115
113
|
|
|
116
114
|
const {
|
|
117
115
|
css: rootCss,
|
|
118
|
-
vars: rootVars
|
|
116
|
+
vars: rootVars,
|
|
117
|
+
parsedTheme
|
|
119
118
|
} = cssVarsParser(mergedTheme, {
|
|
120
119
|
prefix,
|
|
121
120
|
basePrefix: designSystemPrefix,
|
|
122
121
|
shouldSkipGeneratingVar
|
|
123
122
|
});
|
|
124
|
-
mergedTheme = _extends({},
|
|
123
|
+
mergedTheme = _extends({}, parsedTheme, {
|
|
125
124
|
components,
|
|
126
125
|
colorSchemes,
|
|
127
126
|
prefix,
|
|
@@ -134,7 +133,8 @@ export default function createCssVarsProvider(options) {
|
|
|
134
133
|
Object.entries(colorSchemes).forEach(([key, scheme]) => {
|
|
135
134
|
const {
|
|
136
135
|
css,
|
|
137
|
-
vars
|
|
136
|
+
vars,
|
|
137
|
+
parsedTheme: parsedScheme
|
|
138
138
|
} = cssVarsParser(scheme, {
|
|
139
139
|
prefix,
|
|
140
140
|
basePrefix: designSystemPrefix,
|
|
@@ -142,6 +142,10 @@ export default function createCssVarsProvider(options) {
|
|
|
142
142
|
});
|
|
143
143
|
mergedTheme.vars = deepmerge(mergedTheme.vars, vars);
|
|
144
144
|
|
|
145
|
+
if (key === resolvedColorScheme) {
|
|
146
|
+
mergedTheme = _extends({}, mergedTheme, parsedScheme);
|
|
147
|
+
}
|
|
148
|
+
|
|
145
149
|
const resolvedDefaultColorScheme = (() => {
|
|
146
150
|
if (typeof defaultColorScheme === 'string') {
|
|
147
151
|
return defaultColorScheme;
|
|
@@ -182,7 +186,7 @@ export default function createCssVarsProvider(options) {
|
|
|
182
186
|
return () => {
|
|
183
187
|
document.documentElement.style.setProperty('color-scheme', priorColorScheme);
|
|
184
188
|
};
|
|
185
|
-
}, [mode, systemMode]);
|
|
189
|
+
}, [mode, systemMode, enableColorScheme]);
|
|
186
190
|
React.useEffect(() => {
|
|
187
191
|
let timer;
|
|
188
192
|
|
|
@@ -202,7 +206,7 @@ export default function createCssVarsProvider(options) {
|
|
|
202
206
|
return () => {
|
|
203
207
|
clearTimeout(timer);
|
|
204
208
|
};
|
|
205
|
-
}, [colorScheme]);
|
|
209
|
+
}, [colorScheme, disableTransitionOnChange]);
|
|
206
210
|
React.useEffect(() => {
|
|
207
211
|
hasMounted.current = true;
|
|
208
212
|
return () => {
|
|
@@ -253,6 +257,16 @@ export default function createCssVarsProvider(options) {
|
|
|
253
257
|
*/
|
|
254
258
|
defaultMode: PropTypes.string,
|
|
255
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Disable CSS transitions when switching between modes or color schemes
|
|
262
|
+
*/
|
|
263
|
+
disableTransitionOnChange: PropTypes.bool,
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Indicate to the browser which color scheme is used (light or dark) for rendering built-in UI
|
|
267
|
+
*/
|
|
268
|
+
enableColorScheme: PropTypes.bool,
|
|
269
|
+
|
|
256
270
|
/**
|
|
257
271
|
* The key in the local storage used to store current color scheme.
|
|
258
272
|
*/
|
|
@@ -85,19 +85,20 @@ const getCssValue = (keys, value) => {
|
|
|
85
85
|
* `basePrefix`: defined by design system.
|
|
86
86
|
* `prefix`: defined by application
|
|
87
87
|
*
|
|
88
|
-
*
|
|
88
|
+
* the CSS variable value will be adjusted based on the provided `basePrefix` & `prefix` which can be found in `parsedTheme`.
|
|
89
89
|
*
|
|
90
|
-
* @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme)
|
|
90
|
+
* @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.
|
|
91
91
|
*
|
|
92
92
|
* @example
|
|
93
|
-
* const { css, vars } = parser({
|
|
93
|
+
* const { css, vars, parsedTheme } = parser({
|
|
94
94
|
* fontSize: 12,
|
|
95
95
|
* lineHeight: 1.2,
|
|
96
|
-
* palette: { primary: { 500: '
|
|
97
|
-
* })
|
|
96
|
+
* palette: { primary: { 500: 'var(--color)' } }
|
|
97
|
+
* }, { prefix: 'foo' })
|
|
98
98
|
*
|
|
99
|
-
* console.log(css) // { '--fontSize': '12px', '--lineHeight': 1.2, '--palette-primary-500': '
|
|
100
|
-
* console.log(vars) // { fontSize: '--fontSize', lineHeight: '--lineHeight', palette: { primary: { 500: 'var(--palette-primary-500)' } } }
|
|
99
|
+
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--foo-color)' }
|
|
100
|
+
* console.log(vars) // { fontSize: '--foo-fontSize', lineHeight: '--foo-lineHeight', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
|
|
101
|
+
* console.log(parsedTheme) // { fontSize: 12, lineHeight: 1.2, palette: { primary: { 500: 'var(--foo-color)' } } }
|
|
101
102
|
*/
|
|
102
103
|
|
|
103
104
|
|
|
@@ -109,21 +110,17 @@ export default function cssVarsParser(theme, options) {
|
|
|
109
110
|
} = options || {};
|
|
110
111
|
const css = {};
|
|
111
112
|
const vars = {};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const parsedTheme = {};
|
|
114
|
+
walkObjectDeep(theme, (keys, value) => {
|
|
115
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
116
116
|
if (typeof value === 'string' && value.match(/var\(\s*--/)) {
|
|
117
|
-
//
|
|
117
|
+
// for CSS variable, apply prefix or remove basePrefix from the variable
|
|
118
118
|
if (!basePrefix && prefix) {
|
|
119
119
|
value = value.replace(/var\(\s*--/g, `var(--${prefix}-`);
|
|
120
120
|
} else {
|
|
121
121
|
value = prefix ? value.replace(new RegExp(`var\\(\\s*--${basePrefix}`, 'g'), `var(--${prefix}`) // removing spaces
|
|
122
122
|
: value.replace(new RegExp(`var\\(\\s*--${basePrefix}-`, 'g'), 'var(--');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
scope[keys.slice(-1)[0]] = value;
|
|
123
|
+
}
|
|
127
124
|
}
|
|
128
125
|
|
|
129
126
|
if (!shouldSkipGeneratingVar || shouldSkipGeneratingVar && !shouldSkipGeneratingVar(keys, value)) {
|
|
@@ -135,10 +132,13 @@ export default function cssVarsParser(theme, options) {
|
|
|
135
132
|
assignNestedKeys(vars, keys, `var(${cssVar})`);
|
|
136
133
|
}
|
|
137
134
|
}
|
|
135
|
+
|
|
136
|
+
assignNestedKeys(parsedTheme, keys, value);
|
|
138
137
|
}, keys => keys[0] === 'vars' // skip 'vars/*' paths
|
|
139
138
|
);
|
|
140
139
|
return {
|
|
141
140
|
css,
|
|
142
|
-
vars
|
|
141
|
+
vars,
|
|
142
|
+
parsedTheme
|
|
143
143
|
};
|
|
144
144
|
}
|
package/modern/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/system",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "CSS utilities for rapidly laying out custom designs.",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@babel/runtime": "^7.17.
|
|
47
|
-
"@mui/private-theming": "^5.4.
|
|
48
|
-
"@mui/styled-engine": "^5.4.
|
|
46
|
+
"@babel/runtime": "^7.17.2",
|
|
47
|
+
"@mui/private-theming": "^5.4.4",
|
|
48
|
+
"@mui/styled-engine": "^5.4.4",
|
|
49
49
|
"@mui/types": "^7.1.2",
|
|
50
|
-
"@mui/utils": "^5.4.
|
|
50
|
+
"@mui/utils": "^5.4.4",
|
|
51
51
|
"clsx": "^1.1.1",
|
|
52
|
-
"csstype": "^3.0.
|
|
52
|
+
"csstype": "^3.0.11",
|
|
53
53
|
"prop-types": "^15.7.2"
|
|
54
54
|
},
|
|
55
55
|
"sideEffects": false,
|
|
@@ -24,6 +24,18 @@ export interface CSSSelectorObject<Theme extends object = {}> {
|
|
|
24
24
|
[cssSelector: string]: ((theme: Theme) => SystemStyleObject<Theme>) | SystemStyleObject<Theme>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
type CssVariableType = string | number;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Map all nested selectors and CSS variables.
|
|
31
|
+
*/
|
|
32
|
+
export interface CSSSelectorObjectOrCssVariables<Theme extends object = {}> {
|
|
33
|
+
[cssSelectorOrVariable: string]:
|
|
34
|
+
| ((theme: Theme) => SystemStyleObject<Theme> | string | number)
|
|
35
|
+
| SystemStyleObject<Theme>
|
|
36
|
+
| CssVariableType;
|
|
37
|
+
}
|
|
38
|
+
|
|
27
39
|
/**
|
|
28
40
|
* Map of all available CSS properties (including aliases) and their raw value.
|
|
29
41
|
* Only used internally to map CSS properties to input types (responsive value,
|
|
@@ -48,8 +60,7 @@ export type SystemCssProperties<Theme extends object = {}> = {
|
|
|
48
60
|
export type SystemStyleObject<Theme extends object = {}> =
|
|
49
61
|
| SystemCssProperties<Theme>
|
|
50
62
|
| CSSPseudoSelectorProps<Theme>
|
|
51
|
-
|
|
|
52
|
-
| { [cssVariable: string]: string | number }
|
|
63
|
+
| CSSSelectorObjectOrCssVariables<Theme>
|
|
53
64
|
| null;
|
|
54
65
|
|
|
55
66
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|