@deot/docs-client 1.1.5 → 1.1.7

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 (75) hide show
  1. package/README.md +22 -6
  2. package/dist/chunks/{compile-BHD98Ttf-BJaenUUQ.js → compile-CM_OyqYN-rhv4v6Tt.js} +634 -1734
  3. package/dist/chunks/{compiler-sfc.esm-browser-B4_kBkG5.js → compiler-sfc.esm-browser-5dA1IWMJ.js} +185 -305
  4. package/dist/chunks/{script-DjUf9uWK-Cu5Kla_E.js → css-DleINdoA-Brc23sJ9.js} +2716 -2641
  5. package/dist/chunks/{dist-COjpr4FU.js → dist-DHJhaOSs.js} +2 -2
  6. package/dist/chunks/{dist-C8z9l0mA.js → dist-DSypl37f.js} +1 -1
  7. package/dist/chunks/{dist-BQyOK8Qy.js → dist-Wm6vE6kM.js} +2 -2
  8. package/dist/chunks/{echarts-Dk-pu7GM.js → echarts-BBzcOaek.js} +1075 -1290
  9. package/dist/chunks/{html2canvas-Deo0mM5K.js → html2canvas-DoKTvaOT.js} +3 -13
  10. package/dist/chunks/{index.es-UlJ0gfdF.js → index.es-wVPQxEPP.js} +32 -37
  11. package/dist/chunks/{jspdf.es.min-CJc40v7q.js → jspdf.es.min-Zm27YeAg.js} +1080 -1053
  12. package/dist/chunks/{jsx-CwMPlI4_-CAiik-V7.js → jsx-CwMPlI4_-CBhlIHLh.js} +8002 -8541
  13. package/dist/chunks/{jszip.min-BbVwZKYP.js → jszip.min-Da8UgalE.js} +5 -5
  14. package/dist/chunks/{lodash-Cxf6dD_I.js → lodash-CYyW02I7.js} +10 -14
  15. package/dist/chunks/{photoswipe.esm-B0V-xGTB.js → photoswipe.esm-D52MAtDT.js} +11 -38
  16. package/dist/chunks/{purify.es-BiqY1C6m.js → purify.es-DhHsvqCe.js} +1 -23
  17. package/dist/chunks/{vue-router-C0mj8Ot5.js → vue-router-LT2FR3OX.js} +384 -372
  18. package/dist/chunks/{vue.runtime.esm-bundler-XxHGOLq2.js → vue.runtime.esm-bundler-Bk0CnRBe.js} +11 -39
  19. package/dist/eval/chunks/browser-Cmwcvs-d.js +4 -0
  20. package/dist/eval/chunks/chunk-rhk8Qtmk-CUgXtmq_.js +4 -0
  21. package/dist/eval/chunks/compile-CM_OyqYN-rhv4v6Tt.js +7 -0
  22. package/dist/eval/chunks/compiler-sfc.esm-browser-5dA1IWMJ.js +4 -0
  23. package/dist/eval/chunks/css-DleINdoA-Brc23sJ9.js +8 -0
  24. package/dist/eval/chunks/dayjs.min-B3g34Qcz.js +4 -0
  25. package/dist/eval/chunks/dist-0ySyXNpo.js +4 -0
  26. package/dist/eval/chunks/dist-B44jICwZ.js +5 -0
  27. package/dist/eval/chunks/dist-BUw25nXJ.js +6 -0
  28. package/dist/eval/chunks/dist-BeOE8qTX.js +4 -0
  29. package/dist/eval/chunks/dist-C3V7reR4.js +4 -0
  30. package/dist/eval/chunks/dist-CI9Lp9Cj.js +4 -0
  31. package/dist/eval/chunks/dist-CQir6D4y.js +5 -0
  32. package/dist/eval/chunks/dist-Cxf7_ocf.js +4 -0
  33. package/dist/eval/chunks/dist-DF4kisl2.js +5 -0
  34. package/dist/eval/chunks/dist-DHJhaOSs.js +5 -0
  35. package/dist/eval/chunks/dist-DLj8yJdm.js +4 -0
  36. package/dist/eval/chunks/dist-DSypl37f.js +5 -0
  37. package/dist/eval/chunks/dist-DWn6r6un.js +4 -0
  38. package/dist/eval/chunks/dist-DWqBe2Ah.js +6 -0
  39. package/dist/eval/chunks/dist-D_Uqh6m9.js +4 -0
  40. package/dist/eval/chunks/dist-DcIU51zW.js +4 -0
  41. package/dist/eval/chunks/dist-Wm6vE6kM.js +1 -0
  42. package/dist/eval/chunks/dist-kiZUqqzR.js +4 -0
  43. package/dist/eval/chunks/dist-oZ12SGqg.js +4 -0
  44. package/dist/eval/chunks/dist-va7FmnW4.js +4 -0
  45. package/dist/eval/chunks/echarts-BBzcOaek.js +4 -0
  46. package/dist/eval/chunks/eval-runtime-e7f6eb9af5d4.js +1 -0
  47. package/dist/eval/chunks/html2canvas-DoKTvaOT.js +4 -0
  48. package/dist/eval/chunks/index.es-wVPQxEPP.js +5 -0
  49. package/dist/eval/chunks/jspdf.es.min-Zm27YeAg.js +78 -0
  50. package/dist/eval/chunks/jsx-CwMPlI4_-CBhlIHLh.js +4 -0
  51. package/dist/eval/chunks/jszip.min-Da8UgalE.js +4 -0
  52. package/dist/eval/chunks/lodash-CYyW02I7.js +4 -0
  53. package/dist/eval/chunks/photoswipe.esm-D52MAtDT.js +4 -0
  54. package/dist/eval/chunks/purify.es-DhHsvqCe.js +4 -0
  55. package/dist/eval/chunks/rolldown-runtime-Ce3zPWPd.js +4 -0
  56. package/dist/eval/chunks/vue-router-LT2FR3OX.js +5 -0
  57. package/dist/eval/chunks/vue.runtime.esm-bundler-Bk0CnRBe.js +4 -0
  58. package/dist/eval/index.js +24 -0
  59. package/dist/eval/index.style.css +21 -0
  60. package/dist/index.cjs +895 -354
  61. package/dist/index.js +81684 -37415
  62. package/dist/index.style.css +3 -3
  63. package/package.json +16 -11
  64. package/dist/chunks/cdn-DQoETju_-DS-873Vi.js +0 -38
  65. package/dist/chunks/dist-9UPCn_ag.js +0 -24601
  66. package/dist/chunks/dist-uXnwGrO3.js +0 -76
  67. package/dist/chunks/files-BqucFldk-B-hTQ-ip.js +0 -148
  68. package/dist/chunks/linker-xqjVl0X0-CWWI367H.js +0 -118
  69. package/dist/chunks/local-sandbox-DvcgaBOa-CzJxrdVx.js +0 -298
  70. package/dist/chunks/modules-BGzPcoRR-C9BWX8hC.js +0 -154
  71. package/dist/chunks/pinia-pDJilYOg.js +0 -326
  72. package/dist/chunks/remote-mq4zvrI1-Bib9tTkb.js +0 -104
  73. package/dist/chunks/store-BOyC8F2y-CbodPye0.js +0 -17037
  74. package/dist/chunks/vc-components-C7ruefOT.js +0 -6
  75. package/dist/chunks/vc-components-m3l_xrd8.js +0 -6
@@ -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,148 +0,0 @@
1
- globalThis.process;
2
- import { n as e } from "./rolldown-runtime-Ce3zPWPd.js";
3
- //#region packages/playground/dist/files-BqucFldk.js
4
- var t = /* @__PURE__ */ e({
5
- a: () => g,
6
- c: () => _,
7
- d: () => p,
8
- f: () => h,
9
- i: () => a,
10
- l: () => y,
11
- n: () => b,
12
- o: () => u,
13
- p: () => r,
14
- r: () => f,
15
- s: () => d,
16
- t: () => x,
17
- u: () => o
18
- }), n = Object.defineProperty, r = (e, t) => {
19
- let r = {};
20
- for (var i in e) n(r, i, {
21
- get: e[i],
22
- enumerable: !0
23
- });
24
- return t || n(r, Symbol.toStringTag, { value: "Module" }), r;
25
- }, i = /* @__PURE__ */ new Set(["import-map.json", "tsconfig.json"]), a = /* @__PURE__ */ r({
26
- basename: () => c,
27
- collectBareSpecifiers: () => x,
28
- collectReachableFilenames: () => b,
29
- createFileIndex: () => f,
30
- dirname: () => s,
31
- getCommonRoot: () => g,
32
- getExtension: () => u,
33
- isIgnoredFilename: () => d,
34
- isInsideRoot: () => _,
35
- isRelativeSpecifier: () => y,
36
- joinVirtualPath: () => l,
37
- listImportSpecifiers: () => v,
38
- normalizeVirtualPath: () => o,
39
- resolveEntry: () => p,
40
- resolveModulePath: () => h
41
- }), o = (e) => {
42
- let t = String(e || "").replace(/\\/gu, "/").trim();
43
- if (!t) return "/";
44
- let n = (t.startsWith("/") ? t : `/${t}`).split("/"), r = [];
45
- for (let e of n) if (e && e !== ".") {
46
- if (e === "..") {
47
- r.length && r.pop();
48
- continue;
49
- }
50
- r.push(e);
51
- }
52
- return `/${r.join("/")}`;
53
- }, s = (e) => {
54
- let t = o(e), n = t.lastIndexOf("/");
55
- return n <= 0 ? "/" : t.slice(0, n) || "/";
56
- }, c = (e) => {
57
- let t = o(e), n = t.lastIndexOf("/");
58
- return n === -1 ? t : t.slice(n + 1);
59
- }, l = (e, t) => {
60
- let n = String(t || "").replace(/\\/gu, "/");
61
- if (n.startsWith("/")) return o(n);
62
- let r = o(e);
63
- return o(`${r === "/" ? "" : r}/${n}`);
64
- }, u = (e) => {
65
- let t = c(e), n = t.lastIndexOf(".");
66
- return n <= 0 ? "" : t.slice(n).toLowerCase();
67
- }, d = (e) => i.has(c(e)), f = (e) => {
68
- let t = /* @__PURE__ */ new Map();
69
- return Object.entries(e || {}).forEach(([e, n]) => {
70
- let r = o(e);
71
- d(r) || t.set(r, n);
72
- }), t;
73
- }, p = (e, t) => {
74
- let n = f(e);
75
- if (!n.size) throw Error("[Playground] files 为空,无法确定入口");
76
- if (t) {
77
- let e = o(t);
78
- if (d(e)) throw Error(`[Playground] entry 不能是 ${c(e)}`);
79
- if (!n.has(e)) throw Error(`[Playground] entry 不在 files 中: ${t}`);
80
- return e;
81
- }
82
- for (let t of Object.keys(e || {})) {
83
- let e = o(t);
84
- if (!d(e) && n.has(e)) return e;
85
- }
86
- /* istanbul ignore next -- 忽略文件已在前面排除,正常 files 不会走到这里 */
87
- throw Error("[Playground] files 中没有可用的入口文件");
88
- }, m = [
89
- ".vue",
90
- ".ts",
91
- ".js",
92
- ".tsx",
93
- ".jsx",
94
- ".json",
95
- ".css",
96
- ".scss",
97
- ".sass"
98
- ], h = (e, t, n) => {
99
- if (!t || !(t === "." || t === ".." || t.startsWith("./") || t.startsWith("../") || t.startsWith("/"))) return null;
100
- let r = l(s(e), t);
101
- if (n.has(r)) return r;
102
- for (let e of m) {
103
- let t = `${r}${e}`;
104
- if (n.has(t)) return t;
105
- }
106
- for (let e of m) {
107
- let t = `${r}/index${e}`;
108
- if (n.has(t)) return t;
109
- }
110
- return null;
111
- }, g = (e) => {
112
- let t = e.map(o);
113
- if (!t.length) return "/";
114
- let n = t.map((e) => e.split("/").filter(Boolean)), r = n[0], i = r.length;
115
- for (let e = 1; e < n.length; e += 1) {
116
- let t = 0;
117
- for (; t < i && t < n[e].length && r[t] === n[e][t];) t += 1;
118
- i = t;
119
- }
120
- if (!i) return "/";
121
- let a = `/${r.slice(0, i).join("/")}`;
122
- return t.some((e) => e === a) ? s(a) : a;
123
- }, _ = (e, t) => {
124
- let n = o(e), r = o(t);
125
- return r === "/" || n === r || n.startsWith(`${r}/`);
126
- }, v = (e) => {
127
- let t = [], n = String(e || "");
128
- for (let e of n.matchAll(/(?:\bfrom\s+|import\s*\(\s*|import\s+)['"]([^'"]+)['"]/gu)) e[1] && t.push(e[1]);
129
- return t;
130
- }, y = (e) => e === "." || e === ".." || e.startsWith("./") || e.startsWith("../") || e.startsWith("/"), b = (e, t) => {
131
- let n = f(e), r = [], i = /* @__PURE__ */ new Set(), a = (e) => {
132
- let t = o(e);
133
- !i.has(t) && n.has(t) && (i.add(t), r.push(t), v(n.get(t) || "").forEach((e) => {
134
- let r = h(t, e, n);
135
- r && a(r);
136
- }));
137
- };
138
- return a(t), r;
139
- }, x = (e, t) => {
140
- let n = f(e), r = [], i = /* @__PURE__ */ new Set();
141
- return t.forEach((e) => {
142
- v(n.get(o(e)) || "").forEach((e) => {
143
- !e || y(e) || i.has(e) || /\.(?:css|scss|sass)(?:[?#]|$)/.test(e) || (i.add(e), r.push(e));
144
- });
145
- }), r;
146
- };
147
- //#endregion
148
- export { t as a, d as c, o as d, p as f, f as i, _ as l, x as n, g as o, h as p, b as r, u as s, r as t, y as u };
@@ -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 { d as i, i as a, l as o, o as s, p as c, u as l } from "./files-BqucFldk-B-hTQ-ip.js";
4
- import { resolveHostModule as u } from "./modules-BGzPcoRR-C9BWX8hC.js";
5
- //#region packages/playground/dist/linker-xqjVl0X0.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 = a(n), g = s([...h.keys()]), _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Set(), y = (e) => (t) => {
72
- if (l(t)) {
73
- let n = c(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 = i(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 a = { exports: {} };
88
- _.set(n, a.exports), v.add(n);
89
- try {
90
- return Function("require", "module", "exports", r.js)(y(n), a, a.exports), _.set(n, a.exports), a.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,298 +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, pt as d, q as f, st as p, t as m, w as h, z as g } from "./vue.runtime.esm-bundler-XxHGOLq2.js";
3
- import { gr as _ } from "./dist-9UPCn_ag.js";
4
- import { o as v } from "./vue-router-C0mj8Ot5.js";
5
- import { t as y } from "./files-BqucFldk-B-hTQ-ip.js";
6
- import { f as b, i as x } from "./store-BOyC8F2y-CbodPye0.js";
7
- import "../index.js";
8
- //#region packages/playground/dist/local-sandbox-DvcgaBOa.js
9
- var S = (e) => {
10
- let t = [];
11
- return e.forEach((e) => {
12
- let n = String(e || "").trim();
13
- n && t.push(n);
14
- }), t;
15
- }, C = (e, t) => {
16
- /* istanbul ignore if -- 仅浏览器注入样式 */
17
- if (typeof document > "u") return null;
18
- document.querySelector(`style[data-playground-id="${e}"]`)?.remove();
19
- let n = t.filter(Boolean).join("\n");
20
- if (!n) return null;
21
- let r = document.createElement("style");
22
- return r.setAttribute("data-playground-id", e), r.textContent = n, document.head.appendChild(r), r;
23
- }, w = (e) => {
24
- /* istanbul ignore if -- 仅浏览器注入样式 */
25
- typeof document < "u" && document.querySelector(`style[data-playground-id="${e}"]`)?.remove();
26
- }, T = (e) => ({
27
- enable: () => Promise.resolve(!0),
28
- disable() {},
29
- dispose() {},
30
- run: (t, n, r) => {
31
- let i = (typeof n == "function" || n == null ? {} : n).visible, a = typeof n == "function" ? n : typeof r == "function" ? r : e.isRef(i) ? () => {
32
- i.value = !0;
33
- } : void 0;
34
- return (...e) => {
35
- if (typeof a == "function") return a(...e);
36
- };
37
- }
38
- }), E = "docs:local-out", D = `
39
- if (!window.__docsLocalBridge) {
40
- window.__docsLocalBridge = true;
41
- window.addEventListener('message', function (event) {
42
- var data = event.data;
43
- if (!data || data.channel !== ${JSON.stringify(E)}) return;
44
- window.parent.postMessage(data.payload, '*');
45
- });
46
- }
47
- `, O = `<!doctype html><html><head></head><body><script>${D}<\/script></body></html>`, k = (e) => {
48
- let t = e.contentWindow;
49
- return !t || t.__docsLocalBridge ? !!t?.__docsLocalBridge : (t.eval(D), !!t.__docsLocalBridge);
50
- }, A = class {
51
- iframe;
52
- parent;
53
- listeners = /* @__PURE__ */ new Map();
54
- constructor(e) {
55
- this.iframe = e, this.parent = { postMessage: (e) => {
56
- this.iframe.contentWindow?.postMessage({
57
- channel: E,
58
- payload: e
59
- }, "*");
60
- } };
61
- }
62
- get contentWindow() {
63
- return this.iframe.contentWindow;
64
- }
65
- get innerHeight() {
66
- let e = this.iframe.contentWindow?.innerHeight ?? 0;
67
- return e > 0 ? e : this.iframe.clientHeight || this.iframe.parentElement?.clientHeight || 0;
68
- }
69
- addEventListener(e, t) {
70
- let n = this.iframe.contentWindow;
71
- if (!n) return;
72
- if (e !== "message") {
73
- n.addEventListener(e, t);
74
- return;
75
- }
76
- let r = (e) => {
77
- let n = e, r = n.data;
78
- r && r.channel === "docs:local-out" || t({
79
- data: n.data,
80
- source: this.parent
81
- });
82
- };
83
- this.listeners.set(t, r), n.addEventListener("message", r);
84
- }
85
- removeEventListener(e, t) {
86
- let n = this.iframe.contentWindow;
87
- if (!n) return;
88
- let r = this.listeners.get(t);
89
- if (r) {
90
- this.listeners.delete(t), n.removeEventListener(e, r);
91
- return;
92
- }
93
- n.removeEventListener(e, t);
94
- }
95
- requestAnimationFrame(e) {
96
- return window.requestAnimationFrame(e);
97
- }
98
- cancelAnimationFrame(e) {
99
- window.cancelAnimationFrame(e);
100
- }
101
- setTimeout(e, t, ...n) {
102
- return window.setTimeout(e, t, ...n);
103
- }
104
- clearTimeout(e) {
105
- window.clearTimeout(e);
106
- }
107
- }, j = (e) => {
108
- if (e == null) return "";
109
- let t = typeof e == "object" && "message" in e ? e.message : e;
110
- if (t == null || t === "") return "";
111
- let n = String(t);
112
- return n === "undefined" || n === "null" ? "" : n;
113
- }, M = ["srcdoc"], N = /*@__PURE__*/ i({
114
- __name: "local-sandbox",
115
- props: {
116
- files: {},
117
- entry: {},
118
- options: {},
119
- previewScroller: {
120
- type: Boolean,
121
- default: !1
122
- },
123
- clearConsole: {
124
- type: Boolean,
125
- default: !1
126
- },
127
- autoHeight: {
128
- type: Boolean,
129
- default: !1
130
- }
131
- },
132
- emits: ["error"],
133
- setup(y, { expose: S, emit: E }) {
134
- let D = y, N = E, P = O, F = a(null), I = a(null), L = a(null), R = a(""), z = a(""), B = p(null), V = null, H = null, U = 0, W = null, G = `docs-local-${Math.random().toString(36).slice(2, 10)}`, K = () => {
135
- N("error", {
136
- compile: R.value,
137
- runtime: z.value
138
- });
139
- };
140
- f([R, z], K);
141
- let q = (e) => i({
142
- name: "DocsLink",
143
- props: { to: {
144
- type: String,
145
- default: ""
146
- } },
147
- setup(t, { slots: n }) {
148
- return () => h("a", {
149
- href: t.to,
150
- style: {
151
- color: "inherit",
152
- textDecoration: "none"
153
- },
154
- onClick(n) {
155
- n.preventDefault(), e.parent.postMessage({
156
- action: "docs:navigate",
157
- to: t.to
158
- });
159
- }
160
- }, n.default?.());
161
- }
162
- }), J = () => {
163
- H?.unmount(), H = null, w(G);
164
- }, Y = (e, r, i) => {
165
- if (!L.value) return;
166
- J(), C(G, i), D.clearConsole && console.clear();
167
- let a = D.previewScroller === !0, o = c({
168
- name: "LocalSandboxRoot",
169
- setup() {
170
- let r = T(m);
171
- return g("docs:playground", r), n((e) => {
172
- let t = j(e);
173
- return t && (z.value = t), !1;
174
- }), t(() => r.dispose()), () => {
175
- let t = h(e);
176
- return a ? h(_, {
177
- height: "100%",
178
- native: !1,
179
- autoResize: !0,
180
- showBar: !0,
181
- contentClass: x
182
- }, { default: () => t }) : t;
183
- };
184
- }
185
- });
186
- o.component("DocsLink", q(r)), o.config.errorHandler = (e) => {
187
- let t = j(e);
188
- t && (z.value = t);
189
- }, o.mount(L.value), H = o;
190
- }, X = () => {
191
- let e = I.value;
192
- if (!e?.contentWindow) return null;
193
- try {
194
- if (!k(e)) return null;
195
- } catch {
196
- return null;
197
- }
198
- return V ??= new A(e), B.value = e.contentWindow, V;
199
- }, Z = async () => {
200
- let e = W;
201
- /* istanbul ignore if -- 桥接 iframe 尚未就绪或编译已被取代 */
202
- if (!e || e.version !== U) return;
203
- let t = X();
204
- /* istanbul ignore if -- 挂载点在编译完成时已经存在 */
205
- t && L.value && (await l(), W === e && L.value && (W = null, Y(e.component, t, e.css)));
206
- }, Q = async () => {
207
- let e = ++U;
208
- W = null, R.value = "", z.value = "", K(), J();
209
- try {
210
- let [{ compilePlayground: t }, { linkPlayground: n }, r, i] = await Promise.all([
211
- import("./compile-BHD98Ttf-BJaenUUQ.js"),
212
- import("./linker-xqjVl0X0-CWWI367H.js"),
213
- import("./modules-BGzPcoRR-C9BWX8hC.js"),
214
- import("./files-BqucFldk-B-hTQ-ip.js").then((e) => e.a).then((e) => e.i)
215
- ]);
216
- /* istanbul ignore if -- 并发编译时只保留最后一次 */
217
- if (e !== U) return;
218
- let a = await t(D.files, { entry: D.entry });
219
- /* istanbul ignore if -- 并发编译时只保留最后一次 */
220
- if (e !== U) return;
221
- if (a.errors.length || !a.entry) {
222
- R.value = a.errors.join("\n") || "[Playground] 未能确定入口", K();
223
- return;
224
- }
225
- let o = b(D.options.cdnURL, D.options.builtinImportMap), s = i.collectBareSpecifiers(D.files, i.collectReachableFilenames(D.files, a.entry)), { createRemoteLoader: c } = await import("./remote-mq4zvrI1-Bib9tTkb.js"), l = c(o, {
226
- vue: m,
227
- vueRouter: v
228
- }, D.options.cdnURL), u = await r.loadLocalModules(s, o, {
229
- vue: m,
230
- vueRouter: v
231
- }, (e) => l.load(e), D.options.cdnURL);
232
- /* istanbul ignore if -- 并发编译时只保留最后一次 */
233
- if (e !== U) return;
234
- if (u.errors.length) {
235
- R.value = u.errors.join("\n"), K();
236
- return;
237
- }
238
- let d = n(a, D.files, { modules: u.modules });
239
- /* istanbul ignore if -- 并发编译时只保留最后一次 */
240
- if (e !== U) return;
241
- if (d.errors.length || !d.component) {
242
- R.value = (d.errors.length ? d.errors : ["[Playground] 未能解析入口组件"]).join("\n"), K();
243
- return;
244
- }
245
- W = {
246
- component: d.component,
247
- css: d.css,
248
- version: e
249
- }, await Z();
250
- } catch (t) {
251
- /* istanbul ignore next -- 编译器自身异常才进入,普通错误走结果里的 errors */
252
- if (e !== U) return;
253
- /* istanbul ignore next -- 同上,只兜底编译器抛错 */
254
- R.value = t instanceof Error ? t.message : String(t), K();
255
- }
256
- }, $ = () => {
257
- Z();
258
- };
259
- return e(() => {
260
- Q();
261
- }), f(() => [
262
- D.files,
263
- D.entry,
264
- D.options,
265
- D.previewScroller
266
- ], () => {
267
- F.value && Q();
268
- }, { deep: !0 }), t(() => {
269
- U += 1, W = null, J();
270
- }), S({
271
- container: F,
272
- messageSource: B,
273
- local: !0,
274
- refresh: () => {
275
- Q();
276
- }
277
- }), (e, t) => (r(), s("div", {
278
- ref_key: "containerEl",
279
- ref: F,
280
- class: "docs-playground-local"
281
- }, [u("iframe", {
282
- ref_key: "bridgeEl",
283
- ref: I,
284
- class: "docs-playground-local__bridge",
285
- tabindex: "-1",
286
- "aria-hidden": "true",
287
- title: "",
288
- srcdoc: o(P),
289
- onLoad: $
290
- }, null, 40, M), u("div", {
291
- ref_key: "mountEl",
292
- ref: L,
293
- class: d(["docs-playground-local__mount", { "docs-playground-local__mount--auto": y.autoHeight }])
294
- }, null, 2)], 512));
295
- }
296
- }), P = /* @__PURE__ */ y({ default: () => F }), F = N;
297
- //#endregion
298
- export { S as n, P as t };