@t007/dialog 0.0.6 → 0.0.8
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/README.md +8 -1
- package/dist/index.global.js +20 -6
- package/dist/index.js +2 -2
- package/dist/standalone.js +20 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
- [Customization](#customization)
|
|
24
24
|
- [Author](#author)
|
|
25
25
|
- [Acknowledgments](#acknowledgments)
|
|
26
|
+
- [Star History](#star-history)
|
|
26
27
|
|
|
27
28
|
---
|
|
28
29
|
|
|
@@ -223,4 +224,10 @@ Example override:
|
|
|
223
224
|
|
|
224
225
|
## Acknowledgments
|
|
225
226
|
|
|
226
|
-
Built to support modern web applications requiring non-blocking, highly customizable UI interfaces. Part of the `@t007` utility ecosystem.
|
|
227
|
+
Built to support modern web applications requiring non-blocking, highly customizable UI interfaces. Part of the `@t007` utility ecosystem.
|
|
228
|
+
|
|
229
|
+
## Star History
|
|
230
|
+
|
|
231
|
+
If you find this project useful, please consider giving it a star! ⭐
|
|
232
|
+
|
|
233
|
+
[](https://github.com/Tobi007-del/t007-tools)
|
package/dist/index.global.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(() => {
|
|
3
|
+
// ../utils/node_modules/sia-reactor/dist/chunk-DW7Z7YEA.js
|
|
4
|
+
function isDef(val) {
|
|
5
|
+
return "undefined" !== typeof val;
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
// ../utils/dist/index.js
|
|
9
|
+
function isSym(val) {
|
|
10
|
+
return "symbol" === typeof val;
|
|
11
|
+
}
|
|
12
|
+
function isStr(val) {
|
|
13
|
+
return "string" === typeof val;
|
|
14
|
+
}
|
|
15
|
+
function isFunc(val) {
|
|
16
|
+
return "function" === typeof val;
|
|
17
|
+
}
|
|
4
18
|
function isSameURL(src1, src2) {
|
|
5
|
-
if (
|
|
19
|
+
if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
|
|
6
20
|
try {
|
|
7
21
|
const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
|
|
8
22
|
return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
|
|
@@ -27,8 +41,8 @@
|
|
|
27
41
|
}
|
|
28
42
|
var VIRTUAL_RESOURCE = /* @__PURE__ */ Symbol.for("T007_VIRTUAL_RESOURCE");
|
|
29
43
|
function loadResource(req, type = "style", { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts = 3, retryKey = false } = {}, w = window) {
|
|
30
|
-
w.t007._resourceCache ??= {};
|
|
31
|
-
if (req === VIRTUAL_RESOURCE ||
|
|
44
|
+
w.t007 ??= {}, w.t007._resourceCache ??= {};
|
|
45
|
+
if (req === VIRTUAL_RESOURCE || isSym(req)) return Promise.resolve();
|
|
32
46
|
const src = req;
|
|
33
47
|
if (w.t007._resourceCache[src]) return w.t007._resourceCache[src];
|
|
34
48
|
const existing = type === "script" ? Array.prototype.find.call(w.document.scripts, (s) => isSameURL(s.src, src)) : type === "style" ? Array.prototype.find.call(w.document.styleSheets, (s) => isSameURL(s.href, src)) : null;
|
|
@@ -58,7 +72,7 @@
|
|
|
58
72
|
while (proto && proto !== Object.prototype) {
|
|
59
73
|
for (const method of Object.getOwnPropertyNames(proto)) {
|
|
60
74
|
if (method === "constructor") continue;
|
|
61
|
-
if (
|
|
75
|
+
if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) continue;
|
|
62
76
|
callback(method, owner);
|
|
63
77
|
}
|
|
64
78
|
proto = Object.getPrototypeOf(proto);
|
|
@@ -69,7 +83,7 @@
|
|
|
69
83
|
owner2[method] = owner2[method].bind(owner2);
|
|
70
84
|
});
|
|
71
85
|
}
|
|
72
|
-
if (
|
|
86
|
+
if (isDef(window)) {
|
|
73
87
|
window.t007 ??= {};
|
|
74
88
|
t007.VIRTUAL_RESOURCE = VIRTUAL_RESOURCE;
|
|
75
89
|
window.T007_TOAST_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/toast@latest`;
|
|
@@ -204,7 +218,7 @@
|
|
|
204
218
|
function prompt(question, defaultValue, options) {
|
|
205
219
|
return new Promise((resolve) => new T007_Prompt_Dialog({ question, defaultValue, resolve, options }));
|
|
206
220
|
}
|
|
207
|
-
if (
|
|
221
|
+
if (isDef(window)) {
|
|
208
222
|
t007.alert = alert;
|
|
209
223
|
t007.confirm = confirm;
|
|
210
224
|
t007.prompt = prompt;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.js
|
|
2
|
-
import { bindAllMethods, createEl, loadResource } from "@t007/utils";
|
|
2
|
+
import { isDef, bindAllMethods, createEl, loadResource } from "@t007/utils";
|
|
3
3
|
var T007_Dialog = class {
|
|
4
4
|
dialog;
|
|
5
5
|
confirmBtn;
|
|
@@ -123,7 +123,7 @@ function confirm(question, options) {
|
|
|
123
123
|
function prompt(question, defaultValue, options) {
|
|
124
124
|
return new Promise((resolve) => new T007_Prompt_Dialog({ question, defaultValue, resolve, options }));
|
|
125
125
|
}
|
|
126
|
-
if (
|
|
126
|
+
if (isDef(window)) {
|
|
127
127
|
t007.alert = alert;
|
|
128
128
|
t007.confirm = confirm;
|
|
129
129
|
t007.prompt = prompt;
|
package/dist/standalone.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
// ../utils/node_modules/sia-reactor/dist/chunk-DW7Z7YEA.js
|
|
2
|
+
function isDef(val) {
|
|
3
|
+
return "undefined" !== typeof val;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
// ../utils/dist/index.js
|
|
7
|
+
function isSym(val) {
|
|
8
|
+
return "symbol" === typeof val;
|
|
9
|
+
}
|
|
10
|
+
function isStr(val) {
|
|
11
|
+
return "string" === typeof val;
|
|
12
|
+
}
|
|
13
|
+
function isFunc(val) {
|
|
14
|
+
return "function" === typeof val;
|
|
15
|
+
}
|
|
2
16
|
function isSameURL(src1, src2) {
|
|
3
|
-
if (
|
|
17
|
+
if (!isStr(src1) || !isStr(src2) || !src1 || !src2) return false;
|
|
4
18
|
try {
|
|
5
19
|
const u1 = new URL(src1, window.location.href), u2 = new URL(src2, window.location.href);
|
|
6
20
|
return decodeURIComponent(u1.origin + u1.pathname) === decodeURIComponent(u2.origin + u2.pathname);
|
|
@@ -25,8 +39,8 @@ function assignEl(el, props, dataset, styles) {
|
|
|
25
39
|
}
|
|
26
40
|
var VIRTUAL_RESOURCE = /* @__PURE__ */ Symbol.for("T007_VIRTUAL_RESOURCE");
|
|
27
41
|
function loadResource(req, type = "style", { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts = 3, retryKey = false } = {}, w = window) {
|
|
28
|
-
w.t007._resourceCache ??= {};
|
|
29
|
-
if (req === VIRTUAL_RESOURCE ||
|
|
42
|
+
w.t007 ??= {}, w.t007._resourceCache ??= {};
|
|
43
|
+
if (req === VIRTUAL_RESOURCE || isSym(req)) return Promise.resolve();
|
|
30
44
|
const src = req;
|
|
31
45
|
if (w.t007._resourceCache[src]) return w.t007._resourceCache[src];
|
|
32
46
|
const existing = type === "script" ? Array.prototype.find.call(w.document.scripts, (s) => isSameURL(s.src, src)) : type === "style" ? Array.prototype.find.call(w.document.styleSheets, (s) => isSameURL(s.href, src)) : null;
|
|
@@ -56,7 +70,7 @@ function onAllMethods(owner, callback) {
|
|
|
56
70
|
while (proto && proto !== Object.prototype) {
|
|
57
71
|
for (const method of Object.getOwnPropertyNames(proto)) {
|
|
58
72
|
if (method === "constructor") continue;
|
|
59
|
-
if (
|
|
73
|
+
if (isFunc(Object.getOwnPropertyDescriptor(proto, method)?.value)) continue;
|
|
60
74
|
callback(method, owner);
|
|
61
75
|
}
|
|
62
76
|
proto = Object.getPrototypeOf(proto);
|
|
@@ -67,7 +81,7 @@ function bindAllMethods(owner) {
|
|
|
67
81
|
owner2[method] = owner2[method].bind(owner2);
|
|
68
82
|
});
|
|
69
83
|
}
|
|
70
|
-
if (
|
|
84
|
+
if (isDef(window)) {
|
|
71
85
|
window.t007 ??= {};
|
|
72
86
|
t007.VIRTUAL_RESOURCE = VIRTUAL_RESOURCE;
|
|
73
87
|
window.T007_TOAST_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/toast@latest`;
|
|
@@ -202,7 +216,7 @@ function confirm(question, options) {
|
|
|
202
216
|
function prompt(question, defaultValue, options) {
|
|
203
217
|
return new Promise((resolve) => new T007_Prompt_Dialog({ question, defaultValue, resolve, options }));
|
|
204
218
|
}
|
|
205
|
-
if (
|
|
219
|
+
if (isDef(window)) {
|
|
206
220
|
t007.alert = alert;
|
|
207
221
|
t007.confirm = confirm;
|
|
208
222
|
t007.prompt = prompt;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t007/dialog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
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": "
|
|
60
|
+
"@t007/utils": "^0.0.9"
|
|
61
61
|
}
|
|
62
62
|
}
|