@weasel-js/theme 1.13.0 → 1.14.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as ColorList, p as ColorSourceContext, q as TokenName, r as ResolvedTheme, a as Theme, S as Selection, s as TokenValue } from './definition-wsEi-XBr.js';
2
- export { t as AxisDef, A as AxisDefs, u as AxisValue, v as BAKED_THEMES, B as BakedTheme, w as ByAxis, x as ColorContext, y as ColorListItem, F as FlatTokens, G as GeneratedColors, z as GeneratedTheme, P as PinObject, e as PinValue, D as RampColors, R as RawToken, E as SerializableColorList, H as THEMES, I as THEME_SOURCES, T as ThemeDefinition, J as ThemeInput, V as Varying, K as colorCount, M as defineTheme, Q as enumerateSelections, U as fullSelection, W as isByAxis, X as rampSteps, Y as resolveTheme, Z as selectionKey, _ as themeAxes, $ as themeTints, a0 as weaselTheme } from './definition-wsEi-XBr.js';
1
+ import { o as ColorList, p as ColorSourceContext, q as TokenName, r as ResolvedTheme, a as Theme, S as Selection, s as TokenValue } from './definition-nZbgRG7A.js';
2
+ export { t as AxisDef, A as AxisDefs, u as AxisValue, v as BAKED_THEMES, B as BakedTheme, w as ByAxis, x as ColorContext, y as ColorListItem, F as FlatTokens, G as GeneratedColors, z as GeneratedTheme, P as PinObject, e as PinValue, D as RampColors, R as RawToken, E as SerializableColorList, H as THEMES, I as THEME_SOURCES, T as ThemeDefinition, J as ThemeInput, V as Varying, K as colorCount, M as defineTheme, Q as enumerateSelections, U as fullSelection, W as isByAxis, X as rampSteps, Y as resolveTheme, Z as selectionKey, _ as themeAxes, $ as themeTints, a0 as weaselTheme } from './definition-nZbgRG7A.js';
3
3
  export { C as ColorMode, a as ColorModePreference, i as isColorModePreference } from './colorMode-CoklZomJ.js';
4
4
  import { ColorSource, ColorLiteral } from '@weasel-js/paint';
5
5
 
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- export { TINT_REF, applyTheme, blendTheme, colorAt, colorCount, colorCssAt, colorSourceCss, colorSourceLiteral, isColorModePreference, rampSteps, resolveCurrentColor, themeTints } from './chunk-R7OXPHZJ.js';
1
+ export { TINT_REF, applyTheme, blendTheme, colorAt, colorCount, colorCssAt, colorSourceCss, colorSourceLiteral, isColorModePreference, rampSteps, resolveCurrentColor, themeTints } from './chunk-PYRAKINY.js';
2
2
  import { AXES_EXT, overrideKey, ALPHA_EXT } from './chunk-Z675UQ26.js';
3
3
  import './chunk-S7MJPFDP.js';
4
- import { TOKEN_MANIFEST } from './chunk-AAQSJSVD.js';
5
- export { TOKEN_MANIFEST } from './chunk-AAQSJSVD.js';
4
+ import { TOKEN_MANIFEST } from './chunk-F5ODXRE3.js';
5
+ export { TOKEN_MANIFEST } from './chunk-F5ODXRE3.js';
6
6
  import { readCssNumber } from './chunk-M3R5MV7Q.js';
7
7
  import { themeAxes } from './chunk-32JKTYS2.js';
8
8
  export { parseTokenValue, resolveTheme, serializeTokenValue, themeAxes } from './chunk-32JKTYS2.js';
9
- import { weaselTheme } from './chunk-R2SSGWGZ.js';
10
- export { BAKED_THEMES, THEMES, THEME_SOURCES, defineTheme, weaselTheme } from './chunk-R2SSGWGZ.js';
9
+ import { weaselTheme } from './chunk-NCAQ54LO.js';
10
+ export { BAKED_THEMES, THEMES, THEME_SOURCES, defineTheme, weaselTheme } from './chunk-NCAQ54LO.js';
11
11
  import { mergeAxes } from './chunk-P5F3GZV6.js';
12
12
  export { enumerateSelections, fullSelection, isByAxis, selectionKey } from './chunk-P5F3GZV6.js';
13
13
  import { isPlainObject } from '@weasel-js/registry';
package/dist/prefs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PrefGroup, PrefLocus } from '@weasel-js/prefs';
2
- import { a as Theme, V as Varying, e as PinValue, S as Selection } from './definition-wsEi-XBr.js';
2
+ import { a as Theme, V as Varying, e as PinValue, S as Selection } from './definition-nZbgRG7A.js';
3
3
  import '@weasel-js/paint';
4
4
 
5
5
  /** The key of the group a theme's axes are chosen in: `axis.mode` is the leaf holding the mode. */
@@ -13,7 +13,8 @@ declare const themeTokenOf: (path: string) => string;
13
13
  /**
14
14
  * `theme` as a preferences schema. Under `axis`, an `enum` for each of the
15
15
  * theme's axes, set to its default. Then a page for each token group, holding
16
- * a leaf for every token the theme resolves and every override hook: a
16
+ * a leaf for every token the theme resolves and every override hook, named
17
+ * without its group's prefix: a
17
18
  * `color`, a `number` in the token's unit, or a `string` of CSS text for what
18
19
  * neither holds. A leaf is at `<group>.<token>`, the token named without
19
20
  * `--wzl-`, and may be split by every axis.
@@ -23,6 +24,19 @@ declare const themeTokenOf: (path: string) => string;
23
24
  * theme as it is. {@link themeFromPrefs} turns what was written into a theme.
24
25
  */
25
26
  declare function themePrefsSchema(theme?: Theme): PrefGroup;
27
+ /** What a token's CSS refers to, as {@link themePrefsReferences} reads it. */
28
+ interface ThemePrefsReference {
29
+ /** The custom property referred to, `--` and all. */
30
+ readonly property: string;
31
+ /** The path of the leaf that edits it, where it is one of the schema's tokens. */
32
+ readonly path?: string;
33
+ }
34
+ /**
35
+ * Reads a token's CSS as a reference to another custom property where the whole of it is one `var()` with no
36
+ * fallback, and finds the leaf of `schema` that edits that property. Anything else, a `calc()` or a shadow that
37
+ * holds a `var()` among other text included, reads as no reference.
38
+ */
39
+ declare function themePrefsReferences(schema: PrefGroup): (css: unknown) => ThemePrefsReference | undefined;
26
40
 
27
41
  /** What the bridge reads of a store over a {@link themePrefsSchema}: any `PrefsStore` is one. */
28
42
  interface ThemePrefsSource {
@@ -59,4 +73,4 @@ declare function themePrefsValues(store: ThemePrefsValuesSource, base: Theme): {
59
73
  loci: ReadonlyMap<string, PrefLocus>;
60
74
  };
61
75
 
62
- export { THEME_PREFS_AXIS, type ThemePrefsSource, type ThemePrefsValuesSource, themeAxisOf, themeAxisPath, themeFromPrefs, themePrefsPins, themePrefsSchema, themePrefsSelection, themePrefsValues, themeTokenOf };
76
+ export { THEME_PREFS_AXIS, type ThemePrefsReference, type ThemePrefsSource, type ThemePrefsValuesSource, themeAxisOf, themeAxisPath, themeFromPrefs, themePrefsPins, themePrefsReferences, themePrefsSchema, themePrefsSelection, themePrefsValues, themeTokenOf };
package/dist/prefs.js CHANGED
@@ -1,7 +1,7 @@
1
- import { TOKEN_MANIFEST } from './chunk-AAQSJSVD.js';
1
+ import { TOKEN_MANIFEST } from './chunk-F5ODXRE3.js';
2
2
  import { readCssNumber } from './chunk-M3R5MV7Q.js';
3
3
  import { themeAxes, resolveTheme, themeChain } from './chunk-32JKTYS2.js';
4
- import { weaselTheme, defineTheme } from './chunk-R2SSGWGZ.js';
4
+ import { weaselTheme, defineTheme } from './chunk-NCAQ54LO.js';
5
5
  import { selectionKey, enumerateSelections, isByAxis } from './chunk-P5F3GZV6.js';
6
6
  import { prefLeaves, isPrefLocus } from '@weasel-js/prefs';
7
7
  import { rgbaToHex, parseColor } from '@weasel-js/paint';
@@ -110,8 +110,17 @@ var themeTokenOf = (path) => path.slice(path.indexOf(".") + 1);
110
110
  var labeled = (text) => text === "" ? text : text[0].toUpperCase() + text.slice(1);
111
111
  var groupKey = (group) => group === THEME_PREFS_AXIS ? `${THEME_PREFS_AXIS}-tokens` : group;
112
112
  var locusByAxis = (axis, members) => ({ $by: themeAxisPath(axis), $of: members });
113
+ var shortName = (row) => row.name.startsWith(`${row.group}-`) ? row.name.slice(row.group.length + 1) : row.name;
113
114
  function tokenLeaf(row, table, splitBy) {
114
- const leaf = { ...tokenLeafKind(row), name: row.name, description: row.description, default: void 0, splitBy };
115
+ const name = shortName(row);
116
+ const leaf = {
117
+ ...tokenLeafKind(row),
118
+ name,
119
+ description: row.description,
120
+ default: void 0,
121
+ splitBy,
122
+ ...name === row.name ? {} : { tags: [row.name] }
123
+ };
115
124
  const fallback = row.css[selectionKey(table.axes, {})] ?? Object.values(row.css)[0];
116
125
  const held = foldAxes(table.axes, (selection) => prefOfCss(leaf, row.css[selectionKey(table.axes, selection)] ?? fallback), locusByAxis);
117
126
  leaf.default = prefOfCss(leaf, fallback);
@@ -139,6 +148,17 @@ function themePrefsSchema(theme = weaselTheme) {
139
148
  }
140
149
  return { name: `${labeled(theme.name)} theme`, children };
141
150
  }
151
+ var WHOLE_VAR = /^\s*var\(\s*(--[\w-]+)\s*\)\s*$/;
152
+ function themePrefsReferences(schema) {
153
+ const paths = /* @__PURE__ */ new Map();
154
+ for (const path of prefLeaves(schema).keys()) if (themeAxisOf(path) === void 0) paths.set(`--wzl-${themeTokenOf(path)}`, path);
155
+ return (css) => {
156
+ const property = typeof css === "string" ? WHOLE_VAR.exec(css)?.[1] : void 0;
157
+ if (property === void 0) return void 0;
158
+ const path = paths.get(property);
159
+ return path === void 0 ? { property } : { property, path };
160
+ };
161
+ }
142
162
  function pinOf(leaf, held) {
143
163
  if (!isPrefLocus(held)) return cssOfPref(leaf, held);
144
164
  const out = { by: themeAxisOf(held.$by) ?? held.$by };
@@ -188,6 +208,6 @@ function themePrefsValues(store, base) {
188
208
  return { values, loci };
189
209
  }
190
210
 
191
- export { THEME_PREFS_AXIS, themeAxisOf, themeAxisPath, themeFromPrefs, themePrefsPins, themePrefsSchema, themePrefsSelection, themePrefsValues, themeTokenOf };
211
+ export { THEME_PREFS_AXIS, themeAxisOf, themeAxisPath, themeFromPrefs, themePrefsPins, themePrefsReferences, themePrefsSchema, themePrefsSelection, themePrefsValues, themeTokenOf };
192
212
  //# sourceMappingURL=prefs.js.map
193
213
  //# sourceMappingURL=prefs.js.map
package/dist/prefs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/prefs/leaf.ts","../src/prefs/tokens.ts","../src/prefs/schema.ts","../src/prefs/pins.ts"],"names":["isPrefLocus"],"mappings":";;;;;;;;AAOA,IAAM,aAAA,uBAAyC,GAAA,CAAI,CAAC,aAAa,QAAA,EAAU,UAAA,EAAY,YAAY,CAAC,CAAA;AAEpG,SAAS,MAAM,GAAA,EAAiC;AAC9C,EAAA,IAAI;AACF,IAAA,OAAO,SAAA,CAA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,IAAA,MAAM,IAAA,GAAO,QAAA,CAAS,IAAA,EAAM,CAAC,cAAc,SAAA,CAAU,IAAA,EAAM,QAAA,CAAS,YAAA,CAAa,IAAA,EAAM,SAAS,CAAC,CAAC,GAAG,WAAW,CAAA;AAChH,IAAA,IAAIA,YAAY,IAAI,CAAA,EAAG,IAAA,CAAK,GAAA,CAAI,MAAM,IAAI,CAAA;AAAA,SACrC,IAAA,CAAK,OAAO,IAAI,CAAA;AACrB,IAAA,MAAM,QAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAC,CAAA;AAC7C,IAAA,IAAI,CAAC,MAAA,CAAO,GAAA,CAAI,KAAK,CAAA,EAAG;AACtB,MAAA,MAAA,CAAO,IAAI,KAAK,CAAA;AAChB,MAAA,MAAA,CAAO,KAAK,CAAA,GAAI,EAAE,GAAI,MAAA,CAAO,KAAK,CAAA,EAA8B;AAAA,IAClE;AACA,IAAC,MAAA,CAAO,KAAK,CAAA,CAA8B,YAAA,CAAa,IAAI,CAAC,CAAA,GAAI,SAAA,CAAU,IAAA,EAAM,QAAA,CAAS,GAAG,CAAC,CAAA;AAAA,EAChG;AACA,EAAA,OAAO,EAAE,QAAQ,IAAA,EAAK;AACxB","file":"prefs.js","sourcesContent":["// A token as a pref leaf: which kind edits it, and its CSS text to the leaf's value and back.\n\nimport { parseColor, rgbaToHex } from '@weasel-js/paint';\nimport type { PrefLeaf, PrefLinearUnit, PrefNumber } from '@weasel-js/prefs';\nimport { readCssNumber } from '../cssNumber.ts';\nimport type { TokenRow } from './tokens.ts';\n\nconst NUMERIC_TYPES: ReadonlySet<string> = new Set(['dimension', 'number', 'duration', 'fontWeight']);\n\nfunction hexOf(css: string): string | undefined {\n try {\n return rgbaToHex(parseColor(css));\n } catch {\n return undefined;\n }\n}\n\n/**\n * The leaf that edits `row`, less its default: a `color` where every value it\n * resolves to is a color this kit can parse, a `number` in the unit they share\n * where every one is a number, and otherwise a `string` holding the CSS text,\n * which is what a `var()`, a `calc()`, a font stack, or a shadow is edited as.\n */\nexport function tokenLeafKind(row: TokenRow): Pick<PrefNumber, 'kind' | 'unit'> | { kind: 'color'; alpha: true } | { kind: 'string' } {\n const values = Object.values(row.css);\n if (row.type === 'color' && values.every((css) => hexOf(css) !== undefined)) return { kind: 'color', alpha: true };\n if (NUMERIC_TYPES.has(row.type)) {\n const read = values.map(readCssNumber);\n const unit = read[0]?.unit;\n if (read.every((r) => r !== undefined && r.unit === unit)) {\n return unit ? { kind: 'number', unit: { scale: 1, suffix: unit } } : { kind: 'number' };\n }\n }\n return { kind: 'string' };\n}\n\nconst suffixOf = (leaf: PrefLeaf): string => ((leaf as PrefNumber).unit as PrefLinearUnit | undefined)?.suffix ?? '';\n\n/** What `css` reads as on `leaf`, or `undefined` for text its kind cannot hold. */\nexport function prefOfCss(leaf: PrefLeaf, css: string | undefined): unknown {\n if (css === undefined) return undefined;\n if (leaf.kind === 'color') return hexOf(css);\n if (leaf.kind !== 'number') return css;\n const read = readCssNumber(css);\n return read && read.unit === suffixOf(leaf) ? read.value : undefined;\n}\n\n/** The CSS text of a value `leaf` holds. */\nexport function cssOfPref(leaf: PrefLeaf, value: unknown): string {\n return leaf.kind === 'number' ? `${value as number}${suffixOf(leaf)}` : String(value);\n}\n","// Every token of a theme as the prefs bridge reads it: what it is, and the CSS it resolves to at each selection.\n\nimport { enumerateSelections, isByAxis, selectionKey, type AxisDefs, type Selection } from '../axes.ts';\nimport { TOKEN_MANIFEST, type TokenManifestEntry } from '../generated/manifest.ts';\nimport { resolveTheme, themeAxes, themeChain } from '../resolveTheme.ts';\nimport type { Theme } from '../theme.ts';\n\nconst PREFIX = '--wzl-';\n\n/** One token of a theme, named without `--wzl-`. */\nexport interface TokenRow {\n readonly name: string;\n readonly type: string;\n readonly group: string;\n readonly description: string;\n /** The CSS it resolves to, by `selectionKey`. */\n readonly css: Readonly<Record<string, string>>;\n}\n\n/** A theme's tokens and the axes they were resolved along. */\nexport interface TokenTable {\n readonly axes: AxisDefs;\n readonly rows: readonly TokenRow[];\n}\n\nconst MANIFEST = new Map<string, TokenManifestEntry>(TOKEN_MANIFEST.map((entry) => [entry.name.slice(PREFIX.length), entry]));\n\nconst groupOf = (name: string): string => (name.includes('-') ? name.slice(0, name.indexOf('-')) : name);\n\n/** The type and description each token was first declared with, root theme first. A pin's type is `unknown`. */\nfunction declared(theme: Theme): Map<string, { type: string | undefined; description: string }> {\n const out = new Map<string, { type: string | undefined; description: string }>();\n for (const link of themeChain(theme)) {\n for (const [name, varying] of Object.entries(link.tokens)) {\n let raw: unknown = varying;\n while (isByAxis(raw)) raw = Object.entries(raw).find(([key]) => key !== 'by')?.[1];\n const token = raw as { type?: string; description?: string } | undefined;\n const had = out.get(name);\n out.set(name, {\n type: had?.type ?? (token?.type !== 'unknown' ? token?.type : undefined),\n description: had?.description || token?.description || '',\n });\n }\n }\n return out;\n}\n\n/**\n * Every token `theme` resolves, then every override hook it leaves alone, each\n * with its CSS at every selection of the theme's axes. A hook reads as its\n * fallback at all of them.\n */\nexport function tokenTable(theme: Theme): TokenTable {\n const axes = themeAxes(theme);\n const resolved = enumerateSelections(axes).map(\n (selection): [string, Record<string, string>] => [selectionKey(axes, selection), resolveTheme(theme, selection)],\n );\n const own = declared(theme);\n const names = new Set<string>();\n for (const [, tokens] of resolved) for (const name of Object.keys(tokens)) names.add(name.slice(PREFIX.length));\n\n const rows: TokenRow[] = [];\n for (const name of names) {\n const listed = MANIFEST.get(name);\n const said = own.get(name);\n const css: Record<string, string> = {};\n for (const [key, tokens] of resolved) {\n const value = tokens[PREFIX + name];\n if (value !== undefined) css[key] = value;\n }\n rows.push({\n name,\n type: said?.type ?? listed?.type ?? 'string',\n group: listed?.group ?? groupOf(name),\n description: said?.description || listed?.description || '',\n css,\n });\n }\n for (const [name, listed] of MANIFEST) {\n if (!listed.hook || names.has(name)) continue;\n const css = Object.fromEntries(resolved.map(([key]) => [key, listed.defaultValue]));\n rows.push({ name, type: listed.type, group: listed.group, description: listed.description, css });\n }\n return { axes, rows };\n}\n\n/**\n * `at(selection)` over every selection of `axes`, as a value split only by\n * the axes it differs along, the first axis outermost. `split` builds one\n * level from an axis and what each of its values holds.\n */\nexport function foldAxes(\n axes: AxisDefs,\n at: (selection: Selection) => unknown,\n split: (axis: string, members: Record<string, unknown>) => unknown,\n): unknown {\n const names = Object.keys(axes);\n const walk = (i: number, selection: Selection): unknown => {\n if (i === names.length) return at(selection);\n const axis = names[i]!;\n const members = Object.keys(axes[axis]!.values).map((value): [string, unknown] => [value, walk(i + 1, { ...selection, [axis]: value })]);\n const first = JSON.stringify(members[0]![1]);\n return members.every(([, member]) => JSON.stringify(member) === first) ? members[0]![1] : split(axis, Object.fromEntries(members));\n };\n return walk(0, {});\n}\n","import { isPrefLocus, type PrefGroup, type PrefLeaf, type PrefLocus } from '@weasel-js/prefs';\nimport { selectionKey } from '../axes.ts';\nimport { weaselTheme, type Theme } from '../theme.ts';\nimport { prefOfCss, tokenLeafKind } from './leaf.ts';\nimport { foldAxes, tokenTable, type TokenRow } from './tokens.ts';\n\n/** The key of the group a theme's axes are chosen in: `axis.mode` is the leaf holding the mode. */\nexport const THEME_PREFS_AXIS = 'axis';\n\n/** The path of the leaf that holds `axis`'s value. */\nexport const themeAxisPath = (axis: string): string => `${THEME_PREFS_AXIS}.${axis}`;\n\n/** The axis a leaf at `path` holds the value of, or `undefined` for a token's leaf. */\nexport const themeAxisOf = (path: string): string | undefined =>\n (path.startsWith(`${THEME_PREFS_AXIS}.`) ? path.slice(THEME_PREFS_AXIS.length + 1) : undefined);\n\n/** The token a leaf at `path` edits, named without `--wzl-`. */\nexport const themeTokenOf = (path: string): string => path.slice(path.indexOf('.') + 1);\n\nconst labeled = (text: string): string => (text === '' ? text : text[0]!.toUpperCase() + text.slice(1));\n\n// A token group named for the axes' own key takes another; no group's name holds a `-`.\nconst groupKey = (group: string): string => (group === THEME_PREFS_AXIS ? `${THEME_PREFS_AXIS}-tokens` : group);\n\n/** The locus of a value that differs along `axes`, each level keyed by its axis's leaf. */\nexport const locusByAxis = (axis: string, members: Record<string, unknown>): PrefLocus => ({ $by: themeAxisPath(axis), $of: members });\n\nfunction tokenLeaf(row: TokenRow, table: ReturnType<typeof tokenTable>, splitBy: readonly string[]): PrefLeaf {\n const leaf = { ...tokenLeafKind(row), name: row.name, description: row.description, default: undefined as unknown, splitBy } as PrefLeaf;\n const fallback = row.css[selectionKey(table.axes, {})] ?? Object.values(row.css)[0];\n const held = foldAxes(table.axes, (selection) => prefOfCss(leaf, row.css[selectionKey(table.axes, selection)] ?? fallback), locusByAxis);\n leaf.default = prefOfCss(leaf, fallback);\n if (isPrefLocus(held)) leaf.defaultLocus = held;\n return leaf;\n}\n\n/**\n * `theme` as a preferences schema. Under `axis`, an `enum` for each of the\n * theme's axes, set to its default. Then a page for each token group, holding\n * a leaf for every token the theme resolves and every override hook: a\n * `color`, a `number` in the token's unit, or a `string` of CSS text for what\n * neither holds. A leaf is at `<group>.<token>`, the token named without\n * `--wzl-`, and may be split by every axis.\n *\n * A leaf's default is what the theme resolves the token to, already split\n * along the axes it differs by, so a store nothing was written to reads the\n * theme as it is. {@link themeFromPrefs} turns what was written into a theme.\n */\nexport function themePrefsSchema(theme: Theme = weaselTheme): PrefGroup {\n const table = tokenTable(theme);\n const axes: Record<string, PrefLeaf> = {};\n for (const [axis, def] of Object.entries(table.axes)) {\n axes[axis] = {\n kind: 'enum',\n name: labeled(axis),\n description: '',\n default: def.default,\n options: Object.keys(def.values).map((value) => ({ value, label: labeled(value) })),\n };\n }\n const splitBy = Object.keys(table.axes).map(themeAxisPath);\n const children: Record<string, PrefGroup> = { [THEME_PREFS_AXIS]: { name: 'Axes', children: axes } };\n for (const row of table.rows) {\n const key = groupKey(row.group);\n children[key] ??= { name: labeled(row.group), children: {} };\n children[key].children[row.name] = tokenLeaf(row, table, splitBy);\n }\n return { name: `${labeled(theme.name)} theme`, children };\n}\n","import { isPrefLocus, prefLeaves, type PrefGroup, type PrefLeaf, type PrefLocus } from '@weasel-js/prefs';\nimport { selectionKey, type Selection, type Varying } from '../axes.ts';\nimport type { PinValue } from '../definition.ts';\nimport { defineTheme, type Theme } from '../theme.ts';\nimport { cssOfPref, prefOfCss } from './leaf.ts';\nimport { locusByAxis, themeAxisOf, themeTokenOf } from './schema.ts';\nimport { foldAxes, tokenTable } from './tokens.ts';\n\n/** What the bridge reads of a store over a {@link themePrefsSchema}: any `PrefsStore` is one. */\nexport interface ThemePrefsSource {\n schema: PrefGroup;\n get(path: string): unknown;\n locus(path: string): PrefLocus | undefined;\n isSet(path: string): boolean;\n}\n\nfunction pinOf(leaf: PrefLeaf, held: unknown): Varying<PinValue> {\n if (!isPrefLocus(held)) return cssOfPref(leaf, held);\n const out: Record<string, unknown> = { by: themeAxisOf(held.$by) ?? held.$by };\n for (const [value, member] of Object.entries(held.$of)) out[value] = pinOf(leaf, member);\n return out as Varying<PinValue>;\n}\n\n/** The value of each axis as the store has it set: the selection to resolve or apply its theme at. */\nexport function themePrefsSelection(store: ThemePrefsSource): Selection {\n const out: Record<string, string> = {};\n for (const path of prefLeaves(store.schema).keys()) {\n const axis = themeAxisOf(path);\n if (axis !== undefined) out[axis] = store.get(path) as string;\n }\n return out;\n}\n\n/**\n * Every token leaf the store has a value of its own for, as `pins` for a\n * `ThemeDefinition`: a split value in theme's `{ by, … }` form, a color as\n * hex, a number in its unit, and a string as it is held. A leaf following its\n * default is no pin, so the token keeps its rule in the theme the pins go\n * over: an alias left alone still follows a primitive that was pinned.\n */\nexport function themePrefsPins(store: ThemePrefsSource): Record<string, Varying<PinValue>> {\n const out: Record<string, Varying<PinValue>> = {};\n for (const [path, leaf] of prefLeaves(store.schema)) {\n if (themeAxisOf(path) !== undefined || !store.isSet(path)) continue;\n out[themeTokenOf(path)] = pinOf(leaf, store.locus(path) ?? store.get(path));\n }\n return out;\n}\n\n/** `base` with the store's pins over it. `name` defaults to `base`'s with `-prefs` after it. */\nexport function themeFromPrefs(store: ThemePrefsSource, base: Theme, name = `${base.name}-prefs`): Theme {\n return defineTheme({ name, extends: base, pins: themePrefsPins(store) });\n}\n\n/** What {@link themePrefsValues} reads beside the pins. */\nexport interface ThemePrefsValuesSource extends ThemePrefsSource {\n values(): Record<string, unknown>;\n loci(): ReadonlyMap<string, PrefLocus>;\n}\n\n/**\n * The store's values and loci as a form shows them, with every leaf that\n * follows its default read from the pinned theme, where the store reads it\n * from `base`. They differ for an alias of a token that was pinned: `accent`\n * after `accent-base` is set. Shaped as `store.values()` and `store.loci()`.\n */\nexport function themePrefsValues(\n store: ThemePrefsValuesSource,\n base: Theme,\n): { values: Record<string, unknown>; loci: ReadonlyMap<string, PrefLocus> } {\n const { axes, rows } = tokenTable(themeFromPrefs(store, base));\n const css = new Map(rows.map((row) => [row.name, row.css]));\n const now = selectionKey(axes, themePrefsSelection(store));\n const values: Record<string, unknown> = { ...store.values() };\n const loci = new Map(store.loci());\n const copied = new Set<string>();\n for (const [path, leaf] of prefLeaves(store.schema)) {\n if (themeAxisOf(path) !== undefined || store.isSet(path)) continue;\n const resolved = css.get(themeTokenOf(path));\n if (!resolved || Object.values(resolved).some((text) => prefOfCss(leaf, text) === undefined)) continue;\n const held = foldAxes(axes, (selection) => prefOfCss(leaf, resolved[selectionKey(axes, selection)]), locusByAxis);\n if (isPrefLocus(held)) loci.set(path, held);\n else loci.delete(path);\n const group = path.slice(0, path.indexOf('.'));\n if (!copied.has(group)) {\n copied.add(group);\n values[group] = { ...(values[group] as Record<string, unknown>) };\n }\n (values[group] as Record<string, unknown>)[themeTokenOf(path)] = prefOfCss(leaf, resolved[now]);\n }\n return { values, loci };\n}\n"]}
1
+ {"version":3,"sources":["../src/prefs/leaf.ts","../src/prefs/tokens.ts","../src/prefs/schema.ts","../src/prefs/pins.ts"],"names":["isPrefLocus","prefLeaves"],"mappings":";;;;;;;;AAOA,IAAM,aAAA,uBAAyC,GAAA,CAAI,CAAC,aAAa,QAAA,EAAU,UAAA,EAAY,YAAY,CAAC,CAA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IAAA,EAAM,SAAS,CAAC,CAAC,GAAG,WAAW,CAAA;AAChH,IAAA,IAAID,YAAY,IAAI,CAAA,EAAG,IAAA,CAAK,GAAA,CAAI,MAAM,IAAI,CAAA;AAAA,SACrC,IAAA,CAAK,OAAO,IAAI,CAAA;AACrB,IAAA,MAAM,QAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,IAAA,CAAK,OAAA,CAAQ,GAAG,CAAC,CAAA;AAC7C,IAAA,IAAI,CAAC,MAAA,CAAO,GAAA,CAAI,KAAK,CAAA,EAAG;AACtB,MAAA,MAAA,CAAO,IAAI,KAAK,CAAA;AAChB,MAAA,MAAA,CAAO,KAAK,CAAA,GAAI,EAAE,GAAI,MAAA,CAAO,KAAK,CAAA,EAA8B;AAAA,IAClE;AACA,IAAC,MAAA,CAAO,KAAK,CAAA,CAA8B,YAAA,CAAa,IAAI,CAAC,CAAA,GAAI,SAAA,CAAU,IAAA,EAAM,QAAA,CAAS,GAAG,CAAC,CAAA;AAAA,EAChG;AACA,EAAA,OAAO,EAAE,QAAQ,IAAA,EAAK;AACxB","file":"prefs.js","sourcesContent":["// A token as a pref leaf: which kind edits it, and its CSS text to the leaf's value and back.\n\nimport { parseColor, rgbaToHex } from '@weasel-js/paint';\nimport type { PrefLeaf, PrefLinearUnit, PrefNumber } from '@weasel-js/prefs';\nimport { readCssNumber } from '../cssNumber.ts';\nimport type { TokenRow } from './tokens.ts';\n\nconst NUMERIC_TYPES: ReadonlySet<string> = new Set(['dimension', 'number', 'duration', 'fontWeight']);\n\nfunction hexOf(css: string): string | undefined {\n try {\n return rgbaToHex(parseColor(css));\n } catch {\n return undefined;\n }\n}\n\n/**\n * The leaf that edits `row`, less its default: a `color` where every value it\n * resolves to is a color this kit can parse, a `number` in the unit they share\n * where every one is a number, and otherwise a `string` holding the CSS text,\n * which is what a `var()`, a `calc()`, a font stack, or a shadow is edited as.\n */\nexport function tokenLeafKind(row: TokenRow): Pick<PrefNumber, 'kind' | 'unit'> | { kind: 'color'; alpha: true } | { kind: 'string' } {\n const values = Object.values(row.css);\n if (row.type === 'color' && values.every((css) => hexOf(css) !== undefined)) return { kind: 'color', alpha: true };\n if (NUMERIC_TYPES.has(row.type)) {\n const read = values.map(readCssNumber);\n const unit = read[0]?.unit;\n if (read.every((r) => r !== undefined && r.unit === unit)) {\n return unit ? { kind: 'number', unit: { scale: 1, suffix: unit } } : { kind: 'number' };\n }\n }\n return { kind: 'string' };\n}\n\nconst suffixOf = (leaf: PrefLeaf): string => ((leaf as PrefNumber).unit as PrefLinearUnit | undefined)?.suffix ?? '';\n\n/** What `css` reads as on `leaf`, or `undefined` for text its kind cannot hold. */\nexport function prefOfCss(leaf: PrefLeaf, css: string | undefined): unknown {\n if (css === undefined) return undefined;\n if (leaf.kind === 'color') return hexOf(css);\n if (leaf.kind !== 'number') return css;\n const read = readCssNumber(css);\n return read && read.unit === suffixOf(leaf) ? read.value : undefined;\n}\n\n/** The CSS text of a value `leaf` holds. */\nexport function cssOfPref(leaf: PrefLeaf, value: unknown): string {\n return leaf.kind === 'number' ? `${value as number}${suffixOf(leaf)}` : String(value);\n}\n","// Every token of a theme as the prefs bridge reads it: what it is, and the CSS it resolves to at each selection.\n\nimport { enumerateSelections, isByAxis, selectionKey, type AxisDefs, type Selection } from '../axes.ts';\nimport { TOKEN_MANIFEST, type TokenManifestEntry } from '../generated/manifest.ts';\nimport { resolveTheme, themeAxes, themeChain } from '../resolveTheme.ts';\nimport type { Theme } from '../theme.ts';\n\nconst PREFIX = '--wzl-';\n\n/** One token of a theme, named without `--wzl-`. */\nexport interface TokenRow {\n readonly name: string;\n readonly type: string;\n readonly group: string;\n readonly description: string;\n /** The CSS it resolves to, by `selectionKey`. */\n readonly css: Readonly<Record<string, string>>;\n}\n\n/** A theme's tokens and the axes they were resolved along. */\nexport interface TokenTable {\n readonly axes: AxisDefs;\n readonly rows: readonly TokenRow[];\n}\n\nconst MANIFEST = new Map<string, TokenManifestEntry>(TOKEN_MANIFEST.map((entry) => [entry.name.slice(PREFIX.length), entry]));\n\nconst groupOf = (name: string): string => (name.includes('-') ? name.slice(0, name.indexOf('-')) : name);\n\n/** The type and description each token was first declared with, root theme first. A pin's type is `unknown`. */\nfunction declared(theme: Theme): Map<string, { type: string | undefined; description: string }> {\n const out = new Map<string, { type: string | undefined; description: string }>();\n for (const link of themeChain(theme)) {\n for (const [name, varying] of Object.entries(link.tokens)) {\n let raw: unknown = varying;\n while (isByAxis(raw)) raw = Object.entries(raw).find(([key]) => key !== 'by')?.[1];\n const token = raw as { type?: string; description?: string } | undefined;\n const had = out.get(name);\n out.set(name, {\n type: had?.type ?? (token?.type !== 'unknown' ? token?.type : undefined),\n description: had?.description || token?.description || '',\n });\n }\n }\n return out;\n}\n\n/**\n * Every token `theme` resolves, then every override hook it leaves alone, each\n * with its CSS at every selection of the theme's axes. A hook reads as its\n * fallback at all of them.\n */\nexport function tokenTable(theme: Theme): TokenTable {\n const axes = themeAxes(theme);\n const resolved = enumerateSelections(axes).map(\n (selection): [string, Record<string, string>] => [selectionKey(axes, selection), resolveTheme(theme, selection)],\n );\n const own = declared(theme);\n const names = new Set<string>();\n for (const [, tokens] of resolved) for (const name of Object.keys(tokens)) names.add(name.slice(PREFIX.length));\n\n const rows: TokenRow[] = [];\n for (const name of names) {\n const listed = MANIFEST.get(name);\n const said = own.get(name);\n const css: Record<string, string> = {};\n for (const [key, tokens] of resolved) {\n const value = tokens[PREFIX + name];\n if (value !== undefined) css[key] = value;\n }\n rows.push({\n name,\n type: said?.type ?? listed?.type ?? 'string',\n group: listed?.group ?? groupOf(name),\n description: said?.description || listed?.description || '',\n css,\n });\n }\n for (const [name, listed] of MANIFEST) {\n if (!listed.hook || names.has(name)) continue;\n const css = Object.fromEntries(resolved.map(([key]) => [key, listed.defaultValue]));\n rows.push({ name, type: listed.type, group: listed.group, description: listed.description, css });\n }\n return { axes, rows };\n}\n\n/**\n * `at(selection)` over every selection of `axes`, as a value split only by\n * the axes it differs along, the first axis outermost. `split` builds one\n * level from an axis and what each of its values holds.\n */\nexport function foldAxes(\n axes: AxisDefs,\n at: (selection: Selection) => unknown,\n split: (axis: string, members: Record<string, unknown>) => unknown,\n): unknown {\n const names = Object.keys(axes);\n const walk = (i: number, selection: Selection): unknown => {\n if (i === names.length) return at(selection);\n const axis = names[i]!;\n const members = Object.keys(axes[axis]!.values).map((value): [string, unknown] => [value, walk(i + 1, { ...selection, [axis]: value })]);\n const first = JSON.stringify(members[0]![1]);\n return members.every(([, member]) => JSON.stringify(member) === first) ? members[0]![1] : split(axis, Object.fromEntries(members));\n };\n return walk(0, {});\n}\n","import { isPrefLocus, prefLeaves, type PrefGroup, type PrefLeaf, type PrefLocus } from '@weasel-js/prefs';\nimport { selectionKey } from '../axes.ts';\nimport { weaselTheme, type Theme } from '../theme.ts';\nimport { prefOfCss, tokenLeafKind } from './leaf.ts';\nimport { foldAxes, tokenTable, type TokenRow } from './tokens.ts';\n\n/** The key of the group a theme's axes are chosen in: `axis.mode` is the leaf holding the mode. */\nexport const THEME_PREFS_AXIS = 'axis';\n\n/** The path of the leaf that holds `axis`'s value. */\nexport const themeAxisPath = (axis: string): string => `${THEME_PREFS_AXIS}.${axis}`;\n\n/** The axis a leaf at `path` holds the value of, or `undefined` for a token's leaf. */\nexport const themeAxisOf = (path: string): string | undefined =>\n (path.startsWith(`${THEME_PREFS_AXIS}.`) ? path.slice(THEME_PREFS_AXIS.length + 1) : undefined);\n\n/** The token a leaf at `path` edits, named without `--wzl-`. */\nexport const themeTokenOf = (path: string): string => path.slice(path.indexOf('.') + 1);\n\nconst labeled = (text: string): string => (text === '' ? text : text[0]!.toUpperCase() + text.slice(1));\n\n// A token group named for the axes' own key takes another; no group's name holds a `-`.\nconst groupKey = (group: string): string => (group === THEME_PREFS_AXIS ? `${THEME_PREFS_AXIS}-tokens` : group);\n\n/** The locus of a value that differs along `axes`, each level keyed by its axis's leaf. */\nexport const locusByAxis = (axis: string, members: Record<string, unknown>): PrefLocus => ({ $by: themeAxisPath(axis), $of: members });\n\n// On its group's page a token's group prefix says nothing; its whole name stays a tag, so a filter still finds it.\nconst shortName = (row: TokenRow): string => (row.name.startsWith(`${row.group}-`) ? row.name.slice(row.group.length + 1) : row.name);\n\nfunction tokenLeaf(row: TokenRow, table: ReturnType<typeof tokenTable>, splitBy: readonly string[]): PrefLeaf {\n const name = shortName(row);\n const leaf = {\n ...tokenLeafKind(row), name, description: row.description, default: undefined as unknown, splitBy,\n ...(name === row.name ? {} : { tags: [row.name] }),\n } as PrefLeaf;\n const fallback = row.css[selectionKey(table.axes, {})] ?? Object.values(row.css)[0];\n const held = foldAxes(table.axes, (selection) => prefOfCss(leaf, row.css[selectionKey(table.axes, selection)] ?? fallback), locusByAxis);\n leaf.default = prefOfCss(leaf, fallback);\n if (isPrefLocus(held)) leaf.defaultLocus = held;\n return leaf;\n}\n\n/**\n * `theme` as a preferences schema. Under `axis`, an `enum` for each of the\n * theme's axes, set to its default. Then a page for each token group, holding\n * a leaf for every token the theme resolves and every override hook, named\n * without its group's prefix: a\n * `color`, a `number` in the token's unit, or a `string` of CSS text for what\n * neither holds. A leaf is at `<group>.<token>`, the token named without\n * `--wzl-`, and may be split by every axis.\n *\n * A leaf's default is what the theme resolves the token to, already split\n * along the axes it differs by, so a store nothing was written to reads the\n * theme as it is. {@link themeFromPrefs} turns what was written into a theme.\n */\nexport function themePrefsSchema(theme: Theme = weaselTheme): PrefGroup {\n const table = tokenTable(theme);\n const axes: Record<string, PrefLeaf> = {};\n for (const [axis, def] of Object.entries(table.axes)) {\n axes[axis] = {\n kind: 'enum',\n name: labeled(axis),\n description: '',\n default: def.default,\n options: Object.keys(def.values).map((value) => ({ value, label: labeled(value) })),\n };\n }\n const splitBy = Object.keys(table.axes).map(themeAxisPath);\n const children: Record<string, PrefGroup> = { [THEME_PREFS_AXIS]: { name: 'Axes', children: axes } };\n for (const row of table.rows) {\n const key = groupKey(row.group);\n children[key] ??= { name: labeled(row.group), children: {} };\n children[key].children[row.name] = tokenLeaf(row, table, splitBy);\n }\n return { name: `${labeled(theme.name)} theme`, children };\n}\n\n/** What a token's CSS refers to, as {@link themePrefsReferences} reads it. */\nexport interface ThemePrefsReference {\n /** The custom property referred to, `--` and all. */\n readonly property: string;\n /** The path of the leaf that edits it, where it is one of the schema's tokens. */\n readonly path?: string;\n}\n\nconst WHOLE_VAR = /^\\s*var\\(\\s*(--[\\w-]+)\\s*\\)\\s*$/;\n\n/**\n * Reads a token's CSS as a reference to another custom property where the whole of it is one `var()` with no\n * fallback, and finds the leaf of `schema` that edits that property. Anything else, a `calc()` or a shadow that\n * holds a `var()` among other text included, reads as no reference.\n */\nexport function themePrefsReferences(schema: PrefGroup): (css: unknown) => ThemePrefsReference | undefined {\n const paths = new Map<string, string>();\n for (const path of prefLeaves(schema).keys()) if (themeAxisOf(path) === undefined) paths.set(`--wzl-${themeTokenOf(path)}`, path);\n return (css) => {\n const property = typeof css === 'string' ? WHOLE_VAR.exec(css)?.[1] : undefined;\n if (property === undefined) return undefined;\n const path = paths.get(property);\n return path === undefined ? { property } : { property, path };\n };\n}\n","import { isPrefLocus, prefLeaves, type PrefGroup, type PrefLeaf, type PrefLocus } from '@weasel-js/prefs';\nimport { selectionKey, type Selection, type Varying } from '../axes.ts';\nimport type { PinValue } from '../definition.ts';\nimport { defineTheme, type Theme } from '../theme.ts';\nimport { cssOfPref, prefOfCss } from './leaf.ts';\nimport { locusByAxis, themeAxisOf, themeTokenOf } from './schema.ts';\nimport { foldAxes, tokenTable } from './tokens.ts';\n\n/** What the bridge reads of a store over a {@link themePrefsSchema}: any `PrefsStore` is one. */\nexport interface ThemePrefsSource {\n schema: PrefGroup;\n get(path: string): unknown;\n locus(path: string): PrefLocus | undefined;\n isSet(path: string): boolean;\n}\n\nfunction pinOf(leaf: PrefLeaf, held: unknown): Varying<PinValue> {\n if (!isPrefLocus(held)) return cssOfPref(leaf, held);\n const out: Record<string, unknown> = { by: themeAxisOf(held.$by) ?? held.$by };\n for (const [value, member] of Object.entries(held.$of)) out[value] = pinOf(leaf, member);\n return out as Varying<PinValue>;\n}\n\n/** The value of each axis as the store has it set: the selection to resolve or apply its theme at. */\nexport function themePrefsSelection(store: ThemePrefsSource): Selection {\n const out: Record<string, string> = {};\n for (const path of prefLeaves(store.schema).keys()) {\n const axis = themeAxisOf(path);\n if (axis !== undefined) out[axis] = store.get(path) as string;\n }\n return out;\n}\n\n/**\n * Every token leaf the store has a value of its own for, as `pins` for a\n * `ThemeDefinition`: a split value in theme's `{ by, … }` form, a color as\n * hex, a number in its unit, and a string as it is held. A leaf following its\n * default is no pin, so the token keeps its rule in the theme the pins go\n * over: an alias left alone still follows a primitive that was pinned.\n */\nexport function themePrefsPins(store: ThemePrefsSource): Record<string, Varying<PinValue>> {\n const out: Record<string, Varying<PinValue>> = {};\n for (const [path, leaf] of prefLeaves(store.schema)) {\n if (themeAxisOf(path) !== undefined || !store.isSet(path)) continue;\n out[themeTokenOf(path)] = pinOf(leaf, store.locus(path) ?? store.get(path));\n }\n return out;\n}\n\n/** `base` with the store's pins over it. `name` defaults to `base`'s with `-prefs` after it. */\nexport function themeFromPrefs(store: ThemePrefsSource, base: Theme, name = `${base.name}-prefs`): Theme {\n return defineTheme({ name, extends: base, pins: themePrefsPins(store) });\n}\n\n/** What {@link themePrefsValues} reads beside the pins. */\nexport interface ThemePrefsValuesSource extends ThemePrefsSource {\n values(): Record<string, unknown>;\n loci(): ReadonlyMap<string, PrefLocus>;\n}\n\n/**\n * The store's values and loci as a form shows them, with every leaf that\n * follows its default read from the pinned theme, where the store reads it\n * from `base`. They differ for an alias of a token that was pinned: `accent`\n * after `accent-base` is set. Shaped as `store.values()` and `store.loci()`.\n */\nexport function themePrefsValues(\n store: ThemePrefsValuesSource,\n base: Theme,\n): { values: Record<string, unknown>; loci: ReadonlyMap<string, PrefLocus> } {\n const { axes, rows } = tokenTable(themeFromPrefs(store, base));\n const css = new Map(rows.map((row) => [row.name, row.css]));\n const now = selectionKey(axes, themePrefsSelection(store));\n const values: Record<string, unknown> = { ...store.values() };\n const loci = new Map(store.loci());\n const copied = new Set<string>();\n for (const [path, leaf] of prefLeaves(store.schema)) {\n if (themeAxisOf(path) !== undefined || store.isSet(path)) continue;\n const resolved = css.get(themeTokenOf(path));\n if (!resolved || Object.values(resolved).some((text) => prefOfCss(leaf, text) === undefined)) continue;\n const held = foldAxes(axes, (selection) => prefOfCss(leaf, resolved[selectionKey(axes, selection)]), locusByAxis);\n if (isPrefLocus(held)) loci.set(path, held);\n else loci.delete(path);\n const group = path.slice(0, path.indexOf('.'));\n if (!copied.has(group)) {\n copied.add(group);\n values[group] = { ...(values[group] as Record<string, unknown>) };\n }\n (values[group] as Record<string, unknown>)[themeTokenOf(path)] = prefOfCss(leaf, resolved[now]);\n }\n return { values, loci };\n}\n"]}
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Palette, ColorSource } from '@weasel-js/paint';
2
2
  import React from 'react';
3
- import { a as Theme, S as Selection, r as ResolvedTheme, o as ColorList } from './definition-wsEi-XBr.js';
3
+ import { a as Theme, S as Selection, r as ResolvedTheme, o as ColorList } from './definition-nZbgRG7A.js';
4
4
  import { a as ColorModePreference, C as ColorMode } from './colorMode-CoklZomJ.js';
5
5
  export { i as isColorModePreference } from './colorMode-CoklZomJ.js';
6
6
 
package/dist/react.js CHANGED
@@ -1,9 +1,9 @@
1
- import { isColorModePreference, themeTints, applyTheme, colorSourceCss, colorSourceLiteral } from './chunk-R7OXPHZJ.js';
2
- export { isColorModePreference } from './chunk-R7OXPHZJ.js';
1
+ import { isColorModePreference, themeTints, applyTheme, colorSourceCss, colorSourceLiteral } from './chunk-PYRAKINY.js';
2
+ export { isColorModePreference } from './chunk-PYRAKINY.js';
3
3
  import './chunk-S7MJPFDP.js';
4
4
  import './chunk-M3R5MV7Q.js';
5
5
  import { themeAxes, resolveTheme } from './chunk-32JKTYS2.js';
6
- import { weaselTheme } from './chunk-R2SSGWGZ.js';
6
+ import { weaselTheme } from './chunk-NCAQ54LO.js';
7
7
  import { fullSelection, selectionKey } from './chunk-P5F3GZV6.js';
8
8
  import { colorLiteralToHex } from '@weasel-js/paint';
9
9
  import { createContext, useState, useEffect, useCallback, useRef, useMemo, useLayoutEffect, useContext } from 'react';
@@ -1,4 +1,4 @@
1
- import { a as Theme } from '../definition-wsEi-XBr.js';
1
+ import { a as Theme } from '../definition-nZbgRG7A.js';
2
2
  import '@weasel-js/paint';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { defineTheme, weaselTheme } from '../chunk-R2SSGWGZ.js';
1
+ import { defineTheme, weaselTheme } from '../chunk-NCAQ54LO.js';
2
2
  import '../chunk-P5F3GZV6.js';
3
3
 
4
4
  // src/themes/mac-classic.theme.json
@@ -1,4 +1,4 @@
1
- import { a as Theme } from '../definition-wsEi-XBr.js';
1
+ import { a as Theme } from '../definition-nZbgRG7A.js';
2
2
  import '@weasel-js/paint';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { defineTheme, weaselTheme } from '../chunk-R2SSGWGZ.js';
1
+ import { defineTheme, weaselTheme } from '../chunk-NCAQ54LO.js';
2
2
  import '../chunk-P5F3GZV6.js';
3
3
 
4
4
  // src/themes/win9x.theme.json
package/dist/tokens.css CHANGED
@@ -199,16 +199,18 @@
199
199
  --wzl-handle-dot-size: 8px;
200
200
  /* A round handle that belongs to another point — a bezier control handle at the end of its stem. */
201
201
  --wzl-handle-dot-size-sm: 7px;
202
- /* One square of the transparency checker drawn under a paint that is empty, mixed or translucent. Paint it as repeating-conic-gradient(var(--wzl-checker-a) 0% 25%, var(--wzl-checker-b) 0% 50%) 50% / var(--wzl-checker-size) var(--wzl-checker-size). */
202
+ /* One square of the transparency checker drawn under a paint that is empty, mixed or translucent. weasel-ui builds the checker layer once, in components/checker.module.css: compose its `checker` class and paint with var(--wzl-checker-layer). */
203
203
  --wzl-checker-a: var(--wzl-border);
204
204
  /* The other square of the transparency checker. */
205
205
  --wzl-checker-b: var(--wzl-surface);
206
206
  /* Edge of one repeat of the transparency checker: two squares by two. */
207
207
  --wzl-checker-size: 8px;
208
- /* Ground of a canvas app's workspace — the area around the document page. */
209
- --wzl-workspace-surface: var(--wzl-surface-sunken);
208
+ /* Ground of a canvas app's workspace — the area around the document page: surface-raised with its tint taken out (its OKLCH chroma set to 0). */
209
+ --wzl-workspace-surface: #272727;
210
210
  /* Marks drawn over workspace-surface, such as its diagonal stripes, so the page reads as the thing on top. */
211
211
  --wzl-workspace-line: var(--wzl-line-subtle);
212
+ /* The workspace as one background layer: workspace-surface struck with wide diagonal bands of workspace-line. Use it as an element's whole background. */
213
+ --wzl-workspace: repeating-linear-gradient(45deg, transparent 0 8px, var(--wzl-workspace-line) 8px 16px) var(--wzl-workspace-surface);
212
214
  /* Horizontal padding inside a boxed field. Pairs with --wzl-field-h, which is a container override and has no :root default. */
213
215
  --wzl-field-pad-x: 8px;
214
216
  /* How much glass a boxed button and a selected segment wear, from 0 to 1: at 0 a flat fill, at 1 the full ramp, specular gloss, rim, and drop shadow. */
@@ -304,6 +306,7 @@
304
306
  --wzl-code-name: var(--wzl-swatch-rose);
305
307
  --wzl-slider-track-mix: 40%;
306
308
  --wzl-slider-thumb-mix: 100%;
309
+ --wzl-workspace-surface: #272727;
307
310
  --wzl-secondary-fg: var(--wzl-secondary-base);
308
311
  --wzl-panel-surface: var(--wzl-surface-raised);
309
312
  --wzl-panel-border-color: var(--wzl-border);
@@ -326,8 +329,8 @@
326
329
  --wzl-surface-pressed: color-mix(in srgb, var(--wzl-fg) 18%, transparent);
327
330
  --wzl-checker-a: var(--wzl-border);
328
331
  --wzl-checker-b: var(--wzl-surface);
329
- --wzl-workspace-surface: var(--wzl-surface-sunken);
330
332
  --wzl-workspace-line: var(--wzl-line-subtle);
333
+ --wzl-workspace: repeating-linear-gradient(45deg, transparent 0 8px, var(--wzl-workspace-line) 8px 16px) var(--wzl-workspace-surface);
331
334
  }
332
335
 
333
336
  [data-wzl-theme='weasel'][data-wzl-mode='light'],
@@ -361,6 +364,7 @@
361
364
  --wzl-code-name: #be123c;
362
365
  --wzl-slider-track-mix: 18%;
363
366
  --wzl-slider-thumb-mix: 70%;
367
+ --wzl-workspace-surface: #e7e7e7;
364
368
  --wzl-secondary-fg: var(--wzl-secondary-soft);
365
369
  --wzl-panel-surface: var(--wzl-surface-raised);
366
370
  --wzl-panel-border-color: var(--wzl-border);
@@ -383,8 +387,8 @@
383
387
  --wzl-surface-pressed: color-mix(in srgb, var(--wzl-fg) 18%, transparent);
384
388
  --wzl-checker-a: var(--wzl-border);
385
389
  --wzl-checker-b: var(--wzl-surface);
386
- --wzl-workspace-surface: var(--wzl-surface-sunken);
387
390
  --wzl-workspace-line: var(--wzl-line-subtle);
391
+ --wzl-workspace: repeating-linear-gradient(45deg, transparent 0 8px, var(--wzl-workspace-line) 8px 16px) var(--wzl-workspace-surface);
388
392
  }
389
393
 
390
394
  [data-wzl-theme='weasel'][data-wzl-density='compact'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasel-js/theme",
3
- "version": "1.13.0",
3
+ "version": "1.14.1",
4
4
  "description": "Design tokens shared by weasel-ui and weasel-hud — CSS variables + a parallel TS export.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,9 +43,9 @@
43
43
  "./package.json": "./package.json"
44
44
  },
45
45
  "dependencies": {
46
- "@weasel-js/paint": "1.13.0",
47
- "@weasel-js/prefs": "1.13.0",
48
- "@weasel-js/registry": "1.13.0"
46
+ "@weasel-js/paint": "1.14.1",
47
+ "@weasel-js/prefs": "1.14.1",
48
+ "@weasel-js/registry": "1.14.1"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": ">=18"