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