@fangzhongya/vue-archive 0.1.3 → 0.1.5

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.
@@ -87,12 +87,12 @@ __export(index_exports, {
87
87
  });
88
88
  module.exports = __toCommonJS(index_exports);
89
89
 
90
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
90
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
91
91
  function isArray(obj2) {
92
92
  return Object.prototype.toString.call(obj2) == "[object Array]";
93
93
  }
94
94
 
95
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
95
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
96
96
  function getStartSames(str, val) {
97
97
  let s = "";
98
98
  const vs = [...val];
@@ -108,7 +108,7 @@ function getStartSames(str, val) {
108
108
  return [s, str.substring(index), val.substring(index)];
109
109
  }
110
110
 
111
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-KDOS4NFR.js
111
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-KDOS4NFR.js
112
112
  function getImportUrl(url, imp) {
113
113
  const arr = getStartSames(url, imp);
114
114
  const ts2 = arr[0];
@@ -132,12 +132,12 @@ function getImportUrl(url, imp) {
132
132
  return ds.join("") + arr[2].replace(/\\/g, "/");
133
133
  }
134
134
 
135
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
135
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
136
136
  function firstUpper(str) {
137
137
  return str.slice(0, 1).toUpperCase() + str.slice(1);
138
138
  }
139
139
 
140
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
140
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
141
141
  function lineToLargeHump(name) {
142
142
  let arr = name.split("-");
143
143
  arr = arr.map((vs) => {
@@ -846,7 +846,7 @@ function runDev(config2, configCallback) {
846
846
  return new FangMd(config2, configCallback);
847
847
  }
848
848
 
849
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
849
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
850
850
  var zObj = {
851
851
  "<": "&lt;",
852
852
  ">": "&gt;",
@@ -867,7 +867,7 @@ function htmlEscape(str) {
867
867
  // packages/node/index.ts
868
868
  var import_node_path = require("path");
869
869
 
870
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
870
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
871
871
  function mergeObject(a, b, j = 0, i) {
872
872
  if (a instanceof Array) {
873
873
  if (j > 0 && i) {
@@ -921,7 +921,7 @@ function getConfig(key) {
921
921
  return config[key];
922
922
  }
923
923
 
924
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
924
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
925
925
  function getVueText(content) {
926
926
  const result = {
927
927
  template: "",
@@ -968,7 +968,7 @@ function getVueTexts(content) {
968
968
  };
969
969
  }
970
970
 
971
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
971
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
972
972
  function humpToLine(name) {
973
973
  const reg = /(([A-Z])([^A-Z]*))/g;
974
974
  let result;
@@ -990,12 +990,12 @@ function humpToLine(name) {
990
990
  }
991
991
  }
992
992
 
993
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
993
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
994
994
  function firstLower(str) {
995
995
  return str.slice(0, 1).toLowerCase() + str.slice(1);
996
996
  }
997
997
 
998
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
998
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
999
999
  function asyncMergeArray(arr, callback) {
1000
1000
  return new Promise((resolve2, reject) => {
1001
1001
  let index = 0;
@@ -1019,7 +1019,7 @@ function asyncMergeArray(arr, callback) {
1019
1019
  });
1020
1020
  }
1021
1021
 
1022
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-Z7NTQAAJ.js
1022
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-Z7NTQAAJ.js
1023
1023
  function getSuffix2(url) {
1024
1024
  const reg = /\.([a-z|A-Z][a-z|A-Z|0-9]*)$/;
1025
1025
  const regs = reg.exec(url);
@@ -1029,7 +1029,7 @@ function getSuffix2(url) {
1029
1029
  return "";
1030
1030
  }
1031
1031
 
1032
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-S6JRKYPY.js
1032
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-S6JRKYPY.js
1033
1033
  function matchsStart2(key, matchs) {
1034
1034
  if (matchs && matchs.length > 0) {
1035
1035
  for (const value of matchs) {
@@ -1049,7 +1049,7 @@ function matchsStart2(key, matchs) {
1049
1049
  }
1050
1050
  }
1051
1051
 
1052
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-YNOFNHEK.js
1052
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-YNOFNHEK.js
1053
1053
  function matchsEnd2(key, matchs) {
1054
1054
  if (matchs && matchs.length > 0) {
1055
1055
  for (const value of matchs) {
@@ -1712,7 +1712,7 @@ function parse(source, options = {}) {
1712
1712
  }
1713
1713
  var stringify = getStringifier();
1714
1714
 
1715
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1715
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1716
1716
  function deComment(code) {
1717
1717
  let output = "";
1718
1718
  let state = "code";
@@ -1804,7 +1804,7 @@ function deComment(code) {
1804
1804
  return output;
1805
1805
  }
1806
1806
 
1807
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-N5Y3XGHX.js
1807
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-N5Y3XGHX.js
1808
1808
  function getImports(code, includeType = false) {
1809
1809
  code = deComment(code);
1810
1810
  const imports = /* @__PURE__ */ new Set();
@@ -3230,7 +3230,7 @@ var top_default2 = (0, import_vue2.defineComponent)({
3230
3230
  }
3231
3231
  });
3232
3232
 
3233
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-7O4MJOHM.js
3233
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-Q6BNW3MO.js
3234
3234
  var FUNCTION_REGEX = /^\s*(?:(async)\s+)?(?:function\s*(\*?)\s*(\w*)\s*\(([\s\S]*?)\)|(\*?\s*)\b(\w+)\s*\(([\s\S]*?)\)|\(([\s\S]*?)\)|([^=>,\(\)]+?))\s*(?:=>)?\s*(?:\{([\s\S]*?)\}|([\s\S]*))$/;
3235
3235
  function getFunctionFormat(v) {
3236
3236
  if (!v) return;
@@ -3272,6 +3272,8 @@ function getFunctionFormat(v) {
3272
3272
  let name = "";
3273
3273
  let param = "";
3274
3274
  let body = "";
3275
+ let isArrow = false;
3276
+ let arrowBody = "";
3275
3277
  if (funcParams !== void 0) {
3276
3278
  isGenerator = funcGenerator === "*";
3277
3279
  name = funcName || "";
@@ -3283,18 +3285,22 @@ function getFunctionFormat(v) {
3283
3285
  param = methodParams;
3284
3286
  body = blockBody || exprBody || "";
3285
3287
  } else if (arrowParenParams !== void 0 || arrowSingleParam !== void 0) {
3288
+ isArrow = true;
3286
3289
  param = arrowParenParams || arrowSingleParam || "";
3287
3290
  body = blockBody || exprBody || "";
3291
+ arrowBody = body.trim();
3288
3292
  if (!blockBody && !/^\s*return\b/.test(body)) {
3289
3293
  body = `return ${body}`;
3290
3294
  }
3291
3295
  }
3292
3296
  return {
3297
+ isArrow,
3293
3298
  isAsync,
3294
3299
  isGenerator,
3295
3300
  ...name && { name },
3296
3301
  param: param.trim(),
3297
- body: body.trim()
3302
+ body: body.trim(),
3303
+ arrowBody
3298
3304
  };
3299
3305
  }
3300
3306
 
@@ -3569,9 +3575,94 @@ function getTypeValue(arr) {
3569
3575
  return "undefined";
3570
3576
  }
3571
3577
  }
3578
+ var allReservedWords = [
3579
+ // JavaScript 基本关键字
3580
+ "break",
3581
+ "case",
3582
+ "catch",
3583
+ "class",
3584
+ "const",
3585
+ "continue",
3586
+ "debugger",
3587
+ "default",
3588
+ "delete",
3589
+ "do",
3590
+ "else",
3591
+ "export",
3592
+ "extends",
3593
+ "finally",
3594
+ "for",
3595
+ "function",
3596
+ "if",
3597
+ "import",
3598
+ "in",
3599
+ "instanceof",
3600
+ "new",
3601
+ "return",
3602
+ "super",
3603
+ "switch",
3604
+ "this",
3605
+ "throw",
3606
+ "try",
3607
+ "typeof",
3608
+ "var",
3609
+ "void",
3610
+ "while",
3611
+ "with",
3612
+ "yield",
3613
+ // 严格模式下的保留字
3614
+ "implements",
3615
+ "interface",
3616
+ "let",
3617
+ "package",
3618
+ "private",
3619
+ "protected",
3620
+ "public",
3621
+ "static",
3622
+ // 字面量值
3623
+ "true",
3624
+ "false",
3625
+ "null",
3626
+ "undefined",
3627
+ // TypeScript 特有类型关键字
3628
+ "any",
3629
+ "boolean",
3630
+ "number",
3631
+ "string",
3632
+ "object",
3633
+ "symbol",
3634
+ "unknown",
3635
+ "never",
3636
+ "void",
3637
+ "undefined",
3638
+ "null",
3639
+ // TypeScript 类型操作与定义
3640
+ "type",
3641
+ "interface",
3642
+ "enum",
3643
+ "as",
3644
+ "is",
3645
+ "infer",
3646
+ "unique",
3647
+ // TypeScript 类修饰符
3648
+ "abstract",
3649
+ "readonly",
3650
+ // TypeScript 模块与声明
3651
+ "namespace",
3652
+ "module",
3653
+ "declare",
3654
+ "require",
3655
+ // 其他(访问器、未来保留字等)
3656
+ "get",
3657
+ "set",
3658
+ "async",
3659
+ "await",
3660
+ "from",
3661
+ "of",
3662
+ "package"
3663
+ ];
3572
3664
 
3573
3665
  // packages/components/use/code.ts
3574
- var keywords = ["class"];
3575
3666
  function getSpecObjs(specs, name) {
3576
3667
  return specs.filter((o) => o.name == name)[0];
3577
3668
  }
@@ -3627,7 +3718,7 @@ async function getHmtl(propsname, param, value, slotValue, propsText, exposeText
3627
3718
  sarr.push("}");
3628
3719
  } else {
3629
3720
  let z = key;
3630
- if (keywords.includes(key)) {
3721
+ if (allReservedWords.includes(key)) {
3631
3722
  z = key + "1";
3632
3723
  }
3633
3724
  tarr.push(" :" + key + '="' + z + '"');
@@ -58,12 +58,12 @@ var init_prettier = __esm({
58
58
  }
59
59
  });
60
60
 
61
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
61
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
62
62
  function isArray(obj2) {
63
63
  return Object.prototype.toString.call(obj2) == "[object Array]";
64
64
  }
65
65
 
66
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
66
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
67
67
  function getStartSames(str, val) {
68
68
  let s = "";
69
69
  const vs = [...val];
@@ -79,7 +79,7 @@ function getStartSames(str, val) {
79
79
  return [s, str.substring(index), val.substring(index)];
80
80
  }
81
81
 
82
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-KDOS4NFR.js
82
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-KDOS4NFR.js
83
83
  function getImportUrl(url, imp) {
84
84
  const arr = getStartSames(url, imp);
85
85
  const ts2 = arr[0];
@@ -103,12 +103,12 @@ function getImportUrl(url, imp) {
103
103
  return ds.join("") + arr[2].replace(/\\/g, "/");
104
104
  }
105
105
 
106
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
106
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
107
107
  function firstUpper(str) {
108
108
  return str.slice(0, 1).toUpperCase() + str.slice(1);
109
109
  }
110
110
 
111
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
111
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
112
112
  function lineToLargeHump(name) {
113
113
  let arr = name.split("-");
114
114
  arr = arr.map((vs) => {
@@ -828,7 +828,7 @@ function runDev(config2, configCallback) {
828
828
  return new FangMd(config2, configCallback);
829
829
  }
830
830
 
831
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
831
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
832
832
  var zObj = {
833
833
  "<": "&lt;",
834
834
  ">": "&gt;",
@@ -849,7 +849,7 @@ function htmlEscape(str) {
849
849
  // packages/node/index.ts
850
850
  import { join as join4 } from "path";
851
851
 
852
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
852
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
853
853
  function mergeObject(a, b, j = 0, i) {
854
854
  if (a instanceof Array) {
855
855
  if (j > 0 && i) {
@@ -903,7 +903,7 @@ function getConfig(key) {
903
903
  return config[key];
904
904
  }
905
905
 
906
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
906
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
907
907
  function getVueText(content) {
908
908
  const result = {
909
909
  template: "",
@@ -950,7 +950,7 @@ function getVueTexts(content) {
950
950
  };
951
951
  }
952
952
 
953
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
953
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
954
954
  function humpToLine(name) {
955
955
  const reg = /(([A-Z])([^A-Z]*))/g;
956
956
  let result;
@@ -972,12 +972,12 @@ function humpToLine(name) {
972
972
  }
973
973
  }
974
974
 
975
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
975
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
976
976
  function firstLower(str) {
977
977
  return str.slice(0, 1).toLowerCase() + str.slice(1);
978
978
  }
979
979
 
980
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
980
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
981
981
  function asyncMergeArray(arr, callback) {
982
982
  return new Promise((resolve2, reject) => {
983
983
  let index = 0;
@@ -1001,7 +1001,7 @@ function asyncMergeArray(arr, callback) {
1001
1001
  });
1002
1002
  }
1003
1003
 
1004
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-Z7NTQAAJ.js
1004
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-Z7NTQAAJ.js
1005
1005
  function getSuffix2(url) {
1006
1006
  const reg = /\.([a-z|A-Z][a-z|A-Z|0-9]*)$/;
1007
1007
  const regs = reg.exec(url);
@@ -1011,7 +1011,7 @@ function getSuffix2(url) {
1011
1011
  return "";
1012
1012
  }
1013
1013
 
1014
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-S6JRKYPY.js
1014
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-S6JRKYPY.js
1015
1015
  function matchsStart2(key, matchs) {
1016
1016
  if (matchs && matchs.length > 0) {
1017
1017
  for (const value of matchs) {
@@ -1031,7 +1031,7 @@ function matchsStart2(key, matchs) {
1031
1031
  }
1032
1032
  }
1033
1033
 
1034
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-YNOFNHEK.js
1034
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-YNOFNHEK.js
1035
1035
  function matchsEnd2(key, matchs) {
1036
1036
  if (matchs && matchs.length > 0) {
1037
1037
  for (const value of matchs) {
@@ -1694,7 +1694,7 @@ function parse(source, options = {}) {
1694
1694
  }
1695
1695
  var stringify = getStringifier();
1696
1696
 
1697
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1697
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
1698
1698
  function deComment(code) {
1699
1699
  let output = "";
1700
1700
  let state = "code";
@@ -1786,7 +1786,7 @@ function deComment(code) {
1786
1786
  return output;
1787
1787
  }
1788
1788
 
1789
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-N5Y3XGHX.js
1789
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-N5Y3XGHX.js
1790
1790
  function getImports(code, includeType = false) {
1791
1791
  code = deComment(code);
1792
1792
  const imports = /* @__PURE__ */ new Set();
@@ -3212,7 +3212,7 @@ var top_default2 = defineComponent2({
3212
3212
  }
3213
3213
  });
3214
3214
 
3215
- // node_modules/.pnpm/@fangzhongya+utils@0.0.49/node_modules/@fangzhongya/utils/dist/chunk-7O4MJOHM.js
3215
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.65/node_modules/@fangzhongya/utils/dist/chunk-Q6BNW3MO.js
3216
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
3217
  function getFunctionFormat(v) {
3218
3218
  if (!v) return;
@@ -3254,6 +3254,8 @@ function getFunctionFormat(v) {
3254
3254
  let name = "";
3255
3255
  let param = "";
3256
3256
  let body = "";
3257
+ let isArrow = false;
3258
+ let arrowBody = "";
3257
3259
  if (funcParams !== void 0) {
3258
3260
  isGenerator = funcGenerator === "*";
3259
3261
  name = funcName || "";
@@ -3265,18 +3267,22 @@ function getFunctionFormat(v) {
3265
3267
  param = methodParams;
3266
3268
  body = blockBody || exprBody || "";
3267
3269
  } else if (arrowParenParams !== void 0 || arrowSingleParam !== void 0) {
3270
+ isArrow = true;
3268
3271
  param = arrowParenParams || arrowSingleParam || "";
3269
3272
  body = blockBody || exprBody || "";
3273
+ arrowBody = body.trim();
3270
3274
  if (!blockBody && !/^\s*return\b/.test(body)) {
3271
3275
  body = `return ${body}`;
3272
3276
  }
3273
3277
  }
3274
3278
  return {
3279
+ isArrow,
3275
3280
  isAsync,
3276
3281
  isGenerator,
3277
3282
  ...name && { name },
3278
3283
  param: param.trim(),
3279
- body: body.trim()
3284
+ body: body.trim(),
3285
+ arrowBody
3280
3286
  };
3281
3287
  }
3282
3288
 
@@ -3551,9 +3557,94 @@ function getTypeValue(arr) {
3551
3557
  return "undefined";
3552
3558
  }
3553
3559
  }
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
+ ];
3554
3646
 
3555
3647
  // packages/components/use/code.ts
3556
- var keywords = ["class"];
3557
3648
  function getSpecObjs(specs, name) {
3558
3649
  return specs.filter((o) => o.name == name)[0];
3559
3650
  }
@@ -3609,7 +3700,7 @@ async function getHmtl(propsname, param, value, slotValue, propsText, exposeText
3609
3700
  sarr.push("}");
3610
3701
  } else {
3611
3702
  let z = key;
3612
- if (keywords.includes(key)) {
3703
+ if (allReservedWords.includes(key)) {
3613
3704
  z = key + "1";
3614
3705
  }
3615
3706
  tarr.push(" :" + key + '="' + z + '"');
@@ -646,7 +646,7 @@ function zt() {
646
646
  super(t), this.name = "HTMLInjectionError", this.html = i;
647
647
  }
648
648
  }
649
- const Q = ae, Oe = T, Re = Symbol("nomatch"), yt = 7, ye = function(e) {
649
+ const Q = ae, Oe = T, Re = /* @__PURE__ */ Symbol("nomatch"), yt = 7, ye = function(e) {
650
650
  const t = /* @__PURE__ */ Object.create(null), i = /* @__PURE__ */ Object.create(null), u = [];
651
651
  let b = !0;
652
652
  const _ = "Could not find the language '{}', did you forget to load/include a language module?", c = { disableAutodetect: !0, name: "Plain text", contains: [] };
@@ -1 +1 @@
1
- "use strict";;/* empty css */require("../../../_virtual/common.cjs");const e=require("../../../node_modules/.pnpm/@highlightjs_vue-plugin@2.1_9b7dd99aa1babbf0e2c1b55c05d36e38/node_modules/@highlightjs/vue-plugin/dist/highlightjs-vue.esm.min.cjs"),n=require("vue"),t=n.defineComponent({props:{language:{type:String},code:{type:String}},components:{highlightjs:e.component}});module.exports=t;
1
+ "use strict";;/* empty css */require("../../../_virtual/common.cjs");const e=require("../../../node_modules/.pnpm/@highlightjs_vue-plugin@2.1_088738b011f896e680b57492efece010/node_modules/@highlightjs/vue-plugin/dist/highlightjs-vue.esm.min.cjs"),n=require("vue"),t=n.defineComponent({props:{language:{type:String},code:{type:String}},components:{highlightjs:e.component}});module.exports=t;
@@ -1,6 +1,6 @@
1
1
  /* empty css */
2
2
  import "../../../_virtual/common.js";
3
- import o from "../../../node_modules/.pnpm/@highlightjs_vue-plugin@2.1_9b7dd99aa1babbf0e2c1b55c05d36e38/node_modules/@highlightjs/vue-plugin/dist/highlightjs-vue.esm.min.js";
3
+ import o from "../../../node_modules/.pnpm/@highlightjs_vue-plugin@2.1_088738b011f896e680b57492efece010/node_modules/@highlightjs/vue-plugin/dist/highlightjs-vue.esm.min.js";
4
4
  import { defineComponent as t } from "vue";
5
5
  const m = t({
6
6
  props: {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const N=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const A=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const L=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const o=require("./util.cjs"),S=require("../../utils/props.cjs"),C=require("@fangzhongya/utils/basic/string/toFunction"),M=["class"];function q(e,n){return e.filter(t=>t.name==n)[0]}function x(e){return e.map(n=>(n.prop||"...arr")+":"+o.setDataType(n.dataType)).join(",")}async function Z(e,n,t,s,u,y){const g=[],r=[];let T=!0;const B=S.getPropsValue(n.propss||[]),H=S.getEmitsValue(n.emitss||[]),U=S.getExposeValue(n.exposes||[]),z=S.getSlotValue(n.slots||[]);Object.keys(t).forEach(async i=>{let c=t[i];if(/^on[A-Z]/.test(i)&&typeof c=="function"){let a=i.substring(2);const f=i.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(m=>L.firstUpper(m)).join(""),a=A.firstLower(a)):(l=f[0],a=N.humpToLine(a)),f.includes("-")){let m=l.split("-");m=m.map((h,D)=>D!=0?L.firstUpper(h):h),l=m.join("")}g.push(" @"+a+'="'+l+'"');const p=q(H,a)||{},d=p.selectable||"",b=o.parseParamString(d),$=x(b);r.push(`// ${p.description} ${p.name}: (${p.selectable})`),r.push("function "+l+"("+$+") {"),b.forEach(m=>{const h=m.name||"arr";r.push(" console.log('"+m.label+"', "+h+")")}),r.push("}")}else{let a=i;M.includes(i)&&(a=i+"1"),g.push(" :"+i+'="'+a+'"');const f=q(B,i)||{},l=O(f);if(r.push(`// ${f.description} ${f.name}: {${f.type}} (${f.selectable})`),typeof c=="function"||l.dataType.length==1&&l.type=="function"&&c)r.push("const "+i+" = "+await v(c,i,u));else if(T&&(T=!1,r.unshift("import { ref } from 'vue';")),typeof c>"u")if(l.type=="function"){const p=I(f);r.push("const "+a+" = "+p+";")}else{const p=o.getTypeValue(l.dataType);r.push("const "+a+" = ref("+(p==="undefined"?"":p)+");")}else{let p=w(c,i,u);r.push("const "+a+" = ref("+p+");")}}});const P=Object.values(y||{});P.length>0&&(T&&(T=!1,r.unshift("import { ref } from 'vue';")),g.unshift(' ref="refDom"'),r.push("const refDom = ref()"),P.forEach(i=>{const c=q(U,i.name)||{};r.push(`// ${c.description} ${c.name}:(${c.selectable}) ${c.type}`);const a=i.name+"Value",f=o.parseParamString(c?.selectable||""),l=[],p=i.params||[];f.forEach((d,b)=>{const $=d.name;if($){const m=$+i.name,h=p[b];if(r.push(`// ${d.label}`),typeof h=="function")r.push("const "+m+" = "+v(h,$,i.text));else if(typeof h>"u")r.push("const "+m+" = "+o.getTypeValue(d.dataType)+";");else{let D=w(h,$,i.text);r.push("const "+m+" = "+D+";")}l.push(m)}}),i.type==="function"?(c.return?r.push(`const ${a} = refDom.value?.${i.name}(${l.join(", ")})`):r.push(`refDom.value?.${i.name}(${l.join(", ")})`),c.return&&r.push(`console.log('${c.return}', ${a})`)):(r.push(`const ${a} = refDom.value?.${i.name}`),r.push(`console.log('${c.type||c.name}', ${a})`))})),g.length>0&&g.unshift("");const J=G(s,z);let V=`<template>
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const N=require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const A=require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const v=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const o=require("./util.cjs"),S=require("../../utils/props.cjs"),C=require("@fangzhongya/utils/basic/string/toFunction");function q(e,n){return e.filter(t=>t.name==n)[0]}function x(e){return e.map(n=>(n.prop||"...arr")+":"+o.setDataType(n.dataType)).join(",")}async function M(e,n,t,s,u,y){const g=[],r=[];let T=!0;const B=S.getPropsValue(n.propss||[]),H=S.getEmitsValue(n.emitss||[]),U=S.getExposeValue(n.exposes||[]),z=S.getSlotValue(n.slots||[]);Object.keys(t).forEach(async i=>{let a=t[i];if(/^on[A-Z]/.test(i)&&typeof a=="function"){let c=i.substring(2);const f=i.split(":");let l;if(f.length>1?(l=f[0]+f.slice(1).map(m=>v.firstUpper(m)).join(""),c=A.firstLower(c)):(l=f[0],c=N.humpToLine(c)),f.includes("-")){let m=l.split("-");m=m.map((h,D)=>D!=0?v.firstUpper(h):h),l=m.join("")}g.push(" @"+c+'="'+l+'"');const p=q(H,c)||{},d=p.selectable||"",b=o.parseParamString(d),$=x(b);r.push(`// ${p.description} ${p.name}: (${p.selectable})`),r.push("function "+l+"("+$+") {"),b.forEach(m=>{const h=m.name||"arr";r.push(" console.log('"+m.label+"', "+h+")")}),r.push("}")}else{let c=i;o.allReservedWords.includes(i)&&(c=i+"1"),g.push(" :"+i+'="'+c+'"');const f=q(B,i)||{},l=w(f);if(r.push(`// ${f.description} ${f.name}: {${f.type}} (${f.selectable})`),typeof a=="function"||l.dataType.length==1&&l.type=="function"&&a)r.push("const "+i+" = "+await L(a,i,u));else if(T&&(T=!1,r.unshift("import { ref } from 'vue';")),typeof a>"u")if(l.type=="function"){const p=W(f);r.push("const "+c+" = "+p+";")}else{const p=o.getTypeValue(l.dataType);r.push("const "+c+" = ref("+(p==="undefined"?"":p)+");")}else{let p=E(a,i,u);r.push("const "+c+" = ref("+p+");")}}});const P=Object.values(y||{});P.length>0&&(T&&(T=!1,r.unshift("import { ref } from 'vue';")),g.unshift(' ref="refDom"'),r.push("const refDom = ref()"),P.forEach(i=>{const a=q(U,i.name)||{};r.push(`// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`);const c=i.name+"Value",f=o.parseParamString(a?.selectable||""),l=[],p=i.params||[];f.forEach((d,b)=>{const $=d.name;if($){const m=$+i.name,h=p[b];if(r.push(`// ${d.label}`),typeof h=="function")r.push("const "+m+" = "+L(h,$,i.text));else if(typeof h>"u")r.push("const "+m+" = "+o.getTypeValue(d.dataType)+";");else{let D=E(h,$,i.text);r.push("const "+m+" = "+D+";")}l.push(m)}}),i.type==="function"?(a.return?r.push(`const ${c} = refDom.value?.${i.name}(${l.join(", ")})`):r.push(`refDom.value?.${i.name}(${l.join(", ")})`),a.return&&r.push(`console.log('${a.return}', ${c})`)):(r.push(`const ${c} = refDom.value?.${i.name}`),r.push(`console.log('${a.type||a.name}', ${c})`))})),g.length>0&&g.unshift("");const J=R(s,z);let V=`<template>
2
2
  <div>
3
3
  <${e}${g.join(`
4
4
  `)}>${J.join(`
@@ -10,11 +10,11 @@
10
10
  ${V}
11
11
  <script lang="ts" setup>
12
12
  ${j}
13
- <\/script>`}function G(e={},n){const t=[];return Object.keys(e).forEach(s=>{const u=q(n,s)||{},y=e[s];if(y){const g=` <!-- ${u.description} ${u.name}:(${u.selectable}) -->
13
+ <\/script>`}function R(e={},n){const t=[];return Object.keys(e).forEach(s=>{const u=q(n,s)||{},y=e[s];if(y){const g=` <!-- ${u.description} ${u.name}:(${u.selectable}) -->
14
14
  <template #${s}="scope">
15
15
  ${o.vueFormat(y," ")}
16
- </template>`;t.push(g)}}),t&&t.length>0&&t.unshift(""),t}function v(e,n,t){const s=t?t[n]:"";return s&&(s.includes("=>")||s.includes("function"))?s:F(e.toString())}async function F(e){const n=C.getFunctionFormat(e);if(n){let t=`{
16
+ </template>`;t.push(g)}}),t&&t.length>0&&t.unshift(""),t}function L(e,n,t){const s=t?t[n]:"";return s&&(s.includes("=>")||s.includes("function"))?s:F(e.toString())}async function F(e){const n=C.getFunctionFormat(e);if(n){let t=`{
17
17
  ${o.vueFormat(o.getFunBody(n.body)," ")}
18
- }`;return`function (${n.param.split(",").map(s=>s+":any").join(",")}) ${t}`}else return"undefined"}function I(e){const n=o.parseParamString(e.selectable),t=x(n);let s="";e.return&&(s="return ");let u=`{
18
+ }`;return`function (${n.param.split(",").map(s=>s+":any").join(",")}) ${t}`}else return"undefined"}function W(e){const n=o.parseParamString(e.selectable),t=x(n);let s="";e.return&&(s="return ");let u=`{
19
19
  ${o.vueFormat(o.getFunBody(s)," ")}
20
- }`;return`function (${t}) ${u}`}function K(e){const n=e.trim();return/^\(/.test(n)?F(n):JSON.stringify(e)}function w(e,n,t){const s=t?t[n]:"";return s||(typeof e=="string"?K(e+""):JSON.stringify(e))}function O(e){let n=o.getDataType(o.parseTypeDefinition(e?.type)),t=o.getDataTypeType(n);n.length>1&&(t="any");let s=(e?.selectable||"").trim(),u=[];return s&&t!="boolean"&&(s.includes("|")?s.split("|").forEach(y=>{if(y){let g=y.split(":");u.push({label:y,prop:E(g[0].trim())})}}):u=o.parseParamString(s),t=="array"?t="choice":t!="function"&&u.length>1&&(t="select")),{arr:u,type:t,dataType:n}}function E(e,n){try{if(n=="function")if(typeof e=="string"){if(/^\((.|\n|\r)*\)$/.test(e))return e=e.substring(1,e.length-1),new Function(`{ return ${e} }`)()}else return e;else return new Function(`{ return ${e} }`)()}catch{return""+e}}function Q(e,n=!0){const t=O(e),s=o.getTypeValue(t.dataType);if(n){const u=(e.default||"").trim();return E(u||s,o.getDataTypeType(t.dataType))}else{const u=(e.default||"").trim();return E(u,o.getDataTypeType(t.dataType))}}exports.getDefaultValue=Q;exports.getHmtl=Z;exports.getSpecType=O;exports.setValStringify=w;
20
+ }`;return`function (${t}) ${u}`}function Z(e){const n=e.trim();return/^\(/.test(n)?F(n):JSON.stringify(e)}function E(e,n,t){const s=t?t[n]:"";return s||(typeof e=="string"?Z(e+""):JSON.stringify(e))}function w(e){let n=o.getDataType(o.parseTypeDefinition(e?.type)),t=o.getDataTypeType(n);n.length>1&&(t="any");let s=(e?.selectable||"").trim(),u=[];return s&&t!="boolean"&&(s.includes("|")?s.split("|").forEach(y=>{if(y){let g=y.split(":");u.push({label:y,prop:O(g[0].trim())})}}):u=o.parseParamString(s),t=="array"?t="choice":t!="function"&&u.length>1&&(t="select")),{arr:u,type:t,dataType:n}}function O(e,n){try{if(n=="function")if(typeof e=="string"){if(/^\((.|\n|\r)*\)$/.test(e))return e=e.substring(1,e.length-1),new Function(`{ return ${e} }`)()}else return e;else return new Function(`{ return ${e} }`)()}catch{return""+e}}function G(e,n=!0){const t=w(e),s=o.getTypeValue(t.dataType);if(n){const u=(e.default||"").trim();return O(u||s,o.getDataTypeType(t.dataType))}else{const u=(e.default||"").trim();return O(u,o.getDataTypeType(t.dataType))}}exports.getDefaultValue=G;exports.getHmtl=M;exports.getSpecType=w;exports.setValStringify=E;