@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
@@ -1,32 +1,6 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /**
5
- * One change a command makes.
6
- * @typedef {object} Step
7
- * @property {'set' | 'undo'} verb
8
- * @property {string} thing
9
- * @property {string} [value]
10
- * @property {string} [on]
11
- * @property {string} [when]
12
- * @property {string} [state]
13
- * @property {string} [mode]
14
- */
15
- /**
16
- * The theme the commands of one answer are for, and the checks they pass.
17
- * @typedef {object} HowTheme
18
- * @property {string} slug
19
- * @property {boolean} exists - false when the app has no theme: the commands name {@link EXAMPLE_THEME} and the answer starts with `new`.
20
- * @property {string | null} previewDamage - why the in-app preview's record is damaged and how to fix it, or null.
21
- * @property {string[]} themes - Every theme the editor made in the app.
22
- * @property {string | null} note - Which theme the commands are for when the app has several, or that it has none.
23
- * @property {'named' | 'only' | 'last-changed' | 'none'} chosenBy - How the theme was picked.
24
- * @property {number} undoSteps - How many changes `undo` can step back.
25
- * @property {boolean} bodyFontReachesHeadings - Whether `font X --on body` also changes the heading font in this release.
26
- * @property {import('./_settings.mjs').ThemeData} data
27
- * @property {{light: Record<string, string>, dark: Record<string, string>}} base
28
- * @property {(steps: Step[]) => {ok: true} | {ok: false, why: string}} check
29
- */
30
4
  /**
31
5
  * The theme an answer's commands are for: the one named, the only one, or
32
6
  * the one changed last; with none, a theme the answer first makes.
@@ -74,6 +48,10 @@ export type Step = {
74
48
  when?: string | undefined;
75
49
  state?: string | undefined;
76
50
  mode?: string | undefined;
51
+ /**
52
+ * the one member of a group, not the group
53
+ */
54
+ only?: boolean | undefined;
77
55
  };
78
56
  /**
79
57
  * The theme the commands of one answer are for, and the checks they pass.
@@ -113,6 +91,13 @@ export type HowTheme = {
113
91
  light: Record<string, string>;
114
92
  dark: Record<string, string>;
115
93
  };
94
+ /**
95
+ * - The theme's own values: the base's with its settings applied.
96
+ */
97
+ own?: {
98
+ light: Record<string, string>;
99
+ dark: Record<string, string>;
100
+ } | undefined;
116
101
  check: (steps: Step[]) => {
117
102
  ok: true;
118
103
  } | {
@@ -36,6 +36,7 @@ export const EXAMPLE_THEME = 'my-theme';
36
36
  * @property {string} [when]
37
37
  * @property {string} [state]
38
38
  * @property {string} [mode]
39
+ * @property {boolean} [only] the one member of a group, not the group
39
40
  */
40
41
 
41
42
  /**
@@ -51,9 +52,32 @@ export const EXAMPLE_THEME = 'my-theme';
51
52
  * @property {boolean} bodyFontReachesHeadings - Whether `font X --on body` also changes the heading font in this release.
52
53
  * @property {import('./_settings.mjs').ThemeData} data
53
54
  * @property {{light: Record<string, string>, dark: Record<string, string>}} base
55
+ * @property {{light: Record<string, string>, dark: Record<string, string>}} [own] - The theme's own values: the base's with its settings applied.
54
56
  * @property {(steps: Step[]) => {ok: true} | {ok: false, why: string}} check
55
57
  */
56
58
 
59
+ /**
60
+ * The theme's own token values in each mode: the base theme's, with the
61
+ * theme's settings applied (a whole-theme corners setting, an exact
62
+ * token), as `compile` builds them.
63
+ * @param {any} compiled
64
+ * @param {{light: Record<string, string>, dark: Record<string, string>}} base
65
+ * @returns {{light: Record<string, string>, dark: Record<string, string>}}
66
+ */
67
+ function ownTokens(compiled, base) {
68
+ const out = {light: {...base.light}, dark: {...base.dark}};
69
+ for (const [k, v] of Object.entries(compiled?.tokens ?? {})) {
70
+ const pair = Array.isArray(v)
71
+ ? v
72
+ : v && typeof v === 'object'
73
+ ? [/** @type {any} */ (v).light, /** @type {any} */ (v).dark]
74
+ : [v, v];
75
+ if (typeof pair[0] === 'string') out.light[k] = pair[0];
76
+ if (typeof pair[1] === 'string') out.dark[k] = pair[1];
77
+ }
78
+ return out;
79
+ }
80
+
57
81
  /**
58
82
  * The theme an answer's commands are for: the one named, the only one, or
59
83
  * the one changed last; with none, a theme the answer first makes.
@@ -155,6 +179,7 @@ export async function howTheme(ctx, cwd, name) {
155
179
  : 'last-changed',
156
180
  data: theme,
157
181
  base,
182
+ own: ownTokens(compileTheme(ctx, theme, base), base),
158
183
  undoSteps: exists
159
184
  ? readHistory(themeFiles(cwd, slug).history).steps.length
160
185
  : 0,
@@ -162,8 +187,10 @@ export async function howTheme(ctx, cwd, name) {
162
187
  check(steps) {
163
188
  /** @type {import('./_settings.mjs').ThemeData} */
164
189
  const d = JSON.parse(JSON.stringify(theme));
190
+ // The checks set runs read the base theme's values (the corner rungs).
191
+ const checkCtx = /** @type {any} */ ({...ctx, base});
165
192
  try {
166
- for (const st of steps) apply(ctx, slug, d, st);
193
+ for (const st of steps) apply(checkCtx, slug, d, st);
167
194
  if (compiled(d) === before)
168
195
  return {
169
196
  ok: false,
@@ -197,7 +224,7 @@ function apply(ctx, slug, d, st) {
197
224
  d,
198
225
  st.thing,
199
226
  st.value,
200
- {on: st.on, when: st.when, state: st.state, mode: st.mode},
227
+ {on: st.on, when: st.when, state: st.state, mode: st.mode, only: st.only},
201
228
  unset,
202
229
  );
203
230
  if (!unset && s.thing === 'mode') {
@@ -240,6 +267,7 @@ export function render(st, slug) {
240
267
  ...(st.when ? ['--when', st.when] : []),
241
268
  ...(st.state ? ['--state', st.state] : []),
242
269
  ...(st.mode ? ['--mode', st.mode] : []),
270
+ ...(st.only ? ['--only'] : []),
243
271
  ].join(' ');
244
272
  }
245
273
 
@@ -1,6 +1,13 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * The part or group a plain word names, as how reads it (`checkboxes` is
6
+ * the checks group, `panels` the containers), or null.
7
+ * @param {string} word
8
+ * @returns {string | null}
9
+ */
10
+ export function partForWord(word: string): string | null;
4
11
  /**
5
12
  * A CSS property the clause names, with its value kept whole ("caret-color
6
13
  * #2563eb", "transition: background-color 150ms ease", "border-radius 12px