@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,122 +1,126 @@
|
|
|
1
|
-
import { createSignal as
|
|
2
|
-
import { ArrowUp as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { createSignal as _, createMemo as s } from "solid-js";
|
|
2
|
+
import { ArrowUp as gt, Copy as ut, Trash as ht } from "../icons/index.js";
|
|
3
|
+
import { getTopZIndex as ft, createContextMenuPosition as wt, createWorkbenchId as mt, findNearestWidget as Wt, clampScale as xt, WORKBENCH_CANVAS_ZOOM_STEP as R, WORKBENCH_CONTEXT_MENU_WIDTH_PX as St, estimateContextMenuHeight as pt } from "./workbenchHelpers.js";
|
|
4
|
+
import { resolveWorkbenchWidgetDefinitions as Ct, getWidgetEntry as q, createWorkbenchFilterState as kt } from "./widgets/widgetRegistry.js";
|
|
5
|
+
function At(c) {
|
|
6
|
+
const [f, w] = _(null), [B, A] = _(null), [S, P] = _({ width: 0, height: 0 }), l = c.state, u = s(() => l().widgets), a = s(() => l().viewport), v = s(() => l().locked), D = s(() => l().filters), p = s(() => l().selectedWidgetId), C = s(() => ft(u())), Z = s(() => `${Math.round(a().scale * 100)}%`), $ = () => typeof c.widgetDefinitions == "function" ? c.widgetDefinitions() : c.widgetDefinitions, h = s(
|
|
7
|
+
() => Ct($())
|
|
8
|
+
), j = (t) => {
|
|
9
|
+
t && P({ width: t.clientWidth, height: t.clientHeight });
|
|
10
|
+
}, K = (t) => {
|
|
11
|
+
w({
|
|
11
12
|
clientX: t.clientX,
|
|
12
13
|
clientY: t.clientY,
|
|
13
14
|
worldX: t.worldX,
|
|
14
15
|
worldY: t.worldY
|
|
15
16
|
});
|
|
16
|
-
},
|
|
17
|
-
|
|
17
|
+
}, L = (t, e) => {
|
|
18
|
+
m(e.id), w({
|
|
18
19
|
clientX: t.clientX,
|
|
19
20
|
clientY: t.clientY,
|
|
20
21
|
worldX: e.x,
|
|
21
22
|
worldY: e.y,
|
|
22
23
|
widgetId: e.id
|
|
23
24
|
});
|
|
24
|
-
},
|
|
25
|
-
const t =
|
|
25
|
+
}, g = () => w(null), U = (t) => l().widgets.find((e) => e.id === t) ?? null, k = (t) => l().widgets.find((e) => e.type === t) ?? null, T = s(() => {
|
|
26
|
+
const t = f();
|
|
26
27
|
if (!t) return [];
|
|
27
28
|
if (t.widgetId) {
|
|
28
|
-
const e =
|
|
29
|
+
const e = u().find((i) => i.id === t.widgetId), n = [];
|
|
29
30
|
return e && (n.push({
|
|
30
31
|
id: "bring-to-front",
|
|
31
32
|
kind: "action",
|
|
32
33
|
label: "Bring to Front",
|
|
33
|
-
icon:
|
|
34
|
+
icon: gt,
|
|
34
35
|
onSelect: () => {
|
|
35
|
-
|
|
36
|
+
m(e.id), g();
|
|
36
37
|
}
|
|
37
38
|
}), n.push({
|
|
38
39
|
id: "duplicate",
|
|
39
40
|
kind: "action",
|
|
40
41
|
label: "Duplicate",
|
|
41
|
-
icon:
|
|
42
|
+
icon: ut,
|
|
42
43
|
onSelect: () => {
|
|
43
|
-
|
|
44
|
+
z(e.type, e.x + 32, e.y + 32), g();
|
|
44
45
|
}
|
|
45
46
|
})), n.push({ id: "separator-delete", kind: "separator" }), n.push({
|
|
46
47
|
id: "delete",
|
|
47
48
|
kind: "action",
|
|
48
49
|
label: "Delete",
|
|
49
|
-
icon:
|
|
50
|
+
icon: ht,
|
|
50
51
|
destructive: !0,
|
|
51
52
|
onSelect: () => {
|
|
52
|
-
t.widgetId &&
|
|
53
|
+
t.widgetId && Y(t.widgetId), g();
|
|
53
54
|
}
|
|
54
55
|
}), n;
|
|
55
56
|
}
|
|
56
|
-
return
|
|
57
|
+
return h().map((e) => ({
|
|
57
58
|
id: `add-${e.type}`,
|
|
58
59
|
kind: "action",
|
|
59
60
|
label: `Add ${e.label}`,
|
|
60
61
|
icon: e.icon,
|
|
61
62
|
onSelect: () => {
|
|
62
|
-
|
|
63
|
+
M(e.type, t.worldX, t.worldY), g();
|
|
63
64
|
}
|
|
64
65
|
}));
|
|
65
|
-
}),
|
|
66
|
-
const t =
|
|
66
|
+
}), G = s(() => {
|
|
67
|
+
const t = f();
|
|
67
68
|
if (!t) return;
|
|
68
|
-
const e =
|
|
69
|
-
return
|
|
69
|
+
const e = T(), n = e.filter((o) => o.kind === "action").length, i = e.filter((o) => o.kind === "separator").length;
|
|
70
|
+
return wt({
|
|
70
71
|
clientX: t.clientX,
|
|
71
72
|
clientY: t.clientY,
|
|
72
|
-
menuWidth:
|
|
73
|
-
menuHeight:
|
|
73
|
+
menuWidth: St,
|
|
74
|
+
menuHeight: pt(n, i)
|
|
74
75
|
});
|
|
75
|
-
}),
|
|
76
|
-
const i =
|
|
77
|
-
|
|
76
|
+
}), X = (t, e, n) => {
|
|
77
|
+
const i = q(t, h()), o = i.singleton ? k(t) : null;
|
|
78
|
+
if (o)
|
|
79
|
+
return W(o, { centerViewport: !0 });
|
|
80
|
+
const d = i.defaultSize, r = {
|
|
81
|
+
id: mt(),
|
|
78
82
|
type: t,
|
|
79
83
|
title: i.defaultTitle,
|
|
80
84
|
x: e,
|
|
81
85
|
y: n,
|
|
82
|
-
width:
|
|
83
|
-
height:
|
|
84
|
-
z_index:
|
|
86
|
+
width: d.width,
|
|
87
|
+
height: d.height,
|
|
88
|
+
z_index: C() + 1,
|
|
85
89
|
created_at_unix_ms: Date.now()
|
|
86
90
|
};
|
|
87
|
-
return c.setState((
|
|
88
|
-
...
|
|
89
|
-
widgets: [...
|
|
90
|
-
selectedWidgetId:
|
|
91
|
-
})),
|
|
92
|
-
},
|
|
93
|
-
const i =
|
|
94
|
-
return
|
|
95
|
-
},
|
|
91
|
+
return c.setState((x) => ({
|
|
92
|
+
...x,
|
|
93
|
+
widgets: [...x.widgets, r],
|
|
94
|
+
selectedWidgetId: r.id
|
|
95
|
+
})), r;
|
|
96
|
+
}, M = (t, e, n) => {
|
|
97
|
+
const i = q(t, h()).defaultSize;
|
|
98
|
+
return X(t, e - i.width / 2, n - i.height / 2);
|
|
99
|
+
}, z = (t, e, n) => X(t, e, n), Y = (t) => {
|
|
96
100
|
c.setState((e) => ({
|
|
97
101
|
...e,
|
|
98
102
|
widgets: e.widgets.filter((n) => n.id !== t),
|
|
99
103
|
selectedWidgetId: e.selectedWidgetId === t ? null : e.selectedWidgetId
|
|
100
104
|
}));
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
const e =
|
|
105
|
+
}, J = (t) => {
|
|
106
|
+
A(t);
|
|
107
|
+
}, m = (t) => {
|
|
108
|
+
A(t);
|
|
109
|
+
const e = C(), n = u().find((i) => i.id === t);
|
|
106
110
|
n && n.z_index < e && c.setState((i) => ({
|
|
107
111
|
...i,
|
|
108
112
|
widgets: i.widgets.map(
|
|
109
113
|
(o) => o.id === t ? { ...o, z_index: e + 1 } : o
|
|
110
114
|
)
|
|
111
115
|
}));
|
|
112
|
-
},
|
|
116
|
+
}, Q = (t, e) => {
|
|
113
117
|
c.setState((n) => ({
|
|
114
118
|
...n,
|
|
115
119
|
widgets: n.widgets.map(
|
|
116
120
|
(i) => i.id === t ? { ...i, x: e.x, y: e.y } : i
|
|
117
121
|
)
|
|
118
122
|
}));
|
|
119
|
-
},
|
|
123
|
+
}, tt = (t, e) => {
|
|
120
124
|
c.setState((n) => ({
|
|
121
125
|
...n,
|
|
122
126
|
widgets: n.widgets.map(
|
|
@@ -125,74 +129,80 @@ function Yt(c) {
|
|
|
125
129
|
}));
|
|
126
130
|
}, I = (t) => {
|
|
127
131
|
c.setState((e) => ({ ...e, viewport: t }));
|
|
128
|
-
},
|
|
129
|
-
const e =
|
|
130
|
-
t === "in" ? e.scale *
|
|
131
|
-
),
|
|
132
|
-
x: n.width / 2 - i *
|
|
133
|
-
y: n.height / 2 - o *
|
|
134
|
-
scale:
|
|
132
|
+
}, O = (t) => {
|
|
133
|
+
const e = a(), n = S(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, d = xt(
|
|
134
|
+
t === "in" ? e.scale * R : e.scale / R
|
|
135
|
+
), r = {
|
|
136
|
+
x: n.width / 2 - i * d,
|
|
137
|
+
y: n.height / 2 - o * d,
|
|
138
|
+
scale: d
|
|
135
139
|
};
|
|
136
|
-
I(
|
|
137
|
-
},
|
|
140
|
+
I(r);
|
|
141
|
+
}, et = () => {
|
|
138
142
|
c.setState((t) => ({ ...t, locked: !t.locked }));
|
|
139
|
-
},
|
|
143
|
+
}, nt = (t) => {
|
|
140
144
|
c.setState((e) => ({
|
|
141
145
|
...e,
|
|
142
146
|
filters: { ...e.filters, [t]: !e.filters[t] }
|
|
143
147
|
}));
|
|
144
|
-
},
|
|
148
|
+
}, it = (t) => {
|
|
145
149
|
c.setState((e) => {
|
|
146
150
|
const n = { ...e.filters };
|
|
147
151
|
for (const i of Object.keys(n))
|
|
148
152
|
n[i] = i === t;
|
|
149
153
|
return { ...e, filters: n };
|
|
150
154
|
});
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
}, ot = () => {
|
|
156
|
+
const t = kt(h());
|
|
157
|
+
c.setState((e) => ({
|
|
158
|
+
...e,
|
|
159
|
+
filters: t
|
|
155
160
|
}));
|
|
156
|
-
},
|
|
161
|
+
}, V = (t) => {
|
|
157
162
|
c.setState((e) => ({ ...e, selectedWidgetId: t }));
|
|
163
|
+
}, ct = () => {
|
|
164
|
+
const t = S(), e = a();
|
|
165
|
+
return {
|
|
166
|
+
worldX: t.width > 0 ? (t.width / 2 - e.x) / e.scale : 240,
|
|
167
|
+
worldY: t.height > 0 ? (t.height / 2 - e.y) / e.scale : 180
|
|
168
|
+
};
|
|
158
169
|
};
|
|
159
|
-
let
|
|
160
|
-
const
|
|
161
|
-
const i =
|
|
162
|
-
if (
|
|
163
|
-
const
|
|
170
|
+
let N = 0;
|
|
171
|
+
const st = (t, e, n) => {
|
|
172
|
+
const i = a(), o = i.x, d = i.y, r = i.scale, x = performance.now(), dt = 360, rt = ++N, lt = (F) => 1 - Math.pow(1 - F, 3), E = (F) => {
|
|
173
|
+
if (rt !== N) return;
|
|
174
|
+
const at = F - x, H = Math.min(Math.max(at / dt, 0), 1), b = lt(H);
|
|
164
175
|
I({
|
|
165
|
-
x: o + (t - o) *
|
|
166
|
-
y:
|
|
167
|
-
scale:
|
|
168
|
-
}),
|
|
176
|
+
x: o + (t - o) * b,
|
|
177
|
+
y: d + (e - d) * b,
|
|
178
|
+
scale: r + (n - r) * b
|
|
179
|
+
}), H < 1 && requestAnimationFrame(E);
|
|
169
180
|
};
|
|
170
|
-
requestAnimationFrame(
|
|
171
|
-
}, b = (t) => {
|
|
172
|
-
const e = X();
|
|
173
|
-
if (e.width === 0 || e.height === 0) return;
|
|
174
|
-
const n = h(), i = e.width / 2 - (t.x + t.width / 2) * n.scale, o = e.height / 2 - (t.y + t.height / 2) * n.scale;
|
|
175
|
-
tt(i, o, n.scale);
|
|
181
|
+
requestAnimationFrame(E);
|
|
176
182
|
}, y = (t) => {
|
|
177
|
-
|
|
178
|
-
|
|
183
|
+
const e = S();
|
|
184
|
+
if (e.width === 0 || e.height === 0) return;
|
|
185
|
+
const n = a(), i = e.width / 2 - (t.x + t.width / 2) * n.scale, o = e.height / 2 - (t.y + t.height / 2) * n.scale;
|
|
186
|
+
st(i, o, n.scale);
|
|
187
|
+
}, W = (t, e = {}) => (V(t.id), m(t.id), e.centerViewport !== !1 && y(t), t);
|
|
179
188
|
return {
|
|
180
|
-
widgets:
|
|
181
|
-
viewport:
|
|
182
|
-
locked:
|
|
183
|
-
filters:
|
|
184
|
-
selectedWidgetId:
|
|
185
|
-
topZIndex:
|
|
186
|
-
scaleLabel:
|
|
187
|
-
optimisticFrontWidgetId:
|
|
188
|
-
|
|
189
|
+
widgets: u,
|
|
190
|
+
viewport: a,
|
|
191
|
+
locked: v,
|
|
192
|
+
filters: D,
|
|
193
|
+
selectedWidgetId: p,
|
|
194
|
+
topZIndex: C,
|
|
195
|
+
scaleLabel: Z,
|
|
196
|
+
optimisticFrontWidgetId: B,
|
|
197
|
+
widgetDefinitions: h,
|
|
198
|
+
setCanvasFrameRef: j,
|
|
189
199
|
contextMenu: {
|
|
190
|
-
state:
|
|
191
|
-
items:
|
|
192
|
-
position:
|
|
193
|
-
close:
|
|
200
|
+
state: f,
|
|
201
|
+
items: T,
|
|
202
|
+
position: G,
|
|
203
|
+
close: g,
|
|
194
204
|
retarget: (t) => {
|
|
195
|
-
t.preventDefault(), t.stopPropagation(),
|
|
205
|
+
t.preventDefault(), t.stopPropagation(), w({
|
|
196
206
|
clientX: t.clientX,
|
|
197
207
|
clientY: t.clientY,
|
|
198
208
|
worldX: 0,
|
|
@@ -201,53 +211,68 @@ function Yt(c) {
|
|
|
201
211
|
}
|
|
202
212
|
},
|
|
203
213
|
canvas: {
|
|
204
|
-
openCanvasContextMenu:
|
|
205
|
-
openWidgetContextMenu:
|
|
206
|
-
selectWidget:
|
|
207
|
-
startOptimisticFront:
|
|
208
|
-
commitFront:
|
|
209
|
-
commitMove:
|
|
210
|
-
commitResize:
|
|
214
|
+
openCanvasContextMenu: K,
|
|
215
|
+
openWidgetContextMenu: L,
|
|
216
|
+
selectWidget: V,
|
|
217
|
+
startOptimisticFront: J,
|
|
218
|
+
commitFront: m,
|
|
219
|
+
commitMove: Q,
|
|
220
|
+
commitResize: tt,
|
|
211
221
|
commitViewport: I
|
|
212
222
|
},
|
|
213
223
|
hud: {
|
|
214
|
-
zoomIn: () =>
|
|
215
|
-
zoomOut: () =>
|
|
224
|
+
zoomIn: () => O("in"),
|
|
225
|
+
zoomOut: () => O("out")
|
|
216
226
|
},
|
|
217
227
|
lock: {
|
|
218
|
-
toggle:
|
|
228
|
+
toggle: et
|
|
219
229
|
},
|
|
220
230
|
filter: {
|
|
221
|
-
toggle:
|
|
222
|
-
solo:
|
|
223
|
-
showAll:
|
|
231
|
+
toggle: nt,
|
|
232
|
+
solo: it,
|
|
233
|
+
showAll: ot
|
|
224
234
|
},
|
|
225
235
|
navigation: {
|
|
226
236
|
handleArrowNavigation: (t) => {
|
|
227
|
-
const e =
|
|
228
|
-
|
|
229
|
-
|
|
237
|
+
const e = Wt(
|
|
238
|
+
u(),
|
|
239
|
+
p(),
|
|
230
240
|
t,
|
|
231
|
-
|
|
241
|
+
D()
|
|
232
242
|
);
|
|
233
|
-
e &&
|
|
243
|
+
e && W(e);
|
|
234
244
|
},
|
|
235
|
-
centerOnWidget:
|
|
236
|
-
focusWidget:
|
|
245
|
+
centerOnWidget: y,
|
|
246
|
+
focusWidget: W
|
|
237
247
|
},
|
|
238
248
|
widgetActions: {
|
|
239
249
|
deleteSelected: () => {
|
|
240
|
-
const t =
|
|
241
|
-
t &&
|
|
250
|
+
const t = p();
|
|
251
|
+
t && Y(t);
|
|
242
252
|
},
|
|
243
|
-
deleteWidget:
|
|
244
|
-
addWidget:
|
|
245
|
-
addWidgetAtCursor:
|
|
246
|
-
addWidgetCentered:
|
|
253
|
+
deleteWidget: Y,
|
|
254
|
+
addWidget: X,
|
|
255
|
+
addWidgetAtCursor: M,
|
|
256
|
+
addWidgetCentered: z,
|
|
257
|
+
ensureWidget: (t, e) => {
|
|
258
|
+
const n = k(t);
|
|
259
|
+
if (n)
|
|
260
|
+
return W(n, { centerViewport: e?.centerViewport ?? !0 });
|
|
261
|
+
const i = ct(), o = M(
|
|
262
|
+
t,
|
|
263
|
+
e?.worldX ?? i.worldX,
|
|
264
|
+
e?.worldY ?? i.worldY
|
|
265
|
+
);
|
|
266
|
+
return (e?.centerViewport ?? !0) && o && y(o), o;
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
queries: {
|
|
270
|
+
findWidgetByType: k,
|
|
271
|
+
findWidgetById: U
|
|
247
272
|
},
|
|
248
273
|
handleCloseRequest: () => {
|
|
249
|
-
if (
|
|
250
|
-
|
|
274
|
+
if (f()) {
|
|
275
|
+
g();
|
|
251
276
|
return;
|
|
252
277
|
}
|
|
253
278
|
c.onClose();
|
|
@@ -255,5 +280,5 @@ function Yt(c) {
|
|
|
255
280
|
};
|
|
256
281
|
}
|
|
257
282
|
export {
|
|
258
|
-
|
|
283
|
+
At as useWorkbenchModel
|
|
259
284
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Component } from 'solid-js';
|
|
2
|
-
import type { WorkbenchWidgetType } from '../types';
|
|
3
|
-
export interface WidgetRegistryEntry {
|
|
4
|
-
type: WorkbenchWidgetType;
|
|
2
|
+
import type { WorkbenchWidgetDefinition, WorkbenchWidgetType } from '../types';
|
|
3
|
+
export interface WidgetRegistryEntry extends WorkbenchWidgetDefinition {
|
|
5
4
|
label: string;
|
|
6
5
|
icon: Component<{
|
|
7
6
|
class?: string;
|
|
8
7
|
}>;
|
|
9
|
-
body: Component;
|
|
10
8
|
defaultTitle: string;
|
|
11
9
|
}
|
|
12
10
|
export declare const WIDGET_REGISTRY: readonly WidgetRegistryEntry[];
|
|
13
|
-
export declare function
|
|
11
|
+
export declare function resolveWorkbenchWidgetDefinitions(widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): readonly WorkbenchWidgetDefinition[];
|
|
12
|
+
export declare function createWorkbenchFilterState(widgetDefinitions?: readonly WorkbenchWidgetDefinition[], filters?: Partial<Record<WorkbenchWidgetType, boolean>>): Record<WorkbenchWidgetType, boolean>;
|
|
13
|
+
export declare function isValidWorkbenchWidgetType(type: unknown, widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): type is WorkbenchWidgetType;
|
|
14
|
+
export declare function getWidgetEntry(type: WorkbenchWidgetType, widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): WorkbenchWidgetDefinition;
|
|
@@ -1,50 +1,71 @@
|
|
|
1
|
-
import { Terminal as
|
|
2
|
-
import { TerminalWidget as
|
|
3
|
-
import { FileBrowserWidget as
|
|
4
|
-
import { SystemMonitorWidget as
|
|
5
|
-
import { LogViewerWidget as
|
|
6
|
-
import { CodeEditorWidget as
|
|
7
|
-
const
|
|
1
|
+
import { Terminal as d, Folder as n, Cpu as a, Activity as f, FileCode as y } from "../../icons/index.js";
|
|
2
|
+
import { TerminalWidget as m } from "./TerminalWidget.js";
|
|
3
|
+
import { FileBrowserWidget as c } from "./FileBrowserWidget.js";
|
|
4
|
+
import { SystemMonitorWidget as p } from "./SystemMonitorWidget.js";
|
|
5
|
+
import { LogViewerWidget as u } from "./LogViewerWidget.js";
|
|
6
|
+
import { CodeEditorWidget as h } from "./CodeEditorWidget.js";
|
|
7
|
+
const g = [
|
|
8
8
|
{
|
|
9
9
|
type: "terminal",
|
|
10
10
|
label: "Terminal",
|
|
11
|
-
icon:
|
|
12
|
-
body:
|
|
13
|
-
defaultTitle: "Terminal"
|
|
11
|
+
icon: d,
|
|
12
|
+
body: m,
|
|
13
|
+
defaultTitle: "Terminal",
|
|
14
|
+
defaultSize: { width: 480, height: 320 }
|
|
14
15
|
},
|
|
15
16
|
{
|
|
16
17
|
type: "file-browser",
|
|
17
18
|
label: "File Browser",
|
|
18
|
-
icon:
|
|
19
|
-
body:
|
|
20
|
-
defaultTitle: "File Browser"
|
|
19
|
+
icon: n,
|
|
20
|
+
body: c,
|
|
21
|
+
defaultTitle: "File Browser",
|
|
22
|
+
defaultSize: { width: 360, height: 400 }
|
|
21
23
|
},
|
|
22
24
|
{
|
|
23
25
|
type: "system-monitor",
|
|
24
26
|
label: "System Monitor",
|
|
25
|
-
icon:
|
|
26
|
-
body:
|
|
27
|
-
defaultTitle: "System Monitor"
|
|
27
|
+
icon: a,
|
|
28
|
+
body: p,
|
|
29
|
+
defaultTitle: "System Monitor",
|
|
30
|
+
defaultSize: { width: 340, height: 280 }
|
|
28
31
|
},
|
|
29
32
|
{
|
|
30
33
|
type: "log-viewer",
|
|
31
34
|
label: "Log Viewer",
|
|
32
|
-
icon:
|
|
33
|
-
body:
|
|
34
|
-
defaultTitle: "Log Viewer"
|
|
35
|
+
icon: f,
|
|
36
|
+
body: u,
|
|
37
|
+
defaultTitle: "Log Viewer",
|
|
38
|
+
defaultSize: { width: 500, height: 300 }
|
|
35
39
|
},
|
|
36
40
|
{
|
|
37
41
|
type: "code-editor",
|
|
38
42
|
label: "Code Editor",
|
|
39
|
-
icon:
|
|
40
|
-
body:
|
|
41
|
-
defaultTitle: "Code Editor"
|
|
43
|
+
icon: y,
|
|
44
|
+
body: h,
|
|
45
|
+
defaultTitle: "Code Editor",
|
|
46
|
+
defaultSize: { width: 520, height: 380 }
|
|
42
47
|
}
|
|
43
48
|
];
|
|
44
|
-
function
|
|
45
|
-
return e
|
|
49
|
+
function l(e) {
|
|
50
|
+
return e && e.length > 0 ? e : g;
|
|
51
|
+
}
|
|
52
|
+
function E(e, t) {
|
|
53
|
+
const o = l(e), i = {};
|
|
54
|
+
for (const r of o)
|
|
55
|
+
i[r.type] = typeof t?.[r.type] == "boolean" ? !!t[r.type] : !0;
|
|
56
|
+
return i;
|
|
57
|
+
}
|
|
58
|
+
function F(e, t) {
|
|
59
|
+
return typeof e == "string" && l(t).some((o) => o.type === e);
|
|
60
|
+
}
|
|
61
|
+
function v(e, t) {
|
|
62
|
+
const o = l(t);
|
|
63
|
+
return o.find((i) => i.type === e) ?? o[0];
|
|
46
64
|
}
|
|
47
65
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
66
|
+
g as WIDGET_REGISTRY,
|
|
67
|
+
E as createWorkbenchFilterState,
|
|
68
|
+
v as getWidgetEntry,
|
|
69
|
+
F as isValidWorkbenchWidgetType,
|
|
70
|
+
l as resolveWorkbenchWidgetDefinitions
|
|
50
71
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { type WorkbenchState, type WorkbenchViewport, type WorkbenchWidgetItem, type WorkbenchWidgetType } from './types';
|
|
1
|
+
import { type WorkbenchState, type WorkbenchViewport, type WorkbenchWidgetDefinition, type WorkbenchWidgetItem, type WorkbenchWidgetType } from './types';
|
|
2
2
|
export declare function createWorkbenchId(): string;
|
|
3
3
|
export declare function sanitizeViewport(viewport: Partial<WorkbenchViewport> | undefined): WorkbenchViewport;
|
|
4
|
-
export declare function sanitizeFilters(filters: Partial<Record<WorkbenchWidgetType, boolean>> | undefined): Record<WorkbenchWidgetType, boolean>;
|
|
5
|
-
export
|
|
6
|
-
|
|
4
|
+
export declare function sanitizeFilters(filters: Partial<Record<WorkbenchWidgetType, boolean>> | undefined, widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): Record<WorkbenchWidgetType, boolean>;
|
|
5
|
+
export interface SanitizeWorkbenchStateOptions {
|
|
6
|
+
widgetDefinitions?: readonly WorkbenchWidgetDefinition[];
|
|
7
|
+
createFallbackState?: () => WorkbenchState;
|
|
8
|
+
}
|
|
9
|
+
export declare function sanitizeWorkbenchState(input: unknown, options?: SanitizeWorkbenchStateOptions): WorkbenchState;
|
|
10
|
+
export declare function createDefaultWorkbenchState(widgetDefinitions?: readonly WorkbenchWidgetDefinition[]): WorkbenchState;
|
|
7
11
|
export declare const WORKBENCH_CANVAS_ZOOM_STEP = 1.18;
|
|
8
12
|
export declare const WORKBENCH_CONTEXT_MENU_WIDTH_PX = 200;
|
|
9
13
|
export declare function createContextMenuPosition(options: {
|