@react-fabric/utilities 1.0.0-beta.8 → 1.0.1
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/css/boundingBox.js +72 -0
- package/dist/cjs/css/cn.js +39 -0
- package/dist/cjs/css/imageColorset.js +96 -0
- package/dist/cjs/data/countries.js +98 -0
- package/dist/cjs/{_fileType.js → data/fileType.js} +37 -19
- package/dist/cjs/data/format.js +136 -0
- package/dist/cjs/helpers/debounce.js +63 -0
- package/dist/cjs/{useLogger.js → helpers/getLogger.js} +96 -96
- package/dist/cjs/helpers/lonlat.js +99 -0
- package/dist/cjs/index.js +99 -76
- package/dist/cjs/lists/dedupe.js +54 -0
- package/dist/cjs/lists/flatten.js +66 -0
- package/dist/cjs/{_getByPath.js → lists/getByPath.js} +58 -37
- package/dist/cjs/lists/groupBy.js +49 -0
- package/dist/cjs/matchers/compare.js +70 -0
- package/dist/cjs/matchers/isEmpty.js +34 -0
- package/dist/cjs/matchers/isEqual.js +82 -0
- package/dist/cjs/matchers/nullChecks.js +61 -0
- package/dist/cjs/matchers/typeChecks.js +127 -0
- package/dist/cjs/strings/ascii.js +105 -0
- package/dist/cjs/strings/hash.js +75 -0
- package/dist/cjs/strings/interpolate.js +47 -0
- package/dist/cjs/strings/matchString.js +54 -0
- package/dist/cjs/strings/template.js +48 -0
- package/dist/cjs/strings/tokenize.js +83 -0
- package/dist/cjs/utils/mergeRefs.js +56 -0
- package/dist/esm/css/boundingBox.js +71 -0
- package/dist/esm/css/cn.js +39 -0
- package/dist/esm/css/imageColorset.js +96 -0
- package/dist/esm/data/countries.js +98 -0
- package/dist/esm/{_fileType.js → data/fileType.js} +37 -19
- package/dist/esm/data/format.js +138 -0
- package/dist/esm/helpers/debounce.js +63 -0
- package/dist/esm/{useLogger.js → helpers/getLogger.js} +96 -96
- package/dist/esm/helpers/lonlat.js +97 -0
- package/dist/esm/index.js +54 -36
- package/dist/esm/lists/dedupe.js +54 -0
- package/dist/esm/lists/flatten.js +65 -0
- package/dist/esm/{_getByPath.js → lists/getByPath.js} +50 -29
- package/dist/esm/lists/groupBy.js +49 -0
- package/dist/esm/matchers/compare.js +70 -0
- package/dist/esm/matchers/isEmpty.js +34 -0
- package/dist/esm/matchers/isEqual.js +82 -0
- package/dist/esm/matchers/nullChecks.js +58 -0
- package/dist/esm/matchers/typeChecks.js +119 -0
- package/dist/esm/strings/ascii.js +105 -0
- package/dist/esm/strings/hash.js +73 -0
- package/dist/esm/strings/interpolate.js +47 -0
- package/dist/esm/strings/matchString.js +54 -0
- package/dist/esm/strings/template.js +48 -0
- package/dist/esm/strings/tokenize.js +82 -0
- package/dist/esm/utils/mergeRefs.js +56 -0
- package/dist/types/css/boundingBox.d.ts +46 -0
- package/dist/types/css/cn.d.ts +26 -0
- package/dist/types/css/imageColorset.d.ts +37 -0
- package/dist/types/data/countries.d.ts +136 -0
- package/dist/types/{_fileType.d.ts → data/fileType.d.ts} +41 -1
- package/dist/types/data/format.d.ts +122 -0
- package/dist/types/helpers/debounce.d.ts +38 -0
- package/dist/types/helpers/getLogger.d.ts +49 -0
- package/dist/types/helpers/lonlat.d.ts +48 -0
- package/dist/types/index.d.ts +54 -20
- package/dist/types/lists/dedupe.d.ts +36 -0
- package/dist/types/lists/flatten.d.ts +47 -0
- package/dist/types/lists/getByPath.d.ts +45 -0
- package/dist/types/lists/groupBy.d.ts +36 -0
- package/dist/types/matchers/compare.d.ts +38 -0
- package/dist/types/matchers/isEmpty.d.ts +38 -0
- package/dist/types/matchers/isEqual.d.ts +39 -0
- package/dist/types/matchers/nullChecks.d.ts +43 -0
- package/dist/types/matchers/typeChecks.d.ts +107 -0
- package/dist/types/strings/ascii.d.ts +34 -0
- package/dist/types/strings/hash.d.ts +46 -0
- package/dist/types/strings/interpolate.d.ts +34 -0
- package/dist/types/strings/matchString.d.ts +41 -0
- package/dist/types/strings/template.d.ts +35 -0
- package/dist/types/strings/tokenize.d.ts +44 -0
- package/dist/types/utils/mergeRefs.d.ts +36 -0
- package/package.json +13 -11
- package/src/css/boundingBox.ts +80 -0
- package/src/css/cn.ts +32 -0
- package/src/css/imageColorset.ts +97 -0
- package/src/data/countries.ts +126 -0
- package/src/{_fileType.ts → data/fileType.ts} +72 -89
- package/src/data/format.ts +192 -0
- package/src/helpers/debounce.ts +49 -0
- package/src/{useLogger.ts → helpers/getLogger.ts} +52 -101
- package/src/helpers/lonlat.ts +124 -0
- package/src/index.ts +57 -37
- package/src/lists/dedupe.ts +46 -0
- package/src/lists/flatten.ts +56 -0
- package/src/lists/getByPath.ts +122 -0
- package/src/lists/groupBy.ts +47 -0
- package/src/matchers/compare.ts +64 -0
- package/src/matchers/isEmpty.ts +54 -0
- package/src/matchers/isEqual.ts +71 -0
- package/src/matchers/nullChecks.ts +55 -0
- package/src/matchers/typeChecks.ts +146 -0
- package/src/strings/ascii.ts +100 -0
- package/src/strings/hash.ts +68 -0
- package/src/strings/interpolate.ts +42 -0
- package/src/strings/matchString.ts +49 -0
- package/src/strings/template.ts +43 -0
- package/src/strings/tokenize.ts +77 -0
- package/src/utils/mergeRefs.ts +47 -0
- package/src/{yup.ts → utils/yup.ts} +3 -3
- package/dist/cjs/_ascii.js +0 -76
- package/dist/cjs/_boundingBox.js +0 -59
- package/dist/cjs/_countries.js +0 -2805
- package/dist/cjs/_debounce.js +0 -53
- package/dist/cjs/_dedupe.js +0 -63
- package/dist/cjs/_fetch.js +0 -128
- package/dist/cjs/_format.js +0 -118
- package/dist/cjs/_hash.js +0 -67
- package/dist/cjs/_interpolate.js +0 -47
- package/dist/cjs/_isEqual.js +0 -108
- package/dist/cjs/_isType.js +0 -98
- package/dist/cjs/_mergeRefs.js +0 -40
- package/dist/cjs/_tokenize.js +0 -67
- package/dist/cjs/getImageColorset.js +0 -70
- package/dist/esm/_ascii.js +0 -76
- package/dist/esm/_boundingBox.js +0 -58
- package/dist/esm/_countries.js +0 -2805
- package/dist/esm/_debounce.js +0 -53
- package/dist/esm/_dedupe.js +0 -60
- package/dist/esm/_fetch.js +0 -128
- package/dist/esm/_format.js +0 -120
- package/dist/esm/_hash.js +0 -65
- package/dist/esm/_interpolate.js +0 -46
- package/dist/esm/_isEqual.js +0 -106
- package/dist/esm/_isType.js +0 -85
- package/dist/esm/_mergeRefs.js +0 -40
- package/dist/esm/_tokenize.js +0 -66
- package/dist/esm/getImageColorset.js +0 -70
- package/dist/types/_ascii.d.ts +0 -5
- package/dist/types/_boundingBox.d.ts +0 -10
- package/dist/types/_countries.d.ts +0 -85
- package/dist/types/_debounce.d.ts +0 -8
- package/dist/types/_dedupe.d.ts +0 -4
- package/dist/types/_fetch.d.ts +0 -23
- package/dist/types/_format.d.ts +0 -27
- package/dist/types/_getByPath.d.ts +0 -10
- package/dist/types/_hash.d.ts +0 -16
- package/dist/types/_interpolate.d.ts +0 -6
- package/dist/types/_isEqual.d.ts +0 -15
- package/dist/types/_isType.d.ts +0 -14
- package/dist/types/_mergeRefs.d.ts +0 -1
- package/dist/types/_tokenize.d.ts +0 -8
- package/dist/types/getImageColorset.d.ts +0 -1
- package/dist/types/useLogger.d.ts +0 -25
- package/src/_ascii.ts +0 -93
- package/src/_boundingBox.ts +0 -72
- package/src/_countries.ts +0 -3046
- package/src/_debounce.ts +0 -42
- package/src/_dedupe.ts +0 -56
- package/src/_fetch.ts +0 -109
- package/src/_format.ts +0 -141
- package/src/_getByPath.ts +0 -108
- package/src/_hash.ts +0 -62
- package/src/_interpolate.ts +0 -42
- package/src/_isEqual.ts +0 -102
- package/src/_isType.ts +0 -105
- package/src/_mergeRefs.ts +0 -33
- package/src/_tokenize.ts +0 -69
- package/src/getImageColorset.ts +0 -81
- /package/dist/cjs/{yup.js → utils/yup.js} +0 -0
- /package/dist/esm/{yup.js → utils/yup.js} +0 -0
- /package/dist/types/{yup.d.ts → utils/yup.d.ts} +0 -0
package/dist/cjs/_mergeRefs.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* React Fabric
|
|
5
|
-
* @version: 1.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
* Copyright (c) 2024 Adarsh Pastakia
|
|
10
|
-
*
|
|
11
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
12
|
-
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
13
|
-
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
14
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
15
|
-
* subject to the following conditions:
|
|
16
|
-
*
|
|
17
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
18
|
-
* portions of the Software.
|
|
19
|
-
*
|
|
20
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
21
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
22
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/* istanbul ignore file */
|
|
27
|
-
|
|
28
|
-
var mergeRefs = function mergeRefs() {
|
|
29
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
|
-
refs[_key] = arguments[_key];
|
|
31
|
-
}
|
|
32
|
-
return function (el) {
|
|
33
|
-
refs.forEach(function (ref) {
|
|
34
|
-
if (typeof ref === "function") ref(el);
|
|
35
|
-
if (ref && "current" in ref) ref.current = el;
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
exports.mergeRefs = mergeRefs;
|
package/dist/cjs/_tokenize.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _isType = require('./_isType.js');
|
|
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
|
-
|
|
29
|
-
/**
|
|
30
|
-
* split text into array of tokens by word boundaries
|
|
31
|
-
* @param str
|
|
32
|
-
* @param keywords
|
|
33
|
-
* @internal
|
|
34
|
-
*/
|
|
35
|
-
var tokenize = function tokenize(str, keywords) {
|
|
36
|
-
if (_isType.isEmpty(keywords)) {
|
|
37
|
-
return [[str, ""]];
|
|
38
|
-
}
|
|
39
|
-
var keys = _isType.isArray(keywords) ? keywords : [keywords];
|
|
40
|
-
var keyMap = keys.map(function (key) {
|
|
41
|
-
// escape regex control characters
|
|
42
|
-
var escapedKey = key.replace(/([+*.?^$()[\]\\!&|\-=])/gm, "\\$1");
|
|
43
|
-
// place token within word boundaries if start/end with alpha-numeric
|
|
44
|
-
if (key.match(/^[a-z0-9]/i) != null) escapedKey = "\\b".concat(escapedKey);
|
|
45
|
-
if (key.match(/[a-z0-9]$/i) != null) escapedKey = "".concat(escapedKey, "\\b");
|
|
46
|
-
return escapedKey;
|
|
47
|
-
});
|
|
48
|
-
var regx = new RegExp("(".concat(keyMap.join("|"), ")"), "img");
|
|
49
|
-
var match;
|
|
50
|
-
var lastIndex = 0;
|
|
51
|
-
var tokens = [];
|
|
52
|
-
while ((match = regx.exec(str)) !== null) {
|
|
53
|
-
tokens.push([str.substring(lastIndex, match.index), str.substring(match.index, regx.lastIndex)]);
|
|
54
|
-
lastIndex = regx.lastIndex;
|
|
55
|
-
}
|
|
56
|
-
tokens.push([str.substring(lastIndex), ""]);
|
|
57
|
-
return tokens;
|
|
58
|
-
};
|
|
59
|
-
var iconToken = function iconToken(str) {
|
|
60
|
-
var split = str.trim().split(" ");
|
|
61
|
-
var first = split[0];
|
|
62
|
-
var last = split.length > 1 && split.pop();
|
|
63
|
-
return (first && last ? "".concat(first.charAt(0)).concat(last.charAt(0)) : "".concat(first.substring(0, 2))).toUpperCase();
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
exports.iconToken = iconToken;
|
|
67
|
-
exports.tokenize = tokenize;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* React Fabric
|
|
5
|
-
* @version: 1.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
* Copyright (c) 2024 Adarsh Pastakia
|
|
10
|
-
*
|
|
11
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
12
|
-
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
13
|
-
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
14
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
15
|
-
* subject to the following conditions:
|
|
16
|
-
*
|
|
17
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
18
|
-
* portions of the Software.
|
|
19
|
-
*
|
|
20
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
21
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
22
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/* istanbul ignore file */
|
|
27
|
-
|
|
28
|
-
var getImageColorset = function getImageColorset(el) {
|
|
29
|
-
// create canvas
|
|
30
|
-
var canvas = document.createElement("canvas");
|
|
31
|
-
canvas.width = Math.min(500, el.naturalWidth);
|
|
32
|
-
canvas.height = Math.min(500, el.naturalHeight);
|
|
33
|
-
var ctx = canvas.getContext("2d");
|
|
34
|
-
if (ctx != null) {
|
|
35
|
-
ctx.drawImage(el, 0, 0, el.naturalWidth, el.naturalHeight, 0, 0, canvas.width, canvas.height);
|
|
36
|
-
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
37
|
-
var data = imageData.data;
|
|
38
|
-
var r, g, b;
|
|
39
|
-
var dark = 0;
|
|
40
|
-
var light = 0;
|
|
41
|
-
var totalPixels = 0;
|
|
42
|
-
var transparent = (data === null || data === void 0 ? void 0 : data[3]) === 0;
|
|
43
|
-
for (var x = 0, len = data.length; x < len; x += 4) {
|
|
44
|
-
if (data[x + 3] === 0) {
|
|
45
|
-
transparent = true;
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (transparent && data[x - 1] === 1) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
r = data[x];
|
|
52
|
-
g = data[x + 1];
|
|
53
|
-
b = data[x + 2];
|
|
54
|
-
totalPixels++;
|
|
55
|
-
0.2126 * r + 0.7152 * g + 0.0722 * b < 128 ? dark++ : light++;
|
|
56
|
-
}
|
|
57
|
-
var diff = light / totalPixels - dark / totalPixels;
|
|
58
|
-
var ret = diff > 0 ? "light" : "dark";
|
|
59
|
-
if (transparent) {
|
|
60
|
-
ret += "_transparent";
|
|
61
|
-
}
|
|
62
|
-
return ret;
|
|
63
|
-
}
|
|
64
|
-
return "light";
|
|
65
|
-
};
|
|
66
|
-
if (typeof window !== "undefined")
|
|
67
|
-
// @ts-expect-error ignore
|
|
68
|
-
window.getImageColorset = getImageColorset;
|
|
69
|
-
|
|
70
|
-
exports.getImageColorset = getImageColorset;
|
package/dist/esm/_ascii.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
-
import { isEmpty } from './_isType.js';
|
|
5
|
-
|
|
6
|
-
/** ***************** latin-ascii conversions *******************/
|
|
7
|
-
var conversions = {
|
|
8
|
-
AE: "Æ|Ǽ",
|
|
9
|
-
Ae: "Ä",
|
|
10
|
-
ae: "ä|æ|ǽ",
|
|
11
|
-
OE: "Œ",
|
|
12
|
-
Oe: "Ö",
|
|
13
|
-
oe: "ö|œ",
|
|
14
|
-
Ue: "Ü",
|
|
15
|
-
ue: "ü",
|
|
16
|
-
IJ: "IJ",
|
|
17
|
-
ij: "ij",
|
|
18
|
-
ss: "ß",
|
|
19
|
-
A: "À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ",
|
|
20
|
-
a: "à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª",
|
|
21
|
-
C: "Ç|Ć|Ĉ|Ċ|Č",
|
|
22
|
-
c: "ç|ć|ĉ|ċ|č",
|
|
23
|
-
D: "Ð|Ď|Đ",
|
|
24
|
-
d: "ð|ď|đ",
|
|
25
|
-
E: "È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě",
|
|
26
|
-
e: "è|é|ê|ë|ē|ĕ|ė|ę|ě",
|
|
27
|
-
G: "Ĝ|Ğ|Ġ|Ģ",
|
|
28
|
-
g: "ĝ|ğ|ġ|ģ",
|
|
29
|
-
H: "Ĥ|Ħ",
|
|
30
|
-
h: "ĥ|ħ",
|
|
31
|
-
I: "Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ",
|
|
32
|
-
i: "ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı",
|
|
33
|
-
J: "Ĵ",
|
|
34
|
-
j: "ĵ",
|
|
35
|
-
K: "Ķ",
|
|
36
|
-
k: "ķ",
|
|
37
|
-
L: "Ĺ|Ļ|Ľ|Ŀ|Ł",
|
|
38
|
-
l: "ĺ|ļ|ľ|ŀ|ł",
|
|
39
|
-
N: "Ñ|Ń|Ņ|Ň",
|
|
40
|
-
n: "ñ|ń|ņ|ň|ʼn",
|
|
41
|
-
O: "Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ",
|
|
42
|
-
o: "ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º",
|
|
43
|
-
R: "Ŕ|Ŗ|Ř",
|
|
44
|
-
r: "ŕ|ŗ|ř",
|
|
45
|
-
S: "Ś|Ŝ|Ş|Š",
|
|
46
|
-
s: "ś|ŝ|ş|š|ſ",
|
|
47
|
-
T: "Ţ|Ť|Ŧ",
|
|
48
|
-
t: "ţ|ť|ŧ",
|
|
49
|
-
U: "Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ",
|
|
50
|
-
u: "ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ",
|
|
51
|
-
Y: "Ý|Ÿ|Ŷ",
|
|
52
|
-
y: "ý|ÿ|ŷ",
|
|
53
|
-
W: "Ŵ",
|
|
54
|
-
w: "ŵ",
|
|
55
|
-
Z: "Ź|Ż|Ž",
|
|
56
|
-
z: "ź|ż|ž",
|
|
57
|
-
f: "ƒ"
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* latin to ascii converter for convenient searching
|
|
62
|
-
* @internal
|
|
63
|
-
*/
|
|
64
|
-
var ascii = function ascii(str) {
|
|
65
|
-
if (isEmpty(str)) return "";
|
|
66
|
-
Object.entries(conversions).forEach(function (_ref) {
|
|
67
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
68
|
-
a = _ref2[0],
|
|
69
|
-
l = _ref2[1];
|
|
70
|
-
var re = new RegExp(l, "g");
|
|
71
|
-
str = "".concat(str).replace(re, a);
|
|
72
|
-
});
|
|
73
|
-
return str;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export { ascii };
|
package/dist/esm/_boundingBox.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
-
import { isEmpty } from './_isType.js';
|
|
5
|
-
|
|
6
|
-
var _getBox = function _getBox(box) {
|
|
7
|
-
var boundingBox = box;
|
|
8
|
-
if (isEmpty(box)) return [0, 0, 0, 0];
|
|
9
|
-
if (typeof box === "string") {
|
|
10
|
-
boundingBox = box.split(",");
|
|
11
|
-
}
|
|
12
|
-
if (Array.isArray(boundingBox)) {
|
|
13
|
-
boundingBox = boundingBox.map(function (b) {
|
|
14
|
-
return parseInt(b, 10);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return boundingBox;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* box "x,y,w,h" | [x,y,w,h]
|
|
22
|
-
* returns canvas box [x,y,w,h]
|
|
23
|
-
*/
|
|
24
|
-
var getBox = function getBox() {
|
|
25
|
-
var box = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "0,0,0,0";
|
|
26
|
-
var boundingBox = _getBox(box);
|
|
27
|
-
var _boundingBox = _slicedToArray(boundingBox, 4),
|
|
28
|
-
x = _boundingBox[0],
|
|
29
|
-
y = _boundingBox[1],
|
|
30
|
-
w = _boundingBox[2],
|
|
31
|
-
h = _boundingBox[3];
|
|
32
|
-
w = x < 0 ? w + x : w;
|
|
33
|
-
h = y < 0 ? h + y : h;
|
|
34
|
-
x = x > 0 ? x : 0;
|
|
35
|
-
y = y > 0 ? y : 0;
|
|
36
|
-
return [x, y, w, h];
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* box "x1,y1,x2,y2" | [x1,y1,x2,y2]
|
|
41
|
-
* returns canvas box [x,y,w,h]
|
|
42
|
-
*/
|
|
43
|
-
var getBoundingBox = function getBoundingBox() {
|
|
44
|
-
var box = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "0,0,0,0";
|
|
45
|
-
var boundingBox = _getBox(box);
|
|
46
|
-
var _boundingBox2 = _slicedToArray(boundingBox, 4),
|
|
47
|
-
x1 = _boundingBox2[0],
|
|
48
|
-
y1 = _boundingBox2[1],
|
|
49
|
-
x2 = _boundingBox2[2],
|
|
50
|
-
y2 = _boundingBox2[3];
|
|
51
|
-
var w = x2 - x1;
|
|
52
|
-
var h = y2 - y1;
|
|
53
|
-
x1 = x1 > 0 ? x1 : 0;
|
|
54
|
-
y1 = y1 > 0 ? y1 : 0;
|
|
55
|
-
return [x1, y1, w, h];
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export { getBoundingBox, getBox };
|