@fangzhongya/utils 0.0.8-5 → 0.0.8-50
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 +7 -7
- 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 +16 -10
- package/dist/basic/index.d.ts +9 -3
- package/dist/basic/index.js +15 -9
- 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/deepCopy.cjs +7 -0
- package/dist/basic/object/deepCopy.d.ts +8 -0
- package/dist/basic/object/deepCopy.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/getSort.cjs +7 -0
- package/dist/basic/object/getSort.d.ts +10 -0
- package/dist/basic/object/getSort.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 +26 -2
- package/dist/basic/object/index.d.ts +6 -0
- package/dist/basic/object/index.js +25 -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/setSort.cjs +7 -0
- package/dist/basic/object/setSort.d.ts +7 -0
- package/dist/basic/object/setSort.js +7 -0
- 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.d.ts +1 -1
- package/dist/basic/string/splitUpper.d.ts +5 -5
- package/dist/chunk-2OR4FUOA.cjs +47 -0
- package/dist/chunk-2TWAHAYB.js +20 -0
- package/dist/chunk-3CNQO7VA.js +73 -0
- package/dist/chunk-3IR2ABRO.js +8 -0
- package/dist/chunk-3LWFUVER.js +60 -0
- package/dist/{chunk-P3HC3D2H.cjs → chunk-4O7YOSS7.cjs} +5 -5
- package/dist/chunk-4X7AFGTV.cjs +21 -0
- package/dist/chunk-6O6YWEOS.cjs +20 -0
- package/dist/chunk-7AIT4XSD.cjs +13 -0
- package/dist/chunk-7KMW3ZX4.cjs +36 -0
- package/dist/{chunk-7KXJO4NI.js → chunk-APSYRNFU.js} +15 -3
- package/dist/chunk-B4CE4K4W.js +26 -0
- package/dist/chunk-BPJMBYDX.cjs +73 -0
- package/dist/{chunk-PB6FN2XC.cjs → chunk-BYKL65GO.cjs} +24 -0
- package/dist/chunk-D3SX7OUV.cjs +11 -0
- package/dist/chunk-E5FTKWGB.js +112 -0
- package/dist/{chunk-3NFJ3TZL.js → chunk-E75NHLNL.js} +6 -6
- package/dist/chunk-EWXBN4VG.cjs +21 -0
- package/dist/chunk-FGQXKLTH.cjs +67 -0
- package/dist/chunk-GFAUQTB2.cjs +33 -0
- package/dist/chunk-GIAO77MY.js +49 -0
- package/dist/chunk-GOUC2DFA.cjs +8 -0
- package/dist/chunk-IIKQHLKT.cjs +60 -0
- package/dist/chunk-J2GSJKCY.cjs +20 -0
- package/dist/chunk-KQR7FXBF.js +20 -0
- package/dist/chunk-LEPZYF2N.cjs +49 -0
- package/dist/chunk-MGX7U2CG.cjs +20 -0
- package/dist/{chunk-XK2G74PE.cjs → chunk-MMGEI3PX.cjs} +5 -5
- package/dist/chunk-MQHLAQQA.js +21 -0
- package/dist/chunk-N3FZ4WUI.js +16 -0
- package/dist/chunk-NCSN3MC5.js +21 -0
- package/dist/{chunk-PP6UWBUG.js → chunk-NVNNBCS7.js} +4 -4
- 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-SRMXMAFO.cjs +26 -0
- package/dist/chunk-T4BAVDTH.js +31 -0
- package/dist/{chunk-VNVG4BJ4.cjs → chunk-TCMJPIRM.cjs} +16 -12
- package/dist/chunk-TE3XNGF4.cjs +16 -0
- package/dist/{chunk-HQFPDOWY.js → chunk-TYRSVKNE.js} +24 -0
- package/dist/chunk-UFYLVZNU.cjs +31 -0
- package/dist/{chunk-O2RP4UZQ.cjs → chunk-UGFSIZ5P.cjs} +2 -23
- package/dist/chunk-VY5VQ7WE.cjs +21 -0
- package/dist/chunk-WIYZQNGO.js +33 -0
- package/dist/chunk-WPW3M5AP.js +20 -0
- package/dist/{chunk-QKLVFB74.js → chunk-WX3JYE47.js} +2 -23
- package/dist/chunk-XUL6LPTN.js +21 -0
- package/dist/chunk-Y5WYKSYG.js +16 -0
- package/dist/chunk-ZEAT23CI.js +13 -0
- 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/getAttrObj.cjs +7 -0
- package/dist/css/getAttrObj.d.ts +11 -0
- package/dist/css/getAttrObj.js +7 -0
- 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/getSVG.cjs +8 -0
- package/dist/css/getSVG.d.ts +14 -0
- package/dist/css/getSVG.js +8 -0
- package/dist/css/index.cjs +17 -4
- package/dist/css/index.d.ts +3 -0
- package/dist/css/index.js +17 -4
- package/dist/css/setCss.cjs +3 -2
- package/dist/css/setCss.d.ts +9 -1
- package/dist/css/setCss.js +2 -1
- 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/analysisHtml.cjs +8 -0
- package/dist/html/analysisHtml.d.ts +13 -0
- package/dist/html/analysisHtml.js +8 -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 +13 -0
- package/dist/html/index.d.ts +2 -0
- package/dist/html/index.js +13 -0
- package/dist/{index-0bdc2c4f.d.ts → index-071af5d4.d.ts} +2 -2
- package/dist/index-130ae781.d.ts +10 -0
- package/dist/index-5aea66bb.d.ts +21 -0
- package/dist/index-ae0241ec.d.ts +13 -0
- package/dist/{index-82b62caf.d.ts → index-b5d07d0c.d.ts} +9 -0
- package/dist/index-bc08cd32.d.ts +14 -0
- package/dist/index-ed8c0e9f.d.ts +37 -0
- package/dist/index.cjs +61 -30
- package/dist/index.d.ts +31 -12
- package/dist/index.js +62 -31
- package/dist/judge/index.d.ts +1 -1
- package/dist/judge/matchs.d.ts +7 -7
- 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 +1 -1
- package/dist/name/getComponentNames.d.ts +5 -5
- package/dist/name/getComponentNames.js +1 -1
- package/dist/name/getNames.cjs +1 -1
- package/dist/name/getNames.d.ts +5 -5
- package/dist/name/getNames.js +1 -1
- package/dist/name/humpToLine.d.ts +5 -5
- package/dist/name/index.cjs +2 -2
- package/dist/name/index.d.ts +1 -1
- package/dist/name/index.js +2 -2
- 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 +7 -7
- package/dist/urls/index.js +7 -7
- package/package.json +170 -76
- package/dist/chunk-36NQW7GX.cjs +0 -24
- package/dist/chunk-6WSP6FLZ.cjs +0 -8
- package/dist/chunk-7IXRH3MU.js +0 -8
- package/dist/chunk-XQB2HUHZ.js +0 -23
- package/dist/index-fab49d44.d.ts +0 -19
- package/dist/{chunk-Y6WJLQX4.js → chunk-3FHREK6X.js} +6 -6
- package/dist/{chunk-RAPGCAN7.cjs → chunk-EDTINHGX.cjs} +6 -6
- package/dist/{index-110fd300.d.ts → index-445fe401.d.ts} +1 -1
- package/dist/{index-f9cc2ca2.d.ts → index-a65f6120.d.ts} +1 -1
- package/dist/{index-1d6e286f.d.ts → index-eef2a16c.d.ts} +1 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// 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
|
+
export {
|
|
108
|
+
pressEvent,
|
|
109
|
+
shiftEvent,
|
|
110
|
+
foundEvent,
|
|
111
|
+
foundEventCallback
|
|
112
|
+
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
asyncMergeArray
|
|
3
|
-
} from "./chunk-XQB2HUHZ.js";
|
|
4
|
-
import {
|
|
5
|
-
duplicateRemoval
|
|
6
|
-
} from "./chunk-ZVBCHJA5.js";
|
|
7
1
|
import {
|
|
8
2
|
replaceAfter
|
|
9
3
|
} from "./chunk-GOH6G74S.js";
|
|
10
4
|
import {
|
|
11
5
|
toggleArray
|
|
12
6
|
} from "./chunk-GOJN3OQ4.js";
|
|
7
|
+
import {
|
|
8
|
+
asyncMergeArray
|
|
9
|
+
} from "./chunk-Q6FMBSK4.js";
|
|
10
|
+
import {
|
|
11
|
+
duplicateRemoval
|
|
12
|
+
} from "./chunk-ZVBCHJA5.js";
|
|
13
13
|
import {
|
|
14
14
|
isArray
|
|
15
15
|
} from "./chunk-5PX3AFSC.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// 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
|
+
|
|
20
|
+
|
|
21
|
+
exports.htmlEscape = htmlEscape;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/node/getPort.ts
|
|
2
|
+
var _net = require('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 = _net.createServer.call(void 0, ).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
|
+
|
|
66
|
+
|
|
67
|
+
exports.getPort = getPort;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkTE3XNGF4cjs = require('./chunk-TE3XNGF4.cjs');
|
|
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 = _chunkTE3XNGF4cjs.getAttrObj.call(void 0, 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
|
+
|
|
32
|
+
|
|
33
|
+
exports.getSVG = getSVG;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAttrObj
|
|
3
|
+
} from "./chunk-N3FZ4WUI.js";
|
|
4
|
+
|
|
5
|
+
// packages/html/analysisHtml.ts
|
|
6
|
+
function analysisHtml(str) {
|
|
7
|
+
const arr = [];
|
|
8
|
+
getHtml(arr, str);
|
|
9
|
+
return arr;
|
|
10
|
+
}
|
|
11
|
+
function getHtml(arr, str) {
|
|
12
|
+
const reg = /(<\/([a-z|A-Z][^\s|>]*)>)|(<([a-z|A-Z][^\s>/]*)((\s*([^\s="'/|>]+)(=('([^']*)'|"([^"]*)"|([^\s/>]*)))?\s*)*)(>|\/>))/g;
|
|
13
|
+
const rs = reg.exec(str);
|
|
14
|
+
if (rs && rs.length > 0) {
|
|
15
|
+
if (rs.index != 0) {
|
|
16
|
+
arr.push(str.substring(0, rs.index));
|
|
17
|
+
}
|
|
18
|
+
str = str.substring(rs.index + rs[0].length);
|
|
19
|
+
const js = rs[2];
|
|
20
|
+
if (js) {
|
|
21
|
+
return str;
|
|
22
|
+
}
|
|
23
|
+
const obj = {
|
|
24
|
+
div: rs[4],
|
|
25
|
+
attr: rs[5] ? getAttrObj(rs[5]) : void 0,
|
|
26
|
+
value: []
|
|
27
|
+
};
|
|
28
|
+
if (rs[13] == "/>") {
|
|
29
|
+
arr.push(obj);
|
|
30
|
+
} else {
|
|
31
|
+
arr.push(obj);
|
|
32
|
+
if (str) {
|
|
33
|
+
str = getHtml(obj.value, str);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (str) {
|
|
37
|
+
return getHtml(arr, str);
|
|
38
|
+
} else {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
arr.push(str);
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
analysisHtml
|
|
49
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/object/setSort.ts
|
|
2
|
+
function sortAttr(obj, sort, key) {
|
|
3
|
+
const vexports = obj[key] || {};
|
|
4
|
+
const ks = Object.keys(vexports).sort(sort);
|
|
5
|
+
const exports = {};
|
|
6
|
+
ks.forEach((k) => {
|
|
7
|
+
exports[k] = vexports[k];
|
|
8
|
+
});
|
|
9
|
+
obj[key] = exports;
|
|
10
|
+
}
|
|
11
|
+
function sortAttrs(obj, sort, key) {
|
|
12
|
+
if (key instanceof Array) {
|
|
13
|
+
key.forEach((k) => {
|
|
14
|
+
sortAttr(obj, sort, k);
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
sortAttr(obj, sort, key);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getSubAttrs(arr, key) {
|
|
21
|
+
const objarr = [];
|
|
22
|
+
arr.forEach((obj) => {
|
|
23
|
+
Object.keys(obj).forEach((v) => {
|
|
24
|
+
const z = obj[v];
|
|
25
|
+
if (key) {
|
|
26
|
+
if (key instanceof Array && key.includes(v)) {
|
|
27
|
+
objarr.push(z);
|
|
28
|
+
} else if (key === v) {
|
|
29
|
+
objarr.push(z);
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
objarr.push(z);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
return objarr;
|
|
37
|
+
}
|
|
38
|
+
function sortSubAttr(arr, sort, key) {
|
|
39
|
+
arr.forEach((v) => {
|
|
40
|
+
sortAttrs(v, sort, key);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function setSort(obj, sort, ...arr) {
|
|
44
|
+
let objarr = [obj];
|
|
45
|
+
const leg = arr.length;
|
|
46
|
+
for (let index = 0; index < leg; index++) {
|
|
47
|
+
const element = arr[index];
|
|
48
|
+
if (index == leg - 1) {
|
|
49
|
+
if (element) {
|
|
50
|
+
sortSubAttr(objarr, sort, element);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
objarr = getSubAttrs(objarr, element);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
exports.setSort = setSort;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// packages/basic/object/deepCopy.ts
|
|
2
|
+
function deepCopy(obj) {
|
|
3
|
+
const objClone = Array.isArray(obj) ? [] : {};
|
|
4
|
+
if (obj && typeof obj === "object") {
|
|
5
|
+
for (let key in obj) {
|
|
6
|
+
if (obj.hasOwnProperty(key)) {
|
|
7
|
+
if (obj[key] && typeof obj[key] === "object") {
|
|
8
|
+
objClone[key] = deepCopy(obj[key]);
|
|
9
|
+
} else {
|
|
10
|
+
objClone[key] = obj[key];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return objClone;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.deepCopy = deepCopy;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analysisHtml
|
|
3
|
+
} from "./chunk-GIAO77MY.js";
|
|
4
|
+
import {
|
|
5
|
+
htmlEscape
|
|
6
|
+
} from "./chunk-NCSN3MC5.js";
|
|
7
|
+
import {
|
|
8
|
+
__export
|
|
9
|
+
} from "./chunk-UICA3PK6.js";
|
|
10
|
+
|
|
11
|
+
// packages/html/index.ts
|
|
12
|
+
var html_exports = {};
|
|
13
|
+
__export(html_exports, {
|
|
14
|
+
analysisHtml: () => analysisHtml,
|
|
15
|
+
htmlEscape: () => htmlEscape
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
html_exports
|
|
20
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkTE3XNGF4cjs = require('./chunk-TE3XNGF4.cjs');
|
|
4
|
+
|
|
5
|
+
// packages/html/analysisHtml.ts
|
|
6
|
+
function analysisHtml(str) {
|
|
7
|
+
const arr = [];
|
|
8
|
+
getHtml(arr, str);
|
|
9
|
+
return arr;
|
|
10
|
+
}
|
|
11
|
+
function getHtml(arr, str) {
|
|
12
|
+
const reg = /(<\/([a-z|A-Z][^\s|>]*)>)|(<([a-z|A-Z][^\s>/]*)((\s*([^\s="'/|>]+)(=('([^']*)'|"([^"]*)"|([^\s/>]*)))?\s*)*)(>|\/>))/g;
|
|
13
|
+
const rs = reg.exec(str);
|
|
14
|
+
if (rs && rs.length > 0) {
|
|
15
|
+
if (rs.index != 0) {
|
|
16
|
+
arr.push(str.substring(0, rs.index));
|
|
17
|
+
}
|
|
18
|
+
str = str.substring(rs.index + rs[0].length);
|
|
19
|
+
const js = rs[2];
|
|
20
|
+
if (js) {
|
|
21
|
+
return str;
|
|
22
|
+
}
|
|
23
|
+
const obj = {
|
|
24
|
+
div: rs[4],
|
|
25
|
+
attr: rs[5] ? _chunkTE3XNGF4cjs.getAttrObj.call(void 0, rs[5]) : void 0,
|
|
26
|
+
value: []
|
|
27
|
+
};
|
|
28
|
+
if (rs[13] == "/>") {
|
|
29
|
+
arr.push(obj);
|
|
30
|
+
} else {
|
|
31
|
+
arr.push(obj);
|
|
32
|
+
if (str) {
|
|
33
|
+
str = getHtml(obj.value, str);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (str) {
|
|
37
|
+
return getHtml(arr, str);
|
|
38
|
+
} else {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
arr.push(str);
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
exports.analysisHtml = analysisHtml;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkLEPZYF2Ncjs = require('./chunk-LEPZYF2N.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkEWXBN4VGcjs = require('./chunk-EWXBN4VG.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
|
|
10
|
+
|
|
11
|
+
// packages/html/index.ts
|
|
12
|
+
var html_exports = {};
|
|
13
|
+
_chunk5AZGAKWRcjs.__export.call(void 0, html_exports, {
|
|
14
|
+
analysisHtml: () => _chunkLEPZYF2Ncjs.analysisHtml,
|
|
15
|
+
htmlEscape: () => _chunkEWXBN4VGcjs.htmlEscape
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
exports.html_exports = html_exports;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkBYKL65GOcjs = require('./chunk-BYKL65GO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkV3FWFWP2cjs = require('./chunk-V3FWFWP2.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk4O7YOSS7cjs = require('./chunk-4O7YOSS7.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
|
|
@@ -14,8 +14,8 @@ var _chunk5AZGAKWRcjs = require('./chunk-5AZGAKWR.cjs');
|
|
|
14
14
|
// packages/basic/index.ts
|
|
15
15
|
var basic_exports = {};
|
|
16
16
|
_chunk5AZGAKWRcjs.__export.call(void 0, basic_exports, {
|
|
17
|
-
array: () =>
|
|
18
|
-
object: () =>
|
|
17
|
+
array: () => _chunk4O7YOSS7cjs.array_exports,
|
|
18
|
+
object: () => _chunkBYKL65GOcjs.object_exports,
|
|
19
19
|
string: () => _chunkV3FWFWP2cjs.string_exports
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// 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
|
+
export {
|
|
15
|
+
getAttrObj
|
|
16
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
object_exports
|
|
3
|
+
} from "./chunk-TYRSVKNE.js";
|
|
1
4
|
import {
|
|
2
5
|
string_exports
|
|
3
6
|
} from "./chunk-P2CYIUCC.js";
|
|
4
7
|
import {
|
|
5
8
|
array_exports
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
object_exports
|
|
9
|
-
} from "./chunk-HQFPDOWY.js";
|
|
9
|
+
} from "./chunk-E75NHLNL.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
|
+
};
|