@fangzhongya/vue-archive 0.0.2-40 → 0.0.2-41
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 +277 -19
- package/dist/node/index.js +277 -19
- package/dist/packages/components/use/code.cjs +18 -0
- package/dist/packages/components/use/code.d.ts +2 -0
- package/dist/packages/components/use/code.js +99 -0
- package/dist/packages/components/use/set-code.vue.cjs +1 -18
- package/dist/packages/components/use/set-code.vue.js +29 -111
- package/dist/packages/page/comprops/index.vue2.cjs +1 -1
- package/dist/packages/page/comprops/index.vue2.js +46 -41
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -63606,12 +63606,63 @@ function getConfig(key) {
|
|
|
63606
63606
|
var import_standalone = __toESM(require_standalone(), 1);
|
|
63607
63607
|
var import_parser_typescript = __toESM(require_parser_typescript(), 1);
|
|
63608
63608
|
var import_parser_html = __toESM(require_parser_html(), 1);
|
|
63609
|
+
function prettierFormat(st) {
|
|
63610
|
+
let str = import_standalone.default.format(st, {
|
|
63611
|
+
parser: "typescript",
|
|
63612
|
+
plugins: [import_parser_typescript.default]
|
|
63613
|
+
});
|
|
63614
|
+
return str.replace(/\;(\s|\n\r)*$/, "");
|
|
63615
|
+
}
|
|
63609
63616
|
function prettierHtml(st) {
|
|
63610
63617
|
return import_standalone.default.format(st, {
|
|
63611
63618
|
parser: "html",
|
|
63612
63619
|
plugins: [import_parser_html.default]
|
|
63613
63620
|
});
|
|
63614
63621
|
}
|
|
63622
|
+
function vueFormat(st, kg = "") {
|
|
63623
|
+
let arr = (st + "").trim().split(/\n/);
|
|
63624
|
+
arr = arr.map((v) => {
|
|
63625
|
+
return kg + v;
|
|
63626
|
+
});
|
|
63627
|
+
return arr.join("\n");
|
|
63628
|
+
}
|
|
63629
|
+
function getFunBody(sr = "") {
|
|
63630
|
+
sr = sr.trim();
|
|
63631
|
+
let body = "[\\s|\\n|\\r]*\\{((.|\n|\r)+?)\\}[\\s|\\n|\\r]*";
|
|
63632
|
+
let reg = new RegExp("^" + body + "$");
|
|
63633
|
+
let vts = reg.exec(sr);
|
|
63634
|
+
if (vts && vts.length > 0) {
|
|
63635
|
+
return getFunBody(vts[1]);
|
|
63636
|
+
} else {
|
|
63637
|
+
return sr;
|
|
63638
|
+
}
|
|
63639
|
+
}
|
|
63640
|
+
function getFunctionFormat(v) {
|
|
63641
|
+
if (v) {
|
|
63642
|
+
let st = v.toString();
|
|
63643
|
+
st = st.trim();
|
|
63644
|
+
let name = "([a-z|A-Z|_|$][a-z|A-Z|_|$|0-9]*)?";
|
|
63645
|
+
let fun = "(function\\s*" + name + "\\s*)?";
|
|
63646
|
+
let param = "(\\([^\\(|\\)]*\\)\\s*)?";
|
|
63647
|
+
let body = "[\\s|\\n|\\r]*\\{((.|\n|\r)+?)\\}[\\s|\\n|\\r]*";
|
|
63648
|
+
let reg = new RegExp(
|
|
63649
|
+
"^" + fun + param + body + "$"
|
|
63650
|
+
);
|
|
63651
|
+
let vts = reg.exec(st);
|
|
63652
|
+
let obj = {
|
|
63653
|
+
body: st,
|
|
63654
|
+
name: "",
|
|
63655
|
+
param: ""
|
|
63656
|
+
};
|
|
63657
|
+
if (vts && vts.length > 0) {
|
|
63658
|
+
obj.name = vts[2];
|
|
63659
|
+
obj.param = vts[3];
|
|
63660
|
+
obj.body = `{${vts[4]}}`;
|
|
63661
|
+
}
|
|
63662
|
+
obj.body = prettierFormat(obj.body);
|
|
63663
|
+
return obj;
|
|
63664
|
+
}
|
|
63665
|
+
}
|
|
63615
63666
|
|
|
63616
63667
|
// packages/node/index.ts
|
|
63617
63668
|
var _path = require('path');
|
|
@@ -65049,6 +65100,24 @@ var slot = {
|
|
|
65049
65100
|
}
|
|
65050
65101
|
}
|
|
65051
65102
|
};
|
|
65103
|
+
function getPropsValue(arr) {
|
|
65104
|
+
return arr.map((obj) => {
|
|
65105
|
+
const v = {};
|
|
65106
|
+
Object.keys(props).forEach((key) => {
|
|
65107
|
+
v[key] = props[key](obj);
|
|
65108
|
+
});
|
|
65109
|
+
return v;
|
|
65110
|
+
});
|
|
65111
|
+
}
|
|
65112
|
+
function getEmitsValue(arr) {
|
|
65113
|
+
return arr.map((obj) => {
|
|
65114
|
+
const v = {};
|
|
65115
|
+
Object.keys(emits).forEach((key) => {
|
|
65116
|
+
v[key] = emits[key](obj);
|
|
65117
|
+
});
|
|
65118
|
+
return v;
|
|
65119
|
+
});
|
|
65120
|
+
}
|
|
65052
65121
|
|
|
65053
65122
|
// packages/components/compo/index.ts
|
|
65054
65123
|
var notesObj = {
|
|
@@ -66335,6 +66404,137 @@ function runDev(config2, configCallback) {
|
|
|
66335
66404
|
return new FangMd(config2, configCallback);
|
|
66336
66405
|
}
|
|
66337
66406
|
|
|
66407
|
+
// packages/components/use/code.ts
|
|
66408
|
+
function getHmtl(propsname, value, slotValue, propsText) {
|
|
66409
|
+
const tarr = [];
|
|
66410
|
+
const sarr = [];
|
|
66411
|
+
let is = true;
|
|
66412
|
+
Object.keys(value).forEach((key) => {
|
|
66413
|
+
let val = value[key];
|
|
66414
|
+
if (/^on[A-Z]/.test(key) && typeof val == "function") {
|
|
66415
|
+
let name = key.substring(2);
|
|
66416
|
+
const knam = key.split(":");
|
|
66417
|
+
let strs;
|
|
66418
|
+
if (knam.length > 1) {
|
|
66419
|
+
strs = knam[0] + knam.slice(1).map((o) => firstUpper(o)).join("");
|
|
66420
|
+
name = firstLower(name);
|
|
66421
|
+
} else {
|
|
66422
|
+
strs = knam[0];
|
|
66423
|
+
name = humpToLine(name);
|
|
66424
|
+
}
|
|
66425
|
+
if (knam.includes("-")) {
|
|
66426
|
+
let arr = strs.split("-");
|
|
66427
|
+
arr = arr.map((vs, i) => {
|
|
66428
|
+
if (i != 0) {
|
|
66429
|
+
return firstUpper(vs);
|
|
66430
|
+
} else {
|
|
66431
|
+
return vs;
|
|
66432
|
+
}
|
|
66433
|
+
});
|
|
66434
|
+
strs = arr.join("");
|
|
66435
|
+
}
|
|
66436
|
+
tarr.push(
|
|
66437
|
+
" @" + name + '="' + strs + '"'
|
|
66438
|
+
);
|
|
66439
|
+
sarr.push("function " + strs + "(...arr) {");
|
|
66440
|
+
sarr.push(
|
|
66441
|
+
" console.log('" + strs + "', arr)"
|
|
66442
|
+
);
|
|
66443
|
+
sarr.push("}");
|
|
66444
|
+
} else {
|
|
66445
|
+
tarr.push(
|
|
66446
|
+
" :" + key + '="' + key + '"'
|
|
66447
|
+
);
|
|
66448
|
+
if (typeof val == "function") {
|
|
66449
|
+
sarr.push(
|
|
66450
|
+
"const " + key + " = " + getFunctionBody(
|
|
66451
|
+
val,
|
|
66452
|
+
key,
|
|
66453
|
+
propsText
|
|
66454
|
+
)
|
|
66455
|
+
);
|
|
66456
|
+
} else {
|
|
66457
|
+
if (is) {
|
|
66458
|
+
is = false;
|
|
66459
|
+
sarr.unshift(
|
|
66460
|
+
"import { ref } from 'vue';"
|
|
66461
|
+
);
|
|
66462
|
+
}
|
|
66463
|
+
if (typeof val == "undefined") {
|
|
66464
|
+
sarr.push("const " + key + " = ref();");
|
|
66465
|
+
} else {
|
|
66466
|
+
let st2 = setValStringify(
|
|
66467
|
+
val,
|
|
66468
|
+
key,
|
|
66469
|
+
propsText
|
|
66470
|
+
);
|
|
66471
|
+
sarr.push(
|
|
66472
|
+
"const " + key + " = ref(" + st2 + ");"
|
|
66473
|
+
);
|
|
66474
|
+
}
|
|
66475
|
+
}
|
|
66476
|
+
}
|
|
66477
|
+
});
|
|
66478
|
+
if (tarr.length > 0) {
|
|
66479
|
+
tarr.unshift("");
|
|
66480
|
+
}
|
|
66481
|
+
const slots = getSlots(slotValue);
|
|
66482
|
+
const st = `<!--${propsname}-->
|
|
66483
|
+
<template>
|
|
66484
|
+
<div>
|
|
66485
|
+
<${propsname}${tarr.join("\n")}>${slots.join("\n")}
|
|
66486
|
+
</${propsname}>
|
|
66487
|
+
</div>
|
|
66488
|
+
</template>
|
|
66489
|
+
<script lang="ts" setup>
|
|
66490
|
+
${sarr.join("\n")}
|
|
66491
|
+
</script>
|
|
66492
|
+
`;
|
|
66493
|
+
return st;
|
|
66494
|
+
}
|
|
66495
|
+
function getSlots(obj = {}) {
|
|
66496
|
+
const arr = [];
|
|
66497
|
+
Object.keys(obj).forEach((key) => {
|
|
66498
|
+
const v = obj[key];
|
|
66499
|
+
if (v) {
|
|
66500
|
+
const st = ` <template #${key}="scope">
|
|
66501
|
+
${vueFormat(v, " ")}
|
|
66502
|
+
</template>`;
|
|
66503
|
+
arr.push(st);
|
|
66504
|
+
}
|
|
66505
|
+
});
|
|
66506
|
+
if (arr && arr.length > 0) {
|
|
66507
|
+
arr.unshift("");
|
|
66508
|
+
}
|
|
66509
|
+
return arr;
|
|
66510
|
+
}
|
|
66511
|
+
function getFunctionBody(v, key, propsText) {
|
|
66512
|
+
const text = propsText ? propsText[key] : "";
|
|
66513
|
+
if (text) {
|
|
66514
|
+
return "function" + text;
|
|
66515
|
+
} else {
|
|
66516
|
+
const st = getFunctionFormat(
|
|
66517
|
+
prettierFormat(v.toString())
|
|
66518
|
+
);
|
|
66519
|
+
if (st) {
|
|
66520
|
+
let body = `{
|
|
66521
|
+
${vueFormat(getFunBody(st.body), " ")}
|
|
66522
|
+
}`;
|
|
66523
|
+
return `function${st.param}${body}`;
|
|
66524
|
+
} else {
|
|
66525
|
+
return "undefined";
|
|
66526
|
+
}
|
|
66527
|
+
}
|
|
66528
|
+
}
|
|
66529
|
+
function setValStringify(v, key, propsText) {
|
|
66530
|
+
const text = propsText ? propsText[key] : "";
|
|
66531
|
+
if (text) {
|
|
66532
|
+
return text;
|
|
66533
|
+
} else {
|
|
66534
|
+
return JSON.stringify(v);
|
|
66535
|
+
}
|
|
66536
|
+
}
|
|
66537
|
+
|
|
66338
66538
|
// packages/node/index.ts
|
|
66339
66539
|
var Fang;
|
|
66340
66540
|
function h3(div, sx, v) {
|
|
@@ -66365,27 +66565,85 @@ async function nodeInit(c, callback) {
|
|
|
66365
66565
|
await getCompoData(element);
|
|
66366
66566
|
}
|
|
66367
66567
|
}
|
|
66368
|
-
function gettests(obj, arr) {
|
|
66568
|
+
function gettests(obj, arr, n) {
|
|
66369
66569
|
const tests = getTestName(obj.key);
|
|
66370
|
-
|
|
66371
|
-
|
|
66372
|
-
|
|
66373
|
-
|
|
66374
|
-
|
|
66375
|
-
|
|
66376
|
-
|
|
66377
|
-
|
|
66378
|
-
|
|
66379
|
-
|
|
66380
|
-
|
|
66381
|
-
|
|
66382
|
-
|
|
66383
|
-
|
|
66384
|
-
|
|
66570
|
+
if (tests && tests.length > 0) {
|
|
66571
|
+
asyncMergeArray(tests, (res, _reject, zv, inde) => {
|
|
66572
|
+
getLocalTextTests(zv).then((text) => {
|
|
66573
|
+
arr.push(`### \u793A\u4F8B` + inde + 1);
|
|
66574
|
+
const { titles: titles2 } = getNotes(text);
|
|
66575
|
+
const dom = setHtml(
|
|
66576
|
+
"div",
|
|
66577
|
+
{
|
|
66578
|
+
class: "compo-top"
|
|
66579
|
+
},
|
|
66580
|
+
getTopDom(titles2, setHtml)
|
|
66581
|
+
);
|
|
66582
|
+
arr.push(...setDom(dom));
|
|
66583
|
+
arr.push(...setTestUrl(obj, zv));
|
|
66584
|
+
res();
|
|
66585
|
+
}).catch(() => {
|
|
66586
|
+
});
|
|
66587
|
+
}).then(() => {
|
|
66588
|
+
setMd(obj, arr);
|
|
66385
66589
|
});
|
|
66386
|
-
}
|
|
66590
|
+
} else {
|
|
66591
|
+
const name = "cs";
|
|
66592
|
+
const key = _path.join.call(void 0,
|
|
66593
|
+
configObj.example,
|
|
66594
|
+
obj.value,
|
|
66595
|
+
name,
|
|
66596
|
+
"index.vue"
|
|
66597
|
+
);
|
|
66598
|
+
console.log("key", key);
|
|
66599
|
+
arr.push(
|
|
66600
|
+
...setTestUrl(obj, {
|
|
66601
|
+
key,
|
|
66602
|
+
name
|
|
66603
|
+
})
|
|
66604
|
+
);
|
|
66605
|
+
setVue(obj.value, n, _path.join.call(void 0, configObj.dir, key));
|
|
66387
66606
|
setMd(obj, arr);
|
|
66607
|
+
}
|
|
66608
|
+
}
|
|
66609
|
+
function setVue(propsname, param, url) {
|
|
66610
|
+
const ps = getPropsValue(param.props);
|
|
66611
|
+
const es = getEmitsValue(param.emits);
|
|
66612
|
+
const propsObj = {};
|
|
66613
|
+
ps.forEach((val) => {
|
|
66614
|
+
let name = val.name;
|
|
66615
|
+
if (!name.includes(".")) {
|
|
66616
|
+
let arr = name.split("/");
|
|
66617
|
+
name = (arr[0] || "").trim();
|
|
66618
|
+
if (name) {
|
|
66619
|
+
propsObj[name] = val.default;
|
|
66620
|
+
if (arr && arr.length > 1) {
|
|
66621
|
+
es.push({
|
|
66622
|
+
name: "update:" + name,
|
|
66623
|
+
description: val.description,
|
|
66624
|
+
selectable: "value:[" + val.type + "]"
|
|
66625
|
+
});
|
|
66626
|
+
}
|
|
66627
|
+
}
|
|
66628
|
+
}
|
|
66629
|
+
});
|
|
66630
|
+
es.forEach((val) => {
|
|
66631
|
+
let knam = val.name;
|
|
66632
|
+
if (knam.includes("-")) {
|
|
66633
|
+
let arr = knam.split("-");
|
|
66634
|
+
arr = arr.map((vs, i) => {
|
|
66635
|
+
return firstUpper(vs);
|
|
66636
|
+
});
|
|
66637
|
+
knam = arr.join("");
|
|
66638
|
+
} else {
|
|
66639
|
+
knam = firstUpper(knam);
|
|
66640
|
+
}
|
|
66641
|
+
const name = "on" + knam;
|
|
66642
|
+
propsObj[name] = (...arr) => {
|
|
66643
|
+
};
|
|
66388
66644
|
});
|
|
66645
|
+
const html = getHmtl(propsname, propsObj);
|
|
66646
|
+
Fang.fileOpen(url, html);
|
|
66389
66647
|
}
|
|
66390
66648
|
var lss = 0;
|
|
66391
66649
|
function setMd(obj, arr) {
|
|
@@ -66411,7 +66669,7 @@ function setTestUrl(obj, test) {
|
|
|
66411
66669
|
"/" + obj.value + "/index.md"
|
|
66412
66670
|
);
|
|
66413
66671
|
const url = getImportUrl(sc, tu);
|
|
66414
|
-
arr.push(`:::preview ${
|
|
66672
|
+
arr.push(`:::preview ${test.name}`);
|
|
66415
66673
|
arr.push(`demo-preview=${url}`);
|
|
66416
66674
|
arr.push(`:::`);
|
|
66417
66675
|
return arr;
|
|
@@ -66451,7 +66709,7 @@ async function getCompoData(value) {
|
|
|
66451
66709
|
});
|
|
66452
66710
|
}).then(() => {
|
|
66453
66711
|
arr.push(`## \u793A\u4F8B`);
|
|
66454
|
-
gettests(value, arr);
|
|
66712
|
+
gettests(value, arr, obj);
|
|
66455
66713
|
});
|
|
66456
66714
|
});
|
|
66457
66715
|
}
|
package/dist/node/index.js
CHANGED
|
@@ -63606,12 +63606,63 @@ function getConfig(key) {
|
|
|
63606
63606
|
var import_standalone = __toESM(require_standalone(), 1);
|
|
63607
63607
|
var import_parser_typescript = __toESM(require_parser_typescript(), 1);
|
|
63608
63608
|
var import_parser_html = __toESM(require_parser_html(), 1);
|
|
63609
|
+
function prettierFormat(st) {
|
|
63610
|
+
let str = import_standalone.default.format(st, {
|
|
63611
|
+
parser: "typescript",
|
|
63612
|
+
plugins: [import_parser_typescript.default]
|
|
63613
|
+
});
|
|
63614
|
+
return str.replace(/\;(\s|\n\r)*$/, "");
|
|
63615
|
+
}
|
|
63609
63616
|
function prettierHtml(st) {
|
|
63610
63617
|
return import_standalone.default.format(st, {
|
|
63611
63618
|
parser: "html",
|
|
63612
63619
|
plugins: [import_parser_html.default]
|
|
63613
63620
|
});
|
|
63614
63621
|
}
|
|
63622
|
+
function vueFormat(st, kg = "") {
|
|
63623
|
+
let arr = (st + "").trim().split(/\n/);
|
|
63624
|
+
arr = arr.map((v) => {
|
|
63625
|
+
return kg + v;
|
|
63626
|
+
});
|
|
63627
|
+
return arr.join("\n");
|
|
63628
|
+
}
|
|
63629
|
+
function getFunBody(sr = "") {
|
|
63630
|
+
sr = sr.trim();
|
|
63631
|
+
let body = "[\\s|\\n|\\r]*\\{((.|\n|\r)+?)\\}[\\s|\\n|\\r]*";
|
|
63632
|
+
let reg = new RegExp("^" + body + "$");
|
|
63633
|
+
let vts = reg.exec(sr);
|
|
63634
|
+
if (vts && vts.length > 0) {
|
|
63635
|
+
return getFunBody(vts[1]);
|
|
63636
|
+
} else {
|
|
63637
|
+
return sr;
|
|
63638
|
+
}
|
|
63639
|
+
}
|
|
63640
|
+
function getFunctionFormat(v) {
|
|
63641
|
+
if (v) {
|
|
63642
|
+
let st = v.toString();
|
|
63643
|
+
st = st.trim();
|
|
63644
|
+
let name = "([a-z|A-Z|_|$][a-z|A-Z|_|$|0-9]*)?";
|
|
63645
|
+
let fun = "(function\\s*" + name + "\\s*)?";
|
|
63646
|
+
let param = "(\\([^\\(|\\)]*\\)\\s*)?";
|
|
63647
|
+
let body = "[\\s|\\n|\\r]*\\{((.|\n|\r)+?)\\}[\\s|\\n|\\r]*";
|
|
63648
|
+
let reg = new RegExp(
|
|
63649
|
+
"^" + fun + param + body + "$"
|
|
63650
|
+
);
|
|
63651
|
+
let vts = reg.exec(st);
|
|
63652
|
+
let obj = {
|
|
63653
|
+
body: st,
|
|
63654
|
+
name: "",
|
|
63655
|
+
param: ""
|
|
63656
|
+
};
|
|
63657
|
+
if (vts && vts.length > 0) {
|
|
63658
|
+
obj.name = vts[2];
|
|
63659
|
+
obj.param = vts[3];
|
|
63660
|
+
obj.body = `{${vts[4]}}`;
|
|
63661
|
+
}
|
|
63662
|
+
obj.body = prettierFormat(obj.body);
|
|
63663
|
+
return obj;
|
|
63664
|
+
}
|
|
63665
|
+
}
|
|
63615
63666
|
|
|
63616
63667
|
// packages/node/index.ts
|
|
63617
63668
|
import { join as join4 } from "node:path";
|
|
@@ -65049,6 +65100,24 @@ var slot = {
|
|
|
65049
65100
|
}
|
|
65050
65101
|
}
|
|
65051
65102
|
};
|
|
65103
|
+
function getPropsValue(arr) {
|
|
65104
|
+
return arr.map((obj) => {
|
|
65105
|
+
const v = {};
|
|
65106
|
+
Object.keys(props).forEach((key) => {
|
|
65107
|
+
v[key] = props[key](obj);
|
|
65108
|
+
});
|
|
65109
|
+
return v;
|
|
65110
|
+
});
|
|
65111
|
+
}
|
|
65112
|
+
function getEmitsValue(arr) {
|
|
65113
|
+
return arr.map((obj) => {
|
|
65114
|
+
const v = {};
|
|
65115
|
+
Object.keys(emits).forEach((key) => {
|
|
65116
|
+
v[key] = emits[key](obj);
|
|
65117
|
+
});
|
|
65118
|
+
return v;
|
|
65119
|
+
});
|
|
65120
|
+
}
|
|
65052
65121
|
|
|
65053
65122
|
// packages/components/compo/index.ts
|
|
65054
65123
|
var notesObj = {
|
|
@@ -66335,6 +66404,137 @@ function runDev(config2, configCallback) {
|
|
|
66335
66404
|
return new FangMd(config2, configCallback);
|
|
66336
66405
|
}
|
|
66337
66406
|
|
|
66407
|
+
// packages/components/use/code.ts
|
|
66408
|
+
function getHmtl(propsname, value, slotValue, propsText) {
|
|
66409
|
+
const tarr = [];
|
|
66410
|
+
const sarr = [];
|
|
66411
|
+
let is = true;
|
|
66412
|
+
Object.keys(value).forEach((key) => {
|
|
66413
|
+
let val = value[key];
|
|
66414
|
+
if (/^on[A-Z]/.test(key) && typeof val == "function") {
|
|
66415
|
+
let name = key.substring(2);
|
|
66416
|
+
const knam = key.split(":");
|
|
66417
|
+
let strs;
|
|
66418
|
+
if (knam.length > 1) {
|
|
66419
|
+
strs = knam[0] + knam.slice(1).map((o) => firstUpper(o)).join("");
|
|
66420
|
+
name = firstLower(name);
|
|
66421
|
+
} else {
|
|
66422
|
+
strs = knam[0];
|
|
66423
|
+
name = humpToLine(name);
|
|
66424
|
+
}
|
|
66425
|
+
if (knam.includes("-")) {
|
|
66426
|
+
let arr = strs.split("-");
|
|
66427
|
+
arr = arr.map((vs, i) => {
|
|
66428
|
+
if (i != 0) {
|
|
66429
|
+
return firstUpper(vs);
|
|
66430
|
+
} else {
|
|
66431
|
+
return vs;
|
|
66432
|
+
}
|
|
66433
|
+
});
|
|
66434
|
+
strs = arr.join("");
|
|
66435
|
+
}
|
|
66436
|
+
tarr.push(
|
|
66437
|
+
" @" + name + '="' + strs + '"'
|
|
66438
|
+
);
|
|
66439
|
+
sarr.push("function " + strs + "(...arr) {");
|
|
66440
|
+
sarr.push(
|
|
66441
|
+
" console.log('" + strs + "', arr)"
|
|
66442
|
+
);
|
|
66443
|
+
sarr.push("}");
|
|
66444
|
+
} else {
|
|
66445
|
+
tarr.push(
|
|
66446
|
+
" :" + key + '="' + key + '"'
|
|
66447
|
+
);
|
|
66448
|
+
if (typeof val == "function") {
|
|
66449
|
+
sarr.push(
|
|
66450
|
+
"const " + key + " = " + getFunctionBody(
|
|
66451
|
+
val,
|
|
66452
|
+
key,
|
|
66453
|
+
propsText
|
|
66454
|
+
)
|
|
66455
|
+
);
|
|
66456
|
+
} else {
|
|
66457
|
+
if (is) {
|
|
66458
|
+
is = false;
|
|
66459
|
+
sarr.unshift(
|
|
66460
|
+
"import { ref } from 'vue';"
|
|
66461
|
+
);
|
|
66462
|
+
}
|
|
66463
|
+
if (typeof val == "undefined") {
|
|
66464
|
+
sarr.push("const " + key + " = ref();");
|
|
66465
|
+
} else {
|
|
66466
|
+
let st2 = setValStringify(
|
|
66467
|
+
val,
|
|
66468
|
+
key,
|
|
66469
|
+
propsText
|
|
66470
|
+
);
|
|
66471
|
+
sarr.push(
|
|
66472
|
+
"const " + key + " = ref(" + st2 + ");"
|
|
66473
|
+
);
|
|
66474
|
+
}
|
|
66475
|
+
}
|
|
66476
|
+
}
|
|
66477
|
+
});
|
|
66478
|
+
if (tarr.length > 0) {
|
|
66479
|
+
tarr.unshift("");
|
|
66480
|
+
}
|
|
66481
|
+
const slots = getSlots(slotValue);
|
|
66482
|
+
const st = `<!--${propsname}-->
|
|
66483
|
+
<template>
|
|
66484
|
+
<div>
|
|
66485
|
+
<${propsname}${tarr.join("\n")}>${slots.join("\n")}
|
|
66486
|
+
</${propsname}>
|
|
66487
|
+
</div>
|
|
66488
|
+
</template>
|
|
66489
|
+
<script lang="ts" setup>
|
|
66490
|
+
${sarr.join("\n")}
|
|
66491
|
+
</script>
|
|
66492
|
+
`;
|
|
66493
|
+
return st;
|
|
66494
|
+
}
|
|
66495
|
+
function getSlots(obj = {}) {
|
|
66496
|
+
const arr = [];
|
|
66497
|
+
Object.keys(obj).forEach((key) => {
|
|
66498
|
+
const v = obj[key];
|
|
66499
|
+
if (v) {
|
|
66500
|
+
const st = ` <template #${key}="scope">
|
|
66501
|
+
${vueFormat(v, " ")}
|
|
66502
|
+
</template>`;
|
|
66503
|
+
arr.push(st);
|
|
66504
|
+
}
|
|
66505
|
+
});
|
|
66506
|
+
if (arr && arr.length > 0) {
|
|
66507
|
+
arr.unshift("");
|
|
66508
|
+
}
|
|
66509
|
+
return arr;
|
|
66510
|
+
}
|
|
66511
|
+
function getFunctionBody(v, key, propsText) {
|
|
66512
|
+
const text = propsText ? propsText[key] : "";
|
|
66513
|
+
if (text) {
|
|
66514
|
+
return "function" + text;
|
|
66515
|
+
} else {
|
|
66516
|
+
const st = getFunctionFormat(
|
|
66517
|
+
prettierFormat(v.toString())
|
|
66518
|
+
);
|
|
66519
|
+
if (st) {
|
|
66520
|
+
let body = `{
|
|
66521
|
+
${vueFormat(getFunBody(st.body), " ")}
|
|
66522
|
+
}`;
|
|
66523
|
+
return `function${st.param}${body}`;
|
|
66524
|
+
} else {
|
|
66525
|
+
return "undefined";
|
|
66526
|
+
}
|
|
66527
|
+
}
|
|
66528
|
+
}
|
|
66529
|
+
function setValStringify(v, key, propsText) {
|
|
66530
|
+
const text = propsText ? propsText[key] : "";
|
|
66531
|
+
if (text) {
|
|
66532
|
+
return text;
|
|
66533
|
+
} else {
|
|
66534
|
+
return JSON.stringify(v);
|
|
66535
|
+
}
|
|
66536
|
+
}
|
|
66537
|
+
|
|
66338
66538
|
// packages/node/index.ts
|
|
66339
66539
|
var Fang;
|
|
66340
66540
|
function h3(div, sx, v) {
|
|
@@ -66365,27 +66565,85 @@ async function nodeInit(c, callback) {
|
|
|
66365
66565
|
await getCompoData(element);
|
|
66366
66566
|
}
|
|
66367
66567
|
}
|
|
66368
|
-
function gettests(obj, arr) {
|
|
66568
|
+
function gettests(obj, arr, n) {
|
|
66369
66569
|
const tests = getTestName(obj.key);
|
|
66370
|
-
|
|
66371
|
-
|
|
66372
|
-
|
|
66373
|
-
|
|
66374
|
-
|
|
66375
|
-
|
|
66376
|
-
|
|
66377
|
-
|
|
66378
|
-
|
|
66379
|
-
|
|
66380
|
-
|
|
66381
|
-
|
|
66382
|
-
|
|
66383
|
-
|
|
66384
|
-
|
|
66570
|
+
if (tests && tests.length > 0) {
|
|
66571
|
+
asyncMergeArray(tests, (res, _reject, zv, inde) => {
|
|
66572
|
+
getLocalTextTests(zv).then((text) => {
|
|
66573
|
+
arr.push(`### \u793A\u4F8B` + inde + 1);
|
|
66574
|
+
const { titles: titles2 } = getNotes(text);
|
|
66575
|
+
const dom = setHtml(
|
|
66576
|
+
"div",
|
|
66577
|
+
{
|
|
66578
|
+
class: "compo-top"
|
|
66579
|
+
},
|
|
66580
|
+
getTopDom(titles2, setHtml)
|
|
66581
|
+
);
|
|
66582
|
+
arr.push(...setDom(dom));
|
|
66583
|
+
arr.push(...setTestUrl(obj, zv));
|
|
66584
|
+
res();
|
|
66585
|
+
}).catch(() => {
|
|
66586
|
+
});
|
|
66587
|
+
}).then(() => {
|
|
66588
|
+
setMd(obj, arr);
|
|
66385
66589
|
});
|
|
66386
|
-
}
|
|
66590
|
+
} else {
|
|
66591
|
+
const name = "cs";
|
|
66592
|
+
const key = join4(
|
|
66593
|
+
configObj.example,
|
|
66594
|
+
obj.value,
|
|
66595
|
+
name,
|
|
66596
|
+
"index.vue"
|
|
66597
|
+
);
|
|
66598
|
+
console.log("key", key);
|
|
66599
|
+
arr.push(
|
|
66600
|
+
...setTestUrl(obj, {
|
|
66601
|
+
key,
|
|
66602
|
+
name
|
|
66603
|
+
})
|
|
66604
|
+
);
|
|
66605
|
+
setVue(obj.value, n, join4(configObj.dir, key));
|
|
66387
66606
|
setMd(obj, arr);
|
|
66607
|
+
}
|
|
66608
|
+
}
|
|
66609
|
+
function setVue(propsname, param, url) {
|
|
66610
|
+
const ps = getPropsValue(param.props);
|
|
66611
|
+
const es = getEmitsValue(param.emits);
|
|
66612
|
+
const propsObj = {};
|
|
66613
|
+
ps.forEach((val) => {
|
|
66614
|
+
let name = val.name;
|
|
66615
|
+
if (!name.includes(".")) {
|
|
66616
|
+
let arr = name.split("/");
|
|
66617
|
+
name = (arr[0] || "").trim();
|
|
66618
|
+
if (name) {
|
|
66619
|
+
propsObj[name] = val.default;
|
|
66620
|
+
if (arr && arr.length > 1) {
|
|
66621
|
+
es.push({
|
|
66622
|
+
name: "update:" + name,
|
|
66623
|
+
description: val.description,
|
|
66624
|
+
selectable: "value:[" + val.type + "]"
|
|
66625
|
+
});
|
|
66626
|
+
}
|
|
66627
|
+
}
|
|
66628
|
+
}
|
|
66629
|
+
});
|
|
66630
|
+
es.forEach((val) => {
|
|
66631
|
+
let knam = val.name;
|
|
66632
|
+
if (knam.includes("-")) {
|
|
66633
|
+
let arr = knam.split("-");
|
|
66634
|
+
arr = arr.map((vs, i) => {
|
|
66635
|
+
return firstUpper(vs);
|
|
66636
|
+
});
|
|
66637
|
+
knam = arr.join("");
|
|
66638
|
+
} else {
|
|
66639
|
+
knam = firstUpper(knam);
|
|
66640
|
+
}
|
|
66641
|
+
const name = "on" + knam;
|
|
66642
|
+
propsObj[name] = (...arr) => {
|
|
66643
|
+
};
|
|
66388
66644
|
});
|
|
66645
|
+
const html = getHmtl(propsname, propsObj);
|
|
66646
|
+
Fang.fileOpen(url, html);
|
|
66389
66647
|
}
|
|
66390
66648
|
var lss = 0;
|
|
66391
66649
|
function setMd(obj, arr) {
|
|
@@ -66411,7 +66669,7 @@ function setTestUrl(obj, test) {
|
|
|
66411
66669
|
"/" + obj.value + "/index.md"
|
|
66412
66670
|
);
|
|
66413
66671
|
const url = getImportUrl(sc, tu);
|
|
66414
|
-
arr.push(`:::preview ${
|
|
66672
|
+
arr.push(`:::preview ${test.name}`);
|
|
66415
66673
|
arr.push(`demo-preview=${url}`);
|
|
66416
66674
|
arr.push(`:::`);
|
|
66417
66675
|
return arr;
|
|
@@ -66451,7 +66709,7 @@ async function getCompoData(value) {
|
|
|
66451
66709
|
});
|
|
66452
66710
|
}).then(() => {
|
|
66453
66711
|
arr.push(`## \u793A\u4F8B`);
|
|
66454
|
-
gettests(value, arr);
|
|
66712
|
+
gettests(value, arr, obj);
|
|
66455
66713
|
});
|
|
66456
66714
|
});
|
|
66457
66715
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=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"),F=require("../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.cjs"),p=require("./util.cjs");function b(r,t,i,e){const n=[],o=[];let h=!0;Object.keys(t).forEach(s=>{let f=t[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=F.firstLower(u)):(c=l[0],u=j.humpToLine(u)),l.includes("-")){let a=c.split("-");a=a.map((g,$)=>$!=0?m.firstUpper(g):g),c=a.join("")}n.push(" @"+u+'="'+c+'"'),o.push("function "+c+"(...arr) {"),o.push(" console.log('"+c+"', arr)"),o.push("}")}else if(n.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=S(f,s,e);o.push("const "+s+" = ref("+u+");")}}),n.length>0&&n.unshift("");const d=v(i);return`<!--${r}-->
|
|
2
|
+
<template>
|
|
3
|
+
<div>
|
|
4
|
+
<${r}${n.join(`
|
|
5
|
+
`)}>${d.join(`
|
|
6
|
+
`)}
|
|
7
|
+
</${r}>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
${o.join(`
|
|
12
|
+
`)}
|
|
13
|
+
<\/script>
|
|
14
|
+
`}function v(r={}){const t=[];return Object.keys(r).forEach(i=>{const e=r[i];if(e){const n=` <template #${i}="scope">
|
|
15
|
+
${p.vueFormat(e," ")}
|
|
16
|
+
</template>`;t.push(n)}}),t&&t.length>0&&t.unshift(""),t}function O(r,t,i){const e=i?i[t]:"";if(e)return"function"+e;{const n=p.getFunctionFormat(p.prettierFormat(r.toString()));if(n){let o=`{
|
|
17
|
+
${p.vueFormat(p.getFunBody(n.body)," ")}
|
|
18
|
+
}`;return`function${n.param}${o}`}else return"undefined"}}function S(r,t,i){const e=i?i[t]:"";return e||JSON.stringify(r)}exports.getHmtl=b;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { humpToLine as j } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js";
|
|
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 F } 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 b, prettierFormat as v, getFunBody as S } from "./util.js";
|
|
5
|
+
function N(r, t, i, n) {
|
|
6
|
+
const e = [], o = [];
|
|
7
|
+
let a = !0;
|
|
8
|
+
Object.keys(t).forEach((s) => {
|
|
9
|
+
let c = t[s];
|
|
10
|
+
if (/^on[A-Z]/.test(s) && typeof c == "function") {
|
|
11
|
+
let f = s.substring(2);
|
|
12
|
+
const l = s.split(":");
|
|
13
|
+
let u;
|
|
14
|
+
if (l.length > 1 ? (u = l[0] + l.slice(1).map((p) => h(p)).join(""), f = F(f)) : (u = l[0], f = j(f)), l.includes("-")) {
|
|
15
|
+
let p = u.split("-");
|
|
16
|
+
p = p.map((m, $) => $ != 0 ? h(m) : m), u = p.join("");
|
|
17
|
+
}
|
|
18
|
+
e.push(
|
|
19
|
+
" @" + f + '="' + u + '"'
|
|
20
|
+
), o.push("function " + u + "(...arr) {"), o.push(
|
|
21
|
+
" console.log('" + u + "', arr)"
|
|
22
|
+
), o.push("}");
|
|
23
|
+
} else if (e.push(
|
|
24
|
+
" :" + s + '="' + s + '"'
|
|
25
|
+
), typeof c == "function")
|
|
26
|
+
o.push(
|
|
27
|
+
"const " + s + " = " + B(
|
|
28
|
+
c,
|
|
29
|
+
s,
|
|
30
|
+
n
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
else if (a && (a = !1, o.unshift(
|
|
34
|
+
"import { ref } from 'vue';"
|
|
35
|
+
)), typeof c > "u")
|
|
36
|
+
o.push("const " + s + " = ref();");
|
|
37
|
+
else {
|
|
38
|
+
let f = E(
|
|
39
|
+
c,
|
|
40
|
+
s,
|
|
41
|
+
n
|
|
42
|
+
);
|
|
43
|
+
o.push(
|
|
44
|
+
"const " + s + " = ref(" + f + ");"
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}), e.length > 0 && e.unshift("");
|
|
48
|
+
const d = O(i);
|
|
49
|
+
return `<!--${r}-->
|
|
50
|
+
<template>
|
|
51
|
+
<div>
|
|
52
|
+
<${r}${e.join(`
|
|
53
|
+
`)}>${d.join(`
|
|
54
|
+
`)}
|
|
55
|
+
</${r}>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
<script lang="ts" setup>
|
|
59
|
+
${o.join(`
|
|
60
|
+
`)}
|
|
61
|
+
<\/script>
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
function O(r = {}) {
|
|
65
|
+
const t = [];
|
|
66
|
+
return Object.keys(r).forEach((i) => {
|
|
67
|
+
const n = r[i];
|
|
68
|
+
if (n) {
|
|
69
|
+
const e = ` <template #${i}="scope">
|
|
70
|
+
${g(n, " ")}
|
|
71
|
+
</template>`;
|
|
72
|
+
t.push(e);
|
|
73
|
+
}
|
|
74
|
+
}), t && t.length > 0 && t.unshift(""), t;
|
|
75
|
+
}
|
|
76
|
+
function B(r, t, i) {
|
|
77
|
+
const n = i ? i[t] : "";
|
|
78
|
+
if (n)
|
|
79
|
+
return "function" + n;
|
|
80
|
+
{
|
|
81
|
+
const e = b(
|
|
82
|
+
v(r.toString())
|
|
83
|
+
);
|
|
84
|
+
if (e) {
|
|
85
|
+
let o = `{
|
|
86
|
+
${g(S(e.body), " ")}
|
|
87
|
+
}`;
|
|
88
|
+
return `function${e.param}${o}`;
|
|
89
|
+
} else
|
|
90
|
+
return "undefined";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function E(r, t, i) {
|
|
94
|
+
const n = i ? i[t] : "";
|
|
95
|
+
return n || JSON.stringify(r);
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
N as getHmtl
|
|
99
|
+
};
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),
|
|
2
|
-
<template>
|
|
3
|
-
<div>
|
|
4
|
-
<${r.name}${s.join(`
|
|
5
|
-
`)}>${c.join(`
|
|
6
|
-
`)}
|
|
7
|
-
</${r.name}>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
<script lang="ts" setup>
|
|
11
|
-
${t.join(`
|
|
12
|
-
`)}
|
|
13
|
-
<\/script>
|
|
14
|
-
`}),h=e.ref(!1);function x(s){const t=[];return Object.keys(s).forEach(i=>{const n=s[i];if(n){const c=` <template #${i}="scope">
|
|
15
|
-
${d.vueFormat(n," ")}
|
|
16
|
-
</template>`;t.push(c)}}),t&&t.length>0&&t.unshift(""),t}function $(s,t){const n=r.propsText[t];if(n)return"function"+n;{const c=d.getFunctionFormat(d.prettierFormat(s.toString()));if(c){let v=`{
|
|
17
|
-
${d.vueFormat(d.getFunBody(c.body)," ")}
|
|
18
|
-
}`;return`function${c.param}${v}`}else return"undefined"}}function T(s,t){const n=r.propsText[t];return n||JSON.stringify(s)}function j(){h.value=!h.value}function C(){N.copyCode(m.value)}return(s,t)=>(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",{onClick:j,class:"set-code-buts"},[y,e.createElementVNode("div",F,e.toDisplayString(h.value?"显示":"隐藏"),1),e.createElementVNode("div",{onClick:e.withModifiers(C,["stop"]),class:"but-div set-code-but"}," 复制 ",8,w)]),e.withDirectives(e.createElementVNode("div",B,[e.createVNode(V,{language:"html",code:e.unref(m)},null,8,["code"])],512),[[e.vShow,h.value]])]))}});module.exports=J;
|
|
1
|
+
"use strict";const e=require("vue"),i=require("../code/highlight.vue.cjs"),d=require("../../utils/index.cjs"),r=require("./code.cjs"),u={class:"set-code"},a=e.createElementVNode("div",null,"代码",-1),p={class:"but-div set-code-but"},v=["onClick"],h={class:"set-code-html"},m=e.defineComponent({__name:"set-code",props:{name:{type:String},value:{type:Object},slotValue:{type:Object},propsText:{type:Object}},setup(s){const t=s,c=e.computed(()=>r.getHmtl(t.name||"",t.value||{},t.slotValue,t.propsText)),o=e.ref(!1);function n(){o.value=!o.value}function l(){d.copyCode(c.value)}return(_,b)=>(e.openBlock(),e.createElementBlock("div",u,[e.createElementVNode("div",{onClick:n,class:"set-code-buts"},[a,e.createElementVNode("div",p,e.toDisplayString(o.value?"显示":"隐藏"),1),e.createElementVNode("div",{onClick:e.withModifiers(l,["stop"]),class:"but-div set-code-but"}," 复制 ",8,v)]),e.withDirectives(e.createElementVNode("div",h,[e.createVNode(i,{language:"html",code:e.unref(c)},null,8,["code"])],512),[[e.vShow,o.value]])]))}});module.exports=m;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { firstUpper as _ } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js";
|
|
7
|
-
import { firstLower as z } from "../../../node_modules/.pnpm/@fangzhongya_utils@0.0.7-18/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js";
|
|
8
|
-
const G = { class: "set-code" }, I = /* @__PURE__ */ f("div", null, "代码", -1), K = { class: "but-div set-code-but" }, P = ["onClick"], Q = { class: "set-code-html" }, ot = /* @__PURE__ */ C({
|
|
1
|
+
import { defineComponent as n, computed as a, ref as d, openBlock as r, createElementBlock as u, createElementVNode as e, toDisplayString as p, withModifiers as m, withDirectives as v, createVNode as _, unref as h, vShow as f } from "vue";
|
|
2
|
+
import b from "../code/highlight.vue.js";
|
|
3
|
+
import { copyCode as g } from "../../utils/index.js";
|
|
4
|
+
import { getHmtl as y } from "./code.js";
|
|
5
|
+
const C = { class: "set-code" }, k = /* @__PURE__ */ e("div", null, "代码", -1), w = { class: "but-div set-code-but" }, x = ["onClick"], S = { class: "set-code-html" }, H = /* @__PURE__ */ n({
|
|
9
6
|
__name: "set-code",
|
|
10
7
|
props: {
|
|
11
8
|
name: {
|
|
@@ -21,121 +18,42 @@ const G = { class: "set-code" }, I = /* @__PURE__ */ f("div", null, "代码", -1
|
|
|
21
18
|
type: Object
|
|
22
19
|
}
|
|
23
20
|
},
|
|
24
|
-
setup(
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const u = s.split(":");
|
|
34
|
-
let l;
|
|
35
|
-
if (u.length > 1 ? (l = u[0] + u.slice(1).map((a) => _(a)).join(""), c = z(c)) : (l = u[0], c = q(c)), u.includes("-")) {
|
|
36
|
-
let a = l.split("-");
|
|
37
|
-
a = a.map((v, y) => y != 0 ? _(v) : v), l = a.join("");
|
|
38
|
-
}
|
|
39
|
-
e.push(
|
|
40
|
-
" @" + c + '="' + l + '"'
|
|
41
|
-
), t.push("function " + l + "(...arr) {"), t.push(
|
|
42
|
-
" console.log('" + l + "', arr)"
|
|
43
|
-
), t.push("}");
|
|
44
|
-
} else if (e.push(
|
|
45
|
-
" :" + s + '="' + s + '"'
|
|
46
|
-
), typeof p == "function")
|
|
47
|
-
t.push(
|
|
48
|
-
"const " + s + " = " + $(p, s)
|
|
49
|
-
);
|
|
50
|
-
else if (i && (i = !1, t.unshift(
|
|
51
|
-
"import { ref } from 'vue';"
|
|
52
|
-
)), typeof p > "u")
|
|
53
|
-
t.push("const " + s + " = ref();");
|
|
54
|
-
else {
|
|
55
|
-
let c = j(p, s);
|
|
56
|
-
t.push(
|
|
57
|
-
"const " + s + " = ref(" + c + ");"
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
}), e.length > 0 && e.unshift("");
|
|
61
|
-
const r = x(n.slotValue);
|
|
62
|
-
return `<!--${n.name}-->
|
|
63
|
-
<template>
|
|
64
|
-
<div>
|
|
65
|
-
<${n.name}${e.join(`
|
|
66
|
-
`)}>${r.join(`
|
|
67
|
-
`)}
|
|
68
|
-
</${n.name}>
|
|
69
|
-
</div>
|
|
70
|
-
</template>
|
|
71
|
-
<script lang="ts" setup>
|
|
72
|
-
${t.join(`
|
|
73
|
-
`)}
|
|
74
|
-
<\/script>
|
|
75
|
-
`;
|
|
76
|
-
}), m = O(!1);
|
|
77
|
-
function x(e) {
|
|
78
|
-
const t = [];
|
|
79
|
-
return Object.keys(e).forEach((i) => {
|
|
80
|
-
const o = e[i];
|
|
81
|
-
if (o) {
|
|
82
|
-
const r = ` <template #${i}="scope">
|
|
83
|
-
${g(o, " ")}
|
|
84
|
-
</template>`;
|
|
85
|
-
t.push(r);
|
|
86
|
-
}
|
|
87
|
-
}), t && t.length > 0 && t.unshift(""), t;
|
|
21
|
+
setup(c) {
|
|
22
|
+
const t = c, s = a(() => y(
|
|
23
|
+
t.name || "",
|
|
24
|
+
t.value || {},
|
|
25
|
+
t.slotValue,
|
|
26
|
+
t.propsText
|
|
27
|
+
)), o = d(!1);
|
|
28
|
+
function i() {
|
|
29
|
+
o.value = !o.value;
|
|
88
30
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
if (o)
|
|
92
|
-
return "function" + o;
|
|
93
|
-
{
|
|
94
|
-
const r = H(
|
|
95
|
-
J(e.toString())
|
|
96
|
-
);
|
|
97
|
-
if (r) {
|
|
98
|
-
let h = `{
|
|
99
|
-
${g(M(r.body), " ")}
|
|
100
|
-
}`;
|
|
101
|
-
return `function${r.param}${h}`;
|
|
102
|
-
} else
|
|
103
|
-
return "undefined";
|
|
104
|
-
}
|
|
31
|
+
function l() {
|
|
32
|
+
g(s.value);
|
|
105
33
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
function S() {
|
|
111
|
-
m.value = !m.value;
|
|
112
|
-
}
|
|
113
|
-
function T() {
|
|
114
|
-
Z(d.value);
|
|
115
|
-
}
|
|
116
|
-
return (e, t) => (w(), V("div", G, [
|
|
117
|
-
f("div", {
|
|
118
|
-
onClick: S,
|
|
34
|
+
return (V, j) => (r(), u("div", C, [
|
|
35
|
+
e("div", {
|
|
36
|
+
onClick: i,
|
|
119
37
|
class: "set-code-buts"
|
|
120
38
|
}, [
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
onClick:
|
|
39
|
+
k,
|
|
40
|
+
e("div", w, p(o.value ? "显示" : "隐藏"), 1),
|
|
41
|
+
e("div", {
|
|
42
|
+
onClick: m(l, ["stop"]),
|
|
125
43
|
class: "but-div set-code-but"
|
|
126
|
-
}, " 复制 ", 8,
|
|
44
|
+
}, " 复制 ", 8, x)
|
|
127
45
|
]),
|
|
128
|
-
|
|
129
|
-
|
|
46
|
+
v(e("div", S, [
|
|
47
|
+
_(b, {
|
|
130
48
|
language: "html",
|
|
131
|
-
code:
|
|
49
|
+
code: h(s)
|
|
132
50
|
}, null, 8, ["code"])
|
|
133
51
|
], 512), [
|
|
134
|
-
[
|
|
52
|
+
[f, o.value]
|
|
135
53
|
])
|
|
136
54
|
]));
|
|
137
55
|
}
|
|
138
56
|
});
|
|
139
57
|
export {
|
|
140
|
-
|
|
58
|
+
H as default
|
|
141
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),
|
|
1
|
+
"use strict";const e=require("vue"),m=require("../../components/boxurl/index.vue.cjs"),p=require("../../components/compo/props.vue.cjs"),h=require("../../components/header/index.vue.cjs"),x=require("../../config.cjs"),f=require("../../utils/common.cjs"),d=require("../../utils/glob.cjs"),g={class:"__document-index"},E={class:"index-aside"},N={class:"index-aside-div"},k={class:"choice aside"},V=["onClick"],C={class:"aside-li-name"},y={class:"aside-li-name-name"},q={class:"index-body"},B={class:"index-div"},w={class:"index-header"},b={class:"index-main"},D={class:"index-main-div"},O=e.defineComponent({__name:"index",setup(P){const c=x.getConfig("components").map(t=>t.comprops),_=Object.values(d.getComponentPropsObjs()).filter(t=>{for(let s=0;s<c.length;s++){const n=c[s]||"";if(n&&f.isComprops(t.key,n))return!0}});function u(t){const n=new RegExp(t.comprops+"(.)$").exec(t.value);return n?n[1]:t.value}const i=e.ref(_),o=e.ref(i.value[0]),r=e.ref("");function v(t){o.value=t,a()}function a(){d.getPropsRaws([o.value]).then(t=>{const s=t[0];r.value=s.raw})}return a(),(t,s)=>(e.openBlock(),e.createElementBlock("div",g,[e.createElementVNode("div",E,[e.createElementVNode("div",N,[e.createElementVNode("div",k,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(n,R)=>{var l;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["aside-li",{on:n.key==((l=e.unref(o))==null?void 0:l.key)}]),onClick:$=>v(n)},[e.createVNode(m,{value:n},{default:e.withCtx(()=>[e.createElementVNode("div",C,[e.createElementVNode("div",y,e.toDisplayString(u(n)),1)])]),_:2},1032,["value"])],10,V)}),256))])])]),e.createElementVNode("div",q,[e.createElementVNode("div",B,[e.createElementVNode("div",w,[e.createVNode(h)]),e.createElementVNode("div",b,[e.createElementVNode("div",D,[e.createVNode(p,{value:r.value},null,8,["value"])])])])])]))}});module.exports=O;
|
|
@@ -1,49 +1,54 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { getConfig as
|
|
1
|
+
import { defineComponent as h, ref as i, openBlock as c, createElementBlock as a, createElementVNode as t, Fragment as x, renderList as g, normalizeClass as k, unref as C, createVNode as d, withCtx as y, toDisplayString as w } from "vue";
|
|
2
|
+
import $ from "../../components/boxurl/index.vue.js";
|
|
3
|
+
import E from "../../components/compo/props.vue.js";
|
|
4
|
+
import N from "../../components/header/index.vue.js";
|
|
5
|
+
import { getConfig as b } from "../../config.js";
|
|
6
6
|
import { isComprops as B } from "../../utils/common.js";
|
|
7
|
-
import { getComponentPropsObjs as D, getPropsRaws as
|
|
8
|
-
const
|
|
7
|
+
import { getComponentPropsObjs as D, getPropsRaws as O } from "../../utils/glob.js";
|
|
8
|
+
const P = { class: "__document-index" }, R = { class: "index-aside" }, V = { class: "index-aside-div" }, j = { class: "choice aside" }, z = ["onClick"], F = { class: "aside-li-name" }, H = { class: "aside-li-name-name" }, L = { class: "index-body" }, S = { class: "index-div" }, q = { class: "index-header" }, A = { class: "index-main" }, G = { class: "index-main-div" }, Z = /* @__PURE__ */ h({
|
|
9
9
|
__name: "index",
|
|
10
|
-
setup(
|
|
11
|
-
const
|
|
12
|
-
(
|
|
13
|
-
for (let
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
10
|
+
setup(I) {
|
|
11
|
+
const r = b("components").map((e) => e.comprops), v = Object.values(D()).filter(
|
|
12
|
+
(e) => {
|
|
13
|
+
for (let o = 0; o < r.length; o++) {
|
|
14
|
+
const s = r[o] || "";
|
|
15
|
+
if (s && B(e.key, s))
|
|
16
16
|
return !0;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
)
|
|
20
|
-
function p(
|
|
21
|
-
|
|
19
|
+
);
|
|
20
|
+
function p(e) {
|
|
21
|
+
const s = new RegExp(e.comprops + "(.)$").exec(e.value);
|
|
22
|
+
return s ? s[1] : e.value;
|
|
23
|
+
}
|
|
24
|
+
const l = i(v), n = i(l.value[0]), _ = i("");
|
|
25
|
+
function f(e) {
|
|
26
|
+
n.value = e, m();
|
|
22
27
|
}
|
|
23
28
|
function m() {
|
|
24
|
-
|
|
25
|
-
(
|
|
26
|
-
const
|
|
27
|
-
_.value =
|
|
29
|
+
O([n.value]).then(
|
|
30
|
+
(e) => {
|
|
31
|
+
const o = e[0];
|
|
32
|
+
_.value = o.raw;
|
|
28
33
|
}
|
|
29
34
|
);
|
|
30
35
|
}
|
|
31
|
-
return m(), (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
(
|
|
36
|
-
var
|
|
37
|
-
return
|
|
36
|
+
return m(), (e, o) => (c(), a("div", P, [
|
|
37
|
+
t("div", R, [
|
|
38
|
+
t("div", V, [
|
|
39
|
+
t("div", j, [
|
|
40
|
+
(c(!0), a(x, null, g(l.value, (s, J) => {
|
|
41
|
+
var u;
|
|
42
|
+
return c(), a("div", {
|
|
38
43
|
class: k(["aside-li", {
|
|
39
|
-
on:
|
|
44
|
+
on: s.key == ((u = C(n)) == null ? void 0 : u.key)
|
|
40
45
|
}]),
|
|
41
|
-
onClick: (
|
|
46
|
+
onClick: (K) => f(s)
|
|
42
47
|
}, [
|
|
43
|
-
d(
|
|
44
|
-
default:
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
d($, { value: s }, {
|
|
49
|
+
default: y(() => [
|
|
50
|
+
t("div", F, [
|
|
51
|
+
t("div", H, w(p(s)), 1)
|
|
47
52
|
])
|
|
48
53
|
]),
|
|
49
54
|
_: 2
|
|
@@ -53,14 +58,14 @@ const N = { class: "__document-index" }, O = { class: "index-aside" }, P = { cla
|
|
|
53
58
|
])
|
|
54
59
|
])
|
|
55
60
|
]),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
d(
|
|
61
|
+
t("div", L, [
|
|
62
|
+
t("div", S, [
|
|
63
|
+
t("div", q, [
|
|
64
|
+
d(N)
|
|
60
65
|
]),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
d(
|
|
66
|
+
t("div", A, [
|
|
67
|
+
t("div", G, [
|
|
68
|
+
d(E, { value: _.value }, null, 8, ["value"])
|
|
64
69
|
])
|
|
65
70
|
])
|
|
66
71
|
])
|
|
@@ -69,5 +74,5 @@ const N = { class: "__document-index" }, O = { class: "index-aside" }, P = { cla
|
|
|
69
74
|
}
|
|
70
75
|
});
|
|
71
76
|
export {
|
|
72
|
-
|
|
77
|
+
Z as default
|
|
73
78
|
};
|