@react-fabric/utilities 1.0.0-beta.6 → 1.0.0-beta.61
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/dist/cjs/_ascii.js +34 -9
- package/dist/cjs/_boundingBox.js +16 -4
- package/dist/cjs/_countries.js +61 -2769
- package/dist/cjs/_debounce.js +8 -2
- package/dist/cjs/_dedupe.js +48 -2
- package/dist/cjs/_fetch.js +12 -7
- package/dist/cjs/_fileType.js +16 -0
- package/dist/cjs/_format.js +20 -8
- package/dist/cjs/_getByPath.js +16 -5
- package/dist/cjs/_hash.js +13 -7
- package/dist/cjs/_interpolate.js +18 -2
- package/dist/cjs/_isEqual.js +40 -6
- package/dist/cjs/_isType.js +126 -1
- package/dist/cjs/_lonlat.js +102 -0
- package/dist/cjs/_mergeRefs.js +11 -0
- package/dist/cjs/_tokenize.js +17 -4
- package/dist/cjs/getImageColorset.js +17 -2
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/useLogger.js +9 -1
- package/dist/esm/_ascii.js +34 -9
- package/dist/esm/_boundingBox.js +16 -4
- package/dist/esm/_countries.js +61 -2769
- package/dist/esm/_debounce.js +8 -2
- package/dist/esm/_dedupe.js +48 -2
- package/dist/esm/_fetch.js +12 -7
- package/dist/esm/_fileType.js +16 -0
- package/dist/esm/_format.js +20 -8
- package/dist/esm/_getByPath.js +16 -5
- package/dist/esm/_hash.js +13 -7
- package/dist/esm/_interpolate.js +18 -2
- package/dist/esm/_isEqual.js +41 -7
- package/dist/esm/_isType.js +126 -2
- package/dist/esm/_lonlat.js +100 -0
- package/dist/esm/_mergeRefs.js +11 -0
- package/dist/esm/_tokenize.js +17 -4
- package/dist/esm/getImageColorset.js +17 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/useLogger.js +9 -1
- package/dist/types/_ascii.d.ts +7 -2
- package/dist/types/_boundingBox.d.ts +16 -4
- package/dist/types/_countries.d.ts +87 -60
- package/dist/types/_debounce.d.ts +8 -2
- package/dist/types/_dedupe.d.ts +47 -4
- package/dist/types/_fetch.d.ts +12 -9
- package/dist/types/_fileType.d.ts +16 -0
- package/dist/types/_format.d.ts +84 -13
- package/dist/types/_getByPath.d.ts +15 -4
- package/dist/types/_hash.d.ts +12 -6
- package/dist/types/_interpolate.d.ts +17 -2
- package/dist/types/_isEqual.d.ts +37 -6
- package/dist/types/_isType.d.ts +112 -3
- package/dist/types/_lonlat.d.ts +48 -0
- package/dist/types/_mergeRefs.d.ts +11 -0
- package/dist/types/_tokenize.d.ts +16 -4
- package/dist/types/getImageColorset.d.ts +15 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/useLogger.d.ts +9 -1
- package/package.json +8 -7
- package/src/_ascii.ts +10 -5
- package/src/_boundingBox.ts +16 -4
- package/src/_countries.ts +63 -2986
- package/src/_debounce.ts +8 -2
- package/src/_dedupe.ts +51 -5
- package/src/_fetch.ts +12 -7
- package/src/_fileType.ts +16 -0
- package/src/_format.ts +89 -20
- package/src/_getByPath.ts +18 -7
- package/src/_hash.ts +13 -7
- package/src/_interpolate.ts +17 -2
- package/src/_isEqual.ts +41 -7
- package/src/_isType.ts +116 -2
- package/src/_lonlat.ts +135 -0
- package/src/_mergeRefs.ts +11 -0
- package/src/_tokenize.ts +16 -4
- package/src/getImageColorset.ts +17 -2
- package/src/index.ts +1 -0
- package/src/useLogger.ts +9 -1
package/dist/cjs/_ascii.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
3
|
var _isType = require('./_isType.js');
|
|
5
4
|
|
|
5
|
+
/*
|
|
6
|
+
* React Fabric
|
|
7
|
+
* @version: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* The MIT License (MIT)
|
|
11
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
14
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
15
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
16
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
17
|
+
* subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
20
|
+
* portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
23
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
24
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
25
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
/** ***************** latin-ascii conversions *******************/
|
|
7
30
|
var conversions = {
|
|
8
31
|
AE: "Æ|Ǽ",
|
|
@@ -58,17 +81,19 @@ var conversions = {
|
|
|
58
81
|
};
|
|
59
82
|
|
|
60
83
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
84
|
+
* Converts a string to its ASCII representation by replacing
|
|
85
|
+
* special characters with their ASCII equivalents.
|
|
86
|
+
* This function is useful for normalizing strings for search or display purposes.
|
|
87
|
+
* It replaces characters like "Ä" with "Ae", "ß" with "ss", etc.
|
|
88
|
+
*
|
|
89
|
+
* @param {string} str - The input string to be converted.
|
|
90
|
+
* @returns {string} - The ASCII representation of the input string.
|
|
63
91
|
*/
|
|
64
92
|
var ascii = function ascii(str) {
|
|
65
93
|
if (_isType.isEmpty(str)) return "";
|
|
66
|
-
Object.entries(conversions).forEach(function (
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
l = _ref2[1];
|
|
70
|
-
var re = new RegExp(l, "g");
|
|
71
|
-
str = "".concat(str).replace(re, a);
|
|
94
|
+
Object.entries(conversions).forEach(function (entry) {
|
|
95
|
+
var re = new RegExp(entry[1], "g");
|
|
96
|
+
str = "".concat(str).replace(re, entry[0]);
|
|
72
97
|
});
|
|
73
98
|
return str;
|
|
74
99
|
};
|
package/dist/cjs/_boundingBox.js
CHANGED
|
@@ -18,8 +18,13 @@ var _getBox = function _getBox(box) {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* box
|
|
22
|
-
*
|
|
21
|
+
* Get bounding box from a string or array.
|
|
22
|
+
* The box can be in the format "x,y,w,h" or [x,y,w,h].
|
|
23
|
+
* The box is adjusted to ensure that x and y are non-negative.
|
|
24
|
+
* The width and height are adjusted accordingly.
|
|
25
|
+
*
|
|
26
|
+
* @param box "x,y,w,h" | [x,y,w,h]
|
|
27
|
+
* @returns canvas box [x,y,w,h]
|
|
23
28
|
*/
|
|
24
29
|
var getBox = function getBox() {
|
|
25
30
|
var box = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "0,0,0,0";
|
|
@@ -37,8 +42,15 @@ var getBox = function getBox() {
|
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
/**
|
|
40
|
-
* box
|
|
41
|
-
*
|
|
45
|
+
* Get bounding box from a string or array.
|
|
46
|
+
* The box can be in the format "x1,y1,x2,y2" or [x1,y1,x2,y2].
|
|
47
|
+
* The box is adjusted to ensure that x1 and y1 are non-negative.
|
|
48
|
+
* The width and height are calculated as x2 - x1 and y2 - y1 respectively.
|
|
49
|
+
* If x1 or y1 are negative, they are set to 0 and the width and height are adjusted accordingly.
|
|
50
|
+
* This is useful for ensuring that the bounding box is always within the canvas area.
|
|
51
|
+
*
|
|
52
|
+
* @param box "x1,y1,x2,y2" | [x1,y1,x2,y2]
|
|
53
|
+
* @returns canvas box [x,y,w,h]
|
|
42
54
|
*/
|
|
43
55
|
var getBoundingBox = function getBoundingBox() {
|
|
44
56
|
var box = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "0,0,0,0";
|