@korsolutions/guidon 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/babel.config.js +15 -0
- package/dist/commonjs/babel.config.js.map +1 -0
- package/dist/commonjs/bob.config.js +11 -0
- package/dist/commonjs/bob.config.js.map +1 -0
- package/dist/commonjs/components/GuidonOverlay.js +206 -0
- package/dist/commonjs/components/GuidonOverlay.js.map +1 -0
- package/dist/commonjs/components/GuidonProvider.js +157 -0
- package/dist/commonjs/components/GuidonProvider.js.map +1 -0
- package/dist/commonjs/components/GuidonTarget.js +110 -0
- package/dist/commonjs/components/GuidonTarget.js.map +1 -0
- package/dist/commonjs/components/GuidonTooltip.js +422 -0
- package/dist/commonjs/components/GuidonTooltip.js.map +1 -0
- package/dist/commonjs/components/index.js +40 -0
- package/dist/commonjs/components/index.js.map +1 -0
- package/dist/commonjs/hooks/index.js +13 -0
- package/dist/commonjs/hooks/index.js.map +1 -0
- package/dist/commonjs/hooks/useGuidonRef.js +132 -0
- package/dist/commonjs/hooks/useGuidonRef.js.map +1 -0
- package/dist/commonjs/index.js +143 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/package.json +1 -0
- package/dist/commonjs/persistence/adapters.js +213 -0
- package/dist/commonjs/persistence/adapters.js.map +1 -0
- package/dist/commonjs/persistence/hooks.js +153 -0
- package/dist/commonjs/persistence/hooks.js.map +1 -0
- package/dist/commonjs/persistence/index.js +28 -0
- package/dist/commonjs/persistence/index.js.map +1 -0
- package/dist/commonjs/store.js +314 -0
- package/dist/commonjs/store.js.map +1 -0
- package/dist/commonjs/tsconfig.json +32 -0
- package/dist/commonjs/types.js +6 -0
- package/dist/commonjs/types.js.map +1 -0
- package/dist/module/babel.config.js +15 -0
- package/dist/module/babel.config.js.map +1 -0
- package/dist/module/bob.config.js +11 -0
- package/dist/module/bob.config.js.map +1 -0
- package/dist/module/components/GuidonOverlay.js +201 -0
- package/dist/module/components/GuidonOverlay.js.map +1 -0
- package/dist/module/components/GuidonProvider.js +152 -0
- package/dist/module/components/GuidonProvider.js.map +1 -0
- package/dist/module/components/GuidonTarget.js +106 -0
- package/dist/module/components/GuidonTarget.js.map +1 -0
- package/dist/module/components/GuidonTooltip.js +417 -0
- package/dist/module/components/GuidonTooltip.js.map +1 -0
- package/dist/module/components/index.js +7 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/hooks/index.js +4 -0
- package/dist/module/hooks/index.js.map +1 -0
- package/dist/module/hooks/useGuidonRef.js +129 -0
- package/dist/module/hooks/useGuidonRef.js.map +1 -0
- package/dist/module/index.js +17 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/persistence/adapters.js +203 -0
- package/dist/module/persistence/adapters.js.map +1 -0
- package/dist/module/persistence/hooks.js +148 -0
- package/dist/module/persistence/hooks.js.map +1 -0
- package/dist/module/persistence/index.js +5 -0
- package/dist/module/persistence/index.js.map +1 -0
- package/dist/module/store.js +304 -0
- package/dist/module/store.js.map +1 -0
- package/dist/module/tsconfig.json +32 -0
- package/dist/module/types.js +4 -0
- package/dist/module/types.js.map +1 -0
- package/dist/typescript/commonjs/components/GuidonOverlay.d.ts +9 -0
- package/dist/typescript/commonjs/components/GuidonOverlay.d.ts.map +1 -0
- package/dist/typescript/commonjs/components/GuidonProvider.d.ts +14 -0
- package/dist/typescript/commonjs/components/GuidonProvider.d.ts.map +1 -0
- package/dist/typescript/commonjs/components/GuidonTarget.d.ts +7 -0
- package/dist/typescript/commonjs/components/GuidonTarget.d.ts.map +1 -0
- package/dist/typescript/commonjs/components/GuidonTooltip.d.ts +24 -0
- package/dist/typescript/commonjs/components/GuidonTooltip.d.ts.map +1 -0
- package/dist/typescript/commonjs/components/index.d.ts +5 -0
- package/dist/typescript/commonjs/components/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/hooks/index.d.ts +2 -0
- package/dist/typescript/commonjs/hooks/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/hooks/useGuidonRef.d.ts +35 -0
- package/dist/typescript/commonjs/hooks/useGuidonRef.d.ts.map +1 -0
- package/dist/typescript/commonjs/index.d.ts +7 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/package.json +1 -0
- package/dist/typescript/commonjs/persistence/adapters.d.ts +57 -0
- package/dist/typescript/commonjs/persistence/adapters.d.ts.map +1 -0
- package/dist/typescript/commonjs/persistence/hooks.d.ts +29 -0
- package/dist/typescript/commonjs/persistence/hooks.d.ts.map +1 -0
- package/dist/typescript/commonjs/persistence/index.d.ts +3 -0
- package/dist/typescript/commonjs/persistence/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/store.d.ts +89 -0
- package/dist/typescript/commonjs/store.d.ts.map +1 -0
- package/dist/{index-D_JFvCIg.d.mts → typescript/commonjs/types.d.ts} +40 -104
- package/dist/typescript/commonjs/types.d.ts.map +1 -0
- package/dist/typescript/module/components/GuidonOverlay.d.ts +9 -0
- package/dist/typescript/module/components/GuidonOverlay.d.ts.map +1 -0
- package/dist/typescript/module/components/GuidonProvider.d.ts +14 -0
- package/dist/typescript/module/components/GuidonProvider.d.ts.map +1 -0
- package/dist/typescript/module/components/GuidonTarget.d.ts +7 -0
- package/dist/typescript/module/components/GuidonTarget.d.ts.map +1 -0
- package/dist/typescript/module/components/GuidonTooltip.d.ts +24 -0
- package/dist/typescript/module/components/GuidonTooltip.d.ts.map +1 -0
- package/dist/typescript/module/components/index.d.ts +5 -0
- package/dist/typescript/module/components/index.d.ts.map +1 -0
- package/dist/typescript/module/hooks/index.d.ts +2 -0
- package/dist/typescript/module/hooks/index.d.ts.map +1 -0
- package/dist/typescript/module/hooks/useGuidonRef.d.ts +35 -0
- package/dist/typescript/module/hooks/useGuidonRef.d.ts.map +1 -0
- package/dist/typescript/module/index.d.ts +7 -0
- package/dist/typescript/module/index.d.ts.map +1 -0
- package/dist/typescript/module/package.json +1 -0
- package/dist/typescript/module/persistence/adapters.d.ts +57 -0
- package/dist/typescript/module/persistence/adapters.d.ts.map +1 -0
- package/dist/typescript/module/persistence/hooks.d.ts +29 -0
- package/dist/typescript/module/persistence/hooks.d.ts.map +1 -0
- package/dist/typescript/module/persistence/index.d.ts +3 -0
- package/dist/typescript/module/persistence/index.d.ts.map +1 -0
- package/dist/typescript/module/store.d.ts +89 -0
- package/dist/typescript/module/store.d.ts.map +1 -0
- package/dist/{index-D_JFvCIg.d.ts → typescript/module/types.d.ts} +40 -104
- package/dist/typescript/module/types.d.ts.map +1 -0
- package/package.json +25 -13
- package/src/babel.config.js +18 -0
- package/src/bob.config.js +14 -0
- package/src/components/GuidonOverlay.tsx +60 -4
- package/src/components/GuidonProvider.tsx +29 -1
- package/src/components/GuidonTarget.tsx +41 -25
- package/src/components/GuidonTooltip.tsx +143 -9
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useGuidonRef.ts +154 -0
- package/src/index.ts +6 -0
- package/src/store.ts +68 -15
- package/src/tsconfig.json +32 -0
- package/src/types.ts +32 -2
- package/dist/index.d.mts +0 -128
- package/dist/index.d.ts +0 -128
- package/dist/index.js +0 -1097
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1072
- package/dist/index.mjs.map +0 -1
- package/dist/persistence/index.d.mts +0 -2
- package/dist/persistence/index.d.ts +0 -2
- package/dist/persistence/index.js +0 -300
- package/dist/persistence/index.js.map +0 -1
- package/dist/persistence/index.mjs +0 -291
- package/dist/persistence/index.mjs.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { GuidonConfig, GuidonStore, TargetMeasurements } from "./types";
|
|
2
|
+
export declare const useGuidonStore: import("zustand").UseBoundStore<import("zustand").StoreApi<GuidonStore>>;
|
|
3
|
+
/**
|
|
4
|
+
* Guidon API for external control
|
|
5
|
+
* Can be used outside of React components
|
|
6
|
+
*/
|
|
7
|
+
export declare const Guidon: {
|
|
8
|
+
/**
|
|
9
|
+
* Configure the walkthrough with steps and options
|
|
10
|
+
*/
|
|
11
|
+
configure: (config: GuidonConfig) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Start the walkthrough
|
|
14
|
+
*/
|
|
15
|
+
start: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Go to the next step
|
|
18
|
+
*/
|
|
19
|
+
next: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Go to the previous step
|
|
22
|
+
*/
|
|
23
|
+
previous: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Go to a specific step by index
|
|
26
|
+
*/
|
|
27
|
+
goToStep: (index: number) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Skip the walkthrough
|
|
30
|
+
*/
|
|
31
|
+
skip: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Complete the walkthrough
|
|
34
|
+
*/
|
|
35
|
+
complete: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Reset the walkthrough to initial state
|
|
38
|
+
*/
|
|
39
|
+
reset: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Check if the walkthrough is currently active
|
|
42
|
+
*/
|
|
43
|
+
isActive: () => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Check if the walkthrough has been completed
|
|
46
|
+
*/
|
|
47
|
+
isCompleted: () => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get the current step index
|
|
50
|
+
*/
|
|
51
|
+
getCurrentStepIndex: () => number;
|
|
52
|
+
/**
|
|
53
|
+
* Get the current step
|
|
54
|
+
*/
|
|
55
|
+
getCurrentStep: () => import("./types").GuidonStep | null;
|
|
56
|
+
/**
|
|
57
|
+
* Get all steps
|
|
58
|
+
*/
|
|
59
|
+
getSteps: () => import("./types").GuidonStep[];
|
|
60
|
+
/**
|
|
61
|
+
* Subscribe to store changes
|
|
62
|
+
*/
|
|
63
|
+
subscribe: (listener: (state: GuidonStore, prevState: GuidonStore) => void) => () => void;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Hook selectors for common use cases
|
|
67
|
+
*/
|
|
68
|
+
export declare const useGuidonActive: () => boolean;
|
|
69
|
+
export declare const useGuidonStep: () => import("./types").GuidonStep | null;
|
|
70
|
+
export declare const useGuidonProgress: () => {
|
|
71
|
+
currentStep: number;
|
|
72
|
+
totalSteps: number;
|
|
73
|
+
percentage: number;
|
|
74
|
+
};
|
|
75
|
+
export declare const useTargetMeasurements: (targetId: string) => TargetMeasurements;
|
|
76
|
+
/**
|
|
77
|
+
* Hook to check if the guidon is waiting for a target element to mount
|
|
78
|
+
* Returns null if not active, not waiting, or if it's a floating step
|
|
79
|
+
*/
|
|
80
|
+
export declare const useWaitingState: () => {
|
|
81
|
+
isWaiting: boolean;
|
|
82
|
+
targetId: string | null;
|
|
83
|
+
message: string | null;
|
|
84
|
+
} | null;
|
|
85
|
+
/**
|
|
86
|
+
* Hook to check if the current step is a floating step (no target element)
|
|
87
|
+
*/
|
|
88
|
+
export declare const useIsFloatingStep: () => boolean;
|
|
89
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAcjB,eAAO,MAAM,cAAc,0EAuIxB,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,MAAM;IACjB;;OAEG;wBACiB,YAAY;IAIhC;;OAEG;;IAKH;;OAEG;;IAKH;;OAEG;;IAKH;;OAEG;sBACe,MAAM;IAIxB;;OAEG;;IAKH;;OAEG;;IAKH;;OAEG;;IAKH;;OAEG;;IAKH;;OAEG;;IAKH;;OAEG;;IAKH;;OAEG;;IAMH;;OAEG;;IAKH;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,eAC4B,CAAC;AAEzD,eAAO,MAAM,aAAa,2CAItB,CAAC;AAEL,eAAO,MAAM,iBAAiB;;;;CAS3B,CAAC;AAEJ,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,uBAGnD,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;QAmBzB,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAI1B,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
3
2
|
/**
|
|
4
3
|
* Position of tooltip relative to the highlighted element
|
|
5
4
|
*/
|
|
6
|
-
type TooltipPosition = 'top' | 'bottom' | 'left' | 'right' | 'auto';
|
|
5
|
+
export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right' | 'auto';
|
|
6
|
+
/**
|
|
7
|
+
* Position for floating tooltips (steps without a target element)
|
|
8
|
+
*/
|
|
9
|
+
export type FloatingPosition = 'center' | 'top' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
7
10
|
/**
|
|
8
11
|
* Defines the measurements of a target element
|
|
9
12
|
*/
|
|
10
|
-
interface TargetMeasurements {
|
|
13
|
+
export interface TargetMeasurements {
|
|
11
14
|
x: number;
|
|
12
15
|
y: number;
|
|
13
16
|
width: number;
|
|
@@ -16,28 +19,40 @@ interface TargetMeasurements {
|
|
|
16
19
|
/**
|
|
17
20
|
* A single step in the guidon
|
|
18
21
|
*/
|
|
19
|
-
interface GuidonStep {
|
|
22
|
+
export interface GuidonStep {
|
|
20
23
|
/** Unique identifier for this step */
|
|
21
24
|
id: string;
|
|
22
|
-
/**
|
|
23
|
-
|
|
25
|
+
/**
|
|
26
|
+
* ID of the target element to highlight.
|
|
27
|
+
* If omitted, this becomes a floating tooltip step.
|
|
28
|
+
*/
|
|
29
|
+
targetId?: string;
|
|
24
30
|
/** Title displayed in the tooltip */
|
|
25
31
|
title: string;
|
|
26
32
|
/** Description/content displayed in the tooltip */
|
|
27
33
|
description: string;
|
|
28
34
|
/** Preferred position of the tooltip */
|
|
29
35
|
tooltipPosition?: TooltipPosition;
|
|
36
|
+
/**
|
|
37
|
+
* Position for floating tooltips (only used when targetId is not provided)
|
|
38
|
+
* @default 'center'
|
|
39
|
+
*/
|
|
40
|
+
floatingPosition?: FloatingPosition;
|
|
30
41
|
/** Custom content to render in the tooltip */
|
|
31
42
|
customContent?: ReactNode;
|
|
32
43
|
/** Called when this step becomes active */
|
|
33
44
|
onStepEnter?: () => void;
|
|
34
45
|
/** Called when leaving this step */
|
|
35
46
|
onStepExit?: () => void;
|
|
47
|
+
/** Optional message to display while waiting for target to mount */
|
|
48
|
+
waitingMessage?: string;
|
|
49
|
+
/** Timeout in ms before auto-skipping this step (0 = no timeout) */
|
|
50
|
+
waitTimeout?: number;
|
|
36
51
|
}
|
|
37
52
|
/**
|
|
38
53
|
* Theme configuration for guidon styling
|
|
39
54
|
*/
|
|
40
|
-
interface GuidonTheme {
|
|
55
|
+
export interface GuidonTheme {
|
|
41
56
|
/** Color of the backdrop overlay */
|
|
42
57
|
backdropColor?: string;
|
|
43
58
|
/** Opacity of the backdrop (0-1) */
|
|
@@ -64,7 +79,7 @@ interface GuidonTheme {
|
|
|
64
79
|
/**
|
|
65
80
|
* State of a specific guidon tour
|
|
66
81
|
*/
|
|
67
|
-
interface GuidonProgress {
|
|
82
|
+
export interface GuidonProgress {
|
|
68
83
|
/** Unique identifier for the guidon */
|
|
69
84
|
guidonId: string;
|
|
70
85
|
/** Whether this guidon has been completed */
|
|
@@ -80,7 +95,7 @@ interface GuidonProgress {
|
|
|
80
95
|
* Persistence adapter interface for saving/loading guidon progress
|
|
81
96
|
* Implement this interface to connect the guidon to your backend
|
|
82
97
|
*/
|
|
83
|
-
interface GuidonPersistenceAdapter {
|
|
98
|
+
export interface GuidonPersistenceAdapter {
|
|
84
99
|
/**
|
|
85
100
|
* Load the progress for a specific guidon
|
|
86
101
|
* @param guidonId - Unique identifier for the guidon
|
|
@@ -106,7 +121,7 @@ interface GuidonPersistenceAdapter {
|
|
|
106
121
|
/**
|
|
107
122
|
* Configuration for a guidon
|
|
108
123
|
*/
|
|
109
|
-
interface GuidonConfig {
|
|
124
|
+
export interface GuidonConfig {
|
|
110
125
|
/** Unique identifier for this guidon */
|
|
111
126
|
id: string;
|
|
112
127
|
/** Steps in the guidon */
|
|
@@ -125,17 +140,19 @@ interface GuidonConfig {
|
|
|
125
140
|
/**
|
|
126
141
|
* Labels for tooltip buttons
|
|
127
142
|
*/
|
|
128
|
-
interface GuidonTooltipLabels {
|
|
143
|
+
export interface GuidonTooltipLabels {
|
|
129
144
|
next?: string;
|
|
130
145
|
previous?: string;
|
|
131
146
|
skip?: string;
|
|
132
147
|
finish?: string;
|
|
133
148
|
stepOf?: (current: number, total: number) => string;
|
|
149
|
+
/** Default message when waiting for target to mount */
|
|
150
|
+
waitingDefault?: string;
|
|
134
151
|
}
|
|
135
152
|
/**
|
|
136
153
|
* Props for custom tooltip renderer
|
|
137
154
|
*/
|
|
138
|
-
interface GuidonTooltipRenderProps {
|
|
155
|
+
export interface GuidonTooltipRenderProps {
|
|
139
156
|
step: GuidonStep;
|
|
140
157
|
currentIndex: number;
|
|
141
158
|
totalSteps: number;
|
|
@@ -146,7 +163,7 @@ interface GuidonTooltipRenderProps {
|
|
|
146
163
|
/**
|
|
147
164
|
* Props for the GuidonProvider component
|
|
148
165
|
*/
|
|
149
|
-
interface GuidonProviderProps {
|
|
166
|
+
export interface GuidonProviderProps {
|
|
150
167
|
children: ReactNode;
|
|
151
168
|
/** Configuration for the guidon */
|
|
152
169
|
config: GuidonConfig;
|
|
@@ -170,7 +187,7 @@ interface GuidonProviderProps {
|
|
|
170
187
|
/**
|
|
171
188
|
* Props for the GuidonTarget component
|
|
172
189
|
*/
|
|
173
|
-
interface GuidonTargetProps {
|
|
190
|
+
export interface GuidonTargetProps {
|
|
174
191
|
children: ReactNode;
|
|
175
192
|
/** Target ID that matches a step's targetId */
|
|
176
193
|
targetId: string;
|
|
@@ -180,7 +197,7 @@ interface GuidonTargetProps {
|
|
|
180
197
|
/**
|
|
181
198
|
* Internal store state
|
|
182
199
|
*/
|
|
183
|
-
interface GuidonState {
|
|
200
|
+
export interface GuidonState {
|
|
184
201
|
/** Currently active guidon config */
|
|
185
202
|
config: GuidonConfig | null;
|
|
186
203
|
/** Whether the guidon is currently active */
|
|
@@ -195,11 +212,15 @@ interface GuidonState {
|
|
|
195
212
|
isLoading: boolean;
|
|
196
213
|
/** Error from persistence operations */
|
|
197
214
|
error: string | null;
|
|
215
|
+
/** Whether the guide is waiting for a target element to mount */
|
|
216
|
+
waitingForTarget: boolean;
|
|
217
|
+
/** The targetId currently being waited for */
|
|
218
|
+
waitingTargetId: string | null;
|
|
198
219
|
}
|
|
199
220
|
/**
|
|
200
221
|
* Internal store actions
|
|
201
222
|
*/
|
|
202
|
-
interface GuidonActions {
|
|
223
|
+
export interface GuidonActions {
|
|
203
224
|
/** Configure the guidon */
|
|
204
225
|
configure: (config: GuidonConfig) => void;
|
|
205
226
|
/** Start the guidon */
|
|
@@ -225,90 +246,5 @@ interface GuidonActions {
|
|
|
225
246
|
/** Set error state */
|
|
226
247
|
setError: (error: string | null) => void;
|
|
227
248
|
}
|
|
228
|
-
type GuidonStore = GuidonState & GuidonActions;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* No-op adapter that doesn't persist anything
|
|
232
|
-
* Useful for testing or when persistence is not needed
|
|
233
|
-
*/
|
|
234
|
-
declare const createNoopAdapter: () => GuidonPersistenceAdapter;
|
|
235
|
-
/**
|
|
236
|
-
* Memory adapter that stores progress in memory
|
|
237
|
-
* Data is lost when the app is closed
|
|
238
|
-
*/
|
|
239
|
-
declare const createMemoryAdapter: () => GuidonPersistenceAdapter;
|
|
240
|
-
/**
|
|
241
|
-
* localStorage adapter for web
|
|
242
|
-
* Only works in browser environments
|
|
243
|
-
*/
|
|
244
|
-
declare const createLocalStorageAdapter: (keyPrefix?: string) => GuidonPersistenceAdapter;
|
|
245
|
-
/**
|
|
246
|
-
* AsyncStorage adapter for React Native
|
|
247
|
-
* Requires @react-native-async-storage/async-storage to be installed
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
251
|
-
* const adapter = createAsyncStorageAdapter(AsyncStorage);
|
|
252
|
-
*/
|
|
253
|
-
declare const createAsyncStorageAdapter: (asyncStorage: {
|
|
254
|
-
getItem: (key: string) => Promise<string | null>;
|
|
255
|
-
setItem: (key: string, value: string) => Promise<void>;
|
|
256
|
-
removeItem: (key: string) => Promise<void>;
|
|
257
|
-
getAllKeys: () => Promise<readonly string[]>;
|
|
258
|
-
multiGet: (keys: readonly string[]) => Promise<readonly [string, string | null][]>;
|
|
259
|
-
}, keyPrefix?: string) => GuidonPersistenceAdapter;
|
|
260
|
-
/**
|
|
261
|
-
* Create a custom API adapter for backend persistence
|
|
262
|
-
* This is a factory function that creates an adapter based on your API endpoints
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* const adapter = createApiAdapter({
|
|
266
|
-
* loadProgress: async (guidonId) => {
|
|
267
|
-
* const response = await fetch(`/api/guidon/${guidonId}`);
|
|
268
|
-
* return response.json();
|
|
269
|
-
* },
|
|
270
|
-
* saveProgress: async (progress) => {
|
|
271
|
-
* await fetch(`/api/guidon/${progress.guidonId}`, {
|
|
272
|
-
* method: 'POST',
|
|
273
|
-
* body: JSON.stringify(progress),
|
|
274
|
-
* });
|
|
275
|
-
* },
|
|
276
|
-
* });
|
|
277
|
-
*/
|
|
278
|
-
declare const createApiAdapter: (handlers: Partial<GuidonPersistenceAdapter>) => GuidonPersistenceAdapter;
|
|
279
|
-
/**
|
|
280
|
-
* Combine multiple adapters (e.g., save to both local and API)
|
|
281
|
-
* Loads from the first adapter that returns data
|
|
282
|
-
* Saves to all adapters
|
|
283
|
-
*/
|
|
284
|
-
declare const createCompositeAdapter: (adapters: GuidonPersistenceAdapter[]) => GuidonPersistenceAdapter;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Hook to manage guidon's walkthrough progress with a persistence adapter
|
|
288
|
-
*/
|
|
289
|
-
declare function useGuidonPersistence(adapter: GuidonPersistenceAdapter | undefined, guidonId: string): {
|
|
290
|
-
progress: GuidonProgress | null;
|
|
291
|
-
isLoading: boolean;
|
|
292
|
-
error: string | null;
|
|
293
|
-
isCompleted: boolean;
|
|
294
|
-
hasStarted: boolean;
|
|
295
|
-
saveProgress: (newProgress: Omit<GuidonProgress, "guidonId">) => Promise<void>;
|
|
296
|
-
clearProgress: () => Promise<void>;
|
|
297
|
-
markCompleted: () => Promise<void>;
|
|
298
|
-
markStepViewed: (stepIndex: number) => Promise<void>;
|
|
299
|
-
};
|
|
300
|
-
/**
|
|
301
|
-
* Hook to check if a guidon should be shown
|
|
302
|
-
*/
|
|
303
|
-
declare function useShouldShowGuidon(adapter: GuidonPersistenceAdapter | undefined, guidonId: string, options?: {
|
|
304
|
-
/** Show even if completed (for replay) */
|
|
305
|
-
forceShow?: boolean;
|
|
306
|
-
/** Additional condition to check */
|
|
307
|
-
additionalCondition?: () => boolean | Promise<boolean>;
|
|
308
|
-
}): {
|
|
309
|
-
shouldShow: boolean;
|
|
310
|
-
isChecking: boolean;
|
|
311
|
-
isCompleted: boolean;
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
export { type GuidonTargetProps as G, type TargetMeasurements as T, type GuidonTheme as a, type GuidonStep as b, type GuidonProviderProps as c, type GuidonStore as d, type GuidonConfig as e, type GuidonProgress as f, type GuidonPersistenceAdapter as g, type GuidonTooltipLabels as h, type GuidonTooltipRenderProps as i, type TooltipPosition as j, type GuidonState as k, type GuidonActions as l, createNoopAdapter as m, createMemoryAdapter as n, createLocalStorageAdapter as o, createAsyncStorageAdapter as p, createApiAdapter as q, createCompositeAdapter as r, useShouldShowGuidon as s, useGuidonPersistence as u };
|
|
249
|
+
export type GuidonStore = GuidonState & GuidonActions;
|
|
250
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|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AY,KAAK,IAAI,CAAC;IAC1C,uBAAuB;IACvB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,4BAA4B;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,sBAAsB;IACtB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,uCAAuC;IACvC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC7E,0BAA0B;IAC1B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,wBAAwB;IACxB,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,sBAAsB;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GuidonTheme } from '../types';
|
|
2
|
+
interface GuidonOverlayProps {
|
|
3
|
+
theme?: GuidonTheme;
|
|
4
|
+
animationDuration?: number;
|
|
5
|
+
onBackdropPress?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function GuidonOverlay({ theme, animationDuration, onBackdropPress, }: GuidonOverlayProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=GuidonOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuidonOverlay.d.ts","sourceRoot":"","sources":["../../../../src/components/GuidonOverlay.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAsB,WAAW,EAAe,MAAM,UAAU,CAAC;AAgB7E,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAU,EACV,iBAAuB,EACvB,eAAe,GAChB,EAAE,kBAAkB,kDAuKpB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GuidonProviderProps } from '../types';
|
|
2
|
+
interface GuidonContextValue {
|
|
3
|
+
start: () => void;
|
|
4
|
+
skip: () => void;
|
|
5
|
+
reset: () => void;
|
|
6
|
+
replay: () => Promise<void>;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
isCompleted: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function useGuidonContext(): GuidonContextValue;
|
|
12
|
+
export declare function GuidonProvider({ children, config, autoStart, shouldStart, persistenceAdapter, portalComponent: Portal, renderTooltip, tooltipLabels, onBackdropPress, }: GuidonProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=GuidonProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuidonProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/GuidonProvider.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAElB,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB;AAID,wBAAgB,gBAAgB,uBAM/B;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,MAAM,EACN,SAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,eAAe,EAAE,MAAM,EACvB,aAAa,EACb,aAAa,EACb,eAAe,GAChB,EAAE,mBAAmB,2CAgJrB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GuidonTargetProps } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Wrapper component that marks an element as a walkthrough target
|
|
4
|
+
* Automatically measures and reports its position to the walkthrough store
|
|
5
|
+
*/
|
|
6
|
+
export declare function GuidonTarget({ children, targetId, active, }: GuidonTargetProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=GuidonTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuidonTarget.d.ts","sourceRoot":"","sources":["../../../../src/components/GuidonTarget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,QAAQ,EACR,MAAa,GACd,EAAE,iBAAiB,2CAyGnB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { GuidonTheme, GuidonStep } from '../types';
|
|
2
|
+
interface GuidonTooltipProps {
|
|
3
|
+
theme?: GuidonTheme;
|
|
4
|
+
animationDuration?: number;
|
|
5
|
+
renderCustomTooltip?: (props: {
|
|
6
|
+
step: GuidonStep;
|
|
7
|
+
currentIndex: number;
|
|
8
|
+
totalSteps: number;
|
|
9
|
+
onNext: () => void;
|
|
10
|
+
onPrevious: () => void;
|
|
11
|
+
onSkip: () => void;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
labels?: {
|
|
14
|
+
next?: string;
|
|
15
|
+
previous?: string;
|
|
16
|
+
skip?: string;
|
|
17
|
+
finish?: string;
|
|
18
|
+
stepOf?: (current: number, total: number) => string;
|
|
19
|
+
waitingDefault?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare function GuidonTooltip({ theme, animationDuration, renderCustomTooltip, labels, }: GuidonTooltipProps): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=GuidonTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuidonTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/GuidonTooltip.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAoD,UAAU,EAAoB,MAAM,UAAU,CAAC;AAyF5H,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC5B,IAAI,EAAE,UAAU,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,IAAI,CAAC;QACnB,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,MAAM,EAAE,MAAM,IAAI,CAAC;KACpB,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;QACpD,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAU,EACV,iBAAuB,EACvB,mBAAmB,EACnB,MAAW,GACZ,EAAE,kBAAkB,kDAyQpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Element type that can be measured
|
|
4
|
+
* Supports both web elements and React Native Views
|
|
5
|
+
*/
|
|
6
|
+
type MeasurableElement = {
|
|
7
|
+
getBoundingClientRect?: () => DOMRect;
|
|
8
|
+
measureInWindow?: (callback: (x: number, y: number, width: number, height: number) => void) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Hook that returns a ref to attach to an element for guidon targeting.
|
|
12
|
+
* Alternative to the GuidonTarget wrapper component.
|
|
13
|
+
*
|
|
14
|
+
* @param targetId - The target ID that matches a step's targetId
|
|
15
|
+
* @returns A ref to attach to the target element
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* function MyComponent() {
|
|
20
|
+
* const buttonRef = useGuidonRef<View>('my-button');
|
|
21
|
+
* return <Button ref={buttonRef}>Click me</Button>;
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Web usage
|
|
26
|
+
* ```tsx
|
|
27
|
+
* function MyComponent() {
|
|
28
|
+
* const divRef = useGuidonRef<HTMLDivElement>('my-div');
|
|
29
|
+
* return <div ref={divRef}>Highlight me</div>;
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useGuidonRef<T extends MeasurableElement>(targetId: string): RefObject<T | null>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=useGuidonRef.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGuidonRef.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useGuidonRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvE;;;GAGG;AACH,KAAK,iBAAiB,GAAG;IACvB,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC;IACtC,eAAe,CAAC,EAAE,CAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,KACpE,IAAI,CAAC;CACX,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,iBAAiB,EACtD,QAAQ,EAAE,MAAM,GACf,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAgHrB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { GuidonTarget, GuidonOverlay, GuidonTooltip, GuidonProvider, useGuidonContext, } from "./components";
|
|
2
|
+
export { useGuidonRef } from "./hooks";
|
|
3
|
+
export { useGuidonStore, Guidon, useGuidonActive, useGuidonStep, useGuidonProgress, useTargetMeasurements, useWaitingState, useIsFloatingStep, } from "./store";
|
|
4
|
+
export type { GuidonStep, GuidonConfig, GuidonTheme, GuidonProgress, GuidonPersistenceAdapter, GuidonProviderProps, GuidonTargetProps, GuidonTooltipLabels, GuidonTooltipRenderProps, TooltipPosition, FloatingPosition, TargetMeasurements, GuidonState, GuidonActions, GuidonStore, } from "./types";
|
|
5
|
+
export { createNoopAdapter, createMemoryAdapter, createLocalStorageAdapter, createAsyncStorageAdapter, createApiAdapter, createCompositeAdapter, } from "./persistence/adapters";
|
|
6
|
+
export { useGuidonPersistence, useShouldShowGuidon, } from "./persistence/hooks";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,OAAO,EACL,cAAc,EACd,MAAM,EACN,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { GuidonPersistenceAdapter } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* No-op adapter that doesn't persist anything
|
|
4
|
+
* Useful for testing or when persistence is not needed
|
|
5
|
+
*/
|
|
6
|
+
export declare const createNoopAdapter: () => GuidonPersistenceAdapter;
|
|
7
|
+
/**
|
|
8
|
+
* Memory adapter that stores progress in memory
|
|
9
|
+
* Data is lost when the app is closed
|
|
10
|
+
*/
|
|
11
|
+
export declare const createMemoryAdapter: () => GuidonPersistenceAdapter;
|
|
12
|
+
/**
|
|
13
|
+
* localStorage adapter for web
|
|
14
|
+
* Only works in browser environments
|
|
15
|
+
*/
|
|
16
|
+
export declare const createLocalStorageAdapter: (keyPrefix?: string) => GuidonPersistenceAdapter;
|
|
17
|
+
/**
|
|
18
|
+
* AsyncStorage adapter for React Native
|
|
19
|
+
* Requires @react-native-async-storage/async-storage to be installed
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
23
|
+
* const adapter = createAsyncStorageAdapter(AsyncStorage);
|
|
24
|
+
*/
|
|
25
|
+
export declare const createAsyncStorageAdapter: (asyncStorage: {
|
|
26
|
+
getItem: (key: string) => Promise<string | null>;
|
|
27
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
28
|
+
removeItem: (key: string) => Promise<void>;
|
|
29
|
+
getAllKeys: () => Promise<readonly string[]>;
|
|
30
|
+
multiGet: (keys: readonly string[]) => Promise<readonly [string, string | null][]>;
|
|
31
|
+
}, keyPrefix?: string) => GuidonPersistenceAdapter;
|
|
32
|
+
/**
|
|
33
|
+
* Create a custom API adapter for backend persistence
|
|
34
|
+
* This is a factory function that creates an adapter based on your API endpoints
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const adapter = createApiAdapter({
|
|
38
|
+
* loadProgress: async (guidonId) => {
|
|
39
|
+
* const response = await fetch(`/api/guidon/${guidonId}`);
|
|
40
|
+
* return response.json();
|
|
41
|
+
* },
|
|
42
|
+
* saveProgress: async (progress) => {
|
|
43
|
+
* await fetch(`/api/guidon/${progress.guidonId}`, {
|
|
44
|
+
* method: 'POST',
|
|
45
|
+
* body: JSON.stringify(progress),
|
|
46
|
+
* });
|
|
47
|
+
* },
|
|
48
|
+
* });
|
|
49
|
+
*/
|
|
50
|
+
export declare const createApiAdapter: (handlers: Partial<GuidonPersistenceAdapter>) => GuidonPersistenceAdapter;
|
|
51
|
+
/**
|
|
52
|
+
* Combine multiple adapters (e.g., save to both local and API)
|
|
53
|
+
* Loads from the first adapter that returns data
|
|
54
|
+
* Saves to all adapters
|
|
55
|
+
*/
|
|
56
|
+
export declare const createCompositeAdapter: (adapters: GuidonPersistenceAdapter[]) => GuidonPersistenceAdapter;
|
|
57
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../../../src/persistence/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAkB,MAAM,UAAU,CAAC;AAIzE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,wBAKnC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAO,wBAatC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GACpC,YAAW,MAA2B,KACrC,wBAwDD,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,cAAc;IACZ,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACjD,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,UAAU,EAAE,MAAM,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;CACpF,EACD,YAAW,MAA2B,KACrC,wBA2CD,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,OAAO,CAAC,wBAAwB,CAAC,KAC1C,wBAQF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,wBAAwB,EAAE,KACnC,wBA0BD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { GuidonPersistenceAdapter, GuidonProgress } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to manage guidon's walkthrough progress with a persistence adapter
|
|
4
|
+
*/
|
|
5
|
+
export declare function useGuidonPersistence(adapter: GuidonPersistenceAdapter | undefined, guidonId: string): {
|
|
6
|
+
progress: GuidonProgress | null;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
error: string | null;
|
|
9
|
+
isCompleted: boolean;
|
|
10
|
+
hasStarted: boolean;
|
|
11
|
+
saveProgress: (newProgress: Omit<GuidonProgress, "guidonId">) => Promise<void>;
|
|
12
|
+
clearProgress: () => Promise<void>;
|
|
13
|
+
markCompleted: () => Promise<void>;
|
|
14
|
+
markStepViewed: (stepIndex: number) => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Hook to check if a guidon should be shown
|
|
18
|
+
*/
|
|
19
|
+
export declare function useShouldShowGuidon(adapter: GuidonPersistenceAdapter | undefined, guidonId: string, options?: {
|
|
20
|
+
/** Show even if completed (for replay) */
|
|
21
|
+
forceShow?: boolean;
|
|
22
|
+
/** Additional condition to check */
|
|
23
|
+
additionalCondition?: () => boolean | Promise<boolean>;
|
|
24
|
+
}): {
|
|
25
|
+
shouldShow: boolean;
|
|
26
|
+
isChecking: boolean;
|
|
27
|
+
isCompleted: boolean;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/persistence/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzE;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,wBAAwB,GAAG,SAAS,EAC7C,QAAQ,EAAE,MAAM;;;;;;gCA0CM,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC;;;gCA2ClC,MAAM;EAsB3B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,wBAAwB,GAAG,SAAS,EAC7C,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IACR,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,mBAAmB,CAAC,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD;;;;EAkDF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/persistence/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|