@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.
Files changed (52) hide show
  1. package/README.md +9 -7
  2. package/dist/composites.js +190 -158
  3. package/dist/composites.js.map +1 -1
  4. package/dist/graph.css +1 -1
  5. package/dist/graph.js +639 -63
  6. package/dist/graph.js.map +1 -1
  7. package/dist/primitives.css +1 -1
  8. package/dist/primitives.js +108 -93
  9. package/dist/primitives.js.map +1 -1
  10. package/dist/testing.js +207 -0
  11. package/dist/testing.js.map +1 -0
  12. package/dist/tokens.css +22 -2
  13. package/dist/types/composites/banner/Banner.d.ts +9 -3
  14. package/dist/types/composites/banner/index.d.ts +2 -2
  15. package/dist/types/composites/command-palette/CommandPalette.d.ts +16 -10
  16. package/dist/types/composites/command-palette/index.d.ts +2 -2
  17. package/dist/types/composites/shortcut-sheet/ShortcutSheet.d.ts +17 -11
  18. package/dist/types/composites/shortcut-sheet/index.d.ts +2 -2
  19. package/dist/types/composites/toaster/Toaster.d.ts +15 -9
  20. package/dist/types/composites/toaster/index.d.ts +2 -2
  21. package/dist/types/graph/add-at/index.d.ts +2 -0
  22. package/dist/types/graph/add-at/useAddAt.d.ts +32 -0
  23. package/dist/types/graph/canvas-tools/CanvasTools.d.ts +40 -0
  24. package/dist/types/graph/canvas-tools/index.d.ts +2 -0
  25. package/dist/types/graph/canvas-tools/motion.d.ts +2 -0
  26. package/dist/types/graph/connect-hints/index.d.ts +4 -0
  27. package/dist/types/graph/connect-hints/mergeFlowProps.d.ts +10 -0
  28. package/dist/types/graph/connect-hints/useConnectHints.d.ts +48 -0
  29. package/dist/types/graph/follow-fit/index.d.ts +2 -0
  30. package/dist/types/graph/follow-fit/useFollowFit.d.ts +21 -0
  31. package/dist/types/graph/ghost-wire/GhostWire.d.ts +16 -0
  32. package/dist/types/graph/ghost-wire/index.d.ts +2 -0
  33. package/dist/types/graph/index.d.ts +8 -0
  34. package/dist/types/graph/meter/Meter.d.ts +9 -3
  35. package/dist/types/graph/meter/index.d.ts +2 -2
  36. package/dist/types/graph/node-box/NodeBox.d.ts +52 -0
  37. package/dist/types/graph/node-box/geometry.d.ts +47 -0
  38. package/dist/types/graph/node-box/index.d.ts +4 -0
  39. package/dist/types/graph/port-row/PortRow.d.ts +31 -0
  40. package/dist/types/graph/port-row/index.d.ts +2 -0
  41. package/dist/types/graph/wire/Wire.d.ts +27 -0
  42. package/dist/types/graph/wire/index.d.ts +2 -0
  43. package/dist/types/primitives/dialog/Dialog.d.ts +8 -2
  44. package/dist/types/primitives/dialog/index.d.ts +2 -2
  45. package/dist/types/primitives/sheet/Sheet.d.ts +8 -2
  46. package/dist/types/primitives/sheet/index.d.ts +2 -2
  47. package/dist/types/primitives/splitter/Splitter.d.ts +8 -2
  48. package/dist/types/primitives/splitter/splitter-math.d.ts +12 -4
  49. package/dist/types/testing/brand-css.d.ts +41 -0
  50. package/dist/types/testing/contrast.d.ts +36 -0
  51. package/dist/types/testing/index.d.ts +2 -0
  52. package/package.json +6 -2
@@ -4,7 +4,12 @@ import { createPortal as u } from "react-dom";
4
4
  import { Button as d, Dialog as f, IconButton as p } from "./primitives.js";
5
5
  import { ariaKeyShortcuts as m, keyLabel as h } from "./hooks.js";
6
6
  // src/composites/banner/Banner.tsx
7
- function g({ tone: e, children: r, actions: i, onDismiss: a, dismissLabel: o = "Dismiss", className: s, ...c }) {
7
+ var g = { dismiss: "Dismiss" };
8
+ function _({ tone: e, children: r, actions: i, onDismiss: a, labels: o, className: s, ...c }) {
9
+ let l = {
10
+ ...g,
11
+ ...o
12
+ };
8
13
  return /* @__PURE__ */ n("div", {
9
14
  ...c,
10
15
  role: e === "err" ? "alert" : "status",
@@ -22,7 +27,7 @@ function g({ tone: e, children: r, actions: i, onDismiss: a, dismissLabel: o = "
22
27
  a !== void 0 && /* @__PURE__ */ t(p, {
23
28
  className: "pb-banner-dismiss",
24
29
  size: "sm",
25
- label: o,
30
+ label: l.dismiss,
26
31
  onClick: a,
27
32
  children: /* @__PURE__ */ t("svg", {
28
33
  viewBox: "0 0 16 16",
@@ -41,39 +46,39 @@ function g({ tone: e, children: r, actions: i, onDismiss: a, dismissLabel: o = "
41
46
  });
42
47
  }
43
48
  // src/composites/command-palette/rank.ts
44
- function _(e, t) {
49
+ function v(e, t) {
45
50
  if (t === 0) return !0;
46
51
  let n = e.charAt(t - 1), r = e.charAt(t);
47
52
  return !/[\p{L}\p{N}]/u.test(n) || n !== n.toUpperCase() && r !== r.toLowerCase() && r === r.toUpperCase();
48
53
  }
49
- function v(e) {
54
+ function y(e) {
50
55
  let t = e.toLowerCase();
51
56
  return t.length === 1 ? t : e;
52
57
  }
53
- var y = 3, b = 2, x = 2, S = .1, C = 1, w = .02;
54
- function T(e, t) {
58
+ var b = 3, x = 2, S = 2, C = .1, w = 1, T = .02;
59
+ function E(e, t) {
55
60
  let n = t.replace(/\s+/g, "");
56
61
  if (n === "") return {
57
62
  indices: [],
58
63
  score: 0
59
64
  };
60
- let r = Array.from({ length: n.length }, (e, t) => v(n.charAt(t))), i = Array.from({ length: e.length }, (t, n) => v(e.charAt(n))), a = e.length, o = r.length;
65
+ let r = Array.from({ length: n.length }, (e, t) => y(n.charAt(t))), i = Array.from({ length: e.length }, (t, n) => y(e.charAt(n))), a = e.length, o = r.length;
61
66
  if (o > a) return;
62
- let s = i.map((t, n) => n === 0 ? y : _(e, n) ? b : 0), c = [], l = [];
67
+ let s = i.map((t, n) => n === 0 ? b : v(e, n) ? x : 0), c = [], l = [];
63
68
  for (let e = 0; e < o; e += 1) {
64
69
  let t = Array(a).fill(-Infinity), n = Array(a).fill(-1), o = r[e];
65
70
  for (let r = e; r < a; r += 1) {
66
71
  if (i[r] !== o) continue;
67
72
  let a = 1 + (s[r] ?? 0);
68
73
  if (e === 0) {
69
- t[r] = a - r * w;
74
+ t[r] = a - r * T;
70
75
  continue;
71
76
  }
72
77
  let l = c[e - 1] ?? [];
73
78
  for (let i = e - 1; i < r; i += 1) {
74
79
  let e = l[i] ?? -Infinity;
75
80
  if (e === -Infinity) continue;
76
- let o = i === r - 1 ? x : -Math.min((r - i - 1) * S, C), s = e + a + o;
81
+ let o = i === r - 1 ? S : -Math.min((r - i - 1) * C, w), s = e + a + o;
77
82
  s > (t[r] ?? -Infinity) && (t[r] = s, n[r] = i);
78
83
  }
79
84
  }
@@ -89,10 +94,10 @@ function T(e, t) {
89
94
  score: u[d] ?? 0
90
95
  };
91
96
  }
92
- function E(e, t) {
97
+ function D(e, t) {
93
98
  let n = /* @__PURE__ */ new Map();
94
99
  e.forEach((e, r) => {
95
- let i = T(e.label, t);
100
+ let i = E(e.label, t);
96
101
  if (i === void 0) return;
97
102
  let a = n.get(e.group);
98
103
  a === void 0 && (a = {
@@ -123,7 +128,7 @@ function E(e, t) {
123
128
  }))
124
129
  }));
125
130
  }
126
- function D(e, t) {
131
+ function O(e, t) {
127
132
  let n = new Set(t), r = [];
128
133
  for (let t = 0; t < e.length; t += 1) {
129
134
  let i = n.has(t), a = r[r.length - 1];
@@ -135,8 +140,14 @@ function D(e, t) {
135
140
  return r;
136
141
  }
137
142
  // src/composites/command-palette/CommandPalette.tsx
138
- var O = 320, k = 360, A = 8;
139
- function j(e, t) {
143
+ var k = {
144
+ palette: "Commands",
145
+ placeholder: "Type a command",
146
+ empty: "No commands",
147
+ noMatch: (e) => `No command matches “${e}”`,
148
+ keyNames: {}
149
+ }, A = 320, j = 360, M = 8;
150
+ function N(e, t) {
140
151
  let n = Math.max(0, Math.min(320, t.width - 16)), r = Math.max(0, Math.min(360, t.height - 16)), i = (e, t, n) => Math.min(Math.max(e, 8), Math.max(8, n - t - 8));
141
152
  return {
142
153
  left: i(e.x, n, t.width),
@@ -145,8 +156,8 @@ function j(e, t) {
145
156
  height: r
146
157
  };
147
158
  }
148
- var M = (e) => `No command matches “${e}”`, N = 8;
149
- function P(e) {
159
+ var P = 8;
160
+ function F(e) {
150
161
  let t = () => ({
151
162
  width: window.innerWidth,
152
163
  height: window.innerHeight
@@ -161,47 +172,50 @@ function P(e) {
161
172
  };
162
173
  }, [e]), n;
163
174
  }
164
- function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command", label: f = "Commands", emptyLabel: p = "No commands", noMatchLabel: g = M, platform: _, keyNames: v, className: y }) {
165
- let b = a(), x = `${b}-list`, [S, C] = l(""), w = s(() => E(r, S), [r, S]), T = s(() => w.flatMap((e) => e.items.map((e) => e.command)), [w]), O = s(() => T.filter((e) => e.disabled !== !0), [T]), [k, A] = l(void 0), [F, I] = l(S);
166
- F !== S && (I(S), A(void 0));
167
- let L = O.find((e) => e.id === k) ?? O[0], R = (e) => `${b}-option-${T.indexOf(e)}`, z = c(null), B = c(null), V = c(null), H = c(e);
175
+ function I({ onClose: e, commands: r, at: u, platform: d, labels: f, className: p }) {
176
+ let g = {
177
+ ...k,
178
+ ...f
179
+ }, _ = a(), v = `${_}-list`, [y, b] = l(""), x = s(() => D(r, y), [r, y]), S = s(() => x.flatMap((e) => e.items.map((e) => e.command)), [x]), C = s(() => S.filter((e) => e.disabled !== !0), [S]), [w, T] = l(void 0), [E, A] = l(y);
180
+ E !== y && (A(y), T(void 0));
181
+ let j = C.find((e) => e.id === w) ?? C[0], M = (e) => `${_}-option-${S.indexOf(e)}`, I = c(null), L = c(null), R = c(null), z = c(e);
168
182
  o(() => {
169
- H.current = e;
183
+ z.current = e;
170
184
  }), o(() => {
171
185
  let e = document.activeElement instanceof HTMLElement ? document.activeElement : null;
172
- B.current?.focus();
173
- let t = z.current;
186
+ L.current?.focus();
187
+ let t = I.current;
174
188
  return () => {
175
189
  let n = document.activeElement;
176
190
  (n === null || n === document.body || (t?.contains(n) ?? !1) || !n.isConnected) && e?.isConnected === !0 && e.focus();
177
191
  };
178
192
  }, []), i(() => {
179
- if (L === void 0) return;
180
- let e = document.getElementById(R(L));
193
+ if (j === void 0) return;
194
+ let e = document.getElementById(M(j));
181
195
  typeof e?.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
182
- }, [L]);
183
- let U = (e) => {
184
- e.disabled !== !0 && (H.current(), e.run());
185
- }, W = () => {
186
- let e = V.current?.querySelector("[role=\"option\"]"), t = e && e.offsetHeight > 0 ? Math.floor((V.current?.clientHeight ?? 0) / e.offsetHeight) : 0;
187
- return Math.max(1, t || N);
188
- }, G = (e) => {
196
+ }, [j]);
197
+ let B = (e) => {
198
+ e.disabled !== !0 && (z.current(), e.run());
199
+ }, V = () => {
200
+ let e = R.current?.querySelector("[role=\"option\"]"), t = e && e.offsetHeight > 0 ? Math.floor((R.current?.clientHeight ?? 0) / e.offsetHeight) : 0;
201
+ return Math.max(1, t || P);
202
+ }, H = (e) => {
189
203
  if (e.defaultPrevented || e.nativeEvent.isComposing) return;
190
- let t = e.altKey || e.ctrlKey || e.metaKey, n = L === void 0 ? -1 : O.indexOf(L), r = O.length - 1, i = (t) => {
204
+ let t = e.altKey || e.ctrlKey || e.metaKey, n = j === void 0 ? -1 : C.indexOf(j), r = C.length - 1, i = (t) => {
191
205
  e.preventDefault();
192
- let n = O[Math.min(Math.max(t, 0), r)];
193
- n !== void 0 && A(n.id);
206
+ let n = C[Math.min(Math.max(t, 0), r)];
207
+ n !== void 0 && T(n.id);
194
208
  };
195
209
  switch (e.key) {
196
210
  case "Escape":
197
- e.preventDefault(), e.stopPropagation(), H.current();
211
+ e.preventDefault(), e.stopPropagation(), z.current();
198
212
  return;
199
213
  case "Tab":
200
- e.preventDefault(), H.current();
214
+ e.preventDefault(), z.current();
201
215
  return;
202
216
  case "Enter":
203
217
  if (t) return;
204
- e.preventDefault(), L !== void 0 && U(L);
218
+ e.preventDefault(), j !== void 0 && B(j);
205
219
  return;
206
220
  case "ArrowDown":
207
221
  if (t) return;
@@ -213,11 +227,11 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
213
227
  return;
214
228
  case "PageDown":
215
229
  if (t) return;
216
- i(n + W());
230
+ i(n + V());
217
231
  return;
218
232
  case "PageUp":
219
233
  if (t) return;
220
- i(n - W());
234
+ i(n - V());
221
235
  return;
222
236
  case "Home":
223
237
  if (t || e.shiftKey) return;
@@ -229,61 +243,61 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
229
243
  return;
230
244
  default: return;
231
245
  }
232
- }, K = P(u !== void 0), q = u === void 0 ? void 0 : j(u, K), J = q !== void 0, Y;
233
- return r.length === 0 ? Y = p : T.length === 0 && (Y = g(S.trim())), /* @__PURE__ */ t("div", {
246
+ }, U = F(u !== void 0), W = u === void 0 ? void 0 : N(u, U), G = W !== void 0, K;
247
+ return r.length === 0 ? K = g.empty : S.length === 0 && (K = g.noMatch(y.trim())), /* @__PURE__ */ t("div", {
234
248
  className: "pb-palette-layer",
235
- "data-anchored": J ? "" : void 0,
249
+ "data-anchored": G ? "" : void 0,
236
250
  onMouseDown: (e) => {
237
- e.target === e.currentTarget && H.current();
251
+ e.target === e.currentTarget && z.current();
238
252
  },
239
253
  children: /* @__PURE__ */ n("div", {
240
- ref: z,
241
- className: y === void 0 ? "pb-palette" : `pb-palette ${y}`,
254
+ ref: I,
255
+ className: p === void 0 ? "pb-palette" : `pb-palette ${p}`,
242
256
  role: "dialog",
243
257
  "aria-modal": "true",
244
- "aria-label": f,
245
- style: q === void 0 ? void 0 : {
258
+ "aria-label": g.palette,
259
+ style: W === void 0 ? void 0 : {
246
260
  position: "fixed",
247
- left: q.left,
248
- top: q.top,
249
- width: q.width,
250
- maxHeight: q.height
261
+ left: W.left,
262
+ top: W.top,
263
+ width: W.width,
264
+ maxHeight: W.height
251
265
  },
252
266
  onBlur: (e) => {
253
267
  let t = e.relatedTarget;
254
- t instanceof Node && !e.currentTarget.contains(t) && H.current();
268
+ t instanceof Node && !e.currentTarget.contains(t) && z.current();
255
269
  },
256
270
  children: [
257
271
  /* @__PURE__ */ t("input", {
258
- ref: B,
272
+ ref: L,
259
273
  className: "pb-palette-field",
260
274
  type: "text",
261
275
  role: "combobox",
262
- "aria-label": f,
276
+ "aria-label": g.palette,
263
277
  "aria-expanded": "true",
264
- "aria-controls": x,
278
+ "aria-controls": v,
265
279
  "aria-autocomplete": "list",
266
- "aria-activedescendant": L === void 0 ? void 0 : R(L),
280
+ "aria-activedescendant": j === void 0 ? void 0 : M(j),
267
281
  autoComplete: "off",
268
282
  autoCapitalize: "off",
269
283
  autoCorrect: "off",
270
284
  spellCheck: !1,
271
- placeholder: d,
272
- value: S,
285
+ placeholder: g.placeholder,
286
+ value: y,
273
287
  onChange: (e) => {
274
- C(e.target.value);
288
+ b(e.target.value);
275
289
  },
276
- onKeyDown: G
290
+ onKeyDown: H
277
291
  }),
278
292
  /* @__PURE__ */ t("div", {
279
- ref: V,
293
+ ref: R,
280
294
  className: "pb-palette-list",
281
- id: x,
295
+ id: v,
282
296
  role: "listbox",
283
- "aria-label": f,
284
- hidden: T.length === 0,
285
- children: w.map((e, r) => {
286
- let i = `${b}-group-${r}`;
297
+ "aria-label": g.palette,
298
+ hidden: S.length === 0,
299
+ children: x.map((e, r) => {
300
+ let i = `${_}-group-${r}`;
287
301
  return /* @__PURE__ */ n("div", {
288
302
  role: "group",
289
303
  "aria-labelledby": i,
@@ -294,29 +308,29 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
294
308
  role: "presentation",
295
309
  children: e.group
296
310
  }), e.items.map(({ command: e, indices: r }) => {
297
- let i = R(e), a = e.keys === void 0 ? [] : typeof e.keys == "string" ? [e.keys] : e.keys, o = e === L;
311
+ let i = M(e), a = e.keys === void 0 ? [] : typeof e.keys == "string" ? [e.keys] : e.keys, o = e === j;
298
312
  return /* @__PURE__ */ n("div", {
299
313
  id: i,
300
314
  role: "option",
301
315
  "aria-selected": o,
302
316
  "aria-disabled": e.disabled === !0 || void 0,
303
- "aria-keyshortcuts": a.length === 0 ? void 0 : m(a, _),
317
+ "aria-keyshortcuts": a.length === 0 ? void 0 : m(a, d),
304
318
  className: "pb-palette-option",
305
319
  "data-command-id": e.id,
306
320
  onMouseDown: (e) => {
307
321
  e.preventDefault();
308
322
  },
309
323
  onPointerMove: () => {
310
- e.disabled !== !0 && !o && A(e.id);
324
+ e.disabled !== !0 && !o && T(e.id);
311
325
  },
312
326
  onClick: () => {
313
- U(e);
327
+ B(e);
314
328
  },
315
329
  children: [/* @__PURE__ */ n("span", {
316
330
  className: "pb-palette-text",
317
331
  children: [/* @__PURE__ */ t("span", {
318
332
  className: "pb-palette-label",
319
- children: D(e.label, r).map((e, n) => e.marked ? /* @__PURE__ */ t("mark", { children: e.text }, n) : e.text)
333
+ children: O(e.label, r).map((e, n) => e.marked ? /* @__PURE__ */ t("mark", { children: e.text }, n) : e.text)
320
334
  }), e.hint !== void 0 && /* @__PURE__ */ t("span", {
321
335
  className: "pb-palette-hint",
322
336
  children: e.hint
@@ -324,8 +338,8 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
324
338
  }), a.length > 0 && /* @__PURE__ */ t("span", {
325
339
  className: "pb-palette-keys",
326
340
  children: a.map((e) => /* @__PURE__ */ t("kbd", { children: h(e, {
327
- platform: _,
328
- names: v
341
+ platform: d,
342
+ names: g.keyNames
329
343
  }) }, e))
330
344
  })]
331
345
  }, e.id);
@@ -336,27 +350,27 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
336
350
  /* @__PURE__ */ t("p", {
337
351
  className: "pb-palette-empty",
338
352
  role: "status",
339
- children: Y
353
+ children: K
340
354
  })
341
355
  ]
342
356
  })
343
357
  });
344
358
  }
345
- function I({ open: e, ...n }) {
346
- return e ? u(/* @__PURE__ */ t(F, { ...n }), document.body) : null;
359
+ function L({ open: e, ...n }) {
360
+ return e ? u(/* @__PURE__ */ t(I, { ...n }), document.body) : null;
347
361
  }
348
362
  // src/composites/diff-view/DiffView.tsx
349
- function L(e) {
363
+ function R(e) {
350
364
  return e.startsWith("+++ ") || e.startsWith("--- ") ? "meta" : e.startsWith("@@") ? "hunk" : e.startsWith("+") ? "add" : e.startsWith("-") ? "del" : e.startsWith("\\") ? "note" : e === "" || e.startsWith(" ") ? "context" : "meta";
351
365
  }
352
- function R(e) {
366
+ function z(e) {
353
367
  return e.split("/").filter((e) => e !== "").at(-1) ?? e;
354
368
  }
355
- function z(e) {
369
+ function B(e) {
356
370
  let t = e.split(/\r?\n/);
357
371
  return t.length > 0 && t.at(-1) === "" && t.pop(), t;
358
372
  }
359
- function B({ text: e, id: n, hidden: r }) {
373
+ function V({ text: e, id: n, hidden: r }) {
360
374
  return /* @__PURE__ */ t("pre", {
361
375
  className: "pb-diff-body",
362
376
  id: n,
@@ -364,22 +378,22 @@ function B({ text: e, id: n, hidden: r }) {
364
378
  tabIndex: 0,
365
379
  children: /* @__PURE__ */ t("code", {
366
380
  className: "pb-diff-code",
367
- children: z(e).map((e, n) => /* @__PURE__ */ t("span", {
381
+ children: B(e).map((e, n) => /* @__PURE__ */ t("span", {
368
382
  className: "pb-diff-line",
369
- "data-kind": L(e),
383
+ "data-kind": R(e),
370
384
  children: e === "" ? " " : e
371
385
  }, n))
372
386
  })
373
387
  });
374
388
  }
375
- function V({ diff: e, files: r, level: i = 3, collapsed: o, onToggle: s, className: c, ...u }) {
389
+ function H({ diff: e, files: r, level: i = 3, collapsed: o, onToggle: s, className: c, ...u }) {
376
390
  let d = a(), [f, p] = l([]), m = o ?? f, h = `h${String(i)}`, g = (e, t) => {
377
391
  o === void 0 && p((n) => t ? n.filter((t) => t !== e) : [...n, e]), s?.(e, t);
378
392
  };
379
393
  return /* @__PURE__ */ t("div", {
380
394
  ...u,
381
395
  className: c === void 0 ? "pb-diff" : `pb-diff ${c}`,
382
- children: r === void 0 ? /* @__PURE__ */ t(B, { text: e }) : r.map((e, r) => {
396
+ children: r === void 0 ? /* @__PURE__ */ t(V, { text: e }) : r.map((e, r) => {
383
397
  let i = !m.includes(e.path), a = `${d}-${String(r)}`;
384
398
  return /* @__PURE__ */ n("div", {
385
399
  className: "pb-diff-file",
@@ -407,9 +421,9 @@ function V({ diff: e, files: r, level: i = 3, collapsed: o, onToggle: s, classNa
407
421
  stroke: "currentColor",
408
422
  strokeWidth: "2"
409
423
  })
410
- }), R(e.path)]
424
+ }), z(e.path)]
411
425
  })
412
- }), /* @__PURE__ */ t(B, {
426
+ }), /* @__PURE__ */ t(V, {
413
427
  text: e.diff,
414
428
  id: a,
415
429
  hidden: !i
@@ -419,7 +433,14 @@ function V({ diff: e, files: r, level: i = 3, collapsed: o, onToggle: s, classNa
419
433
  });
420
434
  }
421
435
  // src/composites/shortcut-sheet/ShortcutSheet.tsx
422
- function H(e) {
436
+ var U = {
437
+ title: "Keyboard shortcuts",
438
+ or: "or",
439
+ empty: "No shortcuts",
440
+ close: "Close",
441
+ keyNames: {}
442
+ };
443
+ function W(e) {
423
444
  let t = /* @__PURE__ */ new Map();
424
445
  for (let n of e) {
425
446
  let e = t.get(n.group);
@@ -430,21 +451,24 @@ function H(e) {
430
451
  lines: t
431
452
  }));
432
453
  }
433
- function U({ open: e, onClose: i, shortcuts: o, title: s = "Keyboard shortcuts", children: c, orLabel: l = "or", emptyLabel: u = "No shortcuts", closeLabel: d = "Close", platform: p, keyNames: g, className: _ }) {
434
- let v = a(), y = H(o);
454
+ function G({ open: e, onClose: i, shortcuts: o, children: s, platform: c, labels: l, className: u }) {
455
+ let d = {
456
+ ...U,
457
+ ...l
458
+ }, p = a(), g = W(o);
435
459
  return /* @__PURE__ */ n(f, {
436
460
  open: e,
437
461
  onClose: i,
438
- title: s,
439
- closeLabel: d,
440
- className: _ === void 0 ? "pb-shortcut-sheet" : `pb-shortcut-sheet ${_}`,
462
+ title: d.title,
463
+ labels: { close: d.close },
464
+ className: u === void 0 ? "pb-shortcut-sheet" : `pb-shortcut-sheet ${u}`,
441
465
  children: [
442
- y.length === 0 && /* @__PURE__ */ t("p", {
466
+ g.length === 0 && /* @__PURE__ */ t("p", {
443
467
  className: "pb-shortcut-sheet-empty",
444
- children: u
468
+ children: d.empty
445
469
  }),
446
- y.map(({ group: e, lines: i }, a) => {
447
- let o = `${v}-${a}`;
470
+ g.map(({ group: e, lines: i }, a) => {
471
+ let o = `${p}-${a}`;
448
472
  return /* @__PURE__ */ n("section", {
449
473
  className: "pb-shortcut-sheet-group",
450
474
  "aria-labelledby": o,
@@ -459,17 +483,17 @@ function U({ open: e, onClose: i, shortcuts: o, title: s = "Keyboard shortcuts",
459
483
  return /* @__PURE__ */ n("div", {
460
484
  className: "pb-shortcut-sheet-line",
461
485
  children: [/* @__PURE__ */ t("dt", { children: e.label }), /* @__PURE__ */ t("dd", {
462
- "aria-keyshortcuts": a.length === 0 ? void 0 : m(a, p),
486
+ "aria-keyshortcuts": a.length === 0 ? void 0 : m(a, c),
463
487
  children: a.map((e, i) => /* @__PURE__ */ n(r, { children: [i > 0 && /* @__PURE__ */ n("span", {
464
488
  className: "pb-shortcut-sheet-or",
465
489
  children: [
466
490
  " ",
467
- l,
491
+ d.or,
468
492
  " "
469
493
  ]
470
494
  }), /* @__PURE__ */ t("kbd", { children: h(e, {
471
- platform: p,
472
- names: g
495
+ platform: c,
496
+ names: d.keyNames
473
497
  }) })] }, e))
474
498
  })]
475
499
  }, `${e.label}-${i}`);
@@ -477,15 +501,15 @@ function U({ open: e, onClose: i, shortcuts: o, title: s = "Keyboard shortcuts",
477
501
  })]
478
502
  }, e);
479
503
  }),
480
- c !== void 0 && /* @__PURE__ */ t("div", {
504
+ s !== void 0 && /* @__PURE__ */ t("div", {
481
505
  className: "pb-shortcut-sheet-note",
482
- children: c
506
+ children: s
483
507
  })
484
508
  ]
485
509
  });
486
510
  }
487
511
  // src/composites/status-words/StatusWords.tsx
488
- function W({ items: e, className: n, ...r }) {
512
+ function K({ items: e, className: n, ...r }) {
489
513
  return /* @__PURE__ */ t("ul", {
490
514
  "aria-live": "polite",
491
515
  ...r,
@@ -499,7 +523,12 @@ function W({ items: e, className: n, ...r }) {
499
523
  });
500
524
  }
501
525
  // src/composites/toaster/Toaster.tsx
502
- var G = /* @__PURE__ */ new Set([
526
+ var q = {
527
+ region: "Notifications",
528
+ dismiss: "Dismiss",
529
+ more: (e) => `and ${e} more`,
530
+ count: (e) => `${e} times`
531
+ }, J = /* @__PURE__ */ new Set([
503
532
  "top-start",
504
533
  "top",
505
534
  "top-end",
@@ -507,15 +536,18 @@ var G = /* @__PURE__ */ new Set([
507
536
  "bottom",
508
537
  "bottom-end",
509
538
  "inline"
510
- ]), K = (e) => `and ${e} more`, q = (e) => `${e} times`, J = 256;
511
- function Y({ toasts: r, more: s = 0, onDismiss: u, onHold: f, placement: p = "bottom-end", label: m = "Notifications", dismissLabel: h = "Dismiss", moreLabel: g = K, countLabel: _ = q, className: v, onPointerEnter: y, onPointerLeave: b, onFocus: x, onBlur: S, ...C }) {
512
- let w = a(), T = G.has(p) ? p : "inline", E = T.startsWith("top"), D = E ? [...r].reverse() : r, O = r.length === 0 && s <= 0, k = c(/* @__PURE__ */ new Map()), A = c(0), [j, M] = l([]);
539
+ ]), Y = 256;
540
+ function X({ toasts: r, more: s = 0, onDismiss: u, onHold: f, placement: p = "bottom-end", labels: m, className: h, onPointerEnter: g, onPointerLeave: _, onFocus: v, onBlur: y, ...b }) {
541
+ let x = {
542
+ ...q,
543
+ ...m
544
+ }, S = a(), C = J.has(p) ? p : "inline", w = C.startsWith("top"), T = w ? [...r].reverse() : r, E = r.length === 0 && s <= 0, D = c(/* @__PURE__ */ new Map()), O = c(0), [k, A] = l([]);
513
545
  i(() => {
514
546
  let e = [];
515
547
  for (let t of r) {
516
- let n = t.count ?? 1, r = k.current.get(t.id);
517
- r !== void 0 && n <= r || (k.current.set(t.id, n), A.current += 1, e.push({
518
- seq: A.current,
548
+ let n = t.count ?? 1, r = D.current.get(t.id);
549
+ r !== void 0 && n <= r || (D.current.set(t.id, n), O.current += 1, e.push({
550
+ seq: O.current,
519
551
  id: t.id,
520
552
  alert: t.tone === "err",
521
553
  text: t.text,
@@ -523,90 +555,90 @@ function Y({ toasts: r, more: s = 0, onDismiss: u, onHold: f, placement: p = "bo
523
555
  }));
524
556
  }
525
557
  let t = new Set(r.map((e) => e.id));
526
- if (k.current.size > J) for (let e of k.current.keys()) t.has(e) || k.current.delete(e);
558
+ if (D.current.size > Y) for (let e of D.current.keys()) t.has(e) || D.current.delete(e);
527
559
  let n = new Set(e.map((e) => e.id));
528
- M((r) => {
560
+ A((r) => {
529
561
  let i = r.filter((e) => t.has(e.id) && !n.has(e.id));
530
562
  return e.length === 0 && i.length === r.length ? r : [...i, ...e];
531
563
  });
532
564
  }, [r]);
533
- let N = new Set(r.map((e) => e.id)), P = (e) => j.filter((e) => N.has(e.id)).filter((t) => t.alert === e).map((e) => /* @__PURE__ */ n("p", { children: [e.text, e.count > 1 && `, ${_(e.count)}`] }, e.seq)), F = /* @__PURE__ */ n("div", {
565
+ let j = new Set(r.map((e) => e.id)), M = (e) => k.filter((e) => j.has(e.id)).filter((t) => t.alert === e).map((e) => /* @__PURE__ */ n("p", { children: [e.text, e.count > 1 && `, ${x.count(e.count)}`] }, e.seq)), N = /* @__PURE__ */ n("div", {
534
566
  className: "pb-toaster-announce",
535
567
  children: [/* @__PURE__ */ t("div", {
536
568
  role: "status",
537
- children: P(!1)
569
+ children: M(!1)
538
570
  }), /* @__PURE__ */ t("div", {
539
571
  role: "alert",
540
- children: P(!0)
572
+ children: M(!0)
541
573
  })]
542
- }), [I, L] = l(!1), [R, z] = l(!1);
543
- O && (I || R) && (L(!1), z(!1));
544
- let B = I || R, V = c(f);
574
+ }), [P, F] = l(!1), [I, L] = l(!1);
575
+ E && (P || I) && (F(!1), L(!1));
576
+ let R = P || I, z = c(f);
545
577
  o(() => {
546
- V.current = f;
578
+ z.current = f;
547
579
  }), o(() => {
548
- V.current?.(B);
549
- }, [B]), o(() => () => {
550
- V.current?.(!1);
580
+ z.current?.(R);
581
+ }, [R]), o(() => () => {
582
+ z.current?.(!1);
551
583
  }, []);
552
- let H = c(null), U = c(null), W = c(void 0);
584
+ let B = c(null), V = c(null), H = c(void 0);
553
585
  o(() => {
554
- let e = W.current;
586
+ let e = H.current;
555
587
  if (e === void 0) return;
556
- W.current = void 0;
557
- let t = (e === null ? null : H.current?.querySelector(`[data-toast-id="${e}"]`)) ?? H.current?.querySelector(".pb-toast");
588
+ H.current = void 0;
589
+ let t = (e === null ? null : B.current?.querySelector(`[data-toast-id="${e}"]`)) ?? B.current?.querySelector(".pb-toast");
558
590
  if (t != null) {
559
591
  t.focus();
560
592
  return;
561
593
  }
562
- let n = U.current;
563
- U.current = null, n?.isConnected === !0 && n.focus();
594
+ let n = V.current;
595
+ V.current = null, n?.isConnected === !0 && n.focus();
564
596
  });
565
- let Y = (e) => {
566
- if (H.current?.contains(document.activeElement) === !0) {
567
- let t = D.findIndex((t) => t.id === e);
568
- W.current = (D[t + 1] ?? D[t - 1])?.id ?? null;
597
+ let U = (e) => {
598
+ if (B.current?.contains(document.activeElement) === !0) {
599
+ let t = T.findIndex((t) => t.id === e);
600
+ H.current = (T[t + 1] ?? T[t - 1])?.id ?? null;
569
601
  }
570
602
  u(e);
571
603
  };
572
- if (O) return F;
573
- let X = s > 0 && /* @__PURE__ */ t("p", {
604
+ if (E) return N;
605
+ let W = s > 0 && /* @__PURE__ */ t("p", {
574
606
  className: "pb-toaster-more",
575
- children: g(s)
607
+ children: x.more(s)
576
608
  });
577
- return /* @__PURE__ */ n(e, { children: [F, /* @__PURE__ */ n("section", {
578
- ...C,
579
- "aria-label": C["aria-label"] ?? m,
580
- className: v === void 0 ? "pb-toaster" : `pb-toaster ${v}`,
581
- "data-placement": T,
609
+ return /* @__PURE__ */ n(e, { children: [N, /* @__PURE__ */ n("section", {
610
+ ...b,
611
+ "aria-label": b["aria-label"] ?? x.region,
612
+ className: h === void 0 ? "pb-toaster" : `pb-toaster ${h}`,
613
+ "data-placement": C,
582
614
  onPointerEnter: (e) => {
583
- y?.(e), e.pointerType !== "touch" && L(!0);
615
+ g?.(e), e.pointerType !== "touch" && F(!0);
584
616
  },
585
617
  onPointerLeave: (e) => {
586
- b?.(e), L(!1);
618
+ _?.(e), F(!1);
587
619
  },
588
620
  onFocus: (e) => {
589
- x?.(e);
621
+ v?.(e);
590
622
  let t = e.relatedTarget;
591
- !R && t instanceof HTMLElement && !e.currentTarget.contains(t) && (U.current = t), z(!0);
623
+ !I && t instanceof HTMLElement && !e.currentTarget.contains(t) && (V.current = t), L(!0);
592
624
  },
593
625
  onBlur: (e) => {
594
- S?.(e), e.currentTarget.contains(e.relatedTarget) || z(!1);
626
+ y?.(e), e.currentTarget.contains(e.relatedTarget) || L(!1);
595
627
  },
596
628
  children: [
597
- !E && X,
629
+ !w && W,
598
630
  /* @__PURE__ */ t("ol", {
599
631
  className: "pb-toaster-list",
600
- ref: H,
601
- children: D.map((e) => {
602
- let r = `${w}-${e.id}`, i = e.count ?? 1;
632
+ ref: B,
633
+ children: T.map((e) => {
634
+ let r = `${S}-${e.id}`, i = e.count ?? 1;
603
635
  return /* @__PURE__ */ n("li", {
604
636
  className: "pb-toast",
605
637
  "data-tone": e.tone,
606
638
  "data-toast-id": e.id,
607
639
  tabIndex: -1,
608
640
  onKeyDown: (t) => {
609
- t.key !== "Escape" || t.defaultPrevented || (t.preventDefault(), t.stopPropagation(), Y(e.id));
641
+ t.key !== "Escape" || t.defaultPrevented || (t.preventDefault(), t.stopPropagation(), U(e.id));
610
642
  },
611
643
  children: [/* @__PURE__ */ n("div", {
612
644
  className: "pb-toast-text",
@@ -618,7 +650,7 @@ function Y({ toasts: r, more: s = 0, onDismiss: u, onHold: f, placement: p = "bo
618
650
  children: [" ×", i]
619
651
  }), /* @__PURE__ */ n("span", {
620
652
  className: "pb-toast-hidden",
621
- children: [", ", _(i)]
653
+ children: [", ", x.count(i)]
622
654
  })]
623
655
  })]
624
656
  }), /* @__PURE__ */ n("div", {
@@ -626,25 +658,25 @@ function Y({ toasts: r, more: s = 0, onDismiss: u, onHold: f, placement: p = "bo
626
658
  children: [e.action !== void 0 && /* @__PURE__ */ t(d, {
627
659
  size: "sm",
628
660
  onClick: () => {
629
- e.action?.run(), Y(e.id);
661
+ e.action?.run(), U(e.id);
630
662
  },
631
663
  children: e.action.label
632
664
  }), /* @__PURE__ */ t(d, {
633
665
  size: "sm",
634
666
  "aria-describedby": r,
635
667
  onClick: () => {
636
- Y(e.id);
668
+ U(e.id);
637
669
  },
638
- children: h
670
+ children: x.dismiss
639
671
  })]
640
672
  })]
641
673
  }, e.id);
642
674
  })
643
675
  }),
644
- E && X
676
+ w && W
645
677
  ]
646
678
  })] });
647
679
  }
648
- export { g as Banner, I as CommandPalette, V as DiffView, A as PALETTE_GUTTER, k as PALETTE_HEIGHT, O as PALETTE_WIDTH, U as ShortcutSheet, W as StatusWords, Y as Toaster, H as groupShortcuts, D as markRuns, T as matchSubsequence, j as placePalette, E as rankCommands };
680
+ export { _ as Banner, L as CommandPalette, H as DiffView, M as PALETTE_GUTTER, j as PALETTE_HEIGHT, A as PALETTE_WIDTH, G as ShortcutSheet, K as StatusWords, X as Toaster, g as defaultBannerLabels, k as defaultCommandPaletteLabels, U as defaultShortcutSheetLabels, q as defaultToasterLabels, W as groupShortcuts, O as markRuns, E as matchSubsequence, N as placePalette, D as rankCommands };
649
681
 
650
682
  //# sourceMappingURL=composites.js.map