@astryxdesign/cli 0.7.15 → 0.7.16-canary.g54dd64e

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 (123) hide show
  1. package/README.md +5 -3
  2. package/api/component/_adapter.d.mts +1 -1
  3. package/api/component/_adapter.mjs +28 -1
  4. package/api/doctor/_adapter.d.mts +17 -0
  5. package/api/doctor/_adapter.mjs +35 -0
  6. package/api/doctor/doctor.mjs +18 -4
  7. package/api/integration/pack-check.mjs +13 -7
  8. package/api/integration/validate-integration.mjs +1 -1
  9. package/api/theme/_adapter.d.mts +5 -2
  10. package/api/theme/_adapter.mjs +43 -12
  11. package/api/theme/build/build.d.mts +64 -27
  12. package/api/theme/build/build.mjs +341 -69
  13. package/api/theme/eject/eject.mjs +22 -1
  14. package/api/theme/template/template.d.mts +19 -0
  15. package/api/theme/template/template.mjs +102 -25
  16. package/api/theme/theme.type.d.mts +5 -1
  17. package/api/theme/theme.type.mjs +2 -1
  18. package/api/theme/themeBuild.doc.mjs +3 -3
  19. package/api/theme/themeEject.doc.mjs +1 -1
  20. package/api/theme/themeTemplate.doc.mjs +9 -3
  21. package/api/theme-edit/_adapter.d.mts +33 -0
  22. package/api/theme-edit/_adapter.mjs +208 -31
  23. package/api/theme-edit/_check.d.mts +38 -0
  24. package/api/theme-edit/_check.mjs +1326 -211
  25. package/api/theme-edit/_color.d.mts +2 -8
  26. package/api/theme-edit/_color.mjs +292 -219
  27. package/api/theme-edit/_compiler.d.mts +1 -0
  28. package/api/theme-edit/_compiler.mjs +20 -1
  29. package/api/theme-edit/_context.d.mts +29 -0
  30. package/api/theme-edit/_context.mjs +329 -30
  31. package/api/theme-edit/_css.d.mts +60 -1
  32. package/api/theme-edit/_css.mjs +404 -28
  33. package/api/theme-edit/_edit.d.mts +9 -0
  34. package/api/theme-edit/_edit.mjs +1025 -126
  35. package/api/theme-edit/_how-commands.d.mts +11 -26
  36. package/api/theme-edit/_how-commands.mjs +30 -2
  37. package/api/theme-edit/_how-question.d.mts +7 -0
  38. package/api/theme-edit/_how-question.mjs +1304 -176
  39. package/api/theme-edit/_how.mjs +144 -30
  40. package/api/theme-edit/_overview.mjs +2 -0
  41. package/api/theme-edit/_palette.d.mts +11 -0
  42. package/api/theme-edit/_palette.mjs +194 -65
  43. package/api/theme-edit/_parts.d.mts +16 -0
  44. package/api/theme-edit/_parts.mjs +59 -7
  45. package/api/theme-edit/_png.mjs +19 -14
  46. package/api/theme-edit/_preview-app.d.mts +3 -0
  47. package/api/theme-edit/_preview-app.mjs +843 -45
  48. package/api/theme-edit/_preview.d.mts +16 -3
  49. package/api/theme-edit/_preview.mjs +310 -29
  50. package/api/theme-edit/_project.d.mts +11 -0
  51. package/api/theme-edit/_project.mjs +46 -12
  52. package/api/theme-edit/_settings.d.mts +178 -5
  53. package/api/theme-edit/_settings.mjs +2035 -86
  54. package/api/theme-edit/_tables.d.mts +24 -0
  55. package/api/theme-edit/_tables.mjs +211 -149
  56. package/api/theme-edit/_vet.d.mts +42 -0
  57. package/api/theme-edit/_vet.mjs +144 -0
  58. package/api/theme-edit/theme-edit.type.d.mts +2 -1
  59. package/api/theme-edit/theme-edit.type.mjs +1 -1
  60. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  61. package/api/theme-edit/themeEditShow.doc.mjs +11 -3
  62. package/api/upgrade/registry/registry.mjs +6 -1
  63. package/assets/docs/tree/single-component.doc.mjs +11 -2
  64. package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
  65. package/assets/docs.generated.json +2 -2
  66. package/assets/preview-app/next.config.mjs +7 -1
  67. package/assets/preview-app/package.json +1 -0
  68. package/assets/preview-app/src/app/globals.css +1 -0
  69. package/assets/self-audit.generated.json +1 -1
  70. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.doc.mjs +14 -0
  71. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx +53 -0
  72. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.doc.mjs +14 -0
  73. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.tsx +33 -0
  74. package/assets/templates/components.generated.json +1 -1
  75. package/assets/templates/pages/dashboard/page.tsx +1 -1
  76. package/authoring/doctypes/_schema.d.mts +52 -5
  77. package/authoring/doctypes/_schema.mjs +62 -7
  78. package/authoring/doctypes/base/type.ts +10 -0
  79. package/authoring/doctypes/component/component.doc.mjs +1 -1
  80. package/authoring/doctypes/function/function.doc.mjs +6 -0
  81. package/authoring/doctypes/function/type.ts +3 -0
  82. package/authoring/doctypes/legacy.mjs +5 -1
  83. package/authoring/index.d.ts +1 -0
  84. package/clients/cli/build-id.generated.json +1 -1
  85. package/clients/cli/commands/doctor.doc.mjs +2 -2
  86. package/clients/cli/commands/experimental/theme.mjs +190 -37
  87. package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
  88. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
  89. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
  90. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  91. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  92. package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -1
  93. package/clients/cli/commands/experimental-theme-template.doc.mjs +2 -2
  94. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  95. package/clients/cli/commands/theme-eject.doc.mjs +1 -1
  96. package/clients/cli/commands/theme-template.doc.mjs +3 -1
  97. package/clients/cli/commands/theme.mjs +168 -45
  98. package/clients/cli/formatters/index.mjs +7 -4
  99. package/clients/cli/lib/cli-error.mjs +9 -3
  100. package/clients/cli/lib/component-format.mjs +27 -9
  101. package/clients/cli/lib/json-shim.mjs +40 -2
  102. package/clients/cli/manifest.generated.json +1 -1
  103. package/clients/cli/run.mjs +49 -0
  104. package/foundation/config/project.mjs +50 -14
  105. package/foundation/discovery/theme-discovery.d.mts +5 -1
  106. package/foundation/discovery/theme-discovery.mjs +24 -3
  107. package/foundation/fs/gather-cache.d.mts +9 -2
  108. package/foundation/fs/gather-cache.mjs +79 -15
  109. package/foundation/fs/paths.d.mts +31 -0
  110. package/foundation/fs/paths.mjs +43 -10
  111. package/foundation/render/host-exit.d.mts +8 -0
  112. package/foundation/render/host-exit.mjs +11 -0
  113. package/foundation/render/page-host.mjs +56 -10
  114. package/foundation/render/page-worker.mjs +14 -0
  115. package/foundation/render/render-page.mjs +37 -2
  116. package/foundation/response/error-codes.d.mts +2 -1
  117. package/foundation/response/error-codes.d.ts +1 -0
  118. package/foundation/response/error-codes.doc.mjs +5 -0
  119. package/foundation/response/error-codes.mjs +3 -0
  120. package/foundation/response/json.d.mts +15 -0
  121. package/foundation/response/json.mjs +52 -1
  122. package/foundation/response/response-types.doc.mjs +1 -1
  123. package/package.json +7 -6
@@ -20,6 +20,44 @@ export function themeFiles(cwd: string, slug: string): {
20
20
  previewPng: string;
21
21
  sheetPng: string;
22
22
  };
23
+ /**
24
+ * A name `new` takes, for a suggestion: `name` itself when it is valid, not a
25
+ * built-in theme and its folder is free; `my-<name>` for a built-in theme's
26
+ * name; else the first free numbered name.
27
+ * @param {string} cwd
28
+ * @param {string} name
29
+ */
30
+ export function usableNewName(cwd: string, name: string): string;
31
+ /**
32
+ * A theme name near `name` that is valid and whose folder is free: `name-2`,
33
+ * `name-3`, …, shortened to fit the name's length limit.
34
+ * @param {string} cwd
35
+ * @param {string} name
36
+ */
37
+ export function freeThemeName(cwd: string, name: string): string;
38
+ /**
39
+ * Why the editor cannot read one of its files, or null when it can (or the
40
+ * file is not there): a folder in the file's place, or no permission to read
41
+ * it. Bad content is a different problem, judged where the file is parsed.
42
+ * @param {string} file
43
+ * @returns {string | null}
44
+ */
45
+ export function unreadableReason(file: string): string | null;
46
+ /**
47
+ * Refuse, by name, when a file of the theme is a folder or cannot be read:
48
+ * every command reads them, and none should crash on one. The fix is to
49
+ * look at the file and give it back its place; a file is never deleted.
50
+ * @param {string} cwd
51
+ * @param {string} slug
52
+ */
53
+ export function refuseUnreadableFiles(cwd: string, slug: string): void;
54
+ /**
55
+ * Refuse when the app's themes/ is a file or a link to something other
56
+ * than a folder: every editor theme lives in themes/<name>/. The run lists
57
+ * what is there; the message says to rename or move it.
58
+ * @param {string} cwd
59
+ */
60
+ export function refuseThemesNotFolder(cwd: string): void;
23
61
  /**
24
62
  * The themes the editor made in the app (a settings file of its own), by
25
63
  * name, or with `changed` the one an editor command changed last first: the
@@ -51,6 +89,14 @@ export function refuse(code: string, message: string, extra?: {
51
89
  fix?: string;
52
90
  also?: string[];
53
91
  }): never;
92
+ /**
93
+ * A theme name as typed, read the way the editor reads it: a path to its
94
+ * folder or a file in it (t.theme.ts, Brand.settings.json), in any case,
95
+ * names the theme. The result may still need slugFor.
96
+ * @param {unknown} s
97
+ * @returns {string}
98
+ */
99
+ export function typedThemeName(s: unknown): string;
54
100
  /**
55
101
  * The settings of a theme, or a refusal naming the command that makes it.
56
102
  * @param {string} cwd
@@ -106,6 +152,63 @@ export function withoutBadValues(data: ThemeData): {
106
152
  * @returns {string | null}
107
153
  */
108
154
  export function valueProblem(s: any): string | null;
155
+ /**
156
+ * The tokens a base theme's own component rules for a part read through
157
+ * var() (neutral's progress-bar reads --color-border-emphasized), from its
158
+ * built module; an empty set when it is not installed.
159
+ * @param {string} cwd
160
+ * @param {string | null | undefined} like
161
+ * @param {string} target
162
+ * @returns {Set<string>}
163
+ */
164
+ export function baseComponentReads(cwd: string, like: string | null | undefined, target: string): Set<string>;
165
+ /**
166
+ * The top-level tokens a base theme's built module gives (what the
167
+ * editor's settings extend), or an empty map when it is not installed.
168
+ * @param {string} cwd
169
+ * @param {string | null | undefined} like
170
+ * @returns {Map<string, string | null>}
171
+ */
172
+ export function baseTopTokens(cwd: string, like: string | null | undefined): Map<string, string | null>;
173
+ /**
174
+ * What a part's plain rule (its `base` block) holds in the theme as built
175
+ * (the base theme's, the settings' and the own source's together), else in
176
+ * the base theme alone when there is no build: tokens and properties by
177
+ * name. Kebab-case property names, as the editor names them.
178
+ * @param {string} cwd
179
+ * @param {string} slug
180
+ * @param {string | null | undefined} like
181
+ * @param {string} part
182
+ * @returns {Map<string, string | null>}
183
+ */
184
+ export function partRuleTokens(cwd: string, slug: string, like: string | null | undefined, part: string): Map<string, string | null>;
185
+ /**
186
+ * The tokens and properties a theme's own source sets on a part's plain
187
+ * rule, read from the build as ownTokens reads page-wide ones: what the
188
+ * built rule holds that the settings module and the base theme do not give
189
+ * as they are, and that the person's files name.
190
+ * @param {string} cwd
191
+ * @param {string} slug
192
+ * @param {string} part
193
+ * @returns {Map<string, string | null>}
194
+ */
195
+ export function ownPartTokens(cwd: string, slug: string, part: string): Map<string, string | null>;
196
+ /**
197
+ * The page-wide tokens a theme's own source sets itself (see ownTokens):
198
+ * they win over the settings it extends.
199
+ * @param {string} cwd
200
+ * @param {string} slug
201
+ * @returns {string[]}
202
+ */
203
+ export function ownSourceTokens(cwd: string, slug: string): string[];
204
+ /**
205
+ * The values a theme's own source gives page-wide tokens as plain text, by
206
+ * token (see ownTokens).
207
+ * @param {string} cwd
208
+ * @param {string} slug
209
+ * @returns {Record<string, string>}
210
+ */
211
+ export function ownSourceTokenValues(cwd: string, slug: string): Record<string, string>;
109
212
  /** One line for a setting. @param {Setting} s */
110
213
  export function describe(s: Setting): string;
111
214
  /**
@@ -178,9 +281,10 @@ export function compileTheme(ctx: Ctx, data: ThemeData, base: {
178
281
  * Settings whose effect a later or stronger setting hides, with why: `type`
179
282
  * loses heading weight and tracking to `headings`.
180
283
  * @param {ThemeData} data
284
+ * @param {Ctx | null} [ctx] with it, a later setting that reaches the parts through a spread counts too
181
285
  * @returns {Map<Setting, string>}
182
286
  */
183
- export function maskedSettings(data: ThemeData): Map<Setting, string>;
287
+ export function maskedSettings(data: ThemeData, ctx?: Ctx | null): Map<Setting, string>;
184
288
  /**
185
289
  * A plain part setting can lose to a more specific rule for the same part
186
290
  * and property, such as a base theme's `.astryx-heading[data-level="1"]
@@ -204,6 +308,22 @@ export function findOverrides(cssText: string, theme: any): Array<{
204
308
  * @returns {string | null}
205
309
  */
206
310
  export function themeSourceProblem(cwd: string, slug: string): string | null;
311
+ /**
312
+ * Why the person's own theme source does not parse (its line and the
313
+ * parser's message), or null when it parses or is not there.
314
+ * @param {string} cwd
315
+ * @param {string} slug
316
+ * @returns {string | null}
317
+ */
318
+ export function themeSourceParseError(cwd: string, slug: string): string | null;
319
+ /**
320
+ * Refuse, before anything is written or removed, a command whose build
321
+ * would load the person's own theme source when it does not parse: the
322
+ * build would fail part way.
323
+ * @param {string} cwd
324
+ * @param {string} slug
325
+ */
326
+ export function refuseThemeParse(cwd: string, slug: string): void;
207
327
  /**
208
328
  * Refuse a build whose theme source cannot carry the settings, naming the
209
329
  * lines that put it back.
@@ -224,6 +344,15 @@ export function buildTheme(ctx: Ctx, slug: string, data: ThemeData): Promise<{
224
344
  lifted: string[];
225
345
  notes: string[];
226
346
  }>;
347
+ /**
348
+ * Why the built outputs differ from what the theme builds now: one that is
349
+ * missing or changed by hand, found the way `compile --check` finds it
350
+ * (the same build, compared and not written), or null when they match.
351
+ * @param {Ctx} ctx
352
+ * @param {string} slug
353
+ * @returns {Promise<string | null>}
354
+ */
355
+ export function outputsDrift(ctx: Ctx, slug: string): Promise<string | null>;
227
356
  /**
228
357
  * Resolved tokens of the built theme in both modes.
229
358
  * @param {Ctx} ctx
@@ -299,12 +428,38 @@ export function radiusTokenOf(ctx: Ctx, part: string, when?: string): string;
299
428
  export function clearNewMarker(dir: string): void;
300
429
  /**
301
430
  * 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.
431
+ * button, link or tab with aria-disabled (it stays focusable). A form
432
+ * control styled on a wrapper (a typeahead, a complex selector) has its
433
+ * input or button inside marked, so it also matches a disabled form
434
+ * control inside it (never a list row); an action part that holds
435
+ * children (a button group, a segmented control) never does, so one
436
+ * disabled child never makes the whole part look disabled.
304
437
  * @param {string} state
438
+ * @param {boolean} [wrapsControl]
305
439
  * @returns {string}
306
440
  */
307
- export function stateKey(state: string): string;
441
+ export function stateKey(state: string, wrapsControl?: boolean): string;
442
+ /**
443
+ * The component docs of a part: its own component's, and the one named like
444
+ * the part (tab is Tab, under TabList), each with its name, for the ones the
445
+ * project has.
446
+ * @param {Ctx} ctx
447
+ * @param {string} part
448
+ * @returns {Array<{name: string, doc: any}>}
449
+ */
450
+ export function partComponentDocs(ctx: Ctx, part: string): Array<{
451
+ name: string;
452
+ doc: any;
453
+ }>;
454
+ /**
455
+ * Whether a part's styled element wraps one control: its component (or the
456
+ * one named like the part) is a form control (Core's own category) that
457
+ * takes a disabled prop. An action part that holds children (a button
458
+ * group) never does.
459
+ * @param {Ctx} ctx
460
+ * @param {string} target
461
+ */
462
+ export function wrapsOneControl(ctx: Ctx, target: string): boolean;
308
463
  /**
309
464
  * The whole-theme radius tokens a generated settings module writes, or null
310
465
  * when it writes none.
@@ -358,6 +513,18 @@ export function settingsStamp(data: ThemeData): string;
358
513
  * @returns {string | null}
359
514
  */
360
515
  export function staleBuild(cwd: string, slug: string, data: ThemeData): string | null;
516
+ /**
517
+ * Every file the editor's build of a theme writes, the one list staleness
518
+ * reads: the generated settings module, the built stylesheet, module and
519
+ * their types, and, with a color dial set, the generated color files.
520
+ * @param {string} cwd
521
+ * @param {string} slug
522
+ * @param {ThemeData} data
523
+ * @param {boolean} [some] the files a build writes only for some themes
524
+ * (the variants types, for a theme with component variants) instead
525
+ * @returns {string[]}
526
+ */
527
+ export function builtFiles(cwd: string, slug: string, data: ThemeData, some?: boolean): string[];
361
528
  /**
362
529
  * A theme's undo history: the settings text before each change, oldest
363
530
  * first, and how many damaged steps were dropped. Every step after the
@@ -400,7 +567,7 @@ export function fontPackages(ctx: Ctx, data: ThemeData): {
400
567
  installed: boolean;
401
568
  of: Setting;
402
569
  }[];
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 */
570
+ /** @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
571
  /** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
405
572
  /** @typedef {import('./_parts.mjs').TextPair} TextPair */
406
573
  /** What a theme name may be, in words. */
@@ -489,6 +656,12 @@ export type Ctx = {
489
656
  alpha?: string;
490
657
  }>> | null;
491
658
  keepRadii?: Record<string, string> | null;
659
+ derived?: Record<string, Array<{
660
+ property: string;
661
+ vars?: string[];
662
+ replaces?: boolean;
663
+ expand?: string;
664
+ }>>;
492
665
  };
493
666
  export type PaintSide = import("./_parts.mjs").PaintSide;
494
667
  export type TextPair = import("./_parts.mjs").TextPair;