@qrvey/utils 1.15.0-32 → 1.15.0-33

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.
@@ -58,7 +58,7 @@ export declare const recalculatePreservingPositions: (elements: VemFixed[], devi
58
58
  * @param canvasDevice - The target device type (e.g., desktop, tablet, mobile).
59
59
  * @returns - The updated responsive element with an adjusted `width`.
60
60
  */
61
- export declare function calculateWidth(element: VemFixed, canvasWidth: number, canvasDevice: CanvasDevice): VemFixed;
61
+ export declare function updateFixedElementWidth(element: VemFixed, canvasWidth: number, canvasDevice: CanvasDevice): VemFixed;
62
62
  /**
63
63
  * @param elements elements to calculate
64
64
  * @param device current device
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortElementsFromReferencePoint = exports.calculateDistancesToReferencePoint = exports.getFixedGridElementsBottomLimit = exports.calculateWidth = exports.recalculatePreservingPositions = exports.findFixedAvailablePositions = exports.getFixedPositionByDevice = exports.findAvailablePosition = exports.updateFixedPosition = void 0;
3
+ exports.sortElementsFromReferencePoint = exports.calculateDistancesToReferencePoint = exports.getFixedGridElementsBottomLimit = exports.updateFixedElementWidth = exports.recalculatePreservingPositions = exports.findFixedAvailablePositions = exports.getFixedPositionByDevice = exports.findAvailablePosition = exports.updateFixedPosition = void 0;
4
4
  /* eslint-disable @typescript-eslint/explicit-function-return-type */
5
5
  const ICanvasGrid_1 = require("../interfaces/ICanvasGrid");
6
6
  const IVemPosition_1 = require("../interfaces/IVemPosition");
@@ -102,7 +102,7 @@ function findFixedAvailablePositions(canvasWidth, newElements, elements, device,
102
102
  const initialY = startWithPositionY
103
103
  ? nElement.position.fixed[device].y
104
104
  : 0;
105
- const newElement = calculateWidth(nElement, canvasWidth, device);
105
+ const newElement = updateFixedElementWidth(nElement, canvasWidth, device);
106
106
  const availablePosition = findAvailablePosition(canvasWidth, newElement, processedElements, device, { initialY, findRightToLeft, canvasHeight });
107
107
  const newElemWithPosition = updateFixedPosition(newElement, availablePosition, device);
108
108
  resultElems.push(newElemWithPosition);
@@ -161,13 +161,13 @@ const getElementsWithKeepPosition = (elements, device, resolution, canvasHeight)
161
161
  * @param canvasDevice - The target device type (e.g., desktop, tablet, mobile).
162
162
  * @returns - The updated responsive element with an adjusted `width`.
163
163
  */
164
- function calculateWidth(element, canvasWidth, canvasDevice) {
164
+ function updateFixedElementWidth(element, canvasWidth, canvasDevice) {
165
165
  const currentPosition = element.position.fixed[canvasDevice];
166
166
  const fixedWidth = Math.min(currentPosition === null || currentPosition === void 0 ? void 0 : currentPosition.width, canvasWidth);
167
167
  const position = Object.assign(Object.assign({}, currentPosition), { width: fixedWidth });
168
168
  return (0, position_1.setElementPosition)(element, IVemPosition_1.VemPositionType.FIXED, canvasDevice, position);
169
169
  }
170
- exports.calculateWidth = calculateWidth;
170
+ exports.updateFixedElementWidth = updateFixedElementWidth;
171
171
  /**
172
172
  * Retrieves the Y-coordinate of a fixed grid element for a specific device.
173
173
  * If `allowNegative` is false (default), the function ensures the Y-coordinate is non-negative.
@@ -1 +1,3 @@
1
1
  export * from "./gridStrategy";
2
+ export { updateFixedElementWidth } from "./fixed";
3
+ export { updateResponsiveElementColSpan } from "./responsive";
@@ -14,4 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.updateResponsiveElementColSpan = exports.updateFixedElementWidth = void 0;
17
18
  __exportStar(require("./gridStrategy"), exports);
19
+ var fixed_1 = require("./fixed");
20
+ Object.defineProperty(exports, "updateFixedElementWidth", { enumerable: true, get: function () { return fixed_1.updateFixedElementWidth; } });
21
+ var responsive_1 = require("./responsive");
22
+ Object.defineProperty(exports, "updateResponsiveElementColSpan", { enumerable: true, get: function () { return responsive_1.updateResponsiveElementColSpan; } });
@@ -37,7 +37,7 @@ export declare function findResponsiveAvailablePositions(canvasWidth: number, ne
37
37
  * @param canvasDevice - The target device type (e.g., desktop, tablet, mobile).
38
38
  * @returns - The updated responsive element with an adjusted `colSpan`.
39
39
  */
40
- export declare function calculateColSpan(element: VemResponsive, canvasWidth: number, canvasDevice: CanvasDevice): VemResponsive;
40
+ export declare function updateResponsiveElementColSpan(element: VemResponsive, canvasWidth: number, canvasDevice: CanvasDevice): VemResponsive;
41
41
  export declare const getResponsiveGridElementsBottomLimit: (elements: VemResponsive[], device: CanvasDevice, rowGap: number) => number;
42
42
  /**
43
43
  * Calculates the distances of elements from a reference point and returns a list of objects
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortResponsiveElements = exports.sortByDistanceInResponsiveFunction = exports.calculateDistancesToReferencePoint = exports.getResponsiveGridElementsBottomLimit = exports.calculateColSpan = exports.findResponsiveAvailablePositions = exports.updateResponsivePosition = exports.findAvailablePosition = void 0;
3
+ exports.sortResponsiveElements = exports.sortByDistanceInResponsiveFunction = exports.calculateDistancesToReferencePoint = exports.getResponsiveGridElementsBottomLimit = exports.updateResponsiveElementColSpan = exports.findResponsiveAvailablePositions = exports.updateResponsivePosition = exports.findAvailablePosition = void 0;
4
4
  const ICanvasGrid_1 = require("../interfaces/ICanvasGrid");
5
5
  const IVemPosition_1 = require("../interfaces/IVemPosition");
6
6
  const overlap_1 = require("../utils/overlap");
@@ -67,7 +67,7 @@ function findResponsiveAvailablePositions(canvasWidth, newElements, elements, de
67
67
  const processedElements = elements.slice();
68
68
  const resultElems = [];
69
69
  newElements.forEach((nElement) => {
70
- const newElement = calculateColSpan(nElement, canvasWidth, device);
70
+ const newElement = updateResponsiveElementColSpan(nElement, canvasWidth, device);
71
71
  const availablePosition = findAvailablePosition(canvasWidth, newElement, processedElements, device);
72
72
  const newElemWithPosition = updateResponsivePosition(newElement, availablePosition, device);
73
73
  resultElems.push(newElemWithPosition);
@@ -83,13 +83,13 @@ exports.findResponsiveAvailablePositions = findResponsiveAvailablePositions;
83
83
  * @param canvasDevice - The target device type (e.g., desktop, tablet, mobile).
84
84
  * @returns - The updated responsive element with an adjusted `colSpan`.
85
85
  */
86
- function calculateColSpan(element, canvasWidth, canvasDevice) {
86
+ function updateResponsiveElementColSpan(element, canvasWidth, canvasDevice) {
87
87
  const currentPosition = element.position.responsive[canvasDevice];
88
88
  const fixedColSpan = Math.min(currentPosition.colSpan, canvasWidth);
89
89
  const position = Object.assign(Object.assign({}, currentPosition), { colSpan: fixedColSpan });
90
90
  return (0, position_1.setElementPosition)(element, IVemPosition_1.VemPositionType.RESPONSIVE, canvasDevice, position);
91
91
  }
92
- exports.calculateColSpan = calculateColSpan;
92
+ exports.updateResponsiveElementColSpan = updateResponsiveElementColSpan;
93
93
  const getResponsiveGridElementsBottomLimit = (elements, device, rowGap) => {
94
94
  if (!elements.length)
95
95
  return 0;
@@ -58,7 +58,7 @@ export declare const recalculatePreservingPositions: (elements: VemFixed[], devi
58
58
  * @param canvasDevice - The target device type (e.g., desktop, tablet, mobile).
59
59
  * @returns - The updated responsive element with an adjusted `width`.
60
60
  */
61
- export declare function calculateWidth(element: VemFixed, canvasWidth: number, canvasDevice: CanvasDevice): VemFixed;
61
+ export declare function updateFixedElementWidth(element: VemFixed, canvasWidth: number, canvasDevice: CanvasDevice): VemFixed;
62
62
  /**
63
63
  * @param elements elements to calculate
64
64
  * @param device current device
@@ -96,7 +96,7 @@ export function findFixedAvailablePositions(canvasWidth, newElements, elements,
96
96
  const initialY = startWithPositionY
97
97
  ? nElement.position.fixed[device].y
98
98
  : 0;
99
- const newElement = calculateWidth(nElement, canvasWidth, device);
99
+ const newElement = updateFixedElementWidth(nElement, canvasWidth, device);
100
100
  const availablePosition = findAvailablePosition(canvasWidth, newElement, processedElements, device, { initialY, findRightToLeft, canvasHeight });
101
101
  const newElemWithPosition = updateFixedPosition(newElement, availablePosition, device);
102
102
  resultElems.push(newElemWithPosition);
@@ -153,7 +153,7 @@ const getElementsWithKeepPosition = (elements, device, resolution, canvasHeight)
153
153
  * @param canvasDevice - The target device type (e.g., desktop, tablet, mobile).
154
154
  * @returns - The updated responsive element with an adjusted `width`.
155
155
  */
156
- export function calculateWidth(element, canvasWidth, canvasDevice) {
156
+ export function updateFixedElementWidth(element, canvasWidth, canvasDevice) {
157
157
  const currentPosition = element.position.fixed[canvasDevice];
158
158
  const fixedWidth = Math.min(currentPosition === null || currentPosition === void 0 ? void 0 : currentPosition.width, canvasWidth);
159
159
  const position = Object.assign(Object.assign({}, currentPosition), { width: fixedWidth });
@@ -1 +1,3 @@
1
1
  export * from "./gridStrategy";
2
+ export { updateFixedElementWidth } from "./fixed";
3
+ export { updateResponsiveElementColSpan } from "./responsive";
@@ -1 +1,3 @@
1
1
  export * from "./gridStrategy";
2
+ export { updateFixedElementWidth } from "./fixed";
3
+ export { updateResponsiveElementColSpan } from "./responsive";
@@ -37,7 +37,7 @@ export declare function findResponsiveAvailablePositions(canvasWidth: number, ne
37
37
  * @param canvasDevice - The target device type (e.g., desktop, tablet, mobile).
38
38
  * @returns - The updated responsive element with an adjusted `colSpan`.
39
39
  */
40
- export declare function calculateColSpan(element: VemResponsive, canvasWidth: number, canvasDevice: CanvasDevice): VemResponsive;
40
+ export declare function updateResponsiveElementColSpan(element: VemResponsive, canvasWidth: number, canvasDevice: CanvasDevice): VemResponsive;
41
41
  export declare const getResponsiveGridElementsBottomLimit: (elements: VemResponsive[], device: CanvasDevice, rowGap: number) => number;
42
42
  /**
43
43
  * Calculates the distances of elements from a reference point and returns a list of objects
@@ -62,7 +62,7 @@ export function findResponsiveAvailablePositions(canvasWidth, newElements, eleme
62
62
  const processedElements = elements.slice();
63
63
  const resultElems = [];
64
64
  newElements.forEach((nElement) => {
65
- const newElement = calculateColSpan(nElement, canvasWidth, device);
65
+ const newElement = updateResponsiveElementColSpan(nElement, canvasWidth, device);
66
66
  const availablePosition = findAvailablePosition(canvasWidth, newElement, processedElements, device);
67
67
  const newElemWithPosition = updateResponsivePosition(newElement, availablePosition, device);
68
68
  resultElems.push(newElemWithPosition);
@@ -77,7 +77,7 @@ export function findResponsiveAvailablePositions(canvasWidth, newElements, eleme
77
77
  * @param canvasDevice - The target device type (e.g., desktop, tablet, mobile).
78
78
  * @returns - The updated responsive element with an adjusted `colSpan`.
79
79
  */
80
- export function calculateColSpan(element, canvasWidth, canvasDevice) {
80
+ export function updateResponsiveElementColSpan(element, canvasWidth, canvasDevice) {
81
81
  const currentPosition = element.position.responsive[canvasDevice];
82
82
  const fixedColSpan = Math.min(currentPosition.colSpan, canvasWidth);
83
83
  const position = Object.assign(Object.assign({}, currentPosition), { colSpan: fixedColSpan });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.15.0-32",
3
+ "version": "1.15.0-33",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",