@floegence/floe-webapp-core 0.36.0 → 0.36.2
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 +4 -4
- 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/ui/Dialog.js +115 -87
- package/dist/components/ui/FloatingWindow.js +158 -144
- package/dist/components/ui/dialogSurfaceScope.d.ts +14 -0
- package/dist/components/ui/dialogSurfaceScope.js +45 -0
- package/dist/components/workbench/WorkbenchCanvas.d.ts +2 -1
- package/dist/components/workbench/WorkbenchCanvas.js +54 -56
- package/dist/components/workbench/WorkbenchCanvasField.d.ts +25 -0
- package/dist/components/workbench/WorkbenchCanvasField.js +145 -0
- 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 +11 -2
- package/dist/components/workbench/WorkbenchWidget.js +112 -103
- 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/hooks/useOverlayMask.d.ts +11 -9
- package/dist/hooks/useOverlayMask.js +54 -52
- 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,7 +1,16 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
|
-
import type { WorkbenchWidgetItem } from './types';
|
|
2
|
+
import type { WorkbenchWidgetDefinition, WorkbenchWidgetItem, WorkbenchWidgetType } from './types';
|
|
3
3
|
export interface WorkbenchWidgetProps {
|
|
4
|
-
|
|
4
|
+
definition: WorkbenchWidgetDefinition;
|
|
5
|
+
widgetId: string;
|
|
6
|
+
widgetTitle: string;
|
|
7
|
+
widgetType: WorkbenchWidgetType;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
zIndex: number;
|
|
13
|
+
itemSnapshot: () => WorkbenchWidgetItem;
|
|
5
14
|
selected: boolean;
|
|
6
15
|
optimisticFront: boolean;
|
|
7
16
|
topZIndex: number;
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { startHotInteraction as
|
|
4
|
-
import { GripVertical as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
g?.abort(), g = void 0, w?.abort(), w = void 0, I(u)?.stopInteraction(), I(b)?.stopInteraction();
|
|
1
|
+
import { insert as u, createComponent as v, memo as E, effect as B, setAttribute as G, setStyleProperty as m, template as A, delegateEvents as N } from "solid-js/web";
|
|
2
|
+
import { createSignal as R, onCleanup as O, 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 data-floe-dialog-surface-host=true><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 [b, x] = R(null), [f, C] = R(null);
|
|
9
|
+
let h, w;
|
|
10
|
+
O(() => {
|
|
11
|
+
h?.abort(), h = void 0, w?.abort(), w = void 0, I(b)?.stopInteraction(), I(f)?.stopInteraction();
|
|
13
12
|
});
|
|
14
|
-
const M =
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
x:
|
|
18
|
-
y:
|
|
13
|
+
const M = () => b() !== null, k = () => f() !== null, y = H(() => {
|
|
14
|
+
const i = b();
|
|
15
|
+
return i ? {
|
|
16
|
+
x: i.worldX,
|
|
17
|
+
y: i.worldY
|
|
19
18
|
} : {
|
|
20
|
-
x:
|
|
21
|
-
y:
|
|
19
|
+
x: e.x,
|
|
20
|
+
y: e.y
|
|
22
21
|
};
|
|
23
|
-
}),
|
|
24
|
-
const
|
|
25
|
-
return
|
|
22
|
+
}), _ = H(() => {
|
|
23
|
+
const i = f();
|
|
24
|
+
return i ? {
|
|
25
|
+
width: i.width,
|
|
26
|
+
height: i.height
|
|
27
|
+
} : {
|
|
26
28
|
width: e.width,
|
|
27
29
|
height: e.height
|
|
28
|
-
} : {
|
|
29
|
-
width: i.item.width,
|
|
30
|
-
height: i.item.height
|
|
31
30
|
};
|
|
32
|
-
}),
|
|
33
|
-
const o = I(
|
|
31
|
+
}), $ = (i) => {
|
|
32
|
+
const o = I(b);
|
|
34
33
|
if (!o) return;
|
|
35
34
|
const a = {
|
|
36
35
|
x: o.worldX,
|
|
@@ -38,23 +37,23 @@ function ot(i) {
|
|
|
38
37
|
}, r = {
|
|
39
38
|
x: o.startWorldX,
|
|
40
39
|
y: o.startWorldY
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
}, F = (
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
const o =
|
|
40
|
+
}, l = i && (Math.abs(a.x - r.x) > 1 || Math.abs(a.y - r.y) > 1);
|
|
41
|
+
e.onCommitFront(e.widgetId), l && e.onCommitMove(e.widgetId, a), o.stopInteraction(), x(null), h?.abort(), h = void 0;
|
|
42
|
+
}, F = (i) => {
|
|
43
|
+
if (i.button !== 0 || e.locked) return;
|
|
44
|
+
i.preventDefault(), i.stopPropagation(), h?.abort(), e.onStartOptimisticFront(e.widgetId);
|
|
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.x,
|
|
54
|
+
startWorldY: e.y,
|
|
55
|
+
worldX: e.x,
|
|
56
|
+
worldY: e.y,
|
|
58
57
|
moved: !1,
|
|
59
58
|
scale: a,
|
|
60
59
|
stopInteraction: o
|
|
@@ -62,108 +61,118 @@ function ot(i) {
|
|
|
62
61
|
const r = (t) => {
|
|
63
62
|
x((n) => {
|
|
64
63
|
if (!n || n.pointerId !== t.pointerId) return n;
|
|
65
|
-
const c = n.startWorldX + (t.clientX - n.startClientX) / n.scale,
|
|
64
|
+
const c = n.startWorldX + (t.clientX - n.startClientX) / n.scale, g = n.startWorldY + (t.clientY - n.startClientY) / n.scale;
|
|
66
65
|
return {
|
|
67
66
|
...n,
|
|
68
67
|
worldX: c,
|
|
69
|
-
worldY:
|
|
70
|
-
moved: n.moved || Math.abs(c - n.startWorldX) > 2 || Math.abs(
|
|
68
|
+
worldY: g,
|
|
69
|
+
moved: n.moved || Math.abs(c - n.startWorldX) > 2 || Math.abs(g - n.startWorldY) > 2
|
|
71
70
|
};
|
|
72
71
|
});
|
|
73
|
-
},
|
|
74
|
-
t.pointerId ===
|
|
72
|
+
}, l = (t) => {
|
|
73
|
+
t.pointerId === i.pointerId && $(!0);
|
|
75
74
|
}, s = (t) => {
|
|
76
|
-
t.pointerId ===
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
signal:
|
|
80
|
-
}), window.addEventListener("pointerup",
|
|
75
|
+
t.pointerId === i.pointerId && $(!1);
|
|
76
|
+
}, d = new AbortController();
|
|
77
|
+
h = d, window.addEventListener("pointermove", r, {
|
|
78
|
+
signal: d.signal
|
|
79
|
+
}), window.addEventListener("pointerup", l, {
|
|
81
80
|
once: !0,
|
|
82
|
-
signal:
|
|
81
|
+
signal: d.signal
|
|
83
82
|
}), window.addEventListener("pointercancel", s, {
|
|
84
83
|
once: !0,
|
|
85
|
-
signal:
|
|
84
|
+
signal: d.signal
|
|
86
85
|
});
|
|
87
|
-
}, S = (
|
|
88
|
-
const o = I(
|
|
86
|
+
}, S = (i) => {
|
|
87
|
+
const o = I(f);
|
|
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.widgetId, a), o.stopInteraction(), C(null), w?.abort(), w = void 0;
|
|
94
|
+
}, T = (i) => {
|
|
95
|
+
if (i.button !== 0 || e.locked) return;
|
|
96
|
+
i.preventDefault(), i.stopPropagation(), w?.abort(), e.onStartOptimisticFront(e.widgetId);
|
|
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.width,
|
|
106
|
+
startHeight: e.height,
|
|
107
|
+
width: e.width,
|
|
108
|
+
height: e.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), g = Math.max(K, n.startHeight + (t.clientY - n.startClientY) / n.scale);
|
|
117
116
|
return {
|
|
118
117
|
...n,
|
|
119
118
|
width: c,
|
|
120
|
-
height:
|
|
119
|
+
height: g
|
|
121
120
|
};
|
|
122
121
|
});
|
|
123
|
-
},
|
|
124
|
-
t.pointerId ===
|
|
122
|
+
}, l = (t) => {
|
|
123
|
+
t.pointerId === i.pointerId && S(!0);
|
|
125
124
|
}, s = (t) => {
|
|
126
|
-
t.pointerId ===
|
|
127
|
-
},
|
|
128
|
-
w =
|
|
129
|
-
signal:
|
|
130
|
-
}), window.addEventListener("pointerup",
|
|
125
|
+
t.pointerId === i.pointerId && S(!1);
|
|
126
|
+
}, d = new AbortController();
|
|
127
|
+
w = d, window.addEventListener("pointermove", r, {
|
|
128
|
+
signal: d.signal
|
|
129
|
+
}), window.addEventListener("pointerup", l, {
|
|
131
130
|
once: !0,
|
|
132
|
-
signal:
|
|
131
|
+
signal: d.signal
|
|
133
132
|
}), window.addEventListener("pointercancel", s, {
|
|
134
133
|
once: !0,
|
|
135
|
-
signal:
|
|
134
|
+
signal: d.signal
|
|
136
135
|
});
|
|
137
136
|
};
|
|
138
137
|
return (() => {
|
|
139
|
-
var
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
t.preventDefault(), t.stopPropagation(),
|
|
144
|
-
}, a.$$pointerdown = F,
|
|
138
|
+
var i = Z(), o = i.firstChild, a = o.firstChild, r = a.nextSibling, l = r.firstChild, s = r.nextSibling, d = o.nextSibling;
|
|
139
|
+
return i.$$click = () => {
|
|
140
|
+
e.onSelect(e.widgetId), e.onCommitFront(e.widgetId);
|
|
141
|
+
}, i.$$contextmenu = (t) => {
|
|
142
|
+
t.preventDefault(), t.stopPropagation(), e.onContextMenu(t, e.itemSnapshot());
|
|
143
|
+
}, a.$$pointerdown = F, u(a, v(q, {
|
|
145
144
|
class: "w-3.5 h-3.5"
|
|
146
|
-
})),
|
|
147
|
-
const t =
|
|
145
|
+
})), u(r, () => {
|
|
146
|
+
const t = e.definition.icon;
|
|
148
147
|
return v(t, {
|
|
149
148
|
class: "w-3.5 h-3.5"
|
|
150
149
|
});
|
|
151
|
-
},
|
|
152
|
-
t.stopPropagation(), t.preventDefault(),
|
|
153
|
-
}, s.$$pointerdown = (t) => t.stopPropagation(),
|
|
150
|
+
}, l), u(l, () => e.widgetTitle), s.$$click = (t) => {
|
|
151
|
+
t.stopPropagation(), t.preventDefault(), e.onRequestDelete(e.widgetId);
|
|
152
|
+
}, s.$$pointerdown = (t) => t.stopPropagation(), u(s, v(V, {
|
|
154
153
|
class: "w-3 h-3"
|
|
155
|
-
})),
|
|
156
|
-
const t =
|
|
157
|
-
return v(t, {
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
})), u(d, () => {
|
|
155
|
+
const t = e.definition.body;
|
|
156
|
+
return v(t, {
|
|
157
|
+
get widgetId() {
|
|
158
|
+
return e.widgetId;
|
|
159
|
+
},
|
|
160
|
+
get title() {
|
|
161
|
+
return e.widgetTitle;
|
|
162
|
+
},
|
|
163
|
+
get type() {
|
|
164
|
+
return e.widgetType;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}), u(i, (() => {
|
|
168
|
+
var t = E(() => !!e.locked);
|
|
160
169
|
return () => t() ? null : (() => {
|
|
161
|
-
var n =
|
|
162
|
-
return n.$$pointerdown =
|
|
170
|
+
var n = j();
|
|
171
|
+
return n.$$pointerdown = T, n;
|
|
163
172
|
})();
|
|
164
|
-
})(), null),
|
|
165
|
-
var n = !!
|
|
166
|
-
return n !== t.e &&
|
|
173
|
+
})(), null), B((t) => {
|
|
174
|
+
var n = !!e.selected, c = !!M(), g = !!k(), X = !!e.filtered, z = e.widgetId, Y = `translate(${y().x}px, ${y().y}px)`, W = `${_().width}px`, L = `${_().height}px`, D = M() || k() || e.optimisticFront ? `${e.topZIndex + 1}` : `${e.zIndex}`;
|
|
175
|
+
return n !== t.e && i.classList.toggle("is-selected", t.e = n), c !== t.t && i.classList.toggle("is-dragging", t.t = c), g !== t.a && i.classList.toggle("is-resizing", t.a = g), X !== t.o && i.classList.toggle("is-filtered-out", t.o = X), z !== t.i && G(i, "data-floe-workbench-widget-id", t.i = z), Y !== t.n && m(i, "transform", t.n = Y), W !== t.s && m(i, "width", t.s = W), L !== t.h && m(i, "height", t.h = L), D !== t.r && m(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
|
+
N(["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
|
};
|