@astryxdesign/cli 0.7.15-canary.gf890983 → 0.7.15

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 (115) hide show
  1. package/CHANGELOG.md +353 -3
  2. package/api/doctor/_adapter.d.mts +2 -1
  3. package/api/doctor/_adapter.mjs +6 -1
  4. package/api/doctor/doctor.mjs +2 -2
  5. package/api/doctor/theme-checks.mjs +56 -21
  6. package/api/integration/add-helpers.mjs +5 -0
  7. package/api/integration/add-theme.mjs +15 -110
  8. package/api/theme/_adapter.d.mts +37 -5
  9. package/api/theme/_adapter.mjs +363 -50
  10. package/api/theme/_fork.d.mts +90 -0
  11. package/api/theme/_fork.mjs +246 -0
  12. package/api/theme/build/build.d.mts +25 -1
  13. package/api/theme/build/build.mjs +352 -41
  14. package/api/theme/eject/eject.mjs +36 -15
  15. package/api/theme/list/list.mjs +3 -6
  16. package/api/theme/palette/generate/generator.d.mts +13 -0
  17. package/api/theme/palette/generate/generator.mjs +32 -2
  18. package/api/theme/targets/targets.mjs +10 -3
  19. package/api/theme/template/template.mjs +48 -2
  20. package/api/theme/theme.type.d.mts +8 -0
  21. package/api/theme/theme.type.mjs +5 -1
  22. package/api/theme/themeBuild.doc.mjs +2 -2
  23. package/api/theme/themeRemove.doc.mjs +5 -2
  24. package/api/theme/themeTemplate.doc.mjs +2 -2
  25. package/api/theme/themeUse.doc.mjs +8 -2
  26. package/api/theme-edit/_adapter.mjs +157 -36
  27. package/api/theme-edit/_catalog.d.mts +1 -6
  28. package/api/theme-edit/_catalog.mjs +5 -268
  29. package/api/theme-edit/_check.d.mts +3 -1
  30. package/api/theme-edit/_check.mjs +733 -308
  31. package/api/theme-edit/_color.d.mts +19 -0
  32. package/api/theme-edit/_color.mjs +277 -33
  33. package/api/theme-edit/_compiler.d.mts +1 -0
  34. package/api/theme-edit/_compiler.mjs +25 -0
  35. package/api/theme-edit/_context.d.mts +2 -0
  36. package/api/theme-edit/_context.mjs +83 -9
  37. package/api/theme-edit/_css.d.mts +84 -0
  38. package/api/theme-edit/_css.mjs +700 -0
  39. package/api/theme-edit/_edit.mjs +370 -85
  40. package/api/theme-edit/_how-commands.d.mts +5 -0
  41. package/api/theme-edit/_how-commands.mjs +20 -13
  42. package/api/theme-edit/_how-question.d.mts +29 -0
  43. package/api/theme-edit/_how-question.mjs +1573 -182
  44. package/api/theme-edit/_how.mjs +306 -22
  45. package/api/theme-edit/_overview.mjs +2 -7
  46. package/api/theme-edit/_palette.d.mts +27 -5
  47. package/api/theme-edit/_palette.mjs +231 -97
  48. package/api/theme-edit/_parts.d.mts +42 -10
  49. package/api/theme-edit/_parts.mjs +224 -69
  50. package/api/theme-edit/_preview-app.d.mts +8 -0
  51. package/api/theme-edit/_preview-app.mjs +549 -96
  52. package/api/theme-edit/_preview.d.mts +7 -16
  53. package/api/theme-edit/_preview.mjs +77 -84
  54. package/api/theme-edit/_project.d.mts +20 -1
  55. package/api/theme-edit/_project.mjs +43 -13
  56. package/api/theme-edit/_settings.d.mts +96 -20
  57. package/api/theme-edit/_settings.mjs +646 -141
  58. package/api/theme-edit/_tables.d.mts +18 -12
  59. package/api/theme-edit/_tables.mjs +144 -147
  60. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  61. package/api/theme-edit/theme-edit.type.mjs +3 -1
  62. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  63. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
  64. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  65. package/api/theme-edit/themeEditPreviewList.doc.mjs +2 -2
  66. package/api/theme-edit/themeEditSet.doc.mjs +1 -1
  67. package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
  68. package/assets/docs/tree/publishing.doc.mjs +1 -0
  69. package/assets/docs.generated.json +2 -2
  70. package/assets/self-audit.generated.json +1 -1
  71. package/clients/cli/build-id.generated.json +1 -1
  72. package/clients/cli/commands/experimental/index.mjs +10 -10
  73. package/clients/cli/commands/experimental/theme.mjs +22 -3
  74. package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
  75. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -3
  76. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
  77. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  78. package/clients/cli/commands/integration.mjs +8 -0
  79. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  80. package/clients/cli/commands/theme-list.doc.mjs +1 -1
  81. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  82. package/clients/cli/commands/theme.mjs +325 -48
  83. package/clients/cli/index.mjs +18 -3
  84. package/clients/cli/lib/cli-error.mjs +118 -3
  85. package/clients/cli/manifest.generated.json +1 -1
  86. package/foundation/config/project.mjs +34 -8
  87. package/foundation/config/theme-state.d.mts +16 -0
  88. package/foundation/config/theme-state.mjs +84 -13
  89. package/foundation/discovery/template-needs.d.mts +13 -0
  90. package/foundation/discovery/template-needs.mjs +30 -15
  91. package/foundation/discovery/theme-discovery.mjs +14 -2
  92. package/foundation/discovery/theme-imports.d.mts +16 -0
  93. package/foundation/discovery/theme-imports.mjs +30 -2
  94. package/foundation/doc-compiler/import.mjs +10 -4
  95. package/foundation/fs/gather-cache.mjs +82 -23
  96. package/foundation/fs/jiti-cache.d.mts +21 -0
  97. package/foundation/fs/jiti-cache.mjs +66 -0
  98. package/foundation/fs/module-loader.mjs +7 -2
  99. package/foundation/integrations/autolink.d.mts +1 -24
  100. package/foundation/integrations/autolink.mjs +7 -60
  101. package/foundation/integrations/declared-dependencies.d.mts +27 -0
  102. package/foundation/integrations/declared-dependencies.mjs +73 -0
  103. package/foundation/integrations/may-have-integrations.d.mts +8 -0
  104. package/foundation/integrations/may-have-integrations.mjs +47 -0
  105. package/foundation/release/cache.d.mts +21 -2
  106. package/foundation/release/cache.mjs +48 -8
  107. package/foundation/release/folder-lock.d.mts +7 -0
  108. package/foundation/release/folder-lock.mjs +60 -26
  109. package/foundation/release/lock-lease.d.mts +2 -1
  110. package/foundation/release/lock-lease.mjs +7 -2
  111. package/foundation/response/error-codes.doc.mjs +1 -1
  112. package/foundation/response/response-types.doc.mjs +4 -4
  113. package/package.json +6 -6
  114. package/api/theme-edit/_css-properties.d.mts +0 -10
  115. package/api/theme-edit/_css-properties.mjs +0 -556
@@ -100,6 +100,12 @@ export function withoutBadValues(data: ThemeData): {
100
100
  data: ThemeData;
101
101
  dropped: Setting[];
102
102
  };
103
+ /**
104
+ * What is wrong with a setting's value, or null.
105
+ * @param {any} s
106
+ * @returns {string | null}
107
+ */
108
+ export function valueProblem(s: any): string | null;
103
109
  /** One line for a setting. @param {Setting} s */
104
110
  export function describe(s: Setting): string;
105
111
  /**
@@ -138,6 +144,25 @@ export function fontOf(value: string): {
138
144
  * @param {boolean} [spaced]
139
145
  */
140
146
  export function cssFamily(name: string, spaced?: boolean): string;
147
+ /**
148
+ * Whether a generated module is as the editor wrote it: true, false for a
149
+ * hand edit, null for a module with no hash (an earlier editor's).
150
+ * @param {string} text
151
+ * @returns {boolean | null}
152
+ */
153
+ export function moduleUnedited(text: string): boolean | null;
154
+ /**
155
+ * The palette stops each token reads in a generated settings module, as
156
+ * written there (`palette.accent.light[85]`, with ` + 'aa'` for a
157
+ * see-through one): `[light, dark]` per token.
158
+ * @param {string} source
159
+ * @returns {Record<string, Record<'light' | 'dark', {family: string, stop: number, alpha?: string}>>}
160
+ */
161
+ export function stopsIn(source: string): Record<string, Record<"light" | "dark", {
162
+ family: string;
163
+ stop: number;
164
+ alpha?: string;
165
+ }>>;
141
166
  /**
142
167
  * The settings, as a `defineTheme` object.
143
168
  * @param {Ctx} ctx
@@ -222,6 +247,12 @@ export function contrastProblems(ctx: Ctx, data: ThemeData, res: {
222
247
  light: Record<string, string>;
223
248
  dark: Record<string, string>;
224
249
  }): Promise<string[]>;
250
+ /**
251
+ * Whether parsed settings have the shape the editor reads: an object with a
252
+ * list of settings.
253
+ * @param {any} data
254
+ */
255
+ export function settingsShapeOk(data: any): boolean;
225
256
  /**
226
257
  * The value the base theme itself gives a part's property where a setting
227
258
  * applies (its variant and state), as the build keys part styles; null
@@ -240,6 +271,47 @@ export function baseComponent(base: {
240
271
  when?: string;
241
272
  state?: string;
242
273
  }): string | null;
274
+ /**
275
+ * The focus state a part's own styles key on: a part whose styled element
276
+ * is a wrapper (a text input's box) shows focus only through
277
+ * `focus-within`; null when it keys on none.
278
+ * @param {Ctx} ctx
279
+ * @param {string} part
280
+ * @returns {string | null}
281
+ */
282
+ export function focusStateOf(ctx: Ctx, part: string): string | null;
283
+ /**
284
+ * The radius token a part's resting corners read. A part the census saw
285
+ * closed (a menu, a popover) has none recorded: a container or menu reads
286
+ * the container radius, like every Core surface; any other part reads the
287
+ * element radius.
288
+ * @param {Ctx} ctx
289
+ * @param {string} part
290
+ * @param {string} [when]
291
+ * @returns {string}
292
+ */
293
+ export function radiusTokenOf(ctx: Ctx, part: string, when?: string): string;
294
+ /**
295
+ * Remove a `new` marker from a theme folder whose settings are whole: the
296
+ * `new` that left it made the theme, and nothing is left to finish.
297
+ * @param {string} dir
298
+ */
299
+ export function clearNewMarker(dir: string): void;
300
+ /**
301
+ * 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.
304
+ * @param {string} state
305
+ * @returns {string}
306
+ */
307
+ export function stateKey(state: string): string;
308
+ /**
309
+ * The whole-theme radius tokens a generated settings module writes, or null
310
+ * when it writes none.
311
+ * @param {string} source
312
+ * @returns {Record<string, string> | null}
313
+ */
314
+ export function radiiIn(source: string): Record<string, string> | null;
243
315
  /**
244
316
  * The radius, in px, the build writes for a radius token at a corners value
245
317
  * (a rung, or a size). The derived radii keep the base theme's own
@@ -256,6 +328,12 @@ export function baseComponent(base: {
256
328
  export function radiusAt(base: {
257
329
  light: Record<string, string>;
258
330
  }, value: string, token: string): number;
331
+ /**
332
+ * Whether a file is a module the editor generated (its first line is the
333
+ * editor's header).
334
+ * @param {string} file
335
+ */
336
+ export function madeByEditor(file: string): boolean;
259
337
  /**
260
338
  * Refuse a link anywhere the editor reads or writes a theme: `themes/`, the
261
339
  * theme folder, and every file and folder in it. The editor writes the
@@ -270,15 +348,6 @@ export function refuseLinks(cwd: string, slug: string): void;
270
348
  * @param {ThemeData} data
271
349
  */
272
350
  export function settingsStamp(data: ThemeData): string;
273
- /**
274
- * Whether the theme's build was made, whole, from these settings by this
275
- * CLI (a command stopped mid-build, or settings edited by hand, leave it
276
- * behind).
277
- * @param {string} cwd
278
- * @param {string} slug
279
- * @param {ThemeData} data
280
- */
281
- export function buildCurrent(cwd: string, slug: string, data: ThemeData): boolean;
282
351
  /**
283
352
  * Why the theme's build does not match its settings, in words, or null when
284
353
  * it does: a file missing, another CLI version, settings changed since the
@@ -289,12 +358,6 @@ export function buildCurrent(cwd: string, slug: string, data: ThemeData): boolea
289
358
  * @returns {string | null}
290
359
  */
291
360
  export function staleBuild(cwd: string, slug: string, data: ThemeData): string | null;
292
- /**
293
- * Write a file whole: a new file beside it, renamed into place.
294
- * @param {string} file
295
- * @param {string} text
296
- */
297
- export function writeAtomic(file: string, text: string): void;
298
361
  /**
299
362
  * A theme's undo history: the settings text before each change, oldest
300
363
  * first, and how many damaged steps were dropped. Every step after the
@@ -313,12 +376,14 @@ export function readHistory(file: string): {
313
376
  * @param {Ctx} ctx
314
377
  * @param {string} slug
315
378
  * @param {ThemeData} data
316
- * @param {{history: boolean, historyAfter?: string[]}} options
317
- * `historyAfter`: the history to write with the change (a step back pops it)
379
+ * @param {{history: boolean, historyAfter?: string[], radii?: Record<string, string> | null}} options
380
+ * `historyAfter`: the history to write with the change (a step back pops it);
381
+ * `radii`: the whole-theme radii the step being restored was built with
318
382
  */
319
- export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history, historyAfter }: {
383
+ export function commitTheme(ctx: Ctx, slug: string, data: ThemeData, { history, historyAfter, radii }: {
320
384
  history: boolean;
321
385
  historyAfter?: string[];
386
+ radii?: Record<string, string> | null;
322
387
  }): Promise<{
323
388
  changed: string[];
324
389
  res: Record<"light" | "dark", Record<string, string>>;
@@ -333,13 +398,16 @@ export function fontPackages(ctx: Ctx, data: ThemeData): {
333
398
  pkg: string;
334
399
  family: string;
335
400
  installed: boolean;
401
+ of: Setting;
336
402
  }[];
337
- /** @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>}}} Ctx */
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 */
338
404
  /** @typedef {import('./_parts.mjs').PaintSide} PaintSide */
339
405
  /** @typedef {import('./_parts.mjs').TextPair} TextPair */
340
406
  /** What a theme name may be, in words. */
341
- export const NAME_RULE: "lowercase letters, digits and dashes, starting with a letter, 64 characters at most";
407
+ export const NAME_RULE: "lowercase letters, digits and dashes, starting with a letter, 64 characters at most, and not a name Windows reserves (con, prn, aux, nul, com1-com9, lpt1-lpt9)";
342
408
  export function slugOk(s: string): boolean;
409
+ export function windowsReserved(s: string): boolean;
410
+ export function slugFor(name: unknown): string;
343
411
  export function kebab(s: string): string;
344
412
  export function camel(s: string): string;
345
413
  export function shown(cwd: string, f: string): string;
@@ -347,6 +415,8 @@ export function keyOf(s: Setting): string;
347
415
  export function cornerPx(v: string): number;
348
416
  export function textPx(v: string): number;
349
417
  export function themeSource(slug: string): string;
418
+ /** The file a `new` keeps beside the files it writes until it is done. */
419
+ export const NEW_MARKER: ".astryx-new.json";
350
420
  /**
351
421
  * The files the editor writes for a theme, after `<slug>.`: the only ones a
352
422
  * change reads, hashes or puts back, and the only ones a stopped `new`
@@ -413,6 +483,12 @@ export type Ctx = {
413
483
  dark: Record<string, string>;
414
484
  components?: Record<string, any>;
415
485
  };
486
+ keepStops?: Record<string, Record<"light" | "dark", {
487
+ family: string;
488
+ stop: number;
489
+ alpha?: string;
490
+ }>> | null;
491
+ keepRadii?: Record<string, string> | null;
416
492
  };
417
493
  export type PaintSide = import("./_parts.mjs").PaintSide;
418
494
  export type TextPair = import("./_parts.mjs").TextPair;