@floegence/floe-webapp-core 0.81.2 → 0.81.3
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/chat/blocks/SvgBlock.js +16 -10
- package/dist/components/editor/CodeEditor.d.ts +1 -2
- package/dist/components/editor/CodeEditor.js +8 -9
- package/dist/components/editor/languages.js +37 -37
- package/dist/components/editor/monacoEnvironment.js +5 -5
- package/dist/components/editor/monacoStandaloneRuntime.d.ts +1 -1
- package/dist/components/editor/monacoStandaloneRuntime.js +7 -7
- package/dist/node_modules/.pnpm/dompurify@3.4.16/node_modules/dompurify/dist/purify.es.js +1480 -0
- package/dist/terminal/mockRuntime.js +118 -110
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { normalizeTerminalWorkspaceProfile as
|
|
2
|
-
const
|
|
1
|
+
import { normalizeTerminalWorkspaceProfile as z } from "./workspaceProfile.js";
|
|
2
|
+
const A = {
|
|
3
3
|
"README.md": `# Floe Webapp
|
|
4
4
|
Terminal-first demo workspace with a mobile keyboard.`,
|
|
5
5
|
"package.json": `{
|
|
@@ -26,8 +26,8 @@ VITE_FLOE_ENDPOINT_ID=demo-endpoint`,
|
|
|
26
26
|
"scripts/dev.mjs": `import { spawn } from 'node:child_process';
|
|
27
27
|
|
|
28
28
|
spawn('pnpm', ['--filter', '@floegence/floe-webapp-demo', 'dev'], { stdio: 'inherit' });`
|
|
29
|
-
},
|
|
30
|
-
const
|
|
29
|
+
}, G = (i, n) => {
|
|
30
|
+
const r = z(n?.profile), a = n?.resolveNow ?? (() => (/* @__PURE__ */ new Date()).toString()), e = i.trim();
|
|
31
31
|
if (!e)
|
|
32
32
|
return {
|
|
33
33
|
clear: !1,
|
|
@@ -39,28 +39,28 @@ spawn('pnpm', ['--filter', '@floegence/floe-webapp-demo', 'dev'], { stdio: 'inhe
|
|
|
39
39
|
"Available commands:",
|
|
40
40
|
'pwd, ls, ls -la, cat <file>, less <file>, head -n <count> <file>, tail -n <count> <file>, wc -l|-w|-c <file>, mkdir -p <dir>, touch <file>, chmod <mode> <target>, clear, date, echo <text>, echo "$PATH", echo "$SHELL"',
|
|
41
41
|
"git status, git diff, git log --oneline -10, git add ., git checkout -b <branch>, git commit -m <message>",
|
|
42
|
-
`pnpm ${
|
|
42
|
+
`pnpm ${r.scripts.join(", pnpm ")}`,
|
|
43
43
|
"find . -name <pattern>, grep -R <pattern> src/, grep -n <pattern> <file>, grep -i <pattern> <file>, sort <file>, cut <options> <file>, uname -a, vim <file>, sed -n <range> <file>, awk <program> <file>",
|
|
44
44
|
"curl -I|-L <url>, tar -czf|-xzf|-tf <archive>, ssh <host>, scp <src> <dest>"
|
|
45
45
|
].join(`
|
|
46
46
|
`)
|
|
47
47
|
);
|
|
48
48
|
if (e === "pwd")
|
|
49
|
-
return t(
|
|
49
|
+
return t(r.cwd);
|
|
50
50
|
if (e === "ls" || e === "ls -la") {
|
|
51
|
-
const
|
|
51
|
+
const s = [...r.directories, ...r.files];
|
|
52
52
|
return t(
|
|
53
|
-
e === "ls" ?
|
|
54
|
-
...
|
|
55
|
-
...
|
|
53
|
+
e === "ls" ? s.join(" ") : [
|
|
54
|
+
...r.directories.map((o) => `drwxr-xr-x ${o}`),
|
|
55
|
+
...r.files.map((o) => `-rw-r--r-- ${o}`)
|
|
56
56
|
].join(`
|
|
57
57
|
`)
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
if (e.startsWith("ls ")) {
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
return t(
|
|
61
|
+
const s = e.slice(3).trim().replace(/\/$/, "");
|
|
62
|
+
if (r.directories.includes(s))
|
|
63
|
+
return t(s === "packages" ? "boot core init protocol" : s === "apps" ? "demo" : s === "src" ? "app.ts widgets terminal components" : `${s}/`);
|
|
64
64
|
}
|
|
65
65
|
if (e === "clear")
|
|
66
66
|
return {
|
|
@@ -68,7 +68,7 @@ spawn('pnpm', ['--filter', '@floegence/floe-webapp-demo', 'dev'], { stdio: 'inhe
|
|
|
68
68
|
lines: []
|
|
69
69
|
};
|
|
70
70
|
if (e === "date")
|
|
71
|
-
return t(
|
|
71
|
+
return t(a());
|
|
72
72
|
if (e === 'echo "$PATH"')
|
|
73
73
|
return t("/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin");
|
|
74
74
|
if (e === 'echo "$SHELL"')
|
|
@@ -93,97 +93,98 @@ c942cb5 add terminal-first mobile keyboard
|
|
|
93
93
|
37fa316 release 0.35.7`);
|
|
94
94
|
if (e === "git add .")
|
|
95
95
|
return t("staged tracked changes");
|
|
96
|
-
const f = e.match(/^git checkout -b\s+(
|
|
96
|
+
const f = e.match(/^git checkout -b\s+(\S.*)$/);
|
|
97
97
|
if (f)
|
|
98
98
|
return t(`Switched to a new branch '${f[1]}'`);
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
return t(`[main abc1234] ${
|
|
99
|
+
const u = e.match(/^git commit -m\s+"(.+)"$/);
|
|
100
|
+
if (u)
|
|
101
|
+
return t(`[main abc1234] ${u[1]}
|
|
102
102
|
3 files changed, 42 insertions(+), 8 deletions(-)`);
|
|
103
|
-
const d = e.match(/^cat\s+(
|
|
103
|
+
const d = e.match(/^cat\s+(\S.*)$/);
|
|
104
104
|
if (d) {
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
return t(
|
|
105
|
+
const s = p(r.files, d[1] ?? "");
|
|
106
|
+
if (s)
|
|
107
|
+
return t(s);
|
|
108
108
|
}
|
|
109
|
-
const
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
109
|
+
const S = e.match(/^vim\s+(\S.*)$/);
|
|
110
|
+
if (S) {
|
|
111
|
+
const s = m(S[1] ?? ""), o = p(r.files, s);
|
|
112
112
|
if (o)
|
|
113
|
-
return t(
|
|
113
|
+
return t(_(s, o));
|
|
114
114
|
}
|
|
115
115
|
const $ = e.match(/^pnpm\s+([a-z0-9:-]+)$/i);
|
|
116
|
-
if ($ &&
|
|
116
|
+
if ($ && r.scripts.includes($[1] ?? ""))
|
|
117
117
|
return t(`> pnpm ${$[1]}
|
|
118
118
|
completed mock run for script '${$[1]}'`);
|
|
119
|
-
if (e.match(/^find \. -name\s+(
|
|
119
|
+
if (e.match(/^find \. -name\s+(\S.*)$/))
|
|
120
120
|
return t(["./README.md", "./packages/core/src/terminal/suggestionEngine.ts"].join(`
|
|
121
121
|
`));
|
|
122
|
-
|
|
122
|
+
const j = e.match(/^grep -R\s+(\S.*)$/)?.[1], L = j ? C(j) : null;
|
|
123
|
+
if (L && ["src", "src/"].includes(L[1]))
|
|
123
124
|
return t("src/terminal/suggestionEngine.ts:getTerminalSuggestions");
|
|
124
|
-
const b = e.match(/^grep\s+(-n|-i)\s+(
|
|
125
|
+
const b = e.match(/^grep\s+(-n|-i)\s+(\S+)\s+(\S.*)$/);
|
|
125
126
|
if (b) {
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
return t(
|
|
127
|
+
const s = b[1] ?? "", o = D(b[2] ?? ""), c = m(b[3] ?? ""), l = p(r.files, c);
|
|
128
|
+
if (l)
|
|
129
|
+
return t(P(l, c, o, s));
|
|
129
130
|
}
|
|
130
|
-
const v = e.match(/^less\s+(
|
|
131
|
+
const v = e.match(/^less\s+(\S.*)$/);
|
|
131
132
|
if (v) {
|
|
132
|
-
const
|
|
133
|
+
const s = m(v[1] ?? ""), o = p(r.files, s);
|
|
133
134
|
if (o)
|
|
134
135
|
return t(`${o}
|
|
135
136
|
(END)`);
|
|
136
137
|
}
|
|
137
|
-
const
|
|
138
|
-
if (L)
|
|
139
|
-
return t(`created directory ${l(L[1] ?? "")}`);
|
|
140
|
-
const N = e.match(/^touch\s+(.+)$/);
|
|
138
|
+
const N = e.match(/^mkdir\s+-p\s+(\S.*)$/);
|
|
141
139
|
if (N)
|
|
142
|
-
return t(`
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
140
|
+
return t(`created directory ${m(N[1] ?? "")}`);
|
|
141
|
+
const T = e.match(/^touch\s+(\S.*)$/);
|
|
142
|
+
if (T)
|
|
143
|
+
return t(`updated timestamp for ${m(T[1] ?? "")}`);
|
|
144
|
+
const w = e.match(/^chmod\s+(\S+)\s+(\S.*)$/);
|
|
145
|
+
if (w)
|
|
145
146
|
return t(
|
|
146
|
-
`mode ${
|
|
147
|
+
`mode ${w[1] ?? ""} applied to ${m(w[2] ?? "")}`
|
|
147
148
|
);
|
|
148
|
-
const h = e.match(/^head(?:\s+-n\s+(\d+))?(?:\s+-c\s+(\d+))?\s+(
|
|
149
|
+
const h = e.match(/^head(?:\s+-n\s+(\d+))?(?:\s+-c\s+(\d+))?\s+(\S.*)$/);
|
|
149
150
|
if (h) {
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
151
|
+
const s = Number(h[1] ?? 10), o = h[2] ? Number(h[2]) : null, c = m(h[3] ?? ""), l = p(r.files, c);
|
|
152
|
+
if (l)
|
|
152
153
|
return t(
|
|
153
|
-
o === null ?
|
|
154
|
+
o === null ? R(l, s) : l.slice(0, Math.max(0, o))
|
|
154
155
|
);
|
|
155
156
|
}
|
|
156
|
-
const g = e.match(/^tail(?:\s+-n\s+(\d+))?(?:\s+-c\s+(\d+))?\s+(
|
|
157
|
+
const g = e.match(/^tail(?:\s+-n\s+(\d+))?(?:\s+-c\s+(\d+))?\s+(\S.*)$/);
|
|
157
158
|
if (g) {
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
159
|
+
const s = Number(g[1] ?? 10), o = g[2] ? Number(g[2]) : null, c = m(g[3] ?? ""), l = p(r.files, c);
|
|
160
|
+
if (l)
|
|
160
161
|
return t(
|
|
161
|
-
o === null ?
|
|
162
|
+
o === null ? W(l, s) : l.slice(Math.max(0, l.length - Math.max(0, o)))
|
|
162
163
|
);
|
|
163
164
|
}
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
166
|
-
const
|
|
165
|
+
const M = e.match(/^wc\s+(-[lwc])\s+(\S.*)$/);
|
|
166
|
+
if (M) {
|
|
167
|
+
const s = M[1] ?? "", o = m(M[2] ?? ""), c = p(r.files, o);
|
|
167
168
|
if (c)
|
|
168
|
-
return t(
|
|
169
|
+
return t(O(c, o, s));
|
|
169
170
|
}
|
|
170
|
-
const x = e.match(/^sort(?:\s+(-u|-r))?\s+(
|
|
171
|
+
const x = e.match(/^sort(?:\s+(-u|-r))?\s+(\S.*)$/);
|
|
171
172
|
if (x) {
|
|
172
|
-
const
|
|
173
|
+
const s = x[1] ?? "", o = m(x[2] ?? ""), c = p(r.files, o);
|
|
173
174
|
if (c)
|
|
174
|
-
return t(
|
|
175
|
+
return t(I(c, s));
|
|
175
176
|
}
|
|
176
|
-
const
|
|
177
|
+
const y = e.match(/^cut\s+(\S.*)$/)?.[1], E = y ? C(y) : null;
|
|
177
178
|
if (E) {
|
|
178
|
-
const
|
|
179
|
+
const s = E[0], o = m(E[1]), c = p(r.files, o);
|
|
179
180
|
if (c)
|
|
180
|
-
return t(
|
|
181
|
+
return t(B(c, s));
|
|
181
182
|
}
|
|
182
|
-
const k = e.match(/^sed -n '(\d+),(\d+)p'\s+(
|
|
183
|
+
const k = e.match(/^sed -n '(\d+),(\d+)p'\s+(\S.*)$/);
|
|
183
184
|
if (k) {
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
186
|
-
return t(
|
|
185
|
+
const s = Number(k[1] ?? 1), o = Number(k[2] ?? s), c = m(k[3] ?? ""), l = p(r.files, c);
|
|
186
|
+
if (l)
|
|
187
|
+
return t(F(l, s, o));
|
|
187
188
|
}
|
|
188
189
|
return e === "sed -E 's/floe/Floe/g' README.md" ? t(`# Floe Webapp
|
|
189
190
|
Terminal-first demo workspace with a mobile keyboard.`) : e === "awk '{print $1}' package.json" ? t(["{", '"name":', '"scripts":', '"dev":', '"build":', "}", "}"].join(`
|
|
@@ -210,78 +211,85 @@ Last login: Tue Mar 17 22:00:00 2026`) : e === "ssh -p 22 user@example.com" ? t(
|
|
|
210
211
|
]
|
|
211
212
|
};
|
|
212
213
|
};
|
|
213
|
-
function t(
|
|
214
|
+
function t(i) {
|
|
214
215
|
return {
|
|
215
216
|
clear: !1,
|
|
216
217
|
lines: [
|
|
217
218
|
{
|
|
218
219
|
type: "output",
|
|
219
|
-
content:
|
|
220
|
+
content: i
|
|
220
221
|
}
|
|
221
222
|
]
|
|
222
223
|
};
|
|
223
224
|
}
|
|
224
|
-
function p(
|
|
225
|
-
const
|
|
226
|
-
return !
|
|
225
|
+
function p(i, n) {
|
|
226
|
+
const r = m(n);
|
|
227
|
+
return !r || !i.includes(r) ? null : A[r] ?? `// Mock contents for ${r}
|
|
227
228
|
// Generated by the shared terminal runtime.`;
|
|
228
229
|
}
|
|
229
|
-
function
|
|
230
|
-
return
|
|
230
|
+
function m(i) {
|
|
231
|
+
return i.trim().replace(/\/$/, "");
|
|
231
232
|
}
|
|
232
|
-
function
|
|
233
|
-
const
|
|
234
|
-
return
|
|
233
|
+
function D(i) {
|
|
234
|
+
const n = i.trim();
|
|
235
|
+
return n.startsWith('"') && n.endsWith('"') || n.startsWith("'") && n.endsWith("'") ? n.slice(1, -1) : n;
|
|
235
236
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
238
|
-
`).slice(0, Math.max(0,
|
|
237
|
+
function R(i, n) {
|
|
238
|
+
return i.split(`
|
|
239
|
+
`).slice(0, Math.max(0, n)).join(`
|
|
239
240
|
`);
|
|
240
241
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
243
|
-
`).slice(-Math.max(0,
|
|
242
|
+
function W(i, n) {
|
|
243
|
+
return i.split(`
|
|
244
|
+
`).slice(-Math.max(0, n)).join(`
|
|
244
245
|
`);
|
|
245
246
|
}
|
|
246
|
-
function
|
|
247
|
-
return
|
|
248
|
-
`).slice(Math.max(0,
|
|
247
|
+
function F(i, n, r) {
|
|
248
|
+
return i.split(`
|
|
249
|
+
`).slice(Math.max(0, n - 1), Math.max(n - 1, r)).join(`
|
|
249
250
|
`);
|
|
250
251
|
}
|
|
251
|
-
function
|
|
252
|
-
return `"${
|
|
253
|
-
`).length}L, ${
|
|
252
|
+
function _(i, n) {
|
|
253
|
+
return `"${i}" ${n.split(`
|
|
254
|
+
`).length}L, ${n.length}B
|
|
254
255
|
~
|
|
255
|
-
Mock vim session opened for ${
|
|
256
|
+
Mock vim session opened for ${i}`;
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
-
return
|
|
259
|
-
`).length} ${
|
|
258
|
+
function O(i, n, r) {
|
|
259
|
+
return r === "-l" ? `${i.split(`
|
|
260
|
+
`).length} ${n}` : r === "-w" ? `${i.trim().split(/\s+/).filter(Boolean).length} ${n}` : `${i.length} ${n}`;
|
|
260
261
|
}
|
|
261
|
-
function
|
|
262
|
-
if (!
|
|
263
|
-
return `${
|
|
264
|
-
const e =
|
|
265
|
-
return
|
|
266
|
-
`).map((
|
|
267
|
-
({ line:
|
|
268
|
-
).map(({ line:
|
|
269
|
-
`) || `${
|
|
262
|
+
function P(i, n, r, a) {
|
|
263
|
+
if (!r)
|
|
264
|
+
return `${n}: pattern is empty`;
|
|
265
|
+
const e = a === "-i" ? r.toLowerCase() : r;
|
|
266
|
+
return i.split(`
|
|
267
|
+
`).map((u, d) => ({ line: u, index: d })).filter(
|
|
268
|
+
({ line: u }) => (a === "-i" ? u.toLowerCase() : u).includes(e)
|
|
269
|
+
).map(({ line: u, index: d }) => a === "-n" ? `${d + 1}:${u}` : u).join(`
|
|
270
|
+
`) || `${n}: no matches`;
|
|
270
271
|
}
|
|
271
|
-
function
|
|
272
|
-
const
|
|
272
|
+
function I(i, n) {
|
|
273
|
+
const a = [...i.split(`
|
|
273
274
|
`)].sort((e, f) => e.localeCompare(f));
|
|
274
|
-
return
|
|
275
|
-
`) :
|
|
276
|
-
`) :
|
|
275
|
+
return n === "-u" ? [...new Set(a)].join(`
|
|
276
|
+
`) : n === "-r" ? a.reverse().join(`
|
|
277
|
+
`) : a.join(`
|
|
277
278
|
`);
|
|
278
279
|
}
|
|
279
|
-
function
|
|
280
|
-
const
|
|
281
|
-
return
|
|
282
|
-
`).map((
|
|
280
|
+
function B(i, n) {
|
|
281
|
+
const r = n.match(/-d\s+"([^"]+)"/), a = n.match(/-f\s+(\d+)/), e = r?.[1] ?? " ", f = Math.max(1, Number(a?.[1] ?? 1)) - 1;
|
|
282
|
+
return i.split(`
|
|
283
|
+
`).map((u) => u.split(e)[f] ?? "").join(`
|
|
283
284
|
`);
|
|
284
285
|
}
|
|
286
|
+
function C(i) {
|
|
287
|
+
let n = i.length - 1;
|
|
288
|
+
for (; n >= 0 && !/\s/.test(i[n]); ) n -= 1;
|
|
289
|
+
if (n < 0) return null;
|
|
290
|
+
const r = i.slice(n + 1), a = i.slice(0, n).trimEnd();
|
|
291
|
+
return a ? [a, r] : null;
|
|
292
|
+
}
|
|
285
293
|
export {
|
|
286
|
-
|
|
294
|
+
G as runTerminalMockCommand
|
|
287
295
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/floe-webapp-core",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -152,9 +152,10 @@
|
|
|
152
152
|
"dependencies": {
|
|
153
153
|
"clsx": "^2.1.1",
|
|
154
154
|
"diff": "^8.0.4",
|
|
155
|
+
"dompurify": "^3.4.15",
|
|
155
156
|
"marked": "^17.0.6",
|
|
156
157
|
"mermaid": "^11.17.2",
|
|
157
|
-
"monaco-editor": "^0.
|
|
158
|
+
"monaco-editor": "^0.57.0",
|
|
158
159
|
"pdfjs-dist": "6.3.289",
|
|
159
160
|
"shiki": "^3.23.0",
|
|
160
161
|
"solid-motionone": "^1.0.4",
|