@react-hive/honey-utils 3.32.0 → 4.1.0
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 +65 -6
- package/dist/README.md +65 -6
- package/dist/array/index.d.ts +1 -0
- package/dist/array/toggle-array-item.d.ts +26 -0
- package/dist/dom/data-transfer.d.ts +3 -2
- package/dist/dom/history.d.ts +24 -0
- package/dist/dom/index.d.ts +1 -0
- package/dist/encoding/encode-base64-json.d.ts +1 -0
- package/dist/encoding/encode-base64.d.ts +1 -0
- package/dist/encoding/index.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.dev.cjs +236 -53
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/math/clamp.d.ts +18 -0
- package/dist/math/index.d.ts +1 -0
- package/package.json +9 -9
package/dist/index.dev.cjs
CHANGED
|
@@ -412,6 +412,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
412
412
|
/* harmony export */ isArray: () => (/* reexport safe */ _is_array__WEBPACK_IMPORTED_MODULE_7__.isArray),
|
|
413
413
|
/* harmony export */ isEmptyArray: () => (/* reexport safe */ _is_empty_array__WEBPACK_IMPORTED_MODULE_8__.isEmptyArray),
|
|
414
414
|
/* harmony export */ pipe: () => (/* reexport safe */ _pipe__WEBPACK_IMPORTED_MODULE_0__.pipe),
|
|
415
|
+
/* harmony export */ toggleArrayItem: () => (/* reexport safe */ _toggle_array_item__WEBPACK_IMPORTED_MODULE_10__.toggleArrayItem),
|
|
415
416
|
/* harmony export */ unique: () => (/* reexport safe */ _unique__WEBPACK_IMPORTED_MODULE_5__.unique)
|
|
416
417
|
/* harmony export */ });
|
|
417
418
|
/* harmony import */ var _pipe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pipe */ "./src/array/pipe.ts");
|
|
@@ -424,6 +425,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
424
425
|
/* harmony import */ var _is_array__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./is-array */ "./src/array/is-array.ts");
|
|
425
426
|
/* harmony import */ var _is_empty_array__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./is-empty-array */ "./src/array/is-empty-array.ts");
|
|
426
427
|
/* harmony import */ var _get_adjacent_items__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./get-adjacent-items */ "./src/array/get-adjacent-items.ts");
|
|
428
|
+
/* harmony import */ var _toggle_array_item__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./toggle-array-item */ "./src/array/toggle-array-item.ts");
|
|
429
|
+
|
|
427
430
|
|
|
428
431
|
|
|
429
432
|
|
|
@@ -560,6 +563,54 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
560
563
|
const pipe = (...fns) => (arg) => fns.reduce((prev, fn) => fn(prev), arg);
|
|
561
564
|
|
|
562
565
|
|
|
566
|
+
/***/ },
|
|
567
|
+
|
|
568
|
+
/***/ "./src/array/toggle-array-item.ts"
|
|
569
|
+
/*!****************************************!*\
|
|
570
|
+
!*** ./src/array/toggle-array-item.ts ***!
|
|
571
|
+
\****************************************/
|
|
572
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
573
|
+
|
|
574
|
+
__webpack_require__.r(__webpack_exports__);
|
|
575
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
576
|
+
/* harmony export */ toggleArrayItem: () => (/* binding */ toggleArrayItem)
|
|
577
|
+
/* harmony export */ });
|
|
578
|
+
/* harmony import */ var _difference__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./difference */ "./src/array/difference.ts");
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Adds an item to an array or removes it from the array, without changing the source array.
|
|
582
|
+
*
|
|
583
|
+
* With `isIncluded` given, the item ends up in the array or out of it as asked - what a checkbox
|
|
584
|
+
* in a list of them reports. Without it, the item's presence is flipped.
|
|
585
|
+
*
|
|
586
|
+
* The source array itself is returned when it already is as asked, and an item already present is
|
|
587
|
+
* never added a second time. Items are matched as `includes()` matches them.
|
|
588
|
+
*
|
|
589
|
+
* @template T - The type of the items in the array.
|
|
590
|
+
*
|
|
591
|
+
* @param array - The source array.
|
|
592
|
+
* @param item - The item to add or remove.
|
|
593
|
+
* @param isIncluded - Whether the item should be in the array. Flips its presence when omitted.
|
|
594
|
+
*
|
|
595
|
+
* @returns The array with the item in it or out of it.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```ts
|
|
599
|
+
* toggleArrayItem(['a', 'b'], 'c', true); // ['a', 'b', 'c']
|
|
600
|
+
* toggleArrayItem(['a', 'b'], 'b', false); // ['a']
|
|
601
|
+
* toggleArrayItem(['a', 'b'], 'a'); // ['b']
|
|
602
|
+
* toggleArrayItem(['a', 'b'], 'c'); // ['a', 'b', 'c']
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
const toggleArrayItem = (array, item, isIncluded) => {
|
|
606
|
+
const isPresent = array.includes(item);
|
|
607
|
+
if (isPresent === (isIncluded ?? !isPresent)) {
|
|
608
|
+
return array;
|
|
609
|
+
}
|
|
610
|
+
return isPresent ? (0,_difference__WEBPACK_IMPORTED_MODULE_0__.difference)(array, [item]) : [...array, item];
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
|
|
563
614
|
/***/ },
|
|
564
615
|
|
|
565
616
|
/***/ "./src/array/unique.ts"
|
|
@@ -1098,6 +1149,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1098
1149
|
/* harmony export */ getDataTransferJson: () => (/* binding */ getDataTransferJson),
|
|
1099
1150
|
/* harmony export */ setDataTransferJson: () => (/* binding */ setDataTransferJson)
|
|
1100
1151
|
/* harmony export */ });
|
|
1152
|
+
/* harmony import */ var _json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ~/json */ "./src/json/index.ts");
|
|
1153
|
+
|
|
1101
1154
|
const DATA_TRANSFER_JSON_MIME = 'application/json';
|
|
1102
1155
|
/**
|
|
1103
1156
|
* Serializes and stores JSON data in a DataTransfer object.
|
|
@@ -1115,19 +1168,14 @@ const setDataTransferJson = (dataTransfer, data) => {
|
|
|
1115
1168
|
*
|
|
1116
1169
|
* @param dataTransfer DataTransfer instance from a drop event.
|
|
1117
1170
|
*
|
|
1118
|
-
* @returns Parsed JSON value or
|
|
1171
|
+
* @returns Parsed JSON value or null if not present or invalid.
|
|
1119
1172
|
*/
|
|
1120
1173
|
const getDataTransferJson = (dataTransfer) => {
|
|
1121
1174
|
const rawData = dataTransfer.getData(DATA_TRANSFER_JSON_MIME);
|
|
1122
1175
|
if (!rawData) {
|
|
1123
|
-
return
|
|
1124
|
-
}
|
|
1125
|
-
try {
|
|
1126
|
-
return JSON.parse(rawData);
|
|
1127
|
-
}
|
|
1128
|
-
catch {
|
|
1129
|
-
return undefined;
|
|
1176
|
+
return null;
|
|
1130
1177
|
}
|
|
1178
|
+
return (0,_json__WEBPACK_IMPORTED_MODULE_0__.parseJson)(rawData);
|
|
1131
1179
|
};
|
|
1132
1180
|
|
|
1133
1181
|
|
|
@@ -1274,6 +1322,47 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1274
1322
|
|
|
1275
1323
|
|
|
1276
1324
|
|
|
1325
|
+
/***/ },
|
|
1326
|
+
|
|
1327
|
+
/***/ "./src/dom/history.ts"
|
|
1328
|
+
/*!****************************!*\
|
|
1329
|
+
!*** ./src/dom/history.ts ***!
|
|
1330
|
+
\****************************/
|
|
1331
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1332
|
+
|
|
1333
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1334
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1335
|
+
/* harmony export */ replaceHistorySearchParams: () => (/* binding */ replaceHistorySearchParams)
|
|
1336
|
+
/* harmony export */ });
|
|
1337
|
+
/**
|
|
1338
|
+
* Replaces the query string of the current URL without navigating or adding a history entry.
|
|
1339
|
+
*
|
|
1340
|
+
* The path and the hash are kept, and so is the history entry's state, which routers such as
|
|
1341
|
+
* React Router keep their own bookkeeping in. Empty search params remove the query string
|
|
1342
|
+
* altogether rather than leaving a bare `?`.
|
|
1343
|
+
*
|
|
1344
|
+
* `history.replaceState()` fires no event, so a router listening for navigation is not told: its
|
|
1345
|
+
* own location keeps the previous query until it next navigates.
|
|
1346
|
+
*
|
|
1347
|
+
* @param searchParams - The search params the URL should carry.
|
|
1348
|
+
*
|
|
1349
|
+
* @example
|
|
1350
|
+
* ```ts
|
|
1351
|
+
* // https://example.com/products?page=1#reviews
|
|
1352
|
+
* const searchParams = new URLSearchParams(window.location.search);
|
|
1353
|
+
*
|
|
1354
|
+
* searchParams.set('page', '2');
|
|
1355
|
+
*
|
|
1356
|
+
* replaceHistorySearchParams(searchParams);
|
|
1357
|
+
* // ➜ https://example.com/products?page=2#reviews
|
|
1358
|
+
* ```
|
|
1359
|
+
*/
|
|
1360
|
+
const replaceHistorySearchParams = (searchParams) => {
|
|
1361
|
+
const search = searchParams.toString();
|
|
1362
|
+
window.history.replaceState(window.history.state, '', `${window.location.pathname}${search ? `?${search}` : ''}${window.location.hash}`);
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
|
|
1277
1366
|
/***/ },
|
|
1278
1367
|
|
|
1279
1368
|
/***/ "./src/dom/index.ts"
|
|
@@ -1285,25 +1374,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1285
1374
|
__webpack_require__.r(__webpack_exports__);
|
|
1286
1375
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1287
1376
|
/* harmony export */ DATA_TRANSFER_JSON_MIME: () => (/* reexport safe */ _data_transfer__WEBPACK_IMPORTED_MODULE_0__.DATA_TRANSFER_JSON_MIME),
|
|
1288
|
-
/* harmony export */ centerElementInContainer: () => (/* reexport safe */
|
|
1377
|
+
/* harmony export */ centerElementInContainer: () => (/* reexport safe */ _layout__WEBPACK_IMPORTED_MODULE_4__.centerElementInContainer),
|
|
1289
1378
|
/* harmony export */ cloneBlob: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_1__.cloneBlob),
|
|
1290
1379
|
/* harmony export */ downloadFile: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_2__.downloadFile),
|
|
1291
1380
|
/* harmony export */ getDataTransferJson: () => (/* reexport safe */ _data_transfer__WEBPACK_IMPORTED_MODULE_0__.getDataTransferJson),
|
|
1292
1381
|
/* harmony export */ getElementOffsetRect: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_1__.getElementOffsetRect),
|
|
1293
|
-
/* harmony export */ getXOverflowWidth: () => (/* reexport safe */
|
|
1294
|
-
/* harmony export */ getYOverflowHeight: () => (/* reexport safe */
|
|
1295
|
-
/* harmony export */ hasXOverflow: () => (/* reexport safe */
|
|
1296
|
-
/* harmony export */ hasYOverflow: () => (/* reexport safe */
|
|
1382
|
+
/* harmony export */ getXOverflowWidth: () => (/* reexport safe */ _layout__WEBPACK_IMPORTED_MODULE_4__.getXOverflowWidth),
|
|
1383
|
+
/* harmony export */ getYOverflowHeight: () => (/* reexport safe */ _layout__WEBPACK_IMPORTED_MODULE_4__.getYOverflowHeight),
|
|
1384
|
+
/* harmony export */ hasXOverflow: () => (/* reexport safe */ _layout__WEBPACK_IMPORTED_MODULE_4__.hasXOverflow),
|
|
1385
|
+
/* harmony export */ hasYOverflow: () => (/* reexport safe */ _layout__WEBPACK_IMPORTED_MODULE_4__.hasYOverflow),
|
|
1297
1386
|
/* harmony export */ isAnchorHtmlElement: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_1__.isAnchorHtmlElement),
|
|
1298
1387
|
/* harmony export */ isContentEditableHtmlElement: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_1__.isContentEditableHtmlElement),
|
|
1299
|
-
/* harmony export */ parse2DMatrix: () => (/* reexport safe */
|
|
1388
|
+
/* harmony export */ parse2DMatrix: () => (/* reexport safe */ _transform__WEBPACK_IMPORTED_MODULE_5__.parse2DMatrix),
|
|
1389
|
+
/* harmony export */ replaceHistorySearchParams: () => (/* reexport safe */ _history__WEBPACK_IMPORTED_MODULE_3__.replaceHistorySearchParams),
|
|
1300
1390
|
/* harmony export */ setDataTransferJson: () => (/* reexport safe */ _data_transfer__WEBPACK_IMPORTED_MODULE_0__.setDataTransferJson)
|
|
1301
1391
|
/* harmony export */ });
|
|
1302
1392
|
/* harmony import */ var _data_transfer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./data-transfer */ "./src/dom/data-transfer.ts");
|
|
1303
1393
|
/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom */ "./src/dom/dom.ts");
|
|
1304
1394
|
/* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./file */ "./src/dom/file/index.ts");
|
|
1305
|
-
/* harmony import */ var
|
|
1306
|
-
/* harmony import */ var
|
|
1395
|
+
/* harmony import */ var _history__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./history */ "./src/dom/history.ts");
|
|
1396
|
+
/* harmony import */ var _layout__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./layout */ "./src/dom/layout/index.ts");
|
|
1397
|
+
/* harmony import */ var _transform__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transform */ "./src/dom/transform/index.ts");
|
|
1398
|
+
|
|
1307
1399
|
|
|
1308
1400
|
|
|
1309
1401
|
|
|
@@ -1558,18 +1650,26 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1558
1650
|
/* harmony export */ decodeBase64: () => (/* binding */ decodeBase64)
|
|
1559
1651
|
/* harmony export */ });
|
|
1560
1652
|
const BASE64_PATTERN = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
1653
|
+
const decodeBase64Bytes = (value) => {
|
|
1654
|
+
if (typeof Uint8Array.fromBase64 === 'function') {
|
|
1655
|
+
return Uint8Array.fromBase64(value);
|
|
1656
|
+
}
|
|
1657
|
+
if (typeof Buffer !== 'undefined') {
|
|
1658
|
+
return Buffer.from(value, 'base64');
|
|
1659
|
+
}
|
|
1660
|
+
const binary = atob(value);
|
|
1661
|
+
const bytes = new Uint8Array(binary.length);
|
|
1662
|
+
for (let i = 0; i < binary.length; i++) {
|
|
1663
|
+
bytes[i] = binary.charCodeAt(i);
|
|
1664
|
+
}
|
|
1665
|
+
return bytes;
|
|
1666
|
+
};
|
|
1561
1667
|
const decodeBase64 = (value) => {
|
|
1668
|
+
if (!BASE64_PATTERN.test(value)) {
|
|
1669
|
+
return null;
|
|
1670
|
+
}
|
|
1562
1671
|
try {
|
|
1563
|
-
|
|
1564
|
-
return null;
|
|
1565
|
-
}
|
|
1566
|
-
if (typeof Buffer !== 'undefined') {
|
|
1567
|
-
return Buffer.from(value, 'base64').toString('utf-8');
|
|
1568
|
-
}
|
|
1569
|
-
return decodeURIComponent(atob(value)
|
|
1570
|
-
.split('')
|
|
1571
|
-
.map(char => `%${char.charCodeAt(0).toString(16).padStart(2, '0')}`)
|
|
1572
|
-
.join(''));
|
|
1672
|
+
return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(decodeBase64Bytes(value));
|
|
1573
1673
|
}
|
|
1574
1674
|
catch {
|
|
1575
1675
|
return null;
|
|
@@ -1577,6 +1677,51 @@ const decodeBase64 = (value) => {
|
|
|
1577
1677
|
};
|
|
1578
1678
|
|
|
1579
1679
|
|
|
1680
|
+
/***/ },
|
|
1681
|
+
|
|
1682
|
+
/***/ "./src/encoding/encode-base64-json.ts"
|
|
1683
|
+
/*!********************************************!*\
|
|
1684
|
+
!*** ./src/encoding/encode-base64-json.ts ***!
|
|
1685
|
+
\********************************************/
|
|
1686
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1687
|
+
|
|
1688
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1689
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1690
|
+
/* harmony export */ encodeBase64Json: () => (/* binding */ encodeBase64Json)
|
|
1691
|
+
/* harmony export */ });
|
|
1692
|
+
/* harmony import */ var _encode_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encode-base64 */ "./src/encoding/encode-base64.ts");
|
|
1693
|
+
|
|
1694
|
+
const encodeBase64Json = (value) => (0,_encode_base64__WEBPACK_IMPORTED_MODULE_0__.encodeBase64)(JSON.stringify(value));
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
/***/ },
|
|
1698
|
+
|
|
1699
|
+
/***/ "./src/encoding/encode-base64.ts"
|
|
1700
|
+
/*!***************************************!*\
|
|
1701
|
+
!*** ./src/encoding/encode-base64.ts ***!
|
|
1702
|
+
\***************************************/
|
|
1703
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1704
|
+
|
|
1705
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1706
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1707
|
+
/* harmony export */ encodeBase64: () => (/* binding */ encodeBase64)
|
|
1708
|
+
/* harmony export */ });
|
|
1709
|
+
const encodeBase64Bytes = (bytes) => {
|
|
1710
|
+
if (typeof bytes.toBase64 === 'function') {
|
|
1711
|
+
return bytes.toBase64();
|
|
1712
|
+
}
|
|
1713
|
+
if (typeof Buffer !== 'undefined') {
|
|
1714
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('base64');
|
|
1715
|
+
}
|
|
1716
|
+
let binary = '';
|
|
1717
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
1718
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1719
|
+
}
|
|
1720
|
+
return btoa(binary);
|
|
1721
|
+
};
|
|
1722
|
+
const encodeBase64 = (value) => encodeBase64Bytes(new TextEncoder().encode(value));
|
|
1723
|
+
|
|
1724
|
+
|
|
1580
1725
|
/***/ },
|
|
1581
1726
|
|
|
1582
1727
|
/***/ "./src/encoding/index.ts"
|
|
@@ -1588,10 +1733,16 @@ const decodeBase64 = (value) => {
|
|
|
1588
1733
|
__webpack_require__.r(__webpack_exports__);
|
|
1589
1734
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1590
1735
|
/* harmony export */ decodeBase64: () => (/* reexport safe */ _decode_base64__WEBPACK_IMPORTED_MODULE_0__.decodeBase64),
|
|
1591
|
-
/* harmony export */ decodeBase64Json: () => (/* reexport safe */ _decode_base64_json__WEBPACK_IMPORTED_MODULE_1__.decodeBase64Json)
|
|
1736
|
+
/* harmony export */ decodeBase64Json: () => (/* reexport safe */ _decode_base64_json__WEBPACK_IMPORTED_MODULE_1__.decodeBase64Json),
|
|
1737
|
+
/* harmony export */ encodeBase64: () => (/* reexport safe */ _encode_base64__WEBPACK_IMPORTED_MODULE_2__.encodeBase64),
|
|
1738
|
+
/* harmony export */ encodeBase64Json: () => (/* reexport safe */ _encode_base64_json__WEBPACK_IMPORTED_MODULE_3__.encodeBase64Json)
|
|
1592
1739
|
/* harmony export */ });
|
|
1593
1740
|
/* harmony import */ var _decode_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decode-base64 */ "./src/encoding/decode-base64.ts");
|
|
1594
1741
|
/* harmony import */ var _decode_base64_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode-base64-json */ "./src/encoding/decode-base64-json.ts");
|
|
1742
|
+
/* harmony import */ var _encode_base64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encode-base64 */ "./src/encoding/encode-base64.ts");
|
|
1743
|
+
/* harmony import */ var _encode_base64_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./encode-base64-json */ "./src/encoding/encode-base64-json.ts");
|
|
1744
|
+
|
|
1745
|
+
|
|
1595
1746
|
|
|
1596
1747
|
|
|
1597
1748
|
|
|
@@ -2718,6 +2869,38 @@ const parseJson = (value) => {
|
|
|
2718
2869
|
};
|
|
2719
2870
|
|
|
2720
2871
|
|
|
2872
|
+
/***/ },
|
|
2873
|
+
|
|
2874
|
+
/***/ "./src/math/clamp.ts"
|
|
2875
|
+
/*!***************************!*\
|
|
2876
|
+
!*** ./src/math/clamp.ts ***!
|
|
2877
|
+
\***************************/
|
|
2878
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2879
|
+
|
|
2880
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2881
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2882
|
+
/* harmony export */ clamp: () => (/* binding */ clamp)
|
|
2883
|
+
/* harmony export */ });
|
|
2884
|
+
/**
|
|
2885
|
+
* Restricts a number to the inclusive range between `min` and `max`.
|
|
2886
|
+
*
|
|
2887
|
+
* @param value - The number to restrict.
|
|
2888
|
+
* @param min - The lower bound.
|
|
2889
|
+
* @param max - The upper bound. Wins over `min` when the two cross.
|
|
2890
|
+
*
|
|
2891
|
+
* @returns `min` when the value is below it, `max` when the value is above it, and the value
|
|
2892
|
+
* itself otherwise.
|
|
2893
|
+
*
|
|
2894
|
+
* @example
|
|
2895
|
+
* ```ts
|
|
2896
|
+
* clamp(5, 0, 10); // 5
|
|
2897
|
+
* clamp(-3, 0, 10); // 0
|
|
2898
|
+
* clamp(42, 0, 10); // 10
|
|
2899
|
+
* ```
|
|
2900
|
+
*/
|
|
2901
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
2902
|
+
|
|
2903
|
+
|
|
2721
2904
|
/***/ },
|
|
2722
2905
|
|
|
2723
2906
|
/***/ "./src/math/hash-string.ts"
|
|
@@ -2776,10 +2959,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2776
2959
|
/* harmony export */ calculateEuclideanDistance: () => (/* reexport safe */ _math__WEBPACK_IMPORTED_MODULE_0__.calculateEuclideanDistance),
|
|
2777
2960
|
/* harmony export */ calculateMovingSpeed: () => (/* reexport safe */ _math__WEBPACK_IMPORTED_MODULE_0__.calculateMovingSpeed),
|
|
2778
2961
|
/* harmony export */ calculatePercentage: () => (/* reexport safe */ _math__WEBPACK_IMPORTED_MODULE_0__.calculatePercentage),
|
|
2962
|
+
/* harmony export */ clamp: () => (/* reexport safe */ _clamp__WEBPACK_IMPORTED_MODULE_2__.clamp),
|
|
2779
2963
|
/* harmony export */ hashString: () => (/* reexport safe */ _hash_string__WEBPACK_IMPORTED_MODULE_1__.hashString)
|
|
2780
2964
|
/* harmony export */ });
|
|
2781
2965
|
/* harmony import */ var _math__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math */ "./src/math/math.ts");
|
|
2782
2966
|
/* harmony import */ var _hash_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hash-string */ "./src/math/hash-string.ts");
|
|
2967
|
+
/* harmony import */ var _clamp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./clamp */ "./src/math/clamp.ts");
|
|
2968
|
+
|
|
2783
2969
|
|
|
2784
2970
|
|
|
2785
2971
|
|
|
@@ -3622,17 +3808,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3622
3808
|
/******/ });
|
|
3623
3809
|
/************************************************************************/
|
|
3624
3810
|
/******/ // The module cache
|
|
3625
|
-
/******/
|
|
3811
|
+
/******/ const __webpack_module_cache__ = {};
|
|
3626
3812
|
/******/
|
|
3627
3813
|
/******/ // The require function
|
|
3628
3814
|
/******/ function __webpack_require__(moduleId) {
|
|
3629
3815
|
/******/ // Check if module is in cache
|
|
3630
|
-
/******/
|
|
3816
|
+
/******/ const cachedModule = __webpack_module_cache__[moduleId];
|
|
3631
3817
|
/******/ if (cachedModule !== undefined) {
|
|
3632
3818
|
/******/ return cachedModule.exports;
|
|
3633
3819
|
/******/ }
|
|
3634
3820
|
/******/ // Create a new module (and put it into the cache)
|
|
3635
|
-
/******/
|
|
3821
|
+
/******/ const module = __webpack_module_cache__[moduleId] = {
|
|
3636
3822
|
/******/ // no module.id needed
|
|
3637
3823
|
/******/ // no module.loaded needed
|
|
3638
3824
|
/******/ exports: {}
|
|
@@ -3641,7 +3827,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3641
3827
|
/******/ // Execute the module function
|
|
3642
3828
|
/******/ if (!(moduleId in __webpack_modules__)) {
|
|
3643
3829
|
/******/ delete __webpack_module_cache__[moduleId];
|
|
3644
|
-
/******/
|
|
3830
|
+
/******/ const e = new Error("Cannot find module '" + moduleId + "'");
|
|
3645
3831
|
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
3646
3832
|
/******/ throw e;
|
|
3647
3833
|
/******/ }
|
|
@@ -3653,35 +3839,27 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3653
3839
|
/******/
|
|
3654
3840
|
/************************************************************************/
|
|
3655
3841
|
/******/ /* webpack/runtime/define property getters */
|
|
3656
|
-
/******/
|
|
3657
|
-
/******/
|
|
3658
|
-
/******/
|
|
3659
|
-
/******/
|
|
3660
|
-
/******/
|
|
3661
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
3662
|
-
/******/ }
|
|
3842
|
+
/******/ // define getter/value functions for harmony exports
|
|
3843
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
3844
|
+
/******/ for(var key in definition) {
|
|
3845
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
3846
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
3663
3847
|
/******/ }
|
|
3664
|
-
/******/ }
|
|
3665
|
-
/******/ }
|
|
3848
|
+
/******/ }
|
|
3849
|
+
/******/ };
|
|
3666
3850
|
/******/
|
|
3667
3851
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
3668
|
-
/******/ (
|
|
3669
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
3670
|
-
/******/ })();
|
|
3852
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));
|
|
3671
3853
|
/******/
|
|
3672
3854
|
/******/ /* webpack/runtime/make namespace object */
|
|
3673
|
-
/******/
|
|
3674
|
-
/******/
|
|
3675
|
-
/******/
|
|
3676
|
-
/******/
|
|
3677
|
-
/******/
|
|
3678
|
-
/******/ }
|
|
3679
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
3680
|
-
/******/ };
|
|
3681
|
-
/******/ })();
|
|
3855
|
+
/******/ // define __esModule on exports
|
|
3856
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
3857
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3858
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
3859
|
+
/******/ };
|
|
3682
3860
|
/******/
|
|
3683
3861
|
/************************************************************************/
|
|
3684
|
-
|
|
3862
|
+
let __webpack_exports__ = {};
|
|
3685
3863
|
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
3686
3864
|
(() => {
|
|
3687
3865
|
/*!**********************!*\
|
|
@@ -3702,6 +3880,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3702
3880
|
/* harmony export */ camelToWords: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_13__.camelToWords),
|
|
3703
3881
|
/* harmony export */ centerElementInContainer: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.centerElementInContainer),
|
|
3704
3882
|
/* harmony export */ chunk: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.chunk),
|
|
3883
|
+
/* harmony export */ clamp: () => (/* reexport safe */ _math__WEBPACK_IMPORTED_MODULE_11__.clamp),
|
|
3705
3884
|
/* harmony export */ clampOffsetToOverflow: () => (/* reexport safe */ _geometry__WEBPACK_IMPORTED_MODULE_7__.clampOffsetToOverflow),
|
|
3706
3885
|
/* harmony export */ cloneBlob: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.cloneBlob),
|
|
3707
3886
|
/* harmony export */ compact: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.compact),
|
|
@@ -3712,6 +3891,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3712
3891
|
/* harmony export */ delay: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_2__.delay),
|
|
3713
3892
|
/* harmony export */ difference: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.difference),
|
|
3714
3893
|
/* harmony export */ downloadFile: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.downloadFile),
|
|
3894
|
+
/* harmony export */ encodeBase64: () => (/* reexport safe */ _encoding__WEBPACK_IMPORTED_MODULE_18__.encodeBase64),
|
|
3895
|
+
/* harmony export */ encodeBase64Json: () => (/* reexport safe */ _encoding__WEBPACK_IMPORTED_MODULE_18__.encodeBase64Json),
|
|
3715
3896
|
/* harmony export */ everyAsync: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_2__.everyAsync),
|
|
3716
3897
|
/* harmony export */ fileListToFiles: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_5__.fileListToFiles),
|
|
3717
3898
|
/* harmony export */ filterParallel: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_2__.filterParallel),
|
|
@@ -3777,6 +3958,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3777
3958
|
/* harmony export */ pipe: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.pipe),
|
|
3778
3959
|
/* harmony export */ readFilesFromDataTransfer: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_5__.readFilesFromDataTransfer),
|
|
3779
3960
|
/* harmony export */ reduceAsync: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_2__.reduceAsync),
|
|
3961
|
+
/* harmony export */ replaceHistorySearchParams: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.replaceHistorySearchParams),
|
|
3780
3962
|
/* harmony export */ resolveAxisDelta: () => (/* reexport safe */ _intersection__WEBPACK_IMPORTED_MODULE_10__.resolveAxisDelta),
|
|
3781
3963
|
/* harmony export */ resolveBoundedDelta: () => (/* reexport safe */ _geometry__WEBPACK_IMPORTED_MODULE_7__.resolveBoundedDelta),
|
|
3782
3964
|
/* harmony export */ retry: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_2__.retry),
|
|
@@ -3789,6 +3971,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3789
3971
|
/* harmony export */ splitStringIntoWords: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_13__.splitStringIntoWords),
|
|
3790
3972
|
/* harmony export */ timeout: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_2__.timeout),
|
|
3791
3973
|
/* harmony export */ toKebabCase: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_13__.toKebabCase),
|
|
3974
|
+
/* harmony export */ toggleArrayItem: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.toggleArrayItem),
|
|
3792
3975
|
/* harmony export */ traverseFileSystemDirectory: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_5__.traverseFileSystemDirectory),
|
|
3793
3976
|
/* harmony export */ unique: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.unique)
|
|
3794
3977
|
/* harmony export */ });
|