@floegence/floe-webapp-core 0.35.58 → 0.36.0
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 +47 -50
- package/dist/components/deck/DeckContextMenu.d.ts +22 -0
- package/dist/components/deck/DeckContextMenu.js +73 -0
- package/dist/components/deck/DeckGrid.js +147 -104
- package/dist/components/deck/DeckTopBar.js +74 -96
- package/dist/components/deck/WidgetFrame.d.ts +7 -1
- package/dist/components/deck/WidgetFrame.js +60 -52
- package/dist/components/deck/index.d.ts +1 -0
- package/dist/components/ui/InfiniteCanvas.d.ts +2 -0
- package/dist/components/ui/InfiniteCanvas.js +43 -37
- package/dist/components/workbench/WorkbenchCanvas.d.ts +28 -0
- package/dist/components/workbench/WorkbenchCanvas.js +79 -0
- package/dist/components/workbench/WorkbenchContextMenu.d.ts +24 -0
- package/dist/components/workbench/WorkbenchContextMenu.js +44 -0
- package/dist/components/workbench/WorkbenchFilterBar.d.ts +16 -0
- package/dist/components/workbench/WorkbenchFilterBar.js +266 -0
- package/dist/components/workbench/WorkbenchHud.d.ts +6 -0
- package/dist/components/workbench/WorkbenchHud.js +17 -0
- package/dist/components/workbench/WorkbenchLockButton.d.ts +6 -0
- package/dist/components/workbench/WorkbenchLockButton.js +49 -0
- package/dist/components/workbench/WorkbenchOverlay.d.ts +18 -0
- package/dist/components/workbench/WorkbenchOverlay.js +107 -0
- package/dist/components/workbench/WorkbenchSurface.d.ts +21 -0
- package/dist/components/workbench/WorkbenchSurface.js +183 -0
- package/dist/components/workbench/WorkbenchWidget.d.ts +25 -0
- package/dist/components/workbench/WorkbenchWidget.js +183 -0
- package/dist/components/workbench/index.d.ts +7 -0
- package/dist/components/workbench/types.d.ts +39 -0
- package/dist/components/workbench/types.js +25 -0
- package/dist/components/workbench/useWorkbenchModel.d.ts +70 -0
- package/dist/components/workbench/useWorkbenchModel.js +259 -0
- package/dist/components/workbench/widgets/CodeEditorWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/CodeEditorWidget.js +144 -0
- package/dist/components/workbench/widgets/FileBrowserWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/FileBrowserWidget.js +142 -0
- package/dist/components/workbench/widgets/LogViewerWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/LogViewerWidget.js +86 -0
- package/dist/components/workbench/widgets/SystemMonitorWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/SystemMonitorWidget.js +122 -0
- package/dist/components/workbench/widgets/TerminalWidget.d.ts +1 -0
- package/dist/components/workbench/widgets/TerminalWidget.js +70 -0
- package/dist/components/workbench/widgets/widgetRegistry.d.ts +13 -0
- package/dist/components/workbench/widgets/widgetRegistry.js +50 -0
- package/dist/components/workbench/workbenchHelpers.d.ts +22 -0
- package/dist/components/workbench/workbenchHelpers.js +176 -0
- package/dist/deck.js +14 -12
- package/dist/full.js +381 -379
- package/dist/hooks/useDeckDrag.js +15 -15
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -0
- package/dist/ui.css +4 -0
- package/dist/workbench.css +1220 -0
- package/dist/workbench.d.ts +1 -0
- package/dist/workbench.js +22 -0
- package/package.json +5 -1
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { insert as c, createComponent as i, Portal as v, addEventListener as s, effect as h, className as p, template as d, delegateEvents as k } from "solid-js/web";
|
|
2
|
+
import { createEffect as b, onCleanup as C, Show as W } from "solid-js";
|
|
3
|
+
import { isTypingElement as x } from "../../utils/dom.js";
|
|
4
|
+
import { WorkbenchCanvas as A } from "./WorkbenchCanvas.js";
|
|
5
|
+
import { WorkbenchContextMenu as M } from "./WorkbenchContextMenu.js";
|
|
6
|
+
import { WorkbenchFilterBar as S } from "./WorkbenchFilterBar.js";
|
|
7
|
+
import { WorkbenchHud as y } from "./WorkbenchHud.js";
|
|
8
|
+
import { WorkbenchLockButton as F } from "./WorkbenchLockButton.js";
|
|
9
|
+
import { useWorkbenchModel as D } from "./useWorkbenchModel.js";
|
|
10
|
+
var L = /* @__PURE__ */ d("<div class=workbench-menu-backdrop data-floe-workbench-boundary=true>"), E = /* @__PURE__ */ d("<div><div class=workbench-surface__body data-floe-workbench-canvas-frame=true>");
|
|
11
|
+
const I = "F1";
|
|
12
|
+
function U(a) {
|
|
13
|
+
const e = D({
|
|
14
|
+
state: () => a.state(),
|
|
15
|
+
setState: (r) => a.setState(r),
|
|
16
|
+
onClose: () => {
|
|
17
|
+
}
|
|
18
|
+
}), u = () => a.lockShortcut === void 0 ? I : a.lockShortcut;
|
|
19
|
+
b(() => {
|
|
20
|
+
if (a.enableKeyboard === !1 || typeof document > "u") return;
|
|
21
|
+
const r = u(), o = (t) => {
|
|
22
|
+
if (t.defaultPrevented || t.isComposing) return;
|
|
23
|
+
if (r !== null && t.key === r) {
|
|
24
|
+
t.preventDefault(), e.lock.toggle();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const n = t.target;
|
|
28
|
+
if (!(n instanceof Element && x(n)))
|
|
29
|
+
switch (t.key) {
|
|
30
|
+
case "ArrowUp":
|
|
31
|
+
t.preventDefault(), e.navigation.handleArrowNavigation("up");
|
|
32
|
+
break;
|
|
33
|
+
case "ArrowDown":
|
|
34
|
+
t.preventDefault(), e.navigation.handleArrowNavigation("down");
|
|
35
|
+
break;
|
|
36
|
+
case "ArrowLeft":
|
|
37
|
+
t.preventDefault(), e.navigation.handleArrowNavigation("left");
|
|
38
|
+
break;
|
|
39
|
+
case "ArrowRight":
|
|
40
|
+
t.preventDefault(), e.navigation.handleArrowNavigation("right");
|
|
41
|
+
break;
|
|
42
|
+
case "Delete":
|
|
43
|
+
case "Backspace":
|
|
44
|
+
e.selectedWidgetId() && (t.preventDefault(), e.widgetActions.deleteSelected());
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
document.addEventListener("keydown", o, !0), C(() => document.removeEventListener("keydown", o, !0));
|
|
49
|
+
});
|
|
50
|
+
const g = (r, o) => {
|
|
51
|
+
const t = document.querySelector('[data-floe-workbench-canvas-frame="true"]');
|
|
52
|
+
if (!t) return null;
|
|
53
|
+
const n = t.getBoundingClientRect();
|
|
54
|
+
if (r < n.left || r > n.right || o < n.top || o > n.bottom)
|
|
55
|
+
return null;
|
|
56
|
+
const f = r - n.left, w = o - n.top, l = e.viewport();
|
|
57
|
+
return {
|
|
58
|
+
worldX: (f - l.x) / l.scale,
|
|
59
|
+
worldY: (w - l.y) / l.scale
|
|
60
|
+
};
|
|
61
|
+
}, m = (r, o, t) => {
|
|
62
|
+
const n = g(o, t);
|
|
63
|
+
n && e.widgetActions.addWidgetAtCursor(r, n.worldX, n.worldY);
|
|
64
|
+
};
|
|
65
|
+
return (() => {
|
|
66
|
+
var r = E(), o = r.firstChild;
|
|
67
|
+
return c(o, i(A, {
|
|
68
|
+
get widgets() {
|
|
69
|
+
return e.widgets();
|
|
70
|
+
},
|
|
71
|
+
get viewport() {
|
|
72
|
+
return e.viewport();
|
|
73
|
+
},
|
|
74
|
+
get selectedWidgetId() {
|
|
75
|
+
return e.selectedWidgetId();
|
|
76
|
+
},
|
|
77
|
+
get optimisticFrontWidgetId() {
|
|
78
|
+
return e.optimisticFrontWidgetId();
|
|
79
|
+
},
|
|
80
|
+
get topZIndex() {
|
|
81
|
+
return e.topZIndex();
|
|
82
|
+
},
|
|
83
|
+
get locked() {
|
|
84
|
+
return e.locked();
|
|
85
|
+
},
|
|
86
|
+
get filters() {
|
|
87
|
+
return e.filters();
|
|
88
|
+
},
|
|
89
|
+
get setCanvasFrameRef() {
|
|
90
|
+
return e.setCanvasFrameRef;
|
|
91
|
+
},
|
|
92
|
+
get onViewportCommit() {
|
|
93
|
+
return e.canvas.commitViewport;
|
|
94
|
+
},
|
|
95
|
+
get onCanvasContextMenu() {
|
|
96
|
+
return e.canvas.openCanvasContextMenu;
|
|
97
|
+
},
|
|
98
|
+
get onSelectWidget() {
|
|
99
|
+
return e.canvas.selectWidget;
|
|
100
|
+
},
|
|
101
|
+
get onWidgetContextMenu() {
|
|
102
|
+
return e.canvas.openWidgetContextMenu;
|
|
103
|
+
},
|
|
104
|
+
get onStartOptimisticFront() {
|
|
105
|
+
return e.canvas.startOptimisticFront;
|
|
106
|
+
},
|
|
107
|
+
get onCommitFront() {
|
|
108
|
+
return e.canvas.commitFront;
|
|
109
|
+
},
|
|
110
|
+
get onCommitMove() {
|
|
111
|
+
return e.canvas.commitMove;
|
|
112
|
+
},
|
|
113
|
+
get onCommitResize() {
|
|
114
|
+
return e.canvas.commitResize;
|
|
115
|
+
},
|
|
116
|
+
get onRequestDelete() {
|
|
117
|
+
return e.widgetActions.deleteWidget;
|
|
118
|
+
}
|
|
119
|
+
})), c(r, i(F, {
|
|
120
|
+
get locked() {
|
|
121
|
+
return e.locked();
|
|
122
|
+
},
|
|
123
|
+
get onToggle() {
|
|
124
|
+
return e.lock.toggle;
|
|
125
|
+
},
|
|
126
|
+
get shortcutLabel() {
|
|
127
|
+
return u() ?? void 0;
|
|
128
|
+
}
|
|
129
|
+
}), null), c(r, i(S, {
|
|
130
|
+
get widgets() {
|
|
131
|
+
return e.widgets();
|
|
132
|
+
},
|
|
133
|
+
get filters() {
|
|
134
|
+
return e.filters();
|
|
135
|
+
},
|
|
136
|
+
get onSoloFilter() {
|
|
137
|
+
return e.filter.solo;
|
|
138
|
+
},
|
|
139
|
+
get onShowAll() {
|
|
140
|
+
return e.filter.showAll;
|
|
141
|
+
},
|
|
142
|
+
onCreateAt: m
|
|
143
|
+
}), null), c(r, i(y, {
|
|
144
|
+
get scaleLabel() {
|
|
145
|
+
return e.scaleLabel();
|
|
146
|
+
},
|
|
147
|
+
get onZoomOut() {
|
|
148
|
+
return e.hud.zoomOut;
|
|
149
|
+
},
|
|
150
|
+
get onZoomIn() {
|
|
151
|
+
return e.hud.zoomIn;
|
|
152
|
+
}
|
|
153
|
+
}), null), c(r, i(W, {
|
|
154
|
+
get when() {
|
|
155
|
+
return e.contextMenu.state();
|
|
156
|
+
},
|
|
157
|
+
get children() {
|
|
158
|
+
return i(v, {
|
|
159
|
+
get children() {
|
|
160
|
+
return [(() => {
|
|
161
|
+
var t = L();
|
|
162
|
+
return s(t, "contextmenu", e.contextMenu.retarget, !0), s(t, "click", e.contextMenu.close, !0), t;
|
|
163
|
+
})(), i(M, {
|
|
164
|
+
get x() {
|
|
165
|
+
return e.contextMenu.position()?.left ?? 0;
|
|
166
|
+
},
|
|
167
|
+
get y() {
|
|
168
|
+
return e.contextMenu.position()?.top ?? 0;
|
|
169
|
+
},
|
|
170
|
+
get items() {
|
|
171
|
+
return e.contextMenu.items();
|
|
172
|
+
}
|
|
173
|
+
})];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}), null), h(() => p(r, `workbench-surface${a.class ? ` ${a.class}` : ""}`)), r;
|
|
178
|
+
})();
|
|
179
|
+
}
|
|
180
|
+
k(["click", "contextmenu"]);
|
|
181
|
+
export {
|
|
182
|
+
U as WorkbenchSurface
|
|
183
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
import type { WorkbenchWidgetItem } from './types';
|
|
3
|
+
export interface WorkbenchWidgetProps {
|
|
4
|
+
item: WorkbenchWidgetItem;
|
|
5
|
+
selected: boolean;
|
|
6
|
+
optimisticFront: boolean;
|
|
7
|
+
topZIndex: number;
|
|
8
|
+
viewportScale: number;
|
|
9
|
+
locked: boolean;
|
|
10
|
+
filtered: boolean;
|
|
11
|
+
onSelect: (widgetId: string) => void;
|
|
12
|
+
onContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
|
|
13
|
+
onStartOptimisticFront: (widgetId: string) => void;
|
|
14
|
+
onCommitFront: (widgetId: string) => void;
|
|
15
|
+
onCommitMove: (widgetId: string, position: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}) => void;
|
|
19
|
+
onCommitResize: (widgetId: string, size: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}) => void;
|
|
23
|
+
onRequestDelete: (widgetId: string) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function WorkbenchWidget(props: WorkbenchWidgetProps): JSX.Element;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { insert as m, createComponent as v, memo as G, effect as N, setAttribute as O, setStyleProperty as f, template as E, delegateEvents as T } from "solid-js/web";
|
|
2
|
+
import { createSignal as P, onCleanup as q, untrack as I, createMemo as y } from "solid-js";
|
|
3
|
+
import { startHotInteraction as A } from "../../utils/hotInteraction.js";
|
|
4
|
+
import { GripVertical as V, X as Z } from "../icons/index.js";
|
|
5
|
+
import { getWidgetEntry as j } from "./widgets/widgetRegistry.js";
|
|
6
|
+
var J = /* @__PURE__ */ E('<article class=workbench-widget><header class=workbench-widget__header><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title></span></div><button type=button class=workbench-widget__close aria-label="Remove widget"data-floe-canvas-interactive=true></button></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), K = /* @__PURE__ */ E('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
|
|
7
|
+
const Q = 220, U = 160;
|
|
8
|
+
function ot(i) {
|
|
9
|
+
const [u, x] = P(null), [b, C] = P(null);
|
|
10
|
+
let g, w;
|
|
11
|
+
q(() => {
|
|
12
|
+
g?.abort(), g = void 0, w?.abort(), w = void 0, I(u)?.stopInteraction(), I(b)?.stopInteraction();
|
|
13
|
+
});
|
|
14
|
+
const M = y(() => j(i.item.type)), _ = () => u() !== null, k = () => b() !== null, $ = y(() => {
|
|
15
|
+
const e = u();
|
|
16
|
+
return e ? {
|
|
17
|
+
x: e.worldX,
|
|
18
|
+
y: e.worldY
|
|
19
|
+
} : {
|
|
20
|
+
x: i.item.x,
|
|
21
|
+
y: i.item.y
|
|
22
|
+
};
|
|
23
|
+
}), X = y(() => {
|
|
24
|
+
const e = b();
|
|
25
|
+
return e ? {
|
|
26
|
+
width: e.width,
|
|
27
|
+
height: e.height
|
|
28
|
+
} : {
|
|
29
|
+
width: i.item.width,
|
|
30
|
+
height: i.item.height
|
|
31
|
+
};
|
|
32
|
+
}), z = (e) => {
|
|
33
|
+
const o = I(u);
|
|
34
|
+
if (!o) return;
|
|
35
|
+
const a = {
|
|
36
|
+
x: o.worldX,
|
|
37
|
+
y: o.worldY
|
|
38
|
+
}, r = {
|
|
39
|
+
x: o.startWorldX,
|
|
40
|
+
y: o.startWorldY
|
|
41
|
+
}, d = e && (Math.abs(a.x - r.x) > 1 || Math.abs(a.y - r.y) > 1);
|
|
42
|
+
i.onCommitFront(i.item.id), d && i.onCommitMove(i.item.id, a), o.stopInteraction(), x(null), g?.abort(), g = void 0;
|
|
43
|
+
}, F = (e) => {
|
|
44
|
+
if (e.button !== 0 || i.locked) return;
|
|
45
|
+
e.preventDefault(), e.stopPropagation(), g?.abort(), i.onStartOptimisticFront(i.item.id);
|
|
46
|
+
const o = A({
|
|
47
|
+
kind: "drag",
|
|
48
|
+
cursor: "grabbing"
|
|
49
|
+
}), a = Math.max(i.viewportScale, 1e-3);
|
|
50
|
+
x({
|
|
51
|
+
pointerId: e.pointerId,
|
|
52
|
+
startClientX: e.clientX,
|
|
53
|
+
startClientY: e.clientY,
|
|
54
|
+
startWorldX: i.item.x,
|
|
55
|
+
startWorldY: i.item.y,
|
|
56
|
+
worldX: i.item.x,
|
|
57
|
+
worldY: i.item.y,
|
|
58
|
+
moved: !1,
|
|
59
|
+
scale: a,
|
|
60
|
+
stopInteraction: o
|
|
61
|
+
});
|
|
62
|
+
const r = (t) => {
|
|
63
|
+
x((n) => {
|
|
64
|
+
if (!n || n.pointerId !== t.pointerId) return n;
|
|
65
|
+
const c = n.startWorldX + (t.clientX - n.startClientX) / n.scale, h = n.startWorldY + (t.clientY - n.startClientY) / n.scale;
|
|
66
|
+
return {
|
|
67
|
+
...n,
|
|
68
|
+
worldX: c,
|
|
69
|
+
worldY: h,
|
|
70
|
+
moved: n.moved || Math.abs(c - n.startWorldX) > 2 || Math.abs(h - n.startWorldY) > 2
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
}, d = (t) => {
|
|
74
|
+
t.pointerId === e.pointerId && z(!0);
|
|
75
|
+
}, s = (t) => {
|
|
76
|
+
t.pointerId === e.pointerId && z(!1);
|
|
77
|
+
}, l = new AbortController();
|
|
78
|
+
g = l, window.addEventListener("pointermove", r, {
|
|
79
|
+
signal: l.signal
|
|
80
|
+
}), window.addEventListener("pointerup", d, {
|
|
81
|
+
once: !0,
|
|
82
|
+
signal: l.signal
|
|
83
|
+
}), window.addEventListener("pointercancel", s, {
|
|
84
|
+
once: !0,
|
|
85
|
+
signal: l.signal
|
|
86
|
+
});
|
|
87
|
+
}, S = (e) => {
|
|
88
|
+
const o = I(b);
|
|
89
|
+
if (!o) return;
|
|
90
|
+
const a = {
|
|
91
|
+
width: o.width,
|
|
92
|
+
height: o.height
|
|
93
|
+
}, r = Math.abs(o.width - o.startWidth) > 1 || Math.abs(o.height - o.startHeight) > 1;
|
|
94
|
+
e && r && i.onCommitResize(i.item.id, a), o.stopInteraction(), C(null), w?.abort(), w = void 0;
|
|
95
|
+
}, B = (e) => {
|
|
96
|
+
if (e.button !== 0 || i.locked) return;
|
|
97
|
+
e.preventDefault(), e.stopPropagation(), w?.abort(), i.onStartOptimisticFront(i.item.id);
|
|
98
|
+
const o = A({
|
|
99
|
+
kind: "drag",
|
|
100
|
+
cursor: "nwse-resize"
|
|
101
|
+
}), a = Math.max(i.viewportScale, 1e-3);
|
|
102
|
+
C({
|
|
103
|
+
pointerId: e.pointerId,
|
|
104
|
+
startClientX: e.clientX,
|
|
105
|
+
startClientY: e.clientY,
|
|
106
|
+
startWidth: i.item.width,
|
|
107
|
+
startHeight: i.item.height,
|
|
108
|
+
width: i.item.width,
|
|
109
|
+
height: i.item.height,
|
|
110
|
+
scale: a,
|
|
111
|
+
stopInteraction: o
|
|
112
|
+
});
|
|
113
|
+
const r = (t) => {
|
|
114
|
+
C((n) => {
|
|
115
|
+
if (!n || n.pointerId !== t.pointerId) return n;
|
|
116
|
+
const c = Math.max(Q, n.startWidth + (t.clientX - n.startClientX) / n.scale), h = Math.max(U, n.startHeight + (t.clientY - n.startClientY) / n.scale);
|
|
117
|
+
return {
|
|
118
|
+
...n,
|
|
119
|
+
width: c,
|
|
120
|
+
height: h
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
}, d = (t) => {
|
|
124
|
+
t.pointerId === e.pointerId && S(!0);
|
|
125
|
+
}, s = (t) => {
|
|
126
|
+
t.pointerId === e.pointerId && S(!1);
|
|
127
|
+
}, l = new AbortController();
|
|
128
|
+
w = l, window.addEventListener("pointermove", r, {
|
|
129
|
+
signal: l.signal
|
|
130
|
+
}), window.addEventListener("pointerup", d, {
|
|
131
|
+
once: !0,
|
|
132
|
+
signal: l.signal
|
|
133
|
+
}), window.addEventListener("pointercancel", s, {
|
|
134
|
+
once: !0,
|
|
135
|
+
signal: l.signal
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
return (() => {
|
|
139
|
+
var e = J(), o = e.firstChild, a = o.firstChild, r = a.nextSibling, d = r.firstChild, s = r.nextSibling, l = o.nextSibling;
|
|
140
|
+
return e.$$click = () => {
|
|
141
|
+
i.onSelect(i.item.id), i.onCommitFront(i.item.id);
|
|
142
|
+
}, e.$$contextmenu = (t) => {
|
|
143
|
+
t.preventDefault(), t.stopPropagation(), i.onContextMenu(t, i.item);
|
|
144
|
+
}, a.$$pointerdown = F, m(a, v(V, {
|
|
145
|
+
class: "w-3.5 h-3.5"
|
|
146
|
+
})), m(r, () => {
|
|
147
|
+
const t = M().icon;
|
|
148
|
+
return v(t, {
|
|
149
|
+
class: "w-3.5 h-3.5"
|
|
150
|
+
});
|
|
151
|
+
}, d), m(d, () => i.item.title), s.$$click = (t) => {
|
|
152
|
+
t.stopPropagation(), t.preventDefault(), i.onRequestDelete(i.item.id);
|
|
153
|
+
}, s.$$pointerdown = (t) => t.stopPropagation(), m(s, v(Z, {
|
|
154
|
+
class: "w-3 h-3"
|
|
155
|
+
})), m(l, () => {
|
|
156
|
+
const t = M().body;
|
|
157
|
+
return v(t, {});
|
|
158
|
+
}), m(e, (() => {
|
|
159
|
+
var t = G(() => !!i.locked);
|
|
160
|
+
return () => t() ? null : (() => {
|
|
161
|
+
var n = K();
|
|
162
|
+
return n.$$pointerdown = B, n;
|
|
163
|
+
})();
|
|
164
|
+
})(), null), N((t) => {
|
|
165
|
+
var n = !!i.selected, c = !!_(), h = !!k(), Y = !!i.filtered, W = i.item.id, L = `translate(${$().x}px, ${$().y}px)`, D = `${X().width}px`, R = `${X().height}px`, H = _() || k() || i.optimisticFront ? `${i.topZIndex + 1}` : `${i.item.z_index}`;
|
|
166
|
+
return n !== t.e && e.classList.toggle("is-selected", t.e = n), c !== t.t && e.classList.toggle("is-dragging", t.t = c), h !== t.a && e.classList.toggle("is-resizing", t.a = h), Y !== t.o && e.classList.toggle("is-filtered-out", t.o = Y), W !== t.i && O(e, "data-floe-workbench-widget-id", t.i = W), L !== t.n && f(e, "transform", t.n = L), D !== t.s && f(e, "width", t.s = D), R !== t.h && f(e, "height", t.h = R), H !== t.r && f(e, "z-index", t.r = H), t;
|
|
167
|
+
}, {
|
|
168
|
+
e: void 0,
|
|
169
|
+
t: void 0,
|
|
170
|
+
a: void 0,
|
|
171
|
+
o: void 0,
|
|
172
|
+
i: void 0,
|
|
173
|
+
n: void 0,
|
|
174
|
+
s: void 0,
|
|
175
|
+
h: void 0,
|
|
176
|
+
r: void 0
|
|
177
|
+
}), e;
|
|
178
|
+
})();
|
|
179
|
+
}
|
|
180
|
+
T(["contextmenu", "click", "pointerdown"]);
|
|
181
|
+
export {
|
|
182
|
+
ot as WorkbenchWidget
|
|
183
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { WorkbenchOverlay, type WorkbenchOverlayProps, } from './WorkbenchOverlay';
|
|
2
|
+
export { WorkbenchSurface, type WorkbenchSurfaceProps, } from './WorkbenchSurface';
|
|
3
|
+
export { WorkbenchContextMenu, type WorkbenchContextMenuItem, type WorkbenchContextMenuProps, } from './WorkbenchContextMenu';
|
|
4
|
+
export { useWorkbenchModel, type UseWorkbenchModelOptions } from './useWorkbenchModel';
|
|
5
|
+
export { WIDGET_REGISTRY, getWidgetEntry, type WidgetRegistryEntry } from './widgets/widgetRegistry';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId, } from './workbenchHelpers';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type WorkbenchWidgetType = 'terminal' | 'file-browser' | 'system-monitor' | 'log-viewer' | 'code-editor';
|
|
2
|
+
export declare const WORKBENCH_WIDGET_TYPES: readonly WorkbenchWidgetType[];
|
|
3
|
+
export interface WorkbenchWidgetItem {
|
|
4
|
+
id: string;
|
|
5
|
+
type: WorkbenchWidgetType;
|
|
6
|
+
title: string;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
z_index: number;
|
|
12
|
+
created_at_unix_ms: number;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkbenchViewport {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
scale: number;
|
|
18
|
+
}
|
|
19
|
+
export interface WorkbenchState {
|
|
20
|
+
version: 1;
|
|
21
|
+
widgets: WorkbenchWidgetItem[];
|
|
22
|
+
viewport: WorkbenchViewport;
|
|
23
|
+
locked: boolean;
|
|
24
|
+
filters: Record<WorkbenchWidgetType, boolean>;
|
|
25
|
+
selectedWidgetId: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface WorkbenchContextMenuState {
|
|
28
|
+
clientX: number;
|
|
29
|
+
clientY: number;
|
|
30
|
+
worldX: number;
|
|
31
|
+
worldY: number;
|
|
32
|
+
widgetId?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export declare const DEFAULT_WIDGET_DIMENSIONS: Readonly<Record<WorkbenchWidgetType, {
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
}>>;
|
|
38
|
+
export declare const DEFAULT_WORKBENCH_VIEWPORT: WorkbenchViewport;
|
|
39
|
+
export declare const DEFAULT_FILTERS: Record<WorkbenchWidgetType, boolean>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const e = [
|
|
2
|
+
"terminal",
|
|
3
|
+
"file-browser",
|
|
4
|
+
"system-monitor",
|
|
5
|
+
"log-viewer",
|
|
6
|
+
"code-editor"
|
|
7
|
+
], t = {
|
|
8
|
+
terminal: { width: 480, height: 320 },
|
|
9
|
+
"file-browser": { width: 360, height: 400 },
|
|
10
|
+
"system-monitor": { width: 340, height: 280 },
|
|
11
|
+
"log-viewer": { width: 500, height: 300 },
|
|
12
|
+
"code-editor": { width: 520, height: 380 }
|
|
13
|
+
}, i = { x: 80, y: 60, scale: 1 }, r = {
|
|
14
|
+
terminal: !0,
|
|
15
|
+
"file-browser": !0,
|
|
16
|
+
"system-monitor": !0,
|
|
17
|
+
"log-viewer": !0,
|
|
18
|
+
"code-editor": !0
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
r as DEFAULT_FILTERS,
|
|
22
|
+
t as DEFAULT_WIDGET_DIMENSIONS,
|
|
23
|
+
i as DEFAULT_WORKBENCH_VIEWPORT,
|
|
24
|
+
e as WORKBENCH_WIDGET_TYPES
|
|
25
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { InfiniteCanvasContextMenuEvent } from '../../ui';
|
|
2
|
+
import { type WorkbenchContextMenuState, type WorkbenchState, type WorkbenchViewport, type WorkbenchWidgetItem, type WorkbenchWidgetType } from './types';
|
|
3
|
+
import type { WorkbenchContextMenuItem } from './WorkbenchContextMenu';
|
|
4
|
+
export interface UseWorkbenchModelOptions {
|
|
5
|
+
state: () => WorkbenchState;
|
|
6
|
+
setState: (updater: (prev: WorkbenchState) => WorkbenchState) => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useWorkbenchModel(options: UseWorkbenchModelOptions): {
|
|
10
|
+
widgets: import("solid-js").Accessor<WorkbenchWidgetItem[]>;
|
|
11
|
+
viewport: import("solid-js").Accessor<WorkbenchViewport>;
|
|
12
|
+
locked: import("solid-js").Accessor<boolean>;
|
|
13
|
+
filters: import("solid-js").Accessor<Record<WorkbenchWidgetType, boolean>>;
|
|
14
|
+
selectedWidgetId: import("solid-js").Accessor<string | null>;
|
|
15
|
+
topZIndex: import("solid-js").Accessor<number>;
|
|
16
|
+
scaleLabel: import("solid-js").Accessor<string>;
|
|
17
|
+
optimisticFrontWidgetId: import("solid-js").Accessor<string | null>;
|
|
18
|
+
setCanvasFrameRef: (el: HTMLDivElement | undefined) => void;
|
|
19
|
+
contextMenu: {
|
|
20
|
+
state: import("solid-js").Accessor<WorkbenchContextMenuState | null>;
|
|
21
|
+
items: import("solid-js").Accessor<WorkbenchContextMenuItem[]>;
|
|
22
|
+
position: import("solid-js").Accessor<{
|
|
23
|
+
left: number;
|
|
24
|
+
top: number;
|
|
25
|
+
} | undefined>;
|
|
26
|
+
close: () => null;
|
|
27
|
+
retarget: (event: MouseEvent) => void;
|
|
28
|
+
};
|
|
29
|
+
canvas: {
|
|
30
|
+
openCanvasContextMenu: (event: InfiniteCanvasContextMenuEvent) => void;
|
|
31
|
+
openWidgetContextMenu: (event: MouseEvent, item: WorkbenchWidgetItem) => void;
|
|
32
|
+
selectWidget: (widgetId: string) => void;
|
|
33
|
+
startOptimisticFront: (widgetId: string) => void;
|
|
34
|
+
commitFront: (widgetId: string) => void;
|
|
35
|
+
commitMove: (widgetId: string, position: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
}) => void;
|
|
39
|
+
commitResize: (widgetId: string, size: {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}) => void;
|
|
43
|
+
commitViewport: (next: WorkbenchViewport) => void;
|
|
44
|
+
};
|
|
45
|
+
hud: {
|
|
46
|
+
zoomIn: () => void;
|
|
47
|
+
zoomOut: () => void;
|
|
48
|
+
};
|
|
49
|
+
lock: {
|
|
50
|
+
toggle: () => void;
|
|
51
|
+
};
|
|
52
|
+
filter: {
|
|
53
|
+
toggle: (type: WorkbenchWidgetType) => void;
|
|
54
|
+
solo: (type: WorkbenchWidgetType) => void;
|
|
55
|
+
showAll: () => void;
|
|
56
|
+
};
|
|
57
|
+
navigation: {
|
|
58
|
+
handleArrowNavigation: (direction: "up" | "down" | "left" | "right") => void;
|
|
59
|
+
centerOnWidget: (widget: WorkbenchWidgetItem) => void;
|
|
60
|
+
focusWidget: (widget: WorkbenchWidgetItem) => void;
|
|
61
|
+
};
|
|
62
|
+
widgetActions: {
|
|
63
|
+
deleteSelected: () => void;
|
|
64
|
+
deleteWidget: (widgetId: string) => void;
|
|
65
|
+
addWidget: (type: WorkbenchWidgetType, worldX: number, worldY: number) => WorkbenchWidgetItem;
|
|
66
|
+
addWidgetAtCursor: (type: WorkbenchWidgetType, worldX: number, worldY: number) => WorkbenchWidgetItem;
|
|
67
|
+
addWidgetCentered: (type: WorkbenchWidgetType, worldX: number, worldY: number) => WorkbenchWidgetItem;
|
|
68
|
+
};
|
|
69
|
+
handleCloseRequest: () => void;
|
|
70
|
+
};
|