@floegence/floe-webapp-core 0.36.23 → 0.36.25
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/index.d.ts +1 -1
- package/dist/components/ui/localInteractionSurface.d.ts +5 -1
- package/dist/components/ui/localInteractionSurface.js +67 -63
- package/dist/components/workbench/WorkbenchSurface.js +140 -119
- package/dist/components/workbench/WorkbenchWidget.js +252 -226
- package/dist/components/workbench/types.d.ts +1 -1
- package/dist/components/workbench/workbenchInteractionAdapter.js +61 -52
- package/dist/full.js +546 -543
- package/dist/ui.js +124 -121
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ export { CommandPalette } from './CommandPalette';
|
|
|
9
9
|
export { InfiniteCanvas, type InfiniteCanvasProps, type InfiniteCanvasPoint, type InfiniteCanvasContextMenuEvent, } from './InfiniteCanvas';
|
|
10
10
|
export { startPointerSession, type PointerSessionController, type PointerSessionEndEvent, type PointerSessionEndReason, type PointerSessionSnapshot, type StartPointerSessionOptions, } from './pointerSession';
|
|
11
11
|
export { clientToCanvasLocal, clientToCanvasWorld, createViewportFromZoomAnchor, isPointInsideCanvasRect, localToCanvasWorld, type CanvasClientPoint, type CanvasLocalPoint, type CanvasViewportLike, type CanvasViewportRectLike, type CanvasWorldPoint, } from './canvasGeometry';
|
|
12
|
-
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, shouldActivateWorkbenchWidgetLocalTarget, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type SurfaceWheelLocalReason, type SurfaceWheelRoutingDecision, type SurfaceWheelRoutingOptions, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, type WorkbenchWidgetLocalActivationTargetOptions, } from './localInteractionSurface';
|
|
12
|
+
export { CANVAS_WHEEL_INTERACTIVE_ATTR, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR, LOCAL_INTERACTION_SURFACE_ATTR, DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR, WORKBENCH_WIDGET_ACTIVATION_SURFACE_ATTR, DEFAULT_WORKBENCH_WIDGET_ACTIVATION_SURFACE_SELECTOR, WORKBENCH_WIDGET_SHELL_ATTR, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR, isLocalInteractionSurfaceTarget, resolveSurfaceInteractionTargetRole, resolveSurfaceWheelRouting, resolveWorkbenchWidgetEventOwnership, resolveWorkbenchWidgetLocalTypingTarget, shouldActivateWorkbenchWidgetLocalTarget, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type SurfaceWheelLocalReason, type SurfaceWheelRoutingDecision, type SurfaceWheelRoutingOptions, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, type WorkbenchWidgetLocalActivationTargetOptions, } from './localInteractionSurface';
|
|
13
13
|
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';
|
|
14
14
|
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';
|
|
15
15
|
export { Tabs, TabPanel, type TabsProps, type TabPanelProps, type TabItem, type TabsFeatures, type TabsSlotClassNames, type TabsIndicatorMode, type TabsIndicatorColorToken, } from './Tabs';
|
|
@@ -4,6 +4,8 @@ export declare const CANVAS_WHEEL_INTERACTIVE_ATTR = "data-floe-canvas-wheel-int
|
|
|
4
4
|
export declare const DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR = "[data-floe-canvas-wheel-interactive=\"true\"]";
|
|
5
5
|
export declare const WORKBENCH_WIDGET_SHELL_ATTR = "data-floe-workbench-widget-shell";
|
|
6
6
|
export declare const DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR = "[data-floe-workbench-widget-shell=\"true\"]";
|
|
7
|
+
export declare const WORKBENCH_WIDGET_ACTIVATION_SURFACE_ATTR = "data-floe-workbench-widget-activation-surface";
|
|
8
|
+
export declare const DEFAULT_WORKBENCH_WIDGET_ACTIVATION_SURFACE_SELECTOR = "[data-floe-workbench-widget-activation-surface=\"true\"]";
|
|
7
9
|
export type SurfaceInteractionTargetRole = 'canvas' | 'local_surface' | 'pan_surface';
|
|
8
10
|
export type SurfaceWheelLocalReason = 'typing_element' | 'local_interaction_surface' | 'wheel_interactive';
|
|
9
11
|
export type SurfaceWheelRoutingDecision = {
|
|
@@ -26,7 +28,9 @@ export interface WorkbenchWidgetEventOwnershipOptions extends SurfaceInteraction
|
|
|
26
28
|
widgetRoot: Element | EventTarget | null;
|
|
27
29
|
shellSelector?: string;
|
|
28
30
|
}
|
|
29
|
-
export
|
|
31
|
+
export interface WorkbenchWidgetLocalActivationTargetOptions extends WorkbenchWidgetEventOwnershipOptions {
|
|
32
|
+
widgetActivationSurfaceSelector?: string;
|
|
33
|
+
}
|
|
30
34
|
export interface SurfaceWheelRoutingOptions {
|
|
31
35
|
target: EventTarget | null;
|
|
32
36
|
disablePanZoom: boolean;
|
|
@@ -1,90 +1,94 @@
|
|
|
1
|
-
import { isTypingElement as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { isTypingElement as i } from "../../utils/dom.js";
|
|
2
|
+
const T = "data-floe-local-interaction-surface", s = `[${T}="true"]`, S = "data-floe-canvas-wheel-interactive", g = `[${S}="true"]`, A = "data-floe-workbench-widget-shell", f = `[${A}="true"]`, m = "data-floe-workbench-widget-activation-surface", _ = `[${m}="true"]`;
|
|
3
|
+
function u(e) {
|
|
4
4
|
return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function R(e) {
|
|
7
7
|
if (!e || typeof HTMLElement > "u" || !(e instanceof HTMLElement))
|
|
8
8
|
return !1;
|
|
9
9
|
if (e.matches("button, input, select, textarea, summary") || e.matches("a[href], area[href]") || e.matches('iframe, [contenteditable="true"]')) return !0;
|
|
10
|
-
const
|
|
11
|
-
return
|
|
10
|
+
const t = e.getAttribute("tabindex");
|
|
11
|
+
return t !== null && t !== "-1";
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
let
|
|
15
|
-
for (;
|
|
16
|
-
if (
|
|
13
|
+
function h(e, t) {
|
|
14
|
+
let r = e;
|
|
15
|
+
for (; r && r !== t; ) {
|
|
16
|
+
if (i(r) || R(r))
|
|
17
17
|
return !0;
|
|
18
|
-
|
|
18
|
+
r = r.parentElement;
|
|
19
19
|
}
|
|
20
20
|
return !1;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function d(e) {
|
|
23
23
|
const {
|
|
24
|
-
target:
|
|
25
|
-
interactiveSelector:
|
|
26
|
-
panSurfaceSelector:
|
|
27
|
-
localInteractionSurfaceSelector:
|
|
28
|
-
} = e,
|
|
29
|
-
return
|
|
24
|
+
target: t,
|
|
25
|
+
interactiveSelector: r,
|
|
26
|
+
panSurfaceSelector: a,
|
|
27
|
+
localInteractionSurfaceSelector: l = s
|
|
28
|
+
} = e, c = t instanceof Element ? t : null;
|
|
29
|
+
return c ? c.closest(a) !== null ? "pan_surface" : i(c) || c.closest(r) !== null || c.closest(l) !== null ? "local_surface" : "canvas" : "canvas";
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function I(e) {
|
|
32
32
|
const {
|
|
33
|
-
target:
|
|
34
|
-
localInteractionSurfaceSelector:
|
|
35
|
-
wheelInteractiveSelector:
|
|
36
|
-
} = e,
|
|
37
|
-
return
|
|
33
|
+
target: t,
|
|
34
|
+
localInteractionSurfaceSelector: r = s,
|
|
35
|
+
wheelInteractiveSelector: a = g
|
|
36
|
+
} = e, l = u(t);
|
|
37
|
+
return l ? i(l) ? "typing_element" : l.closest(r) !== null ? "local_interaction_surface" : l.closest(a) !== null ? "wheel_interactive" : null : null;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
return
|
|
39
|
+
function w(e) {
|
|
40
|
+
const t = I(e);
|
|
41
|
+
return t ? { kind: "local_surface", reason: t } : e.disablePanZoom ? { kind: "ignore", reason: "pan_zoom_disabled" } : { kind: "canvas_zoom" };
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
43
|
+
function C(e) {
|
|
44
|
+
return d(e) !== "canvas";
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function E(e) {
|
|
47
47
|
const {
|
|
48
|
-
widgetRoot:
|
|
49
|
-
shellSelector:
|
|
50
|
-
} = e,
|
|
51
|
-
return !
|
|
48
|
+
widgetRoot: t,
|
|
49
|
+
shellSelector: r = f
|
|
50
|
+
} = e, a = u(t), l = u(e.target);
|
|
51
|
+
return !a || !l || !a.contains(l) ? "outside_widget" : d(e) !== "canvas" ? "widget_local" : l === a || l.closest(r) !== null ? "widget_shell" : "widget_local";
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function v(e) {
|
|
54
54
|
const {
|
|
55
|
-
widgetRoot:
|
|
56
|
-
shellSelector:
|
|
57
|
-
localInteractionSurfaceSelector:
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
widgetRoot: t,
|
|
56
|
+
shellSelector: r = f,
|
|
57
|
+
localInteractionSurfaceSelector: a = s,
|
|
58
|
+
widgetActivationSurfaceSelector: l = _
|
|
59
|
+
} = e, c = u(t), n = u(e.target);
|
|
60
|
+
return !c || !n || !c.contains(n) || n === c || n.closest(r) !== null || n.closest(e.panSurfaceSelector) !== null || n.closest(a) !== null ? !1 : n.closest(l) !== null ? E(e) === "widget_local" : h(n, c) ? !1 : E(e) === "widget_local";
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function W(e) {
|
|
62
63
|
const {
|
|
63
|
-
widgetRoot:
|
|
64
|
-
shellSelector:
|
|
65
|
-
localInteractionSurfaceSelector:
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
widgetRoot: t,
|
|
65
|
+
shellSelector: r = f,
|
|
66
|
+
localInteractionSurfaceSelector: a = s,
|
|
67
|
+
widgetActivationSurfaceSelector: l = _
|
|
68
|
+
} = e, c = u(t), n = u(e.target);
|
|
69
|
+
if (!c || !n || !c.contains(n) || n === c || n.closest(r) !== null || n.closest(e.panSurfaceSelector) !== null || n.closest(a) !== null || n.closest(l) !== null)
|
|
68
70
|
return null;
|
|
69
|
-
let
|
|
70
|
-
for (;
|
|
71
|
-
if (
|
|
72
|
-
return
|
|
73
|
-
|
|
71
|
+
let o = n;
|
|
72
|
+
for (; o && o !== c; ) {
|
|
73
|
+
if (o instanceof HTMLElement && i(o))
|
|
74
|
+
return o;
|
|
75
|
+
o = o.parentElement;
|
|
74
76
|
}
|
|
75
77
|
return null;
|
|
76
78
|
}
|
|
77
79
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
S as CANVAS_WHEEL_INTERACTIVE_ATTR,
|
|
81
|
+
g as DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR,
|
|
82
|
+
s as DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR,
|
|
83
|
+
_ as DEFAULT_WORKBENCH_WIDGET_ACTIVATION_SURFACE_SELECTOR,
|
|
84
|
+
f as DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR,
|
|
85
|
+
T as LOCAL_INTERACTION_SURFACE_ATTR,
|
|
86
|
+
m as WORKBENCH_WIDGET_ACTIVATION_SURFACE_ATTR,
|
|
87
|
+
A as WORKBENCH_WIDGET_SHELL_ATTR,
|
|
88
|
+
C as isLocalInteractionSurfaceTarget,
|
|
89
|
+
d as resolveSurfaceInteractionTargetRole,
|
|
90
|
+
w as resolveSurfaceWheelRouting,
|
|
91
|
+
E as resolveWorkbenchWidgetEventOwnership,
|
|
92
|
+
W as resolveWorkbenchWidgetLocalTypingTarget,
|
|
93
|
+
v as shouldActivateWorkbenchWidgetLocalTarget
|
|
90
94
|
};
|
|
@@ -1,173 +1,195 @@
|
|
|
1
|
-
import { use as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { clientToCanvasWorld as
|
|
4
|
-
import { WorkbenchCanvas as
|
|
5
|
-
import { WorkbenchContextMenu as
|
|
6
|
-
import { WorkbenchFilterBar as
|
|
7
|
-
import { WorkbenchHud as
|
|
8
|
-
import { WorkbenchLockButton as
|
|
9
|
-
import { installWorkbenchContextMenuDismissListeners as
|
|
10
|
-
import { useWorkbenchModel as
|
|
11
|
-
import { resolveWorkbenchInteractionAdapter as
|
|
12
|
-
var
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
|
|
1
|
+
import { use as T, spread as _, mergeProps as B, insert as f, createComponent as u, Portal as q, addEventListener as z, template as A, delegateEvents as $ } from "solid-js/web";
|
|
2
|
+
import { createSignal as S, createMemo as w, untrack as h, createEffect as m, onCleanup as v, Show as V } from "solid-js";
|
|
3
|
+
import { clientToCanvasWorld as N } from "../ui/canvasGeometry.js";
|
|
4
|
+
import { WorkbenchCanvas as P } from "./WorkbenchCanvas.js";
|
|
5
|
+
import { WorkbenchContextMenu as H } from "./WorkbenchContextMenu.js";
|
|
6
|
+
import { WorkbenchFilterBar as X } from "./WorkbenchFilterBar.js";
|
|
7
|
+
import { WorkbenchHud as Y } from "./WorkbenchHud.js";
|
|
8
|
+
import { WorkbenchLockButton as K } from "./WorkbenchLockButton.js";
|
|
9
|
+
import { installWorkbenchContextMenuDismissListeners as U } from "./workbenchContextMenuDismiss.js";
|
|
10
|
+
import { useWorkbenchModel as Z } from "./useWorkbenchModel.js";
|
|
11
|
+
import { resolveWorkbenchInteractionAdapter as G } from "./workbenchInteractionAdapter.js";
|
|
12
|
+
var j = /* @__PURE__ */ A("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), J = /* @__PURE__ */ A("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
|
|
13
|
+
const Q = "F1";
|
|
14
|
+
function I(i) {
|
|
15
|
+
if (i)
|
|
16
|
+
try {
|
|
17
|
+
i.focus({
|
|
18
|
+
preventScroll: !0
|
|
19
|
+
});
|
|
20
|
+
} catch {
|
|
21
|
+
i.focus();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function ge(i) {
|
|
25
|
+
const t = Z({
|
|
16
26
|
state: () => i.state(),
|
|
17
27
|
setState: (e) => i.setState(e),
|
|
18
28
|
widgetDefinitions: () => i.widgetDefinitions,
|
|
19
29
|
onClose: () => {
|
|
20
30
|
}
|
|
21
|
-
}), [
|
|
31
|
+
}), [s, x] = S(null), a = w(() => G(i.interactionAdapter)), [p, l] = S(h(() => a().createInitialInputOwner())), W = w(() => {
|
|
22
32
|
const e = i.launcherWidgetTypes;
|
|
23
33
|
return !e || e.length <= 0 ? null : new Set(e);
|
|
24
|
-
}),
|
|
25
|
-
const e = t.widgetDefinitions(),
|
|
26
|
-
return
|
|
27
|
-
}),
|
|
28
|
-
const e = t.contextMenu.items(),
|
|
29
|
-
return
|
|
30
|
-
if (
|
|
34
|
+
}), D = w(() => {
|
|
35
|
+
const e = t.widgetDefinitions(), r = W();
|
|
36
|
+
return r ? e.filter((n) => r.has(n.type)) : e;
|
|
37
|
+
}), E = w(() => {
|
|
38
|
+
const e = t.contextMenu.items(), r = W();
|
|
39
|
+
return r ? e.filter((n) => {
|
|
40
|
+
if (n.kind !== "action")
|
|
31
41
|
return !0;
|
|
32
|
-
const o = /^add-(.+)$/.exec(String(
|
|
33
|
-
return o ?
|
|
42
|
+
const o = /^add-(.+)$/.exec(String(n.id ?? ""));
|
|
43
|
+
return o ? r.has(o[1]) : !0;
|
|
34
44
|
}) : e;
|
|
35
|
-
}), k = (e,
|
|
36
|
-
const o = a(), c = o.findWidgetRoot(e),
|
|
37
|
-
if (
|
|
38
|
-
|
|
45
|
+
}), k = (e, r, n) => {
|
|
46
|
+
const o = a(), c = o.findWidgetRoot(e), d = o.readWidgetId(c);
|
|
47
|
+
if (d) {
|
|
48
|
+
l(o.createWidgetInputOwner(d, r));
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
const
|
|
51
|
+
const y = s();
|
|
52
|
+
y && e instanceof Node && y.contains(e) && l(o.createCanvasInputOwner(n));
|
|
53
|
+
}, b = (e = "selection_cleared") => {
|
|
54
|
+
const r = a(), n = s();
|
|
55
|
+
t.selection.clear(), l(r.createCanvasInputOwner(e)), queueMicrotask(() => {
|
|
56
|
+
if (!n || typeof document > "u") return;
|
|
57
|
+
const o = document.activeElement;
|
|
58
|
+
if (!(o instanceof HTMLElement) || !n.contains(o)) {
|
|
59
|
+
I(n);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const c = r.findWidgetRoot(o);
|
|
63
|
+
I(n), c && document.activeElement === o && o.isConnected && o.blur();
|
|
64
|
+
});
|
|
65
|
+
}, R = () => {
|
|
66
|
+
const e = s()?.querySelector('[data-floe-workbench-canvas-frame="true"]'), r = t.viewport(), n = e?.getBoundingClientRect(), o = n?.width ?? 0, c = n?.height ?? 0;
|
|
45
67
|
return {
|
|
46
|
-
worldX: o > 0 ? (o / 2 -
|
|
47
|
-
worldY: c > 0 ? (c / 2 -
|
|
68
|
+
worldX: o > 0 ? (o / 2 - r.x) / r.scale : 240,
|
|
69
|
+
worldY: c > 0 ? (c / 2 - r.y) / r.scale : 180
|
|
48
70
|
};
|
|
49
|
-
},
|
|
50
|
-
const
|
|
71
|
+
}, g = (e) => {
|
|
72
|
+
const r = h(a), n = h(s);
|
|
51
73
|
queueMicrotask(() => {
|
|
52
|
-
|
|
74
|
+
r.focusWidgetElement(n, e), l(r.createWidgetInputOwner(e, "activation"));
|
|
53
75
|
});
|
|
54
76
|
}, M = (e) => {
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
const
|
|
59
|
-
|
|
77
|
+
const r = t.navigation.fitWidget(e);
|
|
78
|
+
g(r.id);
|
|
79
|
+
}, L = (e) => {
|
|
80
|
+
const r = t.navigation.overviewWidget(e);
|
|
81
|
+
g(r.id);
|
|
60
82
|
};
|
|
61
|
-
|
|
83
|
+
m(() => {
|
|
62
84
|
i.onApiReady?.({
|
|
63
|
-
ensureWidget: (e,
|
|
64
|
-
createWidget: (e,
|
|
65
|
-
const
|
|
66
|
-
return o &&
|
|
85
|
+
ensureWidget: (e, r) => t.widgetActions.ensureWidget(e, r) ?? null,
|
|
86
|
+
createWidget: (e, r) => {
|
|
87
|
+
const n = R(), o = t.widgetActions.addWidgetAtCursor(e, r?.worldX ?? n.worldX, r?.worldY ?? n.worldY) ?? null;
|
|
88
|
+
return o && r?.centerViewport !== !1 && t.navigation.centerOnWidget(o), o;
|
|
67
89
|
},
|
|
68
|
-
clearSelection: () =>
|
|
69
|
-
focusWidget: (e,
|
|
70
|
-
const
|
|
71
|
-
return
|
|
90
|
+
clearSelection: () => b("selection_cleared"),
|
|
91
|
+
focusWidget: (e, r) => {
|
|
92
|
+
const n = t.navigation.focusWidget(e, r);
|
|
93
|
+
return g(n.id), n;
|
|
72
94
|
},
|
|
73
95
|
fitWidget: (e) => {
|
|
74
|
-
const
|
|
75
|
-
return
|
|
96
|
+
const r = t.navigation.fitWidget(e);
|
|
97
|
+
return g(r.id), r;
|
|
76
98
|
},
|
|
77
99
|
overviewWidget: (e) => {
|
|
78
|
-
const
|
|
79
|
-
return
|
|
100
|
+
const r = t.navigation.overviewWidget(e);
|
|
101
|
+
return g(r.id), r;
|
|
80
102
|
},
|
|
81
103
|
findWidgetByType: (e) => t.queries.findWidgetByType(e),
|
|
82
104
|
findWidgetById: (e) => t.queries.findWidgetById(e),
|
|
83
|
-
updateWidgetTitle: (e,
|
|
84
|
-
const
|
|
85
|
-
!
|
|
105
|
+
updateWidgetTitle: (e, r) => {
|
|
106
|
+
const n = String(e ?? "").trim(), o = String(r ?? "").trim();
|
|
107
|
+
!n || !o || i.setState((c) => ({
|
|
86
108
|
...c,
|
|
87
|
-
widgets: c.widgets.map((
|
|
88
|
-
...
|
|
109
|
+
widgets: c.widgets.map((d) => d.id === n && d.title !== o ? {
|
|
110
|
+
...d,
|
|
89
111
|
title: o
|
|
90
|
-
} :
|
|
112
|
+
} : d)
|
|
91
113
|
}));
|
|
92
114
|
}
|
|
93
115
|
}), v(() => {
|
|
94
116
|
i.onApiReady?.(null);
|
|
95
117
|
});
|
|
96
118
|
});
|
|
97
|
-
const C = () => i.lockShortcut === void 0 ?
|
|
98
|
-
|
|
119
|
+
const C = () => i.lockShortcut === void 0 ? Q : i.lockShortcut;
|
|
120
|
+
m(() => {
|
|
99
121
|
if (typeof window > "u" || !t.contextMenu.state()) return;
|
|
100
|
-
const e =
|
|
122
|
+
const e = U({
|
|
101
123
|
ownerWindow: window,
|
|
102
124
|
onDismiss: t.contextMenu.close
|
|
103
125
|
});
|
|
104
126
|
v(() => e());
|
|
105
|
-
}),
|
|
106
|
-
const e =
|
|
127
|
+
}), m(() => {
|
|
128
|
+
const e = p();
|
|
107
129
|
if (e.kind !== "widget") return;
|
|
108
|
-
t.widgets().some((
|
|
109
|
-
}),
|
|
110
|
-
const e =
|
|
130
|
+
t.widgets().some((n) => n.id === e.widgetId) || l(a().createCanvasInputOwner("widget_removed"));
|
|
131
|
+
}), m(() => {
|
|
132
|
+
const e = s();
|
|
111
133
|
if (!e) return;
|
|
112
|
-
const
|
|
134
|
+
const r = (o) => {
|
|
113
135
|
k(o.target, "pointer", "background_pointer");
|
|
114
|
-
},
|
|
136
|
+
}, n = (o) => {
|
|
115
137
|
k(o.target, "focus", "background_focus");
|
|
116
138
|
};
|
|
117
|
-
e.addEventListener("pointerdown",
|
|
118
|
-
e.removeEventListener("pointerdown",
|
|
139
|
+
e.addEventListener("pointerdown", r, !0), e.addEventListener("focusin", n), v(() => {
|
|
140
|
+
e.removeEventListener("pointerdown", r, !0), e.removeEventListener("focusin", n);
|
|
119
141
|
});
|
|
120
|
-
}),
|
|
142
|
+
}), m(() => {
|
|
121
143
|
if (i.enableKeyboard === !1 || typeof document > "u") return;
|
|
122
|
-
const e = C(),
|
|
123
|
-
if (!(
|
|
124
|
-
if (e !== null &&
|
|
125
|
-
|
|
144
|
+
const e = C(), r = (n) => {
|
|
145
|
+
if (!(n.defaultPrevented || n.isComposing)) {
|
|
146
|
+
if (e !== null && n.key === e) {
|
|
147
|
+
n.preventDefault(), t.lock.toggle();
|
|
126
148
|
return;
|
|
127
149
|
}
|
|
128
150
|
if (!a().shouldBypassGlobalHotkeys({
|
|
129
|
-
root:
|
|
130
|
-
target:
|
|
131
|
-
owner:
|
|
151
|
+
root: s(),
|
|
152
|
+
target: n.target,
|
|
153
|
+
owner: p(),
|
|
132
154
|
interactiveSelector: a().interactiveSelector
|
|
133
155
|
}))
|
|
134
|
-
switch (
|
|
156
|
+
switch (n.key) {
|
|
135
157
|
case "ArrowUp":
|
|
136
|
-
|
|
158
|
+
n.preventDefault(), t.navigation.handleArrowNavigation("up");
|
|
137
159
|
break;
|
|
138
160
|
case "ArrowDown":
|
|
139
|
-
|
|
161
|
+
n.preventDefault(), t.navigation.handleArrowNavigation("down");
|
|
140
162
|
break;
|
|
141
163
|
case "ArrowLeft":
|
|
142
|
-
|
|
164
|
+
n.preventDefault(), t.navigation.handleArrowNavigation("left");
|
|
143
165
|
break;
|
|
144
166
|
case "ArrowRight":
|
|
145
|
-
|
|
167
|
+
n.preventDefault(), t.navigation.handleArrowNavigation("right");
|
|
146
168
|
break;
|
|
147
169
|
case "Delete":
|
|
148
170
|
case "Backspace":
|
|
149
|
-
t.selectedWidgetId() && (
|
|
171
|
+
t.selectedWidgetId() && (n.preventDefault(), t.widgetActions.deleteSelected());
|
|
150
172
|
break;
|
|
151
173
|
}
|
|
152
174
|
}
|
|
153
175
|
};
|
|
154
|
-
document.addEventListener("keydown",
|
|
176
|
+
document.addEventListener("keydown", r, !0), v(() => document.removeEventListener("keydown", r, !0));
|
|
155
177
|
});
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
159
|
-
const o =
|
|
160
|
-
return
|
|
178
|
+
const F = (e, r) => {
|
|
179
|
+
const n = s()?.querySelector('[data-floe-workbench-canvas-frame="true"]');
|
|
180
|
+
if (!n) return null;
|
|
181
|
+
const o = n.getBoundingClientRect();
|
|
182
|
+
return N(o, t.viewport(), {
|
|
161
183
|
clientX: e,
|
|
162
|
-
clientY:
|
|
184
|
+
clientY: r
|
|
163
185
|
});
|
|
164
|
-
},
|
|
165
|
-
const o =
|
|
186
|
+
}, O = (e, r, n) => {
|
|
187
|
+
const o = F(r, n);
|
|
166
188
|
o && t.widgetActions.addWidgetAtCursor(e, o.worldX, o.worldY);
|
|
167
189
|
};
|
|
168
190
|
return (() => {
|
|
169
|
-
var e =
|
|
170
|
-
return
|
|
191
|
+
var e = J(), r = e.firstChild;
|
|
192
|
+
return T(x, e), _(e, B({
|
|
171
193
|
get class() {
|
|
172
194
|
return `workbench-surface${i.class ? ` ${i.class}` : ""}`;
|
|
173
195
|
}
|
|
@@ -176,8 +198,9 @@ function ue(i) {
|
|
|
176
198
|
}), {
|
|
177
199
|
get "data-workbench-theme"() {
|
|
178
200
|
return t.theme();
|
|
179
|
-
}
|
|
180
|
-
|
|
201
|
+
},
|
|
202
|
+
tabIndex: -1
|
|
203
|
+
}), !1, !0), f(r, u(P, {
|
|
181
204
|
get widgetDefinitions() {
|
|
182
205
|
return t.widgetDefinitions();
|
|
183
206
|
},
|
|
@@ -217,9 +240,7 @@ function ue(i) {
|
|
|
217
240
|
get onCanvasContextMenu() {
|
|
218
241
|
return t.canvas.openCanvasContextMenu;
|
|
219
242
|
},
|
|
220
|
-
|
|
221
|
-
return t.selection.clear;
|
|
222
|
-
},
|
|
243
|
+
onCanvasPointerDown: () => b("background_pointer"),
|
|
223
244
|
get onSelectWidget() {
|
|
224
245
|
return t.canvas.selectWidget;
|
|
225
246
|
},
|
|
@@ -238,7 +259,7 @@ function ue(i) {
|
|
|
238
259
|
get onCommitResize() {
|
|
239
260
|
return t.canvas.commitResize;
|
|
240
261
|
},
|
|
241
|
-
onRequestOverview:
|
|
262
|
+
onRequestOverview: L,
|
|
242
263
|
onRequestFit: M,
|
|
243
264
|
get onRequestDelete() {
|
|
244
265
|
return i.onRequestDelete ?? t.widgetActions.deleteWidget;
|
|
@@ -249,7 +270,7 @@ function ue(i) {
|
|
|
249
270
|
get onLayoutInteractionEnd() {
|
|
250
271
|
return i.onLayoutInteractionEnd;
|
|
251
272
|
}
|
|
252
|
-
})),
|
|
273
|
+
})), f(e, u(K, {
|
|
253
274
|
get locked() {
|
|
254
275
|
return t.locked();
|
|
255
276
|
},
|
|
@@ -259,9 +280,9 @@ function ue(i) {
|
|
|
259
280
|
get shortcutLabel() {
|
|
260
281
|
return C() ?? void 0;
|
|
261
282
|
}
|
|
262
|
-
}), null),
|
|
283
|
+
}), null), f(e, u(X, {
|
|
263
284
|
get widgetDefinitions() {
|
|
264
|
-
return
|
|
285
|
+
return D();
|
|
265
286
|
},
|
|
266
287
|
get widgets() {
|
|
267
288
|
return t.widgets();
|
|
@@ -275,8 +296,8 @@ function ue(i) {
|
|
|
275
296
|
get onShowAll() {
|
|
276
297
|
return t.filter.showAll;
|
|
277
298
|
},
|
|
278
|
-
onCreateAt:
|
|
279
|
-
}), null),
|
|
299
|
+
onCreateAt: O
|
|
300
|
+
}), null), f(e, u(Y, {
|
|
280
301
|
get scaleLabel() {
|
|
281
302
|
return t.scaleLabel();
|
|
282
303
|
},
|
|
@@ -289,18 +310,18 @@ function ue(i) {
|
|
|
289
310
|
get activeTheme() {
|
|
290
311
|
return t.theme();
|
|
291
312
|
},
|
|
292
|
-
onSelectTheme: (
|
|
293
|
-
}), null),
|
|
313
|
+
onSelectTheme: (n) => t.appearance.setTheme(n)
|
|
314
|
+
}), null), f(e, u(V, {
|
|
294
315
|
get when() {
|
|
295
316
|
return t.contextMenu.state();
|
|
296
317
|
},
|
|
297
318
|
get children() {
|
|
298
|
-
return
|
|
319
|
+
return u(q, {
|
|
299
320
|
get children() {
|
|
300
321
|
return [(() => {
|
|
301
|
-
var
|
|
302
|
-
return
|
|
303
|
-
})(),
|
|
322
|
+
var n = j();
|
|
323
|
+
return z(n, "contextmenu", t.contextMenu.retarget, !0), n;
|
|
324
|
+
})(), u(H, {
|
|
304
325
|
get x() {
|
|
305
326
|
return t.contextMenu.position()?.left ?? 0;
|
|
306
327
|
},
|
|
@@ -308,7 +329,7 @@ function ue(i) {
|
|
|
308
329
|
return t.contextMenu.position()?.top ?? 0;
|
|
309
330
|
},
|
|
310
331
|
get items() {
|
|
311
|
-
return
|
|
332
|
+
return E();
|
|
312
333
|
}
|
|
313
334
|
})];
|
|
314
335
|
}
|
|
@@ -317,7 +338,7 @@ function ue(i) {
|
|
|
317
338
|
}), null), e;
|
|
318
339
|
})();
|
|
319
340
|
}
|
|
320
|
-
|
|
341
|
+
$(["contextmenu"]);
|
|
321
342
|
export {
|
|
322
|
-
|
|
343
|
+
ge as WorkbenchSurface
|
|
323
344
|
};
|