@ankhorage/surface 8.0.0 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/{surfaceColor.d.ts → constants/surfaceColor.d.ts} +0 -4
- package/dist/constants/surfaceColor.d.ts.map +1 -0
- package/dist/constants/surfaceColor.js.map +1 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -1
- package/dist/features/app-bar/adapters/inbound/AppBar.js +1 -1
- package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -1
- package/dist/features/badge/adapters/inbound/Badge.d.ts.map +1 -1
- package/dist/features/badge/adapters/inbound/Badge.js +1 -1
- package/dist/features/badge/adapters/inbound/Badge.js.map +1 -1
- package/dist/features/button/adapters/inbound/Button.d.ts.map +1 -1
- package/dist/features/button/adapters/inbound/Button.js +1 -1
- package/dist/features/button/adapters/inbound/Button.js.map +1 -1
- package/dist/features/button/adapters/inbound/IconButton.d.ts.map +1 -1
- package/dist/features/button/adapters/inbound/IconButton.js +1 -1
- package/dist/features/button/adapters/inbound/IconButton.js.map +1 -1
- package/dist/features/card/adapters/inbound/Card.d.ts.map +1 -1
- package/dist/features/card/adapters/inbound/Card.js +1 -1
- package/dist/features/card/adapters/inbound/Card.js.map +1 -1
- package/dist/features/font/adapters/inbound/FontProvider.d.ts +4 -0
- package/dist/features/font/adapters/inbound/FontProvider.d.ts.map +1 -0
- package/dist/features/font/adapters/inbound/FontProvider.js +16 -0
- package/dist/features/font/adapters/inbound/FontProvider.js.map +1 -0
- package/dist/features/font/adapters/inbound/FontRuntimeContext.d.ts +4 -0
- package/dist/features/font/adapters/inbound/FontRuntimeContext.d.ts.map +1 -0
- package/dist/features/font/adapters/inbound/FontRuntimeContext.js +9 -0
- package/dist/features/font/adapters/inbound/FontRuntimeContext.js.map +1 -0
- package/dist/features/font/adapters/inbound/useFontRuntime.d.ts +4 -0
- package/dist/features/font/adapters/inbound/useFontRuntime.d.ts.map +1 -0
- package/dist/features/font/adapters/inbound/useFontRuntime.js +7 -0
- package/dist/features/font/adapters/inbound/useFontRuntime.js.map +1 -0
- package/dist/features/font/public.d.ts +3 -0
- package/dist/features/font/public.d.ts.map +1 -0
- package/dist/features/font/public.js +2 -0
- package/dist/features/font/public.js.map +1 -0
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.d.ts.map +1 -1
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +1 -1
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
- package/dist/features/form/radio/adapters/inbound/Radio.d.ts.map +1 -1
- package/dist/features/form/radio/adapters/inbound/Radio.js +1 -1
- package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
- package/dist/features/form/switch/adapters/inbound/Switch.d.ts.map +1 -1
- package/dist/features/form/switch/adapters/inbound/Switch.js +1 -1
- package/dist/features/form/switch/adapters/inbound/Switch.js.map +1 -1
- package/dist/features/form/text-input/adapters/inbound/TextInput.d.ts.map +1 -1
- package/dist/features/form/text-input/adapters/inbound/TextInput.js +1 -1
- package/dist/features/form/text-input/adapters/inbound/TextInput.js.map +1 -1
- package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts +1 -1
- package/dist/features/form/text-input/utils/resolveTextInputPresentation.d.ts.map +1 -1
- package/dist/features/form/text-input/utils/resolveTextInputPresentation.js.map +1 -1
- package/dist/features/icon/adapters/inbound/Icon.d.ts.map +1 -1
- package/dist/features/icon/adapters/inbound/Icon.js +2 -2
- package/dist/features/icon/adapters/inbound/Icon.js.map +1 -1
- package/dist/features/image/adapters/inbound/Image.d.ts.map +1 -1
- package/dist/features/image/adapters/inbound/Image.js +1 -1
- package/dist/features/image/adapters/inbound/Image.js.map +1 -1
- package/dist/features/image/utils/resolveImageStyle.d.ts +1 -1
- package/dist/features/image/utils/resolveImageStyle.d.ts.map +1 -1
- package/dist/features/image/utils/resolveImageStyle.js +1 -1
- package/dist/features/image/utils/resolveImageStyle.js.map +1 -1
- package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -1
- package/dist/features/layout/adapters/inbound/Grid.js +1 -1
- package/dist/features/layout/adapters/inbound/Grid.js.map +1 -1
- package/dist/features/layout/adapters/inbound/ScrollView.d.ts.map +1 -1
- package/dist/features/layout/adapters/inbound/ScrollView.js +1 -1
- package/dist/features/layout/adapters/inbound/ScrollView.js.map +1 -1
- package/dist/features/layout/adapters/inbound/View.d.ts.map +1 -1
- package/dist/features/layout/adapters/inbound/View.js +1 -1
- package/dist/features/layout/adapters/inbound/View.js.map +1 -1
- package/dist/features/list/adapters/inbound/ListItem.d.ts.map +1 -1
- package/dist/features/list/adapters/inbound/ListItem.js +1 -1
- package/dist/features/list/adapters/inbound/ListItem.js.map +1 -1
- package/dist/features/modal/adapters/inbound/Modal.d.ts.map +1 -1
- package/dist/features/modal/adapters/inbound/Modal.js +1 -1
- package/dist/features/modal/adapters/inbound/Modal.js.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -1
- package/dist/features/pressable/adapters/inbound/Pressable.d.ts.map +1 -1
- package/dist/features/pressable/adapters/inbound/Pressable.js +1 -1
- package/dist/features/pressable/adapters/inbound/Pressable.js.map +1 -1
- package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -1
- package/dist/features/surface/adapters/inbound/Surface.js +1 -1
- package/dist/features/surface/adapters/inbound/Surface.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tab.d.ts.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tab.js +1 -1
- package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -1
- package/dist/features/theme/adapters/inbound/ThemeProvider.d.ts +4 -0
- package/dist/features/theme/adapters/inbound/ThemeProvider.d.ts.map +1 -0
- package/dist/features/theme/adapters/inbound/ThemeProvider.js +27 -0
- package/dist/features/theme/adapters/inbound/ThemeProvider.js.map +1 -0
- package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.d.ts +4 -0
- package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.d.ts.map +1 -0
- package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.js +11 -0
- package/dist/features/theme/adapters/inbound/ThemeRuntimeContext.js.map +1 -0
- package/dist/features/theme/adapters/inbound/ThemeScope.d.ts +4 -0
- package/dist/features/theme/adapters/inbound/ThemeScope.d.ts.map +1 -0
- package/dist/features/theme/adapters/inbound/ThemeScope.js +17 -0
- package/dist/features/theme/adapters/inbound/ThemeScope.js.map +1 -0
- package/dist/features/theme/adapters/inbound/useTheme.d.ts +4 -0
- package/dist/features/theme/adapters/inbound/useTheme.d.ts.map +1 -0
- package/dist/features/theme/adapters/inbound/useTheme.js +7 -0
- package/dist/features/theme/adapters/inbound/useTheme.js.map +1 -0
- package/dist/features/theme/application/use-cases/createTheme.d.ts +5 -0
- package/dist/features/theme/application/use-cases/createTheme.d.ts.map +1 -0
- package/dist/features/theme/application/use-cases/createTheme.js +56 -0
- package/dist/features/theme/application/use-cases/createTheme.js.map +1 -0
- package/dist/features/theme/constants.d.ts +10 -0
- package/dist/features/theme/constants.d.ts.map +1 -0
- package/dist/{theme/defaultTokens.js → features/theme/constants.js} +9 -2
- package/dist/features/theme/constants.js.map +1 -0
- package/dist/{theme → features/theme/domain}/createSurfaceColorDiagnosticCollector.d.ts +1 -1
- package/dist/features/theme/domain/createSurfaceColorDiagnosticCollector.d.ts.map +1 -0
- package/dist/features/theme/domain/createSurfaceColorDiagnosticCollector.js.map +1 -0
- package/dist/{theme → features/theme/domain}/createSurfaceSemanticPolicy.d.ts +1 -1
- package/dist/features/theme/domain/createSurfaceSemanticPolicy.d.ts.map +1 -0
- package/dist/{theme → features/theme/domain}/createSurfaceSemanticPolicy.js +1 -1
- package/dist/features/theme/domain/createSurfaceSemanticPolicy.js.map +1 -0
- package/dist/features/theme/domain/generatePalette.d.ts +10 -0
- package/dist/features/theme/domain/generatePalette.d.ts.map +1 -0
- package/dist/{theme/colorEngine.js → features/theme/domain/generatePalette.js} +2 -10
- package/dist/features/theme/domain/generatePalette.js.map +1 -0
- package/dist/{theme → features/theme/domain}/resolveRoleSemantics.d.ts +1 -1
- package/dist/features/theme/domain/resolveRoleSemantics.d.ts.map +1 -0
- package/dist/{theme → features/theme/domain}/resolveRoleSemantics.js +1 -1
- package/dist/features/theme/domain/resolveRoleSemantics.js.map +1 -0
- package/dist/features/theme/domain/resolveSemanticColors.d.ts +4 -0
- package/dist/features/theme/domain/resolveSemanticColors.d.ts.map +1 -0
- package/dist/features/theme/domain/resolveSemanticColors.js +10 -0
- package/dist/features/theme/domain/resolveSemanticColors.js.map +1 -0
- package/dist/{theme → features/theme/domain}/resolveSurfaceSemanticModel.d.ts +1 -1
- package/dist/features/theme/domain/resolveSurfaceSemanticModel.d.ts.map +1 -0
- package/dist/features/theme/domain/resolveSurfaceSemanticModel.js.map +1 -0
- package/dist/features/theme/public.d.ts +3 -0
- package/dist/features/theme/public.d.ts.map +1 -0
- package/dist/features/theme/public.js +2 -0
- package/dist/features/theme/public.js.map +1 -0
- package/dist/features/theme/runtime.d.ts +5 -0
- package/dist/features/theme/runtime.d.ts.map +1 -0
- package/dist/features/theme/runtime.js +4 -0
- package/dist/features/theme/runtime.js.map +1 -0
- package/dist/{theme → features/theme/utils}/resolveGlobalTokens.d.ts +1 -1
- package/dist/features/theme/utils/resolveGlobalTokens.d.ts.map +1 -0
- package/dist/{theme → features/theme/utils}/resolveGlobalTokens.js +1 -1
- package/dist/features/theme/utils/resolveGlobalTokens.js.map +1 -0
- package/dist/{theme → features/theme/utils}/resolveHeadingTokenOverrides.d.ts +1 -1
- package/dist/features/theme/utils/resolveHeadingTokenOverrides.d.ts.map +1 -0
- package/dist/features/theme/utils/resolveHeadingTokenOverrides.js.map +1 -0
- package/dist/features/theme/utils/resolveNumericTokenOverrides.d.ts.map +1 -0
- package/dist/features/theme/utils/resolveNumericTokenOverrides.js.map +1 -0
- package/dist/{theme → features/theme/utils}/resolveToken.d.ts +2 -8
- package/dist/features/theme/utils/resolveToken.d.ts.map +1 -0
- package/dist/features/theme/utils/resolveToken.js +10 -0
- package/dist/features/theme/utils/resolveToken.js.map +1 -0
- package/dist/{theme → features/theme/utils}/resolveWeightTokenOverrides.d.ts +1 -1
- package/dist/features/theme/utils/resolveWeightTokenOverrides.d.ts.map +1 -0
- package/dist/{theme → features/theme/utils}/resolveWeightTokenOverrides.js +3 -5
- package/dist/features/theme/utils/resolveWeightTokenOverrides.js.map +1 -0
- package/dist/features/toast/adapters/inbound/Toast.d.ts.map +1 -1
- package/dist/features/toast/adapters/inbound/Toast.js +1 -1
- package/dist/features/toast/adapters/inbound/Toast.js.map +1 -1
- package/dist/features/tooltip/adapters/inbound/Tooltip.d.ts.map +1 -1
- package/dist/features/tooltip/adapters/inbound/Tooltip.js +1 -1
- package/dist/features/tooltip/adapters/inbound/Tooltip.js.map +1 -1
- package/dist/features/typography/adapters/inbound/Heading.d.ts +2 -2
- package/dist/features/typography/adapters/inbound/Heading.d.ts.map +1 -1
- package/dist/features/typography/adapters/inbound/Heading.js +4 -20
- package/dist/features/typography/adapters/inbound/Heading.js.map +1 -1
- package/dist/features/typography/adapters/inbound/Text.d.ts +1 -1
- package/dist/features/typography/adapters/inbound/Text.d.ts.map +1 -1
- package/dist/features/typography/adapters/inbound/Text.js +3 -20
- package/dist/features/typography/adapters/inbound/Text.js.map +1 -1
- package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts +2 -2
- package/dist/features/typography/utils/resolveHeadingTextStyle.d.ts.map +1 -1
- package/dist/features/typography/utils/resolveHeadingTextStyle.js.map +1 -1
- package/dist/index.d.ts +9 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/resolvers/resolveControlSize.d.ts +1 -1
- package/dist/internal/resolvers/resolveControlSize.js.map +1 -1
- package/dist/internal/resolvers/resolveFieldPresentation.d.ts +1 -1
- package/dist/internal/resolvers/resolveFieldPresentation.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveFieldPresentation.js.map +1 -1
- package/dist/internal/resolvers/resolveIconSize.d.ts +1 -1
- package/dist/internal/resolvers/resolveIconSize.js.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts +2 -2
- package/dist/internal/resolvers/resolveInteractiveColors.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveInteractiveColors.js.map +1 -1
- package/dist/internal/resolvers/resolveSelectionControlColors.d.ts +2 -2
- package/dist/internal/resolvers/resolveSelectionControlColors.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveSelectionControlColors.js.map +1 -1
- package/dist/internal/resolvers/resolveSurfaceColor.d.ts +2 -2
- package/dist/internal/resolvers/resolveSurfaceColor.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveSurfaceColor.js.map +1 -1
- package/dist/internal/resolvers/resolveTextColor.d.ts +2 -2
- package/dist/internal/resolvers/resolveTextColor.d.ts.map +1 -1
- package/dist/internal/resolvers/resolveTextColor.js.map +1 -1
- package/dist/internal/resolvers/resolveTextStyles.d.ts +1 -1
- package/dist/internal/resolvers/resolveTextStyles.js.map +1 -1
- package/dist/types/accordion.d.ts +1 -1
- package/dist/types/accordion.d.ts.map +1 -1
- package/dist/types/accordion.js.map +1 -1
- package/dist/types/badge.d.ts +1 -1
- package/dist/types/badge.d.ts.map +1 -1
- package/dist/types/badge.js.map +1 -1
- package/dist/types/button.d.ts +1 -1
- package/dist/types/button.d.ts.map +1 -1
- package/dist/types/button.js.map +1 -1
- package/dist/types/checkbox.d.ts +1 -1
- package/dist/types/checkbox.d.ts.map +1 -1
- package/dist/types/checkbox.js.map +1 -1
- package/dist/types/font.d.ts +13 -0
- package/dist/types/font.d.ts.map +1 -0
- package/dist/types/font.js +2 -0
- package/dist/types/font.js.map +1 -0
- package/dist/types/icon.d.ts +1 -1
- package/dist/types/icon.d.ts.map +1 -1
- package/dist/types/icon.js.map +1 -1
- package/dist/types/image.d.ts +1 -1
- package/dist/types/image.d.ts.map +1 -1
- package/dist/types/image.js.map +1 -1
- package/dist/types/interactionPolicy.d.ts.map +1 -0
- package/dist/types/interactionPolicy.js.map +1 -0
- package/dist/types/layout.d.ts +1 -1
- package/dist/types/layout.d.ts.map +1 -1
- package/dist/types/layout.js.map +1 -1
- package/dist/types/list.d.ts +1 -1
- package/dist/types/list.d.ts.map +1 -1
- package/dist/types/list.js.map +1 -1
- package/dist/types/modal.d.ts +1 -1
- package/dist/types/modal.d.ts.map +1 -1
- package/dist/types/modal.js.map +1 -1
- package/dist/types/popover.d.ts +1 -1
- package/dist/types/popover.d.ts.map +1 -1
- package/dist/types/popover.js.map +1 -1
- package/dist/types/popoverMenu.d.ts +1 -1
- package/dist/types/popoverMenu.d.ts.map +1 -1
- package/dist/types/popoverMenu.js.map +1 -1
- package/dist/types/pressable.d.ts +1 -1
- package/dist/types/pressable.d.ts.map +1 -1
- package/dist/types/pressable.js.map +1 -1
- package/dist/types/radio.d.ts +1 -1
- package/dist/types/radio.d.ts.map +1 -1
- package/dist/types/radio.js.map +1 -1
- package/dist/types/surfaceColor.d.ts +6 -0
- package/dist/types/surfaceColor.d.ts.map +1 -0
- package/dist/types/surfaceColor.js +2 -0
- package/dist/types/surfaceColor.js.map +1 -0
- package/dist/types/switch.d.ts +1 -1
- package/dist/types/switch.d.ts.map +1 -1
- package/dist/types/switch.js.map +1 -1
- package/dist/types/tabs.d.ts +1 -1
- package/dist/types/tabs.d.ts.map +1 -1
- package/dist/types/tabs.js.map +1 -1
- package/dist/types/text-input.d.ts +1 -1
- package/dist/types/text-input.d.ts.map +1 -1
- package/dist/types/text-input.js.map +1 -1
- package/dist/{theme/types.d.ts → types/theme.d.ts} +19 -3
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/theme.js +2 -0
- package/dist/types/theme.js.map +1 -0
- package/dist/types/toast.d.ts +2 -2
- package/dist/types/toast.d.ts.map +1 -1
- package/dist/types/toast.js.map +1 -1
- package/dist/types/tooltip.d.ts +1 -1
- package/dist/types/tooltip.d.ts.map +1 -1
- package/dist/types/tooltip.js.map +1 -1
- package/dist/types/typography.d.ts +1 -1
- package/dist/types/typography.d.ts.map +1 -1
- package/dist/types/typography.js.map +1 -1
- package/dist/utils/resolveSpacing.d.ts +1 -1
- package/dist/utils/resolveSpacing.d.ts.map +1 -1
- package/dist/utils/resolveSpacing.js +1 -1
- package/dist/utils/resolveSpacing.js.map +1 -1
- package/dist/utils/resolveViewStyles.d.ts +1 -1
- package/dist/utils/resolveViewStyles.d.ts.map +1 -1
- package/dist/utils/resolveViewStyles.js +1 -1
- package/dist/utils/resolveViewStyles.js.map +1 -1
- package/package.json +16 -7
- package/src/constants/surfaceColor.public.test.ts +34 -0
- package/src/constants/surfaceColor.test.ts +18 -0
- package/src/{surfaceColor.ts → constants/surfaceColor.ts} +0 -5
- package/src/features/app-bar/adapters/inbound/AppBar.tsx +1 -1
- package/src/features/badge/adapters/inbound/Badge.tsx +1 -1
- package/src/features/button/adapters/inbound/Button.tsx +2 -2
- package/src/features/button/adapters/inbound/IconButton.tsx +1 -1
- package/src/features/card/adapters/inbound/Card.tsx +1 -1
- package/src/features/font/adapters/inbound/FontProvider.tsx +27 -0
- package/src/features/font/adapters/inbound/FontRuntimeContext.tsx +12 -0
- package/src/features/font/adapters/inbound/useFontRuntime.ts +9 -0
- package/src/features/font/public.ts +2 -0
- package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +2 -2
- package/src/features/form/radio/adapters/inbound/Radio.tsx +2 -2
- package/src/features/form/switch/adapters/inbound/Switch.tsx +1 -1
- package/src/features/form/text-input/adapters/inbound/TextInput.tsx +1 -1
- package/src/features/form/text-input/utils/resolveTextInputPresentation.ts +1 -1
- package/src/features/icon/adapters/inbound/Icon.tsx +2 -2
- package/src/features/image/adapters/inbound/Image.tsx +1 -1
- package/src/features/image/utils/resolveImageProps.test.ts +1 -1
- package/src/features/image/utils/resolveImageStyle.ts +2 -2
- package/src/features/layout/adapters/inbound/Grid.tsx +1 -1
- package/src/features/layout/adapters/inbound/ScrollView.tsx +1 -1
- package/src/features/layout/adapters/inbound/View.tsx +1 -1
- package/src/features/list/adapters/inbound/ListItem.tsx +2 -2
- package/src/features/modal/adapters/inbound/Modal.tsx +1 -1
- package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +1 -1
- package/src/features/pressable/adapters/inbound/Pressable.tsx +1 -1
- package/src/features/surface/adapters/inbound/Surface.tsx +1 -1
- package/src/features/tabs/adapters/inbound/Tab.tsx +1 -1
- package/src/features/theme/adapters/inbound/ThemeProvider.tsx +46 -0
- package/src/features/theme/adapters/inbound/ThemeRuntimeContext.tsx +14 -0
- package/src/features/theme/adapters/inbound/ThemeScope.test.tsx +52 -0
- package/src/features/theme/adapters/inbound/ThemeScope.tsx +29 -0
- package/src/features/theme/adapters/inbound/useTheme.ts +9 -0
- package/src/features/theme/application/use-cases/createTheme.ts +71 -0
- package/src/{theme → features/theme/application/use-cases}/createThemeOverrides.test.ts +8 -9
- package/src/{theme → features/theme/application/use-cases}/createThemeValidation.test.ts +4 -2
- package/src/features/theme/constants.ts +68 -0
- package/src/{theme → features/theme/domain}/createSurfaceColorDiagnosticCollector.ts +4 -1
- package/src/{theme → features/theme/domain}/createSurfaceSemanticPolicy.ts +2 -2
- package/src/features/theme/domain/generatePalette.test.ts +294 -0
- package/src/{theme/colorEngine.ts → features/theme/domain/generatePalette.ts} +3 -30
- package/src/{theme → features/theme/domain}/inverseSemantics.test.ts +1 -1
- package/src/{theme → features/theme/domain}/resolveRoleSemantics.ts +2 -2
- package/src/features/theme/domain/resolveSemanticColors.ts +23 -0
- package/src/{theme → features/theme/domain}/resolveSurfaceSemanticModel.ts +4 -4
- package/src/{theme → features/theme}/public.test.ts +1 -1
- package/src/features/theme/public.ts +18 -0
- package/src/features/theme/runtime.test.ts +13 -0
- package/src/features/theme/runtime.ts +4 -0
- package/src/{theme → features/theme/utils}/resolveGlobalTokens.ts +2 -2
- package/src/{theme → features/theme/utils}/resolveHeadingTokenOverrides.ts +1 -1
- package/src/features/theme/utils/resolveToken.ts +16 -0
- package/src/{theme → features/theme/utils}/resolveWeightTokenOverrides.ts +12 -12
- package/src/features/toast/adapters/inbound/Toast.tsx +3 -3
- package/src/features/tooltip/adapters/inbound/Tooltip.tsx +1 -1
- package/src/features/typography/adapters/inbound/Heading.tsx +3 -30
- package/src/features/typography/adapters/inbound/Text.tsx +3 -23
- package/src/features/typography/utils/resolveHeadingTextStyle.test.ts +1 -1
- package/src/features/typography/utils/resolveHeadingTextStyle.ts +2 -2
- package/src/index.test.ts +19 -9
- package/src/index.ts +30 -15
- package/src/internal/resolvers/resolveControlSize.test.ts +1 -1
- package/src/internal/resolvers/resolveControlSize.ts +1 -1
- package/src/internal/resolvers/resolveFieldPresentation.ts +1 -1
- package/src/internal/resolvers/resolveIconSize.ts +1 -1
- package/src/internal/resolvers/resolveInteractiveColors.test.ts +1 -1
- package/src/internal/resolvers/resolveInteractiveColors.ts +2 -2
- package/src/internal/resolvers/resolveSelectionControlColors.test.ts +1 -1
- package/src/internal/resolvers/resolveSelectionControlColors.ts +2 -2
- package/src/internal/resolvers/resolveSurfaceColor.test.ts +1 -1
- package/src/internal/resolvers/resolveSurfaceColor.ts +2 -2
- package/src/internal/resolvers/resolveTextColor.test.ts +1 -1
- package/src/internal/resolvers/resolveTextColor.ts +2 -2
- package/src/internal/resolvers/resolveTextStyles.test.ts +1 -1
- package/src/internal/resolvers/resolveTextStyles.ts +1 -1
- package/src/structureOwnership.test.ts +16 -0
- package/src/types/accordion.ts +1 -1
- package/src/types/badge.ts +1 -1
- package/src/types/button.ts +1 -1
- package/src/types/checkbox.ts +1 -1
- package/src/types/font.ts +14 -0
- package/src/types/icon.ts +1 -1
- package/src/types/image.ts +1 -1
- package/src/types/interactionPolicy.test.ts +30 -0
- package/src/types/layout.ts +1 -1
- package/src/types/list.ts +1 -1
- package/src/types/modal.ts +1 -1
- package/src/types/popover.ts +1 -1
- package/src/types/popoverMenu.ts +1 -1
- package/src/types/pressable.ts +1 -1
- package/src/types/radio.ts +1 -1
- package/src/types/surfaceColor.test.ts +18 -0
- package/src/types/surfaceColor.ts +11 -0
- package/src/types/switch.ts +1 -1
- package/src/types/tabs.ts +1 -1
- package/src/types/text-input.ts +1 -1
- package/src/{theme/types.ts → types/theme.ts} +22 -13
- package/src/types/toast.ts +2 -2
- package/src/types/tooltip.ts +1 -1
- package/src/types/typography.ts +1 -1
- package/src/utils/resolveSpacing.ts +2 -2
- package/src/utils/resolveViewStyles.test.ts +1 -1
- package/src/utils/resolveViewStyles.ts +2 -2
- package/src/webAcceptance.test.tsx +1 -1
- package/dist/context/FontContext.d.ts +0 -20
- package/dist/context/FontContext.d.ts.map +0 -1
- package/dist/context/FontContext.js +0 -27
- package/dist/context/FontContext.js.map +0 -1
- package/dist/context/TranslationContext.d.ts +0 -22
- package/dist/context/TranslationContext.d.ts.map +0 -1
- package/dist/context/TranslationContext.js +0 -25
- package/dist/context/TranslationContext.js.map +0 -1
- package/dist/interactionPolicy.d.ts.map +0 -1
- package/dist/interactionPolicy.js.map +0 -1
- package/dist/surfaceColor.d.ts.map +0 -1
- package/dist/surfaceColor.js.map +0 -1
- package/dist/theme/ThemeContext.d.ts +0 -27
- package/dist/theme/ThemeContext.d.ts.map +0 -1
- package/dist/theme/ThemeContext.js +0 -59
- package/dist/theme/ThemeContext.js.map +0 -1
- package/dist/theme/colorEngine.d.ts +0 -16
- package/dist/theme/colorEngine.d.ts.map +0 -1
- package/dist/theme/colorEngine.js.map +0 -1
- package/dist/theme/createSurfaceColorDiagnosticCollector.d.ts.map +0 -1
- package/dist/theme/createSurfaceColorDiagnosticCollector.js.map +0 -1
- package/dist/theme/createSurfaceSemanticPolicy.d.ts.map +0 -1
- package/dist/theme/createSurfaceSemanticPolicy.js.map +0 -1
- package/dist/theme/createTheme.d.ts +0 -5
- package/dist/theme/createTheme.d.ts.map +0 -1
- package/dist/theme/createTheme.js +0 -49
- package/dist/theme/createTheme.js.map +0 -1
- package/dist/theme/defaultTokens.d.ts +0 -3
- package/dist/theme/defaultTokens.d.ts.map +0 -1
- package/dist/theme/defaultTokens.js.map +0 -1
- package/dist/theme/index.d.ts +0 -3
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/index.js +0 -3
- package/dist/theme/index.js.map +0 -1
- package/dist/theme/public.d.ts +0 -5
- package/dist/theme/public.d.ts.map +0 -1
- package/dist/theme/public.js +0 -5
- package/dist/theme/public.js.map +0 -1
- package/dist/theme/resolveGlobalTokens.d.ts.map +0 -1
- package/dist/theme/resolveGlobalTokens.js.map +0 -1
- package/dist/theme/resolveHeadingTokenOverrides.d.ts.map +0 -1
- package/dist/theme/resolveHeadingTokenOverrides.js.map +0 -1
- package/dist/theme/resolveNumericTokenOverrides.d.ts.map +0 -1
- package/dist/theme/resolveNumericTokenOverrides.js.map +0 -1
- package/dist/theme/resolveRoleSemantics.d.ts.map +0 -1
- package/dist/theme/resolveRoleSemantics.js.map +0 -1
- package/dist/theme/resolveSurfaceSemanticModel.d.ts.map +0 -1
- package/dist/theme/resolveSurfaceSemanticModel.js.map +0 -1
- package/dist/theme/resolveToken.d.ts.map +0 -1
- package/dist/theme/resolveToken.js +0 -19
- package/dist/theme/resolveToken.js.map +0 -1
- package/dist/theme/resolveWeightTokenOverrides.d.ts.map +0 -1
- package/dist/theme/resolveWeightTokenOverrides.js.map +0 -1
- package/dist/theme/surfaceColorPolicy.d.ts +0 -8
- package/dist/theme/surfaceColorPolicy.d.ts.map +0 -1
- package/dist/theme/surfaceColorPolicy.js +0 -8
- package/dist/theme/surfaceColorPolicy.js.map +0 -1
- package/dist/theme/types.d.ts.map +0 -1
- package/dist/theme/types.js +0 -2
- package/dist/theme/types.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -6
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js +0 -36
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/deepMerge.d.ts +0 -6
- package/dist/utils/deepMerge.d.ts.map +0 -1
- package/dist/utils/deepMerge.js +0 -26
- package/dist/utils/deepMerge.js.map +0 -1
- package/src/context/FontContext.tsx +0 -59
- package/src/context/TranslationContext.tsx +0 -50
- package/src/interactionPolicy.test.ts +0 -86
- package/src/surfaceColor.test.ts +0 -44
- package/src/theme/ThemeContext.tsx +0 -94
- package/src/theme/colorEngine.test.ts +0 -302
- package/src/theme/createTheme.ts +0 -60
- package/src/theme/defaultTokens.ts +0 -61
- package/src/theme/index.ts +0 -2
- package/src/theme/public.ts +0 -4
- package/src/theme/resolveToken.ts +0 -32
- package/src/theme/surfaceColorPolicy.ts +0 -7
- package/src/utils/deepEqual.ts +0 -34
- package/src/utils/deepMerge.test.ts +0 -113
- package/src/utils/deepMerge.ts +0 -29
- /package/dist/{surfaceColor.js → constants/surfaceColor.js} +0 -0
- /package/dist/{theme → features/theme/domain}/createSurfaceColorDiagnosticCollector.js +0 -0
- /package/dist/{theme → features/theme/domain}/resolveSurfaceSemanticModel.js +0 -0
- /package/dist/{theme → features/theme/utils}/resolveHeadingTokenOverrides.js +0 -0
- /package/dist/{theme → features/theme/utils}/resolveNumericTokenOverrides.d.ts +0 -0
- /package/dist/{theme → features/theme/utils}/resolveNumericTokenOverrides.js +0 -0
- /package/dist/{interactionPolicy.d.ts → types/interactionPolicy.d.ts} +0 -0
- /package/dist/{interactionPolicy.js → types/interactionPolicy.js} +0 -0
- /package/src/{theme → features/theme/utils}/resolveNumericTokenOverrides.ts +0 -0
- /package/src/{interactionPolicy.ts → types/interactionPolicy.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.js","sourceRoot":"","sources":["../../../../../src/features/pressable/adapters/inbound/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,SAAS,IAAI,oBAAoB,GAElC,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AAO,EAAE,QAAQ,CAAC,CAAC;YAClF,OAAO,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACrE,CAAC,CACH;IAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,SAAS,oBAAoB,CAC3B,iBAAsD,EACtD,OAAkC,EAClC,WAA0C;IAE1C,OAAO,iBAAiB,KAAK,SAAS;QACpC,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE;QAChD,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC;AAED,yFAAyF;AACzF,SAAS,uBAAuB,CAC9B,cAA0C,EAC1C,OAAgB,EAChB,OAAgB,EAChB,QAAiB;IAEjB,OAAO,uBAAuB,CAAC;QAC7B,OAAO,EAAE,cAAc,CAAC,OAAO;QAC/B,OAAO;QACP,OAAO;QACP,QAAQ;KACT,CAAC,CAAC;AACL,CAAC","sourcesContent":["import React from 'react';\nimport {\n Platform,\n Pressable as ReactNativePressable,\n type PressableStateCallbackType,\n} from 'react-native';\n\nimport { useResponsiveRuntime } from '../../../../core/responsive';\nimport {\n type InteractionState,\n resolveFocusRingStyles,\n resolveInteractiveState,\n} from '../../../../internal/resolvers';\nimport type { PressableProps } from '../../../../types/pressable';\nimport { resolveViewStyles } from '../../../../utils/resolveViewStyles';\nimport { useTheme } from '../../../theme/runtime';\n\n/*** Renders the token-aware Surface adapter for React Native Pressable. */\nexport function Pressable({\n children,\n disabled = false,\n interactionPolicy = 'enabled',\n onPress,\n onLongPress,\n accessibilityLabel,\n accessibilityRole = 'button',\n accessibilityState,\n style,\n testID,\n ...props\n}: PressableProps) {\n const { theme } = useTheme();\n const { breakpoint } = useResponsiveRuntime();\n const [hovered, setHovered] = React.useState(false);\n const [focused, setFocused] = React.useState(false);\n const isWeb = Platform.OS === 'web';\n const resolvedViewStyles = resolveViewStyles(theme, breakpoint, props);\n const pressHandlers = resolvePressHandlers(interactionPolicy, onPress, onLongPress);\n\n return (\n <ReactNativePressable\n {...pressHandlers}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole={accessibilityRole}\n accessibilityState={{ ...accessibilityState, disabled }}\n disabled={disabled}\n onBlur={() => setFocused(false)}\n onFocus={() => {\n if (isWeb) setFocused(true);\n }}\n onHoverIn={isWeb ? () => setHovered(true) : undefined}\n onHoverOut={isWeb ? () => setHovered(false) : undefined}\n style={(pressableState) => {\n const state = resolveInteractionState(pressableState, hovered, focused, disabled);\n return [\n resolvedViewStyles,\n resolveFocusRingStyles(theme.semantics.border.focus, state.focused, isWeb),\n style,\n ];\n }}\n testID={testID}\n >\n {(pressableState) => {\n const state = resolveInteractionState(pressableState, hovered, focused, disabled);\n return typeof children === 'function' ? children(state) : children;\n }}\n </ReactNativePressable>\n );\n}\n\n/*** Resolves press handlers according to the shared interaction policy. */\nfunction resolvePressHandlers(\n interactionPolicy: PressableProps['interactionPolicy'],\n onPress: PressableProps['onPress'],\n onLongPress: PressableProps['onLongPress'],\n) {\n return interactionPolicy === 'passive'\n ? { onLongPress: undefined, onPress: undefined }\n : { onLongPress, onPress };\n}\n\n/*** Resolves one native Pressable state into the canonical Surface interaction state. */\nfunction resolveInteractionState(\n pressableState: PressableStateCallbackType,\n hovered: boolean,\n focused: boolean,\n disabled: boolean,\n): InteractionState {\n return resolveInteractiveState({\n pressed: pressableState.pressed,\n hovered,\n focused,\n disabled,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/features/surface/adapters/inbound/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/features/surface/adapters/inbound/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;AAI9E,qFAAqF;AACrF,wBAAgB,OAAO,CAAC,EAAE,OAAmB,EAAE,MAAY,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,qBAiB3F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useTheme } from '../../../../theme/ThemeContext';
|
|
3
2
|
import { View } from '../../../layout/public';
|
|
3
|
+
import { useTheme } from '../../../theme/runtime';
|
|
4
4
|
/*** Renders a themed content surface with semantic elevation and border variants. */
|
|
5
5
|
export function Surface({ variant = 'default', radius = 'm', style, ...props }) {
|
|
6
6
|
const { theme } = useTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.js","sourceRoot":"","sources":["../../../../../src/features/surface/adapters/inbound/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Surface.js","sourceRoot":"","sources":["../../../../../src/features/surface/adapters/inbound/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,qFAAqF;AACrF,MAAM,UAAU,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,MAAM,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,EAAgB;IAC1F,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,eAAe,GACnB,OAAO,KAAK,QAAQ;QAClB,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM;QAChC,CAAC,CAAC,OAAO,KAAK,QAAQ;YACpB,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM;YAChC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;IACxC,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;IAEnD,OAAO,CACL,CAAC,IAAI,CACH,IAAI,KAAK,CAAC,CACV,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC,CAAC,2BAA2B,CAAC,OAAO,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC,EACnF,CACH,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,SAAS,2BAA2B,CAClC,OAAuB,EACvB,WAAmB,EACnB,eAAuB;IAEvB,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,QAAQ;YACX,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;QACzE,KAAK,QAAQ;YACX,OAAO;gBACL,eAAe;gBACf,WAAW,EAAE,aAAa;gBAC1B,WAAW,EAAE,CAAC;gBACd,SAAS,EAAE,CAAC;gBACZ,WAAW,EAAE,SAAS;gBACtB,aAAa,EAAE,IAAI;gBACnB,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;gBACrC,YAAY,EAAE,CAAC;aAChB,CAAC;QACJ,KAAK,SAAS;YACZ,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;QACzE,KAAK,SAAS;YACZ,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;IAC5D,CAAC;AACH,CAAC","sourcesContent":["import React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport type { SurfaceProps, SurfaceVariant } from '../../../../types/surface';\nimport { View } from '../../../layout/public';\nimport { useTheme } from '../../../theme/runtime';\n\n/*** Renders a themed content surface with semantic elevation and border variants. */\nexport function Surface({ variant = 'default', radius = 'm', style, ...props }: SurfaceProps) {\n const { theme } = useTheme();\n const backgroundColor =\n variant === 'subtle'\n ? theme.semantics.surface.subtle\n : variant === 'raised'\n ? theme.semantics.surface.raised\n : theme.semantics.surface.default;\n const borderColor = theme.semantics.border.default;\n\n return (\n <View\n {...props}\n radius={radius}\n style={[resolveSurfaceVariantStyles(variant, borderColor, backgroundColor), style]}\n />\n );\n}\n\n/*** Resolves the semantic visual treatment for one Surface variant. */\nfunction resolveSurfaceVariantStyles(\n variant: SurfaceVariant,\n borderColor: string,\n backgroundColor: string,\n): ViewStyle {\n switch (variant) {\n case 'subtle':\n return { backgroundColor, borderColor: 'transparent', borderWidth: 0 };\n case 'raised':\n return {\n backgroundColor,\n borderColor: 'transparent',\n borderWidth: 0,\n elevation: 2,\n shadowColor: '#000000',\n shadowOpacity: 0.08,\n shadowOffset: { width: 0, height: 2 },\n shadowRadius: 8,\n };\n case 'outline':\n return { backgroundColor: 'transparent', borderColor, borderWidth: 1 };\n case 'default':\n return { backgroundColor, borderColor, borderWidth: 1 };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAOvD,oEAAoE;AACpE,wBAAgB,GAAG,CAAC,EAClB,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,iBAA6B,EAC7B,MAAM,GACP,EAAE,QAAQ,qBAsCV"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
|
-
import { useTheme } from '../../../../theme/ThemeContext';
|
|
4
3
|
import { View } from '../../../layout/public';
|
|
4
|
+
import { useTheme } from '../../../theme/runtime';
|
|
5
5
|
import { Text } from '../../../typography/public';
|
|
6
6
|
import { useTabRegistration } from '../../composition/useTabRegistration';
|
|
7
7
|
import { useTabsContext } from '../../composition/useTabsContext';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAC;AAGzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,oEAAoE;AACpE,MAAM,UAAU,GAAG,CAAC,EAClB,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,iBAAiB,GAAG,SAAS,EAC7B,MAAM,GACG;IACT,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,cAAc,EAAE,CAAC;IAChG,MAA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,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAC5E;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC;AAED,4EAA4E;AAC5E,SAAS,eAAe,CAAC,EACvB,WAAW,EACX,QAAQ,GAIT;IACC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChG,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, type ViewStyle } from 'react-native';\n\nimport type { TabProps } from '../../../../types/tabs';\nimport { View } from '../../../layout/public';\nimport { useTheme } from '../../../theme/runtime';\nimport { Text } from '../../../typography/public';\nimport { useTabRegistration } from '../../composition/useTabRegistration';\nimport { useTabsContext } from '../../composition/useTabsContext';\n\n/*** Renders one accessible selectable tab inside a Tabs context. */\nexport function Tab({\n value,\n children,\n disabled = false,\n interactionPolicy = 'enabled',\n testID,\n}: TabProps) {\n const { theme } = useTheme();\n const { activeValue, getPanelId, getTabId, setActiveValue, setFocusedValue } = useTabsContext();\n const pressableRef = useTabRegistration({ disabled, value });\n const selected = activeValue === value;\n const passive = interactionPolicy === 'passive';\n const onPress = passive || disabled ? undefined : () => setActiveValue(value);\n\n return (\n <Pressable\n accessibilityLabel={undefined}\n accessibilityRole=\"tab\"\n accessibilityState={{ disabled, selected }}\n aria-controls={getPanelId(value)}\n disabled={disabled}\n nativeID={getTabId(value)}\n onBlur={() => setFocusedValue(undefined)}\n onFocus={() => setFocusedValue(value)}\n onPress={onPress}\n ref={pressableRef}\n testID={testID}\n >\n <View\n px=\"m\"\n py=\"s\"\n style={resolveTabStyle({\n borderColor: selected\n ? theme.semantics.action.primary.base\n : theme.semantics.border.default,\n disabled,\n })}\n >\n <Text color={selected ? 'primary' : undefined} variant=\"label\" weight=\"medium\">\n {children}\n </Text>\n </View>\n </Pressable>\n );\n}\n\n/*** Resolves active and disabled visual state without inline JSX styles. */\nfunction resolveTabStyle({\n borderColor,\n disabled,\n}: {\n borderColor: string;\n disabled: boolean;\n}): ViewStyle {\n return { borderBottomColor: borderColor, borderBottomWidth: 2, opacity: disabled ? 0.64 : 1 };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ThemeProviderProps } from '../../../../types/theme';
|
|
2
|
+
/*** Install the app-level Surface theme together with global responsive and overlay runtime. */
|
|
3
|
+
export declare function ThemeProvider({ children, initialConfig, initialMode, }: ThemeProviderProps): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../../src/features/theme/adapters/inbound/ThemeProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,yBAAyB,CAAC;AAKhF,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAa,EACb,WAAqB,GACtB,EAAE,kBAAkB,+BA6BpB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { deepMerge } from '@ankhorage/utility/object';
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { ResponsiveProvider } from '../../../../core/responsive/ResponsiveProvider';
|
|
4
|
+
import { OverlayProvider } from '../../../../internal/overlay/OverlayProvider';
|
|
5
|
+
import { useFontRuntime } from '../../../font/adapters/inbound/useFontRuntime';
|
|
6
|
+
import { createTheme } from '../../application/use-cases/createTheme';
|
|
7
|
+
import { ThemeRuntimeContext } from './ThemeRuntimeContext';
|
|
8
|
+
/*** Install the app-level Surface theme together with global responsive and overlay runtime. */
|
|
9
|
+
export function ThemeProvider({ children, initialConfig, initialMode = 'light', }) {
|
|
10
|
+
const defaultTheme = useMemo(() => createTheme(), []);
|
|
11
|
+
const [config, setConfig] = useState(() => initialConfig ? deepMerge(defaultTheme.config, initialConfig) : defaultTheme.config);
|
|
12
|
+
const [mode, setMode] = useState(initialMode);
|
|
13
|
+
const { activeFontId } = useFontRuntime();
|
|
14
|
+
const theme = useMemo(() => createTheme(config, mode, activeFontId), [activeFontId, config, mode]);
|
|
15
|
+
const value = useMemo(() => ({
|
|
16
|
+
theme,
|
|
17
|
+
mode,
|
|
18
|
+
setThemeConfig: (nextConfig) => setConfig((previous) => deepMerge(previous, nextConfig)),
|
|
19
|
+
setMode,
|
|
20
|
+
}), [mode, theme]);
|
|
21
|
+
return (<ResponsiveProvider>
|
|
22
|
+
<ThemeRuntimeContext value={value}>
|
|
23
|
+
<OverlayProvider>{children}</OverlayProvider>
|
|
24
|
+
</ThemeRuntimeContext>
|
|
25
|
+
</ResponsiveProvider>);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../../../../src/features/theme/adapters/inbound/ThemeProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,gGAAgG;AAChG,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAa,EACb,WAAW,GAAG,OAAO,GACF;IACnB,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAc,GAAG,EAAE,CACrD,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CACpF,CAAC;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,CAAC;IAE1C,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,EAC7C,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,CAC7B,CAAC;IACF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,KAAK;QACL,IAAI;QACJ,cAAc,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACxF,OAAO;KACR,CAAC,EACF,CAAC,IAAI,EAAE,KAAK,CAAC,CACd,CAAC;IAEF,OAAO,CACL,CAAC,kBAAkB,CACjB;MAAA,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAChC;QAAA,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,EAAE,eAAe,CAC9C;MAAA,EAAE,mBAAmB,CACvB;IAAA,EAAE,kBAAkB,CAAC,CACtB,CAAC;AACJ,CAAC","sourcesContent":["import type { ThemeConfig } from '@ankhorage/contracts';\nimport { deepMerge } from '@ankhorage/utility/object';\nimport { useMemo, useState } from 'react';\n\nimport { ResponsiveProvider } from '../../../../core/responsive/ResponsiveProvider';\nimport { OverlayProvider } from '../../../../internal/overlay/OverlayProvider';\nimport type { ThemeProviderProps, ThemeRuntime } from '../../../../types/theme';\nimport { useFontRuntime } from '../../../font/adapters/inbound/useFontRuntime';\nimport { createTheme } from '../../application/use-cases/createTheme';\nimport { ThemeRuntimeContext } from './ThemeRuntimeContext';\n\n/*** Install the app-level Surface theme together with global responsive and overlay runtime. */\nexport function ThemeProvider({\n children,\n initialConfig,\n initialMode = 'light',\n}: ThemeProviderProps) {\n const defaultTheme = useMemo(() => createTheme(), []);\n const [config, setConfig] = useState<ThemeConfig>(() =>\n initialConfig ? deepMerge(defaultTheme.config, initialConfig) : defaultTheme.config,\n );\n const [mode, setMode] = useState(initialMode);\n const { activeFontId } = useFontRuntime();\n\n const theme = useMemo(\n () => createTheme(config, mode, activeFontId),\n [activeFontId, config, mode],\n );\n const value = useMemo<ThemeRuntime>(\n () => ({\n theme,\n mode,\n setThemeConfig: (nextConfig) => setConfig((previous) => deepMerge(previous, nextConfig)),\n setMode,\n }),\n [mode, theme],\n );\n\n return (\n <ResponsiveProvider>\n <ThemeRuntimeContext value={value}>\n <OverlayProvider>{children}</OverlayProvider>\n </ThemeRuntimeContext>\n </ResponsiveProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeRuntimeContext.d.ts","sourceRoot":"","sources":["../../../../../src/features/theme/adapters/inbound/ThemeRuntimeContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAK5D,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,uCAK9B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
import { createTheme } from '../../application/use-cases/createTheme';
|
|
3
|
+
const defaultTheme = createTheme();
|
|
4
|
+
/*** Holds the active Surface theme runtime for component consumption. */
|
|
5
|
+
export const ThemeRuntimeContext = createContext({
|
|
6
|
+
theme: defaultTheme,
|
|
7
|
+
mode: 'light',
|
|
8
|
+
setThemeConfig: () => undefined,
|
|
9
|
+
setMode: () => undefined,
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=ThemeRuntimeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeRuntimeContext.js","sourceRoot":"","sources":["../../../../../src/features/theme/adapters/inbound/ThemeRuntimeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,MAAM,YAAY,GAAG,WAAW,EAAE,CAAC;AAEnC,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAe;IAC7D,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,OAAO;IACb,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS;IAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;CACzB,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport type { ThemeRuntime } from '../../../../types/theme';\nimport { createTheme } from '../../application/use-cases/createTheme';\n\nconst defaultTheme = createTheme();\n\n/*** Holds the active Surface theme runtime for component consumption. */\nexport const ThemeRuntimeContext = createContext<ThemeRuntime>({\n theme: defaultTheme,\n mode: 'light',\n setThemeConfig: () => undefined,\n setMode: () => undefined,\n});\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ThemeScopeProps } from '../../../../types/theme';
|
|
2
|
+
/*** Apply a nested Surface theme or mode override without remounting app-level providers. */
|
|
3
|
+
export declare function ThemeScope({ children, themeConfig, mode }: ThemeScopeProps): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=ThemeScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeScope.d.ts","sourceRoot":"","sources":["../../../../../src/features/theme/adapters/inbound/ThemeScope.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM7E,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,eAAe,+BAkB1E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { deepMerge } from '@ankhorage/utility/object';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useFontRuntime } from '../../../font/adapters/inbound/useFontRuntime';
|
|
4
|
+
import { createTheme } from '../../application/use-cases/createTheme';
|
|
5
|
+
import { ThemeRuntimeContext } from './ThemeRuntimeContext';
|
|
6
|
+
import { useTheme } from './useTheme';
|
|
7
|
+
/*** Apply a nested Surface theme or mode override without remounting app-level providers. */
|
|
8
|
+
export function ThemeScope({ children, themeConfig, mode }) {
|
|
9
|
+
const parent = useTheme();
|
|
10
|
+
const { activeFontId } = useFontRuntime();
|
|
11
|
+
const scopedMode = mode ?? parent.mode;
|
|
12
|
+
const scopedConfig = useMemo(() => (themeConfig ? deepMerge(parent.theme.config, themeConfig) : parent.theme.config), [parent.theme.config, themeConfig]);
|
|
13
|
+
const theme = useMemo(() => createTheme(scopedConfig, scopedMode, activeFontId), [activeFontId, scopedConfig, scopedMode]);
|
|
14
|
+
const value = useMemo(() => ({ ...parent, theme, mode: scopedMode }), [parent, scopedMode, theme]);
|
|
15
|
+
return <ThemeRuntimeContext value={value}>{children}</ThemeRuntimeContext>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ThemeScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeScope.js","sourceRoot":"","sources":["../../../../../src/features/theme/adapters/inbound/ThemeScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,M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["import { deepMerge } from '@ankhorage/utility/object';\nimport { useMemo } from 'react';\n\nimport type { ThemeRuntime, ThemeScopeProps } from '../../../../types/theme';\nimport { useFontRuntime } from '../../../font/adapters/inbound/useFontRuntime';\nimport { createTheme } from '../../application/use-cases/createTheme';\nimport { ThemeRuntimeContext } from './ThemeRuntimeContext';\nimport { useTheme } from './useTheme';\n\n/*** Apply a nested Surface theme or mode override without remounting app-level providers. */\nexport function ThemeScope({ children, themeConfig, mode }: ThemeScopeProps) {\n const parent = useTheme();\n const { activeFontId } = useFontRuntime();\n const scopedMode = mode ?? parent.mode;\n const scopedConfig = useMemo(\n () => (themeConfig ? deepMerge(parent.theme.config, themeConfig) : parent.theme.config),\n [parent.theme.config, themeConfig],\n );\n const theme = useMemo(\n () => createTheme(scopedConfig, scopedMode, activeFontId),\n [activeFontId, scopedConfig, scopedMode],\n );\n const value = useMemo<ThemeRuntime>(\n () => ({ ...parent, theme, mode: scopedMode }),\n [parent, scopedMode, theme],\n );\n\n return <ThemeRuntimeContext value={value}>{children}</ThemeRuntimeContext>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../../../src/features/theme/adapters/inbound/useTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D,8CAA8C;AAC9C,wBAAgB,QAAQ,IAAI,YAAY,CAEvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../../../../src/features/theme/adapters/inbound/useTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,8CAA8C;AAC9C,MAAM,UAAU,QAAQ;IACtB,OAAO,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { use } from 'react';\n\nimport type { ThemeRuntime } from '../../../../types/theme';\nimport { ThemeRuntimeContext } from './ThemeRuntimeContext';\n\n/*** Read the active Surface theme runtime. */\nexport function useTheme(): ThemeRuntime {\n return use(ThemeRuntimeContext);\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ThemeConfig } from '@ankhorage/contracts';
|
|
2
|
+
import type { SurfaceTheme } from '../../../../types/theme';
|
|
3
|
+
/*** Resolve canonical persisted theme source into the complete Surface runtime theme. */
|
|
4
|
+
export declare function createTheme(config?: ThemeConfig, mode?: 'light' | 'dark', activeFontId?: string | null): SurfaceTheme;
|
|
5
|
+
//# sourceMappingURL=createTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTheme.d.ts","sourceRoot":"","sources":["../../../../../src/features/theme/application/use-cases/createTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAWxE,yFAAyF;AACzF,wBAAgB,WAAW,CACzB,MAAM,GAAE,WAA4B,EACpC,IAAI,GAAE,OAAO,GAAG,MAAgB,EAChC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,YAAY,CAWd"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { generatePalette } from '../../domain/generatePalette';
|
|
2
|
+
import { resolveGlobalTokens } from '../../utils/resolveGlobalTokens';
|
|
3
|
+
const DEFAULT_CONFIG = {
|
|
4
|
+
id: 'default',
|
|
5
|
+
name: 'Default',
|
|
6
|
+
light: { primaryColor: '#3B82F6', harmony: 'monochromatic' },
|
|
7
|
+
dark: { primaryColor: '#3B82F6', harmony: 'monochromatic' },
|
|
8
|
+
};
|
|
9
|
+
/*** Resolve canonical persisted theme source into the complete Surface runtime theme. */
|
|
10
|
+
export function createTheme(config = DEFAULT_CONFIG, mode = 'light', activeFontId) {
|
|
11
|
+
const { colors, swatches, semantics, colorDiagnostics } = generatePalette(config, mode);
|
|
12
|
+
const baseTheme = {
|
|
13
|
+
...resolveGlobalTokens(config.tokens),
|
|
14
|
+
colors,
|
|
15
|
+
swatches,
|
|
16
|
+
semantics,
|
|
17
|
+
colorDiagnostics,
|
|
18
|
+
config,
|
|
19
|
+
};
|
|
20
|
+
return activeFontId ? withActiveFont(baseTheme, activeFontId) : baseTheme;
|
|
21
|
+
}
|
|
22
|
+
/*** Return a theme with generated module font-family names without mutating the base theme. */
|
|
23
|
+
function withActiveFont(theme, activeFontId) {
|
|
24
|
+
const familyName = toPascalCase(activeFontId);
|
|
25
|
+
return {
|
|
26
|
+
...theme,
|
|
27
|
+
typography: {
|
|
28
|
+
...theme.typography,
|
|
29
|
+
fonts: {
|
|
30
|
+
normal: createFontMap(theme.typography.fonts.normal, familyName, 'Regular'),
|
|
31
|
+
italic: createFontMap(theme.typography.fonts.italic, familyName, 'Italic'),
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function createFontMap(fallback, familyName, style) {
|
|
37
|
+
return {
|
|
38
|
+
...fallback,
|
|
39
|
+
'100': `${familyName}_100${style}`,
|
|
40
|
+
'200': `${familyName}_200${style}`,
|
|
41
|
+
'300': `${familyName}_300${style}`,
|
|
42
|
+
'400': `${familyName}_400${style}`,
|
|
43
|
+
'500': `${familyName}_500${style}`,
|
|
44
|
+
'600': `${familyName}_600${style}`,
|
|
45
|
+
'700': `${familyName}_700${style}`,
|
|
46
|
+
'800': `${familyName}_800${style}`,
|
|
47
|
+
'900': `${familyName}_900${style}`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function toPascalCase(value) {
|
|
51
|
+
return value
|
|
52
|
+
.split(/[- ]+/)
|
|
53
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
54
|
+
.join('');
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=createTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTheme.js","sourceRoot":"","sources":["../../../../../src/features/theme/application/use-cases/createTheme.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,cAAc,GAAgB;IAClC,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE;IAC5D,IAAI,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE;CAC5D,CAAC;AAEF,yFAAyF;AACzF,MAAM,UAAU,WAAW,CACzB,SAAsB,cAAc,EACpC,OAAyB,OAAO,EAChC,YAA4B;IAE5B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxF,MAAM,SAAS,GAAiB;QAC9B,GAAG,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC;QACrC,MAAM;QACN,QAAQ;QACR,SAAS;QACT,gBAAgB;QAChB,MAAM;KACP,CAAC;IACF,OAAO,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5E,CAAC;AAED,+FAA+F;AAC/F,SAAS,cAAc,CAAC,KAAmB,EAAE,YAAoB;IAC/D,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAC9C,OAAO;QACL,GAAG,KAAK;QACR,UAAU,EAAE;YACV,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE;gBACL,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC;gBAC3E,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC;aAC3E;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,QAAgD,EAChD,UAAkB,EAClB,KAA2B;IAE3B,OAAO;QACL,GAAG,QAAQ;QACX,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;QAClC,KAAK,EAAE,GAAG,UAAU,OAAO,KAAK,EAAE;KACnC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK;SACT,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC","sourcesContent":["import type { ThemeConfig } from '@ankhorage/contracts';\n\nimport type { FontWeight, SurfaceTheme } from '../../../../types/theme';\nimport { generatePalette } from '../../domain/generatePalette';\nimport { resolveGlobalTokens } from '../../utils/resolveGlobalTokens';\n\nconst DEFAULT_CONFIG: ThemeConfig = {\n id: 'default',\n name: 'Default',\n light: { primaryColor: '#3B82F6', harmony: 'monochromatic' },\n dark: { primaryColor: '#3B82F6', harmony: 'monochromatic' },\n};\n\n/*** Resolve canonical persisted theme source into the complete Surface runtime theme. */\nexport function createTheme(\n config: ThemeConfig = DEFAULT_CONFIG,\n mode: 'light' | 'dark' = 'light',\n activeFontId?: string | null,\n): SurfaceTheme {\n const { colors, swatches, semantics, colorDiagnostics } = generatePalette(config, mode);\n const baseTheme: SurfaceTheme = {\n ...resolveGlobalTokens(config.tokens),\n colors,\n swatches,\n semantics,\n colorDiagnostics,\n config,\n };\n return activeFontId ? withActiveFont(baseTheme, activeFontId) : baseTheme;\n}\n\n/*** Return a theme with generated module font-family names without mutating the base theme. */\nfunction withActiveFont(theme: SurfaceTheme, activeFontId: string): SurfaceTheme {\n const familyName = toPascalCase(activeFontId);\n return {\n ...theme,\n typography: {\n ...theme.typography,\n fonts: {\n normal: createFontMap(theme.typography.fonts.normal, familyName, 'Regular'),\n italic: createFontMap(theme.typography.fonts.italic, familyName, 'Italic'),\n },\n },\n };\n}\n\nfunction createFontMap(\n fallback: Record<FontWeight, string | undefined>,\n familyName: string,\n style: 'Regular' | 'Italic',\n): Record<FontWeight, string | undefined> {\n return {\n ...fallback,\n '100': `${familyName}_100${style}`,\n '200': `${familyName}_200${style}`,\n '300': `${familyName}_300${style}`,\n '400': `${familyName}_400${style}`,\n '500': `${familyName}_500${style}`,\n '600': `${familyName}_600${style}`,\n '700': `${familyName}_700${style}`,\n '800': `${familyName}_800${style}`,\n '900': `${familyName}_900${style}`,\n };\n}\n\nfunction toPascalCase(value: string): string {\n return value\n .split(/[- ]+/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join('');\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ThemeTokens } from '../../types/theme';
|
|
2
|
+
declare const DEFAULT_TOKENS: Omit<ThemeTokens, 'colors' | 'swatches' | 'semantics' | 'colorDiagnostics'>;
|
|
3
|
+
export declare const SURFACE_COLOR_POLICY: {
|
|
4
|
+
readonly disabledContrast: 3;
|
|
5
|
+
readonly surfaceSeparation: 1.05;
|
|
6
|
+
readonly textContrast: 4.5;
|
|
7
|
+
readonly uiContrast: 3;
|
|
8
|
+
};
|
|
9
|
+
export { DEFAULT_TOKENS };
|
|
10
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/features/theme/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAgBjE,QAAA,MAAM,cAAc,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,kBAAkB,CA0C7F,CAAC;AAEJ,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC;AAEX,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -11,7 +11,7 @@ const EMPTY_FONT_MAP = {
|
|
|
11
11
|
bold: undefined,
|
|
12
12
|
normal: undefined,
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
const DEFAULT_TOKENS = {
|
|
15
15
|
spacing: { none: 0, xs: 4, s: 8, m: 16, l: 24, xl: 32, xxl: 48 },
|
|
16
16
|
radii: { none: 0, s: 4, m: 8, l: 16, full: 9999 },
|
|
17
17
|
typography: {
|
|
@@ -53,4 +53,11 @@ export const DEFAULT_TOKENS = {
|
|
|
53
53
|
},
|
|
54
54
|
shadows: { soft: 2, medium: 4, hard: 8 },
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
export const SURFACE_COLOR_POLICY = {
|
|
57
|
+
disabledContrast: 3,
|
|
58
|
+
surfaceSeparation: 1.05,
|
|
59
|
+
textContrast: 4.5,
|
|
60
|
+
uiContrast: 3,
|
|
61
|
+
};
|
|
62
|
+
export { DEFAULT_TOKENS };
|
|
63
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","s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nD,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;SACpD;QACD,KAAK,EAAE;YACL,EAAE,EAAE,EAAE;YACN,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,EAAE;YACL,EAAE,EAAE,EAAE;YACN,GAAG,EAAE,EAAE;YACP,KAAK,EAAE,EAAE;YACT,EAAE,EAAE,EAAE;YACN,EAAE,EAAE,EAAE;YACN,EAAE,EAAE,EAAE;YACN,EAAE,EAAE,EAAE;YACN,EAAE,EAAE,EAAE;YACN,EAAE,EAAE,EAAE;SACP;QACD,OAAO,EAAE;YACP,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,KAAK;YACjB,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE,KAAK;SACb;QACD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,cAAc,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,cAAc,EAAE,EAAE;KACxE;IACD,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;CACzC,CAAC;AAEJ,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,gBAAgB,EAAE,CAAC;IACnB,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,GAAG;IACjB,UAAU,EAAE,CAAC;CACL,CAAC;AAEX,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { FontWeight, ThemeTokens } from '../../types/theme';\n\nconst EMPTY_FONT_MAP: Record<FontWeight, string | undefined> = {\n '100': undefined,\n '200': undefined,\n '300': undefined,\n '400': undefined,\n '500': undefined,\n '600': undefined,\n '700': undefined,\n '800': undefined,\n '900': undefined,\n bold: undefined,\n normal: undefined,\n};\n\nconst DEFAULT_TOKENS: Omit<ThemeTokens, 'colors' | 'swatches' | 'semantics' | 'colorDiagnostics'> =\n {\n spacing: { none: 0, xs: 4, s: 8, m: 16, l: 24, xl: 32, xxl: 48 },\n radii: { none: 0, s: 4, m: 8, l: 16, full: 9999 },\n typography: {\n headings: {\n 1: { size: 32, lineHeight: 40, weight: 'bold' },\n 2: { size: 24, lineHeight: 32, weight: 'bold' },\n 3: { size: 20, lineHeight: 28, weight: 'bold' },\n 4: { size: 18, lineHeight: 24, weight: 'semiBold' },\n 5: { size: 16, lineHeight: 22, weight: 'semiBold' },\n 6: { size: 14, lineHeight: 20, weight: 'semiBold' },\n },\n sizes: {\n xs: 12,\n s: 14,\n m: 16,\n l: 18,\n xl: 20,\n xxl: 24,\n '3xl': 30,\n h1: 32,\n h2: 24,\n h3: 20,\n h4: 18,\n h5: 16,\n h6: 14,\n },\n weights: {\n thin: '100',\n extraLight: '200',\n light: '300',\n regular: '400',\n medium: '500',\n semiBold: '600',\n bold: '700',\n extraBold: '800',\n black: '900',\n },\n fonts: { normal: { ...EMPTY_FONT_MAP }, italic: { ...EMPTY_FONT_MAP } },\n },\n shadows: { soft: 2, medium: 4, hard: 8 },\n };\n\nexport const SURFACE_COLOR_POLICY = {\n disabledContrast: 3,\n surfaceSeparation: 1.05,\n textContrast: 4.5,\n uiContrast: 3,\n} as const;\n\nexport { DEFAULT_TOKENS };\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColorContrastContext, ColorSelectionTarget, ColorSwatch, ColorSwatchTiePolicy, HexColor } from '@ankhorage/color-theory';
|
|
2
|
-
import type { SurfaceColorSelectionDiagnostic, SurfaceContrastDiagnostic } from '
|
|
2
|
+
import type { SurfaceColorSelectionDiagnostic, SurfaceContrastDiagnostic } from '../../../types/theme';
|
|
3
3
|
/** Collect deterministic Color Theory evidence while Surface resolves semantic colors. */
|
|
4
4
|
export declare function createSurfaceColorDiagnosticCollector(): SurfaceColorDiagnosticCollector;
|
|
5
5
|
declare class SurfaceColorDiagnosticCollector {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSurfaceColorDiagnosticCollector.d.ts","sourceRoot":"","sources":["../../../../src/features/theme/domain/createSurfaceColorDiagnosticCollector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,EACV,+BAA+B,EAC/B,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,0FAA0F;AAC1F,wBAAgB,qCAAqC,oCAEpD;AAED,cAAM,+BAA+B;IACnC,QAAQ,CAAC,UAAU,EAAE,+BAA+B,EAAE,CAAM;IAC5D,QAAQ,CAAC,SAAS,EAAE,yBAAyB,EAAE,CAAM;IAErD,QAAQ,CAAC,iBAAiB,GACxB,IAAI,MAAM,EACV,YAAY,QAAQ,EACpB,YAAY,QAAQ,EACpB,iBAAiB,MAAM,KACtB,QAAQ,CAWT;IAEF,QAAQ,CAAC,cAAc,GACrB,IAAI,MAAM,EACV,YAAY,QAAQ,EACpB,YAAY,QAAQ,EACpB,iBAAiB,MAAM,KACtB,yBAAyB,CAU1B;IAEF,QAAQ,CAAC,WAAW,GAClB,IAAI,MAAM,EACV,QAAQ,WAAW,EACnB,QAAQ,oBAAoB,EAC5B,UAAU,SAAS,oBAAoB,EAAE,EACzC,WAAW,oBAAoB,KAC9B,QAAQ,CAOT;IAEF,QAAQ,CAAC,gBAAgB,GACvB,IAAI,MAAM,EACV,YAAY,QAAQ,EACpB,iBAAiB,MAAM,KACtB,QAAQ,CAWT;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSurfaceColorDiagnosticCollector.js","sourceRoot":"","sources":["../../../../src/features/theme/domain/createSurfaceColorDiagnosticCollector.ts"],"names":[],"m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,IAAI,KAAK,CAAC,iBAAiB,EAAE,gDAAgD,CAAC,CAAC;QACvF,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;IAC7B,CAAC,CAAC;IAEO,gBAAgB,GAAG,CAC1B,EAAU,EACV,UAAoB,EACpB,eAAuB,EACb,EAAE;QACZ,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAClB,EAAE;YACF,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,UAAU;YACV,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,eAAe;YACf,MAAM,EAAE,QAAQ,CAAC,QAAQ,IAAI,eAAe;SAC7C,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,UAAU,CAAC;IAC7B,CAAC,CAAC;CACH","sourcesContent":["import type {\n ColorContrastContext,\n ColorSelectionTarget,\n ColorSwatch,\n ColorSwatchTiePolicy,\n HexColor,\n} from '@ankhorage/color-theory';\nimport {\n getContrastRatio,\n getReadableForeground,\n selectColorSwatchStep,\n} from '@ankhorage/color-theory';\n\nimport type {\n SurfaceColorSelectionDiagnostic,\n SurfaceContrastDiagnostic,\n} from '../../../types/theme';\n\n/** Collect deterministic Color Theory evidence while Surface resolves semantic colors. */\nexport function createSurfaceColorDiagnosticCollector() {\n return new SurfaceColorDiagnosticCollector();\n}\n\nclass SurfaceColorDiagnosticCollector {\n readonly selections: SurfaceColorSelectionDiagnostic[] = [];\n readonly contrasts: SurfaceContrastDiagnostic[] = [];\n\n readonly measureForeground = (\n id: string,\n foreground: HexColor,\n background: HexColor,\n minimumContrast: number,\n ): HexColor => {\n const contrast = getContrastRatio(foreground, background);\n this.contrasts.push({\n id,\n foreground,\n background,\n contrast,\n minimumContrast,\n passes: contrast >= minimumContrast,\n });\n return foreground;\n };\n\n readonly measureSurface = (\n id: string,\n foreground: HexColor,\n background: HexColor,\n minimumContrast: number,\n ): SurfaceContrastDiagnostic => {\n const contrast = getContrastRatio(foreground, background);\n return {\n id,\n foreground,\n background,\n contrast,\n minimumContrast,\n passes: contrast >= minimumContrast,\n };\n };\n\n readonly selectColor = (\n id: string,\n swatch: ColorSwatch,\n target: ColorSelectionTarget,\n contexts: readonly ColorContrastContext[],\n tiePolicy: ColorSwatchTiePolicy,\n ): HexColor => {\n const result = selectColorSwatchStep(swatch, target, contexts, tiePolicy);\n this.selections.push({ id, result });\n if (!result.selected) {\n throw new Error(`[surface] No '${id}' swatch step satisfies the required contrast.`);\n }\n return result.selected.hex;\n };\n\n readonly selectForeground = (\n id: string,\n background: HexColor,\n minimumContrast: number,\n ): HexColor => {\n const selected = getReadableForeground(background);\n this.contrasts.push({\n id,\n foreground: selected.foreground,\n background,\n contrast: selected.contrast,\n minimumContrast,\n passes: selected.contrast >= minimumContrast,\n });\n return selected.foreground;\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColorContrastContext, ColorSelectionTarget, ColorSwatch, ColorSwatchTiePolicy, HexColor, SemanticColorToken } from '@ankhorage/color-theory';
|
|
2
|
-
import type { ContentSemantics, NeutralSemantics, SurfaceContrastDiagnostic, SurfaceSemantics } from '
|
|
2
|
+
import type { ContentSemantics, NeutralSemantics, SurfaceContrastDiagnostic, SurfaceSemantics } from '../../../types/theme';
|
|
3
3
|
type ResolvedSemanticColors = Record<SemanticColorToken, HexColor>;
|
|
4
4
|
interface SurfaceSemanticMeasurements {
|
|
5
5
|
measureForeground: (id: string, foreground: HexColor, background: HexColor, minimumContrast: number) => HexColor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSurfaceSemanticPolicy.d.ts","sourceRoot":"","sources":["../../../../src/features/theme/domain/createSurfaceSemanticPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EACnB,M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AyB,EAAE;IAQhF,aAAa,IAAI,oBAAoB;IAIrC,UAAU,IAAI,oBAAoB;IAIlC,mBAAmB,IAAI,oBAAoB;IAI3C,UAAU,IAAI,oBAAoB;IAIlC,OAAO,CAAC,qBAAqB;IAO7B,OAAO,CAAC,cAAc;CAQvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseHexColorOrThrow } from '@ankhorage/color-theory';
|
|
2
|
-
import { SURFACE_COLOR_POLICY } from '
|
|
2
|
+
import { SURFACE_COLOR_POLICY } from '../constants';
|
|
3
3
|
/** Create the canonical Surface policy for selecting and measuring semantic colors. */
|
|
4
4
|
export function createSurfaceSemanticPolicy(resolved, isDark, measurements) {
|
|
5
5
|
return new SurfaceSemanticPolicy(resolved, isDark, measurements);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSurfaceSemanticPolicy.js","sourceRoot":"","sources":["../../../../src/features/theme/domain/createSurfaceSemanticPolicy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAQ/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAmBpD,uFAAuF;AACvF,MAAM,UAAU,2BAA2B,CACzC,QAAgC,EAChC,MAAe,EACf,YAAyC;IAEzC,OAAO,IAAI,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,qBAAqB;IAMN;IACA;IACA;IAPV,uBAAuB,CAAkC;IACzD,mBAAmB,CAAkC;IACrD,SAAS,CAAuB;IAEzC,YACmB,QAAgC,EAChC,MAAe,EACf,YAAyC;QAFzC,aAAQ,GAAR,QAAQ,CAAwB;QAChC,WAAM,GAAN,MAAM,CAAS;QACf,iBAAY,GAAZ,YAAY,CAA6B;QAE1D,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAC3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AAE,UAAkB;QACnD,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CACrC,EAAE,EACF,oBAAoB,CAAC,UAAU,CAAC,EAChC,IAAI,CAAC,QAAQ,CAAC,UAAU,EACxB,oBAAoB,CAAC,iBAAiB,CACvC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type {\n ColorContrastContext,\n ColorSelectionTarget,\n ColorSwatch,\n ColorSwatchTiePolicy,\n HexColor,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\nimport { parseHexColorOrThrow } from '@ankhorage/color-theory';\n\nimport type {\n ContentSemantics,\n NeutralSemantics,\n SurfaceContrastDiagnostic,\n SurfaceSemantics,\n} from '../../../types/theme';\nimport { SURFACE_COLOR_POLICY } from '../constants';\n\ntype ResolvedSemanticColors = Record<SemanticColorToken, HexColor>;\n\ninterface SurfaceSemanticMeasurements {\n measureForeground: (\n id: string,\n foreground: HexColor,\n background: HexColor,\n minimumContrast: number,\n ) => HexColor;\n measureSurface: (\n id: string,\n foreground: HexColor,\n background: HexColor,\n minimumContrast: number,\n ) => SurfaceContrastDiagnostic;\n}\n\n/** Create the canonical Surface policy for selecting and measuring semantic colors. */\nexport function createSurfaceSemanticPolicy(\n resolved: ResolvedSemanticColors,\n isDark: boolean,\n measurements: SurfaceSemanticMeasurements,\n) {\n return new SurfaceSemanticPolicy(resolved, isDark, measurements);\n}\n\nclass SurfaceSemanticPolicy {\n readonly adjacentSurfaceContexts: readonly ColorContrastContext[];\n readonly textSurfaceContexts: readonly ColorContrastContext[];\n readonly tiePolicy: ColorSwatchTiePolicy;\n\n constructor(\n private readonly resolved: ResolvedSemanticColors,\n private readonly isDark: boolean,\n private readonly measurements: SurfaceSemanticMeasurements,\n ) {\n this.adjacentSurfaceContexts = this.createSurfaceContexts(SURFACE_COLOR_POLICY.uiContrast);\n this.textSurfaceContexts = this.createSurfaceContexts(SURFACE_COLOR_POLICY.textContrast);\n this.tiePolicy = isDark ? 'lower-step' : 'higher-step';\n }\n\n buildNeutral(neutralSwatch: ColorSwatch): NeutralSemantics {\n return {\n bg: this.resolved.background,\n bgSubtle: this.resolved.surface,\n surface: this.resolved.surface,\n surfaceHover: this.isDark ? neutralSwatch[800] : neutralSwatch[200],\n surfaceActive: this.isDark ? neutralSwatch[700] : neutralSwatch[300],\n border: this.resolved.border,\n borderStrong: this.isDark ? neutralSwatch[600] : neutralSwatch[300],\n divider: this.resolved.divider,\n text: this.resolved.text,\n textMuted: this.resolved.textMuted,\n textSubtle: this.isDark ? neutralSwatch[300] : neutralSwatch[600],\n disabledBg: this.resolved.disabledBg,\n disabledText: this.resolved.disabledText,\n };\n }\n\n buildSurface(inverse: HexColor): SurfaceSemantics {\n return {\n default: this.resolved.surface,\n subtle: this.resolved.background,\n raised: this.resolved.surfaceRaised,\n sunken: this.resolved.background,\n overlay: this.resolved.surfaceRaised,\n scrim: '#0000008f',\n disabled: this.resolved.disabledBg,\n inverse,\n };\n }\n\n measureContent(content: ContentSemantics, surface: SurfaceSemantics): void {\n const pairs = [\n [\n 'content.default/background',\n content.default,\n surface.sunken,\n SURFACE_COLOR_POLICY.textContrast,\n ],\n [\n 'content.default/surface',\n content.default,\n surface.default,\n SURFACE_COLOR_POLICY.textContrast,\n ],\n ['content.muted/surface', content.muted, surface.default, SURFACE_COLOR_POLICY.textContrast],\n [\n 'content.subtle/surface',\n content.subtle,\n surface.default,\n SURFACE_COLOR_POLICY.textContrast,\n ],\n [\n 'content.disabled/disabled',\n content.disabled,\n surface.disabled,\n SURFACE_COLOR_POLICY.disabledContrast,\n ],\n [\n 'content.inverse/inverse',\n content.inverse,\n surface.inverse,\n SURFACE_COLOR_POLICY.textContrast,\n ],\n ] as const;\n for (const [id, foreground, background, minimumContrast] of pairs) {\n this.measurements.measureForeground(\n id,\n parseHexColorOrThrow(foreground),\n parseHexColorOrThrow(background),\n minimumContrast,\n );\n }\n }\n\n measureSurfaceSeparation(surface: SurfaceSemantics): SurfaceContrastDiagnostic[] {\n return [\n this.measureSurface('surface.default', surface.default),\n this.measureSurface('surface.raised', surface.raised),\n this.measureSurface('surface.disabled', surface.disabled),\n ];\n }\n\n neutralTarget(): ColorSelectionTarget {\n return { lightness: this.isDark ? 0.65 : 0.55, chroma: 0.02 };\n }\n\n roleTarget(): ColorSelectionTarget {\n return { lightness: this.isDark ? 0.65 : 0.5, chroma: 0.15 };\n }\n\n strongNeutralTarget(): ColorSelectionTarget {\n return { lightness: this.isDark ? 0.8 : 0.4, chroma: 0.02 };\n }\n\n textTarget(): ColorSelectionTarget {\n return { lightness: this.isDark ? 0.75 : 0.45, chroma: 0.15 };\n }\n\n private createSurfaceContexts(minimumContrast: number): readonly ColorContrastContext[] {\n return [\n { id: 'background', against: this.resolved.background, minimumContrast },\n { id: 'surface', against: this.resolved.surface, minimumContrast },\n ];\n }\n\n private measureSurface(id: string, foreground: string): SurfaceContrastDiagnostic {\n return this.measurements.measureSurface(\n id,\n parseHexColorOrThrow(foreground),\n this.resolved.background,\n SURFACE_COLOR_POLICY.surfaceSeparation,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GeneratedThemeSwatches, ThemeColorMode } from '@ankhorage/color-theory';
|
|
2
|
+
import type { ThemeConfig } from '@ankhorage/contracts';
|
|
3
|
+
import type { SurfaceColorDiagnostics, ThemeSemantics, ThemeTokens } from '../../../types/theme';
|
|
4
|
+
export declare function generatePalette(config: ThemeConfig, mode?: ThemeColorMode): {
|
|
5
|
+
colors: ThemeTokens['colors'];
|
|
6
|
+
swatches: GeneratedThemeSwatches;
|
|
7
|
+
semantics: ThemeSemantics;
|
|
8
|
+
colorDiagnostics: SurfaceColorDiagnostics;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=generatePalette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generatePalette.d.ts","sourceRoot":"","sources":["../../../../src/features/theme/domain/generatePalette.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAOtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,uBAAuB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIjG,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,IAAI,GAAE,cAAwB,GAC7B;IACD,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,SAAS,EAAE,cAAc,CAAC;IAC1B,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CA0CA"}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { DARK_SEMANTIC_COLOR_REFERENCES, generateThemeModeColors, LIGHT_SEMANTIC_COLOR_REFERENCES, parseHexColorOrThrow, } from '@ankhorage/color-theory';
|
|
2
|
+
import { resolveSemanticColors } from './resolveSemanticColors';
|
|
2
3
|
import { resolveSurfaceSemanticModel } from './resolveSurfaceSemanticModel';
|
|
3
|
-
export function resolveSemanticColors(generated, references) {
|
|
4
|
-
return Object.fromEntries(Object.entries(references).map(([token, ref]) => {
|
|
5
|
-
const swatch = generated.swatches[ref.role];
|
|
6
|
-
if (!swatch) {
|
|
7
|
-
throw new Error(`Missing swatch for role '${ref.role}' (token: '${token}')`);
|
|
8
|
-
}
|
|
9
|
-
return [token, swatch[ref.step]];
|
|
10
|
-
}));
|
|
11
|
-
}
|
|
12
4
|
export function generatePalette(config, mode = 'light') {
|
|
13
5
|
const modeConfig = mode === 'dark' ? config.dark : config.light;
|
|
14
6
|
const isDark = mode === 'dark';
|
|
@@ -48,4 +40,4 @@ export function generatePalette(config, mode = 'light') {
|
|
|
48
40
|
colorDiagnostics,
|
|
49
41
|
};
|
|
50
42
|
}
|
|
51
|
-
//# sourceMappingURL=
|
|
43
|
+
//# sourceMappingURL=generatePalette.js.map
|
|
@@ -0,0 +1 @@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S,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC;QACxD,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC;QACpD,SAAS,EAAE,CAAC,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC;QACzD,QAAQ,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC;QACtD,UAAU,EAAE,CAAC,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC;QAC1D,UAAU,EAAE,OAAO,CAAC,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,IAAI,EAAE,OAAO,CAAC,OAAO;QACrB,aAAa,EAAE,OAAO,CAAC,KAAK;QAC5B,MAAM,EAAE,MAAM,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,OAAO,EAAE,OAAO,CAAC,IAAI;QACrB,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;IAEF,OAAO;QACL,MAAM;QACN,QAAQ;QACR,SAAS;QACT,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import type { GeneratedThemeSwatches, ThemeColorMode } from '@ankhorage/color-theory';\nimport {\n DARK_SEMANTIC_COLOR_REFERENCES,\n generateThemeModeColors,\n LIGHT_SEMANTIC_COLOR_REFERENCES,\n parseHexColorOrThrow,\n} from '@ankhorage/color-theory';\nimport type { ThemeConfig } from '@ankhorage/contracts';\n\nimport type { SurfaceColorDiagnostics, ThemeSemantics, ThemeTokens } from '../../../types/theme';\nimport { resolveSemanticColors } from './resolveSemanticColors';\nimport { resolveSurfaceSemanticModel } from './resolveSurfaceSemanticModel';\n\nexport function generatePalette(\n config: ThemeConfig,\n mode: ThemeColorMode = 'light',\n): {\n colors: ThemeTokens['colors'];\n swatches: GeneratedThemeSwatches;\n semantics: ThemeSemantics;\n colorDiagnostics: SurfaceColorDiagnostics;\n} {\n const modeConfig = mode === 'dark' ? config.dark : config.light;\n const isDark = mode === 'dark';\n\n parseHexColorOrThrow(modeConfig.primaryColor);\n\n const generated = generateThemeModeColors(modeConfig);\n const { swatches } = generated;\n const references = isDark ? DARK_SEMANTIC_COLOR_REFERENCES : LIGHT_SEMANTIC_COLOR_REFERENCES;\n const resolved = resolveSemanticColors(generated, references);\n const { semantics, colorDiagnostics } = resolveSurfaceSemanticModel({\n generated,\n mode,\n references,\n resolved,\n });\n const { border, content, error, info, neutral, success, surface, warning } = semantics;\n\n const colors: ThemeTokens['colors'] = {\n primary: swatches.primary[500],\n secondary: (swatches.secondary ?? swatches.primary)[500],\n accent: (swatches.tertiary ?? swatches.primary)[500],\n highlight: (swatches.quaternary ?? swatches.primary)[500],\n tertiary: (swatches.tertiary ?? swatches.primary)[500],\n quaternary: (swatches.quaternary ?? swatches.primary)[500],\n background: neutral.bg,\n surface: surface.default,\n text: content.default,\n textSecondary: content.muted,\n border: border.default,\n error: error.base,\n success: success.base,\n warning: warning.base,\n info: info.base,\n };\n\n return {\n colors,\n swatches,\n semantics,\n colorDiagnostics,\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveRoleSemantics.d.ts","sourceRoot":"","sources":["../../../../src/features/theme/domain/resolveRoleSemantics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,UAAU,yBAAyB;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,UAAU,EAAE,QAAQ,CAAC;IACrB,YAAY,EAAE,QAAQ,CAAC;IACvB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,CACjB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,QAAQ,EACpB,UAAU,EAAE,QAAQ,EACpB,eAAe,EAAE,MAAM,KACpB,QAAQ,CAAC;IACd,aAAa,EAAE,QAAQ,CAAC;IACxB,OAAO,EAAE,QAAQ,CAAC;IAClB,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,KAAK,QAAQ,CAAC;IAC1F,MAAM,EAAE,WAAW,CAAC;CACrB;AAWD,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,KAAK,EACL,EAAE,EACF,MAAM,EACN,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,gBAAgB,EAChB,MAAM,GACP,EAAE,yBAAyB,GAAG,aAAa,CAiC3C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SURFACE_COLOR_POLICY } from '
|
|
1
|
+
import { SURFACE_COLOR_POLICY } from '../constants';
|
|
2
2
|
/** Resolve every filled role state together with its measured foreground. */
|
|
3
3
|
export function resolveRoleSemantics({ base, disabledBg, disabledText, hover, id, isDark, measureForeground, onSurfaceText, outline, selectForeground, swatch, }) {
|
|
4
4
|
const states = resolveRoleStateColors(swatch, isDark, base, hover);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveRoleSemantics.js","sourceRoot":"","sources":["../../../../src/features/theme/domain/resolveRoleSemantics.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA8BpD,6EAA6E;AAC7E,MAAM,UAAU,oBAAoB,CAAC,EACnC,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,KAAK,EACL,EAAE,EACF,MAAM,EACN,iBAAiB,EACjB,aAAa,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AAC,CAAC;QACpD,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QAC1C,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QAC1C,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QAC7C,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;KAC/C,CAAC;AACJ,CAAC","sourcesContent":["import type { ColorSwatch, HexColor } from '@ankhorage/color-theory';\n\nimport type { RoleSemantics } from '../../../types/theme';\nimport { SURFACE_COLOR_POLICY } from '../constants';\n\ninterface ResolveRoleSemanticsInput {\n base?: HexColor;\n disabledBg: HexColor;\n disabledText: HexColor;\n hover?: HexColor;\n id: string;\n isDark: boolean;\n measureForeground: (\n id: string,\n foreground: HexColor,\n background: HexColor,\n minimumContrast: number,\n ) => HexColor;\n onSurfaceText: HexColor;\n outline: HexColor;\n selectForeground: (id: string, background: HexColor, minimumContrast: number) => HexColor;\n swatch: ColorSwatch;\n}\n\ninterface RoleStateColors {\n base: HexColor;\n hover: HexColor;\n softActive: HexColor;\n softBg: HexColor;\n softHover: HexColor;\n strong: HexColor;\n}\n\n/** Resolve every filled role state together with its measured foreground. */\nexport function resolveRoleSemantics({\n base,\n disabledBg,\n disabledText,\n hover,\n id,\n isDark,\n measureForeground,\n onSurfaceText,\n outline,\n selectForeground,\n swatch,\n}: ResolveRoleSemanticsInput): RoleSemantics {\n const states = resolveRoleStateColors(swatch, isDark, base, hover);\n\n return {\n ...states,\n outline,\n onSurfaceText,\n onSolidText: selectForeground(`${id}.base`, states.base, SURFACE_COLOR_POLICY.textContrast),\n onHoverText: selectForeground(`${id}.hover`, states.hover, SURFACE_COLOR_POLICY.textContrast),\n onStrongText: selectForeground(\n `${id}.strong`,\n states.strong,\n SURFACE_COLOR_POLICY.textContrast,\n ),\n onSoftText: selectForeground(`${id}.soft`, states.softBg, SURFACE_COLOR_POLICY.textContrast),\n onSoftHoverText: selectForeground(\n `${id}.softHover`,\n states.softHover,\n SURFACE_COLOR_POLICY.textContrast,\n ),\n onSoftActiveText: selectForeground(\n `${id}.softActive`,\n states.softActive,\n SURFACE_COLOR_POLICY.textContrast,\n ),\n disabledBg,\n onDisabledText: measureForeground(\n `${id}.disabled`,\n disabledText,\n disabledBg,\n SURFACE_COLOR_POLICY.disabledContrast,\n ),\n };\n}\n\nfunction resolveRoleStateColors(\n swatch: ColorSwatch,\n isDark: boolean,\n base?: HexColor,\n hover?: HexColor,\n): RoleStateColors {\n return {\n base: base ?? swatch[500],\n hover: hover ?? (isDark ? swatch[400] : swatch[600]),\n strong: isDark ? swatch[300] : swatch[700],\n softBg: isDark ? swatch[900] : swatch[100],\n softHover: isDark ? swatch[800] : swatch[200],\n softActive: isDark ? swatch[700] : swatch[300],\n };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GeneratedThemeModeColors, HexColor, SemanticColorReferenceMap, SemanticColorToken } from '@ankhorage/color-theory';
|
|
2
|
+
export type SurfaceSemanticColors = Record<SemanticColorToken, HexColor>;
|
|
3
|
+
export declare function resolveSemanticColors(generated: GeneratedThemeModeColors, references: SemanticColorReferenceMap): SurfaceSemanticColors;
|
|
4
|
+
//# sourceMappingURL=resolveSemanticColors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSemanticColors.d.ts","sourceRoot":"","sources":["../../../../src/features/theme/domain/resolveSemanticColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,QAAQ,EACR,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAEzE,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,wBAAwB,EACnC,UAAU,EAAE,yBAAyB,GACpC,qBAAqB,CAUvB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function resolveSemanticColors(generated, references) {
|
|
2
|
+
return Object.fromEntries(Object.entries(references).map(([token, ref]) => {
|
|
3
|
+
const swatch = generated.swatches[ref.role];
|
|
4
|
+
if (!swatch) {
|
|
5
|
+
throw new Error(`Missing swatch for role '${ref.role}' (token: '${token}')`);
|
|
6
|
+
}
|
|
7
|
+
return [token, swatch[ref.step]];
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=resolveSemanticColors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSemanticColors.js","sourceRoot":"","sources":["../../../../src/features/theme/domain/resolveSemanticColors.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,qBAAqB,CACnC,SAAmC,EACnC,UAAqC;IAErC,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,IAAI,cAAc,KAAK,IAAI,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CACsB,CAAC;AAC7B,CAAC","sourcesContent":["import type {\n GeneratedThemeModeColors,\n HexColor,\n SemanticColorReferenceMap,\n SemanticColorToken,\n} from '@ankhorage/color-theory';\n\nexport type SurfaceSemanticColors = Record<SemanticColorToken, HexColor>;\n\nexport function resolveSemanticColors(\n generated: GeneratedThemeModeColors,\n references: SemanticColorReferenceMap,\n): SurfaceSemanticColors {\n return Object.fromEntries(\n Object.entries(references).map(([token, ref]) => {\n const swatch = generated.swatches[ref.role];\n if (!swatch) {\n throw new Error(`Missing swatch for role '${ref.role}' (token: '${token}')`);\n }\n return [token, swatch[ref.step]];\n }),\n ) as SurfaceSemanticColors;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GeneratedThemeModeColors, HexColor, SemanticColorReferenceMap, SemanticColorToken, ThemeColorMode } from '@ankhorage/color-theory';
|
|
2
|
-
import type { SurfaceColorDiagnostics, ThemeSemantics } from '
|
|
2
|
+
import type { SurfaceColorDiagnostics, ThemeSemantics } from '../../../types/theme';
|
|
3
3
|
type ResolvedSemanticColors = Record<SemanticColorToken, HexColor>;
|
|
4
4
|
interface ResolveSurfaceSemanticModelInput {
|
|
5
5
|
generated: GeneratedThemeModeColors;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSurfaceSemanticModel.d.ts","sourceRoot":"","sources":["../../../../src/features/theme/domain/resolveSurfaceSemanticModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,wBAAwB,EAExB,QAAQ,EACR,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EAIV,uBAAuB,EACvB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAK9B,KAAK,sBAAsB,GAAG,MAAM,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAkBnE,UAAU,gCAAgC;IACxC,SAAS,EAAE,wBAAwB,CAAC;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,UAAU,EAAE,yBAAyB,CAAC;IACtC,QAAQ,EAAE,sBAAsB,CAAC;CAClC;AAED,4FAA4F;AAC5F,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gCAAgC,GAAG;IACpF,SAAS,EAAE,cAAc,CAAC;IAC1B,gBAAgB,EAAE,uBAAuB,CAAC;CAC3C,CA2CA"}
|