@floegence/floe-webapp-core 0.55.2 → 0.56.2

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