@t007/toast 0.0.11 → 0.0.12

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,14 +1,9 @@
1
1
  "use strict";
2
2
  (() => {
3
- // ../utils/node_modules/sia-reactor/dist/chunk-DW7Z7YEA.js
3
+ // ../utils/dist/index.js
4
4
  function isDef(val) {
5
5
  return "undefined" !== typeof val;
6
6
  }
7
- function isObj(obj, checkArr = true) {
8
- return "object" === typeof obj && obj !== null && (checkArr ? !Array.isArray(obj) : true);
9
- }
10
-
11
- // ../utils/dist/index.js
12
7
  function isSym(val) {
13
8
  return "symbol" === typeof val;
14
9
  }
@@ -18,21 +13,12 @@
18
13
  function isStr(val) {
19
14
  return "string" === typeof val;
20
15
  }
16
+ function isObj(obj, arraycheck = true) {
17
+ return "object" === typeof obj && obj !== null && (arraycheck ? !Array.isArray(obj) : true);
18
+ }
21
19
  function isFunc(val) {
22
20
  return "function" === typeof val;
23
21
  }
24
- function uid(prefix = "") {
25
- return prefix + Date.now().toString(36) + "_" + performance.now().toString(36).replace(".", "") + "_" + Math.random().toString(36).slice(2);
26
- }
27
- function isSameURL(src1, src2) {
28
- if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
29
- try {
30
- const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
31
- return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
32
- } catch {
33
- return src1.replace(/\\/g, "/").split("?")[0].trim() === src2.replace(/\\/g, "/").split("?")[0].trim();
34
- }
35
- }
36
22
  function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
37
23
  return assignEl(el, props, dataset, styles), el;
38
24
  }
@@ -79,14 +65,27 @@
79
65
  function clamp(min = 0, val, max = Infinity) {
80
66
  return Math.min(Math.max(val, min), max);
81
67
  }
82
- function onAllMethods(owner, callback) {
68
+ function uid(prefix = "") {
69
+ return prefix + Date.now().toString(36) + "_" + performance.now().toString(36).replace(".", "") + "_" + Math.random().toString(36).slice(2);
70
+ }
71
+ function isSameURL(src1, src2) {
72
+ if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
73
+ try {
74
+ const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
75
+ return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
76
+ } catch {
77
+ return src1.replace(/\\/g, "/").split("?")[0].trim() === src2.replace(/\\/g, "/").split("?")[0].trim();
78
+ }
79
+ }
80
+ function onAllMethods(owner, callback, skipNestedOwn = true, nested = false) {
83
81
  let proto = owner;
84
82
  while (proto && proto !== Object.prototype) {
85
83
  for (const method of Object.getOwnPropertyNames(proto)) {
86
84
  if (method === "constructor") continue;
85
+ if (nested && skipNestedOwn && Object.prototype.hasOwnProperty.call(owner, method)) continue;
87
86
  if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) callback(method, owner);
88
87
  }
89
- proto = Object.getPrototypeOf(proto);
88
+ proto = Object.getPrototypeOf(proto), nested = true;
90
89
  }
91
90
  }
92
91
  function bindAllMethods(owner) {
@@ -1,12 +1,7 @@
1
- // ../utils/node_modules/sia-reactor/dist/chunk-DW7Z7YEA.js
1
+ // ../utils/dist/index.js
2
2
  function isDef(val) {
3
3
  return "undefined" !== typeof val;
4
4
  }
5
- function isObj(obj, checkArr = true) {
6
- return "object" === typeof obj && obj !== null && (checkArr ? !Array.isArray(obj) : true);
7
- }
8
-
9
- // ../utils/dist/index.js
10
5
  function isSym(val) {
11
6
  return "symbol" === typeof val;
12
7
  }
@@ -16,21 +11,12 @@ function isNum(val) {
16
11
  function isStr(val) {
17
12
  return "string" === typeof val;
18
13
  }
14
+ function isObj(obj, arraycheck = true) {
15
+ return "object" === typeof obj && obj !== null && (arraycheck ? !Array.isArray(obj) : true);
16
+ }
19
17
  function isFunc(val) {
20
18
  return "function" === typeof val;
21
19
  }
22
- function uid(prefix = "") {
23
- return prefix + Date.now().toString(36) + "_" + performance.now().toString(36).replace(".", "") + "_" + Math.random().toString(36).slice(2);
24
- }
25
- function isSameURL(src1, src2) {
26
- if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
27
- try {
28
- const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
29
- return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
30
- } catch {
31
- return src1.replace(/\\/g, "/").split("?")[0].trim() === src2.replace(/\\/g, "/").split("?")[0].trim();
32
- }
33
- }
34
20
  function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
35
21
  return assignEl(el, props, dataset, styles), el;
36
22
  }
@@ -77,14 +63,27 @@ function loadResource(req, type = "style", { module, media, crossOrigin, integri
77
63
  function clamp(min = 0, val, max = Infinity) {
78
64
  return Math.min(Math.max(val, min), max);
79
65
  }
80
- function onAllMethods(owner, callback) {
66
+ function uid(prefix = "") {
67
+ return prefix + Date.now().toString(36) + "_" + performance.now().toString(36).replace(".", "") + "_" + Math.random().toString(36).slice(2);
68
+ }
69
+ function isSameURL(src1, src2) {
70
+ if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
71
+ try {
72
+ const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
73
+ return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
74
+ } catch {
75
+ return src1.replace(/\\/g, "/").split("?")[0].trim() === src2.replace(/\\/g, "/").split("?")[0].trim();
76
+ }
77
+ }
78
+ function onAllMethods(owner, callback, skipNestedOwn = true, nested = false) {
81
79
  let proto = owner;
82
80
  while (proto && proto !== Object.prototype) {
83
81
  for (const method of Object.getOwnPropertyNames(proto)) {
84
82
  if (method === "constructor") continue;
83
+ if (nested && skipNestedOwn && Object.prototype.hasOwnProperty.call(owner, method)) continue;
85
84
  if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) callback(method, owner);
86
85
  }
87
- proto = Object.getPrototypeOf(proto);
86
+ proto = Object.getPrototypeOf(proto), nested = true;
88
87
  }
89
88
  }
90
89
  function bindAllMethods(owner) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t007/toast",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "A lightweight, pure JS toast system.",
5
5
  "author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
6
6
  "license": "MIT",
@@ -55,6 +55,6 @@
55
55
  "promise"
56
56
  ],
57
57
  "dependencies": {
58
- "@t007/utils": "^0.0.11"
58
+ "@t007/utils": "^0.0.15"
59
59
  }
60
60
  }