@uxf/core 11.111.2 → 11.123.0
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/package.json +4 -4
- package/utils/cx.test.js +4 -0
- package/utils/cxa.test.js +5 -0
- package/utils/is-empty.test.js +1 -1
- package/utils/is-not-empty.test.js +1 -1
- package/utils/pagination.js +0 -2
- package/utils/resizer.d.ts +1 -1
- package/utils/resizer.js +9 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/core",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.123.0",
|
|
4
4
|
"description": "UXF Core",
|
|
5
5
|
"author": "Petr Vejvoda <vejvoda@uxf.cz>",
|
|
6
6
|
"homepage": "https://gitlab.com/uxf-npm/core#readme",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "tsc -P tsconfig.json",
|
|
20
|
-
"typecheck": "tsc --noEmit
|
|
20
|
+
"typecheck": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@types/lodash.isequal": "4.5.8",
|
|
24
|
-
"@types/qs": "6.15.
|
|
24
|
+
"@types/qs": "6.15.1",
|
|
25
25
|
"deepmerge": "4.3.1",
|
|
26
26
|
"lodash.isequal": "4.5.0",
|
|
27
|
-
"qs": "6.15.
|
|
27
|
+
"qs": "6.15.3",
|
|
28
28
|
"ts-pattern": "5.9.0"
|
|
29
29
|
},
|
|
30
30
|
"bugs": {
|
package/utils/cx.test.js
CHANGED
|
@@ -5,13 +5,17 @@ const cx_1 = require("./cx");
|
|
|
5
5
|
test("strings", () => {
|
|
6
6
|
expect((0, cx_1.cx)("")).toBe("");
|
|
7
7
|
expect((0, cx_1.cx)("foo")).toBe("foo");
|
|
8
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
8
9
|
expect((0, cx_1.cx)(true && "foo")).toBe("foo");
|
|
10
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
9
11
|
expect((0, cx_1.cx)(false && "foo")).toBe("");
|
|
10
12
|
});
|
|
11
13
|
test("strings (variadic)", () => {
|
|
12
14
|
expect((0, cx_1.cx)("")).toBe("");
|
|
13
15
|
expect((0, cx_1.cx)("foo", "bar")).toBe("foo bar");
|
|
16
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
14
17
|
expect((0, cx_1.cx)(true && "foo", false && "bar", "baz")).toBe("foo baz");
|
|
18
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
15
19
|
expect((0, cx_1.cx)(false && "foo", "bar", "baz", "")).toBe("bar baz");
|
|
16
20
|
});
|
|
17
21
|
test("emptys", () => {
|
package/utils/cxa.test.js
CHANGED
|
@@ -5,13 +5,17 @@ const cxa_1 = require("./cxa");
|
|
|
5
5
|
test("strings", () => {
|
|
6
6
|
expect((0, cxa_1.cxa)("")).toBe("");
|
|
7
7
|
expect((0, cxa_1.cxa)("foo")).toBe("foo");
|
|
8
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
8
9
|
expect((0, cxa_1.cxa)(true && "foo")).toBe("foo");
|
|
10
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
9
11
|
expect((0, cxa_1.cxa)(false && "foo")).toBe("");
|
|
10
12
|
});
|
|
11
13
|
test("strings (variadic)", () => {
|
|
12
14
|
expect((0, cxa_1.cxa)("")).toBe("");
|
|
13
15
|
expect((0, cxa_1.cxa)("foo", "bar")).toBe("foo bar");
|
|
16
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
14
17
|
expect((0, cxa_1.cxa)(true && "foo", false && "bar", "baz")).toBe("foo baz");
|
|
18
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
15
19
|
expect((0, cxa_1.cxa)(false && "foo", "bar", "baz", "")).toBe("bar baz");
|
|
16
20
|
});
|
|
17
21
|
test("numbers", () => {
|
|
@@ -44,6 +48,7 @@ test("arrays", () => {
|
|
|
44
48
|
expect((0, cxa_1.cxa)([])).toBe("");
|
|
45
49
|
expect((0, cxa_1.cxa)(["foo"])).toBe("foo");
|
|
46
50
|
expect((0, cxa_1.cxa)(["foo", "bar"])).toBe("foo bar");
|
|
51
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
47
52
|
expect((0, cxa_1.cxa)(["foo", 0 && "bar", 1 && "baz"])).toBe("foo baz");
|
|
48
53
|
});
|
|
49
54
|
test("arrays (nested)", () => {
|
package/utils/is-empty.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const is_empty_1 = require("./is-empty");
|
|
5
5
|
test("is-empty", () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const is_not_empty_1 = require("./is-not-empty");
|
|
5
5
|
test("is-not-empty", () => {
|
package/utils/pagination.js
CHANGED
|
@@ -41,7 +41,6 @@ const paginationGenerate = (config) => {
|
|
|
41
41
|
...(hidePrevButton ? empty_array_1.EMPTY_ARRAY : PREVIOUS),
|
|
42
42
|
...startPages,
|
|
43
43
|
// Start ellipsis
|
|
44
|
-
// eslint-disable-next-line no-nested-ternary
|
|
45
44
|
...(siblingsStart > boundaryCount + 2
|
|
46
45
|
? START_ELLIPSIS
|
|
47
46
|
: boundaryCount + 1 < count - boundaryCount
|
|
@@ -50,7 +49,6 @@ const paginationGenerate = (config) => {
|
|
|
50
49
|
// Sibling pages
|
|
51
50
|
...range(siblingsStart, siblingsEnd),
|
|
52
51
|
// End ellipsis
|
|
53
|
-
// eslint-disable-next-line no-nested-ternary
|
|
54
52
|
...(siblingsEnd < count - boundaryCount - 1
|
|
55
53
|
? END_ELLIPSIS
|
|
56
54
|
: count - boundaryCount > boundaryCount
|
package/utils/resizer.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface ResizerImageProps {
|
|
|
47
47
|
toFormat?: "webp" | "png" | "avif" | string;
|
|
48
48
|
quality?: number;
|
|
49
49
|
}
|
|
50
|
-
export declare
|
|
50
|
+
export declare function resizerImageUrl(source: ImageSource | null | undefined, width?: number | "auto", height?: number | "auto", props?: ResizerImageProps, version?: number): string | undefined;
|
|
51
51
|
export declare function resizerGetDefaultConfig(generatedFilesUrl: string, staticFilesUrl: string): {
|
|
52
52
|
route: string;
|
|
53
53
|
source: string;
|
package/utils/resizer.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.positionMapper = exports.fitMapper = void 0;
|
|
5
|
+
exports.resizerImageUrl = resizerImageUrl;
|
|
5
6
|
exports.resizerGetDefaultConfig = resizerGetDefaultConfig;
|
|
6
7
|
exports.fitMapper = {
|
|
7
8
|
cover: "cv",
|
|
@@ -54,7 +55,10 @@ const resizerStaticImageUrl = (src, width = "auto", height = "auto", props = {},
|
|
|
54
55
|
].join("_");
|
|
55
56
|
return `${CDN_URL}${BASE_PATH}/generated/static/${directory}/${version}${filename}.${extension}.${toFormat !== null && toFormat !== void 0 ? toFormat : extension}`;
|
|
56
57
|
};
|
|
57
|
-
|
|
58
|
+
function getDimension(dimension) {
|
|
59
|
+
return dimension === "auto" ? "x" : dimension;
|
|
60
|
+
}
|
|
61
|
+
function resizerImageUrl(source, width = "auto", height = "auto", props = {}, version = 1) {
|
|
58
62
|
var _a, _b;
|
|
59
63
|
if (source === null || source === undefined || source === "") {
|
|
60
64
|
return undefined;
|
|
@@ -65,8 +69,8 @@ const resizerImageUrl = (source, width = "auto", height = "auto", props = {}, ve
|
|
|
65
69
|
const { fit = "cover", position = "center", toFormat = (_a = props.toFormat) !== null && _a !== void 0 ? _a : source.extension, trim = "not-trim", background = "FFF", } = props;
|
|
66
70
|
const filename = [
|
|
67
71
|
source.uuid,
|
|
68
|
-
width
|
|
69
|
-
height
|
|
72
|
+
getDimension(width),
|
|
73
|
+
getDimension(height),
|
|
70
74
|
exports.fitMapper[fit],
|
|
71
75
|
exports.positionMapper[position],
|
|
72
76
|
background === "transparent" ? backgroundMapper[background] : background,
|
|
@@ -75,8 +79,7 @@ const resizerImageUrl = (source, width = "auto", height = "auto", props = {}, ve
|
|
|
75
79
|
`${source.extension}.${toFormat}`,
|
|
76
80
|
].join("_");
|
|
77
81
|
return `${CDN_URL}${BASE_PATH}/generated/${source.namespace}/${source.uuid.charAt(0)}/${source.uuid.charAt(1)}/${filename}`;
|
|
78
|
-
}
|
|
79
|
-
exports.resizerImageUrl = resizerImageUrl;
|
|
82
|
+
}
|
|
80
83
|
function resizerGetDefaultConfig(generatedFilesUrl, staticFilesUrl) {
|
|
81
84
|
return [
|
|
82
85
|
{
|