@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,60 +1,90 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const u = 8, M = '[role="menuitem"]:not([disabled]):not([aria-disabled="true"])';
|
|
2
|
+
function a() {
|
|
3
|
+
return typeof window > "u" ? {
|
|
4
|
+
left: 0,
|
|
5
|
+
top: 0,
|
|
6
|
+
right: 0,
|
|
7
|
+
bottom: 0,
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0
|
|
10
|
+
} : {
|
|
11
|
+
left: 0,
|
|
12
|
+
top: 0,
|
|
13
|
+
right: window.innerWidth,
|
|
14
|
+
bottom: window.innerHeight,
|
|
15
|
+
width: window.innerWidth,
|
|
16
|
+
height: window.innerHeight
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function h(e) {
|
|
20
|
+
return e ?? a();
|
|
21
|
+
}
|
|
22
|
+
function E(e, t, f) {
|
|
23
|
+
const i = h(f);
|
|
24
|
+
let o = e.x, n = e.y;
|
|
25
|
+
return o + t.width > i.right - 8 && (o = i.right - t.width - 8), n + t.height > i.bottom - 8 && (n = i.bottom - t.height - 8), {
|
|
26
|
+
x: Math.max(i.left + 8, o),
|
|
27
|
+
y: Math.max(i.top + 8, n)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function A(e, t, f, i) {
|
|
31
|
+
const o = h(i);
|
|
32
|
+
let n;
|
|
33
|
+
switch (f) {
|
|
6
34
|
case "center":
|
|
7
|
-
|
|
35
|
+
n = e.left + e.width / 2 - t.width / 2;
|
|
8
36
|
break;
|
|
9
37
|
case "end":
|
|
10
|
-
|
|
38
|
+
n = e.right - t.width;
|
|
11
39
|
break;
|
|
12
40
|
default:
|
|
13
|
-
|
|
41
|
+
n = e.left;
|
|
14
42
|
}
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
const I = e.top - 8,
|
|
18
|
-
I >
|
|
43
|
+
let r = e.bottom + 4;
|
|
44
|
+
if (n + t.width > o.right - 8 && (n = o.right - t.width - 8), n = Math.max(o.left + 8, n), r + t.height > o.bottom - 8) {
|
|
45
|
+
const I = e.top - o.top - 8, d = o.bottom - e.bottom - 8;
|
|
46
|
+
I > d && I >= t.height ? r = e.top - t.height - 4 : r = o.bottom - t.height - 8;
|
|
19
47
|
}
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
|
|
48
|
+
return r = Math.max(o.top + 8, r), { x: n, y: r };
|
|
49
|
+
}
|
|
50
|
+
function P(e, t, f) {
|
|
51
|
+
const i = h(f);
|
|
52
|
+
let o = e.right, n = e.top;
|
|
53
|
+
if (o + t.width > i.right - 8) {
|
|
54
|
+
const r = e.left - t.width;
|
|
55
|
+
r >= i.left + 8 ? o = r : o = i.right - t.width - 8;
|
|
28
56
|
}
|
|
29
|
-
return
|
|
57
|
+
return n + t.height > i.bottom - 8 && (n = i.bottom - t.height - 8), o = Math.max(i.left + 8, o), n = Math.max(i.top + 8, n), { x: o, y: n };
|
|
30
58
|
}
|
|
31
|
-
function
|
|
32
|
-
return e <= 0 ? null : t < 0 ?
|
|
59
|
+
function s(e, t, f) {
|
|
60
|
+
return e <= 0 ? null : t < 0 ? f > 0 ? 0 : e - 1 : (t + f + e) % e;
|
|
33
61
|
}
|
|
34
|
-
function
|
|
35
|
-
return !e || typeof HTMLElement > "u" ? [] : Array.from(e.querySelectorAll(
|
|
62
|
+
function l(e) {
|
|
63
|
+
return !e || typeof HTMLElement > "u" ? [] : Array.from(e.querySelectorAll(M)).filter(
|
|
36
64
|
(t) => t instanceof HTMLElement
|
|
37
65
|
);
|
|
38
66
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
let
|
|
43
|
-
return t === "last" ?
|
|
67
|
+
function T(e, t = "first") {
|
|
68
|
+
const f = l(e);
|
|
69
|
+
if (!f.length) return !1;
|
|
70
|
+
let i = f[0];
|
|
71
|
+
return t === "last" ? i = f[f.length - 1] : t === "selected" && (i = f.find((o) => o.getAttribute("data-floe-selected") === "true") ?? f[0]), i.focus(), !0;
|
|
44
72
|
}
|
|
45
|
-
function
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
return
|
|
73
|
+
function w(e, t, f) {
|
|
74
|
+
const i = l(e);
|
|
75
|
+
if (!i.length) return !1;
|
|
76
|
+
const o = t ? i.indexOf(t) : -1, n = s(i.length, o, f);
|
|
77
|
+
return n === null ? !1 : (i[n]?.focus(), !0);
|
|
50
78
|
}
|
|
51
79
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
80
|
+
M as MENU_ITEM_SELECTOR,
|
|
81
|
+
u as VIEWPORT_MARGIN,
|
|
82
|
+
A as calculateMenuPosition,
|
|
83
|
+
P as calculateSubmenuPosition,
|
|
84
|
+
E as clampMenuPosition,
|
|
85
|
+
T as focusMenuItem,
|
|
86
|
+
l as getMenuItems,
|
|
87
|
+
s as getWrappedMenuItemIndex,
|
|
88
|
+
w as moveMenuFocus,
|
|
89
|
+
a as resolveViewportMenuBoundaryRect
|
|
60
90
|
};
|
|
@@ -0,0 +1 @@
|
|
|
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';
|
|
@@ -14,6 +14,7 @@ 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;
|
|
18
19
|
onSelectWidget: (widgetId: string) => void;
|
|
19
20
|
onWidgetContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { use as v, insert as m, createComponent as i, effect as W, template as
|
|
1
|
+
import { use as v, insert as m, createComponent as i, effect as W, template as w } from "solid-js/web";
|
|
2
2
|
import { createMemo as o, Show as h, For as F } from "solid-js";
|
|
3
3
|
import { WorkbenchCanvasField as y } from "./WorkbenchCanvasField.js";
|
|
4
|
-
import { WorkbenchWidget as
|
|
5
|
-
import { createWorkbenchRenderLayerMap as
|
|
4
|
+
import { WorkbenchWidget as I } from "./WorkbenchWidget.js";
|
|
5
|
+
import { createWorkbenchRenderLayerMap as R, resolveWorkbenchWidgetRenderMode as l } from "./workbenchHelpers.js";
|
|
6
6
|
import { getWidgetEntry as c } from "./widgets/widgetRegistry.js";
|
|
7
7
|
import { InfiniteCanvas as S } from "../ui/InfiniteCanvas.js";
|
|
8
|
-
var M = /* @__PURE__ */
|
|
8
|
+
var M = /* @__PURE__ */ w("<div class=workbench-canvas>"), k = /* @__PURE__ */ w("<div class=workbench-canvas__projected-layer>");
|
|
9
9
|
function b(e) {
|
|
10
10
|
const n = o((g) => {
|
|
11
11
|
const d = e.widgetById().get(e.widgetId);
|
|
@@ -13,7 +13,7 @@ function b(e) {
|
|
|
13
13
|
if (g) return g;
|
|
14
14
|
throw new Error(`Workbench widget ${e.widgetId} is missing from the projected render map.`);
|
|
15
15
|
}), a = o(() => c(n().type, e.widgetDefinitions));
|
|
16
|
-
return i(
|
|
16
|
+
return i(I, {
|
|
17
17
|
get definition() {
|
|
18
18
|
return a();
|
|
19
19
|
},
|
|
@@ -91,13 +91,13 @@ function b(e) {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
function q(e) {
|
|
94
|
-
const n = o(() => new Map(e.widgets.map((t) => [t.id, t]))), a = o(() =>
|
|
94
|
+
const n = o(() => new Map(e.widgets.map((t) => [t.id, t]))), a = o(() => R(e.widgets)), g = o(() => e.widgets.filter((t) => {
|
|
95
95
|
const r = c(t.type, e.widgetDefinitions);
|
|
96
96
|
return l(r) === "canvas_scaled";
|
|
97
97
|
})), d = o(() => e.widgets.filter((t) => {
|
|
98
98
|
const r = c(t.type, e.widgetDefinitions);
|
|
99
99
|
return l(r) === "projected_surface";
|
|
100
|
-
}).map((t) => t.id)),
|
|
100
|
+
}).map((t) => t.id)), f = () => e.canvasFrameSize.width > 0 && e.canvasFrameSize.height > 0;
|
|
101
101
|
return (() => {
|
|
102
102
|
var t = M(), r = e.setCanvasFrameRef;
|
|
103
103
|
return typeof r == "function" ? v(r, t) : e.setCanvasFrameRef = t, m(t, i(S, {
|
|
@@ -109,6 +109,9 @@ function q(e) {
|
|
|
109
109
|
get onViewportChange() {
|
|
110
110
|
return e.onViewportCommit;
|
|
111
111
|
},
|
|
112
|
+
get onViewportInteractionStart() {
|
|
113
|
+
return e.onViewportInteractionStart;
|
|
114
|
+
},
|
|
112
115
|
get onCanvasContextMenu() {
|
|
113
116
|
return e.onCanvasContextMenu;
|
|
114
117
|
},
|
|
@@ -179,7 +182,7 @@ function q(e) {
|
|
|
179
182
|
},
|
|
180
183
|
projectedViewport: s,
|
|
181
184
|
get surfaceReady() {
|
|
182
|
-
return
|
|
185
|
+
return f();
|
|
183
186
|
}
|
|
184
187
|
})
|
|
185
188
|
})), u;
|
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
import { insert as c, createComponent as a, Portal as
|
|
2
|
-
import { createEffect as s, onCleanup as
|
|
3
|
-
import { isTypingElement as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { insert as c, createComponent as a, Portal as f, addEventListener as w, effect as v, className as h, template as d, delegateEvents as p } from "solid-js/web";
|
|
2
|
+
import { createEffect as s, onCleanup as l, Show as k } from "solid-js";
|
|
3
|
+
import { isTypingElement as W } from "../../utils/dom.js";
|
|
4
|
+
import { clientToCanvasWorld as C } from "../ui/canvasGeometry.js";
|
|
5
|
+
import { WorkbenchCanvas as b } from "./WorkbenchCanvas.js";
|
|
6
|
+
import { WorkbenchContextMenu as A } from "./WorkbenchContextMenu.js";
|
|
7
|
+
import { WorkbenchFilterBar as y } from "./WorkbenchFilterBar.js";
|
|
8
|
+
import { WorkbenchHud as D } from "./WorkbenchHud.js";
|
|
9
|
+
import { WorkbenchLockButton as S } from "./WorkbenchLockButton.js";
|
|
10
|
+
import { installWorkbenchContextMenuDismissListeners as x } from "./workbenchContextMenuDismiss.js";
|
|
11
|
+
import { useWorkbenchModel as M } from "./useWorkbenchModel.js";
|
|
12
|
+
var F = /* @__PURE__ */ d("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), L = /* @__PURE__ */ d("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
|
|
13
|
+
const R = "F1";
|
|
14
|
+
function U(o) {
|
|
15
|
+
const e = M({
|
|
16
|
+
state: () => o.state(),
|
|
17
|
+
setState: (t) => o.setState(t),
|
|
18
|
+
widgetDefinitions: () => o.widgetDefinitions,
|
|
18
19
|
onClose: () => {
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
22
|
s(() => {
|
|
22
|
-
|
|
23
|
+
o.onApiReady?.({
|
|
23
24
|
ensureWidget: (t, r) => e.widgetActions.ensureWidget(t, r) ?? null,
|
|
24
25
|
clearSelection: () => e.selection.clear(),
|
|
25
26
|
focusWidget: (t, r) => e.navigation.focusWidget(t, r),
|
|
26
27
|
fitWidget: (t) => e.navigation.fitWidget(t),
|
|
27
28
|
overviewWidget: (t) => e.navigation.overviewWidget(t),
|
|
28
29
|
findWidgetByType: (t) => e.queries.findWidgetByType(t)
|
|
29
|
-
}),
|
|
30
|
-
|
|
30
|
+
}), l(() => {
|
|
31
|
+
o.onApiReady?.(null);
|
|
31
32
|
});
|
|
32
33
|
});
|
|
33
|
-
const
|
|
34
|
+
const u = () => o.lockShortcut === void 0 ? R : o.lockShortcut;
|
|
34
35
|
s(() => {
|
|
35
36
|
if (typeof window > "u" || !e.contextMenu.state()) return;
|
|
36
|
-
const t =
|
|
37
|
+
const t = x({
|
|
37
38
|
ownerWindow: window,
|
|
38
39
|
onDismiss: e.contextMenu.close
|
|
39
40
|
});
|
|
40
|
-
|
|
41
|
+
l(() => t());
|
|
41
42
|
}), s(() => {
|
|
42
|
-
if (
|
|
43
|
-
const t =
|
|
43
|
+
if (o.enableKeyboard === !1 || typeof document > "u") return;
|
|
44
|
+
const t = u(), r = (n) => {
|
|
44
45
|
if (n.defaultPrevented || n.isComposing) return;
|
|
45
46
|
if (t !== null && n.key === t) {
|
|
46
47
|
n.preventDefault(), e.lock.toggle();
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
|
-
const
|
|
50
|
-
if (!(
|
|
50
|
+
const i = n.target;
|
|
51
|
+
if (!(i instanceof Element && W(i)))
|
|
51
52
|
switch (n.key) {
|
|
52
53
|
case "ArrowUp":
|
|
53
54
|
n.preventDefault(), e.navigation.handleArrowNavigation("up");
|
|
@@ -67,26 +68,23 @@ function P(i) {
|
|
|
67
68
|
break;
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
|
-
document.addEventListener("keydown", r, !0),
|
|
71
|
+
document.addEventListener("keydown", r, !0), l(() => document.removeEventListener("keydown", r, !0));
|
|
71
72
|
});
|
|
72
|
-
const
|
|
73
|
+
const g = (t, r) => {
|
|
73
74
|
const n = document.querySelector('[data-floe-workbench-canvas-frame="true"]');
|
|
74
75
|
if (!n) return null;
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, f = (t, r, n) => {
|
|
84
|
-
const o = m(r, n);
|
|
85
|
-
o && e.widgetActions.addWidgetAtCursor(t, o.worldX, o.worldY);
|
|
76
|
+
const i = n.getBoundingClientRect();
|
|
77
|
+
return C(i, e.viewport(), {
|
|
78
|
+
clientX: t,
|
|
79
|
+
clientY: r
|
|
80
|
+
});
|
|
81
|
+
}, m = (t, r, n) => {
|
|
82
|
+
const i = g(r, n);
|
|
83
|
+
i && e.widgetActions.addWidgetAtCursor(t, i.worldX, i.worldY);
|
|
86
84
|
};
|
|
87
85
|
return (() => {
|
|
88
|
-
var t =
|
|
89
|
-
return c(r, a(
|
|
86
|
+
var t = L(), r = t.firstChild;
|
|
87
|
+
return c(r, a(b, {
|
|
90
88
|
get widgetDefinitions() {
|
|
91
89
|
return e.widgetDefinitions();
|
|
92
90
|
},
|
|
@@ -117,6 +115,9 @@ function P(i) {
|
|
|
117
115
|
get onViewportCommit() {
|
|
118
116
|
return e.canvas.commitViewport;
|
|
119
117
|
},
|
|
118
|
+
get onViewportInteractionStart() {
|
|
119
|
+
return e.canvas.cancelViewportNavigation;
|
|
120
|
+
},
|
|
120
121
|
get onCanvasContextMenu() {
|
|
121
122
|
return e.canvas.openCanvasContextMenu;
|
|
122
123
|
},
|
|
@@ -141,7 +142,7 @@ function P(i) {
|
|
|
141
142
|
get onRequestDelete() {
|
|
142
143
|
return e.widgetActions.deleteWidget;
|
|
143
144
|
}
|
|
144
|
-
})), c(t, a(
|
|
145
|
+
})), c(t, a(S, {
|
|
145
146
|
get locked() {
|
|
146
147
|
return e.locked();
|
|
147
148
|
},
|
|
@@ -149,9 +150,9 @@ function P(i) {
|
|
|
149
150
|
return e.lock.toggle;
|
|
150
151
|
},
|
|
151
152
|
get shortcutLabel() {
|
|
152
|
-
return
|
|
153
|
+
return u() ?? void 0;
|
|
153
154
|
}
|
|
154
|
-
}), null), c(t, a(
|
|
155
|
+
}), null), c(t, a(y, {
|
|
155
156
|
get widgetDefinitions() {
|
|
156
157
|
return e.widgetDefinitions();
|
|
157
158
|
},
|
|
@@ -167,8 +168,8 @@ function P(i) {
|
|
|
167
168
|
get onShowAll() {
|
|
168
169
|
return e.filter.showAll;
|
|
169
170
|
},
|
|
170
|
-
onCreateAt:
|
|
171
|
-
}), null), c(t, a(
|
|
171
|
+
onCreateAt: m
|
|
172
|
+
}), null), c(t, a(D, {
|
|
172
173
|
get scaleLabel() {
|
|
173
174
|
return e.scaleLabel();
|
|
174
175
|
},
|
|
@@ -178,17 +179,17 @@ function P(i) {
|
|
|
178
179
|
get onZoomIn() {
|
|
179
180
|
return e.hud.zoomIn;
|
|
180
181
|
}
|
|
181
|
-
}), null), c(t, a(
|
|
182
|
+
}), null), c(t, a(k, {
|
|
182
183
|
get when() {
|
|
183
184
|
return e.contextMenu.state();
|
|
184
185
|
},
|
|
185
186
|
get children() {
|
|
186
|
-
return a(
|
|
187
|
+
return a(f, {
|
|
187
188
|
get children() {
|
|
188
189
|
return [(() => {
|
|
189
|
-
var n =
|
|
190
|
-
return
|
|
191
|
-
})(), a(
|
|
190
|
+
var n = F();
|
|
191
|
+
return w(n, "contextmenu", e.contextMenu.retarget, !0), n;
|
|
192
|
+
})(), a(A, {
|
|
192
193
|
get x() {
|
|
193
194
|
return e.contextMenu.position()?.left ?? 0;
|
|
194
195
|
},
|
|
@@ -202,10 +203,10 @@ function P(i) {
|
|
|
202
203
|
}
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
|
-
}), null),
|
|
206
|
+
}), null), v(() => h(t, `workbench-surface${o.class ? ` ${o.class}` : ""}`)), t;
|
|
206
207
|
})();
|
|
207
208
|
}
|
|
208
|
-
|
|
209
|
+
p(["contextmenu"]);
|
|
209
210
|
export {
|
|
210
|
-
|
|
211
|
+
U as WorkbenchSurface
|
|
211
212
|
};
|