@design-edito/tools 0.0.33 → 0.1.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 (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/{utils/agnostic → agnostic/objects/enums}/is-in-enum/index.d.ts +1 -1
  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.js +16 -0
  86. package/agnostic/objects/validation/index.d.ts +3 -0
  87. package/agnostic/objects/validation/index.js +6 -0
  88. package/agnostic/optim/index.d.ts +7 -0
  89. package/agnostic/optim/index.js +18 -0
  90. package/{utils/agnostic → agnostic/optim}/memoize/index.d.ts +1 -1
  91. package/agnostic/optim/memoize/index.js +6 -0
  92. package/agnostic/optim/throttle-debounce/index.js +8 -0
  93. package/{utils/agnostic → agnostic/optim}/throttle-debounce/types.d.ts +0 -1
  94. package/agnostic/regexps/index.d.ts +23 -0
  95. package/agnostic/regexps/index.js +89 -0
  96. package/agnostic/strings/char-codes/index.d.ts +17 -0
  97. package/agnostic/strings/char-codes/index.js +6 -0
  98. package/agnostic/strings/index.d.ts +14 -0
  99. package/agnostic/strings/index.js +32 -0
  100. package/agnostic/strings/matches/index.d.ts +3 -0
  101. package/agnostic/strings/matches/index.js +10 -0
  102. package/agnostic/strings/normalize-indent/index.d.ts +1 -0
  103. package/agnostic/strings/normalize-indent/index.js +6 -0
  104. package/{utils/agnostic → agnostic/strings}/replace-all/index.d.ts +1 -1
  105. package/agnostic/strings/replace-all/index.js +6 -0
  106. package/agnostic/strings/to-alphanum/index.d.ts +1 -0
  107. package/agnostic/strings/to-alphanum/index.js +6 -0
  108. package/chunks/chunk-32IRF4OP.js +9 -0
  109. package/chunks/chunk-34U4HX4V.js +73 -0
  110. package/chunks/chunk-4GDNHUCZ.js +162 -0
  111. package/chunks/chunk-4QQBKBYH.js +59 -0
  112. package/chunks/chunk-4VC5PT5T.js +13 -0
  113. package/chunks/chunk-5LNUCDQ6.js +132 -0
  114. package/chunks/chunk-7AWTHZLY.js +12 -0
  115. package/chunks/chunk-7DBNMU6N.js +14 -0
  116. package/chunks/chunk-COVPTTAD.js +10 -0
  117. package/chunks/chunk-DNIOWD7K.js +8 -0
  118. package/chunks/chunk-DQNJQBC6.js +10 -0
  119. package/chunks/chunk-E6MSDKON.js +13 -0
  120. package/chunks/chunk-EDVNAV3G.js +72 -0
  121. package/chunks/chunk-EW46EXFB.js +8 -0
  122. package/chunks/chunk-FPEW3A27.js +14 -0
  123. package/chunks/chunk-GJOU3UAL.js +36 -0
  124. package/chunks/chunk-HC6ZOHCS.js +14 -0
  125. package/chunks/chunk-HGCG2J77.js +122 -0
  126. package/chunks/chunk-IFD7GSGK.js +130 -0
  127. package/chunks/chunk-JQXNEJAP.js +18 -0
  128. package/chunks/chunk-JWBDZPQG.js +18 -0
  129. package/chunks/chunk-K37RALUX.js +8 -0
  130. package/chunks/chunk-KIONYWA7.js +168 -0
  131. package/chunks/chunk-KQT5CTGF.js +21 -0
  132. package/chunks/chunk-LEXQ6E6L.js +31 -0
  133. package/chunks/chunk-LQFKUNVQ.js +19 -0
  134. package/chunks/chunk-MF56TTC5.js +15 -0
  135. package/chunks/chunk-MT74WIQR.js +41 -0
  136. package/chunks/chunk-NRITRUZW.js +10 -0
  137. package/chunks/chunk-NRJQKVQV.js +31 -0
  138. package/chunks/chunk-OSAXBA7G.js +10 -0
  139. package/chunks/chunk-PO3V3I57.js +23 -0
  140. package/chunks/chunk-QXAJXTXV.js +19 -0
  141. package/chunks/chunk-RCO57B6F.js +9 -0
  142. package/chunks/chunk-SQZGZ3VT.js +15 -0
  143. package/chunks/chunk-UYTXXUU7.js +54 -0
  144. package/chunks/chunk-VTPRO4NJ.js +10 -0
  145. package/chunks/chunk-VYW4IADX.js +35 -0
  146. package/chunks/chunk-VZDUZTW6.js +113 -0
  147. package/chunks/chunk-W5A2TON3.js +10 -0
  148. package/chunks/chunk-W7YBGJ4H.js +28 -0
  149. package/chunks/chunk-WLL3FNVL.js +40 -0
  150. package/chunks/chunk-WOAYU6LB.js +13 -0
  151. package/chunks/chunk-XA4HVHJ4.js +18 -0
  152. package/chunks/chunk-XN3PZIVL.js +38 -0
  153. package/chunks/chunk-YDIBNEGA.js +9 -0
  154. package/components/index.d.ts +4 -0
  155. package/index.d.ts +3 -0
  156. package/node/files/index.d.ts +9 -0
  157. package/node/files/index.js +21 -0
  158. package/node/files/is-in-directory/index.d.ts +1 -0
  159. package/node/files/is-in-directory/index.js +6 -0
  160. package/node/files/read-write/index.d.ts +9 -0
  161. package/node/files/read-write/index.js +6 -0
  162. package/node/files/subpaths/index.d.ts +34 -0
  163. package/node/files/subpaths/index.js +7 -0
  164. package/node/index.d.ts +6 -0
  165. package/node/process/index.d.ts +8 -0
  166. package/node/process/index.js +20 -0
  167. package/{utils/node/process-exit → node/process/on-exit}/index.d.ts +1 -1
  168. package/node/process/on-exit/index.js +14 -0
  169. package/package.json +12 -12
  170. package/shared/errors/index.d.ts +14 -0
  171. package/shared/index.d.ts +0 -0
  172. package/chunks/chunk-BEZTX3QU.js +0 -1
  173. package/chunks/chunk-BW5CY5YB.js +0 -1
  174. package/chunks/chunk-DIPJ73JH.js +0 -1
  175. package/chunks/chunk-EFFU6KXJ.js +0 -1
  176. package/chunks/chunk-KNE7WIIW.js +0 -1
  177. package/chunks/chunk-LCLAV6Q2.js +0 -1
  178. package/chunks/chunk-PCAKH6ZJ.js +0 -1
  179. package/chunks/chunk-QQRJPDR7.js +0 -1
  180. package/chunks/chunk-WZBNXYN3.js +0 -1
  181. package/chunks/chunk-XCKXCF4A.js +0 -1
  182. package/chunks/chunk-ZVJO36JU.js +0 -1
  183. package/components/Comp/index.js +0 -1
  184. package/index.js +0 -96
  185. package/utils/agnostic/absolute-modulo/index.d.ts +0 -1
  186. package/utils/agnostic/absolute-modulo/index.js +0 -1
  187. package/utils/agnostic/array/index.d.ts +0 -7
  188. package/utils/agnostic/array/index.js +0 -1
  189. package/utils/agnostic/assert/index.d.ts +0 -3
  190. package/utils/agnostic/assert/index.js +0 -1
  191. package/utils/agnostic/await-timeout/index.d.ts +0 -2
  192. package/utils/agnostic/await-timeout/index.js +0 -1
  193. package/utils/agnostic/bem/index.d.ts +0 -5
  194. package/utils/agnostic/bem/index.js +0 -1
  195. package/utils/agnostic/cast/index.d.ts +0 -7
  196. package/utils/agnostic/cast/index.js +0 -1
  197. package/utils/agnostic/charcode-string/index.d.ts +0 -2
  198. package/utils/agnostic/charcode-string/index.js +0 -1
  199. package/utils/agnostic/clamp/index.d.ts +0 -1
  200. package/utils/agnostic/clamp/index.js +0 -1
  201. package/utils/agnostic/clientside-html-sanitizer/index.d.ts +0 -22
  202. package/utils/agnostic/clientside-html-sanitizer/index.js +0 -1
  203. package/utils/agnostic/crossenv/index.d.ts +0 -11
  204. package/utils/agnostic/crossenv/index.js +0 -1
  205. package/utils/agnostic/flatten-getters/index.d.ts +0 -1
  206. package/utils/agnostic/flatten-getters/index.js +0 -1
  207. package/utils/agnostic/generate-html-placeholders/index.d.ts +0 -7
  208. package/utils/agnostic/generate-html-placeholders/index.js +0 -5
  209. package/utils/agnostic/generate-nice-color/index.js +0 -1
  210. package/utils/agnostic/insert-node/index.d.ts +0 -2
  211. package/utils/agnostic/insert-node/index.js +0 -1
  212. package/utils/agnostic/interpolate/index.d.ts +0 -3
  213. package/utils/agnostic/interpolate/index.js +0 -1
  214. package/utils/agnostic/is-array-of/index.js +0 -1
  215. package/utils/agnostic/is-constructor-function/index.js +0 -1
  216. package/utils/agnostic/is-falsy/index.js +0 -1
  217. package/utils/agnostic/is-in-enum/index.js +0 -1
  218. package/utils/agnostic/is-nullish/index.js +0 -1
  219. package/utils/agnostic/is-object/index.d.ts +0 -1
  220. package/utils/agnostic/is-object/index.js +0 -1
  221. package/utils/agnostic/is-record/index.d.ts +0 -1
  222. package/utils/agnostic/is-record/index.js +0 -1
  223. package/utils/agnostic/is-valid-css-class-name/index.d.ts +0 -2
  224. package/utils/agnostic/is-valid-css-class-name/index.js +0 -1
  225. package/utils/agnostic/memoize/index.js +0 -1
  226. package/utils/agnostic/object-validate-from-partial/index.d.ts +0 -1
  227. package/utils/agnostic/object-validate-from-partial/index.js +0 -1
  228. package/utils/agnostic/random/index.d.ts +0 -9
  229. package/utils/agnostic/random/index.js +0 -1
  230. package/utils/agnostic/record-format/index.js +0 -1
  231. package/utils/agnostic/regexp/index.d.ts +0 -21
  232. package/utils/agnostic/regexp/index.js +0 -1
  233. package/utils/agnostic/replace-all/index.js +0 -1
  234. package/utils/agnostic/responsive-harmonics/index.js +0 -1
  235. package/utils/agnostic/round-numbers/index.d.ts +0 -1
  236. package/utils/agnostic/round-numbers/index.js +0 -1
  237. package/utils/agnostic/selector-to-element/index.d.ts +0 -1
  238. package/utils/agnostic/selector-to-element/index.js +0 -1
  239. package/utils/agnostic/silent-log/index.d.ts +0 -53
  240. package/utils/agnostic/silent-log/index.js +0 -9
  241. package/utils/agnostic/str-to-nodes/index.d.ts +0 -7
  242. package/utils/agnostic/str-to-nodes/index.js +0 -1
  243. package/utils/agnostic/string-matches/index.d.ts +0 -4
  244. package/utils/agnostic/string-matches/index.js +0 -1
  245. package/utils/agnostic/string-normalize-indent/index.d.ts +0 -1
  246. package/utils/agnostic/string-normalize-indent/index.js +0 -3
  247. package/utils/agnostic/throttle-debounce/index.js +0 -1
  248. package/utils/agnostic/to-alphanum/index.d.ts +0 -1
  249. package/utils/agnostic/to-alphanum/index.js +0 -1
  250. package/utils/agnostic/transition/index.d.ts +0 -39
  251. package/utils/agnostic/transition/index.js +0 -1
  252. package/utils/agnostic/wait/index.d.ts +0 -1
  253. package/utils/agnostic/wait/index.js +0 -1
  254. package/utils/browser/dynamic-css/index.d.ts +0 -4
  255. package/utils/browser/dynamic-css/index.js +0 -2
  256. package/utils/browser/get-current-downlink/index.d.ts +0 -1
  257. package/utils/browser/get-current-downlink/index.js +0 -1
  258. package/utils/browser/get-node-ancestors/index.d.ts +0 -1
  259. package/utils/browser/get-node-ancestors/index.js +0 -1
  260. package/utils/node/is-in-directory/index.d.ts +0 -1
  261. package/utils/node/is-in-directory/index.js +0 -1
  262. package/utils/node/list-subpaths/index.d.ts +0 -33
  263. package/utils/node/list-subpaths/index.js +0 -1
  264. package/utils/node/process-exit/index.js +0 -1
  265. package/utils/node/read-write-file/index.d.ts +0 -12
  266. package/utils/node/read-write-file/index.js +0 -1
  267. /package/{utils/agnostic → agnostic/css}/bem/BEM.d.ts +0 -0
  268. /package/{utils/agnostic → agnostic/css}/bem/getNamesArr.d.ts +0 -0
  269. /package/{utils/agnostic → agnostic/numbers}/responsive-harmonics/index.d.ts +0 -0
  270. /package/{utils/agnostic → agnostic/objects}/record-format/index.d.ts +0 -0
  271. /package/{utils/agnostic → agnostic/optim}/throttle-debounce/index.d.ts +0 -0
@@ -0,0 +1,28 @@
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
+ };
@@ -0,0 +1,40 @@
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
+ };
@@ -0,0 +1,13 @@
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
+ };
@@ -0,0 +1,18 @@
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
+ };
@@ -0,0 +1,38 @@
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
+ };
@@ -0,0 +1,9 @@
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
+ };
@@ -0,0 +1,4 @@
1
+ import CompClass from './Comp';
2
+ export declare namespace Components {
3
+ const Comp: typeof CompClass;
4
+ }
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { Agnostic } from './agnostic';
2
+ export { Components } from './components';
3
+ export { Node } from './node';
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,21 @@
1
+ import {
2
+ isInDirectory
3
+ } from "../../chunks/chunk-NRITRUZW.js";
4
+ import {
5
+ Subpaths
6
+ } from "../../chunks/chunk-HGCG2J77.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
+ };
@@ -0,0 +1 @@
1
+ export declare function isInDirectory(childPath: string, parentPath: string): boolean;
@@ -0,0 +1,6 @@
1
+ import {
2
+ isInDirectory
3
+ } from "../../../chunks/chunk-NRITRUZW.js";
4
+ export {
5
+ isInDirectory
6
+ };
@@ -0,0 +1,9 @@
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 {};
@@ -0,0 +1,6 @@
1
+ import {
2
+ readWrite
3
+ } from "../../../chunks/chunk-7DBNMU6N.js";
4
+ export {
5
+ readWrite
6
+ };
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,7 @@
1
+ import {
2
+ Subpaths
3
+ } from "../../../chunks/chunk-HGCG2J77.js";
4
+ import "../../../chunks/chunk-LQFKUNVQ.js";
5
+ export {
6
+ Subpaths
7
+ };
@@ -0,0 +1,6 @@
1
+ import { Files as FilesNamespace } from './files';
2
+ import { Process as ProcessNamespace } from './process';
3
+ export declare namespace Node {
4
+ export import Files = FilesNamespace;
5
+ export import Process = ProcessNamespace;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { beforeForcedExit as beforeForcedExitFunc, beforeExit as beforeExitFunc, onExit as onExitFunc, onAllExits as onAllExitsFunc } from './on-exit';
2
+ export declare namespace Process {
3
+ const forceExitEvents: string[];
4
+ const beforeForcedExit: typeof beforeForcedExitFunc;
5
+ const beforeExit: typeof beforeExitFunc;
6
+ const onExit: typeof onExitFunc;
7
+ const onAllExits: typeof onAllExitsFunc;
8
+ }
@@ -0,0 +1,20 @@
1
+ import {
2
+ beforeExit,
3
+ beforeForcedExit,
4
+ forceExitEvents,
5
+ onAllExits,
6
+ onExit
7
+ } from "../../chunks/chunk-LEXQ6E6L.js";
8
+
9
+ // src/node/process/index.ts
10
+ var Process;
11
+ ((Process2) => {
12
+ Process2.forceExitEvents = forceExitEvents;
13
+ Process2.beforeForcedExit = beforeForcedExit;
14
+ Process2.beforeExit = beforeExit;
15
+ Process2.onExit = onExit;
16
+ Process2.onAllExits = onAllExits;
17
+ })(Process || (Process = {}));
18
+ export {
19
+ Process
20
+ };
@@ -2,4 +2,4 @@ export declare const forceExitEvents: string[];
2
2
  export declare function beforeForcedExit(callback: () => void | Promise<void>): void;
3
3
  export declare function beforeExit(callback: () => void | Promise<void>): void;
4
4
  export declare function onExit(callback: () => void | Promise<void>): void;
5
- export declare function anyway(callback: () => void | Promise<void>): void;
5
+ export declare function onAllExits(callback: () => void | Promise<void>): void;
@@ -0,0 +1,14 @@
1
+ import {
2
+ beforeExit,
3
+ beforeForcedExit,
4
+ forceExitEvents,
5
+ onAllExits,
6
+ onExit
7
+ } from "../../../chunks/chunk-LEXQ6E6L.js";
8
+ export {
9
+ beforeExit,
10
+ beforeForcedExit,
11
+ forceExitEvents,
12
+ onAllExits,
13
+ onExit
14
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.0.33",
3
+ "version": "0.1.2",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -13,23 +13,23 @@
13
13
  "module": "index.js",
14
14
  "peerDependencies": {
15
15
  "chalk": "^5.3.0",
16
- "jsdom": "^24.0.0",
17
- "react": "^18.2.0",
18
- "react-dom": "^18.2.0"
16
+ "jsdom": "^24.1.1",
17
+ "react": "^18.3.1",
18
+ "react-dom": "^18.3.1"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/chalk": "^2.2.0",
22
- "@types/jsdom": "^21.1.6",
23
- "@types/node": "^20.12.5",
22
+ "@types/jsdom": "^21.1.7",
23
+ "@types/node": "^22.1.0",
24
24
  "@types/prompts": "^2.4.9",
25
- "@types/react": "^18.2.74",
26
- "@types/react-dom": "^18.2.24",
25
+ "@types/react": "^18.3.3",
26
+ "@types/react-dom": "^18.3.0",
27
27
  "@types/semver": "^7.5.8",
28
28
  "camelcase": "^8.0.0",
29
- "esbuild": "^0.20.2",
29
+ "esbuild": "^0.23.0",
30
30
  "prompts": "^2.4.2",
31
- "semver": "^7.6.0",
32
- "simple-git": "^3.24.0",
33
- "typescript": "^5.4.4"
31
+ "semver": "^7.6.3",
32
+ "simple-git": "^3.25.0",
33
+ "typescript": "^5.5.4"
34
34
  }
35
35
  }
@@ -0,0 +1,14 @@
1
+ import { Errors } from '~/agnostic/errors';
2
+ export declare enum Codes {
3
+ NO_DOCUMENT = "no-window-document-on-runtime",
4
+ NO_DOCUMENT_PLEASE_PROVIDE = "no-window-document-on-runtime-please-provide"
5
+ }
6
+ export declare const register: Errors.Register<{
7
+ "no-window-document-on-runtime": {
8
+ message: string;
9
+ };
10
+ "no-window-document-on-runtime-please-provide": {
11
+ message: string;
12
+ makeDetails: (tips?: string) => string | undefined;
13
+ };
14
+ }>;
File without changes
@@ -1 +0,0 @@
1
- import{d as o}from"./chunk-XCKXCF4A.js";function f(r){return typeof r=="boolean"?r:typeof r=="string"?r.toLowerCase().trim()==="true":!o(r)}function e(r){return typeof r=="number"?r:typeof r=="string"?parseFloat(r):0}function c(r){return typeof r=="string"?r:String(r)}function p(r){return null}function u(r){return Array.isArray(r)?r:typeof r=="object"&&r!==null?Object.entries(r).map((t,n)=>({key:t,value:n})):[r]}function s(r){return u(r).map(n=>e(n))}function y(r){let t={};try{Object.keys(r).forEach(n=>{t[n]=r[n]})}catch{return t}return t}export{f as a,e as b,c,p as d,u as e,s as f,y as g};
@@ -1 +0,0 @@
1
- function t(u,n){let r=Math.pow(10,n);return Math.round(u*r)/r}export{t as a};
@@ -1 +0,0 @@
1
- function t(n){return typeof n!="function"?!1:"prototype"in n&&"constructor"in n.prototype}export{t as a};
@@ -1 +0,0 @@
1
- import{c as N}from"./chunk-LCLAV6Q2.js";var E={depth:20};async function z(d,o=E){let l=(o.documentObj??await N()).createElement("div"),{inputFreeTransform:a}=o;return l.innerHTML=a!==void 0?a(d):d,y(l,o)?.innerHTML??""}function y(d,o=E){let{tagName:e,attributes:l,childNodes:a}=d,{allowedTags:g=[],allowedAttributes:b={},forbiddenTags:m=[],forbiddenAttributes:A={},depth:w=20,verbose:s=!1}=o;if(w<=0)return console.warn("Max depth reached"),null;let f=e.toLowerCase().trim();if(m.includes("*")||m.includes(f))return s===!0&&console.warn(e,"tag is forbidden"),null;if(!(g.includes("*")||g.includes(f)))return s===!0&&console.warn(e,"tag is not allowed"),null;let p=document.createElement(e);Array.from(l).filter(({name:t,value:i})=>{let I=A["*"]??[],O=A[f]??[];if([...I,...O].some(({attributeName:r,attributeValues:u})=>typeof r=="string"&&r!=="*"&&t!==r||typeof r!="string"&&!r.test(t)?!1:u===void 0||u.includes("*")?(s===!0&&console.warn(t,"attribute on",e,"tag is forbidden"),!0):u.some(n=>typeof n=="string"&&i===n||typeof n!="string"&&n.test(i)?(s===!0&&console.warn(i,"value for",t,"attribute on",e,"tag is forbidden. Rule:",n),!0):!1)))return!1;let F=b["*"]??[],P=b[f]??[],x=[...F,...P],c=[e,"has no allowed attributes"];return x.some(({attributeName:r,attributeValues:u})=>typeof r=="string"&&r!=="*"&&t!==r?(c=[t,"attribute on",e,"tag is not allowed"],!1):typeof r!="string"&&!r.test(t)?(c=[t,"attribute on",e,"tag is not allowed"],!1):u===void 0||u.includes("*")?!0:u.some(n=>typeof n=="string"&&i===n||typeof n!="string"&&n.test(i)?!0:(c=[i,"value for",t,"attribute on",e,"tag is not allowed"],!1)))?!0:(s===!0&&console.warn(...c),!1)}).forEach(({name:t,value:i})=>{p.setAttribute(t,i)});let h=Array.from(a).map(t=>t.nodeType===Node.ELEMENT_NODE?y(t,{...o,depth:w-1}):t.nodeType===Node.TEXT_NODE||o.keepComments===!0&&t.nodeType===Node.COMMENT_NODE?t:null).filter(t=>t!==null);return p.replaceChildren(...h),p}export{E as a,z as b,y as c};
@@ -1 +0,0 @@
1
- function e(n,r){return typeof r=="string"?n===r:n.match(r)!==null}function g(n,r){return Array.isArray(r)?r.some(t=>e(n,t)):e(n,r)}function i(n,r){return Array.isArray(r)?r.every(t=>e(n,t)):e(n,r)}export{e as a,g as b,i as c};
@@ -1 +0,0 @@
1
- var t=(e=>(e.NODE="Node.js",e.BROWSER="Browser",e.DENO="Deno",e.REACT_NATIVE="React Native",e.ELECTRON="Electron",e.CLOUDFLARE="Cloudflare Workers",e.AWS_LAMBDA="AWS Lambda",e))(t||{});function o(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"?"Node.js":typeof window<"u"&&typeof window.document<"u"?"Browser":typeof Deno<"u"?"Deno":typeof process<"u"&&typeof navigator.userAgent=="string"&&/ReactNative/.test(navigator.userAgent)?"React Native":typeof process<"u"&&typeof process.versions<"u"&&typeof process.version.electron<"u"?"Electron":typeof self<"u"&&typeof self.addEventListener=="function"&&typeof Headers<"u"?"Cloudflare Workers":typeof AWS<"u"&&typeof AWS.Lambda<"u"?"AWS Lambda":null}async function u(){let n=o();return["Browser","Electron"].includes(n)?window.document:new(await import("jsdom")).JSDOM().window.document}export{t as a,o as b,u as c};
@@ -1 +0,0 @@
1
- async function n(e){return new Promise(t=>{setTimeout(()=>t(!0),e)})}export{n as a};
@@ -1 +0,0 @@
1
- function e(t){return typeof t=="object"&&t!==null}export{e as a};
@@ -1 +0,0 @@
1
- var t=/^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$/;function a(e){return t.test(e)}export{t as a,a as b};
@@ -1 +0,0 @@
1
- import{a as s}from"./chunk-ZVJO36JU.js";var t=[...s,!1,"",0,-0,NaN];typeof BigInt=="function"&&t.push(BigInt(0));function a(l){return t.includes(l)}function o(l){return!a(l)}var u=a;export{t as a,a as b,o as c,u as d};
@@ -1 +0,0 @@
1
- var e=[null,void 0];function u(l){return e.includes(l)}function i(l){return!u(l)}var n=u;export{e as a,u as b,i as c,n as d};
@@ -1 +0,0 @@
1
- import{Fragment as u,jsx as f}from"react/jsx-runtime";function o(){return f(u,{children:"Coucou !"})}export{o as default};
package/index.js DELETED
@@ -1,96 +0,0 @@
1
- import * as Comp from './components/Comp/index.js'
2
- import * as absoluteModulo from './utils/agnostic/absolute-modulo/index.js'
3
- import * as array from './utils/agnostic/array/index.js'
4
- import * as assert from './utils/agnostic/assert/index.js'
5
- import * as awaitTimeout from './utils/agnostic/await-timeout/index.js'
6
- import * as bem from './utils/agnostic/bem/index.js'
7
- import * as cast from './utils/agnostic/cast/index.js'
8
- import * as charcodeString from './utils/agnostic/charcode-string/index.js'
9
- import * as clamp from './utils/agnostic/clamp/index.js'
10
- import * as clientsideHtmlSanitizer from './utils/agnostic/clientside-html-sanitizer/index.js'
11
- import * as crossenv from './utils/agnostic/crossenv/index.js'
12
- import * as flattenGetters from './utils/agnostic/flatten-getters/index.js'
13
- import * as generateHtmlPlaceholders from './utils/agnostic/generate-html-placeholders/index.js'
14
- import * as generateNiceColor from './utils/agnostic/generate-nice-color/index.js'
15
- import * as insertNode from './utils/agnostic/insert-node/index.js'
16
- import * as interpolate from './utils/agnostic/interpolate/index.js'
17
- import * as isArrayOf from './utils/agnostic/is-array-of/index.js'
18
- import * as isConstructorFunction from './utils/agnostic/is-constructor-function/index.js'
19
- import * as isFalsy from './utils/agnostic/is-falsy/index.js'
20
- import * as isInEnum from './utils/agnostic/is-in-enum/index.js'
21
- import * as isNullish from './utils/agnostic/is-nullish/index.js'
22
- import * as isObject from './utils/agnostic/is-object/index.js'
23
- import * as isRecord from './utils/agnostic/is-record/index.js'
24
- import * as isValidCssClassName from './utils/agnostic/is-valid-css-class-name/index.js'
25
- import * as memoize from './utils/agnostic/memoize/index.js'
26
- import * as objectValidateFromPartial from './utils/agnostic/object-validate-from-partial/index.js'
27
- import * as random from './utils/agnostic/random/index.js'
28
- import * as recordFormat from './utils/agnostic/record-format/index.js'
29
- import * as regexp from './utils/agnostic/regexp/index.js'
30
- import * as replaceAll from './utils/agnostic/replace-all/index.js'
31
- import * as responsiveHarmonics from './utils/agnostic/responsive-harmonics/index.js'
32
- import * as roundNumbers from './utils/agnostic/round-numbers/index.js'
33
- import * as selectorToElement from './utils/agnostic/selector-to-element/index.js'
34
- import * as silentLog from './utils/agnostic/silent-log/index.js'
35
- import * as strToNodes from './utils/agnostic/str-to-nodes/index.js'
36
- import * as stringMatches from './utils/agnostic/string-matches/index.js'
37
- import * as stringNormalizeIndent from './utils/agnostic/string-normalize-indent/index.js'
38
- import * as throttleDebounce from './utils/agnostic/throttle-debounce/index.js'
39
- import * as toAlphanum from './utils/agnostic/to-alphanum/index.js'
40
- import * as transition from './utils/agnostic/transition/index.js'
41
- import * as wait from './utils/agnostic/wait/index.js'
42
- import * as dynamicCss from './utils/browser/dynamic-css/index.js'
43
- import * as getCurrentDownlink from './utils/browser/get-current-downlink/index.js'
44
- import * as getNodeAncestors from './utils/browser/get-node-ancestors/index.js'
45
- import * as isInDirectory from './utils/node/is-in-directory/index.js'
46
- import * as listSubpaths from './utils/node/list-subpaths/index.js'
47
- import * as processExit from './utils/node/process-exit/index.js'
48
- import * as readWriteFile from './utils/node/read-write-file/index.js'
49
- export { Comp }
50
- export { absoluteModulo }
51
- export { array }
52
- export { assert }
53
- export { awaitTimeout }
54
- export { bem }
55
- export { cast }
56
- export { charcodeString }
57
- export { clamp }
58
- export { clientsideHtmlSanitizer }
59
- export { crossenv }
60
- export { flattenGetters }
61
- export { generateHtmlPlaceholders }
62
- export { generateNiceColor }
63
- export { insertNode }
64
- export { interpolate }
65
- export { isArrayOf }
66
- export { isConstructorFunction }
67
- export { isFalsy }
68
- export { isInEnum }
69
- export { isNullish }
70
- export { isObject }
71
- export { isRecord }
72
- export { isValidCssClassName }
73
- export { memoize }
74
- export { objectValidateFromPartial }
75
- export { random }
76
- export { recordFormat }
77
- export { regexp }
78
- export { replaceAll }
79
- export { responsiveHarmonics }
80
- export { roundNumbers }
81
- export { selectorToElement }
82
- export { silentLog }
83
- export { strToNodes }
84
- export { stringMatches }
85
- export { stringNormalizeIndent }
86
- export { throttleDebounce }
87
- export { toAlphanum }
88
- export { transition }
89
- export { wait }
90
- export { dynamicCss }
91
- export { getCurrentDownlink }
92
- export { getNodeAncestors }
93
- export { isInDirectory }
94
- export { listSubpaths }
95
- export { processExit }
96
- export { readWriteFile }
@@ -1 +0,0 @@
1
- export default function absoluteModulo(nbr: number, modulo: number): number;
@@ -1 +0,0 @@
1
- function r(n,e){return(n%e+e)%e}export{r as default};
@@ -1,7 +0,0 @@
1
- type Filler<T = any> = (pos?: number) => T;
2
- export declare function make<T>(filler: Filler<T>, length: number): T[];
3
- export declare function findDuplicates<T>(arr: T[], stopAtFirst?: boolean): T[];
4
- export declare const randomPickErrorSybol: unique symbol;
5
- export type RandomPickErrorSymbol = typeof randomPickErrorSybol;
6
- export default function randomPick<T>(arr: T[], exclude?: T[]): T | RandomPickErrorSymbol;
7
- export {};
@@ -1 +0,0 @@
1
- function f(e,t){return new Array(t).fill(null).map((r,o)=>e(o))}function s(e,t=!1){let r=new Set,o=new Set;for(let n of e){if(r.has(n)&&t)return[n];r.has(n)&&o.add(n),r.add(n)}return Array.from(o)}var a=Symbol();function i(e,t=[]){let r=[...e].filter(l=>!t.includes(l)),o=r.length;if(o===0)return a;let n=Math.floor(Math.random()*o);return r[n]}export{i as default,s as findDuplicates,f as make,a as randomPickErrorSybol};
@@ -1,3 +0,0 @@
1
- type Assertion = (() => boolean) | boolean;
2
- export default function assert(label: string, assertion: Assertion | Array<Assertion>): void;
3
- export {};
@@ -1 +0,0 @@
1
- function o(e){console.info(`\u2705 SUCCESS: "${e}"`)}function n(e){throw new Error(`\u{1F6AB} FAILURE: "${e}""`)}function s(e,r){if(Array.isArray(r))r.forEach((t,f)=>s(`${e} (${f})`,t));else if(typeof r=="function")try{r()===!1?n(e):o(e)}catch(t){n(`${t}`)}else r===!1?n(e):o(e)}export{s as default};
@@ -1,2 +0,0 @@
1
- export type Callback<T> = () => T;
2
- export default function awaitTimeout<T extends any>(callback: Callback<T>, timeoutMs: number): Promise<unknown>;
@@ -1 +0,0 @@
1
- function o(e,t){return new Promise(async(a,n)=>{let c=setTimeout(()=>n(!1),t),l=await e();return clearTimeout(c),a(l)})}export{o as default};
@@ -1,5 +0,0 @@
1
- import BEM from './BEM';
2
- import getNamesArr from './getNamesArr';
3
- declare function bem(blockNameArg: any): BEM;
4
- export { BEM, getNamesArr, bem };
5
- export default bem;
@@ -1 +0,0 @@
1
- import{b as c}from"../../../chunks/chunk-WZBNXYN3.js";import{d as h}from"../../../chunks/chunk-XCKXCF4A.js";import"../../../chunks/chunk-ZVJO36JU.js";function r(e){let i=[];return typeof e=="string"?e.trim().split(/\s+/gm).forEach(t=>{c(t)&&i.push(t)}):Array.isArray(e)?e.forEach(t=>i.push(...r(t))):typeof e=="object"&&e!==null&&Object.entries(e).forEach(([t,s])=>{h(s)||i.push(...r(t))}),i}var n=r;var o=class e{constructor(){this.findBlockByName=this.findBlockByName.bind(this),this.addBlock=this.addBlock.bind(this),this.addElement=this.addElement.bind(this),this.addModifier=this.addModifier.bind(this),this.copy=this.copy.bind(this),this.block=this.block.bind(this),this.element=this.element.bind(this),this.modifier=this.modifier.bind(this),this.blk=this.blk.bind(this),this.elt=this.elt.bind(this),this.mod=this.mod.bind(this),this.cp=this.cp.bind(this),this.addSingleBlock=this.addSingleBlock.bind(this),this.addSingleElement=this.addSingleElement.bind(this),this.addSingleModifier=this.addSingleModifier.bind(this),this.setCurrentBlockByName=this.setCurrentBlockByName.bind(this),this.createBlockByName=this.createBlockByName.bind(this),this.getCurrentBlock=this.getCurrentBlock.bind(this)}addBlock(i){return n(i).forEach(this.addSingleBlock),this}addElement(i){return n(i).forEach(this.addSingleElement),this}addModifier(i){return this.getCurrentBlock()===void 0?this:(n(i).forEach(this.addSingleModifier),this)}copy(){let i=new e;return this.blocks.forEach(t=>{i.addBlock(t.name),t.modifiers.forEach(i.addModifier)}),i}block(i){return this.copy().addBlock(i)}element(i){return this.copy().addElement(i)}modifier(i){return this.copy().addModifier(i)}blk(i){return this.block(i)}elt(i){return this.element(i)}mod(i){return this.modifier(i)}cp(){return this.copy()}get value(){return this.blocks.map(i=>[i.name,...i.modifiers.map(t=>`${i.name}_${t}`)].join(" ")).join(" ")}get val(){return this.value}blocks=[];findBlockByName(i){return this.blocks.find(t=>t.name===i)}addSingleBlock(i){if(this.findBlockByName(i)!==void 0)this.setCurrentBlockByName(i);else{let t=this.createBlockByName(i);this.blocks.push(t)}return this}addSingleElement(i){let t=this.getCurrentBlock();return t===void 0?this.addBlock(i):t.name=t.name+"__"+i,this}addSingleModifier(i){let t=this.getCurrentBlock();return t!==void 0&&t.modifiers.push(i),this}setCurrentBlockByName(i){let t=this.findBlockByName(i);if(t!==void 0){let s=this.blocks.indexOf(t);this.blocks=[...this.blocks.slice(0,s),...this.blocks.slice(s+1),t]}return this}createBlockByName(i){return{name:i,modifiers:[]}}getCurrentBlock(){return this.blocks.slice(-1)[0]}},d=o;function l(e){let i=new d;return e instanceof d?e.copy():i.addBlock(e)}var y=l;export{d as BEM,l as bem,y as default,n as getNamesArr};
@@ -1,7 +0,0 @@
1
- export declare function toBoolean(value: unknown): boolean;
2
- export declare function toNumber(value: unknown): number;
3
- export declare function toString(value: unknown): string;
4
- export declare function toNull(_value: unknown): null;
5
- export declare function toArray(value: unknown): any[];
6
- export declare function toNumberArr(value: unknown): number[];
7
- export declare function toRecord(value: unknown): Record<string, unknown>;
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g}from"../../../chunks/chunk-BEZTX3QU.js";import"../../../chunks/chunk-XCKXCF4A.js";import"../../../chunks/chunk-ZVJO36JU.js";export{e as toArray,a as toBoolean,d as toNull,b as toNumber,f as toNumberArr,g as toRecord,c as toString};
@@ -1,2 +0,0 @@
1
- export declare function toCharcodes36(str: string): string;
2
- export declare function toString(charCodes: string): string;
@@ -1 +0,0 @@
1
- function t(r){if(r.length!==1)return console.error("input char length must be of one");let n=r.charCodeAt(0);return Number.isInteger(n)?n.toString(36):console.error(`Input "${r}" charCode is not an integer: ${n}`)}function e(r){let n=parseInt(r,36);return Number.isInteger(n)?String.fromCharCode(n):console.error(`Input "${r}" parsing did not return an integer: ${n}`)}function o(r){return r.split("").map(t).join(",")}function i(r){return r.split(",").map(e).join("")}export{o as toCharcodes36,i as toString};
@@ -1 +0,0 @@
1
- export default function clamp(num: number, bound1: number, bound2: number): number;
@@ -1 +0,0 @@
1
- function r(t,m,n){let a=Math.min(m,n),e=Math.max(m,n);return Math.min(Math.max(t,a),e)}export{r as default};