@floegence/floe-webapp-core 0.36.24 → 0.36.25
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,381 +1,407 @@
|
|
|
1
|
-
import { spread as
|
|
2
|
-
import { createMemo as h, createSignal 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
|
-
let _,
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { spread as V, mergeProps as vt, insert as l, createComponent as w, memo as kt, template as U, use as St, delegateEvents as $t } from "solid-js/web";
|
|
2
|
+
import { createMemo as h, createSignal as z, onCleanup as Z, untrack as f, createEffect as yt } from "solid-js";
|
|
3
|
+
import { startHotInteraction as It } from "../../utils/hotInteraction.js";
|
|
4
|
+
import { X as G, Minus as K, Maximize as J, GripVertical as pt } from "../icons/index.js";
|
|
5
|
+
import { CANVAS_WHEEL_INTERACTIVE_ATTR as Mt, WORKBENCH_WIDGET_SHELL_ATTR as xt, resolveWorkbenchWidgetLocalTypingTarget as Tt, shouldActivateWorkbenchWidgetLocalTarget as Ct } from "../ui/localInteractionSurface.js";
|
|
6
|
+
import { startPointerSession as Q } from "../ui/pointerSession.js";
|
|
7
|
+
import { createWorkbenchWidgetSurfaceMetrics as Wt } from "./workbenchHelpers.js";
|
|
8
|
+
import { resolveWorkbenchInteractionAdapter as Pt } from "./workbenchInteractionAdapter.js";
|
|
9
|
+
var zt = /* @__PURE__ */ U('<article class=workbench-widget><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>'), Rt = /* @__PURE__ */ U('<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 At = 220, Lt = 160;
|
|
11
|
+
function Bt(e) {
|
|
12
|
+
const s = h(() => Pt(e.interactionAdapter)), [S, x] = z(null), [$, T] = z(null), [tt, et] = z();
|
|
13
|
+
let m, _, R = 0, it = 0, b = null, v = null;
|
|
14
|
+
const k = /* @__PURE__ */ new Map();
|
|
15
|
+
let d;
|
|
16
|
+
const A = (t, i) => {
|
|
17
|
+
const n = It({
|
|
18
|
+
kind: t,
|
|
17
19
|
cursor: i
|
|
18
20
|
});
|
|
19
|
-
let
|
|
20
|
-
return f(() =>
|
|
21
|
-
|
|
21
|
+
let r = !1;
|
|
22
|
+
return f(() => e.onLayoutInteractionStart?.()), () => {
|
|
23
|
+
r || (r = !0, n(), f(() => e.onLayoutInteractionEnd?.()));
|
|
22
24
|
};
|
|
23
25
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
Z(() => {
|
|
27
|
+
m?.stop({
|
|
26
28
|
reason: "manual_stop",
|
|
27
29
|
commit: !1
|
|
28
|
-
}),
|
|
30
|
+
}), m = void 0, _?.stop({
|
|
29
31
|
reason: "manual_stop",
|
|
30
32
|
commit: !1
|
|
31
|
-
}),
|
|
33
|
+
}), _ = void 0, f(S)?.stopInteraction(), f($)?.stopInteraction();
|
|
32
34
|
});
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const C = () => {
|
|
36
|
+
e.onSelect(e.widgetId), e.onCommitFront(e.widgetId);
|
|
37
|
+
}, nt = (t, i) => {
|
|
38
|
+
const n = {
|
|
39
|
+
token: ++it,
|
|
40
|
+
wasSelected: i
|
|
41
|
+
};
|
|
42
|
+
k.set(t, n), queueMicrotask(() => {
|
|
43
|
+
k.get(t)?.token === n.token && k.delete(t);
|
|
44
|
+
}), C();
|
|
45
|
+
}, ot = (t) => {
|
|
46
|
+
const i = k.get(t) ?? null;
|
|
47
|
+
return i && k.delete(t), i;
|
|
48
|
+
};
|
|
49
|
+
yt(() => {
|
|
50
|
+
const t = d;
|
|
51
|
+
if (!t) return;
|
|
52
|
+
const i = (n) => {
|
|
53
|
+
n.button === 0 && nt(n.pointerId, e.selected);
|
|
54
|
+
};
|
|
55
|
+
t.addEventListener("pointerdown", i, !0), Z(() => {
|
|
56
|
+
t.removeEventListener("pointerdown", i, !0);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
const L = () => S() !== null, D = () => $() !== null, rt = h(() => e.filtered ? "cold" : e.selected ? "hot" : "warm"), X = (t) => s().resolveWidgetEventOwnership({
|
|
60
|
+
target: t,
|
|
61
|
+
widgetRoot: d ?? null,
|
|
62
|
+
interactiveSelector: s().interactiveSelector,
|
|
63
|
+
panSurfaceSelector: s().panSurfaceSelector
|
|
64
|
+
}), at = () => {
|
|
65
|
+
C(), d?.focus({
|
|
40
66
|
preventScroll: !0
|
|
41
67
|
});
|
|
42
|
-
},
|
|
43
|
-
|
|
68
|
+
}, E = (t) => {
|
|
69
|
+
et((i) => ({
|
|
44
70
|
seq: (i?.seq ?? 0) + 1,
|
|
45
71
|
source: "local_pointer",
|
|
46
|
-
pointerType:
|
|
72
|
+
pointerType: t
|
|
47
73
|
}));
|
|
48
|
-
},
|
|
49
|
-
if (!(!
|
|
74
|
+
}, ct = (t) => {
|
|
75
|
+
if (!(!d || !t.isConnected || !d.contains(t)))
|
|
50
76
|
try {
|
|
51
|
-
|
|
77
|
+
t.focus({
|
|
52
78
|
preventScroll: !0
|
|
53
79
|
});
|
|
54
80
|
} catch {
|
|
55
|
-
|
|
81
|
+
t.focus();
|
|
56
82
|
}
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
token: ++
|
|
60
|
-
pointerId:
|
|
83
|
+
}, lt = (t, i) => {
|
|
84
|
+
b = {
|
|
85
|
+
token: ++R,
|
|
86
|
+
pointerId: t,
|
|
61
87
|
pointerType: i,
|
|
62
88
|
timestamp: Date.now()
|
|
63
89
|
};
|
|
64
|
-
const
|
|
90
|
+
const n = b;
|
|
65
91
|
queueMicrotask(() => {
|
|
66
|
-
!
|
|
92
|
+
!n || b?.token !== n.token || (E(n.pointerType), b = null);
|
|
67
93
|
});
|
|
68
|
-
},
|
|
94
|
+
}, dt = (t, i) => {
|
|
69
95
|
v = {
|
|
70
|
-
token: ++
|
|
71
|
-
pointerId:
|
|
96
|
+
token: ++R,
|
|
97
|
+
pointerId: t,
|
|
72
98
|
target: i,
|
|
73
99
|
timestamp: Date.now()
|
|
74
100
|
};
|
|
75
|
-
const
|
|
101
|
+
const n = v;
|
|
76
102
|
queueMicrotask(() => {
|
|
77
|
-
const
|
|
78
|
-
!
|
|
103
|
+
const r = () => {
|
|
104
|
+
!n || v?.token !== n.token || (ct(n.target), v = null);
|
|
79
105
|
};
|
|
80
106
|
if (typeof requestAnimationFrame == "function") {
|
|
81
|
-
requestAnimationFrame(() =>
|
|
107
|
+
requestAnimationFrame(() => r());
|
|
82
108
|
return;
|
|
83
109
|
}
|
|
84
|
-
|
|
110
|
+
r();
|
|
85
111
|
});
|
|
86
|
-
},
|
|
87
|
-
if (
|
|
88
|
-
const i = t.selected,
|
|
89
|
-
target:
|
|
90
|
-
widgetRoot:
|
|
91
|
-
interactiveSelector:
|
|
92
|
-
panSurfaceSelector:
|
|
93
|
-
}) : null,
|
|
94
|
-
target:
|
|
95
|
-
widgetRoot:
|
|
96
|
-
interactiveSelector:
|
|
97
|
-
panSurfaceSelector:
|
|
112
|
+
}, st = (t) => {
|
|
113
|
+
if (t.button !== 0) return;
|
|
114
|
+
const i = ot(t.pointerId), n = i?.wasSelected ?? e.selected, r = X(t.target), a = r === "widget_local" ? Tt({
|
|
115
|
+
target: t.target,
|
|
116
|
+
widgetRoot: d ?? null,
|
|
117
|
+
interactiveSelector: s().interactiveSelector,
|
|
118
|
+
panSurfaceSelector: s().panSurfaceSelector
|
|
119
|
+
}) : null, o = r === "widget_local" && !a && Ct({
|
|
120
|
+
target: t.target,
|
|
121
|
+
widgetRoot: d ?? null,
|
|
122
|
+
interactiveSelector: s().interactiveSelector,
|
|
123
|
+
panSurfaceSelector: s().panSurfaceSelector
|
|
98
124
|
});
|
|
99
|
-
if (
|
|
100
|
-
|
|
125
|
+
if (i || C(), r === "widget_shell") {
|
|
126
|
+
d?.focus({
|
|
101
127
|
preventScroll: !0
|
|
102
128
|
});
|
|
103
129
|
return;
|
|
104
130
|
}
|
|
105
|
-
if (
|
|
131
|
+
if (r === "widget_local") {
|
|
106
132
|
if (a) {
|
|
107
|
-
|
|
133
|
+
b = null, n || dt(t.pointerId, a);
|
|
108
134
|
return;
|
|
109
135
|
}
|
|
110
|
-
if (
|
|
111
|
-
if (v = null,
|
|
112
|
-
|
|
136
|
+
if (o) {
|
|
137
|
+
if (v = null, n) {
|
|
138
|
+
E(t.pointerType || void 0);
|
|
113
139
|
return;
|
|
114
140
|
}
|
|
115
|
-
|
|
141
|
+
lt(t.pointerId, t.pointerType || void 0);
|
|
116
142
|
}
|
|
117
143
|
}
|
|
118
|
-
},
|
|
119
|
-
const
|
|
120
|
-
return
|
|
121
|
-
x:
|
|
122
|
-
y:
|
|
144
|
+
}, y = h(() => {
|
|
145
|
+
const t = S();
|
|
146
|
+
return t ? {
|
|
147
|
+
x: t.worldX,
|
|
148
|
+
y: t.worldY
|
|
123
149
|
} : {
|
|
124
|
-
x:
|
|
125
|
-
y:
|
|
150
|
+
x: e.x,
|
|
151
|
+
y: e.y
|
|
126
152
|
};
|
|
127
|
-
}),
|
|
128
|
-
const
|
|
129
|
-
return
|
|
130
|
-
width: e.width,
|
|
131
|
-
height: e.height
|
|
132
|
-
} : {
|
|
153
|
+
}), I = h(() => {
|
|
154
|
+
const t = $();
|
|
155
|
+
return t ? {
|
|
133
156
|
width: t.width,
|
|
134
157
|
height: t.height
|
|
158
|
+
} : {
|
|
159
|
+
width: e.width,
|
|
160
|
+
height: e.height
|
|
135
161
|
};
|
|
136
162
|
}), Y = h(() => {
|
|
137
|
-
if (!(
|
|
138
|
-
return
|
|
139
|
-
widgetId:
|
|
140
|
-
worldX:
|
|
141
|
-
worldY:
|
|
142
|
-
worldWidth:
|
|
143
|
-
worldHeight:
|
|
144
|
-
viewport:
|
|
145
|
-
ready:
|
|
163
|
+
if (!(e.layoutMode !== "projected_surface" || !e.projectedViewport))
|
|
164
|
+
return Wt({
|
|
165
|
+
widgetId: e.widgetId,
|
|
166
|
+
worldX: y().x,
|
|
167
|
+
worldY: y().y,
|
|
168
|
+
worldWidth: I().width,
|
|
169
|
+
worldHeight: I().height,
|
|
170
|
+
viewport: e.projectedViewport(),
|
|
171
|
+
ready: e.surfaceReady ?? !0
|
|
146
172
|
});
|
|
147
|
-
}),
|
|
148
|
-
const
|
|
173
|
+
}), wt = h(() => {
|
|
174
|
+
const t = e.itemSnapshot().z_index, i = Number.isFinite(t) ? Math.max(1, Math.min(99, Math.round(t))) : 1;
|
|
149
175
|
return String(i).padStart(2, "0");
|
|
150
|
-
}),
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
const
|
|
158
|
-
width: `${
|
|
159
|
-
height: `${
|
|
160
|
-
"z-index":
|
|
176
|
+
}), F = (t) => {
|
|
177
|
+
t.preventDefault(), t.stopPropagation(), e.onRequestOverview(e.itemSnapshot());
|
|
178
|
+
}, H = (t) => {
|
|
179
|
+
t.preventDefault(), t.stopPropagation(), e.onRequestFit(e.itemSnapshot());
|
|
180
|
+
}, O = (t) => {
|
|
181
|
+
t.preventDefault(), t.stopPropagation(), e.onRequestDelete(e.widgetId);
|
|
182
|
+
}, ut = h(() => {
|
|
183
|
+
const t = {
|
|
184
|
+
width: `${I().width}px`,
|
|
185
|
+
height: `${I().height}px`,
|
|
186
|
+
"z-index": L() || D() || e.optimisticFront ? `${e.topRenderLayer + 1}` : `${e.renderLayer}`
|
|
161
187
|
};
|
|
162
|
-
if (
|
|
188
|
+
if (e.layoutMode === "projected_surface") {
|
|
163
189
|
const i = Y()?.rect;
|
|
164
190
|
return {
|
|
165
|
-
...
|
|
166
|
-
transform: `translate3d(${i?.screenX ?? 0}px, ${i?.screenY ?? 0}px, 0) scale(${i?.viewportScale ?? Math.max(
|
|
191
|
+
...t,
|
|
192
|
+
transform: `translate3d(${i?.screenX ?? 0}px, ${i?.screenY ?? 0}px, 0) scale(${i?.viewportScale ?? Math.max(e.viewportScale, 1e-3)})`
|
|
167
193
|
};
|
|
168
194
|
}
|
|
169
195
|
return {
|
|
170
|
-
...
|
|
171
|
-
transform: `translate(${
|
|
196
|
+
...t,
|
|
197
|
+
transform: `translate(${y().x}px, ${y().y}px)`
|
|
172
198
|
};
|
|
173
|
-
}),
|
|
199
|
+
}), gt = (t) => {
|
|
174
200
|
const i = f(S);
|
|
175
201
|
if (!i) return;
|
|
176
|
-
const
|
|
202
|
+
const n = {
|
|
177
203
|
x: i.worldX,
|
|
178
204
|
y: i.worldY
|
|
179
|
-
},
|
|
205
|
+
}, r = {
|
|
180
206
|
x: i.startWorldX,
|
|
181
207
|
y: i.startWorldY
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
if (
|
|
186
|
-
|
|
208
|
+
}, a = t && (Math.abs(n.x - r.x) > 1 || Math.abs(n.y - r.y) > 1);
|
|
209
|
+
e.onCommitFront(e.widgetId), a && e.onCommitMove(e.widgetId, n), i.stopInteraction(), x(null), m = void 0;
|
|
210
|
+
}, q = (t) => {
|
|
211
|
+
if (t.button !== 0 || e.locked) return;
|
|
212
|
+
t.preventDefault(), t.stopPropagation(), m?.stop({
|
|
187
213
|
reason: "manual_stop",
|
|
188
214
|
commit: !1
|
|
189
|
-
}),
|
|
215
|
+
}), e.onSelect(e.widgetId), d?.focus({
|
|
190
216
|
preventScroll: !0
|
|
191
|
-
}),
|
|
192
|
-
const i =
|
|
193
|
-
|
|
194
|
-
pointerId:
|
|
195
|
-
startClientX:
|
|
196
|
-
startClientY:
|
|
197
|
-
startWorldX:
|
|
198
|
-
startWorldY:
|
|
199
|
-
worldX:
|
|
200
|
-
worldY:
|
|
217
|
+
}), e.onStartOptimisticFront(e.widgetId);
|
|
218
|
+
const i = A("drag", "grabbing"), n = Math.max(e.viewportScale, 1e-3);
|
|
219
|
+
x({
|
|
220
|
+
pointerId: t.pointerId,
|
|
221
|
+
startClientX: t.clientX,
|
|
222
|
+
startClientY: t.clientY,
|
|
223
|
+
startWorldX: e.x,
|
|
224
|
+
startWorldY: e.y,
|
|
225
|
+
worldX: e.x,
|
|
226
|
+
worldY: e.y,
|
|
201
227
|
moved: !1,
|
|
202
|
-
scale:
|
|
228
|
+
scale: n,
|
|
203
229
|
stopInteraction: i
|
|
204
230
|
});
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
if (!
|
|
208
|
-
const
|
|
231
|
+
const r = (a) => {
|
|
232
|
+
x((o) => {
|
|
233
|
+
if (!o || o.pointerId !== a.pointerId) return o;
|
|
234
|
+
const g = o.startWorldX + (a.clientX - o.startClientX) / o.scale, u = o.startWorldY + (a.clientY - o.startClientY) / o.scale;
|
|
209
235
|
return {
|
|
210
|
-
...
|
|
211
|
-
worldX:
|
|
212
|
-
worldY:
|
|
213
|
-
moved:
|
|
236
|
+
...o,
|
|
237
|
+
worldX: g,
|
|
238
|
+
worldY: u,
|
|
239
|
+
moved: o.moved || Math.abs(g - o.startWorldX) > 2 || Math.abs(u - o.startWorldY) > 2
|
|
214
240
|
};
|
|
215
241
|
});
|
|
216
242
|
};
|
|
217
|
-
|
|
218
|
-
pointerEvent:
|
|
219
|
-
captureEl:
|
|
220
|
-
onMove:
|
|
243
|
+
m = Q({
|
|
244
|
+
pointerEvent: t,
|
|
245
|
+
captureEl: t.currentTarget,
|
|
246
|
+
onMove: r,
|
|
221
247
|
onEnd: ({
|
|
222
|
-
commit:
|
|
223
|
-
}) =>
|
|
248
|
+
commit: a
|
|
249
|
+
}) => gt(a)
|
|
224
250
|
});
|
|
225
|
-
},
|
|
226
|
-
const i = f(
|
|
251
|
+
}, ht = (t) => {
|
|
252
|
+
const i = f($);
|
|
227
253
|
if (!i) return;
|
|
228
|
-
const
|
|
254
|
+
const n = {
|
|
229
255
|
width: i.width,
|
|
230
256
|
height: i.height
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
if (
|
|
235
|
-
|
|
257
|
+
}, r = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
|
|
258
|
+
t && r && e.onCommitResize(e.widgetId, n), i.stopInteraction(), T(null), _ = void 0;
|
|
259
|
+
}, ft = (t) => {
|
|
260
|
+
if (t.button !== 0 || e.locked) return;
|
|
261
|
+
t.preventDefault(), t.stopPropagation(), _?.stop({
|
|
236
262
|
reason: "manual_stop",
|
|
237
263
|
commit: !1
|
|
238
|
-
}),
|
|
239
|
-
const i =
|
|
264
|
+
}), e.onStartOptimisticFront(e.widgetId);
|
|
265
|
+
const i = A("resize", "nwse-resize"), n = Math.max(e.viewportScale, 1e-3);
|
|
240
266
|
T({
|
|
241
|
-
pointerId:
|
|
242
|
-
startClientX:
|
|
243
|
-
startClientY:
|
|
244
|
-
startWidth:
|
|
245
|
-
startHeight:
|
|
246
|
-
width:
|
|
247
|
-
height:
|
|
248
|
-
scale:
|
|
267
|
+
pointerId: t.pointerId,
|
|
268
|
+
startClientX: t.clientX,
|
|
269
|
+
startClientY: t.clientY,
|
|
270
|
+
startWidth: e.width,
|
|
271
|
+
startHeight: e.height,
|
|
272
|
+
width: e.width,
|
|
273
|
+
height: e.height,
|
|
274
|
+
scale: n,
|
|
249
275
|
stopInteraction: i
|
|
250
276
|
});
|
|
251
|
-
const
|
|
252
|
-
T((
|
|
253
|
-
if (!
|
|
254
|
-
const
|
|
277
|
+
const r = (a) => {
|
|
278
|
+
T((o) => {
|
|
279
|
+
if (!o || o.pointerId !== a.pointerId) return o;
|
|
280
|
+
const g = Math.max(At, o.startWidth + (a.clientX - o.startClientX) / o.scale), u = Math.max(Lt, o.startHeight + (a.clientY - o.startClientY) / o.scale);
|
|
255
281
|
return {
|
|
256
|
-
...
|
|
257
|
-
width:
|
|
258
|
-
height:
|
|
282
|
+
...o,
|
|
283
|
+
width: g,
|
|
284
|
+
height: u
|
|
259
285
|
};
|
|
260
286
|
});
|
|
261
287
|
};
|
|
262
|
-
|
|
263
|
-
pointerEvent:
|
|
264
|
-
captureEl:
|
|
265
|
-
onMove:
|
|
288
|
+
_ = Q({
|
|
289
|
+
pointerEvent: t,
|
|
290
|
+
captureEl: t.currentTarget,
|
|
291
|
+
onMove: r,
|
|
266
292
|
onEnd: ({
|
|
267
|
-
commit:
|
|
268
|
-
}) =>
|
|
293
|
+
commit: a
|
|
294
|
+
}) => ht(a)
|
|
269
295
|
});
|
|
270
296
|
};
|
|
271
297
|
return (() => {
|
|
272
|
-
var
|
|
273
|
-
return typeof
|
|
298
|
+
var t = zt(), i = t.firstChild, n = i.firstChild, r = n.firstChild, a = r.nextSibling, o = a.nextSibling, g = n.nextSibling, u = g.nextSibling, W = u.nextSibling, mt = W.firstChild, B = mt.nextSibling, _t = W.nextSibling, p = _t.firstChild, M = p.nextSibling, P = M.nextSibling, bt = i.nextSibling, j = d;
|
|
299
|
+
return typeof j == "function" ? St(j, t) : d = t, V(t, vt({
|
|
274
300
|
get classList() {
|
|
275
301
|
return {
|
|
276
|
-
"is-selected":
|
|
277
|
-
"is-dragging":
|
|
302
|
+
"is-selected": e.selected,
|
|
303
|
+
"is-dragging": L(),
|
|
278
304
|
"is-resizing": D(),
|
|
279
|
-
"is-filtered-out":
|
|
280
|
-
"is-projected-surface":
|
|
281
|
-
"is-locked":
|
|
305
|
+
"is-filtered-out": e.filtered,
|
|
306
|
+
"is-projected-surface": e.layoutMode === "projected_surface",
|
|
307
|
+
"is-locked": e.locked
|
|
282
308
|
};
|
|
283
309
|
}
|
|
284
310
|
}, () => ({
|
|
285
|
-
[
|
|
311
|
+
[s().dialogSurfaceHostAttr]: "true"
|
|
286
312
|
}), {
|
|
287
313
|
get "data-floe-workbench-widget-id"() {
|
|
288
|
-
return
|
|
314
|
+
return e.widgetId;
|
|
289
315
|
}
|
|
290
316
|
}, () => ({
|
|
291
|
-
[
|
|
317
|
+
[s().widgetRootAttr]: "true"
|
|
292
318
|
}), () => ({
|
|
293
|
-
[
|
|
319
|
+
[s().widgetIdAttr]: e.widgetId
|
|
294
320
|
}), {
|
|
295
321
|
get "data-workbench-widget-type"() {
|
|
296
|
-
return
|
|
322
|
+
return e.widgetType;
|
|
297
323
|
},
|
|
298
324
|
get "data-floe-workbench-render-mode"() {
|
|
299
|
-
return
|
|
325
|
+
return e.layoutMode ?? "canvas_scaled";
|
|
300
326
|
}
|
|
301
327
|
}, () => ({
|
|
302
|
-
[
|
|
328
|
+
[Mt]: e.selected ? "true" : void 0
|
|
303
329
|
}), {
|
|
304
330
|
tabIndex: 0,
|
|
305
|
-
onPointerDown:
|
|
331
|
+
onPointerDown: st,
|
|
306
332
|
onFocus: () => {
|
|
307
|
-
|
|
333
|
+
e.onSelect(e.widgetId);
|
|
308
334
|
},
|
|
309
|
-
onContextMenu: (
|
|
310
|
-
|
|
335
|
+
onContextMenu: (c) => {
|
|
336
|
+
X(c.target) === "widget_shell" && (c.preventDefault(), c.stopPropagation(), e.onContextMenu(c, e.itemSnapshot()));
|
|
311
337
|
},
|
|
312
338
|
get style() {
|
|
313
|
-
return
|
|
339
|
+
return ut();
|
|
314
340
|
}
|
|
315
|
-
}), !1, !0), i.$$pointerdown =
|
|
316
|
-
[
|
|
317
|
-
}, !1, !0),
|
|
341
|
+
}), !1, !0), i.$$pointerdown = q, V(i, {
|
|
342
|
+
[xt]: "true"
|
|
343
|
+
}, !1, !0), r.$$click = O, r.$$pointerdown = (c) => c.stopPropagation(), l(r, w(G, {
|
|
318
344
|
class: "workbench-widget__traffic-icon",
|
|
319
345
|
"aria-hidden": "true"
|
|
320
|
-
})),
|
|
346
|
+
})), a.$$click = F, a.$$pointerdown = (c) => c.stopPropagation(), l(a, w(K, {
|
|
321
347
|
class: "workbench-widget__traffic-icon",
|
|
322
348
|
"aria-hidden": "true"
|
|
323
|
-
})),
|
|
349
|
+
})), o.$$click = H, o.$$pointerdown = (c) => c.stopPropagation(), l(o, w(J, {
|
|
324
350
|
class: "workbench-widget__traffic-icon",
|
|
325
351
|
"aria-hidden": "true"
|
|
326
|
-
})),
|
|
352
|
+
})), l(g, wt), u.$$pointerdown = q, l(u, w(pt, {
|
|
327
353
|
class: "w-3.5 h-3.5"
|
|
328
|
-
})),
|
|
329
|
-
const
|
|
330
|
-
return w(
|
|
354
|
+
})), l(W, () => {
|
|
355
|
+
const c = e.definition.icon;
|
|
356
|
+
return w(c, {
|
|
331
357
|
class: "w-3.5 h-3.5"
|
|
332
358
|
});
|
|
333
|
-
},
|
|
359
|
+
}, B), l(B, () => e.widgetTitle), p.$$click = F, p.$$pointerdown = (c) => c.stopPropagation(), l(p, w(K, {
|
|
334
360
|
class: "workbench-widget__window-control-icon",
|
|
335
361
|
"aria-hidden": "true"
|
|
336
|
-
})),
|
|
362
|
+
})), M.$$click = H, M.$$pointerdown = (c) => c.stopPropagation(), l(M, w(J, {
|
|
337
363
|
class: "workbench-widget__window-control-icon",
|
|
338
364
|
"aria-hidden": "true"
|
|
339
|
-
})),
|
|
365
|
+
})), P.$$click = O, P.$$pointerdown = (c) => c.stopPropagation(), l(P, w(G, {
|
|
340
366
|
class: "workbench-widget__window-control-icon",
|
|
341
367
|
"aria-hidden": "true"
|
|
342
|
-
})),
|
|
343
|
-
const
|
|
344
|
-
return w(
|
|
368
|
+
})), l(bt, () => {
|
|
369
|
+
const c = e.definition.body;
|
|
370
|
+
return w(c, {
|
|
345
371
|
get widgetId() {
|
|
346
|
-
return
|
|
372
|
+
return e.widgetId;
|
|
347
373
|
},
|
|
348
374
|
get title() {
|
|
349
|
-
return
|
|
375
|
+
return e.widgetTitle;
|
|
350
376
|
},
|
|
351
377
|
get type() {
|
|
352
|
-
return
|
|
378
|
+
return e.widgetType;
|
|
353
379
|
},
|
|
354
380
|
surfaceMetrics: Y,
|
|
355
381
|
get activation() {
|
|
356
|
-
return
|
|
382
|
+
return tt();
|
|
357
383
|
},
|
|
358
384
|
get lifecycle() {
|
|
359
|
-
return
|
|
385
|
+
return rt();
|
|
360
386
|
},
|
|
361
387
|
get selected() {
|
|
362
|
-
return
|
|
388
|
+
return e.selected;
|
|
363
389
|
},
|
|
364
390
|
get filtered() {
|
|
365
|
-
return
|
|
391
|
+
return e.filtered;
|
|
366
392
|
},
|
|
367
|
-
requestActivate:
|
|
393
|
+
requestActivate: at
|
|
368
394
|
});
|
|
369
|
-
}),
|
|
370
|
-
var
|
|
371
|
-
return () =>
|
|
372
|
-
var
|
|
373
|
-
return
|
|
395
|
+
}), l(t, (() => {
|
|
396
|
+
var c = kt(() => !!e.locked);
|
|
397
|
+
return () => c() ? null : (() => {
|
|
398
|
+
var N = Rt();
|
|
399
|
+
return N.$$pointerdown = ft, N;
|
|
374
400
|
})();
|
|
375
|
-
})(), null),
|
|
401
|
+
})(), null), t;
|
|
376
402
|
})();
|
|
377
403
|
}
|
|
378
|
-
|
|
404
|
+
$t(["pointerdown", "click"]);
|
|
379
405
|
export {
|
|
380
|
-
|
|
406
|
+
Bt as WorkbenchWidget
|
|
381
407
|
};
|
|
@@ -1,103 +1,112 @@
|
|
|
1
|
-
import { isTypingElement as
|
|
2
|
-
import { DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { isTypingElement as E } from "../../utils/dom.js";
|
|
2
|
+
import { DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as R, resolveWorkbenchWidgetEventOwnership as v, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR as _, resolveSurfaceInteractionTargetRole as T, resolveSurfaceWheelRouting as A } from "../ui/localInteractionSurface.js";
|
|
3
|
+
const m = "data-floe-workbench-surface-root", a = "data-floe-workbench-widget-root", s = "data-floe-workbench-widget-id", h = "data-floe-dialog-surface-host";
|
|
4
|
+
function W(e) {
|
|
5
5
|
return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
const r = (e?.getAttribute(
|
|
7
|
+
function S(e, n = s) {
|
|
8
|
+
const r = (e?.getAttribute(n) ?? "").trim();
|
|
9
9
|
return r.length > 0 ? r : null;
|
|
10
10
|
}
|
|
11
|
-
function O(e,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
function O(e, n = a) {
|
|
12
|
+
const o = W(e);
|
|
13
|
+
if (!o) return null;
|
|
14
|
+
const r = o.closest(`[${n}="true"]`);
|
|
15
|
+
return r instanceof HTMLElement ? r : null;
|
|
15
16
|
}
|
|
16
17
|
function k(e) {
|
|
17
18
|
const {
|
|
18
|
-
root:
|
|
19
|
+
root: n,
|
|
19
20
|
widgetId: o,
|
|
20
21
|
widgetRootAttr: r = a,
|
|
21
|
-
readWidgetId: c = (i) =>
|
|
22
|
+
readWidgetId: c = (i) => S(i, s)
|
|
22
23
|
} = e;
|
|
23
|
-
if (!
|
|
24
|
-
const l =
|
|
24
|
+
if (!n || typeof n.querySelectorAll != "function") return null;
|
|
25
|
+
const l = n.querySelectorAll(`[${r}="true"]`);
|
|
25
26
|
for (const i of l)
|
|
26
27
|
if (i instanceof HTMLElement && c(i) === o)
|
|
27
28
|
return i;
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
31
|
function b(e) {
|
|
31
|
-
const
|
|
32
|
-
return
|
|
32
|
+
const n = k(e);
|
|
33
|
+
return n ? (n.focus({ preventScroll: !0 }), !0) : !1;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function g(e) {
|
|
35
36
|
return { kind: "canvas", reason: e };
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
return { kind: "widget", widgetId: e, reason:
|
|
38
|
+
function p(e, n) {
|
|
39
|
+
return { kind: "widget", widgetId: e, reason: n };
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
41
|
+
function C(e) {
|
|
42
|
+
const n = e.findWidgetRoot(e.target);
|
|
43
|
+
if (n) {
|
|
44
|
+
const r = e.readWidgetId(n);
|
|
45
|
+
return r !== null && r === e.selectedWidgetId ? { kind: "local_surface", reason: "selected_widget" } : e.disablePanZoom ? { kind: "ignore", reason: "pan_zoom_disabled" } : { kind: "canvas_zoom" };
|
|
46
|
+
}
|
|
47
|
+
const o = A({
|
|
42
48
|
target: e.target,
|
|
43
49
|
disablePanZoom: e.disablePanZoom,
|
|
44
50
|
wheelInteractiveSelector: e.wheelInteractiveSelector
|
|
45
51
|
});
|
|
46
|
-
return
|
|
52
|
+
return o.kind === "canvas_zoom" ? o : o.kind === "local_surface" ? { kind: "local_surface", reason: o.reason } : { kind: "ignore", reason: o.reason };
|
|
47
53
|
}
|
|
48
54
|
function D(e) {
|
|
49
|
-
const
|
|
50
|
-
root:
|
|
55
|
+
const n = e?.surfaceRootAttr ?? m, o = e?.widgetRootAttr ?? a, r = e?.widgetIdAttr ?? s, c = e?.dialogSurfaceHostAttr ?? h, l = e?.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', i = e?.panSurfaceSelector ?? '[data-floe-canvas-pan-surface="true"]', w = e?.wheelInteractiveSelector ?? R, d = e?.readWidgetId ?? ((t) => S(t, r)), f = e?.findWidgetRoot ?? ((t) => O(t, o)), I = e?.focusWidgetElement ?? ((t, u) => b({
|
|
56
|
+
root: t,
|
|
51
57
|
widgetId: u,
|
|
52
58
|
widgetRootAttr: o,
|
|
53
|
-
readWidgetId:
|
|
59
|
+
readWidgetId: d
|
|
54
60
|
}));
|
|
55
61
|
return {
|
|
56
62
|
...e,
|
|
57
|
-
surfaceRootAttr:
|
|
63
|
+
surfaceRootAttr: n,
|
|
58
64
|
widgetRootAttr: o,
|
|
59
65
|
widgetIdAttr: r,
|
|
60
66
|
dialogSurfaceHostAttr: c,
|
|
61
67
|
interactiveSelector: l,
|
|
62
68
|
panSurfaceSelector: i,
|
|
63
|
-
wheelInteractiveSelector:
|
|
64
|
-
createInitialInputOwner: e?.createInitialInputOwner ?? (() =>
|
|
65
|
-
createCanvasInputOwner: e?.createCanvasInputOwner ??
|
|
66
|
-
createWidgetInputOwner: e?.createWidgetInputOwner ??
|
|
67
|
-
readWidgetId:
|
|
68
|
-
findWidgetRoot:
|
|
69
|
-
focusWidgetElement:
|
|
70
|
-
resolveSurfaceTargetRole: e?.resolveSurfaceTargetRole ?? ((
|
|
71
|
-
target:
|
|
72
|
-
interactiveSelector:
|
|
73
|
-
panSurfaceSelector:
|
|
69
|
+
wheelInteractiveSelector: w,
|
|
70
|
+
createInitialInputOwner: e?.createInitialInputOwner ?? (() => g("initial")),
|
|
71
|
+
createCanvasInputOwner: e?.createCanvasInputOwner ?? g,
|
|
72
|
+
createWidgetInputOwner: e?.createWidgetInputOwner ?? p,
|
|
73
|
+
readWidgetId: d,
|
|
74
|
+
findWidgetRoot: f,
|
|
75
|
+
focusWidgetElement: I,
|
|
76
|
+
resolveSurfaceTargetRole: e?.resolveSurfaceTargetRole ?? ((t) => T({
|
|
77
|
+
target: t.target,
|
|
78
|
+
interactiveSelector: t.interactiveSelector,
|
|
79
|
+
panSurfaceSelector: t.panSurfaceSelector
|
|
74
80
|
})),
|
|
75
|
-
resolveWidgetEventOwnership: e?.resolveWidgetEventOwnership ?? ((
|
|
76
|
-
target:
|
|
77
|
-
widgetRoot:
|
|
78
|
-
interactiveSelector:
|
|
79
|
-
panSurfaceSelector:
|
|
80
|
-
shellSelector:
|
|
81
|
+
resolveWidgetEventOwnership: e?.resolveWidgetEventOwnership ?? ((t) => v({
|
|
82
|
+
target: t.target,
|
|
83
|
+
widgetRoot: t.widgetRoot,
|
|
84
|
+
interactiveSelector: t.interactiveSelector,
|
|
85
|
+
panSurfaceSelector: t.panSurfaceSelector,
|
|
86
|
+
shellSelector: _
|
|
81
87
|
})),
|
|
82
|
-
resolveWheelRouting: e?.resolveWheelRouting ?? ((
|
|
83
|
-
target:
|
|
84
|
-
disablePanZoom:
|
|
85
|
-
|
|
88
|
+
resolveWheelRouting: e?.resolveWheelRouting ?? ((t) => C({
|
|
89
|
+
target: t.target,
|
|
90
|
+
disablePanZoom: t.disablePanZoom,
|
|
91
|
+
selectedWidgetId: t.selectedWidgetId,
|
|
92
|
+
wheelInteractiveSelector: t.wheelInteractiveSelector,
|
|
93
|
+
findWidgetRoot: f,
|
|
94
|
+
readWidgetId: d
|
|
86
95
|
})),
|
|
87
|
-
shouldBypassGlobalHotkeys: e?.shouldBypassGlobalHotkeys ?? ((
|
|
88
|
-
const u =
|
|
89
|
-
return
|
|
96
|
+
shouldBypassGlobalHotkeys: e?.shouldBypassGlobalHotkeys ?? ((t) => {
|
|
97
|
+
const u = W(t.target);
|
|
98
|
+
return E(u);
|
|
90
99
|
})
|
|
91
100
|
};
|
|
92
101
|
}
|
|
93
102
|
export {
|
|
94
103
|
h as DEFAULT_WORKBENCH_DIALOG_SURFACE_HOST_ATTR,
|
|
95
|
-
|
|
104
|
+
m as DEFAULT_WORKBENCH_SURFACE_ROOT_ATTR,
|
|
96
105
|
s as DEFAULT_WORKBENCH_WIDGET_ID_ATTR,
|
|
97
106
|
a as DEFAULT_WORKBENCH_WIDGET_ROOT_ATTR,
|
|
98
107
|
k as findWorkbenchWidgetElement,
|
|
99
108
|
O as findWorkbenchWidgetRoot,
|
|
100
109
|
b as focusWorkbenchWidgetElement,
|
|
101
|
-
|
|
110
|
+
S as readWorkbenchWidgetId,
|
|
102
111
|
D as resolveWorkbenchInteractionAdapter
|
|
103
112
|
};
|