@floegence/floe-webapp-core 0.36.42 → 0.36.43

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.
Files changed (31) hide show
  1. package/dist/components/icons/index.d.ts +2 -0
  2. package/dist/components/icons/index.js +419 -397
  3. package/dist/components/workbench/WorkbenchCanvas.d.ts +45 -2
  4. package/dist/components/workbench/WorkbenchCanvas.js +265 -66
  5. package/dist/components/workbench/WorkbenchCanvasField.d.ts +47 -2
  6. package/dist/components/workbench/WorkbenchCanvasField.js +258 -78
  7. package/dist/components/workbench/WorkbenchFilterBar.d.ts +9 -7
  8. package/dist/components/workbench/WorkbenchFilterBar.js +233 -145
  9. package/dist/components/workbench/WorkbenchLayerObjects.d.ts +136 -0
  10. package/dist/components/workbench/WorkbenchLayerObjects.js +986 -0
  11. package/dist/components/workbench/WorkbenchOverlay.d.ts +4 -1
  12. package/dist/components/workbench/WorkbenchOverlay.js +59 -29
  13. package/dist/components/workbench/WorkbenchSurface.d.ts +23 -11
  14. package/dist/components/workbench/WorkbenchSurface.js +315 -195
  15. package/dist/components/workbench/WorkbenchWidget.js +37 -37
  16. package/dist/components/workbench/index.d.ts +2 -1
  17. package/dist/components/workbench/types.d.ts +96 -1
  18. package/dist/components/workbench/types.js +12 -4
  19. package/dist/components/workbench/useWorkbenchModel.d.ts +62 -4
  20. package/dist/components/workbench/useWorkbenchModel.js +790 -253
  21. package/dist/components/workbench/widgets/widgetRegistry.d.ts +1 -1
  22. package/dist/components/workbench/workbenchHelpers.d.ts +5 -5
  23. package/dist/components/workbench/workbenchHelpers.js +345 -154
  24. package/dist/components/workbench/workbenchOptions.d.ts +43 -0
  25. package/dist/components/workbench/workbenchOptions.js +112 -0
  26. package/dist/full.js +620 -618
  27. package/dist/icons.js +71 -69
  28. package/dist/styles.css +1 -1
  29. package/dist/workbench.css +1117 -26
  30. package/dist/workbench.js +52 -36
  31. package/package.json +1 -1
@@ -1,359 +1,896 @@
1
- import { createSignal as A, createMemo as r, onCleanup as Ct } from "solid-js";
2
- import { ArrowUp as bt, Copy as kt, Trash as Ft } from "../icons/index.js";
3
- import { getTopZIndex as It, createContextMenuPosition as Mt, createWorkbenchId as vt, createWorkbenchViewportCenteredOnWidget as K, findNearestWidget as Xt, WORKBENCH_CONTEXT_MENU_WIDTH_PX as Yt, estimateContextMenuHeight as yt, clampScale as Ot, WORKBENCH_CANVAS_ZOOM_STEP as L, WORKBENCH_MIN_SCALE as _t, createWorkbenchViewportFitForWidget as zt } from "./workbenchHelpers.js";
4
- import { resolveWorkbenchWidgetDefinitions as Tt, getWidgetEntry as j, createWorkbenchFilterState as Vt } from "./widgets/widgetRegistry.js";
5
- function Kt(c) {
6
- const [x, S] = A(null), [U, N] = A(null), [D, G] = A({ width: 0, height: 0 });
7
- let d = null, p = null;
8
- const l = c.state, m = r(() => l().widgets), h = r(() => l().viewport), J = r(() => l().locked), H = r(() => l().filters), F = r(() => l().selectedWidgetId), Q = r(() => l().theme), I = r(() => It(m())), tt = r(() => `${Math.round(h().scale * 100)}%`), et = () => typeof c.widgetDefinitions == "function" ? c.widgetDefinitions() : c.widgetDefinitions, w = r(
9
- () => Tt(et())
10
- ), M = (t, e) => {
11
- const n = Number.isFinite(t) && t > 0 ? t : 0, i = Number.isFinite(e) && e > 0 ? e : 0, o = { width: n, height: i }, s = D();
12
- return s.width === n && s.height === i ? s : (G(o), o);
13
- }, R = () => {
14
- p?.disconnect(), p = null;
15
- }, a = () => d ? M(d.clientWidth, d.clientHeight) : M(0, 0), nt = (t) => {
16
- if (d === (t ?? null)) {
17
- a();
1
+ import { createSignal as tt, createMemo as u, onCleanup as we } from "solid-js";
2
+ import { ArrowUp as ht, Copy as j, Trash as L, MessageSquare as xt, Region as bt, TextTool as me } from "../icons/index.js";
3
+ import { WORKBENCH_STICKY_FILTER_ID as he } from "./types.js";
4
+ import { WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as xe, WORKBENCH_DEFAULT_TEXT_COLOR as be, WORKBENCH_DEFAULT_TEXT_FONT as St, WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as Se, WORKBENCH_DEFAULT_REGION_FILL as We, WORKBENCH_STICKY_NOTE_COLORS as Oe, WORKBENCH_BACKGROUND_MATERIALS as Te } from "./workbenchOptions.js";
5
+ import { createContextMenuPosition as Ce, createWorkbenchId as x, createWorkbenchViewportCenteredOnWidget as Wt, findNearestWidget as Ne, sanitizeFilters as Ae, WORKBENCH_CONTEXT_MENU_WIDTH_PX as Ie, estimateContextMenuHeight as De, clampScale as je, WORKBENCH_CANVAS_ZOOM_STEP as Ot, WORKBENCH_MIN_SCALE as Le, createWorkbenchViewportFitForWidget as ze } from "./workbenchHelpers.js";
6
+ import { resolveWorkbenchWidgetDefinitions as Fe, getWidgetEntry as Tt } from "./widgets/widgetRegistry.js";
7
+ function At(o, c) {
8
+ const r = o.findIndex((l) => l === c);
9
+ return o[(r + 1) % o.length] ?? o[0];
10
+ }
11
+ function Ct(o, c) {
12
+ return Number.isFinite(o) && o > 0 ? o : c;
13
+ }
14
+ function Me(o) {
15
+ return At(Oe, o);
16
+ }
17
+ function Re(o) {
18
+ return At(Te, o);
19
+ }
20
+ function Nt(o) {
21
+ return !("kind" in o);
22
+ }
23
+ function Be(o, c) {
24
+ return o.z_index !== c.z_index ? o.z_index - c.z_index : o.created_at_unix_ms !== c.created_at_unix_ms ? o.created_at_unix_ms - c.created_at_unix_ms : o.id.localeCompare(c.id);
25
+ }
26
+ function et(o) {
27
+ return o.reduce((c, r) => Math.max(c, r.z_index), 1);
28
+ }
29
+ function Xe(o, c) {
30
+ return et([...o, ...c]);
31
+ }
32
+ function Ee(o) {
33
+ return {
34
+ id: o.id,
35
+ type: "sticky_note",
36
+ title: "Sticky note",
37
+ x: o.x,
38
+ y: o.y,
39
+ width: o.width,
40
+ height: o.height,
41
+ z_index: o.z_index,
42
+ created_at_unix_ms: o.created_at_unix_ms
43
+ };
44
+ }
45
+ function Ye(o, c, r) {
46
+ const l = Date.now();
47
+ return {
48
+ id: x(),
49
+ kind: "sticky_note",
50
+ body: "Capture the thought, decision, or next step here.",
51
+ color: xe,
52
+ x: o - 130,
53
+ y: c - 92,
54
+ width: 260,
55
+ height: 184,
56
+ z_index: r,
57
+ created_at_unix_ms: l,
58
+ updated_at_unix_ms: l
59
+ };
60
+ }
61
+ function pe(o, c, r, l) {
62
+ const y = Date.now(), b = Ct(l?.width, 360), T = Ct(l?.height, 96);
63
+ return {
64
+ id: x(),
65
+ kind: "text",
66
+ text: "Label this area",
67
+ font_family: l?.font_family ?? St.fontFamily,
68
+ font_size: l?.font_size ?? 30,
69
+ font_weight: l?.font_weight ?? St.fontWeight,
70
+ color: l?.color ?? be,
71
+ align: l?.align ?? "left",
72
+ x: o - b / 2,
73
+ y: c - T / 2,
74
+ width: b,
75
+ height: T,
76
+ z_index: r,
77
+ created_at_unix_ms: y,
78
+ updated_at_unix_ms: y
79
+ };
80
+ }
81
+ function He(o) {
82
+ const c = Date.now();
83
+ return {
84
+ ...o,
85
+ id: x(),
86
+ x: o.x + 28,
87
+ y: o.y + 28,
88
+ z_index: o.z_index + 1,
89
+ created_at_unix_ms: c,
90
+ updated_at_unix_ms: c
91
+ };
92
+ }
93
+ function Ke(o, c, r) {
94
+ const l = Date.now();
95
+ return {
96
+ id: x(),
97
+ name: "Focus area",
98
+ fill: We,
99
+ opacity: 0.72,
100
+ material: Se,
101
+ x: o - 280,
102
+ y: c - 180,
103
+ width: 560,
104
+ height: 360,
105
+ z_index: r,
106
+ created_at_unix_ms: l,
107
+ updated_at_unix_ms: l
108
+ };
109
+ }
110
+ function Ve(o) {
111
+ const c = Date.now();
112
+ return {
113
+ ...o,
114
+ id: x(),
115
+ name: o.name,
116
+ x: o.x + 36,
117
+ y: o.y + 36,
118
+ z_index: o.z_index + 1,
119
+ created_at_unix_ms: c,
120
+ updated_at_unix_ms: c
121
+ };
122
+ }
123
+ function dn(o) {
124
+ const [c, r] = tt(null), [l, y] = tt(null), [b, T] = tt({ width: 0, height: 0 });
125
+ let f = null, C = null;
126
+ const a = o.state, w = u(() => a().widgets), z = u(() => a().stickyNotes ?? []), nt = u(() => a().annotations ?? []), it = u(() => a().backgroundLayers ?? []), m = u(() => a().viewport), It = u(() => a().locked), F = u(() => a().filters), Dt = u(() => a().selectedWidgetId), M = u(() => a().selectedObject ?? (a().selectedWidgetId ? { kind: "widget", id: a().selectedWidgetId } : null)), R = u(() => a().mode ?? "work"), ot = u(() => a().activeTool ?? "select"), jt = u(() => a().theme), S = u(() => Xe(w(), z())), Lt = u(() => `${Math.round(m().scale * 100)}%`), zt = () => typeof o.widgetDefinitions == "function" ? o.widgetDefinitions() : o.widgetDefinitions, Ft = () => typeof o.textAnnotationDefaults == "function" ? o.textAnnotationDefaults() : o.textAnnotationDefaults, W = u(
127
+ () => Fe(zt())
128
+ ), B = (e, t) => {
129
+ const n = Number.isFinite(e) && e > 0 ? e : 0, i = Number.isFinite(t) && t > 0 ? t : 0, d = { width: n, height: i }, k = b();
130
+ return k.width === n && k.height === i ? k : (T(d), d);
131
+ }, dt = () => {
132
+ C?.disconnect(), C = null;
133
+ }, _ = () => f ? B(f.clientWidth, f.clientHeight) : B(0, 0), Mt = (e) => {
134
+ if (f === (e ?? null)) {
135
+ _();
18
136
  return;
19
137
  }
20
- R(), d = t ?? null, a(), !(!d || typeof ResizeObserver > "u") && (p = new ResizeObserver((e) => {
21
- const n = e[0];
22
- M(
23
- n?.contentRect.width ?? d?.clientWidth ?? 0,
24
- n?.contentRect.height ?? d?.clientHeight ?? 0
138
+ dt(), f = e ?? null, _(), !(!f || typeof ResizeObserver > "u") && (C = new ResizeObserver((t) => {
139
+ const n = t[0];
140
+ B(
141
+ n?.contentRect.width ?? f?.clientWidth ?? 0,
142
+ n?.contentRect.height ?? f?.clientHeight ?? 0
25
143
  );
26
- }), p.observe(d));
144
+ }), C.observe(f));
27
145
  };
28
- Ct(() => {
29
- R(), d = null;
146
+ we(() => {
147
+ dt(), f = null;
30
148
  });
31
- const it = (t) => {
32
- S({
33
- clientX: t.clientX,
34
- clientY: t.clientY,
35
- worldX: t.worldX,
36
- worldY: t.worldY
149
+ const Rt = (e) => {
150
+ r({
151
+ clientX: e.clientX,
152
+ clientY: e.clientY,
153
+ worldX: e.worldX,
154
+ worldY: e.worldY,
155
+ target: { kind: "canvas", mode: R() }
37
156
  });
38
- }, ot = (t, e) => {
39
- f(e.id), S({
40
- clientX: t.clientX,
41
- clientY: t.clientY,
42
- worldX: e.x,
43
- worldY: e.y,
44
- widgetId: e.id
157
+ }, Bt = (e, t) => {
158
+ h(t.id), r({
159
+ clientX: e.clientX,
160
+ clientY: e.clientY,
161
+ worldX: t.x,
162
+ worldY: t.y,
163
+ target: { kind: "widget", id: t.id },
164
+ widgetId: t.id
45
165
  });
46
- }, g = () => S(null), ct = (t) => l().widgets.find((e) => e.id === t) ?? null, C = (t) => l().widgets.find((e) => e.type === t) ?? null, st = (t, e) => {
47
- const n = t.singleton ? C(t.type) : null;
166
+ }, Xt = (e, t) => {
167
+ A(t.id), r({
168
+ clientX: e.clientX,
169
+ clientY: e.clientY,
170
+ worldX: t.x,
171
+ worldY: t.y,
172
+ target: { kind: "sticky_note", id: t.id },
173
+ widgetId: t.id
174
+ });
175
+ }, Et = (e, t) => {
176
+ r({
177
+ clientX: e.clientX,
178
+ clientY: e.clientY,
179
+ worldX: t.x,
180
+ worldY: t.y,
181
+ target: { kind: "annotation", id: t.id }
182
+ });
183
+ }, Yt = (e, t) => {
184
+ r({
185
+ clientX: e.clientX,
186
+ clientY: e.clientY,
187
+ worldX: t.x,
188
+ worldY: t.y,
189
+ target: { kind: "background_layer", id: t.id }
190
+ });
191
+ }, s = () => r(null), pt = (e) => a().widgets.find((t) => t.id === e) ?? null, N = (e) => a().widgets.find((t) => t.type === e) ?? null, X = (e) => a().stickyNotes?.find((t) => t.id === e) ?? null, ct = (e) => a().annotations?.find((t) => t.id === e) ?? null, at = (e) => a().backgroundLayers?.find((t) => t.id === e) ?? null, Ht = (e) => e.target ? e.target : e.widgetId ? X(e.widgetId) ? { kind: "sticky_note", id: e.widgetId } : { kind: "widget", id: e.widgetId } : { kind: "canvas", mode: R() }, Kt = (e, t) => {
192
+ const n = e.singleton ? N(e.type) : null;
48
193
  return n ? {
49
- id: `goto-${t.type}`,
194
+ id: `goto-${e.type}`,
50
195
  kind: "action",
51
196
  verb: "go_to",
52
- widgetType: t.type,
53
- label: `Go to ${t.label}`,
54
- icon: t.icon,
197
+ widgetType: e.type,
198
+ label: `Go to ${e.label}`,
199
+ icon: e.icon,
55
200
  existingWidgetId: n.id,
56
201
  onSelect: () => {
57
- W(n, { centerViewport: !0 }), g();
202
+ O(n, { centerViewport: !0 }), s();
58
203
  }
59
204
  } : {
60
- id: `add-${t.type}`,
205
+ id: `add-${e.type}`,
61
206
  kind: "action",
62
207
  verb: "add",
63
- widgetType: t.type,
64
- label: `Add ${t.label}`,
65
- icon: t.icon,
208
+ widgetType: e.type,
209
+ label: `Add ${e.label}`,
210
+ icon: e.icon,
66
211
  onSelect: () => {
67
- X(t.type, e.worldX, e.worldY), g();
212
+ Y(e.type, t.worldX, t.worldY), s();
68
213
  }
69
214
  };
70
- }, E = r(() => {
71
- const t = x();
72
- if (!t) return [];
73
- if (t.widgetId) {
74
- const e = m().find((i) => i.id === t.widgetId), n = [];
75
- return e && (n.push({
215
+ }, st = u(() => {
216
+ const e = c();
217
+ if (!e) return [];
218
+ const t = Ht(e);
219
+ if (t.kind === "widget") {
220
+ const n = w().find((d) => d.id === t.id), i = [];
221
+ return n && (i.push({
76
222
  id: "bring-to-front",
77
223
  kind: "action",
78
224
  label: "Bring to Front",
79
- icon: bt,
225
+ icon: ht,
80
226
  onSelect: () => {
81
- f(e.id), g();
227
+ h(n.id), s();
82
228
  }
83
- }), n.push({
229
+ }), i.push({
84
230
  id: "duplicate",
85
231
  kind: "action",
86
232
  label: "Duplicate",
87
- icon: kt,
233
+ icon: j,
234
+ onSelect: () => {
235
+ rt(n.type, n.x + 32, n.y + 32), s();
236
+ }
237
+ })), i.push({ id: "separator-delete", kind: "separator" }), i.push({
238
+ id: "delete",
239
+ kind: "action",
240
+ label: "Delete",
241
+ icon: L,
242
+ destructive: !0,
88
243
  onSelect: () => {
89
- B(e.type, e.x + 32, e.y + 32), g();
244
+ p(t.id), s();
90
245
  }
91
- })), n.push({ id: "separator-delete", kind: "separator" }), n.push({
246
+ }), i;
247
+ }
248
+ if (t.kind === "sticky_note") {
249
+ const n = X(t.id), i = [];
250
+ return n && (i.push({
251
+ id: "bring-to-front",
252
+ kind: "action",
253
+ label: "Bring to Front",
254
+ icon: ht,
255
+ onSelect: () => {
256
+ A(n.id), s();
257
+ }
258
+ }), i.push({
259
+ id: "copy-content",
260
+ kind: "action",
261
+ label: "Copy Content",
262
+ icon: j,
263
+ onSelect: () => {
264
+ typeof navigator < "u" && navigator.clipboard?.writeText(n.body), s();
265
+ }
266
+ }), i.push({
267
+ id: "change-color",
268
+ kind: "action",
269
+ label: "Change Color",
270
+ icon: xt,
271
+ onSelect: () => {
272
+ gt(n.id, { color: Me(n.color) }), s();
273
+ }
274
+ })), i.push({ id: "separator-delete", kind: "separator" }), i.push({
92
275
  id: "delete",
93
276
  kind: "action",
94
277
  label: "Delete",
95
- icon: Ft,
278
+ icon: L,
279
+ destructive: !0,
280
+ onSelect: () => {
281
+ U(t.id), s();
282
+ }
283
+ }), i;
284
+ }
285
+ if (t.kind === "annotation") {
286
+ const n = ct(t.id), i = [];
287
+ return n?.kind === "text" && i.push({
288
+ id: "duplicate",
289
+ kind: "action",
290
+ label: "Duplicate Text",
291
+ icon: j,
292
+ onSelect: () => {
293
+ lt(n), s();
294
+ }
295
+ }), i.push({ id: "separator-delete", kind: "separator" }), i.push({
296
+ id: "delete",
297
+ kind: "action",
298
+ label: "Delete Text",
299
+ icon: L,
96
300
  destructive: !0,
97
301
  onSelect: () => {
98
- t.widgetId && Y(t.widgetId), g();
302
+ q(t.id), s();
99
303
  }
100
- }), n;
304
+ }), i;
101
305
  }
102
- return w().map((e) => st(e, t));
103
- }), rt = r(() => {
104
- const t = x();
105
- if (!t) return;
106
- const e = E(), n = e.filter((o) => o.kind === "action").length, i = e.filter((o) => o.kind === "separator").length;
107
- return Mt({
108
- clientX: t.clientX,
109
- clientY: t.clientY,
110
- menuWidth: Yt,
111
- menuHeight: yt(n, i)
306
+ if (t.kind === "background_layer") {
307
+ const n = at(t.id), i = [];
308
+ return n && (i.push({
309
+ id: "duplicate",
310
+ kind: "action",
311
+ label: "Duplicate Region",
312
+ icon: j,
313
+ onSelect: () => {
314
+ ut(n), s();
315
+ }
316
+ }), i.push({
317
+ id: "change-material",
318
+ kind: "action",
319
+ label: "Change Material",
320
+ icon: bt,
321
+ onSelect: () => {
322
+ kt(n.id, { material: Re(n.material) }), s();
323
+ }
324
+ })), i.push({ id: "separator-delete", kind: "separator" }), i.push({
325
+ id: "delete",
326
+ kind: "action",
327
+ label: "Delete Region",
328
+ icon: L,
329
+ destructive: !0,
330
+ onSelect: () => {
331
+ P(t.id), s();
332
+ }
333
+ }), i;
334
+ }
335
+ return t.mode === "background" ? [
336
+ {
337
+ id: "create-background-region",
338
+ kind: "action",
339
+ label: "Add Region",
340
+ icon: bt,
341
+ onSelect: () => {
342
+ V(e.worldX, e.worldY), s();
343
+ }
344
+ },
345
+ {
346
+ id: "create-text",
347
+ kind: "action",
348
+ label: "Add Text",
349
+ icon: me,
350
+ onSelect: () => {
351
+ K(e.worldX, e.worldY), s();
352
+ }
353
+ }
354
+ ] : [
355
+ {
356
+ id: "create-sticky-note",
357
+ kind: "action",
358
+ label: "Add Sticky",
359
+ icon: xt,
360
+ onSelect: () => {
361
+ H(e.worldX, e.worldY), s();
362
+ }
363
+ },
364
+ ...W().map((n) => Kt(n, e))
365
+ ];
366
+ }), Vt = u(() => {
367
+ const e = c();
368
+ if (!e) return;
369
+ const t = st(), n = t.filter((d) => d.kind === "action").length, i = t.filter((d) => d.kind === "separator").length;
370
+ return Ce({
371
+ clientX: e.clientX,
372
+ clientY: e.clientY,
373
+ menuWidth: Ie,
374
+ menuHeight: De(n, i)
112
375
  });
113
- }), v = (t, e, n) => {
114
- const i = j(t, w()), o = i.singleton ? C(t) : null;
115
- if (o)
116
- return W(o, { centerViewport: !0 });
117
- const s = i.defaultSize, u = {
118
- id: vt(),
119
- type: t,
376
+ }), E = (e, t, n) => {
377
+ const i = Tt(e, W()), d = i.singleton ? N(e) : null;
378
+ if (d)
379
+ return O(d, { centerViewport: !0 });
380
+ const k = i.defaultSize, g = {
381
+ id: x(),
382
+ type: e,
120
383
  title: i.defaultTitle,
121
- x: e,
384
+ x: t,
122
385
  y: n,
123
- width: s.width,
124
- height: s.height,
125
- z_index: I() + 1,
386
+ width: k.width,
387
+ height: k.height,
388
+ z_index: S() + 1,
126
389
  created_at_unix_ms: Date.now()
127
390
  };
128
- return c.setState((k) => ({
129
- ...k,
130
- widgets: [...k.widgets, u],
131
- selectedWidgetId: u.id
132
- })), u;
133
- }, X = (t, e, n) => {
134
- const i = j(t, w()).defaultSize;
135
- return v(t, e - i.width / 2, n - i.height / 2);
136
- }, B = (t, e, n) => v(t, e, n), Y = (t) => {
137
- c.setState((e) => ({
138
- ...e,
139
- widgets: e.widgets.filter((n) => n.id !== t),
140
- selectedWidgetId: e.selectedWidgetId === t ? null : e.selectedWidgetId
391
+ return o.setState((D) => ({
392
+ ...D,
393
+ widgets: [...D.widgets, g],
394
+ selectedWidgetId: g.id,
395
+ selectedObject: { kind: "widget", id: g.id },
396
+ mode: "work",
397
+ activeTool: "select"
398
+ })), g;
399
+ }, Y = (e, t, n) => {
400
+ const i = Tt(e, W()).defaultSize;
401
+ return E(e, t - i.width / 2, n - i.height / 2);
402
+ }, rt = (e, t, n) => E(e, t, n), p = (e) => {
403
+ o.setState((t) => ({
404
+ ...t,
405
+ widgets: t.widgets.filter((n) => n.id !== e),
406
+ selectedWidgetId: t.selectedWidgetId === e ? null : t.selectedWidgetId,
407
+ selectedObject: t.selectedObject?.kind === "widget" && t.selectedObject.id === e ? null : t.selectedObject ?? null
141
408
  }));
142
- }, dt = (t) => {
143
- N(t);
144
- }, f = (t) => {
145
- N(t);
146
- const e = I(), n = m().find((i) => i.id === t);
147
- n && n.z_index < e && c.setState((i) => ({
409
+ }, H = (e, t) => {
410
+ const n = Ye(e, t, S() + 1);
411
+ return o.setState((i) => ({
412
+ ...i,
413
+ stickyNotes: [...i.stickyNotes ?? [], n],
414
+ selectedWidgetId: null,
415
+ selectedObject: { kind: "sticky_note", id: n.id },
416
+ mode: "work",
417
+ activeTool: "select"
418
+ })), n;
419
+ }, K = (e, t) => {
420
+ const n = pe(
421
+ e,
422
+ t,
423
+ et(nt()) + 1,
424
+ Ft()
425
+ );
426
+ return o.setState((i) => ({
427
+ ...i,
428
+ annotations: [...i.annotations ?? [], n],
429
+ selectedWidgetId: null,
430
+ selectedObject: { kind: "annotation", id: n.id },
431
+ mode: "background",
432
+ activeTool: "select"
433
+ })), n;
434
+ }, lt = (e) => {
435
+ const t = He(e);
436
+ return o.setState((n) => ({
437
+ ...n,
438
+ annotations: [...n.annotations ?? [], t],
439
+ selectedWidgetId: null,
440
+ selectedObject: { kind: "annotation", id: t.id },
441
+ mode: "background",
442
+ activeTool: "select"
443
+ })), t;
444
+ }, V = (e, t) => {
445
+ const n = Ke(e, t, et(it()) + 1);
446
+ return o.setState((i) => ({
447
+ ...i,
448
+ backgroundLayers: [...i.backgroundLayers ?? [], n],
449
+ selectedWidgetId: null,
450
+ selectedObject: { kind: "background_layer", id: n.id },
451
+ mode: "background",
452
+ activeTool: "select"
453
+ })), n;
454
+ }, ut = (e) => {
455
+ const t = Ve(e);
456
+ return o.setState((n) => ({
457
+ ...n,
458
+ backgroundLayers: [...n.backgroundLayers ?? [], t],
459
+ selectedWidgetId: null,
460
+ selectedObject: { kind: "background_layer", id: t.id },
461
+ mode: "background",
462
+ activeTool: "select"
463
+ })), t;
464
+ }, Ut = (e) => {
465
+ y(e);
466
+ }, h = (e) => {
467
+ y(e);
468
+ const t = S(), n = w().find((i) => i.id === e);
469
+ n && n.z_index < t && o.setState((i) => ({
148
470
  ...i,
149
471
  widgets: i.widgets.map(
150
- (o) => o.id === t ? { ...o, z_index: e + 1 } : o
472
+ (d) => d.id === e ? { ...d, z_index: t + 1 } : d
473
+ )
474
+ }));
475
+ }, A = (e) => {
476
+ y(e);
477
+ const t = S();
478
+ o.setState((n) => ({
479
+ ...n,
480
+ stickyNotes: (n.stickyNotes ?? []).map(
481
+ (i) => i.id === e && i.z_index < t ? { ...i, z_index: t + 1, updated_at_unix_ms: Date.now() } : i
151
482
  )
152
483
  }));
153
- }, lt = (t, e) => {
154
- c.setState((n) => ({
484
+ }, qt = (e, t) => {
485
+ o.setState((n) => ({
155
486
  ...n,
156
487
  widgets: n.widgets.map(
157
- (i) => i.id === t ? { ...i, x: e.x, y: e.y } : i
488
+ (i) => i.id === e ? { ...i, x: t.x, y: t.y } : i
158
489
  )
159
490
  }));
160
- }, at = (t, e) => {
161
- c.setState((n) => ({
491
+ }, Pt = (e, t) => {
492
+ o.setState((n) => ({
162
493
  ...n,
163
494
  widgets: n.widgets.map(
164
- (i) => i.id === t ? { ...i, width: e.width, height: e.height } : i
495
+ (i) => i.id === e ? { ...i, width: t.width, height: t.height } : i
165
496
  )
166
497
  }));
167
- }, y = (t) => {
168
- c.setState((e) => ({ ...e, viewport: t }));
169
- }, q = (t) => {
170
- const e = h(), n = a(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, s = Ot(
171
- t === "in" ? e.scale * L : e.scale / L
172
- ), u = {
173
- x: n.width / 2 - i * s,
174
- y: n.height / 2 - o * s,
175
- scale: s
498
+ }, $t = (e, t) => {
499
+ o.setState((n) => ({
500
+ ...n,
501
+ stickyNotes: (n.stickyNotes ?? []).map(
502
+ (i) => i.id === e ? { ...i, x: t.x, y: t.y, updated_at_unix_ms: Date.now() } : i
503
+ )
504
+ }));
505
+ }, Gt = (e, t) => {
506
+ o.setState((n) => ({
507
+ ...n,
508
+ stickyNotes: (n.stickyNotes ?? []).map(
509
+ (i) => i.id === e ? { ...i, width: t.width, height: t.height, updated_at_unix_ms: Date.now() } : i
510
+ )
511
+ }));
512
+ }, gt = (e, t) => {
513
+ o.setState((n) => ({
514
+ ...n,
515
+ stickyNotes: (n.stickyNotes ?? []).map(
516
+ (i) => i.id === e ? {
517
+ ...i,
518
+ ...typeof t.body == "string" ? { body: t.body } : {},
519
+ ...t.color ? { color: t.color } : {},
520
+ updated_at_unix_ms: Date.now()
521
+ } : i
522
+ )
523
+ }));
524
+ }, U = (e) => {
525
+ o.setState((t) => ({
526
+ ...t,
527
+ stickyNotes: (t.stickyNotes ?? []).filter((n) => n.id !== e),
528
+ selectedObject: t.selectedObject?.kind === "sticky_note" && t.selectedObject.id === e ? null : t.selectedObject ?? null
529
+ }));
530
+ }, Zt = (e, t) => {
531
+ o.setState((n) => ({
532
+ ...n,
533
+ annotations: (n.annotations ?? []).map(
534
+ (i) => i.id === e ? { ...i, x: t.x, y: t.y, updated_at_unix_ms: Date.now() } : i
535
+ )
536
+ }));
537
+ }, vt = (e, t) => {
538
+ o.setState((n) => ({
539
+ ...n,
540
+ annotations: (n.annotations ?? []).map(
541
+ (i) => i.id === e ? { ...i, width: t.width, height: t.height, updated_at_unix_ms: Date.now() } : i
542
+ )
543
+ }));
544
+ }, Jt = (e, t) => {
545
+ o.setState((n) => ({
546
+ ...n,
547
+ annotations: (n.annotations ?? []).map(
548
+ (i) => i.id === e && i.kind === "text" ? {
549
+ ...i,
550
+ ...typeof t.text == "string" ? { text: t.text } : {},
551
+ ...typeof t.font_family == "string" ? { font_family: t.font_family } : {},
552
+ ...typeof t.font_size == "number" ? { font_size: t.font_size } : {},
553
+ ...typeof t.font_weight == "number" ? { font_weight: t.font_weight } : {},
554
+ ...typeof t.color == "string" ? { color: t.color } : {},
555
+ ...t.align ? { align: t.align } : {},
556
+ updated_at_unix_ms: Date.now()
557
+ } : i
558
+ )
559
+ }));
560
+ }, q = (e) => {
561
+ o.setState((t) => ({
562
+ ...t,
563
+ annotations: (t.annotations ?? []).filter((n) => n.id !== e),
564
+ selectedObject: t.selectedObject?.kind === "annotation" && t.selectedObject.id === e ? null : t.selectedObject ?? null
565
+ }));
566
+ }, Qt = (e, t) => {
567
+ o.setState((n) => ({
568
+ ...n,
569
+ backgroundLayers: (n.backgroundLayers ?? []).map(
570
+ (i) => i.id === e ? { ...i, x: t.x, y: t.y, updated_at_unix_ms: Date.now() } : i
571
+ )
572
+ }));
573
+ }, te = (e, t) => {
574
+ o.setState((n) => ({
575
+ ...n,
576
+ backgroundLayers: (n.backgroundLayers ?? []).map(
577
+ (i) => i.id === e ? { ...i, width: t.width, height: t.height, updated_at_unix_ms: Date.now() } : i
578
+ )
579
+ }));
580
+ }, kt = (e, t) => {
581
+ o.setState((n) => ({
582
+ ...n,
583
+ backgroundLayers: (n.backgroundLayers ?? []).map(
584
+ (i) => i.id === e ? {
585
+ ...i,
586
+ ...typeof t.fill == "string" ? { fill: t.fill } : {},
587
+ ...typeof t.opacity == "number" ? { opacity: t.opacity } : {},
588
+ ...typeof t.material == "string" ? { material: t.material } : {},
589
+ ...typeof t.name == "string" ? { name: t.name } : {},
590
+ updated_at_unix_ms: Date.now()
591
+ } : i
592
+ )
593
+ }));
594
+ }, P = (e) => {
595
+ o.setState((t) => ({
596
+ ...t,
597
+ backgroundLayers: (t.backgroundLayers ?? []).filter((n) => n.id !== e),
598
+ selectedObject: t.selectedObject?.kind === "background_layer" && t.selectedObject.id === e ? null : t.selectedObject ?? null
599
+ }));
600
+ }, $ = (e) => {
601
+ o.setState((t) => ({ ...t, viewport: e }));
602
+ }, ft = (e) => {
603
+ const t = m(), n = _(), i = (n.width / 2 - t.x) / t.scale, d = (n.height / 2 - t.y) / t.scale, k = je(
604
+ e === "in" ? t.scale * Ot : t.scale / Ot
605
+ ), g = {
606
+ x: n.width / 2 - i * k,
607
+ y: n.height / 2 - d * k,
608
+ scale: k
176
609
  };
177
- y(u);
178
- }, gt = () => {
179
- c.setState((t) => ({ ...t, locked: !t.locked }));
180
- }, ut = (t) => {
181
- c.setState((e) => ({
182
- ...e,
183
- filters: { ...e.filters, [t]: !e.filters[t] }
610
+ $(g);
611
+ }, ee = () => {
612
+ o.setState((e) => ({ ...e, locked: !e.locked }));
613
+ }, ne = (e) => {
614
+ o.setState((t) => ({
615
+ ...t,
616
+ filters: { ...t.filters, [e]: !t.filters[e] }
184
617
  }));
185
- }, ht = (t) => {
186
- c.setState((e) => {
187
- const n = { ...e.filters };
188
- for (const i of Object.keys(n))
189
- n[i] = i === t;
190
- return { ...e, filters: n };
618
+ }, ie = (e, t) => {
619
+ o.setState((n) => {
620
+ const i = { ...n.filters }, d = [...new Set(t.map((g) => String(g)).filter(Boolean))], k = d.length > 1 && d.every(
621
+ (g) => i[g] !== !1 == (g === e)
622
+ );
623
+ for (const g of d)
624
+ i[g] = k ? !0 : g === e;
625
+ return { ...n, filters: i };
191
626
  });
192
- }, ft = () => {
193
- const t = Vt(w());
194
- c.setState((e) => ({
195
- ...e,
196
- filters: t
627
+ }, oe = () => {
628
+ const e = W();
629
+ o.setState((t) => ({
630
+ ...t,
631
+ filters: Ae(void 0, e)
197
632
  }));
198
- }, b = (t) => {
199
- c.setState((e) => ({ ...e, selectedWidgetId: t }));
200
- }, P = () => {
201
- c.setState(
202
- (t) => t.selectedWidgetId === null ? t : { ...t, selectedWidgetId: null }
633
+ }, I = (e) => {
634
+ o.setState((t) => ({
635
+ ...t,
636
+ selectedWidgetId: e,
637
+ selectedObject: { kind: "widget", id: e },
638
+ mode: t.mode === "background" ? "work" : t.mode,
639
+ activeTool: "select"
640
+ }));
641
+ }, _t = () => {
642
+ o.setState(
643
+ (e) => e.selectedWidgetId === null && !e.selectedObject ? e : { ...e, selectedWidgetId: null, selectedObject: null }
203
644
  );
204
- }, mt = () => {
205
- const t = a(), e = h();
645
+ }, de = (e) => {
646
+ o.setState((t) => ({
647
+ ...t,
648
+ selectedObject: e,
649
+ selectedWidgetId: e?.kind === "widget" ? e.id : null,
650
+ activeTool: "select"
651
+ }));
652
+ }, yt = (e) => {
653
+ o.setState((t) => ({
654
+ ...t,
655
+ selectedWidgetId: null,
656
+ selectedObject: { kind: "sticky_note", id: e },
657
+ mode: "work",
658
+ activeTool: "select"
659
+ })), A(e);
660
+ }, ce = (e) => {
661
+ o.setState((t) => ({
662
+ ...t,
663
+ selectedWidgetId: null,
664
+ selectedObject: { kind: "annotation", id: e },
665
+ mode: "background",
666
+ activeTool: "select"
667
+ }));
668
+ }, ae = (e) => {
669
+ o.setState((t) => ({
670
+ ...t,
671
+ selectedWidgetId: null,
672
+ selectedObject: { kind: "background_layer", id: e },
673
+ mode: "background",
674
+ activeTool: "select"
675
+ }));
676
+ }, se = (e) => {
677
+ const t = e === "annotation" ? "background" : e;
678
+ o.setState((n) => ({
679
+ ...n,
680
+ mode: t,
681
+ activeTool: "select",
682
+ selectedWidgetId: t === "work" ? n.selectedObject?.kind === "widget" ? n.selectedObject.id : n.selectedWidgetId : null,
683
+ selectedObject: t === "work" ? n.selectedObject?.kind === "widget" || n.selectedObject?.kind === "sticky_note" ? n.selectedObject : n.selectedWidgetId ? { kind: "widget", id: n.selectedWidgetId } : null : n.selectedObject?.kind === "background_layer" || n.selectedObject?.kind === "annotation" ? n.selectedObject : null
684
+ }));
685
+ }, re = (e) => {
686
+ o.setState((t) => ({
687
+ ...t,
688
+ activeTool: e,
689
+ mode: e === "text" || e === "background-region" ? "background" : e === "sticky-note" ? "work" : t.mode ?? "work"
690
+ }));
691
+ }, le = (e, t) => {
692
+ const n = ot();
693
+ return n === "sticky-note" ? H(e, t) : n === "text" ? K(e, t) : n === "background-region" ? V(e, t) : null;
694
+ }, ue = () => {
695
+ const e = _(), t = m();
206
696
  return {
207
- worldX: t.width > 0 ? (t.width / 2 - e.x) / e.scale : 240,
208
- worldY: t.height > 0 ? (t.height / 2 - e.y) / e.scale : 180
697
+ worldX: e.width > 0 ? (e.width / 2 - t.x) / t.scale : 240,
698
+ worldY: e.height > 0 ? (e.height / 2 - t.y) / t.scale : 180
209
699
  };
210
700
  };
211
- let O = 0;
212
- const wt = () => {
213
- O += 1;
214
- }, _ = (t) => {
215
- const e = h(), n = e.x, i = e.y, o = e.scale, s = performance.now(), u = 360, k = ++O, St = (T) => 1 - Math.pow(1 - T, 3), $ = (T) => {
216
- if (k !== O) return;
217
- const pt = T - s, Z = Math.min(Math.max(pt / u, 0), 1), V = St(Z);
218
- y({
219
- x: n + (t.x - n) * V,
220
- y: i + (t.y - i) * V,
221
- scale: o + (t.scale - o) * V
222
- }), Z < 1 && requestAnimationFrame($);
701
+ let G = 0;
702
+ const ge = () => {
703
+ G += 1;
704
+ }, Z = (e) => {
705
+ const t = m(), n = t.x, i = t.y, d = t.scale, k = performance.now(), g = 360, D = ++G, _e = (J) => 1 - Math.pow(1 - J, 3), wt = (J) => {
706
+ if (D !== G) return;
707
+ const ye = J - k, mt = Math.min(Math.max(ye / g, 0), 1), Q = _e(mt);
708
+ $({
709
+ x: n + (e.x - n) * Q,
710
+ y: i + (e.y - i) * Q,
711
+ scale: d + (e.scale - d) * Q
712
+ }), mt < 1 && requestAnimationFrame(wt);
223
713
  };
224
- requestAnimationFrame($);
225
- }, z = (t) => {
226
- const e = a();
227
- e.width === 0 || e.height === 0 || _(K({
228
- widget: t,
229
- scale: h().scale,
230
- frameWidth: e.width,
231
- frameHeight: e.height
714
+ requestAnimationFrame(wt);
715
+ }, v = (e) => {
716
+ const t = _();
717
+ t.width === 0 || t.height === 0 || Z(Wt({
718
+ widget: e,
719
+ scale: m().scale,
720
+ frameWidth: t.width,
721
+ frameHeight: t.height
232
722
  }));
233
- }, Wt = (t) => {
234
- const e = a();
235
- e.width === 0 || e.height === 0 || _(zt({
236
- widget: t,
237
- frameWidth: e.width,
238
- frameHeight: e.height
723
+ }, ke = (e) => {
724
+ const t = _();
725
+ t.width === 0 || t.height === 0 || Z(ze({
726
+ widget: e,
727
+ frameWidth: t.width,
728
+ frameHeight: t.height
239
729
  }));
240
- }, xt = (t) => {
241
- const e = a();
242
- e.width === 0 || e.height === 0 || _(K({
243
- widget: t,
244
- scale: _t,
245
- frameWidth: e.width,
246
- frameHeight: e.height
730
+ }, fe = (e) => {
731
+ const t = _();
732
+ t.width === 0 || t.height === 0 || Z(Wt({
733
+ widget: e,
734
+ scale: Le,
735
+ frameWidth: t.width,
736
+ frameHeight: t.height
247
737
  }));
248
- }, W = (t, e = {}) => (b(t.id), f(t.id), e.centerViewport !== !1 && z(t), t);
738
+ }, O = (e, t = {}) => (I(e.id), h(e.id), t.centerViewport !== !1 && v(e), e);
249
739
  return {
250
- widgets: m,
251
- viewport: h,
252
- canvasFrameSize: D,
253
- locked: J,
254
- filters: H,
255
- selectedWidgetId: F,
256
- theme: Q,
257
- topZIndex: I,
258
- scaleLabel: tt,
259
- optimisticFrontWidgetId: U,
260
- widgetDefinitions: w,
261
- setCanvasFrameRef: nt,
740
+ widgets: w,
741
+ stickyNotes: z,
742
+ annotations: nt,
743
+ backgroundLayers: it,
744
+ viewport: m,
745
+ canvasFrameSize: b,
746
+ locked: It,
747
+ filters: F,
748
+ selectedWidgetId: Dt,
749
+ selectedObject: M,
750
+ mode: R,
751
+ activeTool: ot,
752
+ theme: jt,
753
+ topZIndex: S,
754
+ scaleLabel: Lt,
755
+ optimisticFrontWidgetId: l,
756
+ widgetDefinitions: W,
757
+ setCanvasFrameRef: Mt,
262
758
  contextMenu: {
263
- state: x,
264
- items: E,
265
- position: rt,
266
- close: g,
267
- retarget: (t) => {
268
- t.preventDefault(), t.stopPropagation(), S({
269
- clientX: t.clientX,
270
- clientY: t.clientY,
759
+ state: c,
760
+ items: st,
761
+ position: Vt,
762
+ close: s,
763
+ retarget: (e) => {
764
+ e.preventDefault(), e.stopPropagation(), r({
765
+ clientX: e.clientX,
766
+ clientY: e.clientY,
271
767
  worldX: 0,
272
768
  worldY: 0
273
769
  });
274
770
  }
275
771
  },
276
772
  canvas: {
277
- openCanvasContextMenu: it,
278
- openWidgetContextMenu: ot,
279
- selectWidget: b,
280
- clearSelection: P,
281
- startOptimisticFront: dt,
282
- commitFront: f,
283
- commitMove: lt,
284
- commitResize: at,
285
- commitViewport: y,
286
- cancelViewportNavigation: wt
773
+ openCanvasContextMenu: Rt,
774
+ openWidgetContextMenu: Bt,
775
+ openStickyNoteContextMenu: Xt,
776
+ openAnnotationContextMenu: Et,
777
+ openBackgroundLayerContextMenu: Yt,
778
+ selectWidget: I,
779
+ selectObject: de,
780
+ selectStickyNote: yt,
781
+ selectAnnotation: ce,
782
+ selectBackgroundLayer: ae,
783
+ clearSelection: _t,
784
+ startOptimisticFront: Ut,
785
+ commitFront: h,
786
+ commitMove: qt,
787
+ commitResize: Pt,
788
+ commitStickyFront: A,
789
+ commitStickyMove: $t,
790
+ commitStickyResize: Gt,
791
+ commitAnnotationMove: Zt,
792
+ commitAnnotationResize: vt,
793
+ commitBackgroundMove: Qt,
794
+ commitBackgroundResize: te,
795
+ commitViewport: $,
796
+ cancelViewportNavigation: ge
287
797
  },
288
798
  hud: {
289
- zoomIn: () => q("in"),
290
- zoomOut: () => q("out")
799
+ zoomIn: () => ft("in"),
800
+ zoomOut: () => ft("out")
291
801
  },
292
802
  lock: {
293
- toggle: gt
803
+ toggle: ee
294
804
  },
295
805
  filter: {
296
- toggle: ut,
297
- solo: ht,
298
- showAll: ft
806
+ toggle: ne,
807
+ solo: ie,
808
+ showAll: oe
299
809
  },
300
810
  navigation: {
301
- handleArrowNavigation: (t) => {
302
- const e = Xt(
303
- m(),
304
- F(),
305
- t,
306
- H()
811
+ handleArrowNavigation: (e) => {
812
+ const t = M(), n = [
813
+ ...w(),
814
+ ...z().map((d) => Ee(d))
815
+ ].sort(Be), i = Ne(
816
+ n,
817
+ t?.kind === "widget" || t?.kind === "sticky_note" ? t.id : null,
818
+ e,
819
+ Object.fromEntries(
820
+ n.map((d) => [
821
+ Nt(d) ? d.type : "sticky_note",
822
+ Nt(d) ? F()[d.type] !== !1 : F()[he] !== !1
823
+ ])
824
+ )
307
825
  );
308
- e && W(e);
826
+ i && (w().some((d) => d.id === i.id) ? O(i) : yt(i.id));
309
827
  },
310
- centerOnWidget: z,
311
- focusWidget: W,
312
- fitWidget: (t) => (b(t.id), f(t.id), Wt(t), t),
313
- overviewWidget: (t) => (b(t.id), f(t.id), xt(t), t)
828
+ centerOnWidget: v,
829
+ focusWidget: O,
830
+ fitWidget: (e) => (I(e.id), h(e.id), ke(e), e),
831
+ overviewWidget: (e) => (I(e.id), h(e.id), fe(e), e)
314
832
  },
315
833
  selection: {
316
- clear: P
834
+ clear: _t
317
835
  },
318
836
  widgetActions: {
319
837
  deleteSelected: () => {
320
- const t = F();
321
- t && Y(t);
838
+ const e = M();
839
+ e && (e.kind === "widget" && p(e.id), e.kind === "sticky_note" && U(e.id), e.kind === "annotation" && q(e.id), e.kind === "background_layer" && P(e.id));
322
840
  },
323
- deleteWidget: Y,
324
- addWidget: v,
325
- addWidgetAtCursor: X,
326
- addWidgetCentered: B,
327
- ensureWidget: (t, e) => {
328
- const n = C(t);
841
+ deleteWidget: p,
842
+ deleteStickyNote: U,
843
+ deleteAnnotation: q,
844
+ deleteBackgroundLayer: P,
845
+ addWidget: E,
846
+ addWidgetAtCursor: Y,
847
+ addWidgetCentered: rt,
848
+ addStickyNoteAtCursor: H,
849
+ addTextAnnotationAtCursor: K,
850
+ duplicateTextAnnotationFrom: lt,
851
+ addBackgroundLayerAtCursor: V,
852
+ duplicateBackgroundLayerFrom: ut,
853
+ createActiveToolAt: le,
854
+ ensureWidget: (e, t) => {
855
+ const n = N(e);
329
856
  if (n)
330
- return W(n, { centerViewport: e?.centerViewport ?? !0 });
331
- const i = mt(), o = X(
332
- t,
333
- e?.worldX ?? i.worldX,
334
- e?.worldY ?? i.worldY
857
+ return O(n, { centerViewport: t?.centerViewport ?? !0 });
858
+ const i = ue(), d = Y(
859
+ e,
860
+ t?.worldX ?? i.worldX,
861
+ t?.worldY ?? i.worldY
335
862
  );
336
- return (e?.centerViewport ?? !0) && o && z(o), o;
337
- }
863
+ return (t?.centerViewport ?? !0) && d && v(d), d;
864
+ },
865
+ updateStickyNote: gt,
866
+ updateTextAnnotation: Jt,
867
+ updateBackgroundLayer: kt
338
868
  },
339
869
  queries: {
340
- findWidgetByType: C,
341
- findWidgetById: ct
870
+ findWidgetByType: N,
871
+ findWidgetById: pt,
872
+ findStickyNoteById: X,
873
+ findAnnotationById: ct,
874
+ findBackgroundLayerById: at
342
875
  },
343
876
  appearance: {
344
- setTheme: (t) => {
345
- l().theme !== t && c.setState((e) => ({ ...e, theme: t }));
877
+ setTheme: (e) => {
878
+ a().theme !== e && o.setState((t) => ({ ...t, theme: e }));
346
879
  }
347
880
  },
881
+ modes: {
882
+ setMode: se,
883
+ setActiveTool: re
884
+ },
348
885
  handleCloseRequest: () => {
349
- if (x()) {
350
- g();
886
+ if (c()) {
887
+ s();
351
888
  return;
352
889
  }
353
- c.onClose();
890
+ o.onClose();
354
891
  }
355
892
  };
356
893
  }
357
894
  export {
358
- Kt as useWorkbenchModel
895
+ dn as useWorkbenchModel
359
896
  };