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