@mcurcio/patchbay 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +4 -3
  2. package/dist/composites.css +1 -1
  3. package/dist/composites.js +501 -158
  4. package/dist/composites.js.map +1 -1
  5. package/dist/graph.js +94 -79
  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/shell.css +1 -0
  11. package/dist/shell.js +177 -0
  12. package/dist/shell.js.map +1 -0
  13. package/dist/testing.js +207 -0
  14. package/dist/testing.js.map +1 -0
  15. package/dist/types/composites/banner/Banner.d.ts +9 -3
  16. package/dist/types/composites/banner/index.d.ts +2 -2
  17. package/dist/types/composites/code-editor/CodeEditor.d.ts +45 -0
  18. package/dist/types/composites/code-editor/CodeRuns.d.ts +5 -0
  19. package/dist/types/composites/code-editor/CodeText.d.ts +12 -0
  20. package/dist/types/composites/code-editor/highlight.d.ts +83 -0
  21. package/dist/types/composites/code-editor/index.d.ts +6 -0
  22. package/dist/types/composites/command-palette/CommandPalette.d.ts +16 -10
  23. package/dist/types/composites/command-palette/index.d.ts +2 -2
  24. package/dist/types/composites/index.d.ts +1 -0
  25. package/dist/types/composites/shortcut-sheet/ShortcutSheet.d.ts +17 -11
  26. package/dist/types/composites/shortcut-sheet/index.d.ts +2 -2
  27. package/dist/types/composites/toaster/Toaster.d.ts +15 -9
  28. package/dist/types/composites/toaster/index.d.ts +2 -2
  29. package/dist/types/graph/follow-fit/useFollowFit.d.ts +3 -0
  30. package/dist/types/graph/meter/Meter.d.ts +9 -3
  31. package/dist/types/graph/meter/index.d.ts +2 -2
  32. package/dist/types/graph/node-box/NodeBox.d.ts +7 -8
  33. package/dist/types/graph/node-box/index.d.ts +2 -2
  34. package/dist/types/primitives/dialog/Dialog.d.ts +8 -2
  35. package/dist/types/primitives/dialog/index.d.ts +2 -2
  36. package/dist/types/primitives/sheet/Sheet.d.ts +8 -2
  37. package/dist/types/primitives/sheet/index.d.ts +2 -2
  38. package/dist/types/primitives/splitter/Splitter.d.ts +8 -2
  39. package/dist/types/primitives/splitter/splitter-math.d.ts +12 -4
  40. package/dist/types/shell/app-shell/AppShell.d.ts +76 -0
  41. package/dist/types/shell/app-shell/bounds.d.ts +16 -0
  42. package/dist/types/shell/app-shell/index.d.ts +3 -0
  43. package/dist/types/shell/index.d.ts +1 -1
  44. package/dist/types/testing/brand-css.d.ts +41 -0
  45. package/dist/types/testing/contrast.d.ts +36 -0
  46. package/dist/types/testing/index.d.ts +2 -0
  47. package/package.json +5 -1
@@ -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",
@@ -40,40 +45,351 @@ function g({ tone: e, children: r, actions: i, onDismiss: a, dismissLabel: o = "
40
45
  ]
41
46
  });
42
47
  }
48
+ // src/composites/code-editor/CodeRuns.tsx
49
+ function v({ runs: e }) {
50
+ return e.map((e, n) => e.class === "" && e.mark === void 0 ? e.text : /* @__PURE__ */ t("span", {
51
+ className: "pb-code-run",
52
+ "data-class": e.class || void 0,
53
+ "data-mark": e.mark,
54
+ children: e.text
55
+ }, n));
56
+ }
57
+ // src/composites/code-editor/highlight.ts
58
+ function y(e) {
59
+ return e.replace(/\r\n?/g, "\n");
60
+ }
61
+ function b(e) {
62
+ let t = [0];
63
+ for (let n = e.indexOf("\n"); n !== -1; n = e.indexOf("\n", n + 1)) t.push(n + 1);
64
+ return t;
65
+ }
66
+ function x(e, t) {
67
+ let n = Math.min(e.length, Math.max(0, Math.trunc(t))), r = b(e), i = 0;
68
+ for (; i + 1 < r.length && (r[i + 1] ?? Infinity) <= n;) i += 1;
69
+ return {
70
+ line: i + 1,
71
+ column: n - (r[i] ?? 0) + 1,
72
+ offset: n
73
+ };
74
+ }
75
+ function S(e, t, n = 1) {
76
+ let r = b(e), i = Math.min(r.length, Math.max(1, Math.trunc(t))) - 1, a = r[i] ?? 0, o = i + 1 < r.length ? (r[i + 1] ?? 0) - 1 : e.length;
77
+ return Math.min(o, a + Math.max(1, Math.trunc(n)) - 1);
78
+ }
79
+ function C(e) {
80
+ return e === "error" ? "error" : e === "warning" ? "warning" : "other";
81
+ }
82
+ var w = {
83
+ other: 1,
84
+ warning: 2,
85
+ error: 3
86
+ };
87
+ function T(e, t) {
88
+ return e !== void 0 && w[e] >= w[t] ? e : t;
89
+ }
90
+ function E(e, t) {
91
+ let n = b(e), r = Math.min(n.length, Math.max(1, Math.trunc(t.line))) - 1, i = n[r] ?? 0, a = r + 1 < n.length ? (n[r + 1] ?? 0) - 1 : e.length;
92
+ if (t.column === void 0) {
93
+ let t = i, n = a;
94
+ for (; t < n && /\s/.test(e[t] ?? "");) t += 1;
95
+ for (; n > t && /\s/.test(e[n - 1] ?? "");) --n;
96
+ return {
97
+ start: t,
98
+ end: n
99
+ };
100
+ }
101
+ let o = S(e, r + 1, t.column), s = o;
102
+ for (; s < a && !/\s/.test(e[s] ?? "");) s += 1;
103
+ return s === o && o < a && (s = o + 1), {
104
+ start: o,
105
+ end: s
106
+ };
107
+ }
108
+ function D(e, t = [], n = []) {
109
+ let r = [""], i = new Uint16Array(e.length);
110
+ for (let n of t) {
111
+ let t = Math.max(0, Math.trunc(n.start)), a = Math.min(e.length, Math.trunc(n.end));
112
+ if (!(a > t)) continue;
113
+ let o = n.class === "space" ? "" : n.class, s = r.indexOf(o);
114
+ s === -1 && (s = r.push(o) - 1), i.fill(s, t, a);
115
+ }
116
+ let a = [
117
+ void 0,
118
+ "other",
119
+ "warning",
120
+ "error"
121
+ ], o = new Uint8Array(e.length);
122
+ for (let t of n) {
123
+ let { start: n, end: r } = E(e, t), i = w[C(t.severity)];
124
+ for (let e = n; e < r; e += 1) o[e] = Math.max(o[e] ?? 0, i);
125
+ }
126
+ let s = [], c = 0;
127
+ for (let t = 1; t <= e.length; t += 1) {
128
+ if (t < e.length && i[t] === i[c] && o[t] === o[c]) continue;
129
+ let n = a[o[c] ?? 0], l = {
130
+ text: e.slice(c, t),
131
+ class: r[i[c] ?? 0] ?? ""
132
+ };
133
+ n !== void 0 && (l.mark = n), s.push(l), c = t;
134
+ }
135
+ return s;
136
+ }
137
+ function O(e, t = []) {
138
+ let n = b(e).length, r = Array.from({ length: n }, (e, t) => ({
139
+ line: t + 1,
140
+ column: 1,
141
+ diagnostics: []
142
+ }));
143
+ for (let e of t) {
144
+ let t = r[Math.min(n, Math.max(1, Math.trunc(e.line))) - 1];
145
+ t !== void 0 && (t.diagnostics.length === 0 && (t.column = e.column ?? 1), t.diagnostics.push(e), t.mark = T(t.mark, C(e.severity)));
146
+ }
147
+ return r;
148
+ }
149
+ var k, A;
150
+ function j() {
151
+ return k ??= import("knobly/highlight").then((e) => A = e.highlight, (e) => (console.warn("patchbay: language \"knobly\" needs the knobly package; drawing plain text.", e), A = null, null)), k;
152
+ }
153
+ function M(e, t) {
154
+ let n = t === void 0 && e === "knobly", [r, a] = l(void 0);
155
+ return i(() => {
156
+ if (!n || A !== void 0) return;
157
+ let e = !0;
158
+ return j().then((t) => {
159
+ e && a({ highlight: t });
160
+ }), () => {
161
+ e = !1;
162
+ };
163
+ }, [n]), t === void 0 ? n ? A ?? r?.highlight ?? void 0 : void 0 : t;
164
+ }
165
+ // src/composites/code-editor/CodeEditor.tsx
166
+ var N = {
167
+ diagnostic: ({ line: e, column: t, severity: n, code: r, message: i }) => `Line ${String(e)}${t === void 0 ? "" : `, column ${String(t)}`}: ${n}${r === void 0 || r === "" ? "" : ` ${r}`}: ${i}`,
168
+ tabKey: "Tab indents. Press Escape, then Tab, to move on."
169
+ }, P = [];
170
+ function F(e, t) {
171
+ if (t !== "" && e.startsWith(t)) return t.length;
172
+ if (e.startsWith(" ")) return 1;
173
+ let n = t === " " || t === "" ? 4 : t.length, r = 0;
174
+ for (; r < n && e[r] === " ";) r += 1;
175
+ return r;
176
+ }
177
+ function I(e, t, n, r, i) {
178
+ let a = e.slice(t, n).includes("\n");
179
+ if (!i && !a) {
180
+ if (r === "") return;
181
+ let e = t + r.length;
182
+ return {
183
+ from: t,
184
+ to: n,
185
+ insert: r,
186
+ start: e,
187
+ end: e
188
+ };
189
+ }
190
+ let o = e.lastIndexOf("\n", t - 1) + 1, s = n > t && e[n - 1] === "\n" ? n - 1 : n, c = e.indexOf("\n", s), l = c === -1 ? e.length : c, u = e.slice(o, l).split("\n"), d = u.map((e) => i ? e.slice(F(e, r)) : e === "" ? e : r + e), f = d.join("\n");
191
+ if (f !== e.slice(o, l)) {
192
+ if (t === n) {
193
+ let e = (d[0] ?? "").length - (u[0] ?? "").length, n = Math.max(o, t + e);
194
+ return {
195
+ from: o,
196
+ to: l,
197
+ insert: f,
198
+ start: n,
199
+ end: n
200
+ };
201
+ }
202
+ return {
203
+ from: o,
204
+ to: l,
205
+ insert: f,
206
+ start: o,
207
+ end: o + f.length
208
+ };
209
+ }
210
+ }
211
+ function L(e) {
212
+ let t = document.execCommand;
213
+ return typeof t == "function" ? e === "" ? t.call(document, "delete", !1) : t.call(document, "insertText", !1, e) : !1;
214
+ }
215
+ function R({ value: e, onChange: r, language: i, highlight: l, diagnostics: u = P, onCaret: d, lineNumbers: f = !0, indent: p = " ", labels: m, readOnly: h = !1, className: g, style: _, ref: b, onKeyDown: C, onBlur: w, onScroll: T, onSelect: E, "aria-describedby": k, ...A }) {
216
+ let j = {
217
+ ...N,
218
+ ...m
219
+ }, F = c(null), R = c(null), z = c(null), B = c(!1), V = c(null), H = c(""), U = a(), W = M(i, l), G = y(e), ee = s(() => D(G, W?.(G), u), [
220
+ G,
221
+ W,
222
+ u
223
+ ]), K = s(() => O(G, u), [G, u]), q = () => {
224
+ let e = F.current;
225
+ e !== null && (R.current !== null && (R.current.scrollTop = e.scrollTop, R.current.scrollLeft = e.scrollLeft), z.current !== null && (z.current.scrollTop = e.scrollTop));
226
+ }, J = () => {
227
+ let e = F.current;
228
+ if (e === null || d === void 0) return;
229
+ let t = e.selectionDirection === "backward" ? e.selectionStart : e.selectionEnd, n = x(e.value, t), r = `${String(n.line)}:${String(n.column)}:${String(n.offset)}`;
230
+ r !== H.current && (H.current = r, d(n));
231
+ };
232
+ o(() => {
233
+ let e = F.current, t = V.current;
234
+ V.current = null, e !== null && t !== null && e.value === t.value && (e.setSelectionRange(t.start, t.end), J()), q();
235
+ });
236
+ let Y = (e, t) => {
237
+ if (e.setSelectionRange(t.from, t.to), L(t.insert)) {
238
+ e.setSelectionRange(t.start, t.end), J();
239
+ return;
240
+ }
241
+ let n = e.value.slice(0, t.from) + t.insert + e.value.slice(t.to);
242
+ V.current = {
243
+ value: n,
244
+ start: t.start,
245
+ end: t.end
246
+ }, r?.(n);
247
+ }, X = (e) => {
248
+ if (C?.(e), e.defaultPrevented) return;
249
+ if (e.key === "Escape") {
250
+ B.current = !0;
251
+ return;
252
+ }
253
+ if (e.key !== "Tab") {
254
+ e.key !== "Shift" && (B.current = !1);
255
+ return;
256
+ }
257
+ let t = B.current;
258
+ if (B.current = !1, t || h || e.ctrlKey || e.altKey || e.metaKey || e.nativeEvent.isComposing) return;
259
+ e.preventDefault();
260
+ let n = e.currentTarget, r = I(n.value, n.selectionStart, n.selectionEnd, p, e.shiftKey);
261
+ r !== void 0 && Y(n, r);
262
+ }, Z = (e, t) => {
263
+ let n = F.current;
264
+ if (n === null) return;
265
+ let r = S(n.value, e, t);
266
+ n.focus(), n.setSelectionRange(r, r), J();
267
+ }, Q = [...h ? [] : [j.tabKey], ...u.map((e) => j.diagnostic(e))], te = [k, Q.length > 0 ? U : void 0].filter((e) => e !== void 0 && e !== "").join(" ") || void 0, $ = String(K.length).length;
268
+ return /* @__PURE__ */ n("div", {
269
+ className: g === void 0 ? "pb-code-editor" : `pb-code-editor ${g}`,
270
+ style: _,
271
+ "data-readonly": h || void 0,
272
+ children: [
273
+ f ? /* @__PURE__ */ t("pre", {
274
+ ref: z,
275
+ className: "pb-code-gutter",
276
+ "aria-hidden": "true",
277
+ style: { "--pb-code-gutter-digits": $ },
278
+ children: /* @__PURE__ */ t("code", {
279
+ className: "pb-code-gutter-code",
280
+ children: K.map((e) => /* @__PURE__ */ n("span", {
281
+ className: "pb-code-gutter-row",
282
+ children: [
283
+ e.line,
284
+ /* @__PURE__ */ t("span", {
285
+ className: "pb-code-gutter-mark",
286
+ "data-mark": e.mark,
287
+ title: e.diagnostics.length === 0 ? void 0 : e.diagnostics.map((e) => j.diagnostic(e)).join("\n"),
288
+ onClick: e.mark === void 0 ? void 0 : () => {
289
+ Z(e.line, e.column);
290
+ }
291
+ }),
292
+ "\n"
293
+ ]
294
+ }, e.line))
295
+ })
296
+ }) : null,
297
+ /* @__PURE__ */ n("div", {
298
+ className: "pb-code-box",
299
+ children: [/* @__PURE__ */ t("pre", {
300
+ ref: R,
301
+ className: "pb-code-layer",
302
+ "aria-hidden": "true",
303
+ children: /* @__PURE__ */ n("code", {
304
+ className: "pb-code-layer-code",
305
+ children: [/* @__PURE__ */ t(v, { runs: ee }), "\n"]
306
+ })
307
+ }), /* @__PURE__ */ t("textarea", {
308
+ spellCheck: !1,
309
+ autoCapitalize: "off",
310
+ autoComplete: "off",
311
+ autoCorrect: "off",
312
+ wrap: "off",
313
+ ...A,
314
+ ref: (e) => {
315
+ if (F.current = e, typeof b == "function") return b(e);
316
+ b && (b.current = e);
317
+ },
318
+ className: "pb-code-input",
319
+ value: e,
320
+ readOnly: h,
321
+ "aria-describedby": te,
322
+ onChange: (e) => r?.(e.target.value),
323
+ onKeyDown: X,
324
+ onBlur: (e) => {
325
+ B.current = !1, w?.(e);
326
+ },
327
+ onScroll: (e) => {
328
+ q(), T?.(e);
329
+ },
330
+ onSelect: (e) => {
331
+ J(), E?.(e);
332
+ }
333
+ })]
334
+ }),
335
+ Q.length > 0 ? /* @__PURE__ */ t("div", {
336
+ id: U,
337
+ hidden: !0,
338
+ children: Q.map((e, n) => /* @__PURE__ */ t("p", { children: e }, n))
339
+ }) : null
340
+ ]
341
+ });
342
+ }
343
+ // src/composites/code-editor/CodeText.tsx
344
+ function z({ value: e, language: n, highlight: r, className: i, ...a }) {
345
+ let o = M(n, r), c = s(() => {
346
+ let t = y(e);
347
+ return D(t, o?.(t));
348
+ }, [e, o]);
349
+ return /* @__PURE__ */ t("pre", {
350
+ tabIndex: 0,
351
+ ...a,
352
+ className: i === void 0 ? "pb-code-text" : `pb-code-text ${i}`,
353
+ children: /* @__PURE__ */ t("code", {
354
+ className: "pb-code-text-code",
355
+ children: /* @__PURE__ */ t(v, { runs: c })
356
+ })
357
+ });
358
+ }
43
359
  // src/composites/command-palette/rank.ts
44
- function _(e, t) {
360
+ function B(e, t) {
45
361
  if (t === 0) return !0;
46
362
  let n = e.charAt(t - 1), r = e.charAt(t);
47
363
  return !/[\p{L}\p{N}]/u.test(n) || n !== n.toUpperCase() && r !== r.toLowerCase() && r === r.toUpperCase();
48
364
  }
49
- function v(e) {
365
+ function V(e) {
50
366
  let t = e.toLowerCase();
51
367
  return t.length === 1 ? t : e;
52
368
  }
53
- var y = 3, b = 2, x = 2, S = .1, C = 1, w = .02;
54
- function T(e, t) {
369
+ var H = 3, U = 2, W = 2, G = .1, ee = 1, K = .02;
370
+ function q(e, t) {
55
371
  let n = t.replace(/\s+/g, "");
56
372
  if (n === "") return {
57
373
  indices: [],
58
374
  score: 0
59
375
  };
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;
376
+ 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;
61
377
  if (o > a) return;
62
- let s = i.map((t, n) => n === 0 ? y : _(e, n) ? b : 0), c = [], l = [];
378
+ let s = i.map((t, n) => n === 0 ? H : B(e, n) ? U : 0), c = [], l = [];
63
379
  for (let e = 0; e < o; e += 1) {
64
380
  let t = Array(a).fill(-Infinity), n = Array(a).fill(-1), o = r[e];
65
381
  for (let r = e; r < a; r += 1) {
66
382
  if (i[r] !== o) continue;
67
383
  let a = 1 + (s[r] ?? 0);
68
384
  if (e === 0) {
69
- t[r] = a - r * w;
385
+ t[r] = a - r * K;
70
386
  continue;
71
387
  }
72
388
  let l = c[e - 1] ?? [];
73
389
  for (let i = e - 1; i < r; i += 1) {
74
390
  let e = l[i] ?? -Infinity;
75
391
  if (e === -Infinity) continue;
76
- let o = i === r - 1 ? x : -Math.min((r - i - 1) * S, C), s = e + a + o;
392
+ let o = i === r - 1 ? W : -Math.min((r - i - 1) * G, ee), s = e + a + o;
77
393
  s > (t[r] ?? -Infinity) && (t[r] = s, n[r] = i);
78
394
  }
79
395
  }
@@ -89,10 +405,10 @@ function T(e, t) {
89
405
  score: u[d] ?? 0
90
406
  };
91
407
  }
92
- function E(e, t) {
408
+ function J(e, t) {
93
409
  let n = /* @__PURE__ */ new Map();
94
410
  e.forEach((e, r) => {
95
- let i = T(e.label, t);
411
+ let i = q(e.label, t);
96
412
  if (i === void 0) return;
97
413
  let a = n.get(e.group);
98
414
  a === void 0 && (a = {
@@ -123,7 +439,7 @@ function E(e, t) {
123
439
  }))
124
440
  }));
125
441
  }
126
- function D(e, t) {
442
+ function Y(e, t) {
127
443
  let n = new Set(t), r = [];
128
444
  for (let t = 0; t < e.length; t += 1) {
129
445
  let i = n.has(t), a = r[r.length - 1];
@@ -135,8 +451,14 @@ function D(e, t) {
135
451
  return r;
136
452
  }
137
453
  // src/composites/command-palette/CommandPalette.tsx
138
- var O = 320, k = 360, A = 8;
139
- function j(e, t) {
454
+ var X = {
455
+ palette: "Commands",
456
+ placeholder: "Type a command",
457
+ empty: "No commands",
458
+ noMatch: (e) => `No command matches “${e}”`,
459
+ keyNames: {}
460
+ }, Z = 320, Q = 360, te = 8;
461
+ function $(e, t) {
140
462
  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
463
  return {
142
464
  left: i(e.x, n, t.width),
@@ -145,8 +467,8 @@ function j(e, t) {
145
467
  height: r
146
468
  };
147
469
  }
148
- var M = (e) => `No command matches “${e}”`, N = 8;
149
- function P(e) {
470
+ var ne = 8;
471
+ function re(e) {
150
472
  let t = () => ({
151
473
  width: window.innerWidth,
152
474
  height: window.innerHeight
@@ -161,47 +483,50 @@ function P(e) {
161
483
  };
162
484
  }, [e]), n;
163
485
  }
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);
486
+ function ie({ onClose: e, commands: r, at: u, platform: d, labels: f, className: p }) {
487
+ let g = {
488
+ ...X,
489
+ ...f
490
+ }, _ = a(), v = `${_}-list`, [y, b] = l(""), x = s(() => J(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, D] = l(y);
491
+ E !== y && (D(y), T(void 0));
492
+ let O = C.find((e) => e.id === w) ?? C[0], k = (e) => `${_}-option-${S.indexOf(e)}`, A = c(null), j = c(null), M = c(null), N = c(e);
168
493
  o(() => {
169
- H.current = e;
494
+ N.current = e;
170
495
  }), o(() => {
171
496
  let e = document.activeElement instanceof HTMLElement ? document.activeElement : null;
172
- B.current?.focus();
173
- let t = z.current;
497
+ j.current?.focus();
498
+ let t = A.current;
174
499
  return () => {
175
500
  let n = document.activeElement;
176
501
  (n === null || n === document.body || (t?.contains(n) ?? !1) || !n.isConnected) && e?.isConnected === !0 && e.focus();
177
502
  };
178
503
  }, []), i(() => {
179
- if (L === void 0) return;
180
- let e = document.getElementById(R(L));
504
+ if (O === void 0) return;
505
+ let e = document.getElementById(k(O));
181
506
  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) => {
507
+ }, [O]);
508
+ let P = (e) => {
509
+ e.disabled !== !0 && (N.current(), e.run());
510
+ }, F = () => {
511
+ let e = M.current?.querySelector("[role=\"option\"]"), t = e && e.offsetHeight > 0 ? Math.floor((M.current?.clientHeight ?? 0) / e.offsetHeight) : 0;
512
+ return Math.max(1, t || ne);
513
+ }, I = (e) => {
189
514
  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) => {
515
+ let t = e.altKey || e.ctrlKey || e.metaKey, n = O === void 0 ? -1 : C.indexOf(O), r = C.length - 1, i = (t) => {
191
516
  e.preventDefault();
192
- let n = O[Math.min(Math.max(t, 0), r)];
193
- n !== void 0 && A(n.id);
517
+ let n = C[Math.min(Math.max(t, 0), r)];
518
+ n !== void 0 && T(n.id);
194
519
  };
195
520
  switch (e.key) {
196
521
  case "Escape":
197
- e.preventDefault(), e.stopPropagation(), H.current();
522
+ e.preventDefault(), e.stopPropagation(), N.current();
198
523
  return;
199
524
  case "Tab":
200
- e.preventDefault(), H.current();
525
+ e.preventDefault(), N.current();
201
526
  return;
202
527
  case "Enter":
203
528
  if (t) return;
204
- e.preventDefault(), L !== void 0 && U(L);
529
+ e.preventDefault(), O !== void 0 && P(O);
205
530
  return;
206
531
  case "ArrowDown":
207
532
  if (t) return;
@@ -213,11 +538,11 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
213
538
  return;
214
539
  case "PageDown":
215
540
  if (t) return;
216
- i(n + W());
541
+ i(n + F());
217
542
  return;
218
543
  case "PageUp":
219
544
  if (t) return;
220
- i(n - W());
545
+ i(n - F());
221
546
  return;
222
547
  case "Home":
223
548
  if (t || e.shiftKey) return;
@@ -229,61 +554,61 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
229
554
  return;
230
555
  default: return;
231
556
  }
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", {
557
+ }, L = re(u !== void 0), R = u === void 0 ? void 0 : $(u, L), z = R !== void 0, B;
558
+ return r.length === 0 ? B = g.empty : S.length === 0 && (B = g.noMatch(y.trim())), /* @__PURE__ */ t("div", {
234
559
  className: "pb-palette-layer",
235
- "data-anchored": J ? "" : void 0,
560
+ "data-anchored": z ? "" : void 0,
236
561
  onMouseDown: (e) => {
237
- e.target === e.currentTarget && H.current();
562
+ e.target === e.currentTarget && N.current();
238
563
  },
239
564
  children: /* @__PURE__ */ n("div", {
240
- ref: z,
241
- className: y === void 0 ? "pb-palette" : `pb-palette ${y}`,
565
+ ref: A,
566
+ className: p === void 0 ? "pb-palette" : `pb-palette ${p}`,
242
567
  role: "dialog",
243
568
  "aria-modal": "true",
244
- "aria-label": f,
245
- style: q === void 0 ? void 0 : {
569
+ "aria-label": g.palette,
570
+ style: R === void 0 ? void 0 : {
246
571
  position: "fixed",
247
- left: q.left,
248
- top: q.top,
249
- width: q.width,
250
- maxHeight: q.height
572
+ left: R.left,
573
+ top: R.top,
574
+ width: R.width,
575
+ maxHeight: R.height
251
576
  },
252
577
  onBlur: (e) => {
253
578
  let t = e.relatedTarget;
254
- t instanceof Node && !e.currentTarget.contains(t) && H.current();
579
+ t instanceof Node && !e.currentTarget.contains(t) && N.current();
255
580
  },
256
581
  children: [
257
582
  /* @__PURE__ */ t("input", {
258
- ref: B,
583
+ ref: j,
259
584
  className: "pb-palette-field",
260
585
  type: "text",
261
586
  role: "combobox",
262
- "aria-label": f,
587
+ "aria-label": g.palette,
263
588
  "aria-expanded": "true",
264
- "aria-controls": x,
589
+ "aria-controls": v,
265
590
  "aria-autocomplete": "list",
266
- "aria-activedescendant": L === void 0 ? void 0 : R(L),
591
+ "aria-activedescendant": O === void 0 ? void 0 : k(O),
267
592
  autoComplete: "off",
268
593
  autoCapitalize: "off",
269
594
  autoCorrect: "off",
270
595
  spellCheck: !1,
271
- placeholder: d,
272
- value: S,
596
+ placeholder: g.placeholder,
597
+ value: y,
273
598
  onChange: (e) => {
274
- C(e.target.value);
599
+ b(e.target.value);
275
600
  },
276
- onKeyDown: G
601
+ onKeyDown: I
277
602
  }),
278
603
  /* @__PURE__ */ t("div", {
279
- ref: V,
604
+ ref: M,
280
605
  className: "pb-palette-list",
281
- id: x,
606
+ id: v,
282
607
  role: "listbox",
283
- "aria-label": f,
284
- hidden: T.length === 0,
285
- children: w.map((e, r) => {
286
- let i = `${b}-group-${r}`;
608
+ "aria-label": g.palette,
609
+ hidden: S.length === 0,
610
+ children: x.map((e, r) => {
611
+ let i = `${_}-group-${r}`;
287
612
  return /* @__PURE__ */ n("div", {
288
613
  role: "group",
289
614
  "aria-labelledby": i,
@@ -294,29 +619,29 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
294
619
  role: "presentation",
295
620
  children: e.group
296
621
  }), 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;
622
+ let i = k(e), a = e.keys === void 0 ? [] : typeof e.keys == "string" ? [e.keys] : e.keys, o = e === O;
298
623
  return /* @__PURE__ */ n("div", {
299
624
  id: i,
300
625
  role: "option",
301
626
  "aria-selected": o,
302
627
  "aria-disabled": e.disabled === !0 || void 0,
303
- "aria-keyshortcuts": a.length === 0 ? void 0 : m(a, _),
628
+ "aria-keyshortcuts": a.length === 0 ? void 0 : m(a, d),
304
629
  className: "pb-palette-option",
305
630
  "data-command-id": e.id,
306
631
  onMouseDown: (e) => {
307
632
  e.preventDefault();
308
633
  },
309
634
  onPointerMove: () => {
310
- e.disabled !== !0 && !o && A(e.id);
635
+ e.disabled !== !0 && !o && T(e.id);
311
636
  },
312
637
  onClick: () => {
313
- U(e);
638
+ P(e);
314
639
  },
315
640
  children: [/* @__PURE__ */ n("span", {
316
641
  className: "pb-palette-text",
317
642
  children: [/* @__PURE__ */ t("span", {
318
643
  className: "pb-palette-label",
319
- children: D(e.label, r).map((e, n) => e.marked ? /* @__PURE__ */ t("mark", { children: e.text }, n) : e.text)
644
+ children: Y(e.label, r).map((e, n) => e.marked ? /* @__PURE__ */ t("mark", { children: e.text }, n) : e.text)
320
645
  }), e.hint !== void 0 && /* @__PURE__ */ t("span", {
321
646
  className: "pb-palette-hint",
322
647
  children: e.hint
@@ -324,8 +649,8 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
324
649
  }), a.length > 0 && /* @__PURE__ */ t("span", {
325
650
  className: "pb-palette-keys",
326
651
  children: a.map((e) => /* @__PURE__ */ t("kbd", { children: h(e, {
327
- platform: _,
328
- names: v
652
+ platform: d,
653
+ names: g.keyNames
329
654
  }) }, e))
330
655
  })]
331
656
  }, e.id);
@@ -336,27 +661,27 @@ function F({ onClose: e, commands: r, at: u, placeholder: d = "Type a command",
336
661
  /* @__PURE__ */ t("p", {
337
662
  className: "pb-palette-empty",
338
663
  role: "status",
339
- children: Y
664
+ children: B
340
665
  })
341
666
  ]
342
667
  })
343
668
  });
344
669
  }
345
- function I({ open: e, ...n }) {
346
- return e ? u(/* @__PURE__ */ t(F, { ...n }), document.body) : null;
670
+ function ae({ open: e, ...n }) {
671
+ return e ? u(/* @__PURE__ */ t(ie, { ...n }), document.body) : null;
347
672
  }
348
673
  // src/composites/diff-view/DiffView.tsx
349
- function L(e) {
674
+ function oe(e) {
350
675
  return e.startsWith("+++ ") || e.startsWith("--- ") ? "meta" : e.startsWith("@@") ? "hunk" : e.startsWith("+") ? "add" : e.startsWith("-") ? "del" : e.startsWith("\\") ? "note" : e === "" || e.startsWith(" ") ? "context" : "meta";
351
676
  }
352
- function R(e) {
677
+ function se(e) {
353
678
  return e.split("/").filter((e) => e !== "").at(-1) ?? e;
354
679
  }
355
- function z(e) {
680
+ function ce(e) {
356
681
  let t = e.split(/\r?\n/);
357
682
  return t.length > 0 && t.at(-1) === "" && t.pop(), t;
358
683
  }
359
- function B({ text: e, id: n, hidden: r }) {
684
+ function le({ text: e, id: n, hidden: r }) {
360
685
  return /* @__PURE__ */ t("pre", {
361
686
  className: "pb-diff-body",
362
687
  id: n,
@@ -364,22 +689,22 @@ function B({ text: e, id: n, hidden: r }) {
364
689
  tabIndex: 0,
365
690
  children: /* @__PURE__ */ t("code", {
366
691
  className: "pb-diff-code",
367
- children: z(e).map((e, n) => /* @__PURE__ */ t("span", {
692
+ children: ce(e).map((e, n) => /* @__PURE__ */ t("span", {
368
693
  className: "pb-diff-line",
369
- "data-kind": L(e),
694
+ "data-kind": oe(e),
370
695
  children: e === "" ? " " : e
371
696
  }, n))
372
697
  })
373
698
  });
374
699
  }
375
- function V({ diff: e, files: r, level: i = 3, collapsed: o, onToggle: s, className: c, ...u }) {
700
+ function ue({ diff: e, files: r, level: i = 3, collapsed: o, onToggle: s, className: c, ...u }) {
376
701
  let d = a(), [f, p] = l([]), m = o ?? f, h = `h${String(i)}`, g = (e, t) => {
377
702
  o === void 0 && p((n) => t ? n.filter((t) => t !== e) : [...n, e]), s?.(e, t);
378
703
  };
379
704
  return /* @__PURE__ */ t("div", {
380
705
  ...u,
381
706
  className: c === void 0 ? "pb-diff" : `pb-diff ${c}`,
382
- children: r === void 0 ? /* @__PURE__ */ t(B, { text: e }) : r.map((e, r) => {
707
+ children: r === void 0 ? /* @__PURE__ */ t(le, { text: e }) : r.map((e, r) => {
383
708
  let i = !m.includes(e.path), a = `${d}-${String(r)}`;
384
709
  return /* @__PURE__ */ n("div", {
385
710
  className: "pb-diff-file",
@@ -407,9 +732,9 @@ function V({ diff: e, files: r, level: i = 3, collapsed: o, onToggle: s, classNa
407
732
  stroke: "currentColor",
408
733
  strokeWidth: "2"
409
734
  })
410
- }), R(e.path)]
735
+ }), se(e.path)]
411
736
  })
412
- }), /* @__PURE__ */ t(B, {
737
+ }), /* @__PURE__ */ t(le, {
413
738
  text: e.diff,
414
739
  id: a,
415
740
  hidden: !i
@@ -419,7 +744,14 @@ function V({ diff: e, files: r, level: i = 3, collapsed: o, onToggle: s, classNa
419
744
  });
420
745
  }
421
746
  // src/composites/shortcut-sheet/ShortcutSheet.tsx
422
- function H(e) {
747
+ var de = {
748
+ title: "Keyboard shortcuts",
749
+ or: "or",
750
+ empty: "No shortcuts",
751
+ close: "Close",
752
+ keyNames: {}
753
+ };
754
+ function fe(e) {
423
755
  let t = /* @__PURE__ */ new Map();
424
756
  for (let n of e) {
425
757
  let e = t.get(n.group);
@@ -430,21 +762,24 @@ function H(e) {
430
762
  lines: t
431
763
  }));
432
764
  }
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);
765
+ function pe({ open: e, onClose: i, shortcuts: o, children: s, platform: c, labels: l, className: u }) {
766
+ let d = {
767
+ ...de,
768
+ ...l
769
+ }, p = a(), g = fe(o);
435
770
  return /* @__PURE__ */ n(f, {
436
771
  open: e,
437
772
  onClose: i,
438
- title: s,
439
- closeLabel: d,
440
- className: _ === void 0 ? "pb-shortcut-sheet" : `pb-shortcut-sheet ${_}`,
773
+ title: d.title,
774
+ labels: { close: d.close },
775
+ className: u === void 0 ? "pb-shortcut-sheet" : `pb-shortcut-sheet ${u}`,
441
776
  children: [
442
- y.length === 0 && /* @__PURE__ */ t("p", {
777
+ g.length === 0 && /* @__PURE__ */ t("p", {
443
778
  className: "pb-shortcut-sheet-empty",
444
- children: u
779
+ children: d.empty
445
780
  }),
446
- y.map(({ group: e, lines: i }, a) => {
447
- let o = `${v}-${a}`;
781
+ g.map(({ group: e, lines: i }, a) => {
782
+ let o = `${p}-${a}`;
448
783
  return /* @__PURE__ */ n("section", {
449
784
  className: "pb-shortcut-sheet-group",
450
785
  "aria-labelledby": o,
@@ -459,17 +794,17 @@ function U({ open: e, onClose: i, shortcuts: o, title: s = "Keyboard shortcuts",
459
794
  return /* @__PURE__ */ n("div", {
460
795
  className: "pb-shortcut-sheet-line",
461
796
  children: [/* @__PURE__ */ t("dt", { children: e.label }), /* @__PURE__ */ t("dd", {
462
- "aria-keyshortcuts": a.length === 0 ? void 0 : m(a, p),
797
+ "aria-keyshortcuts": a.length === 0 ? void 0 : m(a, c),
463
798
  children: a.map((e, i) => /* @__PURE__ */ n(r, { children: [i > 0 && /* @__PURE__ */ n("span", {
464
799
  className: "pb-shortcut-sheet-or",
465
800
  children: [
466
801
  " ",
467
- l,
802
+ d.or,
468
803
  " "
469
804
  ]
470
805
  }), /* @__PURE__ */ t("kbd", { children: h(e, {
471
- platform: p,
472
- names: g
806
+ platform: c,
807
+ names: d.keyNames
473
808
  }) })] }, e))
474
809
  })]
475
810
  }, `${e.label}-${i}`);
@@ -477,15 +812,15 @@ function U({ open: e, onClose: i, shortcuts: o, title: s = "Keyboard shortcuts",
477
812
  })]
478
813
  }, e);
479
814
  }),
480
- c !== void 0 && /* @__PURE__ */ t("div", {
815
+ s !== void 0 && /* @__PURE__ */ t("div", {
481
816
  className: "pb-shortcut-sheet-note",
482
- children: c
817
+ children: s
483
818
  })
484
819
  ]
485
820
  });
486
821
  }
487
822
  // src/composites/status-words/StatusWords.tsx
488
- function W({ items: e, className: n, ...r }) {
823
+ function me({ items: e, className: n, ...r }) {
489
824
  return /* @__PURE__ */ t("ul", {
490
825
  "aria-live": "polite",
491
826
  ...r,
@@ -499,7 +834,12 @@ function W({ items: e, className: n, ...r }) {
499
834
  });
500
835
  }
501
836
  // src/composites/toaster/Toaster.tsx
502
- var G = /* @__PURE__ */ new Set([
837
+ var he = {
838
+ region: "Notifications",
839
+ dismiss: "Dismiss",
840
+ more: (e) => `and ${e} more`,
841
+ count: (e) => `${e} times`
842
+ }, ge = /* @__PURE__ */ new Set([
503
843
  "top-start",
504
844
  "top",
505
845
  "top-end",
@@ -507,15 +847,18 @@ var G = /* @__PURE__ */ new Set([
507
847
  "bottom",
508
848
  "bottom-end",
509
849
  "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([]);
850
+ ]), _e = 256;
851
+ function ve({ 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 }) {
852
+ let x = {
853
+ ...he,
854
+ ...m
855
+ }, S = a(), C = ge.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
856
  i(() => {
514
857
  let e = [];
515
858
  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,
859
+ let n = t.count ?? 1, r = D.current.get(t.id);
860
+ r !== void 0 && n <= r || (D.current.set(t.id, n), O.current += 1, e.push({
861
+ seq: O.current,
519
862
  id: t.id,
520
863
  alert: t.tone === "err",
521
864
  text: t.text,
@@ -523,90 +866,90 @@ function Y({ toasts: r, more: s = 0, onDismiss: u, onHold: f, placement: p = "bo
523
866
  }));
524
867
  }
525
868
  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);
869
+ if (D.current.size > _e) for (let e of D.current.keys()) t.has(e) || D.current.delete(e);
527
870
  let n = new Set(e.map((e) => e.id));
528
- M((r) => {
871
+ A((r) => {
529
872
  let i = r.filter((e) => t.has(e.id) && !n.has(e.id));
530
873
  return e.length === 0 && i.length === r.length ? r : [...i, ...e];
531
874
  });
532
875
  }, [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", {
876
+ 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
877
  className: "pb-toaster-announce",
535
878
  children: [/* @__PURE__ */ t("div", {
536
879
  role: "status",
537
- children: P(!1)
880
+ children: M(!1)
538
881
  }), /* @__PURE__ */ t("div", {
539
882
  role: "alert",
540
- children: P(!0)
883
+ children: M(!0)
541
884
  })]
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);
885
+ }), [P, F] = l(!1), [I, L] = l(!1);
886
+ E && (P || I) && (F(!1), L(!1));
887
+ let R = P || I, z = c(f);
545
888
  o(() => {
546
- V.current = f;
889
+ z.current = f;
547
890
  }), o(() => {
548
- V.current?.(B);
549
- }, [B]), o(() => () => {
550
- V.current?.(!1);
891
+ z.current?.(R);
892
+ }, [R]), o(() => () => {
893
+ z.current?.(!1);
551
894
  }, []);
552
- let H = c(null), U = c(null), W = c(void 0);
895
+ let B = c(null), V = c(null), H = c(void 0);
553
896
  o(() => {
554
- let e = W.current;
897
+ let e = H.current;
555
898
  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");
899
+ H.current = void 0;
900
+ let t = (e === null ? null : B.current?.querySelector(`[data-toast-id="${e}"]`)) ?? B.current?.querySelector(".pb-toast");
558
901
  if (t != null) {
559
902
  t.focus();
560
903
  return;
561
904
  }
562
- let n = U.current;
563
- U.current = null, n?.isConnected === !0 && n.focus();
905
+ let n = V.current;
906
+ V.current = null, n?.isConnected === !0 && n.focus();
564
907
  });
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;
908
+ let U = (e) => {
909
+ if (B.current?.contains(document.activeElement) === !0) {
910
+ let t = T.findIndex((t) => t.id === e);
911
+ H.current = (T[t + 1] ?? T[t - 1])?.id ?? null;
569
912
  }
570
913
  u(e);
571
914
  };
572
- if (O) return F;
573
- let X = s > 0 && /* @__PURE__ */ t("p", {
915
+ if (E) return N;
916
+ let W = s > 0 && /* @__PURE__ */ t("p", {
574
917
  className: "pb-toaster-more",
575
- children: g(s)
918
+ children: x.more(s)
576
919
  });
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,
920
+ return /* @__PURE__ */ n(e, { children: [N, /* @__PURE__ */ n("section", {
921
+ ...b,
922
+ "aria-label": b["aria-label"] ?? x.region,
923
+ className: h === void 0 ? "pb-toaster" : `pb-toaster ${h}`,
924
+ "data-placement": C,
582
925
  onPointerEnter: (e) => {
583
- y?.(e), e.pointerType !== "touch" && L(!0);
926
+ g?.(e), e.pointerType !== "touch" && F(!0);
584
927
  },
585
928
  onPointerLeave: (e) => {
586
- b?.(e), L(!1);
929
+ _?.(e), F(!1);
587
930
  },
588
931
  onFocus: (e) => {
589
- x?.(e);
932
+ v?.(e);
590
933
  let t = e.relatedTarget;
591
- !R && t instanceof HTMLElement && !e.currentTarget.contains(t) && (U.current = t), z(!0);
934
+ !I && t instanceof HTMLElement && !e.currentTarget.contains(t) && (V.current = t), L(!0);
592
935
  },
593
936
  onBlur: (e) => {
594
- S?.(e), e.currentTarget.contains(e.relatedTarget) || z(!1);
937
+ y?.(e), e.currentTarget.contains(e.relatedTarget) || L(!1);
595
938
  },
596
939
  children: [
597
- !E && X,
940
+ !w && W,
598
941
  /* @__PURE__ */ t("ol", {
599
942
  className: "pb-toaster-list",
600
- ref: H,
601
- children: D.map((e) => {
602
- let r = `${w}-${e.id}`, i = e.count ?? 1;
943
+ ref: B,
944
+ children: T.map((e) => {
945
+ let r = `${S}-${e.id}`, i = e.count ?? 1;
603
946
  return /* @__PURE__ */ n("li", {
604
947
  className: "pb-toast",
605
948
  "data-tone": e.tone,
606
949
  "data-toast-id": e.id,
607
950
  tabIndex: -1,
608
951
  onKeyDown: (t) => {
609
- t.key !== "Escape" || t.defaultPrevented || (t.preventDefault(), t.stopPropagation(), Y(e.id));
952
+ t.key !== "Escape" || t.defaultPrevented || (t.preventDefault(), t.stopPropagation(), U(e.id));
610
953
  },
611
954
  children: [/* @__PURE__ */ n("div", {
612
955
  className: "pb-toast-text",
@@ -618,7 +961,7 @@ function Y({ toasts: r, more: s = 0, onDismiss: u, onHold: f, placement: p = "bo
618
961
  children: [" ×", i]
619
962
  }), /* @__PURE__ */ n("span", {
620
963
  className: "pb-toast-hidden",
621
- children: [", ", _(i)]
964
+ children: [", ", x.count(i)]
622
965
  })]
623
966
  })]
624
967
  }), /* @__PURE__ */ n("div", {
@@ -626,25 +969,25 @@ function Y({ toasts: r, more: s = 0, onDismiss: u, onHold: f, placement: p = "bo
626
969
  children: [e.action !== void 0 && /* @__PURE__ */ t(d, {
627
970
  size: "sm",
628
971
  onClick: () => {
629
- e.action?.run(), Y(e.id);
972
+ e.action?.run(), U(e.id);
630
973
  },
631
974
  children: e.action.label
632
975
  }), /* @__PURE__ */ t(d, {
633
976
  size: "sm",
634
977
  "aria-describedby": r,
635
978
  onClick: () => {
636
- Y(e.id);
979
+ U(e.id);
637
980
  },
638
- children: h
981
+ children: x.dismiss
639
982
  })]
640
983
  })]
641
984
  }, e.id);
642
985
  })
643
986
  }),
644
- E && X
987
+ w && W
645
988
  ]
646
989
  })] });
647
990
  }
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 };
991
+ export { _ as Banner, R as CodeEditor, z as CodeText, ae as CommandPalette, ue as DiffView, te as PALETTE_GUTTER, Q as PALETTE_HEIGHT, Z as PALETTE_WIDTH, pe as ShortcutSheet, me as StatusWords, ve as Toaster, x as caretAt, D as codeRuns, g as defaultBannerLabels, N as defaultCodeEditorLabels, X as defaultCommandPaletteLabels, de as defaultShortcutSheetLabels, he as defaultToasterLabels, fe as groupShortcuts, O as gutterRows, j as loadKnobly, C as markLevel, Y as markRuns, q as matchSubsequence, S as offsetAt, $ as placePalette, J as rankCommands, y as shownText, I as tabEdit };
649
992
 
650
993
  //# sourceMappingURL=composites.js.map