@fangzhongya/vue-archive 0.0.19 → 0.0.20

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.
@@ -3155,15 +3155,16 @@ function getSpecObjs(specs, name) {
3155
3155
  }
3156
3156
  function getParameStr(css) {
3157
3157
  return css.map((o) => {
3158
- return o.prop + ":" + setDataType(o.dataType);
3158
+ const name = o.prop || "...arr";
3159
+ return name + ":" + setDataType(o.dataType);
3159
3160
  }).join(",");
3160
3161
  }
3161
3162
  function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3162
3163
  const tarr = [];
3163
3164
  const sarr = [];
3164
3165
  let is = true;
3165
- const es = getEmitsValue(param.emits);
3166
- const res = getExposeValue(param.expose);
3166
+ const es = getEmitsValue(param.emitss || []);
3167
+ const res = getExposeValue(param.exposes || []);
3167
3168
  Object.keys(value).forEach((key) => {
3168
3169
  let val = value[key];
3169
3170
  if (/^on[A-Z]/.test(key) && typeof val == "function") {
@@ -3189,13 +3190,14 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3189
3190
  strs = arr.join("");
3190
3191
  }
3191
3192
  tarr.push(" @" + name + '="' + strs + '"');
3192
- const s = getSpecObjs(es, name).selectable;
3193
+ const s = getSpecObjs(es, name)?.selectable || "";
3193
3194
  const css = getParametersObj(s);
3194
3195
  const cs = getParameStr(css);
3195
3196
  sarr.push("function " + strs + "(" + cs + ") {");
3196
3197
  css.forEach((o) => {
3198
+ const name2 = o.prop || "arr";
3197
3199
  sarr.push(
3198
- " console.log('" + o.description + o.prop + "', " + o.prop + ")"
3200
+ " console.log('" + o.description + name2 + "', " + name2 + ")"
3199
3201
  );
3200
3202
  });
3201
3203
  sarr.push("}");
@@ -3235,7 +3237,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3235
3237
  sarr.push(`-------${v.name}--------`);
3236
3238
  const s = getSpecObjs(res, v.name);
3237
3239
  const m = v.name + "Value";
3238
- const css = getParametersObj(s.selectable);
3240
+ const css = getParametersObj(s?.selectable || "");
3239
3241
  const cs = [];
3240
3242
  v.params?.forEach((val, index) => {
3241
3243
  const prop = css[index].prop;
@@ -3873,8 +3875,8 @@ function getDefaultValue(obj) {
3873
3875
  }
3874
3876
  }
3875
3877
  function setVue(propsname, param, url) {
3876
- const ps = getPropsValue2(param.propss);
3877
- const es = getEmitsValue(param.emitss);
3878
+ const ps = getPropsValue2(param.propss || []);
3879
+ const es = getEmitsValue(param.emitss || []);
3878
3880
  const propsObj = {};
3879
3881
  ps.forEach((val) => {
3880
3882
  let name = val.name;
@@ -3140,15 +3140,16 @@ function getSpecObjs(specs, name) {
3140
3140
  }
3141
3141
  function getParameStr(css) {
3142
3142
  return css.map((o) => {
3143
- return o.prop + ":" + setDataType(o.dataType);
3143
+ const name = o.prop || "...arr";
3144
+ return name + ":" + setDataType(o.dataType);
3144
3145
  }).join(",");
3145
3146
  }
3146
3147
  function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3147
3148
  const tarr = [];
3148
3149
  const sarr = [];
3149
3150
  let is = true;
3150
- const es = getEmitsValue(param.emits);
3151
- const res = getExposeValue(param.expose);
3151
+ const es = getEmitsValue(param.emitss || []);
3152
+ const res = getExposeValue(param.exposes || []);
3152
3153
  Object.keys(value).forEach((key) => {
3153
3154
  let val = value[key];
3154
3155
  if (/^on[A-Z]/.test(key) && typeof val == "function") {
@@ -3174,13 +3175,14 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3174
3175
  strs = arr.join("");
3175
3176
  }
3176
3177
  tarr.push(" @" + name + '="' + strs + '"');
3177
- const s = getSpecObjs(es, name).selectable;
3178
+ const s = getSpecObjs(es, name)?.selectable || "";
3178
3179
  const css = getParametersObj(s);
3179
3180
  const cs = getParameStr(css);
3180
3181
  sarr.push("function " + strs + "(" + cs + ") {");
3181
3182
  css.forEach((o) => {
3183
+ const name2 = o.prop || "arr";
3182
3184
  sarr.push(
3183
- " console.log('" + o.description + o.prop + "', " + o.prop + ")"
3185
+ " console.log('" + o.description + name2 + "', " + name2 + ")"
3184
3186
  );
3185
3187
  });
3186
3188
  sarr.push("}");
@@ -3220,7 +3222,7 @@ function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3220
3222
  sarr.push(`-------${v.name}--------`);
3221
3223
  const s = getSpecObjs(res, v.name);
3222
3224
  const m = v.name + "Value";
3223
- const css = getParametersObj(s.selectable);
3225
+ const css = getParametersObj(s?.selectable || "");
3224
3226
  const cs = [];
3225
3227
  v.params?.forEach((val, index) => {
3226
3228
  const prop = css[index].prop;
@@ -3858,8 +3860,8 @@ function getDefaultValue(obj) {
3858
3860
  }
3859
3861
  }
3860
3862
  function setVue(propsname, param, url) {
3861
- const ps = getPropsValue2(param.propss);
3862
- const es = getEmitsValue(param.emitss);
3863
+ const ps = getPropsValue2(param.propss || []);
3864
+ const es = getEmitsValue(param.emitss || []);
3863
3865
  const propsObj = {};
3864
3866
  ps.forEach((val) => {
3865
3867
  let name = val.name;
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),B=require("../use/index.cjs"),x=require("./info.vue.cjs"),y=require("./props.vue.cjs"),q=require("../../config.cjs"),C=require("../md/index.vue.cjs");require("./index.cjs");const _=require("../../utils/glob.cjs"),h={class:"compo"},N={key:0,class:"compo-md"},V={key:0,class:"compo-md-list"},E={key:1,class:"compo-use"},b=e.defineComponent({__name:"index",props:{value:Object},setup(r){const t=r,d=q.getConfig("useparam"),c=e.ref(""),u=e.reactive({md:!0}),o=e.ref([]),a=e.ref([]),v=e.ref([]),p=e.ref([]),i=e.ref([]);function k(n){let{propss:l,slots:s,emitss:f,exposes:g}=n;a.value=l,i.value=s,v.value=f,p.value=g}e.watch(()=>t.value,()=>{m()});function m(){t.value?.key&&(_.getLocalTextComponents(t.value?.key).then(n=>{c.value=n}),o.value=_.getKeyMds(t.value?.key)||[])}return m(),(n,l)=>(e.openBlock(),e.createElementBlock("div",h,[e.createVNode(x,{value:r.value},null,8,["value"]),e.createVNode(y,{onChange:k,value:c.value},null,8,["value"]),o.value&&o.value.length?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",{onClick:l[0]||(l[0]=s=>u.md=!u.md),class:"compo-md-name"}," 说明文档 "),u.md?(e.openBlock(),e.createElementBlock("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,s=>(e.openBlock(),e.createBlock(C,{value:s},null,8,["value"]))),256))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.unref(d)?(e.openBlock(),e.createElementBlock("div",E,[e.createVNode(e.unref(B),{value:t.value,param:{props:a.value,slot:i.value,emits:v.value,expose:p.value}},null,8,["value","param"])])):e.createCommentVNode("",!0)]))}});module.exports=b;
1
+ "use strict";const e=require("vue"),_=require("../use/index.cjs"),d=require("./info.vue.cjs"),k=require("./props.vue.cjs"),f=require("../../config.cjs"),g=require("../md/index.vue.cjs");require("./index.cjs");const v=require("../../utils/glob.cjs"),B={class:"compo"},y={key:0,class:"compo-md"},q={key:0,class:"compo-md-list"},C={key:1,class:"compo-use"},h=e.defineComponent({__name:"index",props:{value:Object},setup(c){const t=c,m=f.getConfig("useparam"),l=e.ref(""),u=e.reactive({md:!0}),o=e.ref([]),r=e.ref();function p(n){r.value=n}e.watch(()=>t.value,()=>{a()});function a(){t.value?.key&&(v.getLocalTextComponents(t.value?.key).then(n=>{l.value=n}),o.value=v.getKeyMds(t.value?.key)||[])}return a(),(n,s)=>(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(d,{value:c.value},null,8,["value"]),e.createVNode(k,{onChange:p,value:l.value},null,8,["value"]),o.value&&o.value.length?(e.openBlock(),e.createElementBlock("div",y,[e.createElementVNode("div",{onClick:s[0]||(s[0]=i=>u.md=!u.md),class:"compo-md-name"},"说明文档"),u.md?(e.openBlock(),e.createElementBlock("div",q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,i=>(e.openBlock(),e.createBlock(g,{value:i},null,8,["value"]))),256))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.unref(m)?(e.openBlock(),e.createElementBlock("div",C,[e.createVNode(e.unref(_),{value:t.value,param:r.value},null,8,["value","param"])])):e.createCommentVNode("",!0)]))}});module.exports=h;
@@ -1,75 +1,67 @@
1
- import { defineComponent as $, ref as e, reactive as B, watch as N, createElementBlock as s, openBlock as t, createVNode as r, createCommentVNode as c, createElementVNode as V, Fragment as E, renderList as L, createBlock as b, unref as g } from "vue";
2
- import j from "../use/index.js";
3
- import w from "./info.vue.js";
4
- import D from "./props.vue.js";
5
- import { getConfig as F } from "../../config.js";
6
- import K from "../md/index.vue.js";
1
+ import { defineComponent as g, ref as m, reactive as h, watch as y, createElementBlock as o, openBlock as e, createVNode as r, createCommentVNode as s, createElementVNode as C, Fragment as x, renderList as $, createBlock as B, unref as f } from "vue";
2
+ import N from "../use/index.js";
3
+ import V from "./info.vue.js";
4
+ import E from "./props.vue.js";
5
+ import { getConfig as L } from "../../config.js";
6
+ import b from "../md/index.vue.js";
7
7
  import "./index.js";
8
- import { getLocalTextComponents as M, getKeyMds as O } from "../../utils/glob.js";
9
- const T = { class: "compo" }, U = {
8
+ import { getLocalTextComponents as j, getKeyMds as w } from "../../utils/glob.js";
9
+ const D = { class: "compo" }, F = {
10
10
  key: 0,
11
11
  class: "compo-md"
12
- }, q = {
12
+ }, K = {
13
13
  key: 0,
14
14
  class: "compo-md-list"
15
- }, z = {
15
+ }, M = {
16
16
  key: 1,
17
17
  class: "compo-use"
18
- }, S = /* @__PURE__ */ $({
18
+ }, I = /* @__PURE__ */ g({
19
19
  __name: "index",
20
20
  props: {
21
21
  value: Object
22
22
  },
23
- setup(v) {
24
- const o = v, x = F("useparam"), i = e(""), m = B({
23
+ setup(u) {
24
+ const t = u, _ = L("useparam"), c = m(""), l = h({
25
25
  md: !0
26
- }), a = e([]), p = e([]), d = e([]), f = e([]), _ = e([]);
27
- function h(l) {
28
- let { propss: n, slots: u, emitss: y, exposes: C } = l;
29
- p.value = n, _.value = u, d.value = y, f.value = C;
26
+ }), a = m([]), i = m();
27
+ function k(n) {
28
+ i.value = n;
30
29
  }
31
- N(
32
- () => o.value,
30
+ y(
31
+ () => t.value,
33
32
  () => {
34
- k();
33
+ v();
35
34
  }
36
35
  );
37
- function k() {
38
- o.value?.key && (M(o.value?.key).then(
39
- (l) => {
40
- i.value = l;
41
- }
42
- ), a.value = O(o.value?.key) || []);
36
+ function v() {
37
+ t.value?.key && (j(t.value?.key).then((n) => {
38
+ c.value = n;
39
+ }), a.value = w(t.value?.key) || []);
43
40
  }
44
- return k(), (l, n) => (t(), s("div", T, [
45
- r(w, { value: v.value }, null, 8, ["value"]),
46
- r(D, {
47
- onChange: h,
48
- value: i.value
41
+ return v(), (n, d) => (e(), o("div", D, [
42
+ r(V, { value: u.value }, null, 8, ["value"]),
43
+ r(E, {
44
+ onChange: k,
45
+ value: c.value
49
46
  }, null, 8, ["value"]),
50
- a.value && a.value.length ? (t(), s("div", U, [
51
- V("div", {
52
- onClick: n[0] || (n[0] = (u) => m.md = !m.md),
47
+ a.value && a.value.length ? (e(), o("div", F, [
48
+ C("div", {
49
+ onClick: d[0] || (d[0] = (p) => l.md = !l.md),
53
50
  class: "compo-md-name"
54
- }, " 说明文档 "),
55
- m.md ? (t(), s("div", q, [
56
- (t(!0), s(E, null, L(a.value, (u) => (t(), b(K, { value: u }, null, 8, ["value"]))), 256))
57
- ])) : c("", !0)
58
- ])) : c("", !0),
59
- g(x) ? (t(), s("div", z, [
60
- r(g(j), {
61
- value: o.value,
62
- param: {
63
- props: p.value,
64
- slot: _.value,
65
- emits: d.value,
66
- expose: f.value
67
- }
51
+ }, "说明文档"),
52
+ l.md ? (e(), o("div", K, [
53
+ (e(!0), o(x, null, $(a.value, (p) => (e(), B(b, { value: p }, null, 8, ["value"]))), 256))
54
+ ])) : s("", !0)
55
+ ])) : s("", !0),
56
+ f(_) ? (e(), o("div", M, [
57
+ r(f(N), {
58
+ value: t.value,
59
+ param: i.value
68
60
  }, null, 8, ["value", "param"])
69
- ])) : c("", !0)
61
+ ])) : s("", !0)
70
62
  ]));
71
63
  }
72
64
  });
73
65
  export {
74
- S as default
66
+ I as default
75
67
  };
@@ -1,18 +1,18 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const P=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const x=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const S=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const m=require("./util.cjs"),E=require("../../utils/props.cjs"),z=require("@fangzhongya/utils/basic/string/toFunction"),U=["class"];function O(t,e){return t.filter(n=>n.name==e)[0]}function B(t){return t.map(e=>e.prop+":"+m.setDataType(e.dataType)).join(",")}function C(t,e,n,i,a,d){const c=[],r=[];let y=!0;const w=E.getEmitsValue(e.emits),D=E.getExposeValue(e.expose);Object.keys(n).forEach(s=>{let p=n[s];if(/^on[A-Z]/.test(s)&&typeof p=="function"){let o=s.substring(2);const f=s.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(u=>S.firstUpper(u)).join(""),o=x.firstLower(o)):(l=f[0],o=P.humpToLine(o)),f.includes("-")){let u=l.split("-");u=u.map((b,V)=>V!=0?S.firstUpper(b):b),l=u.join("")}c.push(" @"+o+'="'+l+'"');const h=O(w,o).selectable,$=m.getParametersObj(h),g=B($);r.push("function "+l+"("+g+") {"),$.forEach(u=>{r.push(" console.log('"+u.description+u.prop+"', "+u.prop+")")}),r.push("}")}else{let o=s;if(U.includes(s)&&(o=s+"1"),c.push(" :"+s+'="'+o+'"'),typeof p=="function")r.push("const "+s+" = "+F(p,s,a));else if(y&&(y=!1,r.unshift("import { ref } from 'vue';")),typeof p>"u")r.push("const "+o+" = ref();");else{let f=q(p,s,a);r.push("const "+o+" = ref("+f+");")}}});const j=Object.values(d||{});j.length>0&&(y&&(y=!1,r.unshift("import { ref } from 'vue';")),c.unshift(' ref="refDom"'),r.push("const refDom = ref()"),j.forEach(s=>{r.push(`-------${s.name}--------`);const p=O(D,s.name),o=s.name+"Value",f=m.getParametersObj(p.selectable),l=[];s.params?.forEach((h,$)=>{const g=f[$].prop,u=g+s.name;if(typeof h=="function")r.push("const "+u+" = "+F(h,g,s.text));else if(typeof h>"u")r.push("const "+u+" = undefined;");else{let b=q(h,g,s.text);r.push("const "+u+" = "+b+";")}l.push(u)}),s.type==="function"?r.push(`const ${o} = refDom.value?.${s.name}(${l.join(", ")})`):r.push(`const ${o} = refDom.value?.${s.name}`),r.push(`console.log('"${p.description}"', ${o})`)})),c.length>0&&c.unshift("");const L=H(i);return`<!--${t}-->
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const P=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const x=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const S=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const h=require("./util.cjs"),E=require("../../utils/props.cjs"),z=require("@fangzhongya/utils/basic/string/toFunction"),U=["class"];function O(n,e){return n.filter(t=>t.name==e)[0]}function B(n){return n.map(e=>(e.prop||"...arr")+":"+h.setDataType(e.dataType)).join(",")}function C(n,e,t,i,a,y){const c=[],r=[];let $=!0;const w=E.getEmitsValue(e.emitss||[]),D=E.getExposeValue(e.exposes||[]);Object.keys(t).forEach(s=>{let p=t[s];if(/^on[A-Z]/.test(s)&&typeof p=="function"){let o=s.substring(2);const f=s.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(u=>S.firstUpper(u)).join(""),o=x.firstLower(o)):(l=f[0],o=P.humpToLine(o)),f.includes("-")){let u=l.split("-");u=u.map((m,V)=>V!=0?S.firstUpper(m):m),l=u.join("")}c.push(" @"+o+'="'+l+'"');const g=O(w,o)?.selectable||"",b=h.getParametersObj(g),d=B(b);r.push("function "+l+"("+d+") {"),b.forEach(u=>{const m=u.prop||"arr";r.push(" console.log('"+u.description+m+"', "+m+")")}),r.push("}")}else{let o=s;if(U.includes(s)&&(o=s+"1"),c.push(" :"+s+'="'+o+'"'),typeof p=="function")r.push("const "+s+" = "+F(p,s,a));else if($&&($=!1,r.unshift("import { ref } from 'vue';")),typeof p>"u")r.push("const "+o+" = ref();");else{let f=q(p,s,a);r.push("const "+o+" = ref("+f+");")}}});const j=Object.values(y||{});j.length>0&&($&&($=!1,r.unshift("import { ref } from 'vue';")),c.unshift(' ref="refDom"'),r.push("const refDom = ref()"),j.forEach(s=>{r.push(`-------${s.name}--------`);const p=O(D,s.name),o=s.name+"Value",f=h.getParametersObj(p?.selectable||""),l=[];s.params?.forEach((g,b)=>{const d=f[b].prop,u=d+s.name;if(typeof g=="function")r.push("const "+u+" = "+F(g,d,s.text));else if(typeof g>"u")r.push("const "+u+" = undefined;");else{let m=q(g,d,s.text);r.push("const "+u+" = "+m+";")}l.push(u)}),s.type==="function"?r.push(`const ${o} = refDom.value?.${s.name}(${l.join(", ")})`):r.push(`const ${o} = refDom.value?.${s.name}`),r.push(`console.log('"${p.description}"', ${o})`)})),c.length>0&&c.unshift("");const L=H(i);return`<!--${n}-->
2
2
  <template>
3
3
  <div>
4
- <${t}${c.join(`
4
+ <${n}${c.join(`
5
5
  `)}>${L.join(`
6
6
  `)}
7
- </${t}>
7
+ </${n}>
8
8
  </div>
9
9
  </template>
10
10
  <script lang="ts" setup>
11
11
  ${r.join(`
12
12
  `)}
13
13
  <\/script>
14
- `}function H(t={}){const e=[];return Object.keys(t).forEach(n=>{const i=t[n];if(i){const a=` <template #${n}="scope">
15
- ${m.vueFormat(i," ")}
16
- </template>`;e.push(a)}}),e&&e.length>0&&e.unshift(""),e}function F(t,e,n){const i=n?n[e]:"";return i||T(t.toString())}function T(t){const e=z.getFunctionFormat(m.prettierFormat(t));if(e){let n=`{
17
- ${m.vueFormat(m.getFunBody(e.body)," ")}
18
- }`;return`function ${e.param} ${n}`}else return"undefined"}function J(t){const e=t.trim();return/^\(/.test(e)?T(e):JSON.stringify(t)}function q(t,e,n){const i=n?n[e]:"";return i||(typeof t=="string"?J(t+""):JSON.stringify(t))}function N(t){let e=A(t.type),n="any";e.length==1&&(n=e[0].split("<")[0]);const i=n;let a=(t.selectable||"").trim(),d=[];return a&&n!="boolean"&&(a.split(",").forEach(c=>{if(c){let r=c.split(":");d.push({label:c,prop:r[0].trim()})}}),n=="function"?n="function":n=="array"?n="choice":n="select"),{arr:d,zdtype:i,type:n,dataType:e}}function A(t){let e=[];return(t||"").trim().toLowerCase().split(",").forEach(i=>{i=i.trim(),i&&e.push(i)}),[...new Set(e)].sort()}exports.getHmtl=C;exports.getSpecType=N;exports.setValStringify=q;
14
+ `}function H(n={}){const e=[];return Object.keys(n).forEach(t=>{const i=n[t];if(i){const a=` <template #${t}="scope">
15
+ ${h.vueFormat(i," ")}
16
+ </template>`;e.push(a)}}),e&&e.length>0&&e.unshift(""),e}function F(n,e,t){const i=t?t[e]:"";return i||T(n.toString())}function T(n){const e=z.getFunctionFormat(h.prettierFormat(n));if(e){let t=`{
17
+ ${h.vueFormat(h.getFunBody(e.body)," ")}
18
+ }`;return`function ${e.param} ${t}`}else return"undefined"}function J(n){const e=n.trim();return/^\(/.test(e)?T(e):JSON.stringify(n)}function q(n,e,t){const i=t?t[e]:"";return i||(typeof n=="string"?J(n+""):JSON.stringify(n))}function N(n){let e=A(n.type),t="any";e.length==1&&(t=e[0].split("<")[0]);const i=t;let a=(n.selectable||"").trim(),y=[];return a&&t!="boolean"&&(a.split(",").forEach(c=>{if(c){let r=c.split(":");y.push({label:c,prop:r[0].trim()})}}),t=="function"?t="function":t=="array"?t="choice":t="select"),{arr:y,zdtype:i,type:t,dataType:e}}function A(n){let e=[];return(n||"").trim().toLowerCase().split(",").forEach(i=>{i=i.trim(),i&&e.push(i)}),[...new Set(e)].sort()}exports.getHmtl=C;exports.getSpecType=N;exports.setValStringify=q;
@@ -13,31 +13,32 @@ import { getParametersObj as E, setDataType as C, vueFormat as D, prettierFormat
13
13
  import { getEmitsValue as P, getExposeValue as A } from "../../utils/props.js";
14
14
  import { getFunctionFormat as H } from "@fangzhongya/utils/basic/string/toFunction";
15
15
  const U = ["class"];
16
- function S(e, t) {
17
- return e.filter((n) => n.name == t)[0];
16
+ function S(n, t) {
17
+ return n.filter((e) => e.name == t)[0];
18
18
  }
19
- function Z(e) {
20
- return e.map((t) => t.prop + ":" + C(t.dataType)).join(",");
19
+ function Z(n) {
20
+ return n.map((t) => (t.prop || "...arr") + ":" + C(t.dataType)).join(",");
21
21
  }
22
- function ot(e, t, n, o, a, g) {
22
+ function ot(n, t, e, o, a, d) {
23
23
  const c = [], r = [];
24
- let d = !0;
25
- const x = P(t.emits), V = A(t.expose);
26
- Object.keys(n).forEach((s) => {
27
- let l = n[s];
24
+ let $ = !0;
25
+ const x = P(t.emitss || []), V = A(t.exposes || []);
26
+ Object.keys(e).forEach((s) => {
27
+ let l = e[s];
28
28
  if (/^on[A-Z]/.test(s) && typeof l == "function") {
29
29
  let i = s.substring(2);
30
30
  const u = s.split(":");
31
31
  let p;
32
32
  if (u.length > 1 ? (p = u[0] + u.slice(1).map((f) => j(f)).join(""), i = B(i)) : (p = u[0], i = T(i)), u.includes("-")) {
33
33
  let f = p.split("-");
34
- f = f.map((y, L) => L != 0 ? j(y) : y), p = f.join("");
34
+ f = f.map((m, L) => L != 0 ? j(m) : m), p = f.join("");
35
35
  }
36
36
  c.push(" @" + i + '="' + p + '"');
37
- const m = S(x, i).selectable, $ = E(m), h = Z($);
38
- r.push("function " + p + "(" + h + ") {"), $.forEach((f) => {
37
+ const h = S(x, i)?.selectable || "", y = E(h), g = Z(y);
38
+ r.push("function " + p + "(" + g + ") {"), y.forEach((f) => {
39
+ const m = f.prop || "arr";
39
40
  r.push(
40
- " console.log('" + f.description + f.prop + "', " + f.prop + ")"
41
+ " console.log('" + f.description + m + "', " + m + ")"
41
42
  );
42
43
  }), r.push("}");
43
44
  } else {
@@ -46,7 +47,7 @@ function ot(e, t, n, o, a, g) {
46
47
  r.push(
47
48
  "const " + s + " = " + O(l, s, a)
48
49
  );
49
- else if (d && (d = !1, r.unshift("import { ref } from 'vue';")), typeof l > "u")
50
+ else if ($ && ($ = !1, r.unshift("import { ref } from 'vue';")), typeof l > "u")
50
51
  r.push("const " + i + " = ref();");
51
52
  else {
52
53
  let u = F(l, s, a);
@@ -54,21 +55,21 @@ function ot(e, t, n, o, a, g) {
54
55
  }
55
56
  }
56
57
  });
57
- const b = Object.values(g || {});
58
- b.length > 0 && (d && (d = !1, r.unshift("import { ref } from 'vue';")), c.unshift(' ref="refDom"'), r.push("const refDom = ref()"), b.forEach((s) => {
58
+ const b = Object.values(d || {});
59
+ b.length > 0 && ($ && ($ = !1, r.unshift("import { ref } from 'vue';")), c.unshift(' ref="refDom"'), r.push("const refDom = ref()"), b.forEach((s) => {
59
60
  r.push(`-------${s.name}--------`);
60
- const l = S(V, s.name), i = s.name + "Value", u = E(l.selectable), p = [];
61
- s.params?.forEach((m, $) => {
62
- const h = u[$].prop, f = h + s.name;
63
- if (typeof m == "function")
61
+ const l = S(V, s.name), i = s.name + "Value", u = E(l?.selectable || ""), p = [];
62
+ s.params?.forEach((h, y) => {
63
+ const g = u[y].prop, f = g + s.name;
64
+ if (typeof h == "function")
64
65
  r.push(
65
- "const " + f + " = " + O(m, h, s.text)
66
+ "const " + f + " = " + O(h, g, s.text)
66
67
  );
67
- else if (typeof m > "u")
68
+ else if (typeof h > "u")
68
69
  r.push("const " + f + " = undefined;");
69
70
  else {
70
- let y = F(m, h, s.text);
71
- r.push("const " + f + " = " + y + ";");
71
+ let m = F(h, g, s.text);
72
+ r.push("const " + f + " = " + m + ";");
72
73
  }
73
74
  p.push(f);
74
75
  }), s.type === "function" ? r.push(
@@ -76,13 +77,13 @@ function ot(e, t, n, o, a, g) {
76
77
  ) : r.push(`const ${i} = refDom.value?.${s.name}`), r.push(`console.log('"${l.description}"', ${i})`);
77
78
  })), c.length > 0 && c.unshift("");
78
79
  const z = q(o);
79
- return `<!--${e}-->
80
+ return `<!--${n}-->
80
81
  <template>
81
82
  <div>
82
- <${e}${c.join(`
83
+ <${n}${c.join(`
83
84
  `)}>${z.join(`
84
85
  `)}
85
- </${e}>
86
+ </${n}>
86
87
  </div>
87
88
  </template>
88
89
  <script lang="ts" setup>
@@ -91,63 +92,63 @@ ${r.join(`
91
92
  <\/script>
92
93
  `;
93
94
  }
94
- function q(e = {}) {
95
+ function q(n = {}) {
95
96
  const t = [];
96
- return Object.keys(e).forEach((n) => {
97
- const o = e[n];
97
+ return Object.keys(n).forEach((e) => {
98
+ const o = n[e];
98
99
  if (o) {
99
- const a = ` <template #${n}="scope">
100
+ const a = ` <template #${e}="scope">
100
101
  ${D(o, " ")}
101
102
  </template>`;
102
103
  t.push(a);
103
104
  }
104
105
  }), t && t.length > 0 && t.unshift(""), t;
105
106
  }
106
- function O(e, t, n) {
107
- const o = n ? n[t] : "";
108
- return o || w(e.toString());
107
+ function O(n, t, e) {
108
+ const o = e ? e[t] : "";
109
+ return o || w(n.toString());
109
110
  }
110
- function w(e) {
111
- const t = H(J(e));
111
+ function w(n) {
112
+ const t = H(J(n));
112
113
  if (t) {
113
- let n = `{
114
+ let e = `{
114
115
  ${D(N(t.body), " ")}
115
116
  }`;
116
- return `function ${t.param} ${n}`;
117
+ return `function ${t.param} ${e}`;
117
118
  } else
118
119
  return "undefined";
119
120
  }
120
- function G(e) {
121
- const t = e.trim();
122
- return /^\(/.test(t) ? w(t) : JSON.stringify(e);
121
+ function G(n) {
122
+ const t = n.trim();
123
+ return /^\(/.test(t) ? w(t) : JSON.stringify(n);
123
124
  }
124
- function F(e, t, n) {
125
- const o = n ? n[t] : "";
126
- return o || (typeof e == "string" ? G(e + "") : JSON.stringify(e));
125
+ function F(n, t, e) {
126
+ const o = e ? e[t] : "";
127
+ return o || (typeof n == "string" ? G(n + "") : JSON.stringify(n));
127
128
  }
128
- function it(e) {
129
- let t = I(e.type), n = "any";
130
- t.length == 1 && (n = t[0].split("<")[0]);
131
- const o = n;
132
- let a = (e.selectable || "").trim(), g = [];
133
- return a && n != "boolean" && (a.split(",").forEach((c) => {
129
+ function it(n) {
130
+ let t = I(n.type), e = "any";
131
+ t.length == 1 && (e = t[0].split("<")[0]);
132
+ const o = e;
133
+ let a = (n.selectable || "").trim(), d = [];
134
+ return a && e != "boolean" && (a.split(",").forEach((c) => {
134
135
  if (c) {
135
136
  let r = c.split(":");
136
- g.push({
137
+ d.push({
137
138
  label: c,
138
139
  prop: r[0].trim()
139
140
  });
140
141
  }
141
- }), n == "function" ? n = "function" : n == "array" ? n = "choice" : n = "select"), {
142
- arr: g,
142
+ }), e == "function" ? e = "function" : e == "array" ? e = "choice" : e = "select"), {
143
+ arr: d,
143
144
  zdtype: o,
144
- type: n,
145
+ type: e,
145
146
  dataType: t
146
147
  };
147
148
  }
148
- function I(e) {
149
+ function I(n) {
149
150
  let t = [];
150
- return (e || "").trim().toLowerCase().split(",").forEach((o) => {
151
+ return (n || "").trim().toLowerCase().split(",").forEach((o) => {
151
152
  o = o.trim(), o && t.push(o);
152
153
  }), [...new Set(t)].sort();
153
154
  }
@@ -1 +1 @@
1
- "use strict";const t=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),l=require("../../utils/props.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const E=t.defineComponent({props:{value:{type:Object},param:{type:Object}},render(j,O,v,U,p){const u=t.reactive({emitValue:{},slotValue:{}}),r=v.value;let c="div";r.component?c=t.defineAsyncComponent(r.component):r.name&&(c=t.resolveComponent(r.name));const i=v.param,h=l.getPropsValue(i.props),m=l.getEmitsValue(i.emits),V=l.getExposeValue(i.expose),f=l.getSlotValue(i.slot),a={},q={};h.forEach(s=>{let e=s.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(a[e]=p.propsValue[e],o&&o.length>1&&m.push({name:"update:"+e,description:s.description,selectable:"value:["+s.type+"]"}))}}),m.forEach(s=>{let e=s.name;if(e.includes("-")){let n=e.split("-");n=n.map((_,D)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};u.emitValue[s.name]=_}});let d;return f.forEach(s=>{const e=s.name||"default";q[e]=o=>{if(u.slotValue[e]){const n=u.slotValue[e];return t.h(t.defineComponent({props:{scope:{type:Object}},template:n}),{scope:o})}}}),t.h("div",{class:"use"},[t.h("div",{class:"use-props"},t.h(g,{name:r.name,list:h,onChange:(s,e)=>{p.propsValue=s,p.propsText=e}})),t.h("div",{class:"use-component"},t.h(c,{...a,ref:s=>{d=s}},q)),t.h("div",{class:"use-code"},t.h(T,{name:r.name,param:i,value:a,propsText:p.propsText,exposeText:p.exposeText,slotValue:u.slotValue})),t.h("div",{class:"use-emit"},t.h(y,{name:r.name,list:m,value:u.emitValue})),t.h("div",{class:"use-expose"},t.h(C,{name:r.name,list:V,getRef:()=>d,onChange:s=>{p.exposeText=s}})),t.h("div",{class:"use-slot"},t.h(b,{name:r.name,list:f,onChange:(s,e)=>{u.slotValue[s]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=E;
1
+ "use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),l=require("../../utils/props.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const E=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(j,O,v,U,p){const u=s.reactive({emitValue:{},slotValue:{}}),r=v.value;let c="div";r.component?c=s.defineAsyncComponent(r.component):r.name&&(c=s.resolveComponent(r.name));const i=v.param||{},h=l.getPropsValue(i.propss||[]),m=l.getEmitsValue(i.emitss||[]),V=l.getExposeValue(i.exposes||[]),f=l.getSlotValue(i.slots||[]),a={},q={};h.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(a[e]=p.propsValue[e],o&&o.length>1&&m.push({name:"update:"+e,description:t.description,selectable:"value:["+t.type+"]"}))}}),m.forEach(t=>{let e=t.name;if(e.includes("-")){let n=e.split("-");n=n.map((_,D)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};u.emitValue[t.name]=_}});let d;return f.forEach(t=>{const e=t.name||"default";q[e]=o=>{if(u.slotValue[e]){const n=u.slotValue[e];return s.h(s.defineComponent({props:{scope:{type:Object}},template:n}),{scope:o})}}}),s.h("div",{class:"use"},[s.h("div",{class:"use-props"},s.h(g,{name:r.name,list:h,onChange:(t,e)=>{p.propsValue=t,p.propsText=e}})),s.h("div",{class:"use-component"},s.h(c,{...a,ref:t=>{d=t}},q)),s.h("div",{class:"use-code"},s.h(T,{name:r.name,param:i,value:a,propsText:p.propsText,exposeText:p.exposeText,slotValue:u.slotValue})),s.h("div",{class:"use-emit"},s.h(y,{name:r.name,list:m,value:u.emitValue})),s.h("div",{class:"use-expose"},s.h(C,{name:r.name,list:V,getRef:()=>d,onChange:t=>{p.exposeText=t}})),s.h("div",{class:"use-slot"},s.h(b,{name:r.name,list:f,onChange:(t,e)=>{u.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=E;
@@ -1,4 +1,4 @@
1
- import { defineComponent as _, reactive as T, defineAsyncComponent as b, resolveComponent as j, h as o } from "vue";
1
+ import { defineComponent as _, reactive as T, defineAsyncComponent as b, resolveComponent as j, h as s } from "vue";
2
2
  import C from "./set-props.vue.js";
3
3
  import y from "./set-emit.vue.js";
4
4
  /* empty css */
@@ -18,7 +18,7 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
18
18
  import { firstUpper as g } from "@fangzhongya/utils/basic/string/firstUpper";
19
19
  import "@fangzhongya/utils/urls/getSuffix";
20
20
  import "@fangzhongya/utils/basic/array/replaceAfter";
21
- const se = _({
21
+ const oe = _({
22
22
  /**
23
23
  * @props {Stinrg} value 插入数据
24
24
  */
@@ -34,10 +34,10 @@ const se = _({
34
34
  const r = T({
35
35
  emitValue: {},
36
36
  slotValue: {}
37
- }), s = f.value;
37
+ }), o = f.value;
38
38
  let l = "div";
39
- s.component ? l = b(s.component) : s.name && (l = j(s.name));
40
- const a = f.param, d = D(a.props), c = U(a.emits), h = k(a.expose), x = w(a.slot), i = {}, V = {};
39
+ o.component ? l = b(o.component) : o.name && (l = j(o.name));
40
+ const a = f.param || {}, d = D(a.propss || []), c = U(a.emitss || []), h = k(a.exposes || []), x = w(a.slots || []), i = {}, V = {};
41
41
  d.forEach((t) => {
42
42
  let e = t.name;
43
43
  if (!e.includes(".")) {
@@ -70,7 +70,7 @@ const se = _({
70
70
  V[e] = (p) => {
71
71
  if (r.slotValue[e]) {
72
72
  const m = r.slotValue[e];
73
- return o(
73
+ return s(
74
74
  _({
75
75
  props: {
76
76
  scope: {
@@ -85,31 +85,31 @@ const se = _({
85
85
  );
86
86
  }
87
87
  };
88
- }), o(
88
+ }), s(
89
89
  "div",
90
90
  {
91
91
  class: "use"
92
92
  },
93
93
  [
94
- o(
94
+ s(
95
95
  "div",
96
96
  {
97
97
  class: "use-props"
98
98
  },
99
- o(C, {
100
- name: s.name,
99
+ s(C, {
100
+ name: o.name,
101
101
  list: d,
102
102
  onChange: (t, e) => {
103
103
  n.propsValue = t, n.propsText = e;
104
104
  }
105
105
  })
106
106
  ),
107
- o(
107
+ s(
108
108
  "div",
109
109
  {
110
110
  class: "use-component"
111
111
  },
112
- o(
112
+ s(
113
113
  l,
114
114
  {
115
115
  ...i,
@@ -120,13 +120,13 @@ const se = _({
120
120
  V
121
121
  )
122
122
  ),
123
- o(
123
+ s(
124
124
  "div",
125
125
  {
126
126
  class: "use-code"
127
127
  },
128
- o(E, {
129
- name: s.name,
128
+ s(E, {
129
+ name: o.name,
130
130
  param: a,
131
131
  value: i,
132
132
  propsText: n.propsText,
@@ -134,24 +134,24 @@ const se = _({
134
134
  slotValue: r.slotValue
135
135
  })
136
136
  ),
137
- o(
137
+ s(
138
138
  "div",
139
139
  {
140
140
  class: "use-emit"
141
141
  },
142
- o(y, {
143
- name: s.name,
142
+ s(y, {
143
+ name: o.name,
144
144
  list: c,
145
145
  value: r.emitValue
146
146
  })
147
147
  ),
148
- o(
148
+ s(
149
149
  "div",
150
150
  {
151
151
  class: "use-expose"
152
152
  },
153
- o(O, {
154
- name: s.name,
153
+ s(O, {
154
+ name: o.name,
155
155
  list: h,
156
156
  getRef: () => v,
157
157
  onChange: (t) => {
@@ -159,13 +159,13 @@ const se = _({
159
159
  }
160
160
  })
161
161
  ),
162
- o(
162
+ s(
163
163
  "div",
164
164
  {
165
165
  class: "use-slot"
166
166
  },
167
- o($, {
168
- name: s.name,
167
+ s($, {
168
+ name: o.name,
169
169
  list: x,
170
170
  onChange: (t, e) => {
171
171
  r.slotValue[t] = e;
@@ -191,5 +191,5 @@ const se = _({
191
191
  // },
192
192
  });
193
193
  export {
194
- se as default
194
+ oe as default
195
195
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.19",
4
+ "version": "0.0.20",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",