@fangzhongya/vue-archive 0.0.3-2 → 0.0.3-3
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 +10 -1
- package/dist/node/index.js +10 -1
- package/dist/packages/components/use/code.cjs +10 -7
- package/dist/packages/components/use/code.js +61 -52
- package/dist/packages/components/use/index.cjs +1 -1
- package/dist/packages/components/use/index.js +1 -1
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -66526,12 +66526,21 @@ ${vueFormat(getFunBody(st.body), " ")}
|
|
|
66526
66526
|
}
|
|
66527
66527
|
}
|
|
66528
66528
|
}
|
|
66529
|
+
function getChange(str) {
|
|
66530
|
+
return new Function(
|
|
66531
|
+
"",
|
|
66532
|
+
`{
|
|
66533
|
+
var a = ${str};
|
|
66534
|
+
return a;
|
|
66535
|
+
}`
|
|
66536
|
+
);
|
|
66537
|
+
}
|
|
66529
66538
|
function setValStringify(v, key, propsText) {
|
|
66530
66539
|
const text = propsText ? propsText[key] : "";
|
|
66531
66540
|
if (text) {
|
|
66532
66541
|
return text;
|
|
66533
66542
|
} else {
|
|
66534
|
-
return JSON.stringify(v);
|
|
66543
|
+
return JSON.stringify(getChange(v + ""));
|
|
66535
66544
|
}
|
|
66536
66545
|
}
|
|
66537
66546
|
|
package/dist/node/index.js
CHANGED
|
@@ -66526,12 +66526,21 @@ ${vueFormat(getFunBody(st.body), " ")}
|
|
|
66526
66526
|
}
|
|
66527
66527
|
}
|
|
66528
66528
|
}
|
|
66529
|
+
function getChange(str) {
|
|
66530
|
+
return new Function(
|
|
66531
|
+
"",
|
|
66532
|
+
`{
|
|
66533
|
+
var a = ${str};
|
|
66534
|
+
return a;
|
|
66535
|
+
}`
|
|
66536
|
+
);
|
|
66537
|
+
}
|
|
66529
66538
|
function setValStringify(v, key, propsText) {
|
|
66530
66539
|
const text = propsText ? propsText[key] : "";
|
|
66531
66540
|
if (text) {
|
|
66532
66541
|
return text;
|
|
66533
66542
|
} else {
|
|
66534
|
-
return JSON.stringify(v);
|
|
66543
|
+
return JSON.stringify(getChange(v + ""));
|
|
66535
66544
|
}
|
|
66536
66545
|
}
|
|
66537
66546
|
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.cjs"),m=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),j=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.cjs"),p=require("./util.cjs");function v(t,n,i,e){const r=[],o=[];let h=!0;Object.keys(n).forEach(s=>{let f=n[s];if(/^on[A-Z]/.test(s)&&typeof f=="function"){let u=s.substring(2);const l=s.split(":");let c;if(l.length>1?(c=l[0]+l.slice(1).map(a=>m.firstUpper(a)).join(""),u=j.firstLower(u)):(c=l[0],u=F.humpToLine(u)),l.includes("-")){let a=c.split("-");a=a.map((g,$)=>$!=0?m.firstUpper(g):g),c=a.join("")}r.push(" @"+u+'="'+c+'"'),o.push("function "+c+"(...arr) {"),o.push(" console.log('"+c+"', arr)"),o.push("}")}else if(r.push(" :"+s+'="'+s+'"'),typeof f=="function")o.push("const "+s+" = "+O(f,s,e));else if(h&&(h=!1,o.unshift("import { ref } from 'vue';")),typeof f>"u")o.push("const "+s+" = ref();");else{let u=J(f,s,e);o.push("const "+s+" = ref("+u+");")}}),r.length>0&&r.unshift("");const d=b(i);return`<!--${t}-->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
-
<${
|
|
4
|
+
<${t}${r.join(`
|
|
5
5
|
`)}>${d.join(`
|
|
6
6
|
`)}
|
|
7
|
-
</${
|
|
7
|
+
</${t}>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
${o.join(`
|
|
12
12
|
`)}
|
|
13
13
|
<\/script>
|
|
14
|
-
`}function
|
|
14
|
+
`}function b(t={}){const n=[];return Object.keys(t).forEach(i=>{const e=t[i];if(e){const r=` <template #${i}="scope">
|
|
15
15
|
${p.vueFormat(e," ")}
|
|
16
|
-
</template>`;
|
|
17
|
-
${p.vueFormat(p.getFunBody(
|
|
18
|
-
}`;return`function${
|
|
16
|
+
</template>`;n.push(r)}}),n&&n.length>0&&n.unshift(""),n}function O(t,n,i){const e=i?i[n]:"";if(e)return"function"+e;{const r=p.getFunctionFormat(p.prettierFormat(t.toString()));if(r){let o=`{
|
|
17
|
+
${p.vueFormat(p.getFunBody(r.body)," ")}
|
|
18
|
+
}`;return`function${r.param}${o}`}else return"undefined"}}function S(t){return new Function("",`{
|
|
19
|
+
var a = ${t};
|
|
20
|
+
return a;
|
|
21
|
+
}`)}function J(t,n,i){const e=i?i[n]:"";return e||JSON.stringify(S(t+""))}exports.getHmtl=v;
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { humpToLine as
|
|
1
|
+
import { humpToLine as F } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js";
|
|
2
2
|
import { firstUpper as h } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js";
|
|
3
|
-
import { firstLower as
|
|
4
|
-
import { vueFormat as g, getFunctionFormat as
|
|
5
|
-
function N(
|
|
6
|
-
const
|
|
7
|
-
let
|
|
8
|
-
Object.keys(
|
|
9
|
-
let c =
|
|
10
|
-
if (/^on[A-Z]/.test(
|
|
11
|
-
let f =
|
|
12
|
-
const l =
|
|
3
|
+
import { firstLower as j } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js";
|
|
4
|
+
import { vueFormat as g, getFunctionFormat as v, prettierFormat as b, getFunBody as S } from "./util.js";
|
|
5
|
+
function N(t, n, s, e) {
|
|
6
|
+
const r = [], o = [];
|
|
7
|
+
let p = !0;
|
|
8
|
+
Object.keys(n).forEach((i) => {
|
|
9
|
+
let c = n[i];
|
|
10
|
+
if (/^on[A-Z]/.test(i) && typeof c == "function") {
|
|
11
|
+
let f = i.substring(2);
|
|
12
|
+
const l = i.split(":");
|
|
13
13
|
let u;
|
|
14
|
-
if (l.length > 1 ? (u = l[0] + l.slice(1).map((
|
|
15
|
-
let
|
|
16
|
-
|
|
14
|
+
if (l.length > 1 ? (u = l[0] + l.slice(1).map((a) => h(a)).join(""), f = j(f)) : (u = l[0], f = F(f)), l.includes("-")) {
|
|
15
|
+
let a = u.split("-");
|
|
16
|
+
a = a.map((m, d) => d != 0 ? h(m) : m), u = a.join("");
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
r.push(
|
|
19
19
|
" @" + f + '="' + u + '"'
|
|
20
20
|
), o.push("function " + u + "(...arr) {"), o.push(
|
|
21
21
|
" console.log('" + u + "', arr)"
|
|
22
22
|
), o.push("}");
|
|
23
|
-
} else if (
|
|
24
|
-
" :" +
|
|
23
|
+
} else if (r.push(
|
|
24
|
+
" :" + i + '="' + i + '"'
|
|
25
25
|
), typeof c == "function")
|
|
26
26
|
o.push(
|
|
27
|
-
"const " +
|
|
27
|
+
"const " + i + " = " + w(
|
|
28
28
|
c,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
i,
|
|
30
|
+
e
|
|
31
31
|
)
|
|
32
32
|
);
|
|
33
|
-
else if (
|
|
33
|
+
else if (p && (p = !1, o.unshift(
|
|
34
34
|
"import { ref } from 'vue';"
|
|
35
35
|
)), typeof c > "u")
|
|
36
|
-
o.push("const " +
|
|
36
|
+
o.push("const " + i + " = ref();");
|
|
37
37
|
else {
|
|
38
38
|
let f = E(
|
|
39
39
|
c,
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
i,
|
|
41
|
+
e
|
|
42
42
|
);
|
|
43
43
|
o.push(
|
|
44
|
-
"const " +
|
|
44
|
+
"const " + i + " = ref(" + f + ");"
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
-
}),
|
|
48
|
-
const
|
|
49
|
-
return `<!--${
|
|
47
|
+
}), r.length > 0 && r.unshift("");
|
|
48
|
+
const $ = O(s);
|
|
49
|
+
return `<!--${t}-->
|
|
50
50
|
<template>
|
|
51
51
|
<div>
|
|
52
|
-
<${
|
|
53
|
-
`)}>${
|
|
52
|
+
<${t}${r.join(`
|
|
53
|
+
`)}>${$.join(`
|
|
54
54
|
`)}
|
|
55
|
-
</${
|
|
55
|
+
</${t}>
|
|
56
56
|
</div>
|
|
57
57
|
</template>
|
|
58
58
|
<script lang="ts" setup>
|
|
@@ -61,38 +61,47 @@ ${o.join(`
|
|
|
61
61
|
<\/script>
|
|
62
62
|
`;
|
|
63
63
|
}
|
|
64
|
-
function O(
|
|
65
|
-
const
|
|
66
|
-
return Object.keys(
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
${g(
|
|
64
|
+
function O(t = {}) {
|
|
65
|
+
const n = [];
|
|
66
|
+
return Object.keys(t).forEach((s) => {
|
|
67
|
+
const e = t[s];
|
|
68
|
+
if (e) {
|
|
69
|
+
const r = ` <template #${s}="scope">
|
|
70
|
+
${g(e, " ")}
|
|
71
71
|
</template>`;
|
|
72
|
-
|
|
72
|
+
n.push(r);
|
|
73
73
|
}
|
|
74
|
-
}),
|
|
74
|
+
}), n && n.length > 0 && n.unshift(""), n;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
return "function" +
|
|
76
|
+
function w(t, n, s) {
|
|
77
|
+
const e = s ? s[n] : "";
|
|
78
|
+
if (e)
|
|
79
|
+
return "function" + e;
|
|
80
80
|
{
|
|
81
|
-
const
|
|
82
|
-
|
|
81
|
+
const r = v(
|
|
82
|
+
b(t.toString())
|
|
83
83
|
);
|
|
84
|
-
if (
|
|
84
|
+
if (r) {
|
|
85
85
|
let o = `{
|
|
86
|
-
${g(S(
|
|
86
|
+
${g(S(r.body), " ")}
|
|
87
87
|
}`;
|
|
88
|
-
return `function${
|
|
88
|
+
return `function${r.param}${o}`;
|
|
89
89
|
} else
|
|
90
90
|
return "undefined";
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
function B(t) {
|
|
94
|
+
return new Function(
|
|
95
|
+
"",
|
|
96
|
+
`{
|
|
97
|
+
var a = ${t};
|
|
98
|
+
return a;
|
|
99
|
+
}`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
function E(t, n, s) {
|
|
103
|
+
const e = s ? s[n] : "";
|
|
104
|
+
return e || JSON.stringify(B(t + ""));
|
|
96
105
|
}
|
|
97
106
|
export {
|
|
98
107
|
N as getHmtl
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("vue"),x=require("./set-props.vue.cjs"),q=require("./set-emit.vue.cjs"),E=require("./set-code.vue.cjs"),b=require("./set-expose.vue.cjs"),C=require("./set-slot.vue.cjs"),i=require("../../utils/props.cjs"),V=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),j=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(O,T,v,D,a){console.log("render",new Date().getTime());const r=s.reactive({emitValue:{},slotValue:{}}),n=v.value;let c="div";n.component?c=s.defineAsyncComponent(n.component):n.name&&(c=s.resolveComponent(n.name));const u=v.param,d=i.getPropsValue(u.propss),m=i.getEmitsValue(u.emitss),y=i.getExposeValue(u.exposes),h=i.getSlotValue(u.slots),l={},f={};d.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(l[e]=a.propsValue[e],o&&o.length>1&&m.push({name:"update:"+e,description:t.description,selectable:"value:["+t.type+"]"}))}}),m.forEach(t=>{let e=t.name;if(e.includes("-")){let p=e.split("-");p=p.map((_,U)=>V.firstUpper(_)),e=p.join("")}else e=V.firstUpper(e);const o="on"+e;l[o]=(...p)=>{const _={arr:p,_date_:new Date().getTime()};r.emitValue[t.name]=_}});let g;return h.forEach(t=>{const e=t.name||"default";f[e]=o=>{if(r.slotValue[e])return s.h(s.defineComponent({props:{scope:{type:Object}},template:r.slotValue[e]}),{scope:o})}}),s.h("div",{class:"use"},[s.h("div",{class:"use-props"},s.h(x,{name:n.name,list:d,onChange:(t,e)=>{a.propsValue=t,a.propsText=e}})),s.h("div",{class:"use-component"},s.h(c,{...l,ref:t=>{g=t}},f)),s.h("div",{class:"use-code"},s.h(E,{name:n.name,value:l,propsText:a.propsText,slotValue:r.slotValue})),s.h("div",{class:"use-emit"},s.h(q,{name:n.name,list:m,value:r.emitValue})),s.h("div",{class:"use-expose"},s.h(b,{name:n.name,list:y,getRef:()=>g})),s.h("div",{class:"use-slot"},s.h(C,{name:n.name,list:h,onChange:(t,e)=>{r.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{}}}});module.exports=j;
|
|
1
|
+
"use strict";const s=require("vue"),x=require("./set-props.vue.cjs"),q=require("./set-emit.vue.cjs"),E=require("./set-code.vue.cjs"),b=require("./set-expose.vue.cjs"),C=require("./set-slot.vue.cjs"),i=require("../../utils/props.cjs"),V=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.cjs"),j=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(O,T,v,D,a){console.log("render",new Date().getTime());const r=s.reactive({emitValue:{},slotValue:{}}),n=v.value;let c="div";n.component?c=s.defineAsyncComponent(n.component):n.name&&(c=s.resolveComponent(n.name));const u=v.param,d=i.getPropsValue(u.propss||[]),m=i.getEmitsValue(u.emitss||[]),y=i.getExposeValue(u.exposes||[]),h=i.getSlotValue(u.slots||[]),l={},f={};d.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(l[e]=a.propsValue[e],o&&o.length>1&&m.push({name:"update:"+e,description:t.description,selectable:"value:["+t.type+"]"}))}}),m.forEach(t=>{let e=t.name;if(e.includes("-")){let p=e.split("-");p=p.map((_,U)=>V.firstUpper(_)),e=p.join("")}else e=V.firstUpper(e);const o="on"+e;l[o]=(...p)=>{const _={arr:p,_date_:new Date().getTime()};r.emitValue[t.name]=_}});let g;return h.forEach(t=>{const e=t.name||"default";f[e]=o=>{if(r.slotValue[e])return s.h(s.defineComponent({props:{scope:{type:Object}},template:r.slotValue[e]}),{scope:o})}}),s.h("div",{class:"use"},[s.h("div",{class:"use-props"},s.h(x,{name:n.name,list:d,onChange:(t,e)=>{a.propsValue=t,a.propsText=e}})),s.h("div",{class:"use-component"},s.h(c,{...l,ref:t=>{g=t}},f)),s.h("div",{class:"use-code"},s.h(E,{name:n.name,value:l,propsText:a.propsText,slotValue:r.slotValue})),s.h("div",{class:"use-emit"},s.h(q,{name:n.name,list:m,value:r.emitValue})),s.h("div",{class:"use-expose"},s.h(b,{name:n.name,list:y,getRef:()=>g})),s.h("div",{class:"use-slot"},s.h(C,{name:n.name,list:h,onChange:(t,e)=>{r.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{}}}});module.exports=j;
|
|
@@ -26,7 +26,7 @@ const K = g({
|
|
|
26
26
|
}), o = f.value;
|
|
27
27
|
let i = "div";
|
|
28
28
|
o.component ? i = j(o.component) : o.name && (i = T(o.name));
|
|
29
|
-
const p = f.param, d = D(p.propss), c = w(p.emitss), x = U(p.exposes), V = k(p.slots), l = {}, v = {};
|
|
29
|
+
const p = f.param, d = D(p.propss || []), c = w(p.emitss || []), x = U(p.exposes || []), V = k(p.slots || []), l = {}, v = {};
|
|
30
30
|
d.forEach((s) => {
|
|
31
31
|
let e = s.name;
|
|
32
32
|
if (!e.includes(".")) {
|