@astryxdesign/cli 0.7.14 → 0.7.15-canary.g06b7e61

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 (203) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/README.md +63 -63
  3. package/api/build/_adapter.d.mts +4 -0
  4. package/api/build/_adapter.mjs +28 -2
  5. package/api/build/blocks/blocks.d.mts +10 -1
  6. package/api/build/blocks/blocks.mjs +84 -7
  7. package/api/build/build.mjs +6 -1
  8. package/api/build/tree.d.mts +4 -0
  9. package/api/build/tree.mjs +9 -2
  10. package/api/doctor/_adapter.d.mts +3 -1
  11. package/api/doctor/_adapter.mjs +14 -1
  12. package/api/doctor/_authoring-audit.d.mts +42 -0
  13. package/api/doctor/_authoring-audit.mjs +106 -0
  14. package/api/doctor/doctor.d.mts +7 -0
  15. package/api/doctor/doctor.mjs +24 -39
  16. package/api/doctor/theme-checks.mjs +56 -21
  17. package/api/integration/add-helpers.mjs +5 -0
  18. package/api/integration/add-theme.mjs +15 -110
  19. package/api/integration/validate-integration.mjs +17 -3
  20. package/api/integration/validateIntegration.doc.mjs +1 -1
  21. package/api/search/_adapter.mjs +124 -3
  22. package/api/search/_candidate-score.mjs +63 -9
  23. package/api/search/_entries.d.mts +10 -0
  24. package/api/search/_entries.mjs +68 -1
  25. package/api/search/_gather-templates.d.mts +11 -0
  26. package/api/search/_gather-templates.mjs +22 -2
  27. package/api/search/_words.mjs +26 -6
  28. package/api/swizzle/copy/copy.mjs +1 -1
  29. package/api/theme/_adapter.d.mts +37 -5
  30. package/api/theme/_adapter.mjs +381 -57
  31. package/api/theme/_fork.d.mts +90 -0
  32. package/api/theme/_fork.mjs +246 -0
  33. package/api/theme/build/build.d.mts +40 -2
  34. package/api/theme/build/build.mjs +477 -66
  35. package/api/theme/eject/eject.mjs +36 -15
  36. package/api/theme/list/list.mjs +3 -6
  37. package/api/theme/palette/generate/generator.d.mts +13 -0
  38. package/api/theme/palette/generate/generator.mjs +32 -2
  39. package/api/theme/targets/targets.d.mts +8 -0
  40. package/api/theme/targets/targets.mjs +24 -4
  41. package/api/theme/template/template.mjs +48 -2
  42. package/api/theme/theme.type.d.mts +8 -0
  43. package/api/theme/theme.type.mjs +5 -1
  44. package/api/theme/themeBuild.doc.mjs +7 -4
  45. package/api/theme/themeEject.doc.mjs +3 -3
  46. package/api/theme/themeRemove.doc.mjs +5 -2
  47. package/api/theme/themeTargets.doc.mjs +1 -1
  48. package/api/theme/themeTemplate.doc.mjs +2 -2
  49. package/api/theme/themeUse.doc.mjs +8 -2
  50. package/api/theme-edit/_adapter.d.mts +46 -3
  51. package/api/theme-edit/_adapter.mjs +496 -112
  52. package/api/theme-edit/_catalog.d.mts +1 -6
  53. package/api/theme-edit/_catalog.mjs +5 -268
  54. package/api/theme-edit/_check.d.mts +9 -4
  55. package/api/theme-edit/_check.mjs +1232 -229
  56. package/api/theme-edit/_color.d.mts +19 -0
  57. package/api/theme-edit/_color.mjs +280 -34
  58. package/api/theme-edit/_compiler.d.mts +3 -1
  59. package/api/theme-edit/_compiler.mjs +52 -13
  60. package/api/theme-edit/_context.d.mts +4 -1
  61. package/api/theme-edit/_context.mjs +126 -13
  62. package/api/theme-edit/_css.d.mts +84 -0
  63. package/api/theme-edit/_css.mjs +700 -0
  64. package/api/theme-edit/_edit.d.mts +9 -3
  65. package/api/theme-edit/_edit.mjs +806 -103
  66. package/api/theme-edit/_how-commands.d.mts +38 -7
  67. package/api/theme-edit/_how-commands.mjs +64 -45
  68. package/api/theme-edit/_how-question.d.mts +33 -0
  69. package/api/theme-edit/_how-question.mjs +2553 -381
  70. package/api/theme-edit/_how.mjs +402 -31
  71. package/api/theme-edit/_overview.mjs +2 -7
  72. package/api/theme-edit/_palette.d.mts +60 -13
  73. package/api/theme-edit/_palette.mjs +826 -295
  74. package/api/theme-edit/_parts.d.mts +42 -10
  75. package/api/theme-edit/_parts.mjs +280 -69
  76. package/api/theme-edit/_png.d.mts +4 -4
  77. package/api/theme-edit/_png.mjs +4 -2
  78. package/api/theme-edit/_preview-app.d.mts +14 -0
  79. package/api/theme-edit/_preview-app.mjs +1675 -235
  80. package/api/theme-edit/_preview.d.mts +7 -16
  81. package/api/theme-edit/_preview.mjs +79 -86
  82. package/api/theme-edit/_project.d.mts +32 -2
  83. package/api/theme-edit/_project.mjs +80 -19
  84. package/api/theme-edit/_settings.d.mts +199 -52
  85. package/api/theme-edit/_settings.mjs +1422 -217
  86. package/api/theme-edit/_tables.d.mts +19 -6
  87. package/api/theme-edit/_tables.mjs +150 -92
  88. package/api/theme-edit/theme-edit.type.d.mts +20 -1
  89. package/api/theme-edit/theme-edit.type.mjs +6 -3
  90. package/api/theme-edit/themeEditHow.doc.mjs +6 -0
  91. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  92. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
  93. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  94. package/api/theme-edit/themeEditPreviewList.doc.mjs +2 -2
  95. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -1
  96. package/api/theme-edit/themeEditSet.doc.mjs +1 -1
  97. package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
  98. package/api/upgrade/_adapter.d.mts +1 -0
  99. package/assets/codemods/run-codemod.mjs +61 -0
  100. package/assets/codemods/runner.mjs +5 -4
  101. package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +3 -0
  102. package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +5 -1
  103. package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +3 -0
  104. package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +4 -0
  105. package/assets/codemods/transforms/v0.7.0/rename-empty-search-results-text.mjs +17 -12
  106. package/assets/codemods/transforms/v0.7.2/migrate-list-edge-compensation-to-edge.mjs +3 -0
  107. package/assets/codemods/transforms/v0.7.5/migrate-codeblock-tokenizer-to-language.mjs +3 -0
  108. package/assets/codemods/transforms/v0.7.8/promote-tokenizer-presentation.mjs +3 -0
  109. package/assets/docs/tree/calendars.doc.mjs +1 -3
  110. package/assets/docs/tree/checks.doc.mjs +22 -1
  111. package/assets/docs/tree/publishing.doc.mjs +1 -0
  112. package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
  113. package/assets/docs.generated.json +2 -1
  114. package/assets/preview-app/next.config.mjs +7 -1
  115. package/assets/self-audit.generated.json +1 -0
  116. package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.doc.mjs +14 -0
  117. package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.tsx +31 -0
  118. package/assets/templates/components.generated.json +1 -1
  119. package/authoring/integration/integration.doc.mjs +8 -0
  120. package/authoring/integration/schema.d.mts +8 -0
  121. package/authoring/integration/schema.mjs +1 -0
  122. package/authoring/integration/type.ts +9 -0
  123. package/clients/cli/bin/astryx.mjs +19 -15
  124. package/clients/cli/build-id.generated.json +1 -0
  125. package/clients/cli/commands/ensure-core-built.mjs +12 -5
  126. package/clients/cli/commands/experimental/index.mjs +10 -10
  127. package/clients/cli/commands/experimental/theme.mjs +200 -81
  128. package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
  129. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
  130. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -3
  131. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -2
  132. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  133. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  134. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  135. package/clients/cli/commands/experimental-theme-eject.doc.mjs +3 -3
  136. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
  137. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  138. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +1 -1
  139. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +1 -1
  140. package/clients/cli/commands/experimental-theme-remove.doc.mjs +1 -1
  141. package/clients/cli/commands/experimental-theme-template.doc.mjs +4 -3
  142. package/clients/cli/commands/integration.mjs +8 -0
  143. package/clients/cli/commands/manifest.mjs +5 -2
  144. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  145. package/clients/cli/commands/theme-list.doc.mjs +1 -1
  146. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  147. package/clients/cli/commands/theme.mjs +439 -66
  148. package/clients/cli/index.mjs +27 -6
  149. package/clients/cli/lib/cli-error.mjs +118 -3
  150. package/clients/cli/lib/manifest.mjs +37 -0
  151. package/clients/cli/lib/resolve-theme.mjs +2 -1
  152. package/clients/cli/manifest.generated.json +1 -0
  153. package/foundation/config/project.mjs +34 -8
  154. package/foundation/config/theme-state.d.mts +16 -0
  155. package/foundation/config/theme-state.mjs +84 -13
  156. package/foundation/discovery/module-exports.mjs +16 -2
  157. package/foundation/discovery/stored-self-audit.d.mts +31 -0
  158. package/foundation/discovery/stored-self-audit.mjs +119 -0
  159. package/foundation/discovery/template-adapter.d.mts +48 -2
  160. package/foundation/discovery/template-adapter.mjs +51 -19
  161. package/foundation/discovery/template-needs.d.mts +19 -0
  162. package/foundation/discovery/template-needs.mjs +50 -16
  163. package/foundation/discovery/template-source-tree.d.mts +7 -0
  164. package/foundation/discovery/template-source-tree.mjs +15 -0
  165. package/foundation/discovery/theme-discovery.d.mts +2 -1
  166. package/foundation/discovery/theme-discovery.mjs +16 -10
  167. package/foundation/discovery/theme-imports.d.mts +16 -0
  168. package/foundation/discovery/theme-imports.mjs +30 -2
  169. package/foundation/discovery/theme-module-extensions.d.mts +18 -0
  170. package/foundation/discovery/theme-module-extensions.mjs +30 -0
  171. package/foundation/doc-compiler/import.mjs +22 -15
  172. package/foundation/doc-compiler/stored-docs.d.mts +18 -12
  173. package/foundation/doc-compiler/stored-docs.mjs +52 -19
  174. package/foundation/env/private-dir.d.mts +17 -0
  175. package/foundation/env/private-dir.mjs +42 -0
  176. package/foundation/fs/gather-cache.d.mts +108 -0
  177. package/foundation/fs/gather-cache.mjs +783 -0
  178. package/foundation/fs/jiti-cache.d.mts +21 -0
  179. package/foundation/fs/jiti-cache.mjs +66 -0
  180. package/foundation/fs/module-loader.mjs +14 -3
  181. package/foundation/fs/read-record.d.mts +31 -1
  182. package/foundation/fs/read-record.mjs +100 -7
  183. package/foundation/integrations/autolink.d.mts +1 -24
  184. package/foundation/integrations/autolink.mjs +7 -60
  185. package/foundation/integrations/declared-dependencies.d.mts +27 -0
  186. package/foundation/integrations/declared-dependencies.mjs +73 -0
  187. package/foundation/integrations/integrations.d.mts +8 -0
  188. package/foundation/integrations/integrations.mjs +4 -0
  189. package/foundation/integrations/may-have-integrations.d.mts +8 -0
  190. package/foundation/integrations/may-have-integrations.mjs +47 -0
  191. package/foundation/integrations/validate-contributions.d.mts +62 -1
  192. package/foundation/integrations/validate-contributions.mjs +476 -40
  193. package/foundation/release/cache.d.mts +32 -4
  194. package/foundation/release/cache.mjs +105 -16
  195. package/foundation/release/folder-lock.d.mts +28 -0
  196. package/foundation/release/folder-lock.mjs +205 -0
  197. package/foundation/release/lock-lease.d.mts +2 -1
  198. package/foundation/release/lock-lease.mjs +7 -2
  199. package/foundation/response/error-codes.doc.mjs +1 -1
  200. package/foundation/response/response-types.doc.mjs +5 -5
  201. package/package.json +8 -6
  202. package/api/theme-edit/_css-properties.d.mts +0 -10
  203. package/api/theme-edit/_css-properties.mjs +0 -556
@@ -3,6 +3,11 @@
3
3
 
4
4
  /** The command prefix every suggested command starts with. */
5
5
  export const P: "astryx experimental theme editor";
6
+ /**
7
+ * Parts that take their color from a color prop, whose rule Core writes
8
+ * after part styles: a color set on them never shows.
9
+ */
10
+ export const COLOR_PROP_PARTS: string[];
6
11
  /** The lookup command: what a part reads, a setting, a question, a picture. */
7
12
  export const HOW: "astryx experimental theme editor how";
8
13
  /** The built-in themes a theme can build on (`new --like`, `set base`), neutral first. */
@@ -25,19 +30,27 @@ export const CORNERS: Array<[string, number]>;
25
30
  export const SPACING: Array<[string, number]>;
26
31
  /** @type {Array<[string, number]>} */
27
32
  export const TEXT_SIZE: Array<[string, number]>;
33
+ /** The type roles a font may be set for alone (`font <x> --on <role>`). */
34
+ export const FONT_ROLES: string[];
28
35
  /**
29
36
  * Font presets: the family, then its fallbacks.
30
37
  * @type {Record<string, [string, string]>}
31
38
  */
32
39
  export const FONTS: Record<string, [string, string]>;
33
- /** Presets every desktop system already has, so no font file is needed. */
34
- export const SYSTEM_FONTS: string[];
40
+ /** The CSS-wide keywords: valid in any declaration, never a value of their own. */
41
+ export const CSS_WIDE: string[];
42
+ /** CSS-wide keywords, and `default`, which font-family reserves: never a family, and invalid inside a list. */
43
+ export const CSS_WIDE_KEYWORDS: string[];
44
+ export function isSystemFamily(family: string): boolean;
45
+ export function oneSystemOf(family: string): string | null;
46
+ export function isDesktopFamily(family: string): boolean;
35
47
  /**
36
- * Open fonts with a package that loads them: preset -> family, fallbacks,
37
- * and the package. When the package is installed, previews show the font;
38
- * the app loads it by importing the package once.
39
- * @type {Record<string, {family: string, fallbacks: string, pkg: string}>}
48
+ * Presets that show a font every desktop has, so no font file is needed:
49
+ * the family itself, or (for one that ships on one system, such as Segoe
50
+ * UI) the first fallback.
40
51
  */
52
+ export const SYSTEM_FONTS: string[];
53
+ /** @type {Record<string, {family: string, fallbacks: string, pkg: string}>} */
41
54
  export const OPEN_FONTS: Record<string, {
42
55
  family: string;
43
56
  fallbacks: string;
@@ -10,10 +10,17 @@
10
10
  */
11
11
 
12
12
  import {discoverBundledThemes} from '../../foundation/discovery/theme-discovery.mjs';
13
+ import {collectUnloadedFonts} from '../theme/build/font-warning.mjs';
13
14
 
14
15
  /** The command prefix every suggested command starts with. */
15
16
  export const P = 'astryx experimental theme editor';
16
17
 
18
+ /**
19
+ * Parts that take their color from a color prop, whose rule Core writes
20
+ * after part styles: a color set on them never shows.
21
+ */
22
+ export const COLOR_PROP_PARTS = ['text', 'heading', 'link'];
23
+
17
24
  /** The lookup command: what a part reads, a setting, a question, a picture. */
18
25
  export const HOW = `${P} how`;
19
26
 
@@ -99,6 +106,9 @@ export const TEXT_SIZE = [
99
106
  ['larger', 16],
100
107
  ];
101
108
 
109
+ /** The type roles a font may be set for alone (`font <x> --on <role>`). */
110
+ export const FONT_ROLES = ['body', 'heading', 'code'];
111
+
102
112
  /**
103
113
  * Font presets: the family, then its fallbacks.
104
114
  * @type {Record<string, [string, string]>}
@@ -116,102 +126,150 @@ export const FONTS = {
116
126
  rounded: ['Nunito', '"Varela Round", system-ui, sans-serif'],
117
127
  comic: ['Comic Sans MS', '"Comic Neue", cursive'],
118
128
  };
119
- /** Presets every desktop system already has, so no font file is needed. */
120
- export const SYSTEM_FONTS = [
121
- 'system',
122
- 'tahoma',
123
- 'verdana',
124
- 'segoe',
125
- 'helvetica',
126
- 'georgia',
127
- 'serif',
128
- 'mono',
129
- 'courier',
129
+ /** The CSS-wide keywords: valid in any declaration, never a value of their own. */
130
+ export const CSS_WIDE = [
131
+ 'inherit',
132
+ 'initial',
133
+ 'unset',
134
+ 'revert',
135
+ 'revert-layer',
130
136
  ];
131
137
 
138
+ /** CSS-wide keywords, and `default`, which font-family reserves: never a family, and invalid inside a list. */
139
+ export const CSS_WIDE_KEYWORDS = [...CSS_WIDE, 'default'];
140
+
132
141
  /**
133
- * Open fonts with a package that loads them: preset -> family, fallbacks,
134
- * and the package. When the package is installed, previews show the font;
135
- * the app loads it by importing the package once.
136
- * @type {Record<string, {family: string, fallbacks: string, pkg: string}>}
142
+ * Whether a family needs no font file somewhere: a CSS generic family, or a
143
+ * family on the theme build's own list of system fonts (the one list; the
144
+ * build's font warning reads it).
145
+ * @param {string} family without quotes
137
146
  */
138
- export const OPEN_FONTS = {
139
- inter: {
140
- family: 'Inter',
141
- fallbacks: 'system-ui, sans-serif',
142
- pkg: '@fontsource/inter',
143
- },
144
- roboto: {
145
- family: 'Roboto',
146
- fallbacks: 'system-ui, sans-serif',
147
- pkg: '@fontsource/roboto',
148
- },
149
- poppins: {
150
- family: 'Poppins',
151
- fallbacks: 'system-ui, sans-serif',
152
- pkg: '@fontsource/poppins',
153
- },
154
- figtree: {
155
- family: 'Figtree',
156
- fallbacks: 'system-ui, sans-serif',
157
- pkg: '@fontsource/figtree',
158
- },
159
- 'dm-sans': {
160
- family: 'DM Sans',
161
- fallbacks: 'system-ui, sans-serif',
162
- pkg: '@fontsource/dm-sans',
163
- },
164
- manrope: {
165
- family: 'Manrope',
166
- fallbacks: 'system-ui, sans-serif',
167
- pkg: '@fontsource/manrope',
168
- },
169
- 'space-grotesk': {
170
- family: 'Space Grotesk',
171
- fallbacks: 'system-ui, sans-serif',
172
- pkg: '@fontsource/space-grotesk',
173
- },
174
- 'ibm-plex-sans': {
175
- family: 'IBM Plex Sans',
176
- fallbacks: 'system-ui, sans-serif',
177
- pkg: '@fontsource/ibm-plex-sans',
178
- },
179
- 'ibm-plex-mono': {
180
- family: 'IBM Plex Mono',
181
- fallbacks: 'ui-monospace, monospace',
182
- pkg: '@fontsource/ibm-plex-mono',
183
- },
184
- 'jetbrains-mono': {
185
- family: 'JetBrains Mono',
186
- fallbacks: 'ui-monospace, monospace',
187
- pkg: '@fontsource/jetbrains-mono',
188
- },
189
- nunito: {
190
- family: 'Nunito',
191
- fallbacks: 'system-ui, sans-serif',
192
- pkg: '@fontsource/nunito',
193
- },
194
- 'source-serif': {
195
- family: 'Source Serif 4',
196
- fallbacks: 'Georgia, serif',
197
- pkg: '@fontsource/source-serif-4',
198
- },
199
- 'mona-sans': {
200
- family: 'Mona Sans',
201
- fallbacks: 'system-ui, sans-serif',
202
- pkg: '@fontsource/mona-sans',
203
- },
204
- geist: {
205
- family: 'Geist Sans',
206
- fallbacks: 'system-ui, sans-serif',
207
- pkg: '@fontsource/geist-sans',
208
- },
209
- 'geist-mono': {
210
- family: 'Geist Mono',
211
- fallbacks: 'ui-monospace, monospace',
212
- pkg: '@fontsource/geist-mono',
213
- },
147
+ export const isSystemFamily = family =>
148
+ family.trim() !== '' &&
149
+ collectUnloadedFonts({
150
+ tokens: {'--font-family-body': JSON.stringify(family.trim())},
151
+ }).length === 0;
152
+
153
+ /**
154
+ * The families on that list that only one system ships, with that system:
155
+ * fallback stacks name them on purpose, but as a theme's own font they do
156
+ * not load everywhere.
157
+ */
158
+ const ONE_SYSTEM_FAMILIES = new Map(
159
+ Object.entries({
160
+ macOS: [
161
+ '-apple-system',
162
+ 'blinkmacsystemfont',
163
+ 'helvetica neue',
164
+ 'sf mono',
165
+ 'sf pro',
166
+ 'sf pro text',
167
+ 'sf pro display',
168
+ 'monaco',
169
+ 'menlo',
170
+ 'palatino',
171
+ 'lucida grande',
172
+ 'gill sans',
173
+ 'snell roundhand',
174
+ ],
175
+ Windows: [
176
+ 'segoe ui',
177
+ 'segoe ui emoji',
178
+ 'segoe ui symbol',
179
+ 'consolas',
180
+ 'cambria',
181
+ 'calibri',
182
+ 'lucida console',
183
+ 'brush script mt',
184
+ 'old english text mt',
185
+ ],
186
+ 'Android and ChromeOS': ['roboto'],
187
+ Linux: [
188
+ 'liberation mono',
189
+ 'liberation sans',
190
+ 'liberation serif',
191
+ 'dejavu sans',
192
+ 'dejavu sans mono',
193
+ ],
194
+ }).flatMap(([system, names]) => names.map(n => [n, system])),
195
+ );
196
+
197
+ /** @param {string} family */
198
+ const familyKey = family => family.trim().replace(/\s+/g, ' ').toLowerCase();
199
+
200
+ /**
201
+ * The one system that ships a family on the theme build's list, or null for
202
+ * a family every desktop has (or none does).
203
+ * @param {string} family without quotes
204
+ */
205
+ export const oneSystemOf = family =>
206
+ isSystemFamily(family)
207
+ ? (ONE_SYSTEM_FAMILIES.get(familyKey(family)) ?? null)
208
+ : null;
209
+
210
+ /**
211
+ * Whether a family loads with no font file on every usual desktop: a CSS
212
+ * generic, or a system family macOS and Windows both ship.
213
+ * @param {string} family without quotes
214
+ */
215
+ export const isDesktopFamily = family =>
216
+ isSystemFamily(family) && !ONE_SYSTEM_FAMILIES.has(familyKey(family));
217
+
218
+ /**
219
+ * Presets that show a font every desktop has, so no font file is needed:
220
+ * the family itself, or (for one that ships on one system, such as Segoe
221
+ * UI) the first fallback.
222
+ */
223
+ export const SYSTEM_FONTS = Object.keys(FONTS).filter(k =>
224
+ [FONTS[k][0], FONTS[k][1].split(',')[0].replace(/["']/g, '')].some(
225
+ isDesktopFamily,
226
+ ),
227
+ );
228
+
229
+ /**
230
+ * Open fonts with a package that loads them: preset -> family. The package
231
+ * is `@fontsource/<preset>` and the fallbacks follow the kind of font
232
+ * (`-mono`, serif, sans), except where OPEN_FONT_PACKAGES says otherwise.
233
+ * When the package is installed, previews show the font; the app loads it
234
+ * by importing the package once.
235
+ */
236
+ const OPEN_FONT_FAMILIES = {
237
+ inter: 'Inter',
238
+ roboto: 'Roboto',
239
+ poppins: 'Poppins',
240
+ figtree: 'Figtree',
241
+ 'dm-sans': 'DM Sans',
242
+ manrope: 'Manrope',
243
+ 'space-grotesk': 'Space Grotesk',
244
+ 'ibm-plex-sans': 'IBM Plex Sans',
245
+ 'ibm-plex-mono': 'IBM Plex Mono',
246
+ 'jetbrains-mono': 'JetBrains Mono',
247
+ nunito: 'Nunito',
248
+ 'source-serif': 'Source Serif 4',
249
+ 'mona-sans': 'Mona Sans',
250
+ geist: 'Geist Sans',
251
+ 'geist-mono': 'Geist Mono',
214
252
  };
253
+ /** Presets whose package is not named after them. */
254
+ const OPEN_FONT_PACKAGES = /** @type {Record<string, string>} */ ({
255
+ 'source-serif': 'source-serif-4',
256
+ geist: 'geist-sans',
257
+ });
258
+ /** @type {Record<string, {family: string, fallbacks: string, pkg: string}>} */
259
+ export const OPEN_FONTS = Object.fromEntries(
260
+ Object.entries(OPEN_FONT_FAMILIES).map(([key, family]) => [
261
+ key,
262
+ {
263
+ family,
264
+ fallbacks: key.endsWith('-mono')
265
+ ? 'ui-monospace, monospace'
266
+ : /serif/i.test(family)
267
+ ? 'Georgia, serif'
268
+ : 'system-ui, sans-serif',
269
+ pkg: `@fontsource/${OPEN_FONT_PACKAGES[key] ?? key}`,
270
+ },
271
+ ]),
272
+ );
215
273
 
216
274
  /**
217
275
  * Brand fonts no package loads, and the closest open font, for the warning
@@ -321,7 +379,7 @@ export const DIALS = {
321
379
  CORNERS.map(
322
380
  ([n, v]) => `${n} (${v === 9999 ? 'fully round' : `${v}px`})`,
323
381
  ).join(', ') +
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.",
382
+ ", or a size like 6px. Whole theme: sets the 4 corner tokens in the base theme's proportions (containers and pages at most as round as at pill; inner corners at most as round as at round). With --on <part or group>: that part's border-radius. Corners are a size, so they are the same in light and dark.",
325
383
  values: 'square|small|medium|large|round|pill|more|less|<size like 6px>',
326
384
  examples: [
327
385
  'set my corners pill',
@@ -115,7 +115,11 @@ export type ThemeEditPreviewFields = {
115
115
  cause: string;
116
116
  } | null;
117
117
  /**
118
- * - Files of the in-app theme preview that were changed by hand, so they were not written again and still show the theme as it was.
118
+ * - Set when sheet.html (the sheet of every component, made by `show`) shows the theme as it was before this change: it says so at its top until `show` makes it again.
119
+ */
120
+ sheetStale?: string | undefined;
121
+ /**
122
+ * - Files of the in-app theme preview that were not written again and still show the theme as it was: changed by hand, or a preview folder where a stopped preview change waits for the next preview command.
119
123
  */
120
124
  previewStale?: string[] | undefined;
121
125
  };
@@ -226,6 +230,10 @@ export type ThemeEditChangeData = {
226
230
  * - In-app preview files changed by hand: see ThemeEditPreviewFields.
227
231
  */
228
232
  previewStale?: string[] | undefined;
233
+ /**
234
+ * - Set when sheet.html shows the theme as it was before this change: see ThemeEditPreviewFields.
235
+ */
236
+ sheetStale?: string | undefined;
229
237
  };
230
238
  export type ThemeEditShowOptions = {
231
239
  /**
@@ -342,6 +350,8 @@ export type ThemeEditUndoResponse = {
342
350
  undone: string[];
343
351
  settings: number;
344
352
  stepsLeft: number;
353
+ changedTokens: string[];
354
+ problems: string[];
345
355
  } & ThemeEditPreviewFields;
346
356
  };
347
357
  export type ThemeEditPreviewAddOptions = {
@@ -430,13 +440,18 @@ export type ThemeEditPreviewListOptions = {
430
440
  */
431
441
  export type ThemeEditPreviewListResponse = {
432
442
  type: "themeEdit.previewList";
443
+ /**
444
+ * - `themeMissing`: the theme the preview wears is gone, so its route does not build; `notes`: what else to know, such as the command that switches it.
445
+ */
433
446
  data: {
434
447
  folder: string | null;
435
448
  theme: string | null;
449
+ themeMissing: boolean;
436
450
  pages: Array<{
437
451
  id: string;
438
452
  label: string;
439
453
  }>;
454
+ notes: string[];
440
455
  };
441
456
  };
442
457
  /**
@@ -475,6 +490,10 @@ export type ThemeEditHowOptions = {
475
490
  * - With a PNG picture: how many main colors (default 14).
476
491
  */
477
492
  count?: number | undefined;
493
+ /**
494
+ * - The words as typed after `how`: a picture first takes only a count after it (the count is read from the words); anything else is one question. Replaces `subject`.
495
+ */
496
+ words?: string[] | undefined;
478
497
  };
479
498
  /**
480
499
  * `astryx --json experimental theme editor how <subject>`. `kind` says which answer it is.
@@ -51,7 +51,8 @@
51
51
  * @property {string[]} pictures - PNG pictures taken (only with `png`).
52
52
  * @property {string | null} pictureProblem - Why no picture was taken, and how to get a browser for it.
53
53
  * @property {{code: string, cause: string} | null} notChecked - Set when the change is saved but the components could not be rendered, so it was not checked and has no preview: the cause, such as two copies of React.
54
- * @property {string[]} [previewStale] - Files of the in-app theme preview that were changed by hand, so they were not written again and still show the theme as it was.
54
+ * @property {string} [sheetStale] - Set when sheet.html (the sheet of every component, made by `show`) shows the theme as it was before this change: it says so at its top until `show` makes it again.
55
+ * @property {string[]} [previewStale] - Files of the in-app theme preview that were not written again and still show the theme as it was: changed by hand, or a preview folder where a stopped preview change waits for the next preview command.
55
56
  */
56
57
 
57
58
  /**
@@ -95,6 +96,7 @@
95
96
  * @property {string | null} pictureProblem
96
97
  * @property {{code: string, cause: string} | null} notChecked - Saved but not checked: see ThemeEditPreviewFields.
97
98
  * @property {string[]} [previewStale] - In-app preview files changed by hand: see ThemeEditPreviewFields.
99
+ * @property {string} [sheetStale] - Set when sheet.html shows the theme as it was before this change: see ThemeEditPreviewFields.
98
100
  */
99
101
 
100
102
  /**
@@ -161,7 +163,7 @@
161
163
  * @experimental May change or be removed in a patch release.
162
164
  * @typedef {object} ThemeEditUndoResponse
163
165
  * @property {'themeEdit.undo'} type
164
- * @property {{theme: string, action: 'step', undone: string[], settings: number, stepsLeft: number} & ThemeEditPreviewFields} data
166
+ * @property {{theme: string, action: 'step', undone: string[], settings: number, stepsLeft: number, changedTokens: string[], problems: string[]} & ThemeEditPreviewFields} data
165
167
  */
166
168
 
167
169
  /**
@@ -225,7 +227,7 @@
225
227
  * @experimental May change or be removed in a patch release.
226
228
  * @typedef {object} ThemeEditPreviewListResponse
227
229
  * @property {'themeEdit.previewList'} type
228
- * @property {{folder: string | null, theme: string | null, pages: Array<{id: string, label: string}>}} data
230
+ * @property {{folder: string | null, theme: string | null, themeMissing: boolean, pages: Array<{id: string, label: string}>, notes: string[]}} data - `themeMissing`: the theme the preview wears is gone, so its route does not build; `notes`: what else to know, such as the command that switches it.
229
231
  */
230
232
 
231
233
  /**
@@ -251,6 +253,7 @@
251
253
  * @property {string} [theme] - The theme the suggested commands are for, checked against its settings (default: the only theme the editor made in the app; with several, the one an editor command changed last; with none, `my-theme`, which the answer makes first). An empty name is refused.
252
254
  * @property {string[]} [at] - With a PNG picture: pixel points x,y, whole numbers inside the picture ("40,20;300,180", "40,20 300,180", several entries, or a flat "40,20,300,180").
253
255
  * @property {number} [count] - With a PNG picture: how many main colors (default 14).
256
+ * @property {string[]} [words] - The words as typed after `how`: a picture first takes only a count after it (the count is read from the words); anything else is one question. Replaces `subject`.
254
257
  */
255
258
 
256
259
  /**
@@ -53,6 +53,12 @@ export const doc = {
53
53
  type: 'number',
54
54
  description: 'With a picture: how many main colors (default 14).',
55
55
  },
56
+ {
57
+ name: 'options.words',
58
+ type: 'string[]',
59
+ description:
60
+ 'The words as typed: a picture first takes only a count after it; anything else is one question. Replaces the subject.',
61
+ },
56
62
  {
57
63
  name: 'options.cwd',
58
64
  type: 'string',
@@ -27,7 +27,7 @@ export const doc = {
27
27
  name: 'theme',
28
28
  type: 'string',
29
29
  description:
30
- 'The theme name: lowercase letters, digits and dashes, starting with a letter, 64 characters at most.',
30
+ 'The theme name: lowercase letters, digits and dashes, starting with a letter, 64 characters at most, not a name Windows reserves (con, prn, aux, nul, com1-com9, lpt1-lpt9).',
31
31
  required: true,
32
32
  },
33
33
  {
@@ -13,7 +13,7 @@ export const doc = {
13
13
  summary:
14
14
  'Add pages to the theme preview in the app: the default pages, the best template pages for a description, or one template.',
15
15
  description:
16
- "Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description (\"a sales dashboard\") asks the same page ranking `build` uses for the template pages that fit it best (`top` of them, default 1), and adds each as a page, saying in `matched` what it picked and why (the words of the description it covers). App frames (the Shell templates) are left out, since the preview is an app shell already. When no page is exactly the one described, the closest is added and `matched` says the rest of the description is not on it; only a description no page relates to is refused, writing nothing and naming the closest pages to add with `template`, with the other options repeated. A page the app cannot show (a missing package, or StyleX without a compiler) is skipped and the next match is taken (from the ranking, then the template search), and the result says so. A page's nav label is its template's display name, however it was added; `template` names one page template instead; with neither, it adds the default pages: Overview (the theme at a glance, built to show what themes most often break: long and short text, every text level on every surface, every button variant and size with disabled and loading, inputs in their states, selected navigation, status colors, a table, open layers), Components (every component grouped, each with the command that changes it most) and, when the theme sets a color, Colors (each color's shades in light and dark, with the shade number, the hex and the tokens that use each; it reads the theme's generated colors, so it changes with every `editor set`). The route goes in theme-preview/ in the app's routes folder (app/ or src/app/), or in `path`; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no `path`, it refuses and names both ways on: `path`, or `themeEditPreviewApp`, which makes a new starter app with the preview in it. The route fills the whole window with the theme, shell and edges included. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks, or that uses StyleX in an app with no StyleX compiler, is not added: the result lists it in `skipped`, with the command that installs what it needs. A file the preview did not write is never replaced. The pages wear `theme` (default: the only theme under themes/; with none or several, the app's own theme). The pages go in _pages/ beside the route, a folder Next never serves as a route; a preview an older release wrote into pages/ is moved there. theme-preview.json records a hash of each file the preview writes: a file changed by hand since is never replaced (the refusal names it), and a page file that already holds exactly the planned text is taken over. The files are staged and renamed into place together; when a write fails, every file is put back as it was. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. The folder is refused when it is a file, in themes/ or node_modules/, in a Pages Router folder (pages/ or src/pages/), in a folder Next does not route (_private, @slot, [param]), or written with Windows separators, a leading ~ or white space at either end. With no `path` and no preview in the default place, a preview recorded for a theme is used; with several, the refusal names each. A theme the preview wore that is gone is replaced by the app's own theme, with a note; a changed theme writes the default pages again. A template page whose package the app's package.json names but nobody installed is skipped like a missing one. Only the first 40 different words of a long description go to the ranking, with a note. The project root, src/ and the routes folder itself are refused too: they hold the app. An older preview found there is named, with the remove that clears it. A recorded page whose file is gone is written again (a default page, or the template its id names), or else left out of the nav, with a note. A formatter run (white space, quotes, semicolons, commas) does not count as a change by hand. Refusals never suggest deleting files: they say what to move or rename. Preview commands in one project run one after another. Experimental: it may change or be removed in a patch release.",
16
+ "Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description (\"a sales dashboard\") asks the same page ranking `build` uses for the template pages that fit it best (`top` of them, default 1), and adds each as a page, saying in `matched` what it picked and why (the words of the description it covers). App frames (the Shell templates) are left out, since the preview is an app shell already. When no page is exactly the one described, the closest is added and `matched` says the rest of the description is not on it; only a description no page relates to is refused, writing nothing and naming the closest pages to add with `template`, with the other options repeated. A page the app cannot show (a missing package, or StyleX without a compiler) is skipped and the next match is taken (from the ranking, then the template search), and the result says so. A page's nav label is its template's display name, however it was added; `template` names one page template instead; with neither, it adds the default pages: Overview (the theme at a glance, built to show what themes most often break: long and short text, every text level on every surface, every button variant and size with disabled and loading, inputs in their states, selected navigation, status colors, a table, open layers), Components (every component grouped, each with the command that changes it most) and, when the theme sets a color, Colors (each color's shades in light and dark, with the shade number, the hex and the tokens that use each; it reads the theme's generated colors, so it changes with every `editor set`). The route goes in theme-preview/ in the app's routes folder (app/ or src/app/), or in `path`; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no `path`, it refuses and names both ways on: `path`, or `themeEditPreviewApp`, which makes a new starter app with the preview in it. The route fills the whole window with the theme, shell and edges included. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks, or that uses StyleX in an app with no StyleX compiler, is not added: the result lists it in `skipped`, with the command that installs what it needs. A file the preview did not write is never replaced. The pages wear `theme` (default: the only theme under themes/; with none or several, the app's own theme). The pages go in _pages/ beside the route, a folder Next never serves as a route; a preview an older release wrote into pages/ is moved there. theme-preview.json records a hash of each file the preview writes: a file changed by hand since is never replaced (the refusal names it), and a page file that already holds exactly the planned text is taken over. The files are staged and renamed into place together; when a write fails, every file is put back as it was. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. The folder is refused when it is a file, in themes/, node_modules/ or Next's build folder (.next/, out/ or the distDir next.config names), in a Pages Router folder (pages/ or src/pages/), in a folder Next does not route (_private, @slot, [param]), or written with Windows separators, a leading ~ or white space at either end. With no `path` and no preview in the default place, a preview recorded for a theme is used; with several, the refusal names each. A theme the preview wore that is gone is replaced by the app's own theme, with a note; a changed theme writes the default pages again. A template page whose package the app's package.json names but nobody installed is skipped like a missing one. Only the first 40 different words of a long description go to the ranking, with a note. The project root, src/ and the routes folder itself are refused too: they hold the app. An older preview found there is named, with the remove that clears it. A recorded page whose file is gone is written again (a default page, or the template its id names), or else left out of the nav, with a note. A formatter run (white space, quotes, semicolons, commas) does not count as a change by hand. Refusals never suggest deleting files: they say what to move or rename. Preview commands in one project run one after another. The folder is also refused when it holds a package.json, when another page or route handler of the app already serves its URL (in the folder itself, a route group or the Pages Router), when next.config sets pageExtensions without tsx, when it is in src/app/ while app/ is what Next serves, and when no root layout is above it (an app with its root layout in [locale]/ gets its preview there, opened at /<locale>/theme-preview; an app with a root layout in each route group takes the preview under any of them). A template's needs come from its real import statements, never words in comments or strings; a package the app does not name gets the command that adds it. A theme with no build is built only after every check passed, holding that theme's lock, with a note. An edit inside a string counts as a change by hand; a formatter run does not. Experimental: it may change or be removed in a patch release.",
17
17
  importPath: '@astryxdesign/cli/api/experimental',
18
18
  signature:
19
19
  'themeEditPreviewAdd(description?: string, options?: object): Promise<object>',
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'themeEditPreviewApp()',
13
13
  summary: 'Make a new starter app with the theme preview inside.',
14
14
  description:
15
- "Writes a new starter app into `dir` (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With `theme`, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: the result says how to install, run and open it. `dir` must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/ or node_modules/, or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. Experimental: it may change or be removed in a patch release.",
15
+ "Writes a new starter app into `dir` (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With `theme`, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: the result says how to install, run and open it. `dir` must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/, node_modules/ or Next's build folder (.next/, out/ or the distDir next.config names), or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. An app is refused in public/ (served as files at the site root) and under a name Windows does not allow; a base theme passed to --theme is named as a package theme, installed or not, with the command that adds it. Experimental: it may change or be removed in a patch release.",
16
16
  importPath: '@astryxdesign/cli/api/experimental',
17
17
  signature:
18
18
  'themeEditPreviewApp(dir: string, options?: object): Promise<object>',
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'themeEditPreviewList()',
13
13
  summary: 'The pages of the theme preview in the app.',
14
14
  description:
15
- 'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder (app/ or src/app/) for one, the list is empty. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is listed; with several, the refusal names each. Experimental: it may change or be removed in a patch release.',
15
+ 'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder (app/ or src/app/) for one, the list is empty. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is listed; with several, the refusal names each. When the theme the preview wears is gone, `themeMissing` is true and `notes` names the command that switches it. Experimental: it may change or be removed in a patch release.',
16
16
  importPath: '@astryxdesign/cli/api/experimental',
17
17
  signature: 'themeEditPreviewList(options?: object): Promise<object>',
18
18
  keywords: ['theme', 'experimental theme', 'preview', 'theme preview'],
@@ -34,7 +34,7 @@ export const doc = {
34
34
  {
35
35
  type: 'themeEdit.previewList',
36
36
  description:
37
- 'The route folder (null with no preview), the theme, and the pages.',
37
+ 'The route folder (null with no preview), the theme, whether that theme is gone (`themeMissing`), the pages and notes.',
38
38
  },
39
39
  ],
40
40
  throws: [
@@ -12,7 +12,7 @@ export const doc = {
12
12
  displayName: 'themeEditPreviewRemove()',
13
13
  summary: 'Remove one page from the theme preview, or the whole preview.',
14
14
  description:
15
- 'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. Experimental: it may change or be removed in a patch release.',
15
+ 'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. A remove deletes only the route file, the record and the page files of recorded pages (in _pages/, or pages/ for an older release), and only when a recorded hash shows they are as the preview wrote them: any other file the record names, and any file with no recorded hash, is kept and named, so a copied or edited record never deletes a project file. A route that stays keeps the pages it imports. Experimental: it may change or be removed in a patch release.',
16
16
  importPath: '@astryxdesign/cli/api/experimental',
17
17
  signature:
18
18
  'themeEditPreviewRemove(page?: string, options?: object): Promise<object>',
@@ -76,6 +76,10 @@ export const doc = {
76
76
  code: 'ERR_THEME_LOAD',
77
77
  when: 'the theme the route wears has no build and does not build; nothing is deleted',
78
78
  },
79
+ {
80
+ code: 'ERR_INVALID_ARGUMENT',
81
+ when: 'a second page or another extra argument on the command line',
82
+ },
79
83
  {
80
84
  code: 'ERR_PROJECT_REQUIRED',
81
85
  when: 'no package.json in the folder or above it',
@@ -13,7 +13,7 @@ export const doc = {
13
13
  summary:
14
14
  'Change one thing in a theme: checked against what the components read, built, previewed.',
15
15
  description:
16
- "Changes one thing. The thing is a dial (corners, spacing, accent, neutral, success, warning, danger, info, vibrancy, font, headings, surfaces, buttons, type, text-size, base, mode: big moves with named rungs; `more`/`less` step a rung), a design token by name (--color-background-body; `how --list tokens`), or a CSS property on a part (background --on card; needs --on). Every change is CHECKED first against the installed Core: the part, the --when variant and value, the --state, the token's type (color, size, number, font, shadow; only colors may differ by mode; a shadow is one value for both), and whether the part, or a part inside it, actually reads the token for what you mean. A change that cannot take effect is REFUSED: exit 1, an error code, nothing written, and the suggestions lead with the command that works (the token the part really reads, or the property that sets it directly). Groups: --on <group> (inputs, checks, containers, menus) styles every member; styling one member of an always-alike group (inputs, checks) styles the whole group unless --only. A setting on a part beats a whole-theme dial, and a dial never overwrites one. After building, a plain part setting that a more specific base-theme rule would beat (such as a heading level) is repeated on those variant keys, and the result says so. The result lists resolved token changes, part styles written, contrast problems this theme caused versus its base (text below 4.5:1), notes (the shade a color's main token uses, any shade moved so text reads, and the generated color files; font loading: the exact install line when the font package is missing), and writes themes/<theme>/preview.html. Values with spaces go in quotes: gradients, several shadows, font stacks. Dials: corners square|small|medium|large|round|pill|more|less|<size>; spacing tight|compact|medium|roomy|spacious|more|less; accent, neutral, success, warning, danger, info <color> (a color: the editor generates its light and dark shades from the one color, with the same generator as `theme palette generate`, and points the color tokens at them; a token moves to a nearby shade when it must read: text at 4.5:1, the focus ring at 3:1; the whole theme only, no --on or --mode; `how colors` explains it and the Colors preview page shows every shade); vibrancy 0-100|more|less (how saturated the generated colors are; 50 is the default; needs a color); font <preset, open font, family or stack>; headings light|regular|medium|semibold|bold|heavy or tight|tighter|normal|wide; surfaces flat|outlined|raised|glass; buttons solid|outline|soft|caps; type compact|standard|editorial|display; text-size small|medium|large|larger|more|less|<number of pixels, 10 to 32>; base <built-in theme>|none; mode both|light-only|dark-only. `astryx experimental theme editor how --list dials` explains each. An exact token always wins over the generated colors: `set <theme> --color-accent <color>` (with --on or --mode if you need them) is the escape hatch, whatever order the settings were made in. Experimental: it may change or be removed in a patch release.",
16
+ "Changes one thing. The thing is a dial (corners, spacing, accent, neutral, success, warning, danger, info, vibrancy, font, headings, surfaces, buttons, type, text-size, base, mode: big moves with named rungs; `more`/`less` step a rung), a design token by name (--color-background-body; `how --list tokens`), or a CSS property on a part (background --on card; needs --on). Every change is CHECKED first against the installed Core: the part, the --when variant and value, the --state, the token's type (color, size, number, font, shadow; only colors may differ by mode; a shadow is one value for both), and whether the part, or a part inside it, actually reads the token for what you mean. A change that cannot take effect is REFUSED: exit 1, an error code, nothing written, and the suggestions lead with the command that works (the token the part really reads, or the property that sets it directly). Groups: --on <group> (inputs, checks, containers, menus) styles every member; styling one member of an always-alike group (inputs, checks) styles the whole group unless --only. A setting on a part beats a whole-theme dial, and a dial never overwrites one. After building, a plain part setting that a more specific base-theme rule would beat (such as a heading level) is repeated on those variant keys, and the result says so. The result lists resolved token changes, part styles written, contrast problems this theme caused versus its base (text below 4.5:1), notes (the shade a color's main token uses, any shade moved so text reads, and the generated color files; font loading: the exact install line when the font package is missing), and writes themes/<theme>/preview.html; when sheet.html (made by `show`) now shows the theme as it was, it says so at its top and the result's sheetStale says so. Values with spaces go in quotes: gradients, several shadows, font stacks. Dials: corners square|small|medium|large|round|pill|more|less|<size>; spacing tight|compact|medium|roomy|spacious|more|less; accent, neutral, success, warning, danger, info <color> (a color: the editor generates its light and dark shades from the one color, with the same generator as `theme palette generate`, and points the color tokens at them; a token moves to a nearby shade when it must read: text at 4.5:1, the focus ring at 3:1; the whole theme only, no --on or --mode; `how colors` explains it and the Colors preview page shows every shade); vibrancy 0-100|more|less (how saturated the generated colors are; 50 is the default; needs a color); font <preset, open font, family or stack>; headings light|regular|medium|semibold|bold|heavy or tight|tighter|normal|wide; surfaces flat|outlined|raised|glass; buttons solid|outline|soft|caps; type compact|standard|editorial|display; text-size small|medium|large|larger|more|less|<number of pixels, 10 to 32>; base <built-in theme>|none; mode both|light-only|dark-only. `astryx experimental theme editor how --list dials` explains each. An exact token always wins over the generated colors: `set <theme> --color-accent <color>` (with --on or --mode if you need them) is the escape hatch, whatever order the settings were made in. Experimental: it may change or be removed in a patch release.",
17
17
  importPath: '@astryxdesign/cli/api/experimental',
18
18
  signature:
19
19
  'themeEditSet(theme: string, thing: string, value: string, options?: object): Promise<object>',
@@ -13,7 +13,7 @@ export const doc = {
13
13
  summary:
14
14
  'Put the theme back as it was before its last change, or remove one setting.',
15
15
  description:
16
- 'With only the theme, it steps back one change: the settings file, the theme source and the build go back to how they were before the last change, and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With `thing`, it removes that one setting instead, wherever it is in the settings, and the `now` field of the result says what applies instead (a dial that still writes it, a whole-theme setting of the same thing, or the value of the base theme); name it the way it was set, with the same `on`, `when`, `state`, `mode` and `only`. Removing a color (accent, neutral, success, warning, danger, info) stops generating it, and the tokens it fed go back to the base theme; with no color left, the generated color files the editor wrote are deleted; a palette.config.json you made, or one that holds a color of your own, stays. Removing vibrancy makes the colors again at the default, 50; removing the last color removes vibrancy too, as it needs a color. The history keeps the last 80 steps (in <theme>.history.json); older steps are dropped. Experimental: it may change or be removed in a patch release.',
16
+ 'With only the theme, it steps back one change: the settings, the generated settings module and the build go back to how they were before the last change (your <theme>.theme.ts is not touched), and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With `thing`, it removes that one setting instead, wherever it is in the settings, and the `now` field of the result says what applies instead (a dial that still writes it, a whole-theme setting of the same thing, or the value of the base theme); name it the way it was set, with the same `on`, `when`, `state`, `mode` and `only`. Removing a color (accent, neutral, success, warning, danger, info) stops generating it, and the tokens it fed go back to the base theme; with no color left, the generated color files the editor wrote are deleted; a palette.config.json you made, or one that holds a color of your own, stays. Removing vibrancy makes the colors again at the default, 50; removing the last color removes vibrancy too, as it needs a color. `undo <theme> base` and `undo <theme> mode` go back to the base and mode the theme was made with; when they never changed, that is refused. The history keeps the last 80 steps (in <theme>.history.json); older steps are dropped. Each step also restores the corner radii it was built with. Like `set`, sheetStale in the result says when sheet.html shows the theme as it was. Experimental: it may change or be removed in a patch release.',
17
17
  importPath: '@astryxdesign/cli/api/experimental',
18
18
  signature: 'themeEditUndo(theme: string, options?: object): Promise<object>',
19
19
  keywords: [
@@ -249,6 +249,7 @@ export function runCoreCodemods(versionManifests: CoreVersionManifest[], { apply
249
249
  description?: string;
250
250
  fileExtensions?: string[];
251
251
  codemodType?: string;
252
+ mentions?: string[];
252
253
  };
253
254
  version: string;
254
255
  }>;