@fangzhongya/vue-archive 0.0.29 → 0.0.31

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.
@@ -3161,7 +3161,7 @@ function getType(str) {
3161
3161
  return arr.map((o) => conversionType(o));
3162
3162
  }
3163
3163
  function setDataType(arr) {
3164
- return arr.join("|");
3164
+ return arr.join("|") || "any";
3165
3165
  }
3166
3166
  function getParametersObj(cs) {
3167
3167
  let arrs = cs.split(",");
@@ -3182,7 +3182,7 @@ function getParametersObj(cs) {
3182
3182
  must,
3183
3183
  type: tarr[0],
3184
3184
  dataType: tarr,
3185
- description: t.substring(t.lastIndexOf("]") + 1)
3185
+ description: t.substring(t.lastIndexOf("]") + 1).trim()
3186
3186
  };
3187
3187
  });
3188
3188
  }
@@ -3239,9 +3239,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3239
3239
  sarr.push("function " + strs + "(" + cs + ") {");
3240
3240
  css.forEach((o) => {
3241
3241
  const name2 = o.prop || "arr";
3242
- sarr.push(
3243
- " console.log('" + o.description + name2 + "', " + name2 + ")"
3244
- );
3242
+ sarr.push(" console.log('" + o.label + "', " + name2 + ")");
3245
3243
  });
3246
3244
  sarr.push("}");
3247
3245
  } else {
@@ -3146,7 +3146,7 @@ function getType(str) {
3146
3146
  return arr.map((o) => conversionType(o));
3147
3147
  }
3148
3148
  function setDataType(arr) {
3149
- return arr.join("|");
3149
+ return arr.join("|") || "any";
3150
3150
  }
3151
3151
  function getParametersObj(cs) {
3152
3152
  let arrs = cs.split(",");
@@ -3167,7 +3167,7 @@ function getParametersObj(cs) {
3167
3167
  must,
3168
3168
  type: tarr[0],
3169
3169
  dataType: tarr,
3170
- description: t.substring(t.lastIndexOf("]") + 1)
3170
+ description: t.substring(t.lastIndexOf("]") + 1).trim()
3171
3171
  };
3172
3172
  });
3173
3173
  }
@@ -3224,9 +3224,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3224
3224
  sarr.push("function " + strs + "(" + cs + ") {");
3225
3225
  css.forEach((o) => {
3226
3226
  const name2 = o.prop || "arr";
3227
- sarr.push(
3228
- " console.log('" + o.description + name2 + "', " + name2 + ")"
3229
- );
3227
+ sarr.push(" console.log('" + o.label + "', " + name2 + ")");
3230
3228
  });
3231
3229
  sarr.push("}");
3232
3230
  } else {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const B=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const C=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const V=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs"),S=require("../../utils/props.cjs"),H=require("@fangzhongya/utils/basic/string/toFunction"),J=["class"];function j(s,t){return s.filter(e=>e.name==t)[0]}function N(s){return s.map(t=>(t.prop||"...arr")+":"+g.setDataType(t.dataType)).join(",")}function A(s,t,e,o,h,$){const f=[],n=[];let b=!0;const L=S.getPropsValue(t.propss||[]),P=S.getEmitsValue(t.emitss||[]),x=S.getExposeValue(t.exposes||[]),z=S.getSlotValue(t.slots||[]);Object.keys(e).forEach(r=>{let p=e[r];if(/^on[A-Z]/.test(r)&&typeof p=="function"){let i=r.substring(2);const c=r.split(":");let a;if(c.length>1?(a=c[0]+c.slice(1).map(l=>V.firstUpper(l)).join(""),i=C.firstLower(i)):(a=c[0],i=B.humpToLine(i)),c.includes("-")){let l=a.split("-");l=l.map((m,T)=>T!=0?V.firstUpper(m):m),a=l.join("")}f.push(" @"+i+'="'+a+'"');const u=j(P,i)||{},y=u.selectable||"",q=g.getParametersObj(y),d=N(q);n.push(`// ${u.description} ${u.name}: (${u.selectable})`),n.push("function "+a+"("+d+") {"),q.forEach(l=>{const m=l.prop||"arr";n.push(" console.log('"+l.description+m+"', "+m+")")}),n.push("}")}else{let i=r;J.includes(r)&&(i=r+"1"),f.push(" :"+r+'="'+i+'"');const c=j(L,r)||{},a=D(c);if(n.push(`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`),typeof p=="function")n.push("const "+r+" = "+F(p,r,h));else if(b&&(b=!1,n.unshift("import { ref } from 'vue';")),typeof p>"u"){const u=g.getTypeValue(a.dataType);u=="()=>{}"?n.push("const "+i+" = "+u+";"):n.push("const "+i+" = ref("+(u==="undefined"?"":u)+");")}else{let u=E(p,r,h);n.push("const "+i+" = ref("+u+");")}}});const O=Object.values($||{});O.length>0&&(b&&(b=!1,n.unshift("import { ref } from 'vue';")),f.unshift(' ref="refDom"'),n.push("const refDom = ref()"),O.forEach(r=>{const p=j(x,r.name)||{};n.push(`// ${p.description} ${p.name}:(${p.selectable}) ${p.type}`);const i=r.name+"Value",c=g.getParametersObj(p?.selectable||""),a=[],u=r.params||[];c.forEach((y,q)=>{const d=y.prop;if(d){const l=d+r.name,m=u[q];if(n.push(`// ${y.label}`),typeof m=="function")n.push("const "+l+" = "+F(m,d,r.text));else if(typeof m>"u")n.push("const "+l+" = "+g.getTypeValue(y.dataType)+";");else{let T=E(m,d,r.text);n.push("const "+l+" = "+T+";")}a.push(l)}}),r.type==="function"?n.push(`const ${i} = refDom.value?.${r.name}(${a.join(", ")})`):n.push(`const ${i} = refDom.value?.${r.name}`),n.push(`console.log('"${p.type}"', ${i})`)})),f.length>0&&f.unshift("");const U=M(o,z);return`<!--${s}-->
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const B=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const C=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const V=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs"),S=require("../../utils/props.cjs"),H=require("@fangzhongya/utils/basic/string/toFunction"),J=["class"];function j(s,t){return s.filter(e=>e.name==t)[0]}function N(s){return s.map(t=>(t.prop||"...arr")+":"+g.setDataType(t.dataType)).join(",")}function A(s,t,e,o,m,$){const f=[],n=[];let b=!0;const L=S.getPropsValue(t.propss||[]),P=S.getEmitsValue(t.emitss||[]),x=S.getExposeValue(t.exposes||[]),z=S.getSlotValue(t.slots||[]);Object.keys(e).forEach(r=>{let p=e[r];if(/^on[A-Z]/.test(r)&&typeof p=="function"){let i=r.substring(2);const c=r.split(":");let a;if(c.length>1?(a=c[0]+c.slice(1).map(l=>V.firstUpper(l)).join(""),i=C.firstLower(i)):(a=c[0],i=B.humpToLine(i)),c.includes("-")){let l=a.split("-");l=l.map((h,T)=>T!=0?V.firstUpper(h):h),a=l.join("")}f.push(" @"+i+'="'+a+'"');const u=j(P,i)||{},y=u.selectable||"",q=g.getParametersObj(y),d=N(q);n.push(`// ${u.description} ${u.name}: (${u.selectable})`),n.push("function "+a+"("+d+") {"),q.forEach(l=>{const h=l.prop||"arr";n.push(" console.log('"+l.label+"', "+h+")")}),n.push("}")}else{let i=r;J.includes(r)&&(i=r+"1"),f.push(" :"+r+'="'+i+'"');const c=j(L,r)||{},a=D(c);if(n.push(`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`),typeof p=="function")n.push("const "+r+" = "+F(p,r,m));else if(b&&(b=!1,n.unshift("import { ref } from 'vue';")),typeof p>"u"){const u=g.getTypeValue(a.dataType);u=="()=>{}"?n.push("const "+i+" = "+u+";"):n.push("const "+i+" = ref("+(u==="undefined"?"":u)+");")}else{let u=E(p,r,m);n.push("const "+i+" = ref("+u+");")}}});const O=Object.values($||{});O.length>0&&(b&&(b=!1,n.unshift("import { ref } from 'vue';")),f.unshift(' ref="refDom"'),n.push("const refDom = ref()"),O.forEach(r=>{const p=j(x,r.name)||{};n.push(`// ${p.description} ${p.name}:(${p.selectable}) ${p.type}`);const i=r.name+"Value",c=g.getParametersObj(p?.selectable||""),a=[],u=r.params||[];c.forEach((y,q)=>{const d=y.prop;if(d){const l=d+r.name,h=u[q];if(n.push(`// ${y.label}`),typeof h=="function")n.push("const "+l+" = "+F(h,d,r.text));else if(typeof h>"u")n.push("const "+l+" = "+g.getTypeValue(y.dataType)+";");else{let T=E(h,d,r.text);n.push("const "+l+" = "+T+";")}a.push(l)}}),r.type==="function"?n.push(`const ${i} = refDom.value?.${r.name}(${a.join(", ")})`):n.push(`const ${i} = refDom.value?.${r.name}`),n.push(`console.log('"${p.type}"', ${i})`)})),f.length>0&&f.unshift("");const U=M(o,z);return`<!--${s}-->
2
2
  <template>
3
3
  <div>
4
4
  <${s}${f.join(`
@@ -11,9 +11,9 @@
11
11
  ${n.join(`
12
12
  `)}
13
13
  <\/script>
14
- `}function M(s={},t){const e=[];return Object.keys(s).forEach(o=>{const h=j(t,o)||{},$=s[o];if($){const f=` <!-- ${h.description} ${h.name}:(${h.selectable}) -->
14
+ `}function M(s={},t){const e=[];return Object.keys(s).forEach(o=>{const m=j(t,o)||{},$=s[o];if($){const f=` <!-- ${m.description} ${m.name}:(${m.selectable}) -->
15
15
  <template #${o}="scope">
16
16
  ${g.vueFormat($," ")}
17
17
  </template>`;e.push(f)}}),e&&e.length>0&&e.unshift(""),e}function F(s,t,e){const o=e?e[t]:"";return o||w(s.toString())}function w(s){const t=H.getFunctionFormat(g.prettierFormat(s));if(t){let e=`{
18
18
  ${g.vueFormat(g.getFunBody(t.body)," ")}
19
- }`;return`function (${t.param}) ${e}`}else return"undefined"}function Z(s){const t=s.trim();return/^\(/.test(t)?w(t):JSON.stringify(s)}function E(s,t,e){const o=e?e[t]:"";return o||(typeof s=="string"?Z(s+""):JSON.stringify(s))}function D(s){let t=G(s?.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const o=e;let h=(s?.selectable||"").trim(),$=[];return h&&e!="boolean"&&(h.split(",").forEach(f=>{if(f){let n=f.split(":");$.push({label:f,prop:n[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:$,zdtype:o,type:e,dataType:t}}function G(s){let t=[];return(s||"").trim().toLowerCase().split(",").forEach(o=>{o=o.trim(),o&&t.push(o)}),[...new Set(t)].sort()}exports.getHmtl=A;exports.getSpecType=D;exports.setValStringify=E;
19
+ }`;return`function (${t.param}) ${e}`}else return"undefined"}function Z(s){const t=s.trim();return/^\(/.test(t)?w(t):JSON.stringify(s)}function E(s,t,e){const o=e?e[t]:"";return o||(typeof s=="string"?Z(s+""):JSON.stringify(s))}function D(s){let t=G(s?.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const o=e;let m=(s?.selectable||"").trim(),$=[];return m&&e!="boolean"&&(m.split(",").forEach(f=>{if(f){let n=f.split(":");$.push({label:f,prop:n[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:$,zdtype:o,type:e,dataType:t}}function G(s){let t=[];return(s||"").trim().toLowerCase().split(",").forEach(o=>{o=o.trim(),o&&t.push(o)}),[...new Set(t)].sort()}exports.getHmtl=A;exports.getSpecType=D;exports.setValStringify=E;
@@ -19,8 +19,8 @@ function j(s, e) {
19
19
  function Q(s) {
20
20
  return s.map((e) => (e.prop || "...arr") + ":" + A(e.dataType)).join(",");
21
21
  }
22
- function at(s, e, t, r, h, $) {
23
- const l = [], n = [];
22
+ function at(s, e, t, r, m, $) {
23
+ const f = [], n = [];
24
24
  let y = !0;
25
25
  const z = Z(e.propss || []), L = q(e.emitss || []), P = G(e.exposes || []), B = I(e.slots || []);
26
26
  Object.keys(t).forEach((o) => {
@@ -29,73 +29,71 @@ function at(s, e, t, r, h, $) {
29
29
  let i = o.substring(2);
30
30
  const c = o.split(":");
31
31
  let a;
32
- if (c.length > 1 ? (a = c[0] + c.slice(1).map((f) => O(f)).join(""), i = N(i)) : (a = c[0], i = J(i)), c.includes("-")) {
33
- let f = a.split("-");
34
- f = f.map((m, S) => S != 0 ? O(m) : m), a = f.join("");
32
+ if (c.length > 1 ? (a = c[0] + c.slice(1).map((p) => O(p)).join(""), i = N(i)) : (a = c[0], i = J(i)), c.includes("-")) {
33
+ let p = a.split("-");
34
+ p = p.map((h, S) => S != 0 ? O(h) : h), a = p.join("");
35
35
  }
36
- l.push(" @" + i + '="' + a + '"');
37
- const p = j(L, i) || {}, d = p.selectable || "", b = V(d), g = Q(b);
38
- n.push(`// ${p.description} ${p.name}: (${p.selectable})`), n.push("function " + a + "(" + g + ") {"), b.forEach((f) => {
39
- const m = f.prop || "arr";
40
- n.push(
41
- " console.log('" + f.description + m + "', " + m + ")"
42
- );
36
+ f.push(" @" + i + '="' + a + '"');
37
+ const l = j(L, i) || {}, d = l.selectable || "", b = V(d), g = Q(b);
38
+ n.push(`// ${l.description} ${l.name}: (${l.selectable})`), n.push("function " + a + "(" + g + ") {"), b.forEach((p) => {
39
+ const h = p.prop || "arr";
40
+ n.push(" console.log('" + p.label + "', " + h + ")");
43
41
  }), n.push("}");
44
42
  } else {
45
43
  let i = o;
46
- M.includes(o) && (i = o + "1"), l.push(" :" + o + '="' + i + '"');
44
+ M.includes(o) && (i = o + "1"), f.push(" :" + o + '="' + i + '"');
47
45
  const c = j(z, o) || {}, a = X(c);
48
46
  if (n.push(
49
47
  `// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`
50
48
  ), typeof u == "function")
51
49
  n.push(
52
- "const " + o + " = " + T(u, o, h)
50
+ "const " + o + " = " + T(u, o, m)
53
51
  );
54
52
  else if (y && (y = !1, n.unshift("import { ref } from 'vue';")), typeof u > "u") {
55
- const p = F(a.dataType);
56
- p == "()=>{}" ? n.push("const " + i + " = " + p + ";") : n.push(
57
- "const " + i + " = ref(" + (p === "undefined" ? "" : p) + ");"
53
+ const l = F(a.dataType);
54
+ l == "()=>{}" ? n.push("const " + i + " = " + l + ";") : n.push(
55
+ "const " + i + " = ref(" + (l === "undefined" ? "" : l) + ");"
58
56
  );
59
57
  } else {
60
- let p = D(u, o, h);
61
- n.push("const " + i + " = ref(" + p + ");");
58
+ let l = D(u, o, m);
59
+ n.push("const " + i + " = ref(" + l + ");");
62
60
  }
63
61
  }
64
62
  });
65
63
  const E = Object.values($ || {});
66
- E.length > 0 && (y && (y = !1, n.unshift("import { ref } from 'vue';")), l.unshift(' ref="refDom"'), n.push("const refDom = ref()"), E.forEach((o) => {
64
+ E.length > 0 && (y && (y = !1, n.unshift("import { ref } from 'vue';")), f.unshift(' ref="refDom"'), n.push("const refDom = ref()"), E.forEach((o) => {
67
65
  const u = j(P, o.name) || {};
68
66
  n.push(
69
67
  `// ${u.description} ${u.name}:(${u.selectable}) ${u.type}`
70
68
  );
71
- const i = o.name + "Value", c = V(u?.selectable || ""), a = [], p = o.params || [];
69
+ const i = o.name + "Value", c = V(u?.selectable || ""), a = [], l = o.params || [];
72
70
  c.forEach((d, b) => {
73
71
  const g = d.prop;
74
72
  if (g) {
75
- const f = g + o.name, m = p[b];
76
- if (n.push(`// ${d.label}`), typeof m == "function")
73
+ const p = g + o.name, h = l[b];
74
+ if (n.push(`// ${d.label}`), typeof h == "function")
77
75
  n.push(
78
- "const " + f + " = " + T(m, g, o.text)
76
+ "const " + p + " = " + T(h, g, o.text)
79
77
  );
80
- else if (typeof m > "u")
78
+ else if (typeof h > "u")
81
79
  n.push(
82
- "const " + f + " = " + F(d.dataType) + ";"
80
+ "const " + p + " = " + F(d.dataType) + ";"
83
81
  );
84
82
  else {
85
- let S = D(m, g, o.text);
86
- n.push("const " + f + " = " + S + ";");
83
+ let S = D(h, g, o.text);
84
+ n.push("const " + p + " = " + S + ";");
87
85
  }
88
- a.push(f);
86
+ a.push(p);
89
87
  }
90
88
  }), o.type === "function" ? n.push(
91
89
  `const ${i} = refDom.value?.${o.name}(${a.join(", ")})`
92
90
  ) : n.push(`const ${i} = refDom.value?.${o.name}`), n.push(`console.log('"${u.type}"', ${i})`);
93
- })), l.length > 0 && l.unshift("");
91
+ })), f.length > 0 && f.unshift("");
94
92
  const C = R(r, B);
95
93
  return `<!--${s}-->
96
94
  <template>
97
95
  <div>
98
- <${s}${l.join(`
96
+ <${s}${f.join(`
99
97
  `)}>${C.join(`
100
98
  `)}
101
99
  </${s}>
@@ -110,13 +108,13 @@ ${n.join(`
110
108
  function R(s = {}, e) {
111
109
  const t = [];
112
110
  return Object.keys(s).forEach((r) => {
113
- const h = j(e, r) || {}, $ = s[r];
111
+ const m = j(e, r) || {}, $ = s[r];
114
112
  if ($) {
115
- const l = ` <!-- ${h.description} ${h.name}:(${h.selectable}) -->
113
+ const f = ` <!-- ${m.description} ${m.name}:(${m.selectable}) -->
116
114
  <template #${r}="scope">
117
115
  ${w($, " ")}
118
116
  </template>`;
119
- t.push(l);
117
+ t.push(f);
120
118
  }
121
119
  }), t && t.length > 0 && t.unshift(""), t;
122
120
  }
@@ -146,12 +144,12 @@ function X(s) {
146
144
  let e = Y(s?.type), t = "any";
147
145
  e.length == 1 && (t = e[0].split("<")[0]);
148
146
  const r = t;
149
- let h = (s?.selectable || "").trim(), $ = [];
150
- return h && t != "boolean" && (h.split(",").forEach((l) => {
151
- if (l) {
152
- let n = l.split(":");
147
+ let m = (s?.selectable || "").trim(), $ = [];
148
+ return m && t != "boolean" && (m.split(",").forEach((f) => {
149
+ if (f) {
150
+ let n = f.split(":");
153
151
  $.push({
154
- label: l,
152
+ label: f,
155
153
  prop: n[0].trim()
156
154
  });
157
155
  }
@@ -1,3 +1,3 @@
1
1
  "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@fangzhongya/utils/basic/string/toFunction"),m=require("@fangzhongya/utils/basic/string/firstLower");function l(e){return e.replace(/\;(\s|\n\r)*$/,"")}function d(e){return e="let a = "+e,l(e).replace(/^let a = /,"")}function j(e){return l(e)}function T(e,t=""){let r=(e+"").trim().split(/\n/);return r=r.map(n=>t+n),r.join(`
2
2
  `)}function f(e=""){e=e.trim();let t=`[\\s|\\n|\\r]*\\{((.|
3
- |\r)+?)\\}[\\s|\\n|\\r]*`,n=new RegExp("^"+t+"$").exec(e);return n&&n.length>0?f(n[1]):e}const F=["Boolean","Any","String","Number","Array","Object","Function"];function c(e){return F.includes(e)?m.firstLower(e):e}function $(e){let r=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(r&&r.length>0)return{own:c(r[1]),son:r[2]}}function p(e,t){let r=$(e);r?(t.push(r.own),r.son&&p(r.son,t)):t.push(e)}function s(e){e instanceof Array&&(e=e[0]);const t=[];return e&&p(e,t),t}function g(e){const t=Object.prototype.toString.call(e);let n=/^\[[O|o]bject (.*)\]$/.exec(t),i=typeof e;return n&&n.length>0&&(i=n[1].toLowerCase()),i}function O(e,t){const r=g(e),n=s(t)[0];return n&&n!="any"?r==n:!0}function h(e){if(typeof e=="string"){let t=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(t=!0),t&&(e=e.substring(1,e.length-1)),e+""}else return typeof e=="object"&&e?e.toString():typeof e>"u"||typeof e=="object"&&!e?"":e+""}function v(e){e=(e+"").replace(/^(\s|\n|r)*/,"").replace(/(\s|\n|r)*$/,"");let t="";return/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e)?t="string":/^\[(.|\n|\r)*\]$/.test(e)?t="array":/^\{(.|\n|\r)*\}$/.test(e)?t="object":/^[0-9]*$/.test(e)?t="number":e==="true"||e==="false"?t="boolean":e=="undefined"?t="undefined":e=="null"?t="null":e&&(t="string"),t}function y(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let r=y(e.splice(1));return r=r=="undefined"?"":r,`[${r}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function w(e){let t=[];if(e)if(e=(e+"").trim(),e.startsWith("["))e=e.substring(1,e.lastIndexOf("]")),t=e.split(",");else{let n=/^\<([a-z|\<|\>|\|]+)\>/.exec(e);n&&n.length>0?t=n[1].split("|"):t=["any"]}else t=["any"];return t.map(r=>c(r))}function S(e){return e.join("|")}function x(e){return e.split(",").map(r=>{r=r.trim();let n=!0,i=r.split(":"),u=i[0].trim();u.endsWith("?")&&(n=!1,u=u.substring(0,u.length-1));let o=i[1]||"",a=s(w(o));return{label:r,prop:u,must:n,type:a[0],dataType:a,description:o.substring(o.lastIndexOf("]")+1)}})}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>b.getFunctionFormat});exports.getFunBody=f;exports.getObjType=g;exports.getParametersObj=x;exports.getSonType=s;exports.getString=h;exports.getTypeValue=y;exports.isDefaultType=v;exports.isTypeEqual=O;exports.prettierArrFormat=j;exports.prettierFormat=l;exports.prettierObjFormat=d;exports.setDataType=S;exports.vueFormat=T;
3
+ |\r)+?)\\}[\\s|\\n|\\r]*`,n=new RegExp("^"+t+"$").exec(e);return n&&n.length>0?f(n[1]):e}const F=["Boolean","Any","String","Number","Array","Object","Function"];function c(e){return F.includes(e)?m.firstLower(e):e}function $(e){let r=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(r&&r.length>0)return{own:c(r[1]),son:r[2]}}function p(e,t){let r=$(e);r?(t.push(r.own),r.son&&p(r.son,t)):t.push(e)}function s(e){e instanceof Array&&(e=e[0]);const t=[];return e&&p(e,t),t}function g(e){const t=Object.prototype.toString.call(e);let n=/^\[[O|o]bject (.*)\]$/.exec(t),i=typeof e;return n&&n.length>0&&(i=n[1].toLowerCase()),i}function O(e,t){const r=g(e),n=s(t)[0];return n&&n!="any"?r==n:!0}function h(e){if(typeof e=="string"){let t=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(t=!0),t&&(e=e.substring(1,e.length-1)),e+""}else return typeof e=="object"&&e?e.toString():typeof e>"u"||typeof e=="object"&&!e?"":e+""}function v(e){e=(e+"").replace(/^(\s|\n|r)*/,"").replace(/(\s|\n|r)*$/,"");let t="";return/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e)?t="string":/^\[(.|\n|\r)*\]$/.test(e)?t="array":/^\{(.|\n|\r)*\}$/.test(e)?t="object":/^[0-9]*$/.test(e)?t="number":e==="true"||e==="false"?t="boolean":e=="undefined"?t="undefined":e=="null"?t="null":e&&(t="string"),t}function y(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let r=y(e.splice(1));return r=r=="undefined"?"":r,`[${r}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function w(e){let t=[];if(e)if(e=(e+"").trim(),e.startsWith("["))e=e.substring(1,e.lastIndexOf("]")),t=e.split(",");else{let n=/^\<([a-z|\<|\>|\|]+)\>/.exec(e);n&&n.length>0?t=n[1].split("|"):t=["any"]}else t=["any"];return t.map(r=>c(r))}function S(e){return e.join("|")||"any"}function x(e){return e.split(",").map(r=>{r=r.trim();let n=!0,i=r.split(":"),u=i[0].trim();u.endsWith("?")&&(n=!1,u=u.substring(0,u.length-1));let o=i[1]||"",a=s(w(o));return{label:r,prop:u,must:n,type:a[0],dataType:a,description:o.substring(o.lastIndexOf("]")+1).trim()}})}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>b.getFunctionFormat});exports.getFunBody=f;exports.getObjType=g;exports.getParametersObj=x;exports.getSonType=s;exports.getString=h;exports.getTypeValue=y;exports.isDefaultType=v;exports.isTypeEqual=O;exports.prettierArrFormat=j;exports.prettierFormat=l;exports.prettierObjFormat=d;exports.setDataType=S;exports.vueFormat=T;
@@ -104,7 +104,7 @@ function $(e) {
104
104
  return t.map((n) => f(n));
105
105
  }
106
106
  function O(e) {
107
- return e.join("|");
107
+ return e.join("|") || "any";
108
108
  }
109
109
  function A(e) {
110
110
  return e.split(",").map((n) => {
@@ -118,7 +118,7 @@ function A(e) {
118
118
  must: r,
119
119
  type: o[0],
120
120
  dataType: o,
121
- description: u.substring(u.lastIndexOf("]") + 1)
121
+ description: u.substring(u.lastIndexOf("]") + 1).trim()
122
122
  };
123
123
  });
124
124
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.29",
4
+ "version": "0.0.31",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",