@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.
Files changed (540) hide show
  1. package/README.md +47 -50
  2. package/biome/index.json +74 -0
  3. package/biome/plugins/no-hex-literal.grit +20 -0
  4. package/biome/plugins/no-inline-style.grit +13 -0
  5. package/biome/plugins/no-margin.grit +9 -0
  6. package/biome/plugins/warn/no-hex-literal.grit +23 -0
  7. package/biome/plugins/warn/no-inline-style.grit +13 -0
  8. package/biome/plugins/warn/no-margin.grit +9 -0
  9. package/dist/a11y/FocusScope.d.ts +44 -0
  10. package/dist/a11y/FocusScope.js +229 -0
  11. package/dist/a11y/VisuallyHidden.d.ts +21 -0
  12. package/dist/a11y/VisuallyHidden.js +30 -0
  13. package/dist/avatar/Avatar.d.ts +56 -14
  14. package/dist/avatar/Avatar.js +250 -96
  15. package/dist/avatar/AvatarGroup.d.ts +43 -0
  16. package/dist/avatar/AvatarGroup.js +153 -0
  17. package/dist/backgrounds/GridBackground.d.ts +48 -0
  18. package/dist/backgrounds/GridBackground.js +146 -0
  19. package/dist/beacons/Beacon.d.ts +86 -22
  20. package/dist/beacons/Beacon.js +170 -47
  21. package/dist/brand/GalaxyFilamentWordmark.d.ts +30 -0
  22. package/dist/brand/GalaxyFilamentWordmark.js +39 -0
  23. package/dist/brand/GalaxyLogomark.d.ts +26 -0
  24. package/dist/brand/GalaxyLogomark.js +41 -0
  25. package/dist/brand/GalaxyLogomarkAnimation.d.ts +36 -0
  26. package/dist/brand/GalaxyLogomarkAnimation.js +107 -0
  27. package/dist/brand/GalaxyWordmark.d.ts +30 -0
  28. package/dist/brand/GalaxyWordmark.js +63 -0
  29. package/dist/brand/assets/galaxy-logomark-animation.js +136678 -0
  30. package/dist/brand/brandMark.d.ts +26 -0
  31. package/dist/brand/brandMark.js +35 -0
  32. package/dist/buttons/Button.d.ts +148 -59
  33. package/dist/buttons/Button.js +437 -227
  34. package/dist/buttons/ButtonGroup.d.ts +38 -0
  35. package/dist/buttons/ButtonGroup.js +68 -0
  36. package/dist/buttons/CopyButton.d.ts +77 -0
  37. package/dist/buttons/CopyButton.js +65 -0
  38. package/dist/charts/AreaChart.d.ts +49 -0
  39. package/dist/charts/AreaChart.js +31 -0
  40. package/dist/charts/BarChart.d.ts +54 -67
  41. package/dist/charts/BarChart.js +160 -124
  42. package/dist/charts/ChartAxis.d.ts +35 -40
  43. package/dist/charts/ChartAxis.js +114 -90
  44. package/dist/charts/ChartCategoryTargets.d.ts +12 -26
  45. package/dist/charts/ChartCategoryTargets.js +33 -20
  46. package/dist/charts/ChartFrame.d.ts +71 -116
  47. package/dist/charts/ChartFrame.js +306 -97
  48. package/dist/charts/ChartGroupProvider.d.ts +30 -41
  49. package/dist/charts/ChartGroupProvider.js +20 -7
  50. package/dist/charts/ChartLegend.d.ts +37 -48
  51. package/dist/charts/ChartLegend.js +243 -125
  52. package/dist/charts/ChartMarkTargets.d.ts +12 -28
  53. package/dist/charts/ChartMarkTargets.js +34 -20
  54. package/dist/charts/ChartPrimitives.d.ts +50 -305
  55. package/dist/charts/ChartPrimitives.js +65 -413
  56. package/dist/charts/ChartTooltip.d.ts +20 -26
  57. package/dist/charts/ChartTooltip.js +77 -40
  58. package/dist/charts/Heatmap.d.ts +35 -0
  59. package/dist/charts/Heatmap.js +307 -0
  60. package/dist/charts/LineChart.d.ts +54 -47
  61. package/dist/charts/LineChart.js +174 -121
  62. package/dist/charts/PieChart.d.ts +32 -53
  63. package/dist/charts/PieChart.js +159 -136
  64. package/dist/charts/Sparkline.d.ts +107 -0
  65. package/dist/charts/Sparkline.js +244 -0
  66. package/dist/charts/StatChart.d.ts +37 -13
  67. package/dist/charts/StatChart.js +82 -35
  68. package/dist/charts/barChartGeometry.d.ts +138 -86
  69. package/dist/charts/barChartGeometry.js +122 -101
  70. package/dist/charts/barChartLegend.d.ts +14 -18
  71. package/dist/charts/barChartLegend.js +18 -13
  72. package/dist/charts/chartFormat.d.ts +12 -18
  73. package/dist/charts/chartFormat.js +20 -52
  74. package/dist/charts/chartPalette.d.ts +33 -0
  75. package/dist/charts/chartPalette.js +68 -0
  76. package/dist/charts/chartScales.d.ts +41 -108
  77. package/dist/charts/chartScales.js +62 -128
  78. package/dist/charts/chartSelection.d.ts +15 -0
  79. package/dist/charts/chartSelection.js +22 -0
  80. package/dist/charts/constants.d.ts +100 -256
  81. package/dist/charts/constants.js +109 -275
  82. package/dist/charts/heatmapGeometry.d.ts +95 -0
  83. package/dist/charts/heatmapGeometry.js +155 -0
  84. package/dist/charts/lineChartGeometry.d.ts +108 -58
  85. package/dist/charts/lineChartGeometry.js +120 -78
  86. package/dist/charts/pieChartGeometry.d.ts +66 -40
  87. package/dist/charts/pieChartGeometry.js +68 -38
  88. package/dist/charts/types.d.ts +206 -466
  89. package/dist/charts/types.js +55 -144
  90. package/dist/charts/useCartesianChartLayout.d.ts +28 -59
  91. package/dist/charts/useCartesianChartLayout.js +47 -32
  92. package/dist/charts/useChartDimensions.d.ts +19 -40
  93. package/dist/charts/useChartDimensions.js +40 -56
  94. package/dist/charts/useChartFormatters.d.ts +6 -15
  95. package/dist/charts/useChartFormatters.js +4 -9
  96. package/dist/charts/useChartInteraction.d.ts +69 -116
  97. package/dist/charts/useChartInteraction.js +148 -78
  98. package/dist/charts/useChartTooltipPosition.d.ts +29 -39
  99. package/dist/charts/useChartTooltipPosition.js +14 -5
  100. package/dist/charts/useSeriesColorResolver.d.ts +11 -33
  101. package/dist/charts/useSeriesColorResolver.js +19 -12
  102. package/dist/chips/Chip.d.ts +155 -44
  103. package/dist/chips/Chip.js +329 -155
  104. package/dist/chips/ChipGroup.d.ts +53 -0
  105. package/dist/chips/ChipGroup.js +98 -0
  106. package/dist/drawer/Drawer.d.ts +83 -17
  107. package/dist/drawer/Drawer.js +399 -65
  108. package/dist/dropdown/Dropdown.d.ts +80 -63
  109. package/dist/dropdown/Dropdown.js +127 -129
  110. package/dist/editor/CodeEditor.d.ts +119 -40
  111. package/dist/editor/CodeEditor.js +490 -400
  112. package/dist/editor/CodeEditorReactWidget.d.ts +20 -17
  113. package/dist/editor/CodeEditorReactWidget.js +28 -21
  114. package/dist/feedback/Alert.d.ts +49 -0
  115. package/dist/feedback/Alert.js +172 -0
  116. package/dist/feedback/EmptyState.d.ts +39 -0
  117. package/dist/feedback/EmptyState.js +109 -0
  118. package/dist/feedback/ProgressBar.d.ts +125 -0
  119. package/dist/feedback/ProgressBar.js +183 -0
  120. package/dist/feedback/ProgressCircle.d.ts +99 -0
  121. package/dist/feedback/ProgressCircle.js +187 -0
  122. package/dist/feedback/Skeleton.d.ts +69 -0
  123. package/dist/feedback/Skeleton.js +130 -0
  124. package/dist/feedback/Spinner.d.ts +63 -0
  125. package/dist/feedback/Spinner.js +141 -0
  126. package/dist/fonts.css +70 -0
  127. package/dist/hooks/internal/useIsClient.d.ts +2 -0
  128. package/dist/hooks/internal/useIsClient.js +14 -0
  129. package/dist/hooks/useClipboard.d.ts +19 -0
  130. package/dist/hooks/useClipboard.js +45 -0
  131. package/dist/hooks/useControlledOpenState.d.ts +21 -0
  132. package/dist/hooks/useControlledOpenState.js +19 -0
  133. package/dist/hooks/useControlledState.d.ts +19 -0
  134. package/dist/hooks/useControlledState.js +22 -0
  135. package/dist/hooks/useDebouncedValue.d.ts +14 -0
  136. package/dist/hooks/useDebouncedValue.js +33 -0
  137. package/dist/hooks/useDisclosure.d.ts +26 -0
  138. package/dist/hooks/useDisclosure.js +36 -0
  139. package/dist/hooks/useDismiss.d.ts +23 -27
  140. package/dist/hooks/useDismiss.js +39 -27
  141. package/dist/hooks/useElementClientSize.d.ts +10 -10
  142. package/dist/hooks/useElementClientSize.js +8 -11
  143. package/dist/hooks/useElementWidth.d.ts +6 -13
  144. package/dist/hooks/useElementWidth.js +6 -14
  145. package/dist/hooks/useField.d.ts +47 -0
  146. package/dist/hooks/useField.js +40 -0
  147. package/dist/hooks/useHotkey.d.ts +77 -0
  148. package/dist/hooks/useHotkey.js +246 -0
  149. package/dist/hooks/useIsMac.d.ts +12 -0
  150. package/dist/hooks/useIsMac.js +27 -0
  151. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +17 -0
  152. package/dist/hooks/useIsomorphicLayoutEffect.js +20 -0
  153. package/dist/hooks/useLocalStorage.d.ts +28 -0
  154. package/dist/hooks/useLocalStorage.js +145 -0
  155. package/dist/hooks/useMediaQuery.d.ts +11 -0
  156. package/dist/hooks/useMediaQuery.js +23 -0
  157. package/dist/hooks/usePrefersReducedMotion.d.ts +12 -0
  158. package/dist/hooks/usePrefersReducedMotion.js +25 -0
  159. package/dist/hooks/useResize.d.ts +42 -62
  160. package/dist/hooks/useResize.js +43 -31
  161. package/dist/icons/Icon.d.ts +64 -37
  162. package/dist/icons/Icon.js +96 -37
  163. package/dist/icons/internal/IconSlot.d.ts +10 -0
  164. package/dist/icons/internal/IconSlot.js +32 -0
  165. package/dist/inputs/CheckboxGroup.d.ts +115 -0
  166. package/dist/inputs/CheckboxGroup.js +183 -0
  167. package/dist/inputs/CheckboxInput.d.ts +98 -28
  168. package/dist/inputs/CheckboxInput.js +218 -88
  169. package/dist/inputs/ColorInput.d.ts +115 -29
  170. package/dist/inputs/ColorInput.js +748 -326
  171. package/dist/inputs/CopyInput.d.ts +49 -20
  172. package/dist/inputs/CopyInput.js +57 -49
  173. package/dist/inputs/CronInput.d.ts +94 -0
  174. package/dist/inputs/CronInput.js +618 -0
  175. package/dist/inputs/DateInput.d.ts +175 -28
  176. package/dist/inputs/DateInput.js +1109 -451
  177. package/dist/inputs/DurationInput.d.ts +101 -0
  178. package/dist/inputs/DurationInput.js +441 -0
  179. package/dist/inputs/Field.d.ts +75 -0
  180. package/dist/inputs/Field.js +247 -0
  181. package/dist/inputs/Fieldset.d.ts +53 -0
  182. package/dist/inputs/Fieldset.js +149 -0
  183. package/dist/inputs/FileInput.d.ts +110 -0
  184. package/dist/inputs/FileInput.js +476 -0
  185. package/dist/inputs/Input.d.ts +148 -187
  186. package/dist/inputs/Input.js +339 -259
  187. package/dist/inputs/KeyValueInput.d.ts +120 -0
  188. package/dist/inputs/KeyValueInput.js +383 -0
  189. package/dist/inputs/MultiSelectInput.d.ts +165 -54
  190. package/dist/inputs/MultiSelectInput.js +175 -559
  191. package/dist/inputs/NumberInput.d.ts +65 -9
  192. package/dist/inputs/NumberInput.js +197 -40
  193. package/dist/inputs/PasswordInput.d.ts +17 -12
  194. package/dist/inputs/PasswordInput.js +33 -33
  195. package/dist/inputs/PinInput.d.ts +117 -0
  196. package/dist/inputs/PinInput.js +364 -0
  197. package/dist/inputs/RadioGroup.d.ts +115 -0
  198. package/dist/inputs/RadioGroup.js +179 -0
  199. package/dist/inputs/RadioInput.d.ts +87 -24
  200. package/dist/inputs/RadioInput.js +182 -95
  201. package/dist/inputs/SearchInput.d.ts +66 -0
  202. package/dist/inputs/SearchInput.js +156 -0
  203. package/dist/inputs/SelectInput.d.ts +195 -55
  204. package/dist/inputs/SelectInput.js +1308 -446
  205. package/dist/inputs/SliderInput.d.ts +150 -30
  206. package/dist/inputs/SliderInput.js +441 -186
  207. package/dist/inputs/SwitchInput.d.ts +109 -0
  208. package/dist/inputs/SwitchInput.js +248 -0
  209. package/dist/inputs/TagInput.d.ts +117 -0
  210. package/dist/inputs/TagInput.js +408 -0
  211. package/dist/inputs/TextAreaInput.d.ts +146 -44
  212. package/dist/inputs/TextAreaInput.js +298 -198
  213. package/dist/inputs/TextInput.d.ts +4 -13
  214. package/dist/inputs/TextInput.js +13 -48
  215. package/dist/inputs/ToggleInput.d.ts +120 -22
  216. package/dist/inputs/ToggleInput.js +262 -116
  217. package/dist/inputs/internal/bareField.d.ts +18 -0
  218. package/dist/inputs/internal/bareField.js +38 -0
  219. package/dist/inputs/internal/devWarn.d.ts +7 -0
  220. package/dist/inputs/internal/devWarn.js +30 -0
  221. package/dist/inputs/internal/fieldFrame.d.ts +34 -0
  222. package/dist/inputs/internal/fieldFrame.js +64 -0
  223. package/dist/inputs/internal/fieldWiring.d.ts +50 -0
  224. package/dist/inputs/internal/fieldWiring.js +38 -0
  225. package/dist/inputs/internal/innerButton.d.ts +2 -0
  226. package/dist/inputs/internal/innerButton.js +24 -0
  227. package/dist/inputs/internal/ownField.d.ts +45 -0
  228. package/dist/inputs/internal/ownField.js +58 -0
  229. package/dist/inputs/internal/predicates.d.ts +9 -0
  230. package/dist/inputs/internal/predicates.js +11 -0
  231. package/dist/inputs/internal/useComboboxPopover.d.ts +46 -0
  232. package/dist/inputs/internal/useComboboxPopover.js +92 -0
  233. package/dist/json/JsonViewer.d.ts +62 -0
  234. package/dist/json/JsonViewer.js +483 -0
  235. package/dist/layout/Box.d.ts +87 -0
  236. package/dist/layout/Box.js +109 -0
  237. package/dist/layout/Divider.d.ts +25 -0
  238. package/dist/layout/Divider.js +70 -0
  239. package/dist/layout/Flex.d.ts +139 -0
  240. package/dist/layout/Flex.js +165 -0
  241. package/dist/layout/FlexItem.d.ts +72 -0
  242. package/dist/layout/FlexItem.js +84 -0
  243. package/dist/layout/Grid.d.ts +140 -0
  244. package/dist/layout/Grid.js +178 -0
  245. package/dist/layout/Portal.d.ts +29 -0
  246. package/dist/layout/Portal.js +27 -0
  247. package/dist/layout/ResizablePanels.d.ts +88 -0
  248. package/dist/layout/ResizablePanels.js +198 -0
  249. package/dist/layout/ResizeHandle.d.ts +48 -0
  250. package/dist/layout/ResizeHandle.js +143 -0
  251. package/dist/layout/ScrollArea.d.ts +30 -0
  252. package/dist/layout/ScrollArea.js +138 -0
  253. package/dist/links/Link.d.ts +101 -1
  254. package/dist/links/Link.js +166 -4
  255. package/dist/lists/BulletedList.d.ts +25 -7
  256. package/dist/lists/BulletedList.js +72 -27
  257. package/dist/lists/DescriptionList.d.ts +91 -0
  258. package/dist/lists/DescriptionList.js +147 -0
  259. package/dist/menu/ContextMenu.d.ts +64 -0
  260. package/dist/menu/ContextMenu.js +34 -0
  261. package/dist/menu/Menu.d.ts +280 -0
  262. package/dist/menu/Menu.js +1003 -0
  263. package/dist/modal/ConfirmDialog.d.ts +55 -0
  264. package/dist/modal/ConfirmDialog.js +151 -0
  265. package/dist/modal/Modal.d.ts +64 -14
  266. package/dist/modal/Modal.js +189 -48
  267. package/dist/navigation/Breadcrumbs.d.ts +65 -0
  268. package/dist/navigation/Breadcrumbs.js +243 -0
  269. package/dist/navigation/CommandPalette.d.ts +83 -0
  270. package/dist/navigation/CommandPalette.js +509 -0
  271. package/dist/navigation/Pagination.d.ts +87 -0
  272. package/dist/navigation/Pagination.js +300 -0
  273. package/dist/navigation/SidebarNav.d.ts +107 -0
  274. package/dist/navigation/SidebarNav.js +341 -0
  275. package/dist/navigation/Stepper.d.ts +52 -0
  276. package/dist/navigation/Stepper.js +207 -0
  277. package/dist/navigation/Tabs.d.ts +113 -0
  278. package/dist/navigation/Tabs.js +543 -0
  279. package/dist/navigation/Topbar.d.ts +20 -0
  280. package/dist/navigation/Topbar.js +62 -0
  281. package/dist/overlay/OverlayProvider.d.ts +28 -32
  282. package/dist/overlay/OverlayProvider.js +42 -93
  283. package/dist/overlay/useOverlay.d.ts +88 -12
  284. package/dist/overlay/useOverlay.js +220 -43
  285. package/dist/overlays/Popover.d.ts +114 -0
  286. package/dist/overlays/Popover.js +389 -0
  287. package/dist/shapes/Circle.d.ts +84 -8
  288. package/dist/shapes/Circle.js +122 -20
  289. package/dist/shapes/Square.d.ts +84 -8
  290. package/dist/shapes/Square.js +123 -20
  291. package/dist/styles/mixins.d.ts +35 -0
  292. package/dist/styles/mixins.js +60 -0
  293. package/dist/styles.css +1 -202
  294. package/dist/table/InfiniteSpreadsheet.d.ts +140 -10
  295. package/dist/table/InfiniteSpreadsheet.js +762 -225
  296. package/dist/table/InfiniteTable.d.ts +116 -14
  297. package/dist/table/InfiniteTable.js +287 -429
  298. package/dist/table/SpreadsheetCellEditor.d.ts +54 -6
  299. package/dist/table/SpreadsheetCellEditor.js +163 -84
  300. package/dist/table/TableCore.d.ts +252 -0
  301. package/dist/table/TableCore.js +1082 -0
  302. package/dist/table/VirtualizedInfiniteTable.d.ts +104 -14
  303. package/dist/table/VirtualizedInfiniteTable.js +280 -219
  304. package/dist/table/types.d.ts +66 -244
  305. package/dist/table/types.js +0 -51
  306. package/dist/table/useInfiniteScrollSentinel.d.ts +25 -21
  307. package/dist/table/useInfiniteScrollSentinel.js +38 -30
  308. package/dist/table/useSpreadsheetCellNavigation.d.ts +44 -0
  309. package/dist/table/useSpreadsheetCellNavigation.js +141 -0
  310. package/dist/table/useTableColumnLayout.d.ts +90 -25
  311. package/dist/table/useTableColumnLayout.js +255 -50
  312. package/dist/table/useTableKeyboardNavigation.d.ts +32 -21
  313. package/dist/table/useTableKeyboardNavigation.js +95 -71
  314. package/dist/table/useTableRowSelection.d.ts +24 -25
  315. package/dist/table/useTableRowSelection.js +57 -84
  316. package/dist/table/useTableVirtualizer.d.ts +20 -0
  317. package/dist/table/useTableVirtualizer.js +48 -0
  318. package/dist/text/Bold.d.ts +5 -6
  319. package/dist/text/Bold.js +16 -15
  320. package/dist/text/Code.d.ts +5 -6
  321. package/dist/text/Code.js +16 -25
  322. package/dist/text/CodeBlock.d.ts +77 -0
  323. package/dist/text/CodeBlock.js +373 -0
  324. package/dist/text/EditableText.d.ts +55 -15
  325. package/dist/text/EditableText.js +153 -135
  326. package/dist/text/Ellipsis.d.ts +34 -8
  327. package/dist/text/Ellipsis.js +55 -23
  328. package/dist/text/Kbd.d.ts +72 -0
  329. package/dist/text/Kbd.js +284 -0
  330. package/dist/text/MarkdownText.d.ts +27 -10
  331. package/dist/text/MarkdownText.js +317 -300
  332. package/dist/text/RequiredMarker.d.ts +17 -5
  333. package/dist/text/RequiredMarker.js +34 -36
  334. package/dist/text/Selectable.d.ts +5 -6
  335. package/dist/text/Selectable.js +16 -13
  336. package/dist/text/Span.d.ts +82 -0
  337. package/dist/text/Span.js +115 -0
  338. package/dist/text/Text.d.ts +128 -41
  339. package/dist/text/Text.js +209 -76
  340. package/dist/theme/GalaxyProvider.d.ts +75 -0
  341. package/dist/theme/GalaxyProvider.js +223 -0
  342. package/dist/theme/ThemeSwitcher.d.ts +52 -0
  343. package/dist/theme/ThemeSwitcher.js +94 -0
  344. package/dist/theme/enums.d.ts +118 -0
  345. package/dist/theme/enums.js +144 -0
  346. package/dist/theme/tokens/dark.d.ts +2 -0
  347. package/dist/theme/tokens/dark.js +275 -0
  348. package/dist/theme/tokens/generate.d.ts +15 -0
  349. package/dist/theme/tokens/generate.js +47 -0
  350. package/dist/theme/tokens/light.d.ts +2 -0
  351. package/dist/theme/tokens/light.js +274 -0
  352. package/dist/theme/tokens/palette.d.ts +14 -0
  353. package/dist/theme/tokens/palette.js +153 -0
  354. package/dist/theme/tokens/scales.d.ts +26 -0
  355. package/dist/theme/tokens/scales.js +154 -0
  356. package/dist/theme/tokens/t.d.ts +3 -0
  357. package/dist/theme/tokens/t.js +25 -0
  358. package/dist/theme/tokens/types.d.ts +189 -0
  359. package/dist/theme/tokens/types.js +0 -0
  360. package/dist/theme/useGalaxyTheme.d.ts +46 -0
  361. package/dist/theme/useGalaxyTheme.js +36 -0
  362. package/dist/theme/useInverseScope.d.ts +18 -0
  363. package/dist/theme/useInverseScope.js +33 -0
  364. package/dist/three/GalaxyLogomark3D.d.ts +46 -0
  365. package/dist/three/GalaxyLogomark3D.js +134 -0
  366. package/dist/three/assets/galaxy-logomark.js +4 -0
  367. package/dist/three/galaxyLogomark3DScene.d.ts +27 -0
  368. package/dist/three/galaxyLogomark3DScene.js +165 -0
  369. package/dist/timeline/Timeline.d.ts +120 -0
  370. package/dist/timeline/Timeline.js +301 -0
  371. package/dist/toast/Toast.d.ts +43 -19
  372. package/dist/toast/Toast.js +130 -89
  373. package/dist/toast/ToastProvider.d.ts +23 -23
  374. package/dist/toast/ToastProvider.js +298 -101
  375. package/dist/toast/ToastViewport.d.ts +12 -0
  376. package/dist/toast/ToastViewport.js +210 -0
  377. package/dist/toast/useToast.d.ts +139 -5
  378. package/dist/toast/useToast.js +15 -13
  379. package/dist/tokens.css +654 -0
  380. package/dist/tooltip/Tooltip.d.ts +64 -44
  381. package/dist/tooltip/Tooltip.js +280 -73
  382. package/dist/tooltip/internal/LazyTooltip.d.ts +7 -0
  383. package/dist/tooltip/internal/LazyTooltip.js +53 -0
  384. package/dist/transform/Fade.d.ts +33 -11
  385. package/dist/transform/Fade.js +71 -19
  386. package/dist/transform/Flasher.d.ts +25 -0
  387. package/dist/transform/Flasher.js +39 -0
  388. package/dist/transform/Rotate.d.ts +24 -12
  389. package/dist/transform/Rotate.js +36 -22
  390. package/dist/transform/ScaleFade.d.ts +36 -11
  391. package/dist/transform/ScaleFade.js +86 -28
  392. package/dist/transform/internal/CollapseMotion.d.ts +10 -0
  393. package/dist/transform/internal/CollapseMotion.js +65 -0
  394. package/dist/tree/Tree.d.ts +85 -0
  395. package/dist/tree/Tree.js +387 -0
  396. package/dist/tree/treeRow.d.ts +39 -0
  397. package/dist/tree/treeRow.js +75 -0
  398. package/dist/utils/colors.d.ts +46 -13
  399. package/dist/utils/colors.js +92 -34
  400. package/dist/utils/css.d.ts +23 -0
  401. package/dist/utils/css.js +30 -0
  402. package/dist/utils/format.d.ts +58 -0
  403. package/dist/utils/format.js +220 -0
  404. package/dist/vite/index.d.ts +16 -0
  405. package/dist/vite/index.js +52 -0
  406. package/dist/widget/Widget.d.ts +164 -48
  407. package/dist/widget/Widget.js +335 -96
  408. package/dist/widget/WidgetGroup.d.ts +36 -0
  409. package/dist/widget/WidgetGroup.js +103 -0
  410. package/package.json +855 -157
  411. package/dist/accordion/Accordion.d.ts +0 -54
  412. package/dist/accordion/Accordion.js +0 -183
  413. package/dist/assets/components/GalaxyFilamentWordmarkDark.d.ts +0 -3
  414. package/dist/assets/components/GalaxyFilamentWordmarkDark.js +0 -14
  415. package/dist/assets/components/GalaxyFilamentWordmarkLight.d.ts +0 -3
  416. package/dist/assets/components/GalaxyFilamentWordmarkLight.js +0 -14
  417. package/dist/assets/components/GalaxyLogomarkDark.d.ts +0 -3
  418. package/dist/assets/components/GalaxyLogomarkDark.js +0 -11
  419. package/dist/assets/components/GalaxyLogomarkLight.d.ts +0 -3
  420. package/dist/assets/components/GalaxyLogomarkLight.js +0 -17
  421. package/dist/assets/components/GalaxyWordmarkDark.d.ts +0 -3
  422. package/dist/assets/components/GalaxyWordmarkDark.js +0 -15
  423. package/dist/assets/components/GalaxyWordmarkLight.d.ts +0 -3
  424. package/dist/assets/components/GalaxyWordmarkLight.js +0 -28
  425. package/dist/assets/models/galaxy-animation.js +0 -136666
  426. package/dist/assets/models/galaxy-logomark.js +0 -4
  427. package/dist/avatar/AvatarShimmer.d.ts +0 -30
  428. package/dist/avatar/AvatarShimmer.js +0 -22
  429. package/dist/backgrounds/CellGridBackground.d.ts +0 -24
  430. package/dist/backgrounds/CellGridBackground.js +0 -44
  431. package/dist/backgrounds/CrossGridBackground.d.ts +0 -26
  432. package/dist/backgrounds/CrossGridBackground.js +0 -49
  433. package/dist/backgrounds/DotGridBackground.d.ts +0 -24
  434. package/dist/backgrounds/DotGridBackground.js +0 -47
  435. package/dist/badge/Badge.d.ts +0 -42
  436. package/dist/badge/Badge.js +0 -99
  437. package/dist/charts/ChartEmptyState.d.ts +0 -17
  438. package/dist/charts/ChartEmptyState.js +0 -29
  439. package/dist/charts/ProgressBar.d.ts +0 -29
  440. package/dist/charts/ProgressBar.js +0 -65
  441. package/dist/charts/chartTheme.d.ts +0 -18
  442. package/dist/charts/chartTheme.js +0 -26
  443. package/dist/containers/FlexItem.d.ts +0 -50
  444. package/dist/containers/FlexItem.js +0 -91
  445. package/dist/containers/FlexWrapper.d.ts +0 -96
  446. package/dist/containers/FlexWrapper.js +0 -143
  447. package/dist/containers/GridWrapper.d.ts +0 -79
  448. package/dist/containers/GridWrapper.js +0 -125
  449. package/dist/containers/Spacing.d.ts +0 -23
  450. package/dist/containers/Spacing.js +0 -59
  451. package/dist/containers/Wrapper.d.ts +0 -26
  452. package/dist/containers/Wrapper.js +0 -54
  453. package/dist/dividers/HorizontalDivider.d.ts +0 -7
  454. package/dist/dividers/HorizontalDivider.js +0 -39
  455. package/dist/dividers/VerticalDivider.d.ts +0 -6
  456. package/dist/dividers/VerticalDivider.js +0 -21
  457. package/dist/icons/GalaxyFilamentWordmark.d.ts +0 -11
  458. package/dist/icons/GalaxyFilamentWordmark.js +0 -25
  459. package/dist/icons/GalaxyLogomark.d.ts +0 -13
  460. package/dist/icons/GalaxyLogomark.js +0 -27
  461. package/dist/icons/GalaxyLogomark3D.d.ts +0 -56
  462. package/dist/icons/GalaxyLogomark3D.js +0 -319
  463. package/dist/icons/GalaxyLogomarkAnimation.d.ts +0 -18
  464. package/dist/icons/GalaxyLogomarkAnimation.js +0 -48
  465. package/dist/icons/GalaxyWordmark.d.ts +0 -11
  466. package/dist/icons/GalaxyWordmark.js +0 -25
  467. package/dist/inputs/MultiTextInput.d.ts +0 -32
  468. package/dist/inputs/MultiTextInput.js +0 -180
  469. package/dist/inputs/SwitcherInput.d.ts +0 -30
  470. package/dist/inputs/SwitcherInput.js +0 -81
  471. package/dist/inputs/hooks.d.ts +0 -10
  472. package/dist/inputs/hooks.js +0 -22
  473. package/dist/overlay/constants.d.ts +0 -28
  474. package/dist/overlay/constants.js +0 -37
  475. package/dist/resizable/HorizontalResizeHandle.d.ts +0 -17
  476. package/dist/resizable/HorizontalResizeHandle.js +0 -38
  477. package/dist/resizable/VerticalResizeHandle.d.ts +0 -18
  478. package/dist/resizable/VerticalResizeHandle.js +0 -39
  479. package/dist/table/SpreadsheetCell.d.ts +0 -21
  480. package/dist/table/SpreadsheetCell.js +0 -71
  481. package/dist/table/SpreadsheetHeaderCell.d.ts +0 -23
  482. package/dist/table/SpreadsheetHeaderCell.js +0 -91
  483. package/dist/table/SpreadsheetMenuItem.d.ts +0 -14
  484. package/dist/table/SpreadsheetMenuItem.js +0 -33
  485. package/dist/table/SpreadsheetPrimitives.d.ts +0 -172
  486. package/dist/table/SpreadsheetPrimitives.js +0 -105
  487. package/dist/table/SpreadsheetRow.d.ts +0 -33
  488. package/dist/table/SpreadsheetRow.js +0 -73
  489. package/dist/table/SpreadsheetRowActionCell.d.ts +0 -14
  490. package/dist/table/SpreadsheetRowActionCell.js +0 -51
  491. package/dist/table/TableExpandCell.d.ts +0 -11
  492. package/dist/table/TableExpandCell.js +0 -24
  493. package/dist/table/TableExpandedRow.d.ts +0 -16
  494. package/dist/table/TableExpandedRow.js +0 -77
  495. package/dist/table/TableHeaderCellContent.d.ts +0 -30
  496. package/dist/table/TableHeaderCellContent.js +0 -48
  497. package/dist/table/TablePrimitives.d.ts +0 -313
  498. package/dist/table/TablePrimitives.js +0 -302
  499. package/dist/table/TableSelectCell.d.ts +0 -18
  500. package/dist/table/TableSelectCell.js +0 -27
  501. package/dist/table/TableStatusRow.d.ts +0 -18
  502. package/dist/table/TableStatusRow.js +0 -50
  503. package/dist/table/useSpreadsheetEditing.d.ts +0 -13
  504. package/dist/table/useSpreadsheetEditing.js +0 -41
  505. package/dist/table/useTableColumnResize.d.ts +0 -38
  506. package/dist/table/useTableColumnResize.js +0 -155
  507. package/dist/table/useTableRowExpansion.d.ts +0 -24
  508. package/dist/table/useTableRowExpansion.js +0 -62
  509. package/dist/table/utils.d.ts +0 -50
  510. package/dist/table/utils.js +0 -78
  511. package/dist/text/HotKeys.d.ts +0 -30
  512. package/dist/text/HotKeys.js +0 -74
  513. package/dist/text/Paragraph.d.ts +0 -33
  514. package/dist/text/Paragraph.js +0 -83
  515. package/dist/text/TextShimmer.d.ts +0 -14
  516. package/dist/text/TextShimmer.js +0 -34
  517. package/dist/theme/GalaxyTheme.d.ts +0 -67
  518. package/dist/theme/GalaxyTheme.js +0 -119
  519. package/dist/theme/constants.d.ts +0 -8
  520. package/dist/theme/constants.js +0 -38
  521. package/dist/theme/index.d.ts +0 -6
  522. package/dist/theme/index.js +0 -7
  523. package/dist/theme/types.d.ts +0 -195
  524. package/dist/theme/types.js +0 -10
  525. package/dist/theme/typography.d.ts +0 -2
  526. package/dist/theme/typography.js +0 -73
  527. package/dist/theme/variants/dark.d.ts +0 -2
  528. package/dist/theme/variants/dark.js +0 -125
  529. package/dist/theme/variants/light.d.ts +0 -2
  530. package/dist/theme/variants/light.js +0 -125
  531. package/dist/toast/ToastContainer.d.ts +0 -10
  532. package/dist/toast/ToastContainer.js +0 -31
  533. package/dist/toast/ToastWrapper.d.ts +0 -6
  534. package/dist/toast/ToastWrapper.js +0 -27
  535. package/dist/transform/Flash.d.ts +0 -7
  536. package/dist/transform/Flash.js +0 -18
  537. package/dist/transform/Spin.d.ts +0 -14
  538. package/dist/transform/Spin.js +0 -25
  539. package/dist/utils/linaria.d.ts +0 -1
  540. package/dist/utils/linaria.js +0 -8
@@ -3,24 +3,27 @@ var clamp = (n, min, max) => Math.max(min, Math.min(max, n));
3
3
  var clamp01 = (n) => clamp(n, 0, 1);
4
4
  var rand = (min, max) => Math.random() * (max - min) + min;
5
5
  var wrap360 = (h) => (h % 360 + 360) % 360;
6
+ /** Lowercases, adds a missing `#`, and expands `#rgb` to `#rrggbb`. Throws on anything else. */
6
7
  var normalizeHex = (hex) => {
7
8
  let h = hex.trim().toLowerCase();
8
9
  if (!h.startsWith("#")) h = `#${h}`;
9
10
  if (h.length === 4) {
10
- const r = h[1], g = h[2], b = h[3];
11
+ const [, r = "", g = "", b = ""] = h;
11
12
  return `#${r}${r}${g}${g}${b}${b}`;
12
13
  }
13
14
  if (h.length !== 7) throw new Error(`Invalid hex color: "${hex}". Expected #RRGGBB or #RGB`);
14
15
  return h;
15
16
  };
17
+ /** Parses `#rrggbb` / `#rgb` (with or without `#`) into 0–255 channels. Throws on invalid input. */
16
18
  var hexToRgb = (hex) => {
17
19
  const h = normalizeHex(hex);
18
20
  return {
19
- r: parseInt(h.slice(1, 3), 16),
20
- g: parseInt(h.slice(3, 5), 16),
21
- b: parseInt(h.slice(5, 7), 16)
21
+ r: Number.parseInt(h.slice(1, 3), 16),
22
+ g: Number.parseInt(h.slice(3, 5), 16),
23
+ b: Number.parseInt(h.slice(5, 7), 16)
22
24
  };
23
25
  };
26
+ /** `hexToRgb` plus an alpha channel. */
24
27
  var hexToRgba = (hex, a = 1) => {
25
28
  const { r, g, b } = hexToRgb(hex);
26
29
  return {
@@ -30,15 +33,17 @@ var hexToRgba = (hex, a = 1) => {
30
33
  a
31
34
  };
32
35
  };
33
- var rgbToHex = ({ r, g, b }) => "#" + [
36
+ /** Formats 0–255 channels (rounded, clamped) as lowercase `#rrggbb`. */
37
+ var rgbToHex = ({ r, g, b }) => `#${[
34
38
  r,
35
39
  g,
36
40
  b
37
- ].map((v) => clamp(Math.round(v), 0, 255).toString(16).padStart(2, "0")).join("");
38
- var rgbToHsl = ({ r, g, b }) => {
39
- r /= 255;
40
- g /= 255;
41
- b /= 255;
41
+ ].map((v) => clamp(Math.round(v), 0, 255).toString(16).padStart(2, "0")).join("")}`;
42
+ /** Converts 0–255 channels to HSL (`h` 0–360, `s` and `l` 0–1). */
43
+ var rgbToHsl = (rgb) => {
44
+ const r = rgb.r / 255;
45
+ const g = rgb.g / 255;
46
+ const b = rgb.b / 255;
42
47
  const max = Math.max(r, g, b);
43
48
  const min = Math.min(r, g, b);
44
49
  const delta = max - min;
@@ -67,14 +72,17 @@ var rgbToHsl = ({ r, g, b }) => {
67
72
  l
68
73
  };
69
74
  };
70
- var hslToRgb = ({ h, s, l }) => {
71
- h = wrap360(h);
72
- s = clamp01(s);
73
- l = clamp01(l);
75
+ /** Converts HSL to unrounded 0–255 channels. Wraps `h`, clamps `s` and `l` to 0–1. */
76
+ var hslToRgb = (hsl) => {
77
+ const h = wrap360(hsl.h);
78
+ const s = clamp01(hsl.s);
79
+ const l = clamp01(hsl.l);
74
80
  const c = (1 - Math.abs(2 * l - 1)) * s;
75
81
  const x = c * (1 - Math.abs(h / 60 % 2 - 1));
76
82
  const m = l - c / 2;
77
- let r = 0, g = 0, b = 0;
83
+ let r = 0;
84
+ let g = 0;
85
+ let b = 0;
78
86
  if (h < 60) [r, g, b] = [
79
87
  c,
80
88
  x,
@@ -111,6 +119,7 @@ var hslToRgb = ({ h, s, l }) => {
111
119
  b: (b + m) * 255
112
120
  };
113
121
  };
122
+ /** Converts HSL to `#rrggbb`. */
114
123
  var hslToHex = ({ h, s, l }) => {
115
124
  const { r, g, b } = hslToRgb({
116
125
  h,
@@ -123,10 +132,10 @@ var hslToHex = ({ h, s, l }) => {
123
132
  b
124
133
  });
125
134
  };
126
- var rgbToHsva = ({ r, g, b }) => {
127
- r /= 255;
128
- g /= 255;
129
- b /= 255;
135
+ var rgbToHsva = (rgb) => {
136
+ const r = rgb.r / 255;
137
+ const g = rgb.g / 255;
138
+ const b = rgb.b / 255;
130
139
  const max = Math.max(r, g, b);
131
140
  const delta = max - Math.min(r, g, b);
132
141
  let h = 0;
@@ -146,13 +155,15 @@ var rgbToHsva = ({ r, g, b }) => {
146
155
  a: 1
147
156
  };
148
157
  };
149
- var hsvaToRgb = ({ h, s, v, a: _a }) => {
158
+ var hsvaToRgb = ({ h, s, v }) => {
150
159
  const sNorm = s / 100;
151
160
  const vNorm = v / 100;
152
161
  const c = vNorm * sNorm;
153
162
  const x = c * (1 - Math.abs(h / 60 % 2 - 1));
154
163
  const m = vNorm - c;
155
- let r = 0, g = 0, b = 0;
164
+ let r = 0;
165
+ let g = 0;
166
+ let b = 0;
156
167
  if (h < 60) [r, g, b] = [
157
168
  c,
158
169
  x,
@@ -189,9 +200,11 @@ var hsvaToRgb = ({ h, s, v, a: _a }) => {
189
200
  b: Math.round((b + m) * 255)
190
201
  };
191
202
  };
203
+ /** Converts a hex color to HSVA (`s`, `v` 0–100; `a` always 1), as `@uiw/react-color` expects. */
192
204
  var hexToHsva = (hex) => {
193
205
  return rgbToHsva(hexToRgb(hex));
194
206
  };
207
+ /** Converts HSVA (`s`, `v` 0–100) to `#rrggbb`; alpha is ignored. */
195
208
  var hsvaToHex = (hsva) => {
196
209
  return rgbToHex(hsvaToRgb(hsva));
197
210
  };
@@ -206,7 +219,7 @@ var generateRandomHexColor = () => {
206
219
  * Gets an opaque hex color
207
220
  * @param hex - The hex color to add opacity to
208
221
  * @param opacity - The opacity to add (0-1)
209
- * @returns A hex color with the added opacity
222
+ * @returns An `rgba(r, g, b, opacity)` string (not a hex)
210
223
  */
211
224
  var getOpaqueHexColor = (hex, opacity = .5) => {
212
225
  const { r, g, b } = hexToRgb(hex);
@@ -298,26 +311,71 @@ var generateRandomPastelHexColor = () => {
298
311
  l: rand(.75, .9)
299
312
  });
300
313
  };
314
+ /** Balanced hue ranges for `generateRandomVibrantHexColor` (greens included but not dominant). */
315
+ var VIBRANT_HUE_RANGES = [
316
+ [0, 60],
317
+ [60, 90],
318
+ [90, 150],
319
+ [150, 210],
320
+ [210, 270],
321
+ [270, 330],
322
+ [330, 360]
323
+ ];
301
324
  /**
302
325
  * Random vibrant color (saturated, bold, UI-friendly)
303
326
  * Generates colors similar to: #5D9CEC, #4FC1E9, #48CFAD, #A0D468, #FFCE54, #FC6E51, #ED5565, #AC92EC, #EC87C0
304
327
  */
305
328
  var generateRandomVibrantHexColor = () => {
306
- const hueRanges = [
307
- [0, 60],
308
- [60, 90],
309
- [90, 150],
310
- [150, 210],
311
- [210, 270],
312
- [270, 330],
313
- [330, 360]
314
- ];
315
- const range = hueRanges[Math.floor(Math.random() * hueRanges.length)];
329
+ const [min, max] = VIBRANT_HUE_RANGES[Math.floor(Math.random() * VIBRANT_HUE_RANGES.length)] ?? [0, 360];
316
330
  return hslToHex({
317
- h: rand(range[0], range[1]),
331
+ h: rand(min, max),
318
332
  s: rand(.6, .95),
319
333
  l: rand(.5, .75)
320
334
  });
321
335
  };
336
+ /** WCAG 2.x relative luminance (0–1) of a hex color. */
337
+ var relativeLuminance = (hex) => {
338
+ const { r, g, b } = hexToRgb(hex);
339
+ const [lr = 0, lg = 0, lb = 0] = [
340
+ r,
341
+ g,
342
+ b
343
+ ].map((value) => {
344
+ const channel = value / 255;
345
+ return channel <= .04045 ? channel / 12.92 : ((channel + .055) / 1.055) ** 2.4;
346
+ });
347
+ return .2126 * lr + .7152 * lg + .0722 * lb;
348
+ };
349
+ /** WCAG 2.x contrast ratio between two hex colors, from 1 (same) to 21 (black on white). Order-independent. */
350
+ var contrastRatio = (a, b) => {
351
+ const la = relativeLuminance(a);
352
+ const lb = relativeLuminance(b);
353
+ return (Math.max(la, lb) + .05) / (Math.min(la, lb) + .05);
354
+ };
355
+ /** WCAG AA minimum contrast for body text. */
356
+ var AA_MIN_RATIO = 4.5;
357
+ /** WCAG AA minimum contrast for large text (≥ 18pt, or ≥ 14pt bold). */
358
+ var AA_LARGE_TEXT_MIN_RATIO = 3;
359
+ /**
360
+ * Whether `fg` on `bg` meets WCAG AA: ≥ 4.5:1, or ≥ 3:1 when `isLargeText`.
361
+ * @param isLargeText - Text is ≥ 18pt, or ≥ 14pt bold. @default false
362
+ */
363
+ var meetsAA = (fg, bg, isLargeText = false) => contrastRatio(fg, bg) >= (isLargeText ? AA_LARGE_TEXT_MIN_RATIO : AA_MIN_RATIO);
364
+ /**
365
+ * Per-channel sRGB interpolation `a·(1−t) + b·t`, rounded: `t = 0` is `a`, `t = 1` is `b`.
366
+ * The formula the token `subtle`/`strong` steps are derived with (Tokens Q3).
367
+ * @param t - Weight of `b`, clamped to 0–1.
368
+ */
369
+ var mix = (a, b, t) => {
370
+ const from = hexToRgb(a);
371
+ const to = hexToRgb(b);
372
+ const weight = clamp01(t);
373
+ const lerp = (x, y) => x * (1 - weight) + y * weight;
374
+ return rgbToHex({
375
+ r: lerp(from.r, to.r),
376
+ g: lerp(from.g, to.g),
377
+ b: lerp(from.b, to.b)
378
+ });
379
+ };
322
380
  //#endregion
323
- export { generateRandomHexColor, generateRandomPastelHexColor, generateRandomVibrantHexColor, getBrighterPronouncedHexColor, getDarkerHexColor, getDarkerPronouncedHexColor, getLighterHexColor, getOpaqueHexColor, hexToHsva, hexToRgb, hexToRgba, hslToHex, hslToRgb, hsvaToHex, rgbToHex, rgbToHsl };
381
+ export { contrastRatio, generateRandomHexColor, generateRandomPastelHexColor, generateRandomVibrantHexColor, getBrighterPronouncedHexColor, getDarkerHexColor, getDarkerPronouncedHexColor, getLighterHexColor, getOpaqueHexColor, hexToHsva, hexToRgb, hexToRgba, hslToHex, hslToRgb, hsvaToHex, meetsAA, mix, rgbToHex, rgbToHsl };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * CSS value helpers for the layout components (`Flex`, `Grid`, `Box`). `getCssSizeValue` is kept
3
+ * from 1.x `utils/linaria`; `spaceToCss` and `gapToCss` turn the `Space` props into token
4
+ * variables, so spacing always follows the scale (Constitution II.5, V).
5
+ */
6
+ import type { Space, SpaceShorthand } from "../theme/enums.js";
7
+ /**
8
+ * A CSS length: a numeric `value` as px; else a numeric `fallback` as px; else the string
9
+ * `value`, the string `fallback`, or `"0"`. Unchanged from 1.x, including that a numeric
10
+ * `fallback` wins over a string `value`: `getCssSizeValue(12)` → `"12px"`,
11
+ * `getCssSizeValue("50%")` → `"50%"`, `getCssSizeValue("auto", 8)` → `"8px"`.
12
+ */
13
+ export declare function getCssSizeValue(value?: number | string, fallback?: number | string): string;
14
+ /**
15
+ * `padding` value from a `Space` or a 1–4 value tuple in CSS shorthand order.
16
+ * `12` → `"var(--gx-space-12)"`; `[12, 16]` → `"var(--gx-space-12) var(--gx-space-16)"`.
17
+ */
18
+ export declare function spaceToCss(value: SpaceShorthand): string;
19
+ /**
20
+ * `gap` value from a `Space` or a `[row, column]` tuple.
21
+ * `8` → `"var(--gx-space-8)"`; `[8, 16]` → `"var(--gx-space-8) var(--gx-space-16)"`.
22
+ */
23
+ export declare function gapToCss(value: Space | [Space, Space]): string;
@@ -0,0 +1,30 @@
1
+ import { t } from "../theme/tokens/t.js";
2
+ //#region src/utils/css.ts
3
+ /**
4
+ * A CSS length: a numeric `value` as px; else a numeric `fallback` as px; else the string
5
+ * `value`, the string `fallback`, or `"0"`. Unchanged from 1.x, including that a numeric
6
+ * `fallback` wins over a string `value`: `getCssSizeValue(12)` → `"12px"`,
7
+ * `getCssSizeValue("50%")` → `"50%"`, `getCssSizeValue("auto", 8)` → `"8px"`.
8
+ */
9
+ function getCssSizeValue(value, fallback) {
10
+ if (typeof value === "number") return `${value}px`;
11
+ if (typeof fallback === "number") return `${fallback}px`;
12
+ return value ?? fallback ?? "0";
13
+ }
14
+ var spaceVar = (value) => t.space[value];
15
+ /**
16
+ * `padding` value from a `Space` or a 1–4 value tuple in CSS shorthand order.
17
+ * `12` → `"var(--gx-space-12)"`; `[12, 16]` → `"var(--gx-space-12) var(--gx-space-16)"`.
18
+ */
19
+ function spaceToCss(value) {
20
+ return typeof value === "number" ? spaceVar(value) : value.map(spaceVar).join(" ");
21
+ }
22
+ /**
23
+ * `gap` value from a `Space` or a `[row, column]` tuple.
24
+ * `8` → `"var(--gx-space-8)"`; `[8, 16]` → `"var(--gx-space-8) var(--gx-space-16)"`.
25
+ */
26
+ function gapToCss(value) {
27
+ return spaceToCss(value);
28
+ }
29
+ //#endregion
30
+ export { gapToCss, getCssSizeValue, spaceToCss };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Display formatting for numbers, byte sizes, durations, relative times and percentages
3
+ * (Constitution VIII-A.2). Pure functions on `Intl`, no dependencies, safe at module scope and
4
+ * under SSR. Number parts default to the `en-US` locale (not the runtime's) so server and client
5
+ * render the same string.
6
+ *
7
+ * `precision` is always the maximum number of fraction digits; trailing zeros are dropped
8
+ * (`formatPercent(0.5)` → `"50%"`, not `"50.0%"`). Non-finite input (`NaN`, `±Infinity`) is
9
+ * returned as `formatNumber` prints it (`"NaN"`, `"∞"`, `"-∞"`).
10
+ */
11
+ /**
12
+ * Formats a number with grouping. `1234` → `"1,234"`; `{ compact: true }` → `"1.2k"`
13
+ * (suffixes `k M B T`). `precision` is the maximum fraction digits (default `1` when compact,
14
+ * otherwise the `Intl` default of `3`). `locale` defaults to `"en-US"`.
15
+ */
16
+ export declare function formatNumber(n: number, opts?: {
17
+ compact?: boolean;
18
+ precision?: number;
19
+ locale?: string;
20
+ }): string;
21
+ /**
22
+ * Formats a byte count. `1536` → `"1.5 KB"`. Decimal units (`KB`, base 1000) by default;
23
+ * `{ binary: true }` uses IEC units (`KiB`, base 1024). Whole bytes have no fraction digits.
24
+ * `precision` is the maximum fraction digits (default `1`).
25
+ */
26
+ export declare function formatBytes(bytes: number, opts?: {
27
+ precision?: number;
28
+ binary?: boolean;
29
+ }): string;
30
+ /**
31
+ * Formats a duration in milliseconds. `4215000` → `"1h 10m"`; `{ style: "long" }` →
32
+ * `"1 hour 10 minutes"`. Units are `d h m s ms`, starting at the largest non-zero unit and
33
+ * spanning at most `maxUnits` consecutive units (default `2`, also used when `maxUnits` is not
34
+ * finite); zero units are omitted and the
35
+ * remainder is truncated. Zero is `"0s"` / `"0 seconds"`. `style` defaults to `"compact"`.
36
+ */
37
+ export declare function formatDuration(ms: number, opts?: {
38
+ style?: "compact" | "long";
39
+ maxUnits?: number;
40
+ }): string;
41
+ /**
42
+ * Formats a date relative to `now` (default: the current time, read at call time).
43
+ * `{ style: "short" }` (default) → `"3m ago"`, `"in 2d"`, `"now"` (units `s m h d w mo y`);
44
+ * `{ style: "long" }` → `Intl.RelativeTimeFormat` with `numeric: "auto"` (`"3 minutes ago"`,
45
+ * `"in 2 days"`, `"yesterday"`, `"now"`). Uses the largest unit that fits, truncated;
46
+ * months are 30 days, years 365 days. Under 1 second is `"now"`.
47
+ */
48
+ export declare function formatRelativeTime(date: Date | number, opts?: {
49
+ now?: Date;
50
+ style?: "short" | "long";
51
+ }): string;
52
+ /**
53
+ * Formats a ratio as a percentage. `0.1234` → `"12.3%"`. `precision` is the maximum fraction
54
+ * digits (default `1`).
55
+ */
56
+ export declare function formatPercent(ratio: number, opts?: {
57
+ precision?: number;
58
+ }): string;
@@ -0,0 +1,220 @@
1
+ //#region src/utils/format.ts
2
+ /**
3
+ * Display formatting for numbers, byte sizes, durations, relative times and percentages
4
+ * (Constitution VIII-A.2). Pure functions on `Intl`, no dependencies, safe at module scope and
5
+ * under SSR. Number parts default to the `en-US` locale (not the runtime's) so server and client
6
+ * render the same string.
7
+ *
8
+ * `precision` is always the maximum number of fraction digits; trailing zeros are dropped
9
+ * (`formatPercent(0.5)` → `"50%"`, not `"50.0%"`). Non-finite input (`NaN`, `±Infinity`) is
10
+ * returned as `formatNumber` prints it (`"NaN"`, `"∞"`, `"-∞"`).
11
+ */
12
+ var DEFAULT_LOCALE = "en-US";
13
+ var COMPACT_SUFFIXES = [
14
+ "",
15
+ "k",
16
+ "M",
17
+ "B",
18
+ "T"
19
+ ];
20
+ var DECIMAL_BYTE_UNITS = [
21
+ "B",
22
+ "KB",
23
+ "MB",
24
+ "GB",
25
+ "TB",
26
+ "PB"
27
+ ];
28
+ var BINARY_BYTE_UNITS = [
29
+ "B",
30
+ "KiB",
31
+ "MiB",
32
+ "GiB",
33
+ "TiB",
34
+ "PiB"
35
+ ];
36
+ var SECOND_MS = 1e3;
37
+ var MINUTE_MS = 60 * SECOND_MS;
38
+ var HOUR_MS = 60 * MINUTE_MS;
39
+ var DAY_MS = 24 * HOUR_MS;
40
+ var WEEK_MS = 7 * DAY_MS;
41
+ var MONTH_MS = 30 * DAY_MS;
42
+ var YEAR_MS = 365 * DAY_MS;
43
+ /** Largest first. A duration is cut into consecutive units starting at its largest non-zero one. */
44
+ var DURATION_UNITS = [
45
+ {
46
+ ms: DAY_MS,
47
+ compact: "d",
48
+ singular: "day",
49
+ plural: "days"
50
+ },
51
+ {
52
+ ms: HOUR_MS,
53
+ compact: "h",
54
+ singular: "hour",
55
+ plural: "hours"
56
+ },
57
+ {
58
+ ms: MINUTE_MS,
59
+ compact: "m",
60
+ singular: "minute",
61
+ plural: "minutes"
62
+ },
63
+ {
64
+ ms: SECOND_MS,
65
+ compact: "s",
66
+ singular: "second",
67
+ plural: "seconds"
68
+ },
69
+ {
70
+ ms: 1,
71
+ compact: "ms",
72
+ singular: "millisecond",
73
+ plural: "milliseconds"
74
+ }
75
+ ];
76
+ /** Largest first. A relative time uses the largest unit that fits, truncated (90s → 1m). */
77
+ var RELATIVE_UNITS = [
78
+ {
79
+ ms: YEAR_MS,
80
+ short: "y",
81
+ intl: "year"
82
+ },
83
+ {
84
+ ms: MONTH_MS,
85
+ short: "mo",
86
+ intl: "month"
87
+ },
88
+ {
89
+ ms: WEEK_MS,
90
+ short: "w",
91
+ intl: "week"
92
+ },
93
+ {
94
+ ms: DAY_MS,
95
+ short: "d",
96
+ intl: "day"
97
+ },
98
+ {
99
+ ms: HOUR_MS,
100
+ short: "h",
101
+ intl: "hour"
102
+ },
103
+ {
104
+ ms: MINUTE_MS,
105
+ short: "m",
106
+ intl: "minute"
107
+ },
108
+ {
109
+ ms: SECOND_MS,
110
+ short: "s",
111
+ intl: "second"
112
+ }
113
+ ];
114
+ var decimal = (value, maxFractionDigits, locale = DEFAULT_LOCALE) => new Intl.NumberFormat(locale, {
115
+ signDisplay: "negative",
116
+ ...maxFractionDigits === void 0 ? {} : { maximumFractionDigits: maxFractionDigits }
117
+ }).format(value);
118
+ /**
119
+ * Scales `abs` by `base` until it is below `base` after rounding to the fraction digits that
120
+ * step actually prints (`precisionAt(step)`), so `999_960` bytes becomes `1 MB`, not `1,000 KB`,
121
+ * and `999.6` bytes becomes `1 KB`, not `1,000 B`. Returns the scaled value and the step index.
122
+ */
123
+ function scale(abs, base, steps, precisionAt) {
124
+ let value = abs;
125
+ let step = 0;
126
+ const rounded = () => {
127
+ const factor = 10 ** precisionAt(step);
128
+ return Math.round(value * factor) / factor;
129
+ };
130
+ while (step < steps - 1 && rounded() >= base) {
131
+ value /= base;
132
+ step += 1;
133
+ }
134
+ return [value, step];
135
+ }
136
+ /**
137
+ * Formats a number with grouping. `1234` → `"1,234"`; `{ compact: true }` → `"1.2k"`
138
+ * (suffixes `k M B T`). `precision` is the maximum fraction digits (default `1` when compact,
139
+ * otherwise the `Intl` default of `3`). `locale` defaults to `"en-US"`.
140
+ */
141
+ function formatNumber(n, opts) {
142
+ const locale = opts?.locale ?? DEFAULT_LOCALE;
143
+ if (!opts?.compact || !Number.isFinite(n)) return decimal(n, opts?.precision, locale);
144
+ const precision = opts.precision ?? 1;
145
+ const [value, step] = scale(Math.abs(n), 1e3, COMPACT_SUFFIXES.length, () => precision);
146
+ return `${n < 0 && decimal(value, precision, locale) !== "0" ? "-" : ""}${decimal(value, precision, locale)}${COMPACT_SUFFIXES[step] ?? ""}`;
147
+ }
148
+ /**
149
+ * Formats a byte count. `1536` → `"1.5 KB"`. Decimal units (`KB`, base 1000) by default;
150
+ * `{ binary: true }` uses IEC units (`KiB`, base 1024). Whole bytes have no fraction digits.
151
+ * `precision` is the maximum fraction digits (default `1`).
152
+ */
153
+ function formatBytes(bytes, opts) {
154
+ if (!Number.isFinite(bytes)) return formatNumber(bytes);
155
+ const precision = opts?.precision ?? 1;
156
+ const units = opts?.binary ? BINARY_BYTE_UNITS : DECIMAL_BYTE_UNITS;
157
+ const precisionAt = (step) => step === 0 ? 0 : precision;
158
+ const [value, step] = scale(Math.abs(bytes), opts?.binary ? 1024 : 1e3, units.length, precisionAt);
159
+ const digits = decimal(value, precisionAt(step));
160
+ return `${bytes < 0 && digits !== "0" ? "-" : ""}${digits} ${units[step] ?? ""}`;
161
+ }
162
+ /**
163
+ * Formats a duration in milliseconds. `4215000` → `"1h 10m"`; `{ style: "long" }` →
164
+ * `"1 hour 10 minutes"`. Units are `d h m s ms`, starting at the largest non-zero unit and
165
+ * spanning at most `maxUnits` consecutive units (default `2`, also used when `maxUnits` is not
166
+ * finite); zero units are omitted and the
167
+ * remainder is truncated. Zero is `"0s"` / `"0 seconds"`. `style` defaults to `"compact"`.
168
+ */
169
+ function formatDuration(ms, opts) {
170
+ if (!Number.isFinite(ms)) return formatNumber(ms);
171
+ const isLong = opts?.style === "long";
172
+ const requestedUnits = opts?.maxUnits ?? 2;
173
+ const maxUnits = Number.isFinite(requestedUnits) ? Math.max(1, Math.floor(requestedUnits)) : 2;
174
+ let rest = Math.floor(Math.abs(ms));
175
+ const start = DURATION_UNITS.findIndex((unit) => rest >= unit.ms);
176
+ if (start === -1) return isLong ? "0 seconds" : "0s";
177
+ const parts = [];
178
+ for (const unit of DURATION_UNITS.slice(start, start + maxUnits)) {
179
+ const count = Math.floor(rest / unit.ms);
180
+ rest -= count * unit.ms;
181
+ if (count > 0) {
182
+ const amount = decimal(count, 0);
183
+ parts.push(isLong ? `${amount} ${count === 1 ? unit.singular : unit.plural}` : `${amount}${unit.compact}`);
184
+ }
185
+ }
186
+ return `${ms < 0 ? "-" : ""}${parts.join(" ")}`;
187
+ }
188
+ /**
189
+ * Formats a date relative to `now` (default: the current time, read at call time).
190
+ * `{ style: "short" }` (default) → `"3m ago"`, `"in 2d"`, `"now"` (units `s m h d w mo y`);
191
+ * `{ style: "long" }` → `Intl.RelativeTimeFormat` with `numeric: "auto"` (`"3 minutes ago"`,
192
+ * `"in 2 days"`, `"yesterday"`, `"now"`). Uses the largest unit that fits, truncated;
193
+ * months are 30 days, years 365 days. Under 1 second is `"now"`.
194
+ */
195
+ function formatRelativeTime(date, opts) {
196
+ const now = opts?.now ?? /* @__PURE__ */ new Date();
197
+ const diff = (typeof date === "number" ? date : date.getTime()) - now.getTime();
198
+ if (!Number.isFinite(diff)) return formatNumber(diff);
199
+ const isLong = opts?.style === "long";
200
+ const unit = RELATIVE_UNITS.find((candidate) => Math.abs(diff) >= candidate.ms);
201
+ if (!unit) return isLong ? new Intl.RelativeTimeFormat(DEFAULT_LOCALE, { numeric: "auto" }).format(0, "second") : "now";
202
+ const count = Math.floor(Math.abs(diff) / unit.ms);
203
+ if (isLong) return new Intl.RelativeTimeFormat(DEFAULT_LOCALE, { numeric: "auto" }).format(diff < 0 ? -count : count, unit.intl);
204
+ const amount = `${decimal(count, 0)}${unit.short}`;
205
+ return diff < 0 ? `${amount} ago` : `in ${amount}`;
206
+ }
207
+ /**
208
+ * Formats a ratio as a percentage. `0.1234` → `"12.3%"`. `precision` is the maximum fraction
209
+ * digits (default `1`).
210
+ */
211
+ function formatPercent(ratio, opts) {
212
+ if (!Number.isFinite(ratio)) return formatNumber(ratio);
213
+ return new Intl.NumberFormat(DEFAULT_LOCALE, {
214
+ style: "percent",
215
+ signDisplay: "negative",
216
+ maximumFractionDigits: opts?.precision ?? 1
217
+ }).format(ratio);
218
+ }
219
+ //#endregion
220
+ export { formatBytes, formatDuration, formatNumber, formatPercent, formatRelativeTime };
@@ -0,0 +1,16 @@
1
+ import { type Plugin } from "@wyw-in-js/vite";
2
+ /** Options for {@link galaxyDls}. */
3
+ export type GalaxyDlsOptions = {
4
+ /**
5
+ * App name that starts every generated class: `<prefix>-<Component>-<Part>-<hash>`
6
+ * (`fil-Sidebar-Item-1a2b3c`). Letters, digits and `-`, starting with a letter.
7
+ * @default "gx"
8
+ */
9
+ prefix?: string;
10
+ };
11
+ /**
12
+ * Returns the configured `@wyw-in-js/vite` plugin: the DLS Babel presets (React automatic
13
+ * runtime + TypeScript), `include`/`exclude`, React `importOverrides`, and the DLS
14
+ * `classNameSlug` (`gx-<Component>-<Part>-<hash>`) with `gx` replaced by `prefix`.
15
+ */
16
+ export declare function galaxyDls(options?: GalaxyDlsOptions): Plugin;
@@ -0,0 +1,52 @@
1
+ import { createRequire } from "node:module";
2
+ import wyw from "@wyw-in-js/vite";
3
+ //#region src/vite/index.ts
4
+ /**
5
+ * `@galaxy-io/dls/vite` — one-line wyw-in-js (Linaria) setup for consumer apps.
6
+ *
7
+ * ```ts
8
+ * // vite.config.ts
9
+ * import { galaxyDls } from "@galaxy-io/dls/vite";
10
+ * export default defineConfig({ plugins: [react(), galaxyDls({ prefix: "fil" })] });
11
+ * ```
12
+ *
13
+ * The DLS itself ships pre-extracted CSS (`@galaxy-io/dls/styles.css`); this preset only
14
+ * compiles the app's own `styled` / `css` code, which reads DLS tokens through `t`.
15
+ */
16
+ /** The DLS class prefix; also the default app prefix. */
17
+ var DEFAULT_PREFIX = "gx";
18
+ /** A valid start for a CSS class name: a letter, then letters, digits or `-`. */
19
+ var PREFIX_PATTERN = /^[A-Za-z][A-Za-z0-9-]*$/;
20
+ /** The styled root is named `Root`; its class drops the part segment. */
21
+ var ROOT_PART = "Root";
22
+ /** Files the plugin compiles. The DLS (and every other package) ships already compiled. */
23
+ var INCLUDE = ["**/*.{js,jsx,ts,tsx}"];
24
+ var EXCLUDE = ["**/node_modules/**"];
25
+ /**
26
+ * React is reached while wyw evaluates `styled` components at build time; loading it as-is is
27
+ * expected, so the "unknown import reached during eval" warning is silenced for it.
28
+ */
29
+ var IMPORT_OVERRIDES = {
30
+ react: { unknown: "allow" },
31
+ "react/jsx-runtime": { unknown: "allow" },
32
+ "react/jsx-dev-runtime": { unknown: "allow" }
33
+ };
34
+ /**
35
+ * Returns the configured `@wyw-in-js/vite` plugin: the DLS Babel presets (React automatic
36
+ * runtime + TypeScript), `include`/`exclude`, React `importOverrides`, and the DLS
37
+ * `classNameSlug` (`gx-<Component>-<Part>-<hash>`) with `gx` replaced by `prefix`.
38
+ */
39
+ function galaxyDls(options = {}) {
40
+ const { prefix = DEFAULT_PREFIX } = options;
41
+ if (!PREFIX_PATTERN.test(prefix)) throw new Error(`[@galaxy-io/dls/vite] prefix "${prefix}" is not a valid class-name start: use letters, digits and "-", starting with a letter.`);
42
+ const require = createRequire(import.meta.url);
43
+ return wyw({
44
+ include: INCLUDE,
45
+ exclude: EXCLUDE,
46
+ babelOptions: { presets: [[require.resolve("@babel/preset-react"), { runtime: "automatic" }], require.resolve("@babel/preset-typescript")] },
47
+ importOverrides: IMPORT_OVERRIDES,
48
+ classNameSlug: (hash, title, { name }) => `${prefix}-${name}${title === ROOT_PART ? "" : `-${title}`}-${hash}`
49
+ });
50
+ }
51
+ //#endregion
52
+ export { galaxyDls };