@carlsebastian/jsu 1.0.50 → 1.1.0

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 (49) hide show
  1. package/README.MD +1 -1
  2. package/package.json +1 -1
  3. package/src/docs/api/api.md +3 -2
  4. package/src/docs/custom/custom.md +13 -33
  5. package/src/docs/custom/error/builder/builder.md +24 -0
  6. package/src/docs/custom/error/constructor/error.constructor.md +33 -0
  7. package/src/docs/custom/error/constructor/opts/argumentError.md +78 -0
  8. package/src/docs/custom/error/constructor/opts/indexOutOfBounds.md +77 -0
  9. package/src/docs/custom/error/constructor/opts/invalidPropertyError.md +83 -0
  10. package/src/docs/custom/error/constructor/opts/missingParameterError.md +75 -0
  11. package/src/docs/custom/error/constructor/opts/missingPropertyError.md +81 -0
  12. package/src/docs/custom/error/constructor/opts/noSuchElementTagError.md +81 -0
  13. package/src/docs/custom/error/constructor/opts/notSupportedError.md +81 -0
  14. package/src/docs/custom/error/constructor/opts/unknownPropertyError.md +82 -0
  15. package/src/docs/custom/error/error.md +36 -0
  16. package/src/docs/custom/utils/clamp.md +8 -6
  17. package/src/docs/custom/utils/constructorOrTypeOf.md +8 -6
  18. package/src/docs/custom/utils/generator/generator.md +8 -6
  19. package/src/docs/custom/utils/generator/methods/generator.newToken.md +11 -8
  20. package/src/docs/custom/utils/generator/methods/generator.randomCharacters.md +11 -8
  21. package/src/docs/custom/utils/generator/methods/generator.randomInteger.md +11 -8
  22. package/src/docs/custom/utils/nameOf.md +8 -6
  23. package/src/types/api/api.d.ts +27 -9
  24. package/src/types/custom/error/builder/error.builder.d.ts +1 -1
  25. package/src/types/custom/error/constructor/error.custom.d.ts +24 -8
  26. package/src/types/custom/error/constructor/error.meta.d.ts +6 -6
  27. package/src/types/global.d.ts +3 -3
  28. package/src/utils/Arithmetic/arithmetic.js +0 -0
  29. package/src/utils/Arithmetic/operations/operation.divide.js +79 -0
  30. package/src/utils/Arithmetic/operations/operation.multiply.js +79 -0
  31. package/src/utils/Arithmetic/operations/operation.subtract.js +76 -0
  32. package/src/utils/Arithmetic/operations/operation.sum.js +76 -0
  33. package/src/utils/custom/error/builder/error.builder.js +3 -3
  34. package/src/utils/custom/error/error.js +2 -2
  35. package/src/utils/custom/utils/custom.utils.js +3 -3
  36. package/src/utils/custom/utils/generator/generator.js +4 -4
  37. package/src/utils/dom/attr/attr.class.js +4 -4
  38. package/src/utils/dom/attr/attr.id.js +3 -3
  39. package/src/utils/dom/attr/attr.style.js +5 -5
  40. package/src/utils/dom/element/create/element.create.js +14 -14
  41. package/src/utils/dom/element/getElementBy/dom.getElementBy.js +6 -6
  42. package/src/utils/dom/element/query/dom.query.js +3 -3
  43. package/src/utils/dom/element/tag-verifier/verifier.js +5 -5
  44. package/src/utils/dom/lifecycle/mount.js +3 -3
  45. package/src/utils/dom/lifecycle/unmount.js +2 -2
  46. package/src/utils/storage/local/storage.local.js +3 -3
  47. package/src/utils/storage/session/storage.session.js +3 -3
  48. package/src/utils/storage/storage.js +2 -2
  49. package/src/utils/variables.js +13 -7
@@ -1,4 +1,4 @@
1
- import Emit from '../../custom/error/builder/error.builder.js';
1
+ import Raise from '../../custom/error/builder/error.builder.js';
2
2
  import { IsChildNode, IsParentNode, IsPropertyAt } from '../../guards/data-types/data-types.js';
3
3
 
4
4
  /**
@@ -27,7 +27,7 @@ export default function Mount(parentNode, ...childNodes) {
27
27
  const Method = "Mount", PCN = childNodes.length > 1 ? "childNodes" : "childNode";
28
28
 
29
29
  if (!IsParentNode(parentNode))
30
- Emit._ArgumentError(Method, "parentNode", parentNode, "ParentNode");
30
+ Raise._ArgumentError(Method, "parentNode", parentNode, "ParentNode");
31
31
 
32
32
  if (childNodes.length === 0) {
33
33
  console.warn(`${Method}(@childNode: NOT_PROVIDED): Expects at least 1 or more child node(s) to mount! (Exited)`);
@@ -41,7 +41,7 @@ export default function Mount(parentNode, ...childNodes) {
41
41
 
42
42
  for (const Node of childNodes) {
43
43
  if (!IsChildNode(Node))
44
- Emit._ArgumentError(Method, PCN, Node, "ChildNode");
44
+ Raise._ArgumentError(Method, PCN, Node, "ChildNode");
45
45
 
46
46
  parentNode.appendChild(Node);
47
47
  }
@@ -1,4 +1,4 @@
1
- import Emit from '../../custom/error/builder/error.builder.js';
1
+ import Raise from '../../custom/error/builder/error.builder.js';
2
2
  import { IsChildNode, IsPropertyAt } from '../../guards/data-types/data-types.js';
3
3
 
4
4
  /**
@@ -31,7 +31,7 @@ export default function Unmount(...childNodes) {
31
31
 
32
32
  for (const Node of childNodes) {
33
33
  if (!IsChildNode(Node))
34
- Emit._ArgumentError(Method, PCN, Node, "ChildNode");
34
+ Raise._ArgumentError(Method, PCN, Node, "ChildNode");
35
35
 
36
36
  if (!IsPropertyAt(Node, "remove")) {
37
37
  console.warn(`${Method}(@${PCN}${ICtr > 1 ? `[${Node}]` : `: ${Node}`}: NOT_SUPPORTED_METHOD): A given child node does not support the 'remove()' method! (${ICtr > 1 ? "Skipped" : "Exited"})`);
@@ -1,4 +1,4 @@
1
- import Emit from '../../custom/error/builder/error.builder.js';
1
+ import Raise from '../../custom/error/builder/error.builder.js';
2
2
 
3
3
  /* -- Helper -- */
4
4
  /**
@@ -14,10 +14,10 @@ function ValidateStorageKey(caller, localKey, processId) {
14
14
  ? caller : `STORAGE.LOCAL.(ANONYMOUS)`;
15
15
 
16
16
  if (typeof localKey !== "string")
17
- Emit._ArgumentError(Method, "localKey", localKey, "String");
17
+ Raise._ArgumentError(Method, "localKey", localKey, "String");
18
18
 
19
19
  if (typeof processId !== "string")
20
- Emit._ArgumentError(Method, "processId", processId, "String");
20
+ Raise._ArgumentError(Method, "processId", processId, "String");
21
21
 
22
22
  const Key = localKey.trim();
23
23
  if (Key.length === 0) {
@@ -1,4 +1,4 @@
1
- import Emit from '../../custom/error/builder/error.builder.js';
1
+ import Raise from '../../custom/error/builder/error.builder.js';
2
2
 
3
3
  /* Helper */
4
4
  /**
@@ -14,10 +14,10 @@ function ValidateStorageKey(caller, sessionKey, processId) {
14
14
  ? caller : `STORAGE.SESSION.(ANONYMOUS)`;
15
15
 
16
16
  if (typeof sessionKey !== "string")
17
- Emit._ArgumentError(Method, "sessionKey", sessionKey, "String");
17
+ Raise._ArgumentError(Method, "sessionKey", sessionKey, "String");
18
18
 
19
19
  if (typeof processId !== "string")
20
- Emit._ArgumentError(Method, "processId", processId, "String");
20
+ Raise._ArgumentError(Method, "processId", processId, "String");
21
21
 
22
22
  const Key = sessionKey.trim();
23
23
  if (Key.length === 0) {
@@ -1,4 +1,4 @@
1
- import Emit from '../custom/error/builder/error.builder.js';
1
+ import Raise from '../custom/error/builder/error.builder.js';
2
2
  import { Global } from '../custom/utils/custom.utils.js';
3
3
  import { IsNullOrUndefined, IsPropertyAt } from '../guards/data-types/data-types.js';
4
4
  import LocalStorageMethods from './local/storage.local.js';
@@ -25,7 +25,7 @@ const STORAGE = {
25
25
  */
26
26
  IS_SUPPORTED() {
27
27
  if (!this.LOCAL.IS_SUPPORTED && !this.SESSION.IS_SUPPORTED)
28
- Emit._NotSupportedError(`${this.NAME}.${this.IS_SUPPORTED.name}`, this.NAME);
28
+ Raise._NotSupportedError(`${this.NAME}.${this.IS_SUPPORTED.name}`, this.NAME);
29
29
 
30
30
  return true;
31
31
  },
@@ -1,9 +1,9 @@
1
1
  /**
2
- * A collection of HTMLElements tags.
2
+ * A collection of `HTMLElement` tags.
3
3
  *
4
4
  * ***Source***: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements
5
5
  *
6
- * @type { Map<string, { Generate: () => HTMLElement }> }
6
+ * @type { Map<keyof HTMLElementTags, { Generate(): HTMLElement }> }
7
7
  */
8
8
  export const HTMLElementTags = [
9
9
  "a", "abbr", "acronym", "address", "address", "area", "article", "aside", "audio", "b", "base", "bdi",
@@ -24,11 +24,11 @@ export const HTMLElementTags = [
24
24
  }, new Map([]));
25
25
 
26
26
  /**
27
- * A collection of SVGElements tags.
27
+ * A collection of `SVGElement` tags.
28
28
  *
29
29
  * ***Source***: https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element
30
30
  *
31
- * @type { Map<string, { Generate: () => SVGElement}> }
31
+ * @type { Map<keyof SVGElementTags, { Generate(): SVGElement }> }
32
32
  */
33
33
  export const SVGElementTags = [
34
34
  "a", "animate", "animateMotion", "animateTransform", "circle", "clipPath", "defs", "desc", "ellipse",
@@ -46,11 +46,11 @@ export const SVGElementTags = [
46
46
  }, new Map([]));
47
47
 
48
48
  /**
49
- * A collection of MathMLElements tags.
49
+ * A collection of `MathMLElement` tags.
50
50
  *
51
51
  * ***Source***: https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element
52
52
  *
53
- * @type { Map<string, { Generate: () => MathMLElement}> }
53
+ * @type { Map<keyof MathElementTags, { Generate(): MathMLElement }> }
54
54
  */
55
55
  export const MathMLElementTags = [
56
56
  "math", "maction", "annotation", "annotation-xml", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts",
@@ -67,11 +67,17 @@ export const MathMLElementTags = [
67
67
  */
68
68
  export const XMLNameSpace = ["http://www.w3.org/1998/Math/MathML", "http://www.w3.org/1999/xhtml", "http://www.w3.org/2000/svg"];
69
69
 
70
+ if (globalThis.Variables === null || globalThis.Variables === undefined)
71
+ Object.defineProperty(globalThis, "Variables", {
72
+ value: {},
73
+ writable: false, configurable: true, enumerable: true
74
+ });
75
+
70
76
  [
71
77
  ["HTMLElementTags", HTMLElementTags], ["MathMLElementTags", MathMLElementTags],
72
78
  ["SVGElementTags", SVGElementTags], ["XMLNameSpace", XMLNameSpace]
73
79
  ].forEach((key, val) => {
74
- Object.defineProperty(globalThis, key, {
80
+ Object.defineProperty(globalThis.Variables, key, {
75
81
  value: val,
76
82
  writable: false, configurable: true, enumerable: true
77
83
  });