@design-edito/tools 0.1.31 → 0.1.33
Sign up to get free protection for your applications and to get access to all the features.
- package/agnostic/css/index.js +3 -3
- package/agnostic/errors/index.js +2 -2
- package/agnostic/html/index.js +11 -11
- package/agnostic/html/sanitize/index.js +4 -4
- package/agnostic/html/selector-to-element/index.js +4 -4
- package/agnostic/html/string-to-nodes/index.js +5 -5
- package/agnostic/misc/index.js +7 -7
- package/agnostic/misc/lorem-ipsum/index.js +2 -2
- package/agnostic/numbers/index.js +3 -3
- package/agnostic/optim/index.js +3 -3
- package/agnostic/strings/index.js +3 -3
- package/agnostic/time/index.js +3 -3
- package/chunks/{chunk-EVOTJ7SU.js → chunk-COLNKMBN.js} +1 -1
- package/chunks/{chunk-NWFX6TEY.js → chunk-EX7FS6IR.js} +2 -2
- package/chunks/{chunk-CB52KVOZ.js → chunk-UDY37VIJ.js} +1 -1
- package/chunks/{chunk-WABWQCFE.js → chunk-WXXW6YLW.js} +1 -1
- package/package.json +1 -2
- package/agnostic/html/hyper-json/crossenv/index.d.ts +0 -13
- package/agnostic/html/hyper-json/crossenv/index.js +0 -6
- package/agnostic/misc/crossenv/get-document/index.d.ts +0 -2
- package/agnostic/misc/crossenv/get-document/index.js +0 -7
- package/agnostic/misc/crossenv/get-window/browser.d.ts +0 -2
- package/agnostic/misc/crossenv/get-window/index.d.ts +0 -2
- package/agnostic/misc/crossenv/get-window/index.js +0 -6
- package/agnostic/misc/crossenv/types.d.ts +0 -3
- package/chunks/chunk-2DMWYLFG.js +0 -16
- package/chunks/chunk-2PI5AZIL.js +0 -211
- package/chunks/chunk-2UYTYTX4.js +0 -31
- package/chunks/chunk-3KQRMKQJ.js +0 -27
- package/chunks/chunk-3LVR6KZH.js +0 -22
- package/chunks/chunk-3PHPA25U.js +0 -18
- package/chunks/chunk-3PM7GZ6B.js +0 -33
- package/chunks/chunk-3SQJEEBK.js +0 -642
- package/chunks/chunk-3UURICGY.js +0 -211
- package/chunks/chunk-3X6RXJBR.js +0 -37
- package/chunks/chunk-4F7ZVE7T.js +0 -332
- package/chunks/chunk-4GUDL44X.js +0 -13
- package/chunks/chunk-4QQBKBYH.js +0 -59
- package/chunks/chunk-4RDW62CU.js +0 -36
- package/chunks/chunk-5IR2PWO6.js +0 -211
- package/chunks/chunk-6CM2SWSX.js +0 -35
- package/chunks/chunk-6EYBQHJS.js +0 -33
- package/chunks/chunk-6NZCBAT4.js +0 -19
- package/chunks/chunk-6R54C426.js +0 -35
- package/chunks/chunk-6V23XMYE.js +0 -982
- package/chunks/chunk-73V5RDSG.js +0 -13
- package/chunks/chunk-7IGZP4TV.js +0 -30
- package/chunks/chunk-7QMAYGNV.js +0 -25
- package/chunks/chunk-7YW5HL6N.js +0 -168
- package/chunks/chunk-AFFLZUW5.js +0 -33
- package/chunks/chunk-AMS3FB24.js +0 -85
- package/chunks/chunk-APWPG7BU.js +0 -647
- package/chunks/chunk-AXMPRLPI.js +0 -35
- package/chunks/chunk-B2O7PFSF.js +0 -1108
- package/chunks/chunk-B6CSCX7J.js +0 -278
- package/chunks/chunk-B74HAAS6.js +0 -35
- package/chunks/chunk-BDHNULU7.js +0 -211
- package/chunks/chunk-BEJSITDG.js +0 -31
- package/chunks/chunk-BNB7LEMQ.js +0 -35
- package/chunks/chunk-CECF6UZV.js +0 -29
- package/chunks/chunk-DBAJ66BR.js +0 -18
- package/chunks/chunk-DGQLPQS2.js +0 -33
- package/chunks/chunk-DLLTITVO.js +0 -33
- package/chunks/chunk-DMDOCC72.js +0 -18
- package/chunks/chunk-DRH7Q4FL.js +0 -127
- package/chunks/chunk-DRNK3RLE.js +0 -64
- package/chunks/chunk-EAY65ZP6.js +0 -22
- package/chunks/chunk-EW46EXFB.js +0 -8
- package/chunks/chunk-F5YMP5WU.js +0 -18
- package/chunks/chunk-F7EVMWVG.js +0 -27
- package/chunks/chunk-F7XWUG2V.js +0 -18
- package/chunks/chunk-FFOATPL4.js +0 -211
- package/chunks/chunk-FSCSFZOD.js +0 -647
- package/chunks/chunk-FWHUASVA.js +0 -22
- package/chunks/chunk-G2NZXHW6.js +0 -21
- package/chunks/chunk-GDYVCEWA.js +0 -38
- package/chunks/chunk-GNBIAWSY.js +0 -278
- package/chunks/chunk-GQSPY2CV.js +0 -19
- package/chunks/chunk-HDALT7XM.js +0 -620
- package/chunks/chunk-HEJV6JIO.js +0 -133
- package/chunks/chunk-HENMQK5Y.js +0 -647
- package/chunks/chunk-HFEOHBYG.js +0 -647
- package/chunks/chunk-HGECIEKD.js +0 -35
- package/chunks/chunk-HUKHWFVL.js +0 -19
- package/chunks/chunk-IGD53YL5.js +0 -870
- package/chunks/chunk-ILEM73XB.js +0 -981
- package/chunks/chunk-IPB3U2PD.js +0 -278
- package/chunks/chunk-JAST3E5G.js +0 -647
- package/chunks/chunk-JY3QZ2YO.js +0 -211
- package/chunks/chunk-K3OQEJI3.js +0 -33
- package/chunks/chunk-KN4RZPDY.js +0 -211
- package/chunks/chunk-KXBKJ3GS.js +0 -642
- package/chunks/chunk-L7SL3MND.js +0 -35
- package/chunks/chunk-LCFDDWJR.js +0 -278
- package/chunks/chunk-LFUY5AWK.js +0 -1108
- package/chunks/chunk-LGECI2WL.js +0 -306
- package/chunks/chunk-LGUEB5L5.js +0 -211
- package/chunks/chunk-LI6QDZCA.js +0 -211
- package/chunks/chunk-LYMZZ4BB.js +0 -22
- package/chunks/chunk-MDEDNPU5.js +0 -38
- package/chunks/chunk-MQHKEGP4.js +0 -33
- package/chunks/chunk-NF5ACCXZ.js +0 -211
- package/chunks/chunk-NFUY7SLX.js +0 -211
- package/chunks/chunk-NK557MKV.js +0 -35
- package/chunks/chunk-NWMEWFTK.js +0 -33
- package/chunks/chunk-O5OTBN22.js +0 -35
- package/chunks/chunk-O7MDUYEF.js +0 -211
- package/chunks/chunk-OO5SJJDW.js +0 -35
- package/chunks/chunk-OVG5RGI3.js +0 -29
- package/chunks/chunk-OWRQ3QBI.js +0 -211
- package/chunks/chunk-PO3V3I57.js +0 -23
- package/chunks/chunk-PXB7U2DH.js +0 -31
- package/chunks/chunk-Q52UJOBC.js +0 -18
- package/chunks/chunk-QFEF4EET.js +0 -211
- package/chunks/chunk-QHSVCGLD.js +0 -280
- package/chunks/chunk-QO64L4KB.js +0 -97
- package/chunks/chunk-R6KCN6CK.js +0 -40
- package/chunks/chunk-RHYLRLKT.js +0 -211
- package/chunks/chunk-RJ5E22H5.js +0 -15
- package/chunks/chunk-RWUPHV54.js +0 -25
- package/chunks/chunk-S2757FI3.js +0 -36
- package/chunks/chunk-S42P73SC.js +0 -30
- package/chunks/chunk-S5XDYLJH.js +0 -18
- package/chunks/chunk-S7MJLTCR.js +0 -211
- package/chunks/chunk-SCM6NACT.js +0 -15
- package/chunks/chunk-SFV2NYY4.js +0 -211
- package/chunks/chunk-SH3Y2I5P.js +0 -18
- package/chunks/chunk-SMLKMOAX.js +0 -18
- package/chunks/chunk-SQZGZ3VT.js +0 -15
- package/chunks/chunk-T5CGXYST.js +0 -647
- package/chunks/chunk-TATRVKBS.js +0 -211
- package/chunks/chunk-TRB6DPKJ.js +0 -35
- package/chunks/chunk-UFKH5WD2.js +0 -21
- package/chunks/chunk-UODQZRY2.js +0 -620
- package/chunks/chunk-UOULDS6J.js +0 -33
- package/chunks/chunk-UPHVZROF.js +0 -35
- package/chunks/chunk-UUDXUSI5.js +0 -211
- package/chunks/chunk-UWAMSJ2X.js +0 -28
- package/chunks/chunk-UZUXLD2Q.js +0 -35
- package/chunks/chunk-VA6HXRX4.js +0 -211
- package/chunks/chunk-VRUJR6WR.js +0 -39
- package/chunks/chunk-W6YBEEZM.js +0 -211
- package/chunks/chunk-WECTUHS5.js +0 -127
- package/chunks/chunk-YE5HI3RK.js +0 -211
- package/chunks/chunk-YEBOL67V.js +0 -32
- package/chunks/chunk-YRGOY5YU.js +0 -1108
- package/chunks/chunk-YYE2MVZO.js +0 -211
- package/chunks/chunk-ZB73RE7P.js +0 -35
- package/chunks/chunk-ZONKYNKA.js +0 -28
- package/chunks/{chunk-GPWFYPER.js → chunk-5HWYTIYR.js} +3 -3
- package/chunks/{chunk-MUGIN5OW.js → chunk-MZSIKE3H.js} +3 -3
package/chunks/chunk-HEJV6JIO.js
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
// src/agnostic/misc/logs/index.ts
|
2
|
-
import chalk from "chalk";
|
3
|
-
var Logs;
|
4
|
-
((Logs2) => {
|
5
|
-
function makeTextBlock(text, vPadding = 1, hPadding = vPadding) {
|
6
|
-
const lines = text.split("\n");
|
7
|
-
const longestLine = Math.max(...lines.map((line) => line.length));
|
8
|
-
const textBlockArr = new Array(lines.length + 2 * vPadding).fill(null).map(() => new Array(longestLine + hPadding * 2).fill(" "));
|
9
|
-
lines.forEach((line, linePos) => {
|
10
|
-
const chars = line.split("");
|
11
|
-
textBlockArr[linePos + vPadding]?.splice(hPadding, chars.length, ...chars);
|
12
|
-
});
|
13
|
-
return textBlockArr.map((lineArr) => lineArr.join("")).join("\n");
|
14
|
-
}
|
15
|
-
Logs2.makeTextBlock = makeTextBlock;
|
16
|
-
Logs2.styles = {
|
17
|
-
regular: (text) => text,
|
18
|
-
light: (text) => chalk.grey(text),
|
19
|
-
danger: (text) => chalk.bold.bgRed.whiteBright(makeTextBlock(`/!\\
|
20
|
-
|
21
|
-
${text}
|
22
|
-
`, 2, 6)),
|
23
|
-
important: (text) => chalk.bold(text),
|
24
|
-
title: (text) => `# ${chalk.bold.underline(`${text}
|
25
|
-
`)}`,
|
26
|
-
info: (text) => chalk.blueBright(text),
|
27
|
-
success: (text) => chalk.greenBright(text),
|
28
|
-
error: (text) => chalk.red(text),
|
29
|
-
warning: (text) => chalk.yellow(text)
|
30
|
-
};
|
31
|
-
const logsTimeOrigin = /* @__PURE__ */ new Date();
|
32
|
-
class Log {
|
33
|
-
type;
|
34
|
-
data;
|
35
|
-
time;
|
36
|
-
stack;
|
37
|
-
constructor(type, data) {
|
38
|
-
this.type = type;
|
39
|
-
this.data = data;
|
40
|
-
this.time = /* @__PURE__ */ new Date();
|
41
|
-
this.stack = new Error().stack ?? "";
|
42
|
-
}
|
43
|
-
get displayTime() {
|
44
|
-
return this.time.toLocaleDateString("en-US", {
|
45
|
-
year: "numeric",
|
46
|
-
month: "short",
|
47
|
-
day: "numeric",
|
48
|
-
weekday: "short",
|
49
|
-
hour: "numeric",
|
50
|
-
minute: "numeric",
|
51
|
-
second: "numeric"
|
52
|
-
}) + `:${this.time.getMilliseconds()}`;
|
53
|
-
}
|
54
|
-
get elapsedTimeMs() {
|
55
|
-
return (this.time.getTime() - logsTimeOrigin.getTime()) / 1e3;
|
56
|
-
}
|
57
|
-
get displayStack() {
|
58
|
-
return this.stack.split("\n").map((line) => line.trim()).slice(4).join("\n");
|
59
|
-
}
|
60
|
-
}
|
61
|
-
class Logger {
|
62
|
-
_private_threads = /* @__PURE__ */ new Map();
|
63
|
-
constructor() {
|
64
|
-
this.dir = this.dir.bind(this);
|
65
|
-
this.error = this.error.bind(this);
|
66
|
-
this.log = this.log.bind(this);
|
67
|
-
this.warn = this.warn.bind(this);
|
68
|
-
this.setLog = this.setLog.bind(this);
|
69
|
-
this.print = this.print.bind(this);
|
70
|
-
this.printThreads = this.printThreads.bind(this);
|
71
|
-
}
|
72
|
-
// assert (thread: string = '', ...args: ConsoleMethodsParams['assert']) { this.setLog(thread, 'assert', args) }
|
73
|
-
// count (thread: string = '', ...args: ConsoleMethodsParams['count']) { this.setLog(thread, 'count', args) }
|
74
|
-
// countReset (thread: string = '', ...args: ConsoleMethodsParams['countReset']) { this.setLog(thread, 'countReset', args) }
|
75
|
-
// debug (thread: string = '', ...args: ConsoleMethodsParams['debug']) { this.setLog(thread, 'debug', args) }
|
76
|
-
dir(thread = "", ...args) {
|
77
|
-
this.setLog(thread, "dir", args);
|
78
|
-
}
|
79
|
-
// dirxml (thread: string = '', ...args: ConsoleMethodsParams['dirxml']) { this.setLog(thread, 'dirxml', args) }
|
80
|
-
error(thread = "", ...args) {
|
81
|
-
this.setLog(thread, "error", args);
|
82
|
-
}
|
83
|
-
// group (thread: string = '', ...args: ConsoleMethodsParams['group']) { this.setLog(thread, 'group', args) }
|
84
|
-
// groupCollapsed (thread: string = '', ...args: ConsoleMethodsParams['groupCollapsed']) { this.setLog(thread, 'groupCollapsed', args) }
|
85
|
-
// groupEnd (thread: string = '', ...args: ConsoleMethodsParams['groupEnd']) { this.setLog(thread, 'groupEnd', args) }
|
86
|
-
// info (thread: string = '', ...args: ConsoleMethodsParams['info']) { this.setLog(thread, 'info', args) }
|
87
|
-
log(thread = "", ...args) {
|
88
|
-
this.setLog(thread, "log", args);
|
89
|
-
}
|
90
|
-
// table (thread: string = '', ...args: ConsoleMethodsParams['table']) { this.setLog(thread, 'table', args) }
|
91
|
-
// time (thread: string = '', ...args: ConsoleMethodsParams['time']) { this.setLog(thread, 'time', args) }
|
92
|
-
// timeEnd (thread: string = '', ...args: ConsoleMethodsParams['timeEnd']) { this.setLog(thread, 'timeEnd', args) }
|
93
|
-
// trace (thread: string = '', ...args: ConsoleMethodsParams['trace']) { this.setLog(thread, 'trace', args) }
|
94
|
-
warn(thread = "", ...args) {
|
95
|
-
this.setLog(thread, "warn", args);
|
96
|
-
}
|
97
|
-
setLog(threadName, type, data) {
|
98
|
-
const log = new Log(type, data);
|
99
|
-
const thread = this._private_threads.get(threadName) ?? [];
|
100
|
-
this._private_threads.set(threadName, [...thread, log]);
|
101
|
-
return this;
|
102
|
-
}
|
103
|
-
print(threadFilter, withStack) {
|
104
|
-
const allLogs = Array.from(this._private_threads.entries()).map(([threadName, logs]) => logs.map((log) => ({ threadName, log }))).flat().sort((eltA, eltB) => eltA.log.time.getTime() - eltB.log.time.getTime()).filter(({ threadName }) => {
|
105
|
-
if (threadFilter === void 0) return true;
|
106
|
-
return threadName === threadFilter;
|
107
|
-
});
|
108
|
-
allLogs.forEach(({ threadName, log }) => {
|
109
|
-
console.log(`%c${threadName}`, "font-weight: 800; color: white; background: black; padding: 4px;", `+${log.elapsedTimeMs}s \u2013`, log.displayTime);
|
110
|
-
if (withStack === true) console.log(`%c${log.displayStack}`, "color: grey; font-size: inherit;");
|
111
|
-
console[log.type](...log.data);
|
112
|
-
console.log("");
|
113
|
-
});
|
114
|
-
}
|
115
|
-
printThreads(withStack) {
|
116
|
-
Array.from(this._private_threads.entries()).forEach(([threadName, logs]) => {
|
117
|
-
console.group(`%c${threadName}`, "font-weight: 800; color: white; background: black; padding: 4px;");
|
118
|
-
logs.forEach((log) => {
|
119
|
-
console.log(`+${log.elapsedTimeMs}s \u2013`, log.displayTime);
|
120
|
-
if (withStack === true) console.log(`%c${log.displayStack}`, "color: grey; font-size: inherit;");
|
121
|
-
console[log.type](...log.data);
|
122
|
-
console.log("");
|
123
|
-
});
|
124
|
-
console.groupEnd();
|
125
|
-
});
|
126
|
-
}
|
127
|
-
}
|
128
|
-
Logs2.Logger = Logger;
|
129
|
-
})(Logs || (Logs = {}));
|
130
|
-
|
131
|
-
export {
|
132
|
-
Logs
|
133
|
-
};
|