@deot/docs-client 1.1.4 → 1.1.6

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 (79) hide show
  1. package/README.md +86 -1
  2. package/dist/chunks/{compile-Bw7v7QE--Dd1-R95H.js → compile-CM_OyqYN-Bd7bk_OB.js} +1711 -2816
  3. package/dist/chunks/{compiler-sfc.esm-browser-B4_kBkG5.js → compiler-sfc.esm-browser-5dA1IWMJ.js} +185 -305
  4. package/dist/chunks/{script-xKUjE8pf-oF69rg-w.js → css-DleINdoA-FdeEznDX.js} +2669 -2480
  5. package/dist/chunks/{dist-DlmO7OlF.js → dist-B44jICwZ.js} +1 -1
  6. package/dist/chunks/{dist-COjpr4FU.js → dist-DHJhaOSs.js} +2 -2
  7. package/dist/chunks/{dist-C8z9l0mA.js → dist-DSypl37f.js} +1 -1
  8. package/dist/chunks/dist-DWn6r6un.js +76 -0
  9. package/dist/chunks/{dist-CuJyl-ef.js → dist-Wm6vE6kM.js} +8 -8
  10. package/dist/chunks/{echarts-Dk-pu7GM.js → echarts-BBzcOaek.js} +1075 -1290
  11. package/dist/chunks/{html2canvas-Deo0mM5K.js → html2canvas-DoKTvaOT.js} +3 -13
  12. package/dist/chunks/{index.es-UlJ0gfdF.js → index.es-wVPQxEPP.js} +32 -37
  13. package/dist/chunks/{jspdf.es.min-CJc40v7q.js → jspdf.es.min-Zm27YeAg.js} +1080 -1053
  14. package/dist/chunks/{jsx-CwMPlI4_-CAiik-V7.js → jsx-CwMPlI4_-CBhlIHLh.js} +8002 -8541
  15. package/dist/chunks/{jszip.min-BbVwZKYP.js → jszip.min-Da8UgalE.js} +5 -5
  16. package/dist/chunks/{lodash-Cxf6dD_I.js → lodash-CYyW02I7.js} +10 -14
  17. package/dist/chunks/{photoswipe.esm-B0V-xGTB.js → photoswipe.esm-D52MAtDT.js} +11 -38
  18. package/dist/chunks/{purify.es-BiqY1C6m.js → purify.es-DhHsvqCe.js} +1 -23
  19. package/dist/chunks/{vue-router-C0mj8Ot5.js → vue-router-DZ-KfC9f.js} +373 -361
  20. package/dist/chunks/{vue.runtime.esm-bundler-XxHGOLq2.js → vue.runtime.esm-bundler-zZTAiuf6.js} +10 -38
  21. package/dist/eval/chunks/browser-Cmwcvs-d.js +4 -0
  22. package/dist/eval/chunks/chunk-rhk8Qtmk-CUgXtmq_.js +4 -0
  23. package/dist/eval/chunks/compile-CM_OyqYN-Bd7bk_OB.js +7 -0
  24. package/dist/eval/chunks/compiler-sfc.esm-browser-5dA1IWMJ.js +4 -0
  25. package/dist/eval/chunks/css-DleINdoA-FdeEznDX.js +8 -0
  26. package/dist/eval/chunks/dayjs.min-B3g34Qcz.js +4 -0
  27. package/dist/eval/chunks/dist-0ySyXNpo.js +4 -0
  28. package/dist/eval/chunks/dist-B44jICwZ.js +5 -0
  29. package/dist/eval/chunks/dist-BUw25nXJ.js +6 -0
  30. package/dist/eval/chunks/dist-BeOE8qTX.js +4 -0
  31. package/dist/eval/chunks/dist-C3V7reR4.js +4 -0
  32. package/dist/eval/chunks/dist-CI9Lp9Cj.js +4 -0
  33. package/dist/eval/chunks/dist-CQir6D4y.js +5 -0
  34. package/dist/eval/chunks/dist-Cxf7_ocf.js +4 -0
  35. package/dist/eval/chunks/dist-DF4kisl2.js +5 -0
  36. package/dist/eval/chunks/dist-DHJhaOSs.js +5 -0
  37. package/dist/eval/chunks/dist-DLj8yJdm.js +4 -0
  38. package/dist/eval/chunks/dist-DSypl37f.js +5 -0
  39. package/dist/eval/chunks/dist-DWn6r6un.js +4 -0
  40. package/dist/eval/chunks/dist-DWqBe2Ah.js +6 -0
  41. package/dist/eval/chunks/dist-D_Uqh6m9.js +4 -0
  42. package/dist/eval/chunks/dist-DcIU51zW.js +4 -0
  43. package/dist/eval/chunks/dist-Wm6vE6kM.js +1 -0
  44. package/dist/eval/chunks/dist-kiZUqqzR.js +4 -0
  45. package/dist/eval/chunks/dist-oZ12SGqg.js +4 -0
  46. package/dist/eval/chunks/dist-va7FmnW4.js +4 -0
  47. package/dist/eval/chunks/echarts-BBzcOaek.js +4 -0
  48. package/dist/eval/chunks/eval-runtime-e7f6eb9af5d4.js +1 -0
  49. package/dist/eval/chunks/html2canvas-DoKTvaOT.js +4 -0
  50. package/dist/eval/chunks/index.es-wVPQxEPP.js +5 -0
  51. package/dist/eval/chunks/jspdf.es.min-Zm27YeAg.js +78 -0
  52. package/dist/eval/chunks/jsx-CwMPlI4_-CBhlIHLh.js +4 -0
  53. package/dist/eval/chunks/jszip.min-Da8UgalE.js +4 -0
  54. package/dist/eval/chunks/lodash-CYyW02I7.js +4 -0
  55. package/dist/eval/chunks/photoswipe.esm-D52MAtDT.js +4 -0
  56. package/dist/eval/chunks/purify.es-DhHsvqCe.js +4 -0
  57. package/dist/eval/chunks/rolldown-runtime-Ce3zPWPd.js +4 -0
  58. package/dist/eval/chunks/vue-router-DZ-KfC9f.js +5 -0
  59. package/dist/eval/chunks/vue.runtime.esm-bundler-zZTAiuf6.js +4 -0
  60. package/dist/eval/index.js +24 -0
  61. package/dist/eval/index.style.css +21 -0
  62. package/dist/index.cjs +986 -325
  63. package/dist/index.d.ts +1 -0
  64. package/dist/index.js +73526 -30926
  65. package/dist/index.style.css +3 -3
  66. package/package.json +12 -12
  67. package/dist/chunks/cdn-DEvdGJu2-bmlgKy4E.js +0 -38
  68. package/dist/chunks/dist-Bm7SK-km.js +0 -24517
  69. package/dist/chunks/dist-DN0sqx7H.js +0 -39
  70. package/dist/chunks/dist-uXnwGrO3.js +0 -76
  71. package/dist/chunks/files-C5UMzYxA-q9oJ4PrI.js +0 -110
  72. package/dist/chunks/linker-JHdz37DK-CWgUtxZ5.js +0 -118
  73. package/dist/chunks/local-sandbox-B8IJ5jWb-BgfU3iQ4.js +0 -300
  74. package/dist/chunks/modules-DlLJF_vd-DcNdL6sc.js +0 -153
  75. package/dist/chunks/pinia-pDJilYOg.js +0 -326
  76. package/dist/chunks/remote-DfXAsO9n-C_MtPVYr.js +0 -75
  77. package/dist/chunks/store-D8vwi-HV-RFStijWr.js +0 -16936
  78. package/dist/chunks/vc-components-C7ruefOT.js +0 -6
  79. package/dist/chunks/vc-components-m3l_xrd8.js +0 -6
@@ -1,39 +0,0 @@
1
- globalThis.process;
2
- import { n as e } from "./rolldown-runtime-Ce3zPWPd.js";
3
- //#region node_modules/.pnpm/@deot+helper-resize@1.1.4/node_modules/@deot/helper-resize/dist/index.js
4
- var t = /* @__PURE__ */ e({ Resize: () => n }), n = class e {
5
- el;
6
- static of(t) {
7
- return new e(t);
8
- }
9
- static on(t, n) {
10
- return new e(t).on(n);
11
- }
12
- static off(t, n) {
13
- return new e(t).off(n);
14
- }
15
- listeners = [];
16
- ro = null;
17
- constructor(t) {
18
- this.el = t;
19
- let n = t.__rz__;
20
- n && n instanceof e && (this.listeners = n.listeners, this.ro = n.ro);
21
- }
22
- handleResize = (e) => {
23
- /* istanbul ignore else -- @preserve */
24
- e.some((e) => e.target === this.el) && this.listeners?.forEach((e) => e());
25
- };
26
- on(e) {
27
- return typeof ResizeObserver > "u" ? () => {} : (this.listeners.length || (this.ro = this.ro || new ResizeObserver(this.handleResize), this.ro.observe(this.el), this.el.__rz__ = this), this.listeners.push(e), () => this.off(e));
28
- }
29
- off(e) {
30
- if (e) {
31
- let t = this.listeners.indexOf(e);
32
- if (t === -1) return;
33
- this.listeners.splice(t, 1);
34
- } else this.listeners = [];
35
- !this.listeners.length && this.ro && this.ro.disconnect();
36
- }
37
- };
38
- //#endregion
39
- export { t as n, n as t };
@@ -1,76 +0,0 @@
1
- globalThis.process;
2
- import { n as e } from "./rolldown-runtime-Ce3zPWPd.js";
3
- import { C as t, F as n, M as r, W as i, f as a, q as o } from "./vue.runtime.esm-bundler-XxHGOLq2.js";
4
- //#region node_modules/.pnpm/@deot+vc-hooks@1.2.0_vue@3.5.43_typescript@6.0.3_/node_modules/@deot/vc-hooks/dist/index.js
5
- var s = /* @__PURE__ */ e({
6
- getInstance: () => m,
7
- useAttrs: () => c,
8
- useDrag: () => l,
9
- useScrollbar: () => p
10
- }), c = (e) => {
11
- let t = i(), { merge: n = !0, exclude: r = [] } = e || {};
12
- return a(() => {
13
- if (n && !r.length) return t;
14
- let e = Object.entries(t).reduce((e, [t, i]) => (r.includes(t) || (!n && /^on([A-Z])/.test(t) ? e.listeners[t] = i : !n && /(class|style)/.test(t) ? e[t] = i : e.attrs[t] = i), e), {
15
- style: void 0,
16
- class: void 0,
17
- attrs: {},
18
- listeners: {}
19
- });
20
- return n ? e.attrs : e;
21
- });
22
- }, l = (e) => {
23
- let t = (t, n) => (e.cancel || e.end)?.(t, n), n = (e) => e.preventDefault(), i = (t) => {
24
- let r = (t ? document.addEventListener : document.removeEventListener).bind(document);
25
- r("mousemove", a), r("mouseup", o), e.selectable === !1 && (r("selectstart", n), r("dragstart", n));
26
- }, a = (n) => {
27
- if (!(n.buttons & 1)) {
28
- i(!1), t(n, n);
29
- return;
30
- }
31
- e.move?.(n, n);
32
- }, o = (t) => {
33
- t.button === 0 && (i(!1), e.end?.(t, t));
34
- }, s = (t) => {
35
- t.button === 0 && e.start?.(t, t) !== !1 && i(!0);
36
- }, c = null, l = (e) => {
37
- for (let t = 0; c !== null && t < (e?.length || 0); t++) if (e[t].identifier === c) return e[t];
38
- }, u = (t) => {
39
- if (l(t.touches) && !l(t.changedTouches)) return;
40
- let n = t.changedTouches?.[0] || t.touches?.[0];
41
- c = n && e.start?.(t, n) !== !1 ? n.identifier : null;
42
- }, d = (t) => {
43
- let n = l(t.touches);
44
- n && e.move?.(t, n);
45
- }, f = (e) => (t) => {
46
- let n = l(t.changedTouches);
47
- n && (c = null, e(t, n));
48
- };
49
- return r(() => i(!1)), { listeners: {
50
- onMousedown: s,
51
- onTouchstart: u,
52
- onTouchmove: d,
53
- onTouchend: f((t, n) => e.end?.(t, n)),
54
- onTouchcancel: f(t)
55
- } };
56
- }, u = 0, d = "", f = "", p = (e) => {
57
- let t = !1, i = !1, a = (e) => {
58
- if (!t || e === i) return;
59
- let { style: n } = document.body;
60
- i = e, e ? u++ === 0 && (d = n.getPropertyValue("overflow"), f = n.getPropertyPriority("overflow"), n.setProperty("overflow", "hidden")) : --u === 0 && (d ? n.setProperty("overflow", d, f) : n.removeProperty("overflow"));
61
- };
62
- o(() => e.value, (e) => {
63
- a(e);
64
- }, { immediate: !1 }), n(() => {
65
- t = !0, e.value && a(!0);
66
- }), r(() => {
67
- a(!1);
68
- });
69
- }, m = (e, n) => {
70
- let r = t(), i = RegExp(`${e}$`), a = r.parent;
71
- /* istanbul ignore next -- @preserve */
72
- for (; a && !(a?.type?.name && i.test(a.type.name)) && (!n || !a?.[n] || !a?.proxy?.[n]);) a = a.parent || a?.type?.parent;
73
- return a;
74
- };
75
- //#endregion
76
- export { p as a, l as i, m as n, c as r, s as t };
@@ -1,110 +0,0 @@
1
- globalThis.process;
2
- //#region packages/playground/dist/files-C5UMzYxA.js
3
- var e = /* @__PURE__ */ new Set(["import-map.json", "tsconfig.json"]), t = (e) => {
4
- let t = String(e || "").replace(/\\/gu, "/").trim();
5
- if (!t) return "/";
6
- let n = (t.startsWith("/") ? t : `/${t}`).split("/"), r = [];
7
- for (let e of n) if (e && e !== ".") {
8
- if (e === "..") {
9
- r.length && r.pop();
10
- continue;
11
- }
12
- r.push(e);
13
- }
14
- return `/${r.join("/")}`;
15
- }, n = (e) => {
16
- let n = t(e), r = n.lastIndexOf("/");
17
- return r <= 0 ? "/" : n.slice(0, r) || "/";
18
- }, r = (e) => {
19
- let n = t(e), r = n.lastIndexOf("/");
20
- return r === -1 ? n : n.slice(r + 1);
21
- }, i = (e, n) => {
22
- let r = String(n || "").replace(/\\/gu, "/");
23
- if (r.startsWith("/")) return t(r);
24
- let i = t(e);
25
- return t(`${i === "/" ? "" : i}/${r}`);
26
- }, a = (e) => {
27
- let t = r(e), n = t.lastIndexOf(".");
28
- return n <= 0 ? "" : t.slice(n).toLowerCase();
29
- }, o = (t) => e.has(r(t)), s = (e) => {
30
- let n = /* @__PURE__ */ new Map();
31
- return Object.entries(e || {}).forEach(([e, r]) => {
32
- let i = t(e);
33
- o(i) || n.set(i, r);
34
- }), n;
35
- }, c = (e, n) => {
36
- let i = s(e);
37
- if (!i.size) throw Error("[Playground] files 为空,无法确定入口");
38
- if (n) {
39
- let e = t(n);
40
- if (o(e)) throw Error(`[Playground] entry 不能是 ${r(e)}`);
41
- if (!i.has(e)) throw Error(`[Playground] entry 不在 files 中: ${n}`);
42
- return e;
43
- }
44
- for (let n of Object.keys(e || {})) {
45
- let e = t(n);
46
- if (!o(e) && i.has(e)) return e;
47
- }
48
- /* istanbul ignore next -- 忽略文件已在前面排除,正常 files 不会走到这里 */
49
- throw Error("[Playground] files 中没有可用的入口文件");
50
- }, l = [
51
- ".vue",
52
- ".ts",
53
- ".js",
54
- ".tsx",
55
- ".jsx",
56
- ".json",
57
- ".css",
58
- ".scss",
59
- ".sass"
60
- ], u = (e, t, r) => {
61
- if (!t || !(t.startsWith("./") || t.startsWith("../") || t.startsWith("/"))) return null;
62
- let a = i(n(e), t);
63
- if (r.has(a)) return a;
64
- for (let e of l) {
65
- let t = `${a}${e}`;
66
- if (r.has(t)) return t;
67
- }
68
- for (let e of l) {
69
- let t = `${a}/index${e}`;
70
- if (r.has(t)) return t;
71
- }
72
- return null;
73
- }, d = (e) => {
74
- let r = e.map(t);
75
- if (!r.length) return "/";
76
- let i = r.map((e) => e.split("/").filter(Boolean)), a = i[0], o = a.length;
77
- for (let e = 1; e < i.length; e += 1) {
78
- let t = 0;
79
- for (; t < o && t < i[e].length && a[t] === i[e][t];) t += 1;
80
- o = t;
81
- }
82
- if (!o) return "/";
83
- let s = `/${a.slice(0, o).join("/")}`;
84
- return r.some((e) => e === s) ? n(s) : s;
85
- }, f = (e, n) => {
86
- let r = t(e), i = t(n);
87
- return i === "/" || r === i || r.startsWith(`${i}/`);
88
- }, p = (e) => {
89
- let t = [], n = String(e || "");
90
- for (let e of n.matchAll(/(?:\bfrom\s+|import\s*\(\s*|import\s+)['"]([^'"]+)['"]/gu)) e[1] && t.push(e[1]);
91
- return t;
92
- }, m = (e) => e.startsWith("./") || e.startsWith("../") || e.startsWith("/"), h = (e, n) => {
93
- let r = s(e), i = [], a = /* @__PURE__ */ new Set(), o = (e) => {
94
- let n = t(e);
95
- !a.has(n) && r.has(n) && (a.add(n), i.push(n), p(r.get(n) || "").forEach((e) => {
96
- let t = u(n, e, r);
97
- t && o(t);
98
- }));
99
- };
100
- return o(n), i;
101
- }, g = (e, n) => {
102
- let r = s(e), i = [], a = /* @__PURE__ */ new Set();
103
- return n.forEach((e) => {
104
- p(r.get(t(e)) || "").forEach((e) => {
105
- !e || m(e) || a.has(e) || (a.add(e), i.push(e));
106
- });
107
- }), i;
108
- };
109
- //#endregion
110
- export { r as basename, g as collectBareSpecifiers, h as collectReachableFilenames, s as createFileIndex, n as dirname, d as getCommonRoot, a as getExtension, o as isIgnoredFilename, f as isInsideRoot, m as isRelativeSpecifier, i as joinVirtualPath, p as listImportSpecifiers, t as normalizeVirtualPath, c as resolveEntry, u as resolveModulePath };
@@ -1,118 +0,0 @@
1
- globalThis.process;
2
- import { S as e, t, w as n, z as r } from "./vue.runtime.esm-bundler-XxHGOLq2.js";
3
- import { createFileIndex as i, getCommonRoot as a, isInsideRoot as o, isRelativeSpecifier as s, normalizeVirtualPath as c, resolveModulePath as l } from "./files-C5UMzYxA-q9oJ4PrI.js";
4
- import { resolveHostModule as u } from "./modules-DlLJF_vd-DcNdL6sc.js";
5
- //#region packages/playground/dist/linker-JHdz37DK.js
6
- var d = (i) => {
7
- let a = (t, a) => {
8
- let o = {
9
- _component: t,
10
- _props: a,
11
- config: {
12
- errorHandler: null,
13
- warnHandler: null,
14
- globalProperties: {}
15
- },
16
- _context: {
17
- provides: Object.create(null),
18
- components: Object.create(null),
19
- directives: Object.create(null),
20
- mixins: []
21
- },
22
- use() {
23
- return o;
24
- },
25
- mixin(e) {
26
- return o._context.mixins.push(e), o;
27
- },
28
- component(e, t) {
29
- return t ? (o._context.components[e] = t, o) : o._context.components[e];
30
- },
31
- directive() {
32
- return o;
33
- },
34
- provide(e, t) {
35
- return o._context.provides[e] = t, o;
36
- },
37
- mount() {
38
- return i.components = { ...o._context.components }, i.provides = { ...o._context.provides }, i.mountedComponent = e({
39
- name: "PlaygroundCapturedApp",
40
- components: o._context.components,
41
- setup() {
42
- return Reflect.ownKeys(o._context.provides).forEach((e) => {
43
- r(e, o._context.provides[e]);
44
- }), () => n(t, a || null);
45
- }
46
- }), i.mountedComponent;
47
- },
48
- unmount() {},
49
- onUnmount() {
50
- return o;
51
- }
52
- };
53
- return o;
54
- };
55
- return new Proxy(t, { get(e, t, n) {
56
- return t === "createApp" || t === "createSSRApp" ? a : t === "default" ? n : Reflect.get(e, t, n);
57
- } });
58
- }, f = (e, n, r = {}) => {
59
- let f = [...e.errors || []];
60
- if (!e.entry || f.length) return {
61
- component: null,
62
- css: e.css || [],
63
- errors: f
64
- };
65
- let p = {
66
- mountedComponent: null,
67
- components: {},
68
- provides: {}
69
- }, m = { ...r.modules || {} };
70
- (m.vue == null || m.vue === t) && (m.vue = d(p));
71
- let h = i(n), g = a([...h.keys()]), _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Set(), y = (e) => (t) => {
72
- if (s(t)) {
73
- let n = l(e, t, h);
74
- if (!n) throw Error(`[Playground] 无法解析相对模块 "${t}"(来自 ${e})`);
75
- /* istanbul ignore if -- 公共根已包含全部 files,正常解析不会逃出 */
76
- if (!o(n, g)) throw Error(`[Playground] 模块逃出虚拟根: ${n}`);
77
- return b(n);
78
- }
79
- let n = u(t, m);
80
- if (n) return n;
81
- throw Error(`[Playground] 未注册的模块 "${t}"。请在 import map 中提供可加载的地址。`);
82
- }, b = (t) => {
83
- let n = c(t);
84
- if (_.has(n) || v.has(n)) return _.get(n);
85
- let r = e.modules[n];
86
- if (!r) throw Error(`[Playground] 缺少编译模块: ${n}`);
87
- let i = { exports: {} };
88
- _.set(n, i.exports), v.add(n);
89
- try {
90
- return Function("require", "module", "exports", r.js)(y(n), i, i.exports), _.set(n, i.exports), i.exports;
91
- } catch (e) {
92
- let t = e instanceof Error ? e.message : String(e);
93
- throw f.push(`[Playground] 执行失败 ${n}: ${t}`), e;
94
- } finally {
95
- v.delete(n);
96
- }
97
- };
98
- try {
99
- let t = b(e.entry), n = t?.default ?? t;
100
- return p.mountedComponent && (n = p.mountedComponent), n ? {
101
- component: n,
102
- css: e.css || [],
103
- errors: f
104
- } : (f.push("[Playground] 入口必须 export default 组件,或调用 createApp(App).mount()"), {
105
- component: null,
106
- css: e.css || [],
107
- errors: f
108
- });
109
- } catch (t) {
110
- return f.length || f.push(t instanceof Error ? t.message : String(t)), {
111
- component: null,
112
- css: e.css || [],
113
- errors: f
114
- };
115
- }
116
- };
117
- //#endregion
118
- export { f as linkPlayground };
@@ -1,300 +0,0 @@
1
- globalThis.process;
2
- import { F as e, M as t, P as n, R as r, S as i, at as a, dt as o, g as s, i as c, k as l, p as u, q as d, st as f, t as p, w as m, z as h } from "./vue.runtime.esm-bundler-XxHGOLq2.js";
3
- import { gr as g } from "./dist-Bm7SK-km.js";
4
- import { o as _ } from "./vue-router-C0mj8Ot5.js";
5
- import { f as v, i as y } from "./store-D8vwi-HV-RFStijWr.js";
6
- import "../index.js";
7
- //#region packages/playground/dist/local-sandbox-B8IJ5jWb.js
8
- var b = Object.defineProperty, x = (e, t) => {
9
- let n = {};
10
- for (var r in e) b(n, r, {
11
- get: e[r],
12
- enumerable: !0
13
- });
14
- return t || b(n, Symbol.toStringTag, { value: "Module" }), n;
15
- }, S = (e) => {
16
- let t = [];
17
- return e.forEach((e) => {
18
- let n = String(e || "").trim();
19
- n && t.push(n);
20
- }), t;
21
- }, C = (e, t) => {
22
- /* istanbul ignore if -- 仅浏览器注入样式 */
23
- if (typeof document > "u") return null;
24
- document.querySelector(`style[data-playground-id="${e}"]`)?.remove();
25
- let n = t.filter(Boolean).join("\n");
26
- if (!n) return null;
27
- let r = document.createElement("style");
28
- return r.setAttribute("data-playground-id", e), r.textContent = n, document.head.appendChild(r), r;
29
- }, w = (e) => {
30
- /* istanbul ignore if -- 仅浏览器注入样式 */
31
- typeof document < "u" && document.querySelector(`style[data-playground-id="${e}"]`)?.remove();
32
- }, T = (e) => ({
33
- enable: () => Promise.resolve(!0),
34
- disable() {},
35
- dispose() {},
36
- run: (t, n, r) => {
37
- let i = (typeof n == "function" || n == null ? {} : n).visible, a = typeof n == "function" ? n : typeof r == "function" ? r : e.isRef(i) ? () => {
38
- i.value = !0;
39
- } : void 0;
40
- return (...e) => {
41
- if (typeof a == "function") return a(...e);
42
- };
43
- }
44
- }), E = "docs:local-out", D = `
45
- if (!window.__docsLocalBridge) {
46
- window.__docsLocalBridge = true;
47
- window.addEventListener('message', function (event) {
48
- var data = event.data;
49
- if (!data || data.channel !== ${JSON.stringify(E)}) return;
50
- window.parent.postMessage(data.payload, '*');
51
- });
52
- }
53
- `, O = `<!doctype html><html><head></head><body><script>${D}<\/script></body></html>`, k = (e) => {
54
- let t = e.contentWindow;
55
- return !t || t.__docsLocalBridge ? !!t?.__docsLocalBridge : (t.eval(D), !!t.__docsLocalBridge);
56
- }, A = class {
57
- iframe;
58
- parent;
59
- listeners = /* @__PURE__ */ new Map();
60
- constructor(e) {
61
- this.iframe = e, this.parent = { postMessage: (e) => {
62
- this.iframe.contentWindow?.postMessage({
63
- channel: E,
64
- payload: e
65
- }, "*");
66
- } };
67
- }
68
- get contentWindow() {
69
- return this.iframe.contentWindow;
70
- }
71
- get innerHeight() {
72
- let e = this.iframe.contentWindow?.innerHeight ?? 0;
73
- return e > 0 ? e : this.iframe.clientHeight || this.iframe.parentElement?.clientHeight || 0;
74
- }
75
- addEventListener(e, t) {
76
- let n = this.iframe.contentWindow;
77
- if (!n) return;
78
- if (e !== "message") {
79
- n.addEventListener(e, t);
80
- return;
81
- }
82
- let r = (e) => {
83
- let n = e, r = n.data;
84
- r && r.channel === "docs:local-out" || t({
85
- data: n.data,
86
- source: this.parent
87
- });
88
- };
89
- this.listeners.set(t, r), n.addEventListener("message", r);
90
- }
91
- removeEventListener(e, t) {
92
- let n = this.iframe.contentWindow;
93
- if (!n) return;
94
- let r = this.listeners.get(t);
95
- if (r) {
96
- this.listeners.delete(t), n.removeEventListener(e, r);
97
- return;
98
- }
99
- n.removeEventListener(e, t);
100
- }
101
- requestAnimationFrame(e) {
102
- return window.requestAnimationFrame(e);
103
- }
104
- cancelAnimationFrame(e) {
105
- window.cancelAnimationFrame(e);
106
- }
107
- setTimeout(e, t, ...n) {
108
- return window.setTimeout(e, t, ...n);
109
- }
110
- clearTimeout(e) {
111
- window.clearTimeout(e);
112
- }
113
- }, j = (e) => {
114
- if (e == null) return "";
115
- let t = typeof e == "object" && "message" in e ? e.message : e;
116
- if (t == null || t === "") return "";
117
- let n = String(t);
118
- return n === "undefined" || n === "null" ? "" : n;
119
- }, M = ["srcdoc"], N = /*@__PURE__*/ i({
120
- __name: "local-sandbox",
121
- props: {
122
- files: {},
123
- entry: {},
124
- options: {},
125
- previewScroller: {
126
- type: Boolean,
127
- default: !1
128
- },
129
- clearConsole: {
130
- type: Boolean,
131
- default: !1
132
- }
133
- },
134
- emits: ["error"],
135
- setup(b, { expose: x, emit: S }) {
136
- let E = b, D = S, N = O, P = a(null), F = a(null), I = a(null), L = a(""), R = a(""), z = f(null), B = null, V = null, H = 0, U = null, W = `docs-local-${Math.random().toString(36).slice(2, 10)}`, G = () => {
137
- D("error", {
138
- compile: L.value,
139
- runtime: R.value
140
- });
141
- };
142
- d([L, R], G);
143
- let K = (e) => i({
144
- name: "DocsLink",
145
- props: { to: {
146
- type: String,
147
- default: ""
148
- } },
149
- setup(t, { slots: n }) {
150
- return () => m("a", {
151
- href: t.to,
152
- style: {
153
- color: "inherit",
154
- textDecoration: "none"
155
- },
156
- onClick(n) {
157
- n.preventDefault(), e.parent.postMessage({
158
- action: "docs:navigate",
159
- to: t.to
160
- });
161
- }
162
- }, n.default?.());
163
- }
164
- }), q = () => {
165
- V?.unmount(), V = null, w(W);
166
- }, J = (e, r, i) => {
167
- if (!I.value) return;
168
- q(), C(W, i), E.clearConsole && console.clear();
169
- let a = E.previewScroller === !0, o = c({
170
- name: "LocalSandboxRoot",
171
- setup() {
172
- let r = T(p);
173
- return h("docs:playground", r), n((e) => {
174
- let t = j(e);
175
- return t && (R.value = t), !1;
176
- }), t(() => r.dispose()), () => {
177
- let t = m(e);
178
- return a ? m(g, {
179
- height: "100%",
180
- native: !1,
181
- autoResize: !0,
182
- showBar: !0,
183
- contentClass: y
184
- }, { default: () => t }) : t;
185
- };
186
- }
187
- });
188
- o.component("DocsLink", K(r)), o.config.errorHandler = (e) => {
189
- let t = j(e);
190
- t && (R.value = t);
191
- }, o.mount(I.value), V = o;
192
- }, Y = () => {
193
- let e = F.value;
194
- if (!e?.contentWindow) return null;
195
- try {
196
- if (!k(e)) return null;
197
- } catch {
198
- return null;
199
- }
200
- return B ??= new A(e), z.value = e.contentWindow, B;
201
- }, X = async () => {
202
- let e = U;
203
- /* istanbul ignore if -- 桥接 iframe 尚未就绪或编译已被取代 */
204
- if (!e || e.version !== H) return;
205
- let t = Y();
206
- /* istanbul ignore if -- 挂载点在编译完成时已经存在 */
207
- t && I.value && (await l(), U === e && I.value && (U = null, J(e.component, t, e.css)));
208
- }, Z = async () => {
209
- let e = ++H;
210
- U = null, L.value = "", R.value = "", G(), q();
211
- try {
212
- let [{ compilePlayground: t }, { linkPlayground: n }, r, i] = await Promise.all([
213
- import("./compile-Bw7v7QE--Dd1-R95H.js"),
214
- import("./linker-JHdz37DK-CWgUtxZ5.js"),
215
- import("./modules-DlLJF_vd-DcNdL6sc.js"),
216
- import("./files-C5UMzYxA-q9oJ4PrI.js")
217
- ]);
218
- /* istanbul ignore if -- 并发编译时只保留最后一次 */
219
- if (e !== H) return;
220
- let a = await t(E.files, { entry: E.entry });
221
- /* istanbul ignore if -- 并发编译时只保留最后一次 */
222
- if (e !== H) return;
223
- if (a.errors.length || !a.entry) {
224
- L.value = a.errors.join("\n") || "[Playground] 未能确定入口", G();
225
- return;
226
- }
227
- let o = v(E.options.cdnURL, E.options.builtinImportMap), s = i.collectBareSpecifiers(E.files, i.collectReachableFilenames(E.files, a.entry)), { createRemoteLoader: c } = await import("./remote-DfXAsO9n-C_MtPVYr.js"), l = c(o, {
228
- vue: p,
229
- vueRouter: _
230
- }, E.options.cdnURL), u = await r.loadLocalModules(s, o, {
231
- vue: p,
232
- vueRouter: _
233
- }, (e) => l.load(e), E.options.cdnURL);
234
- /* istanbul ignore if -- 并发编译时只保留最后一次 */
235
- if (e !== H) return;
236
- if (u.errors.length) {
237
- L.value = u.errors.join("\n"), G();
238
- return;
239
- }
240
- let d = n(a, E.files, { modules: u.modules });
241
- /* istanbul ignore if -- 并发编译时只保留最后一次 */
242
- if (e !== H) return;
243
- if (d.errors.length || !d.component) {
244
- L.value = (d.errors.length ? d.errors : ["[Playground] 未能解析入口组件"]).join("\n"), G();
245
- return;
246
- }
247
- U = {
248
- component: d.component,
249
- css: d.css,
250
- version: e
251
- }, await X();
252
- } catch (t) {
253
- /* istanbul ignore next -- 编译器自身异常才进入,普通错误走结果里的 errors */
254
- if (e !== H) return;
255
- /* istanbul ignore next -- 同上,只兜底编译器抛错 */
256
- L.value = t instanceof Error ? t.message : String(t), G();
257
- }
258
- }, Q = () => {
259
- X();
260
- };
261
- return e(() => {
262
- Z();
263
- }), d(() => [
264
- E.files,
265
- E.entry,
266
- E.options,
267
- E.previewScroller
268
- ], () => {
269
- P.value && Z();
270
- }, { deep: !0 }), t(() => {
271
- H += 1, U = null, q();
272
- }), x({
273
- container: P,
274
- messageSource: z,
275
- local: !0,
276
- refresh: () => {
277
- Z();
278
- }
279
- }), (e, t) => (r(), s("div", {
280
- ref_key: "containerEl",
281
- ref: P,
282
- class: "docs-playground-local"
283
- }, [u("iframe", {
284
- ref_key: "bridgeEl",
285
- ref: F,
286
- class: "docs-playground-local__bridge",
287
- tabindex: "-1",
288
- "aria-hidden": "true",
289
- title: "",
290
- srcdoc: o(N),
291
- onLoad: Q
292
- }, null, 40, M), u("div", {
293
- ref_key: "mountEl",
294
- ref: I,
295
- class: "docs-playground-local__mount"
296
- }, null, 512)], 512));
297
- }
298
- }), P = /* @__PURE__ */ x({ default: () => F }), F = N;
299
- //#endregion
300
- export { S as n, P as t };