@floegence/floe-webapp-core 0.35.33 → 0.35.34
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/file-browser/DirectoryTree.js +74 -80
- package/dist/components/file-browser/FileIcons.d.ts +10 -2
- package/dist/components/file-browser/FileIcons.js +289 -181
- package/dist/components/file-browser/index.d.ts +2 -2
- package/dist/components/file-browser/types.d.ts +8 -0
- package/dist/components/ui/picker/PickerBase.js +90 -96
- package/dist/file-browser.js +35 -31
- package/dist/full.js +411 -407
- package/package.json +1 -1
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createMemo as I, For as Q, untrack as W, createSignal as Z, Show as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { insert as l, createComponent as s, effect as v, className as D, template as m, setAttribute as X, spread as Y, mergeProps as q, memo as z, setStyleProperty as J, delegateEvents as K } from "solid-js/web";
|
|
2
|
+
import { createMemo as I, For as Q, untrack as W, createSignal as Z, Show as w } from "solid-js";
|
|
3
|
+
import { cn as f } from "../../utils/cn.js";
|
|
4
4
|
import { useFileBrowser as _ } from "./FileBrowserContext.js";
|
|
5
5
|
import { useFileBrowserDrag as ee } from "../../context/FileBrowserDragContext.js";
|
|
6
|
-
import {
|
|
7
|
-
import { ChevronRight as
|
|
8
|
-
import { createLongPressContextMenuHandlers as
|
|
9
|
-
import { fileBrowserTouchTargetAttrs as
|
|
10
|
-
import { createItemContextMenuEvent as
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
const
|
|
6
|
+
import { FileItemIcon as te } from "./FileIcons.js";
|
|
7
|
+
import { ChevronRight as ne } from "../icons/index.js";
|
|
8
|
+
import { createLongPressContextMenuHandlers as re } from "./longPressContextMenu.js";
|
|
9
|
+
import { fileBrowserTouchTargetAttrs as ie } from "./touchInteractionGuard.js";
|
|
10
|
+
import { createItemContextMenuEvent as ae } from "./contextMenuEvent.js";
|
|
11
|
+
var k = /* @__PURE__ */ m("<div>"), oe = /* @__PURE__ */ m("<button type=button>"), le = /* @__PURE__ */ m('<span class="ml-auto mr-2 text-[10px] text-muted-foreground/60 opacity-0 group-hover:opacity-100 transition-opacity">'), se = /* @__PURE__ */ m('<div class="flex flex-col"><div><button type=button><span class="flex-shrink-0 w-4 h-4"></span><span class=truncate>'), ce = /* @__PURE__ */ m('<span class="flex-shrink-0 w-3.5 h-3.5">');
|
|
12
|
+
function ye(e) {
|
|
13
|
+
const o = _(), i = ee(), b = () => (e.enableDragDrop ?? !0) && !!i, h = () => e.instanceId ?? "default", g = I(() => o.files().filter((r) => r.type === "folder"));
|
|
14
14
|
return (() => {
|
|
15
|
-
var r =
|
|
16
|
-
return r.$$contextmenu = (
|
|
15
|
+
var r = k();
|
|
16
|
+
return r.$$contextmenu = (C) => C.preventDefault(), l(r, s(M, {
|
|
17
17
|
get items() {
|
|
18
18
|
return g();
|
|
19
19
|
},
|
|
20
20
|
depth: 0,
|
|
21
21
|
get instanceId() {
|
|
22
|
-
return
|
|
22
|
+
return h();
|
|
23
23
|
},
|
|
24
24
|
get enableDragDrop() {
|
|
25
|
-
return
|
|
25
|
+
return b();
|
|
26
26
|
},
|
|
27
27
|
dragContext: i
|
|
28
|
-
})),
|
|
28
|
+
})), v(() => D(r, f("flex flex-col", e.class))), r;
|
|
29
29
|
})();
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
return
|
|
31
|
+
function M(e) {
|
|
32
|
+
const o = I(() => e.items.filter((i) => i.type === "folder"));
|
|
33
|
+
return s(Q, {
|
|
34
34
|
get each() {
|
|
35
|
-
return
|
|
35
|
+
return o();
|
|
36
36
|
},
|
|
37
|
-
children: (i) =>
|
|
37
|
+
children: (i) => s(ge, {
|
|
38
38
|
item: i,
|
|
39
39
|
get depth() {
|
|
40
40
|
return e.depth;
|
|
@@ -51,25 +51,25 @@ function F(e) {
|
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
54
|
+
function ge(e) {
|
|
55
|
+
const o = _(), i = () => o.isExpanded(e.item.path), b = () => o.currentPath() === e.item.path, h = W(() => e.item), g = re(o, h, {
|
|
56
56
|
selectOnOpen: !1,
|
|
57
57
|
source: "tree"
|
|
58
58
|
});
|
|
59
59
|
let r;
|
|
60
|
-
const [
|
|
60
|
+
const [C, T] = Z(!1), F = () => r === "touch" || r === "pen", $ = I(() => e.item.children?.filter((t) => t.type === "folder").length ?? 0), x = () => $() > 0, p = () => {
|
|
61
61
|
if (!e.enableDragDrop || !e.dragContext) return !1;
|
|
62
62
|
const t = e.dragContext.dragState();
|
|
63
63
|
return t.isDragging ? e.dragContext.canDropOn(t.draggedItems, e.item.path, e.item, e.instanceId) : !1;
|
|
64
|
-
},
|
|
64
|
+
}, L = () => e.dragContext?.dragState(), A = () => L()?.isDragging ?? !1, E = () => C() && A() && e.enableDragDrop, B = (t) => {
|
|
65
65
|
r = t.pointerType, g.onPointerDown(t);
|
|
66
|
-
},
|
|
66
|
+
}, O = (t) => {
|
|
67
67
|
r = t.pointerType, g.onPointerMove(t);
|
|
68
|
-
},
|
|
68
|
+
}, H = (t) => {
|
|
69
69
|
r = t.pointerType, g.onPointerUp();
|
|
70
|
-
},
|
|
70
|
+
}, N = (t) => {
|
|
71
71
|
r = t.pointerType, g.onPointerCancel();
|
|
72
|
-
},
|
|
72
|
+
}, R = (t) => {
|
|
73
73
|
if (!e.enableDragDrop || !e.dragContext) return;
|
|
74
74
|
const a = e.dragContext.dragState();
|
|
75
75
|
if (!a.isDragging) return;
|
|
@@ -80,84 +80,78 @@ function de(e) {
|
|
|
80
80
|
targetPath: e.item.path,
|
|
81
81
|
targetItem: e.item
|
|
82
82
|
}, d, P);
|
|
83
|
-
},
|
|
83
|
+
}, U = (t) => {
|
|
84
84
|
if (!e.dragContext) return;
|
|
85
85
|
T(!1);
|
|
86
86
|
const a = e.dragContext.dragState();
|
|
87
87
|
a.isDragging && a.dropTarget?.targetPath === e.item.path && e.dragContext.setDropTarget(null, !1);
|
|
88
|
+
}, V = (t) => {
|
|
89
|
+
g.consumeClickSuppression(t) || o.navigateTo(h);
|
|
88
90
|
}, j = (t) => {
|
|
89
|
-
|
|
90
|
-
}, G = (t) => {
|
|
91
|
-
t.preventDefault(), t.stopPropagation(), !L() && l.showContextMenu(oe({
|
|
91
|
+
t.preventDefault(), t.stopPropagation(), !F() && o.showContextMenu(ae({
|
|
92
92
|
x: t.clientX,
|
|
93
93
|
y: t.clientY,
|
|
94
94
|
triggerItem: e.item,
|
|
95
95
|
items: [e.item],
|
|
96
96
|
source: "tree"
|
|
97
97
|
}));
|
|
98
|
-
},
|
|
99
|
-
|
|
98
|
+
}, G = () => {
|
|
99
|
+
x() && o.toggleFolder(e.item.path);
|
|
100
100
|
};
|
|
101
101
|
return (() => {
|
|
102
|
-
var t =
|
|
103
|
-
return a.addEventListener("pointerleave",
|
|
102
|
+
var t = se(), a = t.firstChild, d = a.firstChild, y = d.firstChild, P = y.nextSibling;
|
|
103
|
+
return a.addEventListener("pointerleave", U), a.addEventListener("pointerenter", R), l(a, s(w, {
|
|
104
104
|
get when() {
|
|
105
|
-
return
|
|
105
|
+
return x();
|
|
106
106
|
},
|
|
107
107
|
get fallback() {
|
|
108
|
-
return
|
|
108
|
+
return ce();
|
|
109
109
|
},
|
|
110
110
|
get children() {
|
|
111
|
-
var n =
|
|
112
|
-
return n.$$click =
|
|
111
|
+
var n = oe();
|
|
112
|
+
return n.$$click = G, l(n, s(ne, {
|
|
113
113
|
class: "w-3 h-3 opacity-50"
|
|
114
|
-
})),
|
|
115
|
-
var
|
|
116
|
-
return
|
|
114
|
+
})), v((c) => {
|
|
115
|
+
var u = f("flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center cursor-pointer", "transition-transform duration-150", i() && "rotate-90", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring"), S = i() ? "Collapse folder" : "Expand folder";
|
|
116
|
+
return u !== c.e && D(n, c.e = u), S !== c.t && X(n, "aria-label", c.t = S), c;
|
|
117
117
|
}, {
|
|
118
118
|
e: void 0,
|
|
119
119
|
t: void 0
|
|
120
120
|
}), n;
|
|
121
121
|
}
|
|
122
|
-
}), d),
|
|
123
|
-
onClick:
|
|
124
|
-
onContextMenu:
|
|
122
|
+
}), d), Y(d, q(ie, {
|
|
123
|
+
onClick: V,
|
|
124
|
+
onContextMenu: j,
|
|
125
125
|
onPointerDown: B,
|
|
126
|
-
onPointerMove:
|
|
127
|
-
onPointerUp:
|
|
128
|
-
onPointerCancel:
|
|
126
|
+
onPointerMove: O,
|
|
127
|
+
onPointerUp: H,
|
|
128
|
+
onPointerCancel: N,
|
|
129
129
|
get class() {
|
|
130
|
-
return
|
|
130
|
+
return f("flex items-center gap-1 flex-1 min-w-0 text-left cursor-pointer pl-1", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring");
|
|
131
131
|
}
|
|
132
|
-
}), !1, !0),
|
|
133
|
-
get
|
|
134
|
-
return
|
|
132
|
+
}), !1, !0), l(y, s(te, {
|
|
133
|
+
get item() {
|
|
134
|
+
return e.item;
|
|
135
135
|
},
|
|
136
|
-
get
|
|
137
|
-
return
|
|
138
|
-
class: "w-4 h-4"
|
|
139
|
-
});
|
|
136
|
+
get open() {
|
|
137
|
+
return i();
|
|
140
138
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
class: "w-4 h-4"
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
})), s(P, () => e.item.name), s(d, o(v, {
|
|
139
|
+
class: "w-4 h-4"
|
|
140
|
+
})), l(P, () => e.item.name), l(d, s(w, {
|
|
147
141
|
get when() {
|
|
148
|
-
return
|
|
142
|
+
return x();
|
|
149
143
|
},
|
|
150
144
|
get children() {
|
|
151
|
-
var n =
|
|
152
|
-
return
|
|
145
|
+
var n = le();
|
|
146
|
+
return l(n, $), n;
|
|
153
147
|
}
|
|
154
|
-
}), null),
|
|
148
|
+
}), null), l(t, s(w, {
|
|
155
149
|
get when() {
|
|
156
|
-
return
|
|
150
|
+
return z(() => !!i())() && x();
|
|
157
151
|
},
|
|
158
152
|
get children() {
|
|
159
|
-
var n =
|
|
160
|
-
return
|
|
153
|
+
var n = k();
|
|
154
|
+
return l(n, s(M, {
|
|
161
155
|
get items() {
|
|
162
156
|
return e.item.children ?? [];
|
|
163
157
|
},
|
|
@@ -173,19 +167,19 @@ function de(e) {
|
|
|
173
167
|
get dragContext() {
|
|
174
168
|
return e.dragContext;
|
|
175
169
|
}
|
|
176
|
-
})),
|
|
170
|
+
})), v(() => D(n, f("overflow-hidden transition-all duration-200", i() ? "opacity-100" : "opacity-0"))), n;
|
|
177
171
|
}
|
|
178
|
-
}), null),
|
|
179
|
-
var c =
|
|
172
|
+
}), null), v((n) => {
|
|
173
|
+
var c = f(
|
|
180
174
|
"group flex items-center w-full py-1 text-xs",
|
|
181
175
|
"transition-all duration-150 ease-out",
|
|
182
176
|
"hover:bg-sidebar-accent/60",
|
|
183
|
-
|
|
177
|
+
b() && "bg-sidebar-accent text-sidebar-accent-foreground font-medium",
|
|
184
178
|
// Drop target styling - enhanced visual feedback
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
),
|
|
188
|
-
return c !== n.e &&
|
|
179
|
+
E() && p() && ["bg-primary/15 outline outline-2 outline-primary/60", "shadow-sm shadow-primary/10"],
|
|
180
|
+
E() && !p() && ["bg-destructive/10 outline outline-2 outline-dashed outline-destructive/50"]
|
|
181
|
+
), u = `${8 + e.depth * 12}px`;
|
|
182
|
+
return c !== n.e && D(a, n.e = c), u !== n.t && J(a, "padding-left", n.t = u), n;
|
|
189
183
|
}, {
|
|
190
184
|
e: void 0,
|
|
191
185
|
t: void 0
|
|
@@ -194,5 +188,5 @@ function de(e) {
|
|
|
194
188
|
}
|
|
195
189
|
K(["contextmenu", "click"]);
|
|
196
190
|
export {
|
|
197
|
-
|
|
191
|
+
ye as DirectoryTree
|
|
198
192
|
};
|
|
@@ -4,11 +4,18 @@ export interface FileIconProps {
|
|
|
4
4
|
class?: string;
|
|
5
5
|
}
|
|
6
6
|
type FileIconComponent = Component<FileIconProps>;
|
|
7
|
-
type ResolvableFileIcon = Pick<FileItem, 'name' | 'type' | 'extension' | 'icon'>;
|
|
7
|
+
type ResolvableFileIcon = Pick<FileItem, 'name' | 'type' | 'extension' | 'icon' | 'link'>;
|
|
8
8
|
export type FileItemIconRenderer = FileIconComponent | JSX.Element;
|
|
9
|
+
export interface ResolveFileItemIconOptions {
|
|
10
|
+
open?: boolean;
|
|
11
|
+
}
|
|
9
12
|
export declare const FolderIcon: (props: FileIconProps) => JSX.Element;
|
|
10
13
|
export declare const FolderOpenIcon: (props: FileIconProps) => JSX.Element;
|
|
14
|
+
export declare const SymlinkFolderIcon: (props: FileIconProps) => JSX.Element;
|
|
15
|
+
export declare const SymlinkFolderOpenIcon: (props: FileIconProps) => JSX.Element;
|
|
11
16
|
export declare const FileIcon: (props: FileIconProps) => JSX.Element;
|
|
17
|
+
export declare const SymlinkFileIcon: (props: FileIconProps) => JSX.Element;
|
|
18
|
+
export declare const BrokenSymlinkIcon: (props: FileIconProps) => JSX.Element;
|
|
12
19
|
export declare const CodeFileIcon: (props: FileIconProps) => JSX.Element;
|
|
13
20
|
export declare const JavaScriptFileIcon: FileIconComponent;
|
|
14
21
|
export declare const TypeScriptFileIcon: FileIconComponent;
|
|
@@ -18,9 +25,10 @@ export declare const DocumentFileIcon: (props: FileIconProps) => JSX.Element;
|
|
|
18
25
|
export declare const ConfigFileIcon: (props: FileIconProps) => JSX.Element;
|
|
19
26
|
export declare const StyleFileIcon: (props: FileIconProps) => JSX.Element;
|
|
20
27
|
export declare function getFileIcon(extension?: string): FileIconComponent;
|
|
21
|
-
export declare function resolveFileItemIcon(item: ResolvableFileIcon): FileItemIconRenderer;
|
|
28
|
+
export declare function resolveFileItemIcon(item: ResolvableFileIcon, options?: ResolveFileItemIconOptions): FileItemIconRenderer;
|
|
22
29
|
export declare function FileItemIcon(props: {
|
|
23
30
|
item: ResolvableFileIcon;
|
|
24
31
|
class?: string;
|
|
32
|
+
open?: boolean;
|
|
25
33
|
}): JSX.Element;
|
|
26
34
|
export {};
|