@floegence/floe-webapp-core 0.95.0 → 0.97.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.
@@ -9,6 +9,11 @@ export interface SandboxedHtmlFrameProps {
9
9
  class?: string;
10
10
  style?: JSX.CSSProperties;
11
11
  inert?: boolean;
12
+ /** Deactivation pauses native media without restarting it on reactivation. */
13
+ active?: boolean;
14
+ /** Localized presentation while this exact document loads and reaches a render opportunity. */
15
+ renderPending?: () => JSX.Element;
16
+ onPresentationStateChange?: (state: 'loading' | 'ready') => void;
12
17
  tabIndex?: number;
13
18
  labels?: SandboxedHtmlFrameLabels;
14
19
  /** An untrusted link intent. The host must resolve and authorize every target. */
@@ -1,12 +1,24 @@
1
- import { insert as y, createComponent as x, effect as T, className as F, setAttribute as p, style as M, template as E, use as L } from "solid-js/web";
2
- import { createSignal as C, createMemo as H, createEffect as I, onCleanup as w, onMount as O, Show as S } from "solid-js";
3
- import { sandboxedMarkdownHtml as U } from "../chat/markdown/media.js";
4
- import { secureRandomUUID as A } from "../../utils/secureRandom.js";
5
- var B = /* @__PURE__ */ E('<span role=alert class="max-h-24 shrink-0 overflow-auto break-words bg-background px-3 py-2 text-xs text-destructive">'), D = /* @__PURE__ */ E('<span class="flex h-full min-h-0 w-full flex-col"><iframe sandbox=allow-scripts referrerpolicy=no-referrer style="display:block;width:100%;min-height:0;flex:1 1 0%;border:0">');
6
- function N(n) {
1
+ import { insert as g, createComponent as L, effect as O, setAttribute as m, className as P, style as U, template as T, use as R } from "solid-js/web";
2
+ import { createSignal as E, createMemo as B, createEffect as k, untrack as D, onCleanup as C, onMount as N, Show as q } from "solid-js";
3
+ import { sandboxedMarkdownHtml as W } from "../chat/markdown/media.js";
4
+ import { secureRandomUUID as j } from "../../utils/secureRandom.js";
5
+ var z = /* @__PURE__ */ T('<span data-floe-html-pending style="position:absolute;inset:0;z-index:1;background:var(--background, Canvas)">'), J = /* @__PURE__ */ T('<span role=alert class="max-h-24 shrink-0 overflow-auto break-words bg-background px-3 py-2 text-xs text-destructive">'), V = /* @__PURE__ */ T('<span class="relative flex h-full min-h-0 w-full flex-col"><iframe sandbox=allow-scripts referrerpolicy=no-referrer style="display:block;width:100%;min-height:0;flex:1 1 0%;border:0">');
6
+ function $(t) {
7
7
  return `<script>(()=>{
8
8
  const channel=new MessageChannel();
9
9
  const publish=channel.port1.postMessage.bind(channel.port1);
10
+ const query=document.querySelectorAll.bind(document);
11
+ const MediaElementType=HTMLMediaElement;
12
+ const pause=Function.call.bind(MediaElementType.prototype.pause);
13
+ let active=true;
14
+ channel.port1.onmessage=event=>{
15
+ if(event.data?.type!=='activation')return;
16
+ active=event.data.active===true;
17
+ if(!active)for(const media of query('video,audio'))pause(media);
18
+ };
19
+ channel.port1.start();
20
+ window.addEventListener('play',event=>{const media=eventTarget(event);if(!active&&media instanceof MediaElementType)pause(media)},true);
21
+ window.addEventListener('load',event=>{if(event.isTrusted)publish({type:'document-loaded'})},{once:true});
10
22
  const stop=Function.call.bind(Event.prototype.stopImmediatePropagation);
11
23
  const prevent=Function.call.bind(Event.prototype.preventDefault);
12
24
  const eventTarget=Function.call.bind(Object.getOwnPropertyDescriptor(Event.prototype,'target').get);
@@ -41,78 +53,109 @@ function N(n) {
41
53
  }
42
54
  publish({type:'open-link',href});
43
55
  }
44
- parent.postMessage({type:'floe-html-ready',token:${JSON.stringify(n)}},'*',[channel.port2]);
56
+ parent.postMessage({type:'floe-html-ready',token:${JSON.stringify(t)}},'*',[channel.port2]);
45
57
  })()<\/script>`;
46
58
  }
47
- function q(n) {
48
- let f, m;
49
- const [g, l] = C(""), v = H(() => {
50
- const r = A();
59
+ function Y(t) {
60
+ let p, y;
61
+ const [x, c] = E(""), [A, H] = E(""), [S, M] = E(), b = B(() => {
62
+ const n = j();
51
63
  return {
52
- token: r,
53
- html: U(N(r) + n.html)
64
+ token: n,
65
+ html: W($(n) + t.html)
54
66
  };
55
- });
56
- I(() => {
67
+ }), l = () => A() === b().token;
68
+ k(() => {
69
+ const n = l() ? "ready" : "loading";
70
+ D(() => t.onPresentationStateChange?.(n));
71
+ }), k(() => {
72
+ S()?.postMessage({
73
+ type: "activation",
74
+ active: t.active !== !1
75
+ });
76
+ }), k(() => {
57
77
  const {
58
- token: r
59
- } = v(), t = new AbortController();
60
- let i, e = 0;
61
- l(""), m = (o) => {
62
- !o.isTrusted || o.source !== f.contentWindow || i || o.data?.type !== "floe-html-ready" || o.data?.token !== r || o.ports.length !== 1 || (i = o.ports[0], i.onmessage = (c) => {
63
- if (t.signal.aborted || n.inert) return;
64
- const a = c.data;
78
+ token: n
79
+ } = b(), r = new AbortController();
80
+ let o, e = 0, s = 0, d = !1;
81
+ c(""), y = (i) => {
82
+ !i.isTrusted || i.source !== p.contentWindow || o || i.data?.type !== "floe-html-ready" || i.data?.token !== n || i.ports.length !== 1 || (o = i.ports[0], M(o), o.onmessage = (f) => {
83
+ if (r.signal.aborted) return;
84
+ const a = f.data;
85
+ if (a?.type === "document-loaded") {
86
+ if (d) return;
87
+ d = !0, s = requestAnimationFrame(() => {
88
+ s = requestAnimationFrame(() => {
89
+ r.signal.aborted || H(n);
90
+ });
91
+ });
92
+ return;
93
+ }
94
+ if (t.inert || t.active === !1 || !l()) return;
65
95
  if (a?.type === "anchor-opened") {
66
- l("");
96
+ c("");
67
97
  return;
68
98
  }
69
99
  if (a?.type === "anchor-missing") {
70
- l(n.labels?.anchorUnavailable ?? "The linked section was not found.");
100
+ c(t.labels?.anchorUnavailable ?? "The linked section was not found.");
71
101
  return;
72
102
  }
73
103
  if (a?.type !== "open-link" || typeof a.href != "string" || a.href.length > 8192) return;
74
- const d = a.href, s = n.onOpenLink, u = n.labels?.linkUnavailable, k = ++e;
75
- l(""), Promise.resolve().then(() => {
76
- if (!t.signal.aborted) {
77
- if (!s) throw new Error(u ?? "Opening links is unavailable in this preview.");
78
- return s(d, t.signal);
104
+ const v = a.href, u = t.onOpenLink, h = t.labels?.linkUnavailable, I = ++e;
105
+ c(""), Promise.resolve().then(() => {
106
+ if (!r.signal.aborted) {
107
+ if (!u) throw new Error(h ?? "Opening links is unavailable in this preview.");
108
+ return u(v, r.signal);
79
109
  }
80
- }).catch((h) => {
81
- !t.signal.aborted && k === e && l(h instanceof Error && h.message ? h.message : u ?? "This link could not be opened.");
110
+ }).catch((w) => {
111
+ !r.signal.aborted && I === e && c(w instanceof Error && w.message ? w.message : h ?? "This link could not be opened.");
82
112
  });
83
- }, i.start());
84
- }, w(() => {
85
- t.abort(), i?.close(), m = void 0;
113
+ }, o.start());
114
+ }, C(() => {
115
+ r.abort(), cancelAnimationFrame(s), o?.close(), M(void 0), y = void 0;
86
116
  });
87
117
  });
88
- const b = (r) => m?.(r);
89
- return O(() => {
90
- window.addEventListener("message", b), w(() => window.removeEventListener("message", b));
118
+ const F = (n) => y?.(n);
119
+ return N(() => {
120
+ window.addEventListener("message", F), C(() => window.removeEventListener("message", F));
91
121
  }), (() => {
92
- var r = D(), t = r.firstChild, i = f;
93
- return typeof i == "function" ? L(i, t) : f = t, y(r, x(S, {
122
+ var n = V(), r = n.firstChild;
123
+ g(n, L(q, {
124
+ get when() {
125
+ return !l();
126
+ },
127
+ get children() {
128
+ var e = z();
129
+ return g(e, () => t.renderPending?.()), e;
130
+ }
131
+ }), r);
132
+ var o = p;
133
+ return typeof o == "function" ? R(o, r) : p = r, g(n, L(q, {
94
134
  get when() {
95
- return g();
135
+ return x();
96
136
  },
97
137
  get children() {
98
- var e = B();
99
- return y(e, g), e;
138
+ var e = J();
139
+ return g(e, x), e;
100
140
  }
101
- }), null), T((e) => {
102
- var o = n.class, c = n.title, a = v().html, d = n.inert, s = n.tabIndex, u = {
103
- ...n.style
141
+ }), null), O((e) => {
142
+ var s = l() ? "ready" : "loading", d = !l(), i = t.class, f = t.title, a = b().html, v = t.inert || t.active === !1 || !l(), u = t.inert || t.active === !1 || !l() ? -1 : t.tabIndex, h = {
143
+ ...t.style,
144
+ opacity: l() ? void 0 : "0"
104
145
  };
105
- return o !== e.e && F(t, e.e = o), c !== e.t && p(t, "title", e.t = c), a !== e.a && p(t, "srcdoc", e.a = a), d !== e.o && (t.inert = e.o = d), s !== e.i && p(t, "tabindex", e.i = s), e.n = M(t, u, e.n), e;
146
+ return s !== e.e && m(n, "data-floe-html-state", e.e = s), d !== e.t && m(n, "aria-busy", e.t = d), i !== e.a && P(r, e.a = i), f !== e.o && m(r, "title", e.o = f), a !== e.i && m(r, "srcdoc", e.i = a), v !== e.n && (r.inert = e.n = v), u !== e.s && m(r, "tabindex", e.s = u), e.h = U(r, h, e.h), e;
106
147
  }, {
107
148
  e: void 0,
108
149
  t: void 0,
109
150
  a: void 0,
110
151
  o: void 0,
111
152
  i: void 0,
112
- n: void 0
113
- }), r;
153
+ n: void 0,
154
+ s: void 0,
155
+ h: void 0
156
+ }), n;
114
157
  })();
115
158
  }
116
159
  export {
117
- q as SandboxedHtmlFrame
160
+ Y as SandboxedHtmlFrame
118
161
  };
@@ -167,7 +167,9 @@ export declare function useNotesOverlayModel(options: UseNotesOverlayModelOption
167
167
  id: string;
168
168
  kind: "action";
169
169
  label: string;
170
- icon: () => JSX.Element;
170
+ icon: (props: {
171
+ class?: string;
172
+ }) => JSX.Element;
171
173
  disabled: boolean | undefined;
172
174
  onSelect: () => void;
173
175
  })[]>;
@@ -1,33 +1,33 @@
1
- import { useContextMenuActions as go } from "../ui/ContextMenuActions.js";
2
- import { createSignal as l, createMemo as i, createEffect as p, onCleanup as Q, untrack as 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;
1
+ import { useContextMenuActions as go, ContextMenuActionIcon as yo } from "../ui/ContextMenuActions.js";
2
+ import { createSignal as l, createMemo as i, createEffect as p, onCleanup as Q, untrack as xe } from "solid-js";
3
+ import { useMobileLayout as xo } from "../../context/LayoutContext.js";
4
+ import { Paste as No, Plus as bo, Trash as Co } from "../icons/index.js";
5
+ import { NOTES_CONTEXT_MENU_WIDTH_PX as Mo, estimateNotesContextMenuHeight as _o } from "./NotesContextMenu.js";
6
+ import { samePoint as Ne, resolveFrameSize as J, resolveOverviewBounds as Po, createOverviewItem as Io, clamp as P, createContextMenuPosition as So, getNormalizedOverviewPoint as ft, normalizeNoteText as mt, findTrashTopicNoteCount as ko, hasLiveNotesForTopic as Do, NOTES_CANVAS_ZOOM_STEP as ht, resolveCenteredViewport as Oo } from "./notesOverlayHelpers.js";
7
+ import { numberNotesInTopic as Xo, resolveNotesDigitSequence as ee } from "./notesNumbering.js";
8
+ import { normalizeNotesSnapshot as Yo, groupTrashItems as Lo, visibleWorldRect as Ro, computeBoardBounds as Eo } from "./types.js";
9
+ import { useNotification as Fo } from "../../context/NotificationContext.js";
10
+ const Ao = 650;
11
11
  function h(r) {
12
12
  return r instanceof Error ? r.message : String(r);
13
13
  }
14
- function Go(r) {
15
- const s = Eo();
14
+ function Uo(r) {
15
+ const s = Fo();
16
16
  let be = 1, te = /* @__PURE__ */ new Set();
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());
18
- let O, N, ae, le = null;
19
- const u = i(() => Xo(r.controller.snapshot())), x = i(
17
+ const F = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), [Ce, wt] = l(), [I, vt] = l({ width: 0, height: 0 }), [v, d] = l(null), [Me, _e] = l(""), [z, Pe] = l(null), [Ie, oe] = l(""), [B, S] = l(null), [ne, Se] = l(""), [ke, De] = l(""), [Oe, Xe] = l("amber"), [re, Ye] = l(!1), [Le, Re] = l(!1), [V, Ee] = l(null), [ie, ce] = l(""), [Tt, C] = l(null), [k, se] = l(""), [gt, yt] = l(Date.now()), xt = xo(), [Fe, T] = l(null), [Nt, Ae] = l(null), [ze, D] = l(null), [Be, j] = l(/* @__PURE__ */ new Map());
18
+ let O, x, ae, le = null;
19
+ const u = i(() => Yo(r.controller.snapshot())), N = i(
20
20
  () => u().topics.filter((e) => e.deleted_at_unix_ms <= 0)
21
- ), bt = i(() => x().length), b = i(() => {
21
+ ), bt = i(() => N().length), b = i(() => {
22
22
  const e = r.controller.activeTopicID();
23
- return x().some((t) => t.topic_id === e) ? e : x()[0]?.topic_id ?? "";
23
+ return N().some((t) => t.topic_id === e) ? e : N()[0]?.topic_id ?? "";
24
24
  }), X = i(
25
- () => x().find((e) => e.topic_id === b())
25
+ () => N().find((e) => e.topic_id === b())
26
26
  ), Ct = i(() => {
27
27
  const e = Be();
28
28
  return u().items.map((t) => {
29
29
  const o = e.get(t.note_id);
30
- return !o || xe({ x: t.x, y: t.y }, o) ? t : {
30
+ return !o || Ne({ x: t.x, y: t.y }, o) ? t : {
31
31
  ...t,
32
32
  x: o.x,
33
33
  y: o.y
@@ -36,18 +36,18 @@ function Go(r) {
36
36
  }), $ = i(
37
37
  () => Ct().filter((e) => e.topic_id === b())
38
38
  ), Y = i(
39
- () => Oo(u().items, b())
39
+ () => Xo(u().items, b())
40
40
  ), Mt = i(
41
41
  () => new Map(Y().map((e) => [e.item.note_id, e.label]))
42
- ), _t = i(() => Yo(u().trash_items)), Ve = i(() => u().trash_items.length), Pt = i(() => u().items.length), It = i(
42
+ ), _t = i(() => Lo(u().trash_items)), Ve = i(() => u().trash_items.length), Pt = i(() => u().items.length), It = i(
43
43
  () => $().reduce((e, t) => Math.max(e, t.z_index), 1)
44
- ), g = i(() => Ae() ?? r.controller.viewport()), St = i(() => X()?.name ?? "No topic"), kt = i(() => `${Math.round(g().scale * 100)}%`), Dt = i(() => {
44
+ ), g = i(() => ze() ?? r.controller.viewport()), St = i(() => X()?.name ?? "No topic"), kt = i(() => `${Math.round(g().scale * 100)}%`), Dt = i(() => {
45
45
  const e = J(I());
46
- return Lo(g(), e.width, e.height);
46
+ return Ro(g(), e.width, e.height);
47
47
  }), W = i(
48
- () => _o(Ro($()), Dt())
48
+ () => Po(Eo($()), Dt())
49
49
  ), Ot = i(
50
- () => $().map((e) => Po(e, W()))
50
+ () => $().map((e) => Io(e, W()))
51
51
  ), je = i(() => {
52
52
  const e = W(), t = J(I()), o = g(), n = -o.x / o.scale, c = -o.y / o.scale, a = t.width / o.scale, f = t.height / o.scale, m = P(n, e.minX, e.maxX), M = P(c, e.minY, e.maxY), _ = P(n + a, e.minX, e.maxX), ye = P(c + f, e.minY, e.maxY), E = Math.max((_ - m) / e.width * 100, 6), y = Math.max((ye - M) / e.height * 100, 8), ut = (m - e.minX) / e.width * 100, pt = (M - e.minY) / e.height * 100;
53
53
  return {
@@ -70,13 +70,13 @@ function Go(r) {
70
70
  const e = B();
71
71
  return e ? u().items.find((t) => t.note_id === e) : void 0;
72
72
  }), We = i(
73
- () => !!(B() || V() || A() || v() || re())
73
+ () => !!(B() || V() || z() || v() || re())
74
74
  ), Yt = i(() => {
75
75
  const e = k();
76
76
  if (!e) return null;
77
77
  const t = ee(e, Y());
78
78
  return t.kind !== "pending" ? null : t.exactMatch?.item.note_id ?? null;
79
- }), de = (e) => Ne(() => u().items.some((t) => t.note_id === e)), qe = () => {
79
+ }), de = (e) => xe(() => u().items.some((t) => t.note_id === e)), qe = () => {
80
80
  const e = be;
81
81
  return be += 1, e;
82
82
  }, Lt = (e) => {
@@ -84,11 +84,11 @@ function Go(r) {
84
84
  return F.set(e, t), t;
85
85
  }, Rt = (e) => {
86
86
  const t = qe();
87
- return z.set(e, t), t;
88
- }, He = (e, t) => F.get(e) === t, Ge = (e, t) => z.get(e) === t, ue = (e) => {
87
+ return A.set(e, t), t;
88
+ }, He = (e, t) => F.get(e) === t, Ge = (e, t) => A.get(e) === t, ue = (e) => {
89
89
  F.delete(e);
90
90
  }, pe = (e) => {
91
- z.delete(e);
91
+ A.delete(e);
92
92
  }, fe = (e) => {
93
93
  ue(e), pe(e), q(e), T((t) => t === e ? null : t);
94
94
  }, Et = (e) => {
@@ -96,16 +96,16 @@ function Go(r) {
96
96
  t.topic_id === e && fe(t.note_id);
97
97
  }, Ft = (e) => {
98
98
  fe(e), L(), C((t) => t === e ? null : t), d((t) => t?.noteID === e ? null : t), S((t) => t === e ? null : t);
99
- }, zt = () => {
100
- F.clear(), z.clear();
99
+ }, At = () => {
100
+ F.clear(), A.clear();
101
101
  }, L = () => {
102
102
  O !== void 0 && (window.clearTimeout(O), O = void 0);
103
103
  }, w = () => {
104
- N !== void 0 && (window.clearTimeout(N), N = void 0), se("");
104
+ x !== void 0 && (window.clearTimeout(x), x = void 0), se("");
105
105
  }, Ue = (e, t) => {
106
106
  j((o) => {
107
107
  const n = o.get(e);
108
- if (n && xe(n, t)) return o;
108
+ if (n && Ne(n, t)) return o;
109
109
  const c = new Map(o);
110
110
  return c.set(e, t), c;
111
111
  });
@@ -129,8 +129,8 @@ function Go(r) {
129
129
  Ye(!0);
130
130
  }, Z = () => {
131
131
  Pe(null), oe("");
132
- }, At = () => {
133
- d(null), U(), R(), G(), H(), j(/* @__PURE__ */ new Map()), zt();
132
+ }, zt = () => {
133
+ d(null), U(), R(), G(), H(), j(/* @__PURE__ */ new Map()), At();
134
134
  }, Bt = () => {
135
135
  if (v()) {
136
136
  d(null);
@@ -155,9 +155,9 @@ function Go(r) {
155
155
  r.onClose();
156
156
  }, K = (e) => {
157
157
  r.controller.setActiveTopicID(e);
158
- }, Ke = (e) => ko(u().items, e), Vt = (e, t, o = X()?.topic_id) => {
158
+ }, Ke = (e) => Do(u().items, e), Vt = (e, t, o = X()?.topic_id) => {
159
159
  if (!o) return null;
160
- const n = x().find((m) => m.topic_id === o);
160
+ const n = N().find((m) => m.topic_id === o);
161
161
  if (!n) return null;
162
162
  const c = Ce();
163
163
  if (!c) return null;
@@ -216,7 +216,7 @@ function Go(r) {
216
216
  d(he(e, t));
217
217
  }, et = (e) => {
218
218
  D(e), r.controller.setViewport(e), D(null);
219
- }, tt = (e, t, o) => Do({
219
+ }, tt = (e, t, o) => Oo({
220
220
  viewport: g(),
221
221
  frame: I(),
222
222
  bounds: W(),
@@ -238,10 +238,10 @@ function Go(r) {
238
238
  );
239
239
  }, we = (e) => {
240
240
  if (ae?.abort(), ae = void 0, e) {
241
- const t = Ae();
241
+ const t = ze();
242
242
  t && r.controller.setViewport(t);
243
243
  }
244
- D(null), ze(null);
244
+ D(null), Ae(null);
245
245
  }, qt = (e) => {
246
246
  if (e.button !== 0 && e.pointerType !== "touch" && e.pointerType !== "pen")
247
247
  return;
@@ -254,7 +254,7 @@ function Go(r) {
254
254
  centerOffsetX: m ? n.x - c.centerX / 100 : 0,
255
255
  centerOffsetY: m ? n.y - c.centerY / 100 : 0
256
256
  };
257
- we(!1), e.preventDefault(), e.stopPropagation(), ze(M), nt(e.clientX, e.clientY, M), t.setPointerCapture?.(e.pointerId);
257
+ we(!1), e.preventDefault(), e.stopPropagation(), Ae(M), nt(e.clientX, e.clientY, M), t.setPointerCapture?.(e.pointerId);
258
258
  const _ = new AbortController();
259
259
  ae = _;
260
260
  const ye = (y) => {
@@ -322,16 +322,16 @@ function Go(r) {
322
322
  s.error("Copy failed", "Clipboard write was not available.");
323
323
  }
324
324
  }, Ht = (e) => {
325
- N !== void 0 && window.clearTimeout(N), se(e), N = window.setTimeout(() => {
326
- if (N = void 0, Ne(k) !== e) return;
325
+ x !== void 0 && window.clearTimeout(x), se(e), x = window.setTimeout(() => {
326
+ if (x = void 0, xe(k) !== e) return;
327
327
  se("");
328
- const t = ee(e, Ne(Y));
328
+ const t = ee(e, xe(Y));
329
329
  if (t.kind === "ready") {
330
330
  ve(t.match);
331
331
  return;
332
332
  }
333
333
  t.kind === "pending" && t.exactMatch && ve(t.exactMatch);
334
- }, Fo);
334
+ }, Ao);
335
335
  }, lt = (e) => {
336
336
  const t = ee(e, Y());
337
337
  return t.kind === "invalid" ? !1 : t.kind === "ready" ? (w(), ve(t.match), !0) : (Ht(e), !0);
@@ -426,7 +426,7 @@ function Go(r) {
426
426
  }, ro = (e) => {
427
427
  Pe(e.topic_id), oe(e.name);
428
428
  }, io = async () => {
429
- const e = A();
429
+ const e = z();
430
430
  if (!e) return;
431
431
  const t = Ie().trim();
432
432
  if (Z(), !!t)
@@ -436,8 +436,8 @@ function Go(r) {
436
436
  s.error("Rename failed", h(o));
437
437
  }
438
438
  }, co = async (e) => {
439
- const t = Ke(e.topic_id) + So(u().trash_items, e.topic_id);
440
- A() === e.topic_id && Z();
439
+ const t = Ke(e.topic_id) + ko(u().trash_items, e.topic_id);
440
+ z() === e.topic_id && Z();
441
441
  try {
442
442
  if (Et(e.topic_id), await r.controller.deleteTopic(e.topic_id) === !1) {
443
443
  s.info("Keep one topic", "At least one topic needs to remain available.");
@@ -469,7 +469,7 @@ function Go(r) {
469
469
  id: e.id,
470
470
  kind: "action",
471
471
  label: e.label,
472
- icon: () => e.icon?.(),
472
+ icon: (t) => yo({ icon: e.icon, class: t.class }),
473
473
  disabled: e.disabled,
474
474
  onSelect: () => {
475
475
  d(null), e.onSelect();
@@ -492,7 +492,7 @@ function Go(r) {
492
492
  id: "new",
493
493
  kind: "action",
494
494
  label: "New note",
495
- icon: xo,
495
+ icon: bo,
496
496
  onSelect: () => {
497
497
  const o = v();
498
498
  o && (d(null), rt(o));
@@ -503,7 +503,7 @@ function Go(r) {
503
503
  id: "delete",
504
504
  kind: "action",
505
505
  label: "Delete",
506
- icon: bo,
506
+ icon: Co,
507
507
  destructive: !0,
508
508
  onSelect: () => {
509
509
  const o = v();
@@ -514,11 +514,11 @@ function Go(r) {
514
514
  const e = v();
515
515
  if (!e) return;
516
516
  const t = ge().filter((n) => n.kind === "action").length, o = ge().filter((n) => n.kind === "separator").length;
517
- return Io({
517
+ return So({
518
518
  clientX: e.clientX,
519
519
  clientY: e.clientY,
520
- menuWidth: Co,
521
- menuHeight: Mo(t, o)
520
+ menuWidth: Mo,
521
+ menuHeight: _o(t, o)
522
522
  });
523
523
  }), fo = (e) => {
524
524
  const t = X();
@@ -558,7 +558,7 @@ function Go(r) {
558
558
  e && (R(), await st(e));
559
559
  };
560
560
  return p(() => {
561
- r.open || (At(), Z(), D(null), T(null), C(null));
561
+ r.open || (zt(), Z(), D(null), T(null), C(null));
562
562
  }), p(() => {
563
563
  const e = b();
564
564
  e && r.controller.activeTopicID() !== e && K(e);
@@ -595,7 +595,7 @@ function Go(r) {
595
595
  let o = null;
596
596
  for (const [n, c] of t) {
597
597
  const a = e.find((f) => f.note_id === n);
598
- (!a || xe({ x: a.x, y: a.y }, c)) && (o ??= new Map(t), o.delete(n));
598
+ (!a || Ne({ x: a.x, y: a.y }, c)) && (o ??= new Map(t), o.delete(n));
599
599
  }
600
600
  o && j(o);
601
601
  }), p(() => {
@@ -628,10 +628,10 @@ function Go(r) {
628
628
  trashCount: Ve
629
629
  },
630
630
  rail: {
631
- topics: x,
631
+ topics: N,
632
632
  activeTopicID: b,
633
633
  draftTopicTitle: Me,
634
- renamingTopicID: A,
634
+ renamingTopicID: z,
635
635
  renamingTopicTitle: Ie,
636
636
  getLiveNoteCount: Ke,
637
637
  setDraftTopicTitle: _e,
@@ -648,11 +648,11 @@ function Go(r) {
648
648
  activeTopicLabel: St,
649
649
  activeItems: $,
650
650
  activeTopicID: b,
651
- topics: x,
651
+ topics: N,
652
652
  topZIndex: It,
653
653
  viewport: g,
654
654
  boardScaleLabel: kt,
655
- isMobile: Nt,
655
+ isMobile: xt,
656
656
  overviewOpen: Le,
657
657
  optimisticFrontNoteID: Fe,
658
658
  copiedNoteID: Tt,
@@ -679,7 +679,7 @@ function Go(r) {
679
679
  overview: {
680
680
  items: Ot,
681
681
  viewportStyle: Xt,
682
- navigationState: xt,
682
+ navigationState: Nt,
683
683
  beginNavigation: qt,
684
684
  close: R,
685
685
  open: Ze
@@ -731,5 +731,5 @@ function Go(r) {
731
731
  };
732
732
  }
733
733
  export {
734
- Go as useNotesOverlayModel
734
+ Uo as useNotesOverlayModel
735
735
  };
@@ -21,6 +21,11 @@ export declare const useContextMenuActions: () => {
21
21
  claim: () => ContextMenuActionRequest | undefined;
22
22
  resolve: (request: ContextMenuRequest) => readonly ContextMenuAction[];
23
23
  } | undefined;
24
+ /** Composite icons must never determine the menu's intrinsic size. */
25
+ export declare function ContextMenuActionIcon(props: {
26
+ icon?: () => JSX.Element;
27
+ class?: string;
28
+ }): JSX.Element;
24
29
  /** One document owner. Capture before focus changes; local menus retain priority. */
25
30
  export declare function ContextMenuActions(props: {
26
31
  label: string;