@design-edito/tools 0.0.32 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. package/agnostic/arrays/index.d.ts +11 -0
  2. package/{utils/agnostic → agnostic/arrays}/is-array-of/index.d.ts +2 -2
  3. package/agnostic/arrays/is-array-of/index.js +23 -0
  4. package/agnostic/async/index.d.ts +8 -0
  5. package/agnostic/async/index.js +20 -0
  6. package/agnostic/async/timeout-call/index.d.ts +1 -0
  7. package/agnostic/async/timeout-call/index.js +6 -0
  8. package/agnostic/async/transitions/index.d.ts +41 -0
  9. package/agnostic/async/transitions/index.js +7 -0
  10. package/agnostic/async/wait/index.d.ts +1 -0
  11. package/agnostic/async/wait/index.js +6 -0
  12. package/agnostic/booleans/index.d.ts +8 -0
  13. package/agnostic/booleans/index.js +17 -0
  14. package/{utils/agnostic → agnostic/booleans}/is-falsy/index.d.ts +1 -2
  15. package/agnostic/booleans/is-falsy/index.js +11 -0
  16. package/agnostic/css/bem/index.d.ts +7 -0
  17. package/agnostic/css/bem/index.js +9 -0
  18. package/{utils/agnostic → agnostic/css}/generate-nice-color/index.d.ts +0 -1
  19. package/agnostic/css/generate-nice-color/index.js +8 -0
  20. package/agnostic/css/index.d.ts +14 -0
  21. package/agnostic/css/index.js +177 -0
  22. package/agnostic/css/is-valid-css-class-name/index.d.ts +2 -0
  23. package/agnostic/css/is-valid-css-class-name/index.js +8 -0
  24. package/agnostic/css/styles-set/index.d.ts +37 -0
  25. package/agnostic/errors/index.d.ts +30 -0
  26. package/agnostic/errors/index.js +6 -0
  27. package/agnostic/html/get-node-ancestors/index.d.ts +1 -0
  28. package/agnostic/html/get-node-ancestors/index.js +6 -0
  29. package/agnostic/html/get-position-inside-parent/index.d.ts +1 -0
  30. package/agnostic/html/get-position-inside-parent/index.js +6 -0
  31. package/agnostic/html/index.d.ts +17 -0
  32. package/agnostic/html/index.js +39 -0
  33. package/agnostic/html/insert-node/index.d.ts +2 -0
  34. package/agnostic/html/insert-node/index.js +6 -0
  35. package/agnostic/html/placeholders/index.d.ts +9 -0
  36. package/agnostic/html/placeholders/index.js +6 -0
  37. package/agnostic/html/sanitize/index.d.ts +24 -0
  38. package/agnostic/html/sanitize/index.js +9 -0
  39. package/agnostic/html/selector-to-element/index.d.ts +1 -0
  40. package/agnostic/html/selector-to-element/index.js +9 -0
  41. package/agnostic/html/string-to-nodes/index.d.ts +7 -0
  42. package/agnostic/html/string-to-nodes/index.js +10 -0
  43. package/agnostic/index.d.ts +26 -0
  44. package/agnostic/misc/assert/index.d.ts +5 -0
  45. package/agnostic/misc/assert/index.js +6 -0
  46. package/agnostic/misc/cast/index.d.ts +9 -0
  47. package/agnostic/misc/cast/index.js +8 -0
  48. package/agnostic/misc/crossenv/index.d.ts +13 -0
  49. package/agnostic/misc/crossenv/index.js +6 -0
  50. package/agnostic/misc/get-current-downlink/index.d.ts +1 -0
  51. package/agnostic/misc/get-current-downlink/index.js +6 -0
  52. package/agnostic/misc/index.d.ts +22 -0
  53. package/agnostic/misc/index.js +45 -0
  54. package/{utils/agnostic → agnostic/misc}/is-constructor-function/index.d.ts +1 -1
  55. package/agnostic/misc/is-constructor-function/index.js +6 -0
  56. package/{utils/agnostic → agnostic/misc}/is-nullish/index.d.ts +0 -1
  57. package/agnostic/misc/is-nullish/index.js +10 -0
  58. package/agnostic/misc/logs/index.d.ts +55 -0
  59. package/agnostic/misc/logs/index.js +6 -0
  60. package/agnostic/misc/random/index.d.ts +10 -0
  61. package/agnostic/misc/random/index.js +6 -0
  62. package/agnostic/numbers/absolute-modulo/index.d.ts +1 -0
  63. package/agnostic/numbers/absolute-modulo/index.js +6 -0
  64. package/agnostic/numbers/clamp/index.d.ts +1 -0
  65. package/agnostic/numbers/clamp/index.js +6 -0
  66. package/agnostic/numbers/index.d.ts +13 -0
  67. package/agnostic/numbers/index.js +30 -0
  68. package/agnostic/numbers/interpolate/index.d.ts +1 -0
  69. package/agnostic/numbers/interpolate/index.js +6 -0
  70. package/agnostic/numbers/responsive-harmonics/index.js +9 -0
  71. package/agnostic/numbers/round/index.d.ts +1 -0
  72. package/agnostic/numbers/round/index.js +6 -0
  73. package/agnostic/objects/enums/index.d.ts +4 -0
  74. package/agnostic/objects/enums/index.js +7 -0
  75. package/agnostic/objects/enums/is-in-enum/index.d.ts +1 -0
  76. package/agnostic/objects/enums/is-in-enum/index.js +6 -0
  77. package/agnostic/objects/flatten-getters/index.d.ts +1 -0
  78. package/agnostic/objects/flatten-getters/index.js +9 -0
  79. package/agnostic/objects/index.d.ts +12 -0
  80. package/agnostic/objects/index.js +32 -0
  81. package/agnostic/objects/is-object/index.d.ts +1 -0
  82. package/agnostic/objects/is-object/index.js +6 -0
  83. package/agnostic/objects/is-record/index.d.ts +1 -0
  84. package/agnostic/objects/is-record/index.js +6 -0
  85. package/agnostic/objects/record-format/index.d.ts +11 -0
  86. package/agnostic/objects/record-format/index.js +16 -0
  87. package/agnostic/objects/validation/index.d.ts +3 -0
  88. package/agnostic/objects/validation/index.js +6 -0
  89. package/agnostic/optim/index.d.ts +7 -0
  90. package/agnostic/optim/index.js +18 -0
  91. package/{utils/agnostic → agnostic/optim}/memoize/index.d.ts +1 -1
  92. package/agnostic/optim/memoize/index.js +6 -0
  93. package/agnostic/optim/throttle-debounce/index.js +8 -0
  94. package/{utils/agnostic → agnostic/optim}/throttle-debounce/types.d.ts +0 -1
  95. package/agnostic/regexps/index.d.ts +23 -0
  96. package/agnostic/regexps/index.js +89 -0
  97. package/agnostic/strings/char-codes/index.d.ts +17 -0
  98. package/agnostic/strings/char-codes/index.js +6 -0
  99. package/agnostic/strings/index.d.ts +14 -0
  100. package/agnostic/strings/index.js +32 -0
  101. package/agnostic/strings/matches/index.d.ts +3 -0
  102. package/agnostic/strings/matches/index.js +10 -0
  103. package/agnostic/strings/normalize-indent/index.d.ts +1 -0
  104. package/agnostic/strings/normalize-indent/index.js +6 -0
  105. package/{utils/agnostic → agnostic/strings}/replace-all/index.d.ts +1 -1
  106. package/agnostic/strings/replace-all/index.js +6 -0
  107. package/agnostic/strings/to-alphanum/index.d.ts +1 -0
  108. package/agnostic/strings/to-alphanum/index.js +6 -0
  109. package/chunks/chunk-32IRF4OP.js +9 -0
  110. package/chunks/chunk-34U4HX4V.js +73 -0
  111. package/chunks/chunk-4GDNHUCZ.js +162 -0
  112. package/chunks/chunk-4QQBKBYH.js +59 -0
  113. package/chunks/chunk-4VC5PT5T.js +13 -0
  114. package/chunks/chunk-5LNUCDQ6.js +132 -0
  115. package/chunks/chunk-7AWTHZLY.js +12 -0
  116. package/chunks/chunk-7DBNMU6N.js +14 -0
  117. package/chunks/chunk-7YW5HL6N.js +168 -0
  118. package/chunks/chunk-COVPTTAD.js +10 -0
  119. package/chunks/chunk-DNIOWD7K.js +8 -0
  120. package/chunks/chunk-DQNJQBC6.js +10 -0
  121. package/chunks/chunk-E6MSDKON.js +13 -0
  122. package/chunks/chunk-EDVNAV3G.js +72 -0
  123. package/chunks/chunk-EW46EXFB.js +8 -0
  124. package/chunks/chunk-FPEW3A27.js +14 -0
  125. package/chunks/chunk-GJOU3UAL.js +36 -0
  126. package/chunks/chunk-HC6ZOHCS.js +14 -0
  127. package/chunks/chunk-HGCG2J77.js +122 -0
  128. package/chunks/chunk-IFD7GSGK.js +130 -0
  129. package/chunks/chunk-JQXNEJAP.js +18 -0
  130. package/chunks/chunk-JWBDZPQG.js +18 -0
  131. package/chunks/chunk-K37RALUX.js +8 -0
  132. package/chunks/chunk-KQT5CTGF.js +21 -0
  133. package/chunks/chunk-LEXQ6E6L.js +31 -0
  134. package/chunks/chunk-LQFKUNVQ.js +19 -0
  135. package/chunks/chunk-MF56TTC5.js +15 -0
  136. package/chunks/chunk-MT74WIQR.js +41 -0
  137. package/chunks/chunk-NRITRUZW.js +10 -0
  138. package/chunks/chunk-NRJQKVQV.js +31 -0
  139. package/chunks/chunk-OSAXBA7G.js +10 -0
  140. package/chunks/chunk-PO3V3I57.js +23 -0
  141. package/chunks/chunk-QXAJXTXV.js +19 -0
  142. package/chunks/chunk-RCO57B6F.js +9 -0
  143. package/chunks/chunk-SQZGZ3VT.js +15 -0
  144. package/chunks/chunk-UYTXXUU7.js +54 -0
  145. package/chunks/chunk-VTPRO4NJ.js +10 -0
  146. package/chunks/chunk-VYW4IADX.js +35 -0
  147. package/chunks/chunk-VZDUZTW6.js +113 -0
  148. package/chunks/chunk-W5A2TON3.js +10 -0
  149. package/chunks/chunk-W7YBGJ4H.js +28 -0
  150. package/chunks/chunk-WLL3FNVL.js +40 -0
  151. package/chunks/chunk-WOAYU6LB.js +13 -0
  152. package/chunks/chunk-XA4HVHJ4.js +18 -0
  153. package/chunks/chunk-XN3PZIVL.js +38 -0
  154. package/chunks/chunk-YDIBNEGA.js +9 -0
  155. package/components/index.d.ts +4 -0
  156. package/index.d.ts +3 -0
  157. package/node/files/index.d.ts +9 -0
  158. package/node/files/index.js +21 -0
  159. package/node/files/is-in-directory/index.d.ts +1 -0
  160. package/node/files/is-in-directory/index.js +6 -0
  161. package/node/files/read-write/index.d.ts +9 -0
  162. package/node/files/read-write/index.js +6 -0
  163. package/node/files/subpaths/index.d.ts +34 -0
  164. package/node/files/subpaths/index.js +7 -0
  165. package/node/index.d.ts +6 -0
  166. package/node/process/index.d.ts +8 -0
  167. package/node/process/index.js +20 -0
  168. package/{utils/node/process-exit → node/process/on-exit}/index.d.ts +1 -1
  169. package/node/process/on-exit/index.js +14 -0
  170. package/package.json +12 -12
  171. package/shared/errors/index.d.ts +14 -0
  172. package/shared/index.d.ts +0 -0
  173. package/chunks/chunk-BEZTX3QU.js +0 -1
  174. package/chunks/chunk-BW5CY5YB.js +0 -1
  175. package/chunks/chunk-DIPJ73JH.js +0 -1
  176. package/chunks/chunk-EFFU6KXJ.js +0 -1
  177. package/chunks/chunk-KNE7WIIW.js +0 -1
  178. package/chunks/chunk-LCLAV6Q2.js +0 -1
  179. package/chunks/chunk-PCAKH6ZJ.js +0 -1
  180. package/chunks/chunk-QQRJPDR7.js +0 -1
  181. package/chunks/chunk-WZBNXYN3.js +0 -1
  182. package/chunks/chunk-XCKXCF4A.js +0 -1
  183. package/chunks/chunk-ZVJO36JU.js +0 -1
  184. package/components/Comp/index.js +0 -1
  185. package/index.js +0 -94
  186. package/utils/agnostic/absolute-modulo/index.d.ts +0 -1
  187. package/utils/agnostic/absolute-modulo/index.js +0 -1
  188. package/utils/agnostic/array/index.d.ts +0 -7
  189. package/utils/agnostic/array/index.js +0 -1
  190. package/utils/agnostic/assert/index.d.ts +0 -3
  191. package/utils/agnostic/assert/index.js +0 -1
  192. package/utils/agnostic/await-timeout/index.d.ts +0 -2
  193. package/utils/agnostic/await-timeout/index.js +0 -1
  194. package/utils/agnostic/bem/index.d.ts +0 -5
  195. package/utils/agnostic/bem/index.js +0 -1
  196. package/utils/agnostic/cast/index.d.ts +0 -7
  197. package/utils/agnostic/cast/index.js +0 -1
  198. package/utils/agnostic/charcode-string/index.d.ts +0 -2
  199. package/utils/agnostic/charcode-string/index.js +0 -1
  200. package/utils/agnostic/clamp/index.d.ts +0 -1
  201. package/utils/agnostic/clamp/index.js +0 -1
  202. package/utils/agnostic/clientside-html-sanitizer/index.d.ts +0 -22
  203. package/utils/agnostic/clientside-html-sanitizer/index.js +0 -1
  204. package/utils/agnostic/crossenv/index.d.ts +0 -11
  205. package/utils/agnostic/crossenv/index.js +0 -1
  206. package/utils/agnostic/flatten-getters/index.d.ts +0 -1
  207. package/utils/agnostic/flatten-getters/index.js +0 -1
  208. package/utils/agnostic/generate-html-placeholders/index.d.ts +0 -7
  209. package/utils/agnostic/generate-html-placeholders/index.js +0 -5
  210. package/utils/agnostic/generate-nice-color/index.js +0 -1
  211. package/utils/agnostic/insert-node/index.d.ts +0 -2
  212. package/utils/agnostic/insert-node/index.js +0 -1
  213. package/utils/agnostic/interpolate/index.d.ts +0 -3
  214. package/utils/agnostic/interpolate/index.js +0 -1
  215. package/utils/agnostic/is-array-of/index.js +0 -1
  216. package/utils/agnostic/is-constructor-function/index.js +0 -1
  217. package/utils/agnostic/is-falsy/index.js +0 -1
  218. package/utils/agnostic/is-in-enum/index.d.ts +0 -1
  219. package/utils/agnostic/is-in-enum/index.js +0 -1
  220. package/utils/agnostic/is-nullish/index.js +0 -1
  221. package/utils/agnostic/is-object/index.d.ts +0 -1
  222. package/utils/agnostic/is-object/index.js +0 -1
  223. package/utils/agnostic/is-record/index.d.ts +0 -1
  224. package/utils/agnostic/is-record/index.js +0 -1
  225. package/utils/agnostic/is-valid-css-class-name/index.d.ts +0 -2
  226. package/utils/agnostic/is-valid-css-class-name/index.js +0 -1
  227. package/utils/agnostic/memoize/index.js +0 -1
  228. package/utils/agnostic/object-validate-from-partial/index.d.ts +0 -1
  229. package/utils/agnostic/object-validate-from-partial/index.js +0 -1
  230. package/utils/agnostic/random/index.d.ts +0 -9
  231. package/utils/agnostic/random/index.js +0 -1
  232. package/utils/agnostic/record-format/index.d.ts +0 -6
  233. package/utils/agnostic/record-format/index.js +0 -1
  234. package/utils/agnostic/regexp/index.d.ts +0 -21
  235. package/utils/agnostic/regexp/index.js +0 -1
  236. package/utils/agnostic/replace-all/index.js +0 -1
  237. package/utils/agnostic/responsive-harmonics/index.js +0 -1
  238. package/utils/agnostic/round-numbers/index.d.ts +0 -1
  239. package/utils/agnostic/round-numbers/index.js +0 -1
  240. package/utils/agnostic/selector-to-element/index.d.ts +0 -1
  241. package/utils/agnostic/selector-to-element/index.js +0 -1
  242. package/utils/agnostic/silent-log/index.d.ts +0 -53
  243. package/utils/agnostic/silent-log/index.js +0 -9
  244. package/utils/agnostic/str-to-nodes/index.d.ts +0 -7
  245. package/utils/agnostic/str-to-nodes/index.js +0 -1
  246. package/utils/agnostic/string-matches/index.d.ts +0 -4
  247. package/utils/agnostic/string-matches/index.js +0 -1
  248. package/utils/agnostic/throttle-debounce/index.js +0 -1
  249. package/utils/agnostic/to-alphanum/index.d.ts +0 -1
  250. package/utils/agnostic/to-alphanum/index.js +0 -1
  251. package/utils/agnostic/transition/index.d.ts +0 -39
  252. package/utils/agnostic/transition/index.js +0 -1
  253. package/utils/agnostic/wait/index.d.ts +0 -1
  254. package/utils/agnostic/wait/index.js +0 -1
  255. package/utils/browser/dynamic-css/index.d.ts +0 -4
  256. package/utils/browser/dynamic-css/index.js +0 -2
  257. package/utils/browser/get-current-downlink/index.d.ts +0 -1
  258. package/utils/browser/get-current-downlink/index.js +0 -1
  259. package/utils/browser/get-node-ancestors/index.d.ts +0 -1
  260. package/utils/browser/get-node-ancestors/index.js +0 -1
  261. package/utils/node/is-in-directory/index.d.ts +0 -1
  262. package/utils/node/is-in-directory/index.js +0 -1
  263. package/utils/node/list-subpaths/index.d.ts +0 -33
  264. package/utils/node/list-subpaths/index.js +0 -1
  265. package/utils/node/process-exit/index.js +0 -1
  266. package/utils/node/read-write-file/index.d.ts +0 -12
  267. package/utils/node/read-write-file/index.js +0 -1
  268. /package/{utils/agnostic → agnostic/css}/bem/BEM.d.ts +0 -0
  269. /package/{utils/agnostic → agnostic/css}/bem/getNamesArr.d.ts +0 -0
  270. /package/{utils/agnostic → agnostic/numbers}/responsive-harmonics/index.d.ts +0 -0
  271. /package/{utils/agnostic → agnostic/optim}/throttle-debounce/index.d.ts +0 -0
@@ -0,0 +1,132 @@
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
+ error: (text) => chalk.red(text),
28
+ warning: (text) => chalk.yellow(text)
29
+ };
30
+ const logsTimeOrigin = /* @__PURE__ */ new Date();
31
+ class Log {
32
+ type;
33
+ data;
34
+ time;
35
+ stack;
36
+ constructor(type, data) {
37
+ this.type = type;
38
+ this.data = data;
39
+ this.time = /* @__PURE__ */ new Date();
40
+ this.stack = new Error().stack ?? "";
41
+ }
42
+ get displayTime() {
43
+ return this.time.toLocaleDateString("en-US", {
44
+ year: "numeric",
45
+ month: "short",
46
+ day: "numeric",
47
+ weekday: "short",
48
+ hour: "numeric",
49
+ minute: "numeric",
50
+ second: "numeric"
51
+ }) + `:${this.time.getMilliseconds()}`;
52
+ }
53
+ get elapsedTimeMs() {
54
+ return (this.time.getTime() - logsTimeOrigin.getTime()) / 1e3;
55
+ }
56
+ get displayStack() {
57
+ return this.stack.split("\n").map((line) => line.trim()).slice(4).join("\n");
58
+ }
59
+ }
60
+ class Logger {
61
+ _private_threads = /* @__PURE__ */ new Map();
62
+ constructor() {
63
+ this.dir = this.dir.bind(this);
64
+ this.error = this.error.bind(this);
65
+ this.log = this.log.bind(this);
66
+ this.warn = this.warn.bind(this);
67
+ this.setLog = this.setLog.bind(this);
68
+ this.print = this.print.bind(this);
69
+ this.printThreads = this.printThreads.bind(this);
70
+ }
71
+ // assert (thread: string = '', ...args: ConsoleMethodsParams['assert']) { this.setLog(thread, 'assert', args) }
72
+ // count (thread: string = '', ...args: ConsoleMethodsParams['count']) { this.setLog(thread, 'count', args) }
73
+ // countReset (thread: string = '', ...args: ConsoleMethodsParams['countReset']) { this.setLog(thread, 'countReset', args) }
74
+ // debug (thread: string = '', ...args: ConsoleMethodsParams['debug']) { this.setLog(thread, 'debug', args) }
75
+ dir(thread = "", ...args) {
76
+ this.setLog(thread, "dir", args);
77
+ }
78
+ // dirxml (thread: string = '', ...args: ConsoleMethodsParams['dirxml']) { this.setLog(thread, 'dirxml', args) }
79
+ error(thread = "", ...args) {
80
+ this.setLog(thread, "error", args);
81
+ }
82
+ // group (thread: string = '', ...args: ConsoleMethodsParams['group']) { this.setLog(thread, 'group', args) }
83
+ // groupCollapsed (thread: string = '', ...args: ConsoleMethodsParams['groupCollapsed']) { this.setLog(thread, 'groupCollapsed', args) }
84
+ // groupEnd (thread: string = '', ...args: ConsoleMethodsParams['groupEnd']) { this.setLog(thread, 'groupEnd', args) }
85
+ // info (thread: string = '', ...args: ConsoleMethodsParams['info']) { this.setLog(thread, 'info', args) }
86
+ log(thread = "", ...args) {
87
+ this.setLog(thread, "log", args);
88
+ }
89
+ // table (thread: string = '', ...args: ConsoleMethodsParams['table']) { this.setLog(thread, 'table', args) }
90
+ // time (thread: string = '', ...args: ConsoleMethodsParams['time']) { this.setLog(thread, 'time', args) }
91
+ // timeEnd (thread: string = '', ...args: ConsoleMethodsParams['timeEnd']) { this.setLog(thread, 'timeEnd', args) }
92
+ // trace (thread: string = '', ...args: ConsoleMethodsParams['trace']) { this.setLog(thread, 'trace', args) }
93
+ warn(thread = "", ...args) {
94
+ this.setLog(thread, "warn", args);
95
+ }
96
+ setLog(threadName, type, data) {
97
+ const log = new Log(type, data);
98
+ const thread = this._private_threads.get(threadName) ?? [];
99
+ this._private_threads.set(threadName, [...thread, log]);
100
+ return this;
101
+ }
102
+ print(threadFilter, withStack) {
103
+ 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 }) => {
104
+ if (threadFilter === void 0) return true;
105
+ return threadName === threadFilter;
106
+ });
107
+ allLogs.forEach(({ threadName, log }) => {
108
+ console.log(`%c${threadName}`, "font-weight: 800; color: white; background: black; padding: 4px;", `+${log.elapsedTimeMs}s \u2013`, log.displayTime);
109
+ if (withStack === true) console.log(`%c${log.displayStack}`, "color: grey; font-size: inherit;");
110
+ console[log.type](...log.data);
111
+ console.log("");
112
+ });
113
+ }
114
+ printThreads(withStack) {
115
+ Array.from(this._private_threads.entries()).forEach(([threadName, logs]) => {
116
+ console.group(`%c${threadName}`, "font-weight: 800; color: white; background: black; padding: 4px;");
117
+ logs.forEach((log) => {
118
+ console.log(`+${log.elapsedTimeMs}s \u2013`, log.displayTime);
119
+ if (withStack === true) console.log(`%c${log.displayStack}`, "color: grey; font-size: inherit;");
120
+ console[log.type](...log.data);
121
+ console.log("");
122
+ });
123
+ console.groupEnd();
124
+ });
125
+ }
126
+ }
127
+ Logs2.Logger = Logger;
128
+ })(Logs || (Logs = {}));
129
+
130
+ export {
131
+ Logs
132
+ };
@@ -0,0 +1,12 @@
1
+ // src/agnostic/misc/get-current-downlink/index.ts
2
+ function getCurrentDownlink() {
3
+ if (typeof window !== "object") return void 0;
4
+ if (typeof window.navigator !== "object") return void 0;
5
+ const navigator = window.navigator;
6
+ const connection = navigator?.connection ?? navigator?.mozConnection ?? navigator?.webkitConnection;
7
+ return connection?.downlink;
8
+ }
9
+
10
+ export {
11
+ getCurrentDownlink
12
+ };
@@ -0,0 +1,14 @@
1
+ // src/node/files/read-write/index.ts
2
+ import { promises as fs } from "node:fs";
3
+ async function readWrite(path, editor, ...options) {
4
+ const [readOptions, writeOptions] = options;
5
+ const read = await fs.readFile(path, readOptions);
6
+ const edited = editor(read);
7
+ const actualWriteOptions = options.length === 2 ? writeOptions : readOptions;
8
+ await fs.writeFile(path, edited, actualWriteOptions);
9
+ return edited;
10
+ }
11
+
12
+ export {
13
+ readWrite
14
+ };
@@ -0,0 +1,168 @@
1
+ import {
2
+ isFalsy
3
+ } from "./chunk-QXAJXTXV.js";
4
+ import {
5
+ isValidClassName
6
+ } from "./chunk-W5A2TON3.js";
7
+
8
+ // src/agnostic/css/bem/getNamesArr.ts
9
+ function getNamesArr(arg) {
10
+ const returned = [];
11
+ if (typeof arg === "string") {
12
+ arg.trim().split(/\s+/gm).forEach((name) => {
13
+ if (isValidClassName(name)) returned.push(name);
14
+ });
15
+ } else if (Array.isArray(arg)) {
16
+ arg.forEach((elt) => returned.push(...getNamesArr(elt)));
17
+ } else if (typeof arg === "object" && arg !== null) {
18
+ Object.entries(arg).forEach(([key, val]) => {
19
+ if (!isFalsy(val)) returned.push(...getNamesArr(key));
20
+ });
21
+ }
22
+ return returned;
23
+ }
24
+ var getNamesArr_default = getNamesArr;
25
+
26
+ // src/agnostic/css/bem/BEM.ts
27
+ var BEM = class _BEM {
28
+ constructor() {
29
+ this.findBlockByName = this.findBlockByName.bind(this);
30
+ this.addBlock = this.addBlock.bind(this);
31
+ this.addElement = this.addElement.bind(this);
32
+ this.addModifier = this.addModifier.bind(this);
33
+ this.copy = this.copy.bind(this);
34
+ this.block = this.block.bind(this);
35
+ this.element = this.element.bind(this);
36
+ this.modifier = this.modifier.bind(this);
37
+ this.blk = this.blk.bind(this);
38
+ this.elt = this.elt.bind(this);
39
+ this.mod = this.mod.bind(this);
40
+ this.cp = this.cp.bind(this);
41
+ this.addSingleBlock = this.addSingleBlock.bind(this);
42
+ this.addSingleElement = this.addSingleElement.bind(this);
43
+ this.addSingleModifier = this.addSingleModifier.bind(this);
44
+ this.setCurrentBlockByName = this.setCurrentBlockByName.bind(this);
45
+ this.createBlockByName = this.createBlockByName.bind(this);
46
+ this.getCurrentBlock = this.getCurrentBlock.bind(this);
47
+ }
48
+ addBlock(blockNameArg) {
49
+ const blocksNames = getNamesArr_default(blockNameArg);
50
+ blocksNames.forEach(this.addSingleBlock);
51
+ return this;
52
+ }
53
+ addElement(elementNameArg) {
54
+ const elementsNames = getNamesArr_default(elementNameArg);
55
+ elementsNames.forEach(this.addSingleElement);
56
+ return this;
57
+ }
58
+ addModifier(modifierNameArg) {
59
+ const currentBlock = this.getCurrentBlock();
60
+ if (currentBlock === void 0) return this;
61
+ const modifiersNames = getNamesArr_default(modifierNameArg);
62
+ modifiersNames.forEach(this.addSingleModifier);
63
+ return this;
64
+ }
65
+ copy() {
66
+ const copy = new _BEM();
67
+ this.blocks.forEach((block) => {
68
+ copy.addBlock(block.name);
69
+ block.modifiers.forEach(copy.addModifier);
70
+ });
71
+ return copy;
72
+ }
73
+ block(blockNameArg) {
74
+ return this.copy().addBlock(blockNameArg);
75
+ }
76
+ element(elementNameArg) {
77
+ return this.copy().addElement(elementNameArg);
78
+ }
79
+ modifier(modifierNameArg) {
80
+ return this.copy().addModifier(modifierNameArg);
81
+ }
82
+ blk(blockNameArg) {
83
+ return this.block(blockNameArg);
84
+ }
85
+ elt(elementNameArg) {
86
+ return this.element(elementNameArg);
87
+ }
88
+ mod(modifierNameArg) {
89
+ return this.modifier(modifierNameArg);
90
+ }
91
+ cp() {
92
+ return this.copy();
93
+ }
94
+ get value() {
95
+ return this.blocks.map((block) => {
96
+ return [block.name, ...block.modifiers.map((modifier) => {
97
+ return `${block.name}_${modifier}`;
98
+ })].join(" ");
99
+ }).join(" ");
100
+ }
101
+ get val() {
102
+ return this.value;
103
+ }
104
+ blocks = [];
105
+ findBlockByName(name) {
106
+ return this.blocks.find((block) => block.name === name);
107
+ }
108
+ addSingleBlock(blockName) {
109
+ if (this.findBlockByName(blockName) !== void 0) {
110
+ this.setCurrentBlockByName(blockName);
111
+ } else {
112
+ const block = this.createBlockByName(blockName);
113
+ this.blocks.push(block);
114
+ }
115
+ return this;
116
+ }
117
+ addSingleElement(elementName) {
118
+ const currentBlock = this.getCurrentBlock();
119
+ if (currentBlock === void 0) this.addBlock(elementName);
120
+ else {
121
+ currentBlock.name = currentBlock.name + "__" + elementName;
122
+ }
123
+ return this;
124
+ }
125
+ addSingleModifier(modifierName) {
126
+ const currentBlock = this.getCurrentBlock();
127
+ if (currentBlock !== void 0) {
128
+ currentBlock.modifiers.push(modifierName);
129
+ }
130
+ return this;
131
+ }
132
+ setCurrentBlockByName(blockName) {
133
+ const block = this.findBlockByName(blockName);
134
+ if (block !== void 0) {
135
+ const blockPos = this.blocks.indexOf(block);
136
+ this.blocks = [
137
+ ...this.blocks.slice(0, blockPos),
138
+ ...this.blocks.slice(blockPos + 1),
139
+ block
140
+ ];
141
+ }
142
+ return this;
143
+ }
144
+ createBlockByName(blockName) {
145
+ return { name: blockName, modifiers: [] };
146
+ }
147
+ getCurrentBlock() {
148
+ return this.blocks.slice(-1)[0];
149
+ }
150
+ };
151
+ var BEM_default = BEM;
152
+
153
+ // src/agnostic/css/bem/index.ts
154
+ var Bem;
155
+ ((Bem2) => {
156
+ Bem2.BEM = BEM_default;
157
+ function bem(blockNameArg) {
158
+ const bem2 = new BEM_default();
159
+ if (blockNameArg instanceof BEM_default) return blockNameArg.copy();
160
+ return bem2.addBlock(blockNameArg);
161
+ }
162
+ Bem2.bem = bem;
163
+ Bem2.getNamesArr = getNamesArr_default;
164
+ })(Bem || (Bem = {}));
165
+
166
+ export {
167
+ Bem
168
+ };
@@ -0,0 +1,10 @@
1
+ // src/agnostic/strings/to-alphanum/index.ts
2
+ function toAlphanum(string, replacer = "") {
3
+ const replaced = string.replace(/[^a-z0-9]/igm, replacer);
4
+ if (replacer.length === 0) return replaced;
5
+ return replaced.replace(new RegExp(`${replacer}+`, "igm"), replacer);
6
+ }
7
+
8
+ export {
9
+ toAlphanum
10
+ };
@@ -0,0 +1,8 @@
1
+ // src/agnostic/numbers/absolute-modulo/index.ts
2
+ function absoluteModulo(nbr, modulo) {
3
+ return (nbr % modulo + modulo) % modulo;
4
+ }
5
+
6
+ export {
7
+ absoluteModulo
8
+ };
@@ -0,0 +1,10 @@
1
+ // src/agnostic/async/wait/index.ts
2
+ async function wait(durationMs) {
3
+ return new Promise((resolve) => {
4
+ setTimeout(() => resolve(true), durationMs);
5
+ });
6
+ }
7
+
8
+ export {
9
+ wait
10
+ };
@@ -0,0 +1,13 @@
1
+ // src/agnostic/objects/enums/is-in-enum/index.ts
2
+ function isInEnum(enumObj, value) {
3
+ const keys = Object.keys(enumObj);
4
+ const values = Object.values(enumObj);
5
+ const numericValues = values.filter((val) => typeof val === "number");
6
+ const cleanKeys = keys.filter((key) => !numericValues.includes(parseInt(key, 10)));
7
+ const cleanValues = cleanKeys.map((cleanKey) => enumObj[cleanKey]);
8
+ return cleanValues.includes(value);
9
+ }
10
+
11
+ export {
12
+ isInEnum
13
+ };
@@ -0,0 +1,72 @@
1
+ // src/agnostic/css/generate-nice-color/index.ts
2
+ var niceColors = [
3
+ "fuchsia",
4
+ "teal",
5
+ "aliceblue",
6
+ "bisque",
7
+ "blueviolet",
8
+ "burlywood",
9
+ "chocolate",
10
+ "coral",
11
+ "cornflowerblue",
12
+ "crimson",
13
+ "darkblue",
14
+ "darkgoldenrod",
15
+ "darkkhaki",
16
+ "darkmagenta",
17
+ "darkolivegreen",
18
+ "darkorange",
19
+ "darkorchid",
20
+ "darkred",
21
+ "darksalmon",
22
+ "darkslateblue",
23
+ "darkslategray",
24
+ "darkviolet",
25
+ "deeppink",
26
+ "deepskyblue",
27
+ "dodgerblue",
28
+ "firebrick",
29
+ "floralwhite",
30
+ "gainsboro",
31
+ "gold",
32
+ "hotpink",
33
+ "indianred",
34
+ "indigo",
35
+ "khaki",
36
+ "lavender",
37
+ "lightcoral",
38
+ "lightgreen",
39
+ "lightsalmon",
40
+ "lightsteelblue",
41
+ "limegreen",
42
+ "magenta",
43
+ "mediumseagreen",
44
+ "mediumspringgreen",
45
+ "mediumvioletred",
46
+ "moccasin",
47
+ "orangered",
48
+ "orchid",
49
+ "palegoldenrod",
50
+ "palevioletred",
51
+ "peachpuff",
52
+ "peru",
53
+ "plum",
54
+ "royalblue",
55
+ "sandybrown",
56
+ "springgreen",
57
+ "tan",
58
+ "thistle",
59
+ "tomato",
60
+ "violet",
61
+ "wheat",
62
+ "yellowgreen"
63
+ ];
64
+ var generateNiceColor = () => {
65
+ const pos = Math.floor(Math.random() * niceColors.length);
66
+ return niceColors[pos];
67
+ };
68
+
69
+ export {
70
+ niceColors,
71
+ generateNiceColor
72
+ };
@@ -0,0 +1,8 @@
1
+ // src/agnostic/numbers/interpolate/index.ts
2
+ function interpolate(ratio, bound1, bound2) {
3
+ return bound1 + ratio * (bound2 - bound1);
4
+ }
5
+
6
+ export {
7
+ interpolate
8
+ };
@@ -0,0 +1,14 @@
1
+ // src/agnostic/objects/validation/index.ts
2
+ var Validation;
3
+ ((Validation2) => {
4
+ function fromPartial(obj, partial) {
5
+ return Object.entries(partial).every(([key, val]) => {
6
+ return obj[key] === val;
7
+ });
8
+ }
9
+ Validation2.fromPartial = fromPartial;
10
+ })(Validation || (Validation = {}));
11
+
12
+ export {
13
+ Validation
14
+ };
@@ -0,0 +1,36 @@
1
+ // src/agnostic/misc/crossenv/index.ts
2
+ var Crossenv;
3
+ ((Crossenv2) => {
4
+ let RuntimeName;
5
+ ((RuntimeName2) => {
6
+ RuntimeName2["NODE"] = "Node.js";
7
+ RuntimeName2["BROWSER"] = "Browser";
8
+ RuntimeName2["DENO"] = "Deno";
9
+ RuntimeName2["REACT_NATIVE"] = "React Native";
10
+ RuntimeName2["ELECTRON"] = "Electron";
11
+ RuntimeName2["CLOUDFLARE"] = "Cloudflare Workers";
12
+ RuntimeName2["AWS_LAMBDA"] = "AWS Lambda";
13
+ })(RuntimeName = Crossenv2.RuntimeName || (Crossenv2.RuntimeName = {}));
14
+ function detectRuntime() {
15
+ if (typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined") return "Node.js" /* NODE */;
16
+ if (typeof window !== "undefined" && typeof window.document !== "undefined") return "Browser" /* BROWSER */;
17
+ if (typeof Deno !== "undefined") return "Deno" /* DENO */;
18
+ if (typeof process !== "undefined" && typeof navigator.userAgent === "string" && /ReactNative/.test(navigator.userAgent)) return "React Native" /* REACT_NATIVE */;
19
+ if (typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.version.electron !== "undefined") return "Electron" /* ELECTRON */;
20
+ if (typeof self !== "undefined" && typeof self.addEventListener === "function" && typeof Headers !== "undefined") return "Cloudflare Workers" /* CLOUDFLARE */;
21
+ if (typeof AWS !== "undefined" && typeof AWS.Lambda !== "undefined") return "AWS Lambda" /* AWS_LAMBDA */;
22
+ return null;
23
+ }
24
+ Crossenv2.detectRuntime = detectRuntime;
25
+ function getDocument() {
26
+ const runtime = detectRuntime();
27
+ const runtimesWithGlobalWindow = ["Browser" /* BROWSER */, "Electron" /* ELECTRON */];
28
+ const runtimeHasGlobalWindow = runtimesWithGlobalWindow.includes(runtime);
29
+ return runtimeHasGlobalWindow ? window.document : null;
30
+ }
31
+ Crossenv2.getDocument = getDocument;
32
+ })(Crossenv || (Crossenv = {}));
33
+
34
+ export {
35
+ Crossenv
36
+ };
@@ -0,0 +1,14 @@
1
+ // src/agnostic/misc/is-nullish/index.ts
2
+ var nullishValues = [null, void 0];
3
+ function isNullish(val) {
4
+ return nullishValues.includes(val);
5
+ }
6
+ function isNotNullish(val) {
7
+ return !isNullish(val);
8
+ }
9
+
10
+ export {
11
+ nullishValues,
12
+ isNullish,
13
+ isNotNullish
14
+ };
@@ -0,0 +1,122 @@
1
+ import {
2
+ matchesSome
3
+ } from "./chunk-LQFKUNVQ.js";
4
+
5
+ // src/node/files/subpaths/index.ts
6
+ import { promises as fs } from "node:fs";
7
+ import path from "node:path";
8
+ var Subpaths;
9
+ ((Subpaths2) => {
10
+ Subpaths2.defaultListContext = {
11
+ depth: 0,
12
+ lstats: null,
13
+ rootPath: null
14
+ };
15
+ Subpaths2.fillListContext = (input) => {
16
+ return {
17
+ ...Subpaths2.defaultListContext,
18
+ ...input
19
+ };
20
+ };
21
+ Subpaths2.defaultListOptions = {
22
+ directories: true,
23
+ files: true,
24
+ symlinks: true,
25
+ hidden: true,
26
+ followSimlinks: false,
27
+ dedupeSimlinksContents: false,
28
+ maxDepth: Infinity,
29
+ returnRelative: false,
30
+ exclude: null,
31
+ include: null,
32
+ filter: () => true
33
+ };
34
+ Subpaths2.fillOptions = (input) => {
35
+ return {
36
+ ...Subpaths2.defaultListOptions,
37
+ ...input
38
+ };
39
+ };
40
+ async function list(...args) {
41
+ const [inputPath, _options] = args;
42
+ const options = (0, Subpaths2.fillOptions)(_options ?? {});
43
+ const subpaths = await listAbsoluteSubpaths(...args);
44
+ return options.returnRelative ? subpaths.map((subpath) => path.relative(inputPath, subpath)) : subpaths;
45
+ }
46
+ Subpaths2.list = list;
47
+ async function listAbsoluteSubpaths(inputPath, _options = {}, __private_context = {}) {
48
+ const options = (0, Subpaths2.fillOptions)(_options);
49
+ const _private_context = (0, Subpaths2.fillListContext)(__private_context);
50
+ if (_private_context.rootPath === null) {
51
+ _private_context.rootPath = inputPath;
52
+ }
53
+ const subpaths = [];
54
+ if (_private_context.depth > options.maxDepth) return subpaths;
55
+ try {
56
+ const pathStat = _private_context.lstats ?? await fs.lstat(inputPath);
57
+ if (!pathStat.isDirectory()) return subpaths;
58
+ } catch (err) {
59
+ return subpaths;
60
+ }
61
+ const childrenRelPaths = await fs.readdir(inputPath);
62
+ await Promise.all(childrenRelPaths.map(async (childRelPath) => {
63
+ const childAbsPath = path.join(inputPath, childRelPath);
64
+ const childRelFromRootPath = path.relative(_private_context.rootPath ?? inputPath, childAbsPath);
65
+ const childLstats = await fs.lstat(childAbsPath);
66
+ try {
67
+ const isDirectory = childLstats.isDirectory();
68
+ const isSymlink = childLstats.isSymbolicLink();
69
+ const isFile = !isDirectory && !isSymlink;
70
+ const isHidden = path.basename(childAbsPath).startsWith(".");
71
+ const type = isDirectory ? "directory" : isSymlink ? "symlink" : "file";
72
+ if (isDirectory && options.directories === false) throw true;
73
+ if (isSymlink && options.symlinks === false) throw false;
74
+ if (isFile && options.files === false) throw false;
75
+ if (isHidden && options.hidden === false) throw false;
76
+ const realPath = isSymlink ? await fs.realpath(childAbsPath) : childAbsPath;
77
+ const childPathForFilters = options.returnRelative ? childRelFromRootPath : childAbsPath;
78
+ const isInExclude = matchesSome(childPathForFilters, options.exclude ?? []);
79
+ const isInInclude = matchesSome(childPathForFilters, options.include ?? []);
80
+ if (isInExclude && !isInInclude) throw false;
81
+ const isInFilter = await options.filter(childPathForFilters, { type, hidden: isHidden, realPath });
82
+ if (!isInFilter) throw true;
83
+ if (isSymlink) {
84
+ if (options.followSimlinks === false) subpaths.push(childAbsPath);
85
+ else {
86
+ const childSubpaths = await listAbsoluteSubpaths(realPath, options, {
87
+ ..._private_context,
88
+ depth: _private_context.depth + 1
89
+ });
90
+ subpaths.push(realPath, ...childSubpaths);
91
+ }
92
+ } else {
93
+ if (isDirectory) {
94
+ const childSubpaths = await listAbsoluteSubpaths(childAbsPath, options, {
95
+ ..._private_context,
96
+ depth: _private_context.depth + 1,
97
+ lstats: childLstats
98
+ });
99
+ subpaths.push(childAbsPath, ...childSubpaths);
100
+ } else {
101
+ subpaths.push(childAbsPath);
102
+ }
103
+ }
104
+ } catch (err) {
105
+ if (typeof err !== "boolean") throw new Error(`This try/catch block should only throw booleans`);
106
+ const shouldDiveDeeper = err;
107
+ if (!shouldDiveDeeper) return [];
108
+ const childSubpaths = await listAbsoluteSubpaths(childAbsPath, options, {
109
+ ..._private_context,
110
+ depth: _private_context.depth + 1,
111
+ lstats: childLstats
112
+ });
113
+ subpaths.push(...childSubpaths);
114
+ }
115
+ }));
116
+ return options.dedupeSimlinksContents ? Array.from(new Set(subpaths)) : subpaths;
117
+ }
118
+ })(Subpaths || (Subpaths = {}));
119
+
120
+ export {
121
+ Subpaths
122
+ };