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