@v-c/tour 1.0.2 → 1.1.0-rc.1
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/Mask.d.ts +4 -0
- package/dist/Mask.js +14 -5
- package/dist/Placeholder.js +6 -6
- package/dist/Tour.js +53 -10
- package/dist/TourStep/DefaultPanel.js +9 -5
- package/dist/TourStep/index.js +7 -6
- package/dist/hooks/useClosable.js +6 -0
- package/dist/hooks/useTarget.js +2 -0
- package/dist/index.js +4 -2
- package/dist/interface.d.ts +2 -1
- package/dist/placements.js +6 -4
- package/dist/util.js +2 -0
- package/package.json +5 -5
- package/dist/Mask.cjs +0 -165
- package/dist/Placeholder.cjs +0 -61
- package/dist/Tour.cjs +0 -335
- package/dist/TourStep/DefaultPanel.cjs +0 -206
- package/dist/TourStep/index.cjs +0 -162
- package/dist/_virtual/rolldown_runtime.cjs +0 -21
- package/dist/hooks/useClosable.cjs +0 -24
- package/dist/hooks/useTarget.cjs +0 -82
- package/dist/index.cjs +0 -7
- package/dist/interface.cjs +0 -1
- package/dist/placements.cjs +0 -66
- package/dist/util.cjs +0 -12
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
function isConfigObj(closable) {
|
|
5
|
-
return closable !== null && typeof closable === "object";
|
|
6
|
-
}
|
|
7
|
-
function getClosableConfig(closable, closeIcon, preset) {
|
|
8
|
-
if (closable === false || closeIcon === false && (!isConfigObj(closable) || !closable?.closeIcon)) return null;
|
|
9
|
-
const mergedCloseIcon = typeof closeIcon !== "boolean" ? closeIcon : void 0;
|
|
10
|
-
if (isConfigObj(closable)) return {
|
|
11
|
-
...closable,
|
|
12
|
-
closeIcon: closable?.closeIcon ?? mergedCloseIcon
|
|
13
|
-
};
|
|
14
|
-
return preset || closable || closeIcon ? { closeIcon: mergedCloseIcon } : "empty";
|
|
15
|
-
}
|
|
16
|
-
function useClosable(stepClosable, stepCloseIcon, closable, closeIcon) {
|
|
17
|
-
return (0, vue.computed)(() => {
|
|
18
|
-
const stepClosableConfig = getClosableConfig(stepClosable.value, stepCloseIcon.value, false);
|
|
19
|
-
const rootCloseableConfig = getClosableConfig(closable.value, closeIcon.value, true);
|
|
20
|
-
if (stepClosableConfig !== "empty") return stepClosableConfig;
|
|
21
|
-
return rootCloseableConfig;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
exports.useClosable = useClosable;
|
package/dist/hooks/useTarget.cjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_util = require("../util.cjs");
|
|
7
|
-
let vue = require("vue");
|
|
8
|
-
let _v_c_util_dist_Dom_canUseDom = require("@v-c/util/dist/Dom/canUseDom");
|
|
9
|
-
_v_c_util_dist_Dom_canUseDom = require_rolldown_runtime.__toESM(_v_c_util_dist_Dom_canUseDom);
|
|
10
|
-
let _v_c_util_dist_vnode = require("@v-c/util/dist/vnode");
|
|
11
|
-
function isValidNumber(val) {
|
|
12
|
-
return typeof val === "number" && !Number.isNaN(val);
|
|
13
|
-
}
|
|
14
|
-
function useTarget(target, open, gap, scrollIntoViewOptions, inlineMode, placeholderRef) {
|
|
15
|
-
const targetElement = (0, vue.shallowRef)(null);
|
|
16
|
-
const syncTargetElement = () => {
|
|
17
|
-
targetElement.value = (0, _v_c_util_dist_vnode.resolveToElement)((typeof target.value === "function" ? target.value() : target.value) || null);
|
|
18
|
-
};
|
|
19
|
-
(0, vue.watch)(target, () => {
|
|
20
|
-
if (!(0, _v_c_util_dist_Dom_canUseDom.default)()) return;
|
|
21
|
-
syncTargetElement();
|
|
22
|
-
}, {
|
|
23
|
-
immediate: true,
|
|
24
|
-
flush: "post"
|
|
25
|
-
});
|
|
26
|
-
const posInfo = (0, vue.shallowRef)(null);
|
|
27
|
-
const updatePos = () => {
|
|
28
|
-
if (targetElement.value) {
|
|
29
|
-
if (!inlineMode?.value && !require_util.isInViewPort(targetElement.value) && open.value) targetElement.value?.scrollIntoView(scrollIntoViewOptions.value);
|
|
30
|
-
const { left, top, width, height } = targetElement.value.getBoundingClientRect();
|
|
31
|
-
const nextPosInfo = {
|
|
32
|
-
left,
|
|
33
|
-
top,
|
|
34
|
-
width,
|
|
35
|
-
height,
|
|
36
|
-
radius: 0
|
|
37
|
-
};
|
|
38
|
-
if (inlineMode?.value) {
|
|
39
|
-
const parentRect = placeholderRef?.value?.parentElement?.getBoundingClientRect?.();
|
|
40
|
-
if (parentRect) {
|
|
41
|
-
nextPosInfo.left -= parentRect.left;
|
|
42
|
-
nextPosInfo.top -= parentRect.top;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const origin = posInfo.value;
|
|
46
|
-
if (JSON.stringify(origin) !== JSON.stringify(nextPosInfo)) posInfo.value = nextPosInfo;
|
|
47
|
-
} else posInfo.value = null;
|
|
48
|
-
};
|
|
49
|
-
(0, vue.onMounted)(() => {
|
|
50
|
-
syncTargetElement();
|
|
51
|
-
updatePos();
|
|
52
|
-
});
|
|
53
|
-
const getGapOffset = (index) => (Array.isArray(gap?.value?.offset) ? gap?.value?.offset[index] : gap?.value?.offset) ?? 6;
|
|
54
|
-
(0, vue.watch)([targetElement, open], async (_n, _o, onCleanup) => {
|
|
55
|
-
if (!(0, _v_c_util_dist_Dom_canUseDom.default)()) return;
|
|
56
|
-
await (0, vue.nextTick)();
|
|
57
|
-
updatePos();
|
|
58
|
-
window.addEventListener("resize", updatePos);
|
|
59
|
-
window.addEventListener("scroll", updatePos);
|
|
60
|
-
onCleanup(() => {
|
|
61
|
-
window.removeEventListener("resize", updatePos);
|
|
62
|
-
window.removeEventListener("scroll", updatePos);
|
|
63
|
-
});
|
|
64
|
-
}, {
|
|
65
|
-
immediate: true,
|
|
66
|
-
flush: "post"
|
|
67
|
-
});
|
|
68
|
-
return [(0, vue.computed)(() => {
|
|
69
|
-
if (!posInfo.value) return posInfo.value;
|
|
70
|
-
const gapOffsetX = getGapOffset(0);
|
|
71
|
-
const gapOffsetY = getGapOffset(1);
|
|
72
|
-
const gapRadius = isValidNumber(gap?.value?.radius) ? gap?.value?.radius : 2;
|
|
73
|
-
return {
|
|
74
|
-
left: posInfo.value.left - gapOffsetX,
|
|
75
|
-
top: posInfo.value.top - gapOffsetY,
|
|
76
|
-
width: posInfo.value.width + gapOffsetX * 2,
|
|
77
|
-
height: posInfo.value.height + gapOffsetY * 2,
|
|
78
|
-
radius: gapRadius
|
|
79
|
-
};
|
|
80
|
-
}), targetElement];
|
|
81
|
-
}
|
|
82
|
-
exports.default = useTarget;
|
package/dist/index.cjs
DELETED
package/dist/interface.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
package/dist/placements.cjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
var targetOffset = [0, 0];
|
|
3
|
-
var basePlacements = {
|
|
4
|
-
left: {
|
|
5
|
-
points: ["cr", "cl"],
|
|
6
|
-
offset: [-8, 0]
|
|
7
|
-
},
|
|
8
|
-
right: {
|
|
9
|
-
points: ["cl", "cr"],
|
|
10
|
-
offset: [8, 0]
|
|
11
|
-
},
|
|
12
|
-
top: {
|
|
13
|
-
points: ["bc", "tc"],
|
|
14
|
-
offset: [0, -8]
|
|
15
|
-
},
|
|
16
|
-
bottom: {
|
|
17
|
-
points: ["tc", "bc"],
|
|
18
|
-
offset: [0, 8]
|
|
19
|
-
},
|
|
20
|
-
topLeft: {
|
|
21
|
-
points: ["bl", "tl"],
|
|
22
|
-
offset: [0, -8]
|
|
23
|
-
},
|
|
24
|
-
leftTop: {
|
|
25
|
-
points: ["tr", "tl"],
|
|
26
|
-
offset: [-8, 0]
|
|
27
|
-
},
|
|
28
|
-
topRight: {
|
|
29
|
-
points: ["br", "tr"],
|
|
30
|
-
offset: [0, -8]
|
|
31
|
-
},
|
|
32
|
-
rightTop: {
|
|
33
|
-
points: ["tl", "tr"],
|
|
34
|
-
offset: [8, 0]
|
|
35
|
-
},
|
|
36
|
-
bottomRight: {
|
|
37
|
-
points: ["tr", "br"],
|
|
38
|
-
offset: [0, 8]
|
|
39
|
-
},
|
|
40
|
-
rightBottom: {
|
|
41
|
-
points: ["bl", "br"],
|
|
42
|
-
offset: [8, 0]
|
|
43
|
-
},
|
|
44
|
-
bottomLeft: {
|
|
45
|
-
points: ["tl", "bl"],
|
|
46
|
-
offset: [0, 8]
|
|
47
|
-
},
|
|
48
|
-
leftBottom: {
|
|
49
|
-
points: ["br", "bl"],
|
|
50
|
-
offset: [-8, 0]
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
function getPlacements(arrowPointAtCenter = false) {
|
|
54
|
-
const placements$1 = {};
|
|
55
|
-
Object.keys(basePlacements).forEach((key) => {
|
|
56
|
-
placements$1[key] = {
|
|
57
|
-
...basePlacements[key],
|
|
58
|
-
autoArrow: arrowPointAtCenter,
|
|
59
|
-
targetOffset
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
return placements$1;
|
|
63
|
-
}
|
|
64
|
-
const placements = getPlacements();
|
|
65
|
-
exports.getPlacements = getPlacements;
|
|
66
|
-
exports.placements = placements;
|
package/dist/util.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
function isInViewPort(element) {
|
|
3
|
-
const viewWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
4
|
-
const viewHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
5
|
-
const { top, right, bottom, left } = element.getBoundingClientRect();
|
|
6
|
-
return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
|
|
7
|
-
}
|
|
8
|
-
function getPlacement(targetElement, placement, stepPlacement) {
|
|
9
|
-
return stepPlacement ?? placement ?? (targetElement === null ? "center" : "bottom");
|
|
10
|
-
}
|
|
11
|
-
exports.getPlacement = getPlacement;
|
|
12
|
-
exports.isInViewPort = isInViewPort;
|