@uxf/core 11.110.0 → 11.114.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/README.md CHANGED
@@ -420,7 +420,7 @@ if (inArray(status, statuses)) {
420
420
  Re-export of [lodash.isequal](https://lodash.com/docs/#isEqual). Performs a deep comparison between two values to determine if they are equivalent.
421
421
 
422
422
  ```ts
423
- import isEqual from "@uxf/core/utils/is-equal";
423
+ import { isEqual } from "@uxf/core/utils/is-equal";
424
424
 
425
425
  isEqual({ a: 1, b: [2, 3] }, { a: 1, b: [2, 3] }); /* returns true */
426
426
  isEqual({ a: 1 }, { a: 2 }); /* returns false */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/core",
3
- "version": "11.110.0",
3
+ "version": "11.114.0",
4
4
  "description": "UXF Core",
5
5
  "author": "Petr Vejvoda <vejvoda@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/core#readme",
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)", () => {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const deepmerge_1 = require("./deepmerge");
4
+ test("recursively merges two objects", () => {
5
+ const target = { a: 1, b: { x: 10 } };
6
+ const source = { b: { y: 20 }, c: 3 };
7
+ expect((0, deepmerge_1.deepmerge)(target, source)).toEqual({ a: 1, b: { x: 10, y: 20 }, c: 3 });
8
+ });
9
+ test("concatenates arrays", () => {
10
+ expect((0, deepmerge_1.deepmerge)([1, 2], [3, 4])).toEqual([1, 2, 3, 4]);
11
+ });
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-unnecessary-condition,@typescript-eslint/ban-ts-comment */
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 +1 @@
1
- export {} from "lodash.isequal";
1
+ export { default as isEqual } from "lodash.isequal";
package/utils/is-equal.js CHANGED
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isEqual = void 0;
7
+ var lodash_isequal_1 = require("lodash.isequal");
8
+ Object.defineProperty(exports, "isEqual", { enumerable: true, get: function () { return __importDefault(lodash_isequal_1).default; } });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const is_equal_1 = require("./is-equal");
4
+ test("returns true for deeply equal objects", () => {
5
+ expect((0, is_equal_1.isEqual)({ a: 1, b: [2, 3] }, { a: 1, b: [2, 3] })).toBe(true);
6
+ });
7
+ test("returns false for different objects", () => {
8
+ expect((0, is_equal_1.isEqual)({ a: 1 }, { a: 2 })).toBe(false);
9
+ });
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-unnecessary-condition,@typescript-eslint/ban-ts-comment */
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", () => {
@@ -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
@@ -47,7 +47,7 @@ export interface ResizerImageProps {
47
47
  toFormat?: "webp" | "png" | "avif" | string;
48
48
  quality?: number;
49
49
  }
50
- export declare const resizerImageUrl: (source: ImageSource | null | undefined, width?: number | "auto", height?: number | "auto", props?: ResizerImageProps, version?: number) => string | undefined;
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.resizerImageUrl = exports.positionMapper = exports.fitMapper = void 0;
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
- const resizerImageUrl = (source, width = "auto", height = "auto", props = {}, version = 1) => {
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 === "auto" ? "x" : width,
69
- height === "auto" ? "x" : 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
  {