@instructure/ui-utils 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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/CHANGELOG.md +13 -0
- package/es/camelize.js +2 -44
- package/es/capitalizeFirstLetter.js +2 -34
- package/es/cloneArray.js +9 -42
- package/es/combineDataCid.js +4 -34
- package/es/convertCase.js +1 -25
- package/es/createChainedFunction.js +26 -75
- package/es/deepEqual.js +1 -25
- package/es/generateId.js +8 -50
- package/es/getBrowser.js +40 -71
- package/es/hash.js +40 -65
- package/es/index.js +1 -24
- package/es/isBaseTheme.js +22 -42
- package/es/isEmpty.js +6 -29
- package/es/mergeDeep.js +48 -74
- package/es/ms.js +12 -53
- package/es/parseUnit.js +7 -48
- package/es/pascalize.js +2 -44
- package/es/px.js +14 -56
- package/es/safeHref.js +64 -96
- package/es/safeLinkProps.js +9 -50
- package/es/shallowEqual.js +22 -72
- package/es/within.js +2 -39
- package/package.json +8 -11
- package/tsconfig.build.json +0 -3
- package/lib/camelize.js +0 -53
- package/lib/capitalizeFirstLetter.js +0 -43
- package/lib/cloneArray.js +0 -52
- package/lib/combineDataCid.js +0 -41
- package/lib/convertCase.js +0 -19
- package/lib/createChainedFunction.js +0 -86
- package/lib/deepEqual.js +0 -38
- package/lib/generateId.js +0 -58
- package/lib/getBrowser.js +0 -85
- package/lib/hash.js +0 -82
- package/lib/index.js +0 -187
- package/lib/isBaseTheme.js +0 -50
- package/lib/isEmpty.js +0 -39
- package/lib/mergeDeep.js +0 -89
- package/lib/ms.js +0 -62
- package/lib/package.json +0 -1
- package/lib/parseUnit.js +0 -57
- package/lib/pascalize.js +0 -55
- package/lib/px.js +0 -68
- package/lib/safeHref.js +0 -115
- package/lib/safeLinkProps.js +0 -59
- package/lib/shallowEqual.js +0 -85
- package/lib/within.js +0 -48
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createChainedFunction = createChainedFunction;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
/*
|
|
9
|
-
* The MIT License (MIT)
|
|
10
|
-
*
|
|
11
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
12
|
-
*
|
|
13
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
-
* in the Software without restriction, including without limitation the rights
|
|
16
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
18
|
-
* furnished to do so, subject to the following conditions:
|
|
19
|
-
*
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
21
|
-
* copies or substantial portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
-
* SOFTWARE.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* ---
|
|
34
|
-
* category: utilities/react
|
|
35
|
-
* ---
|
|
36
|
-
* Safe chained functions
|
|
37
|
-
*
|
|
38
|
-
* Will only create a new function if needed,
|
|
39
|
-
* otherwise will pass back existing functions or null.
|
|
40
|
-
*
|
|
41
|
-
* Forked from: https://github.com/react-bootstrap/react-overlays/blob/master/src/utils/createChainedFunction.js
|
|
42
|
-
* @module createChainedFunction
|
|
43
|
-
* @param funcs Functions to chain. It can be null/undefined
|
|
44
|
-
* @returns the functions chained after each other
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
function createChainedFunction(...funcs) {
|
|
48
|
-
return funcs.filter((f, i) => {
|
|
49
|
-
if (f == null) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
// Only allow the first of identical functions
|
|
53
|
-
const indexes = getAllIndexes(funcs, f);
|
|
54
|
-
return indexes.length === 1 || i === indexes[0];
|
|
55
|
-
}).reduce((acc, f) => {
|
|
56
|
-
if (typeof f !== 'function') {
|
|
57
|
-
throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
|
|
58
|
-
}
|
|
59
|
-
if (acc === null) {
|
|
60
|
-
return f;
|
|
61
|
-
}
|
|
62
|
-
return function chainedFunction(...args) {
|
|
63
|
-
acc.apply(this, args);
|
|
64
|
-
f.apply(this, args);
|
|
65
|
-
};
|
|
66
|
-
// TODO I think it can return null too
|
|
67
|
-
}, null);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Find all indexes for a value in an Array
|
|
72
|
-
*
|
|
73
|
-
* @param {array} arr The Array to search for val
|
|
74
|
-
* @param {*} val The value to find indexes for
|
|
75
|
-
* @return {array} All the indexes of the Array matching val
|
|
76
|
-
*/
|
|
77
|
-
function getAllIndexes(arr, val) {
|
|
78
|
-
const indexes = [];
|
|
79
|
-
arr.forEach((e, i) => {
|
|
80
|
-
if (e === val) {
|
|
81
|
-
indexes.push(i);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
return indexes;
|
|
85
|
-
}
|
|
86
|
-
var _default = exports.default = createChainedFunction;
|
package/lib/deepEqual.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "deepEqual", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _fastDeepEqual.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
exports.default = void 0;
|
|
14
|
-
var _fastDeepEqual = _interopRequireDefault(require("fast-deep-equal"));
|
|
15
|
-
/*
|
|
16
|
-
* The MIT License (MIT)
|
|
17
|
-
*
|
|
18
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
19
|
-
*
|
|
20
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
21
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
22
|
-
* in the Software without restriction, including without limitation the rights
|
|
23
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
24
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
25
|
-
* furnished to do so, subject to the following conditions:
|
|
26
|
-
*
|
|
27
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
28
|
-
* copies or substantial portions of the Software.
|
|
29
|
-
*
|
|
30
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
31
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
32
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
33
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
34
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
35
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
36
|
-
* SOFTWARE.
|
|
37
|
-
*/
|
|
38
|
-
var _default = exports.default = _fastDeepEqual.default;
|
package/lib/generateId.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateId = exports.default = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Generates unique css safe ids for elements.
|
|
33
|
-
*
|
|
34
|
-
* @deprecated Use `useDeterministicId` (function components) or the
|
|
35
|
-
* `withDeterministicId` decorator (class components) from
|
|
36
|
-
* `@instructure/ui-react-utils` instead. Both are backed by React's `useId`, so
|
|
37
|
-
* they produce the same id on the server and the client. This counter-based
|
|
38
|
-
* helper depends on render order: the count advances once per render pass, so a
|
|
39
|
-
* server render and the subsequent client render disagree, and the id changes on
|
|
40
|
-
* every re-render. It is no longer used anywhere in InstUI and will be removed
|
|
41
|
-
* in the next major version.
|
|
42
|
-
*
|
|
43
|
-
* @param instanceName - the name of the element/instance to keep track of
|
|
44
|
-
* @param map - a Map<string, counter>, which counts how many times the given element/instance was rendered
|
|
45
|
-
* @returns a string in a format `instanceName_intanceRenderedCount`: `Alert_4`
|
|
46
|
-
*/
|
|
47
|
-
const generateId = (instanceName, map) => {
|
|
48
|
-
if (!map.has(instanceName)) {
|
|
49
|
-
map.set(instanceName, 0);
|
|
50
|
-
} else {
|
|
51
|
-
map.set(instanceName, map.get(instanceName) + 1);
|
|
52
|
-
}
|
|
53
|
-
// Do not rename '___' to '_' it will cause name clash with InstUI v10.14.0
|
|
54
|
-
// or older
|
|
55
|
-
return `${instanceName}___${map.get(instanceName)}`;
|
|
56
|
-
};
|
|
57
|
-
exports.generateId = generateId;
|
|
58
|
-
var _default = exports.default = generateId;
|
package/lib/getBrowser.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.isSafari = exports.isMac = exports.isIE = exports.isFirefox = exports.isEdge = exports.isChromium = exports.isAndroidOrIOS = exports.getBrowser = void 0;
|
|
8
|
-
var _uaParserJs = _interopRequireDefault(require("ua-parser-js"));
|
|
9
|
-
/*
|
|
10
|
-
* The MIT License (MIT)
|
|
11
|
-
*
|
|
12
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
13
|
-
*
|
|
14
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
* in the Software without restriction, including without limitation the rights
|
|
17
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
19
|
-
* furnished to do so, subject to the following conditions:
|
|
20
|
-
*
|
|
21
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
22
|
-
* copies or substantial portions of the Software.
|
|
23
|
-
*
|
|
24
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
-
* SOFTWARE.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* ---
|
|
35
|
-
* category: utilities/Misc
|
|
36
|
-
* ---
|
|
37
|
-
* A utility module using the 1.x [ua-parser-js](https://www.npmjs.com/package/ua-parser-js)
|
|
38
|
-
* browser detection library.
|
|
39
|
-
*
|
|
40
|
-
* @module getBrowser
|
|
41
|
-
*/
|
|
42
|
-
const getBrowser = () => {
|
|
43
|
-
const parser = new _uaParserJs.default();
|
|
44
|
-
const {
|
|
45
|
-
browser
|
|
46
|
-
} = parser.getResult();
|
|
47
|
-
return browser;
|
|
48
|
-
};
|
|
49
|
-
exports.getBrowser = getBrowser;
|
|
50
|
-
const isSafari = () => {
|
|
51
|
-
return getBrowser().name === 'Safari';
|
|
52
|
-
};
|
|
53
|
-
exports.isSafari = isSafari;
|
|
54
|
-
const isEdge = () => {
|
|
55
|
-
return getBrowser().name === 'Edge';
|
|
56
|
-
};
|
|
57
|
-
exports.isEdge = isEdge;
|
|
58
|
-
const isIE = () => {
|
|
59
|
-
return getBrowser().name === 'IE';
|
|
60
|
-
};
|
|
61
|
-
exports.isIE = isIE;
|
|
62
|
-
const isChromium = () => {
|
|
63
|
-
const chromiumBasedBrowsers = ['Chrome', 'Chromium', 'Opera', 'Edge'];
|
|
64
|
-
return chromiumBasedBrowsers.some(browser => {
|
|
65
|
-
return getBrowser().name?.includes(browser);
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
exports.isChromium = isChromium;
|
|
69
|
-
const isFirefox = () => {
|
|
70
|
-
return getBrowser().name === 'Firefox';
|
|
71
|
-
};
|
|
72
|
-
exports.isFirefox = isFirefox;
|
|
73
|
-
const isAndroidOrIOS = () => {
|
|
74
|
-
const parser = new _uaParserJs.default();
|
|
75
|
-
const result = parser.getResult();
|
|
76
|
-
const device = parser.getDevice();
|
|
77
|
-
return result.os.name === 'Android' || device.model === 'iPhone' || device.model === 'iPad' ? true : false;
|
|
78
|
-
};
|
|
79
|
-
exports.isAndroidOrIOS = isAndroidOrIOS;
|
|
80
|
-
const isMac = () => {
|
|
81
|
-
const parser = new _uaParserJs.default();
|
|
82
|
-
const result = parser.getResult();
|
|
83
|
-
return result.os.name === 'Mac OS';
|
|
84
|
-
};
|
|
85
|
-
exports.isMac = isMac;
|
package/lib/hash.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
exports.hash = hash;
|
|
9
|
-
var _jsonStableStringify = _interopRequireDefault(require("json-stable-stringify"));
|
|
10
|
-
/*
|
|
11
|
-
* The MIT License (MIT)
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
14
|
-
*
|
|
15
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
17
|
-
* in the Software without restriction, including without limitation the rights
|
|
18
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
20
|
-
* furnished to do so, subject to the following conditions:
|
|
21
|
-
*
|
|
22
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
23
|
-
* copies or substantial portions of the Software.
|
|
24
|
-
*
|
|
25
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
-
* SOFTWARE.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
function toBase64(input) {
|
|
35
|
-
const tab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
36
|
-
let output = '';
|
|
37
|
-
const length = input.length;
|
|
38
|
-
let triplet;
|
|
39
|
-
const b64pad = '=';
|
|
40
|
-
for (let i = 0; i < length; i += 3) {
|
|
41
|
-
triplet = input.charCodeAt(i) << 16 | (i + 1 < length ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < length ? input.charCodeAt(i + 2) : 0);
|
|
42
|
-
for (let j = 0; j < 4; j += 1) {
|
|
43
|
-
if (i * 8 + j * 6 > input.length * 8) {
|
|
44
|
-
output += b64pad;
|
|
45
|
-
} else {
|
|
46
|
-
output += tab.charAt(triplet >>> 6 * (3 - j) & 0x3f);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return output;
|
|
51
|
-
}
|
|
52
|
-
function executeHash(input) {
|
|
53
|
-
let hash = 0;
|
|
54
|
-
if (input.length === 0) return '0';
|
|
55
|
-
for (let i = 0; i < input.length; i++) {
|
|
56
|
-
const c = input.charCodeAt(i);
|
|
57
|
-
hash = (hash << 5) - hash + c;
|
|
58
|
-
hash |= 0; // Convert to 32bit integer
|
|
59
|
-
}
|
|
60
|
-
return toBase64(String(hash));
|
|
61
|
-
}
|
|
62
|
-
function hash(value, maxLength = 0) {
|
|
63
|
-
if (typeof value === 'undefined') {
|
|
64
|
-
throw new Error('Cannot hash a value which is undefined');
|
|
65
|
-
}
|
|
66
|
-
let hashedValue = '';
|
|
67
|
-
let valueToHash = value;
|
|
68
|
-
if (typeof value !== 'string') {
|
|
69
|
-
if (typeof value === 'object') {
|
|
70
|
-
// Ensure we are robust to things like objects that are identical, but with keys in diff orders
|
|
71
|
-
valueToHash = (0, _jsonStableStringify.default)(value);
|
|
72
|
-
} else {
|
|
73
|
-
valueToHash = value.toString();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
hashedValue = executeHash(valueToHash);
|
|
77
|
-
if (maxLength) {
|
|
78
|
-
hashedValue = hashedValue.slice(0, maxLength);
|
|
79
|
-
}
|
|
80
|
-
return hashedValue;
|
|
81
|
-
}
|
|
82
|
-
var _default = exports.default = hash;
|
package/lib/index.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "camelize", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _camelize.camelize;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "capitalizeFirstLetter", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _capitalizeFirstLetter.capitalizeFirstLetter;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "cloneArray", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _cloneArray.cloneArray;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "combineDataCid", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _combineDataCid.combineDataCid;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "createChainedFunction", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _createChainedFunction.createChainedFunction;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "deepEqual", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _deepEqual.deepEqual;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "generateId", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _generateId.generateId;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "getBrowser", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _getBrowser.getBrowser;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "hash", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _hash.hash;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "isAndroidOrIOS", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _getBrowser.isAndroidOrIOS;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "isBaseTheme", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return _isBaseTheme.isBaseTheme;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(exports, "isChromium", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return _getBrowser.isChromium;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(exports, "isEdge", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function () {
|
|
81
|
-
return _getBrowser.isEdge;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
Object.defineProperty(exports, "isEmpty", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function () {
|
|
87
|
-
return _isEmpty.isEmpty;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(exports, "isFirefox", {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function () {
|
|
93
|
-
return _getBrowser.isFirefox;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(exports, "isIE", {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
get: function () {
|
|
99
|
-
return _getBrowser.isIE;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
Object.defineProperty(exports, "isMac", {
|
|
103
|
-
enumerable: true,
|
|
104
|
-
get: function () {
|
|
105
|
-
return _getBrowser.isMac;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
Object.defineProperty(exports, "isSafari", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
get: function () {
|
|
111
|
-
return _getBrowser.isSafari;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
Object.defineProperty(exports, "mergeDeep", {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
get: function () {
|
|
117
|
-
return _mergeDeep.mergeDeep;
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(exports, "ms", {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return _ms.ms;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
Object.defineProperty(exports, "parseUnit", {
|
|
127
|
-
enumerable: true,
|
|
128
|
-
get: function () {
|
|
129
|
-
return _parseUnit.parseUnit;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
Object.defineProperty(exports, "pascalize", {
|
|
133
|
-
enumerable: true,
|
|
134
|
-
get: function () {
|
|
135
|
-
return _pascalize.pascalize;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
Object.defineProperty(exports, "px", {
|
|
139
|
-
enumerable: true,
|
|
140
|
-
get: function () {
|
|
141
|
-
return _px.px;
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
Object.defineProperty(exports, "safeHref", {
|
|
145
|
-
enumerable: true,
|
|
146
|
-
get: function () {
|
|
147
|
-
return _safeHref.safeHref;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
Object.defineProperty(exports, "safeLinkProps", {
|
|
151
|
-
enumerable: true,
|
|
152
|
-
get: function () {
|
|
153
|
-
return _safeLinkProps.safeLinkProps;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
Object.defineProperty(exports, "shallowEqual", {
|
|
157
|
-
enumerable: true,
|
|
158
|
-
get: function () {
|
|
159
|
-
return _shallowEqual.shallowEqual;
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
Object.defineProperty(exports, "within", {
|
|
163
|
-
enumerable: true,
|
|
164
|
-
get: function () {
|
|
165
|
-
return _within.within;
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
var _capitalizeFirstLetter = require("./capitalizeFirstLetter.js");
|
|
169
|
-
var _cloneArray = require("./cloneArray.js");
|
|
170
|
-
var _createChainedFunction = require("./createChainedFunction.js");
|
|
171
|
-
var _deepEqual = require("./deepEqual.js");
|
|
172
|
-
var _hash = require("./hash.js");
|
|
173
|
-
var _generateId = require("./generateId.js");
|
|
174
|
-
var _isEmpty = require("./isEmpty.js");
|
|
175
|
-
var _mergeDeep = require("./mergeDeep.js");
|
|
176
|
-
var _ms = require("./ms.js");
|
|
177
|
-
var _parseUnit = require("./parseUnit.js");
|
|
178
|
-
var _px = require("./px.js");
|
|
179
|
-
var _safeHref = require("./safeHref.js");
|
|
180
|
-
var _safeLinkProps = require("./safeLinkProps.js");
|
|
181
|
-
var _shallowEqual = require("./shallowEqual.js");
|
|
182
|
-
var _within = require("./within.js");
|
|
183
|
-
var _camelize = require("./camelize.js");
|
|
184
|
-
var _pascalize = require("./pascalize.js");
|
|
185
|
-
var _isBaseTheme = require("./isBaseTheme.js");
|
|
186
|
-
var _getBrowser = require("./getBrowser.js");
|
|
187
|
-
var _combineDataCid = require("./combineDataCid.js");
|
package/lib/isBaseTheme.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isBaseTheme = exports.default = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const baseThemeProps = ['borders', 'breakpoints', 'colors', 'forms', 'media', 'shadows', 'spacing', 'stacking', 'transitions', 'typography'];
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Checks if the given param is an object with all the keys needed for an
|
|
35
|
-
* Instructure theme.
|
|
36
|
-
* @param theme Anything. This function will throw an error if it's not a theme
|
|
37
|
-
* object.
|
|
38
|
-
*/
|
|
39
|
-
const isBaseTheme = theme => {
|
|
40
|
-
if (Array.isArray(theme) || typeof theme === 'function') {
|
|
41
|
-
throw new Error();
|
|
42
|
-
}
|
|
43
|
-
try {
|
|
44
|
-
return 'key' in theme && baseThemeProps.every(prop => prop in theme);
|
|
45
|
-
} catch {
|
|
46
|
-
throw new Error();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
exports.isBaseTheme = isBaseTheme;
|
|
50
|
-
var _default = exports.default = isBaseTheme;
|
package/lib/isEmpty.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
exports.isEmpty = isEmpty;
|
|
8
|
-
/*
|
|
9
|
-
* The MIT License (MIT)
|
|
10
|
-
*
|
|
11
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
12
|
-
*
|
|
13
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
-
* in the Software without restriction, including without limitation the rights
|
|
16
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
18
|
-
* furnished to do so, subject to the following conditions:
|
|
19
|
-
*
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
21
|
-
* copies or substantial portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
-
* SOFTWARE.
|
|
30
|
-
*/
|
|
31
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
32
|
-
function isEmpty(obj) {
|
|
33
|
-
if (typeof obj !== 'object') return true;
|
|
34
|
-
for (const key in obj) {
|
|
35
|
-
if (hasOwnProperty.call(obj, key)) return false;
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
var _default = exports.default = isEmpty;
|