@robertlinde/react-tour-kit 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +838 -0
  3. package/dist/react-native-platform/components/index.d.ts +2 -0
  4. package/dist/react-native-platform/components/index.js +8 -0
  5. package/dist/react-native-platform/components/index.js.map +1 -0
  6. package/dist/react-native-platform/components/tour-overlay.d.ts +3 -0
  7. package/dist/react-native-platform/components/tour-overlay.js +83 -0
  8. package/dist/react-native-platform/components/tour-overlay.js.map +1 -0
  9. package/dist/react-native-platform/components/tour-tooltip.d.ts +3 -0
  10. package/dist/react-native-platform/components/tour-tooltip.js +138 -0
  11. package/dist/react-native-platform/components/tour-tooltip.js.map +1 -0
  12. package/dist/react-native-platform/hooks/index.d.ts +1 -0
  13. package/dist/react-native-platform/hooks/index.js +6 -0
  14. package/dist/react-native-platform/hooks/index.js.map +1 -0
  15. package/dist/react-native-platform/hooks/use-tour-target.d.ts +2 -0
  16. package/dist/react-native-platform/hooks/use-tour-target.js +16 -0
  17. package/dist/react-native-platform/hooks/use-tour-target.js.map +1 -0
  18. package/dist/react-native-platform/index.d.ts +7 -0
  19. package/dist/react-native-platform/index.js +16 -0
  20. package/dist/react-native-platform/index.js.map +1 -0
  21. package/dist/react-native-platform/platform-adapter.d.ts +2 -0
  22. package/dist/react-native-platform/platform-adapter.js +87 -0
  23. package/dist/react-native-platform/platform-adapter.js.map +1 -0
  24. package/dist/react-native-platform/target-registry.d.ts +10 -0
  25. package/dist/react-native-platform/target-registry.js +20 -0
  26. package/dist/react-native-platform/target-registry.js.map +1 -0
  27. package/dist/react-native-platform/tour-provider.d.ts +3 -0
  28. package/dist/react-native-platform/tour-provider.js +200 -0
  29. package/dist/react-native-platform/tour-provider.js.map +1 -0
  30. package/dist/react-native-platform/types/tour-provider.props.type.d.ts +10 -0
  31. package/dist/react-native-platform/types/tour-provider.props.type.js +3 -0
  32. package/dist/react-native-platform/types/tour-provider.props.type.js.map +1 -0
  33. package/dist/react-native.d.ts +8 -0
  34. package/dist/react-native.js +19 -0
  35. package/dist/react-native.js.map +1 -0
  36. package/dist/react-platform/components/index.d.ts +2 -0
  37. package/dist/react-platform/components/index.js +8 -0
  38. package/dist/react-platform/components/index.js.map +1 -0
  39. package/dist/react-platform/components/tour-overlay.d.ts +3 -0
  40. package/dist/react-platform/components/tour-overlay.js +31 -0
  41. package/dist/react-platform/components/tour-overlay.js.map +1 -0
  42. package/dist/react-platform/components/tour-tooltip.d.ts +2 -0
  43. package/dist/react-platform/components/tour-tooltip.js +126 -0
  44. package/dist/react-platform/components/tour-tooltip.js.map +1 -0
  45. package/dist/react-platform/index.d.ts +6 -0
  46. package/dist/react-platform/index.js +14 -0
  47. package/dist/react-platform/index.js.map +1 -0
  48. package/dist/react-platform/platform-adapter.d.ts +2 -0
  49. package/dist/react-platform/platform-adapter.js +95 -0
  50. package/dist/react-platform/platform-adapter.js.map +1 -0
  51. package/dist/react-platform/tour-provider.d.ts +3 -0
  52. package/dist/react-platform/tour-provider.js +207 -0
  53. package/dist/react-platform/tour-provider.js.map +1 -0
  54. package/dist/react-platform/types/tour-provider.props.type.d.ts +10 -0
  55. package/dist/react-platform/types/tour-provider.props.type.js +3 -0
  56. package/dist/react-platform/types/tour-provider.props.type.js.map +1 -0
  57. package/dist/react-platform/utils/find-visible-element.util.d.ts +1 -0
  58. package/dist/react-platform/utils/find-visible-element.util.js +14 -0
  59. package/dist/react-platform/utils/find-visible-element.util.js.map +1 -0
  60. package/dist/react-platform/utils/index.d.ts +1 -0
  61. package/dist/react-platform/utils/index.js +6 -0
  62. package/dist/react-platform/utils/index.js.map +1 -0
  63. package/dist/react.d.ts +8 -0
  64. package/dist/react.js +18 -0
  65. package/dist/react.js.map +1 -0
  66. package/dist/shared/context/index.d.ts +1 -0
  67. package/dist/shared/context/index.js +7 -0
  68. package/dist/shared/context/index.js.map +1 -0
  69. package/dist/shared/context/tour-context.d.ts +3 -0
  70. package/dist/shared/context/tour-context.js +17 -0
  71. package/dist/shared/context/tour-context.js.map +1 -0
  72. package/dist/shared/hooks/index.d.ts +1 -0
  73. package/dist/shared/hooks/index.js +6 -0
  74. package/dist/shared/hooks/index.js.map +1 -0
  75. package/dist/shared/hooks/use-tour.hook.d.ts +2 -0
  76. package/dist/shared/hooks/use-tour.hook.js +10 -0
  77. package/dist/shared/hooks/use-tour.hook.js.map +1 -0
  78. package/dist/shared/index.d.ts +5 -0
  79. package/dist/shared/index.js +14 -0
  80. package/dist/shared/index.js.map +1 -0
  81. package/dist/shared/types/index.d.ts +8 -0
  82. package/dist/shared/types/index.js +7 -0
  83. package/dist/shared/types/index.js.map +1 -0
  84. package/dist/shared/types/platform-adapter.type.d.ts +24 -0
  85. package/dist/shared/types/platform-adapter.type.js +3 -0
  86. package/dist/shared/types/platform-adapter.type.js.map +1 -0
  87. package/dist/shared/types/rect.type.d.ts +10 -0
  88. package/dist/shared/types/rect.type.js +3 -0
  89. package/dist/shared/types/rect.type.js.map +1 -0
  90. package/dist/shared/types/tour-context.type.d.ts +12 -0
  91. package/dist/shared/types/tour-context.type.js +3 -0
  92. package/dist/shared/types/tour-context.type.js.map +1 -0
  93. package/dist/shared/types/tour-overlay-props.type.d.ts +7 -0
  94. package/dist/shared/types/tour-overlay-props.type.js +3 -0
  95. package/dist/shared/types/tour-overlay-props.type.js.map +1 -0
  96. package/dist/shared/types/tour-step.type.d.ts +8 -0
  97. package/dist/shared/types/tour-step.type.js +3 -0
  98. package/dist/shared/types/tour-step.type.js.map +1 -0
  99. package/dist/shared/types/tour-theme.type.d.ts +9 -0
  100. package/dist/shared/types/tour-theme.type.js +21 -0
  101. package/dist/shared/types/tour-theme.type.js.map +1 -0
  102. package/dist/shared/types/tour-tooltip-props.type.d.ts +17 -0
  103. package/dist/shared/types/tour-tooltip-props.type.js +3 -0
  104. package/dist/shared/types/tour-tooltip-props.type.js.map +1 -0
  105. package/dist/shared/utils/calculate-tooltip-position.util.d.ts +14 -0
  106. package/dist/shared/utils/calculate-tooltip-position.util.js +56 -0
  107. package/dist/shared/utils/calculate-tooltip-position.util.js.map +1 -0
  108. package/dist/shared/utils/index.d.ts +1 -0
  109. package/dist/shared/utils/index.js +6 -0
  110. package/dist/shared/utils/index.js.map +1 -0
  111. package/package.json +88 -0
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.TourProvider = TourProvider;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const react_dom_1 = require("react-dom");
8
+ const shared_1 = require("../shared");
9
+ const tour_tooltip_1 = require("./components/tour-tooltip");
10
+ const tour_overlay_1 = require("./components/tour-overlay");
11
+ const platform_adapter_1 = require("./platform-adapter");
12
+ const defaultPlacement = 'bottom';
13
+ const scrollDelayMs = 350;
14
+ const positionRetryDelayMs = 100;
15
+ const initialPositionDelayMs = 50;
16
+ const maxPositionAttempts = 20;
17
+ const domUpdateDelayMs = 100;
18
+ function TourProvider({ children, TooltipComponent, OverlayComponent, onTourEnd, theme, platform = platform_adapter_1.webPlatformAdapter, }) {
19
+ const resolvedTheme = (0, react_1.useMemo)(() => (0, shared_1.resolveTheme)(theme), [theme]);
20
+ const [isActive, setIsActive] = (0, react_1.useState)(false);
21
+ const [currentStep, setCurrentStep] = (0, react_1.useState)(0);
22
+ const [steps, setSteps] = (0, react_1.useState)([]);
23
+ const [currentTourId, setCurrentTourId] = (0, react_1.useState)(undefined);
24
+ const [tooltipPosition, setTooltipPosition] = (0, react_1.useState)({ top: 0, left: 0 });
25
+ const [isPositioned, setIsPositioned] = (0, react_1.useState)(false);
26
+ const [highlightRect, setHighlightRect] = (0, react_1.useState)(undefined);
27
+ const tooltipRef = (0, react_1.useRef)(null);
28
+ const [positionKey, setPositionKey] = (0, react_1.useState)(0);
29
+ const [isMounted, setIsMounted] = (0, react_1.useState)(false);
30
+ const Tooltip = TooltipComponent ?? tour_tooltip_1.TourTooltip;
31
+ const Overlay = OverlayComponent ?? tour_overlay_1.TourOverlay;
32
+ (0, react_1.useEffect)(() => {
33
+ setIsMounted(true);
34
+ }, []);
35
+ const startTour = (0, react_1.useCallback)((tourSteps, tourId) => {
36
+ if (tourSteps.length > 0) {
37
+ setSteps(tourSteps);
38
+ setCurrentStep(0);
39
+ setCurrentTourId(tourId);
40
+ setIsActive(true);
41
+ }
42
+ }, []);
43
+ const endTour = (0, react_1.useCallback)(() => {
44
+ if (onTourEnd) {
45
+ onTourEnd(currentTourId);
46
+ }
47
+ setIsActive(false);
48
+ setCurrentStep(0);
49
+ setSteps([]);
50
+ setCurrentTourId(undefined);
51
+ setHighlightRect(undefined);
52
+ setTooltipPosition({ top: 0, left: 0 });
53
+ setIsPositioned(false);
54
+ }, [currentTourId, onTourEnd]);
55
+ const nextStep = (0, react_1.useCallback)(() => {
56
+ if (currentStep < steps.length - 1) {
57
+ setCurrentStep((previous) => previous + 1);
58
+ }
59
+ else {
60
+ endTour();
61
+ }
62
+ }, [currentStep, steps.length, endTour]);
63
+ const previousStep = (0, react_1.useCallback)(() => {
64
+ if (currentStep > 0) {
65
+ setCurrentStep((previous) => previous - 1);
66
+ }
67
+ }, [currentStep]);
68
+ const goToStep = (0, react_1.useCallback)((step) => {
69
+ if (step >= 0 && step < steps.length) {
70
+ setCurrentStep(step);
71
+ }
72
+ }, [steps.length]);
73
+ const updatePositions = (0, react_1.useCallback)(() => {
74
+ if (!isActive || steps.length === 0) {
75
+ return;
76
+ }
77
+ const currentTourStep = steps[currentStep];
78
+ if (!currentTourStep) {
79
+ return;
80
+ }
81
+ void (async () => {
82
+ const rect = await platform.measureElement(currentTourStep.target);
83
+ if (!rect) {
84
+ if (currentStep < steps.length - 1) {
85
+ setCurrentStep((previous) => previous + 1);
86
+ }
87
+ else {
88
+ endTour();
89
+ }
90
+ return;
91
+ }
92
+ setHighlightRect(rect);
93
+ const placement = currentTourStep.placement ?? defaultPlacement;
94
+ const tooltipDimensions = platform.measureTooltip(tooltipRef);
95
+ const viewportDimensions = platform.getViewportDimensions();
96
+ const position = (0, shared_1.calculateTooltipPosition)(rect, placement, tooltipDimensions, viewportDimensions);
97
+ setTooltipPosition(position);
98
+ setIsPositioned(true);
99
+ })();
100
+ }, [isActive, currentStep, steps, endTour, platform]);
101
+ (0, react_1.useEffect)(() => {
102
+ if (!isActive || steps.length === 0) {
103
+ return;
104
+ }
105
+ const currentTourStep = steps[currentStep];
106
+ if (!currentTourStep) {
107
+ return;
108
+ }
109
+ const runStep = async () => {
110
+ if (currentTourStep.onBeforeStep) {
111
+ await currentTourStep.onBeforeStep();
112
+ await new Promise((resolve) => {
113
+ setTimeout(resolve, domUpdateDelayMs);
114
+ });
115
+ }
116
+ const rect = await platform.measureElement(currentTourStep.target);
117
+ if (!rect) {
118
+ if (currentStep < steps.length - 1) {
119
+ setCurrentStep((previous) => previous + 1);
120
+ }
121
+ else {
122
+ endTour();
123
+ }
124
+ return;
125
+ }
126
+ setHighlightRect(rect);
127
+ setIsPositioned(false);
128
+ await platform.scrollToElement(currentTourStep.target);
129
+ setTimeout(() => {
130
+ setPositionKey((k) => k + 1);
131
+ }, scrollDelayMs);
132
+ };
133
+ void runStep();
134
+ }, [isActive, currentStep, steps, endTour, platform]);
135
+ (0, react_1.useEffect)(() => {
136
+ if (!isActive || !highlightRect || steps.length === 0) {
137
+ return;
138
+ }
139
+ const currentTourStep = steps[currentStep];
140
+ if (!currentTourStep) {
141
+ return;
142
+ }
143
+ let attempts = 0;
144
+ let timeoutId;
145
+ let animationFrameId;
146
+ const tryPosition = () => {
147
+ attempts++;
148
+ animationFrameId = platform.scheduleFrame(() => {
149
+ void (async () => {
150
+ const rect = await platform.measureElement(currentTourStep.target);
151
+ if (!rect || rect.width === 0 || rect.height === 0) {
152
+ if (attempts < maxPositionAttempts) {
153
+ timeoutId = setTimeout(tryPosition, positionRetryDelayMs);
154
+ }
155
+ return;
156
+ }
157
+ setHighlightRect(rect);
158
+ const placement = currentTourStep.placement ?? defaultPlacement;
159
+ const tooltipDimensions = platform.measureTooltip(tooltipRef);
160
+ const viewportDimensions = platform.getViewportDimensions();
161
+ const position = (0, shared_1.calculateTooltipPosition)(rect, placement, tooltipDimensions, viewportDimensions);
162
+ setTooltipPosition(position);
163
+ setIsPositioned(true);
164
+ })();
165
+ });
166
+ };
167
+ timeoutId = setTimeout(tryPosition, initialPositionDelayMs);
168
+ return () => {
169
+ clearTimeout(timeoutId);
170
+ if (animationFrameId) {
171
+ platform.cancelFrame(animationFrameId);
172
+ }
173
+ };
174
+ }, [isActive, currentStep, steps, highlightRect, positionKey, platform]);
175
+ (0, react_1.useEffect)(() => {
176
+ if (!isActive) {
177
+ return;
178
+ }
179
+ return platform.subscribeToKeyboard({
180
+ onEscape: endTour,
181
+ onNext: nextStep,
182
+ onPrev: previousStep,
183
+ });
184
+ }, [isActive, endTour, nextStep, previousStep, platform]);
185
+ (0, react_1.useEffect)(() => {
186
+ if (!isActive) {
187
+ return;
188
+ }
189
+ return platform.subscribeToLayout(updatePositions);
190
+ }, [isActive, updatePositions, platform]);
191
+ const currentTourStep = steps[currentStep];
192
+ const contextValue = (0, react_1.useMemo)(() => ({
193
+ isActive,
194
+ currentStep,
195
+ steps,
196
+ currentTourId,
197
+ startTour,
198
+ endTour,
199
+ nextStep,
200
+ prevStep: previousStep,
201
+ goToStep,
202
+ }), [isActive, currentStep, steps, currentTourId, startTour, endTour, nextStep, previousStep, goToStep]);
203
+ return ((0, jsx_runtime_1.jsxs)(shared_1.TourContext, { value: contextValue, children: [children, isActive && highlightRect && isMounted
204
+ ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Overlay, { highlightRect: highlightRect, theme: resolvedTheme, onClose: endTour }), currentTourStep ? ((0, jsx_runtime_1.jsx)(Tooltip, { ref: tooltipRef, content: currentTourStep.content, currentStep: currentStep, isPositioned: isPositioned, position: tooltipPosition, theme: resolvedTheme, title: currentTourStep.title, totalSteps: steps.length, onClose: endTour, onGoToStep: goToStep, onNext: nextStep, onPrev: previousStep })) : null] }), document.body)
205
+ : null] }));
206
+ }
207
+ //# sourceMappingURL=tour-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-provider.js","sourceRoot":"","sources":["../../src/react-platform/tour-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAwBb,oCAgRC;;AAtSD,iCAAkF;AAClF,yCAAuC;AACvC,sCAOmB;AACnB,4DAA4E;AAC5E,4DAA4E;AAC5E,yDAAsD;AAGtD,MAAM,gBAAgB,GAAG,QAAiB,CAAC;AAC3C,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,SAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,QAAQ,GAAG,qCAAkB,GACX;IAClB,MAAM,aAAa,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,qBAAY,EAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAClE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAa,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAqB,SAAS,CAAC,CAAC;IAClF,MAAM,CAAC,e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AQ;QACR,QAAQ,EAAE,YAAY;QACtB,QAAQ;KACT,CAAC,EACF,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,CAAC,CACpG,CAAC;IAEF,OAAO,CACL,wBAAC,oBAAW,IAAC,KAAK,EAAE,YAAY,aAC7B,QAAQ,EAER,QAAQ,IAAI,aAAa,IAAI,SAAS;gBACrC,CAAC,CAAC,IAAA,wBAAY,EACV,6DACE,uBAAC,OAAO,IAAC,aAAa,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAI,EAEhF,eAAe,CAAC,CAAC,CAAC,CACjB,uBAAC,OAAO,IACN,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,eAAe,CAAC,OAAO,EAChC,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,eAAe,CAAC,KAAK,EAC5B,UAAU,EAAE,KAAK,CAAC,MAAM,EACxB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,QAAQ,EACpB,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,YAAY,GACpB,CACH,CAAC,CAAC,CAAC,IAAI,IACP,EACH,QAAQ,CAAC,IAAI,CACd;gBACH,CAAC,CAAC,IAAI,IACI,CACf,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type ComponentType, type ForwardRefExoticComponent, type ReactNode, type RefAttributes } from 'react';
2
+ import { type PlatformAdapter, type TourOverlayProps, type TourTheme, type TourTooltipProps } from 'src/shared';
3
+ export type TourProviderProps = {
4
+ readonly children: ReactNode;
5
+ readonly TooltipComponent?: ForwardRefExoticComponent<TourTooltipProps & RefAttributes<HTMLDivElement>>;
6
+ readonly OverlayComponent?: ComponentType<TourOverlayProps>;
7
+ readonly onTourEnd?: (tourId: string | undefined) => void;
8
+ readonly theme?: TourTheme;
9
+ readonly platform?: PlatformAdapter;
10
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=tour-provider.props.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-provider.props.type.js","sourceRoot":"","sources":["../../../src/react-platform/types/tour-provider.props.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export declare function findVisibleElement(selector: string): Element | undefined;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findVisibleElement = findVisibleElement;
4
+ function findVisibleElement(selector) {
5
+ const allMatches = document.querySelectorAll(selector);
6
+ for (const element of allMatches) {
7
+ const rect = element.getBoundingClientRect();
8
+ if (rect.width > 0 && rect.height > 0) {
9
+ return element;
10
+ }
11
+ }
12
+ return allMatches[0] ?? null;
13
+ }
14
+ //# sourceMappingURL=find-visible-element.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-visible-element.util.js","sourceRoot":"","sources":["../../../src/react-platform/utils/find-visible-element.util.ts"],"names":[],"mappings":";;AAIA,gDAWC;AAXD,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAEvD,KAAK,MAAM,OAAO,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtC,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC/B,CAAC"}
@@ -0,0 +1 @@
1
+ export { findVisibleElement } from './find-visible-element.util';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findVisibleElement = void 0;
4
+ var find_visible_element_util_1 = require("./find-visible-element.util");
5
+ Object.defineProperty(exports, "findVisibleElement", { enumerable: true, get: function () { return find_visible_element_util_1.findVisibleElement; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react-platform/utils/index.ts"],"names":[],"mappings":";;;AAAA,yEAA+D;AAAvD,+HAAA,kBAAkB,OAAA"}
@@ -0,0 +1,8 @@
1
+ export { TourProvider, type TourProviderProps } from './react-platform';
2
+ export { TourContext, useTour } from './shared';
3
+ export { TourOverlay, TourTooltip } from './react-platform';
4
+ export type { TourStep, TourContextType, TourTooltipProps, TourOverlayProps, TourTheme } from './shared';
5
+ export type { Rect, TourTarget } from './shared';
6
+ export { calculateTooltipPosition } from './shared';
7
+ export { findVisibleElement } from './react-platform';
8
+ export { webPlatformAdapter } from './react-platform';
package/dist/react.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webPlatformAdapter = exports.findVisibleElement = exports.calculateTooltipPosition = exports.TourTooltip = exports.TourOverlay = exports.useTour = exports.TourContext = exports.TourProvider = void 0;
4
+ var react_platform_1 = require("./react-platform");
5
+ Object.defineProperty(exports, "TourProvider", { enumerable: true, get: function () { return react_platform_1.TourProvider; } });
6
+ var shared_1 = require("./shared");
7
+ Object.defineProperty(exports, "TourContext", { enumerable: true, get: function () { return shared_1.TourContext; } });
8
+ Object.defineProperty(exports, "useTour", { enumerable: true, get: function () { return shared_1.useTour; } });
9
+ var react_platform_2 = require("./react-platform");
10
+ Object.defineProperty(exports, "TourOverlay", { enumerable: true, get: function () { return react_platform_2.TourOverlay; } });
11
+ Object.defineProperty(exports, "TourTooltip", { enumerable: true, get: function () { return react_platform_2.TourTooltip; } });
12
+ var shared_2 = require("./shared");
13
+ Object.defineProperty(exports, "calculateTooltipPosition", { enumerable: true, get: function () { return shared_2.calculateTooltipPosition; } });
14
+ var react_platform_3 = require("./react-platform");
15
+ Object.defineProperty(exports, "findVisibleElement", { enumerable: true, get: function () { return react_platform_3.findVisibleElement; } });
16
+ var react_platform_4 = require("./react-platform");
17
+ Object.defineProperty(exports, "webPlatformAdapter", { enumerable: true, get: function () { return react_platform_4.webPlatformAdapter; } });
18
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":";;;AAKA,mDAAsE;AAA9D,8GAAA,YAAY,OAAA;AAEpB,mCAA8C;AAAtC,qGAAA,WAAW,OAAA;AAAE,iGAAA,OAAO,OAAA;AAI5B,mDAA0D;AAAlD,6GAAA,WAAW,OAAA;AAAE,6GAAA,WAAW,OAAA;AAUhC,mCAAkD;AAA1C,kHAAA,wBAAwB,OAAA;AAEhC,mDAAoD;AAA5C,oHAAA,kBAAkB,OAAA;AAI1B,mDAAoD;AAA5C,oHAAA,kBAAkB,OAAA"}
@@ -0,0 +1 @@
1
+ export { TourContext, defaultTourContext } from './tour-context';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultTourContext = exports.TourContext = void 0;
4
+ var tour_context_1 = require("./tour-context");
5
+ Object.defineProperty(exports, "TourContext", { enumerable: true, get: function () { return tour_context_1.TourContext; } });
6
+ Object.defineProperty(exports, "defaultTourContext", { enumerable: true, get: function () { return tour_context_1.defaultTourContext; } });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/context/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+D;AAAvD,2GAAA,WAAW,OAAA;AAAE,kHAAA,kBAAkB,OAAA"}
@@ -0,0 +1,3 @@
1
+ import { type TourContextType } from '../types';
2
+ export declare const defaultTourContext: TourContextType;
3
+ export declare const TourContext: import("react").Context<TourContextType>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TourContext = exports.defaultTourContext = void 0;
4
+ const react_1 = require("react");
5
+ exports.defaultTourContext = {
6
+ isActive: false,
7
+ currentStep: 0,
8
+ steps: [],
9
+ currentTourId: undefined,
10
+ startTour() { },
11
+ endTour() { },
12
+ nextStep() { },
13
+ prevStep() { },
14
+ goToStep() { },
15
+ };
16
+ exports.TourContext = (0, react_1.createContext)(exports.defaultTourContext);
17
+ //# sourceMappingURL=tour-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-context.js","sourceRoot":"","sources":["../../../src/shared/context/tour-context.ts"],"names":[],"mappings":";;;AAAA,iCAAoC;AAOvB,QAAA,kBAAkB,GAAoB;IACjD,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,CAAC;IACd,KAAK,EAAE,EAAE;IACT,aAAa,EAAE,SAAS;IAExB,SAAS,KAAI,CAAC;IAEd,OAAO,KAAI,CAAC;IAEZ,QAAQ,KAAI,CAAC;IAEb,QAAQ,KAAI,CAAC;IAEb,QAAQ,KAAI,CAAC;CACd,CAAC;AAOW,QAAA,WAAW,GAAG,IAAA,qBAAa,EAAkB,0BAAkB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export { useTour } from './use-tour.hook';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTour = void 0;
4
+ var use_tour_hook_1 = require("./use-tour.hook");
5
+ Object.defineProperty(exports, "useTour", { enumerable: true, get: function () { return use_tour_hook_1.useTour; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/hooks/index.ts"],"names":[],"mappings":";;;AAAA,iDAAwC;AAAhC,wGAAA,OAAO,OAAA"}
@@ -0,0 +1,2 @@
1
+ import { type TourContextType } from '../types';
2
+ export declare function useTour(): TourContextType;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useTour = useTour;
5
+ const react_1 = require("react");
6
+ const context_1 = require("../context");
7
+ function useTour() {
8
+ return (0, react_1.use)(context_1.TourContext);
9
+ }
10
+ //# sourceMappingURL=use-tour.hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-tour.hook.js","sourceRoot":"","sources":["../../../src/shared/hooks/use-tour.hook.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAMb,0BAEC;AAND,iCAA0B;AAC1B,wCAAuC;AAGvC,SAAgB,OAAO;IACrB,OAAO,IAAA,WAAG,EAAC,qBAAW,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { Rect, TourTarget, PlatformAdapter, KeyboardHandlers, TourTheme, TourStep, TourContextType, TourOverlayProps, TourTooltipProps, } from './types';
2
+ export { defaultTheme, resolveTheme } from './types';
3
+ export { TourContext, defaultTourContext } from './context';
4
+ export { useTour } from './hooks';
5
+ export { calculateTooltipPosition } from './utils';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateTooltipPosition = exports.useTour = exports.defaultTourContext = exports.TourContext = exports.resolveTheme = exports.defaultTheme = void 0;
4
+ var types_1 = require("./types");
5
+ Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return types_1.defaultTheme; } });
6
+ Object.defineProperty(exports, "resolveTheme", { enumerable: true, get: function () { return types_1.resolveTheme; } });
7
+ var context_1 = require("./context");
8
+ Object.defineProperty(exports, "TourContext", { enumerable: true, get: function () { return context_1.TourContext; } });
9
+ Object.defineProperty(exports, "defaultTourContext", { enumerable: true, get: function () { return context_1.defaultTourContext; } });
10
+ var hooks_1 = require("./hooks");
11
+ Object.defineProperty(exports, "useTour", { enumerable: true, get: function () { return hooks_1.useTour; } });
12
+ var utils_1 = require("./utils");
13
+ Object.defineProperty(exports, "calculateTooltipPosition", { enumerable: true, get: function () { return utils_1.calculateTooltipPosition; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;AAcA,iCAAmD;AAA3C,qGAAA,YAAY,OAAA;AAAE,qGAAA,YAAY,OAAA;AAIlC,qCAA0D;AAAlD,sGAAA,WAAW,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAIvC,iCAAgC;AAAxB,gGAAA,OAAO,OAAA;AAIf,iCAAiD;AAAzC,iHAAA,wBAAwB,OAAA"}
@@ -0,0 +1,8 @@
1
+ export type { Rect, TourTarget } from './rect.type';
2
+ export type { PlatformAdapter, KeyboardHandlers } from './platform-adapter.type';
3
+ export type { TourTheme } from './tour-theme.type';
4
+ export { defaultTheme, resolveTheme } from './tour-theme.type';
5
+ export type { TourStep } from './tour-step.type';
6
+ export type { TourContextType } from './tour-context.type';
7
+ export type { TourOverlayProps } from './tour-overlay-props.type';
8
+ export type { TourTooltipProps } from './tour-tooltip-props.type';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveTheme = exports.defaultTheme = void 0;
4
+ var tour_theme_type_1 = require("./tour-theme.type");
5
+ Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return tour_theme_type_1.defaultTheme; } });
6
+ Object.defineProperty(exports, "resolveTheme", { enumerable: true, get: function () { return tour_theme_type_1.resolveTheme; } });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/types/index.ts"],"names":[],"mappings":";;;AAGA,qDAA6D;AAArD,+GAAA,YAAY,OAAA;AAAE,+GAAA,YAAY,OAAA"}
@@ -0,0 +1,24 @@
1
+ import { type RefObject } from 'react';
2
+ import { type Rect, type TourTarget } from './rect.type';
3
+ export type KeyboardHandlers = {
4
+ readonly onEscape: () => void;
5
+ readonly onNext: () => void;
6
+ readonly onPrev: () => void;
7
+ };
8
+ export type PlatformAdapter = {
9
+ readonly measureElement: (target: TourTarget) => Promise<Rect | undefined>;
10
+ readonly measureTooltip: (ref: RefObject<unknown>) => {
11
+ width: number;
12
+ height: number;
13
+ };
14
+ readonly getViewportDimensions: () => {
15
+ width: number;
16
+ height: number;
17
+ };
18
+ readonly scrollToElement: (target: TourTarget) => Promise<void>;
19
+ readonly subscribeToKeyboard: (handlers: KeyboardHandlers) => () => void;
20
+ readonly subscribeToLayout: (callback: () => void) => () => void;
21
+ readonly scheduleFrame: (callback: () => void) => number;
22
+ readonly cancelFrame: (id: number) => void;
23
+ readonly findElement: (target: TourTarget) => unknown | undefined;
24
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=platform-adapter.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-adapter.type.js","sourceRoot":"","sources":["../../../src/shared/types/platform-adapter.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { type RefObject } from 'react';
2
+ export type Rect = {
3
+ readonly top: number;
4
+ readonly left: number;
5
+ readonly width: number;
6
+ readonly height: number;
7
+ readonly bottom: number;
8
+ readonly right: number;
9
+ };
10
+ export type TourTarget = string | RefObject<unknown>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=rect.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rect.type.js","sourceRoot":"","sources":["../../../src/shared/types/rect.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { type TourStep } from './tour-step.type';
2
+ export type TourContextType = {
3
+ isActive: boolean;
4
+ currentStep: number;
5
+ steps: TourStep[];
6
+ currentTourId: string | undefined;
7
+ startTour: (steps: TourStep[], tourId?: string) => void;
8
+ endTour: () => void;
9
+ nextStep: () => void;
10
+ prevStep: () => void;
11
+ goToStep: (step: number) => void;
12
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=tour-context.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-context.type.js","sourceRoot":"","sources":["../../../src/shared/types/tour-context.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { type Rect } from './rect.type';
2
+ import { type TourTheme } from './tour-theme.type';
3
+ export type TourOverlayProps = {
4
+ readonly highlightRect: Rect;
5
+ readonly onClose: () => void;
6
+ readonly theme: Required<TourTheme>;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=tour-overlay-props.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-overlay-props.type.js","sourceRoot":"","sources":["../../../src/shared/types/tour-overlay-props.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { type TourTarget } from './rect.type';
2
+ export type TourStep = {
3
+ target: TourTarget;
4
+ title: string;
5
+ content: string;
6
+ placement?: 'top' | 'bottom' | 'left' | 'right';
7
+ onBeforeStep?: () => void | Promise<void>;
8
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=tour-step.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-step.type.js","sourceRoot":"","sources":["../../../src/shared/types/tour-step.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export type TourTheme = {
2
+ readonly primaryColor?: string;
3
+ readonly tooltipBackground?: string;
4
+ readonly titleColor?: string;
5
+ readonly contentColor?: string;
6
+ readonly overlayColor?: string;
7
+ };
8
+ export declare const defaultTheme: Required<TourTheme>;
9
+ export declare function resolveTheme(theme?: TourTheme): Required<TourTheme>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultTheme = void 0;
4
+ exports.resolveTheme = resolveTheme;
5
+ exports.defaultTheme = {
6
+ primaryColor: '#3b82f6',
7
+ tooltipBackground: '#ffffff',
8
+ titleColor: '#1f2937',
9
+ contentColor: '#4b5563',
10
+ overlayColor: 'rgba(0, 0, 0, 0.5)',
11
+ };
12
+ function resolveTheme(theme) {
13
+ if (!theme) {
14
+ return exports.defaultTheme;
15
+ }
16
+ return {
17
+ ...exports.defaultTheme,
18
+ ...theme,
19
+ };
20
+ }
21
+ //# sourceMappingURL=tour-theme.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-theme.type.js","sourceRoot":"","sources":["../../../src/shared/types/tour-theme.type.ts"],"names":[],"mappings":";;;AAiDA,oCASC;AApBY,QAAA,YAAY,GAAwB;IAC/C,YAAY,EAAE,SAAS;IACvB,iBAAiB,EAAE,SAAS;IAC5B,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,oBAAoB;CACnC,CAAC;AAKF,SAAgB,YAAY,CAAC,KAAiB;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,oBAAY,CAAC;IACtB,CAAC;IAED,OAAO;QACL,GAAG,oBAAY;QACf,GAAG,KAAK;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type TourTheme } from './tour-theme.type';
2
+ export type TourTooltipProps = {
3
+ readonly title: string;
4
+ readonly content: string;
5
+ readonly currentStep: number;
6
+ readonly totalSteps: number;
7
+ readonly position: {
8
+ top: number;
9
+ left: number;
10
+ };
11
+ readonly isPositioned: boolean;
12
+ readonly onClose: () => void;
13
+ readonly onNext: () => void;
14
+ readonly onPrev: () => void;
15
+ readonly onGoToStep: (step: number) => void;
16
+ readonly theme: Required<TourTheme>;
17
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=tour-tooltip-props.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tour-tooltip-props.type.js","sourceRoot":"","sources":["../../../src/shared/types/tour-tooltip-props.type.ts"],"names":[],"mappings":""}