@floegence/floe-webapp-core 0.36.4 → 0.36.5
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.
|
@@ -1,52 +1,53 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createUniqueId as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useLayout as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Restore as
|
|
7
|
-
import { startHotInteraction as
|
|
8
|
-
import { normalizeFloatingWindowRect as
|
|
9
|
-
|
|
1
|
+
import { createComponent as a, Portal as Ee, spread as ae, mergeProps as se, memo as de, insert as g, effect as u, setAttribute as Ae, addEventListener as m, className as c, template as s, use as Me, delegateEvents as Fe } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as Le, createSignal as v, onMount as De, onCleanup as T, createEffect as S, Show as y, batch as ke } from "solid-js";
|
|
3
|
+
import { cn as _ } from "../../utils/cn.js";
|
|
4
|
+
import { useLayout as We } from "../../context/LayoutContext.js";
|
|
5
|
+
import { Button as ue } from "./Button.js";
|
|
6
|
+
import { Restore as Oe, Maximize as Te, X as He } from "../icons/index.js";
|
|
7
|
+
import { startHotInteraction as Xe } from "../../utils/hotInteraction.js";
|
|
8
|
+
import { normalizeFloatingWindowRect as ce, resolveFloatingWindowRect as Ue } from "./floatingWindowGeometry.js";
|
|
9
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as fe } from "./localInteractionSurface.js";
|
|
10
|
+
var Ye = /* @__PURE__ */ s('<h2 class="text-sm font-medium truncate select-none">'), qe = /* @__PURE__ */ s('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), Ne = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), Be = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), je = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), Ge = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), Ve = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), Ze = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), Je = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), Ke = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), Qe = /* @__PURE__ */ s('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true data-floe-floating-window-surface=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex-1 min-w-0"></div><div class="flex items-center gap-0.5 -mr-1"></div></div><div class="flex-1 overflow-auto p-3">');
|
|
10
11
|
function dt(i) {
|
|
11
|
-
const
|
|
12
|
+
const H = () => i.resizable ?? !0, X = () => i.draggable ?? !0, R = () => i.minSize ?? {
|
|
12
13
|
width: 200,
|
|
13
14
|
height: 150
|
|
14
|
-
},
|
|
15
|
+
}, C = () => i.maxSize ?? {
|
|
15
16
|
width: 1 / 0,
|
|
16
17
|
height: 1 / 0
|
|
17
|
-
},
|
|
18
|
+
}, he = () => i.zIndex ?? 100, we = Le(), ge = We(), b = () => ge.isMobile(), E = 16, U = () => `floating-window-${we}-title`, [A, me] = v(i.defaultPosition ?? {
|
|
18
19
|
x: 0,
|
|
19
20
|
y: 0
|
|
20
|
-
}), [
|
|
21
|
+
}), [M, pe] = v(i.defaultSize ?? {
|
|
21
22
|
width: 400,
|
|
22
23
|
height: 300
|
|
23
|
-
}), [d,
|
|
24
|
-
let
|
|
24
|
+
}), [d, Y] = v(!1), [q, N] = v(!1), [B, j] = v(!1), [ve, F] = v(!1), [xe, ze] = v(null);
|
|
25
|
+
let G = {
|
|
25
26
|
x: 0,
|
|
26
27
|
y: 0
|
|
27
|
-
},
|
|
28
|
+
}, V = {
|
|
28
29
|
x: 0,
|
|
29
30
|
y: 0,
|
|
30
31
|
width: 0,
|
|
31
32
|
height: 0
|
|
32
|
-
},
|
|
33
|
+
}, Z = {
|
|
33
34
|
x: 0,
|
|
34
35
|
y: 0
|
|
35
|
-
},
|
|
36
|
+
}, J = {
|
|
36
37
|
x: 0,
|
|
37
38
|
y: 0,
|
|
38
39
|
width: 0,
|
|
39
40
|
height: 0
|
|
40
|
-
},
|
|
41
|
+
}, K = "se", r, l = null, p = null, P = {
|
|
41
42
|
x: 0,
|
|
42
43
|
y: 0
|
|
43
|
-
},
|
|
44
|
+
}, x = null, I = null, Q = !1, z = {
|
|
44
45
|
x: i.defaultPosition?.x ?? 0,
|
|
45
46
|
y: i.defaultPosition?.y ?? 0,
|
|
46
47
|
width: i.defaultSize?.width ?? 400,
|
|
47
48
|
height: i.defaultSize?.height ?? 300
|
|
48
49
|
};
|
|
49
|
-
const
|
|
50
|
+
const ye = {
|
|
50
51
|
n: "ns-resize",
|
|
51
52
|
s: "ns-resize",
|
|
52
53
|
e: "ew-resize",
|
|
@@ -55,45 +56,45 @@ function dt(i) {
|
|
|
55
56
|
nw: "nwse-resize",
|
|
56
57
|
se: "nwse-resize",
|
|
57
58
|
sw: "nesw-resize"
|
|
58
|
-
},
|
|
59
|
+
}, L = (e, t) => {
|
|
59
60
|
if (!e) {
|
|
60
|
-
|
|
61
|
+
I?.(), I = null;
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
kind:
|
|
65
|
-
cursor:
|
|
64
|
+
I?.(), I = Xe({
|
|
65
|
+
kind: p === "resize" ? "resize" : "drag",
|
|
66
|
+
cursor: t,
|
|
66
67
|
lockUserSelect: !0
|
|
67
68
|
});
|
|
68
|
-
},
|
|
69
|
+
}, ee = (e) => {
|
|
69
70
|
z = e, r && (r.style.transform = `translate3d(${e.x}px, ${e.y}px, 0)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`);
|
|
70
|
-
},
|
|
71
|
-
const e =
|
|
71
|
+
}, D = () => {
|
|
72
|
+
const e = A(), t = M();
|
|
72
73
|
return {
|
|
73
74
|
x: e.x,
|
|
74
75
|
y: e.y,
|
|
75
|
-
width:
|
|
76
|
-
height:
|
|
76
|
+
width: t.width,
|
|
77
|
+
height: t.height
|
|
77
78
|
};
|
|
78
|
-
},
|
|
79
|
-
z = e,
|
|
79
|
+
}, $ = (e) => {
|
|
80
|
+
z = e, me({
|
|
80
81
|
x: e.x,
|
|
81
82
|
y: e.y
|
|
82
|
-
}),
|
|
83
|
+
}), pe({
|
|
83
84
|
width: e.width,
|
|
84
85
|
height: e.height
|
|
85
86
|
});
|
|
86
|
-
},
|
|
87
|
+
}, be = () => {
|
|
87
88
|
try {
|
|
88
89
|
r?.focus({
|
|
89
90
|
preventScroll: !0
|
|
90
91
|
});
|
|
91
92
|
} catch {
|
|
92
93
|
}
|
|
93
|
-
},
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
},
|
|
94
|
+
}, Pe = (e) => {
|
|
95
|
+
const t = e instanceof Element ? e : null;
|
|
96
|
+
return t ? t.closest('button, input, select, textarea, a, [role="button"], [tabindex]:not([tabindex="-1"])') === null : !0;
|
|
97
|
+
}, k = (e) => !!r && e instanceof Node && r.contains(e), $e = () => {
|
|
97
98
|
if (!r) return null;
|
|
98
99
|
const e = r.getBoundingClientRect();
|
|
99
100
|
return {
|
|
@@ -102,176 +103,176 @@ function dt(i) {
|
|
|
102
103
|
width: e.width,
|
|
103
104
|
height: e.height
|
|
104
105
|
};
|
|
105
|
-
},
|
|
106
|
-
i.open && (l === null ||
|
|
107
|
-
mode:
|
|
106
|
+
}, te = () => {
|
|
107
|
+
i.open && (l === null || p === null || typeof window > "u" || ee(Ue({
|
|
108
|
+
mode: p,
|
|
108
109
|
pointer: P,
|
|
109
|
-
dragStartPos:
|
|
110
|
-
dragStartRect:
|
|
111
|
-
resizeStartPos:
|
|
112
|
-
resizeStartRect:
|
|
113
|
-
resizeHandle:
|
|
114
|
-
minSize:
|
|
115
|
-
maxSize:
|
|
110
|
+
dragStartPos: G,
|
|
111
|
+
dragStartRect: V,
|
|
112
|
+
resizeStartPos: Z,
|
|
113
|
+
resizeStartRect: J,
|
|
114
|
+
resizeHandle: K,
|
|
115
|
+
minSize: R(),
|
|
116
|
+
maxSize: C(),
|
|
116
117
|
viewport: {
|
|
117
118
|
width: window.innerWidth,
|
|
118
119
|
height: window.innerHeight
|
|
119
120
|
},
|
|
120
121
|
mobile: b(),
|
|
121
|
-
mobilePadding:
|
|
122
|
+
mobilePadding: E
|
|
122
123
|
})));
|
|
123
|
-
},
|
|
124
|
+
}, W = (e) => {
|
|
124
125
|
if (typeof window > "u") return;
|
|
125
|
-
const
|
|
126
|
+
const t = {
|
|
126
127
|
width: window.innerWidth,
|
|
127
128
|
height: window.innerHeight
|
|
128
129
|
};
|
|
129
130
|
if (d()) {
|
|
130
|
-
|
|
131
|
+
$({
|
|
131
132
|
x: 0,
|
|
132
133
|
y: 0,
|
|
133
|
-
width:
|
|
134
|
-
height:
|
|
134
|
+
width: t.width,
|
|
135
|
+
height: t.height
|
|
135
136
|
});
|
|
136
137
|
return;
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
-
rect:
|
|
140
|
-
minSize:
|
|
141
|
-
maxSize:
|
|
142
|
-
viewport:
|
|
139
|
+
$(ce({
|
|
140
|
+
rect: D(),
|
|
141
|
+
minSize: R(),
|
|
142
|
+
maxSize: C(),
|
|
143
|
+
viewport: t,
|
|
143
144
|
mobile: b(),
|
|
144
|
-
mobilePadding:
|
|
145
|
+
mobilePadding: E,
|
|
145
146
|
center: e?.center ?? !1
|
|
146
147
|
}));
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
const o =
|
|
148
|
+
}, O = (e, t = !0) => {
|
|
149
|
+
x !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(x), x = null), t && te();
|
|
150
|
+
const o = t ? $e() ?? z : null;
|
|
150
151
|
if (e !== void 0)
|
|
151
152
|
try {
|
|
152
153
|
typeof r?.releasePointerCapture == "function" && r.releasePointerCapture(e);
|
|
153
154
|
} catch {
|
|
154
155
|
}
|
|
155
|
-
|
|
156
|
-
o &&
|
|
157
|
-
}),
|
|
156
|
+
ke(() => {
|
|
157
|
+
o && $(o), l = null, p = null, N(!1), j(!1);
|
|
158
|
+
}), L(!1, "");
|
|
158
159
|
};
|
|
159
|
-
|
|
160
|
-
i.open ||
|
|
160
|
+
De(() => {
|
|
161
|
+
i.open || W({
|
|
161
162
|
center: !i.defaultPosition
|
|
162
163
|
});
|
|
163
164
|
const e = () => {
|
|
164
|
-
l === null &&
|
|
165
|
+
l === null && W({
|
|
165
166
|
center: !1
|
|
166
167
|
});
|
|
167
168
|
};
|
|
168
|
-
window.addEventListener("resize", e),
|
|
169
|
-
}),
|
|
169
|
+
window.addEventListener("resize", e), T(() => window.removeEventListener("resize", e));
|
|
170
|
+
}), S(() => {
|
|
170
171
|
if (!i.open) return;
|
|
171
172
|
b();
|
|
172
|
-
const e = !
|
|
173
|
-
|
|
173
|
+
const e = !Q && !i.defaultPosition, t = () => {
|
|
174
|
+
W({
|
|
174
175
|
center: e
|
|
175
|
-
}),
|
|
176
|
+
}), Q = !0;
|
|
176
177
|
};
|
|
177
178
|
if (typeof requestAnimationFrame > "u") {
|
|
178
|
-
|
|
179
|
+
t();
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
181
|
-
requestAnimationFrame(
|
|
182
|
-
}),
|
|
182
|
+
requestAnimationFrame(t);
|
|
183
|
+
}), S(() => {
|
|
183
184
|
if (!i.open) return;
|
|
184
|
-
const e = (
|
|
185
|
-
if (
|
|
185
|
+
const e = (t) => {
|
|
186
|
+
if (t.key !== "Escape") return;
|
|
186
187
|
const o = typeof document < "u" ? document.activeElement : null;
|
|
187
|
-
!
|
|
188
|
+
!k(t.target) && !k(o) || (t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation(), i.onOpenChange(!1));
|
|
188
189
|
};
|
|
189
|
-
document.addEventListener("keydown", e, !0),
|
|
190
|
-
}),
|
|
190
|
+
document.addEventListener("keydown", e, !0), T(() => document.removeEventListener("keydown", e, !0));
|
|
191
|
+
}), S(() => {
|
|
191
192
|
if (!i.open) {
|
|
192
|
-
|
|
193
|
+
F(!1), O(l ?? void 0, !1);
|
|
193
194
|
return;
|
|
194
195
|
}
|
|
195
|
-
|
|
196
|
-
}),
|
|
196
|
+
F(!0);
|
|
197
|
+
}), S(() => {
|
|
197
198
|
if (!i.open) return;
|
|
198
|
-
const e = (
|
|
199
|
-
|
|
200
|
-
},
|
|
201
|
-
e(
|
|
202
|
-
}, o = (
|
|
203
|
-
e(
|
|
199
|
+
const e = (w) => {
|
|
200
|
+
F(k(w));
|
|
201
|
+
}, t = (w) => {
|
|
202
|
+
e(w.target);
|
|
203
|
+
}, o = (w) => {
|
|
204
|
+
e(w.target);
|
|
204
205
|
};
|
|
205
|
-
document.addEventListener("pointerdown",
|
|
206
|
-
document.removeEventListener("pointerdown",
|
|
206
|
+
document.addEventListener("pointerdown", t), document.addEventListener("focusin", o), T(() => {
|
|
207
|
+
document.removeEventListener("pointerdown", t), document.removeEventListener("focusin", o);
|
|
207
208
|
});
|
|
208
|
-
}),
|
|
209
|
+
}), S(() => {
|
|
209
210
|
if (!i.open) return;
|
|
210
|
-
const e =
|
|
211
|
-
l === null ?
|
|
211
|
+
const e = D();
|
|
212
|
+
l === null ? ee(e) : z = e;
|
|
212
213
|
});
|
|
213
|
-
const
|
|
214
|
-
!
|
|
214
|
+
const Se = (e) => {
|
|
215
|
+
!X() || d() || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"]') || (e.preventDefault(), l = e.pointerId, p = "drag", N(!0), G = {
|
|
215
216
|
x: e.clientX,
|
|
216
217
|
y: e.clientY
|
|
217
|
-
},
|
|
218
|
+
}, V = {
|
|
218
219
|
...z
|
|
219
220
|
}, P = {
|
|
220
221
|
x: e.clientX,
|
|
221
222
|
y: e.clientY
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
!
|
|
225
|
-
x:
|
|
226
|
-
y:
|
|
227
|
-
},
|
|
223
|
+
}, L(!0, "grabbing"), typeof r?.setPointerCapture == "function" && r.setPointerCapture(e.pointerId));
|
|
224
|
+
}, f = (e) => (t) => {
|
|
225
|
+
!H() || d() || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), l = t.pointerId, p = "resize", j(!0), K = e, Z = {
|
|
226
|
+
x: t.clientX,
|
|
227
|
+
y: t.clientY
|
|
228
|
+
}, J = {
|
|
228
229
|
...z
|
|
229
230
|
}, P = {
|
|
230
|
-
x:
|
|
231
|
-
y:
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
},
|
|
236
|
-
if (!(l === null || e.pointerId !== l) &&
|
|
231
|
+
x: t.clientX,
|
|
232
|
+
y: t.clientY
|
|
233
|
+
}, L(!0, ye[e]), typeof r?.setPointerCapture == "function" && r.setPointerCapture(t.pointerId));
|
|
234
|
+
}, ne = () => {
|
|
235
|
+
x = null, te();
|
|
236
|
+
}, Ie = (e) => {
|
|
237
|
+
if (!(l === null || e.pointerId !== l) && p !== null && (P = {
|
|
237
238
|
x: e.clientX,
|
|
238
239
|
y: e.clientY
|
|
239
|
-
},
|
|
240
|
+
}, x === null)) {
|
|
240
241
|
if (typeof requestAnimationFrame > "u") {
|
|
241
|
-
|
|
242
|
+
ne();
|
|
242
243
|
return;
|
|
243
244
|
}
|
|
244
|
-
|
|
245
|
+
x = requestAnimationFrame(ne);
|
|
245
246
|
}
|
|
246
|
-
},
|
|
247
|
+
}, ie = (e) => {
|
|
247
248
|
l === null || e.pointerId !== l || (P = {
|
|
248
249
|
x: e.clientX,
|
|
249
250
|
y: e.clientY
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
if (l !== null &&
|
|
253
|
-
const
|
|
254
|
-
|
|
251
|
+
}, O(e.pointerId));
|
|
252
|
+
}, re = () => {
|
|
253
|
+
if (l !== null && O(l, !0), d()) {
|
|
254
|
+
const t = xe();
|
|
255
|
+
t && $(ce({
|
|
255
256
|
rect: {
|
|
256
|
-
x:
|
|
257
|
-
y:
|
|
258
|
-
width:
|
|
259
|
-
height:
|
|
257
|
+
x: t.position.x,
|
|
258
|
+
y: t.position.y,
|
|
259
|
+
width: t.size.width,
|
|
260
|
+
height: t.size.height
|
|
260
261
|
},
|
|
261
|
-
minSize:
|
|
262
|
-
maxSize:
|
|
262
|
+
minSize: R(),
|
|
263
|
+
maxSize: C(),
|
|
263
264
|
viewport: {
|
|
264
265
|
width: window.innerWidth,
|
|
265
266
|
height: window.innerHeight
|
|
266
267
|
},
|
|
267
268
|
mobile: b(),
|
|
268
|
-
mobilePadding:
|
|
269
|
+
mobilePadding: E,
|
|
269
270
|
center: !1
|
|
270
|
-
})),
|
|
271
|
+
})), Y(!1);
|
|
271
272
|
return;
|
|
272
273
|
}
|
|
273
|
-
const e =
|
|
274
|
-
|
|
274
|
+
const e = D();
|
|
275
|
+
ze({
|
|
275
276
|
position: {
|
|
276
277
|
x: e.x,
|
|
277
278
|
y: e.y
|
|
@@ -280,17 +281,17 @@ function dt(i) {
|
|
|
280
281
|
width: e.width,
|
|
281
282
|
height: e.height
|
|
282
283
|
}
|
|
283
|
-
}),
|
|
284
|
+
}), $({
|
|
284
285
|
x: 0,
|
|
285
286
|
y: 0,
|
|
286
287
|
width: window.innerWidth,
|
|
287
288
|
height: window.innerHeight
|
|
288
|
-
}),
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
-
},
|
|
289
|
+
}), Y(!0);
|
|
290
|
+
}, _e = () => {
|
|
291
|
+
re();
|
|
292
|
+
}, Re = (e) => {
|
|
293
|
+
Pe(e.target) && be();
|
|
294
|
+
}, h = (e) => _("absolute z-10", {
|
|
294
295
|
n: "cursor-ns-resize top-0 left-2 right-2 h-1",
|
|
295
296
|
s: "cursor-ns-resize bottom-0 left-2 right-2 h-1",
|
|
296
297
|
e: "cursor-ew-resize right-0 top-2 bottom-2 w-1",
|
|
@@ -300,131 +301,149 @@ function dt(i) {
|
|
|
300
301
|
se: "cursor-nwse-resize bottom-0 right-0 w-2 h-2",
|
|
301
302
|
sw: "cursor-nesw-resize bottom-0 left-0 w-2 h-2"
|
|
302
303
|
}[e]);
|
|
303
|
-
return
|
|
304
|
+
return a(y, {
|
|
304
305
|
get when() {
|
|
305
306
|
return i.open;
|
|
306
307
|
},
|
|
307
308
|
get children() {
|
|
308
|
-
return
|
|
309
|
+
return a(Ee, {
|
|
309
310
|
get children() {
|
|
310
|
-
var e =
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
311
|
+
var e = Qe(), t = e.firstChild, o = t.firstChild, w = o.firstChild, oe = w.nextSibling, Ce = o.nextSibling, le = r;
|
|
312
|
+
return typeof le == "function" ? Me(le, e) : r = e, ae(e, se({
|
|
313
|
+
[fe]: "true"
|
|
314
|
+
}, {
|
|
315
|
+
get class() {
|
|
316
|
+
return _("fixed left-0 top-0 z-[100] flex flex-col", (q() || B()) && "select-none");
|
|
317
|
+
},
|
|
318
|
+
get style() {
|
|
319
|
+
return {
|
|
320
|
+
width: `${M().width}px`,
|
|
321
|
+
height: `${M().height}px`,
|
|
322
|
+
transform: `translate3d(${A().x}px, ${A().y}px, 0)`,
|
|
323
|
+
"z-index": he(),
|
|
324
|
+
"will-change": q() ? "transform" : B() ? "transform, width, height" : void 0
|
|
325
|
+
};
|
|
326
|
+
},
|
|
327
|
+
onPointerMove: Ie,
|
|
328
|
+
onPointerUp: ie,
|
|
329
|
+
onPointerCancel: ie,
|
|
330
|
+
role: "dialog",
|
|
331
|
+
get "aria-labelledby"() {
|
|
332
|
+
return de(() => !!i.title)() ? U() : void 0;
|
|
333
|
+
},
|
|
334
|
+
tabIndex: -1,
|
|
335
|
+
onPointerDown: Re
|
|
336
|
+
}), !1, !0), ae(t, se({
|
|
337
|
+
get "data-floe-floating-window-state"() {
|
|
338
|
+
return ve() ? "active" : "inactive";
|
|
339
|
+
}
|
|
340
|
+
}, {
|
|
341
|
+
[fe]: "true"
|
|
342
|
+
}, {
|
|
343
|
+
get class() {
|
|
344
|
+
return _("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "animate-in fade-in duration-150", d() && "rounded-none", i.class);
|
|
345
|
+
}
|
|
346
|
+
}), !1, !0), o.$$dblclick = _e, o.$$pointerdown = Se, g(w, a(y, {
|
|
314
347
|
get when() {
|
|
315
348
|
return i.title;
|
|
316
349
|
},
|
|
317
350
|
get children() {
|
|
318
|
-
var
|
|
319
|
-
return
|
|
351
|
+
var n = Ye();
|
|
352
|
+
return g(n, () => i.title), u(() => Ae(n, "id", U())), n;
|
|
320
353
|
}
|
|
321
|
-
})),
|
|
354
|
+
})), g(oe, a(ue, {
|
|
322
355
|
variant: "ghost",
|
|
323
356
|
size: "icon",
|
|
324
357
|
class: "h-6 w-6",
|
|
325
|
-
onClick: (
|
|
326
|
-
|
|
358
|
+
onClick: (n) => {
|
|
359
|
+
n.stopPropagation(), re();
|
|
327
360
|
},
|
|
328
361
|
get "aria-label"() {
|
|
329
362
|
return d() ? "Restore" : "Maximize";
|
|
330
363
|
},
|
|
331
364
|
get children() {
|
|
332
|
-
return
|
|
365
|
+
return a(y, {
|
|
333
366
|
get when() {
|
|
334
367
|
return d();
|
|
335
368
|
},
|
|
336
369
|
get fallback() {
|
|
337
|
-
return
|
|
370
|
+
return a(Te, {
|
|
338
371
|
class: "w-3 h-3"
|
|
339
372
|
});
|
|
340
373
|
},
|
|
341
374
|
get children() {
|
|
342
|
-
return
|
|
375
|
+
return a(Oe, {
|
|
343
376
|
class: "w-3 h-3"
|
|
344
377
|
});
|
|
345
378
|
}
|
|
346
379
|
});
|
|
347
380
|
}
|
|
348
|
-
}), null),
|
|
381
|
+
}), null), g(oe, a(ue, {
|
|
349
382
|
variant: "ghost-destructive",
|
|
350
383
|
size: "icon",
|
|
351
384
|
class: "h-6 w-6",
|
|
352
|
-
onClick: (
|
|
353
|
-
|
|
385
|
+
onClick: (n) => {
|
|
386
|
+
n.stopPropagation(), i.onOpenChange(!1);
|
|
354
387
|
},
|
|
355
388
|
"aria-label": "Close",
|
|
356
389
|
get children() {
|
|
357
|
-
return
|
|
390
|
+
return a(He, {
|
|
358
391
|
class: "w-3.5 h-3.5"
|
|
359
392
|
});
|
|
360
393
|
}
|
|
361
|
-
}), null),
|
|
394
|
+
}), null), g(Ce, () => i.children), g(t, a(y, {
|
|
362
395
|
get when() {
|
|
363
396
|
return i.footer;
|
|
364
397
|
},
|
|
365
398
|
get children() {
|
|
366
|
-
var
|
|
367
|
-
return
|
|
399
|
+
var n = qe();
|
|
400
|
+
return g(n, () => i.footer), n;
|
|
368
401
|
}
|
|
369
|
-
}), null),
|
|
402
|
+
}), null), g(t, a(y, {
|
|
370
403
|
get when() {
|
|
371
|
-
return
|
|
404
|
+
return de(() => !!H())() && !d();
|
|
372
405
|
},
|
|
373
406
|
get children() {
|
|
374
407
|
return [(() => {
|
|
375
|
-
var
|
|
376
|
-
return
|
|
408
|
+
var n = Ne();
|
|
409
|
+
return m(n, "pointerdown", f("n"), !0), u(() => c(n, h("n"))), n;
|
|
377
410
|
})(), (() => {
|
|
378
|
-
var
|
|
379
|
-
return
|
|
380
|
-
})(),
|
|
411
|
+
var n = Be();
|
|
412
|
+
return m(n, "pointerdown", f("s"), !0), u(() => c(n, h("s"))), n;
|
|
413
|
+
})(), a(y, {
|
|
381
414
|
get when() {
|
|
382
415
|
return !b();
|
|
383
416
|
},
|
|
384
417
|
get children() {
|
|
385
418
|
return [(() => {
|
|
386
|
-
var
|
|
387
|
-
return
|
|
419
|
+
var n = je();
|
|
420
|
+
return m(n, "pointerdown", f("e"), !0), u(() => c(n, h("e"))), n;
|
|
388
421
|
})(), (() => {
|
|
389
|
-
var
|
|
390
|
-
return
|
|
422
|
+
var n = Ge();
|
|
423
|
+
return m(n, "pointerdown", f("w"), !0), u(() => c(n, h("w"))), n;
|
|
391
424
|
})(), (() => {
|
|
392
|
-
var
|
|
393
|
-
return
|
|
425
|
+
var n = Ve();
|
|
426
|
+
return m(n, "pointerdown", f("ne"), !0), u(() => c(n, h("ne"))), n;
|
|
394
427
|
})(), (() => {
|
|
395
|
-
var
|
|
396
|
-
return
|
|
428
|
+
var n = Ze();
|
|
429
|
+
return m(n, "pointerdown", f("nw"), !0), u(() => c(n, h("nw"))), n;
|
|
397
430
|
})(), (() => {
|
|
398
|
-
var
|
|
399
|
-
return
|
|
431
|
+
var n = Je();
|
|
432
|
+
return m(n, "pointerdown", f("se"), !0), u(() => c(n, h("se"))), n;
|
|
400
433
|
})(), (() => {
|
|
401
|
-
var
|
|
402
|
-
return
|
|
434
|
+
var n = Ke();
|
|
435
|
+
return m(n, "pointerdown", f("sw"), !0), u(() => c(n, h("sw"))), n;
|
|
403
436
|
})()];
|
|
404
437
|
}
|
|
405
438
|
})];
|
|
406
439
|
}
|
|
407
|
-
}), null), u((
|
|
408
|
-
var ue = C("fixed left-0 top-0 z-[100] flex flex-col", (j() || V()) && "select-none"), ce = `${A().width}px`, fe = `${A().height}px`, he = `translate3d(${_().x}px, ${_().y}px, 0)`, we = be(), ge = j() ? "transform" : V() ? "transform, width, height" : void 0, me = i.title ? U() : void 0, ve = Re() ? "active" : "inactive", xe = C("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "animate-in fade-in duration-150", d() && "rounded-none", i.class), ye = C("flex items-center justify-between h-9 px-3", "border-b", d() ? "rounded-none" : "rounded-t-md", B() && !d() && "cursor-move");
|
|
409
|
-
return ue !== t.e && a(e, t.e = ue), ce !== t.t && I(e, "width", t.t = ce), fe !== t.a && I(e, "height", t.a = fe), he !== t.o && I(e, "transform", t.o = he), we !== t.i && I(e, "z-index", t.i = we), ge !== t.n && I(e, "will-change", t.n = ge), me !== t.s && Y(e, "aria-labelledby", t.s = me), ve !== t.h && Y(n, "data-floe-floating-window-state", t.h = ve), xe !== t.r && a(n, t.r = xe), ye !== t.d && a(o, t.d = ye), t;
|
|
410
|
-
}, {
|
|
411
|
-
e: void 0,
|
|
412
|
-
t: void 0,
|
|
413
|
-
a: void 0,
|
|
414
|
-
o: void 0,
|
|
415
|
-
i: void 0,
|
|
416
|
-
n: void 0,
|
|
417
|
-
s: void 0,
|
|
418
|
-
h: void 0,
|
|
419
|
-
r: void 0,
|
|
420
|
-
d: void 0
|
|
421
|
-
}), e;
|
|
440
|
+
}), null), u(() => c(o, _("flex items-center justify-between h-9 px-3", "border-b", d() ? "rounded-none" : "rounded-t-md", X() && !d() && "cursor-move"))), e;
|
|
422
441
|
}
|
|
423
442
|
});
|
|
424
443
|
}
|
|
425
444
|
});
|
|
426
445
|
}
|
|
427
|
-
|
|
446
|
+
Fe(["pointerdown", "dblclick"]);
|
|
428
447
|
export {
|
|
429
448
|
dt as FloatingWindow
|
|
430
449
|
};
|
|
@@ -1,208 +1,229 @@
|
|
|
1
|
-
import { createSignal as _, createMemo as
|
|
2
|
-
import { ArrowUp as
|
|
3
|
-
import { getTopZIndex as
|
|
4
|
-
import { resolveWorkbenchWidgetDefinitions as
|
|
5
|
-
function
|
|
6
|
-
const [
|
|
7
|
-
|
|
8
|
-
),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { createSignal as _, createMemo as d, onCleanup as mt } from "solid-js";
|
|
2
|
+
import { ArrowUp as Wt, Copy as xt, Trash as St } from "../icons/index.js";
|
|
3
|
+
import { getTopZIndex as Ct, createContextMenuPosition as pt, createWorkbenchId as kt, findNearestWidget as Ft, clampScale as Xt, WORKBENCH_CANVAS_ZOOM_STEP as P, WORKBENCH_CONTEXT_MENU_WIDTH_PX as bt, estimateContextMenuHeight as Mt } from "./workbenchHelpers.js";
|
|
4
|
+
import { resolveWorkbenchWidgetDefinitions as Yt, getWidgetEntry as Z, createWorkbenchFilterState as yt } from "./widgets/widgetRegistry.js";
|
|
5
|
+
function Nt(s) {
|
|
6
|
+
const [m, W] = _(null), [$, A] = _(null), [j, K] = _({ width: 0, height: 0 });
|
|
7
|
+
let r = null, x = null;
|
|
8
|
+
const a = s.state, h = d(() => a().widgets), u = d(() => a().viewport), L = d(() => a().locked), D = d(() => a().filters), k = d(() => a().selectedWidgetId), F = d(() => Ct(h())), U = d(() => `${Math.round(u().scale * 100)}%`), G = () => typeof s.widgetDefinitions == "function" ? s.widgetDefinitions() : s.widgetDefinitions, f = d(
|
|
9
|
+
() => Yt(G())
|
|
10
|
+
), X = (t, e) => {
|
|
11
|
+
const n = Number.isFinite(t) && t > 0 ? t : 0, i = Number.isFinite(e) && e > 0 ? e : 0, o = { width: n, height: i }, c = j();
|
|
12
|
+
return c.width === n && c.height === i ? c : (K(o), o);
|
|
13
|
+
}, T = () => {
|
|
14
|
+
x?.disconnect(), x = null;
|
|
15
|
+
}, w = () => r ? X(r.clientWidth, r.clientHeight) : X(0, 0), J = (t) => {
|
|
16
|
+
if (r === (t ?? null)) {
|
|
17
|
+
w();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
T(), r = t ?? null, w(), !(!r || typeof ResizeObserver > "u") && (x = new ResizeObserver((e) => {
|
|
21
|
+
const n = e[0];
|
|
22
|
+
X(
|
|
23
|
+
n?.contentRect.width ?? r?.clientWidth ?? 0,
|
|
24
|
+
n?.contentRect.height ?? r?.clientHeight ?? 0
|
|
25
|
+
);
|
|
26
|
+
}), x.observe(r));
|
|
27
|
+
};
|
|
28
|
+
mt(() => {
|
|
29
|
+
T(), r = null;
|
|
30
|
+
});
|
|
31
|
+
const Q = (t) => {
|
|
32
|
+
W({
|
|
12
33
|
clientX: t.clientX,
|
|
13
34
|
clientY: t.clientY,
|
|
14
35
|
worldX: t.worldX,
|
|
15
36
|
worldY: t.worldY
|
|
16
37
|
});
|
|
17
|
-
},
|
|
18
|
-
|
|
38
|
+
}, tt = (t, e) => {
|
|
39
|
+
S(e.id), W({
|
|
19
40
|
clientX: t.clientX,
|
|
20
41
|
clientY: t.clientY,
|
|
21
42
|
worldX: e.x,
|
|
22
43
|
worldY: e.y,
|
|
23
44
|
widgetId: e.id
|
|
24
45
|
});
|
|
25
|
-
}, g = () =>
|
|
26
|
-
const t =
|
|
46
|
+
}, g = () => W(null), et = (t) => a().widgets.find((e) => e.id === t) ?? null, b = (t) => a().widgets.find((e) => e.type === t) ?? null, N = d(() => {
|
|
47
|
+
const t = m();
|
|
27
48
|
if (!t) return [];
|
|
28
49
|
if (t.widgetId) {
|
|
29
|
-
const e =
|
|
50
|
+
const e = h().find((i) => i.id === t.widgetId), n = [];
|
|
30
51
|
return e && (n.push({
|
|
31
52
|
id: "bring-to-front",
|
|
32
53
|
kind: "action",
|
|
33
54
|
label: "Bring to Front",
|
|
34
|
-
icon:
|
|
55
|
+
icon: Wt,
|
|
35
56
|
onSelect: () => {
|
|
36
|
-
|
|
57
|
+
S(e.id), g();
|
|
37
58
|
}
|
|
38
59
|
}), n.push({
|
|
39
60
|
id: "duplicate",
|
|
40
61
|
kind: "action",
|
|
41
62
|
label: "Duplicate",
|
|
42
|
-
icon:
|
|
63
|
+
icon: xt,
|
|
43
64
|
onSelect: () => {
|
|
44
|
-
|
|
65
|
+
R(e.type, e.x + 32, e.y + 32), g();
|
|
45
66
|
}
|
|
46
67
|
})), n.push({ id: "separator-delete", kind: "separator" }), n.push({
|
|
47
68
|
id: "delete",
|
|
48
69
|
kind: "action",
|
|
49
70
|
label: "Delete",
|
|
50
|
-
icon:
|
|
71
|
+
icon: St,
|
|
51
72
|
destructive: !0,
|
|
52
73
|
onSelect: () => {
|
|
53
|
-
t.widgetId &&
|
|
74
|
+
t.widgetId && y(t.widgetId), g();
|
|
54
75
|
}
|
|
55
76
|
}), n;
|
|
56
77
|
}
|
|
57
|
-
return
|
|
78
|
+
return f().map((e) => ({
|
|
58
79
|
id: `add-${e.type}`,
|
|
59
80
|
kind: "action",
|
|
60
81
|
label: `Add ${e.label}`,
|
|
61
82
|
icon: e.icon,
|
|
62
83
|
onSelect: () => {
|
|
63
|
-
|
|
84
|
+
Y(e.type, t.worldX, t.worldY), g();
|
|
64
85
|
}
|
|
65
86
|
}));
|
|
66
|
-
}),
|
|
67
|
-
const t =
|
|
87
|
+
}), nt = d(() => {
|
|
88
|
+
const t = m();
|
|
68
89
|
if (!t) return;
|
|
69
|
-
const e =
|
|
70
|
-
return
|
|
90
|
+
const e = N(), n = e.filter((o) => o.kind === "action").length, i = e.filter((o) => o.kind === "separator").length;
|
|
91
|
+
return pt({
|
|
71
92
|
clientX: t.clientX,
|
|
72
93
|
clientY: t.clientY,
|
|
73
|
-
menuWidth:
|
|
74
|
-
menuHeight:
|
|
94
|
+
menuWidth: bt,
|
|
95
|
+
menuHeight: Mt(n, i)
|
|
75
96
|
});
|
|
76
|
-
}),
|
|
77
|
-
const i =
|
|
97
|
+
}), M = (t, e, n) => {
|
|
98
|
+
const i = Z(t, f()), o = i.singleton ? b(t) : null;
|
|
78
99
|
if (o)
|
|
79
|
-
return
|
|
80
|
-
const
|
|
81
|
-
id:
|
|
100
|
+
return C(o, { centerViewport: !0 });
|
|
101
|
+
const c = i.defaultSize, l = {
|
|
102
|
+
id: kt(),
|
|
82
103
|
type: t,
|
|
83
104
|
title: i.defaultTitle,
|
|
84
105
|
x: e,
|
|
85
106
|
y: n,
|
|
86
|
-
width:
|
|
87
|
-
height:
|
|
88
|
-
z_index:
|
|
107
|
+
width: c.width,
|
|
108
|
+
height: c.height,
|
|
109
|
+
z_index: F() + 1,
|
|
89
110
|
created_at_unix_ms: Date.now()
|
|
90
111
|
};
|
|
91
|
-
return
|
|
92
|
-
...
|
|
93
|
-
widgets: [...
|
|
94
|
-
selectedWidgetId:
|
|
95
|
-
})),
|
|
96
|
-
},
|
|
97
|
-
const i =
|
|
98
|
-
return
|
|
99
|
-
},
|
|
100
|
-
|
|
112
|
+
return s.setState((p) => ({
|
|
113
|
+
...p,
|
|
114
|
+
widgets: [...p.widgets, l],
|
|
115
|
+
selectedWidgetId: l.id
|
|
116
|
+
})), l;
|
|
117
|
+
}, Y = (t, e, n) => {
|
|
118
|
+
const i = Z(t, f()).defaultSize;
|
|
119
|
+
return M(t, e - i.width / 2, n - i.height / 2);
|
|
120
|
+
}, R = (t, e, n) => M(t, e, n), y = (t) => {
|
|
121
|
+
s.setState((e) => ({
|
|
101
122
|
...e,
|
|
102
123
|
widgets: e.widgets.filter((n) => n.id !== t),
|
|
103
124
|
selectedWidgetId: e.selectedWidgetId === t ? null : e.selectedWidgetId
|
|
104
125
|
}));
|
|
105
|
-
},
|
|
126
|
+
}, it = (t) => {
|
|
106
127
|
A(t);
|
|
107
|
-
},
|
|
128
|
+
}, S = (t) => {
|
|
108
129
|
A(t);
|
|
109
|
-
const e =
|
|
110
|
-
n && n.z_index < e &&
|
|
130
|
+
const e = F(), n = h().find((i) => i.id === t);
|
|
131
|
+
n && n.z_index < e && s.setState((i) => ({
|
|
111
132
|
...i,
|
|
112
133
|
widgets: i.widgets.map(
|
|
113
134
|
(o) => o.id === t ? { ...o, z_index: e + 1 } : o
|
|
114
135
|
)
|
|
115
136
|
}));
|
|
116
|
-
},
|
|
117
|
-
|
|
137
|
+
}, ot = (t, e) => {
|
|
138
|
+
s.setState((n) => ({
|
|
118
139
|
...n,
|
|
119
140
|
widgets: n.widgets.map(
|
|
120
141
|
(i) => i.id === t ? { ...i, x: e.x, y: e.y } : i
|
|
121
142
|
)
|
|
122
143
|
}));
|
|
123
|
-
},
|
|
124
|
-
|
|
144
|
+
}, st = (t, e) => {
|
|
145
|
+
s.setState((n) => ({
|
|
125
146
|
...n,
|
|
126
147
|
widgets: n.widgets.map(
|
|
127
148
|
(i) => i.id === t ? { ...i, width: e.width, height: e.height } : i
|
|
128
149
|
)
|
|
129
150
|
}));
|
|
130
151
|
}, I = (t) => {
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
const e =
|
|
134
|
-
t === "in" ? e.scale *
|
|
135
|
-
),
|
|
136
|
-
x: n.width / 2 - i *
|
|
137
|
-
y: n.height / 2 - o *
|
|
138
|
-
scale:
|
|
152
|
+
s.setState((e) => ({ ...e, viewport: t }));
|
|
153
|
+
}, V = (t) => {
|
|
154
|
+
const e = u(), n = w(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, c = Xt(
|
|
155
|
+
t === "in" ? e.scale * P : e.scale / P
|
|
156
|
+
), l = {
|
|
157
|
+
x: n.width / 2 - i * c,
|
|
158
|
+
y: n.height / 2 - o * c,
|
|
159
|
+
scale: c
|
|
139
160
|
};
|
|
140
|
-
I(
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
|
|
161
|
+
I(l);
|
|
162
|
+
}, ct = () => {
|
|
163
|
+
s.setState((t) => ({ ...t, locked: !t.locked }));
|
|
164
|
+
}, rt = (t) => {
|
|
165
|
+
s.setState((e) => ({
|
|
145
166
|
...e,
|
|
146
167
|
filters: { ...e.filters, [t]: !e.filters[t] }
|
|
147
168
|
}));
|
|
148
|
-
},
|
|
149
|
-
|
|
169
|
+
}, dt = (t) => {
|
|
170
|
+
s.setState((e) => {
|
|
150
171
|
const n = { ...e.filters };
|
|
151
172
|
for (const i of Object.keys(n))
|
|
152
173
|
n[i] = i === t;
|
|
153
174
|
return { ...e, filters: n };
|
|
154
175
|
});
|
|
155
|
-
},
|
|
156
|
-
const t =
|
|
157
|
-
|
|
176
|
+
}, lt = () => {
|
|
177
|
+
const t = yt(f());
|
|
178
|
+
s.setState((e) => ({
|
|
158
179
|
...e,
|
|
159
180
|
filters: t
|
|
160
181
|
}));
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
const t =
|
|
182
|
+
}, H = (t) => {
|
|
183
|
+
s.setState((e) => ({ ...e, selectedWidgetId: t }));
|
|
184
|
+
}, at = () => {
|
|
185
|
+
const t = w(), e = u();
|
|
165
186
|
return {
|
|
166
187
|
worldX: t.width > 0 ? (t.width / 2 - e.x) / e.scale : 240,
|
|
167
188
|
worldY: t.height > 0 ? (t.height / 2 - e.y) / e.scale : 180
|
|
168
189
|
};
|
|
169
190
|
};
|
|
170
|
-
let
|
|
171
|
-
const
|
|
172
|
-
const i =
|
|
173
|
-
if (
|
|
174
|
-
const
|
|
191
|
+
let E = 0;
|
|
192
|
+
const ut = (t, e, n) => {
|
|
193
|
+
const i = u(), o = i.x, c = i.y, l = i.scale, p = performance.now(), gt = 360, ht = ++E, ft = (v) => 1 - Math.pow(1 - v, 3), q = (v) => {
|
|
194
|
+
if (ht !== E) return;
|
|
195
|
+
const wt = v - p, B = Math.min(Math.max(wt / gt, 0), 1), O = ft(B);
|
|
175
196
|
I({
|
|
176
|
-
x: o + (t - o) *
|
|
177
|
-
y:
|
|
178
|
-
scale:
|
|
179
|
-
}),
|
|
197
|
+
x: o + (t - o) * O,
|
|
198
|
+
y: c + (e - c) * O,
|
|
199
|
+
scale: l + (n - l) * O
|
|
200
|
+
}), B < 1 && requestAnimationFrame(q);
|
|
180
201
|
};
|
|
181
|
-
requestAnimationFrame(
|
|
182
|
-
},
|
|
183
|
-
const e =
|
|
202
|
+
requestAnimationFrame(q);
|
|
203
|
+
}, z = (t) => {
|
|
204
|
+
const e = w();
|
|
184
205
|
if (e.width === 0 || e.height === 0) return;
|
|
185
|
-
const n =
|
|
186
|
-
|
|
187
|
-
},
|
|
206
|
+
const n = u(), i = e.width / 2 - (t.x + t.width / 2) * n.scale, o = e.height / 2 - (t.y + t.height / 2) * n.scale;
|
|
207
|
+
ut(i, o, n.scale);
|
|
208
|
+
}, C = (t, e = {}) => (H(t.id), S(t.id), e.centerViewport !== !1 && z(t), t);
|
|
188
209
|
return {
|
|
189
|
-
widgets:
|
|
190
|
-
viewport:
|
|
191
|
-
locked:
|
|
210
|
+
widgets: h,
|
|
211
|
+
viewport: u,
|
|
212
|
+
locked: L,
|
|
192
213
|
filters: D,
|
|
193
|
-
selectedWidgetId:
|
|
194
|
-
topZIndex:
|
|
195
|
-
scaleLabel:
|
|
196
|
-
optimisticFrontWidgetId:
|
|
197
|
-
widgetDefinitions:
|
|
198
|
-
setCanvasFrameRef:
|
|
214
|
+
selectedWidgetId: k,
|
|
215
|
+
topZIndex: F,
|
|
216
|
+
scaleLabel: U,
|
|
217
|
+
optimisticFrontWidgetId: $,
|
|
218
|
+
widgetDefinitions: f,
|
|
219
|
+
setCanvasFrameRef: J,
|
|
199
220
|
contextMenu: {
|
|
200
|
-
state:
|
|
201
|
-
items:
|
|
202
|
-
position:
|
|
221
|
+
state: m,
|
|
222
|
+
items: N,
|
|
223
|
+
position: nt,
|
|
203
224
|
close: g,
|
|
204
225
|
retarget: (t) => {
|
|
205
|
-
t.preventDefault(), t.stopPropagation(),
|
|
226
|
+
t.preventDefault(), t.stopPropagation(), W({
|
|
206
227
|
clientX: t.clientX,
|
|
207
228
|
clientY: t.clientY,
|
|
208
229
|
worldX: 0,
|
|
@@ -211,74 +232,74 @@ function At(c) {
|
|
|
211
232
|
}
|
|
212
233
|
},
|
|
213
234
|
canvas: {
|
|
214
|
-
openCanvasContextMenu:
|
|
215
|
-
openWidgetContextMenu:
|
|
216
|
-
selectWidget:
|
|
217
|
-
startOptimisticFront:
|
|
218
|
-
commitFront:
|
|
219
|
-
commitMove:
|
|
220
|
-
commitResize:
|
|
235
|
+
openCanvasContextMenu: Q,
|
|
236
|
+
openWidgetContextMenu: tt,
|
|
237
|
+
selectWidget: H,
|
|
238
|
+
startOptimisticFront: it,
|
|
239
|
+
commitFront: S,
|
|
240
|
+
commitMove: ot,
|
|
241
|
+
commitResize: st,
|
|
221
242
|
commitViewport: I
|
|
222
243
|
},
|
|
223
244
|
hud: {
|
|
224
|
-
zoomIn: () =>
|
|
225
|
-
zoomOut: () =>
|
|
245
|
+
zoomIn: () => V("in"),
|
|
246
|
+
zoomOut: () => V("out")
|
|
226
247
|
},
|
|
227
248
|
lock: {
|
|
228
|
-
toggle:
|
|
249
|
+
toggle: ct
|
|
229
250
|
},
|
|
230
251
|
filter: {
|
|
231
|
-
toggle:
|
|
232
|
-
solo:
|
|
233
|
-
showAll:
|
|
252
|
+
toggle: rt,
|
|
253
|
+
solo: dt,
|
|
254
|
+
showAll: lt
|
|
234
255
|
},
|
|
235
256
|
navigation: {
|
|
236
257
|
handleArrowNavigation: (t) => {
|
|
237
|
-
const e =
|
|
238
|
-
|
|
239
|
-
|
|
258
|
+
const e = Ft(
|
|
259
|
+
h(),
|
|
260
|
+
k(),
|
|
240
261
|
t,
|
|
241
262
|
D()
|
|
242
263
|
);
|
|
243
|
-
e &&
|
|
264
|
+
e && C(e);
|
|
244
265
|
},
|
|
245
|
-
centerOnWidget:
|
|
246
|
-
focusWidget:
|
|
266
|
+
centerOnWidget: z,
|
|
267
|
+
focusWidget: C
|
|
247
268
|
},
|
|
248
269
|
widgetActions: {
|
|
249
270
|
deleteSelected: () => {
|
|
250
|
-
const t =
|
|
251
|
-
t &&
|
|
271
|
+
const t = k();
|
|
272
|
+
t && y(t);
|
|
252
273
|
},
|
|
253
|
-
deleteWidget:
|
|
254
|
-
addWidget:
|
|
255
|
-
addWidgetAtCursor:
|
|
256
|
-
addWidgetCentered:
|
|
274
|
+
deleteWidget: y,
|
|
275
|
+
addWidget: M,
|
|
276
|
+
addWidgetAtCursor: Y,
|
|
277
|
+
addWidgetCentered: R,
|
|
257
278
|
ensureWidget: (t, e) => {
|
|
258
|
-
const n =
|
|
279
|
+
const n = b(t);
|
|
259
280
|
if (n)
|
|
260
|
-
return
|
|
261
|
-
const i =
|
|
281
|
+
return C(n, { centerViewport: e?.centerViewport ?? !0 });
|
|
282
|
+
const i = at(), o = Y(
|
|
262
283
|
t,
|
|
263
284
|
e?.worldX ?? i.worldX,
|
|
264
285
|
e?.worldY ?? i.worldY
|
|
265
286
|
);
|
|
266
|
-
return (e?.centerViewport ?? !0) && o &&
|
|
287
|
+
return (e?.centerViewport ?? !0) && o && z(o), o;
|
|
267
288
|
}
|
|
268
289
|
},
|
|
269
290
|
queries: {
|
|
270
|
-
findWidgetByType:
|
|
271
|
-
findWidgetById:
|
|
291
|
+
findWidgetByType: b,
|
|
292
|
+
findWidgetById: et
|
|
272
293
|
},
|
|
273
294
|
handleCloseRequest: () => {
|
|
274
|
-
if (
|
|
295
|
+
if (m()) {
|
|
275
296
|
g();
|
|
276
297
|
return;
|
|
277
298
|
}
|
|
278
|
-
|
|
299
|
+
s.onClose();
|
|
279
300
|
}
|
|
280
301
|
};
|
|
281
302
|
}
|
|
282
303
|
export {
|
|
283
|
-
|
|
304
|
+
Nt as useWorkbenchModel
|
|
284
305
|
};
|