aprog 2.0.3 → 2.0.5

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.
package/package.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
2
  "name": "aprog",
3
- "version": "2.0.3",
4
- "description": "Допоміжна бібліотека js",
3
+ "version": "2.0.5",
4
+ "description": "Допоміжна JavaScript-бібліотека для проєктів",
5
5
  "main": "index.js",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./index.js",
9
+ "require": "./index.js"
10
+ }
11
+ },
6
12
  "scripts": {
7
13
  "test": "jest"
8
14
  },
9
15
  "repository": {
10
16
  "type": "git",
11
- "url": "git+https://github.com/uaproger/aprog-js.git"
17
+ "url": "https://github.com/uaproger/aprog-js.git"
12
18
  },
13
19
  "keywords": [
14
20
  "aprog",
15
- "bibliotec"
21
+ "js",
22
+ "library",
23
+ "tools",
24
+ "utilities"
16
25
  ],
17
26
  "author": "AlexProger",
18
27
  "license": "MIT",
@@ -20,10 +29,15 @@
20
29
  "url": "https://github.com/uaproger/aprog-js/issues"
21
30
  },
22
31
  "homepage": "https://github.com/uaproger/aprog-js#readme",
32
+ "type": "module",
33
+ "files": [
34
+ "index.js",
35
+ "bin/",
36
+ "src/"
37
+ ],
23
38
  "devDependencies": {
24
39
  "jest": "^29.7.0"
25
40
  },
26
- "type": "module",
27
41
  "dependencies": {
28
42
  "crypto-js": "^4.2.0"
29
43
  }
package/src/debugger.js CHANGED
@@ -21,7 +21,14 @@ class Debugger {
21
21
  console.group('%c🛠️ Debug Dump Output', 'font-weight: bold; color: #043458; font-size: 12px; background-color: #b3c2cc; padding: 4px 16px; border-radius: 4px;');
22
22
  this.#consoleDump(args);
23
23
  console.groupEnd();
24
- debugger;
24
+ if (typeof window !== 'undefined' && window.__DEV__) {
25
+ debugger;
26
+ setTimeout(() => {
27
+ debugger;
28
+ }, 0);
29
+ } else {
30
+ throw new Error("dd() breakpoint");
31
+ }
25
32
  }
26
33
  }
27
34
 
package/src/general.js CHANGED
@@ -286,10 +286,15 @@ export const label = (attributes = {}) => {
286
286
  case "value":
287
287
  if (isArray(attrValue)) {
288
288
  attrValue.forEach((element) => {
289
- isHtmlElement(element) ? label.appendChild(element) : label.innerHTML = String(element)
290
- })
289
+ isHtmlElement(element) ? label.appendChild(element) : label.innerHTML = String(element);
290
+ });
291
291
  } else {
292
- isHtmlElement(attrValue) ? label.appendChild(attrValue) : label.innerHTML = String(attrValue)
292
+ if (isHtmlElement(attrValue)) {
293
+ label.appendChild(attrValue);
294
+ } else {
295
+ label.innerHTML = String(attrValue);
296
+ label.title = String(attrValue);
297
+ }
293
298
  }
294
299
  break;
295
300
  case "style":
@@ -346,10 +351,15 @@ export const form = (attributes = {}) => {
346
351
  case "value":
347
352
  if (isArray(attrValue)) {
348
353
  attrValue.forEach((element) => {
349
- isHtmlElement(element) ? form.append(element) : form.innerHTML = String(element)
350
- })
354
+ isHtmlElement(element) ? form.append(element) : form.innerHTML = String(element);
355
+ });
351
356
  } else {
352
- isHtmlElement(attrValue) ? form.append(attrValue) : form.innerHTML = String(attrValue)
357
+ if (isHtmlElement(attrValue)) {
358
+ form.appendChild(attrValue);
359
+ } else {
360
+ form.innerHTML = String(attrValue);
361
+ form.title = String(attrValue);
362
+ }
353
363
  }
354
364
  break;
355
365
  case "style":
@@ -397,10 +407,15 @@ export const div = (attributes = {}) => {
397
407
  case "value":
398
408
  if (isArray(attrValue)) {
399
409
  attrValue.forEach((element) => {
400
- isHtmlElement(element) ? div.append(element) : div.innerHTML = String(element)
401
- })
410
+ isHtmlElement(element) ? div.append(element) : div.innerHTML = String(element);
411
+ });
402
412
  } else {
403
- isHtmlElement(attrValue) ? div.append(attrValue) : div.innerHTML = String(attrValue)
413
+ if (isHtmlElement(attrValue)) {
414
+ div.appendChild(attrValue);
415
+ } else {
416
+ div.innerHTML = String(attrValue);
417
+ div.title = String(attrValue);
418
+ }
404
419
  }
405
420
  break;
406
421
  case "style":
@@ -448,10 +463,15 @@ export const a = (attributes = {}) => {
448
463
  case "value":
449
464
  if (isArray(attrValue)) {
450
465
  attrValue.forEach((element) => {
451
- isHtmlElement(element) ? a.append(element) : a.innerHTML = String(element)
452
- })
466
+ isHtmlElement(element) ? a.append(element) : a.innerHTML = String(element);
467
+ });
453
468
  } else {
454
- isHtmlElement(attrValue) ? a.append(attrValue) : a.innerHTML = String(attrValue)
469
+ if (isHtmlElement(attrValue)) {
470
+ a.appendChild(attrValue);
471
+ } else {
472
+ a.innerHTML = String(attrValue);
473
+ a.title = String(attrValue);
474
+ }
455
475
  }
456
476
  break;
457
477
  case "style":
@@ -499,10 +519,15 @@ export const span = (attributes = {}) => {
499
519
  case "value":
500
520
  if (isArray(attrValue)) {
501
521
  attrValue.forEach((element) => {
502
- isHtmlElement(element) ? span.append(element) : span.innerHTML = String(element)
503
- })
522
+ isHtmlElement(element) ? span.append(element) : span.innerHTML = String(element);
523
+ });
504
524
  } else {
505
- isHtmlElement(attrValue) ? span.append(attrValue) : span.innerHTML = String(attrValue)
525
+ if (isHtmlElement(attrValue)) {
526
+ span.appendChild(attrValue);
527
+ } else {
528
+ span.innerHTML = String(attrValue);
529
+ span.title = String(attrValue);
530
+ }
506
531
  }
507
532
  break;
508
533
  case "style":
@@ -550,10 +575,15 @@ export const textarea = (attributes = {}) => {
550
575
  case "value":
551
576
  if (isArray(attrValue)) {
552
577
  attrValue.forEach((element) => {
553
- isHtmlElement(element) ? textarea.appendChild(element) : textarea.innerHTML = String(element)
554
- })
578
+ isHtmlElement(element) ? textarea.appendChild(element) : textarea.innerHTML = String(element);
579
+ });
555
580
  } else {
556
- isHtmlElement(attrValue) ? textarea.appendChild(attrValue) : textarea.innerHTML = String(attrValue)
581
+ if (isHtmlElement(attrValue)) {
582
+ textarea.appendChild(attrValue);
583
+ } else {
584
+ textarea.innerHTML = String(attrValue);
585
+ textarea.title = String(attrValue);
586
+ }
557
587
  }
558
588
  break;
559
589
  case "style":
@@ -601,10 +631,15 @@ export const pre = (attributes = {}) => {
601
631
  case "value":
602
632
  if (isArray(attrValue)) {
603
633
  attrValue.forEach((element) => {
604
- isHtmlElement(element) ? pre.appendChild(element) : pre.innerHTML = String(element)
605
- })
634
+ isHtmlElement(element) ? pre.appendChild(element) : pre.innerHTML = String(element);
635
+ });
606
636
  } else {
607
- isHtmlElement(attrValue) ? pre.appendChild(attrValue) : pre.innerHTML = String(attrValue)
637
+ if (isHtmlElement(attrValue)) {
638
+ pre.appendChild(attrValue);
639
+ } else {
640
+ pre.innerHTML = String(attrValue);
641
+ pre.title = String(attrValue);
642
+ }
608
643
  }
609
644
  break;
610
645
  case "style":
@@ -654,6 +689,7 @@ export const button = (attributes = {}) => {
654
689
  break;
655
690
  case "value":
656
691
  button.innerHTML = String(attrValue);
692
+ button.title = String(attrValue);
657
693
  break;
658
694
  case "disabled":
659
695
  button.disabled = attrValue;
@@ -846,10 +882,15 @@ export const table = (attributes = {}) => {
846
882
  case "value":
847
883
  if (isArray(attrValue)) {
848
884
  attrValue.forEach((element) => {
849
- isHtmlElement(element) ? table.append(element) : table.innerHTML = String(element)
850
- })
885
+ isHtmlElement(element) ? table.append(element) : table.innerHTML = String(element);
886
+ });
851
887
  } else {
852
- isHtmlElement(attrValue) ? table.append(attrValue) : table.innerHTML = String(attrValue)
888
+ if (isHtmlElement(attrValue)) {
889
+ table.appendChild(attrValue);
890
+ } else {
891
+ table.innerHTML = String(attrValue);
892
+ table.title = String(attrValue);
893
+ }
853
894
  }
854
895
  break;
855
896
  case "style":
@@ -900,10 +941,15 @@ export const caption = (attributes = {}) => {
900
941
  case "value":
901
942
  if (isArray(attrValue)) {
902
943
  attrValue.forEach((element) => {
903
- isHtmlElement(element) ? caption.append(element) : caption.innerHTML = String(element)
904
- })
944
+ isHtmlElement(element) ? caption.append(element) : caption.innerHTML = String(element);
945
+ });
905
946
  } else {
906
- isHtmlElement(attrValue) ? caption.append(attrValue) : caption.innerHTML = String(attrValue)
947
+ if (isHtmlElement(attrValue)) {
948
+ caption.appendChild(attrValue);
949
+ } else {
950
+ caption.innerHTML = String(attrValue);
951
+ caption.title = String(attrValue);
952
+ }
907
953
  }
908
954
  break;
909
955
  case "style":
@@ -951,10 +997,15 @@ export const thead = (attributes = {}) => {
951
997
  case "value":
952
998
  if (isArray(attrValue)) {
953
999
  attrValue.forEach((element) => {
954
- isHtmlElement(element) ? thead.append(element) : thead.innerHTML = String(element)
955
- })
1000
+ isHtmlElement(element) ? thead.append(element) : thead.innerHTML = String(element);
1001
+ });
956
1002
  } else {
957
- isHtmlElement(attrValue) ? thead.append(attrValue) : thead.innerHTML = String(attrValue)
1003
+ if (isHtmlElement(attrValue)) {
1004
+ thead.appendChild(attrValue);
1005
+ } else {
1006
+ thead.innerHTML = String(attrValue);
1007
+ thead.title = String(attrValue);
1008
+ }
958
1009
  }
959
1010
  break;
960
1011
  case "style":
@@ -1002,10 +1053,15 @@ export const tbody = (attributes = {}) => {
1002
1053
  case "value":
1003
1054
  if (isArray(attrValue)) {
1004
1055
  attrValue.forEach((element) => {
1005
- isHtmlElement(element) ? tbody.append(element) : tbody.innerHTML = String(element)
1006
- })
1056
+ isHtmlElement(element) ? tbody.append(element) : tbody.innerHTML = String(element);
1057
+ });
1007
1058
  } else {
1008
- isHtmlElement(attrValue) ? tbody.append(attrValue) : tbody.innerHTML = String(attrValue)
1059
+ if (isHtmlElement(attrValue)) {
1060
+ tbody.appendChild(attrValue);
1061
+ } else {
1062
+ tbody.innerHTML = String(attrValue);
1063
+ tbody.title = String(attrValue);
1064
+ }
1009
1065
  }
1010
1066
  break;
1011
1067
  case "style":
@@ -1053,10 +1109,15 @@ export const tr = (attributes = {}) => {
1053
1109
  case "value":
1054
1110
  if (isArray(attrValue)) {
1055
1111
  attrValue.forEach((element) => {
1056
- isHtmlElement(element) ? tr.append(element) : tr.innerHTML = String(element)
1057
- })
1112
+ isHtmlElement(element) ? tr.append(element) : tr.innerHTML = String(element);
1113
+ });
1058
1114
  } else {
1059
- isHtmlElement(attrValue) ? tr.append(attrValue) : tr.innerHTML = String(attrValue)
1115
+ if (isHtmlElement(attrValue)) {
1116
+ tr.appendChild(attrValue);
1117
+ } else {
1118
+ tr.innerHTML = String(attrValue);
1119
+ tr.title = String(attrValue);
1120
+ }
1060
1121
  }
1061
1122
  break;
1062
1123
  case "style":
@@ -1104,10 +1165,15 @@ export const th = (attributes = {}) => {
1104
1165
  case "value":
1105
1166
  if (isArray(attrValue)) {
1106
1167
  attrValue.forEach((element) => {
1107
- isHtmlElement(element) ? th.append(element) : th.innerHTML = String(element)
1108
- })
1168
+ isHtmlElement(element) ? th.append(element) : th.innerHTML = String(element);
1169
+ });
1109
1170
  } else {
1110
- isHtmlElement(attrValue) ? th.append(attrValue) : th.innerHTML = String(attrValue)
1171
+ if (isHtmlElement(attrValue)) {
1172
+ th.appendChild(attrValue);
1173
+ } else {
1174
+ th.innerHTML = String(attrValue);
1175
+ th.title = String(attrValue);
1176
+ }
1111
1177
  }
1112
1178
  break;
1113
1179
  case "style":
@@ -1155,10 +1221,15 @@ export const td = (attributes = {}) => {
1155
1221
  case "value":
1156
1222
  if (isArray(attrValue)) {
1157
1223
  attrValue.forEach((element) => {
1158
- isHtmlElement(element) ? td.append(element) : td.innerHTML = String(element)
1159
- })
1224
+ isHtmlElement(element) ? td.append(element) : td.innerHTML = String(element);
1225
+ });
1160
1226
  } else {
1161
- isHtmlElement(attrValue) ? td.append(attrValue) : td.innerHTML = String(attrValue)
1227
+ if (isHtmlElement(attrValue)) {
1228
+ td.appendChild(attrValue);
1229
+ } else {
1230
+ td.innerHTML = String(attrValue);
1231
+ td.title = String(attrValue);
1232
+ }
1162
1233
  }
1163
1234
  break;
1164
1235
  case "style":
package/src/prism.js CHANGED
@@ -11,11 +11,11 @@ export const prism = (text) => {
11
11
  color: #A782BB;
12
12
  background-color: #212121;
13
13
  }
14
- .token.punctuation, .token.operator { color: #d0d0d0); }
14
+ .token.punctuation, .token.operator { color: #d0d0d0; }
15
15
  .token.property { color: #A782BB; }
16
16
  .token.string { color: #8EA765; }
17
17
  .token.number { color: #118899; }
18
- .token.boolean, .token.null { color: #CC7832); }
18
+ .token.boolean, .token.null { color: #CC7832; }
19
19
  .token.editor {
20
20
  font-weight: 700;
21
21
  color: #1199dd;
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
5
- <orderEntry type="inheritedJdk" />
6
- <orderEntry type="sourceFolder" forTests="false" />
7
- </component>
8
- </module>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptLibraryMappings">
4
- <includedPredefinedLibrary name="Node.js Core" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/aprog-js.iml" filepath="$PROJECT_DIR$/.idea/aprog-js.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/php.xml DELETED
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="MessDetectorOptionsConfiguration">
4
- <option name="transferred" value="true" />
5
- </component>
6
- <component name="PHPCSFixerOptionsConfiguration">
7
- <option name="transferred" value="true" />
8
- </component>
9
- <component name="PHPCodeSnifferOptionsConfiguration">
10
- <option name="highlightLevel" value="WARNING" />
11
- <option name="transferred" value="true" />
12
- </component>
13
- <component name="PhpStanOptionsConfiguration">
14
- <option name="transferred" value="true" />
15
- </component>
16
- <component name="PsalmOptionsConfiguration">
17
- <option name="transferred" value="true" />
18
- </component>
19
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
package/index.test.js DELETED
@@ -1,7 +0,0 @@
1
- const myLibrary = require('./index');
2
-
3
- test('should log "Hello, world!"', () => {
4
- console.log = jest.fn();
5
- myLibrary();
6
- expect(console.log).toHaveBeenCalledWith('Hello, world!');
7
- });