@choco-vanille/theme 0.0.0-stage → 0.1.0-dev.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/LICENSE +21 -0
- package/README.md +216 -2
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2743 -0
- package/dist/index.d.ts +2743 -0
- package/dist/index.js +18 -0
- package/dist/styles.css +2 -0
- package/dist/theme/constants/index.cjs +2 -0
- package/dist/theme/constants/index.cjs.map +1 -0
- package/dist/theme/constants/index.js +9 -0
- package/dist/theme/constants/index.js.map +1 -0
- package/dist/theme/flavors/contrast/constants/index.cjs +2 -0
- package/dist/theme/flavors/contrast/constants/index.cjs.map +1 -0
- package/dist/theme/flavors/contrast/constants/index.js +58 -0
- package/dist/theme/flavors/contrast/constants/index.js.map +1 -0
- package/dist/theme/flavors/contrast/contrastFlavor.const.cjs +2 -0
- package/dist/theme/flavors/contrast/contrastFlavor.const.cjs.map +1 -0
- package/dist/theme/flavors/contrast/contrastFlavor.const.js +149 -0
- package/dist/theme/flavors/contrast/contrastFlavor.const.js.map +1 -0
- package/dist/theme/flavors/contrast/utils/createContrastIntents.utils.cjs +2 -0
- package/dist/theme/flavors/contrast/utils/createContrastIntents.utils.cjs.map +1 -0
- package/dist/theme/flavors/contrast/utils/createContrastIntents.utils.js +20 -0
- package/dist/theme/flavors/contrast/utils/createContrastIntents.utils.js.map +1 -0
- package/dist/theme/flavors/default/constants/index.cjs +2 -0
- package/dist/theme/flavors/default/constants/index.cjs.map +1 -0
- package/dist/theme/flavors/default/constants/index.js +58 -0
- package/dist/theme/flavors/default/constants/index.js.map +1 -0
- package/dist/theme/flavors/default/defaultDarkTheme.const.cjs +2 -0
- package/dist/theme/flavors/default/defaultDarkTheme.const.cjs.map +1 -0
- package/dist/theme/flavors/default/defaultDarkTheme.const.js +93 -0
- package/dist/theme/flavors/default/defaultDarkTheme.const.js.map +1 -0
- package/dist/theme/flavors/default/defaultFlavor.const.cjs +2 -0
- package/dist/theme/flavors/default/defaultFlavor.const.cjs.map +1 -0
- package/dist/theme/flavors/default/defaultFlavor.const.js +12 -0
- package/dist/theme/flavors/default/defaultFlavor.const.js.map +1 -0
- package/dist/theme/flavors/default/defaultLightTheme.const.cjs +2 -0
- package/dist/theme/flavors/default/defaultLightTheme.const.cjs.map +1 -0
- package/dist/theme/flavors/default/defaultLightTheme.const.js +93 -0
- package/dist/theme/flavors/default/defaultLightTheme.const.js.map +1 -0
- package/dist/theme/flavors/neutral/neutralFlavor.const.cjs +2 -0
- package/dist/theme/flavors/neutral/neutralFlavor.const.cjs.map +1 -0
- package/dist/theme/flavors/neutral/neutralFlavor.const.js +32 -0
- package/dist/theme/flavors/neutral/neutralFlavor.const.js.map +1 -0
- package/dist/theme/hooks/viewport/use-breakpoint/useBreakpoint.hook.cjs +2 -0
- package/dist/theme/hooks/viewport/use-breakpoint/useBreakpoint.hook.cjs.map +1 -0
- package/dist/theme/hooks/viewport/use-breakpoint/useBreakpoint.hook.js +11 -0
- package/dist/theme/hooks/viewport/use-breakpoint/useBreakpoint.hook.js.map +1 -0
- package/dist/theme/hooks/viewport/use-breakpoint/utils/mediaQueryStore.utils.cjs +2 -0
- package/dist/theme/hooks/viewport/use-breakpoint/utils/mediaQueryStore.utils.cjs.map +1 -0
- package/dist/theme/hooks/viewport/use-breakpoint/utils/mediaQueryStore.utils.js +20 -0
- package/dist/theme/hooks/viewport/use-breakpoint/utils/mediaQueryStore.utils.js.map +1 -0
- package/dist/theme/styles/themes.css.cjs +1 -0
- package/dist/theme/styles/themes.css.js +1 -0
- package/dist/theme/styles/vars.css.cjs +2 -0
- package/dist/theme/styles/vars.css.cjs.map +1 -0
- package/dist/theme/styles/vars.css.js +366 -0
- package/dist/theme/styles/vars.css.js.map +1 -0
- package/dist/theme/theme-provider/ThemeProvider.cjs +2 -0
- package/dist/theme/theme-provider/ThemeProvider.cjs.map +1 -0
- package/dist/theme/theme-provider/ThemeProvider.css.cjs +2 -0
- package/dist/theme/theme-provider/ThemeProvider.css.cjs.map +1 -0
- package/dist/theme/theme-provider/ThemeProvider.css.js +6 -0
- package/dist/theme/theme-provider/ThemeProvider.css.js.map +1 -0
- package/dist/theme/theme-provider/ThemeProvider.js +45 -0
- package/dist/theme/theme-provider/ThemeProvider.js.map +1 -0
- package/dist/theme/theme-provider/constants/index.cjs +2 -0
- package/dist/theme/theme-provider/constants/index.cjs.map +1 -0
- package/dist/theme/theme-provider/constants/index.js +13 -0
- package/dist/theme/theme-provider/constants/index.js.map +1 -0
- package/dist/theme/theme-provider/contexts/FlavorRegistryContext.cjs +2 -0
- package/dist/theme/theme-provider/contexts/FlavorRegistryContext.cjs.map +1 -0
- package/dist/theme/theme-provider/contexts/FlavorRegistryContext.js +6 -0
- package/dist/theme/theme-provider/contexts/FlavorRegistryContext.js.map +1 -0
- package/dist/theme/theme-provider/contexts/ThemeContext.cjs +2 -0
- package/dist/theme/theme-provider/contexts/ThemeContext.cjs.map +1 -0
- package/dist/theme/theme-provider/contexts/ThemeContext.js +6 -0
- package/dist/theme/theme-provider/contexts/ThemeContext.js.map +1 -0
- package/dist/theme/theme-provider/contexts/ThemeSetterContext.cjs +2 -0
- package/dist/theme/theme-provider/contexts/ThemeSetterContext.cjs.map +1 -0
- package/dist/theme/theme-provider/contexts/ThemeSetterContext.js +6 -0
- package/dist/theme/theme-provider/contexts/ThemeSetterContext.js.map +1 -0
- package/dist/theme/theme-provider/hooks/use-controllable-selection/useControllableSelection.hook.cjs +2 -0
- package/dist/theme/theme-provider/hooks/use-controllable-selection/useControllableSelection.hook.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/use-controllable-selection/useControllableSelection.hook.js +41 -0
- package/dist/theme/theme-provider/hooks/use-controllable-selection/useControllableSelection.hook.js.map +1 -0
- package/dist/theme/theme-provider/hooks/use-document-scope/useDocumentScope.hook.cjs +2 -0
- package/dist/theme/theme-provider/hooks/use-document-scope/useDocumentScope.hook.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/use-document-scope/useDocumentScope.hook.js +30 -0
- package/dist/theme/theme-provider/hooks/use-document-scope/useDocumentScope.hook.js.map +1 -0
- package/dist/theme/theme-provider/hooks/use-flavor-registry/useFlavorRegistry.hook.cjs +2 -0
- package/dist/theme/theme-provider/hooks/use-flavor-registry/useFlavorRegistry.hook.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/use-flavor-registry/useFlavorRegistry.hook.js +30 -0
- package/dist/theme/theme-provider/hooks/use-flavor-registry/useFlavorRegistry.hook.js.map +1 -0
- package/dist/theme/theme-provider/hooks/use-flavor-registry/utils/areFlavorListsEqual.utils.cjs +2 -0
- package/dist/theme/theme-provider/hooks/use-flavor-registry/utils/areFlavorListsEqual.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/use-flavor-registry/utils/areFlavorListsEqual.utils.js +5 -0
- package/dist/theme/theme-provider/hooks/use-flavor-registry/utils/areFlavorListsEqual.utils.js.map +1 -0
- package/dist/theme/theme-provider/hooks/use-theme-provider/useThemeProvider.hook.cjs +2 -0
- package/dist/theme/theme-provider/hooks/use-theme-provider/useThemeProvider.hook.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/use-theme-provider/useThemeProvider.hook.js +80 -0
- package/dist/theme/theme-provider/hooks/use-theme-provider/useThemeProvider.hook.js.map +1 -0
- package/dist/theme/theme-provider/hooks/use-token-styles/useTokenStyles.hook.cjs +2 -0
- package/dist/theme/theme-provider/hooks/use-token-styles/useTokenStyles.hook.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/use-token-styles/useTokenStyles.hook.js +11 -0
- package/dist/theme/theme-provider/hooks/use-token-styles/useTokenStyles.hook.js.map +1 -0
- package/dist/theme/theme-provider/hooks/use-token-styles/utils/areTokenStylesEqual.utils.cjs +2 -0
- package/dist/theme/theme-provider/hooks/use-token-styles/utils/areTokenStylesEqual.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/use-token-styles/utils/areTokenStylesEqual.utils.js +8 -0
- package/dist/theme/theme-provider/hooks/use-token-styles/utils/areTokenStylesEqual.utils.js.map +1 -0
- package/dist/theme/theme-provider/hooks/useResolvedTheme.hook.cjs +2 -0
- package/dist/theme/theme-provider/hooks/useResolvedTheme.hook.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/useResolvedTheme.hook.js +13 -0
- package/dist/theme/theme-provider/hooks/useResolvedTheme.hook.js.map +1 -0
- package/dist/theme/theme-provider/hooks/useSetTheme.hook.cjs +2 -0
- package/dist/theme/theme-provider/hooks/useSetTheme.hook.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/useSetTheme.hook.js +11 -0
- package/dist/theme/theme-provider/hooks/useSetTheme.hook.js.map +1 -0
- package/dist/theme/theme-provider/hooks/useTheme.hook.cjs +2 -0
- package/dist/theme/theme-provider/hooks/useTheme.hook.cjs.map +1 -0
- package/dist/theme/theme-provider/hooks/useTheme.hook.js +11 -0
- package/dist/theme/theme-provider/hooks/useTheme.hook.js.map +1 -0
- package/dist/theme/theme-provider/utils/createFlavorValidator.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/createFlavorValidator.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/createFlavorValidator.utils.js +11 -0
- package/dist/theme/theme-provider/utils/createFlavorValidator.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/get-flavor-stylesheet/getFlavorStylesheet.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/get-flavor-stylesheet/getFlavorStylesheet.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/get-flavor-stylesheet/getFlavorStylesheet.utils.js +15 -0
- package/dist/theme/theme-provider/utils/get-flavor-stylesheet/getFlavorStylesheet.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/get-flavor-stylesheet/utils/hashString.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/get-flavor-stylesheet/utils/hashString.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/get-flavor-stylesheet/utils/hashString.utils.js +9 -0
- package/dist/theme/theme-provider/utils/get-flavor-stylesheet/utils/hashString.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/getReferencedFlavors.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/getReferencedFlavors.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/getReferencedFlavors.utils.js +6 -0
- package/dist/theme/theme-provider/utils/getReferencedFlavors.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/getServerSystemTheme.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/getServerSystemTheme.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/getServerSystemTheme.utils.js +5 -0
- package/dist/theme/theme-provider/utils/getServerSystemTheme.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/getSystemTheme.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/getSystemTheme.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/getSystemTheme.utils.js +6 -0
- package/dist/theme/theme-provider/utils/getSystemTheme.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/register-document-scope/registerDocumentScope.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/register-document-scope/registerDocumentScope.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/register-document-scope/registerDocumentScope.utils.js +33 -0
- package/dist/theme/theme-provider/utils/register-document-scope/registerDocumentScope.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/applyDocumentScope.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/applyDocumentScope.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/applyDocumentScope.utils.js +16 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/applyDocumentScope.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/syncAttribute.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/syncAttribute.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/syncAttribute.utils.js +7 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/syncAttribute.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/syncProperty.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/syncProperty.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/syncProperty.utils.js +7 -0
- package/dist/theme/theme-provider/utils/register-document-scope/utils/syncProperty.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/subscribeToNothing.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/subscribeToNothing.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/subscribeToNothing.utils.js +5 -0
- package/dist/theme/theme-provider/utils/subscribeToNothing.utils.js.map +1 -0
- package/dist/theme/theme-provider/utils/subscribeToSystemTheme.utils.cjs +2 -0
- package/dist/theme/theme-provider/utils/subscribeToSystemTheme.utils.cjs.map +1 -0
- package/dist/theme/theme-provider/utils/subscribeToSystemTheme.utils.js +10 -0
- package/dist/theme/theme-provider/utils/subscribeToSystemTheme.utils.js.map +1 -0
- package/dist/theme/tokens/primitives/breakpoints.const.cjs +2 -0
- package/dist/theme/tokens/primitives/breakpoints.const.cjs.map +1 -0
- package/dist/theme/tokens/primitives/breakpoints.const.js +19 -0
- package/dist/theme/tokens/primitives/breakpoints.const.js.map +1 -0
- package/dist/theme/tokens/primitives/palette.const.cjs +2 -0
- package/dist/theme/tokens/primitives/palette.const.cjs.map +1 -0
- package/dist/theme/tokens/primitives/palette.const.js +602 -0
- package/dist/theme/tokens/primitives/palette.const.js.map +1 -0
- package/dist/theme/tokens/primitives/scales.const.cjs +2 -0
- package/dist/theme/tokens/primitives/scales.const.cjs.map +1 -0
- package/dist/theme/tokens/primitives/scales.const.js +125 -0
- package/dist/theme/tokens/primitives/scales.const.js.map +1 -0
- package/dist/theme/tokens/shared/sharedThemeTokens.const.cjs +2 -0
- package/dist/theme/tokens/shared/sharedThemeTokens.const.cjs.map +1 -0
- package/dist/theme/tokens/shared/sharedThemeTokens.const.js +21 -0
- package/dist/theme/tokens/shared/sharedThemeTokens.const.js.map +1 -0
- package/dist/theme/utils/colors/create-accent/constants/index.cjs +2 -0
- package/dist/theme/utils/colors/create-accent/constants/index.cjs.map +1 -0
- package/dist/theme/utils/colors/create-accent/constants/index.js +9 -0
- package/dist/theme/utils/colors/create-accent/constants/index.js.map +1 -0
- package/dist/theme/utils/colors/create-accent/createAccent.utils.cjs +2 -0
- package/dist/theme/utils/colors/create-accent/createAccent.utils.cjs.map +1 -0
- package/dist/theme/utils/colors/create-accent/createAccent.utils.js +23 -0
- package/dist/theme/utils/colors/create-accent/createAccent.utils.js.map +1 -0
- package/dist/theme/utils/colors/mixColors.utils.cjs +2 -0
- package/dist/theme/utils/colors/mixColors.utils.cjs.map +1 -0
- package/dist/theme/utils/colors/mixColors.utils.js +12 -0
- package/dist/theme/utils/colors/mixColors.utils.js.map +1 -0
- package/dist/theme/utils/flavors/collect-flavor-styles/collectFlavorStyles.utils.cjs +2 -0
- package/dist/theme/utils/flavors/collect-flavor-styles/collectFlavorStyles.utils.cjs.map +1 -0
- package/dist/theme/utils/flavors/collect-flavor-styles/collectFlavorStyles.utils.js +24 -0
- package/dist/theme/utils/flavors/collect-flavor-styles/collectFlavorStyles.utils.js.map +1 -0
- package/dist/theme/utils/flavors/constants/index.cjs +2 -0
- package/dist/theme/utils/flavors/constants/index.cjs.map +1 -0
- package/dist/theme/utils/flavors/constants/index.js +6 -0
- package/dist/theme/utils/flavors/constants/index.js.map +1 -0
- package/dist/theme/utils/flavors/createFlavor.utils.cjs +2 -0
- package/dist/theme/utils/flavors/createFlavor.utils.cjs.map +1 -0
- package/dist/theme/utils/flavors/createFlavor.utils.js +20 -0
- package/dist/theme/utils/flavors/createFlavor.utils.js.map +1 -0
- package/dist/theme/utils/flavors/get-flavor-css/getFlavorCss.utils.cjs +3 -0
- package/dist/theme/utils/flavors/get-flavor-css/getFlavorCss.utils.cjs.map +1 -0
- package/dist/theme/utils/flavors/get-flavor-css/getFlavorCss.utils.js +19 -0
- package/dist/theme/utils/flavors/get-flavor-css/getFlavorCss.utils.js.map +1 -0
- package/dist/theme/utils/flavors/get-flavor-css/utils/get-flavor-selectors/getFlavorSelectors.utils.cjs +2 -0
- package/dist/theme/utils/flavors/get-flavor-css/utils/get-flavor-selectors/getFlavorSelectors.utils.cjs.map +1 -0
- package/dist/theme/utils/flavors/get-flavor-css/utils/get-flavor-selectors/getFlavorSelectors.utils.js +13 -0
- package/dist/theme/utils/flavors/get-flavor-css/utils/get-flavor-selectors/getFlavorSelectors.utils.js.map +1 -0
- package/dist/theme/utils/flavors/get-flavor-css/utils/serializeDeclarations.utils.cjs +2 -0
- package/dist/theme/utils/flavors/get-flavor-css/utils/serializeDeclarations.utils.cjs.map +1 -0
- package/dist/theme/utils/flavors/get-flavor-css/utils/serializeDeclarations.utils.js +5 -0
- package/dist/theme/utils/flavors/get-flavor-css/utils/serializeDeclarations.utils.js.map +1 -0
- package/dist/theme/utils/flavors/getFlavorReferenceName.utils.cjs +2 -0
- package/dist/theme/utils/flavors/getFlavorReferenceName.utils.cjs.map +1 -0
- package/dist/theme/utils/flavors/getFlavorReferenceName.utils.js +6 -0
- package/dist/theme/utils/flavors/getFlavorReferenceName.utils.js.map +1 -0
- package/dist/theme/utils/guards/isRecord.utils.cjs +2 -0
- package/dist/theme/utils/guards/isRecord.utils.cjs.map +1 -0
- package/dist/theme/utils/guards/isRecord.utils.js +5 -0
- package/dist/theme/utils/guards/isRecord.utils.js.map +1 -0
- package/dist/theme/utils/server-rendering/get-theme-root-props/getThemeRootProps.utils.cjs +2 -0
- package/dist/theme/utils/server-rendering/get-theme-root-props/getThemeRootProps.utils.cjs.map +1 -0
- package/dist/theme/utils/server-rendering/get-theme-root-props/getThemeRootProps.utils.js +14 -0
- package/dist/theme/utils/server-rendering/get-theme-root-props/getThemeRootProps.utils.js.map +1 -0
- package/dist/theme/utils/tokens/assertCompleteTheme.utils.cjs +2 -0
- package/dist/theme/utils/tokens/assertCompleteTheme.utils.cjs.map +1 -0
- package/dist/theme/utils/tokens/assertCompleteTheme.utils.js +9 -0
- package/dist/theme/utils/tokens/assertCompleteTheme.utils.js.map +1 -0
- package/dist/theme/utils/tokens/collect-token-styles/collectTokenStyles.utils.cjs +2 -0
- package/dist/theme/utils/tokens/collect-token-styles/collectTokenStyles.utils.cjs.map +1 -0
- package/dist/theme/utils/tokens/collect-token-styles/collectTokenStyles.utils.js +25 -0
- package/dist/theme/utils/tokens/collect-token-styles/collectTokenStyles.utils.js.map +1 -0
- package/dist/theme/utils/tokens/create-theme-tokens/createThemeTokens.utils.cjs +2 -0
- package/dist/theme/utils/tokens/create-theme-tokens/createThemeTokens.utils.cjs.map +1 -0
- package/dist/theme/utils/tokens/create-theme-tokens/createThemeTokens.utils.js +12 -0
- package/dist/theme/utils/tokens/create-theme-tokens/createThemeTokens.utils.js.map +1 -0
- package/dist/theme/utils/tokens/create-theme-tokens/utils/mergeTokens.utils.cjs +2 -0
- package/dist/theme/utils/tokens/create-theme-tokens/utils/mergeTokens.utils.cjs.map +1 -0
- package/dist/theme/utils/tokens/create-theme-tokens/utils/mergeTokens.utils.js +9 -0
- package/dist/theme/utils/tokens/create-theme-tokens/utils/mergeTokens.utils.js.map +1 -0
- package/dist/theme/utils/tokens/getSharedTokenStyles.utils.cjs +2 -0
- package/dist/theme/utils/tokens/getSharedTokenStyles.utils.cjs.map +1 -0
- package/dist/theme/utils/tokens/getSharedTokenStyles.utils.js +12 -0
- package/dist/theme/utils/tokens/getSharedTokenStyles.utils.js.map +1 -0
- package/dist/theme/utils/tokens/getThemeTokenStyles.utils.cjs +2 -0
- package/dist/theme/utils/tokens/getThemeTokenStyles.utils.cjs.map +1 -0
- package/dist/theme/utils/tokens/getThemeTokenStyles.utils.js +12 -0
- package/dist/theme/utils/tokens/getThemeTokenStyles.utils.js.map +1 -0
- package/dist/theme/utils/validation/assertFlavorName.utils.cjs +2 -0
- package/dist/theme/utils/validation/assertFlavorName.utils.cjs.map +1 -0
- package/dist/theme/utils/validation/assertFlavorName.utils.js +10 -0
- package/dist/theme/utils/validation/assertFlavorName.utils.js.map +1 -0
- package/dist/theme/utils/validation/assertThemeName.utils.cjs +2 -0
- package/dist/theme/utils/validation/assertThemeName.utils.cjs.map +1 -0
- package/dist/theme/utils/validation/assertThemeName.utils.js +9 -0
- package/dist/theme/utils/validation/assertThemeName.utils.js.map +1 -0
- package/package.json +83 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Choco Vanille contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,217 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @choco-vanille/theme
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Theming for React: light, dark and system modes, color flavors, and typed
|
|
4
|
+
design tokens exposed as CSS variables.
|
|
5
|
+
|
|
6
|
+
No UI components, no global styles: only the tokens your components use.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @choco-vanille/theme
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Requires React 19.
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
Import the stylesheet once and wrap your app in `ThemeProvider`:
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import '@choco-vanille/theme/styles.css';
|
|
22
|
+
|
|
23
|
+
import { ThemeProvider } from '@choco-vanille/theme';
|
|
24
|
+
|
|
25
|
+
<ThemeProvider>
|
|
26
|
+
<App />
|
|
27
|
+
</ThemeProvider>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use the tokens in your styles, as CSS variables:
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
.card {
|
|
34
|
+
padding: var(--theme-space-16);
|
|
35
|
+
border-radius: var(--theme-radius-xl);
|
|
36
|
+
background: var(--theme-color-surface-main);
|
|
37
|
+
color: var(--theme-color-surface-foreground);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
or as typed references with [Vanilla Extract](https://vanilla-extract.style/)
|
|
42
|
+
or any CSS-in-JS library:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { vars } from '@choco-vanille/theme';
|
|
46
|
+
import { style } from '@vanilla-extract/css';
|
|
47
|
+
|
|
48
|
+
export const card = style({
|
|
49
|
+
padding: vars.space[16],
|
|
50
|
+
background: vars.color.surface.main,
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Change the theme with `useTheme`:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import { useTheme } from '@choco-vanille/theme';
|
|
58
|
+
|
|
59
|
+
const ThemeToggle = () => {
|
|
60
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<button
|
|
64
|
+
onClick={() =>
|
|
65
|
+
setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')
|
|
66
|
+
}
|
|
67
|
+
>
|
|
68
|
+
Toggle theme
|
|
69
|
+
</button>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Stylesheet
|
|
75
|
+
|
|
76
|
+
All the CSS of the package ships as a single file,
|
|
77
|
+
`@choco-vanille/theme/styles.css`, about 27 kB (4 kB gzipped). It is not
|
|
78
|
+
tree-shakable: importing it once, as shown above, brings every theme and
|
|
79
|
+
flavor, whatever your application uses.
|
|
80
|
+
|
|
81
|
+
## Themes
|
|
82
|
+
|
|
83
|
+
`ThemeProvider` accepts `light`, `dark` or `system` (default, follows the OS
|
|
84
|
+
preference).
|
|
85
|
+
|
|
86
|
+
| Prop | Description |
|
|
87
|
+
| -------------------------- | ------------------------------------- |
|
|
88
|
+
| `defaultTheme` | Initial theme. |
|
|
89
|
+
| `theme`, `onThemeChange` | Controlled theme. |
|
|
90
|
+
| `defaultFlavor` | Initial flavor. |
|
|
91
|
+
| `flavor`, `onFlavorChange` | Controlled flavor. |
|
|
92
|
+
| `flavors` | Flavors the user can switch between. |
|
|
93
|
+
| `tokens` | Overrides of mode-independent tokens. |
|
|
94
|
+
|
|
95
|
+
`useTheme()` returns:
|
|
96
|
+
|
|
97
|
+
| Field | Description |
|
|
98
|
+
| --------------- | --------------------------------------------- |
|
|
99
|
+
| `theme` | Selected theme (`light`, `dark` or `system`). |
|
|
100
|
+
| `resolvedTheme` | Theme actually applied (`system` resolved). |
|
|
101
|
+
| `setTheme` | Changes the theme. |
|
|
102
|
+
| `flavor` | Selected flavor. |
|
|
103
|
+
| `flavors` | Available flavors. |
|
|
104
|
+
| `setFlavor` | Changes the flavor. |
|
|
105
|
+
|
|
106
|
+
The preference is not persisted: store it yourself and pass it to `theme` or
|
|
107
|
+
`defaultTheme`.
|
|
108
|
+
|
|
109
|
+
## Flavors
|
|
110
|
+
|
|
111
|
+
A flavor is a color palette with a light and a dark variant.
|
|
112
|
+
|
|
113
|
+
| Export | Name | Description |
|
|
114
|
+
| ---------------- | ------------ | ------------------------------------------ |
|
|
115
|
+
| `defaultFlavor` | `'default'` | The library's colors. Always available. |
|
|
116
|
+
| `contrastFlavor` | `'contrast'` | High contrast (WCAG AAA for text). |
|
|
117
|
+
| `neutralFlavor` | `'neutral'` | Black and white accents instead of indigo. |
|
|
118
|
+
|
|
119
|
+
Pass the exported object to the provider, and the name to `setFlavor`.
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { contrastFlavor, ThemeProvider } from '@choco-vanille/theme';
|
|
123
|
+
|
|
124
|
+
<ThemeProvider defaultFlavor={contrastFlavor}>
|
|
125
|
+
<App />
|
|
126
|
+
</ThemeProvider>;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
To let users choose, pass the list to `flavors`:
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
<ThemeProvider flavors={[contrastFlavor, neutralFlavor]}>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
then switch with `setFlavor('contrast')`, `setFlavor('neutral')` or
|
|
136
|
+
`setFlavor('default')`.
|
|
137
|
+
|
|
138
|
+
### Custom flavor
|
|
139
|
+
|
|
140
|
+
Override only the colors you need, for each mode:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { createFlavor } from '@choco-vanille/theme';
|
|
144
|
+
|
|
145
|
+
export const brandFlavor = createFlavor({
|
|
146
|
+
name: 'brand',
|
|
147
|
+
light: { color: { primary: { main: '#006957' } } },
|
|
148
|
+
dark: { color: { primary: { main: '#3fb8a0' } } },
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Use `name: 'default'` to replace the library's colors across the whole app.
|
|
153
|
+
|
|
154
|
+
## Tokens
|
|
155
|
+
|
|
156
|
+
| Group | Example |
|
|
157
|
+
| --------------------------------------------------------------------- | ---------------------------- |
|
|
158
|
+
| `color` | `--theme-color-primary-main` |
|
|
159
|
+
| `shadow`, `dropShadow` | `--theme-shadow-raised` |
|
|
160
|
+
| `space` | `--theme-space-16` |
|
|
161
|
+
| `radius` | `--theme-radius-md` |
|
|
162
|
+
| `fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `letterSpacing` | `--theme-fontSize-16` |
|
|
163
|
+
| `opacity`, `zIndex`, `duration`, `easing`, `focusRing` | `--theme-duration-fast` |
|
|
164
|
+
|
|
165
|
+
Colors change with the theme and flavor; the other tokens, shadows included,
|
|
166
|
+
do not.
|
|
167
|
+
Your editor autocompletes every token through `vars`.
|
|
168
|
+
|
|
169
|
+
Also exported: `palette` (raw colors for charts and illustrations) and
|
|
170
|
+
`breakpoints` / `mediaQueries` (responsive breakpoints).
|
|
171
|
+
|
|
172
|
+
Prefer `mediaQueries` in your styles. When the layout must change in
|
|
173
|
+
JavaScript, `useBreakpoint` follows the same breakpoints:
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { useBreakpoint } from '@choco-vanille/theme';
|
|
177
|
+
|
|
178
|
+
const Navigation = () => {
|
|
179
|
+
const isMobile = useBreakpoint('tablet', 'below');
|
|
180
|
+
return isMobile ? <MenuDrawer /> : <MenuBar />;
|
|
181
|
+
};
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
`useBreakpoint(breakpoint)` is `true` when the viewport is at least as wide as
|
|
185
|
+
the breakpoint; `useBreakpoint(breakpoint, 'below')` when it is narrower.
|
|
186
|
+
Server and hydration renders reach no breakpoint, like mobile-first CSS, then
|
|
187
|
+
the component re-renders with the real viewport.
|
|
188
|
+
|
|
189
|
+
To change a mode-independent token for the whole app, use the `tokens` prop:
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
<ThemeProvider
|
|
193
|
+
tokens={{
|
|
194
|
+
fontFamily: { sans: 'Inter, sans-serif' },
|
|
195
|
+
radius: { lg: '0.375rem' },
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Colors are changed through a flavor (see [Custom flavor](#custom-flavor)):
|
|
201
|
+
`tokens` throws for `color`. `space` cannot be overridden at all: each spacing
|
|
202
|
+
key names its value, so pick another key instead.
|
|
203
|
+
|
|
204
|
+
## Server-side rendering
|
|
205
|
+
|
|
206
|
+
To avoid a flash of the wrong theme, spread `getThemeRootProps` on `<html>`
|
|
207
|
+
with the same values as the provider:
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import { getThemeRootProps } from '@choco-vanille/theme';
|
|
211
|
+
|
|
212
|
+
<html {...getThemeRootProps({ theme: 'system' })}>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
[MIT](LICENSE)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("./theme/styles/themes.css.cjs");const e=require("./theme/constants/index.cjs"),t=require("./theme/tokens/primitives/breakpoints.const.cjs"),n=require("./theme/tokens/primitives/palette.const.cjs"),r=require("./theme/flavors/default/defaultFlavor.const.cjs"),i=require("./theme/styles/vars.css.cjs"),a=require("./theme/utils/tokens/getThemeTokenStyles.utils.cjs"),o=require("./theme/utils/tokens/create-theme-tokens/createThemeTokens.utils.cjs"),s=require("./theme/utils/flavors/createFlavor.utils.cjs"),c=require("./theme/flavors/contrast/contrastFlavor.const.cjs"),l=require("./theme/flavors/neutral/neutralFlavor.const.cjs"),u=require("./theme/hooks/viewport/use-breakpoint/useBreakpoint.hook.cjs"),d=require("./theme/utils/flavors/get-flavor-css/getFlavorCss.utils.cjs"),f=require("./theme/theme-provider/ThemeProvider.cjs"),p=require("./theme/theme-provider/hooks/useSetTheme.hook.cjs"),m=require("./theme/theme-provider/hooks/useTheme.hook.cjs"),h=require("./theme/utils/server-rendering/get-theme-root-props/getThemeRootProps.utils.cjs");exports.ThemeProvider=f.default,exports.breakpoints=t.breakpoints,exports.contrastFlavor=c.contrastFlavor,exports.createFlavor=s.createFlavor,exports.createThemeTokens=o.createThemeTokens,exports.defaultFlavor=r.defaultFlavor,exports.flavorAttribute=e.flavorAttribute,exports.getFlavorCss=d.getFlavorCss,exports.getThemeRootProps=h.getThemeRootProps,exports.getThemeTokenStyles=a.getThemeTokenStyles,exports.mediaQueries=t.mediaQueries,exports.neutralFlavor=l.neutralFlavor,exports.palette=n.palette,exports.themeAttribute=e.themeAttribute,exports.themeDarkClass=e.themeDarkClass,exports.themeLayer=e.themeLayer,exports.themeLightClass=e.themeLightClass,exports.themeModes=e.themeModes,exports.themeSystemClass=e.themeSystemClass,exports.useBreakpoint=u.useBreakpoint,exports.useSetTheme=p.useSetTheme,exports.useTheme=m.useTheme,exports.vars=i.vars;
|