@weasel-js/theme 1.6.0 → 1.6.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/{chunk-6R3FTRRJ.js → chunk-4EIPTWJA.js} +3 -3
- package/dist/chunk-4EIPTWJA.js.map +1 -0
- package/dist/{chunk-QKRFHBRB.js → chunk-C3S4A65R.js} +2 -2
- package/dist/{chunk-QKRFHBRB.js.map → chunk-C3S4A65R.js.map} +1 -1
- package/dist/{chunk-GI7ZAXIB.js → chunk-EINHFDWI.js} +2 -2
- package/dist/chunk-EINHFDWI.js.map +1 -0
- package/dist/{themes-bTfTZjCh.d.ts → definition-DLdTdFWs.d.ts} +190 -190
- package/dist/engine.d.ts +2 -2
- package/dist/engine.js +6 -6
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/react.d.ts +1 -1
- package/dist/react.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-6R3FTRRJ.js.map +0 -1
- package/dist/chunk-GI7ZAXIB.js.map +0 -1
|
@@ -39,195 +39,6 @@ interface RawToken {
|
|
|
39
39
|
* prefix). Still unresolved — see `ResolvedTokenMap` for the output side. */
|
|
40
40
|
type FlatTokens = Record<string, RawToken>;
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* A theme ready to resolve: its axes and its tokens, each plain or varying by
|
|
44
|
-
* axis, references intact. A `by` that leaves a value out contributes nothing
|
|
45
|
-
* for that selection, so the theme it extends supplies it.
|
|
46
|
-
*/
|
|
47
|
-
interface Theme {
|
|
48
|
-
readonly name: string;
|
|
49
|
-
readonly extends: Theme | null;
|
|
50
|
-
readonly axes: AxisDefs;
|
|
51
|
-
readonly tokens: Readonly<Record<string, Varying<RawToken>>>;
|
|
52
|
-
/** Ramp name → step names in order, for the ramps this theme declares itself. */
|
|
53
|
-
readonly ramps?: Readonly<Record<string, readonly string[]>>;
|
|
54
|
-
/** The colors a `tone` index picks from. Absent: the nearest theme it extends that has one. */
|
|
55
|
-
readonly tones?: SerializableColorList;
|
|
56
|
-
}
|
|
57
|
-
/** What `defineTheme` accepts: a definition whose `extends` is a `Theme`, holding pins and components only. */
|
|
58
|
-
type ThemeInput = Omit<ThemeDefinition, 'extends'> & {
|
|
59
|
-
readonly extends?: Theme | null;
|
|
60
|
-
};
|
|
61
|
-
/** The built-in theme, from the baked output of themes/weasel.json. */
|
|
62
|
-
declare const weaselTheme: Theme;
|
|
63
|
-
/**
|
|
64
|
-
* Build a theme from pins. Unless `extends` says otherwise the result layers
|
|
65
|
-
* onto `weaselTheme`, so a theme only names what it changes. A definition with
|
|
66
|
-
* seeds, ramps, scales or semantics needs deriving first.
|
|
67
|
-
*/
|
|
68
|
-
declare function defineTheme(input: ThemeInput): Theme;
|
|
69
|
-
|
|
70
|
-
/** The output of `resolveTheme`: every token of a theme, for one selection, keyed
|
|
71
|
-
* by CSS custom-property name and flattened to a final CSS value. */
|
|
72
|
-
type ResolvedTheme = Readonly<Record<TokenName, string>>;
|
|
73
|
-
/** Every axis the chain declares. An axis declared more than once keeps every value; a descendant's value entries and default win. */
|
|
74
|
-
declare function themeAxes(theme: Theme): AxisDefs;
|
|
75
|
-
/**
|
|
76
|
-
* Merge the extends chain at a selection, resolve every alias, and key the
|
|
77
|
-
* result by CSS custom-property name. A missing or unknown axis value takes the
|
|
78
|
-
* axis default.
|
|
79
|
-
*
|
|
80
|
-
* Pure — no DOM. An unresolvable reference throws rather than falling back.
|
|
81
|
-
*/
|
|
82
|
-
declare function resolveTheme(theme: Theme, selection?: Selection): ResolvedTheme;
|
|
83
|
-
|
|
84
|
-
/** The categorical generator the swatch ramp uses, asked for `count` colors. */
|
|
85
|
-
interface GeneratedColors {
|
|
86
|
-
readonly generate: {
|
|
87
|
-
readonly count: number;
|
|
88
|
-
readonly gates?: CategoricalRampDef['gates'];
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/** A ramp of the active theme, by name — `{ ramp: 'swatch' }` walks its steps in order. */
|
|
92
|
-
interface RampColors {
|
|
93
|
-
readonly ramp: string;
|
|
94
|
-
}
|
|
95
|
-
/** The forms a theme definition can hold: everything but a function. */
|
|
96
|
-
type SerializableColorList = readonly string[] | GeneratedColors | RampColors;
|
|
97
|
-
/**
|
|
98
|
-
* Several colors, read by index with `colorAt`, wrapping. Literals; the swatch
|
|
99
|
-
* ramp's generator; a ramp of the active theme, which follows the mode; or a
|
|
100
|
-
* function of the index.
|
|
101
|
-
*/
|
|
102
|
-
type ColorList = SerializableColorList | ((i: number) => string);
|
|
103
|
-
/** What a `ColorList` resolves against. `useTheme()`'s value is one. */
|
|
104
|
-
interface ColorContext {
|
|
105
|
-
readonly theme: Theme;
|
|
106
|
-
readonly resolved: ResolvedTheme;
|
|
107
|
-
}
|
|
108
|
-
/** A ramp's step names, from the nearest theme in the chain that declares it. */
|
|
109
|
-
declare function rampSteps(theme: Theme, ramp: string): readonly string[];
|
|
110
|
-
/** The tone list a theme declares, from the nearest theme in its chain that has one. */
|
|
111
|
-
declare function themeTones(theme: Theme): ColorList;
|
|
112
|
-
/** The `i`th color of `list`, wrapping. A ramp list reads the resolved theme, so the answer follows its mode. */
|
|
113
|
-
declare function colorAt(list: ColorList, i: number, ctx?: ColorContext): string;
|
|
114
|
-
/**
|
|
115
|
-
* As `colorAt`, but a ramp list answers with its custom property —
|
|
116
|
-
* `var(--wzl-swatch-sky)` — so a color written into CSS follows a mode change
|
|
117
|
-
* without re-rendering, provider or not.
|
|
118
|
-
*/
|
|
119
|
-
declare function colorCssAt(list: ColorList, i: number, ctx?: ColorContext): string;
|
|
120
|
-
/** How many distinct colors `list` holds before it wraps; `undefined` for a function, which never does. */
|
|
121
|
-
declare function colorCount(list: ColorList, ctx?: ColorContext): number | undefined;
|
|
122
|
-
|
|
123
|
-
/** A number, or `{seeds.name}`. */
|
|
124
|
-
type NumberParam = Varying<number | string>;
|
|
125
|
-
interface PinObject {
|
|
126
|
-
readonly value: TokenValue;
|
|
127
|
-
readonly type?: string;
|
|
128
|
-
readonly description?: string;
|
|
129
|
-
readonly alpha?: number;
|
|
130
|
-
}
|
|
131
|
-
/** A bare value or `{ value, type?, description?, alpha? }`. The value may be a `{token}` reference. */
|
|
132
|
-
type PinValue = TokenValue | PinObject;
|
|
133
|
-
interface LightnessRampDef {
|
|
134
|
-
readonly kind: 'lightness';
|
|
135
|
-
readonly steps: Varying<readonly string[]>;
|
|
136
|
-
/** First and last step's OKLCH lightness. */
|
|
137
|
-
readonly lightness: Varying<readonly [NumberParam, NumberParam]>;
|
|
138
|
-
/** 0 walks evenly; 1 follows a smoothstep S. */
|
|
139
|
-
readonly curve?: NumberParam;
|
|
140
|
-
/** Degrees. Ignored when an anchor is given. */
|
|
141
|
-
readonly hue?: NumberParam;
|
|
142
|
-
readonly chroma?: Varying<{
|
|
143
|
-
readonly peak: NumberParam;
|
|
144
|
-
readonly lightBias?: NumberParam;
|
|
145
|
-
readonly darkBias?: NumberParam;
|
|
146
|
-
}>;
|
|
147
|
-
/**
|
|
148
|
-
* Step name → exact hex (or `{seeds.name}`). An anchor's hue and chroma replace `hue` and `chroma.peak`; with several,
|
|
149
|
-
* both blend by step between consecutive anchors, and steps outside them take the nearest anchor's.
|
|
150
|
-
*/
|
|
151
|
-
readonly anchor?: Varying<Readonly<Record<string, Varying<string>>>>;
|
|
152
|
-
readonly description?: string;
|
|
153
|
-
readonly describe?: Readonly<Record<string, string>>;
|
|
154
|
-
}
|
|
155
|
-
interface CategoricalRampDef {
|
|
156
|
-
readonly kind: 'categorical';
|
|
157
|
-
readonly steps: Varying<readonly string[]>;
|
|
158
|
-
/** Any of the palette generator's `Constraints` except `count` and `anchors`. */
|
|
159
|
-
readonly gates?: Varying<Readonly<Record<string, Varying<number | string>>>>;
|
|
160
|
-
readonly anchors?: readonly {
|
|
161
|
-
readonly name: string;
|
|
162
|
-
readonly hue: number;
|
|
163
|
-
readonly lightness: number;
|
|
164
|
-
readonly chroma?: number;
|
|
165
|
-
}[];
|
|
166
|
-
readonly description?: string;
|
|
167
|
-
readonly describe?: Readonly<Record<string, string>>;
|
|
168
|
-
}
|
|
169
|
-
type RampDef = LightnessRampDef | CategoricalRampDef;
|
|
170
|
-
interface ScaleDef {
|
|
171
|
-
readonly steps: Varying<readonly string[]>;
|
|
172
|
-
readonly base: NumberParam;
|
|
173
|
-
/** Linear: `base + step × i`. */
|
|
174
|
-
readonly step?: NumberParam;
|
|
175
|
-
/** Geometric: `base × ratio^i`. */
|
|
176
|
-
readonly ratio?: NumberParam;
|
|
177
|
-
/** Explicit: `base × factors[i]`, one per step. For a ramp no single rule fits. */
|
|
178
|
-
readonly factors?: Varying<readonly NumberParam[]>;
|
|
179
|
-
readonly description?: string;
|
|
180
|
-
readonly describe?: Readonly<Record<string, string>>;
|
|
181
|
-
}
|
|
182
|
-
interface SemanticCommon {
|
|
183
|
-
readonly type?: string;
|
|
184
|
-
readonly description?: string;
|
|
185
|
-
/** Audited, never applied. */
|
|
186
|
-
readonly check?: {
|
|
187
|
-
readonly contrast: number;
|
|
188
|
-
readonly against: readonly string[];
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
type StepRule = SemanticCommon & {
|
|
192
|
-
readonly ramp: string;
|
|
193
|
-
readonly step: Varying<string>;
|
|
194
|
-
};
|
|
195
|
-
type OffsetRule = SemanticCommon & {
|
|
196
|
-
readonly from: string;
|
|
197
|
-
readonly offset: number;
|
|
198
|
-
readonly dir: 'lighter' | 'darker' | 'away';
|
|
199
|
-
};
|
|
200
|
-
type ContrastRule = SemanticCommon & {
|
|
201
|
-
readonly ramp: string;
|
|
202
|
-
readonly contrast: {
|
|
203
|
-
readonly min: number;
|
|
204
|
-
readonly against: readonly string[];
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
type RefRule = SemanticCommon & {
|
|
208
|
-
readonly ref: string;
|
|
209
|
-
readonly alpha?: number;
|
|
210
|
-
};
|
|
211
|
-
type LiteralRule = SemanticCommon & {
|
|
212
|
-
readonly value: TokenValue;
|
|
213
|
-
};
|
|
214
|
-
type SemanticRule = StepRule | OffsetRule | ContrastRule | RefRule | LiteralRule;
|
|
215
|
-
interface ThemeDefinition {
|
|
216
|
-
readonly name: string;
|
|
217
|
-
/** Another definition's name. Absent or null: extends nothing. */
|
|
218
|
-
readonly extends?: string | null;
|
|
219
|
-
readonly description?: string;
|
|
220
|
-
readonly axes?: AxisDefs;
|
|
221
|
-
readonly seeds?: Readonly<Record<string, Varying<number | string>>>;
|
|
222
|
-
readonly ramps?: Readonly<Record<string, RampDef>>;
|
|
223
|
-
readonly scales?: Readonly<Record<string, ScaleDef>>;
|
|
224
|
-
readonly semantics?: Readonly<Record<string, Varying<SemanticRule>>>;
|
|
225
|
-
readonly components?: Readonly<Record<string, Varying<PinValue>>>;
|
|
226
|
-
readonly pins?: Readonly<Record<string, Varying<PinValue>>>;
|
|
227
|
-
/** The colors a `tone` index picks from. Absent: the nearest theme it extends that has one, else the swatch ramp. */
|
|
228
|
-
readonly tones?: SerializableColorList;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
42
|
type Lookup = (name: string) => ThemeDefinition | undefined;
|
|
232
43
|
/** The definition with its whole `extends` chain folded in, child entries winning. */
|
|
233
44
|
declare function mergeChain(def: ThemeDefinition, lookup?: Lookup, seen?: ReadonlySet<string>): ThemeDefinition;
|
|
@@ -1296,4 +1107,193 @@ declare const THEME_SOURCES: Readonly<Record<string, ThemeDefinition>>;
|
|
|
1296
1107
|
* what `weaselTheme` is built from, so the runtime entry bundles no generator. */
|
|
1297
1108
|
declare const BAKED_THEMES: Readonly<Record<string, BakedTheme>>;
|
|
1298
1109
|
|
|
1299
|
-
|
|
1110
|
+
/**
|
|
1111
|
+
* A theme ready to resolve: its axes and its tokens, each plain or varying by
|
|
1112
|
+
* axis, references intact. A `by` that leaves a value out contributes nothing
|
|
1113
|
+
* for that selection, so the theme it extends supplies it.
|
|
1114
|
+
*/
|
|
1115
|
+
interface Theme {
|
|
1116
|
+
readonly name: string;
|
|
1117
|
+
readonly extends: Theme | null;
|
|
1118
|
+
readonly axes: AxisDefs;
|
|
1119
|
+
readonly tokens: Readonly<Record<string, Varying<RawToken>>>;
|
|
1120
|
+
/** Ramp name → step names in order, for the ramps this theme declares itself. */
|
|
1121
|
+
readonly ramps?: Readonly<Record<string, readonly string[]>>;
|
|
1122
|
+
/** The colors a `tone` index picks from. Absent: the nearest theme it extends that has one. */
|
|
1123
|
+
readonly tones?: SerializableColorList;
|
|
1124
|
+
}
|
|
1125
|
+
/** What `defineTheme` accepts: a definition whose `extends` is a `Theme`, holding pins and components only. */
|
|
1126
|
+
type ThemeInput = Omit<ThemeDefinition, 'extends'> & {
|
|
1127
|
+
readonly extends?: Theme | null;
|
|
1128
|
+
};
|
|
1129
|
+
/** The built-in theme, from the baked output of themes/weasel.json. */
|
|
1130
|
+
declare const weaselTheme: Theme;
|
|
1131
|
+
/**
|
|
1132
|
+
* Build a theme from pins. Unless `extends` says otherwise the result layers
|
|
1133
|
+
* onto `weaselTheme`, so a theme only names what it changes. A definition with
|
|
1134
|
+
* seeds, ramps, scales or semantics needs deriving first.
|
|
1135
|
+
*/
|
|
1136
|
+
declare function defineTheme(input: ThemeInput): Theme;
|
|
1137
|
+
|
|
1138
|
+
/** The output of `resolveTheme`: every token of a theme, for one selection, keyed
|
|
1139
|
+
* by CSS custom-property name and flattened to a final CSS value. */
|
|
1140
|
+
type ResolvedTheme = Readonly<Record<TokenName, string>>;
|
|
1141
|
+
/** Every axis the chain declares. An axis declared more than once keeps every value; a descendant's value entries and default win. */
|
|
1142
|
+
declare function themeAxes(theme: Theme): AxisDefs;
|
|
1143
|
+
/**
|
|
1144
|
+
* Merge the extends chain at a selection, resolve every alias, and key the
|
|
1145
|
+
* result by CSS custom-property name. A missing or unknown axis value takes the
|
|
1146
|
+
* axis default.
|
|
1147
|
+
*
|
|
1148
|
+
* Pure — no DOM. An unresolvable reference throws rather than falling back.
|
|
1149
|
+
*/
|
|
1150
|
+
declare function resolveTheme(theme: Theme, selection?: Selection): ResolvedTheme;
|
|
1151
|
+
|
|
1152
|
+
/** The categorical generator the swatch ramp uses, asked for `count` colors. */
|
|
1153
|
+
interface GeneratedColors {
|
|
1154
|
+
readonly generate: {
|
|
1155
|
+
readonly count: number;
|
|
1156
|
+
readonly gates?: CategoricalRampDef['gates'];
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
/** A ramp of the active theme, by name — `{ ramp: 'swatch' }` walks its steps in order. */
|
|
1160
|
+
interface RampColors {
|
|
1161
|
+
readonly ramp: string;
|
|
1162
|
+
}
|
|
1163
|
+
/** The forms a theme definition can hold: everything but a function. */
|
|
1164
|
+
type SerializableColorList = readonly string[] | GeneratedColors | RampColors;
|
|
1165
|
+
/**
|
|
1166
|
+
* Several colors, read by index with `colorAt`, wrapping. Literals; the swatch
|
|
1167
|
+
* ramp's generator; a ramp of the active theme, which follows the mode; or a
|
|
1168
|
+
* function of the index.
|
|
1169
|
+
*/
|
|
1170
|
+
type ColorList = SerializableColorList | ((i: number) => string);
|
|
1171
|
+
/** What a `ColorList` resolves against. `useTheme()`'s value is one. */
|
|
1172
|
+
interface ColorContext {
|
|
1173
|
+
readonly theme: Theme;
|
|
1174
|
+
readonly resolved: ResolvedTheme;
|
|
1175
|
+
}
|
|
1176
|
+
/** A ramp's step names, from the nearest theme in the chain that declares it. */
|
|
1177
|
+
declare function rampSteps(theme: Theme, ramp: string): readonly string[];
|
|
1178
|
+
/** The tone list a theme declares, from the nearest theme in its chain that has one. */
|
|
1179
|
+
declare function themeTones(theme: Theme): ColorList;
|
|
1180
|
+
/** The `i`th color of `list`, wrapping. A ramp list reads the resolved theme, so the answer follows its mode. */
|
|
1181
|
+
declare function colorAt(list: ColorList, i: number, ctx?: ColorContext): string;
|
|
1182
|
+
/**
|
|
1183
|
+
* As `colorAt`, but a ramp list answers with its custom property —
|
|
1184
|
+
* `var(--wzl-swatch-sky)` — so a color written into CSS follows a mode change
|
|
1185
|
+
* without re-rendering, provider or not.
|
|
1186
|
+
*/
|
|
1187
|
+
declare function colorCssAt(list: ColorList, i: number, ctx?: ColorContext): string;
|
|
1188
|
+
/** How many distinct colors `list` holds before it wraps; `undefined` for a function, which never does. */
|
|
1189
|
+
declare function colorCount(list: ColorList, ctx?: ColorContext): number | undefined;
|
|
1190
|
+
|
|
1191
|
+
/** A number, or `{seeds.name}`. */
|
|
1192
|
+
type NumberParam = Varying<number | string>;
|
|
1193
|
+
interface PinObject {
|
|
1194
|
+
readonly value: TokenValue;
|
|
1195
|
+
readonly type?: string;
|
|
1196
|
+
readonly description?: string;
|
|
1197
|
+
readonly alpha?: number;
|
|
1198
|
+
}
|
|
1199
|
+
/** A bare value or `{ value, type?, description?, alpha? }`. The value may be a `{token}` reference. */
|
|
1200
|
+
type PinValue = TokenValue | PinObject;
|
|
1201
|
+
interface LightnessRampDef {
|
|
1202
|
+
readonly kind: 'lightness';
|
|
1203
|
+
readonly steps: Varying<readonly string[]>;
|
|
1204
|
+
/** First and last step's OKLCH lightness. */
|
|
1205
|
+
readonly lightness: Varying<readonly [NumberParam, NumberParam]>;
|
|
1206
|
+
/** 0 walks evenly; 1 follows a smoothstep S. */
|
|
1207
|
+
readonly curve?: NumberParam;
|
|
1208
|
+
/** Degrees. Ignored when an anchor is given. */
|
|
1209
|
+
readonly hue?: NumberParam;
|
|
1210
|
+
readonly chroma?: Varying<{
|
|
1211
|
+
readonly peak: NumberParam;
|
|
1212
|
+
readonly lightBias?: NumberParam;
|
|
1213
|
+
readonly darkBias?: NumberParam;
|
|
1214
|
+
}>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Step name → exact hex (or `{seeds.name}`). An anchor's hue and chroma replace `hue` and `chroma.peak`; with several,
|
|
1217
|
+
* both blend by step between consecutive anchors, and steps outside them take the nearest anchor's.
|
|
1218
|
+
*/
|
|
1219
|
+
readonly anchor?: Varying<Readonly<Record<string, Varying<string>>>>;
|
|
1220
|
+
readonly description?: string;
|
|
1221
|
+
readonly describe?: Readonly<Record<string, string>>;
|
|
1222
|
+
}
|
|
1223
|
+
interface CategoricalRampDef {
|
|
1224
|
+
readonly kind: 'categorical';
|
|
1225
|
+
readonly steps: Varying<readonly string[]>;
|
|
1226
|
+
/** Any of the palette generator's `Constraints` except `count` and `anchors`. */
|
|
1227
|
+
readonly gates?: Varying<Readonly<Record<string, Varying<number | string>>>>;
|
|
1228
|
+
readonly anchors?: readonly {
|
|
1229
|
+
readonly name: string;
|
|
1230
|
+
readonly hue: number;
|
|
1231
|
+
readonly lightness: number;
|
|
1232
|
+
readonly chroma?: number;
|
|
1233
|
+
}[];
|
|
1234
|
+
readonly description?: string;
|
|
1235
|
+
readonly describe?: Readonly<Record<string, string>>;
|
|
1236
|
+
}
|
|
1237
|
+
type RampDef = LightnessRampDef | CategoricalRampDef;
|
|
1238
|
+
interface ScaleDef {
|
|
1239
|
+
readonly steps: Varying<readonly string[]>;
|
|
1240
|
+
readonly base: NumberParam;
|
|
1241
|
+
/** Linear: `base + step × i`. */
|
|
1242
|
+
readonly step?: NumberParam;
|
|
1243
|
+
/** Geometric: `base × ratio^i`. */
|
|
1244
|
+
readonly ratio?: NumberParam;
|
|
1245
|
+
/** Explicit: `base × factors[i]`, one per step. For a ramp no single rule fits. */
|
|
1246
|
+
readonly factors?: Varying<readonly NumberParam[]>;
|
|
1247
|
+
readonly description?: string;
|
|
1248
|
+
readonly describe?: Readonly<Record<string, string>>;
|
|
1249
|
+
}
|
|
1250
|
+
interface SemanticCommon {
|
|
1251
|
+
readonly type?: string;
|
|
1252
|
+
readonly description?: string;
|
|
1253
|
+
/** Audited, never applied. */
|
|
1254
|
+
readonly check?: {
|
|
1255
|
+
readonly contrast: number;
|
|
1256
|
+
readonly against: readonly string[];
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
type StepRule = SemanticCommon & {
|
|
1260
|
+
readonly ramp: string;
|
|
1261
|
+
readonly step: Varying<string>;
|
|
1262
|
+
};
|
|
1263
|
+
type OffsetRule = SemanticCommon & {
|
|
1264
|
+
readonly from: string;
|
|
1265
|
+
readonly offset: number;
|
|
1266
|
+
readonly dir: 'lighter' | 'darker' | 'away';
|
|
1267
|
+
};
|
|
1268
|
+
type ContrastRule = SemanticCommon & {
|
|
1269
|
+
readonly ramp: string;
|
|
1270
|
+
readonly contrast: {
|
|
1271
|
+
readonly min: number;
|
|
1272
|
+
readonly against: readonly string[];
|
|
1273
|
+
};
|
|
1274
|
+
};
|
|
1275
|
+
type RefRule = SemanticCommon & {
|
|
1276
|
+
readonly ref: string;
|
|
1277
|
+
readonly alpha?: number;
|
|
1278
|
+
};
|
|
1279
|
+
type LiteralRule = SemanticCommon & {
|
|
1280
|
+
readonly value: TokenValue;
|
|
1281
|
+
};
|
|
1282
|
+
type SemanticRule = StepRule | OffsetRule | ContrastRule | RefRule | LiteralRule;
|
|
1283
|
+
interface ThemeDefinition {
|
|
1284
|
+
readonly name: string;
|
|
1285
|
+
/** Another definition's name. Absent or null: extends nothing. */
|
|
1286
|
+
readonly extends?: string | null;
|
|
1287
|
+
readonly description?: string;
|
|
1288
|
+
readonly axes?: AxisDefs;
|
|
1289
|
+
readonly seeds?: Readonly<Record<string, Varying<number | string>>>;
|
|
1290
|
+
readonly ramps?: Readonly<Record<string, RampDef>>;
|
|
1291
|
+
readonly scales?: Readonly<Record<string, ScaleDef>>;
|
|
1292
|
+
readonly semantics?: Readonly<Record<string, Varying<SemanticRule>>>;
|
|
1293
|
+
readonly components?: Readonly<Record<string, Varying<PinValue>>>;
|
|
1294
|
+
readonly pins?: Readonly<Record<string, Varying<PinValue>>>;
|
|
1295
|
+
/** The colors a `tone` index picks from. Absent: the nearest theme it extends that has one, else the swatch ramp. */
|
|
1296
|
+
readonly tones?: SerializableColorList;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
export { weaselTheme as $, type AxisDefs as A, type BakedTheme as B, type CategoricalRampDef as C, THEME_SOURCES as D, type ThemeInput as E, type FlatTokens as F, type GeneratedColors as G, colorAt as H, colorCount as I, colorCssAt as J, defineTheme as K, type Lookup as L, enumerateSelections as M, type NumberParam as N, type OffsetRule as O, type PinObject as P, fullSelection as Q, type RawToken as R, type Selection as S, type ThemeDefinition as T, isByAxis as U, type Varying as V, rampSteps as W, resolveTheme as X, selectionKey as Y, themeAxes as Z, themeTones as _, type Theme as a, type ContrastRule as b, type LightnessRampDef as c, type LiteralRule as d, type PinValue as e, type RampDef as f, type RefRule as g, type ScaleDef as h, type SemanticRule as i, type StepRule as j, bake as k, bakeChain as l, mergeChain as m, type TokenName as n, type ResolvedTheme as o, type TokenValue as p, type AxisDef as q, type AxisValue as r, BAKED_THEMES as s, type ByAxis as t, type ColorContext as u, type ColorList as v, type GeneratedTheme as w, type RampColors as x, type SerializableColorList as y, THEMES as z };
|
package/dist/engine.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OklchDeg, oklchDegToHex } from '@weasel-js/paint';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { T as ThemeDefinition, L as Lookup, F as FlatTokens, R as RawToken, S as Selection, B as BakedTheme, A as AxisDefs, a as Theme } from './definition-DLdTdFWs.js';
|
|
3
|
+
export { C as CategoricalRampDef, b as ContrastRule, c as LightnessRampDef, d as LiteralRule, N as NumberParam, O as OffsetRule, P as PinObject, e as PinValue, f as RampDef, g as RefRule, h as ScaleDef, i as SemanticRule, j as StepRule, k as bake, l as bakeChain, m as mergeChain } from './definition-DLdTdFWs.js';
|
|
4
4
|
|
|
5
5
|
/** A color in OKLCH: lightness 0–1, chroma, hue in degrees. paint's own type,
|
|
6
6
|
* under the name this engine has always called it. */
|
package/dist/engine.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { overrideKey, AXES_EXT, ALPHA_EXT } from './chunk-
|
|
2
|
-
import { mergeAxes, toLch, toHex, generate, DEFAULT_CONSTRAINTS, fullSelection, pick, enumerateSelections, resolveTokens, pickAll, themeAxes, selectionKey, isByAxis, contrast } from './chunk-
|
|
3
|
-
export { CHROMA_WEIGHT, DEFAULT_CONSTRAINTS, anchorFromHex, chromaCap, contrast, deltaE, floorDegrees, generate, hexToRgb, hueGap, hueName, luminance, toHex, toHexPreview, toLab, toLch, vividAt } from './chunk-
|
|
1
|
+
import { overrideKey, AXES_EXT, ALPHA_EXT } from './chunk-EINHFDWI.js';
|
|
2
|
+
import { mergeAxes, toLch, toHex, generate, DEFAULT_CONSTRAINTS, fullSelection, pick, enumerateSelections, resolveTokens, pickAll, themeAxes, selectionKey, isByAxis, contrast } from './chunk-C3S4A65R.js';
|
|
3
|
+
export { CHROMA_WEIGHT, DEFAULT_CONSTRAINTS, anchorFromHex, chromaCap, contrast, deltaE, floorDegrees, generate, hexToRgb, hueGap, hueName, luminance, toHex, toHexPreview, toLab, toLch, vividAt } from './chunk-C3S4A65R.js';
|
|
4
4
|
|
|
5
5
|
// src/engine/steps.ts
|
|
6
6
|
var stepList = (x) => Array.isArray(x) ? [...new Set(x.filter((s) => typeof s === "string"))] : [];
|
|
@@ -1459,9 +1459,9 @@ ${body}
|
|
|
1459
1459
|
return [
|
|
1460
1460
|
"// GENERATED by packages/theme/scripts/build-tokens.ts \u2014 do not edit.",
|
|
1461
1461
|
"",
|
|
1462
|
-
"import type { AxisDefs } from '../axes';",
|
|
1463
|
-
"import type { ThemeDefinition } from '../definition';",
|
|
1464
|
-
"import type { BakedTheme } from '../engine/bake';",
|
|
1462
|
+
"import type { AxisDefs } from '../axes.ts';",
|
|
1463
|
+
"import type { ThemeDefinition } from '../definition.ts';",
|
|
1464
|
+
"import type { BakedTheme } from '../engine/bake.ts';",
|
|
1465
1465
|
"",
|
|
1466
1466
|
"/** Every design token the built-in themes declare, spelled as the CSS",
|
|
1467
1467
|
" * custom property it becomes. */",
|