@fangzhongya/vue-archive 0.0.69 → 0.0.70

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