@fangzhongya/vue-archive 0.0.3-5 → 0.0.3-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66513,29 +66513,32 @@ function getFunctionBody(v, key, propsText) {
66513
66513
  if (text) {
66514
66514
  return "function" + text;
66515
66515
  } else {
66516
- const st = getFunctionFormat(
66517
- prettierFormat(v.toString())
66518
- );
66519
- if (st) {
66520
- let body = `{
66516
+ return funstr(v.toString());
66517
+ }
66518
+ }
66519
+ function funstr(v) {
66520
+ const st = getFunctionFormat(prettierFormat(v));
66521
+ if (st) {
66522
+ let body = `{
66521
66523
  ${vueFormat(getFunBody(st.body), " ")}
66522
66524
  }`;
66523
- return `function${st.param}${body}`;
66524
- } else {
66525
- return "undefined";
66526
- }
66525
+ return `function${st.param}${body}`;
66526
+ } else {
66527
+ return "undefined";
66527
66528
  }
66528
66529
  }
66529
66530
  function getChange(str) {
66530
66531
  const tr = str.trim();
66531
66532
  if (/^\(/.test(tr)) {
66532
- return new Function("", str);
66533
+ return funstr(tr);
66533
66534
  } else {
66534
- return new Function(
66535
- "",
66536
- `{
66535
+ return JSON.stringify(
66536
+ new Function(
66537
+ "",
66538
+ `{
66537
66539
  return ${str}
66538
66540
  }`
66541
+ )
66539
66542
  );
66540
66543
  }
66541
66544
  }
@@ -66545,7 +66548,7 @@ function setValStringify(v, key, propsText) {
66545
66548
  return text;
66546
66549
  } else {
66547
66550
  if (typeof v == "string") {
66548
- return JSON.stringify(getChange(v + ""));
66551
+ return getChange(v + "");
66549
66552
  } else {
66550
66553
  return JSON.stringify(v);
66551
66554
  }
@@ -66513,29 +66513,32 @@ function getFunctionBody(v, key, propsText) {
66513
66513
  if (text) {
66514
66514
  return "function" + text;
66515
66515
  } else {
66516
- const st = getFunctionFormat(
66517
- prettierFormat(v.toString())
66518
- );
66519
- if (st) {
66520
- let body = `{
66516
+ return funstr(v.toString());
66517
+ }
66518
+ }
66519
+ function funstr(v) {
66520
+ const st = getFunctionFormat(prettierFormat(v));
66521
+ if (st) {
66522
+ let body = `{
66521
66523
  ${vueFormat(getFunBody(st.body), " ")}
66522
66524
  }`;
66523
- return `function${st.param}${body}`;
66524
- } else {
66525
- return "undefined";
66526
- }
66525
+ return `function${st.param}${body}`;
66526
+ } else {
66527
+ return "undefined";
66527
66528
  }
66528
66529
  }
66529
66530
  function getChange(str) {
66530
66531
  const tr = str.trim();
66531
66532
  if (/^\(/.test(tr)) {
66532
- return new Function("", str);
66533
+ return funstr(tr);
66533
66534
  } else {
66534
- return new Function(
66535
- "",
66536
- `{
66535
+ return JSON.stringify(
66536
+ new Function(
66537
+ "",
66538
+ `{
66537
66539
  return ${str}
66538
66540
  }`
66541
+ )
66539
66542
  );
66540
66543
  }
66541
66544
  }
@@ -66545,7 +66548,7 @@ function setValStringify(v, key, propsText) {
66545
66548
  return text;
66546
66549
  } else {
66547
66550
  if (typeof v == "string") {
66548
- return JSON.stringify(getChange(v + ""));
66551
+ return getChange(v + "");
66549
66552
  } else {
66550
66553
  return JSON.stringify(v);
66551
66554
  }
@@ -1,20 +1,20 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.cjs"),d=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),b=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.cjs"),h=require("./util.cjs");function S(t,e,n,r){const i=[],s=[];let l=!0;Object.keys(e).forEach(o=>{let f=e[o];if(/^on[A-Z]/.test(o)&&typeof f=="function"){let u=o.substring(2);const p=o.split(":");let c;if(p.length>1?(c=p[0]+p.slice(1).map(a=>d.firstUpper(a)).join(""),u=b.firstLower(u)):(c=p[0],u=$.humpToLine(u)),p.includes("-")){let a=c.split("-");a=a.map((m,y)=>y!=0?d.firstUpper(m):m),c=a.join("")}i.push(" @"+u+'="'+c+'"'),s.push("function "+c+"(...arr) {"),s.push(" console.log('"+c+"', arr)"),s.push("}")}else if(i.push(" :"+o+'="'+o+'"'),typeof f=="function")s.push("const "+o+" = "+j(f,o,r));else if(l&&(l=!1,s.unshift("import { ref } from 'vue';")),typeof f>"u")s.push("const "+o+" = ref();");else{let u=J(f,o,r);s.push("const "+o+" = ref("+u+");")}}),i.length>0&&i.unshift("");const g=F(n);return`<!--${t}-->
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.cjs"),d=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),S=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.cjs"),h=require("./util.cjs");function F(n,t,e,r){const o=[],i=[];let f=!0;Object.keys(t).forEach(s=>{let l=t[s];if(/^on[A-Z]/.test(s)&&typeof l=="function"){let u=s.substring(2);const p=s.split(":");let c;if(p.length>1?(c=p[0]+p.slice(1).map(a=>d.firstUpper(a)).join(""),u=S.firstLower(u)):(c=p[0],u=b.humpToLine(u)),p.includes("-")){let a=c.split("-");a=a.map((m,$)=>$!=0?d.firstUpper(m):m),c=a.join("")}o.push(" @"+u+'="'+c+'"'),i.push("function "+c+"(...arr) {"),i.push(" console.log('"+c+"', arr)"),i.push("}")}else if(o.push(" :"+s+'="'+s+'"'),typeof l=="function")i.push("const "+s+" = "+O(l,s,r));else if(f&&(f=!1,i.unshift("import { ref } from 'vue';")),typeof l>"u")i.push("const "+s+" = ref();");else{let u=E(l,s,r);i.push("const "+s+" = ref("+u+");")}}),o.length>0&&o.unshift("");const g=j(e);return`<!--${n}-->
2
2
  <template>
3
3
  <div>
4
- <${t}${i.join(`
4
+ <${n}${o.join(`
5
5
  `)}>${g.join(`
6
6
  `)}
7
- </${t}>
7
+ </${n}>
8
8
  </div>
9
9
  </template>
10
10
  <script lang="ts" setup>
11
- ${s.join(`
11
+ ${i.join(`
12
12
  `)}
13
13
  <\/script>
14
- `}function F(t={}){const e=[];return Object.keys(t).forEach(n=>{const r=t[n];if(r){const i=` <template #${n}="scope">
14
+ `}function j(n={}){const t=[];return Object.keys(n).forEach(e=>{const r=n[e];if(r){const o=` <template #${e}="scope">
15
15
  ${h.vueFormat(r," ")}
16
- </template>`;e.push(i)}}),e&&e.length>0&&e.unshift(""),e}function j(t,e,n){const r=n?n[e]:"";if(r)return"function"+r;{const i=h.getFunctionFormat(h.prettierFormat(t.toString()));if(i){let s=`{
17
- ${h.vueFormat(h.getFunBody(i.body)," ")}
18
- }`;return`function${i.param}${s}`}else return"undefined"}}function O(t){const e=t.trim();return/^\(/.test(e)?new Function("",t):new Function("",`{
19
- return ${t}
20
- }`)}function J(t,e,n){const r=n?n[e]:"";return r||JSON.stringify(typeof t=="string"?O(t+""):t)}function w(t){let e=E(t.type),n="any";e.length==1&&(n=e[0].split("<")[0]);const r=n;let i=(t.selectable||"").trim(),s=[];return i&&n!="boolean"&&(i.split(",").forEach(l=>{if(l){let g=l.split(":");s.push({label:l,prop:g[0].trim()})}}),n=="function"?n="function":n=="array"?n="choice":n="select"),{arr:s,zdtype:r,type:n,dataType:e}}function E(t){let e=[];return(t||"").trim().toLowerCase().split(",").forEach(r=>{r=r.trim(),r&&e.push(r)}),[...new Set(e)].sort()}exports.getHmtl=S;exports.getSpecType=w;
16
+ </template>`;t.push(o)}}),t&&t.length>0&&t.unshift(""),t}function O(n,t,e){const r=e?e[t]:"";return r?"function"+r:y(n.toString())}function y(n){const t=h.getFunctionFormat(h.prettierFormat(n));if(t){let e=`{
17
+ ${h.vueFormat(h.getFunBody(t.body)," ")}
18
+ }`;return`function${t.param}${e}`}else return"undefined"}function J(n){const t=n.trim();return/^\(/.test(t)?y(t):JSON.stringify(new Function("",`{
19
+ return ${n}
20
+ }`))}function E(n,t,e){const r=e?e[t]:"";return r||(typeof n=="string"?J(n+""):JSON.stringify(n))}function T(n){let t=q(n.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const r=e;let o=(n.selectable||"").trim(),i=[];return o&&e!="boolean"&&(o.split(",").forEach(f=>{if(f){let g=f.split(":");i.push({label:f,prop:g[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:i,zdtype:r,type:e,dataType:t}}function q(n){let t=[];return(n||"").trim().toLowerCase().split(",").forEach(r=>{r=r.trim(),r&&t.push(r)}),[...new Set(t)].sort()}exports.getHmtl=F;exports.getSpecType=T;
@@ -1,135 +1,134 @@
1
- import { humpToLine as y } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js";
1
+ import { humpToLine as b } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js";
2
2
  import { firstUpper as g } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js";
3
- import { firstLower as b } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js";
4
- import { vueFormat as d, getFunctionFormat as F, prettierFormat as S, getFunBody as j } from "./util.js";
5
- function H(t, e, n, r) {
6
- const i = [], s = [];
7
- let u = !0;
8
- Object.keys(e).forEach((o) => {
9
- let c = e[o];
10
- if (/^on[A-Z]/.test(o) && typeof c == "function") {
11
- let f = o.substring(2);
12
- const p = o.split(":");
13
- let l;
14
- if (p.length > 1 ? (l = p[0] + p.slice(1).map((a) => g(a)).join(""), f = b(f)) : (l = p[0], f = y(f)), p.includes("-")) {
15
- let a = l.split("-");
16
- a = a.map((h, $) => $ != 0 ? g(h) : h), l = a.join("");
3
+ import { firstLower as F } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js";
4
+ import { vueFormat as d, getFunctionFormat as S, prettierFormat as j, getFunBody as w } from "./util.js";
5
+ function T(n, t, e, r) {
6
+ const o = [], i = [];
7
+ let l = !0;
8
+ Object.keys(t).forEach((s) => {
9
+ let c = t[s];
10
+ if (/^on[A-Z]/.test(s) && typeof c == "function") {
11
+ let f = s.substring(2);
12
+ const p = s.split(":");
13
+ let u;
14
+ if (p.length > 1 ? (u = p[0] + p.slice(1).map((a) => g(a)).join(""), f = F(f)) : (u = p[0], f = b(f)), p.includes("-")) {
15
+ let a = u.split("-");
16
+ a = a.map((h, y) => y != 0 ? g(h) : h), u = a.join("");
17
17
  }
18
- i.push(
19
- " @" + f + '="' + l + '"'
20
- ), s.push("function " + l + "(...arr) {"), s.push(
21
- " console.log('" + l + "', arr)"
22
- ), s.push("}");
23
- } else if (i.push(
24
- " :" + o + '="' + o + '"'
18
+ o.push(
19
+ " @" + f + '="' + u + '"'
20
+ ), i.push("function " + u + "(...arr) {"), i.push(
21
+ " console.log('" + u + "', arr)"
22
+ ), i.push("}");
23
+ } else if (o.push(
24
+ " :" + s + '="' + s + '"'
25
25
  ), typeof c == "function")
26
- s.push(
27
- "const " + o + " = " + E(
26
+ i.push(
27
+ "const " + s + " = " + O(
28
28
  c,
29
- o,
29
+ s,
30
30
  r
31
31
  )
32
32
  );
33
- else if (u && (u = !1, s.unshift(
33
+ else if (l && (l = !1, i.unshift(
34
34
  "import { ref } from 'vue';"
35
35
  )), typeof c > "u")
36
- s.push("const " + o + " = ref();");
36
+ i.push("const " + s + " = ref();");
37
37
  else {
38
- let f = L(
38
+ let f = z(
39
39
  c,
40
- o,
40
+ s,
41
41
  r
42
42
  );
43
- s.push(
44
- "const " + o + " = ref(" + f + ");"
43
+ i.push(
44
+ "const " + s + " = ref(" + f + ");"
45
45
  );
46
46
  }
47
- }), i.length > 0 && i.unshift("");
48
- const m = w(n);
49
- return `<!--${t}-->
47
+ }), o.length > 0 && o.unshift("");
48
+ const m = E(e);
49
+ return `<!--${n}-->
50
50
  <template>
51
51
  <div>
52
- <${t}${i.join(`
52
+ <${n}${o.join(`
53
53
  `)}>${m.join(`
54
54
  `)}
55
- </${t}>
55
+ </${n}>
56
56
  </div>
57
57
  </template>
58
58
  <script lang="ts" setup>
59
- ${s.join(`
59
+ ${i.join(`
60
60
  `)}
61
61
  <\/script>
62
62
  `;
63
63
  }
64
- function w(t = {}) {
65
- const e = [];
66
- return Object.keys(t).forEach((n) => {
67
- const r = t[n];
64
+ function E(n = {}) {
65
+ const t = [];
66
+ return Object.keys(n).forEach((e) => {
67
+ const r = n[e];
68
68
  if (r) {
69
- const i = ` <template #${n}="scope">
69
+ const o = ` <template #${e}="scope">
70
70
  ${d(r, " ")}
71
71
  </template>`;
72
- e.push(i);
72
+ t.push(o);
73
73
  }
74
- }), e && e.length > 0 && e.unshift(""), e;
74
+ }), t && t.length > 0 && t.unshift(""), t;
75
+ }
76
+ function O(n, t, e) {
77
+ const r = e ? e[t] : "";
78
+ return r ? "function" + r : $(n.toString());
75
79
  }
76
- function E(t, e, n) {
77
- const r = n ? n[e] : "";
78
- if (r)
79
- return "function" + r;
80
- {
81
- const i = F(
82
- S(t.toString())
83
- );
84
- if (i) {
85
- let s = `{
86
- ${d(j(i.body), " ")}
80
+ function $(n) {
81
+ const t = S(j(n));
82
+ if (t) {
83
+ let e = `{
84
+ ${d(w(t.body), " ")}
87
85
  }`;
88
- return `function${i.param}${s}`;
89
- } else
90
- return "undefined";
91
- }
86
+ return `function${t.param}${e}`;
87
+ } else
88
+ return "undefined";
92
89
  }
93
- function O(t) {
94
- const e = t.trim();
95
- return /^\(/.test(e) ? new Function("", t) : new Function(
96
- "",
97
- `{
98
- return ${t}
90
+ function L(n) {
91
+ const t = n.trim();
92
+ return /^\(/.test(t) ? $(t) : JSON.stringify(
93
+ new Function(
94
+ "",
95
+ `{
96
+ return ${n}
99
97
  }`
98
+ )
100
99
  );
101
100
  }
102
- function L(t, e, n) {
103
- const r = n ? n[e] : "";
104
- return r || JSON.stringify(typeof t == "string" ? O(t + "") : t);
101
+ function z(n, t, e) {
102
+ const r = e ? e[t] : "";
103
+ return r || (typeof n == "string" ? L(n + "") : JSON.stringify(n));
105
104
  }
106
- function T(t) {
107
- let e = z(t.type), n = "any";
108
- e.length == 1 && (n = e[0].split("<")[0]);
109
- const r = n;
110
- let i = (t.selectable || "").trim(), s = [];
111
- return i && n != "boolean" && (i.split(",").forEach((u) => {
112
- if (u) {
113
- let m = u.split(":");
114
- s.push({
115
- label: u,
105
+ function U(n) {
106
+ let t = B(n.type), e = "any";
107
+ t.length == 1 && (e = t[0].split("<")[0]);
108
+ const r = e;
109
+ let o = (n.selectable || "").trim(), i = [];
110
+ return o && e != "boolean" && (o.split(",").forEach((l) => {
111
+ if (l) {
112
+ let m = l.split(":");
113
+ i.push({
114
+ label: l,
116
115
  prop: m[0].trim()
117
116
  });
118
117
  }
119
- }), n == "function" ? n = "function" : n == "array" ? n = "choice" : n = "select"), {
120
- arr: s,
118
+ }), e == "function" ? e = "function" : e == "array" ? e = "choice" : e = "select"), {
119
+ arr: i,
121
120
  zdtype: r,
122
- type: n,
123
- dataType: e
121
+ type: e,
122
+ dataType: t
124
123
  };
125
124
  }
126
- function z(t) {
127
- let e = [];
128
- return (t || "").trim().toLowerCase().split(",").forEach((r) => {
129
- r = r.trim(), r && e.push(r);
130
- }), [...new Set(e)].sort();
125
+ function B(n) {
126
+ let t = [];
127
+ return (n || "").trim().toLowerCase().split(",").forEach((r) => {
128
+ r = r.trim(), r && t.push(r);
129
+ }), [...new Set(t)].sort();
131
130
  }
132
131
  export {
133
- H as getHmtl,
134
- T as getSpecType
132
+ T as getHmtl,
133
+ U as getSpecType
135
134
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.3-5",
4
+ "version": "0.0.3-6",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",