@galaxy-io/dls 1.6.1 → 2.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/README.md +47 -50
- package/biome/index.json +74 -0
- package/biome/plugins/no-hex-literal.grit +20 -0
- package/biome/plugins/no-inline-style.grit +13 -0
- package/biome/plugins/no-margin.grit +9 -0
- package/biome/plugins/warn/no-hex-literal.grit +23 -0
- package/biome/plugins/warn/no-inline-style.grit +13 -0
- package/biome/plugins/warn/no-margin.grit +9 -0
- package/dist/a11y/FocusScope.d.ts +44 -0
- package/dist/a11y/FocusScope.js +229 -0
- package/dist/a11y/VisuallyHidden.d.ts +21 -0
- package/dist/a11y/VisuallyHidden.js +30 -0
- package/dist/avatar/Avatar.d.ts +56 -14
- package/dist/avatar/Avatar.js +250 -96
- package/dist/avatar/AvatarGroup.d.ts +43 -0
- package/dist/avatar/AvatarGroup.js +153 -0
- package/dist/backgrounds/GridBackground.d.ts +48 -0
- package/dist/backgrounds/GridBackground.js +146 -0
- package/dist/beacons/Beacon.d.ts +86 -22
- package/dist/beacons/Beacon.js +170 -47
- package/dist/brand/GalaxyFilamentWordmark.d.ts +30 -0
- package/dist/brand/GalaxyFilamentWordmark.js +39 -0
- package/dist/brand/GalaxyLogomark.d.ts +26 -0
- package/dist/brand/GalaxyLogomark.js +41 -0
- package/dist/brand/GalaxyLogomarkAnimation.d.ts +36 -0
- package/dist/brand/GalaxyLogomarkAnimation.js +107 -0
- package/dist/brand/GalaxyWordmark.d.ts +30 -0
- package/dist/brand/GalaxyWordmark.js +63 -0
- package/dist/brand/assets/galaxy-logomark-animation.js +136678 -0
- package/dist/brand/brandMark.d.ts +26 -0
- package/dist/brand/brandMark.js +35 -0
- package/dist/buttons/Button.d.ts +148 -59
- package/dist/buttons/Button.js +437 -227
- package/dist/buttons/ButtonGroup.d.ts +38 -0
- package/dist/buttons/ButtonGroup.js +68 -0
- package/dist/buttons/CopyButton.d.ts +77 -0
- package/dist/buttons/CopyButton.js +65 -0
- package/dist/charts/AreaChart.d.ts +49 -0
- package/dist/charts/AreaChart.js +31 -0
- package/dist/charts/BarChart.d.ts +54 -67
- package/dist/charts/BarChart.js +160 -124
- package/dist/charts/ChartAxis.d.ts +35 -40
- package/dist/charts/ChartAxis.js +114 -90
- package/dist/charts/ChartCategoryTargets.d.ts +12 -26
- package/dist/charts/ChartCategoryTargets.js +33 -20
- package/dist/charts/ChartFrame.d.ts +71 -116
- package/dist/charts/ChartFrame.js +306 -97
- package/dist/charts/ChartGroupProvider.d.ts +30 -41
- package/dist/charts/ChartGroupProvider.js +20 -7
- package/dist/charts/ChartLegend.d.ts +37 -48
- package/dist/charts/ChartLegend.js +243 -125
- package/dist/charts/ChartMarkTargets.d.ts +12 -28
- package/dist/charts/ChartMarkTargets.js +34 -20
- package/dist/charts/ChartPrimitives.d.ts +50 -305
- package/dist/charts/ChartPrimitives.js +65 -413
- package/dist/charts/ChartTooltip.d.ts +20 -26
- package/dist/charts/ChartTooltip.js +77 -40
- package/dist/charts/Heatmap.d.ts +35 -0
- package/dist/charts/Heatmap.js +307 -0
- package/dist/charts/LineChart.d.ts +54 -47
- package/dist/charts/LineChart.js +174 -121
- package/dist/charts/PieChart.d.ts +32 -53
- package/dist/charts/PieChart.js +159 -136
- package/dist/charts/Sparkline.d.ts +107 -0
- package/dist/charts/Sparkline.js +244 -0
- package/dist/charts/StatChart.d.ts +37 -13
- package/dist/charts/StatChart.js +82 -35
- package/dist/charts/barChartGeometry.d.ts +138 -86
- package/dist/charts/barChartGeometry.js +122 -101
- package/dist/charts/barChartLegend.d.ts +14 -18
- package/dist/charts/barChartLegend.js +18 -13
- package/dist/charts/chartFormat.d.ts +12 -18
- package/dist/charts/chartFormat.js +20 -52
- package/dist/charts/chartPalette.d.ts +33 -0
- package/dist/charts/chartPalette.js +68 -0
- package/dist/charts/chartScales.d.ts +41 -108
- package/dist/charts/chartScales.js +62 -128
- package/dist/charts/chartSelection.d.ts +15 -0
- package/dist/charts/chartSelection.js +22 -0
- package/dist/charts/constants.d.ts +100 -256
- package/dist/charts/constants.js +109 -275
- package/dist/charts/heatmapGeometry.d.ts +95 -0
- package/dist/charts/heatmapGeometry.js +155 -0
- package/dist/charts/lineChartGeometry.d.ts +108 -58
- package/dist/charts/lineChartGeometry.js +120 -78
- package/dist/charts/pieChartGeometry.d.ts +66 -40
- package/dist/charts/pieChartGeometry.js +68 -38
- package/dist/charts/types.d.ts +206 -466
- package/dist/charts/types.js +55 -144
- package/dist/charts/useCartesianChartLayout.d.ts +28 -59
- package/dist/charts/useCartesianChartLayout.js +47 -32
- package/dist/charts/useChartDimensions.d.ts +19 -40
- package/dist/charts/useChartDimensions.js +40 -56
- package/dist/charts/useChartFormatters.d.ts +6 -15
- package/dist/charts/useChartFormatters.js +4 -9
- package/dist/charts/useChartInteraction.d.ts +69 -116
- package/dist/charts/useChartInteraction.js +148 -78
- package/dist/charts/useChartTooltipPosition.d.ts +29 -39
- package/dist/charts/useChartTooltipPosition.js +14 -5
- package/dist/charts/useSeriesColorResolver.d.ts +11 -33
- package/dist/charts/useSeriesColorResolver.js +19 -12
- package/dist/chips/Chip.d.ts +155 -44
- package/dist/chips/Chip.js +329 -155
- package/dist/chips/ChipGroup.d.ts +53 -0
- package/dist/chips/ChipGroup.js +98 -0
- package/dist/drawer/Drawer.d.ts +83 -17
- package/dist/drawer/Drawer.js +399 -65
- package/dist/dropdown/Dropdown.d.ts +80 -63
- package/dist/dropdown/Dropdown.js +127 -129
- package/dist/editor/CodeEditor.d.ts +119 -40
- package/dist/editor/CodeEditor.js +490 -400
- package/dist/editor/CodeEditorReactWidget.d.ts +20 -17
- package/dist/editor/CodeEditorReactWidget.js +28 -21
- package/dist/feedback/Alert.d.ts +49 -0
- package/dist/feedback/Alert.js +172 -0
- package/dist/feedback/EmptyState.d.ts +39 -0
- package/dist/feedback/EmptyState.js +109 -0
- package/dist/feedback/ProgressBar.d.ts +125 -0
- package/dist/feedback/ProgressBar.js +183 -0
- package/dist/feedback/ProgressCircle.d.ts +99 -0
- package/dist/feedback/ProgressCircle.js +187 -0
- package/dist/feedback/Skeleton.d.ts +69 -0
- package/dist/feedback/Skeleton.js +130 -0
- package/dist/feedback/Spinner.d.ts +63 -0
- package/dist/feedback/Spinner.js +141 -0
- package/dist/fonts.css +70 -0
- package/dist/hooks/internal/useIsClient.d.ts +2 -0
- package/dist/hooks/internal/useIsClient.js +14 -0
- package/dist/hooks/useClipboard.d.ts +19 -0
- package/dist/hooks/useClipboard.js +45 -0
- package/dist/hooks/useControlledOpenState.d.ts +21 -0
- package/dist/hooks/useControlledOpenState.js +19 -0
- package/dist/hooks/useControlledState.d.ts +19 -0
- package/dist/hooks/useControlledState.js +22 -0
- package/dist/hooks/useDebouncedValue.d.ts +14 -0
- package/dist/hooks/useDebouncedValue.js +33 -0
- package/dist/hooks/useDisclosure.d.ts +26 -0
- package/dist/hooks/useDisclosure.js +36 -0
- package/dist/hooks/useDismiss.d.ts +23 -27
- package/dist/hooks/useDismiss.js +39 -27
- package/dist/hooks/useElementClientSize.d.ts +10 -10
- package/dist/hooks/useElementClientSize.js +8 -11
- package/dist/hooks/useElementWidth.d.ts +6 -13
- package/dist/hooks/useElementWidth.js +6 -14
- package/dist/hooks/useField.d.ts +47 -0
- package/dist/hooks/useField.js +40 -0
- package/dist/hooks/useHotkey.d.ts +77 -0
- package/dist/hooks/useHotkey.js +246 -0
- package/dist/hooks/useIsMac.d.ts +12 -0
- package/dist/hooks/useIsMac.js +27 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +17 -0
- package/dist/hooks/useIsomorphicLayoutEffect.js +20 -0
- package/dist/hooks/useLocalStorage.d.ts +28 -0
- package/dist/hooks/useLocalStorage.js +145 -0
- package/dist/hooks/useMediaQuery.d.ts +11 -0
- package/dist/hooks/useMediaQuery.js +23 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +12 -0
- package/dist/hooks/usePrefersReducedMotion.js +25 -0
- package/dist/hooks/useResize.d.ts +42 -62
- package/dist/hooks/useResize.js +43 -31
- package/dist/icons/Icon.d.ts +64 -37
- package/dist/icons/Icon.js +96 -37
- package/dist/icons/internal/IconSlot.d.ts +10 -0
- package/dist/icons/internal/IconSlot.js +32 -0
- package/dist/inputs/CheckboxGroup.d.ts +115 -0
- package/dist/inputs/CheckboxGroup.js +183 -0
- package/dist/inputs/CheckboxInput.d.ts +98 -28
- package/dist/inputs/CheckboxInput.js +218 -88
- package/dist/inputs/ColorInput.d.ts +115 -29
- package/dist/inputs/ColorInput.js +748 -326
- package/dist/inputs/CopyInput.d.ts +49 -20
- package/dist/inputs/CopyInput.js +57 -49
- package/dist/inputs/CronInput.d.ts +94 -0
- package/dist/inputs/CronInput.js +618 -0
- package/dist/inputs/DateInput.d.ts +175 -28
- package/dist/inputs/DateInput.js +1109 -451
- package/dist/inputs/DurationInput.d.ts +101 -0
- package/dist/inputs/DurationInput.js +441 -0
- package/dist/inputs/Field.d.ts +75 -0
- package/dist/inputs/Field.js +247 -0
- package/dist/inputs/Fieldset.d.ts +53 -0
- package/dist/inputs/Fieldset.js +149 -0
- package/dist/inputs/FileInput.d.ts +110 -0
- package/dist/inputs/FileInput.js +476 -0
- package/dist/inputs/Input.d.ts +148 -187
- package/dist/inputs/Input.js +339 -259
- package/dist/inputs/KeyValueInput.d.ts +120 -0
- package/dist/inputs/KeyValueInput.js +383 -0
- package/dist/inputs/MultiSelectInput.d.ts +165 -54
- package/dist/inputs/MultiSelectInput.js +175 -559
- package/dist/inputs/NumberInput.d.ts +65 -9
- package/dist/inputs/NumberInput.js +197 -40
- package/dist/inputs/PasswordInput.d.ts +17 -12
- package/dist/inputs/PasswordInput.js +33 -33
- package/dist/inputs/PinInput.d.ts +117 -0
- package/dist/inputs/PinInput.js +364 -0
- package/dist/inputs/RadioGroup.d.ts +115 -0
- package/dist/inputs/RadioGroup.js +179 -0
- package/dist/inputs/RadioInput.d.ts +87 -24
- package/dist/inputs/RadioInput.js +182 -95
- package/dist/inputs/SearchInput.d.ts +66 -0
- package/dist/inputs/SearchInput.js +156 -0
- package/dist/inputs/SelectInput.d.ts +195 -55
- package/dist/inputs/SelectInput.js +1308 -446
- package/dist/inputs/SliderInput.d.ts +150 -30
- package/dist/inputs/SliderInput.js +441 -186
- package/dist/inputs/SwitchInput.d.ts +109 -0
- package/dist/inputs/SwitchInput.js +248 -0
- package/dist/inputs/TagInput.d.ts +117 -0
- package/dist/inputs/TagInput.js +408 -0
- package/dist/inputs/TextAreaInput.d.ts +146 -44
- package/dist/inputs/TextAreaInput.js +298 -198
- package/dist/inputs/TextInput.d.ts +4 -13
- package/dist/inputs/TextInput.js +13 -48
- package/dist/inputs/ToggleInput.d.ts +120 -22
- package/dist/inputs/ToggleInput.js +262 -116
- package/dist/inputs/internal/bareField.d.ts +18 -0
- package/dist/inputs/internal/bareField.js +38 -0
- package/dist/inputs/internal/devWarn.d.ts +7 -0
- package/dist/inputs/internal/devWarn.js +30 -0
- package/dist/inputs/internal/fieldFrame.d.ts +34 -0
- package/dist/inputs/internal/fieldFrame.js +64 -0
- package/dist/inputs/internal/fieldWiring.d.ts +50 -0
- package/dist/inputs/internal/fieldWiring.js +38 -0
- package/dist/inputs/internal/innerButton.d.ts +2 -0
- package/dist/inputs/internal/innerButton.js +24 -0
- package/dist/inputs/internal/ownField.d.ts +45 -0
- package/dist/inputs/internal/ownField.js +58 -0
- package/dist/inputs/internal/predicates.d.ts +9 -0
- package/dist/inputs/internal/predicates.js +11 -0
- package/dist/inputs/internal/useComboboxPopover.d.ts +46 -0
- package/dist/inputs/internal/useComboboxPopover.js +92 -0
- package/dist/json/JsonViewer.d.ts +62 -0
- package/dist/json/JsonViewer.js +483 -0
- package/dist/layout/Box.d.ts +87 -0
- package/dist/layout/Box.js +109 -0
- package/dist/layout/Divider.d.ts +25 -0
- package/dist/layout/Divider.js +70 -0
- package/dist/layout/Flex.d.ts +139 -0
- package/dist/layout/Flex.js +165 -0
- package/dist/layout/FlexItem.d.ts +72 -0
- package/dist/layout/FlexItem.js +84 -0
- package/dist/layout/Grid.d.ts +140 -0
- package/dist/layout/Grid.js +178 -0
- package/dist/layout/Portal.d.ts +29 -0
- package/dist/layout/Portal.js +27 -0
- package/dist/layout/ResizablePanels.d.ts +88 -0
- package/dist/layout/ResizablePanels.js +198 -0
- package/dist/layout/ResizeHandle.d.ts +48 -0
- package/dist/layout/ResizeHandle.js +143 -0
- package/dist/layout/ScrollArea.d.ts +30 -0
- package/dist/layout/ScrollArea.js +138 -0
- package/dist/links/Link.d.ts +101 -1
- package/dist/links/Link.js +166 -4
- package/dist/lists/BulletedList.d.ts +25 -7
- package/dist/lists/BulletedList.js +72 -27
- package/dist/lists/DescriptionList.d.ts +91 -0
- package/dist/lists/DescriptionList.js +147 -0
- package/dist/menu/ContextMenu.d.ts +64 -0
- package/dist/menu/ContextMenu.js +34 -0
- package/dist/menu/Menu.d.ts +280 -0
- package/dist/menu/Menu.js +1003 -0
- package/dist/modal/ConfirmDialog.d.ts +55 -0
- package/dist/modal/ConfirmDialog.js +151 -0
- package/dist/modal/Modal.d.ts +64 -14
- package/dist/modal/Modal.js +189 -48
- package/dist/navigation/Breadcrumbs.d.ts +65 -0
- package/dist/navigation/Breadcrumbs.js +243 -0
- package/dist/navigation/CommandPalette.d.ts +83 -0
- package/dist/navigation/CommandPalette.js +509 -0
- package/dist/navigation/Pagination.d.ts +87 -0
- package/dist/navigation/Pagination.js +300 -0
- package/dist/navigation/SidebarNav.d.ts +107 -0
- package/dist/navigation/SidebarNav.js +341 -0
- package/dist/navigation/Stepper.d.ts +52 -0
- package/dist/navigation/Stepper.js +207 -0
- package/dist/navigation/Tabs.d.ts +113 -0
- package/dist/navigation/Tabs.js +543 -0
- package/dist/navigation/Topbar.d.ts +20 -0
- package/dist/navigation/Topbar.js +62 -0
- package/dist/overlay/OverlayProvider.d.ts +28 -32
- package/dist/overlay/OverlayProvider.js +42 -93
- package/dist/overlay/useOverlay.d.ts +88 -12
- package/dist/overlay/useOverlay.js +220 -43
- package/dist/overlays/Popover.d.ts +114 -0
- package/dist/overlays/Popover.js +389 -0
- package/dist/shapes/Circle.d.ts +84 -8
- package/dist/shapes/Circle.js +122 -20
- package/dist/shapes/Square.d.ts +84 -8
- package/dist/shapes/Square.js +123 -20
- package/dist/styles/mixins.d.ts +35 -0
- package/dist/styles/mixins.js +60 -0
- package/dist/styles.css +1 -202
- package/dist/table/InfiniteSpreadsheet.d.ts +140 -10
- package/dist/table/InfiniteSpreadsheet.js +762 -225
- package/dist/table/InfiniteTable.d.ts +116 -14
- package/dist/table/InfiniteTable.js +287 -429
- package/dist/table/SpreadsheetCellEditor.d.ts +54 -6
- package/dist/table/SpreadsheetCellEditor.js +163 -84
- package/dist/table/TableCore.d.ts +252 -0
- package/dist/table/TableCore.js +1082 -0
- package/dist/table/VirtualizedInfiniteTable.d.ts +104 -14
- package/dist/table/VirtualizedInfiniteTable.js +280 -219
- package/dist/table/types.d.ts +66 -244
- package/dist/table/types.js +0 -51
- package/dist/table/useInfiniteScrollSentinel.d.ts +25 -21
- package/dist/table/useInfiniteScrollSentinel.js +38 -30
- package/dist/table/useSpreadsheetCellNavigation.d.ts +44 -0
- package/dist/table/useSpreadsheetCellNavigation.js +141 -0
- package/dist/table/useTableColumnLayout.d.ts +90 -25
- package/dist/table/useTableColumnLayout.js +255 -50
- package/dist/table/useTableKeyboardNavigation.d.ts +32 -21
- package/dist/table/useTableKeyboardNavigation.js +95 -71
- package/dist/table/useTableRowSelection.d.ts +24 -25
- package/dist/table/useTableRowSelection.js +57 -84
- package/dist/table/useTableVirtualizer.d.ts +20 -0
- package/dist/table/useTableVirtualizer.js +48 -0
- package/dist/text/Bold.d.ts +5 -6
- package/dist/text/Bold.js +16 -15
- package/dist/text/Code.d.ts +5 -6
- package/dist/text/Code.js +16 -25
- package/dist/text/CodeBlock.d.ts +77 -0
- package/dist/text/CodeBlock.js +373 -0
- package/dist/text/EditableText.d.ts +55 -15
- package/dist/text/EditableText.js +153 -135
- package/dist/text/Ellipsis.d.ts +34 -8
- package/dist/text/Ellipsis.js +55 -23
- package/dist/text/Kbd.d.ts +72 -0
- package/dist/text/Kbd.js +284 -0
- package/dist/text/MarkdownText.d.ts +27 -10
- package/dist/text/MarkdownText.js +317 -300
- package/dist/text/RequiredMarker.d.ts +17 -5
- package/dist/text/RequiredMarker.js +34 -36
- package/dist/text/Selectable.d.ts +5 -6
- package/dist/text/Selectable.js +16 -13
- package/dist/text/Span.d.ts +82 -0
- package/dist/text/Span.js +115 -0
- package/dist/text/Text.d.ts +128 -41
- package/dist/text/Text.js +209 -76
- package/dist/theme/GalaxyProvider.d.ts +75 -0
- package/dist/theme/GalaxyProvider.js +223 -0
- package/dist/theme/ThemeSwitcher.d.ts +52 -0
- package/dist/theme/ThemeSwitcher.js +94 -0
- package/dist/theme/enums.d.ts +118 -0
- package/dist/theme/enums.js +144 -0
- package/dist/theme/tokens/dark.d.ts +2 -0
- package/dist/theme/tokens/dark.js +275 -0
- package/dist/theme/tokens/generate.d.ts +15 -0
- package/dist/theme/tokens/generate.js +47 -0
- package/dist/theme/tokens/light.d.ts +2 -0
- package/dist/theme/tokens/light.js +274 -0
- package/dist/theme/tokens/palette.d.ts +14 -0
- package/dist/theme/tokens/palette.js +153 -0
- package/dist/theme/tokens/scales.d.ts +26 -0
- package/dist/theme/tokens/scales.js +154 -0
- package/dist/theme/tokens/t.d.ts +3 -0
- package/dist/theme/tokens/t.js +25 -0
- package/dist/theme/tokens/types.d.ts +189 -0
- package/dist/theme/tokens/types.js +0 -0
- package/dist/theme/useGalaxyTheme.d.ts +46 -0
- package/dist/theme/useGalaxyTheme.js +36 -0
- package/dist/theme/useInverseScope.d.ts +18 -0
- package/dist/theme/useInverseScope.js +33 -0
- package/dist/three/GalaxyLogomark3D.d.ts +46 -0
- package/dist/three/GalaxyLogomark3D.js +134 -0
- package/dist/three/assets/galaxy-logomark.js +4 -0
- package/dist/three/galaxyLogomark3DScene.d.ts +27 -0
- package/dist/three/galaxyLogomark3DScene.js +165 -0
- package/dist/timeline/Timeline.d.ts +120 -0
- package/dist/timeline/Timeline.js +301 -0
- package/dist/toast/Toast.d.ts +43 -19
- package/dist/toast/Toast.js +130 -89
- package/dist/toast/ToastProvider.d.ts +23 -23
- package/dist/toast/ToastProvider.js +298 -101
- package/dist/toast/ToastViewport.d.ts +12 -0
- package/dist/toast/ToastViewport.js +210 -0
- package/dist/toast/useToast.d.ts +139 -5
- package/dist/toast/useToast.js +15 -13
- package/dist/tokens.css +654 -0
- package/dist/tooltip/Tooltip.d.ts +64 -44
- package/dist/tooltip/Tooltip.js +280 -73
- package/dist/tooltip/internal/LazyTooltip.d.ts +7 -0
- package/dist/tooltip/internal/LazyTooltip.js +53 -0
- package/dist/transform/Fade.d.ts +33 -11
- package/dist/transform/Fade.js +71 -19
- package/dist/transform/Flasher.d.ts +25 -0
- package/dist/transform/Flasher.js +39 -0
- package/dist/transform/Rotate.d.ts +24 -12
- package/dist/transform/Rotate.js +36 -22
- package/dist/transform/ScaleFade.d.ts +36 -11
- package/dist/transform/ScaleFade.js +86 -28
- package/dist/transform/internal/CollapseMotion.d.ts +10 -0
- package/dist/transform/internal/CollapseMotion.js +65 -0
- package/dist/tree/Tree.d.ts +85 -0
- package/dist/tree/Tree.js +387 -0
- package/dist/tree/treeRow.d.ts +39 -0
- package/dist/tree/treeRow.js +75 -0
- package/dist/utils/colors.d.ts +46 -13
- package/dist/utils/colors.js +92 -34
- package/dist/utils/css.d.ts +23 -0
- package/dist/utils/css.js +30 -0
- package/dist/utils/format.d.ts +58 -0
- package/dist/utils/format.js +220 -0
- package/dist/vite/index.d.ts +16 -0
- package/dist/vite/index.js +52 -0
- package/dist/widget/Widget.d.ts +164 -48
- package/dist/widget/Widget.js +335 -96
- package/dist/widget/WidgetGroup.d.ts +36 -0
- package/dist/widget/WidgetGroup.js +103 -0
- package/package.json +855 -157
- package/dist/accordion/Accordion.d.ts +0 -54
- package/dist/accordion/Accordion.js +0 -183
- package/dist/assets/components/GalaxyFilamentWordmarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyFilamentWordmarkDark.js +0 -14
- package/dist/assets/components/GalaxyFilamentWordmarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyFilamentWordmarkLight.js +0 -14
- package/dist/assets/components/GalaxyLogomarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyLogomarkDark.js +0 -11
- package/dist/assets/components/GalaxyLogomarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyLogomarkLight.js +0 -17
- package/dist/assets/components/GalaxyWordmarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyWordmarkDark.js +0 -15
- package/dist/assets/components/GalaxyWordmarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyWordmarkLight.js +0 -28
- package/dist/assets/models/galaxy-animation.js +0 -136666
- package/dist/assets/models/galaxy-logomark.js +0 -4
- package/dist/avatar/AvatarShimmer.d.ts +0 -30
- package/dist/avatar/AvatarShimmer.js +0 -22
- package/dist/backgrounds/CellGridBackground.d.ts +0 -24
- package/dist/backgrounds/CellGridBackground.js +0 -44
- package/dist/backgrounds/CrossGridBackground.d.ts +0 -26
- package/dist/backgrounds/CrossGridBackground.js +0 -49
- package/dist/backgrounds/DotGridBackground.d.ts +0 -24
- package/dist/backgrounds/DotGridBackground.js +0 -47
- package/dist/badge/Badge.d.ts +0 -42
- package/dist/badge/Badge.js +0 -99
- package/dist/charts/ChartEmptyState.d.ts +0 -17
- package/dist/charts/ChartEmptyState.js +0 -29
- package/dist/charts/ProgressBar.d.ts +0 -29
- package/dist/charts/ProgressBar.js +0 -65
- package/dist/charts/chartTheme.d.ts +0 -18
- package/dist/charts/chartTheme.js +0 -26
- package/dist/containers/FlexItem.d.ts +0 -50
- package/dist/containers/FlexItem.js +0 -91
- package/dist/containers/FlexWrapper.d.ts +0 -96
- package/dist/containers/FlexWrapper.js +0 -143
- package/dist/containers/GridWrapper.d.ts +0 -79
- package/dist/containers/GridWrapper.js +0 -125
- package/dist/containers/Spacing.d.ts +0 -23
- package/dist/containers/Spacing.js +0 -59
- package/dist/containers/Wrapper.d.ts +0 -26
- package/dist/containers/Wrapper.js +0 -54
- package/dist/dividers/HorizontalDivider.d.ts +0 -7
- package/dist/dividers/HorizontalDivider.js +0 -39
- package/dist/dividers/VerticalDivider.d.ts +0 -6
- package/dist/dividers/VerticalDivider.js +0 -21
- package/dist/icons/GalaxyFilamentWordmark.d.ts +0 -11
- package/dist/icons/GalaxyFilamentWordmark.js +0 -25
- package/dist/icons/GalaxyLogomark.d.ts +0 -13
- package/dist/icons/GalaxyLogomark.js +0 -27
- package/dist/icons/GalaxyLogomark3D.d.ts +0 -56
- package/dist/icons/GalaxyLogomark3D.js +0 -319
- package/dist/icons/GalaxyLogomarkAnimation.d.ts +0 -18
- package/dist/icons/GalaxyLogomarkAnimation.js +0 -48
- package/dist/icons/GalaxyWordmark.d.ts +0 -11
- package/dist/icons/GalaxyWordmark.js +0 -25
- package/dist/inputs/MultiTextInput.d.ts +0 -32
- package/dist/inputs/MultiTextInput.js +0 -180
- package/dist/inputs/SwitcherInput.d.ts +0 -30
- package/dist/inputs/SwitcherInput.js +0 -81
- package/dist/inputs/hooks.d.ts +0 -10
- package/dist/inputs/hooks.js +0 -22
- package/dist/overlay/constants.d.ts +0 -28
- package/dist/overlay/constants.js +0 -37
- package/dist/resizable/HorizontalResizeHandle.d.ts +0 -17
- package/dist/resizable/HorizontalResizeHandle.js +0 -38
- package/dist/resizable/VerticalResizeHandle.d.ts +0 -18
- package/dist/resizable/VerticalResizeHandle.js +0 -39
- package/dist/table/SpreadsheetCell.d.ts +0 -21
- package/dist/table/SpreadsheetCell.js +0 -71
- package/dist/table/SpreadsheetHeaderCell.d.ts +0 -23
- package/dist/table/SpreadsheetHeaderCell.js +0 -91
- package/dist/table/SpreadsheetMenuItem.d.ts +0 -14
- package/dist/table/SpreadsheetMenuItem.js +0 -33
- package/dist/table/SpreadsheetPrimitives.d.ts +0 -172
- package/dist/table/SpreadsheetPrimitives.js +0 -105
- package/dist/table/SpreadsheetRow.d.ts +0 -33
- package/dist/table/SpreadsheetRow.js +0 -73
- package/dist/table/SpreadsheetRowActionCell.d.ts +0 -14
- package/dist/table/SpreadsheetRowActionCell.js +0 -51
- package/dist/table/TableExpandCell.d.ts +0 -11
- package/dist/table/TableExpandCell.js +0 -24
- package/dist/table/TableExpandedRow.d.ts +0 -16
- package/dist/table/TableExpandedRow.js +0 -77
- package/dist/table/TableHeaderCellContent.d.ts +0 -30
- package/dist/table/TableHeaderCellContent.js +0 -48
- package/dist/table/TablePrimitives.d.ts +0 -313
- package/dist/table/TablePrimitives.js +0 -302
- package/dist/table/TableSelectCell.d.ts +0 -18
- package/dist/table/TableSelectCell.js +0 -27
- package/dist/table/TableStatusRow.d.ts +0 -18
- package/dist/table/TableStatusRow.js +0 -50
- package/dist/table/useSpreadsheetEditing.d.ts +0 -13
- package/dist/table/useSpreadsheetEditing.js +0 -41
- package/dist/table/useTableColumnResize.d.ts +0 -38
- package/dist/table/useTableColumnResize.js +0 -155
- package/dist/table/useTableRowExpansion.d.ts +0 -24
- package/dist/table/useTableRowExpansion.js +0 -62
- package/dist/table/utils.d.ts +0 -50
- package/dist/table/utils.js +0 -78
- package/dist/text/HotKeys.d.ts +0 -30
- package/dist/text/HotKeys.js +0 -74
- package/dist/text/Paragraph.d.ts +0 -33
- package/dist/text/Paragraph.js +0 -83
- package/dist/text/TextShimmer.d.ts +0 -14
- package/dist/text/TextShimmer.js +0 -34
- package/dist/theme/GalaxyTheme.d.ts +0 -67
- package/dist/theme/GalaxyTheme.js +0 -119
- package/dist/theme/constants.d.ts +0 -8
- package/dist/theme/constants.js +0 -38
- package/dist/theme/index.d.ts +0 -6
- package/dist/theme/index.js +0 -7
- package/dist/theme/types.d.ts +0 -195
- package/dist/theme/types.js +0 -10
- package/dist/theme/typography.d.ts +0 -2
- package/dist/theme/typography.js +0 -73
- package/dist/theme/variants/dark.d.ts +0 -2
- package/dist/theme/variants/dark.js +0 -125
- package/dist/theme/variants/light.d.ts +0 -2
- package/dist/theme/variants/light.js +0 -125
- package/dist/toast/ToastContainer.d.ts +0 -10
- package/dist/toast/ToastContainer.js +0 -31
- package/dist/toast/ToastWrapper.d.ts +0 -6
- package/dist/toast/ToastWrapper.js +0 -27
- package/dist/transform/Flash.d.ts +0 -7
- package/dist/transform/Flash.js +0 -18
- package/dist/transform/Spin.d.ts +0 -14
- package/dist/transform/Spin.js +0 -25
- package/dist/utils/linaria.d.ts +0 -1
- package/dist/utils/linaria.js +0 -8
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DARK_THEME } from "./dark.js";
|
|
2
|
+
import { SCALES, tokenName } from "./generate.js";
|
|
3
|
+
//#region src/theme/tokens/t.ts
|
|
4
|
+
/**
|
|
5
|
+
* `t` — the typed token accessor. Every leaf is the `var(--gx-…)` string for that token, so
|
|
6
|
+
* styles follow the active theme through CSS alone:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const Panel = styled.div`
|
|
10
|
+
* background: ${t.color.background.primary}; // var(--gx-color-background-primary)
|
|
11
|
+
* padding: ${t.space[12]}; // var(--gx-space-12)
|
|
12
|
+
* `;
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Built by walking the token source with `tokenName`, the same function that names the CSS
|
|
16
|
+
* variables, and typed `TokenAccessor<Theme & Scales>`, so `t` cannot drift from `Theme`.
|
|
17
|
+
*/
|
|
18
|
+
var toAccessor = (node, path) => Object.fromEntries(Object.entries(node).map(([key, value]) => [key, typeof value === "object" && value !== null ? toAccessor(value, [...path, key]) : `var(${tokenName([...path, key])})`]));
|
|
19
|
+
/** Typed `var(--gx-…)` accessor for every token. Style with `t.*` only. */
|
|
20
|
+
var t = toAccessor({
|
|
21
|
+
...DARK_THEME,
|
|
22
|
+
...SCALES
|
|
23
|
+
}, []);
|
|
24
|
+
//#endregion
|
|
25
|
+
export { t };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of the token layer (AGENTS.md; docs/theming.md). `Theme` is
|
|
3
|
+
* what changes per theme; `Scales` is theme-independent. `t` is typed
|
|
4
|
+
* `TokenAccessor<Theme & Scales>`, so the accessor and the theme cannot diverge.
|
|
5
|
+
*/
|
|
6
|
+
import type { Space } from "../enums.js";
|
|
7
|
+
/** A `#rrggbb` (or `#rgb`) color. */
|
|
8
|
+
export type Hex = `#${string}`;
|
|
9
|
+
/**
|
|
10
|
+
* The 17 chromatic families of the mode-stable palette (Tailwind v4 hues). There is no gray family:
|
|
11
|
+
* neutrals are the theme's `primary / secondary / tertiary` roles.
|
|
12
|
+
*/
|
|
13
|
+
export type PaletteColor = "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
|
|
14
|
+
/**
|
|
15
|
+
* The five steps of every palette family, lightest (`100`) to darkest (`900`): Tailwind v4's 50,
|
|
16
|
+
* 200, 500, 800 and 950.
|
|
17
|
+
*/
|
|
18
|
+
export type PaletteStep = 100 | 300 | 500 | 700 | 900;
|
|
19
|
+
/**
|
|
20
|
+
* The status roles every color property carries. Their values are their own (not copies of a
|
|
21
|
+
* palette family): a green, a warm amber and a red that never read alike.
|
|
22
|
+
*/
|
|
23
|
+
export type StatusColor = "success" | "warning" | "error";
|
|
24
|
+
/** One value per meaning role and per palette family. */
|
|
25
|
+
type RoleColors = Record<StatusColor | PaletteColor, string>;
|
|
26
|
+
/** A strong fill: its background, the text and icons drawn on it, and its two states. */
|
|
27
|
+
export type SolidColor = {
|
|
28
|
+
/** The fill. */
|
|
29
|
+
background: string;
|
|
30
|
+
/** Text and icons drawn on the fill. */
|
|
31
|
+
text: string;
|
|
32
|
+
/** The fill on hover. */
|
|
33
|
+
hovered: string;
|
|
34
|
+
/** The fill while pressed. */
|
|
35
|
+
pressed: string;
|
|
36
|
+
};
|
|
37
|
+
/** Type-scale steps (Constitution III-A.1). */
|
|
38
|
+
export type TypeStep = "caption" | "body_sm" | "body_md" | "body_lg" | "heading_sm" | "heading_md" | "heading_lg" | "display_sm" | "display_lg";
|
|
39
|
+
/** Serif (Cardo) is editorial only: it has no `caption`, `body_sm` or `body_md` step. */
|
|
40
|
+
type SerifStep = Exclude<TypeStep, "caption" | "body_sm" | "body_md">;
|
|
41
|
+
/** One family's metrics. Generic over its steps so a missing step is a type error. */
|
|
42
|
+
export type FontScale<S extends TypeStep = TypeStep> = {
|
|
43
|
+
/** CSS `font-family` stack. */
|
|
44
|
+
family: string;
|
|
45
|
+
/** The only two weights (Constitution II.4). */
|
|
46
|
+
weight: {
|
|
47
|
+
regular: number;
|
|
48
|
+
medium: number;
|
|
49
|
+
};
|
|
50
|
+
/** `font-size` per step. */
|
|
51
|
+
size: Record<S, string>;
|
|
52
|
+
/** UI `line-height` per step, on the 4px grid. Prose uses `1.5` instead. */
|
|
53
|
+
height: Record<S, string>;
|
|
54
|
+
/** `letter-spacing` per step. */
|
|
55
|
+
spacing: Record<S, string>;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Everything that changes per theme. Resolved hex values; `t` mirrors it as `var(--gx-…)`.
|
|
59
|
+
* Property-first: `t.color.<property>.<role>`, one value per role, no `subtle/default/strong`.
|
|
60
|
+
*/
|
|
61
|
+
export type Theme = {
|
|
62
|
+
color: {
|
|
63
|
+
/** Fills: surfaces, interaction states, and the soft tint of every role. */
|
|
64
|
+
background: RoleColors & {
|
|
65
|
+
/** The canvas. */
|
|
66
|
+
base: string;
|
|
67
|
+
/** Panels. */
|
|
68
|
+
primary: string;
|
|
69
|
+
/** Raised surfaces. */
|
|
70
|
+
secondary: string;
|
|
71
|
+
/** The most elevated surface. */
|
|
72
|
+
tertiary: string;
|
|
73
|
+
/** A neutral row or control under the pointer. */
|
|
74
|
+
hovered: string;
|
|
75
|
+
/** A neutral row or control while pressed. */
|
|
76
|
+
pressed: string;
|
|
77
|
+
/** The chosen item (menus, trees, tabs, nav, tables): `text.primary` at 12% over `base`. */
|
|
78
|
+
selected: string;
|
|
79
|
+
/** Disabled controls. */
|
|
80
|
+
disabled: string;
|
|
81
|
+
};
|
|
82
|
+
/** Text **and** icons. */
|
|
83
|
+
text: RoleColors & {
|
|
84
|
+
/** Primary copy. */
|
|
85
|
+
primary: string;
|
|
86
|
+
/** Supporting copy. */
|
|
87
|
+
secondary: string;
|
|
88
|
+
/** Hints, placeholders, metadata. */
|
|
89
|
+
tertiary: string;
|
|
90
|
+
/** Disabled controls. */
|
|
91
|
+
disabled: string;
|
|
92
|
+
};
|
|
93
|
+
/** Hairlines, dividers and control frames. */
|
|
94
|
+
border: RoleColors & {
|
|
95
|
+
/** Default hairline; field frames at rest. */
|
|
96
|
+
primary: string;
|
|
97
|
+
/** Control borders. */
|
|
98
|
+
secondary: string;
|
|
99
|
+
/** Emphasized dividers. */
|
|
100
|
+
tertiary: string;
|
|
101
|
+
/** A field frame under the pointer. */
|
|
102
|
+
hovered: string;
|
|
103
|
+
/** Focus: field frames and `FOCUS_RING`. */
|
|
104
|
+
focused: string;
|
|
105
|
+
/** Disabled controls. */
|
|
106
|
+
disabled: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Fills with the text drawn on them. `primary` is the monochrome fill (`text.primary` with
|
|
110
|
+
* `background.base` on it): the primary button, checked controls, the brand mark. `neutral` is
|
|
111
|
+
* the muted fill (`background.secondary` with `text.primary` on it; the `BASE` button), its
|
|
112
|
+
* hover and press each a clearly visible step in both themes. The rest are strong fills.
|
|
113
|
+
*/
|
|
114
|
+
solid: Record<"primary" | "neutral" | StatusColor | PaletteColor, SolidColor>;
|
|
115
|
+
/** Black/white overlays: `bgN` is the canvas color at N% opacity, `fgN` the text color. */
|
|
116
|
+
opacity: {
|
|
117
|
+
bg4: string;
|
|
118
|
+
bg8: string;
|
|
119
|
+
bg12: string;
|
|
120
|
+
bg16: string;
|
|
121
|
+
bg24: string;
|
|
122
|
+
bg32: string;
|
|
123
|
+
bg48: string;
|
|
124
|
+
bg64: string;
|
|
125
|
+
bg80: string;
|
|
126
|
+
bg100: string;
|
|
127
|
+
fg4: string;
|
|
128
|
+
fg8: string;
|
|
129
|
+
fg12: string;
|
|
130
|
+
fg16: string;
|
|
131
|
+
fg24: string;
|
|
132
|
+
fg32: string;
|
|
133
|
+
fg48: string;
|
|
134
|
+
fg64: string;
|
|
135
|
+
fg80: string;
|
|
136
|
+
fg100: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
font: {
|
|
140
|
+
/** UI copy (ABC Diatype). */
|
|
141
|
+
sans: FontScale;
|
|
142
|
+
/** Data and code (Berkeley Mono), ~0.92× the sans size at the same line height. */
|
|
143
|
+
mono: FontScale;
|
|
144
|
+
/** Editorial copy (Cardo). */
|
|
145
|
+
serif: FontScale<SerifStep>;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
/** Theme-independent scales, emitted once on `:root`. */
|
|
149
|
+
export type Scales = {
|
|
150
|
+
/** Gap and padding (Constitution II.5). */
|
|
151
|
+
space: Record<Space, string>;
|
|
152
|
+
/** Corner radii (Constitution II.6). */
|
|
153
|
+
radius: {
|
|
154
|
+
sm: string;
|
|
155
|
+
md: string;
|
|
156
|
+
lg: string;
|
|
157
|
+
pill: string;
|
|
158
|
+
};
|
|
159
|
+
/** Transition durations (Constitution II.7). */
|
|
160
|
+
duration: {
|
|
161
|
+
fast: string;
|
|
162
|
+
base: string;
|
|
163
|
+
};
|
|
164
|
+
/** Stacking order of floating layers. */
|
|
165
|
+
z: {
|
|
166
|
+
dropdown: number;
|
|
167
|
+
drawer: number;
|
|
168
|
+
modal: number;
|
|
169
|
+
toast: number;
|
|
170
|
+
tooltip: number;
|
|
171
|
+
};
|
|
172
|
+
/** Control heights: the canonical size rungs (Constitution III-A.4). */
|
|
173
|
+
size: {
|
|
174
|
+
control: {
|
|
175
|
+
xSmall: string;
|
|
176
|
+
small: string;
|
|
177
|
+
medium: string;
|
|
178
|
+
large: string;
|
|
179
|
+
xLarge: string;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
/** The mode-stable primitive palette: the same hex in every theme. For app-side chart and canvas code that needs a fixed hex; DLS charts draw series with `t.color.text.<family>`. */
|
|
183
|
+
palette: Record<PaletteColor, Record<PaletteStep, string>>;
|
|
184
|
+
};
|
|
185
|
+
/** Mirrors a token tree with every leaf replaced by its `var(--gx-…)` string. */
|
|
186
|
+
export type TokenAccessor<T> = {
|
|
187
|
+
[K in keyof T]: T[K] extends string | number ? string : TokenAccessor<T[K]>;
|
|
188
|
+
};
|
|
189
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { GalaxyTheme, ReducedMotion } from "./enums.js";
|
|
2
|
+
import type { Theme } from "./tokens/types.js";
|
|
3
|
+
/** What `useGalaxyTheme()` returns. */
|
|
4
|
+
export interface GalaxyThemeContextValue {
|
|
5
|
+
/** Resolved hex object for the active theme. For JS logic, never for styles. */
|
|
6
|
+
theme: Theme;
|
|
7
|
+
/** The theme actually rendering. Never SYSTEM. */
|
|
8
|
+
activeTheme: GalaxyTheme.DARK | GalaxyTheme.LIGHT;
|
|
9
|
+
/** The stored preference. Can be SYSTEM. Bind pickers to this. */
|
|
10
|
+
selectedTheme: GalaxyTheme;
|
|
11
|
+
/** What the OS reports. */
|
|
12
|
+
systemTheme: GalaxyTheme.DARK | GalaxyTheme.LIGHT;
|
|
13
|
+
/** Whether the provider's detector can read an OS theme at all. */
|
|
14
|
+
isSystemThemeSupported: boolean;
|
|
15
|
+
/** Change the theme preference; persists through the provider's `storage`. */
|
|
16
|
+
setTheme: (theme: GalaxyTheme) => void;
|
|
17
|
+
/** The provider's reduced-motion policy. */
|
|
18
|
+
reducedMotion: ReducedMotion;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The context `GalaxyProvider` fills and `useGalaxyTheme()` reads. Undefined outside a provider.
|
|
22
|
+
* Apps read it through `useGalaxyTheme()`, never directly.
|
|
23
|
+
*/
|
|
24
|
+
export declare const GalaxyThemeContext: import("react").Context<GalaxyThemeContextValue | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* @internal The scope a subtree renders in: the theme of the nearest provider or inverse scope.
|
|
27
|
+
* Read by `useInverseScope` to render the opposite theme, and by a scoped `GalaxyProvider` with
|
|
28
|
+
* no `theme` to inherit it; never by apps.
|
|
29
|
+
*/
|
|
30
|
+
export interface ThemeScope {
|
|
31
|
+
/** The theme rendering in this subtree. */
|
|
32
|
+
base: GalaxyTheme.DARK | GalaxyTheme.LIGHT;
|
|
33
|
+
}
|
|
34
|
+
/** @internal See `ThemeScope`. `undefined` outside a provider. */
|
|
35
|
+
export declare const ThemeScopeContext: import("react").Context<ThemeScope | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Internal: the mount node `GalaxyProvider`'s `portalContainer` supplies to `Portal`. `undefined`
|
|
38
|
+
* when no provider sets one (`Portal` then uses `document.body`); `null` while the node is not
|
|
39
|
+
* available yet. Read by `Portal`, never by apps.
|
|
40
|
+
*/
|
|
41
|
+
export declare const PortalContainerContext: import("react").Context<HTMLElement | null | undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* The resolved theme, and the stored preference and its setter.
|
|
44
|
+
* Throws when called outside a `GalaxyProvider`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useGalaxyTheme(): GalaxyThemeContextValue;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
//#region src/theme/useGalaxyTheme.ts
|
|
3
|
+
/**
|
|
4
|
+
* Read the resolved theme, and change it. For JS logic only (charts, canvas, seeded colors,
|
|
5
|
+
* Storybook): styling never calls this, because components read `var(--gx-…)` and a theme switch
|
|
6
|
+
* is one attribute change on the root.
|
|
7
|
+
*
|
|
8
|
+
* This module owns the contexts (GalaxyProvider Q3 (a)); `GalaxyProvider` supplies the values.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The context `GalaxyProvider` fills and `useGalaxyTheme()` reads. Undefined outside a provider.
|
|
12
|
+
* Apps read it through `useGalaxyTheme()`, never directly.
|
|
13
|
+
*/
|
|
14
|
+
var GalaxyThemeContext = createContext(void 0);
|
|
15
|
+
GalaxyThemeContext.displayName = "GalaxyThemeContext";
|
|
16
|
+
/** @internal See `ThemeScope`. `undefined` outside a provider. */
|
|
17
|
+
var ThemeScopeContext = createContext(void 0);
|
|
18
|
+
ThemeScopeContext.displayName = "ThemeScopeContext";
|
|
19
|
+
/**
|
|
20
|
+
* Internal: the mount node `GalaxyProvider`'s `portalContainer` supplies to `Portal`. `undefined`
|
|
21
|
+
* when no provider sets one (`Portal` then uses `document.body`); `null` while the node is not
|
|
22
|
+
* available yet. Read by `Portal`, never by apps.
|
|
23
|
+
*/
|
|
24
|
+
var PortalContainerContext = createContext(void 0);
|
|
25
|
+
PortalContainerContext.displayName = "PortalContainerContext";
|
|
26
|
+
/**
|
|
27
|
+
* The resolved theme, and the stored preference and its setter.
|
|
28
|
+
* Throws when called outside a `GalaxyProvider`.
|
|
29
|
+
*/
|
|
30
|
+
function useGalaxyTheme() {
|
|
31
|
+
const context = useContext(GalaxyThemeContext);
|
|
32
|
+
if (context === void 0) throw new Error("useGalaxyTheme() must be called inside a GalaxyProvider.");
|
|
33
|
+
return context;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { GalaxyThemeContext, PortalContainerContext, ThemeScopeContext, useGalaxyTheme };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ThemeScope } from "./useGalaxyTheme.js";
|
|
2
|
+
/** @internal The attributes that put an element in the inverse scope. */
|
|
3
|
+
export interface InverseScopeAttributes {
|
|
4
|
+
/** The opposite built-in theme, lowercase. */
|
|
5
|
+
"data-gx-theme": string;
|
|
6
|
+
}
|
|
7
|
+
/** @internal What `useInverseScope` returns. */
|
|
8
|
+
export interface InverseScopeValue {
|
|
9
|
+
/** Spread onto the element that becomes the scope. */
|
|
10
|
+
attributes: InverseScopeAttributes;
|
|
11
|
+
/** Provide through `ThemeScopeContext` to the scope's children, so a nested scope flips back. */
|
|
12
|
+
scope: ThemeScope;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @internal The inverse scope of the nearest provider (outside one: the light theme, the
|
|
16
|
+
* opposite of the dark default), as attributes plus the scope value for its children.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useInverseScope(): InverseScopeValue;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { GalaxyTheme } from "./enums.js";
|
|
2
|
+
import { ThemeScopeContext } from "./useGalaxyTheme.js";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
//#region src/theme/useInverseScope.ts
|
|
5
|
+
/**
|
|
6
|
+
* @internal The inverse scope's attributes (docs/theming.md → The inverse scope): a subtree rendered in
|
|
7
|
+
* the opposite built-in theme. There are no inverse tokens; a component that
|
|
8
|
+
* wants the high-contrast look (the Tooltip bubble; a story-local inverse cell) spreads these
|
|
9
|
+
* attributes on its own element, provides `scope` to its children, and uses the ordinary tokens
|
|
10
|
+
* inside (`background.base`, `text.primary`, …). It sets its own `color: text.primary` so
|
|
11
|
+
* inherited text re-roots in the scope.
|
|
12
|
+
*
|
|
13
|
+
* No CSS lives here, so modules in the Text ↔ Tooltip ↔ Kbd cycle can import it without
|
|
14
|
+
* reordering `styles.css`. Never used by apps.
|
|
15
|
+
*/
|
|
16
|
+
/** The built-in theme opposite each base. */
|
|
17
|
+
var BASE_TO_INVERSE_MAP = {
|
|
18
|
+
[GalaxyTheme.DARK]: GalaxyTheme.LIGHT,
|
|
19
|
+
[GalaxyTheme.LIGHT]: GalaxyTheme.DARK
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @internal The inverse scope of the nearest provider (outside one: the light theme, the
|
|
23
|
+
* opposite of the dark default), as attributes plus the scope value for its children.
|
|
24
|
+
*/
|
|
25
|
+
function useInverseScope() {
|
|
26
|
+
const base = BASE_TO_INVERSE_MAP[useContext(ThemeScopeContext)?.base ?? GalaxyTheme.DARK];
|
|
27
|
+
return {
|
|
28
|
+
attributes: { "data-gx-theme": base.toLowerCase() },
|
|
29
|
+
scope: { base }
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { useInverseScope };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type AriaAttributes, type CSSProperties } from "react";
|
|
2
|
+
export interface GalaxyLogomark3DProps extends AriaAttributes {
|
|
3
|
+
/**
|
|
4
|
+
* Width and height of the square canvas in px.
|
|
5
|
+
* @default 128
|
|
6
|
+
*/
|
|
7
|
+
size?: number;
|
|
8
|
+
/**
|
|
9
|
+
* For a mark on an inverted fill (`text.primary`): the material takes `background.base` instead of `text.primary`.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
isInverse?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Spin continuously around the vertical axis at `speed`.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
isAutoRotate?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Let the user drag to orbit the mark. There is no zoom or pan.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
isInteractive?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Do a quick double flip on random axes when the pointer enters.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
isHoverable?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Auto-rotation rate in radians per second. The hover flip lasts `0.5 / speed` seconds.
|
|
30
|
+
* @default 2
|
|
31
|
+
*/
|
|
32
|
+
speed?: number;
|
|
33
|
+
/** Accessible name. Without it the mark is decorative (`aria-hidden`). */
|
|
34
|
+
ariaLabel?: string;
|
|
35
|
+
/** DOM id on the root `<span>`. */
|
|
36
|
+
id?: string;
|
|
37
|
+
/** Any `data-*` attribute, forwarded to the root `<span>`. */
|
|
38
|
+
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
39
|
+
/** Extra class on the root `<span>`. */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Inline style on the root, merged after its own `--gx-galaxy-logomark-3d-size`. */
|
|
42
|
+
style?: CSSProperties;
|
|
43
|
+
}
|
|
44
|
+
/** The Galaxy mark in 3D, painted `text.primary`. Decorative unless `ariaLabel` is set. */
|
|
45
|
+
declare const GalaxyLogomark3D: import("react").ForwardRefExoticComponent<GalaxyLogomark3DProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
46
|
+
export default GalaxyLogomark3D;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { useGalaxyTheme } from "../theme/useGalaxyTheme.js";
|
|
2
|
+
import { brandMarkAriaProps } from "../brand/brandMark.js";
|
|
3
|
+
import GalaxyLogomark from "../brand/GalaxyLogomark.js";
|
|
4
|
+
import { usePrefersReducedMotion } from "../hooks/usePrefersReducedMotion.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { styled } from "@linaria/react";
|
|
7
|
+
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { cx } from "@linaria/core";
|
|
10
|
+
//#region src/three/GalaxyLogomark3D.tsx
|
|
11
|
+
/**
|
|
12
|
+
* The Galaxy mark as a lit, glossy 3D object for hero moments (a landing hero, a sign-in splash).
|
|
13
|
+
* It can spin slowly, flip when the pointer arrives, and be dragged to orbit. Its material takes
|
|
14
|
+
* the monochrome fill (`solid.primary.background`, read as resolved hex from `useGalaxyTheme()`
|
|
15
|
+
* because WebGL needs a number, not a CSS variable). It always starts as the flat `GalaxyLogomark`: the server and first
|
|
16
|
+
* client render are the static mark; after mount, if WebGL is available and motion is not reduced,
|
|
17
|
+
* three.js (an optional peer) and the model load lazily and the 3D mark replaces the flat one in
|
|
18
|
+
* the same box. This module imports nothing from three.js; the scene lives behind one `import()`.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* At the 1.x camera (z = 4, fov 45°, mesh scale 0.088) the resting mesh spans ≈ 76% of the
|
|
22
|
+
* canvas; the flat fallback is drawn at that share so the swap has no size jump.
|
|
23
|
+
*/
|
|
24
|
+
var FALLBACK_SCALE = .76;
|
|
25
|
+
/** The box: a square of the requested size; the flat mark centers in it, the canvas covers it. */
|
|
26
|
+
var Root = /*#__PURE__*/ styled("span")({
|
|
27
|
+
name: "Root",
|
|
28
|
+
class: "gx-GalaxyLogomark3D-r1dn73it",
|
|
29
|
+
propsAsIs: false
|
|
30
|
+
});
|
|
31
|
+
/** `isInteractive`: the grab cursor while orbiting is possible. */
|
|
32
|
+
var INTERACTIVE_CSS = "gx-GalaxyLogomark3D-INTERACTIVE_CSS-i13nzb8h";
|
|
33
|
+
/** The WebGL canvas fills the box. */
|
|
34
|
+
var CANVAS_CSS = "gx-GalaxyLogomark3D-CANVAS_CSS-c11hevag";
|
|
35
|
+
/** Until the first frame is drawn, the canvas is laid out but not shown. */
|
|
36
|
+
var CANVAS_HIDDEN_CSS = "gx-GalaxyLogomark3D-CANVAS_HIDDEN_CSS-c1eyhbl2";
|
|
37
|
+
/** Whether this browser can create a WebGL context. Called in an effect, never at import. */
|
|
38
|
+
function isWebGLSupported() {
|
|
39
|
+
try {
|
|
40
|
+
const canvas = document.createElement("canvas");
|
|
41
|
+
return (canvas.getContext("webgl2") ?? canvas.getContext("webgl")) !== null;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** The Galaxy mark in 3D, painted `text.primary`. Decorative unless `ariaLabel` is set. */
|
|
47
|
+
var GalaxyLogomark3D = forwardRef(function GalaxyLogomark3D({ size = 128, isInverse = false, isAutoRotate = false, isInteractive = false, isHoverable = false, speed = 2, ariaLabel, id, className, style, ...rest }, ref) {
|
|
48
|
+
const { theme } = useGalaxyTheme();
|
|
49
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
50
|
+
const [isWebGLAvailable, setIsWebGLAvailable] = useState(false);
|
|
51
|
+
const [isReady, setIsReady] = useState(false);
|
|
52
|
+
const canvasRef = useRef(null);
|
|
53
|
+
const sceneRef = useRef(null);
|
|
54
|
+
const color = isInverse ? theme.color.background.base : theme.color.solid.primary.background;
|
|
55
|
+
const options = {
|
|
56
|
+
size,
|
|
57
|
+
color,
|
|
58
|
+
isAutoRotate,
|
|
59
|
+
isInteractive,
|
|
60
|
+
isHoverable,
|
|
61
|
+
speed
|
|
62
|
+
};
|
|
63
|
+
const optionsRef = useRef(options);
|
|
64
|
+
optionsRef.current = options;
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
setIsWebGLAvailable(isWebGLSupported());
|
|
67
|
+
}, []);
|
|
68
|
+
const canRender3D = isWebGLAvailable && !prefersReducedMotion;
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const canvas = canvasRef.current;
|
|
71
|
+
if (!canRender3D || canvas === null) return;
|
|
72
|
+
let isCancelled = false;
|
|
73
|
+
const onContextLost = () => setIsReady(false);
|
|
74
|
+
canvas.addEventListener("webglcontextlost", onContextLost);
|
|
75
|
+
import("./galaxyLogomark3DScene.js").then(({ mountGalaxyLogomark3DScene }) => {
|
|
76
|
+
if (isCancelled) return;
|
|
77
|
+
try {
|
|
78
|
+
sceneRef.current = mountGalaxyLogomark3DScene(canvas, optionsRef.current, () => {
|
|
79
|
+
if (!isCancelled) setIsReady(true);
|
|
80
|
+
});
|
|
81
|
+
} catch {}
|
|
82
|
+
}, () => {});
|
|
83
|
+
return () => {
|
|
84
|
+
isCancelled = true;
|
|
85
|
+
canvas.removeEventListener("webglcontextlost", onContextLost);
|
|
86
|
+
sceneRef.current?.dispose();
|
|
87
|
+
sceneRef.current = null;
|
|
88
|
+
setIsReady(false);
|
|
89
|
+
};
|
|
90
|
+
}, [canRender3D]);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
sceneRef.current?.update({
|
|
93
|
+
size,
|
|
94
|
+
color,
|
|
95
|
+
isAutoRotate,
|
|
96
|
+
isInteractive,
|
|
97
|
+
isHoverable,
|
|
98
|
+
speed
|
|
99
|
+
});
|
|
100
|
+
}, [
|
|
101
|
+
size,
|
|
102
|
+
color,
|
|
103
|
+
isAutoRotate,
|
|
104
|
+
isInteractive,
|
|
105
|
+
isHoverable,
|
|
106
|
+
speed
|
|
107
|
+
]);
|
|
108
|
+
const aria = brandMarkAriaProps(ariaLabel ?? rest["aria-label"]);
|
|
109
|
+
const variables = { "--gx-galaxy-logomark-3d-size": `${size}px` };
|
|
110
|
+
return /* @__PURE__ */ jsxs(Root, {
|
|
111
|
+
ref,
|
|
112
|
+
id,
|
|
113
|
+
role: aria.role,
|
|
114
|
+
"aria-label": aria["aria-label"],
|
|
115
|
+
"aria-hidden": aria["aria-hidden"],
|
|
116
|
+
...rest,
|
|
117
|
+
className: cx(isInteractive && INTERACTIVE_CSS, className),
|
|
118
|
+
style: {
|
|
119
|
+
...variables,
|
|
120
|
+
...style
|
|
121
|
+
},
|
|
122
|
+
children: [!isReady && /* @__PURE__ */ jsx(GalaxyLogomark, {
|
|
123
|
+
size: Math.round(size * FALLBACK_SCALE),
|
|
124
|
+
isInverse
|
|
125
|
+
}), canRender3D && /* @__PURE__ */ jsx("canvas", {
|
|
126
|
+
ref: canvasRef,
|
|
127
|
+
"aria-hidden": true,
|
|
128
|
+
className: cx(CANVAS_CSS, !isReady && CANVAS_HIDDEN_CSS)
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
GalaxyLogomark3D.displayName = "GalaxyLogomark3D";
|
|
133
|
+
//#endregion
|
|
134
|
+
export { GalaxyLogomark3D as default };
|