@koine/utils 2.0.0-beta.1 → 2.0.0-beta.10
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/Defer.js +23 -18
- package/Defer.mjs +6 -5
- package/Emitter.js +31 -20
- package/Emitter.mjs +13 -16
- package/README.md +6 -1
- package/accentSets.js +129 -37
- package/accentSets.mjs +113 -29
- package/addOrReplaceAtIdx.js +27 -10
- package/addOrReplaceAtIdx.mjs +9 -6
- package/areEqual.js +35 -41
- package/areEqual.mjs +16 -22
- package/arrayOfAll.js +20 -11
- package/arrayOfAll.mjs +1 -6
- package/arraySum.js +20 -9
- package/arraySum.mjs +1 -4
- package/arrayToLookup.js +21 -9
- package/arrayToLookup.mjs +2 -4
- package/buildUrlQueryString.js +32 -29
- package/buildUrlQueryString.mjs +11 -14
- package/capitalize.js +21 -9
- package/capitalize.mjs +3 -5
- package/changeUrlPath.js +23 -17
- package/changeUrlPath.mjs +2 -3
- package/chunkByChunks.js +35 -24
- package/chunkByChunks.mjs +17 -20
- package/chunkBySize.js +21 -8
- package/chunkBySize.mjs +3 -4
- package/clamp.js +19 -6
- package/clamp.mjs +1 -2
- package/clsx.d.ts +4 -1
- package/clsx.js +30 -23
- package/clsx.mjs +12 -14
- package/convertRange.js +20 -7
- package/convertRange.mjs +2 -3
- package/cookie.js +13 -5
- package/cookie.mjs +3 -2
- package/createPalette.js +32 -19
- package/createPalette.mjs +14 -6
- package/debounce.js +27 -21
- package/debounce.mjs +9 -17
- package/debouncePromise.d.ts +14 -4
- package/debouncePromise.js +86 -11
- package/debouncePromise.mjs +69 -3
- package/debounceRaf.js +23 -14
- package/debounceRaf.mjs +5 -10
- package/decode.js +20 -7
- package/decode.mjs +2 -3
- package/encode.js +20 -7
- package/encode.mjs +2 -3
- package/ensureInt.js +20 -9
- package/ensureInt.mjs +1 -4
- package/env.js +1 -1
- package/env.mjs +0 -1
- package/errorToString.js +21 -14
- package/errorToString.mjs +1 -4
- package/findDuplicatedIndexes.js +22 -9
- package/findDuplicatedIndexes.mjs +4 -5
- package/forin.js +20 -7
- package/forin.mjs +2 -3
- package/gbToBytes.js +20 -7
- package/gbToBytes.mjs +1 -2
- package/getEmptyArray.js +25 -16
- package/getEmptyArray.mjs +4 -3
- package/getKeys.js +20 -6
- package/getKeys.mjs +1 -2
- package/getMediaQueryWidthResolvers.js +62 -53
- package/getMediaQueryWidthResolvers.mjs +44 -49
- package/getMediaQueryWidthTailwindScreens.js +36 -18
- package/getMediaQueryWidthTailwindScreens.mjs +18 -14
- package/getNonce.js +20 -10
- package/getNonce.mjs +1 -2
- package/getParamAmong.js +22 -19
- package/getParamAmong.mjs +2 -4
- package/getParamAsInt.js +22 -19
- package/getParamAsInt.mjs +2 -4
- package/getParamAsString.js +21 -16
- package/getParamAsString.mjs +1 -2
- package/getType.js +19 -12
- package/getType.mjs +2 -4
- package/getUrlHashParams.js +20 -13
- package/getUrlHashParams.mjs +2 -4
- package/getUrlHashPathname.js +20 -8
- package/getUrlHashPathname.mjs +1 -3
- package/getUrlPathnameParts.js +23 -23
- package/getUrlPathnameParts.mjs +2 -7
- package/getUrlQueryParams.js +26 -33
- package/getUrlQueryParams.mjs +7 -18
- package/imgEmptyPixel.js +20 -6
- package/imgEmptyPixel.mjs +1 -2
- package/index.d.ts +1 -1
- package/index.js +531 -266
- package/index.mjs +2 -2
- package/invariant.js +24 -12
- package/invariant.mjs +6 -8
- package/isAnyObject.js +21 -12
- package/isAnyObject.mjs +1 -2
- package/isArray.js +21 -12
- package/isArray.mjs +1 -2
- package/isBlob.js +21 -12
- package/isBlob.mjs +1 -2
- package/isBoolean.js +21 -12
- package/isBoolean.mjs +1 -2
- package/isBrowser.js +20 -6
- package/isBrowser.mjs +1 -2
- package/isBrowserNow.js +21 -11
- package/isBrowserNow.mjs +1 -2
- package/isDate.js +21 -12
- package/isDate.mjs +1 -2
- package/isEmptyArray.js +21 -12
- package/isEmptyArray.mjs +1 -2
- package/isEmptyObject.js +21 -12
- package/isEmptyObject.mjs +1 -2
- package/isEmptyString.js +19 -6
- package/isEmptyString.mjs +1 -2
- package/isError.js +21 -12
- package/isError.mjs +1 -2
- package/isExternalUrl.js +24 -18
- package/isExternalUrl.mjs +4 -6
- package/isFile.js +21 -12
- package/isFile.mjs +1 -2
- package/isFloat.js +21 -12
- package/isFloat.mjs +1 -2
- package/isFormData.js +21 -12
- package/isFormData.mjs +1 -2
- package/isFullArray.js +21 -12
- package/isFullArray.mjs +1 -2
- package/isFullObject.js +21 -12
- package/isFullObject.mjs +1 -2
- package/isFullString.js +21 -12
- package/isFullString.mjs +1 -2
- package/isFunction.js +18 -9
- package/isFunction.mjs +1 -2
- package/isInt.js +21 -12
- package/isInt.mjs +1 -2
- package/isMap.js +21 -12
- package/isMap.mjs +1 -2
- package/isNaNValue.js +21 -12
- package/isNaNValue.mjs +1 -2
- package/isNegativeNumber.js +21 -12
- package/isNegativeNumber.mjs +1 -2
- package/isNull.js +21 -12
- package/isNull.mjs +1 -2
- package/isNullOrUndefined.js +23 -13
- package/isNullOrUndefined.mjs +1 -2
- package/isNumber.js +21 -14
- package/isNumber.mjs +1 -2
- package/isObject.js +21 -12
- package/isObject.mjs +1 -2
- package/isObjectLike.js +21 -14
- package/isObjectLike.mjs +1 -2
- package/isOneOf.js +19 -11
- package/isOneOf.mjs +1 -7
- package/isPlainObject.js +22 -15
- package/isPlainObject.mjs +3 -6
- package/isPositiveNumber.js +21 -12
- package/isPositiveNumber.mjs +1 -2
- package/isPrimitive.js +26 -22
- package/isPrimitive.mjs +5 -11
- package/isPromise.js +21 -12
- package/isPromise.mjs +1 -2
- package/isRegExp.js +21 -12
- package/isRegExp.mjs +1 -2
- package/isServer.js +22 -11
- package/isServer.mjs +1 -2
- package/isServerNow.js +21 -11
- package/isServerNow.mjs +1 -2
- package/isSet.js +21 -12
- package/isSet.mjs +1 -2
- package/isString.js +21 -12
- package/isString.mjs +1 -2
- package/isSymbol.js +21 -12
- package/isSymbol.mjs +1 -2
- package/isType.js +22 -17
- package/isType.mjs +3 -5
- package/isUndefined.js +21 -12
- package/isUndefined.mjs +1 -2
- package/isWeakMap.js +21 -12
- package/isWeakMap.mjs +1 -2
- package/isWeakSet.js +21 -12
- package/isWeakSet.mjs +1 -2
- package/kbToBytes.js +20 -7
- package/kbToBytes.mjs +1 -2
- package/location.js +6 -2
- package/location.mjs +3 -1
- package/lowercase.js +20 -9
- package/lowercase.mjs +1 -4
- package/mapListBy.js +21 -10
- package/mapListBy.mjs +2 -5
- package/matchSorter.js +132 -133
- package/matchSorter.mjs +108 -126
- package/mbToBytes.js +20 -7
- package/mbToBytes.mjs +1 -2
- package/mergeObjects.d.ts +1 -1
- package/mergeObjects.js +24 -26
- package/mergeObjects.mjs +12 -15
- package/mergeUrlQueryParams.js +25 -20
- package/mergeUrlQueryParams.mjs +4 -8
- package/moveSortableArrayItemByKey.js +26 -12
- package/moveSortableArrayItemByKey.mjs +8 -8
- package/noop.js +20 -7
- package/noop.mjs +1 -2
- package/normaliseUrl.js +22 -18
- package/normaliseUrl.mjs +1 -3
- package/normaliseUrlPathname.js +22 -17
- package/normaliseUrlPathname.mjs +1 -3
- package/objectOmit.js +21 -9
- package/objectOmit.mjs +3 -5
- package/objectPick.js +22 -9
- package/objectPick.mjs +4 -5
- package/package.json +7 -11
- package/parseCookie.js +29 -26
- package/parseCookie.mjs +11 -15
- package/parseURL.js +23 -10
- package/parseURL.mjs +5 -6
- package/quaranteneProps.js +24 -12
- package/quaranteneProps.mjs +6 -8
- package/randomInt.js +19 -6
- package/randomInt.mjs +1 -2
- package/randomKey.js +21 -8
- package/randomKey.mjs +3 -4
- package/readCookie.js +25 -12
- package/readCookie.mjs +7 -8
- package/removeAccents.js +24 -15
- package/removeAccents.mjs +5 -8
- package/removeCookie.js +26 -17
- package/removeCookie.mjs +6 -5
- package/removeDuplicates.js +1 -1
- package/removeDuplicates.mjs +0 -1
- package/removeDuplicatesByKey.js +24 -12
- package/removeDuplicatesByKey.mjs +5 -7
- package/removeDuplicatesComparing.js +22 -11
- package/removeDuplicatesComparing.mjs +3 -4
- package/removeIndexesFromArray.js +21 -8
- package/removeIndexesFromArray.mjs +3 -4
- package/removeTrailingSlash.js +20 -8
- package/removeTrailingSlash.mjs +1 -3
- package/removeUrlQueryParams.js +27 -20
- package/removeUrlQueryParams.mjs +5 -7
- package/render.js +61 -137
- package/render.mjs +43 -98
- package/roundTo.js +34 -22
- package/roundTo.mjs +15 -17
- package/serializeCookie.js +29 -35
- package/serializeCookie.mjs +9 -15
- package/setCookie.js +37 -31
- package/setCookie.mjs +13 -16
- package/shuffle.js +28 -14
- package/shuffle.mjs +10 -10
- package/slugify.js +33 -25
- package/slugify.mjs +13 -11
- package/split.js +18 -4
- package/swapMap.js +22 -10
- package/swapMap.mjs +3 -5
- package/throttle.d.ts +1 -0
- package/throttle.js +23 -15
- package/throttle.mjs +5 -11
- package/titleCase.js +20 -11
- package/titleCase.mjs +1 -6
- package/toNumber.js +20 -9
- package/toNumber.mjs +1 -2
- package/toRgba.js +22 -10
- package/toRgba.mjs +3 -5
- package/transformToUrlPathname.js +21 -18
- package/transformToUrlPathname.mjs +2 -5
- package/truncate.js +20 -13
- package/truncate.mjs +1 -8
- package/tryUntil.js +26 -15
- package/tryUntil.mjs +7 -10
- package/types.js +4 -1
- package/types.mjs +2 -1
- package/uid.js +21 -13
- package/uid.mjs +3 -5
- package/updateLinkParams.js +21 -14
- package/updateLinkParams.mjs +2 -3
- package/updateUrlQueryParams.js +26 -21
- package/updateUrlQueryParams.mjs +3 -7
- package/uppercase.js +20 -9
- package/uppercase.mjs +1 -4
- package/uuid.js +21 -10
- package/uuid.mjs +2 -5
- package/uuidNumeric.js +20 -7
- package/uuidNumeric.mjs +1 -2
- package/wait.js +20 -9
- package/wait.mjs +1 -4
- package/without.js +2 -3
- package/without.mjs +1 -3
package/getEmptyArray.mjs
CHANGED
|
@@ -5,11 +5,12 @@ import isNumber from "./isNumber";
|
|
|
5
5
|
* skeleton UIs.
|
|
6
6
|
*
|
|
7
7
|
* @category array
|
|
8
|
-
*/
|
|
9
|
-
export function getEmptyArray /* <T extends undefined | null = undefined> */(length) {
|
|
8
|
+
*/ export function getEmptyArray(length) {
|
|
10
9
|
if (!isNumber(length)) {
|
|
11
10
|
length = parseInt(length, 10);
|
|
12
11
|
}
|
|
13
|
-
return Array.from({
|
|
12
|
+
return Array.from({
|
|
13
|
+
length
|
|
14
|
+
});
|
|
14
15
|
}
|
|
15
16
|
export default getEmptyArray;
|
package/getKeys.js
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getKeys = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type safe replacement for `Object.keys(myObject)` to iterate over a record
|
|
6
3
|
* without loosing the key's types in simple `string`s.
|
|
7
4
|
*
|
|
8
5
|
* @category objects
|
|
9
6
|
* @see https://stackoverflow.com/a/59459000/1938970
|
|
10
|
-
*/
|
|
11
|
-
exports
|
|
12
|
-
|
|
7
|
+
*/ "use strict";
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
function _export(target, all) {
|
|
12
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: all[name]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
_export(exports, {
|
|
18
|
+
getKeys: function() {
|
|
19
|
+
return getKeys;
|
|
20
|
+
},
|
|
21
|
+
default: function() {
|
|
22
|
+
return _default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const getKeys = Object.keys;
|
|
26
|
+
const _default = getKeys;
|
package/getKeys.mjs
CHANGED
|
@@ -1,72 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getMediaQueryWidthResolvers: function() {
|
|
13
|
+
return getMediaQueryWidthResolvers;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
5
19
|
function getMediaQueryWidthResolvers(customBreakpoints) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
const breakpoints = {
|
|
21
|
+
xs: 0,
|
|
22
|
+
...customBreakpoints
|
|
23
|
+
};
|
|
24
|
+
const sortedBreakpointsNames = Object.keys(breakpoints).map((key)=>{
|
|
25
|
+
const br = key;
|
|
26
|
+
return [
|
|
27
|
+
br,
|
|
28
|
+
breakpoints[br]
|
|
29
|
+
];
|
|
30
|
+
}).sort((a, b)=>a[1] - b[1]).map((item)=>item[0]);
|
|
31
|
+
const getNextBreakpoint = (breakpoint)=>{
|
|
32
|
+
const index = sortedBreakpointsNames.indexOf(breakpoint);
|
|
15
33
|
return sortedBreakpointsNames[index + 1];
|
|
16
34
|
};
|
|
17
35
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var min = function (br) { return "(min-width: ".concat(breakpoints[br], "px)"); };
|
|
36
|
+
* It behaves the same as `(min-width: ${value}px)`
|
|
37
|
+
* where value is the given breakpoint value.
|
|
38
|
+
* For ease of use this can be used both as a function `min("md")` and as an
|
|
39
|
+
* object literal `min.md`.
|
|
40
|
+
*/ const min = (br)=>`(min-width: ${breakpoints[br]}px)`;
|
|
24
41
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var max = function (br) { return "(max-width: ".concat(breakpoints[br] - 0.02, "px)"); };
|
|
42
|
+
* It behaves the same as `(max-width: ${value}px)`
|
|
43
|
+
* where value is the given breakpoint value.
|
|
44
|
+
* For ease of use this can be used both as a function `max("md")` and as an
|
|
45
|
+
* object literal `max.md`.
|
|
46
|
+
*/ const max = (br)=>`(max-width: ${breakpoints[br] - 0.02}px)`;
|
|
31
47
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var up = min;
|
|
48
|
+
* It behaves the same as `min`
|
|
49
|
+
* @inheritdoc {max}
|
|
50
|
+
*/ const up = min;
|
|
36
51
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var brNext = getNextBreakpoint(br);
|
|
52
|
+
* It behaves similarly to `max` but you will use the "next" breakpoint,
|
|
53
|
+
* specifying CSS that will apply from the given breakpoint and down.
|
|
54
|
+
*/ const down = (br)=>{
|
|
55
|
+
const brNext = getNextBreakpoint(br);
|
|
42
56
|
// TODO: if br does not exists otherwise throw Error
|
|
43
|
-
return brNext &&
|
|
57
|
+
return brNext && `(max-width: ${breakpoints[brNext] - 0.02}px)`;
|
|
44
58
|
};
|
|
45
59
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var between = function (br1, br2) {
|
|
60
|
+
* Media query between the two given breakpoints
|
|
61
|
+
*/ const between = (br1, br2)=>{
|
|
49
62
|
br2 = br2 || getNextBreakpoint(br1);
|
|
50
|
-
return br2
|
|
51
|
-
? "(min-width: ".concat(breakpoints[br1], "px) and (max-width: ").concat(breakpoints[br2] - 0.02, "px)")
|
|
52
|
-
: min(br1);
|
|
63
|
+
return br2 ? `(min-width: ${breakpoints[br1]}px) and (max-width: ${breakpoints[br2] - 0.02}px)` : min(br1);
|
|
53
64
|
};
|
|
54
65
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var brNext = getNextBreakpoint(br);
|
|
66
|
+
* Media query to apply from the given breakpoint until the next, just for its
|
|
67
|
+
* full range
|
|
68
|
+
*/ const only = (br)=>{
|
|
69
|
+
const brNext = getNextBreakpoint(br);
|
|
60
70
|
return brNext ? between(br, brNext) : min(br);
|
|
61
71
|
};
|
|
62
72
|
return {
|
|
63
|
-
max
|
|
64
|
-
min
|
|
65
|
-
down
|
|
66
|
-
up
|
|
67
|
-
between
|
|
68
|
-
only
|
|
73
|
+
max,
|
|
74
|
+
min,
|
|
75
|
+
down,
|
|
76
|
+
up,
|
|
77
|
+
between,
|
|
78
|
+
only
|
|
69
79
|
};
|
|
70
80
|
}
|
|
71
|
-
|
|
72
|
-
exports.default = getMediaQueryWidthResolvers;
|
|
81
|
+
const _default = getMediaQueryWidthResolvers;
|
|
@@ -1,68 +1,63 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
1
|
export function getMediaQueryWidthResolvers(customBreakpoints) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
const breakpoints = {
|
|
3
|
+
xs: 0,
|
|
4
|
+
...customBreakpoints
|
|
5
|
+
};
|
|
6
|
+
const sortedBreakpointsNames = Object.keys(breakpoints).map((key)=>{
|
|
7
|
+
const br = key;
|
|
8
|
+
return [
|
|
9
|
+
br,
|
|
10
|
+
breakpoints[br]
|
|
11
|
+
];
|
|
12
|
+
}).sort((a, b)=>a[1] - b[1]).map((item)=>item[0]);
|
|
13
|
+
const getNextBreakpoint = (breakpoint)=>{
|
|
14
|
+
const index = sortedBreakpointsNames.indexOf(breakpoint);
|
|
12
15
|
return sortedBreakpointsNames[index + 1];
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var min = function (br) { return "(min-width: ".concat(breakpoints[br], "px)"); };
|
|
18
|
+
* It behaves the same as `(min-width: ${value}px)`
|
|
19
|
+
* where value is the given breakpoint value.
|
|
20
|
+
* For ease of use this can be used both as a function `min("md")` and as an
|
|
21
|
+
* object literal `min.md`.
|
|
22
|
+
*/ const min = (br)=>`(min-width: ${breakpoints[br]}px)`;
|
|
21
23
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var max = function (br) { return "(max-width: ".concat(breakpoints[br] - 0.02, "px)"); };
|
|
24
|
+
* It behaves the same as `(max-width: ${value}px)`
|
|
25
|
+
* where value is the given breakpoint value.
|
|
26
|
+
* For ease of use this can be used both as a function `max("md")` and as an
|
|
27
|
+
* object literal `max.md`.
|
|
28
|
+
*/ const max = (br)=>`(max-width: ${breakpoints[br] - 0.02}px)`;
|
|
28
29
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var up = min;
|
|
30
|
+
* It behaves the same as `min`
|
|
31
|
+
* @inheritdoc {max}
|
|
32
|
+
*/ const up = min;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var brNext = getNextBreakpoint(br);
|
|
34
|
+
* It behaves similarly to `max` but you will use the "next" breakpoint,
|
|
35
|
+
* specifying CSS that will apply from the given breakpoint and down.
|
|
36
|
+
*/ const down = (br)=>{
|
|
37
|
+
const brNext = getNextBreakpoint(br);
|
|
39
38
|
// TODO: if br does not exists otherwise throw Error
|
|
40
|
-
return brNext &&
|
|
39
|
+
return brNext && `(max-width: ${breakpoints[brNext] - 0.02}px)`;
|
|
41
40
|
};
|
|
42
41
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var between = function (br1, br2) {
|
|
42
|
+
* Media query between the two given breakpoints
|
|
43
|
+
*/ const between = (br1, br2)=>{
|
|
46
44
|
br2 = br2 || getNextBreakpoint(br1);
|
|
47
|
-
return br2
|
|
48
|
-
? "(min-width: ".concat(breakpoints[br1], "px) and (max-width: ").concat(breakpoints[br2] - 0.02, "px)")
|
|
49
|
-
: min(br1);
|
|
45
|
+
return br2 ? `(min-width: ${breakpoints[br1]}px) and (max-width: ${breakpoints[br2] - 0.02}px)` : min(br1);
|
|
50
46
|
};
|
|
51
47
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var brNext = getNextBreakpoint(br);
|
|
48
|
+
* Media query to apply from the given breakpoint until the next, just for its
|
|
49
|
+
* full range
|
|
50
|
+
*/ const only = (br)=>{
|
|
51
|
+
const brNext = getNextBreakpoint(br);
|
|
57
52
|
return brNext ? between(br, brNext) : min(br);
|
|
58
53
|
};
|
|
59
54
|
return {
|
|
60
|
-
max
|
|
61
|
-
min
|
|
62
|
-
down
|
|
63
|
-
up
|
|
64
|
-
between
|
|
65
|
-
only
|
|
55
|
+
max,
|
|
56
|
+
min,
|
|
57
|
+
down,
|
|
58
|
+
up,
|
|
59
|
+
between,
|
|
60
|
+
only
|
|
66
61
|
};
|
|
67
62
|
}
|
|
68
63
|
export default getMediaQueryWidthResolvers;
|
|
@@ -1,27 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getMediaQueryWidthTailwindScreens: function() {
|
|
13
|
+
return getMediaQueryWidthTailwindScreens;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _getMediaQueryWidthResolvers = require("./getMediaQueryWidthResolvers");
|
|
5
20
|
function getMediaQueryWidthTailwindScreens(breakpoints) {
|
|
6
|
-
|
|
21
|
+
const mqWidthResolvers = (0, _getMediaQueryWidthResolvers.getMediaQueryWidthResolvers)(breakpoints);
|
|
7
22
|
// Object.keys(breakpoints).reduce((screens, br) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for
|
|
23
|
+
const screens = Object.keys(breakpoints).reduce((output, br, idx)=>{
|
|
24
|
+
const brNext = Object.keys(breakpoints)[idx + 1];
|
|
25
|
+
for(const resolverName in mqWidthResolvers){
|
|
11
26
|
// this line is just for typescript..
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
const resolver = resolverName;
|
|
28
|
+
const resolverFn = mqWidthResolvers[resolver];
|
|
29
|
+
const raw = resolverFn(br);
|
|
15
30
|
if (raw) {
|
|
16
31
|
if (resolverName === "min") {
|
|
17
|
-
output[
|
|
32
|
+
output[`@${br}`] = {
|
|
33
|
+
raw
|
|
34
|
+
};
|
|
18
35
|
}
|
|
19
36
|
if (resolverName === "between") {
|
|
20
|
-
if (brNext)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
else {
|
|
24
|
-
output[
|
|
37
|
+
if (brNext) output[`@${resolverName}-${br}_${brNext}`] = {
|
|
38
|
+
raw
|
|
39
|
+
};
|
|
40
|
+
} else {
|
|
41
|
+
output[`@${resolverName}-${br}`] = {
|
|
42
|
+
raw
|
|
43
|
+
};
|
|
25
44
|
}
|
|
26
45
|
}
|
|
27
46
|
}
|
|
@@ -29,5 +48,4 @@ function getMediaQueryWidthTailwindScreens(breakpoints) {
|
|
|
29
48
|
}, {});
|
|
30
49
|
return screens;
|
|
31
50
|
}
|
|
32
|
-
|
|
33
|
-
exports.default = getMediaQueryWidthTailwindScreens;
|
|
51
|
+
const _default = getMediaQueryWidthTailwindScreens;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { getMediaQueryWidthResolvers
|
|
1
|
+
import { getMediaQueryWidthResolvers } from "./getMediaQueryWidthResolvers";
|
|
2
2
|
export function getMediaQueryWidthTailwindScreens(breakpoints) {
|
|
3
|
-
|
|
3
|
+
const mqWidthResolvers = getMediaQueryWidthResolvers(breakpoints);
|
|
4
4
|
// Object.keys(breakpoints).reduce((screens, br) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for
|
|
5
|
+
const screens = Object.keys(breakpoints).reduce((output, br, idx)=>{
|
|
6
|
+
const brNext = Object.keys(breakpoints)[idx + 1];
|
|
7
|
+
for(const resolverName in mqWidthResolvers){
|
|
8
8
|
// this line is just for typescript..
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const resolver = resolverName;
|
|
10
|
+
const resolverFn = mqWidthResolvers[resolver];
|
|
11
|
+
const raw = resolverFn(br);
|
|
12
12
|
if (raw) {
|
|
13
13
|
if (resolverName === "min") {
|
|
14
|
-
output[
|
|
14
|
+
output[`@${br}`] = {
|
|
15
|
+
raw
|
|
16
|
+
};
|
|
15
17
|
}
|
|
16
18
|
if (resolverName === "between") {
|
|
17
|
-
if (brNext)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
else {
|
|
21
|
-
output[
|
|
19
|
+
if (brNext) output[`@${resolverName}-${br}_${brNext}`] = {
|
|
20
|
+
raw
|
|
21
|
+
};
|
|
22
|
+
} else {
|
|
23
|
+
output[`@${resolverName}-${br}`] = {
|
|
24
|
+
raw
|
|
25
|
+
};
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
28
|
}
|
package/getNonce.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getNonce: function() {
|
|
13
|
+
return getNonce;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _isUndefined = require("./isUndefined");
|
|
9
20
|
function getNonce() {
|
|
10
|
-
return (0,
|
|
21
|
+
return (0, _isUndefined.isUndefined)(__webpack_nonce__) ? null : __webpack_nonce__;
|
|
11
22
|
}
|
|
12
|
-
|
|
13
|
-
exports.default = getNonce;
|
|
23
|
+
const _default = getNonce;
|
package/getNonce.mjs
CHANGED
|
@@ -2,8 +2,7 @@ import { isUndefined } from "./isUndefined";
|
|
|
2
2
|
/**
|
|
3
3
|
* @category security
|
|
4
4
|
* @see https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/nonce.ts
|
|
5
|
-
*/
|
|
6
|
-
export function getNonce() {
|
|
5
|
+
*/ export function getNonce() {
|
|
7
6
|
return isUndefined(__webpack_nonce__) ? null : __webpack_nonce__;
|
|
8
7
|
}
|
|
9
8
|
export default getNonce;
|
package/getParamAmong.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getParamAmong: function() {
|
|
13
|
+
return getParamAmong;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _getParamAsString = /*#__PURE__*/ _interop_require_default._(require("./getParamAsString"));
|
|
21
|
+
function getParamAmong(raw, allowedValues = []) {
|
|
22
|
+
const string = (0, _getParamAsString.default)(raw);
|
|
19
23
|
return allowedValues.includes(string) ? string : null;
|
|
20
24
|
}
|
|
21
|
-
|
|
22
|
-
exports.default = getParamAmong;
|
|
25
|
+
const _default = getParamAmong;
|
package/getParamAmong.mjs
CHANGED
|
@@ -8,10 +8,8 @@ import getParamAsString from "./getParamAsString";
|
|
|
8
8
|
*
|
|
9
9
|
* @param {string} [raw] - The _raw_ query parameter
|
|
10
10
|
* @param {string[]} [allowedValues=[]] - The list of values (as strings) that the parameter can have, if not one of them `null` is returned
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
if (allowedValues === void 0) { allowedValues = []; }
|
|
14
|
-
var string = getParamAsString(raw);
|
|
11
|
+
*/ export function getParamAmong(raw, allowedValues = []) {
|
|
12
|
+
const string = getParamAsString(raw);
|
|
15
13
|
return allowedValues.includes(string) ? string : null;
|
|
16
14
|
}
|
|
17
15
|
export default getParamAmong;
|
package/getParamAsInt.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getParamAsInt: function() {
|
|
13
|
+
return getParamAsInt;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _getParamAsString = /*#__PURE__*/ _interop_require_default._(require("./getParamAsString"));
|
|
21
|
+
function getParamAsInt(raw, fallback = null) {
|
|
22
|
+
const string = (0, _getParamAsString.default)(raw);
|
|
19
23
|
if (string) {
|
|
20
24
|
return parseInt(string, 10);
|
|
21
25
|
}
|
|
22
26
|
return fallback;
|
|
23
27
|
}
|
|
24
|
-
|
|
25
|
-
exports.default = getParamAsInt;
|
|
28
|
+
const _default = getParamAsInt;
|
package/getParamAsInt.mjs
CHANGED
|
@@ -8,10 +8,8 @@ import getParamAsString from "./getParamAsString";
|
|
|
8
8
|
*
|
|
9
9
|
* @param {string} [raw] - The _raw_ query parameter
|
|
10
10
|
* @param {number} [fallback] - Fallback number, we return `null` if not provided
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
if (fallback === void 0) { fallback = null; }
|
|
14
|
-
var string = getParamAsString(raw);
|
|
11
|
+
*/ export function getParamAsInt(raw, fallback = null) {
|
|
12
|
+
const string = getParamAsString(raw);
|
|
15
13
|
if (string) {
|
|
16
14
|
return parseInt(string, 10);
|
|
17
15
|
}
|
package/getParamAsString.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getParamAsString: function() {
|
|
13
|
+
return getParamAsString;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _isArray = /*#__PURE__*/ _interop_require_default._(require("./isArray"));
|
|
15
21
|
function getParamAsString(raw) {
|
|
16
|
-
return ((0,
|
|
22
|
+
return ((0, _isArray.default)(raw) ? raw[0] : raw) || "";
|
|
17
23
|
}
|
|
18
|
-
|
|
19
|
-
exports.default = getParamAsString;
|
|
24
|
+
const _default = getParamAsString;
|
package/getParamAsString.mjs
CHANGED
|
@@ -7,8 +7,7 @@ import isArray from "./isArray";
|
|
|
7
7
|
* @category location
|
|
8
8
|
*
|
|
9
9
|
* @param {string} [raw] - The _raw_ query parameter
|
|
10
|
-
*/
|
|
11
|
-
export function getParamAsString(raw) {
|
|
10
|
+
*/ export function getParamAsString(raw) {
|
|
12
11
|
return (isArray(raw) ? raw[0] : raw) || "";
|
|
13
12
|
}
|
|
14
13
|
export default getParamAsString;
|