@floegence/floe-webapp-core 0.35.39 → 0.35.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.
- package/dist/components/notes/NotesContextMenu.d.ts +27 -0
- package/dist/components/notes/NotesContextMenu.js +52 -0
- package/dist/components/notes/NotesOverlay.d.ts +7 -0
- package/dist/components/notes/NotesOverlay.js +901 -0
- package/dist/components/notes/index.d.ts +4 -0
- package/dist/components/notes/notesAppearance.d.ts +14 -0
- package/dist/components/notes/notesAppearance.js +142 -0
- package/dist/components/notes/types.d.ts +148 -0
- package/dist/components/notes/types.js +277 -0
- package/dist/full.d.ts +1 -0
- package/dist/full.js +560 -521
- package/dist/notes.css +1014 -0
- package/dist/notes.d.ts +1 -0
- package/dist/notes.js +41 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,901 @@
|
|
|
1
|
+
import { createComponent as c, insert as a, use as Mt, effect as X, className as It, setAttribute as g, memo as he, setStyleProperty as q, template as p, delegateEvents as Fe } from "solid-js/web";
|
|
2
|
+
import { createSignal as R, createMemo as x, createEffect as tt, onCleanup as yt, Show as M, For as ct, untrack as ve } from "solid-js";
|
|
3
|
+
import { Motion as Vt } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
|
|
4
|
+
import { FileText as We, Copy as pe, Trash as Ft, Plus as He, Pencil as fe, X as Wt, Check as Ke } from "../icons/index.js";
|
|
5
|
+
import { cn as Pt } from "../../utils/cn.js";
|
|
6
|
+
import { NotesContextMenu as Ge, NOTES_CONTEXT_MENU_WIDTH_PX as qe, estimateNotesContextMenuHeight as Ue } from "./NotesContextMenu.js";
|
|
7
|
+
import { NotesOverlayIcon as Ze, NotesAnimalIcon as Ht, NotesTrashCanIcon as me, NOTE_COLOR_LABELS as je } from "./notesAppearance.js";
|
|
8
|
+
import { groupTrashItems as Je, computeBoardBounds as Qe, visibleWorldRect as ge, mergeBoardBounds as tn, noteBucketMetrics as Dt, NOTE_COLOR_TOKENS as en, worldToScreen as nn, screenToWorld as on, zoomViewportAtPoint as ye, centerViewportOnWorldPoint as rn } from "./types.js";
|
|
9
|
+
import { useNotification as an } from "../../context/NotificationContext.js";
|
|
10
|
+
var sn = /* @__PURE__ */ p('<div class=notes-overlay__topic-create data-notes-interactive=true><input class=notes-overlay__topic-input placeholder="New topic"data-notes-interactive=true><div class=notes-overlay__topic-create-actions><button type=button class=notes-overlay__text-action data-notes-interactive=true>Add</button><button type=button class=notes-overlay__text-action data-notes-interactive=true>Cancel'), ln = /* @__PURE__ */ p("<div class=notes-overlay__empty-rail>Create your first topic to start pinning notes."), cn = /* @__PURE__ */ p("<div class=notes-overlay__loading>Loading notes…"), dn = /* @__PURE__ */ p("<div class=notes-overlay__empty-board>Right click anywhere to create the first note in this topic."), un = /* @__PURE__ */ p("<span class=notes-overlay__trash-count>"), _n = /* @__PURE__ */ p('<button type=button class=notes-overlay__trash-dock aria-label="Open trash"data-notes-interactive=true data-notes-trash-toggle=true>'), hn = /* @__PURE__ */ p('<div class=notes-trash__head><span class=notes-trash__title></span><button type=button class="notes-overlay__close notes-overlay__close--panel"aria-label="Close trash"data-notes-interactive=true>'), vn = /* @__PURE__ */ p("<div class=notes-trash__empty>Trash is empty."), pn = /* @__PURE__ */ p("<div class=notes-trash__content>"), fn = /* @__PURE__ */ p('<div class=notes-editor__head><span>Edit note</span><button type=button class="notes-overlay__close notes-overlay__close--panel"aria-label="Close note editor"data-notes-interactive=true>'), mn = /* @__PURE__ */ p("<div class=notes-editor__colors>"), gn = /* @__PURE__ */ p("<textarea class=notes-editor__textarea data-notes-interactive=true>"), yn = /* @__PURE__ */ p("<div class=notes-editor__actions><button type=button class=notes-overlay__text-action data-notes-interactive=true>Save</button><button type=button class=notes-overlay__text-action data-notes-interactive=true>Cancel"), wn = /* @__PURE__ */ p('<div class=notes-overlay><div class=notes-overlay__scrim></div><aside><div class=notes-overlay__rail-head><button type=button class=notes-overlay__brand aria-label="Notes topics"data-notes-interactive=true><span>Notes</span></button><button type=button class=notes-overlay__icon-button aria-label="Create topic"data-notes-interactive=true></button></div><div class=notes-overlay__topic-list></div></aside><div class=notes-overlay__viewport><div class=notes-overlay__hud><button type=button class=notes-overlay__hud-topic data-notes-interactive=true></button><button type=button class=notes-overlay__close aria-label="Close notes overlay"data-notes-interactive=true></button></div><div class=notes-overlay__board>'), $n = /* @__PURE__ */ p('<input class="notes-overlay__topic-input notes-overlay__topic-input--row"data-notes-interactive=true>'), bn = /* @__PURE__ */ p("<span>"), xn = /* @__PURE__ */ p('<div role=button tabindex=0 data-notes-interactive=true><span class=notes-overlay__topic-icon></span><span class=notes-overlay__topic-copy><span class=notes-overlay__topic-meta><span></span></span></span><span class=notes-overlay__topic-actions><button type=button class=notes-overlay__inline-icon data-notes-interactive=true></button><button type=button class="notes-overlay__inline-icon notes-overlay__inline-icon--danger"data-notes-interactive=true>'), Cn = /* @__PURE__ */ p("<span class=notes-overlay__topic-name>"), Tn = /* @__PURE__ */ p("<span>No topic"), Sn = /* @__PURE__ */ p('<span class="notes-overlay__topic-icon notes-overlay__topic-icon--hud">'), kn = /* @__PURE__ */ p("<span class=notes-overlay__hud-topic-copy><span class=notes-overlay__hud-topic-name></span><span class=notes-overlay__hud-topic-state>%"), En = /* @__PURE__ */ p("<span>Copied"), Mn = /* @__PURE__ */ p('<div><div class=notes-note__surface><div class=notes-note__toolbar><span class=notes-note__eyebrow></span><span class=notes-note__toolbar-actions><button type=button class=notes-overlay__inline-icon aria-label="Edit note"data-notes-interactive=true></button><button type=button class="notes-overlay__inline-icon notes-overlay__inline-icon--danger"aria-label="Delete note"data-notes-interactive=true></button></span></div><div class=notes-note__body>'), In = /* @__PURE__ */ p('<section class=notes-trash__group><div class=notes-trash__group-head><div class=notes-trash__group-title><span class="notes-overlay__topic-icon notes-overlay__topic-icon--hud"></span><span></span></div><button type=button class="notes-overlay__text-action notes-overlay__text-action--danger"data-notes-interactive=true>Clear</button></div><div class=notes-trash__grid>'), Pn = /* @__PURE__ */ p('<div class="notes-note notes-note--trash"><div class=notes-note__surface><div class="notes-note__toolbar notes-note__toolbar--trash"><span class=notes-note__eyebrow></span><button type=button class=notes-overlay__inline-icon aria-label="Restore note"data-notes-interactive=true></button></div><div class=notes-note__body>'), Dn = /* @__PURE__ */ p("<button type=button data-notes-interactive=true>"), Nn = /* @__PURE__ */ p('<div class=notes-minimap data-notes-interactive=true><svg viewBox="0 0 170 118"class=notes-minimap__svg aria-hidden=true><rect class=notes-minimap__viewport rx=4>'), Rn = /* @__PURE__ */ p("<svg><rect class=notes-minimap__note rx=2></svg>", !1, !0, !1);
|
|
11
|
+
const Xn = 430, Ln = 6, Yn = 960;
|
|
12
|
+
function On(o) {
|
|
13
|
+
const h = Number(o);
|
|
14
|
+
return !Number.isFinite(h) || h <= 0 ? "" : new Intl.DateTimeFormat("en-US", {
|
|
15
|
+
month: "short",
|
|
16
|
+
day: "numeric",
|
|
17
|
+
hour: "numeric",
|
|
18
|
+
minute: "2-digit"
|
|
19
|
+
}).format(new Date(h));
|
|
20
|
+
}
|
|
21
|
+
function Kt(o) {
|
|
22
|
+
const h = o instanceof HTMLElement ? o : null;
|
|
23
|
+
if (!h) return !1;
|
|
24
|
+
if (h.closest('[data-notes-interactive="true"]')) return !0;
|
|
25
|
+
const w = h.tagName.toLowerCase();
|
|
26
|
+
return w === "button" || w === "input" || w === "textarea" || w === "select" || w === "a";
|
|
27
|
+
}
|
|
28
|
+
function we(o) {
|
|
29
|
+
if (o.length < 2) return 0;
|
|
30
|
+
const h = o[0], w = o[1];
|
|
31
|
+
return Math.hypot(w.clientX - h.clientX, w.clientY - h.clientY);
|
|
32
|
+
}
|
|
33
|
+
function $e(o) {
|
|
34
|
+
if (o.length < 2) return {
|
|
35
|
+
x: 0,
|
|
36
|
+
y: 0
|
|
37
|
+
};
|
|
38
|
+
const h = o[0], w = o[1];
|
|
39
|
+
return {
|
|
40
|
+
x: (h.clientX + w.clientX) / 2,
|
|
41
|
+
y: (h.clientY + w.clientY) / 2
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function Bn(o, h, w) {
|
|
45
|
+
const U = Ue(w);
|
|
46
|
+
return {
|
|
47
|
+
x: Math.max(12, Math.min(o, window.innerWidth - qe - 16)),
|
|
48
|
+
y: Math.max(12, Math.min(h, window.innerHeight - U - 16))
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function be(o) {
|
|
52
|
+
const h = String(o.preview_text ?? "").trim();
|
|
53
|
+
return h || "Empty note";
|
|
54
|
+
}
|
|
55
|
+
function Zn(o) {
|
|
56
|
+
const h = an(), [w, U] = R({
|
|
57
|
+
width: 0,
|
|
58
|
+
height: 0
|
|
59
|
+
}), [k, wt] = R(!1), [$t, G] = R(!1), [et, B] = R(!1), [V, r] = R(null), [I, L] = R(null), [$, F] = R(null), [P, C] = R(""), [Z, dt] = R("sage"), [ut, nt] = R(!1), [_t, bt] = R(""), [Nt, ht] = R(null), [Gt, qt] = R("");
|
|
60
|
+
let W, xt, Rt, Xt, Lt, Yt, vt = null, pt = null, m = null, ot = null;
|
|
61
|
+
const Ot = x(() => o.controller.snapshot()), Ut = x(() => o.controller.loading?.() ?? !1), xe = x(() => o.controller.connectionState?.() ?? "idle"), Ce = x(() => o.controller.activeTopicID()), Y = x(() => o.controller.viewport()), lt = x(() => Ot().topics), ft = x(() => Ot().items), mt = x(() => Ot().trash_items), j = x(() => lt().find((t) => t.topic_id === Ce()) ?? lt()[0] ?? null), Ct = x(() => {
|
|
62
|
+
const t = j();
|
|
63
|
+
return t ? ft().filter((e) => e.topic_id === t.topic_id) : [];
|
|
64
|
+
}), Zt = x(() => Je(mt())), Te = x(() => {
|
|
65
|
+
const t = /* @__PURE__ */ new Map();
|
|
66
|
+
for (const e of ft())
|
|
67
|
+
t.set(e.topic_id, (t.get(e.topic_id) ?? 0) + 1);
|
|
68
|
+
return t;
|
|
69
|
+
}), Se = x(() => {
|
|
70
|
+
const t = /* @__PURE__ */ new Map();
|
|
71
|
+
for (const e of mt())
|
|
72
|
+
t.set(e.topic_id, (t.get(e.topic_id) ?? 0) + 1);
|
|
73
|
+
return t;
|
|
74
|
+
}), ke = x(() => Qe(Ct())), Ee = x(() => {
|
|
75
|
+
const t = ge(Y(), w().width || 1, w().height || 1);
|
|
76
|
+
return tn(ke(), t);
|
|
77
|
+
}), Bt = x(() => {
|
|
78
|
+
const t = $();
|
|
79
|
+
return t ? ft().find((e) => e.note_id === t) ?? null : null;
|
|
80
|
+
});
|
|
81
|
+
function Tt(t) {
|
|
82
|
+
o.controller.setViewport(typeof t == "function" ? t(Y()) : t);
|
|
83
|
+
}
|
|
84
|
+
function jt() {
|
|
85
|
+
vt != null && (window.clearTimeout(vt), vt = null), L(null);
|
|
86
|
+
}
|
|
87
|
+
function Me(t) {
|
|
88
|
+
jt(), L(t), vt = window.setTimeout(() => {
|
|
89
|
+
vt = null, L((e) => e === t ? null : e);
|
|
90
|
+
}, 1500);
|
|
91
|
+
}
|
|
92
|
+
function Ie(t) {
|
|
93
|
+
r(null);
|
|
94
|
+
}
|
|
95
|
+
function Jt() {
|
|
96
|
+
const t = window.innerWidth < Yn;
|
|
97
|
+
wt(t), G((e) => t ? e : !0);
|
|
98
|
+
}
|
|
99
|
+
function Qt(t) {
|
|
100
|
+
F(t.note_id), C(t.body), dt(t.color_token), r(null), B(!1), queueMicrotask(() => Xt?.focus());
|
|
101
|
+
}
|
|
102
|
+
function it() {
|
|
103
|
+
F(null);
|
|
104
|
+
}
|
|
105
|
+
async function te() {
|
|
106
|
+
const t = Bt();
|
|
107
|
+
if (t)
|
|
108
|
+
try {
|
|
109
|
+
await o.controller.updateNote(t.note_id, {
|
|
110
|
+
body: P(),
|
|
111
|
+
color_token: Z()
|
|
112
|
+
}), it();
|
|
113
|
+
} catch (e) {
|
|
114
|
+
h.error("Save failed", e instanceof Error ? e.message : String(e));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function ee() {
|
|
118
|
+
const t = _t().trim();
|
|
119
|
+
if (t)
|
|
120
|
+
try {
|
|
121
|
+
const e = await o.controller.createTopic({
|
|
122
|
+
name: t
|
|
123
|
+
});
|
|
124
|
+
o.controller.setActiveTopicID(e.topic_id), nt(!1), bt(""), k() && G(!1);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
h.error("Topic failed", e instanceof Error ? e.message : String(e));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function ne(t) {
|
|
130
|
+
const e = Gt().trim();
|
|
131
|
+
if (ht(null), !(!e || e === t.name))
|
|
132
|
+
try {
|
|
133
|
+
await o.controller.updateTopic(t.topic_id, {
|
|
134
|
+
name: e
|
|
135
|
+
});
|
|
136
|
+
} catch (l) {
|
|
137
|
+
h.error("Rename failed", l instanceof Error ? l.message : String(l));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async function Pe(t) {
|
|
141
|
+
try {
|
|
142
|
+
if (await o.controller.deleteTopic(t) === !1) return;
|
|
143
|
+
it();
|
|
144
|
+
} catch (e) {
|
|
145
|
+
h.error("Delete failed", e instanceof Error ? e.message : String(e));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async function oe(t, e, l, v) {
|
|
149
|
+
const f = j();
|
|
150
|
+
if (!f) {
|
|
151
|
+
h.error("Topic required", "Create a topic first.");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const y = await o.controller.createNote({
|
|
156
|
+
topic_id: f.topic_id,
|
|
157
|
+
body: l,
|
|
158
|
+
x: Math.round(t),
|
|
159
|
+
y: Math.round(e)
|
|
160
|
+
});
|
|
161
|
+
v?.openEditor && Qt(y);
|
|
162
|
+
} catch (y) {
|
|
163
|
+
h.error("Note failed", y instanceof Error ? y.message : String(y));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async function De(t, e) {
|
|
167
|
+
let l = "";
|
|
168
|
+
try {
|
|
169
|
+
l = await navigator.clipboard.readText();
|
|
170
|
+
} catch {
|
|
171
|
+
h.error("Paste failed", "Clipboard permission denied.");
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (!String(l ?? "").trim()) {
|
|
175
|
+
h.error("Clipboard empty", "Copy some text first.");
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
await oe(t, e, l, {
|
|
179
|
+
openEditor: !1
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
async function Ne(t) {
|
|
183
|
+
Promise.resolve(o.controller.bringNoteToFront(t.note_id)).catch(() => {
|
|
184
|
+
});
|
|
185
|
+
try {
|
|
186
|
+
await navigator.clipboard.writeText(t.body), Me(t.note_id);
|
|
187
|
+
} catch {
|
|
188
|
+
h.error("Copy failed", "Clipboard permission denied.");
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async function ie(t) {
|
|
192
|
+
$() === t.note_id && it();
|
|
193
|
+
try {
|
|
194
|
+
await o.controller.deleteNote(t.note_id);
|
|
195
|
+
} catch (e) {
|
|
196
|
+
h.error("Delete failed", e instanceof Error ? e.message : String(e));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async function Re(t) {
|
|
200
|
+
try {
|
|
201
|
+
const e = await o.controller.restoreNote(t.note_id);
|
|
202
|
+
o.controller.setActiveTopicID(e.topic_id), k() && B(!1);
|
|
203
|
+
} catch (e) {
|
|
204
|
+
h.error("Restore failed", e instanceof Error ? e.message : String(e));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async function Xe(t) {
|
|
208
|
+
try {
|
|
209
|
+
await o.controller.clearTrashTopic(t.topic_id);
|
|
210
|
+
} catch (e) {
|
|
211
|
+
h.error("Clear failed", e instanceof Error ? e.message : String(e));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function Le(t, e) {
|
|
215
|
+
const l = W?.getBoundingClientRect();
|
|
216
|
+
return l ? on(Y(), {
|
|
217
|
+
x: t - l.left,
|
|
218
|
+
y: e - l.top
|
|
219
|
+
}) : {
|
|
220
|
+
x: 0,
|
|
221
|
+
y: 0
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function zt(t, e, l) {
|
|
225
|
+
const v = Le(t, e), f = j() ? 2 : 0, y = l ? f + 2 : Math.max(1, f), z = Bn(t, e, y);
|
|
226
|
+
r({
|
|
227
|
+
x: z.x,
|
|
228
|
+
y: z.y,
|
|
229
|
+
worldX: v.x,
|
|
230
|
+
worldY: v.y,
|
|
231
|
+
noteID: l
|
|
232
|
+
}), B(!1);
|
|
233
|
+
}
|
|
234
|
+
function re(t, e) {
|
|
235
|
+
if (t.button === 0 && !Kt(t.target) && (Ie(), m = {
|
|
236
|
+
pointerId: t.pointerId,
|
|
237
|
+
pointerType: t.pointerType || "mouse",
|
|
238
|
+
noteID: e,
|
|
239
|
+
startClientX: t.clientX,
|
|
240
|
+
startClientY: t.clientY,
|
|
241
|
+
startViewport: Y(),
|
|
242
|
+
dragged: !1,
|
|
243
|
+
contextOpened: !1,
|
|
244
|
+
longPressTimer: null
|
|
245
|
+
}, m.pointerType !== "mouse")) {
|
|
246
|
+
const l = t.pointerId;
|
|
247
|
+
m.longPressTimer = window.setTimeout(() => {
|
|
248
|
+
!m || m.pointerId !== l || (m.contextOpened = !0, ve(() => zt(m.startClientX, m.startClientY, m.noteID)));
|
|
249
|
+
}, Xn);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function ae(t) {
|
|
253
|
+
if (!m || m.pointerId !== t) return null;
|
|
254
|
+
const e = m;
|
|
255
|
+
return e.longPressTimer != null && window.clearTimeout(e.longPressTimer), m = null, e;
|
|
256
|
+
}
|
|
257
|
+
tt(() => {
|
|
258
|
+
Jt();
|
|
259
|
+
const t = () => Jt();
|
|
260
|
+
window.addEventListener("resize", t), yt(() => window.removeEventListener("resize", t));
|
|
261
|
+
}), tt(() => {
|
|
262
|
+
W && (pt?.disconnect(), pt = new ResizeObserver((t) => {
|
|
263
|
+
const e = t[0];
|
|
264
|
+
e && U({
|
|
265
|
+
width: Math.round(e.contentRect.width),
|
|
266
|
+
height: Math.round(e.contentRect.height)
|
|
267
|
+
});
|
|
268
|
+
}), pt.observe(W), yt(() => {
|
|
269
|
+
pt?.disconnect(), pt = null;
|
|
270
|
+
}));
|
|
271
|
+
}), tt(() => {
|
|
272
|
+
o.open || (r(null), B(!1), it(), jt());
|
|
273
|
+
}), tt(() => {
|
|
274
|
+
const t = j();
|
|
275
|
+
!t && lt().length > 0 && o.controller.setActiveTopicID(lt()[0].topic_id), t && Nt() && t.topic_id !== Nt() && ht(null);
|
|
276
|
+
}), tt(() => {
|
|
277
|
+
et() && mt().length === 0 && B(!1);
|
|
278
|
+
}), tt(() => {
|
|
279
|
+
if (!o.open) return;
|
|
280
|
+
const t = (e) => {
|
|
281
|
+
if (e.key === "Escape") {
|
|
282
|
+
if (V()) {
|
|
283
|
+
r(null);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if ($()) {
|
|
287
|
+
it();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (et()) {
|
|
291
|
+
B(!1);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
o.onClose();
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
document.addEventListener("keydown", t), yt(() => document.removeEventListener("keydown", t));
|
|
298
|
+
}), tt(() => {
|
|
299
|
+
if (!o.open) return;
|
|
300
|
+
const t = (v) => {
|
|
301
|
+
if (!m || v.pointerId !== m.pointerId) return;
|
|
302
|
+
const f = v.clientX - m.startClientX, y = v.clientY - m.startClientY;
|
|
303
|
+
!m.dragged && Math.hypot(f, y) >= Ln && (m.dragged = !0, m.longPressTimer != null && (window.clearTimeout(m.longPressTimer), m.longPressTimer = null)), m.dragged && Tt({
|
|
304
|
+
x: m.startViewport.x + f,
|
|
305
|
+
y: m.startViewport.y + y,
|
|
306
|
+
scale: m.startViewport.scale
|
|
307
|
+
});
|
|
308
|
+
}, e = (v) => {
|
|
309
|
+
const f = ae(v.pointerId);
|
|
310
|
+
if (!f || f.contextOpened || f.dragged || !f.noteID) return;
|
|
311
|
+
const y = ft().find((z) => z.note_id === f.noteID);
|
|
312
|
+
y && Ne(y);
|
|
313
|
+
}, l = (v) => {
|
|
314
|
+
ae(v.pointerId);
|
|
315
|
+
};
|
|
316
|
+
document.addEventListener("pointermove", t), document.addEventListener("pointerup", e), document.addEventListener("pointercancel", l), yt(() => {
|
|
317
|
+
document.removeEventListener("pointermove", t), document.removeEventListener("pointerup", e), document.removeEventListener("pointercancel", l);
|
|
318
|
+
});
|
|
319
|
+
}), tt(() => {
|
|
320
|
+
if (!o.open) return;
|
|
321
|
+
const t = (e) => {
|
|
322
|
+
const l = e.target instanceof HTMLElement ? e.target : null;
|
|
323
|
+
V() && Rt && l && !Rt.contains(l) && r(null), et() && xt && l && !xt.contains(l) && (l.closest('[data-notes-trash-toggle="true"]') || B(!1));
|
|
324
|
+
};
|
|
325
|
+
document.addEventListener("pointerdown", t, !0), yt(() => document.removeEventListener("pointerdown", t, !0));
|
|
326
|
+
});
|
|
327
|
+
const Ye = x(() => {
|
|
328
|
+
const t = V();
|
|
329
|
+
if (!t) return [];
|
|
330
|
+
const e = [], l = !!j();
|
|
331
|
+
return e.push({
|
|
332
|
+
id: "new",
|
|
333
|
+
kind: "action",
|
|
334
|
+
label: "New note",
|
|
335
|
+
icon: We,
|
|
336
|
+
disabled: !l,
|
|
337
|
+
onSelect: () => {
|
|
338
|
+
r(null), oe(t.worldX, t.worldY, "", {
|
|
339
|
+
openEditor: !0
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}), e.push({
|
|
343
|
+
id: "paste",
|
|
344
|
+
kind: "action",
|
|
345
|
+
label: "Paste here",
|
|
346
|
+
icon: pe,
|
|
347
|
+
disabled: !l,
|
|
348
|
+
onSelect: () => {
|
|
349
|
+
r(null), De(t.worldX, t.worldY);
|
|
350
|
+
}
|
|
351
|
+
}), t.noteID && (e.push({
|
|
352
|
+
id: "sep-delete",
|
|
353
|
+
kind: "separator"
|
|
354
|
+
}), e.push({
|
|
355
|
+
id: "delete",
|
|
356
|
+
kind: "action",
|
|
357
|
+
label: "Delete note",
|
|
358
|
+
icon: Ft,
|
|
359
|
+
destructive: !0,
|
|
360
|
+
onSelect: () => {
|
|
361
|
+
r(null);
|
|
362
|
+
const v = ft().find((f) => f.note_id === t.noteID);
|
|
363
|
+
v && ie(v);
|
|
364
|
+
}
|
|
365
|
+
})), e;
|
|
366
|
+
});
|
|
367
|
+
function Oe(t) {
|
|
368
|
+
if (!W || t.target instanceof HTMLElement && Kt(t.target)) return;
|
|
369
|
+
t.preventDefault();
|
|
370
|
+
const e = W.getBoundingClientRect(), l = t.clientX - e.left, v = t.clientY - e.top, f = Math.exp(-t.deltaY * 15e-4);
|
|
371
|
+
Tt((y) => ye(y, y.scale * f, l, v));
|
|
372
|
+
}
|
|
373
|
+
function Be(t) {
|
|
374
|
+
if (t.touches.length < 2) {
|
|
375
|
+
ot = null;
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
t.preventDefault();
|
|
379
|
+
const e = $e(t.touches);
|
|
380
|
+
ot = {
|
|
381
|
+
startDistance: we(t.touches),
|
|
382
|
+
startScale: Y().scale,
|
|
383
|
+
midpointX: e.x,
|
|
384
|
+
midpointY: e.y
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
function ze(t) {
|
|
388
|
+
if (!ot || t.touches.length < 2 || !W) return;
|
|
389
|
+
t.preventDefault();
|
|
390
|
+
const e = we(t.touches);
|
|
391
|
+
if (!e || !ot.startDistance) return;
|
|
392
|
+
const l = $e(t.touches), v = W.getBoundingClientRect(), f = l.x - v.left, y = l.y - v.top, z = ot.startScale * (e / ot.startDistance);
|
|
393
|
+
Tt((H) => ye(H, z, f, y));
|
|
394
|
+
}
|
|
395
|
+
function se(t) {
|
|
396
|
+
t.touches.length < 2 && (ot = null);
|
|
397
|
+
}
|
|
398
|
+
const At = x(() => {
|
|
399
|
+
const t = Bt(), e = W?.getBoundingClientRect();
|
|
400
|
+
if (!t || !e) return {
|
|
401
|
+
left: 32,
|
|
402
|
+
top: 32
|
|
403
|
+
};
|
|
404
|
+
const l = Dt(t.size_bucket), v = nn(Y(), {
|
|
405
|
+
x: t.x,
|
|
406
|
+
y: t.y
|
|
407
|
+
}), f = l.width * Y().scale, y = e.left + v.x + f + 18, z = e.top + v.y, H = Math.min(320, Math.max(280, e.width * 0.32));
|
|
408
|
+
let b = y;
|
|
409
|
+
b + H > window.innerWidth - 16 && (b = e.left + v.x - H - 18), b = Math.max(16, Math.min(b, window.innerWidth - H - 16));
|
|
410
|
+
const St = Math.max(16, Math.min(z, window.innerHeight - 320));
|
|
411
|
+
return {
|
|
412
|
+
left: b,
|
|
413
|
+
top: St,
|
|
414
|
+
width: H
|
|
415
|
+
};
|
|
416
|
+
}), Ae = x(() => ge(Y(), w().width || 1, w().height || 1));
|
|
417
|
+
function Ve(t, e) {
|
|
418
|
+
const l = ve(w);
|
|
419
|
+
Tt((v) => rn(v, t, e, l.width || 1, l.height || 1));
|
|
420
|
+
}
|
|
421
|
+
return c(M, {
|
|
422
|
+
get when() {
|
|
423
|
+
return o.open;
|
|
424
|
+
},
|
|
425
|
+
get children() {
|
|
426
|
+
var t = wn(), e = t.firstChild, l = e.nextSibling, v = l.firstChild, f = v.firstChild, y = f.firstChild, z = f.nextSibling, H = v.nextSibling, b = l.nextSibling, St = b.firstChild, kt = St.firstChild, le = kt.nextSibling, Et = St.nextSibling;
|
|
427
|
+
t.$$contextmenu = (n) => n.preventDefault(), f.$$click = () => {
|
|
428
|
+
k() && G((n) => !n);
|
|
429
|
+
}, a(f, c(Ze, {
|
|
430
|
+
class: "h-4 w-4"
|
|
431
|
+
}), y), z.$$click = () => {
|
|
432
|
+
nt(!0), ht(null), queueMicrotask(() => Lt?.focus());
|
|
433
|
+
}, a(z, c(He, {
|
|
434
|
+
class: "h-3.5 w-3.5"
|
|
435
|
+
})), a(l, c(M, {
|
|
436
|
+
get when() {
|
|
437
|
+
return ut();
|
|
438
|
+
},
|
|
439
|
+
get children() {
|
|
440
|
+
var n = sn(), i = n.firstChild, u = i.nextSibling, _ = u.firstChild, D = _.nextSibling;
|
|
441
|
+
i.$$keydown = (N) => {
|
|
442
|
+
N.key === "Enter" && (N.preventDefault(), ee()), N.key === "Escape" && (nt(!1), bt(""));
|
|
443
|
+
}, i.$$input = (N) => bt(N.currentTarget.value);
|
|
444
|
+
var T = Lt;
|
|
445
|
+
return typeof T == "function" ? Mt(T, i) : Lt = i, _.$$click = () => {
|
|
446
|
+
ee();
|
|
447
|
+
}, D.$$click = () => {
|
|
448
|
+
nt(!1), bt("");
|
|
449
|
+
}, X(() => i.value = _t()), n;
|
|
450
|
+
}
|
|
451
|
+
}), H), a(H, c(ct, {
|
|
452
|
+
get each() {
|
|
453
|
+
return lt();
|
|
454
|
+
},
|
|
455
|
+
children: (n) => {
|
|
456
|
+
const i = Te().get(n.topic_id) ?? 0, u = Se().get(n.topic_id) ?? 0, _ = () => j()?.topic_id === n.topic_id, D = () => Nt() === n.topic_id;
|
|
457
|
+
return (() => {
|
|
458
|
+
var T = xn(), N = T.firstChild, rt = N.nextSibling, K = rt.firstChild, O = K.firstChild, at = rt.nextSibling, s = at.firstChild, J = s.nextSibling;
|
|
459
|
+
return T.$$keydown = (d) => {
|
|
460
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), o.controller.setActiveTopicID(n.topic_id), k() && G(!1));
|
|
461
|
+
}, T.$$click = () => {
|
|
462
|
+
o.controller.setActiveTopicID(n.topic_id), k() && G(!1);
|
|
463
|
+
}, a(N, c(Ht, {
|
|
464
|
+
get iconKey() {
|
|
465
|
+
return n.icon_key;
|
|
466
|
+
},
|
|
467
|
+
class: "h-4.5 w-4.5"
|
|
468
|
+
})), a(rt, c(M, {
|
|
469
|
+
get when() {
|
|
470
|
+
return D();
|
|
471
|
+
},
|
|
472
|
+
get fallback() {
|
|
473
|
+
return (() => {
|
|
474
|
+
var d = Cn();
|
|
475
|
+
return a(d, () => n.name), d;
|
|
476
|
+
})();
|
|
477
|
+
},
|
|
478
|
+
get children() {
|
|
479
|
+
var d = $n();
|
|
480
|
+
d.$$keydown = (E) => {
|
|
481
|
+
E.key === "Enter" && (E.preventDefault(), ne(n)), E.key === "Escape" && ht(null);
|
|
482
|
+
}, d.addEventListener("blur", () => {
|
|
483
|
+
ne(n);
|
|
484
|
+
}), d.$$input = (E) => qt(E.currentTarget.value), d.$$click = (E) => E.stopPropagation();
|
|
485
|
+
var A = Yt;
|
|
486
|
+
return typeof A == "function" ? Mt(A, d) : Yt = d, X(() => d.value = Gt()), d;
|
|
487
|
+
}
|
|
488
|
+
}), K), a(O, i), a(K, c(M, {
|
|
489
|
+
when: u > 0,
|
|
490
|
+
get children() {
|
|
491
|
+
var d = bn();
|
|
492
|
+
return a(d, u), d;
|
|
493
|
+
}
|
|
494
|
+
}), null), s.$$click = (d) => {
|
|
495
|
+
d.stopPropagation(), ht(n.topic_id), qt(n.name), queueMicrotask(() => Yt?.focus());
|
|
496
|
+
}, a(s, c(fe, {
|
|
497
|
+
class: "h-3.5 w-3.5"
|
|
498
|
+
})), J.$$click = (d) => {
|
|
499
|
+
d.stopPropagation(), Pe(n.topic_id);
|
|
500
|
+
}, a(J, c(Ft, {
|
|
501
|
+
class: "h-3.5 w-3.5"
|
|
502
|
+
})), X((d) => {
|
|
503
|
+
var A = Pt("notes-overlay__topic-row", _() && "is-active"), E = _() ? "true" : void 0, st = n.icon_accent, S = `Rename ${n.name}`, Q = `Delete ${n.name}`;
|
|
504
|
+
return A !== d.e && It(T, d.e = A), E !== d.t && g(T, "aria-current", d.t = E), st !== d.a && g(N, "data-accent", d.a = st), S !== d.o && g(s, "aria-label", d.o = S), Q !== d.i && g(J, "aria-label", d.i = Q), d;
|
|
505
|
+
}, {
|
|
506
|
+
e: void 0,
|
|
507
|
+
t: void 0,
|
|
508
|
+
a: void 0,
|
|
509
|
+
o: void 0,
|
|
510
|
+
i: void 0
|
|
511
|
+
}), T;
|
|
512
|
+
})();
|
|
513
|
+
}
|
|
514
|
+
}), null), a(H, c(M, {
|
|
515
|
+
get when() {
|
|
516
|
+
return he(() => !lt().length)() && !ut();
|
|
517
|
+
},
|
|
518
|
+
get children() {
|
|
519
|
+
return ln();
|
|
520
|
+
}
|
|
521
|
+
}), null), b.addEventListener("touchcancel", se), b.$$touchend = se, b.$$touchmove = ze, b.$$touchstart = Be, b.$$pointerdown = (n) => re(n, null), b.$$contextmenu = (n) => {
|
|
522
|
+
n.preventDefault(), !Kt(n.target) && zt(n.clientX, n.clientY, null);
|
|
523
|
+
}, b.addEventListener("wheel", Oe);
|
|
524
|
+
var ce = W;
|
|
525
|
+
return typeof ce == "function" ? Mt(ce, b) : W = b, kt.$$click = () => {
|
|
526
|
+
k() && G((n) => !n);
|
|
527
|
+
}, a(kt, c(M, {
|
|
528
|
+
get when() {
|
|
529
|
+
return j();
|
|
530
|
+
},
|
|
531
|
+
get fallback() {
|
|
532
|
+
return Tn();
|
|
533
|
+
},
|
|
534
|
+
children: (n) => [(() => {
|
|
535
|
+
var i = Sn();
|
|
536
|
+
return a(i, c(Ht, {
|
|
537
|
+
get iconKey() {
|
|
538
|
+
return n().icon_key;
|
|
539
|
+
},
|
|
540
|
+
class: "h-4.5 w-4.5"
|
|
541
|
+
})), X(() => g(i, "data-accent", n().icon_accent)), i;
|
|
542
|
+
})(), (() => {
|
|
543
|
+
var i = kn(), u = i.firstChild, _ = u.nextSibling, D = _.firstChild;
|
|
544
|
+
return a(u, () => n().name), a(_, () => Math.round(Y().scale * 100), D), X(() => g(_, "data-state", xe())), i;
|
|
545
|
+
})()]
|
|
546
|
+
})), le.$$click = () => o.onClose(), a(le, c(Wt, {
|
|
547
|
+
class: "h-4 w-4"
|
|
548
|
+
})), a(b, c(M, {
|
|
549
|
+
get when() {
|
|
550
|
+
return Ut();
|
|
551
|
+
},
|
|
552
|
+
get children() {
|
|
553
|
+
return cn();
|
|
554
|
+
}
|
|
555
|
+
}), Et), a(Et, c(ct, {
|
|
556
|
+
get each() {
|
|
557
|
+
return Ct();
|
|
558
|
+
},
|
|
559
|
+
children: (n) => {
|
|
560
|
+
const i = Dt(n.size_bucket), u = () => I() === n.note_id;
|
|
561
|
+
return (() => {
|
|
562
|
+
var _ = Mn(), D = _.firstChild, T = D.firstChild, N = T.firstChild, rt = N.nextSibling, K = rt.firstChild, O = K.nextSibling, at = T.nextSibling;
|
|
563
|
+
return _.$$contextmenu = (s) => {
|
|
564
|
+
s.preventDefault(), s.stopPropagation(), zt(s.clientX, s.clientY, n.note_id);
|
|
565
|
+
}, _.$$pointerdown = (s) => {
|
|
566
|
+
s.stopPropagation(), re(s, n.note_id);
|
|
567
|
+
}, a(N, () => n.character_count || 0), K.$$click = (s) => {
|
|
568
|
+
s.stopPropagation(), Qt(n);
|
|
569
|
+
}, K.$$pointerdown = (s) => s.stopPropagation(), a(K, c(fe, {
|
|
570
|
+
class: "h-3.5 w-3.5"
|
|
571
|
+
})), O.$$click = (s) => {
|
|
572
|
+
s.stopPropagation(), ie(n);
|
|
573
|
+
}, O.$$pointerdown = (s) => s.stopPropagation(), a(O, c(Ft, {
|
|
574
|
+
class: "h-3.5 w-3.5"
|
|
575
|
+
})), a(at, () => be(n)), a(D, c(M, {
|
|
576
|
+
get when() {
|
|
577
|
+
return u();
|
|
578
|
+
},
|
|
579
|
+
get children() {
|
|
580
|
+
return c(Vt.div, {
|
|
581
|
+
class: "notes-note__copied",
|
|
582
|
+
initial: {
|
|
583
|
+
opacity: 0,
|
|
584
|
+
scale: 0.88
|
|
585
|
+
},
|
|
586
|
+
animate: {
|
|
587
|
+
opacity: 1,
|
|
588
|
+
scale: 1
|
|
589
|
+
},
|
|
590
|
+
transition: {
|
|
591
|
+
duration: 0.18,
|
|
592
|
+
easing: "ease-out"
|
|
593
|
+
},
|
|
594
|
+
get children() {
|
|
595
|
+
return [c(Ke, {
|
|
596
|
+
class: "h-5 w-5"
|
|
597
|
+
}), En()];
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}), null), X((s) => {
|
|
602
|
+
var J = Pt("notes-note", u() && "is-copied"), d = n.color_token, A = String(n.size_bucket), E = `${i.width}px`, st = `${i.height}px`, S = `translate3d(${n.x}px, ${n.y}px, 0)`, Q = String(n.z_index), gt = String(i.preview_lines);
|
|
603
|
+
return J !== s.e && It(_, s.e = J), d !== s.t && g(_, "data-color", s.t = d), A !== s.a && g(_, "data-size", s.a = A), E !== s.o && q(_, "width", s.o = E), st !== s.i && q(_, "height", s.i = st), S !== s.n && q(_, "transform", s.n = S), Q !== s.s && q(_, "z-index", s.s = Q), gt !== s.h && q(_, "--notes-preview-lines", s.h = gt), s;
|
|
604
|
+
}, {
|
|
605
|
+
e: void 0,
|
|
606
|
+
t: void 0,
|
|
607
|
+
a: void 0,
|
|
608
|
+
o: void 0,
|
|
609
|
+
i: void 0,
|
|
610
|
+
n: void 0,
|
|
611
|
+
s: void 0,
|
|
612
|
+
h: void 0
|
|
613
|
+
}), _;
|
|
614
|
+
})();
|
|
615
|
+
}
|
|
616
|
+
}), null), a(Et, c(M, {
|
|
617
|
+
get when() {
|
|
618
|
+
return he(() => !!(j() && !Ct().length))() && !Ut();
|
|
619
|
+
},
|
|
620
|
+
get children() {
|
|
621
|
+
return dn();
|
|
622
|
+
}
|
|
623
|
+
}), null), a(b, c(zn, {
|
|
624
|
+
bounds: Ee,
|
|
625
|
+
items: Ct,
|
|
626
|
+
viewportRect: Ae,
|
|
627
|
+
onFocusPoint: Ve
|
|
628
|
+
}), null), a(b, c(M, {
|
|
629
|
+
get when() {
|
|
630
|
+
return !et();
|
|
631
|
+
},
|
|
632
|
+
get children() {
|
|
633
|
+
var n = _n();
|
|
634
|
+
return n.$$click = () => {
|
|
635
|
+
B(!0), r(null);
|
|
636
|
+
}, a(n, c(me, {
|
|
637
|
+
class: "h-8 w-8"
|
|
638
|
+
}), null), a(n, c(M, {
|
|
639
|
+
get when() {
|
|
640
|
+
return mt().length > 0;
|
|
641
|
+
},
|
|
642
|
+
get children() {
|
|
643
|
+
var i = un();
|
|
644
|
+
return a(i, () => mt().length), i;
|
|
645
|
+
}
|
|
646
|
+
}), null), n;
|
|
647
|
+
}
|
|
648
|
+
}), null), a(b, c(M, {
|
|
649
|
+
get when() {
|
|
650
|
+
return et();
|
|
651
|
+
},
|
|
652
|
+
get children() {
|
|
653
|
+
return c(Vt.div, {
|
|
654
|
+
ref(n) {
|
|
655
|
+
var i = xt;
|
|
656
|
+
typeof i == "function" ? i(n) : xt = n;
|
|
657
|
+
},
|
|
658
|
+
class: "notes-trash",
|
|
659
|
+
"data-notes-interactive": "true",
|
|
660
|
+
initial: {
|
|
661
|
+
opacity: 0,
|
|
662
|
+
y: 12,
|
|
663
|
+
scale: 0.98
|
|
664
|
+
},
|
|
665
|
+
animate: {
|
|
666
|
+
opacity: 1,
|
|
667
|
+
y: 0,
|
|
668
|
+
scale: 1
|
|
669
|
+
},
|
|
670
|
+
transition: {
|
|
671
|
+
duration: 0.18,
|
|
672
|
+
easing: "ease-out"
|
|
673
|
+
},
|
|
674
|
+
get children() {
|
|
675
|
+
return [(() => {
|
|
676
|
+
var n = hn(), i = n.firstChild, u = i.nextSibling;
|
|
677
|
+
return a(i, c(me, {
|
|
678
|
+
class: "h-5 w-5"
|
|
679
|
+
})), u.$$click = () => B(!1), a(u, c(Wt, {
|
|
680
|
+
class: "h-4 w-4"
|
|
681
|
+
})), n;
|
|
682
|
+
})(), (() => {
|
|
683
|
+
var n = pn();
|
|
684
|
+
return a(n, c(ct, {
|
|
685
|
+
get each() {
|
|
686
|
+
return Zt();
|
|
687
|
+
},
|
|
688
|
+
children: (i) => (() => {
|
|
689
|
+
var u = In(), _ = u.firstChild, D = _.firstChild, T = D.firstChild, N = T.nextSibling, rt = D.nextSibling, K = _.nextSibling;
|
|
690
|
+
return a(T, c(Ht, {
|
|
691
|
+
get iconKey() {
|
|
692
|
+
return i.topic_icon_key;
|
|
693
|
+
},
|
|
694
|
+
class: "h-4.5 w-4.5"
|
|
695
|
+
})), a(N, () => i.topic_name), rt.$$click = () => {
|
|
696
|
+
Xe(i);
|
|
697
|
+
}, a(K, c(ct, {
|
|
698
|
+
get each() {
|
|
699
|
+
return i.items;
|
|
700
|
+
},
|
|
701
|
+
children: (O) => {
|
|
702
|
+
const at = Dt(O.size_bucket);
|
|
703
|
+
return (() => {
|
|
704
|
+
var s = Pn(), J = s.firstChild, d = J.firstChild, A = d.firstChild, E = A.nextSibling, st = d.nextSibling;
|
|
705
|
+
return a(A, () => On(O.deleted_at_unix_ms)), E.$$click = () => {
|
|
706
|
+
Re(O);
|
|
707
|
+
}, a(E, c(pe, {
|
|
708
|
+
class: "h-3.5 w-3.5"
|
|
709
|
+
})), a(st, () => be(O)), X((S) => {
|
|
710
|
+
var Q = O.color_token, gt = String(O.size_bucket), de = `${at.width}px`, ue = `${at.height}px`, _e = String(at.preview_lines);
|
|
711
|
+
return Q !== S.e && g(s, "data-color", S.e = Q), gt !== S.t && g(s, "data-size", S.t = gt), de !== S.a && q(s, "width", S.a = de), ue !== S.o && q(s, "height", S.o = ue), _e !== S.i && q(s, "--notes-preview-lines", S.i = _e), S;
|
|
712
|
+
}, {
|
|
713
|
+
e: void 0,
|
|
714
|
+
t: void 0,
|
|
715
|
+
a: void 0,
|
|
716
|
+
o: void 0,
|
|
717
|
+
i: void 0
|
|
718
|
+
}), s;
|
|
719
|
+
})();
|
|
720
|
+
}
|
|
721
|
+
})), X(() => g(T, "data-accent", i.topic_icon_accent)), u;
|
|
722
|
+
})()
|
|
723
|
+
}), null), a(n, c(M, {
|
|
724
|
+
get when() {
|
|
725
|
+
return !Zt().length;
|
|
726
|
+
},
|
|
727
|
+
get children() {
|
|
728
|
+
return vn();
|
|
729
|
+
}
|
|
730
|
+
}), null), n;
|
|
731
|
+
})()];
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}), null), a(t, c(M, {
|
|
736
|
+
get when() {
|
|
737
|
+
return V();
|
|
738
|
+
},
|
|
739
|
+
get children() {
|
|
740
|
+
return c(Ge, {
|
|
741
|
+
get x() {
|
|
742
|
+
return V().x;
|
|
743
|
+
},
|
|
744
|
+
get y() {
|
|
745
|
+
return V().y;
|
|
746
|
+
},
|
|
747
|
+
get items() {
|
|
748
|
+
return Ye();
|
|
749
|
+
},
|
|
750
|
+
menuRef: (n) => {
|
|
751
|
+
Rt = n;
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
}), null), a(t, c(M, {
|
|
756
|
+
get when() {
|
|
757
|
+
return Bt();
|
|
758
|
+
},
|
|
759
|
+
get children() {
|
|
760
|
+
return c(Vt.div, {
|
|
761
|
+
class: "notes-editor",
|
|
762
|
+
"data-notes-interactive": "true",
|
|
763
|
+
initial: {
|
|
764
|
+
opacity: 0,
|
|
765
|
+
y: 14,
|
|
766
|
+
scale: 0.98
|
|
767
|
+
},
|
|
768
|
+
animate: {
|
|
769
|
+
opacity: 1,
|
|
770
|
+
y: 0,
|
|
771
|
+
scale: 1
|
|
772
|
+
},
|
|
773
|
+
transition: {
|
|
774
|
+
duration: 0.18,
|
|
775
|
+
easing: "ease-out"
|
|
776
|
+
},
|
|
777
|
+
get style() {
|
|
778
|
+
return {
|
|
779
|
+
left: `${At().left}px`,
|
|
780
|
+
top: `${At().top}px`,
|
|
781
|
+
width: `${At().width}px`
|
|
782
|
+
};
|
|
783
|
+
},
|
|
784
|
+
get children() {
|
|
785
|
+
return [(() => {
|
|
786
|
+
var n = fn(), i = n.firstChild, u = i.nextSibling;
|
|
787
|
+
return u.$$click = it, a(u, c(Wt, {
|
|
788
|
+
class: "h-4 w-4"
|
|
789
|
+
})), n;
|
|
790
|
+
})(), (() => {
|
|
791
|
+
var n = mn();
|
|
792
|
+
return a(n, c(ct, {
|
|
793
|
+
each: en,
|
|
794
|
+
children: (i) => (() => {
|
|
795
|
+
var u = Dn();
|
|
796
|
+
return u.$$click = () => dt(i), g(u, "data-color", i), X((_) => {
|
|
797
|
+
var D = Pt("notes-editor__color", Z() === i && "is-active"), T = `Use ${je[i]}`;
|
|
798
|
+
return D !== _.e && It(u, _.e = D), T !== _.t && g(u, "aria-label", _.t = T), _;
|
|
799
|
+
}, {
|
|
800
|
+
e: void 0,
|
|
801
|
+
t: void 0
|
|
802
|
+
}), u;
|
|
803
|
+
})()
|
|
804
|
+
})), n;
|
|
805
|
+
})(), (() => {
|
|
806
|
+
var n = gn();
|
|
807
|
+
n.$$keydown = (u) => {
|
|
808
|
+
(u.metaKey || u.ctrlKey) && u.key === "Enter" && (u.preventDefault(), te());
|
|
809
|
+
}, n.$$input = (u) => C(u.currentTarget.value);
|
|
810
|
+
var i = Xt;
|
|
811
|
+
return typeof i == "function" ? Mt(i, n) : Xt = n, g(n, "spellcheck", !1), X(() => n.value = P()), n;
|
|
812
|
+
})(), (() => {
|
|
813
|
+
var n = yn(), i = n.firstChild, u = i.nextSibling;
|
|
814
|
+
return i.$$click = () => {
|
|
815
|
+
te();
|
|
816
|
+
}, u.$$click = it, n;
|
|
817
|
+
})()];
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
}), null), X((n) => {
|
|
822
|
+
var i = Pt("notes-overlay__rail", $t() ? "is-open" : "is-closed"), u = k() ? "Open topics" : "Active topic", _ = `translate3d(${Y().x}px, ${Y().y}px, 0) scale(${Y().scale})`;
|
|
823
|
+
return i !== n.e && It(l, n.e = i), u !== n.t && g(kt, "aria-label", n.t = u), _ !== n.a && q(Et, "transform", n.a = _), n;
|
|
824
|
+
}, {
|
|
825
|
+
e: void 0,
|
|
826
|
+
t: void 0,
|
|
827
|
+
a: void 0
|
|
828
|
+
}), t;
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
function zn(o) {
|
|
833
|
+
let U = null;
|
|
834
|
+
const k = x(() => {
|
|
835
|
+
const r = o.bounds();
|
|
836
|
+
return Math.min(170 / Math.max(1, r.maxX - r.minX), 118 / Math.max(1, r.maxY - r.minY));
|
|
837
|
+
});
|
|
838
|
+
function wt(r) {
|
|
839
|
+
return (r - o.bounds().minX) * k();
|
|
840
|
+
}
|
|
841
|
+
function $t(r) {
|
|
842
|
+
return (r - o.bounds().minY) * k();
|
|
843
|
+
}
|
|
844
|
+
function G(r, I, L) {
|
|
845
|
+
const $ = Math.max(0, Math.min(170, r - L.left)), F = Math.max(0, Math.min(118, I - L.top)), P = o.bounds().minX + $ / k(), C = o.bounds().minY + F / k();
|
|
846
|
+
o.onFocusPoint(P, C);
|
|
847
|
+
}
|
|
848
|
+
function et(r) {
|
|
849
|
+
if (r.button !== 0) return;
|
|
850
|
+
r.preventDefault();
|
|
851
|
+
const I = r.currentTarget;
|
|
852
|
+
U = r.pointerId, I.setPointerCapture(r.pointerId), G(r.clientX, r.clientY, I.getBoundingClientRect());
|
|
853
|
+
}
|
|
854
|
+
function B(r) {
|
|
855
|
+
if (U !== r.pointerId) return;
|
|
856
|
+
r.preventDefault();
|
|
857
|
+
const I = r.currentTarget;
|
|
858
|
+
G(r.clientX, r.clientY, I.getBoundingClientRect());
|
|
859
|
+
}
|
|
860
|
+
function V(r) {
|
|
861
|
+
if (U !== r.pointerId) return;
|
|
862
|
+
const I = r.currentTarget;
|
|
863
|
+
I.hasPointerCapture(r.pointerId) && I.releasePointerCapture(r.pointerId), U = null;
|
|
864
|
+
}
|
|
865
|
+
return (() => {
|
|
866
|
+
var r = Nn(), I = r.firstChild, L = I.firstChild;
|
|
867
|
+
return r.addEventListener("lostpointercapture", V), r.addEventListener("pointercancel", V), r.$$pointerup = V, r.$$pointermove = B, r.$$pointerdown = et, a(I, c(ct, {
|
|
868
|
+
get each() {
|
|
869
|
+
return o.items();
|
|
870
|
+
},
|
|
871
|
+
children: ($) => {
|
|
872
|
+
const F = Dt($.size_bucket);
|
|
873
|
+
return (() => {
|
|
874
|
+
var P = Rn();
|
|
875
|
+
return X((C) => {
|
|
876
|
+
var Z = $.color_token, dt = wt($.x), ut = $t($.y), nt = Math.max(7, F.width * k()), _t = Math.max(5, F.height * k());
|
|
877
|
+
return Z !== C.e && g(P, "data-color", C.e = Z), dt !== C.t && g(P, "x", C.t = dt), ut !== C.a && g(P, "y", C.a = ut), nt !== C.o && g(P, "width", C.o = nt), _t !== C.i && g(P, "height", C.i = _t), C;
|
|
878
|
+
}, {
|
|
879
|
+
e: void 0,
|
|
880
|
+
t: void 0,
|
|
881
|
+
a: void 0,
|
|
882
|
+
o: void 0,
|
|
883
|
+
i: void 0
|
|
884
|
+
}), P;
|
|
885
|
+
})();
|
|
886
|
+
}
|
|
887
|
+
}), L), X(($) => {
|
|
888
|
+
var F = wt(o.viewportRect().minX), P = $t(o.viewportRect().minY), C = Math.max(22, (o.viewportRect().maxX - o.viewportRect().minX) * k()), Z = Math.max(18, (o.viewportRect().maxY - o.viewportRect().minY) * k());
|
|
889
|
+
return F !== $.e && g(L, "x", $.e = F), P !== $.t && g(L, "y", $.t = P), C !== $.a && g(L, "width", $.a = C), Z !== $.o && g(L, "height", $.o = Z), $;
|
|
890
|
+
}, {
|
|
891
|
+
e: void 0,
|
|
892
|
+
t: void 0,
|
|
893
|
+
a: void 0,
|
|
894
|
+
o: void 0
|
|
895
|
+
}), r;
|
|
896
|
+
})();
|
|
897
|
+
}
|
|
898
|
+
Fe(["contextmenu", "click", "input", "keydown", "pointerdown", "touchstart", "touchmove", "touchend", "pointermove", "pointerup"]);
|
|
899
|
+
export {
|
|
900
|
+
Zn as NotesOverlay
|
|
901
|
+
};
|