@yahoo/uds 3.100.0-beta.2 → 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 -147
- package/dist/automated-config/dist/properties.d.cts +3 -24
- package/dist/automated-config/dist/properties.d.ts +3 -24
- package/dist/automated-config/dist/properties.js +90 -148
- 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.d.cts +1 -6
- package/dist/automated-config/dist/utils/index.d.ts +1 -6
- 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 +10 -19
- package/dist/styles/styler.d.ts +10 -19
- 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 -174
- 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 -172
- 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 -199
- package/dist/components/client/Tooltip/useTooltipContent.d.cts +0 -65
- package/dist/components/client/Tooltip/useTooltipContent.d.ts +0 -65
- package/dist/components/client/Tooltip/useTooltipContent.js +0 -197
- 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 -50
- package/dist/runtime/tooltipConfig.d.cts +0 -21
- package/dist/runtime/tooltipConfig.d.ts +0 -21
- package/dist/runtime/tooltipConfig.js +0 -49
- 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,190 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_index = require('../../../config/dist/index.cjs');
|
|
4
|
+
const require_autoVariants = require('../../../automated-config/dist/generated/autoVariants.cjs');
|
|
5
|
+
const require_colors = require('../../../cli/dist/lib/colors.cjs');
|
|
6
|
+
const require_print = require('../../../cli/dist/lib/print.cjs');
|
|
7
|
+
const require_plugin = require('../plugin.cjs');
|
|
8
|
+
const require_tsMorph = require('./tsMorph.cjs');
|
|
9
|
+
let ts_morph = require("ts-morph");
|
|
10
|
+
let postcss = require("postcss");
|
|
11
|
+
postcss = require_runtime.__toESM(postcss);
|
|
12
|
+
let tailwindcss = require("tailwindcss");
|
|
13
|
+
tailwindcss = require_runtime.__toESM(tailwindcss);
|
|
14
|
+
|
|
15
|
+
//#region ../tailwind/dist/utils/generatePurgeCSSData.js
|
|
16
|
+
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
17
|
+
const NO_FILE = "noFile";
|
|
18
|
+
/**
|
|
19
|
+
* Returns a list of exported Components from UDS
|
|
20
|
+
* both stable and experimental
|
|
21
|
+
*/
|
|
22
|
+
const getExportedComponents = (UDS, UDS_EXPERIMENTAL) => {
|
|
23
|
+
const udsStableExports = Object.keys(UDS);
|
|
24
|
+
const udsExperimentalExports = Object.keys(UDS_EXPERIMENTAL);
|
|
25
|
+
return udsStableExports.concat(udsExperimentalExports).filter((key) => {
|
|
26
|
+
const regexStartsWithCapitalLetter = /* @__PURE__ */ new RegExp("^[A-Z].[^_]");
|
|
27
|
+
const hasUnderscore = key.includes("_");
|
|
28
|
+
const startsWithCapitalLetter = regexStartsWithCapitalLetter.test(key);
|
|
29
|
+
return !hasUnderscore && startsWithCapitalLetter;
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Some UDS components are built using other UDS components,
|
|
34
|
+
* we need to know those dependencies so generate the correct
|
|
35
|
+
*/
|
|
36
|
+
const getComponentsDependencies = (project, componentsList, exportsToFilePath) => {
|
|
37
|
+
const componentsListSet = new Set(componentsList);
|
|
38
|
+
const componentUDSDependencies = {};
|
|
39
|
+
componentsList.forEach((component) => {
|
|
40
|
+
componentUDSDependencies[component] = getComponentUdsDependencies(project, componentsListSet, component, exportsToFilePath);
|
|
41
|
+
});
|
|
42
|
+
return componentUDSDependencies;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* We need to make sure that components from UDS that use other components
|
|
46
|
+
* from UDS also gets included
|
|
47
|
+
*/
|
|
48
|
+
const getComponentUdsDependencies = (project, componentsList, componentName, exportsToFilePath) => {
|
|
49
|
+
return project.getSourceFileOrThrow(exportsToFilePath[componentName]).getImportDeclarations().map((declaration) => {
|
|
50
|
+
return declaration.getNamedImports().map((namedImport) => namedImport.getName());
|
|
51
|
+
}).flat().filter((namedImport) => componentsList.has(namedImport));
|
|
52
|
+
};
|
|
53
|
+
const getComponentsProps = (project, list, variants, variantsList, exportsToFilePath) => {
|
|
54
|
+
const map = {};
|
|
55
|
+
list.forEach((componentName) => {
|
|
56
|
+
map[componentName] = getInitializedAndReferencedProps(project, componentName, variants, variantsList, exportsToFilePath);
|
|
57
|
+
});
|
|
58
|
+
return map;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Converts the variants object used in CVA to
|
|
62
|
+
*/
|
|
63
|
+
const convertVariantsIntoTailwindClass = (variants) => {
|
|
64
|
+
return Object.keys(variants);
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Get the params with default values,
|
|
68
|
+
* required and the ones used in references
|
|
69
|
+
*/
|
|
70
|
+
const getInitializedAndReferencedProps = (project, componentName, variants, variantsList, exportsToFilePath) => {
|
|
71
|
+
const sourceFile = project.getSourceFileOrThrow(exportsToFilePath[componentName] ?? NO_FILE);
|
|
72
|
+
const functionDeclarations = sourceFile.getFunctions();
|
|
73
|
+
const variableDeclarations = sourceFile.getVariableDeclarations();
|
|
74
|
+
const node = [...functionDeclarations, ...variableDeclarations].filter((declaration) => declaration.getName() === componentName)[0];
|
|
75
|
+
const functionDeclaration = require_tsMorph.getReactFunctionDeclaration(node);
|
|
76
|
+
if (!functionDeclaration) require_print.print(require_colors.red(`No function declaration found for ${componentName}`));
|
|
77
|
+
const parameterDeclaration = functionDeclaration?.getParameters();
|
|
78
|
+
if (!parameterDeclaration || parameterDeclaration.length === 0) {
|
|
79
|
+
require_print.print(require_colors.red(`No parameter declaration found for ${componentName}`));
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
if (!parameterDeclaration[0].getChildrenOfKind(ts_morph.SyntaxKind.ObjectBindingPattern)[0]) return [];
|
|
83
|
+
const references = require_tsMorph.findReferencesAsJsxElements(node.getFirstDescendantByKindOrThrow(ts_morph.SyntaxKind.Identifier));
|
|
84
|
+
const propsWithDefaultValues = parameterDeclaration[0].getChildrenOfKind(ts_morph.SyntaxKind.ObjectBindingPattern)[0].getElements().filter((el) => !!el.getInitializer()).map((el) => {
|
|
85
|
+
const stringLiteral = el.getDescendantsOfKind(ts_morph.SyntaxKind.StringLiteral)[0];
|
|
86
|
+
const propName = el.getName();
|
|
87
|
+
const values = [];
|
|
88
|
+
if (stringLiteral) values.push(stringLiteral.getLiteralText());
|
|
89
|
+
return [propName, values];
|
|
90
|
+
}).filter(([propName]) => variantsList.includes(propName));
|
|
91
|
+
const propsUsedInReferences = references.map((r) => require_tsMorph.getUsedPropsInReference(r, variants)).flat().filter(([propName]) => variantsList.includes(propName));
|
|
92
|
+
const mapPropToUsedOptions = /* @__PURE__ */ new Map();
|
|
93
|
+
propsWithDefaultValues.concat(propsUsedInReferences).forEach(([propName, propValues]) => {
|
|
94
|
+
if (propValues.length === 0) propValues = Object.keys(variants[propName]);
|
|
95
|
+
const options = mapPropToUsedOptions.get(propName) ?? /* @__PURE__ */ new Set();
|
|
96
|
+
propValues.forEach((val) => options.add(val));
|
|
97
|
+
mapPropToUsedOptions.set(propName, options);
|
|
98
|
+
});
|
|
99
|
+
return Array.from(mapPropToUsedOptions).map(([propName, options]) => [propName, Array.from(options)]);
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Gets the Tailwind CSS classes used in a component
|
|
103
|
+
*/
|
|
104
|
+
const getTwClassesInComponent = async (componentsList, exportsToFilePath) => {
|
|
105
|
+
const CSS_DATA = `
|
|
106
|
+
@tailwind components;
|
|
107
|
+
@tailwind utilities;
|
|
108
|
+
`;
|
|
109
|
+
const res = {};
|
|
110
|
+
const promises = componentsList.map((component) => {
|
|
111
|
+
return (0, postcss.default)([(0, tailwindcss.default)({
|
|
112
|
+
content: [exportsToFilePath[component]],
|
|
113
|
+
plugins: [require_plugin.tailwindPlugin({ config: require_index.defaultTokensConfig })]
|
|
114
|
+
})]).process(CSS_DATA, {
|
|
115
|
+
from: "app.css",
|
|
116
|
+
to: "./dist/app.css"
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
(await Promise.all(promises)).forEach((result, i) => {
|
|
120
|
+
const currentComponent = componentsList[i];
|
|
121
|
+
res[currentComponent] = result.root.nodes.map((node) => {
|
|
122
|
+
if (node.selector) return node.selector.replace(".", "");
|
|
123
|
+
return [];
|
|
124
|
+
}).join(" ").replace(/\s+/g, " ");
|
|
125
|
+
});
|
|
126
|
+
return res;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Goes through the list of all exports from UDS (stable and experimental)
|
|
130
|
+
* and return a map of each exports and the source file path where its declared
|
|
131
|
+
*/
|
|
132
|
+
const getExportsToFilePath = (project) => {
|
|
133
|
+
const stableComponentsMainFile = project.getSourceFileOrThrow("./src/components/index.ts");
|
|
134
|
+
const experimentalComponentsMainFile = project.getSourceFileOrThrow("./src/components/experimental/index.ts");
|
|
135
|
+
const exportToFilePath = {};
|
|
136
|
+
for (const [name, declarations] of stableComponentsMainFile.getExportedDeclarations()) exportToFilePath[name] = declarations.map((d) => d.getSourceFile().getFilePath())[0];
|
|
137
|
+
for (const [name, declarations] of experimentalComponentsMainFile.getExportedDeclarations()) exportToFilePath[name] = declarations.map((d) => d.getSourceFile().getFilePath())[0];
|
|
138
|
+
return exportToFilePath;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Adds auto-generated variants to the Tailwind CSS classes of components.
|
|
142
|
+
*
|
|
143
|
+
* This function extracts component names from auto variants keys, groups class names by component,
|
|
144
|
+
* updates component classes using auto-generated variant classes, and propagates base classes to subcomponents.
|
|
145
|
+
*
|
|
146
|
+
* @param componentToTwClasses - A map of component names to their current Tailwind CSS classes.
|
|
147
|
+
* @returns Updated map with auto variants added to the component classes.
|
|
148
|
+
*/
|
|
149
|
+
const addAutoVariantsToComponentClasses = (componentToTwClasses) => {
|
|
150
|
+
const componentNameRegex = /^([a-z]+)[A-Z]/;
|
|
151
|
+
const componentNameMap = {};
|
|
152
|
+
const componentNameLookup = /* @__PURE__ */ new Map();
|
|
153
|
+
Object.keys(componentToTwClasses).forEach((actualName) => {
|
|
154
|
+
componentNameLookup.set(actualName.toLowerCase(), actualName);
|
|
155
|
+
});
|
|
156
|
+
Object.keys(require_autoVariants.autoVariants).forEach((key) => {
|
|
157
|
+
const match = key.match(componentNameRegex);
|
|
158
|
+
if (match && match[1]) {
|
|
159
|
+
const extractedName = match[1].charAt(0).toUpperCase() + match[1].slice(1);
|
|
160
|
+
const actualComponentName = componentNameLookup.get(extractedName.toLowerCase()) || extractedName;
|
|
161
|
+
if (!componentNameMap[actualComponentName]) componentNameMap[actualComponentName] = [];
|
|
162
|
+
Object.values(require_autoVariants.autoVariants[key]).forEach((className) => {
|
|
163
|
+
componentNameMap[actualComponentName].push(className);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
Object.entries(componentNameMap).forEach(([componentName, classes]) => {
|
|
168
|
+
componentToTwClasses[componentName] = `${componentToTwClasses[componentName] || ""} ${classes.join(" ")}`.trim();
|
|
169
|
+
});
|
|
170
|
+
const components = Object.keys(componentNameMap);
|
|
171
|
+
Object.keys(componentToTwClasses).forEach((key) => {
|
|
172
|
+
components.forEach((comp) => {
|
|
173
|
+
const compName = comp.charAt(0).toUpperCase() + comp.slice(1);
|
|
174
|
+
if (key.startsWith(compName) && key !== compName) {
|
|
175
|
+
const baseClasses = componentToTwClasses[compName] || "";
|
|
176
|
+
if (baseClasses) componentToTwClasses[key] = `${componentToTwClasses[key]} ${baseClasses}`.trim();
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
return componentToTwClasses;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
//#endregion
|
|
184
|
+
exports.addAutoVariantsToComponentClasses = addAutoVariantsToComponentClasses;
|
|
185
|
+
exports.convertVariantsIntoTailwindClass = convertVariantsIntoTailwindClass;
|
|
186
|
+
exports.getComponentsDependencies = getComponentsDependencies;
|
|
187
|
+
exports.getComponentsProps = getComponentsProps;
|
|
188
|
+
exports.getExportedComponents = getExportedComponents;
|
|
189
|
+
exports.getExportsToFilePath = getExportsToFilePath;
|
|
190
|
+
exports.getTwClassesInComponent = getTwClassesInComponent;
|
|
@@ -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 };
|