@floegence/floe-webapp-core 0.96.0 → 0.97.1
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/notes/useNotesOverlayModel.d.ts +3 -1
- package/dist/components/notes/useNotesOverlayModel.js +63 -63
- package/dist/components/ui/ContextMenuActions.d.ts +5 -0
- package/dist/components/ui/ContextMenuActions.js +140 -136
- package/dist/components/ui/SurfaceAnchoredLayer.d.ts +2 -0
- package/dist/components/ui/SurfaceAnchoredLayer.js +61 -61
- package/dist/components/ui/contextSource.d.ts +7 -1
- package/dist/components/ui/contextSource.js +54 -31
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/components/workbench/WorkbenchSurface.js +48 -45
- package/dist/full.js +572 -571
- package/dist/styles.css +1 -1
- package/dist/ui.css +11 -1
- package/dist/ui.js +178 -177
- package/package.json +1 -1
|
@@ -167,7 +167,9 @@ export declare function useNotesOverlayModel(options: UseNotesOverlayModelOption
|
|
|
167
167
|
id: string;
|
|
168
168
|
kind: "action";
|
|
169
169
|
label: string;
|
|
170
|
-
icon: (
|
|
170
|
+
icon: (props: {
|
|
171
|
+
class?: string;
|
|
172
|
+
}) => JSX.Element;
|
|
171
173
|
disabled: boolean | undefined;
|
|
172
174
|
onSelect: () => void;
|
|
173
175
|
})[]>;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { useContextMenuActions as go } from "../ui/ContextMenuActions.js";
|
|
2
|
-
import { createSignal as l, createMemo as i, createEffect as p, onCleanup as Q, untrack as
|
|
3
|
-
import { useMobileLayout as
|
|
4
|
-
import { Paste as No, Plus as
|
|
5
|
-
import { NOTES_CONTEXT_MENU_WIDTH_PX as
|
|
6
|
-
import { samePoint as
|
|
7
|
-
import { numberNotesInTopic as
|
|
8
|
-
import { normalizeNotesSnapshot as
|
|
9
|
-
import { useNotification as
|
|
10
|
-
const
|
|
1
|
+
import { useContextMenuActions as go, ContextMenuActionIcon as yo } from "../ui/ContextMenuActions.js";
|
|
2
|
+
import { createSignal as l, createMemo as i, createEffect as p, onCleanup as Q, untrack as xe } from "solid-js";
|
|
3
|
+
import { useMobileLayout as xo } from "../../context/LayoutContext.js";
|
|
4
|
+
import { Paste as No, Plus as bo, Trash as Co } from "../icons/index.js";
|
|
5
|
+
import { NOTES_CONTEXT_MENU_WIDTH_PX as Mo, estimateNotesContextMenuHeight as _o } from "./NotesContextMenu.js";
|
|
6
|
+
import { samePoint as Ne, resolveFrameSize as J, resolveOverviewBounds as Po, createOverviewItem as Io, clamp as P, createContextMenuPosition as So, getNormalizedOverviewPoint as ft, normalizeNoteText as mt, findTrashTopicNoteCount as ko, hasLiveNotesForTopic as Do, NOTES_CANVAS_ZOOM_STEP as ht, resolveCenteredViewport as Oo } from "./notesOverlayHelpers.js";
|
|
7
|
+
import { numberNotesInTopic as Xo, resolveNotesDigitSequence as ee } from "./notesNumbering.js";
|
|
8
|
+
import { normalizeNotesSnapshot as Yo, groupTrashItems as Lo, visibleWorldRect as Ro, computeBoardBounds as Eo } from "./types.js";
|
|
9
|
+
import { useNotification as Fo } from "../../context/NotificationContext.js";
|
|
10
|
+
const Ao = 650;
|
|
11
11
|
function h(r) {
|
|
12
12
|
return r instanceof Error ? r.message : String(r);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const s =
|
|
14
|
+
function Uo(r) {
|
|
15
|
+
const s = Fo();
|
|
16
16
|
let be = 1, te = /* @__PURE__ */ new Set();
|
|
17
|
-
const F = /* @__PURE__ */ new Map(),
|
|
18
|
-
let O,
|
|
19
|
-
const u = i(() =>
|
|
17
|
+
const F = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), [Ce, wt] = l(), [I, vt] = l({ width: 0, height: 0 }), [v, d] = l(null), [Me, _e] = l(""), [z, Pe] = l(null), [Ie, oe] = l(""), [B, S] = l(null), [ne, Se] = l(""), [ke, De] = l(""), [Oe, Xe] = l("amber"), [re, Ye] = l(!1), [Le, Re] = l(!1), [V, Ee] = l(null), [ie, ce] = l(""), [Tt, C] = l(null), [k, se] = l(""), [gt, yt] = l(Date.now()), xt = xo(), [Fe, T] = l(null), [Nt, Ae] = l(null), [ze, D] = l(null), [Be, j] = l(/* @__PURE__ */ new Map());
|
|
18
|
+
let O, x, ae, le = null;
|
|
19
|
+
const u = i(() => Yo(r.controller.snapshot())), N = i(
|
|
20
20
|
() => u().topics.filter((e) => e.deleted_at_unix_ms <= 0)
|
|
21
|
-
), bt = i(() =>
|
|
21
|
+
), bt = i(() => N().length), b = i(() => {
|
|
22
22
|
const e = r.controller.activeTopicID();
|
|
23
|
-
return
|
|
23
|
+
return N().some((t) => t.topic_id === e) ? e : N()[0]?.topic_id ?? "";
|
|
24
24
|
}), X = i(
|
|
25
|
-
() =>
|
|
25
|
+
() => N().find((e) => e.topic_id === b())
|
|
26
26
|
), Ct = i(() => {
|
|
27
27
|
const e = Be();
|
|
28
28
|
return u().items.map((t) => {
|
|
29
29
|
const o = e.get(t.note_id);
|
|
30
|
-
return !o ||
|
|
30
|
+
return !o || Ne({ x: t.x, y: t.y }, o) ? t : {
|
|
31
31
|
...t,
|
|
32
32
|
x: o.x,
|
|
33
33
|
y: o.y
|
|
@@ -36,18 +36,18 @@ function Go(r) {
|
|
|
36
36
|
}), $ = i(
|
|
37
37
|
() => Ct().filter((e) => e.topic_id === b())
|
|
38
38
|
), Y = i(
|
|
39
|
-
() =>
|
|
39
|
+
() => Xo(u().items, b())
|
|
40
40
|
), Mt = i(
|
|
41
41
|
() => new Map(Y().map((e) => [e.item.note_id, e.label]))
|
|
42
|
-
), _t = i(() =>
|
|
42
|
+
), _t = i(() => Lo(u().trash_items)), Ve = i(() => u().trash_items.length), Pt = i(() => u().items.length), It = i(
|
|
43
43
|
() => $().reduce((e, t) => Math.max(e, t.z_index), 1)
|
|
44
|
-
), g = i(() =>
|
|
44
|
+
), g = i(() => ze() ?? r.controller.viewport()), St = i(() => X()?.name ?? "No topic"), kt = i(() => `${Math.round(g().scale * 100)}%`), Dt = i(() => {
|
|
45
45
|
const e = J(I());
|
|
46
|
-
return
|
|
46
|
+
return Ro(g(), e.width, e.height);
|
|
47
47
|
}), W = i(
|
|
48
|
-
() =>
|
|
48
|
+
() => Po(Eo($()), Dt())
|
|
49
49
|
), Ot = i(
|
|
50
|
-
() => $().map((e) =>
|
|
50
|
+
() => $().map((e) => Io(e, W()))
|
|
51
51
|
), je = i(() => {
|
|
52
52
|
const e = W(), t = J(I()), o = g(), n = -o.x / o.scale, c = -o.y / o.scale, a = t.width / o.scale, f = t.height / o.scale, m = P(n, e.minX, e.maxX), M = P(c, e.minY, e.maxY), _ = P(n + a, e.minX, e.maxX), ye = P(c + f, e.minY, e.maxY), E = Math.max((_ - m) / e.width * 100, 6), y = Math.max((ye - M) / e.height * 100, 8), ut = (m - e.minX) / e.width * 100, pt = (M - e.minY) / e.height * 100;
|
|
53
53
|
return {
|
|
@@ -70,13 +70,13 @@ function Go(r) {
|
|
|
70
70
|
const e = B();
|
|
71
71
|
return e ? u().items.find((t) => t.note_id === e) : void 0;
|
|
72
72
|
}), We = i(
|
|
73
|
-
() => !!(B() || V() ||
|
|
73
|
+
() => !!(B() || V() || z() || v() || re())
|
|
74
74
|
), Yt = i(() => {
|
|
75
75
|
const e = k();
|
|
76
76
|
if (!e) return null;
|
|
77
77
|
const t = ee(e, Y());
|
|
78
78
|
return t.kind !== "pending" ? null : t.exactMatch?.item.note_id ?? null;
|
|
79
|
-
}), de = (e) =>
|
|
79
|
+
}), de = (e) => xe(() => u().items.some((t) => t.note_id === e)), qe = () => {
|
|
80
80
|
const e = be;
|
|
81
81
|
return be += 1, e;
|
|
82
82
|
}, Lt = (e) => {
|
|
@@ -84,11 +84,11 @@ function Go(r) {
|
|
|
84
84
|
return F.set(e, t), t;
|
|
85
85
|
}, Rt = (e) => {
|
|
86
86
|
const t = qe();
|
|
87
|
-
return
|
|
88
|
-
}, He = (e, t) => F.get(e) === t, Ge = (e, t) =>
|
|
87
|
+
return A.set(e, t), t;
|
|
88
|
+
}, He = (e, t) => F.get(e) === t, Ge = (e, t) => A.get(e) === t, ue = (e) => {
|
|
89
89
|
F.delete(e);
|
|
90
90
|
}, pe = (e) => {
|
|
91
|
-
|
|
91
|
+
A.delete(e);
|
|
92
92
|
}, fe = (e) => {
|
|
93
93
|
ue(e), pe(e), q(e), T((t) => t === e ? null : t);
|
|
94
94
|
}, Et = (e) => {
|
|
@@ -96,16 +96,16 @@ function Go(r) {
|
|
|
96
96
|
t.topic_id === e && fe(t.note_id);
|
|
97
97
|
}, Ft = (e) => {
|
|
98
98
|
fe(e), L(), C((t) => t === e ? null : t), d((t) => t?.noteID === e ? null : t), S((t) => t === e ? null : t);
|
|
99
|
-
},
|
|
100
|
-
F.clear(),
|
|
99
|
+
}, At = () => {
|
|
100
|
+
F.clear(), A.clear();
|
|
101
101
|
}, L = () => {
|
|
102
102
|
O !== void 0 && (window.clearTimeout(O), O = void 0);
|
|
103
103
|
}, w = () => {
|
|
104
|
-
|
|
104
|
+
x !== void 0 && (window.clearTimeout(x), x = void 0), se("");
|
|
105
105
|
}, Ue = (e, t) => {
|
|
106
106
|
j((o) => {
|
|
107
107
|
const n = o.get(e);
|
|
108
|
-
if (n &&
|
|
108
|
+
if (n && Ne(n, t)) return o;
|
|
109
109
|
const c = new Map(o);
|
|
110
110
|
return c.set(e, t), c;
|
|
111
111
|
});
|
|
@@ -129,8 +129,8 @@ function Go(r) {
|
|
|
129
129
|
Ye(!0);
|
|
130
130
|
}, Z = () => {
|
|
131
131
|
Pe(null), oe("");
|
|
132
|
-
},
|
|
133
|
-
d(null), U(), R(), G(), H(), j(/* @__PURE__ */ new Map()),
|
|
132
|
+
}, zt = () => {
|
|
133
|
+
d(null), U(), R(), G(), H(), j(/* @__PURE__ */ new Map()), At();
|
|
134
134
|
}, Bt = () => {
|
|
135
135
|
if (v()) {
|
|
136
136
|
d(null);
|
|
@@ -155,9 +155,9 @@ function Go(r) {
|
|
|
155
155
|
r.onClose();
|
|
156
156
|
}, K = (e) => {
|
|
157
157
|
r.controller.setActiveTopicID(e);
|
|
158
|
-
}, Ke = (e) =>
|
|
158
|
+
}, Ke = (e) => Do(u().items, e), Vt = (e, t, o = X()?.topic_id) => {
|
|
159
159
|
if (!o) return null;
|
|
160
|
-
const n =
|
|
160
|
+
const n = N().find((m) => m.topic_id === o);
|
|
161
161
|
if (!n) return null;
|
|
162
162
|
const c = Ce();
|
|
163
163
|
if (!c) return null;
|
|
@@ -216,7 +216,7 @@ function Go(r) {
|
|
|
216
216
|
d(he(e, t));
|
|
217
217
|
}, et = (e) => {
|
|
218
218
|
D(e), r.controller.setViewport(e), D(null);
|
|
219
|
-
}, tt = (e, t, o) =>
|
|
219
|
+
}, tt = (e, t, o) => Oo({
|
|
220
220
|
viewport: g(),
|
|
221
221
|
frame: I(),
|
|
222
222
|
bounds: W(),
|
|
@@ -238,10 +238,10 @@ function Go(r) {
|
|
|
238
238
|
);
|
|
239
239
|
}, we = (e) => {
|
|
240
240
|
if (ae?.abort(), ae = void 0, e) {
|
|
241
|
-
const t =
|
|
241
|
+
const t = ze();
|
|
242
242
|
t && r.controller.setViewport(t);
|
|
243
243
|
}
|
|
244
|
-
D(null),
|
|
244
|
+
D(null), Ae(null);
|
|
245
245
|
}, qt = (e) => {
|
|
246
246
|
if (e.button !== 0 && e.pointerType !== "touch" && e.pointerType !== "pen")
|
|
247
247
|
return;
|
|
@@ -254,7 +254,7 @@ function Go(r) {
|
|
|
254
254
|
centerOffsetX: m ? n.x - c.centerX / 100 : 0,
|
|
255
255
|
centerOffsetY: m ? n.y - c.centerY / 100 : 0
|
|
256
256
|
};
|
|
257
|
-
we(!1), e.preventDefault(), e.stopPropagation(),
|
|
257
|
+
we(!1), e.preventDefault(), e.stopPropagation(), Ae(M), nt(e.clientX, e.clientY, M), t.setPointerCapture?.(e.pointerId);
|
|
258
258
|
const _ = new AbortController();
|
|
259
259
|
ae = _;
|
|
260
260
|
const ye = (y) => {
|
|
@@ -322,16 +322,16 @@ function Go(r) {
|
|
|
322
322
|
s.error("Copy failed", "Clipboard write was not available.");
|
|
323
323
|
}
|
|
324
324
|
}, Ht = (e) => {
|
|
325
|
-
|
|
326
|
-
if (
|
|
325
|
+
x !== void 0 && window.clearTimeout(x), se(e), x = window.setTimeout(() => {
|
|
326
|
+
if (x = void 0, xe(k) !== e) return;
|
|
327
327
|
se("");
|
|
328
|
-
const t = ee(e,
|
|
328
|
+
const t = ee(e, xe(Y));
|
|
329
329
|
if (t.kind === "ready") {
|
|
330
330
|
ve(t.match);
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
t.kind === "pending" && t.exactMatch && ve(t.exactMatch);
|
|
334
|
-
},
|
|
334
|
+
}, Ao);
|
|
335
335
|
}, lt = (e) => {
|
|
336
336
|
const t = ee(e, Y());
|
|
337
337
|
return t.kind === "invalid" ? !1 : t.kind === "ready" ? (w(), ve(t.match), !0) : (Ht(e), !0);
|
|
@@ -426,7 +426,7 @@ function Go(r) {
|
|
|
426
426
|
}, ro = (e) => {
|
|
427
427
|
Pe(e.topic_id), oe(e.name);
|
|
428
428
|
}, io = async () => {
|
|
429
|
-
const e =
|
|
429
|
+
const e = z();
|
|
430
430
|
if (!e) return;
|
|
431
431
|
const t = Ie().trim();
|
|
432
432
|
if (Z(), !!t)
|
|
@@ -436,8 +436,8 @@ function Go(r) {
|
|
|
436
436
|
s.error("Rename failed", h(o));
|
|
437
437
|
}
|
|
438
438
|
}, co = async (e) => {
|
|
439
|
-
const t = Ke(e.topic_id) +
|
|
440
|
-
|
|
439
|
+
const t = Ke(e.topic_id) + ko(u().trash_items, e.topic_id);
|
|
440
|
+
z() === e.topic_id && Z();
|
|
441
441
|
try {
|
|
442
442
|
if (Et(e.topic_id), await r.controller.deleteTopic(e.topic_id) === !1) {
|
|
443
443
|
s.info("Keep one topic", "At least one topic needs to remain available.");
|
|
@@ -469,7 +469,7 @@ function Go(r) {
|
|
|
469
469
|
id: e.id,
|
|
470
470
|
kind: "action",
|
|
471
471
|
label: e.label,
|
|
472
|
-
icon: () => e.icon
|
|
472
|
+
icon: (t) => yo({ icon: e.icon, class: t.class }),
|
|
473
473
|
disabled: e.disabled,
|
|
474
474
|
onSelect: () => {
|
|
475
475
|
d(null), e.onSelect();
|
|
@@ -492,7 +492,7 @@ function Go(r) {
|
|
|
492
492
|
id: "new",
|
|
493
493
|
kind: "action",
|
|
494
494
|
label: "New note",
|
|
495
|
-
icon:
|
|
495
|
+
icon: bo,
|
|
496
496
|
onSelect: () => {
|
|
497
497
|
const o = v();
|
|
498
498
|
o && (d(null), rt(o));
|
|
@@ -503,7 +503,7 @@ function Go(r) {
|
|
|
503
503
|
id: "delete",
|
|
504
504
|
kind: "action",
|
|
505
505
|
label: "Delete",
|
|
506
|
-
icon:
|
|
506
|
+
icon: Co,
|
|
507
507
|
destructive: !0,
|
|
508
508
|
onSelect: () => {
|
|
509
509
|
const o = v();
|
|
@@ -514,11 +514,11 @@ function Go(r) {
|
|
|
514
514
|
const e = v();
|
|
515
515
|
if (!e) return;
|
|
516
516
|
const t = ge().filter((n) => n.kind === "action").length, o = ge().filter((n) => n.kind === "separator").length;
|
|
517
|
-
return
|
|
517
|
+
return So({
|
|
518
518
|
clientX: e.clientX,
|
|
519
519
|
clientY: e.clientY,
|
|
520
|
-
menuWidth:
|
|
521
|
-
menuHeight:
|
|
520
|
+
menuWidth: Mo,
|
|
521
|
+
menuHeight: _o(t, o)
|
|
522
522
|
});
|
|
523
523
|
}), fo = (e) => {
|
|
524
524
|
const t = X();
|
|
@@ -558,7 +558,7 @@ function Go(r) {
|
|
|
558
558
|
e && (R(), await st(e));
|
|
559
559
|
};
|
|
560
560
|
return p(() => {
|
|
561
|
-
r.open || (
|
|
561
|
+
r.open || (zt(), Z(), D(null), T(null), C(null));
|
|
562
562
|
}), p(() => {
|
|
563
563
|
const e = b();
|
|
564
564
|
e && r.controller.activeTopicID() !== e && K(e);
|
|
@@ -595,7 +595,7 @@ function Go(r) {
|
|
|
595
595
|
let o = null;
|
|
596
596
|
for (const [n, c] of t) {
|
|
597
597
|
const a = e.find((f) => f.note_id === n);
|
|
598
|
-
(!a ||
|
|
598
|
+
(!a || Ne({ x: a.x, y: a.y }, c)) && (o ??= new Map(t), o.delete(n));
|
|
599
599
|
}
|
|
600
600
|
o && j(o);
|
|
601
601
|
}), p(() => {
|
|
@@ -628,10 +628,10 @@ function Go(r) {
|
|
|
628
628
|
trashCount: Ve
|
|
629
629
|
},
|
|
630
630
|
rail: {
|
|
631
|
-
topics:
|
|
631
|
+
topics: N,
|
|
632
632
|
activeTopicID: b,
|
|
633
633
|
draftTopicTitle: Me,
|
|
634
|
-
renamingTopicID:
|
|
634
|
+
renamingTopicID: z,
|
|
635
635
|
renamingTopicTitle: Ie,
|
|
636
636
|
getLiveNoteCount: Ke,
|
|
637
637
|
setDraftTopicTitle: _e,
|
|
@@ -648,11 +648,11 @@ function Go(r) {
|
|
|
648
648
|
activeTopicLabel: St,
|
|
649
649
|
activeItems: $,
|
|
650
650
|
activeTopicID: b,
|
|
651
|
-
topics:
|
|
651
|
+
topics: N,
|
|
652
652
|
topZIndex: It,
|
|
653
653
|
viewport: g,
|
|
654
654
|
boardScaleLabel: kt,
|
|
655
|
-
isMobile:
|
|
655
|
+
isMobile: xt,
|
|
656
656
|
overviewOpen: Le,
|
|
657
657
|
optimisticFrontNoteID: Fe,
|
|
658
658
|
copiedNoteID: Tt,
|
|
@@ -679,7 +679,7 @@ function Go(r) {
|
|
|
679
679
|
overview: {
|
|
680
680
|
items: Ot,
|
|
681
681
|
viewportStyle: Xt,
|
|
682
|
-
navigationState:
|
|
682
|
+
navigationState: Nt,
|
|
683
683
|
beginNavigation: qt,
|
|
684
684
|
close: R,
|
|
685
685
|
open: Ze
|
|
@@ -731,5 +731,5 @@ function Go(r) {
|
|
|
731
731
|
};
|
|
732
732
|
}
|
|
733
733
|
export {
|
|
734
|
-
|
|
734
|
+
Uo as useNotesOverlayModel
|
|
735
735
|
};
|
|
@@ -21,6 +21,11 @@ export declare const useContextMenuActions: () => {
|
|
|
21
21
|
claim: () => ContextMenuActionRequest | undefined;
|
|
22
22
|
resolve: (request: ContextMenuRequest) => readonly ContextMenuAction[];
|
|
23
23
|
} | undefined;
|
|
24
|
+
/** Composite icons must never determine the menu's intrinsic size. */
|
|
25
|
+
export declare function ContextMenuActionIcon(props: {
|
|
26
|
+
icon?: () => JSX.Element;
|
|
27
|
+
class?: string;
|
|
28
|
+
}): JSX.Element;
|
|
24
29
|
/** One document owner. Capture before focus changes; local menus retain priority. */
|
|
25
30
|
export declare function ContextMenuActions(props: {
|
|
26
31
|
label: string;
|