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