@astryxdesign/cli 0.6.3-canary.f22695a → 0.6.3
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.
- package/README.md +1 -2
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +2 -2
- package/api/component/component.type.d.mts +6 -6
- package/api/component/component.type.mjs +19 -19
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +24 -37
- package/api/docs/_adapter.mjs +83 -169
- package/api/docs/detail/detail.mjs +63 -14
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +20 -44
- package/api/docs/detail/section/section.test.mjs +0 -41
- package/api/docs/docs.d.mts +2 -7
- package/api/docs/docs.doc.mjs +10 -27
- package/api/docs/docs.mjs +9 -16
- package/api/docs/docs.test.mjs +0 -6
- package/api/docs/docs.type.d.mts +3 -40
- package/api/docs/docs.type.mjs +8 -36
- package/api/docs/integrationDocs.test.mjs +0 -106
- package/api/doctor/doctor.d.mts +0 -48
- package/api/doctor/doctor.mjs +0 -232
- package/api/doctor/doctor.test.mjs +0 -196
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +1 -1
- package/api/integration/add-contribution.mjs +3 -5
- package/api/integration/add-contribution.test.mjs +4 -4
- package/api/integration/integration-authoring.type.d.mts +1 -1
- package/api/integration/pack-check.mjs +7 -49
- package/api/integration/pack-check.test.mjs +0 -249
- package/api/search/search.d.mts +1 -1
- package/api/search/search.mjs +5 -5
- package/api/search/search.type.d.mts +2 -2
- package/api/search/search.type.mjs +1 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/template.d.mts +1 -1
- package/api/template/template.type.d.mts +6 -6
- package/api/template/template.type.mjs +12 -12
- package/api/theme/build/build.mjs +6 -20
- package/api/theme/build/build.test.mjs +0 -127
- package/api/theme/palette/generate/generate.mjs +1 -1
- package/api/theme/palette/generate/generator.d.mts +13 -10
- package/api/theme/palette/generate/generator.mjs +3 -7
- package/api/theme/theme.type.d.mts +11 -170
- package/api/theme/theme.type.mjs +27 -94
- package/api/upgrade/_adapter.mjs +5 -71
- package/api/upgrade/upgrade.doc.mjs +3 -4
- package/api/upgrade/upgrade.type.d.mts +5 -5
- package/api/upgrade/upgrade.type.mjs +11 -11
- package/assets/codemods/integration-discovery.mjs +2 -40
- package/assets/codemods/integration-discovery.test.mjs +0 -58
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +5 -27
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +5 -20
- package/assets/docs/README.md +0 -9
- package/assets/docs/cli-integrations.doc.mjs +15 -86
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +3 -19
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +65 -383
- package/authoring/_shared/contract.ts +0 -22
- package/authoring/codemod/codemod.doc.mjs +1 -6
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +6 -8
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +3 -3
- package/authoring/debug/parse.d.mts +5 -5
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +23 -788
- package/authoring/doctypes/_schema.mjs +39 -492
- package/authoring/doctypes/base/type.ts +0 -40
- package/authoring/doctypes/command/command.doc.mjs +2 -3
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -3
- package/authoring/doctypes/component/component.doc.mjs +3 -6
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +3 -4
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -3
- package/authoring/doctypes/function/function.doc.mjs +0 -4
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +2 -6
- package/authoring/doctypes/hook/hook.doc.mjs +0 -4
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +2 -3
- package/authoring/doctypes/legacy.d.mts +6 -8
- package/authoring/doctypes/legacy.mjs +4 -5
- package/authoring/doctypes/parse.d.mts +18 -20
- package/authoring/doctypes/parse.mjs +10 -16
- package/authoring/doctypes/parse.test.mjs +3 -77
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +5 -8
- package/authoring/doctypes/reference/reference.doc.mjs +4 -17
- package/authoring/doctypes/reference/type.ts +5 -51
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +2 -3
- package/authoring/doctypes/template/parse.d.mts +1 -92
- package/authoring/doctypes/template/parse.mjs +2 -36
- package/authoring/doctypes/template/parse.test.mjs +2 -8
- package/authoring/doctypes/template/template.doc.mjs +0 -4
- package/authoring/doctypes/template/type.ts +2 -5
- package/authoring/doctypes/types.ts +9 -10
- package/authoring/gap-report/parse.d.mts +10 -10
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/index.d.mts +0 -1
- package/authoring/index.d.ts +17 -49
- package/authoring/index.mjs +0 -1
- package/authoring/integration/integration.doc.mjs +6 -13
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +1 -10
- package/authoring/integration/schema.d.mts +4 -6
- package/authoring/integration/schema.mjs +3 -9
- package/authoring/integration/type.ts +6 -23
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/commands/docs.doc.mjs +3 -13
- package/clients/cli/commands/docs.mjs +21 -121
- package/clients/cli/commands/docs.test.mjs +0 -88
- package/clients/cli/commands/integration-authoring.test.mjs +9 -13
- package/clients/cli/commands/theme-palette-generate.doc.mjs +4 -8
- package/clients/cli/commands/upgrade.doc.mjs +2 -2
- package/clients/cli/formatters/index.mjs +1 -162
- package/clients/cli/formatters/index.test.mjs +0 -91
- package/clients/cli/lib/manifest.mjs +2 -7
- package/foundation/config/project.mjs +6 -21
- package/foundation/discovery/component-discovery.d.mts +1 -1
- package/foundation/discovery/component-discovery.mjs +1 -2
- package/foundation/discovery/docs-discovery.d.mts +4 -11
- package/foundation/discovery/docs-discovery.mjs +88 -208
- package/foundation/discovery/docs-discovery.test.mjs +13 -279
- package/foundation/discovery/template-adapter.mjs +1 -2
- package/foundation/integrations/autolink.mjs +5 -12
- package/foundation/integrations/integration-warnings.mjs +0 -6
- package/foundation/integrations/integrations.d.mts +2 -46
- package/foundation/integrations/integrations.mjs +8 -167
- package/foundation/integrations/integrations.test.mjs +1 -384
- package/foundation/integrations/validate-contributions.d.mts +0 -2
- package/foundation/integrations/validate-contributions.mjs +0 -10
- package/foundation/response/json-contract.test.mjs +17 -46
- package/foundation/response/response-types.doc.mjs +1 -6
- package/package.json +11 -9
- package/api/docs/compiled-topics.test.mjs +0 -78
- package/api/docs/index/index.d.mts +0 -18
- package/api/docs/index/index.mjs +0 -32
- package/api/docs/index/index.test.mjs +0 -62
- package/api/upgrade/project-context.test.mjs +0 -272
- package/assets/docs/authoring.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerFormats.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerFormats.tsx +0 -34
- package/assets/templates/blocks/components/Timer/TimerInline.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerInline.tsx +0 -14
- package/assets/templates/blocks/components/Timer/TimerShowcase.doc.mjs +0 -13
- package/assets/templates/blocks/components/Timer/TimerShowcase.tsx +0 -47
- package/assets/templates/blocks/components/Timer/TimerTypography.doc.mjs +0 -14
- package/assets/templates/blocks/components/Timer/TimerTypography.tsx +0 -31
- package/authoring/doctypes/base/graph-fields.doc.d.mts +0 -9
- package/authoring/doctypes/base/graph-fields.doc.mjs +0 -62
- package/authoring/doctypes/load-contract.test.mjs +0 -207
- package/authoring/doctypes/namespace/namespace.doc.d.mts +0 -9
- package/authoring/doctypes/namespace/namespace.doc.mjs +0 -132
- package/authoring/doctypes/namespace/parse.d.mts +0 -12
- package/authoring/doctypes/namespace/parse.mjs +0 -25
- package/authoring/doctypes/namespace/parse.test.mjs +0 -165
- package/authoring/doctypes/namespace/type.ts +0 -71
- package/authoring/identity/identity.doc.d.mts +0 -9
- package/authoring/identity/identity.doc.mjs +0 -61
- package/authoring/identity/type.ts +0 -132
- package/foundation/discovery/authoring-self-docs.d.mts +0 -69
- package/foundation/discovery/authoring-self-docs.mjs +0 -214
- package/foundation/discovery/authoring-self-docs.test.mjs +0 -154
- package/foundation/discovery/docs-output-budget.d.mts +0 -28
- package/foundation/discovery/docs-output-budget.mjs +0 -50
- package/foundation/discovery/docs-section-key.d.mts +0 -98
- package/foundation/discovery/docs-section-key.mjs +0 -221
- package/foundation/discovery/docs-section-key.test.mjs +0 -224
- package/foundation/doc-compiler/compile.d.mts +0 -162
- package/foundation/doc-compiler/compile.mjs +0 -262
- package/foundation/doc-compiler/doc-compiler.test.mjs +0 -687
- package/foundation/doc-compiler/ir.d.mts +0 -9
- package/foundation/doc-compiler/ir.mjs +0 -287
- package/foundation/doc-compiler/lenses.d.mts +0 -33
- package/foundation/doc-compiler/lenses.mjs +0 -127
- package/foundation/identity/provider-identity.d.mts +0 -90
- package/foundation/identity/provider-identity.mjs +0 -320
- package/foundation/identity/provider-identity.test.mjs +0 -254
- package/foundation/identity/providers.d.mts +0 -7
- package/foundation/identity/providers.mjs +0 -16
- package/foundation/integrations/provider-conflicts.test.mjs +0 -125
|
@@ -206,133 +206,6 @@ describe('themeBuild() — receipt', () => {
|
|
|
206
206
|
});
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
describe('themeBuild() — dropped declarations reach the receipt', () => {
|
|
210
|
-
// Core's generator refuses a declaration whose value would end it early
|
|
211
|
-
// (an unquoted `;` or brace, an unclosed string/comment/url). The runtime
|
|
212
|
-
// says so on the console; a build has a receipt, so every drop must land in
|
|
213
|
-
// `warnings` — a programmatic caller otherwise sees `warnings: []` while the
|
|
214
|
-
// CSS silently omits a value the generated JS still carries.
|
|
215
|
-
it('reports every dropped declaration, from every generator path, in warnings', async () => {
|
|
216
|
-
const themeFile = path.join(tmpDir, 'dropped.mjs');
|
|
217
|
-
fs.writeFileSync(
|
|
218
|
-
themeFile,
|
|
219
|
-
`export default {
|
|
220
|
-
name: 'dropped',
|
|
221
|
-
tokens: {
|
|
222
|
-
'--color-bg': '#0a0a0a } body { background: url(https://example.com/token) ',
|
|
223
|
-
},
|
|
224
|
-
components: {
|
|
225
|
-
button: {
|
|
226
|
-
'variant:secondary': {
|
|
227
|
-
backgroundColor: 'red; background-image: url(https://example.com/component)',
|
|
228
|
-
':hover': {color: '"https://example.com/pseudo'},
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
onDark: {
|
|
233
|
-
tokens: {'--color-bg': 'url(https://example.com/dark'},
|
|
234
|
-
},
|
|
235
|
-
adaptations: {
|
|
236
|
-
rules: [
|
|
237
|
-
{
|
|
238
|
-
when: {pointer: 'coarse'},
|
|
239
|
-
value: {tokens: {'--color-bg': 'red /* https://example.com/adaptation'}},
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
},
|
|
243
|
-
};\n`,
|
|
244
|
-
);
|
|
245
|
-
|
|
246
|
-
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
247
|
-
let result;
|
|
248
|
-
try {
|
|
249
|
-
result = await themeBuild('dropped.mjs', {}, {cwd: tmpDir});
|
|
250
|
-
// Drops are collected, not printed: the programmatic API stays silent.
|
|
251
|
-
expect(warnSpy).not.toHaveBeenCalled();
|
|
252
|
-
} finally {
|
|
253
|
-
warnSpy.mockRestore();
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const css = fs.readFileSync(path.join(tmpDir, 'dropped.css'), 'utf8');
|
|
257
|
-
expect(css).not.toContain('example.com');
|
|
258
|
-
|
|
259
|
-
const warnings = result?.data.warnings ?? [];
|
|
260
|
-
expect(warnings).toHaveLength(5);
|
|
261
|
-
expect(warnings).toEqual(
|
|
262
|
-
expect.arrayContaining([
|
|
263
|
-
expect.stringMatching(
|
|
264
|
-
/^Declaration dropped "--color-bg" in tokens: an unquoted "}" would close the rule/,
|
|
265
|
-
),
|
|
266
|
-
expect.stringMatching(
|
|
267
|
-
/^Declaration dropped "background-color" in components\.button\["variant:secondary"\]: an unquoted ";" would end the declaration/,
|
|
268
|
-
),
|
|
269
|
-
expect.stringMatching(
|
|
270
|
-
/^Declaration dropped "color" in components\.button\["variant:secondary"\]\[":hover"\]: an unclosed " string/,
|
|
271
|
-
),
|
|
272
|
-
expect.stringMatching(
|
|
273
|
-
/^Declaration dropped "--color-bg" in onDark\.tokens: an unclosed url\(/,
|
|
274
|
-
),
|
|
275
|
-
expect.stringMatching(
|
|
276
|
-
/^Declaration dropped "--color-bg" in adaptations\[0\]\.tokens: an unclosed \/\* comment/,
|
|
277
|
-
),
|
|
278
|
-
]),
|
|
279
|
-
);
|
|
280
|
-
for (const w of warnings) {
|
|
281
|
-
expect(w).toContain('The generated CSS omits it');
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
it('generates CSS for legacy null tokens without losing neighboring declarations', async () => {
|
|
286
|
-
fs.writeFileSync(
|
|
287
|
-
path.join(tmpDir, 'legacy.mjs'),
|
|
288
|
-
`export default {
|
|
289
|
-
name: 'legacy',
|
|
290
|
-
tokens: {'--color-background-body': null, '--spacing-4': 12},
|
|
291
|
-
onDark: {tokens: {'--color-background-body': null}},
|
|
292
|
-
components: {button: {base: {borderRadius: '4px'}}},
|
|
293
|
-
};\n`,
|
|
294
|
-
);
|
|
295
|
-
|
|
296
|
-
const result = await themeBuild('legacy.mjs', {}, {cwd: tmpDir});
|
|
297
|
-
const css = fs.readFileSync(path.join(tmpDir, 'legacy.css'), 'utf8');
|
|
298
|
-
expect(css).toContain('--color-background-body: null;');
|
|
299
|
-
expect(css).toContain('--spacing-4: 12;');
|
|
300
|
-
expect(css).toContain('border-radius: 4px;');
|
|
301
|
-
expect(result?.data.warnings).toEqual([]);
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it('keeps valid CSS that carries semicolons, and reports nothing', async () => {
|
|
305
|
-
const themeFile = path.join(tmpDir, 'kept.mjs');
|
|
306
|
-
fs.writeFileSync(
|
|
307
|
-
themeFile,
|
|
308
|
-
`export default {
|
|
309
|
-
name: 'kept',
|
|
310
|
-
tokens: {'--font-family-body': 'Gill\\\\ Sans, "Segoe;UI", serif /* ; */'},
|
|
311
|
-
components: {
|
|
312
|
-
button: {
|
|
313
|
-
'variant:secondary': {
|
|
314
|
-
backgroundImage: 'URL(data:image/svg+xml;base64,PHN2Zz4=)',
|
|
315
|
-
WebkitLineClamp: '2',
|
|
316
|
-
},
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
};\n`,
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
const result = await themeBuild('kept.mjs', {}, {cwd: tmpDir});
|
|
323
|
-
const css = fs.readFileSync(path.join(tmpDir, 'kept.css'), 'utf8');
|
|
324
|
-
|
|
325
|
-
expect(css).toContain(
|
|
326
|
-
'--font-family-body: Gill\\ Sans, "Segoe;UI", serif /* ; */;',
|
|
327
|
-
);
|
|
328
|
-
expect(css).toContain(
|
|
329
|
-
'background-image: URL(data:image/svg+xml;base64,PHN2Zz4=);',
|
|
330
|
-
);
|
|
331
|
-
expect(css).toContain('-webkit-line-clamp: 2;');
|
|
332
|
-
expect(result?.data.warnings).toEqual([]);
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
|
|
336
209
|
describe('themeBuild() — nothing to build', () => {
|
|
337
210
|
it('returns null and writes nothing when the generator yields no CSS', async () => {
|
|
338
211
|
const themeFile = path.join(tmpDir, 'empty.mjs');
|
|
@@ -100,7 +100,7 @@ function serializeCandidate(candidate, outputPath) {
|
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
/** @param {PaletteGenerationResult} result @param {string} candidateText @param {string | null} [previewText]
|
|
103
|
+
/** @param {PaletteGenerationResult} result @param {string} candidateText @param {string | null} [previewText] */
|
|
104
104
|
function receiptFor(result, candidateText, previewText = null) {
|
|
105
105
|
return {
|
|
106
106
|
schemaVersion: 1,
|
|
@@ -22,17 +22,15 @@ export function generateTonalPalette(input: import("../../theme.type.mjs").Tonal
|
|
|
22
22
|
export function serializeGenerationResult(result: unknown): string;
|
|
23
23
|
/** @typedef {import('../../theme.type.mjs').TonalPaletteAnchor} TonalPaletteAnchor */
|
|
24
24
|
/** @typedef {import('../../theme.type.mjs').TonalPaletteGenerationInput} TonalPaletteGenerationInput */
|
|
25
|
-
/** @typedef {import('../../theme.type.mjs').TonalPaletteRampDiagnostics} TonalPaletteRampDiagnostics */
|
|
26
|
-
/** @typedef {import('../../theme.type.mjs').TonalPaletteCoordinationDiagnostics} TonalPaletteCoordinationDiagnostics */
|
|
27
|
-
/** @typedef {import('../../theme.type.mjs').TonalPaletteNormalizedRequest} NormalizedRequest */
|
|
28
25
|
/** @typedef {[number, number, number]} ColorTriple */
|
|
29
26
|
/** @typedef {'light' | 'dark'} PaletteMode */
|
|
30
27
|
/** @typedef {{lightness: number, chroma: number, hue: number}} PolarColor */
|
|
31
28
|
/** @typedef {TonalPaletteAnchor & {color: string, generatedColor: string, deltaE: number}} AnchorResult */
|
|
32
|
-
/** @typedef {{colors: Record<number, string>, diagnostics:
|
|
29
|
+
/** @typedef {{colors: Record<number, string>, diagnostics: Record<string, unknown>}} GeneratedRamp */
|
|
33
30
|
/** @typedef {{id: string, name: string, seed: string, kind: 'chromatic' | 'neutral', anchors: TonalPaletteAnchor[]}} NormalizedFamily */
|
|
31
|
+
/** @typedef {{recipe: typeof PALETTE_RECIPE, vibrancy: number, neutralProfile: string, modeStrategy: string, stops: number[], families: NormalizedFamily[]}} NormalizedRequest */
|
|
34
32
|
/** @typedef {{id: string, name: string, seed: string, light?: GeneratedRamp, dark?: GeneratedRamp}} GeneratedFamily */
|
|
35
|
-
/** @typedef {{recipe: typeof PALETTE_RECIPE, status: 'candidate', request: NormalizedRequest, families: GeneratedFamily[], coordination:
|
|
33
|
+
/** @typedef {{recipe: typeof PALETTE_RECIPE, status: 'candidate', request: NormalizedRequest, families: GeneratedFamily[], coordination: Record<string, unknown>[], errors: {familyId: string, message: string}[]}} PaletteGenerationResult */
|
|
36
34
|
export const PALETTE_RECIPE: "astryx-oklch-v1";
|
|
37
35
|
export const PALETTE_BLACK: "#000000";
|
|
38
36
|
export const PALETTE_WHITE: "#ffffff";
|
|
@@ -40,9 +38,6 @@ export const DEFAULT_21_STOPS: readonly number[];
|
|
|
40
38
|
export const COMPACT_11_STOPS: readonly number[];
|
|
41
39
|
export type TonalPaletteAnchor = import("../../theme.type.mjs").TonalPaletteAnchor;
|
|
42
40
|
export type TonalPaletteGenerationInput = import("../../theme.type.mjs").TonalPaletteGenerationInput;
|
|
43
|
-
export type TonalPaletteRampDiagnostics = import("../../theme.type.mjs").TonalPaletteRampDiagnostics;
|
|
44
|
-
export type TonalPaletteCoordinationDiagnostics = import("../../theme.type.mjs").TonalPaletteCoordinationDiagnostics;
|
|
45
|
-
export type NormalizedRequest = import("../../theme.type.mjs").TonalPaletteNormalizedRequest;
|
|
46
41
|
export type ColorTriple = [number, number, number];
|
|
47
42
|
export type PaletteMode = "light" | "dark";
|
|
48
43
|
export type PolarColor = {
|
|
@@ -57,7 +52,7 @@ export type AnchorResult = TonalPaletteAnchor & {
|
|
|
57
52
|
};
|
|
58
53
|
export type GeneratedRamp = {
|
|
59
54
|
colors: Record<number, string>;
|
|
60
|
-
diagnostics:
|
|
55
|
+
diagnostics: Record<string, unknown>;
|
|
61
56
|
};
|
|
62
57
|
export type NormalizedFamily = {
|
|
63
58
|
id: string;
|
|
@@ -66,6 +61,14 @@ export type NormalizedFamily = {
|
|
|
66
61
|
kind: "chromatic" | "neutral";
|
|
67
62
|
anchors: TonalPaletteAnchor[];
|
|
68
63
|
};
|
|
64
|
+
export type NormalizedRequest = {
|
|
65
|
+
recipe: typeof PALETTE_RECIPE;
|
|
66
|
+
vibrancy: number;
|
|
67
|
+
neutralProfile: string;
|
|
68
|
+
modeStrategy: string;
|
|
69
|
+
stops: number[];
|
|
70
|
+
families: NormalizedFamily[];
|
|
71
|
+
};
|
|
69
72
|
export type GeneratedFamily = {
|
|
70
73
|
id: string;
|
|
71
74
|
name: string;
|
|
@@ -78,7 +81,7 @@ export type PaletteGenerationResult = {
|
|
|
78
81
|
status: "candidate";
|
|
79
82
|
request: NormalizedRequest;
|
|
80
83
|
families: GeneratedFamily[];
|
|
81
|
-
coordination:
|
|
84
|
+
coordination: Record<string, unknown>[];
|
|
82
85
|
errors: {
|
|
83
86
|
familyId: string;
|
|
84
87
|
message: string;
|
|
@@ -12,17 +12,15 @@ import {
|
|
|
12
12
|
|
|
13
13
|
/** @typedef {import('../../theme.type.mjs').TonalPaletteAnchor} TonalPaletteAnchor */
|
|
14
14
|
/** @typedef {import('../../theme.type.mjs').TonalPaletteGenerationInput} TonalPaletteGenerationInput */
|
|
15
|
-
/** @typedef {import('../../theme.type.mjs').TonalPaletteRampDiagnostics} TonalPaletteRampDiagnostics */
|
|
16
|
-
/** @typedef {import('../../theme.type.mjs').TonalPaletteCoordinationDiagnostics} TonalPaletteCoordinationDiagnostics */
|
|
17
|
-
/** @typedef {import('../../theme.type.mjs').TonalPaletteNormalizedRequest} NormalizedRequest */
|
|
18
15
|
/** @typedef {[number, number, number]} ColorTriple */
|
|
19
16
|
/** @typedef {'light' | 'dark'} PaletteMode */
|
|
20
17
|
/** @typedef {{lightness: number, chroma: number, hue: number}} PolarColor */
|
|
21
18
|
/** @typedef {TonalPaletteAnchor & {color: string, generatedColor: string, deltaE: number}} AnchorResult */
|
|
22
|
-
/** @typedef {{colors: Record<number, string>, diagnostics:
|
|
19
|
+
/** @typedef {{colors: Record<number, string>, diagnostics: Record<string, unknown>}} GeneratedRamp */
|
|
23
20
|
/** @typedef {{id: string, name: string, seed: string, kind: 'chromatic' | 'neutral', anchors: TonalPaletteAnchor[]}} NormalizedFamily */
|
|
21
|
+
/** @typedef {{recipe: typeof PALETTE_RECIPE, vibrancy: number, neutralProfile: string, modeStrategy: string, stops: number[], families: NormalizedFamily[]}} NormalizedRequest */
|
|
24
22
|
/** @typedef {{id: string, name: string, seed: string, light?: GeneratedRamp, dark?: GeneratedRamp}} GeneratedFamily */
|
|
25
|
-
/** @typedef {{recipe: typeof PALETTE_RECIPE, status: 'candidate', request: NormalizedRequest, families: GeneratedFamily[], coordination:
|
|
23
|
+
/** @typedef {{recipe: typeof PALETTE_RECIPE, status: 'candidate', request: NormalizedRequest, families: GeneratedFamily[], coordination: Record<string, unknown>[], errors: {familyId: string, message: string}[]}} PaletteGenerationResult */
|
|
26
24
|
|
|
27
25
|
export const PALETTE_RECIPE = 'astryx-oklch-v1';
|
|
28
26
|
export const PALETTE_BLACK = '#000000';
|
|
@@ -413,7 +411,6 @@ function buildDiagnostics(colors, stops, sourceHue, gamutMappedStops, anchors) {
|
|
|
413
411
|
let minimumAdjacentDeltaE = Number.POSITIVE_INFINITY;
|
|
414
412
|
let maximumAdjacentDeltaE = 0;
|
|
415
413
|
let maximumHueDrift = 0;
|
|
416
|
-
/** @type {TonalPaletteRampDiagnostics['hueIdentityRisk']} */
|
|
417
414
|
let hueIdentityRisk = null;
|
|
418
415
|
for (let index = 0; index < stops.length; index++) {
|
|
419
416
|
const stop = stops[index];
|
|
@@ -529,7 +526,6 @@ function buildCoordinationDiagnostics(request, families) {
|
|
|
529
526
|
chroma: hexToOklch(color).C,
|
|
530
527
|
};
|
|
531
528
|
});
|
|
532
|
-
/** @type {[string, string] | null} */
|
|
533
529
|
let closestFamilies = null;
|
|
534
530
|
let minimumFamilyDeltaE = Number.POSITIVE_INFINITY;
|
|
535
531
|
for (let index = 0; index < samples.length; index++) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* xds --json theme build <file>
|
|
6
6
|
*/
|
|
7
7
|
export type ThemeBuildResponse = {
|
|
8
8
|
/**
|
|
@@ -27,7 +27,7 @@ export type ThemeBuildResponse = {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* xds --json theme build <file> --check
|
|
31
31
|
*/
|
|
32
32
|
export type ThemeBuildCheckResponse = {
|
|
33
33
|
type: "theme.build.check";
|
|
@@ -42,7 +42,7 @@ export type ThemeBuildCheckResponse = {
|
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* xds --json theme build <a> <b> … — several themes in one invocation. Each
|
|
46
46
|
* result carries the file as it was passed and the receipt a single-file build
|
|
47
47
|
* would have returned (null when that theme produced no CSS). One file still
|
|
48
48
|
* returns the bare theme.build / theme.build.check envelope.
|
|
@@ -71,14 +71,14 @@ export type ThemeListEntry = {
|
|
|
71
71
|
package?: string | undefined;
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* xds --json theme list
|
|
75
75
|
*/
|
|
76
76
|
export type ThemeListResponse = {
|
|
77
77
|
type: "theme.list";
|
|
78
78
|
data: ThemeListEntry[];
|
|
79
79
|
};
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* xds --json theme add <slug>
|
|
82
82
|
*/
|
|
83
83
|
export type ThemeAddResponse = {
|
|
84
84
|
type: "theme.add";
|
|
@@ -94,7 +94,7 @@ export type ThemeAddResponse = {
|
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* xds --json theme template
|
|
98
98
|
* `written: false` with `reason: 'exists'` is a success: the command is safe to
|
|
99
99
|
* re-run, and an edited template is the consumer's file to keep.
|
|
100
100
|
*/
|
|
@@ -123,7 +123,7 @@ export type ThemeTargetEntry = {
|
|
|
123
123
|
deprecatedFor?: string | undefined;
|
|
124
124
|
};
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* xds --json theme targets [filter]
|
|
127
127
|
*/
|
|
128
128
|
export type ThemeTargetsResponse = {
|
|
129
129
|
type: "theme.targets";
|
|
@@ -134,7 +134,8 @@ export type ThemeTargetsResponse = {
|
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
136
|
/**
|
|
137
|
-
* A
|
|
137
|
+
* A generated palette candidate. The palette is still subject to author review
|
|
138
|
+
* and is not connected to runtime theme values.
|
|
138
139
|
*/
|
|
139
140
|
export type TonalPaletteAnchor = {
|
|
140
141
|
/**
|
|
@@ -145,10 +146,6 @@ export type TonalPaletteAnchor = {
|
|
|
145
146
|
* Existing requested stop where the anchor applies.
|
|
146
147
|
*/
|
|
147
148
|
stop: number;
|
|
148
|
-
/**
|
|
149
|
-
* sRGB hex the stop is pulled toward: three or six
|
|
150
|
-
* digits, with or without `#`; the generator normalizes it.
|
|
151
|
-
*/
|
|
152
149
|
color: string;
|
|
153
150
|
/**
|
|
154
151
|
* `exact` preserves the
|
|
@@ -162,32 +159,11 @@ export type TonalPaletteAnchor = {
|
|
|
162
159
|
*/
|
|
163
160
|
maxDeltaE?: number | undefined;
|
|
164
161
|
};
|
|
165
|
-
/**
|
|
166
|
-
* One requested family: a seed color and the constraints applied to its ramp.
|
|
167
|
-
*/
|
|
168
162
|
export type TonalPaletteFamilyInput = {
|
|
169
|
-
/**
|
|
170
|
-
* Lower-kebab-case key for the family in the generated
|
|
171
|
-
* palette. `black` and `white` are reserved for the standalone values.
|
|
172
|
-
*/
|
|
173
163
|
id: string;
|
|
174
|
-
/**
|
|
175
|
-
* sRGB hex the ramp is generated from: three or six
|
|
176
|
-
* digits, with or without `#`; the generator normalizes it.
|
|
177
|
-
*/
|
|
178
164
|
seed: string;
|
|
179
|
-
/**
|
|
180
|
-
* Display name for review artifacts; defaults to `id`.
|
|
181
|
-
*/
|
|
182
165
|
name?: string | undefined;
|
|
183
|
-
/**
|
|
184
|
-
* `neutral` derives the ramp from
|
|
185
|
-
* `neutralProfile` instead of the seed hue; defaults to `chromatic`.
|
|
186
|
-
*/
|
|
187
166
|
kind?: "neutral" | "chromatic" | undefined;
|
|
188
|
-
/**
|
|
189
|
-
* Colors pinned at specific stops.
|
|
190
|
-
*/
|
|
191
167
|
anchors?: TonalPaletteAnchor[] | undefined;
|
|
192
168
|
};
|
|
193
169
|
export type TonalPaletteGenerationInput = {
|
|
@@ -197,11 +173,6 @@ export type TonalPaletteGenerationInput = {
|
|
|
197
173
|
* (default) to 100 (most vivid).
|
|
198
174
|
*/
|
|
199
175
|
vibrancy?: number | undefined;
|
|
200
|
-
/**
|
|
201
|
-
* Hue treatment for `neutral` families: `neutral-v1` is fully achromatic,
|
|
202
|
-
* `warm-v1` and `cool-v1` add a slight tint, and `custom` derives the hue from
|
|
203
|
-
* the family's own seed. Defaults to `neutral-v1`.
|
|
204
|
-
*/
|
|
205
176
|
neutralProfile?: "custom" | "neutral-v1" | "warm-v1" | "cool-v1" | undefined;
|
|
206
177
|
modeStrategy?: "light-only" | "dark-only" | "light-and-dark" | undefined;
|
|
207
178
|
/**
|
|
@@ -211,10 +182,6 @@ export type TonalPaletteGenerationInput = {
|
|
|
211
182
|
*/
|
|
212
183
|
stops?: number[] | undefined;
|
|
213
184
|
};
|
|
214
|
-
/**
|
|
215
|
-
* A generated palette candidate. The palette is still subject to author review
|
|
216
|
-
* and is not connected to runtime theme values.
|
|
217
|
-
*/
|
|
218
185
|
export type TonalPaletteCandidate = {
|
|
219
186
|
schemaVersion: 1;
|
|
220
187
|
status: "candidate";
|
|
@@ -238,133 +205,7 @@ export type TonalPaletteCandidate = {
|
|
|
238
205
|
}>;
|
|
239
206
|
};
|
|
240
207
|
/**
|
|
241
|
-
*
|
|
242
|
-
*/
|
|
243
|
-
export type TonalPaletteRampDiagnostics = {
|
|
244
|
-
/**
|
|
245
|
-
* Whether luminance rises across every stop.
|
|
246
|
-
*/
|
|
247
|
-
monotonic: boolean;
|
|
248
|
-
/**
|
|
249
|
-
* Smallest perceptual gap between
|
|
250
|
-
* neighboring stops; a small value means two stops read as one color.
|
|
251
|
-
*/
|
|
252
|
-
minimumAdjacentDeltaE: number;
|
|
253
|
-
/**
|
|
254
|
-
* Largest gap between neighboring stops.
|
|
255
|
-
*/
|
|
256
|
-
maximumAdjacentDeltaE: number;
|
|
257
|
-
/**
|
|
258
|
-
* Largest hue distance, in degrees, between
|
|
259
|
-
* a stop and the family's reference hue.
|
|
260
|
-
*/
|
|
261
|
-
maximumHueDrift: number;
|
|
262
|
-
/**
|
|
263
|
-
* Named
|
|
264
|
-
* drift the ramp is at risk of, or `null`.
|
|
265
|
-
*/
|
|
266
|
-
hueIdentityRisk: "blue-to-purple" | "yellow-to-brown" | null;
|
|
267
|
-
/**
|
|
268
|
-
* Stops whose ideal color fell outside
|
|
269
|
-
* sRGB and was mapped back into it.
|
|
270
|
-
*/
|
|
271
|
-
gamutMappedStops: number[];
|
|
272
|
-
/**
|
|
273
|
-
* Each anchor with the color the stop received after its policy was applied
|
|
274
|
-
* and the perceptual distance that color still has from the requested target.
|
|
275
|
-
*/
|
|
276
|
-
anchors: Array<TonalPaletteAnchor & {
|
|
277
|
-
generatedColor: string;
|
|
278
|
-
deltaE: number;
|
|
279
|
-
}>;
|
|
280
|
-
};
|
|
281
|
-
/**
|
|
282
|
-
* Cross-family evidence for one mode, sampled at the stop nearest 50.
|
|
283
|
-
*/
|
|
284
|
-
export type TonalPaletteCoordinationDiagnostics = {
|
|
285
|
-
/**
|
|
286
|
-
* Mode these samples come from.
|
|
287
|
-
*/
|
|
288
|
-
mode: "light" | "dark";
|
|
289
|
-
/**
|
|
290
|
-
* Sampled stop.
|
|
291
|
-
*/
|
|
292
|
-
stop: number;
|
|
293
|
-
/**
|
|
294
|
-
* The two chromatic
|
|
295
|
-
* families hardest to tell apart, or `null` with fewer than two.
|
|
296
|
-
*/
|
|
297
|
-
closestFamilies: [string, string] | null;
|
|
298
|
-
/**
|
|
299
|
-
* Perceptual distance between them.
|
|
300
|
-
*/
|
|
301
|
-
minimumFamilyDeltaE: number | null;
|
|
302
|
-
/**
|
|
303
|
-
* Most saturated family at this stop.
|
|
304
|
-
*/
|
|
305
|
-
strongestFamily: string | null;
|
|
306
|
-
/**
|
|
307
|
-
* Least saturated family at this stop.
|
|
308
|
-
*/
|
|
309
|
-
weakestFamily: string | null;
|
|
310
|
-
/**
|
|
311
|
-
* Strongest chroma over weakest; a large
|
|
312
|
-
* ratio means the families are unbalanced.
|
|
313
|
-
*/
|
|
314
|
-
chromaRatio: number | null;
|
|
315
|
-
};
|
|
316
|
-
/**
|
|
317
|
-
* The request as the generator resolved it, with every default filled in.
|
|
318
|
-
*/
|
|
319
|
-
export type TonalPaletteNormalizedRequest = {
|
|
320
|
-
recipe: "astryx-oklch-v1";
|
|
321
|
-
vibrancy: number;
|
|
322
|
-
neutralProfile: "neutral-v1" | "warm-v1" | "cool-v1" | "custom";
|
|
323
|
-
modeStrategy: "light-only" | "dark-only" | "light-and-dark";
|
|
324
|
-
stops: number[];
|
|
325
|
-
families: Array<{
|
|
326
|
-
id: string;
|
|
327
|
-
name: string;
|
|
328
|
-
seed: string;
|
|
329
|
-
kind: "chromatic" | "neutral";
|
|
330
|
-
anchors: TonalPaletteAnchor[];
|
|
331
|
-
}>;
|
|
332
|
-
};
|
|
333
|
-
/**
|
|
334
|
-
* The detached receipt written beside a candidate. It records what was asked
|
|
335
|
-
* for and what the generator observed, so a candidate can be traced back to
|
|
336
|
-
* its request without rerunning generation.
|
|
337
|
-
*/
|
|
338
|
-
export type TonalPaletteGenerationReceipt = {
|
|
339
|
-
schemaVersion: 1;
|
|
340
|
-
/**
|
|
341
|
-
* Recipe that produced the candidate.
|
|
342
|
-
*/
|
|
343
|
-
recipe: "astryx-oklch-v1";
|
|
344
|
-
/**
|
|
345
|
-
* SHA-256 over the candidate bytes as written.
|
|
346
|
-
*/
|
|
347
|
-
candidateSha256: string;
|
|
348
|
-
/**
|
|
349
|
-
* Present when preview
|
|
350
|
-
* content was generated for the request, even if no file was written because
|
|
351
|
-
* the target already exists.
|
|
352
|
-
*/
|
|
353
|
-
preview?: {
|
|
354
|
-
version: string;
|
|
355
|
-
sha256: string;
|
|
356
|
-
} | undefined;
|
|
357
|
-
request: TonalPaletteNormalizedRequest;
|
|
358
|
-
diagnostics: {
|
|
359
|
-
families: Record<string, {
|
|
360
|
-
light?: TonalPaletteRampDiagnostics;
|
|
361
|
-
dark?: TonalPaletteRampDiagnostics;
|
|
362
|
-
}>;
|
|
363
|
-
coordination: TonalPaletteCoordinationDiagnostics[];
|
|
364
|
-
};
|
|
365
|
-
};
|
|
366
|
-
/**
|
|
367
|
-
* astryx --json theme palette generate <config>
|
|
208
|
+
* xds --json theme palette generate <config>
|
|
368
209
|
*/
|
|
369
210
|
export type ThemePaletteGenerateResponse = {
|
|
370
211
|
type: "theme.palette.generate";
|
|
@@ -380,6 +221,6 @@ export type ThemePaletteGenerateResponse = {
|
|
|
380
221
|
written: boolean;
|
|
381
222
|
reason: "exists" | null;
|
|
382
223
|
candidate: TonalPaletteCandidate;
|
|
383
|
-
generationReceipt:
|
|
224
|
+
generationReceipt: Record<string, unknown>;
|
|
384
225
|
};
|
|
385
226
|
};
|