@syntrologie/adapt-overlays 2.16.0 → 2.17.0

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 (226) hide show
  1. package/dist/chunk-VHAA22YE.js +14 -0
  2. package/dist/chunk-VHAA22YE.js.map +7 -0
  3. package/dist/runtime.d.ts +2 -1
  4. package/dist/runtime.d.ts.map +1 -1
  5. package/dist/runtime.js +2596 -354
  6. package/dist/runtime.js.map +7 -0
  7. package/dist/schema.d.ts +90 -21
  8. package/dist/schema.d.ts.map +1 -1
  9. package/dist/schema.js +440 -151
  10. package/dist/schema.js.map +7 -0
  11. package/dist/types.d.ts +1 -1
  12. package/dist/types.d.ts.map +1 -1
  13. package/package.json +5 -22
  14. package/dist/WorkflowTracker.d.ts +0 -10
  15. package/dist/WorkflowTracker.d.ts.map +0 -1
  16. package/dist/WorkflowTracker.js +0 -19
  17. package/dist/WorkflowWidget.d.ts +0 -70
  18. package/dist/WorkflowWidget.d.ts.map +0 -1
  19. package/dist/WorkflowWidget.js +0 -330
  20. package/dist/WorkflowWidgetLit.js +0 -617
  21. package/dist/cdn.d.ts +0 -35
  22. package/dist/cdn.d.ts.map +0 -1
  23. package/dist/cdn.js +0 -39
  24. package/dist/celebrations/__tests__/engine.test.js +0 -130
  25. package/dist/celebrations/__tests__/executor.test.js +0 -102
  26. package/dist/celebrations/__tests__/reduced-motion.test.js +0 -97
  27. package/dist/celebrations/effects/__tests__/confetti.test.js +0 -89
  28. package/dist/celebrations/effects/__tests__/emoji-rain.test.js +0 -88
  29. package/dist/celebrations/effects/__tests__/fireworks.test.js +0 -87
  30. package/dist/celebrations/effects/__tests__/sparkles.test.js +0 -79
  31. package/dist/celebrations/effects/confetti.js +0 -80
  32. package/dist/celebrations/effects/emoji-rain.js +0 -73
  33. package/dist/celebrations/effects/fireworks.js +0 -69
  34. package/dist/celebrations/effects/sparkles.js +0 -83
  35. package/dist/celebrations/engine.js +0 -93
  36. package/dist/celebrations/index.js +0 -73
  37. package/dist/celebrations/types.js +0 -1
  38. package/dist/editor.d.ts +0 -27
  39. package/dist/editor.d.ts.map +0 -1
  40. package/dist/editor.js +0 -22
  41. package/dist/executors/tour.js +0 -335
  42. package/dist/highlight.js +0 -180
  43. package/dist/modal.js +0 -218
  44. package/dist/overlay-editor-state.d.ts +0 -41
  45. package/dist/overlay-editor-state.d.ts.map +0 -1
  46. package/dist/overlay-editor-state.js +0 -131
  47. package/dist/overlay-editor-ui.d.ts +0 -9
  48. package/dist/overlay-editor-ui.d.ts.map +0 -1
  49. package/dist/overlay-editor-ui.js +0 -306
  50. package/dist/runtime-lit.d.ts +0 -94
  51. package/dist/runtime-lit.d.ts.map +0 -1
  52. package/dist/runtime-lit.js +0 -402
  53. package/dist/sanitizer.js +0 -84
  54. package/dist/summarize.js +0 -86
  55. package/dist/tooltip.js +0 -279
  56. package/dist/tour-types.js +0 -7
  57. package/dist/types.js +0 -7
  58. package/dist/workflow-types.js +0 -1
  59. package/node_modules/@syntro/design-system/README.md +0 -335
  60. package/node_modules/@syntro/design-system/dist/assets/syntrologie-logo.svg +0 -21
  61. package/node_modules/@syntro/design-system/dist/assets/syntrologie-logomark.svg +0 -10
  62. package/node_modules/@syntro/design-system/dist/index.d.ts +0 -8
  63. package/node_modules/@syntro/design-system/dist/index.d.ts.map +0 -1
  64. package/node_modules/@syntro/design-system/dist/index.js +0 -7
  65. package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts +0 -19
  66. package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts.map +0 -1
  67. package/node_modules/@syntro/design-system/dist/tailwind-preset.js +0 -455
  68. package/node_modules/@syntro/design-system/dist/tokens/colors.css +0 -464
  69. package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts +0 -874
  70. package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts.map +0 -1
  71. package/node_modules/@syntro/design-system/dist/tokens/colors.js +0 -564
  72. package/node_modules/@syntro/design-system/dist/tokens/effects.css +0 -43
  73. package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts +0 -139
  74. package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts.map +0 -1
  75. package/node_modules/@syntro/design-system/dist/tokens/effects.js +0 -121
  76. package/node_modules/@syntro/design-system/dist/tokens/index.d.ts +0 -12
  77. package/node_modules/@syntro/design-system/dist/tokens/index.d.ts.map +0 -1
  78. package/node_modules/@syntro/design-system/dist/tokens/index.js +0 -11
  79. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts +0 -93
  80. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts.map +0 -1
  81. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.js +0 -72
  82. package/node_modules/@syntro/design-system/package.json +0 -55
  83. package/node_modules/@syntro/design-system/src/assets/syntrologie-logo.svg +0 -21
  84. package/node_modules/@syntro/design-system/src/assets/syntrologie-logomark.svg +0 -10
  85. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +0 -2
  86. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +0 -1
  87. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +0 -3
  88. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +0 -34
  89. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +0 -1
  90. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +0 -161
  91. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts +0 -84
  92. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts.map +0 -1
  93. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.js +0 -323
  94. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +0 -7
  95. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +0 -1
  96. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +0 -9
  97. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts +0 -25
  98. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts.map +0 -1
  99. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.js +0 -55
  100. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +0 -23
  101. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +0 -1
  102. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +0 -40
  103. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts +0 -33
  104. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts.map +0 -1
  105. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.js +0 -118
  106. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +0 -7
  107. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +0 -1
  108. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +0 -22
  109. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts +0 -32
  110. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts.map +0 -1
  111. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.js +0 -68
  112. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +0 -8
  113. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +0 -1
  114. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +0 -9
  115. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts +0 -34
  116. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts.map +0 -1
  117. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.js +0 -57
  118. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +0 -7
  119. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +0 -1
  120. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +0 -4
  121. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts +0 -13
  122. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts.map +0 -1
  123. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.js +0 -31
  124. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +0 -7
  125. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +0 -1
  126. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +0 -4
  127. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts +0 -7
  128. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts.map +0 -1
  129. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.js +0 -15
  130. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +0 -13
  131. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +0 -1
  132. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +0 -15
  133. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts +0 -36
  134. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts.map +0 -1
  135. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.js +0 -102
  136. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +0 -7
  137. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +0 -1
  138. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +0 -4
  139. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts +0 -20
  140. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts.map +0 -1
  141. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.js +0 -48
  142. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +0 -9
  143. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +0 -1
  144. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +0 -4
  145. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts +0 -16
  146. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts.map +0 -1
  147. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.js +0 -25
  148. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +0 -8
  149. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +0 -1
  150. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +0 -8
  151. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts +0 -66
  152. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts.map +0 -1
  153. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.js +0 -87
  154. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +0 -7
  155. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +0 -1
  156. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +0 -4
  157. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts +0 -7
  158. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts.map +0 -1
  159. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.js +0 -15
  160. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +0 -25
  161. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +0 -1
  162. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +0 -390
  163. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts +0 -66
  164. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts.map +0 -1
  165. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.js +0 -528
  166. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +0 -8
  167. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +0 -1
  168. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +0 -8
  169. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts +0 -41
  170. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts.map +0 -1
  171. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.js +0 -63
  172. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +0 -8
  173. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +0 -1
  174. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +0 -17
  175. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts +0 -55
  176. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts.map +0 -1
  177. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.js +0 -92
  178. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +0 -32
  179. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +0 -1
  180. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +0 -85
  181. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts +0 -90
  182. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts.map +0 -1
  183. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.js +0 -242
  184. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +0 -6
  185. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +0 -1
  186. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +0 -4
  187. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts +0 -12
  188. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts.map +0 -1
  189. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.js +0 -21
  190. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +0 -8
  191. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +0 -1
  192. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +0 -5
  193. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts +0 -21
  194. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts.map +0 -1
  195. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.js +0 -33
  196. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +0 -12
  197. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +0 -1
  198. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +0 -40
  199. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts +0 -28
  200. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts.map +0 -1
  201. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.js +0 -121
  202. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts +0 -110
  203. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts.map +0 -1
  204. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.js +0 -481
  205. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +0 -26
  206. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +0 -1
  207. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +0 -202
  208. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +0 -8
  209. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +0 -1
  210. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +0 -46
  211. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +0 -24
  212. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +0 -1
  213. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +0 -86
  214. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +0 -36
  215. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +0 -1
  216. package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +0 -26
  217. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts +0 -15
  218. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts.map +0 -1
  219. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.js +0 -14
  220. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -33
  221. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +0 -1
  222. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +0 -68
  223. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +0 -22
  224. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +0 -1
  225. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +0 -143
  226. package/node_modules/@syntrologie/shared-editor-ui/package.json +0 -55
@@ -1,335 +0,0 @@
1
- /**
2
- * Tour Executor
3
- *
4
- * Orchestrates sequential tour steps with cross-page state persistence.
5
- * Tours can span multiple pages and resume after navigation.
6
- *
7
- * Each step contains an inner action (modal, tooltip) that gets executed.
8
- * The tour listens for CTA click events to advance to the next step.
9
- */
10
- /** Storage key for active tour state */
11
- const ACTIVE_TOUR_KEY = 'syntro_active_tour';
12
- /** Track active tour executors to prevent duplicates */
13
- const activeTours = new Map();
14
- /**
15
- * Get active tour state from localStorage
16
- */
17
- function getTourState(tourId) {
18
- try {
19
- const data = localStorage.getItem(ACTIVE_TOUR_KEY);
20
- if (!data)
21
- return null;
22
- const state = JSON.parse(data);
23
- // Only return if it matches the requested tour
24
- if (state.tourId !== tourId)
25
- return null;
26
- return state;
27
- }
28
- catch {
29
- return null;
30
- }
31
- }
32
- /**
33
- * Save tour state to localStorage
34
- */
35
- function saveTourState(state) {
36
- try {
37
- localStorage.setItem(ACTIVE_TOUR_KEY, JSON.stringify(state));
38
- }
39
- catch {
40
- // Storage may be full or unavailable
41
- }
42
- }
43
- /**
44
- * Clear tour state from localStorage
45
- */
46
- function clearTourState() {
47
- try {
48
- localStorage.removeItem(ACTIVE_TOUR_KEY);
49
- }
50
- catch {
51
- // Ignore errors
52
- }
53
- }
54
- /**
55
- * Get current route/path
56
- */
57
- function getCurrentRoute() {
58
- return window.location.pathname;
59
- }
60
- /**
61
- * Check if a step matches the current route
62
- */
63
- function stepMatchesRoute(step) {
64
- if (!step.route)
65
- return true;
66
- const currentRoute = getCurrentRoute();
67
- // Simple pattern matching - step.route can be exact path or glob pattern
68
- if (step.route.includes('*')) {
69
- const pattern = new RegExp(`^${step.route.replace(/\*/g, '.*')}$`);
70
- return pattern.test(currentRoute);
71
- }
72
- return currentRoute === step.route;
73
- }
74
- /**
75
- * Execute a tour action
76
- *
77
- * Tours orchestrate a sequence of steps, persisting state to localStorage
78
- * to support cross-page navigation. Each step contains an action to execute
79
- * and optionally defines transitions based on action events.
80
- */
81
- export const executeTour = async (action, context) => {
82
- const { tourId, steps, startStep, autoStart = true } = action;
83
- if (steps.length === 0) {
84
- throw new Error(`Tour "${tourId}" has no steps`);
85
- }
86
- // Self-guard: if this tour is already running, return no-op
87
- // This prevents duplicate modals when applyBatch is called multiple times
88
- if (activeTours.has(tourId)) {
89
- return {
90
- cleanup: async () => {
91
- // Delegate to the original tour's cleanup
92
- const existing = activeTours.get(tourId);
93
- if (existing) {
94
- await existing.cleanup();
95
- }
96
- },
97
- };
98
- }
99
- // Check if we can execute inner actions
100
- if (!context.applyAction) {
101
- throw new Error('Tour executor requires applyAction in context');
102
- }
103
- // Get or initialize tour state
104
- let state = getTourState(tourId);
105
- const isResumingTour = !!state;
106
- // If not resuming and autoStart is false, don't start the tour
107
- if (!isResumingTour && !autoStart) {
108
- return {
109
- cleanup: () => { },
110
- };
111
- }
112
- if (!state) {
113
- state = {
114
- tourId,
115
- currentStepId: startStep || steps[0].id,
116
- startedAt: Date.now(),
117
- };
118
- saveTourState(state);
119
- }
120
- // Find the current step
121
- let currentStepIndex = steps.findIndex((s) => s.id === state.currentStepId);
122
- if (currentStepIndex === -1) {
123
- // Step not found, use startStep or first step
124
- const initialStepId = startStep || steps[0].id;
125
- currentStepIndex = steps.findIndex((s) => s.id === initialStepId);
126
- if (currentStepIndex === -1)
127
- currentStepIndex = 0;
128
- state.currentStepId = steps[currentStepIndex].id;
129
- saveTourState(state);
130
- }
131
- const currentStep = steps[currentStepIndex];
132
- // Check if current step matches the route
133
- if (!stepMatchesRoute(currentStep)) {
134
- // Current page doesn't match this step's route
135
- // Tour is "waiting" for navigation to the correct page
136
- context.publishEvent('tour.waiting_for_route', {
137
- tourId,
138
- stepId: currentStep.id,
139
- expectedRoute: currentStep.route,
140
- currentRoute: getCurrentRoute(),
141
- });
142
- // Return a no-op that cleans up when tour ends
143
- return {
144
- cleanup: () => { },
145
- };
146
- }
147
- // Track state
148
- let isDestroyed = false;
149
- let currentActionHandle = null;
150
- let eventUnsubscribe = null;
151
- let routeWatcher = null;
152
- /**
153
- * Clean up current step
154
- */
155
- const cleanupCurrentStep = async () => {
156
- if (eventUnsubscribe) {
157
- eventUnsubscribe();
158
- eventUnsubscribe = null;
159
- }
160
- if (currentActionHandle?.isApplied()) {
161
- await currentActionHandle.revert();
162
- currentActionHandle = null;
163
- }
164
- };
165
- /**
166
- * Advance to the next step
167
- */
168
- const advanceToStep = async (nextStepId) => {
169
- if (isDestroyed)
170
- return;
171
- // Clean up current step
172
- await cleanupCurrentStep();
173
- if (nextStepId === 'end') {
174
- // Tour complete
175
- clearTourState();
176
- context.publishEvent('tour.completed', {
177
- tourId,
178
- totalSteps: steps.length,
179
- });
180
- isDestroyed = true;
181
- return;
182
- }
183
- // Find next step
184
- const nextStep = steps.find((s) => s.id === nextStepId);
185
- if (!nextStep) {
186
- console.error(`[Tour] Step "${nextStepId}" not found`);
187
- return;
188
- }
189
- // Update state
190
- state.currentStepId = nextStepId;
191
- saveTourState(state);
192
- context.publishEvent('tour.step_changed', {
193
- tourId,
194
- previousStepId: currentStep.id,
195
- nextStepId,
196
- });
197
- // If the next step has a different route, let navigation happen
198
- if (nextStep.route && nextStep.route !== getCurrentRoute()) {
199
- context.publishEvent('tour.awaiting_navigation', {
200
- tourId,
201
- stepId: nextStepId,
202
- targetRoute: nextStep.route,
203
- });
204
- // Tour will resume when page reloads and this executor runs again
205
- return;
206
- }
207
- // Execute the next step's action
208
- await executeStep(nextStep);
209
- };
210
- /**
211
- * Execute a step's inner action and set up event listeners
212
- */
213
- const executeStep = async (step) => {
214
- if (isDestroyed)
215
- return;
216
- context.publishEvent('tour.step_started', {
217
- tourId,
218
- stepId: step.id,
219
- stepIndex: steps.findIndex((s) => s.id === step.id),
220
- totalSteps: steps.length,
221
- });
222
- // Execute the inner action
223
- try {
224
- currentActionHandle = await context.applyAction(step.action);
225
- }
226
- catch (error) {
227
- console.error(`[Tour] Failed to execute step "${step.id}":`, error);
228
- context.publishEvent('tour.step_failed', {
229
- tourId,
230
- stepId: step.id,
231
- error: String(error),
232
- });
233
- return;
234
- }
235
- // Subscribe to CTA click events if there are transitions defined
236
- if (step.onAction && context.subscribeEvent) {
237
- eventUnsubscribe = context.subscribeEvent('action.modal_cta_clicked', (props) => {
238
- const actionId = props?.actionId;
239
- if (actionId && step.onAction) {
240
- const nextStepId = step.onAction[actionId];
241
- if (nextStepId) {
242
- advanceToStep(nextStepId);
243
- }
244
- }
245
- });
246
- // Also listen for tooltip CTA clicks
247
- const tooltipUnsubscribe = context.subscribeEvent('action.tooltip_cta_clicked', (props) => {
248
- const actionId = props?.actionId;
249
- if (actionId && step.onAction) {
250
- const nextStepId = step.onAction[actionId];
251
- if (nextStepId) {
252
- advanceToStep(nextStepId);
253
- }
254
- }
255
- });
256
- // Combine unsubscribes
257
- const originalUnsubscribe = eventUnsubscribe;
258
- eventUnsubscribe = () => {
259
- originalUnsubscribe();
260
- tooltipUnsubscribe();
261
- };
262
- }
263
- };
264
- // Set up route change watcher for SPAs
265
- const setupRouteWatcher = () => {
266
- let lastPath = getCurrentRoute();
267
- const checkRoute = () => {
268
- const currentPath = getCurrentRoute();
269
- if (currentPath !== lastPath) {
270
- lastPath = currentPath;
271
- context.publishEvent('tour.route_changed', {
272
- tourId,
273
- newRoute: currentPath,
274
- });
275
- }
276
- };
277
- // Use NavigationMonitor if available (single patch point),
278
- // otherwise fall back to direct History API patching (legacy)
279
- if (context.subscribeNavigation) {
280
- return context.subscribeNavigation(() => checkRoute());
281
- }
282
- // Legacy: direct History API patching
283
- window.addEventListener('popstate', checkRoute);
284
- const origPushState = history.pushState.bind(history);
285
- const origReplaceState = history.replaceState.bind(history);
286
- history.pushState = (...args) => {
287
- origPushState(...args);
288
- queueMicrotask(checkRoute);
289
- };
290
- history.replaceState = (...args) => {
291
- origReplaceState(...args);
292
- queueMicrotask(checkRoute);
293
- };
294
- return () => {
295
- window.removeEventListener('popstate', checkRoute);
296
- history.pushState = origPushState;
297
- history.replaceState = origReplaceState;
298
- };
299
- };
300
- routeWatcher = setupRouteWatcher();
301
- // Publish tour started/resumed event
302
- if (!isResumingTour) {
303
- context.publishEvent('tour.started', {
304
- tourId,
305
- totalSteps: steps.length,
306
- startStepId: state.currentStepId,
307
- });
308
- }
309
- else {
310
- context.publishEvent('tour.resumed', {
311
- tourId,
312
- stepId: state.currentStepId,
313
- });
314
- }
315
- // Execute the current step
316
- await executeStep(currentStep);
317
- // Create cleanup function
318
- const cleanup = async () => {
319
- isDestroyed = true;
320
- // Remove from active tours
321
- activeTours.delete(tourId);
322
- await cleanupCurrentStep();
323
- if (routeWatcher) {
324
- routeWatcher();
325
- }
326
- // Don't clear tour state on cleanup - allow resume
327
- context.publishEvent('tour.paused', {
328
- tourId,
329
- stepId: state.currentStepId,
330
- });
331
- };
332
- // Register this tour as active
333
- activeTours.set(tourId, { cleanup });
334
- return { cleanup };
335
- };
package/dist/highlight.js DELETED
@@ -1,180 +0,0 @@
1
- /**
2
- * Highlight Overlay
3
- *
4
- * Creates a spotlight effect around an element with a scrim backdrop.
5
- */
6
- import { blue } from '@syntro/design-system/tokens';
7
- const supportsPathClip = typeof CSS !== 'undefined' && CSS.supports?.('clip-path', "path('M0 0 H1 V1 Z')");
8
- export function showHighlight(anchorEl, overlayRoot, opts) {
9
- const padding = opts?.paddingPx ?? 12;
10
- const radius = opts?.radiusPx ?? 12;
11
- const opacity = Math.min(Math.max(opts?.scrimOpacity ?? 0.55, 0), 1);
12
- const ringColor = opts?.ringColor ?? `var(--syntro-ring, ${blue[5]})`;
13
- const blocking = opts?.blocking ?? false;
14
- const onClickOutside = opts?.onClickOutside ?? true;
15
- const onEsc = opts?.onEsc ?? true;
16
- const rootStyles = getComputedStyle(document.documentElement);
17
- const tokenScrim = rootStyles.getPropertyValue('--syntro-spotlight-backdrop').trim();
18
- const tokenRing = rootStyles.getPropertyValue('--syntro-ring').trim();
19
- const scrim = document.createElement('div');
20
- scrim.className = 'syntro-spotlight-scrim';
21
- const needsPointerEvents = blocking || onClickOutside;
22
- Object.assign(scrim.style, {
23
- position: 'fixed',
24
- inset: '0',
25
- zIndex: '2147483646',
26
- pointerEvents: needsPointerEvents ? 'auto' : 'none',
27
- background: tokenScrim || `rgba(2, 6, 23, ${opacity})`,
28
- transition: 'opacity 220ms ease',
29
- opacity: '0',
30
- });
31
- overlayRoot.appendChild(scrim);
32
- requestAnimationFrame(() => (scrim.style.opacity = '1'));
33
- const ring = document.createElement('div');
34
- ring.className = 'syntro-spotlight-ring';
35
- Object.assign(ring.style, {
36
- position: 'fixed',
37
- pointerEvents: 'none',
38
- borderRadius: `${radius}px`,
39
- border: `2px solid ${ringColor || tokenRing || blue[5]}`,
40
- boxShadow: `0 0 0 4px rgba(255,255,255,0.35)`,
41
- zIndex: '2147483647',
42
- transition: 'all 220ms cubic-bezier(0.16,1,0.3,1)',
43
- });
44
- overlayRoot.appendChild(ring);
45
- const fallbackSlices = [];
46
- if (!supportsPathClip) {
47
- for (let i = 0; i < 4; i++) {
48
- const slice = document.createElement('div');
49
- slice.style.position = 'fixed';
50
- slice.style.background = 'inherit';
51
- fallbackSlices.push(slice);
52
- scrim.appendChild(slice);
53
- }
54
- }
55
- const setClipPath = (path) => {
56
- scrim.style.clipPath = path;
57
- scrim.style.webkitClipPath = path;
58
- };
59
- const update = () => {
60
- // Guard: if anchor was removed from DOM (e.g. React Router navigation),
61
- // destroy the overlay gracefully instead of positioning at (0,0).
62
- if (!anchorEl.isConnected) {
63
- handle.destroy();
64
- return;
65
- }
66
- const rect = anchorEl.getBoundingClientRect();
67
- // Use unclamped coordinates so the ring and clip-path track the anchor's
68
- // true position. When the anchor is partially off-screen the browser
69
- // naturally clips the fixed-position ring at the viewport edge.
70
- const x = rect.left - padding;
71
- const y = rect.top - padding;
72
- const w = rect.width + padding * 2;
73
- const h = rect.height + padding * 2;
74
- Object.assign(ring.style, {
75
- left: `${x}px`,
76
- top: `${y}px`,
77
- width: `${w}px`,
78
- height: `${h}px`,
79
- });
80
- if (supportsPathClip) {
81
- const vw = window.innerWidth;
82
- const vh = window.innerHeight;
83
- const r = Math.min(radius, w / 2, h / 2);
84
- const outer = `M 0 0 L ${vw} 0 L ${vw} ${vh} L 0 ${vh} Z`;
85
- const inner = `M ${x + r} ${y} ` +
86
- `A ${r} ${r} 0 0 0 ${x} ${y + r} ` +
87
- `L ${x} ${y + h - r} ` +
88
- `A ${r} ${r} 0 0 0 ${x + r} ${y + h} ` +
89
- `L ${x + w - r} ${y + h} ` +
90
- `A ${r} ${r} 0 0 0 ${x + w} ${y + h - r} ` +
91
- `L ${x + w} ${y + r} ` +
92
- `A ${r} ${r} 0 0 0 ${x + w - r} ${y} ` +
93
- `L ${x + r} ${y} ` +
94
- `Z`;
95
- setClipPath(`path('${outer} ${inner}')`);
96
- }
97
- else {
98
- const [top, right, bottom, left] = fallbackSlices;
99
- Object.assign(top.style, {
100
- left: '0px',
101
- top: '0px',
102
- width: '100vw',
103
- height: `${y}px`,
104
- });
105
- Object.assign(bottom.style, {
106
- left: '0px',
107
- top: `${y + h}px`,
108
- width: '100vw',
109
- height: `${Math.max(0, window.innerHeight - (y + h))}px`,
110
- });
111
- Object.assign(left.style, {
112
- left: '0px',
113
- top: `${y}px`,
114
- width: `${x}px`,
115
- height: `${h}px`,
116
- });
117
- Object.assign(right.style, {
118
- left: `${x + w}px`,
119
- top: `${y}px`,
120
- width: `${Math.max(0, window.innerWidth - (x + w))}px`,
121
- height: `${h}px`,
122
- });
123
- }
124
- };
125
- const ro = new ResizeObserver(() => requestAnimationFrame(update));
126
- ro.observe(anchorEl);
127
- const onScroll = () => requestAnimationFrame(update);
128
- const onResize = () => requestAnimationFrame(update);
129
- window.addEventListener('scroll', onScroll, true);
130
- window.addEventListener('resize', onResize);
131
- const onKey = (e) => {
132
- if (e.key === 'Escape' && onEsc) {
133
- opts?.onDismiss?.();
134
- handle.destroy();
135
- }
136
- };
137
- if (onEsc) {
138
- window.addEventListener('keydown', onKey);
139
- }
140
- const onClick = (event) => {
141
- if (blocking) {
142
- event.preventDefault();
143
- event.stopPropagation();
144
- }
145
- else if (onClickOutside) {
146
- opts?.onDismiss?.();
147
- handle.destroy();
148
- }
149
- };
150
- scrim.addEventListener('click', onClick);
151
- const handle = {
152
- destroy() {
153
- ro.disconnect();
154
- window.removeEventListener('scroll', onScroll, true);
155
- window.removeEventListener('resize', onResize);
156
- if (onEsc) {
157
- window.removeEventListener('keydown', onKey);
158
- }
159
- scrim.removeEventListener('click', onClick);
160
- scrim.style.pointerEvents = 'none';
161
- scrim.style.opacity = '0';
162
- setTimeout(() => {
163
- try {
164
- scrim.remove();
165
- }
166
- catch {
167
- /* already detached */
168
- }
169
- try {
170
- ring.remove();
171
- }
172
- catch {
173
- /* already detached */
174
- }
175
- }, 220);
176
- },
177
- };
178
- update();
179
- return handle;
180
- }