hlp 3.7.2 → 3.7.4
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/_js/_build/script.js +34 -27
- package/_js/script.js +3174 -0
- package/hlp.js +1 -2
- package/package.json +16 -7
package/_js/_build/script.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
-
var _templateObject;
|
|
10
7
|
class hlp {
|
|
11
8
|
static x(input) {
|
|
12
9
|
if (typeof input === 'function') {
|
|
@@ -1173,7 +1170,17 @@ class hlp {
|
|
|
1173
1170
|
}
|
|
1174
1171
|
static async cursorPosition() {
|
|
1175
1172
|
// https://stackoverflow.com/a/43326327/2068362
|
|
1176
|
-
document.head.insertAdjacentHTML('afterbegin',
|
|
1173
|
+
document.head.insertAdjacentHTML('afterbegin', `
|
|
1174
|
+
<style type="text/css">
|
|
1175
|
+
.find-pointer-quad {
|
|
1176
|
+
--hit: 0;
|
|
1177
|
+
position: fixed;
|
|
1178
|
+
z-index:2147483647;
|
|
1179
|
+
transform: translateZ(0);
|
|
1180
|
+
&:hover { --hit: 1; }
|
|
1181
|
+
}
|
|
1182
|
+
</style>
|
|
1183
|
+
`);
|
|
1177
1184
|
window.cursorPositionDelay = 50;
|
|
1178
1185
|
window.cursorPositionQuads = [];
|
|
1179
1186
|
let dim = 10;
|
|
@@ -1183,9 +1190,9 @@ class hlp {
|
|
|
1183
1190
|
let {
|
|
1184
1191
|
style
|
|
1185
1192
|
} = a;
|
|
1186
|
-
style.top = pos < 2 ? 0 :
|
|
1187
|
-
style.left = pos % 2 === 0 ? 0 :
|
|
1188
|
-
style.width = style.height =
|
|
1193
|
+
style.top = pos < 2 ? 0 : `${dim}%`;
|
|
1194
|
+
style.left = pos % 2 === 0 ? 0 : `${dim}%`;
|
|
1195
|
+
style.width = style.height = `${dim}%`;
|
|
1189
1196
|
document.body.appendChild(a);
|
|
1190
1197
|
return a;
|
|
1191
1198
|
};
|
|
@@ -1196,8 +1203,8 @@ class hlp {
|
|
|
1196
1203
|
let hit;
|
|
1197
1204
|
window.cursorPositionQuads.some(a => {
|
|
1198
1205
|
let style = getComputedStyle(a);
|
|
1199
|
-
let result = style.getPropertyValue(
|
|
1200
|
-
if (result ===
|
|
1206
|
+
let result = style.getPropertyValue(`--hit`);
|
|
1207
|
+
if (result === `1`) return hit = {
|
|
1201
1208
|
style,
|
|
1202
1209
|
a
|
|
1203
1210
|
};
|
|
@@ -1212,14 +1219,14 @@ class hlp {
|
|
|
1212
1219
|
style
|
|
1213
1220
|
} = _ref6;
|
|
1214
1221
|
if (reset) {
|
|
1215
|
-
style.top = pos < 2 ? 0 :
|
|
1216
|
-
style.left = pos % 2 === 0 ? 0 :
|
|
1217
|
-
style.width = style.height =
|
|
1222
|
+
style.top = pos < 2 ? 0 : `${dim}%`;
|
|
1223
|
+
style.left = pos % 2 === 0 ? 0 : `${dim}%`;
|
|
1224
|
+
style.width = style.height = `${dim}%`;
|
|
1218
1225
|
} else {
|
|
1219
|
-
style.top = pos < 2 ?
|
|
1220
|
-
style.left = pos % 2 === 0 ?
|
|
1221
|
-
style.width =
|
|
1222
|
-
style.height =
|
|
1226
|
+
style.top = pos < 2 ? `${top}%` : `${top + dim}%`;
|
|
1227
|
+
style.left = pos % 2 === 0 ? `${left}%` : `${left + dim}%`;
|
|
1228
|
+
style.width = `${dim}%`;
|
|
1229
|
+
style.height = `${dim}%`;
|
|
1223
1230
|
}
|
|
1224
1231
|
});
|
|
1225
1232
|
return new Promise(resolve => {
|
|
@@ -1250,10 +1257,10 @@ class hlp {
|
|
|
1250
1257
|
let {
|
|
1251
1258
|
style
|
|
1252
1259
|
} = _ref7;
|
|
1253
|
-
style.top = pos < 2 ? oy :
|
|
1254
|
-
style.left = pos % 2 === 0 ? ox :
|
|
1255
|
-
style.width =
|
|
1256
|
-
style.height =
|
|
1260
|
+
style.top = pos < 2 ? oy : `${nextStep + parseFloat(oy)}%`;
|
|
1261
|
+
style.left = pos % 2 === 0 ? ox : `${nextStep + parseFloat(ox)}%`;
|
|
1262
|
+
style.width = `${nextStep}%`;
|
|
1263
|
+
style.height = `${nextStep}%`;
|
|
1257
1264
|
});
|
|
1258
1265
|
return new Promise(resolve => {
|
|
1259
1266
|
setTimeout(() => resolve(this.cursorPositionBisect(nextStep)), window.cursorPositionDelay);
|
|
@@ -1446,7 +1453,7 @@ class hlp {
|
|
|
1446
1453
|
// apply trick from https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
1447
1454
|
let fn = () => {
|
|
1448
1455
|
let vh = window.innerHeight * 0.01;
|
|
1449
|
-
document.documentElement.style.setProperty('--vh',
|
|
1456
|
+
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
|
1450
1457
|
};
|
|
1451
1458
|
fn();
|
|
1452
1459
|
window.addEventListener('resize', () => {
|
|
@@ -2250,7 +2257,7 @@ class hlp {
|
|
|
2250
2257
|
return new RegExp(hlp.emojiRegexPattern(), (global === true ? 'g' : '') + 'u');
|
|
2251
2258
|
}
|
|
2252
2259
|
static emojiRegexPattern() {
|
|
2253
|
-
return String.raw
|
|
2260
|
+
return String.raw`\p{RI}\p{RI}|\p{Extended_Pictographic}(\p{EMod}|\uFE0F\u20E3?|[\u{E0020}-\u{E007E}]+\u{E007F})?(\u200D(\p{RI}\p{RI}|\p{Extended_Pictographic}(\p{EMod}|\uFE0F\u20E3?|[\u{E0020}-\u{E007E}]+\u{E007F})?))*`;
|
|
2254
2261
|
}
|
|
2255
2262
|
static emojiSplit(str) {
|
|
2256
2263
|
if (!(typeof str === 'string' || str instanceof String)) {
|
|
@@ -2346,7 +2353,7 @@ class hlp {
|
|
|
2346
2353
|
};
|
|
2347
2354
|
cache.get = index => {
|
|
2348
2355
|
if (index >= store.length) {
|
|
2349
|
-
throw RangeError(
|
|
2356
|
+
throw RangeError(`Can't resolve reference ${index + 1}`);
|
|
2350
2357
|
}
|
|
2351
2358
|
return store[index];
|
|
2352
2359
|
};
|
|
@@ -2377,7 +2384,7 @@ class hlp {
|
|
|
2377
2384
|
case 'R':
|
|
2378
2385
|
return expectReference(s);
|
|
2379
2386
|
default:
|
|
2380
|
-
throw SyntaxError(
|
|
2387
|
+
throw SyntaxError(`Invalid or unsupported data type: ${type}`);
|
|
2381
2388
|
}
|
|
2382
2389
|
};
|
|
2383
2390
|
const expectBool = s => {
|
|
@@ -2447,7 +2454,7 @@ class hlp {
|
|
|
2447
2454
|
const reObjectLiteral = /^O:(\d+):"([^\"]+)":(\d+):\{/;
|
|
2448
2455
|
const [match,, className, propCountMatch] = reObjectLiteral.exec(s) || [];
|
|
2449
2456
|
if (!match) throw SyntaxError('Invalid input');
|
|
2450
|
-
if (className !== 'stdClass') throw SyntaxError(
|
|
2457
|
+
if (className !== 'stdClass') throw SyntaxError(`Unsupported object type: ${className}`);
|
|
2451
2458
|
let obj = {};
|
|
2452
2459
|
cache([obj]);
|
|
2453
2460
|
s = s.substr(match.length);
|
|
@@ -2478,7 +2485,7 @@ class hlp {
|
|
|
2478
2485
|
pushIdData = window.pushIdDataGlobal;
|
|
2479
2486
|
}
|
|
2480
2487
|
// node.js
|
|
2481
|
-
if (global !== undefined) {
|
|
2488
|
+
if (typeof global !== 'undefined') {
|
|
2482
2489
|
if (global.pushIdDataGlobal === undefined) {
|
|
2483
2490
|
global.pushIdDataGlobal = {};
|
|
2484
2491
|
}
|
|
@@ -2584,7 +2591,7 @@ class hlp {
|
|
|
2584
2591
|
let file = null;
|
|
2585
2592
|
try {
|
|
2586
2593
|
file = new File([blob], filename);
|
|
2587
|
-
} catch
|
|
2594
|
+
} catch {
|
|
2588
2595
|
// ie 11
|
|
2589
2596
|
file = new Blob([blob], filename);
|
|
2590
2597
|
}
|