@mcurcio/patchbay 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/composites.js +190 -158
- package/dist/composites.js.map +1 -1
- package/dist/graph.css +1 -1
- package/dist/graph.js +639 -63
- package/dist/graph.js.map +1 -1
- package/dist/primitives.css +1 -1
- package/dist/primitives.js +108 -93
- package/dist/primitives.js.map +1 -1
- package/dist/testing.js +207 -0
- package/dist/testing.js.map +1 -0
- package/dist/tokens.css +22 -2
- package/dist/types/composites/banner/Banner.d.ts +9 -3
- package/dist/types/composites/banner/index.d.ts +2 -2
- package/dist/types/composites/command-palette/CommandPalette.d.ts +16 -10
- package/dist/types/composites/command-palette/index.d.ts +2 -2
- package/dist/types/composites/shortcut-sheet/ShortcutSheet.d.ts +17 -11
- package/dist/types/composites/shortcut-sheet/index.d.ts +2 -2
- package/dist/types/composites/toaster/Toaster.d.ts +15 -9
- package/dist/types/composites/toaster/index.d.ts +2 -2
- package/dist/types/graph/add-at/index.d.ts +2 -0
- package/dist/types/graph/add-at/useAddAt.d.ts +32 -0
- package/dist/types/graph/canvas-tools/CanvasTools.d.ts +40 -0
- package/dist/types/graph/canvas-tools/index.d.ts +2 -0
- package/dist/types/graph/canvas-tools/motion.d.ts +2 -0
- package/dist/types/graph/connect-hints/index.d.ts +4 -0
- package/dist/types/graph/connect-hints/mergeFlowProps.d.ts +10 -0
- package/dist/types/graph/connect-hints/useConnectHints.d.ts +48 -0
- package/dist/types/graph/follow-fit/index.d.ts +2 -0
- package/dist/types/graph/follow-fit/useFollowFit.d.ts +21 -0
- package/dist/types/graph/ghost-wire/GhostWire.d.ts +16 -0
- package/dist/types/graph/ghost-wire/index.d.ts +2 -0
- package/dist/types/graph/index.d.ts +8 -0
- package/dist/types/graph/meter/Meter.d.ts +9 -3
- package/dist/types/graph/meter/index.d.ts +2 -2
- package/dist/types/graph/node-box/NodeBox.d.ts +52 -0
- package/dist/types/graph/node-box/geometry.d.ts +47 -0
- package/dist/types/graph/node-box/index.d.ts +4 -0
- package/dist/types/graph/port-row/PortRow.d.ts +31 -0
- package/dist/types/graph/port-row/index.d.ts +2 -0
- package/dist/types/graph/wire/Wire.d.ts +27 -0
- package/dist/types/graph/wire/index.d.ts +2 -0
- package/dist/types/primitives/dialog/Dialog.d.ts +8 -2
- package/dist/types/primitives/dialog/index.d.ts +2 -2
- package/dist/types/primitives/sheet/Sheet.d.ts +8 -2
- package/dist/types/primitives/sheet/index.d.ts +2 -2
- package/dist/types/primitives/splitter/Splitter.d.ts +8 -2
- package/dist/types/primitives/splitter/splitter-math.d.ts +12 -4
- package/dist/types/testing/brand-css.d.ts +41 -0
- package/dist/types/testing/contrast.d.ts +36 -0
- package/dist/types/testing/index.d.ts +2 -0
- package/package.json +6 -2
package/dist/testing.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// src/tokens/tokens.css?raw
|
|
2
|
+
var e = (e) => e.trim().replace(/\s+/g, " ");
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
5
|
+
}
|
|
6
|
+
function n(t) {
|
|
7
|
+
let n = /* @__PURE__ */ new Map();
|
|
8
|
+
for (let r of t.split(";")) {
|
|
9
|
+
let t = r.indexOf(":");
|
|
10
|
+
t < 0 || n.set(r.slice(0, t).trim(), e(r.slice(t + 1)));
|
|
11
|
+
}
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
function r(i, a = null) {
|
|
15
|
+
let o = t(i), s = [], c = 0;
|
|
16
|
+
for (; c < o.length;) {
|
|
17
|
+
let t = o.indexOf("{", c);
|
|
18
|
+
if (t < 0) break;
|
|
19
|
+
let i = 1, l = t + 1;
|
|
20
|
+
for (; l < o.length && i > 0; l += 1) o[l] === "{" ? i += 1 : o[l] === "}" && --i;
|
|
21
|
+
let u = o.slice(c, t), d = e(u.slice(u.lastIndexOf(";") + 1)), f = o.slice(t + 1, l - 1);
|
|
22
|
+
d.startsWith("@") ? s.push(...r(f, d)) : s.push({
|
|
23
|
+
media: a,
|
|
24
|
+
selector: d,
|
|
25
|
+
declarations: n(f)
|
|
26
|
+
}), c = l;
|
|
27
|
+
}
|
|
28
|
+
return s;
|
|
29
|
+
}
|
|
30
|
+
function i(e) {
|
|
31
|
+
return e === void 0 ? /* @__PURE__ */ new Map() : new Map([...e.declarations].filter(([e]) => e.startsWith("--")));
|
|
32
|
+
}
|
|
33
|
+
var a = /^@media \(prefers-color-scheme:\s*dark\)$/;
|
|
34
|
+
function o(e, t, n) {
|
|
35
|
+
return e.find((e) => e.selector === n && (t === null ? e.media === null : e.media !== null && t.test(e.media)));
|
|
36
|
+
}
|
|
37
|
+
function s(e, t) {
|
|
38
|
+
let n = r(e);
|
|
39
|
+
return {
|
|
40
|
+
blocks: n,
|
|
41
|
+
light: o(n, null, t),
|
|
42
|
+
systemDark: o(n, a, `${t}:not([data-theme])`),
|
|
43
|
+
chosenDark: o(n, null, `${t}[data-theme="dark"]`)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function c(e, t, n) {
|
|
47
|
+
let r = (e) => n === "dark" ? e.chosenDark : n === "system dark" ? e.systemDark : void 0, a = [i(e.light), i(r(e))];
|
|
48
|
+
return t !== null && a.push(i(t.light), i(r(t))), new Map(a.flatMap((e) => [...e]));
|
|
49
|
+
}
|
|
50
|
+
function l(e, t) {
|
|
51
|
+
let n = /* @__PURE__ */ new Set(), r = t;
|
|
52
|
+
for (let t = /^var\((--[\w-]+)\)$/.exec(r); t !== null;) {
|
|
53
|
+
let i = t[1] ?? "";
|
|
54
|
+
if (n.has(i)) throw Error(`a var() cycle through ${i}`);
|
|
55
|
+
n.add(i);
|
|
56
|
+
let a = e.get(i);
|
|
57
|
+
if (a === void 0) throw Error(`${i} is not defined`);
|
|
58
|
+
r = a, t = /^var\((--[\w-]+)\)$/.exec(r);
|
|
59
|
+
}
|
|
60
|
+
return r;
|
|
61
|
+
}
|
|
62
|
+
function u(e) {
|
|
63
|
+
let t = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e);
|
|
64
|
+
if (t !== null) return [
|
|
65
|
+
1,
|
|
66
|
+
2,
|
|
67
|
+
3
|
|
68
|
+
].map((e) => parseInt((t[e] ?? "") + (t[e] ?? ""), 16));
|
|
69
|
+
let n = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);
|
|
70
|
+
return n === null ? null : [
|
|
71
|
+
1,
|
|
72
|
+
2,
|
|
73
|
+
3
|
|
74
|
+
].map((e) => parseInt(n[e] ?? "", 16));
|
|
75
|
+
}
|
|
76
|
+
// src/testing/contrast.ts
|
|
77
|
+
var d = 4.5, f = [
|
|
78
|
+
{
|
|
79
|
+
fg: ["--pb-text", "--pb-muted"],
|
|
80
|
+
on: [
|
|
81
|
+
"--pb-surface",
|
|
82
|
+
"--pb-raised",
|
|
83
|
+
"--pb-sunken"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
fg: ["--pb-text"],
|
|
88
|
+
on: ["--pb-warn-soft", "--pb-err-soft"]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
fg: ["--pb-accent"],
|
|
92
|
+
on: [
|
|
93
|
+
"--pb-surface",
|
|
94
|
+
"--pb-raised",
|
|
95
|
+
"--pb-sunken"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
fg: [
|
|
100
|
+
"--pb-ok",
|
|
101
|
+
"--pb-warn",
|
|
102
|
+
"--pb-err",
|
|
103
|
+
"--pb-quiet",
|
|
104
|
+
"--pb-off",
|
|
105
|
+
"--pb-added",
|
|
106
|
+
"--pb-removed",
|
|
107
|
+
"--pb-renamed"
|
|
108
|
+
],
|
|
109
|
+
on: [
|
|
110
|
+
"--pb-surface",
|
|
111
|
+
"--pb-raised",
|
|
112
|
+
"--pb-sunken"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
fg: ["--pb-warn"],
|
|
117
|
+
on: ["--pb-warn-soft"]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
fg: ["--pb-err"],
|
|
121
|
+
on: ["--pb-err-soft"]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
fg: ["--pb-on-strong"],
|
|
125
|
+
on: [
|
|
126
|
+
"--pb-accent",
|
|
127
|
+
"--pb-err",
|
|
128
|
+
"--pb-warn",
|
|
129
|
+
"--pb-ok",
|
|
130
|
+
"--pb-quiet",
|
|
131
|
+
"--pb-off",
|
|
132
|
+
"--pb-muted",
|
|
133
|
+
"--pb-added",
|
|
134
|
+
"--pb-removed",
|
|
135
|
+
"--pb-renamed"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
fg: [
|
|
140
|
+
"--pb-code-text",
|
|
141
|
+
"--pb-code-directive",
|
|
142
|
+
"--pb-code-keyword",
|
|
143
|
+
"--pb-code-variable",
|
|
144
|
+
"--pb-code-number",
|
|
145
|
+
"--pb-code-string",
|
|
146
|
+
"--pb-code-comment",
|
|
147
|
+
"--pb-code-punctuation",
|
|
148
|
+
"--pb-code-error"
|
|
149
|
+
],
|
|
150
|
+
on: ["--pb-code-surface", "--pb-code-surface-readonly"]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
fg: ["--pb-code-error"],
|
|
154
|
+
on: ["--pb-code-error-surface"]
|
|
155
|
+
}
|
|
156
|
+
];
|
|
157
|
+
function p([e, t, n]) {
|
|
158
|
+
let r = (e) => {
|
|
159
|
+
let t = e / 255;
|
|
160
|
+
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
161
|
+
};
|
|
162
|
+
return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
|
|
163
|
+
}
|
|
164
|
+
function m(e, t) {
|
|
165
|
+
let n = u(e), r = u(t);
|
|
166
|
+
if (n === null || r === null) return NaN;
|
|
167
|
+
let [i = 0, a = 0] = [p(n), p(r)].sort((e, t) => t - e);
|
|
168
|
+
return (i + .05) / (a + .05);
|
|
169
|
+
}
|
|
170
|
+
function h(e, t) {
|
|
171
|
+
let n = e.get(t);
|
|
172
|
+
if (n === void 0) return `undefined (${t} is not set)`;
|
|
173
|
+
try {
|
|
174
|
+
return l(e, n);
|
|
175
|
+
} catch (e) {
|
|
176
|
+
return `unresolved (${e instanceof Error ? e.message : String(e)})`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function g(e, t) {
|
|
180
|
+
let n = s("/* patchbay's design tokens (@mcurcio/patchbay/tokens.css): every colour, radius, shadow, duration, space and type\n size a component draws with, as --pb-* custom properties on :root, in a light and a dark theme (docs/tokens.md).\n Component stylesheets use only these, and tokens.test.ts checks it.\n\n The theme follows the system until data-theme on <html> chooses one: no attribute is the system's choice,\n data-theme=\"light\" or \"dark\" overrides it. The dark set is therefore written twice, once for a dark system with no\n choice made and once for a chosen dark, and tokens.test.ts holds the two equal. CSS's light-dark() is not used\n because a CSS minifier may rewrite it for older browsers. */\n:root {\n color-scheme: light;\n\n /* Surfaces: the canvas, boxes and controls, tracks and read-only text. */\n --pb-surface: #f6f7f9;\n --pb-raised: #ffffff;\n --pb-sunken: #eef0f3;\n\n /* Lines: borders, the canvas's dot grid. */\n --pb-line: #d9dde3;\n --pb-line-strong: #aeb5bf;\n\n /* Text: body, secondary, selection and focus, text on a filled chip. */\n --pb-text: #16181d;\n --pb-muted: #5b6270;\n --pb-accent: #3b5bdb;\n --pb-on-strong: #ffffff;\n\n /* Tones: what a state is drawn in, and the soft surfaces under a warning or an error. */\n --pb-ok: #26773a;\n --pb-warn: #a35200;\n --pb-err: #c92a2a;\n --pb-quiet: #4058d6;\n --pb-off: #646b78;\n --pb-warn-soft: #fff4e6;\n --pb-err-soft: #ffe3e3;\n\n /* Changes: an edit not yet applied (added, removed, renamed). */\n --pb-added: #157a3a;\n --pb-removed: #c42020;\n --pb-renamed: #7c3aed;\n\n /* Meters: the bar's three zones and the peak tick. */\n --pb-meter-low: #40c057;\n --pb-meter-mid: #fab005;\n --pb-meter-hot: #fa5252;\n --pb-meter-peak: #2b8a3e;\n\n /* Code: a code box and its highlighter's token colours. */\n --pb-code-surface: var(--pb-raised);\n --pb-code-surface-readonly: var(--pb-sunken);\n --pb-code-border: var(--pb-line-strong);\n --pb-code-text: var(--pb-text);\n --pb-code-directive: #1864ab;\n --pb-code-keyword: #a35200;\n --pb-code-variable: #8a6100;\n --pb-code-number: #2b7a3a;\n --pb-code-string: #a61e1e;\n --pb-code-comment: #666666;\n --pb-code-punctuation: #495057;\n --pb-code-error: #c92a2a;\n --pb-code-error-surface: var(--pb-err-soft);\n\n /* Shape. */\n --pb-radius-box: 8px;\n --pb-radius-control: 6px;\n --pb-radius-pill: 999px;\n --pb-shadow: 0 1px 2px rgb(16 24 40 / 0.08);\n --pb-shadow-lifted: 0 4px 12px rgb(16 24 40 / 0.14);\n\n /* Motion: hover and selection, what slides, a pulsing dot, a wire's flow, the busy spinner's turn. The last three\n drive infinite animations, which a component stops under reduced motion rather than running at 0 s. */\n --pb-motion-fast: 120ms;\n --pb-motion-slow: 180ms;\n --pb-motion-pulse: 2s;\n --pb-motion-flow: 1s;\n --pb-motion-spin: 0.8s;\n\n /* Density: the spacing steps, a compact control's height, the top bar's height. */\n --pb-space-1: 2px;\n --pb-space-2: 4px;\n --pb-space-3: 8px;\n --pb-space-4: 12px;\n --pb-space-5: 16px;\n --pb-row: 22px;\n --pb-bar: 44px;\n\n /* Node geometry: a node box's fixed sizes, the same values as the constants /graph exports (NODE_WIDTH and the\n rest), since an app lays its nodes out from those before they render. A brand may not set these; the tests hold\n each equal to its constant and fail on a brand that sets one. */\n --pb-node-width: 240px;\n --pb-node-header: 46px;\n --pb-node-line: 22px;\n --pb-node-row: 22px;\n --pb-node-pad: 8px;\n --pb-node-footer: 28px;\n --pb-node-handle: 10px;\n --pb-node-handle-hit: 20px;\n\n /* Type: the faces, the two text sizes, and the code boxes' size (shared by a textarea, its highlighted copy and a\n gutter, so their glyphs line up). */\n --pb-font-ui: system-ui, sans-serif;\n --pb-font-code: ui-monospace, monospace;\n --pb-text-sm: 12px;\n --pb-text-md: 13px;\n --pb-code-size: 12px;\n}\n\n/* The system's dark, while no theme is chosen. */\n@media (prefers-color-scheme: dark) {\n :root:not([data-theme]) {\n color-scheme: dark;\n --pb-surface: #0f1115;\n --pb-raised: #181b21;\n --pb-sunken: #12151a;\n --pb-line: #2a2f38;\n --pb-line-strong: #3d4450;\n --pb-text: #e6e8ec;\n --pb-muted: #9aa2b1;\n --pb-accent: #7c94ff;\n --pb-on-strong: #0f1115;\n --pb-ok: #51cf66;\n --pb-warn: #ffa94d;\n --pb-err: #ff6b6b;\n --pb-quiet: #91a7ff;\n --pb-off: #808999;\n --pb-warn-soft: #2e2414;\n --pb-err-soft: #361b1d;\n --pb-added: #4ade80;\n --pb-removed: #f87171;\n --pb-renamed: #c084fc;\n --pb-meter-low: #51cf66;\n --pb-meter-mid: #ffd43b;\n --pb-meter-hot: #ff8787;\n --pb-meter-peak: #b2f2bb;\n --pb-shadow: 0 1px 2px rgb(0 0 0 / 0.5);\n --pb-shadow-lifted: 0 4px 12px rgb(0 0 0 / 0.6);\n --pb-code-directive: #74c0fc;\n --pb-code-keyword: #ffa94d;\n --pb-code-variable: #ffd43b;\n --pb-code-number: #69db7c;\n --pb-code-string: #ff8787;\n --pb-code-comment: #8c929c;\n --pb-code-punctuation: #adb5bd;\n --pb-code-error: #ff6b6b;\n }\n}\n\n/* Dark chosen over any system: the same set, line for line. */\n:root[data-theme=\"dark\"] {\n color-scheme: dark;\n --pb-surface: #0f1115;\n --pb-raised: #181b21;\n --pb-sunken: #12151a;\n --pb-line: #2a2f38;\n --pb-line-strong: #3d4450;\n --pb-text: #e6e8ec;\n --pb-muted: #9aa2b1;\n --pb-accent: #7c94ff;\n --pb-on-strong: #0f1115;\n --pb-ok: #51cf66;\n --pb-warn: #ffa94d;\n --pb-err: #ff6b6b;\n --pb-quiet: #91a7ff;\n --pb-off: #808999;\n --pb-warn-soft: #2e2414;\n --pb-err-soft: #361b1d;\n --pb-added: #4ade80;\n --pb-removed: #f87171;\n --pb-renamed: #c084fc;\n --pb-meter-low: #51cf66;\n --pb-meter-mid: #ffd43b;\n --pb-meter-hot: #ff8787;\n --pb-meter-peak: #b2f2bb;\n --pb-shadow: 0 1px 2px rgb(0 0 0 / 0.5);\n --pb-shadow-lifted: 0 4px 12px rgb(0 0 0 / 0.6);\n --pb-code-directive: #74c0fc;\n --pb-code-keyword: #ffa94d;\n --pb-code-variable: #ffd43b;\n --pb-code-number: #69db7c;\n --pb-code-string: #ff8787;\n --pb-code-comment: #8c929c;\n --pb-code-punctuation: #adb5bd;\n --pb-code-error: #ff6b6b;\n}\n\n/* A finger: every text field is 16 px, code boxes included, as iOS Safari zooms the page when a smaller field takes\n the focus; a handle's hit area grows to 32 px (handles sit 22 px apart, too close for 36 px targets). */\n@media (hover: none) and (pointer: coarse) {\n :root {\n --pb-code-size: 16px;\n --pb-node-handle-hit: 32px;\n }\n}\n\n/* No motion for those who ask for none. The pulse, the flow and the spin keep their durations: a component stops those\n infinite animations instead, since one at 0 s would churn rather than stop. */\n@media (prefers-reduced-motion: reduce) {\n :root {\n --pb-motion-fast: 0ms;\n --pb-motion-slow: 0ms;\n }\n}\n\n/* Derived colours: mixed from the theme's tokens, so they follow the theme and a brand without a dark value of their\n own (var() resolves on :root, after the theme and the brand). A brand may still override them. */\n:root {\n /* Behind a modal dialog: the canvas, mostly opaque. */\n --pb-scrim: color-mix(in srgb, var(--pb-surface) 72%, transparent);\n /* A filled accent control under the pointer: the accent pulled toward the text colour. */\n --pb-accent-hover: color-mix(in srgb, var(--pb-accent) 85%, var(--pb-text));\n}\n\n/* React Flow's own variables point at the tokens, so its canvas, dot grid, wires, handles and minimap follow the\n theme and the brand. Its colorMode prop is not used: it would fight data-theme. Set on .react-flow, so each var()\n resolves where React Flow reads it. */\n.react-flow {\n --xy-background-color: var(--pb-surface);\n --xy-background-pattern-color: var(--pb-line);\n --xy-node-color: var(--pb-text);\n --xy-edge-stroke: var(--pb-muted);\n --xy-edge-stroke-selected: var(--pb-accent);\n --xy-connectionline-stroke: var(--pb-muted);\n --xy-handle-background-color: var(--pb-text);\n --xy-handle-border-color: var(--pb-raised);\n --xy-selection-background-color: color-mix(in srgb, var(--pb-accent) 8%, transparent);\n --xy-selection-border: 1px dotted var(--pb-accent);\n --xy-attribution-background-color: color-mix(in srgb, var(--pb-raised) 60%, transparent);\n --xy-controls-button-background-color: var(--pb-raised);\n --xy-controls-button-color: var(--pb-text);\n --xy-minimap-background-color: var(--pb-raised);\n --xy-minimap-mask-background-color: color-mix(in srgb, var(--pb-surface) 65%, transparent);\n --xy-minimap-mask-stroke-color: var(--pb-accent);\n --xy-minimap-node-background-color: var(--pb-sunken);\n --xy-minimap-node-stroke-color: var(--pb-line-strong);\n}\n\n/* React Flow's attribution link is drawn in a fixed grey of its own, below 4.5:1 on its panel, with no variable to\n point at a token; the muted text colour keeps it legible in both themes and under a brand. Written under .react-flow,\n so it wins whichever of the two stylesheets an app loads first. */\n.react-flow .react-flow__attribution a {\n color: var(--pb-muted);\n}\n", ":root"), r = s(e, `:root[data-brand="${t}"]`), i = [];
|
|
181
|
+
for (let e of [
|
|
182
|
+
"light",
|
|
183
|
+
"dark",
|
|
184
|
+
"system dark"
|
|
185
|
+
]) {
|
|
186
|
+
let a = c(n, r, e);
|
|
187
|
+
for (let n of f) for (let r of n.fg) for (let o of n.on) {
|
|
188
|
+
let n = h(a, r), s = h(a, o), c = m(n, s);
|
|
189
|
+
if (c >= 4.5) continue;
|
|
190
|
+
let l = `${t} ${e}: ${r} (${n}) on ${o} (${s}) ${Number.isNaN(c) ? "is not two hex colours" : `is ${c.toFixed(2)}:1`}`;
|
|
191
|
+
i.push({
|
|
192
|
+
brand: t,
|
|
193
|
+
theme: e,
|
|
194
|
+
fg: r,
|
|
195
|
+
on: o,
|
|
196
|
+
fgValue: n,
|
|
197
|
+
onValue: s,
|
|
198
|
+
ratio: c,
|
|
199
|
+
message: l
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return i;
|
|
204
|
+
}
|
|
205
|
+
export { g as checkBrandContrast, f as contrastPairs, m as contrastRatio, d as minimumContrast };
|
|
206
|
+
|
|
207
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","names":["tokensCss","squash","text","stripComments","declarations","found","declaration","body","colon","cssBlocks","css","at","open","depth","close","before","prelude","customProperties","block","name","systemDark","findBlock","blocks","candidate","selector","media","tokenSets","root","tokensInForce","dark","theme","sets","layers","base","brand","layer","resolveToken","seen","current","value","reference","next","tokens","hexColour","short","i","long","minimumContrast","contrastPairs","luminance","r","g","b","channel","s","c","contrastRatio","first","a","second","high","low","y","x","valueOf","error","checkBrandContrast","own","failures","pair","fg","on","fgValue","onValue","ratio","message"],"sources":["../src/testing/brand-css.ts","../src/testing/contrast.ts"],"sourcesContent":["// Reading the token and brand stylesheets as text (docs/tokens.md#writing-a-brand): their rule sets, the three sets of\n// tokens a :root selector holds (light, the system's dark, the chosen dark), and the tokens in force in a theme, as\n// the cascade resolves them. Pure: no DOM, no test runner. The contrast check and the token tests read through it.\n\n/** One rule set: its selector, the at-rule it sits in (`@media (…)`, or null at the top), and its declarations. */\nexport type CssBlock = { media: string | null; selector: string; declarations: Map<string, string> };\n\nconst squash = (text: string) => text.trim().replace(/\\s+/g, \" \");\n\nexport function stripComments(text: string): string {\n return text.replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\");\n}\n\nfunction declarations(body: string): Map<string, string> {\n const found = new Map<string, string>();\n for (const declaration of body.split(\";\")) {\n const colon = declaration.indexOf(\":\");\n if (colon < 0) continue;\n found.set(declaration.slice(0, colon).trim(), squash(declaration.slice(colon + 1)));\n }\n return found;\n}\n\n/**\n * A stylesheet's rule sets, in order: each plain rule, and each rule inside an at-rule (`@media`) with that at-rule's\n * prelude as its `media`. Statement at-rules (`@import …;`) are skipped. It reads stylesheets as the token files and\n * brands are written, not every CSS there is: braces inside strings are not understood.\n */\nexport function cssBlocks(css: string, media: string | null = null): CssBlock[] {\n const text = stripComments(css);\n const found: CssBlock[] = [];\n let at = 0;\n while (at < text.length) {\n const open = text.indexOf(\"{\", at);\n if (open < 0) break;\n let depth = 1;\n let close = open + 1;\n for (; close < text.length && depth > 0; close += 1) {\n if (text[close] === \"{\") depth += 1;\n else if (text[close] === \"}\") depth -= 1;\n }\n const before = text.slice(at, open);\n const prelude = squash(before.slice(before.lastIndexOf(\";\") + 1));\n const body = text.slice(open + 1, close - 1);\n if (prelude.startsWith(\"@\")) found.push(...cssBlocks(body, prelude));\n else found.push({ media, selector: prelude, declarations: declarations(body) });\n at = close;\n }\n return found;\n}\n\n/** A block's custom properties (`--name: value`), or none for a missing block. */\nexport function customProperties(block: CssBlock | undefined): Map<string, string> {\n if (block === undefined) return new Map();\n return new Map([...block.declarations].filter(([name]) => name.startsWith(\"--\")));\n}\n\nconst systemDark = /^@media \\(prefers-color-scheme:\\s*dark\\)$/;\n\n/** The block with this selector, at the top (`media` null) or inside an at-rule whose prelude `media` matches. */\nexport function findBlock(blocks: readonly CssBlock[], media: RegExp | null, selector: string): CssBlock | undefined {\n return blocks.find(\n (candidate) =>\n candidate.selector === selector &&\n (media === null ? candidate.media === null : candidate.media !== null && media.test(candidate.media)),\n );\n}\n\n/** A stylesheet's three sets under a :root selector, as tokens.css and a brand write them, and all its blocks. */\nexport type TokenSets = {\n blocks: CssBlock[];\n /** `root` itself: the light set. */\n light: CssBlock | undefined;\n /** `root:not([data-theme])` inside `@media (prefers-color-scheme: dark)`: the dark set when no choice is made. */\n systemDark: CssBlock | undefined;\n /** `root[data-theme=\"dark\"]`: the dark set when dark is chosen. */\n chosenDark: CssBlock | undefined;\n};\n\n/** The light, system dark and chosen dark sets of a stylesheet under `root` (`:root`, or `:root[data-brand=\"x\"]`). */\nexport function tokenSets(css: string, root: string): TokenSets {\n const blocks = cssBlocks(css);\n return {\n blocks,\n light: findBlock(blocks, null, root),\n systemDark: findBlock(blocks, systemDark, `${root}:not([data-theme])`),\n chosenDark: findBlock(blocks, null, `${root}[data-theme=\"dark\"]`),\n };\n}\n\n/** How a page is themed: light, dark chosen with `data-theme=\"dark\"`, or dark by the system with no choice made. */\nexport type ContrastTheme = \"light\" | \"dark\" | \"system dark\";\n\n/** The tokens in force in a theme, in the cascade's order: the base's set for it, then the brand's (if any). */\nexport function tokensInForce(base: TokenSets, brand: TokenSets | null, theme: ContrastTheme): Map<string, string> {\n const dark = (sets: TokenSets) =>\n theme === \"dark\" ? sets.chosenDark : theme === \"system dark\" ? sets.systemDark : undefined;\n const layers = [customProperties(base.light), customProperties(dark(base))];\n if (brand !== null) layers.push(customProperties(brand.light), customProperties(dark(brand)));\n return new Map(layers.flatMap((layer) => [...layer]));\n}\n\n/** A value with every `var(--name)` it is followed through resolved from `tokens`; throws on a cycle or a gap. */\nexport function resolveToken(tokens: Map<string, string>, value: string): string {\n const seen = new Set<string>();\n let current = value;\n for (let reference = /^var\\((--[\\w-]+)\\)$/.exec(current); reference !== null;) {\n const name = reference[1] ?? \"\";\n if (seen.has(name)) throw new Error(`a var() cycle through ${name}`);\n seen.add(name);\n const next = tokens.get(name);\n if (next === undefined) throw new Error(`${name} is not defined`);\n current = next;\n reference = /^var\\((--[\\w-]+)\\)$/.exec(current);\n }\n return current;\n}\n\n/** An sRGB colour, 0 to 255 a channel. */\nexport type Rgb = readonly [number, number, number];\n\n/** A `#rgb` or `#rrggbb` colour, or null for anything else. */\nexport function hexColour(value: string): Rgb | null {\n const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(value);\n if (short !== null) return [1, 2, 3].map((i) => parseInt((short[i] ?? \"\") + (short[i] ?? \"\"), 16)) as unknown as Rgb;\n const long = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(value);\n if (long !== null) return [1, 2, 3].map((i) => parseInt(long[i] ?? \"\", 16)) as unknown as Rgb;\n return null;\n}\n\n/** Whether a value is a colour written as hex or `rgb()`/`rgba()`. */\nexport function isColour(value: string): boolean {\n return hexColour(value) !== null || /\\brgba?\\(/.test(value);\n}\n","// The contrast rule (docs/tokens.md#writing-a-brand): every text, tone, change, on-strong and code token at 4.5:1 on\n// each surface it is drawn on, in light and in dark, with a brand's values in force over tokens.css's. Pure: it reads\n// stylesheets as text and returns what fails, so an app's own tests (any runner) can hold its brand to the rule.\nimport tokensCss from \"../tokens/tokens.css?raw\";\nimport { hexColour, resolveToken, type Rgb, type ContrastTheme, tokenSets, tokensInForce } from \"./brand-css\";\n\n/** Tokens drawn as text (`fg`), each checked on every surface it is drawn on (`on`). */\nexport type ContrastPair = { readonly fg: readonly string[]; readonly on: readonly string[] };\n\n/** The least contrast a text token keeps on its surfaces: WCAG's 4.5:1 for normal text. */\nexport const minimumContrast = 4.5;\n\n/** Every text token and the surfaces it is drawn on: text, the accent, tones, changes, on-strong and code. */\nexport const contrastPairs: readonly ContrastPair[] = [\n { fg: [\"--pb-text\", \"--pb-muted\"], on: [\"--pb-surface\", \"--pb-raised\", \"--pb-sunken\"] },\n { fg: [\"--pb-text\"], on: [\"--pb-warn-soft\", \"--pb-err-soft\"] },\n // The sunken surface is under an accent pill or badge.\n { fg: [\"--pb-accent\"], on: [\"--pb-surface\", \"--pb-raised\", \"--pb-sunken\"] },\n {\n fg: [\"--pb-ok\", \"--pb-warn\", \"--pb-err\", \"--pb-quiet\", \"--pb-off\", \"--pb-added\", \"--pb-removed\", \"--pb-renamed\"],\n on: [\"--pb-surface\", \"--pb-raised\", \"--pb-sunken\"],\n },\n { fg: [\"--pb-warn\"], on: [\"--pb-warn-soft\"] },\n { fg: [\"--pb-err\"], on: [\"--pb-err-soft\"] },\n // On-strong is the words on a filled button, mark or badge, so it is checked on every tone a badge fills with.\n {\n fg: [\"--pb-on-strong\"],\n on: [\n \"--pb-accent\",\n \"--pb-err\",\n \"--pb-warn\",\n \"--pb-ok\",\n \"--pb-quiet\",\n \"--pb-off\",\n \"--pb-muted\",\n \"--pb-added\",\n \"--pb-removed\",\n \"--pb-renamed\",\n ],\n },\n {\n fg: [\n \"--pb-code-text\",\n \"--pb-code-directive\",\n \"--pb-code-keyword\",\n \"--pb-code-variable\",\n \"--pb-code-number\",\n \"--pb-code-string\",\n \"--pb-code-comment\",\n \"--pb-code-punctuation\",\n \"--pb-code-error\",\n ],\n on: [\"--pb-code-surface\", \"--pb-code-surface-readonly\"],\n },\n { fg: [\"--pb-code-error\"], on: [\"--pb-code-error-surface\"] },\n];\n\n/** WCAG 2's relative luminance of an sRGB colour. */\nfunction luminance([r, g, b]: Rgb): number {\n const channel = (c: number) => {\n const s = c / 255;\n return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;\n };\n return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);\n}\n\n/** WCAG 2's contrast ratio of two hex colours (`#rgb` or `#rrggbb`), 1 to 21; NaN when either is not one. */\nexport function contrastRatio(a: string, b: string): number {\n const first = hexColour(a);\n const second = hexColour(b);\n if (first === null || second === null) return Number.NaN;\n const [high = 0, low = 0] = [luminance(first), luminance(second)].sort((x, y) => y - x);\n return (high + 0.05) / (low + 0.05);\n}\n\n/** One text token below the rule on one surface, in one theme. */\nexport type ContrastFailure = {\n /** The brand's name, or \"base\" for tokens.css alone. */\n brand: string;\n theme: ContrastTheme;\n fg: string;\n on: string;\n /** The values the two resolve to in that theme (or why one does not resolve). */\n fgValue: string;\n onValue: string;\n /** The contrast, or NaN when a value is not a hex colour. */\n ratio: number;\n /** All of it in a line: \"harbor dark: --pb-muted (#64748b) on --pb-raised (#1e293b) is 3.07:1\". */\n message: string;\n};\n\nexport type { ContrastTheme } from \"./brand-css\";\n\nfunction valueOf(tokens: Map<string, string>, name: string): string {\n const value = tokens.get(name);\n if (value === undefined) return `undefined (${name} is not set)`;\n try {\n return resolveToken(tokens, value);\n } catch (error) {\n return `unresolved (${error instanceof Error ? error.message : String(error)})`;\n }\n}\n\n/**\n * Checks a brand against the contrast rule: for each theme (light, dark chosen, dark by the system), the tokens in\n * force are tokens.css's set for it with the brand's blocks for `brand` (its `:root[data-brand=\"…\"]` rules) over\n * them, and every pair in `contrastPairs` must reach `minimumContrast`. Returns the failures; none means the brand\n * keeps the rule. `css` is the brand's stylesheet as text; an empty one (or a `brand` it has no blocks for) checks\n * the base theme alone. Colours must be written as hex, or the pair fails saying so.\n */\nexport function checkBrandContrast(css: string, brand: string): ContrastFailure[] {\n const base = tokenSets(tokensCss, \":root\");\n const own = tokenSets(css, `:root[data-brand=\"${brand}\"]`);\n const failures: ContrastFailure[] = [];\n for (const theme of [\"light\", \"dark\", \"system dark\"] as const) {\n const tokens = tokensInForce(base, own, theme);\n for (const pair of contrastPairs) {\n for (const fg of pair.fg) {\n for (const on of pair.on) {\n const fgValue = valueOf(tokens, fg);\n const onValue = valueOf(tokens, on);\n const ratio = contrastRatio(fgValue, onValue);\n if (ratio >= minimumContrast) continue;\n const said = Number.isNaN(ratio) ? \"is not two hex colours\" : `is ${ratio.toFixed(2)}:1`;\n const message = `${brand} ${theme}: ${fg} (${fgValue}) on ${on} (${onValue}) ${said}`;\n failures.push({ brand, theme, fg, on, fgValue, onValue, ratio, message });\n }\n }\n }\n }\n return failures;\n}\n"],"mappings":";A,IAOMC,KAAU,MAAiBC,EAAK,KAAK,CAAC,CAAC,QAAQ,QAAQ,GAAG;AAEhE,SAAgBC,EAAc,GAAsB;CAClD,OAAOD,EAAK,QAAQ,qBAAqB,EAAE;AAC7C;AAEA,SAASE,EAAa,GAAmC;CACvD,IAAMC,oBAAQ,IAAI,IAAoB;CACtC,KAAK,IAAMC,KAAeC,EAAK,MAAM,GAAG,GAAG;EACzC,IAAMC,IAAQF,EAAY,QAAQ,GAAG;EACrC,AAAIE,IAAQ,KACZH,EAAM,IAAIC,EAAY,MAAM,GAAGE,CA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AAIE,EAAQ,IAD9D,OAAO,MAAMC,CAAK,IAAI,2BAA2B,MAAMA,EAAM,QAAQ,CAAC,EAAE;GAErF,EAAS,KAAK;IAAE;IAAO;IAAO;IAAI;IAAI;IAAS;IAAS;IAAO;GAAQ,CAAC;EAC1E;CAGN;CACA,OAAON;AACT"}
|
package/dist/tokens.css
CHANGED
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
--pb-motion-flow: 1s;
|
|
75
75
|
--pb-motion-spin: 0.8s;
|
|
76
76
|
|
|
77
|
-
/* Density: the spacing steps, a
|
|
77
|
+
/* Density: the spacing steps, a compact control's height, the top bar's height. */
|
|
78
78
|
--pb-space-1: 2px;
|
|
79
79
|
--pb-space-2: 4px;
|
|
80
80
|
--pb-space-3: 8px;
|
|
@@ -83,6 +83,18 @@
|
|
|
83
83
|
--pb-row: 22px;
|
|
84
84
|
--pb-bar: 44px;
|
|
85
85
|
|
|
86
|
+
/* Node geometry: a node box's fixed sizes, the same values as the constants /graph exports (NODE_WIDTH and the
|
|
87
|
+
rest), since an app lays its nodes out from those before they render. A brand may not set these; the tests hold
|
|
88
|
+
each equal to its constant and fail on a brand that sets one. */
|
|
89
|
+
--pb-node-width: 240px;
|
|
90
|
+
--pb-node-header: 46px;
|
|
91
|
+
--pb-node-line: 22px;
|
|
92
|
+
--pb-node-row: 22px;
|
|
93
|
+
--pb-node-pad: 8px;
|
|
94
|
+
--pb-node-footer: 28px;
|
|
95
|
+
--pb-node-handle: 10px;
|
|
96
|
+
--pb-node-handle-hit: 20px;
|
|
97
|
+
|
|
86
98
|
/* Type: the faces, the two text sizes, and the code boxes' size (shared by a textarea, its highlighted copy and a
|
|
87
99
|
gutter, so their glyphs line up). */
|
|
88
100
|
--pb-font-ui: system-ui, sans-serif;
|
|
@@ -171,10 +183,11 @@
|
|
|
171
183
|
}
|
|
172
184
|
|
|
173
185
|
/* A finger: every text field is 16 px, code boxes included, as iOS Safari zooms the page when a smaller field takes
|
|
174
|
-
the focus. */
|
|
186
|
+
the focus; a handle's hit area grows to 32 px (handles sit 22 px apart, too close for 36 px targets). */
|
|
175
187
|
@media (hover: none) and (pointer: coarse) {
|
|
176
188
|
:root {
|
|
177
189
|
--pb-code-size: 16px;
|
|
190
|
+
--pb-node-handle-hit: 32px;
|
|
178
191
|
}
|
|
179
192
|
}
|
|
180
193
|
|
|
@@ -219,3 +232,10 @@
|
|
|
219
232
|
--xy-minimap-node-background-color: var(--pb-sunken);
|
|
220
233
|
--xy-minimap-node-stroke-color: var(--pb-line-strong);
|
|
221
234
|
}
|
|
235
|
+
|
|
236
|
+
/* React Flow's attribution link is drawn in a fixed grey of its own, below 4.5:1 on its panel, with no variable to
|
|
237
|
+
point at a token; the muted text colour keeps it legible in both themes and under a brand. Written under .react-flow,
|
|
238
|
+
so it wins whichever of the two stylesheets an app loads first. */
|
|
239
|
+
.react-flow .react-flow__attribution a {
|
|
240
|
+
color: var(--pb-muted);
|
|
241
|
+
}
|
|
@@ -2,6 +2,12 @@ import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
|
2
2
|
import "./Banner.css";
|
|
3
3
|
/** The tones a banner draws; any other string is drawn neutrally. */
|
|
4
4
|
export type BannerTone = "ok" | "warn" | "err" | "quiet" | "off" | (string & {});
|
|
5
|
+
/** The banner's own words, each replaceable. */
|
|
6
|
+
export interface BannerLabels {
|
|
7
|
+
/** The close button's name: "Dismiss". */
|
|
8
|
+
dismiss: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const defaultBannerLabels: BannerLabels;
|
|
5
11
|
export type BannerProps = Omit<ComponentPropsWithRef<"div">, "role"> & {
|
|
6
12
|
/** What the news is, by colour: the stripe's, and the surface's for warn and err. */
|
|
7
13
|
tone: BannerTone;
|
|
@@ -11,7 +17,7 @@ export type BannerProps = Omit<ComponentPropsWithRef<"div">, "role"> & {
|
|
|
11
17
|
actions?: ReactNode;
|
|
12
18
|
/** Shows a close button, which asks the app to take the banner away. */
|
|
13
19
|
onDismiss?: () => void;
|
|
14
|
-
/**
|
|
15
|
-
|
|
20
|
+
/** Words to replace; the rest keep their defaults. */
|
|
21
|
+
labels?: Partial<BannerLabels>;
|
|
16
22
|
};
|
|
17
|
-
export declare function Banner({ tone, children, actions, onDismiss,
|
|
23
|
+
export declare function Banner({ tone, children, actions, onDismiss, labels, className, ...rest }: BannerProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Banner } from "./Banner";
|
|
2
|
-
export type { BannerProps, BannerTone } from "./Banner";
|
|
1
|
+
export { Banner, defaultBannerLabels } from "./Banner";
|
|
2
|
+
export type { BannerLabels, BannerProps, BannerTone } from "./Banner";
|
|
@@ -31,21 +31,27 @@ export type CommandPaletteProps = {
|
|
|
31
31
|
commands: readonly Command[];
|
|
32
32
|
/** Anchors the palette's top-left corner at this point, kept inside the window; centred near the top without it. */
|
|
33
33
|
at?: PalettePoint;
|
|
34
|
-
/** The field's placeholder, "Type a command" by default. */
|
|
35
|
-
placeholder?: string;
|
|
36
|
-
/** The palette's name for screen readers, "Commands" by default. */
|
|
37
|
-
label?: string;
|
|
38
|
-
/** Shown when there are no commands at all, "No commands" by default. */
|
|
39
|
-
emptyLabel?: ReactNode;
|
|
40
|
-
/** Shown when the query matches none, "No command matches “query”" by default. */
|
|
41
|
-
noMatchLabel?: (query: string) => ReactNode;
|
|
42
34
|
/** The platform keys are drawn for; the browser's by default. */
|
|
43
35
|
platform?: Platform;
|
|
44
|
-
/**
|
|
45
|
-
|
|
36
|
+
/** Words to replace; the rest keep their defaults. */
|
|
37
|
+
labels?: Partial<CommandPaletteLabels>;
|
|
46
38
|
/** A class added to the palette's box. */
|
|
47
39
|
className?: string;
|
|
48
40
|
};
|
|
41
|
+
/** The palette's own words, each replaceable. */
|
|
42
|
+
export interface CommandPaletteLabels {
|
|
43
|
+
/** The palette's name for screen readers: "Commands". */
|
|
44
|
+
palette: string;
|
|
45
|
+
/** The field's placeholder: "Type a command". */
|
|
46
|
+
placeholder: string;
|
|
47
|
+
/** Shown when there are no commands at all: "No commands". */
|
|
48
|
+
empty: ReactNode;
|
|
49
|
+
/** Shown when the query matches none: "No command matches “query”". */
|
|
50
|
+
noMatch: (query: string) => ReactNode;
|
|
51
|
+
/** Replaces keyLabel's words for keys and modifiers ("Escape", "Ctrl"); none by default, keyLabel's own. */
|
|
52
|
+
keyNames: Readonly<Record<string, string>>;
|
|
53
|
+
}
|
|
54
|
+
export declare const defaultCommandPaletteLabels: CommandPaletteLabels;
|
|
49
55
|
/** The anchored palette's size, held inside the window less the gutter. */
|
|
50
56
|
export declare const PALETTE_WIDTH = 320;
|
|
51
57
|
export declare const PALETTE_HEIGHT = 360;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CommandPalette, PALETTE_GUTTER, PALETTE_HEIGHT, PALETTE_WIDTH, placePalette } from "./CommandPalette";
|
|
2
|
-
export type { Command, CommandPaletteProps, PalettePoint } from "./CommandPalette";
|
|
1
|
+
export { CommandPalette, defaultCommandPaletteLabels, PALETTE_GUTTER, PALETTE_HEIGHT, PALETTE_WIDTH, placePalette, } from "./CommandPalette";
|
|
2
|
+
export type { Command, CommandPaletteLabels, CommandPaletteProps, PalettePoint } from "./CommandPalette";
|
|
3
3
|
export { markRuns, matchSubsequence, rankCommands } from "./rank";
|
|
4
4
|
export type { Rankable, RankedCommand, RankedGroup, SubsequenceMatch } from "./rank";
|
|
@@ -16,26 +16,32 @@ export type ShortcutSheetProps = {
|
|
|
16
16
|
/** Asked for on Escape, the close button and a press on the scrim. */
|
|
17
17
|
onClose: () => void;
|
|
18
18
|
shortcuts: readonly ShortcutLine[];
|
|
19
|
-
/** The dialog's title, "Keyboard shortcuts" by default. */
|
|
20
|
-
title?: ReactNode;
|
|
21
19
|
/** A note under the lists (where the keys do not act, say). */
|
|
22
20
|
children?: ReactNode;
|
|
23
|
-
/** Between two keys that do the same, "or" by default. */
|
|
24
|
-
orLabel?: string;
|
|
25
|
-
/** Shown when there are no shortcuts, "No shortcuts" by default. */
|
|
26
|
-
emptyLabel?: ReactNode;
|
|
27
|
-
/** The close button's name, "Close" by default. */
|
|
28
|
-
closeLabel?: string;
|
|
29
21
|
/** The platform keys are drawn for; the browser's by default. */
|
|
30
22
|
platform?: Platform;
|
|
31
|
-
/**
|
|
32
|
-
|
|
23
|
+
/** Words to replace; the rest keep their defaults. */
|
|
24
|
+
labels?: Partial<ShortcutSheetLabels>;
|
|
33
25
|
/** A class added to the dialog's box. */
|
|
34
26
|
className?: string;
|
|
35
27
|
};
|
|
28
|
+
/** The sheet's own words, each replaceable. */
|
|
29
|
+
export interface ShortcutSheetLabels {
|
|
30
|
+
/** The dialog's title, which also names it: "Keyboard shortcuts". */
|
|
31
|
+
title: ReactNode;
|
|
32
|
+
/** Between two keys that do the same: "or". */
|
|
33
|
+
or: string;
|
|
34
|
+
/** Shown when there are no shortcuts: "No shortcuts". */
|
|
35
|
+
empty: ReactNode;
|
|
36
|
+
/** The close button's name: "Close". */
|
|
37
|
+
close: string;
|
|
38
|
+
/** Replaces keyLabel's words for keys and modifiers ("Escape", "Ctrl"); none by default, keyLabel's own. */
|
|
39
|
+
keyNames: Readonly<Record<string, string>>;
|
|
40
|
+
}
|
|
41
|
+
export declare const defaultShortcutSheetLabels: ShortcutSheetLabels;
|
|
36
42
|
/** The lines in groups, the groups in the order they first appear and each group's lines in the order given. */
|
|
37
43
|
export declare function groupShortcuts(shortcuts: readonly ShortcutLine[]): {
|
|
38
44
|
group: string;
|
|
39
45
|
lines: ShortcutLine[];
|
|
40
46
|
}[];
|
|
41
|
-
export declare function ShortcutSheet({ open, onClose, shortcuts,
|
|
47
|
+
export declare function ShortcutSheet({ open, onClose, shortcuts, children, platform, labels, className }: ShortcutSheetProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { ShortcutLine, ShortcutSheetProps } from "./ShortcutSheet";
|
|
1
|
+
export { defaultShortcutSheetLabels, groupShortcuts, ShortcutSheet } from "./ShortcutSheet";
|
|
2
|
+
export type { ShortcutLine, ShortcutSheetLabels, ShortcutSheetProps } from "./ShortcutSheet";
|
|
@@ -26,13 +26,19 @@ export type ToasterProps = Omit<ComponentPropsWithRef<"section">, "children"> &
|
|
|
26
26
|
* direction), or "inline": in the flow, where the app put it (in a canvas's own panel).
|
|
27
27
|
*/
|
|
28
28
|
placement?: ToasterPlacement;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
/** The words on each Dismiss button, "Dismiss" by default. */
|
|
32
|
-
dismissLabel?: string;
|
|
33
|
-
/** The words for the folded toasts, "and n more" by default. */
|
|
34
|
-
moreLabel?: (more: number) => ReactNode;
|
|
35
|
-
/** What a screen reader reads for a count in place of "×n", "n times" by default. */
|
|
36
|
-
countLabel?: (count: number) => string;
|
|
29
|
+
/** Words to replace; the rest keep their defaults. */
|
|
30
|
+
labels?: Partial<ToasterLabels>;
|
|
37
31
|
};
|
|
38
|
-
|
|
32
|
+
/** The toaster's own words, each replaceable. */
|
|
33
|
+
export interface ToasterLabels {
|
|
34
|
+
/** The stack's region name: "Notifications". An `aria-label` the app gives wins. */
|
|
35
|
+
region: string;
|
|
36
|
+
/** The words on each Dismiss button: "Dismiss". */
|
|
37
|
+
dismiss: string;
|
|
38
|
+
/** The words for the folded toasts: "and n more". */
|
|
39
|
+
more: (more: number) => ReactNode;
|
|
40
|
+
/** What a screen reader reads for a count in place of "×n": "n times". */
|
|
41
|
+
count: (count: number) => string;
|
|
42
|
+
}
|
|
43
|
+
export declare const defaultToasterLabels: ToasterLabels;
|
|
44
|
+
export declare function Toaster({ toasts, more, onDismiss, onHold, placement, labels, className, onPointerEnter, onPointerLeave, onFocus, onBlur, ...rest }: ToasterProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Toaster } from "./Toaster";
|
|
2
|
-
export type { ToasterPlacement, ToasterProps, ToasterToast } from "./Toaster";
|
|
1
|
+
export { defaultToasterLabels, Toaster } from "./Toaster";
|
|
2
|
+
export type { ToasterLabels, ToasterPlacement, ToasterProps, ToasterToast } from "./Toaster";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type OnConnectEnd, type OnConnectStart } from "@xyflow/react";
|
|
2
|
+
import { type MouseEvent as ReactMouseEvent } from "react";
|
|
3
|
+
import type { PortRef } from "../connect-hints";
|
|
4
|
+
import type { PortSide } from "../port-row";
|
|
5
|
+
/** A point in flow coordinates. */
|
|
6
|
+
export type FlowPoint = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
/** Called with where to add, and the port a dropped wire came from (absent for a double-click). */
|
|
11
|
+
export type OnAddAt = (point: FlowPoint, from?: PortRef & {
|
|
12
|
+
side: PortSide;
|
|
13
|
+
}) => void;
|
|
14
|
+
/** The props `useAddAt` gives `<ReactFlow>`. */
|
|
15
|
+
export type AddAtFlowProps = {
|
|
16
|
+
onDoubleClick: (event: ReactMouseEvent<HTMLDivElement>) => void;
|
|
17
|
+
onConnectStart: OnConnectStart;
|
|
18
|
+
onConnectEnd: OnConnectEnd;
|
|
19
|
+
zoomOnDoubleClick: false;
|
|
20
|
+
};
|
|
21
|
+
export type AddAtOptions = {
|
|
22
|
+
/** false switches adding off (as while the graph is read-only); true by default. */
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Calls `onAddAt` for a double-click on empty canvas and for a wire dropped there where no handle took it. Its
|
|
27
|
+
* `flowProps` go to `<ReactFlow>` (through `mergeFlowProps` with others); it turns React Flow's zoom on double-click
|
|
28
|
+
* off, as the double-click is the add.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useAddAt(onAddAt: OnAddAt, options?: AddAtOptions): {
|
|
31
|
+
flowProps: AddAtFlowProps;
|
|
32
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type FitViewOptions, type Node, type PanelPosition } from "@xyflow/react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import "./CanvasTools.css";
|
|
4
|
+
/** The tools' words, each replaceable. */
|
|
5
|
+
export interface CanvasToolsLabels {
|
|
6
|
+
/** The tool group's accessible name: "Canvas". */
|
|
7
|
+
toolbar: string;
|
|
8
|
+
zoomIn: string;
|
|
9
|
+
zoomOut: string;
|
|
10
|
+
fit: string;
|
|
11
|
+
tidy: string;
|
|
12
|
+
minimap: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const defaultCanvasToolsLabels: CanvasToolsLabels;
|
|
15
|
+
/** The app's own key bindings for the tools, as `aria-keyshortcuts` values: shown, not bound. */
|
|
16
|
+
export type CanvasToolsShortcuts = Partial<Record<"zoomIn" | "zoomOut" | "fit" | "tidy" | "minimap", string>>;
|
|
17
|
+
export type CanvasToolsProps<NodeType extends Node = Node> = {
|
|
18
|
+
/** Where the panel sits on the canvas, React Flow's `PanelPosition`: "bottom-left" by default. */
|
|
19
|
+
position?: PanelPosition | (string & {});
|
|
20
|
+
/** React Flow's fit options for the fit tool. */
|
|
21
|
+
fitOptions?: FitViewOptions<NodeType>;
|
|
22
|
+
/** Replaces the fit tool's own fit (pass useFollowFit's `fit`, so the tool also resumes following). */
|
|
23
|
+
onFit?: () => void;
|
|
24
|
+
/** The tidy tool, shown only when given: the layout is the app's. */
|
|
25
|
+
onTidy?: () => void;
|
|
26
|
+
/** Whether the minimap is on: the minimap tool is pressed and React Flow's <MiniMap> is drawn. */
|
|
27
|
+
minimap?: boolean;
|
|
28
|
+
/** The minimap tool, shown only when given: called with the state a press asks for. */
|
|
29
|
+
onMinimap?: (next: boolean) => void;
|
|
30
|
+
/** The class of each node's shape in the minimap, so the app colours it by the node's state. */
|
|
31
|
+
minimapNodeClassName?: string | ((node: NodeType) => string);
|
|
32
|
+
keyShortcuts?: CanvasToolsShortcuts;
|
|
33
|
+
/** Words to replace; the rest keep their defaults. */
|
|
34
|
+
labels?: Partial<CanvasToolsLabels>;
|
|
35
|
+
/** Added to the panel's own `pb-canvas-tools` class. */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** More tools (IconButtons) after patchbay's. */
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
export declare function CanvasTools<NodeType extends Node = Node>({ position, fitOptions, onFit, onTidy, minimap, onMinimap, minimapNodeClassName, keyShortcuts, labels, className, children, }: CanvasToolsProps<NodeType>): import("react").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { mergeFlowProps } from "./mergeFlowProps";
|
|
2
|
+
export type { MergedFlowProps } from "./mergeFlowProps";
|
|
3
|
+
export { ConnectHints, useConnectHints } from "./useConnectHints";
|
|
4
|
+
export type { CanConnect, ConnectHintsFlowProps, ConnectHintsValue, PortHintOf, PortRef } from "./useConnectHints";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type UnionToIntersection<U> = (U extends unknown ? (each: U) => void : never) extends (each: infer I) => void ? I : never;
|
|
2
|
+
/** The objects' props together: each handler is every object's handler for that name. */
|
|
3
|
+
export type MergedFlowProps<T extends readonly (object | undefined)[]> = UnionToIntersection<Exclude<T[number], undefined>>;
|
|
4
|
+
/**
|
|
5
|
+
* One object of `<ReactFlow>` props from several: a handler given by more than one object calls each in order, and
|
|
6
|
+
* `isValidConnection` accepts only when each accepts (it stops at the first that refuses). Any other prop is the last
|
|
7
|
+
* object's that gives it; `undefined` gives nothing.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mergeFlowProps<const T extends readonly (object | undefined)[]>(...objects: T): MergedFlowProps<T>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Connection, Edge, OnConnectEnd, OnConnectStart } from "@xyflow/react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type { PortHint, PortSide } from "../port-row";
|
|
4
|
+
/** One handle: its node's id and its handle id (`null` for a handle without one). */
|
|
5
|
+
export type PortRef = {
|
|
6
|
+
nodeId: string;
|
|
7
|
+
handleId: string | null;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Whether a wire may join `from` (always the output) to `to` (always the input), whichever end the drag began at:
|
|
11
|
+
* `true` accepts, `false` refuses, a string refuses and is the reason.
|
|
12
|
+
*/
|
|
13
|
+
export type CanConnect = (from: PortRef, to: PortRef) => boolean | string;
|
|
14
|
+
/** What one handle shows while a wire is dragged, and why when it refuses. */
|
|
15
|
+
export type PortHintOf = {
|
|
16
|
+
hint: PortHint;
|
|
17
|
+
reason?: string;
|
|
18
|
+
};
|
|
19
|
+
/** The drag in progress, as `<ConnectHints>` hands it to every `PortRow`; `null` while no wire is dragged. */
|
|
20
|
+
export type ConnectHintsValue = {
|
|
21
|
+
/** The handle the drag began at, and its side. */
|
|
22
|
+
origin: PortRef & {
|
|
23
|
+
side: PortSide;
|
|
24
|
+
};
|
|
25
|
+
/** The hint for one handle: `origin`, `ok` or `no` (with its reason) on the other side, `null` on the origin's. */
|
|
26
|
+
hintFor: (port: PortRef, side: PortSide) => PortHintOf;
|
|
27
|
+
} | null;
|
|
28
|
+
/** The handlers `useConnectHints` gives `<ReactFlow>`. */
|
|
29
|
+
export type ConnectHintsFlowProps = {
|
|
30
|
+
onConnectStart: OnConnectStart;
|
|
31
|
+
onConnectEnd: OnConnectEnd;
|
|
32
|
+
isValidConnection: (connection: Edge | Connection) => boolean;
|
|
33
|
+
};
|
|
34
|
+
/** Hands a drag's hints to every `PortRow` inside it. */
|
|
35
|
+
export declare function ConnectHints({ value, children }: {
|
|
36
|
+
value: ConnectHintsValue;
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
/** The drag's hints from the nearest `<ConnectHints>`, or `null` outside one or while no wire is dragged. */
|
|
40
|
+
export declare function useConnectHintsValue(): ConnectHintsValue;
|
|
41
|
+
/**
|
|
42
|
+
* Tracks a wire's drag from React Flow's connect start to its end and judges each candidate handle by `canConnect`.
|
|
43
|
+
* `flowProps` goes to `<ReactFlow>` (through `mergeFlowProps` with others), `value` to `<ConnectHints>`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function useConnectHints(canConnect: CanConnect): {
|
|
46
|
+
value: ConnectHintsValue;
|
|
47
|
+
flowProps: ConnectHintsFlowProps;
|
|
48
|
+
};
|