@floegence/floe-webapp-core 0.36.7 → 0.36.9
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/deck/DeckCell.d.ts +0 -5
- package/dist/components/deck/DeckCell.js +34 -45
- package/dist/components/deck/DeckGrid.d.ts +2 -16
- package/dist/components/deck/DeckGrid.js +83 -105
- package/dist/components/deck/WidgetResizeHandle.d.ts +3 -1
- package/dist/components/deck/WidgetResizeHandle.js +46 -80
- package/dist/components/deck/deckGridMetrics.d.ts +26 -0
- package/dist/components/deck/deckGridMetrics.js +32 -0
- package/dist/components/deck/deckPointerSession.d.ts +52 -0
- package/dist/components/deck/deckPointerSession.js +113 -0
- package/dist/components/editor/CodeEditor.d.ts +2 -0
- package/dist/components/editor/CodeEditor.js +24 -24
- package/dist/components/editor/index.d.ts +1 -0
- package/dist/components/editor/monacoStandaloneRuntime.d.ts +15 -3
- package/dist/components/editor/monacoStandaloneRuntime.js +45 -17
- package/dist/components/ui/InfiniteCanvas.d.ts +2 -0
- package/dist/components/ui/InfiniteCanvas.js +85 -84
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/components/ui/localInteractionSurface.d.ts +19 -0
- package/dist/components/ui/localInteractionSurface.js +38 -23
- package/dist/components/workbench/WorkbenchCanvas.d.ts +4 -0
- package/dist/components/workbench/WorkbenchCanvas.js +176 -11
- package/dist/components/workbench/WorkbenchSurface.js +9 -6
- package/dist/components/workbench/WorkbenchWidget.d.ts +4 -1
- package/dist/components/workbench/WorkbenchWidget.js +153 -120
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/components/workbench/types.d.ts +19 -0
- package/dist/components/workbench/useWorkbenchModel.d.ts +4 -0
- package/dist/components/workbench/useWorkbenchModel.js +33 -32
- package/dist/components/workbench/workbenchHelpers.d.ts +14 -1
- package/dist/components/workbench/workbenchHelpers.js +117 -90
- package/dist/context/DeckContext.d.ts +1 -9
- package/dist/context/DeckContext.js +163 -168
- package/dist/deck.js +22 -21
- package/dist/editor.js +5 -2
- package/dist/full.js +528 -523
- package/dist/hooks/useDeckDrag.d.ts +4 -3
- package/dist/hooks/useDeckDrag.js +39 -72
- package/dist/index.js +54 -53
- package/dist/styles.css +1 -1
- package/dist/ui.js +97 -94
- package/dist/utils/gridCollision.d.ts +1 -0
- package/dist/utils/gridCollision.js +21 -17
- package/dist/workbench.css +16 -0
- package/dist/workbench.js +17 -14
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
1
|
+
import { insert as x, effect as G, className as T, setAttribute as J, setStyleProperty as K, template as Q, use as ee, delegateEvents as te } from "solid-js/web";
|
|
2
|
+
import { createSignal as _, untrack as L, createEffect as b, onCleanup as A } from "solid-js";
|
|
3
3
|
import { cn as D } from "../../utils/cn.js";
|
|
4
|
-
import { startHotInteraction as
|
|
5
|
-
import { resolveSurfaceInteractionTargetRole as
|
|
6
|
-
var
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
return Math.max(
|
|
4
|
+
import { startHotInteraction as y } from "../../utils/hotInteraction.js";
|
|
5
|
+
import { resolveSurfaceInteractionTargetRole as ne, resolveSurfaceWheelRouting as re, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as oe } from "./localInteractionSurface.js";
|
|
6
|
+
var ae = /* @__PURE__ */ Q('<div><div style="transform-origin:0 0">');
|
|
7
|
+
const ie = 1, ce = 0.45, le = 2.2, se = 14e-4, ue = '[data-floe-canvas-pan-surface="true"]', Y = 3;
|
|
8
|
+
function de(n, a, d) {
|
|
9
|
+
return Math.max(a, Math.min(d, n));
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function M(n) {
|
|
12
12
|
return {
|
|
13
13
|
x: Number.isFinite(n.x) ? n.x : 0,
|
|
14
14
|
y: Number.isFinite(n.y) ? n.y : 0,
|
|
15
|
-
scale: Number.isFinite(n.scale) && n.scale > 0 ? n.scale :
|
|
15
|
+
scale: Number.isFinite(n.scale) && n.scale > 0 ? n.scale : ie
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return n.deltaMode === 1 ? n.deltaY * 16 : n.deltaMode === 2 ? n.deltaY * (
|
|
18
|
+
function fe(n, a) {
|
|
19
|
+
return n.deltaMode === 1 ? n.deltaY * 16 : n.deltaMode === 2 ? n.deltaY * (a?.clientHeight ?? window.innerHeight) : n.deltaY;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const [
|
|
23
|
-
let
|
|
24
|
-
const
|
|
25
|
-
const e =
|
|
21
|
+
function Ce(n) {
|
|
22
|
+
const [a, d] = _(L(() => M(n.viewport))), [v, w] = _(null);
|
|
23
|
+
let i, f, m = !1, l;
|
|
24
|
+
const R = () => n.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', X = () => n.panSurfaceSelector ?? ue, F = () => n.wheelInteractiveSelector ?? oe, k = () => n.minScale ?? ce, V = () => n.maxScale ?? le, $ = () => n.wheelZoomSpeed ?? se, N = () => {
|
|
25
|
+
const e = v();
|
|
26
26
|
return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
|
|
27
|
-
},
|
|
27
|
+
}, p = () => {
|
|
28
28
|
f !== void 0 && (window.clearTimeout(f), f = void 0);
|
|
29
|
-
},
|
|
29
|
+
}, C = () => {
|
|
30
30
|
m = !1, l !== void 0 && (window.clearTimeout(l), l = void 0);
|
|
31
|
-
},
|
|
31
|
+
}, U = () => {
|
|
32
32
|
if (typeof window > "u") {
|
|
33
33
|
m = !1;
|
|
34
34
|
return;
|
|
@@ -38,116 +38,117 @@ function ve(n) {
|
|
|
38
38
|
}, 0);
|
|
39
39
|
}, h = (e) => {
|
|
40
40
|
L(() => n.onViewportChange?.(e));
|
|
41
|
-
},
|
|
41
|
+
}, H = (e) => {
|
|
42
42
|
if (typeof window > "u") {
|
|
43
43
|
h(e);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
p(), f = window.setTimeout(() => {
|
|
47
47
|
f = void 0, h(e);
|
|
48
48
|
}, 90);
|
|
49
|
-
},
|
|
49
|
+
}, g = (e) => ne({
|
|
50
50
|
target: e,
|
|
51
|
-
interactiveSelector:
|
|
51
|
+
interactiveSelector: R(),
|
|
52
52
|
panSurfaceSelector: X()
|
|
53
|
-
}),
|
|
54
|
-
const t =
|
|
53
|
+
}), E = (e) => {
|
|
54
|
+
const t = v();
|
|
55
55
|
if (!t || e !== void 0 && t.pointerId !== e) return;
|
|
56
56
|
t.stopInteraction?.();
|
|
57
|
-
const
|
|
58
|
-
w(null),
|
|
57
|
+
const o = a();
|
|
58
|
+
w(null), i && i.hasPointerCapture(t.pointerId) && i.releasePointerCapture(t.pointerId), t.startedFromPanSurface && t.moved && (m = !0, U()), h(o);
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}),
|
|
63
|
-
const e =
|
|
60
|
+
b(() => {
|
|
61
|
+
v() || d(M(n.viewport));
|
|
62
|
+
}), b(() => {
|
|
63
|
+
const e = i;
|
|
64
64
|
if (!e) return;
|
|
65
|
-
const t = (
|
|
66
|
-
!m ||
|
|
65
|
+
const t = (o) => {
|
|
66
|
+
!m || g(o.target) !== "pan_surface" || (C(), o.preventDefault(), o.stopPropagation());
|
|
67
67
|
};
|
|
68
|
-
e.addEventListener("click", t, !0), e.addEventListener("wheel",
|
|
68
|
+
e.addEventListener("click", t, !0), e.addEventListener("wheel", P, {
|
|
69
69
|
passive: !1
|
|
70
|
-
}),
|
|
71
|
-
e.removeEventListener("click", t, !0), e.removeEventListener("wheel",
|
|
70
|
+
}), A(() => {
|
|
71
|
+
e.removeEventListener("click", t, !0), e.removeEventListener("wheel", P);
|
|
72
72
|
});
|
|
73
|
-
}),
|
|
74
|
-
|
|
73
|
+
}), A(() => {
|
|
74
|
+
p(), E(), C();
|
|
75
75
|
});
|
|
76
|
-
const
|
|
76
|
+
const Z = (e) => {
|
|
77
77
|
if (e.button !== 0 || n.disablePanZoom) return;
|
|
78
|
-
const t =
|
|
79
|
-
t !== "local_surface" && (
|
|
78
|
+
const t = g(e.target), o = t === "pan_surface";
|
|
79
|
+
t !== "local_surface" && (p(), C(), o || (e.preventDefault(), i?.setPointerCapture(e.pointerId)), w({
|
|
80
80
|
pointerId: e.pointerId,
|
|
81
81
|
startClientX: e.clientX,
|
|
82
82
|
startClientY: e.clientY,
|
|
83
|
-
startViewport:
|
|
83
|
+
startViewport: a(),
|
|
84
84
|
moved: !1,
|
|
85
|
-
startedFromPanSurface:
|
|
86
|
-
stopInteraction:
|
|
85
|
+
startedFromPanSurface: o,
|
|
86
|
+
stopInteraction: o ? void 0 : y({
|
|
87
87
|
kind: "drag",
|
|
88
88
|
cursor: "grabbing"
|
|
89
89
|
})
|
|
90
90
|
}));
|
|
91
|
-
},
|
|
92
|
-
const t =
|
|
91
|
+
}, W = (e) => {
|
|
92
|
+
const t = v();
|
|
93
93
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
94
|
-
const
|
|
95
|
-
if (!(t.moved || Math.abs(
|
|
96
|
-
t.moved || (e.preventDefault(),
|
|
94
|
+
const o = e.clientX - t.startClientX, r = e.clientY - t.startClientY;
|
|
95
|
+
if (!(t.moved || Math.abs(o) > Y || Math.abs(r) > Y)) return;
|
|
96
|
+
t.moved || (e.preventDefault(), i?.hasPointerCapture(e.pointerId) || i?.setPointerCapture(e.pointerId));
|
|
97
97
|
const s = {
|
|
98
98
|
...t.startViewport,
|
|
99
|
-
x: t.startViewport.x +
|
|
100
|
-
y: t.startViewport.y +
|
|
99
|
+
x: t.startViewport.x + o,
|
|
100
|
+
y: t.startViewport.y + r
|
|
101
101
|
};
|
|
102
102
|
t.moved || w({
|
|
103
103
|
...t,
|
|
104
104
|
moved: !0,
|
|
105
|
-
stopInteraction: t.stopInteraction ??
|
|
105
|
+
stopInteraction: t.stopInteraction ?? y({
|
|
106
106
|
kind: "drag",
|
|
107
107
|
cursor: "grabbing"
|
|
108
108
|
})
|
|
109
109
|
}), d(s);
|
|
110
|
-
}, Z = (e) => {
|
|
111
|
-
P(e.pointerId);
|
|
112
110
|
}, O = (e) => {
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
119
|
-
|
|
111
|
+
E(e.pointerId);
|
|
112
|
+
}, z = (e) => {
|
|
113
|
+
E(e.pointerId);
|
|
114
|
+
}, P = (e) => {
|
|
115
|
+
const t = i?.getBoundingClientRect();
|
|
116
|
+
if (!t || re({
|
|
117
|
+
target: e.target,
|
|
118
|
+
disablePanZoom: !!n.disablePanZoom,
|
|
119
|
+
wheelInteractiveSelector: F()
|
|
120
|
+
}).kind !== "canvas_zoom") return;
|
|
120
121
|
e.preventDefault();
|
|
121
|
-
const
|
|
122
|
-
if (Math.abs(u -
|
|
123
|
-
const
|
|
124
|
-
x: c -
|
|
125
|
-
y: s -
|
|
122
|
+
const r = a(), c = e.clientX - t.left, s = e.clientY - t.top, S = fe(e, i), u = de(r.scale * Math.exp(-S * $()), k(), V());
|
|
123
|
+
if (Math.abs(u - r.scale) < 1e-4) return;
|
|
124
|
+
const j = (c - r.x) / r.scale, q = (s - r.y) / r.scale, I = {
|
|
125
|
+
x: c - j * u,
|
|
126
|
+
y: s - q * u,
|
|
126
127
|
scale: u
|
|
127
128
|
};
|
|
128
|
-
d(
|
|
129
|
-
},
|
|
130
|
-
if (
|
|
131
|
-
const t =
|
|
129
|
+
d(I), H(I);
|
|
130
|
+
}, B = (e) => {
|
|
131
|
+
if (g(e.target) !== "canvas") return;
|
|
132
|
+
const t = i?.getBoundingClientRect();
|
|
132
133
|
if (!t) return;
|
|
133
134
|
e.preventDefault();
|
|
134
|
-
const
|
|
135
|
+
const o = e.clientX - t.left, r = e.clientY - t.top, c = a();
|
|
135
136
|
n.onCanvasContextMenu?.({
|
|
136
137
|
clientX: e.clientX,
|
|
137
138
|
clientY: e.clientY,
|
|
138
|
-
localX:
|
|
139
|
-
localY:
|
|
140
|
-
worldX: (
|
|
141
|
-
worldY: (
|
|
139
|
+
localX: o,
|
|
140
|
+
localY: r,
|
|
141
|
+
worldX: (o - c.x) / c.scale,
|
|
142
|
+
worldY: (r - c.y) / c.scale
|
|
142
143
|
});
|
|
143
144
|
};
|
|
144
145
|
return (() => {
|
|
145
|
-
var e =
|
|
146
|
-
e.$$contextmenu =
|
|
147
|
-
var
|
|
148
|
-
return typeof
|
|
149
|
-
var c = D("floe-infinite-canvas",
|
|
150
|
-
return c !==
|
|
146
|
+
var e = ae(), t = e.firstChild;
|
|
147
|
+
e.$$contextmenu = B, e.addEventListener("pointercancel", z), e.$$pointerup = O, e.$$pointermove = W, e.$$pointerdown = Z;
|
|
148
|
+
var o = i;
|
|
149
|
+
return typeof o == "function" ? ee(o, e) : i = e, x(t, () => n.children), x(e, () => n.overlay?.(a()), null), G((r) => {
|
|
150
|
+
var c = D("floe-infinite-canvas", N() && "is-panning", n.disablePanZoom && "is-locked", n.class), s = n.ariaLabel ?? "Infinite canvas", S = D("floe-infinite-canvas__viewport", n.contentClass), u = `translate(${a().x}px, ${a().y}px) scale(${a().scale})`;
|
|
151
|
+
return c !== r.e && T(e, r.e = c), s !== r.t && J(e, "aria-label", r.t = s), S !== r.a && T(t, r.a = S), u !== r.o && K(t, "transform", r.o = u), r;
|
|
151
152
|
}, {
|
|
152
153
|
e: void 0,
|
|
153
154
|
t: void 0,
|
|
@@ -156,7 +157,7 @@ function ve(n) {
|
|
|
156
157
|
}), e;
|
|
157
158
|
})();
|
|
158
159
|
}
|
|
159
|
-
|
|
160
|
+
te(["pointerdown", "pointermove", "pointerup", "contextmenu"]);
|
|
160
161
|
export {
|
|
161
|
-
|
|
162
|
+
Ce as InfiniteCanvas
|
|
162
163
|
};
|
|
@@ -7,7 +7,7 @@ export { Dropdown, Select, type DropdownProps, type DropdownItem, type SelectPro
|
|
|
7
7
|
export { Tooltip, type TooltipProps } from './Tooltip';
|
|
8
8
|
export { CommandPalette } from './CommandPalette';
|
|
9
9
|
export { InfiniteCanvas, type InfiniteCanvasProps, type InfiniteCanvasPoint, type InfiniteCanvasContextMenuEvent, } from './InfiniteCanvas';
|
|
10
|
-
export { LOCAL_INTERACTION_SURFACE_ATTR, DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR, WORKBENCH_WIDGET_SHELL_ATTR, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR, isLocalInteractionSurfaceTarget, resolveSurfaceInteractionTargetRole, resolveWorkbenchWidgetEventOwnership, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, } from './localInteractionSurface';
|
|
10
|
+
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';
|
|
11
11
|
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';
|
|
12
12
|
export { Tabs, TabPanel, type TabsProps, type TabPanelProps, type TabItem, type TabsFeatures, type TabsSlotClassNames, type TabsIndicatorMode, type TabsIndicatorColorToken, } from './Tabs';
|
|
13
13
|
export { DirectoryPicker, type DirectoryPickerProps } from './DirectoryPicker';
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
export declare const LOCAL_INTERACTION_SURFACE_ATTR = "data-floe-local-interaction-surface";
|
|
2
2
|
export declare const DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR = "[data-floe-local-interaction-surface=\"true\"]";
|
|
3
|
+
export declare const CANVAS_WHEEL_INTERACTIVE_ATTR = "data-floe-canvas-wheel-interactive";
|
|
4
|
+
export declare const DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR = "[data-floe-canvas-wheel-interactive=\"true\"]";
|
|
3
5
|
export declare const WORKBENCH_WIDGET_SHELL_ATTR = "data-floe-workbench-widget-shell";
|
|
4
6
|
export declare const DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR = "[data-floe-workbench-widget-shell=\"true\"]";
|
|
5
7
|
export type SurfaceInteractionTargetRole = 'canvas' | 'local_surface' | 'pan_surface';
|
|
8
|
+
export type SurfaceWheelLocalReason = 'typing_element' | 'local_interaction_surface' | 'wheel_interactive';
|
|
9
|
+
export type SurfaceWheelRoutingDecision = {
|
|
10
|
+
kind: 'canvas_zoom';
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'local_surface';
|
|
13
|
+
reason: SurfaceWheelLocalReason;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'ignore';
|
|
16
|
+
reason: 'pan_zoom_disabled';
|
|
17
|
+
};
|
|
6
18
|
export type WorkbenchWidgetEventOwnership = 'outside_widget' | 'widget_local' | 'widget_shell';
|
|
7
19
|
export interface SurfaceInteractionRoutingOptions {
|
|
8
20
|
target: EventTarget | null;
|
|
@@ -14,6 +26,13 @@ export interface WorkbenchWidgetEventOwnershipOptions extends SurfaceInteraction
|
|
|
14
26
|
widgetRoot: Element | EventTarget | null;
|
|
15
27
|
shellSelector?: string;
|
|
16
28
|
}
|
|
29
|
+
export interface SurfaceWheelRoutingOptions {
|
|
30
|
+
target: EventTarget | null;
|
|
31
|
+
disablePanZoom: boolean;
|
|
32
|
+
localInteractionSurfaceSelector?: string;
|
|
33
|
+
wheelInteractiveSelector?: string;
|
|
34
|
+
}
|
|
17
35
|
export declare function resolveSurfaceInteractionTargetRole(options: SurfaceInteractionRoutingOptions): SurfaceInteractionTargetRole;
|
|
36
|
+
export declare function resolveSurfaceWheelRouting(options: SurfaceWheelRoutingOptions): SurfaceWheelRoutingDecision;
|
|
18
37
|
export declare function isLocalInteractionSurfaceTarget(options: SurfaceInteractionRoutingOptions): boolean;
|
|
19
38
|
export declare function resolveWorkbenchWidgetEventOwnership(options: WorkbenchWidgetEventOwnershipOptions): WorkbenchWidgetEventOwnership;
|
|
@@ -1,33 +1,48 @@
|
|
|
1
|
-
import { isTypingElement as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { isTypingElement as a } from "../../utils/dom.js";
|
|
2
|
+
const u = "data-floe-local-interaction-surface", i = `[${u}="true"]`, f = "data-floe-canvas-wheel-interactive", E = `[${f}="true"]`, _ = "data-floe-workbench-widget-shell", T = `[${_}="true"]`;
|
|
3
|
+
function c(e) {
|
|
4
4
|
return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function s(e) {
|
|
7
7
|
const {
|
|
8
|
-
target:
|
|
9
|
-
interactiveSelector:
|
|
10
|
-
panSurfaceSelector:
|
|
11
|
-
localInteractionSurfaceSelector:
|
|
12
|
-
} = e,
|
|
13
|
-
return
|
|
8
|
+
target: t,
|
|
9
|
+
interactiveSelector: l,
|
|
10
|
+
panSurfaceSelector: r,
|
|
11
|
+
localInteractionSurfaceSelector: n = i
|
|
12
|
+
} = e, o = t instanceof Element ? t : null;
|
|
13
|
+
return o ? o.closest(r) !== null ? "pan_surface" : a(o) || o.closest(l) !== null || o.closest(n) !== null ? "local_surface" : "canvas" : "canvas";
|
|
14
14
|
}
|
|
15
15
|
function d(e) {
|
|
16
|
-
|
|
16
|
+
const {
|
|
17
|
+
target: t,
|
|
18
|
+
localInteractionSurfaceSelector: l = i,
|
|
19
|
+
wheelInteractiveSelector: r = E
|
|
20
|
+
} = e, n = c(t);
|
|
21
|
+
return n ? a(n) ? "typing_element" : n.closest(l) !== null ? "local_interaction_surface" : n.closest(r) !== null ? "wheel_interactive" : null : null;
|
|
22
|
+
}
|
|
23
|
+
function R(e) {
|
|
24
|
+
const t = d(e);
|
|
25
|
+
return t ? { kind: "local_surface", reason: t } : e.disablePanZoom ? { kind: "ignore", reason: "pan_zoom_disabled" } : { kind: "canvas_zoom" };
|
|
26
|
+
}
|
|
27
|
+
function A(e) {
|
|
28
|
+
return s(e) !== "canvas";
|
|
17
29
|
}
|
|
18
|
-
function
|
|
30
|
+
function L(e) {
|
|
19
31
|
const {
|
|
20
|
-
widgetRoot:
|
|
21
|
-
shellSelector:
|
|
22
|
-
} = e,
|
|
23
|
-
return !
|
|
32
|
+
widgetRoot: t,
|
|
33
|
+
shellSelector: l = T
|
|
34
|
+
} = e, r = c(t), n = c(e.target);
|
|
35
|
+
return !r || !n || !r.contains(n) ? "outside_widget" : s(e) !== "canvas" ? "widget_local" : n === r || n.closest(l) !== null ? "widget_shell" : "widget_local";
|
|
24
36
|
}
|
|
25
37
|
export {
|
|
26
|
-
|
|
27
|
-
E as
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
f as CANVAS_WHEEL_INTERACTIVE_ATTR,
|
|
39
|
+
E as DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR,
|
|
40
|
+
i as DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR,
|
|
41
|
+
T as DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR,
|
|
42
|
+
u as LOCAL_INTERACTION_SURFACE_ATTR,
|
|
43
|
+
_ as WORKBENCH_WIDGET_SHELL_ATTR,
|
|
44
|
+
A as isLocalInteractionSurfaceTarget,
|
|
45
|
+
s as resolveSurfaceInteractionTargetRole,
|
|
46
|
+
R as resolveSurfaceWheelRouting,
|
|
47
|
+
L as resolveWorkbenchWidgetEventOwnership
|
|
33
48
|
};
|
|
@@ -4,6 +4,10 @@ export interface WorkbenchCanvasProps {
|
|
|
4
4
|
widgetDefinitions: readonly WorkbenchWidgetDefinition[];
|
|
5
5
|
widgets: readonly WorkbenchWidgetItem[];
|
|
6
6
|
viewport: WorkbenchViewport;
|
|
7
|
+
canvasFrameSize: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
7
11
|
selectedWidgetId: string | null;
|
|
8
12
|
optimisticFrontWidgetId: string | null;
|
|
9
13
|
locked: boolean;
|
|
@@ -1,11 +1,106 @@
|
|
|
1
|
-
import { use as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { use as v, insert as m, createComponent as i, effect as W, template as f } from "solid-js/web";
|
|
2
|
+
import { createMemo as o, Show as h, For as F } from "solid-js";
|
|
3
|
+
import { WorkbenchCanvasField as y } from "./WorkbenchCanvasField.js";
|
|
4
|
+
import { WorkbenchWidget as R } from "./WorkbenchWidget.js";
|
|
5
|
+
import { createWorkbenchRenderLayerMap as I, resolveWorkbenchWidgetRenderMode as l } from "./workbenchHelpers.js";
|
|
6
|
+
import { getWidgetEntry as c } from "./widgets/widgetRegistry.js";
|
|
7
|
+
import { InfiniteCanvas as S } from "../ui/InfiniteCanvas.js";
|
|
8
|
+
var M = /* @__PURE__ */ f("<div class=workbench-canvas>"), k = /* @__PURE__ */ f("<div class=workbench-canvas__projected-layer>");
|
|
9
|
+
function b(e) {
|
|
10
|
+
const n = o((g) => {
|
|
11
|
+
const d = e.widgetById().get(e.widgetId);
|
|
12
|
+
if (d) return d;
|
|
13
|
+
if (g) return g;
|
|
14
|
+
throw new Error(`Workbench widget ${e.widgetId} is missing from the projected render map.`);
|
|
15
|
+
}), a = o(() => c(n().type, e.widgetDefinitions));
|
|
16
|
+
return i(R, {
|
|
17
|
+
get definition() {
|
|
18
|
+
return a();
|
|
19
|
+
},
|
|
20
|
+
get widgetId() {
|
|
21
|
+
return e.widgetId;
|
|
22
|
+
},
|
|
23
|
+
get widgetTitle() {
|
|
24
|
+
return n().title;
|
|
25
|
+
},
|
|
26
|
+
get widgetType() {
|
|
27
|
+
return n().type;
|
|
28
|
+
},
|
|
29
|
+
get x() {
|
|
30
|
+
return n().x;
|
|
31
|
+
},
|
|
32
|
+
get y() {
|
|
33
|
+
return n().y;
|
|
34
|
+
},
|
|
35
|
+
get width() {
|
|
36
|
+
return n().width;
|
|
37
|
+
},
|
|
38
|
+
get height() {
|
|
39
|
+
return n().height;
|
|
40
|
+
},
|
|
41
|
+
get renderLayer() {
|
|
42
|
+
return e.renderLayers().byWidgetId.get(e.widgetId) ?? 1;
|
|
43
|
+
},
|
|
44
|
+
itemSnapshot: n,
|
|
45
|
+
get selected() {
|
|
46
|
+
return e.selectedWidgetId === e.widgetId;
|
|
47
|
+
},
|
|
48
|
+
get optimisticFront() {
|
|
49
|
+
return e.optimisticFrontWidgetId === e.widgetId;
|
|
50
|
+
},
|
|
51
|
+
get topRenderLayer() {
|
|
52
|
+
return e.renderLayers().topRenderLayer;
|
|
53
|
+
},
|
|
54
|
+
get viewportScale() {
|
|
55
|
+
return e.projectedViewport.scale;
|
|
56
|
+
},
|
|
57
|
+
get locked() {
|
|
58
|
+
return e.locked;
|
|
59
|
+
},
|
|
60
|
+
get filtered() {
|
|
61
|
+
return !e.filters[n().type];
|
|
62
|
+
},
|
|
63
|
+
layoutMode: "projected_surface",
|
|
64
|
+
get projectedViewport() {
|
|
65
|
+
return e.projectedViewport;
|
|
66
|
+
},
|
|
67
|
+
get surfaceReady() {
|
|
68
|
+
return e.surfaceReady;
|
|
69
|
+
},
|
|
70
|
+
get onSelect() {
|
|
71
|
+
return e.onSelectWidget;
|
|
72
|
+
},
|
|
73
|
+
get onContextMenu() {
|
|
74
|
+
return e.onWidgetContextMenu;
|
|
75
|
+
},
|
|
76
|
+
get onStartOptimisticFront() {
|
|
77
|
+
return e.onStartOptimisticFront;
|
|
78
|
+
},
|
|
79
|
+
get onCommitFront() {
|
|
80
|
+
return e.onCommitFront;
|
|
81
|
+
},
|
|
82
|
+
get onCommitMove() {
|
|
83
|
+
return e.onCommitMove;
|
|
84
|
+
},
|
|
85
|
+
get onCommitResize() {
|
|
86
|
+
return e.onCommitResize;
|
|
87
|
+
},
|
|
88
|
+
get onRequestDelete() {
|
|
89
|
+
return e.onRequestDelete;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function q(e) {
|
|
94
|
+
const n = o(() => new Map(e.widgets.map((t) => [t.id, t]))), a = o(() => I(e.widgets)), g = o(() => e.widgets.filter((t) => {
|
|
95
|
+
const r = c(t.type, e.widgetDefinitions);
|
|
96
|
+
return l(r) === "canvas_scaled";
|
|
97
|
+
})), d = o(() => e.widgets.filter((t) => {
|
|
98
|
+
const r = c(t.type, e.widgetDefinitions);
|
|
99
|
+
return l(r) === "projected_surface";
|
|
100
|
+
}).map((t) => t.id)), w = () => e.canvasFrameSize.width > 0 && e.canvasFrameSize.height > 0;
|
|
6
101
|
return (() => {
|
|
7
|
-
var t =
|
|
8
|
-
return typeof
|
|
102
|
+
var t = M(), r = e.setCanvasFrameRef;
|
|
103
|
+
return typeof r == "function" ? v(r, t) : e.setCanvasFrameRef = t, m(t, i(S, {
|
|
9
104
|
ariaLabel: "Workbench canvas",
|
|
10
105
|
class: "workbench-canvas__infinite",
|
|
11
106
|
get viewport() {
|
|
@@ -20,13 +115,83 @@ function v(e) {
|
|
|
20
115
|
get disablePanZoom() {
|
|
21
116
|
return e.locked;
|
|
22
117
|
},
|
|
118
|
+
overlay: (s) => i(h, {
|
|
119
|
+
get when() {
|
|
120
|
+
return d().length > 0;
|
|
121
|
+
},
|
|
122
|
+
get children() {
|
|
123
|
+
var u = k();
|
|
124
|
+
return m(u, i(F, {
|
|
125
|
+
get each() {
|
|
126
|
+
return d();
|
|
127
|
+
},
|
|
128
|
+
children: (C) => i(b, {
|
|
129
|
+
widgetId: C,
|
|
130
|
+
get widgetDefinitions() {
|
|
131
|
+
return e.widgetDefinitions;
|
|
132
|
+
},
|
|
133
|
+
get canvasFrameSize() {
|
|
134
|
+
return e.canvasFrameSize;
|
|
135
|
+
},
|
|
136
|
+
widgetById: n,
|
|
137
|
+
renderLayers: a,
|
|
138
|
+
get selectedWidgetId() {
|
|
139
|
+
return e.selectedWidgetId;
|
|
140
|
+
},
|
|
141
|
+
get optimisticFrontWidgetId() {
|
|
142
|
+
return e.optimisticFrontWidgetId;
|
|
143
|
+
},
|
|
144
|
+
get locked() {
|
|
145
|
+
return e.locked;
|
|
146
|
+
},
|
|
147
|
+
get filters() {
|
|
148
|
+
return e.filters;
|
|
149
|
+
},
|
|
150
|
+
get setCanvasFrameRef() {
|
|
151
|
+
return e.setCanvasFrameRef;
|
|
152
|
+
},
|
|
153
|
+
get onViewportCommit() {
|
|
154
|
+
return e.onViewportCommit;
|
|
155
|
+
},
|
|
156
|
+
get onCanvasContextMenu() {
|
|
157
|
+
return e.onCanvasContextMenu;
|
|
158
|
+
},
|
|
159
|
+
get onSelectWidget() {
|
|
160
|
+
return e.onSelectWidget;
|
|
161
|
+
},
|
|
162
|
+
get onWidgetContextMenu() {
|
|
163
|
+
return e.onWidgetContextMenu;
|
|
164
|
+
},
|
|
165
|
+
get onStartOptimisticFront() {
|
|
166
|
+
return e.onStartOptimisticFront;
|
|
167
|
+
},
|
|
168
|
+
get onCommitFront() {
|
|
169
|
+
return e.onCommitFront;
|
|
170
|
+
},
|
|
171
|
+
get onCommitMove() {
|
|
172
|
+
return e.onCommitMove;
|
|
173
|
+
},
|
|
174
|
+
get onCommitResize() {
|
|
175
|
+
return e.onCommitResize;
|
|
176
|
+
},
|
|
177
|
+
get onRequestDelete() {
|
|
178
|
+
return e.onRequestDelete;
|
|
179
|
+
},
|
|
180
|
+
projectedViewport: s,
|
|
181
|
+
get surfaceReady() {
|
|
182
|
+
return w();
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
})), u;
|
|
186
|
+
}
|
|
187
|
+
}),
|
|
23
188
|
get children() {
|
|
24
|
-
return i(
|
|
189
|
+
return i(y, {
|
|
25
190
|
get widgetDefinitions() {
|
|
26
191
|
return e.widgetDefinitions;
|
|
27
192
|
},
|
|
28
193
|
get widgets() {
|
|
29
|
-
return
|
|
194
|
+
return g();
|
|
30
195
|
},
|
|
31
196
|
get selectedWidgetId() {
|
|
32
197
|
return e.selectedWidgetId;
|
|
@@ -66,9 +231,9 @@ function v(e) {
|
|
|
66
231
|
}
|
|
67
232
|
});
|
|
68
233
|
}
|
|
69
|
-
})),
|
|
234
|
+
})), W(() => t.classList.toggle("is-locked", !!e.locked)), t;
|
|
70
235
|
})();
|
|
71
236
|
}
|
|
72
237
|
export {
|
|
73
|
-
|
|
238
|
+
q as WorkbenchCanvas
|
|
74
239
|
};
|
|
@@ -4,13 +4,13 @@ import { isTypingElement as A } from "../../utils/dom.js";
|
|
|
4
4
|
import { WorkbenchCanvas as y } from "./WorkbenchCanvas.js";
|
|
5
5
|
import { WorkbenchContextMenu as D } from "./WorkbenchContextMenu.js";
|
|
6
6
|
import { WorkbenchFilterBar as x } from "./WorkbenchFilterBar.js";
|
|
7
|
-
import { WorkbenchHud as
|
|
8
|
-
import { WorkbenchLockButton as
|
|
9
|
-
import { useWorkbenchModel as
|
|
7
|
+
import { WorkbenchHud as S } from "./WorkbenchHud.js";
|
|
8
|
+
import { WorkbenchLockButton as F } from "./WorkbenchLockButton.js";
|
|
9
|
+
import { useWorkbenchModel as M } from "./useWorkbenchModel.js";
|
|
10
10
|
var L = /* @__PURE__ */ m("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), R = /* @__PURE__ */ m("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
|
|
11
11
|
const E = "F1";
|
|
12
12
|
function U(i) {
|
|
13
|
-
const e =
|
|
13
|
+
const e = M({
|
|
14
14
|
state: () => i.state(),
|
|
15
15
|
setState: (t) => i.setState(t),
|
|
16
16
|
widgetDefinitions: () => i.widgetDefinitions,
|
|
@@ -85,6 +85,9 @@ function U(i) {
|
|
|
85
85
|
get viewport() {
|
|
86
86
|
return e.viewport();
|
|
87
87
|
},
|
|
88
|
+
get canvasFrameSize() {
|
|
89
|
+
return e.canvasFrameSize();
|
|
90
|
+
},
|
|
88
91
|
get selectedWidgetId() {
|
|
89
92
|
return e.selectedWidgetId();
|
|
90
93
|
},
|
|
@@ -127,7 +130,7 @@ function U(i) {
|
|
|
127
130
|
get onRequestDelete() {
|
|
128
131
|
return e.widgetActions.deleteWidget;
|
|
129
132
|
}
|
|
130
|
-
})), c(t, a(
|
|
133
|
+
})), c(t, a(F, {
|
|
131
134
|
get locked() {
|
|
132
135
|
return e.locked();
|
|
133
136
|
},
|
|
@@ -154,7 +157,7 @@ function U(i) {
|
|
|
154
157
|
return e.filter.showAll;
|
|
155
158
|
},
|
|
156
159
|
onCreateAt: w
|
|
157
|
-
}), null), c(t, a(
|
|
160
|
+
}), null), c(t, a(S, {
|
|
158
161
|
get scaleLabel() {
|
|
159
162
|
return e.scaleLabel();
|
|
160
163
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
|
-
import type { WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
|
|
2
|
+
import type { WorkbenchViewport, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetRenderMode, WorkbenchWidgetType } from './types';
|
|
3
3
|
export interface WorkbenchWidgetProps {
|
|
4
4
|
definition: WorkbenchWidgetDefinition;
|
|
5
5
|
widgetId: string;
|
|
@@ -17,6 +17,9 @@ export interface WorkbenchWidgetProps {
|
|
|
17
17
|
viewportScale: number;
|
|
18
18
|
locked: boolean;
|
|
19
19
|
filtered: boolean;
|
|
20
|
+
layoutMode?: WorkbenchWidgetRenderMode;
|
|
21
|
+
projectedViewport?: WorkbenchViewport;
|
|
22
|
+
surfaceReady?: boolean;
|
|
20
23
|
onSelect: (widgetId: string) => void;
|
|
21
24
|
onContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
|
|
22
25
|
onStartOptimisticFront: (widgetId: string) => void;
|