@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.
- package/dist/index.css +1 -1
- package/dist/node/index.cjs +83 -30
- package/dist/node/index.js +83 -30
- package/dist/packages/components/choice/index.vue.cjs +1 -1
- package/dist/packages/components/code/highlight.vue.cjs +1 -1
- package/dist/packages/components/code/index.vue.cjs +1 -1
- package/dist/packages/components/compo/code.vue.cjs +1 -0
- package/dist/packages/components/compo/code.vue.js +21 -0
- package/dist/packages/components/compo/code.vue3.cjs +1 -0
- package/dist/packages/components/compo/code.vue3.js +5 -0
- package/dist/packages/components/compo/index.cjs +1 -1
- package/dist/packages/components/compo/index.js +126 -108
- package/dist/packages/components/main/index.vue.cjs +1 -1
- package/dist/packages/components/main/index.vue.js +36 -32
- package/dist/packages/components/test/index.vue.cjs +1 -1
- package/dist/packages/components/use/code.cjs +10 -10
- package/dist/packages/components/use/code.d.ts +25 -17
- package/dist/packages/components/use/code.js +99 -93
- package/dist/packages/components/use/code.vue.cjs +1 -0
- package/dist/packages/components/use/code.vue.js +66 -0
- package/dist/packages/components/use/code.vue2.cjs +1 -0
- package/dist/packages/components/use/code.vue2.js +4 -0
- package/dist/packages/components/use/edit.cjs +18 -0
- package/dist/packages/components/use/edit.d.ts +32 -0
- package/dist/packages/components/use/edit.js +187 -0
- package/dist/packages/components/use/effect.d.ts +18 -0
- package/dist/packages/components/use/effect.vue.cjs +1 -0
- package/dist/packages/components/use/effect.vue.js +12 -0
- package/dist/packages/components/use/retrie/array/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/boolean/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/expose/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/index.d.ts +1 -1
- package/dist/packages/components/use/retrie/input/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/input/text.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/object/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/other/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/slot/index.vue.cjs +1 -1
- package/dist/packages/components/use/set-code.vue.cjs +1 -1
- package/dist/packages/components/use/set-code.vue.js +17 -58
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.js +38 -34
- package/dist/packages/page/compon/index.vue2.cjs +1 -1
- package/dist/packages/page/develop/index.vue2.cjs +1 -1
- package/dist/packages/page/edit/index.vue.cjs +1 -0
- package/dist/packages/page/edit/index.vue.js +4 -0
- package/dist/packages/page/edit/index.vue2.cjs +1 -0
- package/dist/packages/page/edit/index.vue2.js +23 -0
- package/dist/packages/router/file.cjs +1 -1
- package/dist/packages/router/file.js +5 -4
- package/dist/packages/router/index.cjs +1 -1
- package/dist/packages/router/index.d.ts +1 -0
- package/dist/packages/router/index.js +55 -45
- package/dist/packages/utils/props.cjs +1 -1
- package/dist/packages/utils/props.js +30 -27
- 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
|
|
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}${
|
|
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={},
|
|
15
|
-
<template #${
|
|
16
|
-
${
|
|
17
|
-
</template>`;s.push(
|
|
18
|
-
${
|
|
19
|
-
}`;return`function (${t.
|
|
20
|
-
${
|
|
21
|
-
}`;return`function (${s}) ${o}`}function G(e){const
|
|
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 {
|
|
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;
|
|
@@ -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
|
|
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
|
|
17
|
-
return t.filter((s) => s.name ==
|
|
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((
|
|
20
|
+
return t.map((n) => (n.prop || "...arr") + ":" + v(n.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function ht(t,
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
const B = I(
|
|
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
|
|
28
|
-
if (/^on[A-Z]/.test(o) && typeof
|
|
29
|
-
let
|
|
30
|
-
const
|
|
31
|
-
let
|
|
32
|
-
if (
|
|
33
|
-
let
|
|
34
|
-
|
|
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
|
-
|
|
37
|
-
const
|
|
38
|
-
r.push(`// ${
|
|
39
|
-
const $ =
|
|
40
|
-
r.push(" console.log('" +
|
|
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
|
|
44
|
-
W.includes(o) && (
|
|
45
|
-
const
|
|
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
|
-
`// ${
|
|
48
|
-
), typeof
|
|
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(
|
|
50
|
+
"const " + o + " = " + x(
|
|
51
|
+
c,
|
|
52
|
+
o,
|
|
53
|
+
i
|
|
54
|
+
)
|
|
51
55
|
);
|
|
52
|
-
else if (
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
r.push("const " +
|
|
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
|
|
61
|
+
const a = V(l.dataType);
|
|
58
62
|
r.push(
|
|
59
|
-
"const " +
|
|
63
|
+
"const " + u + " = ref(" + (a === "undefined" ? "" : a) + ");"
|
|
60
64
|
);
|
|
61
65
|
}
|
|
62
66
|
else {
|
|
63
|
-
let
|
|
64
|
-
r.push("const " +
|
|
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 && (
|
|
70
|
-
const
|
|
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
|
-
`// ${
|
|
76
|
+
`// ${c.description} ${c.name}:(${c.selectable}) ${c.type}`
|
|
73
77
|
);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const g =
|
|
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
|
|
79
|
-
if (r.push(`// ${
|
|
82
|
+
const p = g + o.name, $ = a[b];
|
|
83
|
+
if (r.push(`// ${y.label}`), typeof $ == "function")
|
|
80
84
|
r.push(
|
|
81
|
-
"const " +
|
|
85
|
+
"const " + p + " = " + x($, g, o.text)
|
|
82
86
|
);
|
|
83
87
|
else if (typeof $ > "u")
|
|
84
88
|
r.push(
|
|
85
|
-
"const " +
|
|
89
|
+
"const " + p + " = " + V(y.dataType) + ";"
|
|
86
90
|
);
|
|
87
91
|
else {
|
|
88
|
-
let
|
|
89
|
-
r.push("const " +
|
|
92
|
+
let S = L($, g, o.text);
|
|
93
|
+
r.push("const " + p + " = " + S + ";");
|
|
90
94
|
}
|
|
91
|
-
|
|
95
|
+
l.push(p);
|
|
92
96
|
}
|
|
93
|
-
}), o.type === "function" ? r.push(
|
|
94
|
-
`const ${
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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}${
|
|
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 = {},
|
|
119
|
+
function X(t = {}, n) {
|
|
114
120
|
const s = [];
|
|
115
|
-
return Object.keys(t).forEach((
|
|
116
|
-
const i =
|
|
121
|
+
return Object.keys(t).forEach((e) => {
|
|
122
|
+
const i = T(n, e) || {}, h = t[e];
|
|
117
123
|
if (h) {
|
|
118
|
-
const
|
|
119
|
-
<template #${
|
|
120
|
-
${
|
|
124
|
+
const m = ` <!-- ${i.description} ${i.name}:(${i.selectable}) -->
|
|
125
|
+
<template #${e}="scope">
|
|
126
|
+
${E(h, " ")}
|
|
121
127
|
</template>`;
|
|
122
|
-
s.push(
|
|
128
|
+
s.push(m);
|
|
123
129
|
}
|
|
124
130
|
}), s && s.length > 0 && s.unshift(""), s;
|
|
125
131
|
}
|
|
126
|
-
function x(t,
|
|
127
|
-
const
|
|
128
|
-
return
|
|
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
|
|
132
|
-
if (
|
|
137
|
+
const n = R(G(t));
|
|
138
|
+
if (n) {
|
|
133
139
|
let s = `{
|
|
134
|
-
${
|
|
140
|
+
${E(C(n.body), " ")}
|
|
135
141
|
}`;
|
|
136
|
-
return `function (${e.
|
|
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
|
|
142
|
-
let
|
|
143
|
-
t.return && (
|
|
147
|
+
const n = j(t.selectable), s = P(n);
|
|
148
|
+
let e = "";
|
|
149
|
+
t.return && (e = "return ");
|
|
144
150
|
let i = `{
|
|
145
|
-
${
|
|
151
|
+
${E(C(e), " ")}
|
|
146
152
|
}`;
|
|
147
153
|
return `function (${s}) ${i}`;
|
|
148
154
|
}
|
|
149
155
|
function _(t) {
|
|
150
|
-
const
|
|
151
|
-
return /^\(/.test(
|
|
156
|
+
const n = t.trim();
|
|
157
|
+
return /^\(/.test(n) ? F(n) : JSON.stringify(t);
|
|
152
158
|
}
|
|
153
|
-
function L(t,
|
|
154
|
-
const
|
|
155
|
-
return
|
|
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
|
|
159
|
-
|
|
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 &&
|
|
162
|
-
if (
|
|
163
|
-
let r =
|
|
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:
|
|
166
|
-
prop:
|
|
171
|
+
label: m,
|
|
172
|
+
prop: D(r[0].trim())
|
|
167
173
|
});
|
|
168
174
|
}
|
|
169
|
-
}) : h =
|
|
175
|
+
}) : h = j(i), e == "array" ? e = "choice" : e != "function" && h.length > 1 && (e = "select")), {
|
|
170
176
|
arr: h,
|
|
171
|
-
type:
|
|
177
|
+
type: e,
|
|
172
178
|
dataType: s
|
|
173
179
|
};
|
|
174
180
|
}
|
|
175
|
-
function
|
|
181
|
+
function D(t, n) {
|
|
176
182
|
try {
|
|
177
|
-
if (
|
|
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,
|
|
190
|
-
const s = z(t),
|
|
191
|
-
if (
|
|
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
|
|
199
|
+
return D(i || e, s.dataType[0]);
|
|
194
200
|
} else {
|
|
195
201
|
const i = (t.default || "").trim();
|
|
196
|
-
return
|
|
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,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;
|