@deot/docs-playground 1.1.3 → 1.1.4

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.
Files changed (27) hide show
  1. package/README.md +1 -0
  2. package/dist/{cdn-Czve5_9b.cjs → cdn-BoYKnGD3.cjs} +7 -0
  3. package/dist/{cdn-DEvdGJu2.js → cdn-DQoETju_.js} +2 -1
  4. package/dist/{compile-Bw7v7QE-.js → compile-BHD98Ttf.js} +24 -32
  5. package/dist/{compile-DSMuM8zl.cjs → compile-Da095AyM.cjs} +24 -32
  6. package/dist/{files-C5UMzYxA.js → files-BqucFldk.js} +33 -4
  7. package/dist/{files-D5LNOtjp.cjs → files-BsAOZiPN.cjs} +93 -18
  8. package/dist/index.cjs +35 -30
  9. package/dist/index.js +35 -30
  10. package/dist/index.style.css +1 -1
  11. package/dist/{linker-B--sjERT.cjs → linker-DIpEiean.cjs} +2 -2
  12. package/dist/{linker-JHdz37DK.js → linker-xqjVl0X0.js} +2 -2
  13. package/dist/{local-sandbox-DnkKrBhf.cjs → local-sandbox-0ojvBQPO.cjs} +12 -8
  14. package/dist/{local-sandbox-B8IJ5jWb.js → local-sandbox-DvcgaBOa.js} +14 -21
  15. package/dist/{modules-DlLJF_vd.js → modules-BGzPcoRR.js} +7 -1
  16. package/dist/{modules-CInmL-8h.cjs → modules-E6kK6ZJH.cjs} +7 -1
  17. package/dist/{remote-CKMzn1J3.cjs → remote-BG0E1Ugo.cjs} +67 -21
  18. package/dist/{remote-DfXAsO9n.js → remote-mq4zvrI1.js} +67 -21
  19. package/dist/script-BiCcpu3G.cjs +111 -0
  20. package/dist/script-DjUf9uWK.js +98 -0
  21. package/dist/{scss-DaIqB_qT.cjs → scss-B8OFbz1k.cjs} +23 -5
  22. package/dist/{scss-Co2it4vB.js → scss-DIh6971q.js} +18 -6
  23. package/dist/{store-D8vwi-HV.js → store-BOyC8F2y.js} +149 -6
  24. package/dist/{store-BF7z-oaO.cjs → store-DKawhFZu.cjs} +151 -6
  25. package/package.json +8 -7
  26. package/dist/script-5Xzzx7u5.cjs +0 -57
  27. package/dist/script-xKUjE8pf.js +0 -46
package/README.md CHANGED
@@ -156,6 +156,7 @@ const handleMessage = async () => {
156
156
  - Playground 运行时通过公共 CDN 加载 Vue 和默认 import map 中的依赖,手工预览需要网络访问。
157
157
  - 默认 CDN 为 `https://cdn.jsdelivr.net/npm`,可通过 `options.cdnURL` 换成 unpkg 等兼容 `/{package}/{file}` 路径的镜像;该地址用于预览样式和内置 import map。
158
158
  - `lodash-es` 和在线 Sass 编译器使用 jsDelivr 的 `/+esm` 入口;unpkg 等 CDN 不支持该路径。
159
+ - 直接渲染时,未配置的 npm 模块(含作用域包和子路径)自动从 jsDelivr 的 `/+esm` 入口加载;组件包的传递依赖也适用,`import()` 在调用时加载。`@deot/vc` 的组件、hooks 和 locale 走远程模块加载器,Vue 保持与宿主共用。可用 `options.builtinImportMap.imports` 指定依赖的版本和 URL。
159
160
  - Vue SFC 的 `<style lang="scss">` / `lang="sass"` 以及独立 `.scss` / `.sass` 文件会在浏览器里编译;`_partial.scss` 只作为 `@use` 依赖。
160
161
  - `options.builtinImportMap.imports` 可以覆盖默认模块 URL。Vue 运行时仍从 `play.vuejs.org` 加载。
161
162
  - 每个 Playground 实例都使用自己的 preview 配置和 iframe 消息来源校验。
@@ -49,6 +49,7 @@ var createBuiltinImports = (cdnURL = DEFAULT_CDN_URL) => ({
49
49
  "lodash-es": jsdelivrEsmURL("lodash-es/+esm")
50
50
  });
51
51
  var createBuiltinStyles = (cdnURL = DEFAULT_CDN_URL) => Object.fromEntries(PREVIEW_STYLE_ASSETS.map((asset) => [asset, cdnAsset(cdnURL, asset)]));
52
+ var resolveNpmImport = (specifier) => /^https?:\/\//.test(specifier) ? specifier : jsdelivrEsmURL(`${specifier}/+esm`);
52
53
  //#endregion
53
54
  Object.defineProperty(exports, "DEFAULT_CDN_URL", {
54
55
  enumerable: true,
@@ -92,3 +93,9 @@ Object.defineProperty(exports, "normalizeCdnURL", {
92
93
  return normalizeCdnURL;
93
94
  }
94
95
  });
96
+ Object.defineProperty(exports, "resolveNpmImport", {
97
+ enumerable: true,
98
+ get: function() {
99
+ return resolveNpmImport;
100
+ }
101
+ });
@@ -49,5 +49,6 @@ var createBuiltinImports = (cdnURL = DEFAULT_CDN_URL) => ({
49
49
  "lodash-es": jsdelivrEsmURL("lodash-es/+esm")
50
50
  });
51
51
  var createBuiltinStyles = (cdnURL = DEFAULT_CDN_URL) => Object.fromEntries(PREVIEW_STYLE_ASSETS.map((asset) => [asset, cdnAsset(cdnURL, asset)]));
52
+ var resolveNpmImport = (specifier) => /^https?:\/\//.test(specifier) ? specifier : jsdelivrEsmURL(`${specifier}/+esm`);
52
53
  //#endregion
53
- export { DEFAULT_CDN_URL as a, normalizeCdnURL as i, createBuiltinImports as n, DEFAULT_ENTRY as o, createBuiltinStyles as r, NEW_SFC_CODE as s, SASS_CDN_URL as t };
54
+ export { resolveNpmImport as a, NEW_SFC_CODE as c, normalizeCdnURL as i, createBuiltinImports as n, DEFAULT_CDN_URL as o, createBuiltinStyles as r, DEFAULT_ENTRY as s, SASS_CDN_URL as t };
@@ -1,7 +1,7 @@
1
- import { n as compileScssSource } from "./scss-Co2it4vB.js";
2
- import { collectReachableFilenames, createFileIndex, getExtension, normalizeVirtualPath, resolveEntry } from "./files-C5UMzYxA.js";
3
- import { n as transformScript } from "./script-xKUjE8pf.js";
4
- import { n as collectCss } from "./local-sandbox-B8IJ5jWb.js";
1
+ import { d as resolveEntry, n as collectReachableFilenames, o as getExtension, r as createFileIndex, u as normalizeVirtualPath } from "./files-BqucFldk.js";
2
+ import { n as compileScssSource, r as extractScssExports } from "./scss-DIh6971q.js";
3
+ import { n as transformScript } from "./script-DjUf9uWK.js";
4
+ import { n as collectCss } from "./local-sandbox-DvcgaBOa.js";
5
5
  import { compileString } from "sass";
6
6
  //#region packages/playground/src/core/runtime/local/compile/scss.ts
7
7
  /**
@@ -216,10 +216,10 @@ var compileOne = async (filename, code, files) => {
216
216
  errors
217
217
  };
218
218
  if (ext === ".scss" || ext === ".sass") try {
219
- const css = compileLocalScss(code, filename, files);
219
+ const { css, exports: styleExports } = extractScssExports(compileLocalScss(code, filename, files), filename);
220
220
  return {
221
221
  filename,
222
- js: `exports.default = {};\n//# sourceURL=playground://${filename}`,
222
+ js: `exports.__esModule = true; exports.default = ${JSON.stringify(styleExports)};\n//# sourceURL=playground://${filename}`,
223
223
  css,
224
224
  errors
225
225
  };
@@ -248,32 +248,24 @@ var compileOne = async (filename, code, files) => {
248
248
  errors
249
249
  };
250
250
  }
251
- if (ext === ".js" || ext === ".ts" || ext === ".jsx" || ext === ".tsx") {
252
- if (ext === ".jsx" || ext === ".tsx") {
253
- errors.push(`[Playground] JSX/TSX 暂不支持: ${filename}`);
254
- return {
255
- filename,
256
- js: "exports.default = {};",
257
- css: "",
258
- errors
259
- };
260
- }
261
- try {
262
- return {
263
- filename,
264
- js: transformScript(code, filename, { typescript: ext === ".ts" }),
265
- css: "",
266
- errors
267
- };
268
- } catch (error) {
269
- errors.push(messageOf(error));
270
- return {
271
- filename,
272
- js: "exports.default = {};",
273
- css: "",
274
- errors
275
- };
276
- }
251
+ if (ext === ".js" || ext === ".ts" || ext === ".jsx" || ext === ".tsx") try {
252
+ return {
253
+ filename,
254
+ js: transformScript(code, filename, {
255
+ typescript: ext === ".ts" || ext === ".tsx",
256
+ jsx: ext === ".jsx" || ext === ".tsx"
257
+ }),
258
+ css: "",
259
+ errors
260
+ };
261
+ } catch (error) {
262
+ errors.push(messageOf(error));
263
+ return {
264
+ filename,
265
+ js: "exports.default = {};",
266
+ css: "",
267
+ errors
268
+ };
277
269
  }
278
270
  errors.push(`[Playground] 不支持的文件类型: ${filename}`);
279
271
  return {
@@ -1,7 +1,7 @@
1
- const require_scss = require("./scss-DaIqB_qT.cjs");
2
- const require_files = require("./files-D5LNOtjp.cjs");
3
- const require_script = require("./script-5Xzzx7u5.cjs");
4
- const require_local_sandbox = require("./local-sandbox-DnkKrBhf.cjs");
1
+ const require_scss = require("./scss-B8OFbz1k.cjs");
2
+ const require_files = require("./files-BsAOZiPN.cjs");
3
+ const require_script = require("./script-BiCcpu3G.cjs");
4
+ const require_local_sandbox = require("./local-sandbox-0ojvBQPO.cjs");
5
5
  let sass = require("sass");
6
6
  //#region packages/playground/src/core/runtime/local/compile/scss.ts
7
7
  /**
@@ -216,10 +216,10 @@ var compileOne = async (filename, code, files) => {
216
216
  errors
217
217
  };
218
218
  if (ext === ".scss" || ext === ".sass") try {
219
- const css = compileLocalScss(code, filename, files);
219
+ const { css, exports: styleExports } = require_scss.extractScssExports(compileLocalScss(code, filename, files), filename);
220
220
  return {
221
221
  filename,
222
- js: `exports.default = {};\n//# sourceURL=playground://${filename}`,
222
+ js: `exports.__esModule = true; exports.default = ${JSON.stringify(styleExports)};\n//# sourceURL=playground://${filename}`,
223
223
  css,
224
224
  errors
225
225
  };
@@ -248,32 +248,24 @@ var compileOne = async (filename, code, files) => {
248
248
  errors
249
249
  };
250
250
  }
251
- if (ext === ".js" || ext === ".ts" || ext === ".jsx" || ext === ".tsx") {
252
- if (ext === ".jsx" || ext === ".tsx") {
253
- errors.push(`[Playground] JSX/TSX 暂不支持: ${filename}`);
254
- return {
255
- filename,
256
- js: "exports.default = {};",
257
- css: "",
258
- errors
259
- };
260
- }
261
- try {
262
- return {
263
- filename,
264
- js: require_script.transformScript(code, filename, { typescript: ext === ".ts" }),
265
- css: "",
266
- errors
267
- };
268
- } catch (error) {
269
- errors.push(messageOf(error));
270
- return {
271
- filename,
272
- js: "exports.default = {};",
273
- css: "",
274
- errors
275
- };
276
- }
251
+ if (ext === ".js" || ext === ".ts" || ext === ".jsx" || ext === ".tsx") try {
252
+ return {
253
+ filename,
254
+ js: require_script.transformScript(code, filename, {
255
+ typescript: ext === ".ts" || ext === ".tsx",
256
+ jsx: ext === ".jsx" || ext === ".tsx"
257
+ }),
258
+ css: "",
259
+ errors
260
+ };
261
+ } catch (error) {
262
+ errors.push(messageOf(error));
263
+ return {
264
+ filename,
265
+ js: "exports.default = {};",
266
+ css: "",
267
+ errors
268
+ };
277
269
  }
278
270
  errors.push(`[Playground] 不支持的文件类型: ${filename}`);
279
271
  return {
@@ -1,7 +1,36 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
1
13
  //#region packages/playground/src/core/runtime/local/compile/types.ts
2
14
  var IGNORED_FILENAMES = /* @__PURE__ */ new Set(["import-map.json", "tsconfig.json"]);
3
15
  //#endregion
4
16
  //#region packages/playground/src/core/runtime/local/compile/files.ts
17
+ var files_exports = /* @__PURE__ */ __exportAll({
18
+ basename: () => basename,
19
+ collectBareSpecifiers: () => collectBareSpecifiers,
20
+ collectReachableFilenames: () => collectReachableFilenames,
21
+ createFileIndex: () => createFileIndex,
22
+ dirname: () => dirname,
23
+ getCommonRoot: () => getCommonRoot,
24
+ getExtension: () => getExtension,
25
+ isIgnoredFilename: () => isIgnoredFilename,
26
+ isInsideRoot: () => isInsideRoot,
27
+ isRelativeSpecifier: () => isRelativeSpecifier,
28
+ joinVirtualPath: () => joinVirtualPath,
29
+ listImportSpecifiers: () => listImportSpecifiers,
30
+ normalizeVirtualPath: () => normalizeVirtualPath,
31
+ resolveEntry: () => resolveEntry,
32
+ resolveModulePath: () => resolveModulePath
33
+ });
5
34
  /**
6
35
  * 统一成以 `/` 开头的 POSIX 绝对虚拟路径。
7
36
  * `App.vue` 与 `/App.vue` 是同一文件,和 iframe 预览使用的 files 键一致。
@@ -91,7 +120,7 @@ var CANDIDATE_EXTENSIONS = [
91
120
  * @returns 解析后的 files 键;找不到时返回 null。
92
121
  */
93
122
  var resolveModulePath = (fromFilename, specifier, fileIndex) => {
94
- if (!specifier || !(specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/"))) return null;
123
+ if (!specifier || !(specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/"))) return null;
95
124
  const target = joinVirtualPath(dirname(fromFilename), specifier);
96
125
  if (fileIndex.has(target)) return target;
97
126
  for (const ext of CANDIDATE_EXTENSIONS) {
@@ -137,7 +166,7 @@ var listImportSpecifiers = (code) => {
137
166
  for (const match of source.matchAll(/(?:\bfrom\s+|import\s*\(\s*|import\s+)['"]([^'"]+)['"]/gu)) if (match[1]) result.push(match[1]);
138
167
  return result;
139
168
  };
140
- var isRelativeSpecifier = (id) => id.startsWith("./") || id.startsWith("../") || id.startsWith("/");
169
+ var isRelativeSpecifier = (id) => id === "." || id === ".." || id.startsWith("./") || id.startsWith("../") || id.startsWith("/");
141
170
  /**
142
171
  * 从入口出发只编译静态 import 能走到的文件。
143
172
  * @param files 当前 Playground 文件表。
@@ -167,7 +196,7 @@ var collectBareSpecifiers = (files, filenames) => {
167
196
  const seen = /* @__PURE__ */ new Set();
168
197
  filenames.forEach((filename) => {
169
198
  listImportSpecifiers(index.get(normalizeVirtualPath(filename)) || "").forEach((specifier) => {
170
- if (!specifier || isRelativeSpecifier(specifier) || seen.has(specifier)) return;
199
+ if (!specifier || isRelativeSpecifier(specifier) || seen.has(specifier) || /\.(?:css|scss|sass)(?:[?#]|$)/.test(specifier)) return;
171
200
  seen.add(specifier);
172
201
  result.push(specifier);
173
202
  });
@@ -175,4 +204,4 @@ var collectBareSpecifiers = (files, filenames) => {
175
204
  return result;
176
205
  };
177
206
  //#endregion
178
- export { basename, collectBareSpecifiers, collectReachableFilenames, createFileIndex, dirname, getCommonRoot, getExtension, isIgnoredFilename, isInsideRoot, isRelativeSpecifier, joinVirtualPath, listImportSpecifiers, normalizeVirtualPath, resolveEntry, resolveModulePath };
207
+ export { getCommonRoot as a, isInsideRoot as c, resolveEntry as d, resolveModulePath as f, files_exports as i, isRelativeSpecifier as l, collectReachableFilenames as n, getExtension as o, __exportAll as p, createFileIndex as r, isIgnoredFilename as s, collectBareSpecifiers as t, normalizeVirtualPath as u };
@@ -1,7 +1,25 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
1
2
  //#region packages/playground/src/core/runtime/local/compile/types.ts
2
3
  var IGNORED_FILENAMES = /* @__PURE__ */ new Set(["import-map.json", "tsconfig.json"]);
3
4
  //#endregion
4
5
  //#region packages/playground/src/core/runtime/local/compile/files.ts
6
+ var files_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
7
+ basename: () => basename,
8
+ collectBareSpecifiers: () => collectBareSpecifiers,
9
+ collectReachableFilenames: () => collectReachableFilenames,
10
+ createFileIndex: () => createFileIndex,
11
+ dirname: () => dirname,
12
+ getCommonRoot: () => getCommonRoot,
13
+ getExtension: () => getExtension,
14
+ isIgnoredFilename: () => isIgnoredFilename,
15
+ isInsideRoot: () => isInsideRoot,
16
+ isRelativeSpecifier: () => isRelativeSpecifier,
17
+ joinVirtualPath: () => joinVirtualPath,
18
+ listImportSpecifiers: () => listImportSpecifiers,
19
+ normalizeVirtualPath: () => normalizeVirtualPath,
20
+ resolveEntry: () => resolveEntry,
21
+ resolveModulePath: () => resolveModulePath
22
+ });
5
23
  /**
6
24
  * 统一成以 `/` 开头的 POSIX 绝对虚拟路径。
7
25
  * `App.vue` 与 `/App.vue` 是同一文件,和 iframe 预览使用的 files 键一致。
@@ -91,7 +109,7 @@ var CANDIDATE_EXTENSIONS = [
91
109
  * @returns 解析后的 files 键;找不到时返回 null。
92
110
  */
93
111
  var resolveModulePath = (fromFilename, specifier, fileIndex) => {
94
- if (!specifier || !(specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/"))) return null;
112
+ if (!specifier || !(specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/"))) return null;
95
113
  const target = joinVirtualPath(dirname(fromFilename), specifier);
96
114
  if (fileIndex.has(target)) return target;
97
115
  for (const ext of CANDIDATE_EXTENSIONS) {
@@ -137,7 +155,7 @@ var listImportSpecifiers = (code) => {
137
155
  for (const match of source.matchAll(/(?:\bfrom\s+|import\s*\(\s*|import\s+)['"]([^'"]+)['"]/gu)) if (match[1]) result.push(match[1]);
138
156
  return result;
139
157
  };
140
- var isRelativeSpecifier = (id) => id.startsWith("./") || id.startsWith("../") || id.startsWith("/");
158
+ var isRelativeSpecifier = (id) => id === "." || id === ".." || id.startsWith("./") || id.startsWith("../") || id.startsWith("/");
141
159
  /**
142
160
  * 从入口出发只编译静态 import 能走到的文件。
143
161
  * @param files 当前 Playground 文件表。
@@ -167,7 +185,7 @@ var collectBareSpecifiers = (files, filenames) => {
167
185
  const seen = /* @__PURE__ */ new Set();
168
186
  filenames.forEach((filename) => {
169
187
  listImportSpecifiers(index.get(normalizeVirtualPath(filename)) || "").forEach((specifier) => {
170
- if (!specifier || isRelativeSpecifier(specifier) || seen.has(specifier)) return;
188
+ if (!specifier || isRelativeSpecifier(specifier) || seen.has(specifier) || /\.(?:css|scss|sass)(?:[?#]|$)/.test(specifier)) return;
171
189
  seen.add(specifier);
172
190
  result.push(specifier);
173
191
  });
@@ -175,18 +193,75 @@ var collectBareSpecifiers = (files, filenames) => {
175
193
  return result;
176
194
  };
177
195
  //#endregion
178
- exports.basename = basename;
179
- exports.collectBareSpecifiers = collectBareSpecifiers;
180
- exports.collectReachableFilenames = collectReachableFilenames;
181
- exports.createFileIndex = createFileIndex;
182
- exports.dirname = dirname;
183
- exports.getCommonRoot = getCommonRoot;
184
- exports.getExtension = getExtension;
185
- exports.isIgnoredFilename = isIgnoredFilename;
186
- exports.isInsideRoot = isInsideRoot;
187
- exports.isRelativeSpecifier = isRelativeSpecifier;
188
- exports.joinVirtualPath = joinVirtualPath;
189
- exports.listImportSpecifiers = listImportSpecifiers;
190
- exports.normalizeVirtualPath = normalizeVirtualPath;
191
- exports.resolveEntry = resolveEntry;
192
- exports.resolveModulePath = resolveModulePath;
196
+ Object.defineProperty(exports, "collectBareSpecifiers", {
197
+ enumerable: true,
198
+ get: function() {
199
+ return collectBareSpecifiers;
200
+ }
201
+ });
202
+ Object.defineProperty(exports, "collectReachableFilenames", {
203
+ enumerable: true,
204
+ get: function() {
205
+ return collectReachableFilenames;
206
+ }
207
+ });
208
+ Object.defineProperty(exports, "createFileIndex", {
209
+ enumerable: true,
210
+ get: function() {
211
+ return createFileIndex;
212
+ }
213
+ });
214
+ Object.defineProperty(exports, "files_exports", {
215
+ enumerable: true,
216
+ get: function() {
217
+ return files_exports;
218
+ }
219
+ });
220
+ Object.defineProperty(exports, "getCommonRoot", {
221
+ enumerable: true,
222
+ get: function() {
223
+ return getCommonRoot;
224
+ }
225
+ });
226
+ Object.defineProperty(exports, "getExtension", {
227
+ enumerable: true,
228
+ get: function() {
229
+ return getExtension;
230
+ }
231
+ });
232
+ Object.defineProperty(exports, "isIgnoredFilename", {
233
+ enumerable: true,
234
+ get: function() {
235
+ return isIgnoredFilename;
236
+ }
237
+ });
238
+ Object.defineProperty(exports, "isInsideRoot", {
239
+ enumerable: true,
240
+ get: function() {
241
+ return isInsideRoot;
242
+ }
243
+ });
244
+ Object.defineProperty(exports, "isRelativeSpecifier", {
245
+ enumerable: true,
246
+ get: function() {
247
+ return isRelativeSpecifier;
248
+ }
249
+ });
250
+ Object.defineProperty(exports, "normalizeVirtualPath", {
251
+ enumerable: true,
252
+ get: function() {
253
+ return normalizeVirtualPath;
254
+ }
255
+ });
256
+ Object.defineProperty(exports, "resolveEntry", {
257
+ enumerable: true,
258
+ get: function() {
259
+ return resolveEntry;
260
+ }
261
+ });
262
+ Object.defineProperty(exports, "resolveModulePath", {
263
+ enumerable: true,
264
+ get: function() {
265
+ return resolveModulePath;
266
+ }
267
+ });
package/dist/index.cjs CHANGED
@@ -1,8 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
3
- const require_cdn = require("./cdn-Czve5_9b.cjs");
4
- const require_store = require("./store-BF7z-oaO.cjs");
5
- const require_scss = require("./scss-DaIqB_qT.cjs");
3
+ const require_cdn = require("./cdn-BoYKnGD3.cjs");
4
+ const require_store = require("./store-DKawhFZu.cjs");
5
+ const require_scss = require("./scss-B8OFbz1k.cjs");
6
+ const require_files = require("./files-BsAOZiPN.cjs");
6
7
  let vue = require("vue");
7
8
  let _deot_vc = require("@deot/vc");
8
9
  let _deot_docs_locale = require("@deot/docs-locale");
@@ -439,7 +440,7 @@ var _hoisted_5$4 = ["onKeydown"];
439
440
  var _hoisted_6$3 = ["title"];
440
441
  var _hoisted_7$3 = ["title", "aria-label"];
441
442
  var _hoisted_8$2 = ["title", "aria-label"];
442
- var _hoisted_9$2 = { class: "docs-playground-editor__actions" };
443
+ var _hoisted_9$1 = { class: "docs-playground-editor__actions" };
443
444
  var _hoisted_10$1 = ["title"];
444
445
  var _hoisted_11$1 = ["title", "disabled"];
445
446
  var _hoisted_12$1 = {
@@ -755,7 +756,7 @@ var editor_default = /* @__PURE__ */ (0, vue.defineComponent)({
755
756
  ], 64))], 42, _hoisted_4$4);
756
757
  }), 128))]),
757
758
  _: 1
758
- }, 512), (0, vue.createElementVNode)("div", _hoisted_9$2, [(0, vue.createElementVNode)("button", {
759
+ }, 512), (0, vue.createElementVNode)("div", _hoisted_9$1, [(0, vue.createElementVNode)("button", {
759
760
  type: "button",
760
761
  title: (0, vue.unref)(t)("playground.editor.createFile"),
761
762
  onClick: handleCreate
@@ -1187,7 +1188,7 @@ var _hoisted_8$1 = {
1187
1188
  class: "docs-playground__tool-divider",
1188
1189
  "aria-hidden": "true"
1189
1190
  };
1190
- var _hoisted_9$1 = ["aria-label"];
1191
+ var _hoisted_9 = ["aria-label"];
1191
1192
  var _hoisted_10 = [
1192
1193
  "title",
1193
1194
  "aria-label",
@@ -1360,7 +1361,7 @@ var toolbar_default = /* @__PURE__ */ (0, vue.defineComponent)({
1360
1361
  "aria-pressed": item === __props.activeView,
1361
1362
  onClick: ($event) => emit("view-change", item)
1362
1363
  }, (0, vue.toDisplayString)(getViewLabel(item)), 11, _hoisted_10);
1363
- }), 128))], 8, _hoisted_9$1)) : (0, vue.createCommentVNode)("v-if", true),
1364
+ }), 128))], 8, _hoisted_9)) : (0, vue.createCommentVNode)("v-if", true),
1364
1365
  __props.showClose && (__props.showRuntimeActions || showViews.value) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_11)) : (0, vue.createCommentVNode)("v-if", true),
1365
1366
  __props.showClose ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
1366
1367
  key: 3,
@@ -1425,7 +1426,7 @@ var wrapper_default = /* @__PURE__ */ (0, vue.defineComponent)({
1425
1426
  "portal-fulfilled"
1426
1427
  ],
1427
1428
  setup(__props, { emit: __emit }) {
1428
- const LocalSandbox = (0, vue.defineAsyncComponent)(() => Promise.resolve().then(() => require("./local-sandbox-DnkKrBhf.cjs")).then((n) => n.local_sandbox_exports));
1429
+ const LocalSandbox = (0, vue.defineAsyncComponent)(() => Promise.resolve().then(() => require("./local-sandbox-0ojvBQPO.cjs")).then((n) => n.local_sandbox_exports));
1429
1430
  const props = __props;
1430
1431
  const emit = __emit;
1431
1432
  const { t } = (0, _deot_docs_locale.useLocale)();
@@ -1607,26 +1608,25 @@ var Alone = new _deot_vc.Portal(wrapper_default, {
1607
1608
  });
1608
1609
  //#endregion
1609
1610
  //#region packages/playground/src/core/runtime/runtime.vue?vue&type=script&setup=true&lang.ts
1610
- var _hoisted_1$1 = { class: "docs-playground-runtime-host" };
1611
- var _hoisted_2$1 = {
1611
+ var _hoisted_1$1 = {
1612
1612
  key: 0,
1613
1613
  class: "docs-playground__runtime-error",
1614
1614
  role: "alert"
1615
1615
  };
1616
- var _hoisted_3$1 = {
1616
+ var _hoisted_2$1 = {
1617
1617
  key: 0,
1618
1618
  class: "docs-playground__header"
1619
1619
  };
1620
- var _hoisted_4$1 = ["id", "title"];
1621
- var _hoisted_5$1 = ["href"];
1622
- var _hoisted_6 = { class: "docs-playground__title-text" };
1623
- var _hoisted_7 = {
1620
+ var _hoisted_3$1 = ["id", "title"];
1621
+ var _hoisted_4$1 = ["href"];
1622
+ var _hoisted_5$1 = { class: "docs-playground__title-text" };
1623
+ var _hoisted_6 = {
1624
1624
  key: 1,
1625
1625
  class: "docs-playground__runtime-error",
1626
1626
  role: "alert"
1627
1627
  };
1628
- var _hoisted_8 = { class: "docs-playground-runtime__viewport-stage" };
1629
- var _hoisted_9 = [
1628
+ var _hoisted_7 = { class: "docs-playground-runtime__viewport-stage" };
1629
+ var _hoisted_8 = [
1630
1630
  "aria-expanded",
1631
1631
  "title",
1632
1632
  "aria-label"
@@ -1672,7 +1672,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1672
1672
  "navigate"
1673
1673
  ],
1674
1674
  setup(__props, { expose: __expose, emit: __emit }) {
1675
- const LocalSandbox = (0, vue.defineAsyncComponent)(() => Promise.resolve().then(() => require("./local-sandbox-DnkKrBhf.cjs")).then((n) => n.local_sandbox_exports));
1675
+ const LocalSandbox = (0, vue.defineAsyncComponent)(() => Promise.resolve().then(() => require("./local-sandbox-0ojvBQPO.cjs")).then((n) => n.local_sandbox_exports));
1676
1676
  const props = __props;
1677
1677
  const { locale, t } = (0, _deot_docs_locale.useLocale)();
1678
1678
  const displayTitle = (0, vue.computed)(() => props.title.trim());
@@ -1711,6 +1711,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1711
1711
  }.MODE !== "development";
1712
1712
  const copyValue = (0, vue.computed)(() => props.files[props.entry] || "");
1713
1713
  const store = props.local ? null : require_store.createRuntimeStore(props.files, props.entry, props.options);
1714
+ const storeReady = (0, vue.computed)(() => store && !store.loading && Object.values(store.files).every((file) => require_files.isIgnoredFilename(file.filename) || !/\.(?:vue|[jt]sx?|json|s[ac]ss)$/.test(file.filename) || !file.code.trim() || !!file.compiled.js));
1714
1715
  const sandboxRef = (0, vue.ref)(null);
1715
1716
  const localError = (0, vue.ref)({
1716
1717
  compile: "",
@@ -1937,13 +1938,13 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1937
1938
  openPopup: handleOpenPopup
1938
1939
  });
1939
1940
  return (_ctx, _cache) => {
1940
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$1, [__props.styleless ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1941
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)(["docs-playground-runtime-host", { "docs-playground-runtime-host--direct": __props.local && __props.styleless }]) }, [__props.styleless ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1941
1942
  key: 0,
1942
1943
  ref_key: "runtimeRoot",
1943
1944
  ref: runtimeRoot,
1944
1945
  class: "docs-playground-runtime--styleless",
1945
1946
  style: (0, vue.normalizeStyle)(stylelessStyle.value)
1946
- }, [errorText.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("pre", _hoisted_2$1, (0, vue.toDisplayString)(errorText.value), 1)) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createElementVNode)("div", {
1947
+ }, [errorText.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("pre", _hoisted_1$1, (0, vue.toDisplayString)(errorText.value), 1)) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createElementVNode)("div", {
1947
1948
  class: "docs-playground-runtime__viewport",
1948
1949
  style: (0, vue.normalizeStyle)(viewportStyle.value)
1949
1950
  }, [__props.local ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(LocalSandbox), {
@@ -1955,13 +1956,15 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1955
1956
  options: __props.options,
1956
1957
  "preview-scroller": __props.previewScroller,
1957
1958
  "clear-console": clearConsole,
1959
+ "auto-height": !(0, vue.unref)(getViewportHeight)(__props.viewport),
1958
1960
  onError: handleLocalError
1959
1961
  }, null, 8, [
1960
1962
  "files",
1961
1963
  "entry",
1962
1964
  "options",
1963
- "preview-scroller"
1964
- ])) : (0, vue.unref)(store) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_vue_repl.Sandbox), {
1965
+ "preview-scroller",
1966
+ "auto-height"
1967
+ ])) : (0, vue.unref)(store) && storeReady.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_vue_repl.Sandbox), {
1965
1968
  key: 1,
1966
1969
  ref_key: "sandboxRef",
1967
1970
  ref: sandboxRef,
@@ -1974,7 +1977,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1974
1977
  ref: runtimeRoot,
1975
1978
  class: "docs-playground-runtime"
1976
1979
  }, [
1977
- !__props.hideChrome ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$1, [displayTitle.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
1980
+ !__props.hideChrome ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_2$1, [displayTitle.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
1978
1981
  key: 0,
1979
1982
  ref_key: "titleEl",
1980
1983
  ref: titleEl,
@@ -1985,7 +1988,7 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1985
1988
  }, [(0, vue.createElementVNode)("a", {
1986
1989
  class: "docs-playground__title-anchor",
1987
1990
  href: `#${titleId.value}`
1988
- }, "#", 8, _hoisted_5$1), (0, vue.createElementVNode)("span", _hoisted_6, (0, vue.toDisplayString)(displayTitle.value), 1)], 8, _hoisted_4$1)) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createVNode)(toolbar_default, {
1991
+ }, "#", 8, _hoisted_4$1), (0, vue.createElementVNode)("span", _hoisted_5$1, (0, vue.toDisplayString)(displayTitle.value), 1)], 8, _hoisted_3$1)) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createVNode)(toolbar_default, {
1989
1992
  "copy-value": copyValue.value,
1990
1993
  viewport: __props.viewport,
1991
1994
  "viewport-options": __props.viewportOptions,
@@ -1999,11 +2002,11 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
1999
2002
  "viewport",
2000
2003
  "viewport-options"
2001
2004
  ])])) : (0, vue.createCommentVNode)("v-if", true),
2002
- errorText.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("pre", _hoisted_7, (0, vue.toDisplayString)(errorText.value), 1)) : (0, vue.createCommentVNode)("v-if", true),
2005
+ errorText.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("pre", _hoisted_6, (0, vue.toDisplayString)(errorText.value), 1)) : (0, vue.createCommentVNode)("v-if", true),
2003
2006
  (0, vue.createElementVNode)("section", {
2004
2007
  class: (0, vue.normalizeClass)(["docs-playground__preview", { "is-expanded": previewExpanded.value }]),
2005
2008
  style: (0, vue.normalizeStyle)(previewStyle.value)
2006
- }, [(0, vue.createElementVNode)("div", _hoisted_8, [(0, vue.createElementVNode)("div", {
2009
+ }, [(0, vue.createElementVNode)("div", _hoisted_7, [(0, vue.createElementVNode)("div", {
2007
2010
  class: "docs-playground-runtime__viewport",
2008
2011
  style: (0, vue.normalizeStyle)(viewportStyle.value)
2009
2012
  }, [__props.local ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(LocalSandbox), {
@@ -2015,13 +2018,15 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
2015
2018
  options: __props.options,
2016
2019
  "preview-scroller": __props.previewScroller,
2017
2020
  "clear-console": clearConsole,
2021
+ "auto-height": !(0, vue.unref)(getViewportHeight)(__props.viewport),
2018
2022
  onError: handleLocalError
2019
2023
  }, null, 8, [
2020
2024
  "files",
2021
2025
  "entry",
2022
2026
  "options",
2023
- "preview-scroller"
2024
- ])) : (0, vue.unref)(store) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_vue_repl.Sandbox), {
2027
+ "preview-scroller",
2028
+ "auto-height"
2029
+ ])) : (0, vue.unref)(store) && storeReady.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_vue_repl.Sandbox), {
2025
2030
  key: sandboxKey.value,
2026
2031
  ref_key: "sandboxRef",
2027
2032
  ref: sandboxRef,
@@ -2038,8 +2043,8 @@ var runtime_default = /* @__PURE__ */ (0, vue.defineComponent)({
2038
2043
  title: expandLabel.value,
2039
2044
  "aria-label": expandLabel.value,
2040
2045
  onClick: handleTogglePreviewExpand
2041
- }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: "expand" })], 10, _hoisted_9)) : (0, vue.createCommentVNode)("v-if", true)], 6)
2042
- ], 512))]);
2046
+ }, [(0, vue.createVNode)((0, vue.unref)(icon_default), { name: "expand" })], 10, _hoisted_8)) : (0, vue.createCommentVNode)("v-if", true)], 6)
2047
+ ], 512))], 2);
2043
2048
  };
2044
2049
  }
2045
2050
  });