@t007/dialog 0.0.8 → 0.0.11

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,11 +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
-
8
- // ../utils/dist/index.js
9
7
  function isSym(val) {
10
8
  return "symbol" === typeof val;
11
9
  }
@@ -15,15 +13,6 @@
15
13
  function isFunc(val) {
16
14
  return "function" === typeof val;
17
15
  }
18
- function isSameURL(src1, src2) {
19
- if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
20
- try {
21
- const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
22
- return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
23
- } catch {
24
- return src1.replace(/\\/g, "/").split("?")[0].trim() === src2.replace(/\\/g, "/").split("?")[0].trim();
25
- }
26
- }
27
16
  function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
28
17
  return assignEl(el, props, dataset, styles), el;
29
18
  }
@@ -67,15 +56,24 @@
67
56
  });
68
57
  return w.t007._resourceCache[src];
69
58
  }
70
- function onAllMethods(owner, callback) {
59
+ function isSameURL(src1, src2) {
60
+ if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
61
+ try {
62
+ const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
63
+ return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
64
+ } catch {
65
+ return src1.replace(/\\/g, "/").split("?")[0].trim() === src2.replace(/\\/g, "/").split("?")[0].trim();
66
+ }
67
+ }
68
+ function onAllMethods(owner, callback, skipNestedOwn = true, nested = false) {
71
69
  let proto = owner;
72
70
  while (proto && proto !== Object.prototype) {
73
71
  for (const method of Object.getOwnPropertyNames(proto)) {
74
72
  if (method === "constructor") continue;
75
- if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) continue;
76
- callback(method, owner);
73
+ if (nested && skipNestedOwn && Object.prototype.hasOwnProperty.call(owner, method)) continue;
74
+ if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) callback(method, owner);
77
75
  }
78
- proto = Object.getPrototypeOf(proto);
76
+ proto = Object.getPrototypeOf(proto), nested = true;
79
77
  }
80
78
  }
81
79
  function bindAllMethods(owner) {
@@ -1,9 +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
-
6
- // ../utils/dist/index.js
7
5
  function isSym(val) {
8
6
  return "symbol" === typeof val;
9
7
  }
@@ -13,15 +11,6 @@ function isStr(val) {
13
11
  function isFunc(val) {
14
12
  return "function" === typeof val;
15
13
  }
16
- function isSameURL(src1, src2) {
17
- if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
18
- try {
19
- const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
20
- return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
21
- } catch {
22
- return src1.replace(/\\/g, "/").split("?")[0].trim() === src2.replace(/\\/g, "/").split("?")[0].trim();
23
- }
24
- }
25
14
  function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
26
15
  return assignEl(el, props, dataset, styles), el;
27
16
  }
@@ -65,15 +54,24 @@ function loadResource(req, type = "style", { module, media, crossOrigin, integri
65
54
  });
66
55
  return w.t007._resourceCache[src];
67
56
  }
68
- function onAllMethods(owner, callback) {
57
+ function isSameURL(src1, src2) {
58
+ if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
59
+ try {
60
+ const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
61
+ return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
62
+ } catch {
63
+ return src1.replace(/\\/g, "/").split("?")[0].trim() === src2.replace(/\\/g, "/").split("?")[0].trim();
64
+ }
65
+ }
66
+ function onAllMethods(owner, callback, skipNestedOwn = true, nested = false) {
69
67
  let proto = owner;
70
68
  while (proto && proto !== Object.prototype) {
71
69
  for (const method of Object.getOwnPropertyNames(proto)) {
72
70
  if (method === "constructor") continue;
73
- if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) continue;
74
- callback(method, owner);
71
+ if (nested && skipNestedOwn && Object.prototype.hasOwnProperty.call(owner, method)) continue;
72
+ if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) callback(method, owner);
75
73
  }
76
- proto = Object.getPrototypeOf(proto);
74
+ proto = Object.getPrototypeOf(proto), nested = true;
77
75
  }
78
76
  }
79
77
  function bindAllMethods(owner) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t007/dialog",
3
- "version": "0.0.8",
3
+ "version": "0.0.11",
4
4
  "description": "A lightweight, pure JS dialog system.",
5
5
  "author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
6
6
  "license": "MIT",
@@ -57,6 +57,6 @@
57
57
  "accessible"
58
58
  ],
59
59
  "dependencies": {
60
- "@t007/utils": "^0.0.9"
60
+ "@t007/utils": "^0.0.15"
61
61
  }
62
62
  }