@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.
- package/README.md +28 -4
- package/dist/algorithms/factory.d.ts +24 -11
- package/dist/algorithms/factory.d.ts.map +1 -1
- package/dist/algorithms/factory.js +55 -22
- package/dist/algorithms/factory.js.map +1 -1
- package/dist/baked.d.ts +14 -1
- package/dist/baked.d.ts.map +1 -1
- package/dist/baked.js +17 -0
- package/dist/baked.js.map +1 -1
- package/dist/batteries.js +11 -2
- package/dist/cli.js +55 -28
- package/dist/cli.js.map +1 -1
- package/dist/elements/qr.js +0 -0
- package/dist/elements/qr.js.map +1 -1
- package/dist/host/algorithms-bundle.generated.d.ts.map +1 -1
- package/dist/host/algorithms-bundle.generated.js +1 -1
- package/dist/host/algorithms-bundle.generated.js.map +1 -1
- package/dist/host/authoring-prelude.generated.d.ts +1 -1
- package/dist/host/authoring-prelude.generated.d.ts.map +1 -1
- package/dist/host/authoring-prelude.generated.js +1 -1
- package/dist/host/authoring-prelude.generated.js.map +1 -1
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +11 -3
- package/dist/host/index.js.map +1 -1
- package/dist/host/registry.d.ts +34 -7
- package/dist/host/registry.d.ts.map +1 -1
- package/dist/host/registry.js +45 -11
- package/dist/host/registry.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/knobs.d.ts +22 -0
- package/dist/knobs.d.ts.map +1 -0
- package/dist/knobs.js +63 -0
- package/dist/knobs.js.map +1 -0
- package/dist/mcp/tools.d.ts +7 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +65 -29
- package/dist/mcp/tools.js.map +1 -1
- package/dist/theme-file.d.ts +8 -0
- package/dist/theme-file.d.ts.map +1 -1
- package/dist/theme-file.js +10 -0
- package/dist/theme-file.js.map +1 -1
- package/dist/types.d.ts +46 -12
- package/dist/types.d.ts.map +1 -1
- package/manifest.json +25 -2
- 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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
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.
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* not
|
|
112
|
-
*
|
|
113
|
-
*
|
|
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.
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
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,e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,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.
|
|
2411
|
-
*
|
|
2412
|
-
*
|
|
2413
|
-
* not
|
|
2414
|
-
*
|
|
2415
|
-
*
|
|
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
|
-
|
|
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.
|
|
2482
|
-
*
|
|
2483
|
-
*
|
|
2484
|
-
*
|
|
2485
|
-
*
|
|
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
|
-
|
|
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
|
}
|