@yahoo/uds 3.133.0-beta.1 → 3.133.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.cjs +12 -22
- package/dist/_virtual/_rolldown/runtime.js +6 -11
- package/dist/automated-config/dist/generated/autoVariants.cjs +1 -3
- package/dist/automated-config/dist/generated/autoVariants.js +1 -2
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +1 -3
- package/dist/automated-config/dist/generated/generatedConfigs.js +1 -2
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +1 -3
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +1 -2
- package/dist/automated-config/dist/mapTextVariantFixtureToValue.cjs +3 -5
- package/dist/automated-config/dist/mapTextVariantFixtureToValue.js +1 -3
- package/dist/automated-config/dist/properties.cjs +7 -10
- package/dist/automated-config/dist/properties.d.cts +1 -1
- package/dist/automated-config/dist/properties.d.ts +1 -1
- package/dist/automated-config/dist/properties.js +2 -5
- package/dist/automated-config/dist/utils/assertUnreachable.cjs +1 -3
- package/dist/automated-config/dist/utils/assertUnreachable.js +1 -2
- package/dist/automated-config/dist/utils/buildConfigSchema.cjs +4 -6
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +1 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.js +1 -3
- package/dist/automated-config/dist/utils/cartesianProduct.cjs +1 -3
- package/dist/automated-config/dist/utils/cartesianProduct.js +1 -2
- package/dist/automated-config/dist/utils/coalesceConfigVariant.cjs +3 -5
- package/dist/automated-config/dist/utils/coalesceConfigVariant.js +1 -3
- package/dist/automated-config/dist/utils/defaults.cjs +1 -3
- package/dist/automated-config/dist/utils/defaults.js +1 -2
- package/dist/automated-config/dist/utils/generateDefaultClassName.cjs +1 -3
- package/dist/automated-config/dist/utils/generateDefaultClassName.js +1 -2
- package/dist/automated-config/dist/utils/generateKeyFromFlatConfigPath.cjs +1 -3
- package/dist/automated-config/dist/utils/generateKeyFromFlatConfigPath.js +1 -2
- package/dist/automated-config/dist/utils/generateSchemaKey.cjs +1 -3
- package/dist/automated-config/dist/utils/generateSchemaKey.js +1 -2
- package/dist/automated-config/dist/utils/getConfigComponentVariant.cjs +2 -4
- package/dist/automated-config/dist/utils/getConfigComponentVariant.js +1 -3
- package/dist/automated-config/dist/utils/getConfigVariantComponentStatesMatrix.cjs +5 -7
- package/dist/automated-config/dist/utils/getConfigVariantComponentStatesMatrix.js +1 -3
- package/dist/automated-config/dist/utils/getConfigVariantProperties.cjs +3 -5
- package/dist/automated-config/dist/utils/getConfigVariantProperties.js +1 -3
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.cjs +3 -5
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.js +1 -3
- package/dist/automated-config/dist/utils/getConfigVariants.cjs +4 -6
- package/dist/automated-config/dist/utils/getConfigVariants.js +1 -3
- package/dist/automated-config/dist/utils/index.cjs +17 -19
- package/dist/automated-config/dist/utils/index.js +11 -13
- package/dist/automated-config/dist/utils/mapColorFixtureToValue.cjs +4 -6
- package/dist/automated-config/dist/utils/mapColorFixtureToValue.js +3 -5
- package/dist/automated-config/dist/utils/mapValues.cjs +1 -3
- package/dist/automated-config/dist/utils/mapValues.js +1 -2
- package/dist/automated-config/dist/utils/subcomponents.cjs +1 -3
- package/dist/automated-config/dist/utils/subcomponents.js +1 -2
- package/dist/automated-config/dist/utils/variantConfigGuards.cjs +1 -3
- package/dist/automated-config/dist/utils/variantConfigGuards.js +1 -2
- package/dist/cli/commands/sync.cjs +16 -18
- package/dist/cli/commands/sync.js +1 -3
- package/dist/cli/commands/utils/sortKeys.cjs +2 -4
- package/dist/cli/commands/utils/sortKeys.js +1 -2
- package/dist/cli/commands/version.cjs +5 -7
- package/dist/cli/commands/version.js +1 -3
- package/dist/cli/dist/cli.cjs +8 -10
- package/dist/cli/dist/cli.js +1 -3
- package/dist/cli/dist/commands/codemod/codemod.cjs +6 -8
- package/dist/cli/dist/commands/codemod/codemod.js +1 -3
- package/dist/cli/dist/commands/editor-rules.cjs +6 -8
- package/dist/cli/dist/commands/editor-rules.js +1 -3
- package/dist/cli/dist/lib/args.cjs +1 -3
- package/dist/cli/dist/lib/args.js +1 -2
- package/dist/cli/dist/lib/box.cjs +3 -5
- package/dist/cli/dist/lib/box.js +1 -3
- package/dist/cli/dist/lib/colors.cjs +1 -3
- package/dist/cli/dist/lib/colors.js +1 -2
- package/dist/cli/dist/lib/print.cjs +1 -3
- package/dist/cli/dist/lib/print.js +1 -2
- package/dist/cli/dist/utils/analytics.cjs +2 -4
- package/dist/cli/dist/utils/analytics.js +1 -3
- package/dist/cli/dist/utils/getCommandHelp.cjs +3 -5
- package/dist/cli/dist/utils/getCommandHelp.js +1 -3
- package/dist/cli/dist/utils/getDirChoices.cjs +3 -5
- package/dist/cli/dist/utils/getDirChoices.js +1 -3
- package/dist/cli/dist/utils/rules/config.cjs +2 -4
- package/dist/cli/dist/utils/rules/config.js +1 -3
- package/dist/cli/runner.cjs +13 -15
- package/dist/cli/runner.js +1 -3
- package/dist/components/Banner/Banner.cjs +8 -10
- package/dist/components/Banner/Banner.d.cts +3 -4
- package/dist/components/Banner/Banner.d.ts +3 -4
- package/dist/components/Banner/Banner.js +1 -3
- package/dist/components/Banner/BannerContent.cjs +4 -6
- package/dist/components/Banner/BannerContent.d.cts +2 -2
- package/dist/components/Banner/BannerContent.d.ts +2 -2
- package/dist/components/Banner/BannerContent.js +1 -3
- package/dist/components/Banner/BannerDescription.cjs +5 -7
- package/dist/components/Banner/BannerDescription.d.cts +2 -2
- package/dist/components/Banner/BannerDescription.d.ts +2 -2
- package/dist/components/Banner/BannerDescription.js +1 -3
- package/dist/components/Banner/BannerTitle.cjs +5 -7
- package/dist/components/Banner/BannerTitle.d.cts +2 -2
- package/dist/components/Banner/BannerTitle.d.ts +2 -2
- package/dist/components/Banner/BannerTitle.js +1 -3
- package/dist/components/Banner/index.cjs +6 -7
- package/dist/components/Banner/index.js +1 -2
- package/dist/components/Banner/utils.cjs +3 -5
- package/dist/components/Banner/utils.d.cts +1 -1
- package/dist/components/Banner/utils.d.ts +1 -1
- package/dist/components/Banner/utils.js +1 -3
- package/dist/components/Box.cjs +5 -7
- package/dist/components/Box.d.cts +3 -4
- package/dist/components/Box.d.ts +3 -4
- package/dist/components/Box.js +1 -3
- package/dist/components/Divider/Divider.cjs +4 -6
- package/dist/components/Divider/Divider.d.cts +2 -2
- package/dist/components/Divider/Divider.d.ts +2 -2
- package/dist/components/Divider/Divider.js +1 -3
- package/dist/components/Divider/DividerCore.cjs +8 -10
- package/dist/components/Divider/DividerCore.d.cts +3 -4
- package/dist/components/Divider/DividerCore.d.ts +3 -4
- package/dist/components/Divider/DividerCore.js +1 -3
- package/dist/components/Divider/DividerInternal.cjs +5 -7
- package/dist/components/Divider/DividerInternal.d.cts +3 -4
- package/dist/components/Divider/DividerInternal.d.ts +3 -4
- package/dist/components/Divider/DividerInternal.js +1 -3
- package/dist/components/Divider/index.cjs +3 -4
- package/dist/components/Divider/index.js +1 -2
- package/dist/components/FormLabel.cjs +5 -7
- package/dist/components/FormLabel.d.cts +3 -4
- package/dist/components/FormLabel.d.ts +3 -4
- package/dist/components/FormLabel.js +1 -3
- package/dist/components/HStack.cjs +5 -7
- package/dist/components/HStack.d.cts +3 -4
- package/dist/components/HStack.d.ts +3 -4
- package/dist/components/HStack.js +1 -3
- package/dist/components/Icon.cjs +11 -22
- package/dist/components/Icon.d.cts +3 -3
- package/dist/components/Icon.d.ts +3 -3
- package/dist/components/Icon.js +8 -19
- package/dist/components/IconSlot.cjs +11 -32
- package/dist/components/IconSlot.d.cts +2 -4
- package/dist/components/IconSlot.d.ts +2 -4
- package/dist/components/IconSlot.js +7 -29
- package/dist/components/Image.cjs +4 -6
- package/dist/components/Image.d.cts +3 -4
- package/dist/components/Image.d.ts +3 -4
- package/dist/components/Image.js +1 -3
- package/dist/components/Link.cjs +5 -7
- package/dist/components/Link.d.cts +3 -4
- package/dist/components/Link.d.ts +3 -4
- package/dist/components/Link.js +1 -3
- package/dist/components/Scrim.cjs +5 -7
- package/dist/components/Scrim.d.cts +2 -2
- package/dist/components/Scrim.d.ts +2 -2
- package/dist/components/Scrim.js +1 -3
- package/dist/components/SvgFloatingOverlay.cjs +5 -7
- package/dist/components/SvgFloatingOverlay.d.cts +2 -2
- package/dist/components/SvgFloatingOverlay.d.ts +2 -2
- package/dist/components/SvgFloatingOverlay.js +1 -3
- package/dist/components/Text.cjs +5 -7
- package/dist/components/Text.d.cts +3 -4
- package/dist/components/Text.d.ts +3 -4
- package/dist/components/Text.js +1 -3
- package/dist/components/VStack.cjs +5 -7
- package/dist/components/VStack.d.cts +3 -4
- package/dist/components/VStack.d.ts +3 -4
- package/dist/components/VStack.js +1 -3
- package/dist/components/client/AnimateHeightChange.cjs +4 -6
- package/dist/components/client/AnimateHeightChange.d.cts +2 -2
- package/dist/components/client/AnimateHeightChange.d.ts +2 -2
- package/dist/components/client/AnimateHeightChange.js +1 -3
- package/dist/components/client/Avatar/Avatar.cjs +4 -6
- package/dist/components/client/Avatar/Avatar.d.cts +2 -2
- package/dist/components/client/Avatar/Avatar.d.ts +2 -2
- package/dist/components/client/Avatar/Avatar.js +1 -3
- package/dist/components/client/Avatar/AvatarIcon.cjs +8 -10
- package/dist/components/client/Avatar/AvatarIcon.d.cts +3 -4
- package/dist/components/client/Avatar/AvatarIcon.d.ts +3 -4
- package/dist/components/client/Avatar/AvatarIcon.js +3 -5
- package/dist/components/client/Avatar/AvatarImage.cjs +10 -12
- package/dist/components/client/Avatar/AvatarImage.d.cts +3 -4
- package/dist/components/client/Avatar/AvatarImage.d.ts +3 -4
- package/dist/components/client/Avatar/AvatarImage.js +3 -5
- package/dist/components/client/Avatar/AvatarText.cjs +8 -10
- package/dist/components/client/Avatar/AvatarText.d.cts +3 -4
- package/dist/components/client/Avatar/AvatarText.d.ts +3 -4
- package/dist/components/client/Avatar/AvatarText.js +3 -5
- package/dist/components/client/Avatar/index.cjs +6 -7
- package/dist/components/client/Avatar/index.js +1 -2
- package/dist/components/client/Avatar/utils.cjs +5 -7
- package/dist/components/client/Avatar/utils.d.cts +1 -2
- package/dist/components/client/Avatar/utils.d.ts +1 -2
- package/dist/components/client/Avatar/utils.js +1 -3
- package/dist/components/client/Badge.cjs +6 -8
- package/dist/components/client/Badge.d.cts +1 -2
- package/dist/components/client/Badge.d.ts +1 -2
- package/dist/components/client/Badge.js +2 -4
- package/dist/components/client/BottomSheet/BottomSheet.cjs +15 -17
- package/dist/components/client/BottomSheet/BottomSheet.d.cts +3 -3
- package/dist/components/client/BottomSheet/BottomSheet.d.ts +3 -3
- package/dist/components/client/BottomSheet/BottomSheet.js +1 -3
- package/dist/components/client/BottomSheet/BottomSheetContent.cjs +7 -9
- package/dist/components/client/BottomSheet/BottomSheetContent.d.cts +3 -3
- package/dist/components/client/BottomSheet/BottomSheetContent.d.ts +3 -3
- package/dist/components/client/BottomSheet/BottomSheetContent.js +1 -3
- package/dist/components/client/BottomSheet/BottomSheetDismiss.cjs +3 -5
- package/dist/components/client/BottomSheet/BottomSheetDismiss.d.cts +2 -2
- package/dist/components/client/BottomSheet/BottomSheetDismiss.d.ts +2 -2
- package/dist/components/client/BottomSheet/BottomSheetDismiss.js +1 -3
- package/dist/components/client/BottomSheet/BottomSheetHandle.cjs +5 -7
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.cts +3 -3
- package/dist/components/client/BottomSheet/BottomSheetHandle.d.ts +3 -3
- package/dist/components/client/BottomSheet/BottomSheetHandle.js +1 -3
- package/dist/components/client/BottomSheet/BottomSheetHeader.cjs +6 -8
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.cts +3 -3
- package/dist/components/client/BottomSheet/BottomSheetHeader.d.ts +3 -3
- package/dist/components/client/BottomSheet/BottomSheetHeader.js +1 -3
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.cjs +3 -5
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.d.cts +2 -2
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.d.ts +2 -2
- package/dist/components/client/BottomSheet/BottomSheetInternalContext.js +1 -3
- package/dist/components/client/BottomSheet/BottomSheetProvider.cjs +5 -7
- package/dist/components/client/BottomSheet/BottomSheetProvider.d.cts +2 -2
- package/dist/components/client/BottomSheet/BottomSheetProvider.d.ts +2 -2
- package/dist/components/client/BottomSheet/BottomSheetProvider.js +1 -3
- package/dist/components/client/BottomSheet/BottomSheetTrigger.cjs +3 -5
- package/dist/components/client/BottomSheet/BottomSheetTrigger.d.cts +2 -2
- package/dist/components/client/BottomSheet/BottomSheetTrigger.d.ts +2 -2
- package/dist/components/client/BottomSheet/BottomSheetTrigger.js +1 -3
- package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.cjs +3 -5
- package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.d.cts +2 -2
- package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.d.ts +2 -2
- package/dist/components/client/BottomSheet/UDSBottomSheetConfigProvider.js +1 -3
- package/dist/components/client/BottomSheet/index.cjs +10 -11
- package/dist/components/client/BottomSheet/index.js +1 -2
- package/dist/components/client/BottomSheet/useBottomSheetDrag.cjs +5 -7
- package/dist/components/client/BottomSheet/useBottomSheetDrag.js +1 -3
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.cjs +5 -7
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.cts +1 -2
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.d.ts +1 -2
- package/dist/components/client/BottomSheet/useBottomSheetSnapModel.js +1 -3
- package/dist/components/client/BottomSheet/useBottomSheetStore.cjs +4 -6
- package/dist/components/client/BottomSheet/useBottomSheetStore.d.cts +2 -2
- package/dist/components/client/BottomSheet/useBottomSheetStore.d.ts +2 -2
- package/dist/components/client/BottomSheet/useBottomSheetStore.js +1 -3
- package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.cjs +3 -5
- package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.d.cts +2 -2
- package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.d.ts +2 -2
- package/dist/components/client/BottomSheet/useBottomSheetStoreInternal.js +1 -3
- package/dist/components/client/BottomSheet/useExpansionMargins.cjs +3 -5
- package/dist/components/client/BottomSheet/useExpansionMargins.js +1 -3
- package/dist/components/client/BottomSheet/useViewportHeight.cjs +4 -6
- package/dist/components/client/BottomSheet/useViewportHeight.js +1 -3
- package/dist/components/client/BottomSheet/useVirtualKeyboard.cjs +4 -6
- package/dist/components/client/BottomSheet/useVirtualKeyboard.js +1 -3
- package/dist/components/client/BottomSheet/utils.cjs +4 -6
- package/dist/components/client/BottomSheet/utils.d.cts +1 -1
- package/dist/components/client/BottomSheet/utils.d.ts +1 -1
- package/dist/components/client/BottomSheet/utils.js +1 -3
- package/dist/components/client/Button.cjs +14 -16
- package/dist/components/client/Button.d.cts +1 -2
- package/dist/components/client/Button.d.ts +1 -2
- package/dist/components/client/Button.js +6 -8
- package/dist/components/client/Checkbox.cjs +8 -10
- package/dist/components/client/Checkbox.d.cts +1 -2
- package/dist/components/client/Checkbox.d.ts +1 -2
- package/dist/components/client/Checkbox.js +2 -4
- package/dist/components/client/Chip/Chip.cjs +7 -9
- package/dist/components/client/Chip/Chip.d.cts +0 -1
- package/dist/components/client/Chip/Chip.d.ts +0 -1
- package/dist/components/client/Chip/Chip.js +2 -4
- package/dist/components/client/Chip/ChipBase.cjs +7 -9
- package/dist/components/client/Chip/ChipBase.d.cts +1 -2
- package/dist/components/client/Chip/ChipBase.d.ts +1 -2
- package/dist/components/client/Chip/ChipBase.js +2 -4
- package/dist/components/client/Chip/ChipButton.cjs +6 -8
- package/dist/components/client/Chip/ChipButton.d.cts +1 -2
- package/dist/components/client/Chip/ChipButton.d.ts +1 -2
- package/dist/components/client/Chip/ChipButton.js +2 -4
- package/dist/components/client/Chip/ChipDismissible.cjs +8 -10
- package/dist/components/client/Chip/ChipDismissible.d.cts +1 -2
- package/dist/components/client/Chip/ChipDismissible.d.ts +1 -2
- package/dist/components/client/Chip/ChipDismissible.js +2 -4
- package/dist/components/client/Chip/ChipLink.cjs +6 -8
- package/dist/components/client/Chip/ChipLink.d.cts +1 -2
- package/dist/components/client/Chip/ChipLink.d.ts +1 -2
- package/dist/components/client/Chip/ChipLink.js +2 -4
- package/dist/components/client/Chip/ChipToggle.cjs +7 -10
- package/dist/components/client/Chip/ChipToggle.d.cts +1 -2
- package/dist/components/client/Chip/ChipToggle.d.ts +1 -2
- package/dist/components/client/Chip/ChipToggle.js +3 -6
- package/dist/components/client/Chip/index.cjs +7 -8
- package/dist/components/client/Chip/index.js +1 -2
- package/dist/components/client/IconButton.cjs +13 -20
- package/dist/components/client/IconButton.d.cts +2 -3
- package/dist/components/client/IconButton.d.ts +2 -3
- package/dist/components/client/IconButton.js +5 -12
- package/dist/components/client/Input/Input.cjs +18 -16
- package/dist/components/client/Input/Input.d.cts +3 -4
- package/dist/components/client/Input/Input.d.ts +3 -4
- package/dist/components/client/Input/Input.js +10 -8
- package/dist/components/client/Input/InputHelpText.cjs +6 -8
- package/dist/components/client/Input/InputHelpText.d.cts +2 -2
- package/dist/components/client/Input/InputHelpText.d.ts +2 -2
- package/dist/components/client/Input/InputHelpText.js +1 -3
- package/dist/components/client/Input/InputHelpTextInternal.cjs +6 -8
- package/dist/components/client/Input/InputHelpTextInternal.d.cts +3 -4
- package/dist/components/client/Input/InputHelpTextInternal.d.ts +3 -4
- package/dist/components/client/Input/InputHelpTextInternal.js +1 -3
- package/dist/components/client/Input/index.cjs +4 -5
- package/dist/components/client/Input/index.js +1 -2
- package/dist/components/client/Menu/Menu.Content.cjs +5 -7
- package/dist/components/client/Menu/Menu.Content.d.cts +3 -4
- package/dist/components/client/Menu/Menu.Content.d.ts +3 -4
- package/dist/components/client/Menu/Menu.Content.js +1 -3
- package/dist/components/client/Menu/Menu.Divider.cjs +5 -7
- package/dist/components/client/Menu/Menu.Divider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Divider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Divider.js +1 -3
- package/dist/components/client/Menu/Menu.Item.cjs +5 -7
- package/dist/components/client/Menu/Menu.Item.d.cts +3 -4
- package/dist/components/client/Menu/Menu.Item.d.ts +3 -4
- package/dist/components/client/Menu/Menu.Item.js +1 -3
- package/dist/components/client/Menu/Menu.ItemBase.cjs +7 -9
- package/dist/components/client/Menu/Menu.ItemBase.d.cts +3 -4
- package/dist/components/client/Menu/Menu.ItemBase.d.ts +3 -4
- package/dist/components/client/Menu/Menu.ItemBase.js +1 -3
- package/dist/components/client/Menu/Menu.ItemCheckbox.cjs +5 -7
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +3 -4
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +3 -4
- package/dist/components/client/Menu/Menu.ItemCheckbox.js +1 -3
- package/dist/components/client/Menu/Menu.Provider.cjs +6 -8
- package/dist/components/client/Menu/Menu.Provider.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Provider.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Provider.js +1 -3
- package/dist/components/client/Menu/Menu.Trigger.cjs +5 -7
- package/dist/components/client/Menu/Menu.Trigger.d.cts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.d.ts +2 -2
- package/dist/components/client/Menu/Menu.Trigger.js +1 -3
- package/dist/components/client/Menu/Menu.cjs +8 -9
- package/dist/components/client/Menu/Menu.index.cjs +29 -31
- package/dist/components/client/Menu/Menu.index.js +1 -3
- package/dist/components/client/Menu/Menu.js +1 -2
- package/dist/components/client/Menu/index.cjs +8 -9
- package/dist/components/client/Menu/index.d.cts +0 -1
- package/dist/components/client/Menu/index.d.ts +0 -1
- package/dist/components/client/Menu/index.js +1 -2
- package/dist/components/client/Menu/utils/transformAriakitPlacement.cjs +2 -4
- package/dist/components/client/Menu/utils/transformAriakitPlacement.js +1 -2
- package/dist/components/client/Popover/Popover.cjs +5 -7
- package/dist/components/client/Popover/Popover.d.cts +3 -3
- package/dist/components/client/Popover/Popover.d.ts +3 -3
- package/dist/components/client/Popover/Popover.js +1 -3
- package/dist/components/client/Popover/PopoverContent.cjs +14 -16
- package/dist/components/client/Popover/PopoverContent.d.cts +3 -4
- package/dist/components/client/Popover/PopoverContent.d.ts +3 -4
- package/dist/components/client/Popover/PopoverContent.js +1 -3
- package/dist/components/client/Popover/PopoverContext.cjs +4 -7
- package/dist/components/client/Popover/PopoverContext.d.cts +2 -2
- package/dist/components/client/Popover/PopoverContext.d.ts +2 -2
- package/dist/components/client/Popover/PopoverContext.js +1 -3
- package/dist/components/client/Popover/PopoverTrigger.cjs +4 -6
- package/dist/components/client/Popover/PopoverTrigger.d.cts +3 -3
- package/dist/components/client/Popover/PopoverTrigger.d.ts +3 -3
- package/dist/components/client/Popover/PopoverTrigger.js +1 -3
- package/dist/components/client/Popover/UDSPopoverConfigProvider.cjs +3 -5
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +4 -4
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +4 -4
- package/dist/components/client/Popover/UDSPopoverConfigProvider.js +1 -3
- package/dist/components/client/Popover/index.cjs +6 -7
- package/dist/components/client/Popover/index.d.cts +1 -1
- package/dist/components/client/Popover/index.d.ts +1 -1
- package/dist/components/client/Popover/index.js +1 -2
- package/dist/components/client/Pressable.cjs +5 -7
- package/dist/components/client/Pressable.d.cts +3 -4
- package/dist/components/client/Pressable.d.ts +3 -4
- package/dist/components/client/Pressable.js +1 -3
- package/dist/components/client/Radio/Radio.cjs +8 -10
- package/dist/components/client/Radio/Radio.d.cts +1 -2
- package/dist/components/client/Radio/Radio.d.ts +1 -2
- package/dist/components/client/Radio/Radio.js +2 -4
- package/dist/components/client/Radio/RadioGroupProvider.cjs +6 -8
- package/dist/components/client/Radio/RadioGroupProvider.d.cts +1 -2
- package/dist/components/client/Radio/RadioGroupProvider.d.ts +1 -2
- package/dist/components/client/Radio/RadioGroupProvider.js +2 -4
- package/dist/components/client/Radio/RadioGroupStore.cjs +3 -5
- package/dist/components/client/Radio/RadioGroupStore.d.cts +2 -2
- package/dist/components/client/Radio/RadioGroupStore.d.ts +2 -2
- package/dist/components/client/Radio/RadioGroupStore.js +1 -3
- package/dist/components/client/Radio/index.cjs +4 -5
- package/dist/components/client/Radio/index.js +1 -2
- package/dist/components/client/Radio/useRadioGroup.cjs +4 -6
- package/dist/components/client/Radio/useRadioGroup.js +1 -3
- package/dist/components/client/SpringMotionConfig.cjs +6 -8
- package/dist/components/client/SpringMotionConfig.d.cts +1 -2
- package/dist/components/client/SpringMotionConfig.d.ts +1 -2
- package/dist/components/client/SpringMotionConfig.js +1 -3
- package/dist/components/client/Switch.cjs +8 -10
- package/dist/components/client/Switch.d.cts +1 -2
- package/dist/components/client/Switch.d.ts +1 -2
- package/dist/components/client/Switch.js +2 -4
- package/dist/components/client/Tabs/Tab.cjs +7 -9
- package/dist/components/client/Tabs/Tab.d.cts +3 -3
- package/dist/components/client/Tabs/Tab.d.ts +3 -3
- package/dist/components/client/Tabs/Tab.js +1 -3
- package/dist/components/client/Tabs/TabList.cjs +5 -7
- package/dist/components/client/Tabs/TabList.d.cts +3 -3
- package/dist/components/client/Tabs/TabList.d.ts +3 -3
- package/dist/components/client/Tabs/TabList.js +1 -3
- package/dist/components/client/Tabs/TabPanel.cjs +3 -5
- package/dist/components/client/Tabs/TabPanel.d.cts +3 -3
- package/dist/components/client/Tabs/TabPanel.d.ts +3 -3
- package/dist/components/client/Tabs/TabPanel.js +1 -3
- package/dist/components/client/Tabs/Tabs.cjs +4 -6
- package/dist/components/client/Tabs/Tabs.d.cts +3 -3
- package/dist/components/client/Tabs/Tabs.d.ts +3 -3
- package/dist/components/client/Tabs/Tabs.js +1 -3
- package/dist/components/client/Tabs/index.cjs +6 -7
- package/dist/components/client/Tabs/index.js +1 -2
- package/dist/components/client/Tabs/tabsContext.cjs +3 -5
- package/dist/components/client/Tabs/tabsContext.d.cts +3 -3
- package/dist/components/client/Tabs/tabsContext.d.ts +3 -3
- package/dist/components/client/Tabs/tabsContext.js +1 -3
- package/dist/components/client/Toast/Toast.cjs +10 -12
- package/dist/components/client/Toast/Toast.d.cts +3 -4
- package/dist/components/client/Toast/Toast.d.ts +3 -4
- package/dist/components/client/Toast/Toast.js +1 -3
- package/dist/components/client/Toast/ToastContainer.cjs +7 -9
- package/dist/components/client/Toast/ToastContainer.d.cts +3 -4
- package/dist/components/client/Toast/ToastContainer.d.ts +3 -4
- package/dist/components/client/Toast/ToastContainer.js +1 -3
- package/dist/components/client/Toast/ToastPortal.cjs +6 -8
- package/dist/components/client/Toast/ToastPortal.d.cts +2 -2
- package/dist/components/client/Toast/ToastPortal.d.ts +2 -2
- package/dist/components/client/Toast/ToastPortal.js +1 -3
- package/dist/components/client/Toast/UDSToastConfigProvider.cjs +3 -5
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +3 -4
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +3 -4
- package/dist/components/client/Toast/UDSToastConfigProvider.js +1 -3
- package/dist/components/client/Toast/createToast.cjs +7 -9
- package/dist/components/client/Toast/createToast.d.cts +1 -2
- package/dist/components/client/Toast/createToast.d.ts +1 -2
- package/dist/components/client/Toast/createToast.js +1 -3
- package/dist/components/client/Toast/index.cjs +7 -8
- package/dist/components/client/Toast/index.js +1 -2
- package/dist/components/client/Tooltip/Tooltip.cjs +5 -7
- package/dist/components/client/Tooltip/Tooltip.d.cts +3 -3
- package/dist/components/client/Tooltip/Tooltip.d.ts +3 -3
- package/dist/components/client/Tooltip/Tooltip.js +1 -3
- package/dist/components/client/Tooltip/TooltipContent.cjs +14 -16
- package/dist/components/client/Tooltip/TooltipContent.d.cts +4 -4
- package/dist/components/client/Tooltip/TooltipContent.d.ts +4 -4
- package/dist/components/client/Tooltip/TooltipContent.js +1 -3
- package/dist/components/client/Tooltip/TooltipTrigger.cjs +3 -5
- package/dist/components/client/Tooltip/TooltipTrigger.d.cts +3 -3
- package/dist/components/client/Tooltip/TooltipTrigger.d.ts +3 -3
- package/dist/components/client/Tooltip/TooltipTrigger.js +1 -3
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.cjs +3 -5
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.cts +3 -3
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.ts +3 -3
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.js +1 -3
- package/dist/components/client/Tooltip/index.cjs +6 -7
- package/dist/components/client/Tooltip/index.d.cts +1 -1
- package/dist/components/client/Tooltip/index.d.ts +1 -1
- package/dist/components/client/Tooltip/index.js +1 -2
- package/dist/components/client/Tooltip/tooltipContext.cjs +4 -7
- package/dist/components/client/Tooltip/tooltipContext.d.cts +2 -2
- package/dist/components/client/Tooltip/tooltipContext.d.ts +2 -2
- package/dist/components/client/Tooltip/tooltipContext.js +1 -3
- package/dist/components/client/buttonConstants.cjs +2 -4
- package/dist/components/client/buttonConstants.d.cts +1 -3
- package/dist/components/client/buttonConstants.d.ts +1 -3
- package/dist/components/client/buttonConstants.js +1 -2
- package/dist/components/client/index.cjs +55 -56
- package/dist/components/client/index.d.cts +1 -11
- package/dist/components/client/index.d.ts +1 -11
- package/dist/components/client/index.js +1 -2
- package/dist/components/client/motionFeatures/domAnimation.cjs +8 -9
- package/dist/components/client/motionFeatures/domAnimation.js +1 -2
- package/dist/components/client/motionFeatures/domMax.cjs +8 -9
- package/dist/components/client/motionFeatures/domMax.js +1 -2
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.cjs +3 -5
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.cts +3 -3
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.d.ts +3 -3
- package/dist/components/client/providers/UDSBreakpointsConfigProvider.js +1 -3
- package/dist/components/client/providers/UDSConfigProvider.cjs +8 -10
- package/dist/components/client/providers/UDSConfigProvider.d.cts +2 -2
- package/dist/components/client/providers/UDSConfigProvider.d.ts +2 -2
- package/dist/components/client/providers/UDSConfigProvider.js +1 -3
- package/dist/components/experimental/Spinner.cjs +5 -7
- package/dist/components/experimental/Spinner.d.cts +2 -2
- package/dist/components/experimental/Spinner.d.ts +2 -2
- package/dist/components/experimental/Spinner.js +1 -3
- package/dist/components/experimental/Table.cjs +6 -8
- package/dist/components/experimental/Table.d.cts +3 -5
- package/dist/components/experimental/Table.d.ts +3 -5
- package/dist/components/experimental/Table.js +2 -4
- package/dist/components/experimental/Table.mocks.cjs +3 -5
- package/dist/components/experimental/Table.mocks.js +1 -3
- package/dist/components/experimental/client/Accordion.cjs +10 -12
- package/dist/components/experimental/client/Accordion.d.cts +2 -3
- package/dist/components/experimental/client/Accordion.d.ts +2 -3
- package/dist/components/experimental/client/Accordion.js +1 -3
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.cjs +3 -5
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.cts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.d.ts +2 -2
- package/dist/components/experimental/client/AvoidMotionLibraryProvider.js +1 -3
- package/dist/components/experimental/client/Modal.cjs +8 -10
- package/dist/components/experimental/client/Modal.d.cts +3 -3
- package/dist/components/experimental/client/Modal.d.ts +3 -3
- package/dist/components/experimental/client/Modal.js +1 -3
- package/dist/components/experimental/client/SegmentedControl.cjs +9 -12
- package/dist/components/experimental/client/SegmentedControl.d.cts +2 -3
- package/dist/components/experimental/client/SegmentedControl.d.ts +2 -3
- package/dist/components/experimental/client/SegmentedControl.js +3 -6
- package/dist/components/experimental/client/SwitchV2.cjs +9 -11
- package/dist/components/experimental/client/SwitchV2.d.cts +1 -2
- package/dist/components/experimental/client/SwitchV2.d.ts +1 -2
- package/dist/components/experimental/client/SwitchV2.js +2 -4
- package/dist/components/experimental/client/index.cjs +7 -8
- package/dist/components/experimental/client/index.js +1 -2
- package/dist/components/experimental/index.cjs +15 -17
- package/dist/components/experimental/index.d.cts +0 -1
- package/dist/components/experimental/index.d.ts +0 -1
- package/dist/components/experimental/index.js +1 -3
- package/dist/components/index.cjs +74 -76
- package/dist/components/index.d.cts +1 -4
- package/dist/components/index.d.ts +1 -4
- package/dist/components/index.js +1 -3
- package/dist/config/dist/index.cjs +2 -5
- package/dist/config/dist/index.d.cts +1 -1
- package/dist/config/dist/index.d.ts +1 -1
- package/dist/config/dist/index.js +2 -4
- package/dist/css-tokens/dist/index.cjs +37 -39
- package/dist/css-tokens/dist/index.d.cts +1 -1
- package/dist/css-tokens/dist/index.d.ts +1 -1
- package/dist/css-tokens/dist/index.js +35 -37
- package/dist/defaultTokensConfig.cjs +4 -6
- package/dist/defaultTokensConfig.d.cts +0 -2
- package/dist/defaultTokensConfig.d.ts +0 -2
- package/dist/defaultTokensConfig.js +1 -3
- package/dist/fixtures/dist/index.cjs +1 -3
- package/dist/fixtures/dist/index.d.cts +1 -1
- package/dist/fixtures/dist/index.d.ts +1 -1
- package/dist/fixtures/dist/index.js +1 -2
- package/dist/fixtures/index.cjs +4 -6
- package/dist/fixtures/index.d.cts +1 -1
- package/dist/fixtures/index.d.ts +1 -1
- package/dist/fixtures/index.js +1 -3
- package/dist/fixtures/src/arbitrary.cjs +7 -10
- package/dist/fixtures/src/arbitrary.js +1 -3
- package/dist/fixtures/src/util.cjs +2 -4
- package/dist/fixtures/src/util.js +1 -3
- package/dist/flags.cjs +6 -4
- package/dist/flags.js +5 -2
- package/dist/fonts/dist/index.cjs +22 -14
- package/dist/fonts/dist/index.d.cts +1 -1
- package/dist/fonts/dist/index.d.ts +1 -1
- package/dist/fonts/dist/index.js +22 -13
- package/dist/hooks/useForkRef.cjs +3 -5
- package/dist/hooks/useForkRef.js +1 -3
- package/dist/hooks/useRtl.cjs +3 -5
- package/dist/hooks/useRtl.js +1 -3
- package/dist/hooks/useSvgFloatingContent.cjs +6 -8
- package/dist/hooks/useSvgFloatingContent.js +1 -3
- package/dist/icons/dist/types.d.cts +30 -0
- package/dist/icons/dist/types.d.ts +30 -0
- package/dist/index.cjs +102 -103
- package/dist/index.d.cts +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +1 -2
- package/dist/modes/dist/index.cjs +1 -3
- package/dist/modes/dist/index.d.cts +1 -1
- package/dist/modes/dist/index.d.ts +1 -1
- package/dist/modes/dist/index.js +1 -2
- package/dist/motion-tokens/dist/index.cjs +1 -3
- package/dist/motion-tokens/dist/index.d.cts +1 -1
- package/dist/motion-tokens/dist/index.d.ts +1 -1
- package/dist/motion-tokens/dist/index.js +1 -2
- package/dist/palette/dist/index.cjs +13 -3
- package/dist/palette/dist/index.js +13 -2
- package/dist/providers/ColorModeProvider.cjs +4 -6
- package/dist/providers/ColorModeProvider.d.cts +5 -6
- package/dist/providers/ColorModeProvider.d.ts +5 -6
- package/dist/providers/ColorModeProvider.js +1 -3
- package/dist/providers/ScaleModeProvider.cjs +4 -6
- package/dist/providers/ScaleModeProvider.d.cts +5 -6
- package/dist/providers/ScaleModeProvider.d.ts +5 -6
- package/dist/providers/ScaleModeProvider.js +1 -3
- package/dist/providers/ThemeProvider.cjs +5 -7
- package/dist/providers/ThemeProvider.d.cts +3 -4
- package/dist/providers/ThemeProvider.d.ts +3 -4
- package/dist/providers/ThemeProvider.js +1 -3
- package/dist/runtime/bottomSheetConfig.cjs +2 -4
- package/dist/runtime/bottomSheetConfig.d.cts +1 -1
- package/dist/runtime/bottomSheetConfig.d.ts +1 -1
- package/dist/runtime/bottomSheetConfig.js +1 -2
- package/dist/runtime/breakpointsConfig.cjs +4 -6
- package/dist/runtime/breakpointsConfig.d.cts +1 -3
- package/dist/runtime/breakpointsConfig.d.ts +1 -3
- package/dist/runtime/breakpointsConfig.js +1 -3
- package/dist/runtime/index.cjs +8 -9
- package/dist/runtime/index.js +1 -2
- package/dist/runtime/popoverConfig.cjs +3 -5
- package/dist/runtime/popoverConfig.d.cts +1 -2
- package/dist/runtime/popoverConfig.d.ts +1 -2
- package/dist/runtime/popoverConfig.js +1 -3
- package/dist/runtime/toastConfig.cjs +2 -4
- package/dist/runtime/toastConfig.d.cts +1 -3
- package/dist/runtime/toastConfig.d.ts +1 -3
- package/dist/runtime/toastConfig.js +1 -2
- package/dist/runtime/tooltipConfig.cjs +3 -5
- package/dist/runtime/tooltipConfig.d.cts +1 -2
- package/dist/runtime/tooltipConfig.d.ts +1 -2
- package/dist/runtime/tooltipConfig.js +1 -3
- package/dist/runtime/udsConfig.cjs +7 -9
- package/dist/runtime/udsConfig.d.cts +0 -1
- package/dist/runtime/udsConfig.d.ts +0 -1
- package/dist/runtime/udsConfig.js +1 -3
- package/dist/styles/styler.cjs +6 -8
- package/dist/styles/styler.d.cts +32 -32
- package/dist/styles/styler.d.ts +32 -32
- package/dist/styles/styler.js +1 -3
- package/dist/styles/stylerTypes.d.cts +1 -2
- package/dist/styles/stylerTypes.d.ts +1 -2
- package/dist/styles/variants.cjs +4 -6
- package/dist/styles/variants.js +1 -3
- package/dist/tailwind/dist/_virtual/_rolldown/runtime.cjs +7 -13
- package/dist/tailwind/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.cjs +1 -3
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.js +1 -1
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.cjs +1 -3
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.js +1 -1
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/mapTextVariantFixtureToValue.cjs +3 -5
- package/dist/tailwind/dist/automated-config/dist/mapTextVariantFixtureToValue.js +1 -2
- package/dist/tailwind/dist/automated-config/dist/mapTextVariantFixtureToValue.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/properties.cjs +7 -10
- package/dist/tailwind/dist/automated-config/dist/properties.js +2 -4
- package/dist/tailwind/dist/automated-config/dist/properties.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/assertUnreachable.cjs +1 -3
- package/dist/tailwind/dist/automated-config/dist/utils/assertUnreachable.js +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/assertUnreachable.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/generateDefaultClassName.cjs +1 -3
- package/dist/tailwind/dist/automated-config/dist/utils/generateDefaultClassName.js +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/generateDefaultClassName.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/generateSchemaKey.cjs +1 -3
- package/dist/tailwind/dist/automated-config/dist/utils/generateSchemaKey.js +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/generateSchemaKey.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/index.cjs +7 -9
- package/dist/tailwind/dist/automated-config/dist/utils/index.js +1 -2
- package/dist/tailwind/dist/automated-config/dist/utils/index.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/mapColorFixtureToValue.cjs +4 -6
- package/dist/tailwind/dist/automated-config/dist/utils/mapColorFixtureToValue.js +3 -4
- package/dist/tailwind/dist/automated-config/dist/utils/mapColorFixtureToValue.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/variantConfigGuards.cjs +1 -3
- package/dist/tailwind/dist/automated-config/dist/utils/variantConfigGuards.js +1 -1
- package/dist/tailwind/dist/automated-config/dist/utils/variantConfigGuards.js.map +1 -1
- package/dist/tailwind/dist/cli/dist/lib/colors.cjs +1 -3
- package/dist/tailwind/dist/cli/dist/lib/colors.js +1 -1
- package/dist/tailwind/dist/cli/dist/lib/colors.js.map +1 -1
- package/dist/tailwind/dist/cli/dist/lib/logger.cjs +18 -6
- package/dist/tailwind/dist/cli/dist/lib/logger.js +15 -2
- package/dist/tailwind/dist/cli/dist/lib/logger.js.map +1 -1
- package/dist/tailwind/dist/cli/dist/lib/print.cjs +1 -3
- package/dist/tailwind/dist/cli/dist/lib/print.js +1 -1
- package/dist/tailwind/dist/cli/dist/lib/print.js.map +1 -1
- package/dist/tailwind/dist/cli/dist/lib/spinner.cjs +1 -3
- package/dist/tailwind/dist/cli/dist/lib/spinner.js +1 -1
- package/dist/tailwind/dist/cli/dist/lib/spinner.js.map +1 -1
- package/dist/tailwind/dist/cli.cjs +6 -7
- package/dist/tailwind/dist/cli.js +1 -2
- package/dist/tailwind/dist/commands/css.cjs +6 -8
- package/dist/tailwind/dist/commands/css.helpers.cjs +1 -3
- package/dist/tailwind/dist/commands/css.helpers.js +1 -1
- package/dist/tailwind/dist/commands/css.helpers.js.map +1 -1
- package/dist/tailwind/dist/commands/css.js +1 -2
- package/dist/tailwind/dist/commands/css.js.map +1 -1
- package/dist/tailwind/dist/commands/generateComponentData.cjs +4 -6
- package/dist/tailwind/dist/commands/generateComponentData.js +1 -2
- package/dist/tailwind/dist/commands/generateComponentData.js.map +1 -1
- package/dist/tailwind/dist/commands/generatePurgeCSSData.cjs +6 -8
- package/dist/tailwind/dist/commands/generatePurgeCSSData.js +1 -2
- package/dist/tailwind/dist/commands/generatePurgeCSSData.js.map +1 -1
- package/dist/tailwind/dist/commands/purge.cjs +5 -7
- package/dist/tailwind/dist/commands/purge.js +1 -2
- package/dist/tailwind/dist/commands/purge.js.map +1 -1
- package/dist/tailwind/dist/config/dist/index.cjs +2 -5
- package/dist/tailwind/dist/config/dist/index.d.cts +0 -1
- package/dist/tailwind/dist/config/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/config/dist/index.d.ts +0 -1
- package/dist/tailwind/dist/config/dist/index.d.ts.map +1 -1
- package/dist/tailwind/dist/config/dist/index.js +2 -3
- package/dist/tailwind/dist/config/dist/index.js.map +1 -1
- package/dist/tailwind/dist/css/generate.cjs +14 -16
- package/dist/tailwind/dist/css/generate.d.ts +0 -1
- package/dist/tailwind/dist/css/generate.d.ts.map +1 -1
- package/dist/tailwind/dist/css/generate.helpers.cjs +18 -20
- package/dist/tailwind/dist/css/generate.helpers.js +1 -2
- package/dist/tailwind/dist/css/generate.helpers.js.map +1 -1
- package/dist/tailwind/dist/css/generate.js +1 -2
- package/dist/tailwind/dist/css/generate.js.map +1 -1
- package/dist/tailwind/dist/css/nodeUtils.cjs +9 -11
- package/dist/tailwind/dist/css/nodeUtils.js +1 -2
- package/dist/tailwind/dist/css/nodeUtils.js.map +1 -1
- package/dist/tailwind/dist/css/postcss.cjs +2 -4
- package/dist/tailwind/dist/css/postcss.helpers.cjs +1 -3
- package/dist/tailwind/dist/css/postcss.helpers.js +1 -1
- package/dist/tailwind/dist/css/postcss.helpers.js.map +1 -1
- package/dist/tailwind/dist/css/postcss.js +1 -2
- package/dist/tailwind/dist/css/postcss.js.map +1 -1
- package/dist/tailwind/dist/css/runner.cjs +16 -18
- package/dist/tailwind/dist/css/runner.helpers.cjs +3 -5
- package/dist/tailwind/dist/css/runner.helpers.js +1 -2
- package/dist/tailwind/dist/css/runner.helpers.js.map +1 -1
- package/dist/tailwind/dist/css/runner.js +3 -4
- package/dist/tailwind/dist/css/runner.js.map +1 -1
- package/dist/tailwind/dist/css/theme.cjs +1 -3
- package/dist/tailwind/dist/css/theme.js +1 -1
- package/dist/tailwind/dist/css/utils.cjs +3 -5
- package/dist/tailwind/dist/css/utils.js +1 -2
- package/dist/tailwind/dist/css/utils.js.map +1 -1
- package/dist/tailwind/dist/css-tokens/dist/index.cjs +37 -41
- package/dist/tailwind/dist/css-tokens/dist/index.js +36 -38
- package/dist/tailwind/dist/css-tokens/dist/index.js.map +1 -1
- package/dist/tailwind/dist/fixtures/dist/index.cjs +16 -20
- package/dist/tailwind/dist/fixtures/dist/index.js +16 -18
- package/dist/tailwind/dist/fixtures/dist/index.js.map +1 -1
- package/dist/tailwind/dist/fonts/dist/index.cjs +22 -14
- package/dist/tailwind/dist/fonts/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/fonts/dist/index.d.ts.map +1 -1
- package/dist/tailwind/dist/fonts/dist/index.js +22 -12
- package/dist/tailwind/dist/fonts/dist/index.js.map +1 -1
- package/dist/tailwind/dist/icons/src/safelist.cjs +1 -3
- package/dist/tailwind/dist/icons/src/safelist.js +1 -1
- package/dist/tailwind/dist/index.cjs +5 -6
- package/dist/tailwind/dist/index.js +1 -2
- package/dist/tailwind/dist/modes/dist/index.cjs +1 -3
- package/dist/tailwind/dist/modes/dist/index.js +1 -1
- package/dist/tailwind/dist/modes/dist/index.js.map +1 -1
- package/dist/tailwind/dist/motion-tokens/dist/index.cjs +1 -3
- package/dist/tailwind/dist/motion-tokens/dist/index.js +1 -1
- package/dist/tailwind/dist/motion-tokens/dist/index.js.map +1 -1
- package/dist/tailwind/dist/palette/dist/index.cjs +13 -3
- package/dist/tailwind/dist/palette/dist/index.js +13 -1
- package/dist/tailwind/dist/palette/dist/index.js.map +1 -1
- package/dist/tailwind/dist/plugin.cjs +22 -24
- package/dist/tailwind/dist/plugin.d.cts +3 -3
- package/dist/tailwind/dist/plugin.d.cts.map +1 -1
- package/dist/tailwind/dist/plugin.d.ts +3 -3
- package/dist/tailwind/dist/plugin.d.ts.map +1 -1
- package/dist/tailwind/dist/plugin.js +1 -2
- package/dist/tailwind/dist/plugin.js.map +1 -1
- package/dist/tailwind/dist/purger/legacy/index.d.cts +2 -0
- package/dist/tailwind/dist/purger/legacy/purgeCSS.cjs +10 -12
- package/dist/tailwind/dist/purger/legacy/purgeCSS.js +2 -3
- package/dist/tailwind/dist/purger/legacy/purgeCSS.js.map +1 -1
- package/dist/tailwind/dist/purger/legacy/purgeFromCode.cjs +4 -6
- package/dist/tailwind/dist/purger/legacy/purgeFromCode.d.cts +1 -1
- package/dist/tailwind/dist/purger/legacy/purgeFromCode.js +1 -2
- package/dist/tailwind/dist/purger/legacy/purgeFromCode.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/ast/expressions.cjs +4 -6
- package/dist/tailwind/dist/purger/optimized/ast/expressions.d.cts +2 -0
- package/dist/tailwind/dist/purger/optimized/ast/expressions.js +1 -2
- package/dist/tailwind/dist/purger/optimized/ast/expressions.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/ast/index.d.cts +2 -0
- package/dist/tailwind/dist/purger/optimized/ast/index.d.ts +1 -4
- package/dist/tailwind/dist/purger/optimized/ast/jsx.cjs +2 -4
- package/dist/tailwind/dist/purger/optimized/ast/jsx.d.cts +2 -0
- package/dist/tailwind/dist/purger/optimized/ast/jsx.d.ts +0 -1
- package/dist/tailwind/dist/purger/optimized/ast/jsx.js +2 -3
- package/dist/tailwind/dist/purger/optimized/ast/jsx.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/ast/props.d.cts +2 -0
- package/dist/tailwind/dist/purger/optimized/ast/props.d.ts +1 -1
- package/dist/tailwind/dist/purger/optimized/ast/spread.d.cts +2 -0
- package/dist/tailwind/dist/purger/optimized/ast/spread.d.ts +0 -1
- package/dist/tailwind/dist/purger/optimized/index.d.cts +3 -0
- package/dist/tailwind/dist/purger/optimized/index.d.ts +1 -4
- package/dist/tailwind/dist/purger/optimized/purge.cjs +8 -10
- package/dist/tailwind/dist/purger/optimized/purge.d.cts +2 -0
- package/dist/tailwind/dist/purger/optimized/purge.d.ts +1 -1
- package/dist/tailwind/dist/purger/optimized/purge.js +1 -2
- package/dist/tailwind/dist/purger/optimized/purge.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +4 -6
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.d.cts +1 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +1 -2
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/types.d.ts +0 -1
- package/dist/tailwind/dist/purger/optimized/types.d.ts.map +1 -1
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +7 -9
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +1 -2
- package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/utils/files.cjs +4 -6
- package/dist/tailwind/dist/purger/optimized/utils/files.d.cts +2 -0
- package/dist/tailwind/dist/purger/optimized/utils/files.js +1 -2
- package/dist/tailwind/dist/purger/optimized/utils/files.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/utils/safelist.cjs +4 -6
- package/dist/tailwind/dist/purger/optimized/utils/safelist.js +1 -2
- package/dist/tailwind/dist/purger/optimized/utils/safelist.js.map +1 -1
- package/dist/tailwind/dist/purger.cjs +4 -5
- package/dist/tailwind/dist/purger.d.ts +0 -2
- package/dist/tailwind/dist/purger.js +1 -2
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.cjs +1 -3
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.js +1 -1
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.js.map +1 -1
- package/dist/tailwind/dist/tailwind/base/addColorModeVars.cjs +6 -8
- package/dist/tailwind/dist/tailwind/base/addColorModeVars.js +1 -2
- package/dist/tailwind/dist/tailwind/base/addColorModeVars.js.map +1 -1
- package/dist/tailwind/dist/tailwind/base/addColorModeVarsV2.cjs +6 -8
- package/dist/tailwind/dist/tailwind/base/addColorModeVarsV2.js +1 -2
- package/dist/tailwind/dist/tailwind/base/addColorModeVarsV2.js.map +1 -1
- package/dist/tailwind/dist/tailwind/base/addFontFaceDeclarations.cjs +2 -4
- package/dist/tailwind/dist/tailwind/base/addFontFaceDeclarations.js +1 -2
- package/dist/tailwind/dist/tailwind/base/addFontFaceDeclarations.js.map +1 -1
- package/dist/tailwind/dist/tailwind/base/addFontVars.cjs +2 -4
- package/dist/tailwind/dist/tailwind/base/addFontVars.js +1 -2
- package/dist/tailwind/dist/tailwind/base/addFontVars.js.map +1 -1
- package/dist/tailwind/dist/tailwind/base/addMotionVars.cjs +2 -4
- package/dist/tailwind/dist/tailwind/base/addMotionVars.js +1 -2
- package/dist/tailwind/dist/tailwind/base/addMotionVars.js.map +1 -1
- package/dist/tailwind/dist/tailwind/base/addScaleModeVars.cjs +4 -6
- package/dist/tailwind/dist/tailwind/base/addScaleModeVars.js +1 -2
- package/dist/tailwind/dist/tailwind/base/addScaleModeVars.js.map +1 -1
- package/dist/tailwind/dist/tailwind/components/getFocusRingStyles.cjs +3 -4
- package/dist/tailwind/dist/tailwind/components/getFocusRingStyles.js +2 -2
- package/dist/tailwind/dist/tailwind/components/getFocusRingStyles.js.map +1 -1
- package/dist/tailwind/dist/tailwind/components/getGroupedTextStyles.cjs +10 -6
- package/dist/tailwind/dist/tailwind/components/getGroupedTextStyles.js +7 -2
- package/dist/tailwind/dist/tailwind/components/getGroupedTextStyles.js.map +1 -1
- package/dist/tailwind/dist/tailwind/components/getHitTargetStyles.cjs +1 -3
- package/dist/tailwind/dist/tailwind/components/getHitTargetStyles.js +1 -1
- package/dist/tailwind/dist/tailwind/components/getIconStyles.cjs +1 -3
- package/dist/tailwind/dist/tailwind/components/getIconStyles.js +1 -1
- package/dist/tailwind/dist/tailwind/components/getInputStyles.cjs +1 -3
- package/dist/tailwind/dist/tailwind/components/getInputStyles.js +1 -1
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.cjs +7 -9
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.js +1 -2
- package/dist/tailwind/dist/tailwind/components/getResponsiveTextStyles.js.map +1 -1
- package/dist/tailwind/dist/tailwind/defaultTailwindThemeAsUdsConfig.cjs +1 -3
- package/dist/tailwind/dist/tailwind/defaultTailwindThemeAsUdsConfig.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/defaultTailwindThemeAsUdsConfig.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/defaultTailwindThemeAsUdsConfig.js +1 -1
- package/dist/tailwind/dist/tailwind/plugins/a11y.cjs +21 -7
- package/dist/tailwind/dist/tailwind/plugins/a11y.js +17 -2
- package/dist/tailwind/dist/tailwind/plugins/a11y.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.cjs +4 -6
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/borderRadius.cjs +7 -9
- package/dist/tailwind/dist/tailwind/plugins/borderRadius.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/borderRadius.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/borderWidth.cjs +7 -9
- package/dist/tailwind/dist/tailwind/plugins/borderWidth.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/borderWidth.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/breakpoints.cjs +7 -9
- package/dist/tailwind/dist/tailwind/plugins/breakpoints.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/breakpoints.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/colors.cjs +73 -15
- package/dist/tailwind/dist/tailwind/plugins/colors.js +62 -3
- package/dist/tailwind/dist/tailwind/plugins/colors.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +6 -8
- package/dist/tailwind/dist/tailwind/plugins/components.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/components.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/elevation.cjs +9 -11
- package/dist/tailwind/dist/tailwind/plugins/elevation.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/elevation.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.cjs +3 -5
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/icons.cjs +4 -6
- package/dist/tailwind/dist/tailwind/plugins/icons.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/icons.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/input.cjs +4 -6
- package/dist/tailwind/dist/tailwind/plugins/input.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/input.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/motion.cjs +4 -6
- package/dist/tailwind/dist/tailwind/plugins/motion.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/motion.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/nestedBorderRadius.cjs +6 -8
- package/dist/tailwind/dist/tailwind/plugins/nestedBorderRadius.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/nestedBorderRadius.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/scaleMode.cjs +5 -7
- package/dist/tailwind/dist/tailwind/plugins/scaleMode.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/scaleMode.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/shadows.cjs +6 -8
- package/dist/tailwind/dist/tailwind/plugins/shadows.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/shadows.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/sizing.cjs +5 -7
- package/dist/tailwind/dist/tailwind/plugins/sizing.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/sizing.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/spacing.cjs +3 -5
- package/dist/tailwind/dist/tailwind/plugins/spacing.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/spacing.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/typography.cjs +14 -16
- package/dist/tailwind/dist/tailwind/plugins/typography.js +1 -2
- package/dist/tailwind/dist/tailwind/plugins/typography.js.map +1 -1
- package/dist/tailwind/dist/tailwind/theme/getFontFamilyTheme.cjs +4 -6
- package/dist/tailwind/dist/tailwind/theme/getFontFamilyTheme.js +1 -2
- package/dist/tailwind/dist/tailwind/theme/getFontFamilyTheme.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.cjs +4 -6
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.d.cts +3 -3
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.d.cts.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.d.ts +3 -3
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.d.ts.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.js +1 -2
- package/dist/tailwind/dist/tailwind/utils/addFontsPlugin.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.cjs +8 -10
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.cts +0 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.cts.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.ts +0 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.d.ts.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.js +1 -2
- package/dist/tailwind/dist/tailwind/utils/composeTailwindPlugins.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/getColorModeStyles.cjs +1 -3
- package/dist/tailwind/dist/tailwind/utils/getColorModeStyles.js +1 -1
- package/dist/tailwind/dist/tailwind/utils/getColorModeStyles.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/getElevationStyles.cjs +5 -7
- package/dist/tailwind/dist/tailwind/utils/getElevationStyles.js +1 -2
- package/dist/tailwind/dist/tailwind/utils/getElevationStyles.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontFaceDeclarations.cjs +2 -4
- package/dist/tailwind/dist/tailwind/utils/getFontFaceDeclarations.js +1 -2
- package/dist/tailwind/dist/tailwind/utils/getFontFaceDeclarations.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.cjs +5 -7
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.d.cts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.d.ts +1 -1
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.js +1 -2
- package/dist/tailwind/dist/tailwind/utils/getFontStyles.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/getMotionStyles.cjs +5 -7
- package/dist/tailwind/dist/tailwind/utils/getMotionStyles.js +1 -2
- package/dist/tailwind/dist/tailwind/utils/getMotionStyles.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/getNestedBorderRadiusUtilities.cjs +1 -3
- package/dist/tailwind/dist/tailwind/utils/getNestedBorderRadiusUtilities.js +1 -1
- package/dist/tailwind/dist/tailwind/utils/getScaleModeStyles.cjs +1 -3
- package/dist/tailwind/dist/tailwind/utils/getScaleModeStyles.js +1 -1
- package/dist/tailwind/dist/tailwind/utils/getShadowPresetValues.cjs +3 -5
- package/dist/tailwind/dist/tailwind/utils/getShadowPresetValues.js +1 -2
- package/dist/tailwind/dist/tailwind/utils/getShadowPresetValues.js.map +1 -1
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.cjs +6 -8
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.cts +4 -4
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.ts +4 -4
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.js +4 -5
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.js.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -1
- package/dist/tailwind/dist/utils/assertUnreachable.cjs +1 -3
- package/dist/tailwind/dist/utils/assertUnreachable.js +1 -1
- package/dist/tailwind/dist/utils/entries.cjs +1 -3
- package/dist/tailwind/dist/utils/entries.js +1 -1
- package/dist/tailwind/dist/utils/entryPoints.cjs +4 -6
- package/dist/tailwind/dist/utils/entryPoints.js +1 -2
- package/dist/tailwind/dist/utils/entryPoints.js.map +1 -1
- package/dist/tailwind/dist/utils/fromEntries.cjs +1 -3
- package/dist/tailwind/dist/utils/fromEntries.js +1 -1
- package/dist/tailwind/dist/utils/generatePurgeCSSData.cjs +11 -15
- package/dist/tailwind/dist/utils/generatePurgeCSSData.js +2 -5
- package/dist/tailwind/dist/utils/generatePurgeCSSData.js.map +1 -1
- package/dist/tailwind/dist/utils/mapValues.cjs +1 -3
- package/dist/tailwind/dist/utils/mapValues.js +1 -1
- package/dist/tailwind/dist/utils/opacity.cjs +3 -5
- package/dist/tailwind/dist/utils/opacity.js +1 -2
- package/dist/tailwind/dist/utils/opacity.js.map +1 -1
- package/dist/tailwind/dist/utils/optimizeCSS.cjs +3 -5
- package/dist/tailwind/dist/utils/optimizeCSS.js +1 -2
- package/dist/tailwind/dist/utils/optimizeCSS.js.map +1 -1
- package/dist/tailwind/dist/utils/parseTokens.cjs +7 -9
- package/dist/tailwind/dist/utils/parseTokens.js +3 -4
- package/dist/tailwind/dist/utils/parseTokens.js.map +1 -1
- package/dist/tailwind/dist/utils/postcssPreserveVars.cjs +1 -3
- package/dist/tailwind/dist/utils/postcssPreserveVars.js +1 -1
- package/dist/tailwind/dist/utils/tsMorph.cjs +4 -6
- package/dist/tailwind/dist/utils/tsMorph.js +1 -2
- package/dist/tailwind/dist/utils/tsMorph.js.map +1 -1
- package/dist/tailwind/dist/utils.cjs +12 -13
- package/dist/tailwind/dist/utils.js +1 -2
- package/dist/tailwind/plugin.cjs +5 -6
- package/dist/tailwind/plugin.js +1 -2
- package/dist/tailwind/purger.cjs +3 -4
- package/dist/tailwind/purger.js +1 -2
- package/dist/tailwind/utils.cjs +12 -13
- package/dist/tailwind/utils.d.cts +0 -1
- package/dist/tailwind/utils.d.ts +0 -1
- package/dist/tailwind/utils.js +1 -2
- package/dist/tokens/automation/configs/index.cjs +3 -4
- package/dist/tokens/automation/configs/index.js +1 -2
- package/dist/tokens/automation/index.cjs +16 -17
- package/dist/tokens/automation/index.js +1 -2
- package/dist/tokens/automation/properties.cjs +3 -4
- package/dist/tokens/automation/properties.js +1 -2
- package/dist/tokens/configs/borderRadius.cjs +2 -4
- package/dist/tokens/configs/borderRadius.d.cts +1 -3
- package/dist/tokens/configs/borderRadius.d.ts +1 -3
- package/dist/tokens/configs/borderRadius.js +1 -2
- package/dist/tokens/configs/borderWidth.cjs +2 -4
- package/dist/tokens/configs/borderWidth.d.cts +1 -3
- package/dist/tokens/configs/borderWidth.d.ts +1 -3
- package/dist/tokens/configs/borderWidth.js +1 -2
- package/dist/tokens/configs/font.cjs +2 -4
- package/dist/tokens/configs/font.d.cts +1 -3
- package/dist/tokens/configs/font.d.ts +1 -3
- package/dist/tokens/configs/font.js +1 -2
- package/dist/tokens/configs/motion.cjs +3 -4
- package/dist/tokens/configs/motion.js +1 -2
- package/dist/tokens/configs/palette/alwaysPalette.cjs +3 -4
- package/dist/tokens/configs/palette/alwaysPalette.js +1 -2
- package/dist/tokens/configs/palette/index.cjs +3 -4
- package/dist/tokens/configs/palette/index.js +1 -2
- package/dist/tokens/configs/scaleMode.cjs +5 -7
- package/dist/tokens/configs/scaleMode.d.cts +1 -3
- package/dist/tokens/configs/scaleMode.d.ts +1 -3
- package/dist/tokens/configs/scaleMode.js +1 -3
- package/dist/tokens/configs/shadow.cjs +2 -4
- package/dist/tokens/configs/shadow.d.cts +1 -3
- package/dist/tokens/configs/shadow.d.ts +1 -3
- package/dist/tokens/configs/shadow.js +1 -2
- package/dist/tokens/configs/sizes.cjs +3 -5
- package/dist/tokens/configs/sizes.d.cts +1 -3
- package/dist/tokens/configs/sizes.d.ts +1 -3
- package/dist/tokens/configs/sizes.js +1 -3
- package/dist/tokens/configs/typography.cjs +2 -4
- package/dist/tokens/configs/typography.d.cts +1 -3
- package/dist/tokens/configs/typography.d.ts +1 -3
- package/dist/tokens/configs/typography.js +1 -2
- package/dist/tokens/consts/cssTokens.cjs +3 -4
- package/dist/tokens/consts/cssTokens.js +1 -2
- package/dist/tokens/consts/defaultModes.cjs +3 -4
- package/dist/tokens/consts/defaultModes.js +1 -2
- package/dist/tokens/consts/fontDeclarationsMap.cjs +3 -4
- package/dist/tokens/consts/fontDeclarationsMap.js +1 -2
- package/dist/tokens/index.cjs +28 -29
- package/dist/tokens/index.d.cts +2 -6
- package/dist/tokens/index.d.ts +2 -6
- package/dist/tokens/index.js +1 -2
- package/dist/tokens/parseButtonVariants.cjs +2 -4
- package/dist/tokens/parseButtonVariants.d.cts +1 -3
- package/dist/tokens/parseButtonVariants.d.ts +1 -3
- package/dist/tokens/parseButtonVariants.js +1 -2
- package/dist/tokens/parseTokens.cjs +3 -4
- package/dist/tokens/parseTokens.d.cts +0 -1
- package/dist/tokens/parseTokens.d.ts +0 -1
- package/dist/tokens/parseTokens.js +1 -2
- package/dist/tokens/types.d.cts +7 -7
- package/dist/tokens/types.d.ts +7 -7
- package/dist/tokens/utils/entries.cjs +2 -4
- package/dist/tokens/utils/entries.js +1 -2
- package/dist/tokens/utils/fromEntries.cjs +2 -4
- package/dist/tokens/utils/fromEntries.js +1 -2
- package/dist/tokens/utils/getFontUrls.cjs +4 -6
- package/dist/tokens/utils/getFontUrls.d.cts +0 -3
- package/dist/tokens/utils/getFontUrls.d.ts +0 -3
- package/dist/tokens/utils/getFontUrls.js +1 -3
- package/dist/tokens/utils/mapValues.cjs +2 -4
- package/dist/tokens/utils/mapValues.js +1 -2
- package/dist/tokens/utils/spectrum.cjs +2 -4
- package/dist/tokens/utils/spectrum.d.cts +1 -3
- package/dist/tokens/utils/spectrum.d.ts +1 -3
- package/dist/tokens/utils/spectrum.js +1 -2
- package/dist/types/{src → dist}/index.d.cts +23 -35
- package/dist/types/{src → dist}/index.d.ts +23 -35
- package/dist/uds/generated/componentData.cjs +1921 -1923
- package/dist/uds/generated/componentData.js +1394 -1395
- package/dist/uds/generated/tailwindPurge.cjs +1 -3
- package/dist/uds/generated/tailwindPurge.js +1 -2
- package/dist/uds/package.cjs +7 -9
- package/dist/uds/package.js +2 -3
- package/dist/utils/assertUnreachable.cjs +2 -4
- package/dist/utils/assertUnreachable.js +1 -2
- package/dist/utils/composeRefs.cjs +2 -4
- package/dist/utils/composeRefs.js +1 -2
- package/dist/utils/createSlot.cjs +4 -6
- package/dist/utils/createSlot.js +1 -3
- package/dist/utils/entries.cjs +2 -4
- package/dist/utils/entries.js +1 -2
- package/dist/utils/falsyToString.cjs +2 -4
- package/dist/utils/falsyToString.js +1 -2
- package/dist/utils/fromEntries.cjs +2 -4
- package/dist/utils/fromEntries.js +1 -2
- package/dist/utils/getUnscaledAnchorRect.cjs +2 -4
- package/dist/utils/getUnscaledAnchorRect.js +1 -2
- package/dist/utils/intersperse.cjs +4 -6
- package/dist/utils/intersperse.d.cts +2 -2
- package/dist/utils/intersperse.d.ts +2 -2
- package/dist/utils/intersperse.js +1 -3
- package/dist/utils/isElevationAlias.cjs +3 -5
- package/dist/utils/isElevationAlias.d.cts +1 -1
- package/dist/utils/isElevationAlias.d.ts +1 -1
- package/dist/utils/isElevationAlias.js +1 -3
- package/dist/utils/mapValues.cjs +2 -4
- package/dist/utils/mapValues.js +1 -2
- package/dist/utils/mergeSlotProps.cjs +3 -5
- package/dist/utils/mergeSlotProps.js +1 -3
- package/dist/utils/parseShadow.cjs +2 -4
- package/dist/utils/parseShadow.js +1 -2
- package/dist/utils/svgFloatingContentUtils.cjs +4 -8
- package/dist/utils/svgFloatingContentUtils.js +3 -6
- package/generated/componentData.json +1584 -1582
- package/package.json +2 -2
|
@@ -8,9 +8,6 @@ import { findReferencesAsJsxElements, getReactFunctionDeclaration, getUsedPropsI
|
|
|
8
8
|
import { SyntaxKind } from "ts-morph";
|
|
9
9
|
import postcss from "postcss";
|
|
10
10
|
import tailwindcss from "tailwindcss";
|
|
11
|
-
|
|
12
|
-
//#region src/utils/generatePurgeCSSData.ts
|
|
13
|
-
const NO_FILE = "noFile";
|
|
14
11
|
/**
|
|
15
12
|
* Returns a list of exported Components from UDS
|
|
16
13
|
* both stable and experimental
|
|
@@ -64,7 +61,7 @@ const convertVariantsIntoTailwindClass = (variants) => {
|
|
|
64
61
|
* required and the ones used in references
|
|
65
62
|
*/
|
|
66
63
|
const getInitializedAndReferencedProps = (project, componentName, variants, variantsList, exportsToFilePath) => {
|
|
67
|
-
const sourceFile = project.getSourceFileOrThrow(exportsToFilePath[componentName] ??
|
|
64
|
+
const sourceFile = project.getSourceFileOrThrow(exportsToFilePath[componentName] ?? "noFile");
|
|
68
65
|
const functionDeclarations = sourceFile.getFunctions();
|
|
69
66
|
const variableDeclarations = sourceFile.getVariableDeclarations();
|
|
70
67
|
const node = [...functionDeclarations, ...variableDeclarations].filter((declaration) => declaration.getName() === componentName)[0];
|
|
@@ -175,7 +172,7 @@ const addAutoVariantsToComponentClasses = (componentToTwClasses) => {
|
|
|
175
172
|
});
|
|
176
173
|
return componentToTwClasses;
|
|
177
174
|
};
|
|
178
|
-
|
|
179
175
|
//#endregion
|
|
180
176
|
export { addAutoVariantsToComponentClasses, convertVariantsIntoTailwindClass, getComponentsDependencies, getComponentsProps, getExportedComponents, getExportsToFilePath, getTwClassesInComponent };
|
|
177
|
+
|
|
181
178
|
//# sourceMappingURL=generatePurgeCSSData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePurgeCSSData.js","names":[],"sources":["../../src/utils/generatePurgeCSSData.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { autoVariants } from '@yahoo/uds-automated-config/autoVariants';\nimport { print, red } from '@yahoo/uds-cli/lib';\nimport { defaultTokensConfig } from '@yahoo/uds-config';\nimport type { AcceptedPlugin } from 'postcss';\nimport postcss from 'postcss';\nimport tailwindcss from 'tailwindcss';\nimport type { Project } from 'ts-morph';\nimport { SyntaxKind } from 'ts-morph';\n\nimport { tailwindPlugin } from '../tailwind/tailwindPlugin';\nimport {\n findReferencesAsJsxElements,\n getReactFunctionDeclaration,\n getUsedPropsInReference,\n} from './tsMorph';\n\ntype ComponentsList = string[];\ntype ComponentToVariants = { [key: string]: PropToUsedOptions[] };\ntype VariantsList = string[];\ntype ComponentDependencies = { [key: string]: string[] };\ntype ComponentToTwClasses = { [key: string]: string };\ntype ExportToFilePath = { [key: string]: string };\ntype AllProps = Array<[string, string[]]>;\ntype PropToUsedOptions = [string, string[]];\n\nconst NO_FILE: string = 'noFile';\n\n/**\n * Returns a list of exported Components from UDS\n * both stable and experimental\n */\nconst getExportedComponents = (\n UDS: Record<string, any>,\n UDS_EXPERIMENTAL: Record<string, any>,\n): ComponentsList => {\n const udsStableExports = Object.keys(UDS);\n const udsExperimentalExports = Object.keys(UDS_EXPERIMENTAL);\n const allExports = udsStableExports.concat(udsExperimentalExports);\n const keys = allExports.filter((key) => {\n const regexStartsWithCapitalLetter = new RegExp('^[A-Z].[^_]');\n const hasUnderscore = key.includes('_');\n const startsWithCapitalLetter = regexStartsWithCapitalLetter.test(key);\n return !hasUnderscore && startsWithCapitalLetter;\n });\n return keys;\n};\n\n/**\n * Some UDS components are built using other UDS components,\n * we need to know those dependencies so generate the correct\n */\nconst getComponentsDependencies = (\n project: Project,\n componentsList: ComponentsList,\n exportsToFilePath: ExportToFilePath,\n): ComponentDependencies => {\n const componentsListSet = new Set(componentsList);\n // the components a component from UDS depends on\n const componentUDSDependencies: { [k: string]: string[] } = {};\n componentsList.forEach((component) => {\n componentUDSDependencies[component] = getComponentUdsDependencies(\n project,\n componentsListSet,\n component,\n exportsToFilePath,\n );\n });\n return componentUDSDependencies;\n};\n\n/**\n * We need to make sure that components from UDS that use other components\n * from UDS also gets included\n */\nconst getComponentUdsDependencies = (\n project: Project,\n componentsList: Set<string>,\n componentName: string,\n exportsToFilePath: ExportToFilePath,\n): string[] => {\n const sourceFile = project.getSourceFileOrThrow(exportsToFilePath[componentName]);\n\n const deps = sourceFile\n .getImportDeclarations()\n .map((declaration) => {\n return declaration.getNamedImports().map((namedImport) => namedImport.getName());\n })\n .flat()\n .filter((namedImport) => componentsList.has(namedImport));\n\n return deps;\n};\n\nconst getComponentsProps = (\n project: Project,\n list: ComponentsList,\n variants: Record<string, Record<string, string>>,\n variantsList: VariantsList,\n exportsToFilePath: ExportToFilePath,\n): ComponentToVariants => {\n const map: ComponentToVariants = {};\n\n list.forEach((componentName) => {\n const list = getInitializedAndReferencedProps(\n project,\n componentName,\n variants,\n variantsList,\n exportsToFilePath,\n );\n map[componentName] = list;\n });\n\n return map;\n};\n\n/**\n * Converts the variants object used in CVA to\n */\nconst convertVariantsIntoTailwindClass = (\n variants: Record<string, Record<string, string>>,\n): VariantsList => {\n const variantsList = Object.keys(variants) as Array<keyof typeof variants>;\n\n return variantsList;\n};\n\n/**\n * Get the params with default values,\n * required and the ones used in references\n */\nconst getInitializedAndReferencedProps = (\n project: Project,\n componentName: string,\n variants: Record<string, Record<string, string>>,\n variantsList: VariantsList,\n exportsToFilePath: ExportToFilePath,\n): AllProps => {\n const sourceFile = project.getSourceFileOrThrow(exportsToFilePath[componentName] ?? NO_FILE);\n\n const functionDeclarations = sourceFile.getFunctions();\n const variableDeclarations = sourceFile.getVariableDeclarations();\n const node = [...functionDeclarations, ...variableDeclarations].filter(\n (declaration) => declaration.getName() === componentName,\n )[0];\n\n const functionDeclaration = getReactFunctionDeclaration(node);\n\n if (!functionDeclaration) {\n print(red(`No function declaration found for ${componentName}`));\n }\n\n const parameterDeclaration = functionDeclaration?.getParameters();\n\n if (!parameterDeclaration || parameterDeclaration.length === 0) {\n print(red(`No parameter declaration found for ${componentName}`));\n return [];\n }\n\n // the first parameter in all react components is the props\n if (!parameterDeclaration[0].getChildrenOfKind(SyntaxKind.ObjectBindingPattern)[0]) {\n return [];\n }\n\n const componentIdentifier = node.getFirstDescendantByKindOrThrow(SyntaxKind.Identifier);\n const references = findReferencesAsJsxElements(componentIdentifier);\n\n const propsWithDefaultValues = parameterDeclaration[0]\n .getChildrenOfKind(SyntaxKind.ObjectBindingPattern)[0]\n .getElements()\n .filter((el) => !!el.getInitializer())\n .map((el) => {\n const stringLiteral = el.getDescendantsOfKind(SyntaxKind.StringLiteral)[0];\n const propName = el.getName();\n const values: string[] = [];\n if (stringLiteral) {\n values.push(stringLiteral.getLiteralText());\n }\n\n return [propName, values] as [string, string[]];\n })\n .filter(([propName]) => variantsList.includes(propName));\n\n const propsUsedInReferences = references\n .map((r) => getUsedPropsInReference(r, variants))\n .flat()\n .filter(([propName]) => variantsList.includes(propName));\n\n const mapPropToUsedOptions = new Map<string, Set<string>>();\n\n propsWithDefaultValues.concat(propsUsedInReferences).forEach(([propName, propValues]) => {\n // This means that an expression has been used\n // so we need to add all possible options for that prop\n if (propValues.length === 0) {\n propValues = Object.keys(variants[propName as keyof typeof variants]);\n }\n\n const options: Set<string> = mapPropToUsedOptions.get(propName) ?? new Set();\n propValues.forEach((val) => options.add(val));\n mapPropToUsedOptions.set(propName, options);\n });\n\n const res: Array<[string, string[]]> = Array.from(mapPropToUsedOptions).map(\n ([propName, options]) => [propName, Array.from(options)],\n );\n\n return res;\n};\n\n/**\n * Gets the Tailwind CSS classes used in a component\n */\nconst getTwClassesInComponent = async (\n componentsList: ComponentsList,\n exportsToFilePath: ExportToFilePath,\n): Promise<ComponentToTwClasses> => {\n const CSS_DATA = `\n @tailwind components;\n @tailwind utilities;\n `;\n\n const res: ComponentToTwClasses = {};\n\n const promises = componentsList.map((component) => {\n const plugin = tailwindcss({\n content: [exportsToFilePath[component]],\n plugins: [tailwindPlugin({ config: defaultTokensConfig })],\n });\n return postcss([plugin as AcceptedPlugin]).process(CSS_DATA, {\n from: 'app.css',\n to: './dist/app.css',\n });\n });\n\n const resolvedPromises = await Promise.all(promises);\n\n resolvedPromises.forEach((result, i) => {\n const currentComponent = componentsList[i];\n const classes = result.root.nodes\n .map((node) => {\n if ((node as any).selector) {\n return (node as any).selector.replace('.', '');\n }\n\n return [];\n })\n .join(' ')\n // replace multiple spaces with one space\n .replace(/\\s+/g, ' ');\n res[currentComponent] = classes;\n });\n\n return res;\n};\n\n/**\n * Goes through the list of all exports from UDS (stable and experimental)\n * and return a map of each exports and the source file path where its declared\n */\nconst getExportsToFilePath = (project: Project): ExportToFilePath => {\n const stableComponentsMainFile = project.getSourceFileOrThrow('./src/components/index.ts');\n const experimentalComponentsMainFile = project.getSourceFileOrThrow(\n './src/components/experimental/index.ts',\n );\n const exportToFilePath: ExportToFilePath = {};\n for (const [name, declarations] of stableComponentsMainFile.getExportedDeclarations()) {\n exportToFilePath[name] = declarations.map((d) => d.getSourceFile().getFilePath())[0];\n }\n for (const [name, declarations] of experimentalComponentsMainFile.getExportedDeclarations()) {\n exportToFilePath[name] = declarations.map((d) => d.getSourceFile().getFilePath())[0];\n }\n\n return exportToFilePath;\n};\n\n/**\n * Adds auto-generated variants to the Tailwind CSS classes of components.\n *\n * This function extracts component names from auto variants keys, groups class names by component,\n * updates component classes using auto-generated variant classes, and propagates base classes to subcomponents.\n *\n * @param componentToTwClasses - A map of component names to their current Tailwind CSS classes.\n * @returns Updated map with auto variants added to the component classes.\n */\nconst addAutoVariantsToComponentClasses = (\n componentToTwClasses: ComponentToTwClasses,\n): ComponentToTwClasses => {\n // Extract component names from auto variants keys\n // Example: \"checkboxSizeRoot\" -> \"Checkbox\"\n const componentNameRegex = /^([a-z]+)[A-Z]/;\n const componentNameMap: Record<string, string[]> = {};\n\n // Create a case-insensitive lookup map from component names in componentToTwClasses\n const componentNameLookup = new Map<string, string>();\n Object.keys(componentToTwClasses).forEach((actualName) => {\n componentNameLookup.set(actualName.toLowerCase(), actualName);\n });\n\n // Group class names by component\n Object.keys(autoVariants).forEach((key) => {\n const match = key.match(componentNameRegex);\n if (match && match[1]) {\n const extractedName = match[1].charAt(0).toUpperCase() + match[1].slice(1);\n // Use case-insensitive lookup to find the actual component name\n const actualComponentName =\n componentNameLookup.get(extractedName.toLowerCase()) || extractedName;\n\n if (!componentNameMap[actualComponentName]) {\n componentNameMap[actualComponentName] = [];\n }\n\n // Get all class names for this variant\n Object.values(autoVariants[key as keyof typeof autoVariants]).forEach((className) => {\n componentNameMap[actualComponentName].push(className);\n });\n }\n });\n\n // Add or update component classes\n Object.entries(componentNameMap).forEach(([componentName, classes]) => {\n const existingClasses = componentToTwClasses[componentName] || '';\n componentToTwClasses[componentName] = `${existingClasses} ${classes.join(' ')}`.trim();\n });\n\n // add a step to also add the classes to sub components (example, AvatarText, AvatarIcon, ...)\n const components = Object.keys(componentNameMap);\n Object.keys(componentToTwClasses).forEach((key) => {\n components.forEach((comp) => {\n const compName = comp.charAt(0).toUpperCase() + comp.slice(1);\n if (key.startsWith(compName) && key !== compName) {\n const baseClasses = componentToTwClasses[compName] || '';\n if (baseClasses) {\n componentToTwClasses[key] = `${componentToTwClasses[key]} ${baseClasses}`.trim();\n }\n }\n });\n });\n return componentToTwClasses;\n};\n\nexport {\n addAutoVariantsToComponentClasses,\n convertVariantsIntoTailwindClass,\n getComponentsDependencies,\n getComponentsProps,\n getComponentUdsDependencies,\n getExportedComponents,\n getExportsToFilePath,\n getInitializedAndReferencedProps,\n getTwClassesInComponent,\n NO_FILE,\n};\n"],"mappings":";;;;;;;;;;;;AA2BA,MAAM,UAAkB;;;;;AAMxB,MAAM,yBACJ,KACA,qBACmB;CACnB,MAAM,mBAAmB,OAAO,KAAK,IAAI;CACzC,MAAM,yBAAyB,OAAO,KAAK,iBAAiB;AAQ5D,QAPmB,iBAAiB,OAAO,uBAAuB,CAC1C,QAAQ,QAAQ;EACtC,MAAM,+CAA+B,IAAI,OAAO,cAAc;EAC9D,MAAM,gBAAgB,IAAI,SAAS,IAAI;EACvC,MAAM,0BAA0B,6BAA6B,KAAK,IAAI;AACtE,SAAO,CAAC,iBAAiB;GACzB;;;;;;AAQJ,MAAM,6BACJ,SACA,gBACA,sBAC0B;CAC1B,MAAM,oBAAoB,IAAI,IAAI,eAAe;CAEjD,MAAM,2BAAsD,EAAE;AAC9D,gBAAe,SAAS,cAAc;AACpC,2BAAyB,aAAa,4BACpC,SACA,mBACA,WACA,kBACD;GACD;AACF,QAAO;;;;;;AAOT,MAAM,+BACJ,SACA,gBACA,eACA,sBACa;AAWb,QAVmB,QAAQ,qBAAqB,kBAAkB,eAAe,CAG9E,uBAAuB,CACvB,KAAK,gBAAgB;AACpB,SAAO,YAAY,iBAAiB,CAAC,KAAK,gBAAgB,YAAY,SAAS,CAAC;GAChF,CACD,MAAM,CACN,QAAQ,gBAAgB,eAAe,IAAI,YAAY,CAAC;;AAK7D,MAAM,sBACJ,SACA,MACA,UACA,cACA,sBACwB;CACxB,MA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;AACjD,aAAW,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;AAC7D,OAAI,IAAI,WAAW,SAAS,IAAI,QAAQ,UAAU;IAChD,MAAM,cAAc,qBAAqB,aAAa;AACtD,QAAI,YACF,sBAAqB,OAAO,GAAG,qBAAqB,KAAK,GAAG,cAAc,MAAM;;IAGpF;GACF;AACF,QAAO"}
|
|
1
|
+
{"version":3,"file":"generatePurgeCSSData.js","names":[],"sources":["../../src/utils/generatePurgeCSSData.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { autoVariants } from '@yahoo/uds-automated-config/autoVariants';\nimport { print, red } from '@yahoo/uds-cli/lib';\nimport { defaultTokensConfig } from '@yahoo/uds-config';\nimport type { AcceptedPlugin } from 'postcss';\nimport postcss from 'postcss';\nimport tailwindcss from 'tailwindcss';\nimport type { Project } from 'ts-morph';\nimport { SyntaxKind } from 'ts-morph';\n\nimport { tailwindPlugin } from '../tailwind/tailwindPlugin';\nimport {\n findReferencesAsJsxElements,\n getReactFunctionDeclaration,\n getUsedPropsInReference,\n} from './tsMorph';\n\ntype ComponentsList = string[];\ntype ComponentToVariants = { [key: string]: PropToUsedOptions[] };\ntype VariantsList = string[];\ntype ComponentDependencies = { [key: string]: string[] };\ntype ComponentToTwClasses = { [key: string]: string };\ntype ExportToFilePath = { [key: string]: string };\ntype AllProps = Array<[string, string[]]>;\ntype PropToUsedOptions = [string, string[]];\n\nconst NO_FILE: string = 'noFile';\n\n/**\n * Returns a list of exported Components from UDS\n * both stable and experimental\n */\nconst getExportedComponents = (\n UDS: Record<string, any>,\n UDS_EXPERIMENTAL: Record<string, any>,\n): ComponentsList => {\n const udsStableExports = Object.keys(UDS);\n const udsExperimentalExports = Object.keys(UDS_EXPERIMENTAL);\n const allExports = udsStableExports.concat(udsExperimentalExports);\n const keys = allExports.filter((key) => {\n const regexStartsWithCapitalLetter = new RegExp('^[A-Z].[^_]');\n const hasUnderscore = key.includes('_');\n const startsWithCapitalLetter = regexStartsWithCapitalLetter.test(key);\n return !hasUnderscore && startsWithCapitalLetter;\n });\n return keys;\n};\n\n/**\n * Some UDS components are built using other UDS components,\n * we need to know those dependencies so generate the correct\n */\nconst getComponentsDependencies = (\n project: Project,\n componentsList: ComponentsList,\n exportsToFilePath: ExportToFilePath,\n): ComponentDependencies => {\n const componentsListSet = new Set(componentsList);\n // the components a component from UDS depends on\n const componentUDSDependencies: { [k: string]: string[] } = {};\n componentsList.forEach((component) => {\n componentUDSDependencies[component] = getComponentUdsDependencies(\n project,\n componentsListSet,\n component,\n exportsToFilePath,\n );\n });\n return componentUDSDependencies;\n};\n\n/**\n * We need to make sure that components from UDS that use other components\n * from UDS also gets included\n */\nconst getComponentUdsDependencies = (\n project: Project,\n componentsList: Set<string>,\n componentName: string,\n exportsToFilePath: ExportToFilePath,\n): string[] => {\n const sourceFile = project.getSourceFileOrThrow(exportsToFilePath[componentName]);\n\n const deps = sourceFile\n .getImportDeclarations()\n .map((declaration) => {\n return declaration.getNamedImports().map((namedImport) => namedImport.getName());\n })\n .flat()\n .filter((namedImport) => componentsList.has(namedImport));\n\n return deps;\n};\n\nconst getComponentsProps = (\n project: Project,\n list: ComponentsList,\n variants: Record<string, Record<string, string>>,\n variantsList: VariantsList,\n exportsToFilePath: ExportToFilePath,\n): ComponentToVariants => {\n const map: ComponentToVariants = {};\n\n list.forEach((componentName) => {\n const list = getInitializedAndReferencedProps(\n project,\n componentName,\n variants,\n variantsList,\n exportsToFilePath,\n );\n map[componentName] = list;\n });\n\n return map;\n};\n\n/**\n * Converts the variants object used in CVA to\n */\nconst convertVariantsIntoTailwindClass = (\n variants: Record<string, Record<string, string>>,\n): VariantsList => {\n const variantsList = Object.keys(variants) as Array<keyof typeof variants>;\n\n return variantsList;\n};\n\n/**\n * Get the params with default values,\n * required and the ones used in references\n */\nconst getInitializedAndReferencedProps = (\n project: Project,\n componentName: string,\n variants: Record<string, Record<string, string>>,\n variantsList: VariantsList,\n exportsToFilePath: ExportToFilePath,\n): AllProps => {\n const sourceFile = project.getSourceFileOrThrow(exportsToFilePath[componentName] ?? NO_FILE);\n\n const functionDeclarations = sourceFile.getFunctions();\n const variableDeclarations = sourceFile.getVariableDeclarations();\n const node = [...functionDeclarations, ...variableDeclarations].filter(\n (declaration) => declaration.getName() === componentName,\n )[0];\n\n const functionDeclaration = getReactFunctionDeclaration(node);\n\n if (!functionDeclaration) {\n print(red(`No function declaration found for ${componentName}`));\n }\n\n const parameterDeclaration = functionDeclaration?.getParameters();\n\n if (!parameterDeclaration || parameterDeclaration.length === 0) {\n print(red(`No parameter declaration found for ${componentName}`));\n return [];\n }\n\n // the first parameter in all react components is the props\n if (!parameterDeclaration[0].getChildrenOfKind(SyntaxKind.ObjectBindingPattern)[0]) {\n return [];\n }\n\n const componentIdentifier = node.getFirstDescendantByKindOrThrow(SyntaxKind.Identifier);\n const references = findReferencesAsJsxElements(componentIdentifier);\n\n const propsWithDefaultValues = parameterDeclaration[0]\n .getChildrenOfKind(SyntaxKind.ObjectBindingPattern)[0]\n .getElements()\n .filter((el) => !!el.getInitializer())\n .map((el) => {\n const stringLiteral = el.getDescendantsOfKind(SyntaxKind.StringLiteral)[0];\n const propName = el.getName();\n const values: string[] = [];\n if (stringLiteral) {\n values.push(stringLiteral.getLiteralText());\n }\n\n return [propName, values] as [string, string[]];\n })\n .filter(([propName]) => variantsList.includes(propName));\n\n const propsUsedInReferences = references\n .map((r) => getUsedPropsInReference(r, variants))\n .flat()\n .filter(([propName]) => variantsList.includes(propName));\n\n const mapPropToUsedOptions = new Map<string, Set<string>>();\n\n propsWithDefaultValues.concat(propsUsedInReferences).forEach(([propName, propValues]) => {\n // This means that an expression has been used\n // so we need to add all possible options for that prop\n if (propValues.length === 0) {\n propValues = Object.keys(variants[propName as keyof typeof variants]);\n }\n\n const options: Set<string> = mapPropToUsedOptions.get(propName) ?? new Set();\n propValues.forEach((val) => options.add(val));\n mapPropToUsedOptions.set(propName, options);\n });\n\n const res: Array<[string, string[]]> = Array.from(mapPropToUsedOptions).map(\n ([propName, options]) => [propName, Array.from(options)],\n );\n\n return res;\n};\n\n/**\n * Gets the Tailwind CSS classes used in a component\n */\nconst getTwClassesInComponent = async (\n componentsList: ComponentsList,\n exportsToFilePath: ExportToFilePath,\n): Promise<ComponentToTwClasses> => {\n const CSS_DATA = `\n @tailwind components;\n @tailwind utilities;\n `;\n\n const res: ComponentToTwClasses = {};\n\n const promises = componentsList.map((component) => {\n const plugin = tailwindcss({\n content: [exportsToFilePath[component]],\n plugins: [tailwindPlugin({ config: defaultTokensConfig })],\n });\n return postcss([plugin as AcceptedPlugin]).process(CSS_DATA, {\n from: 'app.css',\n to: './dist/app.css',\n });\n });\n\n const resolvedPromises = await Promise.all(promises);\n\n resolvedPromises.forEach((result, i) => {\n const currentComponent = componentsList[i];\n const classes = result.root.nodes\n .map((node) => {\n if ((node as any).selector) {\n return (node as any).selector.replace('.', '');\n }\n\n return [];\n })\n .join(' ')\n // replace multiple spaces with one space\n .replace(/\\s+/g, ' ');\n res[currentComponent] = classes;\n });\n\n return res;\n};\n\n/**\n * Goes through the list of all exports from UDS (stable and experimental)\n * and return a map of each exports and the source file path where its declared\n */\nconst getExportsToFilePath = (project: Project): ExportToFilePath => {\n const stableComponentsMainFile = project.getSourceFileOrThrow('./src/components/index.ts');\n const experimentalComponentsMainFile = project.getSourceFileOrThrow(\n './src/components/experimental/index.ts',\n );\n const exportToFilePath: ExportToFilePath = {};\n for (const [name, declarations] of stableComponentsMainFile.getExportedDeclarations()) {\n exportToFilePath[name] = declarations.map((d) => d.getSourceFile().getFilePath())[0];\n }\n for (const [name, declarations] of experimentalComponentsMainFile.getExportedDeclarations()) {\n exportToFilePath[name] = declarations.map((d) => d.getSourceFile().getFilePath())[0];\n }\n\n return exportToFilePath;\n};\n\n/**\n * Adds auto-generated variants to the Tailwind CSS classes of components.\n *\n * This function extracts component names from auto variants keys, groups class names by component,\n * updates component classes using auto-generated variant classes, and propagates base classes to subcomponents.\n *\n * @param componentToTwClasses - A map of component names to their current Tailwind CSS classes.\n * @returns Updated map with auto variants added to the component classes.\n */\nconst addAutoVariantsToComponentClasses = (\n componentToTwClasses: ComponentToTwClasses,\n): ComponentToTwClasses => {\n // Extract component names from auto variants keys\n // Example: \"checkboxSizeRoot\" -> \"Checkbox\"\n const componentNameRegex = /^([a-z]+)[A-Z]/;\n const componentNameMap: Record<string, string[]> = {};\n\n // Create a case-insensitive lookup map from component names in componentToTwClasses\n const componentNameLookup = new Map<string, string>();\n Object.keys(componentToTwClasses).forEach((actualName) => {\n componentNameLookup.set(actualName.toLowerCase(), actualName);\n });\n\n // Group class names by component\n Object.keys(autoVariants).forEach((key) => {\n const match = key.match(componentNameRegex);\n if (match && match[1]) {\n const extractedName = match[1].charAt(0).toUpperCase() + match[1].slice(1);\n // Use case-insensitive lookup to find the actual component name\n const actualComponentName =\n componentNameLookup.get(extractedName.toLowerCase()) || extractedName;\n\n if (!componentNameMap[actualComponentName]) {\n componentNameMap[actualComponentName] = [];\n }\n\n // Get all class names for this variant\n Object.values(autoVariants[key as keyof typeof autoVariants]).forEach((className) => {\n componentNameMap[actualComponentName].push(className);\n });\n }\n });\n\n // Add or update component classes\n Object.entries(componentNameMap).forEach(([componentName, classes]) => {\n const existingClasses = componentToTwClasses[componentName] || '';\n componentToTwClasses[componentName] = `${existingClasses} ${classes.join(' ')}`.trim();\n });\n\n // add a step to also add the classes to sub components (example, AvatarText, AvatarIcon, ...)\n const components = Object.keys(componentNameMap);\n Object.keys(componentToTwClasses).forEach((key) => {\n components.forEach((comp) => {\n const compName = comp.charAt(0).toUpperCase() + comp.slice(1);\n if (key.startsWith(compName) && key !== compName) {\n const baseClasses = componentToTwClasses[compName] || '';\n if (baseClasses) {\n componentToTwClasses[key] = `${componentToTwClasses[key]} ${baseClasses}`.trim();\n }\n }\n });\n });\n return componentToTwClasses;\n};\n\nexport {\n addAutoVariantsToComponentClasses,\n convertVariantsIntoTailwindClass,\n getComponentsDependencies,\n getComponentsProps,\n getComponentUdsDependencies,\n getExportedComponents,\n getExportsToFilePath,\n getInitializedAndReferencedProps,\n getTwClassesInComponent,\n NO_FILE,\n};\n"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAM,yBACJ,KACA,qBACmB;CACnB,MAAM,mBAAmB,OAAO,KAAK,IAAI;CACzC,MAAM,yBAAyB,OAAO,KAAK,iBAAiB;AAQ5D,QAPmB,iBAAiB,OAAO,uBACpB,CAAC,QAAQ,QAAQ;EACtC,MAAM,+CAA+B,IAAI,OAAO,cAAc;EAC9D,MAAM,gBAAgB,IAAI,SAAS,IAAI;EACvC,MAAM,0BAA0B,6BAA6B,KAAK,IAAI;AACtE,SAAO,CAAC,iBAAiB;GAEhB;;;;;;AAOb,MAAM,6BACJ,SACA,gBACA,sBAC0B;CAC1B,MAAM,oBAAoB,IAAI,IAAI,eAAe;CAEjD,MAAM,2BAAsD,EAAE;AAC9D,gBAAe,SAAS,cAAc;AACpC,2BAAyB,aAAa,4BACpC,SACA,mBACA,WACA,kBACD;GACD;AACF,QAAO;;;;;;AAOT,MAAM,+BACJ,SACA,gBACA,eACA,sBACa;AAWb,QAVmB,QAAQ,qBAAqB,kBAAkB,eAE3C,CACpB,uBAAuB,CACvB,KAAK,gBAAgB;AACpB,SAAO,YAAY,iBAAiB,CAAC,KAAK,gBAAgB,YAAY,SAAS,CAAC;GAChF,CACD,MAAM,CACN,QAAQ,gBAAgB,eAAe,IAAI,YAAY,CAE/C;;AAGb,MAAM,sBACJ,SACA,MACA,UACA,cACA,sBACwB;CACxB,MAAM,MAA2B,EAAE;AAEnC,MAAK,SAAS,kBAAkB;AAQ9B,MAAI,iBAPS,iCACX,SACA,eACA,UACA,cACA,kBAEuB;GACzB;AAEF,QAAO;;;;;AAMT,MAAM,oCACJ,aACiB;AAGjB,QAFqB,OAAO,KAAK,SAEd;;;;;;AAOrB,MAAM,oCACJ,SACA,eACA,UACA,cACA,sBAC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B,KAAK,GAAG,cAAc,MAAM;;IAGpF;GACF;AACF,QAAO"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
|
-
|
|
3
2
|
//#region src/utils/mapValues.ts
|
|
4
3
|
function mapValues(obj, callbackFn) {
|
|
5
4
|
return Object.keys(obj).reduce((acc, key, i) => {
|
|
@@ -7,6 +6,5 @@ function mapValues(obj, callbackFn) {
|
|
|
7
6
|
return acc;
|
|
8
7
|
}, {});
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
//#endregion
|
|
12
|
-
exports.mapValues = mapValues;
|
|
10
|
+
exports.mapValues = mapValues;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
|
-
const require_runtime = require(
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
let lodash_clamp_js = require("lodash/clamp.js");
|
|
4
|
-
lodash_clamp_js = require_runtime.__toESM(lodash_clamp_js);
|
|
5
|
-
|
|
4
|
+
lodash_clamp_js = require_runtime.__toESM(lodash_clamp_js, 1);
|
|
6
5
|
//#region src/utils/opacity.ts
|
|
7
6
|
/**
|
|
8
7
|
* Converts a number or string to a valid OpacityStep.
|
|
@@ -22,6 +21,5 @@ function parseOpacityStep(opacity) {
|
|
|
22
21
|
if (isNaN(parsed)) throw new Error(`Invalid opacity value: cannot parse "${opacity}" as a number`);
|
|
23
22
|
return (0, lodash_clamp_js.default)(parsed, 0, 100).toString();
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
//#endregion
|
|
27
|
-
exports.parseOpacityStep = parseOpacityStep;
|
|
25
|
+
exports.parseOpacityStep = parseOpacityStep;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
2
|
import { clamp } from "lodash-es";
|
|
3
|
-
|
|
4
3
|
//#region src/utils/opacity.ts
|
|
5
4
|
/**
|
|
6
5
|
* Converts a number or string to a valid OpacityStep.
|
|
@@ -20,7 +19,7 @@ function parseOpacityStep(opacity) {
|
|
|
20
19
|
if (isNaN(parsed)) throw new Error(`Invalid opacity value: cannot parse "${opacity}" as a number`);
|
|
21
20
|
return clamp(parsed, 0, 100).toString();
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
23
|
export { parseOpacityStep };
|
|
24
|
+
|
|
26
25
|
//# sourceMappingURL=opacity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opacity.js","names":[],"sources":["../../src/utils/opacity.ts"],"sourcesContent":["import type { OpacityStep } from '@yahoo/uds-types';\nimport { clamp } from 'lodash';\n\n/**\n * Converts a number or string to a valid OpacityStep.\n *\n * Converts a number or string to a valid OpacityStep by:\n * - Parsing the value as an integer\n * - Clamping between 0 and 100\n * - Returning as a string in the format expected by OpacityStep\n *\n * @param opacity - The opacity value (number or string)\n * @returns A valid OpacityStep string clamped between 0-100\n * @throws {Error} If opacity is undefined, null, or cannot be parsed as a number\n */\nexport function parseOpacityStep(opacity: number | string | undefined): OpacityStep {\n if (opacity === undefined || opacity === null) {\n throw new Error(`Invalid opacity value: ${opacity}`);\n }\n\n const parsed = typeof opacity === 'number' ? opacity : parseInt(opacity, 10);\n\n if (isNaN(parsed)) {\n throw new Error(`Invalid opacity value: cannot parse \"${opacity}\" as a number`);\n }\n\n return clamp(parsed, 0, 100).toString() as OpacityStep;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"opacity.js","names":[],"sources":["../../src/utils/opacity.ts"],"sourcesContent":["import type { OpacityStep } from '@yahoo/uds-types';\nimport { clamp } from 'lodash';\n\n/**\n * Converts a number or string to a valid OpacityStep.\n *\n * Converts a number or string to a valid OpacityStep by:\n * - Parsing the value as an integer\n * - Clamping between 0 and 100\n * - Returning as a string in the format expected by OpacityStep\n *\n * @param opacity - The opacity value (number or string)\n * @returns A valid OpacityStep string clamped between 0-100\n * @throws {Error} If opacity is undefined, null, or cannot be parsed as a number\n */\nexport function parseOpacityStep(opacity: number | string | undefined): OpacityStep {\n if (opacity === undefined || opacity === null) {\n throw new Error(`Invalid opacity value: ${opacity}`);\n }\n\n const parsed = typeof opacity === 'number' ? opacity : parseInt(opacity, 10);\n\n if (isNaN(parsed)) {\n throw new Error(`Invalid opacity value: cannot parse \"${opacity}\" as a number`);\n }\n\n return clamp(parsed, 0, 100).toString() as OpacityStep;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAgB,iBAAiB,SAAmD;AAClF,KAAI,YAAY,KAAA,KAAa,YAAY,KACvC,OAAM,IAAI,MAAM,0BAA0B,UAAU;CAGtD,MAAM,SAAS,OAAO,YAAY,WAAW,UAAU,SAAS,SAAS,GAAG;AAE5E,KAAI,MAAM,OAAO,CACf,OAAM,IAAI,MAAM,wCAAwC,QAAQ,eAAe;AAGjF,QAAO,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
|
-
const require_runtime = require(
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
let node_zlib = require("node:zlib");
|
|
4
4
|
let postcss = require("postcss");
|
|
5
|
-
postcss = require_runtime.__toESM(postcss);
|
|
6
|
-
|
|
5
|
+
postcss = require_runtime.__toESM(postcss, 1);
|
|
7
6
|
//#region src/utils/optimizeCSS.ts
|
|
8
7
|
/**
|
|
9
8
|
* Check if a selector is a "meaningful" selector (class, ID, attribute, or pseudo-class)
|
|
@@ -399,6 +398,5 @@ async function optimizeCSS(css, options) {
|
|
|
399
398
|
}
|
|
400
399
|
};
|
|
401
400
|
}
|
|
402
|
-
|
|
403
401
|
//#endregion
|
|
404
|
-
exports.optimizeCSS = optimizeCSS;
|
|
402
|
+
exports.optimizeCSS = optimizeCSS;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
2
|
import { gzipSync } from "node:zlib";
|
|
3
3
|
import postcss from "postcss";
|
|
4
|
-
|
|
5
4
|
//#region src/utils/optimizeCSS.ts
|
|
6
5
|
/**
|
|
7
6
|
* Check if a selector is a "meaningful" selector (class, ID, attribute, or pseudo-class)
|
|
@@ -397,7 +396,7 @@ async function optimizeCSS(css, options) {
|
|
|
397
396
|
}
|
|
398
397
|
};
|
|
399
398
|
}
|
|
400
|
-
|
|
401
399
|
//#endregion
|
|
402
400
|
export { optimizeCSS };
|
|
401
|
+
|
|
403
402
|
//# sourceMappingURL=optimizeCSS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimizeCSS.js","names":[],"sources":["../../src/utils/optimizeCSS.ts"],"sourcesContent":["import { gzipSync } from 'node:zlib';\n\nimport type { AtRule, Declaration, Plugin, Root, Rule } from 'postcss';\nimport postcss from 'postcss';\n\n/**\n * Check if a selector is a \"meaningful\" selector (class, ID, attribute, or pseudo-class)\n * as opposed to just element/type selectors (like `code, kbd, pre` in preflight).\n * Meaningful selectors indicate the font is actually used by components, not just base reset.\n */\nfunction isMeaningfulSelector(selector: string): boolean {\n // Split compound selectors\n const parts = selector.split(',').map((s) => s.trim());\n\n for (const part of parts) {\n // Check if any part of the selector has class, ID, attribute, or custom pseudo-class\n // This indicates actual usage by components, not just preflight/reset\n if (\n part.includes('.') || // class selector\n part.includes('#') || // ID selector\n part.includes('[') || // attribute selector\n part.includes(':not(') || // complex pseudo-class\n part.includes(':where(') ||\n part.includes(':is(') ||\n part.includes(':has(')\n ) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * PostCSS plugin to remove @font-face declarations for font families that are not used\n * anywhere in the CSS (excluding preflight/reset styles that only use element selectors).\n */\nfunction removeUnusedFontFaces(): Plugin {\n return {\n postcssPlugin: 'remove-unused-font-faces',\n Once(root: Root) {\n // Track font variables and whether they're used in meaningful selectors\n // Key: variable name (without --uds-font- prefix), Value: { used: boolean, meaningful: boolean }\n const fontVarUsage = new Map<string, { used: boolean; meaningful: boolean }>();\n\n // First pass: collect all font-family references from the CSS (excluding @font-face)\n const usedFontFamilies = new Set<string>();\n\n root.walkDecls('font-family', (decl) => {\n // Skip font-family declarations inside @font-face\n if (decl.parent?.type === 'atrule' && (decl.parent as AtRule).name === 'font-face') {\n return;\n }\n\n // Get the selector for this rule\n const rule = decl.parent as Rule;\n const selector = rule?.selector || '';\n const meaningful = isMeaningfulSelector(selector);\n\n // Parse font-family value to extract font names\n // Handles: \"Font Name\", 'Font Name', Font-Name, var(--uds-font-xxx)\n const value = decl.value;\n\n // Check for CSS variables that reference fonts\n const varMatches = value.matchAll(/var\\(--uds-font-([^),]+)\\)/g);\n for (const match of varMatches) {\n const varName = match[1];\n const existing = fontVarUsage.get(varName) || { used: false, meaningful: false };\n fontVarUsage.set(varName, {\n used: true,\n meaningful: existing.meaningful || meaningful,\n });\n }\n\n // Extract font family names (quoted or unquoted) - only if in meaningful selector\n if (meaningful) {\n const fontNames = value\n .split(',')\n .map((font) => font.trim())\n .map((font) => {\n // Remove quotes\n if (\n (font.startsWith('\"') && font.endsWith('\"')) ||\n (font.startsWith(\"'\") && font.endsWith(\"'\"))\n ) {\n return font.slice(1, -1);\n }\n // Skip var() references and generic families\n if (\n font.startsWith('var(') ||\n [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-monospace',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-rounded',\n ].includes(font.toLowerCase())\n ) {\n return null;\n }\n return font;\n })\n .filter(Boolean) as string[];\n\n fontNames.forEach((name) => usedFontFamilies.add(name));\n }\n });\n\n // Collect all font variable definitions for resolving nested references\n const fontVarDefinitions = new Map<string, string>();\n root.walkDecls((decl) => {\n if (\n decl.prop.startsWith('--uds-font-') &&\n !decl.prop.includes('size') &&\n !decl.prop.includes('weight') &&\n !decl.prop.includes('slant') &&\n !decl.prop.includes('width')\n ) {\n const varName = decl.prop.replace('--uds-font-', '');\n fontVarDefinitions.set(varName, decl.value);\n }\n });\n\n // Helper to resolve a variable value to actual font names (handles nested var() references)\n const resolveToFontNames = (value: string, visited = new Set<string>()): string[] => {\n const fontNames: string[] = [];\n\n // Check for nested var() references\n const varMatch = value.match(/var\\(--uds-font-([^),]+)\\)/);\n if (varMatch) {\n const nestedVarName = varMatch[1];\n // Prevent infinite loops\n if (!visited.has(nestedVarName)) {\n visited.add(nestedVarName);\n const nestedValue = fontVarDefinitions.get(nestedVarName);\n if (nestedValue) {\n // Mark the nested variable as used if parent is used\n const nestedUsage = fontVarUsage.get(nestedVarName);\n if (nestedUsage) {\n // Propagate meaningful status up the chain\n const parentUsage = fontVarUsage.get(\n value.replace(/var\\(--uds-font-([^),]+)\\).*/, '$1'),\n );\n if (parentUsage?.meaningful) {\n nestedUsage.meaningful = true;\n }\n }\n fontNames.push(...resolveToFontNames(nestedValue, visited));\n }\n }\n }\n\n // Extract actual font names from the value\n value\n .split(',')\n .map((font) => font.trim())\n .forEach((font) => {\n // Skip var() references (handled above)\n if (font.startsWith('var(')) {\n return;\n }\n\n // Remove quotes\n if (\n (font.startsWith('\"') && font.endsWith('\"')) ||\n (font.startsWith(\"'\") && font.endsWith(\"'\"))\n ) {\n font = font.slice(1, -1);\n }\n\n // Skip generic families\n if (\n [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-monospace',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-rounded',\n ].includes(font.toLowerCase())\n ) {\n return;\n }\n\n if (font) {\n fontNames.push(font);\n }\n });\n\n return fontNames;\n };\n\n // Process font variable definitions and resolve nested references\n for (const [varName, value] of fontVarDefinitions) {\n const usage = fontVarUsage.get(varName);\n\n // Only include fonts from this variable if it's used in a meaningful selector\n if (usage?.used && usage?.meaningful) {\n const fontNames = resolveToFontNames(value);\n fontNames.forEach((name) => usedFontFamilies.add(name));\n }\n }\n\n // Second pass: remove unused @font-face rules and track which fonts are kept\n const keptFonts = new Set<string>();\n root.walkAtRules('font-face', (atRule) => {\n let fontFamily: string | null = null;\n\n atRule.walkDecls('font-family', (decl) => {\n fontFamily = decl.value.replace(/[\"']/g, '').trim();\n });\n\n if (fontFamily && !usedFontFamilies.has(fontFamily)) {\n atRule.remove();\n } else if (fontFamily) {\n keptFonts.add(fontFamily);\n }\n });\n\n // Third pass: update CSS variable definitions to remove fonts that were not kept\n // This ensures variables like --uds-font-mono don't reference fonts we didn't load\n root.walkDecls((decl) => {\n if (\n decl.prop.startsWith('--uds-font-') &&\n !decl.prop.includes('size') &&\n !decl.prop.includes('weight') &&\n !decl.prop.includes('slant') &&\n !decl.prop.includes('width')\n ) {\n // Parse the font stack and filter out fonts that weren't kept\n const fonts = decl.value.split(',').map((f) => f.trim());\n const filteredFonts = fonts.filter((font) => {\n // Keep var() references\n if (font.startsWith('var(')) {\n return true;\n }\n\n // Extract font name (remove quotes)\n let fontName = font;\n if (\n (font.startsWith('\"') && font.endsWith('\"')) ||\n (font.startsWith(\"'\") && font.endsWith(\"'\"))\n ) {\n fontName = font.slice(1, -1);\n }\n\n // Keep generic font families\n if (\n [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-monospace',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-rounded',\n ].includes(fontName.toLowerCase())\n ) {\n return true;\n }\n\n // Keep fonts that have @font-face declarations\n return keptFonts.has(fontName);\n });\n\n // Update the declaration if fonts were removed\n if (filteredFonts.length < fonts.length && filteredFonts.length > 0) {\n decl.value = filteredFonts.join(', ');\n }\n }\n });\n },\n };\n}\n\nremoveUnusedFontFaces.postcss = true;\n\n/**\n * PostCSS plugin to remove redundant .uds-color-mode-light rules.\n * Light mode is the default (set on :root), so the explicit class is unnecessary.\n */\nfunction removeRedundantLightModePlugin(): Plugin {\n return {\n postcssPlugin: 'remove-redundant-light-mode',\n Once(root: Root) {\n root.walkRules((rule) => {\n // Match .uds-color-mode-light selector (exact match or as part of selector list)\n const selectors = rule.selector.split(',').map((s) => s.trim());\n const filteredSelectors = selectors.filter((s) => {\n // Remove selectors that are exactly .uds-color-mode-light\n // or .uds-color-mode-light with just :root/:where/:is wrappers\n const normalized = s.replace(/\\s+/g, ' ').trim();\n return (\n normalized !== '.uds-color-mode-light' &&\n normalized !== ':root .uds-color-mode-light' &&\n normalized !== ':where(.uds-color-mode-light)' &&\n normalized !== ':is(.uds-color-mode-light)'\n );\n });\n\n if (filteredSelectors.length === 0) {\n // All selectors were light mode - remove the entire rule\n rule.remove();\n } else if (filteredSelectors.length < selectors.length) {\n // Some selectors were light mode - update the selector\n rule.selector = filteredSelectors.join(', ');\n }\n });\n },\n };\n}\n\nremoveRedundantLightModePlugin.postcss = true;\n\n/**\n * PostCSS plugin to remove empty CSS rules (rules with no declarations).\n * Also aggregates duplicate selectors.\n */\nfunction removeEmptyRulesPlugin(): Plugin {\n return {\n postcssPlugin: 'remove-empty-rules',\n Once(root: Root) {\n // Remove empty rules\n root.walkRules((rule) => {\n // Check if rule has any declarations (not just comments or empty)\n const hasDeclarations = rule.nodes?.some(\n (node) => node.type === 'decl' || (node.type === 'rule' && node.nodes?.length > 0),\n );\n\n if (!hasDeclarations) {\n rule.remove();\n }\n });\n\n // Remove empty at-rules (like empty @media blocks)\n root.walkAtRules((atRule) => {\n if (atRule.name !== 'font-face' && atRule.name !== 'keyframes') {\n const hasContent = atRule.nodes?.some((node) => {\n if (node.type === 'rule') {\n return node.nodes?.some((n) => n.type === 'decl');\n }\n if (node.type === 'decl') {\n return true;\n }\n return false;\n });\n\n if (!hasContent && atRule.nodes?.length === 0) {\n atRule.remove();\n }\n }\n });\n },\n };\n}\n\nremoveEmptyRulesPlugin.postcss = true;\n\n/**\n * PostCSS plugin to aggregate rules with identical selectors.\n */\nfunction aggregateDuplicateSelectorsPlugin(): Plugin {\n return {\n postcssPlugin: 'aggregate-duplicate-selectors',\n Once(root: Root) {\n // Map of selector -> first rule with that selector\n const selectorMap = new Map<string, Rule>();\n\n // Collect rules to process (only top-level rules, not nested)\n const rulesToProcess: Rule[] = [];\n root.walkRules((rule) => {\n // Only process top-level rules (direct children of root or at-rules)\n if (rule.parent?.type === 'root' || rule.parent?.type === 'atrule') {\n rulesToProcess.push(rule);\n }\n });\n\n for (const rule of rulesToProcess) {\n const selector = rule.selector;\n const parent = rule.parent;\n\n // Create a unique key including the parent context\n const parentKey =\n parent?.type === 'atrule'\n ? `@${(parent as AtRule).name}:${(parent as AtRule).params}`\n : 'root';\n const key = `${parentKey}|${selector}`;\n\n if (selectorMap.has(key)) {\n const existingRule = selectorMap.get(key)!;\n\n // Move all declarations from current rule to existing rule\n rule.walkDecls((decl) => {\n // Check if the declaration already exists\n const existingDecl = existingRule.nodes?.find(\n (node): node is Declaration => node.type === 'decl' && node.prop === decl.prop,\n );\n\n if (existingDecl) {\n // Replace with new value\n existingDecl.value = decl.value;\n } else {\n // Append the declaration\n existingRule.append(decl.clone());\n }\n });\n\n // Remove the duplicate rule\n rule.remove();\n } else {\n selectorMap.set(key, rule);\n }\n }\n },\n };\n}\n\naggregateDuplicateSelectorsPlugin.postcss = true;\n\n/**\n * Validates CSS syntax and returns any errors found.\n */\nfunction validateCSS(css: string): { valid: boolean; errors: string[] } {\n const errors: string[] = [];\n\n try {\n // Parse the CSS to check for syntax errors\n const result = postcss.parse(css);\n\n // Check for common issues\n result.walkRules((rule) => {\n // Check for empty selectors\n if (!rule.selector.trim()) {\n errors.push(`Empty selector found at line ${rule.source?.start?.line}`);\n }\n\n // Check for malformed selectors\n try {\n // Basic selector validation - this catches obvious syntax errors\n if (rule.selector.includes('{{') || rule.selector.includes('}}')) {\n errors.push(`Malformed selector \"${rule.selector}\" at line ${rule.source?.start?.line}`);\n }\n } catch {\n errors.push(`Invalid selector \"${rule.selector}\" at line ${rule.source?.start?.line}`);\n }\n });\n\n // Check for unclosed blocks (postcss.parse will throw for these)\n result.walkDecls((decl) => {\n // Check for missing values\n if (!decl.value.trim()) {\n errors.push(`Empty value for property \"${decl.prop}\" at line ${decl.source?.start?.line}`);\n }\n });\n\n return { valid: errors.length === 0, errors };\n } catch (error) {\n if (error instanceof Error) {\n errors.push(`CSS Parse Error: ${error.message}`);\n } else {\n errors.push('Unknown CSS parse error');\n }\n return { valid: false, errors };\n }\n}\n\n/**\n * Reference data extracted from CSS for deduplication\n */\ninterface CSSReferenceData {\n /** Font-face fingerprints (font-family + src + weight + style) */\n fontFaces: Set<string>;\n /** Keyframes fingerprints (name + content) */\n keyframes: Set<string>;\n /** Regular rule fingerprints (selector + declarations) */\n rules: Set<string>;\n}\n\n/**\n * Create a fingerprint for a @font-face rule\n */\nfunction getFontFaceFingerprint(atRule: AtRule): string {\n let fontFamily = '';\n let src = '';\n let fontWeight = 'normal';\n let fontStyle = 'normal';\n\n atRule.walkDecls((decl) => {\n if (decl.prop === 'font-family') {\n fontFamily = decl.value.replace(/[\"']/g, '').trim();\n } else if (decl.prop === 'src') {\n src = decl.value;\n } else if (decl.prop === 'font-weight') {\n fontWeight = decl.value;\n } else if (decl.prop === 'font-style') {\n fontStyle = decl.value;\n }\n });\n\n return JSON.stringify({ fontFamily, src, fontWeight, fontStyle });\n}\n\n/**\n * Create a fingerprint for a @keyframes rule\n */\nfunction getKeyframesFingerprint(atRule: AtRule): string {\n // Use name + normalized content as fingerprint\n const name = atRule.params;\n const content = atRule.toString().replace(/\\s+/g, ' ').trim();\n return JSON.stringify({ name, content });\n}\n\n/**\n * Normalize a selector by removing scope prefix and whitespace\n */\nfunction normalizeSelector(selector: string, scopeClass?: string): string {\n let normalized = selector.trim();\n if (scopeClass) {\n // Remove scope prefix patterns like \".scope \" or \".scope.\"\n const escapedScope = scopeClass.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n normalized = normalized\n .replace(new RegExp(`${escapedScope}\\\\s+`, 'g'), '')\n .replace(new RegExp(`${escapedScope}\\\\.`, 'g'), '.')\n .replace(new RegExp(`${escapedScope}`, 'g'), '');\n }\n return normalized.replace(/\\s+/g, ' ').trim();\n}\n\n/**\n * Create a fingerprint for a CSS rule (selector + declarations)\n */\nfunction getRuleFingerprint(rule: Rule, scopeClass?: string): string {\n const selector = normalizeSelector(rule.selector, scopeClass);\n const declarations: string[] = [];\n\n rule.walkDecls((decl) => {\n declarations.push(`${decl.prop}:${decl.value}`);\n });\n\n // Sort declarations for consistent comparison\n declarations.sort();\n return JSON.stringify({ selector, declarations });\n}\n\n/**\n * Extract reference data from CSS for deduplication\n */\nfunction extractCSSReferenceData(css: string, scopeClass?: string): CSSReferenceData {\n const data: CSSReferenceData = {\n fontFaces: new Set(),\n keyframes: new Set(),\n rules: new Set(),\n };\n\n try {\n const root = postcss.parse(css);\n\n root.walkAtRules((atRule) => {\n if (atRule.name === 'font-face') {\n data.fontFaces.add(getFontFaceFingerprint(atRule));\n } else if (atRule.name === 'keyframes' || atRule.name === '-webkit-keyframes') {\n data.keyframes.add(getKeyframesFingerprint(atRule));\n }\n });\n\n root.walkRules((rule) => {\n // Skip rules inside @font-face or @keyframes\n if (rule.parent?.type === 'atrule') {\n const parentName = (rule.parent as AtRule).name;\n if (\n parentName === 'font-face' ||\n parentName === 'keyframes' ||\n parentName === '-webkit-keyframes'\n ) {\n return;\n }\n }\n data.rules.add(getRuleFingerprint(rule, scopeClass));\n });\n } catch {\n // If parsing fails, return empty data\n }\n\n return data;\n}\n\n/**\n * PostCSS plugin to remove CSS that exists in reference CSS\n * Handles @font-face, @keyframes, and regular rule deduplication\n */\nfunction removeDuplicateCss(referenceData: CSSReferenceData, scopeClass?: string): Plugin {\n return {\n postcssPlugin: 'remove-duplicate-css',\n Once(root: Root) {\n const toRemove: (AtRule | Rule)[] = [];\n\n root.walkAtRules((atRule) => {\n if (atRule.name === 'font-face') {\n const fingerprint = getFontFaceFingerprint(atRule);\n if (referenceData.fontFaces.has(fingerprint)) {\n toRemove.push(atRule);\n }\n } else if (atRule.name === 'keyframes' || atRule.name === '-webkit-keyframes') {\n const fingerprint = getKeyframesFingerprint(atRule);\n if (referenceData.keyframes.has(fingerprint)) {\n toRemove.push(atRule);\n }\n }\n });\n\n root.walkRules((rule) => {\n // Skip rules inside @font-face or @keyframes\n if (rule.parent?.type === 'atrule') {\n const parentName = (rule.parent as AtRule).name;\n if (\n parentName === 'font-face' ||\n parentName === 'keyframes' ||\n parentName === '-webkit-keyframes'\n ) {\n return;\n }\n }\n\n const fingerprint = getRuleFingerprint(rule, scopeClass);\n if (referenceData.rules.has(fingerprint)) {\n toRemove.push(rule);\n }\n });\n\n // Remove duplicates\n for (const node of toRemove) {\n node.remove();\n }\n },\n };\n}\n\n/**\n * Options for CSS optimization\n */\ninterface OptimizeCSSOptions {\n /** Remove unused @font-face declarations (default: true) */\n removeUnusedFonts?: boolean;\n /** Remove empty CSS rules (default: true) */\n removeEmptyRules?: boolean;\n /** Aggregate duplicate selectors (default: true) */\n aggregateDuplicateSelectors?: boolean;\n /** Reference CSS to deduplicate against (for scoped CSS) */\n referenceCss?: string;\n /** Scope class used in this CSS (for normalizing selectors during deduplication) */\n scopeClass?: string;\n}\n\n/**\n * Optimizes CSS by:\n * 1. Removing unused @font-face declarations\n * 2. Removing empty rules\n * 3. Aggregating duplicate selectors\n *\n * Returns the optimized CSS and validation results.\n */\nasync function optimizeCSS(\n css: string,\n options?: OptimizeCSSOptions,\n): Promise<{\n css: string;\n validation: { valid: boolean; errors: string[] };\n stats: {\n originalSize: number;\n originalSizeGzip: number;\n optimizedSize: number;\n fontFacesRemoved: number;\n emptyRulesRemoved: number;\n };\n}> {\n const originalSize = Buffer.byteLength(css, 'utf8');\n const originalSizeGzip = gzipSync(css).length;\n\n // Count font-faces before\n const fontFacesBefore = (css.match(/@font-face/g) || []).length;\n\n // Count rules before (rough estimate)\n const rulesBefore = (css.match(/\\{[^}]*\\}/g) || []).length;\n\n // Build list of plugins based on options (all enabled by default)\n const plugins: postcss.AcceptedPlugin[] = [];\n\n if (options?.removeUnusedFonts !== false) {\n plugins.push(removeUnusedFontFaces());\n }\n\n // Remove redundant .uds-color-mode-light rules (light is default on :root)\n plugins.push(removeRedundantLightModePlugin());\n\n // If reference CSS is provided, deduplicate all matching CSS (font-faces, keyframes, rules)\n if (options?.referenceCss) {\n const referenceData = extractCSSReferenceData(options.referenceCss);\n if (\n referenceData.fontFaces.size > 0 ||\n referenceData.keyframes.size > 0 ||\n referenceData.rules.size > 0\n ) {\n plugins.push(removeDuplicateCss(referenceData, options.scopeClass));\n }\n }\n\n if (options?.removeEmptyRules !== false) {\n plugins.push(removeEmptyRulesPlugin());\n }\n\n if (options?.aggregateDuplicateSelectors !== false) {\n plugins.push(aggregateDuplicateSelectorsPlugin());\n }\n\n // Apply optimizations\n const result =\n plugins.length > 0 ? await postcss(plugins).process(css, { from: undefined }) : { css };\n\n const optimizedCSS = result.css;\n const optimizedSize = Buffer.byteLength(optimizedCSS, 'utf8');\n\n // Count font-faces after\n const fontFacesAfter = (optimizedCSS.match(/@font-face/g) || []).length;\n\n // Count rules after\n const rulesAfter = (optimizedCSS.match(/\\{[^}]*\\}/g) || []).length;\n\n // Validate the result\n const validation = validateCSS(optimizedCSS);\n\n return {\n css: optimizedCSS,\n validation,\n stats: {\n originalSize,\n originalSizeGzip,\n optimizedSize,\n fontFacesRemoved: fontFacesBefore - fontFacesAfter,\n emptyRulesRemoved: Math.max(0, rulesBefore - rulesAfter),\n },\n };\n}\n\nexport {\n aggregateDuplicateSelectorsPlugin as aggregateDuplicateSelectors,\n optimizeCSS,\n type OptimizeCSSOptions,\n removeEmptyRulesPlugin as removeEmptyRules,\n removeUnusedFontFaces,\n validateCSS,\n};\n"],"mappings":";;;;;;;;;;AAUA,SAAS,qBAAqB,UAA2B;CAEvD,MAAM,QAAQ,SAAS,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC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B,kBAAkB;GACpC,mBAAmB,KAAK,IAAI,GAAG,cAAc,WAAW;GACzD;EACF"}
|
|
1
|
+
{"version":3,"file":"optimizeCSS.js","names":[],"sources":["../../src/utils/optimizeCSS.ts"],"sourcesContent":["import { gzipSync } from 'node:zlib';\n\nimport type { AtRule, Declaration, Plugin, Root, Rule } from 'postcss';\nimport postcss from 'postcss';\n\n/**\n * Check if a selector is a \"meaningful\" selector (class, ID, attribute, or pseudo-class)\n * as opposed to just element/type selectors (like `code, kbd, pre` in preflight).\n * Meaningful selectors indicate the font is actually used by components, not just base reset.\n */\nfunction isMeaningfulSelector(selector: string): boolean {\n // Split compound selectors\n const parts = selector.split(',').map((s) => s.trim());\n\n for (const part of parts) {\n // Check if any part of the selector has class, ID, attribute, or custom pseudo-class\n // This indicates actual usage by components, not just preflight/reset\n if (\n part.includes('.') || // class selector\n part.includes('#') || // ID selector\n part.includes('[') || // attribute selector\n part.includes(':not(') || // complex pseudo-class\n part.includes(':where(') ||\n part.includes(':is(') ||\n part.includes(':has(')\n ) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * PostCSS plugin to remove @font-face declarations for font families that are not used\n * anywhere in the CSS (excluding preflight/reset styles that only use element selectors).\n */\nfunction removeUnusedFontFaces(): Plugin {\n return {\n postcssPlugin: 'remove-unused-font-faces',\n Once(root: Root) {\n // Track font variables and whether they're used in meaningful selectors\n // Key: variable name (without --uds-font- prefix), Value: { used: boolean, meaningful: boolean }\n const fontVarUsage = new Map<string, { used: boolean; meaningful: boolean }>();\n\n // First pass: collect all font-family references from the CSS (excluding @font-face)\n const usedFontFamilies = new Set<string>();\n\n root.walkDecls('font-family', (decl) => {\n // Skip font-family declarations inside @font-face\n if (decl.parent?.type === 'atrule' && (decl.parent as AtRule).name === 'font-face') {\n return;\n }\n\n // Get the selector for this rule\n const rule = decl.parent as Rule;\n const selector = rule?.selector || '';\n const meaningful = isMeaningfulSelector(selector);\n\n // Parse font-family value to extract font names\n // Handles: \"Font Name\", 'Font Name', Font-Name, var(--uds-font-xxx)\n const value = decl.value;\n\n // Check for CSS variables that reference fonts\n const varMatches = value.matchAll(/var\\(--uds-font-([^),]+)\\)/g);\n for (const match of varMatches) {\n const varName = match[1];\n const existing = fontVarUsage.get(varName) || { used: false, meaningful: false };\n fontVarUsage.set(varName, {\n used: true,\n meaningful: existing.meaningful || meaningful,\n });\n }\n\n // Extract font family names (quoted or unquoted) - only if in meaningful selector\n if (meaningful) {\n const fontNames = value\n .split(',')\n .map((font) => font.trim())\n .map((font) => {\n // Remove quotes\n if (\n (font.startsWith('\"') && font.endsWith('\"')) ||\n (font.startsWith(\"'\") && font.endsWith(\"'\"))\n ) {\n return font.slice(1, -1);\n }\n // Skip var() references and generic families\n if (\n font.startsWith('var(') ||\n [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-monospace',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-rounded',\n ].includes(font.toLowerCase())\n ) {\n return null;\n }\n return font;\n })\n .filter(Boolean) as string[];\n\n fontNames.forEach((name) => usedFontFamilies.add(name));\n }\n });\n\n // Collect all font variable definitions for resolving nested references\n const fontVarDefinitions = new Map<string, string>();\n root.walkDecls((decl) => {\n if (\n decl.prop.startsWith('--uds-font-') &&\n !decl.prop.includes('size') &&\n !decl.prop.includes('weight') &&\n !decl.prop.includes('slant') &&\n !decl.prop.includes('width')\n ) {\n const varName = decl.prop.replace('--uds-font-', '');\n fontVarDefinitions.set(varName, decl.value);\n }\n });\n\n // Helper to resolve a variable value to actual font names (handles nested var() references)\n const resolveToFontNames = (value: string, visited = new Set<string>()): string[] => {\n const fontNames: string[] = [];\n\n // Check for nested var() references\n const varMatch = value.match(/var\\(--uds-font-([^),]+)\\)/);\n if (varMatch) {\n const nestedVarName = varMatch[1];\n // Prevent infinite loops\n if (!visited.has(nestedVarName)) {\n visited.add(nestedVarName);\n const nestedValue = fontVarDefinitions.get(nestedVarName);\n if (nestedValue) {\n // Mark the nested variable as used if parent is used\n const nestedUsage = fontVarUsage.get(nestedVarName);\n if (nestedUsage) {\n // Propagate meaningful status up the chain\n const parentUsage = fontVarUsage.get(\n value.replace(/var\\(--uds-font-([^),]+)\\).*/, '$1'),\n );\n if (parentUsage?.meaningful) {\n nestedUsage.meaningful = true;\n }\n }\n fontNames.push(...resolveToFontNames(nestedValue, visited));\n }\n }\n }\n\n // Extract actual font names from the value\n value\n .split(',')\n .map((font) => font.trim())\n .forEach((font) => {\n // Skip var() references (handled above)\n if (font.startsWith('var(')) {\n return;\n }\n\n // Remove quotes\n if (\n (font.startsWith('\"') && font.endsWith('\"')) ||\n (font.startsWith(\"'\") && font.endsWith(\"'\"))\n ) {\n font = font.slice(1, -1);\n }\n\n // Skip generic families\n if (\n [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-monospace',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-rounded',\n ].includes(font.toLowerCase())\n ) {\n return;\n }\n\n if (font) {\n fontNames.push(font);\n }\n });\n\n return fontNames;\n };\n\n // Process font variable definitions and resolve nested references\n for (const [varName, value] of fontVarDefinitions) {\n const usage = fontVarUsage.get(varName);\n\n // Only include fonts from this variable if it's used in a meaningful selector\n if (usage?.used && usage?.meaningful) {\n const fontNames = resolveToFontNames(value);\n fontNames.forEach((name) => usedFontFamilies.add(name));\n }\n }\n\n // Second pass: remove unused @font-face rules and track which fonts are kept\n const keptFonts = new Set<string>();\n root.walkAtRules('font-face', (atRule) => {\n let fontFamily: string | null = null;\n\n atRule.walkDecls('font-family', (decl) => {\n fontFamily = decl.value.replace(/[\"']/g, '').trim();\n });\n\n if (fontFamily && !usedFontFamilies.has(fontFamily)) {\n atRule.remove();\n } else if (fontFamily) {\n keptFonts.add(fontFamily);\n }\n });\n\n // Third pass: update CSS variable definitions to remove fonts that were not kept\n // This ensures variables like --uds-font-mono don't reference fonts we didn't load\n root.walkDecls((decl) => {\n if (\n decl.prop.startsWith('--uds-font-') &&\n !decl.prop.includes('size') &&\n !decl.prop.includes('weight') &&\n !decl.prop.includes('slant') &&\n !decl.prop.includes('width')\n ) {\n // Parse the font stack and filter out fonts that weren't kept\n const fonts = decl.value.split(',').map((f) => f.trim());\n const filteredFonts = fonts.filter((font) => {\n // Keep var() references\n if (font.startsWith('var(')) {\n return true;\n }\n\n // Extract font name (remove quotes)\n let fontName = font;\n if (\n (font.startsWith('\"') && font.endsWith('\"')) ||\n (font.startsWith(\"'\") && font.endsWith(\"'\"))\n ) {\n fontName = font.slice(1, -1);\n }\n\n // Keep generic font families\n if (\n [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n 'ui-monospace',\n 'ui-serif',\n 'ui-sans-serif',\n 'ui-rounded',\n ].includes(fontName.toLowerCase())\n ) {\n return true;\n }\n\n // Keep fonts that have @font-face declarations\n return keptFonts.has(fontName);\n });\n\n // Update the declaration if fonts were removed\n if (filteredFonts.length < fonts.length && filteredFonts.length > 0) {\n decl.value = filteredFonts.join(', ');\n }\n }\n });\n },\n };\n}\n\nremoveUnusedFontFaces.postcss = true;\n\n/**\n * PostCSS plugin to remove redundant .uds-color-mode-light rules.\n * Light mode is the default (set on :root), so the explicit class is unnecessary.\n */\nfunction removeRedundantLightModePlugin(): Plugin {\n return {\n postcssPlugin: 'remove-redundant-light-mode',\n Once(root: Root) {\n root.walkRules((rule) => {\n // Match .uds-color-mode-light selector (exact match or as part of selector list)\n const selectors = rule.selector.split(',').map((s) => s.trim());\n const filteredSelectors = selectors.filter((s) => {\n // Remove selectors that are exactly .uds-color-mode-light\n // or .uds-color-mode-light with just :root/:where/:is wrappers\n const normalized = s.replace(/\\s+/g, ' ').trim();\n return (\n normalized !== '.uds-color-mode-light' &&\n normalized !== ':root .uds-color-mode-light' &&\n normalized !== ':where(.uds-color-mode-light)' &&\n normalized !== ':is(.uds-color-mode-light)'\n );\n });\n\n if (filteredSelectors.length === 0) {\n // All selectors were light mode - remove the entire rule\n rule.remove();\n } else if (filteredSelectors.length < selectors.length) {\n // Some selectors were light mode - update the selector\n rule.selector = filteredSelectors.join(', ');\n }\n });\n },\n };\n}\n\nremoveRedundantLightModePlugin.postcss = true;\n\n/**\n * PostCSS plugin to remove empty CSS rules (rules with no declarations).\n * Also aggregates duplicate selectors.\n */\nfunction removeEmptyRulesPlugin(): Plugin {\n return {\n postcssPlugin: 'remove-empty-rules',\n Once(root: Root) {\n // Remove empty rules\n root.walkRules((rule) => {\n // Check if rule has any declarations (not just comments or empty)\n const hasDeclarations = rule.nodes?.some(\n (node) => node.type === 'decl' || (node.type === 'rule' && node.nodes?.length > 0),\n );\n\n if (!hasDeclarations) {\n rule.remove();\n }\n });\n\n // Remove empty at-rules (like empty @media blocks)\n root.walkAtRules((atRule) => {\n if (atRule.name !== 'font-face' && atRule.name !== 'keyframes') {\n const hasContent = atRule.nodes?.some((node) => {\n if (node.type === 'rule') {\n return node.nodes?.some((n) => n.type === 'decl');\n }\n if (node.type === 'decl') {\n return true;\n }\n return false;\n });\n\n if (!hasContent && atRule.nodes?.length === 0) {\n atRule.remove();\n }\n }\n });\n },\n };\n}\n\nremoveEmptyRulesPlugin.postcss = true;\n\n/**\n * PostCSS plugin to aggregate rules with identical selectors.\n */\nfunction aggregateDuplicateSelectorsPlugin(): Plugin {\n return {\n postcssPlugin: 'aggregate-duplicate-selectors',\n Once(root: Root) {\n // Map of selector -> first rule with that selector\n const selectorMap = new Map<string, Rule>();\n\n // Collect rules to process (only top-level rules, not nested)\n const rulesToProcess: Rule[] = [];\n root.walkRules((rule) => {\n // Only process top-level rules (direct children of root or at-rules)\n if (rule.parent?.type === 'root' || rule.parent?.type === 'atrule') {\n rulesToProcess.push(rule);\n }\n });\n\n for (const rule of rulesToProcess) {\n const selector = rule.selector;\n const parent = rule.parent;\n\n // Create a unique key including the parent context\n const parentKey =\n parent?.type === 'atrule'\n ? `@${(parent as AtRule).name}:${(parent as AtRule).params}`\n : 'root';\n const key = `${parentKey}|${selector}`;\n\n if (selectorMap.has(key)) {\n const existingRule = selectorMap.get(key)!;\n\n // Move all declarations from current rule to existing rule\n rule.walkDecls((decl) => {\n // Check if the declaration already exists\n const existingDecl = existingRule.nodes?.find(\n (node): node is Declaration => node.type === 'decl' && node.prop === decl.prop,\n );\n\n if (existingDecl) {\n // Replace with new value\n existingDecl.value = decl.value;\n } else {\n // Append the declaration\n existingRule.append(decl.clone());\n }\n });\n\n // Remove the duplicate rule\n rule.remove();\n } else {\n selectorMap.set(key, rule);\n }\n }\n },\n };\n}\n\naggregateDuplicateSelectorsPlugin.postcss = true;\n\n/**\n * Validates CSS syntax and returns any errors found.\n */\nfunction validateCSS(css: string): { valid: boolean; errors: string[] } {\n const errors: string[] = [];\n\n try {\n // Parse the CSS to check for syntax errors\n const result = postcss.parse(css);\n\n // Check for common issues\n result.walkRules((rule) => {\n // Check for empty selectors\n if (!rule.selector.trim()) {\n errors.push(`Empty selector found at line ${rule.source?.start?.line}`);\n }\n\n // Check for malformed selectors\n try {\n // Basic selector validation - this catches obvious syntax errors\n if (rule.selector.includes('{{') || rule.selector.includes('}}')) {\n errors.push(`Malformed selector \"${rule.selector}\" at line ${rule.source?.start?.line}`);\n }\n } catch {\n errors.push(`Invalid selector \"${rule.selector}\" at line ${rule.source?.start?.line}`);\n }\n });\n\n // Check for unclosed blocks (postcss.parse will throw for these)\n result.walkDecls((decl) => {\n // Check for missing values\n if (!decl.value.trim()) {\n errors.push(`Empty value for property \"${decl.prop}\" at line ${decl.source?.start?.line}`);\n }\n });\n\n return { valid: errors.length === 0, errors };\n } catch (error) {\n if (error instanceof Error) {\n errors.push(`CSS Parse Error: ${error.message}`);\n } else {\n errors.push('Unknown CSS parse error');\n }\n return { valid: false, errors };\n }\n}\n\n/**\n * Reference data extracted from CSS for deduplication\n */\ninterface CSSReferenceData {\n /** Font-face fingerprints (font-family + src + weight + style) */\n fontFaces: Set<string>;\n /** Keyframes fingerprints (name + content) */\n keyframes: Set<string>;\n /** Regular rule fingerprints (selector + declarations) */\n rules: Set<string>;\n}\n\n/**\n * Create a fingerprint for a @font-face rule\n */\nfunction getFontFaceFingerprint(atRule: AtRule): string {\n let fontFamily = '';\n let src = '';\n let fontWeight = 'normal';\n let fontStyle = 'normal';\n\n atRule.walkDecls((decl) => {\n if (decl.prop === 'font-family') {\n fontFamily = decl.value.replace(/[\"']/g, '').trim();\n } else if (decl.prop === 'src') {\n src = decl.value;\n } else if (decl.prop === 'font-weight') {\n fontWeight = decl.value;\n } else if (decl.prop === 'font-style') {\n fontStyle = decl.value;\n }\n });\n\n return JSON.stringify({ fontFamily, src, fontWeight, fontStyle });\n}\n\n/**\n * Create a fingerprint for a @keyframes rule\n */\nfunction getKeyframesFingerprint(atRule: AtRule): string {\n // Use name + normalized content as fingerprint\n const name = atRule.params;\n const content = atRule.toString().replace(/\\s+/g, ' ').trim();\n return JSON.stringify({ name, content });\n}\n\n/**\n * Normalize a selector by removing scope prefix and whitespace\n */\nfunction normalizeSelector(selector: string, scopeClass?: string): string {\n let normalized = selector.trim();\n if (scopeClass) {\n // Remove scope prefix patterns like \".scope \" or \".scope.\"\n const escapedScope = scopeClass.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n normalized = normalized\n .replace(new RegExp(`${escapedScope}\\\\s+`, 'g'), '')\n .replace(new RegExp(`${escapedScope}\\\\.`, 'g'), '.')\n .replace(new RegExp(`${escapedScope}`, 'g'), '');\n }\n return normalized.replace(/\\s+/g, ' ').trim();\n}\n\n/**\n * Create a fingerprint for a CSS rule (selector + declarations)\n */\nfunction getRuleFingerprint(rule: Rule, scopeClass?: string): string {\n const selector = normalizeSelector(rule.selector, scopeClass);\n const declarations: string[] = [];\n\n rule.walkDecls((decl) => {\n declarations.push(`${decl.prop}:${decl.value}`);\n });\n\n // Sort declarations for consistent comparison\n declarations.sort();\n return JSON.stringify({ selector, declarations });\n}\n\n/**\n * Extract reference data from CSS for deduplication\n */\nfunction extractCSSReferenceData(css: string, scopeClass?: string): CSSReferenceData {\n const data: CSSReferenceData = {\n fontFaces: new Set(),\n keyframes: new Set(),\n rules: new Set(),\n };\n\n try {\n const root = postcss.parse(css);\n\n root.walkAtRules((atRule) => {\n if (atRule.name === 'font-face') {\n data.fontFaces.add(getFontFaceFingerprint(atRule));\n } else if (atRule.name === 'keyframes' || atRule.name === '-webkit-keyframes') {\n data.keyframes.add(getKeyframesFingerprint(atRule));\n }\n });\n\n root.walkRules((rule) => {\n // Skip rules inside @font-face or @keyframes\n if (rule.parent?.type === 'atrule') {\n const parentName = (rule.parent as AtRule).name;\n if (\n parentName === 'font-face' ||\n parentName === 'keyframes' ||\n parentName === '-webkit-keyframes'\n ) {\n return;\n }\n }\n data.rules.add(getRuleFingerprint(rule, scopeClass));\n });\n } catch {\n // If parsing fails, return empty data\n }\n\n return data;\n}\n\n/**\n * PostCSS plugin to remove CSS that exists in reference CSS\n * Handles @font-face, @keyframes, and regular rule deduplication\n */\nfunction removeDuplicateCss(referenceData: CSSReferenceData, scopeClass?: string): Plugin {\n return {\n postcssPlugin: 'remove-duplicate-css',\n Once(root: Root) {\n const toRemove: (AtRule | Rule)[] = [];\n\n root.walkAtRules((atRule) => {\n if (atRule.name === 'font-face') {\n const fingerprint = getFontFaceFingerprint(atRule);\n if (referenceData.fontFaces.has(fingerprint)) {\n toRemove.push(atRule);\n }\n } else if (atRule.name === 'keyframes' || atRule.name === '-webkit-keyframes') {\n const fingerprint = getKeyframesFingerprint(atRule);\n if (referenceData.keyframes.has(fingerprint)) {\n toRemove.push(atRule);\n }\n }\n });\n\n root.walkRules((rule) => {\n // Skip rules inside @font-face or @keyframes\n if (rule.parent?.type === 'atrule') {\n const parentName = (rule.parent as AtRule).name;\n if (\n parentName === 'font-face' ||\n parentName === 'keyframes' ||\n parentName === '-webkit-keyframes'\n ) {\n return;\n }\n }\n\n const fingerprint = getRuleFingerprint(rule, scopeClass);\n if (referenceData.rules.has(fingerprint)) {\n toRemove.push(rule);\n }\n });\n\n // Remove duplicates\n for (const node of toRemove) {\n node.remove();\n }\n },\n };\n}\n\n/**\n * Options for CSS optimization\n */\ninterface OptimizeCSSOptions {\n /** Remove unused @font-face declarations (default: true) */\n removeUnusedFonts?: boolean;\n /** Remove empty CSS rules (default: true) */\n removeEmptyRules?: boolean;\n /** Aggregate duplicate selectors (default: true) */\n aggregateDuplicateSelectors?: boolean;\n /** Reference CSS to deduplicate against (for scoped CSS) */\n referenceCss?: string;\n /** Scope class used in this CSS (for normalizing selectors during deduplication) */\n scopeClass?: string;\n}\n\n/**\n * Optimizes CSS by:\n * 1. Removing unused @font-face declarations\n * 2. Removing empty rules\n * 3. Aggregating duplicate selectors\n *\n * Returns the optimized CSS and validation results.\n */\nasync function optimizeCSS(\n css: string,\n options?: OptimizeCSSOptions,\n): Promise<{\n css: string;\n validation: { valid: boolean; errors: string[] };\n stats: {\n originalSize: number;\n originalSizeGzip: number;\n optimizedSize: number;\n fontFacesRemoved: number;\n emptyRulesRemoved: number;\n };\n}> {\n const originalSize = Buffer.byteLength(css, 'utf8');\n const originalSizeGzip = gzipSync(css).length;\n\n // Count font-faces before\n const fontFacesBefore = (css.match(/@font-face/g) || []).length;\n\n // Count rules before (rough estimate)\n const rulesBefore = (css.match(/\\{[^}]*\\}/g) || []).length;\n\n // Build list of plugins based on options (all enabled by default)\n const plugins: postcss.AcceptedPlugin[] = [];\n\n if (options?.removeUnusedFonts !== false) {\n plugins.push(removeUnusedFontFaces());\n }\n\n // Remove redundant .uds-color-mode-light rules (light is default on :root)\n plugins.push(removeRedundantLightModePlugin());\n\n // If reference CSS is provided, deduplicate all matching CSS (font-faces, keyframes, rules)\n if (options?.referenceCss) {\n const referenceData = extractCSSReferenceData(options.referenceCss);\n if (\n referenceData.fontFaces.size > 0 ||\n referenceData.keyframes.size > 0 ||\n referenceData.rules.size > 0\n ) {\n plugins.push(removeDuplicateCss(referenceData, options.scopeClass));\n }\n }\n\n if (options?.removeEmptyRules !== false) {\n plugins.push(removeEmptyRulesPlugin());\n }\n\n if (options?.aggregateDuplicateSelectors !== false) {\n plugins.push(aggregateDuplicateSelectorsPlugin());\n }\n\n // Apply optimizations\n const result =\n plugins.length > 0 ? await postcss(plugins).process(css, { from: undefined }) : { css };\n\n const optimizedCSS = result.css;\n const optimizedSize = Buffer.byteLength(optimizedCSS, 'utf8');\n\n // Count font-faces after\n const fontFacesAfter = (optimizedCSS.match(/@font-face/g) || []).length;\n\n // Count rules after\n const rulesAfter = (optimizedCSS.match(/\\{[^}]*\\}/g) || []).length;\n\n // Validate the result\n const validation = validateCSS(optimizedCSS);\n\n return {\n css: optimizedCSS,\n validation,\n stats: {\n originalSize,\n originalSizeGzip,\n optimizedSize,\n fontFacesRemoved: fontFacesBefore - fontFacesAfter,\n emptyRulesRemoved: Math.max(0, rulesBefore - rulesAfter),\n },\n };\n}\n\nexport {\n aggregateDuplicateSelectorsPlugin as aggregateDuplicateSelectors,\n optimizeCSS,\n type OptimizeCSSOptions,\n removeEmptyRulesPlugin as removeEmptyRules,\n removeUnusedFontFaces,\n validateCSS,\n};\n"],"mappings":";;;;;;;;;AAUA,SAAS,qBAAqB,UAA2B;CAEvD,MAAM,QAAQ,SAAS,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC;AAEtD,MAAK,MAAM,QAAQ,MAGjB,KACE,KAAK,SAAS,IAAI,IAClB,KAAK,SAAS,IAAI,IAClB,KAAK,SAAS,IAAI,IAClB,KAAK,SAAS,QAAQ,IACtB,KAAK,SAAS,UAAU,IACxB,KAAK,SAAS,OAAO,IACrB,KAAK,SAAS,QAAQ,CAEtB,QAAO;AAIX,QAAO;;;;;;AAOT,SAAS,wBAAgC;AACvC,QAAO;EACL,eAAe;EACf,KAAK,MAAY;GAGf,MAAM,+BAAe,IAAI,KAAqD;GAG9E,MAAM,mCAAmB,IAAI,KAAa;AAE1C,QAAK,UAAU,gBAAgB,SAAS;AAEtC,QAAI,KAAK,QAAQ,SAAS,YAAa,KAAK,OAAkB,SAAS,YACr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AuB,CAAC;AAIvC,SAAQ,KAAK,gCAAgC,CAAC;AAG9C,KAAI,SAAS,cAAc;EACzB,MAAM,gBAAgB,wBAAwB,QAAQ,aAAa;AACnE,MACE,cAAc,UAAU,OAAO,KAC/B,cAAc,UAAU,OAAO,KAC/B,cAAc,MAAM,OAAO,EAE3B,SAAQ,KAAK,mBAAmB,eAAe,QAAQ,WAAW,CAAC;;AAIvE,KAAI,SAAS,qBAAqB,MAChC,SAAQ,KAAK,wBAAwB,CAAC;AAGxC,KAAI,SAAS,gCAAgC,MAC3C,SAAQ,KAAK,mCAAmC,CAAC;CAOnD,MAAM,gBAFJ,QAAQ,SAAS,IAAI,MAAM,QAAQ,QAAQ,CAAC,QAAQ,KAAK,EAAE,MAAM,KAAA,GAAW,CAAC,GAAG,EAAE,KAAK,EAE7D;CAC5B,MAAM,gBAAgB,OAAO,WAAW,cAAc,OAAO;CAG7D,MAAM,kBAAkB,aAAa,MAAM,cAAc,IAAI,EAAE,EAAE;CAGjE,MAAM,cAAc,aAAa,MAAM,aAAa,IAAI,EAAE,EAAE;AAK5D,QAAO;EACL,KAAK;EACL,YAJiB,YAAY,aAInB;EACV,OAAO;GACL;GACA;GACA;GACA,kBAAkB,kBAAkB;GACpC,mBAAmB,KAAK,IAAI,GAAG,cAAc,WAAW;GACzD;EACF"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
|
-
const require_index = require(
|
|
3
|
-
const require_index$1 = require(
|
|
4
|
-
const require_entries = require(
|
|
5
|
-
const require_mapValues = require(
|
|
6
|
-
const require_opacity = require(
|
|
7
|
-
|
|
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");
|
|
8
7
|
//#region src/utils/parseTokens.ts
|
|
9
8
|
/** Converts a SpectrumValueEntry to a space-separated RGB string for CSS variables. */
|
|
10
9
|
function spectrumValueToRgbString(value) {
|
|
@@ -40,7 +39,7 @@ function transformColors(colors, elevationPresets, focusRingConfig) {
|
|
|
40
39
|
require_entries.entries(palette).forEach(([paletteType, paletteConfig]) => {
|
|
41
40
|
for (const [paletteKey, { hue, step, opacity }] of Object.entries(paletteConfig)) {
|
|
42
41
|
if (!(paletteType in tailwindConfig.palette)) tailwindConfig.palette[paletteType] = {};
|
|
43
|
-
const name =
|
|
42
|
+
const name = `--uds-${paletteType}-color-${paletteKey}`;
|
|
44
43
|
rootVars[name] = `var(--${require_index$1.SPECTRUM_COLOR_PREFIX}-${hue}-${step})`;
|
|
45
44
|
const opacityValue = opacity !== void 0 ? require_opacity.parseOpacityStep(opacity) : void 0;
|
|
46
45
|
tailwindConfig.palette[paletteType][paletteKey] = shouldIncludeOpacity(opacityValue) ? `rgb(var(${name}) / ${opacityValue}%)` : `rgb(var(${name}))`;
|
|
@@ -147,6 +146,5 @@ function parseTokens(config) {
|
|
|
147
146
|
})
|
|
148
147
|
};
|
|
149
148
|
}
|
|
150
|
-
|
|
151
149
|
//#endregion
|
|
152
|
-
exports.parseTokens = parseTokens;
|
|
150
|
+
exports.parseTokens = parseTokens;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
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, OUTLINE_PREFIX, SPECTRUM_COLOR_PREFIX,
|
|
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, OUTLINE_PREFIX, SPECTRUM_COLOR_PREFIX, getShadowLayerValue } from "../css-tokens/dist/index.js";
|
|
4
4
|
import { entries } from "./entries.js";
|
|
5
5
|
import { mapValues } from "./mapValues.js";
|
|
6
6
|
import { parseOpacityStep } from "./opacity.js";
|
|
7
|
-
|
|
8
7
|
//#region src/utils/parseTokens.ts
|
|
9
8
|
/** Converts a SpectrumValueEntry to a space-separated RGB string for CSS variables. */
|
|
10
9
|
function spectrumValueToRgbString(value) {
|
|
@@ -40,7 +39,7 @@ function transformColors(colors, elevationPresets, focusRingConfig) {
|
|
|
40
39
|
entries(palette).forEach(([paletteType, paletteConfig]) => {
|
|
41
40
|
for (const [paletteKey, { hue, step, opacity }] of Object.entries(paletteConfig)) {
|
|
42
41
|
if (!(paletteType in tailwindConfig.palette)) tailwindConfig.palette[paletteType] = {};
|
|
43
|
-
const name =
|
|
42
|
+
const name = `--uds-${paletteType}-color-${paletteKey}`;
|
|
44
43
|
rootVars[name] = `var(--${SPECTRUM_COLOR_PREFIX}-${hue}-${step})`;
|
|
45
44
|
const opacityValue = opacity !== void 0 ? parseOpacityStep(opacity) : void 0;
|
|
46
45
|
tailwindConfig.palette[paletteType][paletteKey] = shouldIncludeOpacity(opacityValue) ? `rgb(var(${name}) / ${opacityValue}%)` : `rgb(var(${name}))`;
|
|
@@ -147,7 +146,7 @@ function parseTokens(config) {
|
|
|
147
146
|
})
|
|
148
147
|
};
|
|
149
148
|
}
|
|
150
|
-
|
|
151
149
|
//#endregion
|
|
152
150
|
export { parseTokens };
|
|
151
|
+
|
|
153
152
|
//# sourceMappingURL=parseTokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseTokens.js","names":[],"sources":["../../src/utils/parseTokens.ts"],"sourcesContent":["import type { UniversalTokensConfig } from '@yahoo/uds-config';\nimport {\n AVATAR_SIZE_PREFIX,\n BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX,\n BACKGROUND_BLUR_RADIUS_PREFIX,\n BACKGROUND_COLOR_PREFIX,\n BORDER_RADIUS_PREFIX,\n BORDER_WIDTH_PREFIX,\n DROP_SHADOW_PREFIX,\n getShadowLayerValue,\n ICON_SIZE_PREFIX,\n LINE_COLOR_PREFIX,\n OUTLINE_PREFIX,\n SPECTRUM_COLOR_PREFIX,\n UDS_PREFIX,\n} from '@yahoo/uds-css-tokens';\nimport { alwaysPalette } from '@yahoo/uds-palette';\nimport type {\n ColorMode,\n ColorsConfig,\n ElevationLevel,\n ElevationPreset,\n FocusRingColor,\n FocusRingConfig,\n Hue,\n HueStep,\n OpacityStep,\n PaletteConfig,\n PaletteType,\n ScaleMode,\n} from '@yahoo/uds-types';\n\nimport { entries } from './entries';\nimport { mapValues } from './mapValues';\nimport { parseOpacityStep } from './opacity';\n\n/** Converts a SpectrumValueEntry to a space-separated RGB string for CSS variables. */\nfunction spectrumValueToRgbString(value: { rgb: { r: number; g: number; b: number } }): string {\n const { r, g, b } = value.rgb;\n return `${r} ${g} ${b}`;\n}\n\nfunction shouldIncludeOpacity(opacity: OpacityStep | undefined): boolean {\n if (!opacity) {\n return false;\n }\n\n const parsedOpacity = parseInt(opacity, 10);\n return !isNaN(parsedOpacity) && parsedOpacity !== 100;\n}\n\ntype ColorModeElevationPresets = Partial<Record<ElevationLevel, ElevationPreset>>;\n\nfunction resolveFocusRingColor(color: FocusRingColor): string {\n switch (color.type) {\n case 'spectrum':\n return `rgb(var(--${SPECTRUM_COLOR_PREFIX}-${color.value.hue}-${color.value.step}))`;\n case 'line':\n return `rgb(var(--${LINE_COLOR_PREFIX}-${color.value}))`;\n case 'always':\n return alwaysPalette[color.value as keyof typeof alwaysPalette];\n default:\n return `rgb(var(--${SPECTRUM_COLOR_PREFIX}-gray-15))`;\n }\n}\n\nfunction transformColors(\n colors: ColorsConfig,\n elevationPresets: ColorModeElevationPresets,\n focusRingConfig?: FocusRingConfig,\n) {\n const { palette, spectrum } = colors;\n const rootVars: Record<string, string> = {};\n const tailwindConfig = {\n spectrum: {} as Record<Hue, Record<HueStep, string>>,\n palette: {} as {\n [key in PaletteType]: Record<keyof PaletteConfig[key], string>;\n },\n };\n\n for (const [hue, hueSteps] of entries(spectrum)) {\n for (const [hueStep, value] of entries(hueSteps)) {\n const name = `${hue}-${hueStep}`;\n const varKey = `--${SPECTRUM_COLOR_PREFIX}-${name}`;\n if (!tailwindConfig.spectrum[hue]) {\n tailwindConfig.spectrum[hue] = {} as Record<HueStep, string>;\n }\n tailwindConfig.spectrum[hue][hueStep] = `rgb(var(${varKey}))`;\n rootVars[varKey] = spectrumValueToRgbString(value);\n }\n }\n\n entries(palette).forEach(([paletteType, paletteConfig]) => {\n for (const [paletteKey, { hue, step, opacity }] of Object.entries(paletteConfig)) {\n if (!(paletteType in tailwindConfig.palette)) {\n // @ts-expect-error we fill this object later\n tailwindConfig.palette[paletteType] = {};\n }\n const name = `--${UDS_PREFIX}-${paletteType}-color-${paletteKey}`;\n rootVars[name] = `var(--${SPECTRUM_COLOR_PREFIX}-${hue}-${step})`;\n const opacityValue = opacity !== undefined ? parseOpacityStep(opacity) : undefined;\n // @ts-expect-error this is fine\n tailwindConfig.palette[paletteType][paletteKey] = shouldIncludeOpacity(opacityValue)\n ? `rgb(var(${name}) / ${opacityValue}%)`\n : `rgb(var(${name}))`;\n }\n });\n\n // Elevation levels\n entries(elevationPresets).forEach(([level, elevationPreset]) => {\n if (elevationPreset) {\n entries(elevationPreset).forEach(([key]) => {\n // background color\n if (key === 'finalBackgroundValue') {\n const { r, g, b, a } = elevationPreset[key];\n const alpha = parseInt(a) / 100;\n const name = `--${BACKGROUND_COLOR_PREFIX}-elevation-${level}`;\n rootVars[name] = `rgba(${r}, ${g}, ${b}, ${alpha})`;\n }\n\n // border color\n if (key === 'borderColor') {\n const name = `--${LINE_COLOR_PREFIX}-elevation-${level}`;\n\n switch (elevationPreset[key].type) {\n case 'always':\n rootVars[name] = alwaysPalette[elevationPreset[key].value];\n break;\n case 'spectrum':\n rootVars[name] =\n `rgb(var(--${SPECTRUM_COLOR_PREFIX}-${elevationPreset[key].value.hue}-${elevationPreset[key].value.step}))`;\n break;\n case 'line':\n rootVars[name] = `rgb(var(--${LINE_COLOR_PREFIX}-${elevationPreset[key].value}))`;\n break;\n }\n }\n\n // border width\n if (key === 'borderWidth') {\n const name = `--${BORDER_WIDTH_PREFIX}-elevation-${level}`;\n rootVars[name] = `var(--${BORDER_WIDTH_PREFIX}-${elevationPreset[key]})`;\n }\n\n // drop shadow\n if (key === 'dropShadow') {\n const name = `--${DROP_SHADOW_PREFIX}-elevation-${level}`;\n const configValue = elevationPreset[key];\n\n rootVars[name] = Array.isArray(configValue)\n ? configValue\n .map((preset, index) =>\n getShadowLayerValue({\n preset,\n prefix: index > 0 ? `${index + 1}` : undefined,\n shadowType: 'drop',\n }),\n )\n .join(', ')\n : `var(--${DROP_SHADOW_PREFIX}-${elevationPreset[key]})`;\n }\n\n // background blur radius\n if (key === 'backgroundBlurRadius') {\n const name = `--${BACKGROUND_BLUR_RADIUS_PREFIX}-elevation-${level}`;\n rootVars[name] = `blur(${elevationPreset[key]}px)`;\n }\n\n // background blur fallback value\n if (key === 'fallbackBlurredBackgroundValue') {\n const { r, g, b } = elevationPreset[key];\n const name = `--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX}-elevation-${level}`;\n rootVars[name] = `rgb(${r}, ${g}, ${b})`;\n }\n });\n }\n });\n\n rootVars[`--${OUTLINE_PREFIX}-offset`] = focusRingConfig ? `${focusRingConfig.offset}px` : '2px';\n rootVars[`--${OUTLINE_PREFIX}-width`] = focusRingConfig ? `${focusRingConfig.width}px` : '2px';\n rootVars[`--${OUTLINE_PREFIX}-style`] = 'solid';\n rootVars[`--${OUTLINE_PREFIX}-color`] = focusRingConfig\n ? resolveFocusRingColor(focusRingConfig.color)\n : `rgb(var(--${SPECTRUM_COLOR_PREFIX}-gray-15))`;\n\n return {\n _vars: rootVars,\n _raw: colors,\n tailwindConfig,\n };\n}\n\nfunction transformNumericToPx<T extends Record<string, number>>(prefix: string, config: T) {\n if (!config) {\n return {\n _vars: {} as Record<string, string>,\n _raw: {} as Record<string, number>,\n tailwindConfig: {} as Record<string, string>,\n };\n }\n const rootVars: Record<string, string> = {};\n const tailwindConfig = {} as Record<string, string>;\n for (const [variant, value] of entries(config)) {\n const rootVarKey = `--${prefix}-${variant}`;\n const rootVarValue = `${value}px`;\n rootVars[rootVarKey] = rootVarValue;\n tailwindConfig[variant] = `var(${rootVarKey})`;\n }\n return {\n _vars: rootVars,\n _raw: config,\n tailwindConfig,\n };\n}\n\ntype WebTokens = Omit<UniversalTokensConfig, 'colorMode' | 'scaleMode' | 'fontFamily'> & {\n colorMode: Record<ColorMode, ReturnType<typeof transformColors>>;\n scaleMode: Record<\n ScaleMode,\n {\n borderRadius: ReturnType<typeof transformNumericToPx>;\n borderWidth: ReturnType<typeof transformNumericToPx>;\n avatarSizes: ReturnType<typeof transformNumericToPx>;\n iconSizes: ReturnType<typeof transformNumericToPx>;\n }\n >;\n};\n\nfunction getElevationPresetsForColorMode(\n colorMode: ColorMode,\n config: UniversalTokensConfig,\n): ColorModeElevationPresets {\n if (!config.elevation) {\n return {};\n }\n\n const result: ColorModeElevationPresets = {};\n\n entries(config.elevation).forEach(([level, levelPreset]) => {\n result[level] = levelPreset[colorMode];\n });\n\n return result;\n}\n\nexport function parseTokens(config: UniversalTokensConfig): WebTokens {\n const { colorMode, scaleMode } = config;\n\n return {\n ...config,\n colorMode: {\n light: transformColors(\n colorMode.light,\n getElevationPresetsForColorMode('light', config),\n config.focusRing?.light,\n ),\n dark: transformColors(\n colorMode.dark,\n getElevationPresetsForColorMode('dark', config),\n config.focusRing?.dark,\n ),\n },\n scaleMode: mapValues(scaleMode, ({ borderRadius, borderWidth, avatarSizes, iconSizes }) => {\n return {\n borderRadius: transformNumericToPx(BORDER_RADIUS_PREFIX, borderRadius),\n borderWidth: transformNumericToPx(BORDER_WIDTH_PREFIX, borderWidth),\n avatarSizes: transformNumericToPx(AVATAR_SIZE_PREFIX, avatarSizes),\n iconSizes: transformNumericToPx(ICON_SIZE_PREFIX, iconSizes),\n };\n }),\n };\n}\n\nexport { type WebTokens };\n"],"mappings":";;;;;;;;;AAqCA,SAAS,yBAAyB,OAA6D;CAC7F,MAAM,EAAE,GAAG,GAAG,MAAM,MAAM;AAC1B,QAAO,GAAG,EAAE,GAAG,EAAE,GAAG;;AAGtB,SAAS,qBAAqB,SAA2C;AACvE,KAAI,CAAC,QACH,QAAO;CAGT,MAAM,gBAAgB,SAAS,SAAS,GAAG;AAC3C,QAAO,CAAC,MAAM,cAAc,IAAI,kBAAkB;;AAKpD,SAAS,sBAAsB,OAA+B;AAC5D,SAAQ,MAAM,MAAd;EACE,KAAK,WACH,QAAO,aAAa,sBAAsB,GAAG,MAAM,MAAM,IAAI,GAAG,MAAM,MAAM,KAAK;EACnF,KAAK,OACH,QAAO,aAAa,kBAAkB,GAAG,MAAM,MAAM;EACvD,KAAK,SACH,QAAO,cAAc,MAAM;EAC7B,QACE,QAAO,aAAa,sBAAsB;;;AAIhD,SAAS,gBACP,QACA,kBACA,iBACA;CACA,MAAM,EAAE,SAAS,aAAa;CAC9B,MAAM,WAAmC,EAAE;CAC3C,MAAM,iBAAiB;EACrB,UAAU,EAAE;EACZ,SAAS,EAAE;EAGZ;AAED,MAAK,MAAM,CAAC,KAAK,aAAa,QAAQ,SAAS,CAC7C,MAAK,MAAM,CAAC,SAAS,UAAU,QAAQ,SAAS,EAAE;EAEhD,MAAM,SAAS,KAAK,sBAAsB,GAD7B,GAAG,IAAI,GAAG;AAEvB,MAAI,CAAC,eAAe,SAAS,KAC3B,gBAAe,SAAS,OAAO,EAAE;AAEnC,i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AM,aAAa,KAAK,OAAO,GAAG;AAElC,WAAS,cADY,GAAG,MAAM;AAE9B,iBAAe,WAAW,OAAO,WAAW;;AAE9C,QAAO;EACL,OAAO;EACP,MAAM;EACN;EACD;;AAgBH,SAAS,gCACP,WACA,QAC2B;AAC3B,KAAI,CAAC,OAAO,UACV,QAAO,EAAE;CAGX,MAAM,SAAoC,EAAE;AAE5C,SAAQ,OAAO,UAAU,CAAC,SAAS,CAAC,OAAO,iBAAiB;AAC1D,SAAO,SAAS,YAAY;GAC5B;AAEF,QAAO;;AAGT,SAAgB,YAAY,QAA0C;CACpE,MAAM,EAAE,WAAW,cAAc;AAEjC,QAAO;EACL,GAAG;EACH,WAAW;GACT,OAAO,gBACL,UAAU,OACV,gCAAgC,SAAS,OAAO,EAChD,OAAO,WAAW,MACnB;GACD,MAAM,gBACJ,UAAU,MACV,gCAAgC,QAAQ,OAAO,EAC/C,OAAO,WAAW,KACnB;GACF;EACD,WAAW,UAAU,YAAY,EAAE,cAAc,aAAa,aAAa,gBAAgB;AACzF,UAAO;IACL,cAAc,qBAAqB,sBAAsB,aAAa;IACtE,aAAa,qBAAqB,qBAAqB,YAAY;IACnE,aAAa,qBAAqB,oBAAoB,YAAY;IAClE,WAAW,qBAAqB,kBAAkB,UAAU;IAC7D;IACD;EACH"}
|
|
1
|
+
{"version":3,"file":"parseTokens.js","names":[],"sources":["../../src/utils/parseTokens.ts"],"sourcesContent":["import type { UniversalTokensConfig } from '@yahoo/uds-config';\nimport {\n AVATAR_SIZE_PREFIX,\n BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX,\n BACKGROUND_BLUR_RADIUS_PREFIX,\n BACKGROUND_COLOR_PREFIX,\n BORDER_RADIUS_PREFIX,\n BORDER_WIDTH_PREFIX,\n DROP_SHADOW_PREFIX,\n getShadowLayerValue,\n ICON_SIZE_PREFIX,\n LINE_COLOR_PREFIX,\n OUTLINE_PREFIX,\n SPECTRUM_COLOR_PREFIX,\n UDS_PREFIX,\n} from '@yahoo/uds-css-tokens';\nimport { alwaysPalette } from '@yahoo/uds-palette';\nimport type {\n ColorMode,\n ColorsConfig,\n ElevationLevel,\n ElevationPreset,\n FocusRingColor,\n FocusRingConfig,\n Hue,\n HueStep,\n OpacityStep,\n PaletteConfig,\n PaletteType,\n ScaleMode,\n} from '@yahoo/uds-types';\n\nimport { entries } from './entries';\nimport { mapValues } from './mapValues';\nimport { parseOpacityStep } from './opacity';\n\n/** Converts a SpectrumValueEntry to a space-separated RGB string for CSS variables. */\nfunction spectrumValueToRgbString(value: { rgb: { r: number; g: number; b: number } }): string {\n const { r, g, b } = value.rgb;\n return `${r} ${g} ${b}`;\n}\n\nfunction shouldIncludeOpacity(opacity: OpacityStep | undefined): boolean {\n if (!opacity) {\n return false;\n }\n\n const parsedOpacity = parseInt(opacity, 10);\n return !isNaN(parsedOpacity) && parsedOpacity !== 100;\n}\n\ntype ColorModeElevationPresets = Partial<Record<ElevationLevel, ElevationPreset>>;\n\nfunction resolveFocusRingColor(color: FocusRingColor): string {\n switch (color.type) {\n case 'spectrum':\n return `rgb(var(--${SPECTRUM_COLOR_PREFIX}-${color.value.hue}-${color.value.step}))`;\n case 'line':\n return `rgb(var(--${LINE_COLOR_PREFIX}-${color.value}))`;\n case 'always':\n return alwaysPalette[color.value as keyof typeof alwaysPalette];\n default:\n return `rgb(var(--${SPECTRUM_COLOR_PREFIX}-gray-15))`;\n }\n}\n\nfunction transformColors(\n colors: ColorsConfig,\n elevationPresets: ColorModeElevationPresets,\n focusRingConfig?: FocusRingConfig,\n) {\n const { palette, spectrum } = colors;\n const rootVars: Record<string, string> = {};\n const tailwindConfig = {\n spectrum: {} as Record<Hue, Record<HueStep, string>>,\n palette: {} as {\n [key in PaletteType]: Record<keyof PaletteConfig[key], string>;\n },\n };\n\n for (const [hue, hueSteps] of entries(spectrum)) {\n for (const [hueStep, value] of entries(hueSteps)) {\n const name = `${hue}-${hueStep}`;\n const varKey = `--${SPECTRUM_COLOR_PREFIX}-${name}`;\n if (!tailwindConfig.spectrum[hue]) {\n tailwindConfig.spectrum[hue] = {} as Record<HueStep, string>;\n }\n tailwindConfig.spectrum[hue][hueStep] = `rgb(var(${varKey}))`;\n rootVars[varKey] = spectrumValueToRgbString(value);\n }\n }\n\n entries(palette).forEach(([paletteType, paletteConfig]) => {\n for (const [paletteKey, { hue, step, opacity }] of Object.entries(paletteConfig)) {\n if (!(paletteType in tailwindConfig.palette)) {\n // @ts-expect-error we fill this object later\n tailwindConfig.palette[paletteType] = {};\n }\n const name = `--${UDS_PREFIX}-${paletteType}-color-${paletteKey}`;\n rootVars[name] = `var(--${SPECTRUM_COLOR_PREFIX}-${hue}-${step})`;\n const opacityValue = opacity !== undefined ? parseOpacityStep(opacity) : undefined;\n // @ts-expect-error this is fine\n tailwindConfig.palette[paletteType][paletteKey] = shouldIncludeOpacity(opacityValue)\n ? `rgb(var(${name}) / ${opacityValue}%)`\n : `rgb(var(${name}))`;\n }\n });\n\n // Elevation levels\n entries(elevationPresets).forEach(([level, elevationPreset]) => {\n if (elevationPreset) {\n entries(elevationPreset).forEach(([key]) => {\n // background color\n if (key === 'finalBackgroundValue') {\n const { r, g, b, a } = elevationPreset[key];\n const alpha = parseInt(a) / 100;\n const name = `--${BACKGROUND_COLOR_PREFIX}-elevation-${level}`;\n rootVars[name] = `rgba(${r}, ${g}, ${b}, ${alpha})`;\n }\n\n // border color\n if (key === 'borderColor') {\n const name = `--${LINE_COLOR_PREFIX}-elevation-${level}`;\n\n switch (elevationPreset[key].type) {\n case 'always':\n rootVars[name] = alwaysPalette[elevationPreset[key].value];\n break;\n case 'spectrum':\n rootVars[name] =\n `rgb(var(--${SPECTRUM_COLOR_PREFIX}-${elevationPreset[key].value.hue}-${elevationPreset[key].value.step}))`;\n break;\n case 'line':\n rootVars[name] = `rgb(var(--${LINE_COLOR_PREFIX}-${elevationPreset[key].value}))`;\n break;\n }\n }\n\n // border width\n if (key === 'borderWidth') {\n const name = `--${BORDER_WIDTH_PREFIX}-elevation-${level}`;\n rootVars[name] = `var(--${BORDER_WIDTH_PREFIX}-${elevationPreset[key]})`;\n }\n\n // drop shadow\n if (key === 'dropShadow') {\n const name = `--${DROP_SHADOW_PREFIX}-elevation-${level}`;\n const configValue = elevationPreset[key];\n\n rootVars[name] = Array.isArray(configValue)\n ? configValue\n .map((preset, index) =>\n getShadowLayerValue({\n preset,\n prefix: index > 0 ? `${index + 1}` : undefined,\n shadowType: 'drop',\n }),\n )\n .join(', ')\n : `var(--${DROP_SHADOW_PREFIX}-${elevationPreset[key]})`;\n }\n\n // background blur radius\n if (key === 'backgroundBlurRadius') {\n const name = `--${BACKGROUND_BLUR_RADIUS_PREFIX}-elevation-${level}`;\n rootVars[name] = `blur(${elevationPreset[key]}px)`;\n }\n\n // background blur fallback value\n if (key === 'fallbackBlurredBackgroundValue') {\n const { r, g, b } = elevationPreset[key];\n const name = `--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX}-elevation-${level}`;\n rootVars[name] = `rgb(${r}, ${g}, ${b})`;\n }\n });\n }\n });\n\n rootVars[`--${OUTLINE_PREFIX}-offset`] = focusRingConfig ? `${focusRingConfig.offset}px` : '2px';\n rootVars[`--${OUTLINE_PREFIX}-width`] = focusRingConfig ? `${focusRingConfig.width}px` : '2px';\n rootVars[`--${OUTLINE_PREFIX}-style`] = 'solid';\n rootVars[`--${OUTLINE_PREFIX}-color`] = focusRingConfig\n ? resolveFocusRingColor(focusRingConfig.color)\n : `rgb(var(--${SPECTRUM_COLOR_PREFIX}-gray-15))`;\n\n return {\n _vars: rootVars,\n _raw: colors,\n tailwindConfig,\n };\n}\n\nfunction transformNumericToPx<T extends Record<string, number>>(prefix: string, config: T) {\n if (!config) {\n return {\n _vars: {} as Record<string, string>,\n _raw: {} as Record<string, number>,\n tailwindConfig: {} as Record<string, string>,\n };\n }\n const rootVars: Record<string, string> = {};\n const tailwindConfig = {} as Record<string, string>;\n for (const [variant, value] of entries(config)) {\n const rootVarKey = `--${prefix}-${variant}`;\n const rootVarValue = `${value}px`;\n rootVars[rootVarKey] = rootVarValue;\n tailwindConfig[variant] = `var(${rootVarKey})`;\n }\n return {\n _vars: rootVars,\n _raw: config,\n tailwindConfig,\n };\n}\n\ntype WebTokens = Omit<UniversalTokensConfig, 'colorMode' | 'scaleMode' | 'fontFamily'> & {\n colorMode: Record<ColorMode, ReturnType<typeof transformColors>>;\n scaleMode: Record<\n ScaleMode,\n {\n borderRadius: ReturnType<typeof transformNumericToPx>;\n borderWidth: ReturnType<typeof transformNumericToPx>;\n avatarSizes: ReturnType<typeof transformNumericToPx>;\n iconSizes: ReturnType<typeof transformNumericToPx>;\n }\n >;\n};\n\nfunction getElevationPresetsForColorMode(\n colorMode: ColorMode,\n config: UniversalTokensConfig,\n): ColorModeElevationPresets {\n if (!config.elevation) {\n return {};\n }\n\n const result: ColorModeElevationPresets = {};\n\n entries(config.elevation).forEach(([level, levelPreset]) => {\n result[level] = levelPreset[colorMode];\n });\n\n return result;\n}\n\nexport function parseTokens(config: UniversalTokensConfig): WebTokens {\n const { colorMode, scaleMode } = config;\n\n return {\n ...config,\n colorMode: {\n light: transformColors(\n colorMode.light,\n getElevationPresetsForColorMode('light', config),\n config.focusRing?.light,\n ),\n dark: transformColors(\n colorMode.dark,\n getElevationPresetsForColorMode('dark', config),\n config.focusRing?.dark,\n ),\n },\n scaleMode: mapValues(scaleMode, ({ borderRadius, borderWidth, avatarSizes, iconSizes }) => {\n return {\n borderRadius: transformNumericToPx(BORDER_RADIUS_PREFIX, borderRadius),\n borderWidth: transformNumericToPx(BORDER_WIDTH_PREFIX, borderWidth),\n avatarSizes: transformNumericToPx(AVATAR_SIZE_PREFIX, avatarSizes),\n iconSizes: transformNumericToPx(ICON_SIZE_PREFIX, iconSizes),\n };\n }),\n };\n}\n\nexport { type WebTokens };\n"],"mappings":";;;;;;;;AAqCA,SAAS,yBAAyB,OAA6D;CAC7F,MAAM,EAAE,GAAG,GAAG,MAAM,MAAM;AAC1B,QAAO,GAAG,EAAE,GAA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EACL,GAAG;EACH,WAAW;GACT,OAAO,gBACL,UAAU,OACV,gCAAgC,SAAS,OAAO,EAChD,OAAO,WAAW,MACnB;GACD,MAAM,gBACJ,UAAU,MACV,gCAAgC,QAAQ,OAAO,EAC/C,OAAO,WAAW,KACnB;GACF;EACD,WAAW,UAAU,YAAY,EAAE,cAAc,aAAa,aAAa,gBAAgB;AACzF,UAAO;IACL,cAAc,qBAAqB,sBAAsB,aAAa;IACtE,aAAa,qBAAqB,qBAAqB,YAAY;IACnE,aAAa,qBAAqB,oBAAoB,YAAY;IAClE,WAAW,qBAAqB,kBAAkB,UAAU;IAC7D;IACD;EACH"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
|
-
|
|
3
2
|
//#region src/utils/postcssPreserveVars.ts
|
|
4
3
|
const PRESERVE_SELECTOR = "._uds-preserve-vars";
|
|
5
4
|
/**
|
|
@@ -60,7 +59,6 @@ function preserveVarsCleanup() {
|
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
61
|
preserveVarsCleanup.postcss = true;
|
|
63
|
-
|
|
64
62
|
//#endregion
|
|
65
63
|
exports.preserveVars = preserveVars;
|
|
66
|
-
exports.preserveVarsCleanup = preserveVarsCleanup;
|
|
64
|
+
exports.preserveVarsCleanup = preserveVarsCleanup;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
|
-
const require_runtime = require(
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
let ts_morph = require("ts-morph");
|
|
4
4
|
let lodash_camelCase_js = require("lodash/camelCase.js");
|
|
5
|
-
lodash_camelCase_js = require_runtime.__toESM(lodash_camelCase_js);
|
|
5
|
+
lodash_camelCase_js = require_runtime.__toESM(lodash_camelCase_js, 1);
|
|
6
6
|
let lodash_isEmpty_js = require("lodash/isEmpty.js");
|
|
7
|
-
lodash_isEmpty_js = require_runtime.__toESM(lodash_isEmpty_js);
|
|
8
|
-
|
|
7
|
+
lodash_isEmpty_js = require_runtime.__toESM(lodash_isEmpty_js, 1);
|
|
9
8
|
//#region src/utils/tsMorph.ts
|
|
10
9
|
/** Determines if an expression is using React.forwardRef. */
|
|
11
10
|
function isForwardRefExpression(node) {
|
|
@@ -119,8 +118,7 @@ const getUsedPropsInReference = (reference, variants) => {
|
|
|
119
118
|
});
|
|
120
119
|
return res;
|
|
121
120
|
};
|
|
122
|
-
|
|
123
121
|
//#endregion
|
|
124
122
|
exports.findReferencesAsJsxElements = findReferencesAsJsxElements;
|
|
125
123
|
exports.getReactFunctionDeclaration = getReactFunctionDeclaration;
|
|
126
|
-
exports.getUsedPropsInReference = getUsedPropsInReference;
|
|
124
|
+
exports.getUsedPropsInReference = getUsedPropsInReference;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
|
|
2
2
|
import { camelCase, isEmpty } from "lodash-es";
|
|
3
3
|
import { Node, SyntaxKind } from "ts-morph";
|
|
4
|
-
|
|
5
4
|
//#region src/utils/tsMorph.ts
|
|
6
5
|
/** Determines if an expression is using React.forwardRef. */
|
|
7
6
|
function isForwardRefExpression(node) {
|
|
@@ -115,7 +114,7 @@ const getUsedPropsInReference = (reference, variants) => {
|
|
|
115
114
|
});
|
|
116
115
|
return res;
|
|
117
116
|
};
|
|
118
|
-
|
|
119
117
|
//#endregion
|
|
120
118
|
export { findReferencesAsJsxElements, getReactFunctionDeclaration, getUsedPropsInReference };
|
|
119
|
+
|
|
121
120
|
//# sourceMappingURL=tsMorph.js.map
|