@brett_lamy/ui 5.10.0 → 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.
- package/dist/components/avatar.d.ts +4 -1
- package/dist/components/avatar.d.ts.map +1 -1
- package/dist/components/avatar.js +55 -47
- package/dist/components/canvas.d.ts +18 -0
- package/dist/components/canvas.d.ts.map +1 -1
- package/dist/components/canvas.js +79 -11
- package/dist/components/command-menu.js +1 -1
- package/dist/components/floating-chat.d.ts +1 -1
- package/dist/components/floating-sheet.d.ts +1 -1
- package/dist/components/hover-card.d.ts +69 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +164 -0
- package/dist/components/list.d.ts +3 -0
- package/dist/components/list.d.ts.map +1 -1
- package/dist/components/list.js +265 -250
- package/dist/components/markdown-view.d.ts +3 -1
- package/dist/components/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view.js +12 -11
- package/dist/components/open-code.d.ts +31 -0
- package/dist/components/open-code.d.ts.map +1 -0
- package/dist/components/open-code.js +253 -0
- package/dist/components/replay-preview.d.ts +2 -2
- package/dist/components/replay-preview.d.ts.map +1 -1
- package/dist/components/replay-preview.js +3 -3
- package/dist/components/sql-console.js +1 -1
- package/dist/components/tree.d.ts +4 -1
- package/dist/components/tree.d.ts.map +1 -1
- package/dist/components/tree.js +229 -202
- package/dist/components/tui-preview.d.ts +3 -0
- package/dist/components/tui-preview.d.ts.map +1 -0
- package/dist/components/tui-preview.js +3 -0
- package/dist/components/workspace.d.ts +11 -0
- package/dist/components/workspace.d.ts.map +1 -0
- package/dist/components/workspace.js +74 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +17 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +163 -156
- package/dist/lib/canvas-math.d.ts +1 -1
- package/dist/lib/canvas-math.d.ts.map +1 -1
- package/dist/lib/canvas-math.js +1 -1
- package/dist/lib/open-code-browser-agent.d.ts +7 -0
- package/dist/lib/open-code-browser-agent.d.ts.map +1 -0
- package/dist/lib/open-code-browser-agent.js +161 -0
- package/dist/lib/open-code-browser.d.ts +17 -0
- package/dist/lib/open-code-browser.d.ts.map +1 -0
- package/dist/lib/open-code-browser.js +252 -0
- package/dist/lib/open-code-host.d.ts +182 -0
- package/dist/lib/open-code-host.d.ts.map +1 -0
- package/dist/lib/open-code-host.js +118 -0
- package/dist/lib/open-code-keychain.d.ts +11 -0
- package/dist/lib/open-code-keychain.d.ts.map +1 -0
- package/dist/lib/open-code-keychain.js +19 -0
- package/dist/lib/open-code-preview.d.ts +16 -0
- package/dist/lib/open-code-preview.d.ts.map +1 -0
- package/dist/lib/open-code-preview.js +112 -0
- package/dist/lib/tailscale-connect.d.ts.map +1 -1
- package/dist/lib/tailscale-connect.js +97 -62
- package/dist/lib/tailscale-policy.d.ts +11 -2
- package/dist/lib/tailscale-policy.d.ts.map +1 -1
- package/dist/lib/tailscale-policy.js +27 -18
- package/dist/lib/tailscale-router/bridge.d.ts +7 -2
- package/dist/lib/tailscale-router/bridge.d.ts.map +1 -1
- package/dist/lib/tailscale-router/bridge.js +64 -57
- package/dist/lib/theme.d.ts.map +1 -1
- package/dist/lib/theme.js +8 -5
- package/dist/opencode.d.ts +7 -0
- package/dist/opencode.d.ts.map +1 -0
- package/dist/opencode.js +6 -0
- package/dist/tailscale-sw.js +237 -12
- package/package.json +21 -3
package/dist/components/tree.js
CHANGED
|
@@ -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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
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("/",
|
|
23
|
-
for (; i.has(e);) 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 ?
|
|
32
|
-
function
|
|
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
|
|
38
|
-
function
|
|
39
|
-
let r = `<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0" style="position:absolute" aria-hidden="true"><symbol id="${
|
|
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(
|
|
50
|
-
byFileName: Object.fromEntries([...e.icons].map(([e, t]) => [e, i(
|
|
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
|
|
54
|
-
for (let t of e.composedPath()) if (t instanceof HTMLElement && t.dataset.itemPath) return t
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
71
|
-
index:
|
|
72
|
-
selectedIds:
|
|
73
|
-
gitStatus:
|
|
74
|
-
onSelectionChange:
|
|
75
|
-
onRename:
|
|
76
|
-
onRenameEnd:
|
|
77
|
-
canDrag:
|
|
78
|
-
onMove:
|
|
79
|
-
canMove:
|
|
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
|
|
82
|
-
preparedInput: ae(
|
|
83
|
-
initialExpansion:
|
|
84
|
-
initialExpandedPaths: Array.isArray(
|
|
85
|
-
initialSelectedPaths: (
|
|
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: !!
|
|
89
|
-
density:
|
|
90
|
-
icons:
|
|
91
|
-
gitStatus:
|
|
92
|
+
flattenEmptyDirectories: !!S,
|
|
93
|
+
density: T,
|
|
94
|
+
icons: se(N, C),
|
|
95
|
+
gitStatus: y(N, w),
|
|
92
96
|
onSelectionChange: (e) => {
|
|
93
|
-
let t =
|
|
94
|
-
|
|
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 =
|
|
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 }) => !!
|
|
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 =
|
|
107
|
-
n && r && r !== n.name &&
|
|
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
|
-
|
|
114
|
+
V(), G();
|
|
111
115
|
}
|
|
112
116
|
},
|
|
113
117
|
dragAndDrop: {
|
|
114
|
-
canDrag: (e) => !!
|
|
118
|
+
canDrag: (e) => !!P.current.canDrag?.(F(e)),
|
|
115
119
|
canDrop: ({ draggedPaths: e, target: t }) => {
|
|
116
|
-
let { onMove: n, canMove: r } =
|
|
117
|
-
return !!n && (r?.(
|
|
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
|
-
|
|
124
|
+
P.current.onMove?.(F(e), I(t.directoryPath)), V();
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
|
-
}),
|
|
124
|
-
function
|
|
125
|
-
let t =
|
|
126
|
-
|
|
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
|
-
|
|
129
|
-
preparedInput: ae(e.paths,
|
|
132
|
+
z.resetPaths({
|
|
133
|
+
preparedInput: ae(e.paths, f),
|
|
130
134
|
initialExpandedPaths: n.flatMap((t) => e.pathOf.get(t) ?? [])
|
|
131
135
|
});
|
|
132
|
-
let t =
|
|
136
|
+
let t = P.current.selectedIds ?? r;
|
|
133
137
|
for (let n of t) {
|
|
134
138
|
let t = e.pathOf.get(n);
|
|
135
|
-
t &&
|
|
139
|
+
t && z.getItem(t)?.select();
|
|
136
140
|
}
|
|
137
|
-
|
|
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 &&
|
|
143
|
+
o && a && z.focusPath(a);
|
|
140
144
|
} finally {
|
|
141
|
-
|
|
145
|
+
L.current = !1;
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
|
-
function
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
function V() {
|
|
149
|
+
L.current = !0, setTimeout(() => {
|
|
150
|
+
L.current = !1, he(P.current.index);
|
|
147
151
|
});
|
|
148
152
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}, [
|
|
152
|
-
let
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}, [
|
|
156
|
-
let
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}, [
|
|
160
|
-
function
|
|
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
|
-
|
|
166
|
+
L.current = !0;
|
|
163
167
|
try {
|
|
164
|
-
for (let e of
|
|
165
|
-
for (let e of r)
|
|
166
|
-
|
|
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
|
-
|
|
172
|
+
L.current = !1;
|
|
169
173
|
}
|
|
170
174
|
let i = [...r][0];
|
|
171
|
-
n && i &&
|
|
175
|
+
n && i && z.scrollToPath(i, {
|
|
172
176
|
focus: !1,
|
|
173
177
|
offset: "nearest"
|
|
174
178
|
});
|
|
175
179
|
}
|
|
176
|
-
let
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}, [
|
|
180
|
-
let
|
|
181
|
-
|
|
182
|
-
let e = [...
|
|
183
|
-
|
|
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 =
|
|
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 =
|
|
193
|
+
let t = z.getItem(`${n.slice(0, e).join("/")}/`);
|
|
190
194
|
t?.isDirectory() && t.expand();
|
|
191
195
|
}
|
|
192
196
|
}
|
|
193
197
|
}, [
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
198
|
+
be,
|
|
199
|
+
N,
|
|
200
|
+
z
|
|
197
201
|
]);
|
|
198
|
-
let
|
|
199
|
-
|
|
200
|
-
let
|
|
201
|
-
function
|
|
202
|
-
|
|
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
|
-
|
|
205
|
-
let e =
|
|
208
|
+
o(() => {
|
|
209
|
+
let e = O ? N.pathOf.get(O) : void 0;
|
|
206
210
|
if (!e) return;
|
|
207
|
-
|
|
208
|
-
let t =
|
|
209
|
-
t?.shadowRoot?.querySelector("[data-item-path] input") || (n.disconnect(),
|
|
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 (!
|
|
217
|
-
|
|
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
|
-
}, [
|
|
230
|
-
let
|
|
231
|
-
if (!
|
|
232
|
-
let e =
|
|
233
|
-
|
|
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=${
|
|
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
|
-
|
|
245
|
+
o(() => {
|
|
242
246
|
let e, n = 0, r = () => {
|
|
243
|
-
let i =
|
|
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(),
|
|
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
|
-
}, [
|
|
261
|
-
let
|
|
262
|
-
|
|
263
|
-
},
|
|
264
|
-
let t =
|
|
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
|
-
},
|
|
270
|
+
}, we = {
|
|
267
271
|
onDragStart: (e) => {
|
|
268
|
-
let t =
|
|
272
|
+
let t = _(e.nativeEvent);
|
|
269
273
|
if (!t) return;
|
|
270
|
-
|
|
271
|
-
let n =
|
|
272
|
-
|
|
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
|
-
|
|
279
|
+
Y.current = !1;
|
|
276
280
|
},
|
|
277
281
|
onDragOver: (e) => {
|
|
278
|
-
if (
|
|
279
|
-
let t =
|
|
280
|
-
if (!M.accepts([...e.dataTransfer.types],
|
|
281
|
-
|
|
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",
|
|
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) ||
|
|
291
|
+
e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget) || X(null);
|
|
288
292
|
},
|
|
289
293
|
onDrop: (e) => {
|
|
290
|
-
if (
|
|
291
|
-
let t =
|
|
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
|
-
}, [
|
|
295
|
-
let t =
|
|
296
|
-
return
|
|
297
|
-
},
|
|
298
|
-
let t =
|
|
299
|
-
!t || !
|
|
300
|
-
},
|
|
301
|
-
|
|
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
|
-
...
|
|
305
|
-
|
|
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) &&
|
|
324
|
+
e.key === "Enter" && !e.nativeEvent.composedPath().some((e) => e instanceof HTMLInputElement) && Oe(e.nativeEvent);
|
|
308
325
|
}
|
|
309
|
-
}),
|
|
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) =>
|
|
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
|
|
337
|
+
return E ? /* @__PURE__ */ d(a, {
|
|
316
338
|
"data-slot": "tree-root",
|
|
317
|
-
...
|
|
318
|
-
className: e("flex min-h-0 flex-col",
|
|
339
|
+
...me,
|
|
340
|
+
className: e("flex min-h-0 flex-col", pe),
|
|
319
341
|
onContextMenu: (e) => {
|
|
320
|
-
|
|
342
|
+
De(e.nativeEvent) || e.preventDefault();
|
|
321
343
|
},
|
|
322
344
|
onKeyDown: (e) => {
|
|
323
|
-
(e.key === "ContextMenu" || e.shiftKey && e.key === "F10") && !
|
|
345
|
+
(e.key === "ContextMenu" || e.shiftKey && e.key === "F10") && !De(e.nativeEvent) && e.preventDefault();
|
|
324
346
|
},
|
|
325
347
|
children: [
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
348
|
+
Me,
|
|
349
|
+
$,
|
|
350
|
+
Te ? E(Te) : null,
|
|
351
|
+
Ne
|
|
329
352
|
]
|
|
330
|
-
}) : /* @__PURE__ */
|
|
353
|
+
}) : /* @__PURE__ */ d("div", {
|
|
331
354
|
"data-slot": "tree-root",
|
|
332
|
-
...
|
|
333
|
-
className: e("flex min-h-0 flex-col",
|
|
334
|
-
children: [
|
|
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
|
|
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
|
|
347
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
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:
|
|
397
|
+
color: x
|
|
371
398
|
},
|
|
372
399
|
tsx: {
|
|
373
400
|
label: "TSX",
|
|
374
|
-
color:
|
|
401
|
+
color: x
|
|
375
402
|
},
|
|
376
403
|
js: {
|
|
377
404
|
label: "JS",
|
|
378
|
-
color:
|
|
405
|
+
color: S
|
|
379
406
|
},
|
|
380
407
|
jsx: {
|
|
381
408
|
label: "JSX",
|
|
382
|
-
color:
|
|
409
|
+
color: S
|
|
383
410
|
},
|
|
384
411
|
mjs: {
|
|
385
412
|
label: "JS",
|
|
386
|
-
color:
|
|
413
|
+
color: S
|
|
387
414
|
},
|
|
388
415
|
json: {
|
|
389
416
|
label: "{ }",
|
|
390
|
-
color:
|
|
417
|
+
color: C
|
|
391
418
|
},
|
|
392
419
|
css: {
|
|
393
420
|
label: "CSS",
|
|
394
|
-
color:
|
|
421
|
+
color: w
|
|
395
422
|
},
|
|
396
423
|
md: {
|
|
397
424
|
label: "MD",
|
|
398
|
-
color:
|
|
425
|
+
color: T
|
|
399
426
|
},
|
|
400
427
|
mdx: {
|
|
401
428
|
label: "MDX",
|
|
402
|
-
color:
|
|
429
|
+
color: E
|
|
403
430
|
},
|
|
404
431
|
stl: {
|
|
405
432
|
label: "STL",
|
|
406
|
-
color:
|
|
433
|
+
color: w
|
|
407
434
|
},
|
|
408
435
|
html: {
|
|
409
436
|
label: "HTML",
|
|
410
|
-
color:
|
|
437
|
+
color: D
|
|
411
438
|
},
|
|
412
439
|
svg: {
|
|
413
440
|
label: "SVG",
|
|
414
|
-
color:
|
|
441
|
+
color: O
|
|
415
442
|
},
|
|
416
443
|
png: {
|
|
417
444
|
label: "PNG",
|
|
418
|
-
color:
|
|
445
|
+
color: k
|
|
419
446
|
},
|
|
420
447
|
jpg: {
|
|
421
448
|
label: "JPG",
|
|
422
|
-
color:
|
|
449
|
+
color: k
|
|
423
450
|
},
|
|
424
451
|
yml: {
|
|
425
452
|
label: "YML",
|
|
426
|
-
color:
|
|
453
|
+
color: A
|
|
427
454
|
},
|
|
428
455
|
yaml: {
|
|
429
456
|
label: "YML",
|
|
430
|
-
color:
|
|
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:
|
|
465
|
+
color: T
|
|
439
466
|
}
|
|
440
467
|
};
|
|
441
|
-
function
|
|
442
|
-
let r = /\.([a-z0-9]+)$/i.exec(e)?.[1]?.toLowerCase() ?? "", i =
|
|
443
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
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__ */
|
|
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__ */
|
|
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 {
|
|
521
|
+
export { v as Tree, ue as TreeFileIcon, b as TreeFolderIcon };
|