@fangzhongya/vue-archive 0.0.69 → 0.0.71
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.
- package/README.md +0 -2
- package/dist/index.css +2 -2
- package/dist/node/index.cjs +448 -358
- package/dist/node/index.d.cts +2 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.js +445 -358
- package/dist/packages/components/use/code.cjs +15 -16
- package/dist/packages/components/use/code.d.ts +25 -17
- package/dist/packages/components/use/code.js +76 -74
- package/dist/packages/components/use/edit.cjs +11 -11
- package/dist/packages/components/use/edit.d.ts +1 -1
- package/dist/packages/components/use/edit.js +119 -94
- package/dist/packages/components/use/prettier.cjs +1 -0
- package/dist/packages/components/use/prettier.d.ts +1 -4
- package/dist/packages/components/use/prettier.js +40 -0
- package/dist/packages/components/use/retrie/array/index.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/array/index.vue.js +17 -16
- package/dist/packages/components/use/retrie/function/index.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/function/index.vue.js +22 -20
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.cjs +3 -0
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.js +58 -0
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue.cjs +1 -0
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue.js +62 -0
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue3.cjs +1 -0
- package/dist/packages/components/use/retrie/input/codemirror/codemirror.vue3.js +5 -0
- package/dist/packages/components/use/retrie/input/editor/editor.cjs +3 -0
- package/dist/packages/components/use/retrie/input/{codemirror.d.ts → editor/editor.d.ts} +9 -9
- package/dist/packages/components/use/retrie/input/editor/editor.js +39 -0
- package/dist/packages/components/use/retrie/input/editor/editor.vue.cjs +1 -0
- package/dist/packages/components/use/retrie/input/editor/editor.vue.js +53 -0
- package/dist/packages/components/use/retrie/input/editor/editor.vue3.cjs +1 -0
- package/dist/packages/components/use/retrie/input/editor/editor.vue3.js +5 -0
- package/dist/packages/components/use/retrie/input/editor/init.cjs +1 -0
- package/dist/packages/components/use/retrie/input/editor/init.d.ts +1 -0
- package/dist/packages/components/use/retrie/input/editor/init.js +16 -0
- package/dist/packages/components/use/retrie/input/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/input/index.vue.js +25 -15
- package/dist/packages/components/use/retrie/input/text.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/input/text.vue.js +21 -13
- package/dist/packages/components/use/retrie/number/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/number/index.vue.js +24 -22
- package/dist/packages/components/use/retrie/object/index.vue.cjs +2 -2
- package/dist/packages/components/use/retrie/object/index.vue.js +15 -14
- package/dist/packages/components/use/retrie/other/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/other/index.vue.js +17 -16
- package/dist/packages/components/use/retrie/slot/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/slot/index.vue.js +19 -17
- package/dist/packages/components/use/retrie/string/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/string/index.vue.js +20 -18
- package/dist/packages/components/use/set-code.vue.cjs +1 -1
- package/dist/packages/components/use/set-code.vue.js +7 -7
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.d.ts +10 -5
- package/dist/packages/components/use/util.js +88 -62
- package/dist/packages/config.d.ts +3 -1
- package/dist/packages/page/edit/index.vue2.cjs +1 -1
- package/dist/packages/page/edit/index.vue2.js +11 -7
- package/package.json +3 -2
- package/dist/packages/components/use/codemirror.cjs +0 -3
- package/dist/packages/components/use/codemirror.js +0 -31
- package/dist/packages/components/use/retrie/input/codemirror.vue.cjs +0 -1
- package/dist/packages/components/use/retrie/input/codemirror.vue.js +0 -43
- package/dist/packages/components/use/retrie/input/codemirror.vue2.cjs +0 -1
- package/dist/packages/components/use/retrie/input/codemirror.vue2.js +0 -4
- /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
|
|
2
|
-
<
|
|
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
|
-
`)}>${
|
|
4
|
+
`)}>${z.join(`
|
|
6
5
|
`)}
|
|
7
6
|
</${e}>
|
|
8
|
-
|
|
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
|
-
${
|
|
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
|
-
${
|
|
17
|
-
</template>`;s.push(g)}}),s&&s.length>0&&s.unshift(""),s}function
|
|
18
|
-
${
|
|
19
|
-
}`;return`function (${n.param.split(",").map(t=>t+":any").join(",")}) ${s}`}else return"undefined"}function
|
|
20
|
-
${
|
|
21
|
-
}`;return`function (${s}) ${o}`}function
|
|
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;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
13
|
-
import { getPropsValue as
|
|
14
|
-
import { getFunctionFormat as
|
|
15
|
-
const
|
|
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
|
|
20
|
-
return t.map((n) => (n.prop || "...arr") + ":" +
|
|
19
|
+
function B(t) {
|
|
20
|
+
return t.map((n) => (n.prop || "...arr") + ":" + M(n.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
async function yt(t, n, s, e, i, h) {
|
|
23
23
|
const m = [], r = [];
|
|
24
24
|
let d = !0;
|
|
25
|
-
const
|
|
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
|
|
30
|
+
const a = o.split(":");
|
|
31
31
|
let l;
|
|
32
|
-
if (
|
|
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(($,
|
|
34
|
+
p = p.map(($, w) => w != 0 ? L($) : $), l = p.join("");
|
|
35
35
|
}
|
|
36
36
|
m.push(" @" + u + '="' + l + '"');
|
|
37
|
-
const
|
|
38
|
-
r.push(`// ${
|
|
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
|
-
|
|
45
|
-
const
|
|
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
|
-
`// ${
|
|
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 + " = " +
|
|
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
|
|
59
|
-
r.push("const " + u + " = " +
|
|
58
|
+
const f = tt(a);
|
|
59
|
+
r.push("const " + u + " = " + f + ";");
|
|
60
60
|
} else {
|
|
61
|
-
const
|
|
61
|
+
const f = D(l.dataType);
|
|
62
62
|
r.push(
|
|
63
|
-
"const " + u + " = ref(" + (
|
|
63
|
+
"const " + u + " = ref(" + (f === "undefined" ? "" : f) + ");"
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
|
-
let
|
|
68
|
-
r.push("const " + u + " = ref(" +
|
|
67
|
+
let f = P(c, o, i);
|
|
68
|
+
r.push("const " + u + " = ref(" + f + ");");
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const c = T(
|
|
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",
|
|
79
|
-
|
|
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, $ =
|
|
82
|
+
const p = g + o.name, $ = f[b];
|
|
83
83
|
if (r.push(`// ${y.label}`), typeof $ == "function")
|
|
84
84
|
r.push(
|
|
85
|
-
"const " + p + " = " +
|
|
85
|
+
"const " + p + " = " + C($, g, o.text)
|
|
86
86
|
);
|
|
87
87
|
else if (typeof $ > "u")
|
|
88
88
|
r.push(
|
|
89
|
-
"const " + p + " = " +
|
|
89
|
+
"const " + p + " = " + D(y.dataType) + ";"
|
|
90
90
|
);
|
|
91
91
|
else {
|
|
92
|
-
let
|
|
93
|
-
r.push("const " + p + " = " +
|
|
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
|
|
104
|
-
|
|
105
|
-
<
|
|
106
|
-
<div>
|
|
103
|
+
const Z = k(e, U);
|
|
104
|
+
let S = `<template>
|
|
105
|
+
<div>
|
|
107
106
|
<${t}${m.join(`
|
|
108
|
-
`)}>${
|
|
107
|
+
`)}>${Z.join(`
|
|
109
108
|
`)}
|
|
110
109
|
</${t}>
|
|
111
|
-
|
|
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
|
-
${
|
|
115
|
-
|
|
116
|
-
<\/script>
|
|
117
|
-
`;
|
|
118
|
+
${V}
|
|
119
|
+
<\/script>`;
|
|
118
120
|
}
|
|
119
|
-
function
|
|
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
|
-
${
|
|
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
|
|
134
|
+
function C(t, n, s) {
|
|
133
135
|
const e = s ? s[n] : "";
|
|
134
|
-
return e && (e.includes("=>") || e.includes("function")) ? e :
|
|
136
|
+
return e && (e.includes("=>") || e.includes("function")) ? e : E(t.toString());
|
|
135
137
|
}
|
|
136
|
-
function
|
|
137
|
-
const n =
|
|
138
|
+
async function E(t) {
|
|
139
|
+
const n = Y(t);
|
|
138
140
|
if (n) {
|
|
139
141
|
let s = `{
|
|
140
|
-
${
|
|
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
|
|
147
|
-
const n = j(t.selectable), s =
|
|
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
|
-
${
|
|
153
|
+
${O(z(e), " ")}
|
|
152
154
|
}`;
|
|
153
155
|
return `function (${s}) ${i}`;
|
|
154
156
|
}
|
|
155
|
-
function
|
|
157
|
+
function et(t) {
|
|
156
158
|
const n = t.trim();
|
|
157
|
-
return /^\(/.test(n) ?
|
|
159
|
+
return /^\(/.test(n) ? E(n) : JSON.stringify(t);
|
|
158
160
|
}
|
|
159
|
-
function
|
|
161
|
+
function P(t, n, s) {
|
|
160
162
|
const e = s ? s[n] : "";
|
|
161
|
-
return e || (typeof t == "string" ?
|
|
163
|
+
return e || (typeof t == "string" ? et(t + "") : JSON.stringify(t));
|
|
162
164
|
}
|
|
163
|
-
function
|
|
164
|
-
let n =
|
|
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:
|
|
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
|
|
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
|
|
196
|
-
const s =
|
|
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
|
|
201
|
+
return F(i || e, s.dataType[0]);
|
|
200
202
|
} else {
|
|
201
203
|
const i = (t.default || "").trim();
|
|
202
|
-
return
|
|
204
|
+
return F(i, s.dataType[0]);
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
export {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
${
|
|
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
|
|
17
|
-
const { ${
|
|
18
|
-
${
|
|
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
|
}, {
|