@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/debug/diff.cjs
CHANGED
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
function createArray() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
const arr = [];
|
|
4
|
+
arr.__proto__ = [];
|
|
5
|
+
arr.__proto__.format = function toString() {
|
|
6
|
+
return this.map((obj) => ({
|
|
7
|
+
...obj,
|
|
8
|
+
path: obj.path.join(" > ")
|
|
9
|
+
}));
|
|
10
|
+
};
|
|
11
|
+
arr.__proto__.toString = function toString() {
|
|
12
|
+
return JSON.stringify(this.format(), null, 2);
|
|
13
|
+
};
|
|
14
|
+
return arr;
|
|
16
15
|
}
|
|
17
16
|
function diff(obj1, obj2, depth = 10, path = [], diffList = createArray()) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
value1,
|
|
45
|
-
value2
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
return diffList;
|
|
17
|
+
if (depth <= 0) return diffList;
|
|
18
|
+
new Set([...Object.keys(obj1), ...Object.keys(obj2)]).forEach((key) => {
|
|
19
|
+
const value1 = obj1[key];
|
|
20
|
+
const value2 = obj2[key];
|
|
21
|
+
if (value1 === value2) return;
|
|
22
|
+
const type1 = typeof value1;
|
|
23
|
+
if (type1 !== typeof value2) {
|
|
24
|
+
diffList.push({
|
|
25
|
+
path: path.concat(key),
|
|
26
|
+
value1,
|
|
27
|
+
value2
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (Number.isNaN(value1) && Number.isNaN(value2)) return;
|
|
32
|
+
if (type1 === "object" && value1 !== null && value2 !== null) {
|
|
33
|
+
diff(value1, value2, depth - 1, path.concat(key), diffList);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
diffList.push({
|
|
37
|
+
path: path.concat(key),
|
|
38
|
+
value1,
|
|
39
|
+
value2
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
return diffList;
|
|
49
43
|
}
|
|
50
44
|
exports.default = diff;
|
package/dist/debug/diff.js
CHANGED
|
@@ -1,50 +1,43 @@
|
|
|
1
1
|
function createArray() {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
const arr = [];
|
|
3
|
+
arr.__proto__ = [];
|
|
4
|
+
arr.__proto__.format = function toString() {
|
|
5
|
+
return this.map((obj) => ({
|
|
6
|
+
...obj,
|
|
7
|
+
path: obj.path.join(" > ")
|
|
8
|
+
}));
|
|
9
|
+
};
|
|
10
|
+
arr.__proto__.toString = function toString() {
|
|
11
|
+
return JSON.stringify(this.format(), null, 2);
|
|
12
|
+
};
|
|
13
|
+
return arr;
|
|
14
14
|
}
|
|
15
15
|
function diff(obj1, obj2, depth = 10, path = [], diffList = createArray()) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
value1,
|
|
43
|
-
value2
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
return diffList;
|
|
16
|
+
if (depth <= 0) return diffList;
|
|
17
|
+
new Set([...Object.keys(obj1), ...Object.keys(obj2)]).forEach((key) => {
|
|
18
|
+
const value1 = obj1[key];
|
|
19
|
+
const value2 = obj2[key];
|
|
20
|
+
if (value1 === value2) return;
|
|
21
|
+
const type1 = typeof value1;
|
|
22
|
+
if (type1 !== typeof value2) {
|
|
23
|
+
diffList.push({
|
|
24
|
+
path: path.concat(key),
|
|
25
|
+
value1,
|
|
26
|
+
value2
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (Number.isNaN(value1) && Number.isNaN(value2)) return;
|
|
31
|
+
if (type1 === "object" && value1 !== null && value2 !== null) {
|
|
32
|
+
diff(value1, value2, depth - 1, path.concat(key), diffList);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
diffList.push({
|
|
36
|
+
path: path.concat(key),
|
|
37
|
+
value1,
|
|
38
|
+
value2
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
return diffList;
|
|
47
42
|
}
|
|
48
|
-
export {
|
|
49
|
-
diff as default
|
|
50
|
-
};
|
|
43
|
+
export { diff as default };
|
package/dist/deprecated.cjs
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
function deprecated(props, instead, component) {
|
|
4
|
-
|
|
5
|
-
window.console.error(
|
|
6
|
-
`Warning: ${props} is deprecated at [ ${component} ], use [ ${instead} ] instead of it.`
|
|
7
|
-
);
|
|
8
|
-
}
|
|
3
|
+
if (typeof window !== "undefined" && window.console && window.console.error) window.console.error(`Warning: ${props} is deprecated at [ ${component} ], use [ ${instead} ] instead of it.`);
|
|
9
4
|
}
|
|
10
5
|
exports.default = deprecated;
|
package/dist/deprecated.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
function deprecated(props, instead, component) {
|
|
2
|
-
|
|
3
|
-
window.console.error(
|
|
4
|
-
`Warning: ${props} is deprecated at [ ${component} ], use [ ${instead} ] instead of it.`
|
|
5
|
-
);
|
|
6
|
-
}
|
|
2
|
+
if (typeof window !== "undefined" && window.console && window.console.error) window.console.error(`Warning: ${props} is deprecated at [ ${component} ], use [ ${instead} ] instead of it.`);
|
|
7
3
|
}
|
|
8
|
-
export {
|
|
9
|
-
deprecated as default
|
|
10
|
-
};
|
|
4
|
+
export { deprecated as default };
|
|
@@ -1,51 +1,47 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
let cached;
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
var cached;
|
|
4
3
|
function getScrollBarSize(fresh) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
if (typeof document === "undefined") return 0;
|
|
5
|
+
if (fresh || cached === void 0) {
|
|
6
|
+
const inner = document.createElement("div");
|
|
7
|
+
inner.style.width = "100%";
|
|
8
|
+
inner.style.height = "200px";
|
|
9
|
+
const outer = document.createElement("div");
|
|
10
|
+
const outerStyle = outer.style;
|
|
11
|
+
outerStyle.position = "absolute";
|
|
12
|
+
outerStyle.top = "0";
|
|
13
|
+
outerStyle.left = "0";
|
|
14
|
+
outerStyle.pointerEvents = "none";
|
|
15
|
+
outerStyle.visibility = "hidden";
|
|
16
|
+
outerStyle.width = "200px";
|
|
17
|
+
outerStyle.height = "150px";
|
|
18
|
+
outerStyle.overflow = "hidden";
|
|
19
|
+
outer.appendChild(inner);
|
|
20
|
+
document.body.appendChild(outer);
|
|
21
|
+
const widthContained = inner.offsetWidth;
|
|
22
|
+
outer.style.overflow = "scroll";
|
|
23
|
+
let widthScroll = inner.offsetWidth;
|
|
24
|
+
if (widthContained === widthScroll) widthScroll = outer.clientWidth;
|
|
25
|
+
document.body.removeChild(outer);
|
|
26
|
+
cached = widthContained - widthScroll;
|
|
27
|
+
}
|
|
28
|
+
return cached;
|
|
30
29
|
}
|
|
31
30
|
function ensureSize(str) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const match = str.match(/^(.*)px$/);
|
|
32
|
+
const value = Number(match?.[1]);
|
|
33
|
+
return Number.isNaN(value) ? getScrollBarSize() : value;
|
|
35
34
|
}
|
|
36
35
|
function getTargetScrollBarSize(target) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
width: ensureSize(width),
|
|
47
|
-
height: ensureSize(height)
|
|
48
|
-
};
|
|
36
|
+
if (typeof document === "undefined" || !target || !(target instanceof Element)) return {
|
|
37
|
+
width: 0,
|
|
38
|
+
height: 0
|
|
39
|
+
};
|
|
40
|
+
const { width, height } = getComputedStyle(target, "::-webkit-scrollbar");
|
|
41
|
+
return {
|
|
42
|
+
width: ensureSize(width),
|
|
43
|
+
height: ensureSize(height)
|
|
44
|
+
};
|
|
49
45
|
}
|
|
50
46
|
exports.default = getScrollBarSize;
|
|
51
47
|
exports.getTargetScrollBarSize = getTargetScrollBarSize;
|
package/dist/getScrollBarSize.js
CHANGED
|
@@ -1,51 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
var cached;
|
|
2
2
|
function getScrollBarSize(fresh) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
3
|
+
if (typeof document === "undefined") return 0;
|
|
4
|
+
if (fresh || cached === void 0) {
|
|
5
|
+
const inner = document.createElement("div");
|
|
6
|
+
inner.style.width = "100%";
|
|
7
|
+
inner.style.height = "200px";
|
|
8
|
+
const outer = document.createElement("div");
|
|
9
|
+
const outerStyle = outer.style;
|
|
10
|
+
outerStyle.position = "absolute";
|
|
11
|
+
outerStyle.top = "0";
|
|
12
|
+
outerStyle.left = "0";
|
|
13
|
+
outerStyle.pointerEvents = "none";
|
|
14
|
+
outerStyle.visibility = "hidden";
|
|
15
|
+
outerStyle.width = "200px";
|
|
16
|
+
outerStyle.height = "150px";
|
|
17
|
+
outerStyle.overflow = "hidden";
|
|
18
|
+
outer.appendChild(inner);
|
|
19
|
+
document.body.appendChild(outer);
|
|
20
|
+
const widthContained = inner.offsetWidth;
|
|
21
|
+
outer.style.overflow = "scroll";
|
|
22
|
+
let widthScroll = inner.offsetWidth;
|
|
23
|
+
if (widthContained === widthScroll) widthScroll = outer.clientWidth;
|
|
24
|
+
document.body.removeChild(outer);
|
|
25
|
+
cached = widthContained - widthScroll;
|
|
26
|
+
}
|
|
27
|
+
return cached;
|
|
28
28
|
}
|
|
29
29
|
function ensureSize(str) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const match = str.match(/^(.*)px$/);
|
|
31
|
+
const value = Number(match?.[1]);
|
|
32
|
+
return Number.isNaN(value) ? getScrollBarSize() : value;
|
|
33
33
|
}
|
|
34
34
|
function getTargetScrollBarSize(target) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
width: ensureSize(width),
|
|
45
|
-
height: ensureSize(height)
|
|
46
|
-
};
|
|
35
|
+
if (typeof document === "undefined" || !target || !(target instanceof Element)) return {
|
|
36
|
+
width: 0,
|
|
37
|
+
height: 0
|
|
38
|
+
};
|
|
39
|
+
const { width, height } = getComputedStyle(target, "::-webkit-scrollbar");
|
|
40
|
+
return {
|
|
41
|
+
width: ensureSize(width),
|
|
42
|
+
height: ensureSize(height)
|
|
43
|
+
};
|
|
47
44
|
}
|
|
48
|
-
export {
|
|
49
|
-
getScrollBarSize as default,
|
|
50
|
-
getTargetScrollBarSize
|
|
51
|
-
};
|
|
45
|
+
export { getScrollBarSize as default, getTargetScrollBarSize };
|
package/dist/guid.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
let seed = 0;
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
var seed = 0;
|
|
4
3
|
function guid() {
|
|
5
|
-
|
|
4
|
+
return `${Date.now()}_${seed++}`;
|
|
6
5
|
}
|
|
7
6
|
exports.default = guid;
|
package/dist/guid.js
CHANGED
package/dist/hooks/useEvent.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
function useEvent(callback) {
|
|
4
|
-
|
|
3
|
+
return callback;
|
|
5
4
|
}
|
|
6
5
|
exports.default = useEvent;
|
package/dist/hooks/useEvent.js
CHANGED
package/dist/hooks/useId.cjs
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
const vue = require("vue");
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
let vue = require("vue");
|
|
4
3
|
function getUseId() {
|
|
5
|
-
|
|
4
|
+
return vue.useId;
|
|
6
5
|
}
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (process.env.NODE_ENV === "test") {
|
|
14
|
-
return "test-id";
|
|
15
|
-
}
|
|
16
|
-
return vueId;
|
|
6
|
+
var useOriginalId = getUseId();
|
|
7
|
+
function useId_default(id) {
|
|
8
|
+
const vueId = useOriginalId();
|
|
9
|
+
if (id) return id;
|
|
10
|
+
if (process.env.NODE_ENV === "test") return "test-id";
|
|
11
|
+
return vueId;
|
|
17
12
|
}
|
|
18
|
-
exports.default =
|
|
13
|
+
exports.default = useId_default;
|
package/dist/hooks/useId.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import { useId
|
|
1
|
+
import { useId } from "vue";
|
|
2
2
|
function getUseId() {
|
|
3
|
-
|
|
3
|
+
return useId;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (process.env.NODE_ENV === "test") {
|
|
12
|
-
return "test-id";
|
|
13
|
-
}
|
|
14
|
-
return vueId;
|
|
5
|
+
var useOriginalId = getUseId();
|
|
6
|
+
function useId_default(id) {
|
|
7
|
+
const vueId = useOriginalId();
|
|
8
|
+
if (id) return id;
|
|
9
|
+
if (process.env.NODE_ENV === "test") return "test-id";
|
|
10
|
+
return vueId;
|
|
15
11
|
}
|
|
16
|
-
export {
|
|
17
|
-
useId as default
|
|
18
|
-
};
|
|
12
|
+
export { useId_default as default };
|
|
@@ -1,58 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const vue = require("vue");
|
|
1
|
+
let vue = require("vue");
|
|
4
2
|
function useLayoutEffect(callback, deps = []) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
vue.onUpdated(() => {
|
|
29
|
-
if (close) {
|
|
30
|
-
close?.();
|
|
31
|
-
}
|
|
32
|
-
if (typeof callback === "function") {
|
|
33
|
-
close = callback();
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
vue.onUnmounted(() => {
|
|
38
|
-
if (close) {
|
|
39
|
-
close?.();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
3
|
+
let close = null;
|
|
4
|
+
if (deps && deps.length) (0, vue.watch)(deps, async () => {
|
|
5
|
+
if (close) close?.();
|
|
6
|
+
await (0, vue.nextTick)();
|
|
7
|
+
if (typeof callback === "function") close = callback();
|
|
8
|
+
}, {
|
|
9
|
+
immediate: true,
|
|
10
|
+
flush: "post"
|
|
11
|
+
});
|
|
12
|
+
else {
|
|
13
|
+
(0, vue.onMounted)(() => {
|
|
14
|
+
if (close) close?.();
|
|
15
|
+
if (typeof callback === "function") close = callback();
|
|
16
|
+
});
|
|
17
|
+
(0, vue.onUpdated)(() => {
|
|
18
|
+
if (close) close?.();
|
|
19
|
+
if (typeof callback === "function") close = callback();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
(0, vue.onUnmounted)(() => {
|
|
23
|
+
if (close) close?.();
|
|
24
|
+
});
|
|
42
25
|
}
|
|
43
26
|
function useLayoutUpdateEffect(callback, deps) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (typeof callback === "function") {
|
|
51
|
-
close = callback();
|
|
52
|
-
}
|
|
53
|
-
}, {
|
|
54
|
-
flush: "post"
|
|
55
|
-
});
|
|
27
|
+
let close = null;
|
|
28
|
+
(0, vue.watch)(deps, async () => {
|
|
29
|
+
if (close) close?.();
|
|
30
|
+
await (0, vue.nextTick)();
|
|
31
|
+
if (typeof callback === "function") close = callback();
|
|
32
|
+
}, { flush: "post" });
|
|
56
33
|
}
|
|
57
34
|
exports.useLayoutEffect = useLayoutEffect;
|
|
58
35
|
exports.useLayoutUpdateEffect = useLayoutUpdateEffect;
|