@floegence/floe-webapp-core 0.35.41 → 0.35.42

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.
@@ -80,6 +80,7 @@ export type NotesItemMetrics = Readonly<{
80
80
  width: number;
81
81
  height: number;
82
82
  preview_lines: number;
83
+ preview_limit: number;
83
84
  }>;
84
85
  export type NotesCreateTopicInput = Readonly<{
85
86
  name: string;
@@ -117,6 +118,7 @@ export interface NotesController {
117
118
  bringNoteToFront: (noteID: string) => MaybePromise<NotesItem | void>;
118
119
  deleteNote: (noteID: string) => MaybePromise<void>;
119
120
  restoreNote: (noteID: string) => MaybePromise<NotesItem>;
121
+ deleteTrashedNotePermanently?: (noteID: string) => MaybePromise<void>;
120
122
  clearTrashTopic: (topicID: string) => MaybePromise<void>;
121
123
  }
122
124
  export declare const NOTES_SCALE_MIN = 0.42;
@@ -143,6 +145,7 @@ export declare function replaceSnapshotTopic(snapshot: NotesSnapshot, topic: Not
143
145
  export declare function replaceSnapshotItem(snapshot: NotesSnapshot, item: NotesItem): NotesSnapshot;
144
146
  export declare function removeSnapshotItem(snapshot: NotesSnapshot, noteID: string): NotesSnapshot;
145
147
  export declare function replaceSnapshotTrashItem(snapshot: NotesSnapshot, trashItem: NotesTrashItem): NotesSnapshot;
148
+ export declare function removeSnapshotTrashItem(snapshot: NotesSnapshot, noteID: string): NotesSnapshot;
146
149
  export declare function removeSnapshotTopic(snapshot: NotesSnapshot, topicID: string): NotesSnapshot;
147
150
  export declare function applyNotesEvent(snapshot: NotesSnapshot, event: NotesEvent): NotesSnapshot;
148
151
  export {};
@@ -1,9 +1,9 @@
1
- const A = 0.42, X = 2.1, C = ["graphite", "sage", "amber", "azure", "coral", "rose"], z = ["fox", "crane", "otter", "lynx", "whale", "hare"], B = ["ember", "sea", "moss", "ink", "gold", "berry"], I = Object.freeze({
2
- 1: { width: 184, height: 126, preview_lines: 4 },
3
- 2: { width: 202, height: 142, preview_lines: 5 },
4
- 3: { width: 220, height: 160, preview_lines: 6 },
5
- 4: { width: 238, height: 180, preview_lines: 7 },
6
- 5: { width: 256, height: 198, preview_lines: 8 }
1
+ const X = 0.42, w = 2.1, B = ["graphite", "sage", "amber", "azure", "coral", "rose"], C = ["fox", "crane", "otter", "lynx", "whale", "hare"], k = ["ember", "sea", "moss", "ink", "gold", "berry"], I = Object.freeze({
2
+ 1: { width: 196, height: 134, preview_lines: 4, preview_limit: 68 },
3
+ 2: { width: 214, height: 148, preview_lines: 5, preview_limit: 90 },
4
+ 3: { width: 232, height: 164, preview_lines: 6, preview_limit: 112 },
5
+ 4: { width: 248, height: 182, preview_lines: 7, preview_limit: 138 },
6
+ 5: { width: 266, height: 202, preview_lines: 8, preview_limit: 164 }
7
7
  }), N = Object.freeze({
8
8
  minX: -320,
9
9
  minY: -220,
@@ -14,23 +14,23 @@ function T(t) {
14
14
  const e = Math.round(Number(t) || 1);
15
15
  return e <= 1 ? 1 : e >= 5 ? 5 : e;
16
16
  }
17
- function f(t) {
17
+ function l(t) {
18
18
  return [...t].sort((e, i) => e.sort_order !== i.sort_order ? e.sort_order - i.sort_order : e.name.localeCompare(i.name));
19
19
  }
20
- function l(t) {
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 a(t) {
23
+ function m(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 m(t, e, i) {
26
+ function a(t, e, i) {
27
27
  const r = [...t], n = r.findIndex((o) => o[e] === i[e]);
28
28
  return n >= 0 ? (r[n] = i, r) : (r.push(i), r);
29
29
  }
30
30
  function y(t) {
31
31
  return I[T(t)];
32
32
  }
33
- function k() {
33
+ function z() {
34
34
  return {
35
35
  seq: 0,
36
36
  retention_hours: 72,
@@ -43,16 +43,16 @@ function g(t) {
43
43
  return {
44
44
  seq: Number(t.seq) || 0,
45
45
  retention_hours: Number(t.retention_hours) || 72,
46
- topics: f(t.topics ?? []),
47
- items: l(t.items ?? []),
48
- trash_items: a(t.trash_items ?? [])
46
+ topics: l(t.topics ?? []),
47
+ items: f(t.items ?? []),
48
+ trash_items: m(t.trash_items ?? [])
49
49
  };
50
50
  }
51
51
  function S(t) {
52
52
  const e = Number(t);
53
53
  return Number.isFinite(e) ? Math.max(0.42, Math.min(2.1, e)) : 1;
54
54
  }
55
- function w(t, e) {
55
+ function D(t, e) {
56
56
  return {
57
57
  x: t.x + e.x * t.scale,
58
58
  y: t.y + e.y * t.scale
@@ -65,7 +65,7 @@ function _(t, e) {
65
65
  y: (e.y - t.y) / i
66
66
  };
67
67
  }
68
- function D(t, e, i) {
68
+ function L(t, e, i) {
69
69
  const r = _(t, { x: 0, y: 0 }), n = _(t, { x: e, y: i });
70
70
  return {
71
71
  minX: Math.min(r.x, n.x),
@@ -74,7 +74,7 @@ function D(t, e, i) {
74
74
  maxY: Math.max(r.y, n.y)
75
75
  };
76
76
  }
77
- function L(t, e, i, r) {
77
+ function R(t, e, i, r) {
78
78
  const n = S(e), o = _(t, { x: i, y: r });
79
79
  return {
80
80
  x: i - o.x * n,
@@ -112,9 +112,9 @@ function P(t, e) {
112
112
  maxY: Math.max(t.maxY, e.maxY)
113
113
  };
114
114
  }
115
- function R(t) {
115
+ function V(t) {
116
116
  const e = /* @__PURE__ */ new Map();
117
- for (const i of a(t)) {
117
+ for (const i of m(t)) {
118
118
  const r = e.get(i.topic_id);
119
119
  if (r) {
120
120
  r.items.push(i);
@@ -135,7 +135,7 @@ function R(t) {
135
135
  function b(t) {
136
136
  return t.items.reduce((e, i) => Math.max(e, i.z_index), 0) + 1;
137
137
  }
138
- function V(t, e) {
138
+ function j(t, e) {
139
139
  const i = t.items.find((r) => r.note_id === e);
140
140
  return i ? x(t, {
141
141
  ...i,
@@ -146,17 +146,17 @@ function V(t, e) {
146
146
  function M(t, e) {
147
147
  return {
148
148
  ...t,
149
- topics: f(m(t.topics, "topic_id", e))
149
+ topics: l(a(t.topics, "topic_id", e))
150
150
  };
151
151
  }
152
152
  function x(t, e) {
153
153
  return {
154
154
  ...t,
155
- items: l(m(t.items, "note_id", e)),
155
+ items: f(a(t.items, "note_id", e)),
156
156
  trash_items: t.trash_items.filter((i) => i.note_id !== e.note_id)
157
157
  };
158
158
  }
159
- function j(t, e) {
159
+ function K(t, e) {
160
160
  return {
161
161
  ...t,
162
162
  items: t.items.filter((i) => i.note_id !== e)
@@ -166,7 +166,13 @@ function u(t, e) {
166
166
  return {
167
167
  ...t,
168
168
  items: t.items.filter((i) => i.note_id !== e.note_id),
169
- trash_items: a(m(t.trash_items, "note_id", e))
169
+ trash_items: m(a(t.trash_items, "note_id", e))
170
+ };
171
+ }
172
+ function E(t, e) {
173
+ return {
174
+ ...t,
175
+ trash_items: t.trash_items.filter((i) => i.note_id !== e)
170
176
  };
171
177
  }
172
178
  function d(t, e) {
@@ -179,19 +185,19 @@ function d(t, e) {
179
185
  function p(t) {
180
186
  return !t || typeof t != "object" ? null : t;
181
187
  }
182
- function E(t) {
188
+ function O(t) {
183
189
  return !t || typeof t != "object" ? null : t;
184
190
  }
185
191
  function h(t) {
186
192
  return !t || typeof t != "object" ? null : t;
187
193
  }
188
- function O(t) {
194
+ function Y(t) {
189
195
  return Array.isArray(t) ? t.map(h).filter(Boolean) : [];
190
196
  }
191
- function Y(t) {
197
+ function A(t) {
192
198
  return Array.isArray(t) ? t.map((e) => String(e ?? "").trim()).filter(Boolean) : [];
193
199
  }
194
- function K(t, e) {
200
+ function W(t, e) {
195
201
  const i = e.payload ?? {};
196
202
  let r = t;
197
203
  switch (e.type) {
@@ -205,7 +211,7 @@ function K(t, e) {
205
211
  case "topic.deleted": {
206
212
  const o = p(i.topic)?.topic_id || String(e.topic_id ?? "").trim();
207
213
  o && (r = d(r, o));
208
- for (const c of O(i.trash_items))
214
+ for (const c of Y(i.trash_items))
209
215
  r = u(r, c);
210
216
  break;
211
217
  }
@@ -221,7 +227,7 @@ function K(t, e) {
221
227
  case "item.updated":
222
228
  case "item.fronted":
223
229
  case "item.restored": {
224
- const n = E(i.item);
230
+ const n = O(i.item);
225
231
  n && (r = x(r, n));
226
232
  break;
227
233
  }
@@ -231,7 +237,7 @@ function K(t, e) {
231
237
  break;
232
238
  }
233
239
  case "trash.topic_cleared": {
234
- const n = String(i.topic_id ?? e.topic_id ?? "").trim(), o = Y(i.deleted_ids), c = !!i.topic_removed;
240
+ const n = String(i.topic_id ?? e.topic_id ?? "").trim(), o = A(i.deleted_ids), c = !!i.topic_removed;
235
241
  r = {
236
242
  ...r,
237
243
  trash_items: r.trash_items.filter((s) => !(o.includes(s.note_id) || !o.length && n && s.topic_id === n))
@@ -241,6 +247,16 @@ function K(t, e) {
241
247
  });
242
248
  break;
243
249
  }
250
+ case "item.removed": {
251
+ const n = String(i.note_id ?? e.entity_id ?? "").trim();
252
+ n && (r = E(r, n));
253
+ const o = String(i.topic_id ?? e.topic_id ?? "").trim();
254
+ i.topic_removed && o && (r = {
255
+ ...r,
256
+ topics: r.topics.filter((s) => s.topic_id !== o)
257
+ });
258
+ break;
259
+ }
244
260
  }
245
261
  return {
246
262
  ...r,
@@ -248,30 +264,31 @@ function K(t, e) {
248
264
  };
249
265
  }
250
266
  export {
251
- X as NOTES_SCALE_MAX,
252
- A as NOTES_SCALE_MIN,
267
+ w as NOTES_SCALE_MAX,
268
+ X as NOTES_SCALE_MIN,
253
269
  I as NOTE_BUCKET_METRICS,
254
- C as NOTE_COLOR_TOKENS,
255
- B as TOPIC_ACCENT_TOKENS,
256
- z as TOPIC_ICON_KEYS,
257
- K as applyNotesEvent,
270
+ B as NOTE_COLOR_TOKENS,
271
+ k as TOPIC_ACCENT_TOKENS,
272
+ C as TOPIC_ICON_KEYS,
273
+ W as applyNotesEvent,
258
274
  q as centerViewportOnWorldPoint,
259
275
  S as clampScale,
260
276
  F as computeBoardBounds,
261
- k as createDefaultNotesSnapshot,
262
- R as groupTrashItems,
277
+ z as createDefaultNotesSnapshot,
278
+ V as groupTrashItems,
263
279
  P as mergeBoardBounds,
264
280
  b as nextLocalZIndex,
265
281
  g as normalizeNotesSnapshot,
266
282
  y as noteBucketMetrics,
267
- V as promoteLocalItem,
268
- j as removeSnapshotItem,
283
+ j as promoteLocalItem,
284
+ K as removeSnapshotItem,
269
285
  d as removeSnapshotTopic,
286
+ E as removeSnapshotTrashItem,
270
287
  x as replaceSnapshotItem,
271
288
  M as replaceSnapshotTopic,
272
289
  u as replaceSnapshotTrashItem,
273
290
  _ as screenToWorld,
274
- D as visibleWorldRect,
275
- w as worldToScreen,
276
- L as zoomViewportAtPoint
291
+ L as visibleWorldRect,
292
+ D as worldToScreen,
293
+ R as zoomViewportAtPoint
277
294
  };