@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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +135 -2
  3. package/dist/accessibility-Dg5Dh35o.js +409 -0
  4. package/dist/attributes-vx1W0PiK.js +26 -0
  5. package/dist/breakpoints-CJjhy79u.js +83 -0
  6. package/dist/code-DcoH6hCX.js +69 -0
  7. package/dist/conditions-CjjQwqro.js +338 -0
  8. package/dist/corners-CH5jyCks.js +92 -0
  9. package/dist/cursors-hl00ix41.js +54 -0
  10. package/dist/cyclonedx/bom.json +1 -0
  11. package/dist/density-DEW_j0I5.js +207 -0
  12. package/dist/depth-DCn3mAAJ.js +143 -0
  13. package/dist/doc-page-BQXdbP_h.js +439 -0
  14. package/dist/extending-CY7ry7Y4.js +31 -0
  15. package/dist/faces-D76c_Ryh.js +65 -0
  16. package/dist/gate-CoX2Yr9x.js +199 -0
  17. package/dist/index.d.ts +48 -0
  18. package/dist/index.js +39 -0
  19. package/dist/layers-BxdWdfPg.js +53 -0
  20. package/dist/looks-BrROho5Y.js +107 -0
  21. package/dist/measure-uwF7Fmpy.js +137 -0
  22. package/dist/mode-colors-Cf_ZPo3g.js +260 -0
  23. package/dist/mode-panels-Bmh0ec0U.js +54 -0
  24. package/dist/motion-DRbsuZZo.js +202 -0
  25. package/dist/overview-BbE82N2c.js +192 -0
  26. package/dist/palettes-CZo2HrNT.js +49 -0
  27. package/dist/parts-BVmqVMgo.js +25 -0
  28. package/dist/recipes-C88xVIGB.js +32 -0
  29. package/dist/rows-Dv8c7jye.js +18 -0
  30. package/dist/sampler-Ue67PX2n.js +27 -0
  31. package/dist/series-AvSZjk2b.js +63 -0
  32. package/dist/setting-BsgJKTlh.js +12 -0
  33. package/dist/sizes-B7LgvyBS.js +98 -0
  34. package/dist/spacing-DMyyV6vX.js +75 -0
  35. package/dist/surfaces-Db0HjMwB.js +76 -0
  36. package/dist/text-styles-BZnXaigP.js +233 -0
  37. package/dist/theme.d.ts +12 -0
  38. package/dist/theme.js +23 -0
  39. package/dist/themes-yClyRA9e.js +305 -0
  40. package/dist/theming-text.recipe-Dvcza4j1.js +308 -0
  41. package/dist/token-table-yrZh5kLy.js +182 -0
  42. package/dist/tokens-7Pm-eLiZ.js +138 -0
  43. package/dist/use-readings-D56mNtEc.js +77 -0
  44. package/dist/variables-ymFs3Bzn.js +43 -0
  45. package/dist/worn-D4HEJsJ2.js +15 -0
  46. package/dist/writing-b05oSPB2.js +31 -0
  47. package/package.json +124 -3
@@ -0,0 +1,69 @@
1
+ import { n as variableOf } from "./variables-ymFs3Bzn.js";
2
+ import { n as useWords, t as DocPage } from "./doc-page-BQXdbP_h.js";
3
+ import { t as ModeColors } from "./mode-colors-Cf_ZPo3g.js";
4
+ import { CODE } from "@stealthscale/theme/contract";
5
+ import { c } from "react/compiler-runtime";
6
+ import { jsx } from "react/jsx-runtime";
7
+ //#region src/pages/code.tsx
8
+ /**
9
+ * Returns the code inks as rows measured against one surface.
10
+ */
11
+ function rowsOn(surface) {
12
+ return CODE.map((ink) => ({
13
+ against: {
14
+ name: surface,
15
+ variable: variableOf("colors", surface)
16
+ },
17
+ name: `code.${ink}`,
18
+ variable: variableOf("colors", `code.${ink}`)
19
+ }));
20
+ }
21
+ /**
22
+ * Renders the code page: the inks on each surface, each list named by its surface, then a passage
23
+ * set in them.
24
+ */
25
+ function CodePage() {
26
+ const $ = c(5);
27
+ const { t } = useWords();
28
+ let t0;
29
+ if ($[0] !== t) {
30
+ t0 = [{
31
+ id: "page",
32
+ surface: "bg"
33
+ }, {
34
+ id: "panel",
35
+ surface: "bg.panel"
36
+ }].map((t1) => {
37
+ const { id, surface } = t1;
38
+ return {
39
+ block: /* @__PURE__ */ jsx(ModeColors, {
40
+ name: t("blocks.onSurface", {
41
+ name: "code",
42
+ surface
43
+ }),
44
+ rows: rowsOn(surface)
45
+ }),
46
+ id
47
+ };
48
+ });
49
+ $[0] = t;
50
+ $[1] = t0;
51
+ } else t0 = $[1];
52
+ let t1;
53
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
54
+ t1 = { id: "sample" };
55
+ $[2] = t1;
56
+ } else t1 = $[2];
57
+ let t2;
58
+ if ($[3] !== t0) {
59
+ t2 = /* @__PURE__ */ jsx(DocPage, {
60
+ page: "code",
61
+ sections: [...t0, t1]
62
+ });
63
+ $[3] = t0;
64
+ $[4] = t2;
65
+ } else t2 = $[4];
66
+ return t2;
67
+ }
68
+ //#endregion
69
+ export { CodePage };
@@ -0,0 +1,338 @@
1
+ import { n as useWords, t as DocPage } from "./doc-page-BQXdbP_h.js";
2
+ import { CONDITIONS } from "@stealthscale/theme/contract";
3
+ import { c } from "react/compiler-runtime";
4
+ import { Table } from "@stealthscale/component-collections";
5
+ import { Code } from "@stealthscale/component-typography";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { useMediaQuery } from "@stealthscale/hooks";
8
+ //#region src/blocks/condition-table.tsx
9
+ /**
10
+ * Returns a cell that writes a condition as a recipe writes it.
11
+ */
12
+ function named(condition) {
13
+ return /* @__PURE__ */ jsx(Code, { children: `_${condition}` });
14
+ }
15
+ /**
16
+ * Renders a row per condition, in the vocabulary's order, with the sentence the plugin's words
17
+ * write for it.
18
+ */
19
+ function ConditionTable() {
20
+ const $ = c(23);
21
+ const { t } = useWords();
22
+ let T0;
23
+ let caption;
24
+ let t0;
25
+ if ($[0] !== t) {
26
+ caption = t("conditions.sections.conditions.title");
27
+ T0 = Table.Simple;
28
+ t0 = t("blocks.tableOf", { name: caption });
29
+ $[0] = t;
30
+ $[1] = T0;
31
+ $[2] = caption;
32
+ $[3] = t0;
33
+ } else {
34
+ T0 = $[1];
35
+ caption = $[2];
36
+ t0 = $[3];
37
+ }
38
+ let t1;
39
+ if ($[4] !== t) {
40
+ t1 = t("blocks.condition");
41
+ $[4] = t;
42
+ $[5] = t1;
43
+ } else t1 = $[5];
44
+ let t2;
45
+ if ($[6] !== t1) {
46
+ t2 = {
47
+ cell: _temp$1,
48
+ key: "condition",
49
+ label: t1,
50
+ rowHeader: true
51
+ };
52
+ $[6] = t1;
53
+ $[7] = t2;
54
+ } else t2 = $[7];
55
+ let t3;
56
+ if ($[8] !== t) {
57
+ t3 = t("blocks.meaning");
58
+ $[8] = t;
59
+ $[9] = t3;
60
+ } else t3 = $[9];
61
+ let t4;
62
+ if ($[10] !== t3) {
63
+ t4 = {
64
+ key: "meaning",
65
+ label: t3
66
+ };
67
+ $[10] = t3;
68
+ $[11] = t4;
69
+ } else t4 = $[11];
70
+ let t5;
71
+ if ($[12] !== t2 || $[13] !== t4) {
72
+ t5 = [t2, t4];
73
+ $[12] = t2;
74
+ $[13] = t4;
75
+ $[14] = t5;
76
+ } else t5 = $[14];
77
+ let t6;
78
+ if ($[15] !== t) {
79
+ t6 = CONDITIONS.map((condition_0) => ({
80
+ condition: condition_0,
81
+ meaning: t(`conditions.meanings.${condition_0}`, { defaultValue: "" })
82
+ }));
83
+ $[15] = t;
84
+ $[16] = t6;
85
+ } else t6 = $[16];
86
+ let t7;
87
+ if ($[17] !== T0 || $[18] !== caption || $[19] !== t0 || $[20] !== t5 || $[21] !== t6) {
88
+ t7 = /* @__PURE__ */ jsx(T0, {
89
+ "aria-label": t0,
90
+ caption,
91
+ columns: t5,
92
+ rows: t6,
93
+ rowToKey: _temp2$1
94
+ });
95
+ $[17] = T0;
96
+ $[18] = caption;
97
+ $[19] = t0;
98
+ $[20] = t5;
99
+ $[21] = t6;
100
+ $[22] = t7;
101
+ } else t7 = $[22];
102
+ return t7;
103
+ }
104
+ function _temp2$1(t0) {
105
+ const { condition: condition_1 } = t0;
106
+ return condition_1;
107
+ }
108
+ function _temp$1(t0) {
109
+ const { condition } = t0;
110
+ return named(condition);
111
+ }
112
+ //#endregion
113
+ //#region src/blocks/media-states.tsx
114
+ /**
115
+ * Lists the conditions a browser decides from the reader's device and settings.
116
+ */
117
+ const DECIDED = [
118
+ {
119
+ condition: "_mouse",
120
+ query: "(pointer: fine)"
121
+ },
122
+ {
123
+ condition: "_touch",
124
+ query: "(pointer: coarse)"
125
+ },
126
+ {
127
+ condition: "_osDark",
128
+ query: "(prefers-color-scheme: dark)"
129
+ },
130
+ {
131
+ condition: "_motionReduce",
132
+ query: "(prefers-reduced-motion: reduce)"
133
+ },
134
+ {
135
+ condition: "_reducedTransparency",
136
+ query: "(prefers-reduced-transparency: reduce)"
137
+ },
138
+ {
139
+ condition: "_highContrast",
140
+ query: "(forced-colors: active)"
141
+ }
142
+ ];
143
+ /**
144
+ * Returns a cell that writes a name as code.
145
+ */
146
+ function coded(name) {
147
+ return /* @__PURE__ */ jsx(Code, {
148
+ size: "sm",
149
+ children: name
150
+ });
151
+ }
152
+ /**
153
+ * Renders a row per condition, re-read whenever one of the queries changes.
154
+ *
155
+ * @remarks
156
+ * The queries are read on the first render, so the page shows the reader's state at once. The
157
+ * table is set at the `sm` size, so the longest media query fits beside the contents rail in a
158
+ * window 1280px wide.
159
+ */
160
+ function MediaStates() {
161
+ const $ = c(32);
162
+ const { t } = useWords();
163
+ let t0;
164
+ let t1;
165
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
166
+ t0 = DECIDED.map(_temp);
167
+ t1 = { ssr: false };
168
+ $[0] = t0;
169
+ $[1] = t1;
170
+ } else {
171
+ t0 = $[0];
172
+ t1 = $[1];
173
+ }
174
+ const matches = useMediaQuery(t0, t1);
175
+ let t2;
176
+ if ($[2] !== matches) {
177
+ t2 = DECIDED.map((t3, at) => {
178
+ const { condition, query: query_0 } = t3;
179
+ return {
180
+ condition,
181
+ matches: matches[at] === true,
182
+ query: query_0
183
+ };
184
+ });
185
+ $[2] = matches;
186
+ $[3] = t2;
187
+ } else t2 = $[3];
188
+ const rows = t2;
189
+ let t3;
190
+ if ($[4] !== t) {
191
+ t3 = t("blocks.tableOf", { name: t("blocks.decided") });
192
+ $[4] = t;
193
+ $[5] = t3;
194
+ } else t3 = $[5];
195
+ let t4;
196
+ if ($[6] !== t) {
197
+ t4 = t("blocks.decided");
198
+ $[6] = t;
199
+ $[7] = t4;
200
+ } else t4 = $[7];
201
+ let t5;
202
+ if ($[8] !== t) {
203
+ t5 = t("blocks.condition");
204
+ $[8] = t;
205
+ $[9] = t5;
206
+ } else t5 = $[9];
207
+ let t6;
208
+ if ($[10] !== t5) {
209
+ t6 = {
210
+ cell: _temp2,
211
+ key: "condition",
212
+ label: t5,
213
+ rowHeader: true
214
+ };
215
+ $[10] = t5;
216
+ $[11] = t6;
217
+ } else t6 = $[11];
218
+ let t7;
219
+ if ($[12] !== t) {
220
+ t7 = t("blocks.query");
221
+ $[12] = t;
222
+ $[13] = t7;
223
+ } else t7 = $[13];
224
+ let t8;
225
+ if ($[14] !== t7) {
226
+ t8 = {
227
+ cell: _temp3,
228
+ key: "query",
229
+ label: t7
230
+ };
231
+ $[14] = t7;
232
+ $[15] = t8;
233
+ } else t8 = $[15];
234
+ let t9;
235
+ if ($[16] !== t) {
236
+ t9 = (t10) => {
237
+ const { matches: now } = t10;
238
+ return now ? t("blocks.yes") : t("blocks.no");
239
+ };
240
+ $[16] = t;
241
+ $[17] = t9;
242
+ } else t9 = $[17];
243
+ let t10;
244
+ if ($[18] !== t) {
245
+ t10 = t("blocks.matches");
246
+ $[18] = t;
247
+ $[19] = t10;
248
+ } else t10 = $[19];
249
+ let t11;
250
+ if ($[20] !== t10 || $[21] !== t9) {
251
+ t11 = {
252
+ cell: t9,
253
+ key: "matches",
254
+ label: t10
255
+ };
256
+ $[20] = t10;
257
+ $[21] = t9;
258
+ $[22] = t11;
259
+ } else t11 = $[22];
260
+ let t12;
261
+ if ($[23] !== t11 || $[24] !== t6 || $[25] !== t8) {
262
+ t12 = [
263
+ t6,
264
+ t8,
265
+ t11
266
+ ];
267
+ $[23] = t11;
268
+ $[24] = t6;
269
+ $[25] = t8;
270
+ $[26] = t12;
271
+ } else t12 = $[26];
272
+ let t13;
273
+ if ($[27] !== rows || $[28] !== t12 || $[29] !== t3 || $[30] !== t4) {
274
+ t13 = /* @__PURE__ */ jsx(Table.Simple, {
275
+ "aria-label": t3,
276
+ caption: t4,
277
+ columns: t12,
278
+ rows,
279
+ rowToKey: _temp4,
280
+ size: "sm"
281
+ });
282
+ $[27] = rows;
283
+ $[28] = t12;
284
+ $[29] = t3;
285
+ $[30] = t4;
286
+ $[31] = t13;
287
+ } else t13 = $[31];
288
+ return t13;
289
+ }
290
+ function _temp4(t0) {
291
+ const { condition: condition_1 } = t0;
292
+ return condition_1;
293
+ }
294
+ function _temp3(t0) {
295
+ const { query: query_1 } = t0;
296
+ return coded(query_1);
297
+ }
298
+ function _temp2(t0) {
299
+ const { condition: condition_0 } = t0;
300
+ return coded(condition_0);
301
+ }
302
+ function _temp(t0) {
303
+ const { query } = t0;
304
+ return query;
305
+ }
306
+ //#endregion
307
+ //#region src/pages/conditions.tsx
308
+ /**
309
+ * The page's sections, in reading order.
310
+ */
311
+ const SECTIONS = [
312
+ {
313
+ block: /* @__PURE__ */ jsx(ConditionTable, {}),
314
+ id: "conditions"
315
+ },
316
+ {
317
+ block: /* @__PURE__ */ jsx(MediaStates, {}),
318
+ id: "decided"
319
+ },
320
+ { id: "writing" }
321
+ ];
322
+ /**
323
+ * Renders the conditions page.
324
+ */
325
+ function ConditionsPage() {
326
+ const $ = c(1);
327
+ let t0;
328
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
329
+ t0 = /* @__PURE__ */ jsx(DocPage, {
330
+ page: "conditions",
331
+ sections: SECTIONS
332
+ });
333
+ $[0] = t0;
334
+ } else t0 = $[0];
335
+ return t0;
336
+ }
337
+ //#endregion
338
+ export { ConditionsPage };
@@ -0,0 +1,92 @@
1
+ import { n as variableOf } from "./variables-ymFs3Bzn.js";
2
+ import { n as useWords, t as DocPage } from "./doc-page-BQXdbP_h.js";
3
+ import { t as tokenRows } from "./rows-Dv8c7jye.js";
4
+ import { t as TokenTable } from "./token-table-yrZh5kLy.js";
5
+ import { t as sampler } from "./sampler-Ue67PX2n.js";
6
+ import { BORDER_WIDTHS, CORNERS, RADII, STROKES } from "@stealthscale/theme/contract";
7
+ import { c } from "react/compiler-runtime";
8
+ import { jsx } from "react/jsx-runtime";
9
+ //#region src/pages/corners.tsx
10
+ /**
11
+ * Renders a tile with a corner.
12
+ */
13
+ const TILE = sampler("tile", "radius");
14
+ /**
15
+ * Renders a line as thick as a stroke.
16
+ */
17
+ const LINE = sampler("line", "stroke");
18
+ /**
19
+ * Lists the page's tables of tokens, in reading order.
20
+ */
21
+ const TABLES = [
22
+ {
23
+ id: "corners",
24
+ rows: tokenRows("radii", CORNERS, TILE)
25
+ },
26
+ {
27
+ id: "radii",
28
+ rows: tokenRows("radii", RADII, TILE)
29
+ },
30
+ {
31
+ id: "strokes",
32
+ rows: tokenRows("borderWidths", STROKES, LINE)
33
+ },
34
+ {
35
+ id: "widths",
36
+ rows: tokenRows("borderWidths", BORDER_WIDTHS, LINE)
37
+ }
38
+ ];
39
+ /**
40
+ * Lists the two tokens of the focus ring: its width and the room it leaves round a control.
41
+ */
42
+ const RING = [{
43
+ name: "borderWidths.ring",
44
+ variable: variableOf("borderWidths", "ring")
45
+ }, {
46
+ name: "spacing.ring",
47
+ variable: variableOf("spacing", "ring")
48
+ }];
49
+ /**
50
+ * Renders the corners page.
51
+ */
52
+ function CornersPage() {
53
+ const $ = c(4);
54
+ const { t } = useWords();
55
+ let t0;
56
+ if ($[0] !== t) {
57
+ const t2 = TABLES.map((t1) => {
58
+ const { id, rows } = t1;
59
+ return {
60
+ block: /* @__PURE__ */ jsx(TokenTable, {
61
+ caption: t(`corners.sections.${id}.title`, { defaultValue: id }),
62
+ lengths: true,
63
+ rows
64
+ }),
65
+ id
66
+ };
67
+ });
68
+ const t3 = t("corners.sections.ring.title");
69
+ let t4;
70
+ if ($[2] !== t3) {
71
+ t4 = {
72
+ block: /* @__PURE__ */ jsx(TokenTable, {
73
+ caption: t3,
74
+ lengths: true,
75
+ rows: RING
76
+ }),
77
+ id: "ring"
78
+ };
79
+ $[2] = t3;
80
+ $[3] = t4;
81
+ } else t4 = $[3];
82
+ t0 = /* @__PURE__ */ jsx(DocPage, {
83
+ page: "corners",
84
+ sections: [...t2, t4]
85
+ });
86
+ $[0] = t;
87
+ $[1] = t0;
88
+ } else t0 = $[1];
89
+ return t0;
90
+ }
91
+ //#endregion
92
+ export { CornersPage };
@@ -0,0 +1,54 @@
1
+ import { n as useWords, t as DocPage } from "./doc-page-BQXdbP_h.js";
2
+ import { t as tokenRows } from "./rows-Dv8c7jye.js";
3
+ import { t as TokenTable } from "./token-table-yrZh5kLy.js";
4
+ import { t as sampler } from "./sampler-Ue67PX2n.js";
5
+ import { CURSORS } from "@stealthscale/theme/contract";
6
+ import { c } from "react/compiler-runtime";
7
+ import { jsx } from "react/jsx-runtime";
8
+ //#region src/pages/cursors.tsx
9
+ /**
10
+ * Lists the cursors, each on a tile that shows it.
11
+ */
12
+ const ROWS = tokenRows("cursor", CURSORS, sampler("tile", "cursor"));
13
+ /**
14
+ * Renders the cursors page.
15
+ */
16
+ function CursorsPage() {
17
+ const $ = c(7);
18
+ const { t } = useWords();
19
+ let t0;
20
+ if ($[0] !== t) {
21
+ t0 = t("cursors.sections.cursors.title");
22
+ $[0] = t;
23
+ $[1] = t0;
24
+ } else t0 = $[1];
25
+ let t1;
26
+ if ($[2] !== t0) {
27
+ t1 = {
28
+ block: /* @__PURE__ */ jsx(TokenTable, {
29
+ caption: t0,
30
+ rows: ROWS
31
+ }),
32
+ id: "cursors"
33
+ };
34
+ $[2] = t0;
35
+ $[3] = t1;
36
+ } else t1 = $[3];
37
+ let t2;
38
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
39
+ t2 = { id: "using" };
40
+ $[4] = t2;
41
+ } else t2 = $[4];
42
+ let t3;
43
+ if ($[5] !== t1) {
44
+ t3 = /* @__PURE__ */ jsx(DocPage, {
45
+ page: "cursors",
46
+ sections: [t1, t2]
47
+ });
48
+ $[5] = t1;
49
+ $[6] = t3;
50
+ } else t3 = $[6];
51
+ return t3;
52
+ }
53
+ //#endregion
54
+ export { CursorsPage };