@deot/vc-shared 1.0.7 → 1.0.9
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/dist/index.cjs +17 -2
- package/dist/index.d.ts +14 -1
- package/dist/index.iife.js +17 -2
- package/dist/index.js +17 -2
- package/dist/index.umd.cjs +17 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
+
const IS_SERVER = typeof window === "undefined";
|
|
6
|
+
|
|
5
7
|
const autoCatch = async (impl, options = {}) => {
|
|
6
8
|
const { onError = console.error } = options;
|
|
7
9
|
let target = impl;
|
|
@@ -36,15 +38,28 @@ const toOptions = (args, orders, original) => {
|
|
|
36
38
|
});
|
|
37
39
|
return result;
|
|
38
40
|
};
|
|
41
|
+
const getComputedStyle = (el, SIZING_STYLE) => {
|
|
42
|
+
if (IS_SERVER) return {};
|
|
43
|
+
const style = window.getComputedStyle(el);
|
|
44
|
+
const boxSizing = style.getPropertyValue("box-sizing") || style.getPropertyValue("-moz-box-sizing") || style.getPropertyValue("-webkit-box-sizing");
|
|
45
|
+
const paddingSize = parseFloat(style.getPropertyValue("padding-bottom")) + parseFloat(style.getPropertyValue("padding-top"));
|
|
46
|
+
const borderSize = parseFloat(style.getPropertyValue("border-bottom-width")) + parseFloat(style.getPropertyValue("border-top-width"));
|
|
47
|
+
const sizingStyle = SIZING_STYLE.map((key) => `${key}:${style.getPropertyValue(key)}`).join(";");
|
|
48
|
+
return {
|
|
49
|
+
sizingStyle,
|
|
50
|
+
paddingSize,
|
|
51
|
+
borderSize,
|
|
52
|
+
boxSizing
|
|
53
|
+
};
|
|
54
|
+
};
|
|
39
55
|
|
|
40
56
|
const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
41
57
|
__proto__: null,
|
|
42
58
|
autoCatch,
|
|
43
59
|
eleInRegExp,
|
|
60
|
+
getComputedStyle,
|
|
44
61
|
toOptions
|
|
45
62
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
46
63
|
|
|
47
|
-
const IS_SERVER = typeof window === "undefined";
|
|
48
|
-
|
|
49
64
|
exports.IS_SERVER = IS_SERVER;
|
|
50
65
|
exports.Utils = utils;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,18 @@ declare interface Exceptions {
|
|
|
8
8
|
tagName?: RegExp;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
declare const getComputedStyle_2: (el: HTMLElement, SIZING_STYLE: string[]) => {
|
|
12
|
+
sizingStyle?: undefined;
|
|
13
|
+
paddingSize?: undefined;
|
|
14
|
+
borderSize?: undefined;
|
|
15
|
+
boxSizing?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
sizingStyle: string;
|
|
18
|
+
paddingSize: number;
|
|
19
|
+
borderSize: number;
|
|
20
|
+
boxSizing: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
11
23
|
export declare const IS_SERVER: boolean;
|
|
12
24
|
|
|
13
25
|
declare const toOptions: <T>(args: any[], orders: Array<keyof T>, original?: T) => T;
|
|
@@ -16,7 +28,8 @@ declare namespace Utils {
|
|
|
16
28
|
export {
|
|
17
29
|
autoCatch,
|
|
18
30
|
eleInRegExp,
|
|
19
|
-
toOptions
|
|
31
|
+
toOptions,
|
|
32
|
+
getComputedStyle_2 as getComputedStyle
|
|
20
33
|
}
|
|
21
34
|
}
|
|
22
35
|
export { Utils }
|
package/dist/index.iife.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
var VcShared = (function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
const IS_SERVER = typeof window === "undefined";
|
|
5
|
+
|
|
4
6
|
const autoCatch = async (impl, options = {}) => {
|
|
5
7
|
const { onError = console.error } = options;
|
|
6
8
|
let target = impl;
|
|
@@ -35,16 +37,29 @@ var VcShared = (function (exports) {
|
|
|
35
37
|
});
|
|
36
38
|
return result;
|
|
37
39
|
};
|
|
40
|
+
const getComputedStyle = (el, SIZING_STYLE) => {
|
|
41
|
+
if (IS_SERVER) return {};
|
|
42
|
+
const style = window.getComputedStyle(el);
|
|
43
|
+
const boxSizing = style.getPropertyValue("box-sizing") || style.getPropertyValue("-moz-box-sizing") || style.getPropertyValue("-webkit-box-sizing");
|
|
44
|
+
const paddingSize = parseFloat(style.getPropertyValue("padding-bottom")) + parseFloat(style.getPropertyValue("padding-top"));
|
|
45
|
+
const borderSize = parseFloat(style.getPropertyValue("border-bottom-width")) + parseFloat(style.getPropertyValue("border-top-width"));
|
|
46
|
+
const sizingStyle = SIZING_STYLE.map((key) => `${key}:${style.getPropertyValue(key)}`).join(";");
|
|
47
|
+
return {
|
|
48
|
+
sizingStyle,
|
|
49
|
+
paddingSize,
|
|
50
|
+
borderSize,
|
|
51
|
+
boxSizing
|
|
52
|
+
};
|
|
53
|
+
};
|
|
38
54
|
|
|
39
55
|
const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
40
56
|
__proto__: null,
|
|
41
57
|
autoCatch,
|
|
42
58
|
eleInRegExp,
|
|
59
|
+
getComputedStyle,
|
|
43
60
|
toOptions
|
|
44
61
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
45
62
|
|
|
46
|
-
const IS_SERVER = typeof window === "undefined";
|
|
47
|
-
|
|
48
63
|
exports.IS_SERVER = IS_SERVER;
|
|
49
64
|
exports.Utils = utils;
|
|
50
65
|
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const IS_SERVER = typeof window === "undefined";
|
|
2
|
+
|
|
1
3
|
const autoCatch = async (impl, options = {}) => {
|
|
2
4
|
const { onError = console.error } = options;
|
|
3
5
|
let target = impl;
|
|
@@ -32,14 +34,27 @@ const toOptions = (args, orders, original) => {
|
|
|
32
34
|
});
|
|
33
35
|
return result;
|
|
34
36
|
};
|
|
37
|
+
const getComputedStyle = (el, SIZING_STYLE) => {
|
|
38
|
+
if (IS_SERVER) return {};
|
|
39
|
+
const style = window.getComputedStyle(el);
|
|
40
|
+
const boxSizing = style.getPropertyValue("box-sizing") || style.getPropertyValue("-moz-box-sizing") || style.getPropertyValue("-webkit-box-sizing");
|
|
41
|
+
const paddingSize = parseFloat(style.getPropertyValue("padding-bottom")) + parseFloat(style.getPropertyValue("padding-top"));
|
|
42
|
+
const borderSize = parseFloat(style.getPropertyValue("border-bottom-width")) + parseFloat(style.getPropertyValue("border-top-width"));
|
|
43
|
+
const sizingStyle = SIZING_STYLE.map((key) => `${key}:${style.getPropertyValue(key)}`).join(";");
|
|
44
|
+
return {
|
|
45
|
+
sizingStyle,
|
|
46
|
+
paddingSize,
|
|
47
|
+
borderSize,
|
|
48
|
+
boxSizing
|
|
49
|
+
};
|
|
50
|
+
};
|
|
35
51
|
|
|
36
52
|
const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
37
53
|
__proto__: null,
|
|
38
54
|
autoCatch,
|
|
39
55
|
eleInRegExp,
|
|
56
|
+
getComputedStyle,
|
|
40
57
|
toOptions
|
|
41
58
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
42
59
|
|
|
43
|
-
const IS_SERVER = typeof window === "undefined";
|
|
44
|
-
|
|
45
60
|
export { IS_SERVER, utils as Utils };
|
package/dist/index.umd.cjs
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VcShared = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
+
const IS_SERVER = typeof window === "undefined";
|
|
8
|
+
|
|
7
9
|
const autoCatch = async (impl, options = {}) => {
|
|
8
10
|
const { onError = console.error } = options;
|
|
9
11
|
let target = impl;
|
|
@@ -38,16 +40,29 @@
|
|
|
38
40
|
});
|
|
39
41
|
return result;
|
|
40
42
|
};
|
|
43
|
+
const getComputedStyle = (el, SIZING_STYLE) => {
|
|
44
|
+
if (IS_SERVER) return {};
|
|
45
|
+
const style = window.getComputedStyle(el);
|
|
46
|
+
const boxSizing = style.getPropertyValue("box-sizing") || style.getPropertyValue("-moz-box-sizing") || style.getPropertyValue("-webkit-box-sizing");
|
|
47
|
+
const paddingSize = parseFloat(style.getPropertyValue("padding-bottom")) + parseFloat(style.getPropertyValue("padding-top"));
|
|
48
|
+
const borderSize = parseFloat(style.getPropertyValue("border-bottom-width")) + parseFloat(style.getPropertyValue("border-top-width"));
|
|
49
|
+
const sizingStyle = SIZING_STYLE.map((key) => `${key}:${style.getPropertyValue(key)}`).join(";");
|
|
50
|
+
return {
|
|
51
|
+
sizingStyle,
|
|
52
|
+
paddingSize,
|
|
53
|
+
borderSize,
|
|
54
|
+
boxSizing
|
|
55
|
+
};
|
|
56
|
+
};
|
|
41
57
|
|
|
42
58
|
const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
43
59
|
__proto__: null,
|
|
44
60
|
autoCatch,
|
|
45
61
|
eleInRegExp,
|
|
62
|
+
getComputedStyle,
|
|
46
63
|
toOptions
|
|
47
64
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
48
65
|
|
|
49
|
-
const IS_SERVER = typeof window === "undefined";
|
|
50
|
-
|
|
51
66
|
exports.IS_SERVER = IS_SERVER;
|
|
52
67
|
exports.Utils = utils;
|
|
53
68
|
|