@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
package/dist/Mask.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export interface MaskProps {
|
|
|
16
16
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
17
17
|
styles?: Partial<Record<SemanticName, CSSProperties>>;
|
|
18
18
|
getPopupContainer?: TourProps['getPopupContainer'];
|
|
19
|
+
onEsc?: (info: {
|
|
20
|
+
top: boolean;
|
|
21
|
+
event: KeyboardEvent;
|
|
22
|
+
}) => void;
|
|
19
23
|
}
|
|
20
24
|
declare const Mask: import('vue').DefineSetupFnComponent<MaskProps, {}, {}, MaskProps & {}, import('vue').PublicProps>;
|
|
21
25
|
export default Mask;
|
package/dist/Mask.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Fragment, createVNode, defineComponent, mergeProps, useId } from "vue";
|
|
2
2
|
import Portal from "@v-c/portal";
|
|
3
3
|
import { clsx } from "@v-c/util";
|
|
4
|
+
//#region src/Mask.tsx
|
|
4
5
|
var COVER_PROPS = {
|
|
5
6
|
"fill": "transparent",
|
|
6
7
|
"pointer-events": "auto"
|
|
7
8
|
};
|
|
8
|
-
var
|
|
9
|
+
var Mask = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
9
10
|
const id = useId();
|
|
10
11
|
const isSafari = typeof navigator !== "undefined" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
11
12
|
return () => {
|
|
12
|
-
const { prefixCls, rootClassName, pos, showMask, fill = "rgba(0,0,0,0.5)", open, animated, zIndex, disabledInteraction, styles, classNames: tourClassNames, getPopupContainer } = props;
|
|
13
|
+
const { prefixCls, rootClassName, pos, showMask, fill = "rgba(0,0,0,0.5)", open, animated, zIndex, disabledInteraction, styles, classNames: tourClassNames, getPopupContainer, onEsc } = props;
|
|
13
14
|
const maskId = `${prefixCls}-mask-${id}`;
|
|
14
15
|
const mergedAnimated = typeof animated === "object" ? animated?.placeholder : animated;
|
|
15
16
|
const maskRectSize = isSafari ? {
|
|
@@ -23,7 +24,8 @@ var Mask_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
23
24
|
return createVNode(Portal, {
|
|
24
25
|
"open": open,
|
|
25
26
|
"autoLock": !inlineMode,
|
|
26
|
-
"getContainer": getPopupContainer
|
|
27
|
+
"getContainer": getPopupContainer,
|
|
28
|
+
"onEsc": onEsc
|
|
27
29
|
}, { default: () => [createVNode("div", {
|
|
28
30
|
"class": clsx(`${prefixCls}-mask`, rootClassName, tourClassNames?.mask),
|
|
29
31
|
"style": {
|
|
@@ -147,7 +149,13 @@ var Mask_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
147
149
|
default: void 0
|
|
148
150
|
},
|
|
149
151
|
getPopupContainer: {
|
|
150
|
-
type:
|
|
152
|
+
type: Boolean,
|
|
153
|
+
required: false,
|
|
154
|
+
skipCheck: true,
|
|
155
|
+
default: void 0
|
|
156
|
+
},
|
|
157
|
+
onEsc: {
|
|
158
|
+
type: Function,
|
|
151
159
|
required: false,
|
|
152
160
|
default: void 0
|
|
153
161
|
}
|
|
@@ -155,4 +163,5 @@ var Mask_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
155
163
|
name: "TourMask",
|
|
156
164
|
inheritAttrs: false
|
|
157
165
|
});
|
|
158
|
-
|
|
166
|
+
//#endregion
|
|
167
|
+
export { Mask as default };
|
package/dist/Placeholder.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, createVNode, defineComponent, mergeProps } from "vue";
|
|
2
2
|
import Portal from "@v-c/portal";
|
|
3
|
-
|
|
3
|
+
//#region src/Placeholder.tsx
|
|
4
|
+
var Placeholder = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
|
|
4
5
|
expose({
|
|
5
6
|
getDom: () => {
|
|
6
7
|
return props?.domRef.value ?? props?.fallbackDOM?.();
|
|
@@ -19,13 +20,11 @@ var Placeholder_default = /* @__PURE__ */ defineComponent((props, { expose, attr
|
|
|
19
20
|
props: {
|
|
20
21
|
domRef: {
|
|
21
22
|
type: Object,
|
|
22
|
-
required: true
|
|
23
|
-
default: void 0
|
|
23
|
+
required: true
|
|
24
24
|
},
|
|
25
25
|
fallbackDOM: {
|
|
26
26
|
type: Function,
|
|
27
|
-
required: true
|
|
28
|
-
default: void 0
|
|
27
|
+
required: true
|
|
29
28
|
},
|
|
30
29
|
open: {
|
|
31
30
|
type: Boolean,
|
|
@@ -51,4 +50,5 @@ var Placeholder_default = /* @__PURE__ */ defineComponent((props, { expose, attr
|
|
|
51
50
|
name: "TourPlaceholder",
|
|
52
51
|
inheritAttrs: false
|
|
53
52
|
});
|
|
54
|
-
|
|
53
|
+
//#endregion
|
|
54
|
+
export { Placeholder as default };
|
package/dist/Tour.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import Mask from "./Mask.js";
|
|
2
|
+
import Placeholder from "./Placeholder.js";
|
|
3
3
|
import { useClosable } from "./hooks/useClosable.js";
|
|
4
4
|
import { getPlacement } from "./util.js";
|
|
5
5
|
import useTarget from "./hooks/useTarget.js";
|
|
6
6
|
import { getPlacements } from "./placements.js";
|
|
7
|
-
import
|
|
8
|
-
import { Fragment, computed, createVNode, defineComponent, mergeProps, nextTick, shallowRef, unref, watch } from "vue";
|
|
7
|
+
import TourStep from "./TourStep/index.js";
|
|
8
|
+
import { Fragment, computed, createVNode, defineComponent, mergeProps, nextTick, onBeforeUnmount, shallowRef, unref, watch } from "vue";
|
|
9
9
|
import { clsx } from "@v-c/util";
|
|
10
10
|
import { Trigger } from "@v-c/trigger";
|
|
11
|
+
//#region src/Tour.tsx
|
|
11
12
|
var CENTER_PLACEHOLDER = {
|
|
12
13
|
left: "50%",
|
|
13
14
|
top: "50%",
|
|
@@ -18,7 +19,7 @@ var defaultScrollIntoViewOptions = {
|
|
|
18
19
|
block: "center",
|
|
19
20
|
inline: "center"
|
|
20
21
|
};
|
|
21
|
-
var
|
|
22
|
+
var Tour = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
22
23
|
const triggerRef = shallowRef();
|
|
23
24
|
const placeholderRef = shallowRef(null);
|
|
24
25
|
const inlineMode = computed(() => props?.getPopupContainer === false);
|
|
@@ -87,6 +88,41 @@ var Tour_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
87
88
|
setInternalOpen(false);
|
|
88
89
|
props?.onClose?.(mergedCurrent.value);
|
|
89
90
|
};
|
|
91
|
+
const mergedKeyboard = computed(() => props?.keyboard ?? true);
|
|
92
|
+
const handleEscClose = ({ event }) => {
|
|
93
|
+
if (mergedKeyboard.value && mergedClosable.value !== null) {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
handleClose();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const isEditableTarget = (e) => {
|
|
99
|
+
const target = e.target;
|
|
100
|
+
if (!target) return false;
|
|
101
|
+
const tagName = target.tagName.toLowerCase();
|
|
102
|
+
return tagName === "input" || tagName === "textarea" || target.isContentEditable;
|
|
103
|
+
};
|
|
104
|
+
const keyboardHandler = (e) => {
|
|
105
|
+
if (isEditableTarget(e)) return;
|
|
106
|
+
if (mergedKeyboard.value && e.key === "ArrowLeft" && mergedCurrent.value > 0) {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
onInternalChange(mergedCurrent.value - 1);
|
|
109
|
+
}
|
|
110
|
+
if (mergedKeyboard.value && e.key === "ArrowRight" && mergedCurrent.value < steps.value.length - 1) {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
onInternalChange(mergedCurrent.value + 1);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
watch(mergedOpen, (open, _, onCleanup) => {
|
|
116
|
+
if (open) {
|
|
117
|
+
window.addEventListener("keydown", keyboardHandler);
|
|
118
|
+
onCleanup(() => {
|
|
119
|
+
window.removeEventListener("keydown", keyboardHandler);
|
|
120
|
+
});
|
|
121
|
+
} else window.removeEventListener("keydown", keyboardHandler);
|
|
122
|
+
}, { immediate: true });
|
|
123
|
+
onBeforeUnmount(() => {
|
|
124
|
+
window.removeEventListener("keydown", keyboardHandler);
|
|
125
|
+
});
|
|
90
126
|
const fallbackDOM = () => {
|
|
91
127
|
return targetElement.value || (typeof document !== "undefined" ? document.body : null);
|
|
92
128
|
};
|
|
@@ -109,7 +145,7 @@ var Tour_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
109
145
|
...style || {}
|
|
110
146
|
};
|
|
111
147
|
if (attrStyle && typeof attrStyle === "object") Object.assign(placeholderStyle, attrStyle);
|
|
112
|
-
const popupElement = createVNode(
|
|
148
|
+
const popupElement = createVNode(TourStep, mergeProps({
|
|
113
149
|
"styles": styles,
|
|
114
150
|
"classNames": classNames,
|
|
115
151
|
"arrow": mergedArrow.value,
|
|
@@ -131,7 +167,7 @@ var Tour_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
131
167
|
}
|
|
132
168
|
}, stepInfo.value, { "closable": mergedClosable.value }), null);
|
|
133
169
|
if (targetElement.value === void 0 || !hasOpened.value) return null;
|
|
134
|
-
return createVNode(Fragment, null, [createVNode(
|
|
170
|
+
return createVNode(Fragment, null, [createVNode(Mask, {
|
|
135
171
|
"getPopupContainer": getPopupContainer,
|
|
136
172
|
"styles": styles,
|
|
137
173
|
"classNames": classNames,
|
|
@@ -144,7 +180,8 @@ var Tour_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
144
180
|
"open": mergedOpen.value,
|
|
145
181
|
"animated": animated,
|
|
146
182
|
"rootClassName": rootClassName,
|
|
147
|
-
"disabledInteraction": disabledInteraction
|
|
183
|
+
"disabledInteraction": disabledInteraction,
|
|
184
|
+
"onEsc": handleEscClose
|
|
148
185
|
}, null), createVNode(Trigger, mergeProps(restAttrs, {
|
|
149
186
|
"getPopupContainer": getPopupContainer,
|
|
150
187
|
"builtinPlacements": mergedBuiltinPlacements.value,
|
|
@@ -160,7 +197,7 @@ var Tour_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
160
197
|
"zIndex": zIndex,
|
|
161
198
|
"arrow": !!mergedArrow.value,
|
|
162
199
|
"onPopupAlign": onPopupAlign
|
|
163
|
-
}), { default: () => [createVNode(
|
|
200
|
+
}), { default: () => [createVNode(Placeholder, {
|
|
164
201
|
"open": mergedOpen.value,
|
|
165
202
|
"autoLock": !inlineMode.value,
|
|
166
203
|
"getContainer": getPopupContainer,
|
|
@@ -317,6 +354,11 @@ var Tour_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
317
354
|
required: false,
|
|
318
355
|
default: void 0
|
|
319
356
|
},
|
|
357
|
+
keyboard: {
|
|
358
|
+
type: Boolean,
|
|
359
|
+
required: false,
|
|
360
|
+
default: void 0
|
|
361
|
+
},
|
|
320
362
|
onPopupAlign: {
|
|
321
363
|
type: Function,
|
|
322
364
|
required: false,
|
|
@@ -326,4 +368,5 @@ var Tour_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
326
368
|
name: "VcTour",
|
|
327
369
|
inheritAttrs: false
|
|
328
370
|
});
|
|
329
|
-
|
|
371
|
+
//#endregion
|
|
372
|
+
export { Tour as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createTextVNode, createVNode, defineComponent, mergeProps } from "vue";
|
|
2
2
|
import { clsx } from "@v-c/util";
|
|
3
3
|
import pickAttrs from "@v-c/util/dist/pickAttrs";
|
|
4
|
-
|
|
4
|
+
//#region src/TourStep/DefaultPanel.tsx
|
|
5
|
+
var DefaultPanel = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
5
6
|
return () => {
|
|
6
7
|
const { prefixCls, current, total, title, description, onClose, onPrev, onNext, onFinish, closable, classNames: tourClassNames, styles } = props;
|
|
7
8
|
const ariaProps = pickAttrs(closable || {}, true);
|
|
@@ -16,7 +17,10 @@ var DefaultPanel_default = /* @__PURE__ */ defineComponent((props, { attrs }) =>
|
|
|
16
17
|
"type": "button",
|
|
17
18
|
"onClick": onClose,
|
|
18
19
|
"aria-label": "Close"
|
|
19
|
-
}, ariaProps, {
|
|
20
|
+
}, ariaProps, {
|
|
21
|
+
"class": clsx(`${prefixCls}-close`, tourClassNames?.close),
|
|
22
|
+
"style": styles?.close
|
|
23
|
+
}), [closeIcon]),
|
|
20
24
|
createVNode("div", {
|
|
21
25
|
"class": clsx(`${prefixCls}-header`, tourClassNames?.header),
|
|
22
26
|
"style": styles?.header
|
|
@@ -128,8 +132,7 @@ var DefaultPanel_default = /* @__PURE__ */ defineComponent((props, { attrs }) =>
|
|
|
128
132
|
Boolean,
|
|
129
133
|
Array
|
|
130
134
|
],
|
|
131
|
-
required: true
|
|
132
|
-
default: void 0
|
|
135
|
+
required: true
|
|
133
136
|
},
|
|
134
137
|
description: {
|
|
135
138
|
type: [
|
|
@@ -196,4 +199,5 @@ var DefaultPanel_default = /* @__PURE__ */ defineComponent((props, { attrs }) =>
|
|
|
196
199
|
name: "TourDefaultPanel",
|
|
197
200
|
inheritAttrs: false
|
|
198
201
|
});
|
|
199
|
-
|
|
202
|
+
//#endregion
|
|
203
|
+
export { DefaultPanel as default };
|
package/dist/TourStep/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import DefaultPanel from "./DefaultPanel.js";
|
|
2
2
|
import { Fragment, createVNode, defineComponent } from "vue";
|
|
3
|
-
|
|
3
|
+
//#region src/TourStep/index.tsx
|
|
4
|
+
var TourStep = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
4
5
|
return () => {
|
|
5
6
|
const { current, renderPanel } = props;
|
|
6
7
|
return createVNode(Fragment, null, [typeof renderPanel === "function" ? renderPanel({
|
|
7
8
|
...props,
|
|
8
9
|
...attrs
|
|
9
|
-
}, current) : createVNode(
|
|
10
|
+
}, current) : createVNode(DefaultPanel, props, null)]);
|
|
10
11
|
};
|
|
11
12
|
}, {
|
|
12
13
|
props: {
|
|
@@ -85,8 +86,7 @@ var TourStep_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
85
86
|
Boolean,
|
|
86
87
|
Array
|
|
87
88
|
],
|
|
88
|
-
required: true
|
|
89
|
-
default: void 0
|
|
89
|
+
required: true
|
|
90
90
|
},
|
|
91
91
|
description: {
|
|
92
92
|
type: [
|
|
@@ -153,4 +153,5 @@ var TourStep_default = /* @__PURE__ */ defineComponent((props, { attrs }) => {
|
|
|
153
153
|
name: "TourStep",
|
|
154
154
|
inheritAttrs: false
|
|
155
155
|
});
|
|
156
|
-
|
|
156
|
+
//#endregion
|
|
157
|
+
export { TourStep as default };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
+
//#region src/hooks/useClosable.tsx
|
|
2
3
|
function isConfigObj(closable) {
|
|
3
4
|
return closable !== null && typeof closable === "object";
|
|
4
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Convert `closable` to ClosableConfig.
|
|
8
|
+
* When `preset` is true, will auto fill ClosableConfig with default value.
|
|
9
|
+
*/
|
|
5
10
|
function getClosableConfig(closable, closeIcon, preset) {
|
|
6
11
|
if (closable === false || closeIcon === false && (!isConfigObj(closable) || !closable?.closeIcon)) return null;
|
|
7
12
|
const mergedCloseIcon = typeof closeIcon !== "boolean" ? closeIcon : void 0;
|
|
@@ -19,4 +24,5 @@ function useClosable(stepClosable, stepCloseIcon, closable, closeIcon) {
|
|
|
19
24
|
return rootCloseableConfig;
|
|
20
25
|
});
|
|
21
26
|
}
|
|
27
|
+
//#endregion
|
|
22
28
|
export { useClosable };
|
package/dist/hooks/useTarget.js
CHANGED
|
@@ -2,6 +2,7 @@ import { isInViewPort } from "../util.js";
|
|
|
2
2
|
import { computed, nextTick, onMounted, shallowRef, watch } from "vue";
|
|
3
3
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
4
4
|
import { resolveToElement } from "@v-c/util/dist/vnode";
|
|
5
|
+
//#region src/hooks/useTarget.ts
|
|
5
6
|
function isValidNumber(val) {
|
|
6
7
|
return typeof val === "number" && !Number.isNaN(val);
|
|
7
8
|
}
|
|
@@ -73,4 +74,5 @@ function useTarget(target, open, gap, scrollIntoViewOptions, inlineMode, placeho
|
|
|
73
74
|
};
|
|
74
75
|
}), targetElement];
|
|
75
76
|
}
|
|
77
|
+
//#endregion
|
|
76
78
|
export { useTarget as default };
|
package/dist/index.js
CHANGED
package/dist/interface.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AriaAttributes, CSSProperties, Ref } from 'vue';
|
|
|
4
4
|
import { Gap } from './hooks/useTarget.ts';
|
|
5
5
|
import { PlacementType } from './placements';
|
|
6
6
|
import { DefaultPanelProps } from './TourStep/DefaultPanel.tsx';
|
|
7
|
-
export type SemanticName = 'section' | 'footer' | 'actions' | 'header' | 'title' | 'description' | 'mask';
|
|
7
|
+
export type SemanticName = 'section' | 'footer' | 'actions' | 'header' | 'title' | 'description' | 'mask' | 'close';
|
|
8
8
|
export type HTMLAriaDataAttributes = AriaAttributes & {
|
|
9
9
|
[key: `data-${string}`]: unknown;
|
|
10
10
|
role?: string;
|
|
@@ -78,4 +78,5 @@ export interface TourProps extends Pick<TriggerProps, 'onPopupAlign'> {
|
|
|
78
78
|
arrowPointAtCenter?: boolean;
|
|
79
79
|
}) => TriggerProps['builtinPlacements']);
|
|
80
80
|
disabledInteraction?: boolean;
|
|
81
|
+
keyboard?: boolean;
|
|
81
82
|
}
|
package/dist/placements.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/placements.tsx
|
|
1
2
|
var targetOffset = [0, 0];
|
|
2
3
|
var basePlacements = {
|
|
3
4
|
left: {
|
|
@@ -50,15 +51,16 @@ var basePlacements = {
|
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
function getPlacements(arrowPointAtCenter = false) {
|
|
53
|
-
const placements
|
|
54
|
+
const placements = {};
|
|
54
55
|
Object.keys(basePlacements).forEach((key) => {
|
|
55
|
-
placements
|
|
56
|
+
placements[key] = {
|
|
56
57
|
...basePlacements[key],
|
|
57
58
|
autoArrow: arrowPointAtCenter,
|
|
58
59
|
targetOffset
|
|
59
60
|
};
|
|
60
61
|
});
|
|
61
|
-
return placements
|
|
62
|
+
return placements;
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
var placements = getPlacements();
|
|
65
|
+
//#endregion
|
|
64
66
|
export { getPlacements, placements };
|
package/dist/util.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/util.ts
|
|
1
2
|
function isInViewPort(element) {
|
|
2
3
|
const viewWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
3
4
|
const viewHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
@@ -7,4 +8,5 @@ function isInViewPort(element) {
|
|
|
7
8
|
function getPlacement(targetElement, placement, stepPlacement) {
|
|
8
9
|
return stepPlacement ?? placement ?? (targetElement === null ? "center" : "bottom");
|
|
9
10
|
}
|
|
11
|
+
//#endregion
|
|
10
12
|
export { getPlacement, isInViewPort };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/tour",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.1.0-rc.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
".": {
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"import": "./dist/index.js",
|
|
18
|
-
"
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
19
|
},
|
|
20
20
|
"./dist/*": "./dist/*",
|
|
21
21
|
"./package.json": "./package.json"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"vue": "^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@v-c/portal": "^1.0.
|
|
33
|
-
"@v-c/trigger": "^1.0.
|
|
34
|
-
"@v-c/util": "^1.0.
|
|
32
|
+
"@v-c/portal": "^1.0.8",
|
|
33
|
+
"@v-c/trigger": "^1.0.14",
|
|
34
|
+
"@v-c/util": "^1.0.19"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "vite build",
|
package/dist/Mask.cjs
DELETED
|
@@ -1,165 +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
|
-
let vue = require("vue");
|
|
7
|
-
let _v_c_portal = require("@v-c/portal");
|
|
8
|
-
_v_c_portal = require_rolldown_runtime.__toESM(_v_c_portal);
|
|
9
|
-
let _v_c_util = require("@v-c/util");
|
|
10
|
-
var COVER_PROPS = {
|
|
11
|
-
"fill": "transparent",
|
|
12
|
-
"pointer-events": "auto"
|
|
13
|
-
};
|
|
14
|
-
var Mask = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs }) => {
|
|
15
|
-
const id = (0, vue.useId)();
|
|
16
|
-
const isSafari = typeof navigator !== "undefined" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
17
|
-
return () => {
|
|
18
|
-
const { prefixCls, rootClassName, pos, showMask, fill = "rgba(0,0,0,0.5)", open, animated, zIndex, disabledInteraction, styles, classNames: tourClassNames, getPopupContainer } = props;
|
|
19
|
-
const maskId = `${prefixCls}-mask-${id}`;
|
|
20
|
-
const mergedAnimated = typeof animated === "object" ? animated?.placeholder : animated;
|
|
21
|
-
const maskRectSize = isSafari ? {
|
|
22
|
-
width: "100%",
|
|
23
|
-
height: "100%"
|
|
24
|
-
} : {
|
|
25
|
-
width: "100vw",
|
|
26
|
-
height: "100vh"
|
|
27
|
-
};
|
|
28
|
-
const inlineMode = getPopupContainer === false;
|
|
29
|
-
return (0, vue.createVNode)(_v_c_portal.default, {
|
|
30
|
-
"open": open,
|
|
31
|
-
"autoLock": !inlineMode,
|
|
32
|
-
"getContainer": getPopupContainer
|
|
33
|
-
}, { default: () => [(0, vue.createVNode)("div", {
|
|
34
|
-
"class": (0, _v_c_util.clsx)(`${prefixCls}-mask`, rootClassName, tourClassNames?.mask),
|
|
35
|
-
"style": {
|
|
36
|
-
position: inlineMode ? "absolute" : "fixed",
|
|
37
|
-
left: `0px`,
|
|
38
|
-
right: `0px`,
|
|
39
|
-
top: `0px`,
|
|
40
|
-
bottom: `0px`,
|
|
41
|
-
zIndex,
|
|
42
|
-
pointerEvents: pos && !disabledInteraction ? "none" : "auto",
|
|
43
|
-
...attrs.style,
|
|
44
|
-
...styles?.mask
|
|
45
|
-
}
|
|
46
|
-
}, [showMask ? (0, vue.createVNode)("svg", { "style": {
|
|
47
|
-
width: "100%",
|
|
48
|
-
height: "100%"
|
|
49
|
-
} }, [
|
|
50
|
-
(0, vue.createVNode)("defs", null, [(0, vue.createVNode)("mask", { "id": maskId }, [(0, vue.createVNode)("rect", (0, vue.mergeProps)({
|
|
51
|
-
"x": "0",
|
|
52
|
-
"y": "0"
|
|
53
|
-
}, maskRectSize, { "fill": "white" }), null), pos && (0, vue.createVNode)("rect", {
|
|
54
|
-
"x": pos.left,
|
|
55
|
-
"y": pos.top,
|
|
56
|
-
"rx": pos.radius,
|
|
57
|
-
"width": pos.width,
|
|
58
|
-
"height": pos.height,
|
|
59
|
-
"fill": "black",
|
|
60
|
-
"class": mergedAnimated ? `${prefixCls}-placeholder-animated` : ""
|
|
61
|
-
}, null)])]),
|
|
62
|
-
(0, vue.createVNode)("rect", {
|
|
63
|
-
"x": "0",
|
|
64
|
-
"y": "0",
|
|
65
|
-
"width": "100%",
|
|
66
|
-
"height": "100%",
|
|
67
|
-
"fill": fill,
|
|
68
|
-
"mask": `url(#${maskId})`
|
|
69
|
-
}, null),
|
|
70
|
-
pos && (0, vue.createVNode)(vue.Fragment, null, [
|
|
71
|
-
(0, vue.createVNode)("rect", (0, vue.mergeProps)(COVER_PROPS, {
|
|
72
|
-
"x": "0",
|
|
73
|
-
"y": "0",
|
|
74
|
-
"width": "100%",
|
|
75
|
-
"height": Math.max(pos.top, 0)
|
|
76
|
-
}), null),
|
|
77
|
-
(0, vue.createVNode)("rect", (0, vue.mergeProps)(COVER_PROPS, {
|
|
78
|
-
"x": "0",
|
|
79
|
-
"y": "0",
|
|
80
|
-
"width": Math.max(pos.left, 0),
|
|
81
|
-
"height": "100%"
|
|
82
|
-
}), null),
|
|
83
|
-
(0, vue.createVNode)("rect", (0, vue.mergeProps)(COVER_PROPS, {
|
|
84
|
-
"x": "0",
|
|
85
|
-
"y": pos.top + pos.height,
|
|
86
|
-
"width": "100%",
|
|
87
|
-
"height": `calc(100% - ${pos.top + pos.height}px)`
|
|
88
|
-
}), null),
|
|
89
|
-
(0, vue.createVNode)("rect", (0, vue.mergeProps)(COVER_PROPS, {
|
|
90
|
-
"x": pos.left + pos.width,
|
|
91
|
-
"y": "0",
|
|
92
|
-
"width": `calc(100% - ${pos.left + pos.width}px)`,
|
|
93
|
-
"height": "100%"
|
|
94
|
-
}), null)
|
|
95
|
-
])
|
|
96
|
-
]) : null])] });
|
|
97
|
-
};
|
|
98
|
-
}, {
|
|
99
|
-
props: {
|
|
100
|
-
prefixCls: {
|
|
101
|
-
type: String,
|
|
102
|
-
required: false,
|
|
103
|
-
default: void 0
|
|
104
|
-
},
|
|
105
|
-
pos: {
|
|
106
|
-
type: [Object, null],
|
|
107
|
-
required: false,
|
|
108
|
-
default: void 0
|
|
109
|
-
},
|
|
110
|
-
rootClassName: {
|
|
111
|
-
type: String,
|
|
112
|
-
required: false,
|
|
113
|
-
default: void 0
|
|
114
|
-
},
|
|
115
|
-
showMask: {
|
|
116
|
-
type: Boolean,
|
|
117
|
-
required: false,
|
|
118
|
-
default: void 0
|
|
119
|
-
},
|
|
120
|
-
fill: {
|
|
121
|
-
type: String,
|
|
122
|
-
required: false,
|
|
123
|
-
default: void 0
|
|
124
|
-
},
|
|
125
|
-
open: {
|
|
126
|
-
type: Boolean,
|
|
127
|
-
required: false,
|
|
128
|
-
default: void 0
|
|
129
|
-
},
|
|
130
|
-
animated: {
|
|
131
|
-
type: [Boolean, Object],
|
|
132
|
-
required: false,
|
|
133
|
-
default: void 0
|
|
134
|
-
},
|
|
135
|
-
zIndex: {
|
|
136
|
-
type: Number,
|
|
137
|
-
required: false,
|
|
138
|
-
default: void 0
|
|
139
|
-
},
|
|
140
|
-
disabledInteraction: {
|
|
141
|
-
type: Boolean,
|
|
142
|
-
required: false,
|
|
143
|
-
default: void 0
|
|
144
|
-
},
|
|
145
|
-
classNames: {
|
|
146
|
-
type: Object,
|
|
147
|
-
required: false,
|
|
148
|
-
default: void 0
|
|
149
|
-
},
|
|
150
|
-
styles: {
|
|
151
|
-
type: Object,
|
|
152
|
-
required: false,
|
|
153
|
-
default: void 0
|
|
154
|
-
},
|
|
155
|
-
getPopupContainer: {
|
|
156
|
-
type: [Function, Boolean],
|
|
157
|
-
required: false,
|
|
158
|
-
default: void 0
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
name: "TourMask",
|
|
162
|
-
inheritAttrs: false
|
|
163
|
-
});
|
|
164
|
-
var Mask_default = Mask;
|
|
165
|
-
exports.default = Mask_default;
|
package/dist/Placeholder.cjs
DELETED
|
@@ -1,61 +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
|
-
let vue = require("vue");
|
|
7
|
-
let _v_c_portal = require("@v-c/portal");
|
|
8
|
-
_v_c_portal = require_rolldown_runtime.__toESM(_v_c_portal);
|
|
9
|
-
var Placeholder = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, attrs }) => {
|
|
10
|
-
expose({
|
|
11
|
-
getDom: () => {
|
|
12
|
-
return props?.domRef.value ?? props?.fallbackDOM?.();
|
|
13
|
-
},
|
|
14
|
-
__$el: (0, vue.computed)(() => props?.domRef?.value ?? props?.fallbackDOM?.())
|
|
15
|
-
});
|
|
16
|
-
return () => {
|
|
17
|
-
const { open, autoLock, getContainer } = props;
|
|
18
|
-
return (0, vue.createVNode)(_v_c_portal.default, {
|
|
19
|
-
"open": open,
|
|
20
|
-
"autoLock": autoLock,
|
|
21
|
-
"getContainer": getContainer
|
|
22
|
-
}, { default: () => [(0, vue.createVNode)("div", (0, vue.mergeProps)({ "ref": props.domRef }, attrs), null)] });
|
|
23
|
-
};
|
|
24
|
-
}, {
|
|
25
|
-
props: {
|
|
26
|
-
domRef: {
|
|
27
|
-
type: Object,
|
|
28
|
-
required: true,
|
|
29
|
-
default: void 0
|
|
30
|
-
},
|
|
31
|
-
fallbackDOM: {
|
|
32
|
-
type: Function,
|
|
33
|
-
required: true,
|
|
34
|
-
default: void 0
|
|
35
|
-
},
|
|
36
|
-
open: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
required: false,
|
|
39
|
-
default: void 0
|
|
40
|
-
},
|
|
41
|
-
autoLock: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
required: false,
|
|
44
|
-
default: void 0
|
|
45
|
-
},
|
|
46
|
-
getContainer: {
|
|
47
|
-
type: [
|
|
48
|
-
String,
|
|
49
|
-
Function,
|
|
50
|
-
Boolean
|
|
51
|
-
],
|
|
52
|
-
required: false,
|
|
53
|
-
skipCheck: true,
|
|
54
|
-
default: void 0
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
name: "TourPlaceholder",
|
|
58
|
-
inheritAttrs: false
|
|
59
|
-
});
|
|
60
|
-
var Placeholder_default = Placeholder;
|
|
61
|
-
exports.default = Placeholder_default;
|