@floegence/floe-webapp-core 0.36.45 → 0.36.48
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 -1
- package/dist/components/workbench/WorkbenchCanvas.js +108 -88
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +2 -1
- package/dist/components/workbench/WorkbenchCanvasField.js +40 -34
- 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 +6 -5
- package/dist/components/workbench/WorkbenchWidget.d.ts +2 -1
- package/dist/components/workbench/WorkbenchWidget.js +175 -168
- package/dist/components/workbench/types.d.ts +8 -0
- package/dist/components/workbench/useWorkbenchModel.d.ts +2 -1
- package/dist/components/workbench/useWorkbenchModel.js +325 -312
- package/dist/components/workbench/workbenchMotion.d.ts +3 -0
- package/dist/components/workbench/workbenchMotion.js +60 -0
- package/dist/styles.css +1 -1
- package/dist/workbench.css +25 -0
- 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 { resolveWorkbenchModeStrategy 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;
|
|
21
|
+
}
|
|
22
|
+
function Ue(o) {
|
|
23
|
+
return Dt(Ie, o);
|
|
24
|
+
}
|
|
25
|
+
function qe(o) {
|
|
26
|
+
return Dt(Lt, o);
|
|
19
27
|
}
|
|
20
|
-
function
|
|
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 Ue(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 $e(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 Ze(o) {
|
|
|
120
128
|
updated_at_unix_ms: c
|
|
121
129
|
};
|
|
122
130
|
}
|
|
123
|
-
function
|
|
124
|
-
const [c,
|
|
131
|
+
function _n(o) {
|
|
132
|
+
const [c, s] = et(null), [a, _] = et(null), [y, w] = et({ width: 0, height: 0 });
|
|
125
133
|
let f = null, T = 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
|
-
},
|
|
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 = () => {
|
|
132
140
|
T?.disconnect(), T = null;
|
|
133
|
-
},
|
|
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 un(o) {
|
|
|
163
171
|
target: { kind: "widget", id: t.id },
|
|
164
172
|
widgetId: t.id
|
|
165
173
|
});
|
|
166
|
-
},
|
|
167
|
-
I(t.id),
|
|
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 un(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 un(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,22 +217,22 @@ function un(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",
|
|
@@ -232,7 +240,7 @@ function un(o) {
|
|
|
232
240
|
label: "Duplicate",
|
|
233
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",
|
|
@@ -241,19 +249,19 @@ function un(o) {
|
|
|
241
249
|
icon: z,
|
|
242
250
|
destructive: !0,
|
|
243
251
|
onSelect: () => {
|
|
244
|
-
|
|
252
|
+
K(t.id), l();
|
|
245
253
|
}
|
|
246
254
|
}), i;
|
|
247
255
|
}
|
|
248
256
|
if (t.kind === "sticky_note") {
|
|
249
|
-
const n =
|
|
257
|
+
const n = X(t.id), i = [];
|
|
250
258
|
return n && (i.push({
|
|
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
|
-
I(n.id),
|
|
264
|
+
I(n.id), l();
|
|
257
265
|
}
|
|
258
266
|
}), i.push({
|
|
259
267
|
id: "copy-content",
|
|
@@ -261,15 +269,15 @@ function un(o) {
|
|
|
261
269
|
label: "Copy Content",
|
|
262
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",
|
|
@@ -278,19 +286,19 @@ function un(o) {
|
|
|
278
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
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",
|
|
@@ -299,27 +307,27 @@ function un(o) {
|
|
|
299
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
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",
|
|
@@ -328,7 +336,7 @@ function un(o) {
|
|
|
328
336
|
icon: z,
|
|
329
337
|
destructive: !0,
|
|
330
338
|
onSelect: () => {
|
|
331
|
-
$(t.id),
|
|
339
|
+
$(t.id), l();
|
|
332
340
|
}
|
|
333
341
|
}), i;
|
|
334
342
|
}
|
|
@@ -337,18 +345,18 @@ function un(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,36 +364,36 @@ function un(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
399
|
return o.setState((j) => ({
|
|
@@ -396,18 +404,18 @@ function un(o) {
|
|
|
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 un(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 un(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 un(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 un(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,11 +474,11 @@ function un(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(
|
|
@@ -473,43 +486,43 @@ function un(o) {
|
|
|
473
486
|
)
|
|
474
487
|
}));
|
|
475
488
|
}, I = (e) => {
|
|
476
|
-
|
|
477
|
-
const t =
|
|
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 un(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 un(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(
|
|
@@ -598,52 +611,52 @@ function un(o) {
|
|
|
598
611
|
selectedObject: t.selectedObject?.kind === "background_layer" && t.selectedObject.id === e ? null : t.selectedObject ?? null
|
|
599
612
|
}));
|
|
600
613
|
};
|
|
601
|
-
let
|
|
602
|
-
const
|
|
614
|
+
let Z = 0;
|
|
615
|
+
const v = (e) => {
|
|
603
616
|
o.setState((t) => ({ ...t, viewport: e }));
|
|
604
|
-
},
|
|
605
|
-
|
|
606
|
-
},
|
|
607
|
-
const t =
|
|
608
|
-
if (j !==
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
x: n + (e.x - n) *
|
|
612
|
-
y: i + (e.y - i) *
|
|
613
|
-
scale: d + (e.scale - d) *
|
|
614
|
-
}),
|
|
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);
|
|
615
628
|
};
|
|
616
629
|
requestAnimationFrame(wt);
|
|
617
|
-
},
|
|
618
|
-
const t =
|
|
630
|
+
}, ae = (e) => {
|
|
631
|
+
const t = Ot(e), n = h();
|
|
619
632
|
if (n.scale >= t.minScale) return;
|
|
620
|
-
const i =
|
|
621
|
-
|
|
633
|
+
const i = m();
|
|
634
|
+
L(Xe({
|
|
622
635
|
viewport: n,
|
|
623
636
|
scale: t.minScale,
|
|
624
637
|
minScale: t.minScale,
|
|
625
638
|
frameWidth: i.width,
|
|
626
639
|
frameHeight: i.height
|
|
627
640
|
}));
|
|
628
|
-
},
|
|
629
|
-
const t =
|
|
630
|
-
e === "in" ? t.scale *
|
|
631
|
-
|
|
632
|
-
|
|
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
|
|
633
646
|
), g = {
|
|
634
647
|
x: n.width / 2 - i * k,
|
|
635
648
|
y: n.height / 2 - d * k,
|
|
636
649
|
scale: k
|
|
637
650
|
};
|
|
638
|
-
|
|
639
|
-
},
|
|
651
|
+
v(g);
|
|
652
|
+
}, se = () => {
|
|
640
653
|
o.setState((e) => ({ ...e, locked: !e.locked }));
|
|
641
|
-
},
|
|
654
|
+
}, re = (e) => {
|
|
642
655
|
o.setState((t) => ({
|
|
643
656
|
...t,
|
|
644
657
|
filters: { ...t.filters, [e]: !t.filters[e] }
|
|
645
658
|
}));
|
|
646
|
-
},
|
|
659
|
+
}, le = (e, t) => {
|
|
647
660
|
o.setState((n) => {
|
|
648
661
|
const i = { ...n.filters }, d = [...new Set(t.map((g) => String(g)).filter(Boolean))], k = d.length > 1 && d.every(
|
|
649
662
|
(g) => i[g] !== !1 == (g === e)
|
|
@@ -652,13 +665,13 @@ function un(o) {
|
|
|
652
665
|
i[g] = k ? !0 : g === e;
|
|
653
666
|
return { ...n, filters: i };
|
|
654
667
|
});
|
|
655
|
-
},
|
|
656
|
-
const e =
|
|
668
|
+
}, ue = () => {
|
|
669
|
+
const e = O();
|
|
657
670
|
o.setState((t) => ({
|
|
658
671
|
...t,
|
|
659
|
-
filters:
|
|
672
|
+
filters: ze(void 0, e)
|
|
660
673
|
}));
|
|
661
|
-
},
|
|
674
|
+
}, D = (e) => {
|
|
662
675
|
o.setState((t) => ({
|
|
663
676
|
...t,
|
|
664
677
|
selectedWidgetId: e,
|
|
@@ -666,18 +679,18 @@ function un(o) {
|
|
|
666
679
|
mode: t.mode === "background" ? "work" : t.mode,
|
|
667
680
|
activeTool: "select"
|
|
668
681
|
}));
|
|
669
|
-
},
|
|
682
|
+
}, yt = () => {
|
|
670
683
|
o.setState(
|
|
671
684
|
(e) => e.selectedWidgetId === null && !e.selectedObject ? e : { ...e, selectedWidgetId: null, selectedObject: null }
|
|
672
685
|
);
|
|
673
|
-
},
|
|
686
|
+
}, ge = (e) => {
|
|
674
687
|
o.setState((t) => ({
|
|
675
688
|
...t,
|
|
676
689
|
selectedObject: e,
|
|
677
690
|
selectedWidgetId: e?.kind === "widget" ? e.id : null,
|
|
678
691
|
activeTool: "select"
|
|
679
692
|
}));
|
|
680
|
-
},
|
|
693
|
+
}, mt = (e) => {
|
|
681
694
|
o.setState((t) => ({
|
|
682
695
|
...t,
|
|
683
696
|
selectedWidgetId: null,
|
|
@@ -685,7 +698,7 @@ function un(o) {
|
|
|
685
698
|
mode: "work",
|
|
686
699
|
activeTool: "select"
|
|
687
700
|
})), I(e);
|
|
688
|
-
},
|
|
701
|
+
}, ke = (e) => {
|
|
689
702
|
o.setState((t) => ({
|
|
690
703
|
...t,
|
|
691
704
|
selectedWidgetId: null,
|
|
@@ -693,7 +706,7 @@ function un(o) {
|
|
|
693
706
|
mode: "background",
|
|
694
707
|
activeTool: "select"
|
|
695
708
|
}));
|
|
696
|
-
},
|
|
709
|
+
}, fe = (e) => {
|
|
697
710
|
o.setState((t) => ({
|
|
698
711
|
...t,
|
|
699
712
|
selectedWidgetId: null,
|
|
@@ -701,80 +714,80 @@ function un(o) {
|
|
|
701
714
|
mode: "background",
|
|
702
715
|
activeTool: "select"
|
|
703
716
|
}));
|
|
704
|
-
},
|
|
705
|
-
const t =
|
|
717
|
+
}, _e = (e) => {
|
|
718
|
+
const t = Ee(e);
|
|
706
719
|
o.setState((n) => ({
|
|
707
720
|
...n,
|
|
708
721
|
mode: t,
|
|
709
722
|
activeTool: "select",
|
|
710
723
|
selectedWidgetId: t === "work" ? n.selectedObject?.kind === "widget" ? n.selectedObject.id : n.selectedWidgetId : null,
|
|
711
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
|
|
712
|
-
})),
|
|
713
|
-
},
|
|
725
|
+
})), ae(t);
|
|
726
|
+
}, ye = (e) => {
|
|
714
727
|
o.setState((t) => ({
|
|
715
728
|
...t,
|
|
716
729
|
activeTool: e,
|
|
717
730
|
mode: e === "text" || e === "background-region" ? "background" : e === "sticky-note" ? "work" : t.mode ?? "work"
|
|
718
731
|
}));
|
|
719
|
-
},
|
|
720
|
-
const n =
|
|
721
|
-
return n === "sticky-note" ?
|
|
722
|
-
},
|
|
723
|
-
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();
|
|
724
737
|
return {
|
|
725
738
|
worldX: e.width > 0 ? (e.width / 2 - t.x) / t.scale : 240,
|
|
726
739
|
worldY: e.height > 0 ? (e.height / 2 - t.y) / t.scale : 180
|
|
727
740
|
};
|
|
728
|
-
},
|
|
729
|
-
const t =
|
|
730
|
-
t.width === 0 || t.height === 0 ||
|
|
741
|
+
}, J = (e) => {
|
|
742
|
+
const t = m();
|
|
743
|
+
t.width === 0 || t.height === 0 || L(Ct({
|
|
731
744
|
widget: e,
|
|
732
|
-
scale:
|
|
745
|
+
scale: h().scale,
|
|
733
746
|
frameWidth: t.width,
|
|
734
747
|
frameHeight: t.height
|
|
735
748
|
}));
|
|
736
|
-
},
|
|
737
|
-
const t =
|
|
738
|
-
t.width === 0 || t.height === 0 ||
|
|
749
|
+
}, he = (e) => {
|
|
750
|
+
const t = m();
|
|
751
|
+
t.width === 0 || t.height === 0 || L(He({
|
|
739
752
|
widget: e,
|
|
740
753
|
frameWidth: t.width,
|
|
741
754
|
frameHeight: t.height
|
|
742
755
|
}));
|
|
743
|
-
},
|
|
744
|
-
const t =
|
|
745
|
-
t.width === 0 || t.height === 0 ||
|
|
756
|
+
}, xe = (e) => {
|
|
757
|
+
const t = m();
|
|
758
|
+
t.width === 0 || t.height === 0 || L(Ct({
|
|
746
759
|
widget: e,
|
|
747
|
-
scale:
|
|
760
|
+
scale: Ye,
|
|
748
761
|
frameWidth: t.width,
|
|
749
762
|
frameHeight: t.height
|
|
750
763
|
}));
|
|
751
|
-
},
|
|
764
|
+
}, C = (e, t = {}) => (D(e.id), b(e.id), t.centerViewport !== !1 && J(e), e);
|
|
752
765
|
return {
|
|
753
|
-
widgets:
|
|
754
|
-
stickyNotes:
|
|
755
|
-
annotations:
|
|
756
|
-
backgroundLayers:
|
|
757
|
-
viewport:
|
|
758
|
-
canvasFrameSize:
|
|
759
|
-
locked:
|
|
760
|
-
filters:
|
|
761
|
-
selectedWidgetId:
|
|
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,
|
|
762
775
|
selectedObject: p,
|
|
763
|
-
mode:
|
|
764
|
-
activeTool:
|
|
765
|
-
theme:
|
|
766
|
-
topZIndex:
|
|
767
|
-
scaleLabel:
|
|
768
|
-
optimisticFrontWidgetId:
|
|
769
|
-
widgetDefinitions:
|
|
770
|
-
setCanvasFrameRef:
|
|
776
|
+
mode: N,
|
|
777
|
+
activeTool: dt,
|
|
778
|
+
theme: Ft,
|
|
779
|
+
topZIndex: W,
|
|
780
|
+
scaleLabel: Rt,
|
|
781
|
+
optimisticFrontWidgetId: a,
|
|
782
|
+
widgetDefinitions: O,
|
|
783
|
+
setCanvasFrameRef: Xt,
|
|
771
784
|
contextMenu: {
|
|
772
785
|
state: c,
|
|
773
|
-
items:
|
|
774
|
-
position:
|
|
775
|
-
close:
|
|
786
|
+
items: rt,
|
|
787
|
+
position: $t,
|
|
788
|
+
close: l,
|
|
776
789
|
retarget: (e) => {
|
|
777
|
-
e.preventDefault(), e.stopPropagation(),
|
|
790
|
+
e.preventDefault(), e.stopPropagation(), s({
|
|
778
791
|
clientX: e.clientX,
|
|
779
792
|
clientY: e.clientY,
|
|
780
793
|
worldX: 0,
|
|
@@ -783,121 +796,121 @@ function un(o) {
|
|
|
783
796
|
}
|
|
784
797
|
},
|
|
785
798
|
canvas: {
|
|
786
|
-
openCanvasContextMenu:
|
|
787
|
-
openWidgetContextMenu:
|
|
788
|
-
openStickyNoteContextMenu:
|
|
789
|
-
openAnnotationContextMenu:
|
|
790
|
-
openBackgroundLayerContextMenu:
|
|
791
|
-
selectWidget:
|
|
792
|
-
selectObject:
|
|
793
|
-
selectStickyNote:
|
|
794
|
-
selectAnnotation:
|
|
795
|
-
selectBackgroundLayer:
|
|
796
|
-
clearSelection:
|
|
797
|
-
startOptimisticFront:
|
|
798
|
-
commitFront:
|
|
799
|
-
commitMove:
|
|
800
|
-
commitResize:
|
|
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,
|
|
801
814
|
commitStickyFront: I,
|
|
802
|
-
commitStickyMove:
|
|
803
|
-
commitStickyResize:
|
|
804
|
-
commitAnnotationMove:
|
|
805
|
-
commitAnnotationResize:
|
|
806
|
-
commitBackgroundMove:
|
|
807
|
-
commitBackgroundResize:
|
|
808
|
-
commitViewport:
|
|
809
|
-
cancelViewportNavigation:
|
|
815
|
+
commitStickyMove: Qt,
|
|
816
|
+
commitStickyResize: te,
|
|
817
|
+
commitAnnotationMove: ee,
|
|
818
|
+
commitAnnotationResize: ne,
|
|
819
|
+
commitBackgroundMove: oe,
|
|
820
|
+
commitBackgroundResize: de,
|
|
821
|
+
commitViewport: v,
|
|
822
|
+
cancelViewportNavigation: ce
|
|
810
823
|
},
|
|
811
824
|
hud: {
|
|
812
|
-
zoomIn: () =>
|
|
813
|
-
zoomOut: () =>
|
|
825
|
+
zoomIn: () => _t("in"),
|
|
826
|
+
zoomOut: () => _t("out")
|
|
814
827
|
},
|
|
815
828
|
lock: {
|
|
816
|
-
toggle:
|
|
829
|
+
toggle: se
|
|
817
830
|
},
|
|
818
831
|
filter: {
|
|
819
|
-
toggle:
|
|
820
|
-
solo:
|
|
821
|
-
showAll:
|
|
832
|
+
toggle: re,
|
|
833
|
+
solo: le,
|
|
834
|
+
showAll: ue
|
|
822
835
|
},
|
|
823
836
|
navigation: {
|
|
824
837
|
handleArrowNavigation: (e) => {
|
|
825
838
|
const t = p(), n = [
|
|
826
|
-
...
|
|
827
|
-
...
|
|
828
|
-
].sort(
|
|
839
|
+
...x(),
|
|
840
|
+
...R().map((d) => $e(d))
|
|
841
|
+
].sort(Pe), i = Me(
|
|
829
842
|
n,
|
|
830
843
|
t?.kind === "widget" || t?.kind === "sticky_note" ? t.id : null,
|
|
831
844
|
e,
|
|
832
845
|
Object.fromEntries(
|
|
833
846
|
n.map((d) => [
|
|
834
|
-
|
|
835
|
-
|
|
847
|
+
It(d) ? d.type : "sticky_note",
|
|
848
|
+
It(d) ? B()[d.type] !== !1 : B()[Ce] !== !1
|
|
836
849
|
])
|
|
837
850
|
)
|
|
838
851
|
);
|
|
839
|
-
i && (
|
|
852
|
+
i && (x().some((d) => d.id === i.id) ? C(i) : mt(i.id));
|
|
840
853
|
},
|
|
841
|
-
centerOnWidget:
|
|
842
|
-
focusWidget:
|
|
843
|
-
fitWidget: (e) => (
|
|
844
|
-
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)
|
|
845
858
|
},
|
|
846
859
|
selection: {
|
|
847
|
-
clear:
|
|
860
|
+
clear: yt
|
|
848
861
|
},
|
|
849
862
|
widgetActions: {
|
|
850
863
|
deleteSelected: () => {
|
|
851
864
|
const e = p();
|
|
852
|
-
e && (e.kind === "widget" &&
|
|
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));
|
|
853
866
|
},
|
|
854
|
-
deleteWidget:
|
|
855
|
-
deleteStickyNote:
|
|
856
|
-
deleteAnnotation:
|
|
867
|
+
deleteWidget: K,
|
|
868
|
+
deleteStickyNote: P,
|
|
869
|
+
deleteAnnotation: G,
|
|
857
870
|
deleteBackgroundLayer: $,
|
|
858
|
-
addWidget:
|
|
859
|
-
addWidgetAtCursor:
|
|
860
|
-
addWidgetCentered:
|
|
861
|
-
addStickyNoteAtCursor:
|
|
862
|
-
addTextAnnotationAtCursor:
|
|
863
|
-
duplicateTextAnnotationFrom:
|
|
864
|
-
addBackgroundLayerAtCursor:
|
|
865
|
-
duplicateBackgroundLayerFrom:
|
|
866
|
-
createActiveToolAt:
|
|
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,
|
|
867
880
|
ensureWidget: (e, t) => {
|
|
868
|
-
const n =
|
|
881
|
+
const n = A(e);
|
|
869
882
|
if (n)
|
|
870
|
-
return
|
|
871
|
-
const i =
|
|
883
|
+
return C(n, { centerViewport: t?.centerViewport ?? !0 });
|
|
884
|
+
const i = we(), d = H(
|
|
872
885
|
e,
|
|
873
886
|
t?.worldX ?? i.worldX,
|
|
874
887
|
t?.worldY ?? i.worldY
|
|
875
888
|
);
|
|
876
|
-
return (t?.centerViewport ?? !0) && d &&
|
|
889
|
+
return (t?.centerViewport ?? !0) && d && J(d), d;
|
|
877
890
|
},
|
|
878
|
-
updateStickyNote:
|
|
879
|
-
updateTextAnnotation:
|
|
880
|
-
updateBackgroundLayer:
|
|
891
|
+
updateStickyNote: kt,
|
|
892
|
+
updateTextAnnotation: ie,
|
|
893
|
+
updateBackgroundLayer: ft
|
|
881
894
|
},
|
|
882
895
|
queries: {
|
|
883
|
-
findWidgetByType:
|
|
884
|
-
findWidgetById:
|
|
885
|
-
findStickyNoteById:
|
|
886
|
-
findAnnotationById:
|
|
887
|
-
findBackgroundLayerById:
|
|
896
|
+
findWidgetByType: A,
|
|
897
|
+
findWidgetById: qt,
|
|
898
|
+
findStickyNoteById: X,
|
|
899
|
+
findAnnotationById: at,
|
|
900
|
+
findBackgroundLayerById: st
|
|
888
901
|
},
|
|
889
902
|
appearance: {
|
|
890
903
|
setTheme: (e) => {
|
|
891
|
-
|
|
904
|
+
r().theme !== e && o.setState((t) => ({ ...t, theme: e }));
|
|
892
905
|
}
|
|
893
906
|
},
|
|
894
907
|
modes: {
|
|
895
|
-
setMode:
|
|
896
|
-
setActiveTool:
|
|
908
|
+
setMode: _e,
|
|
909
|
+
setActiveTool: ye
|
|
897
910
|
},
|
|
898
911
|
handleCloseRequest: () => {
|
|
899
912
|
if (c()) {
|
|
900
|
-
|
|
913
|
+
l();
|
|
901
914
|
return;
|
|
902
915
|
}
|
|
903
916
|
o.onClose();
|
|
@@ -905,5 +918,5 @@ function un(o) {
|
|
|
905
918
|
};
|
|
906
919
|
}
|
|
907
920
|
export {
|
|
908
|
-
|
|
921
|
+
_n as useWorkbenchModel
|
|
909
922
|
};
|