@floegence/floe-webapp-core 0.36.15 → 0.36.16
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 +1 -0
- package/dist/components/ui/InfiniteCanvas.js +47 -45
- package/dist/components/workbench/WorkbenchCanvas.d.ts +3 -0
- package/dist/components/workbench/WorkbenchCanvas.js +51 -28
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +2 -0
- package/dist/components/workbench/WorkbenchCanvasField.js +18 -6
- package/dist/components/workbench/WorkbenchHud.d.ts +9 -0
- package/dist/components/workbench/WorkbenchHud.js +24 -10
- package/dist/components/workbench/WorkbenchSurface.js +68 -49
- package/dist/components/workbench/WorkbenchThemeSelector.d.ts +6 -0
- package/dist/components/workbench/WorkbenchThemeSelector.js +77 -0
- package/dist/components/workbench/WorkbenchWidget.d.ts +2 -0
- package/dist/components/workbench/WorkbenchWidget.js +205 -164
- package/dist/components/workbench/index.d.ts +2 -0
- package/dist/components/workbench/types.d.ts +2 -0
- package/dist/components/workbench/useWorkbenchModel.d.ts +5 -0
- package/dist/components/workbench/useWorkbenchModel.js +83 -77
- package/dist/components/workbench/workbenchHelpers.js +53 -50
- package/dist/components/workbench/workbenchThemes.d.ts +32 -0
- package/dist/components/workbench/workbenchThemes.js +82 -0
- package/dist/styles.css +1 -1
- package/dist/workbench-themes.css +1106 -0
- package/dist/workbench.css +492 -96
- package/dist/workbench.js +35 -27
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ export interface InfiniteCanvasProps {
|
|
|
19
19
|
onViewportChange?: (viewport: InfiniteCanvasPoint) => void;
|
|
20
20
|
onViewportInteractionStart?: (kind: 'wheel' | 'pan') => void;
|
|
21
21
|
onCanvasContextMenu?: (event: InfiniteCanvasContextMenuEvent) => void;
|
|
22
|
+
onCanvasPointerDown?: (event: PointerEvent) => void;
|
|
22
23
|
ariaLabel?: string;
|
|
23
24
|
class?: string;
|
|
24
25
|
contentClass?: string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { spread as B, mergeProps as j, insert as T, effect as q, className as G, setStyleProperty as J, template as K, use as Q } from "solid-js/web";
|
|
2
2
|
import { createSignal as _, untrack as I, createEffect as L, onCleanup as A } from "solid-js";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { startHotInteraction as
|
|
3
|
+
import { cn as D } from "../../utils/cn.js";
|
|
4
|
+
import { startHotInteraction as x } from "../../utils/hotInteraction.js";
|
|
5
5
|
import { resolveSurfaceInteractionTargetRole as ee, resolveSurfaceWheelRouting as te, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as ne } from "./localInteractionSurface.js";
|
|
6
6
|
import { clientToCanvasLocal as Y, localToCanvasWorld as re, createViewportFromZoomAnchor as oe } from "./canvasGeometry.js";
|
|
7
|
-
import { SURFACE_PORTAL_LAYER_ATTR as
|
|
8
|
-
var
|
|
7
|
+
import { SURFACE_PORTAL_LAYER_ATTR as ae } from "./dialogSurfaceScope.js";
|
|
8
|
+
var ie = /* @__PURE__ */ K('<div><div style="transform-origin:0 0">');
|
|
9
9
|
const ce = 1, le = 0.45, se = 2.2, ue = 14e-4, de = '[data-floe-canvas-pan-surface="true"]', R = 3;
|
|
10
|
-
function fe(t,
|
|
11
|
-
return Math.max(
|
|
10
|
+
function fe(t, a, u) {
|
|
11
|
+
return Math.max(a, Math.min(u, t));
|
|
12
12
|
}
|
|
13
13
|
function b(t) {
|
|
14
14
|
return {
|
|
@@ -17,12 +17,12 @@ function b(t) {
|
|
|
17
17
|
scale: Number.isFinite(t.scale) && t.scale > 0 ? t.scale : ce
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
function me(t,
|
|
21
|
-
return t.deltaMode === 1 ? t.deltaY * 16 : t.deltaMode === 2 ? t.deltaY * (
|
|
20
|
+
function me(t, a) {
|
|
21
|
+
return t.deltaMode === 1 ? t.deltaY * 16 : t.deltaMode === 2 ? t.deltaY * (a?.clientHeight ?? window.innerHeight) : t.deltaY;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const [
|
|
25
|
-
let
|
|
23
|
+
function ge(t) {
|
|
24
|
+
const [a, u] = _(I(() => b(t.viewport))), [m, S] = _(null);
|
|
25
|
+
let i, d, f = !1, l;
|
|
26
26
|
const M = () => t.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', X = () => t.panSurfaceSelector ?? de, F = () => t.wheelInteractiveSelector ?? ne, V = () => t.minScale ?? le, y = () => t.maxScale ?? se, k = () => t.wheelZoomSpeed ?? ue, U = () => {
|
|
27
27
|
const e = m();
|
|
28
28
|
return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
|
|
@@ -48,44 +48,46 @@ function Pe(t) {
|
|
|
48
48
|
w(), d = window.setTimeout(() => {
|
|
49
49
|
d = void 0, v(e);
|
|
50
50
|
}, 90);
|
|
51
|
-
},
|
|
51
|
+
}, h = (e) => ee({
|
|
52
52
|
target: e,
|
|
53
53
|
interactiveSelector: M(),
|
|
54
54
|
panSurfaceSelector: X()
|
|
55
|
-
}),
|
|
55
|
+
}), p = (e) => {
|
|
56
56
|
const n = m();
|
|
57
57
|
if (!n || e !== void 0 && n.pointerId !== e) return;
|
|
58
58
|
n.stopInteraction?.();
|
|
59
|
-
const r =
|
|
60
|
-
S(null),
|
|
59
|
+
const r = a();
|
|
60
|
+
S(null), i && i.hasPointerCapture(n.pointerId) && i.releasePointerCapture(n.pointerId), n.startedFromPanSurface && n.moved && (f = !0, N()), v(r);
|
|
61
61
|
};
|
|
62
62
|
L(() => {
|
|
63
63
|
m() || u(b(t.viewport));
|
|
64
64
|
}), L(() => {
|
|
65
|
-
const e =
|
|
65
|
+
const e = i;
|
|
66
66
|
if (!e) return;
|
|
67
67
|
const n = (r) => {
|
|
68
|
-
!f ||
|
|
68
|
+
!f || h(r.target) !== "pan_surface" || (C(), r.preventDefault(), r.stopPropagation());
|
|
69
69
|
};
|
|
70
|
-
e.addEventListener("click", n, !0), e.addEventListener("wheel",
|
|
70
|
+
e.addEventListener("click", n, !0), e.addEventListener("wheel", P, {
|
|
71
71
|
passive: !1
|
|
72
72
|
}), A(() => {
|
|
73
|
-
e.removeEventListener("click", n, !0), e.removeEventListener("wheel",
|
|
73
|
+
e.removeEventListener("click", n, !0), e.removeEventListener("wheel", P);
|
|
74
74
|
});
|
|
75
75
|
}), A(() => {
|
|
76
|
-
w(),
|
|
76
|
+
w(), p(), C();
|
|
77
77
|
});
|
|
78
78
|
const H = (e) => {
|
|
79
|
-
if (e.button !== 0
|
|
80
|
-
const n =
|
|
81
|
-
n
|
|
79
|
+
if (e.button !== 0) return;
|
|
80
|
+
const n = h(e.target);
|
|
81
|
+
if (n === "canvas" && t.onCanvasPointerDown?.(e), t.disablePanZoom) return;
|
|
82
|
+
const r = n === "pan_surface";
|
|
83
|
+
n !== "local_surface" && (w(), C(), r || (t.onViewportInteractionStart?.("pan"), e.preventDefault(), i?.setPointerCapture(e.pointerId)), S({
|
|
82
84
|
pointerId: e.pointerId,
|
|
83
85
|
startClientX: e.clientX,
|
|
84
86
|
startClientY: e.clientY,
|
|
85
|
-
startViewport:
|
|
87
|
+
startViewport: a(),
|
|
86
88
|
moved: !1,
|
|
87
89
|
startedFromPanSurface: r,
|
|
88
|
-
stopInteraction: r ? void 0 :
|
|
90
|
+
stopInteraction: r ? void 0 : x({
|
|
89
91
|
kind: "drag",
|
|
90
92
|
cursor: "grabbing"
|
|
91
93
|
})
|
|
@@ -95,7 +97,7 @@ function Pe(t) {
|
|
|
95
97
|
if (!n || n.pointerId !== e.pointerId) return;
|
|
96
98
|
const r = e.clientX - n.startClientX, o = e.clientY - n.startClientY;
|
|
97
99
|
if (!(n.moved || Math.abs(r) > R || Math.abs(o) > R)) return;
|
|
98
|
-
n.moved || (e.preventDefault(),
|
|
100
|
+
n.moved || (e.preventDefault(), i?.hasPointerCapture(e.pointerId) || i?.setPointerCapture(e.pointerId));
|
|
99
101
|
const s = {
|
|
100
102
|
...n.startViewport,
|
|
101
103
|
x: n.startViewport.x + r,
|
|
@@ -104,43 +106,43 @@ function Pe(t) {
|
|
|
104
106
|
n.moved || S({
|
|
105
107
|
...n,
|
|
106
108
|
moved: !0,
|
|
107
|
-
stopInteraction: n.stopInteraction ??
|
|
109
|
+
stopInteraction: n.stopInteraction ?? x({
|
|
108
110
|
kind: "drag",
|
|
109
111
|
cursor: "grabbing"
|
|
110
112
|
})
|
|
111
113
|
}), u(s);
|
|
112
114
|
}, O = (e) => {
|
|
113
|
-
|
|
115
|
+
p(e.pointerId);
|
|
114
116
|
}, $ = (e) => {
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
const n =
|
|
117
|
+
p(e.pointerId);
|
|
118
|
+
}, P = (e) => {
|
|
119
|
+
const n = i?.getBoundingClientRect();
|
|
118
120
|
if (!n || te({
|
|
119
121
|
target: e.target,
|
|
120
122
|
disablePanZoom: !!t.disablePanZoom,
|
|
121
123
|
wheelInteractiveSelector: F()
|
|
122
124
|
}).kind !== "canvas_zoom") return;
|
|
123
125
|
e.preventDefault(), t.onViewportInteractionStart?.("wheel");
|
|
124
|
-
const o =
|
|
126
|
+
const o = a(), c = Y(n, {
|
|
125
127
|
clientX: e.clientX,
|
|
126
128
|
clientY: e.clientY
|
|
127
|
-
}), s = me(e,
|
|
128
|
-
if (Math.abs(
|
|
129
|
+
}), s = me(e, i), g = fe(o.scale * Math.exp(-s * k()), V(), y());
|
|
130
|
+
if (Math.abs(g - o.scale) < 1e-4) return;
|
|
129
131
|
const E = oe({
|
|
130
132
|
viewport: o,
|
|
131
133
|
localPoint: c,
|
|
132
|
-
nextScale:
|
|
134
|
+
nextScale: g
|
|
133
135
|
});
|
|
134
136
|
u(E), Z(E);
|
|
135
137
|
}, z = (e) => {
|
|
136
|
-
if (
|
|
137
|
-
const n =
|
|
138
|
+
if (h(e.target) !== "canvas") return;
|
|
139
|
+
const n = i?.getBoundingClientRect();
|
|
138
140
|
if (!n) return;
|
|
139
141
|
e.preventDefault();
|
|
140
142
|
const r = Y(n, {
|
|
141
143
|
clientX: e.clientX,
|
|
142
144
|
clientY: e.clientY
|
|
143
|
-
}), o =
|
|
145
|
+
}), o = a(), c = re(o, r);
|
|
144
146
|
t.onCanvasContextMenu?.({
|
|
145
147
|
clientX: e.clientX,
|
|
146
148
|
clientY: e.clientY,
|
|
@@ -151,13 +153,13 @@ function Pe(t) {
|
|
|
151
153
|
});
|
|
152
154
|
};
|
|
153
155
|
return (() => {
|
|
154
|
-
var e =
|
|
155
|
-
return typeof r == "function" ? Q(r, e) :
|
|
156
|
+
var e = ie(), n = e.firstChild, r = i;
|
|
157
|
+
return typeof r == "function" ? Q(r, e) : i = e, B(e, j({
|
|
156
158
|
get class() {
|
|
157
|
-
return
|
|
159
|
+
return D("floe-infinite-canvas", U() && "is-panning", t.disablePanZoom && "is-locked", t.class);
|
|
158
160
|
}
|
|
159
161
|
}, {
|
|
160
|
-
[
|
|
162
|
+
[ae]: "true"
|
|
161
163
|
}, {
|
|
162
164
|
onPointerDown: H,
|
|
163
165
|
onPointerMove: W,
|
|
@@ -167,8 +169,8 @@ function Pe(t) {
|
|
|
167
169
|
get "aria-label"() {
|
|
168
170
|
return t.ariaLabel ?? "Infinite canvas";
|
|
169
171
|
}
|
|
170
|
-
}), !1, !0), T(n, () => t.children), T(e, () => t.overlay?.(
|
|
171
|
-
var c =
|
|
172
|
+
}), !1, !0), T(n, () => t.children), T(e, () => t.overlay?.(a()), null), q((o) => {
|
|
173
|
+
var c = D("floe-infinite-canvas__viewport", t.contentClass), s = `translate(${a().x}px, ${a().y}px) scale(${a().scale})`;
|
|
172
174
|
return c !== o.e && G(n, o.e = c), s !== o.t && J(n, "transform", o.t = s), o;
|
|
173
175
|
}, {
|
|
174
176
|
e: void 0,
|
|
@@ -177,5 +179,5 @@ function Pe(t) {
|
|
|
177
179
|
})();
|
|
178
180
|
}
|
|
179
181
|
export {
|
|
180
|
-
|
|
182
|
+
ge as InfiniteCanvas
|
|
181
183
|
};
|
|
@@ -16,6 +16,7 @@ export interface WorkbenchCanvasProps {
|
|
|
16
16
|
onViewportCommit: (viewport: WorkbenchViewport) => void;
|
|
17
17
|
onViewportInteractionStart?: (kind: 'wheel' | 'pan') => void;
|
|
18
18
|
onCanvasContextMenu: (event: InfiniteCanvasContextMenuEvent) => void;
|
|
19
|
+
onCanvasPointerDown?: (event: PointerEvent) => void;
|
|
19
20
|
onSelectWidget: (widgetId: string) => void;
|
|
20
21
|
onWidgetContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
|
|
21
22
|
onStartOptimisticFront: (widgetId: string) => void;
|
|
@@ -28,6 +29,8 @@ export interface WorkbenchCanvasProps {
|
|
|
28
29
|
width: number;
|
|
29
30
|
height: number;
|
|
30
31
|
}) => void;
|
|
32
|
+
onRequestOverview: (item: WorkbenchWidgetItem) => void;
|
|
33
|
+
onRequestFit: (item: WorkbenchWidgetItem) => void;
|
|
31
34
|
onRequestDelete: (widgetId: string) => void;
|
|
32
35
|
}
|
|
33
36
|
export declare function WorkbenchCanvas(props: WorkbenchCanvasProps): import("solid-js").JSX.Element;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { use as
|
|
2
|
-
import { createMemo as o, Show as h, For as
|
|
3
|
-
import { WorkbenchCanvasField as
|
|
4
|
-
import { WorkbenchWidget as
|
|
5
|
-
import { createWorkbenchRenderLayerMap as
|
|
6
|
-
import { getWidgetEntry as
|
|
1
|
+
import { use as C, insert as m, createComponent as i, effect as R, template as w } from "solid-js/web";
|
|
2
|
+
import { createMemo as o, Show as h, For as W } from "solid-js";
|
|
3
|
+
import { WorkbenchCanvasField as F } from "./WorkbenchCanvasField.js";
|
|
4
|
+
import { WorkbenchWidget as y } from "./WorkbenchWidget.js";
|
|
5
|
+
import { createWorkbenchRenderLayerMap as I, resolveWorkbenchWidgetRenderMode as l } from "./workbenchHelpers.js";
|
|
6
|
+
import { getWidgetEntry as u } from "./widgets/widgetRegistry.js";
|
|
7
7
|
import { InfiniteCanvas as S } from "../ui/InfiniteCanvas.js";
|
|
8
|
-
var
|
|
9
|
-
function
|
|
8
|
+
var k = /* @__PURE__ */ w("<div class=workbench-canvas><div class=workbench-canvas__atmosphere aria-hidden=true>"), M = /* @__PURE__ */ w("<div class=workbench-canvas__projected-layer>");
|
|
9
|
+
function q(e) {
|
|
10
10
|
const n = o((g) => {
|
|
11
11
|
const d = e.widgetById().get(e.widgetId);
|
|
12
12
|
if (d) return d;
|
|
13
13
|
if (g) return g;
|
|
14
14
|
throw new Error(`Workbench widget ${e.widgetId} is missing from the projected render map.`);
|
|
15
|
-
}), a = o(() =>
|
|
16
|
-
return i(
|
|
15
|
+
}), a = o(() => u(n().type, e.widgetDefinitions));
|
|
16
|
+
return i(y, {
|
|
17
17
|
get definition() {
|
|
18
18
|
return a();
|
|
19
19
|
},
|
|
@@ -85,22 +85,30 @@ function b(e) {
|
|
|
85
85
|
get onCommitResize() {
|
|
86
86
|
return e.onCommitResize;
|
|
87
87
|
},
|
|
88
|
+
get onRequestOverview() {
|
|
89
|
+
return e.onRequestOverview;
|
|
90
|
+
},
|
|
91
|
+
get onRequestFit() {
|
|
92
|
+
return e.onRequestFit;
|
|
93
|
+
},
|
|
88
94
|
get onRequestDelete() {
|
|
89
95
|
return e.onRequestDelete;
|
|
90
96
|
}
|
|
91
97
|
});
|
|
92
98
|
}
|
|
93
|
-
function
|
|
94
|
-
const n = o(() => new Map(e.widgets.map((t) => [t.id, t]))), a = o(() =>
|
|
95
|
-
const r =
|
|
99
|
+
function V(e) {
|
|
100
|
+
const n = o(() => new Map(e.widgets.map((t) => [t.id, t]))), a = o(() => I(e.widgets)), g = o(() => e.widgets.filter((t) => {
|
|
101
|
+
const r = u(t.type, e.widgetDefinitions);
|
|
96
102
|
return l(r) === "canvas_scaled";
|
|
97
103
|
})), d = o(() => e.widgets.filter((t) => {
|
|
98
|
-
const r =
|
|
104
|
+
const r = u(t.type, e.widgetDefinitions);
|
|
99
105
|
return l(r) === "projected_surface";
|
|
100
|
-
}).map((t) => t.id)),
|
|
106
|
+
}).map((t) => t.id)), s = () => e.canvasFrameSize.width > 0 && e.canvasFrameSize.height > 0;
|
|
101
107
|
return (() => {
|
|
102
|
-
var t =
|
|
103
|
-
|
|
108
|
+
var t = k();
|
|
109
|
+
t.firstChild;
|
|
110
|
+
var r = e.setCanvasFrameRef;
|
|
111
|
+
return typeof r == "function" ? C(r, t) : e.setCanvasFrameRef = t, m(t, i(S, {
|
|
104
112
|
ariaLabel: "Workbench canvas",
|
|
105
113
|
class: "workbench-canvas__infinite",
|
|
106
114
|
get viewport() {
|
|
@@ -115,21 +123,24 @@ function q(e) {
|
|
|
115
123
|
get onCanvasContextMenu() {
|
|
116
124
|
return e.onCanvasContextMenu;
|
|
117
125
|
},
|
|
126
|
+
get onCanvasPointerDown() {
|
|
127
|
+
return e.onCanvasPointerDown;
|
|
128
|
+
},
|
|
118
129
|
get disablePanZoom() {
|
|
119
130
|
return e.locked;
|
|
120
131
|
},
|
|
121
|
-
overlay: (
|
|
132
|
+
overlay: (v) => i(h, {
|
|
122
133
|
get when() {
|
|
123
134
|
return d().length > 0;
|
|
124
135
|
},
|
|
125
136
|
get children() {
|
|
126
|
-
var
|
|
127
|
-
return m(
|
|
137
|
+
var c = M();
|
|
138
|
+
return m(c, i(W, {
|
|
128
139
|
get each() {
|
|
129
140
|
return d();
|
|
130
141
|
},
|
|
131
|
-
children: (
|
|
132
|
-
widgetId:
|
|
142
|
+
children: (f) => i(q, {
|
|
143
|
+
widgetId: f,
|
|
133
144
|
get widgetDefinitions() {
|
|
134
145
|
return e.widgetDefinitions;
|
|
135
146
|
},
|
|
@@ -177,19 +188,25 @@ function q(e) {
|
|
|
177
188
|
get onCommitResize() {
|
|
178
189
|
return e.onCommitResize;
|
|
179
190
|
},
|
|
191
|
+
get onRequestOverview() {
|
|
192
|
+
return e.onRequestOverview;
|
|
193
|
+
},
|
|
194
|
+
get onRequestFit() {
|
|
195
|
+
return e.onRequestFit;
|
|
196
|
+
},
|
|
180
197
|
get onRequestDelete() {
|
|
181
198
|
return e.onRequestDelete;
|
|
182
199
|
},
|
|
183
|
-
projectedViewport:
|
|
200
|
+
projectedViewport: v,
|
|
184
201
|
get surfaceReady() {
|
|
185
|
-
return
|
|
202
|
+
return s();
|
|
186
203
|
}
|
|
187
204
|
})
|
|
188
|
-
})),
|
|
205
|
+
})), c;
|
|
189
206
|
}
|
|
190
207
|
}),
|
|
191
208
|
get children() {
|
|
192
|
-
return i(
|
|
209
|
+
return i(F, {
|
|
193
210
|
get widgetDefinitions() {
|
|
194
211
|
return e.widgetDefinitions;
|
|
195
212
|
},
|
|
@@ -229,14 +246,20 @@ function q(e) {
|
|
|
229
246
|
get onCommitResize() {
|
|
230
247
|
return e.onCommitResize;
|
|
231
248
|
},
|
|
249
|
+
get onRequestOverview() {
|
|
250
|
+
return e.onRequestOverview;
|
|
251
|
+
},
|
|
252
|
+
get onRequestFit() {
|
|
253
|
+
return e.onRequestFit;
|
|
254
|
+
},
|
|
232
255
|
get onRequestDelete() {
|
|
233
256
|
return e.onRequestDelete;
|
|
234
257
|
}
|
|
235
258
|
});
|
|
236
259
|
}
|
|
237
|
-
})),
|
|
260
|
+
}), null), R(() => t.classList.toggle("is-locked", !!e.locked)), t;
|
|
238
261
|
})();
|
|
239
262
|
}
|
|
240
263
|
export {
|
|
241
|
-
|
|
264
|
+
V as WorkbenchCanvas
|
|
242
265
|
};
|
|
@@ -19,6 +19,8 @@ export interface WorkbenchCanvasFieldProps {
|
|
|
19
19
|
width: number;
|
|
20
20
|
height: number;
|
|
21
21
|
}) => void;
|
|
22
|
+
onRequestOverview: (item: WorkbenchWidgetItem) => void;
|
|
23
|
+
onRequestFit: (item: WorkbenchWidgetItem) => void;
|
|
22
24
|
onRequestDelete: (widgetId: string) => void;
|
|
23
25
|
}
|
|
24
26
|
export declare function WorkbenchCanvasField(props: WorkbenchCanvasFieldProps): import("solid-js").JSX.Element;
|
|
@@ -3,8 +3,8 @@ import { createMemo as i, For as c } from "solid-js";
|
|
|
3
3
|
import { createWorkbenchRenderLayerMap as a } from "./workbenchHelpers.js";
|
|
4
4
|
import { getWidgetEntry as l } from "./widgets/widgetRegistry.js";
|
|
5
5
|
import { WorkbenchWidget as w } from "./WorkbenchWidget.js";
|
|
6
|
-
var
|
|
7
|
-
function
|
|
6
|
+
var v = /* @__PURE__ */ m("<div class=workbench-canvas__field><div class=workbench-canvas__grid aria-hidden=true>");
|
|
7
|
+
function f(e) {
|
|
8
8
|
const t = i((r) => {
|
|
9
9
|
const n = e.widgetById().get(e.widgetId);
|
|
10
10
|
if (n) return n;
|
|
@@ -76,20 +76,26 @@ function W(e) {
|
|
|
76
76
|
get onCommitResize() {
|
|
77
77
|
return e.onCommitResize;
|
|
78
78
|
},
|
|
79
|
+
get onRequestOverview() {
|
|
80
|
+
return e.onRequestOverview;
|
|
81
|
+
},
|
|
82
|
+
get onRequestFit() {
|
|
83
|
+
return e.onRequestFit;
|
|
84
|
+
},
|
|
79
85
|
get onRequestDelete() {
|
|
80
86
|
return e.onRequestDelete;
|
|
81
87
|
}
|
|
82
88
|
});
|
|
83
89
|
}
|
|
84
|
-
function
|
|
90
|
+
function F(e) {
|
|
85
91
|
const t = i(() => e.widgets.map((n) => n.id)), d = i(() => new Map(e.widgets.map((n) => [n.id, n]))), r = i(() => a(e.widgets));
|
|
86
92
|
return (() => {
|
|
87
|
-
var n =
|
|
93
|
+
var n = v();
|
|
88
94
|
return n.firstChild, u(n, g(c, {
|
|
89
95
|
get each() {
|
|
90
96
|
return t();
|
|
91
97
|
},
|
|
92
|
-
children: (o) => g(
|
|
98
|
+
children: (o) => g(f, {
|
|
93
99
|
widgetId: o,
|
|
94
100
|
get widgetDefinitions() {
|
|
95
101
|
return e.widgetDefinitions;
|
|
@@ -132,6 +138,12 @@ function v(e) {
|
|
|
132
138
|
get onCommitResize() {
|
|
133
139
|
return e.onCommitResize;
|
|
134
140
|
},
|
|
141
|
+
get onRequestOverview() {
|
|
142
|
+
return e.onRequestOverview;
|
|
143
|
+
},
|
|
144
|
+
get onRequestFit() {
|
|
145
|
+
return e.onRequestFit;
|
|
146
|
+
},
|
|
135
147
|
get onRequestDelete() {
|
|
136
148
|
return e.onRequestDelete;
|
|
137
149
|
}
|
|
@@ -140,5 +152,5 @@ function v(e) {
|
|
|
140
152
|
})();
|
|
141
153
|
}
|
|
142
154
|
export {
|
|
143
|
-
|
|
155
|
+
F as WorkbenchCanvasField
|
|
144
156
|
};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import type { WorkbenchThemeId } from './workbenchThemes';
|
|
1
2
|
export interface WorkbenchHudProps {
|
|
2
3
|
scaleLabel: string;
|
|
3
4
|
onZoomOut: () => void;
|
|
4
5
|
onZoomIn: () => void;
|
|
6
|
+
/**
|
|
7
|
+
* Current workbench theme. When provided alongside {@link onSelectTheme},
|
|
8
|
+
* the HUD renders an inline theme selector next to the zoom controls.
|
|
9
|
+
* Omit both to hide the selector entirely (e.g. when the consumer provides
|
|
10
|
+
* its own theming UI elsewhere).
|
|
11
|
+
*/
|
|
12
|
+
activeTheme?: WorkbenchThemeId;
|
|
13
|
+
onSelectTheme?: (id: WorkbenchThemeId) => void;
|
|
5
14
|
}
|
|
6
15
|
export declare function WorkbenchHud(props: WorkbenchHudProps): import("solid-js").JSX.Element;
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import { insert as n, createComponent as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { insert as n, createComponent as o, memo as h, template as i, delegateEvents as u } from "solid-js/web";
|
|
2
|
+
import { Show as m } from "solid-js";
|
|
3
|
+
import { Minus as b, Plus as d } from "../icons/index.js";
|
|
4
|
+
import { WorkbenchThemeSelector as s } from "./WorkbenchThemeSelector.js";
|
|
5
|
+
var _ = /* @__PURE__ */ i("<div class=workbench-hud__divider aria-hidden=true>"), v = /* @__PURE__ */ i('<div class=workbench-hud data-floe-canvas-interactive=true><button type=button class=workbench-hud__button aria-label="Zoom out"></button><div class=workbench-hud__scale></div><button type=button class=workbench-hud__button aria-label="Zoom in">');
|
|
6
|
+
function S(e) {
|
|
5
7
|
return (() => {
|
|
6
|
-
var
|
|
7
|
-
return
|
|
8
|
+
var l = v(), t = l.firstChild, c = t.nextSibling, r = c.nextSibling;
|
|
9
|
+
return n(l, o(m, {
|
|
10
|
+
get when() {
|
|
11
|
+
return h(() => !!e.activeTheme)() && e.onSelectTheme;
|
|
12
|
+
},
|
|
13
|
+
get children() {
|
|
14
|
+
return [o(s, {
|
|
15
|
+
get activeTheme() {
|
|
16
|
+
return e.activeTheme;
|
|
17
|
+
},
|
|
18
|
+
onSelect: (a) => e.onSelectTheme?.(a)
|
|
19
|
+
}), _()];
|
|
20
|
+
}
|
|
21
|
+
}), t), t.$$click = () => e.onZoomOut(), n(t, o(b, {
|
|
8
22
|
class: "w-3.5 h-3.5"
|
|
9
|
-
})), n(
|
|
23
|
+
})), n(c, () => e.scaleLabel), r.$$click = () => e.onZoomIn(), n(r, o(d, {
|
|
10
24
|
class: "w-3.5 h-3.5"
|
|
11
|
-
})),
|
|
25
|
+
})), l;
|
|
12
26
|
})();
|
|
13
27
|
}
|
|
14
|
-
|
|
28
|
+
u(["click"]);
|
|
15
29
|
export {
|
|
16
|
-
|
|
30
|
+
S as WorkbenchHud
|
|
17
31
|
};
|