@floegence/floe-webapp-core 0.35.43 → 0.35.45
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.js +17 -17
- package/dist/components/notes/NotesEditorFlyout.js +4 -4
- package/dist/components/notes/NotesOverlay.js +203 -167
- package/dist/components/notes/NotesTrashFlyout.js +4 -4
- package/dist/context/CommandContext.d.ts +2 -0
- package/dist/context/CommandContext.js +47 -49
- package/dist/context/ComponentRegistry.d.ts +1 -0
- package/dist/context/ComponentRegistry.js +40 -39
- package/dist/hooks/useOverlayMask.d.ts +4 -0
- package/dist/hooks/useOverlayMask.js +37 -32
- package/package.json +1 -1
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { use as
|
|
1
|
+
import { use as f, insert as s, createComponent as m, addEventListener as E, effect as d, className as T, setStyleProperty as v, template as i, delegateEvents as N } from "solid-js/web";
|
|
2
2
|
import { For as x } from "solid-js";
|
|
3
3
|
import { cn as C } from "../../utils/cn.js";
|
|
4
|
-
var O = /* @__PURE__ */
|
|
5
|
-
const
|
|
6
|
-
function
|
|
4
|
+
var O = /* @__PURE__ */ i('<div role=menu class="notes-context-menu notes-menu"data-floe-notes-boundary=true>'), h = /* @__PURE__ */ i("<div role=separator aria-orientation=horizontal class=notes-context-menu__separator>"), I = /* @__PURE__ */ i("<button type=button role=menuitem><span class=notes-context-menu__label>");
|
|
5
|
+
const A = 188, M = 16, X = 32, b = 9;
|
|
6
|
+
function P(t) {
|
|
7
7
|
return t.kind === "action";
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return M + Math.max(1, t) * X + Math.max(0, n) *
|
|
9
|
+
function H(t, n = 0) {
|
|
10
|
+
return M + Math.max(1, t) * X + Math.max(0, n) * b;
|
|
11
11
|
}
|
|
12
12
|
function R(t) {
|
|
13
13
|
return (() => {
|
|
14
14
|
var n = O();
|
|
15
15
|
n.$$contextmenu = (e) => e.preventDefault();
|
|
16
|
-
var
|
|
17
|
-
return typeof
|
|
16
|
+
var u = t.menuRef;
|
|
17
|
+
return typeof u == "function" ? f(u, n) : t.menuRef = n, s(n, m(x, {
|
|
18
18
|
get each() {
|
|
19
19
|
return t.items;
|
|
20
20
|
},
|
|
21
21
|
children: (e) => {
|
|
22
|
-
if (!
|
|
22
|
+
if (!P(e))
|
|
23
23
|
return h();
|
|
24
24
|
const a = e.icon;
|
|
25
25
|
return (() => {
|
|
26
|
-
var o = I(),
|
|
27
|
-
return
|
|
26
|
+
var o = I(), c = o.firstChild;
|
|
27
|
+
return E(o, "click", e.onSelect, !0), s(o, m(a, {
|
|
28
28
|
class: "h-3.5 w-3.5"
|
|
29
|
-
}),
|
|
29
|
+
}), c), s(c, () => e.label), d((r) => {
|
|
30
30
|
var l = C("notes-context-menu__item notes-menu__item", e.destructive && "is-destructive is-danger"), _ = e.disabled;
|
|
31
|
-
return l !== r.e &&
|
|
31
|
+
return l !== r.e && T(o, r.e = l), _ !== r.t && (o.disabled = r.t = _), r;
|
|
32
32
|
}, {
|
|
33
33
|
e: void 0,
|
|
34
34
|
t: void 0
|
|
35
35
|
}), o;
|
|
36
36
|
})();
|
|
37
37
|
}
|
|
38
|
-
})),
|
|
38
|
+
})), d((e) => {
|
|
39
39
|
var a = `${t.x}px`, o = `${t.y}px`;
|
|
40
|
-
return a !== e.e &&
|
|
40
|
+
return a !== e.e && v(n, "left", e.e = a), o !== e.t && v(n, "top", e.t = o), e;
|
|
41
41
|
}, {
|
|
42
42
|
e: void 0,
|
|
43
43
|
t: void 0
|
|
@@ -46,7 +46,7 @@ function R(t) {
|
|
|
46
46
|
}
|
|
47
47
|
N(["contextmenu", "click"]);
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
A as NOTES_CONTEXT_MENU_WIDTH_PX,
|
|
50
50
|
R as NotesContextMenu,
|
|
51
|
-
|
|
51
|
+
H as estimateNotesContextMenuHeight
|
|
52
52
|
};
|
|
@@ -6,10 +6,10 @@ import { noteColorClass as L } from "./notesOverlayHelpers.js";
|
|
|
6
6
|
import { NOTE_COLOR_TOKENS as B } from "./types.js";
|
|
7
7
|
import { Textarea as y } from "../ui/Input.js";
|
|
8
8
|
import { Button as v } from "../ui/Button.js";
|
|
9
|
-
var P = /* @__PURE__ */ f('<div class="notes-flyout notes-flyout--editor"><div class=notes-flyout__header><div><div class=notes-editor__label>Edit note</div><div class=notes-flyout__title></div></div><button type=button class=notes-flyout__close aria-label="Close editor"></button></div><div class=notes-editor><div class=notes-editor__palette><div class=notes-editor__label>Color</div><div class=notes-editor__swatches></div></div><div class=notes-editor__field><div class=notes-editor__label>Text</div></div></div><div class=notes-flyout__footer>'), F = /* @__PURE__ */ f("<button type=button><span>"), R = /* @__PURE__ */ f('<div class="notes-flyout notes-flyout--paste"><div class=notes-flyout__header><div><div class=notes-editor__label>Manual paste</div><div class=notes-flyout__title>Clipboard access was unavailable</div></div><button type=button class=notes-flyout__close aria-label="Close paste panel"></button></div><div class=notes-flyout__body></div><div class=notes-flyout__footer>');
|
|
9
|
+
var P = /* @__PURE__ */ f('<div class="notes-flyout notes-flyout--editor"data-floe-notes-boundary=true><div class=notes-flyout__header><div><div class=notes-editor__label>Edit note</div><div class=notes-flyout__title></div></div><button type=button class=notes-flyout__close aria-label="Close editor"></button></div><div class=notes-editor><div class=notes-editor__palette><div class=notes-editor__label>Color</div><div class=notes-editor__swatches></div></div><div class=notes-editor__field><div class=notes-editor__label>Text</div></div></div><div class=notes-flyout__footer>'), F = /* @__PURE__ */ f("<button type=button><span>"), R = /* @__PURE__ */ f('<div class="notes-flyout notes-flyout--paste"data-floe-notes-boundary=true><div class=notes-flyout__header><div><div class=notes-editor__label>Manual paste</div><div class=notes-flyout__title>Clipboard access was unavailable</div></div><button type=button class=notes-flyout__close aria-label="Close paste panel"></button></div><div class=notes-flyout__body></div><div class=notes-flyout__footer>');
|
|
10
10
|
function z(t) {
|
|
11
11
|
return (() => {
|
|
12
|
-
var i = P(), r = i.firstChild,
|
|
12
|
+
var i = P(), r = i.firstChild, u = r.firstChild, c = u.firstChild, _ = c.nextSibling, a = u.nextSibling, n = r.nextSibling, C = n.firstChild, x = C.firstChild, S = x.nextSibling, h = C.nextSibling;
|
|
13
13
|
h.firstChild;
|
|
14
14
|
var g = n.nextSibling;
|
|
15
15
|
return i.$$pointerdown = (o) => o.stopPropagation(), e(_, () => t.note?.body.trim() ? "Refine note" : "Compose note"), a.$$click = () => t.onClose(), e(a, l(m, {
|
|
@@ -55,8 +55,8 @@ function G(t) {
|
|
|
55
55
|
return t.open;
|
|
56
56
|
},
|
|
57
57
|
get children() {
|
|
58
|
-
var i = R(), r = i.firstChild,
|
|
59
|
-
return i.$$pointerdown = (n) => n.stopPropagation(),
|
|
58
|
+
var i = R(), r = i.firstChild, u = r.firstChild, c = u.nextSibling, _ = r.nextSibling, a = _.nextSibling;
|
|
59
|
+
return i.$$pointerdown = (n) => n.stopPropagation(), c.$$click = () => t.onClose(), e(c, l(m, {
|
|
60
60
|
class: "w-4 h-4"
|
|
61
61
|
})), e(_, l(y, {
|
|
62
62
|
"data-floe-autofocus": !0,
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import { createComponent as o, insert as
|
|
2
|
-
import { Show as s } from "solid-js";
|
|
3
|
-
import { Motion as
|
|
4
|
-
import { easing as
|
|
5
|
-
import { useOverlayMask as
|
|
6
|
-
import { X as
|
|
7
|
-
import { NotesBoard as
|
|
8
|
-
import { NotesContextMenu as
|
|
9
|
-
import { NotesEditorFlyout as
|
|
10
|
-
import { NotesOverviewPanel as
|
|
11
|
-
import { NotesTopicRail as
|
|
12
|
-
import { NotesTrashFlyout as
|
|
13
|
-
import { NotesTrashCanIcon as
|
|
14
|
-
import { useNotesOverlayModel as
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { createComponent as o, insert as i, addEventListener as p, effect as y, setAttribute as k, Portal as u, memo as $, template as c, delegateEvents as x } from "solid-js/web";
|
|
2
|
+
import { createEffect as D, onCleanup as I, Show as s } from "solid-js";
|
|
3
|
+
import { Motion as C } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
|
|
4
|
+
import { easing as E, duration as T } from "../../utils/animations.js";
|
|
5
|
+
import { useOverlayMask as F } from "../../hooks/useOverlayMask.js";
|
|
6
|
+
import { X as L } from "../icons/index.js";
|
|
7
|
+
import { NotesBoard as R } from "./NotesBoard.js";
|
|
8
|
+
import { NotesContextMenu as B } from "./NotesContextMenu.js";
|
|
9
|
+
import { NotesEditorFlyout as P, NotesManualPasteFlyout as Z } from "./NotesEditorFlyout.js";
|
|
10
|
+
import { NotesOverviewPanel as _ } from "./NotesOverviewPanel.js";
|
|
11
|
+
import { NotesTopicRail as z } from "./NotesTopicRail.js";
|
|
12
|
+
import { NotesTrashFlyout as W } from "./NotesTrashFlyout.js";
|
|
13
|
+
import { NotesTrashCanIcon as q } from "./notesAppearance.js";
|
|
14
|
+
import { useNotesOverlayModel as A } from "./useNotesOverlayModel.js";
|
|
15
|
+
var V = /* @__PURE__ */ c('<header class=notes-overlay__header data-floe-canvas-interactive=true><div class=notes-overlay__header-brand><div class=notes-overlay__header-title>Notes</div><div class=notes-overlay__header-separator></div><div class=notes-overlay__header-stat> topics</div><div class=notes-overlay__header-stat> live note</div><div class=notes-overlay__header-stat> trash</div></div><div class=notes-overlay__header-actions><button type=button class=notes-overlay__close aria-label="Close notes overlay"data-floe-overlay-close=true>'), H = /* @__PURE__ */ c("<button type=button class=notes-trash__toggle><div class=notes-trash__toggle-mark>"), U = /* @__PURE__ */ c("<div class=notes-overlay__body><div class=notes-trash data-floe-canvas-interactive=true>"), X = /* @__PURE__ */ c("<div class=notes-overview-backdrop data-floe-notes-boundary=true>"), Y = /* @__PURE__ */ c("<div class=notes-overview-flyout data-floe-notes-boundary=true>"), j = /* @__PURE__ */ c("<div class=notes-menu-backdrop data-floe-notes-boundary=true>");
|
|
16
|
+
const G = '[data-floe-notes-boundary="true"]';
|
|
17
|
+
function J(r) {
|
|
18
|
+
return typeof Element < "u" && r instanceof Element ? r : typeof Node < "u" && r instanceof Node ? r.parentElement : null;
|
|
19
|
+
}
|
|
20
|
+
function w(r) {
|
|
21
|
+
return !!J(r)?.closest(G);
|
|
22
|
+
}
|
|
23
|
+
function K(r) {
|
|
24
|
+
return r === "floating" ? {
|
|
25
|
+
mode: r,
|
|
19
26
|
ariaModal: void 0,
|
|
20
27
|
lockBodyScroll: !1,
|
|
21
28
|
trapFocus: !1,
|
|
@@ -36,40 +43,48 @@ function H(l) {
|
|
|
36
43
|
}
|
|
37
44
|
};
|
|
38
45
|
}
|
|
39
|
-
function
|
|
40
|
-
const e =
|
|
41
|
-
let
|
|
42
|
-
const
|
|
43
|
-
return
|
|
44
|
-
open
|
|
45
|
-
|
|
46
|
+
function ge(r) {
|
|
47
|
+
const e = A(r);
|
|
48
|
+
let v;
|
|
49
|
+
const l = () => K(r.interactionMode), b = () => r.onClose();
|
|
50
|
+
return D(() => {
|
|
51
|
+
if (!r.open || l().mode !== "floating" || typeof document > "u") return;
|
|
52
|
+
const t = (n) => {
|
|
53
|
+
w(n.target) || queueMicrotask(b);
|
|
54
|
+
};
|
|
55
|
+
document.addEventListener("click", t, !0), I(() => document.removeEventListener("click", t, !0));
|
|
56
|
+
}), F({
|
|
57
|
+
open: () => r.open,
|
|
58
|
+
root: () => v,
|
|
46
59
|
onClose: () => e.handleCloseRequest(),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
onEscapeOutside: l().mode === "floating" ? b : void 0,
|
|
61
|
+
containsTarget: w,
|
|
62
|
+
lockBodyScroll: l().lockBodyScroll,
|
|
63
|
+
trapFocus: l().trapFocus,
|
|
64
|
+
closeOnEscape: l().closeOnEscape,
|
|
50
65
|
blockHotkeys: !0,
|
|
51
|
-
blockWheel:
|
|
52
|
-
blockTouchMove:
|
|
53
|
-
autoFocus:
|
|
66
|
+
blockWheel: l().blockWheel,
|
|
67
|
+
blockTouchMove: l().blockTouchMove,
|
|
68
|
+
autoFocus: l().autoFocus,
|
|
54
69
|
restoreFocus: !0
|
|
55
70
|
}), o(s, {
|
|
56
71
|
get when() {
|
|
57
|
-
return
|
|
72
|
+
return r.open;
|
|
58
73
|
},
|
|
59
74
|
get children() {
|
|
60
|
-
return o(
|
|
75
|
+
return o(C.section, {
|
|
61
76
|
ref(t) {
|
|
62
|
-
var n =
|
|
63
|
-
typeof n == "function" ? n(t) :
|
|
77
|
+
var n = v;
|
|
78
|
+
typeof n == "function" ? n(t) : v = t;
|
|
64
79
|
},
|
|
65
80
|
class: "notes-overlay",
|
|
66
81
|
role: "dialog",
|
|
67
82
|
get "aria-modal"() {
|
|
68
|
-
return
|
|
83
|
+
return l().ariaModal;
|
|
69
84
|
},
|
|
70
85
|
"aria-label": "Notes overlay",
|
|
71
86
|
get "data-notes-interaction-mode"() {
|
|
72
|
-
return
|
|
87
|
+
return l().mode;
|
|
73
88
|
},
|
|
74
89
|
tabIndex: -1,
|
|
75
90
|
initial: {
|
|
@@ -80,12 +95,13 @@ function ie(l) {
|
|
|
80
95
|
},
|
|
81
96
|
get transition() {
|
|
82
97
|
return {
|
|
83
|
-
duration:
|
|
98
|
+
duration: T.fast
|
|
84
99
|
};
|
|
85
100
|
},
|
|
86
101
|
get children() {
|
|
87
|
-
return [o(
|
|
102
|
+
return [o(C.div, {
|
|
88
103
|
class: "notes-overlay__frame",
|
|
104
|
+
"data-floe-notes-boundary": "true",
|
|
89
105
|
initial: {
|
|
90
106
|
opacity: 0,
|
|
91
107
|
y: 18,
|
|
@@ -98,19 +114,19 @@ function ie(l) {
|
|
|
98
114
|
},
|
|
99
115
|
get transition() {
|
|
100
116
|
return {
|
|
101
|
-
duration:
|
|
102
|
-
easing:
|
|
117
|
+
duration: T.normal,
|
|
118
|
+
easing: E.easeOut
|
|
103
119
|
};
|
|
104
120
|
},
|
|
105
121
|
get children() {
|
|
106
122
|
return [(() => {
|
|
107
|
-
var t =
|
|
108
|
-
return
|
|
123
|
+
var t = V(), n = t.firstChild, a = n.firstChild, g = a.nextSibling, m = g.nextSibling, N = m.firstChild, d = m.nextSibling, M = d.firstChild, f = d.nextSibling, O = f.firstChild, S = n.nextSibling, h = S.firstChild;
|
|
124
|
+
return i(m, () => e.header.topicCount(), N), i(d, () => e.header.totalLiveNotes(), M), i(d, () => e.header.totalLiveNotes() === 1 ? "" : "s", null), i(f, () => e.header.trashCount(), O), h.$$click = () => e.handleCloseRequest(), i(h, o(L, {
|
|
109
125
|
class: "w-4 h-4"
|
|
110
126
|
})), t;
|
|
111
127
|
})(), (() => {
|
|
112
|
-
var t =
|
|
113
|
-
return
|
|
128
|
+
var t = U(), n = t.firstChild;
|
|
129
|
+
return i(t, o(z, {
|
|
114
130
|
get topics() {
|
|
115
131
|
return e.rail.topics();
|
|
116
132
|
},
|
|
@@ -150,10 +166,10 @@ function ie(l) {
|
|
|
150
166
|
get onCancelRename() {
|
|
151
167
|
return e.rail.cancelTopicRename;
|
|
152
168
|
},
|
|
153
|
-
onDeleteTopic: (
|
|
154
|
-
e.rail.deleteTopic(
|
|
169
|
+
onDeleteTopic: (a) => {
|
|
170
|
+
e.rail.deleteTopic(a);
|
|
155
171
|
}
|
|
156
|
-
}), n),
|
|
172
|
+
}), n), i(t, o(R, {
|
|
157
173
|
get activeTopic() {
|
|
158
174
|
return e.board.activeTopic();
|
|
159
175
|
},
|
|
@@ -217,8 +233,8 @@ function ie(l) {
|
|
|
217
233
|
onMobilePaste: () => {
|
|
218
234
|
e.board.mobilePaste();
|
|
219
235
|
},
|
|
220
|
-
onCopyNote: (
|
|
221
|
-
e.board.copyNote(
|
|
236
|
+
onCopyNote: (a) => {
|
|
237
|
+
e.board.copyNote(a);
|
|
222
238
|
},
|
|
223
239
|
get onOpenNoteContextMenu() {
|
|
224
240
|
return e.board.openNoteContextMenu;
|
|
@@ -226,8 +242,8 @@ function ie(l) {
|
|
|
226
242
|
get onOpenEditor() {
|
|
227
243
|
return e.board.openEditor;
|
|
228
244
|
},
|
|
229
|
-
onMoveToTrash: (
|
|
230
|
-
e.board.moveToTrash(
|
|
245
|
+
onMoveToTrash: (a) => {
|
|
246
|
+
e.board.moveToTrash(a);
|
|
231
247
|
},
|
|
232
248
|
get onStartOptimisticFront() {
|
|
233
249
|
return e.board.startOptimisticFront;
|
|
@@ -238,12 +254,12 @@ function ie(l) {
|
|
|
238
254
|
get onCommitMove() {
|
|
239
255
|
return e.board.commitMove;
|
|
240
256
|
}
|
|
241
|
-
}), n),
|
|
257
|
+
}), n), i(t, o(s, {
|
|
242
258
|
get when() {
|
|
243
259
|
return !e.board.isMobile();
|
|
244
260
|
},
|
|
245
261
|
get children() {
|
|
246
|
-
return o(
|
|
262
|
+
return o(_, {
|
|
247
263
|
mode: "desktop",
|
|
248
264
|
get items() {
|
|
249
265
|
return e.overview.items();
|
|
@@ -268,158 +284,178 @@ function ie(l) {
|
|
|
268
284
|
}
|
|
269
285
|
});
|
|
270
286
|
}
|
|
271
|
-
}), n),
|
|
287
|
+
}), n), i(n, o(s, {
|
|
272
288
|
get when() {
|
|
273
289
|
return !e.trash.open();
|
|
274
290
|
},
|
|
275
291
|
get children() {
|
|
276
|
-
var
|
|
277
|
-
return p(
|
|
292
|
+
var a = H(), g = a.firstChild;
|
|
293
|
+
return p(a, "click", e.trash.openDock, !0), i(g, o(q, {
|
|
278
294
|
class: "notes-trash__toggle-icon"
|
|
279
|
-
})),
|
|
295
|
+
})), y(() => k(a, "aria-label", `Open trash dock${e.trash.count() > 0 ? `, ${e.trash.count()} items` : ""}`)), a;
|
|
280
296
|
}
|
|
281
|
-
})),
|
|
297
|
+
})), y(() => n.classList.toggle("is-open", !!e.trash.open())), t;
|
|
282
298
|
})()];
|
|
283
299
|
}
|
|
284
300
|
}), o(s, {
|
|
285
301
|
get when() {
|
|
286
|
-
return
|
|
302
|
+
return $(() => !!e.board.isMobile())() && e.board.overviewOpen();
|
|
287
303
|
},
|
|
288
304
|
get children() {
|
|
289
|
-
return
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
305
|
+
return o(u, {
|
|
306
|
+
get children() {
|
|
307
|
+
return [(() => {
|
|
308
|
+
var t = X();
|
|
309
|
+
return p(t, "click", e.overview.close, !0), t;
|
|
310
|
+
})(), (() => {
|
|
311
|
+
var t = Y();
|
|
312
|
+
return i(t, o(_, {
|
|
313
|
+
mode: "mobile",
|
|
314
|
+
get items() {
|
|
315
|
+
return e.overview.items();
|
|
316
|
+
},
|
|
317
|
+
get boardScaleLabel() {
|
|
318
|
+
return e.board.boardScaleLabel();
|
|
319
|
+
},
|
|
320
|
+
get viewportStyle() {
|
|
321
|
+
return e.overview.viewportStyle();
|
|
322
|
+
},
|
|
323
|
+
get navigationState() {
|
|
324
|
+
return e.overview.navigationState();
|
|
325
|
+
},
|
|
326
|
+
get onPointerDown() {
|
|
327
|
+
return e.overview.beginNavigation;
|
|
328
|
+
},
|
|
329
|
+
get onZoomOut() {
|
|
330
|
+
return e.board.zoomOut;
|
|
331
|
+
},
|
|
332
|
+
get onZoomIn() {
|
|
333
|
+
return e.board.zoomIn;
|
|
334
|
+
},
|
|
335
|
+
get onClose() {
|
|
336
|
+
return e.overview.close;
|
|
337
|
+
}
|
|
338
|
+
})), t;
|
|
339
|
+
})()];
|
|
340
|
+
}
|
|
341
|
+
});
|
|
322
342
|
}
|
|
323
|
-
}), o(
|
|
324
|
-
get
|
|
325
|
-
return
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
343
|
+
}), o(u, {
|
|
344
|
+
get children() {
|
|
345
|
+
return o(W, {
|
|
346
|
+
get open() {
|
|
347
|
+
return e.trash.open();
|
|
348
|
+
},
|
|
349
|
+
get groups() {
|
|
350
|
+
return e.trash.groups();
|
|
351
|
+
},
|
|
352
|
+
get now() {
|
|
353
|
+
return e.trash.now();
|
|
354
|
+
},
|
|
355
|
+
get canDeleteNow() {
|
|
356
|
+
return e.trash.canDeleteNow;
|
|
357
|
+
},
|
|
358
|
+
get onClose() {
|
|
359
|
+
return e.trash.close;
|
|
360
|
+
},
|
|
361
|
+
get onBackdropContextMenu() {
|
|
362
|
+
return e.trash.backdropContextMenu;
|
|
363
|
+
},
|
|
364
|
+
onRestore: (t) => {
|
|
365
|
+
e.trash.restore(t);
|
|
366
|
+
},
|
|
367
|
+
onDeleteNow: (t) => {
|
|
368
|
+
e.trash.deleteNow(t);
|
|
369
|
+
},
|
|
370
|
+
onClearTopicTrash: (t) => {
|
|
371
|
+
e.trash.clearTopic(t);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
350
374
|
}
|
|
351
375
|
}), o(s, {
|
|
352
376
|
get when() {
|
|
353
377
|
return e.contextMenu.state();
|
|
354
378
|
},
|
|
355
379
|
get children() {
|
|
356
|
-
return
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
380
|
+
return o(u, {
|
|
381
|
+
get children() {
|
|
382
|
+
return [(() => {
|
|
383
|
+
var t = j();
|
|
384
|
+
return p(t, "click", e.contextMenu.close, !0), t;
|
|
385
|
+
})(), o(B, {
|
|
386
|
+
get x() {
|
|
387
|
+
return e.contextMenu.position()?.left ?? 0;
|
|
388
|
+
},
|
|
389
|
+
get y() {
|
|
390
|
+
return e.contextMenu.position()?.top ?? 0;
|
|
391
|
+
},
|
|
392
|
+
get items() {
|
|
393
|
+
return e.contextMenu.items();
|
|
394
|
+
}
|
|
395
|
+
})];
|
|
368
396
|
}
|
|
369
|
-
})
|
|
397
|
+
});
|
|
370
398
|
}
|
|
371
399
|
}), o(s, {
|
|
372
400
|
get when() {
|
|
373
401
|
return !!e.editor.note();
|
|
374
402
|
},
|
|
375
403
|
get children() {
|
|
376
|
-
return o(
|
|
377
|
-
get
|
|
378
|
-
return
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
404
|
+
return o(u, {
|
|
405
|
+
get children() {
|
|
406
|
+
return o(P, {
|
|
407
|
+
get note() {
|
|
408
|
+
return e.editor.note();
|
|
409
|
+
},
|
|
410
|
+
get draftBody() {
|
|
411
|
+
return e.editor.draftBody();
|
|
412
|
+
},
|
|
413
|
+
get draftColor() {
|
|
414
|
+
return e.editor.draftColor();
|
|
415
|
+
},
|
|
416
|
+
get onDraftBodyChange() {
|
|
417
|
+
return e.editor.setDraftBody;
|
|
418
|
+
},
|
|
419
|
+
get onDraftColorChange() {
|
|
420
|
+
return e.editor.setDraftColor;
|
|
421
|
+
},
|
|
422
|
+
get onClose() {
|
|
423
|
+
return e.editor.close;
|
|
424
|
+
},
|
|
425
|
+
onSave: () => {
|
|
426
|
+
e.editor.save();
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}), o(u, {
|
|
433
|
+
get children() {
|
|
434
|
+
return o(Z, {
|
|
435
|
+
get open() {
|
|
436
|
+
return e.manualPaste.open();
|
|
385
437
|
},
|
|
386
|
-
get
|
|
387
|
-
return e.
|
|
438
|
+
get text() {
|
|
439
|
+
return e.manualPaste.text();
|
|
388
440
|
},
|
|
389
|
-
get
|
|
390
|
-
return e.
|
|
441
|
+
get onTextChange() {
|
|
442
|
+
return e.manualPaste.setText;
|
|
391
443
|
},
|
|
392
444
|
get onClose() {
|
|
393
|
-
return e.
|
|
445
|
+
return e.manualPaste.close;
|
|
394
446
|
},
|
|
395
|
-
|
|
396
|
-
e.
|
|
447
|
+
onConfirm: () => {
|
|
448
|
+
e.manualPaste.confirm();
|
|
397
449
|
}
|
|
398
450
|
});
|
|
399
451
|
}
|
|
400
|
-
}), o(R, {
|
|
401
|
-
get open() {
|
|
402
|
-
return e.manualPaste.open();
|
|
403
|
-
},
|
|
404
|
-
get text() {
|
|
405
|
-
return e.manualPaste.text();
|
|
406
|
-
},
|
|
407
|
-
get onTextChange() {
|
|
408
|
-
return e.manualPaste.setText;
|
|
409
|
-
},
|
|
410
|
-
get onClose() {
|
|
411
|
-
return e.manualPaste.close;
|
|
412
|
-
},
|
|
413
|
-
onConfirm: () => {
|
|
414
|
-
e.manualPaste.confirm();
|
|
415
|
-
}
|
|
416
452
|
})];
|
|
417
453
|
}
|
|
418
454
|
});
|
|
419
455
|
}
|
|
420
456
|
});
|
|
421
457
|
}
|
|
422
|
-
|
|
458
|
+
x(["click"]);
|
|
423
459
|
export {
|
|
424
|
-
|
|
460
|
+
ge as NotesOverlay
|
|
425
461
|
};
|
|
@@ -3,7 +3,7 @@ import { Show as u, For as P } from "solid-js";
|
|
|
3
3
|
import { X as U } from "../icons/index.js";
|
|
4
4
|
import { NotesAnimalIcon as V, NotesTrashCanIcon as W } from "./notesAppearance.js";
|
|
5
5
|
import { topicAccentClass as Y, notePreviewMetrics as Z, getNotePreviewText as tt, formatDeletedTimestamp as et, formatRemainingTrashTime as st, noteColorClass as nt } from "./notesOverlayHelpers.js";
|
|
6
|
-
var it = /* @__PURE__ */ a("<div class=notes-trash-backdrop>"), lt = /* @__PURE__ */ a("<div class=notes-trash__sections>"), ot = /* @__PURE__ */ a('<div class=notes-trash__flyout><div class=notes-trash__panel><div class=notes-trash__panel-header><div class=notes-trash__panel-title-group><div class=notes-trash__panel-title-row><div class=notes-trash__panel-title>Trash Dock</div><div class=notes-trash__panel-header-actions><div class=notes-trash__panel-count> items</div><button type=button class=notes-trash__panel-close aria-label="Close trash dock"></button></div></div><div class=notes-trash__panel-body>Grouped by topic, sorted by latest deletion, and recoverable for 72 hours.'), rt = /* @__PURE__ */ a("<div class=notes-trash__empty><div><strong>Trash is empty</strong><span>Deleted notes from any topic will appear here."), at = /* @__PURE__ */ a("<section class=notes-trash-section><div class=notes-trash-section__header><div class=notes-trash-section__title-group><div class=notes-trash-section__title-line><div></div><div class=notes-trash-section__title></div></div><div class=notes-trash-section__meta> deleted note</div></div><button type=button class=notes-trash-section__clear>Clear topic trash</button></div><div class=notes-trash-section__grid>"), ct = /* @__PURE__ */ a("<button type=button class=is-danger>Delete now"), _t = /* @__PURE__ */ a("<article><div class=notes-note__surface><div class=notes-trash-note__meta><span></span><strong></strong></div><div class=notes-trash-note__body><span></span></div><div class=notes-trash-note__actions><button type=button>Restore");
|
|
6
|
+
var it = /* @__PURE__ */ a("<div class=notes-trash-backdrop data-floe-notes-boundary=true>"), lt = /* @__PURE__ */ a("<div class=notes-trash__sections>"), ot = /* @__PURE__ */ a('<div class=notes-trash__flyout data-floe-notes-boundary=true><div class=notes-trash__panel><div class=notes-trash__panel-header><div class=notes-trash__panel-title-group><div class=notes-trash__panel-title-row><div class=notes-trash__panel-title>Trash Dock</div><div class=notes-trash__panel-header-actions><div class=notes-trash__panel-count> items</div><button type=button class=notes-trash__panel-close aria-label="Close trash dock"></button></div></div><div class=notes-trash__panel-body>Grouped by topic, sorted by latest deletion, and recoverable for 72 hours.'), rt = /* @__PURE__ */ a("<div class=notes-trash__empty><div><strong>Trash is empty</strong><span>Deleted notes from any topic will appear here."), at = /* @__PURE__ */ a("<section class=notes-trash-section><div class=notes-trash-section__header><div class=notes-trash-section__title-group><div class=notes-trash-section__title-line><div></div><div class=notes-trash-section__title></div></div><div class=notes-trash-section__meta> deleted note</div></div><button type=button class=notes-trash-section__clear>Clear topic trash</button></div><div class=notes-trash-section__grid>"), ct = /* @__PURE__ */ a("<button type=button class=is-danger>Delete now"), _t = /* @__PURE__ */ a("<article><div class=notes-note__surface><div class=notes-trash-note__meta><span></span><strong></strong></div><div class=notes-trash-note__body><span></span></div><div class=notes-trash-note__actions><button type=button>Restore");
|
|
7
7
|
function mt(s) {
|
|
8
8
|
return r(u, {
|
|
9
9
|
get when() {
|
|
@@ -42,7 +42,7 @@ function mt(s) {
|
|
|
42
42
|
children: (n) => {
|
|
43
43
|
const B = Y(n.topic_icon_accent);
|
|
44
44
|
return (() => {
|
|
45
|
-
var p = at(),
|
|
45
|
+
var p = at(), f = p.firstChild, g = f.firstChild, b = g.firstChild, h = b.firstChild, E = h.nextSibling, $ = b.nextSibling, G = $.firstChild, K = g.nextSibling, X = f.nextSibling;
|
|
46
46
|
return D(h, `notes-topic-mark notes-topic-mark--trash ${B}`), t(h, r(V, {
|
|
47
47
|
get iconKey() {
|
|
48
48
|
return n.topic_icon_key;
|
|
@@ -55,8 +55,8 @@ function mt(s) {
|
|
|
55
55
|
children: (o) => {
|
|
56
56
|
const v = Z(o), j = tt(o.body, v.preview_limit);
|
|
57
57
|
return (() => {
|
|
58
|
-
var _ = _t(), q = _.firstChild,
|
|
59
|
-
return t(
|
|
58
|
+
var _ = _t(), q = _.firstChild, C = q.firstChild, y = C.firstChild, H = y.nextSibling, w = C.nextSibling, J = w.firstChild, x = w.nextSibling, L = x.firstChild;
|
|
59
|
+
return t(y, () => et(o.deleted_at_unix_ms)), t(H, () => st(o.deleted_at_unix_ms, s.now)), t(J, j), L.$$click = () => s.onRestore(o.note_id), t(x, r(u, {
|
|
60
60
|
get when() {
|
|
61
61
|
return s.canDeleteNow;
|
|
62
62
|
},
|
|
@@ -1,60 +1,58 @@
|
|
|
1
|
-
import { createSignal as c, onCleanup as
|
|
2
|
-
import { createSimpleContext as
|
|
3
|
-
import { useResolvedFloeConfig as
|
|
4
|
-
import { formatKeybind as
|
|
1
|
+
import { createSignal as c, onCleanup as L, createEffect as P } from "solid-js";
|
|
2
|
+
import { createSimpleContext as S } from "./createSimpleContext.js";
|
|
3
|
+
import { useResolvedFloeConfig as E } from "./FloeConfigContext.js";
|
|
4
|
+
import { formatKeybind as T, parseKeybind as W, matchKeybind as u } from "../utils/keybind.js";
|
|
5
5
|
import { deferAfterPaint as F, deferNonBlocking as m } from "../utils/defer.js";
|
|
6
6
|
import { shouldIgnoreHotkeys as I } from "../utils/dom.js";
|
|
7
|
-
function
|
|
8
|
-
const x =
|
|
9
|
-
|
|
7
|
+
function M() {
|
|
8
|
+
const x = E(), y = () => x.config.commands, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), [v, s] = c(!1), [g, f] = c(""), [K, h] = c(""), [b, A] = c([]), l = () => {
|
|
9
|
+
A(Array.from(r.values()));
|
|
10
10
|
};
|
|
11
11
|
if (typeof window < "u" && y().enableGlobalKeybinds) {
|
|
12
12
|
const t = (e) => {
|
|
13
|
-
const n = y()
|
|
14
|
-
|
|
13
|
+
const n = y(), k = I(e, {
|
|
14
|
+
ignoreWhenTyping: n.ignoreWhenTyping,
|
|
15
|
+
allowWhenTypingWithin: n.allowWhenTypingWithin
|
|
16
|
+
});
|
|
17
|
+
if (n.save.enabled && u(e, n.save.keybind)) {
|
|
15
18
|
const o = r.get(n.save.commandId);
|
|
16
19
|
o ? (e.preventDefault(), m(() => {
|
|
17
20
|
Promise.resolve(o.execute()).catch((d) => console.error(d));
|
|
18
21
|
})) : n.save.preventDefaultWhenNoHandler && e.preventDefault();
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
21
|
-
if (!
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})) {
|
|
25
|
-
if (n.palette.enabled && p(e, n.palette.keybind)) {
|
|
26
|
-
e.preventDefault(), s((o) => !o);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (!v())
|
|
30
|
-
for (const o of r.values()) {
|
|
31
|
-
if (!o.keybind) continue;
|
|
32
|
-
const d = i.get(o.id);
|
|
33
|
-
if (d && p(e, d)) {
|
|
34
|
-
e.preventDefault(), m(() => {
|
|
35
|
-
Promise.resolve(o.execute()).catch((A) => console.error(A));
|
|
36
|
-
});
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
24
|
+
if (!k && n.palette.enabled && u(e, n.palette.keybind)) {
|
|
25
|
+
e.preventDefault(), s((o) => !o);
|
|
26
|
+
return;
|
|
40
27
|
}
|
|
28
|
+
if (!v())
|
|
29
|
+
for (const o of r.values()) {
|
|
30
|
+
if (!o.keybind || k && !o.allowWhileTyping) continue;
|
|
31
|
+
const d = i.get(o.id);
|
|
32
|
+
if (d && u(e, d)) {
|
|
33
|
+
e.preventDefault(), m(() => {
|
|
34
|
+
Promise.resolve(o.execute()).catch((D) => console.error(D));
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
41
39
|
};
|
|
42
|
-
window.addEventListener("keydown", t),
|
|
40
|
+
window.addEventListener("keydown", t), L(() => window.removeEventListener("keydown", t));
|
|
43
41
|
}
|
|
44
|
-
let
|
|
45
|
-
|
|
42
|
+
let p = 0;
|
|
43
|
+
P(() => {
|
|
46
44
|
const t = g().trim();
|
|
47
|
-
|
|
48
|
-
const e =
|
|
45
|
+
p += 1;
|
|
46
|
+
const e = p;
|
|
49
47
|
if (!t) {
|
|
50
48
|
h("");
|
|
51
49
|
return;
|
|
52
50
|
}
|
|
53
51
|
F(() => {
|
|
54
|
-
e ===
|
|
52
|
+
e === p && h(t.toLowerCase());
|
|
55
53
|
});
|
|
56
54
|
});
|
|
57
|
-
let w = "", C = null,
|
|
55
|
+
let w = "", C = null, a = [];
|
|
58
56
|
return {
|
|
59
57
|
// State
|
|
60
58
|
isOpen: v,
|
|
@@ -62,7 +60,7 @@ function T() {
|
|
|
62
60
|
commands: b,
|
|
63
61
|
filteredCommands: () => {
|
|
64
62
|
const t = b(), e = K();
|
|
65
|
-
return t === C && e === w ?
|
|
63
|
+
return t === C && e === w ? a : (C = t, w = e, e ? (a = t.filter((n) => n.title.toLowerCase().includes(e) || n.description?.toLowerCase().includes(e) || n.category?.toLowerCase().includes(e)), a) : (a = t, t));
|
|
66
64
|
},
|
|
67
65
|
// Actions
|
|
68
66
|
open: () => s(!0),
|
|
@@ -71,15 +69,15 @@ function T() {
|
|
|
71
69
|
},
|
|
72
70
|
toggle: () => s((t) => !t),
|
|
73
71
|
setSearch: (t) => f(t),
|
|
74
|
-
register: (t) => (r.set(t.id, t), t.keybind && i.set(t.id,
|
|
75
|
-
r.delete(t.id), i.delete(t.id),
|
|
72
|
+
register: (t) => (r.set(t.id, t), t.keybind && i.set(t.id, W(t.keybind)), l(), () => {
|
|
73
|
+
r.delete(t.id), i.delete(t.id), l();
|
|
76
74
|
}),
|
|
77
75
|
registerAll: (t) => (t.forEach((e) => {
|
|
78
|
-
r.set(e.id, e), e.keybind && i.set(e.id,
|
|
79
|
-
}),
|
|
76
|
+
r.set(e.id, e), e.keybind && i.set(e.id, W(e.keybind));
|
|
77
|
+
}), l(), () => {
|
|
80
78
|
t.forEach((e) => {
|
|
81
79
|
r.delete(e.id), i.delete(e.id);
|
|
82
|
-
}),
|
|
80
|
+
}), l();
|
|
83
81
|
}),
|
|
84
82
|
execute: (t) => {
|
|
85
83
|
const e = r.get(t);
|
|
@@ -87,18 +85,18 @@ function T() {
|
|
|
87
85
|
Promise.resolve(e.execute()).catch((n) => console.error(n));
|
|
88
86
|
}));
|
|
89
87
|
},
|
|
90
|
-
getKeybindDisplay:
|
|
88
|
+
getKeybindDisplay: T
|
|
91
89
|
};
|
|
92
90
|
}
|
|
93
91
|
const {
|
|
94
|
-
Provider:
|
|
95
|
-
use:
|
|
96
|
-
} =
|
|
92
|
+
Provider: G,
|
|
93
|
+
use: J
|
|
94
|
+
} = S({
|
|
97
95
|
name: "Command",
|
|
98
|
-
init:
|
|
96
|
+
init: M
|
|
99
97
|
});
|
|
100
98
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
G as CommandProvider,
|
|
100
|
+
M as createCommandService,
|
|
101
|
+
J as useCommand
|
|
104
102
|
};
|
|
@@ -7,16 +7,16 @@ import { useCommand as b } from "./CommandContext.js";
|
|
|
7
7
|
import { useNotification as R } from "./NotificationContext.js";
|
|
8
8
|
import { deferNonBlocking as M } from "../utils/defer.js";
|
|
9
9
|
function S(r) {
|
|
10
|
-
const
|
|
10
|
+
const i = `[${r}]`;
|
|
11
11
|
return {
|
|
12
|
-
debug: (...n) => console.debug(
|
|
13
|
-
info: (...n) => console.info(
|
|
14
|
-
warn: (...n) => console.warn(
|
|
15
|
-
error: (...n) => console.error(
|
|
12
|
+
debug: (...n) => console.debug(i, ...n),
|
|
13
|
+
info: (...n) => console.info(i, ...n),
|
|
14
|
+
warn: (...n) => console.warn(i, ...n),
|
|
15
|
+
error: (...n) => console.error(i, ...n)
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function A(r,
|
|
19
|
-
const n = `component:${
|
|
18
|
+
function A(r, i) {
|
|
19
|
+
const n = `component:${i}:`;
|
|
20
20
|
return {
|
|
21
21
|
get: (a, m) => r.load(n + a, m),
|
|
22
22
|
set: (a, m) => r.debouncedSave(n + a, m),
|
|
@@ -24,36 +24,36 @@ function A(r, s) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function D() {
|
|
27
|
-
const r = x(),
|
|
28
|
-
return (
|
|
27
|
+
const r = x(), i = v(), n = b(), a = R(), m = w();
|
|
28
|
+
return (l, p) => ({
|
|
29
29
|
protocol: p?.protocol,
|
|
30
30
|
theme: r,
|
|
31
|
-
layout:
|
|
31
|
+
layout: i,
|
|
32
32
|
commands: n,
|
|
33
33
|
notifications: a,
|
|
34
|
-
storage: A(m.persist,
|
|
35
|
-
logger: S(
|
|
34
|
+
storage: A(m.persist, l),
|
|
35
|
+
logger: S(l)
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const f = h({
|
|
39
39
|
name: "ComponentRegistry",
|
|
40
40
|
init: B
|
|
41
|
-
}), G =
|
|
41
|
+
}), G = f.Provider;
|
|
42
42
|
function H() {
|
|
43
|
-
return
|
|
43
|
+
return f.use();
|
|
44
44
|
}
|
|
45
45
|
function J() {
|
|
46
|
-
return
|
|
46
|
+
return f.useOptional();
|
|
47
47
|
}
|
|
48
48
|
function K() {
|
|
49
|
-
return
|
|
49
|
+
return f.has();
|
|
50
50
|
}
|
|
51
51
|
function B() {
|
|
52
|
-
const [r,
|
|
53
|
-
|
|
52
|
+
const [r, i] = C(/* @__PURE__ */ new Map()), [n, a] = C(/* @__PURE__ */ new Set()), m = /* @__PURE__ */ new Map(), l = (t) => {
|
|
53
|
+
i((e) => new Map(e).set(t.id, t));
|
|
54
54
|
}, p = (t) => {
|
|
55
55
|
const e = t.map((o) => o.id).filter((o) => !!o);
|
|
56
|
-
return
|
|
56
|
+
return i((o) => {
|
|
57
57
|
const c = new Map(o);
|
|
58
58
|
return t.forEach((u) => c.set(u.id, u)), c;
|
|
59
59
|
}), () => {
|
|
@@ -61,31 +61,32 @@ function B() {
|
|
|
61
61
|
y(o);
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
},
|
|
64
|
+
}, d = async (t, e) => {
|
|
65
65
|
const o = r().get(t);
|
|
66
66
|
if (!o || n().has(t)) return;
|
|
67
67
|
const c = [];
|
|
68
68
|
try {
|
|
69
69
|
if (o.commands?.length) {
|
|
70
|
-
const u = o.commands.map((
|
|
71
|
-
id:
|
|
72
|
-
title:
|
|
73
|
-
description:
|
|
74
|
-
icon:
|
|
75
|
-
keybind:
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
const u = o.commands.map((s) => ({
|
|
71
|
+
id: s.id,
|
|
72
|
+
title: s.title,
|
|
73
|
+
description: s.description,
|
|
74
|
+
icon: s.icon,
|
|
75
|
+
keybind: s.keybind,
|
|
76
|
+
allowWhileTyping: s.allowWhileTyping,
|
|
77
|
+
category: s.category,
|
|
78
|
+
execute: () => s.execute(e)
|
|
78
79
|
}));
|
|
79
80
|
c.push(e.commands.registerAll(u));
|
|
80
81
|
}
|
|
81
82
|
await o.onMount?.(e), c.length && m.set(t, () => c.forEach((u) => u())), a((u) => {
|
|
82
|
-
const
|
|
83
|
-
return
|
|
83
|
+
const s = new Set(u);
|
|
84
|
+
return s.add(t), s;
|
|
84
85
|
});
|
|
85
86
|
} catch (u) {
|
|
86
|
-
throw c.forEach((
|
|
87
|
+
throw c.forEach((s) => s()), u;
|
|
87
88
|
}
|
|
88
|
-
},
|
|
89
|
+
}, g = async (t) => {
|
|
89
90
|
const e = r().get(t);
|
|
90
91
|
if (e && n().has(t))
|
|
91
92
|
try {
|
|
@@ -97,24 +98,24 @@ function B() {
|
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
}, y = async (t) => {
|
|
100
|
-
await
|
|
101
|
+
await g(t), i((e) => {
|
|
101
102
|
const o = new Map(e);
|
|
102
103
|
return o.delete(t), o;
|
|
103
104
|
});
|
|
104
105
|
};
|
|
105
106
|
return {
|
|
106
|
-
register:
|
|
107
|
+
register: l,
|
|
107
108
|
registerAll: p,
|
|
108
109
|
unregister: y,
|
|
109
|
-
mount:
|
|
110
|
-
unmount:
|
|
110
|
+
mount: d,
|
|
111
|
+
unmount: g,
|
|
111
112
|
mountAll: async (t) => {
|
|
112
113
|
for (const e of r().keys())
|
|
113
|
-
await
|
|
114
|
+
await d(e, t(e));
|
|
114
115
|
},
|
|
115
116
|
unmountAll: async () => {
|
|
116
117
|
for (const t of n())
|
|
117
|
-
await
|
|
118
|
+
await g(t);
|
|
118
119
|
},
|
|
119
120
|
components: r,
|
|
120
121
|
mountedComponents: n,
|
|
@@ -5,6 +5,10 @@ export interface UseOverlayMaskOptions {
|
|
|
5
5
|
open: Accessor<boolean>;
|
|
6
6
|
root: Accessor<HTMLElement | undefined>;
|
|
7
7
|
onClose?: () => void;
|
|
8
|
+
/** Treat additional nodes as part of the overlay surface (e.g. portaled layers). */
|
|
9
|
+
containsTarget?: (target: EventTarget | null) => boolean;
|
|
10
|
+
/** Optional alternate close path for Escape pressed outside the overlay surface. */
|
|
11
|
+
onEscapeOutside?: () => void;
|
|
8
12
|
/** Lock `document.body` scroll while the overlay is open (default: true). */
|
|
9
13
|
lockBodyScroll?: boolean;
|
|
10
14
|
/** Prevent scroll via wheel events (default: none). */
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { createEffect as
|
|
2
|
-
import { lockBodyStyle as
|
|
3
|
-
import { deferAfterPaint as
|
|
4
|
-
import { getFocusableElements as
|
|
5
|
-
function
|
|
1
|
+
import { createEffect as T, onCleanup as O } from "solid-js";
|
|
2
|
+
import { lockBodyStyle as M } from "../utils/bodyStyleLock.js";
|
|
3
|
+
import { deferAfterPaint as p } from "../utils/defer.js";
|
|
4
|
+
import { getFocusableElements as B, getFirstFocusableElement as D } from "../utils/focus.js";
|
|
5
|
+
function b(t) {
|
|
6
6
|
return typeof Node < "u" && t instanceof Node;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function i(t, c, r) {
|
|
9
|
+
return r ? r(c) : !t || !b(c) ? !1 : t.contains(c);
|
|
10
|
+
}
|
|
11
|
+
function k(t, c, r, u) {
|
|
12
|
+
return r === "none" ? !1 : r === "all" ? !0 : !i(t, c, u);
|
|
10
13
|
}
|
|
11
14
|
function H(t) {
|
|
12
|
-
const
|
|
13
|
-
|
|
15
|
+
const c = () => t.lockBodyScroll !== !1, r = () => t.trapFocus !== !1, u = () => t.closeOnEscape === !1 ? "none" : t.closeOnEscape === "inside" ? "inside" : t.closeOnEscape === "none" ? "none" : "always", g = () => t.blockHotkeys !== !1, w = () => t.restoreFocus !== !1;
|
|
16
|
+
T(() => {
|
|
14
17
|
if (!t.open() || typeof document > "u") return;
|
|
15
|
-
const f = document.activeElement instanceof HTMLElement ? document.activeElement : null,
|
|
16
|
-
|
|
18
|
+
const f = document.activeElement instanceof HTMLElement ? document.activeElement : null, L = c() ? M({ overflow: "hidden" }) : null;
|
|
19
|
+
p(() => {
|
|
17
20
|
const e = t.root();
|
|
18
21
|
if (!e) return;
|
|
19
22
|
const n = t.autoFocus;
|
|
20
23
|
if (n === !1) return;
|
|
21
|
-
const o = typeof n == "object" ? n.selector : void 0,
|
|
24
|
+
const o = typeof n == "object" ? n.selector : void 0, l = (o ? e.querySelector(o) : null) ?? e.querySelector("[data-floe-autofocus]") ?? D(e) ?? e;
|
|
22
25
|
try {
|
|
23
|
-
|
|
26
|
+
l.focus();
|
|
24
27
|
} catch {
|
|
25
28
|
}
|
|
26
29
|
});
|
|
@@ -28,7 +31,7 @@ function H(t) {
|
|
|
28
31
|
if (e.key !== "Tab") return;
|
|
29
32
|
const n = t.root();
|
|
30
33
|
if (!n) return;
|
|
31
|
-
const o =
|
|
34
|
+
const o = B(n);
|
|
32
35
|
if (!o.length) {
|
|
33
36
|
e.preventDefault();
|
|
34
37
|
try {
|
|
@@ -37,48 +40,50 @@ function H(t) {
|
|
|
37
40
|
}
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
|
-
const
|
|
43
|
+
const a = o[0], l = o[o.length - 1], s = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
41
44
|
if (e.shiftKey) {
|
|
42
|
-
if (
|
|
45
|
+
if (s === a || !s || !n.contains(s)) {
|
|
43
46
|
e.preventDefault();
|
|
44
47
|
try {
|
|
45
|
-
|
|
48
|
+
l.focus();
|
|
46
49
|
} catch {
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
|
-
} else if (
|
|
52
|
+
} else if (s === l) {
|
|
50
53
|
e.preventDefault();
|
|
51
54
|
try {
|
|
52
|
-
|
|
55
|
+
a.focus();
|
|
53
56
|
} catch {
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
}, m = (e) => {
|
|
57
60
|
if (e.key !== "Escape") return;
|
|
58
|
-
const n =
|
|
59
|
-
if (n
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
const n = u();
|
|
62
|
+
if (n === "none") return;
|
|
63
|
+
const o = t.root(), a = i(o, b(e.target) ? e.target : document.activeElement, t.containsTarget);
|
|
64
|
+
if (n === "inside") {
|
|
65
|
+
if (a) {
|
|
66
|
+
e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
|
|
67
|
+
return;
|
|
65
68
|
}
|
|
66
|
-
e.preventDefault(), e.stopImmediatePropagation(), t.
|
|
69
|
+
t.onEscapeOutside && (e.preventDefault(), e.stopImmediatePropagation(), t.onEscapeOutside());
|
|
70
|
+
return;
|
|
67
71
|
}
|
|
72
|
+
e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
|
|
68
73
|
}, v = (e) => {
|
|
69
74
|
const n = t.root();
|
|
70
|
-
n &&
|
|
75
|
+
n && g() && i(n, e.target, t.containsTarget) && e.stopPropagation();
|
|
71
76
|
}, y = (e) => {
|
|
72
77
|
const n = t.blockWheel ?? "none", o = t.root();
|
|
73
|
-
|
|
78
|
+
k(o, e.target, n, t.containsTarget) && e.cancelable && e.preventDefault();
|
|
74
79
|
}, h = (e) => {
|
|
75
80
|
e.stopPropagation();
|
|
76
81
|
}, E = (e) => {
|
|
77
82
|
const n = t.blockTouchMove ?? "none", o = t.root();
|
|
78
|
-
|
|
83
|
+
k(o, e.target, n, t.containsTarget) && e.cancelable && e.preventDefault();
|
|
79
84
|
};
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
r() && document.addEventListener("keydown", d, !0), u() !== "none" && window.addEventListener("keydown", m, !0), document.addEventListener("keydown", v), (t.blockWheel ?? "none") !== "none" && (document.addEventListener("wheel", y, { capture: !0, passive: !1 }), document.addEventListener("wheel", h)), (t.blockTouchMove ?? "none") !== "none" && document.addEventListener("touchmove", E, { capture: !0, passive: !1 }), O(() => {
|
|
86
|
+
r() && document.removeEventListener("keydown", d, !0), u() !== "none" && window.removeEventListener("keydown", m, !0), document.removeEventListener("keydown", v), (t.blockWheel ?? "none") !== "none" && (document.removeEventListener("wheel", y, !0), document.removeEventListener("wheel", h)), (t.blockTouchMove ?? "none") !== "none" && document.removeEventListener("touchmove", E, !0), L?.(), w() && f && f.isConnected && p(() => {
|
|
82
87
|
if (typeof document > "u") return;
|
|
83
88
|
const e = document.activeElement;
|
|
84
89
|
if (!(e && e !== document.body && e !== document.documentElement))
|