markstream-vue2 0.0.48 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +179 -79
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/NodeRenderer/LegacyNodesRenderer.vue.d.ts +1 -0
- package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +1 -0
- package/dist/types/types/index.d.ts +2 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ 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
58
|
import { defineComponent, getCurrentInstance, computed, shallowRef, h, inject, ref, watch, readonly, useAttrs, onMounted, nextTick, onUpdated, onBeforeUnmount, provide, getCurrentScope, onScopeDispose, markRaw, reactive, onUnmounted } from "vue-demi";
|
|
59
|
-
import {
|
|
59
|
+
import { normalizeShikiLanguage, createSmoothMarkdownStream, getHighlightRegistrationKey, getRuntimeShikiRegistrationConfig, registerHighlightOnce } from "markstream-core";
|
|
60
60
|
import { autoUpdate, offset, flip, shift, computePosition } from "@floating-ui/dom";
|
|
61
61
|
function getVue2MinorVersion$1(version) {
|
|
62
62
|
const raw = typeof version === "string" ? version : "";
|
|
@@ -616,6 +616,20 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
616
616
|
},
|
|
617
617
|
setup(__props) {
|
|
618
618
|
const props = __props;
|
|
619
|
+
function settleAndMergeSegments(current, segmentId) {
|
|
620
|
+
return current.reduce((result, segment) => {
|
|
621
|
+
const nextSegment = segment.id === segmentId ? __spreadProps(__spreadValues({}, segment), { fading: false }) : segment;
|
|
622
|
+
const previousSegment = result[result.length - 1];
|
|
623
|
+
if (previousSegment && !previousSegment.fading && !nextSegment.fading) {
|
|
624
|
+
result[result.length - 1] = __spreadProps(__spreadValues({}, previousSegment), {
|
|
625
|
+
content: previousSegment.content + nextSegment.content
|
|
626
|
+
});
|
|
627
|
+
} else {
|
|
628
|
+
result.push(nextSegment);
|
|
629
|
+
}
|
|
630
|
+
return result;
|
|
631
|
+
}, []);
|
|
632
|
+
}
|
|
619
633
|
const instance = getCurrentInstance();
|
|
620
634
|
const attrs = computed(() => {
|
|
621
635
|
var _a2, _b;
|
|
@@ -645,39 +659,58 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
645
659
|
return "";
|
|
646
660
|
return String(raw);
|
|
647
661
|
});
|
|
648
|
-
const
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
function getRenderedContent() {
|
|
652
|
-
return settledCode.value + streamedDelta.value;
|
|
653
|
-
}
|
|
662
|
+
const segments = ref(props.node.code ? [{ id: 0, content: props.node.code, fading: false }] : []);
|
|
663
|
+
const renderedCode = ref(props.node.code);
|
|
664
|
+
let nextSegmentId = 1;
|
|
654
665
|
function setFullContent(next) {
|
|
655
|
-
|
|
656
|
-
|
|
666
|
+
var _a2;
|
|
667
|
+
if (segments.value.length === 1 && !((_a2 = segments.value[0]) == null ? void 0 : _a2.fading) && segments.value[0].content === next)
|
|
668
|
+
return;
|
|
669
|
+
segments.value = next ? [{ id: nextSegmentId++, content: next, fading: false }] : [];
|
|
657
670
|
}
|
|
658
|
-
function
|
|
659
|
-
if (!
|
|
671
|
+
function settleSegment(segmentId) {
|
|
672
|
+
if (!segments.value.some((segment) => segment.id === segmentId && segment.fading))
|
|
660
673
|
return;
|
|
661
|
-
|
|
662
|
-
|
|
674
|
+
segments.value = settleAndMergeSegments(segments.value, segmentId);
|
|
675
|
+
}
|
|
676
|
+
function streamedDeltaClass(segment) {
|
|
677
|
+
return segment.id % 2 === 0 ? "inline-code-stream-delta--a" : "inline-code-stream-delta--b";
|
|
663
678
|
}
|
|
664
679
|
watch(
|
|
665
680
|
[() => props.node.code, streamStateKey, fadeEnabled],
|
|
666
681
|
([next]) => {
|
|
667
682
|
const normalized = String(next != null ? next : "");
|
|
668
|
-
const rendered = getRenderedContent();
|
|
669
683
|
const key = streamStateKey.value;
|
|
670
684
|
const previousPersisted = key ? inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.get(key) : void 0;
|
|
671
|
-
const previousContent = previousPersisted != null ? previousPersisted :
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
685
|
+
const previousContent = previousPersisted != null ? previousPersisted : renderedCode.value;
|
|
686
|
+
const resumeFromPersistedContent = previousPersisted !== void 0 && previousPersisted !== renderedCode.value;
|
|
687
|
+
if (!fadeEnabled.value) {
|
|
688
|
+
setFullContent(normalized);
|
|
689
|
+
} else if (normalized !== previousContent) {
|
|
690
|
+
if (previousContent && normalized.startsWith(previousContent)) {
|
|
691
|
+
const appendedContent = normalized.slice(previousContent.length);
|
|
692
|
+
const lastSegment = segments.value[segments.value.length - 1];
|
|
693
|
+
if (resumeFromPersistedContent) {
|
|
694
|
+
segments.value = [
|
|
695
|
+
{ id: nextSegmentId++, content: previousContent, fading: false },
|
|
696
|
+
{ id: nextSegmentId++, content: appendedContent, fading: true }
|
|
697
|
+
];
|
|
698
|
+
} else if (lastSegment == null ? void 0 : lastSegment.fading) {
|
|
699
|
+
segments.value = [
|
|
700
|
+
...segments.value.slice(0, -1),
|
|
701
|
+
__spreadProps(__spreadValues({}, lastSegment), { content: lastSegment.content + appendedContent })
|
|
702
|
+
];
|
|
703
|
+
} else {
|
|
704
|
+
segments.value = [
|
|
705
|
+
...segments.value,
|
|
706
|
+
{ id: nextSegmentId++, content: appendedContent, fading: true }
|
|
707
|
+
];
|
|
708
|
+
}
|
|
709
|
+
} else {
|
|
710
|
+
setFullContent(normalized);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
renderedCode.value = normalized;
|
|
681
714
|
if (key)
|
|
682
715
|
inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
|
|
683
716
|
},
|
|
@@ -688,17 +721,20 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
688
721
|
(enabled) => {
|
|
689
722
|
if (enabled)
|
|
690
723
|
return;
|
|
691
|
-
setFullContent(
|
|
724
|
+
setFullContent(renderedCode.value);
|
|
692
725
|
}
|
|
693
726
|
);
|
|
694
|
-
|
|
695
|
-
return { __sfc: true, props, instance, attrs, inheritedFade, inheritedTextStreamState, explicitFade, fadeEnabled, streamStateKey, settledCode, streamedDelta, streamFadeVersion, getRenderedContent, setFullContent, settleStreamedDelta, streamedDeltaClass };
|
|
727
|
+
return { __sfc: true, props, settleAndMergeSegments, instance, attrs, inheritedFade, inheritedTextStreamState, explicitFade, fadeEnabled, streamStateKey, segments, renderedCode, nextSegmentId, setFullContent, settleSegment, streamedDeltaClass };
|
|
696
728
|
}
|
|
697
729
|
});
|
|
698
|
-
const
|
|
730
|
+
const InlineCodeNode_vue_vue_type_style_index_0_scoped_6ea4ef26_lang = "";
|
|
699
731
|
var _sfc_render$E = function render6() {
|
|
700
732
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
701
|
-
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-['']" },
|
|
733
|
+
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._l(_setup.segments, function(segment) {
|
|
734
|
+
return _c("span", { key: segment.id, class: segment.fading ? ["inline-code-stream-delta", _setup.streamedDeltaClass(segment)] : void 0, on: { "animationend": function($event) {
|
|
735
|
+
segment.fading && _setup.settleSegment(segment.id);
|
|
736
|
+
} } }, [_vm._v(" " + _vm._s(segment.content) + " ")]);
|
|
737
|
+
}), 0);
|
|
702
738
|
};
|
|
703
739
|
var _sfc_staticRenderFns$E = [];
|
|
704
740
|
var __component__$E = /* @__PURE__ */ normalizeComponent(
|
|
@@ -707,7 +743,7 @@ var __component__$E = /* @__PURE__ */ normalizeComponent(
|
|
|
707
743
|
_sfc_staticRenderFns$E,
|
|
708
744
|
false,
|
|
709
745
|
null,
|
|
710
|
-
"
|
|
746
|
+
"6ea4ef26",
|
|
711
747
|
null,
|
|
712
748
|
null
|
|
713
749
|
);
|
|
@@ -1094,6 +1130,20 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
1094
1130
|
emits: ["copy"],
|
|
1095
1131
|
setup(__props) {
|
|
1096
1132
|
const props = __props;
|
|
1133
|
+
function settleAndMergeSegments(current, segmentId) {
|
|
1134
|
+
return current.reduce((result, segment) => {
|
|
1135
|
+
const nextSegment = segmentId == null || segment.id === segmentId ? __spreadProps(__spreadValues({}, segment), { fading: false }) : segment;
|
|
1136
|
+
const previousSegment = result[result.length - 1];
|
|
1137
|
+
if (previousSegment && !previousSegment.fading && !nextSegment.fading) {
|
|
1138
|
+
result[result.length - 1] = __spreadProps(__spreadValues({}, previousSegment), {
|
|
1139
|
+
content: previousSegment.content + nextSegment.content
|
|
1140
|
+
});
|
|
1141
|
+
} else {
|
|
1142
|
+
result.push(nextSegment);
|
|
1143
|
+
}
|
|
1144
|
+
return result;
|
|
1145
|
+
}, []);
|
|
1146
|
+
}
|
|
1097
1147
|
const katexReady = useKatexReady();
|
|
1098
1148
|
const instance = getCurrentInstance();
|
|
1099
1149
|
const attrs = computed(() => {
|
|
@@ -1125,54 +1175,76 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
1125
1175
|
return "";
|
|
1126
1176
|
return String(raw);
|
|
1127
1177
|
});
|
|
1128
|
-
const
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
function getRenderedContent() {
|
|
1132
|
-
return settledContent.value + streamedDelta.value;
|
|
1133
|
-
}
|
|
1178
|
+
const segments = ref(props.node.content ? [{ id: 0, content: props.node.content, fading: false }] : []);
|
|
1179
|
+
const renderedContent = ref(props.node.content);
|
|
1180
|
+
let nextSegmentId = 1;
|
|
1134
1181
|
function setFullContent(next) {
|
|
1135
|
-
|
|
1136
|
-
|
|
1182
|
+
var _a2;
|
|
1183
|
+
if (segments.value.length === 1 && !((_a2 = segments.value[0]) == null ? void 0 : _a2.fading) && segments.value[0].content === next)
|
|
1184
|
+
return;
|
|
1185
|
+
segments.value = next ? [{ id: nextSegmentId++, content: next, fading: false }] : [];
|
|
1186
|
+
}
|
|
1187
|
+
function settleSegment(segmentId) {
|
|
1188
|
+
if (!segments.value.some((segment) => segment.id === segmentId && segment.fading))
|
|
1189
|
+
return;
|
|
1190
|
+
segments.value = settleAndMergeSegments(segments.value, segmentId);
|
|
1137
1191
|
}
|
|
1138
|
-
function
|
|
1139
|
-
if (!
|
|
1192
|
+
function settleFadingSegments() {
|
|
1193
|
+
if (!segments.value.some((segment) => segment.fading))
|
|
1140
1194
|
return;
|
|
1141
|
-
|
|
1142
|
-
|
|
1195
|
+
segments.value = settleAndMergeSegments(segments.value);
|
|
1196
|
+
}
|
|
1197
|
+
function streamedDeltaClass(segment) {
|
|
1198
|
+
return segment.id % 2 === 0 ? "text-node-stream-delta--a" : "text-node-stream-delta--b";
|
|
1143
1199
|
}
|
|
1144
1200
|
watch(
|
|
1145
1201
|
[() => props.node.content, streamStateKey, fadeEnabled, () => inheritedStreamVersion == null ? void 0 : inheritedStreamVersion.value],
|
|
1146
1202
|
([next]) => {
|
|
1147
1203
|
const normalized = String(next != null ? next : "");
|
|
1148
|
-
const rendered = getRenderedContent();
|
|
1149
1204
|
const key = streamStateKey.value;
|
|
1150
1205
|
const previousPersisted = key ? inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.get(key) : void 0;
|
|
1151
|
-
const previousContent = previousPersisted != null ? previousPersisted :
|
|
1206
|
+
const previousContent = previousPersisted != null ? previousPersisted : renderedContent.value;
|
|
1207
|
+
const resumeFromPersistedContent = previousPersisted !== void 0 && previousPersisted !== renderedContent.value;
|
|
1152
1208
|
if (!fadeEnabled.value) {
|
|
1153
1209
|
setFullContent(normalized);
|
|
1210
|
+
renderedContent.value = normalized;
|
|
1154
1211
|
if (key)
|
|
1155
1212
|
inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
|
|
1156
1213
|
return;
|
|
1157
1214
|
}
|
|
1158
1215
|
if (normalized === previousContent) {
|
|
1159
|
-
if (
|
|
1160
|
-
|
|
1161
|
-
else if (
|
|
1216
|
+
if (segments.value.some((segment) => segment.fading))
|
|
1217
|
+
settleFadingSegments();
|
|
1218
|
+
else if (renderedContent.value !== normalized)
|
|
1162
1219
|
setFullContent(normalized);
|
|
1163
1220
|
if (key)
|
|
1164
1221
|
inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
|
|
1222
|
+
renderedContent.value = normalized;
|
|
1165
1223
|
return;
|
|
1166
1224
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1225
|
+
if (previousContent && normalized.startsWith(previousContent)) {
|
|
1226
|
+
const appendedContent = normalized.slice(previousContent.length);
|
|
1227
|
+
const lastSegment = segments.value[segments.value.length - 1];
|
|
1228
|
+
if (resumeFromPersistedContent) {
|
|
1229
|
+
segments.value = [
|
|
1230
|
+
{ id: nextSegmentId++, content: previousContent, fading: false },
|
|
1231
|
+
{ id: nextSegmentId++, content: appendedContent, fading: true }
|
|
1232
|
+
];
|
|
1233
|
+
} else if (lastSegment == null ? void 0 : lastSegment.fading) {
|
|
1234
|
+
segments.value = [
|
|
1235
|
+
...segments.value.slice(0, -1),
|
|
1236
|
+
__spreadProps(__spreadValues({}, lastSegment), { content: lastSegment.content + appendedContent })
|
|
1237
|
+
];
|
|
1238
|
+
} else {
|
|
1239
|
+
segments.value = [
|
|
1240
|
+
...segments.value,
|
|
1241
|
+
{ id: nextSegmentId++, content: appendedContent, fading: true }
|
|
1242
|
+
];
|
|
1243
|
+
}
|
|
1244
|
+
} else {
|
|
1245
|
+
setFullContent(normalized);
|
|
1246
|
+
}
|
|
1247
|
+
renderedContent.value = normalized;
|
|
1176
1248
|
if (key)
|
|
1177
1249
|
inheritedTextStreamState == null ? void 0 : inheritedTextStreamState.set(key, normalized);
|
|
1178
1250
|
},
|
|
@@ -1183,17 +1255,20 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
1183
1255
|
(enabled) => {
|
|
1184
1256
|
if (enabled)
|
|
1185
1257
|
return;
|
|
1186
|
-
setFullContent(
|
|
1258
|
+
setFullContent(renderedContent.value);
|
|
1187
1259
|
}
|
|
1188
1260
|
);
|
|
1189
|
-
|
|
1190
|
-
return { __sfc: true, props, katexReady, instance, attrs, inheritedFade, inheritedTextStreamState, inheritedStreamVersion, explicitFade, fadeEnabled, streamStateKey, settledContent, streamedDelta, streamFadeVersion, getRenderedContent, setFullContent, settleStreamedDelta, streamedDeltaClass };
|
|
1261
|
+
return { __sfc: true, props, settleAndMergeSegments, katexReady, instance, attrs, inheritedFade, inheritedTextStreamState, inheritedStreamVersion, explicitFade, fadeEnabled, streamStateKey, segments, renderedContent, nextSegmentId, setFullContent, settleSegment, settleFadingSegments, streamedDeltaClass };
|
|
1191
1262
|
}
|
|
1192
1263
|
});
|
|
1193
|
-
const
|
|
1264
|
+
const TextNode_vue_vue_type_style_index_0_scoped_00951658_lang = "";
|
|
1194
1265
|
var _sfc_render$C = function render8() {
|
|
1195
1266
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
1196
|
-
return _c("span", { staticClass: "whitespace-pre-wrap break-words text-node", class: [_setup.katexReady && _vm.node.center ? "text-node-center" : ""] },
|
|
1267
|
+
return _c("span", { staticClass: "whitespace-pre-wrap break-words text-node", class: [_setup.katexReady && _vm.node.center ? "text-node-center" : ""] }, _vm._l(_setup.segments, function(segment) {
|
|
1268
|
+
return _c("span", { key: segment.id, class: segment.fading ? ["text-node-stream-delta", _setup.streamedDeltaClass(segment)] : void 0, on: { "animationend": function($event) {
|
|
1269
|
+
segment.fading && _setup.settleSegment(segment.id);
|
|
1270
|
+
} } }, [_vm._v(" " + _vm._s(segment.content) + " ")]);
|
|
1271
|
+
}), 0);
|
|
1197
1272
|
};
|
|
1198
1273
|
var _sfc_staticRenderFns$C = [];
|
|
1199
1274
|
var __component__$C = /* @__PURE__ */ normalizeComponent(
|
|
@@ -1202,7 +1277,7 @@ var __component__$C = /* @__PURE__ */ normalizeComponent(
|
|
|
1202
1277
|
_sfc_staticRenderFns$C,
|
|
1203
1278
|
false,
|
|
1204
1279
|
null,
|
|
1205
|
-
"
|
|
1280
|
+
"00951658",
|
|
1206
1281
|
null,
|
|
1207
1282
|
null
|
|
1208
1283
|
);
|
|
@@ -3859,13 +3934,23 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3859
3934
|
customHtmlTags: null,
|
|
3860
3935
|
htmlPolicy: null
|
|
3861
3936
|
},
|
|
3862
|
-
emits: ["copy", "handleArtifactClick", "click"],
|
|
3937
|
+
emits: ["copy", "copy-code", "handleArtifactClick", "click"],
|
|
3863
3938
|
setup(__props, { emit }) {
|
|
3864
3939
|
const props = __props;
|
|
3865
3940
|
provide("markstreamTypewriter", computed(() => props.typewriter === true));
|
|
3866
3941
|
provide("markstreamFade", computed(() => props.fade !== false));
|
|
3867
|
-
function
|
|
3868
|
-
|
|
3942
|
+
function isNativeDomEvent(value) {
|
|
3943
|
+
return typeof Event !== "undefined" && value instanceof Event;
|
|
3944
|
+
}
|
|
3945
|
+
function handleCopy(payload) {
|
|
3946
|
+
if (isNativeDomEvent(payload))
|
|
3947
|
+
return;
|
|
3948
|
+
if (typeof payload === "string") {
|
|
3949
|
+
emit("copy-code", payload);
|
|
3950
|
+
emit("copy", payload);
|
|
3951
|
+
return;
|
|
3952
|
+
}
|
|
3953
|
+
emit("copy", payload);
|
|
3869
3954
|
}
|
|
3870
3955
|
function handleArtifactClick(payload) {
|
|
3871
3956
|
emit("handleArtifactClick", payload);
|
|
@@ -4064,7 +4149,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
4064
4149
|
function handleClick(event) {
|
|
4065
4150
|
emit("click", event);
|
|
4066
4151
|
}
|
|
4067
|
-
return { __sfc: true, props, emit, handleCopy, handleArtifactClick, nodeComponents, customComponentsMap, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, nonCodeBindings, linkBindings, listBindings, effectiveCustomHtmlTagsSet, renderedItems, getCodeBlockLanguage, getCustomCodeLanguageComponent, getNodeComponent, isCustomCodeBlockComponent, isCustomLanguageCodeBlockComponent, getBindingsFor, handleClick };
|
|
4152
|
+
return { __sfc: true, props, emit, isNativeDomEvent, handleCopy, handleArtifactClick, nodeComponents, customComponentsMap, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, nonCodeBindings, linkBindings, listBindings, effectiveCustomHtmlTagsSet, renderedItems, getCodeBlockLanguage, getCustomCodeLanguageComponent, getNodeComponent, isCustomCodeBlockComponent, isCustomLanguageCodeBlockComponent, getBindingsFor, handleClick };
|
|
4068
4153
|
}
|
|
4069
4154
|
});
|
|
4070
4155
|
var _sfc_render$f = function render31() {
|
|
@@ -4252,10 +4337,23 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
4252
4337
|
maxLiveNodes: { default: 320 },
|
|
4253
4338
|
liveNodeBuffer: { default: 60 }
|
|
4254
4339
|
},
|
|
4255
|
-
emits: ["copy", "handleArtifactClick", "click", "mouseover", "mouseout"],
|
|
4340
|
+
emits: ["copy", "copy-code", "handleArtifactClick", "click", "mouseover", "mouseout"],
|
|
4256
4341
|
setup(__props, { emit }) {
|
|
4257
4342
|
var _a2, _b, _c;
|
|
4258
4343
|
const props = __props;
|
|
4344
|
+
function isNativeDomEvent(value) {
|
|
4345
|
+
return typeof Event !== "undefined" && value instanceof Event;
|
|
4346
|
+
}
|
|
4347
|
+
function emitCodeCopy(payload) {
|
|
4348
|
+
if (isNativeDomEvent(payload))
|
|
4349
|
+
return;
|
|
4350
|
+
if (typeof payload === "string") {
|
|
4351
|
+
emit("copy-code", payload);
|
|
4352
|
+
emit("copy", payload);
|
|
4353
|
+
return;
|
|
4354
|
+
}
|
|
4355
|
+
emit("copy", payload);
|
|
4356
|
+
}
|
|
4259
4357
|
const MAX_DEFERRED_NODE_COUNT = 900;
|
|
4260
4358
|
const MAX_VIEWPORT_OBSERVER_TARGETS = 640;
|
|
4261
4359
|
const VIEWPORT_PRIORITY_RECOVERY_COUNT = 200;
|
|
@@ -6184,35 +6282,35 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
6184
6282
|
}),
|
|
6185
6283
|
{ flush: "post" }
|
|
6186
6284
|
);
|
|
6187
|
-
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, smoothStream, resolvedShowTooltips, inheritedHtmlPolicy, inheritedSmoothStreaming, resolvedHtmlPolicy, smoothStreamingEligible, hasMountedForSmoothStreaming, smoothStreamingEnabled, renderContent, rawContent, smoothSourceSynced, requestedFinal, effectiveFinal, renderVersionSource, logPerf, resolveViewportRoot, instanceMsgId, defaultMd, customTagCache, EMPTY_PARSED_NODES, customComponentsMap, effectiveCustomHtmlTags, mdBase, mdInstance, 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, MermaidBlockNodeLoading, mermaidBlockNodeComponent, mermaidBlockNodeImport, loadMermaidBlockNode, resolveMermaidBlockNodeComponent, InfographicBlockNodeLoading, infographicBlockNodeComponent, infographicBlockNodeImport, loadInfographicBlockNode, resolveInfographicBlockNodeComponent, D2BlockNodeAsync, codeBlockComponent, nodeComponents, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, mermaidBindings, d2Bindings, infographicBindings, nonCodeBindings, linkBindings, listBindings, legacyRenderedItems, legacyStructuredContentMode, renderedItems, getCodeBlockRenderNode, getCodeBlockLanguage, getCustomCodeLanguageComponent, isLegacyStructuredNode, getRenderKey, getMermaidBindingsFor, getInfographicBindingsFor, getNodeComponent, isCustomCodeBlockComponent, isCustomLanguageCodeBlockComponent, getBindingsFor, handleContainerClick, handleContainerMouseover, handleContainerMouseout, hasExplicitNodes, typewriterCursorRef, showTypewriterCursor, typewriterCursorTimeout, lastTypewriterContentLength, TYPEWRITER_CURSOR_EXCLUDED_NODE_TYPES, shouldSkipTypewriterCursorForNode, shouldShowTypewriterCursorForCurrentNodes, getNodeTextLength, getTypewriterContentLength, clearTypewriterCursorTimeout, getLastTextNode, updateTypewriterCursorPosition, LegacyNodesRenderer };
|
|
6285
|
+
return { __sfc: true, props, emit, isNativeDomEvent, emitCodeCopy, MAX_DEFERRED_NODE_COUNT, MAX_VIEWPORT_OBSERVER_TARGETS, VIEWPORT_PRIORITY_RECOVERY_COUNT, containerRef, viewportPriorityAutoDisabled, SCROLL_PARENT_OVERFLOW_RE, isClient, instance, debugPerformanceEnabled, attrs, textStreamState, streamRenderVersion, smoothStream, resolvedShowTooltips, inheritedHtmlPolicy, inheritedSmoothStreaming, resolvedHtmlPolicy, smoothStreamingEligible, hasMountedForSmoothStreaming, smoothStreamingEnabled, renderContent, rawContent, smoothSourceSynced, requestedFinal, effectiveFinal, renderVersionSource, logPerf, resolveViewportRoot, instanceMsgId, defaultMd, customTagCache, EMPTY_PARSED_NODES, customComponentsMap, effectiveCustomHtmlTags, mdBase, mdInstance, 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, MermaidBlockNodeLoading, mermaidBlockNodeComponent, mermaidBlockNodeImport, loadMermaidBlockNode, resolveMermaidBlockNodeComponent, InfographicBlockNodeLoading, infographicBlockNodeComponent, infographicBlockNodeImport, loadInfographicBlockNode, resolveInfographicBlockNodeComponent, D2BlockNodeAsync, codeBlockComponent, nodeComponents, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, mermaidBindings, d2Bindings, infographicBindings, nonCodeBindings, linkBindings, listBindings, legacyRenderedItems, legacyStructuredContentMode, renderedItems, getCodeBlockRenderNode, getCodeBlockLanguage, getCustomCodeLanguageComponent, isLegacyStructuredNode, getRenderKey, getMermaidBindingsFor, getInfographicBindingsFor, getNodeComponent, isCustomCodeBlockComponent, isCustomLanguageCodeBlockComponent, getBindingsFor, handleContainerClick, handleContainerMouseover, handleContainerMouseout, hasExplicitNodes, typewriterCursorRef, showTypewriterCursor, typewriterCursorTimeout, lastTypewriterContentLength, TYPEWRITER_CURSOR_EXCLUDED_NODE_TYPES, shouldSkipTypewriterCursorForNode, shouldShowTypewriterCursorForCurrentNodes, getNodeTextLength, getTypewriterContentLength, clearTypewriterCursorTimeout, getLastTextNode, updateTypewriterCursorPosition, LegacyNodesRenderer };
|
|
6188
6286
|
}
|
|
6189
6287
|
});
|
|
6190
|
-
const
|
|
6288
|
+
const NodeRenderer_vue_vue_type_style_index_0_scoped_1dc14ae3_lang = "";
|
|
6191
6289
|
const NodeRenderer_vue_vue_type_style_index_1_lang = "";
|
|
6192
6290
|
var _sfc_render$d = function render33() {
|
|
6193
6291
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
6194
6292
|
return _c("div", { ref: "containerRef", staticClass: "markstream-vue2 markdown-renderer", class: [{ dark: _setup.props.isDark }, { virtualized: _setup.virtualizationEnabled }], attrs: { "data-custom-id": _setup.props.customId }, on: { "click": _setup.handleContainerClick, "mouseover": _setup.handleContainerMouseover, "mouseout": _setup.handleContainerMouseout } }, [_setup.legacyNodesMode ? _vm._l(_setup.legacyRenderedItems, function(item) {
|
|
6195
6293
|
return _c("div", { key: item.renderKey, staticClass: "node-slot", attrs: { "data-node-index": item.index, "data-node-type": item.node.type } }, [_c("div", { staticClass: "node-content" }, [!item.isCodeBlock && _setup.props.fade !== false ? _c("transition", { attrs: { "name": "fade", "appear": "" } }, [_c(item.component, _vm._b({ tag: "component", attrs: { "node": item.node, "loading": item.node.loading, "index-key": item.indexKey, "custom-id": _setup.props.customId, "is-dark": _setup.props.isDark }, on: { "copy": function($event) {
|
|
6196
|
-
return _setup.
|
|
6294
|
+
return _setup.emitCodeCopy($event);
|
|
6197
6295
|
}, "handle-artifact-click": function($event) {
|
|
6198
6296
|
return _setup.emit("handleArtifactClick", $event);
|
|
6199
6297
|
} } }, "component", item.bindings, false))], 1) : _c(item.component, _vm._b({ tag: "component", attrs: { "node": item.node, "loading": item.node.loading, "index-key": item.indexKey, "custom-id": _setup.props.customId, "is-dark": _setup.props.isDark }, on: { "copy": function($event) {
|
|
6200
|
-
return _setup.
|
|
6298
|
+
return _setup.emitCodeCopy($event);
|
|
6201
6299
|
}, "handle-artifact-click": function($event) {
|
|
6202
6300
|
return _setup.emit("handleArtifactClick", $event);
|
|
6203
6301
|
} } }, "component", item.bindings, false))], 1)]);
|
|
6204
6302
|
}) : _setup.legacyStructuredContentMode ? _c(_setup.LegacyNodesRenderer, { attrs: { "nodes": _setup.parsedNodes, "custom-id": _setup.props.customId, "index-key": _setup.props.indexKey, "typewriter": _setup.props.typewriter, "fade": _setup.props.fade, "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, "langs": _setup.props.langs, "is-dark": _setup.props.isDark, "custom-html-tags": _setup.mergedParseOptions.customHtmlTags, "html-policy": _setup.resolvedHtmlPolicy }, on: { "copy": function($event) {
|
|
6205
|
-
return _setup.
|
|
6303
|
+
return _setup.emitCodeCopy($event);
|
|
6206
6304
|
}, "handle-artifact-click": function($event) {
|
|
6207
6305
|
return _setup.emit("handleArtifactClick", $event);
|
|
6208
6306
|
} } }) : [_setup.virtualizationEnabled ? _c("div", { staticClass: "node-spacer", style: { height: `${_setup.topSpacerHeight}px` }, attrs: { "aria-hidden": "true" } }) : _vm._e(), _vm._l(_setup.renderedItems, function(item) {
|
|
6209
6307
|
var _a2;
|
|
6210
6308
|
return _c("div", { key: item.renderKey, ref: `node-slot-${item.index}`, refInFor: true, staticClass: "node-slot", attrs: { "data-node-index": item.index, "data-node-type": item.node.type } }, [_setup.shouldRenderNode(item.index) ? _c("div", { ref: `node-content-${item.index}`, refInFor: true, staticClass: "node-content" }, [!item.isCodeBlock && _setup.props.fade !== false ? _c("transition", { attrs: { "name": "fade", "appear": "" } }, [_c(item.component, _vm._b({ tag: "component", attrs: { "node": item.node, "loading": item.node.loading, "index-key": item.indexKey, "custom-id": _setup.props.customId, "is-dark": _setup.props.isDark }, on: { "copy": function($event) {
|
|
6211
|
-
return _setup.
|
|
6309
|
+
return _setup.emitCodeCopy($event);
|
|
6212
6310
|
}, "handle-artifact-click": function($event) {
|
|
6213
6311
|
return _setup.emit("handleArtifactClick", $event);
|
|
6214
6312
|
} } }, "component", item.bindings, false))], 1) : _c(item.component, _vm._b({ tag: "component", attrs: { "node": item.node, "loading": item.node.loading, "index-key": item.indexKey, "custom-id": _setup.props.customId, "is-dark": _setup.props.isDark }, on: { "copy": function($event) {
|
|
6215
|
-
return _setup.
|
|
6313
|
+
return _setup.emitCodeCopy($event);
|
|
6216
6314
|
}, "handle-artifact-click": function($event) {
|
|
6217
6315
|
return _setup.emit("handleArtifactClick", $event);
|
|
6218
6316
|
} } }, "component", item.bindings, false))], 1) : _c("div", { staticClass: "node-placeholder", style: { height: `${(_a2 = _setup.nodeHeights[item.index]) != null ? _a2 : _setup.averageNodeHeight}px` } })]);
|
|
@@ -6225,7 +6323,7 @@ var __component__$d = /* @__PURE__ */ normalizeComponent(
|
|
|
6225
6323
|
_sfc_staticRenderFns$d,
|
|
6226
6324
|
false,
|
|
6227
6325
|
null,
|
|
6228
|
-
"
|
|
6326
|
+
"1dc14ae3",
|
|
6229
6327
|
null,
|
|
6230
6328
|
null
|
|
6231
6329
|
);
|
|
@@ -10635,8 +10733,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
10635
10733
|
if (isUnmounted)
|
|
10636
10734
|
return;
|
|
10637
10735
|
if (!props.node.content) {
|
|
10638
|
-
|
|
10639
|
-
|
|
10736
|
+
renderedHtml.value = "";
|
|
10737
|
+
fallbackText.value = props.node.loading ? "" : props.node.raw;
|
|
10738
|
+
renderingLoading.value = !!props.node.loading;
|
|
10739
|
+
hasRenderedOnce = !props.node.loading;
|
|
10640
10740
|
return;
|
|
10641
10741
|
}
|
|
10642
10742
|
const cached = getCachedMathRender(cacheKey.value);
|
|
@@ -10711,7 +10811,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
10711
10811
|
return { __sfc: true, props, containerEl, registerVisibility, visibilityHandle, currentRenderId, isUnmounted, currentAbortController, displayMode, mathContent, cacheKey, initialCached, renderedHtml, fallbackText, renderingLoading, hasRenderedOnce, renderWithMainThreadFallback, applySuccessfulRender, applyRawFallback, renderMath };
|
|
10712
10812
|
}
|
|
10713
10813
|
});
|
|
10714
|
-
const
|
|
10814
|
+
const MathInlineNode_vue_vue_type_style_index_0_scoped_6e33b527_lang = "";
|
|
10715
10815
|
var _sfc_render$3 = function render42() {
|
|
10716
10816
|
var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
|
|
10717
10817
|
return _c("span", { ref: "containerEl", staticClass: "math-inline-wrapper" }, [_setup.renderedHtml ? _c("span", { staticClass: "math-inline", domProps: { "innerHTML": _vm._s(_setup.renderedHtml) } }) : _setup.fallbackText ? _c("span", { staticClass: "math-inline math-inline--fallback" }, [_vm._v(_vm._s(_setup.fallbackText))]) : _vm._e(), _setup.renderingLoading && !_setup.renderedHtml && !_setup.fallbackText ? _c("span", { staticClass: "math-inline__loading", attrs: { "role": "status", "aria-live": "polite" } }, [_vm._t("loading", function() {
|
|
@@ -10725,7 +10825,7 @@ var __component__$3 = /* @__PURE__ */ normalizeComponent(
|
|
|
10725
10825
|
_sfc_staticRenderFns$3,
|
|
10726
10826
|
false,
|
|
10727
10827
|
null,
|
|
10728
|
-
"
|
|
10828
|
+
"6e33b527",
|
|
10729
10829
|
null,
|
|
10730
10830
|
null
|
|
10731
10831
|
);
|