@fangzhongya/utils 0.0.8-3 → 0.0.8-30
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.
- package/dist/basic/array/asyncMergeArray.cjs +2 -2
- package/dist/basic/array/asyncMergeArray.d.ts +6 -6
- package/dist/basic/array/asyncMergeArray.js +1 -1
- package/dist/basic/array/duplicateRemoval.d.ts +6 -6
- package/dist/basic/array/index.cjs +6 -6
- package/dist/basic/array/index.js +5 -5
- package/dist/basic/array/isArray.d.ts +5 -5
- package/dist/basic/array/replaceAfter.d.ts +7 -7
- package/dist/basic/array/toggleArray.d.ts +7 -7
- package/dist/basic/index.cjs +12 -9
- package/dist/basic/index.d.ts +11 -8
- package/dist/basic/index.js +11 -8
- package/dist/basic/object/attrValueSort.cjs +7 -0
- package/dist/basic/object/attrValueSort.d.ts +12 -0
- package/dist/basic/object/attrValueSort.js +7 -0
- package/dist/basic/object/filterObject.cjs +7 -0
- package/dist/basic/object/filterObject.d.ts +14 -0
- package/dist/basic/object/filterObject.js +7 -0
- package/dist/basic/object/hasOwn.cjs +7 -0
- package/dist/basic/object/hasOwn.d.ts +9 -0
- package/dist/basic/object/hasOwn.js +7 -0
- package/dist/basic/object/index.cjs +14 -2
- package/dist/basic/object/index.d.ts +3 -0
- package/dist/basic/object/index.js +13 -1
- package/dist/basic/object/isObject.d.ts +5 -5
- package/dist/basic/object/isObjectArray.d.ts +5 -5
- package/dist/basic/object/mergeObject.d.ts +8 -8
- package/dist/basic/object/unmergeObject.d.ts +8 -8
- package/dist/basic/string/appearNum.d.ts +6 -6
- package/dist/basic/string/appearNumSeat.d.ts +7 -7
- package/dist/basic/string/firstLower.d.ts +5 -5
- package/dist/basic/string/firstUpper.d.ts +5 -5
- package/dist/basic/string/getStartSame.d.ts +6 -6
- package/dist/basic/string/getStartSames.d.ts +6 -6
- package/dist/basic/string/index.cjs +6 -6
- package/dist/basic/string/index.d.ts +2 -2
- package/dist/basic/string/index.js +5 -5
- package/dist/basic/string/splitUpper.cjs +2 -2
- package/dist/basic/string/splitUpper.d.ts +5 -5
- package/dist/basic/string/splitUpper.js +1 -1
- package/dist/chunk-2OR4FUOA.cjs +47 -0
- package/dist/chunk-3IR2ABRO.js +8 -0
- package/dist/chunk-4X7AFGTV.cjs +21 -0
- package/dist/{chunk-3NFJ3TZL.js → chunk-54HCJAV6.js} +4 -4
- package/dist/{chunk-6MGCPTRE.js → chunk-7OV6BXIR.js} +4 -4
- package/dist/chunk-7RDB5KMY.js +79 -0
- package/dist/chunk-A2WTSAKR.cjs +24 -0
- package/dist/chunk-B4CE4K4W.js +26 -0
- package/dist/{chunk-P3HC3D2H.cjs → chunk-BAYALXR5.cjs} +5 -5
- package/dist/chunk-D3SX7OUV.cjs +11 -0
- package/dist/chunk-E5FTKWGB.js +112 -0
- package/dist/chunk-EWXBN4VG.cjs +21 -0
- package/dist/chunk-FGQXKLTH.cjs +67 -0
- package/dist/{chunk-2W7EPKCY.js → chunk-FQRX7MEM.js} +6 -6
- package/dist/{chunk-ZMG2MHGS.cjs → chunk-GH6ZVMB4.cjs} +5 -5
- package/dist/chunk-GOUC2DFA.cjs +8 -0
- package/dist/chunk-JSWHKRQC.js +20 -0
- package/dist/chunk-L6EZ5APF.cjs +20 -0
- package/dist/{chunk-UCZBNN4I.cjs → chunk-L7FSHU27.cjs} +7 -3
- package/dist/chunk-MH4BDAI6.cjs +79 -0
- package/dist/chunk-MQHLAQQA.js +21 -0
- package/dist/{chunk-JLEIVV37.cjs → chunk-MVG6E6RR.cjs} +7 -7
- package/dist/chunk-NCSN3MC5.js +21 -0
- package/dist/chunk-NUIODPZJ.cjs +28 -0
- package/dist/{chunk-4TVFBKXC.js → chunk-OUXKXJIR.js} +3 -3
- package/dist/chunk-Q63V2U5G.js +47 -0
- package/dist/chunk-Q6FMBSK4.js +27 -0
- package/dist/chunk-QJVB3JIZ.js +67 -0
- package/dist/chunk-QZVMLHFW.cjs +16 -0
- package/dist/chunk-RQRBSTSX.cjs +112 -0
- package/dist/chunk-S42NGJ5W.js +11 -0
- package/dist/{chunk-5JCMM6YG.cjs → chunk-SJ65ETUC.cjs} +12 -0
- package/dist/chunk-SRMXMAFO.cjs +26 -0
- package/dist/{chunk-RWKZ6ZKW.js → chunk-SYJ6G63E.js} +11 -3
- package/dist/chunk-T4BAVDTH.js +31 -0
- package/dist/{chunk-VNVG4BJ4.cjs → chunk-TCMJPIRM.cjs} +16 -12
- package/dist/chunk-UFYLVZNU.cjs +31 -0
- package/dist/{chunk-O2RP4UZQ.cjs → chunk-UGFSIZ5P.cjs} +2 -23
- package/dist/{chunk-C5A37VUQ.js → chunk-UYXPXTIN.js} +12 -0
- package/dist/{chunk-ZQX2TYQB.js → chunk-V3AYCU2W.js} +4 -4
- package/dist/{chunk-Z6NS6N32.js → chunk-VKE5JARB.js} +7 -3
- package/dist/chunk-VY5VQ7WE.cjs +21 -0
- package/dist/chunk-VYMN4FOM.cjs +16 -0
- package/dist/{chunk-QKLVFB74.js → chunk-WX3JYE47.js} +2 -23
- package/dist/chunk-XAQM2IVP.js +16 -0
- package/dist/chunk-XUL6LPTN.js +21 -0
- package/dist/chunk-Y5WYKSYG.js +16 -0
- package/dist/{chunk-SYXWQKOO.cjs → chunk-ZLCUSADU.cjs} +5 -5
- package/dist/css/fetchUnitValue.cjs +2 -2
- package/dist/css/fetchUnitValue.d.ts +7 -7
- package/dist/css/fetchUnitValue.js +1 -1
- package/dist/css/getCss.d.ts +7 -1
- package/dist/css/getPositionRelative.cjs +8 -0
- package/dist/css/getPositionRelative.d.ts +7 -0
- package/dist/css/getPositionRelative.js +8 -0
- package/dist/css/index.cjs +12 -3
- package/dist/css/index.d.ts +2 -0
- package/dist/css/index.js +13 -4
- package/dist/css/setCss.cjs +8 -0
- package/dist/css/setCss.d.ts +11 -0
- package/dist/css/setCss.js +8 -0
- package/dist/dom/getLocus.cjs +7 -0
- package/dist/dom/getLocus.d.ts +14 -0
- package/dist/dom/getLocus.js +7 -0
- package/dist/dom/getShiftEvent.cjs +13 -0
- package/dist/dom/getShiftEvent.d.ts +25 -0
- package/dist/dom/getShiftEvent.js +13 -0
- package/dist/dom/index.cjs +18 -0
- package/dist/dom/index.d.ts +2 -0
- package/dist/dom/index.js +18 -0
- package/dist/html/htmlEscape.cjs +7 -0
- package/dist/html/htmlEscape.d.ts +8 -0
- package/dist/html/htmlEscape.js +7 -0
- package/dist/html/index.cjs +8 -0
- package/dist/html/index.d.ts +1 -0
- package/dist/html/index.js +8 -0
- package/dist/index-130ae781.d.ts +10 -0
- package/dist/index-5aea66bb.d.ts +21 -0
- package/dist/{index-fab49d44.d.ts → index-778c3239.d.ts} +9 -0
- package/dist/{index-c661bc0a.d.ts → index-977a71ba.d.ts} +2 -2
- package/dist/index-bc08cd32.d.ts +14 -0
- package/dist/{index-2c4dacd2.d.ts → index-c2217c22.d.ts} +6 -0
- package/dist/index-da501f98.d.ts +10 -0
- package/dist/index.cjs +59 -33
- package/dist/index.d.ts +32 -18
- package/dist/index.js +59 -33
- package/dist/judge/index.cjs +6 -6
- package/dist/judge/index.js +5 -5
- package/dist/judge/matchs.cjs +3 -3
- package/dist/judge/matchs.d.ts +7 -7
- package/dist/judge/matchs.js +2 -2
- package/dist/judge/matchsEnd.d.ts +6 -6
- package/dist/judge/matchsStart.d.ts +6 -6
- package/dist/judge/matchsWhole.d.ts +6 -6
- package/dist/load/getSynch.d.ts +5 -5
- package/dist/log/styleLog.d.ts +65 -65
- package/dist/name/getComponentNames.cjs +3 -3
- package/dist/name/getComponentNames.d.ts +5 -5
- package/dist/name/getComponentNames.js +2 -2
- package/dist/name/getNames.cjs +3 -3
- package/dist/name/getNames.d.ts +5 -5
- package/dist/name/getNames.js +2 -2
- package/dist/name/humpToLine.d.ts +5 -5
- package/dist/name/index.cjs +7 -7
- package/dist/name/index.d.ts +1 -1
- package/dist/name/index.js +7 -7
- package/dist/name/lineToLargeHump.d.ts +5 -5
- package/dist/name/lineToSmallHump.d.ts +5 -5
- package/dist/node/getPort.cjs +7 -0
- package/dist/node/getPort.d.ts +13 -0
- package/dist/node/getPort.js +7 -0
- package/dist/node/index.cjs +8 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +8 -0
- package/dist/tree/getTreeObj.cjs +11 -0
- package/dist/tree/getTreeObj.d.ts +26 -0
- package/dist/tree/getTreeObj.js +11 -0
- package/dist/tree/index.cjs +12 -0
- package/dist/tree/index.d.ts +1 -0
- package/dist/tree/index.js +12 -0
- package/dist/urls/getImportUrl.d.ts +6 -6
- package/dist/urls/getImportUrlSuffix.d.ts +6 -6
- package/dist/urls/getNewFileName.d.ts +5 -5
- package/dist/urls/getReplaceImportUrl.d.ts +6 -6
- package/dist/urls/getReplaceUrl.d.ts +6 -6
- package/dist/urls/getSuffix.d.ts +5 -5
- package/dist/urls/getUrlCatalogue.d.ts +5 -5
- package/dist/urls/getUrlCatalogueLast.d.ts +5 -5
- package/dist/urls/getUrlCatalogueObj.d.ts +14 -14
- package/dist/urls/index.cjs +10 -10
- package/dist/urls/index.d.ts +2 -2
- package/dist/urls/index.js +13 -13
- package/package.json +173 -112
- package/dist/chunk-7B2HWFLC.cjs +0 -20
- package/dist/chunk-ISSZY3JI.cjs +0 -24
- package/dist/chunk-XQB2HUHZ.js +0 -23
- package/dist/{chunk-BWNLZJJG.js → chunk-EJWFLQF3.js} +3 -3
- package/dist/{chunk-T2QKEABG.js → chunk-FRGDQOX4.js} +3 -3
- package/dist/{chunk-PAJDTMC5.cjs → chunk-KRBTSMT2.cjs} +3 -3
- package/dist/{chunk-T22I7TJQ.cjs → chunk-NGQKVTCR.cjs} +3 -3
- package/dist/{chunk-5UV36ZIW.cjs → chunk-O6P3QI3B.cjs} +3 -3
- package/dist/{chunk-LPDYEUMB.cjs → chunk-VIVEXAEC.cjs} +9 -9
- package/dist/{chunk-MXLYIZIX.js → chunk-VRRDYCUH.js} +3 -3
- package/dist/{chunk-MYS6DR74.js → chunk-X6SR256S.js} +12 -12
- package/dist/{index-42672b09.d.ts → index-8731c480.d.ts} +2 -2
- package/dist/{index-f6ea5a6a.d.ts → index-a65f6120.d.ts} +1 -1
- package/dist/{index-39c0a1ca.d.ts → index-e021eaf4.d.ts} +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/string/splitUpper.ts
|
|
2
2
|
function splitUpper(name) {
|
|
3
|
-
|
|
3
|
+
const reg = /(([A-Z])([^A-Z]*))/g;
|
|
4
4
|
let result;
|
|
5
|
-
|
|
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
|
-
|
|
14
|
+
if (arr.length > 0) {
|
|
15
|
+
return arr;
|
|
16
|
+
} else {
|
|
17
|
+
return [name];
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/tree/getTreeObj.ts
|
|
2
|
+
function getTreeObj(type, arr, param) {
|
|
3
|
+
if (type == 1) {
|
|
4
|
+
return treeToArray(arr, param);
|
|
5
|
+
} else {
|
|
6
|
+
return arrayToTree(arr, param);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function getTreeChildren(arr, param, fid, objs) {
|
|
10
|
+
arr.forEach((v) => {
|
|
11
|
+
const obj = Object.assign({}, v);
|
|
12
|
+
obj[param.fid] = fid;
|
|
13
|
+
const id = obj[param.id];
|
|
14
|
+
objs[id] = obj;
|
|
15
|
+
const arr2 = obj[param.children];
|
|
16
|
+
if (arr2 && arr2.length > 0) {
|
|
17
|
+
getTreeChildren(arr2, param, id, objs);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function treeToArray(arr, param) {
|
|
22
|
+
const objs = {};
|
|
23
|
+
arr.forEach((v) => {
|
|
24
|
+
const obj = Object.assign({}, v);
|
|
25
|
+
const id = obj[param.id];
|
|
26
|
+
const arr2 = obj[param.children];
|
|
27
|
+
if (arr2 && arr2.length > 0) {
|
|
28
|
+
getTreeChildren(arr2, param, id, objs);
|
|
29
|
+
}
|
|
30
|
+
objs[id] = obj;
|
|
31
|
+
});
|
|
32
|
+
const array = Object.values(objs).map((o) => {
|
|
33
|
+
const v = Object.assign({}, o);
|
|
34
|
+
delete v[param.children];
|
|
35
|
+
return v;
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
tree: arr,
|
|
39
|
+
array,
|
|
40
|
+
obj: objs
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function arrayToTree(arr, param) {
|
|
44
|
+
const djs = [];
|
|
45
|
+
const objs = {};
|
|
46
|
+
arr.forEach((v) => {
|
|
47
|
+
const obj = Object.assign({}, v);
|
|
48
|
+
const id = obj[param.id];
|
|
49
|
+
const fid = obj[param.fid];
|
|
50
|
+
if (fid) {
|
|
51
|
+
if (objs[fid]) {
|
|
52
|
+
objs[fid][param.children] = objs[fid][param.children] || [];
|
|
53
|
+
objs[fid][param.children].push(obj);
|
|
54
|
+
} else {
|
|
55
|
+
objs[fid] = {
|
|
56
|
+
[param.children]: [obj]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
djs.push(obj);
|
|
61
|
+
}
|
|
62
|
+
if (objs[id]) {
|
|
63
|
+
objs[id] = Object.assign({}, obj, objs[id]);
|
|
64
|
+
} else {
|
|
65
|
+
objs[id] = obj;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
tree: djs,
|
|
70
|
+
array: arr,
|
|
71
|
+
obj: objs
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
exports.getTreeObj = getTreeObj; exports.treeToArray = treeToArray; exports.arrayToTree = arrayToTree;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCss
|
|
3
|
+
} from "./chunk-5RZYHE3X.js";
|
|
4
|
+
|
|
5
|
+
// packages/css/getPositionRelative.ts
|
|
6
|
+
function getPositionRelative(el, str = "relative") {
|
|
7
|
+
if (el && el.parentElement) {
|
|
8
|
+
const fel = el.parentElement;
|
|
9
|
+
if (getCss(fel, "position") == str) {
|
|
10
|
+
return fel;
|
|
11
|
+
} else {
|
|
12
|
+
return getPositionRelative(fel);
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
return el;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
getPositionRelative
|
|
21
|
+
};
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkO6P3QI3Bcjs = require('./chunk-O6P3QI3B.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkLTVXRDTDcjs = require('./chunk-LTVXRDTD.cjs');
|
|
6
|
+
var _chunkKRBTSMT2cjs = require('./chunk-KRBTSMT2.cjs');
|
|
10
7
|
|
|
11
8
|
|
|
12
9
|
var _chunkXHR36FJKcjs = require('./chunk-XHR36FJK.cjs');
|
|
@@ -15,13 +12,16 @@ var _chunkXHR36FJKcjs = require('./chunk-XHR36FJK.cjs');
|
|
|
15
12
|
var _chunkWI55O3IVcjs = require('./chunk-WI55O3IV.cjs');
|
|
16
13
|
|
|
17
14
|
|
|
15
|
+
var _chunkLTVXRDTDcjs = require('./chunk-LTVXRDTD.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
18
|
var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
|
|
19
19
|
|
|
20
20
|
// packages/name/index.ts
|
|
21
21
|
var name_exports = {};
|
|
22
22
|
_chunk5AZGAKWRcjs.__export.call(void 0, name_exports, {
|
|
23
|
-
getComponentNames: () =>
|
|
24
|
-
getNames: () =>
|
|
23
|
+
getComponentNames: () => _chunkKRBTSMT2cjs.getComponentNames,
|
|
24
|
+
getNames: () => _chunkO6P3QI3Bcjs.getNames,
|
|
25
25
|
humpToLine: () => _chunkLTVXRDTDcjs.humpToLine,
|
|
26
26
|
lineToLargeHump: () => _chunkWI55O3IVcjs.lineToLargeHump,
|
|
27
27
|
lineToSmallHump: () => _chunkXHR36FJKcjs.lineToSmallHump
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// packages/html/htmlEscape.ts
|
|
2
|
+
var zObj = {
|
|
3
|
+
"<": "<",
|
|
4
|
+
">": ">",
|
|
5
|
+
'"': """,
|
|
6
|
+
"'": "'",
|
|
7
|
+
" ": " "
|
|
8
|
+
};
|
|
9
|
+
function htmlEscape(str) {
|
|
10
|
+
str = str.replace(/&(?!\w+;)/g, "&");
|
|
11
|
+
return str.replace(/[<>&" ']/g, (c) => {
|
|
12
|
+
if (c) {
|
|
13
|
+
return zObj[c] || c;
|
|
14
|
+
}
|
|
15
|
+
return c;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
htmlEscape
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkVY5VQ7WEcjs = require('./chunk-VY5VQ7WE.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkUGS2F6DKcjs = require('./chunk-UGS2F6DK.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk4X7AFGTVcjs = require('./chunk-4X7AFGTV.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkUGFSIZ5Pcjs = require('./chunk-UGFSIZ5P.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
|
|
16
|
+
|
|
17
|
+
// packages/css/index.ts
|
|
18
|
+
var css_exports = {};
|
|
19
|
+
_chunk5AZGAKWRcjs.__export.call(void 0, css_exports, {
|
|
20
|
+
fetchUnitValue: () => _chunkUGFSIZ5Pcjs.fetchUnitValue,
|
|
21
|
+
getCss: () => _chunkUGS2F6DKcjs.getCss,
|
|
22
|
+
getPositionRelative: () => _chunkVY5VQ7WEcjs.getPositionRelative,
|
|
23
|
+
setCss: () => _chunk4X7AFGTVcjs.setCss
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.css_exports = css_exports;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
string_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7OV6BXIR.js";
|
|
4
4
|
import {
|
|
5
5
|
array_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-54HCJAV6.js";
|
|
7
7
|
import {
|
|
8
8
|
object_exports
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-UYXPXTIN.js";
|
|
10
10
|
import {
|
|
11
11
|
__export
|
|
12
12
|
} from "./chunk-UICA3PK6.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// packages/dom/getLocus.ts
|
|
2
|
+
function getLocus(ks, js) {
|
|
3
|
+
const x = js.clientX - ks.clientX;
|
|
4
|
+
const y = js.clientY - ks.clientY;
|
|
5
|
+
return {
|
|
6
|
+
x,
|
|
7
|
+
y,
|
|
8
|
+
t: locus(x, y)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function locus(x, y, mim = 10) {
|
|
12
|
+
const isX = x > 0 + mim || x < 0 - mim;
|
|
13
|
+
const isY = y > 0 + mim || y < 0 - mim;
|
|
14
|
+
if (isX && isY) {
|
|
15
|
+
if (x > 0) {
|
|
16
|
+
if (y > 0) {
|
|
17
|
+
return 5;
|
|
18
|
+
} else {
|
|
19
|
+
return 6;
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
if (y > 0) {
|
|
23
|
+
return 7;
|
|
24
|
+
} else {
|
|
25
|
+
return 8;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} else if (isX) {
|
|
29
|
+
if (x > 0) {
|
|
30
|
+
return 1;
|
|
31
|
+
} else {
|
|
32
|
+
return 2;
|
|
33
|
+
}
|
|
34
|
+
} else if (isY) {
|
|
35
|
+
if (y > 0) {
|
|
36
|
+
return 3;
|
|
37
|
+
} else {
|
|
38
|
+
return 4;
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
getLocus
|
|
47
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// packages/basic/array/asyncMergeArray.ts
|
|
2
|
+
function asyncMergeArray(arr, callback) {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
let index = 0;
|
|
5
|
+
const k = arr.length;
|
|
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
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
asyncMergeArray
|
|
27
|
+
};
|
|
@@ -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;
|
|
@@ -6,6 +6,15 @@ var _chunkNRJPCN4Jcjs = require('./chunk-NRJPCN4J.cjs');
|
|
|
6
6
|
var _chunk3VYRYSWKcjs = require('./chunk-3VYRYSWK.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
var _chunkUFYLVZNUcjs = require('./chunk-UFYLVZNU.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkD3SX7OUVcjs = require('./chunk-D3SX7OUV.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkGOUC2DFAcjs = require('./chunk-GOUC2DFA.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
9
18
|
var _chunkQLBOPNV4cjs = require('./chunk-QLBOPNV4.cjs');
|
|
10
19
|
|
|
11
20
|
|
|
@@ -17,6 +26,9 @@ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
|
|
|
17
26
|
// packages/basic/object/index.ts
|
|
18
27
|
var object_exports = {};
|
|
19
28
|
_chunk5AZGAKWRcjs.__export.call(void 0, object_exports, {
|
|
29
|
+
attrValueSort: () => _chunkUFYLVZNUcjs.attrValueSort,
|
|
30
|
+
filterObject: () => _chunkD3SX7OUVcjs.filterObject,
|
|
31
|
+
hasOwn: () => _chunkGOUC2DFAcjs.hasOwn,
|
|
20
32
|
isObject: () => _chunkMIC3W2VYcjs.isObject,
|
|
21
33
|
isObjectArray: () => _chunkQLBOPNV4cjs.isObjectArray,
|
|
22
34
|
mergeObject: () => _chunkNRJPCN4Jcjs.mergeObject,
|
|
@@ -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,15 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
getPositionRelative
|
|
3
|
+
} from "./chunk-MQHLAQQA.js";
|
|
4
4
|
import {
|
|
5
5
|
getCss
|
|
6
6
|
} from "./chunk-5RZYHE3X.js";
|
|
7
|
+
import {
|
|
8
|
+
setCss
|
|
9
|
+
} from "./chunk-XUL6LPTN.js";
|
|
10
|
+
import {
|
|
11
|
+
fetchUnitValue
|
|
12
|
+
} from "./chunk-WX3JYE47.js";
|
|
7
13
|
import {
|
|
8
14
|
__export
|
|
9
15
|
} from "./chunk-UICA3PK6.js";
|
|
@@ -12,7 +18,9 @@ import {
|
|
|
12
18
|
var css_exports = {};
|
|
13
19
|
__export(css_exports, {
|
|
14
20
|
fetchUnitValue: () => fetchUnitValue,
|
|
15
|
-
getCss: () => getCss
|
|
21
|
+
getCss: () => getCss,
|
|
22
|
+
getPositionRelative: () => getPositionRelative,
|
|
23
|
+
setCss: () => setCss
|
|
16
24
|
});
|
|
17
25
|
|
|
18
26
|
export {
|
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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,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;
|