@mui/system 7.0.0-alpha.0 → 7.0.0-alpha.2
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.d.ts +22 -173
- package/Box/boxClasses.d.ts +3 -3
- package/Box/index.d.ts +4 -5
- package/CHANGELOG.md +92 -0
- package/CSSProperties.d.ts +1 -3
- package/Container/Container.d.ts +2 -2
- package/Container/ContainerProps.d.ts +36 -36
- package/Container/containerClasses.d.ts +17 -17
- package/Container/createContainer.d.ts +10 -10
- package/Container/createContainer.js +1 -0
- package/Container/index.d.ts +4 -5
- package/DefaultPropsProvider/DefaultPropsProvider.d.ts +13 -7
- package/DefaultPropsProvider/index.d.ts +1 -1
- package/GlobalStyles/GlobalStyles.d.ts +11 -7
- package/GlobalStyles/index.d.ts +2 -2
- package/Grid/Grid.d.ts +2 -2
- package/Grid/GridProps.d.ts +89 -91
- package/Grid/createGrid.d.ts +8 -8
- package/Grid/createGrid.js +1 -0
- package/Grid/gridClasses.d.ts +15 -15
- package/Grid/gridGenerator.d.ts +37 -17
- package/Grid/index.d.ts +7 -7
- package/Grid/traverseBreakpoints.d.ts +3 -3
- package/InitColorSchemeScript/InitColorSchemeScript.d.ts +42 -42
- package/InitColorSchemeScript/index.d.ts +2 -2
- package/README.md +2 -2
- package/RtlProvider/index.d.ts +1 -4
- package/Stack/Stack.d.ts +2 -2
- package/Stack/StackProps.d.ts +44 -44
- package/Stack/createStack.d.ts +17 -14
- package/Stack/createStack.js +1 -0
- package/Stack/index.d.ts +5 -5
- package/Stack/stackClasses.d.ts +3 -3
- package/ThemeProvider/ThemeProvider.d.ts +1 -4
- package/ThemeProvider/index.d.ts +2 -2
- package/borders/borders.d.ts +2 -3
- package/borders/index.d.ts +2 -2
- package/breakpoints/breakpoints.d.ts +7 -19
- package/breakpoints/index.d.ts +2 -2
- package/colorManipulator/colorManipulator.d.ts +2 -7
- package/colorManipulator/index.d.ts +1 -1
- package/compose/compose.d.ts +2 -5
- package/compose/index.d.ts +1 -1
- package/createBox/createBox.d.ts +4 -8
- package/createBox/index.d.ts +1 -1
- package/createBreakpoints/createBreakpoints.d.ts +3 -10
- package/createBreakpoints/index.d.ts +1 -1
- package/createStyled/createStyled.d.ts +5 -17
- package/createStyled/index.d.ts +2 -2
- package/createTheme/applyStyles.d.ts +2 -2
- package/createTheme/createSpacing.d.ts +6 -6
- package/createTheme/createTheme.d.ts +11 -18
- package/createTheme/index.d.ts +4 -4
- package/createTheme/shape.d.ts +1 -4
- package/cssContainerQueries/cssContainerQueries.d.ts +9 -9
- package/cssContainerQueries/index.d.ts +3 -3
- package/cssGrid/cssGrid.d.ts +2 -3
- package/cssGrid/index.d.ts +2 -2
- package/cssVars/createCssVarsProvider.d.ts +89 -107
- package/cssVars/createCssVarsTheme.d.ts +12 -9
- package/cssVars/createGetCssVar.d.ts +1 -1
- package/cssVars/cssVarsParser.d.ts +7 -7
- package/cssVars/getColorSchemeSelector.d.ts +1 -1
- package/cssVars/index.d.ts +7 -7
- package/cssVars/prepareCssVars.d.ts +11 -11
- package/cssVars/prepareTypographyVars.d.ts +3 -7
- package/cssVars/useCurrentColorScheme.d.ts +43 -43
- package/display/display.d.ts +2 -3
- package/display/index.d.ts +2 -2
- package/esm/Box/Box.d.ts +72 -0
- package/esm/Box/boxClasses.d.ts +7 -0
- package/esm/Box/index.d.ts +4 -0
- package/esm/CSSProperties.d.ts +7 -0
- package/esm/Container/Container.d.ts +13 -0
- package/esm/Container/ContainerProps.d.ts +40 -0
- package/esm/Container/containerClasses.d.ts +22 -0
- package/esm/Container/createContainer.d.ts +18 -0
- package/esm/Container/createContainer.js +2 -0
- package/esm/Container/index.d.ts +4 -0
- package/esm/DefaultPropsProvider/DefaultPropsProvider.d.ts +18 -0
- package/esm/DefaultPropsProvider/index.d.ts +1 -0
- package/esm/GlobalStyles/GlobalStyles.d.ts +17 -0
- package/esm/GlobalStyles/index.d.ts +2 -0
- package/esm/Grid/Grid.d.ts +13 -0
- package/esm/Grid/GridProps.d.ts +103 -0
- package/esm/Grid/createGrid.d.ts +13 -0
- package/esm/Grid/createGrid.js +2 -0
- package/esm/Grid/gridClasses.d.ts +20 -0
- package/esm/Grid/gridGenerator.d.ts +42 -0
- package/esm/Grid/index.d.ts +7 -0
- package/esm/Grid/traverseBreakpoints.d.ts +7 -0
- package/esm/InitColorSchemeScript/InitColorSchemeScript.d.ts +51 -0
- package/esm/InitColorSchemeScript/index.d.ts +2 -0
- package/esm/RtlProvider/index.d.ts +8 -0
- package/esm/Stack/Stack.d.ts +14 -0
- package/esm/Stack/StackProps.d.ts +53 -0
- package/esm/Stack/createStack.d.ts +24 -0
- package/esm/Stack/createStack.js +2 -0
- package/esm/Stack/index.d.ts +5 -0
- package/esm/Stack/stackClasses.d.ts +8 -0
- package/esm/ThemeProvider/ThemeProvider.d.ts +24 -0
- package/esm/ThemeProvider/index.d.ts +2 -0
- package/esm/borders/borders.d.ts +13 -0
- package/esm/borders/index.d.ts +2 -0
- package/esm/breakpoints/breakpoints.d.ts +19 -0
- package/esm/breakpoints/index.d.ts +2 -0
- package/esm/colorManipulator/colorManipulator.d.ts +25 -0
- package/esm/colorManipulator/index.d.ts +1 -0
- package/esm/compose/compose.d.ts +2 -0
- package/esm/compose/index.d.ts +1 -0
- package/esm/createBox/createBox.d.ts +9 -0
- package/esm/createBox/index.d.ts +1 -0
- package/esm/createBreakpoints/createBreakpoints.d.ts +78 -0
- package/esm/createBreakpoints/index.d.ts +3 -0
- package/esm/createStyled/createStyled.d.ts +27 -0
- package/esm/createStyled/index.d.ts +2 -0
- package/esm/createTheme/applyStyles.d.ts +67 -0
- package/esm/createTheme/createSpacing.d.ts +10 -0
- package/esm/createTheme/createTheme.d.ts +54 -0
- package/esm/createTheme/index.d.ts +4 -0
- package/esm/createTheme/shape.d.ts +6 -0
- package/esm/cssContainerQueries/cssContainerQueries.d.ts +23 -0
- package/esm/cssContainerQueries/index.d.ts +3 -0
- package/esm/cssGrid/cssGrid.d.ts +2 -0
- package/esm/cssGrid/index.d.ts +2 -0
- package/esm/cssVars/createCssVarsProvider.d.ts +129 -0
- package/esm/cssVars/createCssVarsTheme.d.ts +15 -0
- package/esm/cssVars/createGetCssVar.d.ts +5 -0
- package/esm/cssVars/cssVarsParser.d.ts +64 -0
- package/esm/cssVars/getColorSchemeSelector.d.ts +1 -0
- package/esm/cssVars/index.d.ts +7 -0
- package/esm/cssVars/prepareCssVars.d.ts +16 -0
- package/esm/cssVars/prepareTypographyVars.d.ts +4 -0
- package/esm/cssVars/useCurrentColorScheme.d.ts +54 -0
- package/esm/display/display.d.ts +2 -0
- package/esm/display/index.d.ts +2 -0
- package/esm/flexbox/flexbox.d.ts +2 -0
- package/esm/flexbox/index.d.ts +2 -0
- package/esm/getThemeValue/getThemeValue.d.ts +1 -0
- package/esm/getThemeValue/index.d.ts +2 -0
- package/esm/index.d.ts +79 -0
- package/esm/index.js +7 -0
- package/esm/memoTheme.d.ts +12 -0
- package/esm/memoize/index.d.ts +1 -0
- package/esm/memoize/memoize.d.ts +1 -0
- package/esm/merge/index.d.ts +1 -0
- package/esm/merge/merge.d.ts +1 -0
- package/esm/package.json +1 -0
- package/esm/palette/index.d.ts +2 -0
- package/esm/palette/palette.d.ts +4 -0
- package/esm/positions/index.d.ts +2 -0
- package/esm/positions/positions.d.ts +2 -0
- package/esm/preprocessStyles.d.ts +5 -0
- package/esm/propsToClassKey/index.d.ts +1 -0
- package/esm/propsToClassKey/propsToClassKey.d.ts +1 -0
- package/esm/responsivePropType/index.d.ts +1 -0
- package/esm/responsivePropType/responsivePropType.d.ts +2 -0
- package/esm/shadows/index.d.ts +1 -0
- package/esm/shadows/shadows.d.ts +2 -0
- package/esm/sizing/index.d.ts +2 -0
- package/esm/sizing/sizing.d.ts +11 -0
- package/esm/spacing/index.d.ts +2 -0
- package/esm/spacing/spacing.d.ts +18 -0
- package/esm/style/index.d.ts +2 -0
- package/esm/style/style.d.ts +19 -0
- package/esm/styleFunctionSx/AliasesCSSProperties.d.ts +269 -0
- package/esm/styleFunctionSx/OverwriteCSSProperties.d.ts +54 -0
- package/esm/styleFunctionSx/StandardCssProperties.d.ts +2 -0
- package/esm/styleFunctionSx/defaultSxConfig.d.ts +15 -0
- package/esm/styleFunctionSx/extendSxProp.d.ts +4 -0
- package/esm/styleFunctionSx/index.d.ts +9 -0
- package/esm/styleFunctionSx/styleFunctionSx.d.ts +62 -0
- package/esm/styled/index.d.ts +1 -0
- package/esm/styled/styled.d.ts +3 -0
- package/esm/typography/index.d.ts +2 -0
- package/esm/typography/typography.d.ts +11 -0
- package/esm/useMediaQuery/index.d.ts +2 -0
- package/esm/useMediaQuery/useMediaQuery.d.ts +32 -0
- package/esm/useTheme/index.d.ts +2 -0
- package/esm/useTheme/useTheme.d.ts +2 -0
- package/esm/useThemeProps/getThemeProps.d.ts +16 -0
- package/esm/useThemeProps/index.d.ts +3 -0
- package/esm/useThemeProps/useThemeProps.d.ts +14 -0
- package/esm/useThemeWithoutDefault/index.d.ts +1 -0
- package/esm/useThemeWithoutDefault/useThemeWithoutDefault.d.ts +1 -0
- package/esm/version/index.d.ts +6 -0
- package/esm/version/index.js +2 -2
- package/flexbox/flexbox.d.ts +2 -3
- package/flexbox/index.d.ts +2 -2
- package/getThemeValue/getThemeValue.d.ts +1 -1
- package/getThemeValue/index.d.ts +2 -2
- package/index.d.ts +66 -115
- package/index.js +1 -1
- package/memoTheme.d.ts +3 -3
- package/memoize/index.d.ts +1 -1
- package/memoize/memoize.d.ts +1 -3
- package/merge/index.d.ts +1 -1
- package/merge/merge.d.ts +1 -1
- package/modern/Box/Box.d.ts +72 -0
- package/modern/Box/boxClasses.d.ts +7 -0
- package/modern/Box/index.d.ts +4 -0
- package/modern/CSSProperties.d.ts +7 -0
- package/modern/Container/Container.d.ts +13 -0
- package/modern/Container/ContainerProps.d.ts +40 -0
- package/modern/Container/containerClasses.d.ts +22 -0
- package/modern/Container/createContainer.d.ts +18 -0
- package/modern/Container/createContainer.js +2 -0
- package/modern/Container/index.d.ts +4 -0
- package/modern/DefaultPropsProvider/DefaultPropsProvider.d.ts +18 -0
- package/modern/DefaultPropsProvider/index.d.ts +1 -0
- package/modern/GlobalStyles/GlobalStyles.d.ts +17 -0
- package/modern/GlobalStyles/index.d.ts +2 -0
- package/modern/Grid/Grid.d.ts +13 -0
- package/modern/Grid/GridProps.d.ts +103 -0
- package/modern/Grid/createGrid.d.ts +13 -0
- package/modern/Grid/createGrid.js +2 -0
- package/modern/Grid/gridClasses.d.ts +20 -0
- package/modern/Grid/gridGenerator.d.ts +42 -0
- package/modern/Grid/index.d.ts +7 -0
- package/modern/Grid/traverseBreakpoints.d.ts +7 -0
- package/modern/InitColorSchemeScript/InitColorSchemeScript.d.ts +51 -0
- package/modern/InitColorSchemeScript/index.d.ts +2 -0
- package/modern/RtlProvider/index.d.ts +8 -0
- package/modern/Stack/Stack.d.ts +14 -0
- package/modern/Stack/StackProps.d.ts +53 -0
- package/modern/Stack/createStack.d.ts +24 -0
- package/modern/Stack/createStack.js +2 -0
- package/modern/Stack/index.d.ts +5 -0
- package/modern/Stack/stackClasses.d.ts +8 -0
- package/modern/ThemeProvider/ThemeProvider.d.ts +24 -0
- package/modern/ThemeProvider/index.d.ts +2 -0
- package/modern/borders/borders.d.ts +13 -0
- package/modern/borders/index.d.ts +2 -0
- package/modern/breakpoints/breakpoints.d.ts +19 -0
- package/modern/breakpoints/index.d.ts +2 -0
- package/modern/colorManipulator/colorManipulator.d.ts +25 -0
- package/modern/colorManipulator/index.d.ts +1 -0
- package/modern/compose/compose.d.ts +2 -0
- package/modern/compose/index.d.ts +1 -0
- package/modern/createBox/createBox.d.ts +9 -0
- package/modern/createBox/index.d.ts +1 -0
- package/modern/createBreakpoints/createBreakpoints.d.ts +78 -0
- package/modern/createBreakpoints/index.d.ts +3 -0
- package/modern/createStyled/createStyled.d.ts +27 -0
- package/modern/createStyled/index.d.ts +2 -0
- package/modern/createTheme/applyStyles.d.ts +67 -0
- package/modern/createTheme/createSpacing.d.ts +10 -0
- package/modern/createTheme/createTheme.d.ts +54 -0
- package/modern/createTheme/index.d.ts +4 -0
- package/modern/createTheme/shape.d.ts +6 -0
- package/modern/cssContainerQueries/cssContainerQueries.d.ts +23 -0
- package/modern/cssContainerQueries/index.d.ts +3 -0
- package/modern/cssGrid/cssGrid.d.ts +2 -0
- package/modern/cssGrid/index.d.ts +2 -0
- package/modern/cssVars/createCssVarsProvider.d.ts +129 -0
- package/modern/cssVars/createCssVarsTheme.d.ts +15 -0
- package/modern/cssVars/createGetCssVar.d.ts +5 -0
- package/modern/cssVars/cssVarsParser.d.ts +64 -0
- package/modern/cssVars/getColorSchemeSelector.d.ts +1 -0
- package/modern/cssVars/index.d.ts +7 -0
- package/modern/cssVars/prepareCssVars.d.ts +16 -0
- package/modern/cssVars/prepareTypographyVars.d.ts +4 -0
- package/modern/cssVars/useCurrentColorScheme.d.ts +54 -0
- package/modern/display/display.d.ts +2 -0
- package/modern/display/index.d.ts +2 -0
- package/modern/flexbox/flexbox.d.ts +2 -0
- package/modern/flexbox/index.d.ts +2 -0
- package/modern/getThemeValue/getThemeValue.d.ts +1 -0
- package/modern/getThemeValue/index.d.ts +2 -0
- package/modern/index.d.ts +79 -0
- package/modern/index.js +1 -1
- package/modern/memoTheme.d.ts +12 -0
- package/modern/memoize/index.d.ts +1 -0
- package/modern/memoize/memoize.d.ts +1 -0
- package/modern/merge/index.d.ts +1 -0
- package/modern/merge/merge.d.ts +1 -0
- package/modern/package.json +1 -0
- package/modern/palette/index.d.ts +2 -0
- package/modern/palette/palette.d.ts +4 -0
- package/modern/positions/index.d.ts +2 -0
- package/modern/positions/positions.d.ts +2 -0
- package/modern/preprocessStyles.d.ts +5 -0
- package/modern/propsToClassKey/index.d.ts +1 -0
- package/modern/propsToClassKey/propsToClassKey.d.ts +1 -0
- package/modern/responsivePropType/index.d.ts +1 -0
- package/modern/responsivePropType/responsivePropType.d.ts +2 -0
- package/modern/shadows/index.d.ts +1 -0
- package/modern/shadows/shadows.d.ts +2 -0
- package/modern/sizing/index.d.ts +2 -0
- package/modern/sizing/sizing.d.ts +11 -0
- package/modern/spacing/index.d.ts +2 -0
- package/modern/spacing/spacing.d.ts +18 -0
- package/modern/style/index.d.ts +2 -0
- package/modern/style/style.d.ts +19 -0
- package/modern/styleFunctionSx/AliasesCSSProperties.d.ts +269 -0
- package/modern/styleFunctionSx/OverwriteCSSProperties.d.ts +54 -0
- package/modern/styleFunctionSx/StandardCssProperties.d.ts +2 -0
- package/modern/styleFunctionSx/defaultSxConfig.d.ts +15 -0
- package/modern/styleFunctionSx/extendSxProp.d.ts +4 -0
- package/modern/styleFunctionSx/index.d.ts +9 -0
- package/modern/styleFunctionSx/styleFunctionSx.d.ts +62 -0
- package/modern/styled/index.d.ts +1 -0
- package/modern/styled/styled.d.ts +3 -0
- package/modern/typography/index.d.ts +2 -0
- package/modern/typography/typography.d.ts +11 -0
- package/modern/useMediaQuery/index.d.ts +2 -0
- package/modern/useMediaQuery/useMediaQuery.d.ts +32 -0
- package/modern/useTheme/index.d.ts +2 -0
- package/modern/useTheme/useTheme.d.ts +2 -0
- package/modern/useThemeProps/getThemeProps.d.ts +16 -0
- package/modern/useThemeProps/index.d.ts +3 -0
- package/modern/useThemeProps/useThemeProps.d.ts +14 -0
- package/modern/useThemeWithoutDefault/index.d.ts +1 -0
- package/modern/useThemeWithoutDefault/useThemeWithoutDefault.d.ts +1 -0
- package/modern/version/index.d.ts +6 -0
- package/modern/version/index.js +2 -2
- package/package.json +38 -6
- package/palette/index.d.ts +2 -2
- package/palette/palette.d.ts +2 -3
- package/positions/index.d.ts +2 -2
- package/positions/positions.d.ts +2 -3
- package/preprocessStyles.d.ts +4 -4
- package/propsToClassKey/index.d.ts +1 -1
- package/propsToClassKey/propsToClassKey.d.ts +1 -1
- package/responsivePropType/index.d.ts +1 -1
- package/responsivePropType/responsivePropType.d.ts +1 -2
- package/shadows/index.d.ts +1 -1
- package/shadows/shadows.d.ts +2 -3
- package/sizing/index.d.ts +2 -2
- package/sizing/sizing.d.ts +2 -3
- package/spacing/index.d.ts +2 -2
- package/spacing/spacing.d.ts +15 -78
- package/style/index.d.ts +2 -2
- package/style/style.d.ts +8 -16
- package/styleFunctionSx/AliasesCSSProperties.d.ts +268 -268
- package/styleFunctionSx/OverwriteCSSProperties.d.ts +52 -52
- package/styleFunctionSx/StandardCssProperties.d.ts +1 -1
- package/styleFunctionSx/defaultSxConfig.d.ts +3 -8
- package/styleFunctionSx/extendSxProp.d.ts +4 -3
- package/styleFunctionSx/index.d.ts +9 -13
- package/styleFunctionSx/styleFunctionSx.d.ts +14 -41
- package/styled/index.d.ts +1 -1
- package/styled/styled.d.ts +2 -4
- package/tsconfig.build.tsbuildinfo +1 -0
- package/typography/index.d.ts +2 -2
- package/typography/typography.d.ts +2 -3
- package/useMediaQuery/index.d.ts +2 -2
- package/useMediaQuery/useMediaQuery.d.ts +27 -27
- package/useTheme/index.d.ts +2 -2
- package/useTheme/useTheme.d.ts +2 -3
- package/useThemeProps/getThemeProps.d.ts +8 -9
- package/useThemeProps/index.d.ts +3 -4
- package/useThemeProps/useThemeProps.d.ts +6 -12
- package/useThemeWithoutDefault/index.d.ts +1 -1
- package/useThemeWithoutDefault/useThemeWithoutDefault.d.ts +1 -1
- package/version/index.d.ts +1 -1
- package/version/index.js +2 -2
- package/Box/package.json +0 -6
- package/Container/package.json +0 -6
- package/DefaultPropsProvider/package.json +0 -6
- package/GlobalStyles/package.json +0 -6
- package/Grid/package.json +0 -6
- package/InitColorSchemeScript/package.json +0 -6
- package/RtlProvider/package.json +0 -6
- package/Stack/package.json +0 -6
- package/ThemeProvider/package.json +0 -6
- package/borders/package.json +0 -6
- package/breakpoints/package.json +0 -6
- package/colorManipulator/package.json +0 -6
- package/compose/package.json +0 -6
- package/createBox/package.json +0 -6
- package/createBreakpoints/package.json +0 -6
- package/createStyled/package.json +0 -6
- package/createTheme/package.json +0 -6
- package/cssContainerQueries/package.json +0 -6
- package/cssGrid/package.json +0 -6
- package/cssVars/package.json +0 -6
- package/display/package.json +0 -6
- package/flexbox/package.json +0 -6
- package/getThemeValue/package.json +0 -6
- package/memoize/package.json +0 -6
- package/merge/package.json +0 -6
- package/palette/package.json +0 -6
- package/positions/package.json +0 -6
- package/propsToClassKey/package.json +0 -6
- package/responsivePropType/package.json +0 -6
- package/shadows/package.json +0 -6
- package/sizing/package.json +0 -6
- package/spacing/package.json +0 -6
- package/style/package.json +0 -6
- package/styleFunctionSx/package.json +0 -6
- package/styled/package.json +0 -6
- package/typography/package.json +0 -6
- package/useMediaQuery/package.json +0 -6
- package/useTheme/package.json +0 -6
- package/useThemeProps/package.json +0 -6
- package/useThemeWithoutDefault/package.json +0 -6
- package/version/package.json +0 -6
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { OverridableStringUnion } from '@mui/types';
|
|
2
|
+
export interface BreakpointOverrides {}
|
|
3
|
+
export type Breakpoint = OverridableStringUnion<'xs' | 'sm' | 'md' | 'lg' | 'xl', BreakpointOverrides>;
|
|
4
|
+
export const keys: Breakpoint[];
|
|
5
|
+
|
|
6
|
+
// Keep in sync with docs/src/pages/customization/breakpoints/breakpoints.md
|
|
7
|
+
// #host-reference
|
|
8
|
+
export interface Breakpoints {
|
|
9
|
+
keys: Breakpoint[];
|
|
10
|
+
/**
|
|
11
|
+
* Each breakpoint (a key) matches with a fixed screen width (a value).
|
|
12
|
+
* @default {
|
|
13
|
+
* // extra-small
|
|
14
|
+
* xs: 0,
|
|
15
|
+
* // small
|
|
16
|
+
* sm: 600,
|
|
17
|
+
* // medium
|
|
18
|
+
* md: 900,
|
|
19
|
+
* // large
|
|
20
|
+
* lg: 1200,
|
|
21
|
+
* // extra-large
|
|
22
|
+
* xl: 1536,
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
25
|
+
values: { [key in Breakpoint]: number };
|
|
26
|
+
/**
|
|
27
|
+
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
28
|
+
* @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key (inclusive).
|
|
29
|
+
* @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-up-key-media-query)
|
|
30
|
+
*/
|
|
31
|
+
up: (key: Breakpoint | number) => string;
|
|
32
|
+
/**
|
|
33
|
+
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
34
|
+
* @returns A media query string ready to be used with most styling solutions, which matches screen widths less than the screen size given by the breakpoint key (exclusive).
|
|
35
|
+
* @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-down-key-media-query)
|
|
36
|
+
*/
|
|
37
|
+
down: (key: Breakpoint | number) => string;
|
|
38
|
+
/**
|
|
39
|
+
* @param start - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
40
|
+
* @param end - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
41
|
+
* @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than
|
|
42
|
+
* the screen size given by the breakpoint key in the first argument (inclusive) and less than the screen size given by the breakpoint key in the second argument (exclusive).
|
|
43
|
+
* @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-between-start-end-media-query)
|
|
44
|
+
*/
|
|
45
|
+
between: (start: Breakpoint | number, end: Breakpoint | number) => string;
|
|
46
|
+
/**
|
|
47
|
+
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
48
|
+
* @returns A media query string ready to be used with most styling solutions, which matches screen widths starting from
|
|
49
|
+
* the screen size given by the breakpoint key (inclusive) and stopping at the screen size given by the next breakpoint key (exclusive).
|
|
50
|
+
* @see [API documentation](https://next.mui.com/material-ui/customization/breakpoints/#theme-breakpoints-only-key-media-query)
|
|
51
|
+
*/
|
|
52
|
+
only: (key: Breakpoint) => string;
|
|
53
|
+
/**
|
|
54
|
+
* @param key - A breakpoint key (`xs`, `sm`, etc.).
|
|
55
|
+
* @returns A media query string ready to be used with most styling solutions, which matches screen widths stopping at
|
|
56
|
+
* the screen size given by the breakpoint key (exclusive) and starting at the screen size given by the next breakpoint key (inclusive).
|
|
57
|
+
*/
|
|
58
|
+
not: (key: Breakpoint) => string;
|
|
59
|
+
/**
|
|
60
|
+
* The unit used for the breakpoint's values.
|
|
61
|
+
* @default 'px'
|
|
62
|
+
*/
|
|
63
|
+
unit?: string | undefined;
|
|
64
|
+
}
|
|
65
|
+
export interface BreakpointsOptions extends Partial<Breakpoints> {
|
|
66
|
+
/**
|
|
67
|
+
* The increment divided by 100 used to implement exclusive breakpoints.
|
|
68
|
+
* For example, `step: 5` means that `down(500)` will result in `'(max-width: 499.95px)'`.
|
|
69
|
+
* @default 5
|
|
70
|
+
*/
|
|
71
|
+
step?: number | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The unit used for the breakpoint's values.
|
|
74
|
+
* @default 'px'
|
|
75
|
+
*/
|
|
76
|
+
unit?: string | undefined;
|
|
77
|
+
}
|
|
78
|
+
export default function createBreakpoints(options: BreakpointsOptions): Breakpoints;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CreateMUIStyled as CreateMUIStyledStyledEngine, CSSInterpolation } from '@mui/styled-engine';
|
|
3
|
+
import styleFunctionSx, { SxProps } from "../styleFunctionSx/index.js";
|
|
4
|
+
import { Theme as DefaultTheme } from "../createTheme/index.js";
|
|
5
|
+
export function shouldForwardProp(propName: PropertyKey): boolean;
|
|
6
|
+
export interface MUIStyledCommonProps<Theme extends object = DefaultTheme> {
|
|
7
|
+
theme?: Theme;
|
|
8
|
+
as?: React.ElementType;
|
|
9
|
+
sx?: SxProps<Theme>;
|
|
10
|
+
}
|
|
11
|
+
export interface MuiStyledOptions {
|
|
12
|
+
name?: string;
|
|
13
|
+
slot?: string;
|
|
14
|
+
// The difference between Interpolation and CSSInterpolation is that the former supports functions based on props
|
|
15
|
+
// If we want to support props in the overrides, we will need to change the CSSInterpolation to Interpolation<Props>
|
|
16
|
+
overridesResolver?: (props: any, styles: Record<string, CSSInterpolation>) => CSSInterpolation;
|
|
17
|
+
skipVariantsResolver?: boolean;
|
|
18
|
+
skipSx?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type CreateMUIStyled<Theme extends object = DefaultTheme> = CreateMUIStyledStyledEngine<MUIStyledCommonProps<Theme>, MuiStyledOptions, Theme>;
|
|
21
|
+
export default function createStyled<Theme extends object = DefaultTheme>(options?: {
|
|
22
|
+
themeId?: string;
|
|
23
|
+
defaultTheme?: Theme;
|
|
24
|
+
rootShouldForwardProp?: (prop: PropertyKey) => boolean;
|
|
25
|
+
slotShouldForwardProp?: (prop: PropertyKey) => boolean;
|
|
26
|
+
styleFunctionSx?: typeof styleFunctionSx;
|
|
27
|
+
}): CreateMUIStyled<Theme>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CSSObject } from '@mui/styled-engine';
|
|
2
|
+
export interface ApplyStyles<K extends string> {
|
|
3
|
+
(key: K, styles: CSSObject): CSSObject;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A universal utility to style components with multiple color modes. Always use it from the theme object.
|
|
7
|
+
* It works with:
|
|
8
|
+
* - [Basic theme](https://mui.com/material-ui/customization/dark-mode/)
|
|
9
|
+
* - [CSS theme variables](https://mui.com/material-ui/customization/css-theme-variables/overview/)
|
|
10
|
+
* - Zero-runtime engine
|
|
11
|
+
*
|
|
12
|
+
* Tips: Use an array over object spread and place `theme.applyStyles()` last.
|
|
13
|
+
*
|
|
14
|
+
* With the styled function:
|
|
15
|
+
* ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
|
|
16
|
+
* 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })}
|
|
17
|
+
*
|
|
18
|
+
* With the sx prop:
|
|
19
|
+
* ✅ [{ background: '#e5e5e5' }, theme => theme.applyStyles('dark', { background: '#1c1c1c' })]
|
|
20
|
+
* 🚫 { background: '#e5e5e5', ...theme => theme.applyStyles('dark', { background: '#1c1c1c' })}
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* 1. using with `styled`:
|
|
24
|
+
* ```jsx
|
|
25
|
+
* const Component = styled('div')(({ theme }) => [
|
|
26
|
+
* { background: '#e5e5e5' },
|
|
27
|
+
* theme.applyStyles('dark', {
|
|
28
|
+
* background: '#1c1c1c',
|
|
29
|
+
* color: '#fff',
|
|
30
|
+
* }),
|
|
31
|
+
* ]);
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* 2. using with `sx` prop:
|
|
36
|
+
* ```jsx
|
|
37
|
+
* <Box sx={[
|
|
38
|
+
* { background: '#e5e5e5' },
|
|
39
|
+
* theme => theme.applyStyles('dark', {
|
|
40
|
+
* background: '#1c1c1c',
|
|
41
|
+
* color: '#fff',
|
|
42
|
+
* }),
|
|
43
|
+
* ]}
|
|
44
|
+
* />
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* 3. theming a component:
|
|
49
|
+
* ```jsx
|
|
50
|
+
* extendTheme({
|
|
51
|
+
* components: {
|
|
52
|
+
* MuiButton: {
|
|
53
|
+
* styleOverrides: {
|
|
54
|
+
* root: ({ theme }) => [
|
|
55
|
+
* { background: '#e5e5e5' },
|
|
56
|
+
* theme.applyStyles('dark', {
|
|
57
|
+
* background: '#1c1c1c',
|
|
58
|
+
* color: '#fff',
|
|
59
|
+
* }),
|
|
60
|
+
* ],
|
|
61
|
+
* },
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* })
|
|
65
|
+
*```
|
|
66
|
+
*/
|
|
67
|
+
export default function applyStyles<K extends string>(key: K, styles: CSSObject): CSSObject;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type SpacingOptions = number | string | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
|
|
2
|
+
export type SpacingArgument = number | string;
|
|
3
|
+
export interface Spacing {
|
|
4
|
+
(): string;
|
|
5
|
+
(value: SpacingArgument): string;
|
|
6
|
+
(topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
|
|
7
|
+
(top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
|
|
8
|
+
(top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
|
|
9
|
+
}
|
|
10
|
+
export default function createSpacing(spacingInput?: SpacingOptions, transform?: Spacing | (() => undefined) | ((abs: number | string) => number | number)): Spacing;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CSSObject } from '@mui/styled-engine';
|
|
2
|
+
import { Breakpoints, BreakpointsOptions } from "../createBreakpoints/createBreakpoints.js";
|
|
3
|
+
import { Shape, ShapeOptions } from "./shape.js";
|
|
4
|
+
import { Spacing, SpacingOptions } from "./createSpacing.js";
|
|
5
|
+
import { SxConfig, SxProps } from "../styleFunctionSx/index.js";
|
|
6
|
+
import { ApplyStyles } from "./applyStyles.js";
|
|
7
|
+
import { CssContainerQueries } from "../cssContainerQueries/index.js";
|
|
8
|
+
export { Breakpoint, Breakpoints, BreakpointOverrides } from "../createBreakpoints/createBreakpoints.js";
|
|
9
|
+
export type Direction = 'ltr' | 'rtl';
|
|
10
|
+
export interface Typography {}
|
|
11
|
+
export interface Mixins {}
|
|
12
|
+
export interface Shadows {}
|
|
13
|
+
export interface Transitions {}
|
|
14
|
+
export interface ZIndex {}
|
|
15
|
+
export interface ThemeOptions {
|
|
16
|
+
shape?: ShapeOptions;
|
|
17
|
+
breakpoints?: BreakpointsOptions;
|
|
18
|
+
direction?: Direction;
|
|
19
|
+
mixins?: Mixins;
|
|
20
|
+
palette?: Record<string, any>;
|
|
21
|
+
shadows?: Shadows;
|
|
22
|
+
spacing?: SpacingOptions;
|
|
23
|
+
transitions?: Transitions;
|
|
24
|
+
components?: Record<string, any>;
|
|
25
|
+
typography?: Typography;
|
|
26
|
+
zIndex?: ZIndex;
|
|
27
|
+
unstable_sxConfig?: SxConfig;
|
|
28
|
+
}
|
|
29
|
+
export interface Theme extends CssContainerQueries {
|
|
30
|
+
shape: Shape;
|
|
31
|
+
breakpoints: Breakpoints;
|
|
32
|
+
direction: Direction;
|
|
33
|
+
palette: Record<string, any> & {
|
|
34
|
+
mode: 'light' | 'dark';
|
|
35
|
+
};
|
|
36
|
+
shadows?: Shadows;
|
|
37
|
+
spacing: Spacing;
|
|
38
|
+
transitions?: Transitions;
|
|
39
|
+
components?: Record<string, any>;
|
|
40
|
+
mixins?: Mixins;
|
|
41
|
+
typography?: Typography;
|
|
42
|
+
zIndex?: ZIndex;
|
|
43
|
+
applyStyles: ApplyStyles<'light' | 'dark'>;
|
|
44
|
+
unstable_sxConfig: SxConfig;
|
|
45
|
+
unstable_sx: (props: SxProps<Theme>) => CSSObject;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Generate a theme base on the options received.
|
|
50
|
+
* @param options Takes an incomplete theme object and adds the missing parts.
|
|
51
|
+
* @param args Deep merge the arguments with the about to be returned theme.
|
|
52
|
+
* @returns A complete, ready-to-use theme object.
|
|
53
|
+
*/
|
|
54
|
+
export default function createTheme(options?: ThemeOptions, ...args: object[]): Theme;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Breakpoints } from "../createBreakpoints/createBreakpoints.js";
|
|
2
|
+
export interface ContainerQueries {
|
|
3
|
+
up: Breakpoints['up'];
|
|
4
|
+
down: Breakpoints['down'];
|
|
5
|
+
between: Breakpoints['between'];
|
|
6
|
+
only: Breakpoints['only'];
|
|
7
|
+
not: Breakpoints['not'];
|
|
8
|
+
}
|
|
9
|
+
export interface CssContainerQueries {
|
|
10
|
+
containerQueries: ((name: string) => ContainerQueries) & ContainerQueries;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* For using in `sx` prop to sort the breakpoint from low to high.
|
|
14
|
+
* Note: this function does not work and will not support multiple units.
|
|
15
|
+
* e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
|
|
16
|
+
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 eventhough 40rem > 300px
|
|
17
|
+
*/
|
|
18
|
+
export declare function sortContainerQueries(theme: Partial<CssContainerQueries>, css: Record<string, any>): Record<string, any>;
|
|
19
|
+
export declare function isCqShorthand(breakpointKeys: string[], value: string): boolean;
|
|
20
|
+
export declare function getContainerQuery(theme: CssContainerQueries, shorthand: string): string | null;
|
|
21
|
+
export default function cssContainerQueries<T extends {
|
|
22
|
+
breakpoints: Breakpoints;
|
|
23
|
+
}>(themeInput: T): T & CssContainerQueries;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import InitColorSchemeScript from "../InitColorSchemeScript/index.js";
|
|
3
|
+
import { Result } from "./useCurrentColorScheme.js";
|
|
4
|
+
export interface ColorSchemeContextValue<SupportedColorScheme extends string> extends Result<SupportedColorScheme> {
|
|
5
|
+
allColorSchemes: SupportedColorScheme[];
|
|
6
|
+
}
|
|
7
|
+
export interface CssVarsProviderConfig<ColorScheme extends string> {
|
|
8
|
+
/**
|
|
9
|
+
* DOM attribute for applying color scheme
|
|
10
|
+
* @default 'data-color-scheme'
|
|
11
|
+
*/
|
|
12
|
+
attribute?: string;
|
|
13
|
+
/**
|
|
14
|
+
* localStorage key used to store application `mode`
|
|
15
|
+
* @default 'mode'
|
|
16
|
+
*/
|
|
17
|
+
modeStorageKey?: string;
|
|
18
|
+
/**
|
|
19
|
+
* localStorage key used to store `colorScheme`
|
|
20
|
+
* @default 'color-scheme'
|
|
21
|
+
*/
|
|
22
|
+
colorSchemeStorageKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Design system default color scheme.
|
|
25
|
+
* - provides string if the design system has one default color scheme (either light or dark)
|
|
26
|
+
* - provides object if the design system has default light & dark color schemes
|
|
27
|
+
*/
|
|
28
|
+
defaultColorScheme: ColorScheme | {
|
|
29
|
+
light: ColorScheme;
|
|
30
|
+
dark: ColorScheme;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Disable CSS transitions when switching between modes or color schemes
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
disableTransitionOnChange?: boolean;
|
|
37
|
+
}
|
|
38
|
+
type Identify<I extends string | undefined, T> = I extends string ? T | { [k in I]: T } : T;
|
|
39
|
+
export interface CreateCssVarsProviderResult<ColorScheme extends string, Identifier extends string | undefined = undefined> {
|
|
40
|
+
CssVarsProvider: (props: React.PropsWithChildren<Partial<CssVarsProviderConfig<ColorScheme>> & {
|
|
41
|
+
theme?: Identify<Identifier, {
|
|
42
|
+
cssVariables?: false;
|
|
43
|
+
cssVarPrefix?: string;
|
|
44
|
+
colorSchemes: Partial<Record<ColorScheme, any>>;
|
|
45
|
+
colorSchemeSelector?: 'media' | 'class' | 'data' | string;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* The default mode when the storage is empty,
|
|
49
|
+
* require the theme to have `colorSchemes` with light and dark.
|
|
50
|
+
* @default 'system'
|
|
51
|
+
*/
|
|
52
|
+
defaultMode?: 'light' | 'dark' | 'system';
|
|
53
|
+
/**
|
|
54
|
+
* The document used to perform `disableTransitionOnChange` feature
|
|
55
|
+
* @default document
|
|
56
|
+
*/
|
|
57
|
+
documentNode?: Document | null;
|
|
58
|
+
/**
|
|
59
|
+
* The node used to attach the color-scheme attribute
|
|
60
|
+
* @default document
|
|
61
|
+
*/
|
|
62
|
+
colorSchemeNode?: Element | null;
|
|
63
|
+
/**
|
|
64
|
+
* The window that attaches the 'storage' event listener
|
|
65
|
+
* @default window
|
|
66
|
+
*/
|
|
67
|
+
storageWindow?: Window | null;
|
|
68
|
+
/**
|
|
69
|
+
* If `true`, the provider creates its own context and generate stylesheet as if it is a root `CssVarsProvider`.
|
|
70
|
+
*/
|
|
71
|
+
disableNestedContext?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* If `true`, the style sheet won't be generated.
|
|
74
|
+
*
|
|
75
|
+
* This is useful for controlling nested CssVarsProvider behavior.
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
disableStyleSheetGeneration?: boolean;
|
|
79
|
+
}>) => React.JSX.Element;
|
|
80
|
+
useColorScheme: () => ColorSchemeContextValue<ColorScheme>;
|
|
81
|
+
getInitColorSchemeScript: typeof InitColorSchemeScript;
|
|
82
|
+
}
|
|
83
|
+
export default function createCssVarsProvider<ColorScheme extends string, Identifier extends string | undefined = undefined>(options: CssVarsProviderConfig<ColorScheme> & {
|
|
84
|
+
/**
|
|
85
|
+
* The design system's unique id for getting the corresponded theme when there are multiple design systems.
|
|
86
|
+
*/
|
|
87
|
+
themeId?: Identifier;
|
|
88
|
+
/**
|
|
89
|
+
* Design system default theme
|
|
90
|
+
*
|
|
91
|
+
* - The structure inside `theme.colorSchemes[colorScheme]` should be exactly the same in all color schemes because
|
|
92
|
+
* those object of the color scheme will be used when the color scheme is active.
|
|
93
|
+
*
|
|
94
|
+
* {
|
|
95
|
+
* colorSchemes: {
|
|
96
|
+
* light: { ...lightColorSchemeValues },
|
|
97
|
+
* dark: { ...darkColorSchemeValues }
|
|
98
|
+
* }
|
|
99
|
+
* }
|
|
100
|
+
*
|
|
101
|
+
* - If colorScheme is 'light', the `lightColorSchemeValues` will be merged to theme as `{ ...theme, ...lightColorSchemeValues }`
|
|
102
|
+
* likewise, if colorScheme is 'dark', the `darkColorSchemeValues` will be merged to theme as `{ ...theme, ...darkColorSchemeValues }`
|
|
103
|
+
*
|
|
104
|
+
* - If the theme contains the same keys as the color scheme, their values will be merged.
|
|
105
|
+
* Ex. {
|
|
106
|
+
* colorSchemes: {
|
|
107
|
+
* light: { palette: { primary: { ... } } },
|
|
108
|
+
* dark: { palette: { primary: { ...} } }
|
|
109
|
+
* },
|
|
110
|
+
* palette: { shared: { ... } }
|
|
111
|
+
* }
|
|
112
|
+
*
|
|
113
|
+
* becomes: {
|
|
114
|
+
* colorSchemes: { ... },
|
|
115
|
+
* palette: { shared: { ... }, primary: { ... } }
|
|
116
|
+
* }
|
|
117
|
+
*/
|
|
118
|
+
theme: any;
|
|
119
|
+
/**
|
|
120
|
+
* A function to be called after the CSS variables are attached. The result of this function will be the final theme pass to ThemeProvider.
|
|
121
|
+
*
|
|
122
|
+
* The example usage is the variant generation in Joy. We need to combine the token from user-input and the default theme first, then generate
|
|
123
|
+
* variants from those tokens.
|
|
124
|
+
*/
|
|
125
|
+
resolveTheme?: (theme: any) => any; // the type is any because it depends on the design system.
|
|
126
|
+
}): CreateCssVarsProviderResult<ColorScheme, Identifier>;
|
|
127
|
+
|
|
128
|
+
// disable automatic export
|
|
129
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DefaultCssVarsTheme } from "./prepareCssVars.js";
|
|
2
|
+
interface Theme extends DefaultCssVarsTheme {
|
|
3
|
+
cssVarPrefix?: string;
|
|
4
|
+
colorSchemeSelector?: 'media' | string;
|
|
5
|
+
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function createCssVarsTheme<T extends Theme, ThemeVars extends Record<string, any>>({
|
|
8
|
+
colorSchemeSelector,
|
|
9
|
+
...theme
|
|
10
|
+
}: T): T & {
|
|
11
|
+
vars: ThemeVars;
|
|
12
|
+
generateThemeVars: () => ThemeVars;
|
|
13
|
+
generateStyleSheets: () => Record<string, any>[];
|
|
14
|
+
};
|
|
15
|
+
export default createCssVarsTheme;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
|
|
3
|
+
* and they does not need to remember the prefix (defined once).
|
|
4
|
+
*/
|
|
5
|
+
export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...fallbacks: (T | AdditionalVars)[]) => string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
type NestedRecord<V = any> = {
|
|
2
|
+
[k: string | number]: NestedRecord<V> | V;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* This function create an object from keys, value and then assign to target
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} obj : the target object to be assigned
|
|
8
|
+
* @param {string[]} keys
|
|
9
|
+
* @param {string | number} value
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const source = {}
|
|
13
|
+
* assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
|
|
14
|
+
* console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const source = { palette: { primary: 'var(--palette-primary)' } }
|
|
18
|
+
* assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
|
|
19
|
+
* console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
|
|
20
|
+
*/
|
|
21
|
+
export declare const assignNestedKeys: <T extends Record<string, any> | null | undefined | string = NestedRecord<any>, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => void;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} obj : source object
|
|
25
|
+
* @param {Function} callback : a function that will be called when
|
|
26
|
+
* - the deepest key in source object is reached
|
|
27
|
+
* - the value of the deepest key is NOT `undefined` | `null`
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
|
|
31
|
+
* // ['palette', 'primary', 'main'] '#000000'
|
|
32
|
+
*/
|
|
33
|
+
export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: (keys: Array<string>) => boolean) => void;
|
|
34
|
+
/**
|
|
35
|
+
* a function that parse theme and return { css, vars }
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} theme
|
|
38
|
+
* @param {{
|
|
39
|
+
* prefix?: string,
|
|
40
|
+
* shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
|
|
41
|
+
* }} options.
|
|
42
|
+
* `prefix`: The prefix of the generated CSS variables. This function does not change the value.
|
|
43
|
+
*
|
|
44
|
+
* @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const { css, vars } = parser({
|
|
48
|
+
* fontSize: 12,
|
|
49
|
+
* lineHeight: 1.2,
|
|
50
|
+
* palette: { primary: { 500: 'var(--color)' } }
|
|
51
|
+
* }, { prefix: 'foo' })
|
|
52
|
+
*
|
|
53
|
+
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
|
|
54
|
+
* console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
|
|
55
|
+
*/
|
|
56
|
+
export default function cssVarsParser<T extends Record<string, any>>(theme: Record<string, any>, options?: {
|
|
57
|
+
prefix?: string;
|
|
58
|
+
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
59
|
+
}): {
|
|
60
|
+
css: Record<string, string | number>;
|
|
61
|
+
vars: T;
|
|
62
|
+
varsWithDefaults: {};
|
|
63
|
+
};
|
|
64
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createGetColorSchemeSelector<T extends string>(selector: 'media' | 'class' | 'data' | string): (colorScheme: T) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default } from "./createCssVarsProvider.js";
|
|
2
|
+
export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue } from "./createCssVarsProvider.js";
|
|
3
|
+
export { default as prepareCssVars } from "./prepareCssVars.js";
|
|
4
|
+
export { default as prepareTypographyVars } from "./prepareTypographyVars.js";
|
|
5
|
+
export type { ExtractTypographyTokens } from "./prepareTypographyVars.js";
|
|
6
|
+
export { default as createCssVarsTheme } from "./createCssVarsTheme.js";
|
|
7
|
+
export { createGetColorSchemeSelector } from "./getColorSchemeSelector.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DefaultCssVarsTheme {
|
|
2
|
+
colorSchemes?: Record<string, any>;
|
|
3
|
+
defaultColorScheme?: string;
|
|
4
|
+
}
|
|
5
|
+
declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends Record<string, any>>(theme: T, parserConfig?: {
|
|
6
|
+
prefix?: string;
|
|
7
|
+
colorSchemeSelector?: 'media' | 'class' | 'data' | string;
|
|
8
|
+
disableCssColorScheme?: boolean;
|
|
9
|
+
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
|
|
10
|
+
getSelector?: (colorScheme: keyof T['colorSchemes'] | undefined, css: Record<string, any>) => string | Record<string, any>;
|
|
11
|
+
}): {
|
|
12
|
+
vars: ThemeVars;
|
|
13
|
+
generateThemeVars: () => ThemeVars;
|
|
14
|
+
generateStyleSheets: () => Record<string, any>[];
|
|
15
|
+
};
|
|
16
|
+
export default prepareCssVars;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
type RecordPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : T[K] extends Record<string, any> ? K : never }[keyof T];
|
|
2
|
+
export type ExtractTypographyTokens<T> = { [K in RecordPropertyNames<T>]: string };
|
|
3
|
+
export default function prepareTypographyVars<T extends Record<string, any>>(typography: T): ExtractTypographyTokens<T>;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type Mode = 'light' | 'dark' | 'system';
|
|
2
|
+
export type SystemMode = Exclude<Mode, 'system'>;
|
|
3
|
+
export interface State<SupportedColorScheme extends string> {
|
|
4
|
+
/**
|
|
5
|
+
* User selected mode.
|
|
6
|
+
* Note: on the server, mode is always undefined
|
|
7
|
+
*/
|
|
8
|
+
mode: 'light' | 'dark' | 'system' | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Only valid if `mode: 'system'`, either 'light' | 'dark'.
|
|
11
|
+
*/
|
|
12
|
+
systemMode: 'light' | 'dark' | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The color scheme for the light mode.
|
|
15
|
+
*/
|
|
16
|
+
lightColorScheme: SupportedColorScheme;
|
|
17
|
+
/**
|
|
18
|
+
* The color scheme for the dark mode.
|
|
19
|
+
*/
|
|
20
|
+
darkColorScheme: SupportedColorScheme;
|
|
21
|
+
}
|
|
22
|
+
export type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
|
|
23
|
+
/**
|
|
24
|
+
* The current application color scheme. It is always `undefined` on the server.
|
|
25
|
+
*/
|
|
26
|
+
colorScheme: SupportedColorScheme | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* `mode` is saved to internal state and localStorage
|
|
29
|
+
* If `mode` is null, it will be reset to the defaultMode
|
|
30
|
+
*/
|
|
31
|
+
setMode: (mode: Mode | null) => void;
|
|
32
|
+
/**
|
|
33
|
+
* `colorScheme` is saved to internal state and localStorage
|
|
34
|
+
* If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
|
|
35
|
+
*/
|
|
36
|
+
setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
|
|
37
|
+
light: SupportedColorScheme | null;
|
|
38
|
+
dark: SupportedColorScheme | null;
|
|
39
|
+
}> | null) => void;
|
|
40
|
+
};
|
|
41
|
+
export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
|
|
42
|
+
export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
|
|
43
|
+
interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
|
|
44
|
+
defaultLightColorScheme: SupportedColorScheme;
|
|
45
|
+
defaultDarkColorScheme: SupportedColorScheme;
|
|
46
|
+
supportedColorSchemes: Array<SupportedColorScheme>;
|
|
47
|
+
defaultMode?: Mode;
|
|
48
|
+
modeStorageKey?: string;
|
|
49
|
+
colorSchemeStorageKey?: string;
|
|
50
|
+
storageWindow?: Window | null;
|
|
51
|
+
noSsr?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getThemeValue(prop: string, value: any, theme: object): any;
|