@fangzhongya/vue-archive 0.0.60 → 0.0.62

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.
@@ -857,17 +857,6 @@ function humpToLine(name) {
857
857
  }
858
858
  }
859
859
 
860
- // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-LPMR5W6M.js
861
- function appearNum(str, t) {
862
- let reg = t;
863
- if (typeof t == "string") {
864
- reg = new RegExp(t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g");
865
- }
866
- let arr = str.match(reg);
867
- let c = arr ? arr.length : 0;
868
- return c;
869
- }
870
-
871
860
  // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
872
861
  function firstLower(str) {
873
862
  return str.slice(0, 1).toLowerCase() + str.slice(1);
@@ -965,93 +954,187 @@ function getVueTexts(content) {
965
954
  };
966
955
  }
967
956
 
957
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-S6JRKYPY.js
958
+ function matchsStart2(key, matchs) {
959
+ if (matchs && matchs.length > 0) {
960
+ for (const value of matchs) {
961
+ if (typeof value == "string") {
962
+ if (key.startsWith(value)) {
963
+ return true;
964
+ }
965
+ } else {
966
+ if (value.test(key)) {
967
+ return true;
968
+ }
969
+ }
970
+ }
971
+ return false;
972
+ } else {
973
+ return true;
974
+ }
975
+ }
976
+
977
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.28/node_modules/@fangzhongya/utils/dist/chunk-YNOFNHEK.js
978
+ function matchsEnd2(key, matchs) {
979
+ if (matchs && matchs.length > 0) {
980
+ for (const value of matchs) {
981
+ if (typeof value == "string") {
982
+ if (key.endsWith(value)) {
983
+ return true;
984
+ }
985
+ } else {
986
+ if (value.test(key)) {
987
+ return true;
988
+ }
989
+ }
990
+ }
991
+ return false;
992
+ } else {
993
+ return true;
994
+ }
995
+ }
996
+
968
997
  // packages/utils/common.ts
969
998
  var defaultExtensions = ["vue", "js", "ts"];
970
- function getAliassNames(obj, arr) {
999
+ function getAliassNames(obj) {
971
1000
  let vm = humpToLine(obj.name);
972
1001
  let ass = [];
973
1002
  if (obj.alias) {
974
1003
  ass.push(obj.alias + "-" + vm);
975
1004
  }
976
- if (arr && arr.length > 0) {
977
- arr.forEach((key) => {
978
- if (obj.alias) {
979
- ass.push(obj.alias + "-" + key + "-" + vm);
980
- }
981
- ass.push(key + "-" + vm);
982
- });
983
- }
984
1005
  return ass;
985
1006
  }
986
- function pxMatchs(matchs) {
987
- matchs.sort((a, b) => {
988
- let al = appearNum(a, "/");
989
- let bl = appearNum(b, "/");
990
- if (al == bl) {
991
- return b.length - a.length;
1007
+ function isMatchDir(url, matchs, nomatchs) {
1008
+ const is = matchsStart2(url, matchs);
1009
+ if (is && nomatchs && nomatchs.length > 0) {
1010
+ if (matchsStart2(url, nomatchs)) {
1011
+ return false;
992
1012
  } else {
993
- return bl - al;
1013
+ return true;
994
1014
  }
995
- });
996
- return matchs;
997
- }
998
- function getMatchs(matchexts = [], extensions = [], matchs = []) {
999
- let es = extensions;
1000
- if (!es || es.length == 0) {
1001
- es = defaultExtensions;
1015
+ } else {
1016
+ return is;
1002
1017
  }
1003
- let pps = [];
1004
- if (matchexts && matchexts.length > 0) {
1005
- pps = matchexts;
1018
+ }
1019
+ function isMatchexts(url, matchs, nomatchs) {
1020
+ const is = matchsEnd2(url, matchs);
1021
+ if (is && nomatchs && nomatchs.length > 0) {
1022
+ if (matchsEnd2(url, nomatchs)) {
1023
+ return false;
1024
+ } else {
1025
+ return true;
1026
+ }
1027
+ } else {
1028
+ return is;
1006
1029
  }
1030
+ }
1031
+ function checkSuffixBeforeMatch(str, regex) {
1032
+ regex.lastIndex = 0;
1033
+ const match = regex.exec(str);
1034
+ if (!match) return "";
1035
+ const matchStartIndex = match.index;
1036
+ return str.substring(0, matchStartIndex);
1037
+ }
1038
+ function createDynamicRegex(functKey) {
1039
+ const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1040
+ return new RegExp(`${escapeRegExp(functKey)}$`);
1041
+ }
1042
+ function getUrlsMatchi(key, matchs) {
1007
1043
  if (matchs && matchs.length > 0) {
1008
- matchs.forEach((v) => {
1009
- es?.forEach((t) => {
1010
- pps.push(v + "." + t);
1011
- });
1012
- });
1044
+ for (const value of matchs) {
1045
+ if (typeof value == "string") {
1046
+ if (key.endsWith(value)) {
1047
+ const v = key.replace(createDynamicRegex(value), "");
1048
+ if (v) {
1049
+ const reg = new RegExp("^.*/([^/]+)$");
1050
+ let ms = v.match(reg);
1051
+ if (ms) {
1052
+ return ms[1];
1053
+ }
1054
+ }
1055
+ }
1056
+ } else {
1057
+ const v = checkSuffixBeforeMatch(key, value);
1058
+ if (v) {
1059
+ const reg = new RegExp("^.*/([^/]+)$");
1060
+ let ms = v.match(reg);
1061
+ if (ms) {
1062
+ return ms[1];
1063
+ }
1064
+ }
1065
+ }
1066
+ }
1013
1067
  }
1014
- pps = [...new Set(pps)];
1015
- return pxMatchs(pps);
1068
+ return "";
1016
1069
  }
1017
- function getUrlName(url, pps, raliass = {}, alias = "") {
1018
- for (let index = 0; index < pps.length; index++) {
1019
- const val = pps[index];
1020
- const reg = new RegExp("^.*/([^/]+)" + val + "$");
1021
- let ms = url.match(reg);
1070
+ function getComponentsObj(key, config2, tdir) {
1071
+ const dk = config2.dir.replace(/^\.\/|((\.\.\/)+)/, "/");
1072
+ let z = key.indexOf(dk);
1073
+ let zv = config2.dir.substring(0, config2.dir.indexOf(dk)) + key.substring(z);
1074
+ let value = "";
1075
+ if (config2.getNameValue) {
1076
+ value = config2.getNameValue(key, config2);
1077
+ } else {
1078
+ const ms = config2.matchextss;
1022
1079
  if (ms) {
1023
- const aliass = [];
1024
- const aliasss = {};
1025
- let adir = "";
1026
- Object.keys(raliass).forEach((key) => {
1027
- let vv = raliass[key];
1028
- if (url.startsWith(vv + "/")) {
1029
- adir = vv;
1030
- aliasss[key] = vv;
1031
- aliass.push(key);
1080
+ value = getUrlsMatchi(key, [ms]);
1081
+ } else {
1082
+ value = getUrlsMatchi(key, config2.matchexts);
1083
+ }
1084
+ }
1085
+ if (value) {
1086
+ let rsobj = {
1087
+ suffix: getSuffix2(key),
1088
+ name: lineToLargeHump(value),
1089
+ value,
1090
+ adir: "",
1091
+ alias: config2.alias,
1092
+ aliasNames: [],
1093
+ raw: "",
1094
+ getRaw: null,
1095
+ mds: [],
1096
+ tests: void 0,
1097
+ url: zv,
1098
+ comprops: config2.comprops,
1099
+ curprops: config2.curprops,
1100
+ dir: config2.dir,
1101
+ cwd: config2.cwd,
1102
+ tdir,
1103
+ key
1104
+ };
1105
+ rsobj.aliasNames = getAliassNames(rsobj);
1106
+ return rsobj;
1107
+ }
1108
+ }
1109
+ function getUrlName(url, config2, urls, key, tdir) {
1110
+ if (isMatchDir(url, config2.matchs, config2.nomatchs)) {
1111
+ let is = false;
1112
+ if (config2.isMatch) {
1113
+ is = config2.isMatch(url, "", [], config2);
1114
+ } else {
1115
+ is = isMatchexts(url, config2.matchexts, config2.nomatchexts);
1116
+ }
1117
+ if (is) {
1118
+ const getUrl = config2.getMatchs;
1119
+ if (getUrl) {
1120
+ const v = getUrl(urls, "", "", config2);
1121
+ return getComponentsObj(v, config2, tdir);
1122
+ } else {
1123
+ const ms = config2.matchextss;
1124
+ if (ms) {
1125
+ if (typeof ms == "string") {
1126
+ if (url.endsWith(ms)) {
1127
+ return getComponentsObj(key, config2, tdir);
1128
+ }
1129
+ } else {
1130
+ if (ms.test(url)) {
1131
+ return getComponentsObj(key, config2, tdir);
1132
+ }
1133
+ }
1134
+ } else {
1135
+ return getComponentsObj(key, config2, tdir);
1032
1136
  }
1033
- });
1034
- let value = ms[1];
1035
- let rsobj = {
1036
- url: "",
1037
- dir: "",
1038
- cwd: "",
1039
- suffix: getSuffix2(url),
1040
- name: lineToLargeHump(value),
1041
- value,
1042
- key: "",
1043
- tdir: "",
1044
- adir,
1045
- alias,
1046
- aliass: aliasss,
1047
- aliasNames: [],
1048
- raw: "",
1049
- getRaw: null,
1050
- mds: [],
1051
- tests: void 0
1052
- };
1053
- rsobj.aliasNames = getAliassNames(rsobj, aliass);
1054
- return rsobj;
1137
+ }
1055
1138
  }
1056
1139
  }
1057
1140
  return;
@@ -1066,24 +1149,41 @@ function getTDir(key) {
1066
1149
  }
1067
1150
  function isComprops(url, comprops) {
1068
1151
  if (comprops) {
1069
- const reg = new RegExp(comprops);
1070
- return reg.test(url);
1071
- } else {
1072
- return false;
1152
+ for (let index = 0; index < comprops.length; index++) {
1153
+ const element = comprops[index];
1154
+ if (typeof element == "string") {
1155
+ if (url.includes(element)) {
1156
+ return true;
1157
+ }
1158
+ } else {
1159
+ if (element.test(url)) {
1160
+ return true;
1161
+ }
1162
+ }
1163
+ }
1073
1164
  }
1165
+ return false;
1074
1166
  }
1075
1167
  function isCurprops(url, comprops) {
1076
1168
  if (comprops) {
1077
- const reg = new RegExp(comprops + "(\\.(js|ts))?$");
1078
- return reg.test(url);
1079
- } else {
1080
- return false;
1169
+ for (let index = 0; index < comprops.length; index++) {
1170
+ const element = comprops[index];
1171
+ if (typeof element == "string") {
1172
+ if (url.endsWith(element)) {
1173
+ return true;
1174
+ }
1175
+ } else {
1176
+ if (element.test(url)) {
1177
+ return true;
1178
+ }
1179
+ }
1180
+ }
1081
1181
  }
1182
+ return false;
1082
1183
  }
1083
- function getComponentsArr(urls, v, comRaw, com, config2) {
1184
+ function getComponentsArr(urls, v, comRaw, com) {
1084
1185
  const props2 = [];
1085
1186
  const arr = [];
1086
- const ppz = getMatchs(v.matchexts, v.extensions, v.matchs);
1087
1187
  const tdir = getTDir(v.dir);
1088
1188
  urls.forEach((key) => {
1089
1189
  const dk = v.dir.replace(/^\.\/|((\.\.\/)+)/, "/");
@@ -1091,11 +1191,11 @@ function getComponentsArr(urls, v, comRaw, com, config2) {
1091
1191
  let zv = v.dir.substring(0, v.dir.indexOf(dk)) + key.substring(z);
1092
1192
  const reg = new RegExp("^" + v.dir);
1093
1193
  let k = zv.replace(reg, "");
1094
- if (config2.comprops && isComprops("/" + k, config2.comprops) || config2.curprops && isCurprops("/" + k, config2.curprops)) {
1194
+ if (v.comprops && isComprops("/" + k, v.comprops) || v.curprops && isCurprops("/" + k, v.curprops)) {
1095
1195
  let value = {};
1096
1196
  value.url = zv;
1097
- value.comprops = config2.comprops || "";
1098
- value.curprops = config2.curprops || "";
1197
+ value.comprops = v.comprops;
1198
+ value.curprops = v.curprops;
1099
1199
  value.value = k;
1100
1200
  value.dir = v.dir;
1101
1201
  value.cwd = v.cwd;
@@ -1106,17 +1206,11 @@ function getComponentsArr(urls, v, comRaw, com, config2) {
1106
1206
  value.getRaw = getRawValue(comRaw, key);
1107
1207
  props2.push(value);
1108
1208
  } else {
1109
- let value = getUrlName(k, ppz, v.aliass, v.alias);
1209
+ let value = getUrlName(k, v, urls, key, tdir);
1210
+ console.log("value", value);
1110
1211
  if (value) {
1111
- value.url = zv;
1112
- value.comprops = config2.comprops;
1113
- value.curprops = config2.curprops;
1114
- value.dir = v.dir;
1115
- value.cwd = v.cwd;
1116
- value.tdir = tdir;
1117
- value.key = key;
1118
- value.component = com[key];
1119
- value.getRaw = getRawValue(comRaw, key);
1212
+ value.component = com[value.key];
1213
+ value.getRaw = getRawValue(comRaw, value.key);
1120
1214
  arr.push(value);
1121
1215
  }
1122
1216
  }
@@ -1634,7 +1728,6 @@ function getTextImport(jstext) {
1634
1728
  // packages/utils/glob.ts
1635
1729
  var componentsObj = {};
1636
1730
  var componentPropsObj = {};
1637
- var aliassComponentsObj = {};
1638
1731
  var componentNameKeys = [];
1639
1732
  var exampleObj = {};
1640
1733
  var examplesObj = {};
@@ -1792,25 +1885,15 @@ function getAliaslevelUrl(key, obj, componentName) {
1792
1885
  componentName = (componentName || "") + "";
1793
1886
  let vm = humpToLine(obj.name);
1794
1887
  let arr = [];
1795
- const aliass = Object.values(obj.aliass || {});
1796
1888
  if (key === "1") {
1797
1889
  if (obj.alias) {
1798
1890
  arr.push(obj.alias + "-" + vm);
1799
1891
  }
1800
- } else if (key === "2") {
1801
- if (aliass && aliass.length > 0) {
1802
- aliass.forEach((v) => {
1803
- arr.push(v + "-" + vm);
1804
- });
1805
- }
1806
1892
  } else if (key === "3") {
1807
1893
  let a = "";
1808
1894
  if (obj.alias) {
1809
1895
  a = obj.alias + "-";
1810
1896
  }
1811
- aliass?.forEach((v) => {
1812
- arr.push(a + v + "-" + vm);
1813
- });
1814
1897
  } else if (key === "4") {
1815
1898
  obj.aliasNames?.forEach((v) => {
1816
1899
  arr.push(humpToLine(v));
@@ -2054,8 +2137,8 @@ async function getTestImportUrl(cobj, text, type) {
2054
2137
  key: ukey,
2055
2138
  name: value,
2056
2139
  cwd: cobj.cwd,
2057
- comprops: comprops || "",
2058
- curprops: curprops || "",
2140
+ comprops,
2141
+ curprops,
2059
2142
  value: v,
2060
2143
  suffix: getSuffix2(value),
2061
2144
  head,
@@ -2083,8 +2166,8 @@ async function getTestImportUrl(cobj, text, type) {
2083
2166
  key: ukey,
2084
2167
  name: v,
2085
2168
  cwd: cobj.cwd,
2086
- comprops: comprops || "",
2087
- curprops: curprops || "",
2169
+ comprops,
2170
+ curprops,
2088
2171
  value: v,
2089
2172
  suffix: getSuffix2(value),
2090
2173
  head,
@@ -2100,8 +2183,8 @@ async function getTestImportUrl(cobj, text, type) {
2100
2183
  const rv = {
2101
2184
  key: value,
2102
2185
  name: v,
2103
- comprops: comprops || "",
2104
- curprops: curprops || "",
2186
+ comprops,
2187
+ curprops,
2105
2188
  value: v,
2106
2189
  suffix: getSuffix2(value),
2107
2190
  head,
@@ -2135,22 +2218,10 @@ function setComponentNameKeys(obj) {
2135
2218
  });
2136
2219
  }
2137
2220
  function setComponentsObj(alias, arr) {
2138
- const aliasss = {};
2139
2221
  arr?.forEach((z) => {
2140
2222
  componentsObj[z.key] = z;
2141
2223
  setComponentNameKeys(z);
2142
- const aliass = Object.values(z.aliass || {});
2143
- if (aliass && aliass.length) {
2144
- aliass.forEach((vs) => {
2145
- aliasss[vs] = aliasss[vs] || [];
2146
- aliasss[vs].push(z.key);
2147
- });
2148
- } else {
2149
- aliasss[defaultName] = aliasss[defaultName] || [];
2150
- aliasss[defaultName].push(z.key);
2151
- }
2152
2224
  });
2153
- aliassComponentsObj[alias] = aliasss;
2154
2225
  }
2155
2226
  function setForComponentsValue(v) {
2156
2227
  let alias;
@@ -2165,7 +2236,7 @@ function setForComponentsValue(v) {
2165
2236
  }
2166
2237
  alias = v.alias || defaultName;
2167
2238
  let urls = v?.urls || Object.keys(v.componentsRaw);
2168
- obj = getComponentsArr(urls, v, v.componentsRaw, v.components, v);
2239
+ obj = getComponentsArr(urls, v, v.componentsRaw, v.components);
2169
2240
  if (obj && obj?.props) {
2170
2241
  obj.props.forEach((z) => {
2171
2242
  componentPropsObj[z.url] = z;
@@ -2184,7 +2255,7 @@ async function getPropsImport(text, obj) {
2184
2255
  let ts = text;
2185
2256
  if (text) {
2186
2257
  let arr = (await getTestImportUrl(obj, text)).filter((v) => {
2187
- return isComprops(v.key, obj.comprops || "") || isCurprops(v.key, obj.curprops || "");
2258
+ return isComprops(v.key, obj.comprops) || isCurprops(v.key, obj.curprops);
2188
2259
  });
2189
2260
  ts = await getPropsTexts(arr) + ts;
2190
2261
  }
@@ -2233,7 +2304,7 @@ async function getComponentsProps(text, obj) {
2233
2304
  if (text) {
2234
2305
  if (obj.comprops || obj.curprops) {
2235
2306
  let arr = (await getTestImportUrl(obj, text)).filter((v) => {
2236
- return isComprops(v.key, obj.comprops || "") || isCurprops(v.key, obj.curprops || "");
2307
+ return isComprops(v.key, obj.comprops) || isCurprops(v.key, obj.curprops);
2237
2308
  });
2238
2309
  let str = await getPropsTexts(arr);
2239
2310
  ts = str + ts;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../../utils/index.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");require("@fangzhongya/utils/html/getVueText");const o=require("../../utils/props.cjs"),c={titles:[],propss:[],slots:[],emitss:[],exposes:[]};function x(e,s){let r=e.charAt(0),l=[['"','"'],["'","'"],["`","`"],["(",")"],["{","}"],["[","]"]];const t=l.map(a=>a[0]);if(t.indexOf(r)!=-1){let a=[r];for(let i=1;i<e.length;i++){const p=e[i];if(t.includes(p))a.push(p);else{let f=!1;for(let m of l)if(p===m[1]&&a[a.length-1]===m[0]){f=!0;break}f&&a.pop()}if(a.length===0)return s&&e[i+1]===" ",e.substring(0,i+1)}}else return s?e.substring(0,e.indexOf(" ")):e}function E(e){delete e.problems,delete e.source;let s=e.tag,r=e.name,l=e.description,t=e.default,n="",a="";if(s=="default")r=r.trim(),r=x(r)||r;else if(s=="selectable")r=r.trim();else{if(r.includes("=")){const f=r.split("=");r=f[0];const m=f[1]+" "+l,g=x(m,!0);g?(t=g,l=m.replace(g,"")):t=e.default||f[1]||""}const p=/\s*\((.*)\)\s/gi.exec(l);p&&p.length>0&&(n=p[1],l=l.replace(p[0],""))}return r.endsWith("*")&&(a="*",r=r.substring(0,r.length-1)),e.name=r,e.required=a,e.default=t||"",e.description=l,e.selectable=n,e}function O(e){let s=["title","text","author","date"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),h(l),r.arr.forEach(t=>{b(t.key,t.value)})}function h(e){c.titles.push(e)}function T(e){let s=["props","name","type","default","required","selectable","description","descriptions","return"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),u(l,"props"),r.arr.forEach(t=>{b(t.key,t.value)})}function y(e){let s=["slot","name","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),u(l,"slot"),r.arr.forEach(t=>{b(t.key,t.value)})}function k(e){let s=["emits","name","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),u(l,"emits"),r.arr.forEach(t=>{b(t.key,t.value)})}function j(e){let s=["expose","name","type","return","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),u(l,"expose"),r.arr.forEach(t=>{b(t.key,t.value)})}function u(e,s){const r=c[s+"name"]||[],l=e.name??e[s]?.name,t=r.indexOf(l);t>=0&&(c[s+"s"].splice(t,1),r.splice(t,1)),c[s+"s"].push(e),r.push(l),c[s+"name"]=r}function S(){Object.keys(c).forEach(e=>{c[e]=[]})}function d(e,s){const r={descriptions:e?.description||""},l=[];return e?.tags&&e.tags?.forEach(t=>{let n=t.tag,a=E(t);if(!r.hasOwnProperty(n))r[n]=a;else{const i={};i[n]=a,l.push({key:n,value:i})}}),{arr:l,obj:r}}function b(e,s){switch(e){case"title":return h(s),!0;case"text":return h(s),!0;case"props":return u(s,"props"),!0;case"slot":return u(s,"slot"),!0;case"emits":return u(s,"emits"),!0;case"expose":return u(s,"expose"),!0;default:return!1}}function w(e,s){switch(e){case"title":return O(s),!0;case"props":return T(s),!0;case"slot":return y(s),!0;case"emits":return k(s),!0;case"expose":return j(s),!0;default:return!1}}function N(e){return S(),e?.forEach(s=>{let r=s?.tags||[],l=r?.length||0;if(l>0)for(let t=0;t<l;t++){const n=r[t]||{};if(w(n.tag,s))break}}),c}function P(e){let s=q.getTextNotes(e);return N(s)}const F=[{label:"属性名",prop:"name",formatter:o.props.name},{label:"说明",prop:"description",formatter:o.props.description},{label:"类型",prop:"type",formatter:o.props.type},{label:"可选值",prop:"selectable",formatter:o.props.selectable},{label:"默认值",prop:"default",formatter:o.props.default},{label:"必传",prop:"required",formatter:o.props.required},{label:"方法返回值",prop:"return",formatter:o.props.return}],v=[{label:"事件名",prop:"name",formatter:o.emits.name},{label:"说明",prop:"description",formatter:o.emits.description},{label:"回调参数",prop:"selectable",formatter:o.emits.selectable}],z=[{label:"方法名",prop:"name",formatter:o.expose.name},{label:"说明",prop:"description",formatter:o.expose.description},{label:"参数",prop:"selectable",formatter:o.expose.selectable},{label:"返回值",prop:"return",formatter(e){return o.expose.return(e)||e.expose.default||""}},{label:"类型",prop:"type",formatter(e){return o.expose.type(e)||"function"}}],A=[{label:"插槽名",prop:"name",formatter:o.slot.name},{label:"说明",prop:"description",formatter:o.slot.description},{label:"作用域参数",prop:"selectable",formatter:o.slot.selectable}];exports.getNotesText=P;exports.temits=v;exports.texpose=z;exports.tprops=F;exports.tslot=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("../../utils/index.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");require("@fangzhongya/utils/html/getVueText");require("@fangzhongya/utils/judge/matchsStart");require("@fangzhongya/utils/judge/matchsEnd");const o=require("../../utils/props.cjs"),c={titles:[],propss:[],slots:[],emitss:[],exposes:[]};function x(e,s){let r=e.charAt(0),l=[['"','"'],["'","'"],["`","`"],["(",")"],["{","}"],["[","]"]];const t=l.map(a=>a[0]);if(t.indexOf(r)!=-1){let a=[r];for(let n=1;n<e.length;n++){const p=e[n];if(t.includes(p))a.push(p);else{let f=!1;for(let m of l)if(p===m[1]&&a[a.length-1]===m[0]){f=!0;break}f&&a.pop()}if(a.length===0)return s&&e[n+1]===" ",e.substring(0,n+1)}}else return s?e.substring(0,e.indexOf(" ")):e}function E(e){delete e.problems,delete e.source;let s=e.tag,r=e.name,l=e.description,t=e.default,i="",a="";if(s=="default")r=r.trim(),r=x(r)||r;else if(s=="selectable")r=r.trim();else{if(r.includes("=")){const f=r.split("=");r=f[0];const m=f[1]+" "+l,g=x(m,!0);g?(t=g,l=m.replace(g,"")):t=e.default||f[1]||""}const p=/\s*\((.*)\)\s/gi.exec(l);p&&p.length>0&&(i=p[1],l=l.replace(p[0],""))}return r.endsWith("*")&&(a="*",r=r.substring(0,r.length-1)),e.name=r,e.required=a,e.default=t||"",e.description=l,e.selectable=i,e}function O(e){let s=["title","text","author","date"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),h(l),r.arr.forEach(t=>{b(t.key,t.value)})}function h(e){c.titles.push(e)}function T(e){let s=["props","name","type","default","required","selectable","description","descriptions","return"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),u(l,"props"),r.arr.forEach(t=>{b(t.key,t.value)})}function y(e){let s=["slot","name","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),u(l,"slot"),r.arr.forEach(t=>{b(t.key,t.value)})}function k(e){let s=["emits","name","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),u(l,"emits"),r.arr.forEach(t=>{b(t.key,t.value)})}function j(e){let s=["expose","name","type","return","selectable","description","descriptions"],r=d(e),l={};s.forEach(t=>{l[t]=r.obj[t]}),u(l,"expose"),r.arr.forEach(t=>{b(t.key,t.value)})}function u(e,s){const r=c[s+"name"]||[],l=e.name??e[s]?.name,t=r.indexOf(l);t>=0&&(c[s+"s"].splice(t,1),r.splice(t,1)),c[s+"s"].push(e),r.push(l),c[s+"name"]=r}function S(){Object.keys(c).forEach(e=>{c[e]=[]})}function d(e,s){const r={descriptions:e?.description||""},l=[];return e?.tags&&e.tags?.forEach(t=>{let i=t.tag,a=E(t);if(!r.hasOwnProperty(i))r[i]=a;else{const n={};n[i]=a,l.push({key:i,value:n})}}),{arr:l,obj:r}}function b(e,s){switch(e){case"title":return h(s),!0;case"text":return h(s),!0;case"props":return u(s,"props"),!0;case"slot":return u(s,"slot"),!0;case"emits":return u(s,"emits"),!0;case"expose":return u(s,"expose"),!0;default:return!1}}function w(e,s){switch(e){case"title":return O(s),!0;case"props":return T(s),!0;case"slot":return y(s),!0;case"emits":return k(s),!0;case"expose":return j(s),!0;default:return!1}}function N(e){return S(),e?.forEach(s=>{let r=s?.tags||[],l=r?.length||0;if(l>0)for(let t=0;t<l;t++){const i=r[t]||{};if(w(i.tag,s))break}}),c}function P(e){let s=q.getTextNotes(e);return N(s)}const F=[{label:"属性名",prop:"name",formatter:o.props.name},{label:"说明",prop:"description",formatter:o.props.description},{label:"类型",prop:"type",formatter:o.props.type},{label:"可选值",prop:"selectable",formatter:o.props.selectable},{label:"默认值",prop:"default",formatter:o.props.default},{label:"必传",prop:"required",formatter:o.props.required},{label:"方法返回值",prop:"return",formatter:o.props.return}],v=[{label:"事件名",prop:"name",formatter:o.emits.name},{label:"说明",prop:"description",formatter:o.emits.description},{label:"回调参数",prop:"selectable",formatter:o.emits.selectable}],z=[{label:"方法名",prop:"name",formatter:o.expose.name},{label:"说明",prop:"description",formatter:o.expose.description},{label:"参数",prop:"selectable",formatter:o.expose.selectable},{label:"返回值",prop:"return",formatter(e){return o.expose.return(e)||e.expose.default||""}},{label:"类型",prop:"type",formatter(e){return o.expose.type(e)||"function"}}],A=[{label:"插槽名",prop:"name",formatter:o.slot.name},{label:"说明",prop:"description",formatter:o.slot.description},{label:"作用域参数",prop:"selectable",formatter:o.slot.selectable}];exports.getNotesText=P;exports.temits=v;exports.texpose=z;exports.tprops=F;exports.tslot=A;
@@ -11,6 +11,8 @@ import "@fangzhongya/utils/basic/string/firstUpper";
11
11
  import "@fangzhongya/utils/urls/getSuffix";
12
12
  import "@fangzhongya/utils/basic/array/replaceAfter";
13
13
  import "@fangzhongya/utils/html/getVueText";
14
+ import "@fangzhongya/utils/judge/matchsStart";
15
+ import "@fangzhongya/utils/judge/matchsEnd";
14
16
  import { props as u, emits as x, expose as d, slot as E } from "../../utils/props.js";
15
17
  const p = {
16
18
  titles: [],
@@ -212,11 +214,11 @@ function z(e) {
212
214
  }
213
215
  }), p;
214
216
  }
215
- function Q(e) {
217
+ function U(e) {
216
218
  let l = T(e);
217
219
  return z(l);
218
220
  }
219
- const R = [
221
+ const V = [
220
222
  {
221
223
  label: "属性名",
222
224
  prop: "name",
@@ -252,7 +254,7 @@ const R = [
252
254
  prop: "return",
253
255
  formatter: u.return
254
256
  }
255
- ], U = [
257
+ ], X = [
256
258
  {
257
259
  label: "事件名",
258
260
  prop: "name",
@@ -268,7 +270,7 @@ const R = [
268
270
  prop: "selectable",
269
271
  formatter: x.selectable
270
272
  }
271
- ], V = [
273
+ ], Y = [
272
274
  {
273
275
  label: "方法名",
274
276
  prop: "name",
@@ -298,7 +300,7 @@ const R = [
298
300
  return d.type(e) || "function";
299
301
  }
300
302
  }
301
- ], X = [
303
+ ], Z = [
302
304
  {
303
305
  label: "插槽名",
304
306
  prop: "name",
@@ -316,9 +318,9 @@ const R = [
316
318
  }
317
319
  ];
318
320
  export {
319
- Q as getNotesText,
320
- U as temits,
321
- V as texpose,
322
- R as tprops,
323
- X as tslot
321
+ U as getNotesText,
322
+ X as temits,
323
+ Y as texpose,
324
+ V as tprops,
325
+ Z as tslot
324
326
  };
@@ -1,25 +1,17 @@
1
- import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from '../../../vue/dist/vue.esm-bundler.js';
2
- declare const _default: DefineComponent<ExtractPropTypes<{
3
- name: {
4
- type: StringConstructor;
5
- };
6
- html: {
7
- type: StringConstructor;
8
- default(): string;
9
- };
10
- }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
11
- refresh: (...args: any[]) => void;
12
- }, string, PublicProps, Readonly< ExtractPropTypes<{
13
- name: {
14
- type: StringConstructor;
15
- };
16
- html: {
17
- type: StringConstructor;
18
- default(): string;
19
- };
20
- }>> & Readonly<{
21
- onRefresh?: ((...args: any[]) => any) | undefined;
22
- }>, {
23
- html: string;
24
- }, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
25
- export default _default;
1
+ import { ObjStr, ObjUnk } from '../../config';
2
+ import { SpecObjs, Spec } from '../../utils/index';
3
+ export declare function getHmtl(propsname: string, param: {
4
+ [key: string]: SpecObjs[];
5
+ }, value: ObjUnk, slotValue?: ObjStr, propsText?: ObjStr, exposeText?: ObjUnk): string;
6
+ export declare function setValStringify(v: unknown, key: string, propsText?: ObjStr): string;
7
+ type SelectsObj = {
8
+ label: string;
9
+ prop: unknown;
10
+ };
11
+ export declare function getSpecType(val: Spec): {
12
+ arr: SelectsObj[];
13
+ type: string;
14
+ dataType: string[];
15
+ };
16
+ export declare function getDefaultValue(obj: Spec, is?: boolean): any;
17
+ export {};
@@ -1 +1 @@
1
- "use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),E=require("./code.cjs"),l=require("../../utils/props.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const j=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(O,U,v,D,u){const p=s.reactive({emitValue:{},slotValue:{}}),r=v.value;let c="div";r.component?c=s.defineAsyncComponent(r.component):r.name&&(c=s.resolveComponent(r.name));const i=v.param||{},f=l.getPropsValue(i.propss||[]),m=l.getEmitsValue(i.emitss||[]),V=l.getExposeValue(i.exposes||[]),h=l.getSlotValue(i.slots||[]),a={},q={};f.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(a[e]=u.propsValue[e]??E.getDefaultValue(t,!1),o&&o.length>1&&m.push({name:"update:"+e,description:t.description,selectable:"value:["+t.type+"]"}))}}),m.forEach(t=>{let e=t.name;if(e.includes("-")){let n=e.split("-");n=n.map((_,P)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};p.emitValue[t.name]=_}});let d;return h.forEach(t=>{const e=t.name||"default";q[e]=o=>{if(p.slotValue[e]){const n=p.slotValue[e];return s.h(s.defineComponent({props:{scope:{type:Object}},template:n}),{scope:o})}}}),s.h("div",{class:"use"},[s.h("div",{class:"use-component"},s.h(c,{...a,ref:t=>{d=t}},q)),s.h("div",{class:"use-code"},s.h(T,{name:r.name,param:i,value:a,propsText:u.propsText,exposeText:u.exposeText,slotValue:p.slotValue})),s.h("div",{class:"use-props"},s.h(g,{name:r.name,list:f,onChange:(t,e)=>{u.propsValue=t,u.propsText=e}})),s.h("div",{class:"use-emit"},s.h(y,{name:r.name,list:m,value:p.emitValue})),s.h("div",{class:"use-expose"},s.h(C,{name:r.name,list:V,getRef:()=>d,onChange:t=>{u.exposeText=t}})),s.h("div",{class:"use-slot"},s.h(b,{name:r.name,list:h,onChange:(t,e)=>{p.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=j;
1
+ "use strict";const s=require("vue"),g=require("./set-props.vue.cjs"),y=require("./set-emit.vue.cjs");;/* empty css */const T=require("./set-code.vue.cjs"),C=require("./set-expose.vue.cjs");;/* empty css */const b=require("./set-slot.vue.cjs"),E=require("./code.cjs"),l=require("../../utils/props.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");const x=require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const j=s.defineComponent({props:{value:{type:Object},param:{type:Object}},render(O,U,v,D,u){const p=s.reactive({emitValue:{},slotValue:{}}),r=v.value||{};let c="div";r.component?c=s.defineAsyncComponent(r.component):r.name&&(c=s.resolveComponent(r.name));const i=v.param||{},f=l.getPropsValue(i.propss||[]),m=l.getEmitsValue(i.emitss||[]),V=l.getExposeValue(i.exposes||[]),h=l.getSlotValue(i.slots||[]),a={},q={};f.forEach(t=>{let e=t.name;if(!e.includes(".")){let o=e.split("/");e=(o[0]||"").trim(),e&&(a[e]=u.propsValue[e]??E.getDefaultValue(t,!1),o&&o.length>1&&m.push({name:"update:"+e,description:t.description,selectable:"value:["+t.type+"]"}))}}),m.forEach(t=>{let e=t.name;if(e.includes("-")){let n=e.split("-");n=n.map((_,P)=>x.firstUpper(_)),e=n.join("")}else e=x.firstUpper(e);const o="on"+e;a[o]=(...n)=>{const _={arr:n,_date_:new Date().getTime()};p.emitValue[t.name]=_}});let d;return h.forEach(t=>{const e=t.name||"default";q[e]=o=>{if(p.slotValue[e]){const n=p.slotValue[e];return s.h(s.defineComponent({props:{scope:{type:Object}},template:n}),{scope:o})}}}),s.h("div",{class:"use"},[s.h("div",{class:"use-component"},s.h(c,{...a,ref:t=>{d=t}},q)),s.h("div",{class:"use-code"},s.h(T,{name:r.name,param:i,value:a,propsText:u.propsText,exposeText:u.exposeText,slotValue:p.slotValue})),s.h("div",{class:"use-props"},s.h(g,{name:r.name,list:f,onChange:(t,e)=>{u.propsValue=t,u.propsText=e}})),s.h("div",{class:"use-emit"},s.h(y,{name:r.name,list:m,value:p.emitValue})),s.h("div",{class:"use-expose"},s.h(C,{name:r.name,list:V,getRef:()=>d,onChange:t=>{u.exposeText=t}})),s.h("div",{class:"use-slot"},s.h(b,{name:r.name,list:h,onChange:(t,e)=>{p.slotValue[t]=e}}))])},data(){return{propsValue:{},propsText:{},exposeText:{}}}});module.exports=j;
@@ -35,7 +35,7 @@ const me = _({
35
35
  const n = T({
36
36
  emitValue: {},
37
37
  slotValue: {}
38
- }), o = f.value;
38
+ }), o = f.value || {};
39
39
  let l = "div";
40
40
  o.component ? l = b(o.component) : o.name && (l = j(o.name));
41
41
  const a = f.param || {}, d = U(a.propss || []), c = k(a.emitss || []), h = w(a.exposes || []), V = A(a.slots || []), i = {}, x = {};
@@ -4,14 +4,14 @@ declare const _default: DefineComponent<ExtractPropTypes<{
4
4
  type: null;
5
5
  };
6
6
  }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
7
- error: (...args: any[]) => void;
8
7
  value: (...args: any[]) => void;
8
+ error: (...args: any[]) => void;
9
9
  }, string, PublicProps, Readonly< ExtractPropTypes<{
10
10
  modelValue: {
11
11
  type: null;
12
12
  };
13
13
  }>> & Readonly<{
14
- onError?: ((...args: any[]) => any) | undefined;
15
14
  onValue?: ((...args: any[]) => any) | undefined;
15
+ onError?: ((...args: any[]) => any) | undefined;
16
16
  }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
17
17
  export default _default;