@designtools/tokens 0.9.0 → 0.11.0

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.
@@ -0,0 +1,199 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * The colour editor's controls, each an input to the generator, never a colour written by hand
5
+ * (pins aside, the one control that takes a colour): the shape of the ramps for the whole system and
6
+ * for one family, pins, the step contract, a ramp before and after, what changed, a link carrying the
7
+ * settings, and saved versions.
8
+ */
9
+ import { VALID_SHADES, } from "@designtools/tokens";
10
+ import { ColorInput, Field, readStored, Segmented, Select, Slider, subscribeStored, Tip, writeStored } from "@designtools/widgets";
11
+ import { Check, CircleHelp, Link2, Pin, Plus, Trash2 } from "lucide-react";
12
+ import { useCallback, useState, useSyncExternalStore } from "react";
13
+ import { describeChanges, linkFor } from "./changes.js";
14
+ import { copyText } from "./clipboard.js";
15
+ const LIGHT_END = 98;
16
+ const DARK_END = 15;
17
+ /** The command line refuses ends closer than this, so the steps can be told apart. */
18
+ const MIN_SPAN = 30;
19
+ const SHADE_OPTIONS = VALID_SHADES.map((s) => ({ value: String(s), label: String(s) }));
20
+ const LABEL = "text-[10px] font-semibold tracking-wide text-ink3 uppercase";
21
+ /** A full-width action in a popover: big enough to hit on a phone. */
22
+ export const ACTION = "inline-flex h-8 shrink-0 cursor-pointer items-center justify-center gap-1.5 self-start rounded-md bg-muted px-3 text-[12px] font-medium text-ink transition-colors hover:bg-scrim disabled:cursor-not-allowed disabled:opacity-40 outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sel";
23
+ /** What a control means, on hover or focus, instead of a paragraph under it. */
24
+ export function Hint({ text }) {
25
+ return (_jsx(Tip, { content: text, children: _jsx("span", { tabIndex: 0, "aria-label": text, className: "inline-flex cursor-help rounded-full text-ink3 outline-none hover:text-ink focus-visible:outline-2 focus-visible:outline-sel", children: _jsx(CircleHelp, { "aria-hidden": true, width: 11, height: 11 }) }) }));
26
+ }
27
+ const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
28
+ const title = (s) => s.charAt(0).toUpperCase() + s.slice(1);
29
+ const systemShape = (seed) => ({
30
+ light: seed.lightnessRange?.light ?? LIGHT_END,
31
+ dark: seed.lightnessRange?.dark ?? DARK_END,
32
+ tintFloor: seed.tintFloor ?? 0,
33
+ profile: seed.chroma?.profile ?? "follow",
34
+ strength: seed.chroma?.strength ?? 1,
35
+ peakAt: seed.chroma?.peakAt,
36
+ hueDrift: seed.hueDrift ?? "none",
37
+ });
38
+ /** The system's shape as seed fields: anything at its default left out, so the hand-back carries only what changed. */
39
+ function systemPatch(s) {
40
+ const range = {};
41
+ if (s.light !== LIGHT_END)
42
+ range.light = s.light;
43
+ if (s.dark !== DARK_END)
44
+ range.dark = s.dark;
45
+ const chroma = {};
46
+ if (s.profile !== "follow")
47
+ chroma.profile = s.profile;
48
+ if (s.strength !== 1)
49
+ chroma.strength = s.strength;
50
+ if (s.profile === "peak" && s.peakAt !== undefined)
51
+ chroma.peakAt = s.peakAt;
52
+ return {
53
+ lightnessRange: Object.keys(range).length ? range : undefined,
54
+ tintFloor: s.tintFloor ? s.tintFloor : undefined,
55
+ chroma: Object.keys(chroma).length ? chroma : undefined,
56
+ hueDrift: s.hueDrift === "none" ? undefined : s.hueDrift,
57
+ };
58
+ }
59
+ /** The controls for a ramp's shape: the range, the tint floor, colourfulness and hue drift. */
60
+ function ShapeFields({ shape, change }) {
61
+ const drift = typeof shape.hueDrift === "number" ? "degrees" : shape.hueDrift;
62
+ return (_jsxs(_Fragment, { children: [_jsx(Field, { label: "Lightest", actions: _jsx(Hint, { text: "How light the palest step is, as OKLCH lightness." }), children: (id) => _jsx(Slider, { labelledBy: id, value: shape.light, min: 80, max: 100, step: 0.5, unit: "%", onChange: (v) => change({ ...shape, light: v, dark: Math.min(shape.dark, v - MIN_SPAN) }) }) }), _jsx(Field, { label: "Darkest", actions: _jsx(Hint, { text: "How deep the darkest step goes. Raise it for soft deep tones; the steps keep a gap." }), children: (id) => _jsx(Slider, { labelledBy: id, value: shape.dark, min: 0, max: 60, step: 1, unit: "%", onChange: (v) => change({ ...shape, dark: v, light: Math.max(shape.light, v + MIN_SPAN) }) }) }), _jsx(Field, { label: "Tint floor", actions: _jsx(Hint, { text: "How much colour the pale steps keep, as far as a screen can show it. Matters most for muted colours." }), children: (id) => (_jsx(Slider, { labelledBy: id, value: Math.round(shape.tintFloor * 100), min: 0, max: 100, step: 5, format: (v) => (v === 0 ? "None" : `${v}%`), onChange: (v) => change({ ...shape, tintFloor: v / 100 }) })) }), _jsx(Field, { label: "Colourfulness", actions: _jsx(Hint, { text: "Follow eases from pale tints to the seed's colour. Constant holds it throughout. Relative keeps the seed's share of what each step can hold. Peak is strongest at one step." }), children: (id) => (_jsx(Segmented, { labelledBy: id, value: shape.profile, onChange: (v) => change({ ...shape, profile: v }), options: [
63
+ { value: "follow", label: "Follow" },
64
+ { value: "constant", label: "Constant" },
65
+ { value: "relative", label: "Relative" },
66
+ { value: "peak", label: "Peak" },
67
+ ] })) }), shape.profile === "peak" && (_jsx(Field, { label: "Peaks at", children: (id) => _jsx(Select, { labelledBy: id, value: String(shape.peakAt ?? 500), options: SHADE_OPTIONS, onChange: (v) => change({ ...shape, peakAt: Number(v) }) }) })), _jsx(Field, { label: "Strength", actions: _jsx(Hint, { text: "More or less colour than the seed's. The seed's own step never moves." }), children: (id) => _jsx(Slider, { labelledBy: id, value: Math.round(shape.strength * 100), min: 25, max: 300, step: 5, format: (v) => `×${(v / 100).toFixed(2)}`, onChange: (v) => change({ ...shape, strength: v / 100 }) }) }), _jsx(Field, { label: "Hue in the darks", actions: _jsx(Hint, { text: "Natural turns yellows towards amber and blues towards indigo as they darken, as hand-tuned ramps do." }), children: (id) => (_jsx(Segmented, { labelledBy: id, value: drift, onChange: (v) => change({ ...shape, hueDrift: v === "degrees" ? 10 : v }), options: [
68
+ { value: "none", label: "Holds" },
69
+ { value: "natural", label: "Natural" },
70
+ { value: "degrees", label: "Turn" },
71
+ ] })) }), typeof shape.hueDrift === "number" && (_jsx(Field, { label: "Turns by", children: (id) => _jsx(Slider, { labelledBy: id, value: shape.hueDrift, min: -45, max: 45, step: 1, unit: "\u00B0", onChange: (v) => change({ ...shape, hueDrift: v }) }) }))] }));
72
+ }
73
+ /** Every colour ramp's shape, for the whole system. */
74
+ export function SystemShape({ edit }) {
75
+ return (_jsxs(_Fragment, { children: [_jsxs("p", { className: `flex items-center gap-1.5 pt-1 ${LABEL}`, children: ["All ramps ", _jsx(Hint, { text: "Settings every colour ramp shares. The neutral isn't included, since both modes' backgrounds are made from it; change it on its own ramp." })] }), _jsx(ShapeFields, { shape: systemShape(edit.seed), change: (next) => edit.set(systemPatch(next)) })] }));
76
+ }
77
+ /** One family's shape: the system's, until it leans away; every difference is listed in the settings. */
78
+ export function FamilyShapeControls({ family, edit }) {
79
+ const { seed, set } = edit;
80
+ const own = seed.families?.[family];
81
+ const sys = family === "neutral" ? systemShape({}) : systemShape(seed);
82
+ const shape = {
83
+ light: own?.lightnessRange?.light ?? sys.light,
84
+ dark: own?.lightnessRange?.dark ?? sys.dark,
85
+ tintFloor: own?.tintFloor ?? sys.tintFloor,
86
+ profile: own?.chroma?.profile ?? sys.profile,
87
+ strength: own?.chroma?.strength ?? sys.strength,
88
+ peakAt: own?.chroma?.peakAt ?? sys.peakAt,
89
+ hueDrift: own?.hueDrift ?? sys.hueDrift,
90
+ };
91
+ const change = (next) => {
92
+ // keep only what differs from the system's shape
93
+ const diff = {};
94
+ const range = {};
95
+ if (next.light !== sys.light)
96
+ range.light = next.light;
97
+ if (next.dark !== sys.dark)
98
+ range.dark = next.dark;
99
+ if (Object.keys(range).length)
100
+ diff.lightnessRange = range;
101
+ if (next.tintFloor !== sys.tintFloor)
102
+ diff.tintFloor = next.tintFloor;
103
+ const chroma = {};
104
+ if (next.profile !== sys.profile)
105
+ chroma.profile = next.profile;
106
+ if (next.strength !== sys.strength)
107
+ chroma.strength = next.strength;
108
+ if (next.profile === "peak" && next.peakAt !== sys.peakAt)
109
+ chroma.peakAt = next.peakAt;
110
+ if (Object.keys(chroma).length)
111
+ diff.chroma = chroma;
112
+ if (next.hueDrift !== sys.hueDrift)
113
+ diff.hueDrift = next.hueDrift;
114
+ const families = { ...seed.families };
115
+ if (Object.keys(diff).length)
116
+ families[family] = diff;
117
+ else
118
+ delete families[family];
119
+ set({ families: Object.keys(families).length ? families : undefined });
120
+ };
121
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("p", { className: `flex items-center gap-1.5 ${LABEL}`, children: ["This ramp ", _jsx(Hint, { text: "Starts from the settings for all ramps. Change one here and it applies to this ramp only." })] }), own && (_jsx("button", { type: "button", onClick: () => change(sys), className: "cursor-pointer rounded-sm px-1 text-[10px] text-ink3 hover:text-ink", children: "Match all ramps" }))] }), _jsx(ShapeFields, { shape: shape, change: change })] }));
122
+ }
123
+ /* ---------------------------------------------------------------------------------------------- */
124
+ /* Pins */
125
+ /** Exact colours on given steps of one family; the ramp bends through them. */
126
+ export function Pins({ family, anchor, edit }) {
127
+ const { seed, set, system } = edit;
128
+ const pins = seed.pins?.[family] ?? {};
129
+ const steps = Object.keys(pins).map(Number);
130
+ const scale = system?.primitives[family];
131
+ const write = (next) => {
132
+ const all = { ...seed.pins };
133
+ if (Object.keys(next).length)
134
+ all[family] = next;
135
+ else
136
+ delete all[family];
137
+ set({ pins: Object.keys(all).length ? all : undefined });
138
+ };
139
+ const free = VALID_SHADES.filter((s) => s !== anchor && !steps.includes(s));
140
+ const add = () => {
141
+ const step = free.find((s) => s > anchor) ?? free[0];
142
+ if (step !== undefined)
143
+ write({ ...pins, [step]: scale?.[String(step)] ?? "#808080" });
144
+ };
145
+ return (_jsxs(_Fragment, { children: [_jsxs("p", { className: `flex items-center gap-1.5 ${LABEL}`, children: ["Exact colours", " ", _jsx(Hint, { text: "Use an exact colour for one step instead of the generated one, a print match say. The steps around it adjust so the ramp still runs light to dark; a colour that can't fit, or can't be shown on screen, is refused with the reason." })] }), steps.map((step) => (_jsxs("div", { className: "flex items-end gap-1.5", children: [_jsx("div", { className: "w-[84px] shrink-0", children: _jsx(Select, { label: "Step", value: String(step), options: SHADE_OPTIONS.filter((o) => Number(o.value) === step || free.includes(Number(o.value))), onChange: (v) => {
146
+ const { [step]: colour, ...rest } = pins;
147
+ write({ ...rest, [Number(v)]: colour });
148
+ } }) }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(ColorInput, { label: `${family} ${step}`, value: pins[step] ?? "", onChange: (c) => write({ ...pins, [step]: c }) }) }), _jsx("button", { type: "button", "aria-label": `Back to the generated colour on ${step}`, onClick: () => {
149
+ const { [step]: _, ...rest } = pins;
150
+ write(rest);
151
+ }, className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-ink3 hover:bg-scrim hover:text-ink", children: _jsx(Trash2, { "aria-hidden": true, width: 14, height: 14 }) })] }, step))), _jsxs("button", { type: "button", onClick: add, disabled: !free.length, className: ACTION, children: [_jsx(Pin, { "aria-hidden": true, width: 13, height: 13 }), " Use an exact colour for a step"] })] }));
152
+ }
153
+ /* ---------------------------------------------------------------------------------------------- */
154
+ /* A ramp before and after, the step contract, what changed */
155
+ /** One family's ramp now, over the project's own, to see what moved. */
156
+ export function Compare({ family, edit }) {
157
+ const now = edit.system?.primitives[family];
158
+ const before = edit.base?.primitives[family];
159
+ if (!now)
160
+ return null;
161
+ const row = (scale, label) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "w-10 shrink-0 text-[9px] text-ink3", children: label }), _jsx("span", { className: "grid flex-1 grid-cols-12", children: VALID_SHADES.map((s) => (_jsx("span", { title: scale ? `${s}: ${scale[String(s)]}` : undefined, className: "h-4", style: { background: scale?.[String(s)] ?? "transparent" } }, s))) })] }));
162
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [row(now, "Now"), before ? row(before, "Before") : _jsx("p", { className: "text-[10px] text-ink3", children: "New: not in the project yet." })] }));
163
+ }
164
+ /** The changes, listed, so drift is visible: every family that leans away shows here. */
165
+ export function Changes({ edit }) {
166
+ const list = describeChanges(edit.baseSeed, edit.seed);
167
+ if (!list.length)
168
+ return null;
169
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("p", { className: LABEL, children: "Changed" }), _jsx("ul", { className: "flex flex-col gap-0.5 text-[10px] leading-snug text-ink2", children: list.map((c) => (_jsx("li", { children: c }, c))) })] }));
170
+ }
171
+ /* ---------------------------------------------------------------------------------------------- */
172
+ /* Sharing and versions */
173
+ const VERSIONS_KEY = "studio:versions";
174
+ const NONE = [];
175
+ /** Named versions of the settings, kept in this browser, to compare before handing one back. */
176
+ export function Versions({ edit }) {
177
+ const versions = useSyncExternalStore(useCallback((cb) => subscribeStored((k) => k === VERSIONS_KEY && cb()), []), () => readStored(VERSIONS_KEY, NONE), () => NONE);
178
+ const save = () => writeStored(VERSIONS_KEY, [...versions, { name: `Version ${versions.length + 1}`, seed: edit.seed, at: Date.now() }]);
179
+ // a version's link: copied, or shown to copy by hand when the clipboard refuses
180
+ const [linked, setLinked] = useState(null);
181
+ const copyLink = async (v) => {
182
+ const url = linkFor(v.seed);
183
+ try {
184
+ await copyText(url);
185
+ setLinked({ at: v.at });
186
+ setTimeout(() => setLinked((l) => (l?.at === v.at && !l.url ? null : l)), 1500);
187
+ }
188
+ catch {
189
+ setLinked({ at: v.at, url });
190
+ }
191
+ };
192
+ const drop = (i) => {
193
+ const next = versions.filter((_, j) => j !== i);
194
+ writeStored(VERSIONS_KEY, next.length ? next : undefined);
195
+ };
196
+ return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("p", { className: `flex items-center gap-1.5 ${LABEL}`, children: ["Versions ", _jsx(Hint, { text: "Kept in this browser, to compare before handing one back. Each has a link that opens this page with it, for someone else to see." })] }), versions.map((v, i) => (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[11px]", children: [_jsx("span", { className: "min-w-0 flex-1 truncate text-ink", children: v.name }), _jsx("span", { className: "text-[10px] text-ink3", children: plural(describeChanges(edit.baseSeed, v.seed).length, "change") }), _jsx("button", { type: "button", onClick: () => edit.set({ ...v.seed }), className: "flex h-7 cursor-pointer items-center rounded-md px-2 text-[11px] text-ink2 hover:bg-scrim hover:text-ink", children: "Show" }), _jsx(Tip, { content: linked?.at === v.at && !linked.url ? "Link copied" : `Copy a link that opens this page with ${v.name}`, children: _jsx("button", { type: "button", "aria-label": `Copy a link to ${v.name}`, onClick: () => copyLink(v), className: "flex size-7 cursor-pointer items-center justify-center rounded-md text-ink3 hover:bg-scrim hover:text-ink", children: linked?.at === v.at && !linked.url ? _jsx(Check, { "aria-hidden": true, width: 13, height: 13 }) : _jsx(Link2, { "aria-hidden": true, width: 13, height: 13 }) }) }), _jsx("button", { type: "button", "aria-label": `Delete ${v.name}`, onClick: () => drop(i), className: "flex size-7 cursor-pointer items-center justify-center rounded-md text-ink3 hover:bg-scrim hover:text-ink", children: _jsx(Trash2, { "aria-hidden": true, width: 13, height: 13 }) })] }), linked?.at === v.at && linked.url && (_jsx("textarea", { readOnly: true, value: linked.url, onFocus: (e) => e.currentTarget.select(), className: "h-14 w-full resize-none rounded-md bg-muted p-2 font-mono text-[10px] text-ink2" }))] }, v.at))), _jsxs("button", { type: "button", onClick: save, className: ACTION, children: [_jsx(Plus, { "aria-hidden": true, width: 13, height: 13 }), " Save as a version"] })] }));
197
+ }
198
+ export { title };
199
+ export { describeChanges, seedFromHash } from "./changes.js";
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from "react";
2
+ import { type Edit } from "./colour-controls.js";
3
+ /** The page's anchors of one kind, kept up to date as the page renders (a colour the generator adds brings its own). */
4
+ export declare function useAnchors(kind: string): HTMLElement[];
5
+ /** Fills the colour page's anchors. Rendered by `ColourGenerator`, inside the app's `<Widgets>`. */
6
+ export declare function InPlaceEditor({ edit, score, clear, prompt, changes, }: {
7
+ edit: Edit;
8
+ score: ReactNode;
9
+ clear: () => void;
10
+ /** The hand-back for the agent, once something has changed. */
11
+ prompt: string | null;
12
+ /** What changed, in words. */
13
+ changes: string[];
14
+ }): import("react").JSX.Element;
@@ -0,0 +1,268 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ /**
4
+ * The colour editor, in place on the docs' colour page. The page draws nothing for it: it leaves
5
+ * empty anchors (`data-designtools-slot="colour:page"`, `"colour:ramp"`, `"colour:family"`), and
6
+ * this fills them. The header gets an Edit colours switch; with it on, each ramp and each colour gets
7
+ * a small button beside its name that opens its settings in a popover, so the page keeps its layout
8
+ * and a ramp is changed while looking at it. Every change is a change to the generator's seed.
9
+ */
10
+ import { Popover } from "@base-ui/react/popover";
11
+ import { getAPCAContrast, getContrastRatio, isAPCAAvailable, VALID_SHADES, } from "@designtools/tokens";
12
+ import { ColorInput, Field, POPUP, readStored, Row, Segmented, Select, subscribeStored, THEME_KEY, Tip, TipProvider, ToolRoot, usePortalContainer, writeStored } from "@designtools/widgets";
13
+ import { Bot, Check, Moon, Palette, Plus, RotateCcw, SlidersHorizontal, Sun, Trash2 } from "lucide-react";
14
+ import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
15
+ import { createPortal } from "react-dom";
16
+ import { ACTION, Compare, FamilyShapeControls, Hint, Pins, SystemShape, Versions } from "./colour-controls.js";
17
+ import { css, properties } from "./css.js";
18
+ import { generateFromSeed } from "./seed.js";
19
+ import { copyText } from "./clipboard.js";
20
+ const STYLES = [{ id: "tokens-studio", css, properties }];
21
+ /** Whether the colour page is in edit mode: kept, and the same in every tab. */
22
+ const EDIT_KEY = "colour:edit";
23
+ const STATUS = ["success", "destructive", "warning"];
24
+ const NAME = /^[a-z][a-z0-9-]*$/;
25
+ const FLOORS = {
26
+ wcag: { "aa-large": 3, aa: 4.5, aaa: 7 },
27
+ apca: { "aa-large": 45, aa: 60, aaa: 75 },
28
+ };
29
+ const SHADES = VALID_SHADES.map((s) => ({ value: String(s), label: String(s) }));
30
+ const BUTTON = "inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-md border border-edge bg-page px-2.5 text-[12px] font-medium text-ink shadow-xs hover:bg-scrim data-popup-open:bg-scrim outline-none focus-visible:outline-2 focus-visible:outline-sel";
31
+ /** A button in the floating bar: no border of its own, the bar is the frame. */
32
+ const BAR = "inline-flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg px-2.5 text-[12px] font-medium text-ink hover:bg-scrim data-popup-open:bg-scrim outline-none focus-visible:outline-2 focus-visible:outline-sel";
33
+ /** An icon on its own in the bar. */
34
+ const ICON = `${BAR} w-8 justify-center px-0`;
35
+ function useEditing() {
36
+ return useSyncExternalStore(useCallback((cb) => subscribeStored((k) => k === EDIT_KEY && cb()), []), () => readStored(EDIT_KEY, false), () => false);
37
+ }
38
+ /** The page's anchors of one kind, kept up to date as the page renders (a colour the generator adds brings its own). */
39
+ export function useAnchors(kind) {
40
+ const [found, setFound] = useState([]);
41
+ useEffect(() => {
42
+ const find = () => {
43
+ const next = [...document.querySelectorAll(`[data-designtools-slot="${kind}"]`)];
44
+ setFound((was) => (was.length === next.length && was.every((el, i) => el === next[i]) ? was : next));
45
+ };
46
+ find();
47
+ const watch = new MutationObserver(find);
48
+ watch.observe(document.body, { childList: true, subtree: true });
49
+ return () => watch.disconnect();
50
+ }, [kind]);
51
+ return found;
52
+ }
53
+ /** A sealed spot in the page for one control: the widgets' styles inside, nothing leaking out. */
54
+ function Sealed({ children, style }) {
55
+ return (_jsx(ToolRoot, { styles: STYLES, style: style ?? { display: "inline-block", verticalAlign: "middle", lineHeight: 0 }, children: _jsx(TipProvider, { children: children }) }));
56
+ }
57
+ /** A button that opens its settings in place, in a popover beside it. */
58
+ function InPlace({ trigger, title, label, children, width = 288, bare = false, icon = false, side = "bottom", }) {
59
+ const container = usePortalContainer();
60
+ return (_jsxs(Popover.Root, { children: [_jsx(Popover.Trigger, { "aria-label": label, className: bare
61
+ ? "flex size-6 cursor-pointer items-center justify-center rounded-md text-ink3 outline-none hover:bg-scrim hover:text-ink focus-visible:outline-2 focus-visible:outline-sel data-popup-open:bg-scrim data-popup-open:text-ink"
62
+ : icon
63
+ ? ICON
64
+ : BUTTON, children: trigger }), _jsx(Popover.Portal, { container: container, children: _jsx(Popover.Positioner, { side: side, align: "end", sideOffset: side === "top" ? 10 : 6, collisionPadding: 12, positionMethod: "fixed", className: "z-50", children: _jsxs(Popover.Popup, { className: `${POPUP} flex max-h-[min(560px,calc(100vh-96px))] flex-col gap-3 overflow-y-auto p-3.5`, style: { width }, children: [_jsx(Popover.Title, { className: "text-[11px] font-semibold text-ink", children: title }), children] }) }) })] }));
65
+ }
66
+ /** A pairing's contrast in the chosen algorithm, and whether it reaches the target. */
67
+ function measure(fg, bg, algorithm, target) {
68
+ try {
69
+ const score = algorithm === "apca" ? Math.round(Math.abs(getAPCAContrast(fg, bg)) * 10) / 10 : Math.round(getContrastRatio(fg, bg) * 100) / 100;
70
+ return { score, pass: score >= FLOORS[algorithm][target] };
71
+ }
72
+ catch {
73
+ return { score: 0, pass: false };
74
+ }
75
+ }
76
+ /** Fills the colour page's anchors. Rendered by `ColourGenerator`, inside the app's `<Widgets>`. */
77
+ export function InPlaceEditor({ edit, score, clear, prompt, changes, }) {
78
+ const editing = useEditing();
79
+ const pages = useAnchors("colour:page");
80
+ const ramps = useAnchors("colour:ramp");
81
+ const families = useAnchors("colour:family");
82
+ return (_jsxs(_Fragment, { children: [pages.length > 0 && (_jsx(Sealed, { style: { position: "fixed", right: 16, bottom: 16, zIndex: 2147482000, lineHeight: 0 }, children: _jsxs("div", { role: "toolbar", "aria-label": "Colour", className: "flex max-w-[calc(100vw-32px)] items-center gap-0.5 rounded-xl border border-edge bg-page p-1 text-ink shadow-lg shadow-black/15", children: [editing && (_jsxs(_Fragment, { children: [prompt && (_jsxs(_Fragment, { children: [_jsx(CopyPrompt, { prompt: prompt, changes: changes }), _jsx(Divider, {})] })), _jsx(InPlace, { title: "Add a colour", label: "Add a colour", icon: true, side: "top", trigger: _jsx(Plus, { "aria-hidden": true, width: 15, height: 15 }), width: 300, children: _jsx(AddColour, { edit: edit }) }), prompt && (_jsx(Tip, { content: "Back to the project's colours", side: "top", children: _jsx("button", { type: "button", "aria-label": "Back to the project's colours", onClick: clear, className: ICON, children: _jsx(RotateCcw, { "aria-hidden": true, width: 14, height: 14 }) }) })), _jsx(ModeSwitch, {}), _jsxs(InPlace, { title: "Colour settings", label: "Colour settings", icon: true, side: "top", trigger: _jsx(SlidersHorizontal, { "aria-hidden": true, width: 14, height: 14 }), width: 320, children: [_jsx(Refused, { error: edit.error }), score, _jsx(SystemSettings, { edit: edit }), _jsx(Versions, { edit: edit })] }), _jsx(Divider, {})] })), _jsxs("button", { type: "button", "aria-pressed": editing, onClick: () => writeStored(EDIT_KEY, editing ? undefined : true), className: BAR, children: [editing ? _jsx(Check, { "aria-hidden": true, width: 14, height: 14 }) : _jsx(Palette, { "aria-hidden": true, width: 14, height: 14 }), editing ? "Done" : "Edit colours"] })] }) })), editing &&
83
+ ramps.map((el, i) => {
84
+ const family = el.dataset.family ?? "";
85
+ return editable(family, edit.seed)
86
+ ? createPortal(_jsx(Sealed, { children: _jsx(RampSettings, { family: family, edit: edit }) }), el, `ramp-${family}-${i}`)
87
+ : null;
88
+ }), editing &&
89
+ families.map((el, i) => {
90
+ const family = el.dataset.family ?? "";
91
+ return edit.system?.semantic.light[family] ? createPortal(_jsx(Sealed, { children: _jsx(Roles, { family: family, edit: edit }) }), el, `family-${family}-${i}`) : null;
92
+ })] }));
93
+ }
94
+ /** A thin line between groups in the bar. */
95
+ function Divider() {
96
+ return _jsx("span", { "aria-hidden": true, className: "mx-1 h-5 w-px shrink-0 bg-edge" });
97
+ }
98
+ /**
99
+ * Add a colour: a new family beside primary and neutral, made from one colour. It gets a full ramp
100
+ * (25 to 950) and its own fill, subdued, hover and press, each label measured like the rest, and it
101
+ * shows on the page as it's added.
102
+ */
103
+ function AddColour({ edit }) {
104
+ const colours = edit.seed.additionalColors ?? [];
105
+ const taken = new Set(["primary", "neutral", "black", "white", "muted", "canvas", "surface", "overlay", "border", "input", "ring", ...STATUS, "green", "red", "yellow", ...colours.map((c) => c.name)]);
106
+ const suggest = () => ["accent", "info", "highlight", "brand", "extra"].find((n) => !taken.has(n)) ?? `colour-${colours.length + 1}`;
107
+ const [name, setName] = useState(suggest);
108
+ const [color, setColor] = useState("#8b5cf6");
109
+ const [added, setAdded] = useState(null);
110
+ const problem = !NAME.test(name) ? "Lower case letters, numbers and dashes, starting with a letter" : taken.has(name) ? "That name is taken" : null;
111
+ const add = () => {
112
+ if (problem)
113
+ return;
114
+ edit.set({ additionalColors: [...colours, { name, color }] });
115
+ setAdded(name);
116
+ setName(["accent", "info", "highlight", "brand", "extra"].find((n) => n !== name && !taken.has(n)) ?? `colour-${colours.length + 2}`);
117
+ };
118
+ return (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-[11px] leading-snug text-ink2", children: "A new colour beside primary and neutral: its own ramp, and a fill, subdued, hover and press, each checked for contrast." }), _jsx(Field, { label: "Name", actions: _jsx(Hint, { text: `How it's written in the code: --${name || "accent"} and bg-${name || "accent"}.` }), children: (id) => (_jsx("input", { "aria-labelledby": id, value: name, spellCheck: false, "aria-invalid": Boolean(problem), onChange: (e) => setName(e.target.value.toLowerCase().replace(/\s+/g, "-")), onKeyDown: (e) => e.key === "Enter" && add(), className: `h-8 w-full rounded-md bg-muted px-2 font-mono text-[12px] text-ink outline-none focus-visible:ring-1 focus-visible:ring-sel ${problem ? "ring-1 ring-fail" : ""}` })) }), problem && _jsx("p", { className: "text-[11px] text-fail", children: problem }), _jsx(Field, { label: "Colour", actions: _jsx(Hint, { text: "The colour it's made from. It lands on step 500; change that on its ramp once it's added." }), children: (id) => _jsx(ColorInput, { label: "New colour", labelledBy: id, value: color, onChange: setColor }) }), _jsxs("button", { type: "button", onClick: add, disabled: Boolean(problem), className: ACTION, children: [_jsx(Plus, { "aria-hidden": true, width: 13, height: 13 }), " Add ", name || "colour"] }), added && _jsxs("p", { className: "text-[11px] text-ink2", children: ["Added ", added, ": it's on the page now, with its ramp and its settings."] })] }));
119
+ }
120
+ /** Light or dark, for the page and the tools together: the same switch as the dock's, in the widget's own button. */
121
+ function ModeSwitch() {
122
+ const chosen = useSyncExternalStore(useCallback((cb) => subscribeStored((k) => k === THEME_KEY && cb()), []), () => readStored(THEME_KEY, null), () => null);
123
+ const dark = chosen === "dark" ||
124
+ (chosen !== "light" && (document.documentElement.dataset.theme === "dark" || (!document.documentElement.dataset.theme && matchMedia("(prefers-color-scheme: dark)").matches)));
125
+ const label = dark ? "Light mode" : "Dark mode";
126
+ return (_jsx(Tip, { content: label, side: "top", children: _jsx("button", { type: "button", "aria-label": label, onClick: () => writeStored(THEME_KEY, dark ? "light" : "dark"), className: ICON, children: dark ? _jsx(Sun, { "aria-hidden": true, width: 14, height: 14 }) : _jsx(Moon, { "aria-hidden": true, width: 14, height: 14 }) }) }));
127
+ }
128
+ /** Copy prompt in the main widget: the changes on hover, the prompt shown to copy by hand when the clipboard refuses. */
129
+ function CopyPrompt({ prompt, changes }) {
130
+ const container = usePortalContainer();
131
+ const anchor = useRef(null);
132
+ const [state, setState] = useState("idle");
133
+ const copy = async () => {
134
+ try {
135
+ await copyText(prompt);
136
+ setState("copied");
137
+ setTimeout(() => setState("idle"), 1500);
138
+ }
139
+ catch {
140
+ setState("manual");
141
+ }
142
+ };
143
+ return (_jsxs(Popover.Root, { open: state === "manual", onOpenChange: (open) => !open && setState("idle"), children: [_jsx(Tip, { content: `A prompt for your agent: ${changes.join("; ")}`, side: "top", children: _jsxs("button", { ref: anchor, type: "button", onClick: copy, className: BAR, children: [state === "copied" ? _jsx(Check, { "aria-hidden": true, width: 13, height: 13 }) : _jsx(Bot, { "aria-hidden": true, width: 13, height: 13 }), state === "copied" ? "Copied" : "Copy prompt", _jsx("span", { className: "rounded-full bg-sel px-1.5 text-[10px] leading-[16px] text-white tabular-nums", children: changes.length })] }) }), _jsx(Popover.Portal, { container: container, children: _jsx(Popover.Positioner, { anchor: anchor, side: "top", align: "end", sideOffset: 10, collisionPadding: 12, positionMethod: "fixed", className: "z-50", children: _jsxs(Popover.Popup, { className: `${POPUP} flex w-[340px] flex-col gap-2 p-3.5`, children: [_jsx(Popover.Title, { className: "text-[11px] font-semibold text-ink", children: "Copy this prompt" }), _jsx("textarea", { readOnly: true, value: prompt, onFocus: (e) => e.currentTarget.select(), className: "h-48 w-full resize-none rounded-md bg-muted p-2 font-mono text-[10px] leading-relaxed text-ink2" })] }) }) })] }));
144
+ }
145
+ /** A ramp the seed can change: the two seeds, the status colours, and colours added. Aliases (green for success) aren't. */
146
+ function editable(family, seed) {
147
+ return family === "primary" || family === "neutral" || STATUS.includes(family) || (seed.additionalColors ?? []).some((c) => c.name === family);
148
+ }
149
+ /** The whole system: how it measures and generates, and colours to add. */
150
+ function SystemSettings({ edit }) {
151
+ const { seed, set } = edit;
152
+ const apca = isAPCAAvailable();
153
+ return (_jsxs(_Fragment, { children: [_jsx(Field, { label: "Contrast", actions: _jsx(Hint, { text: "How contrast is measured. WCAG 2 is what audits check; APCA also weighs how text looks at its size, and is optional." }), children: (id) => (_jsx(Segmented, { labelledBy: id, value: seed.contrastAlgorithm ?? "wcag", onChange: (v) => set({ contrastAlgorithm: v }), options: [{ value: "wcag", label: "WCAG 2" }, ...(apca ? [{ value: "apca", label: "APCA" }] : [])] })) }), _jsx(Field, { label: "Target", actions: _jsx(Hint, { text: "The level every label has to reach on its fill: AA large 3:1, AA 4.5:1, AAA 7:1." }), children: (id) => (_jsx(Segmented, { labelledBy: id, value: seed.contrastTarget ?? "aa", onChange: (v) => set({ contrastTarget: v }), options: [
154
+ { value: "aa-large", label: "AA large" },
155
+ { value: "aa", label: "AA" },
156
+ { value: "aaa", label: "AAA" },
157
+ ] })) }), _jsxs(Row, { children: [_jsx(Field, { label: "Lightness", actions: _jsx(Hint, { text: "How the steps are spaced. Fixed: smooth at the light end, bigger jumps in the darks. Even: more evenly spaced as the eye sees them." }), children: (id) => (_jsx(Segmented, { labelledBy: id, value: seed.lightnessStrategy ?? "fixed", onChange: (v) => set({ lightnessStrategy: v }), options: [
158
+ { value: "fixed", label: "Fixed" },
159
+ { value: "perceptual", label: "Even" },
160
+ ] })) }), _jsx(Field, { label: "Labels on fills", actions: _jsx(Hint, { text: "The text on a filled colour. Balanced: white, black, or a tint of the colour that keeps nearly all the contrast. Strongest: always white or black." }), children: (id) => (_jsx(Segmented, { labelledBy: id, value: seed.foreground ?? "balanced", onChange: (v) => set({ foreground: v }), options: [
161
+ { value: "balanced", label: "Balanced" },
162
+ { value: "max", label: "Strongest" },
163
+ ] })) })] }), _jsx(SystemShape, { edit: edit })] }));
164
+ }
165
+ /** Why the settings can't be generated, when they can't: a refused pin, said plainly. */
166
+ function Refused({ error }) {
167
+ if (!error)
168
+ return null;
169
+ return _jsxs("p", { className: "rounded-md bg-fail/10 px-2.5 py-2 text-[11px] leading-snug text-fail", children: ["Not applied: ", error] });
170
+ }
171
+ /** One ramp: the colour it's made from, the step that colour lands on, and, for an added colour, its name. */
172
+ function RampSettings({ family, edit }) {
173
+ const { seed, set, system } = edit;
174
+ const colours = seed.additionalColors ?? [];
175
+ const entry = colours.find((c) => c.name === family);
176
+ const status = STATUS.includes(family);
177
+ const derived = status && !entry;
178
+ const scale = system?.primitives[family];
179
+ const swatch = family === "primary" ? seed.primaryColor : family === "neutral" ? seed.neutralColor : entry?.color;
180
+ const shown = swatch ?? (scale && typeof scale === "object" ? scale["500"] : "");
181
+ const step = family === "primary" ? seed.seedShade : family === "neutral" ? seed.neutralSeedShade : entry?.seedShade;
182
+ const setEntry = (patch) => set({ additionalColors: entry ? colours.map((c) => (c.name === family ? { ...c, ...patch } : c)) : [...colours, { name: family, color: shown ?? "#000000", ...patch }] });
183
+ const setColour = (color) => (family === "primary" ? set({ primaryColor: color }) : family === "neutral" ? set({ neutralColor: color }) : setEntry({ color }));
184
+ const setStep = (v) => {
185
+ const s = Number(v);
186
+ if (family === "primary")
187
+ set({ seedShade: s });
188
+ else if (family === "neutral")
189
+ set({ neutralSeedShade: s });
190
+ else
191
+ setEntry({ seedShade: s });
192
+ };
193
+ const without = colours.filter((c) => c.name !== family);
194
+ const anchor = ((family === "primary" ? seed.seedShade : family === "neutral" ? seed.neutralSeedShade : entry?.seedShade) ?? 500);
195
+ const refused = edit.error?.startsWith(`${family}:`) ? edit.error.slice(family.length + 1).trim() : null;
196
+ return (_jsxs(InPlace, { title: `${family.charAt(0).toUpperCase()}${family.slice(1)} ramp`, label: `${family} ramp settings`, width: 320, trigger: _jsx(SlidersHorizontal, { "aria-hidden": true, width: 14, height: 14 }), bare: true, children: [_jsx(Refused, { error: refused }), _jsx(Compare, { family: family, edit: edit }), _jsx(Field, { label: "Made from", actions: _jsx(Hint, { text: derived ? "Made from the primary until you change it here. The colour lands exactly on the step below." : "The colour this ramp is built from. It lands exactly on the step below; every other step is worked out from it." }), children: (id) => _jsx(ColorInput, { label: `${family} colour`, labelledBy: id, value: shown ?? "", onChange: setColour }) }), _jsx(Field, { label: "Lands on step", actions: _jsx(Hint, { text: "Which step the colour sits on. A dark colour belongs low (700), a pale one high (200), so the ramp has room either side." }), children: (id) => _jsx(Select, { labelledBy: id, value: String(step ?? 500), options: SHADES, onChange: setStep }) }), entry && !status && (_jsx(Field, { label: "Name", actions: _jsx(Hint, { text: `Its name in the code: --${family}, and bg-${family} in Tailwind.` }), children: (id) => (_jsx("input", { "aria-labelledby": id, value: family, spellCheck: false, "aria-invalid": !NAME.test(family), onChange: (e) => {
197
+ const name = e.target.value.toLowerCase().replace(/\s+/g, "-");
198
+ set({ additionalColors: colours.map((c) => (c.name === family ? { ...c, name } : c)) });
199
+ }, className: "h-7 w-full rounded-md bg-muted px-2 font-mono text-[11px] text-ink outline-none focus-visible:ring-1 focus-visible:ring-sel" })) })), entry && (_jsxs("button", { type: "button", onClick: () => set({ additionalColors: without.length ? without : undefined }), className: ACTION, children: [status ? _jsx(RotateCcw, { "aria-hidden": true, width: 13, height: 13 }) : _jsx(Trash2, { "aria-hidden": true, width: 13, height: 13 }), status ? "Made from the primary again" : "Remove this colour"] })), _jsx(FamilyShapeControls, { family: family, edit: edit }), _jsx(Pins, { family: family, anchor: anchor, edit: edit })] }));
200
+ }
201
+ const ROLES = [
202
+ { key: "DEFAULT", label: "Fill", fg: "foreground" },
203
+ { key: "subdued", label: "Subdued", fg: "subdued-foreground" },
204
+ ];
205
+ /** One colour's roles: which step its fill and its subdued sit on, in each mode, from the steps whose labels pass. */
206
+ function Roles({ family, edit }) {
207
+ return (_jsx(InPlace, { title: `${family.charAt(0).toUpperCase()}${family.slice(1)}: which steps`, label: `${family} roles`, trigger: _jsxs(_Fragment, { children: [_jsx(SlidersHorizontal, { "aria-hidden": true, width: 13, height: 13 }), " Steps"] }), width: 320, children: _jsx(RolePicker, { family: family, edit: edit }) }));
208
+ }
209
+ function RolePicker({ family, edit }) {
210
+ const { seed, set, system } = edit;
211
+ const [mode, setMode] = useState(() => (document.documentElement.dataset.theme === "dark" ? "dark" : "light"));
212
+ const algorithm = seed.contrastAlgorithm ?? "wcag";
213
+ const target = seed.contrastTarget ?? "aa";
214
+ const scale = system?.primitives[family];
215
+ const steps = scale ? Object.keys(scale).map(Number).filter((n) => !Number.isNaN(n)) : [];
216
+ const overrides = seed.shadeOverrides?.[family]?.[mode] ?? {};
217
+ // each step tried in turn, generated for real, so the label the generator would choose is the one measured
218
+ const options = useMemo(() => {
219
+ const out = {};
220
+ for (const role of ROLES) {
221
+ out[role.key] = steps.map((step) => {
222
+ try {
223
+ const tried = generateFromSeed({
224
+ ...seed,
225
+ shadeOverrides: { ...seed.shadeOverrides, [family]: { ...seed.shadeOverrides?.[family], [mode]: { ...overrides, [role.key]: step } } },
226
+ });
227
+ const c = tried.semantic[mode][family];
228
+ const bg = c[role.key];
229
+ const fg = c[role.fg];
230
+ return { step, bg, fg, ...measure(fg, bg, algorithm, target) };
231
+ }
232
+ catch {
233
+ return { step, bg: scale?.[String(step)] ?? "", fg: "", score: 0, pass: false };
234
+ }
235
+ });
236
+ }
237
+ return out;
238
+ // biome-ignore lint/correctness/useExhaustiveDependencies: the seed and mode decide every option
239
+ }, [seed, family, mode]);
240
+ const current = (key) => {
241
+ const c = system?.semantic[mode][family];
242
+ return options[key]?.find((o) => o.bg === c?.[key])?.step;
243
+ };
244
+ const choose = (key, step) => {
245
+ const nextMode = { ...overrides, [key]: step };
246
+ if (step === undefined)
247
+ delete nextMode[key];
248
+ const nextFamily = { ...seed.shadeOverrides?.[family], [mode]: nextMode };
249
+ if (!Object.keys(nextMode).length)
250
+ delete nextFamily[mode];
251
+ const next = { ...seed.shadeOverrides, [family]: nextFamily };
252
+ if (!Object.keys(nextFamily).length)
253
+ delete next[family];
254
+ set({ shadeOverrides: next });
255
+ };
256
+ const unit = algorithm === "apca" ? "Lc " : "";
257
+ const suffix = algorithm === "apca" ? "" : ":1";
258
+ return (_jsxs(_Fragment, { children: [_jsx(Segmented, { label: "Mode", value: mode, onChange: (v) => setMode(v), options: [
259
+ { value: "light", label: "Light" },
260
+ { value: "dark", label: "Dark" },
261
+ ] }), ROLES.map((role) => {
262
+ const chosen = overrides[role.key];
263
+ const now = current(role.key);
264
+ return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("div", { className: "flex items-center justify-between text-[10px]", children: [_jsxs("span", { className: "flex items-center gap-1.5 font-medium text-ink2", children: [role.label, _jsx(Hint, { text: role.key === "DEFAULT"
265
+ ? "The step a button or badge in this colour is filled with. Only steps whose label passes can be chosen; hover one for its contrast."
266
+ : "The step for the quiet version: a pale chip or banner with darker text. Only steps whose label passes can be chosen." })] }), chosen !== undefined ? (_jsx("button", { type: "button", onClick: () => choose(role.key, undefined), className: "cursor-pointer rounded-sm px-1 text-ink3 hover:text-ink", children: "Reset" })) : (_jsx("span", { className: "text-ink3", children: "Generator's choice" }))] }), _jsx("div", { className: "grid grid-cols-6 gap-1", children: options[role.key]?.map((o) => (_jsxs("button", { type: "button", disabled: !o.pass, "aria-pressed": now === o.step, title: `${role.label} on ${o.step}: label ${unit}${o.score}${suffix}${o.pass ? "" : `, under ${target.toUpperCase()}`}`, onClick: () => choose(role.key, o.step), className: `flex h-10 cursor-pointer flex-col items-start justify-between rounded-[4px] p-1 text-[9px] leading-none tabular-nums outline-offset-1 disabled:cursor-not-allowed disabled:opacity-35 ${now === o.step ? "outline-2 outline-sel" : "outline-1 -outline-offset-1 outline-black/10"}`, style: { background: o.bg, color: o.fg || undefined }, children: [_jsx("span", { className: "font-semibold", children: "Aa" }), _jsx("span", { children: o.step })] }, o.step))) })] }, role.key));
267
+ })] }));
268
+ }
@@ -1,2 +1,2 @@
1
- export const css = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;--spacing:4px;--font-weight-semibold:600;--tracking-wide:.025em}}@layer utilities{.fixed{position:fixed}.mb-1{margin-bottom:4px}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.size-7{width:28px;height:28px}.h-7{height:28px}.w-\\[140px\\]{width:140px}.w-full{width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-rotate-90{rotate:-90deg}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0\\.5{gap:2px}.gap-1{gap:4px}.gap-1\\.5{gap:6px}.gap-2{gap:8px}.gap-3{gap:12px}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rounded-md{border-radius:6px}.rounded-sm{border-radius:4px}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-edge{border-color:var(--dt-edge)}.bg-muted{background-color:var(--dt-muted)}.p-2\\.5{padding:10px}.px-1{padding-inline:4px}.px-2{padding-inline:8px}.pt-2{padding-top:8px}.font-mono{font-family:ui-monospace,SF Mono,SFMono-Regular,Menlo,Consolas,monospace}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-fail{color:var(--dt-fail)}.text-ink{color:var(--dt-ink)}.text-ink2{color:var(--dt-ink2)}.text-ink3{color:var(--dt-ink3)}.text-ok{color:var(--dt-ok)}.text-warn{color:var(--dt-warn)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-fail{--tw-ring-color:var(--dt-fail)}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\\:bg-scrim:hover{background-color:var(--dt-scrim)}.hover\\:text-ink:hover{color:var(--dt-ink)}}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-sel:focus-visible{--tw-ring-color:var(--dt-sel)}}:host{all:initial}.dt-base{all:initial;--dt-page:#fff;--dt-raised:#f8f8f9;--dt-muted:#f0f0f2;--dt-edge:#e4e4e7;--dt-ink:#09090b;--dt-ink2:#71717a;--dt-ink3:#a1a1aa;--dt-sel:#3b82f6;--dt-scrim:#0000000f;--dt-ok:#16a34a;--dt-warn:#d97706;--dt-fail:#dc2626;--dt-icon:oklch(55% 0 0);color-scheme:light;font-family:var(--font-sans);letter-spacing:normal;text-align:left;cursor:auto;color:var(--dt-ink);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:11px;font-weight:400;line-height:1.4;display:contents}.dt-base[data-theme=dark]{--dt-page:#161618;--dt-raised:#18181b;--dt-muted:#27272a;--dt-edge:#2e2e33;--dt-ink:#fafafa;--dt-ink2:#b5b5be;--dt-ink3:#9494a0;--dt-scrim:#ffffff14;--dt-ok:#4ade80;--dt-warn:#fbbf24;--dt-fail:#f87171;color-scheme:dark}@media (prefers-color-scheme:dark){.dt-base:not([data-theme=light]){--dt-page:#161618;--dt-raised:#18181b;--dt-muted:#27272a;--dt-edge:#2e2e33;--dt-ink:#fafafa;--dt-ink2:#b5b5be;--dt-ink3:#9494a0;--dt-scrim:#ffffff14;--dt-ok:#4ade80;--dt-warn:#fbbf24;--dt-fail:#f87171;color-scheme:dark}}input[type=number]::-webkit-inner-spin-button{appearance:none;margin:0}input[type=number]::-webkit-outer-spin-button{appearance:none;margin:0}\n";
2
- export const properties = "@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}\n@property --tw-font-weight{syntax:\"*\";inherits:false}\n@property --tw-tracking{syntax:\"*\";inherits:false}\n@property --tw-ordinal{syntax:\"*\";inherits:false}\n@property --tw-slashed-zero{syntax:\"*\";inherits:false}\n@property --tw-numeric-figure{syntax:\"*\";inherits:false}\n@property --tw-numeric-spacing{syntax:\"*\";inherits:false}\n@property --tw-numeric-fraction{syntax:\"*\";inherits:false}\n@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-shadow-color{syntax:\"*\";inherits:false}\n@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}\n@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}\n@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}\n@property --tw-ring-color{syntax:\"*\";inherits:false}\n@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-inset-ring-color{syntax:\"*\";inherits:false}\n@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-ring-inset{syntax:\"*\";inherits:false}\n@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}\n@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}\n@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
1
+ export const css = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;--spacing:4px;--font-weight-medium:500;--font-weight-semibold:600;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}@layer utilities{.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.z-50{z-index:50}.container{width:100%}.mx-1{margin-inline:4px}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.size-6{width:24px;height:24px}.size-7{width:28px;height:28px}.size-8{width:32px;height:32px}.h-4{height:16px}.h-5{height:20px}.h-7{height:28px}.h-8{height:32px}.h-10{height:40px}.h-14{height:56px}.h-48{height:192px}.max-h-\\[min\\(560px\\,calc\\(100vh-96px\\)\\)\\]{max-height:min(560px,100vh - 96px)}.w-8{width:32px}.w-10{width:40px}.w-\\[84px\\]{width:84px}.w-\\[340px\\]{width:340px}.w-full{width:100%}.w-px{width:1px}.max-w-\\[calc\\(100vw-32px\\)\\]{max-width:calc(100vw - 32px)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-rotate-90{rotate:-90deg}.cursor-help{cursor:help}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0\\.5{gap:2px}.gap-1{gap:4px}.gap-1\\.5{gap:6px}.gap-2{gap:8px}.gap-3{gap:12px}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-\\[4px\\]{border-radius:4px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:8px}.rounded-md{border-radius:6px}.rounded-sm{border-radius:4px}.rounded-xl{border-radius:12px}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-edge{border-color:var(--dt-edge)}.bg-edge{background-color:var(--dt-edge)}.bg-fail\\/10{background-color:var(--dt-fail)}@supports (color:color-mix(in lab, red, red)){.bg-fail\\/10{background-color:color-mix(in oklab, var(--dt-fail) 10%, transparent)}}.bg-muted{background-color:var(--dt-muted)}.bg-page{background-color:var(--dt-page)}.bg-sel{background-color:var(--dt-sel)}.p-1{padding:4px}.p-2{padding:8px}.p-2\\.5{padding:10px}.p-3\\.5{padding:14px}.px-0{padding-inline:0}.px-1{padding-inline:4px}.px-1\\.5{padding-inline:6px}.px-2{padding-inline:8px}.px-2\\.5{padding-inline:10px}.px-3{padding-inline:12px}.py-2{padding-block:8px}.pt-1{padding-top:4px}.pt-2{padding-top:8px}.font-mono{font-family:ui-monospace,SF Mono,SFMono-Regular,Menlo,Consolas,monospace}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.leading-\\[16px\\]{--tw-leading:16px;line-height:16px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-fail{color:var(--dt-fail)}.text-ink{color:var(--dt-ink)}.text-ink2{color:var(--dt-ink2)}.text-ink3{color:var(--dt-ink3)}.text-ok{color:var(--dt-ok)}.text-warn{color:var(--dt-warn)}.text-white{color:#fff}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-black\\/15{--tw-shadow-color:#00000026}@supports (color:color-mix(in lab, red, red)){.shadow-black\\/15{--tw-shadow-color:color-mix(in oklab, oklab(0% none none/.15) var(--tw-shadow-alpha), transparent)}}.ring-fail{--tw-ring-color:var(--dt-fail)}.outline-1{outline-style:var(--tw-outline-style);outline-width:1px}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.-outline-offset-1{outline-offset:calc(1px * -1)}.outline-offset-1{outline-offset:1px}.outline-black\\/10{outline-color:oklab(0% none none/.1)}.outline-sel{outline-color:var(--dt-sel)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\\:bg-scrim:hover{background-color:var(--dt-scrim)}.hover\\:text-ink:hover{color:var(--dt-ink)}}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\\:ring-sel:focus-visible{--tw-ring-color:var(--dt-sel)}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\\:-outline-offset-2:focus-visible{outline-offset:calc(2px * -1)}.focus-visible\\:outline-sel:focus-visible{outline-color:var(--dt-sel)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-35:disabled{opacity:.35}.disabled\\:opacity-40:disabled{opacity:.4}.data-popup-open\\:bg-scrim[data-popup-open]{background-color:var(--dt-scrim)}.data-popup-open\\:text-ink[data-popup-open]{color:var(--dt-ink)}}:host{all:initial}.dt-base{all:initial;--dt-page:#fff;--dt-raised:#f8f8f9;--dt-muted:#f0f0f2;--dt-edge:#e4e4e7;--dt-ink:#09090b;--dt-ink2:#71717a;--dt-ink3:#a1a1aa;--dt-sel:#3b82f6;--dt-scrim:#0000000f;--dt-ok:#16a34a;--dt-warn:#d97706;--dt-fail:#dc2626;--dt-icon:oklch(55% 0 0);color-scheme:light;font-family:var(--font-sans);letter-spacing:normal;text-align:left;cursor:auto;color:var(--dt-ink);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:11px;font-weight:400;line-height:1.4;display:contents}.dt-base[data-theme=dark]{--dt-page:#161618;--dt-raised:#18181b;--dt-muted:#27272a;--dt-edge:#2e2e33;--dt-ink:#fafafa;--dt-ink2:#b5b5be;--dt-ink3:#9494a0;--dt-scrim:#ffffff14;--dt-ok:#4ade80;--dt-warn:#fbbf24;--dt-fail:#f87171;color-scheme:dark}@media (prefers-color-scheme:dark){.dt-base:not([data-theme=light]){--dt-page:#161618;--dt-raised:#18181b;--dt-muted:#27272a;--dt-edge:#2e2e33;--dt-ink:#fafafa;--dt-ink2:#b5b5be;--dt-ink3:#9494a0;--dt-scrim:#ffffff14;--dt-ok:#4ade80;--dt-warn:#fbbf24;--dt-fail:#f87171;color-scheme:dark}}input[type=number]::-webkit-inner-spin-button{appearance:none;margin:0}input[type=number]::-webkit-outer-spin-button{appearance:none;margin:0}\n";
2
+ export const properties = "@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}\n@property --tw-leading{syntax:\"*\";inherits:false}\n@property --tw-font-weight{syntax:\"*\";inherits:false}\n@property --tw-tracking{syntax:\"*\";inherits:false}\n@property --tw-ordinal{syntax:\"*\";inherits:false}\n@property --tw-slashed-zero{syntax:\"*\";inherits:false}\n@property --tw-numeric-figure{syntax:\"*\";inherits:false}\n@property --tw-numeric-spacing{syntax:\"*\";inherits:false}\n@property --tw-numeric-fraction{syntax:\"*\";inherits:false}\n@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-shadow-color{syntax:\"*\";inherits:false}\n@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}\n@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}\n@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}\n@property --tw-ring-color{syntax:\"*\";inherits:false}\n@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-inset-ring-color{syntax:\"*\";inherits:false}\n@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-ring-inset{syntax:\"*\";inherits:false}\n@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}\n@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}\n@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}\n@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}";
@@ -2,7 +2,7 @@
2
2
  * The studio's plain logic, browser-safe: a project's generate-tokens command read into a seed, a
3
3
  * seed turned into the generator's inputs, and the command that regenerates from a seed.
4
4
  */
5
- import { exportTokens, generateTokens, } from "@designtools/tokens";
5
+ import { exportTokens, generateTokens, familiesOf, rangeOf, } from "@designtools/tokens";
6
6
  /** Split a command line on spaces outside quotes, unquoting as a shell would. */
7
7
  export function splitCommand(command) {
8
8
  const out = [];
@@ -108,6 +108,9 @@ export function parseCommand(command) {
108
108
  case "--no-wcag-floor":
109
109
  seed.wcagFloor = false;
110
110
  break;
111
+ case "--grounds":
112
+ seed.grounds = value();
113
+ break;
111
114
  case "--gamut":
112
115
  seed.gamut = value();
113
116
  break;
@@ -117,6 +120,39 @@ export function parseCommand(command) {
117
120
  case "--neutral-seed-shade":
118
121
  seed.neutralSeedShade = Number(value());
119
122
  break;
123
+ case "--light-end":
124
+ seed.lightnessRange = { ...seed.lightnessRange, light: Number(value()) };
125
+ break;
126
+ case "--dark-end":
127
+ seed.lightnessRange = { ...seed.lightnessRange, dark: Number(value()) };
128
+ break;
129
+ case "--no-aliases":
130
+ seed.aliases = false;
131
+ break;
132
+ case "--tint-floor":
133
+ seed.tintFloor = Number(value());
134
+ break;
135
+ case "--chroma":
136
+ seed.chroma = { ...seed.chroma, profile: value() };
137
+ break;
138
+ case "--chroma-strength":
139
+ seed.chroma = { ...seed.chroma, strength: Number(value()) };
140
+ break;
141
+ case "--chroma-peak":
142
+ seed.chroma = { ...seed.chroma, peakAt: Number(value()) };
143
+ break;
144
+ case "--hue-drift": {
145
+ const v = value();
146
+ seed.hueDrift = v === "none" || v === "natural" ? v : Number(v);
147
+ break;
148
+ }
149
+ case "--pin": {
150
+ // family@step=colour
151
+ const m = /^([a-z][\w-]*)@(\d+)=(.+)$/.exec(value());
152
+ if (m)
153
+ seed.pins = { ...seed.pins, [m[1]]: { ...seed.pins?.[m[1]], [Number(m[2])]: m[3] } };
154
+ break;
155
+ }
120
156
  case "--shades":
121
157
  seed.shades = value()
122
158
  .split(",")
@@ -188,8 +224,16 @@ export function optionsFromSeed(seed) {
188
224
  ...(seed.wcagFloor === false ? { wcagFloor: false } : {}),
189
225
  ...(seed.surfaceColors ? { surfaceColors: seed.surfaceColors } : {}),
190
226
  ...(seed.backgrounds ? { backgrounds: seed.backgrounds } : {}),
227
+ ...(seed.grounds && seed.grounds !== "full" ? { grounds: seed.grounds } : {}),
191
228
  seedShade: seed.seedShade,
192
229
  ...(Object.keys(seedShades).length ? { seedShades } : {}),
230
+ ...(rangeOf(seed) ? { lightnessRange: rangeOf(seed) } : {}),
231
+ ...(seed.tintFloor !== undefined ? { tintFloor: seed.tintFloor } : {}),
232
+ ...(seed.chroma && Object.keys(seed.chroma).length ? { chroma: seed.chroma } : {}),
233
+ ...(seed.hueDrift !== undefined && seed.hueDrift !== "none" ? { hueDrift: seed.hueDrift } : {}),
234
+ ...(familiesOf(seed) ? { families: familiesOf(seed) } : {}),
235
+ ...(seed.pins && Object.keys(seed.pins).length ? { pins: seed.pins } : {}),
236
+ ...(seed.aliases === false ? { aliases: false } : {}),
193
237
  ...(decorative.length ? { decorative: decorative.sort() } : {}),
194
238
  shades: seed.shades,
195
239
  shadeOverrides: seed.shadeOverrides ?? {},