@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.
@@ -2791,16 +2791,22 @@ function getObj(v) {
2791
2791
  } else if (tag == "selectable") {
2792
2792
  name = name.trim();
2793
2793
  } else {
2794
- if (name.includes("=")) {
2795
- const ms = name.split("=");
2796
- name = ms[0];
2797
- const ss = ms[1] + " " + description;
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 || ms[1] || "";
2809
+ defaults = v.default || ms2 || "";
2804
2810
  }
2805
2811
  }
2806
2812
  const regExp = /\s*\((.*)\)\s*/gi;
@@ -2773,16 +2773,22 @@ function getObj(v) {
2773
2773
  } else if (tag == "selectable") {
2774
2774
  name = name.trim();
2775
2775
  } else {
2776
- if (name.includes("=")) {
2777
- const ms = name.split("=");
2778
- name = ms[0];
2779
- const ss = ms[1] + " " + description;
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 || ms[1] || "";
2791
+ defaults = v.default || ms2 || "";
2786
2792
  }
2787
2793
  }
2788
2794
  const regExp = /\s*\((.*)\)\s*/gi;
@@ -1,18 +1,25 @@
1
- import { ObjStr, ObjUnk } from '../../config';
2
- import { SpecObjs, Spec } from '../../utils/index';
3
- import { DataType } from './util';
4
- export declare function getHmtl(propsname: string, param: {
5
- [key: string]: SpecObjs[];
6
- }, value: ObjUnk, slotValue?: ObjStr, propsText?: ObjStr, exposeText?: ObjUnk): Promise<string>;
7
- export declare function setValStringify(v: unknown, key: string, propsText?: ObjStr): string | Promise<string>;
8
- type SelectsObj = {
9
- label: string;
10
- prop: unknown;
11
- };
12
- export declare function getSpecType(val: Spec): {
13
- arr: SelectsObj[];
14
- type: string;
15
- dataType: DataType[];
16
- };
17
- export declare function getDefaultValue(obj: Spec, is?: boolean): any;
18
- export {};
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"),f={titles:[],propss:[],slots:[],emitss:[],exposes:[]};function w(){Object.keys(f).forEach(e=>{f[e]=[]})}function k(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 u=1;u<e.length;u++){if(t=e[u],l=s.indexOf(t),l!=-1)l>2?i.push(t):i[i.length-1]===t?i.pop():i.push(t);else{let o=!1;for(let a of n)if(t===a[1]&&i[i.length-1]===a[0]){o=!0;break}o&&i.pop()}if(i.length===0)return r&&e[u+1]===" ",e.substring(0,u+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=k(t)||t;else if(r=="selectable")t=t.trim();else{if(t.includes("=")){const a=t.split("=");t=a[0];const d=a[1]+" "+n,g=k(d,!0);g?(s=g,n=d.replace(g,"")):s=e.default||a[1]||""}const o=/\s*\((.*)\)\s*/gi.exec(n);o&&o.length>0&&(l=o[1],n=n.replace(o[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 v(e){let r=["title","text","author","date"],t=m(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),T(n),t.arr.forEach(s=>{b(s.key,s.value)})}function T(e){f.titles.push(e)}function P(e){let r=["props","name","type","default","required","selectable","description","descriptions","model","return"],t=m(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),p(n,"props"),t.arr.forEach(s=>{b(s.key,s.value)})}function F(e){let r=["slot","name","selectable","description","descriptions"],t=m(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),p(n,"slot"),t.arr.forEach(s=>{b(s.key,s.value)})}function B(e){let r=["emits","name","selectable","description","descriptions"],t=m(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),p(n,"emits"),t.arr.forEach(s=>{b(s.key,s.value)})}function I(e){let r=["expose","name","type","return","selectable","description","descriptions"],t=m(e),n={};r.forEach(s=>{n[s]=t.obj[s]}),p(n,"expose"),t.arr.forEach(s=>{b(s.key,s.value)})}function p(e,r){const t=f[r+"name"]||[],n=e.name??e[r]?.name,s=t.indexOf(n);s>=0&&(f[r+"s"].splice(s,1),t.splice(s,1)),f[r+"s"].push(e),t.push(n),f[r+"name"]=t}function m(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 u={};u[l]=i,n.push({key:l,value:u})}}),{arr:n,obj:t}}function b(e,r){switch(e){case"title":return T(r),!0;case"text":return T(r),!0;case"props":return p(r,"props"),!0;case"slot":return p(r,"slot"),!0;case"emits":return p(r,"emits"),!0;case"expose":return p(r,"expose"),!0;default:return!1}}function J(e,r){switch(e){case"title":return v(r),!0;case"props":return P(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(f))}function S(e){if(e)return j.parse(e)}function M(e){let r=S(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:""}},y=(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 x=e=>{if(e)if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const r=e.slice(1,-1).trim();return r?y(r,","):["any"]}else{if(e.startsWith("{")&&e.endsWith("}"))return["Object"];if(e.startsWith("<")&&e.endsWith(">")){const r=e.slice(1,-1).trim();return r?y(r,"|"):["any"]}else return y(e,",")}else return["any"]};function E(e){const r=[];return e.forEach(t=>{const n=C(t);if(n.type){const s=x(n.type),l=E(s);r.push({label:t,value:n.top,children:l})}else r.push(n.top)}),r}function H(e){return y(e,",").map(t=>{const n=t.trim(),s=t.match(/^([^:?]+)(\??):/);if(!s)return null;const l=s[1].trim(),i=!s[2],u=s[0].length,o=t.substring(u).trim();let a=[],d="",g="";for(let h=0;h<o.length;h++){const c=o[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!==")"?(d="",g=o.substring(0)):(d=o.substring(0,h+1).trim(),g=o.substring(h+1));break}}const W=x(d),O=E(W);return{name:l,prop:l,type:N(O),dataType:O,must:i,label:n,description:g}}).filter(Boolean)}exports.getDataType=E;exports.getDataTypeType=N;exports.getNotesText=M;exports.getTextNotes=S;exports.parseParamString=H;exports.parseTypeDefinition=x;
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 f = {
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(f).forEach((e) => {
12
- f[e] = [];
11
+ Object.keys(p).forEach((e) => {
12
+ p[e] = [];
13
13
  });
14
14
  }
15
- function T(e, r) {
16
- let t = e.charAt(0), s = [
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 n = s.map((i) => i[0]);
25
- let l = n.indexOf(t);
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 u = 1; u < e.length; u++) {
29
- if (t = e[u], l = n.indexOf(t), l != -1)
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 o = !1;
33
- for (let a of s)
32
+ let u = !1;
33
+ for (let a of n)
34
34
  if (t === a[1] && i[i.length - 1] === a[0]) {
35
- o = !0;
35
+ u = !0;
36
36
  break;
37
37
  }
38
- o && i.pop();
38
+ u && i.pop();
39
39
  }
40
40
  if (i.length === 0)
41
- return r && e[u + 1] === " ", e.substring(0, u + 1);
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, s = e.description, n = e.default, l = "", i = "";
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 = T(t) || t;
50
+ t = t.trim(), t = O(t) || t;
51
51
  else if (r == "selectable")
52
52
  t = t.trim();
53
53
  else {
54
- if (t.includes("=")) {
55
- const a = t.split("=");
56
- t = a[0];
57
- const d = a[1] + " " + s, h = T(d, !0);
58
- h ? (n = h, s = d.replace(h, "")) : n = e.default || a[1] || "";
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 o = /\s*\((.*)\)\s*/gi.exec(s);
61
- o && o.length > 0 && (l = o[1], s = s.replace(o[0], ""));
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 = n || "", e.description = s, e.selectable = l, e;
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 = m(e), s = {};
75
- r.forEach((n) => {
76
- s[n] = t.obj[n];
77
- }), x(s), t.arr.forEach((n) => {
78
- b(n.key, n.value);
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 x(e) {
82
- f.titles.push(e);
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 = m(e), s = {};
97
- r.forEach((n) => {
98
- s[n] = t.obj[n];
99
- }), p(s, "props"), t.arr.forEach((n) => {
100
- b(n.key, n.value);
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 v(e) {
104
- let r = ["slot", "name", "selectable", "description", "descriptions"], t = m(e), s = {};
105
- r.forEach((n) => {
106
- s[n] = t.obj[n];
107
- }), p(s, "slot"), t.arr.forEach((n) => {
108
- b(n.key, n.value);
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 F(e) {
112
- let r = ["emits", "name", "selectable", "description", "descriptions"], t = m(e), s = {};
113
- r.forEach((n) => {
114
- s[n] = t.obj[n];
115
- }), p(s, "emits"), t.arr.forEach((n) => {
116
- b(n.key, n.value);
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 = m(e), s = {};
129
- r.forEach((n) => {
130
- s[n] = t.obj[n];
131
- }), p(s, "expose"), t.arr.forEach((n) => {
132
- b(n.key, n.value);
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 p(e, r) {
136
- const t = f[r + "name"] || [], s = e.name ?? e[r]?.name, n = t.indexOf(s);
137
- n >= 0 && (f[r + "s"].splice(n, 1), t.splice(n, 1)), f[r + "s"].push(e), t.push(s), f[r + "name"] = t;
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 m(e, r) {
140
+ function b(e, r) {
140
141
  const t = {
141
142
  descriptions: e?.description || ""
142
- }, s = [];
143
- return e?.tags && e.tags?.forEach((n) => {
144
- let l = n.tag, i = A(n);
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 u = {};
149
- u[l] = i, s.push({
149
+ const o = {};
150
+ o[l] = i, n.push({
150
151
  key: l,
151
- value: u
152
+ value: o
152
153
  });
153
154
  }
154
155
  }), {
155
- arr: s,
156
+ arr: n,
156
157
  obj: t
157
158
  };
158
159
  }
159
- function b(e, r) {
160
+ function y(e, r) {
160
161
  switch (e) {
161
162
  case "title":
162
- return x(r), !0;
163
+ return T(r), !0;
163
164
  case "text":
164
- return x(r), !0;
165
+ return T(r), !0;
165
166
  case "props":
166
- return p(r, "props"), !0;
167
+ return h(r, "props"), !0;
167
168
  case "slot":
168
- return p(r, "slot"), !0;
169
+ return h(r, "slot"), !0;
169
170
  case "emits":
170
- return p(r, "emits"), !0;
171
+ return h(r, "emits"), !0;
171
172
  case "expose":
172
- return p(r, "expose"), !0;
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 || [], s = t?.length || 0;
196
- if (s > 0)
197
- for (let n = 0; n < s; n++) {
198
- const l = t[n] || {};
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(f));
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, s = !1, n = 0;
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 === "(" ? (s = !0, r.push(i), i == "[" && (t = !0), n == 0 && (n = l)) : (i === "]" && r[r.length - 1] === "[" || i === ">" && r[r.length - 1] === "<" || i === ")" && r[r.length - 1] === "(") && r.pop(), s && r.length === 0)
229
- return t && n + 1 == l ? {
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, n)
232
+ type: e.substring(0, s)
232
233
  } : {
233
- top: e.substring(0, n),
234
- type: e.substring(n + 1, l)
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
- }, y = (e, r) => {
242
- let t = [], s = [], n = "";
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), n += 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(), n += i) : i === r && t.length === 0 ? (s.push(n.trim()), n = "") : n += 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 n.trim() !== "" && s.push(n.trim()), s;
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 ? y(r, ",") : ["any"];
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 ? y(r, "|") : ["any"];
268
+ return r ? E(r, "|") : ["any"];
268
269
  } else
269
- return y(e, ",");
270
+ return E(e, ",");
270
271
  }
271
272
  else return ["any"];
272
273
  };
273
- function O(e) {
274
+ function S(e) {
274
275
  const r = [];
275
276
  return e.forEach((t) => {
276
- const s = P(t);
277
- if (s.type) {
278
- const n = k(s.type), l = O(n);
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: s.top,
282
+ value: n.top,
282
283
  children: l
283
284
  });
284
285
  } else
285
- r.push(s.top);
286
+ r.push(n.top);
286
287
  }), r;
287
288
  }
288
289
  function Q(e) {
289
- return y(e, ",").map((t) => {
290
- const s = t.trim(), n = t.match(/^([^:?]+)(\??):/);
291
- if (!n) return null;
292
- const l = n[1].trim(), i = !n[2], u = n[0].length, o = t.substring(u).trim();
293
- let a = [], d = "", h = "";
294
- for (let g = 0; g < o.length; g++) {
295
- const c = o[g];
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 !== ")" ? (d = "", h = o.substring(0)) : (d = o.substring(0, g + 1).trim(), h = o.substring(g + 1));
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 S = k(d), E = O(S);
302
+ const x = k(m), f = S(x);
302
303
  return {
303
304
  name: l,
304
305
  prop: l,
305
- type: C(E),
306
- dataType: E,
306
+ type: C(f),
307
+ dataType: f,
307
308
  must: i,
308
- label: s,
309
- description: h
309
+ label: n,
310
+ description: d
310
311
  };
311
312
  }).filter(Boolean);
312
313
  }
313
314
  export {
314
- O as getDataType,
315
+ S as getDataType,
315
316
  C as getDataTypeType,
316
317
  K as getNotesText,
317
318
  z as getTextNotes,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.1.9",
4
+ "version": "0.1.10",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",