@fangzhongya/vue-archive 0.1.9 → 0.1.10
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 +12 -6
- package/dist/node/index.js +12 -6
- package/dist/packages/components/use/code.d.ts +25 -18
- package/dist/packages/utils/annotat.cjs +1 -1
- package/dist/packages/utils/annotat.js +112 -111
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -2791,16 +2791,22 @@ function getObj(v) {
|
|
|
2791
2791
|
} else if (tag == "selectable") {
|
|
2792
2792
|
name = name.trim();
|
|
2793
2793
|
} else {
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
const
|
|
2794
|
+
const i = v.name.indexOf("=");
|
|
2795
|
+
if (i != -1) {
|
|
2796
|
+
const ms1 = name.substring(0, i);
|
|
2797
|
+
const ms2 = name.substring(i + 1);
|
|
2798
|
+
name = ms1;
|
|
2799
|
+
const ss = ms2 + " " + description;
|
|
2798
2800
|
const dvz = getDefault(ss, true);
|
|
2799
2801
|
if (dvz) {
|
|
2800
|
-
defaults = dvz;
|
|
2801
2802
|
description = ss.replace(dvz, "");
|
|
2803
|
+
if (dvz.startsWith("(")) {
|
|
2804
|
+
defaults = dvz.substring(1, dvz.length - 1);
|
|
2805
|
+
} else {
|
|
2806
|
+
defaults = dvz;
|
|
2807
|
+
}
|
|
2802
2808
|
} else {
|
|
2803
|
-
defaults = v.default ||
|
|
2809
|
+
defaults = v.default || ms2 || "";
|
|
2804
2810
|
}
|
|
2805
2811
|
}
|
|
2806
2812
|
const regExp = /\s*\((.*)\)\s*/gi;
|
package/dist/node/index.js
CHANGED
|
@@ -2773,16 +2773,22 @@ function getObj(v) {
|
|
|
2773
2773
|
} else if (tag == "selectable") {
|
|
2774
2774
|
name = name.trim();
|
|
2775
2775
|
} else {
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
const
|
|
2776
|
+
const i = v.name.indexOf("=");
|
|
2777
|
+
if (i != -1) {
|
|
2778
|
+
const ms1 = name.substring(0, i);
|
|
2779
|
+
const ms2 = name.substring(i + 1);
|
|
2780
|
+
name = ms1;
|
|
2781
|
+
const ss = ms2 + " " + description;
|
|
2780
2782
|
const dvz = getDefault(ss, true);
|
|
2781
2783
|
if (dvz) {
|
|
2782
|
-
defaults = dvz;
|
|
2783
2784
|
description = ss.replace(dvz, "");
|
|
2785
|
+
if (dvz.startsWith("(")) {
|
|
2786
|
+
defaults = dvz.substring(1, dvz.length - 1);
|
|
2787
|
+
} else {
|
|
2788
|
+
defaults = dvz;
|
|
2789
|
+
}
|
|
2784
2790
|
} else {
|
|
2785
|
-
defaults = v.default ||
|
|
2791
|
+
defaults = v.default || ms2 || "";
|
|
2786
2792
|
}
|
|
2787
2793
|
}
|
|
2788
2794
|
const regExp = /\s*\((.*)\)\s*/gi;
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from '../../../vue/dist/vue.esm-bundler.js';
|
|
2
|
+
declare const _default: DefineComponent<ExtractPropTypes<{
|
|
3
|
+
name: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
html: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
default(): string;
|
|
9
|
+
};
|
|
10
|
+
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
11
|
+
refresh: (...args: any[]) => void;
|
|
12
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
13
|
+
name: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
};
|
|
16
|
+
html: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default(): string;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{
|
|
21
|
+
onRefresh?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
html: string;
|
|
24
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
25
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("comment-parser"),q=require("@fangzhongya/utils/basic/string/firstLower"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("comment-parser"),q=require("@fangzhongya/utils/basic/string/firstLower"),p={titles:[],propss:[],slots:[],emitss:[],exposes:[]};function w(){Object.keys(p).forEach(e=>{p[e]=[]})}function S(e,r){let t=e.charAt(0),n=[['"','"'],["'","'"],["`","`"],["(",")"],["{","}"],["[","]"]];const s=n.map(i=>i[0]);let l=s.indexOf(t);if(l!=-1){let i=[t];for(let o=1;o<e.length;o++){if(t=e[o],l=s.indexOf(t),l!=-1)l>2?i.push(t):i[i.length-1]===t?i.pop():i.push(t);else{let u=!1;for(let a of n)if(t===a[1]&&i[i.length-1]===a[0]){u=!0;break}u&&i.pop()}if(i.length===0)return r&&e[o+1]===" ",e.substring(0,o+1)}}else return r?e.substring(0,e.indexOf(" ")):e}function A(e){delete e.problems,delete e.source;let r=e.tag,t=e.name,n=e.description,s=e.default,l="",i="";if(r=="default")t=t.trim(),t=S(t)||t;else if(r=="selectable")t=t.trim();else{const o=e.name.indexOf("=");if(o!=-1){const m=t.substring(0,o),d=t.substring(o+1);t=m;const T=d+" "+n,f=S(T,!0);f?(n=T.replace(f,""),f.startsWith("(")?s=f.substring(1,f.length-1):s=f):s=e.default||d||""}const a=/\s*\((.*)\)\s*/gi.exec(n);a&&a.length>0&&(l=a[1],n=n.replace(a[0],""))}return t.endsWith("*")&&(i="*",t=t.substring(0,t.length-1)),e.name=t,e.required=i,e.default=s||"",e.description=n,e.selectable=l,e}function P(e){let r=["title","text","author","date"],t=b(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),E(n),t.arr.forEach(s=>{y(s.key,s.value)})}function E(e){p.titles.push(e)}function v(e){let r=["props","name","type","default","required","selectable","description","descriptions","model","return"],t=b(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),g(n,"props"),t.arr.forEach(s=>{y(s.key,s.value)})}function F(e){let r=["slot","name","selectable","description","descriptions"],t=b(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),g(n,"slot"),t.arr.forEach(s=>{y(s.key,s.value)})}function B(e){let r=["emits","name","selectable","description","descriptions"],t=b(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),g(n,"emits"),t.arr.forEach(s=>{y(s.key,s.value)})}function I(e){let r=["expose","name","type","return","selectable","description","descriptions"],t=b(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),g(n,"expose"),t.arr.forEach(s=>{y(s.key,s.value)})}function g(e,r){const t=p[r+"name"]||[],n=e.name??e[r]?.name,s=t.indexOf(n);s>=0&&(p[r+"s"].splice(s,1),t.splice(s,1)),p[r+"s"].push(e),t.push(n),p[r+"name"]=t}function b(e,r){const t={descriptions:e?.description||""},n=[];return e?.tags&&e.tags?.forEach(s=>{let l=s.tag,i=A(s);if(!t.hasOwnProperty(l))t[l]=i;else{const o={};o[l]=i,n.push({key:l,value:o})}}),{arr:n,obj:t}}function y(e,r){switch(e){case"title":return E(r),!0;case"text":return E(r),!0;case"props":return g(r,"props"),!0;case"slot":return g(r,"slot"),!0;case"emits":return g(r,"emits"),!0;case"expose":return g(r,"expose"),!0;default:return!1}}function J(e,r){switch(e){case"title":return P(r),!0;case"props":return v(r),!0;case"slot":return F(r),!0;case"emits":return B(r),!0;case"expose":return I(r),!0;default:return!1}}function L(e){return w(),e?.forEach(r=>{let t=r?.tags||[],n=t?.length||0;if(n>0)for(let s=0;s<n;s++){const l=t[s]||{};if(J(l.tag,r))break}}),JSON.parse(JSON.stringify(p))}function W(e){if(e)return j.parse(e)}function M(e){let r=W(e);return L(r)}const z=["Boolean","Any","String","Number","Array","Object","Function"];function _(e){return z.includes(e)?q.firstLower(e):e}const C=e=>{let r=[],t=!1,n=!1,s=0;for(let l=0;l<e.length;l++){const i=e[l];if(i==="["||i==="<"||i==="("?(n=!0,r.push(i),i=="["&&(t=!0),s==0&&(s=l)):(i==="]"&&r[r.length-1]==="["||i===">"&&r[r.length-1]==="<"||i===")"&&r[r.length-1]==="(")&&r.pop(),n&&r.length===0)return t&&s+1==l?{top:"Array",type:e.substring(0,s)}:{top:e.substring(0,s),type:e.substring(s+1,l)}}return{top:e,type:""}},x=(e,r)=>{let t=[],n=[],s="";for(let l=0;l<e.length;l++){const i=e[l];i==="["||i==="<"||i==="("?(t.push(i),s+=i):i==="]"&&t.length>0&&t[t.length-1]==="["||i===">"&&t.length>0&&t[t.length-1]==="<"||i===")"&&t.length>0&&t[t.length-1]==="("?(t.pop(),s+=i):i===r&&t.length===0?(n.push(s.trim()),s=""):s+=i}return s.trim()!==""&&n.push(s.trim()),n};function G(e){let r="";return typeof e=="string"?r=e:r=e.value,_(r||"any")}function N(e){const r=e[0]||"any";return G(r)}const O=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const r=e.slice(1,-1).trim();return r?x(r,","):["any"]}else{if(e.startsWith("{")&&e.endsWith("}"))return["Object"];if(e.startsWith("<")&&e.endsWith(">")){const r=e.slice(1,-1).trim();return r?x(r,"|"):["any"]}else return x(e,",")}else return["any"]};function k(e){const r=[];return e.forEach(t=>{const n=C(t);if(n.type){const s=O(n.type),l=k(s);r.push({label:t,value:n.top,children:l})}else r.push(n.top)}),r}function H(e){return x(e,",").map(t=>{const n=t.trim(),s=t.match(/^([^:?]+)(\??):/);if(!s)return null;const l=s[1].trim(),i=!s[2],o=s[0].length,u=t.substring(o).trim();let a=[],m="",d="";for(let h=0;h<u.length;h++){const c=u[h];if(c==="["||c==="<"||c==="("||c==="{"?a.push(c):(c==="]"&&a[a.length-1]==="["||c===">"&&a[a.length-1]==="<"||c==="}"&&a[a.length-1]==="{"||c===")"&&a[a.length-1]==="(")&&a.pop(),a.length===0&&h>0){h==1&&c!=="]"&&c!==">"&&c!=="}"&&c!==")"?(m="",d=u.substring(0)):(m=u.substring(0,h+1).trim(),d=u.substring(h+1));break}}const T=O(m),f=k(T);return{name:l,prop:l,type:N(f),dataType:f,must:i,label:n,description:d}}).filter(Boolean)}exports.getDataType=k;exports.getDataTypeType=N;exports.getNotesText=M;exports.getTextNotes=W;exports.parseParamString=H;exports.parseTypeDefinition=O;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse as W } from "comment-parser";
|
|
2
2
|
import { firstLower as j } from "@fangzhongya/utils/basic/string/firstLower";
|
|
3
|
-
const
|
|
3
|
+
const p = {
|
|
4
4
|
titles: [],
|
|
5
5
|
propss: [],
|
|
6
6
|
slots: [],
|
|
@@ -8,12 +8,12 @@ const f = {
|
|
|
8
8
|
exposes: []
|
|
9
9
|
};
|
|
10
10
|
function N() {
|
|
11
|
-
Object.keys(
|
|
12
|
-
|
|
11
|
+
Object.keys(p).forEach((e) => {
|
|
12
|
+
p[e] = [];
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
let t = e.charAt(0),
|
|
15
|
+
function O(e, r) {
|
|
16
|
+
let t = e.charAt(0), n = [
|
|
17
17
|
['"', '"'],
|
|
18
18
|
["'", "'"],
|
|
19
19
|
["`", "`"],
|
|
@@ -21,46 +21,47 @@ function T(e, r) {
|
|
|
21
21
|
["{", "}"],
|
|
22
22
|
["[", "]"]
|
|
23
23
|
];
|
|
24
|
-
const
|
|
25
|
-
let l =
|
|
24
|
+
const s = n.map((i) => i[0]);
|
|
25
|
+
let l = s.indexOf(t);
|
|
26
26
|
if (l != -1) {
|
|
27
27
|
let i = [t];
|
|
28
|
-
for (let
|
|
29
|
-
if (t = e[
|
|
28
|
+
for (let o = 1; o < e.length; o++) {
|
|
29
|
+
if (t = e[o], l = s.indexOf(t), l != -1)
|
|
30
30
|
l > 2 ? i.push(t) : i[i.length - 1] === t ? i.pop() : i.push(t);
|
|
31
31
|
else {
|
|
32
|
-
let
|
|
33
|
-
for (let a of
|
|
32
|
+
let u = !1;
|
|
33
|
+
for (let a of n)
|
|
34
34
|
if (t === a[1] && i[i.length - 1] === a[0]) {
|
|
35
|
-
|
|
35
|
+
u = !0;
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
u && i.pop();
|
|
39
39
|
}
|
|
40
40
|
if (i.length === 0)
|
|
41
|
-
return r && e[
|
|
41
|
+
return r && e[o + 1] === " ", e.substring(0, o + 1);
|
|
42
42
|
}
|
|
43
43
|
} else
|
|
44
44
|
return r ? e.substring(0, e.indexOf(" ")) : e;
|
|
45
45
|
}
|
|
46
46
|
function A(e) {
|
|
47
47
|
delete e.problems, delete e.source;
|
|
48
|
-
let r = e.tag, t = e.name,
|
|
48
|
+
let r = e.tag, t = e.name, n = e.description, s = e.default, l = "", i = "";
|
|
49
49
|
if (r == "default")
|
|
50
|
-
t = t.trim(), t =
|
|
50
|
+
t = t.trim(), t = O(t) || t;
|
|
51
51
|
else if (r == "selectable")
|
|
52
52
|
t = t.trim();
|
|
53
53
|
else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
t =
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
const o = e.name.indexOf("=");
|
|
55
|
+
if (o != -1) {
|
|
56
|
+
const m = t.substring(0, o), d = t.substring(o + 1);
|
|
57
|
+
t = m;
|
|
58
|
+
const x = d + " " + n, f = O(x, !0);
|
|
59
|
+
f ? (n = x.replace(f, ""), f.startsWith("(") ? s = f.substring(1, f.length - 1) : s = f) : s = e.default || d || "";
|
|
59
60
|
}
|
|
60
|
-
const
|
|
61
|
-
|
|
61
|
+
const a = /\s*\((.*)\)\s*/gi.exec(n);
|
|
62
|
+
a && a.length > 0 && (l = a[1], n = n.replace(a[0], ""));
|
|
62
63
|
}
|
|
63
|
-
return t.endsWith("*") && (i = "*", t = t.substring(0, t.length - 1)), e.name = t, e.required = i, e.default =
|
|
64
|
+
return t.endsWith("*") && (i = "*", t = t.substring(0, t.length - 1)), e.name = t, e.required = i, e.default = s || "", e.description = n, e.selectable = l, e;
|
|
64
65
|
}
|
|
65
66
|
function w(e) {
|
|
66
67
|
let r = [
|
|
@@ -71,15 +72,15 @@ function w(e) {
|
|
|
71
72
|
"date"
|
|
72
73
|
// 'description',
|
|
73
74
|
// 'descriptions',
|
|
74
|
-
], t =
|
|
75
|
-
r.forEach((
|
|
76
|
-
s
|
|
77
|
-
}),
|
|
78
|
-
|
|
75
|
+
], t = b(e), n = {};
|
|
76
|
+
r.forEach((s) => {
|
|
77
|
+
n[s] = t.obj[s];
|
|
78
|
+
}), T(n), t.arr.forEach((s) => {
|
|
79
|
+
y(s.key, s.value);
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
82
|
+
function T(e) {
|
|
83
|
+
p.titles.push(e);
|
|
83
84
|
}
|
|
84
85
|
function q(e) {
|
|
85
86
|
let r = [
|
|
@@ -93,27 +94,27 @@ function q(e) {
|
|
|
93
94
|
"descriptions",
|
|
94
95
|
"model",
|
|
95
96
|
"return"
|
|
96
|
-
], t =
|
|
97
|
-
r.forEach((
|
|
98
|
-
s
|
|
99
|
-
}),
|
|
100
|
-
|
|
97
|
+
], t = b(e), n = {};
|
|
98
|
+
r.forEach((s) => {
|
|
99
|
+
n[s] = t.obj[s];
|
|
100
|
+
}), h(n, "props"), t.arr.forEach((s) => {
|
|
101
|
+
y(s.key, s.value);
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
-
let r = ["slot", "name", "selectable", "description", "descriptions"], t =
|
|
105
|
-
r.forEach((
|
|
106
|
-
s
|
|
107
|
-
}),
|
|
108
|
-
|
|
104
|
+
function F(e) {
|
|
105
|
+
let r = ["slot", "name", "selectable", "description", "descriptions"], t = b(e), n = {};
|
|
106
|
+
r.forEach((s) => {
|
|
107
|
+
n[s] = t.obj[s];
|
|
108
|
+
}), h(n, "slot"), t.arr.forEach((s) => {
|
|
109
|
+
y(s.key, s.value);
|
|
109
110
|
});
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
-
let r = ["emits", "name", "selectable", "description", "descriptions"], t =
|
|
113
|
-
r.forEach((
|
|
114
|
-
s
|
|
115
|
-
}),
|
|
116
|
-
|
|
112
|
+
function v(e) {
|
|
113
|
+
let r = ["emits", "name", "selectable", "description", "descriptions"], t = b(e), n = {};
|
|
114
|
+
r.forEach((s) => {
|
|
115
|
+
n[s] = t.obj[s];
|
|
116
|
+
}), h(n, "emits"), t.arr.forEach((s) => {
|
|
117
|
+
y(s.key, s.value);
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
function B(e) {
|
|
@@ -125,51 +126,51 @@ function B(e) {
|
|
|
125
126
|
"selectable",
|
|
126
127
|
"description",
|
|
127
128
|
"descriptions"
|
|
128
|
-
], t =
|
|
129
|
-
r.forEach((
|
|
130
|
-
s
|
|
131
|
-
}),
|
|
132
|
-
|
|
129
|
+
], t = b(e), n = {};
|
|
130
|
+
r.forEach((s) => {
|
|
131
|
+
n[s] = t.obj[s];
|
|
132
|
+
}), h(n, "expose"), t.arr.forEach((s) => {
|
|
133
|
+
y(s.key, s.value);
|
|
133
134
|
});
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
-
const t =
|
|
137
|
-
|
|
136
|
+
function h(e, r) {
|
|
137
|
+
const t = p[r + "name"] || [], n = e.name ?? e[r]?.name, s = t.indexOf(n);
|
|
138
|
+
s >= 0 && (p[r + "s"].splice(s, 1), t.splice(s, 1)), p[r + "s"].push(e), t.push(n), p[r + "name"] = t;
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
+
function b(e, r) {
|
|
140
141
|
const t = {
|
|
141
142
|
descriptions: e?.description || ""
|
|
142
|
-
},
|
|
143
|
-
return e?.tags && e.tags?.forEach((
|
|
144
|
-
let l =
|
|
143
|
+
}, n = [];
|
|
144
|
+
return e?.tags && e.tags?.forEach((s) => {
|
|
145
|
+
let l = s.tag, i = A(s);
|
|
145
146
|
if (!t.hasOwnProperty(l))
|
|
146
147
|
t[l] = i;
|
|
147
148
|
else {
|
|
148
|
-
const
|
|
149
|
-
|
|
149
|
+
const o = {};
|
|
150
|
+
o[l] = i, n.push({
|
|
150
151
|
key: l,
|
|
151
|
-
value:
|
|
152
|
+
value: o
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
}), {
|
|
155
|
-
arr:
|
|
156
|
+
arr: n,
|
|
156
157
|
obj: t
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
+
function y(e, r) {
|
|
160
161
|
switch (e) {
|
|
161
162
|
case "title":
|
|
162
|
-
return
|
|
163
|
+
return T(r), !0;
|
|
163
164
|
case "text":
|
|
164
|
-
return
|
|
165
|
+
return T(r), !0;
|
|
165
166
|
case "props":
|
|
166
|
-
return
|
|
167
|
+
return h(r, "props"), !0;
|
|
167
168
|
case "slot":
|
|
168
|
-
return
|
|
169
|
+
return h(r, "slot"), !0;
|
|
169
170
|
case "emits":
|
|
170
|
-
return
|
|
171
|
+
return h(r, "emits"), !0;
|
|
171
172
|
case "expose":
|
|
172
|
-
return
|
|
173
|
+
return h(r, "expose"), !0;
|
|
173
174
|
default:
|
|
174
175
|
return !1;
|
|
175
176
|
}
|
|
@@ -181,9 +182,9 @@ function I(e, r) {
|
|
|
181
182
|
case "props":
|
|
182
183
|
return q(r), !0;
|
|
183
184
|
case "slot":
|
|
184
|
-
return v(r), !0;
|
|
185
|
-
case "emits":
|
|
186
185
|
return F(r), !0;
|
|
186
|
+
case "emits":
|
|
187
|
+
return v(r), !0;
|
|
187
188
|
case "expose":
|
|
188
189
|
return B(r), !0;
|
|
189
190
|
default:
|
|
@@ -192,14 +193,14 @@ function I(e, r) {
|
|
|
192
193
|
}
|
|
193
194
|
function J(e) {
|
|
194
195
|
return N(), e?.forEach((r) => {
|
|
195
|
-
let t = r?.tags || [],
|
|
196
|
-
if (
|
|
197
|
-
for (let
|
|
198
|
-
const l = t[
|
|
196
|
+
let t = r?.tags || [], n = t?.length || 0;
|
|
197
|
+
if (n > 0)
|
|
198
|
+
for (let s = 0; s < n; s++) {
|
|
199
|
+
const l = t[s] || {};
|
|
199
200
|
if (I(l.tag, r))
|
|
200
201
|
break;
|
|
201
202
|
}
|
|
202
|
-
}), JSON.parse(JSON.stringify(
|
|
203
|
+
}), JSON.parse(JSON.stringify(p));
|
|
203
204
|
}
|
|
204
205
|
function z(e) {
|
|
205
206
|
if (e)
|
|
@@ -222,29 +223,29 @@ function M(e) {
|
|
|
222
223
|
return L.includes(e) ? j(e) : e;
|
|
223
224
|
}
|
|
224
225
|
const P = (e) => {
|
|
225
|
-
let r = [], t = !1,
|
|
226
|
+
let r = [], t = !1, n = !1, s = 0;
|
|
226
227
|
for (let l = 0; l < e.length; l++) {
|
|
227
228
|
const i = e[l];
|
|
228
|
-
if (i === "[" || i === "<" || i === "(" ? (
|
|
229
|
-
return t &&
|
|
229
|
+
if (i === "[" || i === "<" || i === "(" ? (n = !0, r.push(i), i == "[" && (t = !0), s == 0 && (s = l)) : (i === "]" && r[r.length - 1] === "[" || i === ">" && r[r.length - 1] === "<" || i === ")" && r[r.length - 1] === "(") && r.pop(), n && r.length === 0)
|
|
230
|
+
return t && s + 1 == l ? {
|
|
230
231
|
top: "Array",
|
|
231
|
-
type: e.substring(0,
|
|
232
|
+
type: e.substring(0, s)
|
|
232
233
|
} : {
|
|
233
|
-
top: e.substring(0,
|
|
234
|
-
type: e.substring(
|
|
234
|
+
top: e.substring(0, s),
|
|
235
|
+
type: e.substring(s + 1, l)
|
|
235
236
|
};
|
|
236
237
|
}
|
|
237
238
|
return {
|
|
238
239
|
top: e,
|
|
239
240
|
type: ""
|
|
240
241
|
};
|
|
241
|
-
},
|
|
242
|
-
let t = [],
|
|
242
|
+
}, E = (e, r) => {
|
|
243
|
+
let t = [], n = [], s = "";
|
|
243
244
|
for (let l = 0; l < e.length; l++) {
|
|
244
245
|
const i = e[l];
|
|
245
|
-
i === "[" || i === "<" || i === "(" ? (t.push(i),
|
|
246
|
+
i === "[" || i === "<" || i === "(" ? (t.push(i), s += i) : i === "]" && t.length > 0 && t[t.length - 1] === "[" || i === ">" && t.length > 0 && t[t.length - 1] === "<" || i === ")" && t.length > 0 && t[t.length - 1] === "(" ? (t.pop(), s += i) : i === r && t.length === 0 ? (n.push(s.trim()), s = "") : s += i;
|
|
246
247
|
}
|
|
247
|
-
return
|
|
248
|
+
return s.trim() !== "" && n.push(s.trim()), n;
|
|
248
249
|
};
|
|
249
250
|
function _(e) {
|
|
250
251
|
let r = "";
|
|
@@ -258,60 +259,60 @@ const k = (e) => {
|
|
|
258
259
|
if (e)
|
|
259
260
|
if (e.startsWith("[") && e.endsWith("]") || e.startsWith("(") && e.endsWith(")")) {
|
|
260
261
|
const r = e.slice(1, -1).trim();
|
|
261
|
-
return r ?
|
|
262
|
+
return r ? E(r, ",") : ["any"];
|
|
262
263
|
} else {
|
|
263
264
|
if (e.startsWith("{") && e.endsWith("}"))
|
|
264
265
|
return ["Object"];
|
|
265
266
|
if (e.startsWith("<") && e.endsWith(">")) {
|
|
266
267
|
const r = e.slice(1, -1).trim();
|
|
267
|
-
return r ?
|
|
268
|
+
return r ? E(r, "|") : ["any"];
|
|
268
269
|
} else
|
|
269
|
-
return
|
|
270
|
+
return E(e, ",");
|
|
270
271
|
}
|
|
271
272
|
else return ["any"];
|
|
272
273
|
};
|
|
273
|
-
function
|
|
274
|
+
function S(e) {
|
|
274
275
|
const r = [];
|
|
275
276
|
return e.forEach((t) => {
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
278
|
-
const
|
|
277
|
+
const n = P(t);
|
|
278
|
+
if (n.type) {
|
|
279
|
+
const s = k(n.type), l = S(s);
|
|
279
280
|
r.push({
|
|
280
281
|
label: t,
|
|
281
|
-
value:
|
|
282
|
+
value: n.top,
|
|
282
283
|
children: l
|
|
283
284
|
});
|
|
284
285
|
} else
|
|
285
|
-
r.push(
|
|
286
|
+
r.push(n.top);
|
|
286
287
|
}), r;
|
|
287
288
|
}
|
|
288
289
|
function Q(e) {
|
|
289
|
-
return
|
|
290
|
-
const
|
|
291
|
-
if (!
|
|
292
|
-
const l =
|
|
293
|
-
let a = [],
|
|
294
|
-
for (let g = 0; g <
|
|
295
|
-
const c =
|
|
290
|
+
return E(e, ",").map((t) => {
|
|
291
|
+
const n = t.trim(), s = t.match(/^([^:?]+)(\??):/);
|
|
292
|
+
if (!s) return null;
|
|
293
|
+
const l = s[1].trim(), i = !s[2], o = s[0].length, u = t.substring(o).trim();
|
|
294
|
+
let a = [], m = "", d = "";
|
|
295
|
+
for (let g = 0; g < u.length; g++) {
|
|
296
|
+
const c = u[g];
|
|
296
297
|
if (c === "[" || c === "<" || c === "(" || c === "{" ? a.push(c) : (c === "]" && a[a.length - 1] === "[" || c === ">" && a[a.length - 1] === "<" || c === "}" && a[a.length - 1] === "{" || c === ")" && a[a.length - 1] === "(") && a.pop(), a.length === 0 && g > 0) {
|
|
297
|
-
g == 1 && c !== "]" && c !== ">" && c !== "}" && c !== ")" ? (
|
|
298
|
+
g == 1 && c !== "]" && c !== ">" && c !== "}" && c !== ")" ? (m = "", d = u.substring(0)) : (m = u.substring(0, g + 1).trim(), d = u.substring(g + 1));
|
|
298
299
|
break;
|
|
299
300
|
}
|
|
300
301
|
}
|
|
301
|
-
const
|
|
302
|
+
const x = k(m), f = S(x);
|
|
302
303
|
return {
|
|
303
304
|
name: l,
|
|
304
305
|
prop: l,
|
|
305
|
-
type: C(
|
|
306
|
-
dataType:
|
|
306
|
+
type: C(f),
|
|
307
|
+
dataType: f,
|
|
307
308
|
must: i,
|
|
308
|
-
label:
|
|
309
|
-
description:
|
|
309
|
+
label: n,
|
|
310
|
+
description: d
|
|
310
311
|
};
|
|
311
312
|
}).filter(Boolean);
|
|
312
313
|
}
|
|
313
314
|
export {
|
|
314
|
-
|
|
315
|
+
S as getDataType,
|
|
315
316
|
C as getDataTypeType,
|
|
316
317
|
K as getNotesText,
|
|
317
318
|
z as getTextNotes,
|