@v-c/util 0.0.13 → 0.0.15

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.
Files changed (112) hide show
  1. package/dist/Children/isFragment.cjs +2 -4
  2. package/dist/Children/isFragment.js +3 -5
  3. package/dist/Children/toArray.cjs +10 -17
  4. package/dist/Children/toArray.js +10 -17
  5. package/dist/Dom/addEventListener.cjs +5 -10
  6. package/dist/Dom/addEventListener.js +6 -11
  7. package/dist/Dom/canUseDom.cjs +2 -3
  8. package/dist/Dom/canUseDom.js +2 -4
  9. package/dist/Dom/class.cjs +6 -20
  10. package/dist/Dom/class.js +7 -23
  11. package/dist/Dom/contains.cjs +9 -13
  12. package/dist/Dom/contains.js +9 -14
  13. package/dist/Dom/css.cjs +51 -66
  14. package/dist/Dom/css.js +52 -74
  15. package/dist/Dom/dynamicCSS.cjs +59 -86
  16. package/dist/Dom/dynamicCSS.js +58 -88
  17. package/dist/Dom/findDOMNode.cjs +7 -10
  18. package/dist/Dom/findDOMNode.js +6 -11
  19. package/dist/Dom/focus.cjs +36 -43
  20. package/dist/Dom/focus.js +37 -48
  21. package/dist/Dom/isVisible.cjs +16 -21
  22. package/dist/Dom/isVisible.js +15 -21
  23. package/dist/Dom/scrollLocker.cjs +66 -88
  24. package/dist/Dom/scrollLocker.js +64 -87
  25. package/dist/Dom/shadow.cjs +3 -5
  26. package/dist/Dom/shadow.js +4 -7
  27. package/dist/Dom/styleChecker.cjs +14 -18
  28. package/dist/Dom/styleChecker.js +14 -18
  29. package/dist/Dom/support.cjs +14 -22
  30. package/dist/Dom/support.js +12 -21
  31. package/dist/EventInterface.cjs +0 -1
  32. package/dist/EventInterface.js +0 -1
  33. package/dist/KeyCode.cjs +165 -522
  34. package/dist/KeyCode.js +164 -522
  35. package/dist/Portal.cjs +40 -46
  36. package/dist/Portal.js +37 -45
  37. package/dist/PortalWrapper.cjs +130 -164
  38. package/dist/PortalWrapper.js +126 -163
  39. package/dist/classnames.cjs +30 -38
  40. package/dist/classnames.js +30 -40
  41. package/dist/composeProps.cjs +15 -17
  42. package/dist/composeProps.js +14 -17
  43. package/dist/createRef.cjs +14 -16
  44. package/dist/createRef.js +13 -18
  45. package/dist/debug/diff.cjs +39 -45
  46. package/dist/debug/diff.js +39 -46
  47. package/dist/deprecated.cjs +2 -7
  48. package/dist/deprecated.js +2 -8
  49. package/dist/getScrollBarSize.cjs +39 -43
  50. package/dist/getScrollBarSize.js +39 -45
  51. package/dist/guid.cjs +3 -4
  52. package/dist/guid.js +3 -5
  53. package/dist/hooks/useEvent.cjs +2 -3
  54. package/dist/hooks/useEvent.js +2 -4
  55. package/dist/hooks/useId.cjs +10 -15
  56. package/dist/hooks/useId.js +9 -15
  57. package/dist/hooks/useLayoutEffect.cjs +29 -52
  58. package/dist/hooks/useLayoutEffect.js +30 -54
  59. package/dist/hooks/useMemo.cjs +9 -13
  60. package/dist/hooks/useMemo.js +8 -13
  61. package/dist/hooks/useMergedState.cjs +22 -27
  62. package/dist/hooks/useMergedState.js +22 -28
  63. package/dist/hooks/useMobile.cjs +13 -13
  64. package/dist/hooks/useMobile.js +12 -14
  65. package/dist/hooks/useState.cjs +7 -9
  66. package/dist/hooks/useState.js +6 -9
  67. package/dist/index.cjs +9 -11
  68. package/dist/index.js +5 -11
  69. package/dist/isEqual.cjs +26 -34
  70. package/dist/isEqual.js +25 -34
  71. package/dist/isMobile.cjs +6 -12
  72. package/dist/isMobile.js +5 -12
  73. package/dist/isValid.cjs +4 -4
  74. package/dist/isValid.js +3 -4
  75. package/dist/omit.cjs +6 -9
  76. package/dist/omit.js +6 -10
  77. package/dist/pickAttrs.cjs +20 -36
  78. package/dist/pickAttrs.js +20 -37
  79. package/dist/props-util/index.cjs +35 -52
  80. package/dist/props-util/index.js +35 -57
  81. package/dist/raf.cjs +34 -37
  82. package/dist/raf.js +33 -38
  83. package/dist/setStyle.cjs +14 -15
  84. package/dist/setStyle.js +13 -15
  85. package/dist/switchScrollingEffect.cjs +29 -35
  86. package/dist/switchScrollingEffect.js +27 -34
  87. package/dist/test/domHook.cjs +32 -46
  88. package/dist/test/domHook.js +33 -48
  89. package/dist/type.cjs +36 -17
  90. package/dist/type.d.ts +1 -1
  91. package/dist/type.js +38 -30
  92. package/dist/utils/checkSlotProp.cjs +6 -10
  93. package/dist/utils/checkSlotProp.js +7 -11
  94. package/dist/utils/get.cjs +7 -9
  95. package/dist/utils/get.js +7 -10
  96. package/dist/utils/omit.cjs +5 -7
  97. package/dist/utils/omit.js +6 -8
  98. package/dist/utils/set.cjs +37 -51
  99. package/dist/utils/set.js +36 -53
  100. package/dist/utils/transition.cjs +76 -80
  101. package/dist/utils/transition.d.ts +2 -2
  102. package/dist/utils/transition.js +76 -84
  103. package/dist/utils/watchState.cjs +12 -14
  104. package/dist/utils/watchState.js +13 -16
  105. package/dist/vnode.cjs +48 -39
  106. package/dist/vnode.d.ts +1 -0
  107. package/dist/vnode.js +47 -43
  108. package/dist/vueuse/unref-element.cjs +3 -5
  109. package/dist/vueuse/unref-element.js +3 -5
  110. package/dist/warning.cjs +21 -29
  111. package/dist/warning.js +20 -36
  112. package/package.json +1 -1
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("vue");
1
+ let vue = require("vue");
4
2
  function isFragment(node) {
5
- return vue.isVNode(node) && node.type === vue.Fragment;
3
+ return (0, vue.isVNode)(node) && node.type === vue.Fragment;
6
4
  }
7
5
  exports.isFragment = isFragment;
@@ -1,7 +1,5 @@
1
- import { isVNode, Fragment } from "vue";
1
+ import { Fragment, isVNode } from "vue";
2
2
  function isFragment(node) {
3
- return isVNode(node) && node.type === Fragment;
3
+ return isVNode(node) && node.type === Fragment;
4
4
  }
5
- export {
6
- isFragment
7
- };
5
+ export { isFragment };
@@ -1,20 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isFragment = require("./isFragment.cjs");
1
+ const require_isFragment = require("./isFragment.cjs");
4
2
  function toArray(children, option = {}) {
5
- let ret = [];
6
- if (!Array.isArray(children))
7
- children = [children];
8
- for (const child of children) {
9
- if ((child === void 0 || child === null) && !option.keepEmpty)
10
- continue;
11
- if (Array.isArray(child))
12
- ret = ret.concat(toArray(child, option));
13
- else if (isFragment.isFragment(child) && child.children)
14
- ret = ret.concat(toArray(child.children, option));
15
- else
16
- ret.push(child);
17
- }
18
- return ret;
3
+ let ret = [];
4
+ if (!Array.isArray(children)) children = [children];
5
+ for (const child of children) {
6
+ if ((child === void 0 || child === null) && !option.keepEmpty) continue;
7
+ if (Array.isArray(child)) ret = ret.concat(toArray(child, option));
8
+ else if (require_isFragment.isFragment(child) && child.children) ret = ret.concat(toArray(child.children, option));
9
+ else ret.push(child);
10
+ }
11
+ return ret;
19
12
  }
20
13
  exports.toArray = toArray;
@@ -1,20 +1,13 @@
1
1
  import { isFragment } from "./isFragment.js";
2
2
  function toArray(children, option = {}) {
3
- let ret = [];
4
- if (!Array.isArray(children))
5
- children = [children];
6
- for (const child of children) {
7
- if ((child === void 0 || child === null) && !option.keepEmpty)
8
- continue;
9
- if (Array.isArray(child))
10
- ret = ret.concat(toArray(child, option));
11
- else if (isFragment(child) && child.children)
12
- ret = ret.concat(toArray(child.children, option));
13
- else
14
- ret.push(child);
15
- }
16
- return ret;
3
+ let ret = [];
4
+ if (!Array.isArray(children)) children = [children];
5
+ for (const child of children) {
6
+ if ((child === void 0 || child === null) && !option.keepEmpty) continue;
7
+ if (Array.isArray(child)) ret = ret.concat(toArray(child, option));
8
+ else if (isFragment(child) && child.children) ret = ret.concat(toArray(child.children, option));
9
+ else ret.push(child);
10
+ }
11
+ return ret;
17
12
  }
18
- export {
19
- toArray
20
- };
13
+ export { toArray };
@@ -1,13 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
1
  function addEventListener(...args) {
4
- const [target, eventType, cb, option] = args;
5
- if (target?.addEventListener)
6
- target.addEventListener(eventType, cb, option);
7
- return {
8
- remove() {
9
- target?.removeEventListener?.(eventType, cb, option);
10
- }
11
- };
2
+ const [target, eventType, cb, option] = args;
3
+ if (target?.addEventListener) target.addEventListener(eventType, cb, option);
4
+ return { remove() {
5
+ target?.removeEventListener?.(eventType, cb, option);
6
+ } };
12
7
  }
13
8
  exports.addEventListener = addEventListener;
@@ -1,13 +1,8 @@
1
1
  function addEventListener(...args) {
2
- const [target, eventType, cb, option] = args;
3
- if (target?.addEventListener)
4
- target.addEventListener(eventType, cb, option);
5
- return {
6
- remove() {
7
- target?.removeEventListener?.(eventType, cb, option);
8
- }
9
- };
2
+ const [target, eventType, cb, option] = args;
3
+ if (target?.addEventListener) target.addEventListener(eventType, cb, option);
4
+ return { remove() {
5
+ target?.removeEventListener?.(eventType, cb, option);
6
+ } };
10
7
  }
11
- export {
12
- addEventListener
13
- };
8
+ export { addEventListener };
@@ -1,6 +1,5 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
1
+ Object.defineProperty(exports, "__esModule", { value: true });
3
2
  function canUseDom() {
4
- return !!(typeof window !== "undefined" && window.document && window.document.createElement);
3
+ return !!(typeof window !== "undefined" && window.document && window.document.createElement);
5
4
  }
6
5
  exports.default = canUseDom;
@@ -1,6 +1,4 @@
1
1
  function canUseDom() {
2
- return !!(typeof window !== "undefined" && window.document && window.document.createElement);
2
+ return !!(typeof window !== "undefined" && window.document && window.document.createElement);
3
3
  }
4
- export {
5
- canUseDom as default
6
- };
4
+ export { canUseDom as default };
@@ -1,28 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
1
  function hasClass(node, className) {
4
- if (node.classList)
5
- return node.classList.contains(className);
6
- const originClass = node.className;
7
- return ` ${originClass} `.includes(` ${className} `);
2
+ if (node.classList) return node.classList.contains(className);
3
+ return ` ${node.className} `.includes(` ${className} `);
8
4
  }
9
5
  function addClass(node, className) {
10
- if (node.classList) {
11
- node.classList.add(className);
12
- } else {
13
- if (!hasClass(node, className))
14
- node.className = `${node.className} ${className}`;
15
- }
6
+ if (node.classList) node.classList.add(className);
7
+ else if (!hasClass(node, className)) node.className = `${node.className} ${className}`;
16
8
  }
17
9
  function removeClass(node, className) {
18
- if (node.classList) {
19
- node.classList.remove(className);
20
- } else {
21
- if (hasClass(node, className)) {
22
- const originClass = node.className;
23
- node.className = ` ${originClass} `.replace(` ${className} `, " ");
24
- }
25
- }
10
+ if (node.classList) node.classList.remove(className);
11
+ else if (hasClass(node, className)) node.className = ` ${node.className} `.replace(` ${className} `, " ");
26
12
  }
27
13
  exports.addClass = addClass;
28
14
  exports.hasClass = hasClass;
package/dist/Dom/class.js CHANGED
@@ -1,29 +1,13 @@
1
1
  function hasClass(node, className) {
2
- if (node.classList)
3
- return node.classList.contains(className);
4
- const originClass = node.className;
5
- return ` ${originClass} `.includes(` ${className} `);
2
+ if (node.classList) return node.classList.contains(className);
3
+ return ` ${node.className} `.includes(` ${className} `);
6
4
  }
7
5
  function addClass(node, className) {
8
- if (node.classList) {
9
- node.classList.add(className);
10
- } else {
11
- if (!hasClass(node, className))
12
- node.className = `${node.className} ${className}`;
13
- }
6
+ if (node.classList) node.classList.add(className);
7
+ else if (!hasClass(node, className)) node.className = `${node.className} ${className}`;
14
8
  }
15
9
  function removeClass(node, className) {
16
- if (node.classList) {
17
- node.classList.remove(className);
18
- } else {
19
- if (hasClass(node, className)) {
20
- const originClass = node.className;
21
- node.className = ` ${originClass} `.replace(` ${className} `, " ");
22
- }
23
- }
10
+ if (node.classList) node.classList.remove(className);
11
+ else if (hasClass(node, className)) node.className = ` ${node.className} `.replace(` ${className} `, " ");
24
12
  }
25
- export {
26
- addClass,
27
- hasClass,
28
- removeClass
29
- };
13
+ export { addClass, hasClass, removeClass };
@@ -1,16 +1,12 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
1
+ Object.defineProperty(exports, "__esModule", { value: true });
3
2
  function contains(root, n) {
4
- if (!root)
5
- return false;
6
- if (root.contains)
7
- return root.contains(n);
8
- let node = n;
9
- while (node) {
10
- if (node === root)
11
- return true;
12
- node = node.parentNode;
13
- }
14
- return false;
3
+ if (!root) return false;
4
+ if (root.contains) return root.contains(n);
5
+ let node = n;
6
+ while (node) {
7
+ if (node === root) return true;
8
+ node = node.parentNode;
9
+ }
10
+ return false;
15
11
  }
16
12
  exports.default = contains;
@@ -1,16 +1,11 @@
1
1
  function contains(root, n) {
2
- if (!root)
3
- return false;
4
- if (root.contains)
5
- return root.contains(n);
6
- let node = n;
7
- while (node) {
8
- if (node === root)
9
- return true;
10
- node = node.parentNode;
11
- }
12
- return false;
2
+ if (!root) return false;
3
+ if (root.contains) return root.contains(n);
4
+ let node = n;
5
+ while (node) {
6
+ if (node === root) return true;
7
+ node = node.parentNode;
8
+ }
9
+ return false;
13
10
  }
14
- export {
15
- contains as default
16
- };
11
+ export { contains as default };
package/dist/Dom/css.cjs CHANGED
@@ -1,90 +1,75 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const PIXEL_PATTERN = /margin|padding|width|height|max|min|offset/;
4
- const removePixel = {
5
- left: true,
6
- top: true
1
+ var PIXEL_PATTERN = /margin|padding|width|height|max|min|offset/;
2
+ var removePixel = {
3
+ left: true,
4
+ top: true
7
5
  };
8
- const floatMap = {
9
- cssFloat: 1,
10
- styleFloat: 1,
11
- float: 1
6
+ var floatMap = {
7
+ cssFloat: 1,
8
+ styleFloat: 1,
9
+ float: 1
12
10
  };
13
11
  function getComputedStyle(node) {
14
- return node.nodeType === 1 ? node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
12
+ return node.nodeType === 1 ? node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
15
13
  }
16
14
  function getStyleValue(node, type, value) {
17
- type = type.toLowerCase();
18
- if (value === "auto") {
19
- if (type === "height")
20
- return node.offsetHeight;
21
- if (type === "width")
22
- return node.offsetWidth;
23
- }
24
- if (!(type in removePixel))
25
- removePixel[type] = PIXEL_PATTERN.test(type);
26
- return removePixel[type] ? Number.parseFloat(value) || 0 : value;
15
+ type = type.toLowerCase();
16
+ if (value === "auto") {
17
+ if (type === "height") return node.offsetHeight;
18
+ if (type === "width") return node.offsetWidth;
19
+ }
20
+ if (!(type in removePixel)) removePixel[type] = PIXEL_PATTERN.test(type);
21
+ return removePixel[type] ? Number.parseFloat(value) || 0 : value;
27
22
  }
28
23
  function get(node, name) {
29
- const length = arguments.length;
30
- const style = getComputedStyle(node);
31
- name = floatMap[name] ? "cssFloat" in node.style ? "cssFloat" : "styleFloat" : name;
32
- return length === 1 ? style : getStyleValue(node, name, style[name] || node.style[name]);
24
+ const length = arguments.length;
25
+ const style = getComputedStyle(node);
26
+ name = floatMap[name] ? "cssFloat" in node.style ? "cssFloat" : "styleFloat" : name;
27
+ return length === 1 ? style : getStyleValue(node, name, style[name] || node.style[name]);
33
28
  }
34
29
  function set(node, name, value) {
35
- const length = arguments.length;
36
- name = floatMap[name] ? "cssFloat" in node.style ? "cssFloat" : "styleFloat" : name;
37
- if (length === 3) {
38
- if (typeof value === "number" && PIXEL_PATTERN.test(name))
39
- value = `${value}px`;
40
- node.style[name] = value;
41
- return value;
42
- }
43
- for (const x in name) {
44
- if (x in name)
45
- set(node, x, name[x]);
46
- }
47
- return getComputedStyle(node);
30
+ const length = arguments.length;
31
+ name = floatMap[name] ? "cssFloat" in node.style ? "cssFloat" : "styleFloat" : name;
32
+ if (length === 3) {
33
+ if (typeof value === "number" && PIXEL_PATTERN.test(name)) value = `${value}px`;
34
+ node.style[name] = value;
35
+ return value;
36
+ }
37
+ for (const x in name) if (x in name) set(node, x, name[x]);
38
+ return getComputedStyle(node);
48
39
  }
49
40
  function getOuterWidth(el) {
50
- if (el === document.body)
51
- return document.documentElement.clientWidth;
52
- return el.offsetWidth;
41
+ if (el === document.body) return document.documentElement.clientWidth;
42
+ return el.offsetWidth;
53
43
  }
54
44
  function getOuterHeight(el) {
55
- if (el === document.body)
56
- return window.innerHeight || document.documentElement.clientHeight;
57
- return el.offsetHeight;
45
+ if (el === document.body) return window.innerHeight || document.documentElement.clientHeight;
46
+ return el.offsetHeight;
58
47
  }
59
48
  function getDocSize() {
60
- const width = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth);
61
- const height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
62
- return {
63
- width,
64
- height
65
- };
49
+ return {
50
+ width: Math.max(document.documentElement.scrollWidth, document.body.scrollWidth),
51
+ height: Math.max(document.documentElement.scrollHeight, document.body.scrollHeight)
52
+ };
66
53
  }
67
54
  function getClientSize() {
68
- const width = document.documentElement.clientWidth;
69
- const height = window.innerHeight || document.documentElement.clientHeight;
70
- return {
71
- width,
72
- height
73
- };
55
+ return {
56
+ width: document.documentElement.clientWidth,
57
+ height: window.innerHeight || document.documentElement.clientHeight
58
+ };
74
59
  }
75
60
  function getScroll() {
76
- return {
77
- scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
78
- scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
79
- };
61
+ return {
62
+ scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
63
+ scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
64
+ };
80
65
  }
81
66
  function getOffset(node) {
82
- const box = node.getBoundingClientRect();
83
- const docElem = document.documentElement;
84
- return {
85
- left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
86
- top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
87
- };
67
+ const box = node.getBoundingClientRect();
68
+ const docElem = document.documentElement;
69
+ return {
70
+ left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
71
+ top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
72
+ };
88
73
  }
89
74
  exports.get = get;
90
75
  exports.getClientSize = getClientSize;
package/dist/Dom/css.js CHANGED
@@ -1,96 +1,74 @@
1
- const PIXEL_PATTERN = /margin|padding|width|height|max|min|offset/;
2
- const removePixel = {
3
- left: true,
4
- top: true
1
+ var PIXEL_PATTERN = /margin|padding|width|height|max|min|offset/;
2
+ var removePixel = {
3
+ left: true,
4
+ top: true
5
5
  };
6
- const floatMap = {
7
- cssFloat: 1,
8
- styleFloat: 1,
9
- float: 1
6
+ var floatMap = {
7
+ cssFloat: 1,
8
+ styleFloat: 1,
9
+ float: 1
10
10
  };
11
11
  function getComputedStyle(node) {
12
- return node.nodeType === 1 ? node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
12
+ return node.nodeType === 1 ? node.ownerDocument.defaultView.getComputedStyle(node, null) : {};
13
13
  }
14
14
  function getStyleValue(node, type, value) {
15
- type = type.toLowerCase();
16
- if (value === "auto") {
17
- if (type === "height")
18
- return node.offsetHeight;
19
- if (type === "width")
20
- return node.offsetWidth;
21
- }
22
- if (!(type in removePixel))
23
- removePixel[type] = PIXEL_PATTERN.test(type);
24
- return removePixel[type] ? Number.parseFloat(value) || 0 : value;
15
+ type = type.toLowerCase();
16
+ if (value === "auto") {
17
+ if (type === "height") return node.offsetHeight;
18
+ if (type === "width") return node.offsetWidth;
19
+ }
20
+ if (!(type in removePixel)) removePixel[type] = PIXEL_PATTERN.test(type);
21
+ return removePixel[type] ? Number.parseFloat(value) || 0 : value;
25
22
  }
26
23
  function get(node, name) {
27
- const length = arguments.length;
28
- const style = getComputedStyle(node);
29
- name = floatMap[name] ? "cssFloat" in node.style ? "cssFloat" : "styleFloat" : name;
30
- return length === 1 ? style : getStyleValue(node, name, style[name] || node.style[name]);
24
+ const length = arguments.length;
25
+ const style = getComputedStyle(node);
26
+ name = floatMap[name] ? "cssFloat" in node.style ? "cssFloat" : "styleFloat" : name;
27
+ return length === 1 ? style : getStyleValue(node, name, style[name] || node.style[name]);
31
28
  }
32
29
  function set(node, name, value) {
33
- const length = arguments.length;
34
- name = floatMap[name] ? "cssFloat" in node.style ? "cssFloat" : "styleFloat" : name;
35
- if (length === 3) {
36
- if (typeof value === "number" && PIXEL_PATTERN.test(name))
37
- value = `${value}px`;
38
- node.style[name] = value;
39
- return value;
40
- }
41
- for (const x in name) {
42
- if (x in name)
43
- set(node, x, name[x]);
44
- }
45
- return getComputedStyle(node);
30
+ const length = arguments.length;
31
+ name = floatMap[name] ? "cssFloat" in node.style ? "cssFloat" : "styleFloat" : name;
32
+ if (length === 3) {
33
+ if (typeof value === "number" && PIXEL_PATTERN.test(name)) value = `${value}px`;
34
+ node.style[name] = value;
35
+ return value;
36
+ }
37
+ for (const x in name) if (x in name) set(node, x, name[x]);
38
+ return getComputedStyle(node);
46
39
  }
47
40
  function getOuterWidth(el) {
48
- if (el === document.body)
49
- return document.documentElement.clientWidth;
50
- return el.offsetWidth;
41
+ if (el === document.body) return document.documentElement.clientWidth;
42
+ return el.offsetWidth;
51
43
  }
52
44
  function getOuterHeight(el) {
53
- if (el === document.body)
54
- return window.innerHeight || document.documentElement.clientHeight;
55
- return el.offsetHeight;
45
+ if (el === document.body) return window.innerHeight || document.documentElement.clientHeight;
46
+ return el.offsetHeight;
56
47
  }
57
48
  function getDocSize() {
58
- const width = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth);
59
- const height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
60
- return {
61
- width,
62
- height
63
- };
49
+ return {
50
+ width: Math.max(document.documentElement.scrollWidth, document.body.scrollWidth),
51
+ height: Math.max(document.documentElement.scrollHeight, document.body.scrollHeight)
52
+ };
64
53
  }
65
54
  function getClientSize() {
66
- const width = document.documentElement.clientWidth;
67
- const height = window.innerHeight || document.documentElement.clientHeight;
68
- return {
69
- width,
70
- height
71
- };
55
+ return {
56
+ width: document.documentElement.clientWidth,
57
+ height: window.innerHeight || document.documentElement.clientHeight
58
+ };
72
59
  }
73
60
  function getScroll() {
74
- return {
75
- scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
76
- scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
77
- };
61
+ return {
62
+ scrollLeft: Math.max(document.documentElement.scrollLeft, document.body.scrollLeft),
63
+ scrollTop: Math.max(document.documentElement.scrollTop, document.body.scrollTop)
64
+ };
78
65
  }
79
66
  function getOffset(node) {
80
- const box = node.getBoundingClientRect();
81
- const docElem = document.documentElement;
82
- return {
83
- left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
84
- top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
85
- };
67
+ const box = node.getBoundingClientRect();
68
+ const docElem = document.documentElement;
69
+ return {
70
+ left: box.left + (window.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || document.body.clientLeft || 0),
71
+ top: box.top + (window.pageYOffset || docElem.scrollTop) - (docElem.clientTop || document.body.clientTop || 0)
72
+ };
86
73
  }
87
- export {
88
- get,
89
- getClientSize,
90
- getDocSize,
91
- getOffset,
92
- getOuterHeight,
93
- getOuterWidth,
94
- getScroll,
95
- set
96
- };
74
+ export { get, getClientSize, getDocSize, getOffset, getOuterHeight, getOuterWidth, getScroll, set };