@astryxdesign/cli 0.7.14-canary.gfb823d9 → 0.7.14

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 (135) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/api/component/_adapter.d.mts +15 -0
  3. package/api/component/_adapter.mjs +76 -0
  4. package/api/component/component.mjs +8 -1
  5. package/api/search/_named-keywords.d.mts +31 -0
  6. package/api/search/_named-keywords.mjs +177 -0
  7. package/api/search/search-index.mjs +8 -1
  8. package/api/search/search.d.mts +6 -1
  9. package/api/search/search.mjs +49 -8
  10. package/api/theme/_adapter.d.mts +33 -0
  11. package/api/theme/_adapter.mjs +352 -16
  12. package/api/theme/build/build.mjs +261 -10
  13. package/api/theme/eject/eject.mjs +13 -1
  14. package/api/theme/list/list.mjs +11 -2
  15. package/api/theme/palette/generate/color.d.mts +2 -0
  16. package/api/theme/palette/generate/color.mjs +1 -1
  17. package/api/theme/template/template.mjs +139 -6
  18. package/api/theme/theme.type.d.mts +15 -1
  19. package/api/theme/theme.type.mjs +9 -3
  20. package/api/theme/themeAdd.doc.mjs +1 -1
  21. package/api/theme/themeBuild.doc.mjs +10 -2
  22. package/api/theme/themeEject.doc.mjs +2 -2
  23. package/api/theme/themeListAvailable.doc.mjs +1 -1
  24. package/api/theme/themeRemove.doc.mjs +1 -1
  25. package/api/theme/themeTemplate.doc.mjs +8 -0
  26. package/api/theme/themeUse.doc.mjs +1 -1
  27. package/api/theme-edit/_adapter.d.mts +36 -2
  28. package/api/theme-edit/_adapter.mjs +340 -12
  29. package/api/theme-edit/_check.d.mts +28 -25
  30. package/api/theme-edit/_check.mjs +876 -308
  31. package/api/theme-edit/_color.d.mts +53 -4
  32. package/api/theme-edit/_color.mjs +406 -79
  33. package/api/theme-edit/_compiler.d.mts +14 -6
  34. package/api/theme-edit/_compiler.mjs +89 -59
  35. package/api/theme-edit/_context.d.mts +28 -8
  36. package/api/theme-edit/_context.mjs +142 -19
  37. package/api/theme-edit/_edit.d.mts +3 -1
  38. package/api/theme-edit/_edit.mjs +746 -76
  39. package/api/theme-edit/_how-commands.d.mts +91 -0
  40. package/api/theme-edit/_how-commands.mjs +269 -0
  41. package/api/theme-edit/_how-question.d.mts +57 -0
  42. package/api/theme-edit/_how-question.mjs +2574 -0
  43. package/api/theme-edit/_how.d.mts +27 -8
  44. package/api/theme-edit/_how.mjs +776 -175
  45. package/api/theme-edit/_overview.d.mts +9 -0
  46. package/api/theme-edit/_overview.mjs +296 -0
  47. package/api/theme-edit/_palette.d.mts +155 -15
  48. package/api/theme-edit/_palette.mjs +1446 -262
  49. package/api/theme-edit/_parts.mjs +61 -5
  50. package/api/theme-edit/_png.d.mts +18 -6
  51. package/api/theme-edit/_png.mjs +135 -25
  52. package/api/theme-edit/_preview-app.d.mts +32 -11
  53. package/api/theme-edit/_preview-app.mjs +1976 -285
  54. package/api/theme-edit/_preview.d.mts +39 -8
  55. package/api/theme-edit/_preview.mjs +367 -41
  56. package/api/theme-edit/_settings.d.mts +147 -11
  57. package/api/theme-edit/_settings.mjs +908 -99
  58. package/api/theme-edit/_tables.d.mts +4 -16
  59. package/api/theme-edit/_tables.mjs +51 -117
  60. package/api/theme-edit/theme-edit.type.d.mts +102 -66
  61. package/api/theme-edit/theme-edit.type.mjs +58 -40
  62. package/api/theme-edit/themeEditHow.doc.mjs +17 -6
  63. package/api/theme-edit/themeEditNew.doc.mjs +21 -5
  64. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +18 -5
  65. package/api/theme-edit/themeEditPreviewApp.doc.mjs +12 -9
  66. package/api/theme-edit/themeEditPreviewList.doc.mjs +11 -2
  67. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +29 -3
  68. package/api/theme-edit/themeEditSet.doc.mjs +14 -8
  69. package/api/theme-edit/themeEditShow.doc.mjs +10 -5
  70. package/api/theme-edit/themeEditUndo.doc.mjs +9 -4
  71. package/assets/discover/official-packages.json +4 -0
  72. package/assets/docs/tree/icon-sets.doc.mjs +3 -3
  73. package/assets/docs.generated.json +1 -0
  74. package/assets/icons/definitions/bookmarkAdd.doc.mjs +9 -0
  75. package/assets/icons/definitions/documentSearch.doc.mjs +9 -0
  76. package/assets/icons/definitions/keyboard.doc.mjs +9 -0
  77. package/assets/icons/definitions/paintBrush.doc.mjs +9 -0
  78. package/assets/icons/definitions/wallet.doc.mjs +9 -0
  79. package/assets/preview-app/gitignore +3 -0
  80. package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +1 -1
  81. package/assets/templates/blocks/components/Lightbox/LightboxGallery.tsx +1 -1
  82. package/assets/templates/components.generated.json +1 -0
  83. package/assets/templates/pages/gallery-hero/page.tsx +8 -2
  84. package/assets/templates/pages/settings-dialog/template.doc.mjs +3 -3
  85. package/assets/templates/pages/side-gallery/page.tsx +1 -1
  86. package/assets/templates/pages/table-filter/template.doc.mjs +2 -2
  87. package/assets/templates/pages/theme-showcase/template.doc.mjs +1 -1
  88. package/clients/cli/bin/astryx.mjs +37 -5
  89. package/clients/cli/commands/experimental/theme.mjs +422 -57
  90. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +22 -9
  91. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +103 -4
  92. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +13 -8
  93. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +5 -5
  94. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +5 -5
  95. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  96. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +3 -2
  97. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +2 -8
  98. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +2 -2
  99. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  100. package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -1
  101. package/clients/cli/commands/experimental-theme.doc.mjs +3 -4
  102. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  103. package/clients/cli/commands/theme-eject.doc.mjs +3 -3
  104. package/clients/cli/commands/theme-remove.doc.mjs +2 -2
  105. package/clients/cli/commands/theme-template.doc.mjs +11 -4
  106. package/clients/cli/commands/theme.mjs +145 -46
  107. package/clients/cli/commands.generated.json +1 -0
  108. package/clients/cli/index.mjs +96 -5
  109. package/clients/cli/lib/json-shim.mjs +29 -1
  110. package/foundation/config/project.d.mts +16 -2
  111. package/foundation/config/project.mjs +40 -6
  112. package/foundation/config/theme-state.d.mts +9 -0
  113. package/foundation/config/theme-state.mjs +20 -1
  114. package/foundation/discovery/template-adapter.d.mts +12 -1
  115. package/foundation/discovery/template-adapter.mjs +29 -4
  116. package/foundation/discovery/template-icons.d.mts +13 -0
  117. package/foundation/discovery/template-icons.mjs +76 -0
  118. package/foundation/discovery/template-needs.d.mts +7 -0
  119. package/foundation/discovery/template-needs.mjs +117 -8
  120. package/foundation/discovery/template-source-tree.d.mts +5 -1
  121. package/foundation/discovery/template-source-tree.mjs +6 -4
  122. package/foundation/discovery/theme-discovery.d.mts +14 -3
  123. package/foundation/discovery/theme-discovery.mjs +45 -12
  124. package/foundation/doc-compiler/import.mjs +68 -3
  125. package/foundation/doc-compiler/stored-docs.d.mts +27 -0
  126. package/foundation/doc-compiler/stored-docs.mjs +65 -0
  127. package/foundation/fs/fs-error.d.mts +17 -0
  128. package/foundation/fs/fs-error.mjs +34 -0
  129. package/foundation/response/error-codes.d.mts +3 -1
  130. package/foundation/response/error-codes.doc.mjs +13 -1
  131. package/foundation/response/error-codes.mjs +11 -1
  132. package/foundation/response/response-types.doc.mjs +6 -6
  133. package/package.json +6 -7
  134. package/clients/cli/commands/experimental-theme-palette-generate.doc.mjs +0 -73
  135. package/clients/cli/commands/experimental-theme-palette.doc.mjs +0 -37
@@ -8,14 +8,14 @@ export const HOW: "astryx experimental theme editor how";
8
8
  /** The built-in themes a theme can build on (`new --like`, `set base`), neutral first. */
9
9
  export const LIKE: string[];
10
10
  /**
11
- * Parts that should look alike. `--on <family>` styles every member.
11
+ * Groups of parts that should look alike. `--on <group>` styles every member.
12
12
  * @type {Record<string, string[]>}
13
13
  */
14
14
  export const FAMILIES: Record<string, string[]>;
15
15
  /**
16
- * Families whose members always look alike: styling one member styles them
17
- * all unless `--only` is given. Other families spread only when `--on`
18
- * names the family itself.
16
+ * Groups whose members always look alike: styling one member styles them
17
+ * all unless `--only` is given. Other groups spread only when `--on`
18
+ * names the group itself.
19
19
  */
20
20
  export const AUTO_SPREAD: string[];
21
21
  export function familyOf(target: string): string | null;
@@ -88,18 +88,6 @@ export const COMMON_PROPERTIES: string[];
88
88
  * @type {Record<string, (value: string, on: string | undefined) => string[]>}
89
89
  */
90
90
  export const THING_HINTS: Record<string, (value: string, on: string | undefined) => string[]>;
91
- /**
92
- * Words for parts, and the parts (or families, or `part:prop:value`) they
93
- * mean. The first match order is the answer order.
94
- * @type {Array<[RegExp, string[]]>}
95
- */
96
- export const PART_WORDS: Array<[RegExp, string[]]>;
97
- /**
98
- * Words for aspects of a part. `background` comes last: color words mean it
99
- * only when no other aspect matched them.
100
- * @type {Array<[string, RegExp]>}
101
- */
102
- export const INTENTS: Array<[string, RegExp]>;
103
91
  /** Sample values for design words in a `how` question. */
104
92
  export const DESIGN: Record<string, string>;
105
93
  /** States every part takes, beyond the ones its doc lists. */
@@ -2,8 +2,8 @@
2
2
 
3
3
  /**
4
4
  * @file The data behind `astryx experimental theme`: the dials and their
5
- * rungs, the part families, the built-in themes a theme can build on, and the
6
- * words `how` understands. A new dial, rung, family or word is a table entry
5
+ * rungs, the part groups, the built-in themes a theme can build on, and the
6
+ * words `how` understands. A new dial, rung, group or word is a table entry
7
7
  * here with a test, not new code.
8
8
  *
9
9
  * @position api/theme-edit — data read by the engine and the help text
@@ -23,7 +23,7 @@ export const LIKE = discoverBundledThemes()
23
23
  .sort((a, b) => Number(b === 'neutral') - Number(a === 'neutral'));
24
24
 
25
25
  /**
26
- * Parts that should look alike. `--on <family>` styles every member.
26
+ * Groups of parts that should look alike. `--on <group>` styles every member.
27
27
  * @type {Record<string, string[]>}
28
28
  */
29
29
  export const FAMILIES = {
@@ -62,9 +62,9 @@ export const FAMILIES = {
62
62
  };
63
63
 
64
64
  /**
65
- * Families whose members always look alike: styling one member styles them
66
- * all unless `--only` is given. Other families spread only when `--on`
67
- * names the family itself.
65
+ * Groups whose members always look alike: styling one member styles them
66
+ * all unless `--only` is given. Other groups spread only when `--on`
67
+ * names the group itself.
68
68
  */
69
69
  export const AUTO_SPREAD = ['inputs', 'checks'];
70
70
 
@@ -321,7 +321,7 @@ export const DIALS = {
321
321
  CORNERS.map(
322
322
  ([n, v]) => `${n} (${v === 9999 ? 'fully round' : `${v}px`})`,
323
323
  ).join(', ') +
324
- ", or a size like 6px. Whole theme: sets the 4 corner tokens in fixed ratios. With --on <part or family>: that part's border-radius. Corners are a size, so they are the same in light and dark.",
324
+ ", or a size like 6px. Whole theme: sets the 4 corner tokens in fixed ratios. With --on <part or group>: that part's border-radius. Corners are a size, so they are the same in light and dark.",
325
325
  values: 'square|small|medium|large|round|pill|more|less|<size like 6px>',
326
326
  examples: [
327
327
  'set my corners pill',
@@ -336,7 +336,7 @@ export const DIALS = {
336
336
  help:
337
337
  'How much room there is: padding, gaps and control heights together. Rungs: ' +
338
338
  SPACING.map(([n, f]) => `${n} (x${f})`).join(', ') +
339
- '. Whole theme: scales every spacing token and control height. With --on <part or family>: only inside it.',
339
+ '. Whole theme: scales every spacing token and control height. With --on <part or group>: only inside it.',
340
340
  values: 'tight|compact|medium|roomy|spacious|more|less',
341
341
  examples: [
342
342
  'set my spacing compact',
@@ -347,42 +347,49 @@ export const DIALS = {
347
347
  'spacing space room roomy airy dense density compact tight padding gap gaps margin breathing cramped spread spacious',
348
348
  },
349
349
  accent: {
350
- help: 'The main brand color: primary buttons, links, selection and the focus ring. The color seeds the accent family of the theme palette (palette.config.json, grown by the same generator as `theme palette generate`), and the accent tokens point at its stops, light and dark from the one color: --color-accent, --color-on-accent, --color-text-accent, --color-icon-accent, --color-accent-muted and --focus-outline-color. A token moves to a nearer stop when it needs to: text to 4.5:1, the focus ring to 3:1, the fill until the text on it reads. `how palette` lists the stops. For an exact color, set the token itself (set my --color-accent "#7c3aed"): an exact token always wins over the palette.',
350
+ help: 'The main brand color: primary buttons, links, selection and the focus ring. From the one color the editor generates its shades, light and dark, and points the accent tokens at them: --color-accent, --color-on-accent, --color-text-accent, --color-icon-accent, --color-accent-muted and --focus-outline-color. The fill keeps the exact color you gave in light, and in dark too when text on it reads at 4.5:1 and it stands out from the dark page at 3:1; otherwise dark mode uses shade 70, where the official themes put a dark fill, or the shade nearest it that passes both, and the result says so. Text on the fill is the neutral color\'s white or near-black (pure white or black without a neutral color), whichever reads on it. The fill never moves: when no text reads on it, or a pale fill does not stand out from the light page, the result says so. Other tokens move to a nearby shade when they must read: text at 4.5:1, the focus ring at 3:1. `how colors` explains it; the Colors preview page (`preview add`) shows every shade. For an exact color, set the token itself (set my --color-accent "#7c3aed"): an exact token always wins over the generated colors.',
351
351
  values: '<color>',
352
352
  examples: ['set my accent "#7c3aed"', 'set my accent rebeccapurple'],
353
353
  words:
354
- 'accent brand primary main color colour key highlight link selection palette seed',
354
+ 'accent brand primary main color colour key highlight link selection seed',
355
355
  },
356
356
  neutral: {
357
- help: 'The gray of the theme: surfaces, text, borders and hover tints. The color seeds the neutral family of the theme palette (its hue and how much of it shows), and the surface, text, icon, border, skeleton and overlay tokens point at its stops, light and dark from the one color. Secondary text and icons move to a stop that reads on the surfaces. Give a gray with a little color ("#64748b") for a cool or warm neutral; a strong color makes colored surfaces. `how palette` lists the stops.',
357
+ help: 'The gray of the theme: surfaces (cards, panels, popovers, muted fills), text, icons, borders, skeletons and hover tints. The page background stays the base theme\'s (often a light gray), so a tinted gray never tints the page; the result names it, and for a white or off-white page set --color-background-body "#ffffff" (with --mode light in a theme with both modes). From the one color the editor generates light and dark shades; your exact color sits at its own shade in both modes, and the shades around it follow it. The surface, text, icon, border, skeleton and overlay tokens point at those shades. Secondary text and icons move to a shade that reads on the surfaces. Give a gray with a little color ("#64748b") for a cool or warm neutral; a strong color makes colored surfaces. `how colors` explains it.',
358
358
  values: '<color>',
359
359
  examples: ['set my neutral "#64748b"', 'set my neutral "#78716c"'],
360
360
  words:
361
- 'neutral gray grey surface surfaces background text border tint warm cool slate stone palette',
361
+ 'neutral gray grey surface surfaces background text border tint warm cool slate stone',
362
362
  },
363
363
  success: {
364
- help: 'The success color (done, valid, positive). It seeds the success family of the theme palette, and --color-success, --color-on-success, --color-text-success, --color-icon-success, --color-success-muted, --color-on-success-muted and --color-border-success point at its stops, light and dark. `how palette` lists the stops.',
364
+ help: 'The success color (done, valid, positive). From it the editor generates light and dark shades, and --color-success, --color-on-success, --color-text-success, --color-icon-success, --color-success-muted, --color-on-success-muted and --color-border-success point at them. `how colors` explains it.',
365
365
  values: '<color>',
366
366
  examples: ['set my success "#16a34a"'],
367
- words: 'success green ok valid positive done status palette',
367
+ words: 'success green ok valid positive done status',
368
368
  },
369
369
  warning: {
370
- help: 'The warning color (caution). It seeds the warning family of the theme palette, and the --color-warning tokens (fill, on, text, icon, muted, on-muted, border) point at its stops, light and dark. `how palette` lists the stops.',
370
+ help: 'The warning color (caution). From it the editor generates light and dark shades, and the --color-warning tokens (fill, on, text, icon, muted, on-muted, border) point at them. `how colors` explains it.',
371
371
  values: '<color>',
372
372
  examples: ['set my warning "#f59e0b"'],
373
- words: 'warning caution yellow amber status palette',
373
+ words: 'warning caution yellow amber status',
374
374
  },
375
375
  danger: {
376
- help: 'The danger color (errors, destructive actions). It seeds the danger family of the theme palette, and the --color-error tokens (fill, on, text, icon, muted, on-muted, border) point at its stops, light and dark. `how palette` lists the stops.',
376
+ help: 'The danger color (errors, destructive actions). From it the editor generates light and dark shades, and the --color-error tokens (fill, on, text, icon, muted, on-muted, border) point at them. `how colors` explains it.',
377
377
  values: '<color>',
378
378
  examples: ['set my danger "#dc2626"'],
379
- words: 'danger error destructive red invalid negative status palette',
379
+ words: 'danger error destructive red invalid negative status',
380
380
  },
381
381
  info: {
382
- help: 'The info color (notices, help). It seeds the info family of the theme palette, and the --color-info tokens (fill, on, text, icon, muted, on-muted, border) point at its stops, light and dark. `how palette` lists the stops.',
382
+ help: 'The info color (notices, help). From it the editor generates light and dark shades, and the --color-info tokens (fill, on, text, icon, muted, on-muted, border) point at them. `how colors` explains it.',
383
383
  values: '<color>',
384
384
  examples: ['set my info "#0284c7"'],
385
- words: 'info information notice help blue status palette',
385
+ words: 'info information notice help blue status',
386
+ },
387
+ vibrancy: {
388
+ help: 'How saturated the generated colors are: 0 is gray, 100 the most vivid, 50 the default; more and less step by 10. Every color the theme sets (accent, neutral, success, warning, danger, info) is generated again; each exact color you gave stays as given at its own shade, and the shades around it get more or less color. more at 100 and less at 0 change nothing, so they are refused. The whole theme only, and only once the theme sets a color; undoing the last color removes vibrancy too.',
389
+ values: '<0-100>|more|less',
390
+ examples: ['set my vibrancy 70', 'set my vibrancy less'],
391
+ words:
392
+ 'vibrancy vibrant saturation saturated colorful colourful vivid muted dull washed pastel intense',
386
393
  },
387
394
  font: {
388
395
  help:
@@ -390,7 +397,7 @@ export const DIALS = {
390
397
  SYSTEM_FONTS.join(', ') +
391
398
  '. Open fonts with a loading package: ' +
392
399
  Object.keys(OPEN_FONTS).join(', ') +
393
- ' (previews show them when the package is installed; the result names the import line for the app). Also: rounded, comic, any family name in quotes, or a whole stack with commas ("Inter, Helvetica, sans-serif"). Whole theme: body and headings. With --on heading|body|code: only that role. Any other font must be loaded by the app.',
400
+ ' (previews show them when the package is installed; the result names the import line for the app). Also: rounded, comic, any family name in quotes, or a whole stack with commas ("Inter, Helvetica, sans-serif"). Whole theme: body and headings. With --on heading|body|code: only that role. An open font loads only once its package is installed (the result of set names the install line for your package manager, and the closest font that needs no install); any other font must be loaded by the app.',
394
401
  values: `${[...Object.keys(FONTS), ...Object.keys(OPEN_FONTS)].join('|')}|"<family or stack>"`,
395
402
  examples: [
396
403
  'set my font mono',
@@ -410,7 +417,7 @@ export const DIALS = {
410
417
  Object.entries(HEADING_TRACKING)
411
418
  .map(([n, v]) => `${n} (${v})`)
412
419
  .join(', ') +
413
- '. Set one word at a time: weight words and tracking words are separate settings. Whole theme only; for one heading level use font-weight --on heading --when level:<1-6>.',
420
+ '. Set one word at a time: weight words and tracking words are separate settings. headings always wins over type for weight and tracking, whatever the order. Whole theme only; for one heading level use font-weight --on heading --when level:<1-6>.',
414
421
  values: [
415
422
  ...Object.keys(HEADING_WEIGHTS),
416
423
  ...Object.keys(HEADING_TRACKING),
@@ -433,7 +440,7 @@ export const DIALS = {
433
440
  words: 'cta solid outline outlined soft tint caps uppercase filled',
434
441
  },
435
442
  type: {
436
- help: 'The type personality: how far headings step up from body text and how they are set. compact: small steps (x1.15), semibold. standard: the default (x1.2). editorial: bigger steps (x1.3), tight tracking, semibold. display: big steps (x1.4), heavy weight, tighter tracking (a marketing feel). Works with text-size and headings.',
443
+ help: 'The type personality: how far headings step up from body text and how they are set. compact: small steps (x1.15), semibold. standard: the default (x1.2). editorial: bigger steps (x1.3), tight tracking, semibold. display: big steps (x1.4), heavy weight, tighter tracking (a marketing feel). Text below the base size keeps its standard sizes, so small text stays readable. Works with text-size; a headings setting keeps its weight or tracking whatever the order. Phones (touch screens below 1024px wide) keep the base theme reading sizes.',
437
444
  values: Object.keys(TYPE_STYLES).join('|'),
438
445
  examples: ['set my type display', 'set my type editorial'],
439
446
  words:
@@ -443,7 +450,7 @@ export const DIALS = {
443
450
  help:
444
451
  'Base text size; every heading size scales from it. Rungs: ' +
445
452
  TEXT_SIZE.map(([n, v]) => `${n} (${v}px)`).join(', ') +
446
- ', or a number.',
453
+ ', or a number of pixels from 10 to 32. Phones (touch screens below 1024px wide) keep the base theme reading sizes.',
447
454
  values: 'small|medium|large|larger|more|less|<number>',
448
455
  examples: ['set my text-size small', 'set my text-size more'],
449
456
  words: 'text size font size small big large scale',
@@ -455,7 +462,7 @@ export const DIALS = {
455
462
  words: 'base start starting built-in extends foundation',
456
463
  },
457
464
  mode: {
458
- help: "Which color modes the theme supports. light-only / dark-only: colors get one value and previews render in that mode. both (default): colors without --mode apply to both; --mode light|dark sets one side, and the other side keeps the base theme's value.",
465
+ help: "Which color modes the theme supports. light-only / dark-only: the colors the theme sets get one value, its mode's shade; settings saved for the other mode stay saved but do not apply (the result names them); the in-app preview starts in that mode with no switch. both (default): colors without --mode apply to both; --mode light|dark sets one side, and the other side keeps the base theme's value.",
459
466
  values: 'both|light-only|dark-only',
460
467
  examples: ['set my mode dark-only'],
461
468
  words: 'mode light dark only night day scheme',
@@ -611,98 +618,6 @@ export const THING_HINTS = {
611
618
  'text-color': (_v, on) => [`${HOW} "text color on ${on ?? '<part>'}"`],
612
619
  };
613
620
 
614
- /**
615
- * Words for parts, and the parts (or families, or `part:prop:value`) they
616
- * mean. The first match order is the answer order.
617
- * @type {Array<[RegExp, string[]]>}
618
- */
619
- export const PART_WORDS = [
620
- [
621
- /\b(header|top ?bar|title ?bar|nav ?bar|app ?bar|masthead)\b/,
622
- ['app-shell-header'],
623
- ],
624
- [
625
- /\b(nav(igation)? (links?|items?)|menu items?|top ?nav items?)\b/,
626
- ['top-nav-item', 'side-nav-item'],
627
- ],
628
- [
629
- /\b(app (name|title)|logo|brand name|site title|product name)\b/,
630
- ['top-nav-heading'],
631
- ],
632
- [
633
- /\b(side ?nav|sidebar|side ?panel|left (panel|column))\b/,
634
- ['side-nav', 'side-nav-item'],
635
- ],
636
- [
637
- /\b(content area|main area|behind the cards|main content)\b/,
638
- ['layout-content'],
639
- ],
640
- [
641
- /\b(page|desktop|backdrop|whole background|app background)\b/,
642
- ['app-shell'],
643
- ],
644
- [/\b(windows?|panels?|cards?|boxes|tiles?)\b/, ['containers']],
645
- [/\b(primary|main|blue) buttons?\b/, ['button:variant:primary']],
646
- [/\b(secondary|other) buttons?\b/, ['button:variant:secondary']],
647
- [/\b(ghost|text|link|cancel) buttons?\b/, ['button:variant:ghost']],
648
- [
649
- /\b(destructive|danger|delete|red) buttons?\b/,
650
- ['button:variant:destructive'],
651
- ],
652
- [/\bbuttons?\b/, ['button']],
653
- [/\b(banner|alert|notice|announcement|info box)\b/, ['banner']],
654
- [
655
- /\b(inputs?|text ?box(es)?|text ?fields?|fields?|forms?|dropdowns?|selects?)\b/,
656
- ['inputs'],
657
- ],
658
- [/\b(checkbox(es)?|check ?marks?)\b/, ['checks']],
659
- [/\b(toggles?|switch(es)?)\b/, ['switch']],
660
- [/\b(progress|loading bar)\b/, ['progress-bar-fill', 'progress-bar-track']],
661
- [/\b(table header|column headers?)\b/, ['table-header-cell']],
662
- [/\b(table|rows?)\b/, ['table-row', 'table-cell']],
663
- [/\b(tabs?)\b/, ['tab', 'tab-indicator']],
664
- [/\b(badges?|pills?|chips?|tags?)\b/, ['badge']],
665
- [/\b(status dots?|dots?)\b/, ['status-dot']],
666
- [/\b(headings?|titles?)\b/, ['heading']],
667
- [/\b(dialogs?|modals?|popups?)\b/, ['dialog']],
668
- [/\b(tooltips?)\b/, ['tooltip']],
669
- [/\b(toasts?)\b/, ['toast']],
670
- ];
671
-
672
- /**
673
- * Words for aspects of a part. `background` comes last: color words mean it
674
- * only when no other aspect matched them.
675
- * @type {Array<[string, RegExp]>}
676
- */
677
- export const INTENTS = [
678
- [
679
- 'text',
680
- /\b(text|font colou?r|writing|words|white text|dark text|readable|unreadable|links?|labels?)\b/,
681
- ],
682
- [
683
- 'font',
684
- /\b(font|typeface|bold|weight|heavier|lighter|italic|uppercase|letter ?spacing)\b/,
685
- ],
686
- [
687
- 'corners',
688
- /\b(round(ed|er)?|corners?|radius|curv\w*|circular|circle|pill|sharp|square)\b/,
689
- ],
690
- [
691
- 'shadow',
692
- /\b(shadows?|depth|elevat\w*|bevel\w*|raised|3d|glow|sunken|inset)\b/,
693
- ],
694
- ['border', /\b(borders?|outlines?|edges?|frames?|strokes?|thick)\b/],
695
- [
696
- 'spacing',
697
- /\b(spacing|space|padding|gaps?|margins?|room|roomy|dense|compact|tight|cramped|airy)\b/,
698
- ],
699
- ['size', /\b(taller|shorter|height|bigger|smaller)\b/],
700
- [
701
- 'background',
702
- /\b(background|bg|fill|filled|gradient|glossy|tint|paint|colou?r(ed)?|blue|red|green|white|black|dark|light|cream|beige)\b/,
703
- ],
704
- ];
705
-
706
621
  /** Sample values for design words in a `how` question. */
707
622
  export const DESIGN = /** @type {Record<string, string>} */ ({
708
623
  gradient: '"linear-gradient(#ffffff, #d1d5db)"',
@@ -722,3 +637,22 @@ export const COMMON_STATES = [
722
637
  'focus-within',
723
638
  'disabled',
724
639
  ];
640
+
641
+ // These tables are looked up by words people type: with no prototype,
642
+ // `constructor` or `__proto__` is never found in them.
643
+ for (const table of [
644
+ FAMILIES,
645
+ FONTS,
646
+ OPEN_FONTS,
647
+ CLOSEST_OPEN_FONT,
648
+ HEADING_WEIGHTS,
649
+ HEADING_TRACKING,
650
+ SURFACES,
651
+ TYPE_STYLES,
652
+ DIALS,
653
+ GROUPS,
654
+ DIRECT,
655
+ THING_HINTS,
656
+ DESIGN,
657
+ ])
658
+ Object.setPrototypeOf(table, null);