@floegence/floe-webapp-core 0.35.56 → 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,29 +1,41 @@
1
- import { createComponent as o, insert as l, addEventListener as v, effect as T, setAttribute as $, Portal as u, memo as D, template as c, delegateEvents as I } from "solid-js/web";
2
- import { createMemo as F, createEffect as E, onCleanup as R, 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 L, duration as _ } from "../../utils/animations.js";
5
- import { useOverlayMask as B } from "../../hooks/useOverlayMask.js";
6
- import { X as P } from "../icons/index.js";
7
- import { useResolvedFloeConfig as Z } from "../../context/FloeConfigContext.js";
8
- import { NotesBoard as z } from "./NotesBoard.js";
9
- import { NotesContextMenu as H } from "./NotesContextMenu.js";
10
- import { NotesEditorFlyout as W, NotesManualPasteFlyout as q } from "./NotesEditorFlyout.js";
11
- import { NotesOverviewPanel as w } from "./NotesOverviewPanel.js";
12
- import { NotesTopicRail as A } from "./NotesTopicRail.js";
13
- import { NotesTrashFlyout as j } from "./NotesTrashFlyout.js";
14
- import { NotesTrashCanIcon as K } from "./notesAppearance.js";
15
- import { useNotesOverlayModel as V } from "./useNotesOverlayModel.js";
16
- var G = /* @__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>'), U = /* @__PURE__ */ c("<button type=button class=notes-trash__toggle><div class=notes-trash__toggle-mark>"), X = /* @__PURE__ */ c("<div class=notes-overlay__body><div class=notes-trash data-floe-canvas-interactive=true>"), Y = /* @__PURE__ */ c("<div class=notes-overview-backdrop data-floe-notes-boundary=true>"), J = /* @__PURE__ */ c("<div class=notes-overview-flyout data-floe-notes-boundary=true>"), Q = /* @__PURE__ */ c("<div class=notes-menu-backdrop data-floe-notes-boundary=true>");
17
- const ee = '[data-floe-notes-boundary="true"]';
18
- function te(n) {
19
- return typeof Element < "u" && n instanceof Element ? n : typeof Node < "u" && n instanceof Node ? n.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;
20
20
  }
21
- function k(n) {
22
- return !!te(n)?.closest(ee);
21
+ function y(o) {
22
+ return !!_(o)?.closest(ie);
23
23
  }
24
- function oe(n) {
25
- return n === "floating" ? {
26
- mode: n,
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,
27
39
  ariaModal: void 0,
28
40
  lockBodyScroll: !1,
29
41
  trapFocus: !1,
@@ -44,62 +56,90 @@ function oe(n) {
44
56
  }
45
57
  };
46
58
  }
47
- function he(n) {
48
- const b = Z(), e = V(n);
49
- let g;
50
- const i = () => oe(n.interactionMode), f = () => n.onClose(), M = F(() => {
51
- if (i().mode !== "floating")
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")
52
64
  return [];
53
65
  const t = /* @__PURE__ */ new Set();
54
- if (b.config.commands.palette.enabled) {
55
- const r = b.config.commands.palette.keybind.trim();
56
- r && t.add(r);
57
- }
58
- for (const r of n.allowGlobalHotkeys ?? []) {
59
- const a = r.trim();
66
+ if (S.config.commands.palette.enabled) {
67
+ const a = S.config.commands.palette.keybind.trim();
60
68
  a && t.add(a);
61
69
  }
70
+ for (const a of o.allowGlobalHotkeys ?? []) {
71
+ const i = a.trim();
72
+ i && t.add(i);
73
+ }
62
74
  return Array.from(t);
63
75
  });
64
- return E(() => {
65
- if (!n.open || i().mode !== "floating" || typeof document > "u") return;
66
- const t = (r) => {
67
- k(r.target) || queueMicrotask(f);
76
+ return C(() => {
77
+ if (!o.open || s().mode !== "floating" || typeof document > "u") return;
78
+ const t = (a) => {
79
+ y(a.target) || queueMicrotask(k);
68
80
  };
69
- document.addEventListener("click", t, !0), R(() => document.removeEventListener("click", t, !0));
70
- }), B({
71
- open: () => n.open,
72
- root: () => g,
81
+ document.addEventListener("click", t, !0), O(() => document.removeEventListener("click", t, !0));
82
+ }), W({
83
+ open: () => o.open,
84
+ root: () => p,
73
85
  onClose: () => e.handleCloseRequest(),
74
- onEscapeOutside: i().mode === "floating" ? f : void 0,
75
- containsTarget: k,
76
- lockBodyScroll: i().lockBodyScroll,
77
- trapFocus: i().trapFocus,
78
- closeOnEscape: i().closeOnEscape,
86
+ onEscapeOutside: s().mode === "floating" ? k : void 0,
87
+ containsTarget: y,
88
+ lockBodyScroll: s().lockBodyScroll,
89
+ trapFocus: s().trapFocus,
90
+ closeOnEscape: s().closeOnEscape,
79
91
  blockHotkeys: !0,
80
- allowHotkeys: M,
81
- blockWheel: i().blockWheel,
82
- blockTouchMove: i().blockTouchMove,
83
- autoFocus: i().autoFocus,
92
+ allowHotkeys: P,
93
+ blockWheel: s().blockWheel,
94
+ blockTouchMove: s().blockTouchMove,
95
+ autoFocus: s().autoFocus,
84
96
  restoreFocus: !0
85
- }), 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, {
86
126
  get when() {
87
- return n.open;
127
+ return o.open;
88
128
  },
89
129
  get children() {
90
- return o(C.section, {
130
+ return n(E.section, {
91
131
  ref(t) {
92
- var r = g;
93
- typeof r == "function" ? r(t) : g = t;
132
+ var a = p;
133
+ typeof a == "function" ? a(t) : p = t;
94
134
  },
95
135
  class: "notes-overlay",
96
136
  role: "dialog",
97
137
  get "aria-modal"() {
98
- return i().ariaModal;
138
+ return s().ariaModal;
99
139
  },
100
140
  "aria-label": "Notes overlay",
101
141
  get "data-notes-interaction-mode"() {
102
- return i().mode;
142
+ return s().mode;
103
143
  },
104
144
  tabIndex: -1,
105
145
  initial: {
@@ -110,11 +150,11 @@ function he(n) {
110
150
  },
111
151
  get transition() {
112
152
  return {
113
- duration: _.fast
153
+ duration: I.fast
114
154
  };
115
155
  },
116
156
  get children() {
117
- return [o(C.div, {
157
+ return [n(E.div, {
118
158
  class: "notes-overlay__frame",
119
159
  "data-floe-notes-boundary": "true",
120
160
  initial: {
@@ -129,19 +169,19 @@ function he(n) {
129
169
  },
130
170
  get transition() {
131
171
  return {
132
- duration: _.normal,
133
- easing: L.easeOut
172
+ duration: I.normal,
173
+ easing: H.easeOut
134
174
  };
135
175
  },
136
176
  get children() {
137
177
  return [(() => {
138
- var t = G(), r = t.firstChild, a = r.firstChild, m = a.nextSibling, p = m.nextSibling, N = p.firstChild, d = p.nextSibling, S = d.firstChild, h = d.nextSibling, O = h.firstChild, x = r.nextSibling, y = x.firstChild;
139
- return l(p, () => e.header.topicCount(), N), l(d, () => e.header.totalLiveNotes(), S), l(d, () => e.header.totalLiveNotes() === 1 ? "" : "s", null), l(h, () => e.header.trashCount(), O), y.$$click = () => e.handleCloseRequest(), l(y, o(P, {
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, {
140
180
  class: "w-4 h-4"
141
181
  })), t;
142
182
  })(), (() => {
143
- var t = X(), r = t.firstChild;
144
- return l(t, o(A, {
183
+ var t = oe(), a = t.firstChild;
184
+ return c(t, n(U, {
145
185
  get topics() {
146
186
  return e.rail.topics();
147
187
  },
@@ -181,10 +221,10 @@ function he(n) {
181
221
  get onCancelRename() {
182
222
  return e.rail.cancelTopicRename;
183
223
  },
184
- onDeleteTopic: (a) => {
185
- e.rail.deleteTopic(a);
224
+ onDeleteTopic: (i) => {
225
+ e.rail.deleteTopic(i);
186
226
  }
187
- }), r), l(t, o(z, {
227
+ }), a), c(t, n(G, {
188
228
  get activeTopic() {
189
229
  return e.board.activeTopic();
190
230
  },
@@ -221,6 +261,12 @@ function he(n) {
221
261
  get copiedNoteID() {
222
262
  return e.board.copiedNoteID();
223
263
  },
264
+ get noteNumberByID() {
265
+ return e.board.noteNumberByID();
266
+ },
267
+ get pendingShortcutNoteID() {
268
+ return e.board.pendingShortcutNoteID();
269
+ },
224
270
  get setCanvasFrameRef() {
225
271
  return e.board.setCanvasFrameRef;
226
272
  },
@@ -251,8 +297,8 @@ function he(n) {
251
297
  get onSeedMoveProjection() {
252
298
  return e.board.seedMoveProjection;
253
299
  },
254
- onCopyNote: (a) => {
255
- e.board.copyNote(a);
300
+ onCopyNote: (i) => {
301
+ e.board.copyNote(i);
256
302
  },
257
303
  get onOpenNoteContextMenu() {
258
304
  return e.board.openNoteContextMenu;
@@ -260,8 +306,8 @@ function he(n) {
260
306
  get onOpenEditor() {
261
307
  return e.board.openEditor;
262
308
  },
263
- onMoveToTrash: (a) => {
264
- e.board.moveToTrash(a);
309
+ onMoveToTrash: (i) => {
310
+ e.board.moveToTrash(i);
265
311
  },
266
312
  get onStartOptimisticFront() {
267
313
  return e.board.startOptimisticFront;
@@ -272,12 +318,12 @@ function he(n) {
272
318
  get onCommitMove() {
273
319
  return e.board.commitMove;
274
320
  }
275
- }), r), l(t, o(s, {
321
+ }), a), c(t, n(g, {
276
322
  get when() {
277
323
  return !e.board.isMobile();
278
324
  },
279
325
  get children() {
280
- return o(w, {
326
+ return n(x, {
281
327
  mode: "desktop",
282
328
  get items() {
283
329
  return e.overview.items();
@@ -302,32 +348,32 @@ function he(n) {
302
348
  }
303
349
  });
304
350
  }
305
- }), r), l(r, o(s, {
351
+ }), a), c(a, n(g, {
306
352
  get when() {
307
353
  return !e.trash.open();
308
354
  },
309
355
  get children() {
310
- var a = U(), m = a.firstChild;
311
- return v(a, "click", e.trash.openDock, !0), l(m, o(K, {
356
+ var i = te(), d = i.firstChild;
357
+ return h(i, "click", e.trash.openDock, !0), c(d, n(J, {
312
358
  class: "notes-trash__toggle-icon"
313
- })), T(() => $(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;
314
360
  }
315
- })), T(() => r.classList.toggle("is-open", !!e.trash.open())), t;
361
+ })), M(() => a.classList.toggle("is-open", !!e.trash.open())), t;
316
362
  })()];
317
363
  }
318
- }), o(s, {
364
+ }), n(g, {
319
365
  get when() {
320
- return D(() => !!e.board.isMobile())() && e.board.overviewOpen();
366
+ return R(() => !!e.board.isMobile())() && e.board.overviewOpen();
321
367
  },
322
368
  get children() {
323
- return o(u, {
369
+ return n(v, {
324
370
  get children() {
325
371
  return [(() => {
326
- var t = Y();
327
- return v(t, "click", e.overview.close, !0), t;
372
+ var t = re();
373
+ return h(t, "click", e.overview.close, !0), t;
328
374
  })(), (() => {
329
- var t = J();
330
- return l(t, o(w, {
375
+ var t = ne();
376
+ return c(t, n(x, {
331
377
  mode: "mobile",
332
378
  get items() {
333
379
  return e.overview.items();
@@ -358,9 +404,9 @@ function he(n) {
358
404
  }
359
405
  });
360
406
  }
361
- }), o(u, {
407
+ }), n(v, {
362
408
  get children() {
363
- return o(j, {
409
+ return n(X, {
364
410
  get open() {
365
411
  return e.trash.open();
366
412
  },
@@ -390,17 +436,17 @@ function he(n) {
390
436
  }
391
437
  });
392
438
  }
393
- }), o(s, {
439
+ }), n(g, {
394
440
  get when() {
395
441
  return e.contextMenu.state();
396
442
  },
397
443
  get children() {
398
- return o(u, {
444
+ return n(v, {
399
445
  get children() {
400
446
  return [(() => {
401
- var t = Q();
402
- return v(t, "contextmenu", e.contextMenu.retarget, !0), v(t, "click", e.contextMenu.close, !0), t;
403
- })(), o(H, {
447
+ var t = ae();
448
+ return h(t, "contextmenu", e.contextMenu.retarget, !0), h(t, "click", e.contextMenu.close, !0), t;
449
+ })(), n(j, {
404
450
  get x() {
405
451
  return e.contextMenu.position()?.left ?? 0;
406
452
  },
@@ -414,14 +460,14 @@ function he(n) {
414
460
  }
415
461
  });
416
462
  }
417
- }), o(s, {
463
+ }), n(g, {
418
464
  get when() {
419
465
  return !!e.editor.note();
420
466
  },
421
467
  get children() {
422
- return o(u, {
468
+ return n(v, {
423
469
  get children() {
424
- return o(W, {
470
+ return n(V, {
425
471
  get note() {
426
472
  return e.editor.note();
427
473
  },
@@ -453,9 +499,9 @@ function he(n) {
453
499
  }
454
500
  });
455
501
  }
456
- }), o(u, {
502
+ }), n(v, {
457
503
  get children() {
458
- return o(q, {
504
+ return n(Y, {
459
505
  get open() {
460
506
  return e.manualPaste.open();
461
507
  },
@@ -479,7 +525,7 @@ function he(n) {
479
525
  }
480
526
  });
481
527
  }
482
- I(["click", "contextmenu"]);
528
+ K(["click", "contextmenu"]);
483
529
  export {
484
- he as NotesOverlay
530
+ De as NotesOverlay
485
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
  };