@floegence/floe-webapp-core 0.36.7 → 0.36.8

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.
@@ -1,11 +1,13 @@
1
1
  import { type JSX } from 'solid-js';
2
2
  import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
3
3
  import 'monaco-editor/min/vs/editor/editor.main.css';
4
+ import { type CodeEditorRuntimeOptions } from './monacoStandaloneRuntime';
4
5
  export interface CodeEditorProps {
5
6
  path: string;
6
7
  language?: string;
7
8
  value: string;
8
9
  options?: monaco.editor.IStandaloneEditorConstructionOptions;
10
+ runtimeOptions?: CodeEditorRuntimeOptions;
9
11
  class?: string;
10
12
  style?: JSX.CSSProperties;
11
13
  onReady?: (api: CodeEditorApi) => void;
@@ -1,11 +1,11 @@
1
- import { use as L, effect as D, className as F, style as O, template as V } from "solid-js/web";
2
- import { onMount as b, onCleanup as p, createEffect as g } from "solid-js";
3
- import { useTheme as q } from "../../context/ThemeContext.js";
4
- import { useResizeObserver as w } from "../../hooks/useResizeObserver.js";
1
+ import { use as L, effect as O, className as D, style as F, template as V } from "solid-js/web";
2
+ import { onMount as b, onCleanup as q, createEffect as g } from "solid-js";
3
+ import { useTheme as w } from "../../context/ThemeContext.js";
4
+ import { useResizeObserver as A } from "../../hooks/useResizeObserver.js";
5
5
  import * as f from "monaco-editor/esm/vs/editor/editor.api.js";
6
6
  import "monaco-editor/min/vs/editor/editor.main.css";
7
- import { resolveCodeEditorLanguageSpec as A } from "./languages.js";
8
- import { ensureMonacoEnvironment as U } from "./monacoEnvironment.js";
7
+ import { resolveCodeEditorLanguageSpec as U } from "./languages.js";
8
+ import { ensureMonacoEnvironment as p } from "./monacoEnvironment.js";
9
9
  import { ensureMonacoStandaloneRuntime as N } from "./monacoStandaloneRuntime.js";
10
10
  var _ = /* @__PURE__ */ V("<div>");
11
11
  const E = {
@@ -30,11 +30,11 @@ function B(t, c) {
30
30
  return !r || r.isEmpty() ? "" : c.getValueInRange(r);
31
31
  }
32
32
  function X(t) {
33
- const c = q();
33
+ const c = w();
34
34
  let r;
35
35
  const R = ++$;
36
- let n, o, s, S = null, v = 0;
37
- const x = w(() => r), y = () => {
36
+ let n, o, d, S = null, v = 0;
37
+ const x = A(() => r), y = () => {
38
38
  f.editor.setTheme(c.resolvedTheme() === "dark" ? "vs-dark" : "vs");
39
39
  }, m = () => !n || !o ? null : {
40
40
  editor: n,
@@ -52,7 +52,7 @@ function X(t) {
52
52
  e && t.onSelectionChange?.(e.getSelectedText(), e);
53
53
  }, I = async () => {
54
54
  if (!n) return;
55
- const e = ++v, a = A(t.language);
55
+ const e = ++v, a = U(t.language);
56
56
  let i = a.id;
57
57
  try {
58
58
  await a.load?.();
@@ -61,34 +61,34 @@ function X(t) {
61
61
  i = "plaintext";
62
62
  }
63
63
  if (!n || e !== v) return;
64
- const d = k(R, t.path);
65
- if (o && o.uri.toString() === d.toString()) {
64
+ const u = k(R, t.path);
65
+ if (o && o.uri.toString() === u.toString()) {
66
66
  o.getLanguageId() !== i && f.editor.setModelLanguage(o, i), o.getValue() !== t.value && o.setValue(t.value), C(), M();
67
67
  return;
68
68
  }
69
- const l = f.editor.createModel(t.value, i, d);
69
+ const l = f.editor.createModel(t.value, i, u);
70
70
  o?.dispose(), o = l, n.setModel(o), C(), M();
71
71
  };
72
72
  return b(() => {
73
73
  let e = !1, a, i;
74
74
  (async () => {
75
- if (!r || (U(), await N(), e || !r) || (n = f.editor.create(r, {
75
+ if (!r || (p(), await N(t.runtimeOptions), e || !r) || (n = f.editor.create(r, {
76
76
  model: null,
77
77
  ...E,
78
78
  ...t.options ?? {}
79
79
  }), y(), await I(), e || !n)) return;
80
80
  const l = t.onContentChange, T = t.onChange, z = t.onSelectionChange;
81
- a = n.onDidChangeModelContent((u) => {
81
+ a = n.onDidChangeModelContent((s) => {
82
82
  const h = m();
83
- h && (l?.(u, h), T && T(h.getValue()));
83
+ h && (l?.(s, h), T && T(h.getValue()));
84
84
  }), i = n.onDidChangeCursorSelection(() => {
85
- const u = m();
86
- u && z?.(u.getSelectedText(), u);
85
+ const s = m();
86
+ s && z?.(s.getSelectedText(), s);
87
87
  });
88
88
  })().catch((l) => {
89
89
  console.error("Failed to initialize Monaco editor runtime", l);
90
- }), p(() => {
91
- e = !0, a?.dispose(), i?.dispose(), s && cancelAnimationFrame(s), n?.dispose(), o?.dispose(), n = void 0, o = void 0;
90
+ }), q(() => {
91
+ e = !0, a?.dispose(), i?.dispose(), d && cancelAnimationFrame(d), n?.dispose(), o?.dispose(), n = void 0, o = void 0;
92
92
  });
93
93
  }), g(() => {
94
94
  y();
@@ -101,7 +101,7 @@ function X(t) {
101
101
  t.path, t.language, t.value, I();
102
102
  }), g(() => {
103
103
  const e = x();
104
- !e || !n || (s && cancelAnimationFrame(s), s = requestAnimationFrame(() => {
104
+ !e || !n || (d && cancelAnimationFrame(d), d = requestAnimationFrame(() => {
105
105
  n?.layout({
106
106
  width: e.width,
107
107
  height: e.height
@@ -109,9 +109,9 @@ function X(t) {
109
109
  }));
110
110
  }), (() => {
111
111
  var e = _(), a = r;
112
- return typeof a == "function" ? L(a, e) : r = e, D((i) => {
113
- var d = t.class, l = t.style;
114
- return d !== i.e && F(e, i.e = d), i.t = O(e, l, i.t), i;
112
+ return typeof a == "function" ? L(a, e) : r = e, O((i) => {
113
+ var u = t.class, l = t.style;
114
+ return u !== i.e && D(e, i.e = u), i.t = F(e, l, i.t), i;
115
115
  }, {
116
116
  e: void 0,
117
117
  t: void 0
@@ -1,2 +1,3 @@
1
1
  export { CodeEditor, type CodeEditorProps, type CodeEditorApi } from './CodeEditor';
2
2
  export { resolveCodeEditorLanguageSpec, isCodeEditorLanguageSupported, type CodeEditorLanguageSpec } from './languages';
3
+ export { DEFAULT_MONACO_STANDALONE_FEATURES, normalizeMonacoRuntimeFeatureSet, type CodeEditorRuntimeOptions, type MonacoRuntimeFeatureSet, } from './monacoStandaloneRuntime';
@@ -1,4 +1,16 @@
1
- type MonacoStandaloneRuntimeLoader = () => Promise<unknown>;
2
- export declare function createMonacoStandaloneRuntime(loader: MonacoStandaloneRuntimeLoader): () => Promise<void>;
3
- export declare const ensureMonacoStandaloneRuntime: () => Promise<void>;
1
+ export interface MonacoRuntimeFeatureSet {
2
+ suggestMemory: boolean;
3
+ codeLensCache: boolean;
4
+ inlayHintsCache: boolean;
5
+ treeViewsDnd: boolean;
6
+ actionWidget: boolean;
7
+ }
8
+ export interface CodeEditorRuntimeOptions {
9
+ standaloneFeatures?: Partial<MonacoRuntimeFeatureSet>;
10
+ }
11
+ export declare const DEFAULT_MONACO_STANDALONE_FEATURES: MonacoRuntimeFeatureSet;
12
+ type MonacoStandaloneRuntimeLoader = (features: MonacoRuntimeFeatureSet) => Promise<unknown>;
13
+ export declare function normalizeMonacoRuntimeFeatureSet(standaloneFeatures?: Partial<MonacoRuntimeFeatureSet>): MonacoRuntimeFeatureSet;
14
+ export declare function createMonacoStandaloneRuntime(loader: MonacoStandaloneRuntimeLoader): (options?: CodeEditorRuntimeOptions) => Promise<void>;
15
+ export declare const ensureMonacoStandaloneRuntime: (options?: CodeEditorRuntimeOptions) => Promise<void>;
4
16
  export {};
@@ -1,21 +1,49 @@
1
- function e(t) {
2
- let n = null;
3
- return () => n || (n = t().then(() => {
4
- }).catch((o) => {
5
- throw n = null, o;
6
- }), n);
1
+ const s = {
2
+ suggestMemory: !0,
3
+ codeLensCache: !0,
4
+ inlayHintsCache: !0,
5
+ treeViewsDnd: !0,
6
+ actionWidget: !0
7
+ };
8
+ function u(e) {
9
+ return {
10
+ ...s,
11
+ ...e ?? {}
12
+ };
13
+ }
14
+ function d(e) {
15
+ return [
16
+ `suggestMemory:${e.suggestMemory ? "1" : "0"}`,
17
+ `codeLensCache:${e.codeLensCache ? "1" : "0"}`,
18
+ `inlayHintsCache:${e.inlayHintsCache ? "1" : "0"}`,
19
+ `treeViewsDnd:${e.treeViewsDnd ? "1" : "0"}`,
20
+ `actionWidget:${e.actionWidget ? "1" : "0"}`
21
+ ].join("|");
22
+ }
23
+ function m(e) {
24
+ const n = /* @__PURE__ */ new Map();
25
+ return (r) => {
26
+ const o = u(r?.standaloneFeatures), t = d(o), i = n.get(t);
27
+ if (i) return i;
28
+ const c = e(o).then(() => {
29
+ }).catch((a) => {
30
+ throw n.delete(t), a;
31
+ });
32
+ return n.set(t, c), c;
33
+ };
7
34
  }
8
- function r() {
9
- return Promise.all([
10
- import("monaco-editor/esm/vs/editor/edcore.main.js"),
11
- import("monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestMemory.js"),
12
- import("monaco-editor/esm/vs/editor/contrib/codelens/browser/codeLensCache.js"),
13
- import("monaco-editor/esm/vs/editor/common/services/treeViewsDndService.js"),
14
- import("monaco-editor/esm/vs/platform/actionWidget/browser/actionWidget.js")
15
- ]);
35
+ function h(e) {
36
+ const n = [
37
+ import("monaco-editor/esm/vs/editor/edcore.main.js")
38
+ ];
39
+ return e.suggestMemory && n.push(import("monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestMemory.js")), e.codeLensCache && n.push(import("monaco-editor/esm/vs/editor/contrib/codelens/browser/codeLensCache.js")), e.inlayHintsCache && n.push(import("monaco-editor/esm/vs/editor/contrib/inlayHints/browser/inlayHintsContribution.js")), e.treeViewsDnd && n.push(import("monaco-editor/esm/vs/editor/common/services/treeViewsDndService.js")), e.actionWidget && n.push(import("monaco-editor/esm/vs/platform/actionWidget/browser/actionWidget.js")), Promise.all(n);
16
40
  }
17
- const i = e(r);
41
+ const g = m(
42
+ h
43
+ );
18
44
  export {
19
- e as createMonacoStandaloneRuntime,
20
- i as ensureMonacoStandaloneRuntime
45
+ s as DEFAULT_MONACO_STANDALONE_FEATURES,
46
+ m as createMonacoStandaloneRuntime,
47
+ g as ensureMonacoStandaloneRuntime,
48
+ u as normalizeMonacoRuntimeFeatureSet
21
49
  };
@@ -14,6 +14,7 @@ export interface InfiniteCanvasContextMenuEvent {
14
14
  }
15
15
  export interface InfiniteCanvasProps {
16
16
  children: JSX.Element;
17
+ overlay?: (viewport: InfiniteCanvasPoint) => JSX.Element;
17
18
  viewport: InfiniteCanvasPoint;
18
19
  onViewportChange?: (viewport: InfiniteCanvasPoint) => void;
19
20
  onCanvasContextMenu?: (event: InfiniteCanvasContextMenuEvent) => void;
@@ -22,6 +23,7 @@ export interface InfiniteCanvasProps {
22
23
  contentClass?: string;
23
24
  interactiveSelector?: string;
24
25
  panSurfaceSelector?: string;
26
+ wheelInteractiveSelector?: string;
25
27
  minScale?: number;
26
28
  maxScale?: number;
27
29
  wheelZoomSpeed?: number;
@@ -1,34 +1,34 @@
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";
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";
3
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));
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));
10
10
  }
11
- function A(n) {
11
+ function M(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
- scale: Number.isFinite(n.scale) && n.scale > 0 ? n.scale : re
15
+ scale: Number.isFinite(n.scale) && n.scale > 0 ? n.scale : ie
16
16
  };
17
17
  }
18
- function se(n, i) {
19
- return n.deltaMode === 1 ? n.deltaY * 16 : n.deltaMode === 2 ? n.deltaY * (i?.clientHeight ?? window.innerHeight) : n.deltaY;
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
20
  }
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
- const e = p();
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();
26
26
  return e ? e.startedFromPanSurface ? e.moved : !0 : !1;
27
- }, C = () => {
27
+ }, p = () => {
28
28
  f !== void 0 && (window.clearTimeout(f), f = void 0);
29
- }, g = () => {
29
+ }, C = () => {
30
30
  m = !1, l !== void 0 && (window.clearTimeout(l), l = void 0);
31
- }, V = () => {
31
+ }, U = () => {
32
32
  if (typeof window > "u") {
33
33
  m = !1;
34
34
  return;
@@ -38,116 +38,117 @@ function ve(n) {
38
38
  }, 0);
39
39
  }, h = (e) => {
40
40
  L(() => n.onViewportChange?.(e));
41
- }, N = (e) => {
41
+ }, H = (e) => {
42
42
  if (typeof window > "u") {
43
43
  h(e);
44
44
  return;
45
45
  }
46
- C(), f = window.setTimeout(() => {
46
+ p(), f = window.setTimeout(() => {
47
47
  f = void 0, h(e);
48
48
  }, 90);
49
- }, v = (e) => te({
49
+ }, g = (e) => ne({
50
50
  target: e,
51
- interactiveSelector: M(),
51
+ interactiveSelector: R(),
52
52
  panSurfaceSelector: X()
53
- }), P = (e) => {
54
- const t = p();
53
+ }), E = (e) => {
54
+ const t = v();
55
55
  if (!t || e !== void 0 && t.pointerId !== e) return;
56
56
  t.stopInteraction?.();
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);
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);
59
59
  };
60
- _(() => {
61
- p() || d(A(n.viewport));
62
- }), _(() => {
63
- const e = a;
60
+ b(() => {
61
+ v() || d(M(n.viewport));
62
+ }), b(() => {
63
+ const e = i;
64
64
  if (!e) return;
65
- const t = (r) => {
66
- !m || v(r.target) !== "pan_surface" || (g(), r.preventDefault(), r.stopPropagation());
65
+ const t = (o) => {
66
+ !m || g(o.target) !== "pan_surface" || (C(), o.preventDefault(), o.stopPropagation());
67
67
  };
68
- e.addEventListener("click", t, !0), e.addEventListener("wheel", x, {
68
+ e.addEventListener("click", t, !0), e.addEventListener("wheel", P, {
69
69
  passive: !1
70
- }), b(() => {
71
- e.removeEventListener("click", t, !0), e.removeEventListener("wheel", x);
70
+ }), A(() => {
71
+ e.removeEventListener("click", t, !0), e.removeEventListener("wheel", P);
72
72
  });
73
- }), b(() => {
74
- C(), P(), g();
73
+ }), A(() => {
74
+ p(), E(), C();
75
75
  });
76
- const U = (e) => {
76
+ const Z = (e) => {
77
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({
78
+ const t = g(e.target), o = t === "pan_surface";
79
+ t !== "local_surface" && (p(), C(), o || (e.preventDefault(), i?.setPointerCapture(e.pointerId)), w({
80
80
  pointerId: e.pointerId,
81
81
  startClientX: e.clientX,
82
82
  startClientY: e.clientY,
83
- startViewport: i(),
83
+ startViewport: a(),
84
84
  moved: !1,
85
- startedFromPanSurface: r,
86
- stopInteraction: r ? void 0 : Y({
85
+ startedFromPanSurface: o,
86
+ stopInteraction: o ? void 0 : y({
87
87
  kind: "drag",
88
88
  cursor: "grabbing"
89
89
  })
90
90
  }));
91
- }, H = (e) => {
92
- const t = p();
91
+ }, W = (e) => {
92
+ const t = v();
93
93
  if (!t || t.pointerId !== e.pointerId) return;
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));
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));
97
97
  const s = {
98
98
  ...t.startViewport,
99
- x: t.startViewport.x + r,
100
- y: t.startViewport.y + o
99
+ x: t.startViewport.x + o,
100
+ y: t.startViewport.y + r
101
101
  };
102
102
  t.moved || w({
103
103
  ...t,
104
104
  moved: !0,
105
- stopInteraction: t.stopInteraction ?? Y({
105
+ stopInteraction: t.stopInteraction ?? y({
106
106
  kind: "drag",
107
107
  cursor: "grabbing"
108
108
  })
109
109
  }), d(s);
110
- }, Z = (e) => {
111
- P(e.pointerId);
112
110
  }, O = (e) => {
113
- P(e.pointerId);
114
- }, x = (e) => {
115
- if (v(e.target) !== "canvas")
116
- return;
117
- const r = a?.getBoundingClientRect();
118
- if (!r || n.disablePanZoom)
119
- return;
111
+ E(e.pointerId);
112
+ }, z = (e) => {
113
+ E(e.pointerId);
114
+ }, P = (e) => {
115
+ const t = i?.getBoundingClientRect();
116
+ if (!t || re({
117
+ target: e.target,
118
+ disablePanZoom: !!n.disablePanZoom,
119
+ wheelInteractiveSelector: F()
120
+ }).kind !== "canvas_zoom") return;
120
121
  e.preventDefault();
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,
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,
126
127
  scale: u
127
128
  };
128
- d(E), N(E);
129
- }, W = (e) => {
130
- if (v(e.target) !== "canvas") return;
131
- const t = a?.getBoundingClientRect();
129
+ d(I), H(I);
130
+ }, B = (e) => {
131
+ if (g(e.target) !== "canvas") return;
132
+ const t = i?.getBoundingClientRect();
132
133
  if (!t) return;
133
134
  e.preventDefault();
134
- const r = e.clientX - t.left, o = e.clientY - t.top, c = i();
135
+ const o = e.clientX - t.left, r = e.clientY - t.top, c = a();
135
136
  n.onCanvasContextMenu?.({
136
137
  clientX: e.clientX,
137
138
  clientY: e.clientY,
138
- localX: r,
139
- localY: o,
140
- worldX: (r - c.x) / c.scale,
141
- worldY: (o - c.y) / c.scale
139
+ localX: o,
140
+ localY: r,
141
+ worldX: (o - c.x) / c.scale,
142
+ worldY: (r - c.y) / c.scale
142
143
  });
143
144
  };
144
145
  return (() => {
145
- var e = ne(), t = e.firstChild;
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;
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;
151
152
  }, {
152
153
  e: void 0,
153
154
  t: void 0,
@@ -156,7 +157,7 @@ function ve(n) {
156
157
  }), e;
157
158
  })();
158
159
  }
159
- ee(["pointerdown", "pointermove", "pointerup", "contextmenu"]);
160
+ te(["pointerdown", "pointermove", "pointerup", "contextmenu"]);
160
161
  export {
161
- ve as InfiniteCanvas
162
+ Ce as InfiniteCanvas
162
163
  };
@@ -7,7 +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
+ 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';
11
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';
12
12
  export { Tabs, TabPanel, type TabsProps, type TabPanelProps, type TabItem, type TabsFeatures, type TabsSlotClassNames, type TabsIndicatorMode, type TabsIndicatorColorToken, } from './Tabs';
13
13
  export { DirectoryPicker, type DirectoryPickerProps } from './DirectoryPicker';
@@ -1,8 +1,20 @@
1
1
  export declare const LOCAL_INTERACTION_SURFACE_ATTR = "data-floe-local-interaction-surface";
2
2
  export declare const DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR = "[data-floe-local-interaction-surface=\"true\"]";
3
+ export declare const CANVAS_WHEEL_INTERACTIVE_ATTR = "data-floe-canvas-wheel-interactive";
4
+ export declare const DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR = "[data-floe-canvas-wheel-interactive=\"true\"]";
3
5
  export declare const WORKBENCH_WIDGET_SHELL_ATTR = "data-floe-workbench-widget-shell";
4
6
  export declare const DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR = "[data-floe-workbench-widget-shell=\"true\"]";
5
7
  export type SurfaceInteractionTargetRole = 'canvas' | 'local_surface' | 'pan_surface';
8
+ export type SurfaceWheelLocalReason = 'typing_element' | 'local_interaction_surface' | 'wheel_interactive';
9
+ export type SurfaceWheelRoutingDecision = {
10
+ kind: 'canvas_zoom';
11
+ } | {
12
+ kind: 'local_surface';
13
+ reason: SurfaceWheelLocalReason;
14
+ } | {
15
+ kind: 'ignore';
16
+ reason: 'pan_zoom_disabled';
17
+ };
6
18
  export type WorkbenchWidgetEventOwnership = 'outside_widget' | 'widget_local' | 'widget_shell';
7
19
  export interface SurfaceInteractionRoutingOptions {
8
20
  target: EventTarget | null;
@@ -14,6 +26,13 @@ export interface WorkbenchWidgetEventOwnershipOptions extends SurfaceInteraction
14
26
  widgetRoot: Element | EventTarget | null;
15
27
  shellSelector?: string;
16
28
  }
29
+ export interface SurfaceWheelRoutingOptions {
30
+ target: EventTarget | null;
31
+ disablePanZoom: boolean;
32
+ localInteractionSurfaceSelector?: string;
33
+ wheelInteractiveSelector?: string;
34
+ }
17
35
  export declare function resolveSurfaceInteractionTargetRole(options: SurfaceInteractionRoutingOptions): SurfaceInteractionTargetRole;
36
+ export declare function resolveSurfaceWheelRouting(options: SurfaceWheelRoutingOptions): SurfaceWheelRoutingDecision;
18
37
  export declare function isLocalInteractionSurfaceTarget(options: SurfaceInteractionRoutingOptions): boolean;
19
38
  export declare function resolveWorkbenchWidgetEventOwnership(options: WorkbenchWidgetEventOwnershipOptions): WorkbenchWidgetEventOwnership;
@@ -1,33 +1,48 @@
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) {
1
+ import { isTypingElement as a } from "../../utils/dom.js";
2
+ const u = "data-floe-local-interaction-surface", i = `[${u}="true"]`, f = "data-floe-canvas-wheel-interactive", E = `[${f}="true"]`, _ = "data-floe-workbench-widget-shell", T = `[${_}="true"]`;
3
+ function c(e) {
4
4
  return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
5
5
  }
6
- function a(e) {
6
+ function s(e) {
7
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";
8
+ target: t,
9
+ interactiveSelector: l,
10
+ panSurfaceSelector: r,
11
+ localInteractionSurfaceSelector: n = i
12
+ } = e, o = t instanceof Element ? t : null;
13
+ return o ? o.closest(r) !== null ? "pan_surface" : a(o) || o.closest(l) !== null || o.closest(n) !== null ? "local_surface" : "canvas" : "canvas";
14
14
  }
15
15
  function d(e) {
16
- return a(e) !== "canvas";
16
+ const {
17
+ target: t,
18
+ localInteractionSurfaceSelector: l = i,
19
+ wheelInteractiveSelector: r = E
20
+ } = e, n = c(t);
21
+ return n ? a(n) ? "typing_element" : n.closest(l) !== null ? "local_interaction_surface" : n.closest(r) !== null ? "wheel_interactive" : null : null;
22
+ }
23
+ function R(e) {
24
+ const t = d(e);
25
+ return t ? { kind: "local_surface", reason: t } : e.disablePanZoom ? { kind: "ignore", reason: "pan_zoom_disabled" } : { kind: "canvas_zoom" };
26
+ }
27
+ function A(e) {
28
+ return s(e) !== "canvas";
17
29
  }
18
- function T(e) {
30
+ function L(e) {
19
31
  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";
32
+ widgetRoot: t,
33
+ shellSelector: l = T
34
+ } = e, r = c(t), n = c(e.target);
35
+ return !r || !n || !r.contains(n) ? "outside_widget" : s(e) !== "canvas" ? "widget_local" : n === r || n.closest(l) !== null ? "widget_shell" : "widget_local";
24
36
  }
25
37
  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
38
+ f as CANVAS_WHEEL_INTERACTIVE_ATTR,
39
+ E as DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR,
40
+ i as DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR,
41
+ T as DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR,
42
+ u as LOCAL_INTERACTION_SURFACE_ATTR,
43
+ _ as WORKBENCH_WIDGET_SHELL_ATTR,
44
+ A as isLocalInteractionSurfaceTarget,
45
+ s as resolveSurfaceInteractionTargetRole,
46
+ R as resolveSurfaceWheelRouting,
47
+ L as resolveWorkbenchWidgetEventOwnership
33
48
  };
@@ -4,6 +4,10 @@ export interface WorkbenchCanvasProps {
4
4
  widgetDefinitions: readonly WorkbenchWidgetDefinition[];
5
5
  widgets: readonly WorkbenchWidgetItem[];
6
6
  viewport: WorkbenchViewport;
7
+ canvasFrameSize: {
8
+ width: number;
9
+ height: number;
10
+ };
7
11
  selectedWidgetId: string | null;
8
12
  optimisticFrontWidgetId: string | null;
9
13
  locked: boolean;