@floegence/floe-webapp-core 0.36.17 → 0.36.18
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/ui/index.d.ts +1 -1
- package/dist/components/ui/localInteractionSurface.d.ts +2 -0
- package/dist/components/ui/localInteractionSurface.js +51 -26
- package/dist/components/workbench/WorkbenchWidget.js +120 -101
- package/dist/components/workbench/types.d.ts +7 -0
- package/dist/full.js +463 -462
- package/dist/ui.js +102 -101
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ export { CommandPalette } from './CommandPalette';
|
|
|
9
9
|
export { InfiniteCanvas, type InfiniteCanvasProps, type InfiniteCanvasPoint, type InfiniteCanvasContextMenuEvent, } from './InfiniteCanvas';
|
|
10
10
|
export { startPointerSession, type PointerSessionController, type PointerSessionEndEvent, type PointerSessionEndReason, type PointerSessionSnapshot, type StartPointerSessionOptions, } from './pointerSession';
|
|
11
11
|
export { clientToCanvasLocal, clientToCanvasWorld, createViewportFromZoomAnchor, isPointInsideCanvasRect, localToCanvasWorld, type CanvasClientPoint, type CanvasLocalPoint, type CanvasViewportLike, type CanvasViewportRectLike, type CanvasWorldPoint, } from './canvasGeometry';
|
|
12
|
-
export { CANVAS_WHEEL_INTERACTIVE_ATTR, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR, LOCAL_INTERACTION_SURFACE_ATTR, DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR, WORKBENCH_WIDGET_SHELL_ATTR, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR, isLocalInteractionSurfaceTarget, resolveSurfaceInteractionTargetRole, resolveSurfaceWheelRouting, resolveWorkbenchWidgetEventOwnership, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type SurfaceWheelLocalReason, type SurfaceWheelRoutingDecision, type SurfaceWheelRoutingOptions, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, } from './localInteractionSurface';
|
|
12
|
+
export { CANVAS_WHEEL_INTERACTIVE_ATTR, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR, LOCAL_INTERACTION_SURFACE_ATTR, DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR, WORKBENCH_WIDGET_SHELL_ATTR, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR, isLocalInteractionSurfaceTarget, resolveSurfaceInteractionTargetRole, resolveSurfaceWheelRouting, resolveWorkbenchWidgetEventOwnership, shouldActivateWorkbenchWidgetLocalTarget, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type SurfaceWheelLocalReason, type SurfaceWheelRoutingDecision, type SurfaceWheelRoutingOptions, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, type WorkbenchWidgetLocalActivationTargetOptions, } from './localInteractionSurface';
|
|
13
13
|
export { DIALOG_SURFACE_HOST_ATTR, SURFACE_PORTAL_HOST_ATTR, SURFACE_PORTAL_LAYER_ATTR, DIALOG_SURFACE_BOUNDARY_ATTR, ensureSurfacePortalInteractionTracking, isSurfacePortalMode, projectSurfacePortalPosition, projectSurfacePortalRect, resolveSurfacePortalBoundaryRect, resolveSurfacePortalHost, resolveSurfacePortalMount, resolveSurfacePortalMountRect, __resetSurfacePortalScopeForTests, type ResolvedSurfacePortalHost, type SurfacePortalBoundaryRect, type SurfacePortalInteractionSnapshot, type SurfacePortalMode, type SurfacePortalRect, } from './surfacePortalScope';
|
|
14
14
|
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Interactive3DCard, AnimatedBorderCard, NeonCard, MorphCard, type CardProps, type CardVariant, type CardHeaderProps, type CardTitleProps, type CardDescriptionProps, type CardContentProps, type CardFooterProps, type Interactive3DCardProps, type AnimatedBorderCardProps, type NeonCardProps, type MorphCardProps, } from './Card';
|
|
15
15
|
export { Tabs, TabPanel, type TabsProps, type TabPanelProps, type TabItem, type TabsFeatures, type TabsSlotClassNames, type TabsIndicatorMode, type TabsIndicatorColorToken, } from './Tabs';
|
|
@@ -26,6 +26,7 @@ export interface WorkbenchWidgetEventOwnershipOptions extends SurfaceInteraction
|
|
|
26
26
|
widgetRoot: Element | EventTarget | null;
|
|
27
27
|
shellSelector?: string;
|
|
28
28
|
}
|
|
29
|
+
export type WorkbenchWidgetLocalActivationTargetOptions = WorkbenchWidgetEventOwnershipOptions;
|
|
29
30
|
export interface SurfaceWheelRoutingOptions {
|
|
30
31
|
target: EventTarget | null;
|
|
31
32
|
disablePanZoom: boolean;
|
|
@@ -36,3 +37,4 @@ export declare function resolveSurfaceInteractionTargetRole(options: SurfaceInte
|
|
|
36
37
|
export declare function resolveSurfaceWheelRouting(options: SurfaceWheelRoutingOptions): SurfaceWheelRoutingDecision;
|
|
37
38
|
export declare function isLocalInteractionSurfaceTarget(options: SurfaceInteractionRoutingOptions): boolean;
|
|
38
39
|
export declare function resolveWorkbenchWidgetEventOwnership(options: WorkbenchWidgetEventOwnershipOptions): WorkbenchWidgetEventOwnership;
|
|
40
|
+
export declare function shouldActivateWorkbenchWidgetLocalTarget(options: WorkbenchWidgetLocalActivationTargetOptions): boolean;
|
|
@@ -1,48 +1,73 @@
|
|
|
1
|
-
import { isTypingElement as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { isTypingElement as o } from "../../utils/dom.js";
|
|
2
|
+
const f = "data-floe-local-interaction-surface", u = `[${f}="true"]`, E = "data-floe-canvas-wheel-interactive", d = `[${E}="true"]`, _ = "data-floe-workbench-widget-shell", i = `[${_}="true"]`;
|
|
3
|
+
function a(e) {
|
|
4
4
|
return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
|
|
5
5
|
}
|
|
6
|
+
function T(e) {
|
|
7
|
+
if (!e || typeof HTMLElement > "u" || !(e instanceof HTMLElement))
|
|
8
|
+
return !1;
|
|
9
|
+
if (e.matches("button, input, select, textarea, summary") || e.matches("a[href], area[href]") || e.matches('iframe, [contenteditable="true"]')) return !0;
|
|
10
|
+
const t = e.getAttribute("tabindex");
|
|
11
|
+
return t !== null && t !== "-1";
|
|
12
|
+
}
|
|
13
|
+
function S(e, t) {
|
|
14
|
+
let r = e;
|
|
15
|
+
for (; r && r !== t; ) {
|
|
16
|
+
if (o(r) || T(r))
|
|
17
|
+
return !0;
|
|
18
|
+
r = r.parentElement;
|
|
19
|
+
}
|
|
20
|
+
return !1;
|
|
21
|
+
}
|
|
6
22
|
function s(e) {
|
|
7
23
|
const {
|
|
8
24
|
target: t,
|
|
9
|
-
interactiveSelector:
|
|
10
|
-
panSurfaceSelector:
|
|
11
|
-
localInteractionSurfaceSelector: n =
|
|
12
|
-
} = e,
|
|
13
|
-
return
|
|
25
|
+
interactiveSelector: r,
|
|
26
|
+
panSurfaceSelector: c,
|
|
27
|
+
localInteractionSurfaceSelector: n = u
|
|
28
|
+
} = e, l = t instanceof Element ? t : null;
|
|
29
|
+
return l ? l.closest(c) !== null ? "pan_surface" : o(l) || l.closest(r) !== null || l.closest(n) !== null ? "local_surface" : "canvas" : "canvas";
|
|
14
30
|
}
|
|
15
|
-
function
|
|
31
|
+
function g(e) {
|
|
16
32
|
const {
|
|
17
33
|
target: t,
|
|
18
|
-
localInteractionSurfaceSelector:
|
|
19
|
-
wheelInteractiveSelector:
|
|
20
|
-
} = e, n =
|
|
21
|
-
return n ?
|
|
34
|
+
localInteractionSurfaceSelector: r = u,
|
|
35
|
+
wheelInteractiveSelector: c = d
|
|
36
|
+
} = e, n = a(t);
|
|
37
|
+
return n ? o(n) ? "typing_element" : n.closest(r) !== null ? "local_interaction_surface" : n.closest(c) !== null ? "wheel_interactive" : null : null;
|
|
22
38
|
}
|
|
23
|
-
function
|
|
24
|
-
const t =
|
|
39
|
+
function L(e) {
|
|
40
|
+
const t = g(e);
|
|
25
41
|
return t ? { kind: "local_surface", reason: t } : e.disablePanZoom ? { kind: "ignore", reason: "pan_zoom_disabled" } : { kind: "canvas_zoom" };
|
|
26
42
|
}
|
|
27
43
|
function A(e) {
|
|
28
44
|
return s(e) !== "canvas";
|
|
29
45
|
}
|
|
30
|
-
function
|
|
46
|
+
function m(e) {
|
|
47
|
+
const {
|
|
48
|
+
widgetRoot: t,
|
|
49
|
+
shellSelector: r = i
|
|
50
|
+
} = e, c = a(t), n = a(e.target);
|
|
51
|
+
return !c || !n || !c.contains(n) ? "outside_widget" : s(e) !== "canvas" ? "widget_local" : n === c || n.closest(r) !== null ? "widget_shell" : "widget_local";
|
|
52
|
+
}
|
|
53
|
+
function R(e) {
|
|
31
54
|
const {
|
|
32
55
|
widgetRoot: t,
|
|
33
|
-
shellSelector:
|
|
34
|
-
|
|
35
|
-
|
|
56
|
+
shellSelector: r = i,
|
|
57
|
+
localInteractionSurfaceSelector: c = u
|
|
58
|
+
} = e, n = a(t), l = a(e.target);
|
|
59
|
+
return !n || !l || !n.contains(l) || l === n || l.closest(r) !== null || l.closest(e.panSurfaceSelector) !== null || l.closest(c) !== null || S(l, n) ? !1 : m(e) === "widget_local";
|
|
36
60
|
}
|
|
37
61
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
E as CANVAS_WHEEL_INTERACTIVE_ATTR,
|
|
63
|
+
d as DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR,
|
|
64
|
+
u as DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR,
|
|
65
|
+
i as DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR,
|
|
66
|
+
f as LOCAL_INTERACTION_SURFACE_ATTR,
|
|
43
67
|
_ as WORKBENCH_WIDGET_SHELL_ATTR,
|
|
44
68
|
A as isLocalInteractionSurfaceTarget,
|
|
45
69
|
s as resolveSurfaceInteractionTargetRole,
|
|
46
|
-
|
|
47
|
-
|
|
70
|
+
L as resolveSurfaceWheelRouting,
|
|
71
|
+
m as resolveWorkbenchWidgetEventOwnership,
|
|
72
|
+
R as shouldActivateWorkbenchWidgetLocalTarget
|
|
48
73
|
};
|
|
@@ -1,35 +1,51 @@
|
|
|
1
|
-
import { spread as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { startHotInteraction as
|
|
4
|
-
import { X as
|
|
5
|
-
import { CANVAS_WHEEL_INTERACTIVE_ATTR as
|
|
1
|
+
import { spread as L, mergeProps as at, insert as l, createComponent as c, memo as rt, template as q, use as dt, delegateEvents as lt } from "solid-js/web";
|
|
2
|
+
import { createSignal as C, onCleanup as ct, untrack as S, createMemo as f } from "solid-js";
|
|
3
|
+
import { startHotInteraction as A } from "../../utils/hotInteraction.js";
|
|
4
|
+
import { X as O, Minus as F, Maximize as N, GripVertical as st } from "../icons/index.js";
|
|
5
|
+
import { CANVAS_WHEEL_INTERACTIVE_ATTR as wt, WORKBENCH_WIDGET_SHELL_ATTR as gt, shouldActivateWorkbenchWidgetLocalTarget as ht, resolveWorkbenchWidgetEventOwnership as ut } from "../ui/localInteractionSurface.js";
|
|
6
6
|
import { startPointerSession as j } from "../ui/pointerSession.js";
|
|
7
|
-
import { createWorkbenchWidgetSurfaceMetrics as
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
const [
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import { createWorkbenchWidgetSurfaceMetrics as ft } from "./workbenchHelpers.js";
|
|
8
|
+
var _t = /* @__PURE__ */ q('<article class=workbench-widget data-floe-dialog-surface-host=true><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>'), bt = /* @__PURE__ */ q('<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">');
|
|
9
|
+
const mt = 220, vt = 160, B = '[data-floe-canvas-interactive="true"]', V = '[data-floe-canvas-pan-surface="true"]';
|
|
10
|
+
function Ct(t) {
|
|
11
|
+
const [_, I] = C(null), [b, x] = C(null), [G, Z] = C();
|
|
12
|
+
let h, u, g;
|
|
13
|
+
ct(() => {
|
|
14
|
+
h?.stop({
|
|
15
15
|
reason: "manual_stop",
|
|
16
16
|
commit: !1
|
|
17
|
-
}),
|
|
17
|
+
}), h = void 0, u?.stop({
|
|
18
18
|
reason: "manual_stop",
|
|
19
19
|
commit: !1
|
|
20
|
-
}),
|
|
20
|
+
}), u = void 0, S(_)?.stopInteraction(), S(b)?.stopInteraction();
|
|
21
21
|
});
|
|
22
|
-
const
|
|
22
|
+
const W = () => _() !== null, R = () => b() !== null, p = (e) => ut({
|
|
23
23
|
target: e,
|
|
24
|
-
widgetRoot:
|
|
25
|
-
interactiveSelector:
|
|
26
|
-
panSurfaceSelector:
|
|
27
|
-
}),
|
|
28
|
-
e.button
|
|
29
|
-
|
|
24
|
+
widgetRoot: g ?? null,
|
|
25
|
+
interactiveSelector: B,
|
|
26
|
+
panSurfaceSelector: V
|
|
27
|
+
}), K = (e) => {
|
|
28
|
+
if (e.button !== 0) return;
|
|
29
|
+
t.onSelect(t.widgetId), t.onCommitFront(t.widgetId);
|
|
30
|
+
const i = p(e.target);
|
|
31
|
+
if (i === "widget_shell") {
|
|
32
|
+
g?.focus({
|
|
33
|
+
preventScroll: !0
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
i === "widget_local" && ht({
|
|
38
|
+
target: e.target,
|
|
39
|
+
widgetRoot: g ?? null,
|
|
40
|
+
interactiveSelector: B,
|
|
41
|
+
panSurfaceSelector: V
|
|
42
|
+
}) && Z((r) => ({
|
|
43
|
+
seq: (r?.seq ?? 0) + 1,
|
|
44
|
+
source: "local_pointer",
|
|
45
|
+
pointerType: e.pointerType || void 0
|
|
30
46
|
}));
|
|
31
|
-
}, m =
|
|
32
|
-
const e =
|
|
47
|
+
}, m = f(() => {
|
|
48
|
+
const e = _();
|
|
33
49
|
return e ? {
|
|
34
50
|
x: e.worldX,
|
|
35
51
|
y: e.worldY
|
|
@@ -37,7 +53,7 @@ function xt(t) {
|
|
|
37
53
|
x: t.x,
|
|
38
54
|
y: t.y
|
|
39
55
|
};
|
|
40
|
-
}), v =
|
|
56
|
+
}), v = f(() => {
|
|
41
57
|
const e = b();
|
|
42
58
|
return e ? {
|
|
43
59
|
width: e.width,
|
|
@@ -46,9 +62,9 @@ function xt(t) {
|
|
|
46
62
|
width: t.width,
|
|
47
63
|
height: t.height
|
|
48
64
|
};
|
|
49
|
-
}),
|
|
65
|
+
}), E = f(() => {
|
|
50
66
|
if (!(t.layoutMode !== "projected_surface" || !t.projectedViewport))
|
|
51
|
-
return
|
|
67
|
+
return ft({
|
|
52
68
|
widgetId: t.widgetId,
|
|
53
69
|
worldX: m().x,
|
|
54
70
|
worldY: m().y,
|
|
@@ -57,23 +73,23 @@ function xt(t) {
|
|
|
57
73
|
viewport: t.projectedViewport,
|
|
58
74
|
ready: t.surfaceReady ?? !0
|
|
59
75
|
});
|
|
60
|
-
}),
|
|
76
|
+
}), U = f(() => {
|
|
61
77
|
const e = t.itemSnapshot().z_index, i = Number.isFinite(e) ? Math.max(1, Math.min(99, Math.round(e))) : 1;
|
|
62
78
|
return String(i).padStart(2, "0");
|
|
63
|
-
}),
|
|
79
|
+
}), T = (e) => {
|
|
64
80
|
e.preventDefault(), e.stopPropagation(), t.onRequestOverview(t.itemSnapshot());
|
|
65
|
-
},
|
|
81
|
+
}, z = (e) => {
|
|
66
82
|
e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
|
|
67
83
|
}, D = (e) => {
|
|
68
84
|
e.preventDefault(), e.stopPropagation(), t.onRequestDelete(t.widgetId);
|
|
69
|
-
},
|
|
85
|
+
}, J = f(() => {
|
|
70
86
|
const e = {
|
|
71
87
|
width: `${v().width}px`,
|
|
72
88
|
height: `${v().height}px`,
|
|
73
|
-
"z-index":
|
|
89
|
+
"z-index": W() || R() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
|
|
74
90
|
};
|
|
75
91
|
if (t.layoutMode === "projected_surface") {
|
|
76
|
-
const i =
|
|
92
|
+
const i = E()?.rect;
|
|
77
93
|
return {
|
|
78
94
|
...e,
|
|
79
95
|
left: `${i?.screenX ?? 0}px`,
|
|
@@ -85,29 +101,29 @@ function xt(t) {
|
|
|
85
101
|
...e,
|
|
86
102
|
transform: `translate(${m().x}px, ${m().y}px)`
|
|
87
103
|
};
|
|
88
|
-
}),
|
|
89
|
-
const i = S(
|
|
104
|
+
}), Q = (e) => {
|
|
105
|
+
const i = S(_);
|
|
90
106
|
if (!i) return;
|
|
91
|
-
const
|
|
107
|
+
const r = {
|
|
92
108
|
x: i.worldX,
|
|
93
109
|
y: i.worldY
|
|
94
|
-
},
|
|
110
|
+
}, d = {
|
|
95
111
|
x: i.startWorldX,
|
|
96
112
|
y: i.startWorldY
|
|
97
|
-
}, a = e && (Math.abs(
|
|
98
|
-
t.onCommitFront(t.widgetId), a && t.onCommitMove(t.widgetId,
|
|
113
|
+
}, a = e && (Math.abs(r.x - d.x) > 1 || Math.abs(r.y - d.y) > 1);
|
|
114
|
+
t.onCommitFront(t.widgetId), a && t.onCommitMove(t.widgetId, r), i.stopInteraction(), I(null), h = void 0;
|
|
99
115
|
}, X = (e) => {
|
|
100
116
|
if (e.button !== 0 || t.locked) return;
|
|
101
|
-
e.preventDefault(), e.stopPropagation(),
|
|
117
|
+
e.preventDefault(), e.stopPropagation(), h?.stop({
|
|
102
118
|
reason: "manual_stop",
|
|
103
119
|
commit: !1
|
|
104
|
-
}), t.onSelect(t.widgetId),
|
|
120
|
+
}), t.onSelect(t.widgetId), g?.focus({
|
|
105
121
|
preventScroll: !0
|
|
106
122
|
}), t.onStartOptimisticFront(t.widgetId);
|
|
107
|
-
const i =
|
|
123
|
+
const i = A({
|
|
108
124
|
kind: "drag",
|
|
109
125
|
cursor: "grabbing"
|
|
110
|
-
}),
|
|
126
|
+
}), r = Math.max(t.viewportScale, 1e-3);
|
|
111
127
|
I({
|
|
112
128
|
pointerId: e.pointerId,
|
|
113
129
|
startClientX: e.clientX,
|
|
@@ -117,47 +133,47 @@ function xt(t) {
|
|
|
117
133
|
worldX: t.x,
|
|
118
134
|
worldY: t.y,
|
|
119
135
|
moved: !1,
|
|
120
|
-
scale:
|
|
136
|
+
scale: r,
|
|
121
137
|
stopInteraction: i
|
|
122
138
|
});
|
|
123
|
-
const
|
|
124
|
-
I((
|
|
125
|
-
if (!
|
|
126
|
-
const w =
|
|
139
|
+
const d = (a) => {
|
|
140
|
+
I((o) => {
|
|
141
|
+
if (!o || o.pointerId !== a.pointerId) return o;
|
|
142
|
+
const w = o.startWorldX + (a.clientX - o.startClientX) / o.scale, s = o.startWorldY + (a.clientY - o.startClientY) / o.scale;
|
|
127
143
|
return {
|
|
128
|
-
...
|
|
144
|
+
...o,
|
|
129
145
|
worldX: w,
|
|
130
146
|
worldY: s,
|
|
131
|
-
moved:
|
|
147
|
+
moved: o.moved || Math.abs(w - o.startWorldX) > 2 || Math.abs(s - o.startWorldY) > 2
|
|
132
148
|
};
|
|
133
149
|
});
|
|
134
150
|
};
|
|
135
|
-
|
|
151
|
+
h = j({
|
|
136
152
|
pointerEvent: e,
|
|
137
153
|
captureEl: e.currentTarget,
|
|
138
|
-
onMove:
|
|
154
|
+
onMove: d,
|
|
139
155
|
onEnd: ({
|
|
140
156
|
commit: a
|
|
141
|
-
}) =>
|
|
157
|
+
}) => Q(a)
|
|
142
158
|
});
|
|
143
|
-
},
|
|
159
|
+
}, tt = (e) => {
|
|
144
160
|
const i = S(b);
|
|
145
161
|
if (!i) return;
|
|
146
|
-
const
|
|
162
|
+
const r = {
|
|
147
163
|
width: i.width,
|
|
148
164
|
height: i.height
|
|
149
|
-
},
|
|
150
|
-
e &&
|
|
151
|
-
},
|
|
165
|
+
}, d = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
|
|
166
|
+
e && d && t.onCommitResize(t.widgetId, r), i.stopInteraction(), x(null), u = void 0;
|
|
167
|
+
}, et = (e) => {
|
|
152
168
|
if (e.button !== 0 || t.locked) return;
|
|
153
|
-
e.preventDefault(), e.stopPropagation(),
|
|
169
|
+
e.preventDefault(), e.stopPropagation(), u?.stop({
|
|
154
170
|
reason: "manual_stop",
|
|
155
171
|
commit: !1
|
|
156
172
|
}), t.onStartOptimisticFront(t.widgetId);
|
|
157
|
-
const i =
|
|
173
|
+
const i = A({
|
|
158
174
|
kind: "drag",
|
|
159
175
|
cursor: "nwse-resize"
|
|
160
|
-
}),
|
|
176
|
+
}), r = Math.max(t.viewportScale, 1e-3);
|
|
161
177
|
x({
|
|
162
178
|
pointerId: e.pointerId,
|
|
163
179
|
startClientX: e.clientX,
|
|
@@ -166,37 +182,37 @@ function xt(t) {
|
|
|
166
182
|
startHeight: t.height,
|
|
167
183
|
width: t.width,
|
|
168
184
|
height: t.height,
|
|
169
|
-
scale:
|
|
185
|
+
scale: r,
|
|
170
186
|
stopInteraction: i
|
|
171
187
|
});
|
|
172
|
-
const
|
|
173
|
-
x((
|
|
174
|
-
if (!
|
|
175
|
-
const w = Math.max(
|
|
188
|
+
const d = (a) => {
|
|
189
|
+
x((o) => {
|
|
190
|
+
if (!o || o.pointerId !== a.pointerId) return o;
|
|
191
|
+
const w = Math.max(mt, o.startWidth + (a.clientX - o.startClientX) / o.scale), s = Math.max(vt, o.startHeight + (a.clientY - o.startClientY) / o.scale);
|
|
176
192
|
return {
|
|
177
|
-
...
|
|
193
|
+
...o,
|
|
178
194
|
width: w,
|
|
179
195
|
height: s
|
|
180
196
|
};
|
|
181
197
|
});
|
|
182
198
|
};
|
|
183
|
-
|
|
199
|
+
u = j({
|
|
184
200
|
pointerEvent: e,
|
|
185
201
|
captureEl: e.currentTarget,
|
|
186
|
-
onMove:
|
|
202
|
+
onMove: d,
|
|
187
203
|
onEnd: ({
|
|
188
204
|
commit: a
|
|
189
|
-
}) =>
|
|
205
|
+
}) => tt(a)
|
|
190
206
|
});
|
|
191
207
|
};
|
|
192
208
|
return (() => {
|
|
193
|
-
var e =
|
|
194
|
-
return typeof
|
|
209
|
+
var e = _t(), i = e.firstChild, r = i.firstChild, d = r.firstChild, a = d.nextSibling, o = a.nextSibling, w = r.nextSibling, s = w.nextSibling, y = s.nextSibling, it = y.firstChild, P = it.nextSibling, ot = y.nextSibling, $ = ot.firstChild, k = $.nextSibling, M = k.nextSibling, nt = i.nextSibling, Y = g;
|
|
210
|
+
return typeof Y == "function" ? dt(Y, e) : g = e, L(e, at({
|
|
195
211
|
get classList() {
|
|
196
212
|
return {
|
|
197
213
|
"is-selected": t.selected,
|
|
198
|
-
"is-dragging":
|
|
199
|
-
"is-resizing":
|
|
214
|
+
"is-dragging": W(),
|
|
215
|
+
"is-resizing": R(),
|
|
200
216
|
"is-filtered-out": t.filtered,
|
|
201
217
|
"is-projected-surface": t.layoutMode === "projected_surface",
|
|
202
218
|
"is-locked": t.locked
|
|
@@ -212,49 +228,49 @@ function xt(t) {
|
|
|
212
228
|
return t.layoutMode ?? "canvas_scaled";
|
|
213
229
|
}
|
|
214
230
|
}, () => ({
|
|
215
|
-
[
|
|
231
|
+
[wt]: t.selected ? "true" : void 0
|
|
216
232
|
}), {
|
|
217
233
|
tabIndex: 0,
|
|
218
|
-
onPointerDown:
|
|
234
|
+
onPointerDown: K,
|
|
219
235
|
onFocus: () => {
|
|
220
236
|
t.onSelect(t.widgetId);
|
|
221
237
|
},
|
|
222
|
-
onContextMenu: (
|
|
223
|
-
|
|
238
|
+
onContextMenu: (n) => {
|
|
239
|
+
p(n.target) === "widget_shell" && (n.preventDefault(), n.stopPropagation(), t.onContextMenu(n, t.itemSnapshot()));
|
|
224
240
|
},
|
|
225
241
|
get style() {
|
|
226
|
-
return
|
|
242
|
+
return J();
|
|
227
243
|
}
|
|
228
|
-
}), !1, !0), i.$$pointerdown = X,
|
|
229
|
-
[
|
|
230
|
-
}, !1, !0),
|
|
244
|
+
}), !1, !0), i.$$pointerdown = X, L(i, {
|
|
245
|
+
[gt]: "true"
|
|
246
|
+
}, !1, !0), d.$$click = D, d.$$pointerdown = (n) => n.stopPropagation(), l(d, c(O, {
|
|
231
247
|
class: "workbench-widget__traffic-icon",
|
|
232
248
|
"aria-hidden": "true"
|
|
233
|
-
})), a.$$click =
|
|
249
|
+
})), a.$$click = T, a.$$pointerdown = (n) => n.stopPropagation(), l(a, c(F, {
|
|
234
250
|
class: "workbench-widget__traffic-icon",
|
|
235
251
|
"aria-hidden": "true"
|
|
236
|
-
})),
|
|
252
|
+
})), o.$$click = z, o.$$pointerdown = (n) => n.stopPropagation(), l(o, c(N, {
|
|
237
253
|
class: "workbench-widget__traffic-icon",
|
|
238
254
|
"aria-hidden": "true"
|
|
239
|
-
})), l(w,
|
|
255
|
+
})), l(w, U), s.$$pointerdown = X, l(s, c(st, {
|
|
240
256
|
class: "w-3.5 h-3.5"
|
|
241
|
-
})), l(
|
|
242
|
-
const
|
|
243
|
-
return c(
|
|
257
|
+
})), l(y, () => {
|
|
258
|
+
const n = t.definition.icon;
|
|
259
|
+
return c(n, {
|
|
244
260
|
class: "w-3.5 h-3.5"
|
|
245
261
|
});
|
|
246
|
-
},
|
|
262
|
+
}, P), l(P, () => t.widgetTitle), $.$$click = T, $.$$pointerdown = (n) => n.stopPropagation(), l($, c(F, {
|
|
247
263
|
class: "workbench-widget__window-control-icon",
|
|
248
264
|
"aria-hidden": "true"
|
|
249
|
-
})), k.$$click =
|
|
265
|
+
})), k.$$click = z, k.$$pointerdown = (n) => n.stopPropagation(), l(k, c(N, {
|
|
250
266
|
class: "workbench-widget__window-control-icon",
|
|
251
267
|
"aria-hidden": "true"
|
|
252
|
-
})),
|
|
268
|
+
})), M.$$click = D, M.$$pointerdown = (n) => n.stopPropagation(), l(M, c(O, {
|
|
253
269
|
class: "workbench-widget__window-control-icon",
|
|
254
270
|
"aria-hidden": "true"
|
|
255
|
-
})), l(
|
|
256
|
-
const
|
|
257
|
-
return c(
|
|
271
|
+
})), l(nt, () => {
|
|
272
|
+
const n = t.definition.body;
|
|
273
|
+
return c(n, {
|
|
258
274
|
get widgetId() {
|
|
259
275
|
return t.widgetId;
|
|
260
276
|
},
|
|
@@ -265,19 +281,22 @@ function xt(t) {
|
|
|
265
281
|
return t.widgetType;
|
|
266
282
|
},
|
|
267
283
|
get surfaceMetrics() {
|
|
268
|
-
return
|
|
284
|
+
return E();
|
|
285
|
+
},
|
|
286
|
+
get activation() {
|
|
287
|
+
return G();
|
|
269
288
|
}
|
|
270
289
|
});
|
|
271
290
|
}), l(e, (() => {
|
|
272
|
-
var
|
|
273
|
-
return () =>
|
|
274
|
-
var
|
|
275
|
-
return
|
|
291
|
+
var n = rt(() => !!t.locked);
|
|
292
|
+
return () => n() ? null : (() => {
|
|
293
|
+
var H = bt();
|
|
294
|
+
return H.$$pointerdown = et, H;
|
|
276
295
|
})();
|
|
277
296
|
})(), null), e;
|
|
278
297
|
})();
|
|
279
298
|
}
|
|
280
|
-
|
|
299
|
+
lt(["pointerdown", "click"]);
|
|
281
300
|
export {
|
|
282
|
-
|
|
301
|
+
Ct as WorkbenchWidget
|
|
283
302
|
};
|
|
@@ -20,11 +20,18 @@ export interface WorkbenchWidgetSurfaceMetrics {
|
|
|
20
20
|
ready: boolean;
|
|
21
21
|
rect: WorkbenchProjectedRect;
|
|
22
22
|
}
|
|
23
|
+
export type WorkbenchWidgetBodyActivationSource = 'local_pointer';
|
|
24
|
+
export interface WorkbenchWidgetBodyActivation {
|
|
25
|
+
seq: number;
|
|
26
|
+
source: WorkbenchWidgetBodyActivationSource;
|
|
27
|
+
pointerType?: string;
|
|
28
|
+
}
|
|
23
29
|
export interface WorkbenchWidgetBodyProps<TWidgetType extends string = WorkbenchWidgetType> {
|
|
24
30
|
widgetId: string;
|
|
25
31
|
title: string;
|
|
26
32
|
type: TWidgetType;
|
|
27
33
|
surfaceMetrics?: WorkbenchWidgetSurfaceMetrics;
|
|
34
|
+
activation?: WorkbenchWidgetBodyActivation;
|
|
28
35
|
}
|
|
29
36
|
export interface WorkbenchWidgetDefinition<TWidgetType extends string = WorkbenchWidgetType> {
|
|
30
37
|
type: TWidgetType;
|