@floegence/floe-webapp-core 0.36.33 → 0.36.35
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/Dialog.js +121 -71
- package/dist/components/ui/dialogSurfaceScope.d.ts +5 -2
- package/dist/components/ui/dialogSurfaceScope.js +25 -25
- package/dist/components/ui/surfacePortalScope.d.ts +1 -1
- package/dist/components/workbench/WorkbenchSurface.d.ts +10 -1
- package/dist/components/workbench/WorkbenchSurface.js +155 -135
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/components/workbench/useWorkbenchModel.js +6 -6
- package/package.json +1 -1
|
@@ -1,142 +1,192 @@
|
|
|
1
|
-
import { createComponent as n,
|
|
2
|
-
import { createUniqueId as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { X as
|
|
6
|
-
import { useResolvedFloeConfig as
|
|
7
|
-
import { useOverlayMask as
|
|
8
|
-
import { resolveSurfacePortalHost as
|
|
9
|
-
import { LOCAL_INTERACTION_SURFACE_ATTR as
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { createComponent as n, use as D, setAttribute as s, style as K, Portal as W, spread as A, mergeProps as O, memo as R, insert as d, effect as E, template as u } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as Y, createSignal as k, createMemo as I, createEffect as X, onCleanup as J, Show as g, untrack as Q } from "solid-js";
|
|
3
|
+
import { cn as S } from "../../utils/cn.js";
|
|
4
|
+
import { Button as P } from "./Button.js";
|
|
5
|
+
import { X as Z } from "../icons/index.js";
|
|
6
|
+
import { useResolvedFloeConfig as ee } from "../../context/FloeConfigContext.js";
|
|
7
|
+
import { useOverlayMask as te } from "../../hooks/useOverlayMask.js";
|
|
8
|
+
import { resolveSurfacePortalHost as re, isSurfacePortalMode as F, DIALOG_SURFACE_BOUNDARY_ATTR as x, projectSurfacePortalRect as ne, resolveSurfacePortalBoundaryRect as oe, resolveSurfacePortalMount as ie } from "./dialogSurfaceScope.js";
|
|
9
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as le } from "./localInteractionSurface.js";
|
|
10
|
+
var ae = /* @__PURE__ */ u("<span aria-hidden=true>"), de = /* @__PURE__ */ u('<h2 class="text-sm font-semibold">'), ce = /* @__PURE__ */ u('<p class="mt-0.5 text-xs text-muted-foreground">'), ue = /* @__PURE__ */ u('<div class="flex items-start justify-between p-3 border-b border-border"><div>'), se = /* @__PURE__ */ u('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), fe = /* @__PURE__ */ u('<div><div></div><div class="relative z-[1] flex h-full w-full items-center justify-center"><div><div class="flex-1 overflow-auto overscroll-contain p-3">'), me = /* @__PURE__ */ u("<div>");
|
|
11
|
+
const ge = {
|
|
12
|
+
display: "none"
|
|
13
|
+
};
|
|
14
|
+
function he(e) {
|
|
15
|
+
if (typeof queueMicrotask == "function") {
|
|
16
|
+
queueMicrotask(e);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
Promise.resolve().then(e);
|
|
20
|
+
}
|
|
21
|
+
function M(e) {
|
|
22
|
+
return `${e.left}|${e.top}|${e.right}|${e.bottom}|${e.width}|${e.height}`;
|
|
23
|
+
}
|
|
24
|
+
function we(e) {
|
|
25
|
+
return typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(e) : window.setTimeout(() => e(Date.now()), 16);
|
|
26
|
+
}
|
|
27
|
+
function be(e) {
|
|
28
|
+
if (typeof window < "u" && typeof window.cancelAnimationFrame == "function") {
|
|
29
|
+
window.cancelAnimationFrame(e);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
window.clearTimeout(e);
|
|
33
|
+
}
|
|
34
|
+
function ve(e) {
|
|
35
|
+
const o = Y(), T = () => `dialog-${o}-title`, B = () => `dialog-${o}-description`;
|
|
36
|
+
let p;
|
|
37
|
+
const [_, H] = k(null), [N, j] = k(0), [q, G] = k(0), h = () => e.open && !!_() && N() > 0, z = (t) => {
|
|
38
|
+
H(t), he(() => {
|
|
39
|
+
Q(_) === t && j((l) => l + 1);
|
|
40
|
+
});
|
|
41
|
+
}, w = I(() => h() ? re({
|
|
42
|
+
owner: _()
|
|
43
|
+
}) : {
|
|
15
44
|
host: null,
|
|
16
45
|
boundaryHost: null,
|
|
17
46
|
mountHost: null,
|
|
18
47
|
mode: "global"
|
|
19
|
-
}),
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
48
|
+
}), b = () => `dialog-boundary-${o}`, r = () => F(w()), L = () => ie(w()), C = (t) => ne(oe(t), t), U = () => C(w()), v = I(() => (q(), U())), V = (t) => typeof Element < "u" && t instanceof Element ? !!t.closest(`[${x}="${b()}"]`) : typeof Node < "u" && t instanceof Node ? !!t.parentElement?.closest(`[${x}="${b()}"]`) : !1;
|
|
49
|
+
return X(() => {
|
|
50
|
+
const t = w();
|
|
51
|
+
if (!h() || !F(t) || typeof window > "u")
|
|
52
|
+
return;
|
|
53
|
+
let l = !1, f = null, i = M(C(t));
|
|
54
|
+
const y = () => {
|
|
55
|
+
if (l || !F(t))
|
|
56
|
+
return;
|
|
57
|
+
const a = M(C(t));
|
|
58
|
+
a !== i && (i = a, G(($) => $ + 1));
|
|
59
|
+
}, m = () => {
|
|
60
|
+
l || (f = we(() => {
|
|
61
|
+
y(), m();
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
m(), J(() => {
|
|
65
|
+
l = !0, f !== null && be(f);
|
|
66
|
+
});
|
|
67
|
+
}), te({
|
|
68
|
+
open: h,
|
|
69
|
+
root: () => p,
|
|
70
|
+
containsTarget: (t) => r() && V(t),
|
|
24
71
|
onClose: () => e.onOpenChange(!1),
|
|
25
|
-
lockBodyScroll: () => !
|
|
72
|
+
lockBodyScroll: () => !r(),
|
|
26
73
|
trapFocus: !0,
|
|
27
|
-
closeOnEscape: () =>
|
|
74
|
+
closeOnEscape: () => r() ? "inside" : !0,
|
|
28
75
|
blockHotkeys: !0,
|
|
29
76
|
// Block scroll bleed outside the dialog while keeping the dialog content scrollable.
|
|
30
|
-
blockWheel: () =>
|
|
31
|
-
blockTouchMove: () =>
|
|
77
|
+
blockWheel: () => r() ? "none" : "outside",
|
|
78
|
+
blockTouchMove: () => r() ? "none" : "outside",
|
|
32
79
|
restoreFocus: !0
|
|
33
|
-
}),
|
|
80
|
+
}), [(() => {
|
|
81
|
+
var t = ae();
|
|
82
|
+
return D(z, t), s(t, "data-floe-dialog-owner-anchor", o), K(t, ge), t;
|
|
83
|
+
})(), n(g, {
|
|
34
84
|
get when() {
|
|
35
|
-
return
|
|
85
|
+
return h();
|
|
36
86
|
},
|
|
37
87
|
get children() {
|
|
38
|
-
return n(
|
|
88
|
+
return n(W, {
|
|
39
89
|
get mount() {
|
|
40
|
-
return
|
|
90
|
+
return L();
|
|
41
91
|
},
|
|
42
92
|
get children() {
|
|
43
|
-
var
|
|
44
|
-
|
|
93
|
+
var t = fe(), l = t.firstChild, f = l.nextSibling, i = f.firstChild, y = i.firstChild;
|
|
94
|
+
s(t, "data-floe-dialog-overlay-root", o), A(t, O({
|
|
45
95
|
get "data-floe-dialog-mode"() {
|
|
46
|
-
return
|
|
96
|
+
return r() ? "surface" : "global";
|
|
47
97
|
}
|
|
48
98
|
}, () => ({
|
|
49
|
-
[
|
|
99
|
+
[le]: r() ? "true" : void 0
|
|
50
100
|
}), {
|
|
51
101
|
get class() {
|
|
52
|
-
return
|
|
102
|
+
return S(r() ? "absolute z-20 box-border p-3" : "fixed inset-0 box-border z-50 p-4");
|
|
53
103
|
},
|
|
54
104
|
get style() {
|
|
55
|
-
return
|
|
56
|
-
left: `${
|
|
57
|
-
top: `${
|
|
58
|
-
width: `${
|
|
59
|
-
height: `${
|
|
105
|
+
return R(() => !!r())() ? {
|
|
106
|
+
left: `${v().left}px`,
|
|
107
|
+
top: `${v().top}px`,
|
|
108
|
+
width: `${v().width}px`,
|
|
109
|
+
height: `${v().height}px`
|
|
60
110
|
} : void 0;
|
|
61
111
|
}
|
|
62
|
-
}), !1, !0),
|
|
63
|
-
[
|
|
112
|
+
}), !1, !0), s(l, "data-floe-dialog-backdrop", o), A(l, O(() => ({
|
|
113
|
+
[x]: b()
|
|
64
114
|
}), {
|
|
65
115
|
get class() {
|
|
66
|
-
return
|
|
116
|
+
return S("absolute inset-0 cursor-pointer animate-in fade-in", r() ? "bg-background/72 backdrop-blur-[2px]" : "bg-background/80 backdrop-blur-sm");
|
|
67
117
|
},
|
|
68
118
|
onClick: () => e.onOpenChange(!1)
|
|
69
119
|
}), !1, !1);
|
|
70
|
-
var
|
|
71
|
-
return typeof
|
|
72
|
-
[
|
|
120
|
+
var m = p;
|
|
121
|
+
return typeof m == "function" ? D(m, i) : p = i, s(i, "data-floe-dialog-panel", o), A(i, O(() => ({
|
|
122
|
+
[x]: b()
|
|
73
123
|
}), {
|
|
74
124
|
get class() {
|
|
75
|
-
return
|
|
125
|
+
return S(r() ? "flex max-h-[calc(100%-1rem)] w-[min(32rem,calc(100%-1rem))] max-w-[calc(100%-1rem)] flex-col" : "w-full max-w-md max-h-[85vh]", "bg-card text-card-foreground rounded-md shadow-lg", "border border-border", "animate-in fade-in zoom-in-95", "flex flex-col", e.class);
|
|
76
126
|
},
|
|
77
127
|
role: "dialog",
|
|
78
128
|
get "aria-modal"() {
|
|
79
|
-
return
|
|
129
|
+
return r() ? void 0 : "true";
|
|
80
130
|
},
|
|
81
131
|
get "aria-labelledby"() {
|
|
82
|
-
return
|
|
132
|
+
return R(() => !!e.title)() ? T() : void 0;
|
|
83
133
|
},
|
|
84
134
|
get "aria-describedby"() {
|
|
85
|
-
return
|
|
135
|
+
return R(() => !!e.description)() ? B() : void 0;
|
|
86
136
|
},
|
|
87
137
|
tabIndex: -1
|
|
88
|
-
}), !1, !0),
|
|
138
|
+
}), !1, !0), d(i, n(g, {
|
|
89
139
|
get when() {
|
|
90
140
|
return e.title || e.description;
|
|
91
141
|
},
|
|
92
142
|
get children() {
|
|
93
|
-
var
|
|
94
|
-
return
|
|
143
|
+
var a = ue(), $ = a.firstChild;
|
|
144
|
+
return d($, n(g, {
|
|
95
145
|
get when() {
|
|
96
146
|
return e.title;
|
|
97
147
|
},
|
|
98
148
|
get children() {
|
|
99
|
-
var
|
|
100
|
-
return
|
|
149
|
+
var c = de();
|
|
150
|
+
return d(c, () => e.title), E(() => s(c, "id", T())), c;
|
|
101
151
|
}
|
|
102
|
-
}), null),
|
|
152
|
+
}), null), d($, n(g, {
|
|
103
153
|
get when() {
|
|
104
154
|
return e.description;
|
|
105
155
|
},
|
|
106
156
|
get children() {
|
|
107
|
-
var
|
|
108
|
-
return
|
|
157
|
+
var c = ce();
|
|
158
|
+
return d(c, () => e.description), E(() => s(c, "id", B())), c;
|
|
109
159
|
}
|
|
110
|
-
}), null),
|
|
160
|
+
}), null), d(a, n(P, {
|
|
111
161
|
variant: "ghost-destructive",
|
|
112
162
|
size: "icon",
|
|
113
163
|
class: "h-6 w-6 -mr-1",
|
|
114
164
|
onClick: () => e.onOpenChange(!1),
|
|
115
165
|
"aria-label": "Close",
|
|
116
166
|
get children() {
|
|
117
|
-
return n(
|
|
167
|
+
return n(Z, {
|
|
118
168
|
class: "w-3.5 h-3.5"
|
|
119
169
|
});
|
|
120
170
|
}
|
|
121
|
-
}), null),
|
|
171
|
+
}), null), a;
|
|
122
172
|
}
|
|
123
|
-
}),
|
|
173
|
+
}), y), d(y, () => e.children), d(i, n(g, {
|
|
124
174
|
get when() {
|
|
125
175
|
return e.footer;
|
|
126
176
|
},
|
|
127
177
|
get children() {
|
|
128
|
-
var
|
|
129
|
-
return
|
|
178
|
+
var a = se();
|
|
179
|
+
return d(a, () => e.footer), a;
|
|
130
180
|
}
|
|
131
|
-
}), null),
|
|
181
|
+
}), null), t;
|
|
132
182
|
}
|
|
133
183
|
});
|
|
134
184
|
}
|
|
135
|
-
});
|
|
185
|
+
})];
|
|
136
186
|
}
|
|
137
|
-
function
|
|
138
|
-
const o =
|
|
139
|
-
return n(
|
|
187
|
+
function ke(e) {
|
|
188
|
+
const o = ee();
|
|
189
|
+
return n(ve, {
|
|
140
190
|
get open() {
|
|
141
191
|
return e.open;
|
|
142
192
|
},
|
|
@@ -150,7 +200,7 @@ function ae(e) {
|
|
|
150
200
|
return e.description;
|
|
151
201
|
},
|
|
152
202
|
get footer() {
|
|
153
|
-
return [n(
|
|
203
|
+
return [n(P, {
|
|
154
204
|
variant: "ghost",
|
|
155
205
|
onClick: () => e.onOpenChange(!1),
|
|
156
206
|
get disabled() {
|
|
@@ -159,7 +209,7 @@ function ae(e) {
|
|
|
159
209
|
get children() {
|
|
160
210
|
return e.cancelText ?? o.config.strings.confirmDialog.cancel;
|
|
161
211
|
}
|
|
162
|
-
}), n(
|
|
212
|
+
}), n(P, {
|
|
163
213
|
get variant() {
|
|
164
214
|
return e.variant === "destructive" ? "destructive" : "primary";
|
|
165
215
|
},
|
|
@@ -175,11 +225,11 @@ function ae(e) {
|
|
|
175
225
|
})];
|
|
176
226
|
},
|
|
177
227
|
get children() {
|
|
178
|
-
return e.children ??
|
|
228
|
+
return e.children ?? me();
|
|
179
229
|
}
|
|
180
230
|
});
|
|
181
231
|
}
|
|
182
232
|
export {
|
|
183
|
-
|
|
184
|
-
|
|
233
|
+
ke as ConfirmDialog,
|
|
234
|
+
ve as Dialog
|
|
185
235
|
};
|
|
@@ -19,10 +19,13 @@ export type ResolvedDialogSurfaceHost = Readonly<{
|
|
|
19
19
|
export type ResolvedSurfacePortalHost = ResolvedDialogSurfaceHost;
|
|
20
20
|
export type SurfacePortalBoundaryRect = SurfacePortalRect;
|
|
21
21
|
export type { SurfacePortalRect };
|
|
22
|
+
export type SurfacePortalHostResolutionOptions = Readonly<{
|
|
23
|
+
owner?: Element | null;
|
|
24
|
+
}>;
|
|
22
25
|
export declare function ensureDialogSurfaceInteractionTracking(): void;
|
|
23
26
|
export declare function ensureSurfacePortalInteractionTracking(): void;
|
|
24
|
-
export declare function resolveDialogSurfaceHost(): ResolvedDialogSurfaceHost;
|
|
25
|
-
export declare function resolveSurfacePortalHost(): ResolvedSurfacePortalHost;
|
|
27
|
+
export declare function resolveDialogSurfaceHost(options?: SurfacePortalHostResolutionOptions): ResolvedDialogSurfaceHost;
|
|
28
|
+
export declare function resolveSurfacePortalHost(options?: SurfacePortalHostResolutionOptions): ResolvedSurfacePortalHost;
|
|
26
29
|
export declare function isSurfacePortalMode(surfaceHost: ResolvedSurfacePortalHost): boolean;
|
|
27
30
|
export declare function resolveSurfacePortalMount(surfaceHost: ResolvedSurfacePortalHost): HTMLElement | undefined;
|
|
28
31
|
export declare function resolveSurfacePortalBoundaryRect(surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
|
|
@@ -3,52 +3,52 @@ let r = null, o = null;
|
|
|
3
3
|
function E(t) {
|
|
4
4
|
return typeof Element < "u" && t instanceof Element ? t : typeof Node < "u" && t instanceof Node ? t.parentElement : null;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function w(t) {
|
|
7
7
|
const e = t?.activeElement;
|
|
8
8
|
return e instanceof Element ? e : null;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function l(t) {
|
|
11
11
|
const e = typeof document < "u" ? document : null;
|
|
12
12
|
r = {
|
|
13
13
|
target: E(t),
|
|
14
|
-
activeElement:
|
|
14
|
+
activeElement: w(e),
|
|
15
15
|
recordedAt: Date.now()
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function l(t) {
|
|
19
|
-
i(t.target);
|
|
20
|
-
}
|
|
21
18
|
function c(t) {
|
|
22
|
-
|
|
19
|
+
l(t.target);
|
|
20
|
+
}
|
|
21
|
+
function f(t) {
|
|
22
|
+
l(t.target);
|
|
23
23
|
}
|
|
24
24
|
function d(t) {
|
|
25
|
-
|
|
25
|
+
l(t.target);
|
|
26
26
|
}
|
|
27
27
|
function s() {
|
|
28
|
-
|
|
28
|
+
T();
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
typeof document > "u" || o !== document && (o && (o.removeEventListener("pointerdown",
|
|
30
|
+
function T() {
|
|
31
|
+
typeof document > "u" || o !== document && (o && (o.removeEventListener("pointerdown", c, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("contextmenu", d, !0)), document.addEventListener("pointerdown", c, !0), document.addEventListener("focusin", f, !0), document.addEventListener("contextmenu", d, !0), o = document);
|
|
32
32
|
}
|
|
33
33
|
function R() {
|
|
34
34
|
return !r || Date.now() - r.recordedAt > g ? null : r;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function i(t) {
|
|
37
37
|
const e = t?.closest(`[${a}="true"]`);
|
|
38
|
-
return typeof HTMLElement > "u" ? null : e instanceof HTMLElement
|
|
38
|
+
return typeof HTMLElement > "u" ? null : e instanceof HTMLElement ? e : null;
|
|
39
39
|
}
|
|
40
40
|
function S(t) {
|
|
41
41
|
if (!t) return null;
|
|
42
42
|
const e = t.closest(`[${p}="true"]`);
|
|
43
|
-
return typeof HTMLElement > "u" ? null : e instanceof HTMLElement
|
|
43
|
+
return typeof HTMLElement > "u" ? null : e instanceof HTMLElement ? e : null;
|
|
44
44
|
}
|
|
45
|
-
function L() {
|
|
45
|
+
function L(t = {}) {
|
|
46
46
|
s();
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
host:
|
|
50
|
-
boundaryHost:
|
|
51
|
-
mountHost: S(
|
|
47
|
+
const e = R(), n = i(t.owner ?? null) ?? i(e?.target ?? null) ?? i(e?.activeElement ?? null);
|
|
48
|
+
return n ? {
|
|
49
|
+
host: n,
|
|
50
|
+
boundaryHost: n,
|
|
51
|
+
mountHost: S(n) ?? n,
|
|
52
52
|
mode: "surface"
|
|
53
53
|
} : { host: null, boundaryHost: null, mountHost: null, mode: "global" };
|
|
54
54
|
}
|
|
@@ -112,7 +112,7 @@ function b(t, e) {
|
|
|
112
112
|
y: t.y - n.top
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function P(t, e) {
|
|
116
116
|
if (!u(e))
|
|
117
117
|
return t;
|
|
118
118
|
const n = h(e);
|
|
@@ -125,7 +125,7 @@ function C(t, e) {
|
|
|
125
125
|
height: t.height
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function C() {
|
|
129
129
|
r = null;
|
|
130
130
|
}
|
|
131
131
|
typeof document < "u" && s();
|
|
@@ -134,12 +134,12 @@ export {
|
|
|
134
134
|
a as DIALOG_SURFACE_HOST_ATTR,
|
|
135
135
|
y as SURFACE_PORTAL_HOST_ATTR,
|
|
136
136
|
p as SURFACE_PORTAL_LAYER_ATTR,
|
|
137
|
-
|
|
137
|
+
C as __resetSurfacePortalScopeForTests,
|
|
138
138
|
s as ensureDialogSurfaceInteractionTracking,
|
|
139
|
-
|
|
139
|
+
T as ensureSurfacePortalInteractionTracking,
|
|
140
140
|
u as isSurfacePortalMode,
|
|
141
141
|
b as projectSurfacePortalPosition,
|
|
142
|
-
|
|
142
|
+
P as projectSurfacePortalRect,
|
|
143
143
|
_ as resolveSurfacePortalBoundaryRect,
|
|
144
144
|
L as resolveSurfacePortalHost,
|
|
145
145
|
v as resolveSurfacePortalMount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DIALOG_SURFACE_HOST_ATTR, SURFACE_PORTAL_HOST_ATTR, SURFACE_PORTAL_LAYER_ATTR, DIALOG_SURFACE_BOUNDARY_ATTR, ensureSurfacePortalInteractionTracking, resolveSurfacePortalHost, isSurfacePortalMode, resolveSurfacePortalMount, resolveSurfacePortalBoundaryRect, resolveSurfacePortalMountRect, projectSurfacePortalPosition, projectSurfacePortalRect, __resetSurfacePortalScopeForTests, type SurfacePortalInteractionSnapshot, type SurfacePortalMode, type ResolvedSurfacePortalHost, type SurfacePortalBoundaryRect, type SurfacePortalRect, } from './dialogSurfaceScope';
|
|
1
|
+
export { DIALOG_SURFACE_HOST_ATTR, SURFACE_PORTAL_HOST_ATTR, SURFACE_PORTAL_LAYER_ATTR, DIALOG_SURFACE_BOUNDARY_ATTR, ensureSurfacePortalInteractionTracking, resolveSurfacePortalHost, isSurfacePortalMode, resolveSurfacePortalMount, resolveSurfacePortalBoundaryRect, resolveSurfacePortalMountRect, projectSurfacePortalPosition, projectSurfacePortalRect, __resetSurfacePortalScopeForTests, type SurfacePortalInteractionSnapshot, type SurfacePortalHostResolutionOptions, type SurfacePortalMode, type ResolvedSurfacePortalHost, type SurfacePortalBoundaryRect, type SurfacePortalRect, } from './dialogSurfaceScope';
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type WorkbenchContextMenuItem } from './WorkbenchContextMenu';
|
|
2
|
+
import type { WorkbenchState, WorkbenchContextMenuState, WorkbenchInteractionAdapter, WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
|
|
3
|
+
export type WorkbenchContextMenuItemsResolver = (context: Readonly<{
|
|
4
|
+
menu: WorkbenchContextMenuState;
|
|
5
|
+
items: readonly WorkbenchContextMenuItem[];
|
|
6
|
+
widgets: readonly WorkbenchWidgetItem[];
|
|
7
|
+
widget: WorkbenchWidgetItem | null;
|
|
8
|
+
closeMenu: () => void;
|
|
9
|
+
}>) => readonly WorkbenchContextMenuItem[];
|
|
2
10
|
export interface WorkbenchSurfaceApi {
|
|
3
11
|
ensureWidget: (type: WorkbenchWidgetType, options?: {
|
|
4
12
|
centerViewport?: boolean;
|
|
@@ -41,6 +49,7 @@ export interface WorkbenchSurfaceProps {
|
|
|
41
49
|
widgetDefinitions?: readonly WorkbenchWidgetDefinition[];
|
|
42
50
|
launcherWidgetTypes?: readonly WorkbenchWidgetType[];
|
|
43
51
|
interactionAdapter?: WorkbenchInteractionAdapter;
|
|
52
|
+
resolveContextMenuItems?: WorkbenchContextMenuItemsResolver;
|
|
44
53
|
onApiReady?: (api: WorkbenchSurfaceApi | null) => void;
|
|
45
54
|
onRequestDelete?: (widgetId: string) => void;
|
|
46
55
|
onLayoutInteractionStart?: () => void;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { use as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { clientToCanvasWorld as
|
|
4
|
-
import { WorkbenchCanvas as
|
|
5
|
-
import { WorkbenchContextMenu as
|
|
6
|
-
import { WorkbenchFilterBar as
|
|
7
|
-
import { WorkbenchHud as
|
|
8
|
-
import { WorkbenchLockButton as
|
|
9
|
-
import { installWorkbenchContextMenuDismissListeners as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { use as _, spread as B, mergeProps as q, insert as m, createComponent as u, Portal as N, addEventListener as z, template as A, delegateEvents as H } from "solid-js/web";
|
|
2
|
+
import { createSignal as M, createMemo as w, untrack as W, createEffect as v, onCleanup as h, Show as P } from "solid-js";
|
|
3
|
+
import { clientToCanvasWorld as X } from "../ui/canvasGeometry.js";
|
|
4
|
+
import { WorkbenchCanvas as $ } from "./WorkbenchCanvas.js";
|
|
5
|
+
import { WorkbenchContextMenu as V } from "./WorkbenchContextMenu.js";
|
|
6
|
+
import { WorkbenchFilterBar as Y } from "./WorkbenchFilterBar.js";
|
|
7
|
+
import { WorkbenchHud as K } from "./WorkbenchHud.js";
|
|
8
|
+
import { WorkbenchLockButton as U } from "./WorkbenchLockButton.js";
|
|
9
|
+
import { installWorkbenchContextMenuDismissListeners as Z } from "./workbenchContextMenuDismiss.js";
|
|
10
|
+
import { createContextMenuPosition as G, WORKBENCH_CONTEXT_MENU_WIDTH_PX as j, estimateContextMenuHeight as J } from "./workbenchHelpers.js";
|
|
11
|
+
import { useWorkbenchModel as Q } from "./useWorkbenchModel.js";
|
|
12
|
+
import { resolveWorkbenchInteractionAdapter as ee } from "./workbenchInteractionAdapter.js";
|
|
13
|
+
var te = /* @__PURE__ */ A("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), ne = /* @__PURE__ */ A("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
|
|
14
|
+
const re = "F1";
|
|
15
|
+
function x(i) {
|
|
15
16
|
if (i)
|
|
16
17
|
try {
|
|
17
18
|
i.focus({
|
|
@@ -21,186 +22,205 @@ function I(i) {
|
|
|
21
22
|
i.focus();
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
const t =
|
|
25
|
+
function he(i) {
|
|
26
|
+
const t = Q({
|
|
26
27
|
state: () => i.state(),
|
|
27
28
|
setState: (e) => i.setState(e),
|
|
28
29
|
widgetDefinitions: () => i.widgetDefinitions,
|
|
29
30
|
onClose: () => {
|
|
30
31
|
}
|
|
31
|
-
}), [
|
|
32
|
+
}), [d, E] = M(null), s = w(() => ee(i.interactionAdapter)), [p, l] = M(W(() => s().createInitialInputOwner())), k = w(() => {
|
|
32
33
|
const e = i.launcherWidgetTypes;
|
|
33
34
|
return !e || e.length <= 0 ? null : new Set(e);
|
|
34
35
|
}), D = w(() => {
|
|
35
|
-
const e = t.widgetDefinitions(),
|
|
36
|
-
return
|
|
37
|
-
}),
|
|
38
|
-
const e = t.contextMenu.items(), r =
|
|
39
|
-
|
|
40
|
-
if (n.kind !== "action")
|
|
36
|
+
const e = t.widgetDefinitions(), n = k();
|
|
37
|
+
return n ? e.filter((r) => n.has(r.type)) : e;
|
|
38
|
+
}), C = w(() => {
|
|
39
|
+
const e = t.contextMenu.state(), n = t.contextMenu.items(), r = k(), o = r ? n.filter((c) => {
|
|
40
|
+
if (c.kind !== "action")
|
|
41
41
|
return !0;
|
|
42
|
-
const
|
|
43
|
-
return
|
|
44
|
-
}) :
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
const f = /^add-(.+)$/.exec(String(c.id ?? ""));
|
|
43
|
+
return f ? r.has(f[1]) : !0;
|
|
44
|
+
}) : n;
|
|
45
|
+
if (!e || !i.resolveContextMenuItems)
|
|
46
|
+
return o;
|
|
47
|
+
const a = e.widgetId ? t.queries.findWidgetById(e.widgetId) : null;
|
|
48
|
+
return i.resolveContextMenuItems({
|
|
49
|
+
menu: e,
|
|
50
|
+
items: o,
|
|
51
|
+
widgets: t.widgets(),
|
|
52
|
+
widget: a,
|
|
53
|
+
closeMenu: t.contextMenu.close
|
|
54
|
+
});
|
|
55
|
+
}), b = w(() => {
|
|
56
|
+
const e = t.contextMenu.state();
|
|
57
|
+
if (!e) return;
|
|
58
|
+
const n = C(), r = n.filter((a) => a.kind === "action").length, o = n.filter((a) => a.kind === "separator").length;
|
|
59
|
+
return G({
|
|
60
|
+
clientX: e.clientX,
|
|
61
|
+
clientY: e.clientY,
|
|
62
|
+
menuWidth: j,
|
|
63
|
+
menuHeight: J(r, o)
|
|
64
|
+
});
|
|
65
|
+
}), I = (e, n, r) => {
|
|
66
|
+
const o = s(), a = o.findWidgetRoot(e), c = o.readWidgetId(a);
|
|
67
|
+
if (c) {
|
|
68
|
+
l(o.createWidgetInputOwner(c, n));
|
|
49
69
|
return;
|
|
50
70
|
}
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
const
|
|
55
|
-
t.selection.clear(), l(
|
|
56
|
-
if (!
|
|
71
|
+
const f = d();
|
|
72
|
+
f && e instanceof Node && f.contains(e) && l(o.createCanvasInputOwner(r));
|
|
73
|
+
}, y = (e = "selection_cleared") => {
|
|
74
|
+
const n = s(), r = d();
|
|
75
|
+
t.selection.clear(), l(n.createCanvasInputOwner(e)), queueMicrotask(() => {
|
|
76
|
+
if (!r || typeof document > "u") return;
|
|
57
77
|
const o = document.activeElement;
|
|
58
|
-
if (!(o instanceof HTMLElement) || !
|
|
59
|
-
|
|
78
|
+
if (!(o instanceof HTMLElement) || !r.contains(o)) {
|
|
79
|
+
x(r);
|
|
60
80
|
return;
|
|
61
81
|
}
|
|
62
|
-
const
|
|
63
|
-
|
|
82
|
+
const a = n.findWidgetRoot(o);
|
|
83
|
+
x(r), a && document.activeElement === o && o.isConnected && o.blur();
|
|
64
84
|
});
|
|
65
85
|
}, R = () => {
|
|
66
|
-
const e =
|
|
86
|
+
const e = d()?.querySelector('[data-floe-workbench-canvas-frame="true"]'), n = t.viewport(), r = e?.getBoundingClientRect(), o = r?.width ?? 0, a = r?.height ?? 0;
|
|
67
87
|
return {
|
|
68
|
-
worldX: o > 0 ? (o / 2 -
|
|
69
|
-
worldY:
|
|
88
|
+
worldX: o > 0 ? (o / 2 - n.x) / n.scale : 240,
|
|
89
|
+
worldY: a > 0 ? (a / 2 - n.y) / n.scale : 180
|
|
70
90
|
};
|
|
71
91
|
}, g = (e) => {
|
|
72
|
-
const
|
|
92
|
+
const n = W(s), r = W(d);
|
|
73
93
|
queueMicrotask(() => {
|
|
74
|
-
|
|
94
|
+
n.focusWidgetElement(r, e), l(n.createWidgetInputOwner(e, "activation"));
|
|
75
95
|
});
|
|
76
|
-
},
|
|
77
|
-
const
|
|
78
|
-
g(
|
|
79
|
-
},
|
|
80
|
-
const
|
|
81
|
-
g(
|
|
96
|
+
}, O = (e) => {
|
|
97
|
+
const n = t.navigation.fitWidget(e);
|
|
98
|
+
g(n.id);
|
|
99
|
+
}, T = (e) => {
|
|
100
|
+
const n = t.navigation.overviewWidget(e);
|
|
101
|
+
g(n.id);
|
|
82
102
|
};
|
|
83
|
-
|
|
103
|
+
v(() => {
|
|
84
104
|
i.onApiReady?.({
|
|
85
|
-
ensureWidget: (e,
|
|
86
|
-
createWidget: (e,
|
|
87
|
-
const
|
|
88
|
-
return o &&
|
|
89
|
-
},
|
|
90
|
-
clearSelection: () =>
|
|
91
|
-
focusWidget: (e,
|
|
92
|
-
const
|
|
93
|
-
return g(
|
|
105
|
+
ensureWidget: (e, n) => t.widgetActions.ensureWidget(e, n) ?? null,
|
|
106
|
+
createWidget: (e, n) => {
|
|
107
|
+
const r = R(), o = t.widgetActions.addWidgetAtCursor(e, n?.worldX ?? r.worldX, n?.worldY ?? r.worldY) ?? null;
|
|
108
|
+
return o && n?.centerViewport !== !1 && t.navigation.centerOnWidget(o), o;
|
|
109
|
+
},
|
|
110
|
+
clearSelection: () => y("selection_cleared"),
|
|
111
|
+
focusWidget: (e, n) => {
|
|
112
|
+
const r = t.navigation.focusWidget(e, n);
|
|
113
|
+
return g(r.id), r;
|
|
94
114
|
},
|
|
95
115
|
fitWidget: (e) => {
|
|
96
|
-
const
|
|
97
|
-
return g(
|
|
116
|
+
const n = t.navigation.fitWidget(e);
|
|
117
|
+
return g(n.id), n;
|
|
98
118
|
},
|
|
99
119
|
overviewWidget: (e) => {
|
|
100
|
-
const
|
|
101
|
-
return g(
|
|
120
|
+
const n = t.navigation.overviewWidget(e);
|
|
121
|
+
return g(n.id), n;
|
|
102
122
|
},
|
|
103
123
|
findWidgetByType: (e) => t.queries.findWidgetByType(e),
|
|
104
124
|
findWidgetById: (e) => t.queries.findWidgetById(e),
|
|
105
|
-
updateWidgetTitle: (e,
|
|
106
|
-
const
|
|
107
|
-
!
|
|
108
|
-
...
|
|
109
|
-
widgets:
|
|
110
|
-
...
|
|
125
|
+
updateWidgetTitle: (e, n) => {
|
|
126
|
+
const r = String(e ?? "").trim(), o = String(n ?? "").trim();
|
|
127
|
+
!r || !o || i.setState((a) => ({
|
|
128
|
+
...a,
|
|
129
|
+
widgets: a.widgets.map((c) => c.id === r && c.title !== o ? {
|
|
130
|
+
...c,
|
|
111
131
|
title: o
|
|
112
|
-
} :
|
|
132
|
+
} : c)
|
|
113
133
|
}));
|
|
114
134
|
}
|
|
115
|
-
}),
|
|
135
|
+
}), h(() => {
|
|
116
136
|
i.onApiReady?.(null);
|
|
117
137
|
});
|
|
118
138
|
});
|
|
119
|
-
const
|
|
120
|
-
|
|
139
|
+
const S = () => i.lockShortcut === void 0 ? re : i.lockShortcut;
|
|
140
|
+
v(() => {
|
|
121
141
|
if (typeof window > "u" || !t.contextMenu.state()) return;
|
|
122
|
-
const e =
|
|
142
|
+
const e = Z({
|
|
123
143
|
ownerWindow: window,
|
|
124
144
|
onDismiss: t.contextMenu.close
|
|
125
145
|
});
|
|
126
|
-
|
|
127
|
-
}),
|
|
146
|
+
h(() => e());
|
|
147
|
+
}), v(() => {
|
|
128
148
|
const e = p();
|
|
129
149
|
if (e.kind !== "widget") return;
|
|
130
|
-
t.widgets().some((
|
|
131
|
-
}),
|
|
132
|
-
const e =
|
|
150
|
+
t.widgets().some((r) => r.id === e.widgetId) || l(s().createCanvasInputOwner("widget_removed"));
|
|
151
|
+
}), v(() => {
|
|
152
|
+
const e = d();
|
|
133
153
|
if (!e) return;
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
|
|
154
|
+
const n = (o) => {
|
|
155
|
+
I(o.target, "pointer", "background_pointer");
|
|
156
|
+
}, r = (o) => {
|
|
157
|
+
I(o.target, "focus", "background_focus");
|
|
138
158
|
};
|
|
139
|
-
e.addEventListener("pointerdown",
|
|
140
|
-
e.removeEventListener("pointerdown",
|
|
159
|
+
e.addEventListener("pointerdown", n, !0), e.addEventListener("focusin", r), h(() => {
|
|
160
|
+
e.removeEventListener("pointerdown", n, !0), e.removeEventListener("focusin", r);
|
|
141
161
|
});
|
|
142
|
-
}),
|
|
162
|
+
}), v(() => {
|
|
143
163
|
if (i.enableKeyboard === !1 || typeof document > "u") return;
|
|
144
|
-
const e =
|
|
145
|
-
if (!(
|
|
146
|
-
if (e !== null &&
|
|
147
|
-
|
|
164
|
+
const e = S(), n = (r) => {
|
|
165
|
+
if (!(r.defaultPrevented || r.isComposing)) {
|
|
166
|
+
if (e !== null && r.key === e) {
|
|
167
|
+
r.preventDefault(), t.lock.toggle();
|
|
148
168
|
return;
|
|
149
169
|
}
|
|
150
|
-
if (!
|
|
151
|
-
root:
|
|
152
|
-
target:
|
|
170
|
+
if (!s().shouldBypassGlobalHotkeys({
|
|
171
|
+
root: d(),
|
|
172
|
+
target: r.target,
|
|
153
173
|
owner: p(),
|
|
154
|
-
interactiveSelector:
|
|
174
|
+
interactiveSelector: s().interactiveSelector
|
|
155
175
|
}))
|
|
156
|
-
switch (
|
|
176
|
+
switch (r.key) {
|
|
157
177
|
case "ArrowUp":
|
|
158
|
-
|
|
178
|
+
r.preventDefault(), t.navigation.handleArrowNavigation("up");
|
|
159
179
|
break;
|
|
160
180
|
case "ArrowDown":
|
|
161
|
-
|
|
181
|
+
r.preventDefault(), t.navigation.handleArrowNavigation("down");
|
|
162
182
|
break;
|
|
163
183
|
case "ArrowLeft":
|
|
164
|
-
|
|
184
|
+
r.preventDefault(), t.navigation.handleArrowNavigation("left");
|
|
165
185
|
break;
|
|
166
186
|
case "ArrowRight":
|
|
167
|
-
|
|
187
|
+
r.preventDefault(), t.navigation.handleArrowNavigation("right");
|
|
168
188
|
break;
|
|
169
189
|
case "Delete":
|
|
170
190
|
case "Backspace":
|
|
171
|
-
t.selectedWidgetId() && (
|
|
191
|
+
t.selectedWidgetId() && (r.preventDefault(), t.widgetActions.deleteSelected());
|
|
172
192
|
break;
|
|
173
193
|
}
|
|
174
194
|
}
|
|
175
195
|
};
|
|
176
|
-
document.addEventListener("keydown",
|
|
196
|
+
document.addEventListener("keydown", n, !0), h(() => document.removeEventListener("keydown", n, !0));
|
|
177
197
|
});
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
if (!
|
|
181
|
-
const o =
|
|
182
|
-
return
|
|
198
|
+
const L = (e, n) => {
|
|
199
|
+
const r = d()?.querySelector('[data-floe-workbench-canvas-frame="true"]');
|
|
200
|
+
if (!r) return null;
|
|
201
|
+
const o = r.getBoundingClientRect();
|
|
202
|
+
return X(o, t.viewport(), {
|
|
183
203
|
clientX: e,
|
|
184
|
-
clientY:
|
|
204
|
+
clientY: n
|
|
185
205
|
});
|
|
186
|
-
},
|
|
187
|
-
const o =
|
|
206
|
+
}, F = (e, n, r) => {
|
|
207
|
+
const o = L(n, r);
|
|
188
208
|
o && t.widgetActions.addWidgetAtCursor(e, o.worldX, o.worldY);
|
|
189
209
|
};
|
|
190
210
|
return (() => {
|
|
191
|
-
var e =
|
|
192
|
-
return
|
|
211
|
+
var e = ne(), n = e.firstChild;
|
|
212
|
+
return _(E, e), B(e, q({
|
|
193
213
|
get class() {
|
|
194
214
|
return `workbench-surface${i.class ? ` ${i.class}` : ""}`;
|
|
195
215
|
}
|
|
196
216
|
}, () => ({
|
|
197
|
-
[
|
|
217
|
+
[s().surfaceRootAttr]: "true"
|
|
198
218
|
}), {
|
|
199
219
|
get "data-workbench-theme"() {
|
|
200
220
|
return t.theme();
|
|
201
221
|
},
|
|
202
222
|
tabIndex: -1
|
|
203
|
-
}), !1, !0),
|
|
223
|
+
}), !1, !0), m(n, u($, {
|
|
204
224
|
get widgetDefinitions() {
|
|
205
225
|
return t.widgetDefinitions();
|
|
206
226
|
},
|
|
@@ -226,7 +246,7 @@ function ge(i) {
|
|
|
226
246
|
return t.filters();
|
|
227
247
|
},
|
|
228
248
|
get interactionAdapter() {
|
|
229
|
-
return
|
|
249
|
+
return s();
|
|
230
250
|
},
|
|
231
251
|
get setCanvasFrameRef() {
|
|
232
252
|
return t.setCanvasFrameRef;
|
|
@@ -240,7 +260,7 @@ function ge(i) {
|
|
|
240
260
|
get onCanvasContextMenu() {
|
|
241
261
|
return t.canvas.openCanvasContextMenu;
|
|
242
262
|
},
|
|
243
|
-
onCanvasPointerDown: () =>
|
|
263
|
+
onCanvasPointerDown: () => y("background_pointer"),
|
|
244
264
|
get onSelectWidget() {
|
|
245
265
|
return t.canvas.selectWidget;
|
|
246
266
|
},
|
|
@@ -259,8 +279,8 @@ function ge(i) {
|
|
|
259
279
|
get onCommitResize() {
|
|
260
280
|
return t.canvas.commitResize;
|
|
261
281
|
},
|
|
262
|
-
onRequestOverview:
|
|
263
|
-
onRequestFit:
|
|
282
|
+
onRequestOverview: T,
|
|
283
|
+
onRequestFit: O,
|
|
264
284
|
get onRequestDelete() {
|
|
265
285
|
return i.onRequestDelete ?? t.widgetActions.deleteWidget;
|
|
266
286
|
},
|
|
@@ -270,7 +290,7 @@ function ge(i) {
|
|
|
270
290
|
get onLayoutInteractionEnd() {
|
|
271
291
|
return i.onLayoutInteractionEnd;
|
|
272
292
|
}
|
|
273
|
-
})),
|
|
293
|
+
})), m(e, u(U, {
|
|
274
294
|
get locked() {
|
|
275
295
|
return t.locked();
|
|
276
296
|
},
|
|
@@ -278,9 +298,9 @@ function ge(i) {
|
|
|
278
298
|
return t.lock.toggle;
|
|
279
299
|
},
|
|
280
300
|
get shortcutLabel() {
|
|
281
|
-
return
|
|
301
|
+
return S() ?? void 0;
|
|
282
302
|
}
|
|
283
|
-
}), null),
|
|
303
|
+
}), null), m(e, u(Y, {
|
|
284
304
|
get widgetDefinitions() {
|
|
285
305
|
return D();
|
|
286
306
|
},
|
|
@@ -296,8 +316,8 @@ function ge(i) {
|
|
|
296
316
|
get onShowAll() {
|
|
297
317
|
return t.filter.showAll;
|
|
298
318
|
},
|
|
299
|
-
onCreateAt:
|
|
300
|
-
}), null),
|
|
319
|
+
onCreateAt: F
|
|
320
|
+
}), null), m(e, u(K, {
|
|
301
321
|
get scaleLabel() {
|
|
302
322
|
return t.scaleLabel();
|
|
303
323
|
},
|
|
@@ -310,26 +330,26 @@ function ge(i) {
|
|
|
310
330
|
get activeTheme() {
|
|
311
331
|
return t.theme();
|
|
312
332
|
},
|
|
313
|
-
onSelectTheme: (
|
|
314
|
-
}), null),
|
|
333
|
+
onSelectTheme: (r) => t.appearance.setTheme(r)
|
|
334
|
+
}), null), m(e, u(P, {
|
|
315
335
|
get when() {
|
|
316
336
|
return t.contextMenu.state();
|
|
317
337
|
},
|
|
318
338
|
get children() {
|
|
319
|
-
return u(
|
|
339
|
+
return u(N, {
|
|
320
340
|
get children() {
|
|
321
341
|
return [(() => {
|
|
322
|
-
var
|
|
323
|
-
return z(
|
|
324
|
-
})(), u(
|
|
342
|
+
var r = te();
|
|
343
|
+
return z(r, "contextmenu", t.contextMenu.retarget, !0), r;
|
|
344
|
+
})(), u(V, {
|
|
325
345
|
get x() {
|
|
326
|
-
return
|
|
346
|
+
return b()?.left ?? 0;
|
|
327
347
|
},
|
|
328
348
|
get y() {
|
|
329
|
-
return
|
|
349
|
+
return b()?.top ?? 0;
|
|
330
350
|
},
|
|
331
351
|
get items() {
|
|
332
|
-
return
|
|
352
|
+
return C();
|
|
333
353
|
}
|
|
334
354
|
})];
|
|
335
355
|
}
|
|
@@ -338,7 +358,7 @@ function ge(i) {
|
|
|
338
358
|
}), null), e;
|
|
339
359
|
})();
|
|
340
360
|
}
|
|
341
|
-
|
|
361
|
+
H(["contextmenu"]);
|
|
342
362
|
export {
|
|
343
|
-
|
|
363
|
+
he as WorkbenchSurface
|
|
344
364
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { WorkbenchOverlay, type WorkbenchOverlayProps, } from './WorkbenchOverlay';
|
|
2
|
-
export { WorkbenchSurface, type WorkbenchSurfaceApi, type WorkbenchSurfaceProps, } from './WorkbenchSurface';
|
|
2
|
+
export { WorkbenchSurface, type WorkbenchSurfaceApi, type WorkbenchContextMenuItemsResolver, type WorkbenchSurfaceProps, } from './WorkbenchSurface';
|
|
3
3
|
export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchContextMenuProps, } from './WorkbenchContextMenu';
|
|
4
4
|
export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
|
|
5
5
|
export { WIDGET_REGISTRY, createWorkbenchFilterState, getWidgetEntry, isValidWorkbenchWidgetType, resolveWorkbenchWidgetDefinitions, type WidgetRegistryEntry, } from './widgets/widgetRegistry';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSignal as A, createMemo as r, onCleanup as Ct } from "solid-js";
|
|
2
2
|
import { ArrowUp as bt, Copy as kt, Trash as Ft } from "../icons/index.js";
|
|
3
|
-
import { getTopZIndex as It, createContextMenuPosition as Mt, createWorkbenchId as vt, createWorkbenchViewportCenteredOnWidget as K, findNearestWidget as Xt,
|
|
3
|
+
import { getTopZIndex as It, createContextMenuPosition as Mt, createWorkbenchId as vt, createWorkbenchViewportCenteredOnWidget as K, findNearestWidget as Xt, WORKBENCH_CONTEXT_MENU_WIDTH_PX as Yt, estimateContextMenuHeight as yt, clampScale as Ot, WORKBENCH_CANVAS_ZOOM_STEP as L, WORKBENCH_MIN_SCALE as _t, createWorkbenchViewportFitForWidget as zt } from "./workbenchHelpers.js";
|
|
4
4
|
import { resolveWorkbenchWidgetDefinitions as Tt, getWidgetEntry as j, createWorkbenchFilterState as Vt } from "./widgets/widgetRegistry.js";
|
|
5
5
|
function Kt(c) {
|
|
6
6
|
const [x, S] = A(null), [U, N] = A(null), [D, G] = A({ width: 0, height: 0 });
|
|
@@ -107,8 +107,8 @@ function Kt(c) {
|
|
|
107
107
|
return Mt({
|
|
108
108
|
clientX: t.clientX,
|
|
109
109
|
clientY: t.clientY,
|
|
110
|
-
menuWidth:
|
|
111
|
-
menuHeight:
|
|
110
|
+
menuWidth: Yt,
|
|
111
|
+
menuHeight: yt(n, i)
|
|
112
112
|
});
|
|
113
113
|
}), v = (t, e, n) => {
|
|
114
114
|
const i = j(t, w()), o = i.singleton ? C(t) : null;
|
|
@@ -167,7 +167,7 @@ function Kt(c) {
|
|
|
167
167
|
}, y = (t) => {
|
|
168
168
|
c.setState((e) => ({ ...e, viewport: t }));
|
|
169
169
|
}, q = (t) => {
|
|
170
|
-
const e = h(), n = a(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, s =
|
|
170
|
+
const e = h(), n = a(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, s = Ot(
|
|
171
171
|
t === "in" ? e.scale * L : e.scale / L
|
|
172
172
|
), u = {
|
|
173
173
|
x: n.width / 2 - i * s,
|
|
@@ -232,7 +232,7 @@ function Kt(c) {
|
|
|
232
232
|
}));
|
|
233
233
|
}, Wt = (t) => {
|
|
234
234
|
const e = a();
|
|
235
|
-
e.width === 0 || e.height === 0 || _(
|
|
235
|
+
e.width === 0 || e.height === 0 || _(zt({
|
|
236
236
|
widget: t,
|
|
237
237
|
frameWidth: e.width,
|
|
238
238
|
frameHeight: e.height
|
|
@@ -241,7 +241,7 @@ function Kt(c) {
|
|
|
241
241
|
const e = a();
|
|
242
242
|
e.width === 0 || e.height === 0 || _(K({
|
|
243
243
|
widget: t,
|
|
244
|
-
scale:
|
|
244
|
+
scale: _t,
|
|
245
245
|
frameWidth: e.width,
|
|
246
246
|
frameHeight: e.height
|
|
247
247
|
}));
|