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