@xtyle/core 0.7.0 → 0.7.1

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 (48) hide show
  1. package/README.md +28 -4
  2. package/dist/algorithms/factory.d.ts +24 -11
  3. package/dist/algorithms/factory.d.ts.map +1 -1
  4. package/dist/algorithms/factory.js +55 -22
  5. package/dist/algorithms/factory.js.map +1 -1
  6. package/dist/baked.d.ts +14 -1
  7. package/dist/baked.d.ts.map +1 -1
  8. package/dist/baked.js +17 -0
  9. package/dist/baked.js.map +1 -1
  10. package/dist/batteries.js +11 -2
  11. package/dist/cli.js +55 -28
  12. package/dist/cli.js.map +1 -1
  13. package/dist/elements/qr.js +0 -0
  14. package/dist/elements/qr.js.map +1 -1
  15. package/dist/host/algorithms-bundle.generated.d.ts.map +1 -1
  16. package/dist/host/algorithms-bundle.generated.js +1 -1
  17. package/dist/host/algorithms-bundle.generated.js.map +1 -1
  18. package/dist/host/authoring-prelude.generated.d.ts +1 -1
  19. package/dist/host/authoring-prelude.generated.d.ts.map +1 -1
  20. package/dist/host/authoring-prelude.generated.js +1 -1
  21. package/dist/host/authoring-prelude.generated.js.map +1 -1
  22. package/dist/host/index.d.ts.map +1 -1
  23. package/dist/host/index.js +11 -3
  24. package/dist/host/index.js.map +1 -1
  25. package/dist/host/registry.d.ts +34 -7
  26. package/dist/host/registry.d.ts.map +1 -1
  27. package/dist/host/registry.js +45 -11
  28. package/dist/host/registry.js.map +1 -1
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/knobs.d.ts +22 -0
  34. package/dist/knobs.d.ts.map +1 -0
  35. package/dist/knobs.js +63 -0
  36. package/dist/knobs.js.map +1 -0
  37. package/dist/mcp/tools.d.ts +7 -0
  38. package/dist/mcp/tools.d.ts.map +1 -1
  39. package/dist/mcp/tools.js +65 -29
  40. package/dist/mcp/tools.js.map +1 -1
  41. package/dist/theme-file.d.ts +8 -0
  42. package/dist/theme-file.d.ts.map +1 -1
  43. package/dist/theme-file.js +10 -0
  44. package/dist/theme-file.js.map +1 -1
  45. package/dist/types.d.ts +46 -12
  46. package/dist/types.d.ts.map +1 -1
  47. package/manifest.json +25 -2
  48. package/package.json +1 -1
package/README.md CHANGED
@@ -70,9 +70,29 @@ xtyle audit -a xtyle-default --level AA
70
70
  xtyle gauntlet --runs 200
71
71
  ```
72
72
 
73
- `--bg` / `--fg` / `--accent` are shorthands for the three headline anchors; `--set <token>=<value>`
74
- (repeatable, alias `--constraint`) pins *any* token, so a full multi-anchor recipe bakes straight
75
- from the CLI without dropping to the importable API. The leading `--` on the token is optional.
73
+ The CLI reaches all three input tiers.
74
+
75
+ `--bg` / `--fg` / `--accent` are shorthands for the three headline anchors.
76
+
77
+ `--knob <name>=<value>` (repeatable, alias `-k`) turns one of the algorithm's own dials — the casual
78
+ tier, where a small input reshapes the whole theme. `accentStrategy` is the one to know: it decides
79
+ how `--accent-2/3/4` relate to `--accent`, and it takes `fan` (flanks plus complement), `step` (an
80
+ even walk of the hue circle), `shade` (one hue at four depths), or `duo` (two brand colors as inputs,
81
+ 3 and 4 as their shades).
82
+
83
+ ```sh
84
+ xtyle derive --accent "#5b8cff" --knob accentStrategy=duo --set --accent-2=#e0507a
85
+ xtyle derive --knob scheme=light --knob surfaceRamp=-0.05 --knob density=compact
86
+ ```
87
+
88
+ `xtyle knobs` prints every algorithm's dials and exactly what each one accepts — kind, range, options,
89
+ default — read from the algorithm's own declaration, so a third-party algorithm's novel knob is as
90
+ discoverable as a blessed one. `xtyle knobs -a nxi-nite` narrows to one.
91
+
92
+ `--set <token>=<value>` (repeatable, alias `--constraint`) is the escape hatch: it pins *any* token, so
93
+ a full multi-anchor recipe bakes straight from the CLI without dropping to the importable API. The
94
+ leading `--` on the token is optional. Reach for a knob before a pin — hand-pinning `--accent-2/3/4`
95
+ to fake an accent family is exactly what `accentStrategy` exists to spare you.
76
96
 
77
97
  ```sh
78
98
  xtyle derive --accent "#2d5a9e" \
@@ -82,9 +102,13 @@ xtyle derive --accent "#2d5a9e" \
82
102
  --format css
83
103
  ```
84
104
 
105
+ An algorithm that has since been retired still derives what it always derived: `-a xtyle-brand`
106
+ migrates onto the recipe that reproduces it (`xtyle-default` under `accentStrategy: "shade"`), and a
107
+ `--format theme` written from it names the live algorithm, never the dead id.
108
+
85
109
  ## The seven-dimension contract
86
110
 
87
- `xtyle-default` produces 276 tokens. A representative tour follows; see
111
+ `xtyle-default` produces 299 tokens. A representative tour follows; see
88
112
  [xtyle.dev](https://xtyle.dev) for the authoritative full register.
89
113
 
90
114
  ### color
@@ -105,20 +105,33 @@ export declare function makeXtyleAlgorithm(preset: PresetDefaults): Algorithm;
105
105
  export declare const SHARED_KNOBS: string[];
106
106
  /**
107
107
  * The rendered *domain* of every knob the shared xtyle derivation reads — the kind, range, and
108
- * accepted values a consumer needs to build a control. `hour` is included so `nxi-nite` resolves
109
- * it from here without declaring its own spec. `fonts` and `anchors` are absent by design: they
110
- * are composite groups a consumer expands into multiple controls (font stacks, anchor pickers),
111
- * not single scalar knobs, so their orchestration stays with the consumer. Cosmetic concerns
112
- * (localized labels, unit suffixes, digit precision) are deliberately not here — they belong to
113
- * the consumer; the `label` hints below are just defaults a consumer may override.
108
+ * accepted values a consumer needs to build a control.
109
+ *
110
+ * Strictly the *shared* knobs: a knob only one algorithm reads belongs to that algorithm's own
111
+ * `knobSpecs`, not here (`hour` is nxi-nite's, and lives there). A shared registry carrying a
112
+ * single algorithm's domain would be the same hardcoded name-keyed table `knobSpecs` exists to
113
+ * delete, moved one layer down.
114
+ *
115
+ * `fonts` and `anchors` carry `kind: "composite"` rather than a scalar domain: they are groups a
116
+ * consumer expands into multiple controls (font stacks, anchor pickers), so their orchestration stays
117
+ * with the consumer. They are declared here all the same, so that "this knob is a composite" is a fact
118
+ * the algorithm states rather than a list of names the engine keeps. Cosmetic concerns (localized
119
+ * labels, unit suffixes, digit precision) are deliberately not here — they belong to the consumer; the
120
+ * `label` hints below are just defaults a consumer may override.
114
121
  */
115
122
  export declare const SHARED_KNOB_SPECS: KnobSpec[];
116
123
  /**
117
- * Resolve a declared knob-name list to the render specs a consumer needs. Names that match the
118
- * shared registry get its domain; composite groups a consumer expands itself (`anchors`, `fonts`)
119
- * resolve to nothing (they carry no single scalar control); a novel knob resolves from `extra` when
120
- * the algorithm supplies its own spec. This is the one place a knob name becomes a renderable domain,
121
- * so both baked and hosted facades — and a host facade rebuilding from a name list — agree.
124
+ * Resolve a declared knob-name list to the render specs a consumer needs. A name matching the shared
125
+ * registry gets its domain; a novel knob resolves from `extra` when the algorithm supplies its own
126
+ * spec. This is the one place a knob name becomes a renderable domain, so both baked and hosted
127
+ * facades — and a host facade rebuilding from a name list — agree.
128
+ *
129
+ * A name that resolves to nothing degrades to a `text` control rather than vanishing. An algorithm
130
+ * that declares a knob it never described still *reads* that knob, so dropping it silently would
131
+ * leave the one thing the author asked for unreachable, with nothing on screen to say why. A
132
+ * permissive text field is the honest floor: the knob stays editable, and the missing domain shows up
133
+ * as a crude control instead of an absent one. `undeclared` marks it, so a discovery surface can say
134
+ * *why* it looks crude — a typo'd knob name surfaces as a named gap rather than a mystery text box.
122
135
  */
123
136
  export declare function resolveKnobSpecs(names: readonly string[], extra?: readonly KnobSpec[]): KnobSpec[];
124
137
  export declare const DEFAULT_ANCHORS: PresetAnchors;
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/algorithms/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAWN,KAAK,UAAU,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EACX,cAAc,EACd,SAAS,EACT,aAAa,EAGb,SAAS,EAGT,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,WAAW,EACX,MAAM,EACN,eAAe,EAGf,aAAa,EACb,aAA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KG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAK5E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,EAAE,CAEpE;AAoED,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,CA+zBlE;AAED,eAAO,MAAM,eAAe,UAAW,CAAC;AACxC,eAAO,MAAM,gBAAgB,iBAAa,CAAC;AAE3C;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,EAAE,GAClE,SAAS,CAuBX;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAEpE;AAED,eAAO,MAAM,YAAY,UAcxB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,EA8EvC,CAAC;AAIF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,GAAE,SAAS,QAAQ,EAAO,GAAG,QAAQ,EAAE,CAQtG;AAED,eAAO,MAAM,eAAe,EAAE,aAG7B,CAAC"}
@@ -9,6 +9,15 @@ export const BORDER_SEPARATION = 1.5;
9
9
  export const DIVIDER_SEPARATION = 1.8;
10
10
  const DEFAULT_SHIFT_STEP = 90;
11
11
  const DEFAULT_ACCENT_SPLIT = 45;
12
+ /**
13
+ * The magnitude of one step on the surface stack. The *sign* is scheme-derived rather than constant
14
+ * (see {@link defaultSurfaceRamp}), so this is a magnitude and never a `surfaceRamp` value on its own.
15
+ */
16
+ const DEFAULT_SURFACE_STEP = 0.045;
17
+ /** The `surfaceRamp` a scheme resolves to when the knob is unset: dark ascends the stack, light descends it. */
18
+ function defaultSurfaceRamp(scheme) {
19
+ return scheme === "dark" ? DEFAULT_SURFACE_STEP : -DEFAULT_SURFACE_STEP;
20
+ }
12
21
  // Chroma of the faint accent-hue wash on a surface synthesized from an accent (the "keep the tone"
13
22
  // derivation); kept low enough that any hue stays a neutral-reading surface rather than a muddy fill.
14
23
  const DERIVED_SURFACE_TINT_C = 0.02;
@@ -829,16 +838,11 @@ function buildGraphUncached(preset, opts) {
829
838
  const radiusScale = radiusScaleOf(knobs);
830
839
  const density = densityOf(knobs);
831
840
  const fonts = fontsOf(knobs);
832
- const surfaceStep = 0.045;
833
841
  // The signed lightness delta the surface stack walks from `--bg-0`. Unset, it resolves to the
834
842
  // scheme-derived direction (dark ascends, light descends) at the default magnitude, so output is
835
843
  // unchanged; set, the author's sign wins and the whole stack (body-bg, bg-1/2/3, bg-sunken)
836
844
  // follows the one number instead of six hand-pinned surfaces.
837
- const surfaceRamp = typeof knobs.surfaceRamp === "number"
838
- ? knobs.surfaceRamp
839
- : scheme === "dark"
840
- ? surfaceStep
841
- : -surfaceStep;
845
+ const surfaceRamp = typeof knobs.surfaceRamp === "number" ? knobs.surfaceRamp : defaultSurfaceRamp(scheme);
842
846
  const nodes = [];
843
847
  const lit = (name, value, refs) => {
844
848
  nodes.push(refs && refs.length ? { name, value, refs } : { name, value });
@@ -2407,12 +2411,19 @@ export const SHARED_KNOBS = [
2407
2411
  ];
2408
2412
  /**
2409
2413
  * The rendered *domain* of every knob the shared xtyle derivation reads — the kind, range, and
2410
- * accepted values a consumer needs to build a control. `hour` is included so `nxi-nite` resolves
2411
- * it from here without declaring its own spec. `fonts` and `anchors` are absent by design: they
2412
- * are composite groups a consumer expands into multiple controls (font stacks, anchor pickers),
2413
- * not single scalar knobs, so their orchestration stays with the consumer. Cosmetic concerns
2414
- * (localized labels, unit suffixes, digit precision) are deliberately not here — they belong to
2415
- * the consumer; the `label` hints below are just defaults a consumer may override.
2414
+ * accepted values a consumer needs to build a control.
2415
+ *
2416
+ * Strictly the *shared* knobs: a knob only one algorithm reads belongs to that algorithm's own
2417
+ * `knobSpecs`, not here (`hour` is nxi-nite's, and lives there). A shared registry carrying a
2418
+ * single algorithm's domain would be the same hardcoded name-keyed table `knobSpecs` exists to
2419
+ * delete, moved one layer down.
2420
+ *
2421
+ * `fonts` and `anchors` carry `kind: "composite"` rather than a scalar domain: they are groups a
2422
+ * consumer expands into multiple controls (font stacks, anchor pickers), so their orchestration stays
2423
+ * with the consumer. They are declared here all the same, so that "this knob is a composite" is a fact
2424
+ * the algorithm states rather than a list of names the engine keeps. Cosmetic concerns (localized
2425
+ * labels, unit suffixes, digit precision) are deliberately not here — they belong to the consumer; the
2426
+ * `label` hints below are just defaults a consumer may override.
2416
2427
  */
2417
2428
  export const SHARED_KNOB_SPECS = [
2418
2429
  {
@@ -2469,28 +2480,50 @@ export const SHARED_KNOB_SPECS = [
2469
2480
  { name: "vibrancy", kind: "range", label: "Vibrancy", min: 0, max: 1, step: 0.05, default: 0.5 },
2470
2481
  { name: "typeScale", kind: "range", label: "Type scale", min: 1.05, max: 1.6, step: 0.01, default: 1.2 },
2471
2482
  { name: "radiusScale", kind: "range", label: "Radius scale", min: 0, max: 3, step: 0.1, default: 1 },
2472
- { name: "surfaceRamp", kind: "range", label: "Surface ramp", min: -0.06, max: 0.06, step: 0.005, default: 0.045 },
2473
2483
  // The defaults are the engine's own constants, not a second copy of them: a slider that opens on a
2474
2484
  // value the derivation does not actually use is a lie the control surface tells about the engine.
2485
+ // `surfaceRamp` is signed and its sign is scheme-derived, so it declares a default per scheme; a
2486
+ // lone `+0.045` would open the control on an *ascending* stack under a light theme, which is the
2487
+ // exact inversion of what that theme derives.
2488
+ {
2489
+ name: "surfaceRamp",
2490
+ kind: "range",
2491
+ label: "Surface ramp",
2492
+ min: -0.06,
2493
+ max: 0.06,
2494
+ step: 0.005,
2495
+ default: DEFAULT_SURFACE_STEP,
2496
+ defaultByScheme: { dark: defaultSurfaceRamp("dark"), light: defaultSurfaceRamp("light") },
2497
+ },
2475
2498
  { name: "accentSplit", kind: "range", label: "Accent split", min: 0, max: 90, step: 1, default: DEFAULT_ACCENT_SPLIT, unit: "°" },
2476
2499
  { name: "accentShiftStep", kind: "range", label: "Accent shift step", min: 0, max: 180, step: 5, default: DEFAULT_SHIFT_STEP, unit: "°" },
2477
- { name: "hour", kind: "range", label: "Hour", min: 0, max: 24, step: 1, default: 12 },
2500
+ // Groups a consumer expands into a cluster of its own, not single scalar controls. They *declare*
2501
+ // that rather than being named in a list the engine keeps: an algorithm with its own composite knob
2502
+ // (a palette array, a per-role font map) has to be able to say so, and a name-keyed table of knob
2503
+ // identities held by the engine is exactly what `knobSpecs` exists to delete.
2504
+ { name: "anchors", kind: "composite", label: "Anchors" },
2505
+ { name: "fonts", kind: "composite", label: "Fonts" },
2478
2506
  ];
2479
2507
  const SHARED_KNOB_SPEC_BY_NAME = new Map(SHARED_KNOB_SPECS.map((spec) => [spec.name, spec]));
2480
2508
  /**
2481
- * Resolve a declared knob-name list to the render specs a consumer needs. Names that match the
2482
- * shared registry get its domain; composite groups a consumer expands itself (`anchors`, `fonts`)
2483
- * resolve to nothing (they carry no single scalar control); a novel knob resolves from `extra` when
2484
- * the algorithm supplies its own spec. This is the one place a knob name becomes a renderable domain,
2485
- * so both baked and hosted facades — and a host facade rebuilding from a name list — agree.
2509
+ * Resolve a declared knob-name list to the render specs a consumer needs. A name matching the shared
2510
+ * registry gets its domain; a novel knob resolves from `extra` when the algorithm supplies its own
2511
+ * spec. This is the one place a knob name becomes a renderable domain, so both baked and hosted
2512
+ * facades — and a host facade rebuilding from a name list — agree.
2513
+ *
2514
+ * A name that resolves to nothing degrades to a `text` control rather than vanishing. An algorithm
2515
+ * that declares a knob it never described still *reads* that knob, so dropping it silently would
2516
+ * leave the one thing the author asked for unreachable, with nothing on screen to say why. A
2517
+ * permissive text field is the honest floor: the knob stays editable, and the missing domain shows up
2518
+ * as a crude control instead of an absent one. `undeclared` marks it, so a discovery surface can say
2519
+ * *why* it looks crude — a typo'd knob name surfaces as a named gap rather than a mystery text box.
2486
2520
  */
2487
2521
  export function resolveKnobSpecs(names, extra = []) {
2488
2522
  const byName = new Map(extra.map((spec) => [spec.name, spec]));
2489
2523
  const out = [];
2490
2524
  for (const name of names) {
2491
- const spec = byName.get(name) ?? SHARED_KNOB_SPEC_BY_NAME.get(name);
2492
- if (spec)
2493
- out.push(spec);
2525
+ const spec = byName.get(name) ?? SHARED_KNOB_SPEC_BY_NAME.get(name) ?? { name, kind: "text", undeclared: true };
2526
+ out.push(spec);
2494
2527
  }
2495
2528
  return out;
2496
2529
  }