@mui/system 6.0.0-alpha.9 → 6.0.0-beta.1
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 +363 -3
- package/Container/createContainer.js +0 -2
- package/DefaultPropsProvider/DefaultPropsProvider.d.ts +12 -0
- package/DefaultPropsProvider/DefaultPropsProvider.js +64 -0
- package/DefaultPropsProvider/index.d.ts +1 -0
- package/DefaultPropsProvider/index.js +1 -0
- package/DefaultPropsProvider/package.json +6 -0
- package/{cssVars/getInitColorSchemeScript.d.ts → InitColorSchemeScript/InitColorSchemeScript.d.ts} +9 -2
- package/{cssVars/getInitColorSchemeScript.js → InitColorSchemeScript/InitColorSchemeScript.js} +9 -2
- package/InitColorSchemeScript/index.d.ts +2 -0
- package/InitColorSchemeScript/index.js +1 -0
- package/InitColorSchemeScript/package.json +6 -0
- package/ThemeProvider/ThemeProvider.js +5 -1
- package/Unstable_Grid/Grid.js +5 -81
- package/Unstable_Grid/GridProps.d.ts +12 -97
- package/Unstable_Grid/createGrid.js +36 -55
- package/Unstable_Grid/gridClasses.js +1 -1
- package/Unstable_Grid/gridGenerator.d.ts +3 -10
- package/Unstable_Grid/gridGenerator.js +10 -19
- package/createTheme/createTheme.d.ts +1 -1
- package/cssContainerQueries/cssContainerQueries.js +4 -4
- package/cssVars/createCssVarsProvider.d.ts +2 -2
- package/cssVars/createCssVarsProvider.js +2 -2
- package/cssVars/index.d.ts +0 -1
- package/cssVars/index.js +0 -1
- package/cssVars/prepareCssVars.js +2 -2
- package/cssVars/useCurrentColorScheme.js +1 -1
- package/index.js +1 -1
- package/modern/Container/createContainer.js +0 -2
- package/modern/DefaultPropsProvider/DefaultPropsProvider.js +64 -0
- package/modern/DefaultPropsProvider/index.js +1 -0
- package/modern/{cssVars/getInitColorSchemeScript.js → InitColorSchemeScript/InitColorSchemeScript.js} +9 -2
- package/modern/InitColorSchemeScript/index.js +1 -0
- package/modern/ThemeProvider/ThemeProvider.js +5 -1
- package/modern/Unstable_Grid/Grid.js +5 -81
- package/modern/Unstable_Grid/createGrid.js +36 -55
- package/modern/Unstable_Grid/gridClasses.js +1 -1
- package/modern/Unstable_Grid/gridGenerator.js +10 -19
- package/modern/cssContainerQueries/cssContainerQueries.js +4 -4
- package/modern/cssVars/createCssVarsProvider.js +2 -2
- package/modern/cssVars/index.js +0 -1
- package/modern/cssVars/prepareCssVars.js +2 -2
- package/modern/cssVars/useCurrentColorScheme.js +1 -1
- package/modern/index.js +1 -1
- package/modern/useMediaQuery/useMediaQuery.js +5 -27
- package/node/Container/createContainer.js +0 -2
- package/node/DefaultPropsProvider/DefaultPropsProvider.js +73 -0
- package/node/DefaultPropsProvider/index.js +20 -0
- package/node/{cssVars/getInitColorSchemeScript.js → InitColorSchemeScript/InitColorSchemeScript.js} +11 -3
- package/node/InitColorSchemeScript/index.js +13 -0
- package/node/ThemeProvider/ThemeProvider.js +5 -1
- package/node/Unstable_Grid/Grid.js +5 -81
- package/node/Unstable_Grid/createGrid.js +37 -56
- package/node/Unstable_Grid/gridClasses.js +1 -1
- package/node/Unstable_Grid/gridGenerator.js +10 -19
- package/node/cssContainerQueries/cssContainerQueries.js +4 -4
- package/node/cssVars/createCssVarsProvider.js +5 -5
- package/node/cssVars/index.js +0 -7
- package/node/cssVars/prepareCssVars.js +2 -2
- package/node/cssVars/useCurrentColorScheme.js +3 -3
- package/node/index.js +1 -1
- package/node/useMediaQuery/useMediaQuery.js +5 -26
- package/package.json +5 -5
- package/useMediaQuery/useMediaQuery.d.ts +0 -18
- package/useMediaQuery/useMediaQuery.js +5 -27
package/Unstable_Grid/Grid.js
CHANGED
|
@@ -46,62 +46,18 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
|
|
|
46
46
|
*/
|
|
47
47
|
direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* Defines the offset value for the type `item` components.
|
|
50
50
|
*/
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
54
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
55
|
-
* If 'auto', the grid item's width matches its content.
|
|
56
|
-
* If false, the prop is ignored.
|
|
57
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
58
|
-
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
59
|
-
* @default false
|
|
60
|
-
*/
|
|
61
|
-
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
62
|
-
/**
|
|
63
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
64
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
65
|
-
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
66
|
-
*/
|
|
67
|
-
lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
68
|
-
/**
|
|
69
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
70
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
71
|
-
* If 'auto', the grid item's width matches its content.
|
|
72
|
-
* If false, the prop is ignored.
|
|
73
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
74
|
-
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
75
|
-
* @default false
|
|
76
|
-
*/
|
|
77
|
-
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
78
|
-
/**
|
|
79
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
80
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
81
|
-
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
82
|
-
*/
|
|
83
|
-
mdOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
51
|
+
offset: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.object]),
|
|
84
52
|
/**
|
|
85
53
|
* Defines the vertical space between the type `item` components.
|
|
86
54
|
* It overrides the value of the `spacing` prop.
|
|
87
55
|
*/
|
|
88
56
|
rowSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
89
57
|
/**
|
|
90
|
-
*
|
|
91
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
92
|
-
* If 'auto', the grid item's width matches its content.
|
|
93
|
-
* If false, the prop is ignored.
|
|
94
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
95
|
-
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
96
|
-
* @default false
|
|
58
|
+
* Defines the size of the the type `item` components.
|
|
97
59
|
*/
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
101
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
102
|
-
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
103
|
-
*/
|
|
104
|
-
smOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
60
|
+
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number])), PropTypes.object]),
|
|
105
61
|
/**
|
|
106
62
|
* Defines the space between the type `item` components.
|
|
107
63
|
* It can only be used on a type `container` component.
|
|
@@ -140,38 +96,6 @@ process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ =
|
|
|
140
96
|
* It's applied for all screen sizes.
|
|
141
97
|
* @default 'wrap'
|
|
142
98
|
*/
|
|
143
|
-
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
144
|
-
/**
|
|
145
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
146
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
147
|
-
* If 'auto', the grid item's width matches its content.
|
|
148
|
-
* If false, the prop is ignored.
|
|
149
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
150
|
-
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
151
|
-
* @default false
|
|
152
|
-
*/
|
|
153
|
-
xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
154
|
-
/**
|
|
155
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
156
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
157
|
-
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
158
|
-
*/
|
|
159
|
-
xlOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
160
|
-
/**
|
|
161
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
162
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
163
|
-
* If 'auto', the grid item's width matches its content.
|
|
164
|
-
* If false, the prop is ignored.
|
|
165
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
166
|
-
* The value is applied for all the screen sizes with the lowest priority.
|
|
167
|
-
* @default false
|
|
168
|
-
*/
|
|
169
|
-
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
170
|
-
/**
|
|
171
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
172
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
173
|
-
* The value is applied for the `xs` breakpoint and wider screens if not overridden.
|
|
174
|
-
*/
|
|
175
|
-
xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
|
|
99
|
+
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
176
100
|
} : void 0;
|
|
177
101
|
export default Grid;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { OverrideProps,
|
|
2
|
+
import { OverrideProps, PartiallyRequired } from '@mui/types';
|
|
3
3
|
import { SxProps } from '../styleFunctionSx';
|
|
4
|
-
import { Theme, Breakpoint
|
|
4
|
+
import { Theme, Breakpoint } from '../createTheme';
|
|
5
5
|
import { SystemProps } from '../Box';
|
|
6
6
|
type ResponsiveStyleValue<T> = T | Array<T | null> | {
|
|
7
7
|
[key in Breakpoint]?: T | null;
|
|
@@ -9,94 +9,9 @@ type ResponsiveStyleValue<T> = T | Array<T | null> | {
|
|
|
9
9
|
export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
10
10
|
export type GridSpacing = number | string;
|
|
11
11
|
export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
12
|
-
export type GridSize = 'auto' | number;
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
16
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
17
|
-
* If 'auto', the grid item's width matches its content.
|
|
18
|
-
* If false, the prop is ignored.
|
|
19
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
20
|
-
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
lg?: boolean | GridSize;
|
|
24
|
-
/**
|
|
25
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
26
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
27
|
-
* The value is applied for the `lg` breakpoint and wider screens if not overridden.
|
|
28
|
-
*/
|
|
29
|
-
lgOffset?: GridSize;
|
|
30
|
-
/**
|
|
31
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
32
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
33
|
-
* If 'auto', the grid item's width matches its content.
|
|
34
|
-
* If false, the prop is ignored.
|
|
35
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
36
|
-
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
md?: boolean | GridSize;
|
|
40
|
-
/**
|
|
41
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
42
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
43
|
-
* The value is applied for the `md` breakpoint and wider screens if not overridden.
|
|
44
|
-
*/
|
|
45
|
-
mdOffset?: GridSize;
|
|
46
|
-
/**
|
|
47
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
48
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
49
|
-
* If 'auto', the grid item's width matches its content.
|
|
50
|
-
* If false, the prop is ignored.
|
|
51
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
52
|
-
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
53
|
-
* @default false
|
|
54
|
-
*/
|
|
55
|
-
sm?: boolean | GridSize;
|
|
56
|
-
/**
|
|
57
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
58
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
59
|
-
* The value is applied for the `sm` breakpoint and wider screens if not overridden.
|
|
60
|
-
*/
|
|
61
|
-
smOffset?: GridSize;
|
|
62
|
-
/**
|
|
63
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
64
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
65
|
-
* If 'auto', the grid item's width matches its content.
|
|
66
|
-
* If false, the prop is ignored.
|
|
67
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
68
|
-
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
69
|
-
* @default false
|
|
70
|
-
*/
|
|
71
|
-
xl?: boolean | GridSize;
|
|
72
|
-
/**
|
|
73
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
74
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
75
|
-
* The value is applied for the `xl` breakpoint and wider screens if not overridden.
|
|
76
|
-
*/
|
|
77
|
-
xlOffset?: GridSize;
|
|
78
|
-
/**
|
|
79
|
-
* If a number, it sets the number of columns the grid item uses.
|
|
80
|
-
* It can't be greater than the total number of columns of the container (12 by default).
|
|
81
|
-
* If 'auto', the grid item's width matches its content.
|
|
82
|
-
* If false, the prop is ignored.
|
|
83
|
-
* If true, the grid item's width grows to use the space available in the grid container.
|
|
84
|
-
* The value is applied for all the screen sizes with the lowest priority.
|
|
85
|
-
* @default false
|
|
86
|
-
*/
|
|
87
|
-
xs?: boolean | GridSize;
|
|
88
|
-
/**
|
|
89
|
-
* If a number, it sets the margin-left equals to the number of columns the grid item uses.
|
|
90
|
-
* If 'auto', the grid item push itself to the right-end of the container.
|
|
91
|
-
* The value is applied for the `xs` breakpoint and wider screens if not overridden.
|
|
92
|
-
*/
|
|
93
|
-
xsOffset?: GridSize;
|
|
94
|
-
}
|
|
95
|
-
type CustomBreakpoints = Partial<Record<Breakpoint, boolean | GridSize> & Record<`${Breakpoint}Offset`, GridSize>>;
|
|
96
|
-
interface BreakpointOverridesEmpty {
|
|
97
|
-
}
|
|
98
|
-
type Breakpoints = IfEquals<BreakpointOverrides, BreakpointOverridesEmpty, GridDefaultBreakpoints, CustomBreakpoints>;
|
|
99
|
-
export interface GridBaseProps extends Breakpoints {
|
|
12
|
+
export type GridSize = 'auto' | 'grow' | number | false;
|
|
13
|
+
export type GridOffset = 'auto' | number;
|
|
14
|
+
export interface GridBaseProps {
|
|
100
15
|
/**
|
|
101
16
|
* The content of the component.
|
|
102
17
|
*/
|
|
@@ -124,9 +39,9 @@ export interface GridBaseProps extends Breakpoints {
|
|
|
124
39
|
*/
|
|
125
40
|
direction?: ResponsiveStyleValue<GridDirection>;
|
|
126
41
|
/**
|
|
127
|
-
*
|
|
42
|
+
* Defines the offset value for the type `item` components.
|
|
128
43
|
*/
|
|
129
|
-
|
|
44
|
+
offset?: ResponsiveStyleValue<GridOffset>;
|
|
130
45
|
/**
|
|
131
46
|
* @internal
|
|
132
47
|
* The level of the grid starts from `0`
|
|
@@ -155,6 +70,10 @@ export interface GridBaseProps extends Breakpoints {
|
|
|
155
70
|
* It overrides the value of the `spacing` prop.
|
|
156
71
|
*/
|
|
157
72
|
rowSpacing?: ResponsiveStyleValue<GridSpacing>;
|
|
73
|
+
/**
|
|
74
|
+
* Defines the size of the the type `item` components.
|
|
75
|
+
*/
|
|
76
|
+
size?: ResponsiveStyleValue<GridSize>;
|
|
158
77
|
/**
|
|
159
78
|
* Defines the space between the type `item` components.
|
|
160
79
|
* It can only be used on a type `container` component.
|
|
@@ -168,11 +87,7 @@ export interface GridBaseProps extends Breakpoints {
|
|
|
168
87
|
*/
|
|
169
88
|
wrap?: GridWrap;
|
|
170
89
|
}
|
|
171
|
-
export
|
|
172
|
-
unstable_level: number;
|
|
173
|
-
gridSize: Partial<Record<Breakpoint, GridSize | boolean>>;
|
|
174
|
-
gridOffset: Partial<Record<Breakpoint, GridSize>>;
|
|
175
|
-
}
|
|
90
|
+
export type GridOwnerState = PartiallyRequired<GridBaseProps, 'size' | 'offset' | 'unstable_level'>;
|
|
176
91
|
export interface GridTypeMap<AdditionalProps = {}, DefaultComponent extends React.ElementType = 'div'> {
|
|
177
92
|
props: AdditionalProps & GridBaseProps & {
|
|
178
93
|
sx?: SxProps<Theme>;
|
|
@@ -33,29 +33,47 @@ export default function createGrid(options = {}) {
|
|
|
33
33
|
useThemeProps = useThemePropsDefault,
|
|
34
34
|
componentName = 'MuiGrid'
|
|
35
35
|
} = options;
|
|
36
|
-
const GridOverflowContext = /*#__PURE__*/React.createContext(undefined);
|
|
37
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
38
|
-
GridOverflowContext.displayName = 'GridOverflowContext';
|
|
39
|
-
}
|
|
40
36
|
const useUtilityClasses = (ownerState, theme) => {
|
|
41
37
|
const {
|
|
42
38
|
container,
|
|
43
39
|
direction,
|
|
44
40
|
spacing,
|
|
45
41
|
wrap,
|
|
46
|
-
|
|
42
|
+
size
|
|
47
43
|
} = ownerState;
|
|
48
44
|
const slots = {
|
|
49
|
-
root: ['root', container && 'container', wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...generateDirectionClasses(direction), ...generateSizeClassNames(
|
|
45
|
+
root: ['root', container && 'container', wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...generateDirectionClasses(direction), ...generateSizeClassNames(size), ...(container ? generateSpacingClassNames(spacing, theme.breakpoints.keys[0]) : [])]
|
|
50
46
|
};
|
|
51
47
|
return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
|
|
52
48
|
};
|
|
49
|
+
function parseResponsiveProp(propValue, breakpoints, shouldUseValue = () => true) {
|
|
50
|
+
const parsedProp = {};
|
|
51
|
+
if (propValue === null) {
|
|
52
|
+
return parsedProp;
|
|
53
|
+
}
|
|
54
|
+
if (Array.isArray(propValue)) {
|
|
55
|
+
propValue.forEach((value, index) => {
|
|
56
|
+
if (value !== null && shouldUseValue(value) && breakpoints.keys[index]) {
|
|
57
|
+
parsedProp[breakpoints.keys[index]] = value;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
} else if (typeof propValue === 'object') {
|
|
61
|
+
Object.keys(propValue).forEach(key => {
|
|
62
|
+
const value = propValue[key];
|
|
63
|
+
if (value !== null && value !== undefined && shouldUseValue(value)) {
|
|
64
|
+
parsedProp[key] = value;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
parsedProp[breakpoints.keys[0]] = propValue;
|
|
69
|
+
}
|
|
70
|
+
return parsedProp;
|
|
71
|
+
}
|
|
53
72
|
const GridRoot = createStyledComponent(generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridSizeStyles, generateGridDirectionStyles, generateGridStyles, generateGridOffsetStyles);
|
|
54
73
|
const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
|
55
74
|
const theme = useTheme();
|
|
56
75
|
const themeProps = useThemeProps(inProps);
|
|
57
76
|
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
|
58
|
-
const overflow = React.useContext(GridOverflowContext);
|
|
59
77
|
const {
|
|
60
78
|
className,
|
|
61
79
|
children,
|
|
@@ -64,31 +82,16 @@ export default function createGrid(options = {}) {
|
|
|
64
82
|
component = 'div',
|
|
65
83
|
direction = 'row',
|
|
66
84
|
wrap = 'wrap',
|
|
85
|
+
size: sizeProp = {},
|
|
86
|
+
offset: offsetProp = {},
|
|
67
87
|
spacing: spacingProp = 0,
|
|
68
88
|
rowSpacing: rowSpacingProp = spacingProp,
|
|
69
89
|
columnSpacing: columnSpacingProp = spacingProp,
|
|
70
|
-
disableEqualOverflow: themeDisableEqualOverflow,
|
|
71
90
|
unstable_level: level = 0,
|
|
72
|
-
...
|
|
91
|
+
...other
|
|
73
92
|
} = props;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (level && themeDisableEqualOverflow !== undefined) {
|
|
77
|
-
disableEqualOverflow = inProps.disableEqualOverflow;
|
|
78
|
-
}
|
|
79
|
-
// collect breakpoints related props because they can be customized from the theme.
|
|
80
|
-
const gridSize = {};
|
|
81
|
-
const gridOffset = {};
|
|
82
|
-
const other = {};
|
|
83
|
-
Object.entries(rest).forEach(([key, val]) => {
|
|
84
|
-
if (theme.breakpoints.values[key] !== undefined) {
|
|
85
|
-
gridSize[key] = val;
|
|
86
|
-
} else if (theme.breakpoints.values[key.replace('Offset', '')] !== undefined) {
|
|
87
|
-
gridOffset[key.replace('Offset', '')] = val;
|
|
88
|
-
} else {
|
|
89
|
-
other[key] = val;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
93
|
+
const size = parseResponsiveProp(sizeProp, theme.breakpoints, val => val !== false);
|
|
94
|
+
const offset = parseResponsiveProp(offsetProp, theme.breakpoints);
|
|
92
95
|
const columns = inProps.columns ?? (level ? undefined : columnsProp);
|
|
93
96
|
const spacing = inProps.spacing ?? (level ? undefined : spacingProp);
|
|
94
97
|
const rowSpacing = inProps.rowSpacing ?? inProps.spacing ?? (level ? undefined : rowSpacingProp);
|
|
@@ -103,14 +106,11 @@ export default function createGrid(options = {}) {
|
|
|
103
106
|
spacing,
|
|
104
107
|
rowSpacing,
|
|
105
108
|
columnSpacing,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
disableEqualOverflow: disableEqualOverflow ?? overflow ?? false,
|
|
109
|
-
// use context value if exists.
|
|
110
|
-
parentDisableEqualOverflow: overflow // for nested grid
|
|
109
|
+
size,
|
|
110
|
+
offset
|
|
111
111
|
};
|
|
112
112
|
const classes = useUtilityClasses(ownerState, theme);
|
|
113
|
-
|
|
113
|
+
return /*#__PURE__*/_jsx(GridRoot, {
|
|
114
114
|
ref: ref,
|
|
115
115
|
as: component,
|
|
116
116
|
ownerState: ownerState,
|
|
@@ -125,16 +125,6 @@ export default function createGrid(options = {}) {
|
|
|
125
125
|
return child;
|
|
126
126
|
})
|
|
127
127
|
});
|
|
128
|
-
if (disableEqualOverflow !== undefined && disableEqualOverflow !== (overflow ?? false)) {
|
|
129
|
-
// There are 2 possibilities that should wrap with the GridOverflowContext to communicate with the nested grids:
|
|
130
|
-
// 1. It is the root grid with `disableEqualOverflow`.
|
|
131
|
-
// 2. It is a nested grid with different `disableEqualOverflow` from the context.
|
|
132
|
-
result = /*#__PURE__*/_jsx(GridOverflowContext.Provider, {
|
|
133
|
-
value: disableEqualOverflow,
|
|
134
|
-
children: result
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return result;
|
|
138
128
|
});
|
|
139
129
|
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
|
140
130
|
children: PropTypes.node,
|
|
@@ -144,21 +134,12 @@ export default function createGrid(options = {}) {
|
|
|
144
134
|
component: PropTypes.elementType,
|
|
145
135
|
container: PropTypes.bool,
|
|
146
136
|
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
|
147
|
-
|
|
148
|
-
lg: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
149
|
-
lgOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
150
|
-
md: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
151
|
-
mdOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
137
|
+
offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.object]),
|
|
152
138
|
rowSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
153
|
-
|
|
154
|
-
smOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
139
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number])), PropTypes.object]),
|
|
155
140
|
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
156
141
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
157
|
-
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
158
|
-
xl: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
159
|
-
xlOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
160
|
-
xs: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.bool]),
|
|
161
|
-
xsOffset: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number])
|
|
142
|
+
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
|
162
143
|
} : void 0;
|
|
163
144
|
|
|
164
145
|
// @ts-ignore internal logic for nested grid
|
|
@@ -6,7 +6,7 @@ export function getGridUtilityClass(slot) {
|
|
|
6
6
|
const SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
7
7
|
const DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'];
|
|
8
8
|
const WRAPS = ['nowrap', 'wrap-reverse', 'wrap'];
|
|
9
|
-
const GRID_SIZES = ['auto',
|
|
9
|
+
const GRID_SIZES = ['auto', 'grow', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
10
10
|
const gridClasses = generateUtilityClasses('MuiGrid', ['root', 'container', 'item',
|
|
11
11
|
// spacings
|
|
12
12
|
...SPACINGS.map(spacing => `spacing-xs-${spacing}`),
|
|
@@ -7,18 +7,11 @@ interface Props {
|
|
|
7
7
|
breakpoints: Breakpoints;
|
|
8
8
|
spacing?: Spacing;
|
|
9
9
|
};
|
|
10
|
-
ownerState: GridOwnerState
|
|
11
|
-
parentDisableEqualOverflow?: boolean;
|
|
12
|
-
};
|
|
10
|
+
ownerState: GridOwnerState;
|
|
13
11
|
}
|
|
14
12
|
export declare const generateGridSizeStyles: ({ theme, ownerState }: Props) => {};
|
|
15
13
|
export declare const generateGridOffsetStyles: ({ theme, ownerState }: Props) => {};
|
|
16
|
-
export declare const generateGridColumnsStyles: ({ theme, ownerState }: Props) =>
|
|
17
|
-
[x: string]: string;
|
|
18
|
-
'--Grid-columns'?: undefined;
|
|
19
|
-
} | {
|
|
20
|
-
'--Grid-columns': number;
|
|
21
|
-
};
|
|
14
|
+
export declare const generateGridColumnsStyles: ({ theme, ownerState }: Props) => Record<string, string | number | undefined>;
|
|
22
15
|
export declare const generateGridRowSpacingStyles: ({ theme, ownerState }: Props) => {
|
|
23
16
|
[x: string]: string;
|
|
24
17
|
};
|
|
@@ -27,7 +20,7 @@ export declare const generateGridColumnSpacingStyles: ({ theme, ownerState }: Pr
|
|
|
27
20
|
};
|
|
28
21
|
export declare const generateGridDirectionStyles: ({ theme, ownerState }: Props) => {};
|
|
29
22
|
export declare const generateGridStyles: ({ ownerState }: Props) => {};
|
|
30
|
-
export declare const generateSizeClassNames: (
|
|
23
|
+
export declare const generateSizeClassNames: (size: GridOwnerState['size']) => string[];
|
|
31
24
|
export declare const generateSpacingClassNames: (spacing: GridOwnerState['spacing'], smallestBreakpoint?: string) => string[];
|
|
32
25
|
export declare const generateDirectionClasses: (direction: ResponsiveStyleValue<GridDirection> | undefined) => string[];
|
|
33
26
|
export {};
|
|
@@ -31,11 +31,11 @@ export const generateGridSizeStyles = ({
|
|
|
31
31
|
theme,
|
|
32
32
|
ownerState
|
|
33
33
|
}) => {
|
|
34
|
-
const
|
|
34
|
+
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
35
35
|
const styles = {};
|
|
36
|
-
traverseBreakpoints(theme.breakpoints, ownerState.
|
|
36
|
+
traverseBreakpoints(theme.breakpoints, ownerState.size, (appendStyle, value) => {
|
|
37
37
|
let style = {};
|
|
38
|
-
if (value ===
|
|
38
|
+
if (value === 'grow') {
|
|
39
39
|
style = {
|
|
40
40
|
flexBasis: 0,
|
|
41
41
|
flexGrow: 1,
|
|
@@ -55,7 +55,7 @@ export const generateGridSizeStyles = ({
|
|
|
55
55
|
style = {
|
|
56
56
|
flexGrow: 0,
|
|
57
57
|
flexBasis: 'auto',
|
|
58
|
-
width: `calc(100% * ${value} / ${getParentColumns(ownerState)}${
|
|
58
|
+
width: `calc(100% * ${value} / ${getParentColumns(ownerState)} - (${getParentColumns(ownerState)} - ${value}) * (${getParentSpacing('column')} / ${getParentColumns(ownerState)}))`
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
appendStyle(styles, style);
|
|
@@ -66,8 +66,9 @@ export const generateGridOffsetStyles = ({
|
|
|
66
66
|
theme,
|
|
67
67
|
ownerState
|
|
68
68
|
}) => {
|
|
69
|
+
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
69
70
|
const styles = {};
|
|
70
|
-
traverseBreakpoints(theme.breakpoints, ownerState.
|
|
71
|
+
traverseBreakpoints(theme.breakpoints, ownerState.offset, (appendStyle, value) => {
|
|
71
72
|
let style = {};
|
|
72
73
|
if (value === 'auto') {
|
|
73
74
|
style = {
|
|
@@ -76,7 +77,7 @@ export const generateGridOffsetStyles = ({
|
|
|
76
77
|
}
|
|
77
78
|
if (typeof value === 'number') {
|
|
78
79
|
style = {
|
|
79
|
-
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)})`
|
|
80
|
+
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)} + ${getParentSpacing('column')} * ${value} / ${getParentColumns(ownerState)})`
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
appendStyle(styles, style);
|
|
@@ -161,7 +162,6 @@ export const generateGridStyles = ({
|
|
|
161
162
|
ownerState
|
|
162
163
|
}) => {
|
|
163
164
|
const getSelfSpacing = createGetSelfSpacing(ownerState);
|
|
164
|
-
const getParentSpacing = createGetParentSpacing(ownerState);
|
|
165
165
|
return {
|
|
166
166
|
minWidth: 0,
|
|
167
167
|
boxSizing: 'border-box',
|
|
@@ -171,22 +171,13 @@ export const generateGridStyles = ({
|
|
|
171
171
|
...(ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
|
172
172
|
flexWrap: ownerState.wrap
|
|
173
173
|
}),
|
|
174
|
-
|
|
175
|
-
...(ownerState.disableEqualOverflow && {
|
|
176
|
-
margin: `calc(${getSelfSpacing('row')} * -1) 0px 0px calc(${getSelfSpacing('column')} * -1)`
|
|
177
|
-
})
|
|
178
|
-
}),
|
|
179
|
-
...((!ownerState.container || isNestedContainer(ownerState)) && {
|
|
180
|
-
padding: `calc(${getParentSpacing('row')} / 2) calc(${getParentSpacing('column')} / 2)`,
|
|
181
|
-
...((ownerState.disableEqualOverflow || ownerState.parentDisableEqualOverflow) && {
|
|
182
|
-
padding: `${getParentSpacing('row')} 0px 0px ${getParentSpacing('column')}`
|
|
183
|
-
})
|
|
174
|
+
gap: `${getSelfSpacing('row')} ${getSelfSpacing('column')}`
|
|
184
175
|
})
|
|
185
176
|
};
|
|
186
177
|
};
|
|
187
|
-
export const generateSizeClassNames =
|
|
178
|
+
export const generateSizeClassNames = size => {
|
|
188
179
|
const classNames = [];
|
|
189
|
-
Object.entries(
|
|
180
|
+
Object.entries(size).forEach(([key, value]) => {
|
|
190
181
|
if (value !== false && value !== undefined) {
|
|
191
182
|
classNames.push(`grid-${key}-${String(value)}`);
|
|
192
183
|
}
|
|
@@ -6,7 +6,7 @@ import { SxConfig, SxProps } from '../styleFunctionSx';
|
|
|
6
6
|
import { ApplyStyles } from './applyStyles';
|
|
7
7
|
import { CssContainerQueries } from '../cssContainerQueries';
|
|
8
8
|
|
|
9
|
-
export { Breakpoint, BreakpointOverrides } from './createBreakpoints';
|
|
9
|
+
export { Breakpoint, Breakpoints, BreakpointOverrides } from './createBreakpoints';
|
|
10
10
|
|
|
11
11
|
export type Direction = 'ltr' | 'rtl';
|
|
12
12
|
|
|
@@ -26,10 +26,10 @@ export function sortContainerQueries(theme, css) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
export function isCqShorthand(breakpointKeys, value) {
|
|
29
|
-
return value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
29
|
+
return value === '@' || value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
30
30
|
}
|
|
31
31
|
export function getContainerQuery(theme, shorthand) {
|
|
32
|
-
const matches = shorthand.match(/^@([^/]+)
|
|
32
|
+
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
|
33
33
|
if (!matches) {
|
|
34
34
|
if (process.env.NODE_ENV !== 'production') {
|
|
35
35
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
@@ -38,7 +38,7 @@ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.` : _formatMuiErrorMessag
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
const [, containerQuery, containerName] = matches;
|
|
41
|
-
const value = Number.isNaN(+containerQuery) ? containerQuery : +containerQuery;
|
|
41
|
+
const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
|
|
42
42
|
return theme.containerQueries(containerName).up(value);
|
|
43
43
|
}
|
|
44
44
|
export default function cssContainerQueries(themeInput) {
|
|
@@ -52,7 +52,7 @@ export default function cssContainerQueries(themeInput) {
|
|
|
52
52
|
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
|
53
53
|
if (result.includes('not all and')) {
|
|
54
54
|
// `@container` does not work with `not all and`, so need to invert the logic
|
|
55
|
-
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>');
|
|
55
|
+
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>').replace('and', 'or');
|
|
56
56
|
}
|
|
57
57
|
return result;
|
|
58
58
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import InitColorSchemeScript from '../InitColorSchemeScript';
|
|
3
3
|
import { Mode, Result } from './useCurrentColorScheme';
|
|
4
4
|
|
|
5
5
|
export interface ColorSchemeContextValue<SupportedColorScheme extends string>
|
|
@@ -92,7 +92,7 @@ export interface CreateCssVarsProviderResult<
|
|
|
92
92
|
>,
|
|
93
93
|
) => React.ReactElement<any>;
|
|
94
94
|
useColorScheme: () => ColorSchemeContextValue<ColorScheme>;
|
|
95
|
-
getInitColorSchemeScript: typeof
|
|
95
|
+
getInitColorSchemeScript: typeof InitColorSchemeScript;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export default function createCssVarsProvider<
|
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { GlobalStyles } from '@mui/styled-engine';
|
|
5
5
|
import { useTheme as muiUseTheme } from '@mui/private-theming';
|
|
6
6
|
import ThemeProvider from '../ThemeProvider';
|
|
7
|
-
import
|
|
7
|
+
import InitColorSchemeScript, { DEFAULT_ATTRIBUTE, DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from '../InitColorSchemeScript/InitColorSchemeScript';
|
|
8
8
|
import useCurrentColorScheme from './useCurrentColorScheme';
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
export const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
|
|
@@ -299,7 +299,7 @@ export default function createCssVarsProvider(options) {
|
|
|
299
299
|
} : void 0;
|
|
300
300
|
const defaultLightColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.light;
|
|
301
301
|
const defaultDarkColorScheme = typeof designSystemColorScheme === 'string' ? designSystemColorScheme : designSystemColorScheme.dark;
|
|
302
|
-
const getInitColorSchemeScript = params =>
|
|
302
|
+
const getInitColorSchemeScript = params => InitColorSchemeScript({
|
|
303
303
|
attribute: defaultAttribute,
|
|
304
304
|
colorSchemeStorageKey: defaultColorSchemeStorageKey,
|
|
305
305
|
defaultMode: designSystemMode,
|
package/cssVars/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default } from './createCssVarsProvider';
|
|
2
2
|
export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue, } from './createCssVarsProvider';
|
|
3
|
-
export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
|
|
4
3
|
export { default as prepareCssVars } from './prepareCssVars';
|
|
5
4
|
export { default as prepareTypographyVars } from './prepareTypographyVars';
|
|
6
5
|
export type { ExtractTypographyTokens } from './prepareTypographyVars';
|
package/cssVars/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
export { default } from './createCssVarsProvider';
|
|
4
|
-
export { default as getInitColorSchemeScript } from './getInitColorSchemeScript';
|
|
5
4
|
export { default as prepareCssVars } from './prepareCssVars';
|
|
6
5
|
export { default as prepareTypographyVars } from './prepareTypographyVars';
|
|
7
6
|
export { default as createCssVarsTheme } from './createCssVarsTheme';
|
|
@@ -75,7 +75,7 @@ function prepareCssVars(theme, {
|
|
|
75
75
|
}) || ':root', rootCss);
|
|
76
76
|
const {
|
|
77
77
|
[colorScheme]: defaultSchemeVal,
|
|
78
|
-
...
|
|
78
|
+
...other
|
|
79
79
|
} = colorSchemesMap;
|
|
80
80
|
if (defaultSchemeVal) {
|
|
81
81
|
// default color scheme has to come before other color schemes
|
|
@@ -86,7 +86,7 @@ function prepareCssVars(theme, {
|
|
|
86
86
|
...css
|
|
87
87
|
}) || `[${theme.attribute || 'data-color-scheme'}="${colorScheme}"]`, css);
|
|
88
88
|
}
|
|
89
|
-
Object.entries(
|
|
89
|
+
Object.entries(other).forEach(([key, {
|
|
90
90
|
css
|
|
91
91
|
}]) => {
|
|
92
92
|
insertStyleSheet(getSelector?.(key, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { DEFAULT_MODE_STORAGE_KEY, DEFAULT_COLOR_SCHEME_STORAGE_KEY } from '
|
|
4
|
+
import { DEFAULT_MODE_STORAGE_KEY, DEFAULT_COLOR_SCHEME_STORAGE_KEY } from '../InitColorSchemeScript/InitColorSchemeScript';
|
|
5
5
|
export function getSystemMode(mode) {
|
|
6
6
|
if (typeof window !== 'undefined' && mode === 'system') {
|
|
7
7
|
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
package/index.js
CHANGED