@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.
@@ -1,69 +1,93 @@
1
- import { createSignal as R, createMemo as b, onCleanup as y } from "solid-js";
2
- import { isPrimaryModKeyPressed as L } from "../../utils/keybind.js";
3
- const w = 4, G = "pointer-events-none fixed z-40 rounded-md floe-file-browser-marquee-overlay";
4
- function x(t, n, l, o) {
5
- const r = Math.min(t, l), c = Math.min(n, o);
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: r,
8
- top: c,
9
- width: Math.abs(l - t),
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 P(t, n) {
14
- return !(t.left + t.width < n.left || n.right < t.left || t.top + t.height < n.top || n.bottom < t.top);
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 _(t) {
17
- return !(!(t instanceof Element) || t.closest("[data-file-browser-item-id]") || t.closest('button, input, textarea, select, a, [role="button"], [role="menuitem"]'));
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 C(t) {
20
- const [n, l] = R(null);
21
- let o = null, r = !1, c = [], s = 0, a = 0, u = !1;
22
- const g = () => {
23
- typeof document > "u" || (document.removeEventListener("pointermove", m, !0), document.removeEventListener("pointerup", p, !0), document.removeEventListener("pointercancel", h, !0));
24
- }, f = () => {
25
- g(), o = null, r = !1, c = [], s = 0, a = 0, u = !1, l(null);
26
- }, E = (e) => {
27
- const d = t.getVisibleItemIdsInOrder().filter((M) => {
28
- const I = t.getElementForId(M);
29
- return I ? P(e, I.getBoundingClientRect()) : !1;
30
- }), i = r ? [...c, ...d] : d;
31
- t.replaceSelection(i, {
32
- anchorId: r ? void 0 : i[0] ?? null,
33
- lastInteractedId: i[i.length - 1] ?? null,
34
- preserveAnchor: r
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
- }, m = (e) => {
37
- if (o !== e.pointerId) return;
38
- const d = Math.hypot(e.clientX - s, e.clientY - a);
39
- if (!u && d < w)
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
- e.preventDefault(), u = !0;
42
- const i = x(s, a, e.clientX, e.clientY);
43
- l(i), E(i);
44
- }, p = (e) => {
45
- o === e.pointerId && (!u && !r && t.clearSelection(), f());
46
- }, h = (e) => {
47
- o === e.pointerId && f();
48
- }, S = (e) => {
49
- e.pointerType !== "mouse" || e.button !== 0 || _(e.target) && t.getContainer() && (o = e.pointerId, r = L(e), c = r ? t.getSelectedIds() : [], s = e.clientX, a = e.clientY, u = !1, typeof document < "u" && (document.addEventListener("pointermove", m, !0), document.addEventListener("pointerup", p, !0), document.addEventListener("pointercancel", h, !0)), e.preventDefault());
50
- }, v = b(() => {
51
- const e = n();
52
- return e ? {
53
- left: `${e.left}px`,
54
- top: `${e.top}px`,
55
- width: `${e.width}px`,
56
- height: `${e.height}px`
57
- } : null;
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 y(() => {
60
- f();
82
+ return w(() => {
83
+ d();
61
84
  }), {
62
- overlayStyle: v,
63
- onPointerDown: S
85
+ overlayStyle: E,
86
+ onPointerDown: v
64
87
  };
65
88
  }
66
89
  export {
67
- G as FILE_BROWSER_MARQUEE_OVERLAY_CLASS,
68
- C as createFileBrowserMarqueeSelection
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 v, createComponent as b, memo as z, effect as F, className as N, setAttribute as A, setStyleProperty as h, template as D, delegateEvents as O } from "solid-js/web";
2
- import { createSignal as j, onCleanup as B, untrack as W, createMemo as w } from "solid-js";
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 V, Trash as Z, Check as q } from "../icons/index.js";
5
- import { notePreviewMetrics as J, getNotePreviewText as K, noteColorClass as Q, samePoint as R } from "./notesOverlayHelpers.js";
6
- var U = /* @__PURE__ */ D('<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></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 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>'), p = /* @__PURE__ */ D("<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
- function at(t) {
8
- const [g, $] = j(null);
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, W(g)?.stopInteraction();
12
+ c?.abort(), c = void 0, E(f)?.stopInteraction();
12
13
  });
13
- const C = w(() => J(t.item)), L = w(() => K(t.item.body, C().preview_limit)), E = w(() => !t.item.body.trim()), x = () => g() !== null, y = w(() => {
14
- const o = g();
15
- return o ? {
16
- x: o.worldX,
17
- y: o.worldY
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
- }), I = (o) => {
23
- const n = W(g);
24
- if (!n) return;
25
- const l = {
26
- x: n.worldX,
27
- y: n.worldY
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: n.startWorldX,
30
- y: n.startWorldY
31
- }, m = o && !R(l, s);
32
- m && t.onSeedMoveProjection(t.item.note_id, l), n.stopInteraction(), $(null), c?.abort(), c = void 0, t.onCommitFront(t.item.note_id), m && t.onCommitMove(t.item.note_id, l);
33
- }, T = (o) => {
34
- if (o.button !== 0) return;
35
- o.preventDefault(), o.stopPropagation(), c?.abort(), t.onStartOptimisticFront(t.item.note_id);
36
- const n = G({
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
- }), l = Math.max(t.viewportScale, 1e-3);
40
- $({
41
- pointerId: o.pointerId,
42
- startClientX: o.clientX,
43
- startClientY: o.clientY,
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: l,
50
- stopInteraction: n
50
+ scale: r,
51
+ stopInteraction: i
51
52
  });
52
53
  const s = (a) => {
53
- $((i) => {
54
- if (!i || i.pointerId !== a.pointerId) return i;
55
- const e = i.startWorldX + (a.clientX - i.startClientX) / i.scale, r = i.startWorldY + (a.clientY - i.startClientY) / i.scale;
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
- ...i,
58
- worldX: e,
59
- worldY: r,
60
- moved: i.moved || Math.abs(e - i.startWorldX) > 2 || Math.abs(r - i.startWorldY) > 2
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 === o.pointerId && I(!0);
65
- }, u = (a) => {
66
- a.pointerId === o.pointerId && I(!1);
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", u, {
74
+ }), window.addEventListener("pointercancel", v, {
74
75
  once: !0,
75
76
  signal: d.signal
76
77
  });
77
78
  };
78
79
  return (() => {
79
- var o = U(), n = o.firstChild, l = n.firstChild, s = l.firstChild, m = s.nextSibling, u = m.firstChild, d = u.nextSibling, a = l.nextSibling, i = a.firstChild;
80
- return o.$$click = () => t.onCommitFront(t.item.note_id), o.$$contextmenu = (e) => {
81
- e.preventDefault(), e.stopPropagation(), t.onOpenContextMenu(e, t.item);
82
- }, s.$$pointerdown = T, v(s, b(H, {
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
- })), u.$$click = () => t.onOpenEditor(t.item.note_id), v(u, b(V, {
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), v(d, b(Z, {
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), v(i, L), v(n, (() => {
89
- var e = z(() => !!t.copied);
90
- return () => e() ? (() => {
91
- var r = p(), f = r.firstChild, _ = f.firstChild;
92
- return v(_, b(q, {
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
- })), r;
97
+ })), l;
95
98
  })() : null;
96
- })(), null), F((e) => {
97
- var r = `${Q(t.item.color_token)} notes-note notes-note--size-${t.item.size_bucket - 1}`, f = !!t.copied, _ = !!x(), M = t.item.note_id, X = `translate(${y().x}px, ${y().y}px)`, Y = `${C().width}px`, k = `${C().height}px`, S = x() || t.optimisticFront ? `${t.topZIndex + 1}` : `${t.item.z_index}`, P = !!E();
98
- return r !== e.e && N(o, e.e = r), f !== e.t && o.classList.toggle("is-copied", e.t = f), _ !== e.a && o.classList.toggle("is-dragging", e.a = _), M !== e.o && A(o, "data-floe-notes-note-id", e.o = M), X !== e.i && h(o, "transform", e.i = X), Y !== e.n && h(o, "--note-width", e.n = Y), k !== e.s && h(o, "--note-height", e.s = k), S !== e.h && h(o, "z-index", e.h = S), P !== e.r && a.classList.toggle("is-empty", e.r = P), e;
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
- }), o;
112
+ }), e;
110
113
  })();
111
114
  }
112
- O(["contextmenu", "click", "pointerdown"]);
115
+ R(["contextmenu", "click", "pointerdown"]);
113
116
  export {
114
- at as NotesBoardNote
117
+ lt as NotesBoardNote
115
118
  };