@brett_lamy/ui 5.10.1 → 5.13.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 (69) hide show
  1. package/dist/components/avatar.d.ts +4 -1
  2. package/dist/components/avatar.d.ts.map +1 -1
  3. package/dist/components/avatar.js +55 -47
  4. package/dist/components/canvas.d.ts +18 -0
  5. package/dist/components/canvas.d.ts.map +1 -1
  6. package/dist/components/canvas.js +79 -11
  7. package/dist/components/command-menu.js +1 -1
  8. package/dist/components/floating-chat.d.ts +1 -1
  9. package/dist/components/floating-sheet.d.ts +1 -1
  10. package/dist/components/hover-card.d.ts +69 -0
  11. package/dist/components/hover-card.d.ts.map +1 -0
  12. package/dist/components/hover-card.js +164 -0
  13. package/dist/components/list.d.ts +3 -0
  14. package/dist/components/list.d.ts.map +1 -1
  15. package/dist/components/list.js +265 -250
  16. package/dist/components/markdown-view.d.ts +3 -1
  17. package/dist/components/markdown-view.d.ts.map +1 -1
  18. package/dist/components/markdown-view.js +12 -11
  19. package/dist/components/open-code.d.ts +31 -0
  20. package/dist/components/open-code.d.ts.map +1 -0
  21. package/dist/components/open-code.js +253 -0
  22. package/dist/components/replay-preview.d.ts +2 -2
  23. package/dist/components/replay-preview.d.ts.map +1 -1
  24. package/dist/components/replay-preview.js +3 -3
  25. package/dist/components/sql-console.js +1 -1
  26. package/dist/components/tree.d.ts +4 -1
  27. package/dist/components/tree.d.ts.map +1 -1
  28. package/dist/components/tree.js +229 -202
  29. package/dist/components/tui-preview.d.ts +3 -0
  30. package/dist/components/tui-preview.d.ts.map +1 -0
  31. package/dist/components/tui-preview.js +3 -0
  32. package/dist/components/workspace.d.ts +11 -0
  33. package/dist/components/workspace.d.ts.map +1 -0
  34. package/dist/components/workspace.js +74 -0
  35. package/dist/index.css +1 -1
  36. package/dist/index.d.ts +17 -4
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +163 -156
  39. package/dist/lib/canvas-math.d.ts +1 -1
  40. package/dist/lib/canvas-math.d.ts.map +1 -1
  41. package/dist/lib/canvas-math.js +1 -1
  42. package/dist/lib/open-code-browser-agent.d.ts +7 -0
  43. package/dist/lib/open-code-browser-agent.d.ts.map +1 -0
  44. package/dist/lib/open-code-browser-agent.js +161 -0
  45. package/dist/lib/open-code-browser.d.ts +17 -0
  46. package/dist/lib/open-code-browser.d.ts.map +1 -0
  47. package/dist/lib/open-code-browser.js +252 -0
  48. package/dist/lib/open-code-host.d.ts +182 -0
  49. package/dist/lib/open-code-host.d.ts.map +1 -0
  50. package/dist/lib/open-code-host.js +118 -0
  51. package/dist/lib/open-code-keychain.d.ts +11 -0
  52. package/dist/lib/open-code-keychain.d.ts.map +1 -0
  53. package/dist/lib/open-code-keychain.js +19 -0
  54. package/dist/lib/open-code-preview.d.ts +16 -0
  55. package/dist/lib/open-code-preview.d.ts.map +1 -0
  56. package/dist/lib/open-code-preview.js +112 -0
  57. package/dist/lib/tailscale-policy.d.ts +9 -0
  58. package/dist/lib/tailscale-policy.d.ts.map +1 -1
  59. package/dist/lib/tailscale-policy.js +25 -19
  60. package/dist/lib/tailscale-router/bridge.d.ts +7 -2
  61. package/dist/lib/tailscale-router/bridge.d.ts.map +1 -1
  62. package/dist/lib/tailscale-router/bridge.js +64 -57
  63. package/dist/lib/theme.d.ts.map +1 -1
  64. package/dist/lib/theme.js +8 -5
  65. package/dist/opencode.d.ts +7 -0
  66. package/dist/opencode.d.ts.map +1 -0
  67. package/dist/opencode.js +6 -0
  68. package/dist/tailscale-sw.js +236 -12
  69. package/package.json +21 -3
@@ -1,14 +1,15 @@
1
1
  "use client";
2
2
  import { cn as e } from "../lib/utils.js";
3
3
  import { IC as t } from "../lib/icon.js";
4
- import { SearchField as n } from "./search-field.js";
5
- import { ContextMenu as r } from "./context-menu.js";
6
- import { useEffect as i, useMemo as a, useRef as o, useState as ee } from "react";
7
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
8
- import { prepareFileTreeInput as u, preparePresortedFileTreeInput as d } from "@pierre/trees";
4
+ import { HoverCard as n, useHoverCard as r } from "./hover-card.js";
5
+ import { SearchField as i } from "./search-field.js";
6
+ import { ContextMenu as a } from "./context-menu.js";
7
+ import { useEffect as o, useMemo as ee, useRef as s, useState as c } from "react";
8
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
9
+ import { prepareFileTreeInput as f, preparePresortedFileTreeInput as p } from "@pierre/trees";
9
10
  import { FileTree as te, useFileTree as ne } from "@pierre/trees/react";
10
11
  //#region src/components/tree.tsx
11
- var f = "​", re = "∕";
12
+ var re = "​", m = "∕";
12
13
  function ie(e) {
13
14
  let t = {
14
15
  paths: [],
@@ -19,8 +20,8 @@ function ie(e) {
19
20
  }, n = (e, r) => {
20
21
  let i = /* @__PURE__ */ new Set();
21
22
  for (let a of e) {
22
- let e = a.name.replaceAll("/", re).trim() || "Untitled";
23
- for (; i.has(e);) e = f + e;
23
+ let e = a.name.replaceAll("/", m).trim() || "Untitled";
24
+ for (; i.has(e);) e = re + e;
24
25
  i.add(e);
25
26
  let o = r + e + (a.children ? "/" : "");
26
27
  t.paths.push(o), t.byPath.set(o, a), t.pathOf.set(a.id, o), a.icon && !a.children && t.icons.set(e, a.icon), a.dimmed && t.dimmed.push(o), a.children && n(a.children, o);
@@ -28,15 +29,15 @@ function ie(e) {
28
29
  };
29
30
  return n(e, ""), t;
30
31
  }
31
- var ae = (e, t) => t ? u(e) : d(e);
32
- function p(e) {
32
+ var ae = (e, t) => t ? f(e) : p(e);
33
+ function oe(e) {
33
34
  if (e.k || e.bg) return "";
34
35
  let t = `fill="${e.f ? "currentColor" : "none"}" stroke="${e.f === 1 ? "none" : "currentColor"}" stroke-width="${1.8 * (e.w ?? 1)}" stroke-linecap="round" stroke-linejoin="round"${e.fr ? " fill-rule=\"evenodd\"" : ""}`;
35
36
  return e.d ? `<path d="${e.d}" ${t}/>` : e.c ? `<circle cx="${e.c[0]}" cy="${e.c[1]}" r="${e.c[2]}" ${t}/>` : e.r ? `<rect x="${e.r[0]}" y="${e.r[1]}" width="${e.r[2]}" height="${e.r[3]}" rx="${e.r[4] ?? 0}" ${t}/>` : "";
36
37
  }
37
- var m = (e) => `bl-tree-icon-${e}`, h = "bl-tree-icon-blank";
38
- function oe(e, n) {
39
- let r = `<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" style="position:absolute" aria-hidden="true"><symbol id="${h}" viewBox="0 0 24 24"></symbol>${[...new Set(e.icons.values())].map((e) => `<symbol id="${m(e)}" viewBox="0 0 24 24">${(t[e] ?? []).map(p).join("")}</symbol>`).join("")}</svg>`, i = (e) => ({
38
+ var h = (e) => `bl-tree-icon-${e}`, g = "bl-tree-icon-blank";
39
+ function se(e, n) {
40
+ let r = `<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" style="position:absolute" aria-hidden="true"><symbol id="${g}" viewBox="0 0 24 24"></symbol>${[...new Set(e.icons.values())].map((e) => `<symbol id="${h(e)}" viewBox="0 0 24 24">${(t[e] ?? []).map(oe).join("")}</symbol>`).join("")}</svg>`, i = (e) => ({
40
41
  name: e,
41
42
  viewBox: "0 0 24 24",
42
43
  width: 16,
@@ -46,175 +47,178 @@ function oe(e, n) {
46
47
  set: n === "none" ? "none" : n ?? "standard",
47
48
  colored: !0,
48
49
  spriteSheet: r,
49
- ...n === "none" ? { remap: { "file-tree-icon-file": i(h) } } : {},
50
- byFileName: Object.fromEntries([...e.icons].map(([e, t]) => [e, i(m(t))]))
50
+ ...n === "none" ? { remap: { "file-tree-icon-file": i(g) } } : {},
51
+ byFileName: Object.fromEntries([...e.icons].map(([e, t]) => [e, i(h(t))]))
51
52
  };
52
53
  }
53
- function g(e) {
54
- for (let t of e.composedPath()) if (t instanceof HTMLElement && t.dataset.itemPath) return t.dataset.itemPath;
54
+ function ce(e) {
55
+ for (let t of e.composedPath()) if (t instanceof HTMLElement && t.dataset.itemPath) return t;
55
56
  return null;
56
57
  }
57
- var se = (e) => JSON.stringify(e);
58
- function _({ "aria-label": t, items: s, sort: u, selectedIds: d, defaultSelectedIds: p, onSelectionChange: m, onAction: h, defaultExpanded: _ = "none", expandedIds: y, search: b, flatten: x, icons: S, gitStatus: C, density: w = "default", contextMenu: T, renamingId: E, onRename: D, onRenameEnd: O, canDrag: k, onDragStart: A, onMove: j, canMove: ce, externalDrop: M, className: N, ...P }) {
59
- let F = a(() => ie(s), [s]), I = o({
60
- index: F,
61
- selectedIds: d,
62
- gitStatus: C,
63
- onSelectionChange: m,
64
- onRename: D,
65
- onRenameEnd: O,
66
- canDrag: k,
67
- onMove: j,
68
- canMove: ce
58
+ function _(e) {
59
+ return ce(e)?.dataset.itemPath ?? null;
60
+ }
61
+ var le = (e) => JSON.stringify(e);
62
+ function v({ "aria-label": t, items: l, sort: f, selectedIds: p, defaultSelectedIds: oe, onSelectionChange: h, onAction: g, defaultExpanded: v = "none", expandedIds: b, search: x, flatten: S, icons: C, gitStatus: w, density: T = "default", contextMenu: E, preview: D, renamingId: O, onRename: k, onRenameEnd: A, canDrag: j, onDragStart: ue, onMove: de, canMove: fe, externalDrop: M, className: pe, ...me }) {
63
+ let N = ee(() => ie(l), [l]), P = s({
64
+ index: N,
65
+ selectedIds: p,
66
+ gitStatus: w,
67
+ onSelectionChange: h,
68
+ onRename: k,
69
+ onRenameEnd: A,
70
+ canDrag: j,
71
+ onMove: de,
72
+ canMove: fe
69
73
  });
70
- I.current = {
71
- index: F,
72
- selectedIds: d,
73
- gitStatus: C,
74
- onSelectionChange: m,
75
- onRename: D,
76
- onRenameEnd: O,
77
- canDrag: k,
78
- onMove: j,
79
- canMove: ce
74
+ P.current = {
75
+ index: N,
76
+ selectedIds: p,
77
+ gitStatus: w,
78
+ onSelectionChange: h,
79
+ onRename: k,
80
+ onRenameEnd: A,
81
+ canDrag: j,
82
+ onMove: de,
83
+ canMove: fe
80
84
  };
81
- let L = (e) => e.flatMap((e) => I.current.index.byPath.get(e) ?? []), R = (e) => e ? I.current.index.byPath.get(e) ?? null : null, z = o(!1), B = o(null), { model: V } = ne({
82
- preparedInput: ae(F.paths, u),
83
- initialExpansion: _ === "all" ? "open" : "closed",
84
- initialExpandedPaths: Array.isArray(_) ? _.flatMap((e) => F.pathOf.get(e) ?? []) : void 0,
85
- initialSelectedPaths: (d ?? p ?? []).flatMap((e) => F.pathOf.get(e) ?? []),
85
+ let F = (e) => e.flatMap((e) => P.current.index.byPath.get(e) ?? []), I = (e) => e ? P.current.index.byPath.get(e) ?? null : null, L = s(!1), R = s(null), { model: z } = ne({
86
+ preparedInput: ae(N.paths, f),
87
+ initialExpansion: v === "all" ? "open" : "closed",
88
+ initialExpandedPaths: Array.isArray(v) ? v.flatMap((e) => N.pathOf.get(e) ?? []) : void 0,
89
+ initialSelectedPaths: (p ?? oe ?? []).flatMap((e) => N.pathOf.get(e) ?? []),
86
90
  search: !1,
87
91
  fileTreeSearchMode: "hide-non-matches",
88
- flattenEmptyDirectories: !!x,
89
- density: w,
90
- icons: oe(F, S),
91
- gitStatus: v(F, C),
92
+ flattenEmptyDirectories: !!S,
93
+ density: T,
94
+ icons: se(N, C),
95
+ gitStatus: y(N, w),
92
96
  onSelectionChange: (e) => {
93
- let t = L(e).map((e) => e.id);
94
- z.current || JSON.stringify(t) === B.current || (B.current = null, I.current.onSelectionChange?.(t), I.current.selectedIds && setTimeout(() => de(I.current.selectedIds ?? [], I.current.index, !1)));
97
+ let t = F(e).map((e) => e.id);
98
+ L.current || JSON.stringify(t) === R.current || (R.current = null, P.current.onSelectionChange?.(t), P.current.selectedIds && setTimeout(() => ve(P.current.selectedIds ?? [], P.current.index, !1)));
95
99
  },
96
100
  renderRowDecoration: ({ item: e }) => {
97
- let t = I.current.index.byPath.get(e.path);
101
+ let t = P.current.index.byPath.get(e.path);
98
102
  return t?.detail ? {
99
103
  text: t.detail,
100
104
  ...t.detailTitle ? { title: t.detailTitle } : {}
101
105
  } : null;
102
106
  },
103
107
  renaming: {
104
- canRename: ({ path: e }) => !!I.current.onRename && I.current.index.byPath.get(e)?.id === he.current,
108
+ canRename: ({ path: e }) => !!P.current.onRename && P.current.index.byPath.get(e)?.id === Se.current,
105
109
  onRename: ({ sourcePath: e, destinationPath: t }) => {
106
- let n = I.current.index.byPath.get(e), r = t.replace(/\/$/, "").split("/").at(-1)?.replaceAll(f, "").replaceAll(re, "/").trim();
107
- n && r && r !== n.name && I.current.onRename?.(n, r), W(), J();
110
+ let n = P.current.index.byPath.get(e), r = t.replace(/\/$/, "").split("/").at(-1)?.replaceAll(re, "").replaceAll(m, "/").trim();
111
+ n && r && r !== n.name && P.current.onRename?.(n, r), V(), G();
108
112
  },
109
113
  onError: () => {
110
- W(), J();
114
+ V(), G();
111
115
  }
112
116
  },
113
117
  dragAndDrop: {
114
- canDrag: (e) => !!I.current.canDrag?.(L(e)),
118
+ canDrag: (e) => !!P.current.canDrag?.(F(e)),
115
119
  canDrop: ({ draggedPaths: e, target: t }) => {
116
- let { onMove: n, canMove: r } = I.current;
117
- return !!n && (r?.(L(e), R(t.directoryPath)) ?? !0);
120
+ let { onMove: n, canMove: r } = P.current;
121
+ return !!n && (r?.(F(e), I(t.directoryPath)) ?? !0);
118
122
  },
119
123
  onDropComplete: ({ draggedPaths: e, target: t }) => {
120
- I.current.onMove?.(L(e), R(t.directoryPath)), W();
124
+ P.current.onMove?.(F(e), I(t.directoryPath)), V();
121
125
  }
122
126
  }
123
- }), H = o(F);
124
- function U(e) {
125
- let t = H.current, n = [...t.byPath].filter(([e, t]) => t.children && V.getItem(e)?.isExpanded()).map(([, e]) => e.id), r = V.getSelectedPaths().flatMap((e) => t.byPath.get(e)?.id ?? []), i = t.byPath.get(V.getFocusedPath() ?? "")?.id, a = V.getFileTreeContainer(), o = !!a && (document.activeElement === a || a.contains(document.activeElement));
126
- H.current = e, z.current = !0;
127
+ }), B = s(N);
128
+ function he(e) {
129
+ let t = B.current, n = [...t.byPath].filter(([e, t]) => t.children && z.getItem(e)?.isExpanded()).map(([, e]) => e.id), r = z.getSelectedPaths().flatMap((e) => t.byPath.get(e)?.id ?? []), i = t.byPath.get(z.getFocusedPath() ?? "")?.id, a = z.getFileTreeContainer(), o = !!a && (document.activeElement === a || a.contains(document.activeElement));
130
+ B.current = e, L.current = !0;
127
131
  try {
128
- V.resetPaths({
129
- preparedInput: ae(e.paths, u),
132
+ z.resetPaths({
133
+ preparedInput: ae(e.paths, f),
130
134
  initialExpandedPaths: n.flatMap((t) => e.pathOf.get(t) ?? [])
131
135
  });
132
- let t = I.current.selectedIds ?? r;
136
+ let t = P.current.selectedIds ?? r;
133
137
  for (let n of t) {
134
138
  let t = e.pathOf.get(n);
135
- t && V.getItem(t)?.select();
139
+ t && z.getItem(t)?.select();
136
140
  }
137
- B.current = JSON.stringify(t.filter((t) => e.pathOf.has(t))), V.setGitStatus(v(e, I.current.gitStatus));
141
+ R.current = JSON.stringify(t.filter((t) => e.pathOf.has(t))), z.setGitStatus(y(e, P.current.gitStatus));
138
142
  let a = i ? e.pathOf.get(i) : void 0;
139
- o && a && V.focusPath(a);
143
+ o && a && z.focusPath(a);
140
144
  } finally {
141
- z.current = !1;
145
+ L.current = !1;
142
146
  }
143
147
  }
144
- function W() {
145
- z.current = !0, setTimeout(() => {
146
- z.current = !1, U(I.current.index);
148
+ function V() {
149
+ L.current = !0, setTimeout(() => {
150
+ L.current = !1, he(P.current.index);
147
151
  });
148
152
  }
149
- i(() => {
150
- F !== H.current && U(F);
151
- }, [F]);
152
- let G = a(() => JSON.stringify([S, [...F.icons]]), [S, F]), le = o(G);
153
- i(() => {
154
- G !== le.current && V.setIcons(oe(F, S));
155
- }, [G]);
156
- let K = JSON.stringify(C ?? null), ue = o(K);
157
- i(() => {
158
- K !== ue.current && (ue.current = K, V.setGitStatus(v(H.current, C)));
159
- }, [K]);
160
- function de(e, t, n) {
153
+ o(() => {
154
+ N !== B.current && he(N);
155
+ }, [N]);
156
+ let H = ee(() => JSON.stringify([C, [...N.icons]]), [C, N]), ge = s(H);
157
+ o(() => {
158
+ H !== ge.current && z.setIcons(se(N, C));
159
+ }, [H]);
160
+ let U = JSON.stringify(w ?? null), _e = s(U);
161
+ o(() => {
162
+ U !== _e.current && (_e.current = U, z.setGitStatus(y(B.current, w)));
163
+ }, [U]);
164
+ function ve(e, t, n) {
161
165
  let r = new Set(e.flatMap((e) => t.pathOf.get(e) ?? []));
162
- z.current = !0;
166
+ L.current = !0;
163
167
  try {
164
- for (let e of V.getSelectedPaths()) r.has(e) || V.getItem(e)?.deselect();
165
- for (let e of r) V.getItem(e)?.isSelected() || V.getItem(e)?.select();
166
- B.current = JSON.stringify(e.filter((e) => t.pathOf.has(e)));
168
+ for (let e of z.getSelectedPaths()) r.has(e) || z.getItem(e)?.deselect();
169
+ for (let e of r) z.getItem(e)?.isSelected() || z.getItem(e)?.select();
170
+ R.current = JSON.stringify(e.filter((e) => t.pathOf.has(e)));
167
171
  } finally {
168
- z.current = !1;
172
+ L.current = !1;
169
173
  }
170
174
  let i = [...r][0];
171
- n && i && V.scrollToPath(i, {
175
+ n && i && z.scrollToPath(i, {
172
176
  focus: !1,
173
177
  offset: "nearest"
174
178
  });
175
179
  }
176
- let fe = d ? JSON.stringify(d) : null;
177
- i(() => {
178
- d && de(d, F, !0);
179
- }, [fe, F]);
180
- let pe = y ? JSON.stringify(y) : null, me = o(null);
181
- i(() => {
182
- let e = [...me.current !== V && Array.isArray(_) ? _ : [], ...y ?? []];
183
- me.current = V;
180
+ let ye = p ? JSON.stringify(p) : null;
181
+ o(() => {
182
+ p && ve(p, N, !0);
183
+ }, [ye, N]);
184
+ let be = b ? JSON.stringify(b) : null, xe = s(null);
185
+ o(() => {
186
+ let e = [...xe.current !== z && Array.isArray(v) ? v : [], ...b ?? []];
187
+ xe.current = z;
184
188
  for (let t of e) {
185
- let e = F.pathOf.get(t);
189
+ let e = N.pathOf.get(t);
186
190
  if (!e) continue;
187
191
  let n = e.replace(/\/$/, "").split("/");
188
192
  for (let e = 1; e <= n.length; e++) {
189
- let t = V.getItem(`${n.slice(0, e).join("/")}/`);
193
+ let t = z.getItem(`${n.slice(0, e).join("/")}/`);
190
194
  t?.isDirectory() && t.expand();
191
195
  }
192
196
  }
193
197
  }, [
194
- pe,
195
- F,
196
- V
198
+ be,
199
+ N,
200
+ z
197
201
  ]);
198
- let he = o(E ?? null);
199
- he.current = E ?? null;
200
- let q = o(!1);
201
- function J() {
202
- q.current || (q.current = !0, I.current.onRenameEnd?.());
202
+ let Se = s(O ?? null);
203
+ Se.current = O ?? null;
204
+ let W = s(!1);
205
+ function G() {
206
+ W.current || (W.current = !0, P.current.onRenameEnd?.());
203
207
  }
204
- i(() => {
205
- let e = E ? F.pathOf.get(E) : void 0;
208
+ o(() => {
209
+ let e = O ? N.pathOf.get(O) : void 0;
206
210
  if (!e) return;
207
- q.current = !1;
208
- let t = V.getFileTreeContainer(), n = new MutationObserver(() => {
209
- t?.shadowRoot?.querySelector("[data-item-path] input") || (n.disconnect(), J());
211
+ W.current = !1;
212
+ let t = z.getFileTreeContainer(), n = new MutationObserver(() => {
213
+ t?.shadowRoot?.querySelector("[data-item-path] input") || (n.disconnect(), G());
210
214
  }), r = 0, i = () => {
211
215
  if (document.querySelector("[data-slot=dropdown-menu]")) {
212
216
  r = requestAnimationFrame(i);
213
217
  return;
214
218
  }
215
219
  r = requestAnimationFrame(() => {
216
- if (!V.startRenaming(e)) {
217
- J();
220
+ if (!z.startRenaming(e)) {
221
+ G();
218
222
  return;
219
223
  }
220
224
  t?.shadowRoot && n.observe(t.shadowRoot, {
@@ -226,21 +230,21 @@ function _({ "aria-label": t, items: s, sort: u, selectedIds: d, defaultSelected
226
230
  return i(), () => {
227
231
  cancelAnimationFrame(r), n.disconnect();
228
232
  };
229
- }, [E]);
230
- let Y = o(null), X = o(null), Z = () => {
231
- if (!Y.current) return;
232
- let e = H.current.dimmed.map((e) => `[data-item-path=${se(e)}]`).join(","), t = X.current;
233
- Y.current.textContent = [
233
+ }, [O]);
234
+ let K = s(null), q = s(null), J = () => {
235
+ if (!K.current) return;
236
+ let e = B.current.dimmed.map((e) => `[data-item-path=${le(e)}]`).join(","), t = q.current;
237
+ K.current.textContent = [
234
238
  "[data-file-tree-virtualized-wrapper]{flex:1 1 auto;min-height:0}",
235
239
  "[data-item-section=decoration]{color:color-mix(in oklab,var(--trees-fg) 72%,transparent)}",
236
240
  e ? `${e}{opacity:.6}` : "",
237
241
  t === "" ? "[role=tree]{box-shadow:inset 0 0 0 2px var(--trees-accent);border-radius:var(--trees-border-radius)}" : "",
238
- t ? `[data-item-path=${se(t)}]{background:var(--trees-bg-muted);box-shadow:inset 0 0 0 2px var(--trees-accent)}` : ""
242
+ t ? `[data-item-path=${le(t)}]{background:var(--trees-bg-muted);box-shadow:inset 0 0 0 2px var(--trees-accent)}` : ""
239
243
  ].join("");
240
244
  };
241
- i(() => {
245
+ o(() => {
242
246
  let e, n = 0, r = () => {
243
- let i = V.getFileTreeContainer()?.shadowRoot;
247
+ let i = z.getFileTreeContainer()?.shadowRoot;
244
248
  if (!i) {
245
249
  n = requestAnimationFrame(r);
246
250
  return;
@@ -249,7 +253,7 @@ function _({ "aria-label": t, items: s, sort: u, selectedIds: d, defaultSelected
249
253
  let e = i.querySelector("[role=tree]");
250
254
  e && e.getAttribute("aria-label") !== t && e.setAttribute("aria-label", t);
251
255
  };
252
- a(), Y.current || (Y.current = document.createElement("style"), Y.current.dataset.blTree = ""), Y.current.parentNode !== i && i.appendChild(Y.current), Z(), e = new MutationObserver(a), e.observe(i, {
256
+ a(), K.current || (K.current = document.createElement("style"), K.current.dataset.blTree = ""), K.current.parentNode !== i && i.appendChild(K.current), J(), e = new MutationObserver(a), e.observe(i, {
253
257
  childList: !0,
254
258
  subtree: !0
255
259
  });
@@ -257,84 +261,107 @@ function _({ "aria-label": t, items: s, sort: u, selectedIds: d, defaultSelected
257
261
  return r(), () => {
258
262
  cancelAnimationFrame(n), e?.disconnect();
259
263
  };
260
- }, [V, t]), i(Z, [F]);
261
- let Q = o(!1), $ = (e) => {
262
- X.current !== e && (X.current = e, Z());
263
- }, ge = (e) => {
264
- let t = g(e);
264
+ }, [z, t]), o(J, [N]);
265
+ let Y = s(!1), X = (e) => {
266
+ q.current !== e && (q.current = e, J());
267
+ }, Ce = (e) => {
268
+ let t = _(e);
265
269
  return t ? t.endsWith("/") ? t : t.includes("/") ? t.slice(0, t.lastIndexOf("/", t.length - 1) + 1) : "" : "";
266
- }, _e = {
270
+ }, we = {
267
271
  onDragStart: (e) => {
268
- let t = g(e.nativeEvent);
272
+ let t = _(e.nativeEvent);
269
273
  if (!t) return;
270
- Q.current = !0;
271
- let n = V.getSelectedPaths(), r = L(n.includes(t) ? n : [t]);
272
- A?.(r, e.dataTransfer);
274
+ Y.current = !0;
275
+ let n = z.getSelectedPaths(), r = F(n.includes(t) ? n : [t]);
276
+ ue?.(r, e.dataTransfer);
273
277
  },
274
278
  onDragEnd: () => {
275
- Q.current = !1;
279
+ Y.current = !1;
276
280
  },
277
281
  onDragOver: (e) => {
278
- if (Q.current || !M) return;
279
- let t = ge(e.nativeEvent);
280
- if (!M.accepts([...e.dataTransfer.types], R(t || null))) {
281
- $(null);
282
+ if (Y.current || !M) return;
283
+ let t = Ce(e.nativeEvent);
284
+ if (!M.accepts([...e.dataTransfer.types], I(t || null))) {
285
+ X(null);
282
286
  return;
283
287
  }
284
- e.preventDefault(), e.dataTransfer.dropEffect = "copy", $(t);
288
+ e.preventDefault(), e.dataTransfer.dropEffect = "copy", X(t);
285
289
  },
286
290
  onDragLeave: (e) => {
287
- e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget) || $(null);
291
+ e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget) || X(null);
288
292
  },
289
293
  onDrop: (e) => {
290
- if ($(null), Q.current || !M) return;
291
- let t = R(ge(e.nativeEvent) || null);
294
+ if (X(null), Y.current || !M) return;
295
+ let t = I(Ce(e.nativeEvent) || null);
292
296
  M.accepts([...e.dataTransfer.types], t) && (e.preventDefault(), M.onDrop(e.dataTransfer, t));
293
297
  }
294
- }, [ve, ye] = ee(null), be = (e) => {
295
- let t = R(g(e) ?? V.getFocusedPath());
296
- return ye(t), !!t;
297
- }, xe = (e) => {
298
- let t = R(g(e));
299
- !t || !h || (e.preventDefault(), h(t));
300
- }, Se = /* @__PURE__ */ c(te, {
301
- model: V,
298
+ }, [Te, Ee] = c(null), De = (e) => {
299
+ let t = I(_(e) ?? z.getFocusedPath());
300
+ return Ee(t), !!t;
301
+ }, Oe = (e) => {
302
+ let t = I(_(e));
303
+ !t || !g || (e.preventDefault(), g(t));
304
+ }, [ke, Ae] = c(null), Z = s(null), Q = r({ isDisabled: !D }), je = (e) => {
305
+ if (!D || e.pointerType === "touch") return;
306
+ let t = ce(e.nativeEvent), n = t && I(t.dataset.itemPath ?? null);
307
+ if (!t || !n || !D(n)) {
308
+ Z.current = null, Q.triggerProps.onPointerLeave(e);
309
+ return;
310
+ }
311
+ t !== Z.current && (Z.current = t, Q.close(), Ae(n), Q.triggerProps.onPointerEnter(e));
312
+ }, $ = /* @__PURE__ */ u(te, {
313
+ model: z,
302
314
  "data-slot": "tree",
303
315
  className: "flex min-h-0 flex-1 flex-col",
304
- ..._e,
305
- onDoubleClick: (e) => xe(e.nativeEvent),
316
+ ...we,
317
+ onPointerMove: D ? je : void 0,
318
+ onPointerDownCapture: D ? Q.triggerProps.onPointerDown : void 0,
319
+ onPointerLeave: D ? (e) => {
320
+ Z.current = null, Q.triggerProps.onPointerLeave(e);
321
+ } : void 0,
322
+ onDoubleClick: (e) => Oe(e.nativeEvent),
306
323
  onKeyDown: (e) => {
307
- e.key === "Enter" && !e.nativeEvent.composedPath().some((e) => e instanceof HTMLInputElement) && xe(e.nativeEvent);
324
+ e.key === "Enter" && !e.nativeEvent.composedPath().some((e) => e instanceof HTMLInputElement) && Oe(e.nativeEvent);
308
325
  }
309
- }), Ce = b ? /* @__PURE__ */ c(n, {
326
+ }), Me = x ? /* @__PURE__ */ u(i, {
310
327
  "aria-label": `Search ${t}`,
311
328
  placeholder: "Search",
312
329
  className: "mb-1.5 shrink-0",
313
- onChange: (e) => V.setSearch(e || null)
330
+ onChange: (e) => z.setSearch(e || null)
331
+ }) : null, Ne = D && ke ? /* @__PURE__ */ u(n, {
332
+ ...Q.cardProps,
333
+ triggerRef: Z,
334
+ placement: "end top",
335
+ children: D(ke)
314
336
  }) : null;
315
- return T ? /* @__PURE__ */ l(r, {
337
+ return E ? /* @__PURE__ */ d(a, {
316
338
  "data-slot": "tree-root",
317
- ...P,
318
- className: e("flex min-h-0 flex-col", N),
339
+ ...me,
340
+ className: e("flex min-h-0 flex-col", pe),
319
341
  onContextMenu: (e) => {
320
- be(e.nativeEvent) || e.preventDefault();
342
+ De(e.nativeEvent) || e.preventDefault();
321
343
  },
322
344
  onKeyDown: (e) => {
323
- (e.key === "ContextMenu" || e.shiftKey && e.key === "F10") && !be(e.nativeEvent) && e.preventDefault();
345
+ (e.key === "ContextMenu" || e.shiftKey && e.key === "F10") && !De(e.nativeEvent) && e.preventDefault();
324
346
  },
325
347
  children: [
326
- Ce,
327
- Se,
328
- ve ? T(ve) : null
348
+ Me,
349
+ $,
350
+ Te ? E(Te) : null,
351
+ Ne
329
352
  ]
330
- }) : /* @__PURE__ */ l("div", {
353
+ }) : /* @__PURE__ */ d("div", {
331
354
  "data-slot": "tree-root",
332
- ...P,
333
- className: e("flex min-h-0 flex-col", N),
334
- children: [Ce, Se]
355
+ ...me,
356
+ className: e("flex min-h-0 flex-col", pe),
357
+ children: [
358
+ Me,
359
+ $,
360
+ Ne
361
+ ]
335
362
  });
336
363
  }
337
- function v(e, t) {
364
+ function y(e, t) {
338
365
  return t ? Object.entries(t).flatMap(([t, n]) => {
339
366
  let r = e.pathOf.get(t);
340
367
  return r ? [{
@@ -343,91 +370,91 @@ function v(e, t) {
343
370
  }] : [];
344
371
  }) : void 0;
345
372
  }
346
- function y({ open: t, size: n = 18, className: r }) {
347
- return /* @__PURE__ */ l("svg", {
373
+ function b({ open: t, size: n = 18, className: r }) {
374
+ return /* @__PURE__ */ d("svg", {
348
375
  "aria-hidden": "true",
349
376
  width: n,
350
377
  height: n,
351
378
  viewBox: "0 0 20 20",
352
379
  "data-slot": "tree-folder-icon",
353
380
  className: e("text-link", r),
354
- children: [/* @__PURE__ */ c("path", {
381
+ children: [/* @__PURE__ */ u("path", {
355
382
  d: "M2 5.5A1.5 1.5 0 0 1 3.5 4h3.9l1.6 1.6H16.5A1.5 1.5 0 0 1 18 7.1V14.5A1.5 1.5 0 0 1 16.5 16h-13A1.5 1.5 0 0 1 2 14.5Z",
356
383
  fill: "currentColor",
357
384
  opacity: ".55"
358
- }), t ? /* @__PURE__ */ c("path", {
385
+ }), t ? /* @__PURE__ */ u("path", {
359
386
  d: "M3.9 8.2A1.4 1.4 0 0 1 5.2 7.3h12.1a.9.9 0 0 1 .85 1.2l-2.2 6.6a1.4 1.4 0 0 1-1.3.9H3.3a.9.9 0 0 1-.85-1.2Z",
360
387
  fill: "currentColor"
361
- }) : /* @__PURE__ */ c("path", {
388
+ }) : /* @__PURE__ */ u("path", {
362
389
  d: "M2 8.1A1.1 1.1 0 0 1 3.1 7h13.8A1.1 1.1 0 0 1 18 8.1v6.4a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 2 14.5Z",
363
390
  fill: "currentColor"
364
391
  })]
365
392
  });
366
393
  }
367
- var b = "#3178C6", x = "#D4A500", S = "#C58B00", C = "#8E5CD9", w = "#6E7781", T = "#E3912C", E = "#E4572E", D = "#E8A33D", O = "#2EA36B", k = "#CB4B6F", A = {
394
+ var x = "#3178C6", S = "#D4A500", C = "#C58B00", w = "#8E5CD9", T = "#6E7781", E = "#E3912C", D = "#E4572E", O = "#E8A33D", k = "#2EA36B", A = "#CB4B6F", j = {
368
395
  ts: {
369
396
  label: "TS",
370
- color: b
397
+ color: x
371
398
  },
372
399
  tsx: {
373
400
  label: "TSX",
374
- color: b
401
+ color: x
375
402
  },
376
403
  js: {
377
404
  label: "JS",
378
- color: x
405
+ color: S
379
406
  },
380
407
  jsx: {
381
408
  label: "JSX",
382
- color: x
409
+ color: S
383
410
  },
384
411
  mjs: {
385
412
  label: "JS",
386
- color: x
413
+ color: S
387
414
  },
388
415
  json: {
389
416
  label: "{ }",
390
- color: S
417
+ color: C
391
418
  },
392
419
  css: {
393
420
  label: "CSS",
394
- color: C
421
+ color: w
395
422
  },
396
423
  md: {
397
424
  label: "MD",
398
- color: w
425
+ color: T
399
426
  },
400
427
  mdx: {
401
428
  label: "MDX",
402
- color: T
429
+ color: E
403
430
  },
404
431
  stl: {
405
432
  label: "STL",
406
- color: C
433
+ color: w
407
434
  },
408
435
  html: {
409
436
  label: "HTML",
410
- color: E
437
+ color: D
411
438
  },
412
439
  svg: {
413
440
  label: "SVG",
414
- color: D
441
+ color: O
415
442
  },
416
443
  png: {
417
444
  label: "PNG",
418
- color: O
445
+ color: k
419
446
  },
420
447
  jpg: {
421
448
  label: "JPG",
422
- color: O
449
+ color: k
423
450
  },
424
451
  yml: {
425
452
  label: "YML",
426
- color: k
453
+ color: A
427
454
  },
428
455
  yaml: {
429
456
  label: "YML",
430
- color: k
457
+ color: A
431
458
  },
432
459
  sh: {
433
460
  label: "SH",
@@ -435,12 +462,12 @@ var b = "#3178C6", x = "#D4A500", S = "#C58B00", C = "#8E5CD9", w = "#6E7781", T
435
462
  },
436
463
  txt: {
437
464
  label: "TXT",
438
- color: w
465
+ color: T
439
466
  }
440
467
  };
441
- function j({ name: e, size: t = 18, className: n }) {
442
- let r = /\.([a-z0-9]+)$/i.exec(e)?.[1]?.toLowerCase() ?? "", i = A[r];
443
- return /* @__PURE__ */ l("svg", {
468
+ function ue({ name: e, size: t = 18, className: n }) {
469
+ let r = /\.([a-z0-9]+)$/i.exec(e)?.[1]?.toLowerCase() ?? "", i = j[r];
470
+ return /* @__PURE__ */ d("svg", {
444
471
  "aria-hidden": "true",
445
472
  width: t,
446
473
  height: t,
@@ -449,28 +476,28 @@ function j({ name: e, size: t = 18, className: n }) {
449
476
  "data-ext": r || void 0,
450
477
  className: n,
451
478
  children: [
452
- /* @__PURE__ */ c("path", {
479
+ /* @__PURE__ */ u("path", {
453
480
  d: "M5 2h6.6L16 6.4V16.5A1.5 1.5 0 0 1 14.5 18h-9A1.5 1.5 0 0 1 4 16.5v-13A1.5 1.5 0 0 1 5.5 2Z",
454
481
  fill: "var(--card, white)",
455
482
  stroke: "currentColor",
456
483
  strokeOpacity: ".35",
457
484
  strokeWidth: "1"
458
485
  }),
459
- /* @__PURE__ */ c("path", {
486
+ /* @__PURE__ */ u("path", {
460
487
  d: "M11.5 2.2V5.4a1 1 0 0 0 1 1h3.3",
461
488
  fill: "none",
462
489
  stroke: "currentColor",
463
490
  strokeOpacity: ".35",
464
491
  strokeWidth: "1"
465
492
  }),
466
- i ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("rect", {
493
+ i ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("rect", {
467
494
  x: "1",
468
495
  y: "9",
469
496
  width: i.label.length > 2 ? 16 : 13,
470
497
  height: "8",
471
498
  rx: "2",
472
499
  fill: i.color
473
- }), /* @__PURE__ */ c("text", {
500
+ }), /* @__PURE__ */ u("text", {
474
501
  x: i.label.length > 2 ? 9 : 7.5,
475
502
  y: "15.1",
476
503
  textAnchor: "middle",
@@ -480,7 +507,7 @@ function j({ name: e, size: t = 18, className: n }) {
480
507
  fontFamily: "ui-sans-serif, system-ui, sans-serif",
481
508
  fill: "white",
482
509
  children: i.label
483
- })] }) : /* @__PURE__ */ c("path", {
510
+ })] }) : /* @__PURE__ */ u("path", {
484
511
  d: "M7 10h6M7 12.5h6M7 15h4",
485
512
  stroke: "currentColor",
486
513
  strokeOpacity: ".4",
@@ -491,4 +518,4 @@ function j({ name: e, size: t = 18, className: n }) {
491
518
  });
492
519
  }
493
520
  //#endregion
494
- export { _ as Tree, j as TreeFileIcon, y as TreeFolderIcon };
521
+ export { v as Tree, ue as TreeFileIcon, b as TreeFolderIcon };