@aladinbs/react-guided-tour 1.0.2 → 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/README.md +11 -1
- package/dist/components/ErrorBoundary.d.ts +31 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/Toast.d.ts +14 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/ToastProvider.d.ts +28 -0
- package/dist/components/ToastProvider.d.ts.map +1 -0
- package/dist/components/TourOverlay.d.ts +2 -1
- package/dist/components/TourOverlay.d.ts.map +1 -1
- package/dist/components/TourPopover.d.ts +2 -1
- package/dist/components/TourPopover.d.ts.map +1 -1
- package/dist/components/TourProvider.d.ts +10 -2
- package/dist/components/TourProvider.d.ts.map +1 -1
- package/dist/components/TourRunner.d.ts +2 -1
- package/dist/components/TourRunner.d.ts.map +1 -1
- package/dist/core/TourActions.d.ts +10 -0
- package/dist/core/TourActions.d.ts.map +1 -1
- package/dist/core/TourEngine.d.ts +32 -0
- package/dist/core/TourEngine.d.ts.map +1 -1
- package/dist/hooks/useErrorHandler.d.ts +26 -0
- package/dist/hooks/useErrorHandler.d.ts.map +1 -0
- package/dist/hooks/useToastErrorHandler.d.ts +15 -0
- package/dist/hooks/useToastErrorHandler.d.ts.map +1 -0
- package/dist/hooks/useTourEngine.d.ts +4 -0
- package/dist/hooks/useTourEngine.d.ts.map +1 -1
- package/dist/hooks/useTourHighlight.d.ts +4 -0
- package/dist/hooks/useTourHighlight.d.ts.map +1 -1
- package/dist/index.d.ts +136 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +418 -137
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +442 -156
- package/dist/index.js.map +1 -1
- package/dist/integrations/TabIntegration.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/positioning.d.ts +13 -0
- package/dist/utils/positioning.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -564,8 +564,18 @@ const tourConfig: TourConfig = {
|
|
|
564
564
|
|
|
565
565
|
## 🤝 Contributing
|
|
566
566
|
|
|
567
|
-
We welcome contributions!
|
|
567
|
+
We welcome contributions from the community! Whether you're fixing bugs, adding new features, improving documentation, or helping with testing, your contributions are valuable.
|
|
568
|
+
|
|
569
|
+
### Quick Start for Contributors
|
|
570
|
+
|
|
571
|
+
1. **Fork the repository** and clone it locally
|
|
572
|
+
2. **Install dependencies**: `npm install`
|
|
573
|
+
3. **Build the library**: `npm run build`
|
|
574
|
+
4. **Run the example**: `npm run example`
|
|
575
|
+
5. **Make your changes** and test thoroughly
|
|
576
|
+
6. **Submit a pull request**
|
|
568
577
|
|
|
569
578
|
## 📄 License
|
|
570
579
|
|
|
571
580
|
MIT License - see [LICENSE](LICENSE) file for details.
|
|
581
|
+
# react-guided-tour
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { Component, ReactNode } from 'react';
|
|
2
|
+
export interface ErrorInfo {
|
|
3
|
+
componentStack: string;
|
|
4
|
+
errorBoundary?: string;
|
|
5
|
+
errorBoundaryStack?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ErrorBoundaryState {
|
|
8
|
+
hasError: boolean;
|
|
9
|
+
error: Error | null;
|
|
10
|
+
errorInfo: ErrorInfo | null;
|
|
11
|
+
}
|
|
12
|
+
export interface ErrorBoundaryProps {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
fallback?: (error: Error, errorInfo: ErrorInfo, retry: () => void) => ReactNode;
|
|
15
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
16
|
+
isolate?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
19
|
+
private retryTimeoutId;
|
|
20
|
+
constructor(props: ErrorBoundaryProps);
|
|
21
|
+
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
|
|
22
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
23
|
+
componentWillUnmount(): void;
|
|
24
|
+
retry: () => void;
|
|
25
|
+
render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare function withErrorBoundary<P extends object>(Component: React.ComponentType<P>, errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>): {
|
|
28
|
+
(props: P): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=ErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC;IAChF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,aAAc,SAAQ,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAClF,OAAO,CAAC,cAAc,CAAuB;gBAEjC,KAAK,EAAE,kBAAkB;IASrC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAO1E,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAapD,oBAAoB;IAMpB,KAAK,aAMH;IAEF,MAAM;CAkEP;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACjC,kBAAkB,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC;YAExB,CAAC;;EASnC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ToastType = 'error' | 'warning' | 'success' | 'info';
|
|
3
|
+
export interface ToastProps {
|
|
4
|
+
id: string;
|
|
5
|
+
type: ToastType;
|
|
6
|
+
title: string;
|
|
7
|
+
message: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
onClose: (id: string) => void;
|
|
10
|
+
showDetails?: boolean;
|
|
11
|
+
details?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const Toast: React.NamedExoticComponent<ToastProps>;
|
|
14
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,KAAK,wCAiKhB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ToastType } from './Toast';
|
|
3
|
+
export interface ToastData {
|
|
4
|
+
id: string;
|
|
5
|
+
type: ToastType;
|
|
6
|
+
title: string;
|
|
7
|
+
message: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
showDetails?: boolean;
|
|
10
|
+
details?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ToastContextValue {
|
|
13
|
+
showToast: (toast: Omit<ToastData, 'id'>) => string;
|
|
14
|
+
showError: (title: string, message: string, details?: string) => string;
|
|
15
|
+
showWarning: (title: string, message: string) => string;
|
|
16
|
+
showSuccess: (title: string, message: string) => string;
|
|
17
|
+
showInfo: (title: string, message: string) => string;
|
|
18
|
+
removeToast: (id: string) => void;
|
|
19
|
+
clearAllToasts: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface ToastProviderProps {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
maxToasts?: number;
|
|
24
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
25
|
+
}
|
|
26
|
+
export declare const ToastProvider: React.NamedExoticComponent<ToastProviderProps>;
|
|
27
|
+
export declare function useToast(): ToastContextValue;
|
|
28
|
+
//# sourceMappingURL=ToastProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../src/components/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAoD,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3F,OAAO,EAAS,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,MAAM,CAAC;IACpD,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACxE,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IACxD,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IACxD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IACrD,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,cAAc,GAAG,aAAa,CAAC;CACtE;AAED,eAAO,MAAM,aAAa,gDAqIxB,CAAC;AAEH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export interface TourOverlayProps {
|
|
2
3
|
className?: string;
|
|
3
4
|
}
|
|
4
|
-
export declare
|
|
5
|
+
export declare const TourOverlay: React.NamedExoticComponent<TourOverlayProps>;
|
|
5
6
|
//# sourceMappingURL=TourOverlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourOverlay.d.ts","sourceRoot":"","sources":["../../src/components/TourOverlay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TourOverlay.d.ts","sourceRoot":"","sources":["../../src/components/TourOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAIpD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,8CA4EtB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export interface TourPopoverProps {
|
|
2
3
|
className?: string;
|
|
3
4
|
}
|
|
4
|
-
export declare
|
|
5
|
+
export declare const TourPopover: React.NamedExoticComponent<TourPopoverProps>;
|
|
5
6
|
//# sourceMappingURL=TourPopover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourPopover.d.ts","sourceRoot":"","sources":["../../src/components/TourPopover.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TourPopover.d.ts","sourceRoot":"","sources":["../../src/components/TourPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAOjF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,8CAgTtB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { TourConfig, TourTheme } from '../types';
|
|
3
3
|
import { UseTourEngineReturn } from '../hooks/useTourEngine';
|
|
4
4
|
interface TourContextValue extends UseTourEngineReturn {
|
|
@@ -9,7 +9,15 @@ export interface TourProviderProps {
|
|
|
9
9
|
config: TourConfig;
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Main provider component that initializes the tour system and provides context.
|
|
14
|
+
* Wraps the application with tour functionality.
|
|
15
|
+
*/
|
|
16
|
+
export declare const TourProvider: React.NamedExoticComponent<TourProviderProps>;
|
|
17
|
+
/**
|
|
18
|
+
* Hook to access tour functionality and state.
|
|
19
|
+
* Must be used within a TourProvider.
|
|
20
|
+
*/
|
|
13
21
|
export declare function useTour(): TourContextValue;
|
|
14
22
|
export {};
|
|
15
23
|
//# sourceMappingURL=TourProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourProvider.d.ts","sourceRoot":"","sources":["../../src/components/TourProvider.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"TourProvider.d.ts","sourceRoot":"","sources":["../../src/components/TourProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6B,SAAS,EAAW,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAiB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,UAAU,gBAAiB,SAAQ,mBAAmB;IACpD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;CAClB;AAID,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AA4BD;;;GAGG;AACH,eAAO,MAAM,YAAY,+CAkBvB,CAAC;AAEH;;;GAGG;AACH,wBAAgB,OAAO,IAAI,gBAAgB,CAM1C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export interface TourRunnerProps {
|
|
2
3
|
className?: string;
|
|
3
4
|
}
|
|
4
|
-
export declare
|
|
5
|
+
export declare const TourRunner: React.NamedExoticComponent<TourRunnerProps>;
|
|
5
6
|
//# sourceMappingURL=TourRunner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourRunner.d.ts","sourceRoot":"","sources":["../../src/components/TourRunner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TourRunner.d.ts","sourceRoot":"","sources":["../../src/components/TourRunner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,6CAiBrB,CAAC"}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { TourAction, Integration } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Manages and executes tour actions with pluggable integration support.
|
|
4
|
+
* Handles clicks, navigation, and custom actions through registered integrations.
|
|
5
|
+
*/
|
|
2
6
|
export declare class TourActions {
|
|
3
7
|
private integrations;
|
|
4
8
|
registerIntegration(integration: Integration): void;
|
|
5
9
|
unregisterIntegration(name: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Executes a tour action using the appropriate integration or default handler.
|
|
12
|
+
*/
|
|
6
13
|
execute(action: TourAction, element?: HTMLElement): Promise<void>;
|
|
7
14
|
private findIntegration;
|
|
15
|
+
/**
|
|
16
|
+
* Default action handler for built-in action types.
|
|
17
|
+
*/
|
|
8
18
|
private executeDefault;
|
|
9
19
|
private handleClick;
|
|
10
20
|
private handleNavigate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourActions.d.ts","sourceRoot":"","sources":["../../src/core/TourActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEnD,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAuC;IAEpD,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAInD,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"TourActions.d.ts","sourceRoot":"","sources":["../../src/core/TourActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEnD;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAuC;IAEpD,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAInD,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIhD;;OAEG;IACU,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB9E,OAAO,CAAC,eAAe;IASvB;;OAEG;YACW,cAAc;YA0Bd,WAAW;YAwBX,cAAc;IAkB5B,OAAO,CAAC,KAAK;IAIN,yBAAyB,IAAI,MAAM,EAAE;IAIrC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG7C"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { TourConfig, TourStep, TourState, TourEngineEvents, TourEventCallback } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Core tour engine that manages tour state, navigation, and lifecycle.
|
|
4
|
+
* Handles step progression, state persistence, and event emission.
|
|
5
|
+
*/
|
|
2
6
|
export declare class TourEngine {
|
|
3
7
|
private config;
|
|
4
8
|
private state;
|
|
@@ -8,11 +12,29 @@ export declare class TourEngine {
|
|
|
8
12
|
private initializeState;
|
|
9
13
|
getState(): TourState;
|
|
10
14
|
getConfig(): TourConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Starts the tour from the current step index.
|
|
17
|
+
*/
|
|
11
18
|
start(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Advances to the next step in the tour.
|
|
21
|
+
*/
|
|
12
22
|
next(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Goes back to the previous step in the tour.
|
|
25
|
+
*/
|
|
13
26
|
previous(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Navigates to a specific step by index.
|
|
29
|
+
*/
|
|
14
30
|
goToStep(index: number): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Skips the current tour and marks it as skipped.
|
|
33
|
+
*/
|
|
15
34
|
skip(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Completes the tour and marks it as finished.
|
|
37
|
+
*/
|
|
16
38
|
complete(): Promise<void>;
|
|
17
39
|
stop(): Promise<void>;
|
|
18
40
|
getCurrentStep(): TourStep | null;
|
|
@@ -20,7 +42,13 @@ export declare class TourEngine {
|
|
|
20
42
|
isLastStep(): boolean;
|
|
21
43
|
canGoNext(): boolean;
|
|
22
44
|
canGoPrevious(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Determines if the tour should be shown based on completion/skip state.
|
|
47
|
+
*/
|
|
23
48
|
shouldShowTour(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Resets tour state and clears localStorage.
|
|
51
|
+
*/
|
|
24
52
|
resetTourState(): void;
|
|
25
53
|
private waitForElement;
|
|
26
54
|
private markStepCompleted;
|
|
@@ -30,6 +58,10 @@ export declare class TourEngine {
|
|
|
30
58
|
on<K extends keyof TourEngineEvents>(event: K, callback: TourEventCallback<TourEngineEvents[K]>): void;
|
|
31
59
|
off<K extends keyof TourEngineEvents>(event: K, callback: TourEventCallback<TourEngineEvents[K]>): void;
|
|
32
60
|
private emit;
|
|
61
|
+
/**
|
|
62
|
+
* Subscribes to tour state changes.
|
|
63
|
+
* Returns an unsubscribe function.
|
|
64
|
+
*/
|
|
33
65
|
subscribe(callback: (state: TourState) => void): () => void;
|
|
34
66
|
}
|
|
35
67
|
//# sourceMappingURL=TourEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourEngine.d.ts","sourceRoot":"","sources":["../../src/core/TourEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGhG,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,SAAS,CAAwD;gBAE7D,MAAM,EAAE,UAAU;IAM9B,OAAO,CAAC,eAAe;IAmBhB,QAAQ,IAAI,SAAS;IAIrB,SAAS,IAAI,UAAU;
|
|
1
|
+
{"version":3,"file":"TourEngine.d.ts","sourceRoot":"","sources":["../../src/core/TourEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGhG;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,SAAS,CAAwD;gBAE7D,MAAM,EAAE,UAAU;IAM9B,OAAO,CAAC,eAAe;IAmBhB,QAAQ,IAAI,SAAS;IAIrB,SAAS,IAAI,UAAU;IAI9B;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BnC;;OAEG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAoClC;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAUtC;;OAEG;IACU,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyDnD;;OAEG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BlC;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBzB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,cAAc,IAAI,QAAQ,GAAG,IAAI;IAIjC,WAAW,IAAI,OAAO;IAItB,UAAU,IAAI,OAAO;IAIrB,SAAS,IAAI,OAAO;IAIpB,aAAa,IAAI,OAAO;IAI/B;;OAEG;IACI,cAAc,IAAI,OAAO;IAKhC;;OAEG;IACI,cAAc,IAAI,IAAI;YAOf,cAAc;IA6B5B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,WAAW;IA2BnB,OAAO,CAAC,QAAQ;IAKT,EAAE,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACxC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAC/C,IAAI;IAOA,GAAG,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACzC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAC/C,IAAI;IAOP,OAAO,CAAC,IAAI;IAUZ;;;OAGG;IACI,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;CAmBnE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface ErrorHandlerOptions {
|
|
2
|
+
onError?: (error: Error, context?: string) => void;
|
|
3
|
+
logErrors?: boolean;
|
|
4
|
+
retryAttempts?: number;
|
|
5
|
+
retryDelay?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface UseErrorHandlerReturn {
|
|
8
|
+
handleError: (error: Error, context?: string) => void;
|
|
9
|
+
handleAsyncError: <T>(asyncFn: () => Promise<T>, context?: string, fallback?: T) => Promise<T | undefined>;
|
|
10
|
+
wrapFunction: <T extends (...args: unknown[]) => unknown>(fn: T, context?: string) => T;
|
|
11
|
+
wrapAsyncFunction: <T extends (...args: unknown[]) => Promise<unknown>>(fn: T, context?: string) => T;
|
|
12
|
+
}
|
|
13
|
+
export declare function useErrorHandler(options?: ErrorHandlerOptions): UseErrorHandlerReturn;
|
|
14
|
+
export declare function createSafeAsyncOperation<T>(operation: () => Promise<T>, options?: {
|
|
15
|
+
context?: string;
|
|
16
|
+
fallback?: T;
|
|
17
|
+
onError?: (error: Error) => void;
|
|
18
|
+
retryAttempts?: number;
|
|
19
|
+
retryDelay?: number;
|
|
20
|
+
}): () => Promise<T | undefined>;
|
|
21
|
+
export declare function useErrorBoundary(): {
|
|
22
|
+
handleError: (error: Error, _errorInfo?: {
|
|
23
|
+
componentStack: string;
|
|
24
|
+
}) => never;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useErrorHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useErrorHandler.d.ts","sourceRoot":"","sources":["../../src/hooks/useErrorHandler.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,CAAC,CAAC,EAClB,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,CAAC,KACT,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACtD,EAAE,EAAE,CAAC,EACL,OAAO,CAAC,EAAE,MAAM,KACb,CAAC,CAAC;IACP,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EACpE,EAAE,EAAE,CAAC,EACL,OAAO,CAAC,EAAE,MAAM,KACb,CAAC,CAAC;CACR;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,mBAAwB,GAAG,qBAAqB,CAuFxF;AAGD,wBAAgB,wBAAwB,CAAC,CAAC,EACxC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CAChB,SAUW,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAiCxC;AAGD,wBAAgB,gBAAgB;yBACU,KAAK,eAAe;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;EAMvF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ToastErrorHandlerOptions {
|
|
2
|
+
onError?: (error: Error, context?: string) => void;
|
|
3
|
+
logErrors?: boolean;
|
|
4
|
+
retryAttempts?: number;
|
|
5
|
+
retryDelay?: number;
|
|
6
|
+
toastTitle?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UseToastErrorHandlerReturn {
|
|
9
|
+
handleError: (error: Error, context?: string) => void;
|
|
10
|
+
handleAsyncError: <T>(asyncFn: () => Promise<T>, context?: string, fallback?: T) => Promise<T | undefined>;
|
|
11
|
+
wrapFunction: <T extends (...args: unknown[]) => unknown>(fn: T, context?: string) => T;
|
|
12
|
+
wrapAsyncFunction: <T extends (...args: unknown[]) => Promise<unknown>>(fn: T, context?: string) => T;
|
|
13
|
+
}
|
|
14
|
+
export declare function useToastErrorHandler(options?: ToastErrorHandlerOptions): UseToastErrorHandlerReturn;
|
|
15
|
+
//# sourceMappingURL=useToastErrorHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToastErrorHandler.d.ts","sourceRoot":"","sources":["../../src/hooks/useToastErrorHandler.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,CAAC,CAAC,EAClB,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,CAAC,KACT,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACtD,EAAE,EAAE,CAAC,EACL,OAAO,CAAC,EAAE,MAAM,KACb,CAAC,CAAC;IACP,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EACpE,EAAE,EAAE,CAAC,EACL,OAAO,CAAC,EAAE,MAAM,KACb,CAAC,CAAC;CACR;AAED,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,wBAA6B,GAAG,0BAA0B,CA6FvG"}
|
|
@@ -17,5 +17,9 @@ export interface UseTourEngineReturn {
|
|
|
17
17
|
engine: TourEngine;
|
|
18
18
|
actions: TourActions;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Hook that creates and manages a tour engine instance.
|
|
22
|
+
* Provides tour control methods and state management with error handling.
|
|
23
|
+
*/
|
|
20
24
|
export declare function useTourEngine(config: TourConfig): UseTourEngineReturn;
|
|
21
25
|
//# sourceMappingURL=useTourEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTourEngine.d.ts","sourceRoot":"","sources":["../../src/hooks/useTourEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useTourEngine.d.ts","sourceRoot":"","sources":["../../src/hooks/useTourEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAG3D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,mBAAmB,CAuFrE"}
|
|
@@ -4,5 +4,9 @@ export interface UseTourHighlightReturn {
|
|
|
4
4
|
highlightStyle: React.CSSProperties;
|
|
5
5
|
isVisible: boolean;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Hook that manages element highlighting for tour steps.
|
|
9
|
+
* Finds target elements, positions highlights, and handles dynamic content.
|
|
10
|
+
*/
|
|
7
11
|
export declare function useTourHighlight(step: TourStep | null): UseTourHighlightReturn;
|
|
8
12
|
//# sourceMappingURL=useTourHighlight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTourHighlight.d.ts","sourceRoot":"","sources":["../../src/hooks/useTourHighlight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,UAAU,CAAC;AAGrD,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,sBAAsB,
|
|
1
|
+
{"version":3,"file":"useTourHighlight.d.ts","sourceRoot":"","sources":["../../src/hooks/useTourHighlight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,UAAU,CAAC;AAGrD,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,sBAAsB,CAyH9E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React$1, { ReactNode, Component } from 'react';
|
|
1
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
interface TourStep {
|
|
5
5
|
id: string;
|
|
@@ -120,6 +120,9 @@ interface TourEngineEvents {
|
|
|
120
120
|
'error': {
|
|
121
121
|
error: Error;
|
|
122
122
|
step?: TourStep;
|
|
123
|
+
tourId?: string;
|
|
124
|
+
stepIndex?: number;
|
|
125
|
+
timestamp?: string;
|
|
123
126
|
};
|
|
124
127
|
'state-change': TourState;
|
|
125
128
|
}
|
|
@@ -138,6 +141,10 @@ interface PopoverPosition {
|
|
|
138
141
|
placement: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
139
142
|
}
|
|
140
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Core tour engine that manages tour state, navigation, and lifecycle.
|
|
146
|
+
* Handles step progression, state persistence, and event emission.
|
|
147
|
+
*/
|
|
141
148
|
declare class TourEngine {
|
|
142
149
|
private config;
|
|
143
150
|
private state;
|
|
@@ -147,11 +154,29 @@ declare class TourEngine {
|
|
|
147
154
|
private initializeState;
|
|
148
155
|
getState(): TourState;
|
|
149
156
|
getConfig(): TourConfig;
|
|
157
|
+
/**
|
|
158
|
+
* Starts the tour from the current step index.
|
|
159
|
+
*/
|
|
150
160
|
start(): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Advances to the next step in the tour.
|
|
163
|
+
*/
|
|
151
164
|
next(): Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Goes back to the previous step in the tour.
|
|
167
|
+
*/
|
|
152
168
|
previous(): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Navigates to a specific step by index.
|
|
171
|
+
*/
|
|
153
172
|
goToStep(index: number): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Skips the current tour and marks it as skipped.
|
|
175
|
+
*/
|
|
154
176
|
skip(): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Completes the tour and marks it as finished.
|
|
179
|
+
*/
|
|
155
180
|
complete(): Promise<void>;
|
|
156
181
|
stop(): Promise<void>;
|
|
157
182
|
getCurrentStep(): TourStep | null;
|
|
@@ -159,7 +184,13 @@ declare class TourEngine {
|
|
|
159
184
|
isLastStep(): boolean;
|
|
160
185
|
canGoNext(): boolean;
|
|
161
186
|
canGoPrevious(): boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Determines if the tour should be shown based on completion/skip state.
|
|
189
|
+
*/
|
|
162
190
|
shouldShowTour(): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Resets tour state and clears localStorage.
|
|
193
|
+
*/
|
|
163
194
|
resetTourState(): void;
|
|
164
195
|
private waitForElement;
|
|
165
196
|
private markStepCompleted;
|
|
@@ -169,15 +200,29 @@ declare class TourEngine {
|
|
|
169
200
|
on<K extends keyof TourEngineEvents>(event: K, callback: TourEventCallback<TourEngineEvents[K]>): void;
|
|
170
201
|
off<K extends keyof TourEngineEvents>(event: K, callback: TourEventCallback<TourEngineEvents[K]>): void;
|
|
171
202
|
private emit;
|
|
203
|
+
/**
|
|
204
|
+
* Subscribes to tour state changes.
|
|
205
|
+
* Returns an unsubscribe function.
|
|
206
|
+
*/
|
|
172
207
|
subscribe(callback: (state: TourState) => void): () => void;
|
|
173
208
|
}
|
|
174
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Manages and executes tour actions with pluggable integration support.
|
|
212
|
+
* Handles clicks, navigation, and custom actions through registered integrations.
|
|
213
|
+
*/
|
|
175
214
|
declare class TourActions {
|
|
176
215
|
private integrations;
|
|
177
216
|
registerIntegration(integration: Integration): void;
|
|
178
217
|
unregisterIntegration(name: string): void;
|
|
218
|
+
/**
|
|
219
|
+
* Executes a tour action using the appropriate integration or default handler.
|
|
220
|
+
*/
|
|
179
221
|
execute(action: TourAction, element?: HTMLElement): Promise<void>;
|
|
180
222
|
private findIntegration;
|
|
223
|
+
/**
|
|
224
|
+
* Default action handler for built-in action types.
|
|
225
|
+
*/
|
|
181
226
|
private executeDefault;
|
|
182
227
|
private handleClick;
|
|
183
228
|
private handleNavigate;
|
|
@@ -215,6 +260,10 @@ interface UseTourEngineReturn {
|
|
|
215
260
|
engine: TourEngine;
|
|
216
261
|
actions: TourActions;
|
|
217
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Hook that creates and manages a tour engine instance.
|
|
265
|
+
* Provides tour control methods and state management with error handling.
|
|
266
|
+
*/
|
|
218
267
|
declare function useTourEngine(config: TourConfig): UseTourEngineReturn;
|
|
219
268
|
|
|
220
269
|
interface TourContextValue extends UseTourEngineReturn {
|
|
@@ -225,31 +274,99 @@ interface TourProviderProps {
|
|
|
225
274
|
config: TourConfig;
|
|
226
275
|
children: ReactNode;
|
|
227
276
|
}
|
|
228
|
-
|
|
277
|
+
/**
|
|
278
|
+
* Main provider component that initializes the tour system and provides context.
|
|
279
|
+
* Wraps the application with tour functionality.
|
|
280
|
+
*/
|
|
281
|
+
declare const TourProvider: React$1.NamedExoticComponent<TourProviderProps>;
|
|
282
|
+
/**
|
|
283
|
+
* Hook to access tour functionality and state.
|
|
284
|
+
* Must be used within a TourProvider.
|
|
285
|
+
*/
|
|
229
286
|
declare function useTour(): TourContextValue;
|
|
230
287
|
|
|
231
288
|
interface TourRunnerProps {
|
|
232
289
|
className?: string;
|
|
233
290
|
}
|
|
234
|
-
declare
|
|
291
|
+
declare const TourRunner: React$1.NamedExoticComponent<TourRunnerProps>;
|
|
235
292
|
|
|
236
293
|
interface TourOverlayProps {
|
|
237
294
|
className?: string;
|
|
238
295
|
}
|
|
239
|
-
declare
|
|
296
|
+
declare const TourOverlay: React$1.NamedExoticComponent<TourOverlayProps>;
|
|
240
297
|
|
|
241
298
|
interface TourPopoverProps {
|
|
242
299
|
className?: string;
|
|
243
300
|
}
|
|
244
|
-
declare
|
|
301
|
+
declare const TourPopover: React$1.NamedExoticComponent<TourPopoverProps>;
|
|
302
|
+
|
|
303
|
+
interface ErrorInfo {
|
|
304
|
+
componentStack: string;
|
|
305
|
+
errorBoundary?: string;
|
|
306
|
+
errorBoundaryStack?: string;
|
|
307
|
+
}
|
|
308
|
+
interface ErrorBoundaryState {
|
|
309
|
+
hasError: boolean;
|
|
310
|
+
error: Error | null;
|
|
311
|
+
errorInfo: ErrorInfo | null;
|
|
312
|
+
}
|
|
313
|
+
interface ErrorBoundaryProps {
|
|
314
|
+
children: ReactNode;
|
|
315
|
+
fallback?: (error: Error, errorInfo: ErrorInfo, retry: () => void) => ReactNode;
|
|
316
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
317
|
+
isolate?: boolean;
|
|
318
|
+
}
|
|
319
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
320
|
+
private retryTimeoutId;
|
|
321
|
+
constructor(props: ErrorBoundaryProps);
|
|
322
|
+
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
|
|
323
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
324
|
+
componentWillUnmount(): void;
|
|
325
|
+
retry: () => void;
|
|
326
|
+
render(): string | number | boolean | Iterable<React$1.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
327
|
+
}
|
|
328
|
+
declare function withErrorBoundary<P extends object>(Component: React$1.ComponentType<P>, errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>): {
|
|
329
|
+
(props: P): react_jsx_runtime.JSX.Element;
|
|
330
|
+
displayName: string;
|
|
331
|
+
};
|
|
245
332
|
|
|
246
333
|
interface UseTourHighlightReturn {
|
|
247
334
|
targetElement: HTMLElement | null;
|
|
248
335
|
highlightStyle: React.CSSProperties;
|
|
249
336
|
isVisible: boolean;
|
|
250
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Hook that manages element highlighting for tour steps.
|
|
340
|
+
* Finds target elements, positions highlights, and handles dynamic content.
|
|
341
|
+
*/
|
|
251
342
|
declare function useTourHighlight(step: TourStep | null): UseTourHighlightReturn;
|
|
252
343
|
|
|
344
|
+
interface ErrorHandlerOptions {
|
|
345
|
+
onError?: (error: Error, context?: string) => void;
|
|
346
|
+
logErrors?: boolean;
|
|
347
|
+
retryAttempts?: number;
|
|
348
|
+
retryDelay?: number;
|
|
349
|
+
}
|
|
350
|
+
interface UseErrorHandlerReturn {
|
|
351
|
+
handleError: (error: Error, context?: string) => void;
|
|
352
|
+
handleAsyncError: <T>(asyncFn: () => Promise<T>, context?: string, fallback?: T) => Promise<T | undefined>;
|
|
353
|
+
wrapFunction: <T extends (...args: unknown[]) => unknown>(fn: T, context?: string) => T;
|
|
354
|
+
wrapAsyncFunction: <T extends (...args: unknown[]) => Promise<unknown>>(fn: T, context?: string) => T;
|
|
355
|
+
}
|
|
356
|
+
declare function useErrorHandler(options?: ErrorHandlerOptions): UseErrorHandlerReturn;
|
|
357
|
+
declare function createSafeAsyncOperation<T>(operation: () => Promise<T>, options?: {
|
|
358
|
+
context?: string;
|
|
359
|
+
fallback?: T;
|
|
360
|
+
onError?: (error: Error) => void;
|
|
361
|
+
retryAttempts?: number;
|
|
362
|
+
retryDelay?: number;
|
|
363
|
+
}): () => Promise<T | undefined>;
|
|
364
|
+
declare function useErrorBoundary(): {
|
|
365
|
+
handleError: (error: Error, _errorInfo?: {
|
|
366
|
+
componentStack: string;
|
|
367
|
+
}) => never;
|
|
368
|
+
};
|
|
369
|
+
|
|
253
370
|
declare class TabIntegration implements Integration {
|
|
254
371
|
name: string;
|
|
255
372
|
canHandle(action: TourAction): boolean;
|
|
@@ -313,14 +430,27 @@ declare class NavigationIntegration implements Integration {
|
|
|
313
430
|
private waitForNavigation;
|
|
314
431
|
}
|
|
315
432
|
|
|
433
|
+
/**
|
|
434
|
+
* Gets the absolute position of an element relative to the document.
|
|
435
|
+
*/
|
|
316
436
|
declare function getElementPosition(element: HTMLElement): ElementPosition;
|
|
437
|
+
/**
|
|
438
|
+
* Calculates the optimal position for a popover relative to a target element.
|
|
439
|
+
* Falls back to alternative placements if the preferred placement doesn't fit.
|
|
440
|
+
*/
|
|
317
441
|
declare function calculatePopoverPosition(targetElement: HTMLElement, popoverElement: HTMLElement, preferredPlacement?: 'top' | 'bottom' | 'left' | 'right' | 'center'): PopoverPosition;
|
|
442
|
+
/**
|
|
443
|
+
* Smoothly scrolls an element into view.
|
|
444
|
+
*/
|
|
318
445
|
declare function scrollToElement(element: HTMLElement, behavior?: ScrollBehavior): void;
|
|
446
|
+
/**
|
|
447
|
+
* Checks if an element is currently visible in the viewport.
|
|
448
|
+
*/
|
|
319
449
|
declare function isElementInViewport(element: HTMLElement): boolean;
|
|
320
450
|
declare function getViewportCenter(): {
|
|
321
451
|
x: number;
|
|
322
452
|
y: number;
|
|
323
453
|
};
|
|
324
454
|
|
|
325
|
-
export { NavigationIntegration, TabIntegration, TourActions, TourEngine, TourOverlay, TourPopover, TourProvider, TourRunner, TourStorage, WizardIntegration, calculatePopoverPosition, getElementPosition, getViewportCenter, isElementInViewport, scrollToElement, useTour, useTourEngine, useTourHighlight };
|
|
455
|
+
export { ErrorBoundary, NavigationIntegration, TabIntegration, TourActions, TourEngine, TourOverlay, TourPopover, TourProvider, TourRunner, TourStorage, WizardIntegration, calculatePopoverPosition, createSafeAsyncOperation, getElementPosition, getViewportCenter, isElementInViewport, scrollToElement, useErrorBoundary, useErrorHandler, useTour, useTourEngine, useTourHighlight, withErrorBoundary };
|
|
326
456
|
export type { ElementPosition, HighlightConfig, Integration, PopoverConfig, PopoverPosition, TourAction, TourConfig, TourEngineEvents, TourEventCallback, TourState, TourStep, TourTheme, UseTourEngineReturn, UseTourHighlightReturn };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAGtG,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAG7E,cAAc,qBAAqB,CAAC;AAGpC,YAAY,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|