@yahoo/uds-mobile 1.0.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/CONTRIBUTING.md +1174 -0
- package/README.md +614 -0
- package/cli/uds-mobile.js +10 -0
- package/dist/_virtual/rolldown_runtime.cjs +30 -0
- package/dist/bin/generateTheme.mjs +390 -0
- package/dist/bin/mobile/scripts/utils/configToRNMappings.mjs +74 -0
- package/dist/bin/uds/dist/fixtures.mjs +404 -0
- package/dist/bin/uds/dist/tokens/configs/palette/alwaysPalette.mjs +23 -0
- package/dist/bin/uds/dist/tokens/consts/defaultModes.mjs +6 -0
- package/dist/bin/uds/dist/tokens/consts/fontDeclarationsMap.mjs +652 -0
- package/dist/bin/uds-mobile.mjs +256 -0
- package/dist/components/Avatar.cjs +109 -0
- package/dist/components/Avatar.d.cts +60 -0
- package/dist/components/Avatar.d.cts.map +1 -0
- package/dist/components/Avatar.d.mts +60 -0
- package/dist/components/Avatar.d.mts.map +1 -0
- package/dist/components/Avatar.mjs +109 -0
- package/dist/components/Avatar.mjs.map +1 -0
- package/dist/components/Badge.cjs +68 -0
- package/dist/components/Badge.d.cts +43 -0
- package/dist/components/Badge.d.cts.map +1 -0
- package/dist/components/Badge.d.mts +43 -0
- package/dist/components/Badge.d.mts.map +1 -0
- package/dist/components/Badge.mjs +68 -0
- package/dist/components/Badge.mjs.map +1 -0
- package/dist/components/Box.cjs +114 -0
- package/dist/components/Box.d.cts +87 -0
- package/dist/components/Box.d.cts.map +1 -0
- package/dist/components/Box.d.mts +87 -0
- package/dist/components/Box.d.mts.map +1 -0
- package/dist/components/Box.mjs +114 -0
- package/dist/components/Box.mjs.map +1 -0
- package/dist/components/Button.cjs +187 -0
- package/dist/components/Button.d.cts +56 -0
- package/dist/components/Button.d.cts.map +1 -0
- package/dist/components/Button.d.mts +56 -0
- package/dist/components/Button.d.mts.map +1 -0
- package/dist/components/Button.mjs +186 -0
- package/dist/components/Button.mjs.map +1 -0
- package/dist/components/Checkbox.cjs +156 -0
- package/dist/components/Checkbox.d.cts +48 -0
- package/dist/components/Checkbox.d.cts.map +1 -0
- package/dist/components/Checkbox.d.mts +48 -0
- package/dist/components/Checkbox.d.mts.map +1 -0
- package/dist/components/Checkbox.mjs +155 -0
- package/dist/components/Checkbox.mjs.map +1 -0
- package/dist/components/Chip.cjs +124 -0
- package/dist/components/Chip.d.cts +60 -0
- package/dist/components/Chip.d.cts.map +1 -0
- package/dist/components/Chip.d.mts +60 -0
- package/dist/components/Chip.d.mts.map +1 -0
- package/dist/components/Chip.mjs +124 -0
- package/dist/components/Chip.mjs.map +1 -0
- package/dist/components/HStack.cjs +46 -0
- package/dist/components/HStack.d.cts +41 -0
- package/dist/components/HStack.d.cts.map +1 -0
- package/dist/components/HStack.d.mts +41 -0
- package/dist/components/HStack.d.mts.map +1 -0
- package/dist/components/HStack.mjs +46 -0
- package/dist/components/HStack.mjs.map +1 -0
- package/dist/components/Icon.cjs +150 -0
- package/dist/components/Icon.d.cts +90 -0
- package/dist/components/Icon.d.cts.map +1 -0
- package/dist/components/Icon.d.mts +90 -0
- package/dist/components/Icon.d.mts.map +1 -0
- package/dist/components/Icon.mjs +148 -0
- package/dist/components/Icon.mjs.map +1 -0
- package/dist/components/IconButton.cjs +127 -0
- package/dist/components/IconButton.d.cts +46 -0
- package/dist/components/IconButton.d.cts.map +1 -0
- package/dist/components/IconButton.d.mts +46 -0
- package/dist/components/IconButton.d.mts.map +1 -0
- package/dist/components/IconButton.mjs +127 -0
- package/dist/components/IconButton.mjs.map +1 -0
- package/dist/components/IconSlot.cjs +55 -0
- package/dist/components/IconSlot.d.cts +45 -0
- package/dist/components/IconSlot.d.cts.map +1 -0
- package/dist/components/IconSlot.d.mts +45 -0
- package/dist/components/IconSlot.d.mts.map +1 -0
- package/dist/components/IconSlot.mjs +55 -0
- package/dist/components/IconSlot.mjs.map +1 -0
- package/dist/components/Image.cjs +104 -0
- package/dist/components/Image.d.cts +85 -0
- package/dist/components/Image.d.cts.map +1 -0
- package/dist/components/Image.d.mts +85 -0
- package/dist/components/Image.d.mts.map +1 -0
- package/dist/components/Image.mjs +104 -0
- package/dist/components/Image.mjs.map +1 -0
- package/dist/components/Input.cjs +174 -0
- package/dist/components/Input.d.cts +39 -0
- package/dist/components/Input.d.cts.map +1 -0
- package/dist/components/Input.d.mts +39 -0
- package/dist/components/Input.d.mts.map +1 -0
- package/dist/components/Input.mjs +174 -0
- package/dist/components/Input.mjs.map +1 -0
- package/dist/components/Link.cjs +139 -0
- package/dist/components/Link.d.cts +45 -0
- package/dist/components/Link.d.cts.map +1 -0
- package/dist/components/Link.d.mts +45 -0
- package/dist/components/Link.d.mts.map +1 -0
- package/dist/components/Link.mjs +138 -0
- package/dist/components/Link.mjs.map +1 -0
- package/dist/components/Pressable.cjs +120 -0
- package/dist/components/Pressable.d.cts +90 -0
- package/dist/components/Pressable.d.cts.map +1 -0
- package/dist/components/Pressable.d.mts +90 -0
- package/dist/components/Pressable.d.mts.map +1 -0
- package/dist/components/Pressable.mjs +118 -0
- package/dist/components/Pressable.mjs.map +1 -0
- package/dist/components/Radio.cjs +153 -0
- package/dist/components/Radio.d.cts +46 -0
- package/dist/components/Radio.d.cts.map +1 -0
- package/dist/components/Radio.d.mts +46 -0
- package/dist/components/Radio.d.mts.map +1 -0
- package/dist/components/Radio.mjs +152 -0
- package/dist/components/Radio.mjs.map +1 -0
- package/dist/components/Screen.cjs +89 -0
- package/dist/components/Screen.d.cts +53 -0
- package/dist/components/Screen.d.cts.map +1 -0
- package/dist/components/Screen.d.mts +53 -0
- package/dist/components/Screen.d.mts.map +1 -0
- package/dist/components/Screen.mjs +89 -0
- package/dist/components/Screen.mjs.map +1 -0
- package/dist/components/Switch.cjs +172 -0
- package/dist/components/Switch.d.cts +42 -0
- package/dist/components/Switch.d.cts.map +1 -0
- package/dist/components/Switch.d.mts +42 -0
- package/dist/components/Switch.d.mts.map +1 -0
- package/dist/components/Switch.mjs +171 -0
- package/dist/components/Switch.mjs.map +1 -0
- package/dist/components/Text.cjs +107 -0
- package/dist/components/Text.d.cts +96 -0
- package/dist/components/Text.d.cts.map +1 -0
- package/dist/components/Text.d.mts +96 -0
- package/dist/components/Text.d.mts.map +1 -0
- package/dist/components/Text.mjs +107 -0
- package/dist/components/Text.mjs.map +1 -0
- package/dist/components/VStack.cjs +46 -0
- package/dist/components/VStack.d.cts +41 -0
- package/dist/components/VStack.d.cts.map +1 -0
- package/dist/components/VStack.d.mts +41 -0
- package/dist/components/VStack.d.mts.map +1 -0
- package/dist/components/VStack.mjs +46 -0
- package/dist/components/VStack.mjs.map +1 -0
- package/dist/icons/dist/glyphMap.cjs +5475 -0
- package/dist/icons/dist/glyphMap.d.cts +10 -0
- package/dist/icons/dist/glyphMap.d.cts.map +1 -0
- package/dist/icons/dist/glyphMap.d.mts +10 -0
- package/dist/icons/dist/glyphMap.d.mts.map +1 -0
- package/dist/icons/dist/glyphMap.mjs +5474 -0
- package/dist/icons/dist/glyphMap.mjs.map +1 -0
- package/dist/icons/dist/svgMap.cjs +525 -0
- package/dist/icons/dist/svgMap.d.cts +10 -0
- package/dist/icons/dist/svgMap.d.cts.map +1 -0
- package/dist/icons/dist/svgMap.d.mts +10 -0
- package/dist/icons/dist/svgMap.d.mts.map +1 -0
- package/dist/icons/dist/svgMap.mjs +524 -0
- package/dist/icons/dist/svgMap.mjs.map +1 -0
- package/dist/icons/dist/tokens.cjs +13 -0
- package/dist/icons/dist/tokens.mjs +13 -0
- package/dist/icons/dist/tokens.mjs.map +1 -0
- package/dist/icons/dist/types.d.cts +24 -0
- package/dist/icons/dist/types.d.cts.map +1 -0
- package/dist/icons/dist/types.d.mts +24 -0
- package/dist/icons/dist/types.d.mts.map +1 -0
- package/dist/motion.cjs +56 -0
- package/dist/motion.d.cts +46 -0
- package/dist/motion.d.cts.map +1 -0
- package/dist/motion.d.mts +46 -0
- package/dist/motion.d.mts.map +1 -0
- package/dist/motion.mjs +52 -0
- package/dist/motion.mjs.map +1 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.cts +13 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +13 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/uds/dist/components/Box.d.cts +3 -0
- package/dist/uds/dist/components/Box.d.mts +3 -0
- package/dist/uds/dist/components/Divider/Divider.d.cts +3 -0
- package/dist/uds/dist/components/Divider/Divider.d.mts +3 -0
- package/dist/uds/dist/components/Divider/DividerCore.d.cts +4 -0
- package/dist/uds/dist/components/Divider/DividerCore.d.mts +4 -0
- package/dist/uds/dist/components/Divider/DividerInternal.d.cts +4 -0
- package/dist/uds/dist/components/Divider/DividerInternal.d.mts +4 -0
- package/dist/uds/dist/components/Divider/index.d.cts +2 -0
- package/dist/uds/dist/components/Divider/index.d.mts +2 -0
- package/dist/uds/dist/components/FormLabel.d.cts +3 -0
- package/dist/uds/dist/components/FormLabel.d.mts +4 -0
- package/dist/uds/dist/components/HStack.d.cts +4 -0
- package/dist/uds/dist/components/HStack.d.mts +4 -0
- package/dist/uds/dist/components/Icon.d.cts +3 -0
- package/dist/uds/dist/components/Icon.d.mts +3 -0
- package/dist/uds/dist/components/Image.d.cts +2 -0
- package/dist/uds/dist/components/Image.d.mts +3 -0
- package/dist/uds/dist/components/Link.d.cts +3 -0
- package/dist/uds/dist/components/Link.d.mts +3 -0
- package/dist/uds/dist/components/Text.d.cts +3 -0
- package/dist/uds/dist/components/Text.d.mts +3 -0
- package/dist/uds/dist/components/VStack.d.cts +4 -0
- package/dist/uds/dist/components/VStack.d.mts +4 -0
- package/dist/uds/dist/components/client/Avatar/Avatar.d.cts +2 -0
- package/dist/uds/dist/components/client/Avatar/Avatar.d.mts +3 -0
- package/dist/uds/dist/components/client/Avatar/AvatarIcon.d.cts +2 -0
- package/dist/uds/dist/components/client/Avatar/AvatarIcon.d.mts +3 -0
- package/dist/uds/dist/components/client/Avatar/AvatarImage.d.cts +4 -0
- package/dist/uds/dist/components/client/Avatar/AvatarImage.d.mts +5 -0
- package/dist/uds/dist/components/client/Avatar/AvatarText.d.cts +3 -0
- package/dist/uds/dist/components/client/Avatar/AvatarText.d.mts +4 -0
- package/dist/uds/dist/components/client/Avatar/index.d.cts +5 -0
- package/dist/uds/dist/components/client/Avatar/index.d.mts +5 -0
- package/dist/uds/dist/components/client/Badge.d.cts +3 -0
- package/dist/uds/dist/components/client/Badge.d.mts +3 -0
- package/dist/uds/dist/components/client/Button.d.cts +3 -0
- package/dist/uds/dist/components/client/Button.d.mts +3 -0
- package/dist/uds/dist/components/client/Checkbox.d.cts +3 -0
- package/dist/uds/dist/components/client/Checkbox.d.mts +3 -0
- package/dist/uds/dist/components/client/Chip/Chip.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/Chip.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipBase.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipBase.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipButton.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipButton.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipDismissible.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipDismissible.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipLink.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipLink.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipToggle.d.cts +4 -0
- package/dist/uds/dist/components/client/Chip/ChipToggle.d.mts +4 -0
- package/dist/uds/dist/components/client/Chip/index.d.cts +6 -0
- package/dist/uds/dist/components/client/Chip/index.d.mts +6 -0
- package/dist/uds/dist/components/client/IconButton.d.cts +3 -0
- package/dist/uds/dist/components/client/IconButton.d.mts +3 -0
- package/dist/uds/dist/components/client/Input/Input.d.cts +4 -0
- package/dist/uds/dist/components/client/Input/Input.d.mts +4 -0
- package/dist/uds/dist/components/client/Input/InputHelpText.d.cts +2 -0
- package/dist/uds/dist/components/client/Input/InputHelpText.d.mts +3 -0
- package/dist/uds/dist/components/client/Input/InputHelpTextInternal.d.cts +5 -0
- package/dist/uds/dist/components/client/Input/InputHelpTextInternal.d.mts +6 -0
- package/dist/uds/dist/components/client/Input/index.d.cts +3 -0
- package/dist/uds/dist/components/client/Input/index.d.mts +3 -0
- package/dist/uds/dist/components/client/Menu/Menu.Content.d.cts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Content.d.mts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Divider.d.cts +3 -0
- package/dist/uds/dist/components/client/Menu/Menu.Divider.d.mts +3 -0
- package/dist/uds/dist/components/client/Menu/Menu.Item.d.cts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Item.d.mts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.ItemCheckbox.d.mts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Provider.d.cts +2 -0
- package/dist/uds/dist/components/client/Menu/Menu.Provider.d.mts +3 -0
- package/dist/uds/dist/components/client/Menu/Menu.Trigger.d.cts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.Trigger.d.mts +4 -0
- package/dist/uds/dist/components/client/Menu/Menu.d.cts +2 -0
- package/dist/uds/dist/components/client/Menu/Menu.d.mts +2 -0
- package/dist/uds/dist/components/client/Menu/Menu.index.d.cts +7 -0
- package/dist/uds/dist/components/client/Menu/Menu.index.d.mts +7 -0
- package/dist/uds/dist/components/client/Menu/index.d.cts +9 -0
- package/dist/uds/dist/components/client/Menu/index.d.mts +9 -0
- package/dist/uds/dist/components/client/Pressable.d.cts +3 -0
- package/dist/uds/dist/components/client/Pressable.d.mts +3 -0
- package/dist/uds/dist/components/client/Radio/Radio.d.cts +3 -0
- package/dist/uds/dist/components/client/Radio/Radio.d.mts +3 -0
- package/dist/uds/dist/components/client/Radio/RadioGroupProvider.d.cts +3 -0
- package/dist/uds/dist/components/client/Radio/RadioGroupProvider.d.mts +3 -0
- package/dist/uds/dist/components/client/Radio/index.d.cts +3 -0
- package/dist/uds/dist/components/client/Radio/index.d.mts +3 -0
- package/dist/uds/dist/components/client/SpringMotionConfig.d.cts +3 -0
- package/dist/uds/dist/components/client/SpringMotionConfig.d.mts +3 -0
- package/dist/uds/dist/components/client/Switch.d.cts +3 -0
- package/dist/uds/dist/components/client/Switch.d.mts +3 -0
- package/dist/uds/dist/components/client/index.d.cts +33 -0
- package/dist/uds/dist/components/client/index.d.mts +33 -0
- package/dist/uds/dist/components/index.d.cts +40 -0
- package/dist/uds/dist/components/index.d.mts +40 -0
- package/dist/uds/dist/index.d.cts +46 -0
- package/dist/uds/dist/index.d.mts +46 -0
- package/dist/uds/dist/styles/styler.d.cts +2 -0
- package/dist/uds/dist/styles/styler.d.mts +2 -0
- package/dist/uds/dist/styles/stylerTypes.d.cts +2 -0
- package/dist/uds/dist/styles/stylerTypes.d.mts +2 -0
- package/dist/uds/dist/tokens/automation/configs/avatar.d.cts +2 -0
- package/dist/uds/dist/tokens/automation/configs/avatar.d.mts +2 -0
- package/dist/uds/dist/tokens/automation/properties.d.cts +3 -0
- package/dist/uds/dist/tokens/automation/properties.d.mts +3 -0
- package/dist/uds/dist/tokens/automation/types/ComponentConfig.d.cts +3 -0
- package/dist/uds/dist/tokens/automation/types/ComponentConfig.d.mts +3 -0
- package/dist/uds/dist/tokens/configs/motion.cjs +109 -0
- package/dist/uds/dist/tokens/configs/motion.d.cts +20 -0
- package/dist/uds/dist/tokens/configs/motion.d.cts.map +1 -0
- package/dist/uds/dist/tokens/configs/motion.d.mts +20 -0
- package/dist/uds/dist/tokens/configs/motion.d.mts.map +1 -0
- package/dist/uds/dist/tokens/configs/motion.mjs +108 -0
- package/dist/uds/dist/tokens/configs/motion.mjs.map +1 -0
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.cts +32 -0
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.cts.map +1 -0
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.mts +32 -0
- package/dist/uds/dist/tokens/configs/palette/alwaysPalette.d.mts.map +1 -0
- package/dist/uds/dist/tokens/types.d.cts +426 -0
- package/dist/uds/dist/tokens/types.d.cts.map +1 -0
- package/dist/uds/dist/tokens/types.d.mts +426 -0
- package/dist/uds/dist/tokens/types.d.mts.map +1 -0
- package/dist/uds/dist/types.d.cts +2 -0
- package/dist/uds/dist/types.d.mts +2 -0
- package/fonts/centra-no2-black-italic.otf +0 -0
- package/fonts/centra-no2-black.otf +0 -0
- package/fonts/centra-no2-bold-italic.otf +0 -0
- package/fonts/centra-no2-bold.otf +0 -0
- package/fonts/centra-no2-book-italic.otf +0 -0
- package/fonts/centra-no2-book.otf +0 -0
- package/fonts/centra-no2-extrabold-italic.otf +0 -0
- package/fonts/centra-no2-extrabold.otf +0 -0
- package/fonts/centra-no2-hairline-italic.otf +0 -0
- package/fonts/centra-no2-hairline.otf +0 -0
- package/fonts/centra-no2-light-italic.otf +0 -0
- package/fonts/centra-no2-light.otf +0 -0
- package/fonts/centra-no2-medium-italic.otf +0 -0
- package/fonts/centra-no2-medium.otf +0 -0
- package/fonts/centra-no2-thin-italic.otf +0 -0
- package/fonts/centra-no2-thin.otf +0 -0
- package/fonts/gelica-black-italic.otf +0 -0
- package/fonts/gelica-black.otf +0 -0
- package/fonts/gelica-bold-italic.otf +0 -0
- package/fonts/gelica-bold.otf +0 -0
- package/fonts/gelica-extra-light-italic.otf +0 -0
- package/fonts/gelica-extra-light.otf +0 -0
- package/fonts/gelica-light-italic.otf +0 -0
- package/fonts/gelica-light.otf +0 -0
- package/fonts/gelica-medium-italic.otf +0 -0
- package/fonts/gelica-medium.otf +0 -0
- package/fonts/gelica-regular-italic.otf +0 -0
- package/fonts/gelica-regular.otf +0 -0
- package/fonts/gelica-semi-bold-italic.otf +0 -0
- package/fonts/gelica-semi-bold.otf +0 -0
- package/fonts/index.cjs +270 -0
- package/fonts/index.d.ts +10 -0
- package/fonts/index.mjs +272 -0
- package/fonts/inter-black.ttf +0 -0
- package/fonts/inter-bold.ttf +0 -0
- package/fonts/inter-extra-bold.ttf +0 -0
- package/fonts/inter-extra-light.ttf +0 -0
- package/fonts/inter-light.ttf +0 -0
- package/fonts/inter-medium.ttf +0 -0
- package/fonts/inter-regular.ttf +0 -0
- package/fonts/inter-semi-bold.ttf +0 -0
- package/fonts/inter-thin.ttf +0 -0
- package/fonts/roboto-mono-bold-italic.ttf +0 -0
- package/fonts/roboto-mono-bold.ttf +0 -0
- package/fonts/roboto-mono-light-italic.ttf +0 -0
- package/fonts/roboto-mono-light.ttf +0 -0
- package/fonts/roboto-mono-medium-italic.ttf +0 -0
- package/fonts/roboto-mono-medium.ttf +0 -0
- package/fonts/roboto-mono-regular-italic.ttf +0 -0
- package/fonts/roboto-mono-regular.ttf +0 -0
- package/fonts/roboto-mono-thin-italic.ttf +0 -0
- package/fonts/roboto-mono-thin.ttf +0 -0
- package/fonts/uds-icons.ttf +0 -0
- package/fonts/yahoo-product-sans-bold.otf +0 -0
- package/fonts/yahoo-product-sans-extended-black-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-black.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-bold-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-bold.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-light-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-light.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-medium-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-medium.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-regular-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-regular.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-semibold-italic.ttf +0 -0
- package/fonts/yahoo-product-sans-extended-semibold.ttf +0 -0
- package/fonts/yahoo-product-sans-medium.otf +0 -0
- package/fonts/yahoo-product-sans-regular.otf +0 -0
- package/fonts/yahoo-sans-beta-bold.otf +0 -0
- package/fonts/yahoo-sans-beta-medium.otf +0 -0
- package/fonts/yahoo-sans-beta-regular.otf +0 -0
- package/fonts/yahoo-sans-black.otf +0 -0
- package/fonts/yahoo-sans-bold.otf +0 -0
- package/fonts/yahoo-sans-condensed-black.otf +0 -0
- package/fonts/yahoo-sans-condensed-bold.otf +0 -0
- package/fonts/yahoo-sans-condensed-light.otf +0 -0
- package/fonts/yahoo-sans-condensed-medium.otf +0 -0
- package/fonts/yahoo-sans-condensed-regular.otf +0 -0
- package/fonts/yahoo-sans-condensed-xbold.ttf +0 -0
- package/fonts/yahoo-sans-cr4-bold.ttf +0 -0
- package/fonts/yahoo-sans-cr4-medium.ttf +0 -0
- package/fonts/yahoo-sans-cr4-regular.ttf +0 -0
- package/fonts/yahoo-sans-extrabold.otf +0 -0
- package/fonts/yahoo-sans-extralight.otf +0 -0
- package/fonts/yahoo-sans-italic.otf +0 -0
- package/fonts/yahoo-sans-light.otf +0 -0
- package/fonts/yahoo-sans-medium.otf +0 -0
- package/fonts/yahoo-sans-regular-italic.otf +0 -0
- package/fonts/yahoo-sans-regular.otf +0 -0
- package/fonts/yahoo-sans-semibold.otf +0 -0
- package/fonts/yahoo-serif-display-black.otf +0 -0
- package/fonts/yahoo-serif-display-bold.otf +0 -0
- package/fonts/yahoo-serif-display-extrabold.otf +0 -0
- package/fonts/yahoo-serif-display-light.otf +0 -0
- package/fonts/yahoo-serif-display-regular.otf +0 -0
- package/fonts/yahoo-serif-text-bold-italic.ttf +0 -0
- package/fonts/yahoo-serif-text-bold.otf +0 -0
- package/fonts/yahoo-serif-text-italic.otf +0 -0
- package/fonts/yahoo-serif-text-regular.otf +0 -0
- package/fonts/yas-black-italic.otf +0 -0
- package/fonts/yas-black.otf +0 -0
- package/fonts/yas-bold-italic.otf +0 -0
- package/fonts/yas-bold.otf +0 -0
- package/fonts/yas-condensed-black-italic.otf +0 -0
- package/fonts/yas-condensed-black.otf +0 -0
- package/fonts/yas-condensed-bold-italic.otf +0 -0
- package/fonts/yas-condensed-bold.otf +0 -0
- package/fonts/yas-condensed-light-italic.otf +0 -0
- package/fonts/yas-condensed-light.otf +0 -0
- package/fonts/yas-condensed-medium-italic.otf +0 -0
- package/fonts/yas-condensed-medium.otf +0 -0
- package/fonts/yas-condensed-regular-italic.otf +0 -0
- package/fonts/yas-condensed-regular.otf +0 -0
- package/fonts/yas-condensed-semibold-italic.otf +0 -0
- package/fonts/yas-condensed-semibold.otf +0 -0
- package/fonts/yas-extended-black-italic.otf +0 -0
- package/fonts/yas-extended-black.otf +0 -0
- package/fonts/yas-extended-bold-italic.otf +0 -0
- package/fonts/yas-extended-bold.otf +0 -0
- package/fonts/yas-extended-light-italic.otf +0 -0
- package/fonts/yas-extended-light.otf +0 -0
- package/fonts/yas-extended-medium-italic.otf +0 -0
- package/fonts/yas-extended-medium.otf +0 -0
- package/fonts/yas-extended-regular-italic.otf +0 -0
- package/fonts/yas-extended-regular.otf +0 -0
- package/fonts/yas-extended-semibold-italic.otf +0 -0
- package/fonts/yas-extended-semibold.otf +0 -0
- package/fonts/yas-light-italic.otf +0 -0
- package/fonts/yas-light.otf +0 -0
- package/fonts/yas-medium-italic.otf +0 -0
- package/fonts/yas-medium.otf +0 -0
- package/fonts/yas-regular-italic.otf +0 -0
- package/fonts/yas-regular.otf +0 -0
- package/fonts/yas-semibold-italic.otf +0 -0
- package/fonts/yas-semibold.otf +0 -0
- package/generated/styles.cjs +4510 -0
- package/generated/styles.d.cts +1 -0
- package/generated/styles.d.mts +1 -0
- package/generated/styles.d.ts +2965 -0
- package/generated/styles.mjs +4510 -0
- package/generated/unistyles.d.ts +4320 -0
- package/package.json +308 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spacingMap } from "./uds/dist/fixtures.mjs";
|
|
3
|
+
import { newAlwaysPalette } from "./uds/dist/tokens/configs/palette/alwaysPalette.mjs";
|
|
4
|
+
import { DEFAULT_SCALE_MODE } from "./uds/dist/tokens/consts/defaultModes.mjs";
|
|
5
|
+
import { FONT_DECLARATIONS_MAP } from "./uds/dist/tokens/consts/fontDeclarationsMap.mjs";
|
|
6
|
+
import { MOBILE_STATES, PROPERTY_TO_RN_PROPS, SHADOW_PROPS, TEXT_ONLY_PROPS, toSlashKey } from "./mobile/scripts/utils/configToRNMappings.mjs";
|
|
7
|
+
import { fontAliasToPostscript } from "@yahoo/uds-mobile/fonts";
|
|
8
|
+
|
|
9
|
+
//#region bin/generateTheme.ts
|
|
10
|
+
/**
|
|
11
|
+
* Generate Unistyles theme from UDS tokens.
|
|
12
|
+
*
|
|
13
|
+
* Takes UniversalTokensConfig and generates theme objects for React Native Unistyles.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Converts an array of BoxShadowValue objects to a CSS box-shadow string.
|
|
17
|
+
* React Native's new architecture supports the CSS string syntax for boxShadow.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* boxShadowToCssString([
|
|
21
|
+
* { offsetX: 0, offsetY: 16, blurRadius: 24, spreadDistance: -4, color: 'rgba(0,0,0,0.1)', inset: true }
|
|
22
|
+
* ])
|
|
23
|
+
* // Returns: "inset 0px 16px 24px -4px rgba(0,0,0,0.1)"
|
|
24
|
+
*/
|
|
25
|
+
function boxShadowToCssString(shadows) {
|
|
26
|
+
return shadows.map((s) => {
|
|
27
|
+
const parts = [];
|
|
28
|
+
if (s.inset) parts.push("inset");
|
|
29
|
+
parts.push(`${s.offsetX}px`);
|
|
30
|
+
parts.push(`${s.offsetY}px`);
|
|
31
|
+
parts.push(`${s.blurRadius ?? 0}px`);
|
|
32
|
+
parts.push(`${s.spreadDistance ?? 0}px`);
|
|
33
|
+
if (s.color) parts.push(s.color);
|
|
34
|
+
return parts.join(" ");
|
|
35
|
+
}).join(", ");
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Recursively sorts object keys for deterministic output.
|
|
39
|
+
*/
|
|
40
|
+
function sortKeys(obj) {
|
|
41
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
42
|
+
if (Array.isArray(obj)) return obj.map(sortKeys);
|
|
43
|
+
const sorted = {};
|
|
44
|
+
const keys = Object.keys(obj).sort();
|
|
45
|
+
for (const key of keys) sorted[key] = sortKeys(obj[key]);
|
|
46
|
+
return sorted;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Converts a FontID and weight value to a PostScript font name.
|
|
50
|
+
* React Native requires PostScript names to load fonts, not CSS font-family + weight.
|
|
51
|
+
*/
|
|
52
|
+
function getPostScriptName(fontId, weight, italic = false) {
|
|
53
|
+
const fontConfig = FONT_DECLARATIONS_MAP[fontId];
|
|
54
|
+
if (!fontConfig) return fontId;
|
|
55
|
+
let weightConfig = fontConfig.fontWeights.find((w) => w.value === weight);
|
|
56
|
+
if (!weightConfig) weightConfig = fontConfig.fontWeights.reduce((closest, current) => {
|
|
57
|
+
const closestDiff = Math.abs(closest.value - weight);
|
|
58
|
+
return Math.abs(current.value - weight) < closestDiff ? current : closest;
|
|
59
|
+
});
|
|
60
|
+
const weightLabel = weightConfig.label.toLowerCase().replace(/\s+/g, "-");
|
|
61
|
+
const fontFileKey = italic ? `${fontId}-${weightLabel}-italic` : `${fontId}-${weightLabel}`;
|
|
62
|
+
return fontAliasToPostscript[fontFileKey] ?? fontFileKey;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Converts RGB space-separated string (e.g., "255 0 128") to rgb() format.
|
|
66
|
+
*/
|
|
67
|
+
function rgbStringToRgb(rgbString) {
|
|
68
|
+
const parts = rgbString.trim().split(/\s+/);
|
|
69
|
+
if (parts.length !== 3) return rgbString;
|
|
70
|
+
return `rgb(${parts.join(", ")})`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Generates elevation colors from config.
|
|
74
|
+
*/
|
|
75
|
+
function generateElevationColors(elevation) {
|
|
76
|
+
const result = {};
|
|
77
|
+
for (const level of Object.keys(elevation)) result[`elevation-${level}`] = "transparent";
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Parses a typography unit value to a number.
|
|
82
|
+
*/
|
|
83
|
+
function parseTypographyValue(value) {
|
|
84
|
+
return value.value;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Parses a shadow offset/size string to a number.
|
|
88
|
+
* Handles special values like 'px' (1px) and '-px' (-1px).
|
|
89
|
+
*/
|
|
90
|
+
function parseShadowValue(value) {
|
|
91
|
+
if (value === "px") return 1;
|
|
92
|
+
if (value === "-px") return -1;
|
|
93
|
+
const parsed = parseFloat(value);
|
|
94
|
+
return isNaN(parsed) ? 0 : parsed * 4;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Resolves a shadow color with opacity applied.
|
|
98
|
+
*/
|
|
99
|
+
function resolveShadowColor(colorConfig, opacity, spectrum, palette) {
|
|
100
|
+
const opacityValue = parseInt(opacity, 10) / 100;
|
|
101
|
+
if (colorConfig.type === "always") return `rgba(${colorConfig.value === "white" ? "255, 255, 255" : "0, 0, 0"}, ${opacityValue})`;
|
|
102
|
+
if (colorConfig.type === "palette") {
|
|
103
|
+
const colorDef = palette[colorConfig.value];
|
|
104
|
+
if (colorDef) {
|
|
105
|
+
const rgbValue = spectrum[colorDef.hue]?.[colorDef.step];
|
|
106
|
+
if (rgbValue) return `rgba(${rgbValue.trim().split(/\s+/).join(", ")}, ${opacityValue})`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return `rgba(0, 0, 0, ${opacityValue})`;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Converts shadow presets to React Native BoxShadowValue array.
|
|
113
|
+
*/
|
|
114
|
+
function convertShadowToBoxShadow(presets, spectrum, palette, inset = false) {
|
|
115
|
+
return presets.map((preset) => ({
|
|
116
|
+
offsetX: parseShadowValue(preset.offsetX),
|
|
117
|
+
offsetY: parseShadowValue(preset.offsetY),
|
|
118
|
+
blurRadius: parseShadowValue(preset.blur),
|
|
119
|
+
spreadDistance: parseShadowValue(preset.spread),
|
|
120
|
+
color: resolveShadowColor(preset.color, preset.opacity, spectrum, palette),
|
|
121
|
+
...inset && { inset: true }
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
function generateSpectrum(spectrum) {
|
|
125
|
+
const result = {};
|
|
126
|
+
for (const [hue, steps] of Object.entries(spectrum)) for (const [step, rgbValue] of Object.entries(steps)) result[`${hue}-${step}`] = rgbStringToRgb(rgbValue);
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
function generatePalette(palette, spectrum) {
|
|
130
|
+
const result = {};
|
|
131
|
+
for (const [alias, { hue, step, opacity }] of Object.entries(palette)) {
|
|
132
|
+
const rgbValue = spectrum[hue]?.[step];
|
|
133
|
+
if (!rgbValue) continue;
|
|
134
|
+
if (opacity !== void 0) {
|
|
135
|
+
const opacityPercent = parseInt(opacity, 10) / 100;
|
|
136
|
+
result[alias] = `rgba(${rgbValue.trim().split(/\s+/).join(", ")}, ${opacityPercent})`;
|
|
137
|
+
} else result[alias] = rgbStringToRgb(rgbValue);
|
|
138
|
+
}
|
|
139
|
+
for (const [key, value] of Object.entries(newAlwaysPalette)) {
|
|
140
|
+
if (key.includes("current")) continue;
|
|
141
|
+
result[key] = value;
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
function generateTypography(typographyConfig, fontConfig) {
|
|
146
|
+
const result = {};
|
|
147
|
+
for (const [variant, style] of Object.entries(typographyConfig)) {
|
|
148
|
+
const fontAlias = style.fontFamily.base;
|
|
149
|
+
const fontId = fontConfig[fontAlias] ?? fontAlias;
|
|
150
|
+
const weight = Number(style.fontWeight.base.value);
|
|
151
|
+
const postScriptName = fontId in FONT_DECLARATIONS_MAP ? getPostScriptName(fontId, weight) : fontId;
|
|
152
|
+
result[variant] = {
|
|
153
|
+
fontSize: parseTypographyValue(style.fontSize.base),
|
|
154
|
+
lineHeight: parseTypographyValue(style.lineHeight.base),
|
|
155
|
+
letterSpacing: parseTypographyValue(style.letterSpacing.base),
|
|
156
|
+
fontFamily: postScriptName,
|
|
157
|
+
fontWeight: weight
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
function generateFontAliases(fontConfig) {
|
|
163
|
+
const result = {};
|
|
164
|
+
for (const [alias, fontId] of Object.entries(fontConfig)) if (fontId in FONT_DECLARATIONS_MAP) {
|
|
165
|
+
const defaultWeight = FONT_DECLARATIONS_MAP[fontId].defaults.fontWeight;
|
|
166
|
+
result[alias] = getPostScriptName(fontId, defaultWeight);
|
|
167
|
+
} else result[alias] = fontId;
|
|
168
|
+
result.icons = "uds-icons";
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
function generateShadows(config) {
|
|
172
|
+
const result = {};
|
|
173
|
+
Object.keys(config.shadow.drop).forEach((variant, index) => {
|
|
174
|
+
result[variant] = variant === "none" ? 0 : index;
|
|
175
|
+
});
|
|
176
|
+
Object.keys(config.elevation).forEach((level) => {
|
|
177
|
+
result[`elevation-${level}`] = parseInt(level, 10);
|
|
178
|
+
});
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Resolves a typography variant name to React Native text styles.
|
|
183
|
+
* Looks up the typography config and converts to RN-compatible values.
|
|
184
|
+
*
|
|
185
|
+
* @param variantName - The typography variant name (e.g., 'body1', 'label4', 'ui2')
|
|
186
|
+
* @param typography - The typography config from UniversalTokensConfig
|
|
187
|
+
* @param config - The full config for resolving font family aliases
|
|
188
|
+
* @returns Resolved typography styles (fontSize, lineHeight, letterSpacing, fontFamily)
|
|
189
|
+
*/
|
|
190
|
+
function resolveTypographyStyles(variantName, typography, config) {
|
|
191
|
+
const result = {};
|
|
192
|
+
const typographyStyle = typography[variantName];
|
|
193
|
+
if (!typographyStyle) return result;
|
|
194
|
+
const fontSize = typographyStyle.fontSize?.base?.value;
|
|
195
|
+
const lineHeight = typographyStyle.lineHeight?.base?.value;
|
|
196
|
+
const letterSpacing = typographyStyle.letterSpacing?.base?.value;
|
|
197
|
+
const fontFamily = typographyStyle.fontFamily?.base;
|
|
198
|
+
const fontWeight = typographyStyle.fontWeight?.base?.value;
|
|
199
|
+
if (typeof fontSize === "number") result.fontSize = fontSize;
|
|
200
|
+
if (typeof lineHeight === "number") result.lineHeight = lineHeight;
|
|
201
|
+
if (typeof letterSpacing === "number") result.letterSpacing = letterSpacing;
|
|
202
|
+
if (typeof fontFamily === "string") {
|
|
203
|
+
const fontId = config.font[fontFamily] ?? fontFamily;
|
|
204
|
+
if (fontId in FONT_DECLARATIONS_MAP) result.fontFamily = getPostScriptName(fontId, typeof fontWeight === "number" ? fontWeight : 400);
|
|
205
|
+
else result.fontFamily = fontId;
|
|
206
|
+
}
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
function resolveValue(variable, config, colorMode) {
|
|
210
|
+
const { type, value } = variable;
|
|
211
|
+
const palette = config.colorMode[colorMode].palette;
|
|
212
|
+
const spectrum = config.colorMode[colorMode].spectrum;
|
|
213
|
+
const scaleConfig = config.scaleMode[DEFAULT_SCALE_MODE];
|
|
214
|
+
if (type === "backgroundPaletteColors" || type === "foregroundPaletteColors" || type === "linePaletteColors") {
|
|
215
|
+
const colorDef = palette[type.replace("PaletteColors", "")]?.[value];
|
|
216
|
+
if (colorDef) {
|
|
217
|
+
const rgbValue = spectrum[colorDef.hue]?.[colorDef.step];
|
|
218
|
+
if (rgbValue) {
|
|
219
|
+
const parts = rgbValue.trim().split(/\s+/);
|
|
220
|
+
if (colorDef.opacity !== void 0) return `rgba(${parts.join(", ")}, ${parseInt(colorDef.opacity, 10) / 100})`;
|
|
221
|
+
return `rgb(${parts.join(", ")})`;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (typeof value === "string" && value.startsWith("always/")) return newAlwaysPalette[value] ?? value;
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (type === "spectrumColors") {
|
|
228
|
+
const colorStr = value;
|
|
229
|
+
const lastDashIndex = colorStr.lastIndexOf("-");
|
|
230
|
+
if (lastDashIndex > 0) {
|
|
231
|
+
const hue = colorStr.slice(0, lastDashIndex);
|
|
232
|
+
const step = colorStr.slice(lastDashIndex + 1);
|
|
233
|
+
const rgbValue = spectrum[hue]?.[step];
|
|
234
|
+
if (rgbValue) return `rgb(${rgbValue.trim().split(/\s+/).join(", ")})`;
|
|
235
|
+
}
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (type === "alwaysPaletteAliases") return newAlwaysPalette[value] ?? value;
|
|
239
|
+
if (type === "spacingAliases") return spacingMap[value];
|
|
240
|
+
if (type === "borderWidths") return scaleConfig.borderWidth[value];
|
|
241
|
+
if (type === "borderRadii") return scaleConfig.borderRadius[value];
|
|
242
|
+
if (type === "iconSizes") return scaleConfig.iconSizes[value];
|
|
243
|
+
if (type === "opacitySteps") {
|
|
244
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
245
|
+
return typeof numValue === "number" && !isNaN(numValue) ? numValue / 100 : void 0;
|
|
246
|
+
}
|
|
247
|
+
if (type === "shadowVariants") {
|
|
248
|
+
const shadowVariant = value;
|
|
249
|
+
if (shadowVariant === "none") return [];
|
|
250
|
+
const shadowPresets = config.shadow.drop[shadowVariant];
|
|
251
|
+
if (shadowPresets && shadowPresets.length > 0) return convertShadowToBoxShadow(shadowPresets, spectrum, palette.foreground);
|
|
252
|
+
return [];
|
|
253
|
+
}
|
|
254
|
+
if (type === "shadowVariantsWithInvert") {
|
|
255
|
+
const shadowVariant = value;
|
|
256
|
+
if (shadowVariant === "none") return [];
|
|
257
|
+
const baseVariant = shadowVariant.endsWith("-invert") ? shadowVariant.replace("-invert", "") : shadowVariant;
|
|
258
|
+
const shadowPresets = config.shadow.inset[shadowVariant];
|
|
259
|
+
if (shadowPresets && shadowPresets.length > 0) return convertShadowToBoxShadow(shadowPresets, spectrum, palette.foreground, true);
|
|
260
|
+
const dropPresets = config.shadow.drop[baseVariant];
|
|
261
|
+
if (dropPresets && dropPresets.length > 0) return convertShadowToBoxShadow(dropPresets, spectrum, palette.foreground, true);
|
|
262
|
+
return [];
|
|
263
|
+
}
|
|
264
|
+
if (type === "textDecorationLines") return value;
|
|
265
|
+
if (typeof value === "number") return value;
|
|
266
|
+
}
|
|
267
|
+
function generateComponents(config, colorMode) {
|
|
268
|
+
const result = {};
|
|
269
|
+
const typography = config.typography;
|
|
270
|
+
for (const [componentName, componentConfig] of Object.entries(config)) {
|
|
271
|
+
if (!componentConfig || typeof componentConfig !== "object" || !("variables" in componentConfig)) continue;
|
|
272
|
+
const variables = componentConfig.variables;
|
|
273
|
+
for (const [path, properties] of Object.entries(variables)) {
|
|
274
|
+
const pathParts = path.split("/");
|
|
275
|
+
const layer = pathParts[pathParts.length - 1];
|
|
276
|
+
const variantPath = pathParts.slice(0, -1);
|
|
277
|
+
const isRootLayer = layer === "root";
|
|
278
|
+
for (const state of MOBILE_STATES) {
|
|
279
|
+
const viewStyleObj = {};
|
|
280
|
+
const textStyleObj = {};
|
|
281
|
+
const shadowValues = [];
|
|
282
|
+
for (const [propName, states] of Object.entries(properties)) {
|
|
283
|
+
if (propName === "textVariant") {
|
|
284
|
+
const stateValue$1 = states[state];
|
|
285
|
+
if (stateValue$1 && stateValue$1.type === "textVariants") {
|
|
286
|
+
const variantName = stateValue$1.value;
|
|
287
|
+
const typographyStyles = resolveTypographyStyles(variantName, typography, config);
|
|
288
|
+
const targetObj$1 = isRootLayer ? textStyleObj : viewStyleObj;
|
|
289
|
+
Object.assign(targetObj$1, typographyStyles);
|
|
290
|
+
}
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
const rnProps = PROPERTY_TO_RN_PROPS[propName];
|
|
294
|
+
if (!rnProps) continue;
|
|
295
|
+
const stateValue = states[state];
|
|
296
|
+
if (!stateValue) continue;
|
|
297
|
+
const resolvedValue = resolveValue(stateValue, config, colorMode);
|
|
298
|
+
if (resolvedValue === void 0) continue;
|
|
299
|
+
if (SHADOW_PROPS.has(propName)) {
|
|
300
|
+
if (Array.isArray(resolvedValue)) shadowValues.push(...resolvedValue);
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
const targetObj = isRootLayer && TEXT_ONLY_PROPS.has(propName) ? textStyleObj : viewStyleObj;
|
|
304
|
+
for (const rnProp of rnProps) targetObj[rnProp] = resolvedValue;
|
|
305
|
+
}
|
|
306
|
+
if (shadowValues.length > 0) viewStyleObj.boxShadow = boxShadowToCssString(shadowValues);
|
|
307
|
+
if (variantPath[0] === "textStyle") {
|
|
308
|
+
const variantName = variantPath[1];
|
|
309
|
+
const typographyStyles = resolveTypographyStyles(variantName, typography, config);
|
|
310
|
+
if (layer === "icon") {
|
|
311
|
+
if (typographyStyles.lineHeight !== void 0) viewStyleObj.lineHeight = typographyStyles.lineHeight;
|
|
312
|
+
} else if (layer === "root") Object.assign(viewStyleObj, typographyStyles);
|
|
313
|
+
}
|
|
314
|
+
if (componentName === "link") delete viewStyleObj.gap;
|
|
315
|
+
if (Object.keys(viewStyleObj).length > 0) {
|
|
316
|
+
const flatKey = toSlashKey([
|
|
317
|
+
componentName,
|
|
318
|
+
...variantPath,
|
|
319
|
+
layer,
|
|
320
|
+
state
|
|
321
|
+
]);
|
|
322
|
+
result[flatKey] = viewStyleObj;
|
|
323
|
+
}
|
|
324
|
+
if (isRootLayer && Object.keys(textStyleObj).length > 0) {
|
|
325
|
+
const textLayer = `${layer}Text`;
|
|
326
|
+
const flatKey = toSlashKey([
|
|
327
|
+
componentName,
|
|
328
|
+
...variantPath,
|
|
329
|
+
textLayer,
|
|
330
|
+
state
|
|
331
|
+
]);
|
|
332
|
+
result[flatKey] = textStyleObj;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return sortKeys(result);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Generates a UDS theme object from config for a specific color mode.
|
|
341
|
+
* Output is sorted for deterministic generation.
|
|
342
|
+
*/
|
|
343
|
+
function generateTheme(config, colorMode) {
|
|
344
|
+
const colorsConfig = config.colorMode[colorMode];
|
|
345
|
+
const scaleConfig = config.scaleMode[DEFAULT_SCALE_MODE];
|
|
346
|
+
const elevationColors = generateElevationColors(config.elevation);
|
|
347
|
+
return {
|
|
348
|
+
colors: {
|
|
349
|
+
spectrum: sortKeys(generateSpectrum(colorsConfig.spectrum)),
|
|
350
|
+
background: sortKeys({
|
|
351
|
+
...generatePalette(colorsConfig.palette.background, colorsConfig.spectrum),
|
|
352
|
+
...elevationColors
|
|
353
|
+
}),
|
|
354
|
+
foreground: sortKeys(generatePalette(colorsConfig.palette.foreground, colorsConfig.spectrum)),
|
|
355
|
+
line: sortKeys({
|
|
356
|
+
...generatePalette(colorsConfig.palette.line, colorsConfig.spectrum),
|
|
357
|
+
...elevationColors
|
|
358
|
+
})
|
|
359
|
+
},
|
|
360
|
+
spacing: sortKeys({ ...spacingMap }),
|
|
361
|
+
borderRadius: sortKeys({ ...scaleConfig.borderRadius }),
|
|
362
|
+
borderWidth: sortKeys({
|
|
363
|
+
...scaleConfig.borderWidth,
|
|
364
|
+
...Object.fromEntries(Object.keys(config.elevation).map((level) => [`elevation-${level}`, parseInt(level, 10)]))
|
|
365
|
+
}),
|
|
366
|
+
iconSize: sortKeys({ ...scaleConfig.iconSizes }),
|
|
367
|
+
avatarSize: sortKeys({ ...scaleConfig.avatarSizes }),
|
|
368
|
+
font: sortKeys(generateFontAliases(config.font)),
|
|
369
|
+
typography: sortKeys(generateTypography(config.typography, config.font)),
|
|
370
|
+
shadow: sortKeys(generateShadows(config)),
|
|
371
|
+
components: generateComponents(config, colorMode)
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Generates breakpoints object from config.
|
|
376
|
+
*/
|
|
377
|
+
function generateBreakpoints(config) {
|
|
378
|
+
const bp = config.breakpoints;
|
|
379
|
+
return {
|
|
380
|
+
xs: 0,
|
|
381
|
+
sm: bp.sm.type === "px" ? bp.sm.value : 0,
|
|
382
|
+
md: bp.md.type === "px" ? bp.md.value : 0,
|
|
383
|
+
lg: bp.lg.type === "px" ? bp.lg.value : 0,
|
|
384
|
+
xl: bp.xl.type === "px" ? bp.xl.value : 0,
|
|
385
|
+
"2xl": bp["2xl"].type === "px" ? bp["2xl"].value : 0
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
//#endregion
|
|
390
|
+
export { generateBreakpoints, generateTheme };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//#region scripts/utils/configToRNMappings.ts
|
|
3
|
+
/**
|
|
4
|
+
* Properties that map to React Native style props.
|
|
5
|
+
* Properties not in this list are skipped.
|
|
6
|
+
*/
|
|
7
|
+
const PROPERTY_TO_RN_PROPS = {
|
|
8
|
+
spacingHorizontal: ["paddingHorizontal"],
|
|
9
|
+
spacingVertical: ["paddingVertical"],
|
|
10
|
+
padding: ["padding"],
|
|
11
|
+
gap: ["gap"],
|
|
12
|
+
height: ["height"],
|
|
13
|
+
width: ["width"],
|
|
14
|
+
backgroundColor: ["backgroundColor"],
|
|
15
|
+
color: ["color"],
|
|
16
|
+
borderColor: ["borderColor"],
|
|
17
|
+
borderWidth: ["borderWidth"],
|
|
18
|
+
borderRadius: ["borderRadius"],
|
|
19
|
+
iconSize: ["fontSize", "lineHeight"],
|
|
20
|
+
opacity: ["opacity"],
|
|
21
|
+
size: ["fontSize", "lineHeight"],
|
|
22
|
+
shadow: ["boxShadow"],
|
|
23
|
+
insetShadow: ["boxShadow"],
|
|
24
|
+
textDecorationLine: ["textDecorationLine"],
|
|
25
|
+
textVariant: [
|
|
26
|
+
"fontFamily",
|
|
27
|
+
"fontSize",
|
|
28
|
+
"lineHeight",
|
|
29
|
+
"letterSpacing"
|
|
30
|
+
]
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Properties that only apply to Text components in React Native.
|
|
34
|
+
* These need to be separated from View styles since RN doesn't have inheritance.
|
|
35
|
+
* For root layers, these create separate `rootText` entries.
|
|
36
|
+
*/
|
|
37
|
+
const TEXT_ONLY_PROPS = new Set([
|
|
38
|
+
"color",
|
|
39
|
+
"textDecorationLine",
|
|
40
|
+
"textVariant"
|
|
41
|
+
]);
|
|
42
|
+
/**
|
|
43
|
+
* Shadow properties that should be merged into a single boxShadow array.
|
|
44
|
+
* Both drop shadow and inset shadow map to the same RN boxShadow prop.
|
|
45
|
+
*/
|
|
46
|
+
const SHADOW_PROPS = new Set(["shadow", "insetShadow"]);
|
|
47
|
+
/**
|
|
48
|
+
* States that are relevant for mobile (skip hover).
|
|
49
|
+
* - rest: default state
|
|
50
|
+
* - pressed: active/focus state (maps to focus-within on web)
|
|
51
|
+
* - disabled: non-interactive disabled state
|
|
52
|
+
* - readonly: non-editable but selectable state (Input)
|
|
53
|
+
* - invalid: error/validation state (Input, forms)
|
|
54
|
+
*/
|
|
55
|
+
const MOBILE_STATES = [
|
|
56
|
+
"rest",
|
|
57
|
+
"pressed",
|
|
58
|
+
"disabled",
|
|
59
|
+
"readonly",
|
|
60
|
+
"invalid"
|
|
61
|
+
];
|
|
62
|
+
/**
|
|
63
|
+
* Converts a path array to a slash-separated key.
|
|
64
|
+
* e.g., ['button', 'variant', 'primary', 'root', 'rest'] → 'button/variant/primary/root/rest'
|
|
65
|
+
*
|
|
66
|
+
* This format is easier to work with in Reanimated worklets because variant names
|
|
67
|
+
* can be used directly without transformation (e.g., 'primary', 'alert-secondary').
|
|
68
|
+
*/
|
|
69
|
+
function toSlashKey(parts) {
|
|
70
|
+
return parts.join("/");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
export { MOBILE_STATES, PROPERTY_TO_RN_PROPS, SHADOW_PROPS, TEXT_ONLY_PROPS, toSlashKey };
|