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