@floegence/floe-webapp-core 0.35.55 → 0.35.57

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,28 +1,41 @@
1
- import { createComponent as o, insert as i, addEventListener as v, effect as y, setAttribute as k, Portal as c, memo as x, template as u, delegateEvents as $ } from "solid-js/web";
2
- import { createEffect as D, onCleanup as I, Show as s } from "solid-js";
3
- import { Motion as T } 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 C } 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 j } from "./useNotesOverlayModel.js";
15
- var A = /* @__PURE__ */ u('<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>'), V = /* @__PURE__ */ u("<button type=button class=notes-trash__toggle><div class=notes-trash__toggle-mark>"), H = /* @__PURE__ */ u("<div class=notes-overlay__body><div class=notes-trash data-floe-canvas-interactive=true>"), U = /* @__PURE__ */ u("<div class=notes-overview-backdrop data-floe-notes-boundary=true>"), X = /* @__PURE__ */ u("<div class=notes-overview-flyout data-floe-notes-boundary=true>"), Y = /* @__PURE__ */ u("<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;
1
+ import { createComponent as n, insert as c, addEventListener as h, effect as M, setAttribute as F, Portal as v, memo as R, template as m, delegateEvents as K } from "solid-js/web";
2
+ import { createSignal as Z, createMemo as z, createEffect as C, onCleanup as O, Show as g } from "solid-js";
3
+ import { Motion as E } 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 H, duration as I } from "../../utils/animations.js";
5
+ import { useOverlayMask as W } from "../../hooks/useOverlayMask.js";
6
+ import { X as A } from "../icons/index.js";
7
+ import { useResolvedFloeConfig as q } from "../../context/FloeConfigContext.js";
8
+ import { NotesBoard as G } from "./NotesBoard.js";
9
+ import { NotesContextMenu as j } from "./NotesContextMenu.js";
10
+ import { NotesEditorFlyout as V, NotesManualPasteFlyout as Y } from "./NotesEditorFlyout.js";
11
+ import { NotesOverviewPanel as x } from "./NotesOverviewPanel.js";
12
+ import { NotesTopicRail as U } from "./NotesTopicRail.js";
13
+ import { NotesTrashFlyout as X } from "./NotesTrashFlyout.js";
14
+ import { NotesTrashCanIcon as J } from "./notesAppearance.js";
15
+ import { useNotesOverlayModel as Q } from "./useNotesOverlayModel.js";
16
+ var ee = /* @__PURE__ */ m('<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>'), te = /* @__PURE__ */ m("<button type=button class=notes-trash__toggle><div class=notes-trash__toggle-mark>"), oe = /* @__PURE__ */ m("<div class=notes-overlay__body><div class=notes-trash data-floe-canvas-interactive=true>"), re = /* @__PURE__ */ m("<div class=notes-overview-backdrop data-floe-notes-boundary=true>"), ne = /* @__PURE__ */ m("<div class=notes-overview-flyout data-floe-notes-boundary=true>"), ae = /* @__PURE__ */ m("<div class=notes-menu-backdrop data-floe-notes-boundary=true>");
17
+ const ie = '[data-floe-notes-boundary="true"]', le = '[data-floe-notes-digit-browse="true"]', se = 'input, textarea, select, [contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"], [role="textbox"]';
18
+ function _(o) {
19
+ return typeof Element < "u" && o instanceof Element ? o : typeof Node < "u" && o instanceof Node ? o.parentElement : null;
19
20
  }
20
- function w(r) {
21
- return !!J(r)?.closest(G);
21
+ function y(o) {
22
+ return !!_(o)?.closest(ie);
22
23
  }
23
- function K(r) {
24
- return r === "floating" ? {
25
- mode: r,
24
+ function w(o) {
25
+ return !!_(o)?.closest(le);
26
+ }
27
+ function B(o) {
28
+ return !!_(o)?.closest(se);
29
+ }
30
+ function ce(o) {
31
+ return o.key === "Shift" || o.key === "Meta" || o.key === "Alt" || o.key === "Control";
32
+ }
33
+ function ue(o) {
34
+ return /^\d$/.test(o.key) ? o.key : null;
35
+ }
36
+ function de(o) {
37
+ return o === "floating" ? {
38
+ mode: o,
26
39
  ariaModal: void 0,
27
40
  lockBodyScroll: !1,
28
41
  trapFocus: !1,
@@ -43,48 +56,90 @@ function K(r) {
43
56
  }
44
57
  };
45
58
  }
46
- function ge(r) {
47
- const e = j(r);
48
- let g;
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);
59
+ function De(o) {
60
+ const S = q(), e = Q(o);
61
+ let p;
62
+ const [$, f] = Z(!1), s = () => de(o.interactionMode), k = () => o.onClose(), P = z(() => {
63
+ if (s().mode !== "floating")
64
+ return [];
65
+ const t = /* @__PURE__ */ new Set();
66
+ if (S.config.commands.palette.enabled) {
67
+ const a = S.config.commands.palette.keybind.trim();
68
+ a && t.add(a);
69
+ }
70
+ for (const a of o.allowGlobalHotkeys ?? []) {
71
+ const i = a.trim();
72
+ i && t.add(i);
73
+ }
74
+ return Array.from(t);
75
+ });
76
+ return C(() => {
77
+ if (!o.open || s().mode !== "floating" || typeof document > "u") return;
78
+ const t = (a) => {
79
+ y(a.target) || queueMicrotask(k);
54
80
  };
55
- document.addEventListener("click", t, !0), I(() => document.removeEventListener("click", t, !0));
56
- }), F({
57
- open: () => r.open,
58
- root: () => g,
81
+ document.addEventListener("click", t, !0), O(() => document.removeEventListener("click", t, !0));
82
+ }), W({
83
+ open: () => o.open,
84
+ root: () => p,
59
85
  onClose: () => e.handleCloseRequest(),
60
- onEscapeOutside: l().mode === "floating" ? b : void 0,
61
- containsTarget: w,
62
- lockBodyScroll: l().lockBodyScroll,
63
- trapFocus: l().trapFocus,
64
- closeOnEscape: l().closeOnEscape,
86
+ onEscapeOutside: s().mode === "floating" ? k : void 0,
87
+ containsTarget: y,
88
+ lockBodyScroll: s().lockBodyScroll,
89
+ trapFocus: s().trapFocus,
90
+ closeOnEscape: s().closeOnEscape,
65
91
  blockHotkeys: !0,
66
- blockWheel: l().blockWheel,
67
- blockTouchMove: l().blockTouchMove,
68
- autoFocus: l().autoFocus,
92
+ allowHotkeys: P,
93
+ blockWheel: s().blockWheel,
94
+ blockTouchMove: s().blockTouchMove,
95
+ autoFocus: s().autoFocus,
69
96
  restoreFocus: !0
70
- }), o(s, {
97
+ }), C(() => {
98
+ o.open || (f(!1), e.shortcuts.clearPendingDigitState());
99
+ }), C(() => {
100
+ if (!o.open || typeof document > "u") return;
101
+ const t = () => {
102
+ f(!1), e.shortcuts.clearPendingDigitState();
103
+ }, a = (r) => {
104
+ const u = w(r.target), l = y(r.target);
105
+ f(u), (!l || !u) && e.shortcuts.clearPendingDigitState();
106
+ }, i = (r) => {
107
+ const u = w(r.target), l = y(r.target);
108
+ f(u), (!l || !u) && e.shortcuts.clearPendingDigitState();
109
+ }, d = (r) => {
110
+ const u = ue(r);
111
+ if (!u) {
112
+ ce(r) || e.shortcuts.clearPendingDigitState();
113
+ return;
114
+ }
115
+ const l = document.activeElement, T = w(l), b = $() && (!l || l === document.body || l === document.documentElement || l === p);
116
+ if (!(!r.defaultPrevented && !r.repeat && !r.isComposing && !r.altKey && !r.ctrlKey && !r.metaKey && !e.shortcuts.blocked() && !B(r.target) && !B(l) && (T || b))) {
117
+ t();
118
+ return;
119
+ }
120
+ r.preventDefault(), typeof r.stopImmediatePropagation == "function" ? r.stopImmediatePropagation() : r.stopPropagation(), e.shortcuts.handleDigitShortcut(u);
121
+ };
122
+ document.addEventListener("pointerdown", a, !0), document.addEventListener("focusin", i, !0), document.addEventListener("keydown", d, !0), O(() => {
123
+ document.removeEventListener("pointerdown", a, !0), document.removeEventListener("focusin", i, !0), document.removeEventListener("keydown", d, !0);
124
+ });
125
+ }), n(g, {
71
126
  get when() {
72
- return r.open;
127
+ return o.open;
73
128
  },
74
129
  get children() {
75
- return o(T.section, {
130
+ return n(E.section, {
76
131
  ref(t) {
77
- var n = g;
78
- typeof n == "function" ? n(t) : g = t;
132
+ var a = p;
133
+ typeof a == "function" ? a(t) : p = t;
79
134
  },
80
135
  class: "notes-overlay",
81
136
  role: "dialog",
82
137
  get "aria-modal"() {
83
- return l().ariaModal;
138
+ return s().ariaModal;
84
139
  },
85
140
  "aria-label": "Notes overlay",
86
141
  get "data-notes-interaction-mode"() {
87
- return l().mode;
142
+ return s().mode;
88
143
  },
89
144
  tabIndex: -1,
90
145
  initial: {
@@ -95,11 +150,11 @@ function ge(r) {
95
150
  },
96
151
  get transition() {
97
152
  return {
98
- duration: C.fast
153
+ duration: I.fast
99
154
  };
100
155
  },
101
156
  get children() {
102
- return [o(T.div, {
157
+ return [n(E.div, {
103
158
  class: "notes-overlay__frame",
104
159
  "data-floe-notes-boundary": "true",
105
160
  initial: {
@@ -114,19 +169,19 @@ function ge(r) {
114
169
  },
115
170
  get transition() {
116
171
  return {
117
- duration: C.normal,
118
- easing: E.easeOut
172
+ duration: I.normal,
173
+ easing: H.easeOut
119
174
  };
120
175
  },
121
176
  get children() {
122
177
  return [(() => {
123
- var t = A(), n = t.firstChild, a = n.firstChild, m = a.nextSibling, p = m.nextSibling, N = p.firstChild, d = p.nextSibling, M = d.firstChild, f = d.nextSibling, S = f.firstChild, O = n.nextSibling, h = O.firstChild;
124
- return i(p, () => e.header.topicCount(), N), i(d, () => e.header.totalLiveNotes(), M), i(d, () => e.header.totalLiveNotes() === 1 ? "" : "s", null), i(f, () => e.header.trashCount(), S), h.$$click = () => e.handleCloseRequest(), i(h, o(L, {
178
+ var t = ee(), a = t.firstChild, i = a.firstChild, d = i.nextSibling, r = d.nextSibling, u = r.firstChild, l = r.nextSibling, T = l.firstChild, b = l.nextSibling, N = b.firstChild, L = a.nextSibling, D = L.firstChild;
179
+ return c(r, () => e.header.topicCount(), u), c(l, () => e.header.totalLiveNotes(), T), c(l, () => e.header.totalLiveNotes() === 1 ? "" : "s", null), c(b, () => e.header.trashCount(), N), D.$$click = () => e.handleCloseRequest(), c(D, n(A, {
125
180
  class: "w-4 h-4"
126
181
  })), t;
127
182
  })(), (() => {
128
- var t = H(), n = t.firstChild;
129
- return i(t, o(z, {
183
+ var t = oe(), a = t.firstChild;
184
+ return c(t, n(U, {
130
185
  get topics() {
131
186
  return e.rail.topics();
132
187
  },
@@ -166,10 +221,10 @@ function ge(r) {
166
221
  get onCancelRename() {
167
222
  return e.rail.cancelTopicRename;
168
223
  },
169
- onDeleteTopic: (a) => {
170
- e.rail.deleteTopic(a);
224
+ onDeleteTopic: (i) => {
225
+ e.rail.deleteTopic(i);
171
226
  }
172
- }), n), i(t, o(R, {
227
+ }), a), c(t, n(G, {
173
228
  get activeTopic() {
174
229
  return e.board.activeTopic();
175
230
  },
@@ -206,6 +261,12 @@ function ge(r) {
206
261
  get copiedNoteID() {
207
262
  return e.board.copiedNoteID();
208
263
  },
264
+ get noteNumberByID() {
265
+ return e.board.noteNumberByID();
266
+ },
267
+ get pendingShortcutNoteID() {
268
+ return e.board.pendingShortcutNoteID();
269
+ },
209
270
  get setCanvasFrameRef() {
210
271
  return e.board.setCanvasFrameRef;
211
272
  },
@@ -236,8 +297,8 @@ function ge(r) {
236
297
  get onSeedMoveProjection() {
237
298
  return e.board.seedMoveProjection;
238
299
  },
239
- onCopyNote: (a) => {
240
- e.board.copyNote(a);
300
+ onCopyNote: (i) => {
301
+ e.board.copyNote(i);
241
302
  },
242
303
  get onOpenNoteContextMenu() {
243
304
  return e.board.openNoteContextMenu;
@@ -245,8 +306,8 @@ function ge(r) {
245
306
  get onOpenEditor() {
246
307
  return e.board.openEditor;
247
308
  },
248
- onMoveToTrash: (a) => {
249
- e.board.moveToTrash(a);
309
+ onMoveToTrash: (i) => {
310
+ e.board.moveToTrash(i);
250
311
  },
251
312
  get onStartOptimisticFront() {
252
313
  return e.board.startOptimisticFront;
@@ -257,12 +318,12 @@ function ge(r) {
257
318
  get onCommitMove() {
258
319
  return e.board.commitMove;
259
320
  }
260
- }), n), i(t, o(s, {
321
+ }), a), c(t, n(g, {
261
322
  get when() {
262
323
  return !e.board.isMobile();
263
324
  },
264
325
  get children() {
265
- return o(_, {
326
+ return n(x, {
266
327
  mode: "desktop",
267
328
  get items() {
268
329
  return e.overview.items();
@@ -287,32 +348,32 @@ function ge(r) {
287
348
  }
288
349
  });
289
350
  }
290
- }), n), i(n, o(s, {
351
+ }), a), c(a, n(g, {
291
352
  get when() {
292
353
  return !e.trash.open();
293
354
  },
294
355
  get children() {
295
- var a = V(), m = a.firstChild;
296
- return v(a, "click", e.trash.openDock, !0), i(m, o(q, {
356
+ var i = te(), d = i.firstChild;
357
+ return h(i, "click", e.trash.openDock, !0), c(d, n(J, {
297
358
  class: "notes-trash__toggle-icon"
298
- })), y(() => k(a, "aria-label", `Open trash dock${e.trash.count() > 0 ? `, ${e.trash.count()} items` : ""}`)), a;
359
+ })), M(() => F(i, "aria-label", `Open trash dock${e.trash.count() > 0 ? `, ${e.trash.count()} items` : ""}`)), i;
299
360
  }
300
- })), y(() => n.classList.toggle("is-open", !!e.trash.open())), t;
361
+ })), M(() => a.classList.toggle("is-open", !!e.trash.open())), t;
301
362
  })()];
302
363
  }
303
- }), o(s, {
364
+ }), n(g, {
304
365
  get when() {
305
- return x(() => !!e.board.isMobile())() && e.board.overviewOpen();
366
+ return R(() => !!e.board.isMobile())() && e.board.overviewOpen();
306
367
  },
307
368
  get children() {
308
- return o(c, {
369
+ return n(v, {
309
370
  get children() {
310
371
  return [(() => {
311
- var t = U();
312
- return v(t, "click", e.overview.close, !0), t;
372
+ var t = re();
373
+ return h(t, "click", e.overview.close, !0), t;
313
374
  })(), (() => {
314
- var t = X();
315
- return i(t, o(_, {
375
+ var t = ne();
376
+ return c(t, n(x, {
316
377
  mode: "mobile",
317
378
  get items() {
318
379
  return e.overview.items();
@@ -343,9 +404,9 @@ function ge(r) {
343
404
  }
344
405
  });
345
406
  }
346
- }), o(c, {
407
+ }), n(v, {
347
408
  get children() {
348
- return o(W, {
409
+ return n(X, {
349
410
  get open() {
350
411
  return e.trash.open();
351
412
  },
@@ -375,17 +436,17 @@ function ge(r) {
375
436
  }
376
437
  });
377
438
  }
378
- }), o(s, {
439
+ }), n(g, {
379
440
  get when() {
380
441
  return e.contextMenu.state();
381
442
  },
382
443
  get children() {
383
- return o(c, {
444
+ return n(v, {
384
445
  get children() {
385
446
  return [(() => {
386
- var t = Y();
387
- return v(t, "contextmenu", e.contextMenu.retarget, !0), v(t, "click", e.contextMenu.close, !0), t;
388
- })(), o(B, {
447
+ var t = ae();
448
+ return h(t, "contextmenu", e.contextMenu.retarget, !0), h(t, "click", e.contextMenu.close, !0), t;
449
+ })(), n(j, {
389
450
  get x() {
390
451
  return e.contextMenu.position()?.left ?? 0;
391
452
  },
@@ -399,14 +460,14 @@ function ge(r) {
399
460
  }
400
461
  });
401
462
  }
402
- }), o(s, {
463
+ }), n(g, {
403
464
  get when() {
404
465
  return !!e.editor.note();
405
466
  },
406
467
  get children() {
407
- return o(c, {
468
+ return n(v, {
408
469
  get children() {
409
- return o(P, {
470
+ return n(V, {
410
471
  get note() {
411
472
  return e.editor.note();
412
473
  },
@@ -438,9 +499,9 @@ function ge(r) {
438
499
  }
439
500
  });
440
501
  }
441
- }), o(c, {
502
+ }), n(v, {
442
503
  get children() {
443
- return o(Z, {
504
+ return n(Y, {
444
505
  get open() {
445
506
  return e.manualPaste.open();
446
507
  },
@@ -464,7 +525,7 @@ function ge(r) {
464
525
  }
465
526
  });
466
527
  }
467
- $(["click", "contextmenu"]);
528
+ K(["click", "contextmenu"]);
468
529
  export {
469
- ge as NotesOverlay
530
+ De as NotesOverlay
470
531
  };
@@ -0,0 +1,18 @@
1
+ import type { NotesItem } from './types';
2
+ export interface NotesNumberedItem {
3
+ readonly item: NotesItem;
4
+ readonly index: number;
5
+ readonly label: string;
6
+ }
7
+ export type NotesDigitSequenceResolution = Readonly<{
8
+ kind: 'invalid';
9
+ }> | Readonly<{
10
+ kind: 'pending';
11
+ exactMatch: NotesNumberedItem | null;
12
+ }> | Readonly<{
13
+ kind: 'ready';
14
+ match: NotesNumberedItem;
15
+ }>;
16
+ export declare function sortNotesForNumbering(items: readonly NotesItem[]): NotesItem[];
17
+ export declare function numberNotesInTopic(items: readonly NotesItem[], topicID: string): NotesNumberedItem[];
18
+ export declare function resolveNotesDigitSequence(sequence: string, numberedItems: readonly NotesNumberedItem[]): NotesDigitSequenceResolution;
@@ -0,0 +1,28 @@
1
+ function o(i) {
2
+ return [...i].sort(
3
+ (e, n) => e.created_at_unix_ms !== n.created_at_unix_ms ? e.created_at_unix_ms - n.created_at_unix_ms : e.note_id.localeCompare(n.note_id)
4
+ );
5
+ }
6
+ function c(i, e) {
7
+ return o(i.filter((n) => n.topic_id === e)).map(
8
+ (n, t) => ({
9
+ item: n,
10
+ index: t + 1,
11
+ label: String(t + 1)
12
+ })
13
+ );
14
+ }
15
+ function d(i, e) {
16
+ const n = String(i ?? "").trim();
17
+ if (!/^[1-9]\d*$/.test(n))
18
+ return { kind: "invalid" };
19
+ const t = e.find((r) => r.label === n) ?? null, a = e.some(
20
+ (r) => r.label.startsWith(n) && r.label !== n
21
+ );
22
+ return t && !a ? { kind: "ready", match: t } : t || a ? { kind: "pending", exactMatch: t } : { kind: "invalid" };
23
+ }
24
+ export {
25
+ c as numberNotesInTopic,
26
+ d as resolveNotesDigitSequence,
27
+ o as sortNotesForNumbering
28
+ };
@@ -89,6 +89,8 @@ export declare function useNotesOverlayModel(options: UseNotesOverlayModelOption
89
89
  overviewOpen: import("solid-js").Accessor<boolean>;
90
90
  optimisticFrontNoteID: import("solid-js").Accessor<string | null>;
91
91
  copiedNoteID: import("solid-js").Accessor<string | null>;
92
+ noteNumberByID: import("solid-js").Accessor<Map<string, string>>;
93
+ pendingShortcutNoteID: import("solid-js").Accessor<string | null>;
92
94
  setCanvasFrameRef: import("solid-js").Setter<HTMLDivElement | undefined>;
93
95
  commitViewport: (viewport: NotesViewport) => void;
94
96
  openCanvasContextMenu: (event: {
@@ -203,5 +205,10 @@ export declare function useNotesOverlayModel(options: UseNotesOverlayModelOption
203
205
  close: () => void;
204
206
  confirm: () => Promise<void>;
205
207
  };
208
+ shortcuts: {
209
+ blocked: import("solid-js").Accessor<boolean>;
210
+ handleDigitShortcut: (digit: string) => void;
211
+ clearPendingDigitState: () => void;
212
+ };
206
213
  handleCloseRequest: () => void;
207
214
  };