@floegence/floe-webapp-core 0.36.13 → 0.36.16

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.
Files changed (39) hide show
  1. package/dist/components/deck/DeckCell.js +46 -38
  2. package/dist/components/file-browser/FileContextMenu.js +8 -6
  3. package/dist/components/ui/Dialog.js +62 -52
  4. package/dist/components/ui/Dropdown.js +50 -48
  5. package/dist/components/ui/FloatingWindow.js +73 -69
  6. package/dist/components/ui/InfiniteCanvas.d.ts +2 -0
  7. package/dist/components/ui/InfiniteCanvas.js +121 -101
  8. package/dist/components/ui/canvasGeometry.d.ts +32 -0
  9. package/dist/components/ui/canvasGeometry.js +33 -0
  10. package/dist/components/ui/dialogSurfaceScope.d.ts +8 -8
  11. package/dist/components/ui/dialogSurfaceScope.js +108 -62
  12. package/dist/components/ui/index.d.ts +2 -0
  13. package/dist/components/ui/surfacePortalScope.d.ts +1 -1
  14. package/dist/components/ui/surfacePortalTypes.d.ts +8 -0
  15. package/dist/components/workbench/WorkbenchCanvas.d.ts +4 -0
  16. package/dist/components/workbench/WorkbenchCanvas.js +52 -26
  17. package/dist/components/workbench/WorkbenchCanvasField.d.ts +2 -0
  18. package/dist/components/workbench/WorkbenchCanvasField.js +18 -6
  19. package/dist/components/workbench/WorkbenchHud.d.ts +9 -0
  20. package/dist/components/workbench/WorkbenchHud.js +24 -10
  21. package/dist/components/workbench/WorkbenchSurface.js +56 -36
  22. package/dist/components/workbench/WorkbenchThemeSelector.d.ts +6 -0
  23. package/dist/components/workbench/WorkbenchThemeSelector.js +77 -0
  24. package/dist/components/workbench/WorkbenchWidget.d.ts +2 -0
  25. package/dist/components/workbench/WorkbenchWidget.js +205 -164
  26. package/dist/components/workbench/index.d.ts +2 -0
  27. package/dist/components/workbench/types.d.ts +2 -0
  28. package/dist/components/workbench/useWorkbenchModel.d.ts +6 -0
  29. package/dist/components/workbench/useWorkbenchModel.js +115 -106
  30. package/dist/components/workbench/workbenchHelpers.js +53 -50
  31. package/dist/components/workbench/workbenchThemes.d.ts +32 -0
  32. package/dist/components/workbench/workbenchThemes.js +82 -0
  33. package/dist/full.js +611 -591
  34. package/dist/styles.css +1 -1
  35. package/dist/ui.js +120 -100
  36. package/dist/workbench-themes.css +1106 -0
  37. package/dist/workbench.css +492 -96
  38. package/dist/workbench.js +35 -27
  39. package/package.json +1 -1
@@ -1,163 +1,183 @@
1
- import { insert as x, effect as G, className as T, setAttribute as J, setStyleProperty as K, template as Q, use as ee, delegateEvents as te } from "solid-js/web";
2
- import { createSignal as _, untrack as L, createEffect as b, onCleanup as A } from "solid-js";
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
3
  import { cn as D } from "../../utils/cn.js";
4
- import { startHotInteraction as y } from "../../utils/hotInteraction.js";
5
- import { resolveSurfaceInteractionTargetRole as ne, resolveSurfaceWheelRouting as re, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as oe } from "./localInteractionSurface.js";
6
- var ae = /* @__PURE__ */ Q('<div><div style="transform-origin:0 0">');
7
- const ie = 1, ce = 0.45, le = 2.2, se = 14e-4, ue = '[data-floe-canvas-pan-surface="true"]', Y = 3;
8
- function de(n, a, d) {
9
- return Math.max(a, Math.min(d, n));
4
+ import { startHotInteraction as x } 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 ae } from "./dialogSurfaceScope.js";
8
+ var ie = /* @__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, a, u) {
11
+ return Math.max(a, Math.min(u, t));
10
12
  }
11
- function M(n) {
13
+ function b(t) {
12
14
  return {
13
- x: Number.isFinite(n.x) ? n.x : 0,
14
- y: Number.isFinite(n.y) ? n.y : 0,
15
- scale: Number.isFinite(n.scale) && n.scale > 0 ? n.scale : ie
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 fe(n, a) {
19
- return n.deltaMode === 1 ? n.deltaY * 16 : n.deltaMode === 2 ? n.deltaY * (a?.clientHeight ?? window.innerHeight) : n.deltaY;
20
+ function me(t, a) {
21
+ return t.deltaMode === 1 ? t.deltaY * 16 : t.deltaMode === 2 ? t.deltaY * (a?.clientHeight ?? window.innerHeight) : t.deltaY;
20
22
  }
21
- function Ce(n) {
22
- const [a, d] = _(L(() => M(n.viewport))), [v, w] = _(null);
23
- let i, f, m = !1, l;
24
- const R = () => n.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', X = () => n.panSurfaceSelector ?? ue, F = () => n.wheelInteractiveSelector ?? oe, k = () => n.minScale ?? ce, V = () => n.maxScale ?? le, $ = () => n.wheelZoomSpeed ?? se, N = () => {
25
- const e = v();
23
+ function ge(t) {
24
+ const [a, u] = _(I(() => b(t.viewport))), [m, S] = _(null);
25
+ let i, 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
- }, p = () => {
28
- f !== void 0 && (window.clearTimeout(f), f = void 0);
29
+ }, w = () => {
30
+ d !== void 0 && (window.clearTimeout(d), d = void 0);
29
31
  }, C = () => {
30
- m = !1, l !== void 0 && (window.clearTimeout(l), l = void 0);
31
- }, U = () => {
32
+ f = !1, l !== void 0 && (window.clearTimeout(l), l = void 0);
33
+ }, N = () => {
32
34
  if (typeof window > "u") {
33
- m = !1;
35
+ f = !1;
34
36
  return;
35
37
  }
36
38
  l !== void 0 && window.clearTimeout(l), l = window.setTimeout(() => {
37
- l = void 0, m = !1;
39
+ l = void 0, f = !1;
38
40
  }, 0);
39
- }, h = (e) => {
40
- L(() => n.onViewportChange?.(e));
41
- }, H = (e) => {
41
+ }, v = (e) => {
42
+ I(() => t.onViewportChange?.(e));
43
+ }, Z = (e) => {
42
44
  if (typeof window > "u") {
43
- h(e);
45
+ v(e);
44
46
  return;
45
47
  }
46
- p(), f = window.setTimeout(() => {
47
- f = void 0, h(e);
48
+ w(), d = window.setTimeout(() => {
49
+ d = void 0, v(e);
48
50
  }, 90);
49
- }, g = (e) => ne({
51
+ }, h = (e) => ee({
50
52
  target: e,
51
- interactiveSelector: R(),
53
+ interactiveSelector: M(),
52
54
  panSurfaceSelector: X()
53
- }), E = (e) => {
54
- const t = v();
55
- if (!t || e !== void 0 && t.pointerId !== e) return;
56
- t.stopInteraction?.();
57
- const o = a();
58
- w(null), i && i.hasPointerCapture(t.pointerId) && i.releasePointerCapture(t.pointerId), t.startedFromPanSurface && t.moved && (m = !0, U()), h(o);
55
+ }), p = (e) => {
56
+ const n = m();
57
+ if (!n || e !== void 0 && n.pointerId !== e) return;
58
+ n.stopInteraction?.();
59
+ const r = a();
60
+ S(null), i && i.hasPointerCapture(n.pointerId) && i.releasePointerCapture(n.pointerId), n.startedFromPanSurface && n.moved && (f = !0, N()), v(r);
59
61
  };
60
- b(() => {
61
- v() || d(M(n.viewport));
62
- }), b(() => {
62
+ L(() => {
63
+ m() || u(b(t.viewport));
64
+ }), L(() => {
63
65
  const e = i;
64
66
  if (!e) return;
65
- const t = (o) => {
66
- !m || g(o.target) !== "pan_surface" || (C(), o.preventDefault(), o.stopPropagation());
67
+ const n = (r) => {
68
+ !f || h(r.target) !== "pan_surface" || (C(), r.preventDefault(), r.stopPropagation());
67
69
  };
68
- e.addEventListener("click", t, !0), e.addEventListener("wheel", P, {
70
+ e.addEventListener("click", n, !0), e.addEventListener("wheel", P, {
69
71
  passive: !1
70
72
  }), A(() => {
71
- e.removeEventListener("click", t, !0), e.removeEventListener("wheel", P);
73
+ e.removeEventListener("click", n, !0), e.removeEventListener("wheel", P);
72
74
  });
73
75
  }), A(() => {
74
- p(), E(), C();
76
+ w(), p(), C();
75
77
  });
76
- const Z = (e) => {
77
- if (e.button !== 0 || n.disablePanZoom) return;
78
- const t = g(e.target), o = t === "pan_surface";
79
- t !== "local_surface" && (p(), C(), o || (e.preventDefault(), i?.setPointerCapture(e.pointerId)), w({
78
+ const H = (e) => {
79
+ if (e.button !== 0) return;
80
+ const n = h(e.target);
81
+ if (n === "canvas" && t.onCanvasPointerDown?.(e), t.disablePanZoom) return;
82
+ const r = n === "pan_surface";
83
+ n !== "local_surface" && (w(), C(), r || (t.onViewportInteractionStart?.("pan"), e.preventDefault(), i?.setPointerCapture(e.pointerId)), S({
80
84
  pointerId: e.pointerId,
81
85
  startClientX: e.clientX,
82
86
  startClientY: e.clientY,
83
87
  startViewport: a(),
84
88
  moved: !1,
85
- startedFromPanSurface: o,
86
- stopInteraction: o ? void 0 : y({
89
+ startedFromPanSurface: r,
90
+ stopInteraction: r ? void 0 : x({
87
91
  kind: "drag",
88
92
  cursor: "grabbing"
89
93
  })
90
94
  }));
91
95
  }, W = (e) => {
92
- const t = v();
93
- if (!t || t.pointerId !== e.pointerId) return;
94
- const o = e.clientX - t.startClientX, r = e.clientY - t.startClientY;
95
- if (!(t.moved || Math.abs(o) > Y || Math.abs(r) > Y)) return;
96
- t.moved || (e.preventDefault(), i?.hasPointerCapture(e.pointerId) || i?.setPointerCapture(e.pointerId));
96
+ const n = m();
97
+ if (!n || n.pointerId !== e.pointerId) return;
98
+ const r = e.clientX - n.startClientX, o = e.clientY - n.startClientY;
99
+ if (!(n.moved || Math.abs(r) > R || Math.abs(o) > R)) return;
100
+ n.moved || (e.preventDefault(), i?.hasPointerCapture(e.pointerId) || i?.setPointerCapture(e.pointerId));
97
101
  const s = {
98
- ...t.startViewport,
99
- x: t.startViewport.x + o,
100
- y: t.startViewport.y + r
102
+ ...n.startViewport,
103
+ x: n.startViewport.x + r,
104
+ y: n.startViewport.y + o
101
105
  };
102
- t.moved || w({
103
- ...t,
106
+ n.moved || S({
107
+ ...n,
104
108
  moved: !0,
105
- stopInteraction: t.stopInteraction ?? y({
109
+ stopInteraction: n.stopInteraction ?? x({
106
110
  kind: "drag",
107
111
  cursor: "grabbing"
108
112
  })
109
- }), d(s);
113
+ }), u(s);
110
114
  }, O = (e) => {
111
- E(e.pointerId);
112
- }, z = (e) => {
113
- E(e.pointerId);
115
+ p(e.pointerId);
116
+ }, $ = (e) => {
117
+ p(e.pointerId);
114
118
  }, P = (e) => {
115
- const t = i?.getBoundingClientRect();
116
- if (!t || re({
119
+ const n = i?.getBoundingClientRect();
120
+ if (!n || te({
117
121
  target: e.target,
118
- disablePanZoom: !!n.disablePanZoom,
122
+ disablePanZoom: !!t.disablePanZoom,
119
123
  wheelInteractiveSelector: F()
120
124
  }).kind !== "canvas_zoom") return;
125
+ e.preventDefault(), t.onViewportInteractionStart?.("wheel");
126
+ const o = a(), c = Y(n, {
127
+ clientX: e.clientX,
128
+ clientY: e.clientY
129
+ }), s = me(e, i), g = fe(o.scale * Math.exp(-s * k()), V(), y());
130
+ if (Math.abs(g - o.scale) < 1e-4) return;
131
+ const E = oe({
132
+ viewport: o,
133
+ localPoint: c,
134
+ nextScale: g
135
+ });
136
+ u(E), Z(E);
137
+ }, z = (e) => {
138
+ if (h(e.target) !== "canvas") return;
139
+ const n = i?.getBoundingClientRect();
140
+ if (!n) return;
121
141
  e.preventDefault();
122
- const r = a(), c = e.clientX - t.left, s = e.clientY - t.top, S = fe(e, i), u = de(r.scale * Math.exp(-S * $()), k(), V());
123
- if (Math.abs(u - r.scale) < 1e-4) return;
124
- const j = (c - r.x) / r.scale, q = (s - r.y) / r.scale, I = {
125
- x: c - j * u,
126
- y: s - q * u,
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?.({
142
+ const r = Y(n, {
143
+ clientX: e.clientX,
144
+ clientY: e.clientY
145
+ }), o = a(), c = re(o, r);
146
+ t.onCanvasContextMenu?.({
137
147
  clientX: e.clientX,
138
148
  clientY: e.clientY,
139
- localX: o,
140
- localY: r,
141
- worldX: (o - c.x) / c.scale,
142
- worldY: (r - c.y) / c.scale
149
+ localX: r.localX,
150
+ localY: r.localY,
151
+ worldX: c.worldX,
152
+ worldY: c.worldY
143
153
  });
144
154
  };
145
155
  return (() => {
146
- var e = ae(), t = e.firstChild;
147
- e.$$contextmenu = B, e.addEventListener("pointercancel", z), e.$$pointerup = O, e.$$pointermove = W, e.$$pointerdown = Z;
148
- var o = i;
149
- return typeof o == "function" ? ee(o, e) : i = e, x(t, () => n.children), x(e, () => n.overlay?.(a()), null), G((r) => {
150
- var c = D("floe-infinite-canvas", N() && "is-panning", n.disablePanZoom && "is-locked", n.class), s = n.ariaLabel ?? "Infinite canvas", S = D("floe-infinite-canvas__viewport", n.contentClass), u = `translate(${a().x}px, ${a().y}px) scale(${a().scale})`;
151
- return c !== r.e && T(e, r.e = c), s !== r.t && J(e, "aria-label", r.t = s), S !== r.a && T(t, r.a = S), u !== r.o && K(t, "transform", r.o = u), r;
156
+ var e = ie(), n = e.firstChild, r = i;
157
+ return typeof r == "function" ? Q(r, e) : i = e, B(e, j({
158
+ get class() {
159
+ return D("floe-infinite-canvas", U() && "is-panning", t.disablePanZoom && "is-locked", t.class);
160
+ }
161
+ }, {
162
+ [ae]: "true"
163
+ }, {
164
+ onPointerDown: H,
165
+ onPointerMove: W,
166
+ onPointerUp: O,
167
+ onPointerCancel: $,
168
+ onContextMenu: z,
169
+ get "aria-label"() {
170
+ return t.ariaLabel ?? "Infinite canvas";
171
+ }
172
+ }), !1, !0), T(n, () => t.children), T(e, () => t.overlay?.(a()), null), q((o) => {
173
+ var c = D("floe-infinite-canvas__viewport", t.contentClass), s = `translate(${a().x}px, ${a().y}px) scale(${a().scale})`;
174
+ return c !== o.e && G(n, o.e = c), s !== o.t && J(n, "transform", o.t = s), o;
152
175
  }, {
153
176
  e: void 0,
154
- t: void 0,
155
- a: void 0,
156
- o: void 0
177
+ t: void 0
157
178
  }), e;
158
179
  })();
159
180
  }
160
- te(["pointerdown", "pointermove", "pointerup", "contextmenu"]);
161
181
  export {
162
- Ce as InfiniteCanvas
182
+ ge as InfiniteCanvas
163
183
  };
@@ -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,5 +1,7 @@
1
+ import type { SurfacePortalRect } from './surfacePortalTypes';
1
2
  export declare const DIALOG_SURFACE_HOST_ATTR = "data-floe-dialog-surface-host";
2
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";
3
5
  export declare const DIALOG_SURFACE_BOUNDARY_ATTR = "data-floe-dialog-surface-boundary";
4
6
  export type DialogSurfaceInteractionSnapshot = Readonly<{
5
7
  target: Element | null;
@@ -10,17 +12,13 @@ export type SurfacePortalInteractionSnapshot = DialogSurfaceInteractionSnapshot;
10
12
  export type SurfacePortalMode = 'global' | 'surface';
11
13
  export type ResolvedDialogSurfaceHost = Readonly<{
12
14
  host: HTMLElement | null;
15
+ boundaryHost: HTMLElement | null;
16
+ mountHost: HTMLElement | null;
13
17
  mode: SurfacePortalMode;
14
18
  }>;
15
19
  export type ResolvedSurfacePortalHost = ResolvedDialogSurfaceHost;
16
- export type SurfacePortalBoundaryRect = Readonly<{
17
- left: number;
18
- top: number;
19
- right: number;
20
- bottom: number;
21
- width: number;
22
- height: number;
23
- }>;
20
+ export type SurfacePortalBoundaryRect = SurfacePortalRect;
21
+ export type { SurfacePortalRect };
24
22
  export declare function ensureDialogSurfaceInteractionTracking(): void;
25
23
  export declare function ensureSurfacePortalInteractionTracking(): void;
26
24
  export declare function resolveDialogSurfaceHost(): ResolvedDialogSurfaceHost;
@@ -28,6 +26,7 @@ export declare function resolveSurfacePortalHost(): ResolvedSurfacePortalHost;
28
26
  export declare function isSurfacePortalMode(surfaceHost: ResolvedSurfacePortalHost): boolean;
29
27
  export declare function resolveSurfacePortalMount(surfaceHost: ResolvedSurfacePortalHost): HTMLElement | undefined;
30
28
  export declare function resolveSurfacePortalBoundaryRect(surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
29
+ export declare function resolveSurfacePortalMountRect(surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
31
30
  export declare function projectSurfacePortalPosition(position: Readonly<{
32
31
  x: number;
33
32
  y: number;
@@ -35,5 +34,6 @@ export declare function projectSurfacePortalPosition(position: Readonly<{
35
34
  x: number;
36
35
  y: number;
37
36
  }>;
37
+ export declare function projectSurfacePortalRect(rect: SurfacePortalBoundaryRect, surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
38
38
  export declare function __resetDialogSurfaceScopeForTests(): void;
39
39
  export declare function __resetSurfacePortalScopeForTests(): void;
@@ -1,51 +1,62 @@
1
- const a = "data-floe-dialog-surface-host", w = "data-floe-dialog-surface-boundary";
2
- let o = null, n = null;
3
- function s(e) {
4
- return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
5
- }
6
- function h(e) {
7
- const t = e?.activeElement;
8
- return t instanceof Element ? t : null;
9
- }
10
- function l(e) {
11
- const t = typeof document < "u" ? document : null;
12
- o = {
13
- target: s(e),
14
- activeElement: h(t),
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 u(e) {
19
- l(e.target);
18
+ function i(t) {
19
+ d(t.target);
20
20
  }
21
- function c(e) {
22
- l(e.target);
21
+ function l(t) {
22
+ d(t.target);
23
23
  }
24
- function f() {
25
- m();
24
+ function a() {
25
+ T();
26
26
  }
27
- function m() {
28
- typeof document > "u" || n !== document && (n && (n.removeEventListener("pointerdown", u, !0), n.removeEventListener("focusin", c, !0)), document.addEventListener("pointerdown", u, !0), document.addEventListener("focusin", c, !0), n = document);
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
29
  }
30
- function E() {
31
- return !o || Date.now() - o.recordedAt > 1600 ? null : o;
30
+ function w() {
31
+ return !r || Date.now() - r.recordedAt > p ? null : r;
32
32
  }
33
- function d(e) {
34
- const t = e?.closest(`[${a}="true"]`);
35
- return typeof HTMLElement > "u" ? null : t instanceof HTMLElement && t.isConnected ? t : null;
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
36
  }
37
- function T() {
38
- f();
39
- const e = E(), t = d(e?.target ?? null) ?? d(e?.activeElement ?? null);
40
- return t ? { host: t, mode: "surface" } : { host: null, mode: "global" };
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
41
  }
42
- function r(e) {
43
- return e.mode === "surface" && !!e.host?.isConnected;
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" };
44
51
  }
45
- function v(e) {
46
- return r(e) ? e.host ?? void 0 : void 0;
52
+ function u(t) {
53
+ return t.mode === "surface" && !!t.boundaryHost?.isConnected;
47
54
  }
48
- function p() {
55
+ function S(t) {
56
+ if (u(t))
57
+ return t.mountHost ?? t.boundaryHost ?? void 0;
58
+ }
59
+ function s() {
49
60
  return typeof window > "u" ? {
50
61
  left: 0,
51
62
  top: 0,
@@ -62,37 +73,72 @@ function p() {
62
73
  height: window.innerHeight
63
74
  };
64
75
  }
65
- function g(e) {
66
- if (!r(e) || !e.host)
67
- return p();
68
- const t = e.host.getBoundingClientRect();
76
+ function _(t) {
77
+ if (!u(t) || !t.boundaryHost)
78
+ return s();
79
+ const e = t.boundaryHost.getBoundingClientRect();
69
80
  return {
70
- left: t.left,
71
- top: t.top,
72
- right: t.right,
73
- bottom: t.bottom,
74
- width: t.width,
75
- height: t.height
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
76
110
  };
77
111
  }
78
- function S(e, t) {
79
- if (!r(t))
80
- return e;
81
- const i = g(t);
112
+ function L(t, e) {
113
+ if (!u(e))
114
+ return t;
115
+ const n = h(e);
82
116
  return {
83
- x: e.x - i.left,
84
- y: e.y - i.top
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
85
123
  };
86
124
  }
87
- typeof document < "u" && f();
125
+ function P() {
126
+ r = null;
127
+ }
128
+ typeof document < "u" && a();
88
129
  export {
89
- w as DIALOG_SURFACE_BOUNDARY_ATTR,
90
- a as DIALOG_SURFACE_HOST_ATTR,
91
- f as ensureDialogSurfaceInteractionTracking,
92
- m as ensureSurfacePortalInteractionTracking,
93
- r as isSurfacePortalMode,
94
- S as projectSurfacePortalPosition,
95
- g as resolveSurfacePortalBoundaryRect,
96
- T as resolveSurfacePortalHost,
97
- v as resolveSurfacePortalMount
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
98
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 +1 @@
1
- export { SURFACE_PORTAL_HOST_ATTR, ensureSurfacePortalInteractionTracking, resolveSurfacePortalHost, isSurfacePortalMode, resolveSurfacePortalMount, resolveSurfacePortalBoundaryRect, projectSurfacePortalPosition, __resetSurfacePortalScopeForTests, type SurfacePortalInteractionSnapshot, type SurfacePortalMode, type ResolvedSurfacePortalHost, type SurfacePortalBoundaryRect, } 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 SurfacePortalMode, type ResolvedSurfacePortalHost, type SurfacePortalBoundaryRect, type SurfacePortalRect, } from './dialogSurfaceScope';
@@ -0,0 +1,8 @@
1
+ export type SurfacePortalRect = Readonly<{
2
+ left: number;
3
+ top: number;
4
+ right: number;
5
+ bottom: number;
6
+ width: number;
7
+ height: number;
8
+ }>;
@@ -14,7 +14,9 @@ export interface WorkbenchCanvasProps {
14
14
  filters: Record<WorkbenchWidgetType, boolean>;
15
15
  setCanvasFrameRef: (el: HTMLDivElement | undefined) => void;
16
16
  onViewportCommit: (viewport: WorkbenchViewport) => void;
17
+ onViewportInteractionStart?: (kind: 'wheel' | 'pan') => void;
17
18
  onCanvasContextMenu: (event: InfiniteCanvasContextMenuEvent) => void;
19
+ onCanvasPointerDown?: (event: PointerEvent) => void;
18
20
  onSelectWidget: (widgetId: string) => void;
19
21
  onWidgetContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
20
22
  onStartOptimisticFront: (widgetId: string) => void;
@@ -27,6 +29,8 @@ export interface WorkbenchCanvasProps {
27
29
  width: number;
28
30
  height: number;
29
31
  }) => void;
32
+ onRequestOverview: (item: WorkbenchWidgetItem) => void;
33
+ onRequestFit: (item: WorkbenchWidgetItem) => void;
30
34
  onRequestDelete: (widgetId: string) => void;
31
35
  }
32
36
  export declare function WorkbenchCanvas(props: WorkbenchCanvasProps): import("solid-js").JSX.Element;