@astryxdesign/cli 0.7.15 → 0.7.16-canary.g3aa244b

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 (163) hide show
  1. package/README.md +5 -3
  2. package/api/build/_adapter.d.mts +1 -0
  3. package/api/build/blocks/blocks.d.mts +1 -0
  4. package/api/build/blocks/blocks.mjs +18 -1
  5. package/api/component/_adapter.d.mts +1 -1
  6. package/api/component/_adapter.mjs +28 -1
  7. package/api/doctor/_adapter.d.mts +35 -0
  8. package/api/doctor/_adapter.mjs +69 -0
  9. package/api/doctor/built-checks.mjs +1 -1
  10. package/api/doctor/doctor.d.mts +18 -0
  11. package/api/doctor/doctor.doc.mjs +1 -1
  12. package/api/doctor/doctor.mjs +104 -4
  13. package/api/doctor/theme-checks.mjs +6 -10
  14. package/api/integration/add-contribution.mjs +3 -3
  15. package/api/integration/pack-check.mjs +14 -8
  16. package/api/integration/validate-integration.mjs +1 -1
  17. package/api/search/_adapter.mjs +15 -16
  18. package/api/search/_entries.d.mts +2 -1
  19. package/api/search/_entries.mjs +28 -1
  20. package/api/swizzle/_moduleGraph.mjs +1 -1
  21. package/api/theme/_adapter.d.mts +5 -2
  22. package/api/theme/_adapter.mjs +43 -12
  23. package/api/theme/_fork.mjs +1 -1
  24. package/api/theme/build/build.d.mts +116 -32
  25. package/api/theme/build/build.mjs +449 -102
  26. package/api/theme/eject/eject.mjs +22 -1
  27. package/api/theme/template/template.d.mts +19 -0
  28. package/api/theme/template/template.mjs +102 -25
  29. package/api/theme/theme.type.d.mts +5 -1
  30. package/api/theme/theme.type.mjs +2 -1
  31. package/api/theme/themeBuild.doc.mjs +3 -3
  32. package/api/theme/themeEject.doc.mjs +1 -1
  33. package/api/theme/themeTemplate.doc.mjs +9 -3
  34. package/api/theme-edit/_adapter.d.mts +32 -2
  35. package/api/theme-edit/_adapter.mjs +264 -40
  36. package/api/theme-edit/_check.d.mts +93 -4
  37. package/api/theme-edit/_check.mjs +1727 -223
  38. package/api/theme-edit/_color.d.mts +2 -8
  39. package/api/theme-edit/_color.mjs +292 -219
  40. package/api/theme-edit/_compiler.d.mts +1 -0
  41. package/api/theme-edit/_compiler.mjs +20 -1
  42. package/api/theme-edit/_context.d.mts +31 -1
  43. package/api/theme-edit/_context.mjs +445 -41
  44. package/api/theme-edit/_css.d.mts +60 -1
  45. package/api/theme-edit/_css.mjs +404 -28
  46. package/api/theme-edit/_edit.d.mts +25 -0
  47. package/api/theme-edit/_edit.mjs +1532 -149
  48. package/api/theme-edit/_how-commands.d.mts +11 -26
  49. package/api/theme-edit/_how-commands.mjs +30 -2
  50. package/api/theme-edit/_how-question.d.mts +7 -0
  51. package/api/theme-edit/_how-question.mjs +1304 -176
  52. package/api/theme-edit/_how.mjs +144 -30
  53. package/api/theme-edit/_overview.mjs +2 -0
  54. package/api/theme-edit/_palette.d.mts +38 -0
  55. package/api/theme-edit/_palette.mjs +305 -71
  56. package/api/theme-edit/_parts.d.mts +33 -0
  57. package/api/theme-edit/_parts.mjs +138 -9
  58. package/api/theme-edit/_png.d.mts +18 -0
  59. package/api/theme-edit/_png.mjs +95 -14
  60. package/api/theme-edit/_preview-app.d.mts +36 -1
  61. package/api/theme-edit/_preview-app.mjs +1415 -96
  62. package/api/theme-edit/_preview.d.mts +64 -3
  63. package/api/theme-edit/_preview.mjs +514 -31
  64. package/api/theme-edit/_project.d.mts +11 -0
  65. package/api/theme-edit/_project.mjs +46 -12
  66. package/api/theme-edit/_settings.d.mts +278 -5
  67. package/api/theme-edit/_settings.mjs +2741 -195
  68. package/api/theme-edit/_tables.d.mts +24 -0
  69. package/api/theme-edit/_tables.mjs +211 -149
  70. package/api/theme-edit/_vet.d.mts +42 -0
  71. package/api/theme-edit/_vet.mjs +144 -0
  72. package/api/theme-edit/theme-edit.type.d.mts +20 -2
  73. package/api/theme-edit/theme-edit.type.mjs +6 -2
  74. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  75. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  76. package/api/theme-edit/themeEditShow.doc.mjs +11 -3
  77. package/api/upgrade/registry/registry.mjs +6 -1
  78. package/assets/codemods/parse.mjs +2 -2
  79. package/assets/docs/tree/single-component.doc.mjs +11 -2
  80. package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
  81. package/assets/docs.generated.json +2 -2
  82. package/assets/preview-app/next.config.mjs +7 -1
  83. package/assets/preview-app/package.json +1 -0
  84. package/assets/preview-app/src/app/globals.css +1 -0
  85. package/assets/self-audit.generated.json +1 -1
  86. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.doc.mjs +14 -0
  87. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx +53 -0
  88. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.doc.mjs +14 -0
  89. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.tsx +33 -0
  90. package/assets/templates/components.generated.json +1 -1
  91. package/assets/templates/pages/dashboard/page.tsx +1 -1
  92. package/authoring/doctypes/_schema.d.mts +52 -5
  93. package/authoring/doctypes/_schema.mjs +62 -7
  94. package/authoring/doctypes/base/type.ts +10 -0
  95. package/authoring/doctypes/component/component.doc.mjs +1 -1
  96. package/authoring/doctypes/function/function.doc.mjs +6 -0
  97. package/authoring/doctypes/function/type.ts +3 -0
  98. package/authoring/doctypes/legacy.mjs +5 -1
  99. package/authoring/index.d.ts +1 -0
  100. package/authoring/shadcn/source-variants.d.mts +1 -1
  101. package/authoring/shadcn/source-variants.mjs +32 -10
  102. package/clients/cli/build-id.generated.json +1 -1
  103. package/clients/cli/commands/doctor.doc.mjs +2 -2
  104. package/clients/cli/commands/experimental/theme.mjs +239 -45
  105. package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
  106. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
  107. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +2 -2
  108. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +3 -3
  109. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  110. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  111. package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -1
  112. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
  113. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  114. package/clients/cli/commands/experimental-theme-template.doc.mjs +2 -2
  115. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  116. package/clients/cli/commands/theme-eject.doc.mjs +1 -1
  117. package/clients/cli/commands/theme-template.doc.mjs +3 -1
  118. package/clients/cli/commands/theme.mjs +190 -46
  119. package/clients/cli/formatters/index.mjs +7 -4
  120. package/clients/cli/lib/cli-error.mjs +9 -3
  121. package/clients/cli/lib/component-format.mjs +27 -9
  122. package/clients/cli/lib/json-shim.mjs +72 -2
  123. package/clients/cli/manifest.generated.json +1 -1
  124. package/clients/cli/run.mjs +49 -0
  125. package/foundation/agent-docs/agent-docs-target.d.mts +2 -6
  126. package/foundation/agent-docs/agent-docs-target.mjs +9 -17
  127. package/foundation/agent-docs/agent-docs.mjs +3 -2
  128. package/foundation/config/config-writer.mjs +2 -2
  129. package/foundation/config/project.mjs +60 -14
  130. package/foundation/discovery/component-discovery.mjs +5 -17
  131. package/foundation/discovery/icon-set-writer.mjs +1 -1
  132. package/foundation/discovery/module-exports.mjs +1 -15
  133. package/foundation/discovery/template-adapter.mjs +44 -19
  134. package/foundation/discovery/template-source-tree.mjs +3 -16
  135. package/foundation/discovery/theme-discovery.d.mts +5 -1
  136. package/foundation/discovery/theme-discovery.mjs +61 -43
  137. package/foundation/fs/exact-codec.d.mts +35 -0
  138. package/foundation/fs/exact-codec.mjs +148 -0
  139. package/foundation/fs/gather-cache.d.mts +15 -5
  140. package/foundation/fs/gather-cache.mjs +129 -31
  141. package/foundation/fs/paths.d.mts +39 -0
  142. package/foundation/fs/paths.mjs +44 -11
  143. package/foundation/fs/read-record.mjs +11 -1
  144. package/foundation/integrations/contribution-fixes.mjs +1 -16
  145. package/foundation/integrations/may-have-integrations.mjs +3 -2
  146. package/foundation/integrations/public-imports.mjs +1 -1
  147. package/foundation/render/embedded-imports.mjs +1 -1
  148. package/foundation/render/host-exit.d.mts +8 -0
  149. package/foundation/render/host-exit.mjs +11 -0
  150. package/foundation/render/page-host.mjs +56 -10
  151. package/foundation/render/page-worker.mjs +14 -0
  152. package/foundation/render/render-page.mjs +37 -2
  153. package/foundation/response/error-codes.d.mts +2 -1
  154. package/foundation/response/error-codes.d.ts +1 -0
  155. package/foundation/response/error-codes.doc.mjs +5 -0
  156. package/foundation/response/error-codes.mjs +3 -0
  157. package/foundation/response/json.d.mts +15 -0
  158. package/foundation/response/json.mjs +52 -1
  159. package/foundation/response/response-types.doc.mjs +1 -1
  160. package/foundation/runtime/lazy-dependencies.d.mts +14 -0
  161. package/foundation/runtime/lazy-dependencies.mjs +82 -0
  162. package/foundation/xle/browser.d.mts +2 -2
  163. package/package.json +7 -6
@@ -32,6 +32,16 @@ export function openProject(cwd: string): Promise<ThemeProject>;
32
32
  * @returns {string | null}
33
33
  */
34
34
  export function importPathOf(project: ThemeProject, name: string): string | null;
35
+ /**
36
+ * The built module of a base's theme package, resolved the way the theme
37
+ * resolves it: from the project (an open project, or its folder, relative
38
+ * or not). Null when it is not installed there. The one base resolution:
39
+ * `new`, `set base`, `how` and every suggestion ask this.
40
+ * @param {ThemeProject | string} from
41
+ * @param {string} like
42
+ * @returns {string | null}
43
+ */
44
+ export function baseModule(from: ThemeProject | string, like: string): string | null;
35
45
  /**
36
46
  * The built-in theme package for a base, or a refusal naming its install line.
37
47
  * @param {ThemeProject} project
@@ -51,6 +61,7 @@ export function baseResolved(project: ThemeProject, like: string | undefined): P
51
61
  components: Record<string, any>;
52
62
  }>;
53
63
  export function literals(type: string): string[];
64
+ export function baseInstalled(from: ThemeProject | string, like: string): boolean;
54
65
  export type ThemeProject = {
55
66
  cwd: string;
56
67
  /**
@@ -22,6 +22,10 @@ import {collectThemingTargets} from '../../foundation/discovery/theming-targets.
22
22
  import {resolveImportPath} from '../../foundation/discovery/component-discovery.mjs';
23
23
  import {detectPackageManager} from '../../foundation/env/package-manager.mjs';
24
24
  import {findProjectCoreDir} from '../../foundation/fs/paths.mjs';
25
+ import {
26
+ oncePerListing,
27
+ withListingCache,
28
+ } from '../../foundation/fs/listing-cache.mjs';
25
29
 
26
30
  /**
27
31
  * @typedef {object} ThemeProject
@@ -278,11 +282,13 @@ export async function openProject(cwd) {
278
282
  // Not cached yet.
279
283
  }
280
284
  if (!docs) {
281
- docs = {
285
+ // Each component's import path walks Core's source tree. One listing
286
+ // cache reads each folder once for all of them.
287
+ docs = await withListingCache(async () => ({
282
288
  version: DOCS_VERSION,
283
289
  targets: await collectThemingTargets(path.join(coreDir, 'src')),
284
290
  components: await readComponents(coreDir),
285
- };
291
+ }));
286
292
  try {
287
293
  fs.mkdirSync(cacheDir, {recursive: true});
288
294
  fs.writeFileSync(docsFile, JSON.stringify(docs));
@@ -317,10 +323,40 @@ export async function openProject(cwd) {
317
323
  export function importPathOf(project, name) {
318
324
  const spec =
319
325
  project.components[name]?.importPath ??
320
- resolveImportPath(project.coreDir, name);
326
+ oncePerListing(`importPath ${project.coreDir} ${name}`, () =>
327
+ resolveImportPath(project.coreDir, name),
328
+ );
321
329
  return spec && spec !== '@astryxdesign/core' ? spec : null;
322
330
  }
323
331
 
332
+ /**
333
+ * The built module of a base's theme package, resolved the way the theme
334
+ * resolves it: from the project (an open project, or its folder, relative
335
+ * or not). Null when it is not installed there. The one base resolution:
336
+ * `new`, `set base`, `how` and every suggestion ask this.
337
+ * @param {ThemeProject | string} from
338
+ * @param {string} like
339
+ * @returns {string | null}
340
+ */
341
+ export function baseModule(from, like) {
342
+ const req =
343
+ typeof from === 'string'
344
+ ? createRequire(path.join(path.resolve(from), 'noop.js'))
345
+ : from.req;
346
+ try {
347
+ return req.resolve(`@astryxdesign/theme-${like}/built`);
348
+ } catch {
349
+ return null;
350
+ }
351
+ }
352
+
353
+ /**
354
+ * Whether a base's theme package is installed in the project.
355
+ * @param {ThemeProject | string} from
356
+ * @param {string} like
357
+ */
358
+ export const baseInstalled = (from, like) => baseModule(from, like) != null;
359
+
324
360
  /**
325
361
  * The built-in theme package for a base, or a refusal naming its install line.
326
362
  * @param {ThemeProject} project
@@ -329,15 +365,13 @@ export function importPathOf(project, name) {
329
365
  */
330
366
  export function baseThemeFile(project, like) {
331
367
  const pkg = `@astryxdesign/theme-${like}`;
332
- try {
333
- return project.req.resolve(`${pkg}/built`);
334
- } catch {
335
- throw new AstryxError(
336
- `The ${like} theme is not installed, so a theme cannot build on it. Install ${pkg}, or build on no theme. Nothing was changed.`,
337
- [{name: installLine(project.cwd, [pkg]), reason: 'install it'}],
338
- ERROR_CODES.ERR_UNKNOWN_THEME,
339
- );
340
- }
368
+ const file = baseModule(project, like);
369
+ if (file) return file;
370
+ throw new AstryxError(
371
+ `The ${like} theme is not installed, so a theme cannot build on it. Install ${pkg}, or build on no theme. Nothing was changed.`,
372
+ [{name: installLine(project.cwd, [pkg]), reason: 'install it'}],
373
+ ERROR_CODES.ERR_UNKNOWN_THEME,
374
+ );
341
375
  }
342
376
 
343
377
  /**
@@ -18,8 +18,87 @@ export function themeFiles(cwd: string, slug: string): {
18
18
  preview: string;
19
19
  sheet: string;
20
20
  previewPng: string;
21
+ pictures: string;
21
22
  sheetPng: string;
22
23
  };
24
+ /**
25
+ * Whether `dir` holds nothing of anyone's: absent, empty, or only system
26
+ * files (what `git rm -r` or a branch switch leaves). A path that is not a
27
+ * folder, or one that does not read, is not empty.
28
+ * @param {string} dir
29
+ */
30
+ export function folderIsEmpty(dir: string): boolean;
31
+ /**
32
+ * Whether a value fits what a dial takes, read from the dial's own list of
33
+ * values: a named rung in any case, or a value of the kind it names (a size,
34
+ * a color, a number). `set` still checks the value in full.
35
+ * @param {string} dial
36
+ * @param {string} value
37
+ */
38
+ export function dialValueFits(dial: string, value: string): boolean;
39
+ /**
40
+ * Record files the editor just wrote into a theme folder.
41
+ * @param {string} cwd
42
+ * @param {string} slug
43
+ * @param {string[]} files
44
+ */
45
+ export function recordWritten(cwd: string, slug: string, files: string[]): void;
46
+ /**
47
+ * Whether the editor wrote this file in the theme folder and it is
48
+ * unchanged since.
49
+ * @param {string} cwd
50
+ * @param {string} slug
51
+ * @param {string} file
52
+ */
53
+ export function editorWrote(cwd: string, slug: string, file: string): boolean;
54
+ /**
55
+ * Adopt a picture an older editor took (before it recorded or stamped its
56
+ * pictures) into the record: only while the theme has no record at all, the
57
+ * name is one the editor writes, and the picture is the editor's 1280-pixel
58
+ * wide window. Returns whether it was adopted.
59
+ * @param {string} cwd
60
+ * @param {string} slug
61
+ * @param {string} file
62
+ */
63
+ export function adoptOlderPicture(cwd: string, slug: string, file: string): boolean;
64
+ /**
65
+ * A name `new` takes, for a suggestion: `name` itself when it is valid, not a
66
+ * built-in theme and its folder is free; `my-<name>` for a built-in theme's
67
+ * name; else the first free numbered name.
68
+ * @param {string} cwd
69
+ * @param {string} name
70
+ */
71
+ export function usableNewName(cwd: string, name: string): string;
72
+ /**
73
+ * A theme name near `name` that is valid and whose folder is free: `name-2`,
74
+ * `name-3`, …, shortened to fit the name's length limit.
75
+ * @param {string} cwd
76
+ * @param {string} name
77
+ */
78
+ export function freeThemeName(cwd: string, name: string): string;
79
+ /**
80
+ * Why the editor cannot read one of its files, or null when it can (or the
81
+ * file is not there): a folder in the file's place, or no permission to read
82
+ * it. Bad content is a different problem, judged where the file is parsed.
83
+ * @param {string} file
84
+ * @returns {string | null}
85
+ */
86
+ export function unreadableReason(file: string): string | null;
87
+ /**
88
+ * Refuse, by name, when a file of the theme is a folder or cannot be read:
89
+ * every command reads them, and none should crash on one. The fix is to
90
+ * look at the file and give it back its place; a file is never deleted.
91
+ * @param {string} cwd
92
+ * @param {string} slug
93
+ */
94
+ export function refuseUnreadableFiles(cwd: string, slug: string): void;
95
+ /**
96
+ * Refuse when the app's themes/ is a file or a link to something other
97
+ * than a folder: every editor theme lives in themes/<name>/. The run lists
98
+ * what is there; the message says to rename or move it.
99
+ * @param {string} cwd
100
+ */
101
+ export function refuseThemesNotFolder(cwd: string): void;
23
102
  /**
24
103
  * The themes the editor made in the app (a settings file of its own), by
25
104
  * name, or with `changed` the one an editor command changed last first: the
@@ -51,6 +130,14 @@ export function refuse(code: string, message: string, extra?: {
51
130
  fix?: string;
52
131
  also?: string[];
53
132
  }): never;
133
+ /**
134
+ * A theme name as typed, read the way the editor reads it: a path to its
135
+ * folder or a file in it (t.theme.ts, Brand.settings.json), in any case,
136
+ * names the theme. The result may still need slugFor.
137
+ * @param {unknown} s
138
+ * @returns {string}
139
+ */
140
+ export function typedThemeName(s: unknown): string;
54
141
  /**
55
142
  * The settings of a theme, or a refusal naming the command that makes it.
56
143
  * @param {string} cwd
@@ -106,6 +193,66 @@ export function withoutBadValues(data: ThemeData): {
106
193
  * @returns {string | null}
107
194
  */
108
195
  export function valueProblem(s: any): string | null;
196
+ /**
197
+ * The tokens a base theme's own component rules for a part read through
198
+ * var() (neutral's progress-bar reads --color-border-emphasized), from its
199
+ * built module; an empty set when it is not installed.
200
+ * @param {string} cwd
201
+ * @param {string | null | undefined} like
202
+ * @param {string} target
203
+ * @returns {Set<string>}
204
+ */
205
+ export function baseComponentReads(cwd: string, like: string | null | undefined, target: string): Set<string>;
206
+ /**
207
+ * The top-level tokens a base theme's built module gives (what the
208
+ * editor's settings extend), or an empty map when it is not installed.
209
+ * @param {string} cwd
210
+ * @param {string | null | undefined} like
211
+ * @returns {Map<string, string | null>}
212
+ */
213
+ export function baseTopTokens(cwd: string, like: string | null | undefined): Map<string, string | null>;
214
+ /**
215
+ * What a part's plain rule (its `base` block) holds in the theme as built
216
+ * (the base theme's, the settings' and the own source's together), else in
217
+ * the base theme alone when there is no build: tokens and properties by
218
+ * name. Kebab-case property names, as the editor names them.
219
+ * @param {string} cwd
220
+ * @param {string} slug
221
+ * @param {string | null | undefined} like
222
+ * @param {string} part
223
+ * @returns {Map<string, string | null>}
224
+ */
225
+ export function partRuleTokens(cwd: string, slug: string, like: string | null | undefined, part: string): Map<string, string | null>;
226
+ /**
227
+ * The tokens and properties a theme's own source sets on a part's plain
228
+ * rule, read from the build as ownTokens reads page-wide ones: what the
229
+ * built rule holds that the settings module and the base theme do not give
230
+ * as they are, and that the person's files name.
231
+ * @param {string} cwd
232
+ * @param {string} slug
233
+ * @param {string} part
234
+ * @param {string} [scope] the rule: `base` (the plain one), or a variant
235
+ * such as `variant:primary`
236
+ * @param {string | null} [state] a state block inside that rule (`:hover`)
237
+ * @returns {Map<string, string | null>}
238
+ */
239
+ export function ownPartTokens(cwd: string, slug: string, part: string, scope?: string, state?: string | null): Map<string, string | null>;
240
+ /**
241
+ * The page-wide tokens a theme's own source sets itself (see ownTokens):
242
+ * they win over the settings it extends.
243
+ * @param {string} cwd
244
+ * @param {string} slug
245
+ * @returns {string[]}
246
+ */
247
+ export function ownSourceTokens(cwd: string, slug: string): string[];
248
+ /**
249
+ * The values a theme's own source gives page-wide tokens as plain text, by
250
+ * token (see ownTokens).
251
+ * @param {string} cwd
252
+ * @param {string} slug
253
+ * @returns {Record<string, string>}
254
+ */
255
+ export function ownSourceTokenValues(cwd: string, slug: string): Record<string, string>;
109
256
  /** One line for a setting. @param {Setting} s */
110
257
  export function describe(s: Setting): string;
111
258
  /**
@@ -134,6 +281,14 @@ export function fontOf(value: string): {
134
281
  fallbacks: string;
135
282
  pkg: string | null;
136
283
  };
284
+ /**
285
+ * Spacing in a font family name as CSS reads a bare name: every Unicode
286
+ * space (a no-break space, a thin space, a tab) is one space, a run of them
287
+ * one, and zero-width and format characters (zero-width space, joiners,
288
+ * word joiner, byte-order mark) are dropped.
289
+ * @param {string} v
290
+ */
291
+ export function familySpaces(v: string): string;
137
292
  /**
138
293
  * A font family name as CSS reads it. A name that is a sequence of CSS
139
294
  * identifiers stays bare; any other is quoted, or the browser drops the
@@ -144,6 +299,21 @@ export function fontOf(value: string): {
144
299
  * @param {boolean} [spaced]
145
300
  */
146
301
  export function cssFamily(name: string, spaced?: boolean): string;
302
+ /**
303
+ * The staleness reason for an own source changed since the editor's build.
304
+ * @param {string} slug
305
+ */
306
+ export function sourceChangedReason(slug: string): string;
307
+ /**
308
+ * Record in an editor theme's generated settings that they were built with
309
+ * its own source as it is now, after `compile` built that source (the
310
+ * settings do not depend on what the source sets), only in a module as the
311
+ * editor wrote it.
312
+ * @param {string} cwd
313
+ * @param {string} slug
314
+ * @returns {boolean} whether it was recorded
315
+ */
316
+ export function refreshSourceStamp(cwd: string, slug: string): boolean;
147
317
  /**
148
318
  * Whether a generated module is as the editor wrote it: true, false for a
149
319
  * hand edit, null for a module with no hash (an earlier editor's).
@@ -178,9 +348,10 @@ export function compileTheme(ctx: Ctx, data: ThemeData, base: {
178
348
  * Settings whose effect a later or stronger setting hides, with why: `type`
179
349
  * loses heading weight and tracking to `headings`.
180
350
  * @param {ThemeData} data
351
+ * @param {Ctx | null} [ctx] with it, a later setting that reaches the parts through a spread counts too
181
352
  * @returns {Map<Setting, string>}
182
353
  */
183
- export function maskedSettings(data: ThemeData): Map<Setting, string>;
354
+ export function maskedSettings(data: ThemeData, ctx?: Ctx | null): Map<Setting, string>;
184
355
  /**
185
356
  * A plain part setting can lose to a more specific rule for the same part
186
357
  * and property, such as a base theme's `.astryx-heading[data-level="1"]
@@ -204,6 +375,22 @@ export function findOverrides(cssText: string, theme: any): Array<{
204
375
  * @returns {string | null}
205
376
  */
206
377
  export function themeSourceProblem(cwd: string, slug: string): string | null;
378
+ /**
379
+ * Why the person's own theme source does not parse (its line and the
380
+ * parser's message), or null when it parses or is not there.
381
+ * @param {string} cwd
382
+ * @param {string} slug
383
+ * @returns {string | null}
384
+ */
385
+ export function themeSourceParseError(cwd: string, slug: string): string | null;
386
+ /**
387
+ * Refuse, before anything is written or removed, a command whose build
388
+ * would load the person's own theme source when it does not parse: the
389
+ * build would fail part way.
390
+ * @param {string} cwd
391
+ * @param {string} slug
392
+ */
393
+ export function refuseThemeParse(cwd: string, slug: string): void;
207
394
  /**
208
395
  * Refuse a build whose theme source cannot carry the settings, naming the
209
396
  * lines that put it back.
@@ -211,6 +398,34 @@ export function themeSourceProblem(cwd: string, slug: string): string | null;
211
398
  * @param {string} slug
212
399
  */
213
400
  export function refuseThemeSource(cwd: string, slug: string): void;
401
+ /**
402
+ * The tokens that are not colors the theme as it builds now gives a
403
+ * [light, dark] pair (light-dark()), however its file writes them (a
404
+ * constant, `as const`, `satisfies`, a spread from an imported module):
405
+ * read from a build made into the project's cache folder, never beside the
406
+ * theme. Empty when it does not build there (the build names that itself).
407
+ * @param {Ctx} ctx
408
+ * @param {string} slug
409
+ * @returns {Promise<string[]>}
410
+ */
411
+ export function builtPairs(ctx: Ctx, slug: string): Promise<string[]>;
412
+ /**
413
+ * The refusal of a [light, dark] pair on tokens that are not colors.
414
+ * @param {string} slug
415
+ * @param {string[]} names
416
+ */
417
+ export function ownPairMessage(slug: string, names: string[]): string;
418
+ /**
419
+ * Set what runs after every build of a theme.
420
+ * @param {((ctx: Ctx, slug: string, data: ThemeData) => void) | null} fn
421
+ */
422
+ export function setAfterBuild(fn: ((ctx: Ctx, slug: string, data: ThemeData) => void) | null): void;
423
+ /**
424
+ * Hold the after-build hook for this command's builds: the command writes
425
+ * the app copy itself once it succeeds (show).
426
+ * @param {Ctx} ctx
427
+ */
428
+ export function holdAfterBuild(ctx: Ctx): void;
214
429
  /**
215
430
  * Generate the theme source, build it with the theme build, then repeat any
216
431
  * part setting a more specific rule would beat and build again.
@@ -224,6 +439,15 @@ export function buildTheme(ctx: Ctx, slug: string, data: ThemeData): Promise<{
224
439
  lifted: string[];
225
440
  notes: string[];
226
441
  }>;
442
+ /**
443
+ * Why the built outputs differ from what the theme builds now: one that is
444
+ * missing or changed by hand, found the way `compile --check` finds it
445
+ * (the same build, compared and not written), or null when they match.
446
+ * @param {Ctx} ctx
447
+ * @param {string} slug
448
+ * @returns {Promise<string | null>}
449
+ */
450
+ export function outputsDrift(ctx: Ctx, slug: string): Promise<string | null>;
227
451
  /**
228
452
  * Resolved tokens of the built theme in both modes.
229
453
  * @param {Ctx} ctx
@@ -299,12 +523,38 @@ export function radiusTokenOf(ctx: Ctx, part: string, when?: string): string;
299
523
  export function clearNewMarker(dir: string): void;
300
524
  /**
301
525
  * The pseudo key a state writes in a part's styles. Core marks a disabled
302
- * button, link, tab or menu item with aria-disabled (it stays focusable),
303
- * and its own styles match both forms: so does the theme.
526
+ * button, link or tab with aria-disabled (it stays focusable). A form
527
+ * control styled on a wrapper (a typeahead, a complex selector) has its
528
+ * input or button inside marked, so it also matches a disabled form
529
+ * control inside it (never a list row); an action part that holds
530
+ * children (a button group, a segmented control) never does, so one
531
+ * disabled child never makes the whole part look disabled.
304
532
  * @param {string} state
533
+ * @param {boolean} [wrapsControl]
305
534
  * @returns {string}
306
535
  */
307
- export function stateKey(state: string): string;
536
+ export function stateKey(state: string, wrapsControl?: boolean): string;
537
+ /**
538
+ * The component docs of a part: its own component's, and the one named like
539
+ * the part (tab is Tab, under TabList), each with its name, for the ones the
540
+ * project has.
541
+ * @param {Ctx} ctx
542
+ * @param {string} part
543
+ * @returns {Array<{name: string, doc: any}>}
544
+ */
545
+ export function partComponentDocs(ctx: Ctx, part: string): Array<{
546
+ name: string;
547
+ doc: any;
548
+ }>;
549
+ /**
550
+ * Whether a part's styled element wraps one control: its component (or the
551
+ * one named like the part) is a form control (Core's own category) that
552
+ * takes a disabled prop. An action part that holds children (a button
553
+ * group) never does.
554
+ * @param {Ctx} ctx
555
+ * @param {string} target
556
+ */
557
+ export function wrapsOneControl(ctx: Ctx, target: string): boolean;
308
558
  /**
309
559
  * The whole-theme radius tokens a generated settings module writes, or null
310
560
  * when it writes none.
@@ -358,6 +608,18 @@ export function settingsStamp(data: ThemeData): string;
358
608
  * @returns {string | null}
359
609
  */
360
610
  export function staleBuild(cwd: string, slug: string, data: ThemeData): string | null;
611
+ /**
612
+ * Every file the editor's build of a theme writes, the one list staleness
613
+ * reads: the generated settings module, the built stylesheet, module and
614
+ * their types, and, with a color dial set, the generated color files.
615
+ * @param {string} cwd
616
+ * @param {string} slug
617
+ * @param {ThemeData} data
618
+ * @param {boolean} [some] the files a build writes only for some themes
619
+ * (the variants types, for a theme with component variants) instead
620
+ * @returns {string[]}
621
+ */
622
+ export function builtFiles(cwd: string, slug: string, data: ThemeData, some?: boolean): string[];
361
623
  /**
362
624
  * A theme's undo history: the settings text before each change, oldest
363
625
  * first, and how many damaged steps were dropped. Every step after the
@@ -400,7 +662,7 @@ export function fontPackages(ctx: Ctx, data: ThemeData): {
400
662
  installed: boolean;
401
663
  of: Setting;
402
664
  }[];
403
- /** @typedef {{project: import('./_project.mjs').ThemeProject, C: import('./_compiler.mjs').Compiler, unchecked?: string | null, uncheckedCode?: string | null, wrote?: Map<string, string | null>, base?: {light: Record<string, string>, dark: Record<string, string>, components?: Record<string, any>}, keepStops?: Record<string, Record<'light' | 'dark', {family: string, stop: number, alpha?: string}>> | null, keepRadii?: Record<string, string> | null}} Ctx */
665
+ /** @typedef {{project: import('./_project.mjs').ThemeProject, C: import('./_compiler.mjs').Compiler, unchecked?: string | null, uncheckedCode?: string | null, wrote?: Map<string, string | null>, base?: {light: Record<string, string>, dark: Record<string, string>, components?: Record<string, any>}, keepStops?: Record<string, Record<'light' | 'dark', {family: string, stop: number, alpha?: string}>> | null, keepRadii?: Record<string, string> | null, derived?: Record<string, Array<{property: string, vars?: string[], replaces?: boolean, expand?: string}>>}} Ctx */
404
666
  /** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
405
667
  /** @typedef {import('./_parts.mjs').TextPair} TextPair */
406
668
  /** What a theme name may be, in words. */
@@ -410,10 +672,14 @@ export function windowsReserved(s: string): boolean;
410
672
  export function slugFor(name: unknown): string;
411
673
  export function kebab(s: string): string;
412
674
  export function camel(s: string): string;
675
+ /** Files a system or a tool puts in any folder; a folder of only these is empty. */
676
+ export const FOLDER_JUNK: Set<string>;
413
677
  export function shown(cwd: string, f: string): string;
414
678
  export function keyOf(s: Setting): string;
415
679
  export function cornerPx(v: string): number;
416
680
  export function textPx(v: string): number;
681
+ /** The type tokens base themes set again for phones: families and weights. */
682
+ export const PHONE_TYPE: RegExp;
417
683
  export function themeSource(slug: string): string;
418
684
  /** The file a `new` keeps beside the files it writes until it is done. */
419
685
  export const NEW_MARKER: ".astryx-new.json";
@@ -423,6 +689,7 @@ export const NEW_MARKER: ".astryx-new.json";
423
689
  * leaves (a designer's `<slug>.design.psd` beside them is never touched).
424
690
  */
425
691
  export const EDITOR_SUFFIXES: string[];
692
+ export function isEditorFile(slug: string, n: string): boolean;
426
693
  /** The undo steps a theme keeps; older ones are dropped. */
427
694
  export const HISTORY_STEPS: 80;
428
695
  /**
@@ -489,6 +756,12 @@ export type Ctx = {
489
756
  alpha?: string;
490
757
  }>> | null;
491
758
  keepRadii?: Record<string, string> | null;
759
+ derived?: Record<string, Array<{
760
+ property: string;
761
+ vars?: string[];
762
+ replaces?: boolean;
763
+ expand?: string;
764
+ }>>;
492
765
  };
493
766
  export type PaintSide = import("./_parts.mjs").PaintSide;
494
767
  export type TextPair = import("./_parts.mjs").TextPair;