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