@mxfb/tools 0.3.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/TODO.md +1 -0
  2. package/agnostic/@publisher/index.d.ts +47 -0
  3. package/agnostic/@publisher/index.js +361 -0
  4. package/agnostic/elo/index.d.ts +23 -0
  5. package/agnostic/elo/index.js +28 -0
  6. package/agnostic/elo/index.test.d.ts +1 -0
  7. package/agnostic/elo/index.test.js +67 -0
  8. package/agnostic/index.d.ts +5 -4
  9. package/agnostic/index.js +5 -0
  10. package/agnostic/poetry/generate-rhymes/index.d.ts +1 -0
  11. package/agnostic/poetry/generate-rhymes/index.js +125 -0
  12. package/agnostic/poetry/index.d.ts +1 -0
  13. package/agnostic/poetry/index.js +1 -0
  14. package/agnostic/scrapers/@meteociel/index.d.ts +36 -0
  15. package/agnostic/scrapers/@meteociel/index.js +248 -0
  16. package/agnostic/scrapers/@meteociel/index.test.d.ts +1 -0
  17. package/agnostic/scrapers/@meteociel/index.test.js +43 -0
  18. package/agnostic/scrapers/@meteociel/locations/index.d.ts +11 -0
  19. package/agnostic/scrapers/@meteociel/locations/index.js +10 -0
  20. package/agnostic/scrapers/@meteociel/types.d.ts +1 -0
  21. package/agnostic/scrapers/@meteociel/types.js +1 -0
  22. package/agnostic/scrapers/@tumblr/blogs/delabienbonnemusique/index.d.ts +22 -0
  23. package/agnostic/scrapers/@tumblr/blogs/delabienbonnemusique/index.js +124 -0
  24. package/agnostic/scrapers/@tumblr/blogs/delabienbonnemusique/index.test.d.ts +1 -0
  25. package/agnostic/scrapers/@tumblr/blogs/delabienbonnemusique/index.test.js +107 -0
  26. package/agnostic/scrapers/@tumblr/blogs/index.d.ts +8 -0
  27. package/agnostic/scrapers/@tumblr/blogs/index.js +23 -0
  28. package/agnostic/scrapers/@tumblr/index.d.ts +73 -0
  29. package/agnostic/scrapers/@tumblr/index.js +180 -0
  30. package/agnostic/scrapers/@tumblr/index.test.d.ts +1 -0
  31. package/agnostic/scrapers/@tumblr/index.test.js +319 -0
  32. package/agnostic/scrapers/@tumblr/types.d.ts +238 -0
  33. package/agnostic/scrapers/@tumblr/types.js +38 -0
  34. package/agnostic/scrapers/@tumblr/utils.d.ts +12 -0
  35. package/agnostic/scrapers/@tumblr/utils.js +407 -0
  36. package/agnostic/scrapers/index.d.ts +2 -0
  37. package/agnostic/scrapers/index.js +2 -0
  38. package/agnostic/weather/index.d.ts +1 -0
  39. package/agnostic/weather/index.js +1 -0
  40. package/agnostic/weather/types.d.ts +181 -0
  41. package/agnostic/weather/types.js +8 -0
  42. package/components/index.d.ts +1 -1
  43. package/components/index.js +1 -0
  44. package/components/public-classnames.d.ts +5 -0
  45. package/components/public-classnames.js +5 -0
  46. package/components/utils/index.d.ts +1 -0
  47. package/components/utils/index.js +12 -0
  48. package/components/utils/types.d.ts +3 -0
  49. package/components/utils/types.js +1 -0
  50. package/index.d.ts +3 -3
  51. package/index.js +3 -0
  52. package/node/headless-browser/index.d.ts +37 -0
  53. package/node/headless-browser/index.js +126 -0
  54. package/node/headless-browser/types.d.ts +47 -0
  55. package/node/headless-browser/types.js +5 -0
  56. package/node/index.d.ts +1 -2
  57. package/node/index.js +1 -0
  58. package/node/index.test.d.ts +1 -0
  59. package/node/index.test.js +6 -0
  60. package/node/scrapers/@tumblr/index.d.ts +61 -0
  61. package/node/scrapers/@tumblr/index.js +182 -0
  62. package/node/scrapers/@tumblr/index.test.d.ts +1 -0
  63. package/node/scrapers/@tumblr/index.test.js +185 -0
  64. package/node/scrapers/@tumblr/types.d.ts +91 -0
  65. package/node/scrapers/@tumblr/types.js +1 -0
  66. package/node/scrapers/@tumblr/utils.d.ts +23 -0
  67. package/node/scrapers/@tumblr/utils.js +328 -0
  68. package/node/scrapers/index.d.ts +1 -0
  69. package/node/scrapers/index.js +1 -0
  70. package/package.json +211 -14
  71. package/agnostic/_WIP_tennis/index.d.ts +0 -2
  72. package/agnostic/_WIP_tennis/index.js +0 -62
  73. package/agnostic/arrays/index.d.ts +0 -11
  74. package/agnostic/arrays/is-array-of/index.d.ts +0 -5
  75. package/agnostic/arrays/is-array-of/index.js +0 -23
  76. package/agnostic/async/index.d.ts +0 -8
  77. package/agnostic/async/index.js +0 -20
  78. package/agnostic/async/timeout-call/index.d.ts +0 -1
  79. package/agnostic/async/timeout-call/index.js +0 -6
  80. package/agnostic/async/transitions/index.d.ts +0 -41
  81. package/agnostic/async/transitions/index.js +0 -7
  82. package/agnostic/async/wait/index.d.ts +0 -1
  83. package/agnostic/async/wait/index.js +0 -6
  84. package/agnostic/booleans/index.d.ts +0 -8
  85. package/agnostic/booleans/index.js +0 -17
  86. package/agnostic/booleans/is-falsy/index.d.ts +0 -7
  87. package/agnostic/booleans/is-falsy/index.js +0 -11
  88. package/agnostic/css/bem/BEM.d.ts +0 -29
  89. package/agnostic/css/bem/getNamesArr.d.ts +0 -2
  90. package/agnostic/css/bem/index.d.ts +0 -7
  91. package/agnostic/css/bem/index.js +0 -9
  92. package/agnostic/css/generate-nice-color/index.d.ts +0 -2
  93. package/agnostic/css/generate-nice-color/index.js +0 -8
  94. package/agnostic/css/index.d.ts +0 -14
  95. package/agnostic/css/index.js +0 -177
  96. package/agnostic/css/is-valid-css-class-name/index.d.ts +0 -2
  97. package/agnostic/css/is-valid-css-class-name/index.js +0 -8
  98. package/agnostic/css/styles-set/index.d.ts +0 -37
  99. package/agnostic/errors/index.d.ts +0 -30
  100. package/agnostic/errors/index.js +0 -6
  101. package/agnostic/html/get-node-ancestors/index.d.ts +0 -1
  102. package/agnostic/html/get-node-ancestors/index.js +0 -6
  103. package/agnostic/html/get-position-inside-parent/index.d.ts +0 -1
  104. package/agnostic/html/get-position-inside-parent/index.js +0 -6
  105. package/agnostic/html/index.d.ts +0 -17
  106. package/agnostic/html/index.js +0 -39
  107. package/agnostic/html/insert-node/index.d.ts +0 -2
  108. package/agnostic/html/insert-node/index.js +0 -6
  109. package/agnostic/html/placeholders/index.d.ts +0 -9
  110. package/agnostic/html/placeholders/index.js +0 -6
  111. package/agnostic/html/sanitize/index.d.ts +0 -24
  112. package/agnostic/html/sanitize/index.js +0 -9
  113. package/agnostic/html/selector-to-element/index.d.ts +0 -1
  114. package/agnostic/html/selector-to-element/index.js +0 -9
  115. package/agnostic/html/string-to-nodes/index.d.ts +0 -7
  116. package/agnostic/html/string-to-nodes/index.js +0 -10
  117. package/agnostic/misc/assert/index.d.ts +0 -5
  118. package/agnostic/misc/assert/index.js +0 -6
  119. package/agnostic/misc/cast/index.d.ts +0 -9
  120. package/agnostic/misc/cast/index.js +0 -8
  121. package/agnostic/misc/crossenv/index.d.ts +0 -13
  122. package/agnostic/misc/crossenv/index.js +0 -6
  123. package/agnostic/misc/elo/index.d.ts +0 -31
  124. package/agnostic/misc/elo/index.js +0 -6
  125. package/agnostic/misc/get-current-downlink/index.d.ts +0 -1
  126. package/agnostic/misc/get-current-downlink/index.js +0 -6
  127. package/agnostic/misc/index.d.ts +0 -6
  128. package/agnostic/misc/index.js +0 -16
  129. package/agnostic/misc/is-constructor-function/index.d.ts +0 -2
  130. package/agnostic/misc/is-constructor-function/index.js +0 -6
  131. package/agnostic/misc/is-nullish/index.d.ts +0 -4
  132. package/agnostic/misc/is-nullish/index.js +0 -10
  133. package/agnostic/misc/logs/index.d.ts +0 -55
  134. package/agnostic/misc/logs/index.js +0 -6
  135. package/agnostic/misc/random/index.d.ts +0 -10
  136. package/agnostic/misc/random/index.js +0 -6
  137. package/agnostic/misc/tennis/index.d.ts +0 -60
  138. package/agnostic/misc/tennis/index.js +0 -6
  139. package/agnostic/numbers/absolute-modulo/index.d.ts +0 -1
  140. package/agnostic/numbers/absolute-modulo/index.js +0 -6
  141. package/agnostic/numbers/clamp/index.d.ts +0 -1
  142. package/agnostic/numbers/clamp/index.js +0 -6
  143. package/agnostic/numbers/index.d.ts +0 -13
  144. package/agnostic/numbers/index.js +0 -30
  145. package/agnostic/numbers/interpolate/index.d.ts +0 -1
  146. package/agnostic/numbers/interpolate/index.js +0 -6
  147. package/agnostic/numbers/responsive-harmonics/index.d.ts +0 -10
  148. package/agnostic/numbers/responsive-harmonics/index.js +0 -9
  149. package/agnostic/numbers/round/index.d.ts +0 -1
  150. package/agnostic/numbers/round/index.js +0 -6
  151. package/agnostic/objects/enums/index.d.ts +0 -4
  152. package/agnostic/objects/enums/index.js +0 -7
  153. package/agnostic/objects/enums/is-in-enum/index.d.ts +0 -1
  154. package/agnostic/objects/enums/is-in-enum/index.js +0 -6
  155. package/agnostic/objects/flatten-getters/index.d.ts +0 -1
  156. package/agnostic/objects/flatten-getters/index.js +0 -9
  157. package/agnostic/objects/index.d.ts +0 -12
  158. package/agnostic/objects/index.js +0 -32
  159. package/agnostic/objects/is-object/index.d.ts +0 -1
  160. package/agnostic/objects/is-object/index.js +0 -6
  161. package/agnostic/objects/is-record/index.d.ts +0 -1
  162. package/agnostic/objects/is-record/index.js +0 -6
  163. package/agnostic/objects/record-format/index.d.ts +0 -11
  164. package/agnostic/objects/record-format/index.js +0 -16
  165. package/agnostic/objects/validation/index.d.ts +0 -3
  166. package/agnostic/objects/validation/index.js +0 -6
  167. package/agnostic/optim/index.d.ts +0 -7
  168. package/agnostic/optim/index.js +0 -18
  169. package/agnostic/optim/memoize/index.d.ts +0 -3
  170. package/agnostic/optim/memoize/index.js +0 -6
  171. package/agnostic/optim/throttle-debounce/index.d.ts +0 -30
  172. package/agnostic/optim/throttle-debounce/index.js +0 -8
  173. package/agnostic/optim/throttle-debounce/types.d.ts +0 -2
  174. package/agnostic/regexps/index.d.ts +0 -23
  175. package/agnostic/regexps/index.js +0 -89
  176. package/agnostic/strings/char-codes/index.d.ts +0 -17
  177. package/agnostic/strings/char-codes/index.js +0 -6
  178. package/agnostic/strings/index.d.ts +0 -14
  179. package/agnostic/strings/index.js +0 -32
  180. package/agnostic/strings/matches/index.d.ts +0 -3
  181. package/agnostic/strings/matches/index.js +0 -10
  182. package/agnostic/strings/normalize-indent/index.d.ts +0 -1
  183. package/agnostic/strings/normalize-indent/index.js +0 -6
  184. package/agnostic/strings/replace-all/index.d.ts +0 -1
  185. package/agnostic/strings/replace-all/index.js +0 -6
  186. package/agnostic/strings/to-alphanum/index.d.ts +0 -1
  187. package/agnostic/strings/to-alphanum/index.js +0 -6
  188. package/chunks/chunk-32IRF4OP.js +0 -9
  189. package/chunks/chunk-34U4HX4V.js +0 -73
  190. package/chunks/chunk-4GDNHUCZ.js +0 -162
  191. package/chunks/chunk-4QQBKBYH.js +0 -59
  192. package/chunks/chunk-4VC5PT5T.js +0 -13
  193. package/chunks/chunk-5LNUCDQ6.js +0 -132
  194. package/chunks/chunk-7AWTHZLY.js +0 -12
  195. package/chunks/chunk-7DBNMU6N.js +0 -14
  196. package/chunks/chunk-COVPTTAD.js +0 -10
  197. package/chunks/chunk-DNIOWD7K.js +0 -8
  198. package/chunks/chunk-DQNJQBC6.js +0 -10
  199. package/chunks/chunk-E6MSDKON.js +0 -13
  200. package/chunks/chunk-EDVNAV3G.js +0 -72
  201. package/chunks/chunk-EW46EXFB.js +0 -8
  202. package/chunks/chunk-FPEW3A27.js +0 -14
  203. package/chunks/chunk-GJOU3UAL.js +0 -36
  204. package/chunks/chunk-HC6ZOHCS.js +0 -14
  205. package/chunks/chunk-HGCG2J77.js +0 -122
  206. package/chunks/chunk-IFD7GSGK.js +0 -130
  207. package/chunks/chunk-JQXNEJAP.js +0 -18
  208. package/chunks/chunk-JWBDZPQG.js +0 -18
  209. package/chunks/chunk-K37RALUX.js +0 -8
  210. package/chunks/chunk-KIONYWA7.js +0 -168
  211. package/chunks/chunk-KQT5CTGF.js +0 -21
  212. package/chunks/chunk-LEXQ6E6L.js +0 -31
  213. package/chunks/chunk-LQFKUNVQ.js +0 -19
  214. package/chunks/chunk-MF56TTC5.js +0 -15
  215. package/chunks/chunk-MT74WIQR.js +0 -41
  216. package/chunks/chunk-NRITRUZW.js +0 -10
  217. package/chunks/chunk-NRJQKVQV.js +0 -31
  218. package/chunks/chunk-OSAXBA7G.js +0 -10
  219. package/chunks/chunk-PO3V3I57.js +0 -23
  220. package/chunks/chunk-QXAJXTXV.js +0 -19
  221. package/chunks/chunk-RCO57B6F.js +0 -9
  222. package/chunks/chunk-SQZGZ3VT.js +0 -15
  223. package/chunks/chunk-TTZHPIH7.js +0 -237
  224. package/chunks/chunk-UYTXXUU7.js +0 -54
  225. package/chunks/chunk-VTPRO4NJ.js +0 -10
  226. package/chunks/chunk-VYW4IADX.js +0 -35
  227. package/chunks/chunk-VZDUZTW6.js +0 -113
  228. package/chunks/chunk-W5A2TON3.js +0 -10
  229. package/chunks/chunk-W7YBGJ4H.js +0 -28
  230. package/chunks/chunk-WLL3FNVL.js +0 -40
  231. package/chunks/chunk-WOAYU6LB.js +0 -13
  232. package/chunks/chunk-XA4HVHJ4.js +0 -18
  233. package/chunks/chunk-XN3PZIVL.js +0 -38
  234. package/chunks/chunk-Y3OZHZUF.js +0 -237
  235. package/chunks/chunk-YDIBNEGA.js +0 -9
  236. package/chunks/chunk-ZC5RZBNY.js +0 -33
  237. package/components/Comp/index.d.ts +0 -1
  238. package/node/files/index.d.ts +0 -9
  239. package/node/files/index.js +0 -21
  240. package/node/files/is-in-directory/index.d.ts +0 -1
  241. package/node/files/is-in-directory/index.js +0 -6
  242. package/node/files/read-write/index.d.ts +0 -9
  243. package/node/files/read-write/index.js +0 -6
  244. package/node/files/subpaths/index.d.ts +0 -34
  245. package/node/files/subpaths/index.js +0 -7
  246. package/node/image/index.d.ts +0 -9
  247. package/node/image/index.js +0 -74
  248. package/node/mxfb-cli-config/index.d.ts +0 -19
  249. package/node/mxfb-cli-config/index.js +0 -113
  250. package/node/process/index.d.ts +0 -8
  251. package/node/process/index.js +0 -20
  252. package/node/process/on-exit/index.d.ts +0 -5
  253. package/node/process/on-exit/index.js +0 -14
  254. package/shared/errors/index.d.ts +0 -138
  255. package/shared/index.d.ts +0 -0
@@ -1,28 +0,0 @@
1
- // src/agnostic/misc/assert/index.ts
2
- var Assert;
3
- ((Assert2) => {
4
- function makeSuccess(label) {
5
- console.info(`\u2705 SUCCESS: "${label}"`);
6
- }
7
- function makeFailure(label) {
8
- throw new Error(`\u{1F6AB} FAILURE: "${label}""`);
9
- }
10
- function assert(label, assertion) {
11
- if (Array.isArray(assertion)) assertion.forEach((innerAssertion, pos) => assert(`${label} (${pos})`, innerAssertion));
12
- else if (typeof assertion === "function") {
13
- try {
14
- const result = assertion();
15
- if (result === false) makeFailure(label);
16
- else makeSuccess(label);
17
- } catch (err) {
18
- makeFailure(`${err}`);
19
- }
20
- } else if (assertion === false) makeFailure(label);
21
- else makeSuccess(label);
22
- }
23
- Assert2.assert = assert;
24
- })(Assert || (Assert = {}));
25
-
26
- export {
27
- Assert
28
- };
@@ -1,40 +0,0 @@
1
- // src/agnostic/misc/random/index.ts
2
- var Random;
3
- ((Random2) => {
4
- function random(bound1 = 1, bound2) {
5
- const min = bound2 === void 0 ? 0 : bound1;
6
- const max = bound2 === void 0 ? bound1 : bound2;
7
- if (min === max || min > max) return void 0;
8
- const range = max - min;
9
- return Math.random() * range + min;
10
- }
11
- Random2.random = random;
12
- function randomInt(...args) {
13
- const rand = random(...args);
14
- return rand !== void 0 ? Math.floor(rand) : void 0;
15
- }
16
- Random2.randomInt = randomInt;
17
- Random2.hexChars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
18
- function randomHexChar() {
19
- const nbr = Math.floor(Math.random() * 16);
20
- const char = Random2.hexChars[nbr];
21
- return char;
22
- }
23
- Random2.randomHexChar = randomHexChar;
24
- function randomHash(length = 4) {
25
- return new Array(length).fill(null).map(randomHexChar).join("");
26
- }
27
- Random2.randomHash = randomHash;
28
- function randomHashPattern(pattern, joiner = "-") {
29
- return pattern.map(randomHash).join(joiner);
30
- }
31
- Random2.randomHashPattern = randomHashPattern;
32
- function randomUUID() {
33
- return randomHashPattern([8, 4, 4, 4, 12]);
34
- }
35
- Random2.randomUUID = randomUUID;
36
- })(Random || (Random = {}));
37
-
38
- export {
39
- Random
40
- };
@@ -1,13 +0,0 @@
1
- import {
2
- isInEnum
3
- } from "./chunk-E6MSDKON.js";
4
-
5
- // src/agnostic/objects/enums/index.ts
6
- var Enums;
7
- ((Enums2) => {
8
- Enums2.isInEnum = isInEnum;
9
- })(Enums || (Enums = {}));
10
-
11
- export {
12
- Enums
13
- };
@@ -1,18 +0,0 @@
1
- // src/agnostic/html/insert-node/index.ts
2
- function insertNode(node, position, reference) {
3
- if (position === "after") {
4
- if (reference.nextSibling !== null) reference.parentNode?.insertBefore(node, reference.nextSibling);
5
- else reference.parentNode?.appendChild(node);
6
- } else if (position === "before") {
7
- reference.parentNode?.insertBefore(node, reference);
8
- } else if (position === "startof") {
9
- if (reference.firstChild !== null) reference.insertBefore(node, reference.firstChild);
10
- else reference.appendChild(node);
11
- } else {
12
- reference.appendChild(node);
13
- }
14
- }
15
-
16
- export {
17
- insertNode
18
- };
@@ -1,38 +0,0 @@
1
- import {
2
- register
3
- } from "./chunk-KQT5CTGF.js";
4
- import {
5
- Crossenv
6
- } from "./chunk-GJOU3UAL.js";
7
-
8
- // src/agnostic/html/selector-to-element/index.ts
9
- function selectorToElement(selector, documentObj) {
10
- const actualDocument = documentObj ?? Crossenv.getDocument();
11
- if (actualDocument === null) throw register.getError("no-window-document-on-runtime-please-provide" /* NO_DOCUMENT_PLEASE_PROVIDE */, "The optional second parameter expects a Document object");
12
- const tagRegexp = /^[A-Za-z]+/;
13
- const idRegexp = /#[A-Za-z]+[\w\-\:]*/;
14
- const classRegexp = /\.[A-Za-z]+[\w\-]*/;
15
- const attributeRegexp = /\[[A-Za-z]+[\w\-]*(="[\w\-]+")?\]/;
16
- const matchedTags = selector.match(tagRegexp) ?? [];
17
- const matchedIds = selector.match(idRegexp) ?? [];
18
- const matchedClasses = selector.match(classRegexp) ?? [];
19
- const matchedAttrs = selector.match(attributeRegexp) ?? [];
20
- const tag = matchedTags[matchedTags.length - 1] ?? "div";
21
- const id = matchedIds[matchedIds.length - 1] ?? null;
22
- const classes = matchedClasses.map((matchedClass) => matchedClass.replace(/^\./, ""));
23
- const attributes = matchedAttrs.map((matchedAttr) => matchedAttr.replace(/^\[/, "").replace(/\]$/, "").split("="));
24
- const element = actualDocument.createElement(tag);
25
- if (id !== null) {
26
- element.id = id;
27
- }
28
- element.classList.add(...classes);
29
- attributes.forEach(([name, value = ""]) => {
30
- if (name === void 0) return;
31
- element.setAttribute(name, value);
32
- });
33
- return element;
34
- }
35
-
36
- export {
37
- selectorToElement
38
- };
@@ -1,237 +0,0 @@
1
- // src/agnostic/misc/tennis/index.ts
2
- var Tennis;
3
- ((Tennis2) => {
4
- let Score;
5
- ((Score2) => {
6
- class Game {
7
- format;
8
- pointsSequence = [];
9
- constructor(format) {
10
- this.format = format;
11
- }
12
- add(point) {
13
- if (!this.isFinished()) this.pointsSequence.push(point);
14
- return this;
15
- }
16
- getNumericScore() {
17
- const { pointsSequence, format } = this;
18
- const { upTo, diffToWin } = format;
19
- return pointsSequence.reduce((reduced, point) => {
20
- const [aScore, bScore] = reduced;
21
- const aWon = aScore >= upTo && aScore - bScore >= diffToWin;
22
- const bWon = bScore >= upTo && bScore - aScore >= diffToWin;
23
- if (aWon || bWon) return reduced;
24
- return point ? [aScore + 1, bScore] : [aScore, bScore + 1];
25
- }, [0, 0]);
26
- }
27
- static numericToStringScoreValue(numScore) {
28
- const [aScore, bScore] = numScore;
29
- if (aScore >= 3 && bScore >= 3) {
30
- if (aScore === bScore) return "deuce";
31
- if (aScore < bScore) return "Ad/40";
32
- return "40/Ad";
33
- }
34
- const strScoresList = ["0", "15", "30", "40"];
35
- return `${strScoresList.at(aScore) ?? "?"}/${strScoresList.at(bScore) ?? "?"}`;
36
- }
37
- getScore() {
38
- return Game.numericToStringScoreValue(this.getNumericScore());
39
- }
40
- isFinished() {
41
- const { format } = this;
42
- const { upTo, diffToWin } = format;
43
- const [aScore, bScore] = this.getNumericScore();
44
- const maxScoreReached = Math.max(aScore, bScore) >= upTo;
45
- const diffReached = Math.abs(aScore - bScore) >= diffToWin;
46
- if (maxScoreReached && diffReached) return true;
47
- return false;
48
- }
49
- getWinner() {
50
- if (!this.isFinished()) return null;
51
- const [aScore, bScore] = this.getNumericScore();
52
- return aScore > bScore;
53
- }
54
- }
55
- Score2.Game = Game;
56
- class Set {
57
- format;
58
- pointsSequence = [];
59
- constructor(format) {
60
- this.format = format;
61
- }
62
- add(point) {
63
- this.pointsSequence.push(point);
64
- }
65
- getGames() {
66
- const { format } = this;
67
- const { upTo, diffToWin, gamesFormat, tieBreakFormat, tieBreakAt } = format;
68
- let aGames = 0;
69
- let bGames = 0;
70
- const games = [];
71
- const { pointsSequence } = this;
72
- pointsSequence.forEach((point) => {
73
- const maxGamesReached = Math.max(aGames, bGames) >= upTo;
74
- const diffReached = Math.abs(aGames - bGames) >= diffToWin;
75
- if (maxGamesReached && diffReached) return;
76
- const lastGameInList = games.at(-1);
77
- const lastGameIsFinished = lastGameInList?.isFinished();
78
- if (lastGameInList === void 0 || lastGameIsFinished === true) {
79
- const isTiebreak = aGames === bGames && aGames === tieBreakAt;
80
- if (isTiebreak) games.push(new Game(tieBreakFormat));
81
- else games.push(new Game(gamesFormat));
82
- }
83
- const currentGame = games.at(-1);
84
- if (currentGame === void 0) throw "Something went wrong, this should't be undefined";
85
- currentGame.add(point);
86
- const currentGameWinner = currentGame.getWinner();
87
- if (currentGameWinner === true) {
88
- aGames += 1;
89
- }
90
- if (currentGameWinner === false) {
91
- bGames += 1;
92
- }
93
- });
94
- return games;
95
- }
96
- getNumericScore() {
97
- const games = this.getGames();
98
- let aScore = 0;
99
- let bScore = 0;
100
- games.forEach((game) => {
101
- const winner = game.getWinner();
102
- if (winner === true) {
103
- aScore++;
104
- }
105
- if (winner === false) {
106
- bScore++;
107
- }
108
- });
109
- const lastGame = games.at(-1);
110
- if (lastGame === void 0) return { games: [aScore, bScore] };
111
- if (lastGame.isFinished() === false) return {
112
- games: [aScore, bScore],
113
- currentGame: lastGame.getNumericScore()
114
- };
115
- return { games: [aScore, bScore] };
116
- }
117
- getScore() {
118
- const numericScore = this.getNumericScore();
119
- const { games, currentGame } = numericScore;
120
- if (currentGame === void 0) return `${games.join("/")}`;
121
- return `${games.join("/")} ${Game.numericToStringScoreValue(currentGame)}`;
122
- }
123
- isFinished() {
124
- const { format } = this;
125
- const { upTo, diffToWin, tieBreakAt } = format;
126
- const [aScore, bScore] = this.getNumericScore().games;
127
- const maxGamesReached = Math.max(aScore, bScore) >= upTo;
128
- const diffReached = Math.abs(aScore - bScore) >= diffToWin;
129
- const tieBreakBeenPlayed = tieBreakAt !== null && Math.max(aScore, bScore) > tieBreakAt;
130
- return tieBreakBeenPlayed || maxGamesReached && diffReached;
131
- }
132
- getWinner() {
133
- if (!this.isFinished()) return null;
134
- const [aScore, bScore] = this.getNumericScore().games;
135
- return aScore > bScore;
136
- }
137
- }
138
- Score2.Set = Set;
139
- class Match {
140
- format;
141
- pointsSequence = [];
142
- constructor(format) {
143
- this.format = format;
144
- }
145
- add(point) {
146
- this.pointsSequence.push(point);
147
- }
148
- getSets() {
149
- const { format } = this;
150
- const { upTo, setsFormat, lastSetFormat } = format;
151
- let aSets = 0;
152
- let bSets = 0;
153
- const sets = [];
154
- const { pointsSequence } = this;
155
- pointsSequence.forEach((point) => {
156
- const maxSetsReached = Math.max(aSets, bSets) >= upTo;
157
- if (maxSetsReached) return;
158
- const lastSetInList = sets.at(-1);
159
- const lastSetIsFinished = lastSetInList?.isFinished();
160
- if (lastSetInList === void 0 || lastSetIsFinished === true) {
161
- const isTiebreak = aSets === bSets && aSets === upTo;
162
- if (isTiebreak) sets.push(new Set(lastSetFormat));
163
- else sets.push(new Set(setsFormat));
164
- }
165
- const currentSet = sets.at(-1);
166
- if (currentSet === void 0) throw "Something went wrong, this should't be undefined";
167
- currentSet.add(point);
168
- const currentSetWinner = currentSet.getWinner();
169
- if (currentSetWinner === true) {
170
- aSets += 1;
171
- }
172
- if (currentSetWinner === false) {
173
- bSets += 1;
174
- }
175
- });
176
- return sets;
177
- }
178
- getNumericScore() {
179
- const sets = this.getSets();
180
- const numericScore = {
181
- sets: [],
182
- currentGame: void 0
183
- };
184
- sets.forEach((set) => {
185
- const setNumericScore = set.getNumericScore();
186
- const { games, currentGame } = setNumericScore;
187
- numericScore.sets.push(games);
188
- if (currentGame !== void 0) {
189
- numericScore.currentGame = currentGame;
190
- }
191
- });
192
- return numericScore;
193
- }
194
- getScore() {
195
- return this.getSets().map((set) => set.getScore()).join(" ");
196
- }
197
- isFinished() {
198
- const { format } = this;
199
- const { upTo } = format;
200
- const sets = this.getSets();
201
- let aSets = 0;
202
- let bSets = 0;
203
- sets.forEach((set) => {
204
- const winner = set.getWinner();
205
- if (winner === true) {
206
- aSets++;
207
- }
208
- if (winner === false) {
209
- bSets++;
210
- }
211
- });
212
- return Math.max(aSets, bSets) >= upTo;
213
- }
214
- getWinner() {
215
- if (!this.isFinished()) return null;
216
- const sets = this.getSets();
217
- let aSets = 0;
218
- let bSets = 0;
219
- sets.forEach((set) => {
220
- const winner = set.getWinner();
221
- if (winner === true) {
222
- aSets++;
223
- }
224
- if (winner === false) {
225
- bSets++;
226
- }
227
- });
228
- return aSets > bSets;
229
- }
230
- }
231
- Score2.Match = Match;
232
- })(Score = Tennis2.Score || (Tennis2.Score = {}));
233
- })(Tennis || (Tennis = {}));
234
-
235
- export {
236
- Tennis
237
- };
@@ -1,9 +0,0 @@
1
- // src/agnostic/objects/is-record/index.ts
2
- function isRecord(input) {
3
- if (typeof input !== "object" || input === null) return false;
4
- return Object.keys(input).every((key) => typeof key === "string");
5
- }
6
-
7
- export {
8
- isRecord
9
- };
@@ -1,33 +0,0 @@
1
- // src/agnostic/misc/elo/index.ts
2
- var Elo;
3
- ((Elo2) => {
4
- Elo2.K_FACTOR = 32;
5
- function getWinProbability(eloA, eloB) {
6
- const exponent = (eloB - eloA) / 400;
7
- return 1 / (1 + Math.pow(10, exponent));
8
- }
9
- Elo2.getWinProbability = getWinProbability;
10
- function getOutcome(eloA, eloB, kFactor = Elo2.K_FACTOR) {
11
- const probA = getWinProbability(eloA, eloB);
12
- const probB = 1 - probA;
13
- return {
14
- aWins: {
15
- eloA: Math.round(eloA + kFactor * (1 - probA)),
16
- eloB: Math.round(eloB + kFactor * (0 - probB))
17
- },
18
- bWins: {
19
- eloA: Math.round(eloA + kFactor * (0 - probA)),
20
- eloB: Math.round(eloB + kFactor * (1 - probB))
21
- },
22
- null: {
23
- eloA: Math.round(eloA + kFactor * (0.5 - probA)),
24
- eloB: Math.round(eloB + kFactor * (0.5 - probB))
25
- }
26
- };
27
- }
28
- Elo2.getOutcome = getOutcome;
29
- })(Elo || (Elo = {}));
30
-
31
- export {
32
- Elo
33
- };
@@ -1 +0,0 @@
1
- export default function Comp(): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +0,0 @@
1
- import { isInDirectory as isInDirectoryFunc } from './is-in-directory';
2
- import { ReadWriteEditorFunc as ReadWriteEditorFuncType, readWrite as readWriteFunc } from './read-write';
3
- import { Subpaths as SubpathsNamespace } from './subpaths';
4
- export declare namespace Files {
5
- const isInDirectory: typeof isInDirectoryFunc;
6
- type ReadWriteEditorFunc = ReadWriteEditorFuncType;
7
- const readWrite: typeof readWriteFunc;
8
- export import Subpaths = SubpathsNamespace;
9
- }
@@ -1,21 +0,0 @@
1
- import {
2
- Subpaths
3
- } from "../../chunks/chunk-HGCG2J77.js";
4
- import {
5
- isInDirectory
6
- } from "../../chunks/chunk-NRITRUZW.js";
7
- import {
8
- readWrite
9
- } from "../../chunks/chunk-7DBNMU6N.js";
10
- import "../../chunks/chunk-LQFKUNVQ.js";
11
-
12
- // src/node/files/index.ts
13
- var Files;
14
- ((Files2) => {
15
- Files2.isInDirectory = isInDirectory;
16
- Files2.readWrite = readWrite;
17
- Files2.Subpaths = Subpaths;
18
- })(Files || (Files = {}));
19
- export {
20
- Files
21
- };
@@ -1 +0,0 @@
1
- export declare function isInDirectory(childPath: string, parentPath: string): boolean;
@@ -1,6 +0,0 @@
1
- import {
2
- isInDirectory
3
- } from "../../../chunks/chunk-NRITRUZW.js";
4
- export {
5
- isInDirectory
6
- };
@@ -1,9 +0,0 @@
1
- import { promises as fs } from 'node:fs';
2
- type Path = Parameters<typeof fs.writeFile>[0];
3
- type ReadFileData = Awaited<ReturnType<typeof fs.readFile>>;
4
- type WriteFileData = Parameters<typeof fs.writeFile>[1];
5
- type ReadOptions = Parameters<typeof fs.readFile>[1];
6
- type WriteOptions = Parameters<typeof fs.writeFile>[2];
7
- export type ReadWriteEditorFunc = (curr: ReadFileData) => WriteFileData;
8
- export declare function readWrite(path: Path, editor: ReadWriteEditorFunc, ...options: [ReadOptions?, WriteOptions?]): Promise<string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | import("stream").Stream>;
9
- export {};
@@ -1,6 +0,0 @@
1
- import {
2
- readWrite
3
- } from "../../../chunks/chunk-7DBNMU6N.js";
4
- export {
5
- readWrite
6
- };
@@ -1,34 +0,0 @@
1
- import { Stats } from 'node:fs';
2
- export declare namespace Subpaths {
3
- export type ChildType = 'file' | 'directory' | 'symlink';
4
- export type ChildDetails = {
5
- type: ChildType;
6
- hidden: boolean;
7
- realPath: string;
8
- };
9
- export type ListContext = {
10
- depth?: number;
11
- lstats?: Stats | null;
12
- rootPath?: string | null;
13
- };
14
- export const defaultListContext: Required<ListContext>;
15
- export const fillListContext: (input: ListContext) => Required<ListContext>;
16
- export type ListOptions = {
17
- directories?: boolean;
18
- files?: boolean;
19
- symlinks?: boolean;
20
- hidden?: boolean;
21
- followSimlinks?: boolean;
22
- dedupeSimlinksContents?: boolean;
23
- maxDepth?: number;
24
- returnRelative?: boolean;
25
- exclude?: RegExp | string | (RegExp | string)[] | null;
26
- include?: RegExp | string | (RegExp | string)[] | null;
27
- filter?: ((path: string, details: ChildDetails) => boolean | Promise<boolean>);
28
- };
29
- export const defaultListOptions: Required<ListOptions>;
30
- export const fillOptions: (input: ListOptions) => Required<ListOptions>;
31
- export function list(...args: Parameters<typeof listAbsoluteSubpaths>): Promise<string[]>;
32
- function listAbsoluteSubpaths(inputPath: string, _options?: ListOptions, __private_context?: ListContext): Promise<string[]>;
33
- export {};
34
- }
@@ -1,7 +0,0 @@
1
- import {
2
- Subpaths
3
- } from "../../../chunks/chunk-HGCG2J77.js";
4
- import "../../../chunks/chunk-LQFKUNVQ.js";
5
- export {
6
- Subpaths
7
- };
@@ -1,9 +0,0 @@
1
- export declare function getImageColorsFromUrl(url: string): Promise<string[]>;
2
- export declare const compressorExtensions: {
3
- jpgExtensions: string[];
4
- pngExtensions: string[];
5
- webpExtensions: string[];
6
- avifExtensions: string[];
7
- heifExtensions: string[];
8
- };
9
- export declare function compressImages(src: string, preExtension: string, sizes?: number[], qualities?: number[] | number): Promise<void>;
@@ -1,74 +0,0 @@
1
- // src/node/image/index.ts
2
- import path from "node:path";
3
- import fetch from "node-fetch";
4
- import getColors from "get-image-colors";
5
- import fse from "fs-extra";
6
- import sharp from "sharp";
7
- async function getImageColorsFromUrl(url) {
8
- const data = await fetch(url);
9
- const blob = await data.blob();
10
- const arrayBuffer = await blob.arrayBuffer();
11
- const buffer = Buffer.from(arrayBuffer);
12
- const colors = await getColors(buffer, blob.type);
13
- const result = colors.map((color) => color.hex());
14
- return result;
15
- }
16
- var compressorExtensions = {
17
- jpgExtensions: [".jpg", ".jpeg"],
18
- pngExtensions: [".png"],
19
- webpExtensions: [".wepb"],
20
- avifExtensions: [".avif", ".avifs"],
21
- heifExtensions: [".heif", ".heifs", ".hif"]
22
- };
23
- async function compressImages(src, preExtension, sizes = [], qualities = 100) {
24
- if (!path.isAbsolute(src)) throw new Error("Source path must be absolute.");
25
- const files = await fse.readdir(src);
26
- const {
27
- jpgExtensions,
28
- pngExtensions,
29
- webpExtensions,
30
- avifExtensions,
31
- heifExtensions
32
- } = compressorExtensions;
33
- const allowedExtensions = [
34
- ...jpgExtensions,
35
- ...pngExtensions,
36
- ...webpExtensions,
37
- ...avifExtensions,
38
- ...heifExtensions
39
- ].flat();
40
- for (const file of files) {
41
- const filePath = path.join(src, file);
42
- const isDirectory = (await fse.stat(filePath)).isDirectory();
43
- if (isDirectory) continue;
44
- const ext = path.extname(file);
45
- const extIsAllowed = allowedExtensions.includes(ext.toLowerCase());
46
- if (!extIsAllowed) continue;
47
- const nameWithPreExt = file.replace(new RegExp(`${ext}$`), "");
48
- let matchedPreExt = nameWithPreExt.split(".").slice(1).slice(-1)[0] ?? "";
49
- const preExt = matchedPreExt === "" ? matchedPreExt : `.${matchedPreExt}`;
50
- if (preExt === preExtension) continue;
51
- const name = nameWithPreExt.replace(new RegExp(`${preExtension}$`), "");
52
- for (const sizePos in sizes) {
53
- const size = sizes[sizePos];
54
- const dstFile = `${name}.${size}${preExtension}${ext}`;
55
- const dstFilePath = path.join(src, dstFile);
56
- const quality = Array.isArray(qualities) ? qualities[sizePos] ?? qualities.slice(-1)[0] ?? 100 : qualities;
57
- const resized = sharp(filePath).withMetadata().resize(size, size, { fit: "inside", withoutEnlargement: true });
58
- if (jpgExtensions.includes(ext)) await resized.jpeg({ quality }).toFile(dstFilePath);
59
- if (pngExtensions.includes(ext)) await resized.png({ quality }).toFile(dstFilePath);
60
- if (webpExtensions.includes(ext)) await resized.webp({ quality }).toFile(dstFilePath);
61
- if (avifExtensions.includes(ext)) await resized.avif({ quality }).toFile(dstFilePath);
62
- if (heifExtensions.includes(ext)) await resized.heif({ quality }).toFile(dstFilePath);
63
- console.log(dstFilePath);
64
- console.log("size", size);
65
- console.log("quality", quality);
66
- console.log("poids", (await fse.stat(dstFilePath)).size);
67
- }
68
- }
69
- }
70
- export {
71
- compressImages,
72
- compressorExtensions,
73
- getImageColorsFromUrl
74
- };
@@ -1,19 +0,0 @@
1
- export type Config = {
2
- mxfb_projects_sync?: {
3
- lm_path?: string;
4
- mxfb_path?: string;
5
- };
6
- };
7
- export declare const emptyConfigObj: Config;
8
- export declare function createConfigFile(force?: boolean): Promise<true | Error>;
9
- declare const deletionSecurityPhrase = "THIS IS A DESTRUCTIVE AND DEFINITIVE ACTION";
10
- export declare function deleteConfigDir(security: typeof deletionSecurityPhrase): Promise<true | Error>;
11
- export declare function deleteConfigFile(security: typeof deletionSecurityPhrase): Promise<true | Error>;
12
- export declare function ensureConfigFile(): Promise<true | Error>;
13
- export declare function getConfigFile(): Promise<string | Error>;
14
- export declare function validateConfigObj(configObj: any): configObj is Config;
15
- export declare function parseConfigFile(fileContents: string): Config | Error;
16
- export declare function getConfig(create?: boolean): Promise<Config | Error>;
17
- export type ConfigUpdater = Partial<Config> | ((curr: Config) => Config);
18
- export declare function updateConfig(updater: ConfigUpdater, create?: boolean): Promise<true | Error>;
19
- export {};