@floegence/floe-webapp-core 0.36.17 → 0.36.19
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/InfiniteCanvas.d.ts +17 -0
- package/dist/components/ui/InfiniteCanvas.js +38 -38
- 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/WorkbenchCanvas.d.ts +5 -1
- package/dist/components/workbench/WorkbenchCanvas.js +79 -40
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +5 -1
- package/dist/components/workbench/WorkbenchCanvasField.js +82 -63
- package/dist/components/workbench/WorkbenchSurface.d.ts +13 -1
- package/dist/components/workbench/WorkbenchSurface.js +222 -130
- package/dist/components/workbench/WorkbenchWidget.d.ts +5 -1
- package/dist/components/workbench/WorkbenchWidget.js +155 -123
- package/dist/components/workbench/types.d.ts +66 -0
- package/dist/components/workbench/workbenchInteractionAdapter.d.ts +39 -0
- package/dist/components/workbench/workbenchInteractionAdapter.js +103 -0
- package/dist/full.js +463 -462
- package/dist/ui.js +102 -101
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
|
+
import { type SurfaceInteractionTargetRole, type SurfaceWheelRoutingDecision } from './localInteractionSurface';
|
|
2
3
|
export interface InfiniteCanvasPoint {
|
|
3
4
|
x: number;
|
|
4
5
|
y: number;
|
|
@@ -26,6 +27,22 @@ export interface InfiniteCanvasProps {
|
|
|
26
27
|
interactiveSelector?: string;
|
|
27
28
|
panSurfaceSelector?: string;
|
|
28
29
|
wheelInteractiveSelector?: string;
|
|
30
|
+
resolveTargetRole?: (args: {
|
|
31
|
+
target: EventTarget | null;
|
|
32
|
+
interactiveSelector: string;
|
|
33
|
+
panSurfaceSelector: string;
|
|
34
|
+
}) => SurfaceInteractionTargetRole;
|
|
35
|
+
resolveWheelRouting?: (args: {
|
|
36
|
+
target: EventTarget | null;
|
|
37
|
+
disablePanZoom: boolean;
|
|
38
|
+
wheelInteractiveSelector: string;
|
|
39
|
+
}) => SurfaceWheelRoutingDecision | {
|
|
40
|
+
kind: 'local_surface';
|
|
41
|
+
reason: string;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'ignore';
|
|
44
|
+
reason: string;
|
|
45
|
+
};
|
|
29
46
|
minScale?: number;
|
|
30
47
|
maxScale?: number;
|
|
31
48
|
wheelZoomSpeed?: number;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { spread as z, mergeProps as B, insert as _, effect as j, className as q, setStyleProperty as G, template as J, use as K } from "solid-js/web";
|
|
2
2
|
import { createSignal as T, untrack as L, createEffect as A, onCleanup as I } from "solid-js";
|
|
3
3
|
import { cn as D } from "../../utils/cn.js";
|
|
4
|
-
import { startHotInteraction as
|
|
4
|
+
import { startHotInteraction as R } from "../../utils/hotInteraction.js";
|
|
5
5
|
import { resolveSurfaceInteractionTargetRole as Q, resolveSurfaceWheelRouting as ee, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as te } from "./localInteractionSurface.js";
|
|
6
6
|
import { startPointerSession as ne } from "./pointerSession.js";
|
|
7
|
-
import { clientToCanvasLocal as
|
|
7
|
+
import { clientToCanvasLocal as x, localToCanvasWorld as re, createViewportFromZoomAnchor as oe } from "./canvasGeometry.js";
|
|
8
8
|
import { SURFACE_PORTAL_LAYER_ATTR as ae } from "./dialogSurfaceScope.js";
|
|
9
9
|
var ie = /* @__PURE__ */ J('<div><div style="transform-origin:0 0">');
|
|
10
|
-
const ce = 1, le = 0.45, se = 2.2, ue = 14e-4, fe = '[data-floe-canvas-pan-surface="true"]',
|
|
10
|
+
const ce = 1, le = 0.45, se = 2.2, ue = 14e-4, fe = '[data-floe-canvas-pan-surface="true"]', Y = 3;
|
|
11
11
|
function de(t, a, f) {
|
|
12
12
|
return Math.max(a, Math.min(f, t));
|
|
13
13
|
}
|
|
@@ -22,14 +22,14 @@ function me(t, a) {
|
|
|
22
22
|
return t.deltaMode === 1 ? t.deltaY * 16 : t.deltaMode === 2 ? t.deltaY * (a?.clientHeight ?? window.innerHeight) : t.deltaY;
|
|
23
23
|
}
|
|
24
24
|
function Pe(t) {
|
|
25
|
-
const [a, f] = T(L(() => b(t.viewport))), [S,
|
|
25
|
+
const [a, f] = T(L(() => b(t.viewport))), [S, v] = T(null);
|
|
26
26
|
let i, s, d, m = !1, l;
|
|
27
27
|
const M = () => t.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', X = () => t.panSurfaceSelector ?? fe, F = () => t.wheelInteractiveSelector ?? te, V = () => t.minScale ?? le, y = () => t.maxScale ?? se, k = () => t.wheelZoomSpeed ?? ue, N = () => {
|
|
28
28
|
const e = S();
|
|
29
29
|
return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
|
|
30
|
-
},
|
|
30
|
+
}, w = () => {
|
|
31
31
|
d !== void 0 && (window.clearTimeout(d), d = void 0);
|
|
32
|
-
},
|
|
32
|
+
}, g = () => {
|
|
33
33
|
m = !1, l !== void 0 && (window.clearTimeout(l), l = void 0);
|
|
34
34
|
}, U = () => {
|
|
35
35
|
if (typeof window > "u") {
|
|
@@ -39,26 +39,26 @@ function Pe(t) {
|
|
|
39
39
|
l !== void 0 && window.clearTimeout(l), l = window.setTimeout(() => {
|
|
40
40
|
l = void 0, m = !1;
|
|
41
41
|
}, 0);
|
|
42
|
-
},
|
|
42
|
+
}, C = (e) => {
|
|
43
43
|
L(() => t.onViewportChange?.(e));
|
|
44
|
-
},
|
|
44
|
+
}, W = (e) => {
|
|
45
45
|
if (typeof window > "u") {
|
|
46
|
-
|
|
46
|
+
C(e);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
d = void 0,
|
|
49
|
+
w(), d = window.setTimeout(() => {
|
|
50
|
+
d = void 0, C(e);
|
|
51
51
|
}, 90);
|
|
52
|
-
},
|
|
52
|
+
}, h = (e) => (t.resolveTargetRole ?? Q)({
|
|
53
53
|
target: e,
|
|
54
54
|
interactiveSelector: M(),
|
|
55
55
|
panSurfaceSelector: X()
|
|
56
|
-
}),
|
|
56
|
+
}), Z = () => {
|
|
57
57
|
const e = S();
|
|
58
58
|
if (!e) return;
|
|
59
59
|
e.stopInteraction?.();
|
|
60
60
|
const n = a();
|
|
61
|
-
|
|
61
|
+
v(null), s = void 0, e.startedFromPanSurface && e.moved && (m = !0, U()), C(n);
|
|
62
62
|
};
|
|
63
63
|
A(() => {
|
|
64
64
|
S() || f(b(t.viewport));
|
|
@@ -66,35 +66,35 @@ function Pe(t) {
|
|
|
66
66
|
const e = i;
|
|
67
67
|
if (!e) return;
|
|
68
68
|
const n = (r) => {
|
|
69
|
-
!m ||
|
|
69
|
+
!m || h(r.target) !== "pan_surface" || (g(), r.preventDefault(), r.stopPropagation());
|
|
70
70
|
};
|
|
71
|
-
e.addEventListener("click", n, !0), e.addEventListener("wheel",
|
|
71
|
+
e.addEventListener("click", n, !0), e.addEventListener("wheel", E, {
|
|
72
72
|
passive: !1
|
|
73
73
|
}), I(() => {
|
|
74
|
-
e.removeEventListener("click", n, !0), e.removeEventListener("wheel",
|
|
74
|
+
e.removeEventListener("click", n, !0), e.removeEventListener("wheel", E);
|
|
75
75
|
});
|
|
76
76
|
}), I(() => {
|
|
77
|
-
|
|
77
|
+
w(), s?.stop({
|
|
78
78
|
reason: "manual_stop",
|
|
79
79
|
commit: !0
|
|
80
|
-
}), s = void 0,
|
|
80
|
+
}), s = void 0, g();
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const H = (e) => {
|
|
83
83
|
if (e.button !== 0) return;
|
|
84
|
-
const n =
|
|
84
|
+
const n = h(e.target);
|
|
85
85
|
if (n === "canvas" && t.onCanvasPointerDown?.(e), t.disablePanZoom) return;
|
|
86
86
|
const r = n === "pan_surface";
|
|
87
|
-
n !== "local_surface" && (
|
|
87
|
+
n !== "local_surface" && (w(), g(), r || (t.onViewportInteractionStart?.("pan"), e.preventDefault()), s?.stop({
|
|
88
88
|
reason: "manual_stop",
|
|
89
89
|
commit: !0
|
|
90
|
-
}),
|
|
90
|
+
}), v({
|
|
91
91
|
pointerId: e.pointerId,
|
|
92
92
|
startClientX: e.clientX,
|
|
93
93
|
startClientY: e.clientY,
|
|
94
94
|
startViewport: a(),
|
|
95
95
|
moved: !1,
|
|
96
96
|
startedFromPanSurface: r,
|
|
97
|
-
stopInteraction: r ? void 0 :
|
|
97
|
+
stopInteraction: r ? void 0 : R({
|
|
98
98
|
kind: "drag",
|
|
99
99
|
cursor: "grabbing"
|
|
100
100
|
})
|
|
@@ -104,53 +104,53 @@ function Pe(t) {
|
|
|
104
104
|
capturePointer: !r,
|
|
105
105
|
onMove: O,
|
|
106
106
|
onEnd: () => {
|
|
107
|
-
|
|
107
|
+
Z();
|
|
108
108
|
}
|
|
109
109
|
}));
|
|
110
110
|
}, O = (e) => {
|
|
111
111
|
const n = S();
|
|
112
112
|
if (!n || n.pointerId !== e.pointerId) return;
|
|
113
113
|
const r = e.clientX - n.startClientX, o = e.clientY - n.startClientY;
|
|
114
|
-
if (!(n.moved || Math.abs(r) >
|
|
114
|
+
if (!(n.moved || Math.abs(r) > Y || Math.abs(o) > Y)) return;
|
|
115
115
|
n.moved || (e.preventDefault(), (!i || typeof i.hasPointerCapture != "function" || !i.hasPointerCapture(e.pointerId)) && s?.capturePointer());
|
|
116
116
|
const u = {
|
|
117
117
|
...n.startViewport,
|
|
118
118
|
x: n.startViewport.x + r,
|
|
119
119
|
y: n.startViewport.y + o
|
|
120
120
|
};
|
|
121
|
-
n.moved ||
|
|
121
|
+
n.moved || v({
|
|
122
122
|
...n,
|
|
123
123
|
moved: !0,
|
|
124
|
-
stopInteraction: n.stopInteraction ??
|
|
124
|
+
stopInteraction: n.stopInteraction ?? R({
|
|
125
125
|
kind: "drag",
|
|
126
126
|
cursor: "grabbing"
|
|
127
127
|
})
|
|
128
128
|
}), f(u);
|
|
129
|
-
},
|
|
129
|
+
}, E = (e) => {
|
|
130
130
|
const n = i?.getBoundingClientRect();
|
|
131
|
-
if (!n || ee({
|
|
131
|
+
if (!n || (t.resolveWheelRouting ?? ee)({
|
|
132
132
|
target: e.target,
|
|
133
133
|
disablePanZoom: !!t.disablePanZoom,
|
|
134
134
|
wheelInteractiveSelector: F()
|
|
135
135
|
}).kind !== "canvas_zoom") return;
|
|
136
136
|
e.preventDefault(), t.onViewportInteractionStart?.("wheel");
|
|
137
|
-
const o = a(), c =
|
|
137
|
+
const o = a(), c = x(n, {
|
|
138
138
|
clientX: e.clientX,
|
|
139
139
|
clientY: e.clientY
|
|
140
|
-
}), u = me(e, i),
|
|
141
|
-
if (Math.abs(
|
|
140
|
+
}), u = me(e, i), p = de(o.scale * Math.exp(-u * k()), V(), y());
|
|
141
|
+
if (Math.abs(p - o.scale) < 1e-4) return;
|
|
142
142
|
const P = oe({
|
|
143
143
|
viewport: o,
|
|
144
144
|
localPoint: c,
|
|
145
|
-
nextScale:
|
|
145
|
+
nextScale: p
|
|
146
146
|
});
|
|
147
|
-
f(P),
|
|
147
|
+
f(P), W(P);
|
|
148
148
|
}, $ = (e) => {
|
|
149
|
-
if (
|
|
149
|
+
if (h(e.target) !== "canvas") return;
|
|
150
150
|
const n = i?.getBoundingClientRect();
|
|
151
151
|
if (!n) return;
|
|
152
152
|
e.preventDefault();
|
|
153
|
-
const r =
|
|
153
|
+
const r = x(n, {
|
|
154
154
|
clientX: e.clientX,
|
|
155
155
|
clientY: e.clientY
|
|
156
156
|
}), o = a(), c = re(o, r);
|
|
@@ -172,7 +172,7 @@ function Pe(t) {
|
|
|
172
172
|
}, {
|
|
173
173
|
[ae]: "true"
|
|
174
174
|
}, {
|
|
175
|
-
onPointerDown:
|
|
175
|
+
onPointerDown: H,
|
|
176
176
|
onContextMenu: $,
|
|
177
177
|
get "aria-label"() {
|
|
178
178
|
return t.ariaLabel ?? "Infinite canvas";
|
|
@@ -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,5 +1,6 @@
|
|
|
1
1
|
import { type InfiniteCanvasContextMenuEvent } from '../../ui';
|
|
2
|
-
import
|
|
2
|
+
import { type ResolvedWorkbenchInteractionAdapter } from './workbenchInteractionAdapter';
|
|
3
|
+
import type { WorkbenchInteractionAdapter, WorkbenchViewport, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
|
|
3
4
|
export interface WorkbenchCanvasProps {
|
|
4
5
|
widgetDefinitions: readonly WorkbenchWidgetDefinition[];
|
|
5
6
|
widgets: readonly WorkbenchWidgetItem[];
|
|
@@ -12,6 +13,7 @@ export interface WorkbenchCanvasProps {
|
|
|
12
13
|
optimisticFrontWidgetId: string | null;
|
|
13
14
|
locked: boolean;
|
|
14
15
|
filters: Record<WorkbenchWidgetType, boolean>;
|
|
16
|
+
interactionAdapter?: WorkbenchInteractionAdapter | ResolvedWorkbenchInteractionAdapter;
|
|
15
17
|
setCanvasFrameRef: (el: HTMLDivElement | undefined) => void;
|
|
16
18
|
onViewportCommit: (viewport: WorkbenchViewport) => void;
|
|
17
19
|
onViewportInteractionStart?: (kind: 'wheel' | 'pan') => void;
|
|
@@ -32,5 +34,7 @@ export interface WorkbenchCanvasProps {
|
|
|
32
34
|
onRequestOverview: (item: WorkbenchWidgetItem) => void;
|
|
33
35
|
onRequestFit: (item: WorkbenchWidgetItem) => void;
|
|
34
36
|
onRequestDelete: (widgetId: string) => void;
|
|
37
|
+
onLayoutInteractionStart?: () => void;
|
|
38
|
+
onLayoutInteractionEnd?: () => void;
|
|
35
39
|
}
|
|
36
40
|
export declare function WorkbenchCanvas(props: WorkbenchCanvasProps): import("solid-js").JSX.Element;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { use as
|
|
2
|
-
import { createMemo as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { use as I, insert as v, createComponent as a, effect as h, template as s } from "solid-js/web";
|
|
2
|
+
import { createMemo as i, Show as R, For as W } from "solid-js";
|
|
3
|
+
import { resolveWorkbenchInteractionAdapter as y } from "./workbenchInteractionAdapter.js";
|
|
4
|
+
import { WorkbenchCanvasField as S } from "./WorkbenchCanvasField.js";
|
|
5
|
+
import { WorkbenchWidget as F } from "./WorkbenchWidget.js";
|
|
6
|
+
import { createWorkbenchRenderLayerMap as k, resolveWorkbenchWidgetRenderMode as w } from "./workbenchHelpers.js";
|
|
7
|
+
import { getWidgetEntry as c } from "./widgets/widgetRegistry.js";
|
|
8
|
+
import { InfiniteCanvas as L } from "../ui/InfiniteCanvas.js";
|
|
9
|
+
var M = /* @__PURE__ */ s("<div class=workbench-canvas><div class=workbench-canvas__atmosphere aria-hidden=true>"), b = /* @__PURE__ */ s("<div class=workbench-canvas__projected-layer>");
|
|
9
10
|
function q(e) {
|
|
10
|
-
const n =
|
|
11
|
-
const
|
|
12
|
-
if (d) return d;
|
|
11
|
+
const n = i((d) => {
|
|
12
|
+
const g = e.widgetById().get(e.widgetId);
|
|
13
13
|
if (g) return g;
|
|
14
|
+
if (d) return d;
|
|
14
15
|
throw new Error(`Workbench widget ${e.widgetId} is missing from the projected render map.`);
|
|
15
|
-
}),
|
|
16
|
-
return
|
|
16
|
+
}), u = i(() => c(n().type, e.widgetDefinitions));
|
|
17
|
+
return a(F, {
|
|
17
18
|
get definition() {
|
|
18
|
-
return
|
|
19
|
+
return u();
|
|
19
20
|
},
|
|
20
21
|
get widgetId() {
|
|
21
22
|
return e.widgetId;
|
|
@@ -60,6 +61,9 @@ function q(e) {
|
|
|
60
61
|
get filtered() {
|
|
61
62
|
return !e.filters[n().type];
|
|
62
63
|
},
|
|
64
|
+
get interactionAdapter() {
|
|
65
|
+
return e.interactionAdapter;
|
|
66
|
+
},
|
|
63
67
|
layoutMode: "projected_surface",
|
|
64
68
|
get projectedViewport() {
|
|
65
69
|
return e.projectedViewport;
|
|
@@ -93,22 +97,28 @@ function q(e) {
|
|
|
93
97
|
},
|
|
94
98
|
get onRequestDelete() {
|
|
95
99
|
return e.onRequestDelete;
|
|
100
|
+
},
|
|
101
|
+
get onLayoutInteractionStart() {
|
|
102
|
+
return e.onLayoutInteractionStart;
|
|
103
|
+
},
|
|
104
|
+
get onLayoutInteractionEnd() {
|
|
105
|
+
return e.onLayoutInteractionEnd;
|
|
96
106
|
}
|
|
97
107
|
});
|
|
98
108
|
}
|
|
99
|
-
function
|
|
100
|
-
const n =
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
})),
|
|
104
|
-
const
|
|
105
|
-
return
|
|
106
|
-
}).map((t) => t.id)),
|
|
109
|
+
function A(e) {
|
|
110
|
+
const n = i(() => y(e.interactionAdapter)), u = i(() => new Map(e.widgets.map((t) => [t.id, t]))), d = i(() => k(e.widgets)), g = i(() => e.widgets.filter((t) => {
|
|
111
|
+
const o = c(t.type, e.widgetDefinitions);
|
|
112
|
+
return w(o) === "canvas_scaled";
|
|
113
|
+
})), m = i(() => e.widgets.filter((t) => {
|
|
114
|
+
const o = c(t.type, e.widgetDefinitions);
|
|
115
|
+
return w(o) === "projected_surface";
|
|
116
|
+
}).map((t) => t.id)), f = () => e.canvasFrameSize.width > 0 && e.canvasFrameSize.height > 0;
|
|
107
117
|
return (() => {
|
|
108
|
-
var t =
|
|
118
|
+
var t = M();
|
|
109
119
|
t.firstChild;
|
|
110
|
-
var
|
|
111
|
-
return typeof
|
|
120
|
+
var o = e.setCanvasFrameRef;
|
|
121
|
+
return typeof o == "function" ? I(o, t) : e.setCanvasFrameRef = t, v(t, a(L, {
|
|
112
122
|
ariaLabel: "Workbench canvas",
|
|
113
123
|
class: "workbench-canvas__infinite",
|
|
114
124
|
get viewport() {
|
|
@@ -126,29 +136,40 @@ function V(e) {
|
|
|
126
136
|
get onCanvasPointerDown() {
|
|
127
137
|
return e.onCanvasPointerDown;
|
|
128
138
|
},
|
|
139
|
+
resolveTargetRole: (r) => n().resolveSurfaceTargetRole({
|
|
140
|
+
target: r.target,
|
|
141
|
+
interactiveSelector: r.interactiveSelector,
|
|
142
|
+
panSurfaceSelector: r.panSurfaceSelector
|
|
143
|
+
}),
|
|
144
|
+
resolveWheelRouting: (r) => n().resolveWheelRouting({
|
|
145
|
+
target: r.target,
|
|
146
|
+
disablePanZoom: r.disablePanZoom,
|
|
147
|
+
selectedWidgetId: e.selectedWidgetId,
|
|
148
|
+
wheelInteractiveSelector: r.wheelInteractiveSelector
|
|
149
|
+
}),
|
|
129
150
|
get disablePanZoom() {
|
|
130
151
|
return e.locked;
|
|
131
152
|
},
|
|
132
|
-
overlay: (
|
|
153
|
+
overlay: (r) => a(R, {
|
|
133
154
|
get when() {
|
|
134
|
-
return
|
|
155
|
+
return m().length > 0;
|
|
135
156
|
},
|
|
136
157
|
get children() {
|
|
137
|
-
var
|
|
138
|
-
return
|
|
158
|
+
var l = b();
|
|
159
|
+
return v(l, a(W, {
|
|
139
160
|
get each() {
|
|
140
|
-
return
|
|
161
|
+
return m();
|
|
141
162
|
},
|
|
142
|
-
children: (
|
|
143
|
-
widgetId:
|
|
163
|
+
children: (C) => a(q, {
|
|
164
|
+
widgetId: C,
|
|
144
165
|
get widgetDefinitions() {
|
|
145
166
|
return e.widgetDefinitions;
|
|
146
167
|
},
|
|
147
168
|
get canvasFrameSize() {
|
|
148
169
|
return e.canvasFrameSize;
|
|
149
170
|
},
|
|
150
|
-
widgetById:
|
|
151
|
-
renderLayers:
|
|
171
|
+
widgetById: u,
|
|
172
|
+
renderLayers: d,
|
|
152
173
|
get selectedWidgetId() {
|
|
153
174
|
return e.selectedWidgetId;
|
|
154
175
|
},
|
|
@@ -161,6 +182,9 @@ function V(e) {
|
|
|
161
182
|
get filters() {
|
|
162
183
|
return e.filters;
|
|
163
184
|
},
|
|
185
|
+
get interactionAdapter() {
|
|
186
|
+
return n();
|
|
187
|
+
},
|
|
164
188
|
get setCanvasFrameRef() {
|
|
165
189
|
return e.setCanvasFrameRef;
|
|
166
190
|
},
|
|
@@ -197,16 +221,22 @@ function V(e) {
|
|
|
197
221
|
get onRequestDelete() {
|
|
198
222
|
return e.onRequestDelete;
|
|
199
223
|
},
|
|
200
|
-
|
|
224
|
+
get onLayoutInteractionStart() {
|
|
225
|
+
return e.onLayoutInteractionStart;
|
|
226
|
+
},
|
|
227
|
+
get onLayoutInteractionEnd() {
|
|
228
|
+
return e.onLayoutInteractionEnd;
|
|
229
|
+
},
|
|
230
|
+
projectedViewport: r,
|
|
201
231
|
get surfaceReady() {
|
|
202
|
-
return
|
|
232
|
+
return f();
|
|
203
233
|
}
|
|
204
234
|
})
|
|
205
|
-
})),
|
|
235
|
+
})), l;
|
|
206
236
|
}
|
|
207
237
|
}),
|
|
208
238
|
get children() {
|
|
209
|
-
return
|
|
239
|
+
return a(S, {
|
|
210
240
|
get widgetDefinitions() {
|
|
211
241
|
return e.widgetDefinitions;
|
|
212
242
|
},
|
|
@@ -228,6 +258,9 @@ function V(e) {
|
|
|
228
258
|
get filters() {
|
|
229
259
|
return e.filters;
|
|
230
260
|
},
|
|
261
|
+
get interactionAdapter() {
|
|
262
|
+
return n();
|
|
263
|
+
},
|
|
231
264
|
get onSelectWidget() {
|
|
232
265
|
return e.onSelectWidget;
|
|
233
266
|
},
|
|
@@ -254,12 +287,18 @@ function V(e) {
|
|
|
254
287
|
},
|
|
255
288
|
get onRequestDelete() {
|
|
256
289
|
return e.onRequestDelete;
|
|
290
|
+
},
|
|
291
|
+
get onLayoutInteractionStart() {
|
|
292
|
+
return e.onLayoutInteractionStart;
|
|
293
|
+
},
|
|
294
|
+
get onLayoutInteractionEnd() {
|
|
295
|
+
return e.onLayoutInteractionEnd;
|
|
257
296
|
}
|
|
258
297
|
});
|
|
259
298
|
}
|
|
260
|
-
}), null),
|
|
299
|
+
}), null), h(() => t.classList.toggle("is-locked", !!e.locked)), t;
|
|
261
300
|
})();
|
|
262
301
|
}
|
|
263
302
|
export {
|
|
264
|
-
|
|
303
|
+
A as WorkbenchCanvas
|
|
265
304
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ResolvedWorkbenchInteractionAdapter } from './workbenchInteractionAdapter';
|
|
2
|
+
import type { WorkbenchInteractionAdapter, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
|
|
2
3
|
export interface WorkbenchCanvasFieldProps {
|
|
3
4
|
widgetDefinitions: readonly WorkbenchWidgetDefinition[];
|
|
4
5
|
widgets: readonly WorkbenchWidgetItem[];
|
|
@@ -7,6 +8,7 @@ export interface WorkbenchCanvasFieldProps {
|
|
|
7
8
|
viewportScale: number;
|
|
8
9
|
locked: boolean;
|
|
9
10
|
filters: Record<WorkbenchWidgetType, boolean>;
|
|
11
|
+
interactionAdapter?: WorkbenchInteractionAdapter | ResolvedWorkbenchInteractionAdapter;
|
|
10
12
|
onSelectWidget: (widgetId: string) => void;
|
|
11
13
|
onWidgetContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
|
|
12
14
|
onStartOptimisticFront: (widgetId: string) => void;
|
|
@@ -22,5 +24,7 @@ export interface WorkbenchCanvasFieldProps {
|
|
|
22
24
|
onRequestOverview: (item: WorkbenchWidgetItem) => void;
|
|
23
25
|
onRequestFit: (item: WorkbenchWidgetItem) => void;
|
|
24
26
|
onRequestDelete: (widgetId: string) => void;
|
|
27
|
+
onLayoutInteractionStart?: () => void;
|
|
28
|
+
onLayoutInteractionEnd?: () => void;
|
|
25
29
|
}
|
|
26
30
|
export declare function WorkbenchCanvasField(props: WorkbenchCanvasFieldProps): import("solid-js").JSX.Element;
|