@pgy-eu/react-native-tour-guide 0.0.0-stage → 2.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 +993 -2
- package/lib/commonjs/SpotlightOverlay.js +712 -0
- package/lib/commonjs/SpotlightOverlay.js.map +1 -0
- package/lib/commonjs/Tooltip.js +593 -0
- package/lib/commonjs/Tooltip.js.map +1 -0
- package/lib/commonjs/TourGuideContext.js +535 -0
- package/lib/commonjs/TourGuideContext.js.map +1 -0
- package/lib/commonjs/TourGuideOverlay.js +1173 -0
- package/lib/commonjs/TourGuideOverlay.js.map +1 -0
- package/lib/commonjs/TourTarget.js +80 -0
- package/lib/commonjs/TourTarget.js.map +1 -0
- package/lib/commonjs/accessibility.js +49 -0
- package/lib/commonjs/accessibility.js.map +1 -0
- package/lib/commonjs/dev.js +48 -0
- package/lib/commonjs/dev.js.map +1 -0
- package/lib/commonjs/events.js +56 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/index.js +169 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/shapes.js +158 -0
- package/lib/commonjs/shapes.js.map +1 -0
- package/lib/commonjs/storage.js +116 -0
- package/lib/commonjs/storage.js.map +1 -0
- package/lib/commonjs/themes.js +86 -0
- package/lib/commonjs/themes.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useTourPersistence.js +135 -0
- package/lib/commonjs/useTourPersistence.js.map +1 -0
- package/lib/commonjs/useTourScroll.js +46 -0
- package/lib/commonjs/useTourScroll.js.map +1 -0
- package/lib/commonjs/utils.js +372 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/validation.js +143 -0
- package/lib/commonjs/validation.js.map +1 -0
- package/lib/module/SpotlightOverlay.js +707 -0
- package/lib/module/SpotlightOverlay.js.map +1 -0
- package/lib/module/Tooltip.js +588 -0
- package/lib/module/Tooltip.js.map +1 -0
- package/lib/module/TourGuideContext.js +529 -0
- package/lib/module/TourGuideContext.js.map +1 -0
- package/lib/module/TourGuideOverlay.js +1167 -0
- package/lib/module/TourGuideOverlay.js.map +1 -0
- package/lib/module/TourTarget.js +74 -0
- package/lib/module/TourTarget.js.map +1 -0
- package/lib/module/accessibility.js +43 -0
- package/lib/module/accessibility.js.map +1 -0
- package/lib/module/dev.js +40 -0
- package/lib/module/dev.js.map +1 -0
- package/lib/module/events.js +51 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/index.js +25 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/shapes.js +152 -0
- package/lib/module/shapes.js.map +1 -0
- package/lib/module/storage.js +111 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/themes.js +81 -0
- package/lib/module/themes.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useTourPersistence.js +130 -0
- package/lib/module/useTourPersistence.js.map +1 -0
- package/lib/module/useTourScroll.js +41 -0
- package/lib/module/useTourScroll.js.map +1 -0
- package/lib/module/utils.js +361 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/validation.js +138 -0
- package/lib/module/validation.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/SpotlightOverlay.d.ts +46 -0
- package/lib/typescript/commonjs/src/SpotlightOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Tooltip.d.ts +9 -0
- package/lib/typescript/commonjs/src/Tooltip.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TourGuideContext.d.ts +46 -0
- package/lib/typescript/commonjs/src/TourGuideContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TourGuideOverlay.d.ts +22 -0
- package/lib/typescript/commonjs/src/TourGuideOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TourTarget.d.ts +36 -0
- package/lib/typescript/commonjs/src/TourTarget.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/accessibility.d.ts +22 -0
- package/lib/typescript/commonjs/src/accessibility.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/dev.d.ts +22 -0
- package/lib/typescript/commonjs/src/dev.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/events.d.ts +57 -0
- package/lib/typescript/commonjs/src/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +21 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/shapes.d.ts +50 -0
- package/lib/typescript/commonjs/src/shapes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/storage.d.ts +15 -0
- package/lib/typescript/commonjs/src/storage.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/themes.d.ts +10 -0
- package/lib/typescript/commonjs/src/themes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +599 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useTourPersistence.d.ts +63 -0
- package/lib/typescript/commonjs/src/useTourPersistence.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/useTourScroll.d.ts +36 -0
- package/lib/typescript/commonjs/src/useTourScroll.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils.d.ts +97 -0
- package/lib/typescript/commonjs/src/utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/validation.d.ts +11 -0
- package/lib/typescript/commonjs/src/validation.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/SpotlightOverlay.d.ts +46 -0
- package/lib/typescript/module/src/SpotlightOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/Tooltip.d.ts +9 -0
- package/lib/typescript/module/src/Tooltip.d.ts.map +1 -0
- package/lib/typescript/module/src/TourGuideContext.d.ts +46 -0
- package/lib/typescript/module/src/TourGuideContext.d.ts.map +1 -0
- package/lib/typescript/module/src/TourGuideOverlay.d.ts +22 -0
- package/lib/typescript/module/src/TourGuideOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/TourTarget.d.ts +36 -0
- package/lib/typescript/module/src/TourTarget.d.ts.map +1 -0
- package/lib/typescript/module/src/accessibility.d.ts +22 -0
- package/lib/typescript/module/src/accessibility.d.ts.map +1 -0
- package/lib/typescript/module/src/dev.d.ts +22 -0
- package/lib/typescript/module/src/dev.d.ts.map +1 -0
- package/lib/typescript/module/src/events.d.ts +57 -0
- package/lib/typescript/module/src/events.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +21 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/shapes.d.ts +50 -0
- package/lib/typescript/module/src/shapes.d.ts.map +1 -0
- package/lib/typescript/module/src/storage.d.ts +15 -0
- package/lib/typescript/module/src/storage.d.ts.map +1 -0
- package/lib/typescript/module/src/themes.d.ts +10 -0
- package/lib/typescript/module/src/themes.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +599 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/lib/typescript/module/src/useTourPersistence.d.ts +63 -0
- package/lib/typescript/module/src/useTourPersistence.d.ts.map +1 -0
- package/lib/typescript/module/src/useTourScroll.d.ts +36 -0
- package/lib/typescript/module/src/useTourScroll.d.ts.map +1 -0
- package/lib/typescript/module/src/utils.d.ts +97 -0
- package/lib/typescript/module/src/utils.d.ts.map +1 -0
- package/lib/typescript/module/src/validation.d.ts +11 -0
- package/lib/typescript/module/src/validation.d.ts.map +1 -0
- package/llms.txt +62 -0
- package/package.json +281 -4
- package/src/SpotlightOverlay.tsx +742 -0
- package/src/Tooltip.tsx +638 -0
- package/src/TourGuideContext.tsx +644 -0
- package/src/TourGuideOverlay.tsx +1382 -0
- package/src/TourTarget.tsx +74 -0
- package/src/accessibility.ts +60 -0
- package/src/dev.ts +39 -0
- package/src/events.ts +76 -0
- package/src/index.tsx +64 -0
- package/src/shapes.ts +184 -0
- package/src/storage.ts +114 -0
- package/src/themes.ts +83 -0
- package/src/types.ts +648 -0
- package/src/useTourPersistence.ts +147 -0
- package/src/useTourScroll.ts +60 -0
- package/src/utils.ts +401 -0
- package/src/validation.ts +248 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const darkTheme = {
|
|
4
|
+
tooltipStyles: {
|
|
5
|
+
backgroundColor: '#2C2C2E',
|
|
6
|
+
titleColor: '#FFFFFF',
|
|
7
|
+
descriptionColor: '#EBEBF5',
|
|
8
|
+
buttonTextColor: '#FFFFFF',
|
|
9
|
+
primaryButtonColor: '#007AFF',
|
|
10
|
+
secondaryButtonColor: '#3A3A3C',
|
|
11
|
+
skipButtonColor: '#8E8E93',
|
|
12
|
+
borderRadius: 12
|
|
13
|
+
},
|
|
14
|
+
spotlightStyles: {
|
|
15
|
+
overlayColor: 'black',
|
|
16
|
+
overlayOpacity: 0.6
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const lightTheme = {
|
|
20
|
+
tooltipStyles: {
|
|
21
|
+
backgroundColor: '#FFFFFF',
|
|
22
|
+
titleColor: '#1C1C1E',
|
|
23
|
+
descriptionColor: '#3A3A3C',
|
|
24
|
+
buttonTextColor: '#FFFFFF',
|
|
25
|
+
primaryButtonColor: '#007AFF',
|
|
26
|
+
secondaryButtonColor: '#E5E5EA',
|
|
27
|
+
skipButtonColor: '#8E8E93',
|
|
28
|
+
borderRadius: 12
|
|
29
|
+
},
|
|
30
|
+
spotlightStyles: {
|
|
31
|
+
overlayColor: 'black',
|
|
32
|
+
overlayOpacity: 0.4
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export const minimalTheme = {
|
|
36
|
+
tooltipStyles: {
|
|
37
|
+
backgroundColor: '#FAFAFA',
|
|
38
|
+
titleColor: '#333333',
|
|
39
|
+
descriptionColor: '#666666',
|
|
40
|
+
buttonTextColor: '#FFFFFF',
|
|
41
|
+
primaryButtonColor: '#555555',
|
|
42
|
+
secondaryButtonColor: '#E0E0E0',
|
|
43
|
+
skipButtonColor: '#999999',
|
|
44
|
+
borderRadius: 8
|
|
45
|
+
},
|
|
46
|
+
spotlightStyles: {
|
|
47
|
+
overlayColor: 'black',
|
|
48
|
+
overlayOpacity: 0.3
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export const vibrantTheme = {
|
|
52
|
+
tooltipStyles: {
|
|
53
|
+
backgroundColor: '#1A1A2E',
|
|
54
|
+
titleColor: '#EAEAEA',
|
|
55
|
+
descriptionColor: '#B0B0C0',
|
|
56
|
+
buttonTextColor: '#FFFFFF',
|
|
57
|
+
primaryButtonColor: '#E94560',
|
|
58
|
+
secondaryButtonColor: '#16213E',
|
|
59
|
+
skipButtonColor: '#8E8E93',
|
|
60
|
+
borderRadius: 16
|
|
61
|
+
},
|
|
62
|
+
spotlightStyles: {
|
|
63
|
+
overlayColor: '#0F0F23',
|
|
64
|
+
overlayOpacity: 0.7
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Create a custom theme by deep-merging overrides onto the dark theme base.
|
|
70
|
+
*/
|
|
71
|
+
export const createTheme = overrides => ({
|
|
72
|
+
tooltipStyles: {
|
|
73
|
+
...darkTheme.tooltipStyles,
|
|
74
|
+
...overrides.tooltipStyles
|
|
75
|
+
},
|
|
76
|
+
spotlightStyles: {
|
|
77
|
+
...darkTheme.spotlightStyles,
|
|
78
|
+
...overrides.spotlightStyles
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=themes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["darkTheme","tooltipStyles","backgroundColor","titleColor","descriptionColor","buttonTextColor","primaryButtonColor","secondaryButtonColor","skipButtonColor","borderRadius","spotlightStyles","overlayColor","overlayOpacity","lightTheme","minimalTheme","vibrantTheme","createTheme","overrides"],"sourceRoot":"../../src","sources":["them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BAAkB,EAAE,SAAS;IAC7BC,oBAAoB,EAAE,SAAS;IAC/BC,eAAe,EAAE,SAAS;IAC1BC,YAAY,EAAE;EAChB,CAAC;EACDC,eAAe,EAAE;IACfC,YAAY,EAAE,SAAS;IACvBC,cAAc,EAAE;EAClB;AACF,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMI,WAAW,GAAIC,SAA6B,KAAiB;EACxEhB,aAAa,EAAE;IACb,GAAGD,SAAS,CAACC,aAAa;IAC1B,GAAGgB,SAAS,CAAChB;EACf,CAAC;EACDS,eAAe,EAAE;IACf,GAAGV,SAAS,CAACU,eAAe;IAC5B,GAAGO,SAAS,CAACP;EACf;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef } from 'react';
|
|
4
|
+
import { useTourGuide } from "./TourGuideContext.js";
|
|
5
|
+
import { detectStorage } from "./storage.js";
|
|
6
|
+
import { warn } from "./dev.js";
|
|
7
|
+
const STORAGE_PREFIX = '@tour_guide:';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Hook that adds "show only once" persistence to tours.
|
|
11
|
+
* Wraps `startTour` to check if a tour has been completed before,
|
|
12
|
+
* and automatically marks tours as completed when they finish.
|
|
13
|
+
*
|
|
14
|
+
* @param storage - Optional storage adapter. When omitted, MMKV or
|
|
15
|
+
* AsyncStorage is auto-detected (in that order); with neither installed, an
|
|
16
|
+
* in-memory fallback is used and a dev warning explains persistence won't
|
|
17
|
+
* survive restarts.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
22
|
+
* import { useTourPersistence } from '@wrack/react-native-tour-guide';
|
|
23
|
+
*
|
|
24
|
+
* const { startTour, resetTour, isTourCompleted } = useTourPersistence(AsyncStorage);
|
|
25
|
+
*
|
|
26
|
+
* // Only shows the tour if user hasn't seen it before
|
|
27
|
+
* startTour(steps, { tourId: 'onboarding' });
|
|
28
|
+
*
|
|
29
|
+
* // Force show again
|
|
30
|
+
* await resetTour('onboarding');
|
|
31
|
+
* startTour(steps, { tourId: 'onboarding' });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export const useTourPersistence = storage => {
|
|
35
|
+
const tourGuide = useTourGuide();
|
|
36
|
+
// No adapter passed → auto-detect MMKV or AsyncStorage (memory fallback with
|
|
37
|
+
// a dev warning when neither is installed).
|
|
38
|
+
const resolved = storage ?? detectStorage().adapter;
|
|
39
|
+
const storageRef = useRef(resolved);
|
|
40
|
+
storageRef.current = resolved;
|
|
41
|
+
|
|
42
|
+
// Stable ref to the underlying startTour to avoid re-creating our wrapper on every render
|
|
43
|
+
const startTourRef = useRef(tourGuide.startTour);
|
|
44
|
+
startTourRef.current = tourGuide.startTour;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Check if a tour has been completed
|
|
48
|
+
*/
|
|
49
|
+
const isTourCompleted = useCallback(async tourId => {
|
|
50
|
+
try {
|
|
51
|
+
const value = await storageRef.current.getItem(`${STORAGE_PREFIX}${tourId}`);
|
|
52
|
+
return value === 'completed';
|
|
53
|
+
} catch (error) {
|
|
54
|
+
// A storage backend that is unavailable (not yet initialised, quota, web
|
|
55
|
+
// private mode) must not decide whether the user sees the tour, and must
|
|
56
|
+
// not reject into the caller. Treat "unknown" as "not completed".
|
|
57
|
+
warn(`Could not read tour state for "${tourId}" from storage: ${String(error)}. Treating the tour as not yet completed.`, 'Check that the storage adapter is initialised before calling startTour().');
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Mark a tour as completed
|
|
64
|
+
*/
|
|
65
|
+
const markCompleted = useCallback(async tourId => {
|
|
66
|
+
try {
|
|
67
|
+
await storageRef.current.setItem(`${STORAGE_PREFIX}${tourId}`, 'completed');
|
|
68
|
+
} catch (error) {
|
|
69
|
+
warn(`Could not persist completion of tour "${tourId}": ${String(error)}. The tour will show again next launch.`, 'Check that the storage adapter is writable.');
|
|
70
|
+
}
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Reset a tour so it shows again
|
|
75
|
+
*/
|
|
76
|
+
const resetTour = useCallback(async tourId => {
|
|
77
|
+
try {
|
|
78
|
+
await storageRef.current.removeItem(`${STORAGE_PREFIX}${tourId}`);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
warn(`Could not reset tour "${tourId}": ${String(error)}.`, 'Check that the storage adapter supports removeItem().');
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Start a tour only if it hasn't been completed.
|
|
86
|
+
* Automatically marks the tour as completed when finished.
|
|
87
|
+
* Requires `config.tourId` to be set.
|
|
88
|
+
*
|
|
89
|
+
* @param force - If true, show the tour even if previously completed
|
|
90
|
+
* @returns true if the tour was started, false if it was skipped
|
|
91
|
+
*/
|
|
92
|
+
const startTour = useCallback(async (steps, config, force = false) => {
|
|
93
|
+
const tourId = config?.tourId;
|
|
94
|
+
if (!tourId) {
|
|
95
|
+
warn('useTourPersistence.startTour() was called without config.tourId, so the tour cannot be remembered and will show every time.', "Pass a stable id: startTour(steps, { tourId: 'onboarding' }).");
|
|
96
|
+
startTourRef.current(steps, config);
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Check if already completed
|
|
101
|
+
if (!force) {
|
|
102
|
+
const completed = await isTourCompleted(tourId);
|
|
103
|
+
if (completed) return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Wrap onTourEnd to mark as completed
|
|
107
|
+
const originalOnTourEnd = config?.onTourEnd;
|
|
108
|
+
const enhancedConfig = {
|
|
109
|
+
...config,
|
|
110
|
+
onTourEnd: completed => {
|
|
111
|
+
if (completed) {
|
|
112
|
+
// Fire-and-forget, but never as an unhandled rejection: markCompleted
|
|
113
|
+
// already swallows and reports storage failures.
|
|
114
|
+
void markCompleted(tourId);
|
|
115
|
+
}
|
|
116
|
+
originalOnTourEnd?.(completed);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
startTourRef.current(steps, enhancedConfig);
|
|
120
|
+
return true;
|
|
121
|
+
}, [isTourCompleted, markCompleted]);
|
|
122
|
+
return {
|
|
123
|
+
...tourGuide,
|
|
124
|
+
startTour,
|
|
125
|
+
isTourCompleted,
|
|
126
|
+
resetTour,
|
|
127
|
+
markCompleted
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=useTourPersistence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useTourGuide","detectStorage","warn","STORAGE_PREFIX","useTourPersistence","storage","tourGuide","resolved","adapter","storageRef","current","startTourRef","startTour","isTourCompleted","tourId","value","getItem","error","String","markCompleted","setItem","resetTour","removeItem","steps","config","force","completed","originalOnTourEnd","onTourEnd","enhancedConfig"],"sourceRoot":"../../src","sources":["useTourPersistence.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAG3C,SAASC,YAAY,QAAQ,uBAAoB;AACjD,SAASC,aAAa,QAAQ,cAAW;AACzC,SAASC,IAAI,QAAQ,UAAO;AAE5B,MAAMC,cAAc,GAAG,cAAc;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAIC,OAAqB,IAAK;EAC3D,MAAMC,SAAS,GAAGN,YAAY,CAAC,CAAC;EAChC;EACA;EACA,MAAMO,QAAQ,GAAGF,OAAO,I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,EAAE;MACdf,IAAI,CACF,yBAAyBY,MAAM,MAAMI,MAAM,CAACD,KAAK,CAAC,GAAG,EACrD,uDACF,CAAC;IACH;EACF,CAAC,EAAE,EAAE,CAAC;;EAEN;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAML,SAAS,GAAGd,WAAW,CAC3B,OAAOyB,KAAiB,EAAEC,MAAwB,EAAEC,KAAK,GAAG,KAAK,KAAuB;IACtF,MAAMX,MAAM,GAAGU,MAAM,EAAEV,MAAM;IAC7B,IAAI,CAACA,MAAM,EAAE;MACXZ,IAAI,CACF,6HAA6H,EAC7H,+DACF,CAAC;MACDS,YAAY,CAACD,OAAO,CAACa,KAAK,EAAEC,MAAM,CAAC;MACnC,OAAO,IAAI;IACb;;IAEA;IACA,IAAI,CAACC,KAAK,EAAE;MACV,MAAMC,SAAS,GAAG,MAAMb,eAAe,CAACC,MAAM,CAAC;MAC/C,IAAIY,SAAS,EAAE,OAAO,KAAK;IAC7B;;IAEA;IACA,MAAMC,iBAAiB,GAAGH,MAAM,EAAEI,SAAS;IAC3C,MAAMC,cAA+B,GAAG;MACtC,GAAGL,MAAM;MACTI,SAAS,EAAGF,SAAkB,IAAK;QACjC,IAAIA,SAAS,EAAE;UACb;UACA;UACA,KAAKP,aAAa,CAACL,MAAM,CAAC;QAC5B;QACAa,iBAAiB,GAAGD,SAAS,CAAC;MAChC;IACF,CAAC;IAEDf,YAAY,CAACD,OAAO,CAACa,KAAK,EAAEM,cAAc,CAAC;IAC3C,OAAO,IAAI;EACb,CAAC,EACD,CAAChB,eAAe,EAAEM,aAAa,CACjC,CAAC;EAED,OAAO;IACL,GAAGb,SAAS;IACZM,SAAS;IACTC,eAAe;IACfQ,SAAS;IACTF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
|
+
import { useTourGuide } from "./TourGuideContext.js";
|
|
5
|
+
/**
|
|
6
|
+
* Binds a scrollable to the tour. Wiring this up gives the tour three things:
|
|
7
|
+
*
|
|
8
|
+
* 1. **`followTarget`** — with `config.followTarget: true`, the spotlight and
|
|
9
|
+
* tooltip stay glued to the target while the user scrolls freely.
|
|
10
|
+
* 2. **Exact auto-scroll settling** — `onMomentumScrollEnd` tells the tour the
|
|
11
|
+
* programmatic scroll finished, so the highlight lands immediately instead
|
|
12
|
+
* of waiting for position polling to detect the stop.
|
|
13
|
+
* 3. **A tracked scroll offset** — `getCurrentScrollOffset` becomes redundant;
|
|
14
|
+
* the tour reads the offset it saw last.
|
|
15
|
+
*
|
|
16
|
+
* Already have your own onScroll? Compose: call both handlers, or spread
|
|
17
|
+
* `scrollProps` and call your handler from a wrapper.
|
|
18
|
+
*/
|
|
19
|
+
export const useTourScroll = () => {
|
|
20
|
+
const {
|
|
21
|
+
__reportScroll,
|
|
22
|
+
__reportScrollEnd
|
|
23
|
+
} = useTourGuide();
|
|
24
|
+
const onScroll = useCallback(e => {
|
|
25
|
+
__reportScroll?.(e.nativeEvent.contentOffset.y);
|
|
26
|
+
}, [__reportScroll]);
|
|
27
|
+
const onMomentumScrollEnd = useCallback(() => {
|
|
28
|
+
__reportScrollEnd?.();
|
|
29
|
+
}, [__reportScrollEnd]);
|
|
30
|
+
const scrollProps = useMemo(() => ({
|
|
31
|
+
onScroll,
|
|
32
|
+
onMomentumScrollEnd,
|
|
33
|
+
scrollEventThrottle: 16
|
|
34
|
+
}), [onScroll, onMomentumScrollEnd]);
|
|
35
|
+
return {
|
|
36
|
+
scrollProps,
|
|
37
|
+
onScroll,
|
|
38
|
+
onMomentumScrollEnd
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=useTourScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useTourGuide","useTourScroll","__reportScroll","__reportScrollEnd","onScroll","e","nativeEvent","contentOffset","y","onMomentumScrollEnd","scrollProps","scrollEventThrottle"],"sourceRoot":"../../src","sources":["useTourScroll.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAG5C,SAASC,YAAY,QAAQ,uBAAoB;AAsBjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAyB;EACpD,MAAM;IAAEC,cAAc;IAAEC;EAAkB,CAAC,GAAGH,YAAY,CAAC,CAAC;EAE5D,MAAMI,QAAQ,GAAGN,WAAW,CACzBO,CAA0C,IAAK;IAC9CH,cAAc,GAAGG,CAAC,CAACC,WAAW,CAACC,aAAa,CAACC,CAAC,CAAC;EACjD,CAAC,EACD,CAACN,cAAc,CACjB,CAAC;EAED,MAAMO,mBAAmB,GAAGX,WAAW,CAAC,MAAM;IAC5CK,iBAAiB,GAAG,CAAC;EACvB,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,MAAMO,WAAW,GAAGX,OAAO,CACzB,OAAO;IAAEK,QAAQ;IAAEK,mBAAmB;IAAEE,mBAAmB,EAAE;EAAG,CAAC,CAAC,EAClE,CAACP,QAAQ,EAAEK,mBAAmB,CAChC,CAAC;EAED,OAAO;IAAEC,WAAW;IAAEN,QAAQ;IAAEK;EAAoB,CAAC;AACvD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, Platform, StatusBar } from 'react-native';
|
|
4
|
+
import { warnOnce } from "./dev.js";
|
|
5
|
+
const ZERO_INSETS = {
|
|
6
|
+
top: 0,
|
|
7
|
+
bottom: 0,
|
|
8
|
+
left: 0,
|
|
9
|
+
right: 0
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Compute the best tooltip position based on available screen space.
|
|
14
|
+
* Prefers: bottom > top > right > left.
|
|
15
|
+
* `insets` shrink the usable area so the tour avoids system chrome.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const computeTooltipPosition = ({
|
|
19
|
+
target,
|
|
20
|
+
screenWidth,
|
|
21
|
+
screenHeight,
|
|
22
|
+
tooltipWidth,
|
|
23
|
+
tooltipHeight = 150,
|
|
24
|
+
offset = 20,
|
|
25
|
+
insets = ZERO_INSETS
|
|
26
|
+
}) => {
|
|
27
|
+
const spaceAbove = target.y - offset - insets.top;
|
|
28
|
+
const spaceBelow = screenHeight - insets.bottom - (target.y + target.height + offset);
|
|
29
|
+
const spaceLeft = target.x - offset - insets.left;
|
|
30
|
+
const spaceRight = screenWidth - insets.right - (target.x + target.width + offset);
|
|
31
|
+
if (spaceBelow >= tooltipHeight) return 'bottom';
|
|
32
|
+
if (spaceAbove >= tooltipHeight) return 'top';
|
|
33
|
+
if (spaceRight >= tooltipWidth * 0.6) return 'right';
|
|
34
|
+
if (spaceLeft >= tooltipWidth * 0.6) return 'left';
|
|
35
|
+
return spaceBelow >= spaceAbove ? 'bottom' : 'top';
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Cache the safe-area lookup from react-native-safe-area-context (optional dep).
|
|
39
|
+
// `undefined` = not resolved yet, `null` = lib unavailable.
|
|
40
|
+
let _autoInsets;
|
|
41
|
+
const getAutoInsets = () => {
|
|
42
|
+
if (_autoInsets === undefined) {
|
|
43
|
+
try {
|
|
44
|
+
// initialWindowMetrics is a synchronous snapshot — no hook required, so
|
|
45
|
+
// this works from plain functions and is set once at app launch.
|
|
46
|
+
|
|
47
|
+
const mod = require('react-native-safe-area-context');
|
|
48
|
+
const metricsInsets = mod?.initialWindowMetrics?.insets;
|
|
49
|
+
_autoInsets = metricsInsets ? {
|
|
50
|
+
top: metricsInsets.top ?? 0,
|
|
51
|
+
bottom: metricsInsets.bottom ?? 0,
|
|
52
|
+
left: metricsInsets.left ?? 0,
|
|
53
|
+
right: metricsInsets.right ?? 0
|
|
54
|
+
} : null;
|
|
55
|
+
} catch {
|
|
56
|
+
_autoInsets = null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (_autoInsets) return _autoInsets;
|
|
60
|
+
// Fallback: Android status-bar height for the top edge; nothing reliable for
|
|
61
|
+
// the bottom without the safe-area lib, so consumers should pass `insets`.
|
|
62
|
+
const top = Platform.OS === 'android' ? StatusBar.currentHeight ?? 0 : 0;
|
|
63
|
+
return {
|
|
64
|
+
top,
|
|
65
|
+
bottom: 0,
|
|
66
|
+
left: 0,
|
|
67
|
+
right: 0
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Resolve just the safe-area insets (auto-detected, or overridden via
|
|
73
|
+
* `config.insets`) — WITHOUT any `extraInsets`. This is the value that mirrors
|
|
74
|
+
* system chrome like the status bar, and is what corrects `measureInWindow`
|
|
75
|
+
* coordinates on Android (see TourGuideOverlay).
|
|
76
|
+
*/
|
|
77
|
+
export const resolveSafeAreaInsets = config => {
|
|
78
|
+
const auto = getAutoInsets();
|
|
79
|
+
return {
|
|
80
|
+
top: config?.insets?.top ?? auto.top,
|
|
81
|
+
bottom: config?.insets?.bottom ?? auto.bottom,
|
|
82
|
+
left: config?.insets?.left ?? auto.left,
|
|
83
|
+
right: config?.insets?.right ?? auto.right
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Resolve the effective insets the tour should respect for layout/clamping:
|
|
89
|
+
* the safe area plus any `config.extraInsets` for app chrome like tab bars and
|
|
90
|
+
* headers.
|
|
91
|
+
*/
|
|
92
|
+
export const resolveInsets = config => {
|
|
93
|
+
const base = resolveSafeAreaInsets(config);
|
|
94
|
+
const extra = config?.extraInsets;
|
|
95
|
+
return {
|
|
96
|
+
top: base.top + (extra?.top ?? 0),
|
|
97
|
+
bottom: base.bottom + (extra?.bottom ?? 0),
|
|
98
|
+
left: base.left + (extra?.left ?? 0),
|
|
99
|
+
right: base.right + (extra?.right ?? 0)
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Validate that a ref is valid and points to a mounted component.
|
|
105
|
+
* Returns true if valid, false otherwise.
|
|
106
|
+
*/
|
|
107
|
+
export const validateRef = (ref, stepId) => {
|
|
108
|
+
// No ref at all is an intentional, supported case: a centered tooltip with no
|
|
109
|
+
// spotlight (e.g. a welcome/finish step). Don't warn — it's not a mistake.
|
|
110
|
+
if (!ref) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// A ref was provided but points to nothing — this usually IS a mistake
|
|
115
|
+
// (component not mounted yet / wrong ref), so it's worth a dev warning.
|
|
116
|
+
if (!ref.current) {
|
|
117
|
+
warnOnce(`Step "${stepId}" has a targetRef whose .current is null, so there is nothing to highlight. Showing a centered tooltip instead.`, 'Attach the ref to a rendered host component (e.g. <View ref={ref}>) and make sure it is mounted before startTour() runs.');
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Extract border radius values from a View style.
|
|
125
|
+
* Returns a SpotlightBorderRadius (number if uniform, object if per-corner),
|
|
126
|
+
* or undefined if no border radius is specified.
|
|
127
|
+
*
|
|
128
|
+
* Percentage radii (e.g. `'50%'`, supported by React Native 0.76+) are resolved
|
|
129
|
+
* against the target's shorter side when `target` dimensions are provided — this
|
|
130
|
+
* is what keeps a circular avatar (`borderRadius: '50%'`) round instead of square.
|
|
131
|
+
* Without `target`, percentages fall back to the numeric base/0.
|
|
132
|
+
*/
|
|
133
|
+
export const extractBorderRadius = (style, target) => {
|
|
134
|
+
if (!style) return undefined;
|
|
135
|
+
const flat = StyleSheet.flatten(style);
|
|
136
|
+
if (!flat) return undefined;
|
|
137
|
+
const {
|
|
138
|
+
borderRadius,
|
|
139
|
+
borderTopLeftRadius,
|
|
140
|
+
borderTopRightRadius,
|
|
141
|
+
borderBottomLeftRadius,
|
|
142
|
+
borderBottomRightRadius
|
|
143
|
+
} = flat;
|
|
144
|
+
|
|
145
|
+
// No border radius properties at all
|
|
146
|
+
if (borderRadius === undefined && borderTopLeftRadius === undefined && borderTopRightRadius === undefined && borderBottomLeftRadius === undefined && borderBottomRightRadius === undefined) {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// The shorter side: a radius of `minDim / 2` produces a circle (square target)
|
|
151
|
+
// or a pill (rectangular target), which is exactly how RN renders `'50%'`.
|
|
152
|
+
const minDim = target ? Math.min(target.width, target.height) : 0;
|
|
153
|
+
|
|
154
|
+
// Coerce to a number, resolving percentage strings against the target.
|
|
155
|
+
const toNum = (v, fallback) => {
|
|
156
|
+
if (typeof v === 'number') return v;
|
|
157
|
+
if (typeof v === 'string') {
|
|
158
|
+
const trimmed = v.trim();
|
|
159
|
+
if (trimmed.endsWith('%')) {
|
|
160
|
+
const pct = parseFloat(trimmed);
|
|
161
|
+
if (!Number.isNaN(pct) && minDim > 0) return pct / 100 * minDim;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return fallback;
|
|
165
|
+
};
|
|
166
|
+
const base = toNum(borderRadius, 0);
|
|
167
|
+
const tl = toNum(borderTopLeftRadius, base);
|
|
168
|
+
const tr = toNum(borderTopRightRadius, base);
|
|
169
|
+
const br = toNum(borderBottomRightRadius, base);
|
|
170
|
+
const bl = toNum(borderBottomLeftRadius, base);
|
|
171
|
+
|
|
172
|
+
// All corners the same → return number for smooth rect animation
|
|
173
|
+
if (tl === tr && tr === br && br === bl) {
|
|
174
|
+
return tl;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
topLeft: tl,
|
|
178
|
+
topRight: tr,
|
|
179
|
+
bottomRight: br,
|
|
180
|
+
bottomLeft: bl
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Scroll a scrollable ref to an absolute Y offset.
|
|
186
|
+
*
|
|
187
|
+
* Consumers pass all kinds of scrollables, and each exposes a different imperative
|
|
188
|
+
* API — assuming `scrollTo` crashes with `scrollTo is not a function` on the most
|
|
189
|
+
* common one (`FlatList`). This normalises across:
|
|
190
|
+
*
|
|
191
|
+
* - `ScrollView` (and gesture-handler / Animated wrappers) → `scrollTo`
|
|
192
|
+
* - `FlatList` / `VirtualizedList` → `scrollToOffset`
|
|
193
|
+
* - `SectionList` and other list wrappers → `getScrollResponder()` / `getScrollRef()`
|
|
194
|
+
* - legacy `Animated.ScrollView` → `getNode()`
|
|
195
|
+
* - `KeyboardAwareScrollView` → `scrollToPosition`
|
|
196
|
+
*
|
|
197
|
+
* @returns true if a scroll was actually issued, false if the ref exposes no
|
|
198
|
+
* usable scroll method (the caller should then continue without scrolling
|
|
199
|
+
* rather than leaving the tour stuck).
|
|
200
|
+
*/
|
|
201
|
+
export const scrollRefToY = (scrollRef, y, animated) => {
|
|
202
|
+
const node = scrollRef?.current;
|
|
203
|
+
if (!node) return false;
|
|
204
|
+
const targetY = Math.max(0, y);
|
|
205
|
+
|
|
206
|
+
// Unwrap legacy Animated.ScrollView / list wrappers that hide the real
|
|
207
|
+
// scrollable behind a getter.
|
|
208
|
+
const candidates = [node];
|
|
209
|
+
for (const getter of ['getNode', 'getScrollResponder', 'getScrollRef']) {
|
|
210
|
+
try {
|
|
211
|
+
if (typeof node[getter] === 'function') {
|
|
212
|
+
const inner = node[getter]();
|
|
213
|
+
if (inner) candidates.push(inner);
|
|
214
|
+
}
|
|
215
|
+
} catch {
|
|
216
|
+
// A getter that throws (unmounted inner list) is not usable — skip it.
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
for (const c of candidates) {
|
|
220
|
+
try {
|
|
221
|
+
if (typeof c.scrollTo === 'function') {
|
|
222
|
+
c.scrollTo({
|
|
223
|
+
x: 0,
|
|
224
|
+
y: targetY,
|
|
225
|
+
animated
|
|
226
|
+
});
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
if (typeof c.scrollToOffset === 'function') {
|
|
230
|
+
c.scrollToOffset({
|
|
231
|
+
offset: targetY,
|
|
232
|
+
animated
|
|
233
|
+
});
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
if (typeof c.scrollToPosition === 'function') {
|
|
237
|
+
c.scrollToPosition(0, targetY, animated);
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
} catch {
|
|
241
|
+
// Try the next candidate rather than taking the whole tour down.
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return false;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// ─── Color parsing for readable-by-default tooltips ──────────────────────────
|
|
248
|
+
|
|
249
|
+
const NAMED_COLORS = {
|
|
250
|
+
white: '#ffffff',
|
|
251
|
+
black: '#000000',
|
|
252
|
+
gray: '#808080',
|
|
253
|
+
grey: '#808080',
|
|
254
|
+
red: '#ff0000',
|
|
255
|
+
blue: '#0000ff',
|
|
256
|
+
green: '#008000',
|
|
257
|
+
yellow: '#ffff00',
|
|
258
|
+
orange: '#ffa500',
|
|
259
|
+
purple: '#800080',
|
|
260
|
+
transparent: '#00000000'
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Whether a background color is light (true), dark (false), or unparseable
|
|
265
|
+
* (null). Supports #rgb/#rgba/#rrggbb/#rrggbbaa, rgb()/rgba(), and a handful of
|
|
266
|
+
* common named colors — enough for the tooltip-background use case; anything
|
|
267
|
+
* exotic returns null and callers keep their existing defaults.
|
|
268
|
+
*
|
|
269
|
+
* Used to pick readable default text colors when a consumer sets a custom
|
|
270
|
+
* tooltip background: a pale background used to get the built-in white title
|
|
271
|
+
* text, which is invisible.
|
|
272
|
+
*/
|
|
273
|
+
export const isLightColor = color => {
|
|
274
|
+
if (typeof color !== 'string') return null;
|
|
275
|
+
let c = color.trim().toLowerCase();
|
|
276
|
+
c = NAMED_COLORS[c] ?? c;
|
|
277
|
+
let r, g, b;
|
|
278
|
+
const rgbMatch = c.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/);
|
|
279
|
+
if (rgbMatch) {
|
|
280
|
+
r = parseFloat(rgbMatch[1]);
|
|
281
|
+
g = parseFloat(rgbMatch[2]);
|
|
282
|
+
b = parseFloat(rgbMatch[3]);
|
|
283
|
+
} else if (/^#[0-9a-f]{3,8}$/.test(c)) {
|
|
284
|
+
const hex = c.slice(1);
|
|
285
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
286
|
+
r = parseInt(hex[0] + hex[0], 16);
|
|
287
|
+
g = parseInt(hex[1] + hex[1], 16);
|
|
288
|
+
b = parseInt(hex[2] + hex[2], 16);
|
|
289
|
+
} else if (hex.length === 6 || hex.length === 8) {
|
|
290
|
+
r = parseInt(hex.slice(0, 2), 16);
|
|
291
|
+
g = parseInt(hex.slice(2, 4), 16);
|
|
292
|
+
b = parseInt(hex.slice(4, 6), 16);
|
|
293
|
+
} else {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
if ([r, g, b].some(v => Number.isNaN(v) || v < 0 || v > 255)) return null;
|
|
300
|
+
|
|
301
|
+
// Perceived brightness (ITU-R BT.601), same scale tinycolor uses: 0-255.
|
|
302
|
+
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
303
|
+
return brightness > 180;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// ─── Per-platform config values ──────────────────────────────────────────────
|
|
307
|
+
|
|
308
|
+
const OS_KEYS = new Set(['ios', 'android', 'web', 'default']);
|
|
309
|
+
const isOSConfig = value => {
|
|
310
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) return false;
|
|
311
|
+
const keys = Object.keys(value);
|
|
312
|
+
return keys.length > 0 && keys.every(k => OS_KEYS.has(k));
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Resolve a possibly per-platform value for the running OS.
|
|
317
|
+
* `{ ios: 12, default: 8 }` → 12 on iOS, 8 elsewhere.
|
|
318
|
+
*/
|
|
319
|
+
export const osValue = value => {
|
|
320
|
+
if (value === undefined || !isOSConfig(value)) return value;
|
|
321
|
+
const perOS = value;
|
|
322
|
+
return perOS[Platform.OS] ?? perOS.default;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
// A typo'd OS key ({ iOS: 320 } or { web: 12, macos: 10 }) makes the object
|
|
326
|
+
// fail the OS-config signature check, so it passes through UNRESOLVED and
|
|
327
|
+
// reaches layout math as a raw object. Diagnose that in dev.
|
|
328
|
+
const warnIfMalformedOSConfig = (field, value) => {
|
|
329
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value) || isOSConfig(value)) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const keys = Object.keys(value);
|
|
333
|
+
// Only flag objects that LOOK like an attempted per-platform value.
|
|
334
|
+
if (keys.some(k => OS_KEYS.has(k)) || keys.some(k => /^(ios|android|web)$/i.test(k))) {
|
|
335
|
+
warnOnce(`config.${field} looks like a per-platform value but has unrecognised keys (${keys.join(', ')}), so it was not resolved.`, 'Use exactly { ios, android, web, default } — lowercase — e.g. { ios: 320, default: 300 }.');
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Resolve every PerPlatform field of a tour config for the running OS.
|
|
341
|
+
* Called once in startTour, so everything downstream reads plain values.
|
|
342
|
+
*/
|
|
343
|
+
export const resolvePlatformConfig = config => {
|
|
344
|
+
if (!config) return config;
|
|
345
|
+
warnIfMalformedOSConfig('animationDuration', config.animationDuration);
|
|
346
|
+
warnIfMalformedOSConfig('motion', config.motion);
|
|
347
|
+
warnIfMalformedOSConfig('safeZoneOffset', config.safeZoneOffset);
|
|
348
|
+
warnIfMalformedOSConfig('tooltipWidth', config.tooltipWidth);
|
|
349
|
+
warnIfMalformedOSConfig('triangleSize', config.triangleSize);
|
|
350
|
+
warnIfMalformedOSConfig('tooltipOffset', config.tooltipOffset);
|
|
351
|
+
return {
|
|
352
|
+
...config,
|
|
353
|
+
animationDuration: osValue(config.animationDuration),
|
|
354
|
+
motion: osValue(config.motion),
|
|
355
|
+
safeZoneOffset: osValue(config.safeZoneOffset),
|
|
356
|
+
tooltipWidth: osValue(config.tooltipWidth),
|
|
357
|
+
triangleSize: osValue(config.triangleSize),
|
|
358
|
+
tooltipOffset: osValue(config.tooltipOffset)
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","Platform","StatusBar","warnOnce","ZERO_INSETS","top","bottom","left","right","computeTooltipPosition","target","screenWidth","screenHeight","tooltipWidth","tooltipHeight","offset","insets","spaceAbove","y","spaceBelow","height","spaceLeft","x","spaceRight","width","_autoInsets","getAutoInsets","undefined","mod","require","metricsInsets","initialWindowMetrics","OS","currentHeight","resolveSafeAreaInsets","config","auto","resolveInsets","base","extra","extraInsets","validateRef","ref","stepId","current","extractBorderRadius","style","flat","flatten","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","minDim","Math","min","toNum","v","fallback","trimmed","trim","endsWith","pct","parseFloat","Number","isNaN","tl","tr","br","bl","topLeft","topRight","bottomRight","bottomLeft","scrollRefToY","scrollRef","animated","node","targetY","max","candidates","getter","inner","push","c","scrollTo","scrollToOffset","scrollToPosition","NAMED_COLORS","white","black","gray","grey","red","blue","green","yellow","orange","purple","transparent","isLightColor","color","toLowerCase","r","g","b","rgbMatch","match","test","hex","slice","length","parseInt","some","brightness","OS_KEYS","Set","isOSConfig","value","Array","isArray","keys","Object","every","k","has","osValue","perOS","default","warnIfMalformedOSConfig","field","join","resolvePlatformConfig","animationDuration","motion","safeZoneOffset","triangleSize","tooltipOffset"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;AAAA,SAASA,U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