markstream-vue2 2.0.0 → 2.0.2

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.js CHANGED
@@ -6159,7 +6159,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6159
6159
  const nodeVisibilityHandles = /* @__PURE__ */ new Map();
6160
6160
  const nodeVisibilityFallbackTimers = /* @__PURE__ */ new Map();
6161
6161
  const nodeSlotElements = /* @__PURE__ */ new Map();
6162
- const codeBlockRenderCache = /* @__PURE__ */ new WeakMap();
6162
+ const codeBlockRenderCache = [];
6163
+ watch(
6164
+ () => parsedNodes.value.length,
6165
+ (length) => {
6166
+ if (codeBlockRenderCache.length > length)
6167
+ codeBlockRenderCache.length = length;
6168
+ }
6169
+ );
6163
6170
  const nodeSlotVersion = ref(0);
6164
6171
  const sortedNodeSlots = computed(() => {
6165
6172
  void nodeSlotVersion.value;
@@ -7422,8 +7429,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7422
7429
  const linkBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltip: props.showTooltips } : {}));
7423
7430
  const listBindings = computed(() => __spreadValues(__spreadValues({}, nonCodeBindings.value), typeof props.showTooltips === "boolean" ? { showTooltips: props.showTooltips } : {}));
7424
7431
  const legacyRenderedItems = computed(() => {
7425
- return legacyNodeItems.value.map((node, index2) => {
7432
+ return legacyNodeItems.value.map((item, index2) => {
7426
7433
  var _a3, _b2, _c2, _d;
7434
+ const node = getCodeBlockRenderNode(item, index2);
7427
7435
  const language = getCodeBlockLanguage(node);
7428
7436
  let resolvedNode = node;
7429
7437
  let component = getNodeComponent(node, language);
@@ -7480,7 +7488,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7480
7488
  const renderedItems = computed(() => {
7481
7489
  return visibleNodes.value.map((item) => {
7482
7490
  var _a3, _b2, _c2, _d;
7483
- let node = getCodeBlockRenderNode(item.node);
7491
+ let node = getCodeBlockRenderNode(item.node, item.index);
7484
7492
  const language = getCodeBlockLanguage(node);
7485
7493
  let component = getNodeComponent(node, language);
7486
7494
  if ((node.type === "html_block" || node.type === "html_inline") && component === nodeComponents[node.type]) {
@@ -7527,25 +7535,31 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7527
7535
  });
7528
7536
  });
7529
7537
  });
7530
- function getCodeBlockRenderNode(node) {
7531
- var _a3, _b2, _c2, _d, _e, _f, _g;
7532
- if (node.type !== "code_block")
7538
+ function getCodeBlockRenderNode(node, index2) {
7539
+ var _a3, _b2;
7540
+ if (node.type !== "code_block") {
7541
+ codeBlockRenderCache[index2] = void 0;
7533
7542
  return node;
7543
+ }
7534
7544
  const codeBlockNode = node;
7535
7545
  const signature = [
7536
- String((_a3 = codeBlockNode.language) != null ? _a3 : ""),
7537
- String((_b2 = codeBlockNode.loading) != null ? _b2 : ""),
7538
- String((_c2 = codeBlockNode.diff) != null ? _c2 : ""),
7539
- String((_d = codeBlockNode.code) != null ? _d : ""),
7540
- String((_e = codeBlockNode.originalCode) != null ? _e : ""),
7541
- String((_f = codeBlockNode.updatedCode) != null ? _f : ""),
7542
- String((_g = codeBlockNode.raw) != null ? _g : "")
7543
- ].join("\0");
7544
- const cached = codeBlockRenderCache.get(codeBlockNode);
7545
- if (cached && cached.signature === signature)
7546
+ codeBlockNode.language,
7547
+ codeBlockNode.loading,
7548
+ codeBlockNode.diff,
7549
+ codeBlockNode.code,
7550
+ codeBlockNode.originalCode,
7551
+ codeBlockNode.updatedCode,
7552
+ codeBlockNode.raw,
7553
+ codeBlockNode.startLine,
7554
+ codeBlockNode.endLine,
7555
+ (_a3 = codeBlockNode.sourceMap) == null ? void 0 : _a3.startLine,
7556
+ (_b2 = codeBlockNode.sourceMap) == null ? void 0 : _b2.endLine
7557
+ ];
7558
+ const cached = codeBlockRenderCache[index2];
7559
+ if (cached && signature.every((value, signatureIndex) => value === cached.signature[signatureIndex]))
7546
7560
  return cached.node;
7547
7561
  const cloned = __spreadValues({}, codeBlockNode);
7548
- codeBlockRenderCache.set(codeBlockNode, { signature, node: cloned });
7562
+ codeBlockRenderCache[index2] = { signature, node: cloned };
7549
7563
  return cloned;
7550
7564
  }
7551
7565
  function getCodeBlockLanguage(node) {
@@ -7847,7 +7861,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7847
7861
  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, MermaidBlockNodeLoading, mermaidBlockNodeComponent, mermaidBlockNodeImport, loadMermaidBlockNode, resolveMermaidBlockNodeComponent, InfographicBlockNodeLoading, infographicBlockNodeComponent, infographicBlockNodeImport, loadInfographicBlockNode, resolveInfographicBlockNodeComponent, D2BlockNodeAsync, codeBlockComponent, nodeComponents, indexPrefix, codeBlockExtraProps, builtinCodeBlockExtraProps, codeBlockBindings, customCodeBlockBindings, countCodeLines, estimateBuiltinCodeBlockHeight, pickBoolean, preCodeBlockBindings, 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 };
7848
7862
  }
7849
7863
  });
7850
- const NodeRenderer_vue_vue_type_style_index_0_scoped_ebe176a0_lang = "";
7864
+ const NodeRenderer_vue_vue_type_style_index_0_scoped_cdb2b045_lang = "";
7851
7865
  const NodeRenderer_vue_vue_type_style_index_1_lang = "";
7852
7866
  var _sfc_render$9 = function render36() {
7853
7867
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
@@ -7885,7 +7899,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
7885
7899
  _sfc_staticRenderFns$9,
7886
7900
  false,
7887
7901
  null,
7888
- "ebe176a0",
7902
+ "cdb2b045",
7889
7903
  null,
7890
7904
  null
7891
7905
  );
@@ -8529,6 +8543,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8529
8543
  const modalContent = ref();
8530
8544
  const modalCloneWrapper = ref(null);
8531
8545
  const baseCode = computed(() => props.node.code);
8546
+ const hasPreview = ref(false);
8547
+ const hasRenderError = ref(false);
8532
8548
  const maxPreviewHeight = computed(() => {
8533
8549
  if (!props.maxHeight || props.maxHeight === "none")
8534
8550
  return null;
@@ -8756,88 +8772,176 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8756
8772
  isDragging.value = false;
8757
8773
  }
8758
8774
  let infographicInstance2 = null;
8759
- function renderInfographic() {
8775
+ let renderInFlight = false;
8776
+ let rerenderQueued = false;
8777
+ let rerenderForce = false;
8778
+ let renderScheduled = false;
8779
+ let renderScheduledForce = false;
8780
+ let lastCompletedRenderSignature = "";
8781
+ let unmounted = false;
8782
+ let renderGeneration = 0;
8783
+ function renderInfographic(force = false) {
8760
8784
  return __async(this, null, function* () {
8761
- var _a2;
8762
- if (!infographicContainer.value)
8785
+ var _a2, _b, _c, _d, _e, _f;
8786
+ if (unmounted || !infographicContainer.value)
8787
+ return;
8788
+ if (renderInFlight) {
8789
+ rerenderQueued = true;
8790
+ rerenderForce = rerenderForce || force;
8791
+ return;
8792
+ }
8793
+ const signature = baseCode.value;
8794
+ if (!force && signature === lastCompletedRenderSignature && hasPreview.value)
8763
8795
  return;
8796
+ const source = baseCode.value;
8797
+ const final = props.loading === false;
8798
+ const generation = ++renderGeneration;
8799
+ renderInFlight = true;
8800
+ let nextInfographicInstance = null;
8801
+ let previousChildren = null;
8764
8802
  try {
8765
8803
  const InfographicClass = yield getInfographic();
8766
- if (!InfographicClass) {
8767
- console.warn("Infographic library failed to load.");
8804
+ if (unmounted || generation !== renderGeneration)
8768
8805
  return;
8769
- }
8770
- if (infographicInstance2) {
8771
- (_a2 = infographicInstance2.destroy) == null ? void 0 : _a2.call(infographicInstance2);
8772
- infographicInstance2 = null;
8773
- }
8774
- infographicContainer.value.innerHTML = "";
8775
- infographicInstance2 = new InfographicClass({
8776
- container: infographicContainer.value,
8806
+ if (!InfographicClass)
8807
+ throw new Error("Infographic library failed to load.");
8808
+ const container = infographicContainer.value;
8809
+ if (!container)
8810
+ return;
8811
+ const stillStreaming = props.loading === true;
8812
+ const canRender = signature === baseCode.value || !final && stillStreaming && baseCode.value.startsWith(source);
8813
+ if (!canRender)
8814
+ return;
8815
+ previousChildren = Array.from(container.childNodes);
8816
+ nextInfographicInstance = new InfographicClass({
8817
+ container,
8777
8818
  width: "100%",
8778
8819
  height: "100%"
8779
8820
  });
8780
- infographicInstance2.render(baseCode.value);
8821
+ let renderErrorMessage = "";
8822
+ let renderCompleted = false;
8823
+ (_a2 = nextInfographicInstance.on) == null ? void 0 : _a2.call(nextInfographicInstance, "error", (error) => {
8824
+ const errors = Array.isArray(error) ? error : [error];
8825
+ renderErrorMessage = errors.map((item) => {
8826
+ var _a3;
8827
+ if (item instanceof Error)
8828
+ return item.message;
8829
+ if (typeof item === "string")
8830
+ return item;
8831
+ if (item && typeof item === "object" && "message" in item)
8832
+ return String((_a3 = item.message) != null ? _a3 : "");
8833
+ return String(item != null ? item : "");
8834
+ }).filter(Boolean).join("; ");
8835
+ });
8836
+ (_b = nextInfographicInstance.on) == null ? void 0 : _b.call(nextInfographicInstance, "rendered", () => {
8837
+ renderCompleted = true;
8838
+ });
8839
+ nextInfographicInstance.render(source);
8840
+ if (renderErrorMessage)
8841
+ throw new Error(renderErrorMessage);
8842
+ const nextChildren = Array.from(container.childNodes);
8843
+ const replacedChildren = nextChildren.length > 0 && (nextChildren.length !== previousChildren.length || nextChildren.some((child, index2) => child !== (previousChildren == null ? void 0 : previousChildren[index2])));
8844
+ if (!renderCompleted && !replacedChildren)
8845
+ throw new Error("Infographic render returned empty output.");
8846
+ (_c = infographicInstance2 == null ? void 0 : infographicInstance2.destroy) == null ? void 0 : _c.call(infographicInstance2);
8847
+ infographicInstance2 = nextInfographicInstance;
8848
+ nextInfographicInstance = null;
8849
+ hasPreview.value = true;
8850
+ hasRenderError.value = false;
8851
+ lastCompletedRenderSignature = signature;
8781
8852
  nextTick(() => {
8782
- updateContainerHeight();
8853
+ if (!unmounted && generation === renderGeneration)
8854
+ updateContainerHeight();
8783
8855
  });
8784
8856
  } catch (error) {
8785
- console.error("Failed to render infographic:", error);
8786
- if (infographicContainer.value) {
8787
- infographicContainer.value.innerHTML = `<div class="text-red-500 p-4">Failed to render infographic: ${error instanceof Error ? error.message : "Unknown error"}</div>`;
8857
+ if (unmounted || generation !== renderGeneration)
8858
+ return;
8859
+ (_d = nextInfographicInstance == null ? void 0 : nextInfographicInstance.destroy) == null ? void 0 : _d.call(nextInfographicInstance);
8860
+ nextInfographicInstance = null;
8861
+ if (final && props.loading === false && signature === baseCode.value) {
8862
+ console.error("Failed to render infographic:", error);
8863
+ (_e = infographicInstance2 == null ? void 0 : infographicInstance2.destroy) == null ? void 0 : _e.call(infographicInstance2);
8864
+ infographicInstance2 = null;
8865
+ hasPreview.value = false;
8866
+ hasRenderError.value = true;
8867
+ lastCompletedRenderSignature = "";
8868
+ if (infographicContainer.value) {
8869
+ infographicContainer.value.innerHTML = `<div class="text-red-500 p-4">Failed to render infographic: ${error instanceof Error ? error.message : "Unknown error"}</div>`;
8870
+ }
8871
+ } else if (previousChildren && infographicContainer.value) {
8872
+ infographicContainer.value.replaceChildren(...previousChildren);
8873
+ }
8874
+ } finally {
8875
+ (_f = nextInfographicInstance == null ? void 0 : nextInfographicInstance.destroy) == null ? void 0 : _f.call(nextInfographicInstance);
8876
+ renderInFlight = false;
8877
+ if (!unmounted && generation === renderGeneration && rerenderQueued) {
8878
+ const forceNext = rerenderForce;
8879
+ rerenderQueued = false;
8880
+ rerenderForce = false;
8881
+ queueInfographicRender(forceNext);
8788
8882
  }
8789
8883
  }
8790
8884
  });
8791
8885
  }
8886
+ function queueInfographicRender(force = false) {
8887
+ if (unmounted || showSource.value || isCollapsed.value)
8888
+ return;
8889
+ renderScheduledForce = renderScheduledForce || force;
8890
+ if (renderScheduled)
8891
+ return;
8892
+ renderScheduled = true;
8893
+ nextTick(() => {
8894
+ renderScheduled = false;
8895
+ const forceNext = renderScheduledForce;
8896
+ renderScheduledForce = false;
8897
+ if (!unmounted)
8898
+ void renderInfographic(forceNext);
8899
+ });
8900
+ }
8792
8901
  watch(
8793
8902
  () => baseCode.value,
8794
8903
  () => {
8795
- if (!showSource.value && !isCollapsed.value) {
8796
- nextTick(() => {
8797
- renderInfographic();
8798
- });
8799
- }
8904
+ queueInfographicRender(true);
8905
+ }
8906
+ );
8907
+ watch(
8908
+ () => props.loading,
8909
+ (loading, prev) => {
8910
+ if (prev && !loading)
8911
+ queueInfographicRender(true);
8800
8912
  }
8801
8913
  );
8802
8914
  watch(
8803
8915
  () => showSource.value,
8804
8916
  (isSource) => {
8805
- if (!isSource && !isCollapsed.value) {
8806
- nextTick(() => {
8807
- renderInfographic();
8808
- });
8809
- }
8917
+ if (!isSource)
8918
+ queueInfographicRender(true);
8810
8919
  }
8811
8920
  );
8812
8921
  watch(
8813
8922
  () => isCollapsed.value,
8814
8923
  (collapsed) => {
8815
- if (!collapsed && !showSource.value) {
8816
- nextTick(() => {
8817
- renderInfographic();
8818
- });
8819
- }
8924
+ if (!collapsed)
8925
+ queueInfographicRender();
8820
8926
  }
8821
8927
  );
8822
8928
  watch(
8823
8929
  () => props.maxHeight,
8824
8930
  () => {
8825
- if (!showSource.value && !isCollapsed.value) {
8826
- nextTick(() => {
8827
- renderInfographic();
8828
- });
8829
- }
8931
+ nextTick(updateContainerHeight);
8830
8932
  }
8831
8933
  );
8832
8934
  onMounted(() => {
8833
- if (!showSource.value && !isCollapsed.value) {
8834
- nextTick(() => {
8835
- renderInfographic();
8836
- });
8837
- }
8935
+ queueInfographicRender();
8838
8936
  });
8839
8937
  onBeforeUnmount(() => {
8840
8938
  var _a2;
8939
+ unmounted = true;
8940
+ renderGeneration += 1;
8941
+ rerenderQueued = false;
8942
+ rerenderForce = false;
8943
+ renderScheduled = false;
8944
+ renderScheduledForce = false;
8841
8945
  if (infographicInstance2) {
8842
8946
  (_a2 = infographicInstance2.destroy) == null ? void 0 : _a2.call(infographicInstance2);
8843
8947
  infographicInstance2 = null;
@@ -8864,17 +8968,17 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8864
8968
  }
8865
8969
  }
8866
8970
  );
8867
- return { __sfc: true, props, _emits, t, copyText, isCollapsed, infographicContainer, showSource, isModalOpen, modalContent, modalCloneWrapper, baseCode, maxPreviewHeight, estimatedPreviewHeight, containerHeight, resolveContainerHeight, updateContainerHeight, zoom, translateX, translateY, isDragging, dragStart, 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 };
8971
+ return { __sfc: true, props, _emits, t, copyText, isCollapsed, infographicContainer, showSource, isModalOpen, modalContent, modalCloneWrapper, baseCode, hasPreview, hasRenderError, maxPreviewHeight, estimatedPreviewHeight, containerHeight, resolveContainerHeight, updateContainerHeight, zoom, translateX, translateY, isDragging, dragStart, shouldSkipEventTarget, onBtnHover, onBtnLeave, onCopyHover, copy, handleSwitchMode, handleExportClick, exportSvg, handleKeydown, openModal, closeModal, handleOpenModalClick, zoomIn, zoomOut, resetZoom, startDrag, onDrag, stopDrag, infographicInstance: infographicInstance2, renderInFlight, rerenderQueued, rerenderForce, renderScheduled, renderScheduledForce, lastCompletedRenderSignature, unmounted, renderGeneration, renderInfographic, queueInfographicRender, computedButtonStyle, isFullscreenDisabled, transformStyle, infographicIconUrl, Portal };
8868
8972
  }
8869
8973
  });
8870
- const InfographicBlockNode_vue_vue_type_style_index_0_scoped_4fbaa9a8_lang = "";
8974
+ const InfographicBlockNode_vue_vue_type_style_index_0_scoped_c3368b0a_lang = "";
8871
8975
  var _sfc_render$6 = function render39() {
8872
8976
  var _a2;
8873
8977
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
8874
8978
  return _c("div", { staticClass: "my-4 rounded-lg border overflow-hidden shadow-sm", class: [
8875
8979
  _setup.props.isDark ? "border-gray-700/30" : "border-gray-200",
8876
8980
  { "is-rendering": _setup.props.loading }
8877
- ], attrs: { "data-markstream-infographic": "1", "data-markstream-mode": _setup.showSource ? "source" : _setup.infographicInstance ? "preview" : "pending" } }, [_setup.props.showHeader ? _c("div", { staticClass: "infographic-block-header flex justify-between items-center px-4 py-2.5 border-b", class: _setup.props.isDark ? "bg-gray-800 border-gray-700/30" : "bg-gray-50 border-gray-200" }, [_vm.$slots["header-left"] ? _c("div", [_vm._t("header-left")], 2) : _c("div", { staticClass: "flex items-center gap-x-2 overflow-hidden" }, [_c("img", { staticClass: "w-4 h-4 my-0", attrs: { "src": _setup.infographicIconUrl, "alt": "Infographic" } }), _c("span", { staticClass: "text-sm font-medium font-mono truncate", class: _setup.props.isDark ? "text-gray-400" : "text-gray-600" }, [_vm._v("Infographic")])]), _vm.$slots["header-center"] ? _c("div", [_vm._t("header-center")], 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: "px-2.5 py-1 text-xs rounded transition-colors", class: [
8981
+ ], attrs: { "data-markstream-infographic": "1", "data-markstream-mode": _setup.showSource ? "source" : _setup.hasRenderError ? "error" : _setup.hasPreview ? "preview" : "pending" } }, [_setup.props.showHeader ? _c("div", { staticClass: "infographic-block-header flex justify-between items-center px-4 py-2.5 border-b", class: _setup.props.isDark ? "bg-gray-800 border-gray-700/30" : "bg-gray-50 border-gray-200" }, [_vm.$slots["header-left"] ? _c("div", [_vm._t("header-left")], 2) : _c("div", { staticClass: "flex items-center gap-x-2 overflow-hidden" }, [_c("img", { staticClass: "w-4 h-4 my-0", attrs: { "src": _setup.infographicIconUrl, "alt": "Infographic" } }), _c("span", { staticClass: "text-sm font-medium font-mono truncate", class: _setup.props.isDark ? "text-gray-400" : "text-gray-600" }, [_vm._v("Infographic")])]), _vm.$slots["header-center"] ? _c("div", [_vm._t("header-center")], 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: "px-2.5 py-1 text-xs rounded transition-colors", class: [
8878
8982
  !_setup.showSource ? _setup.props.isDark ? "bg-gray-600 text-gray-200 shadow-sm" : "bg-white text-gray-700 shadow-sm" : _setup.props.isDark ? "text-gray-400 hover:text-gray-200" : "text-gray-500 hover:text-gray-700"
8879
8983
  ], on: { "click": () => _setup.handleSwitchMode("preview"), "mouseenter": function($event) {
8880
8984
  _setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
@@ -8922,7 +9026,7 @@ var _sfc_render$6 = function render39() {
8922
9026
  return _setup.onDrag.apply(null, arguments);
8923
9027
  }, "&touchend": function($event) {
8924
9028
  return _setup.stopDrag.apply(null, arguments);
8925
- } } }, [_c("div", { staticClass: "absolute inset-0 cursor-grab", class: { "cursor-grabbing": _setup.isDragging }, style: _setup.transformStyle }, [_c("div", { ref: "infographicContainer", staticClass: "w-full text-center flex items-center justify-center min-h-full" })])])])]), _c(_setup.Portal, { attrs: { "to": "body" } }, [_c("div", { staticClass: "markstream-vue" }, [_c("transition", { attrs: { "name": "infographic-dialog", "appear": "" } }, [_setup.isModalOpen ? _c("div", { staticClass: "fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4", on: { "click": function($event) {
9029
+ } } }, [!_setup.hasPreview && !_setup.hasRenderError ? _c("pre", { staticClass: "absolute inset-0 overflow-auto p-4 text-left text-sm font-mono whitespace-pre-wrap" }, [_vm._v(_vm._s(_setup.baseCode))]) : _vm._e(), _c("div", { staticClass: "absolute inset-0 cursor-grab", class: { "cursor-grabbing": _setup.isDragging }, style: _setup.transformStyle }, [_c("div", { ref: "infographicContainer", staticClass: "w-full text-center flex items-center justify-center min-h-full" })])])])]), _c(_setup.Portal, { attrs: { "to": "body" } }, [_c("div", { staticClass: "markstream-vue" }, [_c("transition", { attrs: { "name": "infographic-dialog", "appear": "" } }, [_setup.isModalOpen ? _c("div", { staticClass: "fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4", on: { "click": function($event) {
8926
9030
  if ($event.target !== $event.currentTarget)
8927
9031
  return null;
8928
9032
  return _setup.closeModal.apply(null, arguments);
@@ -8941,7 +9045,7 @@ var __component__$6 = /* @__PURE__ */ normalizeComponent(
8941
9045
  _sfc_staticRenderFns$6,
8942
9046
  false,
8943
9047
  null,
8944
- "4fbaa9a8",
9048
+ "c3368b0a",
8945
9049
  null,
8946
9050
  null
8947
9051
  );