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