@fangzhongya/vue-archive 0.0.14 → 0.0.15

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.
@@ -2888,6 +2888,7 @@ function getFunctionFormat(v) {
2888
2888
  }
2889
2889
 
2890
2890
  // packages/components/use/code.ts
2891
+ var keywords = ["class"];
2891
2892
  function getHmtl(propsname, value, slotValue, propsText) {
2892
2893
  const tarr = [];
2893
2894
  const sarr = [];
@@ -2916,44 +2917,30 @@ function getHmtl(propsname, value, slotValue, propsText) {
2916
2917
  });
2917
2918
  strs = arr.join("");
2918
2919
  }
2919
- tarr.push(
2920
- " @" + name + '="' + strs + '"'
2921
- );
2920
+ tarr.push(" @" + name + '="' + strs + '"');
2922
2921
  sarr.push("function " + strs + "(...arr) {");
2923
- sarr.push(
2924
- " console.log('" + strs + "', arr)"
2925
- );
2922
+ sarr.push(" console.log('" + strs + "', arr)");
2926
2923
  sarr.push("}");
2927
2924
  } else {
2928
- tarr.push(
2929
- " :" + key + '="' + key + '"'
2930
- );
2925
+ let z = key;
2926
+ if (keywords.includes(key)) {
2927
+ z = key + "1";
2928
+ }
2929
+ tarr.push(" :" + key + '="' + z + '"');
2931
2930
  if (typeof val == "function") {
2932
2931
  sarr.push(
2933
- "const " + key + " = " + getFunctionBody(
2934
- val,
2935
- key,
2936
- propsText
2937
- )
2932
+ "const " + key + " = " + getFunctionBody(val, key, propsText)
2938
2933
  );
2939
2934
  } else {
2940
2935
  if (is) {
2941
2936
  is = false;
2942
- sarr.unshift(
2943
- "import { ref } from 'vue';"
2944
- );
2937
+ sarr.unshift("import { ref } from 'vue';");
2945
2938
  }
2946
2939
  if (typeof val == "undefined") {
2947
- sarr.push("const " + key + " = ref();");
2940
+ sarr.push("const " + z + " = ref();");
2948
2941
  } else {
2949
- let st2 = setValStringify(
2950
- val,
2951
- key,
2952
- propsText
2953
- );
2954
- sarr.push(
2955
- "const " + key + " = ref(" + st2 + ");"
2956
- );
2942
+ let st2 = setValStringify(val, key, propsText);
2943
+ sarr.push("const " + z + " = ref(" + st2 + ");");
2957
2944
  }
2958
2945
  }
2959
2946
  }
@@ -2873,6 +2873,7 @@ function getFunctionFormat(v) {
2873
2873
  }
2874
2874
 
2875
2875
  // packages/components/use/code.ts
2876
+ var keywords = ["class"];
2876
2877
  function getHmtl(propsname, value, slotValue, propsText) {
2877
2878
  const tarr = [];
2878
2879
  const sarr = [];
@@ -2901,44 +2902,30 @@ function getHmtl(propsname, value, slotValue, propsText) {
2901
2902
  });
2902
2903
  strs = arr.join("");
2903
2904
  }
2904
- tarr.push(
2905
- " @" + name + '="' + strs + '"'
2906
- );
2905
+ tarr.push(" @" + name + '="' + strs + '"');
2907
2906
  sarr.push("function " + strs + "(...arr) {");
2908
- sarr.push(
2909
- " console.log('" + strs + "', arr)"
2910
- );
2907
+ sarr.push(" console.log('" + strs + "', arr)");
2911
2908
  sarr.push("}");
2912
2909
  } else {
2913
- tarr.push(
2914
- " :" + key + '="' + key + '"'
2915
- );
2910
+ let z = key;
2911
+ if (keywords.includes(key)) {
2912
+ z = key + "1";
2913
+ }
2914
+ tarr.push(" :" + key + '="' + z + '"');
2916
2915
  if (typeof val == "function") {
2917
2916
  sarr.push(
2918
- "const " + key + " = " + getFunctionBody(
2919
- val,
2920
- key,
2921
- propsText
2922
- )
2917
+ "const " + key + " = " + getFunctionBody(val, key, propsText)
2923
2918
  );
2924
2919
  } else {
2925
2920
  if (is) {
2926
2921
  is = false;
2927
- sarr.unshift(
2928
- "import { ref } from 'vue';"
2929
- );
2922
+ sarr.unshift("import { ref } from 'vue';");
2930
2923
  }
2931
2924
  if (typeof val == "undefined") {
2932
- sarr.push("const " + key + " = ref();");
2925
+ sarr.push("const " + z + " = ref();");
2933
2926
  } else {
2934
- let st2 = setValStringify(
2935
- val,
2936
- key,
2937
- propsText
2938
- );
2939
- sarr.push(
2940
- "const " + key + " = ref(" + st2 + ");"
2941
- );
2927
+ let st2 = setValStringify(val, key, propsText);
2928
+ sarr.push("const " + z + " = ref(" + st2 + ");");
2942
2929
  }
2943
2930
  }
2944
2931
  }
@@ -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 $=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const b=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const d=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs");function j(r,t,e,n){const o=[],i=[];let l=!0;Object.keys(t).forEach(s=>{let c=t[s];if(/^on[A-Z]/.test(s)&&typeof c=="function"){let u=s.substring(2);const p=s.split(":");let f;if(p.length>1?(f=p[0]+p.slice(1).map(a=>d.firstUpper(a)).join(""),u=b.firstLower(u)):(f=p[0],u=$.humpToLine(u)),p.includes("-")){let a=f.split("-");a=a.map((m,S)=>S!=0?d.firstUpper(m):m),f=a.join("")}o.push(" @"+u+'="'+f+'"'),i.push("function "+f+"(...arr) {"),i.push(" console.log('"+f+"', arr)"),i.push("}")}else if(o.push(" :"+s+'="'+s+'"'),typeof c=="function")i.push("const "+s+" = "+L(c,s,n));else if(l&&(l=!1,i.unshift("import { ref } from 'vue';")),typeof c>"u")i.push("const "+s+" = ref();");else{let u=q(c,s,n);i.push("const "+s+" = ref("+u+");")}}),o.length>0&&o.unshift("");const h=F(e);return`<!--${r}-->
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const $=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const b=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const d=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const g=require("./util.cjs"),j=["class"];function F(r,t,e,n){const o=[],i=[];let c=!0;Object.keys(t).forEach(s=>{let p=t[s];if(/^on[A-Z]/.test(s)&&typeof p=="function"){let u=s.substring(2);const f=s.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(a=>d.firstUpper(a)).join(""),u=b.firstLower(u)):(l=f[0],u=$.humpToLine(u)),f.includes("-")){let a=l.split("-");a=a.map((m,S)=>S!=0?d.firstUpper(m):m),l=a.join("")}o.push(" @"+u+'="'+l+'"'),i.push("function "+l+"(...arr) {"),i.push(" console.log('"+l+"', arr)"),i.push("}")}else{let u=s;if(j.includes(s)&&(u=s+"1"),o.push(" :"+s+'="'+u+'"'),typeof p=="function")i.push("const "+s+" = "+L(p,s,n));else if(c&&(c=!1,i.unshift("import { ref } from 'vue';")),typeof p>"u")i.push("const "+u+" = ref();");else{let f=q(p,s,n);i.push("const "+u+" = ref("+f+");")}}}),o.length>0&&o.unshift("");const h=w(e);return`<!--${r}-->
2
2
  <template>
3
3
  <div>
4
4
  <${r}${o.join(`
@@ -11,8 +11,8 @@
11
11
  ${i.join(`
12
12
  `)}
13
13
  <\/script>
14
- `}function F(r={}){const t=[];return Object.keys(r).forEach(e=>{const n=r[e];if(n){const o=` <template #${e}="scope">
14
+ `}function w(r={}){const t=[];return Object.keys(r).forEach(e=>{const n=r[e];if(n){const o=` <template #${e}="scope">
15
15
  ${g.vueFormat(n," ")}
16
16
  </template>`;t.push(o)}}),t&&t.length>0&&t.unshift(""),t}function L(r,t,e){const n=e?e[t]:"";return n?"function "+n:y(r.toString())}function y(r){const t=g.getFunctionFormat(g.prettierFormat(r));if(t){let e=`{
17
17
  ${g.vueFormat(g.getFunBody(t.body)," ")}
18
- }`;return`function ${t.param} ${e}`}else return"undefined"}function O(r){const t=r.trim();return/^\(/.test(t)?y(t):JSON.stringify(r)}function q(r,t,e){const n=e?e[t]:"";return n||(typeof r=="string"?O(r+""):JSON.stringify(r))}function w(r){let t=E(r.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const n=e;let o=(r.selectable||"").trim(),i=[];return o&&e!="boolean"&&(o.split(",").forEach(l=>{if(l){let h=l.split(":");i.push({label:l,prop:h[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:i,zdtype:n,type:e,dataType:t}}function E(r){let t=[];return(r||"").trim().toLowerCase().split(",").forEach(n=>{n=n.trim(),n&&t.push(n)}),[...new Set(t)].sort()}exports.getHmtl=j;exports.getSpecType=w;exports.setValStringify=q;
18
+ }`;return`function ${t.param} ${e}`}else return"undefined"}function O(r){const t=r.trim();return/^\(/.test(t)?y(t):JSON.stringify(r)}function q(r,t,e){const n=e?e[t]:"";return n||(typeof r=="string"?O(r+""):JSON.stringify(r))}function E(r){let t=T(r.type),e="any";t.length==1&&(e=t[0].split("<")[0]);const n=e;let o=(r.selectable||"").trim(),i=[];return o&&e!="boolean"&&(o.split(",").forEach(c=>{if(c){let h=c.split(":");i.push({label:c,prop:h[0].trim()})}}),e=="function"?e="function":e=="array"?e="choice":e="select"),{arr:i,zdtype:n,type:e,dataType:t}}function T(r){let t=[];return(r||"").trim().toLowerCase().split(",").forEach(n=>{n=n.trim(),n&&t.push(n)}),[...new Set(t)].sort()}exports.getHmtl=F;exports.getSpecType=E;exports.setValStringify=q;
@@ -9,58 +9,44 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
9
9
  import { firstUpper as g } from "@fangzhongya/utils/basic/string/firstUpper";
10
10
  import "@fangzhongya/utils/urls/getSuffix";
11
11
  import "@fangzhongya/utils/basic/array/replaceAfter";
12
- import { vueFormat as d, getFunctionFormat as j, prettierFormat as F, getFunBody as E } from "./util.js";
13
- function I(r, t, e, n) {
14
- const s = [], i = [];
15
- let u = !0;
16
- Object.keys(t).forEach((o) => {
17
- let c = t[o];
18
- if (/^on[A-Z]/.test(o) && typeof c == "function") {
19
- let f = o.substring(2);
20
- const p = o.split(":");
21
- let l;
22
- if (p.length > 1 ? (l = p[0] + p.slice(1).map((a) => g(a)).join(""), f = S(f)) : (l = p[0], f = b(f)), p.includes("-")) {
23
- let a = l.split("-");
24
- a = a.map((h, y) => y != 0 ? g(h) : h), l = a.join("");
12
+ import { vueFormat as d, getFunctionFormat as j, prettierFormat as F, getFunBody as w } from "./util.js";
13
+ const E = ["class"];
14
+ function K(n, t, e, r) {
15
+ const o = [], i = [];
16
+ let c = !0;
17
+ Object.keys(t).forEach((s) => {
18
+ let p = t[s];
19
+ if (/^on[A-Z]/.test(s) && typeof p == "function") {
20
+ let f = s.substring(2);
21
+ const l = s.split(":");
22
+ let u;
23
+ if (l.length > 1 ? (u = l[0] + l.slice(1).map((a) => g(a)).join(""), f = S(f)) : (u = l[0], f = b(f)), l.includes("-")) {
24
+ let a = u.split("-");
25
+ a = a.map((h, $) => $ != 0 ? g(h) : h), u = a.join("");
26
+ }
27
+ o.push(" @" + f + '="' + u + '"'), i.push("function " + u + "(...arr) {"), i.push(" console.log('" + u + "', arr)"), i.push("}");
28
+ } else {
29
+ let f = s;
30
+ if (E.includes(s) && (f = s + "1"), o.push(" :" + s + '="' + f + '"'), typeof p == "function")
31
+ i.push(
32
+ "const " + s + " = " + z(p, s, r)
33
+ );
34
+ else if (c && (c = !1, i.unshift("import { ref } from 'vue';")), typeof p > "u")
35
+ i.push("const " + f + " = ref();");
36
+ else {
37
+ let l = B(p, s, r);
38
+ i.push("const " + f + " = ref(" + l + ");");
25
39
  }
26
- s.push(
27
- " @" + f + '="' + l + '"'
28
- ), i.push("function " + l + "(...arr) {"), i.push(
29
- " console.log('" + l + "', arr)"
30
- ), i.push("}");
31
- } else if (s.push(
32
- " :" + o + '="' + o + '"'
33
- ), typeof c == "function")
34
- i.push(
35
- "const " + o + " = " + w(
36
- c,
37
- o,
38
- n
39
- )
40
- );
41
- else if (u && (u = !1, i.unshift(
42
- "import { ref } from 'vue';"
43
- )), typeof c > "u")
44
- i.push("const " + o + " = ref();");
45
- else {
46
- let f = z(
47
- c,
48
- o,
49
- n
50
- );
51
- i.push(
52
- "const " + o + " = ref(" + f + ");"
53
- );
54
40
  }
55
- }), s.length > 0 && s.unshift("");
41
+ }), o.length > 0 && o.unshift("");
56
42
  const m = O(e);
57
- return `<!--${r}-->
43
+ return `<!--${n}-->
58
44
  <template>
59
45
  <div>
60
- <${r}${s.join(`
46
+ <${n}${o.join(`
61
47
  `)}>${m.join(`
62
48
  `)}
63
- </${r}>
49
+ </${n}>
64
50
  </div>
65
51
  </template>
66
52
  <script lang="ts" setup>
@@ -69,68 +55,68 @@ ${i.join(`
69
55
  <\/script>
70
56
  `;
71
57
  }
72
- function O(r = {}) {
58
+ function O(n = {}) {
73
59
  const t = [];
74
- return Object.keys(r).forEach((e) => {
75
- const n = r[e];
76
- if (n) {
77
- const s = ` <template #${e}="scope">
78
- ${d(n, " ")}
60
+ return Object.keys(n).forEach((e) => {
61
+ const r = n[e];
62
+ if (r) {
63
+ const o = ` <template #${e}="scope">
64
+ ${d(r, " ")}
79
65
  </template>`;
80
- t.push(s);
66
+ t.push(o);
81
67
  }
82
68
  }), t && t.length > 0 && t.unshift(""), t;
83
69
  }
84
- function w(r, t, e) {
85
- const n = e ? e[t] : "";
86
- return n ? "function " + n : $(r.toString());
70
+ function z(n, t, e) {
71
+ const r = e ? e[t] : "";
72
+ return r ? "function " + r : y(n.toString());
87
73
  }
88
- function $(r) {
89
- const t = j(F(r));
74
+ function y(n) {
75
+ const t = j(F(n));
90
76
  if (t) {
91
77
  let e = `{
92
- ${d(E(t.body), " ")}
78
+ ${d(w(t.body), " ")}
93
79
  }`;
94
80
  return `function ${t.param} ${e}`;
95
81
  } else
96
82
  return "undefined";
97
83
  }
98
- function L(r) {
99
- const t = r.trim();
100
- return /^\(/.test(t) ? $(t) : JSON.stringify(r);
84
+ function L(n) {
85
+ const t = n.trim();
86
+ return /^\(/.test(t) ? y(t) : JSON.stringify(n);
101
87
  }
102
- function z(r, t, e) {
103
- const n = e ? e[t] : "";
104
- return n || (typeof r == "string" ? L(r + "") : JSON.stringify(r));
88
+ function B(n, t, e) {
89
+ const r = e ? e[t] : "";
90
+ return r || (typeof n == "string" ? L(n + "") : JSON.stringify(n));
105
91
  }
106
- function K(r) {
107
- let t = B(r.type), e = "any";
92
+ function M(n) {
93
+ let t = C(n.type), e = "any";
108
94
  t.length == 1 && (e = t[0].split("<")[0]);
109
- const n = e;
110
- let s = (r.selectable || "").trim(), i = [];
111
- return s && e != "boolean" && (s.split(",").forEach((u) => {
112
- if (u) {
113
- let m = u.split(":");
95
+ const r = e;
96
+ let o = (n.selectable || "").trim(), i = [];
97
+ return o && e != "boolean" && (o.split(",").forEach((c) => {
98
+ if (c) {
99
+ let m = c.split(":");
114
100
  i.push({
115
- label: u,
101
+ label: c,
116
102
  prop: m[0].trim()
117
103
  });
118
104
  }
119
105
  }), e == "function" ? e = "function" : e == "array" ? e = "choice" : e = "select"), {
120
106
  arr: i,
121
- zdtype: n,
107
+ zdtype: r,
122
108
  type: e,
123
109
  dataType: t
124
110
  };
125
111
  }
126
- function B(r) {
112
+ function C(n) {
127
113
  let t = [];
128
- return (r || "").trim().toLowerCase().split(",").forEach((n) => {
129
- n = n.trim(), n && t.push(n);
114
+ return (n || "").trim().toLowerCase().split(",").forEach((r) => {
115
+ r = r.trim(), r && t.push(r);
130
116
  }), [...new Set(t)].sort();
131
117
  }
132
118
  export {
133
- I as getHmtl,
134
- K as getSpecType,
135
- z as setValStringify
119
+ K as getHmtl,
120
+ M as getSpecType,
121
+ B as setValStringify
136
122
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",