@deot/docs-playground 1.0.10 → 1.1.1

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
@@ -116,7 +116,7 @@ var PLAYGROUND_ICONS = {
116
116
  //#endregion
117
117
  //#region packages/playground/src/icon/icon.vue?vue&type=script&setup=true&lang.ts
118
118
  var _hoisted_1$7 = ["fill", "stroke"];
119
- var _hoisted_2$6 = ["d"];
119
+ var _hoisted_2$7 = ["d"];
120
120
  //#endregion
121
121
  //#region packages/playground/src/icon/icon.vue
122
122
  var icon_default = /* @__PURE__ */ defineComponent({
@@ -147,16 +147,16 @@ var icon_default = /* @__PURE__ */ defineComponent({
147
147
  "stroke-linecap": "round",
148
148
  "stroke-linejoin": "round",
149
149
  "aria-hidden": "true"
150
- }, [createElementVNode("path", { d: icon.value.path }, null, 8, _hoisted_2$6)], 12, _hoisted_1$7);
150
+ }, [createElementVNode("path", { d: icon.value.path }, null, 8, _hoisted_2$7)], 12, _hoisted_1$7);
151
151
  };
152
152
  }
153
153
  });
154
154
  //#endregion
155
155
  //#region packages/playground/src/core/code-preview/github.css?inline
156
- var github_default = "pre code.hljs{display:block;padding:1em;overflow-x:auto}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{font-weight:700;color:#005cc5}.hljs-bullet{color:#735c0f}.hljs-emphasis{font-style:italic;color:#24292e}.hljs-strong{font-weight:700;color:#24292e}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}[data-doc-theme=dark] .hljs,[data-vc-theme=dark] .hljs{color:#c9d1d9;background:#0d1117}[data-doc-theme=dark] .hljs-doctag,[data-doc-theme=dark] .hljs-keyword,[data-doc-theme=dark] .hljs-meta .hljs-keyword,[data-doc-theme=dark] .hljs-template-tag,[data-doc-theme=dark] .hljs-template-variable,[data-doc-theme=dark] .hljs-type,[data-doc-theme=dark] .hljs-variable.language_,[data-vc-theme=dark] .hljs-doctag,[data-vc-theme=dark] .hljs-keyword,[data-vc-theme=dark] .hljs-meta .hljs-keyword,[data-vc-theme=dark] .hljs-template-tag,[data-vc-theme=dark] .hljs-template-variable,[data-vc-theme=dark] .hljs-type,[data-vc-theme=dark] .hljs-variable.language_{color:#ff7b72}[data-doc-theme=dark] .hljs-title,[data-doc-theme=dark] .hljs-title.class_,[data-doc-theme=dark] .hljs-title.function_,[data-vc-theme=dark] .hljs-title,[data-vc-theme=dark] .hljs-title.class_,[data-vc-theme=dark] .hljs-title.function_{color:#d2a8ff}[data-doc-theme=dark] .hljs-attr,[data-doc-theme=dark] .hljs-literal,[data-doc-theme=dark] .hljs-number,[data-doc-theme=dark] .hljs-variable,[data-vc-theme=dark] .hljs-attr,[data-vc-theme=dark] .hljs-literal,[data-vc-theme=dark] .hljs-number,[data-vc-theme=dark] .hljs-variable{color:#79c0ff}[data-doc-theme=dark] .hljs-regexp,[data-doc-theme=dark] .hljs-string,[data-vc-theme=dark] .hljs-regexp,[data-vc-theme=dark] .hljs-string{color:#a5d6ff}[data-doc-theme=dark] .hljs-code,[data-doc-theme=dark] .hljs-comment,[data-vc-theme=dark] .hljs-code,[data-vc-theme=dark] .hljs-comment{color:#8b949e}[data-doc-theme=dark] .hljs-name,[data-doc-theme=dark] .hljs-selector-tag,[data-vc-theme=dark] .hljs-name,[data-vc-theme=dark] .hljs-selector-tag{color:#7ee787}";
156
+ var github_default = "pre code.hljs{display:block;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{font-weight:700;color:#005cc5}.hljs-bullet{color:#735c0f}.hljs-emphasis{font-style:italic;color:#24292e}.hljs-strong{font-weight:700;color:#24292e}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}[data-doc-theme=dark] .hljs,[data-vc-theme=dark] .hljs{color:#c9d1d9;background:#0d1117}[data-doc-theme=dark] .hljs-doctag,[data-doc-theme=dark] .hljs-keyword,[data-doc-theme=dark] .hljs-meta .hljs-keyword,[data-doc-theme=dark] .hljs-template-tag,[data-doc-theme=dark] .hljs-template-variable,[data-doc-theme=dark] .hljs-type,[data-doc-theme=dark] .hljs-variable.language_,[data-vc-theme=dark] .hljs-doctag,[data-vc-theme=dark] .hljs-keyword,[data-vc-theme=dark] .hljs-meta .hljs-keyword,[data-vc-theme=dark] .hljs-template-tag,[data-vc-theme=dark] .hljs-template-variable,[data-vc-theme=dark] .hljs-type,[data-vc-theme=dark] .hljs-variable.language_{color:#ff7b72}[data-doc-theme=dark] .hljs-title,[data-doc-theme=dark] .hljs-title.class_,[data-doc-theme=dark] .hljs-title.function_,[data-vc-theme=dark] .hljs-title,[data-vc-theme=dark] .hljs-title.class_,[data-vc-theme=dark] .hljs-title.function_{color:#d2a8ff}[data-doc-theme=dark] .hljs-attr,[data-doc-theme=dark] .hljs-literal,[data-doc-theme=dark] .hljs-number,[data-doc-theme=dark] .hljs-variable,[data-vc-theme=dark] .hljs-attr,[data-vc-theme=dark] .hljs-literal,[data-vc-theme=dark] .hljs-number,[data-vc-theme=dark] .hljs-variable{color:#79c0ff}[data-doc-theme=dark] .hljs-regexp,[data-doc-theme=dark] .hljs-string,[data-vc-theme=dark] .hljs-regexp,[data-vc-theme=dark] .hljs-string{color:#a5d6ff}[data-doc-theme=dark] .hljs-code,[data-doc-theme=dark] .hljs-comment,[data-vc-theme=dark] .hljs-code,[data-vc-theme=dark] .hljs-comment{color:#8b949e}[data-doc-theme=dark] .hljs-name,[data-doc-theme=dark] .hljs-selector-tag,[data-vc-theme=dark] .hljs-name,[data-vc-theme=dark] .hljs-selector-tag{color:#7ee787}";
157
157
  //#endregion
158
158
  //#region packages/playground/src/core/code-preview/code-preview.scss?inline
159
- var code_preview_default$1 = ".docs-code-preview{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-height:0;overflow:hidden;background:var(--docs-background-color-soft,var(--vc-background-color,#f7f8fa));border-radius:8px}.docs-code-preview__language{z-index:1;min-width:28px;padding:0 8px;font-size:12px;line-height:18px;white-space:nowrap;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition:opacity .15s ease;transition:opacity .15s ease}.docs-code-preview__copy,.docs-code-preview__language{position:absolute;top:6px;right:12px;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;height:28px;color:var(--docs-foreground-color-mute,var(--vc-color-dark-extralight,#71717a));-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.docs-code-preview__copy{z-index:2;width:28px;padding:0;pointer-events:none;cursor:pointer;background:var(--docs-background-color-soft,var(--vc-background-color,#f7f8fa));border:1px solid var(--docs-border-color,var(--vc-color-light-deeper,#d4d4d8));border-radius:8px;opacity:0;-webkit-transition:opacity .15s ease,background-color .15s ease;transition:opacity .15s ease,background-color .15s ease}.docs-code-preview__copy:hover{background:var(--docs-background-color,var(--vc-background-color-light,#fff))}.docs-code-preview__copy:focus-visible{pointer-events:auto;opacity:1}.docs-code-preview:has(.docs-code-preview__copy:focus-visible) .docs-code-preview__language,.docs-code-preview:hover .docs-code-preview__language{opacity:0}.docs-code-preview:has(.docs-code-preview__copy:focus-visible) .docs-code-preview__copy,.docs-code-preview:hover .docs-code-preview__copy{pointer-events:auto;opacity:1}.docs-code-preview__code{width:100%;min-height:0;margin:0;overflow:auto;-webkit-box-flex:1;-webkit-flex:1 1 auto;-ms-flex:1 1 auto;flex:1 1 auto}.docs-code-preview__code,.docs-code-preview__code code.hljs{background:var(--docs-background-color-soft,var(--vc-background-color,#f7f8fa))}.docs-code-preview__code code.hljs{min-height:100%;padding:12px 96px 12px 24px;-webkit-box-sizing:border-box;box-sizing:border-box}";
159
+ var code_preview_default$1 = ".docs-code-preview{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-height:0;overflow:hidden;background:var(--docs-background-color-soft,var(--vc-background-color,#f7f8fa));border-radius:8px}.docs-code-preview__language{z-index:1;min-width:28px;padding:0 8px;font-size:12px;line-height:18px;white-space:nowrap;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition:opacity .15s ease;transition:opacity .15s ease}.docs-code-preview__copy,.docs-code-preview__language{position:absolute;top:6px;right:12px;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;height:28px;color:var(--docs-foreground-color-mute,var(--vc-color-dark-extralight,#71717a));-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.docs-code-preview__copy{z-index:2;width:28px;padding:0;pointer-events:none;cursor:pointer;background:var(--docs-background-color-soft,var(--vc-background-color,#f7f8fa));border:1px solid var(--docs-border-color,var(--vc-color-light-deeper,#d4d4d8));border-radius:8px;opacity:0;-webkit-transition:opacity .15s ease,background-color .15s ease;transition:opacity .15s ease,background-color .15s ease}.docs-code-preview__copy:hover{background:var(--docs-background-color,var(--vc-background-color-light,#fff))}.docs-code-preview__copy:focus-visible{pointer-events:auto;opacity:1}.docs-code-preview:has(.docs-code-preview__copy:focus-visible) .docs-code-preview__language,.docs-code-preview:hover .docs-code-preview__language{opacity:0}.docs-code-preview:has(.docs-code-preview__copy:focus-visible) .docs-code-preview__copy,.docs-code-preview:hover .docs-code-preview__copy{pointer-events:auto;opacity:1}.docs-code-preview__scroller{width:100%;height:100%;min-width:0;min-height:0;-webkit-box-flex:1;-webkit-flex:1 1 auto;-ms-flex:1 1 auto;flex:1 1 auto}.docs-code-preview__code{width:-webkit-max-content;width:-moz-max-content;width:max-content;margin:0}.docs-code-preview__code,.docs-code-preview__code code.hljs{min-width:100%;min-height:100%;overflow:visible;background:var(--docs-background-color-soft,var(--vc-background-color,#f7f8fa))}.docs-code-preview__code code.hljs{display:block;padding:12px 96px 12px 24px;-webkit-box-sizing:border-box;box-sizing:border-box}";
160
160
  //#endregion
161
161
  //#region packages/playground/src/core/code-preview/style.ts
162
162
  var CODE_PREVIEW_STYLE_ID = "docs-code-preview-style";
@@ -174,9 +174,9 @@ var ensureCodePreviewStyle = () => {
174
174
  //#endregion
175
175
  //#region packages/playground/src/core/code-preview/code-preview.vue?vue&type=script&setup=true&lang.ts
176
176
  var _hoisted_1$6 = { class: "docs-code-preview" };
177
- var _hoisted_2$5 = ["title"];
178
- var _hoisted_3$5 = { class: "docs-code-preview__code" };
179
- var _hoisted_4$5 = ["innerHTML"];
177
+ var _hoisted_2$6 = ["title"];
178
+ var _hoisted_3$6 = { class: "docs-code-preview__code" };
179
+ var _hoisted_4$6 = ["innerHTML"];
180
180
  //#endregion
181
181
  //#region packages/playground/src/core/code-preview/code-preview.vue
182
182
  var code_preview_default = /* @__PURE__ */ defineComponent({
@@ -212,7 +212,7 @@ var code_preview_default = /* @__PURE__ */ defineComponent({
212
212
  key: 0,
213
213
  class: "docs-code-preview__language",
214
214
  title: languageLabel.value
215
- }, toDisplayString(languageLabel.value), 9, _hoisted_2$5)) : createCommentVNode("v-if", true),
215
+ }, toDisplayString(languageLabel.value), 9, _hoisted_2$6)) : createCommentVNode("v-if", true),
216
216
  createVNode(unref(Clipboard), {
217
217
  class: "docs-code-preview__copy",
218
218
  value: __props.code,
@@ -228,54 +228,32 @@ var code_preview_default = /* @__PURE__ */ defineComponent({
228
228
  "title",
229
229
  "aria-label"
230
230
  ]),
231
- createCommentVNode(" eslint-disable-next-line vue/no-v-html "),
232
- createElementVNode("pre", _hoisted_3$5, [createElementVNode("code", {
233
- class: "hljs",
234
- innerHTML: highlightedCode.value
235
- }, null, 8, _hoisted_4$5)])
231
+ createVNode(unref(Scroller), {
232
+ class: "docs-code-preview__scroller",
233
+ "auto-resize": true,
234
+ native: false,
235
+ "show-bar": true,
236
+ height: "100%"
237
+ }, {
238
+ default: withCtx(() => [createCommentVNode(" eslint-disable-next-line vue/no-v-html "), createElementVNode("pre", _hoisted_3$6, [createElementVNode("code", {
239
+ class: "hljs",
240
+ innerHTML: highlightedCode.value
241
+ }, null, 8, _hoisted_4$6)])]),
242
+ _: 1
243
+ })
236
244
  ]);
237
245
  };
238
246
  }
239
247
  });
240
248
  //#endregion
241
- //#region packages/playground/src/utils.ts
242
- /**
243
- * 比较两组 playground 文件是否完全一致。
244
- * @param left 左侧文件表。
245
- * @param right 右侧文件表。
246
- * @returns 键集合与各文件内容是否都相同。
247
- */
248
- var filesEqual = (left, right) => {
249
- const leftKeys = Object.keys(left);
250
- const rightKeys = Object.keys(right);
251
- return leftKeys.length === rightKeys.length && leftKeys.every((key) => left[key] === right[key]);
252
- };
253
- /**
254
- * 视图切换条使用的文案键。
255
- * @param view 当前预览视图。
256
- * @returns locale 消息键。
257
- */
258
- var playgroundViewMessage = (view) => view === "runtime" ? "playground.runtime.preview" : "playground.runtime.files";
259
- //#endregion
260
249
  //#region packages/playground/src/core/files-preview/files-preview.vue?vue&type=script&setup=true&lang.ts
261
250
  var _hoisted_1$5 = { class: "docs-playground-files" };
262
- var _hoisted_2$4 = { class: "docs-playground-files__toolbar" };
263
- var _hoisted_3$4 = ["data-filename", "onClick"];
264
- var _hoisted_4$4 = {
251
+ var _hoisted_2$5 = { class: "docs-playground-files__tabs-row" };
252
+ var _hoisted_3$5 = ["data-filename", "onClick"];
253
+ var _hoisted_4$5 = {
265
254
  key: 0,
266
255
  class: "docs-playground-files__entry"
267
256
  };
268
- var _hoisted_5$4 = { class: "docs-playground-files__actions" };
269
- var _hoisted_6$3 = {
270
- key: 0,
271
- class: "docs-playground__views docs-playground__views--files"
272
- };
273
- var _hoisted_7$2 = [
274
- "title",
275
- "aria-label",
276
- "aria-pressed",
277
- "onClick"
278
- ];
279
257
  //#endregion
280
258
  //#region packages/playground/src/core/files-preview/files-preview.vue
281
259
  var files_preview_default = /* @__PURE__ */ defineComponent({
@@ -287,28 +265,26 @@ var files_preview_default = /* @__PURE__ */ defineComponent({
287
265
  activeView: {},
288
266
  activeFilename: {}
289
267
  },
290
- emits: ["active-change", "view-change"],
268
+ emits: ["active-change"],
291
269
  setup(__props, { emit: __emit }) {
292
270
  const props = __props;
293
271
  const { t } = useLocale();
294
- const getViewText = (view) => t(playgroundViewMessage(view));
295
272
  const emit = __emit;
296
273
  const filenames = computed(() => Object.keys(props.files));
297
274
  const activeCode = computed(() => props.files[props.activeFilename] || "");
298
275
  const handleActive = (filename) => {
299
276
  if (filename !== props.activeFilename) emit("active-change", filename);
300
277
  };
301
- const handleView = (view) => emit("view-change", view);
302
278
  return (_ctx, _cache) => {
303
- return openBlock(), createElementBlock("div", _hoisted_1$5, [createElementVNode("div", _hoisted_2$4, [createVNode(unref(Scroller), {
279
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [createElementVNode("div", _hoisted_2$5, [createVNode(unref(Scroller), {
304
280
  class: "docs-playground-files__scroller",
305
281
  "auto-resize": true,
306
282
  native: false,
307
283
  "show-bar": true,
308
- height: "44",
284
+ height: "40",
309
285
  "content-class": "docs-playground-files__tabs",
310
- "content-style": "height: 44px; overflow: hidden;",
311
- "wrapper-style": "height: 44px; overflow-x: auto; overflow-y: hidden;"
286
+ "content-style": "height: 40px; overflow: hidden;",
287
+ "wrapper-style": "height: 40px; overflow-x: auto; overflow-y: hidden;"
312
288
  }, {
313
289
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(filenames.value, (filename) => {
314
290
  return openBlock(), createElementBlock("button", {
@@ -317,20 +293,10 @@ var files_preview_default = /* @__PURE__ */ defineComponent({
317
293
  class: normalizeClass(["docs-playground-files__tab", { "is-active": filename === __props.activeFilename }]),
318
294
  "data-filename": filename,
319
295
  onClick: ($event) => handleActive(filename)
320
- }, [createElementVNode("span", null, toDisplayString(filename), 1), filename === __props.entry ? (openBlock(), createElementBlock("small", _hoisted_4$4, toDisplayString(unref(t)("playground.files.entry")), 1)) : createCommentVNode("v-if", true)], 10, _hoisted_3$4);
296
+ }, [createElementVNode("span", null, toDisplayString(filename), 1), filename === __props.entry ? (openBlock(), createElementBlock("small", _hoisted_4$5, toDisplayString(unref(t)("playground.files.entry")), 1)) : createCommentVNode("v-if", true)], 10, _hoisted_3$5);
321
297
  }), 128))]),
322
298
  _: 1
323
- }), createElementVNode("div", _hoisted_5$4, [__props.views.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_6$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.views, (item) => {
324
- return openBlock(), createElementBlock("button", {
325
- key: item,
326
- type: "button",
327
- class: normalizeClass(["docs-playground__view", { "is-active": item === __props.activeView }]),
328
- title: getViewText(item),
329
- "aria-label": getViewText(item),
330
- "aria-pressed": item === __props.activeView,
331
- onClick: ($event) => handleView(item)
332
- }, [createVNode(unref(icon_default), { name: item }, null, 8, ["name"])], 10, _hoisted_7$2);
333
- }), 128))])) : createCommentVNode("v-if", true)])]), createVNode(unref(code_preview_default), {
299
+ })]), createVNode(unref(code_preview_default), {
334
300
  class: "docs-playground-files__body",
335
301
  code: activeCode.value,
336
302
  filename: __props.activeFilename,
@@ -462,21 +428,21 @@ var Drag = class {
462
428
  //#endregion
463
429
  //#region packages/playground/src/editor/editor.vue?vue&type=script&setup=true&lang.ts
464
430
  var _hoisted_1$4 = { class: "docs-playground-editor" };
465
- var _hoisted_2$3 = ["title"];
466
- var _hoisted_3$3 = { class: "docs-playground-editor__files" };
467
- var _hoisted_4$3 = [
431
+ var _hoisted_2$4 = ["title"];
432
+ var _hoisted_3$4 = { class: "docs-playground-editor__files" };
433
+ var _hoisted_4$4 = [
468
434
  "data-filename",
469
435
  "onClick",
470
436
  "onDblclick"
471
437
  ];
472
- var _hoisted_5$3 = ["onKeydown"];
473
- var _hoisted_6$2 = ["title"];
474
- var _hoisted_7$1 = ["title", "aria-label"];
475
- var _hoisted_8$1 = ["title", "aria-label"];
476
- var _hoisted_9 = { class: "docs-playground-editor__actions" };
477
- var _hoisted_10 = ["title"];
478
- var _hoisted_11 = ["title", "disabled"];
479
- var _hoisted_12 = {
438
+ var _hoisted_5$4 = ["onKeydown"];
439
+ var _hoisted_6$3 = ["title"];
440
+ var _hoisted_7$3 = ["title", "aria-label"];
441
+ var _hoisted_8$2 = ["title", "aria-label"];
442
+ var _hoisted_9$2 = { class: "docs-playground-editor__actions" };
443
+ var _hoisted_10$1 = ["title"];
444
+ var _hoisted_11$1 = ["title", "disabled"];
445
+ var _hoisted_12$1 = {
480
446
  key: 0,
481
447
  class: "docs-playground-editor__error"
482
448
  };
@@ -728,8 +694,8 @@ var Editor = new Portal(/* @__PURE__ */ defineComponent({
728
694
  title: unref(t)("playground.common.close"),
729
695
  style: { "cursor": "pointer" },
730
696
  onClick: handleHide
731
- }, "✕", 8, _hoisted_2$3)], 512),
732
- createElementVNode("div", _hoisted_3$3, [createVNode(unref(Scroller), {
697
+ }, "✕", 8, _hoisted_2$4)], 512),
698
+ createElementVNode("div", _hoisted_3$4, [createVNode(unref(Scroller), {
733
699
  ref_key: "scroller",
734
700
  ref: scroller,
735
701
  class: "docs-playground-editor__scroller",
@@ -757,11 +723,11 @@ var Editor = new Portal(/* @__PURE__ */ defineComponent({
757
723
  onDblclick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"])),
758
724
  onBlur: handleRenameSubmit,
759
725
  onKeydown: [withKeys(withModifiers(handleRenameSubmit, ["prevent"]), ["enter"]), withKeys(withModifiers(handleRenameCancel, ["prevent"]), ["esc"])]
760
- }, null, 40, _hoisted_5$3)), [[vModelText, filenameDraft.value]]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
726
+ }, null, 40, _hoisted_5$4)), [[vModelText, filenameDraft.value]]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
761
727
  filename === currentEntry.value ? (openBlock(), createElementBlock("span", {
762
728
  key: 0,
763
729
  title: unref(t)("playground.editor.entry")
764
- }, "●", 8, _hoisted_6$2)) : createCommentVNode("v-if", true),
730
+ }, "●", 8, _hoisted_6$3)) : createCommentVNode("v-if", true),
765
731
  createElementVNode("span", null, toDisplayString(filename), 1),
766
732
  filename === currentEntry.value ? (openBlock(), createElementBlock("button", {
767
733
  key: 1,
@@ -770,7 +736,7 @@ var Editor = new Portal(/* @__PURE__ */ defineComponent({
770
736
  title: unref(t)("playground.editor.entryCannotDelete"),
771
737
  "aria-label": unref(t)("playground.editor.entryCannotDelete"),
772
738
  disabled: ""
773
- }, null, 8, _hoisted_7$1)) : (openBlock(), createBlock(unref(Popconfirm), {
739
+ }, null, 8, _hoisted_7$3)) : (openBlock(), createBlock(unref(Popconfirm), {
774
740
  key: 2,
775
741
  class: "docs-playground-editor__delete",
776
742
  title: unref(t)("playground.editor.confirmDelete", { filename }),
@@ -783,23 +749,23 @@ var Editor = new Portal(/* @__PURE__ */ defineComponent({
783
749
  class: "docs-playground-editor__close",
784
750
  title: unref(t)("playground.editor.deleteFile"),
785
751
  "aria-label": unref(t)("playground.editor.confirmDelete", { filename })
786
- }, null, 8, _hoisted_8$1)]),
752
+ }, null, 8, _hoisted_8$2)]),
787
753
  _: 2
788
754
  }, 1032, ["title", "onOk"]))
789
- ], 64))], 42, _hoisted_4$3);
755
+ ], 64))], 42, _hoisted_4$4);
790
756
  }), 128))]),
791
757
  _: 1
792
- }, 512), createElementVNode("div", _hoisted_9, [createElementVNode("button", {
758
+ }, 512), createElementVNode("div", _hoisted_9$2, [createElementVNode("button", {
793
759
  type: "button",
794
760
  title: unref(t)("playground.editor.createFile"),
795
761
  onClick: handleCreate
796
- }, "+", 8, _hoisted_10), createElementVNode("button", {
762
+ }, "+", 8, _hoisted_10$1), createElementVNode("button", {
797
763
  type: "button",
798
764
  title: unref(t)("playground.editor.setEntry"),
799
765
  disabled: activeFilename.value === currentEntry.value,
800
766
  onClick: handleEntry
801
- }, toDisplayString(unref(t)("playground.editor.setEntry")), 9, _hoisted_11)])]),
802
- codeErrorText.value ? (openBlock(), createElementBlock("div", _hoisted_12, toDisplayString(codeErrorText.value), 1)) : createCommentVNode("v-if", true),
767
+ }, toDisplayString(unref(t)("playground.editor.setEntry")), 9, _hoisted_11$1)])]),
768
+ codeErrorText.value ? (openBlock(), createElementBlock("div", _hoisted_12$1, toDisplayString(codeErrorText.value), 1)) : createCommentVNode("v-if", true),
803
769
  createVNode(unref(Scroller), {
804
770
  ref_key: "editorScroller",
805
771
  ref: editorScroller,
@@ -823,19 +789,156 @@ var Editor = new Portal(/* @__PURE__ */ defineComponent({
823
789
  };
824
790
  }
825
791
  }), { aliveRegExp: { className: /(PORTAL_TAG_DISABLE)/ } });
792
+ //#endregion
793
+ //#region packages/playground/src/utils.ts
794
+ /**
795
+ * 比较两组 playground 文件是否完全一致。
796
+ * @param left 左侧文件表。
797
+ * @param right 右侧文件表。
798
+ * @returns 键集合与各文件内容是否都相同。
799
+ */
800
+ var filesEqual = (left, right) => {
801
+ const leftKeys = Object.keys(left);
802
+ const rightKeys = Object.keys(right);
803
+ return leftKeys.length === rightKeys.length && leftKeys.every((key) => left[key] === right[key]);
804
+ };
805
+ /**
806
+ * 视图切换条使用的文案键。
807
+ * @param view 当前预览视图。
808
+ * @returns locale 消息键。
809
+ */
810
+ var playgroundViewMessage = (view) => view === "runtime" ? "playground.runtime.preview" : "playground.runtime.files";
811
+ /**
812
+ * 与 markdown-it-anchor 默认 `slugify` 对齐,用于标题锚点 id。
813
+ * @param title 标题文本。
814
+ * @returns 可用作元素 id / hash 的字符串;空标题返回空串。
815
+ */
816
+ var slugifyPlaygroundTitle = (title) => {
817
+ const normalized = String(title).trim().toLowerCase().replace(/\s+/g, "-");
818
+ return normalized ? encodeURIComponent(normalized) : "";
819
+ };
820
+ /**
821
+ * 解析标题锚点 id:显式 id 优先,否则从标题 slugify;必要时避开已占用 id。
822
+ * @param title 标题文本。
823
+ * @param explicitId 可选显式 id。
824
+ * @param isOccupied 返回该 id 是否已被其他元素占用。
825
+ * @returns 锚点 id;无标题时为空串。
826
+ */
827
+ var resolvePlaygroundTitleId = (title, explicitId = "", isOccupied) => {
828
+ if (!String(title).trim()) return "";
829
+ const base = String(explicitId).trim() || slugifyPlaygroundTitle(title);
830
+ if (!base) return "";
831
+ if (!isOccupied || !isOccupied(base)) return base;
832
+ let index = 1;
833
+ while (isOccupied(`${base}-${index}`)) index += 1;
834
+ return `${base}-${index}`;
835
+ };
836
+ //#endregion
837
+ //#region packages/playground/src/core/preview-scroll.ts
838
+ /** iframe 包装成功后挂在 `html` 上,供样式与 auto-height 识别。 */
839
+ var PREVIEW_SCROLL_HTML_CLASS = "docs-playground-preview-scroll";
840
+ /** Scroller 内容节点 class,auto-height 优先测量该节点。 */
841
+ var PREVIEW_SCROLL_CONTENT_CLASS = "docs-playground-preview-scroll__content";
842
+ /** 重评时先清掉 html class,避免 `await import` 期间仍套用 `height:100%`。 */
843
+ var PREVIEW_SCROLL_RESET_CODE = `document.documentElement.classList.remove("${PREVIEW_SCROLL_HTML_CLASS}");`;
844
+ /** 动态探测 `@deot/vc`;失败时为空对象,不阻断 DocsLink / 预览挂载。 */
845
+ var PREVIEW_SCROLLER_IMPORT_CODE = "const __docsVc=await import(\"@deot/vc\").catch(()=>({}))";
846
+ /**
847
+ * Vue 的 `mount` 闭包的是 `createApp(root)` 时的根组件,改 `app._component` 不会生效。
848
+ * 因此劫持 `app.mount`:等全部 useCode 注册完后,再 `createApp` 包一层 Scroller。
849
+ * 前导分号避免接在 `app.component(...)` 后被 ASI 解析成调用返回值。
850
+ */
851
+ var PREVIEW_SCROLLER_USE_CODE = [
852
+ ";(()=>{",
853
+ PREVIEW_SCROLL_RESET_CODE,
854
+ "const __DocsScroller=__docsVc&&__docsVc.Scroller;",
855
+ "if(!__DocsScroller)return;",
856
+ "const UserApp=app._component;",
857
+ "app.mount=(container,...rest)=>{",
858
+ "const next=_createApp({",
859
+ "name:\"DocsPreviewRoot\",",
860
+ "setup(){return()=>__docsH(__DocsScroller,{",
861
+ "height:\"100%\",",
862
+ "native:false,",
863
+ "autoResize:true,",
864
+ "showBar:true,",
865
+ `contentClass:"${PREVIEW_SCROLL_CONTENT_CLASS}"`,
866
+ "},{default:()=>__docsH(UserApp)})}",
867
+ "});",
868
+ "next.config.errorHandler=app.config.errorHandler;",
869
+ "if(app._context&&next._context){",
870
+ "if(app._context.components)Object.assign(next._context.components,app._context.components);",
871
+ "if(app._context.directives)Object.assign(next._context.directives,app._context.directives);",
872
+ "}",
873
+ "window.__app__=next;",
874
+ `document.documentElement.classList.add("${PREVIEW_SCROLL_HTML_CLASS}");`,
875
+ "return next.mount(container,...rest)",
876
+ "}",
877
+ "})()"
878
+ ].join("");
879
+ var PREVIEW_SCROLLER_STYLE = [
880
+ `html.${PREVIEW_SCROLL_HTML_CLASS},`,
881
+ `html.${PREVIEW_SCROLL_HTML_CLASS} body,`,
882
+ `html.${PREVIEW_SCROLL_HTML_CLASS} #app{`,
883
+ "height:100%;min-height:100%;margin:0;overflow:hidden",
884
+ "}",
885
+ `html.${PREVIEW_SCROLL_HTML_CLASS} #app>.vc-scroller,`,
886
+ `html.${PREVIEW_SCROLL_HTML_CLASS} #app>.vc-scroller>.vc-scroller__wrapper{`,
887
+ "height:100%;max-height:100%;box-sizing:border-box",
888
+ "}"
889
+ ].join("");
826
890
  var resolveSandboxContainer = (sandbox) => sandbox?.container ? unref(sandbox.container) : null;
891
+ var resolveScrollContent = (iframeDocument) => {
892
+ if (!iframeDocument.documentElement.classList.contains("docs-playground-preview-scroll")) return null;
893
+ return iframeDocument.querySelector(`.${PREVIEW_SCROLL_CONTENT_CLASS}`);
894
+ };
827
895
  var useSandboxAutoHeight = (sandboxRef) => {
828
896
  const height = ref(24);
829
897
  let container = null;
830
898
  let iframe = null;
831
899
  let containerObserver = null;
832
900
  let contentObserver = null;
901
+ let scrollMountObserver = null;
902
+ let observedScrollNode = null;
833
903
  let frameId = 0;
834
904
  const cancelMeasure = () => {
835
905
  if (!frameId) return;
836
906
  cancelAnimationFrame(frameId);
837
907
  frameId = 0;
838
908
  };
909
+ const measureDocumentContent = (iframeWindow, iframeDocument) => {
910
+ const { body, documentElement } = iframeDocument;
911
+ const bodyStyle = iframeWindow.getComputedStyle(body);
912
+ const bodyMargins = (Number.parseFloat(bodyStyle.marginTop) || 0) + (Number.parseFloat(bodyStyle.marginBottom) || 0);
913
+ const rootTop = documentElement.getBoundingClientRect().top;
914
+ const bodyRect = body.getBoundingClientRect();
915
+ const collapsedTop = Math.max(0, bodyRect.top - rootTop);
916
+ let childrenBottom = 0;
917
+ for (const child of body.children) {
918
+ const rect = child.getBoundingClientRect();
919
+ const marginBottom = Number.parseFloat(iframeWindow.getComputedStyle(child).marginBottom) || 0;
920
+ childrenBottom = Math.max(childrenBottom, rect.bottom + marginBottom - rootTop);
921
+ }
922
+ const scrollHeight = Math.max(body.scrollHeight, documentElement.scrollHeight);
923
+ const overflowingHeight = scrollHeight > (iframe?.clientHeight || 0) + 1 ? scrollHeight : 0;
924
+ return Math.ceil(Math.max(body.offsetHeight + bodyMargins + collapsedTop, bodyRect.height + bodyMargins + collapsedTop, childrenBottom, overflowingHeight));
925
+ };
926
+ const measureScrollContent = (scrollContent) => {
927
+ const contentStyle = scrollContent.ownerDocument.defaultView?.getComputedStyle(scrollContent);
928
+ const margins = contentStyle ? (Number.parseFloat(contentStyle.marginTop) || 0) + (Number.parseFloat(contentStyle.marginBottom) || 0) : 0;
929
+ let childrenBottom = 0;
930
+ const rootTop = scrollContent.getBoundingClientRect().top;
931
+ for (const child of scrollContent.children) {
932
+ const rect = child.getBoundingClientRect();
933
+ const marginBottom = Number.parseFloat(scrollContent.ownerDocument.defaultView?.getComputedStyle(child).marginBottom || "0") || 0;
934
+ childrenBottom = Math.max(childrenBottom, rect.bottom + marginBottom - rootTop);
935
+ }
936
+ return Math.ceil(Math.max(scrollContent.scrollHeight + margins, scrollContent.offsetHeight + margins, childrenBottom + margins));
937
+ };
938
+ const isEmptyPreviewApp = (iframeDocument) => {
939
+ const app = iframeDocument.getElementById("app");
940
+ return !!app && app.childElementCount === 0;
941
+ };
839
942
  const measure = () => {
840
943
  frameId = 0;
841
944
  if (!iframe) return;
@@ -843,21 +946,9 @@ var useSandboxAutoHeight = (sandboxRef) => {
843
946
  const iframeWindow = iframe.contentWindow;
844
947
  const iframeDocument = iframe.contentDocument;
845
948
  if (!iframeWindow || !iframeDocument?.body) return;
846
- const { body, documentElement } = iframeDocument;
847
- const bodyStyle = iframeWindow.getComputedStyle(body);
848
- const bodyMargins = (Number.parseFloat(bodyStyle.marginTop) || 0) + (Number.parseFloat(bodyStyle.marginBottom) || 0);
849
- const rootTop = documentElement.getBoundingClientRect().top;
850
- const bodyRect = body.getBoundingClientRect();
851
- const collapsedTop = Math.max(0, bodyRect.top - rootTop);
852
- let childrenBottom = 0;
853
- for (const child of body.children) {
854
- const rect = child.getBoundingClientRect();
855
- const marginBottom = Number.parseFloat(iframeWindow.getComputedStyle(child).marginBottom) || 0;
856
- childrenBottom = Math.max(childrenBottom, rect.bottom + marginBottom - rootTop);
857
- }
858
- const scrollHeight = Math.max(body.scrollHeight, documentElement.scrollHeight);
859
- const overflowingHeight = scrollHeight > iframe.clientHeight + 1 ? scrollHeight : 0;
860
- const contentHeight = Math.ceil(Math.max(body.offsetHeight + bodyMargins + collapsedTop, bodyRect.height + bodyMargins + collapsedTop, childrenBottom, overflowingHeight));
949
+ const scrollContent = resolveScrollContent(iframeDocument);
950
+ if (!scrollContent && isEmptyPreviewApp(iframeDocument)) return;
951
+ const contentHeight = scrollContent ? measureScrollContent(scrollContent) : measureDocumentContent(iframeWindow, iframeDocument);
861
952
  const nextHeight = Math.max(contentHeight, 24);
862
953
  if (height.value !== nextHeight) height.value = nextHeight;
863
954
  } catch {
@@ -871,6 +962,9 @@ var useSandboxAutoHeight = (sandboxRef) => {
871
962
  const disconnectContent = () => {
872
963
  contentObserver?.disconnect();
873
964
  contentObserver = null;
965
+ scrollMountObserver?.disconnect();
966
+ scrollMountObserver = null;
967
+ observedScrollNode = null;
874
968
  cancelMeasure();
875
969
  };
876
970
  const observeContent = () => {
@@ -888,7 +982,28 @@ var useSandboxAutoHeight = (sandboxRef) => {
888
982
  observer.observe(iframeDocument.documentElement);
889
983
  observer.observe(iframeDocument.body);
890
984
  contentObserver = observer;
891
- scheduleMeasure();
985
+ const attachScrollContent = (node) => {
986
+ if (!node || !contentObserver) return false;
987
+ if (observedScrollNode === node) return true;
988
+ if (observedScrollNode) contentObserver.unobserve(observedScrollNode);
989
+ observedScrollNode = node;
990
+ contentObserver.observe(node);
991
+ return true;
992
+ };
993
+ const syncScrollContent = () => {
994
+ attachScrollContent(resolveScrollContent(iframeDocument));
995
+ scheduleMeasure();
996
+ };
997
+ scrollMountObserver = new MutationObserver(syncScrollContent);
998
+ scrollMountObserver.observe(iframeDocument.documentElement, {
999
+ attributes: true,
1000
+ attributeFilter: ["class"]
1001
+ });
1002
+ scrollMountObserver.observe(iframeDocument.body, {
1003
+ childList: true,
1004
+ subtree: true
1005
+ });
1006
+ syncScrollContent();
892
1007
  } catch {
893
1008
  if (height.value !== 24) height.value = 24;
894
1009
  }
@@ -932,6 +1047,12 @@ var useSandboxAutoHeight = (sandboxRef) => {
932
1047
  });
933
1048
  return height;
934
1049
  };
1050
+ var resolvePreviewBoxHeight = (contentHeight, verticalInset = 0, borderWidth = 1) => {
1051
+ const content = Number.isFinite(contentHeight) ? Math.max(0, contentHeight) : 0;
1052
+ const inset = Number.isFinite(verticalInset) ? Math.max(0, verticalInset) : 0;
1053
+ const border = Number.isFinite(borderWidth) ? Math.max(0, borderWidth) : 1;
1054
+ return content + inset * 2 + border * 2;
1055
+ };
935
1056
  var CLIPPING_OVERFLOW = /* @__PURE__ */ new Set([
936
1057
  "auto",
937
1058
  "scroll",
@@ -945,14 +1066,14 @@ var SCROLLABLE_OVERFLOW = /* @__PURE__ */ new Set([
945
1066
  ]);
946
1067
  var getWindowInnerHeight = () => typeof window === "undefined" ? 0 : window.innerHeight;
947
1068
  var getPlaygroundHost = (el) => el?.closest(".docs-playground") ?? el;
948
- var isPlaygroundExpandEnabled = (expand) => {
949
- if (expand === true) return true;
950
- return typeof expand === "number" && Number.isFinite(expand) && expand > 0;
1069
+ var isPlaygroundExpandable = (value) => {
1070
+ if (value === true) return true;
1071
+ return typeof value === "number" && Number.isFinite(value) && value > 0;
951
1072
  };
952
1073
  var resolveRemainingPreviewHeight = ({ viewportHeight, chromeHeight, gap = 16 }) => Math.max(0, Math.round((Number.isFinite(viewportHeight) ? viewportHeight : 0) - (Number.isFinite(chromeHeight) ? Math.max(0, chromeHeight) : 0) - (Number.isFinite(gap) ? gap : 16)));
953
- var resolveExpandedPreviewHeight = (expand, availableHeight) => {
954
- if (expand === true) return Math.max(24, Math.round(Number.isFinite(availableHeight) ? availableHeight : 0));
955
- return Math.max(24, Math.round(expand));
1074
+ var resolveExpandedPreviewHeight = (expandable, availableHeight) => {
1075
+ if (expandable === true) return Math.max(24, Math.round(Number.isFinite(availableHeight) ? availableHeight : 0));
1076
+ return Math.max(24, Math.round(expandable));
956
1077
  };
957
1078
  var getVisibleViewportRect = (el) => {
958
1079
  const viewportHeight = getWindowInnerHeight();
@@ -1100,6 +1221,13 @@ var formatViewportLabel = (viewport, autoLabel = "Auto") => {
1100
1221
  if (viewport === "auto") return autoLabel;
1101
1222
  return Array.isArray(viewport) ? `${viewport[0]} × ${viewport[1]}px` : `${viewport}px`;
1102
1223
  };
1224
+ var resolvePopupScreenInset = (gap = 40) => {
1225
+ const safeGap = Number.isFinite(gap) ? Math.max(0, gap) : 40;
1226
+ return {
1227
+ x: safeGap * 2,
1228
+ y: safeGap
1229
+ };
1230
+ };
1103
1231
  var getWindowInnerSize = () => {
1104
1232
  if (typeof window === "undefined") return {
1105
1233
  width: 0,
@@ -1111,9 +1239,9 @@ var getWindowInnerSize = () => {
1111
1239
  };
1112
1240
  };
1113
1241
  var resolvePopupRequestedSize = (viewport, screen = getWindowInnerSize(), gap = 40) => {
1114
- const safeGap = Number.isFinite(gap) ? Math.max(0, gap) : 40;
1115
- const maxWidth = Math.max(0, Math.round((Number.isFinite(screen.width) ? screen.width : 0) - safeGap));
1116
- const maxHeight = Math.max(0, Math.round((Number.isFinite(screen.height) ? screen.height : 0) - safeGap));
1242
+ const inset = resolvePopupScreenInset(gap);
1243
+ const maxWidth = Math.max(0, Math.round((Number.isFinite(screen.width) ? screen.width : 0) - inset.x));
1244
+ const maxHeight = Math.max(0, Math.round((Number.isFinite(screen.height) ? screen.height : 0) - inset.y));
1117
1245
  const viewportWidth = getViewportWidth(viewport);
1118
1246
  const viewportHeight = getViewportHeight(viewport);
1119
1247
  return {
@@ -1124,11 +1252,11 @@ var resolvePopupRequestedSize = (viewport, screen = getWindowInnerSize(), gap =
1124
1252
  };
1125
1253
  };
1126
1254
  /**
1127
- * 壳层封顶到 `screen - gap`。未设 viewport 边时,画布铺满工具栏以下区域;
1128
- * 请求尺寸大于可用区域时由 Scroller 处理溢出。
1255
+ * 壳层封顶到 `screen.width - gap * 2`、`screen.height - gap`。
1256
+ * 未设 viewport 边时,画布铺满工具栏以下区域;请求尺寸大于可用区域时由 Scroller 处理溢出。
1129
1257
  * @param viewport 当前 playground 视口配置。
1130
- * @param screen 屏幕可用宽高,默认取 `window.inner*`.
1131
- * @param gap 相对屏幕边缘的留白。
1258
+ * @param screen 屏幕可用宽高,默认取 `window.inner*`。
1259
+ * @param gap 相对屏幕上下边缘的留白;左右为该值的 2 倍。
1132
1260
  * @returns 壳层、内容区与画布尺寸,以及是否需要滚动。
1133
1261
  */
1134
1262
  var resolvePopupLayout = (viewport, screen = getWindowInnerSize(), gap = 40) => {
@@ -1243,23 +1371,56 @@ var useSandboxTheme = (sandboxRef) => {
1243
1371
  //#endregion
1244
1372
  //#region packages/playground/src/core/runtime/toolbar.vue?vue&type=script&setup=true&lang.ts
1245
1373
  var _hoisted_1$3 = { class: "docs-playground__tools" };
1246
- var _hoisted_2$2 = ["title", "aria-label"];
1247
- var _hoisted_3$2 = [
1374
+ var _hoisted_2$3 = {
1375
+ key: 0,
1376
+ class: "docs-playground__tool-group"
1377
+ };
1378
+ var _hoisted_3$3 = [
1248
1379
  "title",
1249
1380
  "aria-label",
1250
1381
  "aria-expanded"
1251
1382
  ];
1252
- var _hoisted_4$2 = ["title", "aria-label"];
1253
- var _hoisted_5$2 = ["title", "aria-label"];
1254
- var _hoisted_6$1 = ["title", "aria-label"];
1383
+ var _hoisted_4$3 = {
1384
+ key: 1,
1385
+ class: "docs-playground__tool-divider",
1386
+ "aria-hidden": "true"
1387
+ };
1388
+ var _hoisted_5$3 = ["title", "aria-label"];
1389
+ var _hoisted_6$2 = ["title", "aria-label"];
1390
+ var _hoisted_7$2 = ["title", "aria-label"];
1391
+ var _hoisted_8$1 = {
1392
+ key: 3,
1393
+ class: "docs-playground__tool-divider",
1394
+ "aria-hidden": "true"
1395
+ };
1396
+ var _hoisted_9$1 = ["aria-label"];
1397
+ var _hoisted_10 = [
1398
+ "title",
1399
+ "aria-label",
1400
+ "aria-selected",
1401
+ "aria-pressed",
1402
+ "onClick"
1403
+ ];
1404
+ var _hoisted_11 = {
1405
+ key: 2,
1406
+ class: "docs-playground__tool-divider",
1407
+ "aria-hidden": "true"
1408
+ };
1409
+ var _hoisted_12 = ["title", "aria-label"];
1255
1410
  //#endregion
1256
1411
  //#region packages/playground/src/core/runtime/toolbar.vue
1257
1412
  var toolbar_default = /* @__PURE__ */ defineComponent({
1258
1413
  __name: "toolbar",
1259
1414
  props: {
1260
- copyValue: {},
1415
+ copyValue: { default: "" },
1261
1416
  viewport: { default: "auto" },
1262
1417
  viewportOptions: { default: () => ["auto", 375] },
1418
+ views: { default: () => [] },
1419
+ activeView: { default: "runtime" },
1420
+ showRuntimeActions: {
1421
+ type: Boolean,
1422
+ default: true
1423
+ },
1263
1424
  showOpenPopup: {
1264
1425
  type: Boolean,
1265
1426
  default: false
@@ -1274,14 +1435,20 @@ var toolbar_default = /* @__PURE__ */ defineComponent({
1274
1435
  "edit",
1275
1436
  "open-popup",
1276
1437
  "close-popup",
1277
- "viewport-change"
1438
+ "viewport-change",
1439
+ "view-change"
1278
1440
  ],
1279
1441
  setup(__props, { emit: __emit }) {
1280
1442
  const props = __props;
1281
1443
  const emit = __emit;
1282
1444
  const { t } = useLocale();
1445
+ const VIEW_ORDER = ["runtime", "files"];
1283
1446
  const viewportMenuVisible = ref(false);
1447
+ const orderedViews = computed(() => VIEW_ORDER.filter((view) => props.views.includes(view)));
1448
+ const showViews = computed(() => orderedViews.value.length > 1);
1284
1449
  const viewportLabel = computed(() => formatViewportLabel(props.viewport, t("playground.runtime.auto")));
1450
+ const getViewAriaLabel = (view) => t(playgroundViewMessage(view));
1451
+ const getViewLabel = (view) => view === "runtime" ? t("playground.runtime.previewLabel") : t("playground.runtime.codeLabel");
1285
1452
  const handleViewport = (index) => {
1286
1453
  const viewport = props.viewportOptions[index];
1287
1454
  if (viewport && !viewportEquals(viewport, props.viewport)) emit("viewport-change", viewport);
@@ -1289,95 +1456,120 @@ var toolbar_default = /* @__PURE__ */ defineComponent({
1289
1456
  watch(() => props.viewportOptions.length, (length) => {
1290
1457
  if (length <= 1) viewportMenuVisible.value = false;
1291
1458
  });
1459
+ watch(() => props.showRuntimeActions, (enabled) => {
1460
+ if (!enabled) viewportMenuVisible.value = false;
1461
+ });
1292
1462
  return (_ctx, _cache) => {
1293
1463
  return openBlock(), createElementBlock("div", _hoisted_1$3, [
1294
- createElementVNode("button", {
1295
- type: "button",
1296
- class: "docs-playground__tool docs-playground__refresh",
1297
- "data-action": "refresh",
1298
- title: unref(t)("playground.runtime.refresh"),
1299
- "aria-label": unref(t)("playground.runtime.refresh"),
1300
- onClick: _cache[0] || (_cache[0] = ($event) => emit("refresh"))
1301
- }, [createVNode(unref(icon_default), { name: "refresh" })], 8, _hoisted_2$2),
1302
- __props.viewportOptions.length > 1 ? (openBlock(), createBlock(unref(Dropdown), {
1303
- key: 0,
1304
- modelValue: viewportMenuVisible.value,
1305
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => viewportMenuVisible.value = $event),
1306
- class: "docs-playground__viewport-menu",
1307
- portal: true,
1308
- trigger: "click",
1309
- placement: "bottom-right"
1310
- }, {
1311
- content: withCtx(() => [createVNode(unref(DropdownMenu), {
1312
- class: "docs-playground__viewport-options",
1313
- role: "menu",
1314
- "aria-label": unref(t)("playground.runtime.viewportMenu")
1464
+ __props.showRuntimeActions ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1465
+ __props.viewportOptions.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_2$3, [createVNode(unref(Dropdown), {
1466
+ modelValue: viewportMenuVisible.value,
1467
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => viewportMenuVisible.value = $event),
1468
+ class: "docs-playground__viewport-menu",
1469
+ portal: true,
1470
+ trigger: "click",
1471
+ placement: "bottom-right"
1315
1472
  }, {
1316
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.viewportOptions, (item, index) => {
1317
- return openBlock(), createBlock(unref(DropdownItem), {
1318
- key: unref(getViewportKey)(item),
1319
- class: "docs-playground__viewport-option",
1320
- value: index,
1321
- selected: unref(viewportEquals)(item, __props.viewport),
1322
- role: "menuitemradio",
1323
- "aria-checked": unref(viewportEquals)(item, __props.viewport),
1324
- onClick: ($event) => handleViewport(index)
1325
- }, {
1326
- default: withCtx(() => [createTextVNode(toDisplayString(unref(formatViewportLabel)(item, unref(t)("playground.runtime.auto"))), 1)]),
1327
- _: 2
1328
- }, 1032, [
1329
- "value",
1330
- "selected",
1331
- "aria-checked",
1332
- "onClick"
1333
- ]);
1334
- }), 128))]),
1473
+ content: withCtx(() => [createVNode(unref(DropdownMenu), {
1474
+ class: "docs-playground__viewport-options",
1475
+ role: "menu",
1476
+ "aria-label": unref(t)("playground.runtime.viewportMenu")
1477
+ }, {
1478
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.viewportOptions, (item, index) => {
1479
+ return openBlock(), createBlock(unref(DropdownItem), {
1480
+ key: unref(getViewportKey)(item),
1481
+ class: "docs-playground__viewport-option",
1482
+ value: index,
1483
+ selected: unref(viewportEquals)(item, __props.viewport),
1484
+ role: "menuitemradio",
1485
+ "aria-checked": unref(viewportEquals)(item, __props.viewport),
1486
+ onClick: ($event) => handleViewport(index)
1487
+ }, {
1488
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(formatViewportLabel)(item, unref(t)("playground.runtime.auto"))), 1)]),
1489
+ _: 2
1490
+ }, 1032, [
1491
+ "value",
1492
+ "selected",
1493
+ "aria-checked",
1494
+ "onClick"
1495
+ ]);
1496
+ }), 128))]),
1497
+ _: 1
1498
+ }, 8, ["aria-label"])]),
1499
+ default: withCtx(() => [createElementVNode("button", {
1500
+ type: "button",
1501
+ class: normalizeClass(["docs-playground__tool docs-playground__viewport-trigger", { "is-active": __props.viewport !== "auto" }]),
1502
+ title: unref(t)("playground.runtime.viewport", { value: viewportLabel.value }),
1503
+ "aria-label": unref(t)("playground.runtime.viewport", { value: viewportLabel.value }),
1504
+ "aria-expanded": viewportMenuVisible.value,
1505
+ "aria-haspopup": "menu"
1506
+ }, [createVNode(unref(icon_default), { name: "viewport" })], 10, _hoisted_3$3)]),
1335
1507
  _: 1
1336
- }, 8, ["aria-label"])]),
1337
- default: withCtx(() => [createElementVNode("button", {
1508
+ }, 8, ["modelValue"])])) : createCommentVNode("v-if", true),
1509
+ __props.viewportOptions.length > 1 ? (openBlock(), createElementBlock("span", _hoisted_4$3)) : createCommentVNode("v-if", true),
1510
+ createElementVNode("button", {
1338
1511
  type: "button",
1339
- class: normalizeClass(["docs-playground__tool docs-playground__viewport-trigger", { "is-active": __props.viewport !== "auto" }]),
1340
- title: unref(t)("playground.runtime.viewport", { value: viewportLabel.value }),
1341
- "aria-label": unref(t)("playground.runtime.viewport", { value: viewportLabel.value }),
1342
- "aria-expanded": viewportMenuVisible.value,
1343
- "aria-haspopup": "menu"
1344
- }, [createVNode(unref(icon_default), { name: "viewport" })], 10, _hoisted_3$2)]),
1345
- _: 1
1346
- }, 8, ["modelValue"])) : createCommentVNode("v-if", true),
1347
- createVNode(unref(Clipboard), {
1348
- class: "docs-playground__tool",
1349
- value: __props.copyValue,
1350
- tag: "button",
1351
- type: "button",
1352
- title: unref(t)("playground.common.copy"),
1353
- "aria-label": unref(t)("playground.common.copy")
1354
- }, {
1355
- default: withCtx(() => [createVNode(unref(icon_default), { name: "copy" })]),
1356
- _: 1
1357
- }, 8, [
1358
- "value",
1359
- "title",
1360
- "aria-label"
1361
- ]),
1362
- createElementVNode("button", {
1363
- type: "button",
1364
- class: "docs-playground__tool docs-playground__editor",
1365
- "data-action": "edit",
1366
- title: unref(t)("playground.runtime.editFiles"),
1367
- "aria-label": unref(t)("playground.runtime.editFiles"),
1368
- onClick: _cache[2] || (_cache[2] = ($event) => emit("edit"))
1369
- }, [createVNode(unref(icon_default), { name: "editor" })], 8, _hoisted_4$2),
1370
- __props.showOpenPopup ? (openBlock(), createElementBlock("button", {
1512
+ class: "docs-playground__tool docs-playground__refresh",
1513
+ "data-action": "refresh",
1514
+ title: unref(t)("playground.runtime.refresh"),
1515
+ "aria-label": unref(t)("playground.runtime.refresh"),
1516
+ onClick: _cache[1] || (_cache[1] = ($event) => emit("refresh"))
1517
+ }, [createVNode(unref(icon_default), { name: "refresh" })], 8, _hoisted_5$3),
1518
+ createElementVNode("button", {
1519
+ type: "button",
1520
+ class: "docs-playground__tool docs-playground__editor",
1521
+ "data-action": "edit",
1522
+ title: unref(t)("playground.runtime.editFiles"),
1523
+ "aria-label": unref(t)("playground.runtime.editFiles"),
1524
+ onClick: _cache[2] || (_cache[2] = ($event) => emit("edit"))
1525
+ }, [createVNode(unref(icon_default), { name: "editor" })], 8, _hoisted_6$2),
1526
+ __props.showOpenPopup ? (openBlock(), createElementBlock("button", {
1527
+ key: 2,
1528
+ type: "button",
1529
+ class: "docs-playground__tool docs-playground__popup",
1530
+ "data-action": "open-popup",
1531
+ title: unref(t)("playground.runtime.openPopup"),
1532
+ "aria-label": unref(t)("playground.runtime.openPopup"),
1533
+ onClick: _cache[3] || (_cache[3] = ($event) => emit("open-popup"))
1534
+ }, [createVNode(unref(icon_default), { name: "popup" })], 8, _hoisted_7$2)) : createCommentVNode("v-if", true),
1535
+ createVNode(unref(Clipboard), {
1536
+ class: "docs-playground__tool",
1537
+ value: __props.copyValue,
1538
+ tag: "button",
1539
+ type: "button",
1540
+ title: unref(t)("playground.common.copy"),
1541
+ "aria-label": unref(t)("playground.common.copy")
1542
+ }, {
1543
+ default: withCtx(() => [createVNode(unref(icon_default), { name: "copy" })]),
1544
+ _: 1
1545
+ }, 8, [
1546
+ "value",
1547
+ "title",
1548
+ "aria-label"
1549
+ ]),
1550
+ showViews.value ? (openBlock(), createElementBlock("span", _hoisted_8$1)) : createCommentVNode("v-if", true)
1551
+ ], 64)) : createCommentVNode("v-if", true),
1552
+ showViews.value ? (openBlock(), createElementBlock("div", {
1371
1553
  key: 1,
1372
- type: "button",
1373
- class: "docs-playground__tool docs-playground__popup",
1374
- "data-action": "open-popup",
1375
- title: unref(t)("playground.runtime.openPopup"),
1376
- "aria-label": unref(t)("playground.runtime.openPopup"),
1377
- onClick: _cache[3] || (_cache[3] = ($event) => emit("open-popup"))
1378
- }, [createVNode(unref(icon_default), { name: "popup" })], 8, _hoisted_5$2)) : createCommentVNode("v-if", true),
1554
+ class: "docs-playground__views",
1555
+ role: "tablist",
1556
+ "aria-label": unref(t)("playground.runtime.views")
1557
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(orderedViews.value, (item) => {
1558
+ return openBlock(), createElementBlock("button", {
1559
+ key: item,
1560
+ type: "button",
1561
+ class: normalizeClass(["docs-playground__view", { "is-active": item === __props.activeView }]),
1562
+ role: "tab",
1563
+ title: getViewAriaLabel(item),
1564
+ "aria-label": getViewAriaLabel(item),
1565
+ "aria-selected": item === __props.activeView,
1566
+ "aria-pressed": item === __props.activeView,
1567
+ onClick: ($event) => emit("view-change", item)
1568
+ }, toDisplayString(getViewLabel(item)), 11, _hoisted_10);
1569
+ }), 128))], 8, _hoisted_9$1)) : createCommentVNode("v-if", true),
1570
+ __props.showClose && (__props.showRuntimeActions || showViews.value) ? (openBlock(), createElementBlock("span", _hoisted_11)) : createCommentVNode("v-if", true),
1379
1571
  __props.showClose ? (openBlock(), createElementBlock("button", {
1380
- key: 2,
1572
+ key: 3,
1381
1573
  type: "button",
1382
1574
  class: "docs-playground__tool docs-playground__popup-close",
1383
1575
  "data-action": "close-popup",
@@ -1387,7 +1579,7 @@ var toolbar_default = /* @__PURE__ */ defineComponent({
1387
1579
  }, [..._cache[5] || (_cache[5] = [createElementVNode("span", {
1388
1580
  class: "docs-playground__popup-close-mark",
1389
1581
  "aria-hidden": "true"
1390
- }, "✕", -1)])], 8, _hoisted_6$1)) : createCommentVNode("v-if", true)
1582
+ }, "✕", -1)])], 8, _hoisted_12)) : createCommentVNode("v-if", true)
1391
1583
  ]);
1392
1584
  };
1393
1585
  }
@@ -1730,6 +1922,7 @@ var bindPlaygroundScss = (store) => {
1730
1922
  //#region packages/playground/src/core/store.ts
1731
1923
  var DOCS_LINK_IMPORT_CODE = "import { h as __docsH } from \"vue\"";
1732
1924
  var DOCS_LINK_USE_CODE = [
1925
+ PREVIEW_SCROLL_RESET_CODE,
1733
1926
  "app.component(\"DocsLink\",{",
1734
1927
  "props:{to:{type:String,default:\"\"}},",
1735
1928
  "setup(props,{slots}){return()=>__docsH(\"a\",{",
@@ -1746,21 +1939,27 @@ var escapeHtmlAttr = (value) => value.replace(/&/gu, "&amp;").replace(/"/gu, "&q
1746
1939
  * `--vc-background-color-light` 不同,否则会出现色带割裂。
1747
1940
  */
1748
1941
  var PLAYGROUND_RUNTIME_CANVAS_BACKGROUND = "var(--vc-background-color-light, var(--docs-background-color, #fff))";
1749
- var createRuntimePreviewOptions = (cdnURL = DEFAULT_CDN_URL) => {
1942
+ var createRuntimePreviewOptions = (cdnURL = DEFAULT_CDN_URL, options = {}) => {
1943
+ const previewScroller = options.previewScroller === true;
1944
+ const hrefs = Object.values({
1945
+ ...createBuiltinStyles(cdnURL),
1946
+ ...getPlaygroundSiteStyles(),
1947
+ ...getPlaygroundStyleOverrides()
1948
+ });
1949
+ const styleBlocks = [
1950
+ `html,body{height:auto;min-height:0;background:${PLAYGROUND_RUNTIME_CANVAS_BACKGROUND}}`,
1951
+ "body{color:var(--vc-foreground-color,#080f20)}",
1952
+ ...previewScroller ? [PREVIEW_SCROLLER_STYLE] : []
1953
+ ];
1750
1954
  return {
1751
1955
  showRuntimeError: false,
1752
1956
  showRuntimeWarning: false,
1753
1957
  headHTML: [
1754
1958
  SANDBOX_RUNTIME_ERROR_CAPTURE_HTML,
1755
1959
  "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">",
1756
- ...Object.values({
1757
- ...createBuiltinStyles(cdnURL),
1758
- ...getPlaygroundSiteStyles(),
1759
- ...getPlaygroundStyleOverrides()
1760
- }).map((href) => `<link rel="stylesheet" href="${escapeHtmlAttr(href)}">`),
1960
+ ...hrefs.map((href) => `<link rel="stylesheet" href="${escapeHtmlAttr(href)}">`),
1761
1961
  "<style>",
1762
- `html,body{height:auto;min-height:0;background:${PLAYGROUND_RUNTIME_CANVAS_BACKGROUND}}`,
1763
- "body{color:var(--vc-foreground-color,#080f20)}",
1962
+ ...styleBlocks,
1764
1963
  "</style>"
1765
1964
  ].join("\n"),
1766
1965
  customCode: {
@@ -1808,14 +2007,16 @@ var createRuntimeStore = (files, entry, options) => {
1808
2007
  //#endregion
1809
2008
  //#region packages/playground/src/core/runtime/alone/wrapper.vue?vue&type=script&setup=true&lang.ts
1810
2009
  var _hoisted_1$2 = ["aria-label"];
1811
- var _hoisted_2$1 = { class: "docs-playground-popup__frame" };
1812
- var _hoisted_3$1 = { class: "docs-playground-popup__header" };
1813
- var _hoisted_4$1 = {
2010
+ var _hoisted_2$2 = { class: "docs-playground-popup__frame" };
2011
+ var _hoisted_3$2 = { class: "docs-playground-popup__header" };
2012
+ var _hoisted_4$2 = ["title"];
2013
+ var _hoisted_5$2 = { class: "docs-playground__title-text" };
2014
+ var _hoisted_6$1 = {
1814
2015
  key: 0,
1815
2016
  class: "docs-playground__runtime-error",
1816
2017
  role: "alert"
1817
2018
  };
1818
- var _hoisted_5$1 = { class: "docs-playground-popup__body" };
2019
+ var _hoisted_7$1 = { class: "docs-playground-popup__body" };
1819
2020
  //#endregion
1820
2021
  //#region packages/playground/src/core/runtime/alone/index.ts
1821
2022
  var Alone = new Portal(/* @__PURE__ */ defineComponent({
@@ -1823,6 +2024,7 @@ var Alone = new Portal(/* @__PURE__ */ defineComponent({
1823
2024
  props: {
1824
2025
  store: {},
1825
2026
  copyValue: {},
2027
+ title: { default: "" },
1826
2028
  viewport: { default: "auto" },
1827
2029
  viewportOptions: { default: () => ["auto", 375] },
1828
2030
  previewOptions: {},
@@ -1923,8 +2125,12 @@ var Alone = new Portal(/* @__PURE__ */ defineComponent({
1923
2125
  }), createElementVNode("div", {
1924
2126
  class: "docs-playground-popup__shell",
1925
2127
  style: normalizeStyle(shellStyle.value)
1926
- }, [createElementVNode("div", _hoisted_2$1, [
1927
- createElementVNode("div", _hoisted_3$1, [createVNode(toolbar_default, {
2128
+ }, [createElementVNode("div", _hoisted_2$2, [
2129
+ createElementVNode("div", _hoisted_3$2, [__props.title.trim() ? (openBlock(), createElementBlock("span", {
2130
+ key: 0,
2131
+ class: "docs-playground__title",
2132
+ title: __props.title.trim()
2133
+ }, [createElementVNode("span", _hoisted_5$2, toDisplayString(__props.title.trim()), 1)], 8, _hoisted_4$2)) : createCommentVNode("v-if", true), createVNode(toolbar_default, {
1928
2134
  "copy-value": __props.copyValue,
1929
2135
  viewport: currentViewport.value,
1930
2136
  "viewport-options": __props.viewportOptions,
@@ -1938,8 +2144,8 @@ var Alone = new Portal(/* @__PURE__ */ defineComponent({
1938
2144
  "viewport",
1939
2145
  "viewport-options"
1940
2146
  ])]),
1941
- errorText.value ? (openBlock(), createElementBlock("pre", _hoisted_4$1, toDisplayString(errorText.value), 1)) : createCommentVNode("v-if", true),
1942
- createElementVNode("div", _hoisted_5$1, [createVNode(unref(Scroller), {
2147
+ errorText.value ? (openBlock(), createElementBlock("pre", _hoisted_6$1, toDisplayString(errorText.value), 1)) : createCommentVNode("v-if", true),
2148
+ createElementVNode("div", _hoisted_7$1, [createVNode(unref(Scroller), {
1943
2149
  class: "docs-playground-popup__scroller",
1944
2150
  "content-class": "docs-playground-popup__scroller-content",
1945
2151
  "auto-resize": true,
@@ -1976,29 +2182,25 @@ var Alone = new Portal(/* @__PURE__ */ defineComponent({
1976
2182
  //#endregion
1977
2183
  //#region packages/playground/src/core/runtime/runtime.vue?vue&type=script&setup=true&lang.ts
1978
2184
  var _hoisted_1$1 = { class: "docs-playground-runtime-host" };
1979
- var _hoisted_2 = {
2185
+ var _hoisted_2$1 = {
1980
2186
  key: 0,
1981
2187
  class: "docs-playground__runtime-error",
1982
2188
  role: "alert"
1983
2189
  };
1984
- var _hoisted_3 = { class: "docs-playground__header" };
1985
- var _hoisted_4 = {
2190
+ var _hoisted_3$1 = {
1986
2191
  key: 0,
1987
- class: "docs-playground__views"
2192
+ class: "docs-playground__header"
1988
2193
  };
1989
- var _hoisted_5 = [
1990
- "title",
1991
- "aria-label",
1992
- "aria-pressed",
1993
- "onClick"
1994
- ];
1995
- var _hoisted_6 = {
1996
- key: 0,
2194
+ var _hoisted_4$1 = ["id", "title"];
2195
+ var _hoisted_5$1 = ["href"];
2196
+ var _hoisted_6 = { class: "docs-playground__title-text" };
2197
+ var _hoisted_7 = {
2198
+ key: 1,
1997
2199
  class: "docs-playground__runtime-error",
1998
2200
  role: "alert"
1999
2201
  };
2000
- var _hoisted_7 = { class: "docs-playground-runtime__viewport-stage" };
2001
- var _hoisted_8 = [
2202
+ var _hoisted_8 = { class: "docs-playground-runtime__viewport-stage" };
2203
+ var _hoisted_9 = [
2002
2204
  "aria-expanded",
2003
2205
  "title",
2004
2206
  "aria-label"
@@ -2015,11 +2217,21 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2015
2217
  options: {},
2016
2218
  previewInset: { default: 10 },
2017
2219
  previewOptions: {},
2220
+ previewScroller: {
2221
+ type: Boolean,
2222
+ default: false
2223
+ },
2018
2224
  styleless: {
2019
2225
  type: Boolean,
2020
2226
  default: false
2021
2227
  },
2022
- expand: { type: [Boolean, Number] },
2228
+ hideChrome: {
2229
+ type: Boolean,
2230
+ default: false
2231
+ },
2232
+ expandable: { type: [Boolean, Number] },
2233
+ title: { default: "" },
2234
+ id: { default: "" },
2023
2235
  viewport: { default: "auto" },
2024
2236
  viewportOptions: { default: () => ["auto", 375] }
2025
2237
  },
@@ -2029,14 +2241,20 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2029
2241
  "viewport-change",
2030
2242
  "navigate"
2031
2243
  ],
2032
- setup(__props, { emit: __emit }) {
2244
+ setup(__props, { expose: __expose, emit: __emit }) {
2033
2245
  const props = __props;
2034
2246
  const { locale, t } = useLocale();
2035
- const getViewText = (view) => t(playgroundViewMessage(view));
2247
+ const displayTitle = computed(() => props.title.trim());
2248
+ const titleEl = ref(null);
2249
+ const titleId = computed(() => resolvePlaygroundTitleId(displayTitle.value, props.id, (candidate) => {
2250
+ if (typeof document === "undefined") return false;
2251
+ const existing = document.getElementById(candidate);
2252
+ return !!existing && existing !== titleEl.value;
2253
+ }));
2036
2254
  const emit = __emit;
2037
2255
  const joinCode = (...values) => values.filter(Boolean).join("\n");
2038
2256
  const mergePreviewOptions = (extraHeadHTML) => {
2039
- const runtimePreviewOptions = createRuntimePreviewOptions(props.options.cdnURL);
2257
+ const runtimePreviewOptions = createRuntimePreviewOptions(props.options.cdnURL, { previewScroller: props.previewScroller });
2040
2258
  return {
2041
2259
  ...runtimePreviewOptions,
2042
2260
  ...props.previewOptions,
@@ -2046,8 +2264,8 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2046
2264
  extraHeadHTML
2047
2265
  ].filter(Boolean).join("\n"),
2048
2266
  customCode: {
2049
- importCode: joinCode(runtimePreviewOptions.customCode?.importCode, props.previewOptions?.customCode?.importCode),
2050
- useCode: joinCode(runtimePreviewOptions.customCode?.useCode, props.previewOptions?.customCode?.useCode)
2267
+ importCode: joinCode(DOCS_LINK_IMPORT_CODE, props.previewOptions?.customCode?.importCode, props.previewScroller ? PREVIEW_SCROLL_RESET_CODE : void 0, props.previewScroller ? PREVIEW_SCROLLER_IMPORT_CODE : void 0),
2268
+ useCode: joinCode(runtimePreviewOptions.customCode?.useCode, props.previewOptions?.customCode?.useCode, props.previewScroller ? PREVIEW_SCROLLER_USE_CODE : void 0)
2051
2269
  }
2052
2270
  };
2053
2271
  };
@@ -2081,36 +2299,44 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2081
2299
  };
2082
2300
  const runtimeRoot = ref(null);
2083
2301
  const previewExpanded = ref(false);
2084
- /** `expand: true` 时在展开瞬间冻结,避免滚动重算高度造成抖动。 */
2302
+ /** `expandable: true` 时在展开瞬间冻结,避免滚动重算高度造成抖动。 */
2085
2303
  const frozenExpandedHeight = ref(0);
2086
2304
  const measurePreviewChromeHeight = () => {
2087
2305
  const root = runtimeRoot.value;
2088
2306
  if (!root) return 0;
2089
- const header = root.querySelector(".docs-playground__header");
2307
+ const header = (root.closest(".docs-playground") ?? root).querySelector(".docs-playground__header");
2090
2308
  const error = root.querySelector(".docs-playground__runtime-error");
2091
2309
  return (header instanceof HTMLElement ? header.offsetHeight : 0) + (error instanceof HTMLElement ? error.offsetHeight : 0);
2092
2310
  };
2311
+ const normalizedPreviewInset = computed(() => {
2312
+ const value = props.previewInset;
2313
+ if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? [value, value] : [10, 10];
2314
+ if (Array.isArray(value) && value.length === 2 && value.every((item) => typeof item === "number" && Number.isFinite(item) && item >= 0)) return [value[0], value[1]];
2315
+ return [10, 10];
2316
+ });
2093
2317
  const measureExpandedPreviewHeight = () => {
2094
2318
  if (typeof window === "undefined") return runtimeHeight.value;
2095
2319
  const chromeHeight = measurePreviewChromeHeight();
2320
+ const viewport = getVisibleViewportRect(runtimeRoot.value);
2321
+ const [vertical] = normalizedPreviewInset.value;
2096
2322
  return resolveExpandedPreviewHeight(true, resolveRemainingPreviewHeight({
2097
- viewportHeight: getVisibleViewportRect(runtimeRoot.value).height,
2323
+ viewportHeight: viewport.height,
2098
2324
  chromeHeight
2099
- }));
2325
+ }) - vertical * 2 - 2);
2100
2326
  };
2101
2327
  const syncFrozenExpandedHeight = () => {
2102
- if (!previewExpanded.value || props.expand !== true) return;
2328
+ if (!previewExpanded.value || props.expandable !== true) return;
2103
2329
  frozenExpandedHeight.value = measureExpandedPreviewHeight();
2104
2330
  };
2105
2331
  if (typeof window !== "undefined") {
2106
2332
  window.addEventListener("message", handleBridgeMessage);
2107
2333
  window.addEventListener("resize", syncFrozenExpandedHeight);
2108
2334
  }
2109
- const canExpandPreview = computed(() => !props.styleless && isPlaygroundExpandEnabled(props.expand));
2335
+ const canExpandPreview = computed(() => !props.styleless && isPlaygroundExpandable(props.expandable));
2110
2336
  const expandLabel = computed(() => t(previewExpanded.value ? "playground.runtime.collapsePreview" : "playground.runtime.expandPreview"));
2111
2337
  const desiredViewportHeight = computed(() => {
2112
- if (previewExpanded.value && props.expand === true) return frozenExpandedHeight.value;
2113
- if (previewExpanded.value && isPlaygroundExpandEnabled(props.expand)) return resolveExpandedPreviewHeight(props.expand, 0);
2338
+ if (previewExpanded.value && props.expandable === true) return frozenExpandedHeight.value;
2339
+ if (previewExpanded.value && isPlaygroundExpandable(props.expandable)) return resolveExpandedPreviewHeight(props.expandable, 0);
2114
2340
  const fixedHeight = getViewportHeight(props.viewport);
2115
2341
  if (fixedHeight) return fixedHeight;
2116
2342
  return runtimeHeight.value;
@@ -2121,7 +2347,7 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2121
2347
  const handleTogglePreviewExpand = () => {
2122
2348
  if (!canExpandPreview.value) return;
2123
2349
  if (!previewExpanded.value) {
2124
- if (props.expand === true) frozenExpandedHeight.value = measureExpandedPreviewHeight();
2350
+ if (props.expandable === true) frozenExpandedHeight.value = measureExpandedPreviewHeight();
2125
2351
  else frozenExpandedHeight.value = 0;
2126
2352
  previewExpanded.value = true;
2127
2353
  nextTick(scrollExpandedPreviewIntoView);
@@ -2136,16 +2362,10 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2136
2362
  frozenExpandedHeight.value = 0;
2137
2363
  }
2138
2364
  });
2139
- const normalizedPreviewInset = computed(() => {
2140
- const value = props.previewInset;
2141
- if (typeof value === "number") return Number.isFinite(value) && value >= 0 ? [value, value] : [10, 10];
2142
- if (Array.isArray(value) && value.length === 2 && value.every((item) => typeof item === "number" && Number.isFinite(item) && item >= 0)) return [value[0], value[1]];
2143
- return [10, 10];
2144
- });
2145
2365
  const previewStyle = computed(() => {
2146
2366
  const [vertical, horizontal] = normalizedPreviewInset.value;
2147
2367
  return {
2148
- height: `${desiredViewportHeight.value + vertical * 2}px`,
2368
+ height: `${resolvePreviewBoxHeight(desiredViewportHeight.value, vertical)}px`,
2149
2369
  padding: vertical === horizontal ? `${vertical}px` : `${vertical}px ${horizontal}px`,
2150
2370
  background: PLAYGROUND_RUNTIME_CANVAS_BACKGROUND
2151
2371
  };
@@ -2210,6 +2430,7 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2210
2430
  Alone.popup({
2211
2431
  store,
2212
2432
  copyValue: copyValue.value,
2433
+ title: props.title,
2213
2434
  viewport: props.viewport,
2214
2435
  viewportOptions: props.viewportOptions,
2215
2436
  previewOptions: popupPreviewOptions.value,
@@ -2219,7 +2440,6 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2219
2440
  onNavigate: (to) => emit("navigate", to)
2220
2441
  });
2221
2442
  };
2222
- const handleView = (view) => emit("view-change", view);
2223
2443
  const handleViewportChange = (viewport) => {
2224
2444
  emit("viewport-change", viewport);
2225
2445
  };
@@ -2244,6 +2464,11 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2244
2464
  window.removeEventListener("resize", syncFrozenExpandedHeight);
2245
2465
  handleClosePopup();
2246
2466
  });
2467
+ __expose({
2468
+ refresh: handleInlineRefresh,
2469
+ edit: handleEditor,
2470
+ openPopup: handleOpenPopup
2471
+ });
2247
2472
  return (_ctx, _cache) => {
2248
2473
  return openBlock(), createElementBlock("div", _hoisted_1$1, [__props.styleless ? (openBlock(), createElementBlock("div", {
2249
2474
  key: 0,
@@ -2251,7 +2476,7 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2251
2476
  ref: runtimeRoot,
2252
2477
  class: "docs-playground-runtime--styleless",
2253
2478
  style: normalizeStyle(stylelessStyle.value)
2254
- }, [errorText.value ? (openBlock(), createElementBlock("pre", _hoisted_2, toDisplayString(errorText.value), 1)) : createCommentVNode("v-if", true), createElementVNode("div", {
2479
+ }, [errorText.value ? (openBlock(), createElementBlock("pre", _hoisted_2$1, toDisplayString(errorText.value), 1)) : createCommentVNode("v-if", true), createElementVNode("div", {
2255
2480
  class: "docs-playground-runtime__viewport",
2256
2481
  style: normalizeStyle(viewportStyle.value)
2257
2482
  }, [createVNode(unref(Sandbox), {
@@ -2266,7 +2491,18 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2266
2491
  ref: runtimeRoot,
2267
2492
  class: "docs-playground-runtime"
2268
2493
  }, [
2269
- createElementVNode("div", _hoisted_3, [createVNode(toolbar_default, {
2494
+ !__props.hideChrome ? (openBlock(), createElementBlock("div", _hoisted_3$1, [displayTitle.value ? (openBlock(), createElementBlock("span", {
2495
+ key: 0,
2496
+ ref_key: "titleEl",
2497
+ ref: titleEl,
2498
+ class: "docs-playground__title",
2499
+ id: titleId.value,
2500
+ tabindex: "-1",
2501
+ title: displayTitle.value
2502
+ }, [createElementVNode("a", {
2503
+ class: "docs-playground__title-anchor",
2504
+ href: `#${titleId.value}`
2505
+ }, "#", 8, _hoisted_5$1), createElementVNode("span", _hoisted_6, toDisplayString(displayTitle.value), 1)], 8, _hoisted_4$1)) : createCommentVNode("v-if", true), createVNode(toolbar_default, {
2270
2506
  "copy-value": copyValue.value,
2271
2507
  viewport: __props.viewport,
2272
2508
  "viewport-options": __props.viewportOptions,
@@ -2279,22 +2515,12 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2279
2515
  "copy-value",
2280
2516
  "viewport",
2281
2517
  "viewport-options"
2282
- ]), __props.views.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.views, (item) => {
2283
- return openBlock(), createElementBlock("button", {
2284
- key: item,
2285
- type: "button",
2286
- class: normalizeClass(["docs-playground__view", { "is-active": item === __props.activeView }]),
2287
- title: getViewText(item),
2288
- "aria-label": getViewText(item),
2289
- "aria-pressed": item === __props.activeView,
2290
- onClick: ($event) => handleView(item)
2291
- }, [createVNode(unref(icon_default), { name: item }, null, 8, ["name"])], 10, _hoisted_5);
2292
- }), 128))])) : createCommentVNode("v-if", true)]),
2293
- errorText.value ? (openBlock(), createElementBlock("pre", _hoisted_6, toDisplayString(errorText.value), 1)) : createCommentVNode("v-if", true),
2518
+ ])])) : createCommentVNode("v-if", true),
2519
+ errorText.value ? (openBlock(), createElementBlock("pre", _hoisted_7, toDisplayString(errorText.value), 1)) : createCommentVNode("v-if", true),
2294
2520
  createElementVNode("section", {
2295
2521
  class: normalizeClass(["docs-playground__preview", { "is-expanded": previewExpanded.value }]),
2296
2522
  style: normalizeStyle(previewStyle.value)
2297
- }, [createElementVNode("div", _hoisted_7, [createElementVNode("div", {
2523
+ }, [createElementVNode("div", _hoisted_8, [createElementVNode("div", {
2298
2524
  class: "docs-playground-runtime__viewport",
2299
2525
  style: normalizeStyle(viewportStyle.value)
2300
2526
  }, [(openBlock(), createBlock(unref(Sandbox), {
@@ -2314,7 +2540,7 @@ var runtime_default = /* @__PURE__ */ defineComponent({
2314
2540
  title: expandLabel.value,
2315
2541
  "aria-label": expandLabel.value,
2316
2542
  onClick: handleTogglePreviewExpand
2317
- }, [createVNode(unref(icon_default), { name: "expand" })], 10, _hoisted_8)) : createCommentVNode("v-if", true)], 6)
2543
+ }, [createVNode(unref(icon_default), { name: "expand" })], 10, _hoisted_9)) : createCommentVNode("v-if", true)], 6)
2318
2544
  ], 512))]);
2319
2545
  };
2320
2546
  }
@@ -2325,6 +2551,13 @@ var _hoisted_1 = {
2325
2551
  key: 0,
2326
2552
  class: "docs-playground__error"
2327
2553
  };
2554
+ var _hoisted_2 = {
2555
+ key: 0,
2556
+ class: "docs-playground__header"
2557
+ };
2558
+ var _hoisted_3 = ["id", "title"];
2559
+ var _hoisted_4 = ["href"];
2560
+ var _hoisted_5 = { class: "docs-playground__title-text" };
2328
2561
  //#endregion
2329
2562
  //#region packages/playground/src/playground.vue
2330
2563
  var playground_default = /* @__PURE__ */ defineComponent({
@@ -2342,7 +2575,13 @@ var playground_default = /* @__PURE__ */ defineComponent({
2342
2575
  },
2343
2576
  options: { default: () => ({}) },
2344
2577
  previewInset: { default: 0 },
2345
- expand: { type: [Boolean, Number] },
2578
+ expandable: { type: [Boolean, Number] },
2579
+ title: { default: "" },
2580
+ id: { default: "" },
2581
+ previewScroller: {
2582
+ type: Boolean,
2583
+ default: false
2584
+ },
2346
2585
  previewOptions: {},
2347
2586
  locale: {}
2348
2587
  },
@@ -2366,6 +2605,8 @@ var playground_default = /* @__PURE__ */ defineComponent({
2366
2605
  const sourceFiles = ref(initialFiles);
2367
2606
  const currentEntry = ref(initialEntry);
2368
2607
  const fileActiveFilename = ref(initialEntry);
2608
+ const runtimeRef = ref(null);
2609
+ const titleEl = ref(null);
2369
2610
  const normalizeViews = (views) => {
2370
2611
  const normalized = [];
2371
2612
  for (const view of views) {
@@ -2376,12 +2617,25 @@ var playground_default = /* @__PURE__ */ defineComponent({
2376
2617
  return normalized.length ? normalized : ["runtime"];
2377
2618
  };
2378
2619
  const normalizedViews = computed(() => normalizeViews(props.views));
2620
+ const hasRuntimeView = computed(() => normalizedViews.value.includes("runtime"));
2621
+ const hasFilesView = computed(() => normalizedViews.value.includes("files"));
2379
2622
  const activeView = ref(normalizedViews.value[0]);
2380
2623
  const runtimeActivated = ref(props.styleless || activeView.value === "runtime");
2381
2624
  const normalizedViewportOptions = computed(() => normalizeViewportOptions(props.viewportOptions));
2382
2625
  const activeViewport = ref(resolveInitialViewport(props.viewport, normalizedViewportOptions.value));
2383
2626
  const selectableViewportOptions = computed(() => includeActiveViewport(normalizedViewportOptions.value, activeViewport.value));
2384
2627
  const error = ref(props.entry && initialFiles[props.entry] === void 0 ? t("playground.validation.entryMissing", { filename: props.entry }) : "");
2628
+ const displayTitle = computed(() => props.title.trim());
2629
+ const titleId = computed(() => resolvePlaygroundTitleId(displayTitle.value, props.id, (candidate) => {
2630
+ if (typeof document === "undefined") return false;
2631
+ const existing = document.getElementById(candidate);
2632
+ return !!existing && existing !== titleEl.value;
2633
+ }));
2634
+ const copyValue = computed(() => sourceFiles.value[currentEntry.value] || "");
2635
+ /** runtime / 双视图始终有顶栏;files-only 仅有标题时渲染。 */
2636
+ const showHeader = computed(() => hasRuntimeView.value || !!displayTitle.value);
2637
+ const showToolbar = computed(() => hasRuntimeView.value);
2638
+ const showRuntimeActions = computed(() => activeView.value === "runtime");
2385
2639
  watch(locale, () => {
2386
2640
  if (props.entry && sourceFiles.value[props.entry] === void 0) error.value = t("playground.validation.entryMissing", { filename: props.entry });
2387
2641
  });
@@ -2395,6 +2649,15 @@ var playground_default = /* @__PURE__ */ defineComponent({
2395
2649
  activeViewport.value = cloneViewport(viewport);
2396
2650
  emit("update:viewport", cloneViewport(viewport));
2397
2651
  };
2652
+ const handleRefresh = () => {
2653
+ runtimeRef.value?.refresh();
2654
+ };
2655
+ const handleEdit = () => {
2656
+ runtimeRef.value?.edit();
2657
+ };
2658
+ const handleOpenPopup = () => {
2659
+ runtimeRef.value?.openPopup();
2660
+ };
2398
2661
  const handleFileActive = (filename) => {
2399
2662
  if (sourceFiles.value[filename] !== void 0) fileActiveFilename.value = filename;
2400
2663
  };
@@ -2476,8 +2739,11 @@ var playground_default = /* @__PURE__ */ defineComponent({
2476
2739
  options: __props.options,
2477
2740
  "preview-options": __props.previewOptions,
2478
2741
  "preview-inset": __props.previewInset,
2479
- expand: __props.expand,
2742
+ "preview-scroller": __props.previewScroller,
2743
+ expandable: __props.expandable,
2480
2744
  styleless: true,
2745
+ title: __props.title,
2746
+ id: __props.id,
2481
2747
  viewport: activeViewport.value,
2482
2748
  "viewport-options": selectableViewportOptions.value,
2483
2749
  onFilesChange: handleFilesChange,
@@ -2489,29 +2755,70 @@ var playground_default = /* @__PURE__ */ defineComponent({
2489
2755
  "options",
2490
2756
  "preview-options",
2491
2757
  "preview-inset",
2492
- "expand",
2758
+ "preview-scroller",
2759
+ "expandable",
2760
+ "title",
2761
+ "id",
2493
2762
  "viewport",
2494
2763
  "viewport-options"
2495
2764
  ])) : (openBlock(), createElementBlock("div", {
2496
2765
  key: 1,
2497
2766
  class: normalizeClass(["docs-playground", { "docs-playground--files": activeView.value === "files" }])
2498
- }, [
2499
- error.value ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(error.value), 1)) : createCommentVNode("v-if", true),
2500
- runtimeActivated.value && normalizedViews.value.includes("runtime") ? withDirectives((openBlock(), createBlock(unref(runtime_default), {
2767
+ }, [error.value ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(error.value), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2768
+ showHeader.value ? (openBlock(), createElementBlock("div", _hoisted_2, [displayTitle.value ? (openBlock(), createElementBlock("span", {
2769
+ key: 0,
2770
+ ref_key: "titleEl",
2771
+ ref: titleEl,
2772
+ class: "docs-playground__title",
2773
+ id: titleId.value,
2774
+ tabindex: "-1",
2775
+ title: displayTitle.value
2776
+ }, [createElementVNode("a", {
2777
+ class: "docs-playground__title-anchor",
2778
+ href: `#${titleId.value}`
2779
+ }, "#", 8, _hoisted_4), createElementVNode("span", _hoisted_5, toDisplayString(displayTitle.value), 1)], 8, _hoisted_3)) : createCommentVNode("v-if", true), showToolbar.value ? (openBlock(), createBlock(toolbar_default, {
2780
+ key: 1,
2781
+ "copy-value": copyValue.value,
2782
+ viewport: activeViewport.value,
2783
+ "viewport-options": selectableViewportOptions.value,
2784
+ views: normalizedViews.value,
2785
+ "active-view": activeView.value,
2786
+ "show-runtime-actions": showRuntimeActions.value,
2787
+ "show-open-popup": hasRuntimeView.value,
2788
+ onRefresh: handleRefresh,
2789
+ onEdit: handleEdit,
2790
+ onOpenPopup: handleOpenPopup,
2791
+ onViewportChange: handleViewport,
2792
+ onViewChange: handleView
2793
+ }, null, 8, [
2794
+ "copy-value",
2795
+ "viewport",
2796
+ "viewport-options",
2797
+ "views",
2798
+ "active-view",
2799
+ "show-runtime-actions",
2800
+ "show-open-popup"
2801
+ ])) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true),
2802
+ runtimeActivated.value && hasRuntimeView.value ? withDirectives((openBlock(), createBlock(unref(runtime_default), {
2501
2803
  key: 1,
2804
+ ref_key: "runtimeRef",
2805
+ ref: runtimeRef,
2502
2806
  files: sourceFiles.value,
2503
2807
  entry: currentEntry.value,
2504
2808
  options: __props.options,
2505
2809
  "preview-options": __props.previewOptions,
2506
2810
  "preview-inset": __props.previewInset,
2507
- expand: __props.expand,
2811
+ "preview-scroller": __props.previewScroller,
2812
+ expandable: __props.expandable,
2813
+ "hide-chrome": true,
2814
+ title: __props.title,
2815
+ id: __props.id,
2508
2816
  "active-view": activeView.value,
2509
2817
  views: normalizedViews.value,
2510
2818
  viewport: activeViewport.value,
2511
2819
  "viewport-options": selectableViewportOptions.value,
2512
2820
  onFilesChange: handleFilesChange,
2513
2821
  onNavigate: _cache[1] || (_cache[1] = ($event) => emit("navigate", $event)),
2514
- onViewChange: handleView,
2515
2822
  onViewportChange: handleViewport
2516
2823
  }, null, 8, [
2517
2824
  "files",
@@ -2519,31 +2826,33 @@ var playground_default = /* @__PURE__ */ defineComponent({
2519
2826
  "options",
2520
2827
  "preview-options",
2521
2828
  "preview-inset",
2522
- "expand",
2829
+ "preview-scroller",
2830
+ "expandable",
2831
+ "title",
2832
+ "id",
2523
2833
  "active-view",
2524
2834
  "views",
2525
2835
  "viewport",
2526
2836
  "viewport-options"
2527
- ])), [[vShow, !error.value && activeView.value === "runtime"]]) : createCommentVNode("v-if", true),
2528
- normalizedViews.value.includes("files") ? withDirectives((openBlock(), createBlock(unref(files_preview_default), {
2837
+ ])), [[vShow, activeView.value === "runtime"]]) : createCommentVNode("v-if", true),
2838
+ hasFilesView.value ? withDirectives((openBlock(), createBlock(unref(files_preview_default), {
2529
2839
  key: 2,
2530
2840
  files: sourceFiles.value,
2531
2841
  entry: currentEntry.value,
2532
2842
  "active-filename": fileActiveFilename.value,
2533
2843
  "active-view": activeView.value,
2534
2844
  views: normalizedViews.value,
2535
- onActiveChange: handleFileActive,
2536
- onViewChange: handleView
2845
+ onActiveChange: handleFileActive
2537
2846
  }, null, 8, [
2538
2847
  "files",
2539
2848
  "entry",
2540
2849
  "active-filename",
2541
2850
  "active-view",
2542
2851
  "views"
2543
- ])), [[vShow, !error.value && activeView.value === "files"]]) : createCommentVNode("v-if", true)
2544
- ], 2));
2852
+ ])), [[vShow, activeView.value === "files"]]) : createCommentVNode("v-if", true)
2853
+ ], 64))], 2));
2545
2854
  };
2546
2855
  }
2547
2856
  });
2548
2857
  //#endregion
2549
- export { code_preview_default as CodePreview, DEFAULT_CDN_URL, Editor, playground_default as Playground, applyPlaygroundImportMapOverride, applyPlaygroundStyleOverride, clearPlaygroundMaps, createBuiltinImports, createBuiltinStyles, createRuntimePreviewOptions, getPlaygroundImportMapOverrides, getPlaygroundSiteModules, getPlaygroundSiteStyles, getPlaygroundStyleOverrides, highlightCode, highlightCodeByLanguage, isSafePlaygroundHref, normalizeCdnURL, registerVueHighlight, removePlaygroundImportMapOverride, removePlaygroundStyleOverride, resolveHighlightLanguage, setPlaygroundImportMapOverrides, setPlaygroundSiteModules, setPlaygroundSiteStyles, setPlaygroundStyleOverrides, vueHighlight };
2858
+ export { code_preview_default as CodePreview, DEFAULT_CDN_URL, Editor, PREVIEW_SCROLLER_USE_CODE, PREVIEW_SCROLL_CONTENT_CLASS, PREVIEW_SCROLL_HTML_CLASS, playground_default as Playground, applyPlaygroundImportMapOverride, applyPlaygroundStyleOverride, clearPlaygroundMaps, createBuiltinImports, createBuiltinStyles, createRuntimePreviewOptions, getPlaygroundImportMapOverrides, getPlaygroundSiteModules, getPlaygroundSiteStyles, getPlaygroundStyleOverrides, highlightCode, highlightCodeByLanguage, isSafePlaygroundHref, normalizeCdnURL, registerVueHighlight, removePlaygroundImportMapOverride, removePlaygroundStyleOverride, resolveHighlightLanguage, resolvePlaygroundTitleId, setPlaygroundImportMapOverrides, setPlaygroundSiteModules, setPlaygroundSiteStyles, setPlaygroundStyleOverrides, slugifyPlaygroundTitle, vueHighlight };