@design-edito/tools 0.1.36 → 0.1.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/agnostic/css/index.js +11 -11
  2. package/agnostic/errors/index.js +2 -2
  3. package/agnostic/html/hyper-json/cast/index.js +2 -2
  4. package/agnostic/html/hyper-json/index.js +3 -3
  5. package/agnostic/html/hyper-json/transformers/append/index.js +2 -2
  6. package/agnostic/html/hyper-json/transformers/classList/index.js +2 -2
  7. package/agnostic/html/hyper-json/transformers/index.js +2 -2
  8. package/agnostic/html/hyper-json/transformers/join/index.js +2 -2
  9. package/agnostic/html/hyper-json/transformers/length/index.js +2 -2
  10. package/agnostic/html/hyper-json/transformers/print/index.js +2 -2
  11. package/agnostic/html/hyper-json/transformers/push/index.js +2 -2
  12. package/agnostic/html/hyper-json/transformers/querySelector/index.js +2 -2
  13. package/agnostic/html/hyper-json/transformers/ref/index.js +2 -2
  14. package/agnostic/html/hyper-json/transformers/replace/index.js +2 -2
  15. package/agnostic/html/hyper-json/transformers/split/index.js +2 -2
  16. package/agnostic/html/hyper-json/transformers/toArray/index.js +2 -2
  17. package/agnostic/html/hyper-json/transformers/toBoolean/index.js +2 -2
  18. package/agnostic/html/hyper-json/transformers/toElement/index.js +2 -2
  19. package/agnostic/html/hyper-json/transformers/toNodeList/index.js +2 -2
  20. package/agnostic/html/hyper-json/transformers/toNull/index.js +2 -2
  21. package/agnostic/html/hyper-json/transformers/toNumber/index.js +2 -2
  22. package/agnostic/html/hyper-json/transformers/toRecord/index.js +2 -2
  23. package/agnostic/html/hyper-json/transformers/toRef/index.js +2 -2
  24. package/agnostic/html/hyper-json/transformers/toString/index.js +2 -2
  25. package/agnostic/html/hyper-json/transformers/toText/index.js +2 -2
  26. package/agnostic/html/hyper-json/transformers/toTransformer/index.js +2 -2
  27. package/agnostic/html/hyper-json/transformers/transformSelected/index.js +2 -2
  28. package/agnostic/html/hyper-json/transformers/trim/index.js +2 -2
  29. package/agnostic/html/hyper-json/tree/index.js +2 -2
  30. package/agnostic/html/hyper-json/utils/index.js +2 -2
  31. package/agnostic/html/index.js +17 -17
  32. package/agnostic/html/replace-in-element/index.d.ts +1 -1
  33. package/agnostic/html/replace-in-element/index.js +1 -1
  34. package/agnostic/html/sanitize/index.js +6 -6
  35. package/agnostic/html/selector-to-element/index.js +6 -6
  36. package/agnostic/html/string-to-nodes/index.js +7 -7
  37. package/agnostic/misc/crossenv/index.js +2 -2
  38. package/agnostic/misc/elo/index.d.ts +31 -0
  39. package/agnostic/misc/elo/index.js +32 -0
  40. package/agnostic/misc/index.js +8 -8
  41. package/agnostic/misc/logs/index.js +2 -2
  42. package/agnostic/misc/logs/logger/index.d.ts +3 -0
  43. package/agnostic/misc/logs/logger/index.js +1 -1
  44. package/agnostic/misc/lorem-ipsum/index.js +4 -4
  45. package/agnostic/numbers/index.js +3 -3
  46. package/agnostic/objects/index.js +7 -7
  47. package/agnostic/optim/index.js +3 -3
  48. package/agnostic/random/index.js +2 -2
  49. package/agnostic/regexps/index.d.ts +1 -0
  50. package/agnostic/regexps/index.js +1 -0
  51. package/agnostic/strings/index.js +6 -6
  52. package/agnostic/time/index.js +3 -3
  53. package/chunks/chunk-6JRUZYTL.js +211 -0
  54. package/chunks/chunk-7YW5HL6N.js +168 -0
  55. package/chunks/chunk-BPOJYE4X.js +1108 -0
  56. package/chunks/chunk-DCKTGQOX.js +29 -0
  57. package/chunks/chunk-MJQF3YZO.js +21 -0
  58. package/chunks/chunk-R57V5HA7.js +211 -0
  59. package/chunks/chunk-RASMASS4.js +111 -0
  60. package/chunks/chunk-TLTLM47Y.js +27 -0
  61. package/chunks/chunk-XWLQR4UY.js +25 -0
  62. package/node/files/index.js +3 -3
  63. package/package.json +1 -1
@@ -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,30 +15,30 @@ import {
15
15
  } from "../../chunks/chunk-7AWTHZLY.js";
16
16
  import {
17
17
  LoremIpsum
18
- } from "../../chunks/chunk-FONURDTX.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-YS6WMSWC.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";
29
28
  import "../../chunks/chunk-RLAZR3NL.js";
29
+ import "../../chunks/chunk-YS6WMSWC.js";
30
30
  import {
31
31
  Crossenv
32
- } from "../../chunks/chunk-UFKH5WD2.js";
33
- import "../../chunks/chunk-RLJOYG64.js";
32
+ } from "../../chunks/chunk-FR5H2OCV.js";
34
33
  import "../../chunks/chunk-S2NMAH7K.js";
35
34
  import "../../chunks/chunk-LV2VMOWR.js";
35
+ import "../../chunks/chunk-RLJOYG64.js";
36
36
  import {
37
37
  Random
38
- } from "../../chunks/chunk-OVG5RGI3.js";
38
+ } from "../../chunks/chunk-DCKTGQOX.js";
39
39
  import "../../chunks/chunk-75BICI4L.js";
40
- import "../../chunks/chunk-OGBUSUE6.js";
41
40
  import "../../chunks/chunk-D3ERTRDW.js";
41
+ import "../../chunks/chunk-OGBUSUE6.js";
42
42
  import "../../chunks/chunk-QXAJXTXV.js";
43
43
  import {
44
44
  isNotNullish,
@@ -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-FONURDTX.js";
4
- import "../../../chunks/chunk-YS6WMSWC.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
7
  import "../../../chunks/chunk-RLAZR3NL.js";
9
- import "../../../chunks/chunk-OVG5RGI3.js";
8
+ import "../../../chunks/chunk-YS6WMSWC.js";
9
+ import "../../../chunks/chunk-DCKTGQOX.js";
10
10
  import "../../../chunks/chunk-75BICI4L.js";
11
- import "../../../chunks/chunk-OGBUSUE6.js";
12
11
  import "../../../chunks/chunk-D3ERTRDW.js";
12
+ import "../../../chunks/chunk-OGBUSUE6.js";
13
13
  export {
14
14
  LoremIpsum
15
15
  };
@@ -1,6 +1,3 @@
1
- import {
2
- absoluteModulo
3
- } from "../../chunks/chunk-DNIOWD7K.js";
4
1
  import {
5
2
  interpolate
6
3
  } from "../../chunks/chunk-BJAYUP7M.js";
@@ -8,6 +5,9 @@ import {
8
5
  createScale,
9
6
  getHarmonic
10
7
  } from "../../chunks/chunk-UYTXXUU7.js";
8
+ import {
9
+ absoluteModulo
10
+ } from "../../chunks/chunk-DNIOWD7K.js";
11
11
  import {
12
12
  round
13
13
  } from "../../chunks/chunk-32IRF4OP.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
- isRecord
3
- } from "../../chunks/chunk-YDIBNEGA.js";
2
+ flattenGetters
3
+ } from "../../chunks/chunk-VFJYLXCI.js";
4
4
  import {
5
5
  isNonNullObject,
6
6
  isObject
@@ -9,18 +9,18 @@ import {
9
9
  recordFormat
10
10
  } from "../../chunks/chunk-YP64J65L.js";
11
11
  import {
12
- Validation
13
- } from "../../chunks/chunk-FPEW3A27.js";
12
+ isRecord
13
+ } from "../../chunks/chunk-YDIBNEGA.js";
14
14
  import {
15
15
  recordMap
16
16
  } from "../../chunks/chunk-XNF5MLCQ.js";
17
+ import {
18
+ Validation
19
+ } from "../../chunks/chunk-FPEW3A27.js";
17
20
  import {
18
21
  Enums
19
22
  } from "../../chunks/chunk-WOAYU6LB.js";
20
23
  import "../../chunks/chunk-E6MSDKON.js";
21
- import {
22
- flattenGetters
23
- } from "../../chunks/chunk-VFJYLXCI.js";
24
24
  import "../../chunks/chunk-SNJJII7A.js";
25
25
  import "../../chunks/chunk-QXAJXTXV.js";
26
26
  import "../../chunks/chunk-HC6ZOHCS.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,9 +1,9 @@
1
1
  import {
2
2
  Random
3
- } from "../../chunks/chunk-OVG5RGI3.js";
3
+ } from "../../chunks/chunk-DCKTGQOX.js";
4
4
  import "../../chunks/chunk-75BICI4L.js";
5
- import "../../chunks/chunk-OGBUSUE6.js";
6
5
  import "../../chunks/chunk-D3ERTRDW.js";
6
+ import "../../chunks/chunk-OGBUSUE6.js";
7
7
  export {
8
8
  Random
9
9
  };
@@ -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,3 +1,6 @@
1
+ import {
2
+ timeout
3
+ } from "../../chunks/chunk-Z7ZDDBV5.js";
1
4
  import {
2
5
  Transitions
3
6
  } from "../../chunks/chunk-ENMBK6H7.js";
@@ -7,9 +10,6 @@ import {
7
10
  import {
8
11
  wait
9
12
  } from "../../chunks/chunk-4CIS3R7T.js";
10
- import {
11
- timeout
12
- } from "../../chunks/chunk-Z7ZDDBV5.js";
13
13
 
14
14
  // src/agnostic/time/index.ts
15
15
  var Time;
@@ -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,168 @@
1
+ import {
2
+ isFalsy
3
+ } from "./chunk-QXAJXTXV.js";
4
+ import {
5
+ isValidClassName
6
+ } from "./chunk-W5A2TON3.js";
7
+
8
+ // src/agnostic/css/bem/getNamesArr.ts
9
+ function getNamesArr(arg) {
10
+ const returned = [];
11
+ if (typeof arg === "string") {
12
+ arg.trim().split(/\s+/gm).forEach((name) => {
13
+ if (isValidClassName(name)) returned.push(name);
14
+ });
15
+ } else if (Array.isArray(arg)) {
16
+ arg.forEach((elt) => returned.push(...getNamesArr(elt)));
17
+ } else if (typeof arg === "object" && arg !== null) {
18
+ Object.entries(arg).forEach(([key, val]) => {
19
+ if (!isFalsy(val)) returned.push(...getNamesArr(key));
20
+ });
21
+ }
22
+ return returned;
23
+ }
24
+ var getNamesArr_default = getNamesArr;
25
+
26
+ // src/agnostic/css/bem/BEM.ts
27
+ var BEM = class _BEM {
28
+ constructor() {
29
+ this.findBlockByName = this.findBlockByName.bind(this);
30
+ this.addBlock = this.addBlock.bind(this);
31
+ this.addElement = this.addElement.bind(this);
32
+ this.addModifier = this.addModifier.bind(this);
33
+ this.copy = this.copy.bind(this);
34
+ this.block = this.block.bind(this);
35
+ this.element = this.element.bind(this);
36
+ this.modifier = this.modifier.bind(this);
37
+ this.blk = this.blk.bind(this);
38
+ this.elt = this.elt.bind(this);
39
+ this.mod = this.mod.bind(this);
40
+ this.cp = this.cp.bind(this);
41
+ this.addSingleBlock = this.addSingleBlock.bind(this);
42
+ this.addSingleElement = this.addSingleElement.bind(this);
43
+ this.addSingleModifier = this.addSingleModifier.bind(this);
44
+ this.setCurrentBlockByName = this.setCurrentBlockByName.bind(this);
45
+ this.createBlockByName = this.createBlockByName.bind(this);
46
+ this.getCurrentBlock = this.getCurrentBlock.bind(this);
47
+ }
48
+ addBlock(blockNameArg) {
49
+ const blocksNames = getNamesArr_default(blockNameArg);
50
+ blocksNames.forEach(this.addSingleBlock);
51
+ return this;
52
+ }
53
+ addElement(elementNameArg) {
54
+ const elementsNames = getNamesArr_default(elementNameArg);
55
+ elementsNames.forEach(this.addSingleElement);
56
+ return this;
57
+ }
58
+ addModifier(modifierNameArg) {
59
+ const currentBlock = this.getCurrentBlock();
60
+ if (currentBlock === void 0) return this;
61
+ const modifiersNames = getNamesArr_default(modifierNameArg);
62
+ modifiersNames.forEach(this.addSingleModifier);
63
+ return this;
64
+ }
65
+ copy() {
66
+ const copy = new _BEM();
67
+ this.blocks.forEach((block) => {
68
+ copy.addBlock(block.name);
69
+ block.modifiers.forEach(copy.addModifier);
70
+ });
71
+ return copy;
72
+ }
73
+ block(blockNameArg) {
74
+ return this.copy().addBlock(blockNameArg);
75
+ }
76
+ element(elementNameArg) {
77
+ return this.copy().addElement(elementNameArg);
78
+ }
79
+ modifier(modifierNameArg) {
80
+ return this.copy().addModifier(modifierNameArg);
81
+ }
82
+ blk(blockNameArg) {
83
+ return this.block(blockNameArg);
84
+ }
85
+ elt(elementNameArg) {
86
+ return this.element(elementNameArg);
87
+ }
88
+ mod(modifierNameArg) {
89
+ return this.modifier(modifierNameArg);
90
+ }
91
+ cp() {
92
+ return this.copy();
93
+ }
94
+ get value() {
95
+ return this.blocks.map((block) => {
96
+ return [block.name, ...block.modifiers.map((modifier) => {
97
+ return `${block.name}_${modifier}`;
98
+ })].join(" ");
99
+ }).join(" ");
100
+ }
101
+ get val() {
102
+ return this.value;
103
+ }
104
+ blocks = [];
105
+ findBlockByName(name) {
106
+ return this.blocks.find((block) => block.name === name);
107
+ }
108
+ addSingleBlock(blockName) {
109
+ if (this.findBlockByName(blockName) !== void 0) {
110
+ this.setCurrentBlockByName(blockName);
111
+ } else {
112
+ const block = this.createBlockByName(blockName);
113
+ this.blocks.push(block);
114
+ }
115
+ return this;
116
+ }
117
+ addSingleElement(elementName) {
118
+ const currentBlock = this.getCurrentBlock();
119
+ if (currentBlock === void 0) this.addBlock(elementName);
120
+ else {
121
+ currentBlock.name = currentBlock.name + "__" + elementName;
122
+ }
123
+ return this;
124
+ }
125
+ addSingleModifier(modifierName) {
126
+ const currentBlock = this.getCurrentBlock();
127
+ if (currentBlock !== void 0) {
128
+ currentBlock.modifiers.push(modifierName);
129
+ }
130
+ return this;
131
+ }
132
+ setCurrentBlockByName(blockName) {
133
+ const block = this.findBlockByName(blockName);
134
+ if (block !== void 0) {
135
+ const blockPos = this.blocks.indexOf(block);
136
+ this.blocks = [
137
+ ...this.blocks.slice(0, blockPos),
138
+ ...this.blocks.slice(blockPos + 1),
139
+ block
140
+ ];
141
+ }
142
+ return this;
143
+ }
144
+ createBlockByName(blockName) {
145
+ return { name: blockName, modifiers: [] };
146
+ }
147
+ getCurrentBlock() {
148
+ return this.blocks.slice(-1)[0];
149
+ }
150
+ };
151
+ var BEM_default = BEM;
152
+
153
+ // src/agnostic/css/bem/index.ts
154
+ var Bem;
155
+ ((Bem2) => {
156
+ Bem2.BEM = BEM_default;
157
+ function bem(blockNameArg) {
158
+ const bem2 = new BEM_default();
159
+ if (blockNameArg instanceof BEM_default) return blockNameArg.copy();
160
+ return bem2.addBlock(blockNameArg);
161
+ }
162
+ Bem2.bem = bem;
163
+ Bem2.getNamesArr = getNamesArr_default;
164
+ })(Bem || (Bem = {}));
165
+
166
+ export {
167
+ Bem
168
+ };