@floegence/floe-webapp-core 0.52.13 → 0.53.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/chat/ChatProvider.js +31 -30
- package/dist/components/chat/hooks/useAttachments.js +27 -26
- package/dist/components/chat/hooks/useCodeDiff.js +24 -23
- package/dist/components/chat/hooks/useCodeHighlight.js +21 -20
- package/dist/components/chat/hooks/useMarkdown.js +27 -26
- package/dist/components/chat/hooks/useMermaid.js +21 -20
- package/dist/components/layout/BottomBar.js +22 -22
- package/dist/components/layout/TopBar.js +7 -7
- package/dist/components/ui/Button.js +1 -1
- package/dist/components/ui/Card.js +1 -1
- package/dist/components/ui/Checkbox.js +69 -69
- package/dist/components/ui/CommandPalette.js +29 -30
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/Dropdown.js +36 -38
- package/dist/components/ui/FloatingWindow.js +2 -3
- package/dist/components/ui/Input.js +3 -3
- package/dist/components/ui/Radio.js +26 -26
- package/dist/components/ui/SegmentedControl.js +6 -6
- package/dist/components/ui/Tabs.js +43 -43
- package/dist/components/ui/floatingPresence.js +1 -1
- package/dist/components/workbench/workbenchHelpers.js +96 -96
- package/dist/context/ThemeContext.js +75 -65
- package/dist/floe.css +27 -55
- package/dist/full.js +61 -59
- package/dist/index.js +26 -24
- package/dist/styles/themes/classicSemanticTokens.d.ts +142 -0
- package/dist/styles/themes/classicSemanticTokens.js +100 -94
- package/dist/styles/themes/presets.d.ts +3 -1
- package/dist/styles/themes/presets.js +126 -63
- package/dist/styles/tokens.d.ts +252 -252
- package/dist/styles/tokens.js +165 -164
- package/dist/styles.css +1 -1
- package/dist/surface.css +17 -42
- package/dist/themes/dark.css +41 -95
- package/dist/themes/light.css +43 -95
- package/dist/themes/shell-presets.generated.css +146 -4
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/secureRandom.d.ts +2 -0
- package/dist/utils/secureRandom.js +11 -0
- package/dist/utils/secureRandom.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { createComponent as Y } from "solid-js/web";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { secureRandomUUID as Z } from "../../utils/secureRandom.js";
|
|
3
|
+
import { createMemo as p, createEffect as $, on as ee, createSignal as b, useContext as te, createContext as oe, batch as F } from "solid-js";
|
|
4
|
+
import { createStore as se, reconcile as T, produce as M } from "solid-js/store";
|
|
4
5
|
import { deferNonBlocking as k } from "../../utils/defer.js";
|
|
5
|
-
import { DEFAULT_VIRTUAL_LIST_CONFIG as
|
|
6
|
-
const z =
|
|
7
|
-
function
|
|
8
|
-
const n =
|
|
6
|
+
import { DEFAULT_VIRTUAL_LIST_CONFIG as ne } from "./types.js";
|
|
7
|
+
const z = oe();
|
|
8
|
+
function Se() {
|
|
9
|
+
const n = te(z);
|
|
9
10
|
if (!n)
|
|
10
11
|
throw new Error("useChatContext must be used within a ChatProvider");
|
|
11
12
|
return n;
|
|
12
13
|
}
|
|
13
|
-
const
|
|
14
|
+
const Ie = (n) => {
|
|
14
15
|
const C = p(() => ({
|
|
15
16
|
placeholder: "Type a message...",
|
|
16
17
|
allowAttachments: !0,
|
|
@@ -19,9 +20,9 @@ const xe = (n) => {
|
|
|
19
20
|
// 10MB
|
|
20
21
|
...n.config
|
|
21
22
|
})), u = p(() => ({
|
|
22
|
-
...
|
|
23
|
+
...ne,
|
|
23
24
|
...n.config?.virtualList
|
|
24
|
-
})), [a, l] =
|
|
25
|
+
})), [a, l] = se(n.initialMessages || []), R = /* @__PURE__ */ new Map(), B = p(() => {
|
|
25
26
|
const e = /* @__PURE__ */ new Map();
|
|
26
27
|
for (let t = 0; t < a.length; t += 1) {
|
|
27
28
|
const o = a[t]?.id;
|
|
@@ -29,19 +30,19 @@ const xe = (n) => {
|
|
|
29
30
|
}
|
|
30
31
|
return e;
|
|
31
32
|
}), x = (e) => {
|
|
32
|
-
const t =
|
|
33
|
+
const t = B().get(e);
|
|
33
34
|
if (t !== void 0) return t;
|
|
34
35
|
const o = a.findIndex((s) => s.id === e);
|
|
35
36
|
return o >= 0 ? o : void 0;
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
+
$(ee(() => n.initialMessages, (e) => {
|
|
38
39
|
e && e.length > 0 && l(T(e));
|
|
39
40
|
}, {
|
|
40
41
|
defer: !0
|
|
41
42
|
}));
|
|
42
43
|
const [A, H] = b(!1), [P, D] = b(!0), [L, S] = b(null), [O, I] = b(0);
|
|
43
44
|
let j = 0;
|
|
44
|
-
const g = /* @__PURE__ */ new Set(), f = [],
|
|
45
|
+
const g = /* @__PURE__ */ new Set(), f = [], m = /* @__PURE__ */ new Map(), q = (e) => {
|
|
45
46
|
if (!g.delete(e)) return;
|
|
46
47
|
const t = f.indexOf(e);
|
|
47
48
|
t >= 0 && f.splice(t, 1), I(g.size);
|
|
@@ -68,9 +69,9 @@ const xe = (n) => {
|
|
|
68
69
|
const t = x(e);
|
|
69
70
|
t !== void 0 && (l(M((o) => {
|
|
70
71
|
o.splice(t, 1);
|
|
71
|
-
})),
|
|
72
|
+
})), m.delete(e));
|
|
72
73
|
}, G = () => {
|
|
73
|
-
l(T([])),
|
|
74
|
+
l(T([])), m.clear();
|
|
74
75
|
}, Q = (e) => {
|
|
75
76
|
l(T(e));
|
|
76
77
|
}, i = (e, t) => {
|
|
@@ -101,7 +102,7 @@ const xe = (n) => {
|
|
|
101
102
|
}
|
|
102
103
|
case "block-start": {
|
|
103
104
|
i(e.messageId, (t) => {
|
|
104
|
-
t.blocks.push(
|
|
105
|
+
t.blocks.push(re(e.blockType));
|
|
105
106
|
});
|
|
106
107
|
break;
|
|
107
108
|
}
|
|
@@ -135,7 +136,7 @@ const xe = (n) => {
|
|
|
135
136
|
}
|
|
136
137
|
}, X = {
|
|
137
138
|
messages: () => a,
|
|
138
|
-
coldMessages:
|
|
139
|
+
coldMessages: R,
|
|
139
140
|
isLoadingHistory: A,
|
|
140
141
|
hasMoreHistory: P,
|
|
141
142
|
streamingMessageId: L,
|
|
@@ -145,9 +146,9 @@ const xe = (n) => {
|
|
|
145
146
|
virtualListConfig: u,
|
|
146
147
|
sendMessage: async (e, t = []) => {
|
|
147
148
|
const o = {
|
|
148
|
-
id:
|
|
149
|
+
id: Z(),
|
|
149
150
|
role: "user",
|
|
150
|
-
blocks:
|
|
151
|
+
blocks: ae(e, t),
|
|
151
152
|
status: "sending",
|
|
152
153
|
timestamp: Date.now()
|
|
153
154
|
};
|
|
@@ -164,9 +165,9 @@ const xe = (n) => {
|
|
|
164
165
|
}
|
|
165
166
|
const s = n.callbacks?.onSendMessage;
|
|
166
167
|
if (!s) return;
|
|
167
|
-
const d = N(), r = e,
|
|
168
|
+
const d = N(), r = e, h = [...t];
|
|
168
169
|
k(() => {
|
|
169
|
-
Promise.resolve().then(() => s(r,
|
|
170
|
+
Promise.resolve().then(() => s(r, h, y)).catch((c) => {
|
|
170
171
|
console.error("Failed to send message:", c);
|
|
171
172
|
}).finally(() => {
|
|
172
173
|
q(d);
|
|
@@ -238,17 +239,17 @@ const xe = (n) => {
|
|
|
238
239
|
});
|
|
239
240
|
});
|
|
240
241
|
},
|
|
241
|
-
heightCache:
|
|
242
|
+
heightCache: m,
|
|
242
243
|
setMessageHeight: (e, t) => {
|
|
243
|
-
|
|
244
|
+
m.set(e, t);
|
|
244
245
|
},
|
|
245
|
-
getMessageHeight: (e) =>
|
|
246
|
+
getMessageHeight: (e) => m.get(e) || u().defaultItemHeight,
|
|
246
247
|
toggleChecklistItem: (e, t, o) => {
|
|
247
248
|
let s = null;
|
|
248
249
|
i(e, (r) => {
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
251
|
-
for (const c of
|
|
250
|
+
const h = r.blocks[t];
|
|
251
|
+
if (h && h.type === "checklist") {
|
|
252
|
+
for (const c of h.items)
|
|
252
253
|
if (c.id === o) {
|
|
253
254
|
s = !c.checked, c.checked = s;
|
|
254
255
|
break;
|
|
@@ -272,7 +273,7 @@ const xe = (n) => {
|
|
|
272
273
|
}
|
|
273
274
|
});
|
|
274
275
|
};
|
|
275
|
-
function
|
|
276
|
+
function re(n) {
|
|
276
277
|
switch (n) {
|
|
277
278
|
case "text":
|
|
278
279
|
return {
|
|
@@ -349,7 +350,7 @@ function ne(n) {
|
|
|
349
350
|
};
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
|
-
function
|
|
353
|
+
function ae(n, C) {
|
|
353
354
|
const u = [];
|
|
354
355
|
for (const a of C)
|
|
355
356
|
a.type === "image" ? u.push({
|
|
@@ -369,6 +370,6 @@ function re(n, C) {
|
|
|
369
370
|
}), u;
|
|
370
371
|
}
|
|
371
372
|
export {
|
|
372
|
-
|
|
373
|
-
|
|
373
|
+
Ie as ChatProvider,
|
|
374
|
+
Se as useChatContext
|
|
374
375
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
import { secureRandomUUID as F } from "../../../utils/secureRandom.js";
|
|
1
2
|
import { createSignal as v } from "solid-js";
|
|
2
|
-
function
|
|
3
|
+
function j(s = {}) {
|
|
3
4
|
const {
|
|
4
5
|
maxAttachments: l = 10,
|
|
5
6
|
maxSize: f = 10 * 1024 * 1024,
|
|
6
7
|
// 10MB
|
|
7
8
|
acceptedTypes: o,
|
|
8
9
|
onUpload: m
|
|
9
|
-
} = s, [p, i] = v([]), [D, u] = v(!1), A = (t) => t.size > f ? `File "${t.name}" is too large. Maximum size is ${
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
} = s, [p, i] = v([]), [D, u] = v(!1), A = (t) => t.size > f ? `File "${t.name}" is too large. Maximum size is ${L(f)}.` : o && !o.split(",").map((e) => e.trim()).some((e) => e.startsWith(".") ? t.name.toLowerCase().endsWith(e.toLowerCase()) : e.endsWith("/*") ? t.type.startsWith(e.slice(0, -1)) : t.type === e) ? `File "${t.name}" is not an accepted file type.` : null, c = async (t) => {
|
|
11
|
+
const r = [], n = p().length;
|
|
12
|
+
n + t.length > l && (r.push(`Maximum ${l} attachments allowed.`), t = t.slice(0, l - n));
|
|
12
13
|
const e = [];
|
|
13
14
|
for (const a of t) {
|
|
14
15
|
const h = A(a);
|
|
15
16
|
if (h) {
|
|
16
|
-
|
|
17
|
+
r.push(h);
|
|
17
18
|
continue;
|
|
18
19
|
}
|
|
19
20
|
const g = a.type.startsWith("image/"), P = {
|
|
20
|
-
id:
|
|
21
|
+
id: F(),
|
|
21
22
|
file: a,
|
|
22
23
|
type: g ? "image" : "file",
|
|
23
24
|
preview: g ? URL.createObjectURL(a) : void 0,
|
|
@@ -29,21 +30,21 @@ function z(s = {}) {
|
|
|
29
30
|
if (e.length > 0 && (i((a) => [...a, ...e]), m))
|
|
30
31
|
for (const a of e)
|
|
31
32
|
w(a);
|
|
32
|
-
return
|
|
33
|
+
return r;
|
|
33
34
|
}, w = async (t) => {
|
|
34
35
|
d(t.id, { status: "uploading", uploadProgress: 0 });
|
|
35
36
|
try {
|
|
36
|
-
const
|
|
37
|
-
d(t.id, { status: "uploaded", uploadProgress: 100, url:
|
|
38
|
-
} catch (
|
|
37
|
+
const r = await m(t.file);
|
|
38
|
+
d(t.id, { status: "uploaded", uploadProgress: 100, url: r });
|
|
39
|
+
} catch (r) {
|
|
39
40
|
d(t.id, {
|
|
40
41
|
status: "error",
|
|
41
|
-
error:
|
|
42
|
+
error: r instanceof Error ? r.message : "Upload failed"
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
|
-
}, d = (t,
|
|
45
|
+
}, d = (t, r) => {
|
|
45
46
|
i(
|
|
46
|
-
(
|
|
47
|
+
(n) => n.map((e) => e.id === t ? { ...e, ...r } : e)
|
|
47
48
|
);
|
|
48
49
|
};
|
|
49
50
|
return {
|
|
@@ -51,22 +52,22 @@ function z(s = {}) {
|
|
|
51
52
|
isDragging: D,
|
|
52
53
|
addFiles: c,
|
|
53
54
|
removeAttachment: (t) => {
|
|
54
|
-
i((
|
|
55
|
-
const
|
|
56
|
-
return
|
|
55
|
+
i((r) => {
|
|
56
|
+
const n = r.find((e) => e.id === t);
|
|
57
|
+
return n?.preview && URL.revokeObjectURL(n.preview), r.filter((e) => e.id !== t);
|
|
57
58
|
});
|
|
58
59
|
},
|
|
59
60
|
clearAttachments: () => {
|
|
60
61
|
const t = p();
|
|
61
|
-
for (const
|
|
62
|
-
|
|
62
|
+
for (const r of t)
|
|
63
|
+
r.preview && URL.revokeObjectURL(r.preview);
|
|
63
64
|
i([]);
|
|
64
65
|
},
|
|
65
66
|
openFilePicker: () => {
|
|
66
67
|
const t = document.createElement("input");
|
|
67
68
|
t.type = "file", t.multiple = !0, o && (t.accept = o), t.onchange = async () => {
|
|
68
|
-
const
|
|
69
|
-
await c(
|
|
69
|
+
const r = Array.from(t.files || []);
|
|
70
|
+
await c(r);
|
|
70
71
|
}, t.click();
|
|
71
72
|
},
|
|
72
73
|
handleDragEnter: (t) => {
|
|
@@ -80,18 +81,18 @@ function z(s = {}) {
|
|
|
80
81
|
},
|
|
81
82
|
handleDrop: async (t) => {
|
|
82
83
|
t.preventDefault(), t.stopPropagation(), u(!1);
|
|
83
|
-
const
|
|
84
|
-
return c(
|
|
84
|
+
const r = Array.from(t.dataTransfer?.files || []);
|
|
85
|
+
return c(r);
|
|
85
86
|
},
|
|
86
87
|
handlePaste: async (t) => {
|
|
87
|
-
const
|
|
88
|
-
return
|
|
88
|
+
const n = Array.from(t.clipboardData?.items || []).filter((e) => e.kind === "file").map((e) => e.getAsFile()).filter((e) => e !== null);
|
|
89
|
+
return n.length > 0 ? (t.preventDefault(), c(n)) : [];
|
|
89
90
|
}
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function L(s) {
|
|
93
94
|
return s < 1024 ? `${s} B` : s < 1024 * 1024 ? `${(s / 1024).toFixed(1)} KB` : `${(s / (1024 * 1024)).toFixed(1)} MB`;
|
|
94
95
|
}
|
|
95
96
|
export {
|
|
96
|
-
|
|
97
|
+
j as useAttachments
|
|
97
98
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { secureRandomUUID as g } from "../../../utils/secureRandom.js";
|
|
2
|
+
import { computeCodeDiffModel as y } from "../diff/diffModel.js";
|
|
2
3
|
let n = null, a = !1, u = null;
|
|
3
|
-
const l = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(),
|
|
4
|
-
function
|
|
4
|
+
const l = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), w = 50;
|
|
5
|
+
function R() {
|
|
5
6
|
if (typeof Worker > "u") return null;
|
|
6
7
|
try {
|
|
7
8
|
return new Worker(new URL(
|
|
@@ -13,7 +14,7 @@ function W() {
|
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function S(t) {
|
|
17
18
|
return n = t, a = !1, u = new Promise((r) => {
|
|
18
19
|
n.onmessage = (e) => {
|
|
19
20
|
if ("type" in e.data && e.data.type === "ready") {
|
|
@@ -27,27 +28,27 @@ function M(t) {
|
|
|
27
28
|
};
|
|
28
29
|
}), u;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function U() {
|
|
31
32
|
return !!n;
|
|
32
33
|
}
|
|
33
|
-
async function
|
|
34
|
+
async function D() {
|
|
34
35
|
return n ? a ? !0 : u ? (await u, !0) : !1 : !1;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function P(t, r) {
|
|
37
38
|
const e = d(t, r), o = i.get(e);
|
|
38
39
|
if (o) return o;
|
|
39
|
-
const c =
|
|
40
|
+
const c = y(t, r);
|
|
40
41
|
return m(e, c), c;
|
|
41
42
|
}
|
|
42
|
-
async function
|
|
43
|
+
async function $(t, r) {
|
|
43
44
|
const e = d(t, r), o = i.get(e);
|
|
44
45
|
if (o) return o;
|
|
45
|
-
if (!await
|
|
46
|
-
const f =
|
|
46
|
+
if (!await D() || !n) {
|
|
47
|
+
const f = y(t, r);
|
|
47
48
|
return m(e, f), f;
|
|
48
49
|
}
|
|
49
50
|
return new Promise((f, s) => {
|
|
50
|
-
const h =
|
|
51
|
+
const h = g();
|
|
51
52
|
l.set(h, {
|
|
52
53
|
resolve: (k) => {
|
|
53
54
|
m(e, k), f(k);
|
|
@@ -56,31 +57,31 @@ async function U(t, r) {
|
|
|
56
57
|
}), n.postMessage({ id: h, oldCode: t, newCode: r });
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function v() {
|
|
60
61
|
n && (n.terminate(), n = null), a = !1, u = null, l.clear(), i.clear();
|
|
61
62
|
}
|
|
62
63
|
function d(t, r) {
|
|
63
|
-
return `${t.length}:${r.length}:${
|
|
64
|
+
return `${t.length}:${r.length}:${p(t)}:${p(r)}`;
|
|
64
65
|
}
|
|
65
66
|
function m(t, r) {
|
|
66
|
-
if (i.size >=
|
|
67
|
+
if (i.size >= w) {
|
|
67
68
|
const e = i.keys().next().value;
|
|
68
69
|
e && i.delete(e);
|
|
69
70
|
}
|
|
70
71
|
i.set(t, r);
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
+
function p(t) {
|
|
73
74
|
let r = 2166136261;
|
|
74
75
|
for (let e = 0; e < t.length; e += 1)
|
|
75
76
|
r ^= t.charCodeAt(e), r = Math.imul(r, 16777619);
|
|
76
77
|
return (r >>> 0).toString(36);
|
|
77
78
|
}
|
|
78
79
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
$ as computeCodeDiff,
|
|
81
|
+
P as computeCodeDiffSync,
|
|
82
|
+
S as configureDiffWorker,
|
|
83
|
+
R as createDiffWorker,
|
|
84
|
+
U as hasDiffWorker,
|
|
85
|
+
v as terminateDiffWorker,
|
|
86
|
+
D as waitForDiffWorker
|
|
86
87
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { secureRandomUUID as m } from "../../../utils/secureRandom.js";
|
|
2
|
+
import { createSignal as w } from "solid-js";
|
|
2
3
|
let t = null, h = !1, l = null;
|
|
3
|
-
const f = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(),
|
|
4
|
+
const f = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), H = 500;
|
|
4
5
|
let g = null;
|
|
5
|
-
function
|
|
6
|
+
function $(e) {
|
|
6
7
|
return t = e, l = new Promise((n) => {
|
|
7
8
|
t.onmessage = (r) => {
|
|
8
9
|
if ("type" in r.data && r.data.type === "ready") {
|
|
@@ -16,24 +17,24 @@ function M(e) {
|
|
|
16
17
|
};
|
|
17
18
|
}), l;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function b(e) {
|
|
20
21
|
g = e;
|
|
21
22
|
}
|
|
22
|
-
async function
|
|
23
|
+
async function S() {
|
|
23
24
|
return t ? h ? !0 : l ? (await l, !0) : !1 : !1;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function W(e) {
|
|
26
27
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
27
28
|
}
|
|
28
|
-
async function
|
|
29
|
+
async function C(e, n, r = "github-dark") {
|
|
29
30
|
const i = `${r}:${n}:${e}`, a = o.get(i);
|
|
30
31
|
if (a) return a;
|
|
31
|
-
if (await
|
|
32
|
+
if (await S() && t)
|
|
32
33
|
return new Promise((u, y) => {
|
|
33
|
-
const d =
|
|
34
|
+
const d = m();
|
|
34
35
|
f.set(d, {
|
|
35
36
|
resolve: (p) => {
|
|
36
|
-
if (o.size >=
|
|
37
|
+
if (o.size >= H) {
|
|
37
38
|
const k = o.keys().next().value;
|
|
38
39
|
k && o.delete(k);
|
|
39
40
|
}
|
|
@@ -48,15 +49,15 @@ async function W(e, n, r = "github-dark") {
|
|
|
48
49
|
return o.set(i, u), u;
|
|
49
50
|
} catch {
|
|
50
51
|
}
|
|
51
|
-
return `<pre class="shiki"><code>${
|
|
52
|
+
return `<pre class="shiki"><code>${W(e)}</code></pre>`;
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
-
const [e, n] =
|
|
54
|
+
function v() {
|
|
55
|
+
const [e, n] = w(!1);
|
|
55
56
|
return {
|
|
56
57
|
highlight: async (i, a, s) => {
|
|
57
58
|
n(!0);
|
|
58
59
|
try {
|
|
59
|
-
return await
|
|
60
|
+
return await C(i, a, s);
|
|
60
61
|
} finally {
|
|
61
62
|
n(!1);
|
|
62
63
|
}
|
|
@@ -64,13 +65,13 @@ function b() {
|
|
|
64
65
|
isLoading: e
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
+
function E() {
|
|
68
69
|
t && (t.terminate(), t = null, h = !1, l = null, f.clear()), o.clear();
|
|
69
70
|
}
|
|
70
71
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
$ as configureShikiWorker,
|
|
73
|
+
b as configureSyncHighlighter,
|
|
74
|
+
C as highlightCode,
|
|
75
|
+
E as terminateShikiWorker,
|
|
76
|
+
v as useCodeHighlight
|
|
76
77
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { secureRandomUUID as w } from "../../../utils/secureRandom.js";
|
|
1
2
|
import { renderMarkdownToHtml as k } from "../markdown/markdown.js";
|
|
2
3
|
let n = null, l = !1, u = null;
|
|
3
|
-
const c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(),
|
|
4
|
-
function
|
|
4
|
+
const c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), m = 200;
|
|
5
|
+
function h() {
|
|
5
6
|
if (typeof Worker > "u") return null;
|
|
6
7
|
try {
|
|
7
8
|
return new Worker(new URL(
|
|
@@ -13,65 +14,65 @@ function y() {
|
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function W(r) {
|
|
17
18
|
return n = r, l = !1, u = new Promise((t) => {
|
|
18
19
|
n.onmessage = (e) => {
|
|
19
20
|
if ("type" in e.data && e.data.type === "ready") {
|
|
20
21
|
l = !0, t();
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
|
-
const { id: o, html:
|
|
24
|
-
s && (c.delete(o), i ? s.reject(new Error(i)) : s.resolve(
|
|
24
|
+
const { id: o, html: f, error: i } = e.data, s = c.get(o);
|
|
25
|
+
s && (c.delete(o), i ? s.reject(new Error(i)) : s.resolve(f));
|
|
25
26
|
}, n.onerror = (e) => {
|
|
26
27
|
console.error("Markdown worker error:", e);
|
|
27
28
|
};
|
|
28
29
|
}), u;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function g() {
|
|
31
32
|
return !!n;
|
|
32
33
|
}
|
|
33
|
-
async function
|
|
34
|
+
async function p() {
|
|
34
35
|
return n ? l ? !0 : u ? (await u, !0) : !1 : !1;
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function R(r) {
|
|
37
38
|
const t = a.get(r);
|
|
38
39
|
if (t) return t;
|
|
39
40
|
const e = k(r);
|
|
40
|
-
return
|
|
41
|
+
return d(r, e), e;
|
|
41
42
|
}
|
|
42
|
-
async function
|
|
43
|
+
async function x(r) {
|
|
43
44
|
const t = a.get(r);
|
|
44
45
|
if (t) return t;
|
|
45
|
-
if (!await
|
|
46
|
+
if (!await p() || !n) {
|
|
46
47
|
const o = k(r);
|
|
47
|
-
return
|
|
48
|
+
return d(r, o), o;
|
|
48
49
|
}
|
|
49
|
-
return new Promise((o,
|
|
50
|
-
const i =
|
|
50
|
+
return new Promise((o, f) => {
|
|
51
|
+
const i = w();
|
|
51
52
|
c.set(i, {
|
|
52
53
|
resolve: (s) => {
|
|
53
|
-
|
|
54
|
+
d(r, s), o(s);
|
|
54
55
|
},
|
|
55
|
-
reject:
|
|
56
|
+
reject: f
|
|
56
57
|
}), n.postMessage({ id: i, content: r });
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function U() {
|
|
60
61
|
n && (n.terminate(), n = null), l = !1, u = null, c.clear(), a.clear();
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
if (a.size >=
|
|
63
|
+
function d(r, t) {
|
|
64
|
+
if (a.size >= m) {
|
|
64
65
|
const e = a.keys().next().value;
|
|
65
66
|
e && a.delete(e);
|
|
66
67
|
}
|
|
67
68
|
a.set(r, t);
|
|
68
69
|
}
|
|
69
70
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
W as configureMarkdownWorker,
|
|
72
|
+
h as createMarkdownWorker,
|
|
73
|
+
g as hasMarkdownWorker,
|
|
74
|
+
x as renderMarkdown,
|
|
75
|
+
R as renderMarkdownSync,
|
|
76
|
+
U as terminateMarkdownWorker,
|
|
77
|
+
p as waitForMarkdownWorker
|
|
77
78
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { secureRandomUUID as w } from "../../../utils/secureRandom.js";
|
|
2
|
+
import { createSignal as M } from "solid-js";
|
|
2
3
|
let a = null, f = !1, c = null;
|
|
3
|
-
const l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(),
|
|
4
|
-
let u = null,
|
|
5
|
-
function
|
|
4
|
+
const l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), k = 200;
|
|
5
|
+
let u = null, p = 0;
|
|
6
|
+
function v(n) {
|
|
6
7
|
return a = n, c = new Promise((o) => {
|
|
7
8
|
a.onmessage = (e) => {
|
|
8
9
|
if ("type" in e.data && e.data.type === "ready") {
|
|
@@ -16,21 +17,21 @@ function E(n) {
|
|
|
16
17
|
};
|
|
17
18
|
}), c;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function I(n) {
|
|
20
21
|
u = n;
|
|
21
22
|
}
|
|
22
|
-
async function
|
|
23
|
+
async function h() {
|
|
23
24
|
return a ? f ? !0 : c ? (await c, !0) : !1 : !1;
|
|
24
25
|
}
|
|
25
|
-
async function
|
|
26
|
+
async function W(n, o = "default") {
|
|
26
27
|
const e = `${o}:${n}`, i = s.get(e);
|
|
27
28
|
if (i) return i;
|
|
28
|
-
if (await
|
|
29
|
+
if (await h() && a)
|
|
29
30
|
return new Promise((t, r) => {
|
|
30
|
-
const m =
|
|
31
|
+
const m = w();
|
|
31
32
|
l.set(m, {
|
|
32
33
|
resolve: (g) => {
|
|
33
|
-
if (s.size >=
|
|
34
|
+
if (s.size >= k) {
|
|
34
35
|
const y = s.keys().next().value;
|
|
35
36
|
y && s.delete(y);
|
|
36
37
|
}
|
|
@@ -41,7 +42,7 @@ async function h(n, o = "default") {
|
|
|
41
42
|
});
|
|
42
43
|
if (u)
|
|
43
44
|
try {
|
|
44
|
-
const t = `mermaid-sync-${
|
|
45
|
+
const t = `mermaid-sync-${p++}`, { svg: r } = await u.render(t, n);
|
|
45
46
|
return s.set(e, r), r;
|
|
46
47
|
} catch (t) {
|
|
47
48
|
const r = t instanceof Error ? t.message : "Failed to render diagram";
|
|
@@ -49,13 +50,13 @@ async function h(n, o = "default") {
|
|
|
49
50
|
}
|
|
50
51
|
throw new Error("Mermaid renderer not configured. Call configureMermaidWorker() or configureSyncMermaid() first.");
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
-
const [n, o] =
|
|
53
|
+
function R() {
|
|
54
|
+
const [n, o] = M(!1);
|
|
54
55
|
return {
|
|
55
56
|
render: async (i, d) => {
|
|
56
57
|
o(!0);
|
|
57
58
|
try {
|
|
58
|
-
return await
|
|
59
|
+
return await W(i, d);
|
|
59
60
|
} finally {
|
|
60
61
|
o(!1);
|
|
61
62
|
}
|
|
@@ -63,13 +64,13 @@ function v() {
|
|
|
63
64
|
isLoading: n
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function S() {
|
|
67
68
|
a && (a.terminate(), a = null, f = !1, c = null, l.clear()), s.clear();
|
|
68
69
|
}
|
|
69
70
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
v as configureMermaidWorker,
|
|
72
|
+
I as configureSyncMermaid,
|
|
73
|
+
W as renderMermaid,
|
|
74
|
+
S as terminateMermaidWorker,
|
|
75
|
+
R as useMermaid
|
|
75
76
|
};
|