@floegence/floe-webapp-core 0.36.10 → 0.36.12
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 +7 -17
- package/dist/components/deck/DeckGrid.js +64 -64
- package/dist/components/deck/WidgetResizeHandle.js +21 -21
- package/dist/components/deck/deckGridMetrics.d.ts +7 -0
- package/dist/components/deck/deckGridMetrics.js +41 -26
- package/dist/components/deck/deckPointerSession.d.ts +2 -0
- package/dist/components/deck/deckPointerSession.js +38 -31
- package/dist/components/workbench/WorkbenchContextMenu.js +32 -27
- package/dist/components/workbench/WorkbenchSurface.d.ts +3 -0
- package/dist/components/workbench/WorkbenchSurface.js +46 -35
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/components/workbench/useWorkbenchModel.d.ts +6 -0
- package/dist/components/workbench/useWorkbenchModel.js +187 -159
- package/dist/components/workbench/workbenchContextMenuDismiss.d.ts +5 -0
- package/dist/components/workbench/workbenchContextMenuDismiss.js +29 -0
- package/dist/components/workbench/workbenchHelpers.d.ts +17 -0
- package/dist/components/workbench/workbenchHelpers.js +105 -76
- package/dist/hooks/useDeckDrag.js +4 -4
- package/dist/workbench.js +18 -16
- package/package.json +1 -1
|
@@ -1,44 +1,49 @@
|
|
|
1
|
-
import { insert as a, createComponent as
|
|
2
|
-
import { For as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { spread as d, mergeProps as v, insert as a, createComponent as s, addEventListener as f, effect as b, className as _, template as c, delegateEvents as p } from "solid-js/web";
|
|
2
|
+
import { For as h } from "solid-js";
|
|
3
|
+
import { cn as x } from "../../utils/cn.js";
|
|
4
|
+
import { WORKBENCH_CONTEXT_MENU_ATTR as k } from "./workbenchContextMenuDismiss.js";
|
|
5
|
+
var w = /* @__PURE__ */ c("<div role=menu class=workbench-context-menu data-floe-workbench-boundary=true>"), C = /* @__PURE__ */ c("<div role=separator aria-orientation=horizontal class=workbench-context-menu__separator>"), $ = /* @__PURE__ */ c("<button type=button role=menuitem><span class=workbench-context-menu__label>");
|
|
6
|
+
function E(r) {
|
|
7
|
+
return r.kind === "action";
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
+
function M(r) {
|
|
9
10
|
return (() => {
|
|
10
|
-
var
|
|
11
|
-
return
|
|
11
|
+
var o = w();
|
|
12
|
+
return d(o, v({
|
|
13
|
+
[k]: "true"
|
|
14
|
+
}, {
|
|
15
|
+
get style() {
|
|
16
|
+
return {
|
|
17
|
+
left: `${r.x}px`,
|
|
18
|
+
top: `${r.y}px`
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
onContextMenu: (e) => e.preventDefault()
|
|
22
|
+
}), !1, !0), a(o, s(h, {
|
|
12
23
|
get each() {
|
|
13
|
-
return
|
|
24
|
+
return r.items;
|
|
14
25
|
},
|
|
15
26
|
children: (e) => {
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
18
|
-
const
|
|
27
|
+
if (!E(e))
|
|
28
|
+
return C();
|
|
29
|
+
const m = e.icon;
|
|
19
30
|
return (() => {
|
|
20
|
-
var t =
|
|
21
|
-
return
|
|
31
|
+
var t = $(), l = t.firstChild;
|
|
32
|
+
return f(t, "click", e.onSelect, !0), a(t, s(m, {
|
|
22
33
|
class: "h-3.5 w-3.5"
|
|
23
|
-
}),
|
|
24
|
-
var
|
|
25
|
-
return
|
|
34
|
+
}), l), a(l, () => e.label), b((n) => {
|
|
35
|
+
var i = x("workbench-context-menu__item", e.destructive && "is-destructive"), u = e.disabled;
|
|
36
|
+
return i !== n.e && _(t, n.e = i), u !== n.t && (t.disabled = n.t = u), n;
|
|
26
37
|
}, {
|
|
27
38
|
e: void 0,
|
|
28
39
|
t: void 0
|
|
29
40
|
}), t;
|
|
30
41
|
})();
|
|
31
42
|
}
|
|
32
|
-
})),
|
|
33
|
-
var c = `${n.x}px`, t = `${n.y}px`;
|
|
34
|
-
return c !== e.e && m(r, "left", e.e = c), t !== e.t && m(r, "top", e.t = t), e;
|
|
35
|
-
}, {
|
|
36
|
-
e: void 0,
|
|
37
|
-
t: void 0
|
|
38
|
-
}), r;
|
|
43
|
+
})), o;
|
|
39
44
|
})();
|
|
40
45
|
}
|
|
41
|
-
|
|
46
|
+
p(["click"]);
|
|
42
47
|
export {
|
|
43
|
-
|
|
48
|
+
M as WorkbenchContextMenu
|
|
44
49
|
};
|
|
@@ -5,9 +5,12 @@ export interface WorkbenchSurfaceApi {
|
|
|
5
5
|
worldX?: number;
|
|
6
6
|
worldY?: number;
|
|
7
7
|
}) => WorkbenchWidgetItem | null;
|
|
8
|
+
clearSelection: () => void;
|
|
8
9
|
focusWidget: (widget: WorkbenchWidgetItem, options?: {
|
|
9
10
|
centerViewport?: boolean;
|
|
10
11
|
}) => WorkbenchWidgetItem;
|
|
12
|
+
fitWidget: (widget: WorkbenchWidgetItem) => WorkbenchWidgetItem;
|
|
13
|
+
overviewWidget: (widget: WorkbenchWidgetItem) => WorkbenchWidgetItem;
|
|
11
14
|
findWidgetByType: (type: WorkbenchWidgetType) => WorkbenchWidgetItem | null;
|
|
12
15
|
}
|
|
13
16
|
export interface WorkbenchSurfaceProps {
|
|
@@ -1,42 +1,53 @@
|
|
|
1
|
-
import { insert as c, createComponent as a, Portal as
|
|
2
|
-
import { createEffect as
|
|
3
|
-
import { isTypingElement as
|
|
4
|
-
import { WorkbenchCanvas as
|
|
1
|
+
import { insert as c, createComponent as a, Portal as h, addEventListener as p, effect as k, className as W, template as g, delegateEvents as b } from "solid-js/web";
|
|
2
|
+
import { createEffect as s, onCleanup as u, Show as C } from "solid-js";
|
|
3
|
+
import { isTypingElement as y } from "../../utils/dom.js";
|
|
4
|
+
import { WorkbenchCanvas as A } from "./WorkbenchCanvas.js";
|
|
5
5
|
import { WorkbenchContextMenu as D } from "./WorkbenchContextMenu.js";
|
|
6
6
|
import { WorkbenchFilterBar as x } from "./WorkbenchFilterBar.js";
|
|
7
7
|
import { WorkbenchHud as S } from "./WorkbenchHud.js";
|
|
8
|
-
import { WorkbenchLockButton as
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { WorkbenchLockButton as M } from "./WorkbenchLockButton.js";
|
|
9
|
+
import { installWorkbenchContextMenuDismissListeners as F } from "./workbenchContextMenuDismiss.js";
|
|
10
|
+
import { useWorkbenchModel as L } from "./useWorkbenchModel.js";
|
|
11
|
+
var R = /* @__PURE__ */ g("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), E = /* @__PURE__ */ g("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
|
|
12
|
+
const _ = "F1";
|
|
13
|
+
function P(i) {
|
|
14
|
+
const e = L({
|
|
14
15
|
state: () => i.state(),
|
|
15
16
|
setState: (t) => i.setState(t),
|
|
16
17
|
widgetDefinitions: () => i.widgetDefinitions,
|
|
17
18
|
onClose: () => {
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
+
s(() => {
|
|
21
22
|
i.onApiReady?.({
|
|
22
23
|
ensureWidget: (t, r) => e.widgetActions.ensureWidget(t, r) ?? null,
|
|
24
|
+
clearSelection: () => e.selection.clear(),
|
|
23
25
|
focusWidget: (t, r) => e.navigation.focusWidget(t, r),
|
|
26
|
+
fitWidget: (t) => e.navigation.fitWidget(t),
|
|
27
|
+
overviewWidget: (t) => e.navigation.overviewWidget(t),
|
|
24
28
|
findWidgetByType: (t) => e.queries.findWidgetByType(t)
|
|
25
|
-
}),
|
|
29
|
+
}), u(() => {
|
|
26
30
|
i.onApiReady?.(null);
|
|
27
31
|
});
|
|
28
32
|
});
|
|
29
|
-
const
|
|
30
|
-
|
|
33
|
+
const d = () => i.lockShortcut === void 0 ? _ : i.lockShortcut;
|
|
34
|
+
s(() => {
|
|
35
|
+
if (typeof window > "u" || !e.contextMenu.state()) return;
|
|
36
|
+
const t = F({
|
|
37
|
+
ownerWindow: window,
|
|
38
|
+
onDismiss: e.contextMenu.close
|
|
39
|
+
});
|
|
40
|
+
u(() => t());
|
|
41
|
+
}), s(() => {
|
|
31
42
|
if (i.enableKeyboard === !1 || typeof document > "u") return;
|
|
32
|
-
const t =
|
|
43
|
+
const t = d(), r = (n) => {
|
|
33
44
|
if (n.defaultPrevented || n.isComposing) return;
|
|
34
45
|
if (t !== null && n.key === t) {
|
|
35
46
|
n.preventDefault(), e.lock.toggle();
|
|
36
47
|
return;
|
|
37
48
|
}
|
|
38
49
|
const o = n.target;
|
|
39
|
-
if (!(o instanceof Element &&
|
|
50
|
+
if (!(o instanceof Element && y(o)))
|
|
40
51
|
switch (n.key) {
|
|
41
52
|
case "ArrowUp":
|
|
42
53
|
n.preventDefault(), e.navigation.handleArrowNavigation("up");
|
|
@@ -56,26 +67,26 @@ function U(i) {
|
|
|
56
67
|
break;
|
|
57
68
|
}
|
|
58
69
|
};
|
|
59
|
-
document.addEventListener("keydown", r, !0),
|
|
70
|
+
document.addEventListener("keydown", r, !0), u(() => document.removeEventListener("keydown", r, !0));
|
|
60
71
|
});
|
|
61
|
-
const
|
|
72
|
+
const m = (t, r) => {
|
|
62
73
|
const n = document.querySelector('[data-floe-workbench-canvas-frame="true"]');
|
|
63
74
|
if (!n) return null;
|
|
64
75
|
const o = n.getBoundingClientRect();
|
|
65
76
|
if (t < o.left || t > o.right || r < o.top || r > o.bottom)
|
|
66
77
|
return null;
|
|
67
|
-
const
|
|
78
|
+
const w = t - o.left, v = r - o.top, l = e.viewport();
|
|
68
79
|
return {
|
|
69
|
-
worldX: (
|
|
70
|
-
worldY: (
|
|
80
|
+
worldX: (w - l.x) / l.scale,
|
|
81
|
+
worldY: (v - l.y) / l.scale
|
|
71
82
|
};
|
|
72
|
-
},
|
|
73
|
-
const o =
|
|
83
|
+
}, f = (t, r, n) => {
|
|
84
|
+
const o = m(r, n);
|
|
74
85
|
o && e.widgetActions.addWidgetAtCursor(t, o.worldX, o.worldY);
|
|
75
86
|
};
|
|
76
87
|
return (() => {
|
|
77
|
-
var t =
|
|
78
|
-
return c(r, a(
|
|
88
|
+
var t = E(), r = t.firstChild;
|
|
89
|
+
return c(r, a(A, {
|
|
79
90
|
get widgetDefinitions() {
|
|
80
91
|
return e.widgetDefinitions();
|
|
81
92
|
},
|
|
@@ -130,7 +141,7 @@ function U(i) {
|
|
|
130
141
|
get onRequestDelete() {
|
|
131
142
|
return e.widgetActions.deleteWidget;
|
|
132
143
|
}
|
|
133
|
-
})), c(t, a(
|
|
144
|
+
})), c(t, a(M, {
|
|
134
145
|
get locked() {
|
|
135
146
|
return e.locked();
|
|
136
147
|
},
|
|
@@ -138,7 +149,7 @@ function U(i) {
|
|
|
138
149
|
return e.lock.toggle;
|
|
139
150
|
},
|
|
140
151
|
get shortcutLabel() {
|
|
141
|
-
return
|
|
152
|
+
return d() ?? void 0;
|
|
142
153
|
}
|
|
143
154
|
}), null), c(t, a(x, {
|
|
144
155
|
get widgetDefinitions() {
|
|
@@ -156,7 +167,7 @@ function U(i) {
|
|
|
156
167
|
get onShowAll() {
|
|
157
168
|
return e.filter.showAll;
|
|
158
169
|
},
|
|
159
|
-
onCreateAt:
|
|
170
|
+
onCreateAt: f
|
|
160
171
|
}), null), c(t, a(S, {
|
|
161
172
|
get scaleLabel() {
|
|
162
173
|
return e.scaleLabel();
|
|
@@ -167,16 +178,16 @@ function U(i) {
|
|
|
167
178
|
get onZoomIn() {
|
|
168
179
|
return e.hud.zoomIn;
|
|
169
180
|
}
|
|
170
|
-
}), null), c(t, a(
|
|
181
|
+
}), null), c(t, a(C, {
|
|
171
182
|
get when() {
|
|
172
183
|
return e.contextMenu.state();
|
|
173
184
|
},
|
|
174
185
|
get children() {
|
|
175
|
-
return a(
|
|
186
|
+
return a(h, {
|
|
176
187
|
get children() {
|
|
177
188
|
return [(() => {
|
|
178
|
-
var n =
|
|
179
|
-
return
|
|
189
|
+
var n = R();
|
|
190
|
+
return p(n, "contextmenu", e.contextMenu.retarget, !0), n;
|
|
180
191
|
})(), a(D, {
|
|
181
192
|
get x() {
|
|
182
193
|
return e.contextMenu.position()?.left ?? 0;
|
|
@@ -191,10 +202,10 @@ function U(i) {
|
|
|
191
202
|
}
|
|
192
203
|
});
|
|
193
204
|
}
|
|
194
|
-
}), null),
|
|
205
|
+
}), null), k(() => W(t, `workbench-surface${i.class ? ` ${i.class}` : ""}`)), t;
|
|
195
206
|
})();
|
|
196
207
|
}
|
|
197
|
-
|
|
208
|
+
b(["contextmenu"]);
|
|
198
209
|
export {
|
|
199
|
-
|
|
210
|
+
P as WorkbenchSurface
|
|
200
211
|
};
|
|
@@ -4,4 +4,4 @@ export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchCont
|
|
|
4
4
|
export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
|
|
5
5
|
export { WIDGET_REGISTRY, createWorkbenchFilterState, getWidgetEntry, isValidWorkbenchWidgetType, resolveWorkbenchWidgetDefinitions, type WidgetRegistryEntry, } from './widgets/widgetRegistry';
|
|
6
6
|
export * from './types';
|
|
7
|
-
export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId, createWorkbenchProjectedRect, createWorkbenchRenderLayerMap, createWorkbenchWidgetSurfaceMetrics, resolveWorkbenchWidgetRenderMode, type WorkbenchRenderLayerMap, } from './workbenchHelpers';
|
|
7
|
+
export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId, createWorkbenchProjectedRect, createWorkbenchRenderLayerMap, createWorkbenchViewportCenteredOnWidget, createWorkbenchViewportFitForWidget, createWorkbenchWidgetSurfaceMetrics, resolveWorkbenchWidgetRenderMode, type WorkbenchRenderLayerMap, } from './workbenchHelpers';
|
|
@@ -36,6 +36,7 @@ export declare function useWorkbenchModel(options: UseWorkbenchModelOptions): {
|
|
|
36
36
|
openCanvasContextMenu: (event: InfiniteCanvasContextMenuEvent) => void;
|
|
37
37
|
openWidgetContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
|
|
38
38
|
selectWidget: (widgetId: string) => void;
|
|
39
|
+
clearSelection: () => void;
|
|
39
40
|
startOptimisticFront: (widgetId: string) => void;
|
|
40
41
|
commitFront: (widgetId: string) => void;
|
|
41
42
|
commitMove: (widgetId: string, position: {
|
|
@@ -66,6 +67,11 @@ export declare function useWorkbenchModel(options: UseWorkbenchModelOptions): {
|
|
|
66
67
|
focusWidget: (widget: WorkbenchWidgetItem, options?: {
|
|
67
68
|
centerViewport?: boolean;
|
|
68
69
|
}) => WorkbenchWidgetItem<WorkbenchWidgetType>;
|
|
70
|
+
fitWidget: (widget: WorkbenchWidgetItem) => WorkbenchWidgetItem<WorkbenchWidgetType>;
|
|
71
|
+
overviewWidget: (widget: WorkbenchWidgetItem) => WorkbenchWidgetItem<WorkbenchWidgetType>;
|
|
72
|
+
};
|
|
73
|
+
selection: {
|
|
74
|
+
clear: () => void;
|
|
69
75
|
};
|
|
70
76
|
widgetActions: {
|
|
71
77
|
deleteSelected: () => void;
|