@floegence/floe-webapp-core 0.36.20 → 0.36.21
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 +2 -4
- package/dist/components/workbench/types.d.ts +2 -2
- 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;
|
|
@@ -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(() => {
|
|
@@ -297,9 +297,7 @@ function Rt(t) {
|
|
|
297
297
|
get type() {
|
|
298
298
|
return t.widgetType;
|
|
299
299
|
},
|
|
300
|
-
|
|
301
|
-
return Y();
|
|
302
|
-
},
|
|
300
|
+
surfaceMetrics: Y,
|
|
303
301
|
get activation() {
|
|
304
302
|
return V();
|
|
305
303
|
},
|
|
@@ -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;
|