@fangzhongya/vue-archive 0.0.19 → 0.0.21
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 +110 -58
- package/dist/node/index.js +110 -58
- package/dist/packages/components/compo/index.vue.cjs +1 -1
- package/dist/packages/components/compo/index.vue.js +42 -50
- package/dist/packages/components/use/code.cjs +11 -10
- package/dist/packages/components/use/code.js +128 -111
- package/dist/packages/components/use/index.cjs +1 -1
- package/dist/packages/components/use/index.js +25 -25
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.d.ts +1 -0
- package/dist/packages/components/use/util.js +49 -27
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)}function
|
|
3
|
-
|\r)+?)\\}[\\s|\\n|\\r]*`,n=new RegExp("^"+t+"$").exec(e);return n&&n.length>0?
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@fangzhongya/utils/basic/string/toFunction"),b=require("@fangzhongya/utils/basic/string/firstLower");function u(e){return e.replace(/\;(\s|\n\r)*$/,"")}function m(e){return e="let a = "+e,u(e).replace(/^let a = /,"")}function d(e){return u(e)}function j(e,t=""){let r=(e+"").trim().split(/\n/);return r=r.map(n=>t+n),r.join(`
|
|
2
|
+
`)}function a(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?a(n[1]):e}const T=["Boolean","Any","String","Number","Array","Object","Function"];function f(e){return T.includes(e)?b.firstLower(e):e}function F(e){let r=new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);if(r&&r.length>0)return{own:f(r[1]),son:r[2]}}function c(e,t){let r=F(e);r?(t.push(r.own),r.son&&c(r.son,t)):t.push(e)}function l(e){e instanceof Array&&(e=e[0]);const t=[];return e&&c(e,t),t}function p(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 $(e,t){const r=p(e),n=l(t)[0];return n&&n!="any"?r==n:!0}function O(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 g(e){switch((e[0]||"any").toLowerCase()){case"string":return'""';case"boolean":return"false";case"number":return"0";case"array":let r=g(e.splice(1));return r=r=="undefined"?"":r,`[${r}]`;case"object":return"{}";case"function":return"()=>{}";case"any":return'""';default:return"undefined"}}function h(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=>f(r))}function w(e){return e.join("|")}function S(e){return e.split(",").map(r=>{let n=r.split(":"),i=n[0].trim(),o=n[1]||"",s=l(h(o));return{label:r,prop:i,type:s[0],dataType:s,description:o.substring(o.lastIndexOf("]")+1)}})}Object.defineProperty(exports,"getFunctionFormat",{enumerable:!0,get:()=>y.getFunctionFormat});exports.getFunBody=a;exports.getObjType=p;exports.getParametersObj=S;exports.getSonType=l;exports.getString=O;exports.getTypeValue=g;exports.isDefaultType=v;exports.isTypeEqual=$;exports.prettierArrFormat=d;exports.prettierFormat=u;exports.prettierObjFormat=m;exports.setDataType=w;exports.vueFormat=j;
|
|
@@ -35,6 +35,7 @@ export declare function getString(st: unknown): string;
|
|
|
35
35
|
* 配置字符串的类型
|
|
36
36
|
*/
|
|
37
37
|
export declare function isDefaultType(st: string): string;
|
|
38
|
+
export declare function getTypeValue(arr: string[]): string;
|
|
38
39
|
export declare function setDataType(arr: string[]): string;
|
|
39
40
|
export declare function getParametersObj(cs: string): {
|
|
40
41
|
label: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { getFunctionFormat as
|
|
1
|
+
import { getFunctionFormat as E } from "@fangzhongya/utils/basic/string/toFunction";
|
|
2
2
|
import { firstLower as c } from "@fangzhongya/utils/basic/string/firstLower";
|
|
3
3
|
function u(e) {
|
|
4
4
|
return e.replace(/\;(\s|\n\r)*$/, "");
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function j(e) {
|
|
7
7
|
return e = "let a = " + e, u(e).replace(/^let a = /, "");
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function T(e) {
|
|
10
10
|
return u(e);
|
|
11
11
|
}
|
|
12
12
|
function x(e, t = "") {
|
|
@@ -29,47 +29,68 @@ const g = [
|
|
|
29
29
|
"Object",
|
|
30
30
|
"Function"
|
|
31
31
|
];
|
|
32
|
-
function
|
|
32
|
+
function s(e) {
|
|
33
33
|
return g.includes(e) ? c(e) : e;
|
|
34
34
|
}
|
|
35
35
|
function y(e) {
|
|
36
36
|
let n = new RegExp("^([a-z|A-Z]+)\\<(.+)\\>$").exec(e);
|
|
37
37
|
if (n && n.length > 0)
|
|
38
38
|
return {
|
|
39
|
-
own:
|
|
39
|
+
own: s(n[1]),
|
|
40
40
|
son: n[2]
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function f(e, t) {
|
|
44
44
|
let n = y(e);
|
|
45
|
-
n ? (t.push(n.own), n.son &&
|
|
45
|
+
n ? (t.push(n.own), n.son && f(n.son, t)) : t.push(e);
|
|
46
46
|
}
|
|
47
47
|
function a(e) {
|
|
48
48
|
e instanceof Array && (e = e[0]);
|
|
49
49
|
const t = [];
|
|
50
|
-
return e &&
|
|
50
|
+
return e && f(e, t), t;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function b(e) {
|
|
53
53
|
const t = Object.prototype.toString.call(e);
|
|
54
54
|
let r = /^\[[O|o]bject (.*)\]$/.exec(t), i = typeof e;
|
|
55
55
|
return r && r.length > 0 && (i = r[1].toLowerCase()), i;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const n =
|
|
57
|
+
function h(e, t) {
|
|
58
|
+
const n = b(e), r = a(t)[0];
|
|
59
59
|
return r && r != "any" ? n == r : !0;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function v(e) {
|
|
62
62
|
if (typeof e == "string") {
|
|
63
63
|
let t = !1;
|
|
64
64
|
return (/^\'(.|\n|\r)*\'$/.test(e) || /^\"(.|\n|\r)*\"$/.test(e) || /^\`(.|\n|\r)*\`$/.test(e)) && (t = !0), t && (e = e.substring(1, e.length - 1)), e + "";
|
|
65
65
|
} else return typeof e == "object" && e ? e.toString() : typeof e > "u" || typeof e == "object" && !e ? "" : e + "";
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function w(e) {
|
|
68
68
|
e = (e + "").replace(/^(\s|\n|r)*/, "").replace(/(\s|\n|r)*$/, "");
|
|
69
69
|
let t = "";
|
|
70
70
|
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;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function m(e) {
|
|
73
|
+
switch ((e[0] || "any").toLowerCase()) {
|
|
74
|
+
case "string":
|
|
75
|
+
return '""';
|
|
76
|
+
case "boolean":
|
|
77
|
+
return "false";
|
|
78
|
+
case "number":
|
|
79
|
+
return "0";
|
|
80
|
+
case "array":
|
|
81
|
+
let n = m(e.splice(1));
|
|
82
|
+
return n = n == "undefined" ? "" : n, `[${n}]`;
|
|
83
|
+
case "object":
|
|
84
|
+
return "{}";
|
|
85
|
+
case "function":
|
|
86
|
+
return "()=>{}";
|
|
87
|
+
case "any":
|
|
88
|
+
return '""';
|
|
89
|
+
default:
|
|
90
|
+
return "undefined";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function d(e) {
|
|
73
94
|
let t = [];
|
|
74
95
|
if (e)
|
|
75
96
|
if (e = (e + "").trim(), e.startsWith("["))
|
|
@@ -80,14 +101,14 @@ function b(e) {
|
|
|
80
101
|
}
|
|
81
102
|
else
|
|
82
103
|
t = ["any"];
|
|
83
|
-
return t.map((n) =>
|
|
104
|
+
return t.map((n) => s(n));
|
|
84
105
|
}
|
|
85
|
-
function
|
|
106
|
+
function F(e) {
|
|
86
107
|
return e.join("|");
|
|
87
108
|
}
|
|
88
|
-
function
|
|
109
|
+
function O(e) {
|
|
89
110
|
return e.split(",").map((n) => {
|
|
90
|
-
let r = n.split(":"), i = r[0], l = r[1] || "", o = a(
|
|
111
|
+
let r = n.split(":"), i = r[0].trim(), l = r[1] || "", o = a(d(l));
|
|
91
112
|
return {
|
|
92
113
|
label: n,
|
|
93
114
|
prop: i,
|
|
@@ -99,16 +120,17 @@ function v(e) {
|
|
|
99
120
|
}
|
|
100
121
|
export {
|
|
101
122
|
p as getFunBody,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
123
|
+
E as getFunctionFormat,
|
|
124
|
+
b as getObjType,
|
|
125
|
+
O as getParametersObj,
|
|
105
126
|
a as getSonType,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
v as getString,
|
|
128
|
+
m as getTypeValue,
|
|
129
|
+
w as isDefaultType,
|
|
130
|
+
h as isTypeEqual,
|
|
131
|
+
T as prettierArrFormat,
|
|
110
132
|
u as prettierFormat,
|
|
111
|
-
|
|
112
|
-
|
|
133
|
+
j as prettierObjFormat,
|
|
134
|
+
F as setDataType,
|
|
113
135
|
x as vueFormat
|
|
114
136
|
};
|