@design-edito/tools 0.1.37 → 0.1.38

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.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Bem
3
- } from "../../../chunks/chunk-7YW5HL6N.js";
3
+ } from "../../../chunks/chunk-KIONYWA7.js";
4
+ import "../../../chunks/chunk-W5A2TON3.js";
4
5
  import "../../../chunks/chunk-QXAJXTXV.js";
5
6
  import "../../../chunks/chunk-HC6ZOHCS.js";
6
- import "../../../chunks/chunk-W5A2TON3.js";
7
7
  export {
8
8
  Bem
9
9
  };
@@ -7,26 +7,26 @@ import "../../chunks/chunk-LV2VMOWR.js";
7
7
  import "../../chunks/chunk-RLJOYG64.js";
8
8
  import {
9
9
  Random
10
- } from "../../chunks/chunk-S32K7POB.js";
11
- import "../../chunks/chunk-D3ERTRDW.js";
10
+ } from "../../chunks/chunk-DCKTGQOX.js";
12
11
  import "../../chunks/chunk-75BICI4L.js";
12
+ import "../../chunks/chunk-D3ERTRDW.js";
13
13
  import "../../chunks/chunk-OGBUSUE6.js";
14
- import "../../chunks/chunk-WH6BPDAC.js";
15
- import "../../chunks/chunk-QHLQVR3E.js";
16
- import "../../chunks/chunk-FENXVJYO.js";
17
- import {
18
- generateNiceColor,
19
- niceColors
20
- } from "../../chunks/chunk-EDVNAV3G.js";
21
14
  import {
22
15
  Bem
23
- } from "../../chunks/chunk-7YW5HL6N.js";
24
- import "../../chunks/chunk-QXAJXTXV.js";
25
- import "../../chunks/chunk-HC6ZOHCS.js";
16
+ } from "../../chunks/chunk-KIONYWA7.js";
26
17
  import {
27
18
  classNameRegex,
28
19
  isValidClassName
29
20
  } from "../../chunks/chunk-W5A2TON3.js";
21
+ import {
22
+ generateNiceColor,
23
+ niceColors
24
+ } from "../../chunks/chunk-EDVNAV3G.js";
25
+ import "../../chunks/chunk-WH6BPDAC.js";
26
+ import "../../chunks/chunk-QHLQVR3E.js";
27
+ import "../../chunks/chunk-FENXVJYO.js";
28
+ import "../../chunks/chunk-QXAJXTXV.js";
29
+ import "../../chunks/chunk-HC6ZOHCS.js";
30
30
 
31
31
  // src/agnostic/css/styles-set/index.tsx
32
32
  import { Component } from "react";
@@ -1,3 +1,9 @@
1
+ import {
2
+ selectorToElement
3
+ } from "../../chunks/chunk-BVCWBTHQ.js";
4
+ import {
5
+ stringToNodes
6
+ } from "../../chunks/chunk-VKURVIRV.js";
1
7
  import {
2
8
  HyperJson
3
9
  } from "../../chunks/chunk-TLTLM47Y.js";
@@ -7,6 +13,9 @@ import "../../chunks/chunk-5GI5G45R.js";
7
13
  import {
8
14
  getPositionInsideParent
9
15
  } from "../../chunks/chunk-VTPRO4NJ.js";
16
+ import {
17
+ Placeholders
18
+ } from "../../chunks/chunk-VYW4IADX.js";
10
19
  import {
11
20
  insertNode
12
21
  } from "../../chunks/chunk-XA4HVHJ4.js";
@@ -14,15 +23,6 @@ import "../../chunks/chunk-XWLQR4UY.js";
14
23
  import {
15
24
  getNodeAncestors
16
25
  } from "../../chunks/chunk-LUPVHC73.js";
17
- import {
18
- Placeholders
19
- } from "../../chunks/chunk-VYW4IADX.js";
20
- import {
21
- selectorToElement
22
- } from "../../chunks/chunk-BVCWBTHQ.js";
23
- import {
24
- stringToNodes
25
- } from "../../chunks/chunk-VKURVIRV.js";
26
26
  import {
27
27
  Sanitize
28
28
  } from "../../chunks/chunk-C5753KUP.js";
@@ -0,0 +1,31 @@
1
+ export declare namespace Elo {
2
+ const K_FACTOR = 32;
3
+ /**
4
+ * Calcule la probabilité de gain de A en fonction des scores Elo de A et B.
5
+ * @param eloA Le score Elo du joueur A.
6
+ * @param eloB Le score Elo du joueur B.
7
+ * @returns La probabilité que le joueur A gagne contre le joueur B.
8
+ */
9
+ function getWinProbability(eloA: number, eloB: number): number;
10
+ /**
11
+ * Calcule les nouveaux classements Elo pour les scénarios de victoire de A, de B et de match nul.
12
+ * @param eloA Le score Elo actuel du joueur A.
13
+ * @param eloB Le score Elo actuel du joueur B.
14
+ * @param kFactor Facteur K pour les calculs Elo (facultatif, valeur par défaut = 32).
15
+ * @returns Un objet contenant les nouveaux classements Elo pour chaque scénario de résultat.
16
+ */
17
+ function getOutcome(eloA: number, eloB: number, kFactor?: number): {
18
+ aWins: {
19
+ eloA: number;
20
+ eloB: number;
21
+ };
22
+ bWins: {
23
+ eloA: number;
24
+ eloB: number;
25
+ };
26
+ null: {
27
+ eloA: number;
28
+ eloB: number;
29
+ };
30
+ };
31
+ }
@@ -0,0 +1,32 @@
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
+ export {
31
+ Elo
32
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Logs
3
- } from "../../chunks/chunk-TEB7KZWB.js";
4
- import "../../chunks/chunk-JWKI6G6E.js";
3
+ } from "../../chunks/chunk-MJQF3YZO.js";
4
+ import "../../chunks/chunk-RASMASS4.js";
5
5
  import "../../chunks/chunk-L3OCRR3V.js";
6
6
  import "../../chunks/chunk-H4PP6AHP.js";
7
7
  import {
@@ -15,17 +15,18 @@ import {
15
15
  } from "../../chunks/chunk-7AWTHZLY.js";
16
16
  import {
17
17
  LoremIpsum
18
- } from "../../chunks/chunk-R57V5HA7.js";
18
+ } from "../../chunks/chunk-6JRUZYTL.js";
19
19
  import "../../chunks/chunk-4CIS3R7T.js";
20
20
  import {
21
21
  Cast
22
22
  } from "../../chunks/chunk-SNJJII7A.js";
23
- import "../../chunks/chunk-RLAZR3NL.js";
24
23
  import "../../chunks/chunk-6RGDWX4A.js";
25
24
  import {
26
25
  isConstructorFunction
27
26
  } from "../../chunks/chunk-RCO57B6F.js";
28
27
  import "../../chunks/chunk-FCU6IHKD.js";
28
+ import "../../chunks/chunk-RLAZR3NL.js";
29
+ import "../../chunks/chunk-YS6WMSWC.js";
29
30
  import {
30
31
  Crossenv
31
32
  } from "../../chunks/chunk-FR5H2OCV.js";
@@ -34,9 +35,9 @@ import "../../chunks/chunk-LV2VMOWR.js";
34
35
  import "../../chunks/chunk-RLJOYG64.js";
35
36
  import {
36
37
  Random
37
- } from "../../chunks/chunk-S32K7POB.js";
38
- import "../../chunks/chunk-D3ERTRDW.js";
38
+ } from "../../chunks/chunk-DCKTGQOX.js";
39
39
  import "../../chunks/chunk-75BICI4L.js";
40
+ import "../../chunks/chunk-D3ERTRDW.js";
40
41
  import "../../chunks/chunk-OGBUSUE6.js";
41
42
  import "../../chunks/chunk-QXAJXTXV.js";
42
43
  import {
@@ -44,7 +45,6 @@ import {
44
45
  isNullish,
45
46
  nullishValues
46
47
  } from "../../chunks/chunk-HC6ZOHCS.js";
47
- import "../../chunks/chunk-YS6WMSWC.js";
48
48
 
49
49
  // src/agnostic/misc/index.ts
50
50
  var Misc;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Logs
3
- } from "../../../chunks/chunk-TEB7KZWB.js";
4
- import "../../../chunks/chunk-JWKI6G6E.js";
3
+ } from "../../../chunks/chunk-MJQF3YZO.js";
4
+ import "../../../chunks/chunk-RASMASS4.js";
5
5
  import "../../../chunks/chunk-L3OCRR3V.js";
6
6
  import "../../../chunks/chunk-H4PP6AHP.js";
7
7
  export {
@@ -33,7 +33,10 @@ export declare class Logger {
33
33
  constructor();
34
34
  dir(thread: string | undefined, ...args: ConsoleMethodsParams['dir']): void;
35
35
  error(thread?: string, ...args: ConsoleMethodsParams['error']): void;
36
+ group(thread?: string, ...args: ConsoleMethodsParams['group']): void;
37
+ groupEnd(thread?: string, ...args: ConsoleMethodsParams['groupEnd']): void;
36
38
  log(thread?: string, ...args: ConsoleMethodsParams['log']): void;
39
+ table(thread: string | undefined, ...args: ConsoleMethodsParams['table']): void;
37
40
  warn(thread?: string, ...args: ConsoleMethodsParams['warn']): void;
38
41
  setLog<T extends ConsoleMethod>(threadName: string, type: T, data: ConsoleMethodsParams[T]): this;
39
42
  print(this: Logger, threadFilter?: string, withStack?: boolean): void;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Logger
3
- } from "../../../../chunks/chunk-JWKI6G6E.js";
3
+ } from "../../../../chunks/chunk-RASMASS4.js";
4
4
  export {
5
5
  Logger
6
6
  };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  LoremIpsum
3
- } from "../../../chunks/chunk-R57V5HA7.js";
4
- import "../../../chunks/chunk-RLAZR3NL.js";
3
+ } from "../../../chunks/chunk-6JRUZYTL.js";
5
4
  import "../../../chunks/chunk-6RGDWX4A.js";
6
5
  import "../../../chunks/chunk-RCO57B6F.js";
7
6
  import "../../../chunks/chunk-FCU6IHKD.js";
8
- import "../../../chunks/chunk-S32K7POB.js";
9
- import "../../../chunks/chunk-D3ERTRDW.js";
7
+ import "../../../chunks/chunk-RLAZR3NL.js";
8
+ import "../../../chunks/chunk-YS6WMSWC.js";
9
+ import "../../../chunks/chunk-DCKTGQOX.js";
10
10
  import "../../../chunks/chunk-75BICI4L.js";
11
+ import "../../../chunks/chunk-D3ERTRDW.js";
11
12
  import "../../../chunks/chunk-OGBUSUE6.js";
12
- import "../../../chunks/chunk-YS6WMSWC.js";
13
13
  export {
14
14
  LoremIpsum
15
15
  };
@@ -1,19 +1,19 @@
1
1
  import {
2
- absoluteModulo
3
- } from "../../chunks/chunk-DNIOWD7K.js";
2
+ interpolate
3
+ } from "../../chunks/chunk-BJAYUP7M.js";
4
4
  import {
5
5
  createScale,
6
6
  getHarmonic
7
7
  } from "../../chunks/chunk-UYTXXUU7.js";
8
8
  import {
9
- clamp
10
- } from "../../chunks/chunk-OSAXBA7G.js";
11
- import {
12
- interpolate
13
- } from "../../chunks/chunk-BJAYUP7M.js";
9
+ absoluteModulo
10
+ } from "../../chunks/chunk-DNIOWD7K.js";
14
11
  import {
15
12
  round
16
13
  } from "../../chunks/chunk-32IRF4OP.js";
14
+ import {
15
+ clamp
16
+ } from "../../chunks/chunk-OSAXBA7G.js";
17
17
 
18
18
  // src/agnostic/numbers/index.ts
19
19
  var Numbers;
@@ -5,18 +5,18 @@ import {
5
5
  isNonNullObject,
6
6
  isObject
7
7
  } from "../../chunks/chunk-HQLRJ7XW.js";
8
+ import {
9
+ recordFormat
10
+ } from "../../chunks/chunk-YP64J65L.js";
8
11
  import {
9
12
  isRecord
10
13
  } from "../../chunks/chunk-YDIBNEGA.js";
11
- import {
12
- Validation
13
- } from "../../chunks/chunk-FPEW3A27.js";
14
14
  import {
15
15
  recordMap
16
16
  } from "../../chunks/chunk-XNF5MLCQ.js";
17
17
  import {
18
- recordFormat
19
- } from "../../chunks/chunk-YP64J65L.js";
18
+ Validation
19
+ } from "../../chunks/chunk-FPEW3A27.js";
20
20
  import {
21
21
  Enums
22
22
  } from "../../chunks/chunk-WOAYU6LB.js";
@@ -1,10 +1,10 @@
1
+ import {
2
+ memoize
3
+ } from "../../chunks/chunk-JWBDZPQG.js";
1
4
  import {
2
5
  debounce,
3
6
  throttle
4
7
  } from "../../chunks/chunk-VZDUZTW6.js";
5
- import {
6
- memoize
7
- } from "../../chunks/chunk-JWBDZPQG.js";
8
8
 
9
9
  // src/agnostic/optim/index.ts
10
10
  var Optim;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Random
3
- } from "../../chunks/chunk-S32K7POB.js";
4
- import "../../chunks/chunk-D3ERTRDW.js";
3
+ } from "../../chunks/chunk-DCKTGQOX.js";
5
4
  import "../../chunks/chunk-75BICI4L.js";
5
+ import "../../chunks/chunk-D3ERTRDW.js";
6
6
  import "../../chunks/chunk-OGBUSUE6.js";
7
7
  export {
8
8
  Random
@@ -20,4 +20,5 @@ export declare namespace Regexps {
20
20
  function stringIs(string: string, _regexp: RegExp, returnMatches: false, _flags: string): boolean;
21
21
  function stringIs(string: string, _regexp: RegExp, returnMatches: true, _flags: string): RegExpMatchArray | null;
22
22
  function fromStrings(strings: string[]): RegExp;
23
+ function escape(string: string): string;
23
24
  }
@@ -54,6 +54,7 @@ var Regexps;
54
54
  function escape(string) {
55
55
  return string.replace(/\s/igm, "\\s").replace(/\n/igm, "\\n").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
56
56
  }
57
+ Regexps2.escape = escape;
57
58
  function stringsToRootsMap(strings, rootsMap = /* @__PURE__ */ new Map()) {
58
59
  const lengthSorted = strings.sort((strA, strB) => strA.length - strB.length);
59
60
  lengthSorted.forEach((string) => {
@@ -5,16 +5,16 @@ import {
5
5
  CharCodes
6
6
  } from "../../chunks/chunk-34U4HX4V.js";
7
7
  import {
8
- matches,
9
- matchesEvery,
10
- matchesSome
11
- } from "../../chunks/chunk-LQFKUNVQ.js";
8
+ toAlphanum
9
+ } from "../../chunks/chunk-COVPTTAD.js";
12
10
  import {
13
11
  normalizeIndent
14
12
  } from "../../chunks/chunk-JQXNEJAP.js";
15
13
  import {
16
- toAlphanum
17
- } from "../../chunks/chunk-COVPTTAD.js";
14
+ matches,
15
+ matchesEvery,
16
+ matchesSome
17
+ } from "../../chunks/chunk-LQFKUNVQ.js";
18
18
 
19
19
  // src/agnostic/strings/index.ts
20
20
  var Strings;
@@ -1,12 +1,12 @@
1
- import {
2
- Duration
3
- } from "../../chunks/chunk-6NYUQXJT.js";
4
1
  import {
5
2
  timeout
6
3
  } from "../../chunks/chunk-Z7ZDDBV5.js";
7
4
  import {
8
5
  Transitions
9
6
  } from "../../chunks/chunk-ENMBK6H7.js";
7
+ import {
8
+ Duration
9
+ } from "../../chunks/chunk-6NYUQXJT.js";
10
10
  import {
11
11
  wait
12
12
  } from "../../chunks/chunk-4CIS3R7T.js";
@@ -0,0 +1,211 @@
1
+ import {
2
+ isArrayOf
3
+ } from "./chunk-6RGDWX4A.js";
4
+ import {
5
+ RANDOM_PICK_ERR_SYMBOL,
6
+ randomPick
7
+ } from "./chunk-FCU6IHKD.js";
8
+ import {
9
+ make
10
+ } from "./chunk-RLAZR3NL.js";
11
+ import {
12
+ findDuplicates
13
+ } from "./chunk-YS6WMSWC.js";
14
+ import {
15
+ Random
16
+ } from "./chunk-DCKTGQOX.js";
17
+
18
+ // src/agnostic/arrays/index.tsx
19
+ var Arrays;
20
+ ((Arrays2) => {
21
+ Arrays2.findDuplicates = findDuplicates;
22
+ Arrays2.isArrayOf = isArrayOf;
23
+ Arrays2.make = make;
24
+ Arrays2.RANDOM_PICK_ERR_SYMBOL = RANDOM_PICK_ERR_SYMBOL;
25
+ Arrays2.randomPick = randomPick;
26
+ })(Arrays || (Arrays = {}));
27
+
28
+ // src/agnostic/misc/lorem-ipsum/index.ts
29
+ var LoremIpsum;
30
+ ((LoremIpsum2) => {
31
+ LoremIpsum2.words = [
32
+ "a",
33
+ "ac",
34
+ "accumsan",
35
+ "adipiscing",
36
+ "aenean",
37
+ "aliquam",
38
+ "aliquet",
39
+ "amet",
40
+ "ante",
41
+ "arcu",
42
+ "at",
43
+ "auctor",
44
+ "augue",
45
+ "bibendum",
46
+ "blandit",
47
+ "condimentum",
48
+ "consectetur",
49
+ "consequat",
50
+ "convallis",
51
+ "cras",
52
+ "curabitur",
53
+ "cursus",
54
+ "dapibus",
55
+ "diam",
56
+ "dictum",
57
+ "dictumst",
58
+ "dignissim",
59
+ "dolor",
60
+ "donec",
61
+ "dui",
62
+ "duis",
63
+ "efficitur",
64
+ "egestas",
65
+ "eget",
66
+ "eleifend",
67
+ "elementum",
68
+ "elit",
69
+ "enim",
70
+ "erat",
71
+ "eros",
72
+ "est",
73
+ "et",
74
+ "eu",
75
+ "euismod",
76
+ "ex",
77
+ "facilisis",
78
+ "faucibus",
79
+ "felis",
80
+ "feugiat",
81
+ "finibus",
82
+ "fringilla",
83
+ "fusce",
84
+ "gravida",
85
+ "habitasse",
86
+ "hac",
87
+ "hendrerit",
88
+ "iaculis",
89
+ "id",
90
+ "imperdiet",
91
+ "in",
92
+ "integer",
93
+ "interdum",
94
+ "ipsum",
95
+ "justo",
96
+ "lacinia",
97
+ "lacus",
98
+ "laoreet",
99
+ "lectus",
100
+ "leo",
101
+ "libero",
102
+ "ligula",
103
+ "lobortis",
104
+ "lorem",
105
+ "luctus",
106
+ "maecenas",
107
+ "magna",
108
+ "malesuada",
109
+ "massa",
110
+ "mattis",
111
+ "mauris",
112
+ "maximus",
113
+ "metus",
114
+ "mi",
115
+ "molestie",
116
+ "mollis",
117
+ "morbi",
118
+ "nam",
119
+ "nec",
120
+ "neque",
121
+ "nibh",
122
+ "nisi",
123
+ "nisl",
124
+ "non",
125
+ "nulla",
126
+ "nullam",
127
+ "nunc",
128
+ "odio",
129
+ "orci",
130
+ "ornare",
131
+ "pellentesque",
132
+ "pharetra",
133
+ "phasellus",
134
+ "placerat",
135
+ "platea",
136
+ "porta",
137
+ "porttitor",
138
+ "posuere",
139
+ "praesent",
140
+ "pulvinar",
141
+ "purus",
142
+ "quam",
143
+ "quis",
144
+ "quisque",
145
+ "risus",
146
+ "rutrum",
147
+ "sagittis",
148
+ "sapien",
149
+ "sed",
150
+ "sem",
151
+ "semper",
152
+ "sit",
153
+ "sodales",
154
+ "sollicitudin",
155
+ "suscipit",
156
+ "suspendisse",
157
+ "tellus",
158
+ "tempor",
159
+ "tempus",
160
+ "tincidunt",
161
+ "tortor",
162
+ "tristique",
163
+ "turpis",
164
+ "ultrices",
165
+ "ultricies",
166
+ "urna",
167
+ "ut",
168
+ "vehicula",
169
+ "vel",
170
+ "velit",
171
+ "venenatis",
172
+ "vestibulum",
173
+ "vitae",
174
+ "vivamus",
175
+ "viverra",
176
+ "volutpat",
177
+ "vulputate"
178
+ ];
179
+ LoremIpsum2.generateSentence = (wordCount) => {
180
+ const resultArr = [];
181
+ let currentWordCound = wordCount;
182
+ for (let i = 0; i < currentWordCound; i++) {
183
+ const picked = Arrays.randomPick(LoremIpsum2.words);
184
+ if (typeof picked === "string") resultArr.push(picked);
185
+ else {
186
+ currentWordCound += 1;
187
+ }
188
+ }
189
+ const [firstWord, ...otherWords] = resultArr;
190
+ if (firstWord === void 0) return "";
191
+ const capFirstLetter = firstWord?.charAt(0).toUpperCase();
192
+ const restOfFirstWord = firstWord?.slice(1);
193
+ const sentence = [
194
+ `${capFirstLetter}${restOfFirstWord}`,
195
+ ...otherWords
196
+ ].join(" ");
197
+ return `${sentence}.`;
198
+ };
199
+ LoremIpsum2.generateSentences = (sentencesCount, maxSentenceLength = 12, minSentenceLength = 4) => {
200
+ const sentences = [];
201
+ for (let i = 0; i < sentencesCount; i++) {
202
+ const length = Random.randomInt(maxSentenceLength, minSentenceLength) ?? 8;
203
+ sentences.push((0, LoremIpsum2.generateSentence)(length));
204
+ }
205
+ return sentences;
206
+ };
207
+ })(LoremIpsum || (LoremIpsum = {}));
208
+
209
+ export {
210
+ LoremIpsum
211
+ };
@@ -0,0 +1,29 @@
1
+ import {
2
+ randomHash,
3
+ randomHashPattern,
4
+ randomUUID
5
+ } from "./chunk-75BICI4L.js";
6
+ import {
7
+ random,
8
+ randomInt
9
+ } from "./chunk-D3ERTRDW.js";
10
+ import {
11
+ hexChars,
12
+ randomHexChar
13
+ } from "./chunk-OGBUSUE6.js";
14
+
15
+ // src/agnostic/random/index.ts
16
+ var Random;
17
+ ((Random2) => {
18
+ Random2.random = random;
19
+ Random2.randomInt = randomInt;
20
+ Random2.hexChars = hexChars;
21
+ Random2.randomHexChar = randomHexChar;
22
+ Random2.randomHash = randomHash;
23
+ Random2.randomHashPattern = randomHashPattern;
24
+ Random2.randomUUID = randomUUID;
25
+ })(Random || (Random = {}));
26
+
27
+ export {
28
+ Random
29
+ };
@@ -0,0 +1,21 @@
1
+ import {
2
+ Logger
3
+ } from "./chunk-RASMASS4.js";
4
+ import {
5
+ styles
6
+ } from "./chunk-L3OCRR3V.js";
7
+ import {
8
+ makeTextBlock
9
+ } from "./chunk-H4PP6AHP.js";
10
+
11
+ // src/agnostic/misc/logs/index.ts
12
+ var Logs;
13
+ ((Logs2) => {
14
+ Logs2.makeTextBlock = makeTextBlock;
15
+ Logs2.styles = styles;
16
+ Logs2.Logger = Logger;
17
+ })(Logs || (Logs = {}));
18
+
19
+ export {
20
+ Logs
21
+ };
@@ -0,0 +1,111 @@
1
+ // src/agnostic/misc/logs/logger/index.ts
2
+ var logsTimeOrigin = /* @__PURE__ */ new Date();
3
+ var Log = class {
4
+ type;
5
+ data;
6
+ time;
7
+ stack;
8
+ constructor(type, data) {
9
+ this.type = type;
10
+ this.data = data;
11
+ this.time = /* @__PURE__ */ new Date();
12
+ this.stack = new Error().stack ?? "";
13
+ }
14
+ get displayTime() {
15
+ return this.time.toLocaleDateString("en-US", {
16
+ year: "numeric",
17
+ month: "short",
18
+ day: "numeric",
19
+ weekday: "short",
20
+ hour: "numeric",
21
+ minute: "numeric",
22
+ second: "numeric"
23
+ }) + `:${this.time.getMilliseconds()}`;
24
+ }
25
+ get elapsedTimeMs() {
26
+ return (this.time.getTime() - logsTimeOrigin.getTime()) / 1e3;
27
+ }
28
+ get displayStack() {
29
+ return this.stack.split("\n").map((line) => line.trim()).slice(4).join("\n");
30
+ }
31
+ };
32
+ var Logger = class {
33
+ _private_threads = /* @__PURE__ */ new Map();
34
+ constructor() {
35
+ this.dir = this.dir.bind(this);
36
+ this.error = this.error.bind(this);
37
+ this.group = this.group.bind(this);
38
+ this.groupEnd = this.groupEnd.bind(this);
39
+ this.log = this.log.bind(this);
40
+ this.table = this.table.bind(this);
41
+ this.warn = this.warn.bind(this);
42
+ this.setLog = this.setLog.bind(this);
43
+ this.print = this.print.bind(this);
44
+ this.printThreads = this.printThreads.bind(this);
45
+ }
46
+ // assert (thread: string = '', ...args: ConsoleMethodsParams['assert']) { this.setLog(thread, 'assert', args) }
47
+ // count (thread: string = '', ...args: ConsoleMethodsParams['count']) { this.setLog(thread, 'count', args) }
48
+ // countReset (thread: string = '', ...args: ConsoleMethodsParams['countReset']) { this.setLog(thread, 'countReset', args) }
49
+ // debug (thread: string = '', ...args: ConsoleMethodsParams['debug']) { this.setLog(thread, 'debug', args) }
50
+ dir(thread = "", ...args) {
51
+ this.setLog(thread, "dir", args);
52
+ }
53
+ // dirxml (thread: string = '', ...args: ConsoleMethodsParams['dirxml']) { this.setLog(thread, 'dirxml', args) }
54
+ error(thread = "", ...args) {
55
+ this.setLog(thread, "error", args);
56
+ }
57
+ group(thread = "", ...args) {
58
+ this.setLog(thread, "group", args);
59
+ }
60
+ // groupCollapsed (thread: string = '', ...args: ConsoleMethodsParams['groupCollapsed']) { this.setLog(thread, 'groupCollapsed', args) }
61
+ groupEnd(thread = "", ...args) {
62
+ this.setLog(thread, "groupEnd", args);
63
+ }
64
+ // info (thread: string = '', ...args: ConsoleMethodsParams['info']) { this.setLog(thread, 'info', args) }
65
+ log(thread = "", ...args) {
66
+ this.setLog(thread, "log", args);
67
+ }
68
+ table(thread = "", ...args) {
69
+ this.setLog(thread, "table", args);
70
+ }
71
+ // time (thread: string = '', ...args: ConsoleMethodsParams['time']) { this.setLog(thread, 'time', args) }
72
+ // timeEnd (thread: string = '', ...args: ConsoleMethodsParams['timeEnd']) { this.setLog(thread, 'timeEnd', args) }
73
+ // trace (thread: string = '', ...args: ConsoleMethodsParams['trace']) { this.setLog(thread, 'trace', args) }
74
+ warn(thread = "", ...args) {
75
+ this.setLog(thread, "warn", args);
76
+ }
77
+ setLog(threadName, type, data) {
78
+ const log = new Log(type, data);
79
+ const thread = this._private_threads.get(threadName) ?? [];
80
+ this._private_threads.set(threadName, [...thread, log]);
81
+ return this;
82
+ }
83
+ print(threadFilter, withStack) {
84
+ 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 }) => {
85
+ if (threadFilter === void 0) return true;
86
+ return threadName === threadFilter;
87
+ });
88
+ allLogs.forEach(({ threadName, log }) => {
89
+ console.log(`%c${threadName}`, "font-weight: 800; color: white; background: black; padding: 4px;", `+${log.elapsedTimeMs}s \u2013`, log.displayTime);
90
+ if (withStack === true) console.log(`%c${log.displayStack}`, "color: grey; font-size: inherit;");
91
+ console[log.type](...log.data);
92
+ console.log("");
93
+ });
94
+ }
95
+ printThreads(withStack) {
96
+ Array.from(this._private_threads.entries()).forEach(([threadName, logs]) => {
97
+ console.group(`%c${threadName}`, "font-weight: 800; color: white; background: black; padding: 4px;");
98
+ logs.forEach((log) => {
99
+ console.log(`+${log.elapsedTimeMs}s \u2013`, log.displayTime);
100
+ if (withStack === true) console.log(`%c${log.displayStack}`, "color: grey; font-size: inherit;");
101
+ console[log.type](...log.data);
102
+ console.log("");
103
+ });
104
+ console.groupEnd();
105
+ });
106
+ }
107
+ };
108
+
109
+ export {
110
+ Logger
111
+ };
@@ -1,12 +1,12 @@
1
- import {
2
- isInDirectory
3
- } from "../../chunks/chunk-NRITRUZW.js";
4
1
  import {
5
2
  Subpaths
6
3
  } from "../../chunks/chunk-HGCG2J77.js";
7
4
  import {
8
5
  readWrite
9
6
  } from "../../chunks/chunk-7DBNMU6N.js";
7
+ import {
8
+ isInDirectory
9
+ } from "../../chunks/chunk-NRITRUZW.js";
10
10
  import "../../chunks/chunk-LQFKUNVQ.js";
11
11
 
12
12
  // src/node/files/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",