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