@floegence/floe-webapp-core 0.36.20 → 0.36.22
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 +2 -2
- package/dist/components/ui/InfiniteCanvas.js +39 -39
- package/dist/components/workbench/WorkbenchCanvas.js +1 -1
- package/dist/components/workbench/WorkbenchWidget.d.ts +2 -2
- package/dist/components/workbench/WorkbenchWidget.js +13 -17
- package/dist/components/workbench/types.d.ts +2 -2
- package/dist/styles.css +1 -1
- package/dist/workbench.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type JSX } from 'solid-js';
|
|
1
|
+
import { type Accessor, type JSX } from 'solid-js';
|
|
2
2
|
import { type SurfaceInteractionTargetRole, type SurfaceWheelRoutingDecision } from './localInteractionSurface';
|
|
3
3
|
export interface InfiniteCanvasPoint {
|
|
4
4
|
x: number;
|
|
@@ -15,7 +15,7 @@ export interface InfiniteCanvasContextMenuEvent {
|
|
|
15
15
|
}
|
|
16
16
|
export interface InfiniteCanvasProps {
|
|
17
17
|
children: JSX.Element;
|
|
18
|
-
overlay?: (viewport: InfiniteCanvasPoint) => JSX.Element;
|
|
18
|
+
overlay?: (viewport: Accessor<InfiniteCanvasPoint>) => JSX.Element;
|
|
19
19
|
viewport: InfiniteCanvasPoint;
|
|
20
20
|
onViewportChange?: (viewport: InfiniteCanvasPoint) => void;
|
|
21
21
|
onViewportInteractionStart?: (kind: 'wheel' | 'pan') => void;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { spread as
|
|
2
|
-
import { createSignal as T, untrack as L, createEffect as A, onCleanup as I } from "solid-js";
|
|
1
|
+
import { spread as B, mergeProps as j, insert as _, effect as q, className as G, setStyleProperty as J, template as K, use as Q } from "solid-js/web";
|
|
2
|
+
import { createSignal as T, untrack as L, createMemo as ee, createEffect as A, onCleanup as I } from "solid-js";
|
|
3
3
|
import { cn as D } from "../../utils/cn.js";
|
|
4
4
|
import { startHotInteraction as R } from "../../utils/hotInteraction.js";
|
|
5
|
-
import { resolveSurfaceInteractionTargetRole as
|
|
6
|
-
import { startPointerSession as
|
|
7
|
-
import { clientToCanvasLocal as x, localToCanvasWorld as
|
|
8
|
-
import { SURFACE_PORTAL_LAYER_ATTR as
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
function
|
|
5
|
+
import { resolveSurfaceInteractionTargetRole as te, resolveSurfaceWheelRouting as ne, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as re } from "./localInteractionSurface.js";
|
|
6
|
+
import { startPointerSession as oe } from "./pointerSession.js";
|
|
7
|
+
import { clientToCanvasLocal as x, localToCanvasWorld as ae, createViewportFromZoomAnchor as ie } from "./canvasGeometry.js";
|
|
8
|
+
import { SURFACE_PORTAL_LAYER_ATTR as ce } from "./dialogSurfaceScope.js";
|
|
9
|
+
var le = /* @__PURE__ */ K('<div><div style="transform-origin:0 0">');
|
|
10
|
+
const se = 1, ue = 0.45, fe = 2.2, de = 14e-4, me = '[data-floe-canvas-pan-surface="true"]', Y = 3;
|
|
11
|
+
function Se(t, a, f) {
|
|
12
12
|
return Math.max(a, Math.min(f, t));
|
|
13
13
|
}
|
|
14
14
|
function b(t) {
|
|
15
15
|
return {
|
|
16
16
|
x: Number.isFinite(t.x) ? t.x : 0,
|
|
17
17
|
y: Number.isFinite(t.y) ? t.y : 0,
|
|
18
|
-
scale: Number.isFinite(t.scale) && t.scale > 0 ? t.scale :
|
|
18
|
+
scale: Number.isFinite(t.scale) && t.scale > 0 ? t.scale : se
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function ve(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
|
-
function
|
|
24
|
+
function Te(t) {
|
|
25
25
|
const [a, f] = T(L(() => b(t.viewport))), [S, v] = T(null);
|
|
26
26
|
let i, s, d, m = !1, l;
|
|
27
|
-
const M = () => t.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', X = () => t.panSurfaceSelector ??
|
|
27
|
+
const M = () => t.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', X = () => t.panSurfaceSelector ?? me, y = () => t.wheelInteractiveSelector ?? re, F = () => t.minScale ?? ue, V = () => t.maxScale ?? fe, k = () => t.wheelZoomSpeed ?? de, N = () => {
|
|
28
28
|
const e = S();
|
|
29
29
|
return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
|
|
30
|
-
}, w = () => {
|
|
30
|
+
}, U = ee(() => t.overlay?.(a)), 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
|
+
}, W = () => {
|
|
35
35
|
if (typeof window > "u") {
|
|
36
36
|
m = !1;
|
|
37
37
|
return;
|
|
@@ -41,7 +41,7 @@ function Pe(t) {
|
|
|
41
41
|
}, 0);
|
|
42
42
|
}, C = (e) => {
|
|
43
43
|
L(() => t.onViewportChange?.(e));
|
|
44
|
-
},
|
|
44
|
+
}, Z = (e) => {
|
|
45
45
|
if (typeof window > "u") {
|
|
46
46
|
C(e);
|
|
47
47
|
return;
|
|
@@ -49,16 +49,16 @@ function Pe(t) {
|
|
|
49
49
|
w(), d = window.setTimeout(() => {
|
|
50
50
|
d = void 0, C(e);
|
|
51
51
|
}, 90);
|
|
52
|
-
}, h = (e) => (t.resolveTargetRole ??
|
|
52
|
+
}, h = (e) => (t.resolveTargetRole ?? te)({
|
|
53
53
|
target: e,
|
|
54
54
|
interactiveSelector: M(),
|
|
55
55
|
panSurfaceSelector: X()
|
|
56
|
-
}),
|
|
56
|
+
}), H = () => {
|
|
57
57
|
const e = S();
|
|
58
58
|
if (!e) return;
|
|
59
59
|
e.stopInteraction?.();
|
|
60
60
|
const n = a();
|
|
61
|
-
v(null), s = void 0, e.startedFromPanSurface && e.moved && (m = !0,
|
|
61
|
+
v(null), s = void 0, e.startedFromPanSurface && e.moved && (m = !0, W()), C(n);
|
|
62
62
|
};
|
|
63
63
|
A(() => {
|
|
64
64
|
S() || f(b(t.viewport));
|
|
@@ -79,7 +79,7 @@ function Pe(t) {
|
|
|
79
79
|
commit: !0
|
|
80
80
|
}), s = void 0, g();
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const O = (e) => {
|
|
83
83
|
if (e.button !== 0) return;
|
|
84
84
|
const n = h(e.target);
|
|
85
85
|
if (n === "canvas" && t.onCanvasPointerDown?.(e), t.disablePanZoom) return;
|
|
@@ -98,16 +98,16 @@ function Pe(t) {
|
|
|
98
98
|
kind: "drag",
|
|
99
99
|
cursor: "grabbing"
|
|
100
100
|
})
|
|
101
|
-
}), s =
|
|
101
|
+
}), s = oe({
|
|
102
102
|
pointerEvent: e,
|
|
103
103
|
captureEl: i ?? null,
|
|
104
104
|
capturePointer: !r,
|
|
105
|
-
onMove:
|
|
105
|
+
onMove: $,
|
|
106
106
|
onEnd: () => {
|
|
107
|
-
|
|
107
|
+
H();
|
|
108
108
|
}
|
|
109
109
|
}));
|
|
110
|
-
},
|
|
110
|
+
}, $ = (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;
|
|
@@ -128,24 +128,24 @@ function Pe(t) {
|
|
|
128
128
|
}), f(u);
|
|
129
129
|
}, E = (e) => {
|
|
130
130
|
const n = i?.getBoundingClientRect();
|
|
131
|
-
if (!n || (t.resolveWheelRouting ??
|
|
131
|
+
if (!n || (t.resolveWheelRouting ?? ne)({
|
|
132
132
|
target: e.target,
|
|
133
133
|
disablePanZoom: !!t.disablePanZoom,
|
|
134
|
-
wheelInteractiveSelector:
|
|
134
|
+
wheelInteractiveSelector: y()
|
|
135
135
|
}).kind !== "canvas_zoom") return;
|
|
136
136
|
e.preventDefault(), t.onViewportInteractionStart?.("wheel");
|
|
137
137
|
const o = a(), c = x(n, {
|
|
138
138
|
clientX: e.clientX,
|
|
139
139
|
clientY: e.clientY
|
|
140
|
-
}), u =
|
|
140
|
+
}), u = ve(e, i), p = Se(o.scale * Math.exp(-u * k()), F(), V());
|
|
141
141
|
if (Math.abs(p - o.scale) < 1e-4) return;
|
|
142
|
-
const P =
|
|
142
|
+
const P = ie({
|
|
143
143
|
viewport: o,
|
|
144
144
|
localPoint: c,
|
|
145
145
|
nextScale: p
|
|
146
146
|
});
|
|
147
|
-
f(P),
|
|
148
|
-
},
|
|
147
|
+
f(P), Z(P);
|
|
148
|
+
}, z = (e) => {
|
|
149
149
|
if (h(e.target) !== "canvas") return;
|
|
150
150
|
const n = i?.getBoundingClientRect();
|
|
151
151
|
if (!n) return;
|
|
@@ -153,7 +153,7 @@ function Pe(t) {
|
|
|
153
153
|
const r = x(n, {
|
|
154
154
|
clientX: e.clientX,
|
|
155
155
|
clientY: e.clientY
|
|
156
|
-
}), o = a(), c =
|
|
156
|
+
}), o = a(), c = ae(o, r);
|
|
157
157
|
t.onCanvasContextMenu?.({
|
|
158
158
|
clientX: e.clientX,
|
|
159
159
|
clientY: e.clientY,
|
|
@@ -164,22 +164,22 @@ function Pe(t) {
|
|
|
164
164
|
});
|
|
165
165
|
};
|
|
166
166
|
return (() => {
|
|
167
|
-
var e =
|
|
168
|
-
return typeof r == "function" ?
|
|
167
|
+
var e = le(), n = e.firstChild, r = i;
|
|
168
|
+
return typeof r == "function" ? Q(r, e) : i = e, B(e, j({
|
|
169
169
|
get class() {
|
|
170
170
|
return D("floe-infinite-canvas", N() && "is-panning", t.disablePanZoom && "is-locked", t.class);
|
|
171
171
|
}
|
|
172
172
|
}, {
|
|
173
|
-
[
|
|
173
|
+
[ce]: "true"
|
|
174
174
|
}, {
|
|
175
|
-
onPointerDown:
|
|
176
|
-
onContextMenu:
|
|
175
|
+
onPointerDown: O,
|
|
176
|
+
onContextMenu: z,
|
|
177
177
|
get "aria-label"() {
|
|
178
178
|
return t.ariaLabel ?? "Infinite canvas";
|
|
179
179
|
}
|
|
180
|
-
}), !1, !0), _(n, () => t.children), _(e,
|
|
180
|
+
}), !1, !0), _(n, () => t.children), _(e, U, null), q((o) => {
|
|
181
181
|
var c = D("floe-infinite-canvas__viewport", t.contentClass), u = `translate(${a().x}px, ${a().y}px) scale(${a().scale})`;
|
|
182
|
-
return c !== o.e &&
|
|
182
|
+
return c !== o.e && G(n, o.e = c), u !== o.t && J(n, "transform", o.t = u), o;
|
|
183
183
|
}, {
|
|
184
184
|
e: void 0,
|
|
185
185
|
t: void 0
|
|
@@ -187,5 +187,5 @@ function Pe(t) {
|
|
|
187
187
|
})();
|
|
188
188
|
}
|
|
189
189
|
export {
|
|
190
|
-
|
|
190
|
+
Te as InfiniteCanvas
|
|
191
191
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type JSX } from 'solid-js';
|
|
1
|
+
import { type Accessor, type JSX } from 'solid-js';
|
|
2
2
|
import { type ResolvedWorkbenchInteractionAdapter } from './workbenchInteractionAdapter';
|
|
3
3
|
import type { WorkbenchViewport, WorkbenchInteractionAdapter, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetRenderMode, WorkbenchWidgetType } from './types';
|
|
4
4
|
export interface WorkbenchWidgetProps {
|
|
@@ -19,7 +19,7 @@ export interface WorkbenchWidgetProps {
|
|
|
19
19
|
locked: boolean;
|
|
20
20
|
filtered: boolean;
|
|
21
21
|
layoutMode?: WorkbenchWidgetRenderMode;
|
|
22
|
-
projectedViewport?: WorkbenchViewport
|
|
22
|
+
projectedViewport?: Accessor<WorkbenchViewport>;
|
|
23
23
|
surfaceReady?: boolean;
|
|
24
24
|
interactionAdapter?: WorkbenchInteractionAdapter | ResolvedWorkbenchInteractionAdapter;
|
|
25
25
|
onSelect: (widgetId: string) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { spread as
|
|
1
|
+
import { spread as p, mergeProps as rt, insert as l, createComponent as c, memo as dt, template as B, use as lt, delegateEvents as ct } from "solid-js/web";
|
|
2
2
|
import { createMemo as u, createSignal as W, onCleanup as st, untrack as f } from "solid-js";
|
|
3
3
|
import { startHotInteraction as wt } from "../../utils/hotInteraction.js";
|
|
4
|
-
import { X as
|
|
4
|
+
import { X as O, Minus as j, Maximize as q, GripVertical as gt } from "../icons/index.js";
|
|
5
5
|
import { CANVAS_WHEEL_INTERACTIVE_ATTR as ht, WORKBENCH_WIDGET_SHELL_ATTR as ut, shouldActivateWorkbenchWidgetLocalTarget as ft } from "../ui/localInteractionSurface.js";
|
|
6
6
|
import { startPointerSession as N } from "../ui/pointerSession.js";
|
|
7
7
|
import { createWorkbenchWidgetSurfaceMetrics as _t } from "./workbenchHelpers.js";
|
|
@@ -85,7 +85,7 @@ function Rt(t) {
|
|
|
85
85
|
worldY: $().y,
|
|
86
86
|
worldWidth: S().width,
|
|
87
87
|
worldHeight: S().height,
|
|
88
|
-
viewport: t.projectedViewport,
|
|
88
|
+
viewport: t.projectedViewport(),
|
|
89
89
|
ready: t.surfaceReady ?? !0
|
|
90
90
|
});
|
|
91
91
|
}), Q = u(() => {
|
|
@@ -107,9 +107,7 @@ function Rt(t) {
|
|
|
107
107
|
const i = Y()?.rect;
|
|
108
108
|
return {
|
|
109
109
|
...e,
|
|
110
|
-
|
|
111
|
-
top: `${i?.screenY ?? 0}px`,
|
|
112
|
-
"--floe-workbench-projected-scale": `${i?.viewportScale ?? Math.max(t.viewportScale, 1e-3)}`
|
|
110
|
+
transform: `translate3d(${i?.screenX ?? 0}px, ${i?.screenY ?? 0}px, 0) scale(${i?.viewportScale ?? Math.max(t.viewportScale, 1e-3)})`
|
|
113
111
|
};
|
|
114
112
|
}
|
|
115
113
|
return {
|
|
@@ -216,7 +214,7 @@ function Rt(t) {
|
|
|
216
214
|
};
|
|
217
215
|
return (() => {
|
|
218
216
|
var e = mt(), i = e.firstChild, r = i.firstChild, d = r.firstChild, a = d.nextSibling, n = a.nextSibling, h = r.nextSibling, w = h.nextSibling, M = w.nextSibling, nt = M.firstChild, L = nt.nextSibling, ot = M.nextSibling, k = ot.firstChild, I = k.nextSibling, C = I.nextSibling, at = i.nextSibling, H = g;
|
|
219
|
-
return typeof H == "function" ? lt(H, e) : g = e,
|
|
217
|
+
return typeof H == "function" ? lt(H, e) : g = e, p(e, rt({
|
|
220
218
|
get classList() {
|
|
221
219
|
return {
|
|
222
220
|
"is-selected": t.selected,
|
|
@@ -258,12 +256,12 @@ function Rt(t) {
|
|
|
258
256
|
get style() {
|
|
259
257
|
return U();
|
|
260
258
|
}
|
|
261
|
-
}), !1, !0), i.$$pointerdown = E,
|
|
259
|
+
}), !1, !0), i.$$pointerdown = E, p(i, {
|
|
262
260
|
[ut]: "true"
|
|
263
|
-
}, !1, !0), d.$$click = A, d.$$pointerdown = (o) => o.stopPropagation(), l(d, c(
|
|
261
|
+
}, !1, !0), d.$$click = A, d.$$pointerdown = (o) => o.stopPropagation(), l(d, c(O, {
|
|
264
262
|
class: "workbench-widget__traffic-icon",
|
|
265
263
|
"aria-hidden": "true"
|
|
266
|
-
})), a.$$click = D, a.$$pointerdown = (o) => o.stopPropagation(), l(a, c(
|
|
264
|
+
})), a.$$click = D, a.$$pointerdown = (o) => o.stopPropagation(), l(a, c(j, {
|
|
267
265
|
class: "workbench-widget__traffic-icon",
|
|
268
266
|
"aria-hidden": "true"
|
|
269
267
|
})), n.$$click = P, n.$$pointerdown = (o) => o.stopPropagation(), l(n, c(q, {
|
|
@@ -276,13 +274,13 @@ function Rt(t) {
|
|
|
276
274
|
return c(o, {
|
|
277
275
|
class: "w-3.5 h-3.5"
|
|
278
276
|
});
|
|
279
|
-
}, L), l(L, () => t.widgetTitle), k.$$click = D, k.$$pointerdown = (o) => o.stopPropagation(), l(k, c(
|
|
277
|
+
}, L), l(L, () => t.widgetTitle), k.$$click = D, k.$$pointerdown = (o) => o.stopPropagation(), l(k, c(j, {
|
|
280
278
|
class: "workbench-widget__window-control-icon",
|
|
281
279
|
"aria-hidden": "true"
|
|
282
280
|
})), I.$$click = P, I.$$pointerdown = (o) => o.stopPropagation(), l(I, c(q, {
|
|
283
281
|
class: "workbench-widget__window-control-icon",
|
|
284
282
|
"aria-hidden": "true"
|
|
285
|
-
})), C.$$click = A, C.$$pointerdown = (o) => o.stopPropagation(), l(C, c(
|
|
283
|
+
})), C.$$click = A, C.$$pointerdown = (o) => o.stopPropagation(), l(C, c(O, {
|
|
286
284
|
class: "workbench-widget__window-control-icon",
|
|
287
285
|
"aria-hidden": "true"
|
|
288
286
|
})), l(at, () => {
|
|
@@ -297,9 +295,7 @@ function Rt(t) {
|
|
|
297
295
|
get type() {
|
|
298
296
|
return t.widgetType;
|
|
299
297
|
},
|
|
300
|
-
|
|
301
|
-
return Y();
|
|
302
|
-
},
|
|
298
|
+
surfaceMetrics: Y,
|
|
303
299
|
get activation() {
|
|
304
300
|
return V();
|
|
305
301
|
},
|
|
@@ -317,8 +313,8 @@ function Rt(t) {
|
|
|
317
313
|
}), l(e, (() => {
|
|
318
314
|
var o = dt(() => !!t.locked);
|
|
319
315
|
return () => o() ? null : (() => {
|
|
320
|
-
var
|
|
321
|
-
return
|
|
316
|
+
var F = vt();
|
|
317
|
+
return F.$$pointerdown = it, F;
|
|
322
318
|
})();
|
|
323
319
|
})(), null), e;
|
|
324
320
|
})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Component } from 'solid-js';
|
|
1
|
+
import type { Accessor, Component } from 'solid-js';
|
|
2
2
|
import type { WorkbenchThemeId } from './workbenchThemes';
|
|
3
3
|
import type { SurfaceInteractionTargetRole, SurfaceWheelLocalReason, WorkbenchWidgetEventOwnership } from '../ui/localInteractionSurface';
|
|
4
4
|
export type BuiltinWorkbenchWidgetType = 'terminal' | 'file-browser' | 'system-monitor' | 'log-viewer' | 'code-editor';
|
|
@@ -90,7 +90,7 @@ export interface WorkbenchWidgetBodyProps<TWidgetType extends string = Workbench
|
|
|
90
90
|
widgetId: string;
|
|
91
91
|
title: string;
|
|
92
92
|
type: TWidgetType;
|
|
93
|
-
surfaceMetrics?: WorkbenchWidgetSurfaceMetrics
|
|
93
|
+
surfaceMetrics?: Accessor<WorkbenchWidgetSurfaceMetrics | undefined>;
|
|
94
94
|
activation?: WorkbenchWidgetBodyActivation;
|
|
95
95
|
lifecycle?: WorkbenchWidgetLifecycle;
|
|
96
96
|
selected?: boolean;
|