@fangzhongya/vue-archive 0.1.8 → 0.1.10

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.
@@ -1341,664 +1341,288 @@ function getRawValue(comRaw, key) {
1341
1341
  }
1342
1342
  }
1343
1343
 
1344
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/primitives.js
1345
- var Markers;
1346
- (function(Markers2) {
1347
- Markers2["start"] = "/**";
1348
- Markers2["nostart"] = "/***";
1349
- Markers2["delim"] = "*";
1350
- Markers2["end"] = "*/";
1351
- })(Markers = Markers || (Markers = {}));
1352
-
1353
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/util.js
1354
- function isSpace(source) {
1355
- return /^\s+$/.test(source);
1356
- }
1357
- function splitCR(source) {
1358
- const matches = source.match(/\r+$/);
1359
- return matches == null ? ["", source] : [source.slice(-matches[0].length), source.slice(0, -matches[0].length)];
1360
- }
1361
- function splitSpace(source) {
1362
- const matches = source.match(/^\s+/);
1363
- return matches == null ? ["", source] : [source.slice(0, matches[0].length), source.slice(matches[0].length)];
1364
- }
1365
- function splitLines(source) {
1366
- return source.split(/\n/);
1367
- }
1368
- function seedSpec(spec = {}) {
1369
- return Object.assign({ tag: "", name: "", type: "", optional: false, description: "", problems: [], source: [] }, spec);
1370
- }
1371
- function seedTokens(tokens = {}) {
1372
- return Object.assign({ start: "", delimiter: "", postDelimiter: "", tag: "", postTag: "", name: "", postName: "", type: "", postType: "", description: "", end: "", lineEnd: "" }, tokens);
1344
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.73/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1345
+ function deComment(code) {
1346
+ let output = "";
1347
+ let state = "code";
1348
+ let escaping = false;
1349
+ let i = 0;
1350
+ const len = code.length;
1351
+ while (i < len) {
1352
+ const char = code[i];
1353
+ const nextChar = code[i + 1];
1354
+ switch (state) {
1355
+ case "code":
1356
+ if (char === "/" && nextChar === "/") {
1357
+ state = "singleLine";
1358
+ i += 2;
1359
+ } else if (char === "/" && nextChar === "*") {
1360
+ state = "multiLine";
1361
+ i += 2;
1362
+ } else if (char === "'") {
1363
+ state = "singleQuote";
1364
+ output += char;
1365
+ i++;
1366
+ } else if (char === '"') {
1367
+ state = "doubleQuote";
1368
+ output += char;
1369
+ i++;
1370
+ } else if (char === "`") {
1371
+ state = "template";
1372
+ output += char;
1373
+ i++;
1374
+ } else {
1375
+ output += char;
1376
+ i++;
1377
+ }
1378
+ break;
1379
+ case "singleLine":
1380
+ if (char === "\n" || char === "\r") {
1381
+ state = "code";
1382
+ output += char;
1383
+ i++;
1384
+ if (char === "\r" && nextChar === "\n") {
1385
+ output += nextChar;
1386
+ i++;
1387
+ }
1388
+ } else {
1389
+ i++;
1390
+ }
1391
+ break;
1392
+ case "multiLine":
1393
+ if (char === "*" && nextChar === "/") {
1394
+ state = "code";
1395
+ i += 2;
1396
+ if (output.length > 0 && /[a-zA-Z0-9_$]$/.test(output) && i < len && /[a-zA-Z0-9_$]/.test(code[i])) {
1397
+ output += " ";
1398
+ }
1399
+ } else {
1400
+ i++;
1401
+ }
1402
+ break;
1403
+ case "singleQuote":
1404
+ output += char;
1405
+ if (!escaping && char === "'") {
1406
+ state = "code";
1407
+ }
1408
+ escaping = !escaping && char === "\\";
1409
+ i++;
1410
+ break;
1411
+ case "doubleQuote":
1412
+ output += char;
1413
+ if (!escaping && char === '"') {
1414
+ state = "code";
1415
+ }
1416
+ escaping = !escaping && char === "\\";
1417
+ i++;
1418
+ break;
1419
+ case "template":
1420
+ output += char;
1421
+ if (!escaping && char === "`") {
1422
+ state = "code";
1423
+ } else if (!escaping && char === "$" && nextChar === "{") {
1424
+ output += nextChar;
1425
+ i += 2;
1426
+ continue;
1427
+ }
1428
+ escaping = !escaping && char === "\\";
1429
+ i++;
1430
+ break;
1431
+ }
1432
+ }
1433
+ return output;
1373
1434
  }
1374
1435
 
1375
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/block-parser.js
1376
- var reTag = /^@\S+/;
1377
- function getParser({ fence = "```" } = {}) {
1378
- const fencer = getFencer(fence);
1379
- const toggleFence = (source, isFenced) => fencer(source) ? !isFenced : isFenced;
1380
- return function parseBlock(source) {
1381
- const sections = [[]];
1382
- let isFenced = false;
1383
- for (const line of source) {
1384
- if (reTag.test(line.tokens.description) && !isFenced) {
1385
- sections.push([line]);
1386
- } else {
1387
- sections[sections.length - 1].push(line);
1436
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.73/node_modules/@fangzhongya/utils/dist/chunk-N5Y3XGHX.js
1437
+ function getImports(code, includeType = false) {
1438
+ code = deComment(code);
1439
+ const imports = /* @__PURE__ */ new Set();
1440
+ const regex = /(?:import\s*(?:type\s+)?(?:(?:\w+|\*\s*as\s+\w+|\{[^}]*\})\s+from\s*)?['"]([^'"]+)['"]|import\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)|export\s*(?:type\s+)?(?:(?:\*|\*?\s*as\s+\w+|\{[^}]*\})\s+from\s*)?['"]([^'"]+)['"])/g;
1441
+ let match;
1442
+ while ((match = regex.exec(code)) !== null) {
1443
+ const path = match[1] || match[2] || match[3] || match[4];
1444
+ if (!path) continue;
1445
+ const fullMatch = match[0];
1446
+ if (!includeType) {
1447
+ if (fullMatch.includes("import") && isPureTypeImport(fullMatch) || fullMatch.includes("export") && isPureTypeExport(fullMatch)) {
1448
+ continue;
1388
1449
  }
1389
- isFenced = toggleFence(line.tokens.description, isFenced);
1390
1450
  }
1391
- return sections;
1392
- };
1451
+ imports.add(path);
1452
+ }
1453
+ return Array.from(imports);
1393
1454
  }
1394
- function getFencer(fence) {
1395
- if (typeof fence === "string")
1396
- return (source) => source.split(fence).length % 2 === 0;
1397
- return fence;
1455
+ function isPureTypeImport(importStatement) {
1456
+ const importTypeRegex = /^\s*import\s+type\b/;
1457
+ if (importTypeRegex.test(importStatement)) {
1458
+ return true;
1459
+ }
1460
+ if (importStatement.includes("{")) {
1461
+ const braceContent = importStatement.match(/\{([^}]*)\}/)?.[1] || "";
1462
+ const items = braceContent.split(",").map((item) => item.trim()).filter(Boolean);
1463
+ return items.length > 0 && items.every((item) => item.startsWith("type "));
1464
+ }
1465
+ return false;
1398
1466
  }
1399
-
1400
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/source-parser.js
1401
- function getParser2({ startLine = 0, markers = Markers } = {}) {
1402
- let block = null;
1403
- let num = startLine;
1404
- return function parseSource(source) {
1405
- let rest = source;
1406
- const tokens = seedTokens();
1407
- [tokens.lineEnd, rest] = splitCR(rest);
1408
- [tokens.start, rest] = splitSpace(rest);
1409
- if (block === null && rest.startsWith(markers.start) && !rest.startsWith(markers.nostart)) {
1410
- block = [];
1411
- tokens.delimiter = rest.slice(0, markers.start.length);
1412
- rest = rest.slice(markers.start.length);
1413
- [tokens.postDelimiter, rest] = splitSpace(rest);
1414
- }
1415
- if (block === null) {
1416
- num++;
1417
- return null;
1418
- }
1419
- const isClosed = rest.trimRight().endsWith(markers.end);
1420
- if (tokens.delimiter === "" && rest.startsWith(markers.delim) && !rest.startsWith(markers.end)) {
1421
- tokens.delimiter = markers.delim;
1422
- rest = rest.slice(markers.delim.length);
1423
- [tokens.postDelimiter, rest] = splitSpace(rest);
1424
- }
1425
- if (isClosed) {
1426
- const trimmed = rest.trimRight();
1427
- tokens.end = rest.slice(trimmed.length - markers.end.length);
1428
- rest = trimmed.slice(0, -markers.end.length);
1429
- }
1430
- tokens.description = rest;
1431
- block.push({ number: num, source, tokens });
1432
- num++;
1433
- if (isClosed) {
1434
- const result = block.slice();
1435
- block = null;
1436
- return result;
1437
- }
1438
- return null;
1439
- };
1467
+ function isPureTypeExport(exportStatement) {
1468
+ const exportTypeRegex = /^\s*export\s+type\b/;
1469
+ if (exportTypeRegex.test(exportStatement)) {
1470
+ return true;
1471
+ }
1472
+ if (exportStatement.includes("{")) {
1473
+ const braceContent = exportStatement.match(/\{([^}]*)\}/)?.[1] || "";
1474
+ const items = braceContent.split(",").map((item) => item.trim()).filter(Boolean);
1475
+ return items.length > 0 && items.every((item) => item.startsWith("type "));
1476
+ }
1477
+ return false;
1440
1478
  }
1441
1479
 
1442
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/spec-parser.js
1443
- function getParser3({ tokenizers }) {
1444
- return function parseSpec(source) {
1445
- var _a;
1446
- let spec = seedSpec({ source });
1447
- for (const tokenize of tokenizers) {
1448
- spec = tokenize(spec);
1449
- if ((_a = spec.problems[spec.problems.length - 1]) === null || _a === void 0 ? void 0 : _a.critical)
1450
- break;
1451
- }
1452
- return spec;
1453
- };
1480
+ // packages/utils/index.ts
1481
+ function getTextImport(jstext) {
1482
+ return new Promise(async (resolve2) => {
1483
+ const importss = getImports(jstext);
1484
+ resolve2(importss);
1485
+ });
1454
1486
  }
1455
1487
 
1456
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/tokenizers/tag.js
1457
- function tagTokenizer() {
1458
- return (spec) => {
1459
- const { tokens } = spec.source[0];
1460
- const match = tokens.description.match(/\s*(@(\S+))(\s*)/);
1461
- if (match === null) {
1462
- spec.problems.push({
1463
- code: "spec:tag:prefix",
1464
- message: 'tag should start with "@" symbol',
1465
- line: spec.source[0].number,
1466
- critical: true
1467
- });
1468
- return spec;
1469
- }
1470
- tokens.tag = match[1];
1471
- tokens.postTag = match[3];
1472
- tokens.description = tokens.description.slice(match[0].length);
1473
- spec.tag = match[2];
1474
- return spec;
1475
- };
1488
+ // packages/utils/glob.ts
1489
+ var componentsObj = {};
1490
+ var componentPropsObj = {};
1491
+ var componentNameKeys = [];
1492
+ var exampleObj = {};
1493
+ var examplesObj = {};
1494
+ var examplesRawObj = {};
1495
+ function getTests() {
1496
+ return getConfig("example");
1476
1497
  }
1477
-
1478
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/tokenizers/type.js
1479
- function typeTokenizer(spacing = "compact") {
1480
- const join5 = getJoiner(spacing);
1481
- return (spec) => {
1482
- let curlies = 0;
1483
- let lines = [];
1484
- for (const [i, { tokens }] of spec.source.entries()) {
1485
- let type = "";
1486
- if (i === 0 && tokens.description[0] !== "{")
1487
- return spec;
1488
- for (const ch of tokens.description) {
1489
- if (ch === "{")
1490
- curlies++;
1491
- if (ch === "}")
1492
- curlies--;
1493
- type += ch;
1494
- if (curlies === 0)
1495
- break;
1498
+ function setExampleObj(dir, example, vexample, comRaw) {
1499
+ const obj2 = mergeObject(example, vexample || {}, 3, true);
1500
+ obj2.exampless = obj2.exampless || [];
1501
+ obj2.examplessRaw = obj2.examplessRaw || [];
1502
+ const arr = [];
1503
+ const examples = obj2.examples;
1504
+ if (examples) {
1505
+ Object.keys(examples).forEach((key) => {
1506
+ arr.push(key);
1507
+ examplesObj[key] = examples[key];
1508
+ });
1509
+ }
1510
+ const examplesRaw = obj2.examplesRaw;
1511
+ const arrraw = [];
1512
+ if (obj2.urls && obj2.urls.length > 0) {
1513
+ obj2.exampless = obj2.urls;
1514
+ obj2.urls.forEach((key) => {
1515
+ arrraw.push(key);
1516
+ if (examplesRaw) {
1517
+ examplesRawObj[key] = getexamplesRawObj(examplesRaw, key);
1496
1518
  }
1497
- lines.push([tokens, type]);
1498
- if (curlies === 0)
1499
- break;
1500
- }
1501
- if (curlies !== 0) {
1502
- spec.problems.push({
1503
- code: "spec:type:unpaired-curlies",
1504
- message: "unpaired curlies",
1505
- line: spec.source[0].number,
1506
- critical: true
1519
+ });
1520
+ } else {
1521
+ obj2.exampless = arr;
1522
+ if (examplesRaw) {
1523
+ Object.keys(examplesRaw).forEach((key) => {
1524
+ arrraw.push(key);
1525
+ examplesRawObj[key] = getexamplesRawObj(examplesRaw, key);
1507
1526
  });
1508
- return spec;
1509
1527
  }
1510
- const parts = [];
1511
- const offset = lines[0][0].postDelimiter.length;
1512
- for (const [i, [tokens, type]] of lines.entries()) {
1513
- tokens.type = type;
1514
- if (i > 0) {
1515
- tokens.type = tokens.postDelimiter.slice(offset) + type;
1516
- tokens.postDelimiter = tokens.postDelimiter.slice(0, offset);
1517
- }
1518
- [tokens.postType, tokens.description] = splitSpace(tokens.description.slice(type.length));
1519
- parts.push(tokens.type);
1528
+ }
1529
+ obj2.examples = void 0;
1530
+ if (example.tests && comRaw) {
1531
+ const testsNanme = example.testsNanme || "/tests/";
1532
+ if (typeof testsNanme == "string") {
1533
+ Object.keys(comRaw).forEach((key) => {
1534
+ if (key.includes(testsNanme)) {
1535
+ obj2.exampless.push(key);
1536
+ arrraw.push(key);
1537
+ examplesRawObj[key] = getexamplesRawObj(comRaw, key);
1538
+ }
1539
+ });
1540
+ } else {
1541
+ Object.keys(comRaw).forEach((key) => {
1542
+ if (testsNanme.test(key)) {
1543
+ obj2.exampless.push(key);
1544
+ arrraw.push(key);
1545
+ examplesRawObj[key] = getexamplesRawObj(comRaw, key);
1546
+ }
1547
+ });
1520
1548
  }
1521
- parts[0] = parts[0].slice(1);
1522
- parts[parts.length - 1] = parts[parts.length - 1].slice(0, -1);
1523
- spec.type = join5(parts);
1524
- return spec;
1525
- };
1549
+ }
1550
+ obj2.exampless = [...new Set(obj2.exampless)];
1551
+ obj2.examplessRaw = [...new Set(arrraw)];
1552
+ obj2.examplesRaw = void 0;
1553
+ exampleObj[dir] = obj2;
1526
1554
  }
1527
- var trim = (x) => x.trim();
1528
- function getJoiner(spacing) {
1529
- if (spacing === "compact")
1530
- return (t) => t.map(trim).join("");
1531
- else if (spacing === "preserve")
1532
- return (t) => t.join("\n");
1533
- else
1534
- return spacing;
1555
+ function getexamplesRawObj(comRaw, key) {
1556
+ if (typeof comRaw == "function") {
1557
+ return comRaw;
1558
+ } else if (comRaw) {
1559
+ return comRaw[key] || comRaw;
1560
+ } else {
1561
+ return comRaw;
1562
+ }
1535
1563
  }
1536
-
1537
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/tokenizers/name.js
1538
- var isQuoted = (s) => s && s.startsWith('"') && s.endsWith('"');
1539
- function nameTokenizer() {
1540
- const typeEnd = (num, { tokens }, i) => tokens.type === "" ? num : i;
1541
- return (spec) => {
1542
- const { tokens } = spec.source[spec.source.reduce(typeEnd, 0)];
1543
- const source = tokens.description.trimLeft();
1544
- const quotedGroups = source.split('"');
1545
- if (quotedGroups.length > 1 && quotedGroups[0] === "" && quotedGroups.length % 2 === 1) {
1546
- spec.name = quotedGroups[1];
1547
- tokens.name = `"${quotedGroups[1]}"`;
1548
- [tokens.postName, tokens.description] = splitSpace(source.slice(tokens.name.length));
1549
- return spec;
1550
- }
1551
- let brackets = 0;
1552
- let name = "";
1553
- let optional = false;
1554
- let defaultValue;
1555
- for (const ch of source) {
1556
- if (brackets === 0 && isSpace(ch))
1557
- break;
1558
- if (ch === "[")
1559
- brackets++;
1560
- if (ch === "]")
1561
- brackets--;
1562
- name += ch;
1564
+ var aliasObj = {};
1565
+ function getURLalias(value) {
1566
+ const alias = getConfig("resolve");
1567
+ if (aliasObj[value]) {
1568
+ return aliasObj[value];
1569
+ } else {
1570
+ for (let o of alias) {
1571
+ if (value.startsWith(o.find + "/")) {
1572
+ const t = o.replacement.replaceAll("\\", "/");
1573
+ const v = t + value.replace(o.find + "/", "/");
1574
+ aliasObj[value] = v;
1575
+ return v;
1576
+ }
1563
1577
  }
1564
- if (brackets !== 0) {
1565
- spec.problems.push({
1566
- code: "spec:name:unpaired-brackets",
1567
- message: "unpaired brackets",
1568
- line: spec.source[0].number,
1569
- critical: true
1578
+ }
1579
+ }
1580
+ async function getImport(text, type) {
1581
+ let jstext = "";
1582
+ if (type == "vue") {
1583
+ jstext = getVueTexts(text).script;
1584
+ } else if (type == "js" || type == "ts" || type == "") {
1585
+ jstext = text;
1586
+ }
1587
+ if (jstext) {
1588
+ const arr = await getTextImport(jstext);
1589
+ const yrs = [];
1590
+ if (arr && arr.length > 0) {
1591
+ arr.forEach((key) => {
1592
+ if (key) {
1593
+ if (key.startsWith("./") || key.startsWith("../")) {
1594
+ yrs.push(key);
1595
+ } else {
1596
+ const v = getURLalias(key);
1597
+ if (v) {
1598
+ yrs.push(v);
1599
+ }
1600
+ }
1601
+ }
1570
1602
  });
1571
- return spec;
1572
1603
  }
1573
- const nameToken = name;
1574
- if (name[0] === "[" && name[name.length - 1] === "]") {
1575
- optional = true;
1576
- name = name.slice(1, -1);
1577
- const parts = name.split("=");
1578
- name = parts[0].trim();
1579
- if (parts[1] !== void 0)
1580
- defaultValue = parts.slice(1).join("=").trim();
1581
- if (name === "") {
1582
- spec.problems.push({
1583
- code: "spec:name:empty-name",
1584
- message: "empty name",
1585
- line: spec.source[0].number,
1586
- critical: true
1587
- });
1588
- return spec;
1589
- }
1590
- if (defaultValue === "") {
1591
- spec.problems.push({
1592
- code: "spec:name:empty-default",
1593
- message: "empty default value",
1594
- line: spec.source[0].number,
1595
- critical: true
1596
- });
1597
- return spec;
1598
- }
1599
- if (!isQuoted(defaultValue) && /=(?!>)/.test(defaultValue)) {
1600
- spec.problems.push({
1601
- code: "spec:name:invalid-default",
1602
- message: "invalid default value syntax",
1603
- line: spec.source[0].number,
1604
- critical: true
1604
+ return yrs;
1605
+ }
1606
+ }
1607
+ function getLocalTextTests(obj2) {
1608
+ return new Promise((resolve2) => {
1609
+ if (obj2) {
1610
+ if (obj2.raw) {
1611
+ resolve2(obj2.raw);
1612
+ } else if (obj2.getRaw) {
1613
+ obj2.getRaw(obj2).then((s) => {
1614
+ const m = getGetRawValue(s);
1615
+ obj2.raw = m;
1616
+ obj2.getRaw = null;
1617
+ resolve2(m);
1605
1618
  });
1606
- return spec;
1619
+ } else {
1620
+ resolve2("");
1607
1621
  }
1622
+ } else {
1623
+ resolve2("");
1608
1624
  }
1609
- spec.optional = optional;
1610
- spec.name = name;
1611
- tokens.name = nameToken;
1612
- if (defaultValue !== void 0)
1613
- spec.default = defaultValue;
1614
- [tokens.postName, tokens.description] = splitSpace(source.slice(tokens.name.length));
1615
- return spec;
1616
- };
1617
- }
1618
-
1619
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/tokenizers/description.js
1620
- function descriptionTokenizer(spacing = "compact", markers = Markers) {
1621
- const join5 = getJoiner2(spacing);
1622
- return (spec) => {
1623
- spec.description = join5(spec.source, markers);
1624
- return spec;
1625
- };
1626
- }
1627
- function getJoiner2(spacing) {
1628
- if (spacing === "compact")
1629
- return compactJoiner;
1630
- if (spacing === "preserve")
1631
- return preserveJoiner;
1632
- return spacing;
1633
- }
1634
- function compactJoiner(lines, markers = Markers) {
1635
- return lines.map(({ tokens: { description } }) => description.trim()).filter((description) => description !== "").join(" ");
1636
- }
1637
- var lineNo = (num, { tokens }, i) => tokens.type === "" ? num : i;
1638
- var getDescription = ({ tokens }) => (tokens.delimiter === "" ? tokens.start : tokens.postDelimiter.slice(1)) + tokens.description;
1639
- function preserveJoiner(lines, markers = Markers) {
1640
- if (lines.length === 0)
1641
- return "";
1642
- if (lines[0].tokens.description === "" && lines[0].tokens.delimiter === markers.start)
1643
- lines = lines.slice(1);
1644
- const lastLine = lines[lines.length - 1];
1645
- if (lastLine !== void 0 && lastLine.tokens.description === "" && lastLine.tokens.end.endsWith(markers.end))
1646
- lines = lines.slice(0, -1);
1647
- lines = lines.slice(lines.reduce(lineNo, 0));
1648
- return lines.map(getDescription).join("\n");
1649
- }
1650
-
1651
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/index.js
1652
- function getParser4({ startLine = 0, fence = "```", spacing = "compact", markers = Markers, tokenizers = [
1653
- tagTokenizer(),
1654
- typeTokenizer(spacing),
1655
- nameTokenizer(),
1656
- descriptionTokenizer(spacing)
1657
- ] } = {}) {
1658
- if (startLine < 0 || startLine % 1 > 0)
1659
- throw new Error("Invalid startLine");
1660
- const parseSource = getParser2({ startLine, markers });
1661
- const parseBlock = getParser({ fence });
1662
- const parseSpec = getParser3({ tokenizers });
1663
- const joinDescription = getJoiner2(spacing);
1664
- return function(source) {
1665
- const blocks = [];
1666
- for (const line of splitLines(source)) {
1667
- const lines = parseSource(line);
1668
- if (lines === null)
1669
- continue;
1670
- const sections = parseBlock(lines);
1671
- const specs = sections.slice(1).map(parseSpec);
1672
- blocks.push({
1673
- description: joinDescription(sections[0], markers),
1674
- tags: specs,
1675
- source: lines,
1676
- problems: specs.reduce((acc, spec) => acc.concat(spec.problems), [])
1677
- });
1678
- }
1679
- return blocks;
1680
- };
1681
- }
1682
-
1683
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/stringifier/index.js
1684
- function join3(tokens) {
1685
- return tokens.start + tokens.delimiter + tokens.postDelimiter + tokens.tag + tokens.postTag + tokens.type + tokens.postType + tokens.name + tokens.postName + tokens.description + tokens.end + tokens.lineEnd;
1686
- }
1687
- function getStringifier() {
1688
- return (block) => block.source.map(({ tokens }) => join3(tokens)).join("\n");
1689
- }
1690
-
1691
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/stringifier/inspect.js
1692
- var zeroWidth = {
1693
- line: 0,
1694
- start: 0,
1695
- delimiter: 0,
1696
- postDelimiter: 0,
1697
- tag: 0,
1698
- postTag: 0,
1699
- name: 0,
1700
- postName: 0,
1701
- type: 0,
1702
- postType: 0,
1703
- description: 0,
1704
- end: 0,
1705
- lineEnd: 0
1706
- };
1707
- var fields = Object.keys(zeroWidth);
1708
-
1709
- // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/index.js
1710
- function parse(source, options = {}) {
1711
- return getParser4(options)(source);
1712
- }
1713
- var stringify = getStringifier();
1714
-
1715
- // node_modules/.pnpm/@fangzhongya+utils@0.0.73/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1716
- function deComment(code) {
1717
- let output = "";
1718
- let state = "code";
1719
- let escaping = false;
1720
- let i = 0;
1721
- const len = code.length;
1722
- while (i < len) {
1723
- const char = code[i];
1724
- const nextChar = code[i + 1];
1725
- switch (state) {
1726
- case "code":
1727
- if (char === "/" && nextChar === "/") {
1728
- state = "singleLine";
1729
- i += 2;
1730
- } else if (char === "/" && nextChar === "*") {
1731
- state = "multiLine";
1732
- i += 2;
1733
- } else if (char === "'") {
1734
- state = "singleQuote";
1735
- output += char;
1736
- i++;
1737
- } else if (char === '"') {
1738
- state = "doubleQuote";
1739
- output += char;
1740
- i++;
1741
- } else if (char === "`") {
1742
- state = "template";
1743
- output += char;
1744
- i++;
1745
- } else {
1746
- output += char;
1747
- i++;
1748
- }
1749
- break;
1750
- case "singleLine":
1751
- if (char === "\n" || char === "\r") {
1752
- state = "code";
1753
- output += char;
1754
- i++;
1755
- if (char === "\r" && nextChar === "\n") {
1756
- output += nextChar;
1757
- i++;
1758
- }
1759
- } else {
1760
- i++;
1761
- }
1762
- break;
1763
- case "multiLine":
1764
- if (char === "*" && nextChar === "/") {
1765
- state = "code";
1766
- i += 2;
1767
- if (output.length > 0 && /[a-zA-Z0-9_$]$/.test(output) && i < len && /[a-zA-Z0-9_$]/.test(code[i])) {
1768
- output += " ";
1769
- }
1770
- } else {
1771
- i++;
1772
- }
1773
- break;
1774
- case "singleQuote":
1775
- output += char;
1776
- if (!escaping && char === "'") {
1777
- state = "code";
1778
- }
1779
- escaping = !escaping && char === "\\";
1780
- i++;
1781
- break;
1782
- case "doubleQuote":
1783
- output += char;
1784
- if (!escaping && char === '"') {
1785
- state = "code";
1786
- }
1787
- escaping = !escaping && char === "\\";
1788
- i++;
1789
- break;
1790
- case "template":
1791
- output += char;
1792
- if (!escaping && char === "`") {
1793
- state = "code";
1794
- } else if (!escaping && char === "$" && nextChar === "{") {
1795
- output += nextChar;
1796
- i += 2;
1797
- continue;
1798
- }
1799
- escaping = !escaping && char === "\\";
1800
- i++;
1801
- break;
1802
- }
1803
- }
1804
- return output;
1805
- }
1806
-
1807
- // node_modules/.pnpm/@fangzhongya+utils@0.0.73/node_modules/@fangzhongya/utils/dist/chunk-N5Y3XGHX.js
1808
- function getImports(code, includeType = false) {
1809
- code = deComment(code);
1810
- const imports = /* @__PURE__ */ new Set();
1811
- const regex = /(?:import\s*(?:type\s+)?(?:(?:\w+|\*\s*as\s+\w+|\{[^}]*\})\s+from\s*)?['"]([^'"]+)['"]|import\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)|export\s*(?:type\s+)?(?:(?:\*|\*?\s*as\s+\w+|\{[^}]*\})\s+from\s*)?['"]([^'"]+)['"])/g;
1812
- let match;
1813
- while ((match = regex.exec(code)) !== null) {
1814
- const path = match[1] || match[2] || match[3] || match[4];
1815
- if (!path) continue;
1816
- const fullMatch = match[0];
1817
- if (!includeType) {
1818
- if (fullMatch.includes("import") && isPureTypeImport(fullMatch) || fullMatch.includes("export") && isPureTypeExport(fullMatch)) {
1819
- continue;
1820
- }
1821
- }
1822
- imports.add(path);
1823
- }
1824
- return Array.from(imports);
1825
- }
1826
- function isPureTypeImport(importStatement) {
1827
- const importTypeRegex = /^\s*import\s+type\b/;
1828
- if (importTypeRegex.test(importStatement)) {
1829
- return true;
1830
- }
1831
- if (importStatement.includes("{")) {
1832
- const braceContent = importStatement.match(/\{([^}]*)\}/)?.[1] || "";
1833
- const items = braceContent.split(",").map((item) => item.trim()).filter(Boolean);
1834
- return items.length > 0 && items.every((item) => item.startsWith("type "));
1835
- }
1836
- return false;
1837
- }
1838
- function isPureTypeExport(exportStatement) {
1839
- const exportTypeRegex = /^\s*export\s+type\b/;
1840
- if (exportTypeRegex.test(exportStatement)) {
1841
- return true;
1842
- }
1843
- if (exportStatement.includes("{")) {
1844
- const braceContent = exportStatement.match(/\{([^}]*)\}/)?.[1] || "";
1845
- const items = braceContent.split(",").map((item) => item.trim()).filter(Boolean);
1846
- return items.length > 0 && items.every((item) => item.startsWith("type "));
1847
- }
1848
- return false;
1849
- }
1850
-
1851
- // packages/utils/index.ts
1852
- function getTextNotes(text) {
1853
- if (text) {
1854
- return parse(text);
1855
- }
1856
- }
1857
- function getTextImport(jstext) {
1858
- return new Promise(async (resolve2) => {
1859
- const importss = getImports(jstext);
1860
- resolve2(importss);
1861
- });
1862
- }
1863
-
1864
- // packages/utils/glob.ts
1865
- var componentsObj = {};
1866
- var componentPropsObj = {};
1867
- var componentNameKeys = [];
1868
- var exampleObj = {};
1869
- var examplesObj = {};
1870
- var examplesRawObj = {};
1871
- function getTests() {
1872
- return getConfig("example");
1873
- }
1874
- function setExampleObj(dir, example, vexample, comRaw) {
1875
- const obj2 = mergeObject(example, vexample || {}, 3, true);
1876
- obj2.exampless = obj2.exampless || [];
1877
- obj2.examplessRaw = obj2.examplessRaw || [];
1878
- const arr = [];
1879
- const examples = obj2.examples;
1880
- if (examples) {
1881
- Object.keys(examples).forEach((key) => {
1882
- arr.push(key);
1883
- examplesObj[key] = examples[key];
1884
- });
1885
- }
1886
- const examplesRaw = obj2.examplesRaw;
1887
- const arrraw = [];
1888
- if (obj2.urls && obj2.urls.length > 0) {
1889
- obj2.exampless = obj2.urls;
1890
- obj2.urls.forEach((key) => {
1891
- arrraw.push(key);
1892
- if (examplesRaw) {
1893
- examplesRawObj[key] = getexamplesRawObj(examplesRaw, key);
1894
- }
1895
- });
1896
- } else {
1897
- obj2.exampless = arr;
1898
- if (examplesRaw) {
1899
- Object.keys(examplesRaw).forEach((key) => {
1900
- arrraw.push(key);
1901
- examplesRawObj[key] = getexamplesRawObj(examplesRaw, key);
1902
- });
1903
- }
1904
- }
1905
- obj2.examples = void 0;
1906
- if (example.tests && comRaw) {
1907
- const testsNanme = example.testsNanme || "/tests/";
1908
- if (typeof testsNanme == "string") {
1909
- Object.keys(comRaw).forEach((key) => {
1910
- if (key.includes(testsNanme)) {
1911
- obj2.exampless.push(key);
1912
- arrraw.push(key);
1913
- examplesRawObj[key] = getexamplesRawObj(comRaw, key);
1914
- }
1915
- });
1916
- } else {
1917
- Object.keys(comRaw).forEach((key) => {
1918
- if (testsNanme.test(key)) {
1919
- obj2.exampless.push(key);
1920
- arrraw.push(key);
1921
- examplesRawObj[key] = getexamplesRawObj(comRaw, key);
1922
- }
1923
- });
1924
- }
1925
- }
1926
- obj2.exampless = [...new Set(obj2.exampless)];
1927
- obj2.examplessRaw = [...new Set(arrraw)];
1928
- obj2.examplesRaw = void 0;
1929
- exampleObj[dir] = obj2;
1930
- }
1931
- function getexamplesRawObj(comRaw, key) {
1932
- if (typeof comRaw == "function") {
1933
- return comRaw;
1934
- } else if (comRaw) {
1935
- return comRaw[key] || comRaw;
1936
- } else {
1937
- return comRaw;
1938
- }
1939
- }
1940
- var aliasObj = {};
1941
- function getURLalias(value) {
1942
- const alias = getConfig("resolve");
1943
- if (aliasObj[value]) {
1944
- return aliasObj[value];
1945
- } else {
1946
- for (let o of alias) {
1947
- if (value.startsWith(o.find + "/")) {
1948
- const t = o.replacement.replaceAll("\\", "/");
1949
- const v = t + value.replace(o.find + "/", "/");
1950
- aliasObj[value] = v;
1951
- return v;
1952
- }
1953
- }
1954
- }
1955
- }
1956
- async function getImport(text, type) {
1957
- let jstext = "";
1958
- if (type == "vue") {
1959
- jstext = getVueTexts(text).script;
1960
- } else if (type == "js" || type == "ts" || type == "") {
1961
- jstext = text;
1962
- }
1963
- if (jstext) {
1964
- const arr = await getTextImport(jstext);
1965
- const yrs = [];
1966
- if (arr && arr.length > 0) {
1967
- arr.forEach((key) => {
1968
- if (key) {
1969
- if (key.startsWith("./") || key.startsWith("../")) {
1970
- yrs.push(key);
1971
- } else {
1972
- const v = getURLalias(key);
1973
- if (v) {
1974
- yrs.push(v);
1975
- }
1976
- }
1977
- }
1978
- });
1979
- }
1980
- return yrs;
1981
- }
1982
- }
1983
- function getLocalTextTests(obj2) {
1984
- return new Promise((resolve2) => {
1985
- if (obj2) {
1986
- if (obj2.raw) {
1987
- resolve2(obj2.raw);
1988
- } else if (obj2.getRaw) {
1989
- obj2.getRaw(obj2).then((s) => {
1990
- const m = getGetRawValue(s);
1991
- obj2.raw = m;
1992
- obj2.getRaw = null;
1993
- resolve2(m);
1994
- });
1995
- } else {
1996
- resolve2("");
1997
- }
1998
- } else {
1999
- resolve2("");
2000
- }
2001
- });
1625
+ });
2002
1626
  }
2003
1627
  function getLevelUrl(key, obj2) {
2004
1628
  key = (key || "") + "";
@@ -2546,12 +2170,19 @@ var props = {
2546
2170
  },
2547
2171
  required(obj2) {
2548
2172
  if (obj2.required) {
2549
- return obj2.required.name + obj2.required.description;
2173
+ return obj2.required.name + obj2.required.description || "true";
2550
2174
  } else if (obj2.props) {
2551
2175
  return obj2.props.required;
2552
2176
  } else {
2553
2177
  return "";
2554
2178
  }
2179
+ },
2180
+ model(obj2) {
2181
+ if (obj2.model) {
2182
+ return obj2.model.name + obj2.model.description || "true";
2183
+ } else {
2184
+ return "";
2185
+ }
2555
2186
  }
2556
2187
  };
2557
2188
  var emits = {
@@ -2706,646 +2337,708 @@ function getSlotValue(arr) {
2706
2337
  });
2707
2338
  }
2708
2339
 
2709
- // packages/components/test/index.ts
2710
- function getObj(v) {
2711
- delete v.problems;
2712
- delete v.source;
2713
- return v;
2714
- }
2715
- function getFilter(obj2, keyArr) {
2716
- const _objs = {
2717
- descriptions: obj2?.description || ""
2718
- };
2719
- const arr = [];
2720
- if (obj2?.tags) {
2721
- obj2?.tags?.forEach((v, index) => {
2722
- let tag = v.tag;
2723
- let ov = getObj(v);
2724
- if (!_objs.hasOwnProperty(tag) && keyArr.includes(tag)) {
2725
- _objs[tag] = ov;
2726
- } else {
2727
- let ao = {};
2728
- ao[tag] = ov;
2729
- arr.push({
2730
- key: tag,
2731
- value: ao
2732
- });
2733
- }
2734
- });
2735
- }
2736
- return {
2737
- arr,
2738
- obj: _objs
2739
- };
2740
- }
2741
- var titles = [];
2742
- function setTitle(obj2) {
2743
- const arr = ["title", "author", "date"];
2744
- const fobj = getFilter(obj2, arr);
2745
- const value = {};
2746
- arr.forEach((key) => {
2747
- value[key] = fobj.obj[key];
2748
- });
2749
- addTitle(value);
2750
- fobj.arr.forEach((o) => {
2751
- addTags(o.key, o.value);
2752
- });
2340
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/primitives.js
2341
+ var Markers;
2342
+ (function(Markers2) {
2343
+ Markers2["start"] = "/**";
2344
+ Markers2["nostart"] = "/***";
2345
+ Markers2["delim"] = "*";
2346
+ Markers2["end"] = "*/";
2347
+ })(Markers = Markers || (Markers = {}));
2348
+
2349
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/util.js
2350
+ function isSpace(source) {
2351
+ return /^\s+$/.test(source);
2753
2352
  }
2754
- var states = [];
2755
- function setState(obj2) {
2756
- const arr = ["state", "type"];
2757
- const fobj = getFilter(obj2, arr);
2758
- const value = {};
2759
- arr.forEach((key) => {
2760
- value[key] = fobj.obj[key];
2761
- });
2762
- addState(value);
2763
- fobj.arr.forEach((o) => {
2764
- addTags(o.key, o.value);
2765
- });
2353
+ function splitCR(source) {
2354
+ const matches = source.match(/\r+$/);
2355
+ return matches == null ? ["", source] : [source.slice(-matches[0].length), source.slice(0, -matches[0].length)];
2766
2356
  }
2767
- function addTitle(value) {
2768
- titles.push(value);
2357
+ function splitSpace(source) {
2358
+ const matches = source.match(/^\s+/);
2359
+ return matches == null ? ["", source] : [source.slice(0, matches[0].length), source.slice(matches[0].length)];
2769
2360
  }
2770
- function addProposal(value) {
2771
- titles.push(value);
2361
+ function splitLines(source) {
2362
+ return source.split(/\n/);
2772
2363
  }
2773
- function addError(value) {
2774
- titles.push(value);
2364
+ function seedSpec(spec = {}) {
2365
+ return Object.assign({ tag: "", name: "", type: "", optional: false, description: "", problems: [], source: [] }, spec);
2775
2366
  }
2776
- function addState(value) {
2777
- states.push(value);
2367
+ function seedTokens(tokens = {}) {
2368
+ return Object.assign({ start: "", delimiter: "", postDelimiter: "", tag: "", postTag: "", name: "", postName: "", type: "", postType: "", description: "", end: "", lineEnd: "" }, tokens);
2778
2369
  }
2779
- function addTags(tag, obj2) {
2780
- switch (tag) {
2781
- case "title":
2782
- addTitle(obj2);
2783
- return true;
2784
- case "proposal":
2785
- addProposal(obj2);
2786
- return true;
2787
- case "error":
2788
- addError(obj2);
2789
- return true;
2790
- case "state":
2791
- addState(obj2);
2792
- return true;
2793
- case "text":
2794
- addTitle(obj2);
2795
- return true;
2796
- case "html":
2797
- addTitle(obj2);
2798
- return true;
2799
- default:
2800
- return false;
2801
- }
2370
+
2371
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/block-parser.js
2372
+ var reTag = /^@\S+/;
2373
+ function getParser({ fence = "```" } = {}) {
2374
+ const fencer = getFencer(fence);
2375
+ const toggleFence = (source, isFenced) => fencer(source) ? !isFenced : isFenced;
2376
+ return function parseBlock(source) {
2377
+ const sections = [[]];
2378
+ let isFenced = false;
2379
+ for (const line of source) {
2380
+ if (reTag.test(line.tokens.description) && !isFenced) {
2381
+ sections.push([line]);
2382
+ } else {
2383
+ sections[sections.length - 1].push(line);
2384
+ }
2385
+ isFenced = toggleFence(line.tokens.description, isFenced);
2386
+ }
2387
+ return sections;
2388
+ };
2802
2389
  }
2803
- function setTags(tag, obj2) {
2804
- switch (tag) {
2805
- case "title":
2806
- setTitle(obj2);
2807
- return true;
2808
- // case 'proposal':
2809
- // setProposal(obj);
2810
- // return true;
2811
- // case 'error':
2812
- // setError(obj);
2813
- // return true;
2814
- case "state":
2815
- setState(obj2);
2816
- return true;
2817
- default:
2818
- return false;
2819
- }
2390
+ function getFencer(fence) {
2391
+ if (typeof fence === "string")
2392
+ return (source) => source.split(fence).length % 2 === 0;
2393
+ return fence;
2820
2394
  }
2821
- function getNotes(text) {
2822
- titles = [];
2823
- states = [];
2824
- const notes = getTextNotes(text);
2825
- notes?.forEach((obj2) => {
2826
- let tags = obj2?.tags || [];
2827
- let lg = tags?.length || 0;
2828
- if (lg > 0) {
2829
- for (let i = 0; i < lg; i++) {
2830
- const v = tags[i] || {};
2831
- let is = setTags(v.tag, obj2);
2832
- if (is) {
2833
- break;
2834
- }
2835
- }
2395
+
2396
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/source-parser.js
2397
+ function getParser2({ startLine = 0, markers = Markers } = {}) {
2398
+ let block = null;
2399
+ let num = startLine;
2400
+ return function parseSource(source) {
2401
+ let rest = source;
2402
+ const tokens = seedTokens();
2403
+ [tokens.lineEnd, rest] = splitCR(rest);
2404
+ [tokens.start, rest] = splitSpace(rest);
2405
+ if (block === null && rest.startsWith(markers.start) && !rest.startsWith(markers.nostart)) {
2406
+ block = [];
2407
+ tokens.delimiter = rest.slice(0, markers.start.length);
2408
+ rest = rest.slice(markers.start.length);
2409
+ [tokens.postDelimiter, rest] = splitSpace(rest);
2836
2410
  }
2837
- });
2838
- return {
2839
- titles,
2840
- states
2411
+ if (block === null) {
2412
+ num++;
2413
+ return null;
2414
+ }
2415
+ const isClosed = rest.trimRight().endsWith(markers.end);
2416
+ if (tokens.delimiter === "" && rest.startsWith(markers.delim) && !rest.startsWith(markers.end)) {
2417
+ tokens.delimiter = markers.delim;
2418
+ rest = rest.slice(markers.delim.length);
2419
+ [tokens.postDelimiter, rest] = splitSpace(rest);
2420
+ }
2421
+ if (isClosed) {
2422
+ const trimmed = rest.trimRight();
2423
+ tokens.end = rest.slice(trimmed.length - markers.end.length);
2424
+ rest = trimmed.slice(0, -markers.end.length);
2425
+ }
2426
+ tokens.description = rest;
2427
+ block.push({ number: num, source, tokens });
2428
+ num++;
2429
+ if (isClosed) {
2430
+ const result = block.slice();
2431
+ block = null;
2432
+ return result;
2433
+ }
2434
+ return null;
2841
2435
  };
2842
2436
  }
2843
2437
 
2844
- // packages/components/compo/top.ts
2845
- var import_vue = require("vue");
2846
- function getTopDom(props2, h4, isZy) {
2847
- let doms = [];
2848
- let domss = [];
2849
- let list = [];
2850
- const getValue = (v) => {
2851
- if (isZy) {
2852
- return htmlEscape(v);
2853
- } else {
2854
- return v;
2855
- }
2856
- };
2857
- const setTitle3 = () => {
2858
- if (list.length > 0) {
2859
- doms.push(
2860
- h4(
2861
- "div",
2862
- {
2863
- class: "compo-top-list"
2864
- },
2865
- list
2866
- )
2867
- );
2868
- list = [];
2438
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/spec-parser.js
2439
+ function getParser3({ tokenizers }) {
2440
+ return function parseSpec(source) {
2441
+ var _a;
2442
+ let spec = seedSpec({ source });
2443
+ for (const tokenize of tokenizers) {
2444
+ spec = tokenize(spec);
2445
+ if ((_a = spec.problems[spec.problems.length - 1]) === null || _a === void 0 ? void 0 : _a.critical)
2446
+ break;
2869
2447
  }
2448
+ return spec;
2870
2449
  };
2871
- const setDivision = () => {
2872
- if (doms.length > 0) {
2873
- domss.push(
2874
- h4(
2875
- "div",
2876
- {
2877
- class: "compo-top-division"
2878
- },
2879
- doms
2880
- )
2881
- );
2882
- doms = [];
2450
+ }
2451
+
2452
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/tokenizers/tag.js
2453
+ function tagTokenizer() {
2454
+ return (spec) => {
2455
+ const { tokens } = spec.source[0];
2456
+ const match = tokens.description.match(/\s*(@(\S+))(\s*)/);
2457
+ if (match === null) {
2458
+ spec.problems.push({
2459
+ code: "spec:tag:prefix",
2460
+ message: 'tag should start with "@" symbol',
2461
+ line: spec.source[0].number,
2462
+ critical: true
2463
+ });
2464
+ return spec;
2883
2465
  }
2466
+ tokens.tag = match[1];
2467
+ tokens.postTag = match[3];
2468
+ tokens.description = tokens.description.slice(match[0].length);
2469
+ spec.tag = match[2];
2470
+ return spec;
2884
2471
  };
2885
- props2?.forEach((obj2) => {
2886
- const info = [];
2887
- let is = false;
2888
- if (obj2.date) {
2889
- is = true;
2890
- info.push(
2891
- h4(
2892
- "div",
2893
- {
2894
- class: "compo-top-date"
2895
- },
2896
- [
2897
- h4("span", {}, "\u66F4\u65B0\u65F6\u95F4\uFF1A"),
2898
- h4("span", {}, [
2899
- getValue(
2900
- obj2.date.name + " " + obj2.date.description
2901
- )
2902
- ])
2903
- ]
2904
- )
2905
- );
2906
- }
2907
- if (obj2.author) {
2908
- is = true;
2909
- info.push(
2910
- h4(
2911
- "div",
2912
- {
2913
- class: "compo-top-author"
2914
- },
2915
- [
2916
- h4("span", {}, "\u4F5C\u8005\uFF1A"),
2917
- h4("span", {}, [
2918
- getValue(
2919
- obj2.author.name + " " + obj2.author.description
2920
- )
2921
- ])
2922
- ]
2923
- )
2924
- );
2925
- }
2926
- if (obj2.title && (obj2.title.type || obj2.title.name || obj2.title.description)) {
2927
- setTitle3();
2928
- if (is) {
2929
- setDivision();
2930
- }
2931
- let type = (obj2.title.type || "div").split(".");
2932
- let c = type[1] || "";
2933
- if (type[0] == "html") {
2934
- doms.push(
2935
- h4("div", {
2936
- class: "compo-top-title " + c,
2937
- innerHTML: obj2.title.name + " " + obj2.title.description
2938
- })
2939
- );
2940
- } else {
2941
- doms.push(
2942
- h4(
2943
- type[0],
2944
- {
2945
- class: "compo-top-title " + c
2946
- },
2947
- [
2948
- h4("span", {}, [
2949
- getValue(
2950
- obj2.title.name + " " + obj2.title.description
2951
- )
2952
- ])
2953
- ]
2954
- )
2955
- );
2956
- }
2957
- }
2958
- if (is) {
2959
- if (list.length > 0) {
2960
- setTitle3();
2961
- setDivision();
2472
+ }
2473
+
2474
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/tokenizers/type.js
2475
+ function typeTokenizer(spacing = "compact") {
2476
+ const join5 = getJoiner(spacing);
2477
+ return (spec) => {
2478
+ let curlies = 0;
2479
+ let lines = [];
2480
+ for (const [i, { tokens }] of spec.source.entries()) {
2481
+ let type = "";
2482
+ if (i === 0 && tokens.description[0] !== "{")
2483
+ return spec;
2484
+ for (const ch of tokens.description) {
2485
+ if (ch === "{")
2486
+ curlies++;
2487
+ if (ch === "}")
2488
+ curlies--;
2489
+ type += ch;
2490
+ if (curlies === 0)
2491
+ break;
2962
2492
  }
2963
- doms.push(
2964
- h4(
2965
- "div",
2966
- {
2967
- class: "compo-top-info"
2968
- },
2969
- info
2970
- )
2971
- );
2493
+ lines.push([tokens, type]);
2494
+ if (curlies === 0)
2495
+ break;
2972
2496
  }
2973
- if (obj2.html) {
2974
- let type = (obj2.html.type || "div").split(".");
2975
- let c = type[1] || "";
2976
- list.push(
2977
- h4(type[0], {
2978
- class: "compo-top-html " + c,
2979
- innerHTML: obj2.html.name + " " + obj2.html.description
2980
- })
2981
- );
2497
+ if (curlies !== 0) {
2498
+ spec.problems.push({
2499
+ code: "spec:type:unpaired-curlies",
2500
+ message: "unpaired curlies",
2501
+ line: spec.source[0].number,
2502
+ critical: true
2503
+ });
2504
+ return spec;
2982
2505
  }
2983
- ["text"].forEach((v) => {
2984
- if (obj2[v]) {
2985
- let type = (obj2[v].type || "div").split(".");
2986
- let c = type[1] || "";
2987
- if (type[0] == "html") {
2988
- list.push(
2989
- h4("div", {
2990
- class: "compo-top-" + v + " " + c,
2991
- innerHTML: obj2[v].name + " " + obj2[v].description
2992
- })
2993
- );
2994
- } else {
2995
- list.push(
2996
- h4(
2997
- type[0],
2998
- {
2999
- class: "compo-top-" + v + " " + c
3000
- },
3001
- [
3002
- h4("span", {}, [
3003
- getValue(
3004
- obj2[v].name + " " + obj2[v].description
3005
- )
3006
- ])
3007
- ]
3008
- )
3009
- );
3010
- }
2506
+ const parts = [];
2507
+ const offset = lines[0][0].postDelimiter.length;
2508
+ for (const [i, [tokens, type]] of lines.entries()) {
2509
+ tokens.type = type;
2510
+ if (i > 0) {
2511
+ tokens.type = tokens.postDelimiter.slice(offset) + type;
2512
+ tokens.postDelimiter = tokens.postDelimiter.slice(0, offset);
3011
2513
  }
3012
- });
3013
- });
3014
- setTitle3();
3015
- setDivision();
3016
- return domss;
2514
+ [tokens.postType, tokens.description] = splitSpace(tokens.description.slice(type.length));
2515
+ parts.push(tokens.type);
2516
+ }
2517
+ parts[0] = parts[0].slice(1);
2518
+ parts[parts.length - 1] = parts[parts.length - 1].slice(0, -1);
2519
+ spec.type = join5(parts);
2520
+ return spec;
2521
+ };
2522
+ }
2523
+ var trim = (x) => x.trim();
2524
+ function getJoiner(spacing) {
2525
+ if (spacing === "compact")
2526
+ return (t) => t.map(trim).join("");
2527
+ else if (spacing === "preserve")
2528
+ return (t) => t.join("\n");
2529
+ else
2530
+ return spacing;
3017
2531
  }
3018
- var top_default = (0, import_vue.defineComponent)({
3019
- /**
3020
- * @props {Stinrg} value 插入数据
3021
- */
3022
- props: {
3023
- value: Array
3024
- },
3025
- render(propss, a, props2) {
3026
- const domss = getTopDom(props2.value, import_vue.h);
3027
- return (0, import_vue.h)(
3028
- "div",
3029
- {
3030
- class: "compo-top"
3031
- },
3032
- domss
3033
- );
3034
- }
3035
- });
3036
2532
 
3037
- // packages/components/test/top.ts
3038
- var import_vue2 = require("vue");
3039
- function getTestTopDom(props2, h4, isZy) {
3040
- let doms = [];
3041
- let domss = [];
3042
- let list = [];
3043
- const getValue = (v) => {
3044
- if (isZy) {
3045
- return htmlEscape(v);
3046
- } else {
3047
- return v;
2533
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/tokenizers/name.js
2534
+ var isQuoted = (s) => s && s.startsWith('"') && s.endsWith('"');
2535
+ function nameTokenizer() {
2536
+ const typeEnd = (num, { tokens }, i) => tokens.type === "" ? num : i;
2537
+ return (spec) => {
2538
+ const { tokens } = spec.source[spec.source.reduce(typeEnd, 0)];
2539
+ const source = tokens.description.trimLeft();
2540
+ const quotedGroups = source.split('"');
2541
+ if (quotedGroups.length > 1 && quotedGroups[0] === "" && quotedGroups.length % 2 === 1) {
2542
+ spec.name = quotedGroups[1];
2543
+ tokens.name = `"${quotedGroups[1]}"`;
2544
+ [tokens.postName, tokens.description] = splitSpace(source.slice(tokens.name.length));
2545
+ return spec;
3048
2546
  }
3049
- };
3050
- const setTitle3 = () => {
3051
- if (list.length > 0) {
3052
- doms.push(
3053
- h4(
3054
- "div",
3055
- {
3056
- class: "test-top-list"
3057
- },
3058
- list
3059
- )
3060
- );
3061
- list = [];
2547
+ let brackets = 0;
2548
+ let name = "";
2549
+ let optional = false;
2550
+ let defaultValue;
2551
+ for (const ch of source) {
2552
+ if (brackets === 0 && isSpace(ch))
2553
+ break;
2554
+ if (ch === "[")
2555
+ brackets++;
2556
+ if (ch === "]")
2557
+ brackets--;
2558
+ name += ch;
3062
2559
  }
3063
- };
3064
- const setDivision = () => {
3065
- if (doms.length > 0) {
3066
- domss.push(
3067
- h4(
3068
- "div",
3069
- {
3070
- class: "test-top-division"
3071
- },
3072
- doms
3073
- )
3074
- );
3075
- doms = [];
2560
+ if (brackets !== 0) {
2561
+ spec.problems.push({
2562
+ code: "spec:name:unpaired-brackets",
2563
+ message: "unpaired brackets",
2564
+ line: spec.source[0].number,
2565
+ critical: true
2566
+ });
2567
+ return spec;
3076
2568
  }
3077
- };
3078
- props2.forEach((obj2) => {
3079
- const info = [];
3080
- let is = false;
3081
- if (obj2.date) {
3082
- is = true;
3083
- info.push(
3084
- h4(
3085
- "div",
3086
- {
3087
- class: "test-top-date"
3088
- },
3089
- [
3090
- h4("span", {}, "\u66F4\u65B0\u65F6\u95F4\uFF1A"),
3091
- h4("span", {}, [
3092
- getValue(
3093
- obj2.date.name + " " + obj2.date.description
3094
- )
3095
- ])
3096
- ]
3097
- )
3098
- );
2569
+ const nameToken = name;
2570
+ if (name[0] === "[" && name[name.length - 1] === "]") {
2571
+ optional = true;
2572
+ name = name.slice(1, -1);
2573
+ const parts = name.split("=");
2574
+ name = parts[0].trim();
2575
+ if (parts[1] !== void 0)
2576
+ defaultValue = parts.slice(1).join("=").trim();
2577
+ if (name === "") {
2578
+ spec.problems.push({
2579
+ code: "spec:name:empty-name",
2580
+ message: "empty name",
2581
+ line: spec.source[0].number,
2582
+ critical: true
2583
+ });
2584
+ return spec;
2585
+ }
2586
+ if (defaultValue === "") {
2587
+ spec.problems.push({
2588
+ code: "spec:name:empty-default",
2589
+ message: "empty default value",
2590
+ line: spec.source[0].number,
2591
+ critical: true
2592
+ });
2593
+ return spec;
2594
+ }
2595
+ if (!isQuoted(defaultValue) && /=(?!>)/.test(defaultValue)) {
2596
+ spec.problems.push({
2597
+ code: "spec:name:invalid-default",
2598
+ message: "invalid default value syntax",
2599
+ line: spec.source[0].number,
2600
+ critical: true
2601
+ });
2602
+ return spec;
2603
+ }
3099
2604
  }
3100
- if (obj2.author) {
3101
- is = true;
3102
- info.push(
3103
- h4(
3104
- "div",
3105
- {
3106
- class: "test-top-author"
3107
- },
3108
- [
3109
- h4("span", {}, "\u4F5C\u8005\uFF1A"),
3110
- h4("span", {}, [
3111
- getValue(
3112
- obj2.author.name + " " + obj2.author.description
3113
- )
3114
- ])
3115
- ]
3116
- )
3117
- );
2605
+ spec.optional = optional;
2606
+ spec.name = name;
2607
+ tokens.name = nameToken;
2608
+ if (defaultValue !== void 0)
2609
+ spec.default = defaultValue;
2610
+ [tokens.postName, tokens.description] = splitSpace(source.slice(tokens.name.length));
2611
+ return spec;
2612
+ };
2613
+ }
2614
+
2615
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/tokenizers/description.js
2616
+ function descriptionTokenizer(spacing = "compact", markers = Markers) {
2617
+ const join5 = getJoiner2(spacing);
2618
+ return (spec) => {
2619
+ spec.description = join5(spec.source, markers);
2620
+ return spec;
2621
+ };
2622
+ }
2623
+ function getJoiner2(spacing) {
2624
+ if (spacing === "compact")
2625
+ return compactJoiner;
2626
+ if (spacing === "preserve")
2627
+ return preserveJoiner;
2628
+ return spacing;
2629
+ }
2630
+ function compactJoiner(lines, markers = Markers) {
2631
+ return lines.map(({ tokens: { description } }) => description.trim()).filter((description) => description !== "").join(" ");
2632
+ }
2633
+ var lineNo = (num, { tokens }, i) => tokens.type === "" ? num : i;
2634
+ var getDescription = ({ tokens }) => (tokens.delimiter === "" ? tokens.start : tokens.postDelimiter.slice(1)) + tokens.description;
2635
+ function preserveJoiner(lines, markers = Markers) {
2636
+ if (lines.length === 0)
2637
+ return "";
2638
+ if (lines[0].tokens.description === "" && lines[0].tokens.delimiter === markers.start)
2639
+ lines = lines.slice(1);
2640
+ const lastLine = lines[lines.length - 1];
2641
+ if (lastLine !== void 0 && lastLine.tokens.description === "" && lastLine.tokens.end.endsWith(markers.end))
2642
+ lines = lines.slice(0, -1);
2643
+ lines = lines.slice(lines.reduce(lineNo, 0));
2644
+ return lines.map(getDescription).join("\n");
2645
+ }
2646
+
2647
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/parser/index.js
2648
+ function getParser4({ startLine = 0, fence = "```", spacing = "compact", markers = Markers, tokenizers = [
2649
+ tagTokenizer(),
2650
+ typeTokenizer(spacing),
2651
+ nameTokenizer(),
2652
+ descriptionTokenizer(spacing)
2653
+ ] } = {}) {
2654
+ if (startLine < 0 || startLine % 1 > 0)
2655
+ throw new Error("Invalid startLine");
2656
+ const parseSource = getParser2({ startLine, markers });
2657
+ const parseBlock = getParser({ fence });
2658
+ const parseSpec = getParser3({ tokenizers });
2659
+ const joinDescription = getJoiner2(spacing);
2660
+ return function(source) {
2661
+ const blocks = [];
2662
+ for (const line of splitLines(source)) {
2663
+ const lines = parseSource(line);
2664
+ if (lines === null)
2665
+ continue;
2666
+ const sections = parseBlock(lines);
2667
+ const specs = sections.slice(1).map(parseSpec);
2668
+ blocks.push({
2669
+ description: joinDescription(sections[0], markers),
2670
+ tags: specs,
2671
+ source: lines,
2672
+ problems: specs.reduce((acc, spec) => acc.concat(spec.problems), [])
2673
+ });
3118
2674
  }
3119
- if (obj2.title && (obj2.title.type || obj2.title.name || obj2.title.description)) {
3120
- setTitle3();
3121
- if (is) {
3122
- setDivision();
3123
- }
3124
- let type = (obj2.title.type || "div").split(".");
3125
- let c = type[1] || "";
3126
- if (type[0] == "html") {
3127
- doms.push(
3128
- h4("div", {
3129
- class: "test-top-title " + c,
3130
- innerHTML: obj2.title.name + " " + obj2.title.description
3131
- })
3132
- );
2675
+ return blocks;
2676
+ };
2677
+ }
2678
+
2679
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/stringifier/index.js
2680
+ function join3(tokens) {
2681
+ return tokens.start + tokens.delimiter + tokens.postDelimiter + tokens.tag + tokens.postTag + tokens.type + tokens.postType + tokens.name + tokens.postName + tokens.description + tokens.end + tokens.lineEnd;
2682
+ }
2683
+ function getStringifier() {
2684
+ return (block) => block.source.map(({ tokens }) => join3(tokens)).join("\n");
2685
+ }
2686
+
2687
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/stringifier/inspect.js
2688
+ var zeroWidth = {
2689
+ line: 0,
2690
+ start: 0,
2691
+ delimiter: 0,
2692
+ postDelimiter: 0,
2693
+ tag: 0,
2694
+ postTag: 0,
2695
+ name: 0,
2696
+ postName: 0,
2697
+ type: 0,
2698
+ postType: 0,
2699
+ description: 0,
2700
+ end: 0,
2701
+ lineEnd: 0
2702
+ };
2703
+ var fields = Object.keys(zeroWidth);
2704
+
2705
+ // node_modules/.pnpm/comment-parser@1.4.1/node_modules/comment-parser/es6/index.js
2706
+ function parse(source, options = {}) {
2707
+ return getParser4(options)(source);
2708
+ }
2709
+ var stringify = getStringifier();
2710
+
2711
+ // packages/utils/annotat.ts
2712
+ var notesObj = {
2713
+ titles: [],
2714
+ propss: [],
2715
+ slots: [],
2716
+ emitss: [],
2717
+ exposes: []
2718
+ };
2719
+ function init() {
2720
+ Object.keys(notesObj).forEach((key) => {
2721
+ notesObj[key] = [];
2722
+ });
2723
+ }
2724
+ function getDefault(ss, iss) {
2725
+ let char = ss.charAt(0);
2726
+ let css2 = [
2727
+ ['"', '"'],
2728
+ ["'", "'"],
2729
+ ["`", "`"],
2730
+ ["(", ")"],
2731
+ ["{", "}"],
2732
+ ["[", "]"]
2733
+ ];
2734
+ const cs = css2.map((o) => o[0]);
2735
+ let ci = cs.indexOf(char);
2736
+ if (ci != -1) {
2737
+ let bracketStack = [char];
2738
+ for (let i = 1; i < ss.length; i++) {
2739
+ char = ss[i];
2740
+ ci = cs.indexOf(char);
2741
+ if (ci != -1) {
2742
+ if (ci > 2) {
2743
+ bracketStack.push(char);
2744
+ } else {
2745
+ if (bracketStack[bracketStack.length - 1] === char) {
2746
+ bracketStack.pop();
2747
+ } else {
2748
+ bracketStack.push(char);
2749
+ }
2750
+ }
3133
2751
  } else {
3134
- doms.push(
3135
- h4(
3136
- type[0],
3137
- {
3138
- class: "test-top-title " + c
3139
- },
3140
- [
3141
- h4("span", {}, [
3142
- getValue(
3143
- obj2.title.name + " " + obj2.title.description
3144
- )
3145
- ])
3146
- ]
3147
- )
3148
- );
2752
+ let is = false;
2753
+ for (let v of css2) {
2754
+ if (char === v[1] && bracketStack[bracketStack.length - 1] === v[0]) {
2755
+ is = true;
2756
+ break;
2757
+ }
2758
+ }
2759
+ if (is) {
2760
+ bracketStack.pop();
2761
+ }
3149
2762
  }
3150
- }
3151
- if (is) {
3152
- if (list.length > 0) {
3153
- setTitle3();
3154
- setDivision();
2763
+ if (bracketStack.length === 0) {
2764
+ if (iss && ss[i + 1] === " ") {
2765
+ return ss.substring(0, i + 1);
2766
+ } else {
2767
+ return ss.substring(0, i + 1);
2768
+ }
3155
2769
  }
3156
- doms.push(
3157
- h4(
3158
- "div",
3159
- {
3160
- class: "test-top-info"
3161
- },
3162
- info
3163
- )
3164
- );
3165
2770
  }
3166
- if (obj2.html) {
3167
- let type = (obj2.html.type || "div").split(".");
3168
- let c = type[1] || "";
3169
- list.push(
3170
- h4(type[0], {
3171
- class: "test-top-html " + c,
3172
- innerHTML: obj2.html.name + " " + obj2.html.description
3173
- })
3174
- );
2771
+ } else {
2772
+ if (iss) {
2773
+ return ss.substring(0, ss.indexOf(" "));
2774
+ } else {
2775
+ return ss;
3175
2776
  }
3176
- ["text", "proposal", "error"].forEach((v) => {
3177
- if (obj2[v]) {
3178
- let type = (obj2[v].type || "div").split(".");
3179
- let c = type[1] || "";
3180
- if (type[0] == "html") {
3181
- list.push(
3182
- h4("div", {
3183
- class: "test-top-" + v + " " + c,
3184
- innerHTML: obj2[v].name + " " + obj2[v].description
3185
- })
3186
- );
2777
+ }
2778
+ }
2779
+ function getObj(v) {
2780
+ delete v.problems;
2781
+ delete v.source;
2782
+ let tag = v.tag;
2783
+ let name = v.name;
2784
+ let description = v.description;
2785
+ let defaults = v.default;
2786
+ let selectable = "";
2787
+ let required = "";
2788
+ if (tag == "default") {
2789
+ name = name.trim();
2790
+ name = getDefault(name) || name;
2791
+ } else if (tag == "selectable") {
2792
+ name = name.trim();
2793
+ } else {
2794
+ const i = v.name.indexOf("=");
2795
+ if (i != -1) {
2796
+ const ms1 = name.substring(0, i);
2797
+ const ms2 = name.substring(i + 1);
2798
+ name = ms1;
2799
+ const ss = ms2 + " " + description;
2800
+ const dvz = getDefault(ss, true);
2801
+ if (dvz) {
2802
+ description = ss.replace(dvz, "");
2803
+ if (dvz.startsWith("(")) {
2804
+ defaults = dvz.substring(1, dvz.length - 1);
3187
2805
  } else {
3188
- list.push(
3189
- h4(
3190
- type[0],
3191
- {
3192
- class: "test-top-" + v + " " + c
3193
- },
3194
- [
3195
- h4("span", {}, [
3196
- getValue(
3197
- obj2[v].name + " " + obj2[v].description
3198
- )
3199
- ])
3200
- ]
3201
- )
3202
- );
2806
+ defaults = dvz;
3203
2807
  }
2808
+ } else {
2809
+ defaults = v.default || ms2 || "";
3204
2810
  }
3205
- });
2811
+ }
2812
+ const regExp = /\s*\((.*)\)\s*/gi;
2813
+ const rtr = regExp.exec(description);
2814
+ if (rtr && rtr.length > 0) {
2815
+ selectable = rtr[1];
2816
+ description = description.replace(rtr[0], "");
2817
+ }
2818
+ }
2819
+ if (name.endsWith("*")) {
2820
+ required = "*";
2821
+ name = name.substring(0, name.length - 1);
2822
+ }
2823
+ v.name = name;
2824
+ v.required = required;
2825
+ v.default = defaults || "";
2826
+ v.description = description;
2827
+ v.selectable = selectable;
2828
+ return v;
2829
+ }
2830
+ function setTitle(obj2) {
2831
+ let title = "";
2832
+ let name = "";
2833
+ let author = "";
2834
+ let description = "";
2835
+ let date = "";
2836
+ let arr = [
2837
+ "title",
2838
+ // 'name',
2839
+ "text",
2840
+ "author",
2841
+ "date"
2842
+ // 'description',
2843
+ // 'descriptions',
2844
+ ];
2845
+ let fobj = getFilter(obj2, arr);
2846
+ let value = {};
2847
+ arr.forEach((key) => {
2848
+ value[key] = fobj.obj[key];
2849
+ });
2850
+ addTitles(value);
2851
+ fobj.arr.forEach((o) => {
2852
+ addTags(o.key, o.value);
2853
+ });
2854
+ }
2855
+ function addTitles(value) {
2856
+ notesObj.titles.push(value);
2857
+ }
2858
+ function setProps(obj2) {
2859
+ let name = "";
2860
+ let type = "";
2861
+ let defaults = "";
2862
+ let description = "";
2863
+ let selectable = "";
2864
+ let arr = [
2865
+ "props",
2866
+ "name",
2867
+ "type",
2868
+ "default",
2869
+ "required",
2870
+ "selectable",
2871
+ "description",
2872
+ "descriptions",
2873
+ "model",
2874
+ "return"
2875
+ ];
2876
+ let fobj = getFilter(obj2, arr);
2877
+ let value = {};
2878
+ arr.forEach((key) => {
2879
+ value[key] = fobj.obj[key];
2880
+ });
2881
+ addObj(value, "props");
2882
+ fobj.arr.forEach((o) => {
2883
+ addTags(o.key, o.value);
3206
2884
  });
3207
- setTitle3();
3208
- setDivision();
3209
- return domss;
3210
2885
  }
3211
- var top_default2 = (0, import_vue2.defineComponent)({
3212
- /**
3213
- * @props {Stinrg} value 插入数据
3214
- */
3215
- props: {
3216
- value: Array
3217
- },
3218
- render(propss, a, props2) {
3219
- const domss = getTestTopDom(props2.value, import_vue2.h);
3220
- if (domss && domss.length > 0) {
3221
- return (0, import_vue2.h)(
3222
- "div",
3223
- {
3224
- class: "test-top-top"
3225
- },
3226
- domss
3227
- );
3228
- }
3229
- return "";
3230
- }
3231
- });
3232
-
3233
- // node_modules/.pnpm/@fangzhongya+utils@0.0.73/node_modules/@fangzhongya/utils/dist/chunk-Q6BNW3MO.js
3234
- var FUNCTION_REGEX = /^\s*(?:(async)\s+)?(?:function\s*(\*?)\s*(\w*)\s*\(([\s\S]*?)\)|(\*?\s*)\b(\w+)\s*\(([\s\S]*?)\)|\(([\s\S]*?)\)|([^=>,\(\)]+?))\s*(?:=>)?\s*(?:\{([\s\S]*?)\}|([\s\S]*))$/;
3235
- function getFunctionFormat(v) {
3236
- if (!v) return;
3237
- const str = typeof v === "function" ? v.toString() : v;
3238
- const trimmed = str.trim();
3239
- const match = trimmed.match(FUNCTION_REGEX);
3240
- if (!match) {
3241
- console.warn("Unsupported function format:", trimmed.slice(0, 100));
3242
- return;
3243
- }
3244
- const [
3245
- _,
3246
- // 完整匹配
3247
- asyncFlag,
3248
- // 异步标志
3249
- funcGenerator,
3250
- // 函数生成器标志
3251
- funcName,
3252
- // 函数名称
3253
- funcParams,
3254
- // 函数参数
3255
- methodGenerator,
3256
- // 方法生成器标志
3257
- methodName,
3258
- // 方法名称
3259
- methodParams,
3260
- // 方法参数
3261
- arrowParenParams,
3262
- // 箭头函数括号参数
3263
- arrowSingleParam,
3264
- // 箭头函数单参数
3265
- blockBody,
3266
- // 块级函数体
3267
- exprBody
3268
- // 表达式函数体
3269
- ] = match;
3270
- let isAsync = !!asyncFlag;
3271
- let isGenerator = false;
2886
+ function setSlot(obj2) {
3272
2887
  let name = "";
3273
- let param = "";
3274
- let body = "";
3275
- let isArrow = false;
3276
- let arrowBody = "";
3277
- if (funcParams !== void 0) {
3278
- isGenerator = funcGenerator === "*";
3279
- name = funcName || "";
3280
- param = funcParams;
3281
- body = blockBody || exprBody || "";
3282
- } else if (methodParams !== void 0) {
3283
- isGenerator = methodGenerator?.includes("*") || false;
3284
- name = methodName || "";
3285
- param = methodParams;
3286
- body = blockBody || exprBody || "";
3287
- } else if (arrowParenParams !== void 0 || arrowSingleParam !== void 0) {
3288
- isArrow = true;
3289
- param = arrowParenParams || arrowSingleParam || "";
3290
- body = blockBody || exprBody || "";
3291
- arrowBody = body.trim();
3292
- if (!blockBody && !/^\s*return\b/.test(body)) {
3293
- body = `return ${body}`;
3294
- }
2888
+ let description = "";
2889
+ let selectable = "";
2890
+ let arr = ["slot", "name", "selectable", "description", "descriptions"];
2891
+ let fobj = getFilter(obj2, arr);
2892
+ let value = {};
2893
+ arr.forEach((key) => {
2894
+ value[key] = fobj.obj[key];
2895
+ });
2896
+ addObj(value, "slot");
2897
+ fobj.arr.forEach((o) => {
2898
+ addTags(o.key, o.value);
2899
+ });
2900
+ }
2901
+ function setEmits(obj2) {
2902
+ let arr = ["emits", "name", "selectable", "description", "descriptions"];
2903
+ let fobj = getFilter(obj2, arr);
2904
+ let value = {};
2905
+ arr.forEach((key) => {
2906
+ value[key] = fobj.obj[key];
2907
+ });
2908
+ addObj(value, "emits");
2909
+ fobj.arr.forEach((o) => {
2910
+ addTags(o.key, o.value);
2911
+ });
2912
+ }
2913
+ function setExpose(obj2) {
2914
+ let arr = [
2915
+ "expose",
2916
+ "name",
2917
+ "type",
2918
+ "return",
2919
+ "selectable",
2920
+ "description",
2921
+ "descriptions"
2922
+ ];
2923
+ let fobj = getFilter(obj2, arr);
2924
+ let value = {};
2925
+ arr.forEach((key) => {
2926
+ value[key] = fobj.obj[key];
2927
+ });
2928
+ addObj(value, "expose");
2929
+ fobj.arr.forEach((o) => {
2930
+ addTags(o.key, o.value);
2931
+ });
2932
+ }
2933
+ function addObj(value, type) {
2934
+ const ms = notesObj[type + "name"] || [];
2935
+ const name = value.name ?? value[type]?.name;
2936
+ const nis = ms.indexOf(name);
2937
+ if (nis >= 0) {
2938
+ notesObj[type + "s"].splice(nis, 1);
2939
+ ms.splice(nis, 1);
2940
+ }
2941
+ notesObj[type + "s"].push(value);
2942
+ ms.push(name);
2943
+ notesObj[type + "name"] = ms;
2944
+ }
2945
+ function getFilter(obj2, arrs) {
2946
+ const _objs = {
2947
+ descriptions: obj2?.description || ""
2948
+ };
2949
+ const arr = [];
2950
+ if (obj2?.tags) {
2951
+ obj2.tags?.forEach((v) => {
2952
+ let tag = v.tag;
2953
+ let ov = getObj(v);
2954
+ if (!_objs.hasOwnProperty(tag)) {
2955
+ _objs[tag] = ov;
2956
+ } else {
2957
+ const ao = {};
2958
+ ao[tag] = ov;
2959
+ arr.push({
2960
+ key: tag,
2961
+ value: ao
2962
+ });
2963
+ }
2964
+ });
3295
2965
  }
3296
2966
  return {
3297
- isArrow,
3298
- isAsync,
3299
- isGenerator,
3300
- ...name && { name },
3301
- param: param.trim(),
3302
- body: body.trim(),
3303
- arrowBody
2967
+ arr,
2968
+ obj: _objs
3304
2969
  };
3305
2970
  }
3306
-
3307
- // packages/components/use/util.ts
3308
- var getFormat2 = (r) => {
3309
- return r;
3310
- };
3311
- var isp = getConfig("prettier");
3312
- if (isp) {
3313
- Promise.resolve().then(() => (init_prettier(), prettier_exports)).then((d) => {
3314
- getFormat2 = d.getFormat;
3315
- });
3316
- }
3317
- function prettierHtml(st) {
3318
- if (isp) {
3319
- const v = getFormat2(st, "html");
3320
- return v;
2971
+ function addTags(tag, obj2) {
2972
+ switch (tag) {
2973
+ case "title":
2974
+ addTitles(obj2);
2975
+ return true;
2976
+ case "text":
2977
+ addTitles(obj2);
2978
+ return true;
2979
+ case "props":
2980
+ addObj(obj2, "props");
2981
+ return true;
2982
+ case "slot":
2983
+ addObj(obj2, "slot");
2984
+ return true;
2985
+ case "emits":
2986
+ addObj(obj2, "emits");
2987
+ return true;
2988
+ case "expose":
2989
+ addObj(obj2, "expose");
2990
+ return true;
2991
+ default:
2992
+ return false;
3321
2993
  }
3322
- return st;
3323
2994
  }
3324
- function prettierTs(st) {
3325
- if (isp) {
3326
- const v = getFormat2(st, "ts");
3327
- return v;
2995
+ function setTags(tag, obj2) {
2996
+ switch (tag) {
2997
+ case "title":
2998
+ setTitle(obj2);
2999
+ return true;
3000
+ case "props":
3001
+ setProps(obj2);
3002
+ return true;
3003
+ case "slot":
3004
+ setSlot(obj2);
3005
+ return true;
3006
+ case "emits":
3007
+ setEmits(obj2);
3008
+ return true;
3009
+ case "expose":
3010
+ setExpose(obj2);
3011
+ return true;
3012
+ default:
3013
+ return false;
3328
3014
  }
3329
- return st;
3330
3015
  }
3331
- function vueFormat(st, kg = "") {
3332
- let arr = (st + "").trim().split(/\n/);
3333
- arr = arr.map((v) => {
3334
- return kg + v;
3016
+ function notesFilter(notes) {
3017
+ init();
3018
+ notes?.forEach((obj2) => {
3019
+ let tags = obj2?.tags || [];
3020
+ let lg = tags?.length || 0;
3021
+ if (lg > 0) {
3022
+ for (let i = 0; i < lg; i++) {
3023
+ const v = tags[i] || {};
3024
+ let is = setTags(v.tag, obj2);
3025
+ if (is) {
3026
+ break;
3027
+ }
3028
+ }
3029
+ }
3335
3030
  });
3336
- return arr.join("\n");
3031
+ return JSON.parse(JSON.stringify(notesObj));
3337
3032
  }
3338
- function getFunBody(sr = "") {
3339
- sr = sr.trim();
3340
- let body = "[\\s|\\n|\\r]*\\{((.|\n|\r)+?)\\}[\\s|\\n|\\r]*";
3341
- let reg = new RegExp("^" + body + "$");
3342
- let vts = reg.exec(sr);
3343
- if (vts && vts.length > 0) {
3344
- return getFunBody(vts[1]);
3345
- } else {
3346
- return sr;
3033
+ function getTextNotes(text) {
3034
+ if (text) {
3035
+ return parse(text);
3347
3036
  }
3348
3037
  }
3038
+ function getNotesText(text) {
3039
+ let notes = getTextNotes(text);
3040
+ return notesFilter(notes);
3041
+ }
3349
3042
  var jctypes = [
3350
3043
  "Boolean",
3351
3044
  "Any",
@@ -3362,30 +3055,6 @@ function conversionType(type) {
3362
3055
  return type;
3363
3056
  }
3364
3057
  }
3365
- var splitIgnoringNesting = (str, delimiter) => {
3366
- let bracketStack = [];
3367
- let parts = [];
3368
- let current = "";
3369
- for (let i = 0; i < str.length; i++) {
3370
- const char = str[i];
3371
- if (char === "[" || char === "<" || char === "(") {
3372
- bracketStack.push(char);
3373
- current += char;
3374
- } else if (char === "]" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "(") {
3375
- bracketStack.pop();
3376
- current += char;
3377
- } else if (char === delimiter && bracketStack.length === 0) {
3378
- parts.push(current.trim());
3379
- current = "";
3380
- } else {
3381
- current += char;
3382
- }
3383
- }
3384
- if (current.trim() !== "") {
3385
- parts.push(current.trim());
3386
- }
3387
- return parts;
3388
- };
3389
3058
  var splitIgnoring = (str) => {
3390
3059
  let bracketStack = [];
3391
3060
  let isArr = false;
@@ -3420,878 +3089,1359 @@ var splitIgnoring = (str) => {
3420
3089
  };
3421
3090
  }
3422
3091
  }
3423
- return {
3424
- top: str,
3425
- type: ""
3426
- };
3427
- };
3428
- var parseTypeDefinition = (typeDef) => {
3429
- if (!typeDef) {
3430
- return ["any"];
3431
- } else if (typeDef.startsWith("[") && typeDef.endsWith("]") || typeDef.startsWith("(") && typeDef.endsWith(")")) {
3432
- const inner = typeDef.slice(1, -1).trim();
3433
- if (!inner) return ["any"];
3434
- const types = splitIgnoringNesting(inner, ",");
3435
- return types;
3436
- } else if (typeDef.startsWith("{") && typeDef.endsWith("}")) {
3437
- return ["Object"];
3438
- } else if (typeDef.startsWith("<") && typeDef.endsWith(">")) {
3439
- const inner = typeDef.slice(1, -1).trim();
3440
- if (!inner) return ["any"];
3441
- const types = splitIgnoringNesting(inner, "|");
3442
- return types;
3443
- } else {
3444
- const types = splitIgnoringNesting(typeDef, ",");
3445
- return types;
3092
+ return {
3093
+ top: str,
3094
+ type: ""
3095
+ };
3096
+ };
3097
+ var splitIgnoringNesting = (str, delimiter) => {
3098
+ let bracketStack = [];
3099
+ let parts = [];
3100
+ let current = "";
3101
+ for (let i = 0; i < str.length; i++) {
3102
+ const char = str[i];
3103
+ if (char === "[" || char === "<" || char === "(") {
3104
+ bracketStack.push(char);
3105
+ current += char;
3106
+ } else if (char === "]" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "(") {
3107
+ bracketStack.pop();
3108
+ current += char;
3109
+ } else if (char === delimiter && bracketStack.length === 0) {
3110
+ parts.push(current.trim());
3111
+ current = "";
3112
+ } else {
3113
+ current += char;
3114
+ }
3115
+ }
3116
+ if (current.trim() !== "") {
3117
+ parts.push(current.trim());
3118
+ }
3119
+ return parts;
3120
+ };
3121
+ function getTypeName(type) {
3122
+ let t = "";
3123
+ if (typeof type == "string") {
3124
+ t = type;
3125
+ } else {
3126
+ t = type.value;
3127
+ }
3128
+ return conversionType(t || "any");
3129
+ }
3130
+ function getDataTypeType(dataType) {
3131
+ const type = dataType[0] || "any";
3132
+ return getTypeName(type);
3133
+ }
3134
+ var parseTypeDefinition = (typeDef) => {
3135
+ if (!typeDef) {
3136
+ return ["any"];
3137
+ } else if (typeDef.startsWith("[") && typeDef.endsWith("]") || typeDef.startsWith("(") && typeDef.endsWith(")")) {
3138
+ const inner = typeDef.slice(1, -1).trim();
3139
+ if (!inner) return ["any"];
3140
+ const types = splitIgnoringNesting(inner, ",");
3141
+ return types;
3142
+ } else if (typeDef.startsWith("{") && typeDef.endsWith("}")) {
3143
+ return ["Object"];
3144
+ } else if (typeDef.startsWith("<") && typeDef.endsWith(">")) {
3145
+ const inner = typeDef.slice(1, -1).trim();
3146
+ if (!inner) return ["any"];
3147
+ const types = splitIgnoringNesting(inner, "|");
3148
+ return types;
3149
+ } else {
3150
+ const types = splitIgnoringNesting(typeDef, ",");
3151
+ return types;
3152
+ }
3153
+ };
3154
+ function getDataType(arr) {
3155
+ const value = [];
3156
+ arr.forEach((v) => {
3157
+ const ss = splitIgnoring(v);
3158
+ if (ss.type) {
3159
+ const dataType = parseTypeDefinition(ss.type);
3160
+ const children = getDataType(dataType);
3161
+ value.push({
3162
+ label: v,
3163
+ value: ss.top,
3164
+ children
3165
+ });
3166
+ } else {
3167
+ value.push(ss.top);
3168
+ }
3169
+ });
3170
+ return value;
3171
+ }
3172
+ function parseParamString(input) {
3173
+ const parts = splitIgnoringNesting(input, ",");
3174
+ return parts.map((trimmedPart) => {
3175
+ const label = trimmedPart.trim();
3176
+ const nameMatch = trimmedPart.match(/^([^:?]+)(\??):/);
3177
+ if (!nameMatch) return null;
3178
+ const name = nameMatch[1].trim();
3179
+ const must = !nameMatch[2];
3180
+ const typeDefStart = nameMatch[0].length;
3181
+ const typeDef = trimmedPart.substring(typeDefStart).trim();
3182
+ let bracketStack = [];
3183
+ let t = "";
3184
+ let description = "";
3185
+ for (let i = 0; i < typeDef.length; i++) {
3186
+ const char = typeDef[i];
3187
+ if (char === "[" || char === "<" || char === "(" || char === "{") {
3188
+ bracketStack.push(char);
3189
+ } else if (char === "]" && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack[bracketStack.length - 1] === "<" || char === "}" && bracketStack[bracketStack.length - 1] === "{" || char === ")" && bracketStack[bracketStack.length - 1] === "(") {
3190
+ bracketStack.pop();
3191
+ }
3192
+ if (bracketStack.length === 0 && i > 0) {
3193
+ if (i == 1 && char !== "]" && char !== ">" && char !== "}" && char !== ")") {
3194
+ t = "";
3195
+ description = typeDef.substring(0);
3196
+ } else {
3197
+ t = typeDef.substring(0, i + 1).trim();
3198
+ description = typeDef.substring(i + 1);
3199
+ }
3200
+ break;
3201
+ }
3202
+ }
3203
+ const dataType = parseTypeDefinition(t);
3204
+ const tarr = getDataType(dataType);
3205
+ return {
3206
+ name,
3207
+ prop: name,
3208
+ type: getDataTypeType(tarr),
3209
+ dataType: tarr,
3210
+ must,
3211
+ label,
3212
+ description
3213
+ };
3214
+ }).filter(Boolean);
3215
+ }
3216
+
3217
+ // packages/components/test/index.ts
3218
+ function getObj2(v) {
3219
+ delete v.problems;
3220
+ delete v.source;
3221
+ return v;
3222
+ }
3223
+ function getFilter2(obj2, keyArr) {
3224
+ const _objs = {
3225
+ descriptions: obj2?.description || ""
3226
+ };
3227
+ const arr = [];
3228
+ if (obj2?.tags) {
3229
+ obj2?.tags?.forEach((v, index) => {
3230
+ let tag = v.tag;
3231
+ let ov = getObj2(v);
3232
+ if (!_objs.hasOwnProperty(tag) && keyArr.includes(tag)) {
3233
+ _objs[tag] = ov;
3234
+ } else {
3235
+ let ao = {};
3236
+ ao[tag] = ov;
3237
+ arr.push({
3238
+ key: tag,
3239
+ value: ao
3240
+ });
3241
+ }
3242
+ });
3243
+ }
3244
+ return {
3245
+ arr,
3246
+ obj: _objs
3247
+ };
3248
+ }
3249
+ var titles = [];
3250
+ function setTitle2(obj2) {
3251
+ const arr = ["title", "author", "date"];
3252
+ const fobj = getFilter2(obj2, arr);
3253
+ const value = {};
3254
+ arr.forEach((key) => {
3255
+ value[key] = fobj.obj[key];
3256
+ });
3257
+ addTitle(value);
3258
+ fobj.arr.forEach((o) => {
3259
+ addTags2(o.key, o.value);
3260
+ });
3261
+ }
3262
+ var states = [];
3263
+ function setState(obj2) {
3264
+ const arr = ["state", "type"];
3265
+ const fobj = getFilter2(obj2, arr);
3266
+ const value = {};
3267
+ arr.forEach((key) => {
3268
+ value[key] = fobj.obj[key];
3269
+ });
3270
+ addState(value);
3271
+ fobj.arr.forEach((o) => {
3272
+ addTags2(o.key, o.value);
3273
+ });
3274
+ }
3275
+ function addTitle(value) {
3276
+ titles.push(value);
3277
+ }
3278
+ function addProposal(value) {
3279
+ titles.push(value);
3280
+ }
3281
+ function addError(value) {
3282
+ titles.push(value);
3283
+ }
3284
+ function addState(value) {
3285
+ states.push(value);
3286
+ }
3287
+ function addTags2(tag, obj2) {
3288
+ switch (tag) {
3289
+ case "title":
3290
+ addTitle(obj2);
3291
+ return true;
3292
+ case "proposal":
3293
+ addProposal(obj2);
3294
+ return true;
3295
+ case "error":
3296
+ addError(obj2);
3297
+ return true;
3298
+ case "state":
3299
+ addState(obj2);
3300
+ return true;
3301
+ case "text":
3302
+ addTitle(obj2);
3303
+ return true;
3304
+ case "html":
3305
+ addTitle(obj2);
3306
+ return true;
3307
+ default:
3308
+ return false;
3309
+ }
3310
+ }
3311
+ function setTags2(tag, obj2) {
3312
+ switch (tag) {
3313
+ case "title":
3314
+ setTitle2(obj2);
3315
+ return true;
3316
+ // case 'proposal':
3317
+ // setProposal(obj);
3318
+ // return true;
3319
+ // case 'error':
3320
+ // setError(obj);
3321
+ // return true;
3322
+ case "state":
3323
+ setState(obj2);
3324
+ return true;
3325
+ default:
3326
+ return false;
3446
3327
  }
3447
- };
3448
- function parseParamString(input) {
3449
- const parts = splitIgnoringNesting(input, ",");
3450
- return parts.map((trimmedPart) => {
3451
- const label = trimmedPart.trim();
3452
- const nameMatch = trimmedPart.match(/^([^:?]+)(\??):/);
3453
- if (!nameMatch) return null;
3454
- const name = nameMatch[1].trim();
3455
- const must = !nameMatch[2];
3456
- const typeDefStart = nameMatch[0].length;
3457
- const typeDef = trimmedPart.substring(typeDefStart).trim();
3458
- let bracketStack = [];
3459
- let t = "";
3460
- let description = "";
3461
- for (let i = 0; i < typeDef.length; i++) {
3462
- const char = typeDef[i];
3463
- if (char === "[" || char === "<" || char === "(" || char === "{") {
3464
- bracketStack.push(char);
3465
- } else if (char === "]" && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack[bracketStack.length - 1] === "<" || char === "}" && bracketStack[bracketStack.length - 1] === "{" || char === ")" && bracketStack[bracketStack.length - 1] === "(") {
3466
- bracketStack.pop();
3467
- }
3468
- if (bracketStack.length === 0 && i > 0) {
3469
- if (i == 1 && char !== "]" && char !== ">" && char !== "}" && char !== ")") {
3470
- t = "";
3471
- description = typeDef.substring(0);
3472
- } else {
3473
- t = typeDef.substring(0, i + 1).trim();
3474
- description = typeDef.substring(i + 1);
3475
- }
3476
- break;
3477
- }
3478
- }
3479
- const dataType = parseTypeDefinition(t);
3480
- const tarr = getDataType(dataType);
3481
- return {
3482
- name,
3483
- prop: name,
3484
- type: getDataTypeType(tarr),
3485
- dataType: tarr,
3486
- must,
3487
- label,
3488
- description
3489
- };
3490
- }).filter(Boolean);
3491
3328
  }
3492
- function setDataType(arr) {
3493
- const v = arr.map((v2) => {
3494
- if (typeof v2 == "string") {
3495
- if (v2.toLowerCase() === "array") {
3496
- return "Array<any>";
3497
- }
3498
- return v2;
3499
- } else {
3500
- if (v2.children && v2.children.length > 0) {
3501
- const vz = setDataType(v2.children);
3502
- return v2.value + "<" + vz + ">";
3503
- } else {
3504
- const z = v2.value;
3505
- if (z.toLowerCase() === "array") {
3506
- return "Array<any>";
3329
+ function getNotes(text) {
3330
+ titles = [];
3331
+ states = [];
3332
+ const notes = getTextNotes(text);
3333
+ notes?.forEach((obj2) => {
3334
+ let tags = obj2?.tags || [];
3335
+ let lg = tags?.length || 0;
3336
+ if (lg > 0) {
3337
+ for (let i = 0; i < lg; i++) {
3338
+ const v = tags[i] || {};
3339
+ let is = setTags2(v.tag, obj2);
3340
+ if (is) {
3341
+ break;
3507
3342
  }
3508
- return z;
3509
3343
  }
3510
3344
  }
3511
- }).join(" | ");
3512
- return v || "any";
3345
+ });
3346
+ return {
3347
+ titles,
3348
+ states
3349
+ };
3513
3350
  }
3514
- function getDataType(arr) {
3515
- const value = [];
3516
- arr.forEach((v) => {
3517
- const ss = splitIgnoring(v);
3518
- if (ss.type) {
3519
- const dataType = parseTypeDefinition(ss.type);
3520
- const children = getDataType(dataType);
3521
- value.push({
3522
- label: v,
3523
- value: ss.top,
3524
- children
3525
- });
3351
+
3352
+ // packages/components/compo/top.ts
3353
+ var import_vue = require("vue");
3354
+ function getTopDom(props2, h4, isZy) {
3355
+ let doms = [];
3356
+ let domss = [];
3357
+ let list = [];
3358
+ const getValue = (v) => {
3359
+ if (isZy) {
3360
+ return htmlEscape(v);
3526
3361
  } else {
3527
- value.push(ss.top);
3362
+ return v;
3528
3363
  }
3529
- });
3530
- return value;
3531
- }
3532
- function getTypeName(type) {
3533
- let t = "";
3534
- if (typeof type == "string") {
3535
- t = type;
3536
- } else {
3537
- t = type.value;
3538
- }
3539
- return conversionType(t || "any");
3540
- }
3541
- function getDataTypeType(dataType) {
3542
- const type = dataType[0] || "any";
3543
- return getTypeName(type);
3544
- }
3545
- function getTypeValue(arr) {
3546
- const dataType = arr[0];
3547
- let type = getDataTypeType(arr);
3548
- switch (type) {
3549
- case "string":
3550
- return '""';
3551
- case "boolean":
3552
- return "false";
3553
- case "number":
3554
- return "0";
3555
- case "array":
3556
- if (typeof dataType === "string") {
3557
- return `[]`;
3364
+ };
3365
+ const setTitle3 = () => {
3366
+ if (list.length > 0) {
3367
+ doms.push(
3368
+ h4(
3369
+ "div",
3370
+ {
3371
+ class: "compo-top-list"
3372
+ },
3373
+ list
3374
+ )
3375
+ );
3376
+ list = [];
3377
+ }
3378
+ };
3379
+ const setDivision = () => {
3380
+ if (doms.length > 0) {
3381
+ domss.push(
3382
+ h4(
3383
+ "div",
3384
+ {
3385
+ class: "compo-top-division"
3386
+ },
3387
+ doms
3388
+ )
3389
+ );
3390
+ doms = [];
3391
+ }
3392
+ };
3393
+ props2?.forEach((obj2) => {
3394
+ const info = [];
3395
+ let is = false;
3396
+ if (obj2.date) {
3397
+ is = true;
3398
+ info.push(
3399
+ h4(
3400
+ "div",
3401
+ {
3402
+ class: "compo-top-date"
3403
+ },
3404
+ [
3405
+ h4("span", {}, "\u66F4\u65B0\u65F6\u95F4\uFF1A"),
3406
+ h4("span", {}, [
3407
+ getValue(
3408
+ obj2.date.name + " " + obj2.date.description
3409
+ )
3410
+ ])
3411
+ ]
3412
+ )
3413
+ );
3414
+ }
3415
+ if (obj2.author) {
3416
+ is = true;
3417
+ info.push(
3418
+ h4(
3419
+ "div",
3420
+ {
3421
+ class: "compo-top-author"
3422
+ },
3423
+ [
3424
+ h4("span", {}, "\u4F5C\u8005\uFF1A"),
3425
+ h4("span", {}, [
3426
+ getValue(
3427
+ obj2.author.name + " " + obj2.author.description
3428
+ )
3429
+ ])
3430
+ ]
3431
+ )
3432
+ );
3433
+ }
3434
+ if (obj2.title && (obj2.title.type || obj2.title.name || obj2.title.description)) {
3435
+ setTitle3();
3436
+ if (is) {
3437
+ setDivision();
3438
+ }
3439
+ let type = (obj2.title.type || "div").split(".");
3440
+ let c = type[1] || "";
3441
+ if (type[0] == "html") {
3442
+ doms.push(
3443
+ h4("div", {
3444
+ class: "compo-top-title " + c,
3445
+ innerHTML: obj2.title.name + " " + obj2.title.description
3446
+ })
3447
+ );
3558
3448
  } else {
3559
- let st = dataType.children;
3560
- if (st && st.length > 0) {
3561
- let v = getTypeValue([st[0]]);
3562
- v = v == "undefined" ? "" : v;
3563
- return `[${v}]`;
3449
+ doms.push(
3450
+ h4(
3451
+ type[0],
3452
+ {
3453
+ class: "compo-top-title " + c
3454
+ },
3455
+ [
3456
+ h4("span", {}, [
3457
+ getValue(
3458
+ obj2.title.name + " " + obj2.title.description
3459
+ )
3460
+ ])
3461
+ ]
3462
+ )
3463
+ );
3464
+ }
3465
+ }
3466
+ if (is) {
3467
+ if (list.length > 0) {
3468
+ setTitle3();
3469
+ setDivision();
3470
+ }
3471
+ doms.push(
3472
+ h4(
3473
+ "div",
3474
+ {
3475
+ class: "compo-top-info"
3476
+ },
3477
+ info
3478
+ )
3479
+ );
3480
+ }
3481
+ if (obj2.html) {
3482
+ let type = (obj2.html.type || "div").split(".");
3483
+ let c = type[1] || "";
3484
+ list.push(
3485
+ h4(type[0], {
3486
+ class: "compo-top-html " + c,
3487
+ innerHTML: obj2.html.name + " " + obj2.html.description
3488
+ })
3489
+ );
3490
+ }
3491
+ ["text"].forEach((v) => {
3492
+ if (obj2[v]) {
3493
+ let type = (obj2[v].type || "div").split(".");
3494
+ let c = type[1] || "";
3495
+ if (type[0] == "html") {
3496
+ list.push(
3497
+ h4("div", {
3498
+ class: "compo-top-" + v + " " + c,
3499
+ innerHTML: obj2[v].name + " " + obj2[v].description
3500
+ })
3501
+ );
3564
3502
  } else {
3565
- return `[]`;
3503
+ list.push(
3504
+ h4(
3505
+ type[0],
3506
+ {
3507
+ class: "compo-top-" + v + " " + c
3508
+ },
3509
+ [
3510
+ h4("span", {}, [
3511
+ getValue(
3512
+ obj2[v].name + " " + obj2[v].description
3513
+ )
3514
+ ])
3515
+ ]
3516
+ )
3517
+ );
3566
3518
  }
3567
3519
  }
3568
- case "object":
3569
- return "{}";
3570
- case "function":
3571
- return "()=>{}";
3572
- case "any":
3573
- return '""';
3574
- default:
3575
- return "undefined";
3576
- }
3520
+ });
3521
+ });
3522
+ setTitle3();
3523
+ setDivision();
3524
+ return domss;
3577
3525
  }
3578
- var allReservedWords = [
3579
- // JavaScript 基本关键字
3580
- "break",
3581
- "case",
3582
- "catch",
3583
- "class",
3584
- "const",
3585
- "continue",
3586
- "debugger",
3587
- "default",
3588
- "delete",
3589
- "do",
3590
- "else",
3591
- "export",
3592
- "extends",
3593
- "finally",
3594
- "for",
3595
- "function",
3596
- "if",
3597
- "import",
3598
- "in",
3599
- "instanceof",
3600
- "new",
3601
- "return",
3602
- "super",
3603
- "switch",
3604
- "this",
3605
- "throw",
3606
- "try",
3607
- "typeof",
3608
- "var",
3609
- "void",
3610
- "while",
3611
- "with",
3612
- "yield",
3613
- // 严格模式下的保留字
3614
- "implements",
3615
- "interface",
3616
- "let",
3617
- "package",
3618
- "private",
3619
- "protected",
3620
- "public",
3621
- "static",
3622
- // 字面量值
3623
- "true",
3624
- "false",
3625
- "null",
3626
- "undefined",
3627
- // TypeScript 特有类型关键字
3628
- "any",
3629
- "boolean",
3630
- "number",
3631
- "string",
3632
- "object",
3633
- "symbol",
3634
- "unknown",
3635
- "never",
3636
- "void",
3637
- "undefined",
3638
- "null",
3639
- // TypeScript 类型操作与定义
3640
- "type",
3641
- "interface",
3642
- "enum",
3643
- "as",
3644
- "is",
3645
- "infer",
3646
- "unique",
3647
- // TypeScript 类修饰符
3648
- "abstract",
3649
- "readonly",
3650
- // TypeScript 模块与声明
3651
- "namespace",
3652
- "module",
3653
- "declare",
3654
- "require",
3655
- // 其他(访问器、未来保留字等)
3656
- "get",
3657
- "set",
3658
- "async",
3659
- "await",
3660
- "from",
3661
- "of",
3662
- "package"
3663
- ];
3526
+ var top_default = (0, import_vue.defineComponent)({
3527
+ /**
3528
+ * @props {Stinrg} value 插入数据
3529
+ */
3530
+ props: {
3531
+ value: Array
3532
+ },
3533
+ render(propss, a, props2) {
3534
+ const domss = getTopDom(props2.value, import_vue.h);
3535
+ return (0, import_vue.h)(
3536
+ "div",
3537
+ {
3538
+ class: "compo-top"
3539
+ },
3540
+ domss
3541
+ );
3542
+ }
3543
+ });
3664
3544
 
3665
- // packages/components/use/code.ts
3666
- function getSpecObjs(specs, name) {
3667
- return specs.filter((o) => o.name == name)[0];
3668
- }
3669
- function getParameStr(css2) {
3670
- return css2.map((o) => {
3671
- const name = o.prop || "...arr";
3672
- return name + ":" + setDataType(o.dataType);
3673
- }).join(",");
3674
- }
3675
- async function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
3676
- const tarr = [];
3677
- const sarr = [];
3678
- let is = true;
3679
- const ps = getPropsValue2(param.propss || []);
3680
- const es2 = getEmitsValue(param.emitss || []);
3681
- const res = getExposeValue(param.exposes || []);
3682
- const ss = getSlotValue(param.slots || []);
3683
- Object.keys(value).forEach(async (key) => {
3684
- let val = value[key];
3685
- if (/^on[A-Z]/.test(key) && typeof val == "function") {
3686
- let name = key.substring(2);
3687
- const knam = key.split(":");
3688
- let strs;
3689
- if (knam.length > 1) {
3690
- strs = knam[0] + knam.slice(1).map((o) => firstUpper(o)).join("");
3691
- name = firstLower(name);
3692
- } else {
3693
- strs = knam[0];
3694
- name = humpToLine(name);
3695
- }
3696
- if (knam.includes("-")) {
3697
- let arr = strs.split("-");
3698
- arr = arr.map((vs, i) => {
3699
- if (i != 0) {
3700
- return firstUpper(vs);
3701
- } else {
3702
- return vs;
3703
- }
3704
- });
3705
- strs = arr.join("");
3706
- }
3707
- tarr.push(" @" + name + '="' + strs + '"');
3708
- const sp = getSpecObjs(es2, name) || {};
3709
- const s = sp.selectable || "";
3710
- const css2 = parseParamString(s);
3711
- const cs = getParameStr(css2);
3712
- sarr.push(`// ${sp.description} ${sp.name}: (${sp.selectable})`);
3713
- sarr.push("function " + strs + "(" + cs + ") {");
3714
- css2.forEach((o) => {
3715
- const name2 = o.name || "arr";
3716
- sarr.push(" console.log('" + o.label + "', " + name2 + ")");
3717
- });
3718
- sarr.push("}");
3545
+ // packages/components/test/top.ts
3546
+ var import_vue2 = require("vue");
3547
+ function getTestTopDom(props2, h4, isZy) {
3548
+ let doms = [];
3549
+ let domss = [];
3550
+ let list = [];
3551
+ const getValue = (v) => {
3552
+ if (isZy) {
3553
+ return htmlEscape(v);
3719
3554
  } else {
3720
- let z = key;
3721
- if (allReservedWords.includes(key)) {
3722
- z = key + "1";
3723
- }
3724
- tarr.push(" :" + key + '="' + z + '"');
3725
- const sp = getSpecObjs(ps, key) || {};
3726
- const t = getSpecType(sp);
3727
- sarr.push(
3728
- `// ${sp.description} ${sp.name}: {${sp.type}} (${sp.selectable})`
3555
+ return v;
3556
+ }
3557
+ };
3558
+ const setTitle3 = () => {
3559
+ if (list.length > 0) {
3560
+ doms.push(
3561
+ h4(
3562
+ "div",
3563
+ {
3564
+ class: "test-top-list"
3565
+ },
3566
+ list
3567
+ )
3729
3568
  );
3730
- if (typeof val == "function" || t.dataType.length == 1 && t.type == "function" && val) {
3731
- sarr.push(
3732
- "const " + key + " = " + await getFunctionBody(
3733
- val,
3734
- key,
3735
- propsText
3736
- )
3569
+ list = [];
3570
+ }
3571
+ };
3572
+ const setDivision = () => {
3573
+ if (doms.length > 0) {
3574
+ domss.push(
3575
+ h4(
3576
+ "div",
3577
+ {
3578
+ class: "test-top-division"
3579
+ },
3580
+ doms
3581
+ )
3582
+ );
3583
+ doms = [];
3584
+ }
3585
+ };
3586
+ props2.forEach((obj2) => {
3587
+ const info = [];
3588
+ let is = false;
3589
+ if (obj2.date) {
3590
+ is = true;
3591
+ info.push(
3592
+ h4(
3593
+ "div",
3594
+ {
3595
+ class: "test-top-date"
3596
+ },
3597
+ [
3598
+ h4("span", {}, "\u66F4\u65B0\u65F6\u95F4\uFF1A"),
3599
+ h4("span", {}, [
3600
+ getValue(
3601
+ obj2.date.name + " " + obj2.date.description
3602
+ )
3603
+ ])
3604
+ ]
3605
+ )
3606
+ );
3607
+ }
3608
+ if (obj2.author) {
3609
+ is = true;
3610
+ info.push(
3611
+ h4(
3612
+ "div",
3613
+ {
3614
+ class: "test-top-author"
3615
+ },
3616
+ [
3617
+ h4("span", {}, "\u4F5C\u8005\uFF1A"),
3618
+ h4("span", {}, [
3619
+ getValue(
3620
+ obj2.author.name + " " + obj2.author.description
3621
+ )
3622
+ ])
3623
+ ]
3624
+ )
3625
+ );
3626
+ }
3627
+ if (obj2.title && (obj2.title.type || obj2.title.name || obj2.title.description)) {
3628
+ setTitle3();
3629
+ if (is) {
3630
+ setDivision();
3631
+ }
3632
+ let type = (obj2.title.type || "div").split(".");
3633
+ let c = type[1] || "";
3634
+ if (type[0] == "html") {
3635
+ doms.push(
3636
+ h4("div", {
3637
+ class: "test-top-title " + c,
3638
+ innerHTML: obj2.title.name + " " + obj2.title.description
3639
+ })
3737
3640
  );
3738
3641
  } else {
3739
- if (is) {
3740
- is = false;
3741
- sarr.unshift("import { ref } from 'vue';");
3742
- }
3743
- if (typeof val == "undefined") {
3744
- if (t.type == "function") {
3745
- const tv = getTypeValueFunction(sp);
3746
- sarr.push("const " + z + " = " + tv + ";");
3747
- } else {
3748
- const tv = getTypeValue(t.dataType);
3749
- sarr.push(
3750
- "const " + z + " = ref(" + (tv === "undefined" ? "" : tv) + ");"
3751
- );
3752
- }
3753
- } else {
3754
- let st2 = setValStringify(val, key, propsText);
3755
- sarr.push("const " + z + " = ref(" + st2 + ");");
3756
- }
3642
+ doms.push(
3643
+ h4(
3644
+ type[0],
3645
+ {
3646
+ class: "test-top-title " + c
3647
+ },
3648
+ [
3649
+ h4("span", {}, [
3650
+ getValue(
3651
+ obj2.title.name + " " + obj2.title.description
3652
+ )
3653
+ ])
3654
+ ]
3655
+ )
3656
+ );
3757
3657
  }
3758
3658
  }
3759
- });
3760
- const ev = Object.values(exposeText || {});
3761
- if (ev.length > 0) {
3762
3659
  if (is) {
3763
- is = false;
3764
- sarr.unshift("import { ref } from 'vue';");
3660
+ if (list.length > 0) {
3661
+ setTitle3();
3662
+ setDivision();
3663
+ }
3664
+ doms.push(
3665
+ h4(
3666
+ "div",
3667
+ {
3668
+ class: "test-top-info"
3669
+ },
3670
+ info
3671
+ )
3672
+ );
3765
3673
  }
3766
- tarr.unshift(' ref="refDom"');
3767
- sarr.push("const refDom = ref()");
3768
- ev.forEach((v) => {
3769
- const s = getSpecObjs(res, v.name) || {};
3770
- sarr.push(
3771
- `// ${s.description} ${s.name}\uFF1A(${s.selectable}) ${s.type}`
3674
+ if (obj2.html) {
3675
+ let type = (obj2.html.type || "div").split(".");
3676
+ let c = type[1] || "";
3677
+ list.push(
3678
+ h4(type[0], {
3679
+ class: "test-top-html " + c,
3680
+ innerHTML: obj2.html.name + " " + obj2.html.description
3681
+ })
3772
3682
  );
3773
- const m = v.name + "Value";
3774
- const css2 = parseParamString(s?.selectable || "");
3775
- const cs = [];
3776
- const ps2 = v.params || [];
3777
- css2.forEach((c, index) => {
3778
- const prop = c.name;
3779
- if (prop) {
3780
- const key = prop + v.name;
3781
- const val = ps2[index];
3782
- sarr.push(`// ${c.label}`);
3783
- if (typeof val == "function") {
3784
- sarr.push(
3785
- "const " + key + " = " + getFunctionBody(val, prop, v.text)
3786
- );
3787
- } else {
3788
- if (typeof val == "undefined") {
3789
- sarr.push(
3790
- "const " + key + " = " + getTypeValue(c.dataType) + ";"
3791
- );
3792
- } else {
3793
- let st2 = setValStringify(val, prop, v.text);
3794
- sarr.push("const " + key + " = " + st2 + ";");
3795
- }
3796
- }
3797
- cs.push(key);
3798
- }
3799
- });
3800
- if (v.type === "function") {
3801
- if (s.return) {
3802
- sarr.push(
3803
- `const ${m} = refDom.value?.${v.name}(${cs.join(
3804
- ", "
3805
- )})`
3683
+ }
3684
+ ["text", "proposal", "error"].forEach((v) => {
3685
+ if (obj2[v]) {
3686
+ let type = (obj2[v].type || "div").split(".");
3687
+ let c = type[1] || "";
3688
+ if (type[0] == "html") {
3689
+ list.push(
3690
+ h4("div", {
3691
+ class: "test-top-" + v + " " + c,
3692
+ innerHTML: obj2[v].name + " " + obj2[v].description
3693
+ })
3806
3694
  );
3807
3695
  } else {
3808
- sarr.push(`refDom.value?.${v.name}(${cs.join(", ")})`);
3809
- }
3810
- if (s.return) {
3811
- sarr.push(`console.log('${s.return}', ${m})`);
3696
+ list.push(
3697
+ h4(
3698
+ type[0],
3699
+ {
3700
+ class: "test-top-" + v + " " + c
3701
+ },
3702
+ [
3703
+ h4("span", {}, [
3704
+ getValue(
3705
+ obj2[v].name + " " + obj2[v].description
3706
+ )
3707
+ ])
3708
+ ]
3709
+ )
3710
+ );
3812
3711
  }
3813
- } else {
3814
- sarr.push(`const ${m} = refDom.value?.${v.name}`);
3815
- sarr.push(`console.log('${s.type || s.name}', ${m})`);
3816
3712
  }
3817
- });
3818
- }
3819
- if (tarr.length > 0) {
3820
- tarr.unshift("");
3821
- }
3822
- const slots = getSlots(slotValue, ss);
3823
- let template = `<template>
3824
- <div>
3825
- <${propsname}${tarr.join("\n")}>${slots.join("\n")}
3826
- </${propsname}>
3827
- </div>
3828
- </template>`;
3829
- template = await prettierHtml(template);
3830
- let js2 = sarr.join("\n");
3831
- js2 = await prettierTs(js2);
3832
- const st = `<!--${propsname}-->
3833
- ${template}
3834
- <script lang="ts" setup>
3835
- ${js2}
3836
- </script>`;
3837
- return st;
3713
+ });
3714
+ });
3715
+ setTitle3();
3716
+ setDivision();
3717
+ return domss;
3838
3718
  }
3839
- function getSlots(obj2 = {}, ss) {
3840
- const arr = [];
3841
- Object.keys(obj2).forEach((key) => {
3842
- const sp = getSpecObjs(ss, key) || {};
3843
- const v = obj2[key];
3844
- if (v) {
3845
- const st = ` <!-- ${sp.description} ${sp.name}\uFF1A(${sp.selectable}) -->
3846
- <template #${key}="scope">
3847
- ${vueFormat(v, " ")}
3848
- </template>`;
3849
- arr.push(st);
3719
+ var top_default2 = (0, import_vue2.defineComponent)({
3720
+ /**
3721
+ * @props {Stinrg} value 插入数据
3722
+ */
3723
+ props: {
3724
+ value: Array
3725
+ },
3726
+ render(propss, a, props2) {
3727
+ const domss = getTestTopDom(props2.value, import_vue2.h);
3728
+ if (domss && domss.length > 0) {
3729
+ return (0, import_vue2.h)(
3730
+ "div",
3731
+ {
3732
+ class: "test-top-top"
3733
+ },
3734
+ domss
3735
+ );
3850
3736
  }
3851
- });
3852
- if (arr && arr.length > 0) {
3853
- arr.unshift("");
3737
+ return "";
3854
3738
  }
3855
- return arr;
3856
- }
3857
- function getFunctionBody(v, key, propsText) {
3858
- const text = propsText ? propsText[key] : "";
3859
- if (text) {
3860
- if (text.includes("=>")) {
3861
- return text;
3862
- } else if (text.includes("function")) {
3863
- return text;
3864
- } else {
3865
- return funstr(v.toString());
3739
+ });
3740
+
3741
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.73/node_modules/@fangzhongya/utils/dist/chunk-Q6BNW3MO.js
3742
+ var FUNCTION_REGEX = /^\s*(?:(async)\s+)?(?:function\s*(\*?)\s*(\w*)\s*\(([\s\S]*?)\)|(\*?\s*)\b(\w+)\s*\(([\s\S]*?)\)|\(([\s\S]*?)\)|([^=>,\(\)]+?))\s*(?:=>)?\s*(?:\{([\s\S]*?)\}|([\s\S]*))$/;
3743
+ function getFunctionFormat(v) {
3744
+ if (!v) return;
3745
+ const str = typeof v === "function" ? v.toString() : v;
3746
+ const trimmed = str.trim();
3747
+ const match = trimmed.match(FUNCTION_REGEX);
3748
+ if (!match) {
3749
+ console.warn("Unsupported function format:", trimmed.slice(0, 100));
3750
+ return;
3751
+ }
3752
+ const [
3753
+ _,
3754
+ // 完整匹配
3755
+ asyncFlag,
3756
+ // 异步标志
3757
+ funcGenerator,
3758
+ // 函数生成器标志
3759
+ funcName,
3760
+ // 函数名称
3761
+ funcParams,
3762
+ // 函数参数
3763
+ methodGenerator,
3764
+ // 方法生成器标志
3765
+ methodName,
3766
+ // 方法名称
3767
+ methodParams,
3768
+ // 方法参数
3769
+ arrowParenParams,
3770
+ // 箭头函数括号参数
3771
+ arrowSingleParam,
3772
+ // 箭头函数单参数
3773
+ blockBody,
3774
+ // 块级函数体
3775
+ exprBody
3776
+ // 表达式函数体
3777
+ ] = match;
3778
+ let isAsync = !!asyncFlag;
3779
+ let isGenerator = false;
3780
+ let name = "";
3781
+ let param = "";
3782
+ let body = "";
3783
+ let isArrow = false;
3784
+ let arrowBody = "";
3785
+ if (funcParams !== void 0) {
3786
+ isGenerator = funcGenerator === "*";
3787
+ name = funcName || "";
3788
+ param = funcParams;
3789
+ body = blockBody || exprBody || "";
3790
+ } else if (methodParams !== void 0) {
3791
+ isGenerator = methodGenerator?.includes("*") || false;
3792
+ name = methodName || "";
3793
+ param = methodParams;
3794
+ body = blockBody || exprBody || "";
3795
+ } else if (arrowParenParams !== void 0 || arrowSingleParam !== void 0) {
3796
+ isArrow = true;
3797
+ param = arrowParenParams || arrowSingleParam || "";
3798
+ body = blockBody || exprBody || "";
3799
+ arrowBody = body.trim();
3800
+ if (!blockBody && !/^\s*return\b/.test(body)) {
3801
+ body = `return ${body}`;
3866
3802
  }
3867
- } else {
3868
- return funstr(v.toString());
3869
3803
  }
3804
+ return {
3805
+ isArrow,
3806
+ isAsync,
3807
+ isGenerator,
3808
+ ...name && { name },
3809
+ param: param.trim(),
3810
+ body: body.trim(),
3811
+ arrowBody
3812
+ };
3870
3813
  }
3871
- async function funstr(v) {
3872
- const st = getFunctionFormat(v);
3873
- if (st) {
3874
- let body = `{
3875
- ${vueFormat(getFunBody(st.body), " ")}
3876
- }`;
3877
- return `function (${st.param.split(",").map((v2) => v2 + ":any").join(",")}) ${body}`;
3878
- } else {
3879
- return "undefined";
3814
+
3815
+ // packages/components/use/util.ts
3816
+ var getFormat2 = (r) => {
3817
+ return r;
3818
+ };
3819
+ var isp = getConfig("prettier");
3820
+ if (isp) {
3821
+ Promise.resolve().then(() => (init_prettier(), prettier_exports)).then((d) => {
3822
+ getFormat2 = d.getFormat;
3823
+ });
3824
+ }
3825
+ function prettierHtml(st) {
3826
+ if (isp) {
3827
+ const v = getFormat2(st, "html");
3828
+ return v;
3880
3829
  }
3830
+ return st;
3881
3831
  }
3882
- function getTypeValueFunction(sp) {
3883
- const css2 = parseParamString(sp.selectable);
3884
- const cs = getParameStr(css2);
3885
- let rs = "";
3886
- if (sp.return) {
3887
- rs = "return ";
3832
+ function prettierTs(st) {
3833
+ if (isp) {
3834
+ const v = getFormat2(st, "ts");
3835
+ return v;
3888
3836
  }
3889
- let body = `{
3890
- ${vueFormat(getFunBody(rs), " ")}
3891
- }`;
3892
- return `function (${cs}) ${body}`;
3837
+ return st;
3893
3838
  }
3894
- function getChange(str) {
3895
- const tr = str.trim();
3896
- if (/^\(/.test(tr)) {
3897
- return funstr(tr);
3839
+ function vueFormat(st, kg = "") {
3840
+ let arr = (st + "").trim().split(/\n/);
3841
+ arr = arr.map((v) => {
3842
+ return kg + v;
3843
+ });
3844
+ return arr.join("\n");
3845
+ }
3846
+ function getFunBody(sr = "") {
3847
+ sr = sr.trim();
3848
+ let body = "[\\s|\\n|\\r]*\\{((.|\n|\r)+?)\\}[\\s|\\n|\\r]*";
3849
+ let reg = new RegExp("^" + body + "$");
3850
+ let vts = reg.exec(sr);
3851
+ if (vts && vts.length > 0) {
3852
+ return getFunBody(vts[1]);
3898
3853
  } else {
3899
- return JSON.stringify(str);
3854
+ return sr;
3900
3855
  }
3901
3856
  }
3902
- function setValStringify(v, key, propsText) {
3903
- const text = propsText ? propsText[key] : "";
3904
- if (text) {
3905
- return text;
3857
+ var jctypes2 = [
3858
+ "Boolean",
3859
+ "Any",
3860
+ "String",
3861
+ "Number",
3862
+ "Array",
3863
+ "Object",
3864
+ "Function"
3865
+ ];
3866
+ function conversionType2(type) {
3867
+ if (jctypes2.includes(type)) {
3868
+ return firstLower(type);
3906
3869
  } else {
3907
- if (typeof v == "string") {
3908
- return getChange(v + "");
3870
+ return type;
3871
+ }
3872
+ }
3873
+ var splitIgnoringNesting2 = (str, delimiter) => {
3874
+ let bracketStack = [];
3875
+ let parts = [];
3876
+ let current = "";
3877
+ for (let i = 0; i < str.length; i++) {
3878
+ const char = str[i];
3879
+ if (char === "[" || char === "<" || char === "(") {
3880
+ bracketStack.push(char);
3881
+ current += char;
3882
+ } else if (char === "]" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack.length > 0 && bracketStack[bracketStack.length - 1] === "(") {
3883
+ bracketStack.pop();
3884
+ current += char;
3885
+ } else if (char === delimiter && bracketStack.length === 0) {
3886
+ parts.push(current.trim());
3887
+ current = "";
3909
3888
  } else {
3910
- return JSON.stringify(v);
3889
+ current += char;
3911
3890
  }
3912
3891
  }
3913
- }
3914
- function getSpecType(val) {
3915
- let tarr = getDataType(parseTypeDefinition(val?.type));
3916
- let type = getDataTypeType(tarr);
3917
- if (tarr.length > 1) {
3918
- type = "any";
3892
+ if (current.trim() !== "") {
3893
+ parts.push(current.trim());
3919
3894
  }
3920
- let selectable = (val?.selectable || "").trim();
3921
- let arr = [];
3922
- if (selectable && type != "boolean") {
3923
- if (selectable.includes("|")) {
3924
- selectable.split("|").forEach((v) => {
3925
- if (v) {
3926
- let z = v.split(":");
3927
- arr.push({
3928
- label: v,
3929
- prop: getObjValue(z[0].trim())
3930
- });
3931
- }
3932
- });
3933
- } else {
3934
- arr = parseParamString(selectable);
3895
+ return parts;
3896
+ };
3897
+ var splitIgnoring2 = (str) => {
3898
+ let bracketStack = [];
3899
+ let isArr = false;
3900
+ let is = false;
3901
+ let top = 0;
3902
+ for (let i = 0; i < str.length; i++) {
3903
+ const char = str[i];
3904
+ if (char === "[" || char === "<" || char === "(") {
3905
+ is = true;
3906
+ bracketStack.push(char);
3907
+ if (char == "[") {
3908
+ isArr = true;
3909
+ }
3910
+ if (top == 0) {
3911
+ top = i;
3912
+ }
3913
+ } else if (char === "]" && bracketStack[bracketStack.length - 1] === "[" || char === ">" && bracketStack[bracketStack.length - 1] === "<" || char === ")" && bracketStack[bracketStack.length - 1] === "(") {
3914
+ bracketStack.pop();
3935
3915
  }
3936
- if (type == "array") {
3937
- type = "choice";
3938
- } else {
3939
- if (type != "function" && arr.length > 1) {
3940
- type = "select";
3916
+ if (is && bracketStack.length === 0) {
3917
+ if (isArr) {
3918
+ if (top + 1 == i) {
3919
+ return {
3920
+ top: "Array",
3921
+ type: str.substring(0, top)
3922
+ };
3923
+ }
3941
3924
  }
3925
+ return {
3926
+ top: str.substring(0, top),
3927
+ type: str.substring(top + 1, i)
3928
+ };
3942
3929
  }
3943
3930
  }
3944
3931
  return {
3945
- arr,
3946
- type,
3947
- dataType: tarr
3932
+ top: str,
3933
+ type: ""
3948
3934
  };
3949
- }
3950
- function getObjValue(d, type) {
3951
- try {
3952
- if (type == "function") {
3953
- if (typeof d === "string") {
3954
- if (/^\((.|\n|\r)*\)$/.test(d)) {
3955
- d = d.substring(1, d.length - 1);
3956
- return new Function(`{ return ${d} }`)();
3957
- }
3935
+ };
3936
+ var parseTypeDefinition2 = (typeDef) => {
3937
+ if (!typeDef) {
3938
+ return ["any"];
3939
+ } else if (typeDef.startsWith("[") && typeDef.endsWith("]") || typeDef.startsWith("(") && typeDef.endsWith(")")) {
3940
+ const inner = typeDef.slice(1, -1).trim();
3941
+ if (!inner) return ["any"];
3942
+ const types = splitIgnoringNesting2(inner, ",");
3943
+ return types;
3944
+ } else if (typeDef.startsWith("{") && typeDef.endsWith("}")) {
3945
+ return ["Object"];
3946
+ } else if (typeDef.startsWith("<") && typeDef.endsWith(">")) {
3947
+ const inner = typeDef.slice(1, -1).trim();
3948
+ if (!inner) return ["any"];
3949
+ const types = splitIgnoringNesting2(inner, "|");
3950
+ return types;
3951
+ } else {
3952
+ const types = splitIgnoringNesting2(typeDef, ",");
3953
+ return types;
3954
+ }
3955
+ };
3956
+ function setDataType(arr) {
3957
+ const v = arr.map((v2) => {
3958
+ if (typeof v2 == "string") {
3959
+ if (v2.toLowerCase() === "array") {
3960
+ return "Array<any>";
3961
+ }
3962
+ return v2;
3963
+ } else {
3964
+ if (v2.children && v2.children.length > 0) {
3965
+ const vz = setDataType(v2.children);
3966
+ return v2.value + "<" + vz + ">";
3958
3967
  } else {
3959
- return d;
3968
+ const z = v2.value;
3969
+ if (z.toLowerCase() === "array") {
3970
+ return "Array<any>";
3971
+ }
3972
+ return z;
3960
3973
  }
3974
+ }
3975
+ }).join(" | ");
3976
+ return v || "any";
3977
+ }
3978
+ function getDataType2(arr) {
3979
+ const value = [];
3980
+ arr.forEach((v) => {
3981
+ const ss = splitIgnoring2(v);
3982
+ if (ss.type) {
3983
+ const dataType = parseTypeDefinition2(ss.type);
3984
+ const children = getDataType2(dataType);
3985
+ value.push({
3986
+ label: v,
3987
+ value: ss.top,
3988
+ children
3989
+ });
3961
3990
  } else {
3962
- return new Function(`{ return ${d} }`)();
3991
+ value.push(ss.top);
3963
3992
  }
3964
- } catch (error) {
3965
- return "" + d;
3966
- }
3993
+ });
3994
+ return value;
3967
3995
  }
3968
- function getDefaultValue(obj2, is = true) {
3969
- const vo = getSpecType(obj2);
3970
- const v = getTypeValue(vo.dataType);
3971
- if (is) {
3972
- const d = (obj2.default || "").trim();
3973
- return getObjValue(d || v, getDataTypeType(vo.dataType));
3996
+ function getTypeName2(type) {
3997
+ let t = "";
3998
+ if (typeof type == "string") {
3999
+ t = type;
3974
4000
  } else {
3975
- const d = (obj2.default || "").trim();
3976
- return getObjValue(d, getDataTypeType(vo.dataType));
4001
+ t = type.value;
3977
4002
  }
4003
+ return conversionType2(t || "any");
3978
4004
  }
3979
-
3980
- // packages/components/compo/index.ts
3981
- var notesObj = {
3982
- titles: [],
3983
- propss: [],
3984
- slots: [],
3985
- emitss: [],
3986
- exposes: []
3987
- };
3988
- function getDefault(ss, iss) {
3989
- let char = ss.charAt(0);
3990
- let css2 = [
3991
- ['"', '"'],
3992
- ["'", "'"],
3993
- ["`", "`"],
3994
- ["(", ")"],
3995
- ["{", "}"],
3996
- ["[", "]"]
3997
- ];
3998
- const cs = css2.map((o) => o[0]);
3999
- let ci = cs.indexOf(char);
4000
- if (ci != -1) {
4001
- let bracketStack = [char];
4002
- for (let i = 1; i < ss.length; i++) {
4003
- char = ss[i];
4004
- ci = cs.indexOf(char);
4005
- if (ci != -1) {
4006
- if (ci > 2) {
4007
- bracketStack.push(char);
4005
+ function getDataTypeType2(dataType) {
4006
+ const type = dataType[0] || "any";
4007
+ return getTypeName2(type);
4008
+ }
4009
+ function getTypeValue(arr) {
4010
+ const dataType = arr[0];
4011
+ let type = getDataTypeType2(arr);
4012
+ switch (type) {
4013
+ case "string":
4014
+ return '""';
4015
+ case "boolean":
4016
+ return "false";
4017
+ case "number":
4018
+ return "0";
4019
+ case "array":
4020
+ if (typeof dataType === "string") {
4021
+ return `[]`;
4022
+ } else {
4023
+ let st = dataType.children;
4024
+ if (st && st.length > 0) {
4025
+ let v = getTypeValue([st[0]]);
4026
+ v = v == "undefined" ? "" : v;
4027
+ return `[${v}]`;
4008
4028
  } else {
4009
- if (bracketStack[bracketStack.length - 1] === char) {
4010
- bracketStack.pop();
4029
+ return `[]`;
4030
+ }
4031
+ }
4032
+ case "object":
4033
+ return "{}";
4034
+ case "function":
4035
+ return "()=>{}";
4036
+ case "any":
4037
+ return '""';
4038
+ default:
4039
+ return "undefined";
4040
+ }
4041
+ }
4042
+ var allReservedWords = [
4043
+ // JavaScript 基本关键字
4044
+ "break",
4045
+ "case",
4046
+ "catch",
4047
+ "class",
4048
+ "const",
4049
+ "continue",
4050
+ "debugger",
4051
+ "default",
4052
+ "delete",
4053
+ "do",
4054
+ "else",
4055
+ "export",
4056
+ "extends",
4057
+ "finally",
4058
+ "for",
4059
+ "function",
4060
+ "if",
4061
+ "import",
4062
+ "in",
4063
+ "instanceof",
4064
+ "new",
4065
+ "return",
4066
+ "super",
4067
+ "switch",
4068
+ "this",
4069
+ "throw",
4070
+ "try",
4071
+ "typeof",
4072
+ "var",
4073
+ "void",
4074
+ "while",
4075
+ "with",
4076
+ "yield",
4077
+ // 严格模式下的保留字
4078
+ "implements",
4079
+ "interface",
4080
+ "let",
4081
+ "package",
4082
+ "private",
4083
+ "protected",
4084
+ "public",
4085
+ "static",
4086
+ // 字面量值
4087
+ "true",
4088
+ "false",
4089
+ "null",
4090
+ "undefined",
4091
+ // TypeScript 特有类型关键字
4092
+ "any",
4093
+ "boolean",
4094
+ "number",
4095
+ "string",
4096
+ "object",
4097
+ "symbol",
4098
+ "unknown",
4099
+ "never",
4100
+ "void",
4101
+ "undefined",
4102
+ "null",
4103
+ // TypeScript 类型操作与定义
4104
+ "type",
4105
+ "interface",
4106
+ "enum",
4107
+ "as",
4108
+ "is",
4109
+ "infer",
4110
+ "unique",
4111
+ // TypeScript 类修饰符
4112
+ "abstract",
4113
+ "readonly",
4114
+ // TypeScript 模块与声明
4115
+ "namespace",
4116
+ "module",
4117
+ "declare",
4118
+ "require",
4119
+ // 其他(访问器、未来保留字等)
4120
+ "get",
4121
+ "set",
4122
+ "async",
4123
+ "await",
4124
+ "from",
4125
+ "of",
4126
+ "package"
4127
+ ];
4128
+
4129
+ // packages/components/use/code.ts
4130
+ function getSpecObjs(specs, name) {
4131
+ return specs.filter((o) => o.name == name)[0];
4132
+ }
4133
+ function getParameStr(css2) {
4134
+ return css2.map((o) => {
4135
+ const name = o.prop || "...arr";
4136
+ return name + ":" + setDataType(o.dataType);
4137
+ }).join(",");
4138
+ }
4139
+ async function getHmtl(propsname, param, value, slotValue, propsText, exposeText) {
4140
+ const tarr = [];
4141
+ const sarr = [];
4142
+ let is = true;
4143
+ const ps = getPropsValue2(param.propss || []);
4144
+ const es2 = getEmitsValue(param.emitss || []);
4145
+ const res = getExposeValue(param.exposes || []);
4146
+ const ss = getSlotValue(param.slots || []);
4147
+ Object.keys(value).forEach(async (key) => {
4148
+ let val = value[key];
4149
+ if (/^on[A-Z]/.test(key) && typeof val == "function") {
4150
+ let name = key.substring(2);
4151
+ const knam = key.split(":");
4152
+ let strs;
4153
+ if (knam.length > 1) {
4154
+ strs = knam[0] + knam.slice(1).map((o) => firstUpper(o)).join("");
4155
+ name = firstLower(name);
4156
+ } else {
4157
+ strs = knam[0];
4158
+ name = humpToLine(name);
4159
+ }
4160
+ if (knam.includes("-")) {
4161
+ let arr = strs.split("-");
4162
+ arr = arr.map((vs, i) => {
4163
+ if (i != 0) {
4164
+ return firstUpper(vs);
4011
4165
  } else {
4012
- bracketStack.push(char);
4166
+ return vs;
4013
4167
  }
4014
- }
4168
+ });
4169
+ strs = arr.join("");
4170
+ }
4171
+ tarr.push(" @" + name + '="' + strs + '"');
4172
+ const sp = getSpecObjs(es2, name) || {};
4173
+ const s = sp.selectable || "";
4174
+ const css2 = parseParamString(s);
4175
+ const cs = getParameStr(css2);
4176
+ sarr.push(`// ${sp.description} ${sp.name}: (${sp.selectable})`);
4177
+ sarr.push("function " + strs + "(" + cs + ") {");
4178
+ css2.forEach((o) => {
4179
+ const name2 = o.name || "arr";
4180
+ sarr.push(" console.log('" + o.label + "', " + name2 + ")");
4181
+ });
4182
+ sarr.push("}");
4183
+ } else {
4184
+ let z = key;
4185
+ if (allReservedWords.includes(key)) {
4186
+ z = key + "1";
4187
+ }
4188
+ tarr.push(" :" + key + '="' + z + '"');
4189
+ const sp = getSpecObjs(ps, key) || {};
4190
+ const t = getSpecType(sp);
4191
+ sarr.push(
4192
+ `// ${sp.description} ${sp.name}: {${sp.type}} (${sp.selectable})`
4193
+ );
4194
+ if (typeof val == "function" || t.dataType.length == 1 && t.type == "function" && val) {
4195
+ sarr.push(
4196
+ "const " + key + " = " + await getFunctionBody(
4197
+ val,
4198
+ key,
4199
+ propsText
4200
+ )
4201
+ );
4015
4202
  } else {
4016
- let is = false;
4017
- for (let v of css2) {
4018
- if (char === v[1] && bracketStack[bracketStack.length - 1] === v[0]) {
4019
- is = true;
4020
- break;
4021
- }
4022
- }
4023
4203
  if (is) {
4024
- bracketStack.pop();
4204
+ is = false;
4205
+ sarr.unshift("import { ref } from 'vue';");
4025
4206
  }
4026
- }
4027
- if (bracketStack.length === 0) {
4028
- if (iss && ss[i + 1] === " ") {
4029
- return ss.substring(0, i + 1);
4207
+ if (typeof val == "undefined") {
4208
+ if (t.type == "function") {
4209
+ const tv = getTypeValueFunction(sp);
4210
+ sarr.push("const " + z + " = " + tv + ";");
4211
+ } else {
4212
+ const tv = getTypeValue(t.dataType);
4213
+ sarr.push(
4214
+ "const " + z + " = ref(" + (tv === "undefined" ? "" : tv) + ");"
4215
+ );
4216
+ }
4030
4217
  } else {
4031
- return ss.substring(0, i + 1);
4218
+ let st2 = setValStringify(val, key, propsText);
4219
+ sarr.push("const " + z + " = ref(" + st2 + ");");
4032
4220
  }
4033
4221
  }
4034
4222
  }
4035
- } else {
4036
- if (iss) {
4037
- return ss.substring(0, ss.indexOf(" "));
4038
- } else {
4039
- return ss;
4223
+ });
4224
+ const ev = Object.values(exposeText || {});
4225
+ if (ev.length > 0) {
4226
+ if (is) {
4227
+ is = false;
4228
+ sarr.unshift("import { ref } from 'vue';");
4040
4229
  }
4041
- }
4042
- }
4043
- function getObj2(v) {
4044
- delete v.problems;
4045
- delete v.source;
4046
- let tag = v.tag;
4047
- let name = v.name;
4048
- let description = v.description;
4049
- let defaults = v.default;
4050
- let selectable = "";
4051
- let required = "";
4052
- if (tag == "default") {
4053
- name = name.trim();
4054
- name = getDefault(name) || name;
4055
- } else if (tag == "selectable") {
4056
- name = name.trim();
4057
- } else {
4058
- if (name.includes("=")) {
4059
- const ms = name.split("=");
4060
- name = ms[0];
4061
- const ss = ms[1] + " " + description;
4062
- const dvz = getDefault(ss, true);
4063
- if (dvz) {
4064
- defaults = dvz;
4065
- description = ss.replace(dvz, "");
4230
+ tarr.unshift(' ref="refDom"');
4231
+ sarr.push("const refDom = ref()");
4232
+ ev.forEach((v) => {
4233
+ const s = getSpecObjs(res, v.name) || {};
4234
+ sarr.push(
4235
+ `// ${s.description} ${s.name}\uFF1A(${s.selectable}) ${s.type}`
4236
+ );
4237
+ const m = v.name + "Value";
4238
+ const css2 = parseParamString(s?.selectable || "");
4239
+ const cs = [];
4240
+ const ps2 = v.params || [];
4241
+ css2.forEach((c, index) => {
4242
+ const prop = c.name;
4243
+ if (prop) {
4244
+ const key = prop + v.name;
4245
+ const val = ps2[index];
4246
+ sarr.push(`// ${c.label}`);
4247
+ if (typeof val == "function") {
4248
+ sarr.push(
4249
+ "const " + key + " = " + getFunctionBody(val, prop, v.text)
4250
+ );
4251
+ } else {
4252
+ if (typeof val == "undefined") {
4253
+ sarr.push(
4254
+ "const " + key + " = " + getTypeValue(c.dataType) + ";"
4255
+ );
4256
+ } else {
4257
+ let st2 = setValStringify(val, prop, v.text);
4258
+ sarr.push("const " + key + " = " + st2 + ";");
4259
+ }
4260
+ }
4261
+ cs.push(key);
4262
+ }
4263
+ });
4264
+ if (v.type === "function") {
4265
+ if (s.return) {
4266
+ sarr.push(
4267
+ `const ${m} = refDom.value?.${v.name}(${cs.join(
4268
+ ", "
4269
+ )})`
4270
+ );
4271
+ } else {
4272
+ sarr.push(`refDom.value?.${v.name}(${cs.join(", ")})`);
4273
+ }
4274
+ if (s.return) {
4275
+ sarr.push(`console.log('${s.return}', ${m})`);
4276
+ }
4066
4277
  } else {
4067
- defaults = v.default || ms[1] || "";
4278
+ sarr.push(`const ${m} = refDom.value?.${v.name}`);
4279
+ sarr.push(`console.log('${s.type || s.name}', ${m})`);
4068
4280
  }
4069
- }
4070
- const regExp = /\s*\((.*)\)\s/gi;
4071
- const rtr = regExp.exec(description);
4072
- if (rtr && rtr.length > 0) {
4073
- selectable = rtr[1];
4074
- description = description.replace(rtr[0], "");
4075
- }
4281
+ });
4076
4282
  }
4077
- if (name.endsWith("*")) {
4078
- required = "*";
4079
- name = name.substring(0, name.length - 1);
4283
+ if (tarr.length > 0) {
4284
+ tarr.unshift("");
4080
4285
  }
4081
- v.name = name;
4082
- v.required = required;
4083
- v.default = defaults || "";
4084
- v.description = description;
4085
- v.selectable = selectable;
4086
- return v;
4087
- }
4088
- function setTitle2(obj2) {
4089
- let title = "";
4090
- let name = "";
4091
- let author = "";
4092
- let description = "";
4093
- let date = "";
4094
- let arr = [
4095
- "title",
4096
- // 'name',
4097
- "text",
4098
- "author",
4099
- "date"
4100
- // 'description',
4101
- // 'descriptions',
4102
- ];
4103
- let fobj = getFilter2(obj2, arr);
4104
- let value = {};
4105
- arr.forEach((key) => {
4106
- value[key] = fobj.obj[key];
4107
- });
4108
- addTitles(value);
4109
- fobj.arr.forEach((o) => {
4110
- addTags2(o.key, o.value);
4111
- });
4112
- }
4113
- function addTitles(value) {
4114
- notesObj.titles.push(value);
4286
+ const slots = getSlots(slotValue, ss);
4287
+ let template = `<template>
4288
+ <div>
4289
+ <${propsname}${tarr.join("\n")}>${slots.join("\n")}
4290
+ </${propsname}>
4291
+ </div>
4292
+ </template>`;
4293
+ template = await prettierHtml(template);
4294
+ let js2 = sarr.join("\n");
4295
+ js2 = await prettierTs(js2);
4296
+ const st = `<!--${propsname}-->
4297
+ ${template}
4298
+ <script lang="ts" setup>
4299
+ ${js2}
4300
+ </script>`;
4301
+ return st;
4115
4302
  }
4116
- function setProps(obj2) {
4117
- let name = "";
4118
- let type = "";
4119
- let defaults = "";
4120
- let description = "";
4121
- let selectable = "";
4122
- let arr = [
4123
- "props",
4124
- "name",
4125
- "type",
4126
- "default",
4127
- "required",
4128
- "selectable",
4129
- "description",
4130
- "descriptions",
4131
- "return"
4132
- ];
4133
- let fobj = getFilter2(obj2, arr);
4134
- let value = {};
4135
- arr.forEach((key) => {
4136
- value[key] = fobj.obj[key];
4137
- });
4138
- addObj(value, "props");
4139
- fobj.arr.forEach((o) => {
4140
- addTags2(o.key, o.value);
4303
+ function getSlots(obj2 = {}, ss) {
4304
+ const arr = [];
4305
+ Object.keys(obj2).forEach((key) => {
4306
+ const sp = getSpecObjs(ss, key) || {};
4307
+ const v = obj2[key];
4308
+ if (v) {
4309
+ const st = ` <!-- ${sp.description} ${sp.name}\uFF1A(${sp.selectable}) -->
4310
+ <template #${key}="scope">
4311
+ ${vueFormat(v, " ")}
4312
+ </template>`;
4313
+ arr.push(st);
4314
+ }
4141
4315
  });
4316
+ if (arr && arr.length > 0) {
4317
+ arr.unshift("");
4318
+ }
4319
+ return arr;
4142
4320
  }
4143
- function setSlot(obj2) {
4144
- let name = "";
4145
- let description = "";
4146
- let selectable = "";
4147
- let arr = ["slot", "name", "selectable", "description", "descriptions"];
4148
- let fobj = getFilter2(obj2, arr);
4149
- let value = {};
4150
- arr.forEach((key) => {
4151
- value[key] = fobj.obj[key];
4152
- });
4153
- addObj(value, "slot");
4154
- fobj.arr.forEach((o) => {
4155
- addTags2(o.key, o.value);
4156
- });
4321
+ function getFunctionBody(v, key, propsText) {
4322
+ const text = propsText ? propsText[key] : "";
4323
+ if (text) {
4324
+ if (text.includes("=>")) {
4325
+ return text;
4326
+ } else if (text.includes("function")) {
4327
+ return text;
4328
+ } else {
4329
+ return funstr(v.toString());
4330
+ }
4331
+ } else {
4332
+ return funstr(v.toString());
4333
+ }
4157
4334
  }
4158
- function setEmits(obj2) {
4159
- let arr = ["emits", "name", "selectable", "description", "descriptions"];
4160
- let fobj = getFilter2(obj2, arr);
4161
- let value = {};
4162
- arr.forEach((key) => {
4163
- value[key] = fobj.obj[key];
4164
- });
4165
- addObj(value, "emits");
4166
- fobj.arr.forEach((o) => {
4167
- addTags2(o.key, o.value);
4168
- });
4335
+ async function funstr(v) {
4336
+ const st = getFunctionFormat(v);
4337
+ if (st) {
4338
+ let body = `{
4339
+ ${vueFormat(getFunBody(st.body), " ")}
4340
+ }`;
4341
+ return `function (${st.param.split(",").map((v2) => v2 + ":any").join(",")}) ${body}`;
4342
+ } else {
4343
+ return "undefined";
4344
+ }
4169
4345
  }
4170
- function setExpose(obj2) {
4171
- let arr = [
4172
- "expose",
4173
- "name",
4174
- "type",
4175
- "return",
4176
- "selectable",
4177
- "description",
4178
- "descriptions"
4179
- ];
4180
- let fobj = getFilter2(obj2, arr);
4181
- let value = {};
4182
- arr.forEach((key) => {
4183
- value[key] = fobj.obj[key];
4184
- });
4185
- addObj(value, "expose");
4186
- fobj.arr.forEach((o) => {
4187
- addTags2(o.key, o.value);
4188
- });
4346
+ function getTypeValueFunction(sp) {
4347
+ const css2 = parseParamString(sp.selectable);
4348
+ const cs = getParameStr(css2);
4349
+ let rs = "";
4350
+ if (sp.return) {
4351
+ rs = "return ";
4352
+ }
4353
+ let body = `{
4354
+ ${vueFormat(getFunBody(rs), " ")}
4355
+ }`;
4356
+ return `function (${cs}) ${body}`;
4189
4357
  }
4190
- function addObj(value, type) {
4191
- const ms = notesObj[type + "name"] || [];
4192
- const name = value.name ?? value[type]?.name;
4193
- const nis = ms.indexOf(name);
4194
- if (nis >= 0) {
4195
- notesObj[type + "s"].splice(nis, 1);
4196
- ms.splice(nis, 1);
4358
+ function getChange(str) {
4359
+ const tr = str.trim();
4360
+ if (/^\(/.test(tr)) {
4361
+ return funstr(tr);
4362
+ } else {
4363
+ return JSON.stringify(str);
4197
4364
  }
4198
- notesObj[type + "s"].push(value);
4199
- ms.push(name);
4200
- notesObj[type + "name"] = ms;
4201
4365
  }
4202
- function init() {
4203
- Object.keys(notesObj).forEach((key) => {
4204
- notesObj[key] = [];
4205
- });
4366
+ function setValStringify(v, key, propsText) {
4367
+ const text = propsText ? propsText[key] : "";
4368
+ if (text) {
4369
+ return text;
4370
+ } else {
4371
+ if (typeof v == "string") {
4372
+ return getChange(v + "");
4373
+ } else {
4374
+ return JSON.stringify(v);
4375
+ }
4376
+ }
4206
4377
  }
4207
- function getFilter2(obj2, arrs) {
4208
- const _objs = {
4209
- descriptions: obj2?.description || ""
4210
- };
4211
- const arr = [];
4212
- if (obj2?.tags) {
4213
- obj2.tags?.forEach((v) => {
4214
- let tag = v.tag;
4215
- let ov = getObj2(v);
4216
- if (!_objs.hasOwnProperty(tag)) {
4217
- _objs[tag] = ov;
4218
- } else {
4219
- const ao = {};
4220
- ao[tag] = ov;
4221
- arr.push({
4222
- key: tag,
4223
- value: ao
4224
- });
4378
+ function getSpecType(val) {
4379
+ let tarr = getDataType2(parseTypeDefinition2(val?.type));
4380
+ let type = getDataTypeType2(tarr);
4381
+ if (tarr.length > 1) {
4382
+ type = "any";
4383
+ }
4384
+ let selectable = (val?.selectable || "").trim();
4385
+ let arr = [];
4386
+ if (selectable && type != "boolean") {
4387
+ if (selectable.includes("|")) {
4388
+ selectable.split("|").forEach((v) => {
4389
+ if (v) {
4390
+ let z = v.split(":");
4391
+ arr.push({
4392
+ label: v,
4393
+ prop: getObjValue(z[0].trim())
4394
+ });
4395
+ }
4396
+ });
4397
+ } else {
4398
+ arr = parseParamString(selectable);
4399
+ }
4400
+ if (type == "array") {
4401
+ type = "choice";
4402
+ } else {
4403
+ if (type != "function" && arr.length > 1) {
4404
+ type = "select";
4225
4405
  }
4226
- });
4406
+ }
4227
4407
  }
4228
4408
  return {
4229
4409
  arr,
4230
- obj: _objs
4410
+ type,
4411
+ dataType: tarr
4231
4412
  };
4232
4413
  }
4233
- function addTags2(tag, obj2) {
4234
- switch (tag) {
4235
- case "title":
4236
- addTitles(obj2);
4237
- return true;
4238
- case "text":
4239
- addTitles(obj2);
4240
- return true;
4241
- case "props":
4242
- addObj(obj2, "props");
4243
- return true;
4244
- case "slot":
4245
- addObj(obj2, "slot");
4246
- return true;
4247
- case "emits":
4248
- addObj(obj2, "emits");
4249
- return true;
4250
- case "expose":
4251
- addObj(obj2, "expose");
4252
- return true;
4253
- default:
4254
- return false;
4255
- }
4256
- }
4257
- function setTags2(tag, obj2) {
4258
- switch (tag) {
4259
- case "title":
4260
- setTitle2(obj2);
4261
- return true;
4262
- case "props":
4263
- setProps(obj2);
4264
- return true;
4265
- case "slot":
4266
- setSlot(obj2);
4267
- return true;
4268
- case "emits":
4269
- setEmits(obj2);
4270
- return true;
4271
- case "expose":
4272
- setExpose(obj2);
4273
- return true;
4274
- default:
4275
- return false;
4276
- }
4277
- }
4278
- function notesFilter(notes) {
4279
- init();
4280
- notes?.forEach((obj2) => {
4281
- let tags = obj2?.tags || [];
4282
- let lg = tags?.length || 0;
4283
- if (lg > 0) {
4284
- for (let i = 0; i < lg; i++) {
4285
- const v = tags[i] || {};
4286
- let is = setTags2(v.tag, obj2);
4287
- if (is) {
4288
- break;
4414
+ function getObjValue(d, type) {
4415
+ try {
4416
+ if (type == "function") {
4417
+ if (typeof d === "string") {
4418
+ if (/^\((.|\n|\r)*\)$/.test(d)) {
4419
+ d = d.substring(1, d.length - 1);
4420
+ return new Function(`{ return ${d} }`)();
4289
4421
  }
4422
+ } else {
4423
+ return d;
4290
4424
  }
4425
+ } else {
4426
+ return new Function(`{ return ${d} }`)();
4291
4427
  }
4292
- });
4293
- return JSON.parse(JSON.stringify(notesObj));
4428
+ } catch (error) {
4429
+ return "" + d;
4430
+ }
4431
+ }
4432
+ function getDefaultValue(obj2, is = true) {
4433
+ const vo = getSpecType(obj2);
4434
+ const v = getTypeValue(vo.dataType);
4435
+ if (is) {
4436
+ const d = (obj2.default || "").trim();
4437
+ return getObjValue(d || v, getDataTypeType2(vo.dataType));
4438
+ } else {
4439
+ const d = (obj2.default || "").trim();
4440
+ return getObjValue(d, getDataTypeType2(vo.dataType));
4441
+ }
4294
4442
  }
4443
+
4444
+ // packages/components/compo/index.ts
4295
4445
  function getNotes2(key) {
4296
4446
  return new Promise((resolve2) => {
4297
4447
  getLocalTextComponents(key).then((text) => {
@@ -4299,16 +4449,17 @@ function getNotes2(key) {
4299
4449
  });
4300
4450
  });
4301
4451
  }
4302
- function getNotesText(text) {
4303
- let notes = getTextNotes(text);
4304
- return notesFilter(notes);
4305
- }
4306
4452
  var tprops = [
4307
4453
  {
4308
4454
  label: "\u5C5E\u6027\u540D",
4309
4455
  prop: "name",
4310
4456
  formatter: props.name
4311
4457
  },
4458
+ {
4459
+ label: "\u53CC\u5411",
4460
+ prop: "model",
4461
+ formatter: props.model
4462
+ },
4312
4463
  {
4313
4464
  label: "\u8BF4\u660E",
4314
4465
  prop: "description",