@deot/docs-client 1.1.3 → 1.1.5

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 (55) hide show
  1. package/README.md +88 -4
  2. package/dist/chunks/browser-Cmwcvs-d.js +505 -0
  3. package/dist/chunks/cdn-DQoETju_-DS-873Vi.js +38 -0
  4. package/dist/chunks/chunk-rhk8Qtmk-CUgXtmq_.js +14 -0
  5. package/dist/chunks/compile-BHD98Ttf-BJaenUUQ.js +79915 -0
  6. package/dist/chunks/compiler-sfc.esm-browser-B4_kBkG5.js +24975 -0
  7. package/dist/chunks/dayjs.min-B3g34Qcz.js +300 -0
  8. package/dist/chunks/dist-0ySyXNpo.js +415 -0
  9. package/dist/chunks/dist-9UPCn_ag.js +24601 -0
  10. package/dist/chunks/dist-B44jICwZ.js +22 -0
  11. package/dist/chunks/dist-BQyOK8Qy.js +17 -0
  12. package/dist/chunks/dist-BUw25nXJ.js +65 -0
  13. package/dist/chunks/dist-BeOE8qTX.js +345 -0
  14. package/dist/chunks/dist-C3V7reR4.js +197 -0
  15. package/dist/chunks/dist-C8z9l0mA.js +58 -0
  16. package/dist/chunks/dist-CI9Lp9Cj.js +247 -0
  17. package/dist/chunks/dist-COjpr4FU.js +426 -0
  18. package/dist/chunks/dist-CQir6D4y.js +244 -0
  19. package/dist/chunks/dist-Cxf7_ocf.js +44 -0
  20. package/dist/chunks/dist-DF4kisl2.js +43 -0
  21. package/dist/chunks/dist-DLj8yJdm.js +38 -0
  22. package/dist/chunks/dist-DWn6r6un.js +76 -0
  23. package/dist/chunks/dist-DWqBe2Ah.js +132 -0
  24. package/dist/chunks/dist-D_Uqh6m9.js +80 -0
  25. package/dist/chunks/dist-DcIU51zW.js +166 -0
  26. package/dist/chunks/dist-kiZUqqzR.js +27 -0
  27. package/dist/chunks/dist-oZ12SGqg.js +6 -0
  28. package/dist/chunks/dist-uXnwGrO3.js +76 -0
  29. package/dist/chunks/dist-va7FmnW4.js +156 -0
  30. package/dist/chunks/{echarts-I1Rk_oCV.js → echarts-Dk-pu7GM.js} +450 -398
  31. package/dist/chunks/files-BqucFldk-B-hTQ-ip.js +148 -0
  32. package/dist/chunks/html2canvas-Deo0mM5K.js +4022 -0
  33. package/dist/chunks/index.es-UlJ0gfdF.js +5757 -0
  34. package/dist/chunks/jspdf.es.min-CJc40v7q.js +17873 -0
  35. package/dist/chunks/jsx-CwMPlI4_-CAiik-V7.js +128454 -0
  36. package/dist/chunks/jszip.min-BbVwZKYP.js +3044 -0
  37. package/dist/chunks/linker-xqjVl0X0-CWWI367H.js +118 -0
  38. package/dist/chunks/local-sandbox-DvcgaBOa-CzJxrdVx.js +298 -0
  39. package/dist/chunks/lodash-Cxf6dD_I.js +5161 -0
  40. package/dist/chunks/modules-BGzPcoRR-C9BWX8hC.js +154 -0
  41. package/dist/chunks/{photoswipe.esm-CT37djgx.js → photoswipe.esm-B0V-xGTB.js} +36 -31
  42. package/dist/chunks/pinia-pDJilYOg.js +326 -0
  43. package/dist/chunks/purify.es-BiqY1C6m.js +867 -0
  44. package/dist/chunks/remote-mq4zvrI1-Bib9tTkb.js +104 -0
  45. package/dist/chunks/script-DjUf9uWK-Cu5Kla_E.js +15055 -0
  46. package/dist/chunks/store-BOyC8F2y-CbodPye0.js +17037 -0
  47. package/dist/chunks/vue-router-C0mj8Ot5.js +1196 -0
  48. package/dist/chunks/vue.runtime.esm-bundler-XxHGOLq2.js +4879 -0
  49. package/dist/index.cjs +997 -340
  50. package/dist/index.d.ts +2 -1
  51. package/dist/index.js +42205 -103464
  52. package/dist/index.style.css +3 -4
  53. package/package.json +9 -9
  54. package/dist/chunks/_commonjsHelpers-BFTU3MAI-D_7z5o6A.js +0 -8
  55. package/dist/chunks/jsx-H2PmTOgp-C0GVSSMR.js +0 -128281
@@ -0,0 +1,118 @@
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 };
@@ -0,0 +1,298 @@
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 };