@react-hive/honey-utils 3.31.0 → 4.0.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 +80 -2
- package/dist/README.md +80 -2
- package/dist/dom/data-transfer.d.ts +3 -2
- package/dist/encoding/decode-base64-json.d.ts +2 -0
- package/dist/encoding/decode-base64.d.ts +2 -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.d.ts +2 -0
- package/dist/index.dev.cjs +126 -8
- package/dist/index.dev.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/json/index.d.ts +1 -0
- package/dist/json/parse-json.d.ts +2 -0
- package/package.json +5 -6
package/dist/index.d.ts
CHANGED
package/dist/index.dev.cjs
CHANGED
|
@@ -1098,6 +1098,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1098
1098
|
/* harmony export */ getDataTransferJson: () => (/* binding */ getDataTransferJson),
|
|
1099
1099
|
/* harmony export */ setDataTransferJson: () => (/* binding */ setDataTransferJson)
|
|
1100
1100
|
/* harmony export */ });
|
|
1101
|
+
/* harmony import */ var _json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ~/json */ "./src/json/index.ts");
|
|
1102
|
+
|
|
1101
1103
|
const DATA_TRANSFER_JSON_MIME = 'application/json';
|
|
1102
1104
|
/**
|
|
1103
1105
|
* Serializes and stores JSON data in a DataTransfer object.
|
|
@@ -1115,19 +1117,14 @@ const setDataTransferJson = (dataTransfer, data) => {
|
|
|
1115
1117
|
*
|
|
1116
1118
|
* @param dataTransfer DataTransfer instance from a drop event.
|
|
1117
1119
|
*
|
|
1118
|
-
* @returns Parsed JSON value or
|
|
1120
|
+
* @returns Parsed JSON value or null if not present or invalid.
|
|
1119
1121
|
*/
|
|
1120
1122
|
const getDataTransferJson = (dataTransfer) => {
|
|
1121
1123
|
const rawData = dataTransfer.getData(DATA_TRANSFER_JSON_MIME);
|
|
1122
1124
|
if (!rawData) {
|
|
1123
|
-
return
|
|
1124
|
-
}
|
|
1125
|
-
try {
|
|
1126
|
-
return JSON.parse(rawData);
|
|
1127
|
-
}
|
|
1128
|
-
catch {
|
|
1129
|
-
return undefined;
|
|
1125
|
+
return null;
|
|
1130
1126
|
}
|
|
1127
|
+
return (0,_json__WEBPACK_IMPORTED_MODULE_0__.parseJson)(rawData);
|
|
1131
1128
|
};
|
|
1132
1129
|
|
|
1133
1130
|
|
|
@@ -1520,6 +1517,82 @@ const parse2DMatrix = (element) => {
|
|
|
1520
1517
|
};
|
|
1521
1518
|
|
|
1522
1519
|
|
|
1520
|
+
/***/ },
|
|
1521
|
+
|
|
1522
|
+
/***/ "./src/encoding/decode-base64-json.ts"
|
|
1523
|
+
/*!********************************************!*\
|
|
1524
|
+
!*** ./src/encoding/decode-base64-json.ts ***!
|
|
1525
|
+
\********************************************/
|
|
1526
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1527
|
+
|
|
1528
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1529
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1530
|
+
/* harmony export */ decodeBase64Json: () => (/* binding */ decodeBase64Json)
|
|
1531
|
+
/* harmony export */ });
|
|
1532
|
+
/* harmony import */ var _json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ~/json */ "./src/json/index.ts");
|
|
1533
|
+
/* harmony import */ var _decode_base64__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode-base64 */ "./src/encoding/decode-base64.ts");
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
const decodeBase64Json = (value) => {
|
|
1537
|
+
const decodedValue = (0,_decode_base64__WEBPACK_IMPORTED_MODULE_1__.decodeBase64)(value);
|
|
1538
|
+
if (decodedValue === null) {
|
|
1539
|
+
return null;
|
|
1540
|
+
}
|
|
1541
|
+
return (0,_json__WEBPACK_IMPORTED_MODULE_0__.parseJson)(decodedValue);
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
/***/ },
|
|
1546
|
+
|
|
1547
|
+
/***/ "./src/encoding/decode-base64.ts"
|
|
1548
|
+
/*!***************************************!*\
|
|
1549
|
+
!*** ./src/encoding/decode-base64.ts ***!
|
|
1550
|
+
\***************************************/
|
|
1551
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1552
|
+
|
|
1553
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1554
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1555
|
+
/* harmony export */ decodeBase64: () => (/* binding */ decodeBase64)
|
|
1556
|
+
/* harmony export */ });
|
|
1557
|
+
const BASE64_PATTERN = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
1558
|
+
const decodeBase64 = (value) => {
|
|
1559
|
+
try {
|
|
1560
|
+
if (!BASE64_PATTERN.test(value)) {
|
|
1561
|
+
return null;
|
|
1562
|
+
}
|
|
1563
|
+
if (typeof Buffer !== 'undefined') {
|
|
1564
|
+
return Buffer.from(value, 'base64').toString('utf-8');
|
|
1565
|
+
}
|
|
1566
|
+
return decodeURIComponent(atob(value)
|
|
1567
|
+
.split('')
|
|
1568
|
+
.map(char => `%${char.charCodeAt(0).toString(16).padStart(2, '0')}`)
|
|
1569
|
+
.join(''));
|
|
1570
|
+
}
|
|
1571
|
+
catch {
|
|
1572
|
+
return null;
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
|
|
1577
|
+
/***/ },
|
|
1578
|
+
|
|
1579
|
+
/***/ "./src/encoding/index.ts"
|
|
1580
|
+
/*!*******************************!*\
|
|
1581
|
+
!*** ./src/encoding/index.ts ***!
|
|
1582
|
+
\*******************************/
|
|
1583
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1584
|
+
|
|
1585
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1586
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1587
|
+
/* harmony export */ decodeBase64: () => (/* reexport safe */ _decode_base64__WEBPACK_IMPORTED_MODULE_0__.decodeBase64),
|
|
1588
|
+
/* harmony export */ decodeBase64Json: () => (/* reexport safe */ _decode_base64_json__WEBPACK_IMPORTED_MODULE_1__.decodeBase64Json)
|
|
1589
|
+
/* harmony export */ });
|
|
1590
|
+
/* harmony import */ var _decode_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./decode-base64 */ "./src/encoding/decode-base64.ts");
|
|
1591
|
+
/* harmony import */ var _decode_base64_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decode-base64-json */ "./src/encoding/decode-base64-json.ts");
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
|
|
1523
1596
|
/***/ },
|
|
1524
1597
|
|
|
1525
1598
|
/***/ "./src/env/index.ts"
|
|
@@ -2604,6 +2677,44 @@ const resolveAxisDelta = (delta, axis, { allowFallback = true, invert = true } =
|
|
|
2604
2677
|
};
|
|
2605
2678
|
|
|
2606
2679
|
|
|
2680
|
+
/***/ },
|
|
2681
|
+
|
|
2682
|
+
/***/ "./src/json/index.ts"
|
|
2683
|
+
/*!***************************!*\
|
|
2684
|
+
!*** ./src/json/index.ts ***!
|
|
2685
|
+
\***************************/
|
|
2686
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2687
|
+
|
|
2688
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2689
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2690
|
+
/* harmony export */ parseJson: () => (/* reexport safe */ _parse_json__WEBPACK_IMPORTED_MODULE_0__.parseJson)
|
|
2691
|
+
/* harmony export */ });
|
|
2692
|
+
/* harmony import */ var _parse_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parse-json */ "./src/json/parse-json.ts");
|
|
2693
|
+
|
|
2694
|
+
|
|
2695
|
+
|
|
2696
|
+
/***/ },
|
|
2697
|
+
|
|
2698
|
+
/***/ "./src/json/parse-json.ts"
|
|
2699
|
+
/*!********************************!*\
|
|
2700
|
+
!*** ./src/json/parse-json.ts ***!
|
|
2701
|
+
\********************************/
|
|
2702
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2703
|
+
|
|
2704
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2705
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2706
|
+
/* harmony export */ parseJson: () => (/* binding */ parseJson)
|
|
2707
|
+
/* harmony export */ });
|
|
2708
|
+
const parseJson = (value) => {
|
|
2709
|
+
try {
|
|
2710
|
+
return JSON.parse(value);
|
|
2711
|
+
}
|
|
2712
|
+
catch {
|
|
2713
|
+
return null;
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
|
|
2717
|
+
|
|
2607
2718
|
/***/ },
|
|
2608
2719
|
|
|
2609
2720
|
/***/ "./src/math/hash-string.ts"
|
|
@@ -3592,6 +3703,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3592
3703
|
/* harmony export */ cloneBlob: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.cloneBlob),
|
|
3593
3704
|
/* harmony export */ compact: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.compact),
|
|
3594
3705
|
/* harmony export */ compose: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.compose),
|
|
3706
|
+
/* harmony export */ decodeBase64: () => (/* reexport safe */ _encoding__WEBPACK_IMPORTED_MODULE_18__.decodeBase64),
|
|
3707
|
+
/* harmony export */ decodeBase64Json: () => (/* reexport safe */ _encoding__WEBPACK_IMPORTED_MODULE_18__.decodeBase64Json),
|
|
3595
3708
|
/* harmony export */ definedProps: () => (/* reexport safe */ _object__WEBPACK_IMPORTED_MODULE_12__.definedProps),
|
|
3596
3709
|
/* harmony export */ delay: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_2__.delay),
|
|
3597
3710
|
/* harmony export */ difference: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.difference),
|
|
@@ -3657,6 +3770,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3657
3770
|
/* harmony export */ once: () => (/* reexport safe */ _function__WEBPACK_IMPORTED_MODULE_6__.once),
|
|
3658
3771
|
/* harmony export */ parse2DMatrix: () => (/* reexport safe */ _dom__WEBPACK_IMPORTED_MODULE_3__.parse2DMatrix),
|
|
3659
3772
|
/* harmony export */ parseFileName: () => (/* reexport safe */ _string__WEBPACK_IMPORTED_MODULE_13__.parseFileName),
|
|
3773
|
+
/* harmony export */ parseJson: () => (/* reexport safe */ _json__WEBPACK_IMPORTED_MODULE_17__.parseJson),
|
|
3660
3774
|
/* harmony export */ pipe: () => (/* reexport safe */ _array__WEBPACK_IMPORTED_MODULE_1__.pipe),
|
|
3661
3775
|
/* harmony export */ readFilesFromDataTransfer: () => (/* reexport safe */ _file__WEBPACK_IMPORTED_MODULE_5__.readFilesFromDataTransfer),
|
|
3662
3776
|
/* harmony export */ reduceAsync: () => (/* reexport safe */ _async__WEBPACK_IMPORTED_MODULE_2__.reduceAsync),
|
|
@@ -3692,6 +3806,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3692
3806
|
/* harmony import */ var _tree__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tree */ "./src/tree/index.ts");
|
|
3693
3807
|
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./types */ "./src/types.ts");
|
|
3694
3808
|
/* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./color */ "./src/color/index.ts");
|
|
3809
|
+
/* harmony import */ var _json__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./json */ "./src/json/index.ts");
|
|
3810
|
+
/* harmony import */ var _encoding__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./encoding */ "./src/encoding/index.ts");
|
|
3811
|
+
|
|
3812
|
+
|
|
3695
3813
|
|
|
3696
3814
|
|
|
3697
3815
|
|