@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.
@@ -1,43 +1,43 @@
1
- import { use as E, insert as i, createComponent as m, addEventListener as T, effect as v, className as f, setStyleProperty as d, template as s, delegateEvents as N } from "solid-js/web";
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__ */ s('<div role=menu class="notes-context-menu notes-menu">'), h = /* @__PURE__ */ s("<div role=separator aria-orientation=horizontal class=notes-context-menu__separator>"), I = /* @__PURE__ */ s("<button type=button role=menuitem><span class=notes-context-menu__label>");
5
- const H = 188, M = 16, X = 32, P = 9;
6
- function S(t) {
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 y(t, n = 0) {
10
- return M + Math.max(1, t) * X + Math.max(0, n) * P;
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 c = t.menuRef;
17
- return typeof c == "function" ? E(c, n) : t.menuRef = n, i(n, m(x, {
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 (!S(e))
22
+ if (!P(e))
23
23
  return h();
24
24
  const a = e.icon;
25
25
  return (() => {
26
- var o = I(), u = o.firstChild;
27
- return T(o, "click", e.onSelect, !0), i(o, m(a, {
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
- }), u), i(u, () => e.label), v((r) => {
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 && f(o, r.e = l), _ !== r.t && (o.disabled = r.t = _), r;
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
- })), v((e) => {
38
+ })), d((e) => {
39
39
  var a = `${t.x}px`, o = `${t.y}px`;
40
- return a !== e.e && d(n, "left", e.e = a), o !== e.t && d(n, "top", e.t = o), 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
- H as NOTES_CONTEXT_MENU_WIDTH_PX,
49
+ A as NOTES_CONTEXT_MENU_WIDTH_PX,
50
50
  R as NotesContextMenu,
51
- y as estimateNotesContextMenuHeight
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, c = r.firstChild, u = c.firstChild, _ = u.nextSibling, a = c.nextSibling, n = r.nextSibling, C = n.firstChild, x = C.firstChild, S = x.nextSibling, h = C.nextSibling;
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, c = r.firstChild, u = c.nextSibling, _ = r.nextSibling, a = _.nextSibling;
59
- return i.$$pointerdown = (n) => n.stopPropagation(), u.$$click = () => t.onClose(), e(u, l(m, {
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 a, addEventListener as p, effect as h, setAttribute as N, memo as S, template as c, delegateEvents as $ } from "solid-js/web";
2
- import { Show as s } from "solid-js";
3
- import { Motion as f } 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 k, duration as _ } from "../../utils/animations.js";
5
- import { useOverlayMask as O } from "../../hooks/useOverlayMask.js";
6
- import { X as x } from "../icons/index.js";
7
- import { NotesBoard as D } from "./NotesBoard.js";
8
- import { NotesContextMenu as I } from "./NotesContextMenu.js";
9
- import { NotesEditorFlyout as F, NotesManualPasteFlyout as R } from "./NotesEditorFlyout.js";
10
- import { NotesOverviewPanel as T } from "./NotesOverviewPanel.js";
11
- import { NotesTopicRail as L } from "./NotesTopicRail.js";
12
- import { NotesTrashFlyout as B } from "./NotesTrashFlyout.js";
13
- import { NotesTrashCanIcon as P } from "./notesAppearance.js";
14
- import { useNotesOverlayModel as E } from "./useNotesOverlayModel.js";
15
- var Z = /* @__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>'), z = /* @__PURE__ */ c("<button type=button class=notes-trash__toggle><div class=notes-trash__toggle-mark>"), W = /* @__PURE__ */ c("<div class=notes-overlay__body><div class=notes-trash data-floe-canvas-interactive=true>"), q = /* @__PURE__ */ c("<div class=notes-overview-backdrop>"), V = /* @__PURE__ */ c("<div class=notes-overview-flyout>"), A = /* @__PURE__ */ c("<div class=notes-menu-backdrop>");
16
- function H(l) {
17
- return l === "floating" ? {
18
- mode: l,
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 ie(l) {
40
- const e = E(l);
41
- let d;
42
- const i = () => H(l.interactionMode);
43
- return O({
44
- open: () => l.open,
45
- root: () => d,
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
- lockBodyScroll: i().lockBodyScroll,
48
- trapFocus: i().trapFocus,
49
- closeOnEscape: i().closeOnEscape,
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: i().blockWheel,
52
- blockTouchMove: i().blockTouchMove,
53
- autoFocus: i().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 l.open;
72
+ return r.open;
58
73
  },
59
74
  get children() {
60
- return o(f.section, {
75
+ return o(C.section, {
61
76
  ref(t) {
62
- var n = d;
63
- typeof n == "function" ? n(t) : d = 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 i().ariaModal;
83
+ return l().ariaModal;
69
84
  },
70
85
  "aria-label": "Notes overlay",
71
86
  get "data-notes-interaction-mode"() {
72
- return i().mode;
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: _.fast
98
+ duration: T.fast
84
99
  };
85
100
  },
86
101
  get children() {
87
- return [o(f.div, {
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: _.normal,
102
- easing: k.easeOut
117
+ duration: T.normal,
118
+ easing: E.easeOut
103
119
  };
104
120
  },
105
121
  get children() {
106
122
  return [(() => {
107
- var t = Z(), n = t.firstChild, r = n.firstChild, v = r.nextSibling, g = v.nextSibling, C = g.firstChild, u = g.nextSibling, y = u.firstChild, m = u.nextSibling, w = m.firstChild, M = n.nextSibling, b = M.firstChild;
108
- return a(g, () => e.header.topicCount(), C), a(u, () => e.header.totalLiveNotes(), y), a(u, () => e.header.totalLiveNotes() === 1 ? "" : "s", null), a(m, () => e.header.trashCount(), w), b.$$click = () => e.handleCloseRequest(), a(b, o(x, {
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 = W(), n = t.firstChild;
113
- return a(t, o(L, {
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: (r) => {
154
- e.rail.deleteTopic(r);
169
+ onDeleteTopic: (a) => {
170
+ e.rail.deleteTopic(a);
155
171
  }
156
- }), n), a(t, o(D, {
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: (r) => {
221
- e.board.copyNote(r);
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: (r) => {
230
- e.board.moveToTrash(r);
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), a(t, o(s, {
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(T, {
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), a(n, o(s, {
287
+ }), n), i(n, o(s, {
272
288
  get when() {
273
289
  return !e.trash.open();
274
290
  },
275
291
  get children() {
276
- var r = z(), v = r.firstChild;
277
- return p(r, "click", e.trash.openDock, !0), a(v, o(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
- })), h(() => N(r, "aria-label", `Open trash dock${e.trash.count() > 0 ? `, ${e.trash.count()} items` : ""}`)), r;
295
+ })), y(() => k(a, "aria-label", `Open trash dock${e.trash.count() > 0 ? `, ${e.trash.count()} items` : ""}`)), a;
280
296
  }
281
- })), h(() => n.classList.toggle("is-open", !!e.trash.open())), t;
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 S(() => !!e.board.isMobile())() && e.board.overviewOpen();
302
+ return $(() => !!e.board.isMobile())() && e.board.overviewOpen();
287
303
  },
288
304
  get children() {
289
- return [(() => {
290
- var t = q();
291
- return p(t, "click", e.overview.close, !0), t;
292
- })(), (() => {
293
- var t = V();
294
- return a(t, o(T, {
295
- mode: "mobile",
296
- get items() {
297
- return e.overview.items();
298
- },
299
- get boardScaleLabel() {
300
- return e.board.boardScaleLabel();
301
- },
302
- get viewportStyle() {
303
- return e.overview.viewportStyle();
304
- },
305
- get navigationState() {
306
- return e.overview.navigationState();
307
- },
308
- get onPointerDown() {
309
- return e.overview.beginNavigation;
310
- },
311
- get onZoomOut() {
312
- return e.board.zoomOut;
313
- },
314
- get onZoomIn() {
315
- return e.board.zoomIn;
316
- },
317
- get onClose() {
318
- return e.overview.close;
319
- }
320
- })), t;
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(B, {
324
- get open() {
325
- return e.trash.open();
326
- },
327
- get groups() {
328
- return e.trash.groups();
329
- },
330
- get now() {
331
- return e.trash.now();
332
- },
333
- get canDeleteNow() {
334
- return e.trash.canDeleteNow;
335
- },
336
- get onClose() {
337
- return e.trash.close;
338
- },
339
- get onBackdropContextMenu() {
340
- return e.trash.backdropContextMenu;
341
- },
342
- onRestore: (t) => {
343
- e.trash.restore(t);
344
- },
345
- onDeleteNow: (t) => {
346
- e.trash.deleteNow(t);
347
- },
348
- onClearTopicTrash: (t) => {
349
- e.trash.clearTopic(t);
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
- var t = A();
358
- return p(t, "click", e.contextMenu.close, !0), t;
359
- })(), o(I, {
360
- get x() {
361
- return e.contextMenu.position()?.left ?? 0;
362
- },
363
- get y() {
364
- return e.contextMenu.position()?.top ?? 0;
365
- },
366
- get items() {
367
- return e.contextMenu.items();
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(F, {
377
- get note() {
378
- return e.editor.note();
379
- },
380
- get draftBody() {
381
- return e.editor.draftBody();
382
- },
383
- get draftColor() {
384
- return e.editor.draftColor();
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 onDraftBodyChange() {
387
- return e.editor.setDraftBody;
438
+ get text() {
439
+ return e.manualPaste.text();
388
440
  },
389
- get onDraftColorChange() {
390
- return e.editor.setDraftColor;
441
+ get onTextChange() {
442
+ return e.manualPaste.setText;
391
443
  },
392
444
  get onClose() {
393
- return e.editor.close;
445
+ return e.manualPaste.close;
394
446
  },
395
- onSave: () => {
396
- e.editor.save();
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
- $(["click"]);
458
+ x(["click"]);
423
459
  export {
424
- ie as NotesOverlay
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(), g = p.firstChild, f = g.firstChild, C = f.firstChild, h = C.firstChild, E = h.nextSibling, $ = C.nextSibling, G = $.firstChild, K = f.nextSibling, X = g.nextSibling;
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, b = q.firstChild, w = b.firstChild, H = w.nextSibling, x = b.nextSibling, J = x.firstChild, y = x.nextSibling, L = y.firstChild;
59
- return t(w, () => 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(y, r(u, {
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
  },
@@ -7,6 +7,8 @@ export interface Command {
7
7
  class?: string;
8
8
  }>;
9
9
  keybind?: string;
10
+ /** Allow this keybind even while the user is typing in an input/editor. */
11
+ allowWhileTyping?: boolean;
10
12
  category?: string;
11
13
  execute: () => void | Promise<void>;
12
14
  }
@@ -1,60 +1,58 @@
1
- import { createSignal as c, onCleanup as D, createEffect as L } from "solid-js";
2
- import { createSimpleContext as P } from "./createSimpleContext.js";
3
- import { useResolvedFloeConfig as S } from "./FloeConfigContext.js";
4
- import { formatKeybind as E, parseKeybind as k, matchKeybind as p } from "../utils/keybind.js";
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 T() {
8
- const x = S(), y = () => x.config.commands, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), [v, s] = c(!1), [g, f] = c(""), [K, h] = c(""), [b, W] = c([]), a = () => {
9
- W(Array.from(r.values()));
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
- if (n.save.enabled && p(e, n.save.keybind)) {
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 (!I(e, {
22
- ignoreWhenTyping: n.ignoreWhenTyping,
23
- allowWhenTypingWithin: n.allowWhenTypingWithin
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), D(() => window.removeEventListener("keydown", t));
40
+ window.addEventListener("keydown", t), L(() => window.removeEventListener("keydown", t));
43
41
  }
44
- let u = 0;
45
- L(() => {
42
+ let p = 0;
43
+ P(() => {
46
44
  const t = g().trim();
47
- u += 1;
48
- const e = u;
45
+ p += 1;
46
+ const e = p;
49
47
  if (!t) {
50
48
  h("");
51
49
  return;
52
50
  }
53
51
  F(() => {
54
- e === u && h(t.toLowerCase());
52
+ e === p && h(t.toLowerCase());
55
53
  });
56
54
  });
57
- let w = "", C = null, l = [];
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 ? l : (C = t, w = e, e ? (l = t.filter((n) => n.title.toLowerCase().includes(e) || n.description?.toLowerCase().includes(e) || n.category?.toLowerCase().includes(e)), l) : (l = t, t));
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, k(t.keybind)), a(), () => {
75
- r.delete(t.id), i.delete(t.id), a();
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, k(e.keybind));
79
- }), a(), () => {
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
- }), a();
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: E
88
+ getKeybindDisplay: T
91
89
  };
92
90
  }
93
91
  const {
94
- Provider: B,
95
- use: G
96
- } = P({
92
+ Provider: G,
93
+ use: J
94
+ } = S({
97
95
  name: "Command",
98
- init: T
96
+ init: M
99
97
  });
100
98
  export {
101
- B as CommandProvider,
102
- T as createCommandService,
103
- G as useCommand
99
+ G as CommandProvider,
100
+ M as createCommandService,
101
+ J as useCommand
104
102
  };
@@ -36,6 +36,7 @@ export interface CommandContribution<TProtocol = unknown> {
36
36
  class?: string;
37
37
  }>;
38
38
  keybind?: string;
39
+ allowWhileTyping?: boolean;
39
40
  category?: string;
40
41
  execute: (ctx: ComponentContext<TProtocol>) => void | Promise<void>;
41
42
  }
@@ -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 s = `[${r}]`;
10
+ const i = `[${r}]`;
11
11
  return {
12
- debug: (...n) => console.debug(s, ...n),
13
- info: (...n) => console.info(s, ...n),
14
- warn: (...n) => console.warn(s, ...n),
15
- error: (...n) => console.error(s, ...n)
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, s) {
19
- const n = `component:${s}:`;
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(), s = v(), n = b(), a = R(), m = w();
28
- return (f, p) => ({
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: s,
31
+ layout: i,
32
32
  commands: n,
33
33
  notifications: a,
34
- storage: A(m.persist, f),
35
- logger: S(f)
34
+ storage: A(m.persist, l),
35
+ logger: S(l)
36
36
  });
37
37
  }
38
- const l = h({
38
+ const f = h({
39
39
  name: "ComponentRegistry",
40
40
  init: B
41
- }), G = l.Provider;
41
+ }), G = f.Provider;
42
42
  function H() {
43
- return l.use();
43
+ return f.use();
44
44
  }
45
45
  function J() {
46
- return l.useOptional();
46
+ return f.useOptional();
47
47
  }
48
48
  function K() {
49
- return l.has();
49
+ return f.has();
50
50
  }
51
51
  function B() {
52
- const [r, s] = C(/* @__PURE__ */ new Map()), [n, a] = C(/* @__PURE__ */ new Set()), m = /* @__PURE__ */ new Map(), f = (t) => {
53
- s((e) => new Map(e).set(t.id, t));
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 s((o) => {
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
- }, g = async (t, e) => {
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((i) => ({
71
- id: i.id,
72
- title: i.title,
73
- description: i.description,
74
- icon: i.icon,
75
- keybind: i.keybind,
76
- category: i.category,
77
- execute: () => i.execute(e)
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 i = new Set(u);
83
- return i.add(t), i;
83
+ const s = new Set(u);
84
+ return s.add(t), s;
84
85
  });
85
86
  } catch (u) {
86
- throw c.forEach((i) => i()), u;
87
+ throw c.forEach((s) => s()), u;
87
88
  }
88
- }, d = async (t) => {
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 d(t), s((e) => {
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: f,
107
+ register: l,
107
108
  registerAll: p,
108
109
  unregister: y,
109
- mount: g,
110
- unmount: d,
110
+ mount: d,
111
+ unmount: g,
111
112
  mountAll: async (t) => {
112
113
  for (const e of r().keys())
113
- await g(e, t(e));
114
+ await d(e, t(e));
114
115
  },
115
116
  unmountAll: async () => {
116
117
  for (const t of n())
117
- await d(t);
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 L, onCleanup as M } from "solid-js";
2
- import { lockBodyStyle as O } from "../utils/bodyStyleLock.js";
3
- import { deferAfterPaint as k } from "../utils/defer.js";
4
- import { getFocusableElements as T, getFirstFocusableElement as B } from "../utils/focus.js";
5
- function i(t) {
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 p(t, u, c) {
9
- return c === "none" ? !1 : c === "all" || !t || !i(u) ? !0 : !t.contains(u);
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 u = () => t.lockBodyScroll !== !1, c = () => t.trapFocus !== !1, s = () => t.closeOnEscape === !1 ? "none" : t.closeOnEscape === "inside" ? "inside" : t.closeOnEscape === "none" ? "none" : "always", b = () => t.blockHotkeys !== !1, w = () => t.restoreFocus !== !1;
13
- L(() => {
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, g = u() ? O({ overflow: "hidden" }) : null;
16
- k(() => {
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, a = (o ? e.querySelector(o) : null) ?? e.querySelector("[data-floe-autofocus]") ?? B(e) ?? e;
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
- a.focus();
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 = T(n);
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 r = o[0], a = o[o.length - 1], l = document.activeElement instanceof HTMLElement ? document.activeElement : null;
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 (l === r || !l || !n.contains(l)) {
45
+ if (s === a || !s || !n.contains(s)) {
43
46
  e.preventDefault();
44
47
  try {
45
- a.focus();
48
+ l.focus();
46
49
  } catch {
47
50
  }
48
51
  }
49
- } else if (l === a) {
52
+ } else if (s === l) {
50
53
  e.preventDefault();
51
54
  try {
52
- r.focus();
55
+ a.focus();
53
56
  } catch {
54
57
  }
55
58
  }
56
59
  }, m = (e) => {
57
60
  if (e.key !== "Escape") return;
58
- const n = s();
59
- if (n !== "none") {
60
- if (n === "inside") {
61
- const o = t.root();
62
- if (!o) return;
63
- const r = i(e.target) ? e.target : document.activeElement;
64
- if (!r || !o.contains(r)) return;
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.onClose?.();
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 && b() && i(e.target) && n.contains(e.target) && e.stopPropagation();
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
- p(o, e.target, n) && e.cancelable && e.preventDefault();
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
- p(o, e.target, n) && e.cancelable && e.preventDefault();
83
+ k(o, e.target, n, t.containsTarget) && e.cancelable && e.preventDefault();
79
84
  };
80
- c() && document.addEventListener("keydown", d, !0), s() !== "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 }), M(() => {
81
- c() && document.removeEventListener("keydown", d, !0), s() !== "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), g?.(), w() && f && f.isConnected && k(() => {
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))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.35.43",
3
+ "version": "0.35.45",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",