@mcurcio/patchbay 0.2.0 → 0.3.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.
@@ -0,0 +1 @@
1
+ .pb-banner{box-sizing:border-box;align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-3) var(--pb-space-4);border:1px solid var(--pb-line);border-inline-start:3px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);background:var(--pb-raised);color:var(--pb-text);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);flex-wrap:wrap;display:flex}.pb-banner[data-tone=ok]{border-inline-start-color:var(--pb-ok)}.pb-banner[data-tone=warn]{border-inline-start-color:var(--pb-warn);background:var(--pb-warn-soft)}.pb-banner[data-tone=err]{border-inline-start-color:var(--pb-err);background:var(--pb-err-soft)}.pb-banner[data-tone=quiet]{border-inline-start-color:var(--pb-quiet)}.pb-banner[data-tone=off]{border-inline-start-color:var(--pb-off)}.pb-banner-text{flex:12em;min-width:0}.pb-banner-actions{gap:var(--pb-space-3);flex-wrap:wrap;display:flex}.pb-button.pb-banner-dismiss{color:var(--pb-text);flex:none;margin-inline-start:auto}@media (forced-colors:active){.pb-banner{border-inline-start-color:canvastext}}.pb-diff{gap:var(--pb-space-3);min-width:0;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);display:grid}.pb-diff-file{gap:var(--pb-space-2);min-width:0;display:grid}.pb-diff-file-title{font-size:var(--pb-text-md);margin:0;font-weight:600}.pb-diff-toggle{box-sizing:border-box;align-items:center;gap:var(--pb-space-2);max-width:100%;min-height:28px;padding:0 var(--pb-space-2);border-radius:var(--pb-radius-control);color:var(--pb-text);font:inherit;text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;display:inline-flex}.pb-diff-toggle:hover{background:var(--pb-sunken)}.pb-diff-toggle:focus-visible{outline:2px solid var(--pb-accent);outline-offset:0}.pb-diff-chevron{color:var(--pb-muted);transition:transform var(--pb-motion-fast) ease-out;flex:none}.pb-diff-file[data-open] .pb-diff-chevron{transform:rotate(90deg)}.pb-diff-body{padding:var(--pb-space-3) 0;border:1px solid var(--pb-code-border);border-radius:var(--pb-radius-control);background:var(--pb-code-surface);color:var(--pb-code-text);font-family:var(--pb-font-code);font-size:var(--pb-code-size);margin:0;line-height:1.5;overflow-x:auto}.pb-diff-body[hidden]{display:none}.pb-diff-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-diff-code{min-width:100%;font:inherit;display:inline-block}.pb-diff-line{padding:0 var(--pb-space-4) 0 var(--pb-space-3);white-space:pre;border-inline-start:3px solid #0000;display:block}.pb-diff-line[data-kind=add]{color:var(--pb-added);border-inline-start-color:currentColor}.pb-diff-line[data-kind=del]{color:var(--pb-removed);border-inline-start-color:currentColor}.pb-diff-line[data-kind=hunk]{color:var(--pb-code-directive)}.pb-diff-line[data-kind=meta],.pb-diff-line[data-kind=note]{color:var(--pb-code-comment)}@media (hover:none) and (pointer:coarse){.pb-diff-toggle{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-diff-line[data-kind=add],.pb-diff-line[data-kind=del]{border-inline-start-color:canvastext}}.pb-status-words{font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);flex-wrap:wrap;align-items:baseline;margin:0;padding:0;list-style:none;display:inline-flex}.pb-status-word{color:var(--pb-muted);white-space:nowrap;font-weight:600}.pb-status-word+.pb-status-word:before{content:"·" / "";padding:0 var(--pb-space-2);color:var(--pb-muted);font-weight:400}.pb-status-word[data-tone=ok]{color:var(--pb-ok)}.pb-status-word[data-tone=warn]{color:var(--pb-warn)}.pb-status-word[data-tone=err]{color:var(--pb-err)}.pb-status-word[data-tone=quiet]{color:var(--pb-quiet)}.pb-status-word[data-tone=off]{color:var(--pb-off)}
@@ -0,0 +1,130 @@
1
+ import "./composites.css";import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ import { useId as n, useState as r } from "react";
3
+ import { IconButton as i } from "./primitives.js";
4
+ // src/composites/banner/Banner.tsx
5
+ function a({ tone: n, children: r, actions: a, onDismiss: o, dismissLabel: s = "Dismiss", className: c, ...l }) {
6
+ return /* @__PURE__ */ t("div", {
7
+ ...l,
8
+ role: n === "err" ? "alert" : "status",
9
+ className: c === void 0 ? "pb-banner" : `pb-banner ${c}`,
10
+ "data-tone": n,
11
+ children: [
12
+ /* @__PURE__ */ e("div", {
13
+ className: "pb-banner-text",
14
+ children: r
15
+ }),
16
+ a !== void 0 && /* @__PURE__ */ e("div", {
17
+ className: "pb-banner-actions",
18
+ children: a
19
+ }),
20
+ o !== void 0 && /* @__PURE__ */ e(i, {
21
+ className: "pb-banner-dismiss",
22
+ size: "sm",
23
+ label: s,
24
+ onClick: o,
25
+ children: /* @__PURE__ */ e("svg", {
26
+ viewBox: "0 0 16 16",
27
+ width: "12",
28
+ height: "12",
29
+ "aria-hidden": "true",
30
+ children: /* @__PURE__ */ e("path", {
31
+ d: "M3 3l10 10M13 3L3 13",
32
+ fill: "none",
33
+ stroke: "currentColor",
34
+ strokeWidth: "1.75"
35
+ })
36
+ })
37
+ })
38
+ ]
39
+ });
40
+ }
41
+ // src/composites/diff-view/DiffView.tsx
42
+ function o(e) {
43
+ return e.startsWith("+++ ") || e.startsWith("--- ") ? "meta" : e.startsWith("@@") ? "hunk" : e.startsWith("+") ? "add" : e.startsWith("-") ? "del" : e.startsWith("\\") ? "note" : e === "" || e.startsWith(" ") ? "context" : "meta";
44
+ }
45
+ function s(e) {
46
+ return e.split("/").filter((e) => e !== "").at(-1) ?? e;
47
+ }
48
+ function c(e) {
49
+ let t = e.split(/\r?\n/);
50
+ return t.length > 0 && t.at(-1) === "" && t.pop(), t;
51
+ }
52
+ function l({ text: t, id: n, hidden: r }) {
53
+ return /* @__PURE__ */ e("pre", {
54
+ className: "pb-diff-body",
55
+ id: n,
56
+ hidden: r,
57
+ tabIndex: 0,
58
+ children: /* @__PURE__ */ e("code", {
59
+ className: "pb-diff-code",
60
+ children: c(t).map((t, n) => /* @__PURE__ */ e("span", {
61
+ className: "pb-diff-line",
62
+ "data-kind": o(t),
63
+ children: t === "" ? " " : t
64
+ }, n))
65
+ })
66
+ });
67
+ }
68
+ function u({ diff: i, files: a, level: o = 3, collapsed: c, onToggle: u, className: d, ...f }) {
69
+ let p = n(), [m, h] = r([]), g = c ?? m, _ = `h${String(o)}`, v = (e, t) => {
70
+ c === void 0 && h((n) => t ? n.filter((t) => t !== e) : [...n, e]), u?.(e, t);
71
+ };
72
+ return /* @__PURE__ */ e("div", {
73
+ ...f,
74
+ className: d === void 0 ? "pb-diff" : `pb-diff ${d}`,
75
+ children: a === void 0 ? /* @__PURE__ */ e(l, { text: i }) : a.map((n, r) => {
76
+ let i = !g.includes(n.path), a = `${p}-${String(r)}`;
77
+ return /* @__PURE__ */ t("div", {
78
+ className: "pb-diff-file",
79
+ "data-open": i || void 0,
80
+ children: [/* @__PURE__ */ e(_, {
81
+ className: "pb-diff-file-title",
82
+ children: /* @__PURE__ */ t("button", {
83
+ type: "button",
84
+ className: "pb-diff-toggle",
85
+ "aria-expanded": i,
86
+ "aria-controls": a,
87
+ title: n.path,
88
+ onClick: () => {
89
+ v(n.path, !i);
90
+ },
91
+ children: [/* @__PURE__ */ e("svg", {
92
+ className: "pb-diff-chevron",
93
+ viewBox: "0 0 16 16",
94
+ width: "10",
95
+ height: "10",
96
+ "aria-hidden": "true",
97
+ children: /* @__PURE__ */ e("path", {
98
+ d: "M5 3l5 5-5 5",
99
+ fill: "none",
100
+ stroke: "currentColor",
101
+ strokeWidth: "2"
102
+ })
103
+ }), s(n.path)]
104
+ })
105
+ }), /* @__PURE__ */ e(l, {
106
+ text: n.diff,
107
+ id: a,
108
+ hidden: !i
109
+ })]
110
+ }, n.path);
111
+ })
112
+ });
113
+ }
114
+ // src/composites/status-words/StatusWords.tsx
115
+ function d({ items: t, className: n, ...r }) {
116
+ return /* @__PURE__ */ e("ul", {
117
+ "aria-live": "polite",
118
+ ...r,
119
+ className: n === void 0 ? "pb-status-words" : `pb-status-words ${n}`,
120
+ children: t.map((t, n) => /* @__PURE__ */ e("li", {
121
+ className: "pb-status-word",
122
+ "data-tone": t.tone,
123
+ title: t.title,
124
+ children: t.label
125
+ }, `${String(n)}:${t.label}`))
126
+ });
127
+ }
128
+ export { a as Banner, u as DiffView, d as StatusWords };
129
+
130
+ //# sourceMappingURL=composites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composites.js","names":["Banner","rest","tone","className","actions","onDismiss","IconButton","dismissLabel","diffLineKind","line","baseName","path","part","lines","all","text","DiffBody","index","DiffView","base","useId","ownCollapsed","setOwnCollapsed","useState","folded","collapsed","Heading","level","toggle","open","was","other","onToggle","files","diff","file","bodyId","StatusWords","items","item"],"sources":["../src/composites/banner/Banner.tsx","../src/composites/diff-view/DiffView.tsx","../src/composites/status-words/StatusWords.tsx"],"sourcesContent":["// A banner: a line of news across the top of a pane or page (a conflict, a lost connection, a refused edit), drawn in\n// its tone, with the app's actions at its end and, if the app lets it go, a close button. An error is an alert, so a\n// screen reader reads it at once; every other tone is a status, read when the reader is free. A tone it does not know\n// is drawn neutrally.\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { IconButton } from \"../../primitives\";\nimport \"./Banner.css\";\n\n/** The tones a banner draws; any other string is drawn neutrally. */\nexport type BannerTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | (string & {});\n\nexport type BannerProps = Omit<ComponentPropsWithRef<\"div\">, \"role\"> & {\n /** What the news is, by colour: the stripe's, and the surface's for warn and err. */\n tone: BannerTone;\n /** The news, in words. */\n children: ReactNode;\n /** A slot at the end: the buttons that act on the news. */\n actions?: ReactNode;\n /** Shows a close button, which asks the app to take the banner away. */\n onDismiss?: () => void;\n /** The close button's name, \"Dismiss\" by default. */\n dismissLabel?: string;\n};\n\nexport function Banner({\n tone,\n children,\n actions,\n onDismiss,\n dismissLabel = \"Dismiss\",\n className,\n ...rest\n}: BannerProps) {\n return (\n <div\n {...rest}\n role={tone === \"err\" ? \"alert\" : \"status\"}\n className={className === undefined ? \"pb-banner\" : `pb-banner ${className}`}\n data-tone={tone}\n >\n <div className=\"pb-banner-text\">{children}</div>\n {actions !== undefined && <div className=\"pb-banner-actions\">{actions}</div>}\n {onDismiss !== undefined && (\n <IconButton className=\"pb-banner-dismiss\" size=\"sm\" label={dismissLabel} onClick={onDismiss}>\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\">\n <path d=\"M3 3l10 10M13 3L3 13\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.75\" />\n </svg>\n </IconButton>\n )}\n </div>\n );\n}\n","// A diff: unified diff text drawn line by line, added lines in the added tone and removed ones in the removed tone,\n// each keeping its \"+\" or \"-\" so the change never rests on colour alone. Given files, each is a section of its own\n// under a heading, labelled by its file name with its whole path on hover, that the person can fold away.\nimport { useId, useState, type ComponentPropsWithRef } from \"react\";\nimport \"./DiffView.css\";\n\nexport type DiffFile = {\n /** The file's path; the section is labelled by its last part. Unique among the files. */\n path: string;\n /** The file's unified diff text. */\n diff: string;\n};\n\n/** What a line of unified diff text is, by its start. */\nexport type DiffLineKind = \"add\" | \"del\" | \"hunk\" | \"meta\" | \"note\" | \"context\";\n\ntype DiffSource =\n | {\n /** One unified diff, drawn whole without a heading. */\n diff: string;\n files?: never;\n }\n | {\n /** One section per file, in this order. */\n files: readonly DiffFile[];\n diff?: never;\n };\n\nexport type DiffViewProps = Omit<ComponentPropsWithRef<\"div\">, \"children\" | \"onToggle\"> &\n DiffSource & {\n /** The files' headings' level, h2 to h6 (h3 by default). */\n level?: 2 | 3 | 4 | 5 | 6;\n /**\n * The paths of the files folded away. Given, the app holds them and onToggle asks it to change them; left out,\n * the view keeps its own, every file open at first.\n */\n collapsed?: readonly string[];\n /** Called when the person opens (true) or folds (false) a file's section. */\n onToggle?: (path: string, open: boolean) => void;\n };\n\n/** The kind of one line of unified diff text. */\nexport function diffLineKind(line: string): DiffLineKind {\n if (line.startsWith(\"+++ \") || line.startsWith(\"--- \")) return \"meta\";\n if (line.startsWith(\"@@\")) return \"hunk\";\n if (line.startsWith(\"+\")) return \"add\";\n if (line.startsWith(\"-\")) return \"del\";\n if (line.startsWith(\"\\\\\")) return \"note\";\n if (line === \"\" || line.startsWith(\" \")) return \"context\";\n // A git header line: diff --git, index, new file mode, rename from, similarity index and the like.\n return \"meta\";\n}\n\n/** A path's last part: \"src/app/main.ts\" is \"main.ts\". */\nexport function baseName(path: string): string {\n const parts = path.split(\"/\").filter((part) => part !== \"\");\n return parts.at(-1) ?? path;\n}\n\nfunction lines(text: string): string[] {\n const all = text.split(/\\r?\\n/);\n // A diff ends with a newline, which starts no line of its own.\n if (all.length > 0 && all.at(-1) === \"\") all.pop();\n return all;\n}\n\nfunction DiffBody({ text, id, hidden }: { text: string; id?: string; hidden?: boolean }) {\n return (\n // Focusable, so a wide diff can be scrolled sideways from the keyboard.\n <pre className=\"pb-diff-body\" id={id} hidden={hidden} tabIndex={0}>\n <code className=\"pb-diff-code\">\n {lines(text).map((line, index) => (\n <span key={index} className=\"pb-diff-line\" data-kind={diffLineKind(line)}>\n {line === \"\" ? \" \" : line}\n </span>\n ))}\n </code>\n </pre>\n );\n}\n\nexport function DiffView({ diff, files, level = 3, collapsed, onToggle, className, ...rest }: DiffViewProps) {\n const base = useId();\n const [ownCollapsed, setOwnCollapsed] = useState<readonly string[]>([]);\n const folded = collapsed ?? ownCollapsed;\n const Heading = `h${String(level)}` as \"h3\";\n const toggle = (path: string, open: boolean) => {\n if (collapsed === undefined) {\n setOwnCollapsed((was) => (open ? was.filter((other) => other !== path) : [...was, path]));\n }\n onToggle?.(path, open);\n };\n return (\n <div {...rest} className={className === undefined ? \"pb-diff\" : `pb-diff ${className}`}>\n {files === undefined ? (\n <DiffBody text={diff} />\n ) : (\n files.map((file, index) => {\n const open = !folded.includes(file.path);\n const bodyId = `${base}-${String(index)}`;\n return (\n <div key={file.path} className=\"pb-diff-file\" data-open={open || undefined}>\n <Heading className=\"pb-diff-file-title\">\n <button\n type=\"button\"\n className=\"pb-diff-toggle\"\n aria-expanded={open}\n aria-controls={bodyId}\n title={file.path}\n onClick={() => {\n toggle(file.path, !open);\n }}\n >\n <svg className=\"pb-diff-chevron\" viewBox=\"0 0 16 16\" width=\"10\" height=\"10\" aria-hidden=\"true\">\n <path d=\"M5 3l5 5-5 5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" />\n </svg>\n {baseName(file.path)}\n </button>\n </Heading>\n <DiffBody text={file.diff} id={bodyId} hidden={!open} />\n </div>\n );\n })\n )}\n </div>\n );\n}\n","// Status words: a short row of states, each a word in its tone (a pane's \"3 errors · 1 warning · saved\"), in the order\n// the app gives, which is most urgent first. The row is one polite live region, so a screen reader reads a change\n// when it is free. A tone it does not know is drawn neutrally.\nimport type { ComponentPropsWithRef } from \"react\";\nimport \"./StatusWords.css\";\n\n/** The tones a word draws; any other string is drawn neutrally. */\nexport type StatusWordTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | (string & {});\n\nexport type StatusWord = {\n tone: StatusWordTone;\n /** The state in words. */\n label: string;\n /** Shown on hover: what the state means or why it is so. */\n title?: string;\n};\n\nexport type StatusWordsProps = Omit<ComponentPropsWithRef<\"ul\">, \"children\"> & {\n /** The states, most urgent first; drawn in this order. */\n items: readonly StatusWord[];\n};\n\nexport function StatusWords({ items, className, ...rest }: StatusWordsProps) {\n return (\n <ul\n aria-live=\"polite\"\n {...rest}\n className={className === undefined ? \"pb-status-words\" : `pb-status-words ${className}`}\n >\n {items.map((item, index) => (\n <li key={`${String(index)}:${item.label}`} className=\"pb-status-word\" data-tone={item.tone} title={item.title}>\n {item.label}\n </li>\n ))}\n </ul>\n );\n}\n"],"mappings":";;;;AAwBA,SAAgBA,EAAO,EACrB,SACA,aACA,YACA,cACA,kBAAe,WACf,cACA,GAAGC,KACW;CACd,OACE,kBAAC,OAAD;EACE,GAAIA;EACJ,MAAMC,MAAS,QAAQ,UAAU;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QAAe,MAAK;QAAO,QAAO;QAAe,aAAY;OAAK,CAAA;MACvE,CAAA,GACJnB,EAASyB,EAAK,IAAI,CACb;;IACD,CAAA,GACT,kBAACnB,GAAD;KAAU,MAAMmB,EAAK;KAAM,IAAIC;KAAQ,QAAQ,CAACP;IAAO,CAAA,CACpD;GAnBK,GAAAM,EAAK,IAmBV;EAET,CAAC;CAEA,CAAA;AAET;;ACxGA,SAAgBE,EAAY,EAAE,UAAO,cAAW,GAAGpC,KAA0B;CAC3E,OACE,kBAAC,MAAD;EACE,aAAU;EACV,GAAIA;EACJ,WAAWE,MAAc,KAAA,IAAY,oBAAoB,mBAAmBA;EAE3E,UAAAmC,EAAM,KAAK,GAAM,MAChB,kBAAC,MAAD;GAA2C,WAAU;GAAiB,aAAWC,EAAK;GAAM,OAAOA,EAAK;GACrG,UAAAA,EAAK;EACJ,GAFK,GAAG,OAAOtB,CAAK,EAAE,GAAGsB,EAAK,OAE9B,CACL;CACC,CAAA;AAER"}
@@ -1 +1 @@
1
- .pb-badge{box-sizing:border-box;align-items:center;gap:var(--pb-space-2);border:1px solid var(--pb-line);border-radius:var(--pb-radius-pill);background:var(--pb-sunken);color:var(--pb-muted);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);white-space:nowrap;padding:0 6px;font-weight:600;line-height:18px;display:inline-flex}.pb-badge[data-tone=ok]{color:var(--pb-ok);border-color:currentColor}.pb-badge[data-tone=warn]{background:var(--pb-warn-soft);color:var(--pb-warn);border-color:currentColor}.pb-badge[data-tone=err]{background:var(--pb-err-soft);color:var(--pb-err);border-color:currentColor}.pb-badge[data-tone=quiet]{color:var(--pb-quiet);border-color:currentColor}.pb-badge[data-tone=off]{color:var(--pb-off)}.pb-spinner:not(.pb-spinner-labelled),.pb-spinner-ring{box-sizing:border-box;vertical-align:-.1em;border-radius:var(--pb-radius-pill);width:.8em;height:.8em;animation:pb-spin var(--pb-motion-spin) linear infinite;border:2px solid;border-right-color:#0000;display:inline-block}.pb-spinner-labelled{align-items:center;display:inline-flex}.pb-spinner-label{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@keyframes pb-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.pb-spinner:not(.pb-spinner-labelled),.pb-spinner-ring{animation:none}}.pb-button{justify-content:center;align-items:center;gap:var(--pb-space-2);box-sizing:border-box;min-height:28px;padding:0 var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast), border-color var(--pb-motion-fast), color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;margin:0;line-height:1.2;display:inline-flex;position:relative}.pb-button:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-button:hover:not(:disabled,[aria-busy=true]){background:var(--pb-sunken)}.pb-button[aria-pressed=true]{color:var(--pb-accent);background:var(--pb-sunken)}.pb-button[data-tone=primary]{color:var(--pb-on-strong);background:var(--pb-accent);border-color:var(--pb-accent)}.pb-button[data-tone=primary]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-accent-hover)}.pb-button[data-tone=danger]{color:var(--pb-err)}.pb-button[data-tone=danger]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-err-soft);border-color:var(--pb-err)}.pb-button:disabled{color:var(--pb-muted);background:var(--pb-raised);border-color:var(--pb-line);cursor:default}.pb-button[aria-busy=true]{cursor:progress}.pb-button[data-size=sm]{min-height:var(--pb-row);padding:0 var(--pb-space-2);font-size:var(--pb-text-sm)}.pb-button-content{align-items:center;gap:var(--pb-space-2);display:inline-flex}.pb-button[aria-busy=true]>.pb-button-content{opacity:0}.pb-button>.pb-button-spinner{margin:auto;position:absolute;inset:0}@media (hover:none) and (pointer:coarse){.pb-button,.pb-button[data-size=sm]{min-height:36px}}@media (forced-colors:active){.pb-button{border-color:buttontext}.pb-button:disabled{color:graytext;border-color:graytext}}.pb-checkbox{width:16px;height:16px;accent-color:var(--pb-accent);cursor:pointer;flex:none;margin:0}.pb-checkbox:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-checkbox[aria-invalid=true]:not(:focus-visible){outline:1px solid var(--pb-err);outline-offset:1px}.pb-checkbox:disabled{cursor:default}.pb-checkbox-row{align-items:center;gap:var(--pb-space-3);min-height:28px;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);cursor:pointer;-webkit-tap-highlight-color:transparent;display:inline-flex}.pb-checkbox-row[data-disabled]{color:var(--pb-muted);cursor:default}@media (hover:none) and (pointer:coarse){.pb-checkbox{width:20px;height:20px}.pb-checkbox-row{min-height:36px;font-size:16px}}.pb-button.pb-icon-button{background:0 0;border-color:#0000;width:28px;min-width:28px;height:28px;padding:0}.pb-button.pb-icon-button[data-size=sm]{width:var(--pb-row);min-width:var(--pb-row);height:var(--pb-row)}.pb-button.pb-icon-button:hover:not(:disabled,[aria-busy=true]),.pb-button.pb-icon-button[aria-pressed=true]{background:var(--pb-sunken)}.pb-button.pb-icon-button[data-tone=primary]{background:var(--pb-accent);border-color:var(--pb-accent)}.pb-button.pb-icon-button[data-tone=primary]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-accent-hover)}.pb-button.pb-icon-button[data-tone=danger]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-err-soft);border-color:var(--pb-err)}.pb-button.pb-icon-button:disabled{background:0 0;border-color:#0000}.pb-icon-button-glyph{justify-content:center;align-items:center;font-size:1.15em;line-height:1;display:inline-flex}@media (hover:none) and (pointer:coarse){.pb-button.pb-icon-button,.pb-button.pb-icon-button[data-size=sm]{width:36px;min-width:36px;height:36px}}@media (forced-colors:active){.pb-button.pb-icon-button{border-color:#0000}.pb-button.pb-icon-button[aria-pressed=true]{border-color:highlight}}.pb-dialog-scrim{z-index:100;box-sizing:border-box;padding:max(10vh, env(safe-area-inset-top)) max(var(--pb-space-5), env(safe-area-inset-right)) max(var(--pb-space-5), env(safe-area-inset-bottom)) max(var(--pb-space-5), env(safe-area-inset-left));background:var(--pb-scrim);animation:pb-dialog-fade var(--pb-motion-fast) ease-out;justify-content:center;align-items:flex-start;display:flex;position:fixed;inset:0}.pb-dialog{box-sizing:border-box;width:min(520px,100%);max-height:100%;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line);border-radius:var(--pb-radius-box);box-shadow:var(--pb-shadow-lifted);animation:pb-dialog-rise var(--pb-motion-slow) ease-out;flex-direction:column;display:flex}.pb-dialog:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-dialog-head{align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-4) var(--pb-space-4) var(--pb-space-3) var(--pb-space-5);display:flex}.pb-dialog-title{min-width:0;font-size:var(--pb-text-md);flex:auto;margin:0;font-weight:600}.pb-button.pb-dialog-close{color:var(--pb-muted);flex:none}.pb-button.pb-dialog-close:hover{color:var(--pb-text)}.pb-dialog-body{min-height:0;padding:0 var(--pb-space-5) var(--pb-space-5);flex:auto;overflow:auto}.pb-dialog-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-dialog-actions{justify-content:flex-end;gap:var(--pb-space-3);padding:var(--pb-space-4) var(--pb-space-5);border-top:1px solid var(--pb-line);flex-wrap:wrap;display:flex}@keyframes pb-dialog-fade{0%{opacity:0}}@keyframes pb-dialog-rise{0%{opacity:0;transform:translateY(var(--pb-space-3))}}@media (max-width:599px){.pb-dialog-scrim{padding-top:max(var(--pb-space-5), env(safe-area-inset-top));padding-right:max(var(--pb-space-4), env(safe-area-inset-right));padding-left:max(var(--pb-space-4), env(safe-area-inset-left))}}@media (prefers-reduced-motion:reduce){.pb-dialog-scrim,.pb-dialog{animation:none}}.pb-field{gap:var(--pb-space-2);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);grid-template-columns:minmax(0,1fr);display:grid}.pb-field[data-layout=inline]{column-gap:var(--pb-space-4);grid-template-columns:130px minmax(0,1fr);align-items:baseline}.pb-field-label{color:var(--pb-text)}.pb-field-control{gap:var(--pb-space-2);min-width:0;display:grid}.pb-field-hint{font-size:var(--pb-text-sm);color:var(--pb-muted)}.pb-field-error{font-size:var(--pb-text-sm);color:var(--pb-err)}.pb-key-value{box-sizing:border-box;gap:var(--pb-space-1) var(--pb-space-4);color:var(--pb-text);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);grid-template-columns:max-content minmax(0,1fr);margin:0;display:grid}.pb-key-value-row{display:contents}.pb-key-value dt{color:var(--pb-muted)}.pb-key-value dd{font-variant-numeric:tabular-nums;overflow-wrap:anywhere;min-width:0;margin:0}.pb-key-value-row[data-tone=ok] dd{color:var(--pb-ok)}.pb-key-value-row[data-tone=warn] dd{color:var(--pb-warn)}.pb-key-value-row[data-tone=err] dd{color:var(--pb-err)}.pb-key-value-row[data-tone=quiet] dd{color:var(--pb-quiet)}.pb-key-value-row[data-tone=off] dd{color:var(--pb-off)}.pb-panel{box-sizing:border-box;min-height:0;max-height:100%;color:var(--pb-text);background:var(--pb-raised);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);flex-direction:column;display:flex}.pb-panel-header{align-items:center;gap:var(--pb-space-3);box-sizing:border-box;min-height:var(--pb-bar);padding:var(--pb-space-3) var(--pb-space-4);border-bottom:1px solid var(--pb-line);flex:none;display:flex}.pb-panel-actions{align-items:center;gap:var(--pb-space-2);flex:none;margin-left:auto;display:flex}.pb-panel-title{min-width:0;font-size:var(--pb-text-md);overflow-wrap:anywhere;flex:auto;margin:0;font-weight:600;line-height:1.3}.pb-panel-body{box-sizing:border-box;min-height:0;padding:var(--pb-space-3) var(--pb-space-4);overscroll-behavior:contain;flex:auto;overflow-y:auto}.pb-panel-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-pill{box-sizing:border-box;align-items:center;gap:var(--pb-space-2);border-radius:var(--pb-radius-pill);background:var(--pb-sunken);color:var(--pb-muted);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);white-space:nowrap;padding:0 7px 0 5px;font-weight:600;line-height:18px;display:inline-flex}.pb-pill-dot{border-radius:var(--pb-radius-pill);background:currentColor;flex:none;width:7px;height:7px}.pb-pill[data-tone=ok]{color:var(--pb-ok)}.pb-pill[data-tone=warn]{color:var(--pb-warn)}.pb-pill[data-tone=err]{color:var(--pb-err)}.pb-pill[data-tone=quiet]{color:var(--pb-quiet)}.pb-pill[data-tone=off]{color:var(--pb-off)}.pb-pill-detail{font-family:var(--pb-font-code);font-weight:400}.pb-pill[data-pulse] .pb-pill-dot{animation:pb-pill-pulse var(--pb-motion-pulse) ease-in-out infinite}@keyframes pb-pill-pulse{50%{opacity:.4}}@media (prefers-reduced-motion:reduce){.pb-pill[data-pulse] .pb-pill-dot{animation:none}}.pb-section-title{box-sizing:border-box;align-items:center;gap:var(--pb-space-3);margin:var(--pb-space-3) 0;color:var(--pb-text);font-family:var(--pb-font-ui);display:flex}.pb-section-title-text{min-width:0;font-size:var(--pb-text-md);overflow-wrap:anywhere;flex:auto;margin:0;font-weight:600}.pb-section-title-actions{align-items:center;gap:var(--pb-space-2);flex:none;display:flex}.pb-select{box-sizing:border-box;width:100%;min-height:28px;padding:var(--pb-space-2) var(--pb-space-2);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:border-color var(--pb-motion-fast);margin:0;line-height:1.2}.pb-select[data-font=code]{font-family:var(--pb-font-code)}.pb-select:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-select[aria-invalid=true]{border-color:var(--pb-err)}.pb-select:disabled{color:var(--pb-muted);background:var(--pb-sunken);border-color:var(--pb-line);cursor:default}@media (hover:none) and (pointer:coarse){.pb-select{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-select{border-color:fieldtext}.pb-select:disabled{border-color:graytext}}.pb-sheet{z-index:10;box-sizing:border-box;width:min(clamp(280px, var(--pb-sheet-width,360px), 560px), calc(100% - 48px));font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border-left:1px solid var(--pb-line);box-shadow:var(--pb-shadow-lifted);animation:pb-sheet-from-right var(--pb-motion-slow) ease-out;flex-direction:column;display:flex;position:absolute;top:0;bottom:0;right:0}.pb-sheet[data-side=bottom]{width:auto;max-height:62%;padding-bottom:env(safe-area-inset-bottom);border-top:1px solid var(--pb-line);border-radius:var(--pb-radius-box) var(--pb-radius-box) 0 0;border-left:none;animation-name:pb-sheet-from-bottom;top:auto;left:0}.pb-sheet-head{align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-3) var(--pb-space-3) var(--pb-space-2) var(--pb-space-4);flex:none;display:flex}.pb-sheet-title{min-width:0;font-size:var(--pb-text-md);flex:auto;margin:0;font-weight:600}.pb-button.pb-sheet-close{color:var(--pb-muted);flex:none}.pb-button.pb-sheet-close:hover{color:var(--pb-text)}.pb-sheet-body{min-height:0;padding:0 var(--pb-space-4) var(--pb-space-3);flex:auto;overflow-y:auto}.pb-sheet-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}@keyframes pb-sheet-from-right{0%{transform:translateX(var(--pb-space-5));opacity:0}}@keyframes pb-sheet-from-bottom{0%{transform:translateY(var(--pb-space-5));opacity:0}}@media (prefers-reduced-motion:reduce){.pb-sheet,.pb-sheet[data-side=bottom]{animation:none}}.pb-splitter{z-index:5;box-sizing:border-box;touch-action:none;transition:background-color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;background:0 0;position:absolute}.pb-splitter[data-orientation=vertical]{cursor:col-resize;width:6px;top:0;bottom:0}.pb-splitter[data-orientation=vertical][data-edge=start]{left:-3px}.pb-splitter[data-orientation=vertical][data-edge=end]{right:-3px}.pb-splitter[data-orientation=horizontal]{cursor:row-resize;height:6px;left:0;right:0}.pb-splitter[data-orientation=horizontal][data-edge=start]{top:-3px}.pb-splitter[data-orientation=horizontal][data-edge=end]{bottom:-3px}.pb-splitter:hover,.pb-splitter:focus-visible,.pb-splitter[data-dragging]{background:var(--pb-accent);outline:none}@media (hover:none) and (pointer:coarse){.pb-splitter:before{content:"";position:absolute}.pb-splitter[data-orientation=vertical]:before{inset:0 -15px}.pb-splitter[data-orientation=horizontal]:before{inset:-15px 0}}@media (forced-colors:active){.pb-splitter:hover,.pb-splitter:focus-visible,.pb-splitter[data-dragging]{background:highlight}}.pb-text-input{box-sizing:border-box;width:100%;min-height:28px;padding:var(--pb-space-2) var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);transition:border-color var(--pb-motion-fast);margin:0;line-height:1.2}.pb-text-input[data-font=code]{font-family:var(--pb-font-code)}.pb-text-input::placeholder{color:var(--pb-muted);opacity:1}.pb-text-input:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-text-input[aria-invalid=true]{border-color:var(--pb-err)}.pb-text-input:disabled,.pb-text-input:read-only{background:var(--pb-sunken)}.pb-text-input:disabled{color:var(--pb-muted);border-color:var(--pb-line);cursor:default}@media (hover:none) and (pointer:coarse){.pb-text-input{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-text-input{border-color:fieldtext}.pb-text-input:disabled{border-color:graytext}}.pb-theme-switch{align-items:center;gap:var(--pb-space-2);box-sizing:border-box;min-height:28px;padding:0 var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);white-space:nowrap;color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;margin:0;line-height:1.2;display:inline-flex}.pb-theme-switch:hover{background:var(--pb-sunken)}.pb-theme-switch:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-theme-switch-icon{flex:none}@media (max-width:599px){.pb-theme-switch{padding:0 var(--pb-space-2)}.pb-theme-switch-word{display:none}}@media (hover:none) and (pointer:coarse){.pb-theme-switch{justify-content:center;min-width:36px;min-height:36px}}.pb-toolbar{align-items:center;gap:var(--pb-space-2);box-sizing:border-box;flex-wrap:wrap;display:flex}.pb-toolbar[aria-orientation=vertical]{flex-flow:column;align-items:stretch}.pb-toolbar.pb-tool-group{gap:var(--pb-space-1);background:var(--pb-raised);border:1px solid var(--pb-line);border-radius:var(--pb-radius-box);box-shadow:var(--pb-shadow);flex-wrap:nowrap;padding:3px;display:inline-flex}.pb-tool-group button{box-sizing:border-box;width:28px;height:28px;font-family:var(--pb-font-ui);color:var(--pb-text);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast), color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;font-size:15px;line-height:1;display:inline-flex}.pb-tool-group button:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-tool-group button:hover:not(:disabled),.pb-tool-group button[aria-pressed=true]{background:var(--pb-sunken)}.pb-tool-group button[aria-pressed=true]{color:var(--pb-accent)}.pb-tool-group button:disabled{color:var(--pb-muted);cursor:default}@media (hover:none) and (pointer:coarse){.pb-tool-group button,.pb-tool-group .pb-button.pb-icon-button,.pb-tool-group .pb-button.pb-icon-button[data-size=sm]{width:40px;min-width:40px;height:40px}}@media (forced-colors:active){.pb-toolbar.pb-tool-group{border-color:canvastext}.pb-tool-group button[aria-pressed=true]{outline:1px solid highlight}}.pb-warn-mark{box-sizing:border-box;border-radius:var(--pb-radius-pill);background:var(--pb-warn);width:12px;height:12px;color:var(--pb-on-strong);font-family:var(--pb-font-ui);text-align:center;vertical-align:middle;flex:none;font-size:9px;font-weight:700;line-height:12px;display:inline-block}.pb-warn-mark-text{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}
1
+ .pb-badge{box-sizing:border-box;align-items:center;gap:var(--pb-space-2);border:1px solid var(--pb-line);border-radius:var(--pb-radius-pill);background:var(--pb-sunken);color:var(--pb-muted);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);white-space:nowrap;padding:0 6px;font-weight:600;line-height:18px;display:inline-flex}.pb-badge[data-tone=ok]{color:var(--pb-ok);border-color:currentColor}.pb-badge[data-tone=warn]{background:var(--pb-warn-soft);color:var(--pb-warn);border-color:currentColor}.pb-badge[data-tone=err]{background:var(--pb-err-soft);color:var(--pb-err);border-color:currentColor}.pb-badge[data-tone=quiet]{color:var(--pb-quiet);border-color:currentColor}.pb-badge[data-tone=off]{color:var(--pb-off)}.pb-spinner:not(.pb-spinner-labelled),.pb-spinner-ring{box-sizing:border-box;vertical-align:-.1em;border-radius:var(--pb-radius-pill);width:.8em;height:.8em;animation:pb-spin var(--pb-motion-spin) linear infinite;border:2px solid;border-right-color:#0000;display:inline-block}.pb-spinner-labelled{align-items:center;display:inline-flex}.pb-spinner-label{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@keyframes pb-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.pb-spinner:not(.pb-spinner-labelled),.pb-spinner-ring{animation:none}}.pb-button{justify-content:center;align-items:center;gap:var(--pb-space-2);box-sizing:border-box;min-height:28px;padding:0 var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast), border-color var(--pb-motion-fast), color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;margin:0;line-height:1.2;display:inline-flex;position:relative}.pb-button:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-button:hover:not(:disabled,[aria-busy=true]){background:var(--pb-sunken)}.pb-button[aria-pressed=true]{color:var(--pb-accent);background:var(--pb-sunken)}.pb-button[data-tone=primary]{color:var(--pb-on-strong);background:var(--pb-accent);border-color:var(--pb-accent)}.pb-button[data-tone=primary]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-accent-hover)}.pb-button[data-tone=danger]{color:var(--pb-err)}.pb-button[data-tone=danger]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-err-soft);border-color:var(--pb-err)}.pb-button:disabled{color:var(--pb-muted);background:var(--pb-raised);border-color:var(--pb-line);cursor:default}.pb-button[aria-busy=true]{cursor:progress}.pb-button[data-size=sm]{min-height:var(--pb-row);padding:0 var(--pb-space-2);font-size:var(--pb-text-sm)}.pb-button-content{align-items:center;gap:var(--pb-space-2);display:inline-flex}.pb-button[aria-busy=true]>.pb-button-content{opacity:0}.pb-button>.pb-button-spinner{margin:auto;position:absolute;inset:0}@media (hover:none) and (pointer:coarse){.pb-button,.pb-button[data-size=sm]{min-height:36px}}@media (forced-colors:active){.pb-button{border-color:buttontext}.pb-button:disabled{color:graytext;border-color:graytext}}.pb-checkbox{width:16px;height:16px;accent-color:var(--pb-accent);cursor:pointer;flex:none;margin:0}.pb-checkbox:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-checkbox[aria-invalid=true]:not(:focus-visible){outline:1px solid var(--pb-err);outline-offset:1px}.pb-checkbox:disabled{cursor:default}.pb-checkbox-row{align-items:center;gap:var(--pb-space-3);min-height:28px;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);cursor:pointer;-webkit-tap-highlight-color:transparent;display:inline-flex}.pb-checkbox-row[data-disabled]{color:var(--pb-muted);cursor:default}@media (hover:none) and (pointer:coarse){.pb-checkbox{width:20px;height:20px}.pb-checkbox-row{min-height:36px;font-size:16px}}.pb-button.pb-icon-button{background:0 0;border-color:#0000;width:28px;min-width:28px;height:28px;padding:0}.pb-button.pb-icon-button[data-size=sm]{width:var(--pb-row);min-width:var(--pb-row);height:var(--pb-row)}.pb-button.pb-icon-button:hover:not(:disabled,[aria-busy=true]),.pb-button.pb-icon-button[aria-pressed=true]{background:var(--pb-sunken)}.pb-button.pb-icon-button[data-tone=primary]{background:var(--pb-accent);border-color:var(--pb-accent)}.pb-button.pb-icon-button[data-tone=primary]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-accent-hover)}.pb-button.pb-icon-button[data-tone=danger]:hover:not(:disabled,[aria-busy=true]){background:var(--pb-err-soft);border-color:var(--pb-err)}.pb-button.pb-icon-button:disabled{background:0 0;border-color:#0000}.pb-icon-button-glyph{justify-content:center;align-items:center;font-size:1.15em;line-height:1;display:inline-flex}@media (hover:none) and (pointer:coarse){.pb-button.pb-icon-button,.pb-button.pb-icon-button[data-size=sm]{width:36px;min-width:36px;height:36px}}@media (forced-colors:active){.pb-button.pb-icon-button{border-color:#0000}.pb-button.pb-icon-button[aria-pressed=true]{border-color:highlight}}.pb-dialog-scrim{z-index:100;box-sizing:border-box;padding:max(10vh, env(safe-area-inset-top)) max(var(--pb-space-5), env(safe-area-inset-right)) max(var(--pb-space-5), env(safe-area-inset-bottom)) max(var(--pb-space-5), env(safe-area-inset-left));background:var(--pb-scrim);animation:pb-dialog-fade var(--pb-motion-fast) ease-out;justify-content:center;align-items:flex-start;display:flex;position:fixed;inset:0}.pb-dialog{box-sizing:border-box;width:min(520px,100%);max-height:100%;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line);border-radius:var(--pb-radius-box);box-shadow:var(--pb-shadow-lifted);animation:pb-dialog-rise var(--pb-motion-slow) ease-out;flex-direction:column;display:flex}.pb-dialog:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-dialog-head{align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-4) var(--pb-space-4) var(--pb-space-3) var(--pb-space-5);display:flex}.pb-dialog-title{min-width:0;font-size:var(--pb-text-md);flex:auto;margin:0;font-weight:600}.pb-button.pb-dialog-close{color:var(--pb-muted);flex:none}.pb-button.pb-dialog-close:hover{color:var(--pb-text)}.pb-dialog-body{min-height:0;padding:0 var(--pb-space-5) var(--pb-space-5);flex:auto;overflow:auto}.pb-dialog-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-dialog-actions{justify-content:flex-end;gap:var(--pb-space-3);padding:var(--pb-space-4) var(--pb-space-5);border-top:1px solid var(--pb-line);flex-wrap:wrap;display:flex}@keyframes pb-dialog-fade{0%{opacity:0}}@keyframes pb-dialog-rise{0%{opacity:0;transform:translateY(var(--pb-space-3))}}@media (max-width:599px){.pb-dialog-scrim{padding-top:max(var(--pb-space-5), env(safe-area-inset-top));padding-right:max(var(--pb-space-4), env(safe-area-inset-right));padding-left:max(var(--pb-space-4), env(safe-area-inset-left))}}@media (prefers-reduced-motion:reduce){.pb-dialog-scrim,.pb-dialog{animation:none}}.pb-field{gap:var(--pb-space-2);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);grid-template-columns:minmax(0,1fr);display:grid}.pb-field[data-layout=inline]{column-gap:var(--pb-space-4);grid-template-columns:130px minmax(0,1fr);align-items:baseline}.pb-field-label{color:var(--pb-text)}.pb-field-control{gap:var(--pb-space-2);min-width:0;display:grid}.pb-field-hint{font-size:var(--pb-text-sm);color:var(--pb-muted)}.pb-field-error{font-size:var(--pb-text-sm);color:var(--pb-err)}.pb-key-value{box-sizing:border-box;gap:var(--pb-space-1) var(--pb-space-4);color:var(--pb-text);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);grid-template-columns:max-content minmax(0,1fr);margin:0;display:grid}.pb-key-value-row{display:contents}.pb-key-value dt{color:var(--pb-muted)}.pb-key-value dd{font-variant-numeric:tabular-nums;overflow-wrap:anywhere;min-width:0;margin:0}.pb-key-value-row[data-tone=ok] dd{color:var(--pb-ok)}.pb-key-value-row[data-tone=warn] dd{color:var(--pb-warn)}.pb-key-value-row[data-tone=err] dd{color:var(--pb-err)}.pb-key-value-row[data-tone=quiet] dd{color:var(--pb-quiet)}.pb-key-value-row[data-tone=off] dd{color:var(--pb-off)}.pb-panel{box-sizing:border-box;min-height:0;max-height:100%;color:var(--pb-text);background:var(--pb-raised);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);flex-direction:column;display:flex}.pb-panel-header{align-items:center;gap:var(--pb-space-3);box-sizing:border-box;min-height:var(--pb-bar);padding:var(--pb-space-3) var(--pb-space-4);border-bottom:1px solid var(--pb-line);flex:none;display:flex}.pb-panel-actions{align-items:center;gap:var(--pb-space-2);flex:none;margin-left:auto;display:flex}.pb-panel-title{min-width:0;font-size:var(--pb-text-md);overflow-wrap:anywhere;flex:auto;margin:0;font-weight:600;line-height:1.3}.pb-panel-body{box-sizing:border-box;min-height:0;padding:var(--pb-space-3) var(--pb-space-4);overscroll-behavior:contain;flex:auto;overflow-y:auto}.pb-panel-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}.pb-pill{box-sizing:border-box;align-items:center;gap:var(--pb-space-2);border-radius:var(--pb-radius-pill);background:var(--pb-sunken);color:var(--pb-muted);font-family:var(--pb-font-ui);font-size:var(--pb-text-sm);white-space:nowrap;padding:0 7px 0 5px;font-weight:600;line-height:18px;display:inline-flex}.pb-pill-dot{border-radius:var(--pb-radius-pill);background:currentColor;flex:none;width:7px;height:7px}.pb-pill[data-tone=ok]{color:var(--pb-ok)}.pb-pill[data-tone=warn]{color:var(--pb-warn)}.pb-pill[data-tone=err]{color:var(--pb-err)}.pb-pill[data-tone=quiet]{color:var(--pb-quiet)}.pb-pill[data-tone=off]{color:var(--pb-off)}.pb-pill-detail{font-family:var(--pb-font-code);font-weight:400}.pb-pill[data-pulse] .pb-pill-dot{animation:pb-pill-pulse var(--pb-motion-pulse) ease-in-out infinite}@keyframes pb-pill-pulse{50%{opacity:.4}}@media (prefers-reduced-motion:reduce){.pb-pill[data-pulse] .pb-pill-dot{animation:none}}.pb-radio-group{gap:var(--pb-space-2);min-width:0;font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);border:0;margin:0;padding:0;display:grid}.pb-radio-group-legend{float:left;width:100%;margin-bottom:var(--pb-space-2);color:var(--pb-text);padding:0}.pb-radio-group-legend[data-hidden]{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;margin:0;position:absolute;overflow:hidden}.pb-radio-group-options{clear:both;flex-direction:column;align-items:flex-start;display:flex}.pb-radio-group[data-layout=inline] .pb-radio-group-options{column-gap:var(--pb-space-5);flex-flow:wrap}.pb-radio-row{align-items:center;gap:var(--pb-space-3);cursor:pointer;-webkit-tap-highlight-color:transparent;min-height:28px;display:inline-flex}.pb-radio-row[data-disabled]{color:var(--pb-muted);cursor:default}.pb-radio{width:16px;height:16px;accent-color:var(--pb-accent);cursor:pointer;flex:none;margin:0}.pb-radio:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-radio-group[aria-invalid=true] .pb-radio:not(:focus-visible){outline:1px solid var(--pb-err);outline-offset:1px}.pb-radio:disabled{cursor:default}.pb-radio-group-hint{font-size:var(--pb-text-sm);color:var(--pb-muted)}.pb-radio-group-error{font-size:var(--pb-text-sm);color:var(--pb-err)}@media (hover:none) and (pointer:coarse){.pb-radio{width:20px;height:20px}.pb-radio-row{min-height:36px;font-size:16px}}.pb-section-title{box-sizing:border-box;align-items:center;gap:var(--pb-space-3);margin:var(--pb-space-3) 0;color:var(--pb-text);font-family:var(--pb-font-ui);display:flex}.pb-section-title-text{min-width:0;font-size:var(--pb-text-md);overflow-wrap:anywhere;flex:auto;margin:0;font-weight:600}.pb-section-title-actions{align-items:center;gap:var(--pb-space-2);flex:none;display:flex}.pb-select{box-sizing:border-box;width:100%;min-height:28px;padding:var(--pb-space-2) var(--pb-space-2);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:border-color var(--pb-motion-fast);margin:0;line-height:1.2}.pb-select[data-font=code]{font-family:var(--pb-font-code)}.pb-select:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-select[aria-invalid=true]{border-color:var(--pb-err)}.pb-select:disabled{color:var(--pb-muted);background:var(--pb-sunken);border-color:var(--pb-line);cursor:default}@media (hover:none) and (pointer:coarse){.pb-select{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-select{border-color:fieldtext}.pb-select:disabled{border-color:graytext}}.pb-sheet{z-index:10;box-sizing:border-box;width:min(clamp(280px, var(--pb-sheet-width,360px), 560px), calc(100% - 48px));font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border-left:1px solid var(--pb-line);box-shadow:var(--pb-shadow-lifted);animation:pb-sheet-from-right var(--pb-motion-slow) ease-out;flex-direction:column;display:flex;position:absolute;top:0;bottom:0;right:0}.pb-sheet[data-side=bottom]{width:auto;max-height:62%;padding-bottom:env(safe-area-inset-bottom);border-top:1px solid var(--pb-line);border-radius:var(--pb-radius-box) var(--pb-radius-box) 0 0;border-left:none;animation-name:pb-sheet-from-bottom;top:auto;left:0}.pb-sheet-head{align-items:center;gap:var(--pb-space-3);padding:var(--pb-space-3) var(--pb-space-3) var(--pb-space-2) var(--pb-space-4);flex:none;display:flex}.pb-sheet-title{min-width:0;font-size:var(--pb-text-md);flex:auto;margin:0;font-weight:600}.pb-button.pb-sheet-close{color:var(--pb-muted);flex:none}.pb-button.pb-sheet-close:hover{color:var(--pb-text)}.pb-sheet-body{min-height:0;padding:0 var(--pb-space-4) var(--pb-space-3);flex:auto;overflow-y:auto}.pb-sheet-body:focus-visible{outline:2px solid var(--pb-accent);outline-offset:-2px}@keyframes pb-sheet-from-right{0%{transform:translateX(var(--pb-space-5));opacity:0}}@keyframes pb-sheet-from-bottom{0%{transform:translateY(var(--pb-space-5));opacity:0}}@media (prefers-reduced-motion:reduce){.pb-sheet,.pb-sheet[data-side=bottom]{animation:none}}.pb-splitter{z-index:5;box-sizing:border-box;touch-action:none;transition:background-color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;background:0 0;position:absolute}.pb-splitter[data-orientation=vertical]{cursor:col-resize;width:6px;top:0;bottom:0}.pb-splitter[data-orientation=vertical][data-edge=start]{left:-3px}.pb-splitter[data-orientation=vertical][data-edge=end]{right:-3px}.pb-splitter[data-orientation=horizontal]{cursor:row-resize;height:6px;left:0;right:0}.pb-splitter[data-orientation=horizontal][data-edge=start]{top:-3px}.pb-splitter[data-orientation=horizontal][data-edge=end]{bottom:-3px}.pb-splitter:hover,.pb-splitter:focus-visible,.pb-splitter[data-dragging]{background:var(--pb-accent);outline:none}@media (hover:none) and (pointer:coarse){.pb-splitter:before{content:"";position:absolute}.pb-splitter[data-orientation=vertical]:before{inset:0 -15px}.pb-splitter[data-orientation=horizontal]:before{inset:-15px 0}}@media (forced-colors:active){.pb-splitter:hover,.pb-splitter:focus-visible,.pb-splitter[data-dragging]{background:highlight}}.pb-text-input{box-sizing:border-box;width:100%;min-height:28px;padding:var(--pb-space-2) var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);transition:border-color var(--pb-motion-fast);margin:0;line-height:1.2}.pb-text-input[data-font=code]{font-family:var(--pb-font-code)}.pb-text-input::placeholder{color:var(--pb-muted);opacity:1}.pb-text-input:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-text-input[aria-invalid=true]{border-color:var(--pb-err)}.pb-text-input:disabled,.pb-text-input:read-only{background:var(--pb-sunken)}.pb-text-input:disabled{color:var(--pb-muted);border-color:var(--pb-line);cursor:default}@media (hover:none) and (pointer:coarse){.pb-text-input{min-height:36px;font-size:16px}}@media (forced-colors:active){.pb-text-input{border-color:fieldtext}.pb-text-input:disabled{border-color:graytext}}.pb-theme-switch{align-items:center;gap:var(--pb-space-2);box-sizing:border-box;min-height:28px;padding:0 var(--pb-space-3);font-family:var(--pb-font-ui);font-size:var(--pb-text-md);white-space:nowrap;color:var(--pb-text);background:var(--pb-raised);border:1px solid var(--pb-line-strong);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;margin:0;line-height:1.2;display:inline-flex}.pb-theme-switch:hover{background:var(--pb-sunken)}.pb-theme-switch:focus-visible{outline:2px solid var(--pb-accent);outline-offset:2px}.pb-theme-switch-icon{flex:none}@media (max-width:599px){.pb-theme-switch{padding:0 var(--pb-space-2)}.pb-theme-switch-word{display:none}}@media (hover:none) and (pointer:coarse){.pb-theme-switch{justify-content:center;min-width:36px;min-height:36px}}.pb-toolbar{align-items:center;gap:var(--pb-space-2);box-sizing:border-box;flex-wrap:wrap;display:flex}.pb-toolbar[aria-orientation=vertical]{flex-flow:column;align-items:stretch}.pb-toolbar.pb-tool-group{gap:var(--pb-space-1);background:var(--pb-raised);border:1px solid var(--pb-line);border-radius:var(--pb-radius-box);box-shadow:var(--pb-shadow);flex-wrap:nowrap;padding:3px;display:inline-flex}.pb-tool-group button{box-sizing:border-box;width:28px;height:28px;font-family:var(--pb-font-ui);color:var(--pb-text);border-radius:var(--pb-radius-control);cursor:pointer;transition:background-color var(--pb-motion-fast), color var(--pb-motion-fast);-webkit-tap-highlight-color:transparent;background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;font-size:15px;line-height:1;display:inline-flex}.pb-tool-group button:focus-visible{outline:2px solid var(--pb-accent);outline-offset:1px}.pb-tool-group button:hover:not(:disabled),.pb-tool-group button[aria-pressed=true]{background:var(--pb-sunken)}.pb-tool-group button[aria-pressed=true]{color:var(--pb-accent)}.pb-tool-group button:disabled{color:var(--pb-muted);cursor:default}@media (hover:none) and (pointer:coarse){.pb-tool-group button,.pb-tool-group .pb-button.pb-icon-button,.pb-tool-group .pb-button.pb-icon-button[data-size=sm]{width:40px;min-width:40px;height:40px}}@media (forced-colors:active){.pb-toolbar.pb-tool-group{border-color:canvastext}.pb-tool-group button[aria-pressed=true]{outline:1px solid highlight}}.pb-warn-mark{box-sizing:border-box;border-radius:var(--pb-radius-pill);background:var(--pb-warn);width:12px;height:12px;color:var(--pb-on-strong);font-family:var(--pb-font-ui);text-align:center;vertical-align:middle;flex:none;font-size:9px;font-weight:700;line-height:12px;display:inline-block}.pb-warn-mark-text{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}
@@ -325,8 +325,66 @@ function k({ tone: e, label: r, pulse: i = !1, title: a, detail: o, className: s
325
325
  ]
326
326
  });
327
327
  }
328
+ // src/primitives/radio-group/RadioGroup.tsx
329
+ function A(e) {
330
+ return e != null && e !== !1 && e !== "";
331
+ }
332
+ function j({ legend: e, legendHidden: r = !1, options: i, value: a, onChange: o, name: c, layout: l = "stacked", hint: u, error: d, className: f, "aria-describedby": p, "aria-invalid": m, ...h }) {
333
+ let g = s(), _ = c ?? `${g}-name`, v = A(u) ? `${g}-hint` : void 0, y = A(d) ? `${g}-error` : void 0, b = [
334
+ p,
335
+ v,
336
+ y
337
+ ].filter((e) => e !== void 0 && e !== "");
338
+ return /* @__PURE__ */ n("fieldset", {
339
+ ...h,
340
+ role: "radiogroup",
341
+ className: f === void 0 ? "pb-radio-group" : `pb-radio-group ${f}`,
342
+ "data-layout": l,
343
+ "aria-describedby": b.length > 0 ? b.join(" ") : void 0,
344
+ "aria-invalid": y !== void 0 || m,
345
+ children: [
346
+ /* @__PURE__ */ t("legend", {
347
+ className: "pb-radio-group-legend",
348
+ "data-hidden": r || void 0,
349
+ children: e
350
+ }),
351
+ /* @__PURE__ */ t("div", {
352
+ className: "pb-radio-group-options",
353
+ children: i.map((e) => /* @__PURE__ */ n("label", {
354
+ className: "pb-radio-row",
355
+ title: e.title,
356
+ "data-disabled": e.disabled === !0 || h.disabled === !0 || void 0,
357
+ children: [/* @__PURE__ */ t("input", {
358
+ className: "pb-radio",
359
+ type: "radio",
360
+ name: _,
361
+ value: e.value,
362
+ checked: e.value === a,
363
+ disabled: e.disabled,
364
+ onChange: () => {
365
+ o(e.value);
366
+ }
367
+ }), /* @__PURE__ */ t("span", {
368
+ className: "pb-radio-label",
369
+ children: e.label
370
+ })]
371
+ }, e.value))
372
+ }),
373
+ v !== void 0 && /* @__PURE__ */ t("div", {
374
+ className: "pb-radio-group-hint",
375
+ id: v,
376
+ children: u
377
+ }),
378
+ y !== void 0 && /* @__PURE__ */ t("div", {
379
+ className: "pb-radio-group-error",
380
+ id: y,
381
+ children: d
382
+ })
383
+ ]
384
+ });
385
+ }
328
386
  // src/primitives/section-title/SectionTitle.tsx
329
- function A({ children: e, actions: r, level: i = 3, className: a }) {
387
+ function M({ children: e, actions: r, level: i = 3, className: a }) {
330
388
  let o = `h${i}`;
331
389
  return /* @__PURE__ */ n("div", {
332
390
  className: a === void 0 ? "pb-section-title" : `pb-section-title ${a}`,
@@ -340,7 +398,7 @@ function A({ children: e, actions: r, level: i = 3, className: a }) {
340
398
  });
341
399
  }
342
400
  // src/primitives/select/Select.tsx
343
- function j({ font: e = "ui", className: n, children: r, ...i }) {
401
+ function N({ font: e = "ui", className: n, children: r, ...i }) {
344
402
  return /* @__PURE__ */ t("select", {
345
403
  ...i,
346
404
  className: n === void 0 ? "pb-select" : `pb-select ${n}`,
@@ -349,7 +407,7 @@ function j({ font: e = "ui", className: n, children: r, ...i }) {
349
407
  });
350
408
  }
351
409
  // src/primitives/sheet/Sheet.tsx
352
- function M({ onClose: e, side: r = "right", title: i, label: a, children: c, width: u, closeLabel: d = "Close", className: f }) {
410
+ function P({ onClose: e, side: r = "right", title: i, label: a, children: c, width: u, closeLabel: d = "Close", className: f }) {
353
411
  let p = l(null), m = s(), h = l(null);
354
412
  o(() => {
355
413
  let e = p.current;
@@ -393,34 +451,34 @@ function M({ onClose: e, side: r = "right", title: i, label: a, children: c, wid
393
451
  })]
394
452
  });
395
453
  }
396
- function N({ open: e, ...n }) {
397
- return e ? /* @__PURE__ */ t(M, { ...n }) : null;
454
+ function F({ open: e, ...n }) {
455
+ return e ? /* @__PURE__ */ t(P, { ...n }) : null;
398
456
  }
399
457
  // src/primitives/splitter/splitter-math.ts
400
- function P(e, t) {
458
+ function I(e, t) {
401
459
  let n = Math.max(t.min, t.max);
402
460
  return Math.round(Math.min(n, Math.max(t.min, e)));
403
461
  }
404
- function F(e, t, n, r) {
405
- return P(e + n * t, r);
462
+ function L(e, t, n, r) {
463
+ return I(e + n * t, r);
406
464
  }
407
- function I(e, t) {
465
+ function R(e, t) {
408
466
  return e === "vertical" ? t === "start" ? "ArrowLeft" : "ArrowRight" : t === "start" ? "ArrowUp" : "ArrowDown";
409
467
  }
410
- var L = {
468
+ var z = {
411
469
  ArrowLeft: "ArrowRight",
412
470
  ArrowRight: "ArrowLeft",
413
471
  ArrowUp: "ArrowDown",
414
472
  ArrowDown: "ArrowUp"
415
473
  };
416
- function R(e, t, n, r, i) {
417
- if (t === n) return P(e + r, i);
418
- if (t === L[n]) return P(e - r, i);
419
- if (t === "Home") return P(i.min, i);
420
- if (t === "End") return P(i.max, i);
474
+ function B(e, t, n, r, i) {
475
+ if (t === n) return I(e + r, i);
476
+ if (t === z[n]) return I(e - r, i);
477
+ if (t === "Home") return I(i.min, i);
478
+ if (t === "End") return I(i.max, i);
421
479
  }
422
480
  // src/primitives/splitter/Splitter.tsx
423
- function z({ orientation: e, value: n, min: r, max: i, onChange: a, label: o, edge: s = "start", step: c = 16, className: u, onPointerDown: d, onPointerMove: f, onPointerUp: p, onPointerCancel: m, onKeyDown: h, ...g }) {
481
+ function V({ orientation: e, value: n, min: r, max: i, onChange: a, label: o, edge: s = "start", step: c = 16, className: u, onPointerDown: d, onPointerMove: f, onPointerUp: p, onPointerCancel: m, onKeyDown: h, ...g }) {
424
482
  let _ = l(null), v = {
425
483
  min: r,
426
484
  max: i
@@ -438,7 +496,7 @@ function z({ orientation: e, value: n, min: r, max: i, onChange: a, label: o, ed
438
496
  f?.(e);
439
497
  let t = _.current;
440
498
  if (t === null) return;
441
- let r = F(t.start, y(e) - t.at, s === "start" ? -1 : 1, v);
499
+ let r = L(t.start, y(e) - t.at, s === "start" ? -1 : 1, v);
442
500
  r !== n && a(r);
443
501
  }
444
502
  function S(e) {
@@ -449,7 +507,7 @@ function z({ orientation: e, value: n, min: r, max: i, onChange: a, label: o, ed
449
507
  }
450
508
  function C(t) {
451
509
  if (h?.(t), t.defaultPrevented || t.altKey || t.ctrlKey || t.metaKey) return;
452
- let r = R(n, t.key, I(e, s), c, v);
510
+ let r = B(n, t.key, R(e, s), c, v);
453
511
  r !== void 0 && (t.preventDefault(), r !== n && a(r));
454
512
  }
455
513
  return /* @__PURE__ */ t("div", {
@@ -472,7 +530,7 @@ function z({ orientation: e, value: n, min: r, max: i, onChange: a, label: o, ed
472
530
  });
473
531
  }
474
532
  // src/primitives/text-input/TextInput.tsx
475
- function B({ font: e = "ui", type: n = "text", className: r, ...i }) {
533
+ function H({ font: e = "ui", type: n = "text", className: r, ...i }) {
476
534
  return /* @__PURE__ */ t("input", {
477
535
  ...i,
478
536
  type: n,
@@ -481,38 +539,38 @@ function B({ font: e = "ui", type: n = "text", className: r, ...i }) {
481
539
  });
482
540
  }
483
541
  // src/primitives/theme-switch/ThemeSwitch.tsx
484
- var V = {
542
+ var U = {
485
543
  theme: "Theme",
486
544
  system: "system",
487
545
  light: "light",
488
546
  dark: "dark",
489
547
  systemHint: "follows the system's setting",
490
548
  clickFor: "click for"
491
- }, H = [
549
+ }, W = [
492
550
  "system",
493
551
  "light",
494
552
  "dark"
495
553
  ];
496
- function U(e) {
497
- return H[(H.indexOf(e) + 1) % H.length] ?? "system";
554
+ function G(e) {
555
+ return W[(W.indexOf(e) + 1) % W.length] ?? "system";
498
556
  }
499
- function W(e, t = V) {
557
+ function K(e, t = U) {
500
558
  let n = e === "system" ? ` (${t.systemHint})` : "";
501
- return `${t.theme}: ${t[e]}${n}; ${t.clickFor} ${t[U(e)]}`;
559
+ return `${t.theme}: ${t[e]}${n}; ${t.clickFor} ${t[G(e)]}`;
502
560
  }
503
- function G({ choice: e, onChoose: r, labels: i, className: a, ...o }) {
561
+ function q({ choice: e, onChoose: r, labels: i, className: a, ...o }) {
504
562
  let s = {
505
- ...V,
563
+ ...U,
506
564
  ...i
507
565
  };
508
566
  return /* @__PURE__ */ n("button", {
509
567
  ...o,
510
568
  type: "button",
511
569
  className: a === void 0 ? "pb-theme-switch" : `pb-theme-switch ${a}`,
512
- title: W(e, s),
570
+ title: K(e, s),
513
571
  "aria-label": `${s.theme}: ${s[e]}`,
514
572
  onClick: () => {
515
- r(U(e));
573
+ r(G(e));
516
574
  },
517
575
  children: [/* @__PURE__ */ n("svg", {
518
576
  className: "pb-theme-switch-icon",
@@ -538,16 +596,16 @@ function G({ choice: e, onChoose: r, labels: i, className: a, ...o }) {
538
596
  });
539
597
  }
540
598
  // src/primitives/toolbar/roving.ts
541
- var K = "button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [role=\"button\"], [role=\"checkbox\"], [role=\"radio\"], [role=\"menuitem\"], [role=\"switch\"]";
542
- function q(e) {
543
- return [...e.querySelectorAll(K)].filter((t) => t.closest("[role=\"toolbar\"]") === e);
599
+ var J = "button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [role=\"button\"], [role=\"checkbox\"], [role=\"radio\"], [role=\"menuitem\"], [role=\"switch\"]";
600
+ function Y(e) {
601
+ return [...e.querySelectorAll(J)].filter((t) => t.closest("[role=\"toolbar\"]") === e);
544
602
  }
545
- function J(e, t) {
603
+ function X(e, t) {
546
604
  let n = t !== null && e.includes(t) ? t : e[0] ?? null;
547
605
  for (let t of e) t.tabIndex = t === n ? 0 : -1;
548
606
  return n;
549
607
  }
550
- function Y(e, t, n, r, i) {
608
+ function Z(e, t, n, r, i) {
551
609
  if (t === 0) return;
552
610
  if (n === "Home") return 0;
553
611
  if (n === "End") return t - 1;
@@ -555,7 +613,7 @@ function Y(e, t, n, r, i) {
555
613
  if (n === o) return (e + 1) % t;
556
614
  if (n === a) return (e - 1 + t) % t;
557
615
  }
558
- function X(e) {
616
+ function Q(e) {
559
617
  return e instanceof HTMLTextAreaElement ? !0 : e instanceof HTMLInputElement ? ![
560
618
  "button",
561
619
  "checkbox",
@@ -569,13 +627,13 @@ function X(e) {
569
627
  ].includes(e.type) : e instanceof HTMLElement && e.isContentEditable;
570
628
  }
571
629
  // src/primitives/toolbar/Toolbar.tsx
572
- function Z({ label: e, orientation: n = "horizontal", className: r, ref: i, onKeyDown: a, onFocus: s, children: c, ...u }) {
630
+ function $({ label: e, orientation: n = "horizontal", className: r, ref: i, onKeyDown: a, onFocus: s, children: c, ...u }) {
573
631
  let d = l(null), f = l(null);
574
632
  o(() => {
575
633
  let e = d.current;
576
634
  if (e === null) return;
577
635
  let t = () => {
578
- f.current = J(q(e), f.current);
636
+ f.current = X(Y(e), f.current);
579
637
  };
580
638
  t();
581
639
  let n = new MutationObserver(t);
@@ -592,16 +650,16 @@ function Z({ label: e, orientation: n = "horizontal", className: r, ref: i, onKe
592
650
  s?.(e);
593
651
  let t = d.current;
594
652
  if (t === null) return;
595
- let n = q(t);
596
- e.target instanceof HTMLElement && n.includes(e.target) && (f.current = J(n, e.target));
653
+ let n = Y(t);
654
+ e.target instanceof HTMLElement && n.includes(e.target) && (f.current = X(n, e.target));
597
655
  }
598
656
  function m(e) {
599
657
  a?.(e);
600
658
  let t = d.current;
601
- if (e.defaultPrevented || t === null || e.altKey || e.ctrlKey || e.metaKey || X(e.target)) return;
602
- let r = q(t), i = r.indexOf(e.target);
659
+ if (e.defaultPrevented || t === null || e.altKey || e.ctrlKey || e.metaKey || Q(e.target)) return;
660
+ let r = Y(t), i = r.indexOf(e.target);
603
661
  if (i === -1) return;
604
- let o = getComputedStyle(t).direction === "rtl", s = Y(i, r.length, e.key, n, o);
662
+ let o = getComputedStyle(t).direction === "rtl", s = Z(i, r.length, e.key, n, o);
605
663
  s !== void 0 && (e.preventDefault(), r[s]?.focus());
606
664
  }
607
665
  return /* @__PURE__ */ t("div", {
@@ -620,14 +678,14 @@ function Z({ label: e, orientation: n = "horizontal", className: r, ref: i, onKe
620
678
  });
621
679
  }
622
680
  // src/primitives/tool-group/ToolGroup.tsx
623
- function Q({ className: e, ...n }) {
624
- return /* @__PURE__ */ t(Z, {
681
+ function ee({ className: e, ...n }) {
682
+ return /* @__PURE__ */ t($, {
625
683
  ...n,
626
684
  className: e === void 0 ? "pb-tool-group" : `pb-tool-group ${e}`
627
685
  });
628
686
  }
629
687
  // src/primitives/warn-mark/WarnMark.tsx
630
- function $({ label: r, title: i, className: a }) {
688
+ function te({ label: r, title: i, className: a }) {
631
689
  return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("span", {
632
690
  className: a === void 0 ? "pb-warn-mark" : `pb-warn-mark ${a}`,
633
691
  "aria-hidden": "true",
@@ -638,6 +696,6 @@ function $({ label: r, title: i, className: a }) {
638
696
  children: r
639
697
  })] });
640
698
  }
641
- export { d as Badge, p as Button, h as Checkbox, S as Dialog, w as Field, g as IconButton, T as KeyValue, O as Panel, k as Pill, A as SectionTitle, j as Select, N as Sheet, f as Spinner, z as Splitter, B as TextInput, G as ThemeSwitch, Q as ToolGroup, Z as Toolbar, $ as WarnMark, V as defaultThemeSwitchLabels, W as themeSwitchTitle };
699
+ export { d as Badge, p as Button, h as Checkbox, S as Dialog, w as Field, g as IconButton, T as KeyValue, O as Panel, k as Pill, j as RadioGroup, M as SectionTitle, N as Select, F as Sheet, f as Spinner, V as Splitter, H as TextInput, q as ThemeSwitch, ee as ToolGroup, $ as Toolbar, te as WarnMark, U as defaultThemeSwitchLabels, K as themeSwitchTitle };
642
700
 
643
701
  //# sourceMappingURL=primitives.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"primitives.js","names":["_Fragment","Badge","className","tone","Spinner","rest","classes","label","Button","click","busy","event","onClick","size","assign","ref","value","Checkbox","own","useRef","setRef","useCallback","node","indeterminate","box","IconButton","title","CloseGlyph","focusable","tabbable","root","element","topmost","open","OpenDialog","boxRef","bodyRef","titleId","useId","onCloseRef","onClose","useEffect","before","body","keepFocus","controls","first","last","active","closeLabel","actions","Dialog","createPortal","present","Field","base","control","children","isValidElement","controlId","hintId","hint","errorId","error","describedBy","id","wired","cloneElement","layout","KeyValue","rows","row","index","overflows","useScrollFocus","settle","sizes","observeChildren","child","content","Panel","Heading","level","header","Pill","pulse","detail","SectionTitle","Select","font","OpenSheet","sheetRef","cameFrom","sheet","back","onFocus","from","onKeyDown","style","width","side","Sheet","clamp","max","bounds","dragged","start","sign","travel","growKey","orientation","edge","opposite","keyed","key","grow","step","Splitter","drag","along","down","onPointerDown","target","\"dragging\"","move","started","next","onChange","end","onPointerCancel","onPointerUp","min","TextInput","defaultThemeSwitchLabels","order","following","choice","themeSwitchTitle","labels","ThemeSwitch","words","itemSelector","items","toolbar","item","setTabStop","stop","current","all","moved","count","forth","rtl","editsText","Toolbar","watch","focus","ToolGroup","WarnMark","Fragment"],"sources":["../src/primitives/badge/Badge.tsx","../src/primitives/spinner/Spinner.tsx","../src/primitives/button/Button.tsx","../src/primitives/checkbox/Checkbox.tsx","../src/primitives/icon-button/IconButton.tsx","../src/primitives/dialog/CloseGlyph.tsx","../src/primitives/dialog/Dialog.tsx","../src/primitives/field/Field.tsx","../src/primitives/key-value/KeyValue.tsx","../src/primitives/panel/scroll-focus.ts","../src/primitives/panel/Panel.tsx","../src/primitives/pill/Pill.tsx","../src/primitives/section-title/SectionTitle.tsx","../src/primitives/select/Select.tsx","../src/primitives/sheet/Sheet.tsx","../src/primitives/splitter/splitter-math.ts","../src/primitives/splitter/Splitter.tsx","../src/primitives/text-input/TextInput.tsx","../src/primitives/theme-switch/ThemeSwitch.tsx","../src/primitives/toolbar/roving.ts","../src/primitives/toolbar/Toolbar.tsx","../src/primitives/tool-group/ToolGroup.tsx","../src/primitives/warn-mark/WarnMark.tsx"],"sourcesContent":["// A badge: a short word or count in a rounded chip, tinted by its tone (a count of retries, a \"not ready\"). A tone it\n// does not know is drawn neutrally.\nimport type { ReactNode } from \"react\";\nimport \"./Badge.css\";\n\n/** The tones a badge draws; any other string is drawn neutrally. */\nexport type BadgeTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | (string & {});\n\nexport type BadgeProps = {\n /** The badge's tone: its text and border colour, and for warn and err a soft surface. */\n tone: BadgeTone;\n /** What the badge says: a word, a count, a WarnMark beside them. */\n children: ReactNode;\n /** Shown on hover: what the badge means. */\n title?: string;\n /** A class added to the badge. */\n className?: string;\n};\n\n/** Draws a short word or count in a chip of its tone. */\nexport function Badge({ tone, children, title, className }: BadgeProps) {\n return (\n <span className={className === undefined ? \"pb-badge\" : `pb-badge ${className}`} data-tone={tone} title={title}>\n {children}\n </span>\n );\n}\n","// The busy mark: an open ring in the current text colour that turns once per --pb-motion-spin, and under reduced\n// motion stands still (the open ring is still the mark). Without a label it is decoration, hidden from screen\n// readers, as inside a busy Button, whose own words and aria-busy say what is happening. With a label it is a status\n// that screen readers announce.\nimport type { ComponentPropsWithRef } from \"react\";\nimport \"./Spinner.css\";\n\nexport type SpinnerProps = Omit<ComponentPropsWithRef<\"span\">, \"children\"> & {\n /** What is being waited for, read by screen readers; without it the spinner is hidden from them. */\n label?: string;\n};\n\nexport function Spinner({ label, className, ...rest }: SpinnerProps) {\n const classes = className === undefined ? \"pb-spinner\" : `pb-spinner ${className}`;\n if (label === undefined || label === \"\") {\n return <span {...rest} className={classes} aria-hidden=\"true\" />;\n }\n return (\n <span {...rest} className={`${classes} pb-spinner-labelled`} role=\"status\">\n <span className=\"pb-spinner-ring\" aria-hidden=\"true\" />\n <span className=\"pb-spinner-label\">{label}</span>\n </span>\n );\n}\n","// A push button in the library's look. Its tone (neutral, primary, danger, or any other word, drawn neutral) and size\n// are data attributes its stylesheet keys on. While busy it shows a Spinner over its words, which keep their place so\n// the button keeps its width, says aria-busy, and ignores presses (it stays focusable, unlike a disabled button, so\n// focus is not lost while a request is on its way).\nimport type { ComponentPropsWithRef, MouseEvent } from \"react\";\nimport { Spinner } from \"../spinner\";\nimport \"./Button.css\";\n\n/** What the button does, by colour: neutral (the default), primary (the one main action), danger; others draw neutral. */\nexport type ButtonTone = \"neutral\" | \"primary\" | \"danger\" | (string & {});\n\n/** md (the default) or sm, the compact one for dense rows; others draw as md. On touch both are at least 36 px tall. */\nexport type ButtonSize = \"md\" | \"sm\" | (string & {});\n\nexport type ButtonProps = ComponentPropsWithRef<\"button\"> & {\n tone?: ButtonTone;\n size?: ButtonSize;\n /** A request is on its way: a spinner over the words, aria-busy, and presses ignored. */\n busy?: boolean;\n};\n\nexport function Button({\n tone = \"neutral\",\n size = \"md\",\n busy = false,\n type = \"button\",\n className,\n children,\n onClick,\n ...rest\n}: ButtonProps) {\n function click(event: MouseEvent<HTMLButtonElement>) {\n if (busy) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n }\n return (\n <button\n {...rest}\n // A submit or reset button is asked for by name; a bare button inside a form never submits it.\n type={type}\n className={className === undefined ? \"pb-button\" : `pb-button ${className}`}\n data-tone={tone}\n data-size={size}\n aria-busy={busy || undefined}\n aria-disabled={busy || rest[\"aria-disabled\"] || undefined}\n onClick={click}\n >\n <span className=\"pb-button-content\">{children}</span>\n {busy && <Spinner className=\"pb-button-spinner\" />}\n </button>\n );\n}\n","// A tick box: a native checkbox (every native prop passes through, ref included, and id and aria props reach the\n// input, so Field can wire it), ticked in the accent. With a label it is wrapped in its own label, so a press on the\n// words ticks it too, and the row is a target a finger can find. Indeterminate (some of a group ticked) is a prop,\n// since HTML has it only as a DOM property.\nimport { useCallback, useLayoutEffect, useRef, type ComponentPropsWithRef, type ReactNode, type Ref } from \"react\";\nimport \"./Checkbox.css\";\n\nexport type CheckboxProps = Omit<ComponentPropsWithRef<\"input\">, \"type\"> & {\n /** The words beside the box, which tick it too; without them, name the box by a Field or aria-label. */\n label?: ReactNode;\n /** Neither ticked nor not: drawn as a dash and read as \"mixed\". */\n indeterminate?: boolean;\n};\n\nfunction assign<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref !== null && ref !== undefined) ref.current = value;\n}\n\nexport function Checkbox({ label, indeterminate = false, className, ref, ...rest }: CheckboxProps) {\n const own = useRef<HTMLInputElement | null>(null);\n const setRef = useCallback(\n (node: HTMLInputElement | null) => {\n own.current = node;\n assign(ref, node);\n },\n [ref],\n );\n useLayoutEffect(() => {\n if (own.current !== null) own.current.indeterminate = indeterminate;\n }, [indeterminate]);\n\n const box = (\n <input\n {...rest}\n ref={setRef}\n type=\"checkbox\"\n className={label === undefined && className !== undefined ? `pb-checkbox ${className}` : \"pb-checkbox\"}\n />\n );\n if (label === undefined) return box;\n return (\n <label\n className={className === undefined ? \"pb-checkbox-row\" : `pb-checkbox-row ${className}`}\n data-disabled={rest.disabled === true || undefined}\n >\n {box}\n <span className=\"pb-checkbox-label\">{label}</span>\n </label>\n );\n}\n","// A square button that shows a glyph and is named by its label: the label is its accessible name and, unless a title\n// is given, its tooltip, and the glyph is hidden from screen readers. Tone, size and busy are Button's.\nimport type { ReactNode } from \"react\";\nimport { Button, type ButtonProps } from \"../button\";\nimport \"./IconButton.css\";\n\nexport type IconButtonProps = Omit<ButtonProps, \"children\" | \"aria-label\"> & {\n /** The button's name for screen readers, and its tooltip unless title says otherwise. */\n label: string;\n /** The glyph: an icon or a character, hidden from screen readers. */\n children: ReactNode;\n};\n\nexport function IconButton({ label, title, className, children, ...rest }: IconButtonProps) {\n return (\n <Button\n {...rest}\n className={className === undefined ? \"pb-icon-button\" : `pb-icon-button ${className}`}\n aria-label={label}\n title={title ?? label}\n >\n <span className=\"pb-icon-button-glyph\" aria-hidden=\"true\">\n {children}\n </span>\n </Button>\n );\n}\n","// The cross on Dialog's and Sheet's close buttons, in the current text colour. Internal: not exported by the layer.\nexport function CloseGlyph() {\n return (\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\">\n <path d=\"M3 3l10 10M13 3L3 13\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.75\" />\n </svg>\n );\n}\n","// A modal dialog: drawn over the page (in a portal on <body>) above a scrim, with a title, a close button, the app's\n// content and an optional row of actions. While it is open, Tab and Shift+Tab stay inside it and focus that wanders\n// out is brought back; Escape, the close button and a press on the scrim ask the app to close it (onClose), and the\n// app closes it by setting open to false. Opening focuses the content's first control (or one the content focused\n// itself, as with autoFocus), else the dialog; the body is a tab stop of its own, so a long one scrolls from the\n// keyboard; closing gives focus back to what had it before. Only the topmost of\n// several open dialogs keeps the focus.\nimport { type ReactNode, type KeyboardEvent, useEffect, useId, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { IconButton } from \"../icon-button\";\nimport { CloseGlyph } from \"./CloseGlyph\";\nimport \"./Dialog.css\";\n\nexport type DialogProps = {\n /** Whether the dialog is shown; the app holds it. */\n open: boolean;\n /** Asked for on Escape, the close button and a press on the scrim. */\n onClose: () => void;\n /** The dialog's title, which also names it for screen readers. */\n title: ReactNode;\n children: ReactNode;\n /** A row at the foot of the dialog, for its buttons. */\n actions?: ReactNode;\n /** The close button's name: \"Close\". */\n closeLabel?: string;\n /** A class added to the dialog's box. */\n className?: string;\n};\n\nconst focusable = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled]):not([type='hidden'])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n \"[contenteditable='true']\",\n].join(\",\");\n\n/** The controls inside `root` that Tab reaches, in order. */\nfunction tabbable(root: HTMLElement): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>(focusable)].filter(\n (element) => element.closest(\"[hidden], [inert]\") === null && element.tabIndex >= 0,\n );\n}\n\n/** Whether `box` is the topmost open dialog: each opens in a portal appended to <body>, so the last one is on top. */\nfunction topmost(box: HTMLElement): boolean {\n const open = box.ownerDocument.querySelectorAll(\".pb-dialog\");\n return open[open.length - 1] === box;\n}\n\nfunction OpenDialog({ onClose, title, children, actions, closeLabel = \"Close\", className }: Omit<DialogProps, \"open\">) {\n const boxRef = useRef<HTMLDivElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onCloseRef.current = onClose;\n }, [onClose]);\n\n useEffect(() => {\n const box = boxRef.current;\n if (box === null) return undefined;\n const before = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n if (!box.contains(document.activeElement)) {\n const body = bodyRef.current;\n (body === null ? undefined : tabbable(body)[0])?.focus();\n if (!box.contains(document.activeElement)) box.focus();\n }\n const keepFocus = (event: FocusEvent) => {\n if (!topmost(box)) return;\n if (event.target instanceof Node && box.contains(event.target)) return;\n (tabbable(box)[0] ?? box).focus();\n };\n document.addEventListener(\"focusin\", keepFocus);\n return () => {\n document.removeEventListener(\"focusin\", keepFocus);\n if (before?.isConnected === true) before.focus();\n };\n }, []);\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n onCloseRef.current();\n return;\n }\n if (event.key !== \"Tab\" || boxRef.current === null) return;\n const controls = tabbable(boxRef.current);\n const first = controls[0];\n const last = controls[controls.length - 1];\n if (first === undefined || last === undefined) {\n event.preventDefault();\n return;\n }\n const active = document.activeElement;\n if (event.shiftKey && (active === first || active === boxRef.current)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n return (\n <div\n className=\"pb-dialog-scrim\"\n onMouseDown={(event) => {\n // Only a press that starts on the scrim itself: a drag out of a text field does not close.\n if (event.target === event.currentTarget) onCloseRef.current();\n }}\n >\n <div\n ref={boxRef}\n className={className === undefined ? \"pb-dialog\" : `pb-dialog ${className}`}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n tabIndex={-1}\n onKeyDown={onKeyDown}\n >\n <div className=\"pb-dialog-head\">\n <h2 className=\"pb-dialog-title\" id={titleId}>\n {title}\n </h2>\n <IconButton\n className=\"pb-dialog-close\"\n label={closeLabel}\n onClick={() => {\n onCloseRef.current();\n }}\n >\n <CloseGlyph />\n </IconButton>\n </div>\n {/* Focusable, so a body that scrolls can be scrolled from the keyboard. */}\n <div ref={bodyRef} className=\"pb-dialog-body\" tabIndex={0}>\n {children}\n </div>\n {actions === undefined ? null : <div className=\"pb-dialog-actions\">{actions}</div>}\n </div>\n </div>\n );\n}\n\nexport function Dialog({ open, ...rest }: DialogProps) {\n if (!open) return null;\n return createPortal(<OpenDialog {...rest} />, document.body);\n}\n","// A labelled form control: the label, the control (its one child), a hint under it and an error under that. It wires\n// the control to them itself: the control gets an id the label points at (its own id if it has one), aria-describedby\n// naming the hint and the error (after any ids it already has), and aria-invalid while there is an error. The control\n// is any element that passes those props on to its native element, as TextInput, Select and Checkbox do.\nimport {\n cloneElement,\n isValidElement,\n useId,\n type AriaAttributes,\n type ComponentPropsWithRef,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport \"./Field.css\";\n\n/** stacked (the default: the label above the control) or inline (the label in a column to its left); others stack. */\nexport type FieldLayout = \"stacked\" | \"inline\" | (string & {});\n\n/** The props Field sets on its control. */\nexport type FieldControlProps = {\n id?: string;\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: AriaAttributes[\"aria-invalid\"];\n};\n\nexport type FieldProps = Omit<ComponentPropsWithRef<\"div\">, \"children\"> & {\n /** What the control is, as its accessible name. */\n label: ReactNode;\n /** Why the value is refused; while there is one the control is marked invalid. Empty means none. */\n error?: ReactNode;\n /** A line of help under the control. */\n hint?: ReactNode;\n layout?: FieldLayout;\n /** The control: one element that passes id and aria props on to its native element. */\n children: ReactElement<FieldControlProps>;\n};\n\nfunction present(node: ReactNode): boolean {\n return node !== undefined && node !== null && node !== false && node !== \"\";\n}\n\nexport function Field({ label, error, hint, layout = \"stacked\", className, children, ...rest }: FieldProps) {\n const base = useId();\n const control: unknown = children;\n const own = isValidElement<FieldControlProps>(control) ? control.props : undefined;\n const controlId = own?.id ?? `${base}-control`;\n const hintId = present(hint) ? `${base}-hint` : undefined;\n const errorId = present(error) ? `${base}-error` : undefined;\n const describedBy = [own?.[\"aria-describedby\"], hintId, errorId].filter((id) => id !== undefined && id !== \"\");\n const wired =\n own === undefined\n ? children\n : cloneElement(children, {\n id: controlId,\n \"aria-describedby\": describedBy.length > 0 ? describedBy.join(\" \") : undefined,\n \"aria-invalid\": errorId !== undefined ? true : own[\"aria-invalid\"],\n });\n return (\n <div\n {...rest}\n className={className === undefined ? \"pb-field\" : `pb-field ${className}`}\n data-layout={layout}\n data-invalid={errorId !== undefined || undefined}\n >\n <label className=\"pb-field-label\" htmlFor={controlId}>\n {label}\n </label>\n <div className=\"pb-field-control\">\n {wired}\n {hintId !== undefined && (\n <div className=\"pb-field-hint\" id={hintId}>\n {hint}\n </div>\n )}\n {errorId !== undefined && (\n <div className=\"pb-field-error\" id={errorId}>\n {error}\n </div>\n )}\n </div>\n </div>\n );\n}\n","// Facts as a two-column list of keys and values (a status summary, an inspector's details), drawn as a <dl> so each key\n// names its value for screen readers. A row's tone colours its value; a tone it does not know leaves it plain.\nimport type { ReactNode } from \"react\";\nimport \"./KeyValue.css\";\n\n/** The tones a value draws in; any other string leaves it plain. */\nexport type KeyValueTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | (string & {});\n\nexport type KeyValueRow = {\n /** The fact's name. */\n key: string;\n /** Its value. */\n value: ReactNode;\n /** Colours the value: a fact that is wrong or worth a look. */\n tone?: KeyValueTone;\n /** Shown on hover over the key: what the fact means. */\n title?: string;\n};\n\nexport type KeyValueProps = {\n /** The facts, in order. */\n rows: readonly KeyValueRow[];\n /** Names the list for screen readers when no heading does. */\n label?: string;\n /** A class added to the list. */\n className?: string;\n};\n\n/** Draws facts as keys and their values, side by side. */\nexport function KeyValue({ rows, label, className }: KeyValueProps) {\n return (\n <dl className={className === undefined ? \"pb-key-value\" : `pb-key-value ${className}`} aria-label={label}>\n {rows.map((row, index) => (\n // Rows have no identity beyond their place; two may share a key.\n <div key={index} className=\"pb-key-value-row\" data-tone={row.tone}>\n <dt title={row.title}>{row.key}</dt>\n <dd>{row.value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n","// Keeps a scrolling box reachable by keyboard: while its content overflows it is a tab stop (so the arrow keys and Page\n// Up and Down scroll it), and while everything fits it is not, so a short panel adds no empty stop to the tab order.\nimport { useEffect, type RefObject } from \"react\";\n\n/** Whether `box`'s content is taller or wider than the box. */\nexport function overflows(box: HTMLElement): boolean {\n return box.scrollHeight > box.clientHeight || box.scrollWidth > box.clientWidth;\n}\n\n/** Makes `ref`'s box focusable exactly while it overflows, watching its size and its content. */\nexport function useScrollFocus(ref: RefObject<HTMLElement | null>): void {\n useEffect(() => {\n const box = ref.current;\n if (box === null) return;\n const settle = () => {\n if (overflows(box)) box.tabIndex = 0;\n else box.removeAttribute(\"tabindex\");\n };\n settle();\n // jsdom has no ResizeObserver; the content watch still runs there.\n const sizes = typeof ResizeObserver === \"function\" ? new ResizeObserver(settle) : null;\n const observeChildren = () => {\n if (sizes === null) return;\n sizes.disconnect();\n sizes.observe(box);\n for (const child of box.children) sizes.observe(child);\n };\n observeChildren();\n const content = new MutationObserver(() => {\n observeChildren();\n settle();\n });\n content.observe(box, { childList: true, subtree: true, characterData: true });\n return () => {\n sizes?.disconnect();\n content.disconnect();\n };\n }, [ref]);\n}\n","// A panel: a region of the page with an optional header (its title, and actions at the far end) over a body that\n// scrolls on its own, as an inspector or a side panel. It draws no outer border: the layout that places it (a docked\n// side, a sheet, a card) draws its edges. Its title names the region for screen readers. While its body overflows, the\n// body is a tab stop, so the keyboard can scroll it.\nimport { useId, useRef, type ComponentPropsWithRef, type ReactNode } from \"react\";\nimport { useScrollFocus } from \"./scroll-focus\";\nimport \"./Panel.css\";\n\nexport type PanelProps = Omit<ComponentPropsWithRef<\"section\">, \"title\"> & {\n /** The panel's heading; it also names the region. Without one, name it with aria-label. */\n title?: ReactNode;\n /** Slot at the header's far end: buttons, a count, a close button. */\n actions?: ReactNode;\n /** The title's heading level, h1 to h6; h2 by default. */\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n children?: ReactNode;\n};\n\n/** Draws a titled region with its actions and a body that scrolls. */\nexport function Panel({ title, actions, level = 2, className, children, ...rest }: PanelProps) {\n const titleId = useId();\n const body = useRef<HTMLDivElement>(null);\n useScrollFocus(body);\n const Heading = `h${String(level)}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n const header = title !== undefined || actions !== undefined;\n return (\n <section\n {...rest}\n aria-labelledby={\n rest[\"aria-labelledby\"] ?? (title !== undefined && rest[\"aria-label\"] === undefined ? titleId : undefined)\n }\n className={className === undefined ? \"pb-panel\" : `pb-panel ${className}`}\n >\n {header && (\n <header className=\"pb-panel-header\">\n {title !== undefined && (\n <Heading id={titleId} className=\"pb-panel-title\">\n {title}\n </Heading>\n )}\n {actions !== undefined && <div className=\"pb-panel-actions\">{actions}</div>}\n </header>\n )}\n <div ref={body} className=\"pb-panel-body\">\n {children}\n </div>\n </section>\n );\n}\n","// A state pill: a dot in the state's tone and the word beside it, so the state never rests on colour alone. A tone it\n// does not know is drawn neutrally, by its own word.\nimport type { ReactNode } from \"react\";\nimport \"./Pill.css\";\n\n/** The tones a pill draws; any other string is drawn neutrally. */\nexport type PillTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | (string & {});\n\nexport type PillProps = {\n /** The state's tone: the dot's and the word's colour. */\n tone: PillTone;\n /** The state in words, always shown beside the dot. */\n label: string;\n /** Pulses the dot (never the word) while the state is on its way, such as \"starting\"; stops under reduced motion. */\n pulse?: boolean;\n /** Shown on hover: what the state means or why it is so. */\n title?: string;\n /** After the word, in code type: a failure's code, say. */\n detail?: ReactNode;\n /** A class added to the pill. */\n className?: string;\n};\n\n/** Draws a state as a dot and its word, in the state's tone. */\nexport function Pill({ tone, label, pulse = false, title, detail, className }: PillProps) {\n return (\n <span\n className={className === undefined ? \"pb-pill\" : `pb-pill ${className}`}\n data-tone={tone}\n data-pulse={pulse ? \"\" : undefined}\n title={title}\n >\n <span className=\"pb-pill-dot\" aria-hidden=\"true\" />\n {label}\n {detail !== undefined && <code className=\"pb-pill-detail\">{detail}</code>}\n </span>\n );\n}\n","// A section's title in a panel or inspector, a heading with its actions (buttons, a count) at the far end. The\n// heading's level fits the page it sits in.\nimport type { ReactNode } from \"react\";\nimport \"./SectionTitle.css\";\n\nexport type SectionTitleProps = {\n /** The title. */\n children: ReactNode;\n /** Slot at the title's far end: buttons, a count, a badge. */\n actions?: ReactNode;\n /** The heading's level, h2 to h6. */\n level?: 2 | 3 | 4 | 5 | 6;\n /** A class added to the title's row. */\n className?: string;\n};\n\n/** Draws a section's heading, with its actions at the far end. */\nexport function SectionTitle({ children, actions, level = 3, className }: SectionTitleProps) {\n const Heading = `h${level}` as const;\n return (\n <div className={className === undefined ? \"pb-section-title\" : `pb-section-title ${className}`}>\n <Heading className=\"pb-section-title-text\">{children}</Heading>\n {actions !== undefined && <div className=\"pb-section-title-actions\">{actions}</div>}\n </div>\n );\n}\n","// A drop-down choice in the library's look: a native select (every native prop passes through, ref included; its\n// options are its children), so the platform's own list opens, the keyboard works as the platform's does, and a phone\n// shows its picker. It shows aria-invalid in the error tone, as Field sets it. On a touch screen its text is 16 px, as\n// iOS Safari zooms the page when a smaller field takes the focus.\nimport type { ComponentPropsWithRef } from \"react\";\nimport \"./Select.css\";\n\n/** ui (the default) or code, the monospace face for values written as code; others draw as ui. */\nexport type SelectFont = \"ui\" | \"code\" | (string & {});\n\nexport type SelectProps = ComponentPropsWithRef<\"select\"> & {\n font?: SelectFont;\n};\n\nexport function Select({ font = \"ui\", className, children, ...rest }: SelectProps) {\n return (\n <select {...rest} className={className === undefined ? \"pb-select\" : `pb-select ${className}`} data-font={font}>\n {children}\n </select>\n );\n}\n","// A sheet: a panel drawn over its container's right edge or rising from its bottom, as an inspector is on a narrow\n// window or a phone. It is not modal: the page around it stays live, and opening it does not take the focus (a\n// selection on the canvas opens it while the person is still working there). Escape inside it and its close button\n// ask the app to close it; if the focus was inside when it closes, it goes back to where it came from. The sheet is\n// placed absolutely, so its container (the app's workspace) is positioned; the app holds open, and chooses the side\n// (the right edge below 760 px, the bottom below 600 px).\nimport {\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type CSSProperties,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { CloseGlyph } from \"../dialog/CloseGlyph\";\nimport { IconButton } from \"../icon-button\";\nimport \"./Sheet.css\";\n\nexport type SheetSide = \"right\" | \"bottom\";\n\nexport type SheetProps = {\n /** Whether the sheet is shown; the app holds it. */\n open: boolean;\n /** Asked for on Escape inside the sheet and on its close button. */\n onClose: () => void;\n /** The edge it is drawn from: the right edge (the default) or the bottom. */\n side?: SheetSide;\n /** The sheet's title, which also names it for screen readers; without one, name it with `label`. */\n title?: ReactNode;\n /** The sheet's name for screen readers when it has no title. */\n label?: string;\n children: ReactNode;\n /** A right sheet's width in px, held to 280–560 px and to 48 px short of its container. */\n width?: number;\n /** The close button's name: \"Close\". */\n closeLabel?: string;\n /** A class added to the sheet. */\n className?: string;\n};\n\nfunction OpenSheet({\n onClose,\n side = \"right\",\n title,\n label,\n children,\n width,\n closeLabel = \"Close\",\n className,\n}: Omit<SheetProps, \"open\">) {\n const sheetRef = useRef<HTMLElement>(null);\n const titleId = useId();\n /** Where the focus came from when it entered the sheet: it goes back there if the sheet closes holding it. */\n const cameFrom = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n const sheet = sheetRef.current;\n return () => {\n const back = cameFrom.current;\n const active = document.activeElement;\n const held = active === null || active === document.body || (sheet?.contains(active) ?? false);\n if (held && back?.isConnected === true) back.focus();\n };\n }, []);\n\n const onFocus = (event: FocusEvent<HTMLElement>) => {\n const from = event.relatedTarget;\n if (from instanceof HTMLElement && !event.currentTarget.contains(from)) cameFrom.current = from;\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (event.defaultPrevented || event.key !== \"Escape\") return;\n event.preventDefault();\n event.stopPropagation();\n onClose();\n };\n\n const style = width === undefined ? undefined : ({ \"--pb-sheet-width\": `${width}px` } as CSSProperties);\n\n return (\n <section\n ref={sheetRef}\n className={className === undefined ? \"pb-sheet\" : `pb-sheet ${className}`}\n data-side={side}\n role=\"dialog\"\n aria-labelledby={title === undefined ? undefined : titleId}\n aria-label={title === undefined ? label : undefined}\n style={style}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n >\n <div className=\"pb-sheet-head\">\n {title === undefined ? (\n <span className=\"pb-sheet-title\" />\n ) : (\n <h2 className=\"pb-sheet-title\" id={titleId}>\n {title}\n </h2>\n )}\n <IconButton className=\"pb-sheet-close\" label={closeLabel} onClick={onClose}>\n <CloseGlyph />\n </IconButton>\n </div>\n {/* Focusable, so a body that scrolls can be scrolled from the keyboard. */}\n <div className=\"pb-sheet-body\" tabIndex={0}>\n {children}\n </div>\n </section>\n );\n}\n\nexport function Sheet({ open, ...rest }: SheetProps) {\n if (!open) return null;\n return <OpenSheet {...rest} />;\n}\n","// A splitter's maths, pure: a size kept within its bounds, a drag, and a key. Splitter.tsx draws and listens; this\n// file decides the size.\n\n/** The smallest and largest size, in px. */\nexport interface Bounds {\n min: number;\n max: number;\n}\n\n/** `value` within `bounds`, in whole px. A max below the min is read as the min. */\nexport function clamp(value: number, bounds: Bounds): number {\n const max = Math.max(bounds.min, bounds.max);\n return Math.round(Math.min(max, Math.max(bounds.min, value)));\n}\n\n/**\n * A drag: the size at the drag's start plus the pointer's travel times `sign`, clamped. The sign is -1 for a splitter on\n * the start edge (left or top) of what it resizes, where moving left or up grows it, and 1 on the end edge.\n */\nexport function dragged(start: number, travel: number, sign: 1 | -1, bounds: Bounds): number {\n return clamp(start + sign * travel, bounds);\n}\n\n/** Which arrow grows what the splitter resizes, from its orientation and the edge it sits on. */\nexport function growKey(orientation: \"vertical\" | \"horizontal\", edge: \"start\" | \"end\"): string {\n if (orientation === \"vertical\") return edge === \"start\" ? \"ArrowLeft\" : \"ArrowRight\";\n return edge === \"start\" ? \"ArrowUp\" : \"ArrowDown\";\n}\n\nconst opposite: Record<string, string> = {\n ArrowLeft: \"ArrowRight\",\n ArrowRight: \"ArrowLeft\",\n ArrowUp: \"ArrowDown\",\n ArrowDown: \"ArrowUp\",\n};\n\n/**\n * A key on a focused splitter: `grow` adds `step` and its opposite arrow takes it away, clamped; Home goes to the min\n * and End to the max; any other key gives undefined (the key is not the splitter's).\n */\nexport function keyed(value: number, key: string, grow: string, step: number, bounds: Bounds): number | undefined {\n if (key === grow) return clamp(value + step, bounds);\n if (key === opposite[grow]) return clamp(value - step, bounds);\n if (key === \"Home\") return clamp(bounds.min, bounds);\n if (key === \"End\") return clamp(bounds.max, bounds);\n return undefined;\n}\n","// A resize handle, as a WAI-ARIA separator: the edge of a pane, dragged with the pointer or moved by the arrow keys,\n// Home and End while focused. It keeps only the drag in progress; the size is the app's (value and onChange). It sits\n// absolutely on one edge of its positioned parent, the pane it resizes. splitter-math.ts holds the maths.\nimport { useRef, type ComponentPropsWithRef, type KeyboardEvent, type PointerEvent } from \"react\";\nimport { dragged, growKey, keyed } from \"./splitter-math\";\nimport \"./Splitter.css\";\n\n/** vertical: a vertical bar that resizes a width; horizontal: a horizontal bar that resizes a height. */\nexport type SplitterOrientation = \"vertical\" | \"horizontal\";\n\n/** The edge of the resized pane the splitter sits on: start is its left or top, end its right or bottom. */\nexport type SplitterEdge = \"start\" | \"end\";\n\nexport type SplitterProps = Omit<\n ComponentPropsWithRef<\"div\">,\n \"onChange\" | \"children\" | \"role\" | \"aria-orientation\" | \"aria-valuenow\" | \"aria-valuemin\" | \"aria-valuemax\"\n> & {\n orientation: SplitterOrientation;\n /** The pane's size in px. */\n value: number;\n /** The smallest size in px. */\n min: number;\n /** The largest size in px. */\n max: number;\n /** A new size, in whole px within min and max. */\n onChange: (px: number) => void;\n /** The separator's accessible name, such as \"Resize the inspector\". */\n label: string;\n /** Which edge of the pane it sits on; start (left or top) by default, where moving left or up grows the pane. */\n edge?: SplitterEdge;\n /** How far one arrow key moves it, in px; 16 by default. */\n step?: number;\n};\n\n/** Draws a pane's resize handle, dragged by pointer or moved by keys. */\nexport function Splitter({\n orientation,\n value,\n min,\n max,\n onChange,\n label,\n edge = \"start\",\n step = 16,\n className,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n onKeyDown,\n ...rest\n}: SplitterProps) {\n const drag = useRef<{ start: number; at: number } | null>(null);\n const bounds = { min, max };\n const along = (event: PointerEvent) => (orientation === \"vertical\" ? event.clientX : event.clientY);\n\n function down(event: PointerEvent<HTMLDivElement>) {\n onPointerDown?.(event);\n if (event.defaultPrevented || event.button !== 0) return;\n event.preventDefault();\n const target = event.currentTarget;\n // Captured, the drag follows the pointer past the bar's few px; jsdom has no capture.\n if (typeof target.setPointerCapture === \"function\") target.setPointerCapture(event.pointerId);\n target.focus();\n target.dataset[\"dragging\"] = \"\";\n drag.current = { start: value, at: along(event) };\n }\n function move(event: PointerEvent<HTMLDivElement>) {\n onPointerMove?.(event);\n const started = drag.current;\n if (started === null) return;\n const next = dragged(started.start, along(event) - started.at, edge === \"start\" ? -1 : 1, bounds);\n if (next !== value) onChange(next);\n }\n function end(event: PointerEvent<HTMLDivElement>) {\n if (event.type === \"pointercancel\") onPointerCancel?.(event);\n else onPointerUp?.(event);\n if (drag.current === null) return;\n drag.current = null;\n const target = event.currentTarget;\n delete target.dataset[\"dragging\"];\n if (typeof target.hasPointerCapture === \"function\" && target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n }\n function key(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n const next = keyed(value, event.key, growKey(orientation, edge), step, bounds);\n if (next === undefined) return;\n event.preventDefault();\n if (next !== value) onChange(next);\n }\n\n return (\n <div\n {...rest}\n role=\"separator\"\n tabIndex={rest.tabIndex ?? 0}\n aria-orientation={orientation}\n aria-label={label}\n aria-valuenow={value}\n aria-valuemin={min}\n aria-valuemax={max}\n className={className === undefined ? \"pb-splitter\" : `pb-splitter ${className}`}\n data-orientation={orientation}\n data-edge={edge}\n onPointerDown={down}\n onPointerMove={move}\n onPointerUp={end}\n onPointerCancel={end}\n onKeyDown={key}\n />\n );\n}\n","// A one-line text field in the library's look: a native input (every native prop passes through, ref included), in\n// the UI face or the code face. It shows aria-invalid in the error tone, as Field sets it. On a touch screen its text is\n// 16 px, as iOS Safari zooms the page when a smaller field takes the focus.\nimport type { ComponentPropsWithRef } from \"react\";\nimport \"./TextInput.css\";\n\n/** ui (the default) or code, the monospace face for values written as code; others draw as ui. */\nexport type TextInputFont = \"ui\" | \"code\" | (string & {});\n\nexport type TextInputProps = ComponentPropsWithRef<\"input\"> & {\n font?: TextInputFont;\n};\n\nexport function TextInput({ font = \"ui\", type = \"text\", className, ...rest }: TextInputProps) {\n return (\n <input\n {...rest}\n type={type}\n className={className === undefined ? \"pb-text-input\" : `pb-text-input ${className}`}\n data-font={font}\n />\n );\n}\n","// The theme switch: one button that cycles system, light and dark. Its word is shown beside the icon, and its\n// accessible name always says the choice, so it is never just a glyph; the icon is SVG, since a font may lack a ◐\n// character. The choice is the app's (useTheme keeps it); the switch only says it and asks for the next. At phone\n// width the word gives way to the icon alone, and the name still says the choice.\nimport type { ComponentPropsWithRef } from \"react\";\nimport type { ThemeChoice } from \"../../hooks/use-theme/useTheme\";\nimport \"./ThemeSwitch.css\";\n\nexport type { ThemeChoice };\n\n/** The switch's words, each replaceable. */\nexport interface ThemeSwitchLabels {\n /** What the switch is: \"Theme\". */\n theme: string;\n system: string;\n light: string;\n dark: string;\n /** Said of system in the tooltip: \"follows the system's setting\". */\n systemHint: string;\n /** Before the next choice in the tooltip: \"click for\". */\n clickFor: string;\n}\n\nexport const defaultThemeSwitchLabels: ThemeSwitchLabels = {\n theme: \"Theme\",\n system: \"system\",\n light: \"light\",\n dark: \"dark\",\n systemHint: \"follows the system's setting\",\n clickFor: \"click for\",\n};\n\nconst order: readonly ThemeChoice[] = [\"system\", \"light\", \"dark\"];\n\n/** The choice a press moves to: system, light, dark and back. */\nfunction following(choice: ThemeChoice): ThemeChoice {\n return order[(order.indexOf(choice) + 1) % order.length] ?? \"system\";\n}\n\nexport type ThemeSwitchProps = Omit<ComponentPropsWithRef<\"button\">, \"children\" | \"onClick\" | \"type\" | \"title\"> & {\n /** The theme now. */\n choice: ThemeChoice;\n /** Called with the next choice in the cycle when the switch is pressed. */\n onChoose: (next: ThemeChoice) => void;\n /** Words to replace; the rest keep their defaults. */\n labels?: Partial<ThemeSwitchLabels>;\n};\n\n/** The switch's tooltip: what the theme is and what a press does. */\nexport function themeSwitchTitle(choice: ThemeChoice, labels: ThemeSwitchLabels = defaultThemeSwitchLabels): string {\n const hint = choice === \"system\" ? ` (${labels.systemHint})` : \"\";\n return `${labels.theme}: ${labels[choice]}${hint}; ${labels.clickFor} ${labels[following(choice)]}`;\n}\n\nexport function ThemeSwitch({ choice, onChoose, labels, className, ...rest }: ThemeSwitchProps) {\n const words = { ...defaultThemeSwitchLabels, ...labels };\n return (\n <button\n {...rest}\n type=\"button\"\n className={className === undefined ? \"pb-theme-switch\" : `pb-theme-switch ${className}`}\n title={themeSwitchTitle(choice, words)}\n aria-label={`${words.theme}: ${words[choice]}`}\n onClick={() => {\n onChoose(following(choice));\n }}\n >\n <svg className=\"pb-theme-switch-icon\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <circle cx=\"8\" cy=\"8\" r=\"6.25\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M8 1.75a6.25 6.25 0 0 1 0 12.5z\" fill=\"currentColor\" />\n </svg>\n <span className=\"pb-theme-switch-word\">{words[choice]}</span>\n </button>\n );\n}\n","// Roving focus over a toolbar's items, pure DOM: which elements are items, which one holds the toolbar's one tab stop,\n// and where an arrow key, Home or End moves the focus. Toolbar.tsx wires it to React.\n\n/** What counts as an item: an enabled control, or anything that says it is a button, checkbox or radio. */\nexport const itemSelector = [\n \"button:not(:disabled)\",\n \"a[href]\",\n \"input:not(:disabled)\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n '[role=\"button\"]',\n '[role=\"checkbox\"]',\n '[role=\"radio\"]',\n '[role=\"menuitem\"]',\n '[role=\"switch\"]',\n].join(\", \");\n\n/** The toolbar's items, in document order, leaving out those of a toolbar nested inside it. */\nexport function items(toolbar: HTMLElement): HTMLElement[] {\n return [...toolbar.querySelectorAll<HTMLElement>(itemSelector)].filter(\n (item) => item.closest('[role=\"toolbar\"]') === toolbar,\n );\n}\n\n/** Gives `current` the one tab stop (0) and every other item -1; with no current, the first item takes it. */\nexport function setTabStop(all: readonly HTMLElement[], current: HTMLElement | null): HTMLElement | null {\n const stop = current !== null && all.includes(current) ? current : (all[0] ?? null);\n for (const item of all) item.tabIndex = item === stop ? 0 : -1;\n return stop;\n}\n\n/**\n * The item a key moves the focus to from `index`, or undefined when the key is not the toolbar's. Horizontal toolbars\n * take the left and right arrows (swapped right to left), vertical ones up and down; both take Home and End. The ends\n * wrap around.\n */\nexport function moved(\n index: number,\n count: number,\n key: string,\n orientation: \"horizontal\" | \"vertical\",\n rtl: boolean,\n): number | undefined {\n if (count === 0) return undefined;\n if (key === \"Home\") return 0;\n if (key === \"End\") return count - 1;\n const [back, forth] =\n orientation === \"vertical\"\n ? [\"ArrowUp\", \"ArrowDown\"]\n : rtl\n ? [\"ArrowRight\", \"ArrowLeft\"]\n : [\"ArrowLeft\", \"ArrowRight\"];\n if (key === forth) return (index + 1) % count;\n if (key === back) return (index - 1 + count) % count;\n return undefined;\n}\n\n/** Whether a key pressed in `element` belongs to the text it edits (arrows, Home and End move its caret). */\nexport function editsText(element: Element): boolean {\n if (element instanceof HTMLTextAreaElement) return true;\n if (element instanceof HTMLInputElement) {\n return ![\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\", \"image\", \"color\", \"file\", \"range\"].includes(\n element.type,\n );\n }\n return element instanceof HTMLElement && element.isContentEditable;\n}\n","// A WAI-ARIA toolbar: a row (or column) of controls that is one tab stop, the arrow keys, Home and End moving the focus\n// between its items (roving tabindex). The items are whatever controls its children render; the toolbar sets their\n// tabIndex itself, so an item's own tabIndex is overwritten. The item last focused keeps the tab stop, and a text field\n// inside keeps its own arrow keys. roving.ts holds the rules.\nimport { useEffect, useRef, type ComponentPropsWithRef, type FocusEvent, type KeyboardEvent } from \"react\";\nimport { editsText, items, moved, setTabStop } from \"./roving\";\nimport \"./Toolbar.css\";\n\nexport type ToolbarOrientation = \"horizontal\" | \"vertical\";\n\nexport type ToolbarProps = Omit<ComponentPropsWithRef<\"div\">, \"role\" | \"aria-orientation\"> & {\n /** The toolbar's accessible name, such as \"Canvas\". */\n label: string;\n /** horizontal (the default) moves with the left and right arrows; vertical with up and down. */\n orientation?: ToolbarOrientation;\n};\n\n/** Draws a group of controls as one tab stop, with the arrow keys moving between them. */\nexport function Toolbar({\n label,\n orientation = \"horizontal\",\n className,\n ref,\n onKeyDown,\n onFocus,\n children,\n ...rest\n}: ToolbarProps) {\n const own = useRef<HTMLDivElement | null>(null);\n const current = useRef<HTMLElement | null>(null);\n\n // After every render, and whenever an item comes, goes or is enabled or disabled, one item holds the tab stop.\n useEffect(() => {\n const toolbar = own.current;\n if (toolbar === null) return;\n const settle = () => {\n current.current = setTabStop(items(toolbar), current.current);\n };\n settle();\n const watch = new MutationObserver(settle);\n watch.observe(toolbar, { childList: true, subtree: true, attributes: true, attributeFilter: [\"disabled\", \"href\"] });\n return () => {\n watch.disconnect();\n };\n });\n\n function focus(event: FocusEvent<HTMLDivElement>) {\n onFocus?.(event);\n const toolbar = own.current;\n if (toolbar === null) return;\n const all = items(toolbar);\n if (event.target instanceof HTMLElement && all.includes(event.target)) {\n current.current = setTabStop(all, event.target);\n }\n }\n function key(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n const toolbar = own.current;\n if (event.defaultPrevented || toolbar === null || event.altKey || event.ctrlKey || event.metaKey) return;\n if (editsText(event.target as Element)) return;\n const all = items(toolbar);\n const index = all.indexOf(event.target as HTMLElement);\n if (index === -1) return;\n const rtl = getComputedStyle(toolbar).direction === \"rtl\";\n const next = moved(index, all.length, event.key, orientation, rtl);\n if (next === undefined) return;\n event.preventDefault();\n all[next]?.focus();\n }\n\n return (\n <div\n {...rest}\n ref={(element) => {\n own.current = element;\n if (typeof ref === \"function\") return ref(element);\n if (ref) ref.current = element;\n return undefined;\n }}\n role=\"toolbar\"\n aria-label={label}\n aria-orientation={orientation}\n className={className === undefined ? \"pb-toolbar\" : `pb-toolbar ${className}`}\n onKeyDown={key}\n onFocus={focus}\n >\n {children}\n </div>\n );\n}\n","// A floating group of tools, such as a canvas's zoom, fit and minimap: a Toolbar drawn as one raised, framed group of\n// square buttons. Its tools are IconButtons (or plain <button>s named by aria-label with their\n// glyph hidden); a pressed one (aria-pressed) is drawn in the accent. 28 px buttons, 40 px on touch.\nimport { Toolbar, type ToolbarProps } from \"../toolbar\";\nimport \"./ToolGroup.css\";\n\nexport type ToolGroupProps = ToolbarProps;\n\n/** Draws a framed group of square tool buttons, one tab stop with roving focus. */\nexport function ToolGroup({ className, ...rest }: ToolGroupProps) {\n return <Toolbar {...rest} className={className === undefined ? \"pb-tool-group\" : `pb-tool-group ${className}`} />;\n}\n","// The warning mark: an \"!\" in a circle beside words, for something that rose lately (a badge's or a counter's). The\n// glyph is hidden from screen readers, which read its label instead.\nimport \"./WarnMark.css\";\n\nexport type WarnMarkProps = {\n /** What the mark means, read by screen readers in its place. */\n label: string;\n /** Shown on hover over the mark. */\n title?: string;\n /** A class added to the mark. */\n className?: string;\n};\n\n/** Draws a warning \"!\" for the eye and its words for screen readers. */\nexport function WarnMark({ label, title, className }: WarnMarkProps) {\n return (\n <>\n <span\n className={className === undefined ? \"pb-warn-mark\" : `pb-warn-mark ${className}`}\n aria-hidden=\"true\"\n title={title}\n >\n !\n </span>\n <span className=\"pb-warn-mark-text\">{label}</span>\n </>\n );\n}\n"],"mappings":";;;;AAoBA,SAAgBC,EAAM,EAAE,SAAM,aAAU,UAAO,gBAAyB;C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AAA,EAAA,UAAA,CACE,kBAAC,QAAD;EACE,WAAWE,MAAc,KAAA,IAAY,iBAAiB,gBAAgBA;EACtE,eAAY;EACL;EACR,UAAA;CAEK,CAAA,GACN,kBAAC,QAAD;EAAM,WAAU;EAAqB,UAAAK;CAAY,CAAA,CACjD,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"primitives.js","names":["present","_Fragment","Badge","className","tone","Spinner","rest","classes","label","Button","click","busy","event","onClick","size","assign","ref","value","Checkbox","own","useRef","setRef","useCallback","node","indeterminate","box","IconButton","title","CloseGlyph","focusable","tabbable","root","element","topmost","open","OpenDialog","boxRef","bodyRef","titleId","useId","onCloseRef","onClose","useEffect","before","body","keepFocus","controls","first","last","active","closeLabel","actions","Dialog","createPortal","present$1","Field","base","control","children","isValidElement","controlId","hintId","hint","errorId","error","describedBy","id","wired","cloneElement","layout","KeyValue","rows","row","index","overflows","useScrollFocus","settle","sizes","observeChildren","child","content","Panel","Heading","level","header","Pill","pulse","detail","present","RadioGroup","describedByOwn","invalidOwn","groupName","name","legendHidden","legend","options","option","SectionTitle","Select","font","OpenSheet","sheetRef","cameFrom","sheet","back","onFocus","from","onKeyDown","style","width","side","Sheet","clamp","max","bounds","dragged","start","sign","travel","growKey","orientation","edge","opposite","keyed","key","grow","step","Splitter","drag","along","down","onPointerDown","target","\"dragging\"","move","started","next","onChange","end","onPointerCancel","onPointerUp","min","TextInput","defaultThemeSwitchLabels","order","following","choice","themeSwitchTitle","labels","ThemeSwitch","words","itemSelector","items","toolbar","item","setTabStop","stop","current","all","moved","count","forth","rtl","editsText","Toolbar","watch","focus","ToolGroup","WarnMark","Fragment"],"sources":["../src/primitives/badge/Badge.tsx","../src/primitives/spinner/Spinner.tsx","../src/primitives/button/Button.tsx","../src/primitives/checkbox/Checkbox.tsx","../src/primitives/icon-button/IconButton.tsx","../src/primitives/dialog/CloseGlyph.tsx","../src/primitives/dialog/Dialog.tsx","../src/primitives/field/Field.tsx","../src/primitives/key-value/KeyValue.tsx","../src/primitives/panel/scroll-focus.ts","../src/primitives/panel/Panel.tsx","../src/primitives/pill/Pill.tsx","../src/primitives/radio-group/RadioGroup.tsx","../src/primitives/section-title/SectionTitle.tsx","../src/primitives/select/Select.tsx","../src/primitives/sheet/Sheet.tsx","../src/primitives/splitter/splitter-math.ts","../src/primitives/splitter/Splitter.tsx","../src/primitives/text-input/TextInput.tsx","../src/primitives/theme-switch/ThemeSwitch.tsx","../src/primitives/toolbar/roving.ts","../src/primitives/toolbar/Toolbar.tsx","../src/primitives/tool-group/ToolGroup.tsx","../src/primitives/warn-mark/WarnMark.tsx"],"sourcesContent":["// A badge: a short word or count in a rounded chip, tinted by its tone (a count of retries, a \"not ready\"). A tone it\n// does not know is drawn neutrally.\nimport type { ReactNode } from \"react\";\nimport \"./Badge.css\";\n\n/** The tones a badge draws; any other string is drawn neutrally. */\nexport type BadgeTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | (string & {});\n\nexport type BadgeProps = {\n /** The badge's tone: its text and border colour, and for warn and err a soft surface. */\n tone: BadgeTone;\n /** What the badge says: a word, a count, a WarnMark beside them. */\n children: ReactNode;\n /** Shown on hover: what the badge means. */\n title?: string;\n /** A class added to the badge. */\n className?: string;\n};\n\n/** Draws a short word or count in a chip of its tone. */\nexport function Badge({ tone, children, title, className }: BadgeProps) {\n return (\n <span className={className === undefined ? \"pb-badge\" : `pb-badge ${className}`} data-tone={tone} title={title}>\n {children}\n </span>\n );\n}\n","// The busy mark: an open ring in the current text colour that turns once per --pb-motion-spin, and under reduced\n// motion stands still (the open ring is still the mark). Without a label it is decoration, hidden from screen\n// readers, as inside a busy Button, whose own words and aria-busy say what is happening. With a label it is a status\n// that screen readers announce.\nimport type { ComponentPropsWithRef } from \"react\";\nimport \"./Spinner.css\";\n\nexport type SpinnerProps = Omit<ComponentPropsWithRef<\"span\">, \"children\"> & {\n /** What is being waited for, read by screen readers; without it the spinner is hidden from them. */\n label?: string;\n};\n\nexport function Spinner({ label, className, ...rest }: SpinnerProps) {\n const classes = className === undefined ? \"pb-spinner\" : `pb-spinner ${className}`;\n if (label === undefined || label === \"\") {\n return <span {...rest} className={classes} aria-hidden=\"true\" />;\n }\n return (\n <span {...rest} className={`${classes} pb-spinner-labelled`} role=\"status\">\n <span className=\"pb-spinner-ring\" aria-hidden=\"true\" />\n <span className=\"pb-spinner-label\">{label}</span>\n </span>\n );\n}\n","// A push button in the library's look. Its tone (neutral, primary, danger, or any other word, drawn neutral) and size\n// are data attributes its stylesheet keys on. While busy it shows a Spinner over its words, which keep their place so\n// the button keeps its width, says aria-busy, and ignores presses (it stays focusable, unlike a disabled button, so\n// focus is not lost while a request is on its way).\nimport type { ComponentPropsWithRef, MouseEvent } from \"react\";\nimport { Spinner } from \"../spinner\";\nimport \"./Button.css\";\n\n/** What the button does, by colour: neutral (the default), primary (the one main action), danger; others draw neutral. */\nexport type ButtonTone = \"neutral\" | \"primary\" | \"danger\" | (string & {});\n\n/** md (the default) or sm, the compact one for dense rows; others draw as md. On touch both are at least 36 px tall. */\nexport type ButtonSize = \"md\" | \"sm\" | (string & {});\n\nexport type ButtonProps = ComponentPropsWithRef<\"button\"> & {\n tone?: ButtonTone;\n size?: ButtonSize;\n /** A request is on its way: a spinner over the words, aria-busy, and presses ignored. */\n busy?: boolean;\n};\n\nexport function Button({\n tone = \"neutral\",\n size = \"md\",\n busy = false,\n type = \"button\",\n className,\n children,\n onClick,\n ...rest\n}: ButtonProps) {\n function click(event: MouseEvent<HTMLButtonElement>) {\n if (busy) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n }\n return (\n <button\n {...rest}\n // A submit or reset button is asked for by name; a bare button inside a form never submits it.\n type={type}\n className={className === undefined ? \"pb-button\" : `pb-button ${className}`}\n data-tone={tone}\n data-size={size}\n aria-busy={busy || undefined}\n aria-disabled={busy || rest[\"aria-disabled\"] || undefined}\n onClick={click}\n >\n <span className=\"pb-button-content\">{children}</span>\n {busy && <Spinner className=\"pb-button-spinner\" />}\n </button>\n );\n}\n","// A tick box: a native checkbox (every native prop passes through, ref included, and id and aria props reach the\n// input, so Field can wire it), ticked in the accent. With a label it is wrapped in its own label, so a press on the\n// words ticks it too, and the row is a target a finger can find. Indeterminate (some of a group ticked) is a prop,\n// since HTML has it only as a DOM property.\nimport { useCallback, useLayoutEffect, useRef, type ComponentPropsWithRef, type ReactNode, type Ref } from \"react\";\nimport \"./Checkbox.css\";\n\nexport type CheckboxProps = Omit<ComponentPropsWithRef<\"input\">, \"type\"> & {\n /** The words beside the box, which tick it too; without them, name the box by a Field or aria-label. */\n label?: ReactNode;\n /** Neither ticked nor not: drawn as a dash and read as \"mixed\". */\n indeterminate?: boolean;\n};\n\nfunction assign<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref !== null && ref !== undefined) ref.current = value;\n}\n\nexport function Checkbox({ label, indeterminate = false, className, ref, ...rest }: CheckboxProps) {\n const own = useRef<HTMLInputElement | null>(null);\n const setRef = useCallback(\n (node: HTMLInputElement | null) => {\n own.current = node;\n assign(ref, node);\n },\n [ref],\n );\n useLayoutEffect(() => {\n if (own.current !== null) own.current.indeterminate = indeterminate;\n }, [indeterminate]);\n\n const box = (\n <input\n {...rest}\n ref={setRef}\n type=\"checkbox\"\n className={label === undefined && className !== undefined ? `pb-checkbox ${className}` : \"pb-checkbox\"}\n />\n );\n if (label === undefined) return box;\n return (\n <label\n className={className === undefined ? \"pb-checkbox-row\" : `pb-checkbox-row ${className}`}\n data-disabled={rest.disabled === true || undefined}\n >\n {box}\n <span className=\"pb-checkbox-label\">{label}</span>\n </label>\n );\n}\n","// A square button that shows a glyph and is named by its label: the label is its accessible name and, unless a title\n// is given, its tooltip, and the glyph is hidden from screen readers. Tone, size and busy are Button's.\nimport type { ReactNode } from \"react\";\nimport { Button, type ButtonProps } from \"../button\";\nimport \"./IconButton.css\";\n\nexport type IconButtonProps = Omit<ButtonProps, \"children\" | \"aria-label\"> & {\n /** The button's name for screen readers, and its tooltip unless title says otherwise. */\n label: string;\n /** The glyph: an icon or a character, hidden from screen readers. */\n children: ReactNode;\n};\n\nexport function IconButton({ label, title, className, children, ...rest }: IconButtonProps) {\n return (\n <Button\n {...rest}\n className={className === undefined ? \"pb-icon-button\" : `pb-icon-button ${className}`}\n aria-label={label}\n title={title ?? label}\n >\n <span className=\"pb-icon-button-glyph\" aria-hidden=\"true\">\n {children}\n </span>\n </Button>\n );\n}\n","// The cross on Dialog's and Sheet's close buttons, in the current text colour. Internal: not exported by the layer.\nexport function CloseGlyph() {\n return (\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\">\n <path d=\"M3 3l10 10M13 3L3 13\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.75\" />\n </svg>\n );\n}\n","// A modal dialog: drawn over the page (in a portal on <body>) above a scrim, with a title, a close button, the app's\n// content and an optional row of actions. While it is open, Tab and Shift+Tab stay inside it and focus that wanders\n// out is brought back; Escape, the close button and a press on the scrim ask the app to close it (onClose), and the\n// app closes it by setting open to false. Opening focuses the content's first control (or one the content focused\n// itself, as with autoFocus), else the dialog; the body is a tab stop of its own, so a long one scrolls from the\n// keyboard; closing gives focus back to what had it before. Only the topmost of\n// several open dialogs keeps the focus.\nimport { type ReactNode, type KeyboardEvent, useEffect, useId, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { IconButton } from \"../icon-button\";\nimport { CloseGlyph } from \"./CloseGlyph\";\nimport \"./Dialog.css\";\n\nexport type DialogProps = {\n /** Whether the dialog is shown; the app holds it. */\n open: boolean;\n /** Asked for on Escape, the close button and a press on the scrim. */\n onClose: () => void;\n /** The dialog's title, which also names it for screen readers. */\n title: ReactNode;\n children: ReactNode;\n /** A row at the foot of the dialog, for its buttons. */\n actions?: ReactNode;\n /** The close button's name: \"Close\". */\n closeLabel?: string;\n /** A class added to the dialog's box. */\n className?: string;\n};\n\nconst focusable = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled]):not([type='hidden'])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n \"[contenteditable='true']\",\n].join(\",\");\n\n/** The controls inside `root` that Tab reaches, in order. */\nfunction tabbable(root: HTMLElement): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>(focusable)].filter(\n (element) => element.closest(\"[hidden], [inert]\") === null && element.tabIndex >= 0,\n );\n}\n\n/** Whether `box` is the topmost open dialog: each opens in a portal appended to <body>, so the last one is on top. */\nfunction topmost(box: HTMLElement): boolean {\n const open = box.ownerDocument.querySelectorAll(\".pb-dialog\");\n return open[open.length - 1] === box;\n}\n\nfunction OpenDialog({ onClose, title, children, actions, closeLabel = \"Close\", className }: Omit<DialogProps, \"open\">) {\n const boxRef = useRef<HTMLDivElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n onCloseRef.current = onClose;\n }, [onClose]);\n\n useEffect(() => {\n const box = boxRef.current;\n if (box === null) return undefined;\n const before = document.activeElement instanceof HTMLElement ? document.activeElement : null;\n if (!box.contains(document.activeElement)) {\n const body = bodyRef.current;\n (body === null ? undefined : tabbable(body)[0])?.focus();\n if (!box.contains(document.activeElement)) box.focus();\n }\n const keepFocus = (event: FocusEvent) => {\n if (!topmost(box)) return;\n if (event.target instanceof Node && box.contains(event.target)) return;\n (tabbable(box)[0] ?? box).focus();\n };\n document.addEventListener(\"focusin\", keepFocus);\n return () => {\n document.removeEventListener(\"focusin\", keepFocus);\n if (before?.isConnected === true) before.focus();\n };\n }, []);\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n onCloseRef.current();\n return;\n }\n if (event.key !== \"Tab\" || boxRef.current === null) return;\n const controls = tabbable(boxRef.current);\n const first = controls[0];\n const last = controls[controls.length - 1];\n if (first === undefined || last === undefined) {\n event.preventDefault();\n return;\n }\n const active = document.activeElement;\n if (event.shiftKey && (active === first || active === boxRef.current)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n };\n\n return (\n <div\n className=\"pb-dialog-scrim\"\n onMouseDown={(event) => {\n // Only a press that starts on the scrim itself: a drag out of a text field does not close.\n if (event.target === event.currentTarget) onCloseRef.current();\n }}\n >\n <div\n ref={boxRef}\n className={className === undefined ? \"pb-dialog\" : `pb-dialog ${className}`}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n tabIndex={-1}\n onKeyDown={onKeyDown}\n >\n <div className=\"pb-dialog-head\">\n <h2 className=\"pb-dialog-title\" id={titleId}>\n {title}\n </h2>\n <IconButton\n className=\"pb-dialog-close\"\n label={closeLabel}\n onClick={() => {\n onCloseRef.current();\n }}\n >\n <CloseGlyph />\n </IconButton>\n </div>\n {/* Focusable, so a body that scrolls can be scrolled from the keyboard. */}\n <div ref={bodyRef} className=\"pb-dialog-body\" tabIndex={0}>\n {children}\n </div>\n {actions === undefined ? null : <div className=\"pb-dialog-actions\">{actions}</div>}\n </div>\n </div>\n );\n}\n\nexport function Dialog({ open, ...rest }: DialogProps) {\n if (!open) return null;\n return createPortal(<OpenDialog {...rest} />, document.body);\n}\n","// A labelled form control: the label, the control (its one child), a hint under it and an error under that. It wires\n// the control to them itself: the control gets an id the label points at (its own id if it has one), aria-describedby\n// naming the hint and the error (after any ids it already has), and aria-invalid while there is an error. The control\n// is any element that passes those props on to its native element, as TextInput, Select and Checkbox do.\nimport {\n cloneElement,\n isValidElement,\n useId,\n type AriaAttributes,\n type ComponentPropsWithRef,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport \"./Field.css\";\n\n/** stacked (the default: the label above the control) or inline (the label in a column to its left); others stack. */\nexport type FieldLayout = \"stacked\" | \"inline\" | (string & {});\n\n/** The props Field sets on its control. */\nexport type FieldControlProps = {\n id?: string;\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: AriaAttributes[\"aria-invalid\"];\n};\n\nexport type FieldProps = Omit<ComponentPropsWithRef<\"div\">, \"children\"> & {\n /** What the control is, as its accessible name. */\n label: ReactNode;\n /** Why the value is refused; while there is one the control is marked invalid. Empty means none. */\n error?: ReactNode;\n /** A line of help under the control. */\n hint?: ReactNode;\n layout?: FieldLayout;\n /** The control: one element that passes id and aria props on to its native element. */\n children: ReactElement<FieldControlProps>;\n};\n\nfunction present(node: ReactNode): boolean {\n return node !== undefined && node !== null && node !== false && node !== \"\";\n}\n\nexport function Field({ label, error, hint, layout = \"stacked\", className, children, ...rest }: FieldProps) {\n const base = useId();\n const control: unknown = children;\n const own = isValidElement<FieldControlProps>(control) ? control.props : undefined;\n const controlId = own?.id ?? `${base}-control`;\n const hintId = present(hint) ? `${base}-hint` : undefined;\n const errorId = present(error) ? `${base}-error` : undefined;\n const describedBy = [own?.[\"aria-describedby\"], hintId, errorId].filter((id) => id !== undefined && id !== \"\");\n const wired =\n own === undefined\n ? children\n : cloneElement(children, {\n id: controlId,\n \"aria-describedby\": describedBy.length > 0 ? describedBy.join(\" \") : undefined,\n \"aria-invalid\": errorId !== undefined ? true : own[\"aria-invalid\"],\n });\n return (\n <div\n {...rest}\n className={className === undefined ? \"pb-field\" : `pb-field ${className}`}\n data-layout={layout}\n data-invalid={errorId !== undefined || undefined}\n >\n <label className=\"pb-field-label\" htmlFor={controlId}>\n {label}\n </label>\n <div className=\"pb-field-control\">\n {wired}\n {hintId !== undefined && (\n <div className=\"pb-field-hint\" id={hintId}>\n {hint}\n </div>\n )}\n {errorId !== undefined && (\n <div className=\"pb-field-error\" id={errorId}>\n {error}\n </div>\n )}\n </div>\n </div>\n );\n}\n","// Facts as a two-column list of keys and values (a status summary, an inspector's details), drawn as a <dl> so each key\n// names its value for screen readers. A row's tone colours its value; a tone it does not know leaves it plain.\nimport type { ReactNode } from \"react\";\nimport \"./KeyValue.css\";\n\n/** The tones a value draws in; any other string leaves it plain. */\nexport type KeyValueTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | (string & {});\n\nexport type KeyValueRow = {\n /** The fact's name. */\n key: string;\n /** Its value. */\n value: ReactNode;\n /** Colours the value: a fact that is wrong or worth a look. */\n tone?: KeyValueTone;\n /** Shown on hover over the key: what the fact means. */\n title?: string;\n};\n\nexport type KeyValueProps = {\n /** The facts, in order. */\n rows: readonly KeyValueRow[];\n /** Names the list for screen readers when no heading does. */\n label?: string;\n /** A class added to the list. */\n className?: string;\n};\n\n/** Draws facts as keys and their values, side by side. */\nexport function KeyValue({ rows, label, className }: KeyValueProps) {\n return (\n <dl className={className === undefined ? \"pb-key-value\" : `pb-key-value ${className}`} aria-label={label}>\n {rows.map((row, index) => (\n // Rows have no identity beyond their place; two may share a key.\n <div key={index} className=\"pb-key-value-row\" data-tone={row.tone}>\n <dt title={row.title}>{row.key}</dt>\n <dd>{row.value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n","// Keeps a scrolling box reachable by keyboard: while its content overflows it is a tab stop (so the arrow keys and Page\n// Up and Down scroll it), and while everything fits it is not, so a short panel adds no empty stop to the tab order.\nimport { useEffect, type RefObject } from \"react\";\n\n/** Whether `box`'s content is taller or wider than the box. */\nexport function overflows(box: HTMLElement): boolean {\n return box.scrollHeight > box.clientHeight || box.scrollWidth > box.clientWidth;\n}\n\n/** Makes `ref`'s box focusable exactly while it overflows, watching its size and its content. */\nexport function useScrollFocus(ref: RefObject<HTMLElement | null>): void {\n useEffect(() => {\n const box = ref.current;\n if (box === null) return;\n const settle = () => {\n if (overflows(box)) box.tabIndex = 0;\n else box.removeAttribute(\"tabindex\");\n };\n settle();\n // jsdom has no ResizeObserver; the content watch still runs there.\n const sizes = typeof ResizeObserver === \"function\" ? new ResizeObserver(settle) : null;\n const observeChildren = () => {\n if (sizes === null) return;\n sizes.disconnect();\n sizes.observe(box);\n for (const child of box.children) sizes.observe(child);\n };\n observeChildren();\n const content = new MutationObserver(() => {\n observeChildren();\n settle();\n });\n content.observe(box, { childList: true, subtree: true, characterData: true });\n return () => {\n sizes?.disconnect();\n content.disconnect();\n };\n }, [ref]);\n}\n","// A panel: a region of the page with an optional header (its title, and actions at the far end) over a body that\n// scrolls on its own, as an inspector or a side panel. It draws no outer border: the layout that places it (a docked\n// side, a sheet, a card) draws its edges. Its title names the region for screen readers. While its body overflows, the\n// body is a tab stop, so the keyboard can scroll it.\nimport { useId, useRef, type ComponentPropsWithRef, type ReactNode } from \"react\";\nimport { useScrollFocus } from \"./scroll-focus\";\nimport \"./Panel.css\";\n\nexport type PanelProps = Omit<ComponentPropsWithRef<\"section\">, \"title\"> & {\n /** The panel's heading; it also names the region. Without one, name it with aria-label. */\n title?: ReactNode;\n /** Slot at the header's far end: buttons, a count, a close button. */\n actions?: ReactNode;\n /** The title's heading level, h1 to h6; h2 by default. */\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n children?: ReactNode;\n};\n\n/** Draws a titled region with its actions and a body that scrolls. */\nexport function Panel({ title, actions, level = 2, className, children, ...rest }: PanelProps) {\n const titleId = useId();\n const body = useRef<HTMLDivElement>(null);\n useScrollFocus(body);\n const Heading = `h${String(level)}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n const header = title !== undefined || actions !== undefined;\n return (\n <section\n {...rest}\n aria-labelledby={\n rest[\"aria-labelledby\"] ?? (title !== undefined && rest[\"aria-label\"] === undefined ? titleId : undefined)\n }\n className={className === undefined ? \"pb-panel\" : `pb-panel ${className}`}\n >\n {header && (\n <header className=\"pb-panel-header\">\n {title !== undefined && (\n <Heading id={titleId} className=\"pb-panel-title\">\n {title}\n </Heading>\n )}\n {actions !== undefined && <div className=\"pb-panel-actions\">{actions}</div>}\n </header>\n )}\n <div ref={body} className=\"pb-panel-body\">\n {children}\n </div>\n </section>\n );\n}\n","// A state pill: a dot in the state's tone and the word beside it, so the state never rests on colour alone. A tone it\n// does not know is drawn neutrally, by its own word.\nimport type { ReactNode } from \"react\";\nimport \"./Pill.css\";\n\n/** The tones a pill draws; any other string is drawn neutrally. */\nexport type PillTone = \"ok\" | \"warn\" | \"err\" | \"quiet\" | \"off\" | (string & {});\n\nexport type PillProps = {\n /** The state's tone: the dot's and the word's colour. */\n tone: PillTone;\n /** The state in words, always shown beside the dot. */\n label: string;\n /** Pulses the dot (never the word) while the state is on its way, such as \"starting\"; stops under reduced motion. */\n pulse?: boolean;\n /** Shown on hover: what the state means or why it is so. */\n title?: string;\n /** After the word, in code type: a failure's code, say. */\n detail?: ReactNode;\n /** A class added to the pill. */\n className?: string;\n};\n\n/** Draws a state as a dot and its word, in the state's tone. */\nexport function Pill({ tone, label, pulse = false, title, detail, className }: PillProps) {\n return (\n <span\n className={className === undefined ? \"pb-pill\" : `pb-pill ${className}`}\n data-tone={tone}\n data-pulse={pulse ? \"\" : undefined}\n title={title}\n >\n <span className=\"pb-pill-dot\" aria-hidden=\"true\" />\n {label}\n {detail !== undefined && <code className=\"pb-pill-detail\">{detail}</code>}\n </span>\n );\n}\n","// A choice of one: native radios under a legend, in one fieldset (role radiogroup), so the browser gives the arrow\n// keys and a single tab stop. Controlled: the app holds the value and every press asks it through onChange. Its hint\n// and error are wired as Field wires a control's: aria-describedby names them, and aria-invalid marks the group while\n// there is an error.\nimport { useId, type ComponentPropsWithRef, type ReactNode } from \"react\";\nimport \"./RadioGroup.css\";\n\n/** stacked (the default: one option a row) or inline (the options side by side, wrapping); others stack. */\nexport type RadioGroupLayout = \"stacked\" | \"inline\" | (string & {});\n\nexport type RadioOption = {\n /** The value onChange gives when this option is picked; unique in the group. */\n value: string;\n /** The option's words, which pick it too. */\n label: ReactNode;\n /** Shown on hover over the option. */\n title?: string;\n /** Not pickable. */\n disabled?: boolean;\n};\n\nexport type RadioGroupProps = Omit<ComponentPropsWithRef<\"fieldset\">, \"children\" | \"onChange\"> & {\n /** What the choice is: the group's legend and accessible name. */\n legend: ReactNode;\n /** Keeps the legend for screen readers only, when the layout around the group already says what it is. */\n legendHidden?: boolean;\n options: readonly RadioOption[];\n /** The picked option's value; one matching no option (or undefined) picks none. */\n value: string | undefined;\n /** Asks the app to pick this value. */\n onChange: (value: string) => void;\n /** The radios' shared name; one of its own by default. */\n name?: string;\n layout?: RadioGroupLayout;\n /** A line of help under the options. */\n hint?: ReactNode;\n /** Why the choice is refused; while there is one the group is marked invalid. Empty means none. */\n error?: ReactNode;\n};\n\nfunction present(node: ReactNode): boolean {\n return node !== undefined && node !== null && node !== false && node !== \"\";\n}\n\nexport function RadioGroup({\n legend,\n legendHidden = false,\n options,\n value,\n onChange,\n name,\n layout = \"stacked\",\n hint,\n error,\n className,\n \"aria-describedby\": describedByOwn,\n \"aria-invalid\": invalidOwn,\n ...rest\n}: RadioGroupProps) {\n const base = useId();\n const groupName = name ?? `${base}-name`;\n const hintId = present(hint) ? `${base}-hint` : undefined;\n const errorId = present(error) ? `${base}-error` : undefined;\n const describedBy = [describedByOwn, hintId, errorId].filter((id) => id !== undefined && id !== \"\");\n return (\n <fieldset\n {...rest}\n role=\"radiogroup\"\n className={className === undefined ? \"pb-radio-group\" : `pb-radio-group ${className}`}\n data-layout={layout}\n aria-describedby={describedBy.length > 0 ? describedBy.join(\" \") : undefined}\n aria-invalid={errorId !== undefined ? true : invalidOwn}\n >\n <legend className=\"pb-radio-group-legend\" data-hidden={legendHidden || undefined}>\n {legend}\n </legend>\n <div className=\"pb-radio-group-options\">\n {options.map((option) => (\n <label\n key={option.value}\n className=\"pb-radio-row\"\n title={option.title}\n data-disabled={option.disabled === true || rest.disabled === true || undefined}\n >\n <input\n className=\"pb-radio\"\n type=\"radio\"\n name={groupName}\n value={option.value}\n checked={option.value === value}\n disabled={option.disabled}\n onChange={() => {\n onChange(option.value);\n }}\n />\n <span className=\"pb-radio-label\">{option.label}</span>\n </label>\n ))}\n </div>\n {hintId !== undefined && (\n <div className=\"pb-radio-group-hint\" id={hintId}>\n {hint}\n </div>\n )}\n {errorId !== undefined && (\n <div className=\"pb-radio-group-error\" id={errorId}>\n {error}\n </div>\n )}\n </fieldset>\n );\n}\n","// A section's title in a panel or inspector, a heading with its actions (buttons, a count) at the far end. The\n// heading's level fits the page it sits in.\nimport type { ReactNode } from \"react\";\nimport \"./SectionTitle.css\";\n\nexport type SectionTitleProps = {\n /** The title. */\n children: ReactNode;\n /** Slot at the title's far end: buttons, a count, a badge. */\n actions?: ReactNode;\n /** The heading's level, h2 to h6. */\n level?: 2 | 3 | 4 | 5 | 6;\n /** A class added to the title's row. */\n className?: string;\n};\n\n/** Draws a section's heading, with its actions at the far end. */\nexport function SectionTitle({ children, actions, level = 3, className }: SectionTitleProps) {\n const Heading = `h${level}` as const;\n return (\n <div className={className === undefined ? \"pb-section-title\" : `pb-section-title ${className}`}>\n <Heading className=\"pb-section-title-text\">{children}</Heading>\n {actions !== undefined && <div className=\"pb-section-title-actions\">{actions}</div>}\n </div>\n );\n}\n","// A drop-down choice in the library's look: a native select (every native prop passes through, ref included; its\n// options are its children), so the platform's own list opens, the keyboard works as the platform's does, and a phone\n// shows its picker. It shows aria-invalid in the error tone, as Field sets it. On a touch screen its text is 16 px, as\n// iOS Safari zooms the page when a smaller field takes the focus.\nimport type { ComponentPropsWithRef } from \"react\";\nimport \"./Select.css\";\n\n/** ui (the default) or code, the monospace face for values written as code; others draw as ui. */\nexport type SelectFont = \"ui\" | \"code\" | (string & {});\n\nexport type SelectProps = ComponentPropsWithRef<\"select\"> & {\n font?: SelectFont;\n};\n\nexport function Select({ font = \"ui\", className, children, ...rest }: SelectProps) {\n return (\n <select {...rest} className={className === undefined ? \"pb-select\" : `pb-select ${className}`} data-font={font}>\n {children}\n </select>\n );\n}\n","// A sheet: a panel drawn over its container's right edge or rising from its bottom, as an inspector is on a narrow\n// window or a phone. It is not modal: the page around it stays live, and opening it does not take the focus (a\n// selection on the canvas opens it while the person is still working there). Escape inside it and its close button\n// ask the app to close it; if the focus was inside when it closes, it goes back to where it came from. The sheet is\n// placed absolutely, so its container (the app's workspace) is positioned; the app holds open, and chooses the side\n// (the right edge below 760 px, the bottom below 600 px).\nimport {\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type CSSProperties,\n useEffect,\n useId,\n useRef,\n} from \"react\";\nimport { CloseGlyph } from \"../dialog/CloseGlyph\";\nimport { IconButton } from \"../icon-button\";\nimport \"./Sheet.css\";\n\nexport type SheetSide = \"right\" | \"bottom\";\n\nexport type SheetProps = {\n /** Whether the sheet is shown; the app holds it. */\n open: boolean;\n /** Asked for on Escape inside the sheet and on its close button. */\n onClose: () => void;\n /** The edge it is drawn from: the right edge (the default) or the bottom. */\n side?: SheetSide;\n /** The sheet's title, which also names it for screen readers; without one, name it with `label`. */\n title?: ReactNode;\n /** The sheet's name for screen readers when it has no title. */\n label?: string;\n children: ReactNode;\n /** A right sheet's width in px, held to 280–560 px and to 48 px short of its container. */\n width?: number;\n /** The close button's name: \"Close\". */\n closeLabel?: string;\n /** A class added to the sheet. */\n className?: string;\n};\n\nfunction OpenSheet({\n onClose,\n side = \"right\",\n title,\n label,\n children,\n width,\n closeLabel = \"Close\",\n className,\n}: Omit<SheetProps, \"open\">) {\n const sheetRef = useRef<HTMLElement>(null);\n const titleId = useId();\n /** Where the focus came from when it entered the sheet: it goes back there if the sheet closes holding it. */\n const cameFrom = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n const sheet = sheetRef.current;\n return () => {\n const back = cameFrom.current;\n const active = document.activeElement;\n const held = active === null || active === document.body || (sheet?.contains(active) ?? false);\n if (held && back?.isConnected === true) back.focus();\n };\n }, []);\n\n const onFocus = (event: FocusEvent<HTMLElement>) => {\n const from = event.relatedTarget;\n if (from instanceof HTMLElement && !event.currentTarget.contains(from)) cameFrom.current = from;\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n if (event.defaultPrevented || event.key !== \"Escape\") return;\n event.preventDefault();\n event.stopPropagation();\n onClose();\n };\n\n const style = width === undefined ? undefined : ({ \"--pb-sheet-width\": `${width}px` } as CSSProperties);\n\n return (\n <section\n ref={sheetRef}\n className={className === undefined ? \"pb-sheet\" : `pb-sheet ${className}`}\n data-side={side}\n role=\"dialog\"\n aria-labelledby={title === undefined ? undefined : titleId}\n aria-label={title === undefined ? label : undefined}\n style={style}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n >\n <div className=\"pb-sheet-head\">\n {title === undefined ? (\n <span className=\"pb-sheet-title\" />\n ) : (\n <h2 className=\"pb-sheet-title\" id={titleId}>\n {title}\n </h2>\n )}\n <IconButton className=\"pb-sheet-close\" label={closeLabel} onClick={onClose}>\n <CloseGlyph />\n </IconButton>\n </div>\n {/* Focusable, so a body that scrolls can be scrolled from the keyboard. */}\n <div className=\"pb-sheet-body\" tabIndex={0}>\n {children}\n </div>\n </section>\n );\n}\n\nexport function Sheet({ open, ...rest }: SheetProps) {\n if (!open) return null;\n return <OpenSheet {...rest} />;\n}\n","// A splitter's maths, pure: a size kept within its bounds, a drag, and a key. Splitter.tsx draws and listens; this\n// file decides the size.\n\n/** The smallest and largest size, in px. */\nexport interface Bounds {\n min: number;\n max: number;\n}\n\n/** `value` within `bounds`, in whole px. A max below the min is read as the min. */\nexport function clamp(value: number, bounds: Bounds): number {\n const max = Math.max(bounds.min, bounds.max);\n return Math.round(Math.min(max, Math.max(bounds.min, value)));\n}\n\n/**\n * A drag: the size at the drag's start plus the pointer's travel times `sign`, clamped. The sign is -1 for a splitter on\n * the start edge (left or top) of what it resizes, where moving left or up grows it, and 1 on the end edge.\n */\nexport function dragged(start: number, travel: number, sign: 1 | -1, bounds: Bounds): number {\n return clamp(start + sign * travel, bounds);\n}\n\n/** Which arrow grows what the splitter resizes, from its orientation and the edge it sits on. */\nexport function growKey(orientation: \"vertical\" | \"horizontal\", edge: \"start\" | \"end\"): string {\n if (orientation === \"vertical\") return edge === \"start\" ? \"ArrowLeft\" : \"ArrowRight\";\n return edge === \"start\" ? \"ArrowUp\" : \"ArrowDown\";\n}\n\nconst opposite: Record<string, string> = {\n ArrowLeft: \"ArrowRight\",\n ArrowRight: \"ArrowLeft\",\n ArrowUp: \"ArrowDown\",\n ArrowDown: \"ArrowUp\",\n};\n\n/**\n * A key on a focused splitter: `grow` adds `step` and its opposite arrow takes it away, clamped; Home goes to the min\n * and End to the max; any other key gives undefined (the key is not the splitter's).\n */\nexport function keyed(value: number, key: string, grow: string, step: number, bounds: Bounds): number | undefined {\n if (key === grow) return clamp(value + step, bounds);\n if (key === opposite[grow]) return clamp(value - step, bounds);\n if (key === \"Home\") return clamp(bounds.min, bounds);\n if (key === \"End\") return clamp(bounds.max, bounds);\n return undefined;\n}\n","// A resize handle, as a WAI-ARIA separator: the edge of a pane, dragged with the pointer or moved by the arrow keys,\n// Home and End while focused. It keeps only the drag in progress; the size is the app's (value and onChange). It sits\n// absolutely on one edge of its positioned parent, the pane it resizes. splitter-math.ts holds the maths.\nimport { useRef, type ComponentPropsWithRef, type KeyboardEvent, type PointerEvent } from \"react\";\nimport { dragged, growKey, keyed } from \"./splitter-math\";\nimport \"./Splitter.css\";\n\n/** vertical: a vertical bar that resizes a width; horizontal: a horizontal bar that resizes a height. */\nexport type SplitterOrientation = \"vertical\" | \"horizontal\";\n\n/** The edge of the resized pane the splitter sits on: start is its left or top, end its right or bottom. */\nexport type SplitterEdge = \"start\" | \"end\";\n\nexport type SplitterProps = Omit<\n ComponentPropsWithRef<\"div\">,\n \"onChange\" | \"children\" | \"role\" | \"aria-orientation\" | \"aria-valuenow\" | \"aria-valuemin\" | \"aria-valuemax\"\n> & {\n orientation: SplitterOrientation;\n /** The pane's size in px. */\n value: number;\n /** The smallest size in px. */\n min: number;\n /** The largest size in px. */\n max: number;\n /** A new size, in whole px within min and max. */\n onChange: (px: number) => void;\n /** The separator's accessible name, such as \"Resize the inspector\". */\n label: string;\n /** Which edge of the pane it sits on; start (left or top) by default, where moving left or up grows the pane. */\n edge?: SplitterEdge;\n /** How far one arrow key moves it, in px; 16 by default. */\n step?: number;\n};\n\n/** Draws a pane's resize handle, dragged by pointer or moved by keys. */\nexport function Splitter({\n orientation,\n value,\n min,\n max,\n onChange,\n label,\n edge = \"start\",\n step = 16,\n className,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n onKeyDown,\n ...rest\n}: SplitterProps) {\n const drag = useRef<{ start: number; at: number } | null>(null);\n const bounds = { min, max };\n const along = (event: PointerEvent) => (orientation === \"vertical\" ? event.clientX : event.clientY);\n\n function down(event: PointerEvent<HTMLDivElement>) {\n onPointerDown?.(event);\n if (event.defaultPrevented || event.button !== 0) return;\n event.preventDefault();\n const target = event.currentTarget;\n // Captured, the drag follows the pointer past the bar's few px; jsdom has no capture.\n if (typeof target.setPointerCapture === \"function\") target.setPointerCapture(event.pointerId);\n target.focus();\n target.dataset[\"dragging\"] = \"\";\n drag.current = { start: value, at: along(event) };\n }\n function move(event: PointerEvent<HTMLDivElement>) {\n onPointerMove?.(event);\n const started = drag.current;\n if (started === null) return;\n const next = dragged(started.start, along(event) - started.at, edge === \"start\" ? -1 : 1, bounds);\n if (next !== value) onChange(next);\n }\n function end(event: PointerEvent<HTMLDivElement>) {\n if (event.type === \"pointercancel\") onPointerCancel?.(event);\n else onPointerUp?.(event);\n if (drag.current === null) return;\n drag.current = null;\n const target = event.currentTarget;\n delete target.dataset[\"dragging\"];\n if (typeof target.hasPointerCapture === \"function\" && target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n }\n function key(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n const next = keyed(value, event.key, growKey(orientation, edge), step, bounds);\n if (next === undefined) return;\n event.preventDefault();\n if (next !== value) onChange(next);\n }\n\n return (\n <div\n {...rest}\n role=\"separator\"\n tabIndex={rest.tabIndex ?? 0}\n aria-orientation={orientation}\n aria-label={label}\n aria-valuenow={value}\n aria-valuemin={min}\n aria-valuemax={max}\n className={className === undefined ? \"pb-splitter\" : `pb-splitter ${className}`}\n data-orientation={orientation}\n data-edge={edge}\n onPointerDown={down}\n onPointerMove={move}\n onPointerUp={end}\n onPointerCancel={end}\n onKeyDown={key}\n />\n );\n}\n","// A one-line text field in the library's look: a native input (every native prop passes through, ref included), in\n// the UI face or the code face. It shows aria-invalid in the error tone, as Field sets it. On a touch screen its text is\n// 16 px, as iOS Safari zooms the page when a smaller field takes the focus.\nimport type { ComponentPropsWithRef } from \"react\";\nimport \"./TextInput.css\";\n\n/** ui (the default) or code, the monospace face for values written as code; others draw as ui. */\nexport type TextInputFont = \"ui\" | \"code\" | (string & {});\n\nexport type TextInputProps = ComponentPropsWithRef<\"input\"> & {\n font?: TextInputFont;\n};\n\nexport function TextInput({ font = \"ui\", type = \"text\", className, ...rest }: TextInputProps) {\n return (\n <input\n {...rest}\n type={type}\n className={className === undefined ? \"pb-text-input\" : `pb-text-input ${className}`}\n data-font={font}\n />\n );\n}\n","// The theme switch: one button that cycles system, light and dark. Its word is shown beside the icon, and its\n// accessible name always says the choice, so it is never just a glyph; the icon is SVG, since a font may lack a ◐\n// character. The choice is the app's (useTheme keeps it); the switch only says it and asks for the next. At phone\n// width the word gives way to the icon alone, and the name still says the choice.\nimport type { ComponentPropsWithRef } from \"react\";\nimport type { ThemeChoice } from \"../../hooks/use-theme/useTheme\";\nimport \"./ThemeSwitch.css\";\n\nexport type { ThemeChoice };\n\n/** The switch's words, each replaceable. */\nexport interface ThemeSwitchLabels {\n /** What the switch is: \"Theme\". */\n theme: string;\n system: string;\n light: string;\n dark: string;\n /** Said of system in the tooltip: \"follows the system's setting\". */\n systemHint: string;\n /** Before the next choice in the tooltip: \"click for\". */\n clickFor: string;\n}\n\nexport const defaultThemeSwitchLabels: ThemeSwitchLabels = {\n theme: \"Theme\",\n system: \"system\",\n light: \"light\",\n dark: \"dark\",\n systemHint: \"follows the system's setting\",\n clickFor: \"click for\",\n};\n\nconst order: readonly ThemeChoice[] = [\"system\", \"light\", \"dark\"];\n\n/** The choice a press moves to: system, light, dark and back. */\nfunction following(choice: ThemeChoice): ThemeChoice {\n return order[(order.indexOf(choice) + 1) % order.length] ?? \"system\";\n}\n\nexport type ThemeSwitchProps = Omit<ComponentPropsWithRef<\"button\">, \"children\" | \"onClick\" | \"type\" | \"title\"> & {\n /** The theme now. */\n choice: ThemeChoice;\n /** Called with the next choice in the cycle when the switch is pressed. */\n onChoose: (next: ThemeChoice) => void;\n /** Words to replace; the rest keep their defaults. */\n labels?: Partial<ThemeSwitchLabels>;\n};\n\n/** The switch's tooltip: what the theme is and what a press does. */\nexport function themeSwitchTitle(choice: ThemeChoice, labels: ThemeSwitchLabels = defaultThemeSwitchLabels): string {\n const hint = choice === \"system\" ? ` (${labels.systemHint})` : \"\";\n return `${labels.theme}: ${labels[choice]}${hint}; ${labels.clickFor} ${labels[following(choice)]}`;\n}\n\nexport function ThemeSwitch({ choice, onChoose, labels, className, ...rest }: ThemeSwitchProps) {\n const words = { ...defaultThemeSwitchLabels, ...labels };\n return (\n <button\n {...rest}\n type=\"button\"\n className={className === undefined ? \"pb-theme-switch\" : `pb-theme-switch ${className}`}\n title={themeSwitchTitle(choice, words)}\n aria-label={`${words.theme}: ${words[choice]}`}\n onClick={() => {\n onChoose(following(choice));\n }}\n >\n <svg className=\"pb-theme-switch-icon\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <circle cx=\"8\" cy=\"8\" r=\"6.25\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M8 1.75a6.25 6.25 0 0 1 0 12.5z\" fill=\"currentColor\" />\n </svg>\n <span className=\"pb-theme-switch-word\">{words[choice]}</span>\n </button>\n );\n}\n","// Roving focus over a toolbar's items, pure DOM: which elements are items, which one holds the toolbar's one tab stop,\n// and where an arrow key, Home or End moves the focus. Toolbar.tsx wires it to React.\n\n/** What counts as an item: an enabled control, or anything that says it is a button, checkbox or radio. */\nexport const itemSelector = [\n \"button:not(:disabled)\",\n \"a[href]\",\n \"input:not(:disabled)\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n '[role=\"button\"]',\n '[role=\"checkbox\"]',\n '[role=\"radio\"]',\n '[role=\"menuitem\"]',\n '[role=\"switch\"]',\n].join(\", \");\n\n/** The toolbar's items, in document order, leaving out those of a toolbar nested inside it. */\nexport function items(toolbar: HTMLElement): HTMLElement[] {\n return [...toolbar.querySelectorAll<HTMLElement>(itemSelector)].filter(\n (item) => item.closest('[role=\"toolbar\"]') === toolbar,\n );\n}\n\n/** Gives `current` the one tab stop (0) and every other item -1; with no current, the first item takes it. */\nexport function setTabStop(all: readonly HTMLElement[], current: HTMLElement | null): HTMLElement | null {\n const stop = current !== null && all.includes(current) ? current : (all[0] ?? null);\n for (const item of all) item.tabIndex = item === stop ? 0 : -1;\n return stop;\n}\n\n/**\n * The item a key moves the focus to from `index`, or undefined when the key is not the toolbar's. Horizontal toolbars\n * take the left and right arrows (swapped right to left), vertical ones up and down; both take Home and End. The ends\n * wrap around.\n */\nexport function moved(\n index: number,\n count: number,\n key: string,\n orientation: \"horizontal\" | \"vertical\",\n rtl: boolean,\n): number | undefined {\n if (count === 0) return undefined;\n if (key === \"Home\") return 0;\n if (key === \"End\") return count - 1;\n const [back, forth] =\n orientation === \"vertical\"\n ? [\"ArrowUp\", \"ArrowDown\"]\n : rtl\n ? [\"ArrowRight\", \"ArrowLeft\"]\n : [\"ArrowLeft\", \"ArrowRight\"];\n if (key === forth) return (index + 1) % count;\n if (key === back) return (index - 1 + count) % count;\n return undefined;\n}\n\n/** Whether a key pressed in `element` belongs to the text it edits (arrows, Home and End move its caret). */\nexport function editsText(element: Element): boolean {\n if (element instanceof HTMLTextAreaElement) return true;\n if (element instanceof HTMLInputElement) {\n return ![\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\", \"image\", \"color\", \"file\", \"range\"].includes(\n element.type,\n );\n }\n return element instanceof HTMLElement && element.isContentEditable;\n}\n","// A WAI-ARIA toolbar: a row (or column) of controls that is one tab stop, the arrow keys, Home and End moving the focus\n// between its items (roving tabindex). The items are whatever controls its children render; the toolbar sets their\n// tabIndex itself, so an item's own tabIndex is overwritten. The item last focused keeps the tab stop, and a text field\n// inside keeps its own arrow keys. roving.ts holds the rules.\nimport { useEffect, useRef, type ComponentPropsWithRef, type FocusEvent, type KeyboardEvent } from \"react\";\nimport { editsText, items, moved, setTabStop } from \"./roving\";\nimport \"./Toolbar.css\";\n\nexport type ToolbarOrientation = \"horizontal\" | \"vertical\";\n\nexport type ToolbarProps = Omit<ComponentPropsWithRef<\"div\">, \"role\" | \"aria-orientation\"> & {\n /** The toolbar's accessible name, such as \"Canvas\". */\n label: string;\n /** horizontal (the default) moves with the left and right arrows; vertical with up and down. */\n orientation?: ToolbarOrientation;\n};\n\n/** Draws a group of controls as one tab stop, with the arrow keys moving between them. */\nexport function Toolbar({\n label,\n orientation = \"horizontal\",\n className,\n ref,\n onKeyDown,\n onFocus,\n children,\n ...rest\n}: ToolbarProps) {\n const own = useRef<HTMLDivElement | null>(null);\n const current = useRef<HTMLElement | null>(null);\n\n // After every render, and whenever an item comes, goes or is enabled or disabled, one item holds the tab stop.\n useEffect(() => {\n const toolbar = own.current;\n if (toolbar === null) return;\n const settle = () => {\n current.current = setTabStop(items(toolbar), current.current);\n };\n settle();\n const watch = new MutationObserver(settle);\n watch.observe(toolbar, { childList: true, subtree: true, attributes: true, attributeFilter: [\"disabled\", \"href\"] });\n return () => {\n watch.disconnect();\n };\n });\n\n function focus(event: FocusEvent<HTMLDivElement>) {\n onFocus?.(event);\n const toolbar = own.current;\n if (toolbar === null) return;\n const all = items(toolbar);\n if (event.target instanceof HTMLElement && all.includes(event.target)) {\n current.current = setTabStop(all, event.target);\n }\n }\n function key(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n const toolbar = own.current;\n if (event.defaultPrevented || toolbar === null || event.altKey || event.ctrlKey || event.metaKey) return;\n if (editsText(event.target as Element)) return;\n const all = items(toolbar);\n const index = all.indexOf(event.target as HTMLElement);\n if (index === -1) return;\n const rtl = getComputedStyle(toolbar).direction === \"rtl\";\n const next = moved(index, all.length, event.key, orientation, rtl);\n if (next === undefined) return;\n event.preventDefault();\n all[next]?.focus();\n }\n\n return (\n <div\n {...rest}\n ref={(element) => {\n own.current = element;\n if (typeof ref === \"function\") return ref(element);\n if (ref) ref.current = element;\n return undefined;\n }}\n role=\"toolbar\"\n aria-label={label}\n aria-orientation={orientation}\n className={className === undefined ? \"pb-toolbar\" : `pb-toolbar ${className}`}\n onKeyDown={key}\n onFocus={focus}\n >\n {children}\n </div>\n );\n}\n","// A floating group of tools, such as a canvas's zoom, fit and minimap: a Toolbar drawn as one raised, framed group of\n// square buttons. Its tools are IconButtons (or plain <button>s named by aria-label with their\n// glyph hidden); a pressed one (aria-pressed) is drawn in the accent. 28 px buttons, 40 px on touch.\nimport { Toolbar, type ToolbarProps } from \"../toolbar\";\nimport \"./ToolGroup.css\";\n\nexport type ToolGroupProps = ToolbarProps;\n\n/** Draws a framed group of square tool buttons, one tab stop with roving focus. */\nexport function ToolGroup({ className, ...rest }: ToolGroupProps) {\n return <Toolbar {...rest} className={className === undefined ? \"pb-tool-group\" : `pb-tool-group ${className}`} />;\n}\n","// The warning mark: an \"!\" in a circle beside words, for something that rose lately (a badge's or a counter's). The\n// glyph is hidden from screen readers, which read its label instead.\nimport \"./WarnMark.css\";\n\nexport type WarnMarkProps = {\n /** What the mark means, read by screen readers in its place. */\n label: string;\n /** Shown on hover over the mark. */\n title?: string;\n /** A class added to the mark. */\n className?: string;\n};\n\n/** Draws a warning \"!\" for the eye and its words for screen readers. */\nexport function WarnMark({ label, title, className }: WarnMarkProps) {\n return (\n <>\n <span\n className={className === undefined ? \"pb-warn-mark\" : `pb-warn-mark ${className}`}\n aria-hidden=\"true\"\n title={title}\n >\n !\n </span>\n <span className=\"pb-warn-mark-text\">{label}</span>\n </>\n );\n}\n"],"mappings":";;;;AAoBA,SAAgBE,EAAM,EAAE,SAAM,aAAU,UAAO,gBAAyB;CACtE,OACE,kBAAC,QAAD;EAAM,WAAWC,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AgBC,GAAU,EAAE,cAAW,GAAGlK,KAAwB;CAChE,OAAO,kBAAC+J,GAAD;EAAS,GAAI/J;EAAM,WAAWH,MAAc,KAAA,IAAY,kBAAkB,iBAAiBA;CAAc,CAAA;AAClH;;ACGA,SAAgBsK,GAAS,EAAE,UAAO,UAAO,gBAA4B;CACnE,OACE,kBAAAxK,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD;EACE,WAAWE,MAAc,KAAA,IAAY,iBAAiB,gBAAgBA;EACtE,eAAY;EACL;EACR,UAAA;CAEK,CAAA,GACN,kBAAC,QAAD;EAAM,WAAU;EAAqB,UAAAK;CAAY,CAAA,CACjD,EAAA,CAAA;AAEN"}
@@ -0,0 +1,17 @@
1
+ import type { ComponentPropsWithRef, ReactNode } from "react";
2
+ import "./Banner.css";
3
+ /** The tones a banner draws; any other string is drawn neutrally. */
4
+ export type BannerTone = "ok" | "warn" | "err" | "quiet" | "off" | (string & {});
5
+ export type BannerProps = Omit<ComponentPropsWithRef<"div">, "role"> & {
6
+ /** What the news is, by colour: the stripe's, and the surface's for warn and err. */
7
+ tone: BannerTone;
8
+ /** The news, in words. */
9
+ children: ReactNode;
10
+ /** A slot at the end: the buttons that act on the news. */
11
+ actions?: ReactNode;
12
+ /** Shows a close button, which asks the app to take the banner away. */
13
+ onDismiss?: () => void;
14
+ /** The close button's name, "Dismiss" by default. */
15
+ dismissLabel?: string;
16
+ };
17
+ export declare function Banner({ tone, children, actions, onDismiss, dismissLabel, className, ...rest }: BannerProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { Banner } from "./Banner";
2
+ export type { BannerProps, BannerTone } from "./Banner";
@@ -0,0 +1,36 @@
1
+ import { type ComponentPropsWithRef } from "react";
2
+ import "./DiffView.css";
3
+ export type DiffFile = {
4
+ /** The file's path; the section is labelled by its last part. Unique among the files. */
5
+ path: string;
6
+ /** The file's unified diff text. */
7
+ diff: string;
8
+ };
9
+ /** What a line of unified diff text is, by its start. */
10
+ export type DiffLineKind = "add" | "del" | "hunk" | "meta" | "note" | "context";
11
+ type DiffSource = {
12
+ /** One unified diff, drawn whole without a heading. */
13
+ diff: string;
14
+ files?: never;
15
+ } | {
16
+ /** One section per file, in this order. */
17
+ files: readonly DiffFile[];
18
+ diff?: never;
19
+ };
20
+ export type DiffViewProps = Omit<ComponentPropsWithRef<"div">, "children" | "onToggle"> & DiffSource & {
21
+ /** The files' headings' level, h2 to h6 (h3 by default). */
22
+ level?: 2 | 3 | 4 | 5 | 6;
23
+ /**
24
+ * The paths of the files folded away. Given, the app holds them and onToggle asks it to change them; left out,
25
+ * the view keeps its own, every file open at first.
26
+ */
27
+ collapsed?: readonly string[];
28
+ /** Called when the person opens (true) or folds (false) a file's section. */
29
+ onToggle?: (path: string, open: boolean) => void;
30
+ };
31
+ /** The kind of one line of unified diff text. */
32
+ export declare function diffLineKind(line: string): DiffLineKind;
33
+ /** A path's last part: "src/app/main.ts" is "main.ts". */
34
+ export declare function baseName(path: string): string;
35
+ export declare function DiffView({ diff, files, level, collapsed, onToggle, className, ...rest }: DiffViewProps): import("react").JSX.Element;
36
+ export {};
@@ -0,0 +1,2 @@
1
+ export { DiffView } from "./DiffView";
2
+ export type { DiffFile, DiffViewProps } from "./DiffView";
@@ -1 +1,3 @@
1
- export {};
1
+ export * from "./banner";
2
+ export * from "./diff-view";
3
+ export * from "./status-words";
@@ -0,0 +1,16 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ import "./StatusWords.css";
3
+ /** The tones a word draws; any other string is drawn neutrally. */
4
+ export type StatusWordTone = "ok" | "warn" | "err" | "quiet" | "off" | (string & {});
5
+ export type StatusWord = {
6
+ tone: StatusWordTone;
7
+ /** The state in words. */
8
+ label: string;
9
+ /** Shown on hover: what the state means or why it is so. */
10
+ title?: string;
11
+ };
12
+ export type StatusWordsProps = Omit<ComponentPropsWithRef<"ul">, "children"> & {
13
+ /** The states, most urgent first; drawn in this order. */
14
+ items: readonly StatusWord[];
15
+ };
16
+ export declare function StatusWords({ items, className, ...rest }: StatusWordsProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { StatusWords } from "./StatusWords";
2
+ export type { StatusWord, StatusWordTone, StatusWordsProps } from "./StatusWords";
@@ -7,6 +7,7 @@ export * from "./icon-button";
7
7
  export * from "./key-value";
8
8
  export * from "./panel";
9
9
  export * from "./pill";
10
+ export * from "./radio-group";
10
11
  export * from "./section-title";
11
12
  export * from "./select";
12
13
  export * from "./sheet";
@@ -0,0 +1,33 @@
1
+ import { type ComponentPropsWithRef, type ReactNode } from "react";
2
+ import "./RadioGroup.css";
3
+ /** stacked (the default: one option a row) or inline (the options side by side, wrapping); others stack. */
4
+ export type RadioGroupLayout = "stacked" | "inline" | (string & {});
5
+ export type RadioOption = {
6
+ /** The value onChange gives when this option is picked; unique in the group. */
7
+ value: string;
8
+ /** The option's words, which pick it too. */
9
+ label: ReactNode;
10
+ /** Shown on hover over the option. */
11
+ title?: string;
12
+ /** Not pickable. */
13
+ disabled?: boolean;
14
+ };
15
+ export type RadioGroupProps = Omit<ComponentPropsWithRef<"fieldset">, "children" | "onChange"> & {
16
+ /** What the choice is: the group's legend and accessible name. */
17
+ legend: ReactNode;
18
+ /** Keeps the legend for screen readers only, when the layout around the group already says what it is. */
19
+ legendHidden?: boolean;
20
+ options: readonly RadioOption[];
21
+ /** The picked option's value; one matching no option (or undefined) picks none. */
22
+ value: string | undefined;
23
+ /** Asks the app to pick this value. */
24
+ onChange: (value: string) => void;
25
+ /** The radios' shared name; one of its own by default. */
26
+ name?: string;
27
+ layout?: RadioGroupLayout;
28
+ /** A line of help under the options. */
29
+ hint?: ReactNode;
30
+ /** Why the choice is refused; while there is one the group is marked invalid. Empty means none. */
31
+ error?: ReactNode;
32
+ };
33
+ export declare function RadioGroup({ legend, legendHidden, options, value, onChange, name, layout, hint, error, className, "aria-describedby": describedByOwn, "aria-invalid": invalidOwn, ...rest }: RadioGroupProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { RadioGroup } from "./RadioGroup";
2
+ export type { RadioGroupLayout, RadioGroupProps, RadioOption } from "./RadioGroup";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcurcio/patchbay",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A React component library for graph-based editors and live dashboards: design tokens and themes, primitives, and React Flow graph components",
5
5
  "keywords": [
6
6
  "react",