@floegence/floe-webapp-core 0.36.60 → 0.36.62

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