@floegence/floe-webapp-core 0.94.1 → 0.95.0

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.
@@ -75,6 +75,8 @@ export interface ContextMenuDirectory {
75
75
  * Context menu item definition
76
76
  */
77
77
  export interface ContextMenuItem {
78
+ /** Semantic identity for deduplicating shared context actions. */
79
+ contextActionId?: string;
78
80
  /** Unique identifier for the action */
79
81
  id: string;
80
82
  /** Display label */
@@ -163,7 +163,14 @@ export declare function useNotesOverlayModel(options: UseNotesOverlayModelOption
163
163
  };
164
164
  contextMenu: {
165
165
  state: import("solid-js").Accessor<NotesContextMenuState | null>;
166
- items: import("solid-js").Accessor<NotesContextMenuItem[]>;
166
+ items: import("solid-js").Accessor<(NotesContextMenuItem | {
167
+ id: string;
168
+ kind: "action";
169
+ label: string;
170
+ icon: () => JSX.Element;
171
+ disabled: boolean | undefined;
172
+ onSelect: () => void;
173
+ })[]>;
167
174
  position: import("solid-js").Accessor<{
168
175
  left: number;
169
176
  top: number;
@@ -1,30 +1,31 @@
1
- import { createSignal as l, createMemo as c, createEffect as p, onCleanup as Q, untrack as Ne } from "solid-js";
2
- import { useMobileLayout as wo } from "../../context/LayoutContext.js";
3
- import { Paste as vo, Plus as To, Trash as go } from "../icons/index.js";
4
- import { NOTES_CONTEXT_MENU_WIDTH_PX as yo, estimateNotesContextMenuHeight as No } from "./NotesContextMenu.js";
5
- import { samePoint as xe, resolveFrameSize as J, resolveOverviewBounds as xo, createOverviewItem as bo, clamp as P, createContextMenuPosition as Co, getNormalizedOverviewPoint as ft, normalizeNoteText as mt, findTrashTopicNoteCount as Mo, hasLiveNotesForTopic as _o, NOTES_CANVAS_ZOOM_STEP as ht, resolveCenteredViewport as Po } from "./notesOverlayHelpers.js";
6
- import { numberNotesInTopic as Io, resolveNotesDigitSequence as ee } from "./notesNumbering.js";
7
- import { normalizeNotesSnapshot as Do, groupTrashItems as So, visibleWorldRect as ko, computeBoardBounds as Oo } from "./types.js";
8
- import { useNotification as Xo } from "../../context/NotificationContext.js";
9
- const Yo = 650;
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 Ne } from "solid-js";
3
+ import { useMobileLayout as yo } from "../../context/LayoutContext.js";
4
+ import { Paste as No, Plus as xo, Trash as bo } from "../icons/index.js";
5
+ import { NOTES_CONTEXT_MENU_WIDTH_PX as Co, estimateNotesContextMenuHeight as Mo } from "./NotesContextMenu.js";
6
+ import { samePoint as xe, resolveFrameSize as J, resolveOverviewBounds as _o, createOverviewItem as Po, clamp as P, createContextMenuPosition as Io, getNormalizedOverviewPoint as ft, normalizeNoteText as mt, findTrashTopicNoteCount as So, hasLiveNotesForTopic as ko, NOTES_CANVAS_ZOOM_STEP as ht, resolveCenteredViewport as Do } from "./notesOverlayHelpers.js";
7
+ import { numberNotesInTopic as Oo, resolveNotesDigitSequence as ee } from "./notesNumbering.js";
8
+ import { normalizeNotesSnapshot as Xo, groupTrashItems as Yo, visibleWorldRect as Lo, computeBoardBounds as Ro } from "./types.js";
9
+ import { useNotification as Eo } from "../../context/NotificationContext.js";
10
+ const Fo = 650;
10
11
  function h(r) {
11
12
  return r instanceof Error ? r.message : String(r);
12
13
  }
13
- function jo(r) {
14
- const s = Xo();
14
+ function Go(r) {
15
+ const s = Eo();
15
16
  let be = 1, te = /* @__PURE__ */ new Set();
16
- const F = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map(), [Ce, wt] = l(), [I, vt] = l({ width: 0, height: 0 }), [v, u] = l(null), [Me, _e] = l(""), [A, Pe] = l(null), [Ie, oe] = l(""), [B, D] = l(null), [ne, De] = l(""), [Se, ke] = l(""), [Oe, Xe] = l("amber"), [re, Ye] = l(!1), [Le, Re] = l(!1), [V, Ee] = l(null), [ie, ce] = l(""), [Tt, C] = l(null), [S, se] = l(""), [gt, yt] = l(Date.now()), Nt = wo(), [Fe, T] = l(null), [xt, ze] = l(null), [Ae, k] = l(null), [Be, j] = l(/* @__PURE__ */ new Map());
17
+ const F = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map(), [Ce, wt] = l(), [I, vt] = l({ width: 0, height: 0 }), [v, d] = l(null), [Me, _e] = l(""), [A, 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()), Nt = yo(), [Fe, T] = l(null), [xt, ze] = l(null), [Ae, D] = l(null), [Be, j] = l(/* @__PURE__ */ new Map());
17
18
  let O, N, ae, le = null;
18
- const d = c(() => Do(r.controller.snapshot())), x = c(
19
- () => d().topics.filter((e) => e.deleted_at_unix_ms <= 0)
20
- ), bt = c(() => x().length), b = c(() => {
19
+ const u = i(() => Xo(r.controller.snapshot())), x = i(
20
+ () => u().topics.filter((e) => e.deleted_at_unix_ms <= 0)
21
+ ), bt = i(() => x().length), b = i(() => {
21
22
  const e = r.controller.activeTopicID();
22
23
  return x().some((t) => t.topic_id === e) ? e : x()[0]?.topic_id ?? "";
23
- }), X = c(
24
+ }), X = i(
24
25
  () => x().find((e) => e.topic_id === b())
25
- ), Ct = c(() => {
26
+ ), Ct = i(() => {
26
27
  const e = Be();
27
- return d().items.map((t) => {
28
+ return u().items.map((t) => {
28
29
  const o = e.get(t.note_id);
29
30
  return !o || xe({ x: t.x, y: t.y }, o) ? t : {
30
31
  ...t,
@@ -32,23 +33,23 @@ function jo(r) {
32
33
  y: o.y
33
34
  };
34
35
  });
35
- }), $ = c(
36
+ }), $ = i(
36
37
  () => Ct().filter((e) => e.topic_id === b())
37
- ), Y = c(
38
- () => Io(d().items, b())
39
- ), Mt = c(
38
+ ), Y = i(
39
+ () => Oo(u().items, b())
40
+ ), Mt = i(
40
41
  () => new Map(Y().map((e) => [e.item.note_id, e.label]))
41
- ), _t = c(() => So(d().trash_items)), Ve = c(() => d().trash_items.length), Pt = c(() => d().items.length), It = c(
42
+ ), _t = i(() => Yo(u().trash_items)), Ve = i(() => u().trash_items.length), Pt = i(() => u().items.length), It = i(
42
43
  () => $().reduce((e, t) => Math.max(e, t.z_index), 1)
43
- ), g = c(() => Ae() ?? r.controller.viewport()), Dt = c(() => X()?.name ?? "No topic"), St = c(() => `${Math.round(g().scale * 100)}%`), kt = c(() => {
44
+ ), g = i(() => Ae() ?? r.controller.viewport()), St = i(() => X()?.name ?? "No topic"), kt = i(() => `${Math.round(g().scale * 100)}%`), Dt = i(() => {
44
45
  const e = J(I());
45
- return ko(g(), e.width, e.height);
46
- }), W = c(
47
- () => xo(Oo($()), kt())
48
- ), Ot = c(
49
- () => $().map((e) => bo(e, W()))
50
- ), je = c(() => {
51
- const e = W(), t = J(I()), o = g(), n = -o.x / o.scale, i = -o.y / o.scale, a = t.width / o.scale, f = t.height / o.scale, m = P(n, e.minX, e.maxX), M = P(i, e.minY, e.maxY), _ = P(n + a, e.minX, e.maxX), ye = P(i + 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;
46
+ return Lo(g(), e.width, e.height);
47
+ }), W = i(
48
+ () => _o(Ro($()), Dt())
49
+ ), Ot = i(
50
+ () => $().map((e) => Po(e, W()))
51
+ ), je = i(() => {
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;
52
53
  return {
53
54
  left: ut,
54
55
  top: pt,
@@ -57,7 +58,7 @@ function jo(r) {
57
58
  centerX: ut + E / 2,
58
59
  centerY: pt + y / 2
59
60
  };
60
- }), Xt = c(() => {
61
+ }), Xt = i(() => {
61
62
  const e = je();
62
63
  return {
63
64
  left: `${e.left}%`,
@@ -65,17 +66,17 @@ function jo(r) {
65
66
  width: `${e.width}%`,
66
67
  height: `${e.height}%`
67
68
  };
68
- }), $e = c(() => {
69
+ }), $e = i(() => {
69
70
  const e = B();
70
- return e ? d().items.find((t) => t.note_id === e) : void 0;
71
- }), We = c(
71
+ return e ? u().items.find((t) => t.note_id === e) : void 0;
72
+ }), We = i(
72
73
  () => !!(B() || V() || A() || v() || re())
73
- ), Yt = c(() => {
74
- const e = S();
74
+ ), Yt = i(() => {
75
+ const e = k();
75
76
  if (!e) return null;
76
77
  const t = ee(e, Y());
77
78
  return t.kind !== "pending" ? null : t.exactMatch?.item.note_id ?? null;
78
- }), de = (e) => Ne(() => d().items.some((t) => t.note_id === e)), qe = () => {
79
+ }), de = (e) => Ne(() => u().items.some((t) => t.note_id === e)), qe = () => {
79
80
  const e = be;
80
81
  return be += 1, e;
81
82
  }, Lt = (e) => {
@@ -91,10 +92,10 @@ function jo(r) {
91
92
  }, fe = (e) => {
92
93
  ue(e), pe(e), q(e), T((t) => t === e ? null : t);
93
94
  }, Et = (e) => {
94
- for (const t of d().items)
95
+ for (const t of u().items)
95
96
  t.topic_id === e && fe(t.note_id);
96
97
  }, Ft = (e) => {
97
- fe(e), L(), C((t) => t === e ? null : t), u((t) => t?.noteID === e ? null : t), D((t) => t === e ? null : t);
98
+ fe(e), L(), C((t) => t === e ? null : t), d((t) => t?.noteID === e ? null : t), S((t) => t === e ? null : t);
98
99
  }, zt = () => {
99
100
  F.clear(), z.clear();
100
101
  }, L = () => {
@@ -105,8 +106,8 @@ function jo(r) {
105
106
  j((o) => {
106
107
  const n = o.get(e);
107
108
  if (n && xe(n, t)) return o;
108
- const i = new Map(o);
109
- return i.set(e, t), i;
109
+ const c = new Map(o);
110
+ return c.set(e, t), c;
110
111
  });
111
112
  }, q = (e) => {
112
113
  j((t) => {
@@ -117,7 +118,7 @@ function jo(r) {
117
118
  }, H = () => {
118
119
  Ee(null), ce("");
119
120
  }, G = () => {
120
- D(null);
121
+ S(null);
121
122
  }, R = () => {
122
123
  Re(!1);
123
124
  }, Ze = () => {
@@ -129,10 +130,10 @@ function jo(r) {
129
130
  }, Z = () => {
130
131
  Pe(null), oe("");
131
132
  }, At = () => {
132
- u(null), U(), R(), G(), H(), j(/* @__PURE__ */ new Map()), zt();
133
+ d(null), U(), R(), G(), H(), j(/* @__PURE__ */ new Map()), zt();
133
134
  }, Bt = () => {
134
135
  if (v()) {
135
- u(null);
136
+ d(null);
136
137
  return;
137
138
  }
138
139
  if (B()) {
@@ -154,13 +155,13 @@ function jo(r) {
154
155
  r.onClose();
155
156
  }, K = (e) => {
156
157
  r.controller.setActiveTopicID(e);
157
- }, Ke = (e) => _o(d().items, e), Vt = (e, t, o = X()?.topic_id) => {
158
+ }, Ke = (e) => ko(u().items, e), Vt = (e, t, o = X()?.topic_id) => {
158
159
  if (!o) return null;
159
160
  const n = x().find((m) => m.topic_id === o);
160
161
  if (!n) return null;
161
- const i = Ce();
162
- if (!i) return null;
163
- const a = i.getBoundingClientRect();
162
+ const c = Ce();
163
+ if (!c) return null;
164
+ const a = c.getBoundingClientRect();
164
165
  if (a.width <= 0 || a.height <= 0 || e < a.left || e > a.right || t < a.top || t > a.bottom)
165
166
  return null;
166
167
  const f = g();
@@ -178,7 +179,7 @@ function jo(r) {
178
179
  }, $t = (e, t) => {
179
180
  const o = jt(e, t).filter((n) => n instanceof HTMLElement).map((n) => n.closest("[data-floe-notes-note-id]")).find(Boolean)?.dataset.floeNotesNoteId?.trim();
180
181
  if (o)
181
- return d().items.find((n) => n.note_id === o);
182
+ return u().items.find((n) => n.note_id === o);
182
183
  }, he = (e, t, o) => {
183
184
  const n = Vt(e, t, o?.topicID);
184
185
  return n ? {
@@ -200,7 +201,7 @@ function jo(r) {
200
201
  };
201
202
  }, Je = (e, t, o) => {
202
203
  const n = he(e, t, o);
203
- return n ? (u(n), !0) : !1;
204
+ return n ? (d(n), !0) : !1;
204
205
  }, Wt = (e, t) => {
205
206
  const o = $t(e, t);
206
207
  if (o) {
@@ -209,13 +210,13 @@ function jo(r) {
209
210
  topicID: o.topic_id,
210
211
  noteID: o.note_id
211
212
  });
212
- u(n);
213
+ d(n);
213
214
  return;
214
215
  }
215
- u(he(e, t));
216
+ d(he(e, t));
216
217
  }, et = (e) => {
217
- k(e), r.controller.setViewport(e), k(null);
218
- }, tt = (e, t, o) => Po({
218
+ D(e), r.controller.setViewport(e), D(null);
219
+ }, tt = (e, t, o) => Do({
219
220
  viewport: g(),
220
221
  frame: I(),
221
222
  bounds: W(),
@@ -223,13 +224,13 @@ function jo(r) {
223
224
  worldY: t,
224
225
  scale: o
225
226
  }), ot = (e) => {
226
- const t = g(), o = J(I()), n = (o.width / 2 - t.x) / t.scale, i = (o.height / 2 - t.y) / t.scale, a = e === "in" ? t.scale * ht : t.scale / ht;
227
- et(tt(n, i, a));
227
+ const t = g(), o = J(I()), n = (o.width / 2 - t.x) / t.scale, c = (o.height / 2 - t.y) / t.scale, a = e === "in" ? t.scale * ht : t.scale / ht;
228
+ et(tt(n, c, a));
228
229
  }, nt = (e, t, o) => {
229
230
  const n = o.surfaceRect;
230
231
  if (n.width <= 0 || n.height <= 0) return;
231
- const i = ft(e, t, n), a = P(i.x - o.centerOffsetX, 0, 1), f = P(i.y - o.centerOffsetY, 0, 1), m = o.bounds;
232
- k(
232
+ const c = ft(e, t, n), a = P(c.x - o.centerOffsetX, 0, 1), f = P(c.y - o.centerOffsetY, 0, 1), m = o.bounds;
233
+ D(
233
234
  tt(
234
235
  m.minX + a * m.width,
235
236
  m.minY + f * m.height
@@ -240,18 +241,18 @@ function jo(r) {
240
241
  const t = Ae();
241
242
  t && r.controller.setViewport(t);
242
243
  }
243
- k(null), ze(null);
244
+ D(null), ze(null);
244
245
  }, qt = (e) => {
245
246
  if (e.button !== 0 && e.pointerType !== "touch" && e.pointerType !== "pen")
246
247
  return;
247
248
  const t = e.currentTarget, o = t.getBoundingClientRect();
248
249
  if (o.width <= 0 || o.height <= 0) return;
249
- const n = ft(e.clientX, e.clientY, o), i = je(), a = n.x * 100, f = n.y * 100, m = a >= i.left && a <= i.left + i.width && f >= i.top && f <= i.top + i.height, M = {
250
+ const n = ft(e.clientX, e.clientY, o), c = je(), a = n.x * 100, f = n.y * 100, m = a >= c.left && a <= c.left + c.width && f >= c.top && f <= c.top + c.height, M = {
250
251
  pointerId: e.pointerId,
251
252
  bounds: W(),
252
253
  surfaceRect: o,
253
- centerOffsetX: m ? n.x - i.centerX / 100 : 0,
254
- centerOffsetY: m ? n.y - i.centerY / 100 : 0
254
+ centerOffsetX: m ? n.x - c.centerX / 100 : 0,
255
+ centerOffsetY: m ? n.y - c.centerY / 100 : 0
255
256
  };
256
257
  we(!1), e.preventDefault(), e.stopPropagation(), ze(M), nt(e.clientX, e.clientY, M), t.setPointerCapture?.(e.pointerId);
257
258
  const _ = new AbortController();
@@ -276,7 +277,7 @@ function jo(r) {
276
277
  y: e.worldY,
277
278
  body: ""
278
279
  });
279
- D(t.note_id);
280
+ S(t.note_id);
280
281
  } catch (t) {
281
282
  s.error("Create failed", h(t));
282
283
  }
@@ -322,7 +323,7 @@ function jo(r) {
322
323
  }
323
324
  }, Ht = (e) => {
324
325
  N !== void 0 && window.clearTimeout(N), se(e), N = window.setTimeout(() => {
325
- if (N = void 0, Ne(S) !== e) return;
326
+ if (N = void 0, Ne(k) !== e) return;
326
327
  se("");
327
328
  const t = ee(e, Ne(Y));
328
329
  if (t.kind === "ready") {
@@ -330,12 +331,12 @@ function jo(r) {
330
331
  return;
331
332
  }
332
333
  t.kind === "pending" && t.exactMatch && ve(t.exactMatch);
333
- }, Yo);
334
+ }, Fo);
334
335
  }, lt = (e) => {
335
336
  const t = ee(e, Y());
336
337
  return t.kind === "invalid" ? !1 : t.kind === "ready" ? (w(), ve(t.match), !0) : (Ht(e), !0);
337
338
  }, Gt = (e) => {
338
- const t = S(), o = `${t}${e}`;
339
+ const t = k(), o = `${t}${e}`;
339
340
  if (!lt(t ? o : e)) {
340
341
  if (!t || e === "0") {
341
342
  w();
@@ -359,12 +360,12 @@ function jo(r) {
359
360
  }
360
361
  });
361
362
  }, Zt = (e) => {
362
- w(), u(null), D(e);
363
+ w(), d(null), S(e);
363
364
  }, Kt = async (e) => {
364
365
  w();
365
366
  const t = mt(e.body);
366
367
  if (!t) {
367
- u(null), D(e.note_id);
368
+ d(null), S(e.note_id);
368
369
  return;
369
370
  }
370
371
  try {
@@ -404,7 +405,7 @@ function jo(r) {
404
405
  await r.controller.updateNote(e, {
405
406
  headline: ne(),
406
407
  title: ne(),
407
- body: Se(),
408
+ body: ke(),
408
409
  color_token: Oe()
409
410
  }), s.success("Saved", "Note updated."), G();
410
411
  } catch (t) {
@@ -435,7 +436,7 @@ function jo(r) {
435
436
  s.error("Rename failed", h(o));
436
437
  }
437
438
  }, co = async (e) => {
438
- const t = Ke(e.topic_id) + Mo(d().trash_items, e.topic_id);
439
+ const t = Ke(e.topic_id) + So(u().trash_items, e.topic_id);
439
440
  A() === e.topic_id && Z();
440
441
  try {
441
442
  if (Et(e.topic_id), await r.controller.deleteTopic(e.topic_id) === !1) {
@@ -464,7 +465,16 @@ function jo(r) {
464
465
  return;
465
466
  }
466
467
  Ge(e, o) && pe(e);
467
- }, ge = c(() => {
468
+ }, ao = go(), lo = i(() => v() ? ao?.claim()?.actions.map((e) => ({
469
+ id: e.id,
470
+ kind: "action",
471
+ label: e.label,
472
+ icon: () => e.icon?.(),
473
+ disabled: e.disabled,
474
+ onSelect: () => {
475
+ d(null), e.onSelect();
476
+ }
477
+ })) ?? [] : []), uo = i(() => {
468
478
  const e = v();
469
479
  if (!e) return [];
470
480
  const t = [
@@ -472,20 +482,20 @@ function jo(r) {
472
482
  id: "paste",
473
483
  kind: "action",
474
484
  label: "Paste here",
475
- icon: vo,
485
+ icon: No,
476
486
  onSelect: () => {
477
487
  const o = v();
478
- o && (u(null), st(o));
488
+ o && (d(null), st(o));
479
489
  }
480
490
  },
481
491
  {
482
492
  id: "new",
483
493
  kind: "action",
484
494
  label: "New note",
485
- icon: To,
495
+ icon: xo,
486
496
  onSelect: () => {
487
497
  const o = v();
488
- o && (u(null), rt(o));
498
+ o && (d(null), rt(o));
489
499
  }
490
500
  }
491
501
  ];
@@ -493,62 +503,62 @@ function jo(r) {
493
503
  id: "delete",
494
504
  kind: "action",
495
505
  label: "Delete",
496
- icon: go,
506
+ icon: bo,
497
507
  destructive: !0,
498
508
  onSelect: () => {
499
509
  const o = v();
500
- o?.noteID && (u(null), dt(o.noteID));
510
+ o?.noteID && (d(null), dt(o.noteID));
501
511
  }
502
512
  })), t;
503
- }), ao = c(() => {
513
+ }), ge = i(() => [...lo(), ...uo()]), po = i(() => {
504
514
  const e = v();
505
515
  if (!e) return;
506
516
  const t = ge().filter((n) => n.kind === "action").length, o = ge().filter((n) => n.kind === "separator").length;
507
- return Co({
517
+ return Io({
508
518
  clientX: e.clientX,
509
519
  clientY: e.clientY,
510
- menuWidth: yo,
511
- menuHeight: No(t, o)
520
+ menuWidth: Co,
521
+ menuHeight: Mo(t, o)
512
522
  });
513
- }), lo = (e) => {
523
+ }), fo = (e) => {
514
524
  const t = X();
515
- t && u({
525
+ t && d({
516
526
  clientX: e.clientX,
517
527
  clientY: e.clientY,
518
528
  worldX: e.worldX,
519
529
  worldY: e.worldY,
520
530
  topicID: t.topic_id
521
531
  });
522
- }, uo = (e, t) => {
532
+ }, mo = (e, t) => {
523
533
  Te(t.note_id), Je(e.clientX, e.clientY, {
524
534
  topicID: t.topic_id,
525
535
  noteID: t.note_id
526
536
  });
527
- }, po = (e) => {
537
+ }, ho = (e) => {
528
538
  U(), Je(e.clientX, e.clientY);
529
- }, fo = (e) => {
539
+ }, wo = (e) => {
530
540
  e.preventDefault(), e.stopPropagation(), Wt(e.clientX, e.clientY);
531
541
  };
532
542
  p(() => {
533
- const e = new Set(d().items.map((t) => t.note_id));
543
+ const e = new Set(u().items.map((t) => t.note_id));
534
544
  for (const t of te)
535
545
  e.has(t) || Ft(t);
536
546
  te = e;
537
547
  }), p(() => {
538
548
  const e = v();
539
- e?.noteID && (de(e.noteID) || u(null));
549
+ e?.noteID && (de(e.noteID) || d(null));
540
550
  }), p(() => {
541
551
  r.open || (te = /* @__PURE__ */ new Set());
542
552
  });
543
- const mo = async () => {
553
+ const vo = async () => {
544
554
  const e = Qe();
545
555
  e && (R(), await rt(e));
546
- }, ho = async () => {
556
+ }, To = async () => {
547
557
  const e = Qe();
548
558
  e && (R(), await st(e));
549
559
  };
550
560
  return p(() => {
551
- r.open || (At(), Z(), k(null), T(null), C(null));
561
+ r.open || (At(), Z(), D(null), T(null), C(null));
552
562
  }), p(() => {
553
563
  const e = b();
554
564
  e && r.controller.activeTopicID() !== e && K(e);
@@ -558,34 +568,34 @@ function jo(r) {
558
568
  le = null;
559
569
  return;
560
570
  }
561
- le !== e.note_id && (le = e.note_id, De(e.title), ke(e.body), Xe(e.color_token));
571
+ le !== e.note_id && (le = e.note_id, Se(e.title), De(e.body), Xe(e.color_token));
562
572
  }), p(() => {
563
573
  const e = Fe();
564
574
  if (!e) return;
565
- const t = d().items.find((n) => n.note_id === e);
575
+ const t = u().items.find((n) => n.note_id === e);
566
576
  if (!t) {
567
577
  T(null);
568
578
  return;
569
579
  }
570
- const o = d().items.reduce(
571
- (n, i) => Math.max(n, i.z_index),
580
+ const o = u().items.reduce(
581
+ (n, c) => Math.max(n, c.z_index),
572
582
  0
573
583
  );
574
584
  t.z_index >= o && T(null);
575
585
  }), p(() => {
576
586
  r.open || (L(), w(), C(null));
577
587
  }), p(() => {
578
- S() && We() && w();
588
+ k() && We() && w();
579
589
  }), p(() => {
580
- const e = S();
590
+ const e = k();
581
591
  e && ee(e, Y()).kind === "invalid" && w();
582
592
  }), p(() => {
583
- const e = d().items, t = Be();
593
+ const e = u().items, t = Be();
584
594
  if (t.size === 0) return;
585
595
  let o = null;
586
- for (const [n, i] of t) {
596
+ for (const [n, c] of t) {
587
597
  const a = e.find((f) => f.note_id === n);
588
- (!a || xe({ x: a.x, y: a.y }, i)) && (o ??= new Map(t), o.delete(n));
598
+ (!a || xe({ x: a.x, y: a.y }, c)) && (o ??= new Map(t), o.delete(n));
589
599
  }
590
600
  o && j(o);
591
601
  }), p(() => {
@@ -608,7 +618,7 @@ function jo(r) {
608
618
  const e = window.setInterval(() => yt(Date.now()), 60 * 1e3);
609
619
  Q(() => window.clearInterval(e));
610
620
  }), p(() => {
611
- b() && u(null);
621
+ b() && d(null);
612
622
  }), Q(() => {
613
623
  L(), w(), we(!1);
614
624
  }), {
@@ -635,13 +645,13 @@ function jo(r) {
635
645
  },
636
646
  board: {
637
647
  activeTopic: X,
638
- activeTopicLabel: Dt,
648
+ activeTopicLabel: St,
639
649
  activeItems: $,
640
650
  activeTopicID: b,
641
651
  topics: x,
642
652
  topZIndex: It,
643
653
  viewport: g,
644
- boardScaleLabel: St,
654
+ boardScaleLabel: kt,
645
655
  isMobile: Nt,
646
656
  overviewOpen: Le,
647
657
  optimisticFrontNoteID: Fe,
@@ -650,16 +660,16 @@ function jo(r) {
650
660
  pendingShortcutNoteID: Yt,
651
661
  setCanvasFrameRef: wt,
652
662
  commitViewport: et,
653
- openCanvasContextMenu: lo,
663
+ openCanvasContextMenu: fo,
654
664
  zoomOut: () => ot("out"),
655
665
  zoomIn: () => ot("in"),
656
666
  openOverview: Ze,
657
667
  selectTopic: K,
658
- mobileCreateNote: mo,
659
- mobilePaste: ho,
668
+ mobileCreateNote: vo,
669
+ mobilePaste: To,
660
670
  seedMoveProjection: Ue,
661
671
  copyNote: Kt,
662
- openNoteContextMenu: uo,
672
+ openNoteContextMenu: mo,
663
673
  openEditor: Zt,
664
674
  moveToTrash: dt,
665
675
  startOptimisticFront: Ut,
@@ -682,7 +692,7 @@ function jo(r) {
682
692
  canDeleteNow: !!r.controller.deleteTrashedNotePermanently,
683
693
  close: U,
684
694
  openDock: me,
685
- backdropContextMenu: po,
695
+ backdropContextMenu: ho,
686
696
  restore: Qt,
687
697
  deleteNow: Jt,
688
698
  clearTopic: eo
@@ -690,17 +700,17 @@ function jo(r) {
690
700
  contextMenu: {
691
701
  state: v,
692
702
  items: ge,
693
- position: ao,
694
- close: () => u(null),
695
- retarget: fo
703
+ position: po,
704
+ close: () => d(null),
705
+ retarget: wo
696
706
  },
697
707
  editor: {
698
708
  note: $e,
699
709
  draftTitle: ne,
700
- draftBody: Se,
710
+ draftBody: ke,
701
711
  draftColor: Oe,
702
- setDraftTitle: De,
703
- setDraftBody: ke,
712
+ setDraftTitle: Se,
713
+ setDraftBody: De,
704
714
  setDraftColor: Xe,
705
715
  close: G,
706
716
  save: to
@@ -721,5 +731,5 @@ function jo(r) {
721
731
  };
722
732
  }
723
733
  export {
724
- jo as useNotesOverlayModel
734
+ Go as useNotesOverlayModel
725
735
  };
@@ -0,0 +1,42 @@
1
+ import { type JSX } from 'solid-js';
2
+ export interface ContextMenuRequest {
3
+ target: HTMLElement;
4
+ x: number;
5
+ y: number;
6
+ selection: string;
7
+ }
8
+ export interface ContextMenuAction {
9
+ id: string;
10
+ label: string;
11
+ icon?: () => JSX.Element;
12
+ onSelect: () => void;
13
+ disabled?: boolean;
14
+ }
15
+ export type ContextMenuActionRequest = {
16
+ origin: ContextMenuRequest;
17
+ actions: readonly ContextMenuAction[];
18
+ };
19
+ /** Explicit adapter boundary for editors and model-owned menus. */
20
+ export declare const useContextMenuActions: () => {
21
+ claim: () => ContextMenuActionRequest | undefined;
22
+ resolve: (request: ContextMenuRequest) => readonly ContextMenuAction[];
23
+ } | undefined;
24
+ /** One document owner. Capture before focus changes; local menus retain priority. */
25
+ export declare function ContextMenuActions(props: {
26
+ label: string;
27
+ actions: (request: ContextMenuRequest) => readonly ContextMenuAction[];
28
+ enabled?: boolean;
29
+ zIndex?: number;
30
+ editing?: {
31
+ labels: ContextMenuEditingLabels;
32
+ onError: (error: unknown) => void;
33
+ };
34
+ children: JSX.Element;
35
+ }): JSX.Element;
36
+ /** Place inside a local context menu. The local menu still owns focus and dismissal. */
37
+ export declare function ContextMenuActionItems(props: {
38
+ onClose: () => void;
39
+ excludeIds?: readonly string[];
40
+ itemClass?: string;
41
+ }): JSX.Element;
42
+ export type ContextMenuEditingLabels = Readonly<Record<'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'selectAll' | 'openLink' | 'copyLink', string>>;