@fangzhongya/vue-archive 0.0.54 → 0.0.55
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 +83 -30
- package/dist/node/index.js +83 -30
- package/dist/packages/components/compo/index.cjs +1 -1
- package/dist/packages/components/compo/index.js +126 -108
- package/dist/packages/components/use/code.cjs +10 -10
- package/dist/packages/components/use/code.js +99 -93
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.js +38 -34
- package/dist/packages/utils/props.cjs +1 -1
- package/dist/packages/utils/props.js +30 -27
- package/package.json +1 -1
|
@@ -9,96 +9,102 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
|
9
9
|
import { firstUpper as w } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
10
10
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
11
11
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
12
|
-
import { getTypeValue as
|
|
12
|
+
import { getTypeValue as V, parseParamString as j, parseTypeDefinition as q, setDataType as v, vueFormat as E, getFunBody as C, prettierFormat as G } from "./util.js";
|
|
13
13
|
import { getPropsValue as I, getEmitsValue as K, getExposeValue as M, getSlotValue as Q } from "../../utils/props.js";
|
|
14
14
|
import { getFunctionFormat as R } from "@fangzhongya/utils/basic/string/toFunction";
|
|
15
15
|
const W = ["class"];
|
|
16
|
-
function
|
|
17
|
-
return t.filter((s) => s.name ==
|
|
16
|
+
function T(t, n) {
|
|
17
|
+
return t.filter((s) => s.name == n)[0];
|
|
18
18
|
}
|
|
19
19
|
function P(t) {
|
|
20
|
-
return t.map((
|
|
20
|
+
return t.map((n) => (n.prop || "...arr") + ":" + v(n.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function ht(t,
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
const B = I(
|
|
22
|
+
function ht(t, n, s, e, i, h) {
|
|
23
|
+
const m = [], r = [];
|
|
24
|
+
let d = !0;
|
|
25
|
+
const B = I(n.propss || []), J = K(n.emitss || []), N = M(n.exposes || []), A = Q(n.slots || []);
|
|
26
26
|
Object.keys(s).forEach((o) => {
|
|
27
|
-
let
|
|
28
|
-
if (/^on[A-Z]/.test(o) && typeof
|
|
29
|
-
let
|
|
30
|
-
const
|
|
31
|
-
let
|
|
32
|
-
if (
|
|
33
|
-
let
|
|
34
|
-
|
|
27
|
+
let c = s[o];
|
|
28
|
+
if (/^on[A-Z]/.test(o) && typeof c == "function") {
|
|
29
|
+
let u = o.substring(2);
|
|
30
|
+
const f = o.split(":");
|
|
31
|
+
let l;
|
|
32
|
+
if (f.length > 1 ? (l = f[0] + f.slice(1).map((p) => w(p)).join(""), u = Z(u)) : (l = f[0], u = U(u)), f.includes("-")) {
|
|
33
|
+
let p = l.split("-");
|
|
34
|
+
p = p.map(($, S) => S != 0 ? w($) : $), l = p.join("");
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
r.push(`// ${
|
|
39
|
-
const $ =
|
|
40
|
-
r.push(" console.log('" +
|
|
36
|
+
m.push(" @" + u + '="' + l + '"');
|
|
37
|
+
const a = T(J, u) || {}, y = a.selectable || "", b = j(y), g = P(b);
|
|
38
|
+
r.push(`// ${a.description} ${a.name}: (${a.selectable})`), r.push("function " + l + "(" + g + ") {"), b.forEach((p) => {
|
|
39
|
+
const $ = p.name || "arr";
|
|
40
|
+
r.push(" console.log('" + p.label + "', " + $ + ")");
|
|
41
41
|
}), r.push("}");
|
|
42
42
|
} else {
|
|
43
|
-
let
|
|
44
|
-
W.includes(o) && (
|
|
45
|
-
const
|
|
43
|
+
let u = o;
|
|
44
|
+
W.includes(o) && (u = o + "1"), m.push(" :" + o + '="' + u + '"');
|
|
45
|
+
const f = T(B, o) || {}, l = z(f);
|
|
46
46
|
if (r.push(
|
|
47
|
-
`// ${
|
|
48
|
-
), typeof
|
|
47
|
+
`// ${f.description} ${f.name}: {${f.type}} (${f.selectable})`
|
|
48
|
+
), typeof c == "function" || l.dataType.length == 1 && l.type == "function" && c)
|
|
49
49
|
r.push(
|
|
50
|
-
"const " + o + " = " + x(
|
|
50
|
+
"const " + o + " = " + x(
|
|
51
|
+
c,
|
|
52
|
+
o,
|
|
53
|
+
i
|
|
54
|
+
)
|
|
51
55
|
);
|
|
52
|
-
else if (
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
r.push("const " +
|
|
56
|
+
else if (d && (d = !1, r.unshift("import { ref } from 'vue';")), typeof c > "u")
|
|
57
|
+
if (l.type == "function") {
|
|
58
|
+
const a = Y(f);
|
|
59
|
+
r.push("const " + u + " = " + a + ";");
|
|
56
60
|
} else {
|
|
57
|
-
const
|
|
61
|
+
const a = V(l.dataType);
|
|
58
62
|
r.push(
|
|
59
|
-
"const " +
|
|
63
|
+
"const " + u + " = ref(" + (a === "undefined" ? "" : a) + ");"
|
|
60
64
|
);
|
|
61
65
|
}
|
|
62
66
|
else {
|
|
63
|
-
let
|
|
64
|
-
r.push("const " +
|
|
67
|
+
let a = L(c, o, i);
|
|
68
|
+
r.push("const " + u + " = ref(" + a + ");");
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
});
|
|
68
72
|
const O = Object.values(h || {});
|
|
69
|
-
O.length > 0 && (
|
|
70
|
-
const
|
|
73
|
+
O.length > 0 && (d && (d = !1, r.unshift("import { ref } from 'vue';")), m.unshift(' ref="refDom"'), r.push("const refDom = ref()"), O.forEach((o) => {
|
|
74
|
+
const c = T(N, o.name) || {};
|
|
71
75
|
r.push(
|
|
72
|
-
`// ${
|
|
76
|
+
`// ${c.description} ${c.name}:(${c.selectable}) ${c.type}`
|
|
73
77
|
);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const g =
|
|
78
|
+
const u = o.name + "Value", f = j(c?.selectable || ""), l = [], a = o.params || [];
|
|
79
|
+
f.forEach((y, b) => {
|
|
80
|
+
const g = y.name;
|
|
77
81
|
if (g) {
|
|
78
|
-
const
|
|
79
|
-
if (r.push(`// ${
|
|
82
|
+
const p = g + o.name, $ = a[b];
|
|
83
|
+
if (r.push(`// ${y.label}`), typeof $ == "function")
|
|
80
84
|
r.push(
|
|
81
|
-
"const " +
|
|
85
|
+
"const " + p + " = " + x($, g, o.text)
|
|
82
86
|
);
|
|
83
87
|
else if (typeof $ > "u")
|
|
84
88
|
r.push(
|
|
85
|
-
"const " +
|
|
89
|
+
"const " + p + " = " + V(y.dataType) + ";"
|
|
86
90
|
);
|
|
87
91
|
else {
|
|
88
|
-
let
|
|
89
|
-
r.push("const " +
|
|
92
|
+
let S = L($, g, o.text);
|
|
93
|
+
r.push("const " + p + " = " + S + ";");
|
|
90
94
|
}
|
|
91
|
-
|
|
95
|
+
l.push(p);
|
|
92
96
|
}
|
|
93
|
-
}), o.type === "function" ? r.push(
|
|
94
|
-
`const ${
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
}), o.type === "function" ? (c.return ? r.push(
|
|
98
|
+
`const ${u} = refDom.value?.${o.name}(${l.join(
|
|
99
|
+
", "
|
|
100
|
+
)})`
|
|
101
|
+
) : r.push(`refDom.value?.${o.name}(${l.join(", ")})`), c.return && r.push(`console.log('${c.return}', ${u})`)) : (r.push(`const ${u} = refDom.value?.${o.name}`), r.push(`console.log('${c.type || c.name}', ${u})`));
|
|
102
|
+
})), m.length > 0 && m.unshift("");
|
|
103
|
+
const H = X(e, A);
|
|
98
104
|
return `<!--${t}-->
|
|
99
105
|
<template>
|
|
100
106
|
<div>
|
|
101
|
-
<${t}${
|
|
107
|
+
<${t}${m.join(`
|
|
102
108
|
`)}>${H.join(`
|
|
103
109
|
`)}
|
|
104
110
|
</${t}>
|
|
@@ -110,71 +116,71 @@ ${r.join(`
|
|
|
110
116
|
<\/script>
|
|
111
117
|
`;
|
|
112
118
|
}
|
|
113
|
-
function X(t = {},
|
|
119
|
+
function X(t = {}, n) {
|
|
114
120
|
const s = [];
|
|
115
|
-
return Object.keys(t).forEach((
|
|
116
|
-
const i =
|
|
121
|
+
return Object.keys(t).forEach((e) => {
|
|
122
|
+
const i = T(n, e) || {}, h = t[e];
|
|
117
123
|
if (h) {
|
|
118
|
-
const
|
|
119
|
-
<template #${
|
|
120
|
-
${
|
|
124
|
+
const m = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
|
|
125
|
+
<template #${e}="scope">
|
|
126
|
+
${E(h, " ")}
|
|
121
127
|
</template>`;
|
|
122
|
-
s.push(
|
|
128
|
+
s.push(m);
|
|
123
129
|
}
|
|
124
130
|
}), s && s.length > 0 && s.unshift(""), s;
|
|
125
131
|
}
|
|
126
|
-
function x(t,
|
|
127
|
-
const
|
|
128
|
-
return
|
|
132
|
+
function x(t, n, s) {
|
|
133
|
+
const e = s ? s[n] : "";
|
|
134
|
+
return e && (e.includes("=>") || e.includes("function")) ? e : F(t.toString());
|
|
129
135
|
}
|
|
130
136
|
function F(t) {
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
137
|
+
const n = R(G(t));
|
|
138
|
+
if (n) {
|
|
133
139
|
let s = `{
|
|
134
|
-
${
|
|
140
|
+
${E(C(n.body), " ")}
|
|
135
141
|
}`;
|
|
136
|
-
return `function (${e.
|
|
142
|
+
return `function (${n.param.split(",").map((e) => e + ":any").join(",")}) ${s}`;
|
|
137
143
|
} else
|
|
138
144
|
return "undefined";
|
|
139
145
|
}
|
|
140
146
|
function Y(t) {
|
|
141
|
-
const
|
|
142
|
-
let
|
|
143
|
-
t.return && (
|
|
147
|
+
const n = j(t.selectable), s = P(n);
|
|
148
|
+
let e = "";
|
|
149
|
+
t.return && (e = "return ");
|
|
144
150
|
let i = `{
|
|
145
|
-
${
|
|
151
|
+
${E(C(e), " ")}
|
|
146
152
|
}`;
|
|
147
153
|
return `function (${s}) ${i}`;
|
|
148
154
|
}
|
|
149
155
|
function _(t) {
|
|
150
|
-
const
|
|
151
|
-
return /^\(/.test(
|
|
156
|
+
const n = t.trim();
|
|
157
|
+
return /^\(/.test(n) ? F(n) : JSON.stringify(t);
|
|
152
158
|
}
|
|
153
|
-
function L(t,
|
|
154
|
-
const
|
|
155
|
-
return
|
|
159
|
+
function L(t, n, s) {
|
|
160
|
+
const e = s ? s[n] : "";
|
|
161
|
+
return e || (typeof t == "string" ? _(t + "") : JSON.stringify(t));
|
|
156
162
|
}
|
|
157
163
|
function z(t) {
|
|
158
|
-
let
|
|
159
|
-
|
|
164
|
+
let n = q(t?.type), s = n.dataType, e = n.type;
|
|
165
|
+
e = e.split("<")[0], e = e.trim().toLowerCase(), s.length > 1 && (e = "any");
|
|
160
166
|
let i = (t?.selectable || "").trim(), h = [];
|
|
161
|
-
return i &&
|
|
162
|
-
if (
|
|
163
|
-
let r =
|
|
167
|
+
return i && e != "boolean" && (i.includes("|") ? i.split("|").forEach((m) => {
|
|
168
|
+
if (m) {
|
|
169
|
+
let r = m.split(":");
|
|
164
170
|
h.push({
|
|
165
|
-
label:
|
|
166
|
-
prop:
|
|
171
|
+
label: m,
|
|
172
|
+
prop: D(r[0].trim())
|
|
167
173
|
});
|
|
168
174
|
}
|
|
169
|
-
}) : h =
|
|
175
|
+
}) : h = j(i), e == "array" ? e = "choice" : e != "function" && h.length > 1 && (e = "select")), {
|
|
170
176
|
arr: h,
|
|
171
|
-
type:
|
|
177
|
+
type: e,
|
|
172
178
|
dataType: s
|
|
173
179
|
};
|
|
174
180
|
}
|
|
175
|
-
function
|
|
181
|
+
function D(t, n) {
|
|
176
182
|
try {
|
|
177
|
-
if (
|
|
183
|
+
if (n?.toLowerCase() == "function")
|
|
178
184
|
if (typeof t == "string") {
|
|
179
185
|
if (/^\((.|\n|\r)*\)$/.test(t))
|
|
180
186
|
return t = t.substring(1, t.length - 1), new Function(`{ return ${t} }`)();
|
|
@@ -186,14 +192,14 @@ function E(t, e) {
|
|
|
186
192
|
return "" + t;
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
|
-
function $t(t,
|
|
190
|
-
const s = z(t),
|
|
191
|
-
if (
|
|
195
|
+
function $t(t, n = !0) {
|
|
196
|
+
const s = z(t), e = V(s.dataType);
|
|
197
|
+
if (n) {
|
|
192
198
|
const i = (t.default || "").trim();
|
|
193
|
-
return
|
|
199
|
+
return D(i || e, s.dataType[0]);
|
|
194
200
|
} else {
|
|
195
201
|
const i = (t.default || "").trim();
|
|
196
|
-
return
|
|
202
|
+
return D(i, s.dataType[0]);
|
|
197
203
|
}
|
|
198
204
|
}
|
|
199
205
|
export {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)}function
|
|
3
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@fangzhongya/utils/basic/string/toFunction"),w=require("@fangzhongya/utils/basic/string/firstLower");function y(e){return e.replace(/\;(\s|\n\r)*$/,"")}function A(e){return e="let a = "+e,y(e).replace(/^let a = /,"")}function x(e){return y(e)}function v(e,n=""){let t=(e+"").trim().split(/\n/);return t=t.map(r=>n+r),t.join(`
|
|
2
|
+
`)}function d(e=""){e=e.trim();let n=`[\\s|\\n|\\r]*\\{((.|
|
|
3
|
+
|\r)+?)\\}[\\s|\\n|\\r]*`,r=new RegExp("^"+n+"$").exec(e);return r&&r.length>0?d(r[1]):e}const W=["Boolean","Any","String","Number","Array","Object","Function"];function k(e){return W.includes(e)?w.firstLower(e):e}function E(e){let t=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(t&&t.length>0)return{own:k(t[1]),son:t[2]}}function T(e,n){let t=E(e);t?(n.push(t.own),t.son&&T(t.son,n)):n.push(e)}function h(e){e instanceof Array&&(e=e[0]);const n=[];return e&&T(e,n),n}function j(e){const n=Object.prototype.toString.call(e);let r=/^\[[O|o]bject (.*)\]$/.exec(n),i=typeof e;return r&&r.length>0&&(i=r[1].toLowerCase()),i}function q(e,n){const t=j(e),r=h(n)[0];return r&&r!="any"?t==r:!0}function B(e){if(typeof e=="string"){let n=!1;return(/^\'(.|\n|\r)*\'$/.test(e)||/^\"(.|\n|\r)*\"$/.test(e)||/^\`(.|\n|\r)*\`$/.test(e))&&(n=!0),n&&(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 L(e){const n=typeof e;if(n=="string"){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}else return n==="object"?e instanceof Array?"array":n===null?"null":n:n}function F(e){const n=e[0]||"any";let t=n.split("<")[0];switch(t=t.trim().toLowerCase(),t){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let r=n.indexOf("<"),i=n.substring(n.indexOf("<")+1,n.length-1)||"";r==-1&&(i="any");let o=F(b(i).dataType);return o=o=="undefined"?"":o,`[${o}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function C(e){let n="";return e.forEach((t,r)=>{t=t.trim(),t&&(n&&(n+=" | "),t==="Array"?n+="Array<any>":n+=t)}),n||"any"}const f=(e,n)=>{let t=[],r=[],i="";for(let o=0;o<e.length;o++){const s=e[o];s==="["||s==="<"||s==="("?(t.push(s),i+=s):s==="]"&&t.length>0&&t[t.length-1]==="["||s===">"&&t.length>0&&t[t.length-1]==="<"||s===")"&&t.length>0&&t[t.length-1]==="("?(t.pop(),i+=s):s===n&&t.length===0?(r.push(i.trim()),i=""):i+=s}return i.trim()!==""&&r.push(i.trim()),r},b=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=f(n,",");return{type:t[0]||"any",dataType:t}}else if(e.startsWith("<")&&e.endsWith(">")){const n=e.slice(1,-1).trim();if(!n)return{type:"any",dataType:["any"]};const t=f(n,"|");return{type:t[0]||"any",dataType:t}}else{const n=f(e,",");return{type:n[0]||"any",dataType:n}}else return{type:"any",dataType:["any"]}};function M(e){return f(e,",").map(t=>{const r=t.trim(),i=t.match(/^([^:?]+)(\??):/);if(!i)return null;const o=i[1].trim(),s=!i[2],$=i[0].length,c=t.substring($).trim();let l=[],p="",g="";for(let u=0;u<c.length;u++){const a=c[u];if(a==="["||a==="<"||a==="("?l.push(a):(a==="]"&&l[l.length-1]==="["||a===">"&&l[l.length-1]==="<"||a===")"&&l[l.length-1]==="(")&&l.pop(),l.length===0&&u>0){u==1&&a!=="]"&&a!==">"&&a!==")"?(p="",g=c.substring(0)):(p=c.substring(0,u+1).trim(),g=c.substring(u+1));break}}const{type:N,dataType:m}=b(p),S=h(m);return{name:o,prop:o,type:S[0],dataType:m,must:s,label:r,description:g}}).filter(Boolean)}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>O.getFunctionFormat});exports.getFunBody=d;exports.getObjType=j;exports.getSonType=h;exports.getString=B;exports.getTypeValue=F;exports.isDefaultType=L;exports.isTypeEqual=q;exports.parseParamString=M;exports.parseTypeDefinition=b;exports.prettierArrFormat=x;exports.prettierFormat=y;exports.prettierObjFormat=A;exports.setDataType=C;exports.vueFormat=v;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getFunctionFormat as M } from "@fangzhongya/utils/basic/string/toFunction";
|
|
2
|
-
import { firstLower as
|
|
2
|
+
import { firstLower as j } from "@fangzhongya/utils/basic/string/firstLower";
|
|
3
3
|
function h(e) {
|
|
4
4
|
return e.replace(/\;(\s|\n\r)*$/, "");
|
|
5
5
|
}
|
|
@@ -14,11 +14,11 @@ function B(e, n = "") {
|
|
|
14
14
|
return t = t.map((r) => n + r), t.join(`
|
|
15
15
|
`);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function x(e = "") {
|
|
18
18
|
e = e.trim();
|
|
19
19
|
let n = `[\\s|\\n|\\r]*\\{((.|
|
|
20
20
|
|\r)+?)\\}[\\s|\\n|\\r]*`, r = new RegExp("^" + n + "$").exec(e);
|
|
21
|
-
return r && r.length > 0 ?
|
|
21
|
+
return r && r.length > 0 ? x(r[1]) : e;
|
|
22
22
|
}
|
|
23
23
|
const S = [
|
|
24
24
|
"Boolean",
|
|
@@ -30,9 +30,9 @@ const S = [
|
|
|
30
30
|
"Function"
|
|
31
31
|
];
|
|
32
32
|
function w(e) {
|
|
33
|
-
return S.includes(e) ?
|
|
33
|
+
return S.includes(e) ? j(e) : e;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function A(e) {
|
|
36
36
|
let t = new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);
|
|
37
37
|
if (t && t.length > 0)
|
|
38
38
|
return {
|
|
@@ -40,22 +40,22 @@ function x(e) {
|
|
|
40
40
|
son: t[2]
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
let t =
|
|
45
|
-
t ? (n.push(t.own), t.son &&
|
|
43
|
+
function d(e, n) {
|
|
44
|
+
let t = A(e);
|
|
45
|
+
t ? (n.push(t.own), t.son && d(t.son, n)) : n.push(e);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function m(e) {
|
|
48
48
|
e instanceof Array && (e = e[0]);
|
|
49
49
|
const n = [];
|
|
50
|
-
return e &&
|
|
50
|
+
return e && d(e, n), n;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function F(e) {
|
|
53
53
|
const n = Object.prototype.toString.call(e);
|
|
54
54
|
let r = /^\[[O|o]bject (.*)\]$/.exec(n), i = typeof e;
|
|
55
55
|
return r && r.length > 0 && (i = r[1].toLowerCase()), i;
|
|
56
56
|
}
|
|
57
57
|
function L(e, n) {
|
|
58
|
-
const t =
|
|
58
|
+
const t = F(e), r = m(n)[0];
|
|
59
59
|
return r && r != "any" ? t == r : !0;
|
|
60
60
|
}
|
|
61
61
|
function C(e) {
|
|
@@ -73,8 +73,10 @@ function N(e) {
|
|
|
73
73
|
} else
|
|
74
74
|
return n === "object" ? e instanceof Array ? "array" : n === null ? "null" : n : n;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
76
|
+
function O(e) {
|
|
77
|
+
const n = e[0] || "any";
|
|
78
|
+
let t = n.split("<")[0];
|
|
79
|
+
switch (t = t.trim().toLowerCase(), t) {
|
|
78
80
|
case "string":
|
|
79
81
|
return '""';
|
|
80
82
|
case "boolean":
|
|
@@ -82,8 +84,10 @@ function F(e) {
|
|
|
82
84
|
case "number":
|
|
83
85
|
return "0";
|
|
84
86
|
case "array":
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
+
let r = n.indexOf("<"), i = n.substring(n.indexOf("<") + 1, n.length - 1) || "";
|
|
88
|
+
r == -1 && (i = "any");
|
|
89
|
+
let l = O(b(i).dataType);
|
|
90
|
+
return l = l == "undefined" ? "" : l, `[${l}]`;
|
|
87
91
|
case "object":
|
|
88
92
|
return "{}";
|
|
89
93
|
case "function":
|
|
@@ -102,12 +106,12 @@ function R(e) {
|
|
|
102
106
|
}
|
|
103
107
|
const f = (e, n) => {
|
|
104
108
|
let t = [], r = [], i = "";
|
|
105
|
-
for (let
|
|
106
|
-
const s = e[
|
|
109
|
+
for (let l = 0; l < e.length; l++) {
|
|
110
|
+
const s = e[l];
|
|
107
111
|
s === "[" || s === "<" || s === "(" ? (t.push(s), i += s) : s === "]" && t.length > 0 && t[t.length - 1] === "[" || s === ">" && t.length > 0 && t[t.length - 1] === "<" || s === ")" && t.length > 0 && t[t.length - 1] === "(" ? (t.pop(), i += s) : s === n && t.length === 0 ? (r.push(i.trim()), i = "") : i += s;
|
|
108
112
|
}
|
|
109
113
|
return i.trim() !== "" && r.push(i.trim()), r;
|
|
110
|
-
},
|
|
114
|
+
}, b = (e) => {
|
|
111
115
|
if (e)
|
|
112
116
|
if (e.startsWith("[") && e.endsWith("]") || e.startsWith("(") && e.endsWith(")")) {
|
|
113
117
|
const n = e.slice(1, -1).trim();
|
|
@@ -138,20 +142,20 @@ function q(e) {
|
|
|
138
142
|
return f(e, ",").map((t) => {
|
|
139
143
|
const r = t.trim(), i = t.match(/^([^:?]+)(\??):/);
|
|
140
144
|
if (!i) return null;
|
|
141
|
-
const
|
|
142
|
-
let
|
|
143
|
-
for (let
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
146
|
-
|
|
145
|
+
const l = i[1].trim(), s = !i[2], T = i[0].length, c = t.substring(T).trim();
|
|
146
|
+
let a = [], p = "", g = "";
|
|
147
|
+
for (let u = 0; u < c.length; u++) {
|
|
148
|
+
const o = c[u];
|
|
149
|
+
if (o === "[" || o === "<" || o === "(" ? a.push(o) : (o === "]" && a[a.length - 1] === "[" || o === ">" && a[a.length - 1] === "<" || o === ")" && a[a.length - 1] === "(") && a.pop(), a.length === 0 && u > 0) {
|
|
150
|
+
u == 1 && o !== "]" && o !== ">" && o !== ")" ? (p = "", g = c.substring(0)) : (p = c.substring(0, u + 1).trim(), g = c.substring(u + 1));
|
|
147
151
|
break;
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
|
-
const { type:
|
|
154
|
+
const { type: W, dataType: y } = b(p), $ = m(y);
|
|
151
155
|
return {
|
|
152
|
-
name:
|
|
153
|
-
prop:
|
|
154
|
-
type:
|
|
156
|
+
name: l,
|
|
157
|
+
prop: l,
|
|
158
|
+
type: $[0],
|
|
155
159
|
dataType: y,
|
|
156
160
|
must: s,
|
|
157
161
|
label: r,
|
|
@@ -160,16 +164,16 @@ function q(e) {
|
|
|
160
164
|
}).filter(Boolean);
|
|
161
165
|
}
|
|
162
166
|
export {
|
|
163
|
-
|
|
167
|
+
x as getFunBody,
|
|
164
168
|
M as getFunctionFormat,
|
|
165
|
-
|
|
166
|
-
|
|
169
|
+
F as getObjType,
|
|
170
|
+
m as getSonType,
|
|
167
171
|
C as getString,
|
|
168
|
-
|
|
172
|
+
O as getTypeValue,
|
|
169
173
|
N as isDefaultType,
|
|
170
174
|
L as isTypeEqual,
|
|
171
175
|
q as parseParamString,
|
|
172
|
-
|
|
176
|
+
b as parseTypeDefinition,
|
|
173
177
|
E as prettierArrFormat,
|
|
174
178
|
h as prettierFormat,
|
|
175
179
|
v as prettierObjFormat,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={name(e){return e.name?e.name.name:e.props?e.props.name:""},description(e){return e.description&&e.description.name?e.description.name:e.descriptions?e.descriptions:e.props?e.props.description:""},type(e){return e.type?e.type.name:e.props?e.props.type:""},selectable(e){return e.selectable?e.selectable.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={name(e){return e.name?e.name.name+e.name.description:e.props?e.props.name:""},description(e){return e.description&&e.description.name?e.description.name+e.description.description:e.descriptions?e.descriptions:e.props?e.props.description:""},type(e){return e.type?e.type.type||e.type.name+e.type.description:e.props?e.props.type:""},selectable(e){return e.selectable?e.selectable.name+e.selectable.description:e.props?e.props.selectable:""},default(e){return e.default?e.default.name+e.default.description:e.props&&e.props.default||""},return(e){if(e.return){let r=e.return.type;return r&&(r=`[${r}]`),r+(e.return.name+e.return.description)}else return e.props?e.props.return:""},required(e){return e.required?e.required.name+e.required.description:e.props?e.props.required:""}},i={name(e){return e.name?e.name.name+e.name.description:e.emits?e.emits.name:""},description(e){return e.description&&e.description.name?e.description.name+e.description.description:e.descriptions?e.descriptions:e.emits?e.emits.description:""},selectable(e){return e.selectable?e.selectable.name+e.selectable.description:e.emits?e.emits.selectable:""}},p={name(e){return e.name?e.name.name+e.name.description:e.expose?e.expose.name:""},description(e){return e.description&&e.description.name?e.description.name+e.description.description:e.descriptions?e.descriptions:e.expose?e.expose.description:""},selectable(e){return e.selectable?e.selectable.name+e.selectable.description:e.expose?e.expose.selectable:""},type(e){return e.type?e.type.type||e.type.name+e.type.description:e.expose?e.expose.type:""},return(e){if(e.return){let r=e.return.type;return r&&(r=`[${r}]`),r+(e.return.name+e.return.description)}else return e.expose?e.expose.return:""}},l={name(e){return e.name?e.name.name+e.name.description:e.slot?e.slot.name:""},description(e){return e.description&&e.description.name?e.description.name+e.description.description:e.descriptions?e.descriptions:e.slot?e.slot.description:""},selectable(e){return e.selectable?e.selectable.name+e.selectable.description:e.slot?e.slot.selectable:""}};function u(e){return e.map(r=>{const t={};return Object.keys(s).forEach(n=>{t[n]=s[n](r)}),t})}function c(e){return e.map(r=>{const t={};return Object.keys(i).forEach(n=>{t[n]=i[n](r)}),t})}function a(e){return e.map(r=>{const t={};return Object.keys(p).forEach(n=>{t[n]=p[n](r)}),t})}function d(e){return e.map(r=>{const t={};return Object.keys(l).forEach(n=>{t[n]=l[n](r)}),t})}exports.emits=i;exports.expose=p;exports.getEmitsValue=c;exports.getExposeValue=a;exports.getPropsValue=u;exports.getSlotValue=d;exports.props=s;exports.slot=l;
|
|
@@ -1,63 +1,66 @@
|
|
|
1
1
|
const s = {
|
|
2
2
|
name(e) {
|
|
3
|
-
return e.name ? e.name.name : e.props ? e.props.name : "";
|
|
3
|
+
return e.name ? e.name.name + e.name.description : e.props ? e.props.name : "";
|
|
4
4
|
},
|
|
5
5
|
description(e) {
|
|
6
|
-
return e.description && e.description.name ? e.description.name : e.descriptions ? e.descriptions : e.props ? e.props.description : "";
|
|
6
|
+
return e.description && e.description.name ? e.description.name + e.description.description : e.descriptions ? e.descriptions : e.props ? e.props.description : "";
|
|
7
7
|
},
|
|
8
8
|
type(e) {
|
|
9
|
-
return e.type ? e.type.name : e.props ? e.props.type : "";
|
|
9
|
+
return e.type ? e.type.type || e.type.name + e.type.description : e.props ? e.props.type : "";
|
|
10
10
|
},
|
|
11
11
|
selectable(e) {
|
|
12
|
-
return e.selectable ? e.selectable.
|
|
12
|
+
return e.selectable ? e.selectable.name + e.selectable.description : e.props ? e.props.selectable : "";
|
|
13
13
|
},
|
|
14
14
|
default(e) {
|
|
15
|
-
return e.default ? e.default.
|
|
15
|
+
return e.default ? e.default.name + e.default.description : e.props && e.props.default || "";
|
|
16
16
|
},
|
|
17
17
|
return(e) {
|
|
18
18
|
if (e.return) {
|
|
19
19
|
let r = e.return.type;
|
|
20
|
-
return r && (r = `[${r}]`), r + (e.return.
|
|
20
|
+
return r && (r = `[${r}]`), r + (e.return.name + e.return.description);
|
|
21
21
|
} else return e.props ? e.props.return : "";
|
|
22
|
+
},
|
|
23
|
+
required(e) {
|
|
24
|
+
return e.required ? e.required.name + e.required.description : e.props ? e.props.required : "";
|
|
22
25
|
}
|
|
23
26
|
}, i = {
|
|
24
27
|
name(e) {
|
|
25
|
-
return e.name ? e.name.name : e.emits ? e.emits.name : "";
|
|
28
|
+
return e.name ? e.name.name + e.name.description : e.emits ? e.emits.name : "";
|
|
26
29
|
},
|
|
27
30
|
description(e) {
|
|
28
|
-
return e.description && e.description.name ? e.description.name : e.descriptions ? e.descriptions : e.emits ? e.emits.description : "";
|
|
31
|
+
return e.description && e.description.name ? e.description.name + e.description.description : e.descriptions ? e.descriptions : e.emits ? e.emits.description : "";
|
|
29
32
|
},
|
|
30
33
|
selectable(e) {
|
|
31
|
-
return e.selectable ? e.selectable.
|
|
34
|
+
return e.selectable ? e.selectable.name + e.selectable.description : e.emits ? e.emits.selectable : "";
|
|
32
35
|
}
|
|
33
|
-
},
|
|
36
|
+
}, p = {
|
|
34
37
|
name(e) {
|
|
35
|
-
return e.name ? e.name.name : e.expose ? e.expose.name : "";
|
|
38
|
+
return e.name ? e.name.name + e.name.description : e.expose ? e.expose.name : "";
|
|
36
39
|
},
|
|
37
40
|
description(e) {
|
|
38
|
-
return e.description && e.description.name ? e.description.name : e.descriptions ? e.descriptions : e.expose ? e.expose.description : "";
|
|
41
|
+
return e.description && e.description.name ? e.description.name + e.description.description : e.descriptions ? e.descriptions : e.expose ? e.expose.description : "";
|
|
39
42
|
},
|
|
40
43
|
selectable(e) {
|
|
41
|
-
return e.selectable ? e.selectable.
|
|
44
|
+
return e.selectable ? e.selectable.name + e.selectable.description : e.expose ? e.expose.selectable : "";
|
|
42
45
|
},
|
|
43
46
|
type(e) {
|
|
44
|
-
return e.type ? e.type.
|
|
47
|
+
return e.type ? e.type.type || e.type.name + e.type.description : e.expose ? e.expose.type : "";
|
|
45
48
|
},
|
|
46
49
|
return(e) {
|
|
47
50
|
if (e.return) {
|
|
48
51
|
let r = e.return.type;
|
|
49
|
-
return r && (r = `[${r}]`), r + (e.return.
|
|
52
|
+
return r && (r = `[${r}]`), r + (e.return.name + e.return.description);
|
|
50
53
|
} else return e.expose ? e.expose.return : "";
|
|
51
54
|
}
|
|
52
|
-
},
|
|
55
|
+
}, l = {
|
|
53
56
|
name(e) {
|
|
54
|
-
return e.name ? e.name.name : e.slot ? e.slot.name : "";
|
|
57
|
+
return e.name ? e.name.name + e.name.description : e.slot ? e.slot.name : "";
|
|
55
58
|
},
|
|
56
59
|
description(e) {
|
|
57
|
-
return e.description && e.description.name ? e.description.name : e.descriptions ? e.descriptions : e.slot ? e.slot.description : "";
|
|
60
|
+
return e.description && e.description.name ? e.description.name + e.description.description : e.descriptions ? e.descriptions : e.slot ? e.slot.description : "";
|
|
58
61
|
},
|
|
59
62
|
selectable(e) {
|
|
60
|
-
return e.selectable ? e.selectable.
|
|
63
|
+
return e.selectable ? e.selectable.name + e.selectable.description : e.slot ? e.slot.selectable : "";
|
|
61
64
|
}
|
|
62
65
|
};
|
|
63
66
|
function u(e) {
|
|
@@ -79,26 +82,26 @@ function c(e) {
|
|
|
79
82
|
function a(e) {
|
|
80
83
|
return e.map((r) => {
|
|
81
84
|
const t = {};
|
|
82
|
-
return Object.keys(
|
|
83
|
-
t[n] =
|
|
85
|
+
return Object.keys(p).forEach((n) => {
|
|
86
|
+
t[n] = p[n](r);
|
|
84
87
|
}), t;
|
|
85
88
|
});
|
|
86
89
|
}
|
|
87
|
-
function
|
|
90
|
+
function d(e) {
|
|
88
91
|
return e.map((r) => {
|
|
89
92
|
const t = {};
|
|
90
|
-
return Object.keys(
|
|
91
|
-
t[n] =
|
|
93
|
+
return Object.keys(l).forEach((n) => {
|
|
94
|
+
t[n] = l[n](r);
|
|
92
95
|
}), t;
|
|
93
96
|
});
|
|
94
97
|
}
|
|
95
98
|
export {
|
|
96
99
|
i as emits,
|
|
97
|
-
|
|
100
|
+
p as expose,
|
|
98
101
|
c as getEmitsValue,
|
|
99
102
|
a as getExposeValue,
|
|
100
103
|
u as getPropsValue,
|
|
101
|
-
|
|
104
|
+
d as getSlotValue,
|
|
102
105
|
s as props,
|
|
103
|
-
|
|
106
|
+
l as slot
|
|
104
107
|
};
|