markstream-vue2 0.0.26 → 0.0.28
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/README.md +8 -0
- package/dist/chunks/{cssMode-2e2be6eb.cjs → cssMode-86e8d6e4.cjs} +1 -1
- package/dist/chunks/{htmlMode-b62439a8.cjs → htmlMode-f84c7583.cjs} +1 -1
- package/dist/chunks/index.legacy-70f0e155.cjs +1 -0
- package/dist/chunks/{jsonMode-bb4aa400.cjs → jsonMode-e60229b9.cjs} +1 -1
- package/dist/chunks/{tsMode-1535ecd2.cjs → tsMode-5b9a0ba1.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +65 -2328
- package/dist/index.js +515 -75
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/AdmonitionNode/AdmonitionNode.vue.d.ts +33 -0
- package/dist/types/components/AdmonitionNode/index.d.ts +2 -0
- package/dist/types/components/BlockquoteNode/BlockquoteNode.vue.d.ts +28 -0
- package/dist/types/components/BlockquoteNode/index.d.ts +2 -0
- package/dist/types/components/CheckboxNode/CheckboxNode.vue.d.ts +18 -0
- package/dist/types/components/CheckboxNode/index.d.ts +2 -0
- package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +210 -0
- package/dist/types/components/CodeBlockNode/HtmlPreviewFrame.vue.d.ts +17 -0
- package/dist/types/components/CodeBlockNode/index.d.ts +2 -0
- package/dist/types/components/CodeBlockNode/monaco.d.ts +1 -0
- package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +3 -0
- package/dist/types/components/D2BlockNode/D2BlockNode.vue.d.ts +66 -0
- package/dist/types/components/D2BlockNode/d2.d.ts +6 -0
- package/dist/types/components/D2BlockNode/index.d.ts +2 -0
- package/dist/types/components/DefinitionListNode/DefinitionListNode.vue.d.ts +36 -0
- package/dist/types/components/DefinitionListNode/index.d.ts +2 -0
- package/dist/types/components/EmojiNode/EmojiNode.vue.d.ts +19 -0
- package/dist/types/components/EmojiNode/index.d.ts +2 -0
- package/dist/types/components/EmphasisNode/EmphasisNode.vue.d.ts +25 -0
- package/dist/types/components/EmphasisNode/index.d.ts +2 -0
- package/dist/types/components/FootnoteAnchorNode/FootnoteAnchorNode.vue.d.ts +18 -0
- package/dist/types/components/FootnoteAnchorNode/index.d.ts +2 -0
- package/dist/types/components/FootnoteNode/FootnoteNode.vue.d.ts +28 -0
- package/dist/types/components/FootnoteNode/index.d.ts +2 -0
- package/dist/types/components/FootnoteReferenceNode/FootnoteReferenceNode.vue.d.ts +19 -0
- package/dist/types/components/FootnoteReferenceNode/index.d.ts +2 -0
- package/dist/types/components/HardBreakNode/HardBreakNode.vue.d.ts +18 -0
- package/dist/types/components/HardBreakNode/index.d.ts +2 -0
- package/dist/types/components/HeadingNode/HeadingNode.vue.d.ts +28 -0
- package/dist/types/components/HeadingNode/index.d.ts +2 -0
- package/dist/types/components/HighlightNode/HighlightNode.vue.d.ts +25 -0
- package/dist/types/components/HighlightNode/index.d.ts +2 -0
- package/dist/types/components/HtmlBlockNode/HtmlBlockNode.vue.d.ts +42 -0
- package/dist/types/components/HtmlBlockNode/index.d.ts +2 -0
- package/dist/types/components/HtmlInlineNode/HtmlInlineNode.vue.d.ts +21 -0
- package/dist/types/components/HtmlInlineNode/index.d.ts +2 -0
- package/dist/types/components/ImageNode/ImageNode.vue.d.ts +104 -0
- package/dist/types/components/ImageNode/index.d.ts +2 -0
- package/dist/types/components/InfographicBlockNode/InfographicBlockNode.vue.d.ts +86 -0
- package/dist/types/components/InfographicBlockNode/index.d.ts +2 -0
- package/dist/types/components/InfographicBlockNode/infographic.d.ts +1 -0
- package/dist/types/components/InlineCodeNode/InlineCodeNode.vue.d.ts +18 -0
- package/dist/types/components/InlineCodeNode/index.d.ts +2 -0
- package/dist/types/components/InsertNode/InsertNode.vue.d.ts +25 -0
- package/dist/types/components/InsertNode/index.d.ts +2 -0
- package/dist/types/components/LinkNode/LinkNode.vue.d.ts +49 -0
- package/dist/types/components/LinkNode/index.d.ts +2 -0
- package/dist/types/components/ListItemNode/ListItemNode.vue.d.ts +30 -0
- package/dist/types/components/ListItemNode/index.d.ts +2 -0
- package/dist/types/components/ListNode/ListNode.vue.d.ts +36 -0
- package/dist/types/components/ListNode/index.d.ts +2 -0
- package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.vue.d.ts +193 -0
- package/dist/types/components/MarkdownCodeBlockNode/index.d.ts +2 -0
- package/dist/types/components/MarkdownRenderCompat.vue.d.ts +94 -0
- package/dist/types/components/MathBlockNode/MathBlockNode.vue.d.ts +20 -0
- package/dist/types/components/MathBlockNode/index.d.ts +2 -0
- package/dist/types/components/MathInlineNode/MathInlineNode.vue.d.ts +40 -0
- package/dist/types/components/MathInlineNode/index.d.ts +2 -0
- package/dist/types/components/MathInlineNode/katex.d.ts +6 -0
- package/dist/types/components/MermaidBlockNode/MermaidBlockNode.vue.d.ts +134 -0
- package/dist/types/components/MermaidBlockNode/index.d.ts +2 -0
- package/dist/types/components/MermaidBlockNode/mermaid.d.ts +6 -0
- package/dist/types/components/NestedRenderer/NestedRenderer.vue.d.ts +30 -0
- package/dist/types/components/NestedRenderer/index.d.ts +2 -0
- package/dist/types/components/NodeRenderer/FallbackComponent.vue.d.ts +16 -0
- package/dist/types/components/NodeRenderer/LegacyNodesRenderer.vue.d.ts +53 -0
- package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +139 -0
- package/dist/types/components/NodeRenderer/asyncComponent.d.ts +2 -0
- package/dist/types/components/NodeRenderer/index.d.ts +2 -0
- package/dist/types/components/NodeRenderer/preloadMonaco.d.ts +1 -0
- package/dist/types/components/ParagraphNode/ParagraphNode.vue.d.ts +25 -0
- package/dist/types/components/ParagraphNode/index.d.ts +2 -0
- package/dist/types/components/Portal/Portal.vue.d.ts +31 -0
- package/dist/types/components/Portal/index.d.ts +2 -0
- package/dist/types/components/PreCodeNode/PreCodeNode.vue.d.ts +14 -0
- package/dist/types/components/PreCodeNode/index.d.ts +2 -0
- package/dist/types/components/ReferenceNode/ReferenceNode.vue.d.ts +24 -0
- package/dist/types/components/ReferenceNode/index.d.ts +2 -0
- package/dist/types/components/StrikethroughNode/StrikethroughNode.vue.d.ts +25 -0
- package/dist/types/components/StrikethroughNode/index.d.ts +2 -0
- package/dist/types/components/StrongNode/StrongNode.vue.d.ts +25 -0
- package/dist/types/components/StrongNode/index.d.ts +2 -0
- package/dist/types/components/SubscriptNode/SubscriptNode.vue.d.ts +25 -0
- package/dist/types/components/SubscriptNode/index.d.ts +2 -0
- package/dist/types/components/SuperscriptNode/SuperscriptNode.vue.d.ts +25 -0
- package/dist/types/components/SuperscriptNode/index.d.ts +2 -0
- package/dist/types/components/TableNode/TableNode.vue.d.ts +59 -0
- package/dist/types/components/TableNode/index.d.ts +2 -0
- package/dist/types/components/TextNode/TextNode.vue.d.ts +21 -0
- package/dist/types/components/TextNode/index.d.ts +2 -0
- package/dist/types/components/TextNode/streamingTextState.d.ts +11 -0
- package/dist/types/components/ThematicBreakNode/ThematicBreakNode.vue.d.ts +2 -0
- package/dist/types/components/ThematicBreakNode/index.d.ts +2 -0
- package/dist/types/components/Tooltip/Tooltip.vue.d.ts +22 -0
- package/dist/types/components/Tooltip/index.d.ts +2 -0
- package/dist/types/components/VmrContainerNode/VmrContainerNode.vue.d.ts +28 -0
- package/dist/types/components/VmrContainerNode/index.d.ts +2 -0
- package/dist/types/composables/useKatexReady.d.ts +1 -0
- package/dist/types/composables/useSafeI18n.d.ts +10 -0
- package/dist/types/composables/useSingletonTooltip.d.ts +14 -0
- package/dist/types/composables/viewportPriority.d.ts +20 -0
- package/dist/types/exports.d.ts +70 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/tailwind-entry.d.ts +2 -0
- package/dist/types/types/component-props.d.ts +210 -0
- package/dist/types/types/index.d.ts +271 -0
- package/dist/types/utils/htmlRenderer.d.ts +43 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/katex-threshold.d.ts +20 -0
- package/dist/types/utils/languageIcon.d.ts +8 -0
- package/dist/types/utils/languageIconExtended.d.ts +1 -0
- package/dist/types/utils/mathRenderCache.d.ts +7 -0
- package/dist/types/utils/nestedHtml.d.ts +19 -0
- package/dist/types/utils/nestedNodes.d.ts +14 -0
- package/dist/types/utils/nodeComponents.d.ts +20 -0
- package/dist/types/utils/performance-monitor.d.ts +121 -0
- package/dist/types/utils/safeRaf.d.ts +2 -0
- package/dist/types/utils/vue26.d.ts +8 -0
- package/dist/types/workers/katexCdnWorker.d.ts +52 -0
- package/dist/types/workers/katexRenderer.worker.d.ts +0 -0
- package/dist/types/workers/katexWorkerClient.d.ts +48 -0
- package/dist/types/workers/mermaidCdnWorker.d.ts +35 -0
- package/dist/types/workers/mermaidParser.worker.d.ts +1 -0
- package/dist/types/workers/mermaidWorkerClient.d.ts +21 -0
- package/package.json +2 -2
- package/dist/chunks/index.legacy-bcde4164.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -55,7 +55,7 @@ import { getMarkdown, parseMarkdownToStructure, setDefaultMathOptions } from "st
|
|
|
55
55
|
export * from "stream-markdown-parser";
|
|
56
56
|
import { KATEX_COMMANDS, normalizeStandaloneBackslashT, setDefaultMathOptions as setDefaultMathOptions2 } from "stream-markdown-parser";
|
|
57
57
|
import * as VueModule from "vue-demi";
|
|
58
|
-
import { defineComponent, getCurrentInstance, computed, shallowRef, h, ref, onMounted, watch, onBeforeUnmount,
|
|
58
|
+
import { defineComponent, getCurrentInstance, computed, shallowRef, h, ref, onMounted, watch, onBeforeUnmount, inject, provide, readonly, useAttrs, nextTick, onUpdated, markRaw, reactive, onUnmounted } from "vue-demi";
|
|
59
59
|
import { autoUpdate, offset, flip, shift, computePosition } from "@floating-ui/dom";
|
|
60
60
|
function getVue2MinorVersion$1(version) {
|
|
61
61
|
const raw = typeof version === "string" ? version : "";
|
|
@@ -962,19 +962,128 @@ var __component__$F = /* @__PURE__ */ normalizeComponent(
|
|
|
962
962
|
null
|
|
963
963
|
);
|
|
964
964
|
const HtmlInlineNode = __component__$F.exports;
|
|
965
|
+
function resolveStreamingTextState({
|
|
966
|
+
nextContent,
|
|
967
|
+
previousContent,
|
|
968
|
+
typewriterEnabled
|
|
969
|
+
}) {
|
|
970
|
+
if (!typewriterEnabled) {
|
|
971
|
+
return {
|
|
972
|
+
settledContent: nextContent,
|
|
973
|
+
streamedDelta: "",
|
|
974
|
+
appended: false
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
if (nextContent === previousContent) {
|
|
978
|
+
return {
|
|
979
|
+
settledContent: nextContent,
|
|
980
|
+
streamedDelta: "",
|
|
981
|
+
appended: false
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
if (previousContent && nextContent.startsWith(previousContent) && nextContent.length > previousContent.length) {
|
|
985
|
+
return {
|
|
986
|
+
settledContent: previousContent,
|
|
987
|
+
streamedDelta: nextContent.slice(previousContent.length),
|
|
988
|
+
appended: true
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
return {
|
|
992
|
+
settledContent: nextContent,
|
|
993
|
+
streamedDelta: "",
|
|
994
|
+
appended: false
|
|
995
|
+
};
|
|
996
|
+
}
|
|
965
997
|
const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
966
998
|
__name: "InlineCodeNode",
|
|
967
999
|
props: {
|
|
968
1000
|
node: null
|
|
969
1001
|
},
|
|
970
1002
|
setup(__props) {
|
|
971
|
-
|
|
1003
|
+
const props = __props;
|
|
1004
|
+
const instance = getCurrentInstance();
|
|
1005
|
+
const attrs = computed(() => {
|
|
1006
|
+
var _a2, _b;
|
|
1007
|
+
return (_b = (_a2 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a2.$attrs) != null ? _b : {};
|
|
1008
|
+
});
|
|
1009
|
+
const inheritedTypewriter = inject("markstreamTypewriter", void 0);
|
|
1010
|
+
const inheritedTextStreamState = inject("markstreamTextStreamState", void 0);
|
|
1011
|
+
const explicitTypewriter = computed(() => {
|
|
1012
|
+
const raw = attrs.value.typewriter;
|
|
1013
|
+
if (raw === "" || raw === true || raw === "true")
|
|
1014
|
+
return true;
|
|
1015
|
+
if (raw === false || raw === "false")
|
|
1016
|
+
return false;
|
|
1017
|
+
return void 0;
|
|
1018
|
+
});
|
|
1019
|
+
const typewriterEnabled = computed(() => {
|
|
1020
|
+
if (typeof explicitTypewriter.value === "boolean")
|
|
1021
|
+
return explicitTypewriter.value;
|
|
1022
|
+
if (typeof (inheritedTypewriter == null ? void 0 : inheritedTypewriter.value) === "boolean")
|
|
1023
|
+
return inheritedTypewriter.value;
|
|
1024
|
+
return true;
|
|
1025
|
+
});
|
|
1026
|
+
const streamStateKey = computed(() => {
|
|
1027
|
+
var _a2;
|
|
1028
|
+
const raw = (_a2 = attrs.value["index-key"]) != null ? _a2 : attrs.value.indexKey;
|
|
1029
|
+
if (raw == null || raw === "")
|
|
1030
|
+
return "";
|
|
1031
|
+
return String(raw);
|
|
1032
|
+
});
|
|
1033
|
+
const settledCode = ref(props.node.code);
|
|
1034
|
+
const streamedDelta = ref("");
|
|
1035
|
+
const streamFadeVersion = ref(0);
|
|
1036
|
+
function getRenderedContent() {
|
|
1037
|
+
return settledCode.value + streamedDelta.value;
|
|
1038
|
+
}
|
|
1039
|
+
function setFullContent(next) {
|
|
1040
|
+
settledCode.value = next;
|
|
1041
|
+
streamedDelta.value = "";
|
|
1042
|
+
}
|
|
1043
|
+
function settleStreamedDelta() {
|
|
1044
|
+
if (!streamedDelta.value)
|
|
1045
|
+
return;
|
|
1046
|
+
settledCode.value = getRenderedContent();
|
|
1047
|
+
streamedDelta.value = "";
|
|
1048
|
+
}
|
|
1049
|
+
watch(
|
|
1050
|
+
[() => props.node.code, streamStateKey, typewriterEnabled],
|
|
1051
|
+
([next]) => {
|
|
1052
|
+
const normalized = String(next != null ? next : "");
|
|
1053
|
+
const rendered = getRenderedContent();
|
|
1054
|
+
const key = streamStateKey.value;
|
|
1055
|
+
const previousPersisted = key ? inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.get(key) : void 0;
|
|
1056
|
+
const previousContent = previousPersisted != null ? previousPersisted : rendered;
|
|
1057
|
+
const nextState = resolveStreamingTextState({
|
|
1058
|
+
nextContent: normalized,
|
|
1059
|
+
previousContent,
|
|
1060
|
+
typewriterEnabled: typewriterEnabled.value
|
|
1061
|
+
});
|
|
1062
|
+
settledCode.value = nextState.settledContent;
|
|
1063
|
+
streamedDelta.value = nextState.streamedDelta;
|
|
1064
|
+
if (nextState.appended)
|
|
1065
|
+
streamFadeVersion.value += 1;
|
|
1066
|
+
if (key)
|
|
1067
|
+
inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
|
|
1068
|
+
},
|
|
1069
|
+
{ immediate: true }
|
|
1070
|
+
);
|
|
1071
|
+
watch(
|
|
1072
|
+
typewriterEnabled,
|
|
1073
|
+
(enabled) => {
|
|
1074
|
+
if (enabled)
|
|
1075
|
+
return;
|
|
1076
|
+
setFullContent(getRenderedContent());
|
|
1077
|
+
}
|
|
1078
|
+
);
|
|
1079
|
+
const streamedDeltaClass = computed(() => streamFadeVersion.value % 2 === 0 ? "inline-code-stream-delta--a" : "inline-code-stream-delta--b");
|
|
1080
|
+
return { __sfc: true, props, instance, attrs, inheritedTypewriter, inheritedTextStreamState, explicitTypewriter, typewriterEnabled, streamStateKey, settledCode, streamedDelta, streamFadeVersion, getRenderedContent, setFullContent, settleStreamedDelta, streamedDeltaClass };
|
|
972
1081
|
}
|
|
973
1082
|
});
|
|
1083
|
+
const InlineCodeNode_vue_vue_type_style_index_0_scoped_38cc3b9f_lang = "";
|
|
974
1084
|
var _sfc_render$E = function render6() {
|
|
975
|
-
var _vm = this, _c = _vm._self._c;
|
|
976
|
-
_vm.
|
|
977
|
-
return _c("code", { staticClass: "inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full before:content-[''] after:content-['']" }, [_vm._v(_vm._s(_vm.node.code))]);
|
|
1085
|
+
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
1086
|
+
return _c("code", { staticClass: "inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full before:content-[''] after:content-['']" }, [_setup.settledCode ? _c("span", [_vm._v(_vm._s(_setup.settledCode))]) : _vm._e(), _setup.streamedDelta ? _c("span", { staticClass: "inline-code-stream-delta", class: [_setup.streamedDeltaClass], on: { "animationend": _setup.settleStreamedDelta } }, [_vm._v(" " + _vm._s(_setup.streamedDelta) + " ")]) : _vm._e()]);
|
|
978
1087
|
};
|
|
979
1088
|
var _sfc_staticRenderFns$E = [];
|
|
980
1089
|
var __component__$E = /* @__PURE__ */ normalizeComponent(
|
|
@@ -983,7 +1092,7 @@ var __component__$E = /* @__PURE__ */ normalizeComponent(
|
|
|
983
1092
|
_sfc_staticRenderFns$E,
|
|
984
1093
|
false,
|
|
985
1094
|
null,
|
|
986
|
-
|
|
1095
|
+
"38cc3b9f",
|
|
987
1096
|
null,
|
|
988
1097
|
null
|
|
989
1098
|
);
|
|
@@ -1522,14 +1631,107 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
1522
1631
|
},
|
|
1523
1632
|
emits: ["copy"],
|
|
1524
1633
|
setup(__props) {
|
|
1634
|
+
const props = __props;
|
|
1525
1635
|
const katexReady = useKatexReady();
|
|
1526
|
-
|
|
1636
|
+
const instance = getCurrentInstance();
|
|
1637
|
+
const attrs = computed(() => {
|
|
1638
|
+
var _a2, _b;
|
|
1639
|
+
return (_b = (_a2 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a2.$attrs) != null ? _b : {};
|
|
1640
|
+
});
|
|
1641
|
+
const inheritedTypewriter = inject("markstreamTypewriter", void 0);
|
|
1642
|
+
const inheritedTextStreamState = inject("markstreamTextStreamState", void 0);
|
|
1643
|
+
const inheritedStreamVersion = inject("markstreamStreamVersion", void 0);
|
|
1644
|
+
const explicitTypewriter = computed(() => {
|
|
1645
|
+
const raw = attrs.value.typewriter;
|
|
1646
|
+
if (raw === "" || raw === true || raw === "true")
|
|
1647
|
+
return true;
|
|
1648
|
+
if (raw === false || raw === "false")
|
|
1649
|
+
return false;
|
|
1650
|
+
return void 0;
|
|
1651
|
+
});
|
|
1652
|
+
const typewriterEnabled = computed(() => {
|
|
1653
|
+
if (typeof explicitTypewriter.value === "boolean")
|
|
1654
|
+
return explicitTypewriter.value;
|
|
1655
|
+
if (typeof (inheritedTypewriter == null ? void 0 : inheritedTypewriter.value) === "boolean")
|
|
1656
|
+
return inheritedTypewriter.value;
|
|
1657
|
+
return true;
|
|
1658
|
+
});
|
|
1659
|
+
const streamStateKey = computed(() => {
|
|
1660
|
+
var _a2;
|
|
1661
|
+
const raw = (_a2 = attrs.value["index-key"]) != null ? _a2 : attrs.value.indexKey;
|
|
1662
|
+
if (raw == null || raw === "")
|
|
1663
|
+
return "";
|
|
1664
|
+
return String(raw);
|
|
1665
|
+
});
|
|
1666
|
+
const settledContent = ref(props.node.content);
|
|
1667
|
+
const streamedDelta = ref("");
|
|
1668
|
+
const streamFadeVersion = ref(0);
|
|
1669
|
+
function getRenderedContent() {
|
|
1670
|
+
return settledContent.value + streamedDelta.value;
|
|
1671
|
+
}
|
|
1672
|
+
function setFullContent(next) {
|
|
1673
|
+
settledContent.value = next;
|
|
1674
|
+
streamedDelta.value = "";
|
|
1675
|
+
}
|
|
1676
|
+
function settleStreamedDelta() {
|
|
1677
|
+
if (!streamedDelta.value)
|
|
1678
|
+
return;
|
|
1679
|
+
settledContent.value = getRenderedContent();
|
|
1680
|
+
streamedDelta.value = "";
|
|
1681
|
+
}
|
|
1682
|
+
watch(
|
|
1683
|
+
[() => props.node.content, streamStateKey, typewriterEnabled, () => inheritedStreamVersion == null ? void 0 : inheritedStreamVersion.value],
|
|
1684
|
+
([next]) => {
|
|
1685
|
+
const normalized = String(next != null ? next : "");
|
|
1686
|
+
const rendered = getRenderedContent();
|
|
1687
|
+
const key = streamStateKey.value;
|
|
1688
|
+
const previousPersisted = key ? inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.get(key) : void 0;
|
|
1689
|
+
const previousContent = previousPersisted != null ? previousPersisted : rendered;
|
|
1690
|
+
if (!typewriterEnabled.value) {
|
|
1691
|
+
setFullContent(normalized);
|
|
1692
|
+
if (key)
|
|
1693
|
+
inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
if (normalized === previousContent) {
|
|
1697
|
+
if (streamedDelta.value)
|
|
1698
|
+
settleStreamedDelta();
|
|
1699
|
+
else if (rendered !== normalized)
|
|
1700
|
+
setFullContent(normalized);
|
|
1701
|
+
if (key)
|
|
1702
|
+
inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
const nextState = resolveStreamingTextState({
|
|
1706
|
+
nextContent: normalized,
|
|
1707
|
+
previousContent,
|
|
1708
|
+
typewriterEnabled: typewriterEnabled.value
|
|
1709
|
+
});
|
|
1710
|
+
settledContent.value = nextState.settledContent;
|
|
1711
|
+
streamedDelta.value = nextState.streamedDelta;
|
|
1712
|
+
if (nextState.appended)
|
|
1713
|
+
streamFadeVersion.value += 1;
|
|
1714
|
+
if (key)
|
|
1715
|
+
inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
|
|
1716
|
+
},
|
|
1717
|
+
{ immediate: true }
|
|
1718
|
+
);
|
|
1719
|
+
watch(
|
|
1720
|
+
typewriterEnabled,
|
|
1721
|
+
(enabled) => {
|
|
1722
|
+
if (enabled)
|
|
1723
|
+
return;
|
|
1724
|
+
setFullContent(getRenderedContent());
|
|
1725
|
+
}
|
|
1726
|
+
);
|
|
1727
|
+
const streamedDeltaClass = computed(() => streamFadeVersion.value % 2 === 0 ? "text-node-stream-delta--a" : "text-node-stream-delta--b");
|
|
1728
|
+
return { __sfc: true, props, katexReady, instance, attrs, inheritedTypewriter, inheritedTextStreamState, inheritedStreamVersion, explicitTypewriter, typewriterEnabled, streamStateKey, settledContent, streamedDelta, streamFadeVersion, getRenderedContent, setFullContent, settleStreamedDelta, streamedDeltaClass };
|
|
1527
1729
|
}
|
|
1528
1730
|
});
|
|
1529
|
-
const
|
|
1731
|
+
const TextNode_vue_vue_type_style_index_0_scoped_356c331b_lang = "";
|
|
1530
1732
|
var _sfc_render$C = function render8() {
|
|
1531
1733
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
1532
|
-
return _c("span", { staticClass: "whitespace-pre-wrap break-words text-node", class: [_setup.katexReady && _vm.node.center ? "text-node-center" : ""] }, [_vm._v(" " + _vm._s(
|
|
1734
|
+
return _c("span", { staticClass: "whitespace-pre-wrap break-words text-node", class: [_setup.katexReady && _vm.node.center ? "text-node-center" : ""] }, [_setup.settledContent ? _c("span", [_vm._v(_vm._s(_setup.settledContent))]) : _vm._e(), _setup.streamedDelta ? _c("span", { staticClass: "text-node-stream-delta", class: [_setup.streamedDeltaClass], on: { "animationend": _setup.settleStreamedDelta } }, [_vm._v(" " + _vm._s(_setup.streamedDelta) + " ")]) : _vm._e()]);
|
|
1533
1735
|
};
|
|
1534
1736
|
var _sfc_staticRenderFns$C = [];
|
|
1535
1737
|
var __component__$C = /* @__PURE__ */ normalizeComponent(
|
|
@@ -1538,7 +1740,7 @@ var __component__$C = /* @__PURE__ */ normalizeComponent(
|
|
|
1538
1740
|
_sfc_staticRenderFns$C,
|
|
1539
1741
|
false,
|
|
1540
1742
|
null,
|
|
1541
|
-
"
|
|
1743
|
+
"356c331b",
|
|
1542
1744
|
null,
|
|
1543
1745
|
null
|
|
1544
1746
|
);
|
|
@@ -1875,13 +2077,16 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
1875
2077
|
const cssVars = computed(() => {
|
|
1876
2078
|
var _a2, _b, _c, _d, _e, _f;
|
|
1877
2079
|
const bottom = props.underlineBottom !== void 0 ? typeof props.underlineBottom === "number" ? `${props.underlineBottom}px` : String(props.underlineBottom) : "-3px";
|
|
2080
|
+
const activeOpacity = (_a2 = props.animationOpacity) != null ? _a2 : 0.35;
|
|
2081
|
+
const restingOpacity = Math.max(0.12, Math.min(activeOpacity * 0.5, activeOpacity));
|
|
1878
2082
|
return {
|
|
1879
|
-
"--link-color": (
|
|
1880
|
-
"--underline-height": `${(
|
|
2083
|
+
"--link-color": (_b = props.color) != null ? _b : "#0366d6",
|
|
2084
|
+
"--underline-height": `${(_c = props.underlineHeight) != null ? _c : 2}px`,
|
|
1881
2085
|
"--underline-bottom": bottom,
|
|
1882
|
-
"--underline-opacity": String(
|
|
1883
|
-
"--underline-
|
|
1884
|
-
"--underline-
|
|
2086
|
+
"--underline-opacity": String(activeOpacity),
|
|
2087
|
+
"--underline-rest-opacity": String(restingOpacity),
|
|
2088
|
+
"--underline-duration": `${(_d = props.animationDuration) != null ? _d : 1.6}s`,
|
|
2089
|
+
"--underline-timing": (_e = props.animationTiming) != null ? _e : "ease-in-out",
|
|
1885
2090
|
"--underline-iteration": typeof props.animationIteration === "number" ? String(props.animationIteration) : (_f = props.animationIteration) != null ? _f : "infinite"
|
|
1886
2091
|
};
|
|
1887
2092
|
});
|
|
@@ -1965,15 +2170,16 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
1965
2170
|
isHovering.value = false;
|
|
1966
2171
|
hideTooltip(true);
|
|
1967
2172
|
});
|
|
1968
|
-
return { __sfc: true, props, lastPointerPosition, pointerTrackerRefCount, pointerTrackerCleanup, ensurePointerTracker, retainPointerTracker, releasePointerTracker, cssVars, nodeComponents, attrs, anchorEl: anchorEl2, isHovering, anchorAttrs, getTooltipText, isPointerInsideAnchor, syncTooltipForHoveredAnchor, onAnchorEnter, onAnchorLeave, title };
|
|
2173
|
+
return { __sfc: true, props, lastPointerPosition, pointerTrackerRefCount, pointerTrackerCleanup, ensurePointerTracker, retainPointerTracker, releasePointerTracker, cssVars, nodeComponents, attrs, anchorEl: anchorEl2, isHovering, anchorAttrs, getTooltipText, isPointerInsideAnchor, syncTooltipForHoveredAnchor, onAnchorEnter, onAnchorLeave, title, TextNode };
|
|
1969
2174
|
}
|
|
1970
2175
|
});
|
|
1971
|
-
const
|
|
2176
|
+
const LinkNode_vue_vue_type_style_index_0_scoped_535a598a_lang = "";
|
|
1972
2177
|
var _sfc_render$w = function render14() {
|
|
2178
|
+
var _a2, _b;
|
|
1973
2179
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
1974
2180
|
return !_vm.node.loading ? _c("a", _vm._b({ ref: "anchorEl", staticClass: "link-node", style: _setup.cssVars, attrs: { "href": _vm.node.href, "title": _vm.showTooltip ? "" : _setup.title, "aria-label": `Link: ${_setup.title}`, "aria-hidden": _vm.node.loading ? "true" : "false", "target": "_blank", "rel": "noopener noreferrer" }, on: { "mouseenter": (e) => _setup.onAnchorEnter(e), "mouseleave": _setup.onAnchorLeave } }, "a", _setup.anchorAttrs, false), _vm._l(_vm.node.children, function(child, index2) {
|
|
1975
2181
|
return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "emphasis"}-${index2}`, tag: "component", attrs: { "node": child, "custom-id": _setup.props.customId, "index-key": `${_vm.indexKey || "link-text"}-${index2}` } });
|
|
1976
|
-
}), 1) : _c("span", _vm._b({ staticClass: "link-loading inline-flex items-baseline gap-1.5", style: _setup.cssVars, attrs: { "aria-hidden": !_vm.node.loading ? "true" : "false" } }, "span", _setup.attrs, false), [_c("span", { staticClass: "link-text-wrapper relative inline-flex" }, [_c("span", { staticClass: "leading-[normal] link-text" }, [_c(
|
|
2182
|
+
}), 1) : _c("span", _vm._b({ staticClass: "link-loading inline-flex items-baseline gap-1.5", style: _setup.cssVars, attrs: { "aria-hidden": !_vm.node.loading ? "true" : "false" } }, "span", _setup.attrs, false), [_c("span", { staticClass: "link-text-wrapper relative inline-flex" }, [_c("span", { staticClass: "leading-[normal] link-text" }, [_c(_setup.TextNode, { staticClass: "leading-[normal] link-text", attrs: { "node": { type: "text", content: String((_a2 = _vm.node.text) != null ? _a2 : ""), raw: String((_b = _vm.node.text) != null ? _b : "") }, "index-key": `${_vm.indexKey || "link-text"}-loading` } })], 1), _c("span", { staticClass: "link-loading-indicator", attrs: { "aria-hidden": "true" } })])]);
|
|
1977
2183
|
};
|
|
1978
2184
|
var _sfc_staticRenderFns$w = [];
|
|
1979
2185
|
var __component__$w = /* @__PURE__ */ normalizeComponent(
|
|
@@ -1982,7 +2188,7 @@ var __component__$w = /* @__PURE__ */ normalizeComponent(
|
|
|
1982
2188
|
_sfc_staticRenderFns$w,
|
|
1983
2189
|
false,
|
|
1984
2190
|
null,
|
|
1985
|
-
"
|
|
2191
|
+
"535a598a",
|
|
1986
2192
|
null,
|
|
1987
2193
|
null
|
|
1988
2194
|
);
|
|
@@ -2526,19 +2732,19 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2526
2732
|
checkbox_input: CheckboxNode,
|
|
2527
2733
|
reference: ReferenceNode,
|
|
2528
2734
|
footnote_anchor: FootnoteAnchorNode,
|
|
2529
|
-
footnote_reference: FootnoteReferenceNode
|
|
2735
|
+
footnote_reference: FootnoteReferenceNode,
|
|
2736
|
+
text: TextNode
|
|
2530
2737
|
}, overrides);
|
|
2531
|
-
|
|
2532
|
-
return { __sfc: true, props, overrides, nodeComponents, katexReady };
|
|
2738
|
+
return { __sfc: true, props, overrides, nodeComponents };
|
|
2533
2739
|
}
|
|
2534
2740
|
});
|
|
2535
|
-
const
|
|
2741
|
+
const ParagraphNode_vue_vue_type_style_index_0_scoped_0d09b107_lang = "";
|
|
2536
2742
|
var _sfc_render$l = function render25() {
|
|
2537
2743
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
2538
2744
|
return _c("p", { staticClass: "paragraph-node", attrs: { "dir": "auto" } }, _vm._l(_vm.node.children, function(child, index2) {
|
|
2539
2745
|
var _a2;
|
|
2540
|
-
return _c(
|
|
2541
|
-
}),
|
|
2746
|
+
return _c(_setup.nodeComponents[child.type], { key: `${_vm.indexKey || "paragraph"}-${index2}`, tag: "component", attrs: { "node": child, "index-key": `${(_a2 = _vm.indexKey) != null ? _a2 : "paragraph"}-${index2}`, "custom-id": _setup.props.customId } });
|
|
2747
|
+
}), 1);
|
|
2542
2748
|
};
|
|
2543
2749
|
var _sfc_staticRenderFns$l = [];
|
|
2544
2750
|
var __component__$l = /* @__PURE__ */ normalizeComponent(
|
|
@@ -2547,7 +2753,7 @@ var __component__$l = /* @__PURE__ */ normalizeComponent(
|
|
|
2547
2753
|
_sfc_staticRenderFns$l,
|
|
2548
2754
|
false,
|
|
2549
2755
|
null,
|
|
2550
|
-
"
|
|
2756
|
+
"0d09b107",
|
|
2551
2757
|
null,
|
|
2552
2758
|
null
|
|
2553
2759
|
);
|
|
@@ -2781,7 +2987,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2781
2987
|
codeBlockProps: null,
|
|
2782
2988
|
renderCodeBlocksAsPre: { type: Boolean },
|
|
2783
2989
|
themes: null,
|
|
2784
|
-
isDark: { type: Boolean }
|
|
2990
|
+
isDark: { type: Boolean },
|
|
2991
|
+
customHtmlTags: null
|
|
2785
2992
|
},
|
|
2786
2993
|
emits: ["copy", "handleArtifactClick"],
|
|
2787
2994
|
setup(__props, { emit }) {
|
|
@@ -2839,25 +3046,63 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2839
3046
|
const nonCodeBindings = computed(() => ({ typewriter: props.typewriter }));
|
|
2840
3047
|
const linkBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltip: props.showTooltips } : {}));
|
|
2841
3048
|
const listBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}));
|
|
3049
|
+
const effectiveCustomHtmlTagsSet = computed(() => {
|
|
3050
|
+
var _a2;
|
|
3051
|
+
const tags = (_a2 = props.customHtmlTags) != null ? _a2 : [];
|
|
3052
|
+
return new Set(
|
|
3053
|
+
tags.map((t) => String(t).trim().toLowerCase()).filter(Boolean)
|
|
3054
|
+
);
|
|
3055
|
+
});
|
|
2842
3056
|
const renderedItems = computed(() => {
|
|
2843
3057
|
const nodes = Array.isArray(props.nodes) ? props.nodes : [];
|
|
2844
3058
|
return nodes.map((rawNode, index2) => {
|
|
2845
|
-
|
|
3059
|
+
var _a2;
|
|
3060
|
+
let node = rawNode;
|
|
2846
3061
|
const language = getCodeBlockLanguage(node);
|
|
2847
3062
|
const type = String((node == null ? void 0 : node.type) || "unknown");
|
|
3063
|
+
let component = getNodeComponent(node, language);
|
|
3064
|
+
if ((node.type === "html_block" || node.type === "html_inline") && component === nodeComponents[node.type]) {
|
|
3065
|
+
const tag = String((_a2 = node.tag) != null ? _a2 : "").trim().toLowerCase() || getHtmlTagFromContent(node.content);
|
|
3066
|
+
if (tag && effectiveCustomHtmlTagsSet.value.has(tag)) {
|
|
3067
|
+
const customComponents = customComponentsMap.value;
|
|
3068
|
+
const customForTag = customComponents[tag];
|
|
3069
|
+
if (customForTag) {
|
|
3070
|
+
component = customForTag;
|
|
3071
|
+
node = __spreadProps(__spreadValues({}, node), {
|
|
3072
|
+
type: tag,
|
|
3073
|
+
tag,
|
|
3074
|
+
content: stripCustomHtmlWrapper(node.content, tag)
|
|
3075
|
+
});
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
2848
3079
|
return {
|
|
2849
3080
|
index: index2,
|
|
2850
3081
|
indexKey: `${indexPrefix.value}-${index2}`,
|
|
2851
3082
|
// Keep code blocks mounted during streaming so Shiki/Monaco renderers can
|
|
2852
3083
|
// preserve their last successful DOM instead of flashing back to <pre>.
|
|
2853
|
-
renderKey: type === "code_block" ? `${indexPrefix.value}-${index2}-${type}` : `${indexPrefix.value}-${index2}-${type}-${String((
|
|
3084
|
+
renderKey: type === "code_block" ? `${indexPrefix.value}-${index2}-${type}` : `${indexPrefix.value}-${index2}-${type}-${String((rawNode == null ? void 0 : rawNode.raw) || "").length}`,
|
|
2854
3085
|
node,
|
|
2855
3086
|
isCodeBlock: (node == null ? void 0 : node.type) === "code_block",
|
|
2856
|
-
component
|
|
3087
|
+
component,
|
|
2857
3088
|
bindings: getBindingsFor(node, language)
|
|
2858
3089
|
};
|
|
2859
3090
|
});
|
|
2860
3091
|
});
|
|
3092
|
+
function getHtmlTagFromContent(html) {
|
|
3093
|
+
const raw = String(html != null ? html : "");
|
|
3094
|
+
const match = raw.match(/^\s*<\s*([A-Z][\w:-]*)/i);
|
|
3095
|
+
return match ? match[1].toLowerCase() : "";
|
|
3096
|
+
}
|
|
3097
|
+
function stripCustomHtmlWrapper(html, tag) {
|
|
3098
|
+
const raw = String(html != null ? html : "");
|
|
3099
|
+
if (!tag)
|
|
3100
|
+
return raw;
|
|
3101
|
+
const escaped = tag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3102
|
+
const openRe = new RegExp(String.raw`^\s*<\s*${escaped}(?:\s[^>]*)?>\s*`, "i");
|
|
3103
|
+
const closeRe = new RegExp(String.raw`\s*<\s*\/\s*${escaped}\s*>\s*$`, "i");
|
|
3104
|
+
return raw.replace(openRe, "").replace(closeRe, "");
|
|
3105
|
+
}
|
|
2861
3106
|
function getCodeBlockLanguage(node) {
|
|
2862
3107
|
var _a2;
|
|
2863
3108
|
return (node == null ? void 0 : node.type) === "code_block" ? String((_a2 = node.language) != null ? _a2 : "").trim().toLowerCase() : "";
|
|
@@ -2903,7 +3148,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2903
3148
|
function handleClick(event) {
|
|
2904
3149
|
emit("handleArtifactClick", event);
|
|
2905
3150
|
}
|
|
2906
|
-
return { __sfc: true, props, emit, nodeComponents, customComponentsMap, indexPrefix, codeBlockBindings, nonCodeBindings, linkBindings, listBindings, renderedItems, getCodeBlockLanguage, getNodeComponent, getBindingsFor, handleClick };
|
|
3151
|
+
return { __sfc: true, props, emit, nodeComponents, customComponentsMap, indexPrefix, codeBlockBindings, nonCodeBindings, linkBindings, listBindings, effectiveCustomHtmlTagsSet, renderedItems, getHtmlTagFromContent, stripCustomHtmlWrapper, getCodeBlockLanguage, getNodeComponent, getBindingsFor, handleClick };
|
|
2907
3152
|
}
|
|
2908
3153
|
});
|
|
2909
3154
|
var _sfc_render$f = function render31() {
|
|
@@ -3016,6 +3261,34 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3016
3261
|
const isClient = typeof window !== "undefined";
|
|
3017
3262
|
const instance = getCurrentInstance();
|
|
3018
3263
|
const debugPerformanceEnabled = computed(() => props.debugPerformance && isClient && typeof console !== "undefined");
|
|
3264
|
+
const attrs = computed(() => {
|
|
3265
|
+
var _a3, _b2;
|
|
3266
|
+
return (_b2 = (_a3 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a3.$attrs) != null ? _b2 : {};
|
|
3267
|
+
});
|
|
3268
|
+
const textStreamState = /* @__PURE__ */ new Map();
|
|
3269
|
+
const streamRenderVersion = ref(0);
|
|
3270
|
+
const resolvedShowTooltips = computed(() => {
|
|
3271
|
+
var _a3;
|
|
3272
|
+
if (typeof props.showTooltips === "boolean")
|
|
3273
|
+
return props.showTooltips;
|
|
3274
|
+
const raw = (_a3 = attrs.value.showTooltips) != null ? _a3 : attrs.value["show-tooltips"];
|
|
3275
|
+
if (raw === "" || raw === true || raw === "true")
|
|
3276
|
+
return true;
|
|
3277
|
+
if (raw === false || raw === "false")
|
|
3278
|
+
return false;
|
|
3279
|
+
return void 0;
|
|
3280
|
+
});
|
|
3281
|
+
provide("markstreamShowTooltips", resolvedShowTooltips);
|
|
3282
|
+
provide("markstreamTypewriter", computed(() => props.typewriter !== false));
|
|
3283
|
+
provide("markstreamTextStreamState", textStreamState);
|
|
3284
|
+
provide("markstreamStreamVersion", streamRenderVersion);
|
|
3285
|
+
watch(
|
|
3286
|
+
[() => props.content, () => props.nodes],
|
|
3287
|
+
() => {
|
|
3288
|
+
streamRenderVersion.value += 1;
|
|
3289
|
+
},
|
|
3290
|
+
{ immediate: true }
|
|
3291
|
+
);
|
|
3019
3292
|
function logPerf(label, data) {
|
|
3020
3293
|
if (!debugPerformanceEnabled.value)
|
|
3021
3294
|
return;
|
|
@@ -3110,6 +3383,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3110
3383
|
return base;
|
|
3111
3384
|
return __spreadValues(__spreadValues(__spreadValues({}, base), hasFinal ? { final: resolvedFinal } : {}), hasCustom ? { customHtmlTags: Array.from(new Set(merged)) } : {});
|
|
3112
3385
|
});
|
|
3386
|
+
const effectiveCustomHtmlTagsSet = computed(() => {
|
|
3387
|
+
var _a3;
|
|
3388
|
+
const arr = (_a3 = mergedParseOptions.value.customHtmlTags) != null ? _a3 : [];
|
|
3389
|
+
return new Set(arr.map((t) => String(t).trim().toLowerCase()).filter(Boolean));
|
|
3390
|
+
});
|
|
3113
3391
|
const parsedNodes = computed(() => {
|
|
3114
3392
|
var _a3;
|
|
3115
3393
|
if (isLegacyVue26Vm(instance == null ? void 0 : instance.proxy) && !props.content && Array.isArray(props.nodes))
|
|
@@ -4315,15 +4593,33 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4315
4593
|
const listBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}));
|
|
4316
4594
|
const legacyRenderedItems = computed(() => {
|
|
4317
4595
|
return legacyNodeItems.value.map((node, index2) => {
|
|
4596
|
+
var _a3;
|
|
4318
4597
|
const language = getCodeBlockLanguage(node);
|
|
4598
|
+
let resolvedNode = node;
|
|
4599
|
+
let component = getNodeComponent(node, language);
|
|
4600
|
+
if ((node.type === "html_block" || node.type === "html_inline") && component === nodeComponents[node.type]) {
|
|
4601
|
+
const tag = String((_a3 = node.tag) != null ? _a3 : "").trim().toLowerCase() || getHtmlTagFromContent(node.content);
|
|
4602
|
+
if (tag && effectiveCustomHtmlTagsSet.value.has(tag)) {
|
|
4603
|
+
const customComponents = customComponentsMap.value;
|
|
4604
|
+
const customForTag = customComponents[tag];
|
|
4605
|
+
if (customForTag) {
|
|
4606
|
+
component = customForTag;
|
|
4607
|
+
resolvedNode = __spreadProps(__spreadValues({}, node), {
|
|
4608
|
+
type: tag,
|
|
4609
|
+
tag,
|
|
4610
|
+
content: stripCustomHtmlWrapper(node.content, tag)
|
|
4611
|
+
});
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4614
|
+
}
|
|
4319
4615
|
return {
|
|
4320
|
-
node,
|
|
4321
|
-
component
|
|
4322
|
-
bindings: getBindingsFor(
|
|
4323
|
-
isCodeBlock:
|
|
4616
|
+
node: resolvedNode,
|
|
4617
|
+
component,
|
|
4618
|
+
bindings: getBindingsFor(resolvedNode, language),
|
|
4619
|
+
isCodeBlock: resolvedNode.type === "code_block",
|
|
4324
4620
|
index: index2,
|
|
4325
4621
|
indexKey: `${indexPrefix.value}-${index2}`,
|
|
4326
|
-
renderKey: getRenderKey(
|
|
4622
|
+
renderKey: getRenderKey(resolvedNode, index2)
|
|
4327
4623
|
};
|
|
4328
4624
|
});
|
|
4329
4625
|
});
|
|
@@ -4334,11 +4630,28 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4334
4630
|
});
|
|
4335
4631
|
const renderedItems = computed(() => {
|
|
4336
4632
|
return visibleNodes.value.map((item) => {
|
|
4337
|
-
|
|
4633
|
+
var _a3;
|
|
4634
|
+
let node = getCodeBlockRenderNode(item.node);
|
|
4338
4635
|
const language = getCodeBlockLanguage(node);
|
|
4636
|
+
let component = getNodeComponent(node, language);
|
|
4637
|
+
if ((node.type === "html_block" || node.type === "html_inline") && component === nodeComponents[node.type]) {
|
|
4638
|
+
const tag = String((_a3 = node.tag) != null ? _a3 : "").trim().toLowerCase() || getHtmlTagFromContent(node.content);
|
|
4639
|
+
if (tag && effectiveCustomHtmlTagsSet.value.has(tag)) {
|
|
4640
|
+
const customComponents = customComponentsMap.value;
|
|
4641
|
+
const customForTag = customComponents[tag];
|
|
4642
|
+
if (customForTag) {
|
|
4643
|
+
component = customForTag;
|
|
4644
|
+
node = __spreadProps(__spreadValues({}, node), {
|
|
4645
|
+
type: tag,
|
|
4646
|
+
tag,
|
|
4647
|
+
content: stripCustomHtmlWrapper(node.content, tag)
|
|
4648
|
+
});
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
}
|
|
4339
4652
|
return __spreadProps(__spreadValues({}, item), {
|
|
4340
4653
|
node,
|
|
4341
|
-
component
|
|
4654
|
+
component,
|
|
4342
4655
|
bindings: getBindingsFor(node, language),
|
|
4343
4656
|
isCodeBlock: node.type === "code_block",
|
|
4344
4657
|
indexKey: `${indexPrefix.value}-${item.index}`,
|
|
@@ -4367,6 +4680,20 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4367
4680
|
codeBlockRenderCache.set(codeBlockNode, { signature, node: cloned });
|
|
4368
4681
|
return cloned;
|
|
4369
4682
|
}
|
|
4683
|
+
function getHtmlTagFromContent(html) {
|
|
4684
|
+
const raw = String(html != null ? html : "");
|
|
4685
|
+
const match = raw.match(/^\s*<\s*([A-Z][\w:-]*)/i);
|
|
4686
|
+
return match ? match[1].toLowerCase() : "";
|
|
4687
|
+
}
|
|
4688
|
+
function stripCustomHtmlWrapper(html, tag) {
|
|
4689
|
+
const raw = String(html != null ? html : "");
|
|
4690
|
+
if (!tag)
|
|
4691
|
+
return raw;
|
|
4692
|
+
const escaped = tag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4693
|
+
const openRe = new RegExp(String.raw`^\s*<\s*${escaped}(?:\s[^>]*)?>\s*`, "i");
|
|
4694
|
+
const closeRe = new RegExp(String.raw`\s*<\s*\/\s*${escaped}\s*>\s*$`, "i");
|
|
4695
|
+
return raw.replace(openRe, "").replace(closeRe, "");
|
|
4696
|
+
}
|
|
4370
4697
|
function getCodeBlockLanguage(node) {
|
|
4371
4698
|
var _a3;
|
|
4372
4699
|
return (node == null ? void 0 : node.type) === "code_block" ? String((_a3 = node.language) != null ? _a3 : "").trim().toLowerCase() : "";
|
|
@@ -4393,6 +4720,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4393
4720
|
if (!node)
|
|
4394
4721
|
return base;
|
|
4395
4722
|
const type = String(node.type || "unknown");
|
|
4723
|
+
if (type === "code_block")
|
|
4724
|
+
return base;
|
|
4396
4725
|
const loading = node.loading === true;
|
|
4397
4726
|
const raw = typeof node.raw === "string" ? node.raw.length : 0;
|
|
4398
4727
|
const content2 = typeof node.content === "string" ? node.content.length : 0;
|
|
@@ -4467,10 +4796,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4467
4796
|
return;
|
|
4468
4797
|
emit("mouseout", event);
|
|
4469
4798
|
}
|
|
4470
|
-
return { __sfc: true, props, emit, MAX_DEFERRED_NODE_COUNT, MAX_VIEWPORT_OBSERVER_TARGETS, VIEWPORT_PRIORITY_RECOVERY_COUNT, containerRef, viewportPriorityAutoDisabled, SCROLL_PARENT_OVERFLOW_RE, isClient, instance, debugPerformanceEnabled, logPerf, resolveViewportRoot, instanceMsgId, defaultMd, customTagCache, EMPTY_PARSED_NODES, mdBase, mdInstance, normalizeCustomTag: normalizeCustomTag2, resolveCustomHtmlTags: resolveCustomHtmlTags2, cloneNodeValue, cloneParsedNodeList, mergedParseOptions, parsedNodes, maxLiveNodesResolved, virtualizationEnabled, viewportPriorityEnabled, registerNodeVisibility, requestFrame, cancelFrame, isTestEnv, hasIdleCallback, resolvedBatchSize, resolvedInitialBatch, batchingEnabled, renderedCount, previousRenderContext, adaptiveBatchSize, nodeVisibilityState, nodeVisibilityHandles, nodeVisibilityFallbackTimers, nodeSlotElements, codeBlockRenderCache, nodeSlotVersion, sortedNodeSlots, scrollRootElement, detachScrollHandler, pendingFocusSync, liveRange, visibleNodes, deferNodes, incrementalRenderingActive, previousBatchConfig, shouldObserveSlots, liveNodeBufferResolved, focusIndex, nodeContentElements, legacyVue26, legacyNodesMode, legacyNodeItems, syncNodeRefs, resolveTemplateRef, desiredRenderedCount, resolveScrollContainer, isReverseFlexScrollRoot, getNormalizedScrollTop, getOffsetTopWithinRoot, cleanupScrollListener, setupScrollListener, cancelScheduledFocusSync, scheduleFocusSync, syncFocusToScroll, clamp, updateLiveRange, nodeHeights, heightStats, heightTreeSize, heightSumTree, heightKnownTree, resetHeightMeasurements, pruneHeightMeasurements, fenwickUpdate, fenwickQuery, fenwickRangeSum, rebuildHeightTrees, recordNodeHeight, averageNodeHeight, estimateHeightRange, topSpacerHeight, bottomSpacerHeight, estimateIndexForOffset, estimateIndexForOffsetFromEnd, cleanupNodeVisibility, markNodeVisible, shouldRenderNode, destroyNodeHandle, setNodeSlotElement, bumpNodeSlotVersion, setNodeContentRef, batchRaf, batchTimeout, batchPending, pendingIncrement, batchIdle, VIEWPORT_FALLBACK_DELAY, VIEWPORT_FALLBACK_MARGIN_PX, cancelBatchTimers, clearVisibilityFallback, scheduleVisibilityFallback, autoDisableViewportPriority, scheduleBatch, queueNextBatch, adjustAdaptiveBatchSize, CodeBlockNodeAsync, MermaidBlockNodeAsync, InfographicBlockNodeAsync, D2BlockNodeAsync, codeBlockComponent, nodeComponents, customComponentsMap, indexPrefix, codeBlockBindings, mermaidBindings, d2Bindings, infographicBindings, nonCodeBindings, linkBindings, listBindings, legacyRenderedItems, legacyStructuredContentMode, renderedItems, getCodeBlockRenderNode, getCodeBlockLanguage, isLegacyStructuredNode, getRenderKey, getNodeComponent, getBindingsFor, handleContainerClick, handleContainerMouseover, handleContainerMouseout, LegacyNodesRenderer };
|
|
4799
|
+
return { __sfc: true, props, emit, MAX_DEFERRED_NODE_COUNT, MAX_VIEWPORT_OBSERVER_TARGETS, VIEWPORT_PRIORITY_RECOVERY_COUNT, containerRef, viewportPriorityAutoDisabled, SCROLL_PARENT_OVERFLOW_RE, isClient, instance, debugPerformanceEnabled, attrs, textStreamState, streamRenderVersion, resolvedShowTooltips, logPerf, resolveViewportRoot, instanceMsgId, defaultMd, customTagCache, EMPTY_PARSED_NODES, mdBase, mdInstance, normalizeCustomTag: normalizeCustomTag2, resolveCustomHtmlTags: resolveCustomHtmlTags2, cloneNodeValue, cloneParsedNodeList, mergedParseOptions, effectiveCustomHtmlTagsSet, parsedNodes, maxLiveNodesResolved, virtualizationEnabled, viewportPriorityEnabled, registerNodeVisibility, requestFrame, cancelFrame, isTestEnv, hasIdleCallback, resolvedBatchSize, resolvedInitialBatch, batchingEnabled, renderedCount, previousRenderContext, adaptiveBatchSize, nodeVisibilityState, nodeVisibilityHandles, nodeVisibilityFallbackTimers, nodeSlotElements, codeBlockRenderCache, nodeSlotVersion, sortedNodeSlots, scrollRootElement, detachScrollHandler, pendingFocusSync, liveRange, visibleNodes, deferNodes, incrementalRenderingActive, previousBatchConfig, shouldObserveSlots, liveNodeBufferResolved, focusIndex, nodeContentElements, legacyVue26, legacyNodesMode, legacyNodeItems, syncNodeRefs, resolveTemplateRef, desiredRenderedCount, resolveScrollContainer, isReverseFlexScrollRoot, getNormalizedScrollTop, getOffsetTopWithinRoot, cleanupScrollListener, setupScrollListener, cancelScheduledFocusSync, scheduleFocusSync, syncFocusToScroll, clamp, updateLiveRange, nodeHeights, heightStats, heightTreeSize, heightSumTree, heightKnownTree, resetHeightMeasurements, pruneHeightMeasurements, fenwickUpdate, fenwickQuery, fenwickRangeSum, rebuildHeightTrees, recordNodeHeight, averageNodeHeight, estimateHeightRange, topSpacerHeight, bottomSpacerHeight, estimateIndexForOffset, estimateIndexForOffsetFromEnd, cleanupNodeVisibility, markNodeVisible, shouldRenderNode, destroyNodeHandle, setNodeSlotElement, bumpNodeSlotVersion, setNodeContentRef, batchRaf, batchTimeout, batchPending, pendingIncrement, batchIdle, VIEWPORT_FALLBACK_DELAY, VIEWPORT_FALLBACK_MARGIN_PX, cancelBatchTimers, clearVisibilityFallback, scheduleVisibilityFallback, autoDisableViewportPriority, scheduleBatch, queueNextBatch, adjustAdaptiveBatchSize, CodeBlockNodeAsync, MermaidBlockNodeAsync, InfographicBlockNodeAsync, D2BlockNodeAsync, codeBlockComponent, nodeComponents, customComponentsMap, indexPrefix, codeBlockBindings, mermaidBindings, d2Bindings, infographicBindings, nonCodeBindings, linkBindings, listBindings, legacyRenderedItems, legacyStructuredContentMode, renderedItems, getCodeBlockRenderNode, getHtmlTagFromContent, stripCustomHtmlWrapper, getCodeBlockLanguage, isLegacyStructuredNode, getRenderKey, getNodeComponent, getBindingsFor, handleContainerClick, handleContainerMouseover, handleContainerMouseout, LegacyNodesRenderer };
|
|
4471
4800
|
}
|
|
4472
4801
|
});
|
|
4473
|
-
const
|
|
4802
|
+
const NodeRenderer_vue_vue_type_style_index_0_scoped_e98920fd_lang = "";
|
|
4474
4803
|
const NodeRenderer_vue_vue_type_style_index_1_lang = "";
|
|
4475
4804
|
var _sfc_render$d = function render33() {
|
|
4476
4805
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
@@ -4484,7 +4813,7 @@ var _sfc_render$d = function render33() {
|
|
|
4484
4813
|
}, "handle-artifact-click": function($event) {
|
|
4485
4814
|
return _setup.emit("handleArtifactClick", $event);
|
|
4486
4815
|
} } }, "component", item.bindings, false))], 1)]);
|
|
4487
|
-
}) : _setup.legacyStructuredContentMode ? _c(_setup.LegacyNodesRenderer, { attrs: { "nodes": _setup.parsedNodes, "custom-id": _setup.props.customId, "index-key": _setup.props.indexKey, "typewriter": _setup.props.typewriter, "show-tooltips": _setup.props.showTooltips, "code-block-stream": _setup.props.codeBlockStream, "code-block-dark-theme": _setup.props.codeBlockDarkTheme, "code-block-light-theme": _setup.props.codeBlockLightTheme, "code-block-monaco-options": _setup.props.codeBlockMonacoOptions, "render-code-blocks-as-pre": _setup.props.renderCodeBlocksAsPre, "code-block-min-width": _setup.props.codeBlockMinWidth, "code-block-max-width": _setup.props.codeBlockMaxWidth, "code-block-props": _setup.props.codeBlockProps, "themes": _setup.props.themes, "is-dark": _setup.props.isDark }, on: { "copy": function($event) {
|
|
4816
|
+
}) : _setup.legacyStructuredContentMode ? _c(_setup.LegacyNodesRenderer, { attrs: { "nodes": _setup.parsedNodes, "custom-id": _setup.props.customId, "index-key": _setup.props.indexKey, "typewriter": _setup.props.typewriter, "show-tooltips": _setup.props.showTooltips, "code-block-stream": _setup.props.codeBlockStream, "code-block-dark-theme": _setup.props.codeBlockDarkTheme, "code-block-light-theme": _setup.props.codeBlockLightTheme, "code-block-monaco-options": _setup.props.codeBlockMonacoOptions, "render-code-blocks-as-pre": _setup.props.renderCodeBlocksAsPre, "code-block-min-width": _setup.props.codeBlockMinWidth, "code-block-max-width": _setup.props.codeBlockMaxWidth, "code-block-props": _setup.props.codeBlockProps, "themes": _setup.props.themes, "is-dark": _setup.props.isDark, "custom-html-tags": _setup.props.customHtmlTags }, on: { "copy": function($event) {
|
|
4488
4817
|
return _setup.emit("copy", $event);
|
|
4489
4818
|
}, "handle-artifact-click": function($event) {
|
|
4490
4819
|
return _setup.emit("handleArtifactClick", $event);
|
|
@@ -4508,7 +4837,7 @@ var __component__$d = /* @__PURE__ */ normalizeComponent(
|
|
|
4508
4837
|
_sfc_staticRenderFns$d,
|
|
4509
4838
|
false,
|
|
4510
4839
|
null,
|
|
4511
|
-
"
|
|
4840
|
+
"e98920fd",
|
|
4512
4841
|
null,
|
|
4513
4842
|
null
|
|
4514
4843
|
);
|
|
@@ -5586,6 +5915,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5586
5915
|
const copyText = ref(false);
|
|
5587
5916
|
const codeLanguage = ref(normalizeLanguageIdentifier(props.node.language));
|
|
5588
5917
|
const monacoLanguage = computed(() => resolveMonacoLanguageId(codeLanguage.value));
|
|
5918
|
+
const isPlainTextLanguage = computed(() => monacoLanguage.value === "plaintext");
|
|
5589
5919
|
const isExpanded = ref(false);
|
|
5590
5920
|
const isCollapsed = ref(false);
|
|
5591
5921
|
const editorCreated = ref(false);
|
|
@@ -5911,6 +6241,23 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5911
6241
|
return null;
|
|
5912
6242
|
}
|
|
5913
6243
|
}
|
|
6244
|
+
function getColorLuminance(color) {
|
|
6245
|
+
const channels = String(color != null ? color : "").match(/\d+(?:\.\d+)?/g);
|
|
6246
|
+
if (!channels || channels.length < 3)
|
|
6247
|
+
return null;
|
|
6248
|
+
const [r, g, b] = channels.slice(0, 3).map(Number);
|
|
6249
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
6250
|
+
}
|
|
6251
|
+
function shouldPreferPlainTextFallbackSurface(bg, fg, expectDark) {
|
|
6252
|
+
if (!isPlainTextLanguage.value)
|
|
6253
|
+
return false;
|
|
6254
|
+
const bgLuminance = getColorLuminance(bg);
|
|
6255
|
+
const fgLuminance = getColorLuminance(fg);
|
|
6256
|
+
if (expectDark) {
|
|
6257
|
+
return bgLuminance != null && bgLuminance > 170 || fgLuminance != null && fgLuminance < 110;
|
|
6258
|
+
}
|
|
6259
|
+
return bgLuminance != null && bgLuminance < 85 || fgLuminance != null && fgLuminance > 190;
|
|
6260
|
+
}
|
|
5914
6261
|
function syncEditorCssVars() {
|
|
5915
6262
|
var _a3, _b2, _c, _d, _e, _f, _g, _h;
|
|
5916
6263
|
const editorEl = codeEditor.value;
|
|
@@ -5947,6 +6294,12 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5947
6294
|
).trim();
|
|
5948
6295
|
const fg = fgVar || String((_f = (_e = fgStyles == null ? void 0 : fgStyles.color) != null ? _e : rootStyles == null ? void 0 : rootStyles.color) != null ? _f : "").trim();
|
|
5949
6296
|
const bg = bgVar || String((_h = (_g = bgStyles == null ? void 0 : bgStyles.backgroundColor) != null ? _g : rootStyles == null ? void 0 : rootStyles.backgroundColor) != null ? _h : "").trim();
|
|
6297
|
+
if (shouldPreferPlainTextFallbackSurface(bg, fg, rootEl.classList.contains("is-dark"))) {
|
|
6298
|
+
rootEl.style.removeProperty("--vscode-editor-foreground");
|
|
6299
|
+
rootEl.style.removeProperty("--vscode-editor-background");
|
|
6300
|
+
rootEl.style.removeProperty("--vscode-editor-selectionBackground");
|
|
6301
|
+
return;
|
|
6302
|
+
}
|
|
5950
6303
|
if (fg)
|
|
5951
6304
|
rootEl.style.setProperty("--vscode-editor-foreground", fg);
|
|
5952
6305
|
if (bg)
|
|
@@ -6091,6 +6444,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
6091
6444
|
deferredEditorVisualSyncRafId = safeRaf(() => {
|
|
6092
6445
|
deferredEditorVisualSyncRafId = null;
|
|
6093
6446
|
safeRaf(() => {
|
|
6447
|
+
syncDiffRevealButtons();
|
|
6094
6448
|
syncInlineFoldProxies();
|
|
6095
6449
|
if (isCollapsed.value)
|
|
6096
6450
|
return;
|
|
@@ -6098,9 +6452,31 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
6098
6452
|
updateExpandedHeight();
|
|
6099
6453
|
else
|
|
6100
6454
|
updateCollapsedHeight();
|
|
6455
|
+
safeRaf(() => {
|
|
6456
|
+
syncDiffRevealButtons();
|
|
6457
|
+
syncInlineFoldProxies();
|
|
6458
|
+
});
|
|
6101
6459
|
});
|
|
6102
6460
|
});
|
|
6103
6461
|
}
|
|
6462
|
+
function syncDiffRevealButtons() {
|
|
6463
|
+
if (!isDiff.value)
|
|
6464
|
+
return;
|
|
6465
|
+
const root = codeEditor.value;
|
|
6466
|
+
if (!root)
|
|
6467
|
+
return;
|
|
6468
|
+
const revealButtons = Array.from(
|
|
6469
|
+
root.querySelectorAll(".stream-monaco-diff-unchanged-bridge .stream-monaco-unchanged-reveal")
|
|
6470
|
+
);
|
|
6471
|
+
for (const button of revealButtons) {
|
|
6472
|
+
if (!(button instanceof HTMLButtonElement))
|
|
6473
|
+
continue;
|
|
6474
|
+
const direction = button.dataset.direction === "up" ? "up" : "down";
|
|
6475
|
+
const icon = document.createElement("span");
|
|
6476
|
+
icon.className = `codicon codicon-chevron-${direction}`;
|
|
6477
|
+
button.replaceChildren(icon);
|
|
6478
|
+
}
|
|
6479
|
+
}
|
|
6104
6480
|
function applyCollapsedContainerHeight(container2, contentHeight, maxHeight) {
|
|
6105
6481
|
const cappedHeight = Math.min(contentHeight, maxHeight);
|
|
6106
6482
|
const shouldScroll = contentHeight > maxHeight + PIXEL_EPSILON;
|
|
@@ -6302,8 +6678,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
6302
6678
|
const origin = (ev == null ? void 0 : ev.clientX) != null && (ev == null ? void 0 : ev.clientY) != null ? { x: ev.clientX, y: ev.clientY } : void 0;
|
|
6303
6679
|
showTooltipForAnchor(target, txt, "top", false, origin, props.isDark);
|
|
6304
6680
|
}
|
|
6305
|
-
function toggleExpand() {
|
|
6681
|
+
function toggleExpand(e) {
|
|
6306
6682
|
isExpanded.value = !isExpanded.value;
|
|
6683
|
+
if (e && tooltipsEnabled.value) {
|
|
6684
|
+
const target = resolveTooltipTarget(e);
|
|
6685
|
+
if (target) {
|
|
6686
|
+
const txt = isExpanded.value ? t("common.collapse") || "Collapse" : t("common.expand") || "Expand";
|
|
6687
|
+
showTooltipForAnchor(target, txt, "top", false, void 0, props.isDark);
|
|
6688
|
+
}
|
|
6689
|
+
}
|
|
6307
6690
|
const editor = isDiff.value ? getDiffEditorView() : getEditorView();
|
|
6308
6691
|
const container2 = codeEditor.value;
|
|
6309
6692
|
if (!editor || !container2)
|
|
@@ -6711,15 +7094,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
6711
7094
|
}
|
|
6712
7095
|
cleanupEditor();
|
|
6713
7096
|
});
|
|
6714
|
-
return { __sfc: true, props, emits, MONACO_TOUCH_PATCH_FLAG, ensureMonacoPassiveTouchListeners, shouldForcePassiveForMonaco, withPassiveOptions, instance, hasPreviewListener, t, codeEditor, container, copyText, codeLanguage, monacoLanguage, isExpanded, isCollapsed, editorCreated, monacoReady, expandRafId, heightBeforeCollapse, resumeGuardFrames, registerVisibility, viewportHandle, viewportReady, createEditor, createDiffEditor, updateCode, updateDiffCode, getEditor, getEditorView, getDiffEditorView, cleanupEditor, safeClean, refreshDiffPresentation, createEditorPromise, detectLanguage, setTheme, runtimeMonacoOptions, inlineFoldProxyCleanups, deferredEditorVisualSyncRafId, isDiff, defaultDiffHideUnchangedRegions, resolveDiffHideUnchangedRegionsOption, resolvedMonacoOptions, desiredEditorKind, currentEditorKind, usePreCodeRender, showInlinePreview, isDevEnv: isDevEnv2, codeFontMin, codeFontMax, codeFontStep, defaultCodeFontSize, codeFontSize, fontBaselineReady, CONTENT_PADDING, LINE_EXTRA_PER_LINE, PIXEL_EPSILON, measureLineHeightFromDom, readActualFontSizeFromEditor, getLineHeightSafe, ensureFontBaseline, increaseCodeFont, decreaseCodeFont, resetCodeFont, computeContentHeight, syncEditorCssVars, resizeSyncHandler, SCROLL_PARENT_OVERFLOW_RE, resolveScrollRootElement, adjustScrollAfterHeightChange, updateExpandedHeight, clearInlineFoldProxies, syncInlineFoldProxies, scheduleEditorVisualSync, applyCollapsedContainerHeight, updateCollapsedHeight, getMaxHeightValue, isPreviewable, displayLanguage, languageIcon, containerStyle, headerStyle, tooltipsEnabled, copy, resolveTooltipTarget, onBtnHover, onBtnLeave, onCopyHover, toggleExpand, toggleHeaderCollapse, previewCode, setAutomaticLayout, runEditorCreation, ensureEditorCreation, stopCreateEditorWatch, getPreferredColorScheme, getThemeName, resolveRequestedTheme, themeUpdate, themeLooksDark, resolvedChromeIsDark, effectiveDiffAppearance, resolvedSurfaceIsDark, buildRuntimeMonacoOptions, syncRuntimeMonacoOptions, monacoStructuralSignature, stopLoadingWatch, stopExpandAutoResize, PreCodeNode, HtmlPreviewFrame };
|
|
7097
|
+
return { __sfc: true, props, emits, MONACO_TOUCH_PATCH_FLAG, ensureMonacoPassiveTouchListeners, shouldForcePassiveForMonaco, withPassiveOptions, instance, hasPreviewListener, t, codeEditor, container, copyText, codeLanguage, monacoLanguage, isPlainTextLanguage, isExpanded, isCollapsed, editorCreated, monacoReady, expandRafId, heightBeforeCollapse, resumeGuardFrames, registerVisibility, viewportHandle, viewportReady, createEditor, createDiffEditor, updateCode, updateDiffCode, getEditor, getEditorView, getDiffEditorView, cleanupEditor, safeClean, refreshDiffPresentation, createEditorPromise, detectLanguage, setTheme, runtimeMonacoOptions, inlineFoldProxyCleanups, deferredEditorVisualSyncRafId, isDiff, defaultDiffHideUnchangedRegions, resolveDiffHideUnchangedRegionsOption, resolvedMonacoOptions, desiredEditorKind, currentEditorKind, usePreCodeRender, showInlinePreview, isDevEnv: isDevEnv2, codeFontMin, codeFontMax, codeFontStep, defaultCodeFontSize, codeFontSize, fontBaselineReady, CONTENT_PADDING, LINE_EXTRA_PER_LINE, PIXEL_EPSILON, measureLineHeightFromDom, readActualFontSizeFromEditor, getLineHeightSafe, ensureFontBaseline, increaseCodeFont, decreaseCodeFont, resetCodeFont, computeContentHeight, getColorLuminance, shouldPreferPlainTextFallbackSurface, syncEditorCssVars, resizeSyncHandler, SCROLL_PARENT_OVERFLOW_RE, resolveScrollRootElement, adjustScrollAfterHeightChange, updateExpandedHeight, clearInlineFoldProxies, syncInlineFoldProxies, scheduleEditorVisualSync, syncDiffRevealButtons, applyCollapsedContainerHeight, updateCollapsedHeight, getMaxHeightValue, isPreviewable, displayLanguage, languageIcon, containerStyle, headerStyle, tooltipsEnabled, copy, resolveTooltipTarget, onBtnHover, onBtnLeave, onCopyHover, toggleExpand, toggleHeaderCollapse, previewCode, setAutomaticLayout, runEditorCreation, ensureEditorCreation, stopCreateEditorWatch, getPreferredColorScheme, getThemeName, resolveRequestedTheme, themeUpdate, themeLooksDark, resolvedChromeIsDark, effectiveDiffAppearance, resolvedSurfaceIsDark, buildRuntimeMonacoOptions, syncRuntimeMonacoOptions, monacoStructuralSignature, stopLoadingWatch, stopExpandAutoResize, PreCodeNode, HtmlPreviewFrame };
|
|
6715
7098
|
}
|
|
6716
7099
|
});
|
|
6717
|
-
const
|
|
7100
|
+
const CodeBlockNode_vue_vue_type_style_index_0_scoped_22412502_lang = "";
|
|
6718
7101
|
var _sfc_render$9 = function render37() {
|
|
6719
7102
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
6720
7103
|
return _setup.usePreCodeRender ? _c(_setup.PreCodeNode, { attrs: { "node": _vm.node, "loading": _setup.props.loading } }) : _c("div", { ref: "container", staticClass: "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: [
|
|
6721
7104
|
_setup.resolvedSurfaceIsDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white",
|
|
6722
|
-
{ "is-rendering": _setup.props.loading, "is-dark": _setup.resolvedSurfaceIsDark, "is-diff": _setup.isDiff }
|
|
7105
|
+
{ "is-rendering": _setup.props.loading, "is-dark": _setup.resolvedSurfaceIsDark, "is-diff": _setup.isDiff, "is-plain-text": _setup.isPlainTextLanguage }
|
|
6723
7106
|
], style: _setup.containerStyle }, [_setup.props.showHeader ? _c("div", { staticClass: "code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5", style: _setup.headerStyle }, [_vm._t("header-left", function() {
|
|
6724
7107
|
return [_c("div", { staticClass: "flex items-center space-x-2 flex-1 overflow-hidden" }, [_c("span", { staticClass: "icon-slot h-4 w-4 flex-shrink-0", domProps: { "innerHTML": _vm._s(_setup.languageIcon) } }), _c("span", { staticClass: "text-sm font-medium font-mono truncate" }, [_vm._v(_vm._s(_setup.displayLanguage))])])];
|
|
6725
7108
|
}), _vm._t("header-right", function() {
|
|
@@ -6749,11 +7132,13 @@ var _sfc_render$9 = function render37() {
|
|
|
6749
7132
|
return _setup.onCopyHover($event);
|
|
6750
7133
|
}, "focus": function($event) {
|
|
6751
7134
|
return _setup.onCopyHover($event);
|
|
6752
|
-
}, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [!_setup.copyText ? _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" } }, [_c("rect", { attrs: { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" } }), _c("path", { attrs: { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" } })])]) : _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M20 6L9 17l-5-5" } })])]) : _vm._e(), _setup.props.showExpandButton ? _c("button", { staticClass: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]", attrs: { "type": "button", "aria-pressed": _setup.isExpanded }, on: { "click":
|
|
7135
|
+
}, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [!_setup.copyText ? _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" } }, [_c("rect", { attrs: { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" } }), _c("path", { attrs: { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" } })])]) : _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M20 6L9 17l-5-5" } })])]) : _vm._e(), _setup.props.showExpandButton ? _c("button", { staticClass: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]", attrs: { "type": "button", "aria-pressed": _setup.isExpanded }, on: { "click": function($event) {
|
|
7136
|
+
return _setup.toggleExpand($event);
|
|
7137
|
+
}, "mouseenter": function($event) {
|
|
6753
7138
|
_setup.onBtnHover($event, _setup.isExpanded ? _setup.t("common.collapse") || "Collapse" : _setup.t("common.expand") || "Expand");
|
|
6754
7139
|
}, "focus": function($event) {
|
|
6755
7140
|
_setup.onBtnHover($event, _setup.isExpanded ? _setup.t("common.collapse") || "Collapse" : _setup.t("common.expand") || "Expand");
|
|
6756
|
-
}, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_setup.isExpanded ? _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "
|
|
7141
|
+
}, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_setup.isExpanded ? _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6" } })]) : _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6" } })])]) : _vm._e(), _setup.isPreviewable && _setup.props.showPreviewButton ? _c("button", { staticClass: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]", attrs: { "type": "button", "aria-label": _setup.t("common.preview") || "Preview" }, on: { "click": _setup.previewCode, "mouseenter": function($event) {
|
|
6757
7142
|
_setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
|
|
6758
7143
|
}, "focus": function($event) {
|
|
6759
7144
|
_setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
|
|
@@ -6769,7 +7154,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
|
|
|
6769
7154
|
_sfc_staticRenderFns$9,
|
|
6770
7155
|
false,
|
|
6771
7156
|
null,
|
|
6772
|
-
"
|
|
7157
|
+
"22412502",
|
|
6773
7158
|
null,
|
|
6774
7159
|
null
|
|
6775
7160
|
);
|
|
@@ -6869,7 +7254,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
6869
7254
|
});
|
|
6870
7255
|
const hasPreview = computed(() => !!svgMarkup.value);
|
|
6871
7256
|
const bodyStyle = computed(() => {
|
|
6872
|
-
if (!bodyMinHeight.value)
|
|
7257
|
+
if (!showSourceFallback.value || !bodyMinHeight.value)
|
|
6873
7258
|
return void 0;
|
|
6874
7259
|
return { minHeight: `${bodyMinHeight.value}px` };
|
|
6875
7260
|
});
|
|
@@ -7010,6 +7395,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
7010
7395
|
return "";
|
|
7011
7396
|
const svgElement = svgEl;
|
|
7012
7397
|
scrubSvgElement(svgElement);
|
|
7398
|
+
svgElement.classList.add("markstream-d2-root-svg");
|
|
7013
7399
|
return svgElement.outerHTML;
|
|
7014
7400
|
}
|
|
7015
7401
|
function setSvg(svg) {
|
|
@@ -7241,7 +7627,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
7241
7627
|
return { __sfc: true, props, t, copyText, isCollapsed, showSource, d2Available, renderError, isRendering, svgMarkup, renderToken, bodyRef, bodyMinHeight, baseCode, showSourceFallback, hasPreview, bodyStyle, renderStyle, isClient, d2Instance, scheduled, unmounted, lastRenderAt, throttleTimer, pendingRender, bodyObserver, DARK_THEME_OVERRIDES, shouldSkipEventTarget, onBtnHover, onBtnLeave, onCopyHover, copy, toggleCollapse, handleSwitchMode, DISALLOWED_STYLE_PATTERNS, SAFE_URL_PROTOCOLS, neutralizeScriptProtocols, sanitizeUrl, scrubSvgElement, toSafeSvgMarkup, setSvg, clearSvg, extractSvg, ensureD2Instance, renderDiagram, scheduleRender, exportSvg, updateBodyMinHeight };
|
|
7242
7628
|
}
|
|
7243
7629
|
});
|
|
7244
|
-
const
|
|
7630
|
+
const D2BlockNode_vue_vue_type_style_index_0_scoped_fdf24c90_lang = "";
|
|
7245
7631
|
var _sfc_render$8 = function render38() {
|
|
7246
7632
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
7247
7633
|
return _c("div", { staticClass: "d2-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: _setup.props.isDark ? "border-gray-700/30 bg-gray-900 text-gray-100" : "border-gray-200 bg-white text-gray-900" }, [_setup.props.showHeader ? _c("div", { staticClass: "d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5", staticStyle: { "color": "var(--vscode-editor-foreground)", "background-color": "var(--vscode-editor-background)" } }, [_vm._m(0), _c("div", { staticClass: "flex items-center gap-x-2" }, [_setup.props.showModeToggle ? _c("div", { staticClass: "flex items-center gap-x-1 rounded-md p-0.5", class: _setup.props.isDark ? "bg-gray-700" : "bg-gray-100" }, [_c("button", { staticClass: "mode-btn px-2 py-1 text-xs rounded", class: !_setup.showSource ? "is-active" : "", attrs: { "type": "button" }, on: { "click": function($event) {
|
|
@@ -7281,7 +7667,7 @@ var __component__$8 = /* @__PURE__ */ normalizeComponent(
|
|
|
7281
7667
|
_sfc_staticRenderFns$8,
|
|
7282
7668
|
false,
|
|
7283
7669
|
null,
|
|
7284
|
-
"
|
|
7670
|
+
"fdf24c90",
|
|
7285
7671
|
null,
|
|
7286
7672
|
null
|
|
7287
7673
|
);
|
|
@@ -7348,6 +7734,21 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
7348
7734
|
const isModalOpen = ref(false);
|
|
7349
7735
|
const modalContent = ref();
|
|
7350
7736
|
const modalCloneWrapper = ref(null);
|
|
7737
|
+
function resolveContainerHeight(actualHeight) {
|
|
7738
|
+
if (!props.maxHeight || props.maxHeight === "none")
|
|
7739
|
+
return `${actualHeight}px`;
|
|
7740
|
+
const maxHeight = Number.parseFloat(String(props.maxHeight));
|
|
7741
|
+
if (!Number.isFinite(maxHeight))
|
|
7742
|
+
return `${actualHeight}px`;
|
|
7743
|
+
return `${Math.min(actualHeight, maxHeight)}px`;
|
|
7744
|
+
}
|
|
7745
|
+
function updateContainerHeight() {
|
|
7746
|
+
if (!infographicContainer.value)
|
|
7747
|
+
return;
|
|
7748
|
+
const actualHeight = infographicContainer.value.scrollHeight;
|
|
7749
|
+
if (actualHeight > 0)
|
|
7750
|
+
containerHeight.value = resolveContainerHeight(actualHeight);
|
|
7751
|
+
}
|
|
7351
7752
|
const zoom = ref(1);
|
|
7352
7753
|
const translateX = ref(0);
|
|
7353
7754
|
const translateY = ref(0);
|
|
@@ -7560,12 +7961,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
7560
7961
|
});
|
|
7561
7962
|
infographicInstance2.render(baseCode.value);
|
|
7562
7963
|
nextTick(() => {
|
|
7563
|
-
|
|
7564
|
-
const actualHeight = infographicContainer.value.scrollHeight;
|
|
7565
|
-
if (actualHeight > 0) {
|
|
7566
|
-
containerHeight.value = `${Math.min(actualHeight, 800)}px`;
|
|
7567
|
-
}
|
|
7568
|
-
}
|
|
7964
|
+
updateContainerHeight();
|
|
7569
7965
|
});
|
|
7570
7966
|
} catch (error) {
|
|
7571
7967
|
console.error("Failed to render infographic:", error);
|
|
@@ -7605,6 +8001,16 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
7605
8001
|
}
|
|
7606
8002
|
}
|
|
7607
8003
|
);
|
|
8004
|
+
watch(
|
|
8005
|
+
() => props.maxHeight,
|
|
8006
|
+
() => {
|
|
8007
|
+
if (!showSource.value && !isCollapsed.value) {
|
|
8008
|
+
nextTick(() => {
|
|
8009
|
+
renderInfographic();
|
|
8010
|
+
});
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
);
|
|
7608
8014
|
onMounted(() => {
|
|
7609
8015
|
if (!showSource.value && !isCollapsed.value) {
|
|
7610
8016
|
nextTick(() => {
|
|
@@ -7640,10 +8046,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
7640
8046
|
}
|
|
7641
8047
|
}
|
|
7642
8048
|
);
|
|
7643
|
-
return { __sfc: true, props, _emits, t, copyText, isCollapsed, infographicContainer, showSource, containerHeight, isModalOpen, modalContent, modalCloneWrapper, zoom, translateX, translateY, isDragging, dragStart, baseCode, shouldSkipEventTarget, onBtnHover, onBtnLeave, onCopyHover, copy, handleSwitchMode, handleExportClick, exportSvg, handleKeydown, openModal, closeModal, handleOpenModalClick, zoomIn, zoomOut, resetZoom, startDrag, onDrag, stopDrag, infographicInstance: infographicInstance2, renderInfographic, computedButtonStyle, isFullscreenDisabled, transformStyle, infographicIconUrl, Portal };
|
|
8049
|
+
return { __sfc: true, props, _emits, t, copyText, isCollapsed, infographicContainer, showSource, containerHeight, isModalOpen, modalContent, modalCloneWrapper, resolveContainerHeight, updateContainerHeight, zoom, translateX, translateY, isDragging, dragStart, baseCode, shouldSkipEventTarget, onBtnHover, onBtnLeave, onCopyHover, copy, handleSwitchMode, handleExportClick, exportSvg, handleKeydown, openModal, closeModal, handleOpenModalClick, zoomIn, zoomOut, resetZoom, startDrag, onDrag, stopDrag, infographicInstance: infographicInstance2, renderInfographic, computedButtonStyle, isFullscreenDisabled, transformStyle, infographicIconUrl, Portal };
|
|
7644
8050
|
}
|
|
7645
8051
|
});
|
|
7646
|
-
const
|
|
8052
|
+
const InfographicBlockNode_vue_vue_type_style_index_0_scoped_f09aa514_lang = "";
|
|
7647
8053
|
var _sfc_render$7 = function render39() {
|
|
7648
8054
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
7649
8055
|
return _c("div", { staticClass: "my-4 rounded-lg border overflow-hidden shadow-sm", class: [
|
|
@@ -7716,7 +8122,7 @@ var __component__$7 = /* @__PURE__ */ normalizeComponent(
|
|
|
7716
8122
|
_sfc_staticRenderFns$7,
|
|
7717
8123
|
false,
|
|
7718
8124
|
null,
|
|
7719
|
-
"
|
|
8125
|
+
"f09aa514",
|
|
7720
8126
|
null,
|
|
7721
8127
|
null
|
|
7722
8128
|
);
|
|
@@ -8178,8 +8584,15 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
8178
8584
|
const origin = (ev == null ? void 0 : ev.clientX) != null && (ev == null ? void 0 : ev.clientY) != null ? { x: ev.clientX, y: ev.clientY } : void 0;
|
|
8179
8585
|
showTooltipForAnchor(target, txt, "top", false, origin, props.isDark);
|
|
8180
8586
|
}
|
|
8181
|
-
function toggleExpand() {
|
|
8587
|
+
function toggleExpand(e) {
|
|
8182
8588
|
isExpanded.value = !isExpanded.value;
|
|
8589
|
+
if (e && tooltipsEnabled.value) {
|
|
8590
|
+
const target = resolveTooltipTarget(e);
|
|
8591
|
+
if (target) {
|
|
8592
|
+
const txt = isExpanded.value ? t("common.collapse") || "Collapse" : t("common.expand") || "Expand";
|
|
8593
|
+
showTooltipForAnchor(target, txt, "top", false, void 0, props.isDark);
|
|
8594
|
+
}
|
|
8595
|
+
}
|
|
8183
8596
|
const content2 = codeBlockContent.value;
|
|
8184
8597
|
if (!content2)
|
|
8185
8598
|
return;
|
|
@@ -8227,7 +8640,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
8227
8640
|
return { __sfc: true, props, emits, t, codeLanguage, copyText, isExpanded, isCollapsed, container, codeBlockContent, rendererTarget, fallbackHtml, rendererReady, hasStableRender, renderObserver, autoScrollEnabled, lastScrollTop, codeFontMin, codeFontMax, codeFontStep, defaultCodeFontSize, codeFontSize, fontBaselineReady, displayLanguage, languageIcon, isPreviewable, containerStyle, contentStyle, tooltipsEnabled, getPreferredColorScheme, getResolvedThemes, getColorChannels, getRelativeLuminance, getContrastRatio, isDarkBackgroundColor, syncRenderedCssVars, escapeHtml: escapeHtml2, renderFallback, clearFallback, keepLastSuccessfulRender, hasRendererContent, clearFallbackWhenRendererReady, renderer, createShikiRenderer, registerHighlight, registeredHighlightLanguages, warnedMissingLanguages, warnedRendererErrors, isDevEnv: isDevEnv2, normalizeRendererLanguage, updateRendererWithFallback, ensureStreamMarkdownLoaded, initRenderer, isAtBottom, handleScroll, copy, resolveTooltipTarget, onBtnHover, onBtnLeave, onCopyHover, toggleExpand, toggleHeaderCollapse, increaseCodeFont, decreaseCodeFont, resetCodeFont, previewCode };
|
|
8228
8641
|
}
|
|
8229
8642
|
});
|
|
8230
|
-
const
|
|
8643
|
+
const MarkdownCodeBlockNode_vue_vue_type_style_index_0_scoped_dfe9b17a_lang = "";
|
|
8231
8644
|
var _sfc_render$6 = function render40() {
|
|
8232
8645
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
8233
8646
|
return _c("div", { ref: "container", staticClass: "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: [_setup.props.isDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white", _setup.props.isDark ? "is-dark" : ""], style: __spreadProps(__spreadValues({}, _setup.containerStyle), {
|
|
@@ -8262,11 +8675,13 @@ var _sfc_render$6 = function render40() {
|
|
|
8262
8675
|
return _setup.onCopyHover($event);
|
|
8263
8676
|
}, "focus": function($event) {
|
|
8264
8677
|
return _setup.onCopyHover($event);
|
|
8265
|
-
}, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [!_setup.copyText ? _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" } }, [_c("rect", { attrs: { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" } }), _c("path", { attrs: { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" } })])]) : _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M20 6L9 17l-5-5" } })])]) : _vm._e(), _setup.props.showExpandButton ? _c("button", { staticClass: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]", attrs: { "type": "button", "aria-pressed": _setup.isExpanded }, on: { "click":
|
|
8678
|
+
}, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [!_setup.copyText ? _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2" } }, [_c("rect", { attrs: { "width": "14", "height": "14", "x": "8", "y": "8", "rx": "2", "ry": "2" } }), _c("path", { attrs: { "d": "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" } })])]) : _c("svg", { staticClass: "w-3 h-3", attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "1em", "height": "1em", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M20 6L9 17l-5-5" } })])]) : _vm._e(), _setup.props.showExpandButton ? _c("button", { staticClass: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]", attrs: { "type": "button", "aria-pressed": _setup.isExpanded }, on: { "click": function($event) {
|
|
8679
|
+
return _setup.toggleExpand($event);
|
|
8680
|
+
}, "mouseenter": function($event) {
|
|
8266
8681
|
_setup.onBtnHover($event, _setup.isExpanded ? _setup.t("common.collapse") || "Collapse" : _setup.t("common.expand") || "Expand");
|
|
8267
8682
|
}, "focus": function($event) {
|
|
8268
8683
|
_setup.onBtnHover($event, _setup.isExpanded ? _setup.t("common.collapse") || "Collapse" : _setup.t("common.expand") || "Expand");
|
|
8269
|
-
}, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_setup.isExpanded ? _c("svg", { attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "0.75rem", "height": "0.75rem", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "
|
|
8684
|
+
}, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_setup.isExpanded ? _c("svg", { attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "0.75rem", "height": "0.75rem", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6" } })]) : _c("svg", { attrs: { "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", "role": "img", "width": "0.75rem", "height": "0.75rem", "viewBox": "0 0 24 24" } }, [_c("path", { attrs: { "fill": "none", "stroke": "currentColor", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", "d": "M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6" } })])]) : _vm._e(), _setup.isPreviewable && _setup.props.showPreviewButton ? _c("button", { staticClass: "code-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]", attrs: { "type": "button", "aria-label": _setup.t("common.preview") || "Preview" }, on: { "click": _setup.previewCode, "mouseenter": function($event) {
|
|
8270
8685
|
_setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
|
|
8271
8686
|
}, "focus": function($event) {
|
|
8272
8687
|
_setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
|
|
@@ -8286,7 +8701,7 @@ var __component__$6 = /* @__PURE__ */ normalizeComponent(
|
|
|
8286
8701
|
_sfc_staticRenderFns$6,
|
|
8287
8702
|
false,
|
|
8288
8703
|
null,
|
|
8289
|
-
"
|
|
8704
|
+
"dfe9b17a",
|
|
8290
8705
|
null,
|
|
8291
8706
|
null
|
|
8292
8707
|
);
|
|
@@ -9443,7 +9858,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9443
9858
|
showCollapseButton: { type: Boolean, default: true },
|
|
9444
9859
|
showZoomControls: { type: Boolean, default: true },
|
|
9445
9860
|
enableWheelZoom: { type: Boolean, default: false },
|
|
9446
|
-
isStrict: { type: Boolean, default: false }
|
|
9861
|
+
isStrict: { type: Boolean, default: false },
|
|
9862
|
+
onRenderError: null
|
|
9447
9863
|
},
|
|
9448
9864
|
emits: ["copy", "export", "openModal", "toggleMode"],
|
|
9449
9865
|
setup(__props, { emit: emits }) {
|
|
@@ -9816,6 +10232,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9816
10232
|
return;
|
|
9817
10233
|
if (!mermaidContent.value)
|
|
9818
10234
|
return;
|
|
10235
|
+
if (typeof props.onRenderError === "function") {
|
|
10236
|
+
const handled = props.onRenderError(error, baseFixedCode.value, mermaidContent.value);
|
|
10237
|
+
if (handled === true) {
|
|
10238
|
+
hasRenderError.value = true;
|
|
10239
|
+
stopPreviewPolling();
|
|
10240
|
+
return;
|
|
10241
|
+
}
|
|
10242
|
+
}
|
|
9819
10243
|
const errorDiv = document.createElement("div");
|
|
9820
10244
|
errorDiv.className = "text-red-500 p-4";
|
|
9821
10245
|
errorDiv.textContent = "Failed to render diagram: ";
|
|
@@ -9949,6 +10373,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9949
10373
|
});
|
|
9950
10374
|
}
|
|
9951
10375
|
const isFullscreenDisabled = computed(() => showSource.value || isRendering.value || isCollapsed.value);
|
|
10376
|
+
function resolveMaxContainerHeight() {
|
|
10377
|
+
if (!props.maxHeight || props.maxHeight === "none")
|
|
10378
|
+
return null;
|
|
10379
|
+
const maxHeight = Number.parseFloat(String(props.maxHeight));
|
|
10380
|
+
return Number.isFinite(maxHeight) ? maxHeight : null;
|
|
10381
|
+
}
|
|
9952
10382
|
function updateContainerHeight(newContainerWidth) {
|
|
9953
10383
|
if (!mermaidContainer.value || !mermaidContent.value)
|
|
9954
10384
|
return;
|
|
@@ -9988,10 +10418,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9988
10418
|
if (intrinsicWidth > 0 && intrinsicHeight > 0) {
|
|
9989
10419
|
const aspectRatio = intrinsicHeight / intrinsicWidth;
|
|
9990
10420
|
const containerWidth = newContainerWidth != null ? newContainerWidth : mermaidContainer.value.clientWidth;
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
containerHeight.value = `${
|
|
10421
|
+
const maxHeight = resolveMaxContainerHeight();
|
|
10422
|
+
const newHeight = containerWidth * aspectRatio;
|
|
10423
|
+
const resolvedHeight = maxHeight == null ? newHeight : Math.min(newHeight, maxHeight);
|
|
10424
|
+
containerHeight.value = `${resolvedHeight}px`;
|
|
9995
10425
|
}
|
|
9996
10426
|
}
|
|
9997
10427
|
const isModalOpen = ref(false);
|
|
@@ -10021,6 +10451,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
10021
10451
|
if (mermaidContainer.value && modalContent.value) {
|
|
10022
10452
|
const clone = mermaidContainer.value.cloneNode(true);
|
|
10023
10453
|
clone.classList.add("fullscreen");
|
|
10454
|
+
clone.style.height = "100%";
|
|
10455
|
+
clone.style.maxHeight = "100%";
|
|
10024
10456
|
const wrapper = clone.querySelector(
|
|
10025
10457
|
"[data-mermaid-wrapper]"
|
|
10026
10458
|
);
|
|
@@ -10637,8 +11069,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
10637
11069
|
yield nextTick();
|
|
10638
11070
|
if (!mermaidAvailable.value || !canScheduleViewportWork())
|
|
10639
11071
|
return;
|
|
10640
|
-
yield progressiveRender();
|
|
10641
11072
|
startPreviewPolling();
|
|
11073
|
+
yield progressiveRender();
|
|
10642
11074
|
} else {
|
|
10643
11075
|
stopPreviewPolling();
|
|
10644
11076
|
if (hasRenderedOnce.value) {
|
|
@@ -10736,6 +11168,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
10736
11168
|
},
|
|
10737
11169
|
{ immediate: false }
|
|
10738
11170
|
);
|
|
11171
|
+
watch(
|
|
11172
|
+
() => props.maxHeight,
|
|
11173
|
+
() => {
|
|
11174
|
+
nextTick(() => {
|
|
11175
|
+
updateContainerHeight();
|
|
11176
|
+
});
|
|
11177
|
+
}
|
|
11178
|
+
);
|
|
10739
11179
|
onUnmounted(() => {
|
|
10740
11180
|
if (contentStableTimer) {
|
|
10741
11181
|
clearTimeout(contentStableTimer);
|
|
@@ -10773,10 +11213,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
10773
11213
|
const computedButtonStyle = computed(() => {
|
|
10774
11214
|
return props.isDark ? "mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200" : "mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700";
|
|
10775
11215
|
});
|
|
10776
|
-
return { __sfc: true, props, emits, DOMPURIFY_CONFIG, mermaidAvailable, mermaidSecurityLevel, mermaidInitConfig, neutralizeScriptProtocols, DISALLOWED_STYLE_PATTERNS, SAFE_URL_PROTOCOLS, sanitizeUrl, scrubSvgElement, toSafeSvgElement, setSafeSvg, clearElement, renderSvgToTarget, t, resolveMermaidInstance, copyText, isCollapsed, mermaidContainer, mermaidContent, modalContent, modalCloneWrapper, registerViewport, viewportHandle, viewportReady, modeContainerRef, baseFixedCode, getCodeWithTheme, zoom, translateX, translateY, isDragging, dragStart, showSource, userToggledShowSource, isRendering, renderQueue, lastContentLength, isContentGenerating, renderDebounceDelay, contentStableDelay, previewPollInitialDelay, previewPollMaxDelay, previewPollMaxAttempts, contentStableTimer, renderRetryTimer, progressiveRenderDebounceTimer, consecutiveRenderTimeouts, MAX_RENDER_TIMEOUT_RETRIES, requestIdle, canScheduleViewportWork, clearProgressiveRenderDebounceTimer, debouncedProgressiveRender, clearRenderRetryTimer, scheduleRenderRetry, containerHeight, resizeObserver, hasRenderedOnce, isThemeRendering, svgCache, lastSvgSnapshot, lastRenderedCode, renderToken, currentWorkController, hasRenderError, savedTransformState, wheelListeners, timeouts, cancelIdle, previewPollTimeoutId, previewPollIdleId, isPreviewPolling, previewPollDelay, previewPollController, lastPreviewStopAt, allowPartialPreview, previewPollAttempts, withTimeoutSignal, renderErrorToContainer, isTimeoutError, shouldSkipEventTarget, onBtnHover, onBtnLeave, onCopyHover, applyThemeTo, canApplyPartialPreview, getSafePrefixCandidate, canParseOnMain, canParseOffthread: canParseOffthread$1, canParseOrPrefix, isFullscreenDisabled, updateContainerHeight, isModalOpen, transformStyle, handleKeydown, openModal, closeModal, checkContentStability, zoomIn, zoomOut, resetZoom, startDrag, onDrag, stopDrag, handleWheel, copy, exportSvg, handleExportClick, handleOpenModalClick, handleSwitchMode, switchMode, initMermaid, renderPartial, progressiveRender, stopPreviewPolling, cleanupAfterLoadingSettled, scheduleNextPreviewPoll, startPreviewPolling, computedButtonStyle, mermaidIconUrl, Portal };
|
|
11216
|
+
return { __sfc: true, props, emits, DOMPURIFY_CONFIG, mermaidAvailable, mermaidSecurityLevel, mermaidInitConfig, neutralizeScriptProtocols, DISALLOWED_STYLE_PATTERNS, SAFE_URL_PROTOCOLS, sanitizeUrl, scrubSvgElement, toSafeSvgElement, setSafeSvg, clearElement, renderSvgToTarget, t, resolveMermaidInstance, copyText, isCollapsed, mermaidContainer, mermaidContent, modalContent, modalCloneWrapper, registerViewport, viewportHandle, viewportReady, modeContainerRef, baseFixedCode, getCodeWithTheme, zoom, translateX, translateY, isDragging, dragStart, showSource, userToggledShowSource, isRendering, renderQueue, lastContentLength, isContentGenerating, renderDebounceDelay, contentStableDelay, previewPollInitialDelay, previewPollMaxDelay, previewPollMaxAttempts, contentStableTimer, renderRetryTimer, progressiveRenderDebounceTimer, consecutiveRenderTimeouts, MAX_RENDER_TIMEOUT_RETRIES, requestIdle, canScheduleViewportWork, clearProgressiveRenderDebounceTimer, debouncedProgressiveRender, clearRenderRetryTimer, scheduleRenderRetry, containerHeight, resizeObserver, hasRenderedOnce, isThemeRendering, svgCache, lastSvgSnapshot, lastRenderedCode, renderToken, currentWorkController, hasRenderError, savedTransformState, wheelListeners, timeouts, cancelIdle, previewPollTimeoutId, previewPollIdleId, isPreviewPolling, previewPollDelay, previewPollController, lastPreviewStopAt, allowPartialPreview, previewPollAttempts, withTimeoutSignal, renderErrorToContainer, isTimeoutError, shouldSkipEventTarget, onBtnHover, onBtnLeave, onCopyHover, applyThemeTo, canApplyPartialPreview, getSafePrefixCandidate, canParseOnMain, canParseOffthread: canParseOffthread$1, canParseOrPrefix, isFullscreenDisabled, resolveMaxContainerHeight, updateContainerHeight, isModalOpen, transformStyle, handleKeydown, openModal, closeModal, checkContentStability, zoomIn, zoomOut, resetZoom, startDrag, onDrag, stopDrag, handleWheel, copy, exportSvg, handleExportClick, handleOpenModalClick, handleSwitchMode, switchMode, initMermaid, renderPartial, progressiveRender, stopPreviewPolling, cleanupAfterLoadingSettled, scheduleNextPreviewPoll, startPreviewPolling, computedButtonStyle, mermaidIconUrl, Portal };
|
|
10777
11217
|
}
|
|
10778
11218
|
});
|
|
10779
|
-
const
|
|
11219
|
+
const MermaidBlockNode_vue_vue_type_style_index_0_scoped_80cb1008_lang = "";
|
|
10780
11220
|
var _sfc_render$2 = function render43() {
|
|
10781
11221
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
10782
11222
|
return _c("div", { staticClass: "my-4 rounded-lg border overflow-hidden shadow-sm", class: [
|
|
@@ -10849,7 +11289,7 @@ var __component__$2 = /* @__PURE__ */ normalizeComponent(
|
|
|
10849
11289
|
_sfc_staticRenderFns$2,
|
|
10850
11290
|
false,
|
|
10851
11291
|
null,
|
|
10852
|
-
"
|
|
11292
|
+
"80cb1008",
|
|
10853
11293
|
null,
|
|
10854
11294
|
null
|
|
10855
11295
|
);
|