@floegence/floe-webapp-core 0.35.52 → 0.35.53
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/NotesBoardNote.js +100 -82
- package/dist/components/notes/NotesEditorFlyout.d.ts +2 -0
- package/dist/components/notes/NotesEditorFlyout.js +60 -45
- package/dist/components/notes/NotesOverlay.js +19 -13
- package/dist/components/notes/NotesTrashFlyout.js +56 -47
- package/dist/components/notes/notesOverlayHelpers.d.ts +1 -0
- package/dist/components/notes/notesOverlayHelpers.js +26 -22
- package/dist/components/notes/types.d.ts +6 -0
- package/dist/components/notes/types.js +103 -74
- package/dist/components/notes/useNotesOverlayModel.d.ts +6 -0
- package/dist/components/notes/useNotesOverlayModel.js +276 -283
- package/dist/notes-legacy.css +248 -26
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,90 +1,99 @@
|
|
|
1
|
-
import { createComponent as r, insert as
|
|
2
|
-
import { Show as
|
|
3
|
-
import { X as
|
|
4
|
-
import { NotesAnimalIcon as
|
|
5
|
-
import { topicAccentClass as
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
return r(
|
|
1
|
+
import { createComponent as r, insert as e, className as R, effect as W, setStyleProperty as A, template as i, delegateEvents as Y } from "solid-js/web";
|
|
2
|
+
import { Show as p, For as E } from "solid-js";
|
|
3
|
+
import { X as Z } from "../icons/index.js";
|
|
4
|
+
import { NotesAnimalIcon as tt, NotesTrashCanIcon as et } from "./notesAppearance.js";
|
|
5
|
+
import { topicAccentClass as st, notePreviewMetrics as nt, normalizeNoteTitle as lt, normalizeNoteText as ot, getNotePreviewText as it, formatDeletedTimestamp as at, formatRemainingTrashTime as rt, noteColorClass as ct } from "./notesOverlayHelpers.js";
|
|
6
|
+
var _t = /* @__PURE__ */ i("<div class=notes-trash-backdrop data-floe-notes-boundary=true>"), dt = /* @__PURE__ */ i("<div class=notes-trash__sections>"), ht = /* @__PURE__ */ i('<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.'), vt = /* @__PURE__ */ i("<div class=notes-trash__empty><div><strong>Trash is empty</strong><span>Deleted notes from any topic will appear here."), $t = /* @__PURE__ */ i("<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>"), ut = /* @__PURE__ */ i("<button type=button class=is-danger>Delete now"), mt = /* @__PURE__ */ i("<article><div class=notes-note__surface><div class=notes-trash-note__meta><span></span><strong></strong></div><div class=notes-trash-note__body></div><div class=notes-trash-note__actions><button type=button>Restore"), gt = /* @__PURE__ */ i('<span class="notes-note__title-block notes-note__title-block--trash"><span class=notes-note__title>'), pt = /* @__PURE__ */ i("<span class=notes-trash-note__body-copy>");
|
|
7
|
+
function kt(n) {
|
|
8
|
+
return r(p, {
|
|
9
9
|
get when() {
|
|
10
|
-
return
|
|
10
|
+
return n.open;
|
|
11
11
|
},
|
|
12
12
|
get children() {
|
|
13
13
|
return [(() => {
|
|
14
|
-
var c =
|
|
15
|
-
return c.$$contextmenu = (
|
|
16
|
-
|
|
17
|
-
}, c.$$click = () =>
|
|
14
|
+
var c = _t();
|
|
15
|
+
return c.$$contextmenu = (a) => {
|
|
16
|
+
a.preventDefault(), a.stopPropagation(), n.onBackdropContextMenu?.(a);
|
|
17
|
+
}, c.$$click = () => n.onClose(), c;
|
|
18
18
|
})(), (() => {
|
|
19
|
-
var c =
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
},
|
|
19
|
+
var c = ht(), a = c.firstChild, F = a.firstChild, I = F.firstChild, M = I.firstChild, G = M.firstChild, K = G.nextSibling, $ = K.firstChild, X = $.firstChild, f = $.nextSibling;
|
|
20
|
+
return a.$$contextmenu = (s) => {
|
|
21
|
+
s.preventDefault(), s.stopPropagation();
|
|
22
|
+
}, a.$$pointerdown = (s) => s.stopPropagation(), e($, () => n.groups.reduce((s, l) => s + l.items.length, 0), X), f.$$click = () => n.onClose(), e(f, r(Z, {
|
|
23
23
|
class: "w-4 h-4"
|
|
24
|
-
})),
|
|
24
|
+
})), e(a, r(p, {
|
|
25
25
|
get when() {
|
|
26
|
-
return
|
|
26
|
+
return n.groups.length > 0;
|
|
27
27
|
},
|
|
28
28
|
get fallback() {
|
|
29
29
|
return (() => {
|
|
30
|
-
var
|
|
31
|
-
return
|
|
30
|
+
var s = vt(), l = s.firstChild;
|
|
31
|
+
return e(s, r(et, {
|
|
32
32
|
class: "notes-trash__empty-icon"
|
|
33
|
-
}),
|
|
33
|
+
}), l), s;
|
|
34
34
|
})();
|
|
35
35
|
},
|
|
36
36
|
get children() {
|
|
37
|
-
var
|
|
38
|
-
return
|
|
37
|
+
var s = dt();
|
|
38
|
+
return e(s, r(E, {
|
|
39
39
|
get each() {
|
|
40
|
-
return
|
|
40
|
+
return n.groups;
|
|
41
41
|
},
|
|
42
|
-
children: (
|
|
43
|
-
const
|
|
42
|
+
children: (l) => {
|
|
43
|
+
const j = st(l.topic_icon_accent);
|
|
44
44
|
return (() => {
|
|
45
|
-
var
|
|
46
|
-
return
|
|
45
|
+
var b = $t(), C = b.firstChild, y = C.firstChild, x = y.firstChild, u = x.firstChild, q = u.nextSibling, m = x.nextSibling, H = m.firstChild, J = y.nextSibling, O = C.nextSibling;
|
|
46
|
+
return R(u, `notes-topic-mark notes-topic-mark--trash ${j}`), e(u, r(tt, {
|
|
47
47
|
get iconKey() {
|
|
48
|
-
return
|
|
48
|
+
return l.topic_icon_key;
|
|
49
49
|
},
|
|
50
50
|
class: "notes-topic-mark__icon"
|
|
51
|
-
})),
|
|
51
|
+
})), e(q, () => l.topic_name), e(m, () => l.items.length, H), e(m, () => l.items.length === 1 ? "" : "s", null), J.$$click = () => n.onClearTopicTrash(l.topic_id), e(O, r(E, {
|
|
52
52
|
get each() {
|
|
53
|
-
return
|
|
53
|
+
return l.items;
|
|
54
54
|
},
|
|
55
55
|
children: (o) => {
|
|
56
|
-
const
|
|
56
|
+
const g = nt(o), _ = lt(o.title), k = ot(o.body), w = k ? it(o.body, g.preview_limit) : _ ? "" : "Empty note";
|
|
57
57
|
return (() => {
|
|
58
|
-
var
|
|
59
|
-
return
|
|
58
|
+
var d = mt(), Q = d.firstChild, T = Q.firstChild, S = T.firstChild, U = S.nextSibling, h = T.nextSibling, N = h.nextSibling, V = N.firstChild;
|
|
59
|
+
return e(S, () => at(o.deleted_at_unix_ms)), e(U, () => rt(o.deleted_at_unix_ms, n.now)), e(h, _ ? (() => {
|
|
60
|
+
var t = gt(), v = t.firstChild;
|
|
61
|
+
return e(v, _), t;
|
|
62
|
+
})() : null, null), e(h, w ? (() => {
|
|
63
|
+
var t = pt();
|
|
64
|
+
return e(t, w), t;
|
|
65
|
+
})() : null, null), V.$$click = () => n.onRestore(o.note_id), e(N, r(p, {
|
|
60
66
|
get when() {
|
|
61
|
-
return
|
|
67
|
+
return n.canDeleteNow;
|
|
62
68
|
},
|
|
63
69
|
get children() {
|
|
64
|
-
var
|
|
65
|
-
return
|
|
70
|
+
var t = ut();
|
|
71
|
+
return t.$$click = () => n.onDeleteNow(o.note_id), t;
|
|
66
72
|
}
|
|
67
|
-
}), null),
|
|
68
|
-
var
|
|
69
|
-
return
|
|
73
|
+
}), null), W((t) => {
|
|
74
|
+
var v = `notes-note notes-trash-note ${ct(o.color_token)} notes-note--size-${o.size_bucket - 1}`, D = !!_, P = `${g.width}px`, z = `${g.height}px`, B = !!_, L = !!(_ && !k);
|
|
75
|
+
return v !== t.e && R(d, t.e = v), D !== t.t && d.classList.toggle("has-title", t.t = D), P !== t.a && A(d, "--note-width", t.a = P), z !== t.o && A(d, "--note-height", t.o = z), B !== t.i && h.classList.toggle("has-title", t.i = B), L !== t.n && h.classList.toggle("is-title-only", t.n = L), t;
|
|
70
76
|
}, {
|
|
71
77
|
e: void 0,
|
|
72
78
|
t: void 0,
|
|
73
|
-
a: void 0
|
|
74
|
-
|
|
79
|
+
a: void 0,
|
|
80
|
+
o: void 0,
|
|
81
|
+
i: void 0,
|
|
82
|
+
n: void 0
|
|
83
|
+
}), d;
|
|
75
84
|
})();
|
|
76
85
|
}
|
|
77
|
-
})),
|
|
86
|
+
})), b;
|
|
78
87
|
})();
|
|
79
88
|
}
|
|
80
|
-
})),
|
|
89
|
+
})), s;
|
|
81
90
|
}
|
|
82
91
|
}), null), c;
|
|
83
92
|
})()];
|
|
84
93
|
}
|
|
85
94
|
});
|
|
86
95
|
}
|
|
87
|
-
|
|
96
|
+
Y(["click", "contextmenu", "pointerdown"]);
|
|
88
97
|
export {
|
|
89
|
-
|
|
98
|
+
kt as NotesTrashFlyout
|
|
90
99
|
};
|
|
@@ -40,6 +40,7 @@ export declare function getNormalizedOverviewPoint(clientX: number, clientY: num
|
|
|
40
40
|
y: number;
|
|
41
41
|
};
|
|
42
42
|
export declare function normalizeNoteText(text: string): string;
|
|
43
|
+
export declare function normalizeNoteTitle(title: string): string;
|
|
43
44
|
export declare function getNotePreviewText(text: string, limit: number): string;
|
|
44
45
|
export declare function formatRemainingTrashTime(deletedAtUnixMs: number, now?: number): string;
|
|
45
46
|
export declare function formatDeletedTimestamp(timestamp: number): string;
|
|
@@ -31,13 +31,16 @@ function T(e) {
|
|
|
31
31
|
return String(e ?? "").replace(/\r\n/g, `
|
|
32
32
|
`).trim();
|
|
33
33
|
}
|
|
34
|
-
function S(e
|
|
34
|
+
function S(e) {
|
|
35
|
+
return String(e ?? "").replace(/\s+/g, " ").trim();
|
|
36
|
+
}
|
|
37
|
+
function Y(e, t) {
|
|
35
38
|
const n = T(e).replace(/\n{3,}/g, `
|
|
36
39
|
|
|
37
40
|
`);
|
|
38
41
|
return n ? n.length <= t ? n : `${n.slice(0, Math.max(0, t - 1)).trimEnd()}...` : "Empty note";
|
|
39
42
|
}
|
|
40
|
-
function
|
|
43
|
+
function v(e, t = Date.now()) {
|
|
41
44
|
const n = Math.max(0, l - (t - e)), i = Math.ceil(n / (3600 * 1e3));
|
|
42
45
|
if (i >= 24) {
|
|
43
46
|
const r = Math.floor(i / 24), o = i % 24;
|
|
@@ -45,7 +48,7 @@ function Y(e, t = Date.now()) {
|
|
|
45
48
|
}
|
|
46
49
|
return `${Math.max(1, i)}h left`;
|
|
47
50
|
}
|
|
48
|
-
function
|
|
51
|
+
function C(e) {
|
|
49
52
|
return new Intl.DateTimeFormat(void 0, {
|
|
50
53
|
month: "short",
|
|
51
54
|
day: "numeric",
|
|
@@ -53,22 +56,22 @@ function v(e) {
|
|
|
53
56
|
minute: "2-digit"
|
|
54
57
|
}).format(e);
|
|
55
58
|
}
|
|
56
|
-
function
|
|
59
|
+
function g(e) {
|
|
57
60
|
return `notes-note--${w[e]}`;
|
|
58
61
|
}
|
|
59
|
-
function
|
|
62
|
+
function y(e) {
|
|
60
63
|
return `notes-topic-tone--${x[e]}`;
|
|
61
64
|
}
|
|
62
|
-
function
|
|
65
|
+
function _(e) {
|
|
63
66
|
return {
|
|
64
67
|
...e,
|
|
65
68
|
width: e.maxX - e.minX,
|
|
66
69
|
height: e.maxY - e.minY
|
|
67
70
|
};
|
|
68
71
|
}
|
|
69
|
-
function
|
|
72
|
+
function p(e, t) {
|
|
70
73
|
const n = t.maxX - t.minX, i = t.maxY - t.minY;
|
|
71
|
-
return
|
|
74
|
+
return _({
|
|
72
75
|
minX: Math.min(e.minX - n / 2, t.minX),
|
|
73
76
|
minY: Math.min(e.minY - i / 2, t.minY),
|
|
74
77
|
maxX: Math.max(e.maxX + n / 2, t.maxX),
|
|
@@ -105,24 +108,24 @@ function F(e, t) {
|
|
|
105
108
|
const n = c[e.size_bucket];
|
|
106
109
|
return {
|
|
107
110
|
id: e.note_id,
|
|
108
|
-
className:
|
|
111
|
+
className: g(e.color_token),
|
|
109
112
|
x: (e.x - t.minX) / t.width * 100,
|
|
110
113
|
y: (e.y - t.minY) / t.height * 100,
|
|
111
114
|
width: n.width / t.width * 100,
|
|
112
115
|
height: n.height / t.height * 100
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
|
-
function
|
|
118
|
+
function I(e) {
|
|
116
119
|
const t = typeof window > "u" ? e.clientX : window.innerWidth - e.menuWidth, n = typeof window > "u" ? e.clientY : window.innerHeight - e.menuHeight;
|
|
117
120
|
return {
|
|
118
121
|
left: Math.max(16, Math.min(e.clientX, t)),
|
|
119
122
|
top: Math.max(16, Math.min(e.clientY, n))
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
|
-
function
|
|
125
|
+
function W(e) {
|
|
123
126
|
return c[e.size_bucket];
|
|
124
127
|
}
|
|
125
|
-
function
|
|
128
|
+
function z(e, t) {
|
|
126
129
|
return e.reduce((n, i) => n + (i.topic_id === t ? 1 : 0), 0);
|
|
127
130
|
}
|
|
128
131
|
function H(e, t) {
|
|
@@ -137,23 +140,24 @@ export {
|
|
|
137
140
|
s as NOTES_DEFAULT_FRAME_WIDTH,
|
|
138
141
|
X as NOTES_MOBILE_BREAKPOINT_PX,
|
|
139
142
|
l as NOTES_TRASH_RETENTION_MS,
|
|
140
|
-
|
|
143
|
+
_ as buildOverviewBounds,
|
|
141
144
|
a as clamp,
|
|
142
145
|
m as clampOverviewCenter,
|
|
143
|
-
|
|
146
|
+
I as createContextMenuPosition,
|
|
144
147
|
F as createOverviewItem,
|
|
145
148
|
H as findTrashTopicNoteCount,
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
C as formatDeletedTimestamp,
|
|
150
|
+
v as formatRemainingTrashTime,
|
|
148
151
|
N as getNormalizedOverviewPoint,
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
Y as getNotePreviewText,
|
|
153
|
+
z as hasLiveNotesForTopic,
|
|
151
154
|
T as normalizeNoteText,
|
|
152
|
-
|
|
153
|
-
|
|
155
|
+
S as normalizeNoteTitle,
|
|
156
|
+
g as noteColorClass,
|
|
157
|
+
W as notePreviewMetrics,
|
|
154
158
|
A as resolveCenteredViewport,
|
|
155
159
|
M as resolveFrameSize,
|
|
156
|
-
|
|
160
|
+
p as resolveOverviewBounds,
|
|
157
161
|
P as samePoint,
|
|
158
|
-
|
|
162
|
+
y as topicAccentClass
|
|
159
163
|
};
|
|
@@ -17,6 +17,8 @@ export type NotesTopic = Readonly<{
|
|
|
17
17
|
export type NotesItem = Readonly<{
|
|
18
18
|
note_id: string;
|
|
19
19
|
topic_id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
headline?: string;
|
|
20
22
|
body: string;
|
|
21
23
|
preview_text: string;
|
|
22
24
|
character_count: number;
|
|
@@ -90,12 +92,16 @@ export type NotesUpdateTopicInput = Readonly<{
|
|
|
90
92
|
}>;
|
|
91
93
|
export type NotesCreateNoteInput = Readonly<{
|
|
92
94
|
topic_id: string;
|
|
95
|
+
headline?: string;
|
|
96
|
+
title?: string;
|
|
93
97
|
body: string;
|
|
94
98
|
color_token?: NoteColorToken;
|
|
95
99
|
x: number;
|
|
96
100
|
y: number;
|
|
97
101
|
}>;
|
|
98
102
|
export type NotesUpdateNoteInput = Readonly<{
|
|
103
|
+
headline?: string;
|
|
104
|
+
title?: string;
|
|
99
105
|
body?: string;
|
|
100
106
|
color_token?: NoteColorToken;
|
|
101
107
|
x?: number;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const
|
|
1
|
+
const B = 0.42, C = 2.1, g = ["graphite", "sage", "amber", "azure", "coral", "rose"], k = ["fox", "crane", "otter", "lynx", "whale", "hare"], D = ["ember", "sea", "moss", "ink", "gold", "berry"], T = Object.freeze({
|
|
2
2
|
1: { width: 196, height: 134, preview_lines: 4, preview_limit: 68 },
|
|
3
3
|
2: { width: 214, height: 148, preview_lines: 5, preview_limit: 90 },
|
|
4
4
|
3: { width: 232, height: 164, preview_lines: 6, preview_limit: 112 },
|
|
5
5
|
4: { width: 248, height: 182, preview_lines: 7, preview_limit: 138 },
|
|
6
6
|
5: { width: 266, height: 202, preview_lines: 8, preview_limit: 164 }
|
|
7
|
-
}),
|
|
7
|
+
}), S = Object.freeze({
|
|
8
8
|
minX: -320,
|
|
9
9
|
minY: -220,
|
|
10
10
|
maxX: 360,
|
|
11
11
|
maxY: 260
|
|
12
12
|
});
|
|
13
|
-
function
|
|
13
|
+
function b(t) {
|
|
14
14
|
const e = Math.round(Number(t) || 1);
|
|
15
15
|
return e <= 1 ? 1 : e >= 5 ? 5 : e;
|
|
16
16
|
}
|
|
@@ -20,17 +20,36 @@ function l(t) {
|
|
|
20
20
|
function f(t) {
|
|
21
21
|
return [...t].sort((e, i) => e.z_index !== i.z_index ? e.z_index - i.z_index : e.updated_at_unix_ms !== i.updated_at_unix_ms ? e.updated_at_unix_ms - i.updated_at_unix_ms : e.note_id.localeCompare(i.note_id));
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function a(t) {
|
|
24
24
|
return [...t].sort((e, i) => e.deleted_at_unix_ms !== i.deleted_at_unix_ms ? i.deleted_at_unix_ms - e.deleted_at_unix_ms : e.topic_sort_order !== i.topic_sort_order ? e.topic_sort_order - i.topic_sort_order : i.updated_at_unix_ms - e.updated_at_unix_ms);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function x(t) {
|
|
27
|
+
return typeof t.headline == "string" ? t.headline : typeof t.title == "string" ? t.title : "";
|
|
28
|
+
}
|
|
29
|
+
function h(t) {
|
|
30
|
+
const e = x(t);
|
|
31
|
+
return {
|
|
32
|
+
...t,
|
|
33
|
+
title: e,
|
|
34
|
+
headline: e
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function I(t) {
|
|
38
|
+
const e = x(t);
|
|
39
|
+
return {
|
|
40
|
+
...t,
|
|
41
|
+
title: e,
|
|
42
|
+
headline: e
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function m(t, e, i) {
|
|
27
46
|
const r = [...t], n = r.findIndex((o) => o[e] === i[e]);
|
|
28
47
|
return n >= 0 ? (r[n] = i, r) : (r.push(i), r);
|
|
29
48
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
49
|
+
function M(t) {
|
|
50
|
+
return T[b(t)];
|
|
32
51
|
}
|
|
33
|
-
function
|
|
52
|
+
function L() {
|
|
34
53
|
return {
|
|
35
54
|
seq: 0,
|
|
36
55
|
retention_hours: 72,
|
|
@@ -39,20 +58,20 @@ function z() {
|
|
|
39
58
|
trash_items: []
|
|
40
59
|
};
|
|
41
60
|
}
|
|
42
|
-
function
|
|
61
|
+
function R(t) {
|
|
43
62
|
return {
|
|
44
63
|
seq: Number(t.seq) || 0,
|
|
45
64
|
retention_hours: Number(t.retention_hours) || 72,
|
|
46
65
|
topics: l(t.topics ?? []),
|
|
47
|
-
items: f(t.items ?? []),
|
|
48
|
-
trash_items:
|
|
66
|
+
items: f((t.items ?? []).map(h)),
|
|
67
|
+
trash_items: a((t.trash_items ?? []).map(I))
|
|
49
68
|
};
|
|
50
69
|
}
|
|
51
|
-
function
|
|
70
|
+
function E(t) {
|
|
52
71
|
const e = Number(t);
|
|
53
72
|
return Number.isFinite(e) ? Math.max(0.42, Math.min(2.1, e)) : 1;
|
|
54
73
|
}
|
|
55
|
-
function
|
|
74
|
+
function V(t, e) {
|
|
56
75
|
return {
|
|
57
76
|
x: t.x + e.x * t.scale,
|
|
58
77
|
y: t.y + e.y * t.scale
|
|
@@ -65,7 +84,7 @@ function _(t, e) {
|
|
|
65
84
|
y: (e.y - t.y) / i
|
|
66
85
|
};
|
|
67
86
|
}
|
|
68
|
-
function
|
|
87
|
+
function q(t, e, i) {
|
|
69
88
|
const r = _(t, { x: 0, y: 0 }), n = _(t, { x: e, y: i });
|
|
70
89
|
return {
|
|
71
90
|
minX: Math.min(r.x, n.x),
|
|
@@ -74,27 +93,27 @@ function L(t, e, i) {
|
|
|
74
93
|
maxY: Math.max(r.y, n.y)
|
|
75
94
|
};
|
|
76
95
|
}
|
|
77
|
-
function
|
|
78
|
-
const n =
|
|
96
|
+
function F(t, e, i, r) {
|
|
97
|
+
const n = E(e), o = _(t, { x: i, y: r });
|
|
79
98
|
return {
|
|
80
99
|
x: i - o.x * n,
|
|
81
100
|
y: r - o.y * n,
|
|
82
101
|
scale: n
|
|
83
102
|
};
|
|
84
103
|
}
|
|
85
|
-
function
|
|
104
|
+
function P(t, e, i, r, n) {
|
|
86
105
|
return {
|
|
87
106
|
x: r / 2 - e * t.scale,
|
|
88
107
|
y: n / 2 - i * t.scale,
|
|
89
108
|
scale: t.scale
|
|
90
109
|
};
|
|
91
110
|
}
|
|
92
|
-
function
|
|
111
|
+
function j(t) {
|
|
93
112
|
if (t.length === 0)
|
|
94
|
-
return
|
|
113
|
+
return S;
|
|
95
114
|
let e = Number.POSITIVE_INFINITY, i = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY, n = Number.NEGATIVE_INFINITY;
|
|
96
115
|
for (const o of t) {
|
|
97
|
-
const c =
|
|
116
|
+
const c = M(o.size_bucket);
|
|
98
117
|
e = Math.min(e, o.x), i = Math.min(i, o.y), r = Math.max(r, o.x + c.width), n = Math.max(n, o.y + c.height);
|
|
99
118
|
}
|
|
100
119
|
return {
|
|
@@ -104,7 +123,7 @@ function F(t) {
|
|
|
104
123
|
maxY: n + 120
|
|
105
124
|
};
|
|
106
125
|
}
|
|
107
|
-
function
|
|
126
|
+
function K(t, e) {
|
|
108
127
|
return {
|
|
109
128
|
minX: Math.min(t.minX, e.minX),
|
|
110
129
|
minY: Math.min(t.minY, e.minY),
|
|
@@ -112,9 +131,9 @@ function P(t, e) {
|
|
|
112
131
|
maxY: Math.max(t.maxY, e.maxY)
|
|
113
132
|
};
|
|
114
133
|
}
|
|
115
|
-
function
|
|
134
|
+
function W(t) {
|
|
116
135
|
const e = /* @__PURE__ */ new Map();
|
|
117
|
-
for (const i of
|
|
136
|
+
for (const i of a(t)) {
|
|
118
137
|
const r = e.get(i.topic_id);
|
|
119
138
|
if (r) {
|
|
120
139
|
r.items.push(i);
|
|
@@ -132,31 +151,31 @@ function V(t) {
|
|
|
132
151
|
}
|
|
133
152
|
return [...e.values()].sort((i, r) => i.latest_deleted_at_unix_ms !== r.latest_deleted_at_unix_ms ? r.latest_deleted_at_unix_ms - i.latest_deleted_at_unix_ms : i.topic_sort_order - r.topic_sort_order);
|
|
134
153
|
}
|
|
135
|
-
function
|
|
154
|
+
function O(t) {
|
|
136
155
|
return t.items.reduce((e, i) => Math.max(e, i.z_index), 0) + 1;
|
|
137
156
|
}
|
|
138
|
-
function
|
|
157
|
+
function U(t, e) {
|
|
139
158
|
const i = t.items.find((r) => r.note_id === e);
|
|
140
|
-
return i ?
|
|
159
|
+
return i ? N(t, {
|
|
141
160
|
...i,
|
|
142
|
-
z_index:
|
|
161
|
+
z_index: O(t),
|
|
143
162
|
updated_at_unix_ms: Date.now()
|
|
144
163
|
}) : t;
|
|
145
164
|
}
|
|
146
|
-
function
|
|
165
|
+
function Y(t, e) {
|
|
147
166
|
return {
|
|
148
167
|
...t,
|
|
149
|
-
topics: l(
|
|
168
|
+
topics: l(m(t.topics, "topic_id", e))
|
|
150
169
|
};
|
|
151
170
|
}
|
|
152
|
-
function
|
|
171
|
+
function N(t, e) {
|
|
153
172
|
return {
|
|
154
173
|
...t,
|
|
155
|
-
items: f(
|
|
174
|
+
items: f(m(t.items, "note_id", h(e))),
|
|
156
175
|
trash_items: t.trash_items.filter((i) => i.note_id !== e.note_id)
|
|
157
176
|
};
|
|
158
177
|
}
|
|
159
|
-
function
|
|
178
|
+
function G(t, e) {
|
|
160
179
|
return {
|
|
161
180
|
...t,
|
|
162
181
|
items: t.items.filter((i) => i.note_id !== e)
|
|
@@ -166,10 +185,12 @@ function u(t, e) {
|
|
|
166
185
|
return {
|
|
167
186
|
...t,
|
|
168
187
|
items: t.items.filter((i) => i.note_id !== e.note_id),
|
|
169
|
-
trash_items:
|
|
188
|
+
trash_items: a(
|
|
189
|
+
m(t.trash_items, "note_id", I(e))
|
|
190
|
+
)
|
|
170
191
|
};
|
|
171
192
|
}
|
|
172
|
-
function
|
|
193
|
+
function A(t, e) {
|
|
173
194
|
return {
|
|
174
195
|
...t,
|
|
175
196
|
trash_items: t.trash_items.filter((i) => i.note_id !== e)
|
|
@@ -185,19 +206,19 @@ function d(t, e) {
|
|
|
185
206
|
function p(t) {
|
|
186
207
|
return !t || typeof t != "object" ? null : t;
|
|
187
208
|
}
|
|
188
|
-
function
|
|
209
|
+
function z(t) {
|
|
189
210
|
return !t || typeof t != "object" ? null : t;
|
|
190
211
|
}
|
|
191
|
-
function
|
|
212
|
+
function y(t) {
|
|
192
213
|
return !t || typeof t != "object" ? null : t;
|
|
193
214
|
}
|
|
194
|
-
function
|
|
195
|
-
return Array.isArray(t) ? t.map(
|
|
215
|
+
function X(t) {
|
|
216
|
+
return Array.isArray(t) ? t.map(y).filter(Boolean) : [];
|
|
196
217
|
}
|
|
197
|
-
function
|
|
218
|
+
function w(t) {
|
|
198
219
|
return Array.isArray(t) ? t.map((e) => String(e ?? "").trim()).filter(Boolean) : [];
|
|
199
220
|
}
|
|
200
|
-
function
|
|
221
|
+
function H(t, e) {
|
|
201
222
|
const i = e.payload ?? {};
|
|
202
223
|
let r = t;
|
|
203
224
|
switch (e.type) {
|
|
@@ -205,18 +226,20 @@ function W(t, e) {
|
|
|
205
226
|
case "topic.updated":
|
|
206
227
|
case "topic.restored": {
|
|
207
228
|
const n = p(i.topic);
|
|
208
|
-
n && (r =
|
|
229
|
+
n && (r = Y(r, n));
|
|
209
230
|
break;
|
|
210
231
|
}
|
|
211
232
|
case "topic.deleted": {
|
|
212
233
|
const o = p(i.topic)?.topic_id || String(e.topic_id ?? "").trim();
|
|
213
234
|
o && (r = d(r, o));
|
|
214
|
-
for (const c of
|
|
235
|
+
for (const c of X(i.trash_items))
|
|
215
236
|
r = u(r, c);
|
|
216
237
|
break;
|
|
217
238
|
}
|
|
218
239
|
case "topic.removed": {
|
|
219
|
-
const n = String(
|
|
240
|
+
const n = String(
|
|
241
|
+
i.topic_id ?? e.topic_id ?? ""
|
|
242
|
+
).trim();
|
|
220
243
|
n && (r = d(r, n), r = {
|
|
221
244
|
...r,
|
|
222
245
|
trash_items: r.trash_items.filter((o) => o.topic_id !== n)
|
|
@@ -227,17 +250,19 @@ function W(t, e) {
|
|
|
227
250
|
case "item.updated":
|
|
228
251
|
case "item.fronted":
|
|
229
252
|
case "item.restored": {
|
|
230
|
-
const n =
|
|
231
|
-
n && (r =
|
|
253
|
+
const n = z(i.item);
|
|
254
|
+
n && (r = N(r, n));
|
|
232
255
|
break;
|
|
233
256
|
}
|
|
234
257
|
case "item.deleted": {
|
|
235
|
-
const n =
|
|
258
|
+
const n = y(i.trash_item);
|
|
236
259
|
n && (r = u(r, n));
|
|
237
260
|
break;
|
|
238
261
|
}
|
|
239
262
|
case "trash.topic_cleared": {
|
|
240
|
-
const n = String(
|
|
263
|
+
const n = String(
|
|
264
|
+
i.topic_id ?? e.topic_id ?? ""
|
|
265
|
+
).trim(), o = w(i.deleted_ids), c = !!i.topic_removed;
|
|
241
266
|
r = {
|
|
242
267
|
...r,
|
|
243
268
|
trash_items: r.trash_items.filter((s) => !(o.includes(s.note_id) || !o.length && n && s.topic_id === n))
|
|
@@ -248,9 +273,13 @@ function W(t, e) {
|
|
|
248
273
|
break;
|
|
249
274
|
}
|
|
250
275
|
case "item.removed": {
|
|
251
|
-
const n = String(
|
|
252
|
-
|
|
253
|
-
|
|
276
|
+
const n = String(
|
|
277
|
+
i.note_id ?? e.entity_id ?? ""
|
|
278
|
+
).trim();
|
|
279
|
+
n && (r = A(r, n));
|
|
280
|
+
const o = String(
|
|
281
|
+
i.topic_id ?? e.topic_id ?? ""
|
|
282
|
+
).trim();
|
|
254
283
|
i.topic_removed && o && (r = {
|
|
255
284
|
...r,
|
|
256
285
|
topics: r.topics.filter((s) => s.topic_id !== o)
|
|
@@ -264,31 +293,31 @@ function W(t, e) {
|
|
|
264
293
|
};
|
|
265
294
|
}
|
|
266
295
|
export {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
296
|
+
C as NOTES_SCALE_MAX,
|
|
297
|
+
B as NOTES_SCALE_MIN,
|
|
298
|
+
T as NOTE_BUCKET_METRICS,
|
|
299
|
+
g as NOTE_COLOR_TOKENS,
|
|
300
|
+
D as TOPIC_ACCENT_TOKENS,
|
|
301
|
+
k as TOPIC_ICON_KEYS,
|
|
302
|
+
H as applyNotesEvent,
|
|
303
|
+
P as centerViewportOnWorldPoint,
|
|
304
|
+
E as clampScale,
|
|
305
|
+
j as computeBoardBounds,
|
|
306
|
+
L as createDefaultNotesSnapshot,
|
|
307
|
+
W as groupTrashItems,
|
|
308
|
+
K as mergeBoardBounds,
|
|
309
|
+
O as nextLocalZIndex,
|
|
310
|
+
R as normalizeNotesSnapshot,
|
|
311
|
+
M as noteBucketMetrics,
|
|
312
|
+
U as promoteLocalItem,
|
|
313
|
+
G as removeSnapshotItem,
|
|
285
314
|
d as removeSnapshotTopic,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
315
|
+
A as removeSnapshotTrashItem,
|
|
316
|
+
N as replaceSnapshotItem,
|
|
317
|
+
Y as replaceSnapshotTopic,
|
|
289
318
|
u as replaceSnapshotTrashItem,
|
|
290
319
|
_ as screenToWorld,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
320
|
+
q as visibleWorldRect,
|
|
321
|
+
V as worldToScreen,
|
|
322
|
+
F as zoomViewportAtPoint
|
|
294
323
|
};
|