@fangzhongya/utils 0.0.8-4 → 0.0.8-40

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.
Files changed (213) hide show
  1. package/dist/basic/array/asyncMergeArray.cjs +2 -2
  2. package/dist/basic/array/asyncMergeArray.d.ts +6 -6
  3. package/dist/basic/array/asyncMergeArray.js +1 -1
  4. package/dist/basic/array/duplicateRemoval.d.ts +6 -6
  5. package/dist/basic/array/index.cjs +6 -6
  6. package/dist/basic/array/index.js +7 -7
  7. package/dist/basic/array/isArray.d.ts +5 -5
  8. package/dist/basic/array/replaceAfter.d.ts +7 -7
  9. package/dist/basic/array/toggleArray.d.ts +7 -7
  10. package/dist/basic/index.cjs +13 -9
  11. package/dist/basic/index.d.ts +9 -5
  12. package/dist/basic/index.js +12 -8
  13. package/dist/basic/object/attrValueSort.cjs +7 -0
  14. package/dist/basic/object/attrValueSort.d.ts +12 -0
  15. package/dist/basic/object/attrValueSort.js +7 -0
  16. package/dist/basic/object/filterObject.cjs +7 -0
  17. package/dist/basic/object/filterObject.d.ts +14 -0
  18. package/dist/basic/object/filterObject.js +7 -0
  19. package/dist/basic/object/hasOwn.cjs +7 -0
  20. package/dist/basic/object/hasOwn.d.ts +9 -0
  21. package/dist/basic/object/hasOwn.js +7 -0
  22. package/dist/basic/object/index.cjs +18 -2
  23. package/dist/basic/object/index.d.ts +4 -0
  24. package/dist/basic/object/index.js +17 -1
  25. package/dist/basic/object/isObject.d.ts +5 -5
  26. package/dist/basic/object/isObjectArray.d.ts +5 -5
  27. package/dist/basic/object/mergeObject.d.ts +8 -8
  28. package/dist/basic/object/setSort.cjs +7 -0
  29. package/dist/basic/object/setSort.d.ts +7 -0
  30. package/dist/basic/object/setSort.js +7 -0
  31. package/dist/basic/object/unmergeObject.d.ts +8 -8
  32. package/dist/basic/string/appearNum.d.ts +6 -6
  33. package/dist/basic/string/appearNumSeat.d.ts +7 -7
  34. package/dist/basic/string/firstLower.d.ts +5 -5
  35. package/dist/basic/string/firstUpper.d.ts +5 -5
  36. package/dist/basic/string/getStartSame.d.ts +6 -6
  37. package/dist/basic/string/getStartSames.d.ts +6 -6
  38. package/dist/basic/string/index.cjs +6 -6
  39. package/dist/basic/string/index.d.ts +3 -3
  40. package/dist/basic/string/index.js +5 -5
  41. package/dist/basic/string/splitUpper.cjs +2 -2
  42. package/dist/basic/string/splitUpper.d.ts +5 -5
  43. package/dist/basic/string/splitUpper.js +1 -1
  44. package/dist/chunk-2OR4FUOA.cjs +47 -0
  45. package/dist/chunk-3IR2ABRO.js +8 -0
  46. package/dist/{chunk-P3HC3D2H.cjs → chunk-4O7YOSS7.cjs} +5 -5
  47. package/dist/chunk-4X7AFGTV.cjs +21 -0
  48. package/dist/chunk-7RDB5KMY.js +79 -0
  49. package/dist/chunk-B4CE4K4W.js +26 -0
  50. package/dist/{chunk-7KXJO4NI.js → chunk-BHZN4K3L.js} +14 -2
  51. package/dist/chunk-D3SX7OUV.cjs +11 -0
  52. package/dist/chunk-E5FTKWGB.js +112 -0
  53. package/dist/{chunk-3NFJ3TZL.js → chunk-E75NHLNL.js} +6 -6
  54. package/dist/chunk-EWXBN4VG.cjs +21 -0
  55. package/dist/chunk-FGQXKLTH.cjs +67 -0
  56. package/dist/chunk-FSQY6A3H.cjs +61 -0
  57. package/dist/chunk-GFAUQTB2.cjs +33 -0
  58. package/dist/chunk-GIAO77MY.js +49 -0
  59. package/dist/chunk-GOUC2DFA.cjs +8 -0
  60. package/dist/chunk-JSWHKRQC.js +20 -0
  61. package/dist/{chunk-JLEIVV37.cjs → chunk-KHGCW3A7.cjs} +7 -7
  62. package/dist/chunk-KQR7FXBF.js +20 -0
  63. package/dist/chunk-L6EZ5APF.cjs +20 -0
  64. package/dist/{chunk-UCZBNN4I.cjs → chunk-L7FSHU27.cjs} +7 -3
  65. package/dist/chunk-LEPZYF2N.cjs +49 -0
  66. package/dist/{chunk-HQFPDOWY.js → chunk-LWHKQ4K2.js} +16 -0
  67. package/dist/chunk-MEMPZX4J.js +61 -0
  68. package/dist/chunk-MGX7U2CG.cjs +20 -0
  69. package/dist/chunk-MH4BDAI6.cjs +79 -0
  70. package/dist/chunk-MQHLAQQA.js +21 -0
  71. package/dist/chunk-N3FZ4WUI.js +16 -0
  72. package/dist/chunk-NCSN3MC5.js +21 -0
  73. package/dist/chunk-ND4NKUAN.cjs +24 -0
  74. package/dist/{chunk-JLGEGDYZ.js → chunk-P2CYIUCC.js} +4 -4
  75. package/dist/{chunk-2W7EPKCY.js → chunk-PVYBDMBK.js} +5 -5
  76. package/dist/chunk-Q63V2U5G.js +47 -0
  77. package/dist/chunk-Q6FMBSK4.js +27 -0
  78. package/dist/chunk-QJVB3JIZ.js +67 -0
  79. package/dist/chunk-QZVMLHFW.cjs +16 -0
  80. package/dist/chunk-RQRBSTSX.cjs +112 -0
  81. package/dist/chunk-S42NGJ5W.js +11 -0
  82. package/dist/chunk-SRMXMAFO.cjs +26 -0
  83. package/dist/{chunk-L6DY4GCH.cjs → chunk-SYXWQKOO.cjs} +5 -5
  84. package/dist/chunk-T4BAVDTH.js +31 -0
  85. package/dist/{chunk-VNVG4BJ4.cjs → chunk-TCMJPIRM.cjs} +16 -12
  86. package/dist/chunk-TE3XNGF4.cjs +16 -0
  87. package/dist/chunk-TOH7JZL5.cjs +36 -0
  88. package/dist/chunk-UFYLVZNU.cjs +31 -0
  89. package/dist/{chunk-O2RP4UZQ.cjs → chunk-UGFSIZ5P.cjs} +2 -23
  90. package/dist/{chunk-5CVTPMX4.js → chunk-USSMLQQB.js} +3 -3
  91. package/dist/{chunk-PB6FN2XC.cjs → chunk-UZGU2YWX.cjs} +16 -0
  92. package/dist/{chunk-FQC2SXR4.cjs → chunk-V3FWFWP2.cjs} +5 -5
  93. package/dist/{chunk-Z6NS6N32.js → chunk-VKE5JARB.js} +7 -3
  94. package/dist/chunk-VY5VQ7WE.cjs +21 -0
  95. package/dist/chunk-WIYZQNGO.js +33 -0
  96. package/dist/{chunk-QKLVFB74.js → chunk-WX3JYE47.js} +2 -23
  97. package/dist/chunk-XUL6LPTN.js +21 -0
  98. package/dist/chunk-Y5WYKSYG.js +16 -0
  99. package/dist/{chunk-NSG7ZMXT.js → chunk-ZQX2TYQB.js} +4 -4
  100. package/dist/css/fetchUnitValue.cjs +2 -2
  101. package/dist/css/fetchUnitValue.d.ts +7 -7
  102. package/dist/css/fetchUnitValue.js +1 -1
  103. package/dist/css/getAttrObj.cjs +7 -0
  104. package/dist/css/getAttrObj.d.ts +11 -0
  105. package/dist/css/getAttrObj.js +7 -0
  106. package/dist/css/getCss.d.ts +7 -1
  107. package/dist/css/getPositionRelative.cjs +8 -0
  108. package/dist/css/getPositionRelative.d.ts +7 -0
  109. package/dist/css/getPositionRelative.js +8 -0
  110. package/dist/css/getSVG.cjs +8 -0
  111. package/dist/css/getSVG.d.ts +14 -0
  112. package/dist/css/getSVG.js +8 -0
  113. package/dist/css/index.cjs +17 -4
  114. package/dist/css/index.d.ts +3 -0
  115. package/dist/css/index.js +16 -3
  116. package/dist/css/setCss.cjs +3 -2
  117. package/dist/css/setCss.d.ts +9 -1
  118. package/dist/css/setCss.js +2 -1
  119. package/dist/dom/getLocus.cjs +7 -0
  120. package/dist/dom/getLocus.d.ts +14 -0
  121. package/dist/dom/getLocus.js +7 -0
  122. package/dist/dom/getShiftEvent.cjs +13 -0
  123. package/dist/dom/getShiftEvent.d.ts +25 -0
  124. package/dist/dom/getShiftEvent.js +13 -0
  125. package/dist/dom/index.cjs +18 -0
  126. package/dist/dom/index.d.ts +2 -0
  127. package/dist/dom/index.js +18 -0
  128. package/dist/html/analysisHtml.cjs +8 -0
  129. package/dist/html/analysisHtml.d.ts +13 -0
  130. package/dist/html/analysisHtml.js +8 -0
  131. package/dist/html/htmlEscape.cjs +7 -0
  132. package/dist/html/htmlEscape.d.ts +8 -0
  133. package/dist/html/htmlEscape.js +7 -0
  134. package/dist/html/index.cjs +13 -0
  135. package/dist/html/index.d.ts +2 -0
  136. package/dist/html/index.js +13 -0
  137. package/dist/index-130ae781.d.ts +10 -0
  138. package/dist/index-5aea66bb.d.ts +21 -0
  139. package/dist/{index-fab49d44.d.ts → index-acc57c4b.d.ts} +12 -0
  140. package/dist/index-ae0241ec.d.ts +13 -0
  141. package/dist/{index-82b62caf.d.ts → index-b5d07d0c.d.ts} +9 -0
  142. package/dist/{index-1626b626.d.ts → index-bb3d187c.d.ts} +2 -2
  143. package/dist/index-bc08cd32.d.ts +14 -0
  144. package/dist/index.cjs +64 -35
  145. package/dist/index.d.ts +32 -15
  146. package/dist/index.js +66 -37
  147. package/dist/judge/index.cjs +6 -6
  148. package/dist/judge/index.js +5 -5
  149. package/dist/judge/matchs.cjs +3 -3
  150. package/dist/judge/matchs.d.ts +7 -7
  151. package/dist/judge/matchs.js +2 -2
  152. package/dist/judge/matchsEnd.d.ts +6 -6
  153. package/dist/judge/matchsStart.d.ts +6 -6
  154. package/dist/judge/matchsWhole.d.ts +6 -6
  155. package/dist/load/getSynch.d.ts +5 -5
  156. package/dist/load/index.cjs +3 -3
  157. package/dist/load/index.js +4 -4
  158. package/dist/log/styleLog.d.ts +65 -65
  159. package/dist/name/getComponentNames.cjs +3 -3
  160. package/dist/name/getComponentNames.d.ts +5 -5
  161. package/dist/name/getComponentNames.js +2 -2
  162. package/dist/name/getNames.cjs +3 -3
  163. package/dist/name/getNames.d.ts +5 -5
  164. package/dist/name/getNames.js +2 -2
  165. package/dist/name/humpToLine.d.ts +5 -5
  166. package/dist/name/index.cjs +7 -7
  167. package/dist/name/index.d.ts +1 -1
  168. package/dist/name/index.js +6 -6
  169. package/dist/name/lineToLargeHump.d.ts +5 -5
  170. package/dist/name/lineToSmallHump.d.ts +5 -5
  171. package/dist/node/getPort.cjs +7 -0
  172. package/dist/node/getPort.d.ts +13 -0
  173. package/dist/node/getPort.js +7 -0
  174. package/dist/node/index.cjs +8 -0
  175. package/dist/node/index.d.ts +1 -0
  176. package/dist/node/index.js +8 -0
  177. package/dist/tree/getTreeObj.cjs +11 -0
  178. package/dist/tree/getTreeObj.d.ts +26 -0
  179. package/dist/tree/getTreeObj.js +11 -0
  180. package/dist/tree/index.cjs +12 -0
  181. package/dist/tree/index.d.ts +1 -0
  182. package/dist/tree/index.js +12 -0
  183. package/dist/urls/getImportUrl.d.ts +6 -6
  184. package/dist/urls/getImportUrlSuffix.d.ts +6 -6
  185. package/dist/urls/getNewFileName.d.ts +5 -5
  186. package/dist/urls/getReplaceImportUrl.d.ts +6 -6
  187. package/dist/urls/getReplaceUrl.d.ts +6 -6
  188. package/dist/urls/getSuffix.d.ts +5 -5
  189. package/dist/urls/getUrlCatalogue.d.ts +5 -5
  190. package/dist/urls/getUrlCatalogueLast.d.ts +5 -5
  191. package/dist/urls/getUrlCatalogueObj.d.ts +14 -14
  192. package/dist/urls/index.cjs +9 -9
  193. package/dist/urls/index.d.ts +1 -1
  194. package/dist/urls/index.js +12 -12
  195. package/package.json +183 -100
  196. package/dist/chunk-36NQW7GX.cjs +0 -24
  197. package/dist/chunk-6WSP6FLZ.cjs +0 -8
  198. package/dist/chunk-7IXRH3MU.js +0 -8
  199. package/dist/chunk-UR7F73LZ.cjs +0 -24
  200. package/dist/chunk-XQB2HUHZ.js +0 -23
  201. package/dist/{chunk-AW3EGUGB.cjs → chunk-AXAVKIR3.cjs} +2 -2
  202. package/dist/{chunk-BWNLZJJG.js → chunk-EJWFLQF3.js} +3 -3
  203. package/dist/{chunk-Y6WJLQX4.js → chunk-HEOIRWEM.js} +11 -11
  204. package/dist/{chunk-PAJDTMC5.cjs → chunk-KRBTSMT2.cjs} +3 -3
  205. package/dist/{chunk-5UV36ZIW.cjs → chunk-O6P3QI3B.cjs} +3 -3
  206. package/dist/{chunk-RAPGCAN7.cjs → chunk-P3477FZW.cjs} +8 -8
  207. package/dist/{chunk-3YUI42XN.cjs → chunk-T22I7TJQ.cjs} +3 -3
  208. package/dist/{chunk-33X65PQS.js → chunk-T2QKEABG.js} +3 -3
  209. package/dist/{chunk-MXLYIZIX.js → chunk-VRRDYCUH.js} +3 -3
  210. package/dist/{chunk-PN4OFZGM.js → chunk-XCTPS2CO.js} +3 -3
  211. package/dist/{index-ea8a32cb.d.ts → index-42672b09.d.ts} +1 -1
  212. package/dist/{index-f9cc2ca2.d.ts → index-a65f6120.d.ts} +1 -1
  213. package/dist/{index-52d58bd9.d.ts → index-eef2a16c.d.ts} +3 -3
@@ -0,0 +1,67 @@
1
+ // packages/node/getPort.ts
2
+ import { createServer } from "node:net";
3
+ function getPort(host, port = 5173, isLocal = true) {
4
+ return new Promise((resolve, reject) => {
5
+ isPortOccupied(port, host, isLocal).then((v) => {
6
+ resolve({ port: v, host });
7
+ }).catch((e) => {
8
+ if (e.code === "EADDRINUSE") {
9
+ getPortNotOccupied(++port, host, isLocal).then((v) => {
10
+ resolve({
11
+ port: v,
12
+ host
13
+ });
14
+ }).catch(() => {
15
+ reject({
16
+ port,
17
+ host
18
+ });
19
+ });
20
+ } else {
21
+ reject({
22
+ port,
23
+ host
24
+ });
25
+ }
26
+ });
27
+ });
28
+ }
29
+ function getPortNotOccupied(port, host, isLocal) {
30
+ return new Promise((resolve, reject) => {
31
+ isPortOccupied(port, host, isLocal).then(() => {
32
+ resolve(port);
33
+ }).catch(async (e) => {
34
+ if (e.code === "EADDRINUSE") {
35
+ resolve(await getPortNotOccupied(++port, host, isLocal));
36
+ } else {
37
+ reject(e);
38
+ }
39
+ });
40
+ });
41
+ }
42
+ var hosts = ["0.0.0.0"];
43
+ function isPortOccupied(port, host, isLocal) {
44
+ return new Promise((resolve, reject) => {
45
+ if (isLocal) {
46
+ if (!host || hosts.includes(host)) {
47
+ host = "localhost";
48
+ }
49
+ }
50
+ const server = createServer().listen({
51
+ host,
52
+ port,
53
+ exclusive: true
54
+ });
55
+ server.on("listening", () => {
56
+ server.close();
57
+ resolve(port);
58
+ });
59
+ server.on("error", (e) => {
60
+ reject(e);
61
+ });
62
+ });
63
+ }
64
+
65
+ export {
66
+ getPort
67
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkFGQXKLTHcjs = require('./chunk-FGQXKLTH.cjs');
4
+
5
+
6
+ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
7
+
8
+ // packages/node/index.ts
9
+ var node_exports = {};
10
+ _chunk5AZGAKWRcjs.__export.call(void 0, node_exports, {
11
+ getPort: () => _chunkFGQXKLTHcjs.getPort
12
+ });
13
+
14
+
15
+
16
+ exports.node_exports = node_exports;
@@ -0,0 +1,112 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/dom/getShiftEvent.ts
2
+ var eventTypes = {
3
+ press: {
4
+ touch: "touchstart",
5
+ mouse: "mousedown"
6
+ },
7
+ shift: {
8
+ touch: "touchmove",
9
+ mouse: "mousemove"
10
+ },
11
+ release: {
12
+ touch: "touchend",
13
+ mouse: "mouseup"
14
+ }
15
+ };
16
+ function pressEvent(dom, press, shift, release, dom1 = document) {
17
+ foundEvent(
18
+ "press",
19
+ (e, t) => {
20
+ const is = press(e);
21
+ if (is) {
22
+ let scoll;
23
+ if (shift) {
24
+ scoll = foundEventCallback("shift", shift, dom1, t);
25
+ }
26
+ if (release) {
27
+ const rcoll = foundEventCallback(
28
+ "release",
29
+ (e1, t1) => {
30
+ release(e1, t1);
31
+ if (scoll) {
32
+ dom1.removeEventListener(
33
+ eventTypes.shift[t1],
34
+ scoll
35
+ );
36
+ }
37
+ dom1.removeEventListener(
38
+ eventTypes.release[t1],
39
+ rcoll
40
+ );
41
+ },
42
+ dom1,
43
+ t
44
+ );
45
+ }
46
+ }
47
+ },
48
+ dom
49
+ );
50
+ }
51
+ function shiftEvent(t, dom1, shift, release, is = true) {
52
+ let scoll;
53
+ if (shift) {
54
+ scoll = foundEventCallback("shift", shift, dom1, t);
55
+ }
56
+ if (release) {
57
+ const rcoll = foundEventCallback(
58
+ "release",
59
+ (e1, t1) => {
60
+ release(e1, t1);
61
+ if (is) {
62
+ if (scoll) {
63
+ dom1.removeEventListener(eventTypes.shift[t1], scoll);
64
+ }
65
+ dom1.removeEventListener(eventTypes.release[t1], rcoll);
66
+ }
67
+ },
68
+ dom1,
69
+ t
70
+ );
71
+ }
72
+ }
73
+ function foundEvent(eventType, c, dom = document, type) {
74
+ if (type != "mouse") {
75
+ dom.addEventListener(eventTypes[eventType].touch, (event) => {
76
+ const e = event;
77
+ const changedTouches = e.changedTouches[0];
78
+ c(changedTouches, "touch");
79
+ });
80
+ }
81
+ if (type != "touch") {
82
+ dom.addEventListener(eventTypes[eventType].mouse, (event) => {
83
+ const e = event;
84
+ c(e, "mouse");
85
+ });
86
+ }
87
+ }
88
+ function foundEventCallback(eventType, c, dom = document, type) {
89
+ if (type == "touch") {
90
+ const eventCallback = (event) => {
91
+ const e = event;
92
+ const changedTouches = e.changedTouches[0];
93
+ c(changedTouches, "touch");
94
+ };
95
+ dom.addEventListener(eventTypes[eventType].touch, eventCallback);
96
+ return eventCallback;
97
+ } else {
98
+ const eventCallback = (event) => {
99
+ const e = event;
100
+ c(e, "mouse");
101
+ };
102
+ dom.addEventListener(eventTypes[eventType].mouse, eventCallback);
103
+ return eventCallback;
104
+ }
105
+ }
106
+
107
+
108
+
109
+
110
+
111
+
112
+ exports.pressEvent = pressEvent; exports.shiftEvent = shiftEvent; exports.foundEvent = foundEvent; exports.foundEventCallback = foundEventCallback;
@@ -0,0 +1,11 @@
1
+ // packages/basic/object/filterObject.ts
2
+ function filterObject(obj, arr) {
3
+ arr.forEach((key) => {
4
+ delete obj[key];
5
+ });
6
+ return obj;
7
+ }
8
+
9
+ export {
10
+ filterObject
11
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk2OR4FUOAcjs = require('./chunk-2OR4FUOA.cjs');
4
+
5
+
6
+
7
+
8
+
9
+ var _chunkRQRBSTSXcjs = require('./chunk-RQRBSTSX.cjs');
10
+
11
+
12
+ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
13
+
14
+ // packages/dom/index.ts
15
+ var dom_exports = {};
16
+ _chunk5AZGAKWRcjs.__export.call(void 0, dom_exports, {
17
+ foundEvent: () => _chunkRQRBSTSXcjs.foundEvent,
18
+ foundEventCallback: () => _chunkRQRBSTSXcjs.foundEventCallback,
19
+ getLocus: () => _chunk2OR4FUOAcjs.getLocus,
20
+ pressEvent: () => _chunkRQRBSTSXcjs.pressEvent,
21
+ shiftEvent: () => _chunkRQRBSTSXcjs.shiftEvent
22
+ });
23
+
24
+
25
+
26
+ exports.dom_exports = dom_exports;
@@ -1,9 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk3YUI42XNcjs = require('./chunk-3YUI42XN.cjs');
4
-
5
-
6
- var _chunk2BY5RQHUcjs = require('./chunk-2BY5RQHU.cjs');
3
+ var _chunkT22I7TJQcjs = require('./chunk-T22I7TJQ.cjs');
7
4
 
8
5
 
9
6
  var _chunkYGJOBIEOcjs = require('./chunk-YGJOBIEO.cjs');
@@ -12,12 +9,15 @@ var _chunkYGJOBIEOcjs = require('./chunk-YGJOBIEO.cjs');
12
9
  var _chunkZZEFL2TEcjs = require('./chunk-ZZEFL2TE.cjs');
13
10
 
14
11
 
12
+ var _chunk2BY5RQHUcjs = require('./chunk-2BY5RQHU.cjs');
13
+
14
+
15
15
  var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
16
16
 
17
17
  // packages/judge/index.ts
18
18
  var judge_exports = {};
19
19
  _chunk5AZGAKWRcjs.__export.call(void 0, judge_exports, {
20
- matchs: () => _chunk3YUI42XNcjs.matchs,
20
+ matchs: () => _chunkT22I7TJQcjs.matchs,
21
21
  matchsEnd: () => _chunkYGJOBIEOcjs.matchsEnd,
22
22
  matchsStart: () => _chunkZZEFL2TEcjs.matchsStart,
23
23
  matchsWhole: () => _chunk2BY5RQHUcjs.matchsWhole
@@ -0,0 +1,31 @@
1
+ // packages/basic/object/attrValueSort.ts
2
+ function attrValueSort(obj, arr, sort) {
3
+ let arrsort;
4
+ if (arr && arr.length > 0) {
5
+ arrsort = arr.map((k) => {
6
+ return {
7
+ key: k,
8
+ value: obj[k]
9
+ };
10
+ });
11
+ } else {
12
+ arrsort = Object.keys(obj).map((k) => {
13
+ return {
14
+ key: k,
15
+ value: obj[k]
16
+ };
17
+ });
18
+ }
19
+ arrsort.sort((a, b) => {
20
+ if (sort) {
21
+ return sort(a.value, b.value);
22
+ } else {
23
+ return a.value - b.value;
24
+ }
25
+ });
26
+ return arrsort.map((o) => o.key);
27
+ }
28
+
29
+ export {
30
+ attrValueSort
31
+ };
@@ -3,18 +3,22 @@ function asyncMergeArray(arr, callback) {
3
3
  return new Promise((resolve, reject) => {
4
4
  let index = 0;
5
5
  const k = arr.length;
6
- arr.forEach((...a) => {
7
- callback(
8
- (...arr2) => {
9
- index++;
10
- if (k == index) {
11
- resolve(arr2);
12
- }
13
- },
14
- reject,
15
- ...a
16
- );
17
- });
6
+ if (k > 0) {
7
+ arr.forEach((...a) => {
8
+ callback(
9
+ (...arr2) => {
10
+ index++;
11
+ if (k == index) {
12
+ resolve(arr2);
13
+ }
14
+ },
15
+ reject,
16
+ ...a
17
+ );
18
+ });
19
+ } else {
20
+ resolve(arr);
21
+ }
18
22
  });
19
23
  }
20
24
 
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/css/getAttrObj.ts
2
+ function getAttrObj(str) {
3
+ const reg = /\s*([^\s="'/>]+)(=('([^']*)'|"([^"]*)"|([^\s/>]*)))?\s*/g;
4
+ let result;
5
+ const obj = {};
6
+ while ((result = reg.exec(str)) !== null) {
7
+ const key = result[1];
8
+ const value = result[5] || result[3];
9
+ obj[key] = value;
10
+ }
11
+ return obj;
12
+ }
13
+
14
+
15
+
16
+ exports.getAttrObj = getAttrObj;
@@ -0,0 +1,36 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkUGFSIZ5Pcjs = require('./chunk-UGFSIZ5P.cjs');
4
+
5
+
6
+ var _chunkVY5VQ7WEcjs = require('./chunk-VY5VQ7WE.cjs');
7
+
8
+
9
+ var _chunkUGS2F6DKcjs = require('./chunk-UGS2F6DK.cjs');
10
+
11
+
12
+ var _chunkGFAUQTB2cjs = require('./chunk-GFAUQTB2.cjs');
13
+
14
+
15
+ var _chunk4X7AFGTVcjs = require('./chunk-4X7AFGTV.cjs');
16
+
17
+
18
+ var _chunkTE3XNGF4cjs = require('./chunk-TE3XNGF4.cjs');
19
+
20
+
21
+ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
22
+
23
+ // packages/css/index.ts
24
+ var css_exports = {};
25
+ _chunk5AZGAKWRcjs.__export.call(void 0, css_exports, {
26
+ fetchUnitValue: () => _chunkUGFSIZ5Pcjs.fetchUnitValue,
27
+ getAttrObj: () => _chunkTE3XNGF4cjs.getAttrObj,
28
+ getCss: () => _chunkUGS2F6DKcjs.getCss,
29
+ getPositionRelative: () => _chunkVY5VQ7WEcjs.getPositionRelative,
30
+ getSVG: () => _chunkGFAUQTB2cjs.getSVG,
31
+ setCss: () => _chunk4X7AFGTVcjs.setCss
32
+ });
33
+
34
+
35
+
36
+ exports.css_exports = css_exports;
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/object/attrValueSort.ts
2
+ function attrValueSort(obj, arr, sort) {
3
+ let arrsort;
4
+ if (arr && arr.length > 0) {
5
+ arrsort = arr.map((k) => {
6
+ return {
7
+ key: k,
8
+ value: obj[k]
9
+ };
10
+ });
11
+ } else {
12
+ arrsort = Object.keys(obj).map((k) => {
13
+ return {
14
+ key: k,
15
+ value: obj[k]
16
+ };
17
+ });
18
+ }
19
+ arrsort.sort((a, b) => {
20
+ if (sort) {
21
+ return sort(a.value, b.value);
22
+ } else {
23
+ return a.value - b.value;
24
+ }
25
+ });
26
+ return arrsort.map((o) => o.key);
27
+ }
28
+
29
+
30
+
31
+ exports.attrValueSort = attrValueSort;
@@ -1,27 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/css/fetchUnitValue.ts
2
- var tops = [
3
- "\n",
4
- "\r",
5
- " ",
6
- "+",
7
- "-",
8
- "*",
9
- "/",
10
- ":",
11
- "("
12
- ];
13
- var ends = [
14
- "\n",
15
- "\r",
16
- " ",
17
- "+",
18
- "-",
19
- "*",
20
- "/",
21
- ";",
22
- ")",
23
- "}"
24
- ];
2
+ var tops = ["\n", "\r", " ", "+", "-", "*", "/", ":", "("];
3
+ var ends = ["\n", "\r", " ", "+", "-", "*", "/", ";", ")", "}"];
25
4
  function fetchUnitValue(text, str, callback) {
26
5
  const reg = new RegExp(`([-]?[0-9\\.]+)(${str})`, "g");
27
6
  return text.replace(reg, function(a, b, c, d) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  string_exports
3
- } from "./chunk-JLGEGDYZ.js";
3
+ } from "./chunk-P2CYIUCC.js";
4
4
  import {
5
5
  array_exports
6
- } from "./chunk-3NFJ3TZL.js";
6
+ } from "./chunk-E75NHLNL.js";
7
7
  import {
8
8
  object_exports
9
- } from "./chunk-HQFPDOWY.js";
9
+ } from "./chunk-LWHKQ4K2.js";
10
10
  import {
11
11
  __export
12
12
  } from "./chunk-UICA3PK6.js";
@@ -3,9 +3,21 @@
3
3
  var _chunkNRJPCN4Jcjs = require('./chunk-NRJPCN4J.cjs');
4
4
 
5
5
 
6
+ var _chunkFSQY6A3Hcjs = require('./chunk-FSQY6A3H.cjs');
7
+
8
+
6
9
  var _chunk3VYRYSWKcjs = require('./chunk-3VYRYSWK.cjs');
7
10
 
8
11
 
12
+ var _chunkUFYLVZNUcjs = require('./chunk-UFYLVZNU.cjs');
13
+
14
+
15
+ var _chunkD3SX7OUVcjs = require('./chunk-D3SX7OUV.cjs');
16
+
17
+
18
+ var _chunkGOUC2DFAcjs = require('./chunk-GOUC2DFA.cjs');
19
+
20
+
9
21
  var _chunkA5LHXE5Xcjs = require('./chunk-A5LHXE5X.cjs');
10
22
 
11
23
 
@@ -17,9 +29,13 @@ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
17
29
  // packages/basic/object/index.ts
18
30
  var object_exports = {};
19
31
  _chunk5AZGAKWRcjs.__export.call(void 0, object_exports, {
32
+ attrValueSort: () => _chunkUFYLVZNUcjs.attrValueSort,
33
+ filterObject: () => _chunkD3SX7OUVcjs.filterObject,
34
+ hasOwn: () => _chunkGOUC2DFAcjs.hasOwn,
20
35
  isObject: () => _chunkMIC3W2VYcjs.isObject,
21
36
  isObjectArray: () => _chunkA5LHXE5Xcjs.isObjectArray,
22
37
  mergeObject: () => _chunkNRJPCN4Jcjs.mergeObject,
38
+ setSort: () => _chunkFSQY6A3Hcjs.setSort,
23
39
  unmergeObject: () => _chunk3VYRYSWKcjs.unmergeObject
24
40
  });
25
41
 
@@ -3,7 +3,7 @@
3
3
  var _chunkJ7S3KBHLcjs = require('./chunk-J7S3KBHL.cjs');
4
4
 
5
5
 
6
- var _chunkUCZBNN4Icjs = require('./chunk-UCZBNN4I.cjs');
6
+ var _chunkL7FSHU27cjs = require('./chunk-L7FSHU27.cjs');
7
7
 
8
8
 
9
9
  var _chunk3HXQ7TGVcjs = require('./chunk-3HXQ7TGV.cjs');
@@ -12,13 +12,13 @@ var _chunk3HXQ7TGVcjs = require('./chunk-3HXQ7TGV.cjs');
12
12
  var _chunkJR6ZN6QDcjs = require('./chunk-JR6ZN6QD.cjs');
13
13
 
14
14
 
15
- var _chunkUEVMS6QDcjs = require('./chunk-UEVMS6QD.cjs');
15
+ var _chunkPW7RP73Jcjs = require('./chunk-PW7RP73J.cjs');
16
16
 
17
17
 
18
- var _chunkOQL4GIEJcjs = require('./chunk-OQL4GIEJ.cjs');
18
+ var _chunkUEVMS6QDcjs = require('./chunk-UEVMS6QD.cjs');
19
19
 
20
20
 
21
- var _chunkPW7RP73Jcjs = require('./chunk-PW7RP73J.cjs');
21
+ var _chunkOQL4GIEJcjs = require('./chunk-OQL4GIEJ.cjs');
22
22
 
23
23
 
24
24
  var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
@@ -32,7 +32,7 @@ _chunk5AZGAKWRcjs.__export.call(void 0, string_exports, {
32
32
  firstUpper: () => _chunkOQL4GIEJcjs.firstUpper,
33
33
  getStartSame: () => _chunkJ7S3KBHLcjs.getStartSame,
34
34
  getStartSames: () => _chunkPW7RP73Jcjs.getStartSames,
35
- splitUpper: () => _chunkUCZBNN4Icjs.splitUpper
35
+ splitUpper: () => _chunkL7FSHU27cjs.splitUpper
36
36
  });
37
37
 
38
38
 
@@ -1,8 +1,8 @@
1
1
  // packages/basic/string/splitUpper.ts
2
2
  function splitUpper(name) {
3
- let reg = /(([A-Z])([^A-Z]*))/g;
3
+ const reg = /(([A-Z])([^A-Z]*))/g;
4
4
  let result;
5
- let arr = [];
5
+ const arr = [];
6
6
  let i = 0;
7
7
  while ((result = reg.exec(name)) !== null) {
8
8
  if (i == 0 && result.index != 0) {
@@ -11,7 +11,11 @@ function splitUpper(name) {
11
11
  i++;
12
12
  arr.push(result[1].toLowerCase());
13
13
  }
14
- return arr;
14
+ if (arr.length > 0) {
15
+ return arr;
16
+ } else {
17
+ return [name];
18
+ }
15
19
  }
16
20
 
17
21
  export {
@@ -0,0 +1,21 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkUGS2F6DKcjs = require('./chunk-UGS2F6DK.cjs');
4
+
5
+ // packages/css/getPositionRelative.ts
6
+ function getPositionRelative(el, str = "relative") {
7
+ if (el && el.parentElement) {
8
+ const fel = el.parentElement;
9
+ if (_chunkUGS2F6DKcjs.getCss.call(void 0, fel, "position") == str) {
10
+ return fel;
11
+ } else {
12
+ return getPositionRelative(fel);
13
+ }
14
+ } else {
15
+ return el;
16
+ }
17
+ }
18
+
19
+
20
+
21
+ exports.getPositionRelative = getPositionRelative;
@@ -0,0 +1,33 @@
1
+ import {
2
+ getAttrObj
3
+ } from "./chunk-N3FZ4WUI.js";
4
+
5
+ // packages/css/getSVG.ts
6
+ function getSVG(str) {
7
+ const reg = /<svg([^>]*)>((.|\n|\r|\t)*)<\/svg>/g;
8
+ const rs = reg.exec(str);
9
+ if (rs && rs.length > 0) {
10
+ const css = rs[1];
11
+ const body = rs[2];
12
+ const attr = getAttrObj(css);
13
+ const b = attr["viewBox"] || "";
14
+ const bs = b.split(" ") || [];
15
+ const l = Number(bs[0]) || 0;
16
+ const t = Number(bs[1]) || 0;
17
+ const w = Number(bs[2] || attr["width"]) || 24;
18
+ const h = Number(bs[3] || attr["height"]) || 24;
19
+ return {
20
+ body,
21
+ viewBox: b,
22
+ left: l,
23
+ top: t,
24
+ width: w,
25
+ height: h
26
+ };
27
+ }
28
+ return;
29
+ }
30
+
31
+ export {
32
+ getSVG
33
+ };
@@ -1,27 +1,6 @@
1
1
  // packages/css/fetchUnitValue.ts
2
- var tops = [
3
- "\n",
4
- "\r",
5
- " ",
6
- "+",
7
- "-",
8
- "*",
9
- "/",
10
- ":",
11
- "("
12
- ];
13
- var ends = [
14
- "\n",
15
- "\r",
16
- " ",
17
- "+",
18
- "-",
19
- "*",
20
- "/",
21
- ";",
22
- ")",
23
- "}"
24
- ];
2
+ var tops = ["\n", "\r", " ", "+", "-", "*", "/", ":", "("];
3
+ var ends = ["\n", "\r", " ", "+", "-", "*", "/", ";", ")", "}"];
25
4
  function fetchUnitValue(text, str, callback) {
26
5
  const reg = new RegExp(`([-]?[0-9\\.]+)(${str})`, "g");
27
6
  return text.replace(reg, function(a, b, c, d) {
@@ -0,0 +1,21 @@
1
+ import {
2
+ humpToLine
3
+ } from "./chunk-J7CICTHH.js";
4
+
5
+ // packages/css/setCss.ts
6
+ function setCss(elem, style, value) {
7
+ if (typeof style == "string") {
8
+ set(elem, style, value || "");
9
+ } else {
10
+ Object.keys(style).forEach((key) => {
11
+ set(elem, key, style[key]);
12
+ });
13
+ }
14
+ }
15
+ function set(elem, style, value) {
16
+ elem.style.setProperty(humpToLine(style), value);
17
+ }
18
+
19
+ export {
20
+ setCss
21
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ getPort
3
+ } from "./chunk-QJVB3JIZ.js";
4
+ import {
5
+ __export
6
+ } from "./chunk-UICA3PK6.js";
7
+
8
+ // packages/node/index.ts
9
+ var node_exports = {};
10
+ __export(node_exports, {
11
+ getPort: () => getPort
12
+ });
13
+
14
+ export {
15
+ node_exports
16
+ };