@fangzhongya/vue-archive 0.0.28 → 0.0.30
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.
- package/dist/node/index.cjs +5 -7
- package/dist/node/index.js +5 -7
- package/dist/packages/components/use/code.cjs +3 -3
- package/dist/packages/components/use/code.js +39 -41
- package/dist/packages/components/use/util.cjs +1 -1
- package/dist/packages/components/use/util.js +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -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 {
|
|
@@ -3250,7 +3248,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3250
3248
|
z = key + "1";
|
|
3251
3249
|
}
|
|
3252
3250
|
tarr.push(" :" + key + '="' + z + '"');
|
|
3253
|
-
const sp = getSpecObjs(ps, key);
|
|
3251
|
+
const sp = getSpecObjs(ps, key) || {};
|
|
3254
3252
|
const t = getSpecType(sp);
|
|
3255
3253
|
sarr.push(
|
|
3256
3254
|
`// ${sp.description} ${sp.name}: {${sp.type}} (${sp.selectable})`
|
|
@@ -3289,7 +3287,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3289
3287
|
tarr.unshift(' ref="refDom"');
|
|
3290
3288
|
sarr.push("const refDom = ref()");
|
|
3291
3289
|
ev.forEach((v) => {
|
|
3292
|
-
const s = getSpecObjs(res, v.name);
|
|
3290
|
+
const s = getSpecObjs(res, v.name) || {};
|
|
3293
3291
|
sarr.push(
|
|
3294
3292
|
`// ${s.description} ${s.name}\uFF1A(${s.selectable}) ${s.type}`
|
|
3295
3293
|
);
|
|
@@ -3350,7 +3348,7 @@ ${sarr.join("\n")}
|
|
|
3350
3348
|
function getSlots(obj = {}, ss) {
|
|
3351
3349
|
const arr = [];
|
|
3352
3350
|
Object.keys(obj).forEach((key) => {
|
|
3353
|
-
const sp = getSpecObjs(ss, key);
|
|
3351
|
+
const sp = getSpecObjs(ss, key) || {};
|
|
3354
3352
|
const v = obj[key];
|
|
3355
3353
|
if (v) {
|
|
3356
3354
|
const st = ` <!-- ${sp.description} ${sp.name}\uFF1A(${sp.selectable}) -->
|
package/dist/node/index.js
CHANGED
|
@@ -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 {
|
|
@@ -3235,7 +3233,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3235
3233
|
z = key + "1";
|
|
3236
3234
|
}
|
|
3237
3235
|
tarr.push(" :" + key + '="' + z + '"');
|
|
3238
|
-
const sp = getSpecObjs(ps, key);
|
|
3236
|
+
const sp = getSpecObjs(ps, key) || {};
|
|
3239
3237
|
const t = getSpecType(sp);
|
|
3240
3238
|
sarr.push(
|
|
3241
3239
|
`// ${sp.description} ${sp.name}: {${sp.type}} (${sp.selectable})`
|
|
@@ -3274,7 +3272,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
|
|
|
3274
3272
|
tarr.unshift(' ref="refDom"');
|
|
3275
3273
|
sarr.push("const refDom = ref()");
|
|
3276
3274
|
ev.forEach((v) => {
|
|
3277
|
-
const s = getSpecObjs(res, v.name);
|
|
3275
|
+
const s = getSpecObjs(res, v.name) || {};
|
|
3278
3276
|
sarr.push(
|
|
3279
3277
|
`// ${s.description} ${s.name}\uFF1A(${s.selectable}) ${s.type}`
|
|
3280
3278
|
);
|
|
@@ -3335,7 +3333,7 @@ ${sarr.join("\n")}
|
|
|
3335
3333
|
function getSlots(obj = {}, ss) {
|
|
3336
3334
|
const arr = [];
|
|
3337
3335
|
Object.keys(obj).forEach((key) => {
|
|
3338
|
-
const sp = getSpecObjs(ss, key);
|
|
3336
|
+
const sp = getSpecObjs(ss, key) || {};
|
|
3339
3337
|
const v = obj[key];
|
|
3340
3338
|
if (v) {
|
|
3341
3339
|
const st = ` <!-- ${sp.description} ${sp.name}\uFF1A(${sp.selectable}) -->
|
|
@@ -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,
|
|
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
|
|
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
|
|
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,
|
|
23
|
-
const
|
|
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((
|
|
33
|
-
let
|
|
34
|
-
|
|
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
|
-
|
|
37
|
-
const
|
|
38
|
-
n.push(`// ${
|
|
39
|
-
const
|
|
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"),
|
|
47
|
-
const c = j(z, o), a = X(c);
|
|
44
|
+
M.includes(o) && (i = o + "1"), f.push(" :" + o + '="' + i + '"');
|
|
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,
|
|
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
|
|
56
|
-
|
|
57
|
-
"const " + i + " = ref(" + (
|
|
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
|
|
61
|
-
n.push("const " + i + " = ref(" +
|
|
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';")),
|
|
67
|
-
const u = j(P, o.name);
|
|
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) => {
|
|
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 = [],
|
|
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
|
|
76
|
-
if (n.push(`// ${d.label}`), typeof
|
|
73
|
+
const p = g + o.name, h = l[b];
|
|
74
|
+
if (n.push(`// ${d.label}`), typeof h == "function")
|
|
77
75
|
n.push(
|
|
78
|
-
"const " +
|
|
76
|
+
"const " + p + " = " + T(h, g, o.text)
|
|
79
77
|
);
|
|
80
|
-
else if (typeof
|
|
78
|
+
else if (typeof h > "u")
|
|
81
79
|
n.push(
|
|
82
|
-
"const " +
|
|
80
|
+
"const " + p + " = " + F(d.dataType) + ";"
|
|
83
81
|
);
|
|
84
82
|
else {
|
|
85
|
-
let S = D(
|
|
86
|
-
n.push("const " +
|
|
83
|
+
let S = D(h, g, o.text);
|
|
84
|
+
n.push("const " + p + " = " + S + ";");
|
|
87
85
|
}
|
|
88
|
-
a.push(
|
|
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
|
-
})),
|
|
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}${
|
|
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
|
|
111
|
+
const m = j(e, r) || {}, $ = s[r];
|
|
114
112
|
if ($) {
|
|
115
|
-
const
|
|
113
|
+
const f = ` <!-- ${m.description} ${m.name}:(${m.selectable}) -->
|
|
116
114
|
<template #${r}="scope">
|
|
117
115
|
${w($, " ")}
|
|
118
116
|
</template>`;
|
|
119
|
-
t.push(
|
|
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
|
|
150
|
-
return
|
|
151
|
-
if (
|
|
152
|
-
let n =
|
|
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:
|
|
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("|")}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;
|