strata-react 1.0.39 → 1.0.41

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 (44) hide show
  1. package/README.md +29 -5
  2. package/UPGRADING.md +11 -0
  3. package/bin/strata-stock-classes.js +5 -0
  4. package/dist/components/button.d.ts +3 -0
  5. package/dist/components/checkbox.d.ts +3 -2
  6. package/dist/components/compare-parts.d.ts +25 -0
  7. package/dist/components/compare-video.d.ts +4 -2
  8. package/dist/components/compare.d.ts +4 -2
  9. package/dist/components/secret-field.d.ts +34 -0
  10. package/dist/components/selection.d.ts +45 -1
  11. package/dist/components/toast.d.ts +3 -2
  12. package/dist/components/transcript-view.d.ts +18 -2
  13. package/dist/components/tree.d.ts +16 -6
  14. package/dist/components/value-controls.d.ts +20 -4
  15. package/dist/{query-CJ1pSPiC.js → errors-BunUBqpA.js} +5 -176
  16. package/dist/errors-BunUBqpA.js.map +1 -0
  17. package/dist/{field-7Z4N5r5g.js → field-DeKNvGox.js} +74 -5
  18. package/dist/field-DeKNvGox.js.map +1 -0
  19. package/dist/index.d.ts +4 -2
  20. package/dist/index.js +847 -332
  21. package/dist/index.js.map +1 -1
  22. package/dist/lib/choice.d.ts +29 -0
  23. package/dist/lib/transcript.d.ts +16 -0
  24. package/dist/map.js +2 -2
  25. package/dist/migrate/cli.d.ts +2 -0
  26. package/dist/migrate/stock-classes.d.ts +11 -0
  27. package/dist/migrate-cli.js +128 -0
  28. package/dist/migrate-cli.js.map +1 -0
  29. package/dist/panorama.js +2 -2
  30. package/dist/query-B934ufsW.js +209 -0
  31. package/dist/query-B934ufsW.js.map +1 -0
  32. package/dist/strata.css +6 -0
  33. package/dist/strata.migrate.css +224 -0
  34. package/dist/testing.js +2 -2
  35. package/dist/{theme-CFNi6WUO.js → theme-DVaIxyNn.js} +6 -75
  36. package/dist/theme-DVaIxyNn.js.map +1 -0
  37. package/dist/value-controls-FO4zQiHP.js +735 -0
  38. package/dist/value-controls-FO4zQiHP.js.map +1 -0
  39. package/package.json +7 -2
  40. package/dist/field-7Z4N5r5g.js.map +0 -1
  41. package/dist/query-CJ1pSPiC.js.map +0 -1
  42. package/dist/theme-CFNi6WUO.js.map +0 -1
  43. package/dist/value-controls-D6O9TsM6.js +0 -356
  44. package/dist/value-controls-D6O9TsM6.js.map +0 -1
@@ -0,0 +1,29 @@
1
+ /** What a chosen key brings with it: keys, or nothing. */
2
+ export type Implies = (key: string) => Iterable<string> | null | undefined;
3
+ /** The derived sets for one explicit choice. */
4
+ export type Resolved = {
5
+ /** Explicit and implied keys. */
6
+ all: Set<string>;
7
+ /** Keys some chosen key implies: cannot be cleared on their own. */
8
+ locked: Set<string>;
9
+ /** Implied keys that were not chosen themselves. */
10
+ dependents: Set<string>;
11
+ /** For each locked key, the chosen keys that bring it (directly or through others). */
12
+ because: Map<string, string[]>;
13
+ };
14
+ export declare function resolve(explicit: ReadonlySet<string>, implies?: Implies): Resolved;
15
+ /** What a change did, for the sentence that announces it. */
16
+ export type ChoiceChange = {
17
+ explicit: Set<string>;
18
+ added: number;
19
+ dropped: number;
20
+ refused: number;
21
+ };
22
+ /**
23
+ * Apply a surface's request for the set it wants shown chosen (`next`, what a tree or table gives
24
+ * back) to the explicit choice. A dependent (implied, not chosen) in `next` is not made explicit
25
+ * (it is already in), and one missing from `next` is put back, not cleared.
26
+ */
27
+ export declare function applyChange(explicit: ReadonlySet<string>, next: ReadonlySet<string>, implies?: Implies): ChoiceChange;
28
+ /** The sentence a screen reader hears for a change, or "" when nothing worth saying happened. */
29
+ export declare function noteFor({ added, dropped, refused }: Pick<ChoiceChange, "added" | "dropped" | "refused">): string;
@@ -3,6 +3,16 @@ export type TranscriptWord = {
3
3
  text: string;
4
4
  start: number;
5
5
  end: number;
6
+ /** How sure the recogniser was, 0 to 1. Below the view's `doubtfulBelow` (default 0.6) the word is doubtful. */
7
+ confidence?: number;
8
+ /** The recogniser's own verdict, when it gives one instead of a number. Wins over `confidence`. */
9
+ doubtful?: boolean;
10
+ };
11
+ /** A mark an app puts on a phrase ("Not sung", "Not a lyric"): a word, always, and the tone it is drawn in. */
12
+ export type TranscriptPhraseState = {
13
+ id: string;
14
+ label: string;
15
+ tone: "neutral" | "info" | "success" | "warning" | "danger";
6
16
  };
7
17
  /** A phrase: timed words, who said it, and its other texts (a translation) by mode. */
8
18
  export type TranscriptPhrase = {
@@ -13,7 +23,13 @@ export type TranscriptPhrase = {
13
23
  speaker?: string;
14
24
  /** Other texts for the phrase by mode name: `{ translated: "…" }`. */
15
25
  alt?: Readonly<Record<string, string>>;
26
+ /** The mark the person (or the app) put on it. */
27
+ state?: TranscriptPhraseState;
16
28
  };
29
+ /** Whether a word is doubtful: the recogniser said so, or its confidence is under `below`. */
30
+ export declare function isDoubtful(word: Pick<TranscriptWord, "confidence" | "doubtful">, below?: number): boolean;
31
+ /** Whether any word of a phrase is doubtful. */
32
+ export declare function phraseDoubtful(phrase: Pick<TranscriptPhrase, "words">, below?: number): boolean;
17
33
  /** Phrases that belong together (a clip), with a heading. */
18
34
  export type TranscriptGroup = {
19
35
  id: string;
package/dist/map.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as useColorScheme, c as Tooltip$1 } from "./theme-CFNi6WUO.js";
2
- import { c as cn } from "./field-7Z4N5r5g.js";
1
+ import { a as useColorScheme } from "./theme-DVaIxyNn.js";
2
+ import { c as Tooltip$1, u as cn } from "./field-DeKNvGox.js";
3
3
  import { i as format } from "./format-B32-PVi2.js";
4
4
  import { n as useSharedCursor, r as geo } from "./cursor-DDGBPiTJ.js";
5
5
  import * as React from "react";
@@ -0,0 +1,2 @@
1
+ /** Runs the command; the exit code. */
2
+ export declare function main(argv: string[], out?: (text: string) => void): Promise<number>;
@@ -0,0 +1,11 @@
1
+ /** What kind of stock class it is, named as the roles that replace it are. */
2
+ export type StockKind = "colour" | "text size" | "radius" | "shadow" | "font";
3
+ /** One stock class found at a line of a file. */
4
+ export type StockClass = {
5
+ line: number;
6
+ className: string;
7
+ kind: StockKind;
8
+ instead: string;
9
+ };
10
+ /** Stock classes in `source`, one entry per use. In a `.css` file only `@apply` lines are read. */
11
+ export declare function findStockClasses(source: string, file?: string): StockClass[];
@@ -0,0 +1,128 @@
1
+ import { readFileSync, readdirSync, statSync } from "node:fs";
2
+ import { join, relative } from "node:path";
3
+ import { parseArgs } from "node:util";
4
+ // src/migrate/stock-classes.ts
5
+ var rules = [
6
+ {
7
+ kind: "colour",
8
+ test: new RegExp(`^(?:bg|text|border(?:-[xytblrse])?|ring|ring-offset|fill|stroke|from|via|to|divide|outline|accent|caret|decoration|placeholder|shadow|inset-shadow|inset-ring|text-shadow)-(?:(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950)|white|black)(?:/\\d+)?$`),
9
+ instead: "a colour role: bg-primary, bg-muted, text-muted-foreground, border-border, bg-danger-subtle…"
10
+ },
11
+ {
12
+ kind: "text size",
13
+ test: /^text-(?:xs|sm|base|lg|xl|[2-9]xl)(?:\/[\w.[\]-]+)?$/,
14
+ instead: "a type step: type-caption, type-label, type-body-sm, type-body, type-heading, type-title"
15
+ },
16
+ {
17
+ kind: "radius",
18
+ test: /^rounded(?:-(?:t|r|b|l|s|e|tl|tr|br|bl|ss|se|ee|es))?-(?:xs|sm|md|lg|xl|2xl|3xl|4xl)$/,
19
+ instead: "a radius role: rounded-control, rounded-surface, rounded-overlay or rounded-pill"
20
+ },
21
+ {
22
+ kind: "shadow",
23
+ test: /^(?:inset-)?shadow-(?:2xs|xs|sm|md|lg|xl|2xl|inner)$/,
24
+ instead: "shadow-overlay for what floats, a border for what sits on the page"
25
+ },
26
+ {
27
+ kind: "font",
28
+ test: /^font-serif$/,
29
+ instead: "font-display, or a face your theme names"
30
+ }
31
+ ];
32
+ /** Stock classes in `source`, one entry per use. In a `.css` file only `@apply` lines are read. */
33
+ function findStockClasses(source, file = "") {
34
+ const css = /\.css$/.test(file);
35
+ const found = [];
36
+ let applying = false;
37
+ source.split("\n").forEach((text, i) => {
38
+ if (css) {
39
+ if (!applying && !text.includes("@apply")) return;
40
+ applying = !/[;}]/.test(text.slice(Math.max(0, text.indexOf("@apply"))));
41
+ }
42
+ for (const token of text.match(/[^\s"'`<>{}()=,;]+/g) ?? []) {
43
+ const className = token.slice(token.lastIndexOf(":") + 1).replace(/^!|!$/g, "");
44
+ const rule = rules.find((r) => r.test.test(className));
45
+ if (rule) found.push({
46
+ line: i + 1,
47
+ className: token.replace(/^!/, ""),
48
+ kind: rule.kind,
49
+ instead: rule.instead
50
+ });
51
+ }
52
+ });
53
+ return found;
54
+ }
55
+ // src/migrate/cli.ts
56
+ var usage = `Usage: strata-stock-classes [options] [folder or file ...]
57
+
58
+ Lists the stock Tailwind classes (colours such as bg-stone-100, text-sm, rounded-xl, shadow-lg, font-serif)
59
+ that strata.css would stop compiling, so an app on strata.migrate.css knows what is left to convert. Reads
60
+ .ts .tsx .js .jsx .mjs .html .mdx .vue .svelte files, and the @apply lines of .css files. Default: ./src.
61
+
62
+ --fail exit 1 when any are found (for a CI step that holds the line while migrating)
63
+ --help show this
64
+ `;
65
+ var readable = /\.(?:[cm]?[jt]sx?|html|mdx|vue|svelte|css)$/;
66
+ var skipped = /* @__PURE__ */ new Set([
67
+ "node_modules",
68
+ "dist",
69
+ ".git",
70
+ "storybook-static",
71
+ "coverage"
72
+ ]);
73
+ function* walk(path) {
74
+ if (statSync(path).isFile()) {
75
+ if (readable.test(path)) yield path;
76
+ return;
77
+ }
78
+ for (const name of readdirSync(path).sort()) if (!skipped.has(name)) yield* walk(join(path, name));
79
+ }
80
+ /** Runs the command; the exit code. */
81
+ async function main(argv, out = (t) => console.log(t)) {
82
+ const { values, positionals } = parseArgs({
83
+ args: argv,
84
+ options: {
85
+ fail: { type: "boolean" },
86
+ help: { type: "boolean" }
87
+ },
88
+ allowPositionals: true
89
+ });
90
+ if (values.help) {
91
+ out(usage);
92
+ return 0;
93
+ }
94
+ const roots = positionals.length ? positionals : ["src"];
95
+ const all = [];
96
+ for (const root of roots) {
97
+ try {
98
+ statSync(root);
99
+ } catch {
100
+ out(`strata-stock-classes: ${root} does not exist`);
101
+ return 2;
102
+ }
103
+ for (const file of walk(root)) {
104
+ const found = findStockClasses(readFileSync(file, "utf8"), file);
105
+ if (found.length) all.push({
106
+ file: relative(process.cwd(), file),
107
+ found
108
+ });
109
+ }
110
+ }
111
+ const total = all.reduce((n, f) => n + f.found.length, 0);
112
+ if (!total) {
113
+ out("No stock Tailwind classes left. Switch the import to strata-react/strata.css.");
114
+ return 0;
115
+ }
116
+ const byKind = /* @__PURE__ */ new Map();
117
+ for (const { file, found } of all) for (const f of found) {
118
+ out(`${file}:${f.line} ${f.className} (${f.kind})`);
119
+ byKind.set(f.kind, (byKind.get(f.kind) ?? 0) + 1);
120
+ }
121
+ out("");
122
+ out(`${total} stock classes in ${all.length} files: ${[...byKind].map(([k, n]) => `${n} ${k}`).join(", ")}.`);
123
+ for (const rule of new Set(all.flatMap((f) => f.found.map((x) => `${x.kind}: ${x.instead}`)))) out(` ${rule}`);
124
+ return values.fail ? 1 : 0;
125
+ }
126
+ export { main };
127
+
128
+ //# sourceMappingURL=migrate-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-cli.js","names":[],"sources":["../src/migrate/stock-classes.ts","../src/migrate/cli.ts"],"sourcesContent":["// Finds the stock Tailwind classes an app still uses, for an app moving onto Strata one screen at a time (issue #225).\n// `strata.css` clears Tailwind's colour, type-size, radius, shadow and font namespaces, so `bg-stone-100`, `text-sm`,\n// `rounded-xl` and `shadow-lg` stop compiling the moment it is imported. `strata.migrate.css` keeps them, and this lists\n// what is left to convert so the app knows when `strata.css` is one import away. It reads class names as text (no Tailwind\n// build, no dependency), so it is a list to work from, not a proof: a class built from parts (\"bg-\" + tone) is invisible\n// to it and to Tailwind's own scanner alike, and a word that only looks like a class in a string can be listed.\n\n/** What kind of stock class it is, named as the roles that replace it are. */\nexport type StockKind = \"colour\" | \"text size\" | \"radius\" | \"shadow\" | \"font\";\n\n/** One stock class found at a line of a file. */\nexport type StockClass = { line: number; className: string; kind: StockKind; instead: string };\n\nconst COLOURS = \"slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose\";\nconst COLOUR_UTILITIES = \"bg|text|border(?:-[xytblrse])?|ring|ring-offset|fill|stroke|from|via|to|divide|outline|accent|caret|decoration|placeholder|shadow|inset-shadow|inset-ring|text-shadow\";\nconst colour = new RegExp(`^(?:${COLOUR_UTILITIES})-(?:(?:${COLOURS})-(?:50|100|200|300|400|500|600|700|800|900|950)|white|black)(?:/\\\\d+)?$`);\nconst textSize = /^text-(?:xs|sm|base|lg|xl|[2-9]xl)(?:\\/[\\w.[\\]-]+)?$/;\nconst radius = /^rounded(?:-(?:t|r|b|l|s|e|tl|tr|br|bl|ss|se|ee|es))?-(?:xs|sm|md|lg|xl|2xl|3xl|4xl)$/;\nconst shadow = /^(?:inset-)?shadow-(?:2xs|xs|sm|md|lg|xl|2xl|inner)$/;\nconst font = /^font-serif$/;\n\nconst rules: { kind: StockKind; test: RegExp; instead: string }[] = [\n { kind: \"colour\", test: colour, instead: \"a colour role: bg-primary, bg-muted, text-muted-foreground, border-border, bg-danger-subtle…\" },\n { kind: \"text size\", test: textSize, instead: \"a type step: type-caption, type-label, type-body-sm, type-body, type-heading, type-title\" },\n { kind: \"radius\", test: radius, instead: \"a radius role: rounded-control, rounded-surface, rounded-overlay or rounded-pill\" },\n { kind: \"shadow\", test: shadow, instead: \"shadow-overlay for what floats, a border for what sits on the page\" },\n { kind: \"font\", test: font, instead: \"font-display, or a face your theme names\" },\n];\n\n/** Stock classes in `source`, one entry per use. In a `.css` file only `@apply` lines are read. */\nexport function findStockClasses(source: string, file = \"\"): StockClass[] {\n const css = /\\.css$/.test(file);\n const found: StockClass[] = [];\n // In a stylesheet an `@apply` runs to its `;` (or the closing brace), however many lines it is written over.\n let applying = false;\n source.split(\"\\n\").forEach((text, i) => {\n if (css) {\n if (!applying && !text.includes(\"@apply\")) return;\n applying = !/[;}]/.test(text.slice(Math.max(0, text.indexOf(\"@apply\"))));\n }\n for (const token of text.match(/[^\\s\"'`<>{}()=,;]+/g) ?? []) {\n // The utility is what follows the last variant (`dark:hover:bg-stone-100`), without an important mark.\n const className = token.slice(token.lastIndexOf(\":\") + 1).replace(/^!|!$/g, \"\");\n const rule = rules.find((r) => r.test.test(className));\n if (rule) found.push({ line: i + 1, className: token.replace(/^!/, \"\"), kind: rule.kind, instead: rule.instead });\n }\n });\n return found;\n}\n","// The strata-stock-classes command: lists the stock Tailwind classes still in an app's source (see stock-classes.ts).\nimport { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findStockClasses, type StockClass } from \"./stock-classes\";\n\nconst usage = `Usage: strata-stock-classes [options] [folder or file ...]\n\nLists the stock Tailwind classes (colours such as bg-stone-100, text-sm, rounded-xl, shadow-lg, font-serif)\nthat strata.css would stop compiling, so an app on strata.migrate.css knows what is left to convert. Reads\n.ts .tsx .js .jsx .mjs .html .mdx .vue .svelte files, and the @apply lines of .css files. Default: ./src.\n\n --fail exit 1 when any are found (for a CI step that holds the line while migrating)\n --help show this\n`;\n\nconst readable = /\\.(?:[cm]?[jt]sx?|html|mdx|vue|svelte|css)$/;\nconst skipped = new Set([\"node_modules\", \"dist\", \".git\", \"storybook-static\", \"coverage\"]);\n\nfunction* walk(path: string): Generator<string> {\n if (statSync(path).isFile()) {\n if (readable.test(path)) yield path;\n return;\n }\n for (const name of readdirSync(path).sort()) if (!skipped.has(name)) yield* walk(join(path, name));\n}\n\n/** Runs the command; the exit code. */\nexport async function main(argv: string[], out: (text: string) => void = (t) => console.log(t)): Promise<number> {\n const { values, positionals } = parseArgs({ args: argv, options: { fail: { type: \"boolean\" }, help: { type: \"boolean\" } }, allowPositionals: true });\n if (values.help) {\n out(usage);\n return 0;\n }\n const roots = positionals.length ? positionals : [\"src\"];\n const all: { file: string; found: StockClass[] }[] = [];\n for (const root of roots) {\n try {\n statSync(root);\n } catch {\n out(`strata-stock-classes: ${root} does not exist`);\n return 2;\n }\n for (const file of walk(root)) {\n const found = findStockClasses(readFileSync(file, \"utf8\"), file);\n if (found.length) all.push({ file: relative(process.cwd(), file), found });\n }\n }\n const total = all.reduce((n, f) => n + f.found.length, 0);\n if (!total) {\n out(\"No stock Tailwind classes left. Switch the import to strata-react/strata.css.\");\n return 0;\n }\n const byKind = new Map<string, number>();\n for (const { file, found } of all) {\n for (const f of found) {\n out(`${file}:${f.line} ${f.className} (${f.kind})`);\n byKind.set(f.kind, (byKind.get(f.kind) ?? 0) + 1);\n }\n }\n out(\"\");\n out(`${total} stock classes in ${all.length} files: ${[...byKind].map(([k, n]) => `${n} ${k}`).join(\", \")}.`);\n for (const rule of new Set(all.flatMap((f) => f.found.map((x) => `${x.kind}: ${x.instead}`)))) out(` ${rule}`);\n return values.fail ? 1 : 0;\n}\n"],"mappings":";;;;AAqBA,IAAM,QAA8D;CAClE;EAAE,MAAM;EAAU,MAAM,IAPP,OAAO,6XAOA;EAAQ,SAAS;CAA+F;CACxI;EAAE,MAAM;EAAa,MAAM;EAAU,SAAS;CAA2F;CACzI;EAAE,MAAM;EAAU,MAAM;EAAQ,SAAS;CAAmF;CAC5H;EAAE,MAAM;EAAU,MAAM;EAAQ,SAAS;CAAqE;CAC9G;EAAE,MAAM;EAAQ,MAAM;EAAM,SAAS;CAA2C;AAClF;;AAGA,SAAgB,iBAAiB,QAAgB,OAAO,IAAkB;CACxE,MAAM,MAAM,SAAS,KAAK,IAAI;CAC9B,MAAM,QAAsB,CAAC;CAE7B,IAAI,WAAW;CACf,OAAO,MAAM,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM;EACtC,IAAI,KAAK;GACP,IAAI,CAAC,YAAY,CAAC,KAAK,SAAS,QAAQ,GA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N5r5g.js";
1
+ import { d as useInView, r as Slider } from "./value-controls-FO4zQiHP.js";
2
+ import { u as cn } from "./field-DeKNvGox.js";
3
3
  import * as React from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { VisuallyHidden } from "react-aria";
@@ -0,0 +1,209 @@
1
+ import { u as cn } from "./field-DeKNvGox.js";
2
+ import { a as readErrorBody, o as Button$1, r as describeHttpError, t as HttpError } from "./errors-BunUBqpA.js";
3
+ import * as React from "react";
4
+ import { Button, Text, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion } from "react-aria-components";
5
+ import { CircleCheck, Info, TriangleAlert, X } from "lucide-react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
8
+ // src/lib/overlay.ts
9
+ var overlaySurface = "rounded-overlay border border-border bg-popover text-popover-foreground shadow-overlay enter-overlay";
10
+ // src/components/toast.tsx
11
+ var queue = new UNSTABLE_ToastQueue({ maxVisibleToasts: 3 });
12
+ /** Milliseconds a toast stays: 5 s plus 40 ms a character, to at most 15 s, and at least 8 s with an action. */
13
+ function toastTimeout(content) {
14
+ if (content.timeout !== void 0) return content.timeout;
15
+ const chars = content.title.length + (content.description?.length ?? 0) + (content.action?.label.length ?? 0);
16
+ return Math.max(content.action ? 8e3 : 0, Math.min(15e3, 5e3 + 40 * chars));
17
+ }
18
+ /** The toast queue: `toast.show({ title })` from anywhere; `toast.close(key)`; `toast.clear()`. */
19
+ var toast = {
20
+ /** Shows a toast and returns its key. */
21
+ show(content) {
22
+ return queue.add(content, { timeout: toastTimeout(content) });
23
+ },
24
+ close(key) {
25
+ queue.close(key);
26
+ },
27
+ clear() {
28
+ queue.clear();
29
+ }
30
+ };
31
+ var marks = {
32
+ info: {
33
+ icon: Info,
34
+ color: "text-info"
35
+ },
36
+ success: {
37
+ icon: CircleCheck,
38
+ color: "text-success"
39
+ },
40
+ warning: {
41
+ icon: TriangleAlert,
42
+ color: "text-warning"
43
+ }
44
+ };
45
+ var mounted = [];
46
+ var watchers = /* @__PURE__ */ new Set();
47
+ var changed = () => watchers.forEach((w) => w());
48
+ var watch = (w) => {
49
+ watchers.add(w);
50
+ return () => void watchers.delete(w);
51
+ };
52
+ /** True while this region is the one that draws. The server and the first client render say yes, so hydration matches. */
53
+ function useOwnsQueue() {
54
+ const id = React.useId();
55
+ React.useLayoutEffect(() => {
56
+ mounted.push(id);
57
+ changed();
58
+ return () => {
59
+ mounted.splice(mounted.indexOf(id), 1);
60
+ changed();
61
+ };
62
+ }, [id]);
63
+ const owns = React.useSyncExternalStore(watch, () => mounted[0] === id, () => true);
64
+ const [warned, setWarned] = React.useState(false);
65
+ React.useEffect(() => {
66
+ if (owns || warned || mounted.indexOf(id) < 1) return;
67
+ setWarned(true);
68
+ }, [
69
+ owns,
70
+ warned,
71
+ id
72
+ ]);
73
+ return owns;
74
+ }
75
+ /** The one place toasts appear. Render it once at the app root; a second one mounted at the same time draws nothing and warns in development. A labelled landmark (F6), polite, above panes and the undo bar. */
76
+ function StrataToastRegion({ label = "Notifications", className }) {
77
+ if (!useOwnsQueue()) return null;
78
+ return /* @__PURE__ */ jsx(UNSTABLE_ToastRegion, {
79
+ queue,
80
+ "aria-label": label,
81
+ className: cn("layer-bar fixed inset-x-4 top-4 grid justify-items-end gap-2 outline-none sm:inset-x-auto sm:top-auto sm:right-4 sm:bottom-4", className),
82
+ children: ({ toast: t }) => /* @__PURE__ */ jsxs(UNSTABLE_Toast, {
83
+ toast: t,
84
+ className: cn("flex w-full max-w-sm items-start gap-3 p-3 outline-none focus-visible:outline-2 focus-visible:outline-ring", overlaySurface),
85
+ children: [
86
+ (() => {
87
+ const { icon: Icon, color } = marks[t.content.tone ?? "info"];
88
+ return /* @__PURE__ */ jsx(Icon, {
89
+ "aria-hidden": true,
90
+ className: cn("mt-0.5 size-4 shrink-0", color)
91
+ });
92
+ })(),
93
+ /* @__PURE__ */ jsxs(UNSTABLE_ToastContent, {
94
+ className: "grid min-w-0 flex-1 gap-0.5",
95
+ children: [/* @__PURE__ */ jsx(Text, {
96
+ slot: "title",
97
+ className: "type-label",
98
+ children: t.content.title
99
+ }), t.content.description && /* @__PURE__ */ jsx(Text, {
100
+ slot: "description",
101
+ className: "type-body-sm text-muted-foreground",
102
+ children: t.content.description
103
+ })]
104
+ }),
105
+ t.content.action && /* @__PURE__ */ jsx(Button$1, {
106
+ size: "sm",
107
+ onPress: () => {
108
+ t.content.action?.onPress();
109
+ queue.close(t.key);
110
+ },
111
+ children: t.content.action.label
112
+ }),
113
+ /* @__PURE__ */ jsx(Button, {
114
+ slot: "close",
115
+ "aria-label": "Dismiss",
116
+ className: "grid size-6 shrink-0 cursor-pointer place-items-center rounded-control text-muted-foreground transition-state hover:bg-muted hover:text-foreground",
117
+ children: /* @__PURE__ */ jsx(X, {
118
+ "aria-hidden": true,
119
+ className: "size-4"
120
+ })
121
+ })
122
+ ]
123
+ })
124
+ });
125
+ }
126
+ // src/query/index.tsx
127
+ /** A QueryClient with Strata's defaults: one retry, 30 s stale time, no refetch on window focus. */
128
+ function createQueryClient(overrides) {
129
+ return new QueryClient({
130
+ ...overrides,
131
+ defaultOptions: {
132
+ ...overrides?.defaultOptions,
133
+ queries: {
134
+ retry: 1,
135
+ staleTime: 3e4,
136
+ refetchOnWindowFocus: false,
137
+ ...overrides?.defaultOptions?.queries
138
+ }
139
+ }
140
+ });
141
+ }
142
+ /** Provides a query client (Strata's defaults unless one is passed) to the app. */
143
+ function StrataQueryProvider({ client, children }) {
144
+ const [fallback] = React.useState(() => client ?? createQueryClient());
145
+ return /* @__PURE__ */ jsx(QueryClientProvider, {
146
+ client: client ?? fallback,
147
+ children
148
+ });
149
+ }
150
+ /**
151
+ * Turns a TanStack query result into the `Load<T>` that `DataView` takes; errors are described for a person by `describe`.
152
+ * A refetch that fails after data arrived stays `ready`, with `stale` saying why and when the data was read.
153
+ */
154
+ function toLoad(query, describe = describeHttpError) {
155
+ if (query.status === "success") return {
156
+ status: "ready",
157
+ data: query.data
158
+ };
159
+ if (query.status === "error" && query.data !== void 0) return {
160
+ status: "ready",
161
+ data: query.data,
162
+ stale: staleOf(query, describe)
163
+ };
164
+ if (query.status === "error") return {
165
+ status: "error",
166
+ message: describe(query.error),
167
+ retry: () => void query.refetch()
168
+ };
169
+ return { status: "loading" };
170
+ }
171
+ /** The `Stale` of a query whose refetch failed after a good read. Shared by `toLoad` and `useInfiniteLoad`. */
172
+ function staleOf(query, describe = describeHttpError) {
173
+ return {
174
+ message: describe(query.error),
175
+ readAt: new Date(query.dataUpdatedAt),
176
+ retry: () => void query.refetch(),
177
+ retrying: query.isFetching
178
+ };
179
+ }
180
+ /** `useQuery`, returned as a `Load<T>` for `DataView`. */
181
+ function useLoad(options) {
182
+ const { describeError, ...rest } = options;
183
+ return toLoad(useQuery(rest), describeError);
184
+ }
185
+ /**
186
+ * fetch() that throws an HttpError on a non-2xx response and parses JSON: the queryFn default, and the usual commit for a write.
187
+ * A 204 or empty body resolves to undefined. An error response's body is read onto the HttpError (`body`, `reason`, `fieldErrors`).
188
+ */
189
+ async function fetchJson(input, init, { readError = readErrorBody } = {}) {
190
+ const headers = new Headers(init?.headers);
191
+ if (!headers.has("Accept")) headers.set("Accept", "application/json");
192
+ const res = await fetch(input, {
193
+ ...init,
194
+ headers
195
+ });
196
+ if (!res.ok) {
197
+ const raw = await res.text().catch(() => "");
198
+ let body = raw || void 0;
199
+ try {
200
+ if (raw) body = JSON.parse(raw);
201
+ } catch {}
202
+ throw new HttpError(res.status, res.statusText, String(input), body, readError(body));
203
+ }
204
+ const text = res.status === 204 ? "" : await res.text();
205
+ return text ? JSON.parse(text) : void 0;
206
+ }
207
+ export { toLoad as a, toast as c, staleOf as i, toastTimeout as l, createQueryClient as n, useLoad as o, fetchJson as r, StrataToastRegion as s, StrataQueryProvider as t, overlaySurface as u };
208
+
209
+ //# sourceMappingURL=query-B934ufsW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-B934ufsW.js","names":["ToastQueue","ToastRegion","AriaToast","ToastContent","Button","AriaButton"],"sources":["../src/lib/overlay.ts","../src/components/toast.tsx","../src/query/index.tsx"],"sourcesContent":["// The look every floating surface shares (Dialog, Popover, and later Menu and Toast): the popover\n// role pair, an overlay radius, one hairline and the one shadow that exists for what floats\n// (components.md §3.11). One string, so a menu and a popover cannot drift apart.\nexport const overlaySurface =\n \"rounded-overlay border border-border bg-popover text-popover-foreground shadow-overlay enter-overlay\";\n","import * as React from \"react\";\nimport { UNSTABLE_Toast as AriaToast, UNSTABLE_ToastContent as ToastContent, UNSTABLE_ToastQueue as ToastQueue, UNSTABLE_ToastRegion as ToastRegion, Button as AriaButton, Text } from \"react-aria-components\";\nimport { CircleCheck, Info, TriangleAlert, X } from \"lucide-react\";\nimport { Button } from \"./button\";\nimport { cn } from \"../lib/utils\";\nimport { overlaySurface } from \"../lib/overlay\";\n\n// A toast confirms background work that finished (\"Export finished\", \"3 pieces synced\"). It is a\n// polite live region; it never carries an error a person must act on, which goes inline as an\n// `Alert` with its recovery (components.md §3.13, patterns.md §7), so there is no danger tone:\n// the type refuses it. `warning` is for a fact worth a glance (\"Kiln 2 is 40 min behind\").\n//\n// Rules the component owns so an app does not have to:\n// - One region, once, at the app root (`ToastRegion`), on the `layer-bar` layer: bottom end of the\n// window on a wide screen, the top on a phone, so it does not sit on the undo bar or cover the\n// focused control. It is a labelled landmark the keyboard reaches with F6 (React Aria).\n// - It stays long enough to read: 5 s plus 40 ms a character, up to 15 s, at least 8 s with an\n// action. The timer pauses while the pointer or focus is on it. There is always a dismiss control.\n// - At most one action, a button (\"Open file\"); content is words, not a form.\n// - Announcements are React Aria's: the toast's text is read when it appears and not again.\n// - The queue is module-level, so `toast.show()` works from a mutation's `onSuccess` outside any\n// component; `toast.clear()` empties it for a test. React Aria marks its toast API unstable; it\n// is used only here, behind this small surface, so a change upstream stays in this file.\n// - One region at a time, enforced (issue #230): the first mounted owns the queue and a second one draws nothing and\n// says so in development, naming the fix. Two regions on one queue show every toast twice, which looks like a bug in\n// the toast and (in a test) fails `findByText` with \"Found multiple elements\"; the usual cause is a route tree that\n// draws the region in its root layout while a test helper draws one too (`renderRoutes(..., { toasts: false })`),\n// or an app with a region in a layout and another in a page. Ownership is held by a mounted-order list, not by the\n// queue, so unmounting the owner hands it to the next region.\n// Toasts are rare and brief, so they get the overlay entrance and nothing else (character.md §3).\n\n/** What a toast says. */\nexport type ToastContentProps = {\n /** What finished, past tense, in the product's words: \"Export finished\". */\n title: string;\n /** One more sentence: what and where (\"run.mp4, 2:31 at 1080p, in your Downloads folder.\"). */\n description?: string;\n /** `info` by default. There is no danger tone: an error the person must act on is an `Alert`. */\n tone?: \"info\" | \"success\" | \"warning\";\n /** One action beside the words. */\n action?: { label: string; onPress: () => void };\n /** Milliseconds before it goes. Defaults to enough to read the words. */\n timeout?: number;\n};\n\nconst queue = new ToastQueue<ToastContentProps>({ maxVisibleToasts: 3 });\n\n/** Milliseconds a toast stays: 5 s plus 40 ms a character, to at most 15 s, and at least 8 s with an action. */\nexport function toastTimeout(content: Pick<ToastContentProps, \"title\" | \"description\" | \"action\" | \"timeout\">): number {\n if (content.timeout !== undefined) return content.timeout;\n const chars = content.title.length + (content.description?.length ?? 0) + (content.action?.label.length ?? 0);\n return Math.max(content.action ? 8000 : 0, Math.min(15000, 5000 + 40 * chars));\n}\n\n/** The toast queue: `toast.show({ title })` from anywhere; `toast.close(key)`; `toast.clear()`. */\nexport const toast = {\n /** Shows a toast and returns its key. */\n show(content: ToastContentProps): string {\n return queue.add(content, { timeout: toastTimeout(content) });\n },\n close(key: string) {\n queue.close(key);\n },\n clear() {\n queue.clear();\n },\n};\n\nconst marks = { info: { icon: Info, color: \"text-info\" }, success: { icon: CircleCheck, color: \"text-success\" }, warning: { icon: TriangleAlert, color: \"text-warning\" } } as const;\n\n/** Props for `ToastRegion`. */\nexport type StrataToastRegionProps = {\n /** Names the landmark. Default \"Notifications\". */\n label?: string;\n className?: string;\n};\n\n// The regions mounted now, oldest first: the first draws, the rest stay empty.\nconst mounted: string[] = [];\nconst watchers = new Set<() => void>();\nconst changed = () => watchers.forEach((w) => w());\nconst watch = (w: () => void) => {\n watchers.add(w);\n return () => void watchers.delete(w);\n};\n\n/** True while this region is the one that draws. The server and the first client render say yes, so hydration matches. */\nfunction useOwnsQueue(): boolean {\n const id = React.useId();\n React.useLayoutEffect(() => {\n mounted.push(id);\n changed();\n return () => {\n mounted.splice(mounted.indexOf(id), 1);\n changed();\n };\n }, [id]);\n const owns = React.useSyncExternalStore(watch, () => mounted[0] === id, () => true);\n const [warned, setWarned] = React.useState(false);\n React.useEffect(() => {\n if (owns || warned || mounted.indexOf(id) < 1) return;\n setWarned(true);\n if (import.meta.env?.DEV) {\n console.warn(\"strata-react: a StrataToastRegion is already mounted, so this one draws nothing. Render it once at the app root; in a test of a route tree that draws its own, pass `toasts: false` to renderRoutes.\");\n }\n }, [owns, warned, id]);\n return owns;\n}\n\n/** The one place toasts appear. Render it once at the app root; a second one mounted at the same time draws nothing and warns in development. A labelled landmark (F6), polite, above panes and the undo bar. */\nexport function StrataToastRegion({ label = \"Notifications\", className }: StrataToastRegionProps) {\n const owns = useOwnsQueue();\n if (!owns) return null;\n return (\n <ToastRegion\n queue={queue}\n aria-label={label}\n className={cn(\"layer-bar fixed inset-x-4 top-4 grid justify-items-end gap-2 outline-none sm:inset-x-auto sm:top-auto sm:right-4 sm:bottom-4\", className)}\n >\n {({ toast: t }) => (\n <AriaToast\n toast={t}\n className={cn(\"flex w-full max-w-sm items-start gap-3 p-3 outline-none focus-visible:outline-2 focus-visible:outline-ring\", overlaySurface)}\n >\n {(() => {\n const { icon: Icon, color } = marks[t.content.tone ?? \"info\"];\n return <Icon aria-hidden className={cn(\"mt-0.5 size-4 shrink-0\", color)} />;\n })()}\n <ToastContent className=\"grid min-w-0 flex-1 gap-0.5\">\n <Text slot=\"title\" className=\"type-label\">\n {t.content.title}\n </Text>\n {t.content.description && <Text slot=\"description\" className=\"type-body-sm text-muted-foreground\">{t.content.description}</Text>}\n </ToastContent>\n {t.content.action && (\n <Button size=\"sm\" onPress={() => { t.content.action?.onPress(); queue.close(t.key); }}>\n {t.content.action.label}\n </Button>\n )}\n <AriaButton slot=\"close\" aria-label=\"Dismiss\" className=\"grid size-6 shrink-0 cursor-pointer place-items-center rounded-control text-muted-foreground transition-state hover:bg-muted hover:text-foreground\">\n <X aria-hidden className=\"size-4\" />\n </AriaButton>\n </AriaToast>\n )}\n </ToastRegion>\n );\n}\n","import * as React from \"react\";\nimport {\n QueryClient,\n QueryClientProvider,\n useQuery,\n type QueryKey,\n type UseQueryOptions,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\nimport type { Load, Stale } from \"../components/data-view\";\nimport { HttpError, describeHttpError, readErrorBody, type DescribeError, type ErrorBody } from \"../lib/errors\";\n\nexport { HttpError, describeHttpError, readErrorBody, type DescribeError, type ErrorBody };\n\n// Data loading, the Strata way: TanStack Query fetches and caches, and every view of the result\n// goes through DataView, which takes a Load<T>. `toLoad` is the one bridge between them, so a\n// screen never re-derives loading/error/ready from a query's flags and never forgets one.\n//\n// Opinions in createQueryClient: one retry (a second failure is real and the person should see\n// it with a \"Try again\"), 30 s stale time (dashboards are read many times a minute but change\n// over minutes), and no refetch on window focus (a table that reorders itself while someone reads\n// it is worse than one that is 30 s old). Override per query when the data says otherwise.\n\n/** A QueryClient with Strata's defaults: one retry, 30 s stale time, no refetch on window focus. */\nexport function createQueryClient(overrides?: ConstructorParameters<typeof QueryClient>[0]) {\n return new QueryClient({\n ...overrides,\n defaultOptions: {\n ...overrides?.defaultOptions,\n queries: { retry: 1, staleTime: 30_000, refetchOnWindowFocus: false, ...overrides?.defaultOptions?.queries },\n },\n });\n}\n\n/** Provides a query client (Strata's defaults unless one is passed) to the app. */\nexport function StrataQueryProvider({ client, children }: { client?: QueryClient; children: React.ReactNode }) {\n const [fallback] = React.useState(() => client ?? createQueryClient());\n return <QueryClientProvider client={client ?? fallback}>{children}</QueryClientProvider>;\n}\n\n/**\n * Turns a TanStack query result into the `Load<T>` that `DataView` takes; errors are described for a person by `describe`.\n * A refetch that fails after data arrived stays `ready`, with `stale` saying why and when the data was read.\n */\nexport function toLoad<T>(query: UseQueryResult<T>, describe: DescribeError = describeHttpError): Load<T> {\n if (query.status === \"success\") return { status: \"ready\", data: query.data };\n // TanStack keeps the last good data when a refetch fails and sets status \"error\" (isRefetchError).\n // That is old data, not no data: keep it on screen and say how old it is.\n if (query.status === \"error\" && query.data !== undefined) return { status: \"ready\", data: query.data, stale: staleOf(query, describe) };\n if (query.status === \"error\") return { status: \"error\", message: describe(query.error), retry: () => void query.refetch() };\n return { status: \"loading\" };\n}\n\n/** The `Stale` of a query whose refetch failed after a good read. Shared by `toLoad` and `useInfiniteLoad`. */\nexport function staleOf(\n query: { error: unknown; dataUpdatedAt: number; isFetching: boolean; refetch: () => unknown },\n describe: DescribeError = describeHttpError,\n): Stale {\n return { message: describe(query.error), readAt: new Date(query.dataUpdatedAt), retry: () => void query.refetch(), retrying: query.isFetching };\n}\n\n/** `useQuery`, returned as a `Load<T>` for `DataView`. */\nexport function useLoad<T, K extends QueryKey = QueryKey>(\n options: UseQueryOptions<T, Error, T, K> & { describeError?: DescribeError },\n): Load<T> {\n const { describeError, ...rest } = options;\n return toLoad(useQuery(rest), describeError);\n}\n\n/** Options for `fetchJson` beyond `fetch`'s own. */\nexport type FetchJsonOptions = {\n /** Finds the server's reason and per-field messages in an error body. Default `readErrorBody` (FastAPI's `detail`, `message`, `error`). */\n readError?: (body: unknown) => ErrorBody;\n};\n\n/**\n * fetch() that throws an HttpError on a non-2xx response and parses JSON: the queryFn default, and the usual commit for a write.\n * A 204 or empty body resolves to undefined. An error response's body is read onto the HttpError (`body`, `reason`, `fieldErrors`).\n */\nexport async function fetchJson<T>(input: string | URL, init?: RequestInit, { readError = readErrorBody }: FetchJsonOptions = {}): Promise<T> {\n // Headers, tuple arrays and plain objects are all valid HeadersInit; normalise before adding the\n // default so a caller's Authorization (or their own Accept) is never dropped.\n const headers = new Headers(init?.headers);\n if (!headers.has(\"Accept\")) headers.set(\"Accept\", \"application/json\");\n const res = await fetch(input, { ...init, headers });\n if (!res.ok) {\n // The body is read as text and parsed only when it parses: a proxy's HTML 502 page or an empty\n // body must still throw the HttpError, never a JSON SyntaxError in its place.\n const raw = await res.text().catch(() => \"\");\n let body: unknown = raw || undefined;\n try {\n if (raw) body = JSON.parse(raw);\n } catch {\n // Not JSON: keep the text.\n }\n throw new HttpError(res.status, res.statusText, String(input), body, readError(body));\n }\n // Writes (DELETE, a PUT that returns nothing) answer 204 or an empty body; that is success, not a\n // JSON parse error.\n const text = res.status === 204 ? \"\" : await res.text();\n return (text ? JSON.parse(text) : undefined) as T;\n}\n\nexport { useInfiniteLoad, type InfiniteLoad, type InfiniteLoadOptions, type More } from \"./infinite\";\nexport { useJob, type Job, type JobOptions } from \"./job\";\n"],"mappings":";;;;;;;;AAGA,IAAa,iBACX;;ACyCF,IAAM,QAAQ,IAAIA,oBAA8B,EAAE,kBAAkB,EAAE,CAAC;;AAGvE,SAAgB,aAAa,SAA0F;CACrH,IAAI,QAAQ,YAAY,KAAA,GAAW,OAAO,QAAQ;CAClD,MAAM,QAAQ,QAAQ,MAAM,UAAU,QAAQ,aAAa,UAAU,MAAM,QAAQ,QAAQ,MAAM,UAAU;CAC3G,OAAO,KAAK,IAAI,QAAQ,SAAS,MAAO,GAAG,KAAK,IAAI,MAAO,MAAO,KAAK,KAAK,CAAC;AAC/E;;AAGA,IAAa,QAAQ;;CAEnB,KAAK,SAAoC;EACvC,OAAO,MAAM,IAAI,SAAS,EAAE,SAAS,aAAa,OAAO,EAAE,CAAC;CAC9D;CACA,MAAM,KAAa;EACjB,MAAM,MAAM,GAAG;CACjB;CACA,QAAQ;EACN,MAAM,MAAM;CACd;AACF;AAEA,IAAM,QAAQ;CAAE,MAAM;EAAE,MAAM;EAAM,OAAO;CAAY;CAAG,SAAS;EAAE,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K;EAAG,aAAa,KAAK,MAAM,QAAQ;CAAE;CAC1H,OAAO,EAAE,QAAQ,UAAU;AAC7B;;AAGA,SAAgB,QACd,OACA,WAA0B,mBACnB;CACP,OAAO;EAAE,SAAS,SAAS,MAAM,KAAK;EAAG,QAAQ,IAAI,KAAK,MAAM,aAAa;EAAG,aAAa,KAAK,MAAM,QAAQ;EAAG,UAAU,MAAM;CAAW;AAChJ;;AAGA,SAAgB,QACd,SACS;CACT,MAAM,EAAE,eAAe,GAAG,SAAS;CACnC,OAAO,OAAO,SAAS,IAAI,GAAG,aAAa;AAC7C;;;;;AAYA,eAAsB,UAAa,OAAqB,MAAoB,EAAE,YAAY,kBAAoC,CAAC,GAAe;CAG5I,MAAM,UAAU,IAAI,QAAQ,MAAM,OAAO;CACzC,IAAI,CAAC,QAAQ,IAAI,QAAQ,GAAG,QAAQ,IAAI,UAAU,kBAAkB;CACpE,MAAM,MAAM,MAAM,MAAM,OAAO;EAAE,GAAG;EAAM;CAAQ,CAAC;CACnD,IAAI,CAAC,IAAI,IAAI;EAGX,MAAM,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,YAAY,EAAE;EAC3C,IAAI,OAAgB,OAAO,KAAA;EAC3B,IAAI;GACF,IAAI,KAAK,OAAO,KAAK,MAAM,GAAG;EAChC,QAAQ,CAER;EACA,MAAM,IAAI,UAAU,IAAI,QAAQ,IAAI,YAAY,OAAO,KAAK,GAAG,MAAM,UAAU,IAAI,CAAC;CACtF;CAGA,MAAM,OAAO,IAAI,WAAW,MAAM,KAAK,MAAM,IAAI,KAAK;CACtD,OAAQ,OAAO,KAAK,MAAM,IAAI,IAAI,KAAA;AACpC"}
package/dist/strata.css CHANGED
@@ -6,8 +6,13 @@
6
6
  @import "./theme.generated.css"; (palette.mjs output: shadcn roles + 12-step ramps)
7
7
  @import "./theme.css"; (status roles, fonts, any subject colours, with reasons)
8
8
 
9
+ An app that already has its own Tailwind colours and sizes imports "strata-react/strata.migrate.css"
10
+ instead: this file without the reset below, so its stock classes keep compiling while it moves
11
+ screens over (the build writes it from this file: scripts/copy-css.mjs). The README says when.
12
+
9
13
  The research behind every value is in jburnhams/ux-research, ui-library/tokens.md. */
10
14
 
15
+ /* strata:strict-begin */
11
16
  /* Clear Tailwind's stock namespaces right after Tailwind's own theme loads. With these gone,
12
17
  `bg-indigo-500`, `text-sm`, `rounded-xl` and `shadow-lg` do not compile at all: the only colours,
13
18
  type steps, radii and shadows that exist are the ones the product's theme names. That is the
@@ -19,6 +24,7 @@
19
24
  --shadow-*: initial;
20
25
  --font-*: initial;
21
26
  }
27
+ /* strata:strict-end */
22
28
 
23
29
  /* React Aria's state variants (`selected:`, `pressed:`, `hover:`, `focus-visible:`, `disabled:`, `open:`,
24
30
  `invalid:`, `expanded:`, `sort-ascending:`…): each reads the `data-*` attribute React Aria Components