@astryxdesign/cli 0.7.15 → 0.7.16-canary.g8514aae

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 (116) 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/validate-integration.mjs +1 -1
  8. package/api/theme/_adapter.d.mts +5 -2
  9. package/api/theme/_adapter.mjs +43 -12
  10. package/api/theme/build/build.d.mts +1 -21
  11. package/api/theme/build/build.mjs +149 -37
  12. package/api/theme/eject/eject.mjs +22 -1
  13. package/api/theme/template/template.d.mts +19 -0
  14. package/api/theme/template/template.mjs +91 -19
  15. package/api/theme/theme.type.d.mts +5 -1
  16. package/api/theme/theme.type.mjs +2 -1
  17. package/api/theme/themeBuild.doc.mjs +3 -3
  18. package/api/theme/themeEject.doc.mjs +1 -1
  19. package/api/theme/themeTemplate.doc.mjs +9 -3
  20. package/api/theme-edit/_adapter.d.mts +21 -0
  21. package/api/theme-edit/_adapter.mjs +176 -22
  22. package/api/theme-edit/_check.d.mts +7 -0
  23. package/api/theme-edit/_check.mjs +1050 -173
  24. package/api/theme-edit/_color.d.mts +2 -8
  25. package/api/theme-edit/_color.mjs +292 -219
  26. package/api/theme-edit/_compiler.d.mts +1 -0
  27. package/api/theme-edit/_compiler.mjs +20 -1
  28. package/api/theme-edit/_context.d.mts +21 -0
  29. package/api/theme-edit/_context.mjs +235 -12
  30. package/api/theme-edit/_css.d.mts +50 -1
  31. package/api/theme-edit/_css.mjs +310 -28
  32. package/api/theme-edit/_edit.d.mts +9 -0
  33. package/api/theme-edit/_edit.mjs +907 -123
  34. package/api/theme-edit/_how-commands.d.mts +11 -26
  35. package/api/theme-edit/_how-commands.mjs +30 -2
  36. package/api/theme-edit/_how-question.d.mts +7 -0
  37. package/api/theme-edit/_how-question.mjs +1304 -176
  38. package/api/theme-edit/_how.mjs +144 -30
  39. package/api/theme-edit/_palette.d.mts +6 -0
  40. package/api/theme-edit/_palette.mjs +164 -62
  41. package/api/theme-edit/_parts.d.mts +16 -0
  42. package/api/theme-edit/_parts.mjs +49 -1
  43. package/api/theme-edit/_png.mjs +19 -14
  44. package/api/theme-edit/_preview-app.mjs +514 -27
  45. package/api/theme-edit/_preview.d.mts +11 -0
  46. package/api/theme-edit/_preview.mjs +245 -24
  47. package/api/theme-edit/_project.d.mts +11 -0
  48. package/api/theme-edit/_project.mjs +35 -9
  49. package/api/theme-edit/_settings.d.mts +122 -5
  50. package/api/theme-edit/_settings.mjs +1363 -71
  51. package/api/theme-edit/_tables.d.mts +19 -0
  52. package/api/theme-edit/_tables.mjs +205 -149
  53. package/api/theme-edit/_vet.d.mts +42 -0
  54. package/api/theme-edit/_vet.mjs +144 -0
  55. package/api/theme-edit/theme-edit.type.d.mts +2 -1
  56. package/api/theme-edit/theme-edit.type.mjs +1 -1
  57. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  58. package/api/theme-edit/themeEditShow.doc.mjs +11 -3
  59. package/assets/docs/tree/single-component.doc.mjs +11 -2
  60. package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
  61. package/assets/docs.generated.json +2 -2
  62. package/assets/preview-app/next.config.mjs +7 -1
  63. package/assets/preview-app/src/app/globals.css +1 -0
  64. package/assets/self-audit.generated.json +1 -1
  65. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.doc.mjs +14 -0
  66. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx +53 -0
  67. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.doc.mjs +14 -0
  68. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.tsx +33 -0
  69. package/assets/templates/components.generated.json +1 -1
  70. package/authoring/doctypes/_schema.d.mts +52 -5
  71. package/authoring/doctypes/_schema.mjs +62 -7
  72. package/authoring/doctypes/base/type.ts +10 -0
  73. package/authoring/doctypes/component/component.doc.mjs +1 -1
  74. package/authoring/doctypes/function/function.doc.mjs +6 -0
  75. package/authoring/doctypes/function/type.ts +3 -0
  76. package/authoring/doctypes/legacy.mjs +5 -1
  77. package/authoring/index.d.ts +1 -0
  78. package/clients/cli/build-id.generated.json +1 -1
  79. package/clients/cli/commands/doctor.doc.mjs +2 -2
  80. package/clients/cli/commands/experimental/theme.mjs +188 -37
  81. package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
  82. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
  83. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
  84. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  85. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  86. package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -1
  87. package/clients/cli/commands/experimental-theme-template.doc.mjs +2 -2
  88. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  89. package/clients/cli/commands/theme-eject.doc.mjs +1 -1
  90. package/clients/cli/commands/theme-template.doc.mjs +3 -1
  91. package/clients/cli/commands/theme.mjs +89 -6
  92. package/clients/cli/formatters/index.mjs +7 -4
  93. package/clients/cli/lib/cli-error.mjs +9 -3
  94. package/clients/cli/lib/component-format.mjs +27 -9
  95. package/clients/cli/lib/json-shim.mjs +40 -2
  96. package/clients/cli/manifest.generated.json +1 -1
  97. package/foundation/config/project.mjs +50 -14
  98. package/foundation/discovery/theme-discovery.d.mts +5 -1
  99. package/foundation/discovery/theme-discovery.mjs +24 -3
  100. package/foundation/fs/gather-cache.d.mts +9 -2
  101. package/foundation/fs/gather-cache.mjs +36 -10
  102. package/foundation/fs/paths.d.mts +16 -0
  103. package/foundation/fs/paths.mjs +25 -0
  104. package/foundation/render/host-exit.d.mts +8 -0
  105. package/foundation/render/host-exit.mjs +11 -0
  106. package/foundation/render/page-host.mjs +56 -10
  107. package/foundation/render/page-worker.mjs +14 -0
  108. package/foundation/render/render-page.mjs +37 -2
  109. package/foundation/response/error-codes.d.mts +2 -1
  110. package/foundation/response/error-codes.d.ts +1 -0
  111. package/foundation/response/error-codes.doc.mjs +5 -0
  112. package/foundation/response/error-codes.mjs +3 -0
  113. package/foundation/response/json.d.mts +15 -0
  114. package/foundation/response/json.mjs +52 -1
  115. package/foundation/response/response-types.doc.mjs +1 -1
  116. package/package.json +7 -6
@@ -20,6 +20,29 @@ export function themeFiles(cwd: string, slug: string): {
20
20
  previewPng: string;
21
21
  sheetPng: string;
22
22
  };
23
+ /**
24
+ * Why the editor cannot read one of its files, or null when it can (or the
25
+ * file is not there): a folder in the file's place, or no permission to read
26
+ * it. Bad content is a different problem, judged where the file is parsed.
27
+ * @param {string} file
28
+ * @returns {string | null}
29
+ */
30
+ export function unreadableReason(file: string): string | null;
31
+ /**
32
+ * Refuse, by name, when a file of the theme is a folder or cannot be read:
33
+ * every command reads them, and none should crash on one. The fix is to
34
+ * look at the file and give it back its place; a file is never deleted.
35
+ * @param {string} cwd
36
+ * @param {string} slug
37
+ */
38
+ export function refuseUnreadableFiles(cwd: string, slug: string): void;
39
+ /**
40
+ * Refuse when the app's themes/ is a file or a link to something other
41
+ * than a folder: every editor theme lives in themes/<name>/. The run lists
42
+ * what is there; the message says to rename or move it.
43
+ * @param {string} cwd
44
+ */
45
+ export function refuseThemesNotFolder(cwd: string): void;
23
46
  /**
24
47
  * The themes the editor made in the app (a settings file of its own), by
25
48
  * name, or with `changed` the one an editor command changed last first: the
@@ -51,6 +74,14 @@ export function refuse(code: string, message: string, extra?: {
51
74
  fix?: string;
52
75
  also?: string[];
53
76
  }): never;
77
+ /**
78
+ * A theme name as typed, read the way the editor reads it: a path to its
79
+ * folder or a file in it (t.theme.ts, Brand.settings.json), in any case,
80
+ * names the theme. The result may still need slugFor.
81
+ * @param {unknown} s
82
+ * @returns {string}
83
+ */
84
+ export function typedThemeName(s: unknown): string;
54
85
  /**
55
86
  * The settings of a theme, or a refusal naming the command that makes it.
56
87
  * @param {string} cwd
@@ -106,6 +137,22 @@ export function withoutBadValues(data: ThemeData): {
106
137
  * @returns {string | null}
107
138
  */
108
139
  export function valueProblem(s: any): string | null;
140
+ /**
141
+ * The page-wide tokens a theme's own source sets itself (the top-level
142
+ * `tokens` of its `defineTheme`): they win over the settings it extends.
143
+ * @param {string} cwd
144
+ * @param {string} slug
145
+ * @returns {string[]}
146
+ */
147
+ export function ownSourceTokens(cwd: string, slug: string): string[];
148
+ /**
149
+ * The values a theme's own source gives page-wide tokens as plain text
150
+ * (`'--radius-page': 'var(--radius-element)'`), by token.
151
+ * @param {string} cwd
152
+ * @param {string} slug
153
+ * @returns {Record<string, string>}
154
+ */
155
+ export function ownSourceTokenValues(cwd: string, slug: string): Record<string, string>;
109
156
  /** One line for a setting. @param {Setting} s */
110
157
  export function describe(s: Setting): string;
111
158
  /**
@@ -178,9 +225,10 @@ export function compileTheme(ctx: Ctx, data: ThemeData, base: {
178
225
  * Settings whose effect a later or stronger setting hides, with why: `type`
179
226
  * loses heading weight and tracking to `headings`.
180
227
  * @param {ThemeData} data
228
+ * @param {Ctx | null} [ctx] with it, a later setting that reaches the parts through a spread counts too
181
229
  * @returns {Map<Setting, string>}
182
230
  */
183
- export function maskedSettings(data: ThemeData): Map<Setting, string>;
231
+ export function maskedSettings(data: ThemeData, ctx?: Ctx | null): Map<Setting, string>;
184
232
  /**
185
233
  * A plain part setting can lose to a more specific rule for the same part
186
234
  * and property, such as a base theme's `.astryx-heading[data-level="1"]
@@ -204,6 +252,22 @@ export function findOverrides(cssText: string, theme: any): Array<{
204
252
  * @returns {string | null}
205
253
  */
206
254
  export function themeSourceProblem(cwd: string, slug: string): string | null;
255
+ /**
256
+ * Why the person's own theme source does not parse (its line and the
257
+ * parser's message), or null when it parses or is not there.
258
+ * @param {string} cwd
259
+ * @param {string} slug
260
+ * @returns {string | null}
261
+ */
262
+ export function themeSourceParseError(cwd: string, slug: string): string | null;
263
+ /**
264
+ * Refuse, before anything is written or removed, a command whose build
265
+ * would load the person's own theme source when it does not parse: the
266
+ * build would fail part way.
267
+ * @param {string} cwd
268
+ * @param {string} slug
269
+ */
270
+ export function refuseThemeParse(cwd: string, slug: string): void;
207
271
  /**
208
272
  * Refuse a build whose theme source cannot carry the settings, naming the
209
273
  * lines that put it back.
@@ -224,6 +288,15 @@ export function buildTheme(ctx: Ctx, slug: string, data: ThemeData): Promise<{
224
288
  lifted: string[];
225
289
  notes: string[];
226
290
  }>;
291
+ /**
292
+ * Why the built outputs differ from what the theme builds now: one that is
293
+ * missing or changed by hand, found the way `compile --check` finds it
294
+ * (the same build, compared and not written), or null when they match.
295
+ * @param {Ctx} ctx
296
+ * @param {string} slug
297
+ * @returns {Promise<string | null>}
298
+ */
299
+ export function outputsDrift(ctx: Ctx, slug: string): Promise<string | null>;
227
300
  /**
228
301
  * Resolved tokens of the built theme in both modes.
229
302
  * @param {Ctx} ctx
@@ -299,12 +372,38 @@ export function radiusTokenOf(ctx: Ctx, part: string, when?: string): string;
299
372
  export function clearNewMarker(dir: string): void;
300
373
  /**
301
374
  * 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.
375
+ * button, link or tab with aria-disabled (it stays focusable). A form
376
+ * control styled on a wrapper (a typeahead, a complex selector) has its
377
+ * input or button inside marked, so it also matches a disabled form
378
+ * control inside it (never a list row); an action part that holds
379
+ * children (a button group, a segmented control) never does, so one
380
+ * disabled child never makes the whole part look disabled.
304
381
  * @param {string} state
382
+ * @param {boolean} [wrapsControl]
305
383
  * @returns {string}
306
384
  */
307
- export function stateKey(state: string): string;
385
+ export function stateKey(state: string, wrapsControl?: boolean): string;
386
+ /**
387
+ * The component docs of a part: its own component's, and the one named like
388
+ * the part (tab is Tab, under TabList), each with its name, for the ones the
389
+ * project has.
390
+ * @param {Ctx} ctx
391
+ * @param {string} part
392
+ * @returns {Array<{name: string, doc: any}>}
393
+ */
394
+ export function partComponentDocs(ctx: Ctx, part: string): Array<{
395
+ name: string;
396
+ doc: any;
397
+ }>;
398
+ /**
399
+ * Whether a part's styled element wraps one control: its component (or the
400
+ * one named like the part) is a form control (Core's own category) that
401
+ * takes a disabled prop. An action part that holds children (a button
402
+ * group) never does.
403
+ * @param {Ctx} ctx
404
+ * @param {string} target
405
+ */
406
+ export function wrapsOneControl(ctx: Ctx, target: string): boolean;
308
407
  /**
309
408
  * The whole-theme radius tokens a generated settings module writes, or null
310
409
  * when it writes none.
@@ -358,6 +457,18 @@ export function settingsStamp(data: ThemeData): string;
358
457
  * @returns {string | null}
359
458
  */
360
459
  export function staleBuild(cwd: string, slug: string, data: ThemeData): string | null;
460
+ /**
461
+ * Every file the editor's build of a theme writes, the one list staleness
462
+ * reads: the generated settings module, the built stylesheet, module and
463
+ * their types, and, with a color dial set, the generated color files.
464
+ * @param {string} cwd
465
+ * @param {string} slug
466
+ * @param {ThemeData} data
467
+ * @param {boolean} [some] the files a build writes only for some themes
468
+ * (the variants types, for a theme with component variants) instead
469
+ * @returns {string[]}
470
+ */
471
+ export function builtFiles(cwd: string, slug: string, data: ThemeData, some?: boolean): string[];
361
472
  /**
362
473
  * A theme's undo history: the settings text before each change, oldest
363
474
  * first, and how many damaged steps were dropped. Every step after the
@@ -400,7 +511,7 @@ export function fontPackages(ctx: Ctx, data: ThemeData): {
400
511
  installed: boolean;
401
512
  of: Setting;
402
513
  }[];
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 */
514
+ /** @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
515
  /** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
405
516
  /** @typedef {import('./_parts.mjs').TextPair} TextPair */
406
517
  /** What a theme name may be, in words. */
@@ -489,6 +600,12 @@ export type Ctx = {
489
600
  alpha?: string;
490
601
  }>> | null;
491
602
  keepRadii?: Record<string, string> | null;
603
+ derived?: Record<string, Array<{
604
+ property: string;
605
+ vars?: string[];
606
+ replaces?: boolean;
607
+ expand?: string;
608
+ }>>;
492
609
  };
493
610
  export type PaintSide = import("./_parts.mjs").PaintSide;
494
611
  export type TextPair = import("./_parts.mjs").TextPair;