react-native-lumen 1.0.0 → 1.1.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/README.md +763 -231
- package/lib/module/components/TourOverlay.js +43 -3
- package/lib/module/components/TourOverlay.js.map +1 -1
- package/lib/module/components/TourProvider.js +318 -63
- package/lib/module/components/TourProvider.js.map +1 -1
- package/lib/module/components/TourTooltip.js +121 -79
- package/lib/module/components/TourTooltip.js.map +1 -1
- package/lib/module/components/TourZone.js +186 -119
- package/lib/module/components/TourZone.js.map +1 -1
- package/lib/module/constants/defaults.js +43 -0
- package/lib/module/constants/defaults.js.map +1 -1
- package/lib/module/context/TourContext.js +5 -0
- package/lib/module/context/TourContext.js.map +1 -0
- package/lib/module/hooks/useTour.js +1 -1
- package/lib/module/hooks/useTour.js.map +1 -1
- package/lib/module/hooks/useTourScrollView.js +71 -0
- package/lib/module/hooks/useTourScrollView.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/storage.js +188 -0
- package/lib/module/utils/storage.js.map +1 -0
- package/lib/typescript/src/components/TourOverlay.d.ts.map +1 -1
- package/lib/typescript/src/components/TourProvider.d.ts +21 -4
- package/lib/typescript/src/components/TourProvider.d.ts.map +1 -1
- package/lib/typescript/src/components/TourTooltip.d.ts.map +1 -1
- package/lib/typescript/src/components/TourZone.d.ts +19 -1
- package/lib/typescript/src/components/TourZone.d.ts.map +1 -1
- package/lib/typescript/src/constants/defaults.d.ts +10 -0
- package/lib/typescript/src/constants/defaults.d.ts.map +1 -1
- package/lib/typescript/src/context/TourContext.d.ts +3 -0
- package/lib/typescript/src/context/TourContext.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useTourScrollView.d.ts +65 -0
- package/lib/typescript/src/hooks/useTourScrollView.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +296 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/storage.d.ts +51 -0
- package/lib/typescript/src/utils/storage.d.ts.map +1 -0
- package/package.json +173 -171
- package/src/components/TourOverlay.tsx +45 -2
- package/src/components/TourProvider.tsx +409 -57
- package/src/components/TourTooltip.tsx +151 -74
- package/src/components/TourZone.tsx +238 -141
- package/src/constants/defaults.ts +51 -0
- package/src/context/TourContext.ts +4 -0
- package/src/hooks/useTour.ts +1 -1
- package/src/hooks/useTourScrollView.ts +111 -0
- package/src/index.tsx +27 -0
- package/src/types/index.ts +306 -1
- package/src/utils/storage.ts +226 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Storage adapter for tour persistence.
|
|
5
|
+
* Auto-detects available storage (MMKV v4 or AsyncStorage) and provides a unified interface.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ─── Types ───────────────────────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
// ─── Storage Detection ───────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
let cachedStorageType = null;
|
|
13
|
+
let cachedAdapter = null;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Attempts to detect and return the MMKV v4 default instance.
|
|
17
|
+
* Returns null if MMKV is not available.
|
|
18
|
+
*/
|
|
19
|
+
function tryGetMMKV() {
|
|
20
|
+
try {
|
|
21
|
+
// Try to require react-native-mmkv (v4 uses different API)
|
|
22
|
+
|
|
23
|
+
const mmkvModule = require('react-native-mmkv');
|
|
24
|
+
|
|
25
|
+
// MMKV v4 exports createMMKV function
|
|
26
|
+
if (mmkvModule?.createMMKV) {
|
|
27
|
+
const createMMKV = mmkvModule.createMMKV;
|
|
28
|
+
// Create a dedicated instance for tour storage
|
|
29
|
+
const storage = createMMKV({
|
|
30
|
+
id: 'react-native-lumen-tour'
|
|
31
|
+
});
|
|
32
|
+
if (typeof storage.getString === 'function' && typeof storage.set === 'function' && typeof storage.remove === 'function') {
|
|
33
|
+
return {
|
|
34
|
+
getItem: key => storage.getString(key) ?? null,
|
|
35
|
+
setItem: (key, value) => storage.set(key, value),
|
|
36
|
+
removeItem: key => storage.remove(key)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Attempts to detect and return AsyncStorage.
|
|
48
|
+
* Returns null if AsyncStorage is not available.
|
|
49
|
+
*/
|
|
50
|
+
function tryGetAsyncStorage() {
|
|
51
|
+
try {
|
|
52
|
+
// Try to require @react-native-async-storage/async-storage
|
|
53
|
+
|
|
54
|
+
const asyncStorageModule = require('@react-native-async-storage/async-storage');
|
|
55
|
+
const AsyncStorage = asyncStorageModule?.default || asyncStorageModule;
|
|
56
|
+
if (AsyncStorage && typeof AsyncStorage.getItem === 'function' && typeof AsyncStorage.setItem === 'function' && typeof AsyncStorage.removeItem === 'function') {
|
|
57
|
+
return {
|
|
58
|
+
getItem: key => AsyncStorage.getItem(key),
|
|
59
|
+
setItem: (key, value) => AsyncStorage.setItem(key, value),
|
|
60
|
+
removeItem: key => AsyncStorage.removeItem(key)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Detects the available storage type and returns an adapter.
|
|
71
|
+
* Priority: MMKV v4 > AsyncStorage > none
|
|
72
|
+
*/
|
|
73
|
+
export function detectStorage() {
|
|
74
|
+
// Return cached result if available
|
|
75
|
+
if (cachedStorageType !== null) {
|
|
76
|
+
return {
|
|
77
|
+
type: cachedStorageType,
|
|
78
|
+
adapter: cachedAdapter
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Try MMKV first (fastest)
|
|
83
|
+
const mmkvAdapter = tryGetMMKV();
|
|
84
|
+
if (mmkvAdapter) {
|
|
85
|
+
cachedStorageType = 'mmkv';
|
|
86
|
+
cachedAdapter = mmkvAdapter;
|
|
87
|
+
return {
|
|
88
|
+
type: 'mmkv',
|
|
89
|
+
adapter: mmkvAdapter
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Try AsyncStorage
|
|
94
|
+
const asyncStorageAdapter = tryGetAsyncStorage();
|
|
95
|
+
if (asyncStorageAdapter) {
|
|
96
|
+
cachedStorageType = 'async-storage';
|
|
97
|
+
cachedAdapter = asyncStorageAdapter;
|
|
98
|
+
return {
|
|
99
|
+
type: 'async-storage',
|
|
100
|
+
adapter: asyncStorageAdapter
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// No storage available
|
|
105
|
+
cachedStorageType = 'none';
|
|
106
|
+
cachedAdapter = null;
|
|
107
|
+
return {
|
|
108
|
+
type: 'none',
|
|
109
|
+
adapter: null
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Clears the cached storage detection result.
|
|
115
|
+
* Useful for testing or when storage availability changes.
|
|
116
|
+
*/
|
|
117
|
+
export function clearStorageCache() {
|
|
118
|
+
cachedStorageType = null;
|
|
119
|
+
cachedAdapter = null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ─── Storage Key Generation ──────────────────────────────────────────────────
|
|
123
|
+
|
|
124
|
+
const STORAGE_KEY_PREFIX = '@lumen_tour_';
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Generates a storage key for a specific tour.
|
|
128
|
+
*/
|
|
129
|
+
export function getTourStorageKey(tourId) {
|
|
130
|
+
return `${STORAGE_KEY_PREFIX}${tourId}`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// ─── Storage Operations ──────────────────────────────────────────────────────
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Saves the current tour progress to storage.
|
|
137
|
+
*/
|
|
138
|
+
export async function saveTourProgress(adapter, tourId, currentStepKey, stepIndex) {
|
|
139
|
+
const state = {
|
|
140
|
+
tourId,
|
|
141
|
+
currentStepKey,
|
|
142
|
+
stepIndex,
|
|
143
|
+
timestamp: Date.now()
|
|
144
|
+
};
|
|
145
|
+
const key = getTourStorageKey(tourId);
|
|
146
|
+
const value = JSON.stringify(state);
|
|
147
|
+
await adapter.setItem(key, value);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Loads the saved tour progress from storage.
|
|
152
|
+
* Returns null if no progress is saved or if the data is invalid.
|
|
153
|
+
*/
|
|
154
|
+
export async function loadTourProgress(adapter, tourId) {
|
|
155
|
+
try {
|
|
156
|
+
const key = getTourStorageKey(tourId);
|
|
157
|
+
const value = await adapter.getItem(key);
|
|
158
|
+
if (!value) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
const state = JSON.parse(value);
|
|
162
|
+
|
|
163
|
+
// Validate the loaded state
|
|
164
|
+
if (state.tourId !== tourId || typeof state.currentStepKey !== 'string' || typeof state.stepIndex !== 'number') {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
return state;
|
|
168
|
+
} catch {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Clears the saved tour progress from storage.
|
|
175
|
+
*/
|
|
176
|
+
export async function clearTourProgress(adapter, tourId) {
|
|
177
|
+
const key = getTourStorageKey(tourId);
|
|
178
|
+
await adapter.removeItem(key);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Checks if there is saved progress for a tour.
|
|
183
|
+
*/
|
|
184
|
+
export async function hasTourProgress(adapter, tourId) {
|
|
185
|
+
const progress = await loadTourProgress(adapter, tourId);
|
|
186
|
+
return progress !== null;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cachedStorageType","cachedAdapter","tryGetMMKV","mmkvModule","require","createMMKV","storage","id","getString","set","remove","getItem","key","setItem","value","removeItem","tryGetAsyncStorage","asyncStorageModule","AsyncStorage","default","detectStorage","type","adapter","mmkvAdapter","asyncStorageAdapter","clearStorageCache","STORAGE_KEY_PREFIX","getTourStorageKey","tourId","saveTourProgress","currentStepKey","stepIndex","state","timestamp","Date","now","JSON","stringify","loadTourProgress","parse","clearTourProgress","hasTourProgress","progress"],"sourceRoot":"..\\..\\..\\src","sources":["utils/storage.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA;;AAiBA;;AAEA,IAAIA,iBAAqC,GAAG,IAAI;AAChD,IAAIC,aAAoC,GAAG,IAAI;;AAE/C;AACA;AACA;AACA;AACA,SAASC,UAAUA,CAAA,EAA0B;EAC3C,IAAI;IACF;;IAEA,MAAMC,UAAU,GAAGC,OAAO,CAAC,mBAAmB,CAAC;;IAE/C;IACA,IAAID,UAAU,EAAEE,UAAU,EAAE;MAC1B,MAAMA,UAAU,GAAGF,UAAU,CAACE,UAAU;MACxC;MACA,MAAMC,OAAO,GAAGD,UAAU,CAAC;QAAEE,EAAE,EAAE;MAA0B,CAAC,CAAC;MAE7D,IACE,OAAOD,OAAO,CAACE,SAAS,KAAK,UAAU,IACvC,OAAOF,OAAO,CAACG,GAAG,KAAK,UAAU,IACjC,OAAOH,OAAO,CAACI,MAAM,KAAK,UAAU,EACpC;QACA,OAAO;UACLC,OAAO,EAAGC,GAAW,IAAKN,OAAO,CAACE,SAAS,CAACI,GAAG,CAAC,IAAI,IAAI;UACxDC,OAAO,EAAEA,CAACD,GAAW,EAAEE,KAAa,KAAKR,OAAO,CAACG,GAAG,CAACG,GAAG,EAAEE,KAAK,CAAC;UAChEC,UAAU,EAAGH,GAAW,IAAKN,OAAO,CAACI,MAAM,CAACE,GAA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CAACE,KAAK,EAAE;MACV,OAAO,IAAI;IACb;IAEA,MAAMkB,KAAuB,GAAGI,IAAI,CAACG,KAAK,CAACzB,KAAK,CAAC;;IAEjD;IACA,IACEkB,KAAK,CAACJ,MAAM,KAAKA,MAAM,IACvB,OAAOI,KAAK,CAACF,cAAc,KAAK,QAAQ,IACxC,OAAOE,KAAK,CAACD,SAAS,KAAK,QAAQ,EACnC;MACA,OAAO,IAAI;IACb;IAEA,OAAOC,KAAK;EACd,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;;AAEA;AACA;AACA;AACA,OAAO,eAAeQ,iBAAiBA,CACrClB,OAAuB,EACvBM,MAAc,EACC;EACf,MAAMhB,GAAG,GAAGe,iBAAiB,CAACC,MAAM,CAAC;EACrC,MAAMN,OAAO,CAACP,UAAU,CAACH,GAAG,CAAC;AAC/B;;AAEA;AACA;AACA;AACA,OAAO,eAAe6B,eAAeA,CACnCnB,OAAuB,EACvBM,MAAc,EACI;EAClB,MAAMc,QAAQ,GAAG,MAAMJ,gBAAgB,CAAChB,OAAO,EAAEM,MAAM,CAAC;EACxD,OAAOc,QAAQ,KAAK,IAAI;AAC1B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourOverlay.d.ts","sourceRoot":"","sources":["../../../../src/components/TourOverlay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TourOverlay.d.ts","sourceRoot":"","sources":["../../../../src/components/TourOverlay.tsx"],"names":[],"mappings":"AA4CA,eAAO,MAAM,WAAW,oFAuJtB,CAAC"}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { TourConfig,
|
|
3
|
-
export declare const TourContext: React.Context<InternalTourContextType | null>;
|
|
2
|
+
import type { TourConfig, StepsOrder } from '../types';
|
|
4
3
|
interface TourProviderProps {
|
|
5
4
|
children: React.ReactNode;
|
|
6
5
|
/**
|
|
7
|
-
* Optional custom steps order.
|
|
6
|
+
* Optional custom steps order. Supports two formats:
|
|
7
|
+
*
|
|
8
|
+
* **Flat array** (single-screen or simple multi-screen):
|
|
9
|
+
* ```
|
|
10
|
+
* stepsOrder={['bio', 'prompt', 'poll', 'filters', 'swipeableCards']}
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* **Screen-grouped object** (multi-screen tours):
|
|
14
|
+
* ```
|
|
15
|
+
* stepsOrder={{
|
|
16
|
+
* ProfileSelf: ['bio', 'prompt', 'poll'],
|
|
17
|
+
* HomeSwipe: ['filters'],
|
|
18
|
+
* SwipeableCards: ['swipeableCards'],
|
|
19
|
+
* }}
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* When using the object format, steps are flattened in the order the screens appear.
|
|
23
|
+
* The tour automatically waits when advancing to a step on an unmounted screen,
|
|
24
|
+
* and resumes when that step's TourZone mounts.
|
|
8
25
|
*/
|
|
9
|
-
stepsOrder?:
|
|
26
|
+
stepsOrder?: StepsOrder;
|
|
10
27
|
/**
|
|
11
28
|
* Initial overlay opacity. Default 0.5
|
|
12
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/TourProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TourProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/TourProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EAGV,UAAU,EAIV,UAAU,EACX,MAAM,UAAU,CAAC;AA6FlB,UAAU,iBAAiB;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAID,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAwiBpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/TourTooltip.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TourTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/TourTooltip.tsx"],"names":[],"mappings":"AAmFA,eAAO,MAAM,WAAW,2FA2MtB,CAAC"}
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
import type { ZoneStyle, ZoneShape, CardProps } from '../types';
|
|
3
4
|
interface TourZoneProps {
|
|
4
5
|
stepKey: string;
|
|
5
6
|
name?: string;
|
|
6
7
|
description: string;
|
|
7
8
|
order?: number;
|
|
8
|
-
shape?:
|
|
9
|
+
shape?: ZoneShape;
|
|
9
10
|
borderRadius?: number;
|
|
10
11
|
children: React.ReactNode;
|
|
11
12
|
style?: StyleProp<ViewStyle>;
|
|
12
13
|
clickable?: boolean;
|
|
14
|
+
preventInteraction?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
completed?: boolean;
|
|
17
|
+
zonePadding?: number;
|
|
18
|
+
zonePaddingTop?: number;
|
|
19
|
+
zonePaddingRight?: number;
|
|
20
|
+
zonePaddingBottom?: number;
|
|
21
|
+
zonePaddingLeft?: number;
|
|
22
|
+
zoneBorderWidth?: number;
|
|
23
|
+
zoneBorderColor?: string;
|
|
24
|
+
zoneGlowColor?: string;
|
|
25
|
+
zoneGlowRadius?: number;
|
|
26
|
+
zoneGlowSpread?: number;
|
|
27
|
+
zoneGlowOffsetX?: number;
|
|
28
|
+
zoneGlowOffsetY?: number;
|
|
29
|
+
zoneStyle?: ZoneStyle;
|
|
30
|
+
renderCustomCard?: (props: CardProps) => React.ReactNode;
|
|
13
31
|
}
|
|
14
32
|
export declare const TourZone: React.FC<TourZoneProps>;
|
|
15
33
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourZone.d.ts","sourceRoot":"","sources":["../../../../src/components/TourZone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"TourZone.d.ts","sourceRoot":"","sources":["../../../../src/components/TourZone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAYzD,OAAO,KAAK,EAEV,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,UAAU,CAAC;AAMlB,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,KAAK,CAAC,SAAS,CAAC;CAC1D;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA0Z5C,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WithSpringConfig } from 'react-native-reanimated';
|
|
2
|
+
import type { ZoneStyle } from '../types';
|
|
2
3
|
export declare const DEFAULT_SPRING_CONFIG: WithSpringConfig;
|
|
3
4
|
export declare const DEFAULT_BACKDROP_OPACITY = 0.5;
|
|
4
5
|
export declare const DEFAULT_LABELS: {
|
|
@@ -7,4 +8,13 @@ export declare const DEFAULT_LABELS: {
|
|
|
7
8
|
finish: string;
|
|
8
9
|
skip: string;
|
|
9
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Default zone style configuration.
|
|
13
|
+
* These values are used when no custom style is provided.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_ZONE_STYLE: Required<ZoneStyle>;
|
|
16
|
+
/**
|
|
17
|
+
* Merges global and per-step zone styles with defaults.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveZoneStyle(globalStyle?: ZoneStyle, stepStyle?: ZoneStyle): Required<ZoneStyle>;
|
|
10
20
|
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../src/constants/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../../src/constants/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,eAAO,MAAM,qBAAqB,EAAE,gBAGnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,eAAO,MAAM,cAAc;;;;;CAK1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAiBlD,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,CAAC,EAAE,SAAS,EACvB,SAAS,CAAC,EAAE,SAAS,GACpB,QAAQ,CAAC,SAAS,CAAC,CAmBrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourContext.d.ts","sourceRoot":"","sources":["../../../../src/context/TourContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD,eAAO,MAAM,WAAW,yDAAsD,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface TourScrollViewOptions {
|
|
2
|
+
/**
|
|
3
|
+
* If true, scrolling will be disabled while the tour is active.
|
|
4
|
+
* @default false
|
|
5
|
+
*/
|
|
6
|
+
disableScrollDuringTour?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface TourScrollViewResult {
|
|
9
|
+
/**
|
|
10
|
+
* Animated ref to attach to your ScrollView/Animated.ScrollView.
|
|
11
|
+
* This is the same ref as `scrollViewRef` from useTour().
|
|
12
|
+
*/
|
|
13
|
+
scrollViewRef: React.RefObject<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the tour is currently active (a step is being shown).
|
|
16
|
+
*/
|
|
17
|
+
isTourActive: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether scrolling should be enabled based on tour state.
|
|
20
|
+
* Only relevant if disableScrollDuringTour option is true.
|
|
21
|
+
*/
|
|
22
|
+
scrollEnabled: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Helper function to scroll to a specific position.
|
|
25
|
+
* Wraps the scrollTo method with error handling.
|
|
26
|
+
*/
|
|
27
|
+
scrollTo: (options: {
|
|
28
|
+
x?: number;
|
|
29
|
+
y?: number;
|
|
30
|
+
animated?: boolean;
|
|
31
|
+
}) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Props to spread onto your ScrollView for full tour integration.
|
|
34
|
+
* Includes ref and scrollEnabled (if disableScrollDuringTour is true).
|
|
35
|
+
*/
|
|
36
|
+
scrollViewProps: {
|
|
37
|
+
ref: React.RefObject<any>;
|
|
38
|
+
scrollEnabled?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Hook to simplify integrating custom scroll views with the tour system.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Basic usage with Animated.ScrollView
|
|
46
|
+
* const { scrollViewRef } = useTourScrollView();
|
|
47
|
+
* return <Animated.ScrollView ref={scrollViewRef}>...</Animated.ScrollView>;
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // With scroll disabled during tour
|
|
51
|
+
* const { scrollViewProps } = useTourScrollView({ disableScrollDuringTour: true });
|
|
52
|
+
* return <Animated.ScrollView {...scrollViewProps}>...</Animated.ScrollView>;
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Custom scroll view wrapper (forwardRef pattern)
|
|
56
|
+
* const MyScrollView = forwardRef((props, ref) => {
|
|
57
|
+
* const { scrollViewRef } = useTourScrollView();
|
|
58
|
+
* useImperativeHandle(ref, () => ({
|
|
59
|
+
* getScrollRef: () => scrollViewRef.current,
|
|
60
|
+
* }));
|
|
61
|
+
* return <Animated.ScrollView ref={scrollViewRef} {...props} />;
|
|
62
|
+
* });
|
|
63
|
+
*/
|
|
64
|
+
export declare function useTourScrollView(options?: TourScrollViewOptions): TourScrollViewResult;
|
|
65
|
+
//# sourceMappingURL=useTourScrollView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTourScrollView.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTourScrollView.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACpC;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5E;;;OAGG;IACH,eAAe,EAAE;QACf,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA4CtB"}
|
|
@@ -2,8 +2,12 @@ export * from './types';
|
|
|
2
2
|
export * from './components/TourProvider';
|
|
3
3
|
export * from './components/TourZone';
|
|
4
4
|
export * from './hooks/useTour';
|
|
5
|
+
export { useTourScrollView } from './hooks/useTourScrollView';
|
|
6
|
+
export type { TourScrollViewOptions, TourScrollViewResult, } from './hooks/useTourScrollView';
|
|
5
7
|
export { TourOverlay } from './components/TourOverlay';
|
|
6
8
|
export { TourTooltip } from './components/TourTooltip';
|
|
7
9
|
export * from './constants/defaults';
|
|
8
10
|
export * from './constants/animations';
|
|
11
|
+
export { detectStorage, clearStorageCache, type StorageType, } from './utils/storage';
|
|
12
|
+
export type { ZoneStyle, ZoneShape, TourStep, CardProps, TourConfig, TourLabels, TooltipStyles, TourPersistenceConfig, TourContextType, StorageAdapter, StepsOrder, } from './types';
|
|
9
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AAGvC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,SAAS,CAAC"}
|