@floegence/floe-webapp-core 0.35.44 → 0.35.46
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/NotesBoardNote.js +65 -64
- package/dist/components/notes/NotesContextMenu.js +17 -17
- package/dist/components/notes/NotesEditorFlyout.js +4 -4
- package/dist/components/notes/NotesOverlay.js +91 -75
- package/dist/components/notes/NotesTrashFlyout.js +4 -4
- package/dist/components/notes/useNotesOverlayModel.d.ts +1 -0
- package/dist/components/notes/useNotesOverlayModel.js +327 -299
- package/dist/context/CommandContext.d.ts +2 -0
- package/dist/context/CommandContext.js +47 -49
- package/dist/context/ComponentRegistry.d.ts +1 -0
- package/dist/context/ComponentRegistry.js +40 -39
- package/dist/hooks/useOverlayMask.d.ts +4 -0
- package/dist/hooks/useOverlayMask.js +37 -32
- package/dist/notes-legacy.css +10 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { createSignal as a, createMemo as c, createEffect as v, onCleanup as X } from "solid-js";
|
|
2
|
-
import { Paste as
|
|
3
|
-
import { NOTES_CONTEXT_MENU_WIDTH_PX as
|
|
4
|
-
import { resolveFrameSize as
|
|
5
|
-
import { normalizeNotesSnapshot as
|
|
6
|
-
import { useNotification as
|
|
7
|
-
function
|
|
8
|
-
return
|
|
2
|
+
import { Paste as Xt, Plus as St, Trash as Yt } from "../icons/index.js";
|
|
3
|
+
import { NOTES_CONTEXT_MENU_WIDTH_PX as Et, estimateNotesContextMenuHeight as Lt } from "./NotesContextMenu.js";
|
|
4
|
+
import { resolveFrameSize as V, resolveOverviewBounds as Rt, createOverviewItem as zt, clamp as b, createContextMenuPosition as At, NOTES_MOBILE_BREAKPOINT_PX as Ft, getNormalizedOverviewPoint as Ae, findTrashTopicNoteCount as kt, hasLiveNotesForTopic as Bt, NOTES_CANVAS_ZOOM_STEP as Fe, resolveCenteredViewport as Vt } from "./notesOverlayHelpers.js";
|
|
5
|
+
import { normalizeNotesSnapshot as Wt, groupTrashItems as Ht, visibleWorldRect as $t, computeBoardBounds as Kt } from "./types.js";
|
|
6
|
+
import { useNotification as Zt } from "../../context/NotificationContext.js";
|
|
7
|
+
function p(r) {
|
|
8
|
+
return r instanceof Error ? r.message : String(r);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const s =
|
|
12
|
-
let D,
|
|
13
|
-
const
|
|
14
|
-
() =>
|
|
15
|
-
),
|
|
16
|
-
const e =
|
|
10
|
+
function eo(r) {
|
|
11
|
+
const s = Zt(), [ne, ke] = a(), [_, Be] = a({ width: 0, height: 0 }), [T, d] = a(null), [re, ie] = a(""), [W, ce] = a(null), [se, H] = a(""), [$, S] = a(null), [ae, le] = a(""), [de, ue] = a("amber"), [pe, fe] = a(!1), [me, he] = a(!1), [K, we] = a(null), [Z, j] = a(""), [Ve, Y] = a(null), [We, He] = a(Date.now()), [$e, Ke] = a(!1), [ve, y] = a(null), [Ze, Te] = a(null), [ge, x] = a(null);
|
|
12
|
+
let D, q, G = null;
|
|
13
|
+
const f = c(() => Wt(r.controller.snapshot())), g = c(
|
|
14
|
+
() => f().topics.filter((e) => e.deleted_at_unix_ms <= 0)
|
|
15
|
+
), je = c(() => g().length), C = c(() => {
|
|
16
|
+
const e = r.controller.activeTopicID();
|
|
17
17
|
return g().some((t) => t.topic_id === e) ? e : g()[0]?.topic_id ?? "";
|
|
18
|
-
}),
|
|
19
|
-
() => g().find((e) => e.topic_id ===
|
|
20
|
-
),
|
|
21
|
-
() =>
|
|
22
|
-
),
|
|
23
|
-
() =>
|
|
24
|
-
),
|
|
25
|
-
() =>
|
|
26
|
-
),
|
|
27
|
-
() => `${Math.round(
|
|
28
|
-
),
|
|
29
|
-
const e =
|
|
30
|
-
return
|
|
18
|
+
}), P = c(
|
|
19
|
+
() => g().find((e) => e.topic_id === C())
|
|
20
|
+
), E = c(
|
|
21
|
+
() => f().items.filter((e) => e.topic_id === C())
|
|
22
|
+
), qe = c(() => Ht(f().trash_items)), ye = c(() => f().trash_items.length), Ge = c(() => f().items.length), Ue = c(
|
|
23
|
+
() => E().reduce((e, t) => Math.max(e, t.z_index), 1)
|
|
24
|
+
), h = c(
|
|
25
|
+
() => ge() ?? r.controller.viewport()
|
|
26
|
+
), Je = c(() => P()?.name ?? "No topic"), Qe = c(
|
|
27
|
+
() => `${Math.round(h().scale * 100)}%`
|
|
28
|
+
), et = c(() => {
|
|
29
|
+
const e = V(_());
|
|
30
|
+
return $t(h(), e.width, e.height);
|
|
31
31
|
}), L = c(
|
|
32
|
-
() =>
|
|
33
|
-
),
|
|
34
|
-
() =>
|
|
35
|
-
),
|
|
36
|
-
const e = L(), t =
|
|
32
|
+
() => Rt(Kt(E()), et())
|
|
33
|
+
), tt = c(
|
|
34
|
+
() => E().map((e) => zt(e, L()))
|
|
35
|
+
), Ce = c(() => {
|
|
36
|
+
const e = L(), t = V(_()), o = h(), n = -o.x / o.scale, i = -o.y / o.scale, l = t.width / o.scale, m = t.height / o.scale, u = b(n, e.minX, e.maxX), N = b(i, e.minY, e.maxY), I = b(n + l, e.minX, e.maxX), oe = b(i + m, e.minY, e.maxY), O = Math.max((I - u) / e.width * 100, 6), w = Math.max((oe - N) / e.height * 100, 8), Re = (u - e.minX) / e.width * 100, ze = (N - e.minY) / e.height * 100;
|
|
37
37
|
return {
|
|
38
|
-
left:
|
|
38
|
+
left: Re,
|
|
39
39
|
top: ze,
|
|
40
40
|
width: O,
|
|
41
|
-
height:
|
|
42
|
-
centerX:
|
|
43
|
-
centerY: ze +
|
|
41
|
+
height: w,
|
|
42
|
+
centerX: Re + O / 2,
|
|
43
|
+
centerY: ze + w / 2
|
|
44
44
|
};
|
|
45
|
-
}),
|
|
46
|
-
const e =
|
|
45
|
+
}), ot = c(() => {
|
|
46
|
+
const e = Ce();
|
|
47
47
|
return {
|
|
48
48
|
left: `${e.left}%`,
|
|
49
49
|
top: `${e.top}%`,
|
|
@@ -51,262 +51,287 @@ function qt(n) {
|
|
|
51
51
|
height: `${e.height}%`
|
|
52
52
|
};
|
|
53
53
|
}), Ne = c(() => {
|
|
54
|
-
const e =
|
|
55
|
-
return e ?
|
|
56
|
-
}),
|
|
54
|
+
const e = $();
|
|
55
|
+
return e ? f().items.find((t) => t.note_id === e) : void 0;
|
|
56
|
+
}), U = () => {
|
|
57
57
|
D !== void 0 && (window.clearTimeout(D), D = void 0);
|
|
58
|
+
}, R = () => {
|
|
59
|
+
we(null), j("");
|
|
58
60
|
}, z = () => {
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
Y(null);
|
|
62
|
-
}, P = () => {
|
|
61
|
+
S(null);
|
|
62
|
+
}, M = () => {
|
|
63
63
|
he(!1);
|
|
64
|
-
},
|
|
64
|
+
}, Ie = () => {
|
|
65
65
|
he(!0);
|
|
66
|
-
}, k = () => {
|
|
67
|
-
pe(!1);
|
|
68
|
-
}, U = () => {
|
|
69
|
-
pe(!0);
|
|
70
66
|
}, A = () => {
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
|
|
67
|
+
fe(!1);
|
|
68
|
+
}, J = () => {
|
|
69
|
+
fe(!0);
|
|
70
|
+
}, F = () => {
|
|
71
|
+
ce(null), H("");
|
|
74
72
|
}, nt = () => {
|
|
73
|
+
d(null), A(), M(), z(), R();
|
|
74
|
+
}, rt = () => {
|
|
75
75
|
if (T()) {
|
|
76
|
-
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (H()) {
|
|
80
|
-
E();
|
|
76
|
+
d(null);
|
|
81
77
|
return;
|
|
82
78
|
}
|
|
83
79
|
if ($()) {
|
|
84
80
|
z();
|
|
85
81
|
return;
|
|
86
82
|
}
|
|
87
|
-
if (
|
|
88
|
-
|
|
83
|
+
if (K()) {
|
|
84
|
+
R();
|
|
89
85
|
return;
|
|
90
86
|
}
|
|
91
|
-
if (
|
|
92
|
-
|
|
87
|
+
if (me()) {
|
|
88
|
+
M();
|
|
93
89
|
return;
|
|
94
90
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
if (pe()) {
|
|
92
|
+
A();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
r.onClose();
|
|
96
|
+
}, k = (e) => {
|
|
97
|
+
r.controller.setActiveTopicID(e);
|
|
98
|
+
}, be = (e) => Bt(f().items, e), it = (e, t, o = P()?.topic_id) => {
|
|
99
99
|
if (!o) return null;
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
102
|
-
const i =
|
|
100
|
+
const n = g().find((u) => u.topic_id === o);
|
|
101
|
+
if (!n) return null;
|
|
102
|
+
const i = ne();
|
|
103
103
|
if (!i) return null;
|
|
104
104
|
const l = i.getBoundingClientRect();
|
|
105
105
|
if (l.width <= 0 || l.height <= 0 || e < l.left || e > l.right || t < l.top || t > l.bottom)
|
|
106
106
|
return null;
|
|
107
|
-
const
|
|
107
|
+
const m = h();
|
|
108
108
|
return {
|
|
109
|
-
topicID:
|
|
110
|
-
worldX: (e - l.left -
|
|
111
|
-
worldY: (t - l.top -
|
|
109
|
+
topicID: n.topic_id,
|
|
110
|
+
worldX: (e - l.left - m.x) / m.scale,
|
|
111
|
+
worldY: (t - l.top - m.y) / m.scale
|
|
112
112
|
};
|
|
113
|
-
},
|
|
114
|
-
|
|
113
|
+
}, ct = (e, t) => {
|
|
114
|
+
if (typeof document > "u") return [];
|
|
115
|
+
if (typeof document.elementsFromPoint == "function")
|
|
116
|
+
return document.elementsFromPoint(e, t);
|
|
117
|
+
const o = document.elementFromPoint(e, t);
|
|
118
|
+
return o ? [o] : [];
|
|
119
|
+
}, st = (e, t) => {
|
|
120
|
+
const o = ct(e, t).filter((n) => n instanceof HTMLElement).map((n) => n.closest("[data-floe-notes-note-id]")).find(Boolean)?.dataset.floeNotesNoteId?.trim();
|
|
121
|
+
if (o)
|
|
122
|
+
return f().items.find((n) => n.note_id === o);
|
|
123
|
+
}, Q = (e, t, o) => {
|
|
124
|
+
const n = it(e, t, o?.topicID);
|
|
125
|
+
return n ? {
|
|
126
|
+
clientX: e,
|
|
127
|
+
clientY: t,
|
|
128
|
+
worldX: n.worldX,
|
|
129
|
+
worldY: n.worldY,
|
|
130
|
+
topicID: n.topicID,
|
|
131
|
+
noteID: o?.noteID ?? null
|
|
132
|
+
} : null;
|
|
133
|
+
}, _e = () => {
|
|
134
|
+
const e = P();
|
|
115
135
|
if (!e) return null;
|
|
116
|
-
const t =
|
|
136
|
+
const t = V(_()), o = h();
|
|
117
137
|
return {
|
|
118
138
|
topicID: e.topic_id,
|
|
119
139
|
worldX: (t.width / 2 - o.x) / o.scale,
|
|
120
140
|
worldY: (t.height / 2 - o.y) / o.scale
|
|
121
141
|
};
|
|
122
|
-
},
|
|
123
|
-
const
|
|
124
|
-
return
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
142
|
+
}, xe = (e, t, o) => {
|
|
143
|
+
const n = Q(e, t, o);
|
|
144
|
+
return n ? (d(n), !0) : !1;
|
|
145
|
+
}, at = (e, t) => {
|
|
146
|
+
const o = st(e, t);
|
|
147
|
+
if (o) {
|
|
148
|
+
B(o.note_id);
|
|
149
|
+
const n = Q(e, t, {
|
|
150
|
+
topicID: o.topic_id,
|
|
151
|
+
noteID: o.note_id
|
|
152
|
+
});
|
|
153
|
+
d(n);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
d(Q(e, t));
|
|
157
|
+
}, De = (e) => {
|
|
158
|
+
x(e), r.controller.setViewport(e), x(null);
|
|
159
|
+
}, Pe = (e, t, o) => Vt({
|
|
160
|
+
viewport: h(),
|
|
136
161
|
frame: _(),
|
|
137
162
|
bounds: L(),
|
|
138
163
|
worldX: e,
|
|
139
164
|
worldY: t,
|
|
140
165
|
scale: o
|
|
141
166
|
}), Me = (e) => {
|
|
142
|
-
const t =
|
|
143
|
-
|
|
144
|
-
},
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
const i =
|
|
167
|
+
const t = h(), o = V(_()), n = (o.width / 2 - t.x) / t.scale, i = (o.height / 2 - t.y) / t.scale, l = e === "in" ? t.scale * Fe : t.scale / Fe;
|
|
168
|
+
De(Pe(n, i, l));
|
|
169
|
+
}, Oe = (e, t, o) => {
|
|
170
|
+
const n = o.surfaceRect;
|
|
171
|
+
if (n.width <= 0 || n.height <= 0) return;
|
|
172
|
+
const i = Ae(e, t, n), l = b(i.x - o.centerOffsetX, 0, 1), m = b(i.y - o.centerOffsetY, 0, 1), u = o.bounds;
|
|
148
173
|
x(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
174
|
+
Pe(
|
|
175
|
+
u.minX + l * u.width,
|
|
176
|
+
u.minY + m * u.height
|
|
152
177
|
)
|
|
153
178
|
);
|
|
154
|
-
},
|
|
155
|
-
if (
|
|
156
|
-
const t =
|
|
157
|
-
t &&
|
|
179
|
+
}, ee = (e) => {
|
|
180
|
+
if (q?.abort(), q = void 0, e) {
|
|
181
|
+
const t = ge();
|
|
182
|
+
t && r.controller.setViewport(t);
|
|
158
183
|
}
|
|
159
|
-
x(null),
|
|
160
|
-
},
|
|
184
|
+
x(null), Te(null);
|
|
185
|
+
}, lt = (e) => {
|
|
161
186
|
if (e.button !== 0 && e.pointerType !== "touch" && e.pointerType !== "pen")
|
|
162
187
|
return;
|
|
163
188
|
const t = e.currentTarget, o = t.getBoundingClientRect();
|
|
164
189
|
if (o.width <= 0 || o.height <= 0) return;
|
|
165
|
-
const
|
|
190
|
+
const n = Ae(e.clientX, e.clientY, o), i = Ce(), l = n.x * 100, m = n.y * 100, u = l >= i.left && l <= i.left + i.width && m >= i.top && m <= i.top + i.height, N = {
|
|
166
191
|
pointerId: e.pointerId,
|
|
167
192
|
bounds: L(),
|
|
168
193
|
surfaceRect: o,
|
|
169
|
-
centerOffsetX:
|
|
170
|
-
centerOffsetY:
|
|
194
|
+
centerOffsetX: u ? n.x - i.centerX / 100 : 0,
|
|
195
|
+
centerOffsetY: u ? n.y - i.centerY / 100 : 0
|
|
171
196
|
};
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
}, O = (
|
|
178
|
-
|
|
197
|
+
ee(!1), e.preventDefault(), e.stopPropagation(), Te(N), Oe(e.clientX, e.clientY, N), t.setPointerCapture?.(e.pointerId);
|
|
198
|
+
const I = new AbortController();
|
|
199
|
+
q = I;
|
|
200
|
+
const oe = (w) => {
|
|
201
|
+
w.pointerId === e.pointerId && Oe(w.clientX, w.clientY, N);
|
|
202
|
+
}, O = (w) => {
|
|
203
|
+
w.pointerId === e.pointerId && (t.hasPointerCapture?.(e.pointerId) && t.releasePointerCapture(e.pointerId), ee(!0));
|
|
179
204
|
};
|
|
180
|
-
t.addEventListener("pointermove",
|
|
205
|
+
t.addEventListener("pointermove", oe, { signal: I.signal }), t.addEventListener("pointerup", O, {
|
|
181
206
|
once: !0,
|
|
182
|
-
signal:
|
|
207
|
+
signal: I.signal
|
|
183
208
|
}), t.addEventListener("pointercancel", O, {
|
|
184
209
|
once: !0,
|
|
185
|
-
signal:
|
|
210
|
+
signal: I.signal
|
|
186
211
|
});
|
|
187
|
-
},
|
|
212
|
+
}, Xe = async (e) => {
|
|
188
213
|
try {
|
|
189
|
-
const t = await
|
|
214
|
+
const t = await r.controller.createNote({
|
|
190
215
|
topic_id: e.topicID,
|
|
191
216
|
x: e.worldX,
|
|
192
217
|
y: e.worldY,
|
|
193
218
|
body: ""
|
|
194
219
|
});
|
|
195
|
-
|
|
220
|
+
S(t.note_id);
|
|
196
221
|
} catch (t) {
|
|
197
|
-
s.error("Create failed",
|
|
222
|
+
s.error("Create failed", p(t));
|
|
198
223
|
}
|
|
199
|
-
},
|
|
224
|
+
}, Se = async (e, t) => {
|
|
200
225
|
try {
|
|
201
|
-
await
|
|
226
|
+
await r.controller.createNote({
|
|
202
227
|
topic_id: e.topicID,
|
|
203
228
|
x: e.worldX,
|
|
204
229
|
y: e.worldY,
|
|
205
230
|
body: t
|
|
206
231
|
}), s.success("Pasted", "Created a new note from clipboard text.");
|
|
207
232
|
} catch (o) {
|
|
208
|
-
s.error("Paste failed",
|
|
233
|
+
s.error("Paste failed", p(o));
|
|
209
234
|
}
|
|
210
235
|
}, Ye = (e) => {
|
|
211
|
-
|
|
212
|
-
},
|
|
236
|
+
j(""), we(e);
|
|
237
|
+
}, Ee = async (e) => {
|
|
213
238
|
try {
|
|
214
239
|
const t = await navigator.clipboard.readText();
|
|
215
240
|
if (!t.trim()) {
|
|
216
241
|
s.info("Clipboard empty", "Paste text into the dialog to create a note."), Ye(e);
|
|
217
242
|
return;
|
|
218
243
|
}
|
|
219
|
-
await
|
|
244
|
+
await Se(e, t);
|
|
220
245
|
} catch {
|
|
221
246
|
s.info("Clipboard blocked", "Manual paste is available as a fallback."), Ye(e);
|
|
222
247
|
}
|
|
223
|
-
},
|
|
224
|
-
|
|
225
|
-
D = void 0,
|
|
248
|
+
}, dt = (e) => {
|
|
249
|
+
U(), Y(e), D = window.setTimeout(() => {
|
|
250
|
+
D = void 0, Y((t) => t === e ? null : t);
|
|
226
251
|
}, 1100);
|
|
227
|
-
},
|
|
252
|
+
}, ut = (e) => {
|
|
228
253
|
y(e);
|
|
229
|
-
},
|
|
230
|
-
y(e), Promise.resolve(
|
|
231
|
-
s.error("Bring forward failed",
|
|
254
|
+
}, B = (e) => {
|
|
255
|
+
y(e), Promise.resolve(r.controller.bringNoteToFront(e)).catch((t) => {
|
|
256
|
+
s.error("Bring forward failed", p(t)), y((o) => o === e ? null : o);
|
|
232
257
|
});
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
},
|
|
258
|
+
}, pt = (e) => {
|
|
259
|
+
d(null), S(e);
|
|
260
|
+
}, ft = async (e) => {
|
|
236
261
|
if (!e.body.trim()) {
|
|
237
|
-
|
|
262
|
+
d(null), S(e.note_id);
|
|
238
263
|
return;
|
|
239
264
|
}
|
|
240
265
|
try {
|
|
241
|
-
|
|
266
|
+
B(e.note_id), await navigator.clipboard.writeText(e.body), dt(e.note_id);
|
|
242
267
|
} catch {
|
|
243
268
|
s.error("Copy failed", "Clipboard write was not available.");
|
|
244
269
|
}
|
|
245
|
-
},
|
|
270
|
+
}, Le = async (e) => {
|
|
246
271
|
try {
|
|
247
|
-
await
|
|
272
|
+
await r.controller.deleteNote(e), U(), Y((t) => t === e ? null : t), J();
|
|
248
273
|
} catch (t) {
|
|
249
|
-
s.error("Delete failed",
|
|
274
|
+
s.error("Delete failed", p(t));
|
|
250
275
|
}
|
|
251
|
-
},
|
|
276
|
+
}, mt = async (e) => {
|
|
252
277
|
try {
|
|
253
|
-
await
|
|
278
|
+
await r.controller.restoreNote(e);
|
|
254
279
|
} catch (t) {
|
|
255
|
-
s.error("Restore failed",
|
|
280
|
+
s.error("Restore failed", p(t));
|
|
256
281
|
}
|
|
257
|
-
},
|
|
258
|
-
if (
|
|
282
|
+
}, ht = async (e) => {
|
|
283
|
+
if (r.controller.deleteTrashedNotePermanently)
|
|
259
284
|
try {
|
|
260
|
-
await
|
|
285
|
+
await r.controller.deleteTrashedNotePermanently(e);
|
|
261
286
|
} catch (t) {
|
|
262
|
-
s.error("Delete failed",
|
|
287
|
+
s.error("Delete failed", p(t));
|
|
263
288
|
}
|
|
264
|
-
},
|
|
289
|
+
}, wt = async (e) => {
|
|
265
290
|
try {
|
|
266
|
-
await
|
|
291
|
+
await r.controller.clearTrashTopic(e);
|
|
267
292
|
} catch (t) {
|
|
268
|
-
s.error("Trash failed",
|
|
293
|
+
s.error("Trash failed", p(t));
|
|
269
294
|
}
|
|
270
|
-
},
|
|
271
|
-
const e =
|
|
295
|
+
}, vt = async () => {
|
|
296
|
+
const e = $();
|
|
272
297
|
if (e)
|
|
273
298
|
try {
|
|
274
|
-
await
|
|
275
|
-
body:
|
|
276
|
-
color_token:
|
|
277
|
-
}), s.success("Saved", "Note updated."),
|
|
299
|
+
await r.controller.updateNote(e, {
|
|
300
|
+
body: ae(),
|
|
301
|
+
color_token: de()
|
|
302
|
+
}), s.success("Saved", "Note updated."), z();
|
|
278
303
|
} catch (t) {
|
|
279
|
-
s.error("Save failed",
|
|
304
|
+
s.error("Save failed", p(t));
|
|
280
305
|
}
|
|
281
|
-
},
|
|
282
|
-
const e =
|
|
283
|
-
!e || !
|
|
284
|
-
},
|
|
285
|
-
const e =
|
|
306
|
+
}, Tt = async () => {
|
|
307
|
+
const e = K();
|
|
308
|
+
!e || !Z().trim() || (await Se(e, Z()), R());
|
|
309
|
+
}, gt = async () => {
|
|
310
|
+
const e = re().trim();
|
|
286
311
|
if (e)
|
|
287
312
|
try {
|
|
288
|
-
const t = await
|
|
289
|
-
|
|
313
|
+
const t = await r.controller.createTopic({ name: e });
|
|
314
|
+
ie(""), k(t.topic_id);
|
|
290
315
|
} catch (t) {
|
|
291
|
-
s.error("Topic failed",
|
|
316
|
+
s.error("Topic failed", p(t));
|
|
292
317
|
}
|
|
293
|
-
},
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
const e =
|
|
318
|
+
}, yt = (e) => {
|
|
319
|
+
ce(e.topic_id), H(e.name);
|
|
320
|
+
}, Ct = async () => {
|
|
321
|
+
const e = W();
|
|
297
322
|
if (!e) return;
|
|
298
|
-
const t =
|
|
299
|
-
if (
|
|
323
|
+
const t = se().trim();
|
|
324
|
+
if (F(), !!t)
|
|
300
325
|
try {
|
|
301
|
-
await
|
|
326
|
+
await r.controller.updateTopic(e, { name: t });
|
|
302
327
|
} catch (o) {
|
|
303
|
-
s.error("Rename failed",
|
|
328
|
+
s.error("Rename failed", p(o));
|
|
304
329
|
}
|
|
305
|
-
},
|
|
306
|
-
const t = be(e.topic_id) +
|
|
307
|
-
|
|
330
|
+
}, Nt = async (e) => {
|
|
331
|
+
const t = be(e.topic_id) + kt(f().trash_items, e.topic_id);
|
|
332
|
+
W() === e.topic_id && F();
|
|
308
333
|
try {
|
|
309
|
-
if (await
|
|
334
|
+
if (await r.controller.deleteTopic(e.topic_id) === !1) {
|
|
310
335
|
s.info(
|
|
311
336
|
"Keep one topic",
|
|
312
337
|
"At least one topic needs to remain available."
|
|
@@ -314,7 +339,7 @@ function qt(n) {
|
|
|
314
339
|
return;
|
|
315
340
|
}
|
|
316
341
|
if (t > 0) {
|
|
317
|
-
|
|
342
|
+
J(), s.success(
|
|
318
343
|
"Topic deleted",
|
|
319
344
|
"Live notes moved into trash for this topic."
|
|
320
345
|
);
|
|
@@ -322,24 +347,24 @@ function qt(n) {
|
|
|
322
347
|
}
|
|
323
348
|
s.success("Topic deleted", "The empty topic was removed.");
|
|
324
349
|
} catch (o) {
|
|
325
|
-
s.error("Delete failed",
|
|
350
|
+
s.error("Delete failed", p(o));
|
|
326
351
|
}
|
|
327
|
-
},
|
|
352
|
+
}, It = async (e, t) => {
|
|
328
353
|
try {
|
|
329
|
-
await
|
|
354
|
+
await r.controller.updateNote(e, {
|
|
330
355
|
x: t.x,
|
|
331
356
|
y: t.y
|
|
332
357
|
});
|
|
333
358
|
} catch (o) {
|
|
334
|
-
s.error("Move failed",
|
|
359
|
+
s.error("Move failed", p(o));
|
|
335
360
|
}
|
|
336
|
-
},
|
|
337
|
-
const e =
|
|
338
|
-
e && (
|
|
339
|
-
},
|
|
340
|
-
const e =
|
|
341
|
-
e && (
|
|
342
|
-
},
|
|
361
|
+
}, bt = async () => {
|
|
362
|
+
const e = _e();
|
|
363
|
+
e && (M(), await Xe(e));
|
|
364
|
+
}, _t = async () => {
|
|
365
|
+
const e = _e();
|
|
366
|
+
e && (M(), await Ee(e));
|
|
367
|
+
}, te = c(() => {
|
|
343
368
|
const e = T();
|
|
344
369
|
if (!e) return [];
|
|
345
370
|
const t = [
|
|
@@ -347,20 +372,20 @@ function qt(n) {
|
|
|
347
372
|
id: "paste",
|
|
348
373
|
kind: "action",
|
|
349
374
|
label: "Paste here",
|
|
350
|
-
icon:
|
|
375
|
+
icon: Xt,
|
|
351
376
|
onSelect: () => {
|
|
352
377
|
const o = T();
|
|
353
|
-
o && (
|
|
378
|
+
o && (d(null), Ee(o));
|
|
354
379
|
}
|
|
355
380
|
},
|
|
356
381
|
{
|
|
357
382
|
id: "new",
|
|
358
383
|
kind: "action",
|
|
359
384
|
label: "New note",
|
|
360
|
-
icon:
|
|
385
|
+
icon: St,
|
|
361
386
|
onSelect: () => {
|
|
362
387
|
const o = T();
|
|
363
|
-
o && (
|
|
388
|
+
o && (d(null), Xe(o));
|
|
364
389
|
}
|
|
365
390
|
}
|
|
366
391
|
];
|
|
@@ -368,73 +393,75 @@ function qt(n) {
|
|
|
368
393
|
id: "delete",
|
|
369
394
|
kind: "action",
|
|
370
395
|
label: "Delete",
|
|
371
|
-
icon:
|
|
396
|
+
icon: Yt,
|
|
372
397
|
destructive: !0,
|
|
373
398
|
onSelect: () => {
|
|
374
399
|
const o = T();
|
|
375
|
-
o?.noteID && (
|
|
400
|
+
o?.noteID && (d(null), Le(o.noteID));
|
|
376
401
|
}
|
|
377
402
|
})), t;
|
|
378
|
-
}),
|
|
403
|
+
}), xt = c(() => {
|
|
379
404
|
const e = T();
|
|
380
405
|
if (!e) return;
|
|
381
|
-
const t =
|
|
382
|
-
return
|
|
406
|
+
const t = te().filter((n) => n.kind === "action").length, o = te().filter((n) => n.kind === "separator").length;
|
|
407
|
+
return At({
|
|
383
408
|
clientX: e.clientX,
|
|
384
409
|
clientY: e.clientY,
|
|
385
|
-
menuWidth:
|
|
386
|
-
menuHeight:
|
|
410
|
+
menuWidth: Et,
|
|
411
|
+
menuHeight: Lt(t, o)
|
|
387
412
|
});
|
|
388
|
-
}),
|
|
389
|
-
const t =
|
|
390
|
-
t &&
|
|
413
|
+
}), Dt = (e) => {
|
|
414
|
+
const t = P();
|
|
415
|
+
t && d({
|
|
391
416
|
clientX: e.clientX,
|
|
392
417
|
clientY: e.clientY,
|
|
393
418
|
worldX: e.worldX,
|
|
394
419
|
worldY: e.worldY,
|
|
395
420
|
topicID: t.topic_id
|
|
396
421
|
});
|
|
397
|
-
},
|
|
398
|
-
|
|
422
|
+
}, Pt = (e, t) => {
|
|
423
|
+
B(t.note_id), xe(e.clientX, e.clientY, {
|
|
399
424
|
topicID: t.topic_id,
|
|
400
425
|
noteID: t.note_id
|
|
401
426
|
});
|
|
402
|
-
},
|
|
403
|
-
|
|
427
|
+
}, Mt = (e) => {
|
|
428
|
+
A(), xe(e.clientX, e.clientY);
|
|
429
|
+
}, Ot = (e) => {
|
|
430
|
+
e.preventDefault(), e.stopPropagation(), at(e.clientX, e.clientY);
|
|
404
431
|
};
|
|
405
432
|
return v(() => {
|
|
406
|
-
|
|
433
|
+
r.open || (nt(), F(), x(null), y(null), Y(null));
|
|
407
434
|
}), v(() => {
|
|
408
|
-
const e =
|
|
409
|
-
e &&
|
|
435
|
+
const e = C();
|
|
436
|
+
e && r.controller.activeTopicID() !== e && k(e);
|
|
410
437
|
}), v(() => {
|
|
411
438
|
const e = Ne();
|
|
412
439
|
if (!e) {
|
|
413
|
-
|
|
440
|
+
G = null;
|
|
414
441
|
return;
|
|
415
442
|
}
|
|
416
|
-
|
|
443
|
+
G !== e.note_id && (G = e.note_id, le(e.body), ue(e.color_token));
|
|
417
444
|
}), v(() => {
|
|
418
|
-
const e =
|
|
445
|
+
const e = ve();
|
|
419
446
|
if (!e) return;
|
|
420
|
-
const t =
|
|
447
|
+
const t = f().items.find((n) => n.note_id === e);
|
|
421
448
|
if (!t) {
|
|
422
449
|
y(null);
|
|
423
450
|
return;
|
|
424
451
|
}
|
|
425
|
-
const o =
|
|
426
|
-
(
|
|
452
|
+
const o = f().items.reduce(
|
|
453
|
+
(n, i) => Math.max(n, i.z_index),
|
|
427
454
|
0
|
|
428
455
|
);
|
|
429
456
|
t.z_index >= o && y(null);
|
|
430
457
|
}), v(() => {
|
|
431
|
-
if (!
|
|
458
|
+
if (!r.open) return;
|
|
432
459
|
const e = () => {
|
|
433
|
-
|
|
460
|
+
Ke(window.innerWidth < Ft);
|
|
434
461
|
};
|
|
435
462
|
e(), window.addEventListener("resize", e), X(() => window.removeEventListener("resize", e));
|
|
436
463
|
}), v(() => {
|
|
437
|
-
const e =
|
|
464
|
+
const e = ne();
|
|
438
465
|
if (!e) return;
|
|
439
466
|
const t = () => {
|
|
440
467
|
Be({
|
|
@@ -449,111 +476,112 @@ function qt(n) {
|
|
|
449
476
|
const o = new ResizeObserver(t);
|
|
450
477
|
o.observe(e), X(() => o.disconnect());
|
|
451
478
|
}), v(() => {
|
|
452
|
-
if (!
|
|
453
|
-
const e = window.setInterval(() =>
|
|
479
|
+
if (!r.open) return;
|
|
480
|
+
const e = window.setInterval(() => He(Date.now()), 60 * 1e3);
|
|
454
481
|
X(() => window.clearInterval(e));
|
|
455
482
|
}), v(() => {
|
|
456
|
-
|
|
483
|
+
C() && d(null);
|
|
457
484
|
}), X(() => {
|
|
458
|
-
|
|
485
|
+
U(), ee(!1);
|
|
459
486
|
}), {
|
|
460
487
|
header: {
|
|
461
|
-
topicCount:
|
|
462
|
-
totalLiveNotes:
|
|
463
|
-
trashCount:
|
|
488
|
+
topicCount: je,
|
|
489
|
+
totalLiveNotes: Ge,
|
|
490
|
+
trashCount: ye
|
|
464
491
|
},
|
|
465
492
|
rail: {
|
|
466
493
|
topics: g,
|
|
467
|
-
activeTopicID:
|
|
468
|
-
draftTopicTitle:
|
|
469
|
-
renamingTopicID:
|
|
470
|
-
renamingTopicTitle:
|
|
494
|
+
activeTopicID: C,
|
|
495
|
+
draftTopicTitle: re,
|
|
496
|
+
renamingTopicID: W,
|
|
497
|
+
renamingTopicTitle: se,
|
|
471
498
|
getLiveNoteCount: be,
|
|
472
|
-
setDraftTopicTitle:
|
|
473
|
-
submitTopic:
|
|
474
|
-
selectTopic:
|
|
475
|
-
startTopicRename:
|
|
476
|
-
setRenamingTopicTitle:
|
|
477
|
-
saveTopicRename:
|
|
478
|
-
cancelTopicRename:
|
|
479
|
-
deleteTopic:
|
|
499
|
+
setDraftTopicTitle: ie,
|
|
500
|
+
submitTopic: gt,
|
|
501
|
+
selectTopic: k,
|
|
502
|
+
startTopicRename: yt,
|
|
503
|
+
setRenamingTopicTitle: H,
|
|
504
|
+
saveTopicRename: Ct,
|
|
505
|
+
cancelTopicRename: F,
|
|
506
|
+
deleteTopic: Nt
|
|
480
507
|
},
|
|
481
508
|
board: {
|
|
482
|
-
activeTopic:
|
|
483
|
-
activeTopicLabel:
|
|
484
|
-
activeItems:
|
|
485
|
-
activeTopicID:
|
|
509
|
+
activeTopic: P,
|
|
510
|
+
activeTopicLabel: Je,
|
|
511
|
+
activeItems: E,
|
|
512
|
+
activeTopicID: C,
|
|
486
513
|
topics: g,
|
|
487
|
-
topZIndex:
|
|
488
|
-
viewport:
|
|
489
|
-
boardScaleLabel:
|
|
490
|
-
isMobile:
|
|
491
|
-
overviewOpen:
|
|
492
|
-
optimisticFrontNoteID:
|
|
493
|
-
copiedNoteID:
|
|
494
|
-
setCanvasFrameRef:
|
|
495
|
-
commitViewport:
|
|
496
|
-
openCanvasContextMenu:
|
|
514
|
+
topZIndex: Ue,
|
|
515
|
+
viewport: h,
|
|
516
|
+
boardScaleLabel: Qe,
|
|
517
|
+
isMobile: $e,
|
|
518
|
+
overviewOpen: me,
|
|
519
|
+
optimisticFrontNoteID: ve,
|
|
520
|
+
copiedNoteID: Ve,
|
|
521
|
+
setCanvasFrameRef: ke,
|
|
522
|
+
commitViewport: De,
|
|
523
|
+
openCanvasContextMenu: Dt,
|
|
497
524
|
zoomOut: () => Me("out"),
|
|
498
525
|
zoomIn: () => Me("in"),
|
|
499
|
-
openOverview:
|
|
500
|
-
selectTopic:
|
|
501
|
-
mobileCreateNote:
|
|
502
|
-
mobilePaste:
|
|
503
|
-
copyNote:
|
|
504
|
-
openNoteContextMenu:
|
|
505
|
-
openEditor:
|
|
506
|
-
moveToTrash:
|
|
507
|
-
startOptimisticFront:
|
|
508
|
-
commitFront:
|
|
509
|
-
commitMove:
|
|
526
|
+
openOverview: Ie,
|
|
527
|
+
selectTopic: k,
|
|
528
|
+
mobileCreateNote: bt,
|
|
529
|
+
mobilePaste: _t,
|
|
530
|
+
copyNote: ft,
|
|
531
|
+
openNoteContextMenu: Pt,
|
|
532
|
+
openEditor: pt,
|
|
533
|
+
moveToTrash: Le,
|
|
534
|
+
startOptimisticFront: ut,
|
|
535
|
+
commitFront: B,
|
|
536
|
+
commitMove: It
|
|
510
537
|
},
|
|
511
538
|
overview: {
|
|
512
|
-
items:
|
|
513
|
-
viewportStyle:
|
|
514
|
-
navigationState:
|
|
515
|
-
beginNavigation:
|
|
516
|
-
close:
|
|
517
|
-
open:
|
|
539
|
+
items: tt,
|
|
540
|
+
viewportStyle: ot,
|
|
541
|
+
navigationState: Ze,
|
|
542
|
+
beginNavigation: lt,
|
|
543
|
+
close: M,
|
|
544
|
+
open: Ie
|
|
518
545
|
},
|
|
519
546
|
trash: {
|
|
520
|
-
open:
|
|
521
|
-
groups:
|
|
522
|
-
count:
|
|
523
|
-
now:
|
|
524
|
-
canDeleteNow: !!
|
|
525
|
-
close:
|
|
526
|
-
openDock:
|
|
527
|
-
backdropContextMenu:
|
|
528
|
-
restore:
|
|
529
|
-
deleteNow:
|
|
530
|
-
clearTopic:
|
|
547
|
+
open: pe,
|
|
548
|
+
groups: qe,
|
|
549
|
+
count: ye,
|
|
550
|
+
now: We,
|
|
551
|
+
canDeleteNow: !!r.controller.deleteTrashedNotePermanently,
|
|
552
|
+
close: A,
|
|
553
|
+
openDock: J,
|
|
554
|
+
backdropContextMenu: Mt,
|
|
555
|
+
restore: mt,
|
|
556
|
+
deleteNow: ht,
|
|
557
|
+
clearTopic: wt
|
|
531
558
|
},
|
|
532
559
|
contextMenu: {
|
|
533
560
|
state: T,
|
|
534
|
-
items:
|
|
535
|
-
position:
|
|
536
|
-
close: () =>
|
|
561
|
+
items: te,
|
|
562
|
+
position: xt,
|
|
563
|
+
close: () => d(null),
|
|
564
|
+
retarget: Ot
|
|
537
565
|
},
|
|
538
566
|
editor: {
|
|
539
567
|
note: Ne,
|
|
540
|
-
draftBody:
|
|
541
|
-
draftColor:
|
|
542
|
-
setDraftBody:
|
|
543
|
-
setDraftColor:
|
|
544
|
-
close:
|
|
545
|
-
save:
|
|
568
|
+
draftBody: ae,
|
|
569
|
+
draftColor: de,
|
|
570
|
+
setDraftBody: le,
|
|
571
|
+
setDraftColor: ue,
|
|
572
|
+
close: z,
|
|
573
|
+
save: vt
|
|
546
574
|
},
|
|
547
575
|
manualPaste: {
|
|
548
|
-
open: () =>
|
|
549
|
-
text:
|
|
550
|
-
setText:
|
|
551
|
-
close:
|
|
552
|
-
confirm:
|
|
576
|
+
open: () => !!K(),
|
|
577
|
+
text: Z,
|
|
578
|
+
setText: j,
|
|
579
|
+
close: R,
|
|
580
|
+
confirm: Tt
|
|
553
581
|
},
|
|
554
|
-
handleCloseRequest:
|
|
582
|
+
handleCloseRequest: rt
|
|
555
583
|
};
|
|
556
584
|
}
|
|
557
585
|
export {
|
|
558
|
-
|
|
586
|
+
eo as useNotesOverlayModel
|
|
559
587
|
};
|