@floegence/floe-webapp-core 0.36.12 → 0.36.15
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/deck/DeckCell.js +46 -38
- package/dist/components/file-browser/FileContextMenu.js +265 -225
- package/dist/components/ui/Dialog.js +63 -53
- package/dist/components/ui/Dropdown.js +209 -169
- package/dist/components/ui/FloatingWindow.js +73 -69
- package/dist/components/ui/InfiniteCanvas.d.ts +1 -0
- package/dist/components/ui/InfiniteCanvas.js +123 -105
- package/dist/components/ui/canvasGeometry.d.ts +32 -0
- package/dist/components/ui/canvasGeometry.js +33 -0
- package/dist/components/ui/dialogSurfaceScope.d.ts +26 -1
- package/dist/components/ui/dialogSurfaceScope.js +132 -33
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/menuUtils.d.ts +21 -2
- package/dist/components/ui/menuUtils.js +73 -43
- package/dist/components/ui/surfacePortalScope.d.ts +1 -0
- package/dist/components/ui/surfacePortalTypes.d.ts +8 -0
- package/dist/components/workbench/WorkbenchCanvas.d.ts +1 -0
- package/dist/components/workbench/WorkbenchCanvas.js +11 -8
- package/dist/components/workbench/WorkbenchSurface.js +56 -55
- package/dist/components/workbench/useWorkbenchModel.d.ts +1 -0
- package/dist/components/workbench/useWorkbenchModel.js +67 -64
- package/dist/full.js +611 -591
- package/dist/styles.css +1 -1
- package/dist/ui.js +120 -100
- package/package.json +1 -1
|
@@ -1,163 +1,181 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createSignal as _, untrack as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { startHotInteraction as
|
|
5
|
-
import { resolveSurfaceInteractionTargetRole as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { spread as B, mergeProps as j, insert as T, effect as q, className as G, setStyleProperty as J, template as K, use as Q } from "solid-js/web";
|
|
2
|
+
import { createSignal as _, untrack as I, createEffect as L, onCleanup as A } from "solid-js";
|
|
3
|
+
import { cn as x } from "../../utils/cn.js";
|
|
4
|
+
import { startHotInteraction as D } from "../../utils/hotInteraction.js";
|
|
5
|
+
import { resolveSurfaceInteractionTargetRole as ee, resolveSurfaceWheelRouting as te, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as ne } from "./localInteractionSurface.js";
|
|
6
|
+
import { clientToCanvasLocal as Y, localToCanvasWorld as re, createViewportFromZoomAnchor as oe } from "./canvasGeometry.js";
|
|
7
|
+
import { SURFACE_PORTAL_LAYER_ATTR as ie } from "./dialogSurfaceScope.js";
|
|
8
|
+
var ae = /* @__PURE__ */ K('<div><div style="transform-origin:0 0">');
|
|
9
|
+
const ce = 1, le = 0.45, se = 2.2, ue = 14e-4, de = '[data-floe-canvas-pan-surface="true"]', R = 3;
|
|
10
|
+
function fe(t, i, u) {
|
|
11
|
+
return Math.max(i, Math.min(u, t));
|
|
10
12
|
}
|
|
11
|
-
function
|
|
13
|
+
function b(t) {
|
|
12
14
|
return {
|
|
13
|
-
x: Number.isFinite(
|
|
14
|
-
y: Number.isFinite(
|
|
15
|
-
scale: Number.isFinite(
|
|
15
|
+
x: Number.isFinite(t.x) ? t.x : 0,
|
|
16
|
+
y: Number.isFinite(t.y) ? t.y : 0,
|
|
17
|
+
scale: Number.isFinite(t.scale) && t.scale > 0 ? t.scale : ce
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
20
|
+
function me(t, i) {
|
|
21
|
+
return t.deltaMode === 1 ? t.deltaY * 16 : t.deltaMode === 2 ? t.deltaY * (i?.clientHeight ?? window.innerHeight) : t.deltaY;
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
const [
|
|
23
|
-
let
|
|
24
|
-
const
|
|
25
|
-
const e =
|
|
23
|
+
function Pe(t) {
|
|
24
|
+
const [i, u] = _(I(() => b(t.viewport))), [m, S] = _(null);
|
|
25
|
+
let a, d, f = !1, l;
|
|
26
|
+
const M = () => t.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', X = () => t.panSurfaceSelector ?? de, F = () => t.wheelInteractiveSelector ?? ne, V = () => t.minScale ?? le, y = () => t.maxScale ?? se, k = () => t.wheelZoomSpeed ?? ue, U = () => {
|
|
27
|
+
const e = m();
|
|
26
28
|
return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
+
}, w = () => {
|
|
30
|
+
d !== void 0 && (window.clearTimeout(d), d = void 0);
|
|
29
31
|
}, C = () => {
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
+
f = !1, l !== void 0 && (window.clearTimeout(l), l = void 0);
|
|
33
|
+
}, N = () => {
|
|
32
34
|
if (typeof window > "u") {
|
|
33
|
-
|
|
35
|
+
f = !1;
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
36
38
|
l !== void 0 && window.clearTimeout(l), l = window.setTimeout(() => {
|
|
37
|
-
l = void 0,
|
|
39
|
+
l = void 0, f = !1;
|
|
38
40
|
}, 0);
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
},
|
|
41
|
+
}, v = (e) => {
|
|
42
|
+
I(() => t.onViewportChange?.(e));
|
|
43
|
+
}, Z = (e) => {
|
|
42
44
|
if (typeof window > "u") {
|
|
43
|
-
|
|
45
|
+
v(e);
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
w(), d = window.setTimeout(() => {
|
|
49
|
+
d = void 0, v(e);
|
|
48
50
|
}, 90);
|
|
49
|
-
},
|
|
51
|
+
}, p = (e) => ee({
|
|
50
52
|
target: e,
|
|
51
|
-
interactiveSelector:
|
|
53
|
+
interactiveSelector: M(),
|
|
52
54
|
panSurfaceSelector: X()
|
|
53
|
-
}),
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
55
|
+
}), h = (e) => {
|
|
56
|
+
const n = m();
|
|
57
|
+
if (!n || e !== void 0 && n.pointerId !== e) return;
|
|
58
|
+
n.stopInteraction?.();
|
|
59
|
+
const r = i();
|
|
60
|
+
S(null), a && a.hasPointerCapture(n.pointerId) && a.releasePointerCapture(n.pointerId), n.startedFromPanSurface && n.moved && (f = !0, N()), v(r);
|
|
59
61
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}),
|
|
63
|
-
const e =
|
|
62
|
+
L(() => {
|
|
63
|
+
m() || u(b(t.viewport));
|
|
64
|
+
}), L(() => {
|
|
65
|
+
const e = a;
|
|
64
66
|
if (!e) return;
|
|
65
|
-
const
|
|
66
|
-
!
|
|
67
|
+
const n = (r) => {
|
|
68
|
+
!f || p(r.target) !== "pan_surface" || (C(), r.preventDefault(), r.stopPropagation());
|
|
67
69
|
};
|
|
68
|
-
e.addEventListener("click",
|
|
70
|
+
e.addEventListener("click", n, !0), e.addEventListener("wheel", g, {
|
|
69
71
|
passive: !1
|
|
70
72
|
}), A(() => {
|
|
71
|
-
e.removeEventListener("click",
|
|
73
|
+
e.removeEventListener("click", n, !0), e.removeEventListener("wheel", g);
|
|
72
74
|
});
|
|
73
75
|
}), A(() => {
|
|
74
|
-
|
|
76
|
+
w(), h(), C();
|
|
75
77
|
});
|
|
76
|
-
const
|
|
77
|
-
if (e.button !== 0 ||
|
|
78
|
-
const
|
|
79
|
-
|
|
78
|
+
const H = (e) => {
|
|
79
|
+
if (e.button !== 0 || t.disablePanZoom) return;
|
|
80
|
+
const n = p(e.target), r = n === "pan_surface";
|
|
81
|
+
n !== "local_surface" && (w(), C(), r || (t.onViewportInteractionStart?.("pan"), e.preventDefault(), a?.setPointerCapture(e.pointerId)), S({
|
|
80
82
|
pointerId: e.pointerId,
|
|
81
83
|
startClientX: e.clientX,
|
|
82
84
|
startClientY: e.clientY,
|
|
83
|
-
startViewport:
|
|
85
|
+
startViewport: i(),
|
|
84
86
|
moved: !1,
|
|
85
|
-
startedFromPanSurface:
|
|
86
|
-
stopInteraction:
|
|
87
|
+
startedFromPanSurface: r,
|
|
88
|
+
stopInteraction: r ? void 0 : D({
|
|
87
89
|
kind: "drag",
|
|
88
90
|
cursor: "grabbing"
|
|
89
91
|
})
|
|
90
92
|
}));
|
|
91
93
|
}, W = (e) => {
|
|
92
|
-
const
|
|
93
|
-
if (!
|
|
94
|
-
const
|
|
95
|
-
if (!(
|
|
96
|
-
|
|
94
|
+
const n = m();
|
|
95
|
+
if (!n || n.pointerId !== e.pointerId) return;
|
|
96
|
+
const r = e.clientX - n.startClientX, o = e.clientY - n.startClientY;
|
|
97
|
+
if (!(n.moved || Math.abs(r) > R || Math.abs(o) > R)) return;
|
|
98
|
+
n.moved || (e.preventDefault(), a?.hasPointerCapture(e.pointerId) || a?.setPointerCapture(e.pointerId));
|
|
97
99
|
const s = {
|
|
98
|
-
...
|
|
99
|
-
x:
|
|
100
|
-
y:
|
|
100
|
+
...n.startViewport,
|
|
101
|
+
x: n.startViewport.x + r,
|
|
102
|
+
y: n.startViewport.y + o
|
|
101
103
|
};
|
|
102
|
-
|
|
103
|
-
...
|
|
104
|
+
n.moved || S({
|
|
105
|
+
...n,
|
|
104
106
|
moved: !0,
|
|
105
|
-
stopInteraction:
|
|
107
|
+
stopInteraction: n.stopInteraction ?? D({
|
|
106
108
|
kind: "drag",
|
|
107
109
|
cursor: "grabbing"
|
|
108
110
|
})
|
|
109
|
-
}),
|
|
111
|
+
}), u(s);
|
|
110
112
|
}, O = (e) => {
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
113
|
+
h(e.pointerId);
|
|
114
|
+
}, $ = (e) => {
|
|
115
|
+
h(e.pointerId);
|
|
116
|
+
}, g = (e) => {
|
|
117
|
+
const n = a?.getBoundingClientRect();
|
|
118
|
+
if (!n || te({
|
|
117
119
|
target: e.target,
|
|
118
|
-
disablePanZoom: !!
|
|
120
|
+
disablePanZoom: !!t.disablePanZoom,
|
|
119
121
|
wheelInteractiveSelector: F()
|
|
120
122
|
}).kind !== "canvas_zoom") return;
|
|
123
|
+
e.preventDefault(), t.onViewportInteractionStart?.("wheel");
|
|
124
|
+
const o = i(), c = Y(n, {
|
|
125
|
+
clientX: e.clientX,
|
|
126
|
+
clientY: e.clientY
|
|
127
|
+
}), s = me(e, a), P = fe(o.scale * Math.exp(-s * k()), V(), y());
|
|
128
|
+
if (Math.abs(P - o.scale) < 1e-4) return;
|
|
129
|
+
const E = oe({
|
|
130
|
+
viewport: o,
|
|
131
|
+
localPoint: c,
|
|
132
|
+
nextScale: P
|
|
133
|
+
});
|
|
134
|
+
u(E), Z(E);
|
|
135
|
+
}, z = (e) => {
|
|
136
|
+
if (p(e.target) !== "canvas") return;
|
|
137
|
+
const n = a?.getBoundingClientRect();
|
|
138
|
+
if (!n) return;
|
|
121
139
|
e.preventDefault();
|
|
122
|
-
const r =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
scale: u
|
|
128
|
-
};
|
|
129
|
-
d(I), H(I);
|
|
130
|
-
}, B = (e) => {
|
|
131
|
-
if (g(e.target) !== "canvas") return;
|
|
132
|
-
const t = i?.getBoundingClientRect();
|
|
133
|
-
if (!t) return;
|
|
134
|
-
e.preventDefault();
|
|
135
|
-
const o = e.clientX - t.left, r = e.clientY - t.top, c = a();
|
|
136
|
-
n.onCanvasContextMenu?.({
|
|
140
|
+
const r = Y(n, {
|
|
141
|
+
clientX: e.clientX,
|
|
142
|
+
clientY: e.clientY
|
|
143
|
+
}), o = i(), c = re(o, r);
|
|
144
|
+
t.onCanvasContextMenu?.({
|
|
137
145
|
clientX: e.clientX,
|
|
138
146
|
clientY: e.clientY,
|
|
139
|
-
localX:
|
|
140
|
-
localY: r,
|
|
141
|
-
worldX:
|
|
142
|
-
worldY:
|
|
147
|
+
localX: r.localX,
|
|
148
|
+
localY: r.localY,
|
|
149
|
+
worldX: c.worldX,
|
|
150
|
+
worldY: c.worldY
|
|
143
151
|
});
|
|
144
152
|
};
|
|
145
153
|
return (() => {
|
|
146
|
-
var e = ae(),
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
154
|
+
var e = ae(), n = e.firstChild, r = a;
|
|
155
|
+
return typeof r == "function" ? Q(r, e) : a = e, B(e, j({
|
|
156
|
+
get class() {
|
|
157
|
+
return x("floe-infinite-canvas", U() && "is-panning", t.disablePanZoom && "is-locked", t.class);
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
160
|
+
[ie]: "true"
|
|
161
|
+
}, {
|
|
162
|
+
onPointerDown: H,
|
|
163
|
+
onPointerMove: W,
|
|
164
|
+
onPointerUp: O,
|
|
165
|
+
onPointerCancel: $,
|
|
166
|
+
onContextMenu: z,
|
|
167
|
+
get "aria-label"() {
|
|
168
|
+
return t.ariaLabel ?? "Infinite canvas";
|
|
169
|
+
}
|
|
170
|
+
}), !1, !0), T(n, () => t.children), T(e, () => t.overlay?.(i()), null), q((o) => {
|
|
171
|
+
var c = x("floe-infinite-canvas__viewport", t.contentClass), s = `translate(${i().x}px, ${i().y}px) scale(${i().scale})`;
|
|
172
|
+
return c !== o.e && G(n, o.e = c), s !== o.t && J(n, "transform", o.t = s), o;
|
|
152
173
|
}, {
|
|
153
174
|
e: void 0,
|
|
154
|
-
t: void 0
|
|
155
|
-
a: void 0,
|
|
156
|
-
o: void 0
|
|
175
|
+
t: void 0
|
|
157
176
|
}), e;
|
|
158
177
|
})();
|
|
159
178
|
}
|
|
160
|
-
te(["pointerdown", "pointermove", "pointerup", "contextmenu"]);
|
|
161
179
|
export {
|
|
162
|
-
|
|
180
|
+
Pe as InfiniteCanvas
|
|
163
181
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface CanvasViewportLike {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
scale: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CanvasClientPoint {
|
|
7
|
+
clientX: number;
|
|
8
|
+
clientY: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CanvasLocalPoint {
|
|
11
|
+
localX: number;
|
|
12
|
+
localY: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CanvasWorldPoint {
|
|
15
|
+
worldX: number;
|
|
16
|
+
worldY: number;
|
|
17
|
+
}
|
|
18
|
+
export interface CanvasViewportRectLike {
|
|
19
|
+
left: number;
|
|
20
|
+
top: number;
|
|
21
|
+
right: number;
|
|
22
|
+
bottom: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function isPointInsideCanvasRect(rect: CanvasViewportRectLike, point: CanvasClientPoint): boolean;
|
|
25
|
+
export declare function clientToCanvasLocal(rect: Pick<CanvasViewportRectLike, 'left' | 'top'>, point: CanvasClientPoint): CanvasLocalPoint;
|
|
26
|
+
export declare function localToCanvasWorld(viewport: CanvasViewportLike, point: CanvasLocalPoint): CanvasWorldPoint;
|
|
27
|
+
export declare function clientToCanvasWorld(rect: CanvasViewportRectLike, viewport: CanvasViewportLike, point: CanvasClientPoint): CanvasWorldPoint | null;
|
|
28
|
+
export declare function createViewportFromZoomAnchor(options: {
|
|
29
|
+
viewport: CanvasViewportLike;
|
|
30
|
+
localPoint: CanvasLocalPoint;
|
|
31
|
+
nextScale: number;
|
|
32
|
+
}): CanvasViewportLike;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function e(l, c) {
|
|
2
|
+
return c.clientX >= l.left && c.clientX <= l.right && c.clientY >= l.top && c.clientY <= l.bottom;
|
|
3
|
+
}
|
|
4
|
+
function o(l, c) {
|
|
5
|
+
return {
|
|
6
|
+
localX: c.clientX - l.left,
|
|
7
|
+
localY: c.clientY - l.top
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function a(l, c) {
|
|
11
|
+
return {
|
|
12
|
+
worldX: (c.localX - l.x) / l.scale,
|
|
13
|
+
worldY: (c.localY - l.y) / l.scale
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function t(l, c, n) {
|
|
17
|
+
return e(l, n) ? a(c, o(l, n)) : null;
|
|
18
|
+
}
|
|
19
|
+
function r(l) {
|
|
20
|
+
const c = a(l.viewport, l.localPoint);
|
|
21
|
+
return {
|
|
22
|
+
x: l.localPoint.localX - c.worldX * l.nextScale,
|
|
23
|
+
y: l.localPoint.localY - c.worldY * l.nextScale,
|
|
24
|
+
scale: l.nextScale
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
o as clientToCanvasLocal,
|
|
29
|
+
t as clientToCanvasWorld,
|
|
30
|
+
r as createViewportFromZoomAnchor,
|
|
31
|
+
e as isPointInsideCanvasRect,
|
|
32
|
+
a as localToCanvasWorld
|
|
33
|
+
};
|
|
@@ -1,14 +1,39 @@
|
|
|
1
|
+
import type { SurfacePortalRect } from './surfacePortalTypes';
|
|
1
2
|
export declare const DIALOG_SURFACE_HOST_ATTR = "data-floe-dialog-surface-host";
|
|
3
|
+
export declare const SURFACE_PORTAL_HOST_ATTR = "data-floe-dialog-surface-host";
|
|
4
|
+
export declare const SURFACE_PORTAL_LAYER_ATTR = "data-floe-surface-portal-layer";
|
|
2
5
|
export declare const DIALOG_SURFACE_BOUNDARY_ATTR = "data-floe-dialog-surface-boundary";
|
|
3
6
|
export type DialogSurfaceInteractionSnapshot = Readonly<{
|
|
4
7
|
target: Element | null;
|
|
5
8
|
activeElement: Element | null;
|
|
6
9
|
recordedAt: number;
|
|
7
10
|
}>;
|
|
11
|
+
export type SurfacePortalInteractionSnapshot = DialogSurfaceInteractionSnapshot;
|
|
12
|
+
export type SurfacePortalMode = 'global' | 'surface';
|
|
8
13
|
export type ResolvedDialogSurfaceHost = Readonly<{
|
|
9
14
|
host: HTMLElement | null;
|
|
10
|
-
|
|
15
|
+
boundaryHost: HTMLElement | null;
|
|
16
|
+
mountHost: HTMLElement | null;
|
|
17
|
+
mode: SurfacePortalMode;
|
|
11
18
|
}>;
|
|
19
|
+
export type ResolvedSurfacePortalHost = ResolvedDialogSurfaceHost;
|
|
20
|
+
export type SurfacePortalBoundaryRect = SurfacePortalRect;
|
|
21
|
+
export type { SurfacePortalRect };
|
|
12
22
|
export declare function ensureDialogSurfaceInteractionTracking(): void;
|
|
23
|
+
export declare function ensureSurfacePortalInteractionTracking(): void;
|
|
13
24
|
export declare function resolveDialogSurfaceHost(): ResolvedDialogSurfaceHost;
|
|
25
|
+
export declare function resolveSurfacePortalHost(): ResolvedSurfacePortalHost;
|
|
26
|
+
export declare function isSurfacePortalMode(surfaceHost: ResolvedSurfacePortalHost): boolean;
|
|
27
|
+
export declare function resolveSurfacePortalMount(surfaceHost: ResolvedSurfacePortalHost): HTMLElement | undefined;
|
|
28
|
+
export declare function resolveSurfacePortalBoundaryRect(surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
|
|
29
|
+
export declare function resolveSurfacePortalMountRect(surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
|
|
30
|
+
export declare function projectSurfacePortalPosition(position: Readonly<{
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}>, surfaceHost: ResolvedSurfacePortalHost): Readonly<{
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function projectSurfacePortalRect(rect: SurfacePortalBoundaryRect, surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
|
|
14
38
|
export declare function __resetDialogSurfaceScopeForTests(): void;
|
|
39
|
+
export declare function __resetSurfacePortalScopeForTests(): void;
|
|
@@ -1,45 +1,144 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
function
|
|
4
|
-
return typeof Element < "u" &&
|
|
5
|
-
}
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
target:
|
|
14
|
-
activeElement:
|
|
1
|
+
const f = "data-floe-dialog-surface-host", y = f, m = "data-floe-surface-portal-layer", A = "data-floe-dialog-surface-boundary", p = 1600;
|
|
2
|
+
let r = null, o = null;
|
|
3
|
+
function g(t) {
|
|
4
|
+
return typeof Element < "u" && t instanceof Element ? t : typeof Node < "u" && t instanceof Node ? t.parentElement : null;
|
|
5
|
+
}
|
|
6
|
+
function E(t) {
|
|
7
|
+
const e = t?.activeElement;
|
|
8
|
+
return e instanceof Element ? e : null;
|
|
9
|
+
}
|
|
10
|
+
function d(t) {
|
|
11
|
+
const e = typeof document < "u" ? document : null;
|
|
12
|
+
r = {
|
|
13
|
+
target: g(t),
|
|
14
|
+
activeElement: E(e),
|
|
15
15
|
recordedAt: Date.now()
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function i(t) {
|
|
19
|
+
d(t.target);
|
|
20
|
+
}
|
|
21
|
+
function l(t) {
|
|
22
|
+
d(t.target);
|
|
23
|
+
}
|
|
24
|
+
function a() {
|
|
25
|
+
T();
|
|
26
|
+
}
|
|
27
|
+
function T() {
|
|
28
|
+
typeof document > "u" || o !== document && (o && (o.removeEventListener("pointerdown", i, !0), o.removeEventListener("focusin", l, !0)), document.addEventListener("pointerdown", i, !0), document.addEventListener("focusin", l, !0), o = document);
|
|
29
|
+
}
|
|
30
|
+
function w() {
|
|
31
|
+
return !r || Date.now() - r.recordedAt > p ? null : r;
|
|
32
|
+
}
|
|
33
|
+
function c(t) {
|
|
34
|
+
const e = t?.closest(`[${f}="true"]`);
|
|
35
|
+
return typeof HTMLElement > "u" ? null : e instanceof HTMLElement && e.isConnected ? e : null;
|
|
36
|
+
}
|
|
37
|
+
function R(t) {
|
|
38
|
+
if (!t) return null;
|
|
39
|
+
const e = t.closest(`[${m}="true"]`);
|
|
40
|
+
return typeof HTMLElement > "u" ? null : e instanceof HTMLElement && e.isConnected ? e : null;
|
|
41
|
+
}
|
|
42
|
+
function v() {
|
|
43
|
+
a();
|
|
44
|
+
const t = w(), e = c(t?.target ?? null) ?? c(t?.activeElement ?? null);
|
|
45
|
+
return e ? {
|
|
46
|
+
host: e,
|
|
47
|
+
boundaryHost: e,
|
|
48
|
+
mountHost: R(e) ?? e,
|
|
49
|
+
mode: "surface"
|
|
50
|
+
} : { host: null, boundaryHost: null, mountHost: null, mode: "global" };
|
|
20
51
|
}
|
|
21
|
-
function u(
|
|
22
|
-
|
|
52
|
+
function u(t) {
|
|
53
|
+
return t.mode === "surface" && !!t.boundaryHost?.isConnected;
|
|
23
54
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
55
|
+
function S(t) {
|
|
56
|
+
if (u(t))
|
|
57
|
+
return t.mountHost ?? t.boundaryHost ?? void 0;
|
|
26
58
|
}
|
|
27
59
|
function s() {
|
|
28
|
-
return
|
|
60
|
+
return typeof window > "u" ? {
|
|
61
|
+
left: 0,
|
|
62
|
+
top: 0,
|
|
63
|
+
right: 0,
|
|
64
|
+
bottom: 0,
|
|
65
|
+
width: 0,
|
|
66
|
+
height: 0
|
|
67
|
+
} : {
|
|
68
|
+
left: 0,
|
|
69
|
+
top: 0,
|
|
70
|
+
right: window.innerWidth,
|
|
71
|
+
bottom: window.innerHeight,
|
|
72
|
+
width: window.innerWidth,
|
|
73
|
+
height: window.innerHeight
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function _(t) {
|
|
77
|
+
if (!u(t) || !t.boundaryHost)
|
|
78
|
+
return s();
|
|
79
|
+
const e = t.boundaryHost.getBoundingClientRect();
|
|
80
|
+
return {
|
|
81
|
+
left: e.left,
|
|
82
|
+
top: e.top,
|
|
83
|
+
right: e.right,
|
|
84
|
+
bottom: e.bottom,
|
|
85
|
+
width: e.width,
|
|
86
|
+
height: e.height
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function h(t) {
|
|
90
|
+
const e = S(t);
|
|
91
|
+
if (!e)
|
|
92
|
+
return s();
|
|
93
|
+
const n = e.getBoundingClientRect();
|
|
94
|
+
return {
|
|
95
|
+
left: n.left,
|
|
96
|
+
top: n.top,
|
|
97
|
+
right: n.right,
|
|
98
|
+
bottom: n.bottom,
|
|
99
|
+
width: n.width,
|
|
100
|
+
height: n.height
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function b(t, e) {
|
|
104
|
+
if (!u(e))
|
|
105
|
+
return t;
|
|
106
|
+
const n = h(e);
|
|
107
|
+
return {
|
|
108
|
+
x: t.x - n.left,
|
|
109
|
+
y: t.y - n.top
|
|
110
|
+
};
|
|
29
111
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
112
|
+
function L(t, e) {
|
|
113
|
+
if (!u(e))
|
|
114
|
+
return t;
|
|
115
|
+
const n = h(e);
|
|
116
|
+
return {
|
|
117
|
+
left: t.left - n.left,
|
|
118
|
+
top: t.top - n.top,
|
|
119
|
+
right: t.right - n.left,
|
|
120
|
+
bottom: t.bottom - n.top,
|
|
121
|
+
width: t.width,
|
|
122
|
+
height: t.height
|
|
123
|
+
};
|
|
33
124
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
const e = s(), n = c(e?.target ?? null) ?? c(e?.activeElement ?? null);
|
|
37
|
-
return n ? { host: n, mode: "surface" } : { host: null, mode: "global" };
|
|
125
|
+
function P() {
|
|
126
|
+
r = null;
|
|
38
127
|
}
|
|
39
|
-
typeof document < "u" &&
|
|
128
|
+
typeof document < "u" && a();
|
|
40
129
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
130
|
+
A as DIALOG_SURFACE_BOUNDARY_ATTR,
|
|
131
|
+
f as DIALOG_SURFACE_HOST_ATTR,
|
|
132
|
+
y as SURFACE_PORTAL_HOST_ATTR,
|
|
133
|
+
m as SURFACE_PORTAL_LAYER_ATTR,
|
|
134
|
+
P as __resetSurfacePortalScopeForTests,
|
|
135
|
+
a as ensureDialogSurfaceInteractionTracking,
|
|
136
|
+
T as ensureSurfacePortalInteractionTracking,
|
|
137
|
+
u as isSurfacePortalMode,
|
|
138
|
+
b as projectSurfacePortalPosition,
|
|
139
|
+
L as projectSurfacePortalRect,
|
|
140
|
+
_ as resolveSurfacePortalBoundaryRect,
|
|
141
|
+
v as resolveSurfacePortalHost,
|
|
142
|
+
S as resolveSurfacePortalMount,
|
|
143
|
+
h as resolveSurfacePortalMountRect
|
|
45
144
|
};
|
|
@@ -7,7 +7,9 @@ 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 { clientToCanvasLocal, clientToCanvasWorld, createViewportFromZoomAnchor, isPointInsideCanvasRect, localToCanvasWorld, type CanvasClientPoint, type CanvasLocalPoint, type CanvasViewportLike, type CanvasViewportRectLike, type CanvasWorldPoint, } from './canvasGeometry';
|
|
10
11
|
export { CANVAS_WHEEL_INTERACTIVE_ATTR, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR, LOCAL_INTERACTION_SURFACE_ATTR, DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR, WORKBENCH_WIDGET_SHELL_ATTR, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR, isLocalInteractionSurfaceTarget, resolveSurfaceInteractionTargetRole, resolveSurfaceWheelRouting, resolveWorkbenchWidgetEventOwnership, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type SurfaceWheelLocalReason, type SurfaceWheelRoutingDecision, type SurfaceWheelRoutingOptions, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, } from './localInteractionSurface';
|
|
12
|
+
export { DIALOG_SURFACE_HOST_ATTR, SURFACE_PORTAL_HOST_ATTR, SURFACE_PORTAL_LAYER_ATTR, DIALOG_SURFACE_BOUNDARY_ATTR, ensureSurfacePortalInteractionTracking, isSurfacePortalMode, projectSurfacePortalPosition, projectSurfacePortalRect, resolveSurfacePortalBoundaryRect, resolveSurfacePortalHost, resolveSurfacePortalMount, resolveSurfacePortalMountRect, __resetSurfacePortalScopeForTests, type ResolvedSurfacePortalHost, type SurfacePortalBoundaryRect, type SurfacePortalInteractionSnapshot, type SurfacePortalMode, type SurfacePortalRect, } from './surfacePortalScope';
|
|
11
13
|
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';
|
|
12
14
|
export { Tabs, TabPanel, type TabsProps, type TabPanelProps, type TabItem, type TabsFeatures, type TabsSlotClassNames, type TabsIndicatorMode, type TabsIndicatorColorToken, } from './Tabs';
|
|
13
15
|
export { DirectoryPicker, type DirectoryPickerProps } from './DirectoryPicker';
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
export declare const VIEWPORT_MARGIN = 8;
|
|
2
2
|
export declare const MENU_ITEM_SELECTOR = "[role=\"menuitem\"]:not([disabled]):not([aria-disabled=\"true\"])";
|
|
3
|
+
export type MenuBoundaryRect = Readonly<{
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
right: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}>;
|
|
3
11
|
export type MenuFocusMode = 'first' | 'last' | 'selected';
|
|
4
|
-
export declare function
|
|
12
|
+
export declare function resolveViewportMenuBoundaryRect(): MenuBoundaryRect;
|
|
13
|
+
export declare function clampMenuPosition(anchor: Readonly<{
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}>, menuRect: Readonly<{
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
}>, boundaryRect?: MenuBoundaryRect): {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
export declare function calculateMenuPosition(triggerRect: DOMRect, menuRect: DOMRect, align: 'start' | 'center' | 'end', boundaryRect?: MenuBoundaryRect): {
|
|
5
24
|
x: number;
|
|
6
25
|
y: number;
|
|
7
26
|
};
|
|
8
|
-
export declare function calculateSubmenuPosition(parentRect: DOMRect, submenuRect: DOMRect): {
|
|
27
|
+
export declare function calculateSubmenuPosition(parentRect: DOMRect, submenuRect: DOMRect, boundaryRect?: MenuBoundaryRect): {
|
|
9
28
|
x: number;
|
|
10
29
|
y: number;
|
|
11
30
|
};
|