@react-fabric/utilities 1.0.0-beta.23 → 1.0.0-beta.25
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 +27 -7
- package/dist/cjs/_hash.js +1 -1
- package/dist/cjs/index.js +0 -2
- package/dist/esm/_ascii.js +27 -7
- package/dist/esm/_hash.js +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/types/_isType.d.ts +1 -1
- package/dist/types/index.d.ts +0 -1
- package/package.json +2 -2
- package/src/_ascii.ts +3 -3
- package/src/_hash.ts +1 -1
- package/src/_isType.ts +1 -1
- package/src/index.ts +0 -1
- package/dist/cjs/_cloneElement.js +0 -44
- package/dist/esm/_cloneElement.js +0 -44
- package/dist/types/_cloneElement.d.ts +0 -2
- package/src/_cloneElement.ts +0 -44
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: "Æ|Ǽ",
|
|
@@ -63,12 +86,9 @@ var conversions = {
|
|
|
63
86
|
*/
|
|
64
87
|
var ascii = function ascii(str) {
|
|
65
88
|
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);
|
|
89
|
+
Object.entries(conversions).forEach(function (entry) {
|
|
90
|
+
var re = new RegExp(entry[1], "g");
|
|
91
|
+
str = "".concat(str).replace(re, entry[0]);
|
|
72
92
|
});
|
|
73
93
|
return str;
|
|
74
94
|
};
|
package/dist/cjs/_hash.js
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _ascii = require('./_ascii.js');
|
|
4
4
|
var _boundingBox = require('./_boundingBox.js');
|
|
5
|
-
var _cloneElement = require('./_cloneElement.js');
|
|
6
5
|
var _countries = require('./_countries.js');
|
|
7
6
|
var _debounce = require('./_debounce.js');
|
|
8
7
|
var _dedupe = require('./_dedupe.js');
|
|
@@ -71,7 +70,6 @@ Object.freeze(EMPTY_OBJECT);
|
|
|
71
70
|
exports.ascii = _ascii.ascii;
|
|
72
71
|
exports.getBoundingBox = _boundingBox.getBoundingBox;
|
|
73
72
|
exports.getBox = _boundingBox.getBox;
|
|
74
|
-
exports.cloneChildren = _cloneElement.cloneChildren;
|
|
75
73
|
exports.Countries = _countries;
|
|
76
74
|
exports.debounce = _debounce.debounce;
|
|
77
75
|
exports.dedupe = _dedupe.dedupe;
|
package/dist/esm/_ascii.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
3
|
import { isEmpty } from './_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: "Æ|Ǽ",
|
|
@@ -63,12 +86,9 @@ var conversions = {
|
|
|
63
86
|
*/
|
|
64
87
|
var ascii = function ascii(str) {
|
|
65
88
|
if (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);
|
|
89
|
+
Object.entries(conversions).forEach(function (entry) {
|
|
90
|
+
var re = new RegExp(entry[1], "g");
|
|
91
|
+
str = "".concat(str).replace(re, entry[0]);
|
|
72
92
|
});
|
|
73
93
|
return str;
|
|
74
94
|
};
|
package/dist/esm/_hash.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
export { ascii } from './_ascii.js';
|
|
4
4
|
export { getBoundingBox, getBox } from './_boundingBox.js';
|
|
5
|
-
export { cloneChildren } from './_cloneElement.js';
|
|
6
5
|
export { default as Countries } from './_countries.js';
|
|
7
6
|
export { debounce } from './_debounce.js';
|
|
8
7
|
export { dedupe, flatten, flattenAndDedupe, groupBy } from './_dedupe.js';
|
package/dist/types/_isType.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const isUndefined: (value: AnyObject) => value is undefined;
|
|
2
2
|
export declare const isNull: (value: AnyObject) => value is null;
|
|
3
|
-
export declare const isNil: (val: AnyObject) => val is undefined;
|
|
3
|
+
export declare const isNil: (val: AnyObject) => val is null | undefined;
|
|
4
4
|
export declare const isEmpty: (val: AnyObject) => val is undefined;
|
|
5
5
|
export declare const isObject: (val: AnyObject) => val is KeyValue<any>;
|
|
6
6
|
export declare const isArray: <T = any>(val: AnyObject) => val is T[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from "./_ascii";
|
|
2
2
|
export * from "./_boundingBox";
|
|
3
3
|
export { getBoundingBox, getBox } from "./_boundingBox";
|
|
4
|
-
export * from "./_cloneElement";
|
|
5
4
|
export { default as Countries } from "./_countries";
|
|
6
5
|
export type { Country } from "./_countries";
|
|
7
6
|
export * from "./_debounce";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/utilities",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.25",
|
|
4
4
|
"description": "RUF: Utility package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"node": ">=18.12.0",
|
|
45
45
|
"npm": ">=8.19.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "34640e2473c7823254e82aa7aed920c9c6f8f503"
|
|
48
48
|
}
|
package/src/_ascii.ts
CHANGED
|
@@ -85,9 +85,9 @@ const conversions = {
|
|
|
85
85
|
*/
|
|
86
86
|
export const ascii = (str: string) => {
|
|
87
87
|
if (isEmpty(str)) return "";
|
|
88
|
-
Object.entries(conversions).forEach((
|
|
89
|
-
const re = new RegExp(
|
|
90
|
-
str = `${str}`.replace(re,
|
|
88
|
+
Object.entries(conversions).forEach((entry) => {
|
|
89
|
+
const re = new RegExp(entry[1], "g");
|
|
90
|
+
str = `${str}`.replace(re, entry[0]);
|
|
91
91
|
});
|
|
92
92
|
return str;
|
|
93
93
|
};
|
package/src/_hash.ts
CHANGED
package/src/_isType.ts
CHANGED
|
@@ -29,7 +29,7 @@ export const isNull = (value: AnyObject): value is null => {
|
|
|
29
29
|
return value === null;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export const isNil = (val: AnyObject): val is undefined => {
|
|
32
|
+
export const isNil = (val: AnyObject): val is null | undefined => {
|
|
33
33
|
return val === undefined || val === null;
|
|
34
34
|
};
|
|
35
35
|
export const isEmpty = (val: AnyObject): val is undefined => {
|
package/src/index.ts
CHANGED
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
export * from "./_ascii";
|
|
27
27
|
export * from "./_boundingBox";
|
|
28
28
|
export { getBoundingBox, getBox } from "./_boundingBox";
|
|
29
|
-
export * from "./_cloneElement";
|
|
30
29
|
export { default as Countries } from "./_countries";
|
|
31
30
|
export type { Country } from "./_countries";
|
|
32
31
|
export * from "./_debounce";
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var react = require('react');
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* React Fabric
|
|
8
|
-
* @version: 1.0.0
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* The MIT License (MIT)
|
|
12
|
-
* Copyright (c) 2024 Adarsh Pastakia
|
|
13
|
-
*
|
|
14
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
15
|
-
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
16
|
-
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
17
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
-
* subject to the following conditions:
|
|
19
|
-
*
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
21
|
-
* portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
24
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
25
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
26
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
var cloneChildren = function cloneChildren(children, callback) {
|
|
30
|
-
var _Children$map;
|
|
31
|
-
return (_Children$map = react.Children.map(children, function (c) {
|
|
32
|
-
if ( /*#__PURE__*/react.isValidElement(c)) {
|
|
33
|
-
if (c.type === jsxRuntime.Fragment) {
|
|
34
|
-
var _c$props;
|
|
35
|
-
// just compare to `Fragment`
|
|
36
|
-
return cloneChildren((_c$props = c.props) === null || _c$props === void 0 ? void 0 : _c$props.children, callback);
|
|
37
|
-
}
|
|
38
|
-
return c;
|
|
39
|
-
}
|
|
40
|
-
return c;
|
|
41
|
-
})) === null || _Children$map === void 0 ? void 0 : _Children$map.flat().filter(Boolean).map(callback);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
exports.cloneChildren = cloneChildren;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Children, isValidElement } from 'react';
|
|
4
|
-
import { Fragment } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* React Fabric
|
|
8
|
-
* @version: 1.0.0
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* The MIT License (MIT)
|
|
12
|
-
* Copyright (c) 2024 Adarsh Pastakia
|
|
13
|
-
*
|
|
14
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
15
|
-
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
16
|
-
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
17
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
-
* subject to the following conditions:
|
|
19
|
-
*
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
21
|
-
* portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
24
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
25
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
26
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
var cloneChildren = function cloneChildren(children, callback) {
|
|
30
|
-
var _Children$map;
|
|
31
|
-
return (_Children$map = Children.map(children, function (c) {
|
|
32
|
-
if ( /*#__PURE__*/isValidElement(c)) {
|
|
33
|
-
if (c.type === Fragment) {
|
|
34
|
-
var _c$props;
|
|
35
|
-
// just compare to `Fragment`
|
|
36
|
-
return cloneChildren((_c$props = c.props) === null || _c$props === void 0 ? void 0 : _c$props.children, callback);
|
|
37
|
-
}
|
|
38
|
-
return c;
|
|
39
|
-
}
|
|
40
|
-
return c;
|
|
41
|
-
})) === null || _Children$map === void 0 ? void 0 : _Children$map.flat().filter(Boolean).map(callback);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export { cloneChildren };
|
package/src/_cloneElement.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* React Fabric
|
|
3
|
-
* @version: 1.0.0
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* The MIT License (MIT)
|
|
7
|
-
* Copyright (c) 2024 Adarsh Pastakia
|
|
8
|
-
*
|
|
9
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
10
|
-
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
11
|
-
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
12
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
-
* subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
16
|
-
* portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
-
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
20
|
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
import { type ReactNode, Children, isValidElement } from "react";
|
|
25
|
-
import { Fragment } from "react/jsx-runtime";
|
|
26
|
-
|
|
27
|
-
export const cloneChildren = (
|
|
28
|
-
children: ReactNode,
|
|
29
|
-
callback: (child: ReactNode, index: number) => ReactNode,
|
|
30
|
-
): ReactNode => {
|
|
31
|
-
return Children.map(children, (c: ReactNode) => {
|
|
32
|
-
if (isValidElement(c)) {
|
|
33
|
-
if (c.type === Fragment) {
|
|
34
|
-
// just compare to `Fragment`
|
|
35
|
-
return cloneChildren(c.props?.children, callback);
|
|
36
|
-
}
|
|
37
|
-
return c;
|
|
38
|
-
}
|
|
39
|
-
return c;
|
|
40
|
-
})
|
|
41
|
-
?.flat()
|
|
42
|
-
.filter(Boolean)
|
|
43
|
-
.map(callback);
|
|
44
|
-
};
|