@alexpeng/dsh-custom-plugin 0.9.1 → 0.9.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/CHANGELOG.md +50 -0
- package/README.i18n.yaml +7 -7
- package/README.md +3 -1
- package/README.zh.md +2 -1
- package/lib/client.js +507 -305
- package/lib/client.js.map +1 -1
- package/lib/types/client/mermaid-render.d.ts +36 -0
- package/lib/types/client/mermaid-scan.d.ts +21 -0
- package/package.json +105 -104
package/lib/client.js
CHANGED
|
@@ -673,6 +673,130 @@ window.__ModuleLoader__.load({
|
|
|
673
673
|
};
|
|
674
674
|
}
|
|
675
675
|
//#endregion
|
|
676
|
+
//#region src/client/mermaid-url.ts
|
|
677
|
+
function bytesToBase64Url(bytes) {
|
|
678
|
+
let bin = "";
|
|
679
|
+
for (const byte of bytes) bin += String.fromCharCode(byte);
|
|
680
|
+
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
681
|
+
}
|
|
682
|
+
async function deflateZlibBase64Url(text) {
|
|
683
|
+
const Ctor = globalThis.CompressionStream;
|
|
684
|
+
if (typeof Ctor !== "function") return null;
|
|
685
|
+
try {
|
|
686
|
+
const stream = new Ctor("deflate");
|
|
687
|
+
const writer = stream.writable.getWriter();
|
|
688
|
+
writer.write(new TextEncoder().encode(text));
|
|
689
|
+
writer.close();
|
|
690
|
+
return bytesToBase64Url(new Uint8Array(await new Response(stream.readable).arrayBuffer()));
|
|
691
|
+
} catch {
|
|
692
|
+
return null;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
/** Build the `https://mermaid.live/edit#pako:…` share link for one diagram. */
|
|
696
|
+
async function mermaidLiveUrl(code) {
|
|
697
|
+
const state = JSON.stringify({
|
|
698
|
+
code,
|
|
699
|
+
mermaid: { theme: "default" }
|
|
700
|
+
});
|
|
701
|
+
return "https://mermaid.live/edit#pako:" + (await deflateZlibBase64Url(state) ?? bytesToBase64Url(new TextEncoder().encode(state)));
|
|
702
|
+
}
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/client/timeline-diff.ts
|
|
705
|
+
/** Whether two timeline entries would render identically. */
|
|
706
|
+
function sameTimelineItem(a, b) {
|
|
707
|
+
return a.seq === b.seq && a.time === b.time && a.turn === b.turn && a.text === b.text && a.imageCount === b.imageCount && a.hasLatex === b.hasLatex && a.hasMathml === b.hasMathml && a.hasMermaid === b.hasMermaid;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Diff one fetched timeline against the previous snapshot by sequence.
|
|
711
|
+
* @param previous - previous ordered items, or null when this is the first fetch.
|
|
712
|
+
* @param previousBySeq - seq index for `previous` (same generation), or null.
|
|
713
|
+
* @param next - freshly fetched items.
|
|
714
|
+
* @returns reused items plus whether any rendered field changed.
|
|
715
|
+
*/
|
|
716
|
+
function reuseTimelineItems(previous, previousBySeq, next) {
|
|
717
|
+
const bySeq = /* @__PURE__ */ new Map();
|
|
718
|
+
const items = [];
|
|
719
|
+
let changed = previous === null || previous.length !== next.length;
|
|
720
|
+
for (let index = 0; index < next.length; index++) {
|
|
721
|
+
const raw = next[index];
|
|
722
|
+
const old = previousBySeq?.get(raw.seq);
|
|
723
|
+
const item = old !== void 0 && sameTimelineItem(old, raw) ? old : raw;
|
|
724
|
+
items.push(item);
|
|
725
|
+
bySeq.set(item.seq, item);
|
|
726
|
+
if (!changed && previous !== null && previous[index] !== item) changed = true;
|
|
727
|
+
}
|
|
728
|
+
return {
|
|
729
|
+
items,
|
|
730
|
+
bySeq,
|
|
731
|
+
changed
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
/** Compact DOM identity for a rendered Mermaid block. A 32-bit FNV-1a hash
|
|
735
|
+
* plus the source length is enough to distinguish live blocks without
|
|
736
|
+
* duplicating every diagram's text into a `data-*` attribute. */
|
|
737
|
+
function mermaidCodeKey(code) {
|
|
738
|
+
let hash = 2166136261;
|
|
739
|
+
for (let i = 0; i < code.length; i++) {
|
|
740
|
+
hash ^= code.charCodeAt(i);
|
|
741
|
+
hash = Math.imul(hash, 16777619);
|
|
742
|
+
}
|
|
743
|
+
return (hash >>> 0).toString(36) + "-" + code.length.toString(36);
|
|
744
|
+
}
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region src/client/mermaid-render.ts
|
|
747
|
+
/** A fresh id per render; Mermaid appends `d` + id / `i` + id scratch nodes. */
|
|
748
|
+
function mermaidScratchId() {
|
|
749
|
+
return "vx-mmd-" + Date.now() + Math.floor(Math.random() * 9999);
|
|
750
|
+
}
|
|
751
|
+
/** Remove the three nodes Mermaid may leave for one render id. */
|
|
752
|
+
function removeMermaidScratch(doc, id) {
|
|
753
|
+
if (doc === null) return;
|
|
754
|
+
for (const scratch of [
|
|
755
|
+
id,
|
|
756
|
+
"d" + id,
|
|
757
|
+
"i" + id
|
|
758
|
+
]) doc.getElementById(scratch)?.remove();
|
|
759
|
+
}
|
|
760
|
+
/** Remove error diagrams left in <body> by builds without error suppression. */
|
|
761
|
+
function removeLegacyMermaidErrors(doc) {
|
|
762
|
+
if (doc === null) return;
|
|
763
|
+
for (const leftover of Array.from(doc.querySelectorAll("body > div[id^=\"dvx-mmd-\"]"))) leftover.remove();
|
|
764
|
+
}
|
|
765
|
+
async function renderMermaid(code, dark = false, options = {}) {
|
|
766
|
+
const doc = options.doc !== void 0 ? options.doc : typeof document !== "undefined" ? document : null;
|
|
767
|
+
const mermaid = (options.win !== void 0 ? options.win : typeof window !== "undefined" ? window : null)?.mermaid;
|
|
768
|
+
if (mermaid === void 0) return {
|
|
769
|
+
ok: false,
|
|
770
|
+
error: "引擎未就绪"
|
|
771
|
+
};
|
|
772
|
+
const id = mermaidScratchId();
|
|
773
|
+
try {
|
|
774
|
+
mermaid.initialize({
|
|
775
|
+
startOnLoad: false,
|
|
776
|
+
theme: dark ? "dark" : "default",
|
|
777
|
+
securityLevel: "strict",
|
|
778
|
+
suppressErrorRendering: true
|
|
779
|
+
});
|
|
780
|
+
const out = await mermaid.render(id, code);
|
|
781
|
+
const svg = typeof out === "string" ? out : out?.svg ?? "";
|
|
782
|
+
if (svg === "") return {
|
|
783
|
+
ok: false,
|
|
784
|
+
error: "引擎未返回 SVG"
|
|
785
|
+
};
|
|
786
|
+
return {
|
|
787
|
+
ok: true,
|
|
788
|
+
svg
|
|
789
|
+
};
|
|
790
|
+
} catch (error) {
|
|
791
|
+
return {
|
|
792
|
+
ok: false,
|
|
793
|
+
error: String(error?.message ?? error)
|
|
794
|
+
};
|
|
795
|
+
} finally {
|
|
796
|
+
removeMermaidScratch(doc, id);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
//#endregion
|
|
676
800
|
//#region src/client/mermaid-code.ts
|
|
677
801
|
/**
|
|
678
802
|
* Pure Mermaid code-block detection helpers for the in-place renderer.
|
|
@@ -787,75 +911,157 @@ window.__ModuleLoader__.load({
|
|
|
787
911
|
return true;
|
|
788
912
|
}
|
|
789
913
|
//#endregion
|
|
790
|
-
//#region src/client/mermaid-
|
|
791
|
-
function bytesToBase64Url(bytes) {
|
|
792
|
-
let bin = "";
|
|
793
|
-
for (const byte of bytes) bin += String.fromCharCode(byte);
|
|
794
|
-
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
795
|
-
}
|
|
796
|
-
async function deflateZlibBase64Url(text) {
|
|
797
|
-
const Ctor = globalThis.CompressionStream;
|
|
798
|
-
if (typeof Ctor !== "function") return null;
|
|
799
|
-
try {
|
|
800
|
-
const stream = new Ctor("deflate");
|
|
801
|
-
const writer = stream.writable.getWriter();
|
|
802
|
-
writer.write(new TextEncoder().encode(text));
|
|
803
|
-
writer.close();
|
|
804
|
-
return bytesToBase64Url(new Uint8Array(await new Response(stream.readable).arrayBuffer()));
|
|
805
|
-
} catch {
|
|
806
|
-
return null;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
/** Build the `https://mermaid.live/edit#pako:…` share link for one diagram. */
|
|
810
|
-
async function mermaidLiveUrl(code) {
|
|
811
|
-
const state = JSON.stringify({
|
|
812
|
-
code,
|
|
813
|
-
mermaid: { theme: "default" }
|
|
814
|
-
});
|
|
815
|
-
return "https://mermaid.live/edit#pako:" + (await deflateZlibBase64Url(state) ?? bytesToBase64Url(new TextEncoder().encode(state)));
|
|
816
|
-
}
|
|
817
|
-
//#endregion
|
|
818
|
-
//#region src/client/timeline-diff.ts
|
|
819
|
-
/** Whether two timeline entries would render identically. */
|
|
820
|
-
function sameTimelineItem(a, b) {
|
|
821
|
-
return a.seq === b.seq && a.time === b.time && a.turn === b.turn && a.text === b.text && a.imageCount === b.imageCount && a.hasLatex === b.hasLatex && a.hasMathml === b.hasMathml && a.hasMermaid === b.hasMermaid;
|
|
822
|
-
}
|
|
914
|
+
//#region src/client/mermaid-scan.ts
|
|
823
915
|
/**
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
*
|
|
828
|
-
*
|
|
916
|
+
* In-place Mermaid rendering over the GUI's code-block DOM, extracted from the
|
|
917
|
+
* React component so it can be benchmarked and tested without mounting the
|
|
918
|
+
* whole shell.
|
|
919
|
+
*
|
|
920
|
+
* Behaviour is deliberately unchanged: the GUI-owned `<pre>` node is never
|
|
921
|
+
* moved, the plugin-owned wrapper is inserted before the block and toggles the
|
|
922
|
+
* block's `display`, a failed render keeps the raw fence plus a retry marker,
|
|
923
|
+
* and a theme flip invalidates the rendered-SVG memo.
|
|
924
|
+
* @module @alexpeng/dsh-custom-plugin/client/mermaid-scan
|
|
829
925
|
*/
|
|
830
|
-
function
|
|
831
|
-
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
926
|
+
function createMermaidScanner(deps) {
|
|
927
|
+
/** Blocks with a render already in flight (WeakSet: dead blocks drop out). */
|
|
928
|
+
const inflight = /* @__PURE__ */ new WeakSet();
|
|
929
|
+
/** Previous scan theme; a flip invalidates rendered-SVG memoization. */
|
|
930
|
+
let lastDark = null;
|
|
931
|
+
/** The banner's language label: `.md-code-block > bannerWrap > banner >
|
|
932
|
+
* infostring` is the GUI CodeBlock's stable shape (its CSS classes are
|
|
933
|
+
* hashed, the structure is not). */
|
|
934
|
+
function blockInfostring(block) {
|
|
935
|
+
const info = block.querySelector(":scope > div:first-child > div:first-child > div:first-child");
|
|
936
|
+
return info !== null ? info.textContent ?? "" : null;
|
|
937
|
+
}
|
|
938
|
+
/** Raw fence text: the GUI keeps unknown languages (mermaid among them) on
|
|
939
|
+
* the plain `<pre><code>` path, so `pre` always carries the source. */
|
|
940
|
+
function blockCodeText(block) {
|
|
941
|
+
const pre = block.querySelector("pre");
|
|
942
|
+
return pre !== null ? pre.textContent ?? "" : null;
|
|
943
|
+
}
|
|
944
|
+
/** Insert/refresh the diagram wrapper before one code block. Never moves
|
|
945
|
+
* GUI-owned nodes — React keeps reconciling its tree; the block is only
|
|
946
|
+
* visually swapped with the diagram stage via display. */
|
|
947
|
+
async function renderInPlace(block, code, dark) {
|
|
948
|
+
const key = mermaidCodeKey(code);
|
|
949
|
+
const existingWrap = block.previousElementSibling;
|
|
950
|
+
if (block.dataset.vxMmd === key && existingWrap !== null && existingWrap.classList.contains("vx-mmd-wrap")) return;
|
|
951
|
+
if (!await deps.ensureMermaid()) {
|
|
952
|
+
block.dataset.vxMmdFail = key;
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
const r = await deps.renderMermaid(code, dark);
|
|
956
|
+
if (!r.ok) {
|
|
957
|
+
block.dataset.vxMmdFail = key;
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
960
|
+
delete block.dataset.vxMmdFail;
|
|
961
|
+
const d = typeof document !== "undefined" ? document : null;
|
|
962
|
+
if (d === null) return;
|
|
963
|
+
let wrap = block.previousElementSibling;
|
|
964
|
+
if (wrap === null || !wrap.classList.contains("vx-mmd-wrap")) {
|
|
965
|
+
wrap = d.createElement("div");
|
|
966
|
+
wrap.className = "vx-mmd-wrap";
|
|
967
|
+
block.parentElement?.insertBefore(wrap, block);
|
|
968
|
+
const bar = d.createElement("div");
|
|
969
|
+
bar.className = "vx-mmd-bar";
|
|
970
|
+
const diagramBtn = d.createElement("button");
|
|
971
|
+
diagramBtn.type = "button";
|
|
972
|
+
diagramBtn.className = "vx-mmd-btn active";
|
|
973
|
+
diagramBtn.textContent = "图表";
|
|
974
|
+
const codeBtn = d.createElement("button");
|
|
975
|
+
codeBtn.type = "button";
|
|
976
|
+
codeBtn.className = "vx-mmd-btn";
|
|
977
|
+
codeBtn.textContent = "代码";
|
|
978
|
+
const live = d.createElement("a");
|
|
979
|
+
live.className = "vx-mmd-live";
|
|
980
|
+
live.target = "_blank";
|
|
981
|
+
live.rel = "noopener noreferrer";
|
|
982
|
+
live.textContent = "mermaid.live";
|
|
983
|
+
mermaidLiveUrl(code).then((url) => {
|
|
984
|
+
live.href = url;
|
|
985
|
+
}).catch(() => {});
|
|
986
|
+
bar.append(diagramBtn, codeBtn, live);
|
|
987
|
+
const stage = d.createElement("div");
|
|
988
|
+
stage.className = "vx-mmd-stage";
|
|
989
|
+
wrap.append(bar, stage);
|
|
990
|
+
const showDiagram = () => {
|
|
991
|
+
stage.style.display = "";
|
|
992
|
+
block.style.display = "none";
|
|
993
|
+
diagramBtn.classList.add("active");
|
|
994
|
+
codeBtn.classList.remove("active");
|
|
995
|
+
};
|
|
996
|
+
const showCode = () => {
|
|
997
|
+
stage.style.display = "none";
|
|
998
|
+
block.style.display = "";
|
|
999
|
+
diagramBtn.classList.remove("active");
|
|
1000
|
+
codeBtn.classList.add("active");
|
|
1001
|
+
};
|
|
1002
|
+
diagramBtn.addEventListener("click", showDiagram);
|
|
1003
|
+
codeBtn.addEventListener("click", showCode);
|
|
1004
|
+
showDiagram();
|
|
1005
|
+
}
|
|
1006
|
+
const stage = wrap.querySelector(".vx-mmd-stage");
|
|
1007
|
+
if (stage === null) return;
|
|
1008
|
+
stage.innerHTML = r.svg;
|
|
1009
|
+
block.dataset.vxMmd = key;
|
|
1010
|
+
}
|
|
1011
|
+
/** Scan every chat code block and render the mermaid ones in place. */
|
|
1012
|
+
async function scan(dark) {
|
|
1013
|
+
const d = typeof document !== "undefined" ? document : null;
|
|
1014
|
+
if (d === null) return;
|
|
1015
|
+
if (lastDark !== null && lastDark !== dark) for (const block of Array.from(d.querySelectorAll(".md-code-block"))) delete block.dataset.vxMmd;
|
|
1016
|
+
lastDark = dark;
|
|
1017
|
+
removeLegacyMermaidErrors(d);
|
|
1018
|
+
for (const wrap of Array.from(d.querySelectorAll(".vx-mmd-wrap"))) {
|
|
1019
|
+
const next = wrap.nextElementSibling;
|
|
1020
|
+
if (next === null || !next.classList.contains("md-code-block")) wrap.remove();
|
|
1021
|
+
}
|
|
1022
|
+
for (const block of Array.from(d.querySelectorAll(".md-code-block"))) {
|
|
1023
|
+
if (inflight.has(block)) continue;
|
|
1024
|
+
const codeRaw = blockCodeText(block);
|
|
1025
|
+
if (codeRaw === null) continue;
|
|
1026
|
+
const code = normalizeMermaidText(codeRaw).trim();
|
|
1027
|
+
if (code === "") continue;
|
|
1028
|
+
const key = mermaidCodeKey(code);
|
|
1029
|
+
const info = blockInfostring(block);
|
|
1030
|
+
if (info !== null && info.trim().toLowerCase() === "mermaid") {
|
|
1031
|
+
if (code.split("\n").filter((l) => l.trim() !== "").length < 2) continue;
|
|
1032
|
+
} else {
|
|
1033
|
+
if (!isGenericInfostring(info)) continue;
|
|
1034
|
+
if (!isMermaidCode(codeRaw)) continue;
|
|
1035
|
+
}
|
|
1036
|
+
if (block.dataset.vxMmd === key || block.dataset.vxMmdFail === key) continue;
|
|
1037
|
+
inflight.add(block);
|
|
1038
|
+
try {
|
|
1039
|
+
await renderInPlace(block, code, dark);
|
|
1040
|
+
} finally {
|
|
1041
|
+
inflight.delete(block);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
/** Undo in-place rendering (feature toggled off): remove wrappers, unhide
|
|
1046
|
+
* code blocks. Diagram DOM is plugin-owned, so removal is safe. */
|
|
1047
|
+
function restore() {
|
|
1048
|
+
const d = typeof document !== "undefined" ? document : null;
|
|
1049
|
+
if (d === null) return;
|
|
1050
|
+
for (const wrap of Array.from(d.querySelectorAll(".vx-mmd-wrap"))) {
|
|
1051
|
+
const next = wrap.nextElementSibling;
|
|
1052
|
+
if (next !== null && next.classList.contains("md-code-block")) next.style.display = "";
|
|
1053
|
+
wrap.remove();
|
|
1054
|
+
}
|
|
1055
|
+
for (const block of Array.from(d.querySelectorAll(".md-code-block"))) {
|
|
1056
|
+
delete block.dataset.vxMmd;
|
|
1057
|
+
delete block.dataset.vxMmdFail;
|
|
1058
|
+
}
|
|
841
1059
|
}
|
|
842
1060
|
return {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
changed
|
|
1061
|
+
scan,
|
|
1062
|
+
restore
|
|
846
1063
|
};
|
|
847
1064
|
}
|
|
848
|
-
/** Compact DOM identity for a rendered Mermaid block. A 32-bit FNV-1a hash
|
|
849
|
-
* plus the source length is enough to distinguish live blocks without
|
|
850
|
-
* duplicating every diagram's text into a `data-*` attribute. */
|
|
851
|
-
function mermaidCodeKey(code) {
|
|
852
|
-
let hash = 2166136261;
|
|
853
|
-
for (let i = 0; i < code.length; i++) {
|
|
854
|
-
hash ^= code.charCodeAt(i);
|
|
855
|
-
hash = Math.imul(hash, 16777619);
|
|
856
|
-
}
|
|
857
|
-
return (hash >>> 0).toString(36) + "-" + code.length.toString(36);
|
|
858
|
-
}
|
|
859
1065
|
//#endregion
|
|
860
1066
|
//#region src/client/styles.ts
|
|
861
1067
|
/**
|
|
@@ -1848,6 +2054,75 @@ window.__ModuleLoader__.load({
|
|
|
1848
2054
|
}, []);
|
|
1849
2055
|
return current;
|
|
1850
2056
|
}
|
|
2057
|
+
/** Follow the OS "reduce motion" preference; weather FX is decorative. */
|
|
2058
|
+
function useReducedMotion() {
|
|
2059
|
+
const query = () => {
|
|
2060
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return null;
|
|
2061
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2062
|
+
};
|
|
2063
|
+
const [reduced, setReduced] = react.useState(() => query()?.matches === true);
|
|
2064
|
+
react.useEffect(() => {
|
|
2065
|
+
const mq = query();
|
|
2066
|
+
if (mq === null) return;
|
|
2067
|
+
const onChange = () => setReduced(mq.matches);
|
|
2068
|
+
setReduced(mq.matches);
|
|
2069
|
+
mq.addEventListener?.("change", onChange);
|
|
2070
|
+
return () => {
|
|
2071
|
+
mq.removeEventListener?.("change", onChange);
|
|
2072
|
+
};
|
|
2073
|
+
}, []);
|
|
2074
|
+
return reduced;
|
|
2075
|
+
}
|
|
2076
|
+
const DIALOG_FOCUSABLE = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
2077
|
+
/**
|
|
2078
|
+
* Modal semantics for the six overlays: focus enters the panel, Tab wraps,
|
|
2079
|
+
* Escape closes, and closing restores the element that opened it.
|
|
2080
|
+
*/
|
|
2081
|
+
function useDialogFocus(onClose) {
|
|
2082
|
+
const ref = react.useRef(null);
|
|
2083
|
+
const closeRef = react.useRef(onClose);
|
|
2084
|
+
closeRef.current = onClose;
|
|
2085
|
+
react.useEffect(() => {
|
|
2086
|
+
const node = ref.current;
|
|
2087
|
+
if (node === null) return;
|
|
2088
|
+
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
2089
|
+
const focusables = () => Array.from(node.querySelectorAll(DIALOG_FOCUSABLE)).filter((el) => el.getClientRects().length > 0);
|
|
2090
|
+
if (!node.contains(document.activeElement)) (focusables()[0] ?? node).focus();
|
|
2091
|
+
const onKeyDown = (event) => {
|
|
2092
|
+
if (event.key === "Escape") {
|
|
2093
|
+
event.preventDefault();
|
|
2094
|
+
event.stopPropagation();
|
|
2095
|
+
closeRef.current();
|
|
2096
|
+
return;
|
|
2097
|
+
}
|
|
2098
|
+
if (event.key !== "Tab") return;
|
|
2099
|
+
const items = focusables();
|
|
2100
|
+
if (items.length === 0) {
|
|
2101
|
+
event.preventDefault();
|
|
2102
|
+
node.focus();
|
|
2103
|
+
return;
|
|
2104
|
+
}
|
|
2105
|
+
const first = items[0];
|
|
2106
|
+
const last = items[items.length - 1];
|
|
2107
|
+
const active = document.activeElement;
|
|
2108
|
+
if (event.shiftKey && (active === first || active === node)) {
|
|
2109
|
+
event.preventDefault();
|
|
2110
|
+
last.focus();
|
|
2111
|
+
} else if (!event.shiftKey && active === last) {
|
|
2112
|
+
event.preventDefault();
|
|
2113
|
+
first.focus();
|
|
2114
|
+
}
|
|
2115
|
+
};
|
|
2116
|
+
node.addEventListener("keydown", onKeyDown);
|
|
2117
|
+
return () => {
|
|
2118
|
+
node.removeEventListener("keydown", onKeyDown);
|
|
2119
|
+
if (previous !== null && previous.isConnected) try {
|
|
2120
|
+
previous.focus();
|
|
2121
|
+
} catch {}
|
|
2122
|
+
};
|
|
2123
|
+
}, []);
|
|
2124
|
+
return ref;
|
|
2125
|
+
}
|
|
1851
2126
|
function useSessionsSafe(props) {
|
|
1852
2127
|
try {
|
|
1853
2128
|
return props.useSessions((st) => st);
|
|
@@ -2829,6 +3104,7 @@ window.__ModuleLoader__.load({
|
|
|
2829
3104
|
weather: state.cfg.weather ?? "none",
|
|
2830
3105
|
dark: state.dark === true
|
|
2831
3106
|
}), shallowEqual);
|
|
3107
|
+
const reduced = useReducedMotion();
|
|
2832
3108
|
const ref = react.useRef(null);
|
|
2833
3109
|
/** 粒子配色跟随背景亮度:浅色主题需要更深的粒子颜色才可辨识。
|
|
2834
3110
|
* ref 让 RAF 循环每帧读到最新值,主题/背景切换时无需重建粒子场。 */
|
|
@@ -2843,11 +3119,11 @@ window.__ModuleLoader__.load({
|
|
|
2843
3119
|
if (g === null) return;
|
|
2844
3120
|
const w = cvs.clientWidth || 0;
|
|
2845
3121
|
const h = cvs.clientHeight || 0;
|
|
2846
|
-
initFx(weather, w, h);
|
|
3122
|
+
if (!reduced) initFx(weather, w, h);
|
|
2847
3123
|
let raf = 0;
|
|
2848
3124
|
const t0 = Date.now();
|
|
2849
3125
|
const loop = () => {
|
|
2850
|
-
if (weather === "none") {
|
|
3126
|
+
if (weather === "none" || reduced) {
|
|
2851
3127
|
try {
|
|
2852
3128
|
g.clearRect(0, 0, cvs.width, cvs.height);
|
|
2853
3129
|
} catch {}
|
|
@@ -2862,10 +3138,11 @@ window.__ModuleLoader__.load({
|
|
|
2862
3138
|
cancelAnimationFrame(raf);
|
|
2863
3139
|
} catch {}
|
|
2864
3140
|
};
|
|
2865
|
-
}, [weather]);
|
|
3141
|
+
}, [weather, reduced]);
|
|
2866
3142
|
return react.createElement("canvas", {
|
|
2867
3143
|
ref,
|
|
2868
|
-
className: "vx-fx"
|
|
3144
|
+
className: "vx-fx",
|
|
3145
|
+
"aria-hidden": true
|
|
2869
3146
|
});
|
|
2870
3147
|
}
|
|
2871
3148
|
let turnsRequestSerial = 0;
|
|
@@ -3098,7 +3375,7 @@ window.__ModuleLoader__.load({
|
|
|
3098
3375
|
mermaidState = { status: "ready" };
|
|
3099
3376
|
if (d0 !== null) {
|
|
3100
3377
|
for (const el of Array.from(d0.querySelectorAll("[data-vx-mmd-fail]"))) delete el.dataset.vxMmdFail;
|
|
3101
|
-
if (S.cfg.mermaid === true)
|
|
3378
|
+
if (S.cfg.mermaid === true) mermaidScanner.scan(S.dark);
|
|
3102
3379
|
}
|
|
3103
3380
|
return true;
|
|
3104
3381
|
}
|
|
@@ -3117,44 +3394,10 @@ window.__ModuleLoader__.load({
|
|
|
3117
3394
|
clearTimeout(watchdog);
|
|
3118
3395
|
}
|
|
3119
3396
|
}
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
ok: false,
|
|
3125
|
-
error: "引擎未就绪"
|
|
3126
|
-
};
|
|
3127
|
-
const id = "vx-mmd-" + Date.now() + Math.floor(Math.random() * 9999);
|
|
3128
|
-
try {
|
|
3129
|
-
mermaid.initialize({
|
|
3130
|
-
startOnLoad: false,
|
|
3131
|
-
theme: dark ? "dark" : "default",
|
|
3132
|
-
securityLevel: "strict",
|
|
3133
|
-
suppressErrorRendering: true
|
|
3134
|
-
});
|
|
3135
|
-
const out = await mermaid.render(id, code);
|
|
3136
|
-
const svg = typeof out === "string" ? out : out?.svg ?? "";
|
|
3137
|
-
if (svg === "") return {
|
|
3138
|
-
ok: false,
|
|
3139
|
-
error: "引擎未返回 SVG"
|
|
3140
|
-
};
|
|
3141
|
-
return {
|
|
3142
|
-
ok: true,
|
|
3143
|
-
svg
|
|
3144
|
-
};
|
|
3145
|
-
} catch (error) {
|
|
3146
|
-
return {
|
|
3147
|
-
ok: false,
|
|
3148
|
-
error: String(error?.message ?? error)
|
|
3149
|
-
};
|
|
3150
|
-
} finally {
|
|
3151
|
-
if (d !== null) for (const scratch of [
|
|
3152
|
-
id,
|
|
3153
|
-
"d" + id,
|
|
3154
|
-
"i" + id
|
|
3155
|
-
]) d.getElementById(scratch)?.remove();
|
|
3156
|
-
}
|
|
3157
|
-
}
|
|
3397
|
+
const mermaidScanner = createMermaidScanner({
|
|
3398
|
+
ensureMermaid,
|
|
3399
|
+
renderMermaid
|
|
3400
|
+
});
|
|
3158
3401
|
function extractMermaid(text) {
|
|
3159
3402
|
const out = [];
|
|
3160
3403
|
const re = /```mermaid\s*\n([\s\S]*?)```/gi;
|
|
@@ -3174,137 +3417,6 @@ window.__ModuleLoader__.load({
|
|
|
3174
3417
|
index: 0
|
|
3175
3418
|
} });
|
|
3176
3419
|
}
|
|
3177
|
-
/** Blocks with a render already in flight (WeakSet: dead blocks drop out). */
|
|
3178
|
-
const mmdInflight = /* @__PURE__ */ new WeakSet();
|
|
3179
|
-
/** Previous scan theme; a flip invalidates rendered-SVG memoization. */
|
|
3180
|
-
let mmdLastDark = null;
|
|
3181
|
-
/** The banner's language label: `.md-code-block > bannerWrap > banner >
|
|
3182
|
-
* infostring` is the GUI CodeBlock's stable shape (its CSS classes are
|
|
3183
|
-
* hashed, the structure is not). */
|
|
3184
|
-
function blockInfostring(block) {
|
|
3185
|
-
const info = block.querySelector(":scope > div:first-child > div:first-child > div:first-child");
|
|
3186
|
-
return info !== null ? info.textContent ?? "" : null;
|
|
3187
|
-
}
|
|
3188
|
-
/** Raw fence text: the GUI keeps unknown languages (mermaid among them) on
|
|
3189
|
-
* the plain `<pre><code>` path, so `pre` always carries the source. */
|
|
3190
|
-
function blockCodeText(block) {
|
|
3191
|
-
const pre = block.querySelector("pre");
|
|
3192
|
-
return pre !== null ? pre.textContent ?? "" : null;
|
|
3193
|
-
}
|
|
3194
|
-
/** Insert/refresh the diagram wrapper before one code block. Never moves
|
|
3195
|
-
* GUI-owned nodes — React keeps reconciling its tree; the block is only
|
|
3196
|
-
* visually swapped with the diagram stage via display. */
|
|
3197
|
-
async function renderInPlace(block, code, dark) {
|
|
3198
|
-
const key = mermaidCodeKey(code);
|
|
3199
|
-
const existingWrap = block.previousElementSibling;
|
|
3200
|
-
if (block.dataset.vxMmd === key && existingWrap !== null && existingWrap.classList.contains("vx-mmd-wrap")) return;
|
|
3201
|
-
if (!await ensureMermaid()) {
|
|
3202
|
-
block.dataset.vxMmdFail = key;
|
|
3203
|
-
return;
|
|
3204
|
-
}
|
|
3205
|
-
const r = await renderMermaid(code, dark);
|
|
3206
|
-
if (!r.ok) {
|
|
3207
|
-
block.dataset.vxMmdFail = key;
|
|
3208
|
-
return;
|
|
3209
|
-
}
|
|
3210
|
-
delete block.dataset.vxMmdFail;
|
|
3211
|
-
const d = typeof document !== "undefined" ? document : null;
|
|
3212
|
-
if (d === null) return;
|
|
3213
|
-
let wrap = block.previousElementSibling;
|
|
3214
|
-
if (wrap === null || !wrap.classList.contains("vx-mmd-wrap")) {
|
|
3215
|
-
wrap = d.createElement("div");
|
|
3216
|
-
wrap.className = "vx-mmd-wrap";
|
|
3217
|
-
block.parentElement?.insertBefore(wrap, block);
|
|
3218
|
-
const bar = d.createElement("div");
|
|
3219
|
-
bar.className = "vx-mmd-bar";
|
|
3220
|
-
const diagramBtn = d.createElement("button");
|
|
3221
|
-
diagramBtn.type = "button";
|
|
3222
|
-
diagramBtn.className = "vx-mmd-btn active";
|
|
3223
|
-
diagramBtn.textContent = "图表";
|
|
3224
|
-
const codeBtn = d.createElement("button");
|
|
3225
|
-
codeBtn.type = "button";
|
|
3226
|
-
codeBtn.className = "vx-mmd-btn";
|
|
3227
|
-
codeBtn.textContent = "代码";
|
|
3228
|
-
const live = d.createElement("a");
|
|
3229
|
-
live.className = "vx-mmd-live";
|
|
3230
|
-
live.target = "_blank";
|
|
3231
|
-
live.rel = "noopener noreferrer";
|
|
3232
|
-
live.textContent = "mermaid.live";
|
|
3233
|
-
mermaidLiveUrl(code).then((url) => {
|
|
3234
|
-
live.href = url;
|
|
3235
|
-
}).catch(() => {});
|
|
3236
|
-
bar.append(diagramBtn, codeBtn, live);
|
|
3237
|
-
const stage = d.createElement("div");
|
|
3238
|
-
stage.className = "vx-mmd-stage";
|
|
3239
|
-
wrap.append(bar, stage);
|
|
3240
|
-
const showDiagram = () => {
|
|
3241
|
-
stage.style.display = "";
|
|
3242
|
-
block.style.display = "none";
|
|
3243
|
-
diagramBtn.classList.add("active");
|
|
3244
|
-
codeBtn.classList.remove("active");
|
|
3245
|
-
};
|
|
3246
|
-
const showCode = () => {
|
|
3247
|
-
stage.style.display = "none";
|
|
3248
|
-
block.style.display = "";
|
|
3249
|
-
diagramBtn.classList.remove("active");
|
|
3250
|
-
codeBtn.classList.add("active");
|
|
3251
|
-
};
|
|
3252
|
-
diagramBtn.addEventListener("click", showDiagram);
|
|
3253
|
-
codeBtn.addEventListener("click", showCode);
|
|
3254
|
-
showDiagram();
|
|
3255
|
-
}
|
|
3256
|
-
const stage = wrap.querySelector(".vx-mmd-stage");
|
|
3257
|
-
if (stage === null) return;
|
|
3258
|
-
stage.innerHTML = r.svg;
|
|
3259
|
-
block.dataset.vxMmd = key;
|
|
3260
|
-
}
|
|
3261
|
-
/** Scan every chat code block and render the mermaid ones in place. */
|
|
3262
|
-
async function scanMermaidBlocks(dark) {
|
|
3263
|
-
const d = typeof document !== "undefined" ? document : null;
|
|
3264
|
-
if (d === null) return;
|
|
3265
|
-
for (const leftover of Array.from(d.querySelectorAll("body > div[id^=\"dvx-mmd-\"]"))) leftover.remove();
|
|
3266
|
-
for (const wrap of Array.from(d.querySelectorAll(".vx-mmd-wrap"))) {
|
|
3267
|
-
const next = wrap.nextElementSibling;
|
|
3268
|
-
if (next === null || !next.classList.contains("md-code-block")) wrap.remove();
|
|
3269
|
-
}
|
|
3270
|
-
for (const block of Array.from(d.querySelectorAll(".md-code-block"))) {
|
|
3271
|
-
if (mmdInflight.has(block)) continue;
|
|
3272
|
-
const codeRaw = blockCodeText(block);
|
|
3273
|
-
if (codeRaw === null) continue;
|
|
3274
|
-
const code = normalizeMermaidText(codeRaw).trim();
|
|
3275
|
-
if (code === "") continue;
|
|
3276
|
-
const key = mermaidCodeKey(code);
|
|
3277
|
-
const info = blockInfostring(block);
|
|
3278
|
-
if (info !== null && info.trim().toLowerCase() === "mermaid") {
|
|
3279
|
-
if (code.split("\n").filter((l) => l.trim() !== "").length < 2) continue;
|
|
3280
|
-
} else {
|
|
3281
|
-
if (!isGenericInfostring(info)) continue;
|
|
3282
|
-
if (!isMermaidCode(codeRaw)) continue;
|
|
3283
|
-
}
|
|
3284
|
-
if (block.dataset.vxMmd === key || block.dataset.vxMmdFail === key) continue;
|
|
3285
|
-
mmdInflight.add(block);
|
|
3286
|
-
try {
|
|
3287
|
-
await renderInPlace(block, code, dark);
|
|
3288
|
-
} finally {
|
|
3289
|
-
mmdInflight.delete(block);
|
|
3290
|
-
}
|
|
3291
|
-
}
|
|
3292
|
-
}
|
|
3293
|
-
/** Undo in-place rendering (feature toggled off): remove wrappers, unhide
|
|
3294
|
-
* code blocks. Diagram DOM is plugin-owned, so removal is safe. */
|
|
3295
|
-
function restoreMermaidBlocks() {
|
|
3296
|
-
const d = typeof document !== "undefined" ? document : null;
|
|
3297
|
-
if (d === null) return;
|
|
3298
|
-
for (const wrap of Array.from(d.querySelectorAll(".vx-mmd-wrap"))) {
|
|
3299
|
-
const next = wrap.nextElementSibling;
|
|
3300
|
-
if (next !== null && next.classList.contains("md-code-block")) next.style.display = "";
|
|
3301
|
-
wrap.remove();
|
|
3302
|
-
}
|
|
3303
|
-
for (const block of Array.from(d.querySelectorAll(".md-code-block"))) {
|
|
3304
|
-
delete block.dataset.vxMmd;
|
|
3305
|
-
delete block.dataset.vxMmdFail;
|
|
3306
|
-
}
|
|
3307
|
-
}
|
|
3308
3420
|
let balanceRetryTimer = null;
|
|
3309
3421
|
let balanceRetries = 0;
|
|
3310
3422
|
async function refreshBalance() {
|
|
@@ -3576,6 +3688,7 @@ window.__ModuleLoader__.load({
|
|
|
3576
3688
|
}, react.createElement("div", { className: "vx-pop-head" }, react.createElement("span", null, "提示词库"), react.createElement("button", {
|
|
3577
3689
|
className: "vx-chip",
|
|
3578
3690
|
title: "关闭",
|
|
3691
|
+
"aria-label": "关闭提示词面板",
|
|
3579
3692
|
onClick: () => setS({ promptOpen: null })
|
|
3580
3693
|
}, react.createElement(Icon, {
|
|
3581
3694
|
n: "x",
|
|
@@ -3597,40 +3710,65 @@ window.__ModuleLoader__.load({
|
|
|
3597
3710
|
}
|
|
3598
3711
|
function HeaderBalance(props) {
|
|
3599
3712
|
useViewedSession(props);
|
|
3600
|
-
const
|
|
3601
|
-
|
|
3713
|
+
const { balance: b, usageRow, balanceOpen: open } = useSSelector((state) => ({
|
|
3714
|
+
balance: state.balance,
|
|
3715
|
+
usageRow: state.usage[dayKey()] ?? null,
|
|
3716
|
+
balanceOpen: state.balanceOpen === true
|
|
3717
|
+
}), shallowEqual);
|
|
3602
3718
|
react.useEffect(() => {
|
|
3603
3719
|
if (S.balance === null) refreshBalance();
|
|
3604
|
-
const
|
|
3720
|
+
const tick = () => {
|
|
3721
|
+
if (typeof document !== "undefined" && document.hidden) return;
|
|
3605
3722
|
refreshBalance();
|
|
3606
|
-
}
|
|
3723
|
+
};
|
|
3724
|
+
const timer = setInterval(tick, 6e4);
|
|
3725
|
+
const onVisibility = () => {
|
|
3726
|
+
if (typeof document === "undefined" || document.hidden) return;
|
|
3727
|
+
refreshBalance();
|
|
3728
|
+
};
|
|
3729
|
+
if (typeof document !== "undefined") document.addEventListener("visibilitychange", onVisibility);
|
|
3607
3730
|
return () => {
|
|
3608
3731
|
clearInterval(timer);
|
|
3732
|
+
if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisibility);
|
|
3609
3733
|
};
|
|
3610
3734
|
}, []);
|
|
3611
|
-
const usageToday =
|
|
3612
|
-
const calls = Object.keys(usageToday).reduce((n, k) => n + (usageToday[k].calls ?? 0), 0);
|
|
3613
|
-
const estimate = Object.entries(usageToday).reduce((sum, [model, row]) => sum + estimateUsageCostCny(row, model), 0);
|
|
3735
|
+
const usageToday = usageRow ?? {};
|
|
3736
|
+
const calls = react.useMemo(() => Object.keys(usageToday).reduce((n, k) => n + (usageToday[k].calls ?? 0), 0), [usageToday]);
|
|
3737
|
+
const estimate = react.useMemo(() => Object.entries(usageToday).reduce((sum, [model, row]) => sum + estimateUsageCostCny(row, model), 0), [usageToday]);
|
|
3614
3738
|
const bal = b?.ok === true && b.balance !== null && b.balance !== void 0 ? b.balance : null;
|
|
3615
3739
|
const keyConfigured = b?.ok === false && b.keyConfigured === true;
|
|
3616
3740
|
const balance = bal !== null ? (bal.currency ?? "CNY") === "CNY" ? "¥" + (bal.total ?? "") : `${bal.total ?? ""} ${bal.currency ?? ""}` : keyConfigured ? "额度" : b === null ? "额度…" : `≈¥${estimate.toFixed(2)}`;
|
|
3617
3741
|
const estimateTitle = `按本机 token 用量与官方价目表折算的估算值(${DEEPSEEK_PRICING_CHECKED_ON} 核对),非账号账单;配置 API Key 后显示真实余额`;
|
|
3618
3742
|
const balanceError = keyConfigured && b?.ok === false ? String(b.error ?? "未知错误") : null;
|
|
3619
3743
|
const pillTitle = bal !== null ? void 0 : balanceError !== null ? `余额查询失败:${balanceError}(失败后会自动重试,也可在面板中手动刷新)` : b === null ? void 0 : estimateTitle;
|
|
3620
|
-
const
|
|
3744
|
+
const togglePanel = () => setS({
|
|
3745
|
+
balanceOpen: !open,
|
|
3746
|
+
panelOpen: false,
|
|
3747
|
+
promptOpen: null,
|
|
3748
|
+
foldersOpen: false
|
|
3749
|
+
});
|
|
3621
3750
|
return react.createElement("span", { className: "vx-balance-wrap" }, react.createElement("span", {
|
|
3622
3751
|
className: "vx-balance-text" + (open ? " vx-balance-open" : ""),
|
|
3752
|
+
role: "button",
|
|
3753
|
+
tabIndex: 0,
|
|
3754
|
+
"aria-expanded": open,
|
|
3755
|
+
"aria-haspopup": "dialog",
|
|
3623
3756
|
title: open ? "再次点击收起面板" : "点击打开面板",
|
|
3624
|
-
onClick:
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3757
|
+
onClick: togglePanel,
|
|
3758
|
+
onKeyDown: (e) => {
|
|
3759
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3760
|
+
e.preventDefault();
|
|
3761
|
+
togglePanel();
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3630
3764
|
}, react.createElement(Icon, {
|
|
3631
3765
|
n: "wallet",
|
|
3632
3766
|
size: 13
|
|
3633
|
-
}), react.createElement("span", { title: pillTitle }, balance), calls > 0 ? react.createElement("span", { className: "vx-balance-today" }, `今日 ${calls} 次`) : null), open ? react.createElement("div", {
|
|
3767
|
+
}), react.createElement("span", { title: pillTitle }, balance), calls > 0 ? react.createElement("span", { className: "vx-balance-today" }, `今日 ${calls} 次`) : null), open ? react.createElement("div", {
|
|
3768
|
+
className: "vx-glass vx-balance-hover",
|
|
3769
|
+
role: "dialog",
|
|
3770
|
+
"aria-label": "额度面板"
|
|
3771
|
+
}, react.createElement(BalancePanelContent, null)) : null);
|
|
3634
3772
|
}
|
|
3635
3773
|
function UsageTable() {
|
|
3636
3774
|
const day = useS().usage[dayKey()] ?? {};
|
|
@@ -3807,7 +3945,7 @@ window.__ModuleLoader__.load({
|
|
|
3807
3945
|
}
|
|
3808
3946
|
function QuoteDock(props) {
|
|
3809
3947
|
useViewedSession(props);
|
|
3810
|
-
const
|
|
3948
|
+
const quoteEnabled = useSSelector((state) => state.cfg.quote === true);
|
|
3811
3949
|
const inputRef = react.useRef(props.input);
|
|
3812
3950
|
inputRef.current = props.input;
|
|
3813
3951
|
const actionsRef = react.useRef(props.inputActions);
|
|
@@ -3830,7 +3968,7 @@ window.__ModuleLoader__.load({
|
|
|
3830
3968
|
};
|
|
3831
3969
|
}, []);
|
|
3832
3970
|
react.useEffect(() => {
|
|
3833
|
-
if (
|
|
3971
|
+
if (!quoteEnabled) {
|
|
3834
3972
|
if (S.quoteSel !== null) setS({ quoteSel: null });
|
|
3835
3973
|
return;
|
|
3836
3974
|
}
|
|
@@ -3874,13 +4012,13 @@ window.__ModuleLoader__.load({
|
|
|
3874
4012
|
};
|
|
3875
4013
|
d.addEventListener("selectionchange", onSel);
|
|
3876
4014
|
return () => d.removeEventListener("selectionchange", onSel);
|
|
3877
|
-
}, [
|
|
4015
|
+
}, [quoteEnabled]);
|
|
3878
4016
|
return null;
|
|
3879
4017
|
}
|
|
3880
4018
|
function QuoteButton() {
|
|
3881
|
-
const
|
|
3882
|
-
if (
|
|
3883
|
-
const q =
|
|
4019
|
+
const quoteSel = useSSelector((state) => state.quoteSel);
|
|
4020
|
+
if (quoteSel === null) return null;
|
|
4021
|
+
const q = quoteSel;
|
|
3884
4022
|
const fmt = q.text.split("\n").map((l) => "> " + l).join("\n");
|
|
3885
4023
|
return react.createElement("button", {
|
|
3886
4024
|
className: "vx-quote-btn",
|
|
@@ -4031,7 +4169,11 @@ window.__ModuleLoader__.load({
|
|
|
4031
4169
|
}));
|
|
4032
4170
|
}
|
|
4033
4171
|
function FolderNode(props) {
|
|
4034
|
-
const
|
|
4172
|
+
const { folderAdd, folderWsPick, dropHint } = useSSelector((state) => ({
|
|
4173
|
+
folderAdd: state.folderAdd,
|
|
4174
|
+
folderWsPick: state.folderWsPick,
|
|
4175
|
+
dropHint: state.dropHint
|
|
4176
|
+
}), shallowEqual);
|
|
4035
4177
|
const node = props.node;
|
|
4036
4178
|
const [open, setOpen] = react.useState(true);
|
|
4037
4179
|
const sessions = useSessionsSafe(props);
|
|
@@ -4150,9 +4292,9 @@ window.__ModuleLoader__.load({
|
|
|
4150
4292
|
const rowLeave = () => {
|
|
4151
4293
|
if (S.dropHint !== null && S.dropHint.id === node.id) setS({ dropHint: null });
|
|
4152
4294
|
};
|
|
4153
|
-
const adding =
|
|
4154
|
-
const pickingWs =
|
|
4155
|
-
const hintZone =
|
|
4295
|
+
const adding = folderAdd === node.id;
|
|
4296
|
+
const pickingWs = folderWsPick === node.id;
|
|
4297
|
+
const hintZone = dropHint !== null && dropHint.id === node.id ? dropHint.zone : null;
|
|
4156
4298
|
const children = node.children ?? [];
|
|
4157
4299
|
const sessIds = node.sessionIds ?? [];
|
|
4158
4300
|
const wsIds = node.workspaceIds ?? [];
|
|
@@ -4825,6 +4967,7 @@ window.__ModuleLoader__.load({
|
|
|
4825
4967
|
react.useEffect(() => {
|
|
4826
4968
|
if (s.ask !== null) setVal(s.ask.value ?? "");
|
|
4827
4969
|
}, [s.ask?.title]);
|
|
4970
|
+
const dialogRef = useDialogFocus(() => setS({ ask: null }));
|
|
4828
4971
|
const ask = s.ask;
|
|
4829
4972
|
if (ask === null) return null;
|
|
4830
4973
|
const submit = () => {
|
|
@@ -4838,6 +4981,11 @@ window.__ModuleLoader__.load({
|
|
|
4838
4981
|
}, react.createElement("div", {
|
|
4839
4982
|
className: "vx-glass vx-modal",
|
|
4840
4983
|
style: { width: "min(360px, 92vw)" },
|
|
4984
|
+
role: "dialog",
|
|
4985
|
+
"aria-modal": true,
|
|
4986
|
+
"aria-label": ask.title,
|
|
4987
|
+
tabIndex: -1,
|
|
4988
|
+
ref: dialogRef,
|
|
4841
4989
|
onClick: (e) => e.stopPropagation()
|
|
4842
4990
|
}, react.createElement("div", { className: "vx-pop-head" }, react.createElement("span", null, ask.title)), react.createElement("input", {
|
|
4843
4991
|
className: "vx-input",
|
|
@@ -4856,32 +5004,43 @@ window.__ModuleLoader__.load({
|
|
|
4856
5004
|
}, "取消"))));
|
|
4857
5005
|
}
|
|
4858
5006
|
function ConfirmModal() {
|
|
4859
|
-
const
|
|
4860
|
-
if (s.confirmAsk === null) return null;
|
|
4861
|
-
const c = s.confirmAsk;
|
|
5007
|
+
const c = useS().confirmAsk;
|
|
4862
5008
|
const answer = (ok) => {
|
|
5009
|
+
if (c === null) return;
|
|
4863
5010
|
const cb = c.cb;
|
|
4864
5011
|
setS({ confirmAsk: null });
|
|
4865
5012
|
cb(ok);
|
|
4866
5013
|
};
|
|
5014
|
+
const dialogRef = useDialogFocus(() => answer(false));
|
|
5015
|
+
if (c === null) return null;
|
|
4867
5016
|
return react.createElement("div", {
|
|
4868
5017
|
className: "vx-modal-mask",
|
|
4869
5018
|
onClick: () => answer(false)
|
|
4870
5019
|
}, react.createElement("div", {
|
|
4871
5020
|
className: "vx-glass vx-modal",
|
|
4872
5021
|
style: { width: "min(380px, 92vw)" },
|
|
5022
|
+
role: "dialog",
|
|
5023
|
+
"aria-modal": true,
|
|
5024
|
+
"aria-label": "确认操作",
|
|
5025
|
+
tabIndex: -1,
|
|
5026
|
+
ref: dialogRef,
|
|
4873
5027
|
onClick: (e) => e.stopPropagation()
|
|
4874
5028
|
}, react.createElement("div", { className: "vx-pad" }, c.message), react.createElement("div", { className: "vx-row vx-pad-sm" }, react.createElement("button", {
|
|
4875
5029
|
className: "vx-btn vx-btn-danger",
|
|
4876
5030
|
onClick: () => answer(true)
|
|
4877
5031
|
}, "确定"), react.createElement("button", {
|
|
4878
5032
|
className: "vx-btn",
|
|
5033
|
+
autoFocus: true,
|
|
4879
5034
|
onClick: () => answer(false)
|
|
4880
5035
|
}, "取消"))));
|
|
4881
5036
|
}
|
|
4882
5037
|
function TemplateModal() {
|
|
4883
5038
|
const s = useS();
|
|
4884
5039
|
const prompt = s.templatePrompt;
|
|
5040
|
+
const dialogRef = useDialogFocus(() => setS({
|
|
5041
|
+
templatePrompt: null,
|
|
5042
|
+
templateValues: {}
|
|
5043
|
+
}));
|
|
4885
5044
|
if (prompt === null) return null;
|
|
4886
5045
|
const names = promptVariables(prompt.text);
|
|
4887
5046
|
const submit = () => {
|
|
@@ -4916,6 +5075,11 @@ window.__ModuleLoader__.load({
|
|
|
4916
5075
|
}, react.createElement("div", {
|
|
4917
5076
|
className: "vx-glass vx-modal",
|
|
4918
5077
|
style: { width: "min(440px, 92vw)" },
|
|
5078
|
+
role: "dialog",
|
|
5079
|
+
"aria-modal": true,
|
|
5080
|
+
"aria-label": `填写变量 · ${prompt.name}`,
|
|
5081
|
+
tabIndex: -1,
|
|
5082
|
+
ref: dialogRef,
|
|
4919
5083
|
onClick: (e) => e.stopPropagation()
|
|
4920
5084
|
}, react.createElement("div", { className: "vx-pop-head" }, react.createElement("span", null, `填写变量 · ${prompt.name}`)), names.map((name) => react.createElement("label", {
|
|
4921
5085
|
key: name,
|
|
@@ -4939,12 +5103,13 @@ window.__ModuleLoader__.load({
|
|
|
4939
5103
|
}, "取消"))));
|
|
4940
5104
|
}
|
|
4941
5105
|
function MermaidInPlace() {
|
|
4942
|
-
const
|
|
4943
|
-
|
|
4944
|
-
|
|
5106
|
+
const { enabled, dark } = useSSelector((state) => ({
|
|
5107
|
+
enabled: state.cfg.mermaid === true,
|
|
5108
|
+
dark: state.dark === true
|
|
5109
|
+
}), shallowEqual);
|
|
4945
5110
|
react.useEffect(() => {
|
|
4946
5111
|
if (!enabled) {
|
|
4947
|
-
|
|
5112
|
+
mermaidScanner.restore();
|
|
4948
5113
|
return;
|
|
4949
5114
|
}
|
|
4950
5115
|
const d = typeof document !== "undefined" ? document : null;
|
|
@@ -4953,14 +5118,12 @@ window.__ModuleLoader__.load({
|
|
|
4953
5118
|
let timer = null;
|
|
4954
5119
|
let stopped = false;
|
|
4955
5120
|
const scan = () => {
|
|
4956
|
-
if (!stopped)
|
|
5121
|
+
if (!stopped) mermaidScanner.scan(dark);
|
|
4957
5122
|
};
|
|
4958
5123
|
const schedule = () => {
|
|
4959
5124
|
if (timer !== null) clearTimeout(timer);
|
|
4960
5125
|
timer = setTimeout(scan, 400);
|
|
4961
5126
|
};
|
|
4962
|
-
if (mmdLastDark !== null && mmdLastDark !== dark) for (const block of Array.from(d.querySelectorAll(".md-code-block"))) delete block.dataset.vxMmd;
|
|
4963
|
-
mmdLastDark = dark;
|
|
4964
5127
|
scan();
|
|
4965
5128
|
const observer = new MutationObserver(schedule);
|
|
4966
5129
|
observer.observe(d.body, {
|
|
@@ -4985,6 +5148,7 @@ window.__ModuleLoader__.load({
|
|
|
4985
5148
|
const [err, setErr] = react.useState(null);
|
|
4986
5149
|
const [loading, setLoading] = react.useState(false);
|
|
4987
5150
|
const [liveUrl, setLiveUrl] = react.useState("#");
|
|
5151
|
+
const dialogRef = useDialogFocus(() => setS({ mermaidModal: null }));
|
|
4988
5152
|
react.useEffect(() => {
|
|
4989
5153
|
if (mm === null) return;
|
|
4990
5154
|
let alive = true;
|
|
@@ -5018,10 +5182,16 @@ window.__ModuleLoader__.load({
|
|
|
5018
5182
|
onClick: () => setS({ mermaidModal: null })
|
|
5019
5183
|
}, react.createElement("div", {
|
|
5020
5184
|
className: "vx-glass vx-modal",
|
|
5185
|
+
role: "dialog",
|
|
5186
|
+
"aria-modal": true,
|
|
5187
|
+
"aria-label": "Mermaid 图表",
|
|
5188
|
+
tabIndex: -1,
|
|
5189
|
+
ref: dialogRef,
|
|
5021
5190
|
onClick: (e) => e.stopPropagation()
|
|
5022
5191
|
}, react.createElement("div", { className: "vx-pop-head" }, react.createElement("span", null, `${mm.title} (${mm.index + 1}/${mm.codes.length})`), react.createElement("span", { className: "vx-row" }, mm.codes.length > 1 ? react.createElement("button", {
|
|
5023
5192
|
className: "vx-chip",
|
|
5024
5193
|
title: "上一个",
|
|
5194
|
+
"aria-label": "上一个图表",
|
|
5025
5195
|
onClick: () => setS({ mermaidModal: {
|
|
5026
5196
|
...mm,
|
|
5027
5197
|
index: (mm.index + mm.codes.length - 1) % mm.codes.length
|
|
@@ -5033,6 +5203,7 @@ window.__ModuleLoader__.load({
|
|
|
5033
5203
|
})) : null, mm.codes.length > 1 ? react.createElement("button", {
|
|
5034
5204
|
className: "vx-chip",
|
|
5035
5205
|
title: "下一个",
|
|
5206
|
+
"aria-label": "下一个图表",
|
|
5036
5207
|
onClick: () => setS({ mermaidModal: {
|
|
5037
5208
|
...mm,
|
|
5038
5209
|
index: (mm.index + 1) % mm.codes.length
|
|
@@ -5048,6 +5219,7 @@ window.__ModuleLoader__.load({
|
|
|
5048
5219
|
}, "在 mermaid.live 打开"), react.createElement("button", {
|
|
5049
5220
|
className: "vx-chip",
|
|
5050
5221
|
title: "关闭",
|
|
5222
|
+
"aria-label": "关闭图表",
|
|
5051
5223
|
onClick: () => setS({ mermaidModal: null })
|
|
5052
5224
|
}, react.createElement(Icon, {
|
|
5053
5225
|
n: "x",
|
|
@@ -5067,6 +5239,7 @@ window.__ModuleLoader__.load({
|
|
|
5067
5239
|
const [index, setIndex] = react.useState(0);
|
|
5068
5240
|
const [remote, setRemote] = react.useState([]);
|
|
5069
5241
|
const [remoteStatus, setRemoteStatus] = react.useState("");
|
|
5242
|
+
const dialogRef = useDialogFocus(() => setS({ commandOpen: false }));
|
|
5070
5243
|
react.useEffect(() => {
|
|
5071
5244
|
if (!s.commandOpen || query.trim().length < 2) {
|
|
5072
5245
|
setRemote([]);
|
|
@@ -5233,6 +5406,11 @@ window.__ModuleLoader__.load({
|
|
|
5233
5406
|
}, react.createElement("div", {
|
|
5234
5407
|
className: "vx-glass vx-modal",
|
|
5235
5408
|
style: { width: "min(620px, 94vw)" },
|
|
5409
|
+
role: "dialog",
|
|
5410
|
+
"aria-modal": true,
|
|
5411
|
+
"aria-label": "命令面板",
|
|
5412
|
+
tabIndex: -1,
|
|
5413
|
+
ref: dialogRef,
|
|
5236
5414
|
onClick: (e) => e.stopPropagation()
|
|
5237
5415
|
}, react.createElement("input", {
|
|
5238
5416
|
className: "vx-input",
|
|
@@ -5268,6 +5446,7 @@ window.__ModuleLoader__.load({
|
|
|
5268
5446
|
useS();
|
|
5269
5447
|
const [sel, setSel] = react.useState({});
|
|
5270
5448
|
const [q, setQ] = react.useState("");
|
|
5449
|
+
const dialogRef = useDialogFocus(() => setS({ batchModal: false }));
|
|
5271
5450
|
const sessions = useSessionsSafe(props);
|
|
5272
5451
|
const ids = sessions !== null ? sessions.ids ?? [] : [];
|
|
5273
5452
|
const byId = sessions !== null ? sessions.byId : {};
|
|
@@ -5300,10 +5479,16 @@ window.__ModuleLoader__.load({
|
|
|
5300
5479
|
}, react.createElement("div", {
|
|
5301
5480
|
className: "vx-glass vx-modal",
|
|
5302
5481
|
style: { width: "min(560px, 92vw)" },
|
|
5482
|
+
role: "dialog",
|
|
5483
|
+
"aria-modal": true,
|
|
5484
|
+
"aria-label": "批量归档会话",
|
|
5485
|
+
tabIndex: -1,
|
|
5486
|
+
ref: dialogRef,
|
|
5303
5487
|
onClick: (e) => e.stopPropagation()
|
|
5304
5488
|
}, react.createElement("div", { className: "vx-pop-head" }, react.createElement("span", null, "批量归档会话"), react.createElement("button", {
|
|
5305
5489
|
className: "vx-chip",
|
|
5306
5490
|
title: "关闭",
|
|
5491
|
+
"aria-label": "关闭批量归档",
|
|
5307
5492
|
onClick: () => setS({ batchModal: false })
|
|
5308
5493
|
}, react.createElement(Icon, {
|
|
5309
5494
|
n: "x",
|
|
@@ -5477,6 +5662,7 @@ window.__ModuleLoader__.load({
|
|
|
5477
5662
|
}), react.createElement("span", { className: "vx-panel-title" }, "个性化中心"), react.createElement("span", { className: "vx-panel-sub" }, "外观 · 效率 · 额度"), react.createElement("span", { className: "vx-flex1" }), react.createElement("button", {
|
|
5478
5663
|
className: "vx-chip",
|
|
5479
5664
|
title: "关闭",
|
|
5665
|
+
"aria-label": "关闭个性化面板",
|
|
5480
5666
|
onClick: () => setS({ panelOpen: false })
|
|
5481
5667
|
}, react.createElement(Icon, {
|
|
5482
5668
|
n: "x",
|
|
@@ -5520,6 +5706,7 @@ window.__ModuleLoader__.load({
|
|
|
5520
5706
|
})), react.createElement("button", {
|
|
5521
5707
|
className: "vx-chip",
|
|
5522
5708
|
title: "关闭",
|
|
5709
|
+
"aria-label": "关闭项目文件夹",
|
|
5523
5710
|
onClick: () => setS({ foldersOpen: false })
|
|
5524
5711
|
}, react.createElement(Icon, {
|
|
5525
5712
|
n: "x",
|
|
@@ -5535,8 +5722,8 @@ window.__ModuleLoader__.load({
|
|
|
5535
5722
|
return react.createElement("div", { className: "vx-settings-page" }, react.createElement(AppearanceTab, null), react.createElement("div", { className: "vx-section-title" }, "功能开关"), react.createElement(ToolsTab, null), react.createElement(MermaidTab, null));
|
|
5536
5723
|
}
|
|
5537
5724
|
function Toasts() {
|
|
5538
|
-
const
|
|
5539
|
-
return react.createElement("div", { className: "vx-toasts" },
|
|
5725
|
+
const toasts = useSSelector((state) => state.toasts);
|
|
5726
|
+
return react.createElement("div", { className: "vx-toasts" }, toasts.map((t) => react.createElement("div", {
|
|
5540
5727
|
key: t.id,
|
|
5541
5728
|
className: "vx-toast" + (t.kind === "error" ? " err" : "")
|
|
5542
5729
|
}, react.createElement(Icon, {
|
|
@@ -5552,7 +5739,22 @@ window.__ModuleLoader__.load({
|
|
|
5552
5739
|
}, t.action.label) : null)));
|
|
5553
5740
|
}
|
|
5554
5741
|
function OverlayRoot(props) {
|
|
5555
|
-
const
|
|
5742
|
+
const { cfg, dark, booted, sessionId, panelOpen, foldersOpen, promptOpen, mermaidModal, batchModal, commandOpen, quoteSel, ask, confirmAsk, templatePrompt } = useSSelector((state) => ({
|
|
5743
|
+
cfg: state.cfg,
|
|
5744
|
+
dark: state.dark,
|
|
5745
|
+
booted: state.booted,
|
|
5746
|
+
sessionId: state.sessionId,
|
|
5747
|
+
panelOpen: state.panelOpen,
|
|
5748
|
+
foldersOpen: state.foldersOpen,
|
|
5749
|
+
promptOpen: state.promptOpen,
|
|
5750
|
+
mermaidModal: state.mermaidModal,
|
|
5751
|
+
batchModal: state.batchModal,
|
|
5752
|
+
commandOpen: state.commandOpen,
|
|
5753
|
+
quoteSel: state.quoteSel,
|
|
5754
|
+
ask: state.ask,
|
|
5755
|
+
confirmAsk: state.confirmAsk,
|
|
5756
|
+
templatePrompt: state.templatePrompt
|
|
5757
|
+
}), shallowEqual);
|
|
5556
5758
|
/** 当前 GUI 实际配色。主题服务已解析的快照最权威(覆盖 GUI 内全局深色
|
|
5557
5759
|
* 切换,与 OS 偏好无关);其次 body 上呈现器维护的 data-ds-dark-theme;
|
|
5558
5760
|
* 最后兜底操作系统 prefers-color-scheme。 */
|
|
@@ -5587,27 +5789,27 @@ window.__ModuleLoader__.load({
|
|
|
5587
5789
|
return () => d.removeEventListener("keydown", onKey);
|
|
5588
5790
|
}, []);
|
|
5589
5791
|
react.useEffect(() => {
|
|
5590
|
-
if (
|
|
5792
|
+
if (booted) applyAppearance();
|
|
5591
5793
|
}, [
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5794
|
+
booted,
|
|
5795
|
+
cfg.bg,
|
|
5796
|
+
cfg.glass,
|
|
5797
|
+
cfg.glassMode,
|
|
5798
|
+
cfg.globalGlass,
|
|
5799
|
+
dark
|
|
5598
5800
|
]);
|
|
5599
5801
|
react.useEffect(() => {
|
|
5600
|
-
syncAntiScroll(
|
|
5802
|
+
syncAntiScroll(cfg.antiScroll === true);
|
|
5601
5803
|
return () => {
|
|
5602
5804
|
syncAntiScroll(false);
|
|
5603
5805
|
};
|
|
5604
|
-
}, [
|
|
5806
|
+
}, [cfg.antiScroll]);
|
|
5605
5807
|
react.useEffect(() => {
|
|
5606
5808
|
const w = typeof window !== "undefined" ? window : null;
|
|
5607
5809
|
const d = typeof document !== "undefined" ? document : null;
|
|
5608
|
-
const applyDark = (
|
|
5609
|
-
S.dark =
|
|
5610
|
-
setS({ dark });
|
|
5810
|
+
const applyDark = (nextDark) => {
|
|
5811
|
+
S.dark = nextDark;
|
|
5812
|
+
setS({ dark: nextDark });
|
|
5611
5813
|
};
|
|
5612
5814
|
applyDark(readDark());
|
|
5613
5815
|
let offTheme;
|
|
@@ -5645,15 +5847,15 @@ window.__ModuleLoader__.load({
|
|
|
5645
5847
|
const dark = readDark();
|
|
5646
5848
|
S.dark = dark;
|
|
5647
5849
|
setS({ dark });
|
|
5648
|
-
}, [
|
|
5850
|
+
}, [booted]);
|
|
5649
5851
|
react.useEffect(() => {
|
|
5650
5852
|
const d = typeof document !== "undefined" ? document : null;
|
|
5651
5853
|
if (d === null) return;
|
|
5652
|
-
d.documentElement.classList.toggle("vx-dark",
|
|
5653
|
-
d.documentElement.classList.toggle("vx-light",
|
|
5654
|
-
}, [
|
|
5854
|
+
d.documentElement.classList.toggle("vx-dark", dark === true);
|
|
5855
|
+
d.documentElement.classList.toggle("vx-light", dark !== true);
|
|
5856
|
+
}, [dark]);
|
|
5655
5857
|
const sessions = useSessionsSafe(props);
|
|
5656
|
-
const summary = sessions !== null &&
|
|
5858
|
+
const summary = sessions !== null && sessionId !== null ? sessions.byId[sessionId] : null;
|
|
5657
5859
|
react.useEffect(() => {
|
|
5658
5860
|
const watchedId = S.sessionId;
|
|
5659
5861
|
if (watchedId === null) return;
|
|
@@ -5681,36 +5883,36 @@ window.__ModuleLoader__.load({
|
|
|
5681
5883
|
if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisibility);
|
|
5682
5884
|
if (!disposed && S.sessionId === watchedId) fetchTurns(watchedId);
|
|
5683
5885
|
};
|
|
5684
|
-
}, [
|
|
5886
|
+
}, [sessionId, summary?.running]);
|
|
5685
5887
|
const children = [react.createElement(FxCanvas, { key: "fx" })];
|
|
5686
5888
|
children.push(react.createElement(MermaidInPlace, { key: "mmd" }));
|
|
5687
|
-
if (
|
|
5889
|
+
if (panelOpen === true) children.push(react.createElement(PersonalizePanel, {
|
|
5688
5890
|
key: "panel",
|
|
5689
5891
|
useSessions: props.useSessions,
|
|
5690
5892
|
useWorkspaces: props.useWorkspaces
|
|
5691
5893
|
}));
|
|
5692
|
-
if (
|
|
5894
|
+
if (foldersOpen === true) children.push(react.createElement(SidebarFoldersPanel, {
|
|
5693
5895
|
key: "folders",
|
|
5694
5896
|
useSessions: props.useSessions,
|
|
5695
5897
|
useWorkspaces: props.useWorkspaces
|
|
5696
5898
|
}));
|
|
5697
|
-
if (
|
|
5698
|
-
if (
|
|
5699
|
-
if (
|
|
5899
|
+
if (promptOpen !== null) children.push(react.createElement(PromptPopover, { key: "prompt" }));
|
|
5900
|
+
if (mermaidModal !== null) children.push(react.createElement(MermaidModal, { key: "mermaid" }));
|
|
5901
|
+
if (batchModal === true) children.push(react.createElement(BatchModal, {
|
|
5700
5902
|
key: "batch",
|
|
5701
5903
|
useSessions: props.useSessions
|
|
5702
5904
|
}));
|
|
5703
|
-
if (
|
|
5905
|
+
if (commandOpen === true) children.push(react.createElement(CommandPalette, {
|
|
5704
5906
|
key: "command",
|
|
5705
5907
|
useSessions: props.useSessions,
|
|
5706
5908
|
useWorkspaces: props.useWorkspaces
|
|
5707
5909
|
}));
|
|
5708
|
-
if (
|
|
5709
|
-
if (
|
|
5710
|
-
if (
|
|
5711
|
-
if (
|
|
5910
|
+
if (quoteSel !== null && cfg.quote === true) children.push(react.createElement(QuoteButton, { key: "quote" }));
|
|
5911
|
+
if (ask !== null) children.push(react.createElement(AskModal, { key: "ask" }));
|
|
5912
|
+
if (confirmAsk !== null) children.push(react.createElement(ConfirmModal, { key: "confirm" }));
|
|
5913
|
+
if (templatePrompt !== null) children.push(react.createElement(TemplateModal, { key: "template" }));
|
|
5712
5914
|
children.push(react.createElement(Toasts, { key: "toasts" }));
|
|
5713
|
-
return react.createElement("div", { className: `vx-root ${
|
|
5915
|
+
return react.createElement("div", { className: `vx-root ${dark ? "vx-dark" : "vx-light"}` }, children);
|
|
5714
5916
|
}
|
|
5715
5917
|
setDynCss("");
|
|
5716
5918
|
try {
|
|
@@ -5818,7 +6020,7 @@ window.__ModuleLoader__.load({
|
|
|
5818
6020
|
syncAntiScroll(false);
|
|
5819
6021
|
} catch {}
|
|
5820
6022
|
try {
|
|
5821
|
-
|
|
6023
|
+
mermaidScanner.restore();
|
|
5822
6024
|
} catch {}
|
|
5823
6025
|
const d = typeof document !== "undefined" ? document : null;
|
|
5824
6026
|
if (d !== null) {
|