@fangzhongya/vue-archive 0.0.34 → 0.0.36
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 +65 -30
- package/dist/node/index.js +65 -30
- package/dist/packages/components/compo/index.cjs +1 -1
- package/dist/packages/components/compo/index.js +2 -1
- package/dist/packages/components/use/code.cjs +12 -10
- package/dist/packages/components/use/code.d.ts +1 -0
- package/dist/packages/components/use/code.js +135 -111
- package/dist/packages/components/use/index.cjs +1 -1
- package/dist/packages/components/use/index.js +23 -22
- package/dist/packages/utils/common.d.ts +1 -0
- package/dist/packages/utils/glob.cjs +2 -2
- package/dist/packages/utils/glob.d.ts +1 -1
- package/dist/packages/utils/glob.js +226 -221
- package/dist/packages/utils/props.cjs +1 -1
- package/dist/packages/utils/props.js +6 -0
- package/package.json +1 -1
|
@@ -1,175 +1,199 @@
|
|
|
1
1
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
2
2
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
3
|
-
import { humpToLine as
|
|
3
|
+
import { humpToLine as H } 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 U } 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 O } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
10
10
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
11
11
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
12
|
-
import {
|
|
13
|
-
import { getPropsValue as
|
|
14
|
-
import { getFunctionFormat as
|
|
15
|
-
const
|
|
16
|
-
function S(
|
|
17
|
-
return
|
|
12
|
+
import { getTypeValue as E, parseParamString as j, setDataType as Z, vueFormat as F, prettierFormat as q, getFunBody as x } from "./util.js";
|
|
13
|
+
import { getPropsValue as G, getEmitsValue as I, getExposeValue as K, getSlotValue as M } from "../../utils/props.js";
|
|
14
|
+
import { getFunctionFormat as Q } from "@fangzhongya/utils/basic/string/toFunction";
|
|
15
|
+
const R = ["class"];
|
|
16
|
+
function S(t, e) {
|
|
17
|
+
return t.filter((n) => n.name == e)[0];
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function z(t) {
|
|
20
|
+
return t.map((e) => (e.prop || "...arr") + ":" + Z(e.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const p = [],
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
Object.keys(
|
|
27
|
-
let
|
|
28
|
-
if (/^on[A-Z]/.test(
|
|
29
|
-
let i =
|
|
30
|
-
const c =
|
|
31
|
-
let
|
|
32
|
-
if (c.length > 1 ? (
|
|
33
|
-
let f =
|
|
34
|
-
f = f.map((h,
|
|
22
|
+
function ht(t, e, n, s, u, $) {
|
|
23
|
+
const p = [], o = [];
|
|
24
|
+
let y = !0;
|
|
25
|
+
const B = G(e.propss || []), C = I(e.emitss || []), J = K(e.exposes || []), N = M(e.slots || []);
|
|
26
|
+
Object.keys(n).forEach((r) => {
|
|
27
|
+
let a = n[r];
|
|
28
|
+
if (/^on[A-Z]/.test(r) && typeof a == "function") {
|
|
29
|
+
let i = r.substring(2);
|
|
30
|
+
const c = r.split(":");
|
|
31
|
+
let m;
|
|
32
|
+
if (c.length > 1 ? (m = c[0] + c.slice(1).map((f) => O(f)).join(""), i = U(i)) : (m = c[0], i = H(i)), c.includes("-")) {
|
|
33
|
+
let f = m.split("-");
|
|
34
|
+
f = f.map((h, V) => V != 0 ? O(h) : h), m = f.join("");
|
|
35
35
|
}
|
|
36
|
-
p.push(" @" + i + '="' +
|
|
37
|
-
const l = S(
|
|
38
|
-
|
|
39
|
-
const g = Q(y);
|
|
40
|
-
n.push(`// ${l.description} ${l.name}: (${l.selectable})`), n.push("function " + a + "(" + g + ") {"), y.forEach((f) => {
|
|
36
|
+
p.push(" @" + i + '="' + m + '"');
|
|
37
|
+
const l = S(C, i) || {}, d = l.selectable || "", b = j(d), g = z(b);
|
|
38
|
+
o.push(`// ${l.description} ${l.name}: (${l.selectable})`), o.push("function " + m + "(" + g + ") {"), b.forEach((f) => {
|
|
41
39
|
const h = f.name || "arr";
|
|
42
|
-
|
|
43
|
-
}),
|
|
40
|
+
o.push(" console.log('" + f.label + "', " + h + ")");
|
|
41
|
+
}), o.push("}");
|
|
44
42
|
} else {
|
|
45
|
-
let i =
|
|
46
|
-
|
|
47
|
-
const c = S(
|
|
48
|
-
if (
|
|
43
|
+
let i = r;
|
|
44
|
+
R.includes(r) && (i = r + "1"), p.push(" :" + r + '="' + i + '"');
|
|
45
|
+
const c = S(B, r) || {}, m = P(c);
|
|
46
|
+
if (o.push(
|
|
49
47
|
`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`
|
|
50
|
-
), typeof
|
|
51
|
-
|
|
52
|
-
"const " +
|
|
48
|
+
), typeof a == "function")
|
|
49
|
+
o.push(
|
|
50
|
+
"const " + r + " = " + D(a, r, u)
|
|
53
51
|
);
|
|
54
|
-
else if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"const " + i + " =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
else if (y && (y = !1, o.unshift("import { ref } from 'vue';")), typeof a > "u")
|
|
53
|
+
if (m.type == "function") {
|
|
54
|
+
const l = X(c);
|
|
55
|
+
o.push("const " + i + " = " + l + ";");
|
|
56
|
+
} else {
|
|
57
|
+
const l = E(m.dataType);
|
|
58
|
+
o.push(
|
|
59
|
+
"const " + i + " = ref(" + (l === "undefined" ? "" : l) + ");"
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
let l = w(a, r, u);
|
|
64
|
+
o.push("const " + i + " = ref(" + l + ");");
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
});
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
`// ${
|
|
68
|
+
const T = Object.values($ || {});
|
|
69
|
+
T.length > 0 && (y && (y = !1, o.unshift("import { ref } from 'vue';")), p.unshift(' ref="refDom"'), o.push("const refDom = ref()"), T.forEach((r) => {
|
|
70
|
+
const a = S(J, r.name) || {};
|
|
71
|
+
o.push(
|
|
72
|
+
`// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`
|
|
70
73
|
);
|
|
71
|
-
const i =
|
|
72
|
-
c.forEach((d,
|
|
74
|
+
const i = r.name + "Value", c = j(a?.selectable || ""), m = [], l = r.params || [];
|
|
75
|
+
c.forEach((d, b) => {
|
|
73
76
|
const g = d.name;
|
|
74
77
|
if (g) {
|
|
75
|
-
const f = g +
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
"const " + f + " = " +
|
|
78
|
+
const f = g + r.name, h = l[b];
|
|
79
|
+
if (o.push(`// ${d.label}`), typeof h == "function")
|
|
80
|
+
o.push(
|
|
81
|
+
"const " + f + " = " + D(h, g, r.text)
|
|
79
82
|
);
|
|
80
83
|
else if (typeof h > "u")
|
|
81
|
-
|
|
82
|
-
"const " + f + " = " +
|
|
84
|
+
o.push(
|
|
85
|
+
"const " + f + " = " + E(d.dataType) + ";"
|
|
83
86
|
);
|
|
84
87
|
else {
|
|
85
|
-
let
|
|
86
|
-
|
|
88
|
+
let V = w(h, g, r.text);
|
|
89
|
+
o.push("const " + f + " = " + V + ";");
|
|
87
90
|
}
|
|
88
|
-
|
|
91
|
+
m.push(f);
|
|
89
92
|
}
|
|
90
|
-
}),
|
|
91
|
-
`const ${i} = refDom.value?.${
|
|
92
|
-
) :
|
|
93
|
+
}), r.type === "function" ? o.push(
|
|
94
|
+
`const ${i} = refDom.value?.${r.name}(${m.join(", ")})`
|
|
95
|
+
) : o.push(`const ${i} = refDom.value?.${r.name}`), o.push(`console.log('"${a.type}"', ${i})`);
|
|
93
96
|
})), p.length > 0 && p.unshift("");
|
|
94
|
-
const
|
|
95
|
-
return `<!--${
|
|
97
|
+
const A = W(s, N);
|
|
98
|
+
return `<!--${t}-->
|
|
96
99
|
<template>
|
|
97
100
|
<div>
|
|
98
|
-
<${
|
|
99
|
-
`)}>${
|
|
101
|
+
<${t}${p.join(`
|
|
102
|
+
`)}>${A.join(`
|
|
100
103
|
`)}
|
|
101
|
-
</${
|
|
104
|
+
</${t}>
|
|
102
105
|
</div>
|
|
103
106
|
</template>
|
|
104
107
|
<script lang="ts" setup>
|
|
105
|
-
${
|
|
108
|
+
${o.join(`
|
|
106
109
|
`)}
|
|
107
110
|
<\/script>
|
|
108
111
|
`;
|
|
109
112
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
return Object.keys(
|
|
113
|
-
const
|
|
113
|
+
function W(t = {}, e) {
|
|
114
|
+
const n = [];
|
|
115
|
+
return Object.keys(t).forEach((s) => {
|
|
116
|
+
const u = S(e, s) || {}, $ = t[s];
|
|
114
117
|
if ($) {
|
|
115
|
-
const p = ` <!-- ${
|
|
116
|
-
<template #${
|
|
117
|
-
${
|
|
118
|
+
const p = ` <!-- ${u.description} ${u.name}:(${u.selectable}) -->
|
|
119
|
+
<template #${s}="scope">
|
|
120
|
+
${F($, " ")}
|
|
118
121
|
</template>`;
|
|
119
|
-
|
|
122
|
+
n.push(p);
|
|
120
123
|
}
|
|
121
|
-
}),
|
|
124
|
+
}), n && n.length > 0 && n.unshift(""), n;
|
|
122
125
|
}
|
|
123
|
-
function
|
|
124
|
-
const
|
|
125
|
-
return
|
|
126
|
+
function D(t, e, n) {
|
|
127
|
+
const s = n ? n[e] : "";
|
|
128
|
+
return s || L(t.toString());
|
|
126
129
|
}
|
|
127
|
-
function
|
|
128
|
-
const e =
|
|
130
|
+
function L(t) {
|
|
131
|
+
const e = Q(q(t));
|
|
129
132
|
if (e) {
|
|
130
|
-
let
|
|
131
|
-
${
|
|
133
|
+
let n = `{
|
|
134
|
+
${F(x(e.body), " ")}
|
|
132
135
|
}`;
|
|
133
|
-
return `function (${e.param}) ${
|
|
136
|
+
return `function (${e.param}) ${n}`;
|
|
134
137
|
} else
|
|
135
138
|
return "undefined";
|
|
136
139
|
}
|
|
137
|
-
function
|
|
138
|
-
const e =
|
|
139
|
-
|
|
140
|
+
function X(t) {
|
|
141
|
+
const e = j(t.selectable), n = z(e);
|
|
142
|
+
let s = "";
|
|
143
|
+
t.return && (s = "return ");
|
|
144
|
+
let u = `{
|
|
145
|
+
${F(x(s), " ")}
|
|
146
|
+
}`;
|
|
147
|
+
return `function (${n}) ${u}`;
|
|
140
148
|
}
|
|
141
|
-
function
|
|
142
|
-
const
|
|
143
|
-
return
|
|
149
|
+
function Y(t) {
|
|
150
|
+
const e = t.trim();
|
|
151
|
+
return /^\(/.test(e) ? L(e) : JSON.stringify(t);
|
|
144
152
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
function w(t, e, n) {
|
|
154
|
+
const s = n ? n[e] : "";
|
|
155
|
+
return s || (typeof t == "string" ? Y(t + "") : JSON.stringify(t));
|
|
156
|
+
}
|
|
157
|
+
function P(t) {
|
|
158
|
+
let e = _(t?.type), n = "any";
|
|
159
|
+
e.length == 1 && (n = e[0].split("<")[0]);
|
|
160
|
+
const s = n;
|
|
161
|
+
let u = (t?.selectable || "").trim(), $ = [];
|
|
162
|
+
return u && n != "boolean" && (u.includes("|") ? u.split("|").forEach((p) => {
|
|
151
163
|
if (p) {
|
|
152
|
-
let
|
|
164
|
+
let o = p.split(":");
|
|
153
165
|
$.push({
|
|
154
166
|
label: p,
|
|
155
|
-
prop:
|
|
167
|
+
prop: o[0].trim()
|
|
156
168
|
});
|
|
157
169
|
}
|
|
158
|
-
}),
|
|
170
|
+
}) : $ = j(u), n == "function" ? n = "function" : n == "array" ? n = "choice" : n = "select"), {
|
|
159
171
|
arr: $,
|
|
160
|
-
zdtype:
|
|
161
|
-
type:
|
|
172
|
+
zdtype: s,
|
|
173
|
+
type: n,
|
|
162
174
|
dataType: e
|
|
163
175
|
};
|
|
164
176
|
}
|
|
165
|
-
function
|
|
177
|
+
function _(t) {
|
|
166
178
|
let e = [];
|
|
167
|
-
return (
|
|
168
|
-
|
|
179
|
+
return (t || "").trim().toLowerCase().split(",").forEach((s) => {
|
|
180
|
+
s = s.trim(), s && e.push(s);
|
|
169
181
|
}), [...new Set(e)].sort();
|
|
170
182
|
}
|
|
183
|
+
function v(t) {
|
|
184
|
+
try {
|
|
185
|
+
return new Function(`{ return ${t} }`)();
|
|
186
|
+
} catch {
|
|
187
|
+
return "" + t;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function $t(t) {
|
|
191
|
+
const e = P(t), n = E(e.dataType), s = (t.default || "").trim();
|
|
192
|
+
return v(s || n);
|
|
193
|
+
}
|
|
171
194
|
export {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
195
|
+
$t as getDefaultValue,
|
|
196
|
+
ht as getHmtl,
|
|
197
|
+
P as getSpecType,
|
|
198
|
+
w as setValStringify
|
|
175
199
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),l=require("../../utils/props.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const
|
|
1
|
+
"use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),E=require("./code.cjs"),l=require("../../utils/props.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const j=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(O,U,v,D,u){const p=s.reactive({emitValue:{},slotValue:{}}),r=v.value;let c="div";r.component?c=s.defineAsyncComponent(r.component):r.name&&(c=s.resolveComponent(r.name));const i=v.param||{},h=l.getPropsValue(i.propss||[]),m=l.getEmitsValue(i.emitss||[]),V=l.getExposeValue(i.exposes||[]),f=l.getSlotValue(i.slots||[]),a={},q={};h.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(a[e]=u.propsValue[e]??E.getDefaultValue(t),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 n=e.split("-");n=n.map((_,P)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};p.emitValue[t.name]=_}});let d;return f.forEach(t=>{const e=t.name||"default";q[e]=o=>{if(p.slotValue[e]){const n=p.slotValue[e];return s.h(s.defineComponent({props:{scope:{type:Object}},template:n}),{scope:o})}}}),s.h("div",{class:"use"},[s.h("div",{class:"use-props"},s.h(g,{name:r.name,list:h,onChange:(t,e)=>{u.propsValue=t,u.propsText=e}})),s.h("div",{class:"use-component"},s.h(c,{...a,ref:t=>{d=t}},q)),s.h("div",{class:"use-code"},s.h(T,{name:r.name,param:i,value:a,propsText:u.propsText,exposeText:u.exposeText,slotValue:p.slotValue})),s.h("div",{class:"use-emit"},s.h(y,{name:r.name,list:m,value:p.emitValue})),s.h("div",{class:"use-expose"},s.h(C,{name:r.name,list:V,getRef:()=>d,onChange:t=>{u.exposeText=t}})),s.h("div",{class:"use-slot"},s.h(b,{name:r.name,list:f,onChange:(t,e)=>{p.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=j;
|
|
@@ -6,7 +6,8 @@ import E from "./set-code.vue.js";
|
|
|
6
6
|
import O from "./set-expose.vue.js";
|
|
7
7
|
/* empty css */
|
|
8
8
|
import $ from "./set-slot.vue.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getDefaultValue as D } from "./code.js";
|
|
10
|
+
import { getPropsValue as U, getEmitsValue as k, getExposeValue as w, getSlotValue as A } from "../../utils/props.js";
|
|
10
11
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
11
12
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
12
13
|
import "@fangzhongya/utils/name/humpToLine";
|
|
@@ -18,7 +19,7 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
|
18
19
|
import { firstUpper as g } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
19
20
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
20
21
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
21
|
-
const
|
|
22
|
+
const me = _({
|
|
22
23
|
/**
|
|
23
24
|
* @props {Stinrg} value 插入数据
|
|
24
25
|
*/
|
|
@@ -30,19 +31,19 @@ const oe = _({
|
|
|
30
31
|
type: Object
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
|
-
render(
|
|
34
|
-
const
|
|
34
|
+
render(P, R, f, S, r) {
|
|
35
|
+
const n = T({
|
|
35
36
|
emitValue: {},
|
|
36
37
|
slotValue: {}
|
|
37
38
|
}), o = f.value;
|
|
38
39
|
let l = "div";
|
|
39
40
|
o.component ? l = b(o.component) : o.name && (l = j(o.name));
|
|
40
|
-
const a = f.param || {}, d =
|
|
41
|
+
const a = f.param || {}, d = U(a.propss || []), c = k(a.emitss || []), h = w(a.exposes || []), V = A(a.slots || []), i = {}, x = {};
|
|
41
42
|
d.forEach((t) => {
|
|
42
43
|
let e = t.name;
|
|
43
44
|
if (!e.includes(".")) {
|
|
44
45
|
let p = e.split("/");
|
|
45
|
-
e = (p[0] || "").trim(), e && (i[e] =
|
|
46
|
+
e = (p[0] || "").trim(), e && (i[e] = r.propsValue[e] ?? D(t), p && p.length > 1 && c.push({
|
|
46
47
|
name: "update:" + e,
|
|
47
48
|
description: t.description,
|
|
48
49
|
selectable: "value:[" + t.type + "]"
|
|
@@ -52,7 +53,7 @@ const oe = _({
|
|
|
52
53
|
let e = t.name;
|
|
53
54
|
if (e.includes("-")) {
|
|
54
55
|
let m = e.split("-");
|
|
55
|
-
m = m.map((u,
|
|
56
|
+
m = m.map((u, q) => g(u)), e = m.join("");
|
|
56
57
|
} else
|
|
57
58
|
e = g(e);
|
|
58
59
|
const p = "on" + e;
|
|
@@ -61,15 +62,15 @@ const oe = _({
|
|
|
61
62
|
arr: m,
|
|
62
63
|
_date_: (/* @__PURE__ */ new Date()).getTime()
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
+
n.emitValue[t.name] = u;
|
|
65
66
|
};
|
|
66
67
|
});
|
|
67
68
|
let v;
|
|
68
|
-
return
|
|
69
|
+
return V.forEach((t) => {
|
|
69
70
|
const e = t.name || "default";
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
const m =
|
|
71
|
+
x[e] = (p) => {
|
|
72
|
+
if (n.slotValue[e]) {
|
|
73
|
+
const m = n.slotValue[e];
|
|
73
74
|
return s(
|
|
74
75
|
_({
|
|
75
76
|
props: {
|
|
@@ -100,7 +101,7 @@ const oe = _({
|
|
|
100
101
|
name: o.name,
|
|
101
102
|
list: d,
|
|
102
103
|
onChange: (t, e) => {
|
|
103
|
-
|
|
104
|
+
r.propsValue = t, r.propsText = e;
|
|
104
105
|
}
|
|
105
106
|
})
|
|
106
107
|
),
|
|
@@ -117,7 +118,7 @@ const oe = _({
|
|
|
117
118
|
v = t;
|
|
118
119
|
}
|
|
119
120
|
},
|
|
120
|
-
|
|
121
|
+
x
|
|
121
122
|
)
|
|
122
123
|
),
|
|
123
124
|
s(
|
|
@@ -129,9 +130,9 @@ const oe = _({
|
|
|
129
130
|
name: o.name,
|
|
130
131
|
param: a,
|
|
131
132
|
value: i,
|
|
132
|
-
propsText:
|
|
133
|
-
exposeText:
|
|
134
|
-
slotValue:
|
|
133
|
+
propsText: r.propsText,
|
|
134
|
+
exposeText: r.exposeText,
|
|
135
|
+
slotValue: n.slotValue
|
|
135
136
|
})
|
|
136
137
|
),
|
|
137
138
|
s(
|
|
@@ -142,7 +143,7 @@ const oe = _({
|
|
|
142
143
|
s(y, {
|
|
143
144
|
name: o.name,
|
|
144
145
|
list: c,
|
|
145
|
-
value:
|
|
146
|
+
value: n.emitValue
|
|
146
147
|
})
|
|
147
148
|
),
|
|
148
149
|
s(
|
|
@@ -155,7 +156,7 @@ const oe = _({
|
|
|
155
156
|
list: h,
|
|
156
157
|
getRef: () => v,
|
|
157
158
|
onChange: (t) => {
|
|
158
|
-
|
|
159
|
+
r.exposeText = t;
|
|
159
160
|
}
|
|
160
161
|
})
|
|
161
162
|
),
|
|
@@ -166,9 +167,9 @@ const oe = _({
|
|
|
166
167
|
},
|
|
167
168
|
s($, {
|
|
168
169
|
name: o.name,
|
|
169
|
-
list:
|
|
170
|
+
list: V,
|
|
170
171
|
onChange: (t, e) => {
|
|
171
|
-
|
|
172
|
+
n.slotValue[t] = e;
|
|
172
173
|
}
|
|
173
174
|
})
|
|
174
175
|
)
|
|
@@ -191,5 +192,5 @@ const oe = _({
|
|
|
191
192
|
// },
|
|
192
193
|
});
|
|
193
194
|
export {
|
|
194
|
-
|
|
195
|
+
me as default
|
|
195
196
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)}async function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../config.cjs"),G=require("@fangzhongya/utils/html/getVueText"),c=require("./common.cjs"),B=require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const E=require("@fangzhongya/utils/name/humpToLine"),A=require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const W=require("@fangzhongya/utils/basic/string/firstLower"),F=require("@fangzhongya/utils/basic/array/duplicateRemoval"),M=require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");const h=require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const D=require("./index.cjs"),w={},d={},v=[],I={},j={},g={};function J(){return b.getConfig("example")}function Q(t,e,n,r){const a=B.mergeObject(e,n||{},3,!0);a.exampless=a.exampless||[],a.examplessRaw=a.examplessRaw||[];const s=[],i=a.examples;i&&Object.keys(i).forEach(o=>{s.push(o),j[o]=i[o]});const u=a.examplesRaw,l=[];if(a.urls&&a.urls.length>0?(a.exampless=a.urls,a.urls.forEach(o=>{l.push(o),u&&(g[o]=N(u,o))})):(a.exampless=s,u&&Object.keys(u).forEach(o=>{l.push(o),g[o]=N(u,o)})),a.examples=void 0,e.tests&&r){const o=e.testsNanme||"/tests/";typeof o=="string"?Object.keys(r).forEach(f=>{f.includes(o)&&(a.exampless.push(f),l.push(f),g[f]=N(r,f))}):Object.keys(r).forEach(f=>{o.test(f)&&(a.exampless.push(f),l.push(f),g[f]=N(r,f))})}a.exampless=[...new Set(a.exampless)],a.examplessRaw=[...new Set(l)],a.examplesRaw=void 0,I[t]=a}function N(t,e){return typeof t=="function"?t:t&&(t[e]||t)}const q={};function X(t){const e=b.getConfig("resolve");if(q[t])return q[t];for(let n of e)if(t.startsWith(n.find+"/")){const a=n.replacement.replaceAll("\\","/")+t.replace(n.find+"/","/");return q[t]=a,a}}async function Y(t,e){let n="";if(e=="vue"?n=G.getVueTexts(t).script:(e=="js"||e=="ts"||e=="")&&(n=t),n){const r=await D.getTextImport(n),a=[];return r&&r.length>0&&r.forEach(s=>{if(s)if(s.startsWith("./")||s.startsWith("../"))a.push(s);else{const i=X(s);i&&a.push(i)}}),a}}function Z(t){return new Promise(e=>{t?t.raw?e(t.raw):t.getRaw?t.getRaw(t).then(n=>{const r=C(n);t.raw=r,t.getRaw=null,e(r)}):e(""):e("")})}function K(t,e){t=(t||"")+"";let n="";switch(t){case"1":n=e.tdir+"/";break;case"2":n=e.adir+"/";break;case"3":n=e.tdir+"/"+e.adir+"/";break}return n}function _(t,e,n){t=(t||"")+"",n=(n||"")+"";let r=E.humpToLine(e.name),a=[];const s=Object.values(e.aliass||{});if(t==="1")e.alias&&a.push(e.alias+"-"+r);else if(t==="2")s&&s.length>0&&s.forEach(u=>{a.push(u+"-"+r)});else if(t==="3"){let u="";e.alias&&(u=e.alias+"-"),s?.forEach(l=>{a.push(u+l+"-"+r)})}else t==="4"?e.aliasNames?.forEach(u=>{a.push(E.humpToLine(u))}):t=="9"&&(a.push(r),e.aliasNames?.forEach(u=>{a.push(E.humpToLine(u))}));a.length==0&&a.push(r);let i=[];return n==="1"?a.forEach(u=>{let l=A.lineToLargeHump(u);i.push(l,W.firstLower(l))}):n==="2"?a.forEach(u=>{let l=A.lineToLargeHump(u);i.push(u,l,W.firstLower(l))}):i=[...a],i=[...new Set(i)],i}function y(t,e,n,r){const a=[];return n.examplessRaw.forEach(s=>{for(let i=0;i<e.length;i++){const u=e[i];if(s==t+u+n.md+".md"){a.push({topurl:t,comkey:r.key,suffix:h.getSuffix(s),name:r.name,value:u,key:s,raw:"",getRaw:c.getRawValue(g,s)});break}}}),a}function P(t){R();const e=w[t];if(e.tests&&Object.keys(e.tests).length>0)return e.tests;{const n=I[e.dir],r=n.dir+K(n.level||0,e),a=_(n.aliaslevel||0,e,n.componentName||0);e.mds=y(r,a,n,e);const s={};return n.exampless.forEach(i=>{for(let u=0;u<a.length;u++){const l=a[u];if(i.startsWith(r+l+"/")){const o=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),f=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let p=i.match(o)||i.match(f);if(p&&p.length>0){let m="";p&&p.length>1&&(m=p[1]),s[i]={topurl:r,name:l,value:m,suffix:h.getSuffix(i),comname:e.name,comkey:e.key,key:i,dir:e.dir,url:i,component:j[i],raw:"",getRaw:c.getRawValue(g,i)};break}}}}),n.tests&&z(s,e,n),e.tests=s,s}}function z(t,e,n){const r=e.url.substring(0,e.url.lastIndexOf("/"+e.value+"/"))+"/"+e.value,a=n.testsNanme||"/tests/";typeof a=="string"?n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:c.getRawValue(g,s)});else if(s.startsWith(r+a)){const i=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),u=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let l=s.match(i)||s.match(u);if(l&&l.length>0){let o="";l&&l.length>1&&(o=l[1]),t[s]={topurl:r,name:e.value,value:o,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,key:s,dir:e.dir,url:s,component:j[s],raw:"",getRaw:c.getRawValue(g,s)}}}}}):n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:c.getRawValue(g,s)});else if(a.test(s)){const i=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),u=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let l=s.match(i)||s.match(u);if(l&&l.length>0){let o="";l&&l.length>1&&(o=l[1]),t[s]={topurl:r,name:e.value,value:o,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,key:s,dir:e.dir,url:s,component:j[s],raw:"",getRaw:c.getRawValue(g,s)}}}}})}function k(t){if(t){const e=P(t);return Object.values(e)}else return[]}function ee(t,e,n){R();const r=P(n),a=[];if(e){let s=r[e];if(s)return a.push(s),a}return Object.values(r).forEach(s=>{s.name+"/"+s.value==t&&a.push(s)}),a}function te(t){return P(t),w[t].mds}async function V(t,e,n,r,a,s,i){let u=await Y(e,n)||[],l=a.split("/");return u.map(o=>{if(o.startsWith("./")){let f=l.slice(0,l.length-1).join("/"),p=o.substring(2);const m=f.replace(/^\.\/|((\.\.\/)+)/,"/");let x=t.indexOf(m)+m.length;return{key:t.substring(0,x)+"/"+p,name:o,comprops:s||"",curprops:i||"",value:p,suffix:h.getSuffix(o),head:f,dir:r,url:f+"/"+p}}else if(o.startsWith("../")){let f=o.split("/"),p=0;for(let L=0;L<f.length;L++)if(f[L]!=".."){p=L;break}let m=f.slice(p,f.length),x=l.slice(0,l.length-p-1).join("/"),O=m.join("/");const S=x.replace(/^\.\/|((\.\.\/)+)/,"/");let H=t.indexOf(S)+S.length;return{key:t.substring(0,H)+"/"+O,name:O,comprops:s||"",curprops:i||"",value:O,suffix:h.getSuffix(o),head:x,dir:r,url:x+"/"+O}}else{const f=r.replace(/^\.\/|((\.\.\/)+)/,"/");let p=o.indexOf(f)+f.length,m=o.substring(p),x=r.substring(0,r.length-1);return{key:o,name:m,comprops:s||"",curprops:i||"",value:m,suffix:h.getSuffix(o),head:x,dir:r,url:x+"/"+m}}})}function se(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>({raw:"",name:r.name,value:r.value,suffix:h.getSuffix(r.key),key:r.key,getRaw:c.getRawValue(g,r.key)}));M.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(u=>{const l=C(u);s.raw=l,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}function ne(){const t=J();b.getConfig("components")?.forEach(n=>{const r=ie(n);let a=n.dir||"";Q(a,t,n.example,r)})}const T="default";function re(t){let e=E.humpToLine(t.name),n=[...t.aliasNames];n.push(e),n.forEach(r=>{v.push({name:r,value:t.key})})}function ae(t,e){const n={};e?.forEach(r=>{w[r.key]=r,re(r);const a=Object.values(r.aliass||{});a&&a.length?a.forEach(s=>{n[s]=n[s]||[],n[s].push(r.key)}):(n[T]=n[T]||[],n[T].push(r.key))})}function ie(t){let e,n;const r=t.resolver;r&&Object.keys(r).forEach(s=>{typeof t[s]>"u"&&(t[s]=r[s])}),e=t.alias||T;let a=t?.urls||Object.keys(t.componentsRaw);return n=c.getComponentsArr(a,t,t.componentsRaw,t.components,t),n&&n?.props&&n.props.forEach(s=>{d[s.url]=s}),ae(e,n.components),t.componentsRaw}function le(t){return R(),w[t]}function R(){return Object.keys(w).length==0&&ne(),Object.values(w)}function oe(){return R(),d}function ue(t,e,n){R();const r=[];if(n){let s=w[n];if(s&&s.key)return[s]}let a=E.humpToLine(t);return v.forEach(s=>{e?s.name.includes(a)&&r.push(w[s.value]):s.name==a&&r.push(w[s.value])}),F.duplicateRemoval(r,"key")}async function fe(t,e){let n=t;if(t){let r=(await V(e.key,t,e.suffix,e.dir,e.url,e.comprops,e.curprops)).filter(a=>c.isComprops(a.key,e.comprops||"")||c.isCurprops(a.key,e.curprops||""));n=await $(r)+n}return n}function ce(t){const e=t.url,n=t.key;return d[e]||d[e+".js"]||d[e+".ts"]||d[n]||d[n+".js"]||d[n+".ts"]}function U(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>ce(r)).filter(r=>!!r);M.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(async u=>{const l=C(u);let o=await fe(l,t[i]);s.raw=o,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}async function $(t){return((await U(t))?.map(r=>r.raw)||[]).join(`
|
|
2
|
+
`)}async function pe(t,e){let n=t;if(t&&(e.comprops||e.curprops)){let r=(await V(e.key,t,e.suffix,e.dir,e.url,e.comprops||"",e.curprops)).filter(s=>c.isComprops(s.key,e.comprops||"")||c.isCurprops(s.key,e.curprops||""));n=await $(r)+n}return n}function C(t){return t&&typeof t=="object"?t.default||"":(t||"")+""}function me(t){return new Promise(e=>{if(t){R();const n=w[t];n?n.raw?e(n.raw):n.getRaw?n.getRaw(n).then(r=>{const a=C(r);pe(a,n).then(s=>{n.raw=s,n.getRaw=null,e(s)})}):e(""):e("")}else e("")})}exports.defaultName=T;exports.getCompoName=ue;exports.getCompoNameKey=le;exports.getCompoNameObj=R;exports.getComponentPropsObjs=oe;exports.getGetRawValue=C;exports.getKeyMds=te;exports.getLevelUrl=K;exports.getLocalTextArr=se;exports.getLocalTextComponents=me;exports.getLocalTextTests=Z;exports.getPropsRaws=U;exports.getTestImportUrl=V;exports.getTestName=k;exports.getTestNameObj=ee;
|
|
@@ -21,7 +21,7 @@ export declare function getKeyMds(key: string): MdObj[] | undefined;
|
|
|
21
21
|
* @param {*} arr
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
export declare function getTestImportUrl(key: string, text: string, type: string, dir: string, url: string, comprops?: string): Promise<Array<PropObj>>;
|
|
24
|
+
export declare function getTestImportUrl(key: string, text: string, type: string, dir: string, url: string, comprops?: string, curprops?: string): Promise<Array<PropObj>>;
|
|
25
25
|
export declare function getLocalTextArr(arr: Array<PropObj>): Promise<TextObj[]>;
|
|
26
26
|
export declare const defaultName = "default";
|
|
27
27
|
export declare function getCompoNameKey(key: string): ComponentsObj;
|