hlp 3.7.6 → 3.7.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/LICENSE.md +21 -0
- package/README.md +754 -748
- package/_js/_build/script.js +57 -46
- package/hlp.esm.js +44 -43
- package/hlp.js +1 -1
- package/package.json +22 -19
package/_js/_build/script.js
CHANGED
|
@@ -117,6 +117,9 @@ class hlp {
|
|
|
117
117
|
return false;
|
|
118
118
|
}
|
|
119
119
|
static v() {
|
|
120
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
121
|
+
args[_key] = arguments[_key];
|
|
122
|
+
}
|
|
120
123
|
if (this.nx(arguments)) {
|
|
121
124
|
return '';
|
|
122
125
|
}
|
|
@@ -142,7 +145,8 @@ class hlp {
|
|
|
142
145
|
});
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
|
-
static map(obj, fn
|
|
148
|
+
static map(obj, fn) {
|
|
149
|
+
let ctx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
146
150
|
return Object.keys(obj).reduce((a, b) => {
|
|
147
151
|
a[b] = fn.call(ctx || null, b, obj[b]);
|
|
148
152
|
return a;
|
|
@@ -193,8 +197,8 @@ class hlp {
|
|
|
193
197
|
return input[Math.floor(Math.random() * input.length)];
|
|
194
198
|
}
|
|
195
199
|
if (typeof input === 'object') {
|
|
196
|
-
var
|
|
197
|
-
return
|
|
200
|
+
var inputArr = Object.values(input);
|
|
201
|
+
return inputArr[Math.floor(Math.random() * inputArr.length)];
|
|
198
202
|
}
|
|
199
203
|
return null;
|
|
200
204
|
}
|
|
@@ -435,10 +439,12 @@ class hlp {
|
|
|
435
439
|
}
|
|
436
440
|
return browser_name;
|
|
437
441
|
}
|
|
438
|
-
static isObject(
|
|
442
|
+
static isObject() {
|
|
443
|
+
let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
439
444
|
return !!a && a.constructor === Object;
|
|
440
445
|
}
|
|
441
|
-
static isArray(
|
|
446
|
+
static isArray() {
|
|
447
|
+
let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
442
448
|
return !!a && a.constructor === Array;
|
|
443
449
|
}
|
|
444
450
|
static isString(string) {
|
|
@@ -524,20 +530,19 @@ class hlp {
|
|
|
524
530
|
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
|
|
525
531
|
sep = typeof thousands_sep === 'undefined' ? ',' : thousands_sep,
|
|
526
532
|
dec = typeof dec_point === 'undefined' ? '.' : dec_point,
|
|
527
|
-
s = '',
|
|
528
533
|
toFixedFix = function (n, prec) {
|
|
529
534
|
var k = Math.pow(10, prec);
|
|
530
535
|
return '' + Math.round(n * k) / k;
|
|
531
536
|
};
|
|
532
|
-
|
|
533
|
-
if (
|
|
534
|
-
|
|
537
|
+
let sArr = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
|
|
538
|
+
if (sArr[0].length > 3) {
|
|
539
|
+
sArr[0] = sArr[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
|
|
535
540
|
}
|
|
536
|
-
if ((
|
|
537
|
-
|
|
538
|
-
|
|
541
|
+
if ((sArr[1] || '').length < prec) {
|
|
542
|
+
sArr[1] = sArr[1] || '';
|
|
543
|
+
sArr[1] += new Array(prec - sArr[1].length + 1).join('0');
|
|
539
544
|
}
|
|
540
|
-
return
|
|
545
|
+
return sArr.join(dec);
|
|
541
546
|
}
|
|
542
547
|
static formatDate(format) {
|
|
543
548
|
let date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -722,7 +727,8 @@ class hlp {
|
|
|
722
727
|
let regExp = new RegExp(value, 'gi');
|
|
723
728
|
return (str.match(regExp) || []).length;
|
|
724
729
|
}
|
|
725
|
-
static indexOfCaseInsensitive(searchStr, str
|
|
730
|
+
static indexOfCaseInsensitive(searchStr, str) {
|
|
731
|
+
let offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
726
732
|
return str.toLowerCase().indexOf(searchStr.toLowerCase(), offset);
|
|
727
733
|
}
|
|
728
734
|
static highlight(string, query) {
|
|
@@ -980,7 +986,7 @@ class hlp {
|
|
|
980
986
|
year = new Date().getFullYear();
|
|
981
987
|
}
|
|
982
988
|
let date = new Date();
|
|
983
|
-
date.
|
|
989
|
+
date.setFullYear(year);
|
|
984
990
|
date.setDate(1);
|
|
985
991
|
date.setMonth(0);
|
|
986
992
|
date.setHours(0);
|
|
@@ -1190,8 +1196,8 @@ class hlp {
|
|
|
1190
1196
|
let {
|
|
1191
1197
|
style
|
|
1192
1198
|
} = a;
|
|
1193
|
-
style.top = pos < 2 ? 0 : `${dim}%`;
|
|
1194
|
-
style.left = pos % 2 === 0 ? 0 : `${dim}%`;
|
|
1199
|
+
style.top = pos < 2 ? '0' : `${dim}%`;
|
|
1200
|
+
style.left = pos % 2 === 0 ? '0' : `${dim}%`;
|
|
1195
1201
|
style.width = style.height = `${dim}%`;
|
|
1196
1202
|
document.body.appendChild(a);
|
|
1197
1203
|
return a;
|
|
@@ -1219,8 +1225,8 @@ class hlp {
|
|
|
1219
1225
|
style
|
|
1220
1226
|
} = _ref6;
|
|
1221
1227
|
if (reset) {
|
|
1222
|
-
style.top = pos < 2 ? 0 : `${dim}%`;
|
|
1223
|
-
style.left = pos % 2 === 0 ? 0 : `${dim}%`;
|
|
1228
|
+
style.top = pos < 2 ? '0' : `${dim}%`;
|
|
1229
|
+
style.left = pos % 2 === 0 ? '0' : `${dim}%`;
|
|
1224
1230
|
style.width = style.height = `${dim}%`;
|
|
1225
1231
|
} else {
|
|
1226
1232
|
style.top = pos < 2 ? `${top}%` : `${top + dim}%`;
|
|
@@ -1276,17 +1282,18 @@ class hlp {
|
|
|
1276
1282
|
element = document.scrollingElement || document.documentElement;
|
|
1277
1283
|
}
|
|
1278
1284
|
if (!hlp.isNumeric(to)) {
|
|
1279
|
-
if (element === (document.scrollingElement || documentElement)) {
|
|
1285
|
+
if (element === (document.scrollingElement || document.documentElement)) {
|
|
1280
1286
|
to = this.offsetTopWithMargin(to);
|
|
1281
1287
|
} else {
|
|
1282
1288
|
to = to.getBoundingClientRect().top - parseInt(getComputedStyle(to).marginTop) - (element.getBoundingClientRect().top - element.scrollTop - parseInt(getComputedStyle(element).marginTop));
|
|
1283
1289
|
}
|
|
1284
1290
|
}
|
|
1285
1291
|
let offset_calc = 0;
|
|
1286
|
-
|
|
1287
|
-
|
|
1292
|
+
let offsetArr = offset;
|
|
1293
|
+
if (!Array.isArray(offsetArr)) {
|
|
1294
|
+
offsetArr = [offsetArr];
|
|
1288
1295
|
}
|
|
1289
|
-
|
|
1296
|
+
offsetArr.forEach(offset__value => {
|
|
1290
1297
|
if (hlp.isNumeric(offset__value)) {
|
|
1291
1298
|
offset_calc += offset__value;
|
|
1292
1299
|
} else {
|
|
@@ -1494,11 +1501,11 @@ class hlp {
|
|
|
1494
1501
|
from.split(';').forEach(from__value => {
|
|
1495
1502
|
properties.push(from__value.split(':')[0].trim());
|
|
1496
1503
|
});
|
|
1497
|
-
let
|
|
1504
|
+
let transitionArr = [];
|
|
1498
1505
|
properties.forEach(properties__value => {
|
|
1499
|
-
|
|
1506
|
+
transitionArr.push(properties__value + ' ' + Math.round(duration / 1000 * 10) / 10 + 's ' + easing);
|
|
1500
1507
|
});
|
|
1501
|
-
transition = 'transition: ' +
|
|
1508
|
+
let transition = 'transition: ' + transitionArr.join(', ') + ' !important;';
|
|
1502
1509
|
let els = null;
|
|
1503
1510
|
if (NodeList.prototype.isPrototypeOf(el)) {
|
|
1504
1511
|
els = Array.from(el);
|
|
@@ -1515,17 +1522,18 @@ class hlp {
|
|
|
1515
1522
|
els__value.classList.add(random_class);
|
|
1516
1523
|
window.requestAnimationFrame(() => {
|
|
1517
1524
|
// set from style inline (don't fully remove previous style)
|
|
1518
|
-
let
|
|
1525
|
+
let new_style_arr = [];
|
|
1526
|
+
let new_style = '';
|
|
1519
1527
|
let prev_style = els__value.getAttribute('style');
|
|
1520
1528
|
if (prev_style !== null) {
|
|
1521
1529
|
prev_style.split(';').forEach(prev_style__value => {
|
|
1522
1530
|
if (prev_style__value != '' && !properties.includes(prev_style__value.split(':')[0].trim())) {
|
|
1523
|
-
|
|
1531
|
+
new_style_arr.push(prev_style__value);
|
|
1524
1532
|
}
|
|
1525
1533
|
});
|
|
1526
1534
|
}
|
|
1527
|
-
if (
|
|
1528
|
-
new_style =
|
|
1535
|
+
if (new_style_arr.length > 0) {
|
|
1536
|
+
new_style = new_style_arr.join(';') + ';' + from + ';';
|
|
1529
1537
|
} else {
|
|
1530
1538
|
new_style = from + ';';
|
|
1531
1539
|
}
|
|
@@ -1597,7 +1605,9 @@ class hlp {
|
|
|
1597
1605
|
});
|
|
1598
1606
|
});
|
|
1599
1607
|
}
|
|
1600
|
-
static addEventListenerOnce(target, type, listener
|
|
1608
|
+
static addEventListenerOnce(target, type, listener) {
|
|
1609
|
+
let addOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
1610
|
+
let removeOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
|
|
1601
1611
|
target.addEventListener(type, function fn(event) {
|
|
1602
1612
|
let result = listener.apply(this, arguments, addOptions);
|
|
1603
1613
|
if (result !== false) {
|
|
@@ -1877,7 +1887,7 @@ class hlp {
|
|
|
1877
1887
|
}
|
|
1878
1888
|
static querySelectorAllShadowDom(selector) {
|
|
1879
1889
|
let traverse = function ($parent) {
|
|
1880
|
-
$els = [];
|
|
1890
|
+
let $els = [];
|
|
1881
1891
|
if ($parent.querySelector('*') !== null) {
|
|
1882
1892
|
$parent.querySelectorAll('*').forEach($el => {
|
|
1883
1893
|
$els.push($el);
|
|
@@ -1889,7 +1899,7 @@ class hlp {
|
|
|
1889
1899
|
return $els;
|
|
1890
1900
|
};
|
|
1891
1901
|
let fragment = document.createDocumentFragment();
|
|
1892
|
-
$els = traverse(document);
|
|
1902
|
+
let $els = traverse(document);
|
|
1893
1903
|
$els.forEach($el => {
|
|
1894
1904
|
if ($el.matches(selector)) {
|
|
1895
1905
|
fragment.appendChild($el.cloneNode());
|
|
@@ -1909,19 +1919,19 @@ class hlp {
|
|
|
1909
1919
|
let mask = document.createElement('div');
|
|
1910
1920
|
mask.classList.add('hlp-focus-mask');
|
|
1911
1921
|
mask.style.position = 'fixed';
|
|
1912
|
-
mask.style.top = 0;
|
|
1913
|
-
mask.style.bottom = 0;
|
|
1914
|
-
mask.style.left = 0;
|
|
1915
|
-
mask.style.right = 0;
|
|
1922
|
+
mask.style.top = '0';
|
|
1923
|
+
mask.style.bottom = '0';
|
|
1924
|
+
mask.style.left = '0';
|
|
1925
|
+
mask.style.right = '0';
|
|
1916
1926
|
mask.style.backgroundColor = 'rgba(0,0,0,0.8)';
|
|
1917
|
-
mask.style.zIndex = 2147483646;
|
|
1927
|
+
mask.style.zIndex = '2147483646';
|
|
1918
1928
|
el.before(mask);
|
|
1919
|
-
el.setAttribute('data-focussed', 1);
|
|
1929
|
+
el.setAttribute('data-focussed', '1');
|
|
1920
1930
|
el.setAttribute('data-focussed-orig-z-index', el.style.zIndex);
|
|
1921
1931
|
el.setAttribute('data-focussed-orig-position', el.style.position);
|
|
1922
1932
|
el.setAttribute('data-focussed-orig-background-color', el.style.backgroundColor);
|
|
1923
1933
|
el.setAttribute('data-focussed-orig-box-shadow', el.style.boxShadow);
|
|
1924
|
-
el.style.zIndex = 2147483647;
|
|
1934
|
+
el.style.zIndex = '2147483647';
|
|
1925
1935
|
el.style.position = 'relative';
|
|
1926
1936
|
el.style.backgroundColor = '#ffffff';
|
|
1927
1937
|
el.style.boxShadow = '0px 0px 0px 20px #fff';
|
|
@@ -2191,7 +2201,8 @@ class hlp {
|
|
|
2191
2201
|
}[op];
|
|
2192
2202
|
return Math.round(n * 10 * Math.pow(10, precision)) / (10 * Math.pow(10, precision));
|
|
2193
2203
|
}
|
|
2194
|
-
static trim(str
|
|
2204
|
+
static trim(str) {
|
|
2205
|
+
let charlist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2195
2206
|
let whitespace = [' ', '\n', '\r', '\t', '\f', '\x0b', '\xa0', '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', '\u2007', '\u2008', '\u2009', '\u200a', '\u200b', '\u2028', '\u2029', '\u3000'].join('');
|
|
2196
2207
|
let l = 0;
|
|
2197
2208
|
let i = 0;
|
|
@@ -2215,12 +2226,14 @@ class hlp {
|
|
|
2215
2226
|
}
|
|
2216
2227
|
return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
|
|
2217
2228
|
}
|
|
2218
|
-
static ltrim(str
|
|
2229
|
+
static ltrim(str) {
|
|
2230
|
+
let charlist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2219
2231
|
charlist = !charlist ? ' \\s\u00A0' : (charlist + '').replace(/([[\]().?/*{}+$^:])/g, '$1');
|
|
2220
2232
|
const re = new RegExp('^[' + charlist + ']+', 'g');
|
|
2221
2233
|
return (str + '').replace(re, '');
|
|
2222
2234
|
}
|
|
2223
|
-
static rtrim(str
|
|
2235
|
+
static rtrim(str) {
|
|
2236
|
+
let charlist = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2224
2237
|
charlist = !charlist ? ' \\s\u00A0' : (charlist + '').replace(/([[\]().?/*{}+$^:])/g, '\\$1');
|
|
2225
2238
|
const re = new RegExp('[' + charlist + ']+$', 'g');
|
|
2226
2239
|
return (str + '').replace(re, '');
|
|
@@ -2606,9 +2619,7 @@ class hlp {
|
|
|
2606
2619
|
return this.blobtofile(this.base64toblob(base64, contentType), filename);
|
|
2607
2620
|
}
|
|
2608
2621
|
static blobtourl(blob) {
|
|
2609
|
-
return URL.createObjectURL(blob
|
|
2610
|
-
type: 'text/plain'
|
|
2611
|
-
});
|
|
2622
|
+
return URL.createObjectURL(blob);
|
|
2612
2623
|
}
|
|
2613
2624
|
static stringtourl(string) {
|
|
2614
2625
|
return this.blobtourl(this.stringtoblob(string));
|
package/hlp.esm.js
CHANGED
|
@@ -55,7 +55,7 @@ var hlp = class hlp {
|
|
|
55
55
|
if (input === "false") return true;
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
58
|
-
static v() {
|
|
58
|
+
static v(...args) {
|
|
59
59
|
if (this.nx(arguments)) return "";
|
|
60
60
|
for (let i = 0; i < arguments.length; i++) if (this.x(arguments[i])) return arguments[i];
|
|
61
61
|
return "";
|
|
@@ -69,7 +69,7 @@ var hlp = class hlp {
|
|
|
69
69
|
fun(input__value, input__key);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
static map(obj, fn, ctx) {
|
|
72
|
+
static map(obj, fn, ctx = null) {
|
|
73
73
|
return Object.keys(obj).reduce((a, b) => {
|
|
74
74
|
a[b] = fn.call(ctx || null, b, obj[b]);
|
|
75
75
|
return a;
|
|
@@ -112,8 +112,8 @@ var hlp = class hlp {
|
|
|
112
112
|
static rand(input) {
|
|
113
113
|
if (Array.isArray(input)) return input[Math.floor(Math.random() * input.length)];
|
|
114
114
|
if (typeof input === "object") {
|
|
115
|
-
var
|
|
116
|
-
return
|
|
115
|
+
var inputArr = Object.values(input);
|
|
116
|
+
return inputArr[Math.floor(Math.random() * inputArr.length)];
|
|
117
117
|
}
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
@@ -277,10 +277,10 @@ var hlp = class hlp {
|
|
|
277
277
|
else browser_name = "unknown";
|
|
278
278
|
return browser_name;
|
|
279
279
|
}
|
|
280
|
-
static isObject(a) {
|
|
280
|
+
static isObject(a = null) {
|
|
281
281
|
return !!a && a.constructor === Object;
|
|
282
282
|
}
|
|
283
|
-
static isArray(a) {
|
|
283
|
+
static isArray(a = null) {
|
|
284
284
|
return !!a && a.constructor === Array;
|
|
285
285
|
}
|
|
286
286
|
static isString(string) {
|
|
@@ -328,17 +328,17 @@ var hlp = class hlp {
|
|
|
328
328
|
}
|
|
329
329
|
static formatNumber(number, decimals = 0, dec_point = ".", thousands_sep = ",") {
|
|
330
330
|
number = (number + "").replace(/[^0-9+\-Ee.]/g, "");
|
|
331
|
-
var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = typeof thousands_sep === "undefined" ? "," : thousands_sep, dec = typeof dec_point === "undefined" ? "." : dec_point,
|
|
331
|
+
var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = typeof thousands_sep === "undefined" ? "," : thousands_sep, dec = typeof dec_point === "undefined" ? "." : dec_point, toFixedFix = function(n, prec) {
|
|
332
332
|
var k = Math.pow(10, prec);
|
|
333
333
|
return "" + Math.round(n * k) / k;
|
|
334
334
|
};
|
|
335
|
-
|
|
336
|
-
if (
|
|
337
|
-
if ((
|
|
338
|
-
|
|
339
|
-
|
|
335
|
+
let sArr = (prec ? toFixedFix(n, prec) : "" + Math.round(n)).split(".");
|
|
336
|
+
if (sArr[0].length > 3) sArr[0] = sArr[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
|
|
337
|
+
if ((sArr[1] || "").length < prec) {
|
|
338
|
+
sArr[1] = sArr[1] || "";
|
|
339
|
+
sArr[1] += new Array(prec - sArr[1].length + 1).join("0");
|
|
340
340
|
}
|
|
341
|
-
return
|
|
341
|
+
return sArr.join(dec);
|
|
342
342
|
}
|
|
343
343
|
static formatDate(format, date = null) {
|
|
344
344
|
if (date === false || date === true || date === null || date === "") date = /* @__PURE__ */ new Date();
|
|
@@ -488,7 +488,7 @@ var hlp = class hlp {
|
|
|
488
488
|
let regExp = new RegExp(value, "gi");
|
|
489
489
|
return (str.match(regExp) || []).length;
|
|
490
490
|
}
|
|
491
|
-
static indexOfCaseInsensitive(searchStr, str, offset) {
|
|
491
|
+
static indexOfCaseInsensitive(searchStr, str, offset = 0) {
|
|
492
492
|
return str.toLowerCase().indexOf(searchStr.toLowerCase(), offset);
|
|
493
493
|
}
|
|
494
494
|
static highlight(string, query, strip = false, strip_length = 500) {
|
|
@@ -659,7 +659,7 @@ var hlp = class hlp {
|
|
|
659
659
|
static weekToDate(week, year) {
|
|
660
660
|
if (year == null) year = (/* @__PURE__ */ new Date()).getFullYear();
|
|
661
661
|
let date = /* @__PURE__ */ new Date();
|
|
662
|
-
date.
|
|
662
|
+
date.setFullYear(year);
|
|
663
663
|
date.setDate(1);
|
|
664
664
|
date.setMonth(0);
|
|
665
665
|
date.setHours(0);
|
|
@@ -821,8 +821,8 @@ var hlp = class hlp {
|
|
|
821
821
|
let a = document.createElement("a");
|
|
822
822
|
a.classList.add("find-pointer-quad");
|
|
823
823
|
let { style } = a;
|
|
824
|
-
style.top = pos < 2 ? 0 : `${dim}%`;
|
|
825
|
-
style.left = pos % 2 === 0 ? 0 : `${dim}%`;
|
|
824
|
+
style.top = pos < 2 ? "0" : `${dim}%`;
|
|
825
|
+
style.left = pos % 2 === 0 ? "0" : `${dim}%`;
|
|
826
826
|
style.width = style.height = `${dim}%`;
|
|
827
827
|
document.body.appendChild(a);
|
|
828
828
|
return a;
|
|
@@ -851,8 +851,8 @@ var hlp = class hlp {
|
|
|
851
851
|
let left = parseFloat(q1.style.left) - dim / 2;
|
|
852
852
|
window.cursorPositionQuads.forEach(({ style }, pos) => {
|
|
853
853
|
if (reset) {
|
|
854
|
-
style.top = pos < 2 ? 0 : `${dim}%`;
|
|
855
|
-
style.left = pos % 2 === 0 ? 0 : `${dim}%`;
|
|
854
|
+
style.top = pos < 2 ? "0" : `${dim}%`;
|
|
855
|
+
style.left = pos % 2 === 0 ? "0" : `${dim}%`;
|
|
856
856
|
style.width = style.height = `${dim}%`;
|
|
857
857
|
} else {
|
|
858
858
|
style.top = pos < 2 ? `${top}%` : `${top + dim}%`;
|
|
@@ -890,11 +890,12 @@ var hlp = class hlp {
|
|
|
890
890
|
static scrollTo(to, duration = 1e3, element = null, offset = 0, only_up = false) {
|
|
891
891
|
return new Promise((resolve) => {
|
|
892
892
|
if (element === null) element = document.scrollingElement || document.documentElement;
|
|
893
|
-
if (!hlp.isNumeric(to)) if (element === (document.scrollingElement || documentElement)) to = this.offsetTopWithMargin(to);
|
|
893
|
+
if (!hlp.isNumeric(to)) if (element === (document.scrollingElement || document.documentElement)) to = this.offsetTopWithMargin(to);
|
|
894
894
|
else to = to.getBoundingClientRect().top - parseInt(getComputedStyle(to).marginTop) - (element.getBoundingClientRect().top - element.scrollTop - parseInt(getComputedStyle(element).marginTop));
|
|
895
895
|
let offset_calc = 0;
|
|
896
|
-
|
|
897
|
-
|
|
896
|
+
let offsetArr = offset;
|
|
897
|
+
if (!Array.isArray(offsetArr)) offsetArr = [offsetArr];
|
|
898
|
+
offsetArr.forEach((offset__value) => {
|
|
898
899
|
if (hlp.isNumeric(offset__value)) offset_calc += offset__value;
|
|
899
900
|
else if (offset__value !== null) {
|
|
900
901
|
if (window.getComputedStyle(offset__value).position === "fixed") offset_calc += -1 * offset__value.offsetHeight;
|
|
@@ -1050,11 +1051,11 @@ var hlp = class hlp {
|
|
|
1050
1051
|
from.split(";").forEach((from__value) => {
|
|
1051
1052
|
properties.push(from__value.split(":")[0].trim());
|
|
1052
1053
|
});
|
|
1053
|
-
let
|
|
1054
|
+
let transitionArr = [];
|
|
1054
1055
|
properties.forEach((properties__value) => {
|
|
1055
|
-
|
|
1056
|
+
transitionArr.push(properties__value + " " + Math.round(duration / 1e3 * 10) / 10 + "s " + easing);
|
|
1056
1057
|
});
|
|
1057
|
-
transition = "transition: " +
|
|
1058
|
+
let transition = "transition: " + transitionArr.join(", ") + " !important;";
|
|
1058
1059
|
let els = null;
|
|
1059
1060
|
if (NodeList.prototype.isPrototypeOf(el)) els = Array.from(el);
|
|
1060
1061
|
else if (el === null) {
|
|
@@ -1066,12 +1067,13 @@ var hlp = class hlp {
|
|
|
1066
1067
|
let random_class = hlp.random_string(10, "abcdefghijklmnopqrstuvwxyz");
|
|
1067
1068
|
els__value.classList.add(random_class);
|
|
1068
1069
|
window.requestAnimationFrame(() => {
|
|
1069
|
-
let
|
|
1070
|
+
let new_style_arr = [];
|
|
1071
|
+
let new_style = "";
|
|
1070
1072
|
let prev_style = els__value.getAttribute("style");
|
|
1071
1073
|
if (prev_style !== null) prev_style.split(";").forEach((prev_style__value) => {
|
|
1072
|
-
if (prev_style__value != "" && !properties.includes(prev_style__value.split(":")[0].trim()))
|
|
1074
|
+
if (prev_style__value != "" && !properties.includes(prev_style__value.split(":")[0].trim())) new_style_arr.push(prev_style__value);
|
|
1073
1075
|
});
|
|
1074
|
-
if (
|
|
1076
|
+
if (new_style_arr.length > 0) new_style = new_style_arr.join(";") + ";" + from + ";";
|
|
1075
1077
|
else new_style = from + ";";
|
|
1076
1078
|
els__value.setAttribute("style", new_style);
|
|
1077
1079
|
window.requestAnimationFrame(() => {
|
|
@@ -1112,7 +1114,7 @@ var hlp = class hlp {
|
|
|
1112
1114
|
});
|
|
1113
1115
|
});
|
|
1114
1116
|
}
|
|
1115
|
-
static addEventListenerOnce(target, type, listener, addOptions, removeOptions) {
|
|
1117
|
+
static addEventListenerOnce(target, type, listener, addOptions = void 0, removeOptions = void 0) {
|
|
1116
1118
|
target.addEventListener(type, function fn(event) {
|
|
1117
1119
|
if (listener.apply(this, arguments, addOptions) !== false) target.removeEventListener(type, fn, removeOptions);
|
|
1118
1120
|
});
|
|
@@ -1316,7 +1318,7 @@ var hlp = class hlp {
|
|
|
1316
1318
|
}
|
|
1317
1319
|
static querySelectorAllShadowDom(selector) {
|
|
1318
1320
|
let traverse = function($parent) {
|
|
1319
|
-
$els = [];
|
|
1321
|
+
let $els = [];
|
|
1320
1322
|
if ($parent.querySelector("*") !== null) $parent.querySelectorAll("*").forEach(($el) => {
|
|
1321
1323
|
$els.push($el);
|
|
1322
1324
|
if ($el.shadowRoot !== void 0 && $el.shadowRoot !== null) $els = $els.concat(traverse($el.shadowRoot));
|
|
@@ -1324,8 +1326,7 @@ var hlp = class hlp {
|
|
|
1324
1326
|
return $els;
|
|
1325
1327
|
};
|
|
1326
1328
|
let fragment = document.createDocumentFragment();
|
|
1327
|
-
|
|
1328
|
-
$els.forEach(($el) => {
|
|
1329
|
+
traverse(document).forEach(($el) => {
|
|
1329
1330
|
if ($el.matches(selector)) fragment.appendChild($el.cloneNode());
|
|
1330
1331
|
});
|
|
1331
1332
|
return fragment.childNodes;
|
|
@@ -1339,19 +1340,19 @@ var hlp = class hlp {
|
|
|
1339
1340
|
let mask = document.createElement("div");
|
|
1340
1341
|
mask.classList.add("hlp-focus-mask");
|
|
1341
1342
|
mask.style.position = "fixed";
|
|
1342
|
-
mask.style.top = 0;
|
|
1343
|
-
mask.style.bottom = 0;
|
|
1344
|
-
mask.style.left = 0;
|
|
1345
|
-
mask.style.right = 0;
|
|
1343
|
+
mask.style.top = "0";
|
|
1344
|
+
mask.style.bottom = "0";
|
|
1345
|
+
mask.style.left = "0";
|
|
1346
|
+
mask.style.right = "0";
|
|
1346
1347
|
mask.style.backgroundColor = "rgba(0,0,0,0.8)";
|
|
1347
|
-
mask.style.zIndex = 2147483646;
|
|
1348
|
+
mask.style.zIndex = "2147483646";
|
|
1348
1349
|
el.before(mask);
|
|
1349
|
-
el.setAttribute("data-focussed", 1);
|
|
1350
|
+
el.setAttribute("data-focussed", "1");
|
|
1350
1351
|
el.setAttribute("data-focussed-orig-z-index", el.style.zIndex);
|
|
1351
1352
|
el.setAttribute("data-focussed-orig-position", el.style.position);
|
|
1352
1353
|
el.setAttribute("data-focussed-orig-background-color", el.style.backgroundColor);
|
|
1353
1354
|
el.setAttribute("data-focussed-orig-box-shadow", el.style.boxShadow);
|
|
1354
|
-
el.style.zIndex = 2147483647;
|
|
1355
|
+
el.style.zIndex = "2147483647";
|
|
1355
1356
|
el.style.position = "relative";
|
|
1356
1357
|
el.style.backgroundColor = "#ffffff";
|
|
1357
1358
|
el.style.boxShadow = "0px 0px 0px 20px #fff";
|
|
@@ -1560,7 +1561,7 @@ var hlp = class hlp {
|
|
|
1560
1561
|
}[op];
|
|
1561
1562
|
return Math.round(n * 10 * Math.pow(10, precision)) / (10 * Math.pow(10, precision));
|
|
1562
1563
|
}
|
|
1563
|
-
static trim(str, charlist) {
|
|
1564
|
+
static trim(str, charlist = null) {
|
|
1564
1565
|
let whitespace = [
|
|
1565
1566
|
" ",
|
|
1566
1567
|
"\n",
|
|
@@ -1601,12 +1602,12 @@ var hlp = class hlp {
|
|
|
1601
1602
|
}
|
|
1602
1603
|
return whitespace.indexOf(str.charAt(0)) === -1 ? str : "";
|
|
1603
1604
|
}
|
|
1604
|
-
static ltrim(str, charlist) {
|
|
1605
|
+
static ltrim(str, charlist = null) {
|
|
1605
1606
|
charlist = !charlist ? " \\s\xA0" : (charlist + "").replace(/([[\]().?/*{}+$^:])/g, "$1");
|
|
1606
1607
|
const re = new RegExp("^[" + charlist + "]+", "g");
|
|
1607
1608
|
return (str + "").replace(re, "");
|
|
1608
1609
|
}
|
|
1609
|
-
static rtrim(str, charlist) {
|
|
1610
|
+
static rtrim(str, charlist = null) {
|
|
1610
1611
|
charlist = !charlist ? " \\s\xA0" : (charlist + "").replace(/([[\]().?/*{}+$^:])/g, "\\$1");
|
|
1611
1612
|
const re = new RegExp("[" + charlist + "]+$", "g");
|
|
1612
1613
|
return (str + "").replace(re, "");
|
|
@@ -1910,7 +1911,7 @@ var hlp = class hlp {
|
|
|
1910
1911
|
return this.blobtofile(this.base64toblob(base64, contentType), filename);
|
|
1911
1912
|
}
|
|
1912
1913
|
static blobtourl(blob) {
|
|
1913
|
-
return URL.createObjectURL(blob
|
|
1914
|
+
return URL.createObjectURL(blob);
|
|
1914
1915
|
}
|
|
1915
1916
|
static stringtourl(string) {
|
|
1916
1917
|
return this.blobtourl(this.stringtoblob(string));
|