@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,259 @@
|
|
|
1
|
+
import { createSignal as k, createMemo as d } from "solid-js";
|
|
2
|
+
import { ArrowUp as st, Copy as dt, Trash as lt } from "../icons/index.js";
|
|
3
|
+
import { DEFAULT_WIDGET_DIMENSIONS as R, DEFAULT_FILTERS as at } from "./types.js";
|
|
4
|
+
import { getTopZIndex as rt, createContextMenuPosition as gt, createWorkbenchId as ht, findNearestWidget as ut, clampScale as mt, WORKBENCH_CANVAS_ZOOM_STEP as z, WORKBENCH_CONTEXT_MENU_WIDTH_PX as ft, estimateContextMenuHeight as wt } from "./workbenchHelpers.js";
|
|
5
|
+
import { WIDGET_REGISTRY as Wt, getWidgetEntry as xt } from "./widgets/widgetRegistry.js";
|
|
6
|
+
function Yt(c) {
|
|
7
|
+
const [u, m] = k(null), [H, M] = k(null), [X, L] = k({ width: 0, height: 0 }), r = c.state, g = d(() => r().widgets), h = d(() => r().viewport), P = d(() => r().locked), T = d(() => r().filters), w = d(() => r().selectedWidgetId), W = d(() => rt(g())), q = d(() => `${Math.round(h().scale * 100)}%`), U = (t) => {
|
|
8
|
+
t && L({ width: t.clientWidth, height: t.clientHeight });
|
|
9
|
+
}, V = (t) => {
|
|
10
|
+
m({
|
|
11
|
+
clientX: t.clientX,
|
|
12
|
+
clientY: t.clientY,
|
|
13
|
+
worldX: t.worldX,
|
|
14
|
+
worldY: t.worldY
|
|
15
|
+
});
|
|
16
|
+
}, Z = (t, e) => {
|
|
17
|
+
f(e.id), m({
|
|
18
|
+
clientX: t.clientX,
|
|
19
|
+
clientY: t.clientY,
|
|
20
|
+
worldX: e.x,
|
|
21
|
+
worldY: e.y,
|
|
22
|
+
widgetId: e.id
|
|
23
|
+
});
|
|
24
|
+
}, a = () => m(null), Y = d(() => {
|
|
25
|
+
const t = u();
|
|
26
|
+
if (!t) return [];
|
|
27
|
+
if (t.widgetId) {
|
|
28
|
+
const e = g().find((i) => i.id === t.widgetId), n = [];
|
|
29
|
+
return e && (n.push({
|
|
30
|
+
id: "bring-to-front",
|
|
31
|
+
kind: "action",
|
|
32
|
+
label: "Bring to Front",
|
|
33
|
+
icon: st,
|
|
34
|
+
onSelect: () => {
|
|
35
|
+
f(e.id), a();
|
|
36
|
+
}
|
|
37
|
+
}), n.push({
|
|
38
|
+
id: "duplicate",
|
|
39
|
+
kind: "action",
|
|
40
|
+
label: "Duplicate",
|
|
41
|
+
icon: dt,
|
|
42
|
+
onSelect: () => {
|
|
43
|
+
F(e.type, e.x + 32, e.y + 32), a();
|
|
44
|
+
}
|
|
45
|
+
})), n.push({ id: "separator-delete", kind: "separator" }), n.push({
|
|
46
|
+
id: "delete",
|
|
47
|
+
kind: "action",
|
|
48
|
+
label: "Delete",
|
|
49
|
+
icon: lt,
|
|
50
|
+
destructive: !0,
|
|
51
|
+
onSelect: () => {
|
|
52
|
+
t.widgetId && S(t.widgetId), a();
|
|
53
|
+
}
|
|
54
|
+
}), n;
|
|
55
|
+
}
|
|
56
|
+
return Wt.map((e) => ({
|
|
57
|
+
id: `add-${e.type}`,
|
|
58
|
+
kind: "action",
|
|
59
|
+
label: `Add ${e.label}`,
|
|
60
|
+
icon: e.icon,
|
|
61
|
+
onSelect: () => {
|
|
62
|
+
_(e.type, t.worldX, t.worldY), a();
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
}), B = d(() => {
|
|
66
|
+
const t = u();
|
|
67
|
+
if (!t) return;
|
|
68
|
+
const e = Y(), n = e.filter((o) => o.kind === "action").length, i = e.filter((o) => o.kind === "separator").length;
|
|
69
|
+
return gt({
|
|
70
|
+
clientX: t.clientX,
|
|
71
|
+
clientY: t.clientY,
|
|
72
|
+
menuWidth: ft,
|
|
73
|
+
menuHeight: wt(n, i)
|
|
74
|
+
});
|
|
75
|
+
}), x = (t, e, n) => {
|
|
76
|
+
const i = xt(t), o = R[t], s = {
|
|
77
|
+
id: ht(),
|
|
78
|
+
type: t,
|
|
79
|
+
title: i.defaultTitle,
|
|
80
|
+
x: e,
|
|
81
|
+
y: n,
|
|
82
|
+
width: o.width,
|
|
83
|
+
height: o.height,
|
|
84
|
+
z_index: W() + 1,
|
|
85
|
+
created_at_unix_ms: Date.now()
|
|
86
|
+
};
|
|
87
|
+
return c.setState((l) => ({
|
|
88
|
+
...l,
|
|
89
|
+
widgets: [...l.widgets, s],
|
|
90
|
+
selectedWidgetId: s.id
|
|
91
|
+
})), s;
|
|
92
|
+
}, _ = (t, e, n) => {
|
|
93
|
+
const i = R[t];
|
|
94
|
+
return x(t, e - i.width / 2, n - i.height / 2);
|
|
95
|
+
}, F = (t, e, n) => x(t, e, n), S = (t) => {
|
|
96
|
+
c.setState((e) => ({
|
|
97
|
+
...e,
|
|
98
|
+
widgets: e.widgets.filter((n) => n.id !== t),
|
|
99
|
+
selectedWidgetId: e.selectedWidgetId === t ? null : e.selectedWidgetId
|
|
100
|
+
}));
|
|
101
|
+
}, G = (t) => {
|
|
102
|
+
M(t);
|
|
103
|
+
}, f = (t) => {
|
|
104
|
+
M(t);
|
|
105
|
+
const e = W(), n = g().find((i) => i.id === t);
|
|
106
|
+
n && n.z_index < e && c.setState((i) => ({
|
|
107
|
+
...i,
|
|
108
|
+
widgets: i.widgets.map(
|
|
109
|
+
(o) => o.id === t ? { ...o, z_index: e + 1 } : o
|
|
110
|
+
)
|
|
111
|
+
}));
|
|
112
|
+
}, $ = (t, e) => {
|
|
113
|
+
c.setState((n) => ({
|
|
114
|
+
...n,
|
|
115
|
+
widgets: n.widgets.map(
|
|
116
|
+
(i) => i.id === t ? { ...i, x: e.x, y: e.y } : i
|
|
117
|
+
)
|
|
118
|
+
}));
|
|
119
|
+
}, j = (t, e) => {
|
|
120
|
+
c.setState((n) => ({
|
|
121
|
+
...n,
|
|
122
|
+
widgets: n.widgets.map(
|
|
123
|
+
(i) => i.id === t ? { ...i, width: e.width, height: e.height } : i
|
|
124
|
+
)
|
|
125
|
+
}));
|
|
126
|
+
}, I = (t) => {
|
|
127
|
+
c.setState((e) => ({ ...e, viewport: t }));
|
|
128
|
+
}, A = (t) => {
|
|
129
|
+
const e = h(), n = X(), i = (n.width / 2 - e.x) / e.scale, o = (n.height / 2 - e.y) / e.scale, s = mt(
|
|
130
|
+
t === "in" ? e.scale * z : e.scale / z
|
|
131
|
+
), l = {
|
|
132
|
+
x: n.width / 2 - i * s,
|
|
133
|
+
y: n.height / 2 - o * s,
|
|
134
|
+
scale: s
|
|
135
|
+
};
|
|
136
|
+
I(l);
|
|
137
|
+
}, v = () => {
|
|
138
|
+
c.setState((t) => ({ ...t, locked: !t.locked }));
|
|
139
|
+
}, K = (t) => {
|
|
140
|
+
c.setState((e) => ({
|
|
141
|
+
...e,
|
|
142
|
+
filters: { ...e.filters, [t]: !e.filters[t] }
|
|
143
|
+
}));
|
|
144
|
+
}, J = (t) => {
|
|
145
|
+
c.setState((e) => {
|
|
146
|
+
const n = { ...e.filters };
|
|
147
|
+
for (const i of Object.keys(n))
|
|
148
|
+
n[i] = i === t;
|
|
149
|
+
return { ...e, filters: n };
|
|
150
|
+
});
|
|
151
|
+
}, Q = () => {
|
|
152
|
+
c.setState((t) => ({
|
|
153
|
+
...t,
|
|
154
|
+
filters: { ...at }
|
|
155
|
+
}));
|
|
156
|
+
}, E = (t) => {
|
|
157
|
+
c.setState((e) => ({ ...e, selectedWidgetId: t }));
|
|
158
|
+
};
|
|
159
|
+
let O = 0;
|
|
160
|
+
const tt = (t, e, n) => {
|
|
161
|
+
const i = h(), o = i.x, s = i.y, l = i.scale, et = performance.now(), nt = 360, it = ++O, ot = (p) => 1 - Math.pow(1 - p, 3), D = (p) => {
|
|
162
|
+
if (it !== O) return;
|
|
163
|
+
const ct = p - et, N = Math.min(Math.max(ct / nt, 0), 1), C = ot(N);
|
|
164
|
+
I({
|
|
165
|
+
x: o + (t - o) * C,
|
|
166
|
+
y: s + (e - s) * C,
|
|
167
|
+
scale: l + (n - l) * C
|
|
168
|
+
}), N < 1 && requestAnimationFrame(D);
|
|
169
|
+
};
|
|
170
|
+
requestAnimationFrame(D);
|
|
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);
|
|
176
|
+
}, y = (t) => {
|
|
177
|
+
E(t.id), f(t.id), b(t);
|
|
178
|
+
};
|
|
179
|
+
return {
|
|
180
|
+
widgets: g,
|
|
181
|
+
viewport: h,
|
|
182
|
+
locked: P,
|
|
183
|
+
filters: T,
|
|
184
|
+
selectedWidgetId: w,
|
|
185
|
+
topZIndex: W,
|
|
186
|
+
scaleLabel: q,
|
|
187
|
+
optimisticFrontWidgetId: H,
|
|
188
|
+
setCanvasFrameRef: U,
|
|
189
|
+
contextMenu: {
|
|
190
|
+
state: u,
|
|
191
|
+
items: Y,
|
|
192
|
+
position: B,
|
|
193
|
+
close: a,
|
|
194
|
+
retarget: (t) => {
|
|
195
|
+
t.preventDefault(), t.stopPropagation(), m({
|
|
196
|
+
clientX: t.clientX,
|
|
197
|
+
clientY: t.clientY,
|
|
198
|
+
worldX: 0,
|
|
199
|
+
worldY: 0
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
canvas: {
|
|
204
|
+
openCanvasContextMenu: V,
|
|
205
|
+
openWidgetContextMenu: Z,
|
|
206
|
+
selectWidget: E,
|
|
207
|
+
startOptimisticFront: G,
|
|
208
|
+
commitFront: f,
|
|
209
|
+
commitMove: $,
|
|
210
|
+
commitResize: j,
|
|
211
|
+
commitViewport: I
|
|
212
|
+
},
|
|
213
|
+
hud: {
|
|
214
|
+
zoomIn: () => A("in"),
|
|
215
|
+
zoomOut: () => A("out")
|
|
216
|
+
},
|
|
217
|
+
lock: {
|
|
218
|
+
toggle: v
|
|
219
|
+
},
|
|
220
|
+
filter: {
|
|
221
|
+
toggle: K,
|
|
222
|
+
solo: J,
|
|
223
|
+
showAll: Q
|
|
224
|
+
},
|
|
225
|
+
navigation: {
|
|
226
|
+
handleArrowNavigation: (t) => {
|
|
227
|
+
const e = ut(
|
|
228
|
+
g(),
|
|
229
|
+
w(),
|
|
230
|
+
t,
|
|
231
|
+
T()
|
|
232
|
+
);
|
|
233
|
+
e && y(e);
|
|
234
|
+
},
|
|
235
|
+
centerOnWidget: b,
|
|
236
|
+
focusWidget: y
|
|
237
|
+
},
|
|
238
|
+
widgetActions: {
|
|
239
|
+
deleteSelected: () => {
|
|
240
|
+
const t = w();
|
|
241
|
+
t && S(t);
|
|
242
|
+
},
|
|
243
|
+
deleteWidget: S,
|
|
244
|
+
addWidget: x,
|
|
245
|
+
addWidgetAtCursor: _,
|
|
246
|
+
addWidgetCentered: F
|
|
247
|
+
},
|
|
248
|
+
handleCloseRequest: () => {
|
|
249
|
+
if (u()) {
|
|
250
|
+
a();
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
c.onClose();
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
export {
|
|
258
|
+
Yt as useWorkbenchModel
|
|
259
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CodeEditorWidget(): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { insert as e, createComponent as d, effect as k, className as m, memo as w, template as o } from "solid-js/web";
|
|
2
|
+
import { For as l } from "solid-js";
|
|
3
|
+
var g = /* @__PURE__ */ o("<div class=workbench-widget-codeeditor><div class=workbench-widget-codeeditor__gutter></div><div class=workbench-widget-codeeditor__code>"), p = /* @__PURE__ */ o("<span>"), h = /* @__PURE__ */ o("<div class=workbench-widget-codeeditor__line>"), v = /* @__PURE__ */ o("<span class=workbench-widget-codeeditor__caret aria-hidden=true>");
|
|
4
|
+
const u = [{
|
|
5
|
+
tokens: [{
|
|
6
|
+
kind: "comment",
|
|
7
|
+
text: "// workbench counter demo"
|
|
8
|
+
}]
|
|
9
|
+
}, {
|
|
10
|
+
tokens: [{
|
|
11
|
+
kind: "keyword",
|
|
12
|
+
text: "import"
|
|
13
|
+
}, {
|
|
14
|
+
kind: "plain",
|
|
15
|
+
text: " { createSignal } "
|
|
16
|
+
}, {
|
|
17
|
+
kind: "keyword",
|
|
18
|
+
text: "from"
|
|
19
|
+
}, {
|
|
20
|
+
kind: "string",
|
|
21
|
+
text: " 'solid-js'"
|
|
22
|
+
}, {
|
|
23
|
+
kind: "plain",
|
|
24
|
+
text: ";"
|
|
25
|
+
}]
|
|
26
|
+
}, {
|
|
27
|
+
tokens: []
|
|
28
|
+
}, {
|
|
29
|
+
tokens: [{
|
|
30
|
+
kind: "keyword",
|
|
31
|
+
text: "export function "
|
|
32
|
+
}, {
|
|
33
|
+
kind: "fn",
|
|
34
|
+
text: "Counter"
|
|
35
|
+
}, {
|
|
36
|
+
kind: "plain",
|
|
37
|
+
text: "() {"
|
|
38
|
+
}]
|
|
39
|
+
}, {
|
|
40
|
+
tokens: [{
|
|
41
|
+
kind: "plain",
|
|
42
|
+
text: " "
|
|
43
|
+
}, {
|
|
44
|
+
kind: "keyword",
|
|
45
|
+
text: "const"
|
|
46
|
+
}, {
|
|
47
|
+
kind: "plain",
|
|
48
|
+
text: " [count, setCount] = "
|
|
49
|
+
}, {
|
|
50
|
+
kind: "fn",
|
|
51
|
+
text: "createSignal"
|
|
52
|
+
}, {
|
|
53
|
+
kind: "plain",
|
|
54
|
+
text: "("
|
|
55
|
+
}, {
|
|
56
|
+
kind: "number",
|
|
57
|
+
text: "0"
|
|
58
|
+
}, {
|
|
59
|
+
kind: "plain",
|
|
60
|
+
text: ");"
|
|
61
|
+
}]
|
|
62
|
+
}, {
|
|
63
|
+
tokens: []
|
|
64
|
+
}, {
|
|
65
|
+
tokens: [{
|
|
66
|
+
kind: "plain",
|
|
67
|
+
text: " "
|
|
68
|
+
}, {
|
|
69
|
+
kind: "keyword",
|
|
70
|
+
text: "return"
|
|
71
|
+
}, {
|
|
72
|
+
kind: "plain",
|
|
73
|
+
text: " ("
|
|
74
|
+
}]
|
|
75
|
+
}, {
|
|
76
|
+
tokens: [{
|
|
77
|
+
kind: "plain",
|
|
78
|
+
text: " <button "
|
|
79
|
+
}, {
|
|
80
|
+
kind: "attr",
|
|
81
|
+
text: "onClick"
|
|
82
|
+
}, {
|
|
83
|
+
kind: "plain",
|
|
84
|
+
text: "={() => setCount(c => c + "
|
|
85
|
+
}, {
|
|
86
|
+
kind: "number",
|
|
87
|
+
text: "1"
|
|
88
|
+
}, {
|
|
89
|
+
kind: "plain",
|
|
90
|
+
text: ")}>"
|
|
91
|
+
}]
|
|
92
|
+
}, {
|
|
93
|
+
tokens: [{
|
|
94
|
+
kind: "plain",
|
|
95
|
+
text: " Count: {count()}"
|
|
96
|
+
}]
|
|
97
|
+
}, {
|
|
98
|
+
tokens: [{
|
|
99
|
+
kind: "plain",
|
|
100
|
+
text: " </button>"
|
|
101
|
+
}]
|
|
102
|
+
}, {
|
|
103
|
+
tokens: [{
|
|
104
|
+
kind: "plain",
|
|
105
|
+
text: " );"
|
|
106
|
+
}]
|
|
107
|
+
}, {
|
|
108
|
+
tokens: [{
|
|
109
|
+
kind: "plain",
|
|
110
|
+
text: "}"
|
|
111
|
+
}]
|
|
112
|
+
}], a = 4;
|
|
113
|
+
function f() {
|
|
114
|
+
return (() => {
|
|
115
|
+
var c = g(), s = c.firstChild, _ = s.nextSibling;
|
|
116
|
+
return e(s, d(l, {
|
|
117
|
+
each: u,
|
|
118
|
+
children: (x, n) => (() => {
|
|
119
|
+
var t = p();
|
|
120
|
+
return e(t, () => n() + 1), k(() => t.classList.toggle("is-active", n() === a)), t;
|
|
121
|
+
})()
|
|
122
|
+
})), e(_, d(l, {
|
|
123
|
+
each: u,
|
|
124
|
+
children: (x, n) => (() => {
|
|
125
|
+
var t = h();
|
|
126
|
+
return e(t, d(l, {
|
|
127
|
+
get each() {
|
|
128
|
+
return x.tokens;
|
|
129
|
+
},
|
|
130
|
+
children: (i) => (() => {
|
|
131
|
+
var r = p();
|
|
132
|
+
return e(r, () => i.text), k(() => m(r, `workbench-widget-codeeditor__${i.kind}`)), r;
|
|
133
|
+
})()
|
|
134
|
+
}), null), e(t, (() => {
|
|
135
|
+
var i = w(() => n() === a);
|
|
136
|
+
return () => i() ? v() : null;
|
|
137
|
+
})(), null), k(() => t.classList.toggle("is-active", n() === a)), t;
|
|
138
|
+
})()
|
|
139
|
+
})), c;
|
|
140
|
+
})();
|
|
141
|
+
}
|
|
142
|
+
export {
|
|
143
|
+
f as CodeEditorWidget
|
|
144
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FileBrowserWidget(): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { insert as c, createComponent as r, template as g, memo as s, effect as h, setStyleProperty as k, delegateEvents as _ } from "solid-js/web";
|
|
2
|
+
import { createSignal as v, For as u } from "solid-js";
|
|
3
|
+
import { ChevronDown as p, ChevronRight as m, FolderOpen as x, Folder as $, FileCode as C } from "../../icons/index.js";
|
|
4
|
+
var F = /* @__PURE__ */ g("<button type=button class=workbench-widget-filebrowser__row><span class=workbench-widget-filebrowser__icon></span><span class=workbench-widget-filebrowser__name>"), S = /* @__PURE__ */ g("<span class=workbench-widget-filebrowser__chev>"), T = /* @__PURE__ */ g("<span class=workbench-widget-filebrowser__chev aria-hidden=true>"), j = /* @__PURE__ */ g("<div class=workbench-widget-filebrowser><div class=workbench-widget-filebrowser__toolbar><span class=workbench-widget-filebrowser__path>~/projects/floe-webapp</span></div><div class=workbench-widget-filebrowser__tree>");
|
|
5
|
+
const y = {
|
|
6
|
+
id: "root",
|
|
7
|
+
label: "floe-webapp",
|
|
8
|
+
kind: "folder",
|
|
9
|
+
children: [{
|
|
10
|
+
id: "src",
|
|
11
|
+
label: "src",
|
|
12
|
+
kind: "folder",
|
|
13
|
+
children: [{
|
|
14
|
+
id: "components",
|
|
15
|
+
label: "components",
|
|
16
|
+
kind: "folder",
|
|
17
|
+
children: [{
|
|
18
|
+
id: "app-tsx",
|
|
19
|
+
label: "App.tsx",
|
|
20
|
+
kind: "file"
|
|
21
|
+
}, {
|
|
22
|
+
id: "notes-tsx",
|
|
23
|
+
label: "NotesBoard.tsx",
|
|
24
|
+
kind: "file"
|
|
25
|
+
}, {
|
|
26
|
+
id: "workbench-tsx",
|
|
27
|
+
label: "WorkbenchOverlay.tsx",
|
|
28
|
+
kind: "file"
|
|
29
|
+
}]
|
|
30
|
+
}, {
|
|
31
|
+
id: "utils",
|
|
32
|
+
label: "utils",
|
|
33
|
+
kind: "folder",
|
|
34
|
+
children: [{
|
|
35
|
+
id: "animations",
|
|
36
|
+
label: "animations.ts",
|
|
37
|
+
kind: "file"
|
|
38
|
+
}, {
|
|
39
|
+
id: "cn",
|
|
40
|
+
label: "cn.ts",
|
|
41
|
+
kind: "file"
|
|
42
|
+
}]
|
|
43
|
+
}, {
|
|
44
|
+
id: "index",
|
|
45
|
+
label: "index.ts",
|
|
46
|
+
kind: "file"
|
|
47
|
+
}]
|
|
48
|
+
}, {
|
|
49
|
+
id: "public",
|
|
50
|
+
label: "public",
|
|
51
|
+
kind: "folder",
|
|
52
|
+
children: [{
|
|
53
|
+
id: "logo",
|
|
54
|
+
label: "logo.svg",
|
|
55
|
+
kind: "file"
|
|
56
|
+
}]
|
|
57
|
+
}, {
|
|
58
|
+
id: "pkgjson",
|
|
59
|
+
label: "package.json",
|
|
60
|
+
kind: "file"
|
|
61
|
+
}, {
|
|
62
|
+
id: "tsconfig",
|
|
63
|
+
label: "tsconfig.json",
|
|
64
|
+
kind: "file"
|
|
65
|
+
}]
|
|
66
|
+
}, f = (n) => {
|
|
67
|
+
const i = () => n.node.kind === "folder", o = () => n.expanded.has(n.node.id);
|
|
68
|
+
return [(() => {
|
|
69
|
+
var e = F(), d = e.firstChild, t = d.nextSibling;
|
|
70
|
+
return e.$$click = () => {
|
|
71
|
+
i() && n.onToggle(n.node.id);
|
|
72
|
+
}, c(e, (() => {
|
|
73
|
+
var l = s(() => !!i());
|
|
74
|
+
return () => l() ? (() => {
|
|
75
|
+
var a = S();
|
|
76
|
+
return c(a, (() => {
|
|
77
|
+
var b = s(() => !!o());
|
|
78
|
+
return () => b() ? r(p, {
|
|
79
|
+
class: "w-3 h-3"
|
|
80
|
+
}) : r(m, {
|
|
81
|
+
class: "w-3 h-3"
|
|
82
|
+
});
|
|
83
|
+
})()), a;
|
|
84
|
+
})() : T();
|
|
85
|
+
})(), d), c(d, (() => {
|
|
86
|
+
var l = s(() => !!i());
|
|
87
|
+
return () => l() ? s(() => !!o())() ? r(x, {
|
|
88
|
+
class: "w-3.5 h-3.5"
|
|
89
|
+
}) : r($, {
|
|
90
|
+
class: "w-3.5 h-3.5"
|
|
91
|
+
}) : r(C, {
|
|
92
|
+
class: "w-3.5 h-3.5"
|
|
93
|
+
});
|
|
94
|
+
})()), c(t, () => n.node.label), h((l) => {
|
|
95
|
+
var a = !!i(), b = !!(i() && o()), w = `${n.depth * 14 + 8}px`;
|
|
96
|
+
return a !== l.e && e.classList.toggle("is-folder", l.e = a), b !== l.t && e.classList.toggle("is-open", l.t = b), w !== l.a && k(e, "padding-left", l.a = w), l;
|
|
97
|
+
}, {
|
|
98
|
+
e: void 0,
|
|
99
|
+
t: void 0,
|
|
100
|
+
a: void 0
|
|
101
|
+
}), e;
|
|
102
|
+
})(), s(() => s(() => !!(i() && o() && n.node.children))() ? r(u, {
|
|
103
|
+
get each() {
|
|
104
|
+
return n.node.children;
|
|
105
|
+
},
|
|
106
|
+
children: (e) => r(f, {
|
|
107
|
+
node: e,
|
|
108
|
+
get depth() {
|
|
109
|
+
return n.depth + 1;
|
|
110
|
+
},
|
|
111
|
+
get expanded() {
|
|
112
|
+
return n.expanded;
|
|
113
|
+
},
|
|
114
|
+
get onToggle() {
|
|
115
|
+
return n.onToggle;
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
}) : null)];
|
|
119
|
+
};
|
|
120
|
+
function B() {
|
|
121
|
+
const [n, i] = v(/* @__PURE__ */ new Set(["root", "src", "components"])), o = (e) => {
|
|
122
|
+
i((d) => {
|
|
123
|
+
const t = new Set(d);
|
|
124
|
+
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
return (() => {
|
|
128
|
+
var e = j(), d = e.firstChild, t = d.nextSibling;
|
|
129
|
+
return c(t, r(f, {
|
|
130
|
+
node: y,
|
|
131
|
+
depth: 0,
|
|
132
|
+
get expanded() {
|
|
133
|
+
return n();
|
|
134
|
+
},
|
|
135
|
+
onToggle: o
|
|
136
|
+
})), e;
|
|
137
|
+
})();
|
|
138
|
+
}
|
|
139
|
+
_(["click"]);
|
|
140
|
+
export {
|
|
141
|
+
B as FileBrowserWidget
|
|
142
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LogViewerWidget(): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { insert as a, createComponent as _, effect as f, className as S, template as d } from "solid-js/web";
|
|
2
|
+
import { createSignal as b, onMount as $, onCleanup as k, For as y } from "solid-js";
|
|
3
|
+
var C = /* @__PURE__ */ d("<div class=workbench-widget-logviewer><div class=workbench-widget-logviewer__lines>"), L = /* @__PURE__ */ d("<div class=workbench-widget-logviewer__line><span class=workbench-widget-logviewer__ts></span><span></span><span class=workbench-widget-logviewer__msg>");
|
|
4
|
+
const i = [{
|
|
5
|
+
level: "info",
|
|
6
|
+
message: "Request GET /api/health 200 (12ms)"
|
|
7
|
+
}, {
|
|
8
|
+
level: "info",
|
|
9
|
+
message: "WebSocket ping/pong cycle OK (lat=38ms)"
|
|
10
|
+
}, {
|
|
11
|
+
level: "info",
|
|
12
|
+
message: 'Scheduled job "rotate-keys" completed'
|
|
13
|
+
}, {
|
|
14
|
+
level: "debug",
|
|
15
|
+
message: "Cache hit workbench:viewport -> fresh"
|
|
16
|
+
}, {
|
|
17
|
+
level: "warn",
|
|
18
|
+
message: "Slow query detected (234ms) on notes.topics"
|
|
19
|
+
}, {
|
|
20
|
+
level: "warn",
|
|
21
|
+
message: "Retry #2 for upstream call /v1/sync"
|
|
22
|
+
}, {
|
|
23
|
+
level: "error",
|
|
24
|
+
message: "Connection timeout on retry 3"
|
|
25
|
+
}, {
|
|
26
|
+
level: "info",
|
|
27
|
+
message: "Reconnected successfully after backoff"
|
|
28
|
+
}, {
|
|
29
|
+
level: "info",
|
|
30
|
+
message: "Applied migration 0042_user_schema"
|
|
31
|
+
}, {
|
|
32
|
+
level: "debug",
|
|
33
|
+
message: "GC pause 14ms (young)"
|
|
34
|
+
}], M = 1100, w = 10;
|
|
35
|
+
function p(s) {
|
|
36
|
+
const c = String(s.getHours()).padStart(2, "0"), g = String(s.getMinutes()).padStart(2, "0"), n = String(s.getSeconds()).padStart(2, "0");
|
|
37
|
+
return `${c}:${g}:${n}`;
|
|
38
|
+
}
|
|
39
|
+
function A() {
|
|
40
|
+
const s = (() => {
|
|
41
|
+
const t = /* @__PURE__ */ new Date();
|
|
42
|
+
return Array.from({
|
|
43
|
+
length: 6
|
|
44
|
+
}, (r, e) => {
|
|
45
|
+
const l = i[e * 3 % i.length], o = new Date(t.getTime() - (6 - e) * 4200);
|
|
46
|
+
return {
|
|
47
|
+
id: o.getTime() + e,
|
|
48
|
+
ts: p(o),
|
|
49
|
+
level: l.level,
|
|
50
|
+
message: l.message
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
})(), [c, g] = b(s);
|
|
54
|
+
let n = s.length, m;
|
|
55
|
+
const h = () => {
|
|
56
|
+
const t = i[n % i.length];
|
|
57
|
+
n += 1, g((r) => {
|
|
58
|
+
const e = [...r, {
|
|
59
|
+
id: n,
|
|
60
|
+
ts: p(/* @__PURE__ */ new Date()),
|
|
61
|
+
level: t.level,
|
|
62
|
+
message: t.message
|
|
63
|
+
}];
|
|
64
|
+
return e.length > w ? e.slice(e.length - w) : e;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
return $(() => {
|
|
68
|
+
m = window.setInterval(h, M);
|
|
69
|
+
}), k(() => {
|
|
70
|
+
m !== void 0 && window.clearInterval(m);
|
|
71
|
+
}), (() => {
|
|
72
|
+
var t = C(), r = t.firstChild;
|
|
73
|
+
return a(r, _(y, {
|
|
74
|
+
get each() {
|
|
75
|
+
return c();
|
|
76
|
+
},
|
|
77
|
+
children: (e) => (() => {
|
|
78
|
+
var l = L(), o = l.firstChild, v = o.nextSibling, u = v.nextSibling;
|
|
79
|
+
return a(o, () => e.ts), a(v, () => e.level.toUpperCase()), a(u, () => e.message), f(() => S(v, `workbench-widget-logviewer__level workbench-widget-logviewer__level--${e.level}`)), l;
|
|
80
|
+
})()
|
|
81
|
+
})), t;
|
|
82
|
+
})();
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
A as LogViewerWidget
|
|
86
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SystemMonitorWidget(): import("solid-js").JSX.Element;
|