@korsolutions/guidon 1.0.1 → 1.0.2
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 +108 -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 +305 -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 +104 -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 +295 -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 +26 -16
- 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 +40 -0
- 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,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWaitingState = exports.useTargetMeasurements = exports.useIsFloatingStep = exports.useGuidonStore = exports.useGuidonStep = exports.useGuidonProgress = exports.useGuidonActive = exports.Guidon = void 0;
|
|
7
|
+
var _zustand = require("zustand");
|
|
8
|
+
const initialState = {
|
|
9
|
+
config: null,
|
|
10
|
+
isActive: false,
|
|
11
|
+
currentStepIndex: 0,
|
|
12
|
+
isCompleted: false,
|
|
13
|
+
targetMeasurements: {},
|
|
14
|
+
isLoading: false,
|
|
15
|
+
error: null,
|
|
16
|
+
waitingForTarget: false,
|
|
17
|
+
waitingTargetId: null
|
|
18
|
+
};
|
|
19
|
+
const useGuidonStore = exports.useGuidonStore = (0, _zustand.create)((set, get) => ({
|
|
20
|
+
...initialState,
|
|
21
|
+
configure: config => {
|
|
22
|
+
set({
|
|
23
|
+
config,
|
|
24
|
+
currentStepIndex: 0,
|
|
25
|
+
isCompleted: false
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
start: () => {
|
|
29
|
+
const {
|
|
30
|
+
config
|
|
31
|
+
} = get();
|
|
32
|
+
if (!config || config.steps.length === 0) return;
|
|
33
|
+
set({
|
|
34
|
+
isActive: true,
|
|
35
|
+
currentStepIndex: 0,
|
|
36
|
+
isCompleted: false
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Call onStepEnter for the first step
|
|
40
|
+
const firstStep = config.steps[0];
|
|
41
|
+
firstStep.onStepEnter?.();
|
|
42
|
+
config.onStepChange?.(0, firstStep);
|
|
43
|
+
},
|
|
44
|
+
next: () => {
|
|
45
|
+
const {
|
|
46
|
+
config,
|
|
47
|
+
currentStepIndex,
|
|
48
|
+
isActive
|
|
49
|
+
} = get();
|
|
50
|
+
if (!config || !isActive) return;
|
|
51
|
+
const currentStep = config.steps[currentStepIndex];
|
|
52
|
+
currentStep?.onStepExit?.();
|
|
53
|
+
if (currentStepIndex < config.steps.length - 1) {
|
|
54
|
+
const nextIndex = currentStepIndex + 1;
|
|
55
|
+
const nextStep = config.steps[nextIndex];
|
|
56
|
+
set({
|
|
57
|
+
currentStepIndex: nextIndex
|
|
58
|
+
});
|
|
59
|
+
nextStep.onStepEnter?.();
|
|
60
|
+
config.onStepChange?.(nextIndex, nextStep);
|
|
61
|
+
} else {
|
|
62
|
+
// Last step completed
|
|
63
|
+
get().complete();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
previous: () => {
|
|
67
|
+
const {
|
|
68
|
+
config,
|
|
69
|
+
currentStepIndex,
|
|
70
|
+
isActive
|
|
71
|
+
} = get();
|
|
72
|
+
if (!config || !isActive || currentStepIndex === 0) return;
|
|
73
|
+
const currentStep = config.steps[currentStepIndex];
|
|
74
|
+
currentStep?.onStepExit?.();
|
|
75
|
+
const prevIndex = currentStepIndex - 1;
|
|
76
|
+
const prevStep = config.steps[prevIndex];
|
|
77
|
+
set({
|
|
78
|
+
currentStepIndex: prevIndex
|
|
79
|
+
});
|
|
80
|
+
prevStep.onStepEnter?.();
|
|
81
|
+
config.onStepChange?.(prevIndex, prevStep);
|
|
82
|
+
},
|
|
83
|
+
goToStep: index => {
|
|
84
|
+
const {
|
|
85
|
+
config,
|
|
86
|
+
currentStepIndex,
|
|
87
|
+
isActive
|
|
88
|
+
} = get();
|
|
89
|
+
if (!config || !isActive) return;
|
|
90
|
+
if (index < 0 || index >= config.steps.length) return;
|
|
91
|
+
const currentStep = config.steps[currentStepIndex];
|
|
92
|
+
currentStep?.onStepExit?.();
|
|
93
|
+
const targetStep = config.steps[index];
|
|
94
|
+
set({
|
|
95
|
+
currentStepIndex: index
|
|
96
|
+
});
|
|
97
|
+
targetStep.onStepEnter?.();
|
|
98
|
+
config.onStepChange?.(index, targetStep);
|
|
99
|
+
},
|
|
100
|
+
skip: () => {
|
|
101
|
+
const {
|
|
102
|
+
config,
|
|
103
|
+
currentStepIndex
|
|
104
|
+
} = get();
|
|
105
|
+
if (!config) return;
|
|
106
|
+
const currentStep = config.steps[currentStepIndex];
|
|
107
|
+
currentStep?.onStepExit?.();
|
|
108
|
+
set({
|
|
109
|
+
isActive: false,
|
|
110
|
+
isCompleted: false
|
|
111
|
+
});
|
|
112
|
+
config.onSkip?.();
|
|
113
|
+
},
|
|
114
|
+
complete: () => {
|
|
115
|
+
const {
|
|
116
|
+
config,
|
|
117
|
+
currentStepIndex
|
|
118
|
+
} = get();
|
|
119
|
+
if (!config) return;
|
|
120
|
+
const currentStep = config.steps[currentStepIndex];
|
|
121
|
+
currentStep?.onStepExit?.();
|
|
122
|
+
set({
|
|
123
|
+
isActive: false,
|
|
124
|
+
isCompleted: true
|
|
125
|
+
});
|
|
126
|
+
config.onComplete?.();
|
|
127
|
+
},
|
|
128
|
+
reset: () => {
|
|
129
|
+
set(initialState);
|
|
130
|
+
},
|
|
131
|
+
registerTarget: (targetId, measurements) => {
|
|
132
|
+
const {
|
|
133
|
+
waitingTargetId
|
|
134
|
+
} = get();
|
|
135
|
+
set(state => ({
|
|
136
|
+
targetMeasurements: {
|
|
137
|
+
...state.targetMeasurements,
|
|
138
|
+
[targetId]: measurements
|
|
139
|
+
},
|
|
140
|
+
// Clear waiting state if this was the target we were waiting for
|
|
141
|
+
waitingForTarget: waitingTargetId === targetId ? false : state.waitingForTarget,
|
|
142
|
+
waitingTargetId: waitingTargetId === targetId ? null : state.waitingTargetId
|
|
143
|
+
}));
|
|
144
|
+
},
|
|
145
|
+
unregisterTarget: targetId => {
|
|
146
|
+
set(state => {
|
|
147
|
+
const {
|
|
148
|
+
[targetId]: _,
|
|
149
|
+
...rest
|
|
150
|
+
} = state.targetMeasurements;
|
|
151
|
+
return {
|
|
152
|
+
targetMeasurements: rest
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
setLoading: isLoading => {
|
|
157
|
+
set({
|
|
158
|
+
isLoading
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
setError: error => {
|
|
162
|
+
set({
|
|
163
|
+
error
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Guidon API for external control
|
|
170
|
+
* Can be used outside of React components
|
|
171
|
+
*/
|
|
172
|
+
const Guidon = exports.Guidon = {
|
|
173
|
+
/**
|
|
174
|
+
* Configure the walkthrough with steps and options
|
|
175
|
+
*/
|
|
176
|
+
configure: config => {
|
|
177
|
+
useGuidonStore.getState().configure(config);
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* Start the walkthrough
|
|
181
|
+
*/
|
|
182
|
+
start: () => {
|
|
183
|
+
useGuidonStore.getState().start();
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* Go to the next step
|
|
187
|
+
*/
|
|
188
|
+
next: () => {
|
|
189
|
+
useGuidonStore.getState().next();
|
|
190
|
+
},
|
|
191
|
+
/**
|
|
192
|
+
* Go to the previous step
|
|
193
|
+
*/
|
|
194
|
+
previous: () => {
|
|
195
|
+
useGuidonStore.getState().previous();
|
|
196
|
+
},
|
|
197
|
+
/**
|
|
198
|
+
* Go to a specific step by index
|
|
199
|
+
*/
|
|
200
|
+
goToStep: index => {
|
|
201
|
+
useGuidonStore.getState().goToStep(index);
|
|
202
|
+
},
|
|
203
|
+
/**
|
|
204
|
+
* Skip the walkthrough
|
|
205
|
+
*/
|
|
206
|
+
skip: () => {
|
|
207
|
+
useGuidonStore.getState().skip();
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* Complete the walkthrough
|
|
211
|
+
*/
|
|
212
|
+
complete: () => {
|
|
213
|
+
useGuidonStore.getState().complete();
|
|
214
|
+
},
|
|
215
|
+
/**
|
|
216
|
+
* Reset the walkthrough to initial state
|
|
217
|
+
*/
|
|
218
|
+
reset: () => {
|
|
219
|
+
useGuidonStore.getState().reset();
|
|
220
|
+
},
|
|
221
|
+
/**
|
|
222
|
+
* Check if the walkthrough is currently active
|
|
223
|
+
*/
|
|
224
|
+
isActive: () => {
|
|
225
|
+
return useGuidonStore.getState().isActive;
|
|
226
|
+
},
|
|
227
|
+
/**
|
|
228
|
+
* Check if the walkthrough has been completed
|
|
229
|
+
*/
|
|
230
|
+
isCompleted: () => {
|
|
231
|
+
return useGuidonStore.getState().isCompleted;
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* Get the current step index
|
|
235
|
+
*/
|
|
236
|
+
getCurrentStepIndex: () => {
|
|
237
|
+
return useGuidonStore.getState().currentStepIndex;
|
|
238
|
+
},
|
|
239
|
+
/**
|
|
240
|
+
* Get the current step
|
|
241
|
+
*/
|
|
242
|
+
getCurrentStep: () => {
|
|
243
|
+
const state = useGuidonStore.getState();
|
|
244
|
+
return state.config?.steps[state.currentStepIndex] ?? null;
|
|
245
|
+
},
|
|
246
|
+
/**
|
|
247
|
+
* Get all steps
|
|
248
|
+
*/
|
|
249
|
+
getSteps: () => {
|
|
250
|
+
return useGuidonStore.getState().config?.steps ?? [];
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* Subscribe to store changes
|
|
254
|
+
*/
|
|
255
|
+
subscribe: useGuidonStore.subscribe
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Hook selectors for common use cases
|
|
260
|
+
*/
|
|
261
|
+
const useGuidonActive = () => useGuidonStore(state => state.isActive);
|
|
262
|
+
exports.useGuidonActive = useGuidonActive;
|
|
263
|
+
const useGuidonStep = () => useGuidonStore(state => {
|
|
264
|
+
if (!state.config || !state.isActive) return null;
|
|
265
|
+
return state.config.steps[state.currentStepIndex];
|
|
266
|
+
});
|
|
267
|
+
exports.useGuidonStep = useGuidonStep;
|
|
268
|
+
const useGuidonProgress = () => useGuidonStore(state => ({
|
|
269
|
+
currentStep: state.currentStepIndex + 1,
|
|
270
|
+
totalSteps: state.config?.steps.length ?? 0,
|
|
271
|
+
percentage: state.config ? (state.currentStepIndex + 1) / state.config.steps.length * 100 : 0
|
|
272
|
+
}));
|
|
273
|
+
exports.useGuidonProgress = useGuidonProgress;
|
|
274
|
+
const useTargetMeasurements = targetId => useGuidonStore(state => state.targetMeasurements[targetId]);
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Hook to check if the guidon is waiting for a target element to mount
|
|
278
|
+
* Returns null if not active, not waiting, or if it's a floating step
|
|
279
|
+
*/
|
|
280
|
+
exports.useTargetMeasurements = useTargetMeasurements;
|
|
281
|
+
const useWaitingState = () => useGuidonStore(state => {
|
|
282
|
+
if (!state.isActive || !state.config) return null;
|
|
283
|
+
const currentStep = state.config.steps[state.currentStepIndex];
|
|
284
|
+
const targetId = currentStep?.targetId;
|
|
285
|
+
|
|
286
|
+
// Floating step (no targetId) - not waiting
|
|
287
|
+
if (!targetId) return null;
|
|
288
|
+
const hasMeasurements = !!state.targetMeasurements[targetId];
|
|
289
|
+
return {
|
|
290
|
+
isWaiting: !hasMeasurements,
|
|
291
|
+
targetId: hasMeasurements ? null : targetId,
|
|
292
|
+
message: currentStep?.waitingMessage ?? null
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Hook to check if the current step is a floating step (no target element)
|
|
298
|
+
*/
|
|
299
|
+
exports.useWaitingState = useWaitingState;
|
|
300
|
+
const useIsFloatingStep = () => useGuidonStore(state => {
|
|
301
|
+
if (!state.config || !state.isActive) return false;
|
|
302
|
+
return !state.config.steps[state.currentStepIndex]?.targetId;
|
|
303
|
+
});
|
|
304
|
+
exports.useIsFloatingStep = useIsFloatingStep;
|
|
305
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_zustand","require","initialState","config","isActive","currentStepIndex","isCompleted","targetMeasurements","isLoading","error","waitingForTarget","waitingTargetId","useGuidonStore","exports","create","set","get","configure","start","steps","length","firstStep","onStepEnter","onStepChange","next","currentStep","onStepExit","nextIndex","nextStep","complete","previous","prevIndex","prevStep","goToStep","index","targetStep","skip","onSkip","onComplete","reset","registerTarget","targetId","measurements","state","unregisterTarget","_","rest","setLoading","setError","Guidon","getState","getCurrentStepIndex","getCurrentStep","getSteps","subscribe","useGuidonActive","useGuidonStep","useGuidonProgress","totalSteps","percentage","useTargetMeasurements","useWaitingState","hasMeasurements","isWaiting","message","waitingMessage","useIsFloatingStep"],"sourceRoot":"../../src","sources":["store.ts"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CAAC,CAAC;AAAC5B,OAAA,CAAAqD,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"customConditions": ["dev-source", "react-native", "react-native-strict-api"],
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"jsx": "react-native",
|
|
7
|
+
"lib": ["DOM", "ESNext"],
|
|
8
|
+
"module": "preserve",
|
|
9
|
+
"moduleDetection": "force",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"target": "ESNext",
|
|
15
|
+
"strict": true,
|
|
16
|
+
"verbatimModuleSyntax": true,
|
|
17
|
+
"allowUnreachableCode": false,
|
|
18
|
+
"allowUnusedLabels": false,
|
|
19
|
+
"forceConsistentCasingInFileNames": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noImplicitReturns": true,
|
|
22
|
+
"noImplicitUseStrict": false,
|
|
23
|
+
"noStrictGenericChecks": false,
|
|
24
|
+
"noUncheckedIndexedAccess": true,
|
|
25
|
+
"noUnusedLocals": true,
|
|
26
|
+
"noUnusedParameters": true,
|
|
27
|
+
"paths": {
|
|
28
|
+
"@/*": ["./src/*"]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"exclude": ["node_modules", "dist"]
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = function (api) {
|
|
4
|
+
api.cache(true);
|
|
5
|
+
return {
|
|
6
|
+
presets: ["module:react-native-builder-bob/babel-preset"],
|
|
7
|
+
plugins: [[require.resolve("babel-plugin-module-resolver"), {
|
|
8
|
+
root: ["./src"],
|
|
9
|
+
alias: {
|
|
10
|
+
"@": "./src"
|
|
11
|
+
}
|
|
12
|
+
}]]
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=babel.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["module","exports","api","cache","presets","plugins","require","resolve","root","alias"],"sourceRoot":"../../src","sources":["babel.config.js"],"mappings":";;AAAAA,MAAM,CAACC,OAAO,GAAG,UAAUC,GAAG,EAAE;EAC9BA,GAAG,CAACC,KAAK,CAAC,IAAI,CAAC;EAEf,OAAO;IACLC,OAAO,EAAE,CAAC,8CAA8C,CAAC;IACzDC,OAAO,EAAE,CACP,CACEC,OAAO,CAACC,OAAO,CAAC,8BAA8B,CAAC,EAC/C;MACEC,IAAI,EAAE,CAAC,OAAO,CAAC;MACfC,KAAK,EAAE;QACL,GAAG,EAAE;MACP;IACF,CAAC,CACF;EAEL,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["module","exports","source","output","targets","esm","configFile"],"sourceRoot":"../../src","sources":["bob.config.js"],"mappings":";;AAAAA,MAAM,CAACC,OAAO,GAAG;EACfC,MAAM,EAAE,KAAK;EACbC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAE,CACP,CACE,QAAQ,EACR;IACEC,GAAG,EAAE,IAAI;IACTC,UAAU,EAAE;EACd,CAAC,CACF,EACD,YAAY;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { StyleSheet, Dimensions, TouchableWithoutFeedback, Platform } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedStyle, withTiming, Easing } from 'react-native-reanimated';
|
|
6
|
+
import Svg, { Defs, Mask, Rect, G } from 'react-native-svg';
|
|
7
|
+
import { useGuidonStore, useWaitingState, useIsFloatingStep } from "../store.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const AnimatedSvg = Animated.createAnimatedComponent(Svg);
|
|
10
|
+
const DEFAULT_THEME = {
|
|
11
|
+
backdropColor: '#000000',
|
|
12
|
+
backdropOpacity: 0.75,
|
|
13
|
+
spotlightBorderRadius: 8,
|
|
14
|
+
spotlightPadding: 8
|
|
15
|
+
};
|
|
16
|
+
export function GuidonOverlay({
|
|
17
|
+
theme = {},
|
|
18
|
+
animationDuration = 300,
|
|
19
|
+
onBackdropPress
|
|
20
|
+
}) {
|
|
21
|
+
const isActive = useGuidonStore(state => state.isActive);
|
|
22
|
+
const config = useGuidonStore(state => state.config);
|
|
23
|
+
const currentStepIndex = useGuidonStore(state => state.currentStepIndex);
|
|
24
|
+
const targetMeasurements = useGuidonStore(state => state.targetMeasurements);
|
|
25
|
+
|
|
26
|
+
// Check for floating or waiting states
|
|
27
|
+
const isFloatingStep = useIsFloatingStep();
|
|
28
|
+
const waitingState = useWaitingState();
|
|
29
|
+
const isWaiting = waitingState?.isWaiting ?? false;
|
|
30
|
+
const mergedTheme = {
|
|
31
|
+
...DEFAULT_THEME,
|
|
32
|
+
...theme
|
|
33
|
+
};
|
|
34
|
+
const {
|
|
35
|
+
width: screenWidth,
|
|
36
|
+
height: screenHeight
|
|
37
|
+
} = Dimensions.get('window');
|
|
38
|
+
|
|
39
|
+
// Get current step's target measurements
|
|
40
|
+
const currentStep = config?.steps[currentStepIndex];
|
|
41
|
+
const currentTargetId = currentStep?.targetId;
|
|
42
|
+
const measurements = currentTargetId ? targetMeasurements[currentTargetId] : undefined;
|
|
43
|
+
|
|
44
|
+
// Determine if we should show full backdrop (no spotlight cutout)
|
|
45
|
+
const showFullBackdrop = isFloatingStep || isWaiting;
|
|
46
|
+
|
|
47
|
+
// Calculate spotlight dimensions with padding
|
|
48
|
+
const spotlight = useMemo(() => {
|
|
49
|
+
if (!measurements) {
|
|
50
|
+
return {
|
|
51
|
+
x: 0,
|
|
52
|
+
y: 0,
|
|
53
|
+
width: 0,
|
|
54
|
+
height: 0
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
x: measurements.x - mergedTheme.spotlightPadding,
|
|
59
|
+
y: measurements.y - mergedTheme.spotlightPadding,
|
|
60
|
+
width: measurements.width + mergedTheme.spotlightPadding * 2,
|
|
61
|
+
height: measurements.height + mergedTheme.spotlightPadding * 2
|
|
62
|
+
};
|
|
63
|
+
}, [measurements, mergedTheme.spotlightPadding]);
|
|
64
|
+
|
|
65
|
+
// Animated styles for fade in/out
|
|
66
|
+
// Show backdrop for: normal steps with measurements, floating steps, or waiting states
|
|
67
|
+
const shouldShow = isActive && (measurements || showFullBackdrop);
|
|
68
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
69
|
+
return {
|
|
70
|
+
opacity: withTiming(shouldShow ? 1 : 0, {
|
|
71
|
+
duration: animationDuration,
|
|
72
|
+
easing: Easing.inOut(Easing.ease)
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
}, [shouldShow, animationDuration]);
|
|
76
|
+
if (!isActive) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Render full backdrop without spotlight for floating steps or waiting states
|
|
81
|
+
if (showFullBackdrop) {
|
|
82
|
+
if (Platform.OS === 'web') {
|
|
83
|
+
return /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
84
|
+
onPress: onBackdropPress,
|
|
85
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
86
|
+
style: [styles.container, animatedStyle],
|
|
87
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
88
|
+
style: {
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
inset: 0,
|
|
91
|
+
backgroundColor: mergedTheme.backdropColor,
|
|
92
|
+
opacity: mergedTheme.backdropOpacity
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Native: full backdrop without cutout
|
|
100
|
+
return /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
101
|
+
onPress: onBackdropPress,
|
|
102
|
+
children: /*#__PURE__*/_jsx(AnimatedSvg, {
|
|
103
|
+
style: [styles.container, animatedStyle],
|
|
104
|
+
width: screenWidth,
|
|
105
|
+
height: screenHeight,
|
|
106
|
+
viewBox: `0 0 ${screenWidth} ${screenHeight}`,
|
|
107
|
+
children: /*#__PURE__*/_jsx(Rect, {
|
|
108
|
+
x: "0",
|
|
109
|
+
y: "0",
|
|
110
|
+
width: "100%",
|
|
111
|
+
height: "100%",
|
|
112
|
+
fill: mergedTheme.backdropColor,
|
|
113
|
+
fillOpacity: mergedTheme.backdropOpacity
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// If we have a target but no measurements yet, don't render anything
|
|
120
|
+
if (!measurements) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// For web, use a different approach with CSS
|
|
125
|
+
if (Platform.OS === 'web') {
|
|
126
|
+
return /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
127
|
+
onPress: onBackdropPress,
|
|
128
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
129
|
+
style: [styles.container, animatedStyle],
|
|
130
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
131
|
+
style: {
|
|
132
|
+
position: 'absolute',
|
|
133
|
+
inset: 0,
|
|
134
|
+
backgroundColor: mergedTheme.backdropColor,
|
|
135
|
+
opacity: mergedTheme.backdropOpacity,
|
|
136
|
+
clipPath: `polygon(
|
|
137
|
+
0% 0%,
|
|
138
|
+
0% 100%,
|
|
139
|
+
${spotlight.x}px 100%,
|
|
140
|
+
${spotlight.x}px ${spotlight.y}px,
|
|
141
|
+
${spotlight.x + spotlight.width}px ${spotlight.y}px,
|
|
142
|
+
${spotlight.x + spotlight.width}px ${spotlight.y + spotlight.height}px,
|
|
143
|
+
${spotlight.x}px ${spotlight.y + spotlight.height}px,
|
|
144
|
+
${spotlight.x}px 100%,
|
|
145
|
+
100% 100%,
|
|
146
|
+
100% 0%
|
|
147
|
+
)`
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Native implementation using SVG mask
|
|
155
|
+
return /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
156
|
+
onPress: onBackdropPress,
|
|
157
|
+
children: /*#__PURE__*/_jsxs(AnimatedSvg, {
|
|
158
|
+
style: [styles.container, animatedStyle],
|
|
159
|
+
width: screenWidth,
|
|
160
|
+
height: screenHeight,
|
|
161
|
+
viewBox: `0 0 ${screenWidth} ${screenHeight}`,
|
|
162
|
+
children: [/*#__PURE__*/_jsx(Defs, {
|
|
163
|
+
children: /*#__PURE__*/_jsxs(Mask, {
|
|
164
|
+
id: "spotlight-mask",
|
|
165
|
+
children: [/*#__PURE__*/_jsx(Rect, {
|
|
166
|
+
x: "0",
|
|
167
|
+
y: "0",
|
|
168
|
+
width: "100%",
|
|
169
|
+
height: "100%",
|
|
170
|
+
fill: "white"
|
|
171
|
+
}), /*#__PURE__*/_jsx(Rect, {
|
|
172
|
+
x: spotlight.x,
|
|
173
|
+
y: spotlight.y,
|
|
174
|
+
width: spotlight.width,
|
|
175
|
+
height: spotlight.height,
|
|
176
|
+
rx: mergedTheme.spotlightBorderRadius,
|
|
177
|
+
ry: mergedTheme.spotlightBorderRadius,
|
|
178
|
+
fill: "black"
|
|
179
|
+
})]
|
|
180
|
+
})
|
|
181
|
+
}), /*#__PURE__*/_jsx(G, {
|
|
182
|
+
mask: "url(#spotlight-mask)",
|
|
183
|
+
children: /*#__PURE__*/_jsx(Rect, {
|
|
184
|
+
x: "0",
|
|
185
|
+
y: "0",
|
|
186
|
+
width: "100%",
|
|
187
|
+
height: "100%",
|
|
188
|
+
fill: mergedTheme.backdropColor,
|
|
189
|
+
fillOpacity: mergedTheme.backdropOpacity
|
|
190
|
+
})
|
|
191
|
+
})]
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
const styles = StyleSheet.create({
|
|
196
|
+
container: {
|
|
197
|
+
...StyleSheet.absoluteFillObject,
|
|
198
|
+
zIndex: 999
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
//# sourceMappingURL=GuidonOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","StyleSheet","Dimensions","TouchableWithoutFeedback","Platform","Animated","useAnimatedStyle","withTiming","Easing","Svg","Defs","Mask","Rect","G","useGuidonStore","useWaitingState","useIsFloatingStep","jsx","_jsx","jsxs","_jsxs","AnimatedSvg","createAnimatedComponent","DEFAULT_THEME","backdropColor","backdropOpacity","spotlightBorderRadius","spotlightPadding","GuidonOverlay","theme","animationDuration","onBackdropPress","isActive","state","config","currentStepIndex","targetMeasurements","isFloatingStep","waitingState","isWaiting","mergedTheme","width","screenWidth","height","screenHeight","get","currentStep","steps","currentTargetId","targetId","measurements","undefined","showFullBackdrop","spotlight","x","y","shouldShow","animatedStyle","opacity","duration","easing","inOut","ease","OS","onPress","children","View","style","styles","container","position","inset","backgroundColor","viewBox","fill","fillOpacity","clipPath","id","rx","ry","mask","create","absoluteFillObject","zIndex"],"sourceRoot":"../../../src","sources":["components/GuidonOverlay.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SACEC,UAAU,EACVC,UAAU,EACVC,wBAAwB,EACxBC,QAAQ,QACH,cAAc;AACrB,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,UAAU,EACVC,MAAM,QACD,yBAAyB;AAChC,OAAOC,GAAG,IAAIC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,CAAC,QAAQ,kBA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