@floegence/floe-webapp-core 0.26.2 → 0.26.4
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/chat/input/ChatInput.js +59 -46
- package/dist/components/deck/WidgetResizeHandle.js +49 -49
- package/dist/components/file-browser/FileBrowser.js +41 -40
- package/dist/components/file-browser/FileBrowserToolbar.js +27 -26
- package/dist/components/file-browser/FileGridView.js +158 -142
- package/dist/components/launchpad/LaunchpadModal.js +53 -85
- package/dist/components/ui/CommandPalette.js +108 -94
- package/dist/components/ui/Dialog.js +53 -76
- package/dist/hooks/useDeckDrag.js +36 -36
- package/dist/hooks/useFileBrowserDrag.js +50 -50
- package/dist/hooks/useOverlayMask.d.ts +26 -0
- package/dist/hooks/useOverlayMask.js +85 -0
- package/dist/styles.css +1 -1
- package/dist/utils/focus.d.ts +2 -0
- package/dist/utils/focus.js +25 -0
- package/package.json +1 -1
|
@@ -1,47 +1,60 @@
|
|
|
1
|
-
import { addEventListener as h, insert as s, createComponent as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useChatContext as
|
|
5
|
-
import { useAttachments as
|
|
6
|
-
import { AttachmentPreview as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
let
|
|
11
|
-
const n =
|
|
12
|
-
maxAttachments:
|
|
13
|
-
maxSize:
|
|
14
|
-
acceptedTypes:
|
|
15
|
-
onUpload:
|
|
16
|
-
}),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { addEventListener as h, insert as s, createComponent as r, effect as S, className as _, setAttribute as M, template as c, use as j, delegateEvents as q } from "solid-js/web";
|
|
2
|
+
import { createSignal as F, onCleanup as z, Show as v } from "solid-js";
|
|
3
|
+
import { cn as E } from "../../../utils/cn.js";
|
|
4
|
+
import { useChatContext as K } from "../ChatProvider.js";
|
|
5
|
+
import { useAttachments as R } from "../hooks/useAttachments.js";
|
|
6
|
+
import { AttachmentPreview as U } from "./AttachmentPreview.js";
|
|
7
|
+
var N = /* @__PURE__ */ c("<div class=chat-input-drop-overlay><span>Drop files here"), O = /* @__PURE__ */ c('<button type=button class=chat-input-attachment-btn title="Add attachments">'), G = /* @__PURE__ */ c('<div><div class=chat-input-row><textarea class=chat-input-textarea rows=1></textarea><button type=button title="Send message">'), J = /* @__PURE__ */ c('<svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48">'), Q = /* @__PURE__ */ c('<svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><line x1=22 y1=2 x2=11 y2=13></line><polygon points="22 2 15 22 11 13 2 9 22 2">'), V = /* @__PURE__ */ c('<svg width=32 height=32 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1=12 y1=3 x2=12 y2=15>');
|
|
8
|
+
const rt = (u) => {
|
|
9
|
+
const i = K(), [p, y] = F(""), [I, w] = F(!1);
|
|
10
|
+
let d, o = null;
|
|
11
|
+
const n = R({
|
|
12
|
+
maxAttachments: i.config().maxAttachments,
|
|
13
|
+
maxSize: i.config().maxAttachmentSize,
|
|
14
|
+
acceptedTypes: i.config().acceptedFileTypes,
|
|
15
|
+
onUpload: i.config().allowAttachments ? (t) => i.uploadAttachment(t) : void 0
|
|
16
|
+
}), L = () => u.placeholder || i.config().placeholder || "Type a message...", f = () => (p().trim() || n.attachments().length > 0) && !u.disabled, x = () => {
|
|
17
|
+
const t = d;
|
|
18
|
+
t && (t.style.height = "auto", t.style.height = `${Math.min(t.scrollHeight, 200)}px`);
|
|
19
|
+
}, P = () => {
|
|
20
|
+
if (o === null) {
|
|
21
|
+
if (typeof requestAnimationFrame > "u") {
|
|
22
|
+
x();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
o = requestAnimationFrame(() => {
|
|
26
|
+
o = null, x();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
20
29
|
}, T = (t) => {
|
|
21
|
-
t.
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
f(
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
y(t.currentTarget.value), P();
|
|
31
|
+
}, H = (t) => {
|
|
32
|
+
t.key === "Enter" && !t.shiftKey && (t.preventDefault(), A());
|
|
33
|
+
}, A = async () => {
|
|
34
|
+
if (!f()) return;
|
|
35
|
+
const t = p().trim(), l = n.attachments();
|
|
36
|
+
y(""), n.clearAttachments(), d && (d.style.height = "auto"), await i.sendMessage(t, l);
|
|
37
|
+
}, B = async (t) => {
|
|
38
|
+
i.config().allowAttachments && await n.handlePaste(t);
|
|
28
39
|
};
|
|
29
|
-
return (() => {
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
return z(() => {
|
|
41
|
+
o !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(o), o = null);
|
|
42
|
+
}), (() => {
|
|
43
|
+
var t = G(), l = t.firstChild, a = l.firstChild, m = a.nextSibling;
|
|
44
|
+
h(t, "drop", n.handleDrop), h(t, "dragover", n.handleDragOver), h(t, "dragleave", n.handleDragLeave), h(t, "dragenter", n.handleDragEnter), s(t, r(v, {
|
|
32
45
|
get when() {
|
|
33
46
|
return n.isDragging();
|
|
34
47
|
},
|
|
35
48
|
get children() {
|
|
36
|
-
var e =
|
|
37
|
-
return s(e,
|
|
49
|
+
var e = N(), g = e.firstChild;
|
|
50
|
+
return s(e, r(Y, {}), g), e;
|
|
38
51
|
}
|
|
39
|
-
}), l), s(t,
|
|
52
|
+
}), l), s(t, r(v, {
|
|
40
53
|
get when() {
|
|
41
54
|
return n.attachments().length > 0;
|
|
42
55
|
},
|
|
43
56
|
get children() {
|
|
44
|
-
return
|
|
57
|
+
return r(U, {
|
|
45
58
|
get attachments() {
|
|
46
59
|
return n.attachments();
|
|
47
60
|
},
|
|
@@ -50,29 +63,29 @@ const nt = (d) => {
|
|
|
50
63
|
}
|
|
51
64
|
});
|
|
52
65
|
}
|
|
53
|
-
}), l), s(l,
|
|
66
|
+
}), l), s(l, r(v, {
|
|
54
67
|
get when() {
|
|
55
|
-
return
|
|
68
|
+
return i.config().allowAttachments;
|
|
56
69
|
},
|
|
57
70
|
get children() {
|
|
58
|
-
var e =
|
|
59
|
-
return h(e, "click", n.openFilePicker, !0), s(e,
|
|
71
|
+
var e = O();
|
|
72
|
+
return h(e, "click", n.openFilePicker, !0), s(e, r(W, {})), e;
|
|
60
73
|
}
|
|
61
|
-
}), a), a.addEventListener("blur", () => w(!1)), a.addEventListener("focus", () => w(!0)), a.addEventListener("paste",
|
|
62
|
-
var
|
|
63
|
-
return typeof
|
|
64
|
-
var
|
|
65
|
-
return
|
|
74
|
+
}), a), a.addEventListener("blur", () => w(!1)), a.addEventListener("focus", () => w(!0)), a.addEventListener("paste", B), a.$$keydown = H, a.$$input = T;
|
|
75
|
+
var $ = d;
|
|
76
|
+
return typeof $ == "function" ? j($, a) : d = a, m.$$click = A, s(m, r(X, {})), S((e) => {
|
|
77
|
+
var g = E("chat-input-container", I() && "chat-input-container-focused", n.isDragging() && "chat-input-container-dragging", u.class), b = L(), k = u.disabled, C = E("chat-input-send-btn", f() && "chat-input-send-btn-active"), D = !f();
|
|
78
|
+
return g !== e.e && _(t, e.e = g), b !== e.t && M(a, "placeholder", e.t = b), k !== e.a && (a.disabled = e.a = k), C !== e.o && _(m, e.o = C), D !== e.i && (m.disabled = e.i = D), e;
|
|
66
79
|
}, {
|
|
67
80
|
e: void 0,
|
|
68
81
|
t: void 0,
|
|
69
82
|
a: void 0,
|
|
70
83
|
o: void 0,
|
|
71
84
|
i: void 0
|
|
72
|
-
}),
|
|
85
|
+
}), S(() => a.value = p()), t;
|
|
73
86
|
})();
|
|
74
|
-
},
|
|
75
|
-
|
|
87
|
+
}, W = () => J(), X = () => Q(), Y = () => V();
|
|
88
|
+
q(["click", "input", "keydown"]);
|
|
76
89
|
export {
|
|
77
|
-
|
|
90
|
+
rt as ChatInput
|
|
78
91
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { effect as x, className as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useDeck as
|
|
5
|
-
import { applyResizeDelta as
|
|
6
|
-
import { getGridConfigFromElement as
|
|
7
|
-
import { lockBodyStyle as
|
|
8
|
-
var
|
|
9
|
-
const
|
|
1
|
+
import { effect as x, className as L, setAttribute as _, template as N, use as O, delegateEvents as U } from "solid-js/web";
|
|
2
|
+
import { createSignal as j, onCleanup as J } from "solid-js";
|
|
3
|
+
import { cn as K } from "../../utils/cn.js";
|
|
4
|
+
import { useDeck as Q } from "../../context/DeckContext.js";
|
|
5
|
+
import { applyResizeDelta as V } from "../../utils/gridLayout.js";
|
|
6
|
+
import { getGridConfigFromElement as Z } from "./DeckGrid.js";
|
|
7
|
+
import { lockBodyStyle as ee } from "../../utils/bodyStyleLock.js";
|
|
8
|
+
var te = /* @__PURE__ */ N("<div style=touch-action:none>");
|
|
9
|
+
const ne = {
|
|
10
10
|
n: "top-0 left-2 right-2 h-2 cursor-ns-resize",
|
|
11
11
|
s: "bottom-0 left-2 right-2 h-2 cursor-ns-resize",
|
|
12
12
|
e: "right-0 top-2 bottom-2 w-2 cursor-ew-resize",
|
|
@@ -15,7 +15,7 @@ const te = {
|
|
|
15
15
|
nw: "top-0 left-0 w-4 h-4 cursor-nwse-resize",
|
|
16
16
|
se: "bottom-0 right-0 w-4 h-4 cursor-nwse-resize",
|
|
17
17
|
sw: "bottom-0 left-0 w-4 h-4 cursor-nesw-resize"
|
|
18
|
-
},
|
|
18
|
+
}, re = {
|
|
19
19
|
n: "ns-resize",
|
|
20
20
|
s: "ns-resize",
|
|
21
21
|
e: "ew-resize",
|
|
@@ -25,84 +25,84 @@ const te = {
|
|
|
25
25
|
se: "nwse-resize",
|
|
26
26
|
sw: "nesw-resize"
|
|
27
27
|
};
|
|
28
|
-
function
|
|
29
|
-
const f =
|
|
30
|
-
let g, h = null, d = 0, u = 0, y = 0, p = 0, s = 0,
|
|
31
|
-
const
|
|
28
|
+
function ue(i) {
|
|
29
|
+
const f = Q(), [m, C] = j(!1);
|
|
30
|
+
let g, h = null, d = 0, u = 0, y = 0, p = 0, s = 0, R = 0, b = 0, S = 0, l = null, w = null, r = null, A = null, P = 0, F = 0;
|
|
31
|
+
const E = (e) => {
|
|
32
32
|
if (!e) {
|
|
33
33
|
w?.(), w = null;
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
w?.(), w =
|
|
37
|
-
cursor:
|
|
36
|
+
w?.(), w = ee({
|
|
37
|
+
cursor: re[i.edge],
|
|
38
38
|
"user-select": "none"
|
|
39
39
|
});
|
|
40
|
-
},
|
|
41
|
-
m() && (l !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(l), l = null),
|
|
42
|
-
},
|
|
40
|
+
}, D = () => {
|
|
41
|
+
m() && (l !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(l), l = null), C(!1), h = null, r = null, A = null, E(!1), f.endResize(!0));
|
|
42
|
+
}, Y = () => {
|
|
43
43
|
if (!r) return;
|
|
44
|
-
const e = r.getBoundingClientRect(), t = 48, n = 24, o = s - e.top,
|
|
45
|
-
let
|
|
46
|
-
if (o < t ?
|
|
47
|
-
const z = r.scrollTop, v = Math.max(0, Math.min(z +
|
|
44
|
+
const e = A ?? r.getBoundingClientRect(), t = 48, n = 24, o = s - e.top, c = e.bottom - s;
|
|
45
|
+
let a = 0;
|
|
46
|
+
if (o < t ? a = -Math.ceil((t - o) / t * n) : c < t && (a = Math.ceil((t - c) / t * n)), a === 0) return;
|
|
47
|
+
const z = r.scrollTop, v = Math.max(0, Math.min(z + a, r.scrollHeight - r.clientHeight));
|
|
48
48
|
v !== z && (r.scrollTop = v);
|
|
49
|
-
},
|
|
49
|
+
}, $ = () => {
|
|
50
50
|
if (l !== null || typeof requestAnimationFrame > "u") return;
|
|
51
51
|
const e = () => {
|
|
52
52
|
if (!m()) {
|
|
53
53
|
l = null;
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
I(), l = requestAnimationFrame(e);
|
|
57
57
|
};
|
|
58
58
|
l = requestAnimationFrame(e);
|
|
59
|
-
},
|
|
59
|
+
}, G = (e) => {
|
|
60
60
|
if (e.pointerType === "mouse" && e.button !== 0) return;
|
|
61
61
|
e.preventDefault(), e.stopPropagation();
|
|
62
62
|
const t = e.currentTarget?.closest(".deck-grid");
|
|
63
63
|
if (!t) return;
|
|
64
|
-
h = e.pointerId, d = e.clientX, u = e.clientY, p = d, s = u,
|
|
64
|
+
h = e.pointerId, d = e.clientX, u = e.clientY, p = d, s = u, R = d, b = u, C(!0), E(!0), r = t, A = t.getBoundingClientRect(), y = t.scrollTop, S = y;
|
|
65
65
|
const n = window.getComputedStyle(t);
|
|
66
|
-
P = parseFloat(n.paddingLeft) || 0,
|
|
67
|
-
},
|
|
68
|
-
!m() || h !== e.pointerId || (p = e.clientX, s = e.clientY, typeof requestAnimationFrame > "u" &&
|
|
69
|
-
},
|
|
66
|
+
P = parseFloat(n.paddingLeft) || 0, F = parseFloat(n.paddingRight) || 0, f.startResize(i.widget.id, i.edge, d, u), g?.setPointerCapture(e.pointerId), $();
|
|
67
|
+
}, W = (e) => {
|
|
68
|
+
!m() || h !== e.pointerId || (p = e.clientX, s = e.clientY, typeof requestAnimationFrame > "u" && I());
|
|
69
|
+
}, I = () => {
|
|
70
70
|
if (!r) return;
|
|
71
|
-
|
|
71
|
+
Y();
|
|
72
72
|
const e = r.scrollTop;
|
|
73
|
-
if (p ===
|
|
74
|
-
|
|
73
|
+
if (p === R && s === b && e === S) return;
|
|
74
|
+
R = p, b = s, S = e;
|
|
75
75
|
const t = p - d, n = s - u + (e - y), {
|
|
76
76
|
cols: o,
|
|
77
|
-
rowHeight:
|
|
78
|
-
gap:
|
|
79
|
-
} =
|
|
80
|
-
if (!Number.isFinite(
|
|
81
|
-
const
|
|
77
|
+
rowHeight: c,
|
|
78
|
+
gap: a
|
|
79
|
+
} = Z(r), z = r.clientWidth - P - F, v = a * (o - 1), T = (z - v) / o;
|
|
80
|
+
if (!Number.isFinite(T) || T <= 0) return;
|
|
81
|
+
const X = c + a, B = Math.round(t / T), H = Math.round(n / X), k = f.getWidgetMinConstraints(i.widget.type), q = V(i.widget.position, i.edge, B, H, k.minColSpan, k.minRowSpan, o);
|
|
82
82
|
f.updateResize(q);
|
|
83
|
-
},
|
|
83
|
+
}, M = (e) => {
|
|
84
84
|
if (h === e.pointerId) {
|
|
85
85
|
try {
|
|
86
86
|
g?.releasePointerCapture(e.pointerId);
|
|
87
87
|
} catch {
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
D();
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
return
|
|
93
|
-
var e =
|
|
94
|
-
e.addEventListener("pointercancel",
|
|
92
|
+
return J(() => D()), (() => {
|
|
93
|
+
var e = te();
|
|
94
|
+
e.addEventListener("pointercancel", M), e.$$pointerup = M, e.$$pointermove = W, e.$$pointerdown = G;
|
|
95
95
|
var t = g;
|
|
96
|
-
return typeof t == "function" ?
|
|
97
|
-
var o =
|
|
98
|
-
return o !== n.e &&
|
|
96
|
+
return typeof t == "function" ? O(t, e) : g = e, x((n) => {
|
|
97
|
+
var o = K("absolute z-30", ne[i.edge], "hover:bg-primary/30 transition-colors", m() && "bg-primary/50"), c = i.edge;
|
|
98
|
+
return o !== n.e && L(e, n.e = o), c !== n.t && _(e, "data-widget-resize-handle", n.t = c), n;
|
|
99
99
|
}, {
|
|
100
100
|
e: void 0,
|
|
101
101
|
t: void 0
|
|
102
102
|
}), e;
|
|
103
103
|
})();
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
U(["pointerdown", "pointermove", "pointerup"]);
|
|
106
106
|
export {
|
|
107
|
-
|
|
107
|
+
ue as WidgetResizeHandle
|
|
108
108
|
};
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { createComponent as n, insert as l, addEventListener as
|
|
2
|
-
import { onMount as
|
|
1
|
+
import { createComponent as n, insert as l, addEventListener as P, use as L, memo as w, effect as T, className as W, setStyleProperty as B, template as m, delegateEvents as p } from "solid-js/web";
|
|
2
|
+
import { onMount as G, onCleanup as H, createEffect as Q, Show as o } from "solid-js";
|
|
3
3
|
import { cn as K } from "../../utils/cn.js";
|
|
4
4
|
import { useLayout as q } from "../../context/LayoutContext.js";
|
|
5
5
|
import { useFileBrowserDrag as J } from "../../context/FileBrowserDragContext.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
import { deferAfterPaint as U } from "../../utils/defer.js";
|
|
7
|
+
import { FileBrowserProvider as X, useFileBrowser as Y } from "./FileBrowserContext.js";
|
|
8
|
+
import { ResizeHandle as Z } from "../layout/ResizeHandle.js";
|
|
9
|
+
import { DirectoryTree as ee } from "./DirectoryTree.js";
|
|
10
|
+
import { FileListView as te } from "./FileListView.js";
|
|
11
|
+
import { FileGridView as re } from "./FileGridView.js";
|
|
12
|
+
import { FileBrowserToolbar as ie } from "./FileBrowserToolbar.js";
|
|
13
|
+
import { FileContextMenu as ne } from "./FileContextMenu.js";
|
|
14
|
+
import { DragPreview as le } from "./DragPreview.js";
|
|
15
|
+
var oe = /* @__PURE__ */ m('<div class="border-b border-border">'), ae = /* @__PURE__ */ m('<button type=button class="flex items-center justify-center w-5 h-5 rounded cursor-pointer hover:bg-sidebar-accent/80 transition-colors"aria-label="Close sidebar"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round class="w-3.5 h-3.5"><path d="M18 6 6 18"></path><path d="m6 6 12 12">'), se = /* @__PURE__ */ m('<div class="absolute inset-0 bg-background/60 backdrop-blur-sm z-[9]">'), de = /* @__PURE__ */ m('<div><div class="flex flex-1 min-h-0 relative"><aside><div class="h-full flex flex-col"><div class="flex items-center justify-between px-3 py-2 border-b border-sidebar-border"><span class="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60">Explorer</span></div><div class="flex-1 min-h-0 overflow-auto py-1"></div></div></aside><div class="flex-1 min-w-0 flex flex-col"><div class="flex-1 min-h-0"></div><div class="flex items-center justify-between px-3 py-1 border-t border-border text-[10px] text-muted-foreground"><span> items</span><span class="truncate max-w-[200px]">');
|
|
16
|
+
function De(e) {
|
|
17
|
+
return n(X, {
|
|
17
18
|
get files() {
|
|
18
19
|
return e.files;
|
|
19
20
|
},
|
|
@@ -48,7 +49,7 @@ function Se(e) {
|
|
|
48
49
|
return e.onOpen;
|
|
49
50
|
},
|
|
50
51
|
get children() {
|
|
51
|
-
return n(
|
|
52
|
+
return n(ue, {
|
|
52
53
|
get class() {
|
|
53
54
|
return e.class;
|
|
54
55
|
},
|
|
@@ -86,10 +87,10 @@ function Se(e) {
|
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
const r =
|
|
90
|
+
function ue(e) {
|
|
91
|
+
const r = Y(), O = q(), d = J(), a = () => O.isMobile(), C = () => r.sidebarWidth(), E = () => e.sidebarResizable ?? !0, s = () => (e.enableDragDrop ?? !0) && !!d, u = () => e.instanceId ?? `filebrowser-${Math.random().toString(36).slice(2, 9)}`;
|
|
91
92
|
let M, I = null, S = null;
|
|
92
|
-
|
|
93
|
+
G(() => {
|
|
93
94
|
if (!d || !s()) return;
|
|
94
95
|
const i = {
|
|
95
96
|
instanceId: u(),
|
|
@@ -102,11 +103,11 @@ function de(e) {
|
|
|
102
103
|
optimisticInsert: r.optimisticInsert
|
|
103
104
|
};
|
|
104
105
|
d.registerInstance(i);
|
|
105
|
-
}),
|
|
106
|
+
}), H(() => {
|
|
106
107
|
d && s() && d.unregisterInstance(u());
|
|
107
108
|
});
|
|
108
109
|
let y = !1, f = !1;
|
|
109
|
-
|
|
110
|
+
Q(() => {
|
|
110
111
|
const i = a();
|
|
111
112
|
if (!y) {
|
|
112
113
|
y = !0, f = i, i && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar();
|
|
@@ -115,18 +116,18 @@ function de(e) {
|
|
|
115
116
|
!f && i && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar(), f = i;
|
|
116
117
|
});
|
|
117
118
|
const j = (i) => {
|
|
118
|
-
(i.metaKey || i.ctrlKey) && i.key.toLowerCase() === "f" && (i.preventDefault(), r.setFilterActive(!0),
|
|
119
|
+
(i.metaKey || i.ctrlKey) && i.key.toLowerCase() === "f" && (i.preventDefault(), r.setFilterActive(!0), U(() => M?.focus()));
|
|
119
120
|
}, D = () => !r.sidebarCollapsed() || !a();
|
|
120
121
|
return (() => {
|
|
121
|
-
var i =
|
|
122
|
+
var i = de(), h = i.firstChild, c = h.firstChild, k = c.firstChild, v = k.firstChild;
|
|
122
123
|
v.firstChild;
|
|
123
|
-
var $ = v.nextSibling, x = c.nextSibling, b = x.firstChild, V = b.nextSibling, g = V.firstChild,
|
|
124
|
+
var $ = v.nextSibling, x = c.nextSibling, b = x.firstChild, V = b.nextSibling, g = V.firstChild, A = g.firstChild, N = g.nextSibling;
|
|
124
125
|
return i.$$keydown = j, l(i, n(o, {
|
|
125
126
|
get when() {
|
|
126
127
|
return e.header;
|
|
127
128
|
},
|
|
128
129
|
get children() {
|
|
129
|
-
var t =
|
|
130
|
+
var t = oe();
|
|
130
131
|
return l(t, () => e.header), t;
|
|
131
132
|
}
|
|
132
133
|
}), h), l(v, n(o, {
|
|
@@ -134,12 +135,12 @@ function de(e) {
|
|
|
134
135
|
return a();
|
|
135
136
|
},
|
|
136
137
|
get children() {
|
|
137
|
-
var t =
|
|
138
|
-
return
|
|
138
|
+
var t = ae();
|
|
139
|
+
return P(t, "click", r.toggleSidebar, !0), t;
|
|
139
140
|
}
|
|
140
|
-
}), null),
|
|
141
|
+
}), null), L((t) => {
|
|
141
142
|
S = t;
|
|
142
|
-
}, $), l($, n(
|
|
143
|
+
}, $), l($, n(ee, {
|
|
143
144
|
get instanceId() {
|
|
144
145
|
return u();
|
|
145
146
|
},
|
|
@@ -151,7 +152,7 @@ function de(e) {
|
|
|
151
152
|
return w(() => !!(E() && D()))() && !a();
|
|
152
153
|
},
|
|
153
154
|
get children() {
|
|
154
|
-
return n(
|
|
155
|
+
return n(Z, {
|
|
155
156
|
direction: "horizontal",
|
|
156
157
|
onResize: (t) => {
|
|
157
158
|
r.setSidebarWidth(r.sidebarWidth() + t);
|
|
@@ -163,19 +164,19 @@ function de(e) {
|
|
|
163
164
|
return w(() => !!a())() && !r.sidebarCollapsed();
|
|
164
165
|
},
|
|
165
166
|
get children() {
|
|
166
|
-
var t =
|
|
167
|
-
return
|
|
167
|
+
var t = se();
|
|
168
|
+
return P(t, "click", r.toggleSidebar, !0), t;
|
|
168
169
|
}
|
|
169
|
-
}), x), l(x, n(
|
|
170
|
+
}), x), l(x, n(ie, {
|
|
170
171
|
filterInputRef: (t) => M = t
|
|
171
|
-
}), b),
|
|
172
|
+
}), b), L((t) => {
|
|
172
173
|
I = t;
|
|
173
174
|
}, b), l(b, n(o, {
|
|
174
175
|
get when() {
|
|
175
176
|
return r.viewMode() === "list";
|
|
176
177
|
},
|
|
177
178
|
get fallback() {
|
|
178
|
-
return n(
|
|
179
|
+
return n(re, {
|
|
179
180
|
get instanceId() {
|
|
180
181
|
return u();
|
|
181
182
|
},
|
|
@@ -185,7 +186,7 @@ function de(e) {
|
|
|
185
186
|
});
|
|
186
187
|
},
|
|
187
188
|
get children() {
|
|
188
|
-
return n(
|
|
189
|
+
return n(te, {
|
|
189
190
|
get instanceId() {
|
|
190
191
|
return u();
|
|
191
192
|
},
|
|
@@ -194,7 +195,7 @@ function de(e) {
|
|
|
194
195
|
}
|
|
195
196
|
});
|
|
196
197
|
}
|
|
197
|
-
})), l(g, () => r.currentFiles().length,
|
|
198
|
+
})), l(g, () => r.currentFiles().length, A), l(g, n(o, {
|
|
198
199
|
get when() {
|
|
199
200
|
return r.filterQueryApplied().trim();
|
|
200
201
|
},
|
|
@@ -208,7 +209,7 @@ function de(e) {
|
|
|
208
209
|
get children() {
|
|
209
210
|
return [" · ", w(() => r.selectedItems().size), " selected"];
|
|
210
211
|
}
|
|
211
|
-
}), null), l(
|
|
212
|
+
}), null), l(N, () => r.currentPath()), l(i, n(ne, {
|
|
212
213
|
get callbacks() {
|
|
213
214
|
return e.contextMenuCallbacks;
|
|
214
215
|
},
|
|
@@ -226,9 +227,9 @@ function de(e) {
|
|
|
226
227
|
return s();
|
|
227
228
|
},
|
|
228
229
|
get children() {
|
|
229
|
-
return n(
|
|
230
|
+
return n(le, {});
|
|
230
231
|
}
|
|
231
|
-
}), null),
|
|
232
|
+
}), null), T((t) => {
|
|
232
233
|
var _ = K("flex flex-col h-full min-h-0 bg-background", "border border-border rounded-lg overflow-hidden", "shadow-sm", e.class), R = K(
|
|
233
234
|
"flex-shrink-0 border-r border-border bg-sidebar relative",
|
|
234
235
|
"transition-all duration-200 ease-out",
|
|
@@ -245,7 +246,7 @@ function de(e) {
|
|
|
245
246
|
}), i;
|
|
246
247
|
})();
|
|
247
248
|
}
|
|
248
|
-
|
|
249
|
+
p(["keydown", "click"]);
|
|
249
250
|
export {
|
|
250
|
-
|
|
251
|
+
De as FileBrowser
|
|
251
252
|
};
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { addEventListener as
|
|
2
|
-
import { onMount as R, Show as
|
|
1
|
+
import { addEventListener as A, insert as o, createComponent as l, use as S, effect as s, className as d, template as u, setAttribute as g, delegateEvents as Q } from "solid-js/web";
|
|
2
|
+
import { onMount as R, Show as M } from "solid-js";
|
|
3
3
|
import { cn as f } from "../../utils/cn.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return s(() => g(e, "class", r.class)), e;
|
|
11
|
-
})(), z = (r) => (() => {
|
|
4
|
+
import { deferAfterPaint as E } from "../../utils/defer.js";
|
|
5
|
+
import { useFileBrowser as L } from "./FileBrowserContext.js";
|
|
6
|
+
import { Breadcrumb as T } from "./Breadcrumb.js";
|
|
7
|
+
import { Grid as V } from "../icons/index.js";
|
|
8
|
+
var N = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><line x1=8 y1=6 x2=21 y2=6></line><line x1=8 y1=12 x2=21 y2=12></line><line x1=8 y1=18 x2=21 y2=18></line><line x1=3 y1=6 x2=3.01 y2=6></line><line x1=3 y1=12 x2=3.01 y2=12></line><line x1=3 y1=18 x2=3.01 y2=18>'), U = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"></path><path d="M12 10v6"></path><path d="m9 13 3-3 3 3">'), G = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect width=18 height=18 x=3 y=3 rx=2 ry=2></rect><line x1=9 y1=3 x2=9 y2=21>'), P = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=11 cy=11 r=8></circle><path d="m21 21-4.3-4.3">'), D = /* @__PURE__ */ u('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M18 6 6 18"></path><path d="m6 6 12 12">'), H = /* @__PURE__ */ u('<button type=button aria-label="Clear filter">'), K = /* @__PURE__ */ u('<div class="flex items-center flex-1 gap-1 px-2 py-1 bg-muted/50 rounded-md border border-border/50 focus-within:border-ring focus-within:ring-1 focus-within:ring-ring"><input type=text placeholder=Filter... aria-label="Filter files by name">'), X = /* @__PURE__ */ u('<div><button type=button aria-label="Toggle sidebar"></button><button type=button aria-label="Navigate to parent folder"></button><div></div><div></div><div class="flex items-center gap-0.5 p-0.5 bg-muted/50 rounded-md">'), Z = /* @__PURE__ */ u('<button type=button aria-label="Filter files">'), q = /* @__PURE__ */ u("<button type=button>");
|
|
9
|
+
const z = (r) => (() => {
|
|
12
10
|
var e = N();
|
|
13
11
|
return s(() => g(e, "class", r.class)), e;
|
|
14
12
|
})(), J = (r) => (() => {
|
|
15
13
|
var e = U();
|
|
16
14
|
return s(() => g(e, "class", r.class)), e;
|
|
17
|
-
})(),
|
|
15
|
+
})(), O = (r) => (() => {
|
|
18
16
|
var e = G();
|
|
19
17
|
return s(() => g(e, "class", r.class)), e;
|
|
20
|
-
})(),
|
|
18
|
+
})(), j = (r) => (() => {
|
|
19
|
+
var e = P();
|
|
20
|
+
return s(() => g(e, "class", r.class)), e;
|
|
21
|
+
})(), W = (r) => (() => {
|
|
21
22
|
var e = D();
|
|
22
23
|
return s(() => g(e, "class", r.class)), e;
|
|
23
24
|
})();
|
|
24
|
-
function
|
|
25
|
-
const e =
|
|
25
|
+
function le(r) {
|
|
26
|
+
const e = L();
|
|
26
27
|
let n;
|
|
27
28
|
const c = () => {
|
|
28
29
|
const v = e.currentPath();
|
|
29
30
|
return v !== "/" && v !== "";
|
|
30
31
|
}, m = () => {
|
|
31
|
-
e.isFilterActive() ? (e.setFilterQuery(""), e.setFilterActive(!1)) : (e.setFilterActive(!0),
|
|
32
|
+
e.isFilterActive() ? (e.setFilterQuery(""), e.setFilterActive(!1)) : (e.setFilterActive(!0), E(() => n?.focus()));
|
|
32
33
|
}, w = () => {
|
|
33
34
|
e.setFilterQuery(""), n?.focus();
|
|
34
35
|
}, h = (v) => {
|
|
@@ -39,18 +40,18 @@ function ie(r) {
|
|
|
39
40
|
return R(() => {
|
|
40
41
|
r.filterInputRef && n && r.filterInputRef(n);
|
|
41
42
|
}), (() => {
|
|
42
|
-
var v =
|
|
43
|
-
return
|
|
43
|
+
var v = X(), x = v.firstChild, b = x.nextSibling, p = b.nextSibling, y = p.nextSibling, k = y.nextSibling;
|
|
44
|
+
return A(x, "click", e.toggleSidebar, !0), o(x, l(O, {
|
|
44
45
|
class: "w-4 h-4"
|
|
45
|
-
})),
|
|
46
|
+
})), A(b, "click", e.navigateUp, !0), o(b, l(J, {
|
|
46
47
|
class: "w-4 h-4"
|
|
47
|
-
})), o(p, l(
|
|
48
|
+
})), o(p, l(T, {})), o(y, l(M, {
|
|
48
49
|
get when() {
|
|
49
50
|
return e.isFilterActive();
|
|
50
51
|
},
|
|
51
52
|
get fallback() {
|
|
52
53
|
return (() => {
|
|
53
|
-
var t =
|
|
54
|
+
var t = Z();
|
|
54
55
|
return t.$$click = m, o(t, l(j, {
|
|
55
56
|
class: "w-4 h-4"
|
|
56
57
|
})), s(() => d(t, f("flex items-center justify-center w-7 h-7 rounded cursor-pointer", "transition-colors duration-100", "hover:bg-muted/70", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"))), t;
|
|
@@ -62,13 +63,13 @@ function ie(r) {
|
|
|
62
63
|
class: "w-3.5 h-3.5 text-muted-foreground flex-shrink-0"
|
|
63
64
|
}), a), a.addEventListener("blur", I), a.$$keydown = h, a.$$input = (i) => e.setFilterQuery(i.currentTarget.value), S((i) => {
|
|
64
65
|
n = i, r.filterInputRef && r.filterInputRef(i);
|
|
65
|
-
}, a), o(t, l(
|
|
66
|
+
}, a), o(t, l(M, {
|
|
66
67
|
get when() {
|
|
67
68
|
return e.filterQuery();
|
|
68
69
|
},
|
|
69
70
|
get children() {
|
|
70
71
|
var i = H();
|
|
71
|
-
return i.$$click = w, o(i, l(
|
|
72
|
+
return i.$$click = w, o(i, l(W, {
|
|
72
73
|
class: "w-3 h-3"
|
|
73
74
|
})), s(() => d(i, f("flex items-center justify-center w-4 h-4 rounded-sm cursor-pointer", "text-muted-foreground hover:text-foreground", "transition-colors duration-100"))), i;
|
|
74
75
|
}
|
|
@@ -80,7 +81,7 @@ function ie(r) {
|
|
|
80
81
|
return e.viewMode();
|
|
81
82
|
},
|
|
82
83
|
onClick: () => e.setViewMode("list"),
|
|
83
|
-
icon:
|
|
84
|
+
icon: z,
|
|
84
85
|
label: "List view"
|
|
85
86
|
}), null), o(k, l(B, {
|
|
86
87
|
mode: "grid",
|
|
@@ -88,7 +89,7 @@ function ie(r) {
|
|
|
88
89
|
return e.viewMode();
|
|
89
90
|
},
|
|
90
91
|
onClick: () => e.setViewMode("grid"),
|
|
91
|
-
icon:
|
|
92
|
+
icon: V,
|
|
92
93
|
label: "Grid view"
|
|
93
94
|
}), null), s((t) => {
|
|
94
95
|
var a = f("flex items-center gap-2 px-2 py-1.5 border-b border-border", "bg-background/50 backdrop-blur-sm", r.class), i = f("md:hidden flex items-center justify-center w-7 h-7 rounded cursor-pointer", "transition-colors duration-100", "hover:bg-muted/70", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", !e.sidebarCollapsed() && "bg-muted/50"), $ = !c(), F = f("flex items-center justify-center w-7 h-7 rounded cursor-pointer", "transition-colors duration-100", "hover:bg-muted/70", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent"), _ = f("flex-1 min-w-0 overflow-hidden transition-all duration-200", e.isFilterActive() && "hidden sm:block sm:flex-1"), C = f("flex items-center gap-1 transition-all duration-200 ease-out", e.isFilterActive() ? "flex-1 sm:flex-none sm:w-48" : "w-7");
|
|
@@ -106,7 +107,7 @@ function ie(r) {
|
|
|
106
107
|
function B(r) {
|
|
107
108
|
const e = () => r.currentMode === r.mode;
|
|
108
109
|
return (() => {
|
|
109
|
-
var n =
|
|
110
|
+
var n = q();
|
|
110
111
|
return n.$$click = () => r.onClick(), o(n, l(r.icon, {
|
|
111
112
|
class: "w-3.5 h-3.5"
|
|
112
113
|
})), s((c) => {
|
|
@@ -121,5 +122,5 @@ function B(r) {
|
|
|
121
122
|
}
|
|
122
123
|
Q(["click", "input", "keydown"]);
|
|
123
124
|
export {
|
|
124
|
-
|
|
125
|
+
le as FileBrowserToolbar
|
|
125
126
|
};
|