@fangzhongya/vue-archive 0.0.54 → 0.0.56

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 (55) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/node/index.cjs +83 -30
  3. package/dist/node/index.js +83 -30
  4. package/dist/packages/components/choice/index.vue.cjs +1 -1
  5. package/dist/packages/components/code/highlight.vue.cjs +1 -1
  6. package/dist/packages/components/code/index.vue.cjs +1 -1
  7. package/dist/packages/components/compo/code.vue.cjs +1 -0
  8. package/dist/packages/components/compo/code.vue.js +21 -0
  9. package/dist/packages/components/compo/code.vue3.cjs +1 -0
  10. package/dist/packages/components/compo/code.vue3.js +5 -0
  11. package/dist/packages/components/compo/index.cjs +1 -1
  12. package/dist/packages/components/compo/index.js +126 -108
  13. package/dist/packages/components/main/index.vue.cjs +1 -1
  14. package/dist/packages/components/main/index.vue.js +36 -32
  15. package/dist/packages/components/test/index.vue.cjs +1 -1
  16. package/dist/packages/components/use/code.cjs +10 -10
  17. package/dist/packages/components/use/code.d.ts +25 -17
  18. package/dist/packages/components/use/code.js +99 -93
  19. package/dist/packages/components/use/code.vue.cjs +1 -0
  20. package/dist/packages/components/use/code.vue.js +66 -0
  21. package/dist/packages/components/use/code.vue2.cjs +1 -0
  22. package/dist/packages/components/use/code.vue2.js +4 -0
  23. package/dist/packages/components/use/edit.cjs +18 -0
  24. package/dist/packages/components/use/edit.d.ts +32 -0
  25. package/dist/packages/components/use/edit.js +187 -0
  26. package/dist/packages/components/use/effect.d.ts +18 -0
  27. package/dist/packages/components/use/effect.vue.cjs +1 -0
  28. package/dist/packages/components/use/effect.vue.js +12 -0
  29. package/dist/packages/components/use/retrie/array/index.vue.cjs +1 -1
  30. package/dist/packages/components/use/retrie/boolean/index.vue.cjs +1 -1
  31. package/dist/packages/components/use/retrie/expose/index.vue.cjs +1 -1
  32. package/dist/packages/components/use/retrie/index.d.ts +1 -1
  33. package/dist/packages/components/use/retrie/input/index.vue.cjs +1 -1
  34. package/dist/packages/components/use/retrie/input/text.vue.cjs +1 -1
  35. package/dist/packages/components/use/retrie/object/index.vue.cjs +1 -1
  36. package/dist/packages/components/use/retrie/other/index.vue.cjs +1 -1
  37. package/dist/packages/components/use/retrie/slot/index.vue.cjs +1 -1
  38. package/dist/packages/components/use/set-code.vue.cjs +1 -1
  39. package/dist/packages/components/use/set-code.vue.js +17 -58
  40. package/dist/packages/components/use/util.cjs +3 -3
  41. package/dist/packages/components/use/util.js +38 -34
  42. package/dist/packages/page/compon/index.vue2.cjs +1 -1
  43. package/dist/packages/page/develop/index.vue2.cjs +1 -1
  44. package/dist/packages/page/edit/index.vue.cjs +1 -0
  45. package/dist/packages/page/edit/index.vue.js +4 -0
  46. package/dist/packages/page/edit/index.vue2.cjs +1 -0
  47. package/dist/packages/page/edit/index.vue2.js +23 -0
  48. package/dist/packages/router/file.cjs +1 -1
  49. package/dist/packages/router/file.js +5 -4
  50. package/dist/packages/router/index.cjs +1 -1
  51. package/dist/packages/router/index.d.ts +1 -0
  52. package/dist/packages/router/index.js +55 -45
  53. package/dist/packages/utils/props.cjs +1 -1
  54. package/dist/packages/utils/props.js +30 -27
  55. package/package.json +1 -1
@@ -1,7 +1,7 @@
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 c=require("./util.cjs"),T=require("../../utils/props.cjs"),J=require("@fangzhongya/utils/basic/string/toFunction"),N=["class"];function q(e,t){return e.filter(s=>s.name==t)[0]}function L(e){return e.map(t=>(t.prop||"...arr")+":"+c.setDataType(t.dataType)).join(",")}function A(e,t,s,n,o,h){const p=[],r=[];let b=!0;const v=T.getPropsValue(t.propss||[]),x=T.getEmitsValue(t.emitss||[]),B=T.getExposeValue(t.exposes||[]),C=T.getSlotValue(t.slots||[]);Object.keys(s).forEach(i=>{let m=s[i];if(/^on[A-Z]/.test(i)&&typeof m=="function"){let u=i.substring(2);const l=i.split(":");let g;if(l.length>1?(g=l[0]+l.slice(1).map(f=>w.firstUpper(f)).join(""),u=H.firstLower(u)):(g=l[0],u=z.humpToLine(u)),l.includes("-")){let f=g.split("-");f=f.map(($,V)=>V!=0?w.firstUpper($):$),g=f.join("")}p.push(" @"+u+'="'+g+'"');const a=q(x,u)||{},d=a.selectable||"",S=c.parseParamString(d),y=L(S);r.push(`// ${a.description} ${a.name}: (${a.selectable})`),r.push("function "+g+"("+y+") {"),S.forEach(f=>{const $=f.name||"arr";r.push(" console.log('"+f.label+"', "+$+")")}),r.push("}")}else{let u=i;N.includes(i)&&(u=i+"1"),p.push(" :"+i+'="'+u+'"');const l=q(v,i)||{},g=E(l);if(r.push(`// ${l.description} ${l.name}: {${l.type}} (${l.selectable})`),typeof m=="function")r.push("const "+i+" = "+P(m,i,o));else if(b&&(b=!1,r.unshift("import { ref } from 'vue';")),typeof m>"u")if(g.type=="function"){const a=Z(l);r.push("const "+u+" = "+a+";")}else{const a=c.getTypeValue(g.dataType);r.push("const "+u+" = ref("+(a==="undefined"?"":a)+");")}else{let a=j(m,i,o);r.push("const "+u+" = ref("+a+");")}}});const O=Object.values(h||{});O.length>0&&(b&&(b=!1,r.unshift("import { ref } from 'vue';")),p.unshift(' ref="refDom"'),r.push("const refDom = ref()"),O.forEach(i=>{const m=q(B,i.name)||{};r.push(`// ${m.description} ${m.name}:(${m.selectable}) ${m.type}`);const u=i.name+"Value",l=c.parseParamString(m?.selectable||""),g=[],a=i.params||[];l.forEach((d,S)=>{const y=d.name;if(y){const f=y+i.name,$=a[S];if(r.push(`// ${d.label}`),typeof $=="function")r.push("const "+f+" = "+P($,y,i.text));else if(typeof $>"u")r.push("const "+f+" = "+c.getTypeValue(d.dataType)+";");else{let V=j($,y,i.text);r.push("const "+f+" = "+V+";")}g.push(f)}}),i.type==="function"?r.push(`const ${u} = refDom.value?.${i.name}(${g.join(", ")})`):r.push(`const ${u} = refDom.value?.${i.name}`),r.push(`console.log('"${m.type}"', ${u})`)})),p.length>0&&p.unshift("");const U=M(n,C);return`<!--${e}-->
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
2
  <template>
3
3
  <div>
4
- <${e}${p.join(`
4
+ <${e}${g.join(`
5
5
  `)}>${U.join(`
6
6
  `)}
7
7
  </${e}>
@@ -11,11 +11,11 @@
11
11
  ${r.join(`
12
12
  `)}
13
13
  <\/script>
14
- `}function M(e={},t){const s=[];return Object.keys(e).forEach(n=>{const o=q(t,n)||{},h=e[n];if(h){const p=` <!-- ${o.description} ${o.name}:(${o.selectable}) -->
15
- <template #${n}="scope">
16
- ${c.vueFormat(h," ")}
17
- </template>`;s.push(p)}}),s&&s.length>0&&s.unshift(""),s}function P(e,t,s){const n=s?s[t]:"";return n&&(n.includes("=>")||n.includes("function"))?n:F(e.toString())}function F(e){const t=J.getFunctionFormat(c.prettierFormat(e));if(t){let s=`{
18
- ${c.vueFormat(c.getFunBody(t.body)," ")}
19
- }`;return`function (${t.param}) ${s}`}else return"undefined"}function Z(e){const t=c.parseParamString(e.selectable),s=L(t);let n="";e.return&&(n="return ");let o=`{
20
- ${c.vueFormat(c.getFunBody(n)," ")}
21
- }`;return`function (${s}) ${o}`}function G(e){const t=e.trim();return/^\(/.test(t)?F(t):JSON.stringify(e)}function j(e,t,s){const n=s?s[t]:"";return n||(typeof e=="string"?G(e+""):JSON.stringify(e))}function E(e){let t=c.parseTypeDefinition(e?.type),s=t.dataType,n=t.type;n=n.split("<")[0],n=n.trim().toLowerCase(),s.length>1&&(n="any");let o=(e?.selectable||"").trim(),h=[];return o&&n!="boolean"&&(o.includes("|")?o.split("|").forEach(p=>{if(p){let r=p.split(":");h.push({label:p,prop:D(r[0].trim())})}}):h=c.parseParamString(o),n=="array"?n="choice":n!="function"&&h.length>1&&(n="select")),{arr:h,type:n,dataType:s}}function D(e,t){try{if(t?.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,t=!0){const s=E(e),n=c.getTypeValue(s.dataType);if(t){const o=(e.default||"").trim();return D(o||n,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;
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}) -->
15
+ <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;
@@ -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): string;
6
- export declare function setValStringify(v: unknown, key: string, propsText?: ObjStr): 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;
@@ -9,96 +9,102 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
9
9
  import { firstUpper as w } 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 j, parseParamString as T, parseTypeDefinition as q, setDataType as v, vueFormat as D, getFunBody as C, prettierFormat as G } from "./util.js";
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
13
  import { getPropsValue as I, getEmitsValue as K, getExposeValue as M, getSlotValue as Q } from "../../utils/props.js";
14
14
  import { getFunctionFormat as R } from "@fangzhongya/utils/basic/string/toFunction";
15
15
  const W = ["class"];
16
- function S(t, e) {
17
- return t.filter((s) => s.name == e)[0];
16
+ function T(t, n) {
17
+ return t.filter((s) => s.name == n)[0];
18
18
  }
19
19
  function P(t) {
20
- return t.map((e) => (e.prop || "...arr") + ":" + v(e.dataType)).join(",");
20
+ return t.map((n) => (n.prop || "...arr") + ":" + v(n.dataType)).join(",");
21
21
  }
22
- function ht(t, e, s, n, i, h) {
23
- const a = [], r = [];
24
- let y = !0;
25
- const B = I(e.propss || []), J = K(e.emitss || []), N = M(e.exposes || []), A = Q(e.slots || []);
22
+ function ht(t, n, s, e, i, h) {
23
+ const m = [], r = [];
24
+ let d = !0;
25
+ const B = I(n.propss || []), J = K(n.emitss || []), N = M(n.exposes || []), A = Q(n.slots || []);
26
26
  Object.keys(s).forEach((o) => {
27
- let p = s[o];
28
- if (/^on[A-Z]/.test(o) && typeof p == "function") {
29
- let c = o.substring(2);
30
- const u = o.split(":");
31
- let m;
32
- if (u.length > 1 ? (m = u[0] + u.slice(1).map((f) => w(f)).join(""), c = Z(c)) : (m = u[0], c = U(c)), u.includes("-")) {
33
- let f = m.split("-");
34
- f = f.map(($, V) => V != 0 ? w($) : $), m = f.join("");
27
+ let c = s[o];
28
+ if (/^on[A-Z]/.test(o) && typeof c == "function") {
29
+ let u = o.substring(2);
30
+ const f = o.split(":");
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("-")) {
33
+ let p = l.split("-");
34
+ p = p.map(($, S) => S != 0 ? w($) : $), l = p.join("");
35
35
  }
36
- a.push(" @" + c + '="' + m + '"');
37
- const l = S(J, c) || {}, d = l.selectable || "", b = T(d), g = P(b);
38
- r.push(`// ${l.description} ${l.name}: (${l.selectable})`), r.push("function " + m + "(" + g + ") {"), b.forEach((f) => {
39
- const $ = f.name || "arr";
40
- r.push(" console.log('" + f.label + "', " + $ + ")");
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) => {
39
+ const $ = p.name || "arr";
40
+ r.push(" console.log('" + p.label + "', " + $ + ")");
41
41
  }), r.push("}");
42
42
  } else {
43
- let c = o;
44
- W.includes(o) && (c = o + "1"), a.push(" :" + o + '="' + c + '"');
45
- const u = S(B, o) || {}, m = z(u);
43
+ let u = o;
44
+ W.includes(o) && (u = o + "1"), m.push(" :" + o + '="' + u + '"');
45
+ const f = T(B, o) || {}, l = z(f);
46
46
  if (r.push(
47
- `// ${u.description} ${u.name}: {${u.type}} (${u.selectable})`
48
- ), typeof p == "function")
47
+ `// ${f.description} ${f.name}: {${f.type}} (${f.selectable})`
48
+ ), typeof c == "function" || l.dataType.length == 1 && l.type == "function" && c)
49
49
  r.push(
50
- "const " + o + " = " + x(p, o, i)
50
+ "const " + o + " = " + x(
51
+ c,
52
+ o,
53
+ i
54
+ )
51
55
  );
52
- else if (y && (y = !1, r.unshift("import { ref } from 'vue';")), typeof p > "u")
53
- if (m.type == "function") {
54
- const l = Y(u);
55
- r.push("const " + c + " = " + l + ";");
56
+ else if (d && (d = !1, r.unshift("import { ref } from 'vue';")), typeof c > "u")
57
+ if (l.type == "function") {
58
+ const a = Y(f);
59
+ r.push("const " + u + " = " + a + ";");
56
60
  } else {
57
- const l = j(m.dataType);
61
+ const a = V(l.dataType);
58
62
  r.push(
59
- "const " + c + " = ref(" + (l === "undefined" ? "" : l) + ");"
63
+ "const " + u + " = ref(" + (a === "undefined" ? "" : a) + ");"
60
64
  );
61
65
  }
62
66
  else {
63
- let l = L(p, o, i);
64
- r.push("const " + c + " = ref(" + l + ");");
67
+ let a = L(c, o, i);
68
+ r.push("const " + u + " = ref(" + a + ");");
65
69
  }
66
70
  }
67
71
  });
68
72
  const O = Object.values(h || {});
69
- O.length > 0 && (y && (y = !1, r.unshift("import { ref } from 'vue';")), a.unshift(' ref="refDom"'), r.push("const refDom = ref()"), O.forEach((o) => {
70
- const p = S(N, o.name) || {};
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) || {};
71
75
  r.push(
72
- `// ${p.description} ${p.name}:(${p.selectable}) ${p.type}`
76
+ `// ${c.description} ${c.name}:(${c.selectable}) ${c.type}`
73
77
  );
74
- const c = o.name + "Value", u = T(p?.selectable || ""), m = [], l = o.params || [];
75
- u.forEach((d, b) => {
76
- const g = d.name;
78
+ const u = o.name + "Value", f = j(c?.selectable || ""), l = [], a = o.params || [];
79
+ f.forEach((y, b) => {
80
+ const g = y.name;
77
81
  if (g) {
78
- const f = g + o.name, $ = l[b];
79
- if (r.push(`// ${d.label}`), typeof $ == "function")
82
+ const p = g + o.name, $ = a[b];
83
+ if (r.push(`// ${y.label}`), typeof $ == "function")
80
84
  r.push(
81
- "const " + f + " = " + x($, g, o.text)
85
+ "const " + p + " = " + x($, g, o.text)
82
86
  );
83
87
  else if (typeof $ > "u")
84
88
  r.push(
85
- "const " + f + " = " + j(d.dataType) + ";"
89
+ "const " + p + " = " + V(y.dataType) + ";"
86
90
  );
87
91
  else {
88
- let V = L($, g, o.text);
89
- r.push("const " + f + " = " + V + ";");
92
+ let S = L($, g, o.text);
93
+ r.push("const " + p + " = " + S + ";");
90
94
  }
91
- m.push(f);
95
+ l.push(p);
92
96
  }
93
- }), o.type === "function" ? r.push(
94
- `const ${c} = refDom.value?.${o.name}(${m.join(", ")})`
95
- ) : r.push(`const ${c} = refDom.value?.${o.name}`), r.push(`console.log('"${p.type}"', ${c})`);
96
- })), a.length > 0 && a.unshift("");
97
- const H = X(n, A);
97
+ }), o.type === "function" ? (c.return ? r.push(
98
+ `const ${u} = refDom.value?.${o.name}(${l.join(
99
+ ", "
100
+ )})`
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
+ })), m.length > 0 && m.unshift("");
103
+ const H = X(e, A);
98
104
  return `<!--${t}-->
99
105
  <template>
100
106
  <div>
101
- <${t}${a.join(`
107
+ <${t}${m.join(`
102
108
  `)}>${H.join(`
103
109
  `)}
104
110
  </${t}>
@@ -110,71 +116,71 @@ ${r.join(`
110
116
  <\/script>
111
117
  `;
112
118
  }
113
- function X(t = {}, e) {
119
+ function X(t = {}, n) {
114
120
  const s = [];
115
- return Object.keys(t).forEach((n) => {
116
- const i = S(e, n) || {}, h = t[n];
121
+ return Object.keys(t).forEach((e) => {
122
+ const i = T(n, e) || {}, h = t[e];
117
123
  if (h) {
118
- const a = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
119
- <template #${n}="scope">
120
- ${D(h, " ")}
124
+ const m = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
125
+ <template #${e}="scope">
126
+ ${E(h, " ")}
121
127
  </template>`;
122
- s.push(a);
128
+ s.push(m);
123
129
  }
124
130
  }), s && s.length > 0 && s.unshift(""), s;
125
131
  }
126
- function x(t, e, s) {
127
- const n = s ? s[e] : "";
128
- return n && (n.includes("=>") || n.includes("function")) ? n : F(t.toString());
132
+ function x(t, n, s) {
133
+ const e = s ? s[n] : "";
134
+ return e && (e.includes("=>") || e.includes("function")) ? e : F(t.toString());
129
135
  }
130
136
  function F(t) {
131
- const e = R(G(t));
132
- if (e) {
137
+ const n = R(G(t));
138
+ if (n) {
133
139
  let s = `{
134
- ${D(C(e.body), " ")}
140
+ ${E(C(n.body), " ")}
135
141
  }`;
136
- return `function (${e.param}) ${s}`;
142
+ return `function (${n.param.split(",").map((e) => e + ":any").join(",")}) ${s}`;
137
143
  } else
138
144
  return "undefined";
139
145
  }
140
146
  function Y(t) {
141
- const e = T(t.selectable), s = P(e);
142
- let n = "";
143
- t.return && (n = "return ");
147
+ const n = j(t.selectable), s = P(n);
148
+ let e = "";
149
+ t.return && (e = "return ");
144
150
  let i = `{
145
- ${D(C(n), " ")}
151
+ ${E(C(e), " ")}
146
152
  }`;
147
153
  return `function (${s}) ${i}`;
148
154
  }
149
155
  function _(t) {
150
- const e = t.trim();
151
- return /^\(/.test(e) ? F(e) : JSON.stringify(t);
156
+ const n = t.trim();
157
+ return /^\(/.test(n) ? F(n) : JSON.stringify(t);
152
158
  }
153
- function L(t, e, s) {
154
- const n = s ? s[e] : "";
155
- return n || (typeof t == "string" ? _(t + "") : JSON.stringify(t));
159
+ function L(t, n, s) {
160
+ const e = s ? s[n] : "";
161
+ return e || (typeof t == "string" ? _(t + "") : JSON.stringify(t));
156
162
  }
157
163
  function z(t) {
158
- let e = q(t?.type), s = e.dataType, n = e.type;
159
- n = n.split("<")[0], n = n.trim().toLowerCase(), s.length > 1 && (n = "any");
164
+ let n = q(t?.type), s = n.dataType, e = n.type;
165
+ e = e.split("<")[0], e = e.trim().toLowerCase(), s.length > 1 && (e = "any");
160
166
  let i = (t?.selectable || "").trim(), h = [];
161
- return i && n != "boolean" && (i.includes("|") ? i.split("|").forEach((a) => {
162
- if (a) {
163
- let r = a.split(":");
167
+ return i && e != "boolean" && (i.includes("|") ? i.split("|").forEach((m) => {
168
+ if (m) {
169
+ let r = m.split(":");
164
170
  h.push({
165
- label: a,
166
- prop: E(r[0].trim())
171
+ label: m,
172
+ prop: D(r[0].trim())
167
173
  });
168
174
  }
169
- }) : h = T(i), n == "array" ? n = "choice" : n != "function" && h.length > 1 && (n = "select")), {
175
+ }) : h = j(i), e == "array" ? e = "choice" : e != "function" && h.length > 1 && (e = "select")), {
170
176
  arr: h,
171
- type: n,
177
+ type: e,
172
178
  dataType: s
173
179
  };
174
180
  }
175
- function E(t, e) {
181
+ function D(t, n) {
176
182
  try {
177
- if (e?.toLowerCase() == "function")
183
+ if (n?.toLowerCase() == "function")
178
184
  if (typeof t == "string") {
179
185
  if (/^\((.|\n|\r)*\)$/.test(t))
180
186
  return t = t.substring(1, t.length - 1), new Function(`{ return ${t} }`)();
@@ -186,14 +192,14 @@ function E(t, e) {
186
192
  return "" + t;
187
193
  }
188
194
  }
189
- function $t(t, e = !0) {
190
- const s = z(t), n = j(s.dataType);
191
- if (e) {
195
+ function $t(t, n = !0) {
196
+ const s = z(t), e = V(s.dataType);
197
+ if (n) {
192
198
  const i = (t.default || "").trim();
193
- return E(i || n, s.dataType[0]);
199
+ return D(i || e, s.dataType[0]);
194
200
  } else {
195
201
  const i = (t.default || "").trim();
196
- return E(i, s.dataType[0]);
202
+ return D(i, s.dataType[0]);
197
203
  }
198
204
  }
199
205
  export {
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),a=require("../code/highlight.vue.cjs"),m=require("../../utils/index.cjs"),v=require("../../utils/util.cjs"),h={class:"set-code"},p={class:"but-div set-code-but"},f={class:"set-code-html"},C=e.defineComponent({__name:"code",props:{name:{type:String},html:{type:String,default(){return""}}},emits:["refresh"],setup(s,{emit:c}){const t=s,n=c,o=e.ref(!1);function l(){o.value=!o.value}function r(){m.copyCode(t.html)}function d(){v.exportStringToFile(t.html,t.name+".vue")}function u(){n("refresh")}return(_,i)=>(e.openBlock(),e.createElementBlock("div",h,[e.createElementVNode("div",{onClick:l,class:"set-code-buts"},[i[0]||(i[0]=e.createElementVNode("div",null,"代码",-1)),e.createElementVNode("div",p,e.toDisplayString(o.value?"显示":"隐藏"),1),e.createElementVNode("div",{onClick:e.withModifiers(r,["stop"]),class:"but-div set-code-but"}," 复制 "),e.createElementVNode("div",{onClick:e.withModifiers(d,["stop"]),class:"but-div set-code-but"}," 下载 "),e.createElementVNode("div",{onClick:e.withModifiers(u,["stop"]),class:"but-div set-code-but"}," 刷新 ")]),e.withDirectives(e.createElementVNode("div",f,[e.createVNode(a,{language:"html",code:t.html},null,8,["code"])],512),[[e.vShow,o.value]])]))}});module.exports=C;
@@ -0,0 +1,66 @@
1
+ import { defineComponent as m, ref as p, createElementBlock as v, openBlock as f, createElementVNode as e, withDirectives as h, toDisplayString as C, withModifiers as i, createVNode as _, vShow as b } from "vue";
2
+ import k from "../code/highlight.vue.js";
3
+ import { copyCode as g } from "../../utils/index.js";
4
+ import { exportStringToFile as S } from "../../utils/util.js";
5
+ const y = { class: "set-code" }, w = { class: "but-div set-code-but" }, x = { class: "set-code-html" }, F = /* @__PURE__ */ m({
6
+ __name: "code",
7
+ props: {
8
+ name: {
9
+ type: String
10
+ },
11
+ html: {
12
+ type: String,
13
+ default() {
14
+ return "";
15
+ }
16
+ }
17
+ },
18
+ emits: ["refresh"],
19
+ setup(c, { emit: n }) {
20
+ const t = c, l = n, o = p(!1);
21
+ function r() {
22
+ o.value = !o.value;
23
+ }
24
+ function d() {
25
+ g(t.html);
26
+ }
27
+ function u() {
28
+ S(t.html, t.name + ".vue");
29
+ }
30
+ function a() {
31
+ l("refresh");
32
+ }
33
+ return (D, s) => (f(), v("div", y, [
34
+ e("div", {
35
+ onClick: r,
36
+ class: "set-code-buts"
37
+ }, [
38
+ s[0] || (s[0] = e("div", null, "代码", -1)),
39
+ e("div", w, C(o.value ? "显示" : "隐藏"), 1),
40
+ e("div", {
41
+ onClick: i(d, ["stop"]),
42
+ class: "but-div set-code-but"
43
+ }, " 复制 "),
44
+ e("div", {
45
+ onClick: i(u, ["stop"]),
46
+ class: "but-div set-code-but"
47
+ }, " 下载 "),
48
+ e("div", {
49
+ onClick: i(a, ["stop"]),
50
+ class: "but-div set-code-but"
51
+ }, " 刷新 ")
52
+ ]),
53
+ h(e("div", x, [
54
+ _(k, {
55
+ language: "html",
56
+ code: t.html
57
+ }, null, 8, ["code"])
58
+ ], 512), [
59
+ [b, o.value]
60
+ ])
61
+ ]));
62
+ }
63
+ });
64
+ export {
65
+ F as default
66
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./code.vue.cjs");module.exports=e;
@@ -0,0 +1,4 @@
1
+ import f from "./code.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +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}
7
+ export default {
8
+ setup(props, ctx) {
9
+ ${c}
10
+ }
11
+ }
12
+ <\/script>
13
+ <style>
14
+ ${l}
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;
@@ -0,0 +1,32 @@
1
+ import * as vues from 'vue';
2
+ /**
3
+ * @title
4
+ * @author 方忠亚
5
+ * @description 这是个我用来测试功能的测试组件,请不要使用它
6
+ * @date 2022年11月24日22点58分
7
+ */
8
+ declare const _default: vues.DefineComponent<vues.ExtractPropTypes<{
9
+ value: {
10
+ type: ObjectConstructor;
11
+ };
12
+ param: {
13
+ type: ObjectConstructor;
14
+ };
15
+ }>, {
16
+ getHmtlVue: (template: string, script: string | undefined, style: string) => string;
17
+ getCodeBlock: (value: string, props: any, ctx: any) => any;
18
+ style: vues.Ref<HTMLStyleElement | null, HTMLStyleElement | null>;
19
+ }, {
20
+ template: string;
21
+ script: string;
22
+ style: string;
23
+ vueHtml: string;
24
+ }, {}, {}, vues.ComponentOptionsMixin, vues.ComponentOptionsMixin, {}, string, vues.PublicProps, Readonly<vues.ExtractPropTypes<{
25
+ value: {
26
+ type: ObjectConstructor;
27
+ };
28
+ param: {
29
+ type: ObjectConstructor;
30
+ };
31
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, vues.ComponentProvideOptions, true, {}, any>;
32
+ export default _default;