markstream-vue2 0.0.46-beta.1 → 0.0.46

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
@@ -2968,29 +2968,149 @@ const ParagraphNode = __component__$l.exports;
2968
2968
  const _sfc_main$k = /* @__PURE__ */ defineComponent({
2969
2969
  __name: "PreCodeNode",
2970
2970
  props: {
2971
- node: null
2971
+ node: null,
2972
+ showLineNumbers: { type: Boolean },
2973
+ diffInline: { type: Boolean }
2972
2974
  },
2973
2975
  setup(__props) {
2974
2976
  const props = __props;
2975
2977
  const normalizedLanguage = computed(() => {
2976
2978
  var _a2, _b, _c;
2977
2979
  const raw = String((_b = (_a2 = props.node) == null ? void 0 : _a2.language) != null ? _b : "");
2978
- const head = String((_c = String(raw).split(/\s+/g)[0]) != null ? _c : "").toLowerCase();
2980
+ const head = String((_c = String(raw).split(/\s+/g)[0]) != null ? _c : "").split(":")[0].toLowerCase();
2979
2981
  const safe = head.replace(/[^\w-]/g, "");
2980
2982
  return safe || "plaintext";
2981
2983
  });
2982
2984
  const languageClass = computed(() => `language-${normalizedLanguage.value}`);
2985
+ const isDiffPreview = computed(() => {
2986
+ var _a2;
2987
+ return props.showLineNumbers === true && ((_a2 = props.node) == null ? void 0 : _a2.diff) === true;
2988
+ });
2989
+ const isInlineDiffPreview = computed(() => isDiffPreview.value && props.diffInline === true);
2990
+ const displayCode = computed(() => {
2991
+ var _a2, _b, _c, _d, _e, _f;
2992
+ if (((_a2 = props.node) == null ? void 0 : _a2.diff) === true)
2993
+ return String((_c = (_b = props.node) == null ? void 0 : _b.code) != null ? _c : "");
2994
+ const value = String((_e = (_d = props.node) == null ? void 0 : _d.code) != null ? _e : "");
2995
+ return ((_f = props.node) == null ? void 0 : _f.loading) === true ? value : value.replace(/\r\n$|\n$|\r$/, "");
2996
+ });
2983
2997
  const ariaLabel = computed(() => {
2984
2998
  const lang = normalizedLanguage.value;
2985
2999
  return lang ? `Code block: ${lang}` : "Code block";
2986
3000
  });
2987
- return { __sfc: true, props, normalizedLanguage, languageClass, ariaLabel };
3001
+ function splitLines(source) {
3002
+ return String(source != null ? source : "").split(/\r\n|\n|\r/);
3003
+ }
3004
+ function isRemovedDiffLine(line) {
3005
+ return line.startsWith("-") && !line.startsWith("---");
3006
+ }
3007
+ function isAddedDiffLine(line) {
3008
+ return line.startsWith("+") && !line.startsWith("+++");
3009
+ }
3010
+ function toDiffLine(code, kind, key, number) {
3011
+ const empty = String(code != null ? code : "").trim().length === 0;
3012
+ return {
3013
+ code,
3014
+ kind: empty && kind !== "hunk" ? "context" : kind,
3015
+ key,
3016
+ number
3017
+ };
3018
+ }
3019
+ function buildDiffPanes(inline = false) {
3020
+ var _a2, _b, _c, _d, _e, _f, _g;
3021
+ const patchLines = splitLines((_a2 = props.node) == null ? void 0 : _a2.code);
3022
+ const hasPatchLines = patchLines.some((line) => isRemovedDiffLine(line) || isAddedDiffLine(line));
3023
+ if (!hasPatchLines && (((_b = props.node) == null ? void 0 : _b.originalCode) != null || ((_c = props.node) == null ? void 0 : _c.updatedCode) != null)) {
3024
+ const original2 = splitLines((_d = props.node) == null ? void 0 : _d.originalCode);
3025
+ const modified2 = splitLines((_e = props.node) == null ? void 0 : _e.updatedCode);
3026
+ if (inline) {
3027
+ const count = Math.max(original2.length, modified2.length);
3028
+ const lines = [];
3029
+ for (let index2 = 0; index2 < count; index2 += 1) {
3030
+ const before = (_f = original2[index2]) != null ? _f : "";
3031
+ const after = (_g = modified2[index2]) != null ? _g : "";
3032
+ if (before === after) {
3033
+ lines.push(toDiffLine(after, "context", `inline-context-${index2}`, index2 + 1));
3034
+ } else {
3035
+ if (index2 < original2.length)
3036
+ lines.push(toDiffLine(before, "removed", `inline-removed-${index2}`, index2 + 1));
3037
+ if (index2 < modified2.length)
3038
+ lines.push(toDiffLine(after, "added", `inline-added-${index2}`, index2 + 1));
3039
+ }
3040
+ }
3041
+ return [{ key: "inline", className: "markstream-pre__diff-pane--inline", lines }];
3042
+ }
3043
+ return [
3044
+ {
3045
+ key: "original",
3046
+ className: "markstream-pre__diff-pane--original",
3047
+ lines: original2.map((line, index2) => toDiffLine(line, modified2[index2] === line ? "context" : "removed", `original-${index2}`, index2 + 1))
3048
+ },
3049
+ {
3050
+ key: "modified",
3051
+ className: "markstream-pre__diff-pane--modified",
3052
+ lines: modified2.map((line, index2) => toDiffLine(line, original2[index2] === line ? "context" : "added", `modified-${index2}`, index2 + 1))
3053
+ }
3054
+ ];
3055
+ }
3056
+ if (inline) {
3057
+ let originalLine2 = 1;
3058
+ let modifiedLine2 = 1;
3059
+ const lines = patchLines.map((raw, index2) => {
3060
+ if (raw.startsWith("@@"))
3061
+ return toDiffLine(raw, "hunk", `inline-hunk-${index2}`, "");
3062
+ if (isRemovedDiffLine(raw))
3063
+ return toDiffLine(raw.slice(1), "removed", `inline-removed-${index2}`, originalLine2++);
3064
+ if (isAddedDiffLine(raw))
3065
+ return toDiffLine(raw.slice(1), "added", `inline-added-${index2}`, modifiedLine2++);
3066
+ const code = raw.startsWith(" ") ? raw.slice(1) : raw;
3067
+ originalLine2 += 1;
3068
+ return toDiffLine(code, "context", `inline-context-${index2}`, modifiedLine2++);
3069
+ });
3070
+ return [{ key: "inline", className: "markstream-pre__diff-pane--inline", lines }];
3071
+ }
3072
+ const original = [];
3073
+ const modified = [];
3074
+ let originalLine = 1;
3075
+ let modifiedLine = 1;
3076
+ for (const [index2, raw] of patchLines.entries()) {
3077
+ if (raw.startsWith("@@")) {
3078
+ original.push(toDiffLine(raw, "hunk", `original-hunk-${index2}`, ""));
3079
+ modified.push(toDiffLine(raw, "hunk", `modified-hunk-${index2}`, ""));
3080
+ } else if (isRemovedDiffLine(raw)) {
3081
+ original.push(toDiffLine(raw.slice(1), "removed", `original-removed-${index2}`, originalLine++));
3082
+ } else if (isAddedDiffLine(raw)) {
3083
+ modified.push(toDiffLine(raw.slice(1), "added", `modified-added-${index2}`, modifiedLine++));
3084
+ } else {
3085
+ const code = raw.startsWith(" ") ? raw.slice(1) : raw;
3086
+ original.push(toDiffLine(code, "context", `original-context-${index2}`, originalLine++));
3087
+ modified.push(toDiffLine(code, "context", `modified-context-${index2}`, modifiedLine++));
3088
+ }
3089
+ }
3090
+ return [
3091
+ { key: "original", className: "markstream-pre__diff-pane--original", lines: original },
3092
+ { key: "modified", className: "markstream-pre__diff-pane--modified", lines: modified }
3093
+ ];
3094
+ }
3095
+ const diffPreviewPanes = computed(() => isDiffPreview.value ? buildDiffPanes(isInlineDiffPreview.value) : []);
3096
+ return { __sfc: true, props, normalizedLanguage, languageClass, isDiffPreview, isInlineDiffPreview, displayCode, ariaLabel, splitLines, isRemovedDiffLine, isAddedDiffLine, toDiffLine, buildDiffPanes, diffPreviewPanes };
2988
3097
  }
2989
3098
  });
2990
3099
  const PreCodeNode_vue_vue_type_style_index_0_lang = "";
2991
3100
  var _sfc_render$k = function render26() {
2992
3101
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
2993
- return _c("pre", { class: [_setup.languageClass], attrs: { "aria-busy": _vm.node.loading === true, "aria-label": _setup.ariaLabel, "data-language": _setup.normalizedLanguage, "tabindex": "0" } }, [_c("code", { attrs: { "translate": "no" }, domProps: { "textContent": _vm._s(_vm.node.code) } })]);
3102
+ return _c("pre", { class: [
3103
+ _setup.languageClass,
3104
+ {
3105
+ "markstream-pre--line-numbers": _setup.props.showLineNumbers,
3106
+ "markstream-pre--diff-preview": _setup.isDiffPreview,
3107
+ "markstream-pre--diff-inline": _setup.isInlineDiffPreview
3108
+ }
3109
+ ], attrs: { "aria-busy": _vm.node.loading === true, "aria-label": _setup.ariaLabel, "data-language": _setup.normalizedLanguage, "data-markstream-line-numbers": _setup.props.showLineNumbers ? "1" : void 0, "data-markstream-pre": "1", "tabindex": "0" } }, [_setup.isDiffPreview ? _c("code", { staticClass: "markstream-pre__diff-code", attrs: { "translate": "no" } }, _vm._l(_setup.diffPreviewPanes, function(pane) {
3110
+ return _c("span", { key: pane.key, staticClass: "markstream-pre__diff-pane", class: pane.className }, _vm._l(pane.lines, function(line) {
3111
+ return _c("span", { key: line.key, staticClass: "markstream-pre__diff-line", class: [`markstream-pre__diff-line--${line.kind}`, { "markstream-pre__diff-line--empty": !line.code.trim() }] }, [_c("span", { staticClass: "markstream-pre__diff-rail", attrs: { "aria-hidden": "true" } }), _c("span", { staticClass: "markstream-pre__diff-number", attrs: { "aria-hidden": "true" } }, [_vm._v(_vm._s(line.number))]), _c("span", { staticClass: "markstream-pre__diff-content" }, [_c("span", { staticClass: "markstream-pre__diff-content-inner" }, [_vm._v(_vm._s(line.code))])])]);
3112
+ }), 0);
3113
+ }), 0) : _c("code", { attrs: { "translate": "no" }, domProps: { "textContent": _vm._s(_setup.displayCode) } })]);
2994
3114
  };
2995
3115
  var _sfc_staticRenderFns$k = [];
2996
3116
  var __component__$k = /* @__PURE__ */ normalizeComponent(
@@ -3288,7 +3408,7 @@ function getUseMonaco() {
3288
3408
  if (importAttempted)
3289
3409
  return null;
3290
3410
  try {
3291
- const imported = yield import("./chunks/index.legacy-1f634d9d.js").then((n) => n.i);
3411
+ const imported = yield import("stream-monaco/legacy");
3292
3412
  mod = (_a2 = imported == null ? void 0 : imported.default) != null ? _a2 : imported;
3293
3413
  yield preload(mod);
3294
3414
  const ok = yield warmupShikiTokenizer(mod);
@@ -6399,6 +6519,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6399
6519
  const isExpanded = ref(false);
6400
6520
  const isCollapsed = ref(false);
6401
6521
  const editorCreated = ref(false);
6522
+ const editorReady = ref(false);
6402
6523
  const monacoReady = ref(false);
6403
6524
  let expandRafId = null;
6404
6525
  const heightBeforeCollapse = ref(null);
@@ -6464,6 +6585,21 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6464
6585
  minimumLineCount: 4,
6465
6586
  revealLineCount: 5
6466
6587
  });
6588
+ const defaultPreFallbackFontSize = 12;
6589
+ const defaultPreFallbackLineHeight = 18;
6590
+ function readPositiveNumber(value) {
6591
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
6592
+ }
6593
+ function readMonacoPadding(value) {
6594
+ var _a3, _b2;
6595
+ if (!value || typeof value !== "object")
6596
+ return { top: 0, bottom: 0 };
6597
+ const raw = value;
6598
+ return {
6599
+ top: (_a3 = readPositiveNumber(raw.top)) != null ? _a3 : 0,
6600
+ bottom: (_b2 = readPositiveNumber(raw.bottom)) != null ? _b2 : 0
6601
+ };
6602
+ }
6467
6603
  function resolveDiffHideUnchangedRegionsOption(value) {
6468
6604
  var _a3;
6469
6605
  if (typeof value === "boolean")
@@ -6477,14 +6613,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6477
6613
  return __spreadValues({}, defaultDiffHideUnchangedRegions);
6478
6614
  }
6479
6615
  const resolvedMonacoOptions = computed(() => {
6480
- var _a3;
6616
+ var _a3, _b2;
6481
6617
  const raw = props.monacoOptions ? __spreadValues({}, props.monacoOptions) : {};
6482
6618
  if (!isDiff.value)
6483
6619
  return raw;
6484
6620
  const diffHideUnchangedRegions = raw.diffHideUnchangedRegions === void 0 ? __spreadValues({}, defaultDiffHideUnchangedRegions) : resolveDiffHideUnchangedRegionsOption(raw.diffHideUnchangedRegions);
6485
6621
  const hideUnchangedRegions = raw.hideUnchangedRegions === void 0 ? void 0 : resolveDiffHideUnchangedRegionsOption(raw.hideUnchangedRegions);
6486
6622
  const diffUnchangedRegionStyle = (_a3 = raw.diffUnchangedRegionStyle) != null ? _a3 : "line-info";
6487
- const needsExtraBottomSpace = diffUnchangedRegionStyle === "line-info" || diffUnchangedRegionStyle === "line-info-basic" || diffUnchangedRegionStyle === "metadata";
6488
6623
  const diffDefaults = {
6489
6624
  maxComputationTime: 0,
6490
6625
  diffAlgorithm: "legacy",
@@ -6496,21 +6631,20 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6496
6631
  selectionHighlight: false,
6497
6632
  occurrencesHighlight: "off",
6498
6633
  matchBrackets: "never",
6499
- lineDecorationsWidth: 12,
6634
+ lineDecorationsWidth: 4,
6500
6635
  lineNumbersMinChars: 2,
6501
6636
  glyphMargin: false,
6502
- fontSize: 13,
6503
- lineHeight: 30,
6637
+ minimap: { enabled: false },
6504
6638
  renderOverviewRuler: false,
6505
6639
  overviewRulerBorder: false,
6506
6640
  hideCursorInOverviewRuler: true,
6507
6641
  scrollBeyondLastLine: false,
6508
- padding: { top: 10, bottom: needsExtraBottomSpace ? 22 : 14 },
6509
6642
  diffHideUnchangedRegions,
6643
+ useInlineViewWhenSpaceIsLimited: (_b2 = raw.useInlineViewWhenSpaceIsLimited) != null ? _b2 : false,
6510
6644
  diffLineStyle: "background",
6511
6645
  diffAppearance: "auto",
6512
6646
  diffUnchangedRegionStyle,
6513
- diffHunkActionsOnHover: true,
6647
+ diffHunkActionsOnHover: false,
6514
6648
  diffHunkHoverHideDelayMs: 160
6515
6649
  };
6516
6650
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, diffDefaults), raw), hideUnchangedRegions === void 0 ? {} : { hideUnchangedRegions }), {
@@ -6571,7 +6705,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
6571
6705
  const codeFontMax = 36;
6572
6706
  const codeFontStep = 1;
6573
6707
  const defaultCodeFontSize = ref(
6574
- typeof ((_b = resolvedMonacoOptions.value) == null ? void 0 : _b.fontSize) === "number" ? resolvedMonacoOptions.value.fontSize : Number.NaN
6708
+ typeof ((_b = resolvedMonacoOptions.value) == null ? void 0 : _b.fontSize) === "number" ? resolvedMonacoOptions.value.fontSize : defaultPreFallbackFontSize
6575
6709
  );
6576
6710
  const codeFontSize = ref(defaultCodeFontSize.value);
6577
6711
  const fontBaselineReady = computed(() => {
@@ -7290,6 +7424,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7290
7424
  scheduleEditorVisualSync();
7291
7425
  });
7292
7426
  }
7427
+ editorReady.value = true;
7293
7428
  });
7294
7429
  }
7295
7430
  function ensureEditorCreation(el) {
@@ -7298,6 +7433,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7298
7433
  if (createEditorPromise)
7299
7434
  return createEditorPromise;
7300
7435
  editorCreated.value = true;
7436
+ editorReady.value = false;
7301
7437
  const pending2 = (() => __async(this, null, function* () {
7302
7438
  yield runEditorCreation(el);
7303
7439
  }))();
@@ -7358,12 +7494,48 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7358
7494
  return String(theme.name);
7359
7495
  return null;
7360
7496
  }
7361
- function resolveRequestedTheme() {
7497
+ function hasTheme(themes, theme) {
7498
+ const name = getThemeName(theme);
7499
+ return themes.some((item) => item === theme || name && getThemeName(item) === name);
7500
+ }
7501
+ function addRuntimeLanguage(languages, language) {
7502
+ if (typeof language !== "string")
7503
+ return;
7504
+ const canonical = normalizeLanguageIdentifier(language);
7505
+ const monacoId = resolveMonacoLanguageId(canonical);
7506
+ for (const value of [canonical, monacoId]) {
7507
+ if (value && !languages.includes(value))
7508
+ languages.push(value);
7509
+ }
7510
+ }
7511
+ const runtimeMonacoThemes = computed(() => {
7512
+ const themes = Array.isArray(props.themes) ? [...props.themes] : [];
7513
+ for (const theme of [props.darkTheme, props.lightTheme]) {
7514
+ if (theme != null && !hasTheme(themes, theme))
7515
+ themes.push(theme);
7516
+ }
7517
+ return themes.length ? themes : void 0;
7518
+ });
7519
+ const runtimeMonacoLanguages = computed(() => {
7362
7520
  var _a3;
7521
+ const languages = [];
7522
+ const configured = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.languages;
7523
+ if (Array.isArray(configured)) {
7524
+ for (const language of configured)
7525
+ addRuntimeLanguage(languages, language);
7526
+ }
7527
+ addRuntimeLanguage(languages, props.node.language);
7528
+ addRuntimeLanguage(languages, codeLanguage.value);
7529
+ addRuntimeLanguage(languages, monacoLanguage.value);
7530
+ addRuntimeLanguage(languages, "plaintext");
7531
+ return languages;
7532
+ });
7533
+ function resolveRequestedTheme() {
7534
+ var _a3, _b2;
7363
7535
  const preferred = getPreferredColorScheme();
7364
7536
  const explicit = (_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.theme;
7365
7537
  const requested = preferred != null ? preferred : explicit;
7366
- const availableThemes = Array.isArray(props.themes) ? props.themes : [];
7538
+ const availableThemes = (_b2 = runtimeMonacoThemes.value) != null ? _b2 : [];
7367
7539
  if (!availableThemes.length || requested == null)
7368
7540
  return requested;
7369
7541
  const requestedName = getThemeName(requested);
@@ -7439,18 +7611,72 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7439
7611
  const resolvedSurfaceIsDark = computed(
7440
7612
  () => isDiff.value ? effectiveDiffAppearance.value === "dark" : resolvedChromeIsDark.value
7441
7613
  );
7614
+ const preFallbackMetrics = computed(() => {
7615
+ var _a3, _b2, _c;
7616
+ const raw = resolvedMonacoOptions.value;
7617
+ const fallbackFontSize = Number.isFinite(codeFontSize.value) && codeFontSize.value > 0 ? codeFontSize.value : defaultPreFallbackFontSize;
7618
+ const resolvedFontSize = (_a3 = readPositiveNumber(raw == null ? void 0 : raw.fontSize)) != null ? _a3 : fallbackFontSize;
7619
+ const resolvedLineHeight = (_b2 = readPositiveNumber(raw == null ? void 0 : raw.lineHeight)) != null ? _b2 : resolvedFontSize === defaultPreFallbackFontSize ? defaultPreFallbackLineHeight : Math.max(12, Math.round(resolvedFontSize * 1.5));
7620
+ const fontFamily = typeof (raw == null ? void 0 : raw.fontFamily) === "string" && raw.fontFamily.trim() ? raw.fontFamily.trim() : void 0;
7621
+ const padding = readMonacoPadding(raw == null ? void 0 : raw.padding);
7622
+ const tabSize = (_c = readPositiveNumber(raw == null ? void 0 : raw.tabSize)) != null ? _c : 4;
7623
+ return {
7624
+ fontFamily,
7625
+ fontSize: resolvedFontSize,
7626
+ lineHeight: resolvedLineHeight,
7627
+ paddingBottom: padding.bottom,
7628
+ paddingTop: padding.top,
7629
+ tabSize
7630
+ };
7631
+ });
7632
+ const preFallbackDiffInline = computed(() => {
7633
+ var _a3;
7634
+ if (!isDiff.value)
7635
+ return false;
7636
+ return ((_a3 = resolvedMonacoOptions.value) == null ? void 0 : _a3.renderSideBySide) === false;
7637
+ });
7638
+ const preFallbackStyle = computed(() => {
7639
+ const metrics = preFallbackMetrics.value;
7640
+ const style = {
7641
+ "--markstream-code-padding-left": "62px",
7642
+ "--markstream-pre-diff-line-height": `${metrics.lineHeight}px`,
7643
+ "--markstream-pre-line-number-top": `${metrics.paddingTop}px`,
7644
+ "--markstream-pre-line-number-width": "36px",
7645
+ "--markstream-pre-line-number-gap": "0px",
7646
+ "fontSize": `${metrics.fontSize}px`,
7647
+ "lineHeight": `${metrics.lineHeight}px`,
7648
+ "paddingBottom": `${metrics.paddingBottom}px`,
7649
+ "paddingTop": `${metrics.paddingTop}px`,
7650
+ "tabSize": metrics.tabSize
7651
+ };
7652
+ if (metrics.fontFamily)
7653
+ style.fontFamily = metrics.fontFamily;
7654
+ return style;
7655
+ });
7442
7656
  function buildRuntimeMonacoOptions() {
7443
- return __spreadProps(__spreadValues(__spreadProps(__spreadValues({
7657
+ var _a3, _b2, _c, _d, _e;
7658
+ const nextOptions = __spreadProps(__spreadValues(__spreadProps(__spreadValues({
7444
7659
  wordWrap: "on",
7445
- wrappingIndent: "same",
7446
- themes: props.themes
7660
+ wrappingIndent: "same"
7447
7661
  }, resolvedMonacoOptions.value || {}), {
7662
+ themes: runtimeMonacoThemes.value,
7663
+ languages: runtimeMonacoLanguages.value,
7448
7664
  theme: resolveRequestedTheme()
7449
7665
  }), isDiff.value ? { diffAppearance: effectiveDiffAppearance.value } : {}), {
7450
7666
  onThemeChange() {
7451
7667
  syncEditorCssVars();
7452
7668
  }
7453
7669
  });
7670
+ if (isDiff.value) {
7671
+ const metrics = preFallbackMetrics.value;
7672
+ (_a3 = nextOptions.fontSize) != null ? _a3 : nextOptions.fontSize = metrics.fontSize;
7673
+ (_b2 = nextOptions.lineHeight) != null ? _b2 : nextOptions.lineHeight = metrics.lineHeight;
7674
+ (_c = nextOptions.padding) != null ? _c : nextOptions.padding = { top: metrics.paddingTop, bottom: metrics.paddingBottom };
7675
+ (_d = nextOptions.tabSize) != null ? _d : nextOptions.tabSize = metrics.tabSize;
7676
+ if (metrics.fontFamily)
7677
+ (_e = nextOptions.fontFamily) != null ? _e : nextOptions.fontFamily = metrics.fontFamily;
7678
+ }
7679
+ return nextOptions;
7454
7680
  }
7455
7681
  function syncRuntimeMonacoOptions() {
7456
7682
  const nextOptions = buildRuntimeMonacoOptions();
@@ -7574,13 +7800,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
7574
7800
  }
7575
7801
  cleanupEditor();
7576
7802
  });
7577
- 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 };
7803
+ return { __sfc: true, props, emits, MONACO_TOUCH_PATCH_FLAG, ensureMonacoPassiveTouchListeners, shouldForcePassiveForMonaco, withPassiveOptions, instance, hasPreviewListener, t, codeEditor, container, copyText, codeLanguage, monacoLanguage, isPlainTextLanguage, isExpanded, isCollapsed, editorCreated, editorReady, 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, defaultPreFallbackFontSize, defaultPreFallbackLineHeight, readPositiveNumber, readMonacoPadding, 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, hasTheme, addRuntimeLanguage, runtimeMonacoThemes, runtimeMonacoLanguages, resolveRequestedTheme, themeUpdate, themeLooksDark, resolvedChromeIsDark, effectiveDiffAppearance, resolvedSurfaceIsDark, preFallbackMetrics, preFallbackDiffInline, preFallbackStyle, buildRuntimeMonacoOptions, syncRuntimeMonacoOptions, monacoStructuralSignature, stopLoadingWatch, stopExpandAutoResize, PreCodeNode, HtmlPreviewFrame };
7578
7804
  }
7579
7805
  });
7580
- const CodeBlockNode_vue_vue_type_style_index_0_scoped_f73cb5ae_lang = "";
7806
+ const CodeBlockNode_vue_vue_type_style_index_0_scoped_b3974933_lang = "";
7581
7807
  var _sfc_render$9 = function render37() {
7582
7808
  var _vm = this, _c = _vm._self._c, _setup = _vm._self._setupProxy;
7583
- 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: [
7809
+ return _setup.usePreCodeRender ? _c(_setup.PreCodeNode, { staticClass: "code-pre-fallback", style: _setup.preFallbackStyle, attrs: { "node": _vm.node, "show-line-numbers": _setup.isDiff, "diff-inline": _setup.preFallbackDiffInline } }) : _c("div", { ref: "container", staticClass: "code-block-container my-4 rounded-lg border overflow-hidden shadow-sm", class: [
7584
7810
  _setup.resolvedSurfaceIsDark ? "border-gray-700/30 bg-gray-900" : "border-gray-200 bg-white",
7585
7811
  { "is-rendering": _setup.props.loading, "is-dark": _setup.resolvedSurfaceIsDark, "is-diff": _setup.isDiff, "is-plain-text": _setup.isPlainTextLanguage }
7586
7812
  ], 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() {
@@ -7623,7 +7849,7 @@ var _sfc_render$9 = function render37() {
7623
7849
  }, "focus": function($event) {
7624
7850
  _setup.onBtnHover($event, _setup.t("common.preview") || "Preview");
7625
7851
  }, "mouseleave": _setup.onBtnLeave, "blur": _setup.onBtnLeave } }, [_c("svg", { attrs: { "xmlns": "http://www.w3.org/2000/svg", "width": "12", "height": "12", "viewBox": "0 0 24 24" } }, [_c("g", { attrs: { "fill": "currentColor", "fill-rule": "evenodd", "clip-rule": "evenodd" } }, [_c("path", { attrs: { "d": "M23.628 7.41c-.12-1.172-.08-3.583-.9-4.233c-1.921-1.51-6.143-1.11-8.815-1.19c-3.481-.15-7.193.14-10.625.24a.34.34 0 0 0 0 .67c3.472-.05 7.074-.29 10.575-.09c2.471.15 6.653-.14 8.254 1.16c.4.33.41 2.732.49 3.582a42 42 0 0 1 .08 9.005a13.8 13.8 0 0 1-.45 3.001c-2.42 1.4-19.69 2.381-20.72.55a21 21 0 0 1-.65-4.632a41.5 41.5 0 0 1 .12-7.964c.08 0 7.334.33 12.586.24c2.331 0 4.682-.13 6.764-.21a.33.33 0 0 0 0-.66c-7.714-.16-12.897-.43-19.31.05c.11-1.38.48-3.922.38-4.002a.3.3 0 0 0-.42 0c-.37.41-.29 1.77-.36 2.251s-.14 1.07-.2 1.6a45 45 0 0 0-.36 8.645a21.8 21.8 0 0 0 .66 5.002c1.46 2.702 17.248 1.461 20.95.43c1.45-.4 1.69-.8 1.871-1.95c.575-3.809.602-7.68.08-11.496" } }), _c("path", { attrs: { "d": "M4.528 5.237a.84.84 0 0 0-.21-1c-.77-.41-1.71.39-1 1.1a.83.83 0 0 0 1.21-.1m2.632-.25c.14-.14.19-.84-.2-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.2-.09m2.88 0a.83.83 0 0 0-.21-1c-.77-.41-1.71.39-1 1.09a.82.82 0 0 0 1.21-.09m-4.29 8.735c0 .08.23 2.471.31 2.561a.371.371 0 0 0 .63-.14c0-.09 0 0 .15-1.72a10 10 0 0 0-.11-2.232a5.3 5.3 0 0 1-.26-1.37a.3.3 0 0 0-.54-.24a6.8 6.8 0 0 0-.2 2.33c-1.281-.38-1.121.13-1.131-.42a15 15 0 0 0-.19-1.93c-.16-.17-.36-.17-.51.14a20 20 0 0 0-.43 3.471c.04.773.18 1.536.42 2.272c.26.4.7.22.7-.1c0-.09-.16-.09 0-1.862c.06-1.18-.23-.3 1.16-.76m5.033-2.552c.32-.07.41-.28.39-.37c0-.55-3.322-.34-3.462-.24s-.2.18-.18.28s0 .11 0 .16a3.8 3.8 0 0 0 1.591.361v.82a15 15 0 0 0-.13 3.132c0 .2-.09.94.17 1.16a.34.34 0 0 0 .48 0c.125-.35.196-.718.21-1.09a8 8 0 0 0 .14-3.232c0-.13.05-.7-.1-.89a8 8 0 0 0 .89-.09m5.544-.181a.69.69 0 0 0-.89-.44a2.8 2.8 0 0 0-1.252 1.001a2.3 2.3 0 0 0-.41-.83a1 1 0 0 0-1.6.27a7 7 0 0 0-.35 2.07c0 .571 0 2.642.06 2.762c.14 1.09 1 .51.63.13a17.6 17.6 0 0 1 .38-3.962c.32-1.18.32.2.39.51s.11 1.081.73 1.081s.48-.93 1.401-1.78q.075 1.345 0 2.69a15 15 0 0 0 0 1.811a.34.34 0 0 0 .68 0q.112-.861.11-1.73a16.7 16.7 0 0 0 .12-3.582m1.441-.201c-.05.16-.3 3.002-.31 3.202a6.3 6.3 0 0 0 .21 1.741c.33 1 1.21 1.07 2.291.82a3.7 3.7 0 0 0 1.14-.23c.21-.22.10-.59-.41-.64q-.817.096-1.64.07c-.44-.07-.34 0-.67-4.442q.015-.185 0-.37a.316.316 0 0 0-.23-.38a.316.316 0 0 0-.38.23" } })])])]) : _vm._e()], 2)];
7626
- })], 2) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_setup.isCollapsed && (_vm.stream ? true : !_vm.loading), expression: "!isCollapsed && (stream ? true : !loading)" }], staticClass: "code-editor-layer" }, [_c("div", { ref: "codeEditor", staticClass: "code-editor-container", class: [_vm.stream ? "" : "code-height-placeholder"] })]), _setup.showInlinePreview && !_setup.hasPreviewListener && _setup.isPreviewable && _setup.codeLanguage === "html" ? _c(_setup.HtmlPreviewFrame, { attrs: { "code": _vm.node.code, "html-preview-allow-scripts": _setup.props.htmlPreviewAllowScripts, "html-preview-sandbox": _setup.props.htmlPreviewSandbox, "is-dark": _setup.props.isDark, "on-close": () => _setup.showInlinePreview = false } }) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_vm.stream && _vm.loading, expression: "!stream && loading" }], staticClass: "code-loading-placeholder" }, [_vm._t("loading", function() {
7852
+ })], 2) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_setup.isCollapsed && (_vm.stream ? true : !_vm.loading), expression: "!isCollapsed && (stream ? true : !loading)" }], staticClass: "code-editor-layer" }, [_c("div", { ref: "codeEditor", staticClass: "code-editor-container", class: [_vm.stream ? "" : "code-height-placeholder"], style: { visibility: _setup.editorReady ? "visible" : "hidden" }, attrs: { "aria-hidden": _setup.editorReady ? void 0 : "true" } }), !_setup.editorReady ? _c("div", { staticClass: "code-editor-fallback-surface" }, [_c(_setup.PreCodeNode, { staticClass: "code-pre-fallback", style: _setup.preFallbackStyle, attrs: { "node": _vm.node, "show-line-numbers": _setup.isDiff, "diff-inline": _setup.preFallbackDiffInline } })], 1) : _vm._e()]), _setup.showInlinePreview && !_setup.hasPreviewListener && _setup.isPreviewable && _setup.codeLanguage === "html" ? _c(_setup.HtmlPreviewFrame, { attrs: { "code": _vm.node.code, "html-preview-allow-scripts": _setup.props.htmlPreviewAllowScripts, "html-preview-sandbox": _setup.props.htmlPreviewSandbox, "is-dark": _setup.props.isDark, "on-close": () => _setup.showInlinePreview = false } }) : _vm._e(), _c("div", { directives: [{ name: "show", rawName: "v-show", value: !_vm.stream && _vm.loading, expression: "!stream && loading" }], staticClass: "code-loading-placeholder" }, [_vm._t("loading", function() {
7627
7853
  return [_c("div", { staticClass: "loading-skeleton" }, [_c("div", { staticClass: "skeleton-line" }), _c("div", { staticClass: "skeleton-line" }), _c("div", { staticClass: "skeleton-line short" })])];
7628
7854
  }, { "loading": _vm.loading, "stream": _vm.stream })], 2), _c("span", { staticClass: "sr-only", attrs: { "aria-live": "polite", "role": "status" } }, [_vm._v(_vm._s(_setup.copyText ? _setup.t("common.copied") || "Copied" : ""))])], 1);
7629
7855
  };
@@ -7634,7 +7860,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
7634
7860
  _sfc_staticRenderFns$9,
7635
7861
  false,
7636
7862
  null,
7637
- "f73cb5ae",
7863
+ "b3974933",
7638
7864
  null,
7639
7865
  null
7640
7866
  );