@astryxdesign/cli 0.7.5-canary.04434e7 → 0.7.5-canary.07030cb

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 (71) hide show
  1. package/README.md +1 -1
  2. package/api/template/tokenizer-showcase.test.mjs +47 -0
  3. package/api/theme/build/build.adaptation-enrollment.test.mjs +4 -0
  4. package/api/theme/build/build.icon-variants.test.mjs +105 -0
  5. package/api/theme/build/build.mjs +36 -7
  6. package/api/theme/build/build.test.mjs +27 -0
  7. package/api/upgrade/_adapter.d.mts +47 -2
  8. package/api/upgrade/_adapter.mjs +58 -2
  9. package/api/upgrade/run/failure-receipt.test.mjs +57 -0
  10. package/api/upgrade/run/outcomes.test.mjs +646 -0
  11. package/api/upgrade/run/run.d.mts +36 -0
  12. package/api/upgrade/run/run.mjs +509 -45
  13. package/api/upgrade/upgrade.doc.mjs +2 -2
  14. package/api/upgrade/upgrade.type.d.mts +24 -0
  15. package/api/upgrade/upgrade.type.mjs +15 -3
  16. package/assets/codemods/__tests__/runner.unparseable.test.mjs +457 -0
  17. package/assets/codemods/integration-runner.mjs +7 -1
  18. package/assets/codemods/integration-runner.protection.test.mjs +53 -0
  19. package/assets/codemods/outcome.mjs +79 -0
  20. package/assets/codemods/outcome.test.mjs +40 -0
  21. package/assets/codemods/parse.mjs +94 -0
  22. package/assets/codemods/run-codemod.mjs +92 -2
  23. package/assets/codemods/runner.mjs +38 -5
  24. package/assets/codemods/transforms/next/__tests__/migrate-codeblock-tokenizer-to-language.test.mjs +130 -0
  25. package/assets/codemods/transforms/next/index.mjs +11 -1
  26. package/assets/codemods/transforms/next/migrate-codeblock-tokenizer-to-language.mjs +315 -0
  27. package/assets/codemods/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +216 -2
  28. package/assets/codemods/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +88 -6
  29. package/assets/codemods/transforms/v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs +4 -3
  30. package/assets/codemods/transforms/v0.7.0/__tests__/validate-data-token-ownership.test.mjs +24 -4
  31. package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +44 -10
  32. package/assets/codemods/transforms/v0.7.0/validate-data-token-ownership.mjs +6 -3
  33. package/assets/docs/author-a-theme.doc.mjs +3 -1
  34. package/assets/docs/icons.doc.mjs +71 -1
  35. package/assets/docs/theme.doc.dense.mjs +8 -0
  36. package/assets/docs/theme.doc.mjs +16 -0
  37. package/assets/docs/theme.doc.zh.mjs +11 -0
  38. package/assets/docs/tree/template-styles.doc.mjs +1 -1
  39. package/assets/docs/tree/tokens-color.doc.mjs +145 -1
  40. package/assets/docs/tree/tokens.doc.mjs +1 -1
  41. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +6 -4
  42. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.tsx +61 -55
  43. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +6 -4
  44. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx +68 -37
  45. package/assets/templates/blocks/components/CodeBlock/CodeBlockBashCommand.doc.mjs +1 -1
  46. package/assets/templates/blocks/components/CodeBlock/CodeBlockBashCommand.tsx +10 -2
  47. package/assets/templates/blocks/components/Thumbnail/ThumbnailDisabled.doc.mjs +1 -1
  48. package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +13 -6
  49. package/assets/templates/pages/dashboard-alert-rail/page.tsx +3 -3
  50. package/assets/templates/pages/library/page.tsx +1 -2
  51. package/assets/templates/pages/table-comparison/page.tsx +12 -3
  52. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +3 -2
  53. package/assets/templates/themes/butter/butterTheme.ts +47 -44
  54. package/assets/templates/themes/chocolate/chocolateTheme.ts +15 -2
  55. package/assets/templates/themes/gothic/gothicTheme.ts +21 -16
  56. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +1 -1
  57. package/assets/templates/themes/matcha/matchaTheme.ts +15 -2
  58. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +4 -4
  59. package/assets/templates/themes/neutral/neutralTheme.ts +24 -119
  60. package/assets/templates/themes/stone/stoneTheme.ts +46 -21
  61. package/assets/templates/themes/y2k/y2kTheme.ts +20 -16
  62. package/assets/theme.template.ts +18 -5
  63. package/authoring/codemod/type.ts +10 -0
  64. package/clients/cli/commands/build-theme.adaptations.test.mjs +110 -0
  65. package/clients/cli/commands/upgrade.doc.mjs +30 -2
  66. package/clients/cli/commands/upgrade.file-protection.test.mjs +146 -0
  67. package/clients/cli/commands/upgrade.outcomes.test.mjs +350 -0
  68. package/foundation/agent-docs/agent-docs.mjs +1 -0
  69. package/foundation/agent-docs/agent-docs.test.mjs +5 -0
  70. package/foundation/response/response-types.doc.mjs +1 -1
  71. package/package.json +10 -9
@@ -15,6 +15,7 @@
15
15
  import path from 'node:path';
16
16
  import postcss from 'postcss';
17
17
  import selectorParser from 'postcss-selector-parser';
18
+ import {parseCss, processSelector} from '../../parse.mjs';
18
19
  import {
19
20
  V054_THEME_SELECTOR_DYNAMIC_AXES,
20
21
  V054_THEME_SELECTOR_TARGETS,
@@ -555,7 +556,7 @@ function migrateSelectorTextWithContext(
555
556
  ) {
556
557
  /** @type {TargetContext} */
557
558
  let context = {guaranteed: [], possible: []};
558
- const text = selectorParser(selectors => {
559
+ const text = processSelector(selector, selectors => {
559
560
  /** @type {TargetContext[]} */
560
561
  const branchContexts = [];
561
562
  selectors.each(selectorNode => {
@@ -593,7 +594,7 @@ function migrateSelectorTextWithContext(
593
594
  });
594
595
  });
595
596
  context = combineSelectorListContexts(branchContexts);
596
- }).processSync(selector, {lossless: true});
597
+ });
597
598
  return {text, context};
598
599
  }
599
600
 
@@ -677,7 +678,7 @@ export function migrateAstryxThemeSelectors(source, from = 'styles.css', data) {
677
678
 
678
679
  /** @param {string} source @param {string} from @returns {string} */
679
680
  function migrateWithActiveTables(source, from) {
680
- const root = postcss.parse(source, {from});
681
+ const root = parseCss(source, {from});
681
682
  const existingComments = new Set();
682
683
  root.walkComments(comment => {
683
684
  existingComments.add(comment.text.trim());
@@ -5,6 +5,7 @@ import * as os from 'node:os';
5
5
  import * as path from 'node:path';
6
6
  import {afterAll, describe, expect, it} from 'vitest';
7
7
  import transform, {meta} from '../validate-data-token-ownership.mjs';
8
+ import {codemodOutcome} from '../../../outcome.mjs';
8
9
  import {upgrade} from '../../../../../api/upgrade/upgrade.mjs';
9
10
 
10
11
  const SLOW = 30_000;
@@ -76,10 +77,20 @@ describe('validate-data-token-ownership', () => {
76
77
  expect(meta.fileExtensions).toEqual(['.css']);
77
78
  });
78
79
 
79
- it('fails on stale generated theme CSS with root data defaults', () => {
80
+ it('reports stale generated theme CSS with root data defaults as a regeneration', () => {
80
81
  expect(() => transform({source: STALE_THEME, path: 'theme.css'})).toThrow(
81
82
  /Rebuild it with `astryx theme build`/,
82
83
  );
84
+ let thrown;
85
+ try {
86
+ transform({source: STALE_THEME, path: 'theme.css'});
87
+ } catch (err) {
88
+ thrown = err;
89
+ }
90
+ expect(codemodOutcome(thrown)).toMatchObject({
91
+ kind: 'regenerate',
92
+ commands: ['astryx theme build'],
93
+ });
83
94
  });
84
95
 
85
96
  it('passes raw data-token uses with or without a fallback', () => {
@@ -136,11 +147,20 @@ describe('validate-data-token-ownership', () => {
136
147
  );
137
148
 
138
149
  it(
139
- 'fails `astryx upgrade --apply` on stale generated theme CSS',
150
+ 'leaves `astryx upgrade --apply` incomplete on stale generated theme CSS, naming the rebuild',
140
151
  async () => {
141
152
  const root = project({...PREBUILT, 'src/theme.css': STALE_THEME});
142
- await expect(runUpgrade(root)).rejects.toMatchObject({
143
- code: 'ERR_CODEMOD_FAILED',
153
+ const res = await runUpgrade(root);
154
+ expect(res.data).toMatchObject({
155
+ complete: false,
156
+ errorCode: 'ERR_CODEMOD_PROTECTED',
157
+ errors: [],
158
+ regenerate: [
159
+ expect.objectContaining({
160
+ file: 'src/theme.css',
161
+ commands: ['astryx theme build'],
162
+ }),
163
+ ],
144
164
  });
145
165
  },
146
166
  SLOW,
@@ -27,6 +27,12 @@ import {
27
27
  importedComponents,
28
28
  resolveImportedComponent,
29
29
  } from '../../transform-prop.mjs';
30
+ import {
31
+ isCodemodParseError,
32
+ markParseError,
33
+ parseCss,
34
+ processSelector,
35
+ } from '../../parse.mjs';
30
36
  import {migrateAstryxThemeSelectors} from '../v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs';
31
37
  import {
32
38
  V06_THEME_SELECTOR_DYNAMIC_AXES,
@@ -204,7 +210,7 @@ function ownerScope(owner) {
204
210
  function unclassifiedBareClasses(selectorText) {
205
211
  /** @type {Set<string>} */
206
212
  const found = new Set();
207
- selectorParser(selectors => {
213
+ processSelector(selectorText, selectors => {
208
214
  selectors.walk((/** @type {any} */ node) => {
209
215
  if (node.type !== 'selector') return;
210
216
  /** @type {any[][]} */
@@ -232,19 +238,23 @@ function unclassifiedBareClasses(selectorText) {
232
238
  }
233
239
  }
234
240
  });
235
- }).processSync(selectorText, {lossless: true});
241
+ });
236
242
  return [...found].sort();
237
243
  }
238
244
 
239
- /** @param {string} selector */
245
+ /** @param {string | import('postcss').Rule} selector selector text, or the rule that holds it */
240
246
  function finishSelectorText(selector) {
241
- return selectorParser(selectors => {
247
+ return processSelector(selector, selectors => {
242
248
  selectors.each(finishSelectorMigration);
243
- }).processSync(selector, {lossless: true});
249
+ });
244
250
  }
245
251
 
246
- /** @param {string} params */
247
- function finishScopeParams(params) {
252
+ /**
253
+ * Migrate each parenthesized selector group of an `@scope` prelude.
254
+ * @param {string} params
255
+ * @param {(selector: string, start: number) => string} [finish] migrates one group; `start` is its offset in `params`
256
+ */
257
+ function finishScopeParams(params, finish = finishSelectorText) {
248
258
  let result = '';
249
259
  let last = 0;
250
260
  let depth = 0;
@@ -281,7 +291,7 @@ function finishScopeParams(params) {
281
291
  if (char === ')' && depth > 0) {
282
292
  depth--;
283
293
  if (depth === 0 && groupStart >= 0) {
284
- result += finishSelectorText(params.slice(groupStart, index));
294
+ result += finish(params.slice(groupStart, index), groupStart);
285
295
  result += ')';
286
296
  last = index + 1;
287
297
  groupStart = -1;
@@ -293,15 +303,39 @@ function finishScopeParams(params) {
293
303
 
294
304
  /** @param {string} source @param {string} from */
295
305
  function migrateCss(source, from) {
306
+ // Parse every selector of the stylesheet as written first, so one the
307
+ // selector parser rejects is reported at its line and column in the file,
308
+ // not in the migrated text below.
309
+ const original = parseCss(source, {from});
310
+ original.walkRules(rule => {
311
+ processSelector(rule, () => {});
312
+ });
313
+ original.walkAtRules('scope', atRule => {
314
+ const offset =
315
+ `@${atRule.name}`.length + (atRule.raws.afterName ?? '').length;
316
+ finishScopeParams(atRule.params, (selector, start) => {
317
+ try {
318
+ processSelector(selector, () => {});
319
+ } catch (err) {
320
+ if (!isCodemodParseError(err)) throw err;
321
+ throw markParseError(
322
+ atRule.error(/** @type {Error} */ (err).message, {
323
+ index: offset + start,
324
+ }),
325
+ );
326
+ }
327
+ return selector;
328
+ });
329
+ });
296
330
  const migrated = migrateAstryxThemeSelectors(source, from, SELECTOR_DATA);
297
- const root = postcss.parse(migrated, {from});
331
+ const root = parseCss(migrated, {from});
298
332
  /** @type {Set<string>} */
299
333
  const existingComments = new Set();
300
334
  root.walkComments(comment => {
301
335
  existingComments.add(comment.text.trim());
302
336
  });
303
337
  root.walkRules(rule => {
304
- rule.selector = finishSelectorText(rule.selector);
338
+ rule.selector = finishSelectorText(rule);
305
339
  const tokens = unclassifiedBareClasses(rule.selector);
306
340
  if (tokens.length === 0) return;
307
341
  const list = tokens.map(token => `.${token}`).join(', ');
@@ -4,8 +4,9 @@
4
4
  * @file Reject stale generated theme CSS that still owns data-token defaults.
5
5
  *
6
6
  * @input Generated theme CSS
7
- * @output No rewritten source; an upgrade error for a generated theme
8
- * stylesheet that still declares data-color defaults at `:root`
7
+ * @output No rewritten source; a regeneration report (`RegenerationRequired`,
8
+ * with `astryx theme build`) for a generated theme stylesheet that still
9
+ * declares data-color defaults at `:root`
9
10
  * @position Next-release upgrade validation for spec:AST-066 FR19
10
11
  *
11
12
  * Raw `var(--color-data-*)` uses are not checked: prebuilt
@@ -15,6 +16,7 @@
15
16
  */
16
17
 
17
18
  import * as path from 'node:path';
19
+ import {RegenerationRequired} from '../../outcome.mjs';
18
20
 
19
21
  export const meta = {
20
22
  title: 'Validate data-token ownership',
@@ -36,8 +38,9 @@ export default function validateDataTokenOwnership(file) {
36
38
  file.source.includes(GENERATED_THEME_HEADER) &&
37
39
  ROOT_DATA_DECLARATION.test(file.source)
38
40
  ) {
39
- throw new Error(
41
+ throw new RegenerationRequired(
40
42
  'This generated theme CSS still emits canonical data defaults at :root. Rebuild it with `astryx theme build`; defaults come from @astryxdesign/core/astryx.css in prebuilt mode, and in a source build from the @astryxdesign/build PostCSS integration or dataVars imports.',
43
+ {commands: ['astryx theme build']},
41
44
  );
42
45
  }
43
46
  return undefined;
@@ -55,9 +55,11 @@ export const docs = {
55
55
  ['tokens', 'Base tokens are copied first, then child tokens override on top.'],
56
56
  ['components', 'Deep-merged: child component rules override matching keys from the base.'],
57
57
  ['icons', 'Shallow-merged: child icons override matching names from the base.'],
58
+ ['iconVariants', 'Replaced, never merged: a child that sets iconVariants replaces the base list; a child that omits it inherits the list.'],
58
59
  ['indicators', 'Shallow-merged: child indicators override matching names from the base.'],
59
60
  ['onDark, onLight', "Deep-merged per surface: the base's resolved surface first, then the child's overrides."],
60
- ['typography, motion, radius, color', 'Child config replaces base entirely (these are scale inputs, not additive).'],
61
+ ['motion', "Field by field: the child's `fast`, `medium` and `ratio` regenerate the fast and medium duration tokens; `slow` and `easing` left unset keep the base theme's tokens, so an inherited slow band stays at the base's ratio."],
62
+ ['typography, radius, color', 'Child config replaces base entirely (these are scale inputs, not additive).'],
61
63
  ['adaptations', 'Width-breakpoint overrides merge by fixed name. Inherited ordered rules keep their relative order; child rules append and re-resolve against the child root axes.'],
62
64
  ]},
63
65
  {type: 'prose', text: "Inheritance is resolved when the theme is defined, so an extended theme is flat: `{@command theme build}` emits one self-contained stylesheet holding everything the child inherited, and the base theme's CSS does not need to be loaded next to it. A base that is not a theme (most often an import that missed) throws when `defineTheme` runs, rather than producing a theme that silently inherits nothing."},
@@ -101,11 +101,81 @@ export const brandTheme = defineTheme({
101
101
  },
102
102
  });`,
103
103
  },
104
+ {
105
+ type: 'prose',
106
+ text: "An entry can also be a function of the request, so the theme maps Icon's size to its icon library's own props or artwork. `Icon` calls it with `{size, variant}`, where `size` is the size it renders at (`xsm`, `sm`, `md`, or `lg`: an explicit `size`, else the owning component's default, else `md`). Reads that return one node — `getIcon()`, `useIcon()`, `getIconRegistry()`, and the theme's `icons` field — call it with `{size: 'md'}`. The same entry shape works in `registerIcons()`.",
107
+ },
108
+ {
109
+ type: 'code',
110
+ lang: 'tsx',
111
+ label: 'A size-aware icon entry',
112
+ code: `import {defineTheme} from '@astryxdesign/core/theme';
113
+ import {Info} from 'lucide-react';
114
+
115
+ export const brandTheme = defineTheme({
116
+ name: 'brand',
117
+ icons: {
118
+ // A heavier stroke keeps the small size legible.
119
+ info: ({size}) => <Info strokeWidth={size === 'sm' || size === 'xsm' ? 2.5 : 2} />,
120
+ },
121
+ });`,
122
+ },
123
+ {
124
+ type: 'prose',
125
+ text: 'Keep the function pure and synchronous: it computes its result from the request only, with no hooks, DOM or SVG measurement, browser globals, network access, mutable module state, or side effects. Its result is final. Returning `null` draws no glyph instead of falling back to a registered or built-in icon, while a `null` or `undefined` node entry still falls back. A child theme that sets an entry for a key replaces the inherited entry for that key.',
126
+ },
104
127
  ],
105
128
  },
106
129
  {
107
- title: 'Component and Library Icons',
130
+ title: 'Icon Variants',
108
131
  category: 'foundations',
132
+ content: [
133
+ {
134
+ type: 'prose',
135
+ text: "A theme lists the icon variant names it supports once, with `iconVariants` in `defineTheme()`. The list belongs to the whole theme, never to one icon, and Astryx defines no names of its own. Inside `defineTheme`, an entry function receives `variant` typed as the listed names, or `undefined`, so a misspelled name is a type error. An entry that receives `undefined` draws its normal artwork.",
136
+ },
137
+ {
138
+ type: 'code',
139
+ lang: 'tsx',
140
+ label: 'Listing variants and mapping them to artwork',
141
+ code: `import {defineTheme} from '@astryxdesign/core/theme';
142
+ import {InfoFilledIcon, InfoIcon} from './brand-icons';
143
+
144
+ export const brandTheme = defineTheme({
145
+ name: 'brand',
146
+ iconVariants: ['outline', 'filled'],
147
+ icons: {
148
+ info: ({size, variant}) =>
149
+ variant === 'filled' ? <InfoFilledIcon /> : <InfoIcon bold={size === 'sm'} />,
150
+ },
151
+ });
152
+
153
+ brandTheme.iconVariants; // ['outline', 'filled']`,
154
+ },
155
+ {
156
+ type: 'prose',
157
+ text: 'A theme that `extends` another inherits its list unless it sets its own; a list it sets replaces the inherited one instead of merging with it.',
158
+ },
159
+ {
160
+ type: 'prose',
161
+ text: 'An application declares the variant names it uses by augmenting `IconVariantMap` from `@astryxdesign/core/Icon`. `IconVariant` is those names, and an entry passed to `registerIcons()` receives `variant` typed as `IconVariant`.',
162
+ },
163
+ {
164
+ type: 'code',
165
+ lang: 'ts',
166
+ label: 'Declaring the variant names an application uses',
167
+ code: `declare module '@astryxdesign/core/Icon' {
168
+ interface IconVariantMap {
169
+ outline: true;
170
+ filled: true;
171
+ }
172
+ }`,
173
+ },
174
+ ],
175
+ },
176
+ {
177
+ title: 'Component and Library Icons',
178
+ category: 'foundations',
109
179
  content: [
110
180
  {
111
181
  type: 'prose',
@@ -21,6 +21,14 @@ export const docsDense = {
21
21
  {type: 'prose', text: "new palette: `astryx theme palette generate palette.config.json --out palette.generated.ts` → review + commit module and receipt → `import {palette} from './palette.generated';` → map semantic tokens to stable stops such as `palette.neutral.light[100]` / `palette.neutral.dark[15]`. regeneration updates mapped roles; generation does not rewrite the theme."},
22
22
  ],
23
23
  },
24
+ {
25
+ section: 'Icon sizes',
26
+ title: 'Icon sizes',
27
+ content: [
28
+ {type: 'prose', text: "theme sets each Icon size's glyph dimension: `width` + `height` on `components.icon['size:sm']` (or xsm/md/lg); semantic names + SVG components alike. px or rem only: a semantic icon takes its font size from the dimension, so em also grows its box. unstyled: xsm/sm/md/lg = 12/16/20/24px at 16px root, scale w/ root font size (rem keeps it). size names are fixed."},
29
+ null,
30
+ ],
31
+ },
24
32
  {
25
33
  section: 'Dark mode',
26
34
  title: 'Dark mode',
@@ -53,6 +53,22 @@ export const docs = {
53
53
  },
54
54
  ],
55
55
  },
56
+ {
57
+ id: 'icon-sizes',
58
+ title: 'Icon sizes',
59
+ content: [
60
+ {
61
+ type: 'prose',
62
+ text: "A theme sets the dimension of each Icon size in its stylesheet: `width` and `height` on `components.icon['size:sm']` (or `xsm`, `md`, `lg`) resize that size's glyph, for semantic icon names and SVG components passed to `Icon` alike. Give the dimension in `px` or `rem`: a semantic icon takes its font size from it, so an `em` value would also grow its box. A size the theme leaves alone stays 12, 16, 20, or 24px at a 16px root (`xsm`, `sm`, `md`, `lg`) and scales with the root font size; `rem` keeps that scaling. The four size names are fixed.",
63
+ },
64
+ {
65
+ type: 'code',
66
+ lang: 'tsx',
67
+ label: 'Set Icon size dimensions',
68
+ code: "const brandTheme = defineTheme({\n name: 'brand',\n components: {\n icon: {\n 'size:sm': {width: '1.125rem', height: '1.125rem'},\n 'size:lg': {width: '1.75rem', height: '1.75rem'},\n },\n },\n});",
69
+ },
70
+ ],
71
+ },
56
72
  {
57
73
  id: 'light-dark-mode',
58
74
  title: 'Dark mode',
@@ -25,6 +25,17 @@ export const docsZh = {
25
25
  },
26
26
  ],
27
27
  },
28
+ {
29
+ section: 'Icon sizes',
30
+ title: '图标尺寸',
31
+ content: [
32
+ {
33
+ type: 'prose',
34
+ text: "主题在样式表中设置每个 Icon 尺寸的大小:在 `components.icon['size:sm']`(或 `xsm`、`md`、`lg`)上设置 `width` 和 `height`,即可调整该尺寸的图标,语义图标名称和直接传给 `Icon` 的 SVG 组件都适用。请使用 `px` 或 `rem` 设置尺寸:语义图标会据此设置自身的字号,因此 `em` 值也会放大它的外框。主题未设置的尺寸在 16px 根字号下保持 12、16、20 或 24px(`xsm`、`sm`、`md`、`lg`),并随根字号缩放;`rem` 可保留这种缩放。四个尺寸名称是固定的。",
35
+ },
36
+ null,
37
+ ],
38
+ },
28
39
  {
29
40
  section: 'Dark mode',
30
41
  title: '深色模式',
@@ -56,7 +56,7 @@ import {colorVars} from '@astryxdesign/core/theme/tokens.stylex';
56
56
 
57
57
  const styles = stylex.create({
58
58
  trend: {
59
- color: colorVars['--color-success'],
59
+ color: colorVars['--color-text-success'],
60
60
  minWidth: 0,
61
61
  },
62
62
  });
@@ -26,6 +26,55 @@ export const docs = {
26
26
  "type": "prose",
27
27
  "text": "Semantic colors for consistent theming. All colors use light-dark() for automatic mode switching."
28
28
  },
29
+ {
30
+ "type": "prose",
31
+ "text": "Status roles: pick the token by the surface. `<status>` is info, success, warning, or error."
32
+ },
33
+ {
34
+ "type": "table",
35
+ "headers": [
36
+ "Status role",
37
+ "Use it for",
38
+ "Pairs with"
39
+ ],
40
+ "rows": [
41
+ [
42
+ "--color-text-<status>",
43
+ "Status text on the page or a card (4.5:1 or more).",
44
+ "—"
45
+ ],
46
+ [
47
+ "--color-icon-<status>",
48
+ "Status icons on the page or a card. Defaults to the text colour.",
49
+ "—"
50
+ ],
51
+ [
52
+ "--color-border-<status>",
53
+ "Status borders on the page or a card, such as an invalid field. Defaults to the text colour.",
54
+ "—"
55
+ ],
56
+ [
57
+ "--color-<status>",
58
+ "Strong status fill, such as a Badge or StatusDot.",
59
+ "--color-on-<status>"
60
+ ],
61
+ [
62
+ "--color-on-<status>",
63
+ "Text and icons on the strong fill (4.5:1 or more).",
64
+ "--color-<status>"
65
+ ],
66
+ [
67
+ "--color-<status>-muted",
68
+ "Pale status fill, such as a Banner.",
69
+ "--color-on-<status>-muted"
70
+ ],
71
+ [
72
+ "--color-on-<status>-muted",
73
+ "Text and icons on the pale fill (4.5:1 or more).",
74
+ "--color-<status>-muted"
75
+ ]
76
+ ]
77
+ },
29
78
  {
30
79
  "type": "table",
31
80
  "headers": [
@@ -154,6 +203,21 @@ export const docs = {
154
203
  "#AA071E",
155
204
  "#E3193B"
156
205
  ],
206
+ [
207
+ "--color-info",
208
+ "#0064E0",
209
+ "#0064E0"
210
+ ],
211
+ [
212
+ "--color-info-muted",
213
+ "#0082FB33",
214
+ "#0082FB3F"
215
+ ],
216
+ [
217
+ "--color-on-info",
218
+ "#FFFFFF",
219
+ "#FFFFFF"
220
+ ],
157
221
  [
158
222
  "--color-success",
159
223
  "#0D8626",
@@ -182,7 +246,7 @@ export const docs = {
182
246
  [
183
247
  "--color-on-error",
184
248
  "#FFFFFF",
185
- "#FFFFFF"
249
+ "#0A1317"
186
250
  ],
187
251
  [
188
252
  "--color-warning",
@@ -199,6 +263,86 @@ export const docs = {
199
263
  "#0A1317",
200
264
  "#0A1317"
201
265
  ],
266
+ [
267
+ "--color-text-info",
268
+ "var(--color-text-blue)",
269
+ "var(--color-text-blue)"
270
+ ],
271
+ [
272
+ "--color-text-success",
273
+ "var(--color-text-green)",
274
+ "var(--color-text-green)"
275
+ ],
276
+ [
277
+ "--color-text-warning",
278
+ "var(--color-text-yellow)",
279
+ "var(--color-text-yellow)"
280
+ ],
281
+ [
282
+ "--color-text-error",
283
+ "var(--color-text-red)",
284
+ "var(--color-text-red)"
285
+ ],
286
+ [
287
+ "--color-icon-info",
288
+ "var(--color-text-info)",
289
+ "var(--color-text-info)"
290
+ ],
291
+ [
292
+ "--color-icon-success",
293
+ "var(--color-text-success)",
294
+ "var(--color-text-success)"
295
+ ],
296
+ [
297
+ "--color-icon-warning",
298
+ "var(--color-text-warning)",
299
+ "var(--color-text-warning)"
300
+ ],
301
+ [
302
+ "--color-icon-error",
303
+ "var(--color-text-error)",
304
+ "var(--color-text-error)"
305
+ ],
306
+ [
307
+ "--color-border-info",
308
+ "var(--color-text-info)",
309
+ "var(--color-text-info)"
310
+ ],
311
+ [
312
+ "--color-border-success",
313
+ "var(--color-text-success)",
314
+ "var(--color-text-success)"
315
+ ],
316
+ [
317
+ "--color-border-warning",
318
+ "var(--color-text-warning)",
319
+ "var(--color-text-warning)"
320
+ ],
321
+ [
322
+ "--color-border-error",
323
+ "var(--color-text-error)",
324
+ "var(--color-text-error)"
325
+ ],
326
+ [
327
+ "--color-on-info-muted",
328
+ "var(--color-text-blue)",
329
+ "var(--color-text-blue)"
330
+ ],
331
+ [
332
+ "--color-on-success-muted",
333
+ "var(--color-text-green)",
334
+ "var(--color-text-green)"
335
+ ],
336
+ [
337
+ "--color-on-warning-muted",
338
+ "var(--color-text-yellow)",
339
+ "var(--color-text-yellow)"
340
+ ],
341
+ [
342
+ "--color-on-error-muted",
343
+ "var(--color-text-red)",
344
+ "var(--color-text-red)"
345
+ ],
202
346
  [
203
347
  "--color-border",
204
348
  "#05365919",
@@ -2,7 +2,7 @@
2
2
 
3
3
  // AUTO-GENERATED — do not edit manually.
4
4
  // Run: node scripts/generate-token-docs.mjs
5
- // Total: 263 tokens across 15 categories.
5
+ // Total: 282 tokens across 15 categories.
6
6
 
7
7
  /** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
8
8
  export const docs = {
@@ -4,16 +4,18 @@
4
4
  export const doc = {
5
5
  type: 'block',
6
6
  exampleFor: 'BottomSheetSwitcher',
7
- name: 'Bottom Sheet Switcher — Review flow',
8
- displayName: 'Bottom Sheet Switcher — Review flow',
7
+ alsoExampleFor: ['BottomSheet'],
8
+ // The published registry identity predates the rewrite; keep it.
9
+ registry: {slug: 'review-flow'},
10
+ name: 'Bottom Sheet — Review flow',
11
+ displayName: 'Bottom Sheet — Review flow',
9
12
  description:
10
- 'A two-step form flow that lets a person review settings, confirm them, or move back, each step in its own native dialog under one scrim.',
13
+ 'A two-step form flow of two standalone sheets driven by one state value: Continue replaces the review step with the confirmation in place, and Back returns.',
11
14
  isReady: true,
12
15
  isShowcase: false,
13
16
  aspectRatio: 3 / 4,
14
17
  componentsUsed: [
15
18
  'BottomSheet',
16
- 'BottomSheetSwitcher',
17
19
  'Button',
18
20
  'Heading',
19
21
  'Section',