react-native-lumen 1.0.0
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/LICENSE +20 -0
- package/README.md +231 -0
- package/lib/module/components/TourOverlay.js +134 -0
- package/lib/module/components/TourOverlay.js.map +1 -0
- package/lib/module/components/TourProvider.js +233 -0
- package/lib/module/components/TourProvider.js.map +1 -0
- package/lib/module/components/TourTooltip.js +233 -0
- package/lib/module/components/TourTooltip.js.map +1 -0
- package/lib/module/components/TourZone.js +246 -0
- package/lib/module/components/TourZone.js.map +1 -0
- package/lib/module/constants/animations.js +72 -0
- package/lib/module/constants/animations.js.map +1 -0
- package/lib/module/constants/defaults.js +14 -0
- package/lib/module/constants/defaults.js.map +1 -0
- package/lib/module/hooks/useTour.js +12 -0
- package/lib/module/hooks/useTour.js.map +1 -0
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/index.js +4 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/TourOverlay.d.ts +2 -0
- package/lib/typescript/src/components/TourOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/TourProvider.d.ts +21 -0
- package/lib/typescript/src/components/TourProvider.d.ts.map +1 -0
- package/lib/typescript/src/components/TourTooltip.d.ts +2 -0
- package/lib/typescript/src/components/TourTooltip.d.ts.map +1 -0
- package/lib/typescript/src/components/TourZone.d.ts +16 -0
- package/lib/typescript/src/components/TourZone.d.ts.map +1 -0
- package/lib/typescript/src/constants/animations.d.ts +34 -0
- package/lib/typescript/src/constants/animations.d.ts.map +1 -0
- package/lib/typescript/src/constants/defaults.d.ts +10 -0
- package/lib/typescript/src/constants/defaults.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useTour.d.ts +2 -0
- package/lib/typescript/src/hooks/useTour.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +135 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/package.json +171 -0
- package/src/components/TourOverlay.tsx +153 -0
- package/src/components/TourProvider.tsx +361 -0
- package/src/components/TourTooltip.tsx +252 -0
- package/src/components/TourZone.tsx +372 -0
- package/src/constants/animations.ts +71 -0
- package/src/constants/defaults.ts +15 -0
- package/src/hooks/useTour.ts +10 -0
- package/src/index.tsx +8 -0
- package/src/types/index.ts +142 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo, memo, useState } from 'react';
|
|
4
|
+
import { StyleSheet, Text, View, Dimensions, TouchableOpacity } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedStyle, useSharedValue, interpolate, Extrapolation } from 'react-native-reanimated';
|
|
6
|
+
import { useTour } from "../hooks/useTour.js";
|
|
7
|
+
import { DEFAULT_LABELS } from "../constants/defaults.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const {
|
|
10
|
+
width: SCREEN_WIDTH,
|
|
11
|
+
height: SCREEN_HEIGHT
|
|
12
|
+
} = Dimensions.get('window');
|
|
13
|
+
export const TourTooltip = /*#__PURE__*/memo(() => {
|
|
14
|
+
const {
|
|
15
|
+
targetX,
|
|
16
|
+
targetY,
|
|
17
|
+
targetWidth,
|
|
18
|
+
targetHeight,
|
|
19
|
+
currentStep,
|
|
20
|
+
steps,
|
|
21
|
+
next,
|
|
22
|
+
prev,
|
|
23
|
+
stop,
|
|
24
|
+
opacity,
|
|
25
|
+
config
|
|
26
|
+
} = useTour();
|
|
27
|
+
const currentStepData = currentStep ? steps[currentStep] : null;
|
|
28
|
+
const tooltipHeight = useSharedValue(150);
|
|
29
|
+
const [tooltipWidth] = useState(280);
|
|
30
|
+
const orderedSteps = useMemo(() => {
|
|
31
|
+
const keys = Object.keys(steps);
|
|
32
|
+
if (keys.length > 0) {
|
|
33
|
+
return keys.sort((a, b) => (steps[a]?.order ?? 0) - (steps[b]?.order ?? 0));
|
|
34
|
+
}
|
|
35
|
+
return keys;
|
|
36
|
+
}, [steps]);
|
|
37
|
+
const currentIndex = currentStep ? orderedSteps.indexOf(currentStep) : -1;
|
|
38
|
+
const totalSteps = orderedSteps.length;
|
|
39
|
+
const isFirst = currentIndex === 0;
|
|
40
|
+
const isLast = currentIndex === totalSteps - 1;
|
|
41
|
+
const tooltipStyle = useAnimatedStyle(() => {
|
|
42
|
+
'worklet';
|
|
43
|
+
|
|
44
|
+
const safeTargetX = targetX.value || 0;
|
|
45
|
+
const safeTargetY = targetY.value || 0;
|
|
46
|
+
const safeTargetWidth = Math.max(targetWidth.value || 0, 1);
|
|
47
|
+
const safeTargetHeight = Math.max(targetHeight.value || 0, 1);
|
|
48
|
+
const safeTooltipHeight = tooltipHeight.value || 150;
|
|
49
|
+
|
|
50
|
+
// FIX: Aggressive Interpolation
|
|
51
|
+
// Map the input value [0 -> 0.6] to output [0 -> 1].
|
|
52
|
+
// This ensures that even if 'opacity.value' stops at 0.7 (backdrop level),
|
|
53
|
+
// the tooltip is already fully opaque (1.0).
|
|
54
|
+
const activeOpacity = interpolate(opacity.value, [0, 0.6], [0, 1], Extrapolation.CLAMP);
|
|
55
|
+
const spaceAbove = safeTargetY;
|
|
56
|
+
const spaceBelow = SCREEN_HEIGHT - (safeTargetY + safeTargetHeight);
|
|
57
|
+
const shouldPlaceAbove = spaceAbove > spaceBelow && spaceAbove > safeTooltipHeight + 30 || safeTargetY > SCREEN_HEIGHT / 2 && spaceAbove > safeTooltipHeight + 20;
|
|
58
|
+
const horizontalCenter = safeTargetX + safeTargetWidth / 2;
|
|
59
|
+
const left = horizontalCenter - tooltipWidth / 2;
|
|
60
|
+
const clampedLeft = Math.max(12, Math.min(SCREEN_WIDTH - tooltipWidth - 12, left));
|
|
61
|
+
const style = {
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
width: tooltipWidth,
|
|
64
|
+
left: clampedLeft,
|
|
65
|
+
opacity: activeOpacity,
|
|
66
|
+
// Add explicit background here for Reanimated to treat it as a solid block layer
|
|
67
|
+
backgroundColor: 'white',
|
|
68
|
+
transform: [{
|
|
69
|
+
translateY: interpolate(activeOpacity, [0, 1], [10, 0])
|
|
70
|
+
}]
|
|
71
|
+
};
|
|
72
|
+
if (shouldPlaceAbove) {
|
|
73
|
+
style.top = Math.max(10, safeTargetY - safeTooltipHeight - 20);
|
|
74
|
+
style.bottom = undefined;
|
|
75
|
+
} else {
|
|
76
|
+
style.top = safeTargetY + safeTargetHeight + 20;
|
|
77
|
+
style.bottom = undefined;
|
|
78
|
+
}
|
|
79
|
+
return style;
|
|
80
|
+
});
|
|
81
|
+
if (!currentStepData) return null;
|
|
82
|
+
const AnimatedView = Animated.View;
|
|
83
|
+
const handleTooltipLayout = event => {
|
|
84
|
+
const {
|
|
85
|
+
height
|
|
86
|
+
} = event.nativeEvent.layout;
|
|
87
|
+
if (height > 0) {
|
|
88
|
+
tooltipHeight.value = height;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Custom Render
|
|
93
|
+
if (config?.renderCard) {
|
|
94
|
+
const cardProps = {
|
|
95
|
+
step: currentStepData,
|
|
96
|
+
currentStepIndex: currentIndex,
|
|
97
|
+
totalSteps,
|
|
98
|
+
next,
|
|
99
|
+
prev,
|
|
100
|
+
stop,
|
|
101
|
+
isFirst,
|
|
102
|
+
isLast,
|
|
103
|
+
labels: config.labels
|
|
104
|
+
};
|
|
105
|
+
return /*#__PURE__*/_jsx(AnimatedView, {
|
|
106
|
+
style: [styles.container, tooltipStyle,
|
|
107
|
+
// Reset styles for custom render so the user has full control
|
|
108
|
+
{
|
|
109
|
+
backgroundColor: 'transparent',
|
|
110
|
+
shadowOpacity: 0,
|
|
111
|
+
elevation: 0,
|
|
112
|
+
padding: 0,
|
|
113
|
+
borderRadius: 0
|
|
114
|
+
}],
|
|
115
|
+
onLayout: handleTooltipLayout,
|
|
116
|
+
children: config.renderCard(cardProps)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Default Render
|
|
121
|
+
const labels = {
|
|
122
|
+
...DEFAULT_LABELS,
|
|
123
|
+
...config?.labels
|
|
124
|
+
};
|
|
125
|
+
const labelNext = isLast ? labels.finish : labels.next;
|
|
126
|
+
const labelSkip = labels.skip;
|
|
127
|
+
return /*#__PURE__*/_jsxs(AnimatedView
|
|
128
|
+
// Combined styles: Container (Shadows) + CardStyle (White BG) + TooltipStyle (Position/Opacity)
|
|
129
|
+
, {
|
|
130
|
+
style: [styles.container, styles.cardStyle, tooltipStyle],
|
|
131
|
+
onLayout: handleTooltipLayout,
|
|
132
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
133
|
+
style: styles.header,
|
|
134
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
135
|
+
style: styles.title,
|
|
136
|
+
children: currentStepData.name || 'Step'
|
|
137
|
+
}), /*#__PURE__*/_jsxs(Text, {
|
|
138
|
+
style: styles.stepIndicator,
|
|
139
|
+
children: [currentIndex + 1, " / ", totalSteps]
|
|
140
|
+
})]
|
|
141
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
142
|
+
style: styles.description,
|
|
143
|
+
children: currentStepData.description
|
|
144
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
145
|
+
style: styles.footer,
|
|
146
|
+
children: [!isLast && /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
147
|
+
onPress: stop,
|
|
148
|
+
style: styles.buttonText,
|
|
149
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
150
|
+
style: styles.skipText,
|
|
151
|
+
children: labelSkip
|
|
152
|
+
})
|
|
153
|
+
}), isLast && /*#__PURE__*/_jsx(View, {
|
|
154
|
+
style: {
|
|
155
|
+
width: 10
|
|
156
|
+
}
|
|
157
|
+
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
158
|
+
onPress: next,
|
|
159
|
+
style: styles.buttonPrimary,
|
|
160
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
161
|
+
style: styles.primaryButtonText,
|
|
162
|
+
children: labelNext
|
|
163
|
+
})
|
|
164
|
+
})]
|
|
165
|
+
})]
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
const styles = StyleSheet.create({
|
|
169
|
+
container: {
|
|
170
|
+
// Shadow Props
|
|
171
|
+
shadowColor: '#000',
|
|
172
|
+
shadowOffset: {
|
|
173
|
+
width: 0,
|
|
174
|
+
height: 4
|
|
175
|
+
},
|
|
176
|
+
shadowOpacity: 0.3,
|
|
177
|
+
shadowRadius: 5,
|
|
178
|
+
elevation: 8,
|
|
179
|
+
zIndex: 999
|
|
180
|
+
},
|
|
181
|
+
cardStyle: {
|
|
182
|
+
backgroundColor: 'white',
|
|
183
|
+
// Ensure this is solid white
|
|
184
|
+
borderRadius: 12,
|
|
185
|
+
padding: 20,
|
|
186
|
+
minHeight: 120
|
|
187
|
+
},
|
|
188
|
+
header: {
|
|
189
|
+
flexDirection: 'row',
|
|
190
|
+
justifyContent: 'space-between',
|
|
191
|
+
marginBottom: 8
|
|
192
|
+
},
|
|
193
|
+
stepIndicator: {
|
|
194
|
+
fontSize: 12,
|
|
195
|
+
color: '#999'
|
|
196
|
+
},
|
|
197
|
+
title: {
|
|
198
|
+
fontSize: 18,
|
|
199
|
+
fontWeight: 'bold',
|
|
200
|
+
color: '#000',
|
|
201
|
+
flex: 1
|
|
202
|
+
},
|
|
203
|
+
description: {
|
|
204
|
+
fontSize: 15,
|
|
205
|
+
color: '#444',
|
|
206
|
+
marginBottom: 20,
|
|
207
|
+
lineHeight: 22
|
|
208
|
+
},
|
|
209
|
+
footer: {
|
|
210
|
+
flexDirection: 'row',
|
|
211
|
+
justifyContent: 'space-between',
|
|
212
|
+
alignItems: 'center'
|
|
213
|
+
},
|
|
214
|
+
buttonText: {
|
|
215
|
+
padding: 8
|
|
216
|
+
},
|
|
217
|
+
skipText: {
|
|
218
|
+
color: '#666',
|
|
219
|
+
fontWeight: '600'
|
|
220
|
+
},
|
|
221
|
+
buttonPrimary: {
|
|
222
|
+
backgroundColor: '#007AFF',
|
|
223
|
+
paddingVertical: 10,
|
|
224
|
+
paddingHorizontal: 20,
|
|
225
|
+
borderRadius: 25
|
|
226
|
+
},
|
|
227
|
+
primaryButtonText: {
|
|
228
|
+
color: '#fff',
|
|
229
|
+
fontWeight: 'bold',
|
|
230
|
+
fontSize: 14
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
//# sourceMappingURL=TourTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","memo","useState","StyleSheet","Text","View","Dimensions","TouchableOpacity","Animated","useAnimatedStyle","useSharedValue","interpolate","Extrapolation","useTour","DEFAULT_LABELS","jsx","_jsx","jsxs","_jsxs","width","SCREEN_WIDTH","height","SCREEN_HEIGHT","get","TourTooltip","targetX","targetY","targetWidth","targetHeight","currentStep","steps","next","prev","stop","opacity","config","currentStepData","tooltipHeight","tooltipWidth","orderedSteps","keys","Object","length","sort","a","b","order","currentIndex","indexOf","totalSteps","isFirst","isLast","tooltipStyle","safeTargetX","value","safeTargetY","safeTargetWidth","Math","max","safeTargetHeight","safeTooltipHeight","activeOpacity","CLAMP","spaceAbove","spaceBelow","shouldPlaceAbove","horizontalCenter","left","clampedLeft","min","style","position","backgroundColor","transform","translateY","top","bottom","undefined","AnimatedView","handleTooltipLayout","event","nativeEvent","layout","renderCard","cardProps","step","currentStepIndex","labels","styles","container","shadowOpacity","elevation","padding","borderRadius","onLayout","children","labelNext","finish","labelSkip","skip","cardStyle","header","title","name","stepIndicator","description","footer","onPress","buttonText","skipText","buttonPrimary","primaryButtonText","create","shadowColor","shadowOffset","shadowRadius","zIndex","minHeight","flexDirection","justifyContent","marginBottom","fontSize","color","fontWeight","flex","lineHeight","alignItems","paddingVertical","paddingHorizontal"],"sourceRoot":"..\\..\\..\\src","sources":["components/TourTooltip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useCallback, useRef } from 'react';
|
|
4
|
+
import { useTour } from "../hooks/useTour.js";
|
|
5
|
+
import { useAnimatedRef, measure, useFrameCallback, withSpring, default as Animated, useSharedValue } from 'react-native-reanimated';
|
|
6
|
+
import { Dimensions } from 'react-native';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const {
|
|
9
|
+
height: SCREEN_HEIGHT
|
|
10
|
+
} = Dimensions.get('window');
|
|
11
|
+
const AnimatedView = Animated.View;
|
|
12
|
+
export const TourZone = ({
|
|
13
|
+
stepKey,
|
|
14
|
+
name,
|
|
15
|
+
description,
|
|
16
|
+
order,
|
|
17
|
+
shape = 'rect',
|
|
18
|
+
borderRadius = 10,
|
|
19
|
+
children,
|
|
20
|
+
style,
|
|
21
|
+
clickable
|
|
22
|
+
}) => {
|
|
23
|
+
const {
|
|
24
|
+
registerStep,
|
|
25
|
+
unregisterStep,
|
|
26
|
+
updateStepLayout,
|
|
27
|
+
currentStep,
|
|
28
|
+
containerRef,
|
|
29
|
+
scrollViewRef,
|
|
30
|
+
targetX,
|
|
31
|
+
targetY,
|
|
32
|
+
targetWidth,
|
|
33
|
+
targetHeight,
|
|
34
|
+
targetRadius,
|
|
35
|
+
config
|
|
36
|
+
} = useTour();
|
|
37
|
+
const viewRef = useAnimatedRef();
|
|
38
|
+
const isActive = currentStep === stepKey;
|
|
39
|
+
|
|
40
|
+
// Track if we're currently scrolling to prevent position updates during scroll
|
|
41
|
+
const isScrolling = useSharedValue(false);
|
|
42
|
+
const hasScrolled = useRef(false);
|
|
43
|
+
|
|
44
|
+
// Signal when scroll completes (from JS thread)
|
|
45
|
+
const onScrollComplete = useCallback(() => {
|
|
46
|
+
isScrolling.value = false;
|
|
47
|
+
}, [isScrolling]);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* UNIFIED MEASUREMENT FUNCTION (JS THREAD)
|
|
51
|
+
* Always measures relative to SCREEN (Viewport), not Content.
|
|
52
|
+
* This fixes the bug where measureLayout returned content-relative Y.
|
|
53
|
+
*/
|
|
54
|
+
const measureJS = useCallback(() => {
|
|
55
|
+
if (isScrolling.value || !isActive) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const view = viewRef.current;
|
|
59
|
+
const container = containerRef.current;
|
|
60
|
+
if (view && container) {
|
|
61
|
+
// 1. Measure the View in Screen Coordinates (PageX/PageY)
|
|
62
|
+
view.measure((_x, _y, width, height, pageX, pageY) => {
|
|
63
|
+
// 2. Measure the Container (TourOverlay) in Screen Coordinates
|
|
64
|
+
// This handles cases where the Tour Overlay isn't exactly at 0,0 (e.g. inside a SafeAreaView)
|
|
65
|
+
container.measure((_cx, _cy, _cw, _ch, containerPageX, containerPageY) => {
|
|
66
|
+
if (width > 0 && height > 0 && !isNaN(pageX) && !isNaN(pageY)) {
|
|
67
|
+
// Calculate final position relative to the Tour Overlay
|
|
68
|
+
const finalX = pageX - containerPageX;
|
|
69
|
+
const finalY = pageY - containerPageY;
|
|
70
|
+
updateStepLayout(stepKey, {
|
|
71
|
+
x: finalX,
|
|
72
|
+
y: finalY,
|
|
73
|
+
width,
|
|
74
|
+
height
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}, [containerRef, stepKey, updateStepLayout, viewRef, isScrolling, isActive]);
|
|
81
|
+
|
|
82
|
+
// Initial measurement when step becomes active
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!isActive) return;
|
|
85
|
+
|
|
86
|
+
// Small delay to ensure layout is ready
|
|
87
|
+
const timeoutId = setTimeout(() => {
|
|
88
|
+
measureJS();
|
|
89
|
+
}, 50);
|
|
90
|
+
return () => clearTimeout(timeoutId);
|
|
91
|
+
}, [isActive, measureJS]);
|
|
92
|
+
|
|
93
|
+
// Reanimated Frame Callback (UI Thread Tracking)
|
|
94
|
+
// This keeps the highlight sticky during manual user scrolling
|
|
95
|
+
useFrameCallback(() => {
|
|
96
|
+
'worklet';
|
|
97
|
+
|
|
98
|
+
if (!isActive || isScrolling.value) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const measured = measure(viewRef);
|
|
103
|
+
const container = measure(containerRef);
|
|
104
|
+
if (measured && container) {
|
|
105
|
+
const x = measured.pageX - container.pageX;
|
|
106
|
+
const y = measured.pageY - container.pageY;
|
|
107
|
+
const width = measured.width;
|
|
108
|
+
const height = measured.height;
|
|
109
|
+
if (width > 0 && height > 0 && !isNaN(x) && !isNaN(y) && isFinite(x) && isFinite(y)) {
|
|
110
|
+
const springConfig = config?.springConfig ?? {
|
|
111
|
+
damping: 100,
|
|
112
|
+
stiffness: 100
|
|
113
|
+
};
|
|
114
|
+
targetX.value = withSpring(x, springConfig);
|
|
115
|
+
targetY.value = withSpring(y, springConfig);
|
|
116
|
+
targetWidth.value = withSpring(width, springConfig);
|
|
117
|
+
targetHeight.value = withSpring(height, springConfig);
|
|
118
|
+
targetRadius.value = withSpring(borderRadius, springConfig);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} catch (e) {
|
|
122
|
+
// Silently ignore measurement errors on UI thread
|
|
123
|
+
}
|
|
124
|
+
}, isActive);
|
|
125
|
+
|
|
126
|
+
// Auto-scroll Effect
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (!isActive || !scrollViewRef?.current || !viewRef.current) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
hasScrolled.current = false;
|
|
132
|
+
const view = viewRef.current;
|
|
133
|
+
const scroll = scrollViewRef.current;
|
|
134
|
+
const container = containerRef.current;
|
|
135
|
+
let attemptCount = 0;
|
|
136
|
+
const maxAttempts = 3;
|
|
137
|
+
const attemptMeasurement = delay => {
|
|
138
|
+
const timeoutId = setTimeout(() => {
|
|
139
|
+
if (hasScrolled.current) return;
|
|
140
|
+
attemptCount++;
|
|
141
|
+
|
|
142
|
+
// 1. Check current visibility on screen
|
|
143
|
+
view.measure((_mx, _my, mw, mh, px, py) => {
|
|
144
|
+
if (mw > 0 && mh > 0 && !isNaN(px) && !isNaN(py)) {
|
|
145
|
+
const viewportHeight = SCREEN_HEIGHT;
|
|
146
|
+
const topBuffer = 100;
|
|
147
|
+
const bottomBuffer = 150;
|
|
148
|
+
|
|
149
|
+
// Check if element is out of the "safe" visual zone
|
|
150
|
+
const needsScroll = py < topBuffer || py + mh > viewportHeight - bottomBuffer;
|
|
151
|
+
if (needsScroll) {
|
|
152
|
+
hasScrolled.current = true;
|
|
153
|
+
isScrolling.value = true;
|
|
154
|
+
|
|
155
|
+
// 2. Measure ScrollView to get its Screen Position (Offset from top)
|
|
156
|
+
// This fixes the "upwards" bug by accounting for headers/safe-areas
|
|
157
|
+
scroll.measure((_sx, _sy, _sw, _sh, scrollPx, scrollPy) => {
|
|
158
|
+
// 3. Measure Element relative to ScrollView Content
|
|
159
|
+
if (view.measureLayout) {
|
|
160
|
+
view.measureLayout(scroll, (contentX, contentY) => {
|
|
161
|
+
// Calculate target scroll position (center the element)
|
|
162
|
+
const centerY = contentY - viewportHeight / 2 + mh / 2 + 50;
|
|
163
|
+
const scrollY = Math.max(0, centerY);
|
|
164
|
+
|
|
165
|
+
// 4. Measure Container to map coordinates to Overlay space
|
|
166
|
+
container.measure((_cx, _cy, _cw, _ch, containerPx, containerPy) => {
|
|
167
|
+
// THE FIX: Add scrollPy (ScrollView's screen Y)
|
|
168
|
+
// Visual Y = ScrollViewScreenY + (ElementContentY - ScrollAmount)
|
|
169
|
+
const targetScreenY = scrollPy + contentY - scrollY - containerPy;
|
|
170
|
+
|
|
171
|
+
// X is simpler: ScrollViewScreenX + ElementContentX - ContainerScreenX
|
|
172
|
+
const targetScreenX = scrollPx + contentX - containerPx;
|
|
173
|
+
updateStepLayout(stepKey, {
|
|
174
|
+
x: targetScreenX,
|
|
175
|
+
y: targetScreenY,
|
|
176
|
+
width: mw,
|
|
177
|
+
height: mh
|
|
178
|
+
});
|
|
179
|
+
try {
|
|
180
|
+
scroll.scrollTo({
|
|
181
|
+
y: scrollY,
|
|
182
|
+
animated: true
|
|
183
|
+
});
|
|
184
|
+
// Wait for scroll animation
|
|
185
|
+
setTimeout(() => onScrollComplete(), 800);
|
|
186
|
+
} catch (e) {
|
|
187
|
+
console.error(e);
|
|
188
|
+
onScrollComplete();
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
// Element is already visible - just sync position
|
|
196
|
+
container.measure((_cx, _cy, _cw, _ch, cPx, cPy) => {
|
|
197
|
+
const finalX = px - cPx;
|
|
198
|
+
const finalY = py - cPy;
|
|
199
|
+
updateStepLayout(stepKey, {
|
|
200
|
+
x: finalX,
|
|
201
|
+
y: finalY,
|
|
202
|
+
width: mw,
|
|
203
|
+
height: mh
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
} else if (attemptCount < maxAttempts) {
|
|
208
|
+
attemptMeasurement(150 * attemptCount);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}, delay);
|
|
212
|
+
return timeoutId;
|
|
213
|
+
};
|
|
214
|
+
const timeoutId = attemptMeasurement(150);
|
|
215
|
+
return () => clearTimeout(timeoutId);
|
|
216
|
+
}, [isActive, scrollViewRef, viewRef, stepKey, isScrolling, onScrollComplete, containerRef, updateStepLayout]);
|
|
217
|
+
|
|
218
|
+
// Standard onLayout handler (uses the unified measureJS)
|
|
219
|
+
const onLayout = () => {
|
|
220
|
+
measureJS();
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// Register step on mount
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
registerStep({
|
|
226
|
+
key: stepKey,
|
|
227
|
+
name,
|
|
228
|
+
description,
|
|
229
|
+
order,
|
|
230
|
+
clickable,
|
|
231
|
+
meta: {
|
|
232
|
+
shape,
|
|
233
|
+
borderRadius
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
return () => unregisterStep(stepKey);
|
|
237
|
+
}, [stepKey, name, description, order, shape, borderRadius, registerStep, registerStep, unregisterStep, clickable]);
|
|
238
|
+
return /*#__PURE__*/_jsx(AnimatedView, {
|
|
239
|
+
ref: viewRef,
|
|
240
|
+
onLayout: onLayout,
|
|
241
|
+
style: style,
|
|
242
|
+
collapsable: false,
|
|
243
|
+
children: children
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
//# sourceMappingURL=TourZone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useCallback","useRef","useTour","useAnimatedRef","measure","useFrameCallback","withSpring","default","Animated","useSharedValue","Dimensions","jsx","_jsx","height","SCREEN_HEIGHT","get","AnimatedView","View","TourZone","stepKey","name","description","order","shape","borderRadius","children","style","clickable","registerStep","unregisterStep","updateStepLayout","currentStep","containerRef","scrollViewRef","targetX","targetY","targetWidth","targetHeight","targetRadius","config","viewRef","isActive","isScrolling","hasScrolled","onScrollComplete","value","measureJS","view","current","container","_x","_y","width","pageX","pageY","_cx","_cy","_cw","_ch","containerPageX","containerPageY","isNaN","finalX","finalY","x","y","timeoutId","setTimeout","clearTimeout","measured","isFinite","springConfig","damping","stiffness","e","scroll","attemptCount","maxAttempts","attemptMeasurement","delay","_mx","_my","mw","mh","px","py","viewportHeight","topBuffer","bottomBuffer","needsScroll","_sx","_sy","_sw","_sh","scrollPx","scrollPy","measureLayout","contentX","contentY","centerY","scrollY","Math","max","containerPx","containerPy","targetScreenY","targetScreenX","scrollTo","animated","console","error","cPx","cPy","onLayout","key","meta","ref","collapsable"],"sourceRoot":"..\\..\\..\\src","sources":["components/TourZone.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACVC,SAAS,EACTC,WAAW,EACXC,MAAM,QAED,OAAO;AAEd,SAASC,OAAO,QAAQ,qBAAkB;AAC1C,SACEC,cAAc,EACdC,OAAO,EACPC,gBAAgB,EAChBC,UAAU,EACVC,OAAO,IAAIC,QAAQ,EAEnBC,c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EnB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default spring configuration matching Reanimated 3 defaults.
|
|
5
|
+
*/
|
|
6
|
+
export const Reanimated3DefaultSpringConfig = {
|
|
7
|
+
damping: 10,
|
|
8
|
+
mass: 1,
|
|
9
|
+
stiffness: 100
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Spring configuration with duration.
|
|
14
|
+
*/
|
|
15
|
+
export const Reanimated3DefaultSpringConfigWithDuration = {
|
|
16
|
+
duration: 1333,
|
|
17
|
+
dampingRatio: 0.5
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A bouncy and energetic spring configuration.
|
|
22
|
+
*/
|
|
23
|
+
export const WigglySpringConfig = {
|
|
24
|
+
damping: 90,
|
|
25
|
+
mass: 4,
|
|
26
|
+
stiffness: 900
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A bouncy spring configuration with fixed duration.
|
|
31
|
+
*/
|
|
32
|
+
export const WigglySpringConfigWithDuration = {
|
|
33
|
+
duration: 550,
|
|
34
|
+
dampingRatio: 0.75
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A gentle and smooth spring configuration.
|
|
39
|
+
*/
|
|
40
|
+
export const GentleSpringConfig = {
|
|
41
|
+
damping: 120,
|
|
42
|
+
mass: 4,
|
|
43
|
+
stiffness: 900
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A gentle spring configuration with fixed duration.
|
|
48
|
+
*/
|
|
49
|
+
export const GentleSpringConfigWithDuration = {
|
|
50
|
+
duration: 550,
|
|
51
|
+
dampingRatio: 1
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A snappy and responsive spring configuration.
|
|
56
|
+
*/
|
|
57
|
+
export const SnappySpringConfig = {
|
|
58
|
+
damping: 110,
|
|
59
|
+
mass: 4,
|
|
60
|
+
stiffness: 900,
|
|
61
|
+
overshootClamping: true
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A snappy spring configuration with fixed duration.
|
|
66
|
+
*/
|
|
67
|
+
export const SnappySpringConfigWithDuration = {
|
|
68
|
+
duration: 550,
|
|
69
|
+
dampingRatio: 0.92,
|
|
70
|
+
overshootClamping: true
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=animations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Reanimated3DefaultSpringConfig","damping","mass","stiffness","Reanimated3DefaultSpringConfigWithDuration","duration","dampingRatio","WigglySpringConfig","WigglySpringConfigWithDuration","GentleSpringConfig","GentleSpringConfigWithDuration","SnappySpringConfig","overshootClamping","SnappySpringConfigWithDuration"],"sourceRoot":"..\\..\\..\\src","sources":["constants/animations.ts"],"mappings":";;AAEA;AACA;AACA;AACA,OAAO,MAAMA,8BAAgD,GAAG;EAC9DC,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE,CAAC;EACPC,SAAS,EAAE;AACb,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,0CAA4D,GAAG;EAC1EC,QAAQ,EAAE,IAAI;EACdC,YAAY,EAAE;AAChB,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,kBAAoC,GAAG;EAClDN,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE,CAAC;EACPC,SAAS,EAAE;AACb,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,8BAAgD,GAAG;EAC9DH,QAAQ,EAAE,GAAG;EACbC,YAAY,EAAE;AAChB,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,kBAAoC,GAAG;EAClDR,OAAO,EAAE,GAAG;EACZC,IAAI,EAAE,CAAC;EACPC,SAAS,EAAE;AACb,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMO,8BAAgD,GAAG;EAC9DL,QAAQ,EAAE,GAAG;EACbC,YAAY,EAAE;AAChB,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMK,kBAAoC,GAAG;EAClDV,OAAO,EAAE,GAAG;EACZC,IAAI,EAAE,CAAC;EACPC,SAAS,EAAE,GAAG;EACdS,iBAAiB,EAAE;AACrB,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,8BAAgD,GAAG;EAC9DR,QAAQ,EAAE,GAAG;EACbC,YAAY,EAAE,IAAI;EAClBM,iBAAiB,EAAE;AACrB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_SPRING_CONFIG = {
|
|
4
|
+
damping: 20,
|
|
5
|
+
stiffness: 90
|
|
6
|
+
};
|
|
7
|
+
export const DEFAULT_BACKDROP_OPACITY = 0.5;
|
|
8
|
+
export const DEFAULT_LABELS = {
|
|
9
|
+
next: 'Next',
|
|
10
|
+
previous: 'Previous',
|
|
11
|
+
finish: 'Finish',
|
|
12
|
+
skip: 'Skip'
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_SPRING_CONFIG","damping","stiffness","DEFAULT_BACKDROP_OPACITY","DEFAULT_LABELS","next","previous","finish","skip"],"sourceRoot":"..\\..\\..\\src","sources":["constants/defaults.ts"],"mappings":";;AAEA,OAAO,MAAMA,qBAAuC,GAAG;EACrDC,OAAO,EAAE,EAAE;EACXC,SAAS,EAAE;AACb,CAAC;AAED,OAAO,MAAMC,wBAAwB,GAAG,GAAG;AAE3C,OAAO,MAAMC,cAAc,GAAG;EAC5BC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE;AACR,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
import { TourContext } from "../components/TourProvider.js";
|
|
5
|
+
export const useTour = () => {
|
|
6
|
+
const context = useContext(TourContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error('useTour must be used within a TourProvider');
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useTour.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useContext","TourContext","useTour","context","Error"],"sourceRoot":"..\\..\\..\\src","sources":["hooks/useTour.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,WAAW,QAAQ,+BAA4B;AAExD,OAAO,MAAMC,OAAO,GAAGA,CAAA,KAAM;EAC3B,MAAMC,OAAO,GAAGH,UAAU,CAACC,WAAW,CAAC;EACvC,IAAI,CAACE,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,4CAA4C,CAAC;EAC/D;EACA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export * from "./types/index.js";
|
|
4
|
+
export * from "./components/TourProvider.js";
|
|
5
|
+
export * from "./components/TourZone.js";
|
|
6
|
+
export * from "./hooks/useTour.js";
|
|
7
|
+
export { TourOverlay } from "./components/TourOverlay.js";
|
|
8
|
+
export { TourTooltip } from "./components/TourTooltip.js";
|
|
9
|
+
export * from "./constants/defaults.js";
|
|
10
|
+
export * from "./constants/animations.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TourOverlay","TourTooltip"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,kBAAS;AACvB,cAAc,8BAA2B;AACzC,cAAc,0BAAuB;AACrC,cAAc,oBAAiB;AAC/B,SAASA,WAAW,QAAQ,6BAA0B;AACtD,SAASC,WAAW,QAAQ,6BAA0B;AACtD,cAAc,yBAAsB;AACpC,cAAc,2BAAwB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["types/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourOverlay.d.ts","sourceRoot":"","sources":["../../../../src/components/TourOverlay.tsx"],"names":[],"mappings":"AA2CA,eAAO,MAAM,WAAW,oFA6GtB,CAAC"}
|