@floegence/floe-webapp-core 0.36.2 → 0.36.4
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 +67 -62
- package/dist/components/ui/InfiniteCanvas.js +80 -77
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/localInteractionSurface.d.ts +19 -0
- package/dist/components/ui/localInteractionSurface.js +33 -0
- package/dist/components/workbench/WorkbenchCanvas.d.ts +0 -1
- package/dist/components/workbench/WorkbenchCanvas.js +6 -9
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +0 -1
- package/dist/components/workbench/WorkbenchCanvasField.js +60 -61
- package/dist/components/workbench/WorkbenchSurface.js +6 -9
- package/dist/components/workbench/WorkbenchWidget.d.ts +2 -2
- package/dist/components/workbench/WorkbenchWidget.js +144 -130
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/components/workbench/workbenchHelpers.d.ts +5 -0
- package/dist/components/workbench/workbenchHelpers.js +85 -72
- package/dist/full.js +517 -509
- package/dist/styles.css +1 -1
- package/dist/ui.js +95 -87
- package/dist/workbench.css +1 -0
- package/dist/workbench.js +12 -11
- package/package.json +1 -1
|
@@ -1,127 +1,132 @@
|
|
|
1
|
-
import { createComponent as n, Portal as
|
|
2
|
-
import { createUniqueId as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { createComponent as n, Portal as R, setAttribute as s, spread as v, mergeProps as C, memo as T, insert as l, effect as A, template as c, use as E } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as S, createMemo as p, Show as u } from "solid-js";
|
|
3
|
+
import { cn as x } from "../../utils/cn.js";
|
|
4
4
|
import { Button as $ } from "./Button.js";
|
|
5
|
-
import { X as
|
|
6
|
-
import { useResolvedFloeConfig as
|
|
7
|
-
import { useOverlayMask as
|
|
8
|
-
import { resolveDialogSurfaceHost as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import { X as z } from "../icons/index.js";
|
|
6
|
+
import { useResolvedFloeConfig as F } from "../../context/FloeConfigContext.js";
|
|
7
|
+
import { useOverlayMask as M } from "../../hooks/useOverlayMask.js";
|
|
8
|
+
import { resolveDialogSurfaceHost as N, DIALOG_SURFACE_BOUNDARY_ATTR as g } from "./dialogSurfaceScope.js";
|
|
9
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as U } from "./localInteractionSurface.js";
|
|
10
|
+
var j = /* @__PURE__ */ c('<h2 class="text-sm font-semibold">'), H = /* @__PURE__ */ c('<p class="mt-0.5 text-xs text-muted-foreground">'), L = /* @__PURE__ */ c('<div class="flex items-start justify-between p-3 border-b border-border"><div>'), P = /* @__PURE__ */ c('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), W = /* @__PURE__ */ c('<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">'), q = /* @__PURE__ */ c("<div>");
|
|
11
|
+
function G(e) {
|
|
12
|
+
const o = S(), _ = () => `dialog-${o}-title`, w = () => `dialog-${o}-description`;
|
|
13
|
+
let m;
|
|
14
|
+
const h = p(() => e.open ? N() : {
|
|
14
15
|
host: null,
|
|
15
16
|
mode: "global"
|
|
16
|
-
}),
|
|
17
|
-
return
|
|
17
|
+
}), f = () => `dialog-boundary-${o}`, t = () => h().mode === "surface" && !!h().host?.isConnected, I = () => h().host ?? void 0, B = (r) => typeof Element < "u" && r instanceof Element ? !!r.closest(`[${g}="${f()}"]`) : typeof Node < "u" && r instanceof Node ? !!r.parentElement?.closest(`[${g}="${f()}"]`) : !1;
|
|
18
|
+
return M({
|
|
18
19
|
open: () => e.open,
|
|
19
|
-
root: () =>
|
|
20
|
-
containsTarget: (
|
|
20
|
+
root: () => m,
|
|
21
|
+
containsTarget: (r) => t() && B(r),
|
|
21
22
|
onClose: () => e.onOpenChange(!1),
|
|
22
|
-
lockBodyScroll: () => !
|
|
23
|
+
lockBodyScroll: () => !t(),
|
|
23
24
|
trapFocus: !0,
|
|
24
|
-
closeOnEscape: () =>
|
|
25
|
+
closeOnEscape: () => t() ? "inside" : !0,
|
|
25
26
|
blockHotkeys: !0,
|
|
26
27
|
// Block scroll bleed outside the dialog while keeping the dialog content scrollable.
|
|
27
|
-
blockWheel: () =>
|
|
28
|
-
blockTouchMove: () =>
|
|
28
|
+
blockWheel: () => t() ? "none" : "outside",
|
|
29
|
+
blockTouchMove: () => t() ? "none" : "outside",
|
|
29
30
|
restoreFocus: !0
|
|
30
|
-
}), n(
|
|
31
|
+
}), n(u, {
|
|
31
32
|
get when() {
|
|
32
33
|
return e.open;
|
|
33
34
|
},
|
|
34
35
|
get children() {
|
|
35
|
-
return n(
|
|
36
|
+
return n(R, {
|
|
36
37
|
get mount() {
|
|
37
38
|
return I();
|
|
38
39
|
},
|
|
39
40
|
get children() {
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
var r = W(), b = r.firstChild, D = b.nextSibling, i = D.firstChild, y = i.firstChild;
|
|
42
|
+
s(r, "data-floe-dialog-overlay-root", o), v(r, C({
|
|
43
|
+
get "data-floe-dialog-mode"() {
|
|
44
|
+
return t() ? "surface" : "global";
|
|
45
|
+
}
|
|
46
|
+
}, () => ({
|
|
47
|
+
[U]: t() ? "true" : void 0
|
|
48
|
+
}), {
|
|
49
|
+
get class() {
|
|
50
|
+
return x(t() ? "absolute inset-0 z-20 p-3" : "fixed inset-0 z-50 p-4");
|
|
51
|
+
}
|
|
52
|
+
}), !1, !0), s(b, "data-floe-dialog-backdrop", o), v(b, C(() => ({
|
|
53
|
+
[g]: f()
|
|
43
54
|
}), {
|
|
44
55
|
get class() {
|
|
45
|
-
return
|
|
56
|
+
return x("absolute inset-0 cursor-pointer animate-in fade-in", t() ? "bg-background/72 backdrop-blur-[2px]" : "bg-background/80 backdrop-blur-sm");
|
|
46
57
|
},
|
|
47
58
|
onClick: () => e.onOpenChange(!1)
|
|
48
59
|
}), !1, !1);
|
|
49
|
-
var k =
|
|
50
|
-
return typeof k == "function" ? E(k,
|
|
51
|
-
[
|
|
60
|
+
var k = m;
|
|
61
|
+
return typeof k == "function" ? E(k, i) : m = i, s(i, "data-floe-dialog-panel", o), v(i, C(() => ({
|
|
62
|
+
[g]: f()
|
|
52
63
|
}), {
|
|
53
64
|
get class() {
|
|
54
|
-
return
|
|
65
|
+
return x(t() ? "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);
|
|
55
66
|
},
|
|
56
67
|
role: "dialog",
|
|
57
68
|
get "aria-modal"() {
|
|
58
|
-
return
|
|
69
|
+
return t() ? void 0 : "true";
|
|
59
70
|
},
|
|
60
71
|
get "aria-labelledby"() {
|
|
61
|
-
return
|
|
72
|
+
return T(() => !!e.title)() ? _() : void 0;
|
|
62
73
|
},
|
|
63
74
|
get "aria-describedby"() {
|
|
64
|
-
return
|
|
75
|
+
return T(() => !!e.description)() ? w() : void 0;
|
|
65
76
|
},
|
|
66
77
|
tabIndex: -1
|
|
67
|
-
}), !1, !0),
|
|
78
|
+
}), !1, !0), l(i, n(u, {
|
|
68
79
|
get when() {
|
|
69
80
|
return e.title || e.description;
|
|
70
81
|
},
|
|
71
82
|
get children() {
|
|
72
|
-
var
|
|
73
|
-
return
|
|
83
|
+
var d = L(), O = d.firstChild;
|
|
84
|
+
return l(O, n(u, {
|
|
74
85
|
get when() {
|
|
75
86
|
return e.title;
|
|
76
87
|
},
|
|
77
88
|
get children() {
|
|
78
|
-
var
|
|
79
|
-
return a
|
|
89
|
+
var a = j();
|
|
90
|
+
return l(a, () => e.title), A(() => s(a, "id", _())), a;
|
|
80
91
|
}
|
|
81
|
-
}), null),
|
|
92
|
+
}), null), l(O, n(u, {
|
|
82
93
|
get when() {
|
|
83
94
|
return e.description;
|
|
84
95
|
},
|
|
85
96
|
get children() {
|
|
86
|
-
var
|
|
87
|
-
return a
|
|
97
|
+
var a = H();
|
|
98
|
+
return l(a, () => e.description), A(() => s(a, "id", w())), a;
|
|
88
99
|
}
|
|
89
|
-
}), null),
|
|
100
|
+
}), null), l(d, n($, {
|
|
90
101
|
variant: "ghost-destructive",
|
|
91
102
|
size: "icon",
|
|
92
103
|
class: "h-6 w-6 -mr-1",
|
|
93
104
|
onClick: () => e.onOpenChange(!1),
|
|
94
105
|
"aria-label": "Close",
|
|
95
106
|
get children() {
|
|
96
|
-
return n(
|
|
107
|
+
return n(z, {
|
|
97
108
|
class: "w-3.5 h-3.5"
|
|
98
109
|
});
|
|
99
110
|
}
|
|
100
|
-
}), null),
|
|
111
|
+
}), null), d;
|
|
101
112
|
}
|
|
102
|
-
}), y),
|
|
113
|
+
}), y), l(y, () => e.children), l(i, n(u, {
|
|
103
114
|
get when() {
|
|
104
115
|
return e.footer;
|
|
105
116
|
},
|
|
106
117
|
get children() {
|
|
107
|
-
var
|
|
108
|
-
return
|
|
118
|
+
var d = P();
|
|
119
|
+
return l(d, () => e.footer), d;
|
|
109
120
|
}
|
|
110
|
-
}), null),
|
|
111
|
-
var u = o() ? "surface" : "global", l = C(o() ? "absolute inset-0 z-20 p-3" : "fixed inset-0 z-50 p-4");
|
|
112
|
-
return u !== r.e && c(t, "data-floe-dialog-mode", r.e = u), l !== r.t && A(t, r.t = l), r;
|
|
113
|
-
}, {
|
|
114
|
-
e: void 0,
|
|
115
|
-
t: void 0
|
|
116
|
-
}), t;
|
|
121
|
+
}), null), r;
|
|
117
122
|
}
|
|
118
123
|
});
|
|
119
124
|
}
|
|
120
125
|
});
|
|
121
126
|
}
|
|
122
|
-
function
|
|
123
|
-
const
|
|
124
|
-
return n(
|
|
127
|
+
function re(e) {
|
|
128
|
+
const o = F();
|
|
129
|
+
return n(G, {
|
|
125
130
|
get open() {
|
|
126
131
|
return e.open;
|
|
127
132
|
},
|
|
@@ -142,7 +147,7 @@ function te(e) {
|
|
|
142
147
|
return e.loading;
|
|
143
148
|
},
|
|
144
149
|
get children() {
|
|
145
|
-
return e.cancelText ??
|
|
150
|
+
return e.cancelText ?? o.config.strings.confirmDialog.cancel;
|
|
146
151
|
}
|
|
147
152
|
}), n($, {
|
|
148
153
|
get variant() {
|
|
@@ -155,16 +160,16 @@ function te(e) {
|
|
|
155
160
|
return e.loading;
|
|
156
161
|
},
|
|
157
162
|
get children() {
|
|
158
|
-
return e.confirmText ??
|
|
163
|
+
return e.confirmText ?? o.config.strings.confirmDialog.confirm;
|
|
159
164
|
}
|
|
160
165
|
})];
|
|
161
166
|
},
|
|
162
167
|
get children() {
|
|
163
|
-
return e.children ??
|
|
168
|
+
return e.children ?? q();
|
|
164
169
|
}
|
|
165
170
|
});
|
|
166
171
|
}
|
|
167
172
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
re as ConfirmDialog,
|
|
174
|
+
G as Dialog
|
|
170
175
|
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
var ne = /* @__PURE__ */
|
|
7
|
-
const re = 1,
|
|
8
|
-
function le(n,
|
|
9
|
-
return Math.max(
|
|
1
|
+
import { insert as j, effect as q, className as I, setAttribute as G, setStyleProperty as J, template as K, use as Q, delegateEvents as ee } from "solid-js/web";
|
|
2
|
+
import { createSignal as T, untrack as L, createEffect as _, onCleanup as b } from "solid-js";
|
|
3
|
+
import { cn as D } from "../../utils/cn.js";
|
|
4
|
+
import { startHotInteraction as Y } from "../../utils/hotInteraction.js";
|
|
5
|
+
import { resolveSurfaceInteractionTargetRole as te } from "./localInteractionSurface.js";
|
|
6
|
+
var ne = /* @__PURE__ */ K('<div><div style="transform-origin:0 0">');
|
|
7
|
+
const re = 1, oe = 0.45, ae = 2.2, ie = 14e-4, ce = '[data-floe-canvas-pan-surface="true"]', y = 3;
|
|
8
|
+
function le(n, i, d) {
|
|
9
|
+
return Math.max(i, Math.min(d, n));
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function A(n) {
|
|
12
12
|
return {
|
|
13
13
|
x: Number.isFinite(n.x) ? n.x : 0,
|
|
14
14
|
y: Number.isFinite(n.y) ? n.y : 0,
|
|
15
15
|
scale: Number.isFinite(n.scale) && n.scale > 0 ? n.scale : re
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function se(n,
|
|
19
|
-
return n.deltaMode === 1 ? n.deltaY * 16 : n.deltaMode === 2 ? n.deltaY * (
|
|
18
|
+
function se(n, i) {
|
|
19
|
+
return n.deltaMode === 1 ? n.deltaY * 16 : n.deltaMode === 2 ? n.deltaY * (i?.clientHeight ?? window.innerHeight) : n.deltaY;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const [
|
|
23
|
-
let
|
|
24
|
-
const
|
|
21
|
+
function ve(n) {
|
|
22
|
+
const [i, d] = T(L(() => A(n.viewport))), [p, w] = T(null);
|
|
23
|
+
let a, f, m = !1, l;
|
|
24
|
+
const M = () => n.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', X = () => n.panSurfaceSelector ?? ce, R = () => n.minScale ?? oe, F = () => n.maxScale ?? ae, k = () => n.wheelZoomSpeed ?? ie, $ = () => {
|
|
25
25
|
const e = p();
|
|
26
26
|
return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
|
|
27
|
-
}, v = () => {
|
|
28
|
-
f !== void 0 && (window.clearTimeout(f), f = void 0);
|
|
29
27
|
}, C = () => {
|
|
28
|
+
f !== void 0 && (window.clearTimeout(f), f = void 0);
|
|
29
|
+
}, g = () => {
|
|
30
30
|
m = !1, l !== void 0 && (window.clearTimeout(l), l = void 0);
|
|
31
|
-
},
|
|
31
|
+
}, V = () => {
|
|
32
32
|
if (typeof window > "u") {
|
|
33
33
|
m = !1;
|
|
34
34
|
return;
|
|
@@ -38,113 +38,116 @@ function we(n) {
|
|
|
38
38
|
}, 0);
|
|
39
39
|
}, h = (e) => {
|
|
40
40
|
L(() => n.onViewportChange?.(e));
|
|
41
|
-
},
|
|
41
|
+
}, N = (e) => {
|
|
42
42
|
if (typeof window > "u") {
|
|
43
43
|
h(e);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
C(), f = window.setTimeout(() => {
|
|
47
47
|
f = void 0, h(e);
|
|
48
48
|
}, 90);
|
|
49
|
-
},
|
|
49
|
+
}, v = (e) => te({
|
|
50
|
+
target: e,
|
|
51
|
+
interactiveSelector: M(),
|
|
52
|
+
panSurfaceSelector: X()
|
|
53
|
+
}), P = (e) => {
|
|
50
54
|
const t = p();
|
|
51
55
|
if (!t || e !== void 0 && t.pointerId !== e) return;
|
|
52
56
|
t.stopInteraction?.();
|
|
53
|
-
const r =
|
|
54
|
-
|
|
57
|
+
const r = i();
|
|
58
|
+
w(null), a && a.hasPointerCapture(t.pointerId) && a.releasePointerCapture(t.pointerId), t.startedFromPanSurface && t.moved && (m = !0, V()), h(r);
|
|
55
59
|
};
|
|
56
|
-
|
|
57
|
-
p() || d(
|
|
58
|
-
}),
|
|
59
|
-
const e =
|
|
60
|
+
_(() => {
|
|
61
|
+
p() || d(A(n.viewport));
|
|
62
|
+
}), _(() => {
|
|
63
|
+
const e = a;
|
|
60
64
|
if (!e) return;
|
|
61
65
|
const t = (r) => {
|
|
62
|
-
!m ||
|
|
66
|
+
!m || v(r.target) !== "pan_surface" || (g(), r.preventDefault(), r.stopPropagation());
|
|
63
67
|
};
|
|
64
68
|
e.addEventListener("click", t, !0), e.addEventListener("wheel", x, {
|
|
65
69
|
passive: !1
|
|
66
|
-
}),
|
|
70
|
+
}), b(() => {
|
|
67
71
|
e.removeEventListener("click", t, !0), e.removeEventListener("wheel", x);
|
|
68
72
|
});
|
|
69
|
-
}),
|
|
70
|
-
|
|
73
|
+
}), b(() => {
|
|
74
|
+
C(), P(), g();
|
|
71
75
|
});
|
|
72
|
-
const
|
|
73
|
-
if (e.button !== 0 ||
|
|
74
|
-
const t =
|
|
75
|
-
|
|
76
|
+
const U = (e) => {
|
|
77
|
+
if (e.button !== 0 || n.disablePanZoom) return;
|
|
78
|
+
const t = v(e.target), r = t === "pan_surface";
|
|
79
|
+
t !== "local_surface" && (C(), g(), r || (e.preventDefault(), a?.setPointerCapture(e.pointerId)), w({
|
|
76
80
|
pointerId: e.pointerId,
|
|
77
81
|
startClientX: e.clientX,
|
|
78
82
|
startClientY: e.clientY,
|
|
79
|
-
startViewport:
|
|
83
|
+
startViewport: i(),
|
|
80
84
|
moved: !1,
|
|
81
|
-
startedFromPanSurface:
|
|
82
|
-
stopInteraction:
|
|
85
|
+
startedFromPanSurface: r,
|
|
86
|
+
stopInteraction: r ? void 0 : Y({
|
|
83
87
|
kind: "drag",
|
|
84
88
|
cursor: "grabbing"
|
|
85
89
|
})
|
|
86
90
|
}));
|
|
87
|
-
},
|
|
91
|
+
}, H = (e) => {
|
|
88
92
|
const t = p();
|
|
89
93
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
90
|
-
const r = e.clientX - t.startClientX,
|
|
91
|
-
if (!(t.moved || Math.abs(r) >
|
|
92
|
-
t.moved || (e.preventDefault(),
|
|
93
|
-
const
|
|
94
|
+
const r = e.clientX - t.startClientX, o = e.clientY - t.startClientY;
|
|
95
|
+
if (!(t.moved || Math.abs(r) > y || Math.abs(o) > y)) return;
|
|
96
|
+
t.moved || (e.preventDefault(), a?.hasPointerCapture(e.pointerId) || a?.setPointerCapture(e.pointerId));
|
|
97
|
+
const s = {
|
|
94
98
|
...t.startViewport,
|
|
95
99
|
x: t.startViewport.x + r,
|
|
96
|
-
y: t.startViewport.y +
|
|
100
|
+
y: t.startViewport.y + o
|
|
97
101
|
};
|
|
98
|
-
t.moved ||
|
|
102
|
+
t.moved || w({
|
|
99
103
|
...t,
|
|
100
104
|
moved: !0,
|
|
101
|
-
stopInteraction: t.stopInteraction ??
|
|
105
|
+
stopInteraction: t.stopInteraction ?? Y({
|
|
102
106
|
kind: "drag",
|
|
103
107
|
cursor: "grabbing"
|
|
104
108
|
})
|
|
105
|
-
}), d(
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
|
|
109
|
+
}), d(s);
|
|
110
|
+
}, Z = (e) => {
|
|
111
|
+
P(e.pointerId);
|
|
112
|
+
}, O = (e) => {
|
|
113
|
+
P(e.pointerId);
|
|
110
114
|
}, x = (e) => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
if (v(e.target) !== "canvas")
|
|
116
|
+
return;
|
|
117
|
+
const r = a?.getBoundingClientRect();
|
|
118
|
+
if (!r || n.disablePanZoom)
|
|
115
119
|
return;
|
|
116
|
-
}
|
|
117
120
|
e.preventDefault();
|
|
118
|
-
const
|
|
119
|
-
if (Math.abs(
|
|
120
|
-
const
|
|
121
|
-
x:
|
|
122
|
-
y:
|
|
123
|
-
scale:
|
|
121
|
+
const o = i(), c = e.clientX - r.left, s = e.clientY - r.top, S = se(e, a), u = le(o.scale * Math.exp(-S * k()), R(), F());
|
|
122
|
+
if (Math.abs(u - o.scale) < 1e-4) return;
|
|
123
|
+
const B = (c - o.x) / o.scale, z = (s - o.y) / o.scale, E = {
|
|
124
|
+
x: c - B * u,
|
|
125
|
+
y: s - z * u,
|
|
126
|
+
scale: u
|
|
124
127
|
};
|
|
125
|
-
d(
|
|
126
|
-
},
|
|
127
|
-
if (
|
|
128
|
-
const t =
|
|
128
|
+
d(E), N(E);
|
|
129
|
+
}, W = (e) => {
|
|
130
|
+
if (v(e.target) !== "canvas") return;
|
|
131
|
+
const t = a?.getBoundingClientRect();
|
|
129
132
|
if (!t) return;
|
|
130
133
|
e.preventDefault();
|
|
131
|
-
const r = e.clientX - t.left,
|
|
134
|
+
const r = e.clientX - t.left, o = e.clientY - t.top, c = i();
|
|
132
135
|
n.onCanvasContextMenu?.({
|
|
133
136
|
clientX: e.clientX,
|
|
134
137
|
clientY: e.clientY,
|
|
135
138
|
localX: r,
|
|
136
|
-
localY:
|
|
139
|
+
localY: o,
|
|
137
140
|
worldX: (r - c.x) / c.scale,
|
|
138
|
-
worldY: (
|
|
141
|
+
worldY: (o - c.y) / c.scale
|
|
139
142
|
});
|
|
140
143
|
};
|
|
141
144
|
return (() => {
|
|
142
145
|
var e = ne(), t = e.firstChild;
|
|
143
|
-
e.$$contextmenu =
|
|
144
|
-
var r =
|
|
145
|
-
return typeof r == "function" ?
|
|
146
|
-
var c =
|
|
147
|
-
return c !==
|
|
146
|
+
e.$$contextmenu = W, e.addEventListener("pointercancel", O), e.$$pointerup = Z, e.$$pointermove = H, e.$$pointerdown = U;
|
|
147
|
+
var r = a;
|
|
148
|
+
return typeof r == "function" ? Q(r, e) : a = e, j(t, () => n.children), q((o) => {
|
|
149
|
+
var c = D("floe-infinite-canvas", $() && "is-panning", n.disablePanZoom && "is-locked", n.class), s = n.ariaLabel ?? "Infinite canvas", S = D("floe-infinite-canvas__viewport", n.contentClass), u = `translate(${i().x}px, ${i().y}px) scale(${i().scale})`;
|
|
150
|
+
return c !== o.e && I(e, o.e = c), s !== o.t && G(e, "aria-label", o.t = s), S !== o.a && I(t, o.a = S), u !== o.o && J(t, "transform", o.o = u), o;
|
|
148
151
|
}, {
|
|
149
152
|
e: void 0,
|
|
150
153
|
t: void 0,
|
|
@@ -153,7 +156,7 @@ function we(n) {
|
|
|
153
156
|
}), e;
|
|
154
157
|
})();
|
|
155
158
|
}
|
|
156
|
-
|
|
159
|
+
ee(["pointerdown", "pointermove", "pointerup", "contextmenu"]);
|
|
157
160
|
export {
|
|
158
|
-
|
|
161
|
+
ve as InfiniteCanvas
|
|
159
162
|
};
|
|
@@ -7,6 +7,7 @@ export { Dropdown, Select, type DropdownProps, type DropdownItem, type SelectPro
|
|
|
7
7
|
export { Tooltip, type TooltipProps } from './Tooltip';
|
|
8
8
|
export { CommandPalette } from './CommandPalette';
|
|
9
9
|
export { InfiniteCanvas, type InfiniteCanvasProps, type InfiniteCanvasPoint, type InfiniteCanvasContextMenuEvent, } from './InfiniteCanvas';
|
|
10
|
+
export { LOCAL_INTERACTION_SURFACE_ATTR, DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR, WORKBENCH_WIDGET_SHELL_ATTR, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR, isLocalInteractionSurfaceTarget, resolveSurfaceInteractionTargetRole, resolveWorkbenchWidgetEventOwnership, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, } from './localInteractionSurface';
|
|
10
11
|
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Interactive3DCard, AnimatedBorderCard, NeonCard, MorphCard, type CardProps, type CardVariant, type CardHeaderProps, type CardTitleProps, type CardDescriptionProps, type CardContentProps, type CardFooterProps, type Interactive3DCardProps, type AnimatedBorderCardProps, type NeonCardProps, type MorphCardProps, } from './Card';
|
|
11
12
|
export { Tabs, TabPanel, type TabsProps, type TabPanelProps, type TabItem, type TabsFeatures, type TabsSlotClassNames, type TabsIndicatorMode, type TabsIndicatorColorToken, } from './Tabs';
|
|
12
13
|
export { DirectoryPicker, type DirectoryPickerProps } from './DirectoryPicker';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const LOCAL_INTERACTION_SURFACE_ATTR = "data-floe-local-interaction-surface";
|
|
2
|
+
export declare const DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR = "[data-floe-local-interaction-surface=\"true\"]";
|
|
3
|
+
export declare const WORKBENCH_WIDGET_SHELL_ATTR = "data-floe-workbench-widget-shell";
|
|
4
|
+
export declare const DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR = "[data-floe-workbench-widget-shell=\"true\"]";
|
|
5
|
+
export type SurfaceInteractionTargetRole = 'canvas' | 'local_surface' | 'pan_surface';
|
|
6
|
+
export type WorkbenchWidgetEventOwnership = 'outside_widget' | 'widget_local' | 'widget_shell';
|
|
7
|
+
export interface SurfaceInteractionRoutingOptions {
|
|
8
|
+
target: EventTarget | null;
|
|
9
|
+
interactiveSelector: string;
|
|
10
|
+
panSurfaceSelector: string;
|
|
11
|
+
localInteractionSurfaceSelector?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkbenchWidgetEventOwnershipOptions extends SurfaceInteractionRoutingOptions {
|
|
14
|
+
widgetRoot: Element | EventTarget | null;
|
|
15
|
+
shellSelector?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveSurfaceInteractionTargetRole(options: SurfaceInteractionRoutingOptions): SurfaceInteractionTargetRole;
|
|
18
|
+
export declare function isLocalInteractionSurfaceTarget(options: SurfaceInteractionRoutingOptions): boolean;
|
|
19
|
+
export declare function resolveWorkbenchWidgetEventOwnership(options: WorkbenchWidgetEventOwnershipOptions): WorkbenchWidgetEventOwnership;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isTypingElement as i } from "../../utils/dom.js";
|
|
2
|
+
const s = "data-floe-local-interaction-surface", u = `[${s}="true"]`, f = "data-floe-workbench-widget-shell", E = `[${f}="true"]`;
|
|
3
|
+
function o(e) {
|
|
4
|
+
return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
|
|
5
|
+
}
|
|
6
|
+
function a(e) {
|
|
7
|
+
const {
|
|
8
|
+
target: l,
|
|
9
|
+
interactiveSelector: c,
|
|
10
|
+
panSurfaceSelector: n,
|
|
11
|
+
localInteractionSurfaceSelector: t = u
|
|
12
|
+
} = e, r = l instanceof Element ? l : null;
|
|
13
|
+
return r ? r.closest(n) !== null ? "pan_surface" : i(r) || r.closest(c) !== null || r.closest(t) !== null ? "local_surface" : "canvas" : "canvas";
|
|
14
|
+
}
|
|
15
|
+
function d(e) {
|
|
16
|
+
return a(e) !== "canvas";
|
|
17
|
+
}
|
|
18
|
+
function T(e) {
|
|
19
|
+
const {
|
|
20
|
+
widgetRoot: l,
|
|
21
|
+
shellSelector: c = E
|
|
22
|
+
} = e, n = o(l), t = o(e.target);
|
|
23
|
+
return !n || !t || !n.contains(t) ? "outside_widget" : a(e) !== "canvas" ? "widget_local" : t === n || t.closest(c) !== null ? "widget_shell" : "widget_local";
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
u as DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR,
|
|
27
|
+
E as DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR,
|
|
28
|
+
s as LOCAL_INTERACTION_SURFACE_ATTR,
|
|
29
|
+
f as WORKBENCH_WIDGET_SHELL_ATTR,
|
|
30
|
+
d as isLocalInteractionSurfaceTarget,
|
|
31
|
+
a as resolveSurfaceInteractionTargetRole,
|
|
32
|
+
T as resolveWorkbenchWidgetEventOwnership
|
|
33
|
+
};
|
|
@@ -6,7 +6,6 @@ export interface WorkbenchCanvasProps {
|
|
|
6
6
|
viewport: WorkbenchViewport;
|
|
7
7
|
selectedWidgetId: string | null;
|
|
8
8
|
optimisticFrontWidgetId: string | null;
|
|
9
|
-
topZIndex: number;
|
|
10
9
|
locked: boolean;
|
|
11
10
|
filters: Record<WorkbenchWidgetType, boolean>;
|
|
12
11
|
setCanvasFrameRef: (el: HTMLDivElement | undefined) => void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { use as r, insert as o, createComponent as i, effect as a, template as g } from "solid-js/web";
|
|
2
2
|
import { WorkbenchCanvasField as c } from "./WorkbenchCanvasField.js";
|
|
3
|
-
import { InfiniteCanvas as
|
|
4
|
-
var
|
|
5
|
-
function
|
|
3
|
+
import { InfiniteCanvas as m } from "../ui/InfiniteCanvas.js";
|
|
4
|
+
var u = /* @__PURE__ */ g("<div class=workbench-canvas>");
|
|
5
|
+
function v(e) {
|
|
6
6
|
return (() => {
|
|
7
|
-
var t =
|
|
8
|
-
return typeof n == "function" ? r(n, t) : e.setCanvasFrameRef = t, o(t, i(
|
|
7
|
+
var t = u(), n = e.setCanvasFrameRef;
|
|
8
|
+
return typeof n == "function" ? r(n, t) : e.setCanvasFrameRef = t, o(t, i(m, {
|
|
9
9
|
ariaLabel: "Workbench canvas",
|
|
10
10
|
class: "workbench-canvas__infinite",
|
|
11
11
|
get viewport() {
|
|
@@ -34,9 +34,6 @@ function C(e) {
|
|
|
34
34
|
get optimisticFrontWidgetId() {
|
|
35
35
|
return e.optimisticFrontWidgetId;
|
|
36
36
|
},
|
|
37
|
-
get topZIndex() {
|
|
38
|
-
return e.topZIndex;
|
|
39
|
-
},
|
|
40
37
|
get viewportScale() {
|
|
41
38
|
return e.viewport.scale;
|
|
42
39
|
},
|
|
@@ -73,5 +70,5 @@ function C(e) {
|
|
|
73
70
|
})();
|
|
74
71
|
}
|
|
75
72
|
export {
|
|
76
|
-
|
|
73
|
+
v as WorkbenchCanvas
|
|
77
74
|
};
|
|
@@ -4,7 +4,6 @@ export interface WorkbenchCanvasFieldProps {
|
|
|
4
4
|
widgets: readonly WorkbenchWidgetItem[];
|
|
5
5
|
selectedWidgetId: string | null;
|
|
6
6
|
optimisticFrontWidgetId: string | null;
|
|
7
|
-
topZIndex: number;
|
|
8
7
|
viewportScale: number;
|
|
9
8
|
locked: boolean;
|
|
10
9
|
filters: Record<WorkbenchWidgetType, boolean>;
|