@mui/material 6.0.0-alpha.10 → 6.0.0-alpha.11
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/Accordion/Accordion.d.ts +3 -3
- package/AccordionActions/AccordionActions.d.ts +2 -2
- package/AccordionDetails/AccordionDetails.d.ts +2 -2
- package/AccordionSummary/AccordionSummary.d.ts +3 -3
- package/Alert/Alert.d.ts +3 -3
- package/AlertTitle/AlertTitle.d.ts +3 -3
- package/AppBar/AppBar.d.ts +3 -3
- package/Autocomplete/Autocomplete.d.ts +2 -2
- package/Autocomplete/Autocomplete.js +9 -17
- package/Avatar/Avatar.d.ts +2 -2
- package/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/Backdrop/Backdrop.d.ts +3 -3
- package/Badge/Badge.d.ts +3 -3
- package/BottomNavigation/BottomNavigation.d.ts +2 -2
- package/BottomNavigationAction/BottomNavigationAction.d.ts +3 -3
- package/Box/Box.d.ts +2 -2
- package/Breadcrumbs/Breadcrumbs.d.ts +3 -3
- package/Button/Button.d.ts +4 -4
- package/ButtonBase/ButtonBase.d.ts +2 -2
- package/ButtonGroup/ButtonGroup.d.ts +2 -2
- package/CHANGELOG.md +76 -0
- package/Card/Card.d.ts +3 -3
- package/CardActionArea/CardActionArea.d.ts +3 -3
- package/CardActions/CardActions.d.ts +2 -2
- package/CardContent/CardContent.d.ts +2 -2
- package/CardHeader/CardHeader.d.ts +2 -2
- package/CardMedia/CardMedia.d.ts +2 -2
- package/Checkbox/Checkbox.d.ts +4 -4
- package/Chip/Chip.d.ts +5 -5
- package/Chip/Chip.js +0 -2
- package/CircularProgress/CircularProgress.d.ts +2 -2
- package/Collapse/Collapse.d.ts +5 -5
- package/Collapse/Collapse.js +1 -2
- package/Container/Container.d.ts +2 -2
- package/CssBaseline/CssBaseline.d.ts +2 -2
- package/Dialog/Dialog.d.ts +3 -3
- package/Dialog/Dialog.js +1 -2
- package/DialogActions/DialogActions.d.ts +2 -2
- package/DialogContent/DialogContent.d.ts +2 -2
- package/DialogContentText/DialogContentText.d.ts +3 -3
- package/DialogTitle/DialogTitle.d.ts +3 -3
- package/Divider/Divider.d.ts +3 -3
- package/Drawer/Drawer.d.ts +3 -3
- package/Drawer/Drawer.js +1 -2
- package/Fab/Fab.d.ts +3 -3
- package/Fade/Fade.d.ts +3 -3
- package/Fade/Fade.js +1 -1
- package/FilledInput/FilledInput.d.ts +3 -3
- package/FormControl/FormControl.d.ts +6 -6
- package/FormControlLabel/FormControlLabel.d.ts +4 -4
- package/FormGroup/FormGroup.d.ts +3 -3
- package/FormHelperText/FormHelperText.d.ts +2 -2
- package/FormLabel/FormLabel.d.ts +4 -4
- package/GlobalStyles/GlobalStyles.d.ts +3 -3
- package/Grid/Grid.d.ts +2 -2
- package/Grid/Grid.js +7 -13
- package/Grow/Grow.d.ts +5 -5
- package/Grow/Grow.js +1 -1
- package/Hidden/Hidden.d.ts +2 -2
- package/Icon/Icon.d.ts +3 -3
- package/IconButton/IconButton.d.ts +4 -4
- package/ImageList/ImageList.d.ts +2 -2
- package/ImageListItem/ImageListItem.d.ts +2 -2
- package/ImageListItemBar/ImageListItemBar.d.ts +2 -2
- package/Input/Input.d.ts +3 -3
- package/InputAdornment/InputAdornment.d.ts +2 -2
- package/InputBase/InputBase.d.ts +2 -2
- package/InputBase/InputBase.js +26 -20
- package/InputLabel/InputLabel.d.ts +3 -3
- package/LinearProgress/LinearProgress.d.ts +2 -2
- package/Link/Link.d.ts +4 -4
- package/Link/Link.js +1 -2
- package/List/List.d.ts +3 -3
- package/ListItem/ListItem.d.ts +3 -3
- package/ListItemAvatar/ListItemAvatar.d.ts +2 -2
- package/ListItemButton/ListItemButton.d.ts +3 -3
- package/ListItemIcon/ListItemIcon.d.ts +2 -2
- package/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +2 -2
- package/ListItemText/ListItemText.d.ts +2 -2
- package/ListSubheader/ListSubheader.d.ts +2 -2
- package/Menu/Menu.d.ts +4 -4
- package/MenuItem/MenuItem.d.ts +3 -3
- package/MenuList/MenuList.d.ts +4 -4
- package/MobileStepper/MobileStepper.d.ts +3 -3
- package/Modal/Modal.d.ts +8 -8
- package/NativeSelect/NativeSelect.d.ts +3 -3
- package/OutlinedInput/OutlinedInput.d.ts +3 -3
- package/Pagination/Pagination.d.ts +2 -2
- package/PaginationItem/PaginationItem.d.ts +2 -2
- package/Paper/Paper.d.ts +3 -3
- package/Paper/Paper.js +1 -2
- package/Popover/Popover.d.ts +4 -4
- package/Popper/Popper.d.ts +4 -4
- package/Popper/Popper.js +4 -4
- package/Radio/Radio.d.ts +3 -3
- package/RadioGroup/RadioGroup.d.ts +3 -3
- package/Rating/Rating.d.ts +2 -2
- package/ScopedCssBaseline/ScopedCssBaseline.d.ts +2 -2
- package/Select/Select.d.ts +3 -3
- package/Skeleton/Skeleton.d.ts +2 -2
- package/Slide/Slide.d.ts +4 -4
- package/Slide/Slide.js +1 -1
- package/Slider/Slider.d.ts +3 -3
- package/Snackbar/Snackbar.d.ts +2 -2
- package/Snackbar/Snackbar.js +1 -2
- package/SnackbarContent/SnackbarContent.d.ts +3 -3
- package/SpeedDial/SpeedDial.d.ts +2 -2
- package/SpeedDial/SpeedDial.js +1 -2
- package/SpeedDialAction/SpeedDialAction.d.ts +3 -3
- package/SpeedDialIcon/SpeedDialIcon.d.ts +2 -2
- package/Stack/Stack.d.ts +2 -2
- package/Step/Step.d.ts +2 -2
- package/StepButton/StepButton.d.ts +3 -3
- package/StepConnector/StepConnector.d.ts +3 -3
- package/StepContent/StepContent.d.ts +2 -2
- package/StepIcon/StepIcon.d.ts +2 -2
- package/StepLabel/StepLabel.d.ts +2 -2
- package/Stepper/Stepper.d.ts +2 -2
- package/SvgIcon/SvgIcon.d.ts +3 -3
- package/SwipeableDrawer/SwipeableDrawer.d.ts +3 -3
- package/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/Switch/Switch.d.ts +4 -4
- package/Tab/Tab.d.ts +4 -4
- package/Tab/Tab.js +3 -1
- package/Tab/tabClasses.d.ts +1 -1
- package/TabScrollButton/TabScrollButton.d.ts +2 -2
- package/Table/Table.d.ts +2 -2
- package/TableBody/TableBody.d.ts +2 -2
- package/TableCell/TableCell.d.ts +2 -2
- package/TableContainer/TableContainer.d.ts +2 -2
- package/TableFooter/TableFooter.d.ts +2 -2
- package/TableHead/TableHead.d.ts +2 -2
- package/TablePagination/TablePagination.d.ts +4 -4
- package/TableRow/TableRow.d.ts +2 -2
- package/TableSortLabel/TableSortLabel.d.ts +3 -3
- package/Tabs/Tabs.d.ts +2 -2
- package/Tabs/Tabs.js +1 -2
- package/TextField/TextField.d.ts +10 -10
- package/ToggleButton/ToggleButton.d.ts +3 -3
- package/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -2
- package/Toolbar/Toolbar.d.ts +2 -2
- package/Tooltip/Tooltip.d.ts +2 -2
- package/Tooltip/Tooltip.js +1 -2
- package/Typography/Typography.d.ts +3 -3
- package/Typography/Typography.js +2 -2
- package/Zoom/Zoom.d.ts +3 -3
- package/Zoom/Zoom.js +1 -1
- package/index.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +9 -17
- package/modern/Chip/Chip.js +0 -2
- package/modern/Collapse/Collapse.js +1 -2
- package/modern/Dialog/Dialog.js +1 -2
- package/modern/Drawer/Drawer.js +1 -2
- package/modern/Fade/Fade.js +1 -1
- package/modern/Grid/Grid.js +7 -13
- package/modern/Grow/Grow.js +1 -1
- package/modern/InputBase/InputBase.js +26 -20
- package/modern/Link/Link.js +1 -2
- package/modern/Paper/Paper.js +1 -2
- package/modern/Popper/Popper.js +4 -4
- package/modern/Slide/Slide.js +1 -1
- package/modern/Snackbar/Snackbar.js +1 -2
- package/modern/SpeedDial/SpeedDial.js +1 -2
- package/modern/SwipeableDrawer/SwipeableDrawer.js +3 -3
- package/modern/Tab/Tab.js +3 -1
- package/modern/Tabs/Tabs.js +1 -2
- package/modern/Tooltip/Tooltip.js +1 -2
- package/modern/Typography/Typography.js +2 -2
- package/modern/Zoom/Zoom.js +1 -1
- package/modern/index.js +1 -1
- package/modern/styles/createTheme.js +1 -1
- package/modern/styles/index.js +2 -1
- package/modern/styles/stringifyTheme.js +55 -0
- package/modern/zero-styled/index.js +20 -1
- package/node/Autocomplete/Autocomplete.js +9 -17
- package/node/Chip/Chip.js +0 -2
- package/node/Collapse/Collapse.js +1 -2
- package/node/Dialog/Dialog.js +1 -2
- package/node/Drawer/Drawer.js +1 -2
- package/node/Fade/Fade.js +2 -2
- package/node/Grid/Grid.js +7 -13
- package/node/Grow/Grow.js +2 -2
- package/node/InputBase/InputBase.js +25 -19
- package/node/Link/Link.js +1 -2
- package/node/Paper/Paper.js +1 -2
- package/node/Popper/Popper.js +4 -4
- package/node/Slide/Slide.js +2 -2
- package/node/Snackbar/Snackbar.js +1 -2
- package/node/SpeedDial/SpeedDial.js +1 -2
- package/node/SwipeableDrawer/SwipeableDrawer.js +5 -4
- package/node/Tab/Tab.js +3 -1
- package/node/Tabs/Tabs.js +1 -2
- package/node/Tooltip/Tooltip.js +1 -2
- package/node/Typography/Typography.js +2 -2
- package/node/Zoom/Zoom.js +2 -2
- package/node/index.js +1 -1
- package/node/styles/createTheme.js +1 -1
- package/node/styles/index.js +20 -1
- package/node/styles/stringifyTheme.js +62 -0
- package/node/zero-styled/index.js +29 -0
- package/package.json +6 -6
- package/styles/createTheme.js +1 -1
- package/styles/index.d.ts +3 -0
- package/styles/index.js +2 -1
- package/styles/stringifyTheme.d.ts +20 -0
- package/styles/stringifyTheme.js +55 -0
- package/zero-styled/index.d.ts +7 -0
- package/zero-styled/index.js +20 -1
package/node/styles/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var _exportNames = {
|
|
|
30
30
|
unstable_getUnit: true,
|
|
31
31
|
unstable_toUnitless: true,
|
|
32
32
|
responsiveFontSizes: true,
|
|
33
|
+
createTransitions: true,
|
|
33
34
|
duration: true,
|
|
34
35
|
easing: true,
|
|
35
36
|
useTheme: true,
|
|
@@ -96,6 +97,12 @@ Object.defineProperty(exports, "createTheme", {
|
|
|
96
97
|
return _createTheme.default;
|
|
97
98
|
}
|
|
98
99
|
});
|
|
100
|
+
Object.defineProperty(exports, "createTransitions", {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () {
|
|
103
|
+
return _createTransitions.default;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
99
106
|
Object.defineProperty(exports, "css", {
|
|
100
107
|
enumerable: true,
|
|
101
108
|
get: function () {
|
|
@@ -298,7 +305,7 @@ var _createMuiStrictModeTheme = _interopRequireDefault(require("./createMuiStric
|
|
|
298
305
|
var _createStyles = _interopRequireDefault(require("./createStyles"));
|
|
299
306
|
var _cssUtils = require("./cssUtils");
|
|
300
307
|
var _responsiveFontSizes = _interopRequireDefault(require("./responsiveFontSizes"));
|
|
301
|
-
var _createTransitions = require("./createTransitions");
|
|
308
|
+
var _createTransitions = _interopRequireWildcard(require("./createTransitions"));
|
|
302
309
|
var _useTheme = _interopRequireDefault(require("./useTheme"));
|
|
303
310
|
var _useThemeProps = _interopRequireDefault(require("./useThemeProps"));
|
|
304
311
|
var _styled = _interopRequireDefault(require("./styled"));
|
|
@@ -322,6 +329,18 @@ var _extendTheme = _interopRequireDefault(require("./extendTheme"));
|
|
|
322
329
|
var _experimental_extendTheme = _interopRequireDefault(require("./experimental_extendTheme"));
|
|
323
330
|
var _getOverlayAlpha = _interopRequireDefault(require("./getOverlayAlpha"));
|
|
324
331
|
var _shouldSkipGeneratingVar = _interopRequireDefault(require("./shouldSkipGeneratingVar"));
|
|
332
|
+
var _stringifyTheme = require("./stringifyTheme");
|
|
333
|
+
Object.keys(_stringifyTheme).forEach(function (key) {
|
|
334
|
+
if (key === "default" || key === "__esModule") return;
|
|
335
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
336
|
+
if (key in exports && exports[key] === _stringifyTheme[key]) return;
|
|
337
|
+
Object.defineProperty(exports, key, {
|
|
338
|
+
enumerable: true,
|
|
339
|
+
get: function () {
|
|
340
|
+
return _stringifyTheme[key];
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
});
|
|
325
344
|
var _createTypography = _interopRequireDefault(require("./createTypography"));
|
|
326
345
|
var _createMixins = _interopRequireDefault(require("./createMixins"));
|
|
327
346
|
var _excludeVariablesFromRoot = _interopRequireDefault(require("./excludeVariablesFromRoot"));
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.stringifyTheme = stringifyTheme;
|
|
7
|
+
var _deepmerge = require("@mui/utils/deepmerge");
|
|
8
|
+
/* eslint-disable import/prefer-default-export */
|
|
9
|
+
|
|
10
|
+
function isSerializable(val) {
|
|
11
|
+
return (0, _deepmerge.isPlainObject)(val) || typeof val === 'undefined' || typeof val === 'string' || typeof val === 'boolean' || typeof val === 'number' || Array.isArray(val);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `baseTheme` usually comes from `createTheme` or `extendTheme`.
|
|
16
|
+
*
|
|
17
|
+
* This function is intended to be used with zero-runtime CSS-in-JS like Pigment CSS
|
|
18
|
+
* For example, in a Next.js project:
|
|
19
|
+
*
|
|
20
|
+
* ```js
|
|
21
|
+
* // next.config.js
|
|
22
|
+
* const { extendTheme } = require('@mui/material/styles');
|
|
23
|
+
*
|
|
24
|
+
* const theme = extendTheme();
|
|
25
|
+
* // `.toRuntimeSource` is Pigment CSS specific to create a theme that is available at runtime.
|
|
26
|
+
* theme.toRuntimeSource = stringifyTheme;
|
|
27
|
+
*
|
|
28
|
+
* module.exports = withPigment({
|
|
29
|
+
* theme,
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function stringifyTheme(baseTheme = {}) {
|
|
34
|
+
const serializableTheme = {
|
|
35
|
+
...baseTheme
|
|
36
|
+
};
|
|
37
|
+
function serializeTheme(object) {
|
|
38
|
+
const array = Object.entries(object);
|
|
39
|
+
// eslint-disable-next-line no-plusplus
|
|
40
|
+
for (let index = 0; index < array.length; index++) {
|
|
41
|
+
const [key, value] = array[index];
|
|
42
|
+
if (!isSerializable(value) || key.startsWith('unstable_')) {
|
|
43
|
+
delete object[key];
|
|
44
|
+
} else if ((0, _deepmerge.isPlainObject)(value)) {
|
|
45
|
+
object[key] = {
|
|
46
|
+
...value
|
|
47
|
+
};
|
|
48
|
+
serializeTheme(object[key]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
serializeTheme(serializableTheme);
|
|
53
|
+
return `import { createBreakpoints } from '@mui/system';
|
|
54
|
+
import { createTransitions } from '@mui/material/styles';
|
|
55
|
+
|
|
56
|
+
const theme = ${JSON.stringify(serializableTheme, null, 2)};
|
|
57
|
+
|
|
58
|
+
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
59
|
+
theme.transitions = createTransitions(theme.transitions || {});
|
|
60
|
+
|
|
61
|
+
export default theme;`;
|
|
62
|
+
}
|
|
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "css", {
|
|
|
11
11
|
return _system.css;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
+
exports.globalCss = globalCss;
|
|
15
|
+
exports.internal_createExtendSxProp = internal_createExtendSxProp;
|
|
14
16
|
Object.defineProperty(exports, "keyframes", {
|
|
15
17
|
enumerable: true,
|
|
16
18
|
get: function () {
|
|
@@ -23,10 +25,37 @@ Object.defineProperty(exports, "styled", {
|
|
|
23
25
|
return _styled.default;
|
|
24
26
|
}
|
|
25
27
|
});
|
|
28
|
+
Object.defineProperty(exports, "useTheme", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return _useTheme.default;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var React = _interopRequireWildcard(require("react"));
|
|
35
|
+
var _styleFunctionSx = require("@mui/system/styleFunctionSx");
|
|
26
36
|
var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
|
|
37
|
+
var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
|
|
38
|
+
var _GlobalStyles2 = _interopRequireDefault(require("../GlobalStyles"));
|
|
39
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
40
|
var _system = require("@mui/system");
|
|
28
41
|
var _styled = _interopRequireDefault(require("../styles/styled"));
|
|
42
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
43
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
44
|
+
function globalCss(styles) {
|
|
45
|
+
var _GlobalStyles;
|
|
46
|
+
return function GlobalStylesWrapper() {
|
|
47
|
+
return _GlobalStyles || (_GlobalStyles = /*#__PURE__*/(0, _jsxRuntime.jsx)(_GlobalStyles2.default, {
|
|
48
|
+
styles: styles
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
29
53
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
54
|
function createUseThemeProps(name) {
|
|
31
55
|
return _useThemeProps.default;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
59
|
+
function internal_createExtendSxProp() {
|
|
60
|
+
return _styleFunctionSx.extendSxProp;
|
|
32
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"url": "https://opencollective.com/mui-org"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@babel/runtime": "^7.24.
|
|
30
|
+
"@babel/runtime": "^7.24.7",
|
|
31
31
|
"@types/react-transition-group": "^4.4.10",
|
|
32
32
|
"clsx": "^2.1.1",
|
|
33
33
|
"csstype": "^3.1.3",
|
|
34
34
|
"prop-types": "^15.8.1",
|
|
35
35
|
"react-is": "^18.2.0",
|
|
36
36
|
"react-transition-group": "^4.4.5",
|
|
37
|
-
"@mui/system": "^6.0.0-alpha.10",
|
|
38
|
-
"@mui/base": "5.0.0-beta.48",
|
|
39
|
-
"@mui/utils": "^6.0.0-alpha.9",
|
|
40
37
|
"@mui/types": "^7.2.14",
|
|
41
|
-
"@mui/
|
|
38
|
+
"@mui/base": "5.0.0-beta.49",
|
|
39
|
+
"@mui/system": "^6.0.0-alpha.11",
|
|
40
|
+
"@mui/utils": "^6.0.0-alpha.11",
|
|
41
|
+
"@mui/core-downloads-tracker": "^6.0.0-alpha.11"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@emotion/react": "^11.5.0",
|
package/styles/createTheme.js
CHANGED
|
@@ -45,7 +45,7 @@ Please use another name.` : _formatMuiErrorMessage(18));
|
|
|
45
45
|
const traverse = (node, component) => {
|
|
46
46
|
let key;
|
|
47
47
|
|
|
48
|
-
// eslint-disable-next-line guard-for-in
|
|
48
|
+
// eslint-disable-next-line guard-for-in
|
|
49
49
|
for (key in node) {
|
|
50
50
|
const child = node[key];
|
|
51
51
|
if (stateClasses.indexOf(key) !== -1 && Object.keys(child).length > 0) {
|
package/styles/index.d.ts
CHANGED
|
@@ -100,6 +100,9 @@ export { default as withTheme } from './withTheme';
|
|
|
100
100
|
export * from './CssVarsProvider';
|
|
101
101
|
|
|
102
102
|
export { default as extendTheme } from './extendTheme';
|
|
103
|
+
|
|
104
|
+
export * from './stringifyTheme';
|
|
105
|
+
|
|
103
106
|
export type {
|
|
104
107
|
ColorSchemeOverrides,
|
|
105
108
|
SupportedColorScheme,
|
package/styles/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export { default as unstable_createMuiStrictModeTheme } from './createMuiStrictM
|
|
|
14
14
|
export { default as createStyles } from './createStyles';
|
|
15
15
|
export { getUnit as unstable_getUnit, toUnitless as unstable_toUnitless } from './cssUtils';
|
|
16
16
|
export { default as responsiveFontSizes } from './responsiveFontSizes';
|
|
17
|
-
export { duration, easing } from './createTransitions';
|
|
17
|
+
export { default as createTransitions, duration, easing } from './createTransitions';
|
|
18
18
|
export { default as useTheme } from './useTheme';
|
|
19
19
|
export { default as useThemeProps } from './useThemeProps';
|
|
20
20
|
export { default as styled } from './styled';
|
|
@@ -31,6 +31,7 @@ export { default as extendTheme } from './extendTheme';
|
|
|
31
31
|
export { default as experimental_extendTheme } from './experimental_extendTheme'; // TODO: Remove in v7
|
|
32
32
|
export { default as getOverlayAlpha } from './getOverlayAlpha';
|
|
33
33
|
export { default as shouldSkipGeneratingVar } from './shouldSkipGeneratingVar';
|
|
34
|
+
export * from './stringifyTheme';
|
|
34
35
|
|
|
35
36
|
// Private methods for creating parts of the theme
|
|
36
37
|
export { default as private_createTypography } from './createTypography';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `baseTheme` usually comes from `createTheme` or `extendTheme`.
|
|
3
|
+
*
|
|
4
|
+
* This function is intended to be used with zero-runtime CSS-in-JS like Pigment CSS
|
|
5
|
+
* For example, in a Next.js project:
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* // next.config.js
|
|
9
|
+
* const { extendTheme } = require('@mui/material/styles');
|
|
10
|
+
*
|
|
11
|
+
* const theme = extendTheme();
|
|
12
|
+
* // `.toRuntimeSource` is Pigment CSS specific to create a theme that is available at runtime.
|
|
13
|
+
* theme.toRuntimeSource = stringifyTheme;
|
|
14
|
+
*
|
|
15
|
+
* module.exports = withPigment({
|
|
16
|
+
* theme,
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function stringifyTheme(baseTheme?: Record<string, any>): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
import { isPlainObject } from '@mui/utils/deepmerge';
|
|
3
|
+
function isSerializable(val) {
|
|
4
|
+
return isPlainObject(val) || typeof val === 'undefined' || typeof val === 'string' || typeof val === 'boolean' || typeof val === 'number' || Array.isArray(val);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `baseTheme` usually comes from `createTheme` or `extendTheme`.
|
|
9
|
+
*
|
|
10
|
+
* This function is intended to be used with zero-runtime CSS-in-JS like Pigment CSS
|
|
11
|
+
* For example, in a Next.js project:
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* // next.config.js
|
|
15
|
+
* const { extendTheme } = require('@mui/material/styles');
|
|
16
|
+
*
|
|
17
|
+
* const theme = extendTheme();
|
|
18
|
+
* // `.toRuntimeSource` is Pigment CSS specific to create a theme that is available at runtime.
|
|
19
|
+
* theme.toRuntimeSource = stringifyTheme;
|
|
20
|
+
*
|
|
21
|
+
* module.exports = withPigment({
|
|
22
|
+
* theme,
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function stringifyTheme(baseTheme = {}) {
|
|
27
|
+
const serializableTheme = {
|
|
28
|
+
...baseTheme
|
|
29
|
+
};
|
|
30
|
+
function serializeTheme(object) {
|
|
31
|
+
const array = Object.entries(object);
|
|
32
|
+
// eslint-disable-next-line no-plusplus
|
|
33
|
+
for (let index = 0; index < array.length; index++) {
|
|
34
|
+
const [key, value] = array[index];
|
|
35
|
+
if (!isSerializable(value) || key.startsWith('unstable_')) {
|
|
36
|
+
delete object[key];
|
|
37
|
+
} else if (isPlainObject(value)) {
|
|
38
|
+
object[key] = {
|
|
39
|
+
...value
|
|
40
|
+
};
|
|
41
|
+
serializeTheme(object[key]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
serializeTheme(serializableTheme);
|
|
46
|
+
return `import { createBreakpoints } from '@mui/system';
|
|
47
|
+
import { createTransitions } from '@mui/material/styles';
|
|
48
|
+
|
|
49
|
+
const theme = ${JSON.stringify(serializableTheme, null, 2)};
|
|
50
|
+
|
|
51
|
+
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
52
|
+
theme.transitions = createTransitions(theme.transitions || {});
|
|
53
|
+
|
|
54
|
+
export default theme;`;
|
|
55
|
+
}
|
package/zero-styled/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { extendSxProp } from '@mui/system/styleFunctionSx';
|
|
1
3
|
import useThemeProps from '../styles/useThemeProps';
|
|
4
|
+
import useTheme from '../styles/useTheme';
|
|
5
|
+
import { GlobalStylesProps } from '../GlobalStyles';
|
|
2
6
|
export { css, keyframes } from '@mui/system';
|
|
3
7
|
export { default as styled } from '../styles/styled';
|
|
8
|
+
export declare function globalCss(styles: GlobalStylesProps['styles']): () => React.JSX.Element;
|
|
4
9
|
export declare function createUseThemeProps(name: string): typeof useThemeProps;
|
|
10
|
+
export declare function internal_createExtendSxProp(): typeof extendSxProp;
|
|
11
|
+
export { useTheme };
|
package/zero-styled/index.js
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { extendSxProp } from '@mui/system/styleFunctionSx';
|
|
1
3
|
import useThemeProps from '../styles/useThemeProps';
|
|
4
|
+
import useTheme from '../styles/useTheme';
|
|
5
|
+
import GlobalStyles from '../GlobalStyles';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
7
|
export { css, keyframes } from '@mui/system';
|
|
3
8
|
export { default as styled } from '../styles/styled';
|
|
9
|
+
export function globalCss(styles) {
|
|
10
|
+
var _GlobalStyles;
|
|
11
|
+
return function GlobalStylesWrapper() {
|
|
12
|
+
return _GlobalStyles || (_GlobalStyles = /*#__PURE__*/_jsx(GlobalStyles, {
|
|
13
|
+
styles: styles
|
|
14
|
+
}));
|
|
15
|
+
};
|
|
16
|
+
}
|
|
4
17
|
|
|
5
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
19
|
export function createUseThemeProps(name) {
|
|
7
20
|
return useThemeProps;
|
|
8
|
-
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
|
+
export function internal_createExtendSxProp() {
|
|
25
|
+
return extendSxProp;
|
|
26
|
+
}
|
|
27
|
+
export { useTheme };
|