@floegence/floe-webapp-core 0.35.13 → 0.35.15
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/deck/WidgetResizeHandle.js +34 -33
- package/dist/components/file-browser/FileBrowser.js +77 -70
- package/dist/components/file-browser/FileBrowserContext.js +141 -140
- package/dist/components/file-browser/types.d.ts +1 -0
- package/dist/components/layout/ActivityBar.js +21 -21
- package/dist/components/layout/MobileTabBar.js +12 -12
- package/dist/components/layout/ResizeHandle.d.ts +2 -0
- package/dist/components/layout/ResizeHandle.js +38 -37
- package/dist/components/layout/Shell.js +164 -140
- package/dist/components/layout/Sidebar.js +8 -8
- package/dist/components/layout/SidebarPane.d.ts +2 -0
- package/dist/components/layout/SidebarPane.js +22 -16
- package/dist/components/ui/CommandPalette.js +47 -46
- package/dist/components/ui/FloatingWindow.d.ts +5 -1
- package/dist/components/ui/FloatingWindow.js +267 -194
- package/dist/components/ui/floatingWindowGeometry.d.ts +41 -0
- package/dist/components/ui/floatingWindowGeometry.js +65 -0
- package/dist/context/FileBrowserDragContext.js +45 -43
- package/dist/context/LayoutContext.d.ts +1 -0
- package/dist/context/LayoutContext.js +20 -19
- package/dist/floe.css +19 -0
- package/dist/hooks/useDeckDrag.js +39 -35
- package/dist/hooks/useFileBrowserDrag.js +74 -81
- package/dist/styles.css +1 -1
- package/dist/utils/hotInteraction.d.ts +9 -0
- package/dist/utils/hotInteraction.js +34 -0
- package/package.json +10 -10
- package/LICENSE +0 -21
|
@@ -1,149 +1,142 @@
|
|
|
1
|
-
import { createSignal as x, createEffect as q, onCleanup as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
l?.(), l = null;
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
l?.(), l = V({ cursor: "grabbing", "user-select": "none" });
|
|
16
|
-
}, v = () => {
|
|
17
|
-
s !== null && (cancelAnimationFrame(s), s = null), _(), c = null, d = null, h = !1, I = null, R(!1), T(!1);
|
|
18
|
-
}, w = () => {
|
|
1
|
+
import { createSignal as x, createEffect as q, onCleanup as G } from "solid-js";
|
|
2
|
+
import { useFileBrowserDrag as y } from "../context/FileBrowserDragContext.js";
|
|
3
|
+
const Y = 5, k = 500, V = 10, i = 48, C = 24;
|
|
4
|
+
function J(n) {
|
|
5
|
+
const e = y(), [m, T] = x(!1);
|
|
6
|
+
let l = null, h = 0, P = 0, g = 0, u = 0, d = null, s = null, c = null, p = !1, f = "mouse", D = null;
|
|
7
|
+
const _ = () => (n.enabled?.() ?? !0) && !!e, I = () => {
|
|
8
|
+
c !== null && (clearTimeout(c), c = null);
|
|
9
|
+
}, L = () => {
|
|
10
|
+
s !== null && (cancelAnimationFrame(s), s = null), I(), l = null, d = null, p = !1, D = null, T(!1);
|
|
11
|
+
}, X = () => {
|
|
19
12
|
if (!e) return;
|
|
20
13
|
const t = e.getInstances();
|
|
21
14
|
for (const [, a] of t) {
|
|
22
15
|
const o = a.getScrollContainer();
|
|
23
|
-
o &&
|
|
16
|
+
o && R(o, g, u);
|
|
24
17
|
const r = a.getSidebarScrollContainer();
|
|
25
|
-
r &&
|
|
18
|
+
r && R(r, g, u);
|
|
26
19
|
}
|
|
27
|
-
},
|
|
28
|
-
const r =
|
|
29
|
-
if (
|
|
20
|
+
}, R = (t, a, o) => {
|
|
21
|
+
const r = D?.get(t) ?? t.getBoundingClientRect();
|
|
22
|
+
if (D?.set(t, r), a < r.left || a > r.right || o < r.top || o > r.bottom)
|
|
30
23
|
return;
|
|
31
|
-
const
|
|
32
|
-
let
|
|
33
|
-
if (
|
|
34
|
-
const S = Math.max(0, Math.min(t.scrollTop +
|
|
24
|
+
const M = o - r.top, H = r.bottom - o, O = a - r.left, A = r.right - a;
|
|
25
|
+
let v = 0, E = 0;
|
|
26
|
+
if (M < i ? v = -Math.ceil((i - M) / i * C) : H < i && (v = Math.ceil((i - H) / i * C)), O < i ? E = -Math.ceil((i - O) / i * C) : A < i && (E = Math.ceil((i - A) / i * C)), v !== 0) {
|
|
27
|
+
const S = Math.max(0, Math.min(t.scrollTop + v, t.scrollHeight - t.clientHeight));
|
|
35
28
|
S !== t.scrollTop && (t.scrollTop = S);
|
|
36
29
|
}
|
|
37
|
-
if (
|
|
38
|
-
const S = Math.max(0, Math.min(t.scrollLeft +
|
|
30
|
+
if (E !== 0) {
|
|
31
|
+
const S = Math.max(0, Math.min(t.scrollLeft + E, t.scrollWidth - t.clientWidth));
|
|
39
32
|
S !== t.scrollLeft && (t.scrollLeft = S);
|
|
40
33
|
}
|
|
41
|
-
},
|
|
34
|
+
}, w = () => {
|
|
42
35
|
if (s !== null) return;
|
|
43
36
|
const t = () => {
|
|
44
|
-
if (
|
|
37
|
+
if (l === null || !m()) {
|
|
45
38
|
s = null;
|
|
46
39
|
return;
|
|
47
40
|
}
|
|
48
|
-
|
|
41
|
+
X(), s = requestAnimationFrame(t);
|
|
49
42
|
};
|
|
50
43
|
s = requestAnimationFrame(t);
|
|
51
|
-
},
|
|
44
|
+
}, b = () => {
|
|
52
45
|
if (!e || !d) return;
|
|
53
|
-
|
|
46
|
+
D = /* @__PURE__ */ new Map(), n.isSelected(d.id) || n.selectItem(d.id, !1);
|
|
54
47
|
const t = n.getSelectedItems(), o = (t.length > 0 && n.isSelected(d.id) ? t : [d]).map((r) => ({
|
|
55
48
|
item: r,
|
|
56
49
|
sourceInstanceId: n.instanceId,
|
|
57
50
|
sourcePath: n.currentPath()
|
|
58
51
|
}));
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
if (
|
|
52
|
+
T(!0), e.startDrag(o, g, u), n.onDragStart?.(), w();
|
|
53
|
+
}, B = (t, a) => {
|
|
54
|
+
_() && l === null && (t.pointerType === "mouse" && t.button !== 0 || (l = t.pointerId, f = t.pointerType, h = t.clientX, P = t.clientY, g = h, u = P, d = a, p = !1, t.currentTarget.setPointerCapture(t.pointerId), (f === "touch" || f === "pen") && (I(), c = setTimeout(() => {
|
|
55
|
+
if (l !== null && d) {
|
|
56
|
+
if (p = !0, "vibrate" in navigator)
|
|
64
57
|
try {
|
|
65
58
|
navigator.vibrate(50);
|
|
66
59
|
} catch {
|
|
67
60
|
}
|
|
68
|
-
|
|
61
|
+
b();
|
|
69
62
|
}
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
const a =
|
|
75
|
-
if ((
|
|
76
|
-
|
|
63
|
+
}, k))));
|
|
64
|
+
}, F = (t) => {
|
|
65
|
+
if (l !== t.pointerId) return;
|
|
66
|
+
g = t.clientX, u = t.clientY;
|
|
67
|
+
const a = g - h, o = u - P, r = Math.sqrt(a * a + o * o);
|
|
68
|
+
if ((f === "touch" || f === "pen") && !p && r > V) {
|
|
69
|
+
I(), L();
|
|
77
70
|
return;
|
|
78
71
|
}
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
if (
|
|
72
|
+
f === "mouse" && !m() && r > Y && b(), m() && e && e.updateDrag(g, u);
|
|
73
|
+
}, U = (t) => {
|
|
74
|
+
if (l === t.pointerId) {
|
|
82
75
|
try {
|
|
83
76
|
t.currentTarget?.releasePointerCapture(t.pointerId);
|
|
84
77
|
} catch {
|
|
85
78
|
}
|
|
86
|
-
|
|
79
|
+
m() && e && e.endDrag(!0), L();
|
|
87
80
|
}
|
|
88
81
|
}, N = (t) => {
|
|
89
|
-
|
|
82
|
+
l === t.pointerId && (m() && e && e.endDrag(!1), L());
|
|
90
83
|
};
|
|
91
84
|
return q(() => {
|
|
92
|
-
if (!
|
|
93
|
-
const t = (r) =>
|
|
94
|
-
document.addEventListener("pointermove", t, !0), document.addEventListener("pointerup", a, !0), document.addEventListener("pointercancel", o, !0),
|
|
95
|
-
|
|
85
|
+
if (!_() || typeof document > "u") return;
|
|
86
|
+
const t = (r) => F(r), a = (r) => U(r), o = (r) => N(r);
|
|
87
|
+
document.addEventListener("pointermove", t, !0), document.addEventListener("pointerup", a, !0), document.addEventListener("pointercancel", o, !0), G(() => {
|
|
88
|
+
L(), document.removeEventListener("pointermove", t, !0), document.removeEventListener("pointerup", a, !0), document.removeEventListener("pointercancel", o, !0);
|
|
96
89
|
});
|
|
97
90
|
}), {
|
|
98
|
-
isDragging:
|
|
91
|
+
isDragging: m,
|
|
99
92
|
getDragHandlers: (t) => ({
|
|
100
|
-
onPointerDown: (a) =>
|
|
93
|
+
onPointerDown: (a) => B(a, t),
|
|
101
94
|
"data-draggable": "true"
|
|
102
95
|
})
|
|
103
96
|
};
|
|
104
97
|
}
|
|
105
|
-
function
|
|
106
|
-
const e =
|
|
107
|
-
if (!
|
|
108
|
-
const
|
|
109
|
-
return
|
|
110
|
-
|
|
98
|
+
function K(n) {
|
|
99
|
+
const e = y(), [m, T] = x(!1), l = () => (n.enabled?.() ?? !0) && !!e, h = () => m() ? e?.dragState()?.isDragging ?? !1 : !1, P = () => {
|
|
100
|
+
if (!h() || !e) return !1;
|
|
101
|
+
const s = e.dragState();
|
|
102
|
+
return s.isDragging ? e.canDropOn(
|
|
103
|
+
s.draggedItems,
|
|
111
104
|
n.targetPath(),
|
|
112
105
|
n.targetItem(),
|
|
113
106
|
n.instanceId
|
|
114
107
|
) : !1;
|
|
115
|
-
},
|
|
116
|
-
if (!
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
108
|
+
}, g = (s) => {
|
|
109
|
+
if (!l() || !e) return;
|
|
110
|
+
const c = e.dragState();
|
|
111
|
+
if (!c.isDragging) return;
|
|
119
112
|
T(!0);
|
|
120
|
-
const
|
|
113
|
+
const p = n.targetPath(), f = n.targetItem(), D = e.canDropOn(c.draggedItems, p, f, n.instanceId), I = s.currentTarget?.getBoundingClientRect() ?? null;
|
|
121
114
|
e.setDropTarget(
|
|
122
115
|
{
|
|
123
116
|
instanceId: n.instanceId,
|
|
124
|
-
targetPath:
|
|
125
|
-
targetItem:
|
|
117
|
+
targetPath: p,
|
|
118
|
+
targetItem: f
|
|
126
119
|
},
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
D,
|
|
121
|
+
I
|
|
129
122
|
);
|
|
130
|
-
},
|
|
123
|
+
}, u = (s) => {
|
|
131
124
|
if (!e) return;
|
|
132
125
|
T(!1);
|
|
133
|
-
const
|
|
134
|
-
|
|
126
|
+
const c = e.dragState();
|
|
127
|
+
c.isDragging && c.dropTarget?.instanceId === n.instanceId && c.dropTarget.targetPath === n.targetPath() && e.setDropTarget(null, !1);
|
|
135
128
|
};
|
|
136
129
|
return {
|
|
137
|
-
isDropTarget:
|
|
130
|
+
isDropTarget: h,
|
|
138
131
|
isValidDrop: P,
|
|
139
132
|
getDropTargetProps: () => ({
|
|
140
|
-
onPointerEnter:
|
|
141
|
-
onPointerLeave:
|
|
133
|
+
onPointerEnter: g,
|
|
134
|
+
onPointerLeave: u,
|
|
142
135
|
"data-drop-target": "true"
|
|
143
136
|
})
|
|
144
137
|
};
|
|
145
138
|
}
|
|
146
139
|
export {
|
|
147
|
-
|
|
148
|
-
|
|
140
|
+
K as useFileBrowserDropTarget,
|
|
141
|
+
J as useFileBrowserItemDrag
|
|
149
142
|
};
|