@astryxdesign/cli 0.7.1-canary.ff40b78 → 0.7.2-canary.07f97c6

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 (55) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/api/build/_adapter.d.mts +1 -0
  3. package/api/build/_adapter.mjs +7 -0
  4. package/api/build/build.mjs +4 -1
  5. package/api/component/component.test.mjs +357 -184
  6. package/api/search/search.mjs +12 -0
  7. package/api/template/table-filter-view-tabs.test.mjs +45 -0
  8. package/api/theme/build/build.core-on-demand.test.mjs +113 -0
  9. package/api/theme/build/build.d.mts +13 -13
  10. package/api/theme/build/build.mjs +72 -37
  11. package/assets/docs/getting-started.doc.mjs +0 -10
  12. package/assets/docs/styling-overview.doc.mjs +54 -15
  13. package/assets/docs/tree/migration-setup.doc.mjs +31 -6
  14. package/assets/docs/tree/responsive.doc.mjs +37 -0
  15. package/assets/docs/tree/tailwind.doc.mjs +12 -0
  16. package/assets/docs/tree/tokens-and-setup.doc.mjs +3 -2
  17. package/assets/docs/tree/tokens-syntax.doc.mjs +20 -0
  18. package/assets/docs/tree/tokens.doc.mjs +1 -1
  19. package/assets/templates/blocks/components/CommandPalette/CommandPaletteAsyncSearch.tsx +6 -1
  20. package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
  21. package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
  22. package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
  23. package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
  24. package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
  25. package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
  26. package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
  27. package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
  28. package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
  29. package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
  30. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
  31. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
  32. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
  33. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
  34. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
  35. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
  36. package/assets/templates/pages/detail-page/page.tsx +3 -3
  37. package/assets/templates/pages/table-filter/page.tsx +3 -2
  38. package/assets/templates/pages/table-inbox/page.tsx +10 -8
  39. package/assets/templates/themes/butter/butterTheme.ts +53 -11
  40. package/assets/templates/themes/chocolate/chocolateTheme.ts +29 -5
  41. package/assets/templates/themes/gothic/gothicTheme.ts +44 -9
  42. package/assets/templates/themes/stone/stoneTheme.ts +58 -11
  43. package/assets/templates/themes/y2k/y2kTheme.ts +60 -10
  44. package/authoring/doctypes/base/type.ts +6 -0
  45. package/authoring/doctypes/component/component.doc.mjs +2 -2
  46. package/clients/cli/commands/build-theme.mjs +32 -4
  47. package/clients/cli/commands/build-theme.watch.test.mjs +63 -2
  48. package/clients/cli/lib/component-format.mjs +5 -1
  49. package/foundation/discovery/component-discovery.mjs +27 -26
  50. package/foundation/discovery/hook-discovery.mjs +13 -12
  51. package/foundation/fs/listing-cache.d.mts +36 -0
  52. package/foundation/fs/listing-cache.mjs +95 -0
  53. package/foundation/fs/listing-cache.test.mjs +88 -0
  54. package/foundation/fs/paths.mjs +3 -2
  55. package/package.json +10 -10
@@ -1652,8 +1652,8 @@ const COMPOSER_TOOLS: {
1652
1652
  /**
1653
1653
  * The compose sheet.
1654
1654
  *
1655
- * **`BottomSheet hasScrim={false}`, which is the only non-modal surface in
1656
- * core.** With the scrim off the sheet opens with `show()` rather than
1655
+ * **`BottomSheet hasScrim={false}` keeps this bottom-edge composer non-modal.**
1656
+ * With the scrim off the sheet opens with `show()` rather than
1657
1657
  * `showModal()`, so it never enters the top layer, never makes the page inert
1658
1658
  * and never locks body scroll: the inbox behind it stays live. That matters
1659
1659
  * more here than anywhere else in this template, because writing a message is
@@ -1661,12 +1661,14 @@ const COMPOSER_TOOLS: {
1661
1661
  * actually said, copy an order number out of a thread. A modal composer
1662
1662
  * answers that with "close me first".
1663
1663
  *
1664
- * The trade is position, and it is worth naming. A sheet rises from the bottom
1665
- * edge, centred: its positioner is `inset-inline: 0` with
1666
- * `justify-content: center`, and there is no anchor, side or width prop. So
1667
- * this cannot be docked to the inline-end corner the way a `Dialog` can be.
1668
- * `Dialog` takes a static `position` and would put the window in that corner —
1669
- * but `Dialog` is always modal, so buying the corner costs the live inbox.
1664
+ * The trade is bottom-edge geometry, and it is worth naming. A non-modal
1665
+ * `Drawer` keeps page context live from an inline edge, but it is a full-height
1666
+ * side panel; this composer intentionally rises from the bottom. A sheet's
1667
+ * positioner is `inset-inline: 0` with `justify-content: center`, and there is
1668
+ * no anchor, side or width prop. So this cannot be docked to the inline-end
1669
+ * corner the way a `Dialog` can be. `Dialog` takes a static `position` and would
1670
+ * put the window in that corner — but `Dialog` is always modal, so buying the
1671
+ * corner costs the live inbox.
1670
1672
  * `ChatComposerDrawer` is a false friend: despite the name it is an in-flow
1671
1673
  * disclosure tray for a ChatComposer's attachments, with no positioning of its
1672
1674
  * own.
@@ -43,6 +43,55 @@ const butterSyntax = defineSyntaxTheme({
43
43
  },
44
44
  });
45
45
 
46
+ /**
47
+ * The secondary Button treatment. Selector, MultiSelector, and ComplexSelector
48
+ * reuse it for their `secondary` trigger so every secondary control in this
49
+ * theme matches (AST-079 FR2).
50
+ *
51
+ * Secondary: blue outline + label in light, butter yellow in dark.
52
+ */
53
+ const SECONDARY_BUTTON = {
54
+ backgroundColor: 'transparent',
55
+ borderWidth: '1.5px',
56
+ borderStyle: 'solid',
57
+ borderColor: 'light-dark(#225BFF, #FDEE8C)',
58
+ color: 'light-dark(#225BFF, #FDEE8C)',
59
+ ':hover': {
60
+ backgroundColor: 'light-dark(#225BFF14, #FDEE8C14)',
61
+ },
62
+ } as const;
63
+
64
+ /**
65
+ * The secondary Button treatment on Selector and MultiSelector triggers
66
+ * (AST-079 FR2). Inside an InputGroup a trigger keeps the neutral fill and the
67
+ * group's edges instead (FR6). The hover stays off disabled and read-only
68
+ * triggers, which carry `data-disabled` and `data-readonly`.
69
+ */
70
+ const SECONDARY_SELECTOR = {
71
+ ':not(.astryx-input-group *)': {
72
+ backgroundColor: SECONDARY_BUTTON.backgroundColor,
73
+ borderWidth: SECONDARY_BUTTON.borderWidth,
74
+ borderStyle: SECONDARY_BUTTON.borderStyle,
75
+ borderColor: SECONDARY_BUTTON.borderColor,
76
+ color: SECONDARY_BUTTON.color,
77
+ },
78
+ ':hover:not([data-disabled], [data-readonly], .astryx-input-group *)':
79
+ SECONDARY_BUTTON[':hover'],
80
+ } as const;
81
+
82
+ /**
83
+ * The secondary Button treatment on ComplexSelector triggers (AST-079 FR2), with
84
+ * the hover kept off a disabled trigger, whose inner button is disabled.
85
+ */
86
+ const SECONDARY_COMPLEX_SELECTOR = {
87
+ backgroundColor: SECONDARY_BUTTON.backgroundColor,
88
+ borderWidth: SECONDARY_BUTTON.borderWidth,
89
+ borderStyle: SECONDARY_BUTTON.borderStyle,
90
+ borderColor: SECONDARY_BUTTON.borderColor,
91
+ color: SECONDARY_BUTTON.color,
92
+ ':hover:not(:has(> :disabled))': SECONDARY_BUTTON[':hover'],
93
+ } as const;
94
+
46
95
  export const butterTheme = defineTheme({
47
96
  name: 'butter',
48
97
 
@@ -276,17 +325,7 @@ export const butterTheme = defineTheme({
276
325
  paddingBlock: 'var(--spacing-3)',
277
326
  paddingInline: 'var(--spacing-4)',
278
327
  },
279
- // Secondary: blue outline + label in light, butter yellow in dark.
280
- 'variant:secondary': {
281
- backgroundColor: 'transparent',
282
- borderWidth: '1.5px',
283
- borderStyle: 'solid',
284
- borderColor: 'light-dark(#225BFF, #FDEE8C)',
285
- color: 'light-dark(#225BFF, #FDEE8C)',
286
- ':hover': {
287
- backgroundColor: 'light-dark(#225BFF14, #FDEE8C14)',
288
- },
289
- },
328
+ 'variant:secondary': SECONDARY_BUTTON,
290
329
  // Ghost: same accent color as secondary, no background.
291
330
  'variant:ghost': {
292
331
  color: 'light-dark(#225BFF, #FDEE8C)',
@@ -534,6 +573,7 @@ export const butterTheme = defineTheme({
534
573
  'status:success': {'--color-success': '#91D143'},
535
574
  'status:warning': {'--color-warning': '#ffc502'},
536
575
  'status:error': {'--color-error': '#fc473b'},
576
+ 'variant:secondary': SECONDARY_SELECTOR,
537
577
  },
538
578
  'multi-selector': {
539
579
  base: {
@@ -544,7 +584,9 @@ export const butterTheme = defineTheme({
544
584
  'status:success': {'--color-success': '#91D143'},
545
585
  'status:warning': {'--color-warning': '#ffc502'},
546
586
  'status:error': {'--color-error': '#fc473b'},
587
+ 'variant:secondary': SECONDARY_SELECTOR,
547
588
  },
589
+ 'complex-selector': {'variant:secondary': SECONDARY_COMPLEX_SELECTOR},
548
590
  typeahead: {
549
591
  base: {
550
592
  paddingBlock: 'var(--spacing-2)',
@@ -34,6 +34,30 @@ const chocolateSyntax = defineSyntaxTheme({
34
34
  },
35
35
  });
36
36
 
37
+ /**
38
+ * The secondary Button treatment. Selector, MultiSelector, and ComplexSelector
39
+ * reuse it for their `secondary` trigger so every secondary control in this
40
+ * theme matches (AST-079 FR2).
41
+ */
42
+ const SECONDARY_BUTTON = {
43
+ borderWidth: '1px',
44
+ borderStyle: 'solid',
45
+ borderColor: 'var(--color-border-emphasized)',
46
+ } as const;
47
+
48
+ /**
49
+ * The secondary Button treatment on Selector and MultiSelector triggers
50
+ * (AST-079 FR2). Inside an InputGroup a trigger keeps the neutral fill and the
51
+ * group's edges instead (FR6).
52
+ */
53
+ const SECONDARY_SELECTOR = {
54
+ ':not(.astryx-input-group *)': {
55
+ borderWidth: SECONDARY_BUTTON.borderWidth,
56
+ borderStyle: SECONDARY_BUTTON.borderStyle,
57
+ borderColor: SECONDARY_BUTTON.borderColor,
58
+ },
59
+ } as const;
60
+
37
61
  export const chocolateTheme = defineTheme({
38
62
  name: 'chocolate',
39
63
 
@@ -219,12 +243,12 @@ export const chocolateTheme = defineTheme({
219
243
  base: {
220
244
  borderRadius: 'var(--radius-full)',
221
245
  },
222
- 'variant:secondary': {
223
- borderWidth: '1px',
224
- borderStyle: 'solid',
225
- borderColor: 'var(--color-border-emphasized)',
226
- },
246
+ 'variant:secondary': SECONDARY_BUTTON,
227
247
  },
248
+ // Secondary selector triggers match the secondary Button (AST-079 FR2).
249
+ selector: {'variant:secondary': SECONDARY_SELECTOR},
250
+ 'multi-selector': {'variant:secondary': SECONDARY_SELECTOR},
251
+ 'complex-selector': {'variant:secondary': SECONDARY_BUTTON},
228
252
 
229
253
  card: {
230
254
  base: {
@@ -40,9 +40,48 @@ const gothicSyntax = defineSyntaxTheme({
40
40
  property: '#7cc5b3', // Verdigris
41
41
  punctuation: '#7a8290', // Mid neutral
42
42
  background: '#101314',
43
+ // Diff rows on the near-black background: any lighter wash lowers every
44
+ // light token's contrast, so the rows take opaque hues at the
45
+ // background's own luminance — a deep green and a deep red that read as
46
+ // colour, not brightness — and every token keeps the contrast it has on
47
+ // the plain background. Markers: forest moss and blood crimson.
48
+ added: '#081408',
49
+ removed: '#1e0a0a',
50
+ 'added-marker': '#a3c987',
51
+ 'removed-marker': '#d97580',
43
52
  },
44
53
  });
45
54
 
55
+ /**
56
+ * The secondary Button treatment. Selector, MultiSelector, and ComplexSelector
57
+ * reuse it for their `secondary` trigger so every secondary control in this
58
+ * theme matches (AST-079 FR2).
59
+ *
60
+ * Primary inherits default — light pill with dark text via
61
+ * --color-accent / --color-on-accent (matches the cream badge).
62
+ * Secondary uses the dark-slate "neutral" badge treatment.
63
+ */
64
+ const SECONDARY_BUTTON = {
65
+ backgroundColor: 'var(--color-background-gray)',
66
+ color: 'var(--color-text-gray)',
67
+ borderColor: 'transparent',
68
+ borderWidth: '0',
69
+ } as const;
70
+
71
+ /**
72
+ * The secondary Button treatment on Selector and MultiSelector triggers
73
+ * (AST-079 FR2). Inside an InputGroup a trigger keeps the neutral fill and the
74
+ * group's edges instead (FR6).
75
+ */
76
+ const SECONDARY_SELECTOR = {
77
+ ':not(.astryx-input-group *)': {
78
+ backgroundColor: SECONDARY_BUTTON.backgroundColor,
79
+ color: SECONDARY_BUTTON.color,
80
+ borderColor: SECONDARY_BUTTON.borderColor,
81
+ borderWidth: SECONDARY_BUTTON.borderWidth,
82
+ },
83
+ } as const;
84
+
46
85
  export const gothicTheme = defineTheme({
47
86
  name: 'gothic',
48
87
 
@@ -227,15 +266,7 @@ export const gothicTheme = defineTheme({
227
266
 
228
267
  components: {
229
268
  button: {
230
- // Primary inherits default — light pill with dark text via
231
- // --color-accent / --color-on-accent (matches the cream badge).
232
- // Secondary uses the dark-slate "neutral" badge treatment.
233
- 'variant:secondary': {
234
- backgroundColor: 'var(--color-background-gray)',
235
- color: 'var(--color-text-gray)',
236
- borderColor: 'transparent',
237
- borderWidth: '0',
238
- },
269
+ 'variant:secondary': SECONDARY_BUTTON,
239
270
  'variant:ghost': {
240
271
  ':hover': {
241
272
  backgroundColor: 'var(--color-overlay-hover)',
@@ -248,6 +279,10 @@ export const gothicTheme = defineTheme({
248
279
  color: 'var(--color-text-red)',
249
280
  },
250
281
  },
282
+ // Secondary selector triggers match the secondary Button (AST-079 FR2).
283
+ selector: {'variant:secondary': SECONDARY_SELECTOR},
284
+ 'multi-selector': {'variant:secondary': SECONDARY_SELECTOR},
285
+ 'complex-selector': {'variant:secondary': SECONDARY_BUTTON},
251
286
 
252
287
  badge: {
253
288
  base: {
@@ -56,9 +56,60 @@ const stoneSyntax = defineSyntaxTheme({
56
56
  property: ['#4e6357', '#94b2a0'], // Teal T40 / T70
57
57
  punctuation: ['#5e5e5e', '#ababb0'], // Stone Neutral T40 / T70
58
58
  background: ['#f3f3f5', '#171719'],
59
+ // Diff rows: the muted green/red at 25% in light and 20% in dark keep
60
+ // every token at or above 4.5:1 on the tint; the markers are the tinted
61
+ // text tokens (8.1:1 light, 8.8:1 dark on their tints).
62
+ added: ['#d0e9ce40', '#b4cdb233'],
63
+ removed: ['#f9dcd740', '#dcc0bc33'],
64
+ 'added-marker': ['#374c36', '#d0e9ce'],
65
+ 'removed-marker': ['#58413e', '#f9dcd7'],
59
66
  },
60
67
  });
61
68
 
69
+ /**
70
+ * The secondary Button treatment. Selector, MultiSelector, and ComplexSelector
71
+ * reuse it for their `secondary` trigger so every secondary control in this
72
+ * theme matches (AST-079 FR2).
73
+ */
74
+ const SECONDARY_BUTTON = {
75
+ backgroundColor: 'transparent',
76
+ borderWidth: '1.5px',
77
+ borderStyle: 'solid',
78
+ borderColor: 'var(--color-border-emphasized)',
79
+ ':hover': {
80
+ backgroundColor: 'var(--color-neutral)',
81
+ },
82
+ } as const;
83
+
84
+ /**
85
+ * The secondary Button treatment on Selector and MultiSelector triggers
86
+ * (AST-079 FR2). Inside an InputGroup a trigger keeps the neutral fill and the
87
+ * group's edges instead (FR6). The hover stays off disabled and read-only
88
+ * triggers, which carry `data-disabled` and `data-readonly`.
89
+ */
90
+ const SECONDARY_SELECTOR = {
91
+ ':not(.astryx-input-group *)': {
92
+ backgroundColor: SECONDARY_BUTTON.backgroundColor,
93
+ borderWidth: SECONDARY_BUTTON.borderWidth,
94
+ borderStyle: SECONDARY_BUTTON.borderStyle,
95
+ borderColor: SECONDARY_BUTTON.borderColor,
96
+ },
97
+ ':hover:not([data-disabled], [data-readonly], .astryx-input-group *)':
98
+ SECONDARY_BUTTON[':hover'],
99
+ } as const;
100
+
101
+ /**
102
+ * The secondary Button treatment on ComplexSelector triggers (AST-079 FR2), with
103
+ * the hover kept off a disabled trigger, whose inner button is disabled.
104
+ */
105
+ const SECONDARY_COMPLEX_SELECTOR = {
106
+ backgroundColor: SECONDARY_BUTTON.backgroundColor,
107
+ borderWidth: SECONDARY_BUTTON.borderWidth,
108
+ borderStyle: SECONDARY_BUTTON.borderStyle,
109
+ borderColor: SECONDARY_BUTTON.borderColor,
110
+ ':hover:not(:has(> :disabled))': SECONDARY_BUTTON[':hover'],
111
+ } as const;
112
+
62
113
  export const stoneTheme = defineTheme({
63
114
  name: 'stone',
64
115
 
@@ -262,15 +313,7 @@ export const stoneTheme = defineTheme({
262
313
  base: {
263
314
  borderRadius: 'var(--radius-full)',
264
315
  },
265
- 'variant:secondary': {
266
- backgroundColor: 'transparent',
267
- borderWidth: '1.5px',
268
- borderStyle: 'solid',
269
- borderColor: 'var(--color-border-emphasized)',
270
- ':hover': {
271
- backgroundColor: 'var(--color-neutral)',
272
- },
273
- },
316
+ 'variant:secondary': SECONDARY_BUTTON,
274
317
  'variant:destructive': {
275
318
  backgroundColor: 'var(--color-background-red)',
276
319
  color: 'var(--color-text-red)',
@@ -389,8 +432,12 @@ export const stoneTheme = defineTheme({
389
432
  'number-input': INPUT_STATUS_VARS,
390
433
  'date-input': INPUT_STATUS_VARS,
391
434
  'time-input': INPUT_STATUS_VARS,
392
- selector: INPUT_STATUS_VARS,
393
- 'multi-selector': INPUT_STATUS_VARS,
435
+ selector: {...INPUT_STATUS_VARS, 'variant:secondary': SECONDARY_SELECTOR},
436
+ 'multi-selector': {
437
+ ...INPUT_STATUS_VARS,
438
+ 'variant:secondary': SECONDARY_SELECTOR,
439
+ },
440
+ 'complex-selector': {'variant:secondary': SECONDARY_COMPLEX_SELECTOR},
394
441
  typeahead: INPUT_STATUS_VARS,
395
442
  tokenizer: INPUT_STATUS_VARS,
396
443
 
@@ -29,9 +29,64 @@ const y2kSyntax = defineSyntaxTheme({
29
29
  property: ['#3c6755', '#87b5a1'],
30
30
  punctuation: ['#5e5e5e', '#ababab'],
31
31
  background: ['#FFF6ED', '#190f00'],
32
+ // Diff rows: the muted green/red at 25% in light and 20% in dark keep
33
+ // every token at or above 4.5:1 on the tint. Markers: the tinted text
34
+ // tokens in light (7.3:1 / 7.9:1); in dark those tokens are near-black,
35
+ // so the string and tag colours mark the rows (5.1:1 each).
36
+ added: ['#C5E17A40', '#C5E17A33'],
37
+ removed: ['#FFC5C340', '#FFC5C333'],
38
+ 'added-marker': ['#3a5500', '#a5af8b'],
39
+ 'removed-marker': ['#8b1d24', '#d19f9d'],
32
40
  },
33
41
  });
34
42
 
43
+ /**
44
+ * The secondary Button treatment. Selector, MultiSelector, and ComplexSelector
45
+ * reuse it for their `secondary` trigger so every secondary control in this
46
+ * theme matches (AST-079 FR2).
47
+ */
48
+ const SECONDARY_BUTTON = {
49
+ backgroundColor: 'var(--color-background-green)',
50
+ borderWidth: '1px',
51
+ borderStyle: 'solid',
52
+ borderColor: 'var(--color-text-green)',
53
+ color: 'var(--color-text-green)',
54
+ ':hover': {
55
+ backgroundColor: 'var(--color-border-green)',
56
+ },
57
+ } as const;
58
+
59
+ /**
60
+ * The secondary Button treatment on Selector and MultiSelector triggers
61
+ * (AST-079 FR2). Inside an InputGroup a trigger keeps the neutral fill and the
62
+ * group's edges instead (FR6). The hover stays off disabled and read-only
63
+ * triggers, which carry `data-disabled` and `data-readonly`.
64
+ */
65
+ const SECONDARY_SELECTOR = {
66
+ ':not(.astryx-input-group *)': {
67
+ backgroundColor: SECONDARY_BUTTON.backgroundColor,
68
+ borderWidth: SECONDARY_BUTTON.borderWidth,
69
+ borderStyle: SECONDARY_BUTTON.borderStyle,
70
+ borderColor: SECONDARY_BUTTON.borderColor,
71
+ color: SECONDARY_BUTTON.color,
72
+ },
73
+ ':hover:not([data-disabled], [data-readonly], .astryx-input-group *)':
74
+ SECONDARY_BUTTON[':hover'],
75
+ } as const;
76
+
77
+ /**
78
+ * The secondary Button treatment on ComplexSelector triggers (AST-079 FR2), with
79
+ * the hover kept off a disabled trigger, whose inner button is disabled.
80
+ */
81
+ const SECONDARY_COMPLEX_SELECTOR = {
82
+ backgroundColor: SECONDARY_BUTTON.backgroundColor,
83
+ borderWidth: SECONDARY_BUTTON.borderWidth,
84
+ borderStyle: SECONDARY_BUTTON.borderStyle,
85
+ borderColor: SECONDARY_BUTTON.borderColor,
86
+ color: SECONDARY_BUTTON.color,
87
+ ':hover:not(:has(> :disabled))': SECONDARY_BUTTON[':hover'],
88
+ } as const;
89
+
35
90
  export const y2kTheme = defineTheme({
36
91
  name: 'y2k',
37
92
 
@@ -256,16 +311,7 @@ export const y2kTheme = defineTheme({
256
311
  color: 'var(--color-background-body)',
257
312
  borderColor: 'transparent',
258
313
  },
259
- 'variant:secondary': {
260
- backgroundColor: 'var(--color-background-green)',
261
- borderWidth: '1px',
262
- borderStyle: 'solid',
263
- borderColor: 'var(--color-text-green)',
264
- color: 'var(--color-text-green)',
265
- ':hover': {
266
- backgroundColor: 'var(--color-border-green)',
267
- },
268
- },
314
+ 'variant:secondary': SECONDARY_BUTTON,
269
315
  'variant:ghost': {
270
316
  borderColor: 'transparent',
271
317
  },
@@ -277,6 +323,10 @@ export const y2kTheme = defineTheme({
277
323
  borderColor: 'var(--color-text-red)',
278
324
  },
279
325
  },
326
+ // Secondary selector triggers match the secondary Button (AST-079 FR2).
327
+ selector: {'variant:secondary': SECONDARY_SELECTOR},
328
+ 'multi-selector': {'variant:secondary': SECONDARY_SELECTOR},
329
+ 'complex-selector': {'variant:secondary': SECONDARY_COMPLEX_SELECTOR},
280
330
 
281
331
  badge: {
282
332
  base: {
@@ -383,6 +383,12 @@ export interface ComponentPropDoc {
383
383
  * ```
384
384
  */
385
385
  slotElements?: ComponentSlotElement[];
386
+ /** Lifecycle marker for a prop outside the stable compatibility promise
387
+ * (spec:AST-017 FR21). Set `'experimental'` on a stable component's
388
+ * optional `experimental` prop object, and say in `description` that its
389
+ * contents may change or be removed in a patch release. Omit for stable
390
+ * props. */
391
+ stability?: 'experimental';
386
392
  }
387
393
 
388
394
  /**
@@ -56,7 +56,7 @@ export const doc = {
56
56
  name: 'replaces',
57
57
  type: 'string',
58
58
  description:
59
- "Integration components only: the exact `name` of the Core ComponentDoc this component takes over for unqualified lookup, so every app that loads the integration gets it from component detail, component lists, search, `swizzle <Name>`, and issue routing; `swizzle --list` keeps listing Core names. The Core original stays reachable with `--package @astryxdesign/core`. It takes effect only when the package's peer range starts at the release that applies it, `\"@astryxdesign/cli\": \">=0.6.7\"` or later; without such a range the component keeps its own name and `doctor integration components` warns. Set it only to intentionally own a Core identity; give an alternative or variant its own name instead.",
59
+ 'Integration components only: the exact `name` of the Core ComponentDoc this component takes over for unqualified lookup, so every app that loads the integration gets it from component detail, component lists, search, `swizzle <Name>`, and issue routing; `swizzle --list` keeps listing Core names. The Core original stays reachable with `--package @astryxdesign/core`. It takes effect only when the package\'s peer range starts at the release that applies it, `"@astryxdesign/cli": ">=0.6.7"` or later; without such a range the component keeps its own name and `doctor integration components` warns. Set it only to intentionally own a Core identity; give an alternative or variant its own name instead.',
60
60
  },
61
61
  {
62
62
  name: 'keywords',
@@ -181,7 +181,7 @@ export const doc = {
181
181
  name: 'props',
182
182
  type: 'ComponentPropDoc[]',
183
183
  description:
184
- 'SingleComponentDoc variant (required there): all public props for the one primary component. Each prop is {name, type, description, default?, required?, slotElements?}. Skip styling props like xstyle/className/style. Also present on SubComponentDoc.',
184
+ 'SingleComponentDoc variant (required there): all public props for the one primary component. Each prop is {name, type, description, default?, required?, slotElements?, stability?}. Skip styling props like xstyle/className/style. Also present on SubComponentDoc.',
185
185
  },
186
186
  {
187
187
  name: 'components',
@@ -112,9 +112,11 @@ function resolveCliBin() {
112
112
  * @param {{out?: string, iconsSpecifier?: string, detail?: string}} options -
113
113
  * Parsed command options that affect generated output, plus the detail
114
114
  * level the user chose.
115
+ * @param {(child: import('node:child_process').ChildProcess) => void} [onSpawn] -
116
+ * Receives the child, so a watcher that stops can stop it too.
115
117
  * @returns {Promise<number>}
116
118
  */
117
- function runThemeBuildOnceChild(file, options) {
119
+ function runThemeBuildOnceChild(file, options, onSpawn) {
118
120
  const cliBin = resolveCliBin();
119
121
  // A detail level the user chose applies to every rebuild.
120
122
  const args = options.detail
@@ -128,6 +130,7 @@ function runThemeBuildOnceChild(file, options) {
128
130
  stdio: 'inherit',
129
131
  env: process.env,
130
132
  });
133
+ onSpawn?.(child);
131
134
  child.on('close', code => resolve(code ?? 0));
132
135
  child.on('error', () => resolve(1));
133
136
  });
@@ -139,7 +142,9 @@ function runThemeBuildOnceChild(file, options) {
139
142
  * Rebuilds are serialized: one at a time, in the order the changes arrived, so
140
143
  * the log stays readable. Each rebuild runs in a child process so a build error
141
144
  * (which the single-build path reports via a hard exit) is contained and the
142
- * watcher keeps running.
145
+ * watcher keeps running. Stopping ends the watch at once: queued changes are
146
+ * dropped, the signal reaches a rebuild in progress, as Ctrl-C in a terminal
147
+ * reaches the whole process group, and "Stopped watching." is the last line.
143
148
  *
144
149
  * @param {Array<{file: string, filePath: string}>} entries - The theme file
145
150
  * arguments as the user passed them, with their resolved absolute paths.
@@ -159,6 +164,11 @@ async function runThemeBuildWatch(entries, options) {
159
164
  }
160
165
 
161
166
  let building = false;
167
+ let stopped = false;
168
+ /** @type {import('node:child_process').ChildProcess | null} */
169
+ let rebuildChild = null;
170
+ /** @type {Promise<void> | null} */
171
+ let rebuildDone = null;
162
172
  /** @type {Set<{file: string, filePath: string}>} */
163
173
  const queued = new Set();
164
174
  /** @type {Map<string, ReturnType<typeof setTimeout>>} */
@@ -166,6 +176,7 @@ async function runThemeBuildWatch(entries, options) {
166
176
 
167
177
  /** @param {{file: string, filePath: string}} entry */
168
178
  const rebuild = async entry => {
179
+ if (stopped) return;
169
180
  if (building) {
170
181
  // Coalesce changes that land mid-build into a single follow-up run.
171
182
  queued.add(entry);
@@ -173,8 +184,16 @@ async function runThemeBuildWatch(entries, options) {
173
184
  }
174
185
  building = true;
175
186
  emit(text(`\nChange detected — rebuilding ${rel(entry.filePath)}...`));
176
- await runThemeBuildOnceChild(entry.file, options);
187
+ const done = runThemeBuildOnceChild(entry.file, options, child => {
188
+ rebuildChild = child;
189
+ });
190
+ rebuildDone = done.then(() => {});
191
+ await done;
192
+ rebuildChild = null;
193
+ rebuildDone = null;
177
194
  building = false;
195
+ // A stop during this build has already ended the watch.
196
+ if (stopped) return;
178
197
  emit(text(watchingLine));
179
198
  const next = queued.values().next();
180
199
  if (!next.done) {
@@ -205,9 +224,18 @@ async function runThemeBuildWatch(entries, options) {
205
224
  emit(text(watchingLine));
206
225
 
207
226
  await new Promise((/** @type {(value?: void) => void} */ resolve) => {
208
- const stop = () => {
227
+ /** @param {NodeJS.Signals} signal */
228
+ const stop = async signal => {
229
+ process.removeListener('SIGINT', stop);
230
+ process.removeListener('SIGTERM', stop);
231
+ stopped = true;
232
+ queued.clear();
209
233
  for (const d of debounces.values()) clearTimeout(d);
210
234
  for (const w of watchers) w.close();
235
+ // A rebuild in progress would otherwise keep the process alive after
236
+ // "Stopped watching.". In a terminal, Ctrl-C already reached it.
237
+ rebuildChild?.kill(signal);
238
+ await rebuildDone;
211
239
  emit(text('\nStopped watching.'));
212
240
  resolve();
213
241
  };
@@ -124,7 +124,8 @@ describe('theme build --watch', () => {
124
124
  const rebuilt = await waitFor(
125
125
  () => {
126
126
  try {
127
- if (fs.readFileSync(cssFile, 'utf-8').includes('#010203')) return true;
127
+ if (fs.readFileSync(cssFile, 'utf-8').includes('#010203'))
128
+ return true;
128
129
  } catch {
129
130
  // CSS mid-write; fall through to re-touch.
130
131
  }
@@ -157,6 +158,63 @@ describe('theme build --watch', () => {
157
158
  expect(stdout).toMatch(/Stopped watching/);
158
159
  }, 30_000);
159
160
 
161
+ it('stops at once when interrupted mid-rebuild, and drops a queued change', async () => {
162
+ const themeFile = path.join(tmpDir, 'ws.mjs');
163
+ fs.writeFileSync(
164
+ themeFile,
165
+ `export default { name: 'ws', tokens: { '--color-bg': '#ffffff' } };\n`,
166
+ );
167
+ // Top-level await holds every rebuild of this version in progress for 20 s,
168
+ // far longer than a stop may take.
169
+ const slow =
170
+ `await new Promise(resolve => setTimeout(resolve, 20000));\n` +
171
+ `export default { name: 'ws', tokens: { '--color-bg': '#010203' } };\n`;
172
+
173
+ const child = spawn(
174
+ process.execPath,
175
+ [CLI_BIN, 'theme', 'build', 'ws.mjs', '--watch'],
176
+ {cwd: tmpDir, env: {...process.env, FORCE_COLOR: '0'}},
177
+ );
178
+ let stdout = '';
179
+ child.stdout.on('data', d => (stdout += d.toString()));
180
+ child.stderr.on('data', d => (stdout += d.toString()));
181
+ const exited = new Promise(resolve =>
182
+ child.once('exit', () => resolve(Date.now())),
183
+ );
184
+
185
+ let stoppedAt;
186
+ try {
187
+ expect(await waitFor(() => /Watching/i.test(stdout))).toBe(true);
188
+ // Start the slow rebuild, re-touching in case a watch event is dropped.
189
+ const started = await waitFor(
190
+ () => {
191
+ if (/rebuilding ws\.mjs/.test(stdout)) return true;
192
+ fs.writeFileSync(themeFile, slow);
193
+ return false;
194
+ },
195
+ {timeout: 20000, interval: 200},
196
+ );
197
+ expect(started).toBe(true);
198
+ // Queue a change behind the rebuild in progress (debounce is 100 ms).
199
+ fs.writeFileSync(themeFile, `${slow}// queued\n`);
200
+ await new Promise(resolve => setTimeout(resolve, 500));
201
+ } finally {
202
+ stoppedAt = Date.now();
203
+ child.kill('SIGINT');
204
+ }
205
+
206
+ const exitedAt = await Promise.race([
207
+ exited,
208
+ new Promise(resolve => setTimeout(() => resolve(null), 15000)),
209
+ ]);
210
+ if (exitedAt === null) child.kill('SIGKILL');
211
+ // Finishing the interrupted rebuild, or starting the queued one, takes 20 s.
212
+ expect(exitedAt).not.toBeNull();
213
+ expect(exitedAt - stoppedAt).toBeLessThan(10000);
214
+ expect(stdout.match(/rebuilding/g)).toHaveLength(1);
215
+ expect(stdout.trimEnd().endsWith('Stopped watching.')).toBe(true);
216
+ }, 60_000);
217
+
160
218
  it.each([
161
219
  [[], false],
162
220
  [['--detail', 'full'], true],
@@ -219,7 +277,10 @@ describe('theme build --watch', () => {
219
277
  );
220
278
  expect(built).toBe(true);
221
279
  await waitFor(() => /Watching w1\.mjs, w2\.mjs/.test(stdout));
222
- const firstCssBefore = fs.readFileSync(path.join(tmpDir, 'w1.css'), 'utf-8');
280
+ const firstCssBefore = fs.readFileSync(
281
+ path.join(tmpDir, 'w1.css'),
282
+ 'utf-8',
283
+ );
223
284
 
224
285
  const changed = `export default { name: 'w2', tokens: { '--color-bg': '#010203' } };\n`;
225
286
  fs.writeFileSync(second, changed);
@@ -68,8 +68,12 @@ function formatPropsTable(props) {
68
68
  for (const p of props) {
69
69
  const def = p.default ? `\`${mdCell(p.default)}\`` : '-';
70
70
  const req = p.required ? ' **(required)**' : '';
71
+ // The text projection of the prop doc's `stability` field: an
72
+ // experimental prop is outside the stable compatibility promise.
73
+ const stability =
74
+ p.stability === 'experimental' ? ' **(experimental)**' : '';
71
75
  lines.push(
72
- `| \`${mdCell(p.name)}\` | \`${mdCell(p.type)}\` | ${def} | ${mdCell(p.description)}${req} |`,
76
+ `| \`${mdCell(p.name)}\` | \`${mdCell(p.type)}\` | ${def} | ${mdCell(p.description)}${req}${stability} |`,
73
77
  );
74
78
  }
75
79
  return lines.join('\n');