@floegence/floe-webapp-core 0.36.28 → 0.36.30
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/WorkbenchWidget.js +234 -182
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/components/workbench/types.d.ts +2 -0
- package/dist/components/workbench/workbenchHelpers.d.ts +2 -1
- package/dist/components/workbench/workbenchHelpers.js +87 -83
- package/dist/styles.css +1 -1
- package/dist/workbench.css +15 -0
- package/dist/workbench.js +13 -12
- package/package.json +1 -1
|
@@ -1,87 +1,92 @@
|
|
|
1
|
-
import { spread as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import { startHotInteraction as
|
|
4
|
-
import { X as
|
|
5
|
-
import { CANVAS_WHEEL_INTERACTIVE_ATTR as
|
|
6
|
-
import { startPointerSession as
|
|
7
|
-
import { createWorkbenchWidgetSurfaceMetrics as
|
|
8
|
-
import { resolveWorkbenchInteractionAdapter as
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { spread as nt, mergeProps as Wt, insert as l, createComponent as g, memo as Et, effect as Lt, style as zt, template as st, use as Rt, delegateEvents as At } from "solid-js/web";
|
|
2
|
+
import { createMemo as d, createSignal as k, onCleanup as ot, untrack as m, createEffect as rt } from "solid-js";
|
|
3
|
+
import { startHotInteraction as Dt } from "../../utils/hotInteraction.js";
|
|
4
|
+
import { X as at, Minus as ct, Maximize as lt, GripVertical as Xt } from "../icons/index.js";
|
|
5
|
+
import { CANVAS_WHEEL_INTERACTIVE_ATTR as Yt, WORKBENCH_WIDGET_SHELL_ATTR as jt, resolveWorkbenchWidgetLocalTypingTarget as Ft, shouldActivateWorkbenchWidgetLocalTarget as Ht } from "../ui/localInteractionSurface.js";
|
|
6
|
+
import { startPointerSession as dt } from "../ui/pointerSession.js";
|
|
7
|
+
import { createWorkbenchWidgetSurfaceMetrics as Ot, resolveWorkbenchProjectedSurfaceScaleBehavior as qt } from "./workbenchHelpers.js";
|
|
8
|
+
import { resolveWorkbenchInteractionAdapter as Bt } from "./workbenchInteractionAdapter.js";
|
|
9
|
+
var Nt = /* @__PURE__ */ st('<article class=workbench-widget><div class=workbench-widget__surface><header class=workbench-widget__header><span class=workbench-widget__traffic role=group aria-label="Window controls"><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--close"aria-label="Close widget"title="Close widget"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button></span><span class=workbench-widget__badge aria-hidden=true></span><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title-dot aria-hidden=true></span><span class=workbench-widget__title></span></div><span class=workbench-widget__window-controls role=group aria-label="Window controls"><button type=button class="workbench-widget__window-control workbench-widget__window-control--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--close"aria-label="Remove widget"title="Remove widget"data-floe-canvas-interactive=true></button></span></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), Vt = /* @__PURE__ */ st('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
|
|
10
|
+
const Zt = 220, Gt = 160, Jt = 160;
|
|
11
|
+
function re(e) {
|
|
12
|
+
const w = d(() => Bt(e.interactionAdapter)), [y, L] = k(null), [x, z] = k(null), [wt, ut] = k(), [R, A] = k(!1), [B, I] = k({
|
|
13
|
+
enabled: !1,
|
|
14
|
+
scale: 1
|
|
15
|
+
});
|
|
16
|
+
let _, b, gt = 0, ht = 0, v = null, S;
|
|
17
|
+
const p = /* @__PURE__ */ new Map();
|
|
18
|
+
let s;
|
|
19
|
+
const M = () => {
|
|
20
|
+
typeof window > "u" || S === void 0 || (window.clearTimeout(S), S = void 0);
|
|
21
|
+
}, N = (t, i) => {
|
|
22
|
+
const n = Dt({
|
|
18
23
|
kind: t,
|
|
19
24
|
cursor: i
|
|
20
25
|
});
|
|
21
|
-
let
|
|
22
|
-
return
|
|
23
|
-
|
|
26
|
+
let r = !1;
|
|
27
|
+
return m(() => e.onLayoutInteractionStart?.()), () => {
|
|
28
|
+
r || (r = !0, n(), m(() => e.onLayoutInteractionEnd?.()));
|
|
24
29
|
};
|
|
25
30
|
};
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
ot(() => {
|
|
32
|
+
_?.stop({
|
|
28
33
|
reason: "manual_stop",
|
|
29
34
|
commit: !1
|
|
30
|
-
}),
|
|
35
|
+
}), _ = void 0, b?.stop({
|
|
31
36
|
reason: "manual_stop",
|
|
32
37
|
commit: !1
|
|
33
|
-
}),
|
|
38
|
+
}), b = void 0, m(y)?.stopInteraction(), m(x)?.stopInteraction(), M();
|
|
34
39
|
});
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
const
|
|
41
|
-
token: ++
|
|
40
|
+
const T = () => {
|
|
41
|
+
A(!1), e.onSelect(e.widgetId), e.onCommitFront(e.widgetId);
|
|
42
|
+
}, D = () => {
|
|
43
|
+
A(!1);
|
|
44
|
+
}, $ = d(() => e.selected || R()), ft = (t, i, n) => {
|
|
45
|
+
const r = {
|
|
46
|
+
token: ++ht,
|
|
42
47
|
wasSelected: i,
|
|
43
|
-
ownership:
|
|
48
|
+
ownership: n
|
|
44
49
|
};
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
p.set(t, r), !i && n === "widget_local" && A(!0), queueMicrotask(() => {
|
|
51
|
+
p.get(t)?.token === r.token && p.delete(t);
|
|
47
52
|
});
|
|
48
|
-
},
|
|
49
|
-
const i =
|
|
50
|
-
return i &&
|
|
53
|
+
}, mt = (t) => {
|
|
54
|
+
const i = p.get(t) ?? null;
|
|
55
|
+
return i && p.delete(t), i;
|
|
51
56
|
};
|
|
52
|
-
|
|
53
|
-
const t =
|
|
57
|
+
rt(() => {
|
|
58
|
+
const t = s;
|
|
54
59
|
if (!t) return;
|
|
55
|
-
const i = (
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
+
const i = (a) => {
|
|
61
|
+
a.button === 0 && ft(a.pointerId, $(), C(a.target));
|
|
62
|
+
}, n = (a) => {
|
|
63
|
+
a.button === 0 && R() && C(a.target) === "widget_local" && T();
|
|
64
|
+
}, r = () => {
|
|
60
65
|
setTimeout(() => {
|
|
61
|
-
e.selected ||
|
|
66
|
+
e.selected || D();
|
|
62
67
|
}, 0);
|
|
63
68
|
};
|
|
64
|
-
t.addEventListener("pointerdown", i, !0), t.addEventListener("click",
|
|
65
|
-
t.removeEventListener("pointerdown", i, !0), t.removeEventListener("click",
|
|
69
|
+
t.addEventListener("pointerdown", i, !0), t.addEventListener("click", n, !0), t.addEventListener("pointerup", r), t.addEventListener("pointercancel", D), ot(() => {
|
|
70
|
+
t.removeEventListener("pointerdown", i, !0), t.removeEventListener("click", n, !0), t.removeEventListener("pointerup", r), t.removeEventListener("pointercancel", D);
|
|
66
71
|
});
|
|
67
72
|
});
|
|
68
|
-
const X = () =>
|
|
73
|
+
const X = () => y() !== null, Y = () => x() !== null, _t = d(() => e.filtered ? "cold" : $() ? "hot" : "warm"), C = (t) => w().resolveWidgetEventOwnership({
|
|
69
74
|
target: t,
|
|
70
|
-
widgetRoot:
|
|
71
|
-
interactiveSelector:
|
|
72
|
-
panSurfaceSelector:
|
|
73
|
-
}),
|
|
74
|
-
|
|
75
|
+
widgetRoot: s ?? null,
|
|
76
|
+
interactiveSelector: w().interactiveSelector,
|
|
77
|
+
panSurfaceSelector: w().panSurfaceSelector
|
|
78
|
+
}), bt = () => {
|
|
79
|
+
T(), s?.focus({
|
|
75
80
|
preventScroll: !0
|
|
76
81
|
});
|
|
77
|
-
},
|
|
78
|
-
|
|
82
|
+
}, V = (t) => {
|
|
83
|
+
ut((i) => ({
|
|
79
84
|
seq: (i?.seq ?? 0) + 1,
|
|
80
85
|
source: "local_pointer",
|
|
81
86
|
pointerType: t
|
|
82
87
|
}));
|
|
83
|
-
},
|
|
84
|
-
if (!(!
|
|
88
|
+
}, vt = (t) => {
|
|
89
|
+
if (!(!s || !t.isConnected || !s.contains(t)))
|
|
85
90
|
try {
|
|
86
91
|
t.focus({
|
|
87
92
|
preventScroll: !0
|
|
@@ -89,58 +94,58 @@ function Nt(e) {
|
|
|
89
94
|
} catch {
|
|
90
95
|
t.focus();
|
|
91
96
|
}
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
token: ++
|
|
97
|
+
}, St = (t, i) => {
|
|
98
|
+
v = {
|
|
99
|
+
token: ++gt,
|
|
95
100
|
pointerId: t,
|
|
96
101
|
target: i,
|
|
97
102
|
timestamp: Date.now()
|
|
98
103
|
};
|
|
99
|
-
const
|
|
104
|
+
const n = v;
|
|
100
105
|
queueMicrotask(() => {
|
|
101
|
-
const
|
|
102
|
-
!
|
|
106
|
+
const r = () => {
|
|
107
|
+
!n || v?.token !== n.token || (vt(n.target), v = null);
|
|
103
108
|
};
|
|
104
109
|
if (typeof requestAnimationFrame == "function") {
|
|
105
|
-
requestAnimationFrame(() =>
|
|
110
|
+
requestAnimationFrame(() => r());
|
|
106
111
|
return;
|
|
107
112
|
}
|
|
108
|
-
|
|
113
|
+
r();
|
|
109
114
|
});
|
|
110
|
-
},
|
|
115
|
+
}, pt = (t) => {
|
|
111
116
|
if (t.button !== 0) return;
|
|
112
|
-
const i =
|
|
117
|
+
const i = mt(t.pointerId), n = i?.wasSelected ?? e.selected, r = i?.ownership ?? C(t.target), a = r === "widget_local" ? Ft({
|
|
113
118
|
target: t.target,
|
|
114
|
-
widgetRoot:
|
|
115
|
-
interactiveSelector:
|
|
116
|
-
panSurfaceSelector:
|
|
117
|
-
}) : null,
|
|
119
|
+
widgetRoot: s ?? null,
|
|
120
|
+
interactiveSelector: w().interactiveSelector,
|
|
121
|
+
panSurfaceSelector: w().panSurfaceSelector
|
|
122
|
+
}) : null, o = r === "widget_local" && !a && Ht({
|
|
118
123
|
target: t.target,
|
|
119
|
-
widgetRoot:
|
|
120
|
-
interactiveSelector:
|
|
121
|
-
panSurfaceSelector:
|
|
124
|
+
widgetRoot: s ?? null,
|
|
125
|
+
interactiveSelector: w().interactiveSelector,
|
|
126
|
+
panSurfaceSelector: w().panSurfaceSelector
|
|
122
127
|
});
|
|
123
|
-
if (
|
|
124
|
-
|
|
128
|
+
if (r === "widget_shell") {
|
|
129
|
+
T(), s?.focus({
|
|
125
130
|
preventScroll: !0
|
|
126
131
|
});
|
|
127
132
|
return;
|
|
128
133
|
}
|
|
129
|
-
if (
|
|
130
|
-
if (
|
|
131
|
-
|
|
134
|
+
if (r === "widget_local") {
|
|
135
|
+
if (a) {
|
|
136
|
+
n || St(t.pointerId, a);
|
|
132
137
|
return;
|
|
133
138
|
}
|
|
134
|
-
if (
|
|
135
|
-
if (
|
|
136
|
-
|
|
139
|
+
if (o) {
|
|
140
|
+
if (v = null, n) {
|
|
141
|
+
V(t.pointerType || void 0);
|
|
137
142
|
return;
|
|
138
143
|
}
|
|
139
|
-
|
|
144
|
+
T(), V(t.pointerType || void 0);
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
|
-
},
|
|
143
|
-
const t =
|
|
147
|
+
}, P = d(() => {
|
|
148
|
+
const t = y();
|
|
144
149
|
return t ? {
|
|
145
150
|
x: t.worldX,
|
|
146
151
|
y: t.worldY
|
|
@@ -148,8 +153,8 @@ function Nt(e) {
|
|
|
148
153
|
x: e.x,
|
|
149
154
|
y: e.y
|
|
150
155
|
};
|
|
151
|
-
}),
|
|
152
|
-
const t =
|
|
156
|
+
}), u = d(() => {
|
|
157
|
+
const t = x();
|
|
153
158
|
return t ? {
|
|
154
159
|
width: t.width,
|
|
155
160
|
height: t.height
|
|
@@ -157,64 +162,111 @@ function Nt(e) {
|
|
|
157
162
|
width: e.width,
|
|
158
163
|
height: e.height
|
|
159
164
|
};
|
|
160
|
-
}),
|
|
165
|
+
}), j = d(() => {
|
|
161
166
|
if (!(e.layoutMode !== "projected_surface" || !e.projectedViewport))
|
|
162
|
-
return
|
|
167
|
+
return Ot({
|
|
163
168
|
widgetId: e.widgetId,
|
|
164
|
-
worldX:
|
|
165
|
-
worldY:
|
|
166
|
-
worldWidth:
|
|
167
|
-
worldHeight:
|
|
169
|
+
worldX: P().x,
|
|
170
|
+
worldY: P().y,
|
|
171
|
+
worldWidth: u().width,
|
|
172
|
+
worldHeight: u().height,
|
|
168
173
|
viewport: e.projectedViewport(),
|
|
169
174
|
ready: e.surfaceReady ?? !0
|
|
170
175
|
});
|
|
171
|
-
}),
|
|
176
|
+
}), F = d(() => j()?.rect.viewportScale ?? Math.max(e.viewportScale, 1e-3)), Z = d(() => e.layoutMode === "projected_surface" && qt(e.definition) === "settle_sharp_zoom"), G = d(() => e.layoutMode === "projected_surface" && Z() && B().enabled && B().scale > 1.001), $t = d(() => {
|
|
177
|
+
if (e.layoutMode !== "projected_surface")
|
|
178
|
+
return;
|
|
179
|
+
const t = F();
|
|
180
|
+
return G() ? {
|
|
181
|
+
width: `${u().width}px`,
|
|
182
|
+
height: `${u().height}px`,
|
|
183
|
+
zoom: `${t}`
|
|
184
|
+
} : {
|
|
185
|
+
width: "100%",
|
|
186
|
+
height: "100%",
|
|
187
|
+
zoom: "1"
|
|
188
|
+
};
|
|
189
|
+
}), kt = d(() => {
|
|
172
190
|
const t = e.itemSnapshot().z_index, i = Number.isFinite(t) ? Math.max(1, Math.min(99, Math.round(t))) : 1;
|
|
173
191
|
return String(i).padStart(2, "0");
|
|
174
|
-
}),
|
|
192
|
+
}), J = (t) => {
|
|
175
193
|
t.preventDefault(), t.stopPropagation(), e.onRequestOverview(e.itemSnapshot());
|
|
176
|
-
},
|
|
194
|
+
}, K = (t) => {
|
|
177
195
|
t.preventDefault(), t.stopPropagation(), e.onRequestFit(e.itemSnapshot());
|
|
178
|
-
},
|
|
196
|
+
}, U = (t) => {
|
|
179
197
|
t.preventDefault(), t.stopPropagation(), e.onRequestDelete(e.widgetId);
|
|
180
|
-
},
|
|
198
|
+
}, yt = d(() => {
|
|
181
199
|
const t = {
|
|
182
|
-
width: `${x().width}px`,
|
|
183
|
-
height: `${x().height}px`,
|
|
184
200
|
"z-index": X() || Y() || e.optimisticFront ? `${e.topRenderLayer + 1}` : `${e.renderLayer}`
|
|
185
201
|
};
|
|
186
202
|
if (e.layoutMode === "projected_surface") {
|
|
187
|
-
const i =
|
|
203
|
+
const i = j()?.rect, n = F(), r = G(), a = r ? i?.screenWidth ?? u().width * n : u().width, o = r ? i?.screenHeight ?? u().height * n : u().height;
|
|
188
204
|
return {
|
|
189
205
|
...t,
|
|
190
|
-
|
|
206
|
+
width: `${a}px`,
|
|
207
|
+
height: `${o}px`,
|
|
208
|
+
transform: r ? `translate(${i?.screenX ?? 0}px, ${i?.screenY ?? 0}px)` : `translate(${i?.screenX ?? 0}px, ${i?.screenY ?? 0}px) scale(${n})`,
|
|
209
|
+
zoom: "1"
|
|
191
210
|
};
|
|
192
211
|
}
|
|
193
212
|
return {
|
|
194
213
|
...t,
|
|
195
|
-
|
|
214
|
+
width: `${u().width}px`,
|
|
215
|
+
height: `${u().height}px`,
|
|
216
|
+
transform: `translate(${P().x}px, ${P().y}px)`
|
|
196
217
|
};
|
|
197
|
-
})
|
|
198
|
-
|
|
218
|
+
});
|
|
219
|
+
rt(() => {
|
|
220
|
+
if (!Z()) {
|
|
221
|
+
M(), I({
|
|
222
|
+
enabled: !1,
|
|
223
|
+
scale: 1
|
|
224
|
+
});
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const t = F();
|
|
228
|
+
if (t <= 1.001 || X() || Y()) {
|
|
229
|
+
M(), I({
|
|
230
|
+
enabled: !1,
|
|
231
|
+
scale: t
|
|
232
|
+
});
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (I({
|
|
236
|
+
enabled: !1,
|
|
237
|
+
scale: t
|
|
238
|
+
}), typeof window > "u")
|
|
239
|
+
return;
|
|
240
|
+
M();
|
|
241
|
+
const i = t;
|
|
242
|
+
S = window.setTimeout(() => {
|
|
243
|
+
S = void 0, I((n) => Math.abs(n.scale - i) < 1e-3 ? {
|
|
244
|
+
enabled: !0,
|
|
245
|
+
scale: i
|
|
246
|
+
} : n);
|
|
247
|
+
}, Jt);
|
|
248
|
+
});
|
|
249
|
+
const xt = (t) => {
|
|
250
|
+
const i = m(y);
|
|
199
251
|
if (!i) return;
|
|
200
|
-
const
|
|
252
|
+
const n = {
|
|
201
253
|
x: i.worldX,
|
|
202
254
|
y: i.worldY
|
|
203
|
-
},
|
|
255
|
+
}, r = {
|
|
204
256
|
x: i.startWorldX,
|
|
205
257
|
y: i.startWorldY
|
|
206
|
-
},
|
|
207
|
-
e.onCommitFront(e.widgetId),
|
|
208
|
-
},
|
|
258
|
+
}, a = t && (Math.abs(n.x - r.x) > 1 || Math.abs(n.y - r.y) > 1);
|
|
259
|
+
e.onCommitFront(e.widgetId), a && e.onCommitMove(e.widgetId, n), i.stopInteraction(), L(null), _ = void 0;
|
|
260
|
+
}, Q = (t) => {
|
|
209
261
|
if (t.button !== 0 || e.locked) return;
|
|
210
|
-
t.preventDefault(), t.stopPropagation(),
|
|
262
|
+
t.preventDefault(), t.stopPropagation(), _?.stop({
|
|
211
263
|
reason: "manual_stop",
|
|
212
264
|
commit: !1
|
|
213
|
-
}), e.onSelect(e.widgetId),
|
|
265
|
+
}), e.onSelect(e.widgetId), s?.focus({
|
|
214
266
|
preventScroll: !0
|
|
215
267
|
}), e.onStartOptimisticFront(e.widgetId);
|
|
216
|
-
const i =
|
|
217
|
-
|
|
268
|
+
const i = N("drag", "grabbing"), n = Math.max(e.viewportScale, 1e-3);
|
|
269
|
+
L({
|
|
218
270
|
pointerId: t.pointerId,
|
|
219
271
|
startClientX: t.clientX,
|
|
220
272
|
startClientY: t.clientY,
|
|
@@ -223,45 +275,45 @@ function Nt(e) {
|
|
|
223
275
|
worldX: e.x,
|
|
224
276
|
worldY: e.y,
|
|
225
277
|
moved: !1,
|
|
226
|
-
scale:
|
|
278
|
+
scale: n,
|
|
227
279
|
stopInteraction: i
|
|
228
280
|
});
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
if (!
|
|
232
|
-
const h =
|
|
281
|
+
const r = (a) => {
|
|
282
|
+
L((o) => {
|
|
283
|
+
if (!o || o.pointerId !== a.pointerId) return o;
|
|
284
|
+
const h = o.startWorldX + (a.clientX - o.startClientX) / o.scale, f = o.startWorldY + (a.clientY - o.startClientY) / o.scale;
|
|
233
285
|
return {
|
|
234
|
-
...
|
|
286
|
+
...o,
|
|
235
287
|
worldX: h,
|
|
236
|
-
worldY:
|
|
237
|
-
moved:
|
|
288
|
+
worldY: f,
|
|
289
|
+
moved: o.moved || Math.abs(h - o.startWorldX) > 2 || Math.abs(f - o.startWorldY) > 2
|
|
238
290
|
};
|
|
239
291
|
});
|
|
240
292
|
};
|
|
241
|
-
|
|
293
|
+
_ = dt({
|
|
242
294
|
pointerEvent: t,
|
|
243
295
|
captureEl: t.currentTarget,
|
|
244
|
-
onMove:
|
|
296
|
+
onMove: r,
|
|
245
297
|
onEnd: ({
|
|
246
|
-
commit:
|
|
247
|
-
}) =>
|
|
298
|
+
commit: a
|
|
299
|
+
}) => xt(a)
|
|
248
300
|
});
|
|
249
|
-
},
|
|
250
|
-
const i =
|
|
301
|
+
}, It = (t) => {
|
|
302
|
+
const i = m(x);
|
|
251
303
|
if (!i) return;
|
|
252
|
-
const
|
|
304
|
+
const n = {
|
|
253
305
|
width: i.width,
|
|
254
306
|
height: i.height
|
|
255
|
-
},
|
|
256
|
-
t &&
|
|
257
|
-
},
|
|
307
|
+
}, r = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
|
|
308
|
+
t && r && e.onCommitResize(e.widgetId, n), i.stopInteraction(), z(null), b = void 0;
|
|
309
|
+
}, Mt = (t) => {
|
|
258
310
|
if (t.button !== 0 || e.locked) return;
|
|
259
|
-
t.preventDefault(), t.stopPropagation(),
|
|
311
|
+
t.preventDefault(), t.stopPropagation(), b?.stop({
|
|
260
312
|
reason: "manual_stop",
|
|
261
313
|
commit: !1
|
|
262
314
|
}), e.onStartOptimisticFront(e.widgetId);
|
|
263
|
-
const i =
|
|
264
|
-
|
|
315
|
+
const i = N("resize", "nwse-resize"), n = Math.max(e.viewportScale, 1e-3);
|
|
316
|
+
z({
|
|
265
317
|
pointerId: t.pointerId,
|
|
266
318
|
startClientX: t.clientX,
|
|
267
319
|
startClientY: t.clientY,
|
|
@@ -269,35 +321,35 @@ function Nt(e) {
|
|
|
269
321
|
startHeight: e.height,
|
|
270
322
|
width: e.width,
|
|
271
323
|
height: e.height,
|
|
272
|
-
scale:
|
|
324
|
+
scale: n,
|
|
273
325
|
stopInteraction: i
|
|
274
326
|
});
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
if (!
|
|
278
|
-
const h = Math.max(
|
|
327
|
+
const r = (a) => {
|
|
328
|
+
z((o) => {
|
|
329
|
+
if (!o || o.pointerId !== a.pointerId) return o;
|
|
330
|
+
const h = Math.max(Zt, o.startWidth + (a.clientX - o.startClientX) / o.scale), f = Math.max(Gt, o.startHeight + (a.clientY - o.startClientY) / o.scale);
|
|
279
331
|
return {
|
|
280
|
-
...
|
|
332
|
+
...o,
|
|
281
333
|
width: h,
|
|
282
|
-
height:
|
|
334
|
+
height: f
|
|
283
335
|
};
|
|
284
336
|
});
|
|
285
337
|
};
|
|
286
|
-
|
|
338
|
+
b = dt({
|
|
287
339
|
pointerEvent: t,
|
|
288
340
|
captureEl: t.currentTarget,
|
|
289
|
-
onMove:
|
|
341
|
+
onMove: r,
|
|
290
342
|
onEnd: ({
|
|
291
|
-
commit:
|
|
292
|
-
}) =>
|
|
343
|
+
commit: a
|
|
344
|
+
}) => It(a)
|
|
293
345
|
});
|
|
294
346
|
};
|
|
295
347
|
return (() => {
|
|
296
|
-
var t =
|
|
297
|
-
return typeof
|
|
348
|
+
var t = Nt(), i = t.firstChild, n = i.firstChild, r = n.firstChild, a = r.firstChild, o = a.nextSibling, h = o.nextSibling, f = r.nextSibling, H = f.nextSibling, O = H.nextSibling, Tt = O.firstChild, tt = Tt.nextSibling, Ct = O.nextSibling, W = Ct.firstChild, E = W.nextSibling, q = E.nextSibling, Pt = n.nextSibling, et = s;
|
|
349
|
+
return typeof et == "function" ? Rt(et, t) : s = t, nt(t, Wt({
|
|
298
350
|
get classList() {
|
|
299
351
|
return {
|
|
300
|
-
"is-selected":
|
|
352
|
+
"is-selected": $(),
|
|
301
353
|
"is-dragging": X(),
|
|
302
354
|
"is-resizing": Y(),
|
|
303
355
|
"is-filtered-out": e.filtered,
|
|
@@ -306,15 +358,15 @@ function Nt(e) {
|
|
|
306
358
|
};
|
|
307
359
|
}
|
|
308
360
|
}, () => ({
|
|
309
|
-
[
|
|
361
|
+
[w().dialogSurfaceHostAttr]: "true"
|
|
310
362
|
}), {
|
|
311
363
|
get "data-floe-workbench-widget-id"() {
|
|
312
364
|
return e.widgetId;
|
|
313
365
|
}
|
|
314
366
|
}, () => ({
|
|
315
|
-
[
|
|
367
|
+
[w().widgetRootAttr]: "true"
|
|
316
368
|
}), () => ({
|
|
317
|
-
[
|
|
369
|
+
[w().widgetIdAttr]: e.widgetId
|
|
318
370
|
}), {
|
|
319
371
|
get "data-workbench-widget-type"() {
|
|
320
372
|
return e.widgetType;
|
|
@@ -323,49 +375,49 @@ function Nt(e) {
|
|
|
323
375
|
return e.layoutMode ?? "canvas_scaled";
|
|
324
376
|
}
|
|
325
377
|
}, () => ({
|
|
326
|
-
[
|
|
378
|
+
[Yt]: $() ? "true" : void 0
|
|
327
379
|
}), {
|
|
328
380
|
tabIndex: 0,
|
|
329
|
-
onPointerDown:
|
|
381
|
+
onPointerDown: pt,
|
|
330
382
|
onFocus: () => {
|
|
331
|
-
|
|
383
|
+
R() || e.onSelect(e.widgetId);
|
|
332
384
|
},
|
|
333
385
|
onContextMenu: (c) => {
|
|
334
|
-
|
|
386
|
+
C(c.target) === "widget_shell" && (c.preventDefault(), c.stopPropagation(), e.onContextMenu(c, e.itemSnapshot()));
|
|
335
387
|
},
|
|
336
388
|
get style() {
|
|
337
|
-
return
|
|
389
|
+
return yt();
|
|
338
390
|
}
|
|
339
|
-
}), !1, !0),
|
|
340
|
-
[
|
|
341
|
-
}, !1, !0),
|
|
391
|
+
}), !1, !0), n.$$pointerdown = Q, nt(n, {
|
|
392
|
+
[jt]: "true"
|
|
393
|
+
}, !1, !0), a.$$click = U, a.$$pointerdown = (c) => c.stopPropagation(), l(a, g(at, {
|
|
342
394
|
class: "workbench-widget__traffic-icon",
|
|
343
395
|
"aria-hidden": "true"
|
|
344
|
-
})), o.$$click =
|
|
396
|
+
})), o.$$click = J, o.$$pointerdown = (c) => c.stopPropagation(), l(o, g(ct, {
|
|
345
397
|
class: "workbench-widget__traffic-icon",
|
|
346
398
|
"aria-hidden": "true"
|
|
347
|
-
})),
|
|
399
|
+
})), h.$$click = K, h.$$pointerdown = (c) => c.stopPropagation(), l(h, g(lt, {
|
|
348
400
|
class: "workbench-widget__traffic-icon",
|
|
349
401
|
"aria-hidden": "true"
|
|
350
|
-
})), l(
|
|
402
|
+
})), l(f, kt), H.$$pointerdown = Q, l(H, g(Xt, {
|
|
351
403
|
class: "w-3.5 h-3.5"
|
|
352
|
-
})), l(
|
|
404
|
+
})), l(O, () => {
|
|
353
405
|
const c = e.definition.icon;
|
|
354
|
-
return
|
|
406
|
+
return g(c, {
|
|
355
407
|
class: "w-3.5 h-3.5"
|
|
356
408
|
});
|
|
357
|
-
},
|
|
409
|
+
}, tt), l(tt, () => e.widgetTitle), W.$$click = J, W.$$pointerdown = (c) => c.stopPropagation(), l(W, g(ct, {
|
|
358
410
|
class: "workbench-widget__window-control-icon",
|
|
359
411
|
"aria-hidden": "true"
|
|
360
|
-
})),
|
|
412
|
+
})), E.$$click = K, E.$$pointerdown = (c) => c.stopPropagation(), l(E, g(lt, {
|
|
361
413
|
class: "workbench-widget__window-control-icon",
|
|
362
414
|
"aria-hidden": "true"
|
|
363
|
-
})),
|
|
415
|
+
})), q.$$click = U, q.$$pointerdown = (c) => c.stopPropagation(), l(q, g(at, {
|
|
364
416
|
class: "workbench-widget__window-control-icon",
|
|
365
417
|
"aria-hidden": "true"
|
|
366
|
-
})), l(
|
|
418
|
+
})), l(Pt, () => {
|
|
367
419
|
const c = e.definition.body;
|
|
368
|
-
return
|
|
420
|
+
return g(c, {
|
|
369
421
|
get widgetId() {
|
|
370
422
|
return e.widgetId;
|
|
371
423
|
},
|
|
@@ -375,31 +427,31 @@ function Nt(e) {
|
|
|
375
427
|
get type() {
|
|
376
428
|
return e.widgetType;
|
|
377
429
|
},
|
|
378
|
-
surfaceMetrics:
|
|
430
|
+
surfaceMetrics: j,
|
|
379
431
|
get activation() {
|
|
380
|
-
return
|
|
432
|
+
return wt();
|
|
381
433
|
},
|
|
382
434
|
get lifecycle() {
|
|
383
|
-
return
|
|
435
|
+
return _t();
|
|
384
436
|
},
|
|
385
437
|
get selected() {
|
|
386
|
-
return
|
|
438
|
+
return $();
|
|
387
439
|
},
|
|
388
440
|
get filtered() {
|
|
389
441
|
return e.filtered;
|
|
390
442
|
},
|
|
391
|
-
requestActivate:
|
|
443
|
+
requestActivate: bt
|
|
392
444
|
});
|
|
393
|
-
}), l(
|
|
394
|
-
var c =
|
|
445
|
+
}), l(i, (() => {
|
|
446
|
+
var c = Et(() => !!e.locked);
|
|
395
447
|
return () => c() ? null : (() => {
|
|
396
|
-
var
|
|
397
|
-
return
|
|
448
|
+
var it = Vt();
|
|
449
|
+
return it.$$pointerdown = Mt, it;
|
|
398
450
|
})();
|
|
399
|
-
})(), null), t;
|
|
451
|
+
})(), null), Lt((c) => zt(i, $t(), c)), t;
|
|
400
452
|
})();
|
|
401
453
|
}
|
|
402
|
-
|
|
454
|
+
At(["pointerdown", "click"]);
|
|
403
455
|
export {
|
|
404
|
-
|
|
456
|
+
re as WorkbenchWidget
|
|
405
457
|
};
|
|
@@ -4,6 +4,6 @@ export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchCont
|
|
|
4
4
|
export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
|
|
5
5
|
export { WIDGET_REGISTRY, createWorkbenchFilterState, getWidgetEntry, isValidWorkbenchWidgetType, resolveWorkbenchWidgetDefinitions, type WidgetRegistryEntry, } from './widgets/widgetRegistry';
|
|
6
6
|
export * from './types';
|
|
7
|
-
export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId, createWorkbenchProjectedRect, createWorkbenchRenderLayerMap, createWorkbenchViewportCenteredOnWidget, createWorkbenchViewportFitForWidget, createWorkbenchWidgetSurfaceMetrics, resolveWorkbenchWidgetRenderMode, type WorkbenchRenderLayerMap, } from './workbenchHelpers';
|
|
7
|
+
export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId, createWorkbenchProjectedRect, createWorkbenchRenderLayerMap, createWorkbenchViewportCenteredOnWidget, createWorkbenchViewportFitForWidget, createWorkbenchWidgetSurfaceMetrics, resolveWorkbenchProjectedSurfaceScaleBehavior, resolveWorkbenchWidgetRenderMode, type WorkbenchRenderLayerMap, } from './workbenchHelpers';
|
|
8
8
|
export { DEFAULT_WORKBENCH_THEME, WORKBENCH_THEME_IDS, WORKBENCH_THEMES, isWorkbenchThemeId, workbenchThemeMeta, type WorkbenchThemeId, type WorkbenchThemeMeta, type WorkbenchThemePreview, } from './workbenchThemes';
|
|
9
9
|
export { WorkbenchThemeSelector, type WorkbenchThemeSelectorProps, } from './WorkbenchThemeSelector';
|