@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.
- package/dist/Children/isFragment.cjs +2 -4
- package/dist/Children/isFragment.js +3 -5
- package/dist/Children/toArray.cjs +10 -17
- package/dist/Children/toArray.js +10 -17
- package/dist/Dom/addEventListener.cjs +5 -10
- package/dist/Dom/addEventListener.js +6 -11
- package/dist/Dom/canUseDom.cjs +2 -3
- package/dist/Dom/canUseDom.js +2 -4
- package/dist/Dom/class.cjs +6 -20
- package/dist/Dom/class.js +7 -23
- package/dist/Dom/contains.cjs +9 -13
- package/dist/Dom/contains.js +9 -14
- package/dist/Dom/css.cjs +51 -66
- package/dist/Dom/css.js +52 -74
- package/dist/Dom/dynamicCSS.cjs +59 -86
- package/dist/Dom/dynamicCSS.js +58 -88
- package/dist/Dom/findDOMNode.cjs +7 -10
- package/dist/Dom/findDOMNode.js +6 -11
- package/dist/Dom/focus.cjs +36 -43
- package/dist/Dom/focus.js +37 -48
- package/dist/Dom/isVisible.cjs +16 -21
- package/dist/Dom/isVisible.js +15 -21
- package/dist/Dom/scrollLocker.cjs +66 -88
- package/dist/Dom/scrollLocker.js +64 -87
- package/dist/Dom/shadow.cjs +3 -5
- package/dist/Dom/shadow.js +4 -7
- package/dist/Dom/styleChecker.cjs +14 -18
- package/dist/Dom/styleChecker.js +14 -18
- package/dist/Dom/support.cjs +14 -22
- package/dist/Dom/support.js +12 -21
- package/dist/EventInterface.cjs +0 -1
- package/dist/EventInterface.js +0 -1
- package/dist/KeyCode.cjs +165 -522
- package/dist/KeyCode.js +164 -522
- package/dist/Portal.cjs +40 -46
- package/dist/Portal.js +37 -45
- package/dist/PortalWrapper.cjs +130 -164
- package/dist/PortalWrapper.js +126 -163
- package/dist/classnames.cjs +30 -38
- package/dist/classnames.js +30 -40
- package/dist/composeProps.cjs +15 -17
- package/dist/composeProps.js +14 -17
- package/dist/createRef.cjs +14 -16
- package/dist/createRef.js +13 -18
- package/dist/debug/diff.cjs +39 -45
- package/dist/debug/diff.js +39 -46
- package/dist/deprecated.cjs +2 -7
- package/dist/deprecated.js +2 -8
- package/dist/getScrollBarSize.cjs +39 -43
- package/dist/getScrollBarSize.js +39 -45
- package/dist/guid.cjs +3 -4
- package/dist/guid.js +3 -5
- package/dist/hooks/useEvent.cjs +2 -3
- package/dist/hooks/useEvent.js +2 -4
- package/dist/hooks/useId.cjs +10 -15
- package/dist/hooks/useId.js +9 -15
- package/dist/hooks/useLayoutEffect.cjs +29 -52
- package/dist/hooks/useLayoutEffect.js +30 -54
- package/dist/hooks/useMemo.cjs +9 -13
- package/dist/hooks/useMemo.js +8 -13
- package/dist/hooks/useMergedState.cjs +22 -27
- package/dist/hooks/useMergedState.js +22 -28
- package/dist/hooks/useMobile.cjs +13 -13
- package/dist/hooks/useMobile.js +12 -14
- package/dist/hooks/useState.cjs +7 -9
- package/dist/hooks/useState.js +6 -9
- package/dist/index.cjs +9 -11
- package/dist/index.js +5 -11
- package/dist/isEqual.cjs +26 -34
- package/dist/isEqual.js +25 -34
- package/dist/isMobile.cjs +6 -12
- package/dist/isMobile.js +5 -12
- package/dist/isValid.cjs +4 -4
- package/dist/isValid.js +3 -4
- package/dist/omit.cjs +6 -9
- package/dist/omit.js +6 -10
- package/dist/pickAttrs.cjs +20 -36
- package/dist/pickAttrs.js +20 -37
- package/dist/props-util/index.cjs +35 -52
- package/dist/props-util/index.js +35 -57
- package/dist/raf.cjs +34 -37
- package/dist/raf.js +33 -38
- package/dist/setStyle.cjs +14 -15
- package/dist/setStyle.js +13 -15
- package/dist/switchScrollingEffect.cjs +29 -35
- package/dist/switchScrollingEffect.js +27 -34
- package/dist/test/domHook.cjs +32 -46
- package/dist/test/domHook.js +33 -48
- package/dist/type.cjs +36 -17
- package/dist/type.d.ts +1 -1
- package/dist/type.js +38 -30
- package/dist/utils/checkSlotProp.cjs +6 -10
- package/dist/utils/checkSlotProp.js +7 -11
- package/dist/utils/get.cjs +7 -9
- package/dist/utils/get.js +7 -10
- package/dist/utils/omit.cjs +5 -7
- package/dist/utils/omit.js +6 -8
- package/dist/utils/set.cjs +37 -51
- package/dist/utils/set.js +36 -53
- package/dist/utils/transition.cjs +76 -80
- package/dist/utils/transition.d.ts +2 -2
- package/dist/utils/transition.js +76 -84
- package/dist/utils/watchState.cjs +12 -14
- package/dist/utils/watchState.js +13 -16
- package/dist/vnode.cjs +48 -39
- package/dist/vnode.d.ts +1 -0
- package/dist/vnode.js +47 -43
- package/dist/vueuse/unref-element.cjs +3 -5
- package/dist/vueuse/unref-element.js +3 -5
- package/dist/warning.cjs +21 -29
- package/dist/warning.js +20 -36
- package/package.json +1 -1
package/dist/PortalWrapper.js
CHANGED
|
@@ -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
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
10
|
+
return process.env.NODE_ENV === "test" ? openCount : 0;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
var cacheOverflow = {};
|
|
13
13
|
function getParent(getContainer) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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 };
|
package/dist/classnames.cjs
CHANGED
|
@@ -1,44 +1,36 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
function toVal(mix) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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;
|
package/dist/classnames.js
CHANGED
|
@@ -1,45 +1,35 @@
|
|
|
1
1
|
function toVal(mix) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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 };
|
package/dist/composeProps.cjs
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
"
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
16
|
+
var composeProps_default = composeProps;
|
|
17
|
+
exports.default = composeProps_default;
|
package/dist/composeProps.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
function composeProps(originProps, patchProps, isAll) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
15
|
+
var composeProps_default = composeProps;
|
|
16
|
+
export { composeProps_default as default };
|
package/dist/createRef.cjs
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
function createRef() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const func = (node) => {
|
|
4
|
+
func.current = node;
|
|
5
|
+
};
|
|
6
|
+
return func;
|
|
8
7
|
}
|
|
9
8
|
function fillRef(ref, node) {
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 =
|
|
21
|
+
exports.default = createRef_default;
|
|
24
22
|
exports.fillRef = fillRef;
|
package/dist/createRef.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
function createRef() {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const func = (node) => {
|
|
3
|
+
func.current = node;
|
|
4
|
+
};
|
|
5
|
+
return func;
|
|
6
6
|
}
|
|
7
7
|
function fillRef(ref, node) {
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
return (node) => {
|
|
13
|
+
refs.forEach((ref) => {
|
|
14
|
+
fillRef(ref, node);
|
|
15
|
+
});
|
|
16
|
+
};
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
createRef as default,
|
|
23
|
-
fillRef
|
|
24
|
-
};
|
|
18
|
+
var createRef_default = createRef;
|
|
19
|
+
export { composeRef, createRef_default as default, fillRef };
|