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