@korsolutions/guidon 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -23
- package/dist/commonjs/components/GuidonOverlay.js +1 -1
- package/dist/commonjs/components/GuidonOverlay.js.map +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/store.js +25 -5
- package/dist/commonjs/store.js.map +1 -1
- package/dist/module/components/GuidonOverlay.js +1 -1
- package/dist/module/components/GuidonOverlay.js.map +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/store.js +25 -5
- package/dist/module/store.js.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +1 -1
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/store.d.ts.map +1 -1
- package/dist/typescript/commonjs/types.d.ts +97 -70
- package/dist/typescript/commonjs/types.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +1 -1
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/store.d.ts.map +1 -1
- package/dist/typescript/module/types.d.ts +97 -70
- package/dist/typescript/module/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/GuidonOverlay.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/store.ts +27 -6
- package/src/types.ts +98 -70
package/src/types.ts
CHANGED
|
@@ -221,82 +221,103 @@ export interface GuidonTargetProps {
|
|
|
221
221
|
export type GuidonTours = Record<string, GuidonConfig>;
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
225
|
-
|
|
224
|
+
* Single tour configuration for use within GuidonToursConfig
|
|
225
|
+
*/
|
|
226
|
+
export interface GuidonTourDefinition {
|
|
227
|
+
/** Unique identifier for this tour (should match the key) */
|
|
228
|
+
id: string;
|
|
229
|
+
/** Steps in the tour */
|
|
230
|
+
steps: Array<{
|
|
231
|
+
/** Unique identifier for this step */
|
|
232
|
+
id: string;
|
|
233
|
+
/**
|
|
234
|
+
* ID of the target element to highlight.
|
|
235
|
+
* Omit for floating tooltip (centered, no spotlight).
|
|
236
|
+
*/
|
|
237
|
+
targetId?: string;
|
|
238
|
+
/** Title displayed in the tooltip */
|
|
239
|
+
title: string;
|
|
240
|
+
/** Description/content displayed in the tooltip */
|
|
241
|
+
description: string;
|
|
242
|
+
/**
|
|
243
|
+
* Preferred position of the tooltip relative to target
|
|
244
|
+
* @default 'auto'
|
|
245
|
+
*/
|
|
246
|
+
tooltipPosition?: TooltipPosition;
|
|
247
|
+
/**
|
|
248
|
+
* Position for floating tooltips (when no targetId)
|
|
249
|
+
* @default 'center'
|
|
250
|
+
*/
|
|
251
|
+
floatingPosition?: FloatingPosition;
|
|
252
|
+
/** Custom React content to render in the tooltip */
|
|
253
|
+
customContent?: ReactNode;
|
|
254
|
+
/** Called when this step becomes active */
|
|
255
|
+
onStepEnter?: () => void;
|
|
256
|
+
/** Called when leaving this step */
|
|
257
|
+
onStepExit?: () => void;
|
|
258
|
+
/** Message shown while waiting for target element to mount */
|
|
259
|
+
waitingMessage?: string;
|
|
260
|
+
/**
|
|
261
|
+
* Auto-skip timeout in ms if target doesn't mount.
|
|
262
|
+
* Set to 0 to disable.
|
|
263
|
+
*/
|
|
264
|
+
waitTimeout?: number;
|
|
265
|
+
}>;
|
|
266
|
+
/**
|
|
267
|
+
* Theme customization for this specific tour.
|
|
268
|
+
* Overrides the global theme if provided.
|
|
269
|
+
*/
|
|
270
|
+
theme?: GuidonTheme;
|
|
271
|
+
/** Animation duration in milliseconds (overrides global) */
|
|
272
|
+
animationDuration?: number;
|
|
273
|
+
/** Called when the tour is completed (user finishes all steps) */
|
|
274
|
+
onComplete?: () => void;
|
|
275
|
+
/** Called when the tour is skipped */
|
|
276
|
+
onSkip?: () => void;
|
|
277
|
+
/** Called when the step changes */
|
|
278
|
+
onStepChange?: (stepIndex: number, step: GuidonStep) => void;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Configuration object for defining multiple tours with shared settings.
|
|
226
283
|
*
|
|
227
284
|
* @example
|
|
228
285
|
* ```tsx
|
|
229
|
-
* const
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* { id: "
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
286
|
+
* const config = {
|
|
287
|
+
* theme: { backdropOpacity: 0.8, primaryColor: '#007AFF' },
|
|
288
|
+
* tours: {
|
|
289
|
+
* welcome: {
|
|
290
|
+
* id: "welcome",
|
|
291
|
+
* steps: [{ id: "s1", title: "Welcome", description: "..." }],
|
|
292
|
+
* },
|
|
293
|
+
* explore: {
|
|
294
|
+
* id: "explore",
|
|
295
|
+
* steps: [...],
|
|
296
|
+
* theme: { primaryColor: '#FF0000' }, // Override for this tour
|
|
297
|
+
* },
|
|
241
298
|
* },
|
|
242
299
|
* } satisfies GuidonToursConfig;
|
|
243
300
|
*
|
|
244
|
-
* Guidon.configureTours(
|
|
301
|
+
* Guidon.configureTours(config);
|
|
245
302
|
* ```
|
|
246
303
|
*/
|
|
247
|
-
export
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Preferred position of the tooltip relative to target
|
|
266
|
-
* @default 'auto'
|
|
267
|
-
*/
|
|
268
|
-
tooltipPosition?: TooltipPosition;
|
|
269
|
-
/**
|
|
270
|
-
* Position for floating tooltips (when no targetId)
|
|
271
|
-
* @default 'center'
|
|
272
|
-
*/
|
|
273
|
-
floatingPosition?: FloatingPosition;
|
|
274
|
-
/** Custom React content to render in the tooltip */
|
|
275
|
-
customContent?: ReactNode;
|
|
276
|
-
/** Called when this step becomes active */
|
|
277
|
-
onStepEnter?: () => void;
|
|
278
|
-
/** Called when leaving this step */
|
|
279
|
-
onStepExit?: () => void;
|
|
280
|
-
/** Message shown while waiting for target element to mount */
|
|
281
|
-
waitingMessage?: string;
|
|
282
|
-
/**
|
|
283
|
-
* Auto-skip timeout in ms if target doesn't mount.
|
|
284
|
-
* Set to 0 to disable.
|
|
285
|
-
*/
|
|
286
|
-
waitTimeout?: number;
|
|
287
|
-
}>;
|
|
288
|
-
/** Theme customization for this tour */
|
|
289
|
-
theme?: GuidonTheme;
|
|
290
|
-
/** Animation duration in milliseconds */
|
|
291
|
-
animationDuration?: number;
|
|
292
|
-
/** Called when the tour is completed (user finishes all steps) */
|
|
293
|
-
onComplete?: () => void;
|
|
294
|
-
/** Called when the tour is skipped */
|
|
295
|
-
onSkip?: () => void;
|
|
296
|
-
/** Called when the step changes */
|
|
297
|
-
onStepChange?: (stepIndex: number, step: GuidonStep) => void;
|
|
298
|
-
};
|
|
299
|
-
};
|
|
304
|
+
export interface GuidonToursConfig {
|
|
305
|
+
/**
|
|
306
|
+
* Global theme applied to all tours.
|
|
307
|
+
* Individual tours can override with their own theme.
|
|
308
|
+
* @default { backdropOpacity: 0.7 }
|
|
309
|
+
*/
|
|
310
|
+
theme?: GuidonTheme;
|
|
311
|
+
/**
|
|
312
|
+
* Global animation duration applied to all tours.
|
|
313
|
+
* Individual tours can override.
|
|
314
|
+
*/
|
|
315
|
+
animationDuration?: number;
|
|
316
|
+
/**
|
|
317
|
+
* Map of tour IDs to tour configurations
|
|
318
|
+
*/
|
|
319
|
+
tours: Record<string, GuidonTourDefinition>;
|
|
320
|
+
}
|
|
300
321
|
|
|
301
322
|
/**
|
|
302
323
|
* Internal store state
|
|
@@ -304,6 +325,10 @@ export type GuidonToursConfig = {
|
|
|
304
325
|
export interface GuidonState {
|
|
305
326
|
/** Collection of all configured tours */
|
|
306
327
|
tours: GuidonTours;
|
|
328
|
+
/** Global theme applied to all tours */
|
|
329
|
+
globalTheme?: GuidonTheme;
|
|
330
|
+
/** Global animation duration applied to all tours */
|
|
331
|
+
globalAnimationDuration?: number;
|
|
307
332
|
/** ID of the currently active tour */
|
|
308
333
|
activeTourId: string | null;
|
|
309
334
|
/** Currently active guidon config (derived from tours + activeTourId, or legacy single config) */
|
|
@@ -332,8 +357,11 @@ export interface GuidonState {
|
|
|
332
357
|
export interface GuidonActions {
|
|
333
358
|
/** Configure a single guidon (legacy API, still supported) */
|
|
334
359
|
configure: (config: GuidonConfig) => void;
|
|
335
|
-
/**
|
|
336
|
-
|
|
360
|
+
/**
|
|
361
|
+
* Configure multiple named tours.
|
|
362
|
+
* Accepts either GuidonToursConfig (with global theme) or legacy GuidonTours format.
|
|
363
|
+
*/
|
|
364
|
+
configureTours: (config: GuidonToursConfig | GuidonTours) => void;
|
|
337
365
|
/** Start a tour by ID, or the legacy single config if no ID provided */
|
|
338
366
|
start: (tourId?: string) => void;
|
|
339
367
|
/** Stop the current tour without completing it */
|