@vnejs/uis.utils 0.1.1 → 0.1.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/uis.utils",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "main": "src/index.js",
5
5
  "scripts": {
6
6
  "publish:major:plugin": "npm run publish:major",
@@ -1,11 +1 @@
1
- import { LENGTH_ARRAY } from "./getHeightArray";
2
-
3
- export const getVneLength = (size) => {
4
- for (let i = 0; i < LENGTH_ARRAY.length; i++) {
5
- const result = LENGTH_ARRAY[LENGTH_ARRAY.length - i - 1];
6
-
7
- if (size % result === 0) return { count: Math.round(size / result), length: result };
8
- }
9
-
10
- return { isEmpty: true };
11
- };
1
+ export const getVneLength = (length) => `round(down, ${length >= 0 ? "min" : "max"}(calc(${length} / 2160 * 100vh), calc(${length} / 3840 * 100vw)), 1px)`;
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "./cn";
2
2
  export * from "./defaults";
3
- export * from "./getHeightArray";
4
3
  export * from "./getVneLength";
@@ -1,23 +0,0 @@
1
- export const HEIGHT = 2160;
2
- export const WIDTH = 3840;
3
- export const HEIGHT_ARRAY = [];
4
- export const WIDTH_ARRAY = [];
5
-
6
- const proccess = (i, value, arr) => {
7
- if (value % i === 0) arr.push(i);
8
- if (value / i < i) {
9
- const maxLength = arr.length;
10
-
11
- arr.forEach((_, j) => arr.push(Math.round(value / arr[maxLength - j - 1])));
12
- arr.push(value);
13
-
14
- return true;
15
- }
16
-
17
- return false;
18
- };
19
-
20
- for (let i = 2; ; i++) if (proccess(i, HEIGHT, HEIGHT_ARRAY)) break;
21
- for (let i = 2; ; i++) if (proccess(i, WIDTH, WIDTH_ARRAY)) break;
22
-
23
- export const LENGTH_ARRAY = [...new Set([...HEIGHT_ARRAY, ...WIDTH_ARRAY]).values()].sort((i, j) => i - j);