@yahoo/uds 3.100.0-beta.3 → 3.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/automated-config/dist/generated/autoVariants.cjs +1 -10
- package/dist/automated-config/dist/generated/autoVariants.d.cts +0 -9
- package/dist/automated-config/dist/generated/autoVariants.d.ts +0 -9
- package/dist/automated-config/dist/generated/autoVariants.js +1 -10
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +1 -1640
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +189 -405
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +189 -405
- package/dist/automated-config/dist/generated/generatedConfigs.js +1 -1639
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +0 -94
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +1 -2
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +1 -2
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +0 -94
- package/dist/automated-config/dist/properties.cjs +89 -152
- package/dist/automated-config/dist/properties.d.cts +4 -25
- package/dist/automated-config/dist/properties.d.ts +4 -25
- package/dist/automated-config/dist/properties.js +90 -153
- package/dist/automated-config/dist/utils/buildConfigSchema.cjs +1 -5
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +1 -2
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +1 -2
- package/dist/automated-config/dist/utils/buildConfigSchema.js +1 -5
- package/dist/automated-config/dist/utils/coalesceConfigVariant.cjs +2 -4
- package/dist/automated-config/dist/utils/coalesceConfigVariant.js +1 -1
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/automated-config/dist/utils/index.cjs +4 -4
- package/dist/automated-config/dist/utils/index.d.cts +1 -6
- package/dist/automated-config/dist/utils/index.d.ts +1 -6
- package/dist/automated-config/dist/utils/index.js +4 -4
- package/dist/automated-config/dist/utils/mapValues.cjs +13 -0
- package/dist/automated-config/dist/utils/mapValues.js +12 -0
- package/dist/cli/commands/sync.cjs +2 -6
- package/dist/cli/commands/sync.js +2 -6
- package/dist/cli/dist/commands/editor-rules.cjs +1 -1
- package/dist/cli/dist/commands/editor-rules.js +1 -1
- package/dist/cli/dist/utils/rules/config.cjs +1 -1
- package/dist/cli/dist/utils/rules/config.js +1 -1
- package/dist/cli/runner.cjs +23 -3
- package/dist/cli/runner.js +22 -3
- package/dist/components/client/Button.js +2 -2
- package/dist/components/client/SpringMotionConfig.cjs +8 -8
- package/dist/components/client/SpringMotionConfig.js +1 -1
- package/dist/components/client/index.cjs +0 -8
- package/dist/components/client/index.d.cts +1 -7
- package/dist/components/client/index.d.ts +1 -7
- package/dist/components/client/index.js +1 -5
- package/dist/components/client/providers/UDSConfigProvider.cjs +2 -6
- package/dist/components/client/providers/UDSConfigProvider.d.cts +1 -2
- package/dist/components/client/providers/UDSConfigProvider.d.ts +1 -2
- package/dist/components/client/providers/UDSConfigProvider.js +2 -6
- package/dist/components/experimental/index.cjs +36 -0
- package/dist/components/experimental/index.js +32 -1
- package/dist/components/index.cjs +51 -8
- package/dist/components/index.d.cts +1 -6
- package/dist/components/index.d.ts +1 -6
- package/dist/components/index.js +46 -5
- package/dist/config/dist/index.cjs +1 -95
- package/dist/config/dist/index.d.cts +1 -139
- package/dist/config/dist/index.d.ts +1 -139
- package/dist/config/dist/index.js +1 -95
- package/dist/css-tokens/dist/index.cjs +9 -2
- package/dist/css-tokens/dist/index.d.cts +13 -4
- package/dist/css-tokens/dist/index.d.ts +13 -4
- package/dist/css-tokens/dist/index.js +9 -2
- package/dist/fixtures/dist/index.cjs +1 -27
- package/dist/fixtures/dist/index.d.cts +3 -17
- package/dist/fixtures/dist/index.d.ts +3 -17
- package/dist/fixtures/dist/index.js +2 -26
- package/dist/fixtures/index.cjs +1 -6
- package/dist/fixtures/index.d.cts +2 -4
- package/dist/fixtures/index.d.ts +2 -4
- package/dist/fixtures/index.js +2 -3
- package/dist/index.cjs +10 -25
- package/dist/index.d.cts +4 -11
- package/dist/index.d.ts +4 -11
- package/dist/index.js +11 -18
- package/dist/runtime/index.cjs +0 -2
- package/dist/runtime/index.d.cts +1 -2
- package/dist/runtime/index.d.ts +1 -2
- package/dist/runtime/index.js +1 -2
- package/dist/runtime/udsConfig.cjs +1 -3
- package/dist/runtime/udsConfig.d.cts +0 -2
- package/dist/runtime/udsConfig.d.ts +0 -2
- package/dist/runtime/udsConfig.js +1 -3
- package/dist/styles/styler.d.cts +38 -47
- package/dist/styles/styler.d.ts +38 -47
- package/dist/styles/variants.d.cts +0 -27
- package/dist/styles/variants.d.ts +0 -27
- package/dist/tailwind/dist/.prettierrc.cjs +13 -0
- package/dist/tailwind/dist/.prettierrc.js +12 -0
- package/dist/tailwind/dist/_virtual/_rolldown/runtime.cjs +11 -0
- package/dist/tailwind/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/tailwind/dist/commands/generatePurgeCSSData.cjs +52 -0
- package/dist/tailwind/dist/commands/generatePurgeCSSData.d.ts +3 -0
- package/dist/tailwind/dist/commands/generatePurgeCSSData.js +50 -0
- package/dist/tailwind/dist/commands/purge.cjs +27 -0
- package/dist/tailwind/dist/commands/purge.d.ts +3 -0
- package/dist/tailwind/dist/commands/purge.js +27 -0
- package/dist/tailwind/dist/index.d.cts +3 -0
- package/dist/tailwind/dist/index.d.ts +5 -0
- package/dist/tailwind/dist/plugin.cjs +38 -0
- package/dist/tailwind/{tailwindPlugin.d.ts → dist/plugin.d.cts} +6 -5
- package/dist/tailwind/{tailwindPlugin.d.cts → dist/plugin.d.ts} +6 -5
- package/dist/tailwind/dist/plugin.js +37 -0
- package/dist/tailwind/dist/tailwind/base/addColorModeVars.cjs +21 -0
- package/dist/tailwind/{base → dist/tailwind/base}/addColorModeVars.js +4 -3
- package/dist/tailwind/{base → dist/tailwind/base}/addColorModeVarsV2.cjs +9 -10
- package/dist/tailwind/{base → dist/tailwind/base}/addColorModeVarsV2.js +4 -3
- package/dist/tailwind/dist/tailwind/base/addFontFaceDeclarations.cjs +12 -0
- package/dist/tailwind/{base → dist/tailwind/base}/addFontFaceDeclarations.js +2 -1
- package/dist/tailwind/dist/tailwind/base/addFontVars.cjs +11 -0
- package/dist/tailwind/{base → dist/tailwind/base}/addFontVars.js +2 -1
- package/dist/tailwind/dist/tailwind/base/addMotionVars.cjs +11 -0
- package/dist/tailwind/{base → dist/tailwind/base}/addMotionVars.js +2 -1
- package/dist/tailwind/{base → dist/tailwind/base}/addScaleModeVars.cjs +6 -6
- package/dist/tailwind/{base → dist/tailwind/base}/addScaleModeVars.js +4 -3
- package/dist/tailwind/{components → dist/tailwind/components}/getFocusRingStyles.cjs +3 -3
- package/dist/tailwind/{components → dist/tailwind/components}/getFocusRingStyles.js +3 -2
- package/dist/tailwind/dist/tailwind/components/getGroupedTextStyles.cjs +20 -0
- package/dist/tailwind/{components → dist/tailwind/components}/getGroupedTextStyles.js +4 -3
- package/dist/tailwind/{components → dist/tailwind/components}/getHitTargetStyles.cjs +2 -3
- package/dist/tailwind/{components → dist/tailwind/components}/getHitTargetStyles.js +3 -2
- package/dist/tailwind/{components → dist/tailwind/components}/getIconStyles.cjs +2 -2
- package/dist/tailwind/{components → dist/tailwind/components}/getIconStyles.js +2 -1
- package/dist/tailwind/{components → dist/tailwind/components}/getInputStyles.cjs +2 -2
- package/dist/tailwind/dist/tailwind/components/getInputStyles.d.cts +11 -0
- package/dist/tailwind/dist/tailwind/components/getInputStyles.d.ts +11 -0
- package/dist/tailwind/{components → dist/tailwind/components}/getInputStyles.js +2 -1
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.cjs +72 -0
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.d.cts +9 -0
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.d.ts +9 -0
- package/dist/tailwind/{components → dist/tailwind/components}/getResponsiveTextStyles.js +5 -4
- package/dist/tailwind/{components → dist/tailwind/components}/types.d.cts +3 -4
- package/dist/tailwind/{components → dist/tailwind/components}/types.d.ts +3 -4
- package/dist/tailwind/{defaultTailwindThemeAsUdsConfig.cjs → dist/tailwind/defaultTailwindThemeAsUdsConfig.cjs} +2 -2
- package/dist/tailwind/{defaultTailwindThemeAsUdsConfig.d.cts → dist/tailwind/defaultTailwindThemeAsUdsConfig.d.cts} +3 -2
- package/dist/tailwind/{defaultTailwindThemeAsUdsConfig.d.ts → dist/tailwind/defaultTailwindThemeAsUdsConfig.d.ts} +3 -2
- package/dist/tailwind/{defaultTailwindThemeAsUdsConfig.js → dist/tailwind/defaultTailwindThemeAsUdsConfig.js} +2 -1
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/a11y.cjs +7 -7
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/a11y.js +2 -1
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/borderRadius.cjs +10 -12
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/borderRadius.js +6 -5
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/borderWidth.cjs +10 -11
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/borderWidth.js +6 -5
- package/dist/tailwind/dist/tailwind/plugins/breakpoints.cjs +35 -0
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/breakpoints.js +5 -4
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/colors.cjs +19 -20
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/colors.js +8 -7
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +31 -0
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/components.js +5 -5
- package/dist/tailwind/dist/tailwind/plugins/elevation.cjs +38 -0
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/elevation.js +5 -4
- package/dist/tailwind/{utils → dist/tailwind/plugins}/getTailwindAsUdsColors.cjs +11 -11
- package/dist/tailwind/{utils → dist/tailwind/plugins}/getTailwindAsUdsColors.js +4 -3
- package/dist/tailwind/dist/tailwind/plugins/icons.cjs +14 -0
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/icons.js +2 -1
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/input.cjs +5 -5
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/input.js +2 -1
- package/dist/tailwind/dist/tailwind/plugins/motion.cjs +15 -0
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/motion.js +2 -1
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/nestedBorderRadius.cjs +9 -9
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/nestedBorderRadius.js +2 -1
- package/dist/tailwind/dist/tailwind/plugins/scaleMode.cjs +18 -0
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/scaleMode.js +3 -2
- package/dist/tailwind/dist/tailwind/plugins/shadows.cjs +46 -0
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/shadows.js +3 -2
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/sizing.cjs +6 -6
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/sizing.js +4 -3
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/spacing.cjs +3 -3
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/spacing.js +2 -1
- package/dist/tailwind/dist/tailwind/plugins/typography.cjs +86 -0
- package/dist/tailwind/{plugins → dist/tailwind/plugins}/typography.js +21 -7
- package/dist/tailwind/dist/tailwind/theme/getFontFamilyTheme.cjs +24 -0
- package/dist/tailwind/{theme → dist/tailwind/theme}/getFontFamilyTheme.js +4 -3
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.cjs +16 -0
- package/dist/tailwind/{utils → dist/tailwind/utils}/addFontsPlugin.d.cts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/addFontsPlugin.d.ts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/addFontsPlugin.js +2 -1
- package/dist/tailwind/{utils → dist/tailwind/utils}/composeTailwindPlugins.cjs +10 -17
- package/dist/tailwind/{utils → dist/tailwind/utils}/composeTailwindPlugins.d.cts +4 -16
- package/dist/tailwind/{utils → dist/tailwind/utils}/composeTailwindPlugins.d.ts +4 -15
- package/dist/tailwind/{utils → dist/tailwind/utils}/composeTailwindPlugins.js +2 -1
- package/dist/tailwind/{utils → dist/tailwind/utils}/flattenColorPalette.cjs +2 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/flattenColorPalette.js +2 -1
- package/dist/tailwind/{utils → dist/tailwind/utils}/getColorModeStyles.cjs +2 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/getColorModeStyles.d.cts +3 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/getColorModeStyles.d.ts +3 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/getColorModeStyles.js +2 -1
- package/dist/tailwind/dist/tailwind/utils/getElevationStyles.cjs +33 -0
- package/dist/tailwind/{utils → dist/tailwind/utils}/getElevationStyles.d.cts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getElevationStyles.d.ts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getElevationStyles.js +5 -4
- package/dist/tailwind/{utils → dist/tailwind/utils}/getFontFaceDeclarations.cjs +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getFontFaceDeclarations.d.cts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getFontFaceDeclarations.d.ts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getFontFaceDeclarations.js +3 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/getFontStyles.cjs +7 -7
- package/dist/tailwind/{utils → dist/tailwind/utils}/getFontStyles.d.cts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getFontStyles.d.ts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getFontStyles.js +6 -5
- package/dist/tailwind/dist/tailwind/utils/getMotionStyles.cjs +38 -0
- package/dist/tailwind/{utils → dist/tailwind/utils}/getMotionStyles.d.cts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getMotionStyles.d.ts +3 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getMotionStyles.js +6 -5
- package/dist/tailwind/{utils → dist/tailwind/utils}/getNestedBorderRadiusUtilities.cjs +2 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/getNestedBorderRadiusUtilities.js +2 -1
- package/dist/tailwind/{utils → dist/tailwind/utils}/getScaleModeStyles.cjs +2 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/getScaleModeStyles.d.cts +3 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/getScaleModeStyles.d.ts +3 -2
- package/dist/tailwind/{utils → dist/tailwind/utils}/getScaleModeStyles.js +2 -1
- package/dist/tailwind/{utils → dist/tailwind/utils}/getShadowPresetValues.cjs +5 -5
- package/dist/tailwind/{utils → dist/tailwind/utils}/getShadowPresetValues.d.cts +4 -4
- package/dist/tailwind/{utils → dist/tailwind/utils}/getShadowPresetValues.d.ts +4 -4
- package/dist/tailwind/{utils → dist/tailwind/utils}/getShadowPresetValues.js +4 -3
- package/dist/tailwind/{utils → dist/tailwind/utils}/getShadowStyles.cjs +6 -6
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.cts +22 -0
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.ts +22 -0
- package/dist/tailwind/{utils → dist/tailwind/utils}/getShadowStyles.js +5 -4
- package/dist/tailwind/dist/utils/assertUnreachable.cjs +10 -0
- package/dist/tailwind/dist/utils/assertUnreachable.js +9 -0
- package/dist/tailwind/dist/utils/entries.cjs +10 -0
- package/dist/tailwind/dist/utils/entries.js +9 -0
- package/dist/tailwind/dist/utils/fromEntries.cjs +18 -0
- package/dist/tailwind/dist/utils/fromEntries.js +17 -0
- package/dist/tailwind/dist/utils/generatePurgeCSSData.cjs +190 -0
- package/dist/tailwind/dist/utils/generatePurgeCSSData.js +181 -0
- package/dist/tailwind/dist/utils/mapValues.cjs +13 -0
- package/dist/tailwind/dist/utils/mapValues.js +12 -0
- package/dist/{tokens → tailwind/dist}/utils/opacity.cjs +5 -6
- package/dist/{tokens → tailwind/dist}/utils/opacity.js +2 -1
- package/dist/tailwind/dist/utils/parseTokens.cjs +136 -0
- package/dist/tailwind/dist/utils/parseTokens.d.cts +32 -0
- package/dist/tailwind/dist/utils/parseTokens.d.ts +32 -0
- package/dist/tailwind/dist/utils/parseTokens.js +136 -0
- package/dist/{cli/commands → tailwind/dist}/utils/purgeCSS.cjs +35 -46
- package/dist/tailwind/dist/utils/purgeCSS.d.ts +2 -0
- package/dist/{cli/commands → tailwind/dist}/utils/purgeCSS.js +26 -26
- package/dist/{uds/scripts → tailwind/dist}/utils/tsMorph.cjs +11 -27
- package/dist/{uds/scripts → tailwind/dist}/utils/tsMorph.js +4 -12
- package/dist/tailwind/dist/utils.d.cts +11 -0
- package/dist/tailwind/dist/utils.d.ts +11 -0
- package/dist/tailwind/plugin.cjs +10 -0
- package/dist/tailwind/plugin.d.cts +5 -0
- package/dist/tailwind/plugin.d.ts +5 -0
- package/dist/tailwind/plugin.js +6 -0
- package/dist/tailwind/{purger/index.cjs → purger.cjs} +1 -1
- package/dist/tailwind/{purger/index.d.ts → purger.d.cts} +1 -1
- package/dist/tailwind/{purger/index.d.cts → purger.d.ts} +1 -1
- package/dist/tailwind/{purger/index.js → purger.js} +1 -1
- package/dist/tailwind/utils.cjs +25 -0
- package/dist/tailwind/utils.d.cts +13 -0
- package/dist/tailwind/utils.d.ts +13 -0
- package/dist/tailwind/utils.js +13 -0
- package/dist/tokens/automation/configs/index.cjs +1 -2
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +0 -1
- package/dist/tokens/automation/index.d.cts +2 -2
- package/dist/tokens/automation/index.d.ts +2 -2
- package/dist/tokens/automation/index.js +2 -2
- package/dist/tokens/automation/properties.d.cts +2 -2
- package/dist/tokens/automation/properties.d.ts +2 -2
- package/dist/tokens/configs/typography.cjs +0 -15
- package/dist/tokens/configs/typography.d.cts +2 -6
- package/dist/tokens/configs/typography.d.ts +2 -6
- package/dist/tokens/configs/typography.js +1 -15
- package/dist/tokens/consts/cssTokens.cjs +1 -1
- package/dist/tokens/consts/cssTokens.d.cts +2 -2
- package/dist/tokens/consts/cssTokens.d.ts +2 -2
- package/dist/tokens/consts/cssTokens.js +2 -2
- package/dist/tokens/index.cjs +2 -7
- package/dist/tokens/index.d.cts +4 -6
- package/dist/tokens/index.d.ts +4 -6
- package/dist/tokens/index.js +4 -6
- package/dist/tokens/parseTokens.cjs +2 -133
- package/dist/tokens/parseTokens.d.cts +2 -30
- package/dist/tokens/parseTokens.d.ts +2 -30
- package/dist/tokens/parseTokens.js +1 -132
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +2 -25
- package/dist/types/dist/index.d.ts +2 -25
- package/dist/uds/generated/tailwindPurge.cjs +2 -31
- package/dist/uds/generated/tailwindPurge.js +2 -31
- package/dist/uds/package.cjs +284 -0
- package/dist/uds/package.js +278 -0
- package/dist/utils/fromEntries.cjs +18 -0
- package/dist/utils/fromEntries.d.cts +13 -0
- package/dist/utils/fromEntries.d.ts +13 -0
- package/dist/utils/fromEntries.js +16 -0
- package/package.json +15 -28
- package/dist/cli/commands/purge.cjs +0 -26
- package/dist/cli/commands/purge.d.cts +0 -15
- package/dist/cli/commands/purge.d.ts +0 -15
- package/dist/cli/commands/purge.js +0 -25
- package/dist/cli/commands/utils/purgeCSS.d.cts +0 -59
- package/dist/cli/commands/utils/purgeCSS.d.ts +0 -59
- package/dist/components/client/Tooltip/Tooltip.cjs +0 -37
- package/dist/components/client/Tooltip/Tooltip.d.cts +0 -16
- package/dist/components/client/Tooltip/Tooltip.d.ts +0 -16
- package/dist/components/client/Tooltip/Tooltip.js +0 -35
- package/dist/components/client/Tooltip/TooltipContent.cjs +0 -173
- package/dist/components/client/Tooltip/TooltipContent.d.cts +0 -8
- package/dist/components/client/Tooltip/TooltipContent.d.ts +0 -8
- package/dist/components/client/Tooltip/TooltipContent.js +0 -171
- package/dist/components/client/Tooltip/TooltipTrigger.cjs +0 -20
- package/dist/components/client/Tooltip/TooltipTrigger.d.cts +0 -13
- package/dist/components/client/Tooltip/TooltipTrigger.d.ts +0 -13
- package/dist/components/client/Tooltip/TooltipTrigger.js +0 -18
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.cjs +0 -41
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.cts +0 -29
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.ts +0 -29
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.js +0 -38
- package/dist/components/client/Tooltip/index.cjs +0 -12
- package/dist/components/client/Tooltip/index.d.cts +0 -7
- package/dist/components/client/Tooltip/index.d.ts +0 -7
- package/dist/components/client/Tooltip/index.js +0 -8
- package/dist/components/client/Tooltip/tooltipContext.cjs +0 -12
- package/dist/components/client/Tooltip/tooltipContext.d.cts +0 -12
- package/dist/components/client/Tooltip/tooltipContext.d.ts +0 -12
- package/dist/components/client/Tooltip/tooltipContext.js +0 -10
- package/dist/components/client/Tooltip/useTooltipContent.cjs +0 -186
- package/dist/components/client/Tooltip/useTooltipContent.d.cts +0 -63
- package/dist/components/client/Tooltip/useTooltipContent.d.ts +0 -63
- package/dist/components/client/Tooltip/useTooltipContent.js +0 -184
- package/dist/components/client/Tooltip/util.cjs +0 -248
- package/dist/components/client/Tooltip/util.d.cts +0 -118
- package/dist/components/client/Tooltip/util.d.ts +0 -118
- package/dist/components/client/Tooltip/util.js +0 -240
- package/dist/fixtures/dist/arbitrary.d.cts +0 -11
- package/dist/fixtures/dist/arbitrary.d.ts +0 -11
- package/dist/fixtures/src/arbitrary.cjs +0 -23
- package/dist/fixtures/src/arbitrary.d.cts +0 -15
- package/dist/fixtures/src/arbitrary.d.ts +0 -15
- package/dist/fixtures/src/arbitrary.js +0 -18
- package/dist/fixtures/src/util.cjs +0 -26
- package/dist/fixtures/src/util.d.cts +0 -9
- package/dist/fixtures/src/util.d.ts +0 -9
- package/dist/fixtures/src/util.js +0 -25
- package/dist/runtime/tooltipConfig.cjs +0 -32
- package/dist/runtime/tooltipConfig.d.cts +0 -19
- package/dist/runtime/tooltipConfig.d.ts +0 -19
- package/dist/runtime/tooltipConfig.js +0 -31
- package/dist/tailwind/base/addColorModeVars.cjs +0 -22
- package/dist/tailwind/base/addColorModeVars.d.cts +0 -11
- package/dist/tailwind/base/addColorModeVars.d.ts +0 -11
- package/dist/tailwind/base/addColorModeVarsV2.d.cts +0 -11
- package/dist/tailwind/base/addColorModeVarsV2.d.ts +0 -11
- package/dist/tailwind/base/addFontFaceDeclarations.cjs +0 -12
- package/dist/tailwind/base/addFontFaceDeclarations.d.cts +0 -11
- package/dist/tailwind/base/addFontFaceDeclarations.d.ts +0 -11
- package/dist/tailwind/base/addFontVars.cjs +0 -11
- package/dist/tailwind/base/addFontVars.d.cts +0 -11
- package/dist/tailwind/base/addFontVars.d.ts +0 -11
- package/dist/tailwind/base/addMotionVars.cjs +0 -11
- package/dist/tailwind/base/addMotionVars.d.cts +0 -11
- package/dist/tailwind/base/addMotionVars.d.ts +0 -11
- package/dist/tailwind/base/addScaleModeVars.d.cts +0 -10
- package/dist/tailwind/base/addScaleModeVars.d.ts +0 -10
- package/dist/tailwind/components/getFocusRingStyles.d.cts +0 -14
- package/dist/tailwind/components/getFocusRingStyles.d.ts +0 -14
- package/dist/tailwind/components/getGroupedTextStyles.cjs +0 -21
- package/dist/tailwind/components/getGroupedTextStyles.d.cts +0 -26
- package/dist/tailwind/components/getGroupedTextStyles.d.ts +0 -26
- package/dist/tailwind/components/getHitTargetStyles.d.cts +0 -8
- package/dist/tailwind/components/getHitTargetStyles.d.ts +0 -8
- package/dist/tailwind/components/getIconStyles.d.cts +0 -10
- package/dist/tailwind/components/getIconStyles.d.ts +0 -10
- package/dist/tailwind/components/getInputStyles.d.cts +0 -10
- package/dist/tailwind/components/getInputStyles.d.ts +0 -10
- package/dist/tailwind/components/getResponsiveTextStyles.cjs +0 -74
- package/dist/tailwind/components/getResponsiveTextStyles.d.cts +0 -39
- package/dist/tailwind/components/getResponsiveTextStyles.d.ts +0 -39
- package/dist/tailwind/components/types.cjs +0 -1
- package/dist/tailwind/components/types.js +0 -1
- package/dist/tailwind/plugins/a11y.d.cts +0 -14
- package/dist/tailwind/plugins/a11y.d.ts +0 -14
- package/dist/tailwind/plugins/blurBgFallback.cjs +0 -30
- package/dist/tailwind/plugins/blurBgFallback.d.cts +0 -14
- package/dist/tailwind/plugins/blurBgFallback.d.ts +0 -14
- package/dist/tailwind/plugins/blurBgFallback.js +0 -27
- package/dist/tailwind/plugins/borderRadius.d.cts +0 -28
- package/dist/tailwind/plugins/borderRadius.d.ts +0 -28
- package/dist/tailwind/plugins/borderWidth.d.cts +0 -16
- package/dist/tailwind/plugins/borderWidth.d.ts +0 -16
- package/dist/tailwind/plugins/breakpoints.cjs +0 -37
- package/dist/tailwind/plugins/breakpoints.d.cts +0 -42
- package/dist/tailwind/plugins/breakpoints.d.ts +0 -42
- package/dist/tailwind/plugins/colors.d.cts +0 -14
- package/dist/tailwind/plugins/colors.d.ts +0 -14
- package/dist/tailwind/plugins/components.cjs +0 -32
- package/dist/tailwind/plugins/components.d.cts +0 -14
- package/dist/tailwind/plugins/components.d.ts +0 -14
- package/dist/tailwind/plugins/elevation.cjs +0 -38
- package/dist/tailwind/plugins/elevation.d.cts +0 -14
- package/dist/tailwind/plugins/elevation.d.ts +0 -14
- package/dist/tailwind/plugins/icons.cjs +0 -14
- package/dist/tailwind/plugins/icons.d.cts +0 -14
- package/dist/tailwind/plugins/icons.d.ts +0 -14
- package/dist/tailwind/plugins/input.d.cts +0 -17
- package/dist/tailwind/plugins/input.d.ts +0 -17
- package/dist/tailwind/plugins/motion.cjs +0 -15
- package/dist/tailwind/plugins/motion.d.cts +0 -14
- package/dist/tailwind/plugins/motion.d.ts +0 -14
- package/dist/tailwind/plugins/nestedBorderRadius.d.cts +0 -14
- package/dist/tailwind/plugins/nestedBorderRadius.d.ts +0 -14
- package/dist/tailwind/plugins/scaleMode.cjs +0 -18
- package/dist/tailwind/plugins/scaleMode.d.cts +0 -17
- package/dist/tailwind/plugins/scaleMode.d.ts +0 -17
- package/dist/tailwind/plugins/shadows.cjs +0 -46
- package/dist/tailwind/plugins/shadows.d.cts +0 -14
- package/dist/tailwind/plugins/shadows.d.ts +0 -14
- package/dist/tailwind/plugins/sizing.d.cts +0 -17
- package/dist/tailwind/plugins/sizing.d.ts +0 -17
- package/dist/tailwind/plugins/spacing.d.cts +0 -14
- package/dist/tailwind/plugins/spacing.d.ts +0 -14
- package/dist/tailwind/plugins/typography.cjs +0 -73
- package/dist/tailwind/plugins/typography.d.cts +0 -14
- package/dist/tailwind/plugins/typography.d.ts +0 -14
- package/dist/tailwind/postcss.config.cjs +0 -9
- package/dist/tailwind/postcss.config.d.cts +0 -2
- package/dist/tailwind/postcss.config.d.ts +0 -2
- package/dist/tailwind/postcss.config.js +0 -13
- package/dist/tailwind/tailwind.config.cjs +0 -30
- package/dist/tailwind/tailwind.config.d.cts +0 -19
- package/dist/tailwind/tailwind.config.d.ts +0 -20
- package/dist/tailwind/tailwind.config.js +0 -30
- package/dist/tailwind/tailwindPlugin.cjs +0 -40
- package/dist/tailwind/tailwindPlugin.js +0 -37
- package/dist/tailwind/theme/getFontFamilyTheme.cjs +0 -25
- package/dist/tailwind/theme/getFontFamilyTheme.d.cts +0 -7
- package/dist/tailwind/theme/getFontFamilyTheme.d.ts +0 -7
- package/dist/tailwind/tsMorph.cjs +0 -12
- package/dist/tailwind/tsMorph.d.cts +0 -3
- package/dist/tailwind/tsMorph.d.ts +0 -3
- package/dist/tailwind/tsMorph.js +0 -4
- package/dist/tailwind/utils/addFontsPlugin.cjs +0 -16
- package/dist/tailwind/utils/flattenColorPalette.d.cts +0 -5
- package/dist/tailwind/utils/flattenColorPalette.d.ts +0 -5
- package/dist/tailwind/utils/getElevationStyles.cjs +0 -33
- package/dist/tailwind/utils/getMotionStyles.cjs +0 -39
- package/dist/tailwind/utils/getNestedBorderRadiusUtilities.d.cts +0 -27
- package/dist/tailwind/utils/getNestedBorderRadiusUtilities.d.ts +0 -27
- package/dist/tailwind/utils/getShadowStyles.d.cts +0 -22
- package/dist/tailwind/utils/getShadowStyles.d.ts +0 -22
- package/dist/tailwind/utils/getShadowVars.cjs +0 -27
- package/dist/tailwind/utils/getShadowVars.d.cts +0 -8
- package/dist/tailwind/utils/getShadowVars.d.ts +0 -8
- package/dist/tailwind/utils/getShadowVars.js +0 -26
- package/dist/tailwind/utils/getTailwindAsUdsColors.d.cts +0 -9
- package/dist/tailwind/utils/getTailwindAsUdsColors.d.ts +0 -9
- package/dist/tailwind/utils/index.cjs +0 -25
- package/dist/tailwind/utils/index.d.cts +0 -12
- package/dist/tailwind/utils/index.d.ts +0 -12
- package/dist/tailwind/utils/index.js +0 -13
- package/dist/tokens/utils/opacity.d.cts +0 -20
- package/dist/tokens/utils/opacity.d.ts +0 -20
- package/dist/uds/scripts/utils/tsMorph.d.cts +0 -33
- package/dist/uds/scripts/utils/tsMorph.d.ts +0 -33
- package/dist/utils/getMotionVar.cjs +0 -16
- package/dist/utils/getMotionVar.d.cts +0 -17
- package/dist/utils/getMotionVar.d.ts +0 -17
- package/dist/utils/getMotionVar.js +0 -15
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { defaultTokensConfig } from "../../../config/dist/index.js";
|
|
3
|
+
import { autoVariants } from "../../../automated-config/dist/generated/autoVariants.js";
|
|
4
|
+
import { red } from "../../../cli/dist/lib/colors.js";
|
|
5
|
+
import { print } from "../../../cli/dist/lib/print.js";
|
|
6
|
+
import { tailwindPlugin } from "../plugin.js";
|
|
7
|
+
import { findReferencesAsJsxElements, getReactFunctionDeclaration, getUsedPropsInReference } from "./tsMorph.js";
|
|
8
|
+
import { SyntaxKind } from "ts-morph";
|
|
9
|
+
import postcss from "postcss";
|
|
10
|
+
import tailwindcss from "tailwindcss";
|
|
11
|
+
|
|
12
|
+
//#region ../tailwind/dist/utils/generatePurgeCSSData.js
|
|
13
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
14
|
+
const NO_FILE = "noFile";
|
|
15
|
+
/**
|
|
16
|
+
* Returns a list of exported Components from UDS
|
|
17
|
+
* both stable and experimental
|
|
18
|
+
*/
|
|
19
|
+
const getExportedComponents = (UDS, UDS_EXPERIMENTAL) => {
|
|
20
|
+
const udsStableExports = Object.keys(UDS);
|
|
21
|
+
const udsExperimentalExports = Object.keys(UDS_EXPERIMENTAL);
|
|
22
|
+
return udsStableExports.concat(udsExperimentalExports).filter((key) => {
|
|
23
|
+
const regexStartsWithCapitalLetter = /* @__PURE__ */ new RegExp("^[A-Z].[^_]");
|
|
24
|
+
const hasUnderscore = key.includes("_");
|
|
25
|
+
const startsWithCapitalLetter = regexStartsWithCapitalLetter.test(key);
|
|
26
|
+
return !hasUnderscore && startsWithCapitalLetter;
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Some UDS components are built using other UDS components,
|
|
31
|
+
* we need to know those dependencies so generate the correct
|
|
32
|
+
*/
|
|
33
|
+
const getComponentsDependencies = (project, componentsList, exportsToFilePath) => {
|
|
34
|
+
const componentsListSet = new Set(componentsList);
|
|
35
|
+
const componentUDSDependencies = {};
|
|
36
|
+
componentsList.forEach((component) => {
|
|
37
|
+
componentUDSDependencies[component] = getComponentUdsDependencies(project, componentsListSet, component, exportsToFilePath);
|
|
38
|
+
});
|
|
39
|
+
return componentUDSDependencies;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* We need to make sure that components from UDS that use other components
|
|
43
|
+
* from UDS also gets included
|
|
44
|
+
*/
|
|
45
|
+
const getComponentUdsDependencies = (project, componentsList, componentName, exportsToFilePath) => {
|
|
46
|
+
return project.getSourceFileOrThrow(exportsToFilePath[componentName]).getImportDeclarations().map((declaration) => {
|
|
47
|
+
return declaration.getNamedImports().map((namedImport) => namedImport.getName());
|
|
48
|
+
}).flat().filter((namedImport) => componentsList.has(namedImport));
|
|
49
|
+
};
|
|
50
|
+
const getComponentsProps = (project, list, variants, variantsList, exportsToFilePath) => {
|
|
51
|
+
const map = {};
|
|
52
|
+
list.forEach((componentName) => {
|
|
53
|
+
map[componentName] = getInitializedAndReferencedProps(project, componentName, variants, variantsList, exportsToFilePath);
|
|
54
|
+
});
|
|
55
|
+
return map;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Converts the variants object used in CVA to
|
|
59
|
+
*/
|
|
60
|
+
const convertVariantsIntoTailwindClass = (variants) => {
|
|
61
|
+
return Object.keys(variants);
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Get the params with default values,
|
|
65
|
+
* required and the ones used in references
|
|
66
|
+
*/
|
|
67
|
+
const getInitializedAndReferencedProps = (project, componentName, variants, variantsList, exportsToFilePath) => {
|
|
68
|
+
const sourceFile = project.getSourceFileOrThrow(exportsToFilePath[componentName] ?? NO_FILE);
|
|
69
|
+
const functionDeclarations = sourceFile.getFunctions();
|
|
70
|
+
const variableDeclarations = sourceFile.getVariableDeclarations();
|
|
71
|
+
const node = [...functionDeclarations, ...variableDeclarations].filter((declaration) => declaration.getName() === componentName)[0];
|
|
72
|
+
const functionDeclaration = getReactFunctionDeclaration(node);
|
|
73
|
+
if (!functionDeclaration) print(red(`No function declaration found for ${componentName}`));
|
|
74
|
+
const parameterDeclaration = functionDeclaration?.getParameters();
|
|
75
|
+
if (!parameterDeclaration || parameterDeclaration.length === 0) {
|
|
76
|
+
print(red(`No parameter declaration found for ${componentName}`));
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
if (!parameterDeclaration[0].getChildrenOfKind(SyntaxKind.ObjectBindingPattern)[0]) return [];
|
|
80
|
+
const references = findReferencesAsJsxElements(node.getFirstDescendantByKindOrThrow(SyntaxKind.Identifier));
|
|
81
|
+
const propsWithDefaultValues = parameterDeclaration[0].getChildrenOfKind(SyntaxKind.ObjectBindingPattern)[0].getElements().filter((el) => !!el.getInitializer()).map((el) => {
|
|
82
|
+
const stringLiteral = el.getDescendantsOfKind(SyntaxKind.StringLiteral)[0];
|
|
83
|
+
const propName = el.getName();
|
|
84
|
+
const values = [];
|
|
85
|
+
if (stringLiteral) values.push(stringLiteral.getLiteralText());
|
|
86
|
+
return [propName, values];
|
|
87
|
+
}).filter(([propName]) => variantsList.includes(propName));
|
|
88
|
+
const propsUsedInReferences = references.map((r) => getUsedPropsInReference(r, variants)).flat().filter(([propName]) => variantsList.includes(propName));
|
|
89
|
+
const mapPropToUsedOptions = /* @__PURE__ */ new Map();
|
|
90
|
+
propsWithDefaultValues.concat(propsUsedInReferences).forEach(([propName, propValues]) => {
|
|
91
|
+
if (propValues.length === 0) propValues = Object.keys(variants[propName]);
|
|
92
|
+
const options = mapPropToUsedOptions.get(propName) ?? /* @__PURE__ */ new Set();
|
|
93
|
+
propValues.forEach((val) => options.add(val));
|
|
94
|
+
mapPropToUsedOptions.set(propName, options);
|
|
95
|
+
});
|
|
96
|
+
return Array.from(mapPropToUsedOptions).map(([propName, options]) => [propName, Array.from(options)]);
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Gets the Tailwind CSS classes used in a component
|
|
100
|
+
*/
|
|
101
|
+
const getTwClassesInComponent = async (componentsList, exportsToFilePath) => {
|
|
102
|
+
const CSS_DATA = `
|
|
103
|
+
@tailwind components;
|
|
104
|
+
@tailwind utilities;
|
|
105
|
+
`;
|
|
106
|
+
const res = {};
|
|
107
|
+
const promises = componentsList.map((component) => {
|
|
108
|
+
return postcss([tailwindcss({
|
|
109
|
+
content: [exportsToFilePath[component]],
|
|
110
|
+
plugins: [tailwindPlugin({ config: defaultTokensConfig })]
|
|
111
|
+
})]).process(CSS_DATA, {
|
|
112
|
+
from: "app.css",
|
|
113
|
+
to: "./dist/app.css"
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
(await Promise.all(promises)).forEach((result, i) => {
|
|
117
|
+
const currentComponent = componentsList[i];
|
|
118
|
+
res[currentComponent] = result.root.nodes.map((node) => {
|
|
119
|
+
if (node.selector) return node.selector.replace(".", "");
|
|
120
|
+
return [];
|
|
121
|
+
}).join(" ").replace(/\s+/g, " ");
|
|
122
|
+
});
|
|
123
|
+
return res;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Goes through the list of all exports from UDS (stable and experimental)
|
|
127
|
+
* and return a map of each exports and the source file path where its declared
|
|
128
|
+
*/
|
|
129
|
+
const getExportsToFilePath = (project) => {
|
|
130
|
+
const stableComponentsMainFile = project.getSourceFileOrThrow("./src/components/index.ts");
|
|
131
|
+
const experimentalComponentsMainFile = project.getSourceFileOrThrow("./src/components/experimental/index.ts");
|
|
132
|
+
const exportToFilePath = {};
|
|
133
|
+
for (const [name, declarations] of stableComponentsMainFile.getExportedDeclarations()) exportToFilePath[name] = declarations.map((d) => d.getSourceFile().getFilePath())[0];
|
|
134
|
+
for (const [name, declarations] of experimentalComponentsMainFile.getExportedDeclarations()) exportToFilePath[name] = declarations.map((d) => d.getSourceFile().getFilePath())[0];
|
|
135
|
+
return exportToFilePath;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Adds auto-generated variants to the Tailwind CSS classes of components.
|
|
139
|
+
*
|
|
140
|
+
* This function extracts component names from auto variants keys, groups class names by component,
|
|
141
|
+
* updates component classes using auto-generated variant classes, and propagates base classes to subcomponents.
|
|
142
|
+
*
|
|
143
|
+
* @param componentToTwClasses - A map of component names to their current Tailwind CSS classes.
|
|
144
|
+
* @returns Updated map with auto variants added to the component classes.
|
|
145
|
+
*/
|
|
146
|
+
const addAutoVariantsToComponentClasses = (componentToTwClasses) => {
|
|
147
|
+
const componentNameRegex = /^([a-z]+)[A-Z]/;
|
|
148
|
+
const componentNameMap = {};
|
|
149
|
+
const componentNameLookup = /* @__PURE__ */ new Map();
|
|
150
|
+
Object.keys(componentToTwClasses).forEach((actualName) => {
|
|
151
|
+
componentNameLookup.set(actualName.toLowerCase(), actualName);
|
|
152
|
+
});
|
|
153
|
+
Object.keys(autoVariants).forEach((key) => {
|
|
154
|
+
const match = key.match(componentNameRegex);
|
|
155
|
+
if (match && match[1]) {
|
|
156
|
+
const extractedName = match[1].charAt(0).toUpperCase() + match[1].slice(1);
|
|
157
|
+
const actualComponentName = componentNameLookup.get(extractedName.toLowerCase()) || extractedName;
|
|
158
|
+
if (!componentNameMap[actualComponentName]) componentNameMap[actualComponentName] = [];
|
|
159
|
+
Object.values(autoVariants[key]).forEach((className) => {
|
|
160
|
+
componentNameMap[actualComponentName].push(className);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
Object.entries(componentNameMap).forEach(([componentName, classes]) => {
|
|
165
|
+
componentToTwClasses[componentName] = `${componentToTwClasses[componentName] || ""} ${classes.join(" ")}`.trim();
|
|
166
|
+
});
|
|
167
|
+
const components = Object.keys(componentNameMap);
|
|
168
|
+
Object.keys(componentToTwClasses).forEach((key) => {
|
|
169
|
+
components.forEach((comp) => {
|
|
170
|
+
const compName = comp.charAt(0).toUpperCase() + comp.slice(1);
|
|
171
|
+
if (key.startsWith(compName) && key !== compName) {
|
|
172
|
+
const baseClasses = componentToTwClasses[compName] || "";
|
|
173
|
+
if (baseClasses) componentToTwClasses[key] = `${componentToTwClasses[key]} ${baseClasses}`.trim();
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
return componentToTwClasses;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
export { addAutoVariantsToComponentClasses, convertVariantsIntoTailwindClass, getComponentsDependencies, getComponentsProps, getExportedComponents, getExportsToFilePath, getTwClassesInComponent };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
|
|
3
|
+
//#region ../tailwind/dist/utils/mapValues.js
|
|
4
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
5
|
+
function mapValues(obj, callbackFn) {
|
|
6
|
+
return Object.keys(obj).reduce((acc, key, i) => {
|
|
7
|
+
acc[key] = callbackFn(obj[key], key, i);
|
|
8
|
+
return acc;
|
|
9
|
+
}, {});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.mapValues = mapValues;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
//#region ../tailwind/dist/utils/mapValues.js
|
|
3
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
4
|
+
function mapValues(obj, callbackFn) {
|
|
5
|
+
return Object.keys(obj).reduce((acc, key, i) => {
|
|
6
|
+
acc[key] = callbackFn(obj[key], key, i);
|
|
7
|
+
return acc;
|
|
8
|
+
}, {});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { mapValues };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
let lodash_clamp_js = require("lodash/clamp.js");
|
|
5
|
-
lodash_clamp_js = require_runtime.__toESM(lodash_clamp_js);
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let lodash_es = require("lodash-es");
|
|
6
4
|
|
|
7
|
-
//#region
|
|
5
|
+
//#region ../tailwind/dist/utils/opacity.js
|
|
6
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
8
7
|
/**
|
|
9
8
|
* Converts a number or string to a valid OpacityStep.
|
|
10
9
|
*
|
|
@@ -21,7 +20,7 @@ function parseOpacityStep(opacity) {
|
|
|
21
20
|
if (opacity === void 0 || opacity === null) throw new Error(`Invalid opacity value: ${opacity}`);
|
|
22
21
|
const parsed = typeof opacity === "number" ? opacity : parseInt(opacity, 10);
|
|
23
22
|
if (isNaN(parsed)) throw new Error(`Invalid opacity value: cannot parse "${opacity}" as a number`);
|
|
24
|
-
return (0,
|
|
23
|
+
return (0, lodash_es.clamp)(parsed, 0, 100).toString();
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
//#endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
2
|
import { clamp } from "lodash-es";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../tailwind/dist/utils/opacity.js
|
|
5
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
5
6
|
/**
|
|
6
7
|
* Converts a number or string to a valid OpacityStep.
|
|
7
8
|
*
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_index = require('../../../palette/dist/index.cjs');
|
|
3
|
+
const require_index$1 = require('../../../css-tokens/dist/index.cjs');
|
|
4
|
+
const require_entries = require('./entries.cjs');
|
|
5
|
+
const require_mapValues = require('./mapValues.cjs');
|
|
6
|
+
const require_opacity = require('./opacity.cjs');
|
|
7
|
+
|
|
8
|
+
//#region ../tailwind/dist/utils/parseTokens.js
|
|
9
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
10
|
+
function shouldIncludeOpacity(opacity) {
|
|
11
|
+
if (!opacity) return false;
|
|
12
|
+
const parsedOpacity = parseInt(opacity, 10);
|
|
13
|
+
return !isNaN(parsedOpacity) && parsedOpacity !== 100;
|
|
14
|
+
}
|
|
15
|
+
function transformColors(colors, elevationPresets) {
|
|
16
|
+
const { palette, spectrum } = colors;
|
|
17
|
+
const rootVars = {};
|
|
18
|
+
const tailwindConfig = {
|
|
19
|
+
spectrum: {},
|
|
20
|
+
palette: {}
|
|
21
|
+
};
|
|
22
|
+
for (const [hue, hueSteps] of require_entries.entries(spectrum)) for (const [hueStep, value] of require_entries.entries(hueSteps)) {
|
|
23
|
+
const varKey = `--${require_index$1.SPECTRUM_COLOR_PREFIX}-${`${hue}-${hueStep}`}`;
|
|
24
|
+
if (!tailwindConfig.spectrum[hue]) tailwindConfig.spectrum[hue] = {};
|
|
25
|
+
tailwindConfig.spectrum[hue][hueStep] = `rgb(var(${varKey}))`;
|
|
26
|
+
rootVars[varKey] = value;
|
|
27
|
+
}
|
|
28
|
+
require_entries.entries(palette).forEach(([paletteType, paletteConfig]) => {
|
|
29
|
+
for (const [paletteKey, { hue, step, opacity }] of Object.entries(paletteConfig)) {
|
|
30
|
+
if (!(paletteType in tailwindConfig.palette)) tailwindConfig.palette[paletteType] = {};
|
|
31
|
+
const name = `--${require_index$1.UDS_PREFIX}-${paletteType}-color-${paletteKey}`;
|
|
32
|
+
rootVars[name] = `var(--${require_index$1.SPECTRUM_COLOR_PREFIX}-${hue}-${step})`;
|
|
33
|
+
const opacityValue = opacity !== void 0 ? require_opacity.parseOpacityStep(opacity) : void 0;
|
|
34
|
+
tailwindConfig.palette[paletteType][paletteKey] = shouldIncludeOpacity(opacityValue) ? `rgb(var(${name}) / ${opacityValue}%)` : `rgb(var(${name}))`;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
require_entries.entries(elevationPresets).forEach(([level, elevationPreset]) => {
|
|
38
|
+
if (elevationPreset) require_entries.entries(elevationPreset).forEach(([key]) => {
|
|
39
|
+
if (key === "finalBackgroundValue") {
|
|
40
|
+
const { r, g, b, a } = elevationPreset[key];
|
|
41
|
+
const alpha = parseInt(a) / 100;
|
|
42
|
+
const name = `--${require_index$1.BACKGROUND_COLOR_PREFIX}-elevation-${level}`;
|
|
43
|
+
rootVars[name] = `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
44
|
+
}
|
|
45
|
+
if (key === "borderColor") {
|
|
46
|
+
const name = `--${require_index$1.LINE_COLOR_PREFIX}-elevation-${level}`;
|
|
47
|
+
switch (elevationPreset[key].type) {
|
|
48
|
+
case "always":
|
|
49
|
+
rootVars[name] = require_index.alwaysPalette[elevationPreset[key].value];
|
|
50
|
+
break;
|
|
51
|
+
case "spectrum":
|
|
52
|
+
rootVars[name] = `rgb(var(--${require_index$1.SPECTRUM_COLOR_PREFIX}-${elevationPreset[key].value.hue}-${elevationPreset[key].value.step}))`;
|
|
53
|
+
break;
|
|
54
|
+
case "line":
|
|
55
|
+
rootVars[name] = `rgb(var(--${require_index$1.LINE_COLOR_PREFIX}-${elevationPreset[key].value}))`;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (key === "borderWidth") {
|
|
60
|
+
const name = `--${require_index$1.BORDER_WIDTH_PREFIX}-elevation-${level}`;
|
|
61
|
+
rootVars[name] = `var(--${require_index$1.BORDER_WIDTH_PREFIX}-${elevationPreset[key]})`;
|
|
62
|
+
}
|
|
63
|
+
if (key === "dropShadow") {
|
|
64
|
+
const name = `--${require_index$1.DROP_SHADOW_PREFIX}-elevation-${level}`;
|
|
65
|
+
const configValue = elevationPreset[key];
|
|
66
|
+
rootVars[name] = Array.isArray(configValue) ? configValue.map((preset, index) => require_index$1.getShadowLayerValue({
|
|
67
|
+
preset,
|
|
68
|
+
prefix: index > 0 ? `${index + 1}` : void 0,
|
|
69
|
+
shadowType: "drop"
|
|
70
|
+
})).join(", ") : `var(--${require_index$1.DROP_SHADOW_PREFIX}-${elevationPreset[key]})`;
|
|
71
|
+
}
|
|
72
|
+
if (key === "backgroundBlurRadius") {
|
|
73
|
+
const name = `--${require_index$1.BACKGROUND_BLUR_RADIUS_PREFIX}-elevation-${level}`;
|
|
74
|
+
rootVars[name] = `blur(${elevationPreset[key]}px)`;
|
|
75
|
+
}
|
|
76
|
+
if (key === "fallbackBlurredBackgroundValue") {
|
|
77
|
+
const { r, g, b } = elevationPreset[key];
|
|
78
|
+
const name = `--${require_index$1.BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX}-elevation-${level}`;
|
|
79
|
+
rootVars[name] = `rgb(${r}, ${g}, ${b})`;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
_vars: rootVars,
|
|
85
|
+
_raw: colors,
|
|
86
|
+
tailwindConfig
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function transformNumericToPx(prefix, config) {
|
|
90
|
+
if (!config) return {
|
|
91
|
+
_vars: {},
|
|
92
|
+
_raw: {},
|
|
93
|
+
tailwindConfig: {}
|
|
94
|
+
};
|
|
95
|
+
const rootVars = {};
|
|
96
|
+
const tailwindConfig = {};
|
|
97
|
+
for (const [variant, value] of require_entries.entries(config)) {
|
|
98
|
+
const rootVarKey = `--${prefix}-${variant}`;
|
|
99
|
+
rootVars[rootVarKey] = `${value}px`;
|
|
100
|
+
tailwindConfig[variant] = `var(${rootVarKey})`;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
_vars: rootVars,
|
|
104
|
+
_raw: config,
|
|
105
|
+
tailwindConfig
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function getElevationPresetsForColorMode(colorMode, config) {
|
|
109
|
+
if (!config.elevation) return {};
|
|
110
|
+
const result = {};
|
|
111
|
+
require_entries.entries(config.elevation).forEach(([level, levelPreset]) => {
|
|
112
|
+
result[level] = levelPreset[colorMode];
|
|
113
|
+
});
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
function parseTokens(config) {
|
|
117
|
+
const { colorMode, scaleMode } = config;
|
|
118
|
+
return {
|
|
119
|
+
...config,
|
|
120
|
+
colorMode: {
|
|
121
|
+
light: transformColors(colorMode.light, getElevationPresetsForColorMode("light", config)),
|
|
122
|
+
dark: transformColors(colorMode.dark, getElevationPresetsForColorMode("dark", config))
|
|
123
|
+
},
|
|
124
|
+
scaleMode: require_mapValues.mapValues(scaleMode, ({ borderRadius, borderWidth, avatarSizes, iconSizes }) => {
|
|
125
|
+
return {
|
|
126
|
+
borderRadius: transformNumericToPx(require_index$1.BORDER_RADIUS_PREFIX, borderRadius),
|
|
127
|
+
borderWidth: transformNumericToPx(require_index$1.BORDER_WIDTH_PREFIX, borderWidth),
|
|
128
|
+
avatarSizes: transformNumericToPx(require_index$1.AVATAR_SIZE_PREFIX, avatarSizes),
|
|
129
|
+
iconSizes: transformNumericToPx(require_index$1.ICON_SIZE_PREFIX, iconSizes)
|
|
130
|
+
};
|
|
131
|
+
})
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
exports.parseTokens = parseTokens;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
import { ColorMode, ColorsConfig, ElevationLevel, ElevationPreset, Hue, HueStep, PaletteConfig, PaletteType, ScaleMode } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { UniversalTokensConfig } from "../../../config/dist/index.cjs";
|
|
4
|
+
|
|
5
|
+
//#region ../tailwind/dist/utils/parseTokens.d.ts
|
|
6
|
+
//#region src/utils/parseTokens.d.ts
|
|
7
|
+
type ColorModeElevationPresets = Partial<Record<ElevationLevel, ElevationPreset>>;
|
|
8
|
+
declare function transformColors(colors: ColorsConfig, elevationPresets: ColorModeElevationPresets): {
|
|
9
|
+
_vars: Record<string, string>;
|
|
10
|
+
_raw: ColorsConfig;
|
|
11
|
+
tailwindConfig: {
|
|
12
|
+
spectrum: Record<Hue, Record<HueStep, string>>;
|
|
13
|
+
palette: { [key in PaletteType]: Record<keyof PaletteConfig[key], string> };
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
declare function transformNumericToPx<T extends Record<string, number>>(prefix: string, config: T): {
|
|
17
|
+
_vars: Record<string, string>;
|
|
18
|
+
_raw: Record<string, number>;
|
|
19
|
+
tailwindConfig: Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
type WebTokens = Omit<UniversalTokensConfig, 'colorMode' | 'scaleMode' | 'fontFamily'> & {
|
|
22
|
+
colorMode: Record<ColorMode, ReturnType<typeof transformColors>>;
|
|
23
|
+
scaleMode: Record<ScaleMode, {
|
|
24
|
+
borderRadius: ReturnType<typeof transformNumericToPx>;
|
|
25
|
+
borderWidth: ReturnType<typeof transformNumericToPx>;
|
|
26
|
+
avatarSizes: ReturnType<typeof transformNumericToPx>;
|
|
27
|
+
iconSizes: ReturnType<typeof transformNumericToPx>;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
declare function parseTokens(config: UniversalTokensConfig): WebTokens; //#endregion
|
|
31
|
+
//#endregion
|
|
32
|
+
export { type WebTokens, parseTokens };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
import { ColorMode, ColorsConfig, ElevationLevel, ElevationPreset, Hue, HueStep, PaletteConfig, PaletteType, ScaleMode } from "../../../types/dist/index.js";
|
|
3
|
+
import { UniversalTokensConfig } from "../../../config/dist/index.js";
|
|
4
|
+
|
|
5
|
+
//#region ../tailwind/dist/utils/parseTokens.d.ts
|
|
6
|
+
//#region src/utils/parseTokens.d.ts
|
|
7
|
+
type ColorModeElevationPresets = Partial<Record<ElevationLevel, ElevationPreset>>;
|
|
8
|
+
declare function transformColors(colors: ColorsConfig, elevationPresets: ColorModeElevationPresets): {
|
|
9
|
+
_vars: Record<string, string>;
|
|
10
|
+
_raw: ColorsConfig;
|
|
11
|
+
tailwindConfig: {
|
|
12
|
+
spectrum: Record<Hue, Record<HueStep, string>>;
|
|
13
|
+
palette: { [key in PaletteType]: Record<keyof PaletteConfig[key], string> };
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
declare function transformNumericToPx<T extends Record<string, number>>(prefix: string, config: T): {
|
|
17
|
+
_vars: Record<string, string>;
|
|
18
|
+
_raw: Record<string, number>;
|
|
19
|
+
tailwindConfig: Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
type WebTokens = Omit<UniversalTokensConfig, 'colorMode' | 'scaleMode' | 'fontFamily'> & {
|
|
22
|
+
colorMode: Record<ColorMode, ReturnType<typeof transformColors>>;
|
|
23
|
+
scaleMode: Record<ScaleMode, {
|
|
24
|
+
borderRadius: ReturnType<typeof transformNumericToPx>;
|
|
25
|
+
borderWidth: ReturnType<typeof transformNumericToPx>;
|
|
26
|
+
avatarSizes: ReturnType<typeof transformNumericToPx>;
|
|
27
|
+
iconSizes: ReturnType<typeof transformNumericToPx>;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
declare function parseTokens(config: UniversalTokensConfig): WebTokens; //#endregion
|
|
31
|
+
//#endregion
|
|
32
|
+
export { type WebTokens, parseTokens };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
import { alwaysPalette } from "../../../palette/dist/index.js";
|
|
3
|
+
import { AVATAR_SIZE_PREFIX, BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX, BACKGROUND_BLUR_RADIUS_PREFIX, BACKGROUND_COLOR_PREFIX, BORDER_RADIUS_PREFIX, BORDER_WIDTH_PREFIX, DROP_SHADOW_PREFIX, ICON_SIZE_PREFIX, LINE_COLOR_PREFIX, SPECTRUM_COLOR_PREFIX, UDS_PREFIX, getShadowLayerValue } from "../../../css-tokens/dist/index.js";
|
|
4
|
+
import { entries } from "./entries.js";
|
|
5
|
+
import { mapValues } from "./mapValues.js";
|
|
6
|
+
import { parseOpacityStep } from "./opacity.js";
|
|
7
|
+
|
|
8
|
+
//#region ../tailwind/dist/utils/parseTokens.js
|
|
9
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
10
|
+
function shouldIncludeOpacity(opacity) {
|
|
11
|
+
if (!opacity) return false;
|
|
12
|
+
const parsedOpacity = parseInt(opacity, 10);
|
|
13
|
+
return !isNaN(parsedOpacity) && parsedOpacity !== 100;
|
|
14
|
+
}
|
|
15
|
+
function transformColors(colors, elevationPresets) {
|
|
16
|
+
const { palette, spectrum } = colors;
|
|
17
|
+
const rootVars = {};
|
|
18
|
+
const tailwindConfig = {
|
|
19
|
+
spectrum: {},
|
|
20
|
+
palette: {}
|
|
21
|
+
};
|
|
22
|
+
for (const [hue, hueSteps] of entries(spectrum)) for (const [hueStep, value] of entries(hueSteps)) {
|
|
23
|
+
const varKey = `--${SPECTRUM_COLOR_PREFIX}-${`${hue}-${hueStep}`}`;
|
|
24
|
+
if (!tailwindConfig.spectrum[hue]) tailwindConfig.spectrum[hue] = {};
|
|
25
|
+
tailwindConfig.spectrum[hue][hueStep] = `rgb(var(${varKey}))`;
|
|
26
|
+
rootVars[varKey] = value;
|
|
27
|
+
}
|
|
28
|
+
entries(palette).forEach(([paletteType, paletteConfig]) => {
|
|
29
|
+
for (const [paletteKey, { hue, step, opacity }] of Object.entries(paletteConfig)) {
|
|
30
|
+
if (!(paletteType in tailwindConfig.palette)) tailwindConfig.palette[paletteType] = {};
|
|
31
|
+
const name = `--${UDS_PREFIX}-${paletteType}-color-${paletteKey}`;
|
|
32
|
+
rootVars[name] = `var(--${SPECTRUM_COLOR_PREFIX}-${hue}-${step})`;
|
|
33
|
+
const opacityValue = opacity !== void 0 ? parseOpacityStep(opacity) : void 0;
|
|
34
|
+
tailwindConfig.palette[paletteType][paletteKey] = shouldIncludeOpacity(opacityValue) ? `rgb(var(${name}) / ${opacityValue}%)` : `rgb(var(${name}))`;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
entries(elevationPresets).forEach(([level, elevationPreset]) => {
|
|
38
|
+
if (elevationPreset) entries(elevationPreset).forEach(([key]) => {
|
|
39
|
+
if (key === "finalBackgroundValue") {
|
|
40
|
+
const { r, g, b, a } = elevationPreset[key];
|
|
41
|
+
const alpha = parseInt(a) / 100;
|
|
42
|
+
const name = `--${BACKGROUND_COLOR_PREFIX}-elevation-${level}`;
|
|
43
|
+
rootVars[name] = `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
44
|
+
}
|
|
45
|
+
if (key === "borderColor") {
|
|
46
|
+
const name = `--${LINE_COLOR_PREFIX}-elevation-${level}`;
|
|
47
|
+
switch (elevationPreset[key].type) {
|
|
48
|
+
case "always":
|
|
49
|
+
rootVars[name] = alwaysPalette[elevationPreset[key].value];
|
|
50
|
+
break;
|
|
51
|
+
case "spectrum":
|
|
52
|
+
rootVars[name] = `rgb(var(--${SPECTRUM_COLOR_PREFIX}-${elevationPreset[key].value.hue}-${elevationPreset[key].value.step}))`;
|
|
53
|
+
break;
|
|
54
|
+
case "line":
|
|
55
|
+
rootVars[name] = `rgb(var(--${LINE_COLOR_PREFIX}-${elevationPreset[key].value}))`;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (key === "borderWidth") {
|
|
60
|
+
const name = `--${BORDER_WIDTH_PREFIX}-elevation-${level}`;
|
|
61
|
+
rootVars[name] = `var(--${BORDER_WIDTH_PREFIX}-${elevationPreset[key]})`;
|
|
62
|
+
}
|
|
63
|
+
if (key === "dropShadow") {
|
|
64
|
+
const name = `--${DROP_SHADOW_PREFIX}-elevation-${level}`;
|
|
65
|
+
const configValue = elevationPreset[key];
|
|
66
|
+
rootVars[name] = Array.isArray(configValue) ? configValue.map((preset, index) => getShadowLayerValue({
|
|
67
|
+
preset,
|
|
68
|
+
prefix: index > 0 ? `${index + 1}` : void 0,
|
|
69
|
+
shadowType: "drop"
|
|
70
|
+
})).join(", ") : `var(--${DROP_SHADOW_PREFIX}-${elevationPreset[key]})`;
|
|
71
|
+
}
|
|
72
|
+
if (key === "backgroundBlurRadius") {
|
|
73
|
+
const name = `--${BACKGROUND_BLUR_RADIUS_PREFIX}-elevation-${level}`;
|
|
74
|
+
rootVars[name] = `blur(${elevationPreset[key]}px)`;
|
|
75
|
+
}
|
|
76
|
+
if (key === "fallbackBlurredBackgroundValue") {
|
|
77
|
+
const { r, g, b } = elevationPreset[key];
|
|
78
|
+
const name = `--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX}-elevation-${level}`;
|
|
79
|
+
rootVars[name] = `rgb(${r}, ${g}, ${b})`;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
_vars: rootVars,
|
|
85
|
+
_raw: colors,
|
|
86
|
+
tailwindConfig
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function transformNumericToPx(prefix, config) {
|
|
90
|
+
if (!config) return {
|
|
91
|
+
_vars: {},
|
|
92
|
+
_raw: {},
|
|
93
|
+
tailwindConfig: {}
|
|
94
|
+
};
|
|
95
|
+
const rootVars = {};
|
|
96
|
+
const tailwindConfig = {};
|
|
97
|
+
for (const [variant, value] of entries(config)) {
|
|
98
|
+
const rootVarKey = `--${prefix}-${variant}`;
|
|
99
|
+
rootVars[rootVarKey] = `${value}px`;
|
|
100
|
+
tailwindConfig[variant] = `var(${rootVarKey})`;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
_vars: rootVars,
|
|
104
|
+
_raw: config,
|
|
105
|
+
tailwindConfig
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function getElevationPresetsForColorMode(colorMode, config) {
|
|
109
|
+
if (!config.elevation) return {};
|
|
110
|
+
const result = {};
|
|
111
|
+
entries(config.elevation).forEach(([level, levelPreset]) => {
|
|
112
|
+
result[level] = levelPreset[colorMode];
|
|
113
|
+
});
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
function parseTokens(config) {
|
|
117
|
+
const { colorMode, scaleMode } = config;
|
|
118
|
+
return {
|
|
119
|
+
...config,
|
|
120
|
+
colorMode: {
|
|
121
|
+
light: transformColors(colorMode.light, getElevationPresetsForColorMode("light", config)),
|
|
122
|
+
dark: transformColors(colorMode.dark, getElevationPresetsForColorMode("dark", config))
|
|
123
|
+
},
|
|
124
|
+
scaleMode: mapValues(scaleMode, ({ borderRadius, borderWidth, avatarSizes, iconSizes }) => {
|
|
125
|
+
return {
|
|
126
|
+
borderRadius: transformNumericToPx(BORDER_RADIUS_PREFIX, borderRadius),
|
|
127
|
+
borderWidth: transformNumericToPx(BORDER_WIDTH_PREFIX, borderWidth),
|
|
128
|
+
avatarSizes: transformNumericToPx(AVATAR_SIZE_PREFIX, avatarSizes),
|
|
129
|
+
iconSizes: transformNumericToPx(ICON_SIZE_PREFIX, iconSizes)
|
|
130
|
+
};
|
|
131
|
+
})
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
export { parseTokens };
|