@fangzhongya/vue-archive 0.0.76 → 0.0.77

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.
Files changed (27) hide show
  1. package/dist/node/index.cjs +145 -108
  2. package/dist/node/index.js +145 -108
  3. package/dist/packages/components/use/code.cjs +12 -12
  4. package/dist/packages/components/use/code.d.ts +25 -17
  5. package/dist/packages/components/use/code.js +92 -92
  6. package/dist/packages/components/use/edit.cjs +5 -5
  7. package/dist/packages/components/use/edit.js +63 -63
  8. package/dist/packages/components/use/retrie/any/index.vue.cjs +1 -1
  9. package/dist/packages/components/use/retrie/any/index.vue.js +27 -49
  10. package/dist/packages/components/use/retrie/choice/index.d.ts +33 -2
  11. package/dist/packages/components/use/retrie/choice/index.vue.cjs +1 -1
  12. package/dist/packages/components/use/retrie/choice/index.vue.js +24 -27
  13. package/dist/packages/components/use/retrie/input/editor/editor.cjs +1 -1
  14. package/dist/packages/components/use/retrie/input/editor/editor.js +50 -29
  15. package/dist/packages/components/use/retrie/input/editor/getExtraLib.cjs +416 -0
  16. package/dist/packages/components/use/retrie/input/editor/getExtraLib.d.ts +2 -0
  17. package/dist/packages/components/use/retrie/input/editor/getExtraLib.js +427 -0
  18. package/dist/packages/components/use/retrie/other/index.d.ts +13 -12
  19. package/dist/packages/components/use/retrie/other/index.vue.cjs +1 -1
  20. package/dist/packages/components/use/retrie/other/index.vue.js +1 -1
  21. package/dist/packages/components/use/retrie/select/index.d.ts +33 -2
  22. package/dist/packages/components/use/retrie/select/index.vue.cjs +1 -1
  23. package/dist/packages/components/use/retrie/select/index.vue.js +26 -26
  24. package/dist/packages/components/use/util.cjs +3 -3
  25. package/dist/packages/components/use/util.d.ts +23 -25
  26. package/dist/packages/components/use/util.js +161 -136
  27. package/package.json +1 -1
@@ -1,20 +1,20 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const J=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const N=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const L=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const l=require("./util.cjs"),T=require("../../utils/props.cjs"),A=require("@fangzhongya/utils/basic/string/toFunction"),M=["class"];function q(e,n){return e.filter(s=>s.name==n)[0]}function x(e){return e.map(n=>(n.prop||"...arr")+":"+l.setDataType(n.dataType)).join(",")}async function Z(e,n,s,t,o,h){const g=[],r=[];let b=!0;const B=T.getPropsValue(n.propss||[]),C=T.getEmitsValue(n.emitss||[]),H=T.getExposeValue(n.exposes||[]),U=T.getSlotValue(n.slots||[]);Object.keys(s).forEach(async i=>{let u=s[i];if(/^on[A-Z]/.test(i)&&typeof u=="function"){let c=i.substring(2);const f=i.split(":");let a;if(f.length>1?(a=f[0]+f.slice(1).map(m=>L.firstUpper(m)).join(""),c=N.firstLower(c)):(a=f[0],c=J.humpToLine(c)),f.includes("-")){let m=a.split("-");m=m.map(($,F)=>F!=0?L.firstUpper($):$),a=m.join("")}g.push(" @"+c+'="'+a+'"');const p=q(C,c)||{},d=p.selectable||"",S=l.parseParamString(d),y=x(S);r.push(`// ${p.description} ${p.name}: (${p.selectable})`),r.push("function "+a+"("+y+") {"),S.forEach(m=>{const $=m.name||"arr";r.push(" console.log('"+m.label+"', "+$+")")}),r.push("}")}else{let c=i;M.includes(i)&&(c=i+"1"),g.push(" :"+i+'="'+c+'"');const f=q(B,i)||{},a=O(f);if(r.push(`// ${f.description} ${f.name}: {${f.type}} (${f.selectable})`),typeof u=="function"||a.dataType.length==1&&a.type=="function"&&u)r.push("const "+i+" = "+await v(u,i,o));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof u>"u")if(a.type=="function"){const p=I(f);r.push("const "+c+" = "+p+";")}else{const p=l.getTypeValue(a.dataType);r.push("const "+c+" = ref("+(p==="undefined"?"":p)+");")}else{let p=D(u,i,o);r.push("const "+c+" = ref("+p+");")}}});const P=Object.values(h||{});P.length>0&&(b&&(b=!1,r.unshift("import { ref } from 'vue';")),g.unshift(' ref="refDom"'),r.push("const refDom = ref()"),P.forEach(i=>{const u=q(H,i.name)||{};r.push(`// ${u.description} ${u.name}:(${u.selectable}) ${u.type}`);const c=i.name+"Value",f=l.parseParamString(u?.selectable||""),a=[],p=i.params||[];f.forEach((d,S)=>{const y=d.name;if(y){const m=y+i.name,$=p[S];if(r.push(`// ${d.label}`),typeof $=="function")r.push("const "+m+" = "+v($,y,i.text));else if(typeof $>"u")r.push("const "+m+" = "+l.getTypeValue(d.dataType)+";");else{let F=D($,y,i.text);r.push("const "+m+" = "+F+";")}a.push(m)}}),i.type==="function"?(u.return?r.push(`const ${c} = refDom.value?.${i.name}(${a.join(", ")})`):r.push(`refDom.value?.${i.name}(${a.join(", ")})`),u.return&&r.push(`console.log('${u.return}', ${c})`)):(r.push(`const ${c} = refDom.value?.${i.name}`),r.push(`console.log('${u.type||u.name}', ${c})`))})),g.length>0&&g.unshift("");const z=G(t,U);let V=`<template>
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const N=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const A=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const L=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const o=require("./util.cjs"),S=require("../../utils/props.cjs"),C=require("@fangzhongya/utils/basic/string/toFunction"),M=["class"];function q(e,n){return e.filter(t=>t.name==n)[0]}function x(e){return e.map(n=>(n.prop||"...arr")+":"+o.setDataType(n.dataType)).join(",")}async function Z(e,n,t,s,u,y){const g=[],r=[];let T=!0;const B=S.getPropsValue(n.propss||[]),H=S.getEmitsValue(n.emitss||[]),U=S.getExposeValue(n.exposes||[]),z=S.getSlotValue(n.slots||[]);Object.keys(t).forEach(async i=>{let c=t[i];if(/^on[A-Z]/.test(i)&&typeof c=="function"){let a=i.substring(2);const f=i.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(m=>L.firstUpper(m)).join(""),a=A.firstLower(a)):(l=f[0],a=N.humpToLine(a)),f.includes("-")){let m=l.split("-");m=m.map((h,D)=>D!=0?L.firstUpper(h):h),l=m.join("")}g.push(" @"+a+'="'+l+'"');const p=q(H,a)||{},d=p.selectable||"",b=o.parseParamString(d),$=x(b);r.push(`// ${p.description} ${p.name}: (${p.selectable})`),r.push("function "+l+"("+$+") {"),b.forEach(m=>{const h=m.name||"arr";r.push(" console.log('"+m.label+"', "+h+")")}),r.push("}")}else{let a=i;M.includes(i)&&(a=i+"1"),g.push(" :"+i+'="'+a+'"');const f=q(B,i)||{},l=O(f);if(r.push(`// ${f.description} ${f.name}: {${f.type}} (${f.selectable})`),typeof c=="function"||l.dataType.length==1&&l.type=="function"&&c)r.push("const "+i+" = "+await v(c,i,u));else if(T&&(T=!1,r.unshift("import { ref } from 'vue';")),typeof c>"u")if(l.type=="function"){const p=I(f);r.push("const "+a+" = "+p+";")}else{const p=o.getTypeValue(l.dataType);r.push("const "+a+" = ref("+(p==="undefined"?"":p)+");")}else{let p=w(c,i,u);r.push("const "+a+" = ref("+p+");")}}});const P=Object.values(y||{});P.length>0&&(T&&(T=!1,r.unshift("import { ref } from 'vue';")),g.unshift(' ref="refDom"'),r.push("const refDom = ref()"),P.forEach(i=>{const c=q(U,i.name)||{};r.push(`// ${c.description} ${c.name}:(${c.selectable}) ${c.type}`);const a=i.name+"Value",f=o.parseParamString(c?.selectable||""),l=[],p=i.params||[];f.forEach((d,b)=>{const $=d.name;if($){const m=$+i.name,h=p[b];if(r.push(`// ${d.label}`),typeof h=="function")r.push("const "+m+" = "+v(h,$,i.text));else if(typeof h>"u")r.push("const "+m+" = "+o.getTypeValue(d.dataType)+";");else{let D=w(h,$,i.text);r.push("const "+m+" = "+D+";")}l.push(m)}}),i.type==="function"?(c.return?r.push(`const ${a} = refDom.value?.${i.name}(${l.join(", ")})`):r.push(`refDom.value?.${i.name}(${l.join(", ")})`),c.return&&r.push(`console.log('${c.return}', ${a})`)):(r.push(`const ${a} = refDom.value?.${i.name}`),r.push(`console.log('${c.type||c.name}', ${a})`))})),g.length>0&&g.unshift("");const J=G(s,z);let V=`<template>
2
2
  <div>
3
3
  <${e}${g.join(`
4
- `)}>${z.join(`
4
+ `)}>${J.join(`
5
5
  `)}
6
6
  </${e}>
7
7
  </div>
8
- </template>`;V=await l.prettierHtml(V);let j=r.join(`
9
- `);return j=await l.prettierTs(j),`<!--${e}-->
8
+ </template>`;V=await o.prettierHtml(V);let j=r.join(`
9
+ `);return j=await o.prettierTs(j),`<!--${e}-->
10
10
  ${V}
11
11
  <script lang="ts" setup>
12
12
  ${j}
13
- <\/script>`}function G(e={},n){const s=[];return Object.keys(e).forEach(t=>{const o=q(n,t)||{},h=e[t];if(h){const g=` <!-- ${o.description} ${o.name}:(${o.selectable}) -->
14
- <template #${t}="scope">
15
- ${l.vueFormat(h," ")}
16
- </template>`;s.push(g)}}),s&&s.length>0&&s.unshift(""),s}function v(e,n,s){const t=s?s[n]:"";return t&&(t.includes("=>")||t.includes("function"))?t:w(e.toString())}async function w(e){const n=A.getFunctionFormat(e);if(n){let s=`{
17
- ${l.vueFormat(l.getFunBody(n.body)," ")}
18
- }`;return`function (${n.param.split(",").map(t=>t+":any").join(",")}) ${s}`}else return"undefined"}function I(e){const n=l.parseParamString(e.selectable),s=x(n);let t="";e.return&&(t="return ");let o=`{
19
- ${l.vueFormat(l.getFunBody(t)," ")}
20
- }`;return`function (${s}) ${o}`}function K(e){const n=e.trim();return/^\(/.test(n)?w(n):JSON.stringify(e)}function D(e,n,s){const t=s?s[n]:"";return t||(typeof e=="string"?K(e+""):JSON.stringify(e))}function O(e){let n=l.parseTypeDefinition(e?.type),s=n.dataType,t=n.type;t=t.split("<")[0],t=t.trim().toLowerCase(),s.length>1&&(t="any");let o=(e?.selectable||"").trim(),h=[];return o&&t!="boolean"&&(o.includes("|")?o.split("|").forEach(g=>{if(g){let r=g.split(":");h.push({label:g,prop:E(r[0].trim())})}}):h=l.parseParamString(o),t=="array"?t="choice":t!="function"&&h.length>1&&(t="select")),{arr:h,type:t,dataType:s}}function E(e,n){try{if(n?.toLowerCase()=="function")if(typeof e=="string"){if(/^\((.|\n|\r)*\)$/.test(e))return e=e.substring(1,e.length-1),new Function(`{ return ${e} }`)()}else return e;else return new Function(`{ return ${e} }`)()}catch{return""+e}}function Q(e,n=!0){const s=O(e),t=l.getTypeValue(s.dataType);if(n){const o=(e.default||"").trim();return E(o||t,s.dataType[0])}else{const o=(e.default||"").trim();return E(o,s.dataType[0])}}exports.getDefaultValue=Q;exports.getHmtl=Z;exports.getSpecType=O;exports.setValStringify=D;
13
+ <\/script>`}function G(e={},n){const t=[];return Object.keys(e).forEach(s=>{const u=q(n,s)||{},y=e[s];if(y){const g=` <!-- ${u.description} ${u.name}:(${u.selectable}) -->
14
+ <template #${s}="scope">
15
+ ${o.vueFormat(y," ")}
16
+ </template>`;t.push(g)}}),t&&t.length>0&&t.unshift(""),t}function v(e,n,t){const s=t?t[n]:"";return s&&(s.includes("=>")||s.includes("function"))?s:F(e.toString())}async function F(e){const n=C.getFunctionFormat(e);if(n){let t=`{
17
+ ${o.vueFormat(o.getFunBody(n.body)," ")}
18
+ }`;return`function (${n.param.split(",").map(s=>s+":any").join(",")}) ${t}`}else return"undefined"}function I(e){const n=o.parseParamString(e.selectable),t=x(n);let s="";e.return&&(s="return ");let u=`{
19
+ ${o.vueFormat(o.getFunBody(s)," ")}
20
+ }`;return`function (${t}) ${u}`}function K(e){const n=e.trim();return/^\(/.test(n)?F(n):JSON.stringify(e)}function w(e,n,t){const s=t?t[n]:"";return s||(typeof e=="string"?K(e+""):JSON.stringify(e))}function O(e){let n=o.getDataType(o.parseTypeDefinition(e?.type)),t=o.getDataTypeType(n);n.length>1&&(t="any");let s=(e?.selectable||"").trim(),u=[];return s&&t!="boolean"&&(s.includes("|")?s.split("|").forEach(y=>{if(y){let g=y.split(":");u.push({label:y,prop:E(g[0].trim())})}}):u=o.parseParamString(s),t=="array"?t="choice":t!="function"&&u.length>1&&(t="select")),{arr:u,type:t,dataType:n}}function E(e,n){try{if(n=="function")if(typeof e=="string"){if(/^\((.|\n|\r)*\)$/.test(e))return e=e.substring(1,e.length-1),new Function(`{ return ${e} }`)()}else return e;else return new Function(`{ return ${e} }`)()}catch{return""+e}}function Q(e,n=!0){const t=O(e),s=o.getTypeValue(t.dataType);if(n){const u=(e.default||"").trim();return E(u||s,o.getDataTypeType(t.dataType))}else{const u=(e.default||"").trim();return E(u,o.getDataTypeType(t.dataType))}}exports.getDefaultValue=Q;exports.getHmtl=Z;exports.getSpecType=O;exports.setValStringify=w;
@@ -1,17 +1,25 @@
1
- import { ObjStr, ObjUnk } from '../../config';
2
- import { SpecObjs, Spec } from '../../utils/index';
3
- export declare function getHmtl(propsname: string, param: {
4
- [key: string]: SpecObjs[];
5
- }, value: ObjUnk, slotValue?: ObjStr, propsText?: ObjStr, exposeText?: ObjUnk): Promise<string>;
6
- export declare function setValStringify(v: unknown, key: string, propsText?: ObjStr): string | Promise<string>;
7
- type SelectsObj = {
8
- label: string;
9
- prop: unknown;
10
- };
11
- export declare function getSpecType(val: Spec): {
12
- arr: SelectsObj[];
13
- type: string;
14
- dataType: string[];
15
- };
16
- export declare function getDefaultValue(obj: Spec, is?: boolean): any;
17
- 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,53 +1,53 @@
1
1
  import "@fangzhongya/utils/basic/object/mergeObject";
2
2
  import "@fangzhongya/utils/basic/array/toggleArray";
3
- import { humpToLine as q } from "@fangzhongya/utils/name/humpToLine";
3
+ import { humpToLine as v } from "@fangzhongya/utils/name/humpToLine";
4
4
  import "@fangzhongya/utils/name/lineToLargeHump";
5
5
  import "@fangzhongya/utils/basic/string/appearNum";
6
- import { firstLower as v } from "@fangzhongya/utils/basic/string/firstLower";
6
+ import { firstLower as G } from "@fangzhongya/utils/basic/string/firstLower";
7
7
  import "@fangzhongya/utils/basic/array/duplicateRemoval";
8
8
  import "@fangzhongya/utils/basic/array/asyncMergeArray";
9
- import { firstUpper as L } from "@fangzhongya/utils/basic/string/firstUpper";
9
+ import { firstUpper as z } from "@fangzhongya/utils/basic/string/firstUpper";
10
10
  import "@fangzhongya/utils/urls/getSuffix";
11
11
  import "@fangzhongya/utils/basic/array/replaceAfter";
12
- import { getTypeValue as D, parseParamString as j, prettierHtml as G, prettierTs as I, parseTypeDefinition as K, setDataType as M, vueFormat as O, getFunBody as z } from "./util.js";
13
- import { getPropsValue as Q, getEmitsValue as R, getExposeValue as W, getSlotValue as X } from "../../utils/props.js";
14
- import { getFunctionFormat as Y } from "@fangzhongya/utils/basic/string/toFunction";
15
- const _ = ["class"];
12
+ import { getTypeValue as E, getDataTypeType as F, parseParamString as j, prettierHtml as I, prettierTs as K, getDataType as M, parseTypeDefinition as Q, setDataType as R, vueFormat as x, getFunBody as J } from "./util.js";
13
+ import { getPropsValue as W, getEmitsValue as X, getExposeValue as Y, getSlotValue as _ } from "../../utils/props.js";
14
+ import { getFunctionFormat as k } from "@fangzhongya/utils/basic/string/toFunction";
15
+ const tt = ["class"];
16
16
  function T(t, n) {
17
- return t.filter((s) => s.name == n)[0];
17
+ return t.filter((e) => e.name == n)[0];
18
18
  }
19
- function B(t) {
20
- return t.map((n) => (n.prop || "...arr") + ":" + M(n.dataType)).join(",");
19
+ function L(t) {
20
+ return t.map((n) => (n.prop || "...arr") + ":" + R(n.dataType)).join(",");
21
21
  }
22
- async function yt(t, n, s, e, i, h) {
22
+ async function bt(t, n, e, s, i, $) {
23
23
  const m = [], r = [];
24
24
  let d = !0;
25
- const J = Q(n.propss || []), N = R(n.emitss || []), A = W(n.exposes || []), U = X(n.slots || []);
26
- Object.keys(s).forEach(async (o) => {
27
- let c = s[o];
25
+ const A = W(n.propss || []), C = X(n.emitss || []), U = Y(n.exposes || []), Z = _(n.slots || []);
26
+ Object.keys(e).forEach(async (o) => {
27
+ let c = e[o];
28
28
  if (/^on[A-Z]/.test(o) && typeof c == "function") {
29
29
  let u = o.substring(2);
30
30
  const a = o.split(":");
31
31
  let l;
32
- if (a.length > 1 ? (l = a[0] + a.slice(1).map((p) => L(p)).join(""), u = v(u)) : (l = a[0], u = q(u)), a.includes("-")) {
32
+ if (a.length > 1 ? (l = a[0] + a.slice(1).map((p) => z(p)).join(""), u = G(u)) : (l = a[0], u = v(u)), a.includes("-")) {
33
33
  let p = l.split("-");
34
- p = p.map(($, w) => w != 0 ? L($) : $), l = p.join("");
34
+ p = p.map((h, V) => V != 0 ? z(h) : h), l = p.join("");
35
35
  }
36
36
  m.push(" @" + u + '="' + l + '"');
37
- const f = T(N, u) || {}, y = f.selectable || "", b = j(y), g = B(b);
37
+ const f = T(C, u) || {}, y = f.selectable || "", b = j(y), g = L(b);
38
38
  r.push(`// ${f.description} ${f.name}: (${f.selectable})`), r.push("function " + l + "(" + g + ") {"), b.forEach((p) => {
39
- const $ = p.name || "arr";
40
- r.push(" console.log('" + p.label + "', " + $ + ")");
39
+ const h = p.name || "arr";
40
+ r.push(" console.log('" + p.label + "', " + h + ")");
41
41
  }), r.push("}");
42
42
  } else {
43
43
  let u = o;
44
- _.includes(o) && (u = o + "1"), m.push(" :" + o + '="' + u + '"');
45
- const a = T(J, o) || {}, l = H(a);
44
+ tt.includes(o) && (u = o + "1"), m.push(" :" + o + '="' + u + '"');
45
+ const a = T(A, o) || {}, l = N(a);
46
46
  if (r.push(
47
47
  `// ${a.description} ${a.name}: {${a.type}} (${a.selectable})`
48
48
  ), typeof c == "function" || l.dataType.length == 1 && l.type == "function" && c)
49
49
  r.push(
50
- "const " + o + " = " + await C(
50
+ "const " + o + " = " + await B(
51
51
  c,
52
52
  o,
53
53
  i
@@ -55,23 +55,23 @@ async function yt(t, n, s, e, i, h) {
55
55
  );
56
56
  else if (d && (d = !1, r.unshift("import { ref } from 'vue';")), typeof c > "u")
57
57
  if (l.type == "function") {
58
- const f = tt(a);
58
+ const f = nt(a);
59
59
  r.push("const " + u + " = " + f + ";");
60
60
  } else {
61
- const f = D(l.dataType);
61
+ const f = E(l.dataType);
62
62
  r.push(
63
63
  "const " + u + " = ref(" + (f === "undefined" ? "" : f) + ");"
64
64
  );
65
65
  }
66
66
  else {
67
- let f = P(c, o, i);
67
+ let f = H(c, o, i);
68
68
  r.push("const " + u + " = ref(" + f + ");");
69
69
  }
70
70
  }
71
71
  });
72
- const x = Object.values(h || {});
73
- x.length > 0 && (d && (d = !1, r.unshift("import { ref } from 'vue';")), m.unshift(' ref="refDom"'), r.push("const refDom = ref()"), x.forEach((o) => {
74
- const c = T(A, o.name) || {};
72
+ const P = Object.values($ || {});
73
+ P.length > 0 && (d && (d = !1, r.unshift("import { ref } from 'vue';")), m.unshift(' ref="refDom"'), r.push("const refDom = ref()"), P.forEach((o) => {
74
+ const c = T(U, o.name) || {};
75
75
  r.push(
76
76
  `// ${c.description} ${c.name}:(${c.selectable}) ${c.type}`
77
77
  );
@@ -79,18 +79,18 @@ async function yt(t, n, s, e, i, h) {
79
79
  a.forEach((y, b) => {
80
80
  const g = y.name;
81
81
  if (g) {
82
- const p = g + o.name, $ = f[b];
83
- if (r.push(`// ${y.label}`), typeof $ == "function")
82
+ const p = g + o.name, h = f[b];
83
+ if (r.push(`// ${y.label}`), typeof h == "function")
84
84
  r.push(
85
- "const " + p + " = " + C($, g, o.text)
85
+ "const " + p + " = " + B(h, g, o.text)
86
86
  );
87
- else if (typeof $ > "u")
87
+ else if (typeof h > "u")
88
88
  r.push(
89
- "const " + p + " = " + D(y.dataType) + ";"
89
+ "const " + p + " = " + E(y.dataType) + ";"
90
90
  );
91
91
  else {
92
- let w = P($, g, o.text);
93
- r.push("const " + p + " = " + w + ";");
92
+ let V = H(h, g, o.text);
93
+ r.push("const " + p + " = " + V + ";");
94
94
  }
95
95
  l.push(p);
96
96
  }
@@ -100,89 +100,89 @@ async function yt(t, n, s, e, i, h) {
100
100
  )})`
101
101
  ) : r.push(`refDom.value?.${o.name}(${l.join(", ")})`), c.return && r.push(`console.log('${c.return}', ${u})`)) : (r.push(`const ${u} = refDom.value?.${o.name}`), r.push(`console.log('${c.type || c.name}', ${u})`));
102
102
  })), m.length > 0 && m.unshift("");
103
- const Z = k(e, U);
103
+ const q = et(s, Z);
104
104
  let S = `<template>
105
105
  <div>
106
106
  <${t}${m.join(`
107
- `)}>${Z.join(`
107
+ `)}>${q.join(`
108
108
  `)}
109
109
  </${t}>
110
110
  </div>
111
111
  </template>`;
112
- S = await G(S);
113
- let V = r.join(`
112
+ S = await I(S);
113
+ let D = r.join(`
114
114
  `);
115
- return V = await I(V), `<!--${t}-->
115
+ return D = await K(D), `<!--${t}-->
116
116
  ${S}
117
117
  <script lang="ts" setup>
118
- ${V}
118
+ ${D}
119
119
  <\/script>`;
120
120
  }
121
- function k(t = {}, n) {
122
- const s = [];
123
- return Object.keys(t).forEach((e) => {
124
- const i = T(n, e) || {}, h = t[e];
125
- if (h) {
121
+ function et(t = {}, n) {
122
+ const e = [];
123
+ return Object.keys(t).forEach((s) => {
124
+ const i = T(n, s) || {}, $ = t[s];
125
+ if ($) {
126
126
  const m = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
127
- <template #${e}="scope">
128
- ${O(h, " ")}
127
+ <template #${s}="scope">
128
+ ${x($, " ")}
129
129
  </template>`;
130
- s.push(m);
130
+ e.push(m);
131
131
  }
132
- }), s && s.length > 0 && s.unshift(""), s;
132
+ }), e && e.length > 0 && e.unshift(""), e;
133
133
  }
134
- function C(t, n, s) {
135
- const e = s ? s[n] : "";
136
- return e && (e.includes("=>") || e.includes("function")) ? e : E(t.toString());
134
+ function B(t, n, e) {
135
+ const s = e ? e[n] : "";
136
+ return s && (s.includes("=>") || s.includes("function")) ? s : w(t.toString());
137
137
  }
138
- async function E(t) {
139
- const n = Y(t);
138
+ async function w(t) {
139
+ const n = k(t);
140
140
  if (n) {
141
- let s = `{
142
- ${O(z(n.body), " ")}
141
+ let e = `{
142
+ ${x(J(n.body), " ")}
143
143
  }`;
144
- return `function (${n.param.split(",").map((e) => e + ":any").join(",")}) ${s}`;
144
+ return `function (${n.param.split(",").map((s) => s + ":any").join(",")}) ${e}`;
145
145
  } else
146
146
  return "undefined";
147
147
  }
148
- function tt(t) {
149
- const n = j(t.selectable), s = B(n);
150
- let e = "";
151
- t.return && (e = "return ");
148
+ function nt(t) {
149
+ const n = j(t.selectable), e = L(n);
150
+ let s = "";
151
+ t.return && (s = "return ");
152
152
  let i = `{
153
- ${O(z(e), " ")}
153
+ ${x(J(s), " ")}
154
154
  }`;
155
- return `function (${s}) ${i}`;
155
+ return `function (${e}) ${i}`;
156
156
  }
157
- function et(t) {
157
+ function st(t) {
158
158
  const n = t.trim();
159
- return /^\(/.test(n) ? E(n) : JSON.stringify(t);
159
+ return /^\(/.test(n) ? w(n) : JSON.stringify(t);
160
160
  }
161
- function P(t, n, s) {
162
- const e = s ? s[n] : "";
163
- return e || (typeof t == "string" ? et(t + "") : JSON.stringify(t));
161
+ function H(t, n, e) {
162
+ const s = e ? e[n] : "";
163
+ return s || (typeof t == "string" ? st(t + "") : JSON.stringify(t));
164
164
  }
165
- function H(t) {
166
- let n = K(t?.type), s = n.dataType, e = n.type;
167
- e = e.split("<")[0], e = e.trim().toLowerCase(), s.length > 1 && (e = "any");
168
- let i = (t?.selectable || "").trim(), h = [];
169
- return i && e != "boolean" && (i.includes("|") ? i.split("|").forEach((m) => {
170
- if (m) {
171
- let r = m.split(":");
172
- h.push({
173
- label: m,
174
- prop: F(r[0].trim())
165
+ function N(t) {
166
+ let n = M(Q(t?.type)), e = F(n);
167
+ n.length > 1 && (e = "any");
168
+ let s = (t?.selectable || "").trim(), i = [];
169
+ return s && e != "boolean" && (s.includes("|") ? s.split("|").forEach(($) => {
170
+ if ($) {
171
+ let m = $.split(":");
172
+ i.push({
173
+ label: $,
174
+ prop: O(m[0].trim())
175
175
  });
176
176
  }
177
- }) : h = j(i), e == "array" ? e = "choice" : e != "function" && h.length > 1 && (e = "select")), {
178
- arr: h,
177
+ }) : i = j(s), e == "array" ? e = "choice" : e != "function" && i.length > 1 && (e = "select")), {
178
+ arr: i,
179
179
  type: e,
180
- dataType: s
180
+ dataType: n
181
181
  };
182
182
  }
183
- function F(t, n) {
183
+ function O(t, n) {
184
184
  try {
185
- if (n?.toLowerCase() == "function")
185
+ if (n == "function")
186
186
  if (typeof t == "string") {
187
187
  if (/^\((.|\n|\r)*\)$/.test(t))
188
188
  return t = t.substring(1, t.length - 1), new Function(`{ return ${t} }`)();
@@ -194,19 +194,19 @@ function F(t, n) {
194
194
  return "" + t;
195
195
  }
196
196
  }
197
- function dt(t, n = !0) {
198
- const s = H(t), e = D(s.dataType);
197
+ function Tt(t, n = !0) {
198
+ const e = N(t), s = E(e.dataType);
199
199
  if (n) {
200
200
  const i = (t.default || "").trim();
201
- return F(i || e, s.dataType[0]);
201
+ return O(i || s, F(e.dataType));
202
202
  } else {
203
203
  const i = (t.default || "").trim();
204
- return F(i, s.dataType[0]);
204
+ return O(i, F(e.dataType));
205
205
  }
206
206
  }
207
207
  export {
208
- dt as getDefaultValue,
209
- yt as getHmtl,
210
- H as getSpecType,
211
- P as setValStringify
208
+ Tt as getDefaultValue,
209
+ bt as getHmtl,
210
+ N as getSpecType,
211
+ H as setValStringify
212
212
  };
@@ -1,6 +1,6 @@
1
- "use strict";const e=require("vue"),_=require("./code.vue.cjs"),f=require("./retrie/input/index.vue.cjs");;/* empty css */const g=require("./effect.vue.cjs"),d=require("./util.cjs");function b(c){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const l in c)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(c,l);Object.defineProperty(a,l,u.get?u:{enumerable:!0,get:()=>c[l]})}}return a.default=c,Object.freeze(a)}const h=b(e),j=e.defineComponent({props:{value:{type:Object},param:{type:Object}},data(){return{template:"",script:"",style:"",vueHtml:""}},setup(c){function a(s){const r=document.getElementsByTagName("head")[0],i="data-vite-dev-id",o=s+".css",p=r.querySelector(`style[${i}="${o}"]`);if(p)return p;{let t=document.createElement("style");return t.appendChild(document.createTextNode("")),t.setAttribute("type","text/css"),t.setAttribute(i,o),r.appendChild(t),t}}async function l(s,r="",i){const o=[],p=c.value?.name;let t="";Object.keys(h).forEach(y=>{r.includes(y+"(")&&o.push(y)}),o.length>0&&(t=`import { ${o.join(" , ")} } from 'vue';`);let m=`<template>
1
+ "use strict";const t=require("vue"),_=require("./code.vue.cjs"),f=require("./retrie/input/index.vue.cjs");;/* empty css */const g=require("./effect.vue.cjs"),d=require("./util.cjs");function b(c){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const i in c)if(i!=="default"){const u=Object.getOwnPropertyDescriptor(c,i);Object.defineProperty(a,i,u.get?u:{enumerable:!0,get:()=>c[i]})}}return a.default=c,Object.freeze(a)}const y=b(t),j=t.defineComponent({props:{value:{type:Object},param:{type:Object}},data(){return{template:"",script:"",style:"",vueHtml:""}},setup(c){function a(s){const r=document.getElementsByTagName("head")[0],l="data-vite-dev-id",o=s+".css",p=r.querySelector(`style[${l}="${o}"]`);if(p)return p;{let e=document.createElement("style");return e.appendChild(document.createTextNode("")),e.setAttribute("type","text/css"),e.setAttribute(l,o),r.appendChild(e),e}}async function i(s,r="",l){const o=[],p=c.value?.name;let e="";Object.keys(y).forEach(h=>{r.includes(h+"(")&&o.push(h)}),o.length>0&&(e=`import { ${o.join(" , ")} } from 'vue';`);let m=`<template>
2
2
  ${s}
3
- </template>`;m=await d.prettierHtml(m);let v=`${t}
3
+ </template>`;m=await d.prettierHtml(m);let v=`${e}
4
4
  export default {
5
5
  setup(props, ctx) {
6
6
  ${r}
@@ -11,8 +11,8 @@ ${m}
11
11
  ${v}
12
12
  <\/script>
13
13
  <style>
14
- ${i}
14
+ ${l}
15
15
  </style>
16
- `}function u(s,r,i){try{const o=Object.keys(h);return new Function("props","ctx","vue",` "use strict";
16
+ `}function u(s,r,l){try{const o=Object.keys(y);return new Function("props","ctx","vue",` "use strict";
17
17
  const { ${o.join(",")} } = vue;
18
- ${s}; `)(r,i,h)}catch(o){console.error("Code block execution failed:",o)}}const n=e.ref(null);return e.onMounted(()=>{n.value=a(c.value?.key)}),{getHmtlVue:l,getCodeBlock:u,style:n}},render(c,a,l,u,n){const s=l.value||{};let r="div";s.component?r=e.defineAsyncComponent(s.component):s.name&&(r=e.resolveComponent(s.name));const i={};i[s.name]=r;const o=async()=>{const t=await u.getHmtlVue(n.template,n.script,n.style);n.vueHtml=t},p=()=>{u.style.innerHTML=n.style,o()};return e.h("div",{class:"code-edit"},[e.h("div",{class:"edit-effect use"},[e.h(g,{class:"use-component"},{default:()=>e.h(e.defineComponent({components:i,setup(t,m){return u.getCodeBlock(n.script,t,m)},template:n.template||"<div></div>"}))}),e.h(_,{html:n.vueHtml,name:s.name+"_edit",onRefresh:o})]),e.h("div",{class:"edit-input"},[e.h("div",{class:"but-div",onClick:p},"运行"),e.h("div",{},[e.h("div",{},"template"),e.h("div",{},e.h(f,{format:"html",check:t=>t,options:[s.name],modelValue:n.template,"onUpdate:modelValue":async t=>{n.template=await d.prettierHtml(t)}}))]),e.h("div",{},[e.h("div",{},"script"),e.h("div",{},"setup(props, ctx)"),e.h("div",{},e.h(f,{format:"js",check:t=>t,options:["props","ctx"],modelValue:n.script,"onUpdate:modelValue":async t=>{n.script=await d.prettierJs(t)}}))]),e.h("div",{},[e.h("div",{},"style"),e.h("div",{},e.h(f,{format:"css",check:t=>t,modelValue:n.style,"onUpdate:modelValue":async t=>{n.style=await d.prettierCss(t)}}))])])])}});module.exports=j;
18
+ ${s}; `)(r,l,y)}catch(o){console.error("Code block execution failed:",o)}}const n=t.ref(null);return t.onMounted(()=>{n.value=a(c.value?.key)}),{getHmtlVue:i,getCodeBlock:u,style:n}},render(c,a,i,u,n){const s=i.value||{};let r="div";s.component?r=t.defineAsyncComponent(s.component):s.name&&(r=t.resolveComponent(s.name));const l={};l[s.name]=r;const o=async()=>{const e=await u.getHmtlVue(n.template,n.script,n.style);n.vueHtml=e},p=()=>{u.style.innerHTML=n.style,o()};return t.h("div",{class:"code-edit"},[t.h("div",{class:"edit-effect use"},[t.h(g,{class:"use-component"},{default:()=>t.h(t.defineComponent({components:l,setup(e,m){return u.getCodeBlock(n.script,e,m)},template:n.template||"<div></div>"}))}),t.h(_,{html:n.vueHtml,name:s.name+"_edit",onRefresh:o})]),t.h("div",{class:"edit-input"},[t.h("div",{class:"but-div",onClick:p},"运行"),t.h("div",{},[t.h("div",{},"template"),t.h("div",{},t.h(f,{format:"html",check:e=>e,options:[s.name],modelValue:n.template,"onUpdate:modelValue":async e=>{n.template=e,n.template=await d.prettierHtml(e)}}))]),t.h("div",{},[t.h("div",{},"script"),t.h("div",{},"setup(props, ctx)"),t.h("div",{},t.h(f,{format:"js",check:e=>e,options:["props","ctx"],modelValue:n.script,"onUpdate:modelValue":async e=>{n.script=e,n.script=await d.prettierJs(e)}}))]),t.h("div",{},[t.h("div",{},"style"),t.h("div",{},t.h(f,{format:"css",check:e=>e,modelValue:n.style,"onUpdate:modelValue":async e=>{n.style=e,n.style=await d.prettierCss(e)}}))])])])}});module.exports=j;