@stealthscale/plugin-theming 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +135 -2
- package/dist/accessibility-Dg5Dh35o.js +409 -0
- package/dist/attributes-vx1W0PiK.js +26 -0
- package/dist/breakpoints-CJjhy79u.js +83 -0
- package/dist/code-DcoH6hCX.js +69 -0
- package/dist/conditions-CjjQwqro.js +338 -0
- package/dist/corners-CH5jyCks.js +92 -0
- package/dist/cursors-hl00ix41.js +54 -0
- package/dist/cyclonedx/bom.json +1 -0
- package/dist/density-DEW_j0I5.js +207 -0
- package/dist/depth-DCn3mAAJ.js +143 -0
- package/dist/doc-page-BQXdbP_h.js +439 -0
- package/dist/extending-CY7ry7Y4.js +31 -0
- package/dist/faces-D76c_Ryh.js +65 -0
- package/dist/gate-CoX2Yr9x.js +199 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +39 -0
- package/dist/layers-BxdWdfPg.js +53 -0
- package/dist/looks-BrROho5Y.js +107 -0
- package/dist/measure-uwF7Fmpy.js +137 -0
- package/dist/mode-colors-Cf_ZPo3g.js +260 -0
- package/dist/mode-panels-Bmh0ec0U.js +54 -0
- package/dist/motion-DRbsuZZo.js +202 -0
- package/dist/overview-BbE82N2c.js +192 -0
- package/dist/palettes-CZo2HrNT.js +49 -0
- package/dist/parts-BVmqVMgo.js +25 -0
- package/dist/recipes-C88xVIGB.js +32 -0
- package/dist/rows-Dv8c7jye.js +18 -0
- package/dist/sampler-Ue67PX2n.js +27 -0
- package/dist/series-AvSZjk2b.js +63 -0
- package/dist/setting-BsgJKTlh.js +12 -0
- package/dist/sizes-B7LgvyBS.js +98 -0
- package/dist/spacing-DMyyV6vX.js +75 -0
- package/dist/surfaces-Db0HjMwB.js +76 -0
- package/dist/text-styles-BZnXaigP.js +233 -0
- package/dist/theme.d.ts +12 -0
- package/dist/theme.js +23 -0
- package/dist/themes-yClyRA9e.js +305 -0
- package/dist/theming-text.recipe-Dvcza4j1.js +308 -0
- package/dist/token-table-yrZh5kLy.js +182 -0
- package/dist/tokens-7Pm-eLiZ.js +138 -0
- package/dist/use-readings-D56mNtEc.js +77 -0
- package/dist/variables-ymFs3Bzn.js +43 -0
- package/dist/worn-D4HEJsJ2.js +15 -0
- package/dist/writing-b05oSPB2.js +31 -0
- package/package.json +124 -3
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { r as SAMPLE } from "./theming-text.recipe-Dvcza4j1.js";
|
|
2
|
+
import { t as referenceOf } from "./variables-ymFs3Bzn.js";
|
|
3
|
+
import { n as useWords, t as DocPage } from "./doc-page-BQXdbP_h.js";
|
|
4
|
+
import { t as useWornTheme } from "./worn-D4HEJsJ2.js";
|
|
5
|
+
import { i as ThemingSample } from "./parts-BVmqVMgo.js";
|
|
6
|
+
import { t as setting } from "./setting-BsgJKTlh.js";
|
|
7
|
+
import { CORNERS, FACES, PALETTES } from "@stealthscale/theme/contract";
|
|
8
|
+
import { c } from "react/compiler-runtime";
|
|
9
|
+
import { Grid, Stack } from "@stealthscale/component-layout";
|
|
10
|
+
import { Badge, ColorSwatch } from "@stealthscale/component-data";
|
|
11
|
+
import { Text } from "@stealthscale/component-typography";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { THEME_ATTRIBUTE } from "@stealthscale/theme";
|
|
14
|
+
import { useThemeChoice } from "@stealthscale/provider-shell";
|
|
15
|
+
import { Button } from "@stealthscale/component-actions";
|
|
16
|
+
import { Card } from "@stealthscale/component-surfaces";
|
|
17
|
+
//#region src/blocks/theme-samples.tsx
|
|
18
|
+
/**
|
|
19
|
+
* Renders the samples in the theme of the element around them.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Every sample reads its token through a reference, so it shows the theme of the nearest element
|
|
23
|
+
* above it that has a theme attribute.
|
|
24
|
+
*/
|
|
25
|
+
function ThemeSamples() {
|
|
26
|
+
const $ = c(18);
|
|
27
|
+
const { t } = useWords();
|
|
28
|
+
let t0;
|
|
29
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t0 = /* @__PURE__ */ jsx(Stack, {
|
|
31
|
+
direction: "row",
|
|
32
|
+
gap: "xs",
|
|
33
|
+
wrap: true,
|
|
34
|
+
children: PALETTES.map(_temp$1)
|
|
35
|
+
});
|
|
36
|
+
$[0] = t0;
|
|
37
|
+
} else t0 = $[0];
|
|
38
|
+
let t1;
|
|
39
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
40
|
+
t1 = /* @__PURE__ */ jsxs(Stack, {
|
|
41
|
+
direction: "row",
|
|
42
|
+
gap: "md",
|
|
43
|
+
children: [FACES.map(_temp2), CORNERS.slice(0, 3).map(_temp3)]
|
|
44
|
+
});
|
|
45
|
+
$[1] = t1;
|
|
46
|
+
} else t1 = $[1];
|
|
47
|
+
let t2;
|
|
48
|
+
if ($[2] !== t) {
|
|
49
|
+
t2 = t("blocks.save");
|
|
50
|
+
$[2] = t;
|
|
51
|
+
$[3] = t2;
|
|
52
|
+
} else t2 = $[3];
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[4] !== t2) {
|
|
55
|
+
t3 = /* @__PURE__ */ jsx(Button, {
|
|
56
|
+
size: "sm",
|
|
57
|
+
children: t2
|
|
58
|
+
});
|
|
59
|
+
$[4] = t2;
|
|
60
|
+
$[5] = t3;
|
|
61
|
+
} else t3 = $[5];
|
|
62
|
+
let t4;
|
|
63
|
+
if ($[6] !== t) {
|
|
64
|
+
t4 = t("blocks.cancel");
|
|
65
|
+
$[6] = t;
|
|
66
|
+
$[7] = t4;
|
|
67
|
+
} else t4 = $[7];
|
|
68
|
+
let t5;
|
|
69
|
+
if ($[8] !== t4) {
|
|
70
|
+
t5 = /* @__PURE__ */ jsx(Button, {
|
|
71
|
+
size: "sm",
|
|
72
|
+
variant: "outline",
|
|
73
|
+
children: t4
|
|
74
|
+
});
|
|
75
|
+
$[8] = t4;
|
|
76
|
+
$[9] = t5;
|
|
77
|
+
} else t5 = $[9];
|
|
78
|
+
let t6;
|
|
79
|
+
if ($[10] !== t) {
|
|
80
|
+
t6 = t("blocks.draft");
|
|
81
|
+
$[10] = t;
|
|
82
|
+
$[11] = t6;
|
|
83
|
+
} else t6 = $[11];
|
|
84
|
+
let t7;
|
|
85
|
+
if ($[12] !== t6) {
|
|
86
|
+
t7 = /* @__PURE__ */ jsx(Badge, { children: t6 });
|
|
87
|
+
$[12] = t6;
|
|
88
|
+
$[13] = t7;
|
|
89
|
+
} else t7 = $[13];
|
|
90
|
+
let t8;
|
|
91
|
+
if ($[14] !== t3 || $[15] !== t5 || $[16] !== t7) {
|
|
92
|
+
t8 = /* @__PURE__ */ jsxs(Stack, {
|
|
93
|
+
gap: "md",
|
|
94
|
+
children: [
|
|
95
|
+
t0,
|
|
96
|
+
t1,
|
|
97
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
98
|
+
direction: "row",
|
|
99
|
+
gap: "sm",
|
|
100
|
+
wrap: true,
|
|
101
|
+
children: [
|
|
102
|
+
t3,
|
|
103
|
+
t5,
|
|
104
|
+
t7
|
|
105
|
+
]
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
});
|
|
109
|
+
$[14] = t3;
|
|
110
|
+
$[15] = t5;
|
|
111
|
+
$[16] = t7;
|
|
112
|
+
$[17] = t8;
|
|
113
|
+
} else t8 = $[17];
|
|
114
|
+
return t8;
|
|
115
|
+
}
|
|
116
|
+
function _temp3(corner) {
|
|
117
|
+
return /* @__PURE__ */ jsx(ThemingSample, { style: setting(SAMPLE.radius, referenceOf("radii", corner)) }, corner);
|
|
118
|
+
}
|
|
119
|
+
function _temp2(face) {
|
|
120
|
+
return /* @__PURE__ */ jsx(ThemingSample, {
|
|
121
|
+
shape: "text",
|
|
122
|
+
style: setting(SAMPLE.face, referenceOf("fonts", face)),
|
|
123
|
+
children: "Aa"
|
|
124
|
+
}, face);
|
|
125
|
+
}
|
|
126
|
+
function _temp$1(palette) {
|
|
127
|
+
return /* @__PURE__ */ jsx(ColorSwatch, { value: referenceOf("colors", `${palette}.solid`) }, palette);
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/blocks/theme-card.tsx
|
|
131
|
+
/**
|
|
132
|
+
* Renders the card under the theme's own attribute, in the page's color mode.
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* The card states the theme attribute, so every token inside it is the theme's and every sample
|
|
136
|
+
* wears it, whichever theme the page wears. The sentence about the theme is the plugin's word
|
|
137
|
+
* `themes.characters.<name>`, and a theme without one shows its name and its samples alone. The
|
|
138
|
+
* button is pressed while the page wears the theme.
|
|
139
|
+
*/
|
|
140
|
+
function ThemeCard(t0) {
|
|
141
|
+
const $ = c(28);
|
|
142
|
+
const { name } = t0;
|
|
143
|
+
const { t } = useWords();
|
|
144
|
+
const { setTheme } = useThemeChoice();
|
|
145
|
+
const worn = useWornTheme() === name;
|
|
146
|
+
const t1 = `themes.characters.${name}`;
|
|
147
|
+
let t2;
|
|
148
|
+
if ($[0] !== t || $[1] !== t1) {
|
|
149
|
+
t2 = t(t1, { defaultValue: "" });
|
|
150
|
+
$[0] = t;
|
|
151
|
+
$[1] = t1;
|
|
152
|
+
$[2] = t2;
|
|
153
|
+
} else t2 = $[2];
|
|
154
|
+
const character = t2;
|
|
155
|
+
let t3;
|
|
156
|
+
if ($[3] !== name) {
|
|
157
|
+
t3 = { [THEME_ATTRIBUTE]: name };
|
|
158
|
+
$[3] = name;
|
|
159
|
+
$[4] = t3;
|
|
160
|
+
} else t3 = $[4];
|
|
161
|
+
let t4;
|
|
162
|
+
if ($[5] !== name) {
|
|
163
|
+
t4 = /* @__PURE__ */ jsx(Card.Title, {
|
|
164
|
+
as: "h3",
|
|
165
|
+
children: name
|
|
166
|
+
});
|
|
167
|
+
$[5] = name;
|
|
168
|
+
$[6] = t4;
|
|
169
|
+
} else t4 = $[6];
|
|
170
|
+
let t5;
|
|
171
|
+
if ($[7] !== character) {
|
|
172
|
+
t5 = character === "" ? null : /* @__PURE__ */ jsx(Card.Description, { children: character });
|
|
173
|
+
$[7] = character;
|
|
174
|
+
$[8] = t5;
|
|
175
|
+
} else t5 = $[8];
|
|
176
|
+
let t6;
|
|
177
|
+
if ($[9] !== t4 || $[10] !== t5) {
|
|
178
|
+
t6 = /* @__PURE__ */ jsxs(Card.Header, { children: [t4, t5] });
|
|
179
|
+
$[9] = t4;
|
|
180
|
+
$[10] = t5;
|
|
181
|
+
$[11] = t6;
|
|
182
|
+
} else t6 = $[11];
|
|
183
|
+
let t7;
|
|
184
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
185
|
+
t7 = /* @__PURE__ */ jsx(Card.Content, { children: /* @__PURE__ */ jsx(ThemeSamples, {}) });
|
|
186
|
+
$[12] = t7;
|
|
187
|
+
} else t7 = $[12];
|
|
188
|
+
let t8;
|
|
189
|
+
if ($[13] !== name || $[14] !== setTheme) {
|
|
190
|
+
t8 = () => {
|
|
191
|
+
setTheme(name);
|
|
192
|
+
};
|
|
193
|
+
$[13] = name;
|
|
194
|
+
$[14] = setTheme;
|
|
195
|
+
$[15] = t8;
|
|
196
|
+
} else t8 = $[15];
|
|
197
|
+
const t9 = worn ? "solid" : "outline";
|
|
198
|
+
let t10;
|
|
199
|
+
if ($[16] !== name || $[17] !== t) {
|
|
200
|
+
t10 = t("blocks.wear", { name });
|
|
201
|
+
$[16] = name;
|
|
202
|
+
$[17] = t;
|
|
203
|
+
$[18] = t10;
|
|
204
|
+
} else t10 = $[18];
|
|
205
|
+
let t11;
|
|
206
|
+
if ($[19] !== t10 || $[20] !== t8 || $[21] !== t9 || $[22] !== worn) {
|
|
207
|
+
t11 = /* @__PURE__ */ jsx(Card.Footer, { children: /* @__PURE__ */ jsx(Button, {
|
|
208
|
+
"aria-pressed": worn,
|
|
209
|
+
onClick: t8,
|
|
210
|
+
size: "sm",
|
|
211
|
+
variant: t9,
|
|
212
|
+
children: t10
|
|
213
|
+
}) });
|
|
214
|
+
$[19] = t10;
|
|
215
|
+
$[20] = t8;
|
|
216
|
+
$[21] = t9;
|
|
217
|
+
$[22] = worn;
|
|
218
|
+
$[23] = t11;
|
|
219
|
+
} else t11 = $[23];
|
|
220
|
+
let t12;
|
|
221
|
+
if ($[24] !== t11 || $[25] !== t3 || $[26] !== t6) {
|
|
222
|
+
t12 = /* @__PURE__ */ jsxs(Card.Root, {
|
|
223
|
+
variant: "outline",
|
|
224
|
+
...t3,
|
|
225
|
+
children: [
|
|
226
|
+
t6,
|
|
227
|
+
t7,
|
|
228
|
+
t11
|
|
229
|
+
]
|
|
230
|
+
});
|
|
231
|
+
$[24] = t11;
|
|
232
|
+
$[25] = t3;
|
|
233
|
+
$[26] = t6;
|
|
234
|
+
$[27] = t12;
|
|
235
|
+
} else t12 = $[27];
|
|
236
|
+
return t12;
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/blocks/theme-cards.tsx
|
|
240
|
+
/**
|
|
241
|
+
* Renders the cards in columns as wide as the room allows, in the order the product offers the
|
|
242
|
+
* themes, or a sentence where the product offers none.
|
|
243
|
+
*/
|
|
244
|
+
function ThemeCards() {
|
|
245
|
+
const $ = c(8);
|
|
246
|
+
const { t } = useWords();
|
|
247
|
+
const { themes } = useThemeChoice();
|
|
248
|
+
if (themes.length === 0) {
|
|
249
|
+
let t0;
|
|
250
|
+
if ($[0] !== t) {
|
|
251
|
+
t0 = t("blocks.noThemes");
|
|
252
|
+
$[0] = t;
|
|
253
|
+
$[1] = t0;
|
|
254
|
+
} else t0 = $[1];
|
|
255
|
+
let t1;
|
|
256
|
+
if ($[2] !== t0) {
|
|
257
|
+
t1 = /* @__PURE__ */ jsx(Text, { children: t0 });
|
|
258
|
+
$[2] = t0;
|
|
259
|
+
$[3] = t1;
|
|
260
|
+
} else t1 = $[3];
|
|
261
|
+
return t1;
|
|
262
|
+
}
|
|
263
|
+
let t0;
|
|
264
|
+
if ($[4] !== themes) {
|
|
265
|
+
t0 = themes.map(_temp);
|
|
266
|
+
$[4] = themes;
|
|
267
|
+
$[5] = t0;
|
|
268
|
+
} else t0 = $[5];
|
|
269
|
+
let t1;
|
|
270
|
+
if ($[6] !== t0) {
|
|
271
|
+
t1 = /* @__PURE__ */ jsx(Grid.Root, {
|
|
272
|
+
columns: "fill-xs",
|
|
273
|
+
gap: "md",
|
|
274
|
+
children: t0
|
|
275
|
+
});
|
|
276
|
+
$[6] = t0;
|
|
277
|
+
$[7] = t1;
|
|
278
|
+
} else t1 = $[7];
|
|
279
|
+
return t1;
|
|
280
|
+
}
|
|
281
|
+
function _temp(name) {
|
|
282
|
+
return /* @__PURE__ */ jsx(ThemeCard, { name }, name);
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/pages/themes.tsx
|
|
286
|
+
/**
|
|
287
|
+
* Renders the themes page.
|
|
288
|
+
*/
|
|
289
|
+
function ThemesPage() {
|
|
290
|
+
const $ = c(1);
|
|
291
|
+
let t0;
|
|
292
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
293
|
+
t0 = /* @__PURE__ */ jsx(DocPage, {
|
|
294
|
+
page: "themes",
|
|
295
|
+
sections: [{
|
|
296
|
+
block: /* @__PURE__ */ jsx(ThemeCards, {}),
|
|
297
|
+
id: "offered"
|
|
298
|
+
}, { id: "wearing" }]
|
|
299
|
+
});
|
|
300
|
+
$[0] = t0;
|
|
301
|
+
} else t0 = $[0];
|
|
302
|
+
return t0;
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
export { ThemesPage };
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { FIELD_EDGE, axis, defineRecipe, dense, stack } from "@stealthscale/theme/authoring";
|
|
2
|
+
import { ANIMATION_STYLES, FONT_SIZES, LAYER_STYLES, ROLE_STYLES } from "@stealthscale/theme/contract";
|
|
3
|
+
//#region src/recipes/keys.ts
|
|
4
|
+
/**
|
|
5
|
+
* Writes the name of a style as the value of a recipe's axis.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* A value of an axis becomes part of a class name, so the dot a nested style's name contains is
|
|
9
|
+
* written as a dash: `fill.solid` is the value `fill-solid`. No two of the foundation's names
|
|
10
|
+
* differ by a dot alone.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Returns the axis value of a style's name, each dot written as a dash.
|
|
14
|
+
*
|
|
15
|
+
* @param name - The style's name, such as `heading.2xl`.
|
|
16
|
+
*/
|
|
17
|
+
function keyOf(name) {
|
|
18
|
+
return name.replaceAll(".", "-");
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/recipes/theming-look.recipe.ts
|
|
22
|
+
/**
|
|
23
|
+
* States the box a layer style is shown on: one value per layer style the foundation fills.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* The axis lists every name of the foundation's vocabulary and states each value under
|
|
27
|
+
* `staticCss`, so a product that installs the plugin emits every look whether or not its own
|
|
28
|
+
* sources name one. A look reads the primary palette, so a fill shows the brand.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Maps each value of the axis to the layer style it applies.
|
|
32
|
+
*/
|
|
33
|
+
const NAMED$2 = new Map(LAYER_STYLES.map((name) => [keyOf(name), name]));
|
|
34
|
+
/**
|
|
35
|
+
* Lists the values of the axis, in the vocabulary's order.
|
|
36
|
+
*/
|
|
37
|
+
const LOOKS = [...NAMED$2.keys()];
|
|
38
|
+
/**
|
|
39
|
+
* Writes one value of the axis: the layer style of the same name.
|
|
40
|
+
*/
|
|
41
|
+
const look = axis(LOOKS, (key) => ({ layerStyle: NAMED$2.get(key) }));
|
|
42
|
+
/**
|
|
43
|
+
* Styles a box that centres its name, at the control's corner, in the primary palette.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* The box has a transparent edge at the control's width and the field's edge color, so a look
|
|
47
|
+
* that colors the edge, such as an outline or a field look, shows it.
|
|
48
|
+
*/
|
|
49
|
+
const recipe$4 = defineRecipe({
|
|
50
|
+
base: {
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
borderColor: "transparent",
|
|
53
|
+
borderRadius: "l2",
|
|
54
|
+
borderStyle: "solid",
|
|
55
|
+
borderWidth: "control",
|
|
56
|
+
colorPalette: "primary",
|
|
57
|
+
display: "flex",
|
|
58
|
+
[FIELD_EDGE]: "{colors.border.emphasized}",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
minBlockSize: "20",
|
|
61
|
+
padding: dense("{spacing.inset.sm}"),
|
|
62
|
+
textAlign: "center"
|
|
63
|
+
},
|
|
64
|
+
className: "theming-look",
|
|
65
|
+
jsx: [/^ThemingLook$/u],
|
|
66
|
+
staticCss: [{ look: LOOKS }],
|
|
67
|
+
variants: { look: look() }
|
|
68
|
+
});
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/recipes/theming-motion.recipe.ts
|
|
71
|
+
/**
|
|
72
|
+
* States the tile a motion is shown on: one value per animation style the foundation fills.
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* Three motions move a property a plain tile does not paint, so their values paint it: `sweep`
|
|
76
|
+
* turns the moving border's angle, `shimmer` moves the shine across the tile, and `aurora`
|
|
77
|
+
* drifts the aurora backdrop. A collapsing tile starts from its own height, and a meteor crosses
|
|
78
|
+
* the tile's room rather than the window. Every motion stops for a reader who asked for less
|
|
79
|
+
* motion, as every animation style of the foundation does.
|
|
80
|
+
*/
|
|
81
|
+
/**
|
|
82
|
+
* Maps each value of the axis to the animation style it applies.
|
|
83
|
+
*/
|
|
84
|
+
const NAMED$1 = new Map(ANIMATION_STYLES.map((name) => [keyOf(name), name]));
|
|
85
|
+
/**
|
|
86
|
+
* Lists the values of the axis, in the vocabulary's order.
|
|
87
|
+
*/
|
|
88
|
+
const MOTIONS = [...NAMED$1.keys()];
|
|
89
|
+
/**
|
|
90
|
+
* Lists the paint each motion that moves a property a tile does not paint adds.
|
|
91
|
+
*/
|
|
92
|
+
const PAINTED = {
|
|
93
|
+
aurora: { layerStyle: "backdrop.aurora" },
|
|
94
|
+
shimmer: {
|
|
95
|
+
backgroundImage: "{gradients.shine}",
|
|
96
|
+
backgroundSize: "200% 100%"
|
|
97
|
+
},
|
|
98
|
+
sweep: { layerStyle: "border.moving" }
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Writes one value of the axis: the animation style of the same name, with the paint it moves.
|
|
102
|
+
*/
|
|
103
|
+
const motion = axis(MOTIONS, (key) => ({
|
|
104
|
+
animationStyle: NAMED$1.get(key),
|
|
105
|
+
...PAINTED[key]
|
|
106
|
+
}));
|
|
107
|
+
/**
|
|
108
|
+
* Styles a tile in the primary palette's solid, at the control's corner.
|
|
109
|
+
*/
|
|
110
|
+
const recipe$3 = defineRecipe({
|
|
111
|
+
base: {
|
|
112
|
+
"--height": "{sizes.10}",
|
|
113
|
+
"--meteor-travel": "{sizes.24}",
|
|
114
|
+
"--shadow-color": "{colors.primary.solid}",
|
|
115
|
+
background: "colorPalette.solid",
|
|
116
|
+
borderRadius: "l2",
|
|
117
|
+
boxSize: "10",
|
|
118
|
+
colorPalette: "primary",
|
|
119
|
+
display: "block"
|
|
120
|
+
},
|
|
121
|
+
className: "theming-motion",
|
|
122
|
+
jsx: [/^ThemingMotion$/u],
|
|
123
|
+
staticCss: [{ motion: MOTIONS }],
|
|
124
|
+
variants: { motion: motion() }
|
|
125
|
+
});
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/recipes/theming-panel.recipe.ts
|
|
128
|
+
/**
|
|
129
|
+
* States the panel a block shows one color mode in: the mode's page and ink, with a hairline edge.
|
|
130
|
+
*
|
|
131
|
+
* @remarks
|
|
132
|
+
* The panel has the theme and the mode attributes, so every token inside it resolves in that
|
|
133
|
+
* mode, and it paints the mode's page background, so each value shows against the page of its
|
|
134
|
+
* own mode.
|
|
135
|
+
*/
|
|
136
|
+
/**
|
|
137
|
+
* Styles a panel: the page's background and ink, the container's corner and a medium inset.
|
|
138
|
+
*/
|
|
139
|
+
const recipe$2 = defineRecipe({
|
|
140
|
+
base: {
|
|
141
|
+
...stack({
|
|
142
|
+
direction: "column",
|
|
143
|
+
gap: "gap.md"
|
|
144
|
+
}),
|
|
145
|
+
background: "bg",
|
|
146
|
+
borderColor: "border",
|
|
147
|
+
borderRadius: "l3",
|
|
148
|
+
borderStyle: "solid",
|
|
149
|
+
borderWidth: "hairline",
|
|
150
|
+
color: "fg",
|
|
151
|
+
minInlineSize: "0",
|
|
152
|
+
padding: dense("{spacing.inset.md}")
|
|
153
|
+
},
|
|
154
|
+
className: "theming-panel",
|
|
155
|
+
jsx: [/^ThemingPanel$/u]
|
|
156
|
+
});
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/recipes/sample-properties.ts
|
|
159
|
+
/**
|
|
160
|
+
* Lists the custom property each value of a sample is read from.
|
|
161
|
+
*/
|
|
162
|
+
const SAMPLE = {
|
|
163
|
+
cursor: "--theming-cursor",
|
|
164
|
+
face: "--theming-face",
|
|
165
|
+
filter: "--theming-filter",
|
|
166
|
+
fontSize: "--theming-font-size",
|
|
167
|
+
leading: "--theming-leading",
|
|
168
|
+
opacity: "--theming-opacity",
|
|
169
|
+
radius: "--theming-radius",
|
|
170
|
+
ratio: "--theming-ratio",
|
|
171
|
+
shadow: "--theming-shadow",
|
|
172
|
+
size: "--theming-size",
|
|
173
|
+
stroke: "--theming-stroke",
|
|
174
|
+
tracking: "--theming-tracking",
|
|
175
|
+
weight: "--theming-weight"
|
|
176
|
+
};
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/recipes/theming-sample.recipe.ts
|
|
179
|
+
/**
|
|
180
|
+
* States the sample a token is shown on: a bar as long as a length, a square as large as a size, a
|
|
181
|
+
* line as thick as a stroke, a box at an aspect ratio, a tile with a corner, a shadow, a cursor, a
|
|
182
|
+
* blur or an opacity, and words set at a face, size, weight, leading or tracking.
|
|
183
|
+
*
|
|
184
|
+
* @remarks
|
|
185
|
+
* A page passes the token to the sample as a custom property, `var(--radii-l2)` for
|
|
186
|
+
* `--theming-radius`, because the page shows whichever token it lists. Each shape reads only the
|
|
187
|
+
* properties it shows, and a property left unset takes the value that shows nothing. Words that
|
|
188
|
+
* state no face are set in the heading face, which follows the body face unless the theme states
|
|
189
|
+
* one, so a size or a weight shows the face that sets a theme apart.
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* Lists the shapes a sample takes, in the order a page shows them.
|
|
193
|
+
*/
|
|
194
|
+
const SHAPES = [
|
|
195
|
+
"bar",
|
|
196
|
+
"square",
|
|
197
|
+
"line",
|
|
198
|
+
"ratio",
|
|
199
|
+
"tile",
|
|
200
|
+
"text"
|
|
201
|
+
];
|
|
202
|
+
/**
|
|
203
|
+
* Lists the styles of each shape.
|
|
204
|
+
*/
|
|
205
|
+
const STYLES$1 = {
|
|
206
|
+
bar: {
|
|
207
|
+
background: "colorPalette.solid",
|
|
208
|
+
blockSize: "2",
|
|
209
|
+
borderRadius: "xs",
|
|
210
|
+
inlineSize: `var(${SAMPLE.size})`
|
|
211
|
+
},
|
|
212
|
+
line: {
|
|
213
|
+
borderBlockStartStyle: "solid",
|
|
214
|
+
borderBlockStartWidth: `var(${SAMPLE.stroke})`,
|
|
215
|
+
borderColor: "fg",
|
|
216
|
+
inlineSize: "16"
|
|
217
|
+
},
|
|
218
|
+
ratio: {
|
|
219
|
+
aspectRatio: `var(${SAMPLE.ratio})`,
|
|
220
|
+
background: "colorPalette.subtle",
|
|
221
|
+
borderColor: "colorPalette.muted",
|
|
222
|
+
borderStyle: "solid",
|
|
223
|
+
borderWidth: "hairline",
|
|
224
|
+
inlineSize: "20"
|
|
225
|
+
},
|
|
226
|
+
square: {
|
|
227
|
+
background: "colorPalette.subtle",
|
|
228
|
+
borderColor: "colorPalette.muted",
|
|
229
|
+
borderRadius: "l1",
|
|
230
|
+
borderStyle: "solid",
|
|
231
|
+
borderWidth: "hairline",
|
|
232
|
+
boxSize: `var(${SAMPLE.size})`
|
|
233
|
+
},
|
|
234
|
+
text: {
|
|
235
|
+
fontFamily: `var(${SAMPLE.face}, {fonts.heading})`,
|
|
236
|
+
fontSize: `var(${SAMPLE.fontSize}, inherit)`,
|
|
237
|
+
fontWeight: `var(${SAMPLE.weight}, inherit)`,
|
|
238
|
+
letterSpacing: `var(${SAMPLE.tracking}, inherit)`,
|
|
239
|
+
lineHeight: `var(${SAMPLE.leading}, inherit)`
|
|
240
|
+
},
|
|
241
|
+
tile: {
|
|
242
|
+
background: "bg.panel",
|
|
243
|
+
borderColor: "border",
|
|
244
|
+
borderRadius: `var(${SAMPLE.radius}, {radii.l2})`,
|
|
245
|
+
borderStyle: "solid",
|
|
246
|
+
borderWidth: "hairline",
|
|
247
|
+
boxShadow: `var(${SAMPLE.shadow}, none)`,
|
|
248
|
+
boxSize: "12",
|
|
249
|
+
cursor: `var(${SAMPLE.cursor}, auto)`,
|
|
250
|
+
filter: `var(${SAMPLE.filter}, none)`,
|
|
251
|
+
opacity: `var(${SAMPLE.opacity}, 1)`
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Styles a sample in the primary palette at the shape a page asks for.
|
|
256
|
+
*/
|
|
257
|
+
const recipe$1 = defineRecipe({
|
|
258
|
+
base: {
|
|
259
|
+
colorPalette: "primary",
|
|
260
|
+
display: "block",
|
|
261
|
+
flexShrink: "0"
|
|
262
|
+
},
|
|
263
|
+
className: "theming-sample",
|
|
264
|
+
defaultVariants: { shape: "tile" },
|
|
265
|
+
jsx: [/^ThemingSample$/u],
|
|
266
|
+
staticCss: [{ shape: [...SHAPES] }],
|
|
267
|
+
variants: { shape: axis(SHAPES, (one) => STYLES$1[one])() }
|
|
268
|
+
});
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/recipes/theming-text.recipe.ts
|
|
271
|
+
/**
|
|
272
|
+
* States the words a text style is shown in: one value per size style and per role style the
|
|
273
|
+
* foundation fills.
|
|
274
|
+
*
|
|
275
|
+
* @remarks
|
|
276
|
+
* The axis lists every name of the foundation's vocabulary and states each value under
|
|
277
|
+
* `staticCss`, so a product that installs the plugin emits every text style. The axis is `text`,
|
|
278
|
+
* because a prop named `style` is the element's inline style.
|
|
279
|
+
*/
|
|
280
|
+
/**
|
|
281
|
+
* Maps each value of the axis to the text style it applies.
|
|
282
|
+
*/
|
|
283
|
+
const NAMED = new Map([...FONT_SIZES, ...ROLE_STYLES].map((name) => [keyOf(name), name]));
|
|
284
|
+
/**
|
|
285
|
+
* Lists the values of the axis: the sizes, then the roles.
|
|
286
|
+
*/
|
|
287
|
+
const STYLES = [...NAMED.keys()];
|
|
288
|
+
/**
|
|
289
|
+
* Writes one value of the axis: the text style of the same name.
|
|
290
|
+
*/
|
|
291
|
+
const style = axis(STYLES, (key) => ({ textStyle: NAMED.get(key) }));
|
|
292
|
+
/**
|
|
293
|
+
* Styles the words of a sample in the ink, breaking a line that is wider than its room anywhere.
|
|
294
|
+
*/
|
|
295
|
+
const recipe = defineRecipe({
|
|
296
|
+
base: {
|
|
297
|
+
color: "fg",
|
|
298
|
+
display: "block",
|
|
299
|
+
minInlineSize: "0",
|
|
300
|
+
overflowWrap: "anywhere"
|
|
301
|
+
},
|
|
302
|
+
className: "theming-text",
|
|
303
|
+
jsx: [/^ThemingText$/u],
|
|
304
|
+
staticCss: [{ text: STYLES }],
|
|
305
|
+
variants: { text: style() }
|
|
306
|
+
});
|
|
307
|
+
//#endregion
|
|
308
|
+
export { recipe$3 as a, recipe$2 as i, recipe$1 as n, recipe$4 as o, SAMPLE as r, keyOf as s, recipe as t };
|