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