@symbo.ls/utils 2.11.411 → 2.11.420
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/dist/cjs/browser.js +7 -5
- package/dist/cjs/codify.js +7 -1
- package/dist/cjs/index.js +17 -7
- package/dist/cjs/load.js +3 -1
- package/dist/cjs/scaling.js +7 -1
- package/package.json +2 -2
- package/src/browser.js +7 -5
- package/src/load.js +2 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -23,12 +23,14 @@ __export(browser_exports, {
|
|
|
23
23
|
toggleFullscreen: () => toggleFullscreen
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(browser_exports);
|
|
26
|
-
var toggleFullscreen = (el) => {
|
|
27
|
-
if (!document.fullscreenElement) {
|
|
28
|
-
|
|
26
|
+
var toggleFullscreen = async (el) => {
|
|
27
|
+
if (!document.fullscreenElement && el.node) {
|
|
28
|
+
try {
|
|
29
|
+
await el.node.requestFullscreen();
|
|
30
|
+
} catch (err) {
|
|
29
31
|
console.warn(`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`);
|
|
30
|
-
}
|
|
32
|
+
}
|
|
31
33
|
} else {
|
|
32
|
-
document.exitFullscreen();
|
|
34
|
+
await document.exitFullscreen();
|
|
33
35
|
}
|
|
34
36
|
};
|
package/dist/cjs/codify.js
CHANGED
|
@@ -732,7 +732,7 @@ var require_object = __commonJS({
|
|
|
732
732
|
return o;
|
|
733
733
|
};
|
|
734
734
|
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
735
|
-
const o = (0, import_types.isArray)(obj) ? [] : {};
|
|
735
|
+
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
736
736
|
for (const prop in obj) {
|
|
737
737
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
738
738
|
continue;
|
|
@@ -1108,6 +1108,12 @@ var require_object = __commonJS({
|
|
|
1108
1108
|
if (foundString || foundInArray)
|
|
1109
1109
|
return el;
|
|
1110
1110
|
}
|
|
1111
|
+
if (el.parent && el.parent.childExtend) {
|
|
1112
|
+
const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
1113
|
+
const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
1114
|
+
if (foundString || foundInArray)
|
|
1115
|
+
return el;
|
|
1116
|
+
}
|
|
1111
1117
|
};
|
|
1112
1118
|
var getExtendsInElement = (obj) => {
|
|
1113
1119
|
let result = [];
|
package/dist/cjs/index.js
CHANGED
|
@@ -732,7 +732,7 @@ var require_object = __commonJS({
|
|
|
732
732
|
return o;
|
|
733
733
|
};
|
|
734
734
|
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
735
|
-
const o = (0, import_types.isArray)(obj) ? [] : {};
|
|
735
|
+
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
736
736
|
for (const prop in obj) {
|
|
737
737
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
738
738
|
continue;
|
|
@@ -1108,6 +1108,12 @@ var require_object = __commonJS({
|
|
|
1108
1108
|
if (foundString || foundInArray)
|
|
1109
1109
|
return el;
|
|
1110
1110
|
}
|
|
1111
|
+
if (el.parent && el.parent.childExtend) {
|
|
1112
|
+
const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
1113
|
+
const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
1114
|
+
if (foundString || foundInArray)
|
|
1115
|
+
return el;
|
|
1116
|
+
}
|
|
1111
1117
|
};
|
|
1112
1118
|
var getExtendsInElement = (obj) => {
|
|
1113
1119
|
let result = [];
|
|
@@ -1537,13 +1543,15 @@ module.exports = __toCommonJS(src_exports);
|
|
|
1537
1543
|
var import_utils2 = __toESM(require_cjs(), 1);
|
|
1538
1544
|
|
|
1539
1545
|
// src/browser.js
|
|
1540
|
-
var toggleFullscreen = (el) => {
|
|
1541
|
-
if (!document.fullscreenElement) {
|
|
1542
|
-
|
|
1546
|
+
var toggleFullscreen = async (el) => {
|
|
1547
|
+
if (!document.fullscreenElement && el.node) {
|
|
1548
|
+
try {
|
|
1549
|
+
await el.node.requestFullscreen();
|
|
1550
|
+
} catch (err) {
|
|
1543
1551
|
console.warn(`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`);
|
|
1544
|
-
}
|
|
1552
|
+
}
|
|
1545
1553
|
} else {
|
|
1546
|
-
document.exitFullscreen();
|
|
1554
|
+
await document.exitFullscreen();
|
|
1547
1555
|
}
|
|
1548
1556
|
};
|
|
1549
1557
|
|
|
@@ -1606,7 +1614,7 @@ var loadJavascriptFile = (FILE_URL, async = false, doc = document, type = "text/
|
|
|
1606
1614
|
}
|
|
1607
1615
|
});
|
|
1608
1616
|
};
|
|
1609
|
-
var loadJavascriptFileSync = (FILE_URL, doc = document, type = "text/javascript") => {
|
|
1617
|
+
var loadJavascriptFileSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
|
|
1610
1618
|
const xhr = new window.XMLHttpRequest();
|
|
1611
1619
|
xhr.open("GET", FILE_URL, false);
|
|
1612
1620
|
xhr.send();
|
|
@@ -1615,6 +1623,8 @@ var loadJavascriptFileSync = (FILE_URL, doc = document, type = "text/javascript"
|
|
|
1615
1623
|
scriptEle.type = type;
|
|
1616
1624
|
scriptEle.text = xhr.responseText;
|
|
1617
1625
|
doc.body.appendChild(scriptEle);
|
|
1626
|
+
if (typeof fallback === "function")
|
|
1627
|
+
fallback();
|
|
1618
1628
|
} else {
|
|
1619
1629
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
1620
1630
|
}
|
package/dist/cjs/load.js
CHANGED
|
@@ -50,7 +50,7 @@ var loadJavascriptFile = (FILE_URL, async = false, doc = document, type = "text/
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
|
-
var loadJavascriptFileSync = (FILE_URL, doc = document, type = "text/javascript") => {
|
|
53
|
+
var loadJavascriptFileSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
|
|
54
54
|
const xhr = new window.XMLHttpRequest();
|
|
55
55
|
xhr.open("GET", FILE_URL, false);
|
|
56
56
|
xhr.send();
|
|
@@ -59,6 +59,8 @@ var loadJavascriptFileSync = (FILE_URL, doc = document, type = "text/javascript"
|
|
|
59
59
|
scriptEle.type = type;
|
|
60
60
|
scriptEle.text = xhr.responseText;
|
|
61
61
|
doc.body.appendChild(scriptEle);
|
|
62
|
+
if (typeof fallback === "function")
|
|
63
|
+
fallback();
|
|
62
64
|
} else {
|
|
63
65
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
64
66
|
}
|
package/dist/cjs/scaling.js
CHANGED
|
@@ -732,7 +732,7 @@ var require_object = __commonJS({
|
|
|
732
732
|
return o;
|
|
733
733
|
};
|
|
734
734
|
var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
|
|
735
|
-
const o = (0, import_types.isArray)(obj) ? [] : {};
|
|
735
|
+
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
736
736
|
for (const prop in obj) {
|
|
737
737
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
738
738
|
continue;
|
|
@@ -1108,6 +1108,12 @@ var require_object = __commonJS({
|
|
|
1108
1108
|
if (foundString || foundInArray)
|
|
1109
1109
|
return el;
|
|
1110
1110
|
}
|
|
1111
|
+
if (el.parent && el.parent.childExtend) {
|
|
1112
|
+
const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
1113
|
+
const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
1114
|
+
if (foundString || foundInArray)
|
|
1115
|
+
return el;
|
|
1116
|
+
}
|
|
1111
1117
|
};
|
|
1112
1118
|
var getExtendsInElement = (obj) => {
|
|
1113
1119
|
let result = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/utils",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.420",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@domql/utils": "latest"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "115d994931e8dae83701a8a98f2722e1a59ae4a2"
|
|
30
30
|
}
|
package/src/browser.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
export const toggleFullscreen = (el) => {
|
|
4
|
-
if (!document.fullscreenElement) {
|
|
5
|
-
|
|
3
|
+
export const toggleFullscreen = async (el) => {
|
|
4
|
+
if (!document.fullscreenElement && el.node) {
|
|
5
|
+
try {
|
|
6
|
+
await el.node.requestFullscreen()
|
|
7
|
+
} catch (err) {
|
|
6
8
|
console.warn(`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`)
|
|
7
|
-
}
|
|
9
|
+
}
|
|
8
10
|
} else {
|
|
9
|
-
document.exitFullscreen()
|
|
11
|
+
await document.exitFullscreen()
|
|
10
12
|
}
|
|
11
13
|
}
|
package/src/load.js
CHANGED
|
@@ -28,7 +28,7 @@ export const loadJavascriptFile = (FILE_URL, async = false, doc = document, type
|
|
|
28
28
|
})
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export const loadJavascriptFileSync = (FILE_URL, doc = document, type = 'text/javascript') => {
|
|
31
|
+
export const loadJavascriptFileSync = (FILE_URL, doc = document, fallback, type = 'text/javascript') => {
|
|
32
32
|
const xhr = new window.XMLHttpRequest()
|
|
33
33
|
xhr.open('GET', FILE_URL, false) // false makes the request synchronous
|
|
34
34
|
xhr.send()
|
|
@@ -38,6 +38,7 @@ export const loadJavascriptFileSync = (FILE_URL, doc = document, type = 'text/ja
|
|
|
38
38
|
scriptEle.type = type
|
|
39
39
|
scriptEle.text = xhr.responseText
|
|
40
40
|
doc.body.appendChild(scriptEle)
|
|
41
|
+
if (typeof fallback === 'function') fallback()
|
|
41
42
|
} else {
|
|
42
43
|
throw new Error(`Failed to load the script ${FILE_URL}`)
|
|
43
44
|
}
|