hlp 3.7.8 → 3.7.9

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.
Files changed (2) hide show
  1. package/_js/_build/script.js +104 -75
  2. package/package.json +7 -7
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _templateObject;
7
11
  class hlp {
8
12
  static x(input) {
9
13
  if (typeof input === 'function') {
@@ -140,7 +144,9 @@ class hlp {
140
144
  });
141
145
  } else if (typeof input === 'object') {
142
146
  Object.entries(input).forEach(_ref => {
143
- let [input__key, input__value] = _ref;
147
+ let _ref2 = (0, _slicedToArray2.default)(_ref, 2),
148
+ input__key = _ref2[0],
149
+ input__value = _ref2[1];
144
150
  fun(input__value, input__key);
145
151
  });
146
152
  }
@@ -164,8 +170,10 @@ class hlp {
164
170
  }
165
171
  if (typeof input === 'object') {
166
172
  var ret = null;
167
- Object.entries(input).forEach(_ref2 => {
168
- let [input__key, input__value] = _ref2;
173
+ Object.entries(input).forEach(_ref3 => {
174
+ let _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
175
+ input__key = _ref4[0],
176
+ input__value = _ref4[1];
169
177
  if (ret === null) {
170
178
  ret = input__value;
171
179
  }
@@ -184,8 +192,10 @@ class hlp {
184
192
  }
185
193
  if (typeof input === 'object') {
186
194
  let ret = null;
187
- Object.entries(input).forEach(_ref3 => {
188
- let [input__key, input__value] = _ref3;
195
+ Object.entries(input).forEach(_ref5 => {
196
+ let _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
197
+ input__key = _ref6[0],
198
+ input__value = _ref6[1];
189
199
  ret = input__value;
190
200
  });
191
201
  return ret;
@@ -230,7 +240,9 @@ class hlp {
230
240
  return false;
231
241
  }
232
242
  if (min > max) {
233
- [min, max] = [max, min];
243
+ var _ref7 = [max, min];
244
+ min = _ref7[0];
245
+ max = _ref7[1];
234
246
  }
235
247
  return ~~(Math.random() * (max - min + 1)) + min;
236
248
  }
@@ -517,7 +529,9 @@ class hlp {
517
529
  }
518
530
  for (let i = passwordChars.length - 1; i > 0; i--) {
519
531
  let j = Math.floor(Math.random() * (i + 1));
520
- [passwordChars[i], passwordChars[j]] = [passwordChars[j], passwordChars[i]];
532
+ var _ref8 = [passwordChars[j], passwordChars[i]];
533
+ passwordChars[i] = _ref8[0];
534
+ passwordChars[j] = _ref8[1];
521
535
  }
522
536
  return passwordChars.join('');
523
537
  }
@@ -635,8 +649,10 @@ class hlp {
635
649
  if (hash.has(obj)) return hash.get(obj); // cyclic reference
636
650
  const result = obj instanceof Date ? new Date(obj) : obj instanceof RegExp ? new RegExp(obj.source, obj.flags) : obj.constructor ? new obj.constructor() : Object.create(null);
637
651
  hash.set(obj, result);
638
- if (obj instanceof Map) Array.from(obj, _ref4 => {
639
- let [key, val] = _ref4;
652
+ if (obj instanceof Map) Array.from(obj, _ref9 => {
653
+ let _ref0 = (0, _slicedToArray2.default)(_ref9, 2),
654
+ key = _ref0[0],
655
+ val = _ref0[1];
640
656
  return result.set(key, hlp.deepCopy(val, hash));
641
657
  });
642
658
  return Object.assign(result, ...Object.keys(obj).map(key => ({
@@ -816,8 +832,10 @@ class hlp {
816
832
  xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
817
833
  }
818
834
  if (this.x(args.headers)) {
819
- Object.entries(args.headers).forEach(_ref5 => {
820
- let [headers__key, headers__value] = _ref5;
835
+ Object.entries(args.headers).forEach(_ref1 => {
836
+ let _ref10 = (0, _slicedToArray2.default)(_ref1, 2),
837
+ headers__key = _ref10[0],
838
+ headers__value = _ref10[1];
821
839
  xhr.setRequestHeader(headers__key, headers__value);
822
840
  });
823
841
  }
@@ -1176,29 +1194,17 @@ class hlp {
1176
1194
  }
1177
1195
  static async cursorPosition() {
1178
1196
  // https://stackoverflow.com/a/43326327/2068362
1179
- document.head.insertAdjacentHTML('afterbegin', `
1180
- <style type="text/css">
1181
- .find-pointer-quad {
1182
- --hit: 0;
1183
- position: fixed;
1184
- z-index:2147483647;
1185
- transform: translateZ(0);
1186
- &:hover { --hit: 1; }
1187
- }
1188
- </style>
1189
- `);
1197
+ document.head.insertAdjacentHTML('afterbegin', "\n <style type=\"text/css\">\n .find-pointer-quad {\n --hit: 0;\n position: fixed;\n\t z-index:2147483647;\n transform: translateZ(0);\n &:hover { --hit: 1; }\n }\n </style>\n ");
1190
1198
  window.cursorPositionDelay = 50;
1191
1199
  window.cursorPositionQuads = [];
1192
1200
  let dim = 10;
1193
1201
  let createQuad = (_, pos) => {
1194
1202
  let a = document.createElement('a');
1195
1203
  a.classList.add('find-pointer-quad');
1196
- let {
1197
- style
1198
- } = a;
1199
- style.top = pos < 2 ? '0' : `${dim}%`;
1200
- style.left = pos % 2 === 0 ? '0' : `${dim}%`;
1201
- style.width = style.height = `${dim}%`;
1204
+ let style = a.style;
1205
+ style.top = pos < 2 ? '0' : "".concat(dim, "%");
1206
+ style.left = pos % 2 === 0 ? '0' : "".concat(dim, "%");
1207
+ style.width = style.height = "".concat(dim, "%");
1202
1208
  document.body.appendChild(a);
1203
1209
  return a;
1204
1210
  };
@@ -1209,46 +1215,43 @@ class hlp {
1209
1215
  let hit;
1210
1216
  window.cursorPositionQuads.some(a => {
1211
1217
  let style = getComputedStyle(a);
1212
- let result = style.getPropertyValue(`--hit`);
1213
- if (result === `1`) return hit = {
1218
+ let result = style.getPropertyValue("--hit");
1219
+ if (result === "1") return hit = {
1214
1220
  style,
1215
1221
  a
1216
1222
  };
1217
1223
  });
1218
1224
  if (!hit) {
1219
- let [q1] = window.cursorPositionQuads;
1225
+ let _cursorPositionQuads = (0, _slicedToArray2.default)(window.cursorPositionQuads, 1),
1226
+ q1 = _cursorPositionQuads[0];
1220
1227
  let reset = Math.abs(dim) > 10000;
1221
1228
  let top = parseFloat(q1.style.top) - dim / 2;
1222
1229
  let left = parseFloat(q1.style.left) - dim / 2;
1223
- window.cursorPositionQuads.forEach((_ref6, pos) => {
1224
- let {
1225
- style
1226
- } = _ref6;
1230
+ window.cursorPositionQuads.forEach((_ref11, pos) => {
1231
+ let style = _ref11.style;
1227
1232
  if (reset) {
1228
- style.top = pos < 2 ? '0' : `${dim}%`;
1229
- style.left = pos % 2 === 0 ? '0' : `${dim}%`;
1230
- style.width = style.height = `${dim}%`;
1233
+ style.top = pos < 2 ? '0' : "".concat(dim, "%");
1234
+ style.left = pos % 2 === 0 ? '0' : "".concat(dim, "%");
1235
+ style.width = style.height = "".concat(dim, "%");
1231
1236
  } else {
1232
- style.top = pos < 2 ? `${top}%` : `${top + dim}%`;
1233
- style.left = pos % 2 === 0 ? `${left}%` : `${left + dim}%`;
1234
- style.width = `${dim}%`;
1235
- style.height = `${dim}%`;
1237
+ style.top = pos < 2 ? "".concat(top, "%") : "".concat(top + dim, "%");
1238
+ style.left = pos % 2 === 0 ? "".concat(left, "%") : "".concat(left + dim, "%");
1239
+ style.width = "".concat(dim, "%");
1240
+ style.height = "".concat(dim, "%");
1236
1241
  }
1237
1242
  });
1238
1243
  return new Promise(resolve => {
1239
1244
  setTimeout(() => resolve(this.cursorPositionBisect(!reset ? 2 * dim : dim)), window.cursorPositionDelay);
1240
1245
  });
1241
1246
  }
1242
- let {
1243
- style,
1244
- a
1245
- } = hit;
1246
- let {
1247
- top,
1248
- left,
1249
- width,
1250
- height
1251
- } = a.getBoundingClientRect();
1247
+ let _hit = hit,
1248
+ style = _hit.style,
1249
+ a = _hit.a;
1250
+ let _a$getBoundingClientR = a.getBoundingClientRect(),
1251
+ top = _a$getBoundingClientR.top,
1252
+ left = _a$getBoundingClientR.left,
1253
+ width = _a$getBoundingClientR.width,
1254
+ height = _a$getBoundingClientR.height;
1252
1255
  if (width < 3) {
1253
1256
  window.cursorPositionQuads.forEach(a => a.remove());
1254
1257
  return {
@@ -1259,14 +1262,12 @@ class hlp {
1259
1262
  let ox = a.style.left;
1260
1263
  let oy = a.style.top;
1261
1264
  let nextStep = dim / 2;
1262
- window.cursorPositionQuads.forEach((_ref7, pos) => {
1263
- let {
1264
- style
1265
- } = _ref7;
1266
- style.top = pos < 2 ? oy : `${nextStep + parseFloat(oy)}%`;
1267
- style.left = pos % 2 === 0 ? ox : `${nextStep + parseFloat(ox)}%`;
1268
- style.width = `${nextStep}%`;
1269
- style.height = `${nextStep}%`;
1265
+ window.cursorPositionQuads.forEach((_ref12, pos) => {
1266
+ let style = _ref12.style;
1267
+ style.top = pos < 2 ? oy : "".concat(nextStep + parseFloat(oy), "%");
1268
+ style.left = pos % 2 === 0 ? ox : "".concat(nextStep + parseFloat(ox), "%");
1269
+ style.width = "".concat(nextStep, "%");
1270
+ style.height = "".concat(nextStep, "%");
1270
1271
  });
1271
1272
  return new Promise(resolve => {
1272
1273
  setTimeout(() => resolve(this.cursorPositionBisect(nextStep)), window.cursorPositionDelay);
@@ -1460,7 +1461,7 @@ class hlp {
1460
1461
  // apply trick from https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
1461
1462
  let fn = () => {
1462
1463
  let vh = window.innerHeight * 0.01;
1463
- document.documentElement.style.setProperty('--vh', `${vh}px`);
1464
+ document.documentElement.style.setProperty('--vh', "".concat(vh, "px"));
1464
1465
  };
1465
1466
  fn();
1466
1467
  window.addEventListener('resize', () => {
@@ -2270,7 +2271,7 @@ class hlp {
2270
2271
  return new RegExp(hlp.emojiRegexPattern(), (global === true ? 'g' : '') + 'u');
2271
2272
  }
2272
2273
  static emojiRegexPattern() {
2273
- 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})?))*`;
2274
+ return String.raw(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["p{RI}p{RI}|p{Extended_Pictographic}(p{EMod}|\uFE0F\u20E3?|[\uDB40\uDC20-\uDB40\uDC7E]+\uDB40\uDC7F)?(\u200D(p{RI}p{RI}|p{Extended_Pictographic}(p{EMod}|\uFE0F\u20E3?|[\uDB40\uDC20-\uDB40\uDC7E]+\uDB40\uDC7F)?))*"], ["\\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})?))*"])));
2274
2275
  }
2275
2276
  static emojiSplit(str) {
2276
2277
  if (!(typeof str === 'string' || str instanceof String)) {
@@ -2366,7 +2367,7 @@ class hlp {
2366
2367
  };
2367
2368
  cache.get = index => {
2368
2369
  if (index >= store.length) {
2369
- throw RangeError(`Can't resolve reference ${index + 1}`);
2370
+ throw RangeError("Can't resolve reference ".concat(index + 1));
2370
2371
  }
2371
2372
  return store[index];
2372
2373
  };
@@ -2397,30 +2398,42 @@ class hlp {
2397
2398
  case 'R':
2398
2399
  return expectReference(s);
2399
2400
  default:
2400
- throw SyntaxError(`Invalid or unsupported data type: ${type}`);
2401
+ throw SyntaxError("Invalid or unsupported data type: ".concat(type));
2401
2402
  }
2402
2403
  };
2403
2404
  const expectBool = s => {
2404
2405
  const reBool = /^b:([01]);/;
2405
- const [match, boolMatch] = reBool.exec(s) || [];
2406
+ const _ref13 = reBool.exec(s) || [],
2407
+ _ref14 = (0, _slicedToArray2.default)(_ref13, 2),
2408
+ match = _ref14[0],
2409
+ boolMatch = _ref14[1];
2406
2410
  if (!boolMatch) throw SyntaxError('Invalid bool value, expected 0 or 1');
2407
2411
  return [boolMatch === '1', match.length];
2408
2412
  };
2409
2413
  const expectInt = s => {
2410
2414
  const reInt = /^i:([+-]?\d+);/;
2411
- const [match, intMatch] = reInt.exec(s) || [];
2415
+ const _ref15 = reInt.exec(s) || [],
2416
+ _ref16 = (0, _slicedToArray2.default)(_ref15, 2),
2417
+ match = _ref16[0],
2418
+ intMatch = _ref16[1];
2412
2419
  if (!intMatch) throw SyntaxError('Expected an integer value');
2413
2420
  return [parseInt(intMatch, 10), match.length];
2414
2421
  };
2415
2422
  const expectFloat = s => {
2416
2423
  const reFloat = /^d:(NAN|-?INF|(?:\d+\.\d*|\d*\.\d+|\d+)(?:[eE][+-]\d+)?);/;
2417
- const [match, floatMatch] = reFloat.exec(s) || [];
2424
+ const _ref17 = reFloat.exec(s) || [],
2425
+ _ref18 = (0, _slicedToArray2.default)(_ref17, 2),
2426
+ match = _ref18[0],
2427
+ floatMatch = _ref18[1];
2418
2428
  if (!floatMatch) throw SyntaxError('Expected a float value');
2419
2429
  return [floatMatch === 'NAN' ? Number.NaN : floatMatch === '-INF' ? Number.NEGATIVE_INFINITY : floatMatch === 'INF' ? Number.POSITIVE_INFINITY : parseFloat(floatMatch), match.length];
2420
2430
  };
2421
2431
  const expectString = s => {
2422
2432
  const reStrLength = /^s:(\d+):"/g;
2423
- const [match, byteLenMatch] = reStrLength.exec(s) || [];
2433
+ const _ref19 = reStrLength.exec(s) || [],
2434
+ _ref20 = (0, _slicedToArray2.default)(_ref19, 2),
2435
+ match = _ref20[0],
2436
+ byteLenMatch = _ref20[1];
2424
2437
  if (!match) throw SyntaxError('Expected a string value');
2425
2438
  const len = parseInt(byteLenMatch, 10);
2426
2439
  s = s.substr(match.length);
@@ -2431,7 +2444,10 @@ class hlp {
2431
2444
  };
2432
2445
  const expectEscapedString = s => {
2433
2446
  const reStrLength = /^S:(\d+):"/g;
2434
- const [match, strLenMatch] = reStrLength.exec(s) || [];
2447
+ const _ref21 = reStrLength.exec(s) || [],
2448
+ _ref22 = (0, _slicedToArray2.default)(_ref21, 2),
2449
+ match = _ref22[0],
2450
+ strLenMatch = _ref22[1];
2435
2451
  if (!match) throw SyntaxError('Expected an escaped string value');
2436
2452
  const len = parseInt(strLenMatch, 10);
2437
2453
  s = s.substr(match.length);
@@ -2442,13 +2458,19 @@ class hlp {
2442
2458
  };
2443
2459
  const expectReference = s => {
2444
2460
  const reRef = /^[rR]:(\d+);/;
2445
- const [match, refIndex] = reRef.exec(s) || [];
2461
+ const _ref23 = reRef.exec(s) || [],
2462
+ _ref24 = (0, _slicedToArray2.default)(_ref23, 2),
2463
+ match = _ref24[0],
2464
+ refIndex = _ref24[1];
2446
2465
  if (!match) throw SyntaxError('Expected reference value');
2447
2466
  return [cache.get(parseInt(refIndex, 10) - 1), match.length];
2448
2467
  };
2449
2468
  const expectArray = s => {
2450
2469
  const reArrayLength = /^a:(\d+):\{/;
2451
- const [arrayLiteralBeginMatch, arrayLengthMatch] = reArrayLength.exec(s) || [];
2470
+ const _ref25 = reArrayLength.exec(s) || [],
2471
+ _ref26 = (0, _slicedToArray2.default)(_ref25, 2),
2472
+ arrayLiteralBeginMatch = _ref26[0],
2473
+ arrayLengthMatch = _ref26[1];
2452
2474
  if (!arrayLengthMatch) throw SyntaxError('Expected array length annotation');
2453
2475
  s = s.substr(arrayLiteralBeginMatch.length);
2454
2476
  const items = {};
@@ -2465,9 +2487,13 @@ class hlp {
2465
2487
  };
2466
2488
  const expectObject = s => {
2467
2489
  const reObjectLiteral = /^O:(\d+):"([^\"]+)":(\d+):\{/;
2468
- const [match,, className, propCountMatch] = reObjectLiteral.exec(s) || [];
2490
+ const _ref27 = reObjectLiteral.exec(s) || [],
2491
+ _ref28 = (0, _slicedToArray2.default)(_ref27, 4),
2492
+ match = _ref28[0],
2493
+ className = _ref28[2],
2494
+ propCountMatch = _ref28[3];
2469
2495
  if (!match) throw SyntaxError('Invalid input');
2470
- if (className !== 'stdClass') throw SyntaxError(`Unsupported object type: ${className}`);
2496
+ if (className !== 'stdClass') throw SyntaxError("Unsupported object type: ".concat(className));
2471
2497
  let obj = {};
2472
2498
  cache([obj]);
2473
2499
  s = s.substr(match.length);
@@ -2604,7 +2630,7 @@ class hlp {
2604
2630
  let file = null;
2605
2631
  try {
2606
2632
  file = new File([blob], filename);
2607
- } catch {
2633
+ } catch (_unused) {
2608
2634
  // ie 11
2609
2635
  file = new Blob([blob], filename);
2610
2636
  }
@@ -2820,7 +2846,10 @@ class hlp {
2820
2846
  let path = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
2821
2847
  let paths = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
2822
2848
  if (object !== null && typeof object === 'object') {
2823
- for (const [object__key, object__value] of Object.entries(object)) {
2849
+ for (const _ref29 of Object.entries(object)) {
2850
+ var _ref30 = (0, _slicedToArray2.default)(_ref29, 2);
2851
+ const object__key = _ref30[0];
2852
+ const object__value = _ref30[1];
2824
2853
  if (object__value !== null && typeof object__value === 'object') {
2825
2854
  this.findRecursiveInObject(object__value, key, value, (path === '' ? '' : path + '.') + object__key, paths);
2826
2855
  } else if ((key === null || object__key === key) && (value === null || object__value === value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hlp",
3
- "version": "3.7.8",
3
+ "version": "3.7.9",
4
4
  "main": "_js/_build/script.js",
5
5
  "module": "hlp.esm.js",
6
6
  "exports": {
@@ -43,7 +43,7 @@
43
43
  "@babel/plugin-proposal-private-methods": "^7.18.6",
44
44
  "@babel/plugin-transform-runtime": "^7.29.0",
45
45
  "@babel/polyfill": "^7.12.1",
46
- "@babel/preset-env": "^7.29.2",
46
+ "@babel/preset-env": "^7.29.5",
47
47
  "@babel/preset-react": "^7.28.5",
48
48
  "@babel/preset-typescript": "^7.28.5",
49
49
  "@prettier/plugin-php": "^0.25.0",
@@ -55,7 +55,7 @@
55
55
  "babel-runtime": "^6.26.0",
56
56
  "babelify": "^10.0.0",
57
57
  "browser-sync": "^3.0.4",
58
- "caniuse-lite": "^1.0.30001790",
58
+ "caniuse-lite": "^1.0.30001792",
59
59
  "cli-error-notifier": "^3.0.2",
60
60
  "concat": "^1.0.3",
61
61
  "core-js": "^3.49.0",
@@ -64,7 +64,7 @@
64
64
  "dotenv": "^17.4.2",
65
65
  "element-closest": "^3.0.2",
66
66
  "env-cmd": "^11.0.0",
67
- "eslint": "^10.2.1",
67
+ "eslint": "^10.3.0",
68
68
  "exit": "^0.1.2",
69
69
  "from-env": "^1.1.4",
70
70
  "highlight.js": "^11.11.1",
@@ -76,14 +76,14 @@
76
76
  "mdn-polyfills": "^5.20.0",
77
77
  "move-file-cli": "^3.0.0",
78
78
  "ncp": "^2.0.0",
79
- "npm-check-updates": "^21.0.3",
79
+ "npm-check-updates": "^22.1.0",
80
80
  "npm-run-all2": "^8.0.4",
81
81
  "onchange": "^7.1.0",
82
- "postcss": "^8.5.10",
82
+ "postcss": "^8.5.14",
83
83
  "postcss-cli": "^11.0.1",
84
84
  "postcss-tailwind-data-attr": "^1.0.7",
85
85
  "prettier": "^3.8.3",
86
- "puppeteer": "^24.42.0",
86
+ "puppeteer": "^24.43.0",
87
87
  "regenerator-runtime": "^0.14.1",
88
88
  "replace-in-file": "^8.4.0",
89
89
  "rimraf": "^6.1.3",