@pgy-eu/react-native-tour-guide 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,63 @@
|
|
|
1
|
+
import type { TourStorage, TourStep, TourGuideConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook that adds "show only once" persistence to tours.
|
|
4
|
+
* Wraps `startTour` to check if a tour has been completed before,
|
|
5
|
+
* and automatically marks tours as completed when they finish.
|
|
6
|
+
*
|
|
7
|
+
* @param storage - Optional storage adapter. When omitted, MMKV or
|
|
8
|
+
* AsyncStorage is auto-detected (in that order); with neither installed, an
|
|
9
|
+
* in-memory fallback is used and a dev warning explains persistence won't
|
|
10
|
+
* survive restarts.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
15
|
+
* import { useTourPersistence } from '@wrack/react-native-tour-guide';
|
|
16
|
+
*
|
|
17
|
+
* const { startTour, resetTour, isTourCompleted } = useTourPersistence(AsyncStorage);
|
|
18
|
+
*
|
|
19
|
+
* // Only shows the tour if user hasn't seen it before
|
|
20
|
+
* startTour(steps, { tourId: 'onboarding' });
|
|
21
|
+
*
|
|
22
|
+
* // Force show again
|
|
23
|
+
* await resetTour('onboarding');
|
|
24
|
+
* startTour(steps, { tourId: 'onboarding' });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const useTourPersistence: (storage?: TourStorage) => {
|
|
28
|
+
startTour: (steps: TourStep[], config?: TourGuideConfig, force?: boolean) => Promise<boolean>;
|
|
29
|
+
isTourCompleted: (tourId: string) => Promise<boolean>;
|
|
30
|
+
resetTour: (tourId: string) => Promise<void>;
|
|
31
|
+
markCompleted: (tourId: string) => Promise<void>;
|
|
32
|
+
currentStep: number;
|
|
33
|
+
isActive: boolean;
|
|
34
|
+
isPaused: boolean;
|
|
35
|
+
activeTourId?: string;
|
|
36
|
+
steps: TourStep[];
|
|
37
|
+
activeSteps: TourStep[];
|
|
38
|
+
config?: import("./types").ResolvedTourGuideConfig;
|
|
39
|
+
defineTour: (tourId: string, steps: TourStep[], config?: TourGuideConfig) => void;
|
|
40
|
+
removeTour: (tourId: string) => void;
|
|
41
|
+
canStartTour: (tourOrSteps: string | TourStep[]) => boolean;
|
|
42
|
+
nextStep: () => void;
|
|
43
|
+
prevStep: () => void;
|
|
44
|
+
skipTour: () => void;
|
|
45
|
+
endTour: () => void;
|
|
46
|
+
goToStep: (index: number) => void;
|
|
47
|
+
pauseTour: () => void;
|
|
48
|
+
resumeTour: () => void;
|
|
49
|
+
setStepCompleted: (stepId: string, completed: boolean) => void;
|
|
50
|
+
registerTarget: (id: string, ref: import("./types").MeasurableRef, style?: import("react-native").StyleProp<import("react-native").ViewStyle>) => void;
|
|
51
|
+
unregisterTarget: (id: string, ref?: import("./types").MeasurableRef) => void;
|
|
52
|
+
getTarget: (id: string) => import("./types").RegisteredTarget | undefined;
|
|
53
|
+
setTargetLayout: (layout: import("./types").SpotlightTarget | null) => void;
|
|
54
|
+
targetLayout: import("./types").SpotlightTarget | null;
|
|
55
|
+
events: import("./events").TourEvents;
|
|
56
|
+
__reportScroll?: (y: number) => void;
|
|
57
|
+
__reportScrollEnd?: () => void;
|
|
58
|
+
__subscribeScroll?: (cb: (y: number) => void) => () => void;
|
|
59
|
+
__subscribeScrollEnd?: (cb: () => void) => () => void;
|
|
60
|
+
__getTrackedScrollY?: () => number | undefined;
|
|
61
|
+
__registerOverlay?: () => () => void;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=useTourPersistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTourPersistence.d.ts","sourceRoot":"","sources":["../../../../src/useTourPersistence.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAOtE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,WAAW;uBAoEtC,QAAQ,EAAE,WAAW,eAAe,sBAAkB,OAAO,CAAC,OAAO,CAAC;8BArDnC,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;wBAiC/B,MAAM;4BAdF,MAAM;;;;;;;;0DA+E8vhB,CAAC;;;;;;;;;;;4EAAy0C,CAAC;sCAA+S,CAAC;;;;;;;;;;;CADj7kB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
|
|
2
|
+
export interface TourScrollBinding {
|
|
3
|
+
/**
|
|
4
|
+
* Spread onto the ScrollView/FlatList the tour scrolls (alongside your
|
|
5
|
+
* `ref={scrollRef}`):
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const { scrollProps } = useTourScroll();
|
|
9
|
+
* <ScrollView ref={scrollRef} {...scrollProps}>…</ScrollView>
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
scrollProps: {
|
|
13
|
+
onScroll: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
14
|
+
onMomentumScrollEnd: () => void;
|
|
15
|
+
scrollEventThrottle: number;
|
|
16
|
+
};
|
|
17
|
+
/** The individual handlers, for composing with your own. */
|
|
18
|
+
onScroll: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
19
|
+
onMomentumScrollEnd: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Binds a scrollable to the tour. Wiring this up gives the tour three things:
|
|
23
|
+
*
|
|
24
|
+
* 1. **`followTarget`** — with `config.followTarget: true`, the spotlight and
|
|
25
|
+
* tooltip stay glued to the target while the user scrolls freely.
|
|
26
|
+
* 2. **Exact auto-scroll settling** — `onMomentumScrollEnd` tells the tour the
|
|
27
|
+
* programmatic scroll finished, so the highlight lands immediately instead
|
|
28
|
+
* of waiting for position polling to detect the stop.
|
|
29
|
+
* 3. **A tracked scroll offset** — `getCurrentScrollOffset` becomes redundant;
|
|
30
|
+
* the tour reads the offset it saw last.
|
|
31
|
+
*
|
|
32
|
+
* Already have your own onScroll? Compose: call both handlers, or spread
|
|
33
|
+
* `scrollProps` and call your handler from a wrapper.
|
|
34
|
+
*/
|
|
35
|
+
export declare const useTourScroll: () => TourScrollBinding;
|
|
36
|
+
//# sourceMappingURL=useTourScroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTourScroll.d.ts","sourceRoot":"","sources":["../../../../src/useTourScroll.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAI5E,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,WAAW,EAAE;QACX,QAAQ,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;QAC/D,mBAAmB,EAAE,MAAM,IAAI,CAAC;QAChC,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,4DAA4D;IAC5D,QAAQ,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC/D,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,QAAO,iBAoBhC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { EdgeInsets, MeasurableRef, PerPlatform, ResolvedTourGuideConfig, SpotlightTarget, TourGuideConfig } from './types';
|
|
2
|
+
import type { SpotlightBorderRadius } from './shapes';
|
|
3
|
+
/**
|
|
4
|
+
* Compute the best tooltip position based on available screen space.
|
|
5
|
+
* Prefers: bottom > top > right > left.
|
|
6
|
+
* `insets` shrink the usable area so the tour avoids system chrome.
|
|
7
|
+
*/
|
|
8
|
+
interface TooltipPositionOptions {
|
|
9
|
+
target: SpotlightTarget;
|
|
10
|
+
screenWidth: number;
|
|
11
|
+
screenHeight: number;
|
|
12
|
+
tooltipWidth: number;
|
|
13
|
+
tooltipHeight?: number;
|
|
14
|
+
offset?: number;
|
|
15
|
+
insets?: EdgeInsets;
|
|
16
|
+
}
|
|
17
|
+
export declare const computeTooltipPosition: ({ target, screenWidth, screenHeight, tooltipWidth, tooltipHeight, offset, insets, }: TooltipPositionOptions) => "top" | "bottom" | "left" | "right";
|
|
18
|
+
/**
|
|
19
|
+
* Resolve just the safe-area insets (auto-detected, or overridden via
|
|
20
|
+
* `config.insets`) — WITHOUT any `extraInsets`. This is the value that mirrors
|
|
21
|
+
* system chrome like the status bar, and is what corrects `measureInWindow`
|
|
22
|
+
* coordinates on Android (see TourGuideOverlay).
|
|
23
|
+
*/
|
|
24
|
+
export declare const resolveSafeAreaInsets: (config?: {
|
|
25
|
+
insets?: Partial<EdgeInsets>;
|
|
26
|
+
}) => EdgeInsets;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the effective insets the tour should respect for layout/clamping:
|
|
29
|
+
* the safe area plus any `config.extraInsets` for app chrome like tab bars and
|
|
30
|
+
* headers.
|
|
31
|
+
*/
|
|
32
|
+
export declare const resolveInsets: (config?: {
|
|
33
|
+
insets?: Partial<EdgeInsets>;
|
|
34
|
+
extraInsets?: Partial<EdgeInsets>;
|
|
35
|
+
}) => EdgeInsets;
|
|
36
|
+
/**
|
|
37
|
+
* Validate that a ref is valid and points to a mounted component.
|
|
38
|
+
* Returns true if valid, false otherwise.
|
|
39
|
+
*/
|
|
40
|
+
export declare const validateRef: (ref: MeasurableRef | undefined, stepId: string) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Extract border radius values from a View style.
|
|
43
|
+
* Returns a SpotlightBorderRadius (number if uniform, object if per-corner),
|
|
44
|
+
* or undefined if no border radius is specified.
|
|
45
|
+
*
|
|
46
|
+
* Percentage radii (e.g. `'50%'`, supported by React Native 0.76+) are resolved
|
|
47
|
+
* against the target's shorter side when `target` dimensions are provided — this
|
|
48
|
+
* is what keeps a circular avatar (`borderRadius: '50%'`) round instead of square.
|
|
49
|
+
* Without `target`, percentages fall back to the numeric base/0.
|
|
50
|
+
*/
|
|
51
|
+
export declare const extractBorderRadius: (style: any, target?: {
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
}) => SpotlightBorderRadius | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Scroll a scrollable ref to an absolute Y offset.
|
|
57
|
+
*
|
|
58
|
+
* Consumers pass all kinds of scrollables, and each exposes a different imperative
|
|
59
|
+
* API — assuming `scrollTo` crashes with `scrollTo is not a function` on the most
|
|
60
|
+
* common one (`FlatList`). This normalises across:
|
|
61
|
+
*
|
|
62
|
+
* - `ScrollView` (and gesture-handler / Animated wrappers) → `scrollTo`
|
|
63
|
+
* - `FlatList` / `VirtualizedList` → `scrollToOffset`
|
|
64
|
+
* - `SectionList` and other list wrappers → `getScrollResponder()` / `getScrollRef()`
|
|
65
|
+
* - legacy `Animated.ScrollView` → `getNode()`
|
|
66
|
+
* - `KeyboardAwareScrollView` → `scrollToPosition`
|
|
67
|
+
*
|
|
68
|
+
* @returns true if a scroll was actually issued, false if the ref exposes no
|
|
69
|
+
* usable scroll method (the caller should then continue without scrolling
|
|
70
|
+
* rather than leaving the tour stuck).
|
|
71
|
+
*/
|
|
72
|
+
export declare const scrollRefToY: (scrollRef: {
|
|
73
|
+
current: any;
|
|
74
|
+
} | null | undefined, y: number, animated: boolean) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether a background color is light (true), dark (false), or unparseable
|
|
77
|
+
* (null). Supports #rgb/#rgba/#rrggbb/#rrggbbaa, rgb()/rgba(), and a handful of
|
|
78
|
+
* common named colors — enough for the tooltip-background use case; anything
|
|
79
|
+
* exotic returns null and callers keep their existing defaults.
|
|
80
|
+
*
|
|
81
|
+
* Used to pick readable default text colors when a consumer sets a custom
|
|
82
|
+
* tooltip background: a pale background used to get the built-in white title
|
|
83
|
+
* text, which is invisible.
|
|
84
|
+
*/
|
|
85
|
+
export declare const isLightColor: (color: string) => boolean | null;
|
|
86
|
+
/**
|
|
87
|
+
* Resolve a possibly per-platform value for the running OS.
|
|
88
|
+
* `{ ios: 12, default: 8 }` → 12 on iOS, 8 elsewhere.
|
|
89
|
+
*/
|
|
90
|
+
export declare const osValue: <T>(value: PerPlatform<T> | undefined) => T | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve every PerPlatform field of a tour config for the running OS.
|
|
93
|
+
* Called once in startTour, so everything downstream reads plain values.
|
|
94
|
+
*/
|
|
95
|
+
export declare const resolvePlatformConfig: (config: TourGuideConfig | undefined) => ResolvedTourGuideConfig | undefined;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EAEb,WAAW,EACX,uBAAuB,EACvB,eAAe,EACf,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAItD;;;;GAIG;AACH,UAAU,sBAAsB;IAC9B,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,eAAO,MAAM,sBAAsB,GAAI,qFAQpC,sBAAsB,KAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAYvD,CAAC;AAiCF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;CAAE,KAAG,UAQjF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;CACnC,KAAG,UASH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,aAAa,GAAG,SAAS,EAAE,QAAQ,MAAM,KAAG,OAkB5E,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAE9B,OAAO,GAAG,EACV,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,KACzC,qBAAqB,GAAG,SAsD1B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,GAEvB,WAAW;IAAE,OAAO,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,EAC9C,GAAG,MAAM,EACT,UAAU,OAAO,KAChB,OAwCF,CAAC;AAkBF;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OAAO,GAAG,IAkCtD,CAAC;AAYF;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,OAAO,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,KAAG,CAAC,GAAG,SAIlE,CAAC;AAmBF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,eAAe,GAAG,SAAS,KAClC,uBAAuB,GAAG,SAiB5B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ResolvedTourGuideConfig, TourStep } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Validate tour steps and config in development and report actionable warnings.
|
|
4
|
+
*
|
|
5
|
+
* Every check here corresponds to a mistake that otherwise fails *silently* at
|
|
6
|
+
* runtime — the tour simply does nothing, or shows a centered tooltip with no
|
|
7
|
+
* explanation — which is the hardest class of bug to diagnose from the outside.
|
|
8
|
+
* Runs only in dev; it is a no-op in production builds.
|
|
9
|
+
*/
|
|
10
|
+
export declare const validateTour: (steps: TourStep[], config?: ResolvedTourGuideConfig) => void;
|
|
11
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAcjE;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,QAAQ,EAAE,EAAE,SAAS,uBAAuB,KAAG,IAwKlF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SpotlightMotion, SpotlightStyles, SpotlightTarget } from './types';
|
|
3
|
+
import type { SpotlightBorderRadius, SpotlightPadding } from './shapes';
|
|
4
|
+
export interface SpotlightOverlayProps {
|
|
5
|
+
target: SpotlightTarget | null;
|
|
6
|
+
/** Uniform number or per-side padding around the spotlight */
|
|
7
|
+
padding?: SpotlightPadding;
|
|
8
|
+
borderRadius?: SpotlightBorderRadius;
|
|
9
|
+
styles?: SpotlightStyles;
|
|
10
|
+
screenWidth: number;
|
|
11
|
+
screenHeight: number;
|
|
12
|
+
animationDuration?: number;
|
|
13
|
+
onBackdropPress?: () => void;
|
|
14
|
+
onSpotlightPress?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Leave the spotlight hole touch-transparent so the real element underneath
|
|
17
|
+
* receives taps. Only meaningful when the overlay is NOT inside a Modal
|
|
18
|
+
* (inline overlay mode) — a Modal swallows touches regardless.
|
|
19
|
+
*/
|
|
20
|
+
interactive?: boolean;
|
|
21
|
+
/** How the spotlight travels between steps (default: 'morph') */
|
|
22
|
+
motion?: SpotlightMotion;
|
|
23
|
+
/**
|
|
24
|
+
* Keep the (expensive) blur subtree mounted even while the current step has
|
|
25
|
+
* blur disabled, cross-fading its opacity instead of mounting/unmounting at
|
|
26
|
+
* step boundaries — that mount is what caused a visible hitch when moving
|
|
27
|
+
* between blurred and unblurred steps. Set by TourGuideOverlay when any step
|
|
28
|
+
* in the tour enables blur.
|
|
29
|
+
*/
|
|
30
|
+
mountBlurLayer?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Additional cutout subpaths that stay punched out of the backdrop —
|
|
33
|
+
* spotlights kept lit from earlier steps (`step.keepSpotlight`). Purely
|
|
34
|
+
* visual: press bands and the blur mask only consider the current spotlight.
|
|
35
|
+
*/
|
|
36
|
+
keptPaths?: string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Component that creates a spotlight effect with a dark overlay.
|
|
40
|
+
* Supports smooth animated transitions between targets.
|
|
41
|
+
* The spotlight automatically matches the target's shape via border radius.
|
|
42
|
+
* Optionally supports blur and gradient effects if dependencies are installed.
|
|
43
|
+
*/
|
|
44
|
+
declare const SpotlightOverlay: React.FC<SpotlightOverlayProps>;
|
|
45
|
+
export default SpotlightOverlay;
|
|
46
|
+
//# sourceMappingURL=SpotlightOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpotlightOverlay.d.ts","sourceRoot":"","sources":["../../../../src/SpotlightOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AA8DxE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iEAAiE;IACjE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsnBrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TooltipProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Tooltip component that displays tour information.
|
|
5
|
+
* Supports automatic positioning and customizable styling.
|
|
6
|
+
*/
|
|
7
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
8
|
+
export default Tooltip;
|
|
9
|
+
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,OAAO,KAAK,EAA2B,YAAY,EAAE,MAAM,SAAS,CAAC;AAiBrE;;;GAGG;AACH,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAofnC,CAAC;AAgHF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { TourGuideContextValue } from './types';
|
|
3
|
+
export interface TourGuideProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Provider component that wraps your app to enable tour guide functionality.
|
|
8
|
+
* Place this at the root of your app, typically in App.tsx.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { TourGuideProvider, TourGuideOverlay } from '@wrack/react-native-tour-guide';
|
|
13
|
+
*
|
|
14
|
+
* export default function App() {
|
|
15
|
+
* return (
|
|
16
|
+
* <TourGuideProvider>
|
|
17
|
+
* <YourApp />
|
|
18
|
+
* <TourGuideOverlay />
|
|
19
|
+
* </TourGuideProvider>
|
|
20
|
+
* );
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const TourGuideProvider: React.FC<TourGuideProviderProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Hook to access tour guide functionality.
|
|
27
|
+
* Must be used within a TourGuideProvider.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const { startTour, isActive } = useTourGuide();
|
|
32
|
+
*
|
|
33
|
+
* const handleStartTour = () => {
|
|
34
|
+
* startTour([
|
|
35
|
+
* {
|
|
36
|
+
* id: 'step1',
|
|
37
|
+
* targetRef: myButtonRef,
|
|
38
|
+
* title: 'Welcome!',
|
|
39
|
+
* description: 'This is your first step.',
|
|
40
|
+
* },
|
|
41
|
+
* ]);
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const useTourGuide: () => TourGuideContextValue;
|
|
46
|
+
//# sourceMappingURL=TourGuideContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourGuideContext.d.ts","sourceRoot":"","sources":["../../../../src/TourGuideContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAQZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAMV,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAajB,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAgjB9D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,QAAO,qBAM/B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Main overlay component that displays the tour guide.
|
|
4
|
+
* This should be placed at the root level of your app, after your main content.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { TourGuideProvider, TourGuideOverlay } from '@wrack/react-native-tour-guide';
|
|
9
|
+
*
|
|
10
|
+
* export default function App() {
|
|
11
|
+
* return (
|
|
12
|
+
* <TourGuideProvider>
|
|
13
|
+
* <YourApp />
|
|
14
|
+
* <TourGuideOverlay />
|
|
15
|
+
* </TourGuideProvider>
|
|
16
|
+
* );
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const TourGuideOverlay: React.FC;
|
|
21
|
+
export default TourGuideOverlay;
|
|
22
|
+
//# sourceMappingURL=TourGuideOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourGuideOverlay.d.ts","sourceRoot":"","sources":["../../../../src/TourGuideOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAqHjF;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAstC7B,CAAC;AAQF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface TourTargetProps {
|
|
4
|
+
/** Unique id steps reference via `targetId` */
|
|
5
|
+
id: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Style for the wrapper View. Border radius set here is auto-extracted for
|
|
9
|
+
* spotlight shape matching, exactly like a step's `targetStyle`.
|
|
10
|
+
*/
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Declaratively mark a component as a tour target — the alternative to
|
|
15
|
+
* threading refs into your steps array.
|
|
16
|
+
*
|
|
17
|
+
* Wraps its children in a View (with `collapsable={false}`, so Android's view
|
|
18
|
+
* flattening can never make the target unmeasurable) and registers it with the
|
|
19
|
+
* provider. Steps then reference it by id:
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <TourTarget id="compose" style={{ borderRadius: 24 }}>
|
|
24
|
+
* <ComposeButton />
|
|
25
|
+
* </TourTarget>
|
|
26
|
+
*
|
|
27
|
+
* startTour([{ id: 'step1', targetId: 'compose', title: '…', description: '…' }]);
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* The wrapper carries no styles of its own, so layout is unchanged unless you
|
|
31
|
+
* pass `style`. If the target mounts after the tour starts (a later screen),
|
|
32
|
+
* the tour waits briefly for it to register before falling back to a centered
|
|
33
|
+
* tooltip.
|
|
34
|
+
*/
|
|
35
|
+
export declare const TourTarget: React.FC<TourTargetProps>;
|
|
36
|
+
//# sourceMappingURL=TourTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourTarget.d.ts","sourceRoot":"","sources":["../../../../src/TourTarget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzD,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAkChD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TourStep, TourGuideConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Announce a step change to screen readers (VoiceOver / TalkBack).
|
|
4
|
+
*/
|
|
5
|
+
export declare const announceStep: (step: TourStep, stepIndex: number, totalSteps: number, config?: TourGuideConfig) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Build the accessibility label for the tooltip container.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getTooltipAccessibilityProps: (step: TourStep, stepIndex: number, totalSteps: number, config?: TourGuideConfig) => {
|
|
10
|
+
accessible?: undefined;
|
|
11
|
+
accessibilityRole?: undefined;
|
|
12
|
+
accessibilityLabel?: undefined;
|
|
13
|
+
accessibilityHint?: undefined;
|
|
14
|
+
accessibilityLiveRegion?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
accessible: boolean;
|
|
17
|
+
accessibilityRole: "alert";
|
|
18
|
+
accessibilityLabel: string;
|
|
19
|
+
accessibilityHint: string;
|
|
20
|
+
accessibilityLiveRegion: "polite";
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=accessibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessibility.d.ts","sourceRoot":"","sources":["../../../../src/accessibility.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,QAAQ,EACd,WAAW,MAAM,EACjB,YAAY,MAAM,EAClB,SAAS,eAAe,SAmBzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACvC,MAAM,QAAQ,EACd,WAAW,MAAM,EACjB,YAAY,MAAM,EAClB,SAAS,eAAe;;;;;;;;;;;;CAoBzB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-only diagnostics.
|
|
3
|
+
*
|
|
4
|
+
* Every warning the library emits goes through here so that:
|
|
5
|
+
* - it is stripped in production builds (`__DEV__` is false), keeping consumer
|
|
6
|
+
* release logs and crash-reporting breadcrumbs clean;
|
|
7
|
+
* - it is de-duplicated, so a warning inside a render/measure loop is printed
|
|
8
|
+
* once instead of on every frame;
|
|
9
|
+
* - it always carries the package name and an actionable "how to fix" line.
|
|
10
|
+
*/
|
|
11
|
+
/** True in development. Falls back to NODE_ENV outside React Native (e.g. tests, web SSR). */
|
|
12
|
+
export declare const isDev: () => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Print a dev-only warning at most once per unique message.
|
|
15
|
+
* `fix` is appended as a concrete next step for whoever reads the log.
|
|
16
|
+
*/
|
|
17
|
+
export declare const warnOnce: (message: string, fix?: string) => void;
|
|
18
|
+
/** Print a dev-only warning every time (for genuinely per-occurrence problems). */
|
|
19
|
+
export declare const warn: (message: string, fix?: string) => void;
|
|
20
|
+
/** Test-only: clear the de-duplication cache so each test starts clean. */
|
|
21
|
+
export declare const __resetWarnings: () => void;
|
|
22
|
+
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,8FAA8F;AAC9F,eAAO,MAAM,KAAK,QAAO,OACyD,CAAC;AAInF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,SAMrD,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,IAAI,GAAI,SAAS,MAAM,EAAE,MAAM,MAAM,SAGjD,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,eAAe,YAAqB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { TourStep } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Events emitted over the tour's lifecycle, with their payloads.
|
|
4
|
+
* Subscribe via `useTourGuide().events.on(...)` — the subscription-based
|
|
5
|
+
* alternative to config callbacks, built for analytics: attach once at app
|
|
6
|
+
* root instead of threading onTourStart/onStepChange through every config.
|
|
7
|
+
*/
|
|
8
|
+
export interface TourEventMap {
|
|
9
|
+
/** A tour started */
|
|
10
|
+
start: {
|
|
11
|
+
tourId?: string;
|
|
12
|
+
totalSteps: number;
|
|
13
|
+
};
|
|
14
|
+
/** The step changed (next, back, or a goToStep jump). `to` is the new index. */
|
|
15
|
+
stepChange: {
|
|
16
|
+
from: number;
|
|
17
|
+
to: number;
|
|
18
|
+
step?: TourStep;
|
|
19
|
+
};
|
|
20
|
+
/** The tour ended — completed=true when the user finished the last step */
|
|
21
|
+
end: {
|
|
22
|
+
completed: boolean;
|
|
23
|
+
tourId?: string;
|
|
24
|
+
};
|
|
25
|
+
/** The user skipped the tour (an `end` with completed=false follows) */
|
|
26
|
+
skip: {
|
|
27
|
+
at: number;
|
|
28
|
+
};
|
|
29
|
+
/** The tour was paused */
|
|
30
|
+
pause: {
|
|
31
|
+
at: number;
|
|
32
|
+
};
|
|
33
|
+
/** The tour was resumed */
|
|
34
|
+
resume: {
|
|
35
|
+
at: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export type TourEventName = keyof TourEventMap;
|
|
39
|
+
export type TourEventHandler<K extends TourEventName> = (payload: TourEventMap[K]) => void;
|
|
40
|
+
/** The public subscription surface exposed on the context as `events`. */
|
|
41
|
+
export interface TourEvents {
|
|
42
|
+
/** Subscribe. Returns an unsubscribe function. */
|
|
43
|
+
on<K extends TourEventName>(event: K, handler: TourEventHandler<K>): () => void;
|
|
44
|
+
/** Remove a previously added handler. */
|
|
45
|
+
off<K extends TourEventName>(event: K, handler: TourEventHandler<K>): void;
|
|
46
|
+
}
|
|
47
|
+
/** @internal The provider-side emitter (public surface + emit). */
|
|
48
|
+
export interface TourEventsInternal extends TourEvents {
|
|
49
|
+
emit<K extends TourEventName>(event: K, payload: TourEventMap[K]): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A tiny dependency-free emitter. A throwing handler is isolated — analytics
|
|
53
|
+
* code must never be able to take the tour down.
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export declare const createTourEvents: () => TourEventsInternal;
|
|
57
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,KAAK,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,gFAAgF;IAChF,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,QAAQ,CAAA;KAAE,CAAC;IAC1D,2EAA2E;IAC3E,GAAG,EAAE;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,wEAAwE;IACxE,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACrB,0BAA0B;IAC1B,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACtB,2BAA2B;IAC3B,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACxB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC;AAC/C,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,aAAa,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAE3F,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,kDAAkD;IAClD,EAAE,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC;IAChF,yCAAyC;IACzC,GAAG,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC5E;AAED,mEAAmE;AACnE,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,IAAI,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CACzE;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAO,kBA+BnC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { TourGuideProvider, useTourGuide } from './TourGuideContext';
|
|
2
|
+
export { TourTarget } from './TourTarget';
|
|
3
|
+
export { default as TourGuideOverlay } from './TourGuideOverlay';
|
|
4
|
+
export { default as SpotlightOverlay } from './SpotlightOverlay';
|
|
5
|
+
export { default as Tooltip } from './Tooltip';
|
|
6
|
+
export { useTourPersistence } from './useTourPersistence';
|
|
7
|
+
export { useTourScroll } from './useTourScroll';
|
|
8
|
+
export type { TourScrollBinding } from './useTourScroll';
|
|
9
|
+
export { detectStorage } from './storage';
|
|
10
|
+
export type { StorageType } from './storage';
|
|
11
|
+
export type { TourEvents, TourEventMap, TourEventName, TourEventHandler } from './events';
|
|
12
|
+
export { darkTheme, lightTheme, minimalTheme, vibrantTheme, createTheme } from './themes';
|
|
13
|
+
export { computeShape, roundedRectPath, shapeInnerPath } from './shapes';
|
|
14
|
+
export { computeTooltipPosition, validateRef, extractBorderRadius, resolveInsets, resolveSafeAreaInsets, osValue, } from './utils';
|
|
15
|
+
export { announceStep, getTooltipAccessibilityProps } from './accessibility';
|
|
16
|
+
export type { TourStep, RegisteredTarget, TooltipComponents, TourButtonProps, TourProgressProps, TourGuideConfig, TourGuideContextValue, SpotlightTarget, SpotlightStyles, TooltipStyles, TooltipProps, ScrollToTargetConfig, BackdropBehavior, TourStorage, TourTheme, MeasurableRef, ScrollableRef, EdgeInsets, SpotlightMotion, SpotlightMaskPathFn, OSConfig, PerPlatform, ResolvedTourGuideConfig, } from './types';
|
|
17
|
+
export type { SpotlightBorderRadius, SpotlightPadding, ShapeBounds, ShapeResult } from './shapes';
|
|
18
|
+
export type { TourGuideProviderProps } from './TourGuideContext';
|
|
19
|
+
export type { TourTargetProps } from './TourTarget';
|
|
20
|
+
export type { SpotlightOverlayProps } from './SpotlightOverlay';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG1F,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG1F,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,qBAAqB,EACrB,OAAO,GACR,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAG7E,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,uBAAuB,GACxB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAElG,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { EdgeInsets, SpotlightTarget } from './types';
|
|
2
|
+
/** Padding around the spotlight: uniform number or per-side values. */
|
|
3
|
+
export type SpotlightPadding = number | Partial<EdgeInsets>;
|
|
4
|
+
/** Resolve a SpotlightPadding to explicit per-side values. */
|
|
5
|
+
export declare const resolvePadding: (padding: SpotlightPadding | undefined) => EdgeInsets;
|
|
6
|
+
/**
|
|
7
|
+
* Internal type for border radius — number for uniform, object for per-corner.
|
|
8
|
+
* Users specify this via `targetStyle` (auto-extracted) or `spotlightBorderRadius` (number override).
|
|
9
|
+
*/
|
|
10
|
+
export type SpotlightBorderRadius = number | {
|
|
11
|
+
topLeft?: number;
|
|
12
|
+
topRight?: number;
|
|
13
|
+
bottomRight?: number;
|
|
14
|
+
bottomLeft?: number;
|
|
15
|
+
};
|
|
16
|
+
export interface ShapeBounds {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}
|
|
22
|
+
export interface RectShapeResult {
|
|
23
|
+
kind: 'rect';
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
rx: number;
|
|
29
|
+
ry: number;
|
|
30
|
+
}
|
|
31
|
+
export interface PathShapeResult {
|
|
32
|
+
kind: 'path';
|
|
33
|
+
d: string;
|
|
34
|
+
bounds: ShapeBounds;
|
|
35
|
+
}
|
|
36
|
+
export type ShapeResult = RectShapeResult | PathShapeResult;
|
|
37
|
+
/**
|
|
38
|
+
* SVG subpath for a uniformly-rounded rectangle (clockwise, closed). Used for
|
|
39
|
+
* the spotlight cutout and for kept spotlights.
|
|
40
|
+
*/
|
|
41
|
+
export declare const roundedRectPath: (x: number, y: number, w: number, h: number, r: number) => string;
|
|
42
|
+
/** The inner (hole) subpath for any shape result. */
|
|
43
|
+
export declare const shapeInnerPath: (result: ShapeResult) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Compute the spotlight shape for a target.
|
|
46
|
+
* Always produces a rounded rectangle matching the target's border radius.
|
|
47
|
+
* Border radii are scaled proportionally so circles stay circular with padding.
|
|
48
|
+
*/
|
|
49
|
+
export declare const computeShape: (target: SpotlightTarget, padding?: SpotlightPadding, customBorderRadius?: SpotlightBorderRadius) => ShapeResult;
|
|
50
|
+
//# sourceMappingURL=shapes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapes.d.ts","sourceRoot":"","sources":["../../../../src/shapes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE3D,uEAAuE;AACvE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE5D,8DAA8D;AAC9D,eAAO,MAAM,cAAc,GAAI,SAAS,gBAAgB,GAAG,SAAS,KAAG,UAUtE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN;IACE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAIN,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,eAAe,CAAC;AAW5D;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MASvF,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,cAAc,GAAI,QAAQ,WAAW,KAAG,MAG4B,CAAC;AA0DlF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GACvB,QAAQ,eAAe,EACvB,UAAS,gBAAoB,EAC7B,qBAAqB,qBAAqB,KACzC,WA8BF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TourStorage } from './types';
|
|
2
|
+
/** How persistence storage was resolved. */
|
|
3
|
+
export type StorageType = 'mmkv' | 'async-storage' | 'memory' | 'custom';
|
|
4
|
+
/**
|
|
5
|
+
* Detect an available storage backend for tour persistence.
|
|
6
|
+
* Priority: MMKV (fastest) → AsyncStorage → in-memory fallback.
|
|
7
|
+
* The result is cached; the adapters are only probed once.
|
|
8
|
+
*/
|
|
9
|
+
export declare const detectStorage: () => {
|
|
10
|
+
type: StorageType;
|
|
11
|
+
adapter: TourStorage;
|
|
12
|
+
};
|
|
13
|
+
/** Test-only: clear the detection cache. */
|
|
14
|
+
export declare const __resetStorageCache: () => void;
|
|
15
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA8EzE;;;;GAIG;AACH,eAAO,MAAM,aAAa,QAAO;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAqBzE,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,mBAAmB,YAE/B,CAAC"}
|