@astryxdesign/core 0.1.4-canary.37c19d3 → 0.1.4-canary.39ffd21

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 (226) hide show
  1. package/dist/Banner/Banner.d.ts.map +1 -1
  2. package/dist/Banner/Banner.js +1 -8
  3. package/dist/Calendar/Calendar.d.ts.map +1 -1
  4. package/dist/Calendar/Calendar.js +11 -31
  5. package/dist/Calendar/styles.d.ts +2 -2
  6. package/dist/Calendar/styles.d.ts.map +1 -1
  7. package/dist/Calendar/styles.js +2 -2
  8. package/dist/Carousel/Carousel.d.ts.map +1 -1
  9. package/dist/Carousel/Carousel.js +0 -1
  10. package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
  11. package/dist/Chat/ChatToolCalls.js +1 -8
  12. package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
  13. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  14. package/dist/CheckboxInput/CheckboxInput.js +1 -3
  15. package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
  16. package/dist/ClickableCard/ClickableCard.js +3 -26
  17. package/dist/CodeBlock/CodeBlock.d.ts +1 -10
  18. package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
  19. package/dist/CodeBlock/CodeBlock.js +5 -23
  20. package/dist/Collapsible/Collapsible.d.ts +3 -9
  21. package/dist/Collapsible/Collapsible.d.ts.map +1 -1
  22. package/dist/Collapsible/Collapsible.js +13 -101
  23. package/dist/Collapsible/CollapsibleGroup.d.ts +7 -39
  24. package/dist/Collapsible/CollapsibleGroup.d.ts.map +1 -1
  25. package/dist/Collapsible/CollapsibleGroup.js +9 -70
  26. package/dist/Collapsible/CollapsibleGroupContext.d.ts +0 -31
  27. package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
  28. package/dist/Collapsible/CollapsibleGroupContext.js +3 -33
  29. package/dist/Collapsible/index.d.ts +0 -1
  30. package/dist/Collapsible/index.d.ts.map +1 -1
  31. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  32. package/dist/ContextMenu/ContextMenu.js +0 -2
  33. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  34. package/dist/DateTimeInput/DateTimeInput.js +0 -2
  35. package/dist/Grid/Grid.d.ts +3 -4
  36. package/dist/Grid/Grid.d.ts.map +1 -1
  37. package/dist/Grid/Grid.js +9 -26
  38. package/dist/Icon/Icon.d.ts.map +1 -1
  39. package/dist/Icon/Icon.js +1 -5
  40. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  41. package/dist/Lightbox/Lightbox.js +2 -26
  42. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  43. package/dist/NumberInput/NumberInput.js +16 -32
  44. package/dist/Pagination/Pagination.d.ts.map +1 -1
  45. package/dist/Pagination/Pagination.js +36 -87
  46. package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
  47. package/dist/PowerSearch/PowerSearch.js +21 -39
  48. package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
  49. package/dist/ProgressBar/ProgressBar.js +1 -2
  50. package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
  51. package/dist/Resizable/ResizeHandle.js +2 -10
  52. package/dist/SideNav/SideNav.d.ts.map +1 -1
  53. package/dist/SideNav/SideNav.js +2 -6
  54. package/dist/TabList/TabMenu.d.ts.map +1 -1
  55. package/dist/TabList/TabMenu.js +7 -34
  56. package/dist/Table/BaseTable.d.ts.map +1 -1
  57. package/dist/Table/BaseTable.js +2 -12
  58. package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
  59. package/dist/Table/plugins/columnResize/useTableColumnResize.js +2 -5
  60. package/dist/Table/plugins/pagination/paginateData.d.ts.map +1 -1
  61. package/dist/Table/plugins/pagination/paginateData.js +1 -5
  62. package/dist/Table/plugins/selection/useTableSelectionState.d.ts.map +1 -1
  63. package/dist/Table/plugins/selection/useTableSelectionState.js +1 -11
  64. package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
  65. package/dist/Table/plugins/sortable/useTableSortableState.js +4 -8
  66. package/dist/Thumbnail/Thumbnail.d.ts +2 -3
  67. package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
  68. package/dist/Thumbnail/Thumbnail.js +0 -1
  69. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  70. package/dist/TimeInput/TimeInput.js +1 -6
  71. package/dist/Toast/Toast.d.ts.map +1 -1
  72. package/dist/Toast/Toast.js +3 -11
  73. package/dist/Toast/ToastViewport.d.ts.map +1 -1
  74. package/dist/Toast/ToastViewport.js +0 -12
  75. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  76. package/dist/Typeahead/BaseTypeahead.js +2 -5
  77. package/dist/astryx.css +0 -7
  78. package/dist/astryx.umd.js +48 -48
  79. package/dist/astryx.umd.js.map +4 -4
  80. package/dist/hooks/focusableSelector.d.ts +1 -1
  81. package/dist/hooks/focusableSelector.d.ts.map +1 -1
  82. package/dist/hooks/focusableSelector.js +1 -1
  83. package/dist/hooks/useFocusTrap.d.ts +0 -3
  84. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  85. package/dist/hooks/useFocusTrap.js +1 -38
  86. package/dist/theme/defineTheme.d.ts +1 -1
  87. package/dist/theme/defineTheme.d.ts.map +1 -1
  88. package/dist/theme/expandColorScale.d.ts.map +1 -1
  89. package/dist/theme/expandColorScale.js +3 -10
  90. package/dist/theme/hct.d.ts +15 -0
  91. package/dist/theme/hct.d.ts.map +1 -1
  92. package/dist/theme/hct.js +9 -9
  93. package/dist/theme/tokens.d.ts +2 -10
  94. package/dist/theme/tokens.d.ts.map +1 -1
  95. package/dist/theme/tokens.js +4 -220
  96. package/dist/utils/index.d.ts +0 -2
  97. package/dist/utils/index.d.ts.map +1 -1
  98. package/dist/utils/index.js +1 -2
  99. package/dist/utils/timeParser.d.ts.map +1 -1
  100. package/dist/utils/timeParser.js +5 -8
  101. package/package.json +1 -1
  102. package/src/Avatar/Avatar.doc.mjs +0 -11
  103. package/src/Banner/Banner.doc.mjs +0 -8
  104. package/src/Banner/Banner.test.tsx +0 -38
  105. package/src/Banner/Banner.tsx +1 -8
  106. package/src/Calendar/Calendar.doc.mjs +1 -1
  107. package/src/Calendar/Calendar.test.tsx +4 -112
  108. package/src/Calendar/Calendar.tsx +5 -26
  109. package/src/Calendar/styles.ts +2 -12
  110. package/src/Carousel/Carousel.doc.mjs +12 -12
  111. package/src/Carousel/Carousel.test.tsx +0 -13
  112. package/src/Carousel/Carousel.tsx +0 -1
  113. package/src/Chat/Chat.doc.mjs +1 -1
  114. package/src/Chat/ChatToolCalls.test.tsx +0 -55
  115. package/src/Chat/ChatToolCalls.tsx +12 -10
  116. package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
  117. package/src/CheckboxInput/CheckboxInput.test.tsx +4 -71
  118. package/src/CheckboxInput/CheckboxInput.tsx +0 -2
  119. package/src/Citation/Citation.doc.mjs +0 -5
  120. package/src/ClickableCard/ClickableCard.tsx +2 -45
  121. package/src/CodeBlock/CodeBlock.doc.mjs +2 -7
  122. package/src/CodeBlock/CodeBlock.test.tsx +3 -87
  123. package/src/CodeBlock/CodeBlock.tsx +3 -43
  124. package/src/Collapsible/Collapsible.doc.mjs +4 -8
  125. package/src/Collapsible/Collapsible.tsx +10 -86
  126. package/src/Collapsible/CollapsibleGroup.doc.mjs +3 -27
  127. package/src/Collapsible/CollapsibleGroup.test.tsx +0 -288
  128. package/src/Collapsible/CollapsibleGroup.tsx +9 -107
  129. package/src/Collapsible/CollapsibleGroupContext.tsx +2 -42
  130. package/src/Collapsible/index.ts +0 -4
  131. package/src/CommandPalette/CommandPaletteEmpty.doc.mjs +0 -5
  132. package/src/CommandPalette/CommandPaletteGroup.doc.mjs +0 -10
  133. package/src/CommandPalette/CommandPaletteInput.doc.mjs +0 -6
  134. package/src/CommandPalette/CommandPaletteItem.doc.mjs +0 -6
  135. package/src/CommandPalette/CommandPaletteList.doc.mjs +0 -9
  136. package/src/ContextMenu/ContextMenu.doc.mjs +0 -15
  137. package/src/ContextMenu/ContextMenu.test.tsx +0 -15
  138. package/src/ContextMenu/ContextMenu.tsx +0 -2
  139. package/src/ContextMenu/ContextMenuItem.doc.mjs +0 -6
  140. package/src/DateTimeInput/DateTimeInput.test.tsx +0 -70
  141. package/src/DateTimeInput/DateTimeInput.tsx +0 -2
  142. package/src/Dialog/DialogHeader.doc.mjs +0 -45
  143. package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
  144. package/src/Field/FieldLabel.test.tsx +2 -2
  145. package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +3 -0
  146. package/src/Grid/Grid.test.tsx +18 -43
  147. package/src/Grid/Grid.tsx +9 -26
  148. package/src/Icon/Icon.test.tsx +29 -41
  149. package/src/Icon/Icon.tsx +2 -6
  150. package/src/Layout/LayoutContent.doc.mjs +0 -12
  151. package/src/Layout/LayoutPanel.doc.mjs +0 -40
  152. package/src/Lightbox/Lightbox.doc.mjs +0 -5
  153. package/src/Lightbox/Lightbox.test.tsx +2 -123
  154. package/src/Lightbox/Lightbox.tsx +1 -29
  155. package/src/NavMenu/NavMenu.doc.mjs +0 -15
  156. package/src/NumberInput/NumberInput.test.tsx +3 -48
  157. package/src/NumberInput/NumberInput.tsx +15 -32
  158. package/src/Overlay/Overlay.doc.mjs +0 -6
  159. package/src/Pagination/Pagination.test.tsx +0 -143
  160. package/src/Pagination/Pagination.tsx +23 -75
  161. package/src/Popover/Popover.test.tsx +0 -65
  162. package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
  163. package/src/PowerSearch/PowerSearch.test.tsx +1 -109
  164. package/src/PowerSearch/PowerSearch.tsx +16 -37
  165. package/src/ProgressBar/ProgressBar.test.tsx +0 -10
  166. package/src/ProgressBar/ProgressBar.tsx +1 -2
  167. package/src/Resizable/ResizeHandle.tsx +2 -10
  168. package/src/SegmentedControl/SegmentedControl.doc.mjs +1 -1
  169. package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
  170. package/src/SideNav/SideNav.doc.mjs +1 -7
  171. package/src/SideNav/SideNav.test.tsx +0 -20
  172. package/src/SideNav/SideNav.tsx +2 -6
  173. package/src/TabList/TabList.test.tsx +1 -185
  174. package/src/TabList/TabMenu.tsx +9 -45
  175. package/src/Table/BaseTable.tsx +1 -11
  176. package/src/Table/Table.test.tsx +0 -51
  177. package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +0 -13
  178. package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -3
  179. package/src/Table/plugins/pagination/paginateData.ts +1 -5
  180. package/src/Table/plugins/pagination/useTablePagination.test.tsx +0 -13
  181. package/src/Table/plugins/selection/useTableSelectionState.test.tsx +0 -23
  182. package/src/Table/plugins/selection/useTableSelectionState.tsx +6 -11
  183. package/src/Table/plugins/sortable/useTableSortableState.test.tsx +1 -35
  184. package/src/Table/plugins/sortable/useTableSortableState.tsx +4 -8
  185. package/src/TextArea/TextArea.test.tsx +3 -3
  186. package/src/TextInput/TextInput.test.tsx +3 -3
  187. package/src/Thumbnail/Thumbnail.test.tsx +2 -36
  188. package/src/Thumbnail/Thumbnail.tsx +2 -4
  189. package/src/TimeInput/TimeInput.test.tsx +0 -37
  190. package/src/TimeInput/TimeInput.tsx +1 -11
  191. package/src/Timestamp/Timestamp.doc.mjs +1 -1
  192. package/src/Toast/Toast.tsx +3 -11
  193. package/src/Toast/ToastViewport.test.tsx +0 -64
  194. package/src/Toast/ToastViewport.tsx +0 -12
  195. package/src/ToggleButton/ToggleButton.doc.mjs +0 -1
  196. package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
  197. package/src/TopNav/TopNav.doc.mjs +1 -1
  198. package/src/TreeList/TreeList.doc.mjs +2 -2
  199. package/src/Typeahead/BaseTypeahead.doc.mjs +0 -19
  200. package/src/Typeahead/BaseTypeahead.tsx +2 -5
  201. package/src/Typeahead/Typeahead.doc.mjs +1 -1
  202. package/src/Typeahead/Typeahead.test.tsx +1 -45
  203. package/src/hooks/focusableSelector.ts +1 -1
  204. package/src/hooks/useFocusTrap.doc.mjs +2 -4
  205. package/src/hooks/useFocusTrap.test.tsx +1 -149
  206. package/src/hooks/useFocusTrap.ts +1 -50
  207. package/src/theme/SyntaxTheme.doc.mjs +4 -4
  208. package/src/theme/defineTheme.ts +13 -4
  209. package/src/theme/derivedVarRegistry.test.ts +2 -2
  210. package/src/theme/expandColorScale.test.ts +0 -29
  211. package/src/theme/expandColorScale.ts +6 -11
  212. package/src/theme/hct.ts +17 -9
  213. package/src/theme/tokens.test.ts +9 -182
  214. package/src/theme/tokens.ts +4 -239
  215. package/src/theme/useTheme.test.tsx +0 -20
  216. package/src/utils/index.ts +0 -3
  217. package/src/utils/timeParser.test.ts +0 -13
  218. package/src/utils/timeParser.ts +5 -8
  219. package/dist/utils/color.d.ts +0 -42
  220. package/dist/utils/color.d.ts.map +0 -1
  221. package/dist/utils/color.js +0 -150
  222. package/src/Resizable/ResizeHandle.test.tsx +0 -180
  223. package/src/__tests__/TestIcon.tsx +0 -26
  224. package/src/docPropReferences.test.ts +0 -178
  225. package/src/utils/color.test.ts +0 -133
  226. package/src/utils/color.ts +0 -148
@@ -18,5 +18,5 @@
18
18
  * This is the canonical focusable selector; prefer importing it here over
19
19
  * re-declaring the string so behavior stays consistent across hooks.
20
20
  */
21
- export declare const FOCUSABLE_SELECTOR = "button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), [contenteditable]:not([contenteditable=\"false\"]), audio[controls], video[controls], iframe, details > summary:first-child";
21
+ export declare const FOCUSABLE_SELECTOR = "button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), [contenteditable]:not([contenteditable=\"false\"]), audio[controls], video[controls], iframe, details > summary:first-child";
22
22
  //# sourceMappingURL=focusableSelector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"focusableSelector.d.ts","sourceRoot":"","sources":["../../src/hooks/focusableSelector.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,ySACqQ,CAAC"}
1
+ {"version":3,"file":"focusableSelector.d.ts","sourceRoot":"","sources":["../../src/hooks/focusableSelector.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,4RACwP,CAAC"}
@@ -21,4 +21,4 @@
21
21
  * This is the canonical focusable selector; prefer importing it here over
22
22
  * re-declaring the string so behavior stays consistent across hooks.
23
23
  */
24
- export const FOCUSABLE_SELECTOR = 'button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child';
24
+ export const FOCUSABLE_SELECTOR = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child';
@@ -49,9 +49,6 @@ export interface UseFocusTrapReturn<T extends HTMLElement = HTMLElement> {
49
49
  * - Listens to focus events on the document
50
50
  * - Redirects focus back into the container if it escapes
51
51
  * - Handles both Tab and Shift+Tab navigation
52
- * - Restores focus to the element that was focused before activation when the
53
- * trap deactivates or unmounts, unless focus was already moved elsewhere
54
- * (so consumers that restore focus themselves are unaffected)
55
52
  *
56
53
  * @example
57
54
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"useFocusTrap.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusTrap.ts"],"names":[],"mappings":"AAgDA;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,WAAW,CAAC,EAAE,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,IAAI,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC9D,OAAO,EAAE,mBAAmB,GAC3B,kBAAkB,CAAC,CAAC,CAAC,CAoJvB"}
@@ -5,8 +5,7 @@
5
5
  /**
6
6
  * @file useFocusTrap.ts
7
7
  * @input Uses React useCallback, useEffect, useRef
8
- * @output Exports useFocusTrap hook for trapping focus within a container and
9
- * restoring focus to the previously-focused element on deactivation
8
+ * @output Exports useFocusTrap hook for trapping focus within a container
10
9
  * @position Core hook; used by dialogs, modals, date pickers
11
10
  *
12
11
  * Based on WAI-ARIA dialog pattern:
@@ -147,9 +146,6 @@ function focusLastDescendant(container) {
147
146
  * - Listens to focus events on the document
148
147
  * - Redirects focus back into the container if it escapes
149
148
  * - Handles both Tab and Shift+Tab navigation
150
- * - Restores focus to the element that was focused before activation when the
151
- * trap deactivates or unmounts, unless focus was already moved elsewhere
152
- * (so consumers that restore focus themselves are unaffected)
153
149
  *
154
150
  * @example
155
151
  * ```
@@ -189,39 +185,6 @@ export function useFocusTrap(options) {
189
185
  }
190
186
  }, []);
191
187
 
192
- /**
193
- * Capture the element focused before the trap activated, and restore focus to
194
- * it when the trap deactivates (or the component unmounts). Overlays are
195
- * opened imperatively (e.g. `showPopover()`), so the browser's declarative
196
- * popover focus restoration does not apply — without this, closing a Popover
197
- * via Escape or light dismiss drops keyboard focus to `<body>`.
198
- *
199
- * The restore is guarded so it never steals focus a consumer moved on
200
- * purpose: it only runs when focus would otherwise be lost — i.e. the active
201
- * element is nothing, the document body/root, or still inside the (possibly
202
- * now-unmounted) trap container. If focus already moved to some other element
203
- * outside the trap (the user clicked elsewhere, or a consumer such as
204
- * DropdownMenu already refocused its trigger), the restore is a no-op.
205
- */
206
- useEffect(() => {
207
- if (!isActive) {
208
- return;
209
- }
210
- const previouslyFocused = document.activeElement;
211
- // Snapshot the container now; by cleanup it may be detached or unmounted.
212
- const container = containerRef.current;
213
- return () => {
214
- const active = document.activeElement;
215
- const focusWasLost = active == null || active === document.body || active === document.documentElement || container != null && container.contains(active);
216
- if (!focusWasLost) {
217
- return;
218
- }
219
- if (previouslyFocused != null && previouslyFocused.isConnected && typeof previouslyFocused.focus === 'function') {
220
- previouslyFocused.focus();
221
- }
222
- };
223
- }, [isActive]);
224
-
225
188
  /**
226
189
  * Handle focus events - redirect focus back into container if it escapes.
227
190
  * Only redirects for keyboard navigation, not mouse clicks.
@@ -228,7 +228,7 @@ export interface DefineThemeInput {
228
228
  /**
229
229
  * Default syntax highlighting theme for code components.
230
230
  * Sets --color-syntax-* tokens at the theme root. Can be overridden
231
- * per-region (or per-instance) by wrapping in SyntaxTheme.
231
+ * per-region via SyntaxTheme or per-instance via syntaxTheme prop.
232
232
  *
233
233
  * @example
234
234
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"defineTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defineTheme.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAC,gBAAgB,EAAa,MAAM,SAAS,CAAC;AAC1D,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAoB,KAAK,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAoB,KAAK,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAmB,KAAK,gBAAgB,EAAC,MAAM,oB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B,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC;AAM9B,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAQpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"expandColorScale.d.ts","sourceRoot":"","sources":["../../src/theme/expandColorScale.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAE3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAChC;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AA8BtD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,CAkFlB"}
1
+ {"version":3,"file":"expandColorScale.d.ts","sourceRoot":"","sources":["../../src/theme/expandColorScale.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAE3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;CAChC;AAED,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AA0BtD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,CAiFlB"}
@@ -56,9 +56,6 @@ const NEUTRAL_VARIANT_CHROMA = {
56
56
  function ld(light, dark) {
57
57
  return `light-dark(${light}, ${dark})`;
58
58
  }
59
- function accentWithAlpha(alpha) {
60
- return `color-mix(in srgb, var(--color-accent) ${alpha * 100}%, transparent)`;
61
- }
62
59
 
63
60
  /**
64
61
  * Expand a color scale config into Astryx color token overrides.
@@ -96,11 +93,7 @@ export function expandColorScale(config) {
96
93
  return {
97
94
  // Core semantic
98
95
  '--color-accent': ld(P[40], P[80]),
99
- // Derived accent tokens reference --color-accent instead of baking its
100
- // resolved hex, so a scoped override of the base token re-accents the
101
- // whole subtree at runtime. --color-on-accent stays baked: it is a
102
- // contrast computation against the accent, which CSS cannot express.
103
- '--color-accent-muted': ld(accentWithAlpha(0.2), accentWithAlpha(0.25)),
96
+ '--color-accent-muted': ld(hexWithAlpha(P[40], 0.2), hexWithAlpha(P[80], 0.25)),
104
97
  '--color-on-accent': ld(P[100], P[20]),
105
98
  '--color-neutral': ld(hexWithAlpha(N[10], 0.1), hexWithAlpha(N[90], 0.2)),
106
99
  '--color-background-surface': ld(N[99], N[10]),
@@ -113,9 +106,9 @@ export function expandColorScale(config) {
113
106
  '--color-text-primary': ld(N[textPrimaryLightTone], N[textPrimaryDarkTone]),
114
107
  '--color-text-secondary': ld(NV[textSecondaryLightTone], NV[textSecondaryDarkTone]),
115
108
  '--color-text-disabled': ld(NV[60], NV[40]),
116
- '--color-text-accent': 'var(--color-accent)',
109
+ '--color-text-accent': ld(P[30], P[80]),
117
110
  // Icon
118
- '--color-icon-accent': 'var(--color-accent)',
111
+ '--color-icon-accent': ld(P[40], P[80]),
119
112
  '--color-icon-primary': ld(N[textPrimaryLightTone], N[textPrimaryDarkTone]),
120
113
  '--color-icon-secondary': ld(NV[textSecondaryLightTone], NV[textSecondaryDarkTone]),
121
114
  '--color-icon-disabled': ld(NV[60], NV[40]),
@@ -1,3 +1,18 @@
1
+ /**
2
+ * @file hct.ts
3
+ * @input Hex color string (#RRGGBB)
4
+ * @output HCT color representation (Hue, Chroma, Tone)
5
+ * @position Theme utility; consumed by expandColorScale.ts
6
+ *
7
+ * Minimal HCT (Hue, Chroma, Tone) color space implementation.
8
+ * Ported from Google's material-color-utilities (Apache-2.0).
9
+ * Zero runtime dependencies — all math is self-contained.
10
+ *
11
+ * HCT combines:
12
+ * - Hue from CIELab (perceptually uniform hue)
13
+ * - Chroma approximated via CIELab C*ab (colorfulness)
14
+ * - Tone from L* (CIE Lightness, 0=black, 100=white)
15
+ */
1
16
  export interface HCT {
2
17
  hue: number;
3
18
  chroma: number;
@@ -1 +1 @@
1
- {"version":3,"file":"hct.d.ts","sourceRoot":"","sources":["../../src/theme/hct.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAoFD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzC;AAkBD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAkBzC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CA8BzC;AAkDD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxB;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/D"}
1
+ {"version":3,"file":"hct.d.ts","sourceRoot":"","sources":["../../src/theme/hct.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAoFD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzC;AA4BD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAkBzC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CA8BzC;AAkDD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxB;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/D"}
package/dist/theme/hct.js CHANGED
@@ -16,8 +16,6 @@
16
16
  * - Tone from L* (CIE Lightness, 0=black, 100=white)
17
17
  */
18
18
 
19
- import { parseHex, formatHex } from "../utils/color.js";
20
-
21
19
  // =============================================================================
22
20
  // Types
23
21
  // =============================================================================
@@ -88,11 +86,13 @@ export function yToTone(y) {
88
86
  // =============================================================================
89
87
 
90
88
  function hexToRgb(hex) {
91
- const parsed = parseHex(hex);
92
- if (parsed === null) {
93
- return [0, 0, 0];
94
- }
95
- return [parsed.r, parsed.g, parsed.b];
89
+ const h = hex.replace('#', '');
90
+ const full = h.length === 3 ? h[0] + h[0] + h[1] + h[1] + h[2] + h[2] : h.slice(0, 6);
91
+ const n = parseInt(full, 16);
92
+ return [n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff];
93
+ }
94
+ function rgbToHex(r, g, b) {
95
+ return '#' + [r, g, b].map(c => c.toString(16).padStart(2, '0')).join('').toUpperCase();
96
96
  }
97
97
 
98
98
  // =============================================================================
@@ -142,7 +142,7 @@ export function hctToHex(hct) {
142
142
  }
143
143
  if (chroma < 0.5) {
144
144
  const gray = toneToGray(tone);
145
- return formatHex(gray, gray, gray);
145
+ return rgbToHex(gray, gray, gray);
146
146
  }
147
147
  let lo = 0;
148
148
  let hi = chroma;
@@ -183,7 +183,7 @@ function hctComponentToHex(hue, chroma, tone) {
183
183
  if (r < 0 || r > 255 || g < 0 || g > 255 || bVal < 0 || bVal > 255) {
184
184
  return null;
185
185
  }
186
- return formatHex(r, g, bVal);
186
+ return rgbToHex(r, g, bVal);
187
187
  }
188
188
 
189
189
  // =============================================================================
@@ -8,11 +8,6 @@
8
8
  * build-time theme adapters, chart configuration, canvas/SVG rendering, tests,
9
9
  * or plain JS theme objects for other styling libraries.
10
10
  *
11
- * Derived tokens can reference other tokens (`var(--color-accent)`) and use CSS
12
- * color functions (`color-mix`). The resolver follows those references through
13
- * the theme iteratively and evaluates the supported color functions so callers
14
- * receive concrete raw values, not CSS expressions.
15
- *
16
11
  * SYNC: When modified, update:
17
12
  * - /packages/core/src/theme/useTheme.ts
18
13
  * - /packages/core/src/theme/index.ts
@@ -56,11 +51,8 @@ export declare const tokenVars: Record<TokenName, string>;
56
51
  * The result starts with `tokenDefaults`, applies `theme.tokens`, then
57
52
  * reapplies `theme.__inputTokens` when available so explicit tuple overrides
58
53
  * retain their original light/dark sides instead of relying on CSS parsing.
59
- * A final pass resolves any `var()` references between tokens and evaluates
60
- * the CSS color functions the theme generator emits (e.g. `color-mix`), so
61
- * derived tokens like `--color-text-accent` return concrete values rather than
62
- * `var(--color-accent)`. This mirrors the token resolution used by
63
- * `useTheme()` but does not need React context or media queries.
54
+ * This mirrors the token resolution used by `useTheme()` but does not need
55
+ * React context or media queries.
64
56
  *
65
57
  * Pass `theme` as null/undefined to resolve defaults only.
66
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AAGvB,kFAAkF;A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B,SAAQ,yBAAyB;IACzE,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,MAAM,CAEhE;AAED,sFAAsF;AACtF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAElB,CAAC;AAmF/B;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACtC,OAAO,EAAE,yBAAyB,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAyBxB;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACtC,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAC/B,OAAO,EAAE,wBAAwB,GAChC,MAAM,CAGR"}
@@ -10,18 +10,12 @@
10
10
  * build-time theme adapters, chart configuration, canvas/SVG rendering, tests,
11
11
  * or plain JS theme objects for other styling libraries.
12
12
  *
13
- * Derived tokens can reference other tokens (`var(--color-accent)`) and use CSS
14
- * color functions (`color-mix`). The resolver follows those references through
15
- * the theme iteratively and evaluates the supported color functions so callers
16
- * receive concrete raw values, not CSS expressions.
17
- *
18
13
  * SYNC: When modified, update:
19
14
  * - /packages/core/src/theme/useTheme.ts
20
15
  * - /packages/core/src/theme/index.ts
21
16
  */
22
17
 
23
18
  import { tokenDefaults } from "./defineTheme.js";
24
- import { parseColor, formatColor } from "../utils/color.js";
25
19
 
26
20
  /** Resolved color mode used when choosing the side of light/dark token values. */
27
21
 
@@ -121,224 +115,14 @@ function resolveXDSTokenValue(value, mode) {
121
115
  return value;
122
116
  }
123
117
 
124
- // =============================================================================
125
- // Reference resolution — turn token expressions into concrete raw values
126
- // =============================================================================
127
- //
128
- // Generated themes emit derived tokens as references to other tokens rather
129
- // than baked-in values, so a scoped CSS override of a base token re-themes the
130
- // subtree that references it. The CSS cascade resolves those references, but
131
- // non-CSS consumers (canvas, SVG, data-viz) need the concrete value. These
132
- // helpers replay the same resolution in JS: follow `var()` references through
133
- // the resolved token map (iteratively, guarding against cycles) and evaluate
134
- // the CSS color functions used by the theme generator against those values.
135
-
136
- /** Index of the `)` matching the `(` at `openIndex`, or -1 when unbalanced. */
137
- function findMatchingParen(input, openIndex) {
138
- let depth = 0;
139
- for (let i = openIndex; i < input.length; i++) {
140
- const char = input[i];
141
- if (char === '(') {
142
- depth++;
143
- } else if (char === ')') {
144
- depth--;
145
- if (depth === 0) {
146
- return i;
147
- }
148
- }
149
- }
150
- return -1;
151
- }
152
-
153
- /** Split a color-mix component into its color and optional percentage. */
154
- function parseMixComponent(part) {
155
- const trimmed = part.trim();
156
- const match = trimmed.match(/\s+([\d.]+)%$/);
157
- if (match) {
158
- return {
159
- color: trimmed.slice(0, match.index).trim(),
160
- percentage: parseFloat(match[1])
161
- };
162
- }
163
- return {
164
- color: trimmed,
165
- percentage: null
166
- };
167
- }
168
-
169
- /**
170
- * Evaluate `color-mix(in <space>, c1 [p1], c2 [p2])` to a concrete color.
171
- *
172
- * Supports the `srgb` color space (the one the theme generator emits) using
173
- * the CSS Color 5 algorithm: normalize the percentages, interpolate the
174
- * premultiplied channels, then apply the alpha multiplier when the mix weights
175
- * sum to less than 100%. Returns null for anything it can't evaluate so the
176
- * original expression is preserved rather than guessed.
177
- */
178
- function evaluateColorMix(body) {
179
- const spaceMatch = body.match(/^in\s+([\w-]+)\s*,\s*(.+)$/s);
180
- if (!spaceMatch) {
181
- return null;
182
- }
183
- const [, colorSpace, rest] = spaceMatch;
184
- if (colorSpace.toLowerCase() !== 'srgb') {
185
- return null;
186
- }
187
- const split = splitTopLevelComma(rest);
188
- if (split === null) {
189
- return null;
190
- }
191
- const first = parseMixComponent(split[0]);
192
- const second = parseMixComponent(split[1]);
193
- if (first === null || second === null) {
194
- return null;
195
- }
196
- const c1 = parseColor(first.color);
197
- const c2 = parseColor(second.color);
198
- if (c1 === null || c2 === null) {
199
- return null;
200
- }
201
-
202
- // Fill in omitted percentages, then normalize so they sum to 100%.
203
- let p1;
204
- let p2;
205
- if (first.percentage !== null && second.percentage !== null) {
206
- p1 = first.percentage;
207
- p2 = second.percentage;
208
- } else if (first.percentage !== null) {
209
- p1 = first.percentage;
210
- p2 = 100 - p1;
211
- } else if (second.percentage !== null) {
212
- p2 = second.percentage;
213
- p1 = 100 - p2;
214
- } else {
215
- p1 = 50;
216
- p2 = 50;
217
- }
218
- const sum = p1 + p2;
219
- if (sum <= 0) {
220
- return null;
221
- }
222
- const w1 = p1 / sum;
223
- const w2 = p2 / sum;
224
- const alphaMultiplier = sum < 100 ? sum / 100 : 1;
225
-
226
- // Interpolate in premultiplied sRGB, then un-premultiply.
227
- const mixedA = w1 * c1.a + w2 * c2.a;
228
- const premix = (k1, k2) => w1 * k1 * c1.a + w2 * k2 * c2.a;
229
- const rp = premix(c1.r, c2.r);
230
- const gp = premix(c1.g, c2.g);
231
- const bp = premix(c1.b, c2.b);
232
- const rgb = mixedA === 0 ? {
233
- r: 0,
234
- g: 0,
235
- b: 0
236
- } : {
237
- r: rp / mixedA,
238
- g: gp / mixedA,
239
- b: bp / mixedA
240
- };
241
- return formatColor({
242
- ...rgb,
243
- a: mixedA * alphaMultiplier
244
- });
245
- }
246
-
247
- /** Evaluate every supported color function in an expression, innermost first. */
248
- function evaluateColorFunctions(expr) {
249
- const idx = expr.indexOf('color-mix(');
250
- if (idx === -1) {
251
- return expr;
252
- }
253
- const openIndex = idx + 'color-mix'.length;
254
- const closeIndex = findMatchingParen(expr, openIndex);
255
- if (closeIndex === -1) {
256
- return expr;
257
- }
258
- const body = evaluateColorFunctions(expr.slice(openIndex + 1, closeIndex));
259
- const evaluated = evaluateColorMix(body);
260
- const replacement = evaluated ?? `color-mix(${body})`;
261
- return expr.slice(0, idx) + replacement + evaluateColorFunctions(expr.slice(closeIndex + 1));
262
- }
263
-
264
- /**
265
- * Substitute `var(--name[, fallback])` references with their resolved values.
266
- * `seen` tracks the reference chain so cycles resolve to the literal reference
267
- * instead of recursing forever.
268
- */
269
- function substituteVars(expr, raw, cache, seen) {
270
- const start = expr.indexOf('var(');
271
- if (start === -1) {
272
- return expr;
273
- }
274
- const openIndex = start + 'var'.length;
275
- const closeIndex = findMatchingParen(expr, openIndex);
276
- if (closeIndex === -1) {
277
- return expr;
278
- }
279
- const inner = expr.slice(openIndex + 1, closeIndex);
280
- const commaSplit = splitTopLevelComma(inner);
281
- const name = (commaSplit ? commaSplit[0] : inner).trim();
282
- const fallback = commaSplit ? commaSplit[1] : null;
283
- let replacement;
284
- if (seen.has(name)) {
285
- replacement = expr.slice(start, closeIndex + 1);
286
- } else if (name in raw) {
287
- seen.add(name);
288
- replacement = resolveReference(name, raw, cache, seen);
289
- seen.delete(name);
290
- } else if (fallback !== null) {
291
- replacement = substituteVars(fallback.trim(), raw, cache, seen);
292
- } else {
293
- replacement = expr.slice(start, closeIndex + 1);
294
- }
295
- const rest = substituteVars(expr.slice(closeIndex + 1), raw, cache, seen);
296
- return expr.slice(0, start) + replacement + rest;
297
- }
298
-
299
- /** Fully resolve a single expression: substitute references, then evaluate colors. */
300
- function resolveExpression(expr, raw, cache, seen) {
301
- if (!expr.includes('var(') && !expr.includes('color-mix(')) {
302
- return expr;
303
- }
304
- const substituted = substituteVars(expr, raw, cache, seen);
305
- return evaluateColorFunctions(substituted);
306
- }
307
-
308
- /** Resolve one token by name, memoizing the result in `cache`. */
309
- function resolveReference(name, raw, cache, seen) {
310
- if (name in cache) {
311
- return cache[name];
312
- }
313
- const value = raw[name];
314
- if (value === undefined) {
315
- return '';
316
- }
317
- const resolved = resolveExpression(value, raw, cache, seen);
318
- cache[name] = resolved;
319
- return resolved;
320
- }
321
-
322
- /** Resolve every reference/color function in a raw token map to concrete values. */
323
- function resolveReferences(raw) {
324
- const cache = {};
325
- for (const name of Object.keys(raw)) {
326
- resolveReference(name, raw, cache, new Set());
327
- }
328
- return cache;
329
- }
330
-
331
118
  /**
332
119
  * Resolve all Astryx token values for a theme and effective color mode.
333
120
  *
334
121
  * The result starts with `tokenDefaults`, applies `theme.tokens`, then
335
122
  * reapplies `theme.__inputTokens` when available so explicit tuple overrides
336
123
  * retain their original light/dark sides instead of relying on CSS parsing.
337
- * A final pass resolves any `var()` references between tokens and evaluates
338
- * the CSS color functions the theme generator emits (e.g. `color-mix`), so
339
- * derived tokens like `--color-text-accent` return concrete values rather than
340
- * `var(--color-accent)`. This mirrors the token resolution used by
341
- * `useTheme()` but does not need React context or media queries.
124
+ * This mirrors the token resolution used by `useTheme()` but does not need
125
+ * React context or media queries.
342
126
  *
343
127
  * Pass `theme` as null/undefined to resolve defaults only.
344
128
  */
@@ -351,7 +135,7 @@ export function resolveThemeTokens(theme, options) {
351
135
  resolved[key] = resolveXDSTokenValue(value, mode);
352
136
  }
353
137
  if (theme == null) {
354
- return resolveReferences(resolved);
138
+ return resolved;
355
139
  }
356
140
  for (const [key, value] of Object.entries(theme.tokens)) {
357
141
  resolved[key] = resolveXDSTokenValue(value, mode);
@@ -363,7 +147,7 @@ export function resolveThemeTokens(theme, options) {
363
147
  }
364
148
  }
365
149
  }
366
- return resolveReferences(resolved);
150
+ return resolved;
367
151
  }
368
152
 
369
153
  /** Resolve one Astryx token value for a theme and effective color mode. */
@@ -22,6 +22,4 @@ export { observeResize, unobserveResize } from './sharedResizeObserver';
22
22
  export { isRenderable } from './isRenderable';
23
23
  export { getInputARIA } from './inputAria';
24
24
  export type { InputARIA, InputARIAInputGroup } from './inputAria';
25
- export { parseHex, parseRgb, parseColor, formatHex, formatColor } from './color';
26
- export type { RGBA } from './color';
27
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AA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AAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,SAAS,EACT,UAAU,EACV,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAC,MAAM,UAAU,CAAC;AAE5D,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,UAAU,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAC7D,YAAY,EACV,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AACtD,YAAY,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAE,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,YAAY,EAAC,SAAS,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC"}
@@ -18,5 +18,4 @@ export { themeProps, themeDataAttributes } from "./themeProps.js";
18
18
  export { groupItems, getItemGroup } from "./groupItems.js";
19
19
  export { observeResize, unobserveResize } from "./sharedResizeObserver.js";
20
20
  export { isRenderable } from "./isRenderable.js";
21
- export { getInputARIA } from "./inputAria.js";
22
- export { parseHex, parseRgb, parseColor, formatHex, formatColor } from "./color.js";
21
+ export { getInputARIA } from "./inputAria.js";
@@ -1 +1 @@
1
- {"version":3,"file":"timeParser.d.ts","sourceRoot":"","sources":["../../src/utils/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AAW,CACzB,CAAC,EAAE,aAAa,GAAG,SAAS,EAC5B,CAAC,EAAE,aAAa,GAAG,SAAS,GAC3B,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAoBf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAqBf"}
@@ -305,16 +305,13 @@ export function adjustTime(time, deltaMinutes, includeSeconds = false) {
305
305
  if (!parsed) {
306
306
  return time;
307
307
  }
308
-
309
- // A non-finite delta would spin the wrap-around forever (-Infinity) or
310
- // produce "NaN:NaN" (NaN) — return the input unchanged instead.
311
- if (!Number.isFinite(deltaMinutes)) {
312
- return time;
313
- }
314
308
  let totalMinutes = parsed.hour * 60 + parsed.minute + deltaMinutes;
315
309
 
316
- // Wrap around midnight (double-modulo handles negatives in O(1))
317
- totalMinutes = (totalMinutes % (24 * 60) + 24 * 60) % (24 * 60);
310
+ // Wrap around midnight
311
+ while (totalMinutes < 0) {
312
+ totalMinutes += 24 * 60;
313
+ }
314
+ totalMinutes = totalMinutes % (24 * 60);
318
315
  const newHour = Math.floor(totalMinutes / 60);
319
316
  const newMinute = totalMinutes % 60;
320
317
  return formatISOTime({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/core",
3
- "version": "0.1.4-canary.37c19d3",
3
+ "version": "0.1.4-canary.39ffd21",
4
4
  "displayName": "XDS Core",
5
5
  "description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
6
6
  "author": "Meta Open Source",
@@ -106,15 +106,4 @@ export const docsDense = {
106
106
  {guidance: false, description: 'Force a square or custom shape. Avatars are always circular.'},
107
107
  ],
108
108
  },
109
- propDescriptions: {
110
- src: 'primary image source URL',
111
- fallbackSrc: 'fallback image when primary fails',
112
- name: 'user name for initials and alt text',
113
- alt: 'alt text; falls back to name',
114
- size: "avatar size. Named ('tiny', 'xsmall', 'small', 'medium', 'large') or numeric px. Short names 'sm'/'md'/'lg' are NOT valid; use full words.",
115
- status: 'corner content for status indicators',
116
- },
117
- components: [
118
- {name: 'AvatarStatusDot', description: 'size-aware status indicator rendered in the Avatar corner'},
119
- ],
120
109
  };
@@ -113,7 +113,6 @@ export const docs = {
113
113
  targets: [
114
114
  {className: 'astryx-banner', visualProps: ['container', 'status']},
115
115
  {className: 'astryx-banner-icon', visualProps: ['status']},
116
- {className: 'astryx-banner-content', visualProps: ['container', 'status']},
117
116
  ],
118
117
  vars: [
119
118
  {name: '--_banner-radius', description: 'Border radius (card container only)', default: 'var(--radius-container)', private: true},
@@ -181,13 +180,6 @@ export const docsZh = {
181
180
  'status',
182
181
  ],
183
182
  },
184
- {
185
- className: 'astryx-banner-content',
186
- visualProps: [
187
- 'container',
188
- 'status',
189
- ],
190
- },
191
183
  ],
192
184
  vars: [
193
185
  {name: '--_banner-radius', description: 'Border radius (card container only)', default: 'var(--radius-container)', private: true},