@fangzhongya/vue-archive 0.0.47 → 0.0.48

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.
@@ -1,52 +1,62 @@
1
- import { defineComponent as x, ref as d, onMounted as b, createElementBlock as a, openBlock as o, createElementVNode as s, renderSlot as m, normalizeStyle as p, createCommentVNode as f, toDisplayString as i, Fragment as y, renderList as _ } from "vue";
2
- const g = { class: "box-url-span" }, h = { class: "box-url-box-div" }, k = { class: "box-div-li" }, N = { class: "box-div-li-span" }, S = { class: "box-div-li-span" }, w = {
1
+ import { defineComponent as p, ref as v, onMounted as f, createElementBlock as l, openBlock as i, createElementVNode as s, renderSlot as y, normalizeStyle as g, createCommentVNode as k, toDisplayString as a, Fragment as _, renderList as h } from "vue";
2
+ import { openInEditor as N } from "../../utils/util.js";
3
+ import { getConfig as C } from "../../config.js";
4
+ import { getReplaceUrls as w } from "@fangzhongya/utils/urls/getReplaceUrls";
5
+ const E = { class: "box-url-span" }, S = { class: "box-url-box-div" }, B = { class: "box-div-li" }, V = { class: "box-div-li-span" }, X = { class: "box-div-li-span" }, Y = {
3
6
  key: 0,
4
7
  class: "box-div-li"
5
- }, B = { class: "box-div-li-span" }, C = { class: "box-div-li" }, E = { class: "box-div-li-span" }, X = /* @__PURE__ */ x({
8
+ }, j = { class: "box-div-li-span" }, z = { class: "box-div-li" }, D = { class: "box-div-li-span" }, O = /* @__PURE__ */ p({
6
9
  __name: "index",
7
10
  props: {
8
11
  value: Object
9
12
  },
10
- setup(l) {
11
- const v = d(), u = d(""), r = d("");
12
- return b(() => {
13
- v.value.onmouseenter = (e) => {
13
+ setup(o) {
14
+ const r = o, c = v(), u = v(""), x = v(""), m = C("directory"), b = () => {
15
+ const n = r.value?.key, e = w(n, r.value?.cwd || m);
16
+ N(e);
17
+ };
18
+ return f(() => {
19
+ c.value.onmouseenter = (e) => {
14
20
  var e = e || window.event;
15
- let t, n;
16
- e.x || e.y ? (t = e.x, n = e.y) : (e.pageX || e.pageY) && (t = e.pageX - 1, n = e.pageY - 1), u.value = t + "px", r.value = n + "px";
21
+ let t, d;
22
+ e.x || e.y ? (t = e.x, d = e.y) : (e.pageX || e.pageY) && (t = e.pageX - 1, d = e.pageY - 1), u.value = t + "px", x.value = d + "px";
17
23
  };
18
- }), (c, e) => (o(), a("div", {
24
+ }), (n, e) => (i(), l("div", {
19
25
  ref_key: "boxurl",
20
- ref: v,
26
+ ref: c,
21
27
  class: "box-url"
22
28
  }, [
23
- s("span", g, [
24
- m(c.$slots, "default")
29
+ s("span", E, [
30
+ y(n.$slots, "default")
25
31
  ]),
26
32
  s("div", {
27
33
  class: "box-url-box",
28
- style: p({ top: r.value, left: u.value })
34
+ style: g({ top: x.value, left: u.value })
29
35
  }, [
30
- s("div", h, [
31
- s("div", k, [
32
- s("div", N, i(l.value?.name), 1),
33
- s("div", S, i(l.value?.value), 1)
36
+ s("div", S, [
37
+ s("div", B, [
38
+ s("div", V, a(o.value?.name), 1),
39
+ s("div", X, a(o.value?.value), 1)
34
40
  ]),
35
- l.value?.aliasNames && l.value?.aliasNames.length ? (o(), a("div", w, [
41
+ o.value?.aliasNames && o.value?.aliasNames.length ? (i(), l("div", Y, [
36
42
  e[0] || (e[0] = s("div", { class: "box-div-li-span" }, "别名", -1)),
37
- s("div", B, [
38
- (o(!0), a(y, null, _(l.value?.aliasNames, (t) => (o(), a("span", null, i(t), 1))), 256))
43
+ s("div", j, [
44
+ (i(!0), l(_, null, h(o.value?.aliasNames, (t) => (i(), l("span", null, a(t), 1))), 256))
39
45
  ])
40
- ])) : f("", !0),
41
- s("div", C, [
42
- e[1] || (e[1] = s("div", { class: "box-div-li-span" }, " 文件路径 ", -1)),
43
- s("div", E, i(l.value?.key), 1)
44
- ])
46
+ ])) : k("", !0),
47
+ s("div", z, [
48
+ e[1] || (e[1] = s("div", { class: "box-div-li-span" }, "文件路径", -1)),
49
+ s("div", D, a(o.value?.key), 1)
50
+ ]),
51
+ s("div", {
52
+ class: "box-div-but",
53
+ onClick: b
54
+ }, "打开vscode")
45
55
  ])
46
56
  ], 4)
47
57
  ], 512));
48
58
  }
49
59
  });
50
60
  export {
51
- X as default
61
+ O as default
52
62
  };
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),u=require("../boxurl/index.vue.cjs"),g=require("../../router/index.cjs"),m=require("./highlight.vue.cjs"),v=require("../../utils/index.cjs"),d=require("../../utils/glob.cjs"),C=require("vue-router"),x={class:"code"},w={class:"code-top"},E={class:"code-top-but"},N={class:"top-but-files"},V=["onClick"],y={class:"code-highlightjs"},b=e.defineComponent({__name:"index",props:{text:String,value:Object},setup(p){const _=C.useRouter(),t=p;e.watch(()=>t.text,()=>{r()});const a=e.ref([]),o=e.ref(),n=e.ref(!1);function h(){o.value?.raw?v.copyCode(o.value.raw):v.copyCode(t.text)}function f(){n.value=!n.value}function k(){g.toSingle(_,t.value)}function s(i){n.value=!0,o.value=i}function r(){o.value=void 0,n.value=!1,t.text&&d.getTestImportUrl(t.value?.key,t.text,"vue",t.value?.dir,t.value?.url,t.value?.comprops).then(i=>{d.getLocalTextArr(i).then(c=>{a.value=c.filter(l=>l.raw)})})}return r(),(i,c)=>(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("div",w,[e.createElementVNode("div",E,[e.createElementVNode("div",{class:"but-div",onClick:k},"go"),e.createElementVNode("div",{class:"but-div",onClick:h},"复制"),e.createElementVNode("div",{class:"but-div",onClick:f},e.toDisplayString(n.value?"隐藏":"显示"),1),e.createElementVNode("div",N,[e.createVNode(u,{value:t.value},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["but-div",{on:!(o.value&&o.value.value)}]),onClick:c[0]||(c[0]=e.withModifiers(l=>s(),["stop"]))}," index.vue ",2)]),_:1},8,["value"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(l,q)=>(e.openBlock(),e.createBlock(u,{value:l},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["but-div",{on:l.key==o.value?.key}]),onClick:e.withModifiers(B=>s(l),["stop"])},e.toDisplayString(l.value),11,V)]),_:2},1032,["value"]))),256))])])]),e.withDirectives(e.createElementVNode("div",y,[e.createVNode(m,{language:"html",code:o.value?.raw||t.text},null,8,["code"])],512),[[e.vShow,n.value]])]))}});module.exports=b;
1
+ "use strict";const e=require("vue"),u=require("../boxurl/index.vue.cjs"),x=require("../../router/index.cjs"),w=require("./highlight.vue.cjs"),v=require("../../utils/index.cjs"),d=require("../../utils/glob.cjs"),f=require("../../utils/util.cjs"),_=require("@fangzhongya/utils/urls/getUrlCatalogueObj"),b=require("vue-router"),y={class:"code"},E={class:"code-top"},N={class:"code-top-but"},V={class:"top-but-files"},q=["onClick"],S={class:"code-highlightjs"},B=e.defineComponent({__name:"index",props:{text:String,value:Object},setup(p){const g=b.useRouter(),t=p;e.watch(()=>t.text,()=>{s()});const c=e.ref([]),o=e.ref(),a=e.ref(!1);function k(){o.value?.raw?v.copyCode(o.value.raw):v.copyCode(t.text)}function h(){if(o.value?.raw){const l=_.getUrlCatalogueObj(o.value?.key),n=t.value?.name+"_"+l.name+"."+l.suffix;f.exportStringToFile(o.value.raw,n)}else{const l=_.getUrlCatalogueObj(t.value?.key),n=t.value?.name+"_"+l.name+"."+l.suffix;f.exportStringToFile(t.text,n)}}function m(){a.value=!a.value}function C(){x.toSingle(g,t.value)}function r(l){a.value=!0,o.value=l}function s(){o.value=void 0,a.value=!1,t.text&&d.getTestImportUrl(t.value,t.text,"vue").then(l=>{d.getLocalTextArr(l).then(n=>{c.value=n.filter(i=>i.raw)})})}return s(),(l,n)=>(e.openBlock(),e.createElementBlock("div",y,[e.createElementVNode("div",E,[e.createElementVNode("div",N,[e.createElementVNode("div",{class:"but-div",onClick:C},"go"),e.createElementVNode("div",{class:"but-div",onClick:k},"复制"),e.createElementVNode("div",{class:"but-div",onClick:h},"下载"),e.createElementVNode("div",{class:"but-div",onClick:m},e.toDisplayString(a.value?"隐藏":"显示"),1),e.createElementVNode("div",V,[e.createVNode(u,{value:t.value},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["but-div",{on:!(o.value&&o.value.value)}]),onClick:n[0]||(n[0]=e.withModifiers(i=>r(),["stop"]))}," index.vue ",2)]),_:1},8,["value"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(i,j)=>(e.openBlock(),e.createBlock(u,{value:i},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["but-div",{on:i.key==o.value?.key}]),onClick:e.withModifiers(D=>r(i),["stop"])},e.toDisplayString(i.value),11,q)]),_:2},1032,["value"]))),256))])])]),e.withDirectives(e.createElementVNode("div",S,[e.createVNode(w,{language:"html",code:o.value?.raw||t.text},null,8,["code"])],512),[[e.vShow,a.value]])]))}});module.exports=B;
@@ -1,105 +1,115 @@
1
- import { defineComponent as S, watch as B, ref as n, createElementBlock as d, openBlock as u, createElementVNode as t, withDirectives as D, toDisplayString as f, createVNode as p, withCtx as m, withModifiers as h, normalizeClass as _, Fragment as T, renderList as $, createBlock as j, vShow as E } from "vue";
2
- import k from "../boxurl/index.vue.js";
3
- import { toSingle as L } from "../../router/index.js";
4
- import N from "./highlight.vue.js";
1
+ import { defineComponent as j, watch as B, ref as s, createElementBlock as d, openBlock as u, createElementVNode as l, withDirectives as $, toDisplayString as f, createVNode as m, withCtx as p, withModifiers as _, normalizeClass as k, Fragment as E, renderList as F, createBlock as L, vShow as N } from "vue";
2
+ import h from "../boxurl/index.vue.js";
3
+ import { toSingle as O } from "../../router/index.js";
4
+ import U from "./highlight.vue.js";
5
5
  import { copyCode as g } from "../../utils/index.js";
6
6
  import { getTestImportUrl as V, getLocalTextArr as z } from "../../utils/glob.js";
7
+ import { exportStringToFile as C } from "../../utils/util.js";
8
+ import { getUrlCatalogueObj as x } from "@fangzhongya/utils/urls/getUrlCatalogueObj";
7
9
  import { useRouter as A } from "vue-router";
8
- const F = { class: "code" }, H = { class: "code-top" }, I = { class: "code-top-but" }, M = { class: "top-but-files" }, O = ["onClick"], R = { class: "code-highlightjs" }, Y = /* @__PURE__ */ S({
10
+ const H = { class: "code" }, I = { class: "code-top" }, M = { class: "code-top-but" }, R = { class: "top-but-files" }, q = ["onClick"], G = { class: "code-highlightjs" }, le = /* @__PURE__ */ j({
9
11
  __name: "index",
10
12
  props: {
11
13
  text: String,
12
14
  value: Object
13
15
  },
14
- setup(C) {
15
- const x = A(), e = C;
16
+ setup(w) {
17
+ const b = A(), e = w;
16
18
  B(
17
19
  () => e.text,
18
20
  () => {
19
21
  v();
20
22
  }
21
23
  );
22
- const c = n([]), o = n(), i = n(!1);
23
- function w() {
24
- o.value?.raw ? g(o.value.raw) : g(e.text);
24
+ const c = s([]), t = s(), n = s(!1);
25
+ function y() {
26
+ t.value?.raw ? g(t.value.raw) : g(e.text);
27
+ }
28
+ function S() {
29
+ if (t.value?.raw) {
30
+ const o = x(t.value?.key), i = e.value?.name + "_" + o.name + "." + o.suffix;
31
+ C(t.value.raw, i);
32
+ } else {
33
+ const o = x(e.value?.key), i = e.value?.name + "_" + o.name + "." + o.suffix;
34
+ C(e.text, i);
35
+ }
25
36
  }
26
- function b() {
27
- i.value = !i.value;
37
+ function D() {
38
+ n.value = !n.value;
28
39
  }
29
- function y() {
30
- L(x, e.value);
40
+ function T() {
41
+ O(b, e.value);
31
42
  }
32
- function r(a) {
33
- i.value = !0, o.value = a;
43
+ function r(o) {
44
+ n.value = !0, t.value = o;
34
45
  }
35
46
  function v() {
36
- o.value = void 0, i.value = !1, e.text && V(
37
- e.value?.key,
38
- e.text,
39
- "vue",
40
- e.value?.dir,
41
- e.value?.url,
42
- e.value?.comprops
43
- ).then((a) => {
44
- z(a).then((s) => {
45
- c.value = s.filter((l) => l.raw);
46
- });
47
- });
47
+ t.value = void 0, n.value = !1, e.text && V(e.value, e.text, "vue").then(
48
+ (o) => {
49
+ z(o).then((i) => {
50
+ c.value = i.filter((a) => a.raw);
51
+ });
52
+ }
53
+ );
48
54
  }
49
- return v(), (a, s) => (u(), d("div", F, [
50
- t("div", H, [
51
- t("div", I, [
52
- t("div", {
55
+ return v(), (o, i) => (u(), d("div", H, [
56
+ l("div", I, [
57
+ l("div", M, [
58
+ l("div", {
53
59
  class: "but-div",
54
- onClick: y
60
+ onClick: T
55
61
  }, "go"),
56
- t("div", {
62
+ l("div", {
57
63
  class: "but-div",
58
- onClick: w
64
+ onClick: y
59
65
  }, "复制"),
60
- t("div", {
66
+ l("div", {
67
+ class: "but-div",
68
+ onClick: S
69
+ }, "下载"),
70
+ l("div", {
61
71
  class: "but-div",
62
- onClick: b
63
- }, f(i.value ? "隐藏" : "显示"), 1),
64
- t("div", M, [
65
- p(k, {
72
+ onClick: D
73
+ }, f(n.value ? "隐藏" : "显示"), 1),
74
+ l("div", R, [
75
+ m(h, {
66
76
  value: e.value
67
77
  }, {
68
- default: m(() => [
69
- t("div", {
70
- class: _(["but-div", {
71
- on: !(o.value && o.value.value)
78
+ default: p(() => [
79
+ l("div", {
80
+ class: k(["but-div", {
81
+ on: !(t.value && t.value.value)
72
82
  }]),
73
- onClick: s[0] || (s[0] = h((l) => r(), ["stop"]))
83
+ onClick: i[0] || (i[0] = _((a) => r(), ["stop"]))
74
84
  }, " index.vue ", 2)
75
85
  ]),
76
86
  _: 1
77
87
  }, 8, ["value"]),
78
- (u(!0), d(T, null, $(c.value, (l, U) => (u(), j(k, { value: l }, {
79
- default: m(() => [
80
- t("div", {
81
- class: _(["but-div", {
82
- on: l.key == o.value?.key
88
+ (u(!0), d(E, null, F(c.value, (a, J) => (u(), L(h, { value: a }, {
89
+ default: p(() => [
90
+ l("div", {
91
+ class: k(["but-div", {
92
+ on: a.key == t.value?.key
83
93
  }]),
84
- onClick: h((q) => r(l), ["stop"])
85
- }, f(l.value), 11, O)
94
+ onClick: _((K) => r(a), ["stop"])
95
+ }, f(a.value), 11, q)
86
96
  ]),
87
97
  _: 2
88
98
  }, 1032, ["value"]))), 256))
89
99
  ])
90
100
  ])
91
101
  ]),
92
- D(t("div", R, [
93
- p(N, {
102
+ $(l("div", G, [
103
+ m(U, {
94
104
  language: "html",
95
- code: o.value?.raw || e.text
105
+ code: t.value?.raw || e.text
96
106
  }, null, 8, ["code"])
97
107
  ], 512), [
98
- [E, i.value]
108
+ [N, n.value]
99
109
  ])
100
110
  ]));
101
111
  }
102
112
  });
103
113
  export {
104
- Y as default
114
+ le as default
105
115
  };
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),x=require("../code/highlight.vue.cjs"),f=require("../../utils/index.cjs"),a=require("./code.cjs"),y={class:"set-code"},C={class:"but-div set-code-but"},V={class:"set-code-html"},k=e.defineComponent({__name:"set-code",props:{name:{type:String},param:{type:Object},value:{type:Object},slotValue:{type:Object},propsText:{type:Object},exposeText:{type:Object}},setup(d){const t=d,c=e.ref("");e.watch([()=>t.name,()=>t.param,()=>t.value,()=>t.slotValue,()=>t.propsText,()=>t.exposeText],()=>{c.value=a.getHmtl(t.name||"",t.param||{},t.value||{},t.slotValue,t.propsText,t.exposeText)},{deep:!0});const s=e.ref(!1);function r(){c.value=a.getHmtl(t.name||"",t.param||{},t.value||{},t.slotValue,t.propsText,t.exposeText)}function u(){s.value=!s.value}function p(){f.copyCode(c.value)}function v(n,l,b="text/plain"){const h=new Blob([n],{type:b}),i=URL.createObjectURL(h),o=document.createElement("a");o.href=i,o.download=l,o.style.display="none",document.body.appendChild(o),o.click(),setTimeout(()=>{document.body.removeChild(o),URL.revokeObjectURL(i)},100)}function m(){v(c.value,t.name+".vue")}return(n,l)=>(e.openBlock(),e.createElementBlock("div",y,[e.createElementVNode("div",{onClick:u,class:"set-code-buts"},[l[0]||(l[0]=e.createElementVNode("div",null,"代码",-1)),e.createElementVNode("div",C,e.toDisplayString(s.value?"显示":"隐藏"),1),e.createElementVNode("div",{onClick:e.withModifiers(p,["stop"]),class:"but-div set-code-but"}," 复制 "),e.createElementVNode("div",{onClick:e.withModifiers(m,["stop"]),class:"but-div set-code-but"}," 导出 "),e.createElementVNode("div",{onClick:e.withModifiers(r,["stop"]),class:"but-div set-code-but"}," 刷新 ")]),e.withDirectives(e.createElementVNode("div",V,[e.createVNode(x,{language:"html",code:c.value},null,8,["code"])],512),[[e.vShow,s.value]])]))}});module.exports=k;
1
+ "use strict";const e=require("vue"),d=require("../code/highlight.vue.cjs"),p=require("../../utils/index.cjs"),l=require("./code.cjs"),v=require("../../utils/util.cjs"),m={class:"set-code"},h={class:"but-div set-code-but"},x={class:"set-code-html"},b=e.defineComponent({__name:"set-code",props:{name:{type:String},param:{type:Object},value:{type:Object},slotValue:{type:Object},propsText:{type:Object},exposeText:{type:Object}},setup(i){const t=i,o=e.ref("");e.watch([()=>t.name,()=>t.param,()=>t.value,()=>t.slotValue,()=>t.propsText,()=>t.exposeText],()=>{o.value=l.getHmtl(t.name||"",t.param||{},t.value||{},t.slotValue,t.propsText,t.exposeText)},{deep:!0});const s=e.ref(!1);function n(){o.value=l.getHmtl(t.name||"",t.param||{},t.value||{},t.slotValue,t.propsText,t.exposeText)}function a(){s.value=!s.value}function r(){p.copyCode(o.value)}function u(){v.exportStringToFile(o.value,t.name+".vue")}return(f,c)=>(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",{onClick:a,class:"set-code-buts"},[c[0]||(c[0]=e.createElementVNode("div",null,"代码",-1)),e.createElementVNode("div",h,e.toDisplayString(s.value?"显示":"隐藏"),1),e.createElementVNode("div",{onClick:e.withModifiers(r,["stop"]),class:"but-div set-code-but"}," 复制 "),e.createElementVNode("div",{onClick:e.withModifiers(u,["stop"]),class:"but-div set-code-but"}," 下载 "),e.createElementVNode("div",{onClick:e.withModifiers(n,["stop"]),class:"but-div set-code-but"}," 刷新 ")]),e.withDirectives(e.createElementVNode("div",x,[e.createVNode(d,{language:"html",code:o.value},null,8,["code"])],512),[[e.vShow,s.value]])]))}});module.exports=b;
@@ -1,8 +1,9 @@
1
- import { defineComponent as y, ref as p, watch as C, createElementBlock as k, openBlock as T, createElementVNode as t, withDirectives as _, toDisplayString as g, withModifiers as n, createVNode as j, vShow as w } from "vue";
2
- import O from "../code/highlight.vue.js";
3
- import { copyCode as V } from "../../utils/index.js";
4
- import { getHmtl as u } from "./code.js";
5
- const R = { class: "set-code" }, S = { class: "but-div set-code-but" }, L = { class: "set-code-html" }, H = /* @__PURE__ */ y({
1
+ import { defineComponent as v, ref as c, watch as m, createElementBlock as f, openBlock as x, createElementVNode as t, withDirectives as b, toDisplayString as h, withModifiers as l, createVNode as C, vShow as _ } from "vue";
2
+ import k from "../code/highlight.vue.js";
3
+ import { copyCode as y } from "../../utils/index.js";
4
+ import { getHmtl as i } from "./code.js";
5
+ import { exportStringToFile as T } from "../../utils/util.js";
6
+ const g = { class: "set-code" }, V = { class: "but-div set-code-but" }, j = { class: "set-code-html" }, H = /* @__PURE__ */ v({
6
7
  __name: "set-code",
7
8
  props: {
8
9
  name: {
@@ -24,9 +25,9 @@ const R = { class: "set-code" }, S = { class: "but-div set-code-but" }, L = { cl
24
25
  type: Object
25
26
  }
26
27
  },
27
- setup(d) {
28
- const e = d, s = p("");
29
- C(
28
+ setup(n) {
29
+ const e = n, o = c("");
30
+ m(
30
31
  [
31
32
  () => e.name,
32
33
  () => e.param,
@@ -36,7 +37,7 @@ const R = { class: "set-code" }, S = { class: "but-div set-code-but" }, L = { cl
36
37
  () => e.exposeText
37
38
  ],
38
39
  () => {
39
- s.value = u(
40
+ o.value = i(
40
41
  e.name || "",
41
42
  e.param || {},
42
43
  e.value || {},
@@ -47,9 +48,9 @@ const R = { class: "set-code" }, S = { class: "but-div set-code-but" }, L = { cl
47
48
  },
48
49
  { deep: !0 }
49
50
  );
50
- const l = p(!1);
51
- function r() {
52
- s.value = u(
51
+ const s = c(!1);
52
+ function p() {
53
+ o.value = i(
53
54
  e.name || "",
54
55
  e.param || {},
55
56
  e.value || {},
@@ -58,48 +59,42 @@ const R = { class: "set-code" }, S = { class: "but-div set-code-but" }, L = { cl
58
59
  e.exposeText
59
60
  );
60
61
  }
61
- function m() {
62
- l.value = !l.value;
63
- }
64
- function v() {
65
- V(s.value);
62
+ function u() {
63
+ s.value = !s.value;
66
64
  }
67
- function b(a, c, h = "text/plain") {
68
- const x = new Blob([a], { type: h }), i = URL.createObjectURL(x), o = document.createElement("a");
69
- o.href = i, o.download = c, o.style.display = "none", document.body.appendChild(o), o.click(), setTimeout(() => {
70
- document.body.removeChild(o), URL.revokeObjectURL(i);
71
- }, 100);
65
+ function r() {
66
+ y(o.value);
72
67
  }
73
- function f() {
74
- b(s.value, e.name + ".vue");
68
+ function d() {
69
+ T(o.value, e.name + ".vue");
75
70
  }
76
- return (a, c) => (T(), k("div", R, [
71
+ return (w, a) => (x(), f("div", g, [
77
72
  t("div", {
78
- onClick: m,
73
+ onClick: u,
79
74
  class: "set-code-buts"
80
75
  }, [
81
- c[0] || (c[0] = t("div", null, "代码", -1)),
82
- t("div", S, g(l.value ? "显示" : "隐藏"), 1),
76
+ a[0] || (a[0] = t("div", null, "代码", -1)),
77
+ t("div", V, h(s.value ? "显示" : "隐藏"), 1),
83
78
  t("div", {
84
- onClick: n(v, ["stop"]),
79
+ onClick: l(r, ["stop"]),
85
80
  class: "but-div set-code-but"
86
81
  }, " 复制 "),
87
82
  t("div", {
88
- onClick: n(f, ["stop"]),
83
+ onClick: l(d, ["stop"]),
89
84
  class: "but-div set-code-but"
90
- }, " 导出 "),
85
+ }, " 下载 "),
91
86
  t("div", {
92
- onClick: n(r, ["stop"]),
87
+ onClick: l(p, ["stop"]),
93
88
  class: "but-div set-code-but"
94
89
  }, " 刷新 ")
95
90
  ]),
96
- _(t("div", L, [
97
- j(O, {
91
+ b(t("div", j, [
92
+ C(k, {
98
93
  language: "html",
99
- code: s.value
94
+ code: o.value
100
95
  }, null, 8, ["code"])
101
96
  ], 512), [
102
- [w, l.value]
97
+ [_, s.value]
103
98
  ])
104
99
  ]));
105
100
  }
@@ -12,6 +12,7 @@ export interface GlobComs {
12
12
  }
13
13
  export interface Component {
14
14
  dir: string;
15
+ cwd?: string;
15
16
  extensions?: Array<string>;
16
17
  alias?: string;
17
18
  aliass?: ObjStr;
@@ -34,6 +35,7 @@ export interface ExampleObj {
34
35
  tests?: boolean;
35
36
  testsNanme?: string;
36
37
  dir?: string;
38
+ cwd?: string;
37
39
  /**
38
40
  * 0 : url 下面就是组件
39
41
  * 1 : dir 名称开始
@@ -73,6 +75,7 @@ export interface Config {
73
75
  redirect?: boolean;
74
76
  useparam?: boolean;
75
77
  resolve?: Resolve[];
78
+ directory?: string;
76
79
  components: Array<Components>;
77
80
  example?: ExampleObj;
78
81
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./storage.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const T=require("@fangzhongya/utils/name/humpToLine"),R=require("@fangzhongya/utils/name/lineToLargeHump"),x=require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");const E=require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const w=["vue","js","ts"];function K(r,e){let n=T.humpToLine(r.name),i=[];return r.alias&&i.push(r.alias+"-"+n),e&&e.length>0&&e.forEach(t=>{r.alias&&i.push(r.alias+"-"+t+"-"+n),i.push(t+"-"+n)}),i}function L(r){return r.sort((e,n)=>{let i=x.appearNum(e,"/"),t=x.appearNum(n,"/");return i==t?n.length-e.length:t-i}),r}function N(r=[],e=[],n=[]){let i=e;(!i||i.length==0)&&(i=w);let t=[];return r&&r.length>0&&(t=r),n&&n.length>0&&n.forEach(a=>{i?.forEach(p=>{t.push(a+"."+p)})}),t=[...new Set(t)],L(t)}function S(r,e,n={},i=""){for(let t=0;t<e.length;t++){const a=e[t],p=new RegExp("^.*/([^/]+)"+a+"$");let d=r.match(p);if(d){const f=[],u={};let c="";Object.keys(n).forEach(g=>{let l=n[g];r.startsWith(l+"/")&&(c=l,u[g]=l,f.push(g))});let h=d[1],o={url:"",dir:"",suffix:E.getSuffix(r),name:R.lineToLargeHump(h),value:h,key:"",tdir:"",adir:c,alias:i,aliass:u,aliasNames:[],raw:"",getRaw:null,mds:[],tests:void 0};return o.aliasNames=K(o,f),o}}}function M(r){q.setSession("aside.key",r)}function O(){return q.getSession("aside.key")}function y(r){let e=r.match(/\/([^\/]+)\/$/);return e&&e.length>1?e[1]:""}function A(r,e){return e?new RegExp(e).test(r):!1}function C(r,e){return e?new RegExp(e+"(\\.(js|ts))?$").test(r):!1}function z(r,e,n,i,t){const a=[],p=[],d=N(e.matchexts,e.extensions,e.matchs),f=y(e.dir);return r.forEach(u=>{const c=e.dir.replace(/^\.\/|((\.\.\/)+)/,"/");let h=u.indexOf(c),o=e.dir.substring(0,e.dir.indexOf(c))+u.substring(h);const g=new RegExp("^"+e.dir);let l=o.replace(g,"");if(t.comprops&&A("/"+l,t.comprops)||t.curprops&&C("/"+l,t.curprops)){let s={};s.url=o,s.comprops=t.comprops||"",s.curprops=t.curprops||"",s.value=l,s.dir=e.dir,s.suffix=E.getSuffix(u),s.tdir=f,s.key=u,s.raw="",s.getRaw=m(n,u),a.push(s)}else{let s=S(l,d,e.aliass,e.alias);s&&(s.url=o,s.comprops=t.comprops,s.curprops=t.curprops,s.dir=e.dir,s.tdir=f,s.key=u,s.component=i[u],s.getRaw=m(n,u),p.push(s))}}),{props:a,components:p}}function m(r,e){return typeof r=="function"?r:r?r[e]:null}exports.defaultExtensions=w;exports.getAsideKey=O;exports.getComponentsArr=z;exports.getMatchs=N;exports.getRawValue=m;exports.getUrlName=S;exports.isComprops=A;exports.isCurprops=C;exports.setAsideKey=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./storage.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const T=require("@fangzhongya/utils/name/humpToLine"),R=require("@fangzhongya/utils/name/lineToLargeHump"),x=require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");const q=require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const E=["vue","js","ts"];function K(r,e){let n=T.humpToLine(r.name),i=[];return r.alias&&i.push(r.alias+"-"+n),e&&e.length>0&&e.forEach(t=>{r.alias&&i.push(r.alias+"-"+t+"-"+n),i.push(t+"-"+n)}),i}function L(r){return r.sort((e,n)=>{let i=x.appearNum(e,"/"),t=x.appearNum(n,"/");return i==t?n.length-e.length:t-i}),r}function N(r=[],e=[],n=[]){let i=e;(!i||i.length==0)&&(i=E);let t=[];return r&&r.length>0&&(t=r),n&&n.length>0&&n.forEach(a=>{i?.forEach(p=>{t.push(a+"."+p)})}),t=[...new Set(t)],L(t)}function S(r,e,n={},i=""){for(let t=0;t<e.length;t++){const a=e[t],p=new RegExp("^.*/([^/]+)"+a+"$");let d=r.match(p);if(d){const c=[],u={};let f="";Object.keys(n).forEach(g=>{let l=n[g];r.startsWith(l+"/")&&(f=l,u[g]=l,c.push(g))});let h=d[1],o={url:"",dir:"",cwd:"",suffix:q.getSuffix(r),name:R.lineToLargeHump(h),value:h,key:"",tdir:"",adir:f,alias:i,aliass:u,aliasNames:[],raw:"",getRaw:null,mds:[],tests:void 0};return o.aliasNames=K(o,c),o}}}function M(r){w.setSession("aside.key",r)}function O(){return w.getSession("aside.key")}function y(r){let e=r.match(/\/([^\/]+)\/$/);return e&&e.length>1?e[1]:""}function A(r,e){return e?new RegExp(e).test(r):!1}function C(r,e){return e?new RegExp(e+"(\\.(js|ts))?$").test(r):!1}function z(r,e,n,i,t){const a=[],p=[],d=N(e.matchexts,e.extensions,e.matchs),c=y(e.dir);return r.forEach(u=>{const f=e.dir.replace(/^\.\/|((\.\.\/)+)/,"/");let h=u.indexOf(f),o=e.dir.substring(0,e.dir.indexOf(f))+u.substring(h);const g=new RegExp("^"+e.dir);let l=o.replace(g,"");if(t.comprops&&A("/"+l,t.comprops)||t.curprops&&C("/"+l,t.curprops)){let s={};s.url=o,s.comprops=t.comprops||"",s.curprops=t.curprops||"",s.value=l,s.dir=e.dir,s.cwd=e.cwd,s.suffix=q.getSuffix(u),s.tdir=c,s.key=u,s.raw="",s.getRaw=m(n,u),a.push(s)}else{let s=S(l,d,e.aliass,e.alias);s&&(s.url=o,s.comprops=t.comprops,s.curprops=t.curprops,s.dir=e.dir,s.cwd=e.cwd,s.tdir=c,s.key=u,s.component=i[u],s.getRaw=m(n,u),p.push(s))}}),{props:a,components:p}}function m(r,e){return typeof r=="function"?r:r?r[e]:null}exports.defaultExtensions=E;exports.getAsideKey=O;exports.getComponentsArr=z;exports.getMatchs=N;exports.getRawValue=m;exports.getUrlName=S;exports.isComprops=A;exports.isCurprops=C;exports.setAsideKey=M;
@@ -10,6 +10,7 @@ export interface TextObj {
10
10
  value: string;
11
11
  suffix: string;
12
12
  key: string;
13
+ cwd?: string;
13
14
  raw: string;
14
15
  getRaw: GetRaw | null;
15
16
  }
@@ -22,6 +23,7 @@ export interface PropObj {
22
23
  suffix: string;
23
24
  head: string;
24
25
  key: string;
26
+ cwd?: string;
25
27
  dir: string;
26
28
  }
27
29
  export interface PropsObj extends TextObj {
@@ -1,4 +1,4 @@
1
- import { getSession as w, setSession as N } from "./storage.js";
1
+ import { getSession as E, setSession as N } from "./storage.js";
2
2
  import "@fangzhongya/utils/basic/object/mergeObject";
3
3
  import "@fangzhongya/utils/basic/array/toggleArray";
4
4
  import { humpToLine as A } from "@fangzhongya/utils/name/humpToLine";
@@ -8,7 +8,7 @@ import "@fangzhongya/utils/basic/string/firstLower";
8
8
  import "@fangzhongya/utils/basic/array/duplicateRemoval";
9
9
  import "@fangzhongya/utils/basic/array/asyncMergeArray";
10
10
  import "@fangzhongya/utils/basic/string/firstUpper";
11
- import { getSuffix as E } from "@fangzhongya/utils/urls/getSuffix";
11
+ import { getSuffix as w } from "@fangzhongya/utils/urls/getSuffix";
12
12
  import "@fangzhongya/utils/basic/array/replaceAfter";
13
13
  const S = ["vue", "js", "ts"];
14
14
  function z(t, e) {
@@ -47,7 +47,8 @@ function T(t, e, n = {}, i = "") {
47
47
  let g = d[1], p = {
48
48
  url: "",
49
49
  dir: "",
50
- suffix: E(t),
50
+ cwd: "",
51
+ suffix: w(t),
51
52
  name: R(g),
52
53
  value: g,
53
54
  key: "",
@@ -65,11 +66,11 @@ function T(t, e, n = {}, i = "") {
65
66
  }
66
67
  }
67
68
  }
68
- function G(t) {
69
+ function I(t) {
69
70
  N("aside.key", t);
70
71
  }
71
- function I() {
72
- return w("aside.key");
72
+ function J() {
73
+ return E("aside.key");
73
74
  }
74
75
  function $(t) {
75
76
  let e = t.match(/\/([^\/]+)\/$/);
@@ -81,7 +82,7 @@ function K(t, e) {
81
82
  function L(t, e) {
82
83
  return e ? new RegExp(e + "(\\.(js|ts))?$").test(t) : !1;
83
84
  }
84
- function J(t, e, n, i, r) {
85
+ function P(t, e, n, i, r) {
85
86
  const u = [], a = [], d = O(e.matchexts, e.extensions, e.matchs), f = $(e.dir);
86
87
  return t.forEach((o) => {
87
88
  const c = e.dir.replace(/^\.\/|((\.\.\/)+)/, "/");
@@ -90,10 +91,10 @@ function J(t, e, n, i, r) {
90
91
  let l = p.replace(m, "");
91
92
  if (r.comprops && K("/" + l, r.comprops) || r.curprops && L("/" + l, r.curprops)) {
92
93
  let s = {};
93
- s.url = p, s.comprops = r.comprops || "", s.curprops = r.curprops || "", s.value = l, s.dir = e.dir, s.suffix = E(o), s.tdir = f, s.key = o, s.raw = "", s.getRaw = x(n, o), u.push(s);
94
+ s.url = p, s.comprops = r.comprops || "", s.curprops = r.curprops || "", s.value = l, s.dir = e.dir, s.cwd = e.cwd, s.suffix = w(o), s.tdir = f, s.key = o, s.raw = "", s.getRaw = x(n, o), u.push(s);
94
95
  } else {
95
96
  let s = T(l, d, e.aliass, e.alias);
96
- s && (s.url = p, s.comprops = r.comprops, s.curprops = r.curprops, s.dir = e.dir, s.tdir = f, s.key = o, s.component = i[o], s.getRaw = x(n, o), a.push(s));
97
+ s && (s.url = p, s.comprops = r.comprops, s.curprops = r.curprops, s.dir = e.dir, s.cwd = e.cwd, s.tdir = f, s.key = o, s.component = i[o], s.getRaw = x(n, o), a.push(s));
97
98
  }
98
99
  }), {
99
100
  props: u,
@@ -105,12 +106,12 @@ function x(t, e) {
105
106
  }
106
107
  export {
107
108
  S as defaultExtensions,
108
- I as getAsideKey,
109
- J as getComponentsArr,
109
+ J as getAsideKey,
110
+ P as getComponentsArr,
110
111
  O as getMatchs,
111
112
  x as getRawValue,
112
113
  T as getUrlName,
113
114
  K as isComprops,
114
115
  L as isCurprops,
115
- G as setAsideKey
116
+ I as setAsideKey
116
117
  };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../config.cjs"),G=require("@fangzhongya/utils/html/getVueText"),c=require("./common.cjs"),B=require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const E=require("@fangzhongya/utils/name/humpToLine"),A=require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const W=require("@fangzhongya/utils/basic/string/firstLower"),F=require("@fangzhongya/utils/basic/array/duplicateRemoval"),M=require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");const h=require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const D=require("./index.cjs"),w={},d={},v=[],I={},j={},g={};function J(){return b.getConfig("example")}function Q(t,e,n,r){const a=B.mergeObject(e,n||{},3,!0);a.exampless=a.exampless||[],a.examplessRaw=a.examplessRaw||[];const s=[],i=a.examples;i&&Object.keys(i).forEach(o=>{s.push(o),j[o]=i[o]});const u=a.examplesRaw,l=[];if(a.urls&&a.urls.length>0?(a.exampless=a.urls,a.urls.forEach(o=>{l.push(o),u&&(g[o]=N(u,o))})):(a.exampless=s,u&&Object.keys(u).forEach(o=>{l.push(o),g[o]=N(u,o)})),a.examples=void 0,e.tests&&r){const o=e.testsNanme||"/tests/";typeof o=="string"?Object.keys(r).forEach(f=>{f.includes(o)&&(a.exampless.push(f),l.push(f),g[f]=N(r,f))}):Object.keys(r).forEach(f=>{o.test(f)&&(a.exampless.push(f),l.push(f),g[f]=N(r,f))})}a.exampless=[...new Set(a.exampless)],a.examplessRaw=[...new Set(l)],a.examplesRaw=void 0,I[t]=a}function N(t,e){return typeof t=="function"?t:t&&(t[e]||t)}const q={};function X(t){const e=b.getConfig("resolve");if(q[t])return q[t];for(let n of e)if(t.startsWith(n.find+"/")){const a=n.replacement.replaceAll("\\","/")+t.replace(n.find+"/","/");return q[t]=a,a}}async function Y(t,e){let n="";if(e=="vue"?n=G.getVueTexts(t).script:(e=="js"||e=="ts"||e=="")&&(n=t),n){const r=await D.getTextImport(n),a=[];return r&&r.length>0&&r.forEach(s=>{if(s)if(s.startsWith("./")||s.startsWith("../"))a.push(s);else{const i=X(s);i&&a.push(i)}}),a}}function Z(t){return new Promise(e=>{t?t.raw?e(t.raw):t.getRaw?t.getRaw(t).then(n=>{const r=C(n);t.raw=r,t.getRaw=null,e(r)}):e(""):e("")})}function K(t,e){t=(t||"")+"";let n="";switch(t){case"1":n=e.tdir+"/";break;case"2":n=e.adir+"/";break;case"3":n=e.tdir+"/"+e.adir+"/";break}return n}function _(t,e,n){t=(t||"")+"",n=(n||"")+"";let r=E.humpToLine(e.name),a=[];const s=Object.values(e.aliass||{});if(t==="1")e.alias&&a.push(e.alias+"-"+r);else if(t==="2")s&&s.length>0&&s.forEach(u=>{a.push(u+"-"+r)});else if(t==="3"){let u="";e.alias&&(u=e.alias+"-"),s?.forEach(l=>{a.push(u+l+"-"+r)})}else t==="4"?e.aliasNames?.forEach(u=>{a.push(E.humpToLine(u))}):t=="9"&&(a.push(r),e.aliasNames?.forEach(u=>{a.push(E.humpToLine(u))}));a.length==0&&a.push(r);let i=[];return n==="1"?a.forEach(u=>{let l=A.lineToLargeHump(u);i.push(l,W.firstLower(l))}):n==="2"?a.forEach(u=>{let l=A.lineToLargeHump(u);i.push(u,l,W.firstLower(l))}):i=[...a],i=[...new Set(i)],i}function y(t,e,n,r){const a=[];return n.examplessRaw.forEach(s=>{for(let i=0;i<e.length;i++){const u=e[i];if(s==t+u+n.md+".md"){a.push({topurl:t,comkey:r.key,suffix:h.getSuffix(s),name:r.name,value:u,key:s,raw:"",getRaw:c.getRawValue(g,s)});break}}}),a}function P(t){R();const e=w[t];if(e.tests&&Object.keys(e.tests).length>0)return e.tests;{const n=I[e.dir],r=n.dir+K(n.level||0,e),a=_(n.aliaslevel||0,e,n.componentName||0);e.mds=y(r,a,n,e);const s={};return n.exampless.forEach(i=>{for(let u=0;u<a.length;u++){const l=a[u];if(i.startsWith(r+l+"/")){const o=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),f=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let p=i.match(o)||i.match(f);if(p&&p.length>0){let m="";p&&p.length>1&&(m=p[1]),s[i]={topurl:r,name:l,value:m,suffix:h.getSuffix(i),comname:e.name,comkey:e.key,key:i,dir:e.dir,url:i,component:j[i],raw:"",getRaw:c.getRawValue(g,i)};break}}}}),n.tests&&z(s,e,n),e.tests=s,s}}function z(t,e,n){const r=e.url.substring(0,e.url.lastIndexOf("/"+e.value+"/"))+"/"+e.value,a=n.testsNanme||"/tests/";typeof a=="string"?n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:c.getRawValue(g,s)});else if(s.startsWith(r+a)){const i=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),u=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let l=s.match(i)||s.match(u);if(l&&l.length>0){let o="";l&&l.length>1&&(o=l[1]),t[s]={topurl:r,name:e.value,value:o,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,key:s,dir:e.dir,url:s,component:j[s],raw:"",getRaw:c.getRawValue(g,s)}}}}}):n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:c.getRawValue(g,s)});else if(a.test(s)){const i=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),u=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let l=s.match(i)||s.match(u);if(l&&l.length>0){let o="";l&&l.length>1&&(o=l[1]),t[s]={topurl:r,name:e.value,value:o,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,key:s,dir:e.dir,url:s,component:j[s],raw:"",getRaw:c.getRawValue(g,s)}}}}})}function k(t){if(t){const e=P(t);return Object.values(e)}else return[]}function ee(t,e,n){R();const r=P(n),a=[];if(e){let s=r[e];if(s)return a.push(s),a}return Object.values(r).forEach(s=>{s.name+"/"+s.value==t&&a.push(s)}),a}function te(t){return P(t),w[t].mds}async function V(t,e,n,r,a,s,i){let u=await Y(e,n)||[],l=a.split("/");return u.map(o=>{if(o.startsWith("./")){let f=l.slice(0,l.length-1).join("/"),p=o.substring(2);const m=f.replace(/^\.\/|((\.\.\/)+)/,"/");let x=t.indexOf(m)+m.length;return{key:t.substring(0,x)+"/"+p,name:o,comprops:s||"",curprops:i||"",value:p,suffix:h.getSuffix(o),head:f,dir:r,url:f+"/"+p}}else if(o.startsWith("../")){let f=o.split("/"),p=0;for(let L=0;L<f.length;L++)if(f[L]!=".."){p=L;break}let m=f.slice(p,f.length),x=l.slice(0,l.length-p-1).join("/"),O=m.join("/");const S=x.replace(/^\.\/|((\.\.\/)+)/,"/");let H=t.indexOf(S)+S.length;return{key:t.substring(0,H)+"/"+O,name:O,comprops:s||"",curprops:i||"",value:O,suffix:h.getSuffix(o),head:x,dir:r,url:x+"/"+O}}else{const f=r.replace(/^\.\/|((\.\.\/)+)/,"/");let p=o.indexOf(f)+f.length,m=o.substring(p),x=r.substring(0,r.length-1);return{key:o,name:m,comprops:s||"",curprops:i||"",value:m,suffix:h.getSuffix(o),head:x,dir:r,url:x+"/"+m}}})}function se(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>({raw:"",name:r.name,value:r.value,suffix:h.getSuffix(r.key),key:r.key,getRaw:c.getRawValue(g,r.key)}));M.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(u=>{const l=C(u);s.raw=l,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}function ne(){const t=J();b.getConfig("components")?.forEach(n=>{const r=ie(n);let a=n.dir||"";Q(a,t,n.example,r)})}const T="default";function re(t){let e=E.humpToLine(t.name),n=[...t.aliasNames];n.push(e),n.forEach(r=>{v.push({name:r,value:t.key})})}function ae(t,e){const n={};e?.forEach(r=>{w[r.key]=r,re(r);const a=Object.values(r.aliass||{});a&&a.length?a.forEach(s=>{n[s]=n[s]||[],n[s].push(r.key)}):(n[T]=n[T]||[],n[T].push(r.key))})}function ie(t){let e,n;const r=t.resolver;r&&Object.keys(r).forEach(s=>{typeof t[s]>"u"&&(t[s]=r[s])}),e=t.alias||T;let a=t?.urls||Object.keys(t.componentsRaw);return n=c.getComponentsArr(a,t,t.componentsRaw,t.components,t),n&&n?.props&&n.props.forEach(s=>{d[s.url]=s}),ae(e,n.components),t.componentsRaw}function le(t){return R(),w[t]}function R(){return Object.keys(w).length==0&&ne(),Object.values(w)}function oe(){return R(),d}function ue(t,e,n){R();const r=[];if(n){let s=w[n];if(s&&s.key)return[s]}let a=E.humpToLine(t);return v.forEach(s=>{e?s.name.includes(a)&&r.push(w[s.value]):s.name==a&&r.push(w[s.value])}),F.duplicateRemoval(r,"key")}async function fe(t,e){let n=t;if(t){let r=(await V(e.key,t,e.suffix,e.dir,e.url,e.comprops,e.curprops)).filter(a=>c.isComprops(a.key,e.comprops||"")||c.isCurprops(a.key,e.curprops||""));n=await $(r)+n}return n}function ce(t){const e=t.url,n=t.key;return d[e]||d[e+".js"]||d[e+".ts"]||d[n]||d[n+".js"]||d[n+".ts"]}function U(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>ce(r)).filter(r=>!!r);M.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(async u=>{const l=C(u);let o=await fe(l,t[i]);s.raw=o,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}async function $(t){return((await U(t))?.map(r=>r.raw)||[]).join(`
2
- `)}async function pe(t,e){let n=t;if(t&&(e.comprops||e.curprops)){let r=(await V(e.key,t,e.suffix,e.dir,e.url,e.comprops||"",e.curprops)).filter(s=>c.isComprops(s.key,e.comprops||"")||c.isCurprops(s.key,e.curprops||""));n=await $(r)+n}return n}function C(t){return t&&typeof t=="object"?t.default||"":(t||"")+""}function me(t){return new Promise(e=>{if(t){R();const n=w[t];n?n.raw?e(n.raw):n.getRaw?n.getRaw(n).then(r=>{const a=C(r);pe(a,n).then(s=>{n.raw=s,n.getRaw=null,e(s)})}):e(""):e("")}else e("")})}exports.defaultName=T;exports.getCompoName=ue;exports.getCompoNameKey=le;exports.getCompoNameObj=R;exports.getComponentPropsObjs=oe;exports.getGetRawValue=C;exports.getKeyMds=te;exports.getLevelUrl=K;exports.getLocalTextArr=se;exports.getLocalTextComponents=me;exports.getLocalTextTests=Z;exports.getPropsRaws=U;exports.getTestImportUrl=V;exports.getTestName=k;exports.getTestNameObj=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("../config.cjs"),B=require("@fangzhongya/utils/html/getVueText"),c=require("./common.cjs"),F=require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const T=require("@fangzhongya/utils/name/humpToLine"),W=require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const M=require("@fangzhongya/utils/basic/string/firstLower"),D=require("@fangzhongya/utils/basic/array/duplicateRemoval"),I=require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");const h=require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const J=require("./index.cjs"),w={},R={},K=[],U={},b={},g={};function Q(){return P.getConfig("example")}function X(t,e,n,r){const a=F.mergeObject(e,n||{},3,!0);a.exampless=a.exampless||[],a.examplessRaw=a.examplessRaw||[];const s=[],i=a.examples;i&&Object.keys(i).forEach(u=>{s.push(u),b[u]=i[u]});const l=a.examplesRaw,o=[];if(a.urls&&a.urls.length>0?(a.exampless=a.urls,a.urls.forEach(u=>{o.push(u),l&&(g[u]=j(l,u))})):(a.exampless=s,l&&Object.keys(l).forEach(u=>{o.push(u),g[u]=j(l,u)})),a.examples=void 0,e.tests&&r){const u=e.testsNanme||"/tests/";typeof u=="string"?Object.keys(r).forEach(f=>{f.includes(u)&&(a.exampless.push(f),o.push(f),g[f]=j(r,f))}):Object.keys(r).forEach(f=>{u.test(f)&&(a.exampless.push(f),o.push(f),g[f]=j(r,f))})}a.exampless=[...new Set(a.exampless)],a.examplessRaw=[...new Set(o)],a.examplesRaw=void 0,U[t]=a}function j(t,e){return typeof t=="function"?t:t&&(t[e]||t)}const q={};function Y(t){const e=P.getConfig("resolve");if(q[t])return q[t];for(let n of e)if(t.startsWith(n.find+"/")){const a=n.replacement.replaceAll("\\","/")+t.replace(n.find+"/","/");return q[t]=a,a}}async function Z(t,e){let n="";if(e=="vue"?n=B.getVueTexts(t).script:(e=="js"||e=="ts"||e=="")&&(n=t),n){const r=await J.getTextImport(n),a=[];return r&&r.length>0&&r.forEach(s=>{if(s)if(s.startsWith("./")||s.startsWith("../"))a.push(s);else{const i=Y(s);i&&a.push(i)}}),a}}function _(t){return new Promise(e=>{t?t.raw?e(t.raw):t.getRaw?t.getRaw(t).then(n=>{const r=L(n);t.raw=r,t.getRaw=null,e(r)}):e(""):e("")})}function $(t,e){t=(t||"")+"";let n="";switch(t){case"1":n=e.tdir+"/";break;case"2":n=e.adir+"/";break;case"3":n=e.tdir+"/"+e.adir+"/";break}return n}function y(t,e,n){t=(t||"")+"",n=(n||"")+"";let r=T.humpToLine(e.name),a=[];const s=Object.values(e.aliass||{});if(t==="1")e.alias&&a.push(e.alias+"-"+r);else if(t==="2")s&&s.length>0&&s.forEach(l=>{a.push(l+"-"+r)});else if(t==="3"){let l="";e.alias&&(l=e.alias+"-"),s?.forEach(o=>{a.push(l+o+"-"+r)})}else t==="4"?e.aliasNames?.forEach(l=>{a.push(T.humpToLine(l))}):t=="9"&&(a.push(r),e.aliasNames?.forEach(l=>{a.push(T.humpToLine(l))}));a.length==0&&a.push(r);let i=[];return n==="1"?a.forEach(l=>{let o=W.lineToLargeHump(l);i.push(o,M.firstLower(o))}):n==="2"?a.forEach(l=>{let o=W.lineToLargeHump(l);i.push(l,o,M.firstLower(o))}):i=[...a],i=[...new Set(i)],i}function z(t,e,n,r){const a=[];return n.examplessRaw.forEach(s=>{for(let i=0;i<e.length;i++){const l=e[i];if(s==t+l+n.md+".md"){a.push({cwd:n.cwd||r.cwd,topurl:t,comkey:r.key,suffix:h.getSuffix(s),name:r.name,value:l,key:s,raw:"",getRaw:c.getRawValue(g,s)});break}}}),a}function V(t){O();const e=w[t];if(e.tests&&Object.keys(e.tests).length>0)return e.tests;{const n=U[e.dir],r=n.dir+$(n.level||0,e),a=y(n.aliaslevel||0,e,n.componentName||0);e.mds=z(r,a,n,e);const s={};return n.exampless.forEach(i=>{for(let l=0;l<a.length;l++){const o=a[l];if(i.startsWith(r+o+"/")){const u=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),f=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let p=i.match(u)||i.match(f);if(p&&p.length>0){let m="";p&&p.length>1&&(m=p[1]),s[i]={topurl:r,name:o,value:m,suffix:h.getSuffix(i),comname:e.name,comkey:e.key,cwd:n.cwd||e.cwd,key:i,dir:e.dir,url:i,component:b[i],raw:"",getRaw:c.getRawValue(g,i)};break}}}}),n.tests&&k(s,e,n),e.tests=s,s}}function k(t,e,n){const r=e.url.substring(0,e.url.lastIndexOf("/"+e.value+"/"))+"/"+e.value,a=n.testsNanme||"/tests/";typeof a=="string"?n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({cwd:e.cwd,topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:c.getRawValue(g,s)});else if(s.startsWith(r+a)){const i=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),l=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let o=s.match(i)||s.match(l);if(o&&o.length>0){let u="";o&&o.length>1&&(u=o[1]),t[s]={topurl:r,name:e.value,value:u,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,cwd:n.cwd||e.cwd,key:s,dir:e.dir,url:s,component:b[s],raw:"",getRaw:c.getRawValue(g,s)}}}}}):n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({cwd:e.cwd,topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:c.getRawValue(g,s)});else if(a.test(s)){const i=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),l=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let o=s.match(i)||s.match(l);if(o&&o.length>0){let u="";o&&o.length>1&&(u=o[1]),t[s]={cwd:n.cwd||e.cwd,topurl:r,name:e.value,value:u,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,key:s,dir:e.dir,url:s,component:b[s],raw:"",getRaw:c.getRawValue(g,s)}}}}})}function ee(t){if(t){const e=V(t);return Object.values(e)}else return[]}function te(t,e,n){O();const r=V(n),a=[];if(e){let s=r[e];if(s)return a.push(s),a}return Object.values(r).forEach(s=>{s.name+"/"+s.value==t&&a.push(s)}),a}function se(t){return V(t),w[t].mds}async function A(t,e,n){let r=t.key,a=t.dir,s=t.url,i=t.comprops,l=t.curprops,o=await Z(e,n||t.suffix)||[],u=s.split("/");return o.map(f=>{if(f.startsWith("./")){let p=u.slice(0,u.length-1).join("/"),m=f.substring(2);const d=p.replace(/^\.\/|((\.\.\/)+)/,"/");let x=r.indexOf(d)+d.length;return{key:r.substring(0,x)+"/"+m,name:f,cwd:t.cwd,comprops:i||"",curprops:l||"",value:m,suffix:h.getSuffix(f),head:p,dir:a,url:p+"/"+m}}else if(f.startsWith("../")){let p=f.split("/"),m=0;for(let N=0;N<p.length;N++)if(p[N]!=".."){m=N;break}let d=p.slice(m,p.length),x=u.slice(0,u.length-m-1).join("/"),E=d.join("/");const S=x.replace(/^\.\/|((\.\.\/)+)/,"/");let G=r.indexOf(S)+S.length;return{key:r.substring(0,G)+"/"+E,name:E,cwd:t.cwd,comprops:i||"",curprops:l||"",value:E,suffix:h.getSuffix(f),head:x,dir:a,url:x+"/"+E}}else{const p=a.replace(/^\.\/|((\.\.\/)+)/,"/");let m=f.indexOf(p)+p.length,d=f.substring(m),x=a.substring(0,a.length-1);return{key:f,name:d,comprops:i||"",curprops:l||"",value:d,suffix:h.getSuffix(f),head:x,dir:a,cwd:t.cwd,url:x+"/"+d}}})}function ne(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>({...r,raw:"",suffix:h.getSuffix(r.key),getRaw:c.getRawValue(g,r.key)}));I.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(l=>{const o=L(l);s.raw=o,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}function re(){const t=Q();P.getConfig("components")?.forEach(n=>{const r=le(n);let a=n.dir||"";X(a,t,n.example,r)})}const C="default";function ae(t){let e=T.humpToLine(t.name),n=[...t.aliasNames];n.push(e),n.forEach(r=>{K.push({name:r,value:t.key})})}function ie(t,e){const n={};e?.forEach(r=>{w[r.key]=r,ae(r);const a=Object.values(r.aliass||{});a&&a.length?a.forEach(s=>{n[s]=n[s]||[],n[s].push(r.key)}):(n[C]=n[C]||[],n[C].push(r.key))})}function le(t){let e,n;const r=t.resolver;r&&Object.keys(r).forEach(s=>{typeof t[s]>"u"&&(t[s]=r[s])}),e=t.alias||C;let a=t?.urls||Object.keys(t.componentsRaw);return n=c.getComponentsArr(a,t,t.componentsRaw,t.components,t),n&&n?.props&&n.props.forEach(s=>{R[s.url]=s}),ie(e,n.components),t.componentsRaw}function oe(t){return O(),w[t]}function O(){return Object.keys(w).length==0&&re(),Object.values(w)}function ue(){return O(),R}function fe(t,e,n){O();const r=[];if(n){let s=w[n];if(s&&s.key)return[s]}let a=T.humpToLine(t);return K.forEach(s=>{e?s.name.includes(a)&&r.push(w[s.value]):s.name==a&&r.push(w[s.value])}),D.duplicateRemoval(r,"key")}async function ce(t,e){let n=t;if(t){let r=(await A(e,t)).filter(a=>c.isComprops(a.key,e.comprops||"")||c.isCurprops(a.key,e.curprops||""));n=await H(r)+n}return n}function pe(t){const e=t.url,n=t.key;return R[e]||R[e+".js"]||R[e+".ts"]||R[n]||R[n+".js"]||R[n+".ts"]}function v(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>pe(r)).filter(r=>!!r);I.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(async l=>{const o=L(l);let u=await ce(o,t[i]);s.raw=u,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}async function H(t){return((await v(t))?.map(r=>r.raw)||[]).join(`
2
+ `)}async function me(t,e){let n=t;if(t&&(e.comprops||e.curprops)){let r=(await A(e,t)).filter(s=>c.isComprops(s.key,e.comprops||"")||c.isCurprops(s.key,e.curprops||""));n=await H(r)+n}return n}function L(t){return t&&typeof t=="object"?t.default||"":(t||"")+""}function ge(t){return new Promise(e=>{if(t){O();const n=w[t];n?n.raw?e(n.raw):n.getRaw?n.getRaw(n).then(r=>{const a=L(r);me(a,n).then(s=>{n.raw=s,n.getRaw=null,e(s)})}):e(""):e("")}else e("")})}exports.defaultName=C;exports.getCompoName=fe;exports.getCompoNameKey=oe;exports.getCompoNameObj=O;exports.getComponentPropsObjs=ue;exports.getGetRawValue=L;exports.getKeyMds=se;exports.getLevelUrl=$;exports.getLocalTextArr=ne;exports.getLocalTextComponents=ge;exports.getLocalTextTests=_;exports.getPropsRaws=v;exports.getTestImportUrl=A;exports.getTestName=ee;exports.getTestNameObj=te;