@floegence/floe-webapp-core 0.35.49 → 0.35.51
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/FileContextMenu.d.ts +7 -0
- package/dist/components/file-browser/FileContextMenu.js +185 -157
- package/dist/components/file-browser/FileGridView.js +64 -63
- package/dist/components/file-browser/FileListView.js +27 -26
- package/dist/components/file-browser/useFileBrowserMarqueeSelection.d.ts +23 -1
- package/dist/components/file-browser/useFileBrowserMarqueeSelection.js +79 -55
- package/dist/components/notes/NotesBoardNote.js +66 -63
- package/dist/components/notes/useNotesOverlayModel.js +390 -339
- package/package.json +1 -1
|
@@ -1,69 +1,93 @@
|
|
|
1
|
-
import { createSignal as
|
|
2
|
-
import { isPrimaryModKeyPressed as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const
|
|
1
|
+
import { createSignal as S, createMemo as b, onCleanup as w } from "solid-js";
|
|
2
|
+
import { isPrimaryModKeyPressed as M } from "../../utils/keybind.js";
|
|
3
|
+
const y = 4, A = "pointer-events-none absolute z-40 rounded-md floe-file-browser-marquee-overlay";
|
|
4
|
+
function T(e, n, c, o) {
|
|
5
|
+
const l = Math.min(e, c), u = Math.min(n, o);
|
|
6
6
|
return {
|
|
7
|
-
left:
|
|
8
|
-
top:
|
|
9
|
-
width: Math.abs(
|
|
7
|
+
left: l,
|
|
8
|
+
top: u,
|
|
9
|
+
width: Math.abs(c - e),
|
|
10
10
|
height: Math.abs(o - n)
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return !(
|
|
13
|
+
function O(e, n) {
|
|
14
|
+
return !(e.left + e.width < n.left || n.right < e.left || e.top + e.height < n.top || n.bottom < e.top);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return !(!(
|
|
16
|
+
function P(e) {
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
function x(e) {
|
|
20
|
+
const n = e.getBoundingClientRect();
|
|
21
|
+
return {
|
|
22
|
+
left: n.left,
|
|
23
|
+
top: n.top,
|
|
24
|
+
scrollLeft: e.scrollLeft,
|
|
25
|
+
scrollTop: e.scrollTop,
|
|
26
|
+
clientLeft: e.clientLeft,
|
|
27
|
+
clientTop: e.clientTop
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function C(e, n) {
|
|
31
|
+
return {
|
|
32
|
+
left: e.left - n.left + n.scrollLeft - n.clientLeft,
|
|
33
|
+
top: e.top - n.top + n.scrollTop - n.clientTop,
|
|
34
|
+
width: e.width,
|
|
35
|
+
height: e.height
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function D(e) {
|
|
39
|
+
const [n, c] = S(null);
|
|
40
|
+
let o = null, l = !1, u = [], a = 0, f = 0, s = !1;
|
|
41
|
+
const I = () => {
|
|
42
|
+
typeof document > "u" || (document.removeEventListener("pointermove", p, !0), document.removeEventListener("pointerup", m, !0), document.removeEventListener("pointercancel", h, !0));
|
|
43
|
+
}, d = () => {
|
|
44
|
+
I(), o = null, l = !1, u = [], a = 0, f = 0, s = !1, c(null);
|
|
45
|
+
}, L = (t) => {
|
|
46
|
+
const i = e.getVisibleItemIdsInOrder().filter((R) => {
|
|
47
|
+
const g = e.getElementForId(R);
|
|
48
|
+
return g ? O(t, g.getBoundingClientRect()) : !1;
|
|
49
|
+
}), r = l ? [...u, ...i] : i;
|
|
50
|
+
e.replaceSelection(r, {
|
|
51
|
+
anchorId: l ? void 0 : r[0] ?? null,
|
|
52
|
+
lastInteractedId: r[r.length - 1] ?? null,
|
|
53
|
+
preserveAnchor: l
|
|
35
54
|
});
|
|
36
|
-
},
|
|
37
|
-
if (o !==
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
55
|
+
}, p = (t) => {
|
|
56
|
+
if (o !== t.pointerId) return;
|
|
57
|
+
const i = Math.hypot(t.clientX - a, t.clientY - f);
|
|
58
|
+
if (!s && i < y)
|
|
40
59
|
return;
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
o ===
|
|
46
|
-
}, h = (
|
|
47
|
-
o ===
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
t.preventDefault(), s = !0;
|
|
61
|
+
const r = T(a, f, t.clientX, t.clientY);
|
|
62
|
+
c(r), L(r);
|
|
63
|
+
}, m = (t) => {
|
|
64
|
+
o === t.pointerId && (!s && !l && e.clearSelection(), d());
|
|
65
|
+
}, h = (t) => {
|
|
66
|
+
o === t.pointerId && d();
|
|
67
|
+
}, v = (t) => {
|
|
68
|
+
t.pointerType !== "mouse" || t.button !== 0 || P(t.target) && e.getContainer() && (o = t.pointerId, l = M(t), u = l ? e.getSelectedIds() : [], a = t.clientX, f = t.clientY, s = !1, typeof document < "u" && (document.addEventListener("pointermove", p, !0), document.addEventListener("pointerup", m, !0), document.addEventListener("pointercancel", h, !0)), t.preventDefault());
|
|
69
|
+
}, E = b(() => {
|
|
70
|
+
const t = n();
|
|
71
|
+
if (!t) return null;
|
|
72
|
+
const i = e.getOverlayHost?.() ?? e.getContainer();
|
|
73
|
+
if (!i) return null;
|
|
74
|
+
const r = C(t, x(i));
|
|
75
|
+
return {
|
|
76
|
+
left: `${r.left}px`,
|
|
77
|
+
top: `${r.top}px`,
|
|
78
|
+
width: `${r.width}px`,
|
|
79
|
+
height: `${r.height}px`
|
|
80
|
+
};
|
|
58
81
|
});
|
|
59
|
-
return
|
|
60
|
-
|
|
82
|
+
return w(() => {
|
|
83
|
+
d();
|
|
61
84
|
}), {
|
|
62
|
-
overlayStyle:
|
|
63
|
-
onPointerDown:
|
|
85
|
+
overlayStyle: E,
|
|
86
|
+
onPointerDown: v
|
|
64
87
|
};
|
|
65
88
|
}
|
|
66
89
|
export {
|
|
67
|
-
|
|
68
|
-
|
|
90
|
+
A as FILE_BROWSER_MARQUEE_OVERLAY_CLASS,
|
|
91
|
+
D as createFileBrowserMarqueeSelection,
|
|
92
|
+
C as projectViewportRectToOverlayHost
|
|
69
93
|
};
|
|
@@ -1,101 +1,104 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as j, onCleanup as B, untrack as
|
|
1
|
+
import { insert as u, createComponent as h, memo as N, effect as O, className as z, setAttribute as A, setStyleProperty as b, template as T, delegateEvents as R } from "solid-js/web";
|
|
2
|
+
import { createSignal as j, onCleanup as B, untrack as E, createMemo as w } from "solid-js";
|
|
3
3
|
import { startHotInteraction as G } from "../../utils/hotInteraction.js";
|
|
4
|
-
import { GripVertical as H, Pencil as
|
|
5
|
-
import { notePreviewMetrics as
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { GripVertical as H, Pencil as K, Trash as V, Check as Z } from "../icons/index.js";
|
|
5
|
+
import { notePreviewMetrics as q, getNotePreviewText as J, noteColorClass as Q, samePoint as U } from "./notesOverlayHelpers.js";
|
|
6
|
+
var p = /* @__PURE__ */ T('<article data-floe-geometry-surface=notes-note><div class=notes-note__surface><header class=notes-note__header><button type=button class=notes-note__drag aria-label="Drag note"data-floe-canvas-interactive=true data-floe-notes-front-skip=true></button><div class=notes-note__actions><button type=button class=notes-note__icon-button data-floe-canvas-interactive=true aria-label="Edit note"></button><button type=button class="notes-note__icon-button is-danger"data-floe-canvas-interactive=true data-floe-notes-front-skip=true aria-label="Move note to trash"></button></div></header><button type=button class=notes-note__body data-floe-canvas-interactive=true data-floe-canvas-pan-surface=true><span>'), tt = /* @__PURE__ */ T("<div class=notes-note__copied-state aria-hidden=true><div class=notes-note__copied-pill><span class=notes-note__copied-icon></span><span class=notes-note__copied-copy>Copied");
|
|
7
|
+
const et = '[data-floe-notes-front-skip="true"]';
|
|
8
|
+
function lt(t) {
|
|
9
|
+
const [f, C] = j(null);
|
|
9
10
|
let c;
|
|
10
11
|
B(() => {
|
|
11
|
-
c?.abort(), c = void 0,
|
|
12
|
+
c?.abort(), c = void 0, E(f)?.stopInteraction();
|
|
12
13
|
});
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
x:
|
|
17
|
-
y:
|
|
14
|
+
const $ = w(() => q(t.item)), W = w(() => J(t.item.body, $().preview_limit)), D = w(() => !t.item.body.trim()), x = () => f() !== null, y = w(() => {
|
|
15
|
+
const e = f();
|
|
16
|
+
return e ? {
|
|
17
|
+
x: e.worldX,
|
|
18
|
+
y: e.worldY
|
|
18
19
|
} : {
|
|
19
20
|
x: t.item.x,
|
|
20
21
|
y: t.item.y
|
|
21
22
|
};
|
|
22
|
-
}),
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
25
|
-
const
|
|
26
|
-
x:
|
|
27
|
-
y:
|
|
23
|
+
}), F = (e) => !(e instanceof Element && e.closest(et)), k = (e) => {
|
|
24
|
+
const i = E(f);
|
|
25
|
+
if (!i) return;
|
|
26
|
+
const r = {
|
|
27
|
+
x: i.worldX,
|
|
28
|
+
y: i.worldY
|
|
28
29
|
}, s = {
|
|
29
|
-
x:
|
|
30
|
-
y:
|
|
31
|
-
}, m =
|
|
32
|
-
m && t.onSeedMoveProjection(t.item.note_id,
|
|
33
|
-
},
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
const
|
|
30
|
+
x: i.startWorldX,
|
|
31
|
+
y: i.startWorldY
|
|
32
|
+
}, m = e && !U(r, s);
|
|
33
|
+
m && t.onSeedMoveProjection(t.item.note_id, r), i.stopInteraction(), C(null), c?.abort(), c = void 0, t.onCommitFront(t.item.note_id), m && t.onCommitMove(t.item.note_id, r);
|
|
34
|
+
}, L = (e) => {
|
|
35
|
+
if (e.button !== 0) return;
|
|
36
|
+
e.preventDefault(), e.stopPropagation(), c?.abort(), t.onStartOptimisticFront(t.item.note_id);
|
|
37
|
+
const i = G({
|
|
37
38
|
kind: "drag",
|
|
38
39
|
cursor: "grabbing"
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
pointerId:
|
|
42
|
-
startClientX:
|
|
43
|
-
startClientY:
|
|
40
|
+
}), r = Math.max(t.viewportScale, 1e-3);
|
|
41
|
+
C({
|
|
42
|
+
pointerId: e.pointerId,
|
|
43
|
+
startClientX: e.clientX,
|
|
44
|
+
startClientY: e.clientY,
|
|
44
45
|
startWorldX: t.item.x,
|
|
45
46
|
startWorldY: t.item.y,
|
|
46
47
|
worldX: t.item.x,
|
|
47
48
|
worldY: t.item.y,
|
|
48
49
|
moved: !1,
|
|
49
|
-
scale:
|
|
50
|
-
stopInteraction:
|
|
50
|
+
scale: r,
|
|
51
|
+
stopInteraction: i
|
|
51
52
|
});
|
|
52
53
|
const s = (a) => {
|
|
53
|
-
|
|
54
|
-
if (!
|
|
55
|
-
const
|
|
54
|
+
C((n) => {
|
|
55
|
+
if (!n || n.pointerId !== a.pointerId) return n;
|
|
56
|
+
const o = n.startWorldX + (a.clientX - n.startClientX) / n.scale, l = n.startWorldY + (a.clientY - n.startClientY) / n.scale;
|
|
56
57
|
return {
|
|
57
|
-
...
|
|
58
|
-
worldX:
|
|
59
|
-
worldY:
|
|
60
|
-
moved:
|
|
58
|
+
...n,
|
|
59
|
+
worldX: o,
|
|
60
|
+
worldY: l,
|
|
61
|
+
moved: n.moved || Math.abs(o - n.startWorldX) > 2 || Math.abs(l - n.startWorldY) > 2
|
|
61
62
|
};
|
|
62
63
|
});
|
|
63
64
|
}, m = (a) => {
|
|
64
|
-
a.pointerId ===
|
|
65
|
-
},
|
|
66
|
-
a.pointerId ===
|
|
65
|
+
a.pointerId === e.pointerId && k(!0);
|
|
66
|
+
}, v = (a) => {
|
|
67
|
+
a.pointerId === e.pointerId && k(!1);
|
|
67
68
|
}, d = new AbortController();
|
|
68
69
|
c = d, window.addEventListener("pointermove", s, {
|
|
69
70
|
signal: d.signal
|
|
70
71
|
}), window.addEventListener("pointerup", m, {
|
|
71
72
|
once: !0,
|
|
72
73
|
signal: d.signal
|
|
73
|
-
}), window.addEventListener("pointercancel",
|
|
74
|
+
}), window.addEventListener("pointercancel", v, {
|
|
74
75
|
once: !0,
|
|
75
76
|
signal: d.signal
|
|
76
77
|
});
|
|
77
78
|
};
|
|
78
79
|
return (() => {
|
|
79
|
-
var
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
},
|
|
80
|
+
var e = p(), i = e.firstChild, r = i.firstChild, s = r.firstChild, m = s.nextSibling, v = m.firstChild, d = v.nextSibling, a = r.nextSibling, n = a.firstChild;
|
|
81
|
+
return e.$$click = (o) => {
|
|
82
|
+
F(o.target) && t.onCommitFront(t.item.note_id);
|
|
83
|
+
}, e.$$contextmenu = (o) => {
|
|
84
|
+
o.preventDefault(), o.stopPropagation(), t.onOpenContextMenu(o, t.item);
|
|
85
|
+
}, s.$$pointerdown = L, u(s, h(H, {
|
|
83
86
|
class: "w-3.5 h-3.5"
|
|
84
|
-
})),
|
|
87
|
+
})), v.$$click = () => t.onOpenEditor(t.item.note_id), u(v, h(K, {
|
|
85
88
|
class: "w-3.5 h-3.5"
|
|
86
|
-
})), d.$$click = () => t.onMoveToTrash(t.item.note_id),
|
|
89
|
+
})), d.$$click = () => t.onMoveToTrash(t.item.note_id), u(d, h(V, {
|
|
87
90
|
class: "w-3.5 h-3.5"
|
|
88
|
-
})), a.$$click = () => t.onCopy(t.item),
|
|
89
|
-
var
|
|
90
|
-
return () =>
|
|
91
|
-
var
|
|
92
|
-
return
|
|
91
|
+
})), a.$$click = () => t.onCopy(t.item), u(n, W), u(i, (() => {
|
|
92
|
+
var o = N(() => !!t.copied);
|
|
93
|
+
return () => o() ? (() => {
|
|
94
|
+
var l = tt(), _ = l.firstChild, g = _.firstChild;
|
|
95
|
+
return u(g, h(Z, {
|
|
93
96
|
class: "w-3.5 h-3.5"
|
|
94
|
-
})),
|
|
97
|
+
})), l;
|
|
95
98
|
})() : null;
|
|
96
|
-
})(), null),
|
|
97
|
-
var
|
|
98
|
-
return
|
|
99
|
+
})(), null), O((o) => {
|
|
100
|
+
var l = `${Q(t.item.color_token)} notes-note notes-note--size-${t.item.size_bucket - 1}`, _ = !!t.copied, g = !!x(), I = t.item.note_id, M = `translate(${y().x}px, ${y().y}px)`, S = `${$().width}px`, X = `${$().height}px`, Y = x() || t.optimisticFront ? `${t.topZIndex + 1}` : `${t.item.z_index}`, P = !!D();
|
|
101
|
+
return l !== o.e && z(e, o.e = l), _ !== o.t && e.classList.toggle("is-copied", o.t = _), g !== o.a && e.classList.toggle("is-dragging", o.a = g), I !== o.o && A(e, "data-floe-notes-note-id", o.o = I), M !== o.i && b(e, "transform", o.i = M), S !== o.n && b(e, "--note-width", o.n = S), X !== o.s && b(e, "--note-height", o.s = X), Y !== o.h && b(e, "z-index", o.h = Y), P !== o.r && a.classList.toggle("is-empty", o.r = P), o;
|
|
99
102
|
}, {
|
|
100
103
|
e: void 0,
|
|
101
104
|
t: void 0,
|
|
@@ -106,10 +109,10 @@ function at(t) {
|
|
|
106
109
|
s: void 0,
|
|
107
110
|
h: void 0,
|
|
108
111
|
r: void 0
|
|
109
|
-
}),
|
|
112
|
+
}), e;
|
|
110
113
|
})();
|
|
111
114
|
}
|
|
112
|
-
|
|
115
|
+
R(["contextmenu", "click", "pointerdown"]);
|
|
113
116
|
export {
|
|
114
|
-
|
|
117
|
+
lt as NotesBoardNote
|
|
115
118
|
};
|