@floegence/floe-webapp-core 0.36.40 → 0.36.41
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.
|
@@ -1,93 +1,99 @@
|
|
|
1
|
-
import { createSignal as
|
|
2
|
-
import { isPrimaryModKeyPressed as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const
|
|
1
|
+
import { createSignal as v, createMemo as w, onCleanup as M } from "solid-js";
|
|
2
|
+
import { isPrimaryModKeyPressed as T } from "../../utils/keybind.js";
|
|
3
|
+
const x = 4, _ = "pointer-events-none absolute z-40 rounded-md floe-file-browser-marquee-overlay";
|
|
4
|
+
function y(e, t, l, r) {
|
|
5
|
+
const i = Math.min(e, l), s = Math.min(t, r);
|
|
6
6
|
return {
|
|
7
|
-
left:
|
|
8
|
-
top:
|
|
9
|
-
width: Math.abs(
|
|
10
|
-
height: Math.abs(
|
|
7
|
+
left: i,
|
|
8
|
+
top: s,
|
|
9
|
+
width: Math.abs(l - e),
|
|
10
|
+
height: Math.abs(r - t)
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return !(e.left + e.width <
|
|
13
|
+
function H(e, t) {
|
|
14
|
+
return !(e.left + e.width < t.left || t.right < e.left || e.top + e.height < t.top || t.bottom < e.top);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function O(e) {
|
|
17
17
|
return !(!(e instanceof Element) || e.closest("[data-file-browser-item-id]") || e.closest('button, input, textarea, select, a, [role="button"], [role="menuitem"]'));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
19
|
+
function P(e) {
|
|
20
|
+
const t = e.getBoundingClientRect(), l = e.offsetWidth, r = e.offsetHeight;
|
|
21
21
|
return {
|
|
22
|
-
left:
|
|
23
|
-
top:
|
|
22
|
+
left: t.left,
|
|
23
|
+
top: t.top,
|
|
24
24
|
scrollLeft: e.scrollLeft,
|
|
25
25
|
scrollTop: e.scrollTop,
|
|
26
26
|
clientLeft: e.clientLeft,
|
|
27
|
-
clientTop: e.clientTop
|
|
27
|
+
clientTop: e.clientTop,
|
|
28
|
+
scaleX: l > 0 && t.width > 0 ? t.width / l : 1,
|
|
29
|
+
scaleY: r > 0 && t.height > 0 ? t.height / r : 1
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
|
-
function
|
|
32
|
+
function I(e) {
|
|
33
|
+
return Number.isFinite(e) && e !== void 0 && e > 0 ? e : 1;
|
|
34
|
+
}
|
|
35
|
+
function B(e, t) {
|
|
36
|
+
const l = I(t.scaleX), r = I(t.scaleY);
|
|
31
37
|
return {
|
|
32
|
-
left: e.left -
|
|
33
|
-
top: e.top -
|
|
34
|
-
width: e.width,
|
|
35
|
-
height: e.height
|
|
38
|
+
left: (e.left - t.left) / l + t.scrollLeft - t.clientLeft,
|
|
39
|
+
top: (e.top - t.top) / r + t.scrollTop - t.clientTop,
|
|
40
|
+
width: e.width / l,
|
|
41
|
+
height: e.height / r
|
|
36
42
|
};
|
|
37
43
|
}
|
|
38
|
-
function
|
|
39
|
-
const [
|
|
40
|
-
let
|
|
41
|
-
const
|
|
42
|
-
typeof document > "u" || (document.removeEventListener("pointermove", p, !0), document.removeEventListener("pointerup",
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
const
|
|
47
|
-
const g = e.getElementForId(
|
|
48
|
-
return g ?
|
|
49
|
-
}),
|
|
50
|
-
e.replaceSelection(
|
|
51
|
-
anchorId:
|
|
52
|
-
lastInteractedId:
|
|
53
|
-
preserveAnchor:
|
|
44
|
+
function A(e) {
|
|
45
|
+
const [t, l] = v(null);
|
|
46
|
+
let r = null, i = !1, s = [], a = 0, d = 0, u = !1;
|
|
47
|
+
const L = () => {
|
|
48
|
+
typeof document > "u" || (document.removeEventListener("pointermove", p, !0), document.removeEventListener("pointerup", h, !0), document.removeEventListener("pointercancel", m, !0));
|
|
49
|
+
}, f = () => {
|
|
50
|
+
L(), r = null, i = !1, s = [], a = 0, d = 0, u = !1, l(null);
|
|
51
|
+
}, E = (n) => {
|
|
52
|
+
const c = e.getVisibleItemIdsInOrder().filter((S) => {
|
|
53
|
+
const g = e.getElementForId(S);
|
|
54
|
+
return g ? H(n, g.getBoundingClientRect()) : !1;
|
|
55
|
+
}), o = i ? [...s, ...c] : c;
|
|
56
|
+
e.replaceSelection(o, {
|
|
57
|
+
anchorId: i ? void 0 : o[0] ?? null,
|
|
58
|
+
lastInteractedId: o[o.length - 1] ?? null,
|
|
59
|
+
preserveAnchor: i
|
|
54
60
|
});
|
|
55
|
-
}, p = (
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
61
|
+
}, p = (n) => {
|
|
62
|
+
if (r !== n.pointerId) return;
|
|
63
|
+
const c = Math.hypot(n.clientX - a, n.clientY - d);
|
|
64
|
+
if (!u && c < x)
|
|
59
65
|
return;
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
74
|
-
const
|
|
66
|
+
n.preventDefault(), u = !0;
|
|
67
|
+
const o = y(a, d, n.clientX, n.clientY);
|
|
68
|
+
l(o), E(o);
|
|
69
|
+
}, h = (n) => {
|
|
70
|
+
r === n.pointerId && (!u && !i && e.clearSelection(), f());
|
|
71
|
+
}, m = (n) => {
|
|
72
|
+
r === n.pointerId && f();
|
|
73
|
+
}, b = (n) => {
|
|
74
|
+
n.pointerType !== "mouse" || n.button !== 0 || O(n.target) && e.getContainer() && (r = n.pointerId, i = T(n), s = i ? e.getSelectedIds() : [], a = n.clientX, d = n.clientY, u = !1, typeof document < "u" && (document.addEventListener("pointermove", p, !0), document.addEventListener("pointerup", h, !0), document.addEventListener("pointercancel", m, !0)), n.preventDefault());
|
|
75
|
+
}, R = w(() => {
|
|
76
|
+
const n = t();
|
|
77
|
+
if (!n) return null;
|
|
78
|
+
const c = e.getOverlayHost?.() ?? e.getContainer();
|
|
79
|
+
if (!c) return null;
|
|
80
|
+
const o = B(n, P(c));
|
|
75
81
|
return {
|
|
76
|
-
left: `${
|
|
77
|
-
top: `${
|
|
78
|
-
width: `${
|
|
79
|
-
height: `${
|
|
82
|
+
left: `${o.left}px`,
|
|
83
|
+
top: `${o.top}px`,
|
|
84
|
+
width: `${o.width}px`,
|
|
85
|
+
height: `${o.height}px`
|
|
80
86
|
};
|
|
81
87
|
});
|
|
82
|
-
return
|
|
83
|
-
|
|
88
|
+
return M(() => {
|
|
89
|
+
f();
|
|
84
90
|
}), {
|
|
85
|
-
overlayStyle:
|
|
86
|
-
onPointerDown:
|
|
91
|
+
overlayStyle: R,
|
|
92
|
+
onPointerDown: b
|
|
87
93
|
};
|
|
88
94
|
}
|
|
89
95
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
_ as FILE_BROWSER_MARQUEE_OVERLAY_CLASS,
|
|
97
|
+
A as createFileBrowserMarqueeSelection,
|
|
98
|
+
B as projectViewportRectToOverlayHost
|
|
93
99
|
};
|