@astryxdesign/cli 0.7.0-canary.693da50 → 0.7.0-canary.6ecd417

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 (241) hide show
  1. package/README.md +79 -84
  2. package/api/build/build.mjs +9 -0
  3. package/api/component/_adapter.d.mts +2 -0
  4. package/api/component/_adapter.mjs +3 -1
  5. package/api/component/component.doc.mjs +5 -1
  6. package/api/docs/compiled-topics.test.mjs +16 -0
  7. package/api/doctor/doctor.doc.mjs +1 -1
  8. package/api/doctor/doctor.test.mjs +28 -0
  9. package/api/doctor/theme-checks.mjs +10 -10
  10. package/api/doctor/theme-checks.test.mjs +5 -4
  11. package/api/gap-report/gap-report.doc.mjs +1 -1
  12. package/api/gap-report/gap-report.mjs +15 -0
  13. package/api/gap-report/gap-report.test.mjs +1 -1
  14. package/api/index.d.mts +0 -2
  15. package/api/index.mjs +0 -2
  16. package/api/init/init.doc.mjs +5 -1
  17. package/api/init/init.mjs +22 -0
  18. package/api/init/init.type.d.mts +4 -1
  19. package/api/init/init.type.mjs +1 -1
  20. package/api/init/remove/remove.mjs +8 -3
  21. package/api/init/remove/remove.test.mjs +12 -0
  22. package/api/init/run/run.d.mts +1 -1
  23. package/api/init/run/run.mjs +3 -3
  24. package/api/integration/pack-check.test.mjs +8 -0
  25. package/api/integration/validate-integration.d.mts +4 -0
  26. package/api/integration/validate-integration.mjs +5 -2
  27. package/api/integration/validateIntegration.doc.mjs +1 -1
  28. package/api/json/index.ts +0 -1
  29. package/api/search/search.doc.mjs +1 -1
  30. package/api/search/search.mjs +1 -1
  31. package/api/search/search.test.mjs +1 -1
  32. package/api/search/search.type.d.mts +1 -1
  33. package/api/search/search.type.mjs +1 -1
  34. package/api/template/list/list.mjs +23 -2
  35. package/api/template/list/list.test.mjs +52 -0
  36. package/api/template/template-integration.test.mjs +37 -100
  37. package/api/template/template.doc.mjs +8 -3
  38. package/api/template/template.mjs +45 -0
  39. package/api/template/template.type.mjs +1 -1
  40. package/api/theme/_adapter.mjs +3 -3
  41. package/api/theme/add/add.d.mts +11 -5
  42. package/api/theme/add/add.mjs +19 -192
  43. package/api/theme/add/add.test.mjs +68 -258
  44. package/api/theme/add/add.types.test.mjs +0 -1
  45. package/api/theme/build/build.d.mts +3 -4
  46. package/api/theme/build/build.mjs +26 -65
  47. package/api/theme/build/build.test.mjs +11 -24
  48. package/api/theme/build/family.mjs +1 -1
  49. package/api/theme/eject/eject.copy-compat.test.mjs +168 -0
  50. package/api/theme/integration-themes.test.mjs +3 -3
  51. package/api/theme/remove/remove.test.mjs +1 -1
  52. package/api/theme/targets/targets.test.mjs +0 -4
  53. package/api/theme/template/template.mjs +1 -1
  54. package/api/theme/theme.type.d.mts +1 -30
  55. package/api/theme/theme.type.mjs +3 -13
  56. package/api/theme/themeAdd.doc.mjs +19 -27
  57. package/api/theme/themeTargets.doc.mjs +3 -4
  58. package/api/theme/themeTemplate.doc.mjs +1 -1
  59. package/api/theme/use/use.test.mjs +1 -1
  60. package/api/upgrade/upgrade.doc.mjs +1 -1
  61. package/api/upgrade/upgrade.mjs +19 -0
  62. package/assets/codemods/transforms/next/__tests__/migrate-deprecated-theme-surface.test.mjs +322 -0
  63. package/assets/codemods/transforms/next/__tests__/migrate-field-input-styling.test.mjs +108 -0
  64. package/assets/codemods/transforms/next/__tests__/preserve-bottom-sheet-content-padding.test.mjs +178 -0
  65. package/assets/codemods/transforms/next/__tests__/validate-data-token-ownership.test.mjs +84 -0
  66. package/assets/codemods/transforms/next/index.mjs +35 -1
  67. package/assets/codemods/transforms/next/migrate-deprecated-theme-surface-v0.6-data.mjs +229 -0
  68. package/assets/codemods/transforms/next/migrate-deprecated-theme-surface.mjs +624 -0
  69. package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
  70. package/assets/codemods/transforms/next/preserve-bottom-sheet-content-padding.mjs +242 -0
  71. package/assets/codemods/transforms/next/validate-data-token-ownership.mjs +102 -0
  72. package/assets/codemods/transforms/v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs +38 -18
  73. package/assets/docs/author-a-theme.doc.mjs +5 -5
  74. package/assets/docs/getting-started.doc.mjs +2 -2
  75. package/assets/docs/spacing.doc.mjs +2 -2
  76. package/assets/docs/theme.doc.dense.mjs +1 -1
  77. package/assets/docs/theme.doc.mjs +2 -2
  78. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  79. package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
  80. package/assets/docs/tree/fonts-and-assets.doc.mjs +3 -3
  81. package/assets/docs/tree/styling-advanced.doc.mjs +21 -14
  82. package/assets/docs/tree/themes.doc.mjs +1 -1
  83. package/assets/docs/tree/tokens-data.doc.mjs +2 -2
  84. package/assets/docs/tree/tokens-spacing.doc.mjs +15 -15
  85. package/assets/docs/tree/tokens-usage.doc.mjs +1 -1
  86. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +2 -2
  87. package/assets/docs/tree/versioning.doc.mjs +1 -4
  88. package/assets/docs/use-a-theme.doc.mjs +16 -16
  89. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.tsx +1 -1
  90. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.tsx +1 -1
  91. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.tsx +1 -1
  92. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.tsx +1 -1
  93. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
  94. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
  95. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
  96. package/assets/templates/blocks/components/Dialog/DialogAdaptivePresentation.tsx +1 -1
  97. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  98. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
  99. package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
  100. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
  101. package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
  102. package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
  103. package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
  104. package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
  105. package/assets/templates/blocks/components/Slider/SliderFormattedValue.tsx +1 -1
  106. package/assets/templates/blocks/components/Slider/SliderRangeSlider.tsx +1 -1
  107. package/assets/templates/blocks/components/Slider/SliderShowcase.tsx +1 -1
  108. package/assets/templates/blocks/components/Slider/SliderWithMarks.tsx +1 -1
  109. package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -1
  110. package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -2
  111. package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -1
  112. package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -1
  113. package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -1
  114. package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -2
  115. package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -1
  116. package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -4
  117. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
  118. package/assets/templates/pages/canvas-editor/page.tsx +2 -2
  119. package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
  120. package/assets/templates/pages/payment-form/page.tsx +1 -1
  121. package/assets/templates/pages/table-filter/page.tsx +11 -6
  122. package/assets/templates/pages/table-inbox/page.tsx +3 -1
  123. package/assets/templates/pages/theme-showcase/page.tsx +2 -2
  124. package/assets/templates/themes/butter/butterTheme.ts +12 -0
  125. package/assets/templates/themes/chocolate/chocolateTheme.ts +12 -0
  126. package/assets/templates/themes/matcha/matchaTheme.ts +14 -14
  127. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +10 -9
  128. package/assets/templates/themes/neutral/neutralTheme.ts +12 -0
  129. package/assets/templates/themes/stone/stoneTheme.ts +12 -0
  130. package/assets/templates/themes/y2k/y2kTheme.ts +10 -10
  131. package/assets/theme.template.ts +1 -1
  132. package/authoring/debug/type.ts +2 -2
  133. package/authoring/doctypes/base/type.ts +0 -9
  134. package/authoring/integration/integration.doc.mjs +1 -1
  135. package/clients/cli/command-result-coverage.test.mjs +1 -1
  136. package/clients/cli/commands/build-theme.adaptations.test.mjs +4 -0
  137. package/clients/cli/commands/build-theme.ascii-output.test.mjs +35 -8
  138. package/clients/cli/commands/build-theme.color-scheme.test.mjs +10 -6
  139. package/clients/cli/commands/build-theme.data-tokens.test.mjs +23 -75
  140. package/clients/cli/commands/build-theme.mjs +31 -67
  141. package/clients/cli/commands/build-theme.registry.test.mjs +0 -10
  142. package/clients/cli/commands/build.doc.mjs +1 -1
  143. package/clients/cli/commands/build.mjs +1 -1
  144. package/clients/cli/commands/component-ownership.test.mjs +2 -2
  145. package/clients/cli/commands/debug-result-summary.test.mjs +0 -16
  146. package/clients/cli/commands/discover.mjs +2 -1
  147. package/clients/cli/commands/doctor.mjs +5 -2
  148. package/clients/cli/commands/empty-argument.test.mjs +16 -0
  149. package/clients/cli/commands/gap-report.doc.mjs +1 -1
  150. package/clients/cli/commands/gap-report.test.mjs +2 -2
  151. package/clients/cli/commands/init.doc.mjs +4 -4
  152. package/clients/cli/commands/init.flag-help.test.mjs +7 -10
  153. package/clients/cli/commands/init.next-steps.test.mjs +1 -1
  154. package/clients/cli/commands/integration.mjs +2 -1
  155. package/clients/cli/commands/option-pair-refusals.test.mjs +37 -0
  156. package/clients/cli/commands/search.test.mjs +1 -1
  157. package/clients/cli/commands/silent-success-refusals.test.mjs +15 -0
  158. package/clients/cli/commands/swizzle.mjs +4 -1
  159. package/clients/cli/commands/template.doc.mjs +4 -4
  160. package/clients/cli/commands/template.flag-help.test.mjs +18 -11
  161. package/clients/cli/commands/template.mjs +7 -1
  162. package/clients/cli/commands/text-json-parity.test.mjs +0 -17
  163. package/clients/cli/commands/theme-add-lifecycle.test.mjs +142 -49
  164. package/clients/cli/commands/theme-add.doc.mjs +10 -17
  165. package/clients/cli/commands/theme-list.behavior.test.mjs +2 -1
  166. package/clients/cli/commands/theme-targets.behavior.test.mjs +8 -6
  167. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  168. package/clients/cli/commands/theme.doc.mjs +2 -2
  169. package/clients/cli/commands/upgrade.doc.mjs +1 -1
  170. package/clients/cli/commands/upgrade.flag-help.test.mjs +7 -11
  171. package/clients/cli/commands/validate-nothing-exits-nonzero.test.mjs +67 -0
  172. package/clients/cli/index.mjs +0 -4
  173. package/clients/cli/lib/cli-error.mjs +19 -0
  174. package/clients/cli/lib/component-format.mjs +111 -57
  175. package/clients/cli/lib/component-format.test.mjs +28 -39
  176. package/clients/cli/lib/doc-text-ascii.test.mjs +5 -2
  177. package/clients/cli/lib/exit-codes.test.mjs +0 -7
  178. package/clients/cli/lib/json-shim.test.mjs +0 -24
  179. package/foundation/agent-docs/agent-docs.d.mts +2 -1
  180. package/foundation/agent-docs/agent-docs.mjs +6 -1
  181. package/foundation/agent-docs/app-theme-workflow.test.mjs +3 -0
  182. package/foundation/config/theme-state.mjs +3 -3
  183. package/foundation/debug/debug-fields.test.mjs +13 -35
  184. package/foundation/debug/event.mjs +13 -78
  185. package/foundation/debug/privacy-contract.test.mjs +20 -12
  186. package/foundation/debug/redact.d.mts +2 -2
  187. package/foundation/debug/redact.mjs +2 -2
  188. package/foundation/discovery/template-needs.mjs +93 -11
  189. package/foundation/discovery/template-needs.test.mjs +106 -3
  190. package/foundation/discovery/theme-imports.mjs +1 -1
  191. package/foundation/discovery/theming-targets.d.mts +1 -20
  192. package/foundation/discovery/theming-targets.mjs +1 -38
  193. package/foundation/discovery/theming-targets.test.mjs +9 -175
  194. package/foundation/doc-compiler/doc-loads.test.mjs +0 -12
  195. package/foundation/env/package-manager.d.mts +13 -0
  196. package/foundation/env/package-manager.mjs +106 -63
  197. package/foundation/response/error-codes.doc.mjs +1 -1
  198. package/foundation/response/response-types.doc.mjs +11 -31
  199. package/foundation/response/response-types.doc.test.mjs +36 -14
  200. package/foundation/response/response.doc.mjs +1 -1
  201. package/foundation/xle/browser.d.mts +2 -2
  202. package/foundation/xle/browser.mjs +2 -2
  203. package/foundation/xle/expand.mjs +1 -1
  204. package/foundation/xle/print.mjs +1 -1
  205. package/package.json +9 -9
  206. package/api/layout/_adapter.d.mts +0 -34
  207. package/api/layout/_adapter.mjs +0 -148
  208. package/api/layout/check/check.d.mts +0 -17
  209. package/api/layout/check/check.mjs +0 -41
  210. package/api/layout/expand/expand.d.mts +0 -23
  211. package/api/layout/expand/expand.mjs +0 -161
  212. package/api/layout/expand/expand.path-safety.test.mjs +0 -53
  213. package/api/layout/expand/expand.receipt.test.mjs +0 -74
  214. package/api/layout/grammar/grammar.d.mts +0 -14
  215. package/api/layout/grammar/grammar.mjs +0 -88
  216. package/api/layout/layout.d.mts +0 -6
  217. package/api/layout/layout.mjs +0 -17
  218. package/api/layout/layout.test.mjs +0 -297
  219. package/api/layout/layout.type.d.mts +0 -90
  220. package/api/layout/layout.type.mjs +0 -104
  221. package/api/layout/layoutCheck.doc.d.mts +0 -11
  222. package/api/layout/layoutCheck.doc.mjs +0 -85
  223. package/api/layout/layoutExpand.doc.d.mts +0 -11
  224. package/api/layout/layoutExpand.doc.mjs +0 -107
  225. package/api/layout/layoutGrammar.doc.d.mts +0 -11
  226. package/api/layout/layoutGrammar.doc.mjs +0 -57
  227. package/api/theme/add/add.binary.test.mjs +0 -157
  228. package/api/theme/add/add.rollback.test.mjs +0 -158
  229. package/api/theme/add/add.staging.test.mjs +0 -83
  230. package/clients/cli/commands/layout-check.doc.mjs +0 -67
  231. package/clients/cli/commands/layout-expand.doc.mjs +0 -87
  232. package/clients/cli/commands/layout-grammar.doc.mjs +0 -32
  233. package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +0 -140
  234. package/clients/cli/commands/layout.doc.mjs +0 -36
  235. package/clients/cli/commands/layout.error-codes.test.mjs +0 -66
  236. package/clients/cli/commands/layout.exit-parity.test.mjs +0 -41
  237. package/clients/cli/commands/layout.expand-receipt.test.mjs +0 -94
  238. package/clients/cli/commands/layout.mjs +0 -327
  239. package/clients/cli/commands/layout.path-help.test.mjs +0 -33
  240. package/clients/cli/commands/layout.stdin-cap.test.mjs +0 -47
  241. package/clients/cli/commands/layout.text-fields.test.mjs +0 -39
@@ -124,224 +124,7 @@ afterEach(() => {
124
124
  });
125
125
 
126
126
  describe('themeAdd', () => {
127
- it('keeps the released source-copy response and works without built exports', async () => {
128
- installTheme('ocean', '@acme/themes', {missingBuilt: true});
129
-
130
- const result = await themeAdd('ocean', {
131
- cwd: tmpDir,
132
- package: '@acme/themes',
133
- });
134
-
135
- expect(result).toMatchObject({
136
- type: 'theme.add',
137
- data: {
138
- slug: 'ocean',
139
- displayName: 'ocean',
140
- maintained: true,
141
- package: '@acme/themes',
142
- outputDir: 'src/themes/ocean',
143
- entry: 'oceanTheme.ts',
144
- exportName: 'oceanTheme',
145
- files: ['oceanTheme.ts', 'oceanTheme.doc.mjs'],
146
- },
147
- meta: {
148
- deprecations: [
149
- {
150
- id: 'DEP-0005',
151
- replacements: ['theme eject', 'theme add --import'],
152
- },
153
- ],
154
- },
155
- });
156
- expect(
157
- fs.readFileSync(
158
- path.join(tmpDir, 'src/themes/ocean/oceanTheme.ts'),
159
- 'utf-8',
160
- ),
161
- ).toContain('export const oceanTheme');
162
- expect(
163
- fs.readFileSync(
164
- path.join(tmpDir, 'src/themes/ocean/oceanTheme.doc.mjs'),
165
- 'utf-8',
166
- ),
167
- ).toContain("name: 'ocean'");
168
- expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(
169
- false,
170
- );
171
- });
172
-
173
- it('keeps every released bundled copy receipt field and file', async () => {
174
- const result = await themeAdd('neutral', {cwd: tmpDir});
175
-
176
- expect(result.data).toEqual({
177
- slug: 'neutral',
178
- displayName: 'Neutral',
179
- maintained: true,
180
- package: '@astryxdesign/cli',
181
- outputDir: path.join('src', 'themes', 'neutral'),
182
- entry: 'neutralTheme.ts',
183
- exportName: 'neutralTheme',
184
- files: [
185
- 'neutralTheme.ts',
186
- 'icons.tsx',
187
- 'neutralPalettes.ts',
188
- 'neutralPalettes.generated.ts',
189
- 'neutralPaletteRefs.generated.ts',
190
- 'neutralPalettes.generated.receipt.json',
191
- 'palette.config.json',
192
- ],
193
- });
194
- expect(
195
- fs.readdirSync(path.join(tmpDir, 'src/themes/neutral')).sort(),
196
- ).toEqual([...result.data.files].sort());
197
- });
198
-
199
- it('keeps every relative import required by a copied theme', async () => {
200
- const result = await themeAdd('neutral', {cwd: tmpDir});
201
- const outputDir = path.join(tmpDir, result.data.outputDir);
202
- const relativeImports = /from\s+['"](\.\.?\/[^'"]+)['"]/gu;
203
-
204
- for (const file of result.data.files) {
205
- if (!/\.(?:ts|tsx|mjs)$/u.test(file)) continue;
206
- const source = fs.readFileSync(path.join(outputDir, file), 'utf-8');
207
- for (const [, specifier] of source.matchAll(relativeImports)) {
208
- const imported = path.resolve(outputDir, path.dirname(file), specifier);
209
- expect(
210
- fs.existsSync(imported) ||
211
- fs.existsSync(`${imported}.ts`) ||
212
- fs.existsSync(`${imported}.tsx`) ||
213
- fs.existsSync(`${imported}.mjs`),
214
- ).toBe(true);
215
- }
216
- }
217
- });
218
-
219
- it('strips the repository copyright header from copied text', async () => {
220
- const result = await themeAdd('neutral', {cwd: tmpDir});
221
- const first = path.join(
222
- tmpDir,
223
- result.data.outputDir,
224
- result.data.files[0],
225
- );
226
- expect(fs.readFileSync(first, 'utf-8')).not.toMatch(
227
- /Copyright \(c\) Meta Platforms/u,
228
- );
229
- });
230
-
231
- it('keeps case-insensitive copy lookup', async () => {
232
- const result = await themeAdd('Neutral', {cwd: tmpDir});
233
- expect(result.data.slug).toBe('neutral');
234
- });
235
-
236
- it('keeps an explicit copy target path', async () => {
237
- const result = await themeAdd('neutral', {
238
- cwd: tmpDir,
239
- targetPath: 'themes/mine',
240
- });
241
- expect(result.data.outputDir).toBe(path.join('themes', 'mine'));
242
- expect(
243
- fs.existsSync(path.join(tmpDir, 'themes', 'mine', result.data.files[0])),
244
- ).toBe(true);
245
- });
246
-
247
- it('keeps unknown-theme errors on the copy path', async () => {
248
- await expect(
249
- themeAdd('does-not-exist', {cwd: tmpDir}),
250
- ).rejects.toMatchObject({code: 'ERR_UNKNOWN_THEME'});
251
- });
252
-
253
- it('keeps the copy overwrite guard and explicit replacement', async () => {
254
- await themeAdd('neutral', {cwd: tmpDir});
255
- await expect(themeAdd('neutral', {cwd: tmpDir})).rejects.toMatchObject({
256
- code: 'ERR_FILE_EXISTS',
257
- });
258
- await expect(
259
- themeAdd('neutral', {cwd: tmpDir, overwrite: true}),
260
- ).resolves.toMatchObject({type: 'theme.add'});
261
- });
262
-
263
- it('keeps copy path traversal protection', async () => {
264
- await expect(
265
- themeAdd('neutral', {cwd: tmpDir, targetPath: '../escape'}),
266
- ).rejects.toMatchObject({code: 'ERR_PATH_TRAVERSAL'});
267
- });
268
-
269
- it('keeps stable write errors when a copy target is a file', async () => {
270
- fs.writeFileSync(path.join(tmpDir, 'blocker'), 'x');
271
- await expect(
272
- themeAdd('neutral', {cwd: tmpDir, targetPath: 'blocker'}),
273
- ).rejects.toMatchObject({code: 'ERR_WRITE_FAILED'});
274
- });
275
-
276
- it('keeps stable write errors when the default copy ancestor is a file', async () => {
277
- fs.rmSync(path.join(tmpDir, 'src'), {recursive: true, force: true});
278
- fs.writeFileSync(path.join(tmpDir, 'src'), 'x');
279
- await expect(themeAdd('neutral', {cwd: tmpDir})).rejects.toMatchObject({
280
- code: 'ERR_WRITE_FAILED',
281
- });
282
- });
283
-
284
- it('keeps copying into an existing empty target directory', async () => {
285
- fs.mkdirSync(path.join(tmpDir, 'mydir'));
286
- const result = await themeAdd('neutral', {
287
- cwd: tmpDir,
288
- targetPath: 'mydir',
289
- });
290
- expect(result.data.outputDir).toBe('mydir');
291
- });
292
-
293
- it('excludes local themes from the copying lookup', async () => {
294
- installTheme();
295
- const localDir = path.join(tmpDir, 'src', 'themes', 'ocean');
296
- fs.mkdirSync(localDir, {recursive: true});
297
- fs.writeFileSync(
298
- path.join(localDir, 'oceanTheme.doc.mjs'),
299
- "/** @type {import('@astryxdesign/cli/authoring').ThemeDoc} */\nexport default {type: 'theme', name: 'ocean', displayName: 'Local ocean', description: 'Local.', maintained: false};\n",
300
- );
301
- fs.writeFileSync(
302
- path.join(localDir, 'oceanTheme.ts'),
303
- 'export const oceanTheme = {source: "local"};\n',
304
- );
305
-
306
- const result = await themeAdd('ocean', {
307
- cwd: tmpDir,
308
- targetPath: 'src/copied-ocean',
309
- });
310
-
311
- expect(result.type).toBe('theme.add');
312
- expect(result.data.package).toBe('@acme/themes');
313
- expect(
314
- fs.readFileSync(
315
- path.join(tmpDir, 'src', 'copied-ocean', 'oceanTheme.ts'),
316
- 'utf-8',
317
- ),
318
- ).not.toContain('source: "local"');
319
- });
320
-
321
- it.each([
322
- ['a target path', {targetPath: 'src/brand'}],
323
- ['overwrite', {overwrite: true}],
324
- ])('rejects --import with %s before writing', async (_label, copyOption) => {
325
- installTheme();
326
-
327
- await expect(
328
- themeAdd('ocean', {
329
- cwd: tmpDir,
330
- import: true,
331
- package: '@acme/themes',
332
- ...copyOption,
333
- }),
334
- ).rejects.toMatchObject({
335
- code: 'ERR_THEME_INVALID',
336
- message: expect.stringContaining('cannot be combined'),
337
- });
338
- expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(
339
- false,
340
- );
341
- expect(fs.existsSync(path.join(tmpDir, 'src/brand'))).toBe(false);
342
- });
343
-
344
- it('records and imports a built package theme without copying source', async () => {
127
+ it('records and imports a built package theme by default without copying source', async () => {
345
128
  installTheme();
346
129
  const packageBefore = fs.readFileSync(
347
130
  path.join(tmpDir, 'package.json'),
@@ -350,7 +133,6 @@ describe('themeAdd', () => {
350
133
 
351
134
  const result = await themeAdd('ocean', {
352
135
  cwd: tmpDir,
353
- import: true,
354
136
  package: '@acme/themes',
355
137
  });
356
138
 
@@ -388,11 +170,73 @@ describe('themeAdd', () => {
388
170
  });
389
171
  });
390
172
 
173
+ it('accepts import as a no-op and preserves the same theme.app behavior', async () => {
174
+ installTheme();
175
+
176
+ const first = await themeAdd('ocean', {
177
+ cwd: tmpDir,
178
+ import: true,
179
+ package: '@acme/themes',
180
+ });
181
+ expect(first.type).toBe('theme.app');
182
+ expect(first.data.change).toMatchObject({action: 'add', changed: true});
183
+
184
+ const moduleFile = path.join(tmpDir, 'src/astryx-themes.ts');
185
+ fs.appendFileSync(moduleFile, '\n// hand edit\n');
186
+ const repeated = await themeAdd('ocean', {
187
+ cwd: tmpDir,
188
+ package: '@acme/themes',
189
+ });
190
+
191
+ expect(repeated.type).toBe('theme.app');
192
+ expect(repeated.data.change.changed).toBe(false);
193
+ expect(fs.readFileSync(moduleFile, 'utf-8')).not.toContain('hand edit');
194
+ });
195
+
196
+ it.each([
197
+ ['a target path', {targetPath: 'src/brand'}],
198
+ ['overwrite true', {overwrite: true}],
199
+ ])(
200
+ 'rejects removed copy option %s before writing',
201
+ async (_label, copyOption) => {
202
+ installTheme();
203
+
204
+ await expect(
205
+ themeAdd('ocean', {
206
+ cwd: tmpDir,
207
+ package: '@acme/themes',
208
+ ...copyOption,
209
+ }),
210
+ ).rejects.toMatchObject({
211
+ code: 'ERR_THEME_INVALID',
212
+ message: expect.stringContaining('themeEject'),
213
+ });
214
+ expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(
215
+ false,
216
+ );
217
+ expect(fs.existsSync(path.join(tmpDir, 'src/brand'))).toBe(false);
218
+ },
219
+ );
220
+
221
+ it('accepts overwrite false as a compatibility no-op', async () => {
222
+ installTheme();
223
+
224
+ const result = await themeAdd('ocean', {
225
+ cwd: tmpDir,
226
+ package: '@acme/themes',
227
+ overwrite: false,
228
+ });
229
+
230
+ expect(result.type).toBe('theme.app');
231
+ expect(result.data.change).toMatchObject({action: 'add', changed: true});
232
+ expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(true);
233
+ expect(fs.existsSync(path.join(tmpDir, 'src/themes/ocean'))).toBe(false);
234
+ });
235
+
391
236
  it('keeps the released CLI selector while recording the import package', async () => {
392
237
  installBuiltThemePackage('neutral');
393
238
  const result = await themeAdd('neutral', {
394
239
  cwd: tmpDir,
395
- import: true,
396
240
  package: '@astryxdesign/cli',
397
241
  });
398
242
 
@@ -415,37 +259,13 @@ describe('themeAdd', () => {
415
259
  });
416
260
  });
417
261
 
418
- it('regenerates an already-added theme and reports no state change', async () => {
419
- installTheme();
420
- await themeAdd('ocean', {
421
- cwd: tmpDir,
422
- import: true,
423
- package: '@acme/themes',
424
- });
425
- const moduleFile = path.join(tmpDir, 'src/astryx-themes.ts');
426
- fs.appendFileSync(moduleFile, '\n// hand edit\n');
427
-
428
- const result = await themeAdd('ocean', {
429
- cwd: tmpDir,
430
- import: true,
431
- package: '@acme/themes',
432
- });
433
-
434
- expect(result.data.change.changed).toBe(false);
435
- expect(fs.readFileSync(moduleFile, 'utf-8')).not.toContain('hand edit');
436
- });
437
-
438
262
  it('fails before writing when the selected module path is authored', async () => {
439
263
  installTheme();
440
264
  const moduleFile = path.join(tmpDir, 'src/astryx-themes.ts');
441
265
  fs.writeFileSync(moduleFile, 'export const mine = true;\n');
442
266
 
443
267
  await expect(
444
- themeAdd('ocean', {
445
- cwd: tmpDir,
446
- import: true,
447
- package: '@acme/themes',
448
- }),
268
+ themeAdd('ocean', {cwd: tmpDir, package: '@acme/themes'}),
449
269
  ).rejects.toMatchObject({code: 'ERR_FILE_EXISTS'});
450
270
  expect(fs.readFileSync(moduleFile, 'utf-8')).toBe(
451
271
  'export const mine = true;\n',
@@ -459,7 +279,6 @@ describe('themeAdd', () => {
459
279
 
460
280
  const result = await themeAdd('ocean', {
461
281
  cwd: tmpDir,
462
- import: true,
463
282
  package: '@acme/themes',
464
283
  });
465
284
 
@@ -469,11 +288,7 @@ describe('themeAdd', () => {
469
288
 
470
289
  it('prefers a built local theme and switches the recorded owner', async () => {
471
290
  installTheme();
472
- await themeAdd('ocean', {
473
- cwd: tmpDir,
474
- import: true,
475
- package: '@acme/themes',
476
- });
291
+ await themeAdd('ocean', {cwd: tmpDir, package: '@acme/themes'});
477
292
  await themeEject('ocean', {cwd: tmpDir, package: '@acme/themes'});
478
293
  const localDir = path.join(tmpDir, 'src', 'themes', 'ocean');
479
294
  fs.writeFileSync(
@@ -482,7 +297,7 @@ describe('themeAdd', () => {
482
297
  );
483
298
  fs.writeFileSync(path.join(localDir, 'ocean.css'), '/* local css */\n');
484
299
 
485
- const result = await themeAdd('ocean', {cwd: tmpDir, import: true});
300
+ const result = await themeAdd('ocean', {cwd: tmpDir});
486
301
 
487
302
  expect(result).toMatchObject({
488
303
  type: 'theme.app',
@@ -518,7 +333,6 @@ describe('themeAdd', () => {
518
333
 
519
334
  const result = await themeAdd('ocean', {
520
335
  cwd: tmpDir,
521
- import: true,
522
336
  package: '@acme/themes',
523
337
  });
524
338
 
@@ -535,11 +349,7 @@ describe('themeAdd', () => {
535
349
  installTheme('ocean', '@acme/themes', {missingBuilt: true});
536
350
 
537
351
  await expect(
538
- themeAdd('ocean', {
539
- cwd: tmpDir,
540
- import: true,
541
- package: '@acme/themes',
542
- }),
352
+ themeAdd('ocean', {cwd: tmpDir, package: '@acme/themes'}),
543
353
  ).rejects.toMatchObject({
544
354
  code: 'ERR_THEME_INVALID',
545
355
  message: expect.stringMatching(
@@ -124,7 +124,6 @@ describe('generated app-theme module types', () => {
124
124
 
125
125
  await themeAdd('ocean', {
126
126
  cwd: project,
127
- import: true,
128
127
  package: '@acme/themes',
129
128
  });
130
129
  await themeAdd('stone', {cwd: project, import: true});
@@ -50,7 +50,7 @@ export function validateThemePrivateInputs(file: string, { cwd }?: {
50
50
  * Validate component overrides against one discovered target registry.
51
51
  *
52
52
  * @param {{components?: Record<string, Record<string, unknown>>, onDark?: {components?: Record<string, Record<string, unknown>>}, onLight?: {components?: Record<string, Record<string, unknown>>}, __onDark?: {components?: Record<string, Record<string, unknown>>}, __onLight?: {components?: Record<string, Record<string, unknown>>}}} themeDef
53
- * @param {{propsByKey: Record<string, string[]>, deprecatedByKey: Record<string, string>}} knownComponents
53
+ * @param {{propsByKey: Record<string, string[]>}} knownComponents
54
54
  * @returns {string[]}
55
55
  */
56
56
  export function validateComponentOverridesAgainstRegistry(themeDef: {
@@ -69,7 +69,6 @@ export function validateComponentOverridesAgainstRegistry(themeDef: {
69
69
  };
70
70
  }, knownComponents: {
71
71
  propsByKey: Record<string, string[]>;
72
- deprecatedByKey: Record<string, string>;
73
72
  }): string[];
74
73
  /**
75
74
  * Print the install snippet and font guidance once for a batch: the first
@@ -119,11 +118,12 @@ export function themeBuild(file: string, options?: {
119
118
  }, ctx?: {
120
119
  cwd?: string;
121
120
  }): Promise<import("../theme.type.mjs").ThemeBuildResponse | import("../theme.type.mjs").ThemeBuildCheckResponse | null>;
122
- /** @param {string[]} files @param {{familyKey: string, check?: boolean, iconsSpecifier?: string}} options @param {{cwd?: string}} [ctx] */
121
+ /** @param {string[]} files @param {{familyKey: string, check?: boolean, iconsSpecifier?: string, __onPrivateVarError?: () => void}} options @param {{cwd?: string}} [ctx] */
123
122
  export function themeBuildFamily(files: string[], options: {
124
123
  familyKey: string;
125
124
  check?: boolean;
126
125
  iconsSpecifier?: string;
126
+ __onPrivateVarError?: () => void;
127
127
  }, { cwd }?: {
128
128
  cwd?: string;
129
129
  }): Promise<{
@@ -222,5 +222,4 @@ export type CoreBindings = {
222
222
  generateThemeRulesSplit: any;
223
223
  generateOnMediaCSS: any;
224
224
  generateAdaptationCSS: any;
225
- dataTokenDefaults: any;
226
225
  };
@@ -23,9 +23,10 @@
23
23
  * the selected theme's parsed bindings and inheritance, never from comment or
24
24
  * string contents. A registry that cannot be preserved fails before output
25
25
  * generation, including in check mode. Errors throw AstryxError (with a stable
26
- * code). Human progress is emitted through the shared `logger`
27
- * (silent by default), so the CLI keeps its exact output while a programmatic
28
- * caller stays quiet.
26
+ * code). Private-variable diagnostics keep their released warnings and generated
27
+ * files; an internal callback lets the CLI make only the process status fail.
28
+ * Human progress is emitted through the shared `logger` (silent by default), so
29
+ * the CLI keeps its exact output while a programmatic caller stays quiet.
29
30
  *
30
31
  * The installed `@astryxdesign/core` is an independently versioned optional
31
32
  * peer, so it can be older than the CLI. A theme that uses only baseline
@@ -72,7 +73,7 @@ import {logger} from '../../logger.mjs';
72
73
  import {loadComponentDoc} from '../../../foundation/discovery/component-loader.mjs';
73
74
  import {
74
75
  collectThemingTargets,
75
- targetValidationRegistry,
76
+ targetsByKey,
76
77
  } from '../../../foundation/discovery/theming-targets.mjs';
77
78
  import {
78
79
  collectUnloadedFonts,
@@ -98,14 +99,12 @@ import {resolveIconImports} from './icon-imports.mjs';
98
99
  // capability instead, required only by a theme that actually uses it:
99
100
  // requiring it unconditionally made every theme build — adaptations or not —
100
101
  // fail against an older published core. This is a targeted allowance for that
101
- // one capability, not a general scheme; the other two optional reads below
102
- // (`generateOnMediaCSS`, `dataTokenDefaults`) both exist in every core that
103
- // ships adaptations' predecessor surface.
102
+ // one capability, not a general scheme; `generateOnMediaCSS` exists in every
103
+ // core that ships adaptations' predecessor surface.
104
104
  /** @type {any} */ let _defineTheme = null;
105
105
  /** @type {any} */ let _generateThemeRulesSplit = null;
106
106
  /** @type {any} */ let _generateOnMediaCSS = null;
107
107
  /** @type {any} */ let _generateAdaptationCSS = null;
108
- /** @type {any} */ let _dataTokenDefaults = null;
109
108
  /**
110
109
  * The whole `@astryxdesign/core/theme` namespace. A theme file handed a
111
110
  * wrapped core must still get every export the installed one has, including
@@ -128,7 +127,6 @@ try {
128
127
  _generateThemeRulesSplit = coreTheme.generateThemeRulesSplit;
129
128
  _generateOnMediaCSS = coreTheme.generateOnMediaCSS;
130
129
  _generateAdaptationCSS = coreTheme.generateAdaptationCSS;
131
- _dataTokenDefaults = coreTheme.dataTokenDefaults;
132
130
  try {
133
131
  _coreRootModule = await import('@astryxdesign/core');
134
132
  } catch {
@@ -155,7 +153,6 @@ try {
155
153
  * generateThemeRulesSplit: any,
156
154
  * generateOnMediaCSS: any,
157
155
  * generateAdaptationCSS: any,
158
- * dataTokenDefaults: any,
159
156
  * }} CoreBindings
160
157
  */
161
158
 
@@ -172,7 +169,6 @@ const _cliCore = {
172
169
  generateThemeRulesSplit: _generateThemeRulesSplit,
173
170
  generateOnMediaCSS: _generateOnMediaCSS,
174
171
  generateAdaptationCSS: _generateAdaptationCSS,
175
- dataTokenDefaults: _dataTokenDefaults,
176
172
  };
177
173
 
178
174
  /**
@@ -187,7 +183,6 @@ function setCore(core) {
187
183
  _generateThemeRulesSplit = core.generateThemeRulesSplit;
188
184
  _generateOnMediaCSS = core.generateOnMediaCSS;
189
185
  _generateAdaptationCSS = core.generateAdaptationCSS;
190
- _dataTokenDefaults = core.dataTokenDefaults;
191
186
  }
192
187
 
193
188
  /**
@@ -294,7 +289,6 @@ async function loadProjectCore(cwd) {
294
289
  generateThemeRulesSplit: themeModule.generateThemeRulesSplit,
295
290
  generateOnMediaCSS: themeModule.generateOnMediaCSS,
296
291
  generateAdaptationCSS: themeModule.generateAdaptationCSS,
297
- dataTokenDefaults: themeModule.dataTokenDefaults,
298
292
  };
299
293
  }
300
294
 
@@ -752,10 +746,8 @@ const _augmentationTargetCache = new Map();
752
746
  * Resolve a rendered theme class token (the key without `astryx-`) to candidate
753
747
  * public core subpaths and interface prefixes that may own its augmentable prop
754
748
  * maps. Some tokens are subtargets documented by a parent component
755
- * (`avatar-status-dot` augments `@astryxdesign/core/Avatar`), and some
756
- * deprecated tokens still omit word separators (`progressbar`, `statusdot`)
757
- * while the public API keeps `ProgressBar`/`StatusDot` casing. Component docs
758
- * are the source of truth for the target token → owning component relationship.
749
+ * (`avatar-status-dot` augments `@astryxdesign/core/Avatar`). Component docs are
750
+ * the source of truth for the target token → owning component relationship.
759
751
  *
760
752
  * @param {string} componentName
761
753
  * @returns {Promise<Array<{moduleName: string, interfacePrefix: string}>>}
@@ -832,8 +824,7 @@ async function resolveAugmentationTargetCandidates(componentName) {
832
824
 
833
825
  // Try the exact rendered token first for documented subtargets such as
834
826
  // avatar-status-dot → AvatarStatusDotVariantMap, then the owning public
835
- // component name for the deprecated unhyphenated tokens such as
836
- // progressbar → ProgressBarVariantMap/statusdot → StatusDotVariantMap.
827
+ // component name (for example, ProgressBar for progress-bar-fill).
837
828
  addCandidate(moduleName, toPascalCase(componentName));
838
829
  addCandidate(moduleName, moduleName);
839
830
  if (Array.isArray(doc?.components)) {
@@ -1991,30 +1982,25 @@ export declare const ${iconInfo.exportName}: IconRegistry;
1991
1982
 
1992
1983
  /**
1993
1984
  * Load known theme target keys from core component docs: the visual props AND
1994
- * runtime states each target reflects, plus canonical replacements for
1995
- * deprecated target keys. Deprecated targets remain accepted for compatibility,
1996
- * but every use receives actionable build guidance. Returns null when docs are
1997
- * unavailable so validation skips warnings rather than guessing from a second
1998
- * registry.
1985
+ * runtime states each target reflects. Returns null when docs are unavailable so
1986
+ * validation skips warnings rather than guessing from a second registry.
1999
1987
  *
2000
- * @returns {Promise<{propsByKey: Record<string, string[]>, deprecatedByKey: Record<string, string>} | null>}
1988
+ * @returns {Promise<{propsByKey: Record<string, string[]>} | null>}
2001
1989
  */
2002
1990
  async function loadKnownComponents() {
2003
1991
  const coreRoot = resolveCoreRoot();
2004
1992
  const coreSrc = coreRoot ? path.join(coreRoot, 'src') : null;
2005
1993
  if (!coreSrc || !fs.existsSync(coreSrc)) return null;
2006
1994
 
2007
- const registry = targetValidationRegistry(
2008
- await collectThemingTargets(coreSrc),
2009
- );
2010
- return Object.keys(registry.propsByKey).length > 0 ? registry : null;
1995
+ const propsByKey = targetsByKey(await collectThemingTargets(coreSrc));
1996
+ return Object.keys(propsByKey).length > 0 ? {propsByKey} : null;
2011
1997
  }
2012
1998
 
2013
- /** @type {{propsByKey: Record<string, string[]>, deprecatedByKey: Record<string, string>} | null | undefined} */
1999
+ /** @type {{propsByKey: Record<string, string[]>} | null | undefined} */
2014
2000
  let knownComponentsCache;
2015
2001
 
2016
2002
  /**
2017
- * @returns {Promise<{propsByKey: Record<string, string[]>, deprecatedByKey: Record<string, string>} | null>}
2003
+ * @returns {Promise<{propsByKey: Record<string, string[]>} | null>}
2018
2004
  */
2019
2005
  async function getKnownComponents() {
2020
2006
  if (knownComponentsCache === undefined) {
@@ -2027,7 +2013,7 @@ async function getKnownComponents() {
2027
2013
  * Validate component overrides against one discovered target registry.
2028
2014
  *
2029
2015
  * @param {{components?: Record<string, Record<string, unknown>>, onDark?: {components?: Record<string, Record<string, unknown>>}, onLight?: {components?: Record<string, Record<string, unknown>>}, __onDark?: {components?: Record<string, Record<string, unknown>>}, __onLight?: {components?: Record<string, Record<string, unknown>>}}} themeDef
2030
- * @param {{propsByKey: Record<string, string[]>, deprecatedByKey: Record<string, string>}} knownComponents
2016
+ * @param {{propsByKey: Record<string, string[]>}} knownComponents
2031
2017
  * @returns {string[]}
2032
2018
  */
2033
2019
  export function validateComponentOverridesAgainstRegistry(
@@ -2053,9 +2039,8 @@ export function validateComponentOverridesAgainstRegistry(
2053
2039
  }
2054
2040
  }
2055
2041
 
2056
- for (const {name: layerName, components} of layers) {
2042
+ for (const {components} of layers) {
2057
2043
  for (const [component, rules] of Object.entries(components)) {
2058
- const location = layerName === 'base' ? '' : ` in ${layerName}`;
2059
2044
  if (!(component in knownComponents.propsByKey)) {
2060
2045
  const similar = Object.keys(knownComponents.propsByKey)
2061
2046
  .filter(k => {
@@ -2081,13 +2066,6 @@ export function validateComponentOverridesAgainstRegistry(
2081
2066
  continue;
2082
2067
  }
2083
2068
 
2084
- const replacement = knownComponents.deprecatedByKey[component];
2085
- if (replacement != null) {
2086
- warnings.push(
2087
- `Deprecated component target "${component}"${location}. Use "${replacement}" instead.`,
2088
- );
2089
- }
2090
-
2091
2069
  const knownProps = knownComponents.propsByKey[component];
2092
2070
  for (const key of Object.keys(rules)) {
2093
2071
  if (key === 'base') continue;
@@ -2114,7 +2092,7 @@ export function validateComponentOverridesAgainstRegistry(
2114
2092
 
2115
2093
  /**
2116
2094
  * Validate component overrides in a theme definition.
2117
- * Warns on unknown component names, deprecated targets, and unknown prop names.
2095
+ * Warns on unknown component and prop names.
2118
2096
  *
2119
2097
  * @param {{components?: Record<string, Record<string, unknown>>, onDark?: {components?: Record<string, Record<string, unknown>>}, onLight?: {components?: Record<string, Record<string, unknown>>}, __onDark?: {components?: Record<string, Record<string, unknown>>}, __onLight?: {components?: Record<string, Record<string, unknown>>}}} themeDef
2120
2098
  * @returns {Promise<string[]>}
@@ -2331,7 +2309,7 @@ function validateHeadingTypeAugmentationSupport(themeDef) {
2331
2309
  * `logger` (silent by default).
2332
2310
  *
2333
2311
  * @param {string} file - Theme file path, resolved against `cwd`.
2334
- * @param {{out?: string, check?: boolean, iconsSpecifier?: string, __prepareFamily?: boolean, __familyLoader?: any, __familyInterception?: any}} [options] -
2312
+ * @param {{out?: string, check?: boolean, iconsSpecifier?: string, __prepareFamily?: boolean, __familyLoader?: any, __familyInterception?: any, __onPrivateVarError?: () => void}} [options] -
2335
2313
  * `out` overrides the output CSS path; `check` compares against on-disk outputs
2336
2314
  * instead of writing. `iconsSpecifier` overrides the icon registry import
2337
2315
  * specifier in the generated module (e.g. `./icons.mjs`); when omitted, the
@@ -2488,6 +2466,7 @@ async function themeBuildInternal(
2488
2466
  logger.error(` [error] ${source}${e}`);
2489
2467
  }
2490
2468
  if (privateVarErrors.length > 0) {
2469
+ options.__onPrivateVarError?.();
2491
2470
  logger.error(
2492
2471
  `\n ${source}${privateVarErrors.length} private var error(s). Use standard CSS properties instead.`,
2493
2472
  );
@@ -2753,26 +2732,8 @@ async function themeBuildInternal(
2753
2732
  logger.log(`${source}No overrides found; nothing to build.`);
2754
2733
  return null;
2755
2734
  }
2756
- // The data-token defaults are theme-independent and go in @layer
2757
- // astryx-base, below the theme's own overrides. Formatted here from the
2758
- // public `dataTokenDefaults` export, byte for byte as the `<Theme>`
2759
- // runtime emits it — build-theme.data-tokens.test.mjs is the drift guard.
2760
- // Placed after the reset block and before the theme block: a layer's order
2761
- // is fixed by where it is first declared, so emitting it anywhere else in
2762
- // the file would invert reset < astryx-base < astryx-theme for a consumer
2763
- // who imports this stylesheet on its own.
2764
- const baseCss = _dataTokenDefaults
2765
- ? `:root {\n${Object.entries(_dataTokenDefaults)
2766
- .map(([name, value]) => ` ${name}: ${value};`)
2767
- .join('\n')}\n}`
2768
- : '';
2769
- if (baseCss) {
2770
- cssParts.splice(
2771
- prose.length > 0 ? 1 : 0,
2772
- 0,
2773
- `@layer astryx-base {\n${baseCss}\n}`,
2774
- );
2775
- }
2735
+ cssParts.unshift('@layer reset, astryx-base, astryx-theme;');
2736
+ const baseCss = '';
2776
2737
  cssPlan = {
2777
2738
  base: baseCss,
2778
2739
  prose,
@@ -3246,7 +3207,7 @@ async function preloadFamilySource(filePath, loader, interception) {
3246
3207
  finally { patch.undo(); }
3247
3208
  }
3248
3209
 
3249
- /** @param {string[]} files @param {{familyKey: string, check?: boolean, iconsSpecifier?: string}} options @param {{cwd?: string}} [ctx] */
3210
+ /** @param {string[]} files @param {{familyKey: string, check?: boolean, iconsSpecifier?: string, __onPrivateVarError?: () => void}} options @param {{cwd?: string}} [ctx] */
3250
3211
  export async function themeBuildFamily(
3251
3212
  files,
3252
3213
  options,
@@ -3283,7 +3244,7 @@ export async function themeBuildFamily(
3283
3244
  }
3284
3245
  const file = source.file;
3285
3246
  // prettier-ignore
3286
- const member = await themeBuildInternal(file, {iconsSpecifier: options.iconsSpecifier, __prepareFamily: true, __familyLoader: familyLoader, __familyInterception: familyInterception}, {cwd});
3247
+ const member = await themeBuildInternal(file, {iconsSpecifier: options.iconsSpecifier, __prepareFamily: true, __familyLoader: familyLoader, __familyInterception: familyInterception, __onPrivateVarError: options.__onPrivateVarError}, {cwd});
3287
3248
  if (!member || member.type) {
3288
3249
  throw new AstryxError(
3289
3250
  `Theme family member "${file}" did not produce a complete build plan.`,