@floegence/floe-webapp-core 0.36.19 → 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 +98 -86
- package/dist/components/workbench/types.d.ts +7 -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;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { spread as F, mergeProps as
|
|
2
|
-
import { createMemo as u, createSignal as W, onCleanup as
|
|
3
|
-
import { startHotInteraction as
|
|
4
|
-
import { X as j, Minus as O, Maximize as
|
|
5
|
-
import { CANVAS_WHEEL_INTERACTIVE_ATTR as
|
|
6
|
-
import { startPointerSession as
|
|
7
|
-
import { createWorkbenchWidgetSurfaceMetrics as
|
|
8
|
-
import { resolveWorkbenchInteractionAdapter as
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
const s = u(() =>
|
|
13
|
-
let _, b,
|
|
14
|
-
const
|
|
15
|
-
const r =
|
|
1
|
+
import { spread as F, 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
|
+
import { createMemo as u, createSignal as W, onCleanup as st, untrack as f } from "solid-js";
|
|
3
|
+
import { startHotInteraction as wt } from "../../utils/hotInteraction.js";
|
|
4
|
+
import { X as j, Minus as O, Maximize as q, GripVertical as gt } from "../icons/index.js";
|
|
5
|
+
import { CANVAS_WHEEL_INTERACTIVE_ATTR as ht, WORKBENCH_WIDGET_SHELL_ATTR as ut, shouldActivateWorkbenchWidgetLocalTarget as ft } from "../ui/localInteractionSurface.js";
|
|
6
|
+
import { startPointerSession as N } from "../ui/pointerSession.js";
|
|
7
|
+
import { createWorkbenchWidgetSurfaceMetrics as _t } from "./workbenchHelpers.js";
|
|
8
|
+
import { resolveWorkbenchInteractionAdapter as bt } from "./workbenchInteractionAdapter.js";
|
|
9
|
+
var mt = /* @__PURE__ */ B('<article class=workbench-widget><header class=workbench-widget__header><span class=workbench-widget__traffic role=group aria-label="Window controls"><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--close"aria-label="Close widget"title="Close widget"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button></span><span class=workbench-widget__badge aria-hidden=true></span><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title-dot aria-hidden=true></span><span class=workbench-widget__title></span></div><span class=workbench-widget__window-controls role=group aria-label="Window controls"><button type=button class="workbench-widget__window-control workbench-widget__window-control--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--close"aria-label="Remove widget"title="Remove widget"data-floe-canvas-interactive=true></button></span></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), vt = /* @__PURE__ */ B('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
|
|
10
|
+
const $t = 220, St = 160;
|
|
11
|
+
function Rt(t) {
|
|
12
|
+
const s = u(() => bt(t.interactionAdapter)), [m, y] = W(null), [v, x] = W(null), [V, Z] = W();
|
|
13
|
+
let _, b, g;
|
|
14
|
+
const z = (e, i) => {
|
|
15
|
+
const r = wt({
|
|
16
16
|
kind: e,
|
|
17
17
|
cursor: i
|
|
18
18
|
});
|
|
@@ -21,7 +21,7 @@ function Wt(t) {
|
|
|
21
21
|
d || (d = !0, r(), f(() => t.onLayoutInteractionEnd?.()));
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
st(() => {
|
|
25
25
|
_?.stop({
|
|
26
26
|
reason: "manual_stop",
|
|
27
27
|
commit: !1
|
|
@@ -30,24 +30,28 @@ function Wt(t) {
|
|
|
30
30
|
commit: !1
|
|
31
31
|
}), b = void 0, f(m)?.stopInteraction(), f(v)?.stopInteraction();
|
|
32
32
|
});
|
|
33
|
-
const
|
|
33
|
+
const R = () => m() !== null, T = () => v() !== null, G = u(() => t.filtered ? "cold" : t.selected ? "hot" : "warm"), X = (e) => s().resolveWidgetEventOwnership({
|
|
34
34
|
target: e,
|
|
35
|
-
widgetRoot:
|
|
35
|
+
widgetRoot: g ?? null,
|
|
36
36
|
interactiveSelector: s().interactiveSelector,
|
|
37
37
|
panSurfaceSelector: s().panSurfaceSelector
|
|
38
|
-
}),
|
|
38
|
+
}), K = () => {
|
|
39
|
+
t.onSelect(t.widgetId), t.onCommitFront(t.widgetId), g?.focus({
|
|
40
|
+
preventScroll: !0
|
|
41
|
+
});
|
|
42
|
+
}, J = (e) => {
|
|
39
43
|
if (e.button !== 0) return;
|
|
40
44
|
t.onSelect(t.widgetId), t.onCommitFront(t.widgetId);
|
|
41
|
-
const i =
|
|
45
|
+
const i = X(e.target);
|
|
42
46
|
if (i === "widget_shell") {
|
|
43
|
-
|
|
47
|
+
g?.focus({
|
|
44
48
|
preventScroll: !0
|
|
45
49
|
});
|
|
46
50
|
return;
|
|
47
51
|
}
|
|
48
|
-
i === "widget_local" &&
|
|
52
|
+
i === "widget_local" && ft({
|
|
49
53
|
target: e.target,
|
|
50
|
-
widgetRoot:
|
|
54
|
+
widgetRoot: g ?? null,
|
|
51
55
|
interactiveSelector: s().interactiveSelector,
|
|
52
56
|
panSurfaceSelector: s().panSurfaceSelector
|
|
53
57
|
}) && Z((r) => ({
|
|
@@ -73,34 +77,34 @@ function Wt(t) {
|
|
|
73
77
|
width: t.width,
|
|
74
78
|
height: t.height
|
|
75
79
|
};
|
|
76
|
-
}),
|
|
80
|
+
}), Y = u(() => {
|
|
77
81
|
if (!(t.layoutMode !== "projected_surface" || !t.projectedViewport))
|
|
78
|
-
return
|
|
82
|
+
return _t({
|
|
79
83
|
widgetId: t.widgetId,
|
|
80
84
|
worldX: $().x,
|
|
81
85
|
worldY: $().y,
|
|
82
86
|
worldWidth: S().width,
|
|
83
87
|
worldHeight: S().height,
|
|
84
|
-
viewport: t.projectedViewport,
|
|
88
|
+
viewport: t.projectedViewport(),
|
|
85
89
|
ready: t.surfaceReady ?? !0
|
|
86
90
|
});
|
|
87
|
-
}),
|
|
91
|
+
}), Q = u(() => {
|
|
88
92
|
const e = t.itemSnapshot().z_index, i = Number.isFinite(e) ? Math.max(1, Math.min(99, Math.round(e))) : 1;
|
|
89
93
|
return String(i).padStart(2, "0");
|
|
90
|
-
}),
|
|
94
|
+
}), D = (e) => {
|
|
91
95
|
e.preventDefault(), e.stopPropagation(), t.onRequestOverview(t.itemSnapshot());
|
|
92
|
-
}, D = (e) => {
|
|
93
|
-
e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
|
|
94
96
|
}, P = (e) => {
|
|
97
|
+
e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
|
|
98
|
+
}, A = (e) => {
|
|
95
99
|
e.preventDefault(), e.stopPropagation(), t.onRequestDelete(t.widgetId);
|
|
96
|
-
},
|
|
100
|
+
}, U = u(() => {
|
|
97
101
|
const e = {
|
|
98
102
|
width: `${S().width}px`,
|
|
99
103
|
height: `${S().height}px`,
|
|
100
|
-
"z-index":
|
|
104
|
+
"z-index": R() || T() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
|
|
101
105
|
};
|
|
102
106
|
if (t.layoutMode === "projected_surface") {
|
|
103
|
-
const i =
|
|
107
|
+
const i = Y()?.rect;
|
|
104
108
|
return {
|
|
105
109
|
...e,
|
|
106
110
|
left: `${i?.screenX ?? 0}px`,
|
|
@@ -112,7 +116,7 @@ function Wt(t) {
|
|
|
112
116
|
...e,
|
|
113
117
|
transform: `translate(${$().x}px, ${$().y}px)`
|
|
114
118
|
};
|
|
115
|
-
}),
|
|
119
|
+
}), tt = (e) => {
|
|
116
120
|
const i = f(m);
|
|
117
121
|
if (!i) return;
|
|
118
122
|
const r = {
|
|
@@ -128,10 +132,10 @@ function Wt(t) {
|
|
|
128
132
|
e.preventDefault(), e.stopPropagation(), _?.stop({
|
|
129
133
|
reason: "manual_stop",
|
|
130
134
|
commit: !1
|
|
131
|
-
}), t.onSelect(t.widgetId),
|
|
135
|
+
}), t.onSelect(t.widgetId), g?.focus({
|
|
132
136
|
preventScroll: !0
|
|
133
137
|
}), t.onStartOptimisticFront(t.widgetId);
|
|
134
|
-
const i =
|
|
138
|
+
const i = z("drag", "grabbing"), r = Math.max(t.viewportScale, 1e-3);
|
|
135
139
|
y({
|
|
136
140
|
pointerId: e.pointerId,
|
|
137
141
|
startClientX: e.clientX,
|
|
@@ -145,26 +149,26 @@ function Wt(t) {
|
|
|
145
149
|
stopInteraction: i
|
|
146
150
|
});
|
|
147
151
|
const d = (a) => {
|
|
148
|
-
y((
|
|
149
|
-
if (!
|
|
150
|
-
const
|
|
152
|
+
y((n) => {
|
|
153
|
+
if (!n || n.pointerId !== a.pointerId) return n;
|
|
154
|
+
const h = n.startWorldX + (a.clientX - n.startClientX) / n.scale, w = n.startWorldY + (a.clientY - n.startClientY) / n.scale;
|
|
151
155
|
return {
|
|
152
|
-
...
|
|
153
|
-
worldX:
|
|
156
|
+
...n,
|
|
157
|
+
worldX: h,
|
|
154
158
|
worldY: w,
|
|
155
|
-
moved:
|
|
159
|
+
moved: n.moved || Math.abs(h - n.startWorldX) > 2 || Math.abs(w - n.startWorldY) > 2
|
|
156
160
|
};
|
|
157
161
|
});
|
|
158
162
|
};
|
|
159
|
-
_ =
|
|
163
|
+
_ = N({
|
|
160
164
|
pointerEvent: e,
|
|
161
165
|
captureEl: e.currentTarget,
|
|
162
166
|
onMove: d,
|
|
163
167
|
onEnd: ({
|
|
164
168
|
commit: a
|
|
165
|
-
}) =>
|
|
169
|
+
}) => tt(a)
|
|
166
170
|
});
|
|
167
|
-
},
|
|
171
|
+
}, et = (e) => {
|
|
168
172
|
const i = f(v);
|
|
169
173
|
if (!i) return;
|
|
170
174
|
const r = {
|
|
@@ -172,13 +176,13 @@ function Wt(t) {
|
|
|
172
176
|
height: i.height
|
|
173
177
|
}, d = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
|
|
174
178
|
e && d && t.onCommitResize(t.widgetId, r), i.stopInteraction(), x(null), b = void 0;
|
|
175
|
-
},
|
|
179
|
+
}, it = (e) => {
|
|
176
180
|
if (e.button !== 0 || t.locked) return;
|
|
177
181
|
e.preventDefault(), e.stopPropagation(), b?.stop({
|
|
178
182
|
reason: "manual_stop",
|
|
179
183
|
commit: !1
|
|
180
184
|
}), t.onStartOptimisticFront(t.widgetId);
|
|
181
|
-
const i =
|
|
185
|
+
const i = z("resize", "nwse-resize"), r = Math.max(t.viewportScale, 1e-3);
|
|
182
186
|
x({
|
|
183
187
|
pointerId: e.pointerId,
|
|
184
188
|
startClientX: e.clientX,
|
|
@@ -191,33 +195,33 @@ function Wt(t) {
|
|
|
191
195
|
stopInteraction: i
|
|
192
196
|
});
|
|
193
197
|
const d = (a) => {
|
|
194
|
-
x((
|
|
195
|
-
if (!
|
|
196
|
-
const
|
|
198
|
+
x((n) => {
|
|
199
|
+
if (!n || n.pointerId !== a.pointerId) return n;
|
|
200
|
+
const h = Math.max($t, n.startWidth + (a.clientX - n.startClientX) / n.scale), w = Math.max(St, n.startHeight + (a.clientY - n.startClientY) / n.scale);
|
|
197
201
|
return {
|
|
198
|
-
...
|
|
199
|
-
width:
|
|
202
|
+
...n,
|
|
203
|
+
width: h,
|
|
200
204
|
height: w
|
|
201
205
|
};
|
|
202
206
|
});
|
|
203
207
|
};
|
|
204
|
-
b =
|
|
208
|
+
b = N({
|
|
205
209
|
pointerEvent: e,
|
|
206
210
|
captureEl: e.currentTarget,
|
|
207
211
|
onMove: d,
|
|
208
212
|
onEnd: ({
|
|
209
213
|
commit: a
|
|
210
|
-
}) =>
|
|
214
|
+
}) => et(a)
|
|
211
215
|
});
|
|
212
216
|
};
|
|
213
217
|
return (() => {
|
|
214
|
-
var e =
|
|
215
|
-
return typeof
|
|
218
|
+
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, F(e, rt({
|
|
216
220
|
get classList() {
|
|
217
221
|
return {
|
|
218
222
|
"is-selected": t.selected,
|
|
219
|
-
"is-dragging":
|
|
220
|
-
"is-resizing":
|
|
223
|
+
"is-dragging": R(),
|
|
224
|
+
"is-resizing": T(),
|
|
221
225
|
"is-filtered-out": t.filtered,
|
|
222
226
|
"is-projected-surface": t.layoutMode === "projected_surface",
|
|
223
227
|
"is-locked": t.locked
|
|
@@ -241,49 +245,49 @@ function Wt(t) {
|
|
|
241
245
|
return t.layoutMode ?? "canvas_scaled";
|
|
242
246
|
}
|
|
243
247
|
}, () => ({
|
|
244
|
-
[
|
|
248
|
+
[ht]: t.selected ? "true" : void 0
|
|
245
249
|
}), {
|
|
246
250
|
tabIndex: 0,
|
|
247
|
-
onPointerDown:
|
|
251
|
+
onPointerDown: J,
|
|
248
252
|
onFocus: () => {
|
|
249
253
|
t.onSelect(t.widgetId);
|
|
250
254
|
},
|
|
251
|
-
onContextMenu: (
|
|
252
|
-
|
|
255
|
+
onContextMenu: (o) => {
|
|
256
|
+
X(o.target) === "widget_shell" && (o.preventDefault(), o.stopPropagation(), t.onContextMenu(o, t.itemSnapshot()));
|
|
253
257
|
},
|
|
254
258
|
get style() {
|
|
255
|
-
return
|
|
259
|
+
return U();
|
|
256
260
|
}
|
|
257
261
|
}), !1, !0), i.$$pointerdown = E, F(i, {
|
|
258
|
-
[
|
|
259
|
-
}, !1, !0), d.$$click =
|
|
262
|
+
[ut]: "true"
|
|
263
|
+
}, !1, !0), d.$$click = A, d.$$pointerdown = (o) => o.stopPropagation(), l(d, c(j, {
|
|
260
264
|
class: "workbench-widget__traffic-icon",
|
|
261
265
|
"aria-hidden": "true"
|
|
262
|
-
})), a.$$click =
|
|
266
|
+
})), a.$$click = D, a.$$pointerdown = (o) => o.stopPropagation(), l(a, c(O, {
|
|
263
267
|
class: "workbench-widget__traffic-icon",
|
|
264
268
|
"aria-hidden": "true"
|
|
265
|
-
})),
|
|
269
|
+
})), n.$$click = P, n.$$pointerdown = (o) => o.stopPropagation(), l(n, c(q, {
|
|
266
270
|
class: "workbench-widget__traffic-icon",
|
|
267
271
|
"aria-hidden": "true"
|
|
268
|
-
})), l(
|
|
272
|
+
})), l(h, Q), w.$$pointerdown = E, l(w, c(gt, {
|
|
269
273
|
class: "w-3.5 h-3.5"
|
|
270
274
|
})), l(M, () => {
|
|
271
|
-
const
|
|
272
|
-
return c(
|
|
275
|
+
const o = t.definition.icon;
|
|
276
|
+
return c(o, {
|
|
273
277
|
class: "w-3.5 h-3.5"
|
|
274
278
|
});
|
|
275
|
-
},
|
|
279
|
+
}, L), l(L, () => t.widgetTitle), k.$$click = D, k.$$pointerdown = (o) => o.stopPropagation(), l(k, c(O, {
|
|
276
280
|
class: "workbench-widget__window-control-icon",
|
|
277
281
|
"aria-hidden": "true"
|
|
278
|
-
})), I.$$click =
|
|
282
|
+
})), I.$$click = P, I.$$pointerdown = (o) => o.stopPropagation(), l(I, c(q, {
|
|
279
283
|
class: "workbench-widget__window-control-icon",
|
|
280
284
|
"aria-hidden": "true"
|
|
281
|
-
})), C.$$click =
|
|
285
|
+
})), C.$$click = A, C.$$pointerdown = (o) => o.stopPropagation(), l(C, c(j, {
|
|
282
286
|
class: "workbench-widget__window-control-icon",
|
|
283
287
|
"aria-hidden": "true"
|
|
284
|
-
})), l(
|
|
285
|
-
const
|
|
286
|
-
return c(
|
|
288
|
+
})), l(at, () => {
|
|
289
|
+
const o = t.definition.body;
|
|
290
|
+
return c(o, {
|
|
287
291
|
get widgetId() {
|
|
288
292
|
return t.widgetId;
|
|
289
293
|
},
|
|
@@ -293,23 +297,31 @@ function Wt(t) {
|
|
|
293
297
|
get type() {
|
|
294
298
|
return t.widgetType;
|
|
295
299
|
},
|
|
296
|
-
|
|
297
|
-
return X();
|
|
298
|
-
},
|
|
300
|
+
surfaceMetrics: Y,
|
|
299
301
|
get activation() {
|
|
300
302
|
return V();
|
|
301
|
-
}
|
|
303
|
+
},
|
|
304
|
+
get lifecycle() {
|
|
305
|
+
return G();
|
|
306
|
+
},
|
|
307
|
+
get selected() {
|
|
308
|
+
return t.selected;
|
|
309
|
+
},
|
|
310
|
+
get filtered() {
|
|
311
|
+
return t.filtered;
|
|
312
|
+
},
|
|
313
|
+
requestActivate: K
|
|
302
314
|
});
|
|
303
315
|
}), l(e, (() => {
|
|
304
|
-
var
|
|
305
|
-
return () =>
|
|
306
|
-
var
|
|
307
|
-
return
|
|
316
|
+
var o = dt(() => !!t.locked);
|
|
317
|
+
return () => o() ? null : (() => {
|
|
318
|
+
var p = vt();
|
|
319
|
+
return p.$$pointerdown = it, p;
|
|
308
320
|
})();
|
|
309
321
|
})(), null), e;
|
|
310
322
|
})();
|
|
311
323
|
}
|
|
312
|
-
|
|
324
|
+
ct(["pointerdown", "click"]);
|
|
313
325
|
export {
|
|
314
|
-
|
|
326
|
+
Rt as WorkbenchWidget
|
|
315
327
|
};
|
|
@@ -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';
|
|
@@ -85,12 +85,17 @@ export interface WorkbenchWidgetBodyActivation {
|
|
|
85
85
|
source: WorkbenchWidgetBodyActivationSource;
|
|
86
86
|
pointerType?: string;
|
|
87
87
|
}
|
|
88
|
+
export type WorkbenchWidgetLifecycle = 'hot' | 'warm' | 'cold';
|
|
88
89
|
export interface WorkbenchWidgetBodyProps<TWidgetType extends string = WorkbenchWidgetType> {
|
|
89
90
|
widgetId: string;
|
|
90
91
|
title: string;
|
|
91
92
|
type: TWidgetType;
|
|
92
|
-
surfaceMetrics?: WorkbenchWidgetSurfaceMetrics
|
|
93
|
+
surfaceMetrics?: Accessor<WorkbenchWidgetSurfaceMetrics | undefined>;
|
|
93
94
|
activation?: WorkbenchWidgetBodyActivation;
|
|
95
|
+
lifecycle?: WorkbenchWidgetLifecycle;
|
|
96
|
+
selected?: boolean;
|
|
97
|
+
filtered?: boolean;
|
|
98
|
+
requestActivate?: () => void;
|
|
94
99
|
}
|
|
95
100
|
export interface WorkbenchWidgetDefinition<TWidgetType extends string = WorkbenchWidgetType> {
|
|
96
101
|
type: TWidgetType;
|