@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,169 +1,132 @@
1
- import { defineComponent, shallowRef, onMounted, onUpdated, onBeforeUnmount, createVNode } from "vue";
2
1
  import canUseDom from "./Dom/canUseDom.js";
2
+ import Portal_default from "./Portal.js";
3
+ import setStyle_default from "./setStyle.js";
3
4
  import ScrollLocker from "./Dom/scrollLocker.js";
4
- import Portal from "./Portal.js";
5
- import wrapperRaf from "./raf.js";
6
- import setStyle from "./setStyle.js";
7
- let openCount = 0;
8
- const supportDom = canUseDom();
5
+ import raf_default from "./raf.js";
6
+ import { createVNode, defineComponent, onBeforeUnmount, onMounted, onUpdated, shallowRef } from "vue";
7
+ var openCount = 0;
8
+ var supportDom = canUseDom();
9
9
  function getOpenCount() {
10
- return process.env.NODE_ENV === "test" ? openCount : 0;
10
+ return process.env.NODE_ENV === "test" ? openCount : 0;
11
11
  }
12
- let cacheOverflow = {};
12
+ var cacheOverflow = {};
13
13
  function getParent(getContainer) {
14
- if (!supportDom) return null;
15
- if (getContainer) {
16
- if (typeof getContainer === "string") return document.querySelectorAll(getContainer)[0];
17
- if (typeof getContainer === "function") return getContainer();
18
- if (typeof getContainer === "object" && getContainer instanceof window.HTMLElement) {
19
- return getContainer;
20
- }
21
- }
22
- return document.body;
14
+ if (!supportDom) return null;
15
+ if (getContainer) {
16
+ if (typeof getContainer === "string") return document.querySelectorAll(getContainer)[0];
17
+ if (typeof getContainer === "function") return getContainer();
18
+ if (typeof getContainer === "object" && getContainer instanceof window.HTMLElement) return getContainer;
19
+ }
20
+ return document.body;
23
21
  }
24
- const PortalWrapper = /* @__PURE__ */ defineComponent((props, ctx) => {
25
- const container = shallowRef();
26
- const componentRef = shallowRef();
27
- const rafId = shallowRef();
28
- const scrollLocker = shallowRef();
29
- const removeCurrentContainer = () => {
30
- container.value?.parentNode?.removeChild(container.value);
31
- };
32
- const updateOpenCount = (prevProps) => {
33
- const {
34
- visible: prevVisible,
35
- getContainer: prevGetContainer
36
- } = prevProps || {};
37
- const {
38
- visible,
39
- getContainer: getContainer2
40
- } = props;
41
- if (visible !== prevVisible && supportDom && getParent(getContainer2) === document.body) {
42
- if (visible && !prevVisible) openCount += 1;
43
- else if (prevProps) openCount -= 1;
44
- }
45
- const getContainerIsFunc = typeof getContainer2 === "function" && typeof prevGetContainer === "function";
46
- if (getContainerIsFunc ? getContainer2.toString() !== prevGetContainer.toString() : getContainer2 !== prevGetContainer) {
47
- removeCurrentContainer();
48
- }
49
- };
50
- const attachToParent = (force = false) => {
51
- if (force || container.value && !container.value.parentNode) {
52
- const parent = getParent(props.getContainer);
53
- if (parent) {
54
- parent.appendChild(container.value);
55
- return true;
56
- }
57
- return false;
58
- }
59
- return true;
60
- };
61
- const setWrapperClassName = () => {
62
- const {
63
- wrapperClassName
64
- } = props;
65
- if (container.value && wrapperClassName && wrapperClassName !== container.value.className) {
66
- container.value.className = wrapperClassName;
67
- }
68
- };
69
- const getContainer = () => {
70
- if (!supportDom) return null;
71
- if (!container.value) {
72
- container.value = document.createElement("div");
73
- attachToParent(true);
74
- }
75
- setWrapperClassName();
76
- return container.value;
77
- };
78
- onMounted(() => {
79
- scrollLocker.value = new ScrollLocker({
80
- container: getParent(props.getContainer)
81
- });
82
- updateOpenCount();
83
- if (!attachToParent()) {
84
- rafId.value = wrapperRaf(() => {
85
- });
86
- }
87
- });
88
- onUpdated(() => {
89
- updateOpenCount(props);
90
- updateOpenCount(props);
91
- setWrapperClassName();
92
- attachToParent();
93
- });
94
- onBeforeUnmount(() => {
95
- const {
96
- visible,
97
- getContainer: getContainer2
98
- } = props;
99
- if (supportDom && getParent(getContainer2) === document.body) {
100
- openCount = visible && openCount ? openCount - 1 : openCount;
101
- }
102
- removeCurrentContainer();
103
- wrapperRaf.cancel(rafId.value);
104
- });
105
- const switchScrollingEffect = () => {
106
- if (openCount === 1 && !Object.keys(cacheOverflow).length) {
107
- switchScrollingEffect();
108
- cacheOverflow = setStyle({
109
- overflow: "hidden",
110
- overflowX: "hidden",
111
- overflowY: "hidden"
112
- });
113
- } else if (!openCount) {
114
- setStyle(cacheOverflow);
115
- cacheOverflow = {};
116
- switchScrollingEffect();
117
- }
118
- };
119
- return () => {
120
- const {
121
- forceRender,
122
- visible
123
- } = props;
124
- let portal = null;
125
- const childProps = {
126
- getOpenCount,
127
- getContainer,
128
- switchScrollingEffect,
129
- scrollLocker: scrollLocker.value
130
- };
131
- if (forceRender || visible || componentRef.value) {
132
- portal = createVNode(Portal, {
133
- "getContainer": getContainer,
134
- "ref": componentRef
135
- }, {
136
- default: () => [ctx?.slots?.default(childProps)]
137
- });
138
- }
139
- return portal;
140
- };
141
- }, {
142
- props: {
143
- visible: {
144
- type: Boolean,
145
- required: false,
146
- default: void 0
147
- },
148
- getContainer: {
149
- type: [String, Function],
150
- required: false,
151
- skipCheck: true,
152
- default: void 0
153
- },
154
- wrapperClassName: {
155
- type: String,
156
- required: false,
157
- default: void 0
158
- },
159
- forceRender: {
160
- type: Boolean,
161
- required: false,
162
- default: void 0
163
- }
164
- }
165
- });
166
- export {
167
- PortalWrapper as default,
168
- getOpenCount
169
- };
22
+ var PortalWrapper_default = /* @__PURE__ */ defineComponent((props, ctx) => {
23
+ const container = shallowRef();
24
+ const componentRef = shallowRef();
25
+ const rafId = shallowRef();
26
+ const scrollLocker = shallowRef();
27
+ const removeCurrentContainer = () => {
28
+ container.value?.parentNode?.removeChild(container.value);
29
+ };
30
+ const updateOpenCount = (prevProps) => {
31
+ const { visible: prevVisible, getContainer: prevGetContainer } = prevProps || {};
32
+ const { visible, getContainer: getContainer$1 } = props;
33
+ if (visible !== prevVisible && supportDom && getParent(getContainer$1) === document.body) {
34
+ if (visible && !prevVisible) openCount += 1;
35
+ else if (prevProps) openCount -= 1;
36
+ }
37
+ if (typeof getContainer$1 === "function" && typeof prevGetContainer === "function" ? getContainer$1.toString() !== prevGetContainer.toString() : getContainer$1 !== prevGetContainer) removeCurrentContainer();
38
+ };
39
+ const attachToParent = (force = false) => {
40
+ if (force || container.value && !container.value.parentNode) {
41
+ const parent = getParent(props.getContainer);
42
+ if (parent) {
43
+ parent.appendChild(container.value);
44
+ return true;
45
+ }
46
+ return false;
47
+ }
48
+ return true;
49
+ };
50
+ const setWrapperClassName = () => {
51
+ const { wrapperClassName } = props;
52
+ if (container.value && wrapperClassName && wrapperClassName !== container.value.className) container.value.className = wrapperClassName;
53
+ };
54
+ const getContainer = () => {
55
+ if (!supportDom) return null;
56
+ if (!container.value) {
57
+ container.value = document.createElement("div");
58
+ attachToParent(true);
59
+ }
60
+ setWrapperClassName();
61
+ return container.value;
62
+ };
63
+ onMounted(() => {
64
+ scrollLocker.value = new ScrollLocker({ container: getParent(props.getContainer) });
65
+ updateOpenCount();
66
+ if (!attachToParent()) rafId.value = raf_default(() => {});
67
+ });
68
+ onUpdated(() => {
69
+ updateOpenCount(props);
70
+ updateOpenCount(props);
71
+ setWrapperClassName();
72
+ attachToParent();
73
+ });
74
+ onBeforeUnmount(() => {
75
+ const { visible, getContainer: getContainer$1 } = props;
76
+ if (supportDom && getParent(getContainer$1) === document.body) openCount = visible && openCount ? openCount - 1 : openCount;
77
+ removeCurrentContainer();
78
+ raf_default.cancel(rafId.value);
79
+ });
80
+ const switchScrollingEffect = () => {
81
+ if (openCount === 1 && !Object.keys(cacheOverflow).length) {
82
+ switchScrollingEffect();
83
+ cacheOverflow = setStyle_default({
84
+ overflow: "hidden",
85
+ overflowX: "hidden",
86
+ overflowY: "hidden"
87
+ });
88
+ } else if (!openCount) {
89
+ setStyle_default(cacheOverflow);
90
+ cacheOverflow = {};
91
+ switchScrollingEffect();
92
+ }
93
+ };
94
+ return () => {
95
+ const { forceRender, visible } = props;
96
+ let portal = null;
97
+ const childProps = {
98
+ getOpenCount,
99
+ getContainer,
100
+ switchScrollingEffect,
101
+ scrollLocker: scrollLocker.value
102
+ };
103
+ if (forceRender || visible || componentRef.value) portal = createVNode(Portal_default, {
104
+ "getContainer": getContainer,
105
+ "ref": componentRef
106
+ }, { default: () => [ctx?.slots?.default(childProps)] });
107
+ return portal;
108
+ };
109
+ }, { props: {
110
+ visible: {
111
+ type: Boolean,
112
+ required: false,
113
+ default: void 0
114
+ },
115
+ getContainer: {
116
+ type: [String, Function],
117
+ required: false,
118
+ skipCheck: true,
119
+ default: void 0
120
+ },
121
+ wrapperClassName: {
122
+ type: String,
123
+ required: false,
124
+ default: void 0
125
+ },
126
+ forceRender: {
127
+ type: Boolean,
128
+ required: false,
129
+ default: void 0
130
+ }
131
+ } });
132
+ export { PortalWrapper_default as default, getOpenCount };
@@ -1,44 +1,36 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
1
+ Object.defineProperty(exports, "__esModule", { value: true });
3
2
  function toVal(mix) {
4
- let str = "";
5
- if (typeof mix === "string" || typeof mix === "number") {
6
- str += mix;
7
- } else if (typeof mix === "object") {
8
- if (Array.isArray(mix)) {
9
- for (let k = 0; k < mix.length; k++) {
10
- if (mix[k]) {
11
- const y = toVal(mix[k]);
12
- if (y) {
13
- str && (str += " ");
14
- str += y;
15
- }
16
- }
17
- }
18
- } else {
19
- for (const k in mix) {
20
- if (mix[k]) {
21
- str && (str += " ");
22
- str += k;
23
- }
24
- }
25
- }
26
- }
27
- return str;
3
+ let str = "";
4
+ if (typeof mix === "string" || typeof mix === "number") str += mix;
5
+ else if (typeof mix === "object") {
6
+ if (Array.isArray(mix)) {
7
+ for (let k = 0; k < mix.length; k++) if (mix[k]) {
8
+ const y = toVal(mix[k]);
9
+ if (y) {
10
+ str && (str += " ");
11
+ str += y;
12
+ }
13
+ }
14
+ } else for (const k in mix) if (mix[k]) {
15
+ str && (str += " ");
16
+ str += k;
17
+ }
18
+ }
19
+ return str;
28
20
  }
29
21
  function classNames(...args) {
30
- let str = "";
31
- for (let i = 0; i < args.length; i++) {
32
- const tmp = args[i];
33
- if (tmp) {
34
- const x = toVal(tmp);
35
- if (x) {
36
- str && (str += " ");
37
- str += x;
38
- }
39
- }
40
- }
41
- return str;
22
+ let str = "";
23
+ for (let i = 0; i < args.length; i++) {
24
+ const tmp = args[i];
25
+ if (tmp) {
26
+ const x = toVal(tmp);
27
+ if (x) {
28
+ str && (str += " ");
29
+ str += x;
30
+ }
31
+ }
32
+ }
33
+ return str;
42
34
  }
43
35
  const clsx = classNames;
44
36
  exports.clsx = clsx;
@@ -1,45 +1,35 @@
1
1
  function toVal(mix) {
2
- let str = "";
3
- if (typeof mix === "string" || typeof mix === "number") {
4
- str += mix;
5
- } else if (typeof mix === "object") {
6
- if (Array.isArray(mix)) {
7
- for (let k = 0; k < mix.length; k++) {
8
- if (mix[k]) {
9
- const y = toVal(mix[k]);
10
- if (y) {
11
- str && (str += " ");
12
- str += y;
13
- }
14
- }
15
- }
16
- } else {
17
- for (const k in mix) {
18
- if (mix[k]) {
19
- str && (str += " ");
20
- str += k;
21
- }
22
- }
23
- }
24
- }
25
- return str;
2
+ let str = "";
3
+ if (typeof mix === "string" || typeof mix === "number") str += mix;
4
+ else if (typeof mix === "object") {
5
+ if (Array.isArray(mix)) {
6
+ for (let k = 0; k < mix.length; k++) if (mix[k]) {
7
+ const y = toVal(mix[k]);
8
+ if (y) {
9
+ str && (str += " ");
10
+ str += y;
11
+ }
12
+ }
13
+ } else for (const k in mix) if (mix[k]) {
14
+ str && (str += " ");
15
+ str += k;
16
+ }
17
+ }
18
+ return str;
26
19
  }
27
20
  function classNames(...args) {
28
- let str = "";
29
- for (let i = 0; i < args.length; i++) {
30
- const tmp = args[i];
31
- if (tmp) {
32
- const x = toVal(tmp);
33
- if (x) {
34
- str && (str += " ");
35
- str += x;
36
- }
37
- }
38
- }
39
- return str;
21
+ let str = "";
22
+ for (let i = 0; i < args.length; i++) {
23
+ const tmp = args[i];
24
+ if (tmp) {
25
+ const x = toVal(tmp);
26
+ if (x) {
27
+ str && (str += " ");
28
+ str += x;
29
+ }
30
+ }
31
+ }
32
+ return str;
40
33
  }
41
34
  const clsx = classNames;
42
- export {
43
- clsx,
44
- classNames as default
45
- };
35
+ export { clsx, classNames as default };
@@ -1,19 +1,17 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
1
+ Object.defineProperty(exports, "__esModule", { value: true });
3
2
  function composeProps(originProps, patchProps, isAll) {
4
- const composedProps = {
5
- ...originProps,
6
- ...isAll ? patchProps : {}
7
- };
8
- Object.keys(patchProps).forEach((key) => {
9
- const func = patchProps[key];
10
- if (typeof func === "function") {
11
- composedProps[key] = (...args) => {
12
- func(...args);
13
- return originProps[key]?.(...args);
14
- };
15
- }
16
- });
17
- return composedProps;
3
+ const composedProps = {
4
+ ...originProps,
5
+ ...isAll ? patchProps : {}
6
+ };
7
+ Object.keys(patchProps).forEach((key) => {
8
+ const func = patchProps[key];
9
+ if (typeof func === "function") composedProps[key] = (...args) => {
10
+ func(...args);
11
+ return originProps[key]?.(...args);
12
+ };
13
+ });
14
+ return composedProps;
18
15
  }
19
- exports.default = composeProps;
16
+ var composeProps_default = composeProps;
17
+ exports.default = composeProps_default;
@@ -1,19 +1,16 @@
1
1
  function composeProps(originProps, patchProps, isAll) {
2
- const composedProps = {
3
- ...originProps,
4
- ...isAll ? patchProps : {}
5
- };
6
- Object.keys(patchProps).forEach((key) => {
7
- const func = patchProps[key];
8
- if (typeof func === "function") {
9
- composedProps[key] = (...args) => {
10
- func(...args);
11
- return originProps[key]?.(...args);
12
- };
13
- }
14
- });
15
- return composedProps;
2
+ const composedProps = {
3
+ ...originProps,
4
+ ...isAll ? patchProps : {}
5
+ };
6
+ Object.keys(patchProps).forEach((key) => {
7
+ const func = patchProps[key];
8
+ if (typeof func === "function") composedProps[key] = (...args) => {
9
+ func(...args);
10
+ return originProps[key]?.(...args);
11
+ };
12
+ });
13
+ return composedProps;
16
14
  }
17
- export {
18
- composeProps as default
19
- };
15
+ var composeProps_default = composeProps;
16
+ export { composeProps_default as default };
@@ -1,24 +1,22 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
1
+ Object.defineProperty(exports, "__esModule", { value: true });
3
2
  function createRef() {
4
- const func = (node) => {
5
- func.current = node;
6
- };
7
- return func;
3
+ const func = (node) => {
4
+ func.current = node;
5
+ };
6
+ return func;
8
7
  }
9
8
  function fillRef(ref, node) {
10
- if (typeof ref === "function")
11
- ref(node);
12
- else if (typeof ref === "object" && ref && "current" in ref)
13
- ref.current = node;
9
+ if (typeof ref === "function") ref(node);
10
+ else if (typeof ref === "object" && ref && "current" in ref) ref.current = node;
14
11
  }
15
12
  function composeRef(...refs) {
16
- return (node) => {
17
- refs.forEach((ref) => {
18
- fillRef(ref, node);
19
- });
20
- };
13
+ return (node) => {
14
+ refs.forEach((ref) => {
15
+ fillRef(ref, node);
16
+ });
17
+ };
21
18
  }
19
+ var createRef_default = createRef;
22
20
  exports.composeRef = composeRef;
23
- exports.default = createRef;
21
+ exports.default = createRef_default;
24
22
  exports.fillRef = fillRef;
package/dist/createRef.js CHANGED
@@ -1,24 +1,19 @@
1
1
  function createRef() {
2
- const func = (node) => {
3
- func.current = node;
4
- };
5
- return func;
2
+ const func = (node) => {
3
+ func.current = node;
4
+ };
5
+ return func;
6
6
  }
7
7
  function fillRef(ref, node) {
8
- if (typeof ref === "function")
9
- ref(node);
10
- else if (typeof ref === "object" && ref && "current" in ref)
11
- ref.current = node;
8
+ if (typeof ref === "function") ref(node);
9
+ else if (typeof ref === "object" && ref && "current" in ref) ref.current = node;
12
10
  }
13
11
  function composeRef(...refs) {
14
- return (node) => {
15
- refs.forEach((ref) => {
16
- fillRef(ref, node);
17
- });
18
- };
12
+ return (node) => {
13
+ refs.forEach((ref) => {
14
+ fillRef(ref, node);
15
+ });
16
+ };
19
17
  }
20
- export {
21
- composeRef,
22
- createRef as default,
23
- fillRef
24
- };
18
+ var createRef_default = createRef;
19
+ export { composeRef, createRef_default as default, fillRef };