@syntrologie/adapt-nav 2.15.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 (211) hide show
  1. package/dist/NavWidgetLit.d.ts.map +1 -1
  2. package/dist/chunk-HMLY7DHA.js +16 -0
  3. package/dist/chunk-HMLY7DHA.js.map +7 -0
  4. package/dist/chunk-ZYHZ6JAD.js +447 -0
  5. package/dist/chunk-ZYHZ6JAD.js.map +7 -0
  6. package/dist/editor.d.ts +42 -21
  7. package/dist/editor.d.ts.map +1 -1
  8. package/dist/editor.js +310 -313
  9. package/dist/editor.js.map +7 -0
  10. package/dist/resolveNavTarget.d.ts +61 -0
  11. package/dist/resolveNavTarget.d.ts.map +1 -0
  12. package/dist/resolveNavTarget.test.d.ts +2 -0
  13. package/dist/resolveNavTarget.test.d.ts.map +1 -0
  14. package/dist/runtime.d.ts +3 -4
  15. package/dist/runtime.d.ts.map +1 -1
  16. package/dist/runtime.js +612 -221
  17. package/dist/runtime.js.map +7 -0
  18. package/dist/schema.d.ts +182 -72
  19. package/dist/schema.d.ts.map +1 -1
  20. package/dist/schema.js +155 -125
  21. package/dist/schema.js.map +7 -0
  22. package/package.json +9 -24
  23. package/dist/NavWidget.d.ts +0 -31
  24. package/dist/NavWidget.d.ts.map +0 -1
  25. package/dist/NavWidget.js +0 -476
  26. package/dist/NavWidgetLit.js +0 -495
  27. package/dist/NavWidgetLit.test.js +0 -199
  28. package/dist/cdn.d.ts +0 -62
  29. package/dist/cdn.d.ts.map +0 -1
  30. package/dist/cdn.js +0 -48
  31. package/dist/editor-lit.d.ts +0 -49
  32. package/dist/editor-lit.d.ts.map +0 -1
  33. package/dist/editor-lit.js +0 -319
  34. package/dist/runtime-lit.d.ts +0 -108
  35. package/dist/runtime-lit.d.ts.map +0 -1
  36. package/dist/runtime-lit.js +0 -241
  37. package/dist/summarize.js +0 -51
  38. package/dist/types.js +0 -18
  39. package/node_modules/@syntro/design-system/README.md +0 -335
  40. package/node_modules/@syntro/design-system/dist/assets/syntrologie-logo.svg +0 -21
  41. package/node_modules/@syntro/design-system/dist/assets/syntrologie-logomark.svg +0 -10
  42. package/node_modules/@syntro/design-system/dist/index.d.ts +0 -8
  43. package/node_modules/@syntro/design-system/dist/index.d.ts.map +0 -1
  44. package/node_modules/@syntro/design-system/dist/index.js +0 -7
  45. package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts +0 -19
  46. package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts.map +0 -1
  47. package/node_modules/@syntro/design-system/dist/tailwind-preset.js +0 -455
  48. package/node_modules/@syntro/design-system/dist/tokens/colors.css +0 -464
  49. package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts +0 -874
  50. package/node_modules/@syntro/design-system/dist/tokens/colors.d.ts.map +0 -1
  51. package/node_modules/@syntro/design-system/dist/tokens/colors.js +0 -564
  52. package/node_modules/@syntro/design-system/dist/tokens/effects.css +0 -43
  53. package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts +0 -139
  54. package/node_modules/@syntro/design-system/dist/tokens/effects.d.ts.map +0 -1
  55. package/node_modules/@syntro/design-system/dist/tokens/effects.js +0 -121
  56. package/node_modules/@syntro/design-system/dist/tokens/index.d.ts +0 -12
  57. package/node_modules/@syntro/design-system/dist/tokens/index.d.ts.map +0 -1
  58. package/node_modules/@syntro/design-system/dist/tokens/index.js +0 -11
  59. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts +0 -93
  60. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.d.ts.map +0 -1
  61. package/node_modules/@syntro/design-system/dist/tokens/panel-shell.js +0 -72
  62. package/node_modules/@syntro/design-system/package.json +0 -55
  63. package/node_modules/@syntro/design-system/src/assets/syntrologie-logo.svg +0 -21
  64. package/node_modules/@syntro/design-system/src/assets/syntrologie-logomark.svg +0 -10
  65. package/node_modules/@syntrologie/sdk-contracts/dist/index.d.ts +0 -129
  66. package/node_modules/@syntrologie/sdk-contracts/dist/index.js +0 -17
  67. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.d.ts +0 -2296
  68. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.js +0 -361
  69. package/node_modules/@syntrologie/sdk-contracts/package.json +0 -33
  70. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +0 -2
  71. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +0 -1
  72. package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +0 -3
  73. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +0 -34
  74. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +0 -1
  75. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +0 -161
  76. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts +0 -84
  77. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.d.ts.map +0 -1
  78. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPickerLit.js +0 -323
  79. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +0 -7
  80. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +0 -1
  81. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +0 -9
  82. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts +0 -25
  83. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.d.ts.map +0 -1
  84. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggleLit.js +0 -55
  85. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +0 -23
  86. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +0 -1
  87. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +0 -40
  88. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts +0 -33
  89. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.d.ts.map +0 -1
  90. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLineLit.js +0 -118
  91. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +0 -7
  92. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +0 -1
  93. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +0 -22
  94. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts +0 -32
  95. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.d.ts.map +0 -1
  96. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadgeLit.js +0 -68
  97. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +0 -8
  98. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +0 -1
  99. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +0 -9
  100. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts +0 -34
  101. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.d.ts.map +0 -1
  102. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSectionLit.js +0 -57
  103. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +0 -7
  104. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +0 -1
  105. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +0 -4
  106. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts +0 -13
  107. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.d.ts.map +0 -1
  108. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButtonLit.js +0 -31
  109. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +0 -7
  110. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +0 -1
  111. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +0 -4
  112. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts +0 -7
  113. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.d.ts.map +0 -1
  114. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBodyLit.js +0 -15
  115. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +0 -13
  116. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +0 -1
  117. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +0 -15
  118. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts +0 -36
  119. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.d.ts.map +0 -1
  120. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCardLit.js +0 -102
  121. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +0 -7
  122. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +0 -1
  123. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +0 -4
  124. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts +0 -20
  125. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.d.ts.map +0 -1
  126. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooterLit.js +0 -48
  127. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +0 -9
  128. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +0 -1
  129. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +0 -4
  130. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts +0 -16
  131. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.d.ts.map +0 -1
  132. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeaderLit.js +0 -25
  133. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +0 -8
  134. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +0 -1
  135. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +0 -8
  136. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts +0 -66
  137. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.d.ts.map +0 -1
  138. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInputLit.js +0 -87
  139. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +0 -7
  140. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +0 -1
  141. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +0 -4
  142. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts +0 -7
  143. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.d.ts.map +0 -1
  144. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayoutLit.js +0 -15
  145. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +0 -25
  146. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +0 -1
  147. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +0 -390
  148. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts +0 -66
  149. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.d.ts.map +0 -1
  150. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShellLit.js +0 -528
  151. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +0 -8
  152. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +0 -1
  153. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +0 -8
  154. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts +0 -41
  155. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.d.ts.map +0 -1
  156. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelectLit.js +0 -63
  157. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +0 -8
  158. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +0 -1
  159. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +0 -17
  160. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts +0 -55
  161. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.d.ts.map +0 -1
  162. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextareaLit.js +0 -92
  163. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +0 -32
  164. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +0 -1
  165. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +0 -85
  166. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts +0 -90
  167. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.d.ts.map +0 -1
  168. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlightLit.js +0 -242
  169. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +0 -6
  170. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +0 -1
  171. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +0 -4
  172. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts +0 -12
  173. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.d.ts.map +0 -1
  174. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyStateLit.js +0 -21
  175. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +0 -8
  176. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +0 -1
  177. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +0 -5
  178. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts +0 -21
  179. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.d.ts.map +0 -1
  180. package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeaderLit.js +0 -33
  181. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +0 -12
  182. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +0 -1
  183. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +0 -40
  184. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts +0 -28
  185. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.d.ts.map +0 -1
  186. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourneyLit.js +0 -121
  187. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts +0 -110
  188. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.d.ts.map +0 -1
  189. package/node_modules/@syntrologie/shared-editor-ui/dist/controllers/PanelShellController.js +0 -476
  190. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +0 -26
  191. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +0 -1
  192. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +0 -202
  193. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +0 -8
  194. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +0 -1
  195. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +0 -46
  196. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +0 -24
  197. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +0 -1
  198. package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +0 -86
  199. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +0 -36
  200. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +0 -1
  201. package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +0 -26
  202. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts +0 -15
  203. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.d.ts.map +0 -1
  204. package/node_modules/@syntrologie/shared-editor-ui/dist/lit-elements.js +0 -14
  205. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -33
  206. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +0 -1
  207. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +0 -68
  208. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +0 -22
  209. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +0 -1
  210. package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +0 -143
  211. package/node_modules/@syntrologie/shared-editor-ui/package.json +0 -55
package/dist/runtime.js CHANGED
@@ -1,241 +1,632 @@
1
- /**
2
- * Adaptive Nav - Runtime Module
3
- *
4
- * Runtime manifest for the navigation tips accordion adaptive.
5
- * Includes widget-based nav tips and navigation action executors
6
- * (scrollTo, navigate) previously in adaptive-navigation.
7
- */
8
- import { NavMountableWidget } from './NavWidget';
9
- import { registerNavWidgetLit } from './NavWidgetLit';
10
- // ============================================================================
11
- // Navigation Action Executors (merged from adaptive-navigation)
12
- // ============================================================================
13
- /**
14
- * Execute a scrollTo action
15
- */
16
- export const executeScrollTo = async (action, context) => {
17
- const anchorEl = context.resolveAnchor(action.anchorId);
18
- if (!anchorEl) {
19
- console.error(`[adaptive-nav] Anchor not found for scrollTo, skipping: ${action.anchorId.selector}`);
20
- return { cleanup: () => { } };
1
+ import {
2
+ renderIcon
3
+ } from "./chunk-ZYHZ6JAD.js";
4
+ import {
5
+ __privateAdd,
6
+ __privateGet,
7
+ __privateMethod,
8
+ __privateSet
9
+ } from "./chunk-HMLY7DHA.js";
10
+
11
+ // src/NavWidgetLit.ts
12
+ import { html, LitElement, nothing } from "lit";
13
+ import { styleMap } from "lit/directives/style-map.js";
14
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
15
+
16
+ // src/resolveNavTarget.ts
17
+ function resolveNavTarget(args) {
18
+ const { href, external, windowOrigin, isIframe } = args;
19
+ const isOpaqueOrigin = windowOrigin === "null";
20
+ if (isIframe || isOpaqueOrigin) {
21
+ return { kind: "open", url: href };
22
+ }
23
+ if (external) {
24
+ return { kind: "open", url: href };
25
+ }
26
+ let url;
27
+ try {
28
+ url = new URL(href, windowOrigin);
29
+ } catch {
30
+ return { kind: "fullnav", url: href };
31
+ }
32
+ if (url.origin !== windowOrigin) {
33
+ return { kind: "fullnav", url: url.toString() };
34
+ }
35
+ return { kind: "spa", url };
36
+ }
37
+ function detectIsIframe() {
38
+ if (typeof window === "undefined") return false;
39
+ try {
40
+ return window !== window.top;
41
+ } catch {
42
+ return true;
43
+ }
44
+ }
45
+
46
+ // src/NavWidgetLit.ts
47
+ var TOKEN_PURPLE_4 = "#6a59ce";
48
+ var TOKEN_SLATE_GREY_7 = "#677384";
49
+ var TOKEN_SLATE_GREY_8 = "#87919f";
50
+ function escapeHtml(str) {
51
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
52
+ }
53
+ function renderIcon2(emoji) {
54
+ return renderIcon(emoji) || escapeHtml(emoji);
55
+ }
56
+ function routeMatchesCurrent(routes) {
57
+ if (typeof window === "undefined") return false;
58
+ const current = window.location.pathname;
59
+ return routes.some((route) => {
60
+ const routePath = route.split("?")[0].split("#")[0];
61
+ if (routePath.endsWith("/**")) {
62
+ return current.startsWith(routePath.slice(0, -3));
21
63
  }
22
- // Scroll to element
23
- anchorEl.scrollIntoView({
24
- behavior: action.behavior ?? 'smooth',
25
- block: action.block ?? 'center',
26
- inline: action.inline ?? 'nearest',
64
+ return current === routePath;
65
+ });
66
+ }
67
+ function pulseElement(el) {
68
+ const keyframes = [
69
+ { boxShadow: "0 0 0 0 rgba(13, 148, 136, 0.5)" },
70
+ { boxShadow: "0 0 0 8px rgba(13, 148, 136, 0)" }
71
+ ];
72
+ el.animate(keyframes, { duration: 600, iterations: 3, easing: "ease-out" });
73
+ }
74
+ function resolveTheme(theme) {
75
+ if (theme === "dark") return "dark";
76
+ if (theme === "light") return "light";
77
+ if (typeof window !== "undefined") {
78
+ return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
79
+ }
80
+ return "light";
81
+ }
82
+ var _contextUnsub, _accumulatorUnsub, _NavWidgetLit_instances, subscribeRuntime_fn, unsubscribeRuntime_fn, getVisibleTips_fn, getResolvedTheme_fn, handleToggle_fn, handleNavigate_fn, handleFocusAnchor_fn, publishEvent_fn, renderTipItem_fn;
83
+ var NavWidgetLit = class extends LitElement {
84
+ constructor() {
85
+ super(...arguments);
86
+ __privateAdd(this, _NavWidgetLit_instances);
87
+ // ---------- Public properties --------------------------------------------
88
+ this.config = { expandBehavior: "single", theme: "auto", actions: [] };
89
+ this.runtime = void 0;
90
+ this.instanceId = "nav-widget";
91
+ // ---------- Internal state -----------------------------------------------
92
+ /** @internal */
93
+ this._expandedIds = /* @__PURE__ */ new Set();
94
+ /** @internal */
95
+ this._renderTick = 0;
96
+ /** @internal */
97
+ this._hoveredId = null;
98
+ // ---------- Private subscriptions ----------------------------------------
99
+ __privateAdd(this, _contextUnsub, null);
100
+ __privateAdd(this, _accumulatorUnsub, null);
101
+ }
102
+ // ---------- No shadow DOM — inherit host CSS variables --------------------
103
+ createRenderRoot() {
104
+ return this;
105
+ }
106
+ // ---------- Lifecycle: connectedCallback ---------------------------------
107
+ connectedCallback() {
108
+ super.connectedCallback();
109
+ __privateMethod(this, _NavWidgetLit_instances, subscribeRuntime_fn).call(this);
110
+ }
111
+ // ---------- Lifecycle: disconnectedCallback ------------------------------
112
+ disconnectedCallback() {
113
+ super.disconnectedCallback();
114
+ __privateMethod(this, _NavWidgetLit_instances, unsubscribeRuntime_fn).call(this);
115
+ }
116
+ // ---------- Lifecycle: updated -------------------------------------------
117
+ updated(changed) {
118
+ if (changed.has("runtime")) {
119
+ __privateMethod(this, _NavWidgetLit_instances, unsubscribeRuntime_fn).call(this);
120
+ __privateMethod(this, _NavWidgetLit_instances, subscribeRuntime_fn).call(this);
121
+ }
122
+ }
123
+ // ---------- Render --------------------------------------------------------
124
+ render() {
125
+ const visibleTips = __privateMethod(this, _NavWidgetLit_instances, getVisibleTips_fn).call(this);
126
+ const theme = __privateMethod(this, _NavWidgetLit_instances, getResolvedTheme_fn).call(this);
127
+ const containerStyle = styleMap({
128
+ fontFamily: "var(--sc-font-family, system-ui, -apple-system, sans-serif)",
129
+ maxWidth: "100%",
130
+ overflow: "hidden",
131
+ backgroundColor: "transparent",
132
+ color: "inherit"
27
133
  });
28
- context.publishEvent('action.applied', {
29
- id: context.generateId(),
30
- kind: 'navigation:scrollTo',
31
- anchorId: action.anchorId,
32
- behavior: action.behavior ?? 'smooth',
134
+ const accordionStyle = styleMap({
135
+ display: "flex",
136
+ flexDirection: "column",
137
+ gap: "var(--sc-content-item-gap, 6px)"
33
138
  });
34
- return {
35
- cleanup: () => {
36
- // Optionally restore scroll position on revert
37
- },
38
- };
139
+ const categoryHeaderStyle = styleMap({
140
+ fontSize: "var(--sc-content-category-font-size, 12px)",
141
+ fontWeight: "600",
142
+ textTransform: "uppercase",
143
+ letterSpacing: "0.05em",
144
+ padding: "var(--sc-content-category-padding, 8px 4px 4px 4px)",
145
+ color: theme === "dark" ? TOKEN_SLATE_GREY_8 : TOKEN_SLATE_GREY_7
146
+ });
147
+ const emptyStateStyle = styleMap({
148
+ fontSize: "13px",
149
+ padding: "16px",
150
+ textAlign: "center",
151
+ color: theme === "dark" ? TOKEN_SLATE_GREY_7 : TOKEN_SLATE_GREY_8
152
+ });
153
+ if (visibleTips.length === 0) {
154
+ return html`
155
+ <div
156
+ style=${containerStyle}
157
+ data-adaptive-id=${this.instanceId}
158
+ data-adaptive-type="adaptive-nav"
159
+ >
160
+ <div style=${emptyStateStyle}>
161
+ You're all set for now! We'll share helpful tips here when they're relevant to what
162
+ you're doing.
163
+ </div>
164
+ </div>
165
+ `;
166
+ }
167
+ const categoryGroups = /* @__PURE__ */ new Map();
168
+ for (const tip of visibleTips) {
169
+ const cat = tip.config.category;
170
+ if (!categoryGroups.has(cat)) {
171
+ categoryGroups.set(cat, []);
172
+ }
173
+ categoryGroups.get(cat).push(tip);
174
+ }
175
+ const hasCategories = visibleTips.some((t) => t.config.category);
176
+ return html`
177
+ <div
178
+ style=${containerStyle}
179
+ data-adaptive-id=${this.instanceId}
180
+ data-adaptive-type="adaptive-nav"
181
+ >
182
+ <div style=${accordionStyle}>
183
+ ${hasCategories ? Array.from(categoryGroups.entries()).map(
184
+ ([category, items]) => html`
185
+ ${category ? html`<div style=${categoryHeaderStyle} data-category-header=${category}>${category}</div>` : nothing}
186
+ ${items.map((tip, idx) => __privateMethod(this, _NavWidgetLit_instances, renderTipItem_fn).call(this, tip, idx, items.length))}
187
+ `
188
+ ) : visibleTips.map((tip, idx) => __privateMethod(this, _NavWidgetLit_instances, renderTipItem_fn).call(this, tip, idx, visibleTips.length))}
189
+ </div>
190
+ </div>
191
+ `;
192
+ }
193
+ };
194
+ _contextUnsub = new WeakMap();
195
+ _accumulatorUnsub = new WeakMap();
196
+ _NavWidgetLit_instances = new WeakSet();
197
+ // ---------- Runtime subscriptions ----------------------------------------
198
+ subscribeRuntime_fn = function() {
199
+ if (!this.runtime) return;
200
+ __privateSet(this, _contextUnsub, this.runtime.context.subscribe(() => {
201
+ this._renderTick += 1;
202
+ }));
203
+ if (this.runtime.accumulator?.subscribe) {
204
+ __privateSet(this, _accumulatorUnsub, this.runtime.accumulator.subscribe(() => {
205
+ this._renderTick += 1;
206
+ }));
207
+ }
39
208
  };
40
- /**
41
- * Try to navigate using the host framework's native router.
42
- * Returns true if a framework router handled the navigation,
43
- * false if no framework was detected (caller should use pushState or location.href).
44
- *
45
- * Using the native router preserves SPA behavior (no full reload),
46
- * layout state, scroll position, and framework-specific features
47
- * (RSC streaming, view transitions, etc.).
48
- */
49
- export function navigateWithFrameworkRouter(url) {
50
- if (typeof window === 'undefined')
51
- return false;
52
- const w = window;
53
- // Next.js �� window.next.router.push() triggers App Router navigation
54
- // with RSC fetch, layout preservation, and loading states
209
+ unsubscribeRuntime_fn = function() {
210
+ var _a, _b;
211
+ (_a = __privateGet(this, _contextUnsub)) == null ? void 0 : _a.call(this);
212
+ __privateSet(this, _contextUnsub, null);
213
+ (_b = __privateGet(this, _accumulatorUnsub)) == null ? void 0 : _b.call(this);
214
+ __privateSet(this, _accumulatorUnsub, null);
215
+ };
216
+ // ---------- Computed helpers (called on each render) ---------------------
217
+ getVisibleTips_fn = function() {
218
+ void this._renderTick;
219
+ if (!this.runtime) return this.config.actions;
220
+ return this.config.actions.filter((tip) => {
221
+ if (!tip.triggerWhen) return true;
55
222
  try {
56
- const nextRouter = w.next?.router;
57
- if (nextRouter?.push) {
58
- nextRouter.push(url);
59
- return true;
60
- }
223
+ const result = this.runtime.evaluateSync(tip.triggerWhen);
224
+ return result.value;
225
+ } catch {
226
+ return false;
61
227
  }
62
- catch {
63
- /* fall through */
228
+ });
229
+ };
230
+ getResolvedTheme_fn = function() {
231
+ return resolveTheme(this.config.theme);
232
+ };
233
+ // ---------- Event handlers -----------------------------------------------
234
+ handleToggle_fn = function(id) {
235
+ const wasExpanded = this._expandedIds.has(id);
236
+ let next;
237
+ if (this.config.expandBehavior === "single") {
238
+ for (const prevId of this._expandedIds) {
239
+ if (prevId !== id) {
240
+ __privateMethod(this, _NavWidgetLit_instances, publishEvent_fn).call(this, "nav:toggled", {
241
+ tipId: prevId,
242
+ expanded: false
243
+ });
244
+ }
64
245
  }
65
- // Nuxt 3 useRouter() isn't accessible from outside Vue, but
66
- // $nuxt.$router (Nuxt 2) or window.__NUXT__?.hooks (Nuxt 3) + navigateTo
67
- // aren't reliably exposed. Nuxt 2 exposes $nuxt.$router.push().
68
- try {
69
- if (w.$nuxt?.$router?.push) {
70
- w.$nuxt.$router.push(url);
71
- return true;
72
- }
246
+ next = wasExpanded ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([id]);
247
+ } else {
248
+ next = new Set(this._expandedIds);
249
+ if (wasExpanded) {
250
+ next.delete(id);
251
+ } else {
252
+ next.add(id);
73
253
  }
74
- catch {
75
- /* fall through */
254
+ }
255
+ __privateMethod(this, _NavWidgetLit_instances, publishEvent_fn).call(this, "nav:toggled", {
256
+ tipId: id,
257
+ expanded: !wasExpanded
258
+ });
259
+ this._expandedIds = next;
260
+ };
261
+ handleNavigate_fn = function(href, external) {
262
+ const normalized = href.trim().toLowerCase();
263
+ if (normalized.startsWith("javascript:") || normalized.startsWith("data:")) return;
264
+ __privateMethod(this, _NavWidgetLit_instances, publishEvent_fn).call(this, "nav:tip_clicked", { href, external });
265
+ this.dispatchEvent(
266
+ new CustomEvent("nav-tip-clicked", {
267
+ bubbles: true,
268
+ detail: { href, external, instanceId: this.instanceId }
269
+ })
270
+ );
271
+ const target = resolveNavTarget({
272
+ href,
273
+ external,
274
+ windowOrigin: typeof window !== "undefined" ? window.location.origin : "",
275
+ isIframe: detectIsIframe()
276
+ });
277
+ if (target.kind === "open") {
278
+ window.open(target.url, "_blank", "noopener,noreferrer");
279
+ return;
280
+ }
281
+ if (target.kind === "fullnav") {
282
+ window.location.href = target.url;
283
+ return;
284
+ }
285
+ target.url.search = window.location.search;
286
+ if (!navigateWithFrameworkRouter(target.url.toString())) {
287
+ window.history.pushState(null, "", target.url.toString());
288
+ window.dispatchEvent(new PopStateEvent("popstate"));
289
+ }
290
+ };
291
+ handleFocusAnchor_fn = function(anchor) {
292
+ const el = document.querySelector(anchor.selector);
293
+ if (!(el instanceof HTMLElement)) return;
294
+ __privateMethod(this, _NavWidgetLit_instances, publishEvent_fn).call(this, "nav:tip_focused", {
295
+ selector: anchor.selector,
296
+ route: anchor.route
297
+ });
298
+ this.dispatchEvent(
299
+ new CustomEvent("nav-tip-focused", {
300
+ bubbles: true,
301
+ detail: { selector: anchor.selector, instanceId: this.instanceId }
302
+ })
303
+ );
304
+ el.scrollIntoView({ behavior: "smooth", block: "center" });
305
+ pulseElement(el);
306
+ setTimeout(() => el.focus(), 400);
307
+ };
308
+ publishEvent_fn = function(name, props) {
309
+ this.runtime?.events.publish(name, {
310
+ instanceId: this.instanceId,
311
+ timestamp: Date.now(),
312
+ ...props
313
+ });
314
+ };
315
+ // ---------- Tip item rendering -------------------------------------------
316
+ renderTipItem_fn = function(tip, index, total) {
317
+ const { id, title, description, href, icon, external, anchor, category: _cat } = tip.config;
318
+ const isExpanded = this._expandedIds.has(id);
319
+ const isLast = index === total - 1;
320
+ const isHovered = this._hoveredId === id;
321
+ const theme = __privateMethod(this, _NavWidgetLit_instances, getResolvedTheme_fn).call(this);
322
+ const effectiveHref = anchor ? Array.isArray(anchor.route) ? anchor.route[0] : anchor.route : href;
323
+ const isSamePage = anchor ? routeMatchesCurrent(Array.isArray(anchor.route) ? anchor.route : [anchor.route]) : effectiveHref ? routeMatchesCurrent([effectiveHref]) : false;
324
+ const hasSelector = anchor?.selector && anchor.selector !== "*";
325
+ const isFocusAction = isSamePage && hasSelector;
326
+ const hasAction = !!effectiveHref || isFocusAction;
327
+ const ctaLabel = isFocusAction ? "Focus \u2192" : external ? "Go \u2197" : "Go \u2192";
328
+ const itemStyle = styleMap({
329
+ borderRadius: "var(--sc-content-border-radius, 8px)",
330
+ overflow: "hidden",
331
+ transition: "box-shadow 0.2s ease",
332
+ backgroundColor: "var(--sc-content-background)",
333
+ border: "var(--sc-content-border)",
334
+ ...isExpanded ? {
335
+ boxShadow: theme === "dark" ? "0 4px 12px rgba(0, 0, 0, 0.15)" : "0 4px 12px rgba(0, 0, 0, 0.08)"
336
+ } : {},
337
+ ...!isLast ? { borderBottom: "var(--sc-content-item-divider, none)" } : {}
338
+ });
339
+ const headerStyle = styleMap({
340
+ display: "flex",
341
+ alignItems: "center",
342
+ gap: "8px",
343
+ width: "100%",
344
+ padding: "var(--sc-content-item-padding, 12px 16px)",
345
+ border: "none",
346
+ cursor: "pointer",
347
+ fontSize: "var(--sc-content-item-font-size, 15px)",
348
+ fontWeight: "500",
349
+ fontFamily: "inherit",
350
+ textAlign: "left",
351
+ transition: "background-color 0.15s ease",
352
+ backgroundColor: isHovered ? "var(--sc-content-background-hover)" : "transparent",
353
+ color: "var(--sc-content-text-color)"
354
+ });
355
+ const chevronStyle = styleMap({
356
+ fontSize: "20px",
357
+ transition: "transform 0.2s ease",
358
+ marginLeft: "auto",
359
+ flexShrink: "0",
360
+ color: "var(--sc-content-chevron-color, currentColor)",
361
+ transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
362
+ });
363
+ const bodyStyle = styleMap({
364
+ overflow: "hidden",
365
+ transition: "max-height 0.25s ease, padding-bottom 0.25s ease",
366
+ padding: "var(--sc-content-body-padding, 0 16px 12px 16px)",
367
+ color: "var(--sc-content-text-secondary-color)",
368
+ maxHeight: isExpanded ? "500px" : "0",
369
+ paddingBottom: isExpanded ? "16px" : "0"
370
+ });
371
+ const descriptionStyle = styleMap({
372
+ fontSize: "var(--sc-content-body-font-size, 14px)",
373
+ lineHeight: "1.5",
374
+ margin: "0"
375
+ });
376
+ const linkButtonStyle = styleMap({
377
+ display: "inline-flex",
378
+ alignItems: "center",
379
+ gap: "4px",
380
+ marginTop: "10px",
381
+ padding: "6px 12px",
382
+ borderRadius: "6px",
383
+ textDecoration: "none",
384
+ fontSize: "13px",
385
+ fontWeight: "500",
386
+ cursor: "pointer",
387
+ border: "none",
388
+ transition: "background-color 0.15s ease",
389
+ backgroundColor: `var(--sc-color-primary, ${TOKEN_PURPLE_4})`,
390
+ color: "#ffffff"
391
+ });
392
+ const iconStyle = styleMap({
393
+ fontSize: "16px",
394
+ flexShrink: "0"
395
+ });
396
+ const onLinkClick = (e) => {
397
+ e.preventDefault();
398
+ e.stopPropagation();
399
+ if (isFocusAction && anchor) {
400
+ __privateMethod(this, _NavWidgetLit_instances, handleFocusAnchor_fn).call(this, anchor);
401
+ } else if (effectiveHref) {
402
+ __privateMethod(this, _NavWidgetLit_instances, handleNavigate_fn).call(this, effectiveHref, external ?? false);
76
403
  }
77
- // Angular — Angular Router isn't exposed on window by default.
78
- // The most reliable approach is to detect Angular and use location.href.
79
- if (w.ng || w.getAllAngularRootElements || document.querySelector('[ng-version]')) {
80
- window.location.href = url;
81
- return true;
404
+ };
405
+ return html`
406
+ <div
407
+ style=${itemStyle}
408
+ data-nav-tip-id=${id}
409
+ >
410
+ <button
411
+ type="button"
412
+ style=${headerStyle}
413
+ aria-expanded=${isExpanded}
414
+ @click=${() => __privateMethod(this, _NavWidgetLit_instances, handleToggle_fn).call(this, id)}
415
+ @mouseenter=${() => {
416
+ this._hoveredId = id;
417
+ }}
418
+ @mouseleave=${() => {
419
+ this._hoveredId = null;
420
+ }}
421
+ >
422
+ ${icon ? html`<span style=${iconStyle}>${unsafeHTML(renderIcon2(icon))}</span>` : nothing}
423
+ <span>${title}</span>
424
+ <span style=${chevronStyle}>${"\u203A"}</span>
425
+ </button>
426
+ <div style=${bodyStyle} aria-hidden=${!isExpanded}>
427
+ <p style=${descriptionStyle}>${description}</p>
428
+ ${hasAction ? html`
429
+ <a
430
+ href=${effectiveHref || "#"}
431
+ style=${linkButtonStyle}
432
+ target=${external ? "_blank" : nothing}
433
+ rel=${external ? "noopener noreferrer" : nothing}
434
+ @click=${onLinkClick}
435
+ >${ctaLabel}</a>
436
+ ` : nothing}
437
+ </div>
438
+ </div>
439
+ `;
440
+ };
441
+ // ---------- Reactive properties (no decorators) --------------------------
442
+ NavWidgetLit.properties = {
443
+ // Public inputs
444
+ config: { attribute: false },
445
+ runtime: { attribute: false },
446
+ instanceId: { type: String },
447
+ // Internal reactive state
448
+ _expandedIds: { state: true },
449
+ _renderTick: { state: true },
450
+ _hoveredId: { state: true }
451
+ };
452
+ var TAG_NAME = "syntro-nav-tips";
453
+ function registerNavWidgetLit() {
454
+ if (typeof window === "undefined") return;
455
+ if (!customElements.get(TAG_NAME)) {
456
+ customElements.define(TAG_NAME, NavWidgetLit);
457
+ }
458
+ }
459
+
460
+ // src/runtime.ts
461
+ var executeScrollTo = async (action, context) => {
462
+ const anchorEl = context.resolveAnchor(action.anchorId);
463
+ if (!anchorEl) {
464
+ console.error(
465
+ `[adaptive-nav] Anchor not found for scrollTo, skipping: ${action.anchorId.selector}`
466
+ );
467
+ return { cleanup: () => {
468
+ } };
469
+ }
470
+ anchorEl.scrollIntoView({
471
+ behavior: action.behavior ?? "smooth",
472
+ block: action.block ?? "center",
473
+ inline: action.inline ?? "nearest"
474
+ });
475
+ context.publishEvent("action.applied", {
476
+ id: context.generateId(),
477
+ kind: "navigation:scrollTo",
478
+ anchorId: action.anchorId,
479
+ behavior: action.behavior ?? "smooth"
480
+ });
481
+ return {
482
+ cleanup: () => {
82
483
  }
83
- // SvelteKit — goto() isn't on window, but __SVELTEKIT_DATA__ confirms the framework.
84
- if (w.__SVELTEKIT_DATA__ || document.body?.hasAttribute('data-sveltekit')) {
85
- window.location.href = url;
86
- return true;
484
+ };
485
+ };
486
+ function navigateWithFrameworkRouter(url) {
487
+ if (typeof window === "undefined") return false;
488
+ const w = window;
489
+ try {
490
+ const nextRouter = w.next?.router;
491
+ if (nextRouter?.push) {
492
+ nextRouter.push(url);
493
+ return true;
87
494
  }
88
- // Astro (View Transitions) — no client-side router API exposed
89
- if (document.querySelector('[data-astro-transition-fallback]')) {
90
- window.location.href = url;
91
- return true;
495
+ } catch {
496
+ }
497
+ try {
498
+ if (w.$nuxt?.$router?.push) {
499
+ w.$nuxt.$router.push(url);
500
+ return true;
92
501
  }
93
- return false;
502
+ } catch {
503
+ }
504
+ if (w.ng || w.getAllAngularRootElements || document.querySelector("[ng-version]")) {
505
+ window.location.href = url;
506
+ return true;
507
+ }
508
+ if (w.__SVELTEKIT_DATA__ || document.body?.hasAttribute("data-sveltekit")) {
509
+ window.location.href = url;
510
+ return true;
511
+ }
512
+ if (document.querySelector("[data-astro-transition-fallback]")) {
513
+ window.location.href = url;
514
+ return true;
515
+ }
516
+ return false;
94
517
  }
95
- /**
96
- * Check if a URL is same-origin as the current page.
97
- * Relative URLs (e.g. "/dashboard") are always same-origin.
98
- */
99
518
  function isSameOrigin(url) {
100
- try {
101
- const parsed = new URL(url, window.location.origin);
102
- return parsed.origin === window.location.origin;
103
- }
104
- catch {
105
- // If URL parsing fails, fall back to full navigation
106
- return false;
107
- }
519
+ try {
520
+ const parsed = new URL(url, window.location.origin);
521
+ return parsed.origin === window.location.origin;
522
+ } catch {
523
+ return false;
524
+ }
108
525
  }
109
- /**
110
- * Execute a navigate action
111
- */
112
- export const executeNavigate = async (action, context) => {
113
- // Validate URL to prevent javascript: URLs
114
- const url = action.url.trim();
115
- if (url.toLowerCase().startsWith('javascript:')) {
116
- throw new Error('javascript: URLs are not allowed');
117
- }
118
- const target = action.target ?? '_self';
119
- context.publishEvent('action.applied', {
120
- id: context.generateId(),
121
- kind: 'navigation:navigate',
122
- url: action.url,
123
- target,
124
- });
125
- if (target === '_blank') {
126
- // Open in new tab
127
- window.open(url, '_blank', 'noopener,noreferrer');
526
+ var executeNavigate = async (action, context) => {
527
+ const url = action.url.trim();
528
+ if (url.toLowerCase().startsWith("javascript:")) {
529
+ throw new Error("javascript: URLs are not allowed");
530
+ }
531
+ const target = action.target ?? "_self";
532
+ context.publishEvent("action.applied", {
533
+ id: context.generateId(),
534
+ kind: "navigation:navigate",
535
+ url: action.url,
536
+ target
537
+ });
538
+ if (target === "_blank") {
539
+ window.open(url, "_blank", "noopener,noreferrer");
540
+ } else if (!action.forceFullNavigation && isSameOrigin(url)) {
541
+ if (!navigateWithFrameworkRouter(url)) {
542
+ window.history.pushState(null, "", url);
543
+ window.dispatchEvent(new PopStateEvent("popstate"));
128
544
  }
129
- else if (!action.forceFullNavigation && isSameOrigin(url)) {
130
- // Try the host framework's native router first (Next.js, Nuxt, Angular, etc.)
131
- // Falls back to pushState for vanilla SPAs, or location.href as last resort.
132
- if (!navigateWithFrameworkRouter(url)) {
133
- window.history.pushState(null, '', url);
134
- window.dispatchEvent(new PopStateEvent('popstate'));
135
- }
545
+ } else {
546
+ window.location.href = url;
547
+ }
548
+ return {
549
+ cleanup: () => {
136
550
  }
137
- else {
138
- // Full navigation for cross-origin URLs or when explicitly requested
139
- window.location.href = url;
140
- }
141
- return {
142
- cleanup: () => {
143
- // Navigation cannot be reverted
144
- },
551
+ };
552
+ };
553
+ var NavWidgetLitMountable = {
554
+ mount(container, config) {
555
+ registerNavWidgetLit();
556
+ const el = document.createElement("syntro-nav-tips");
557
+ const {
558
+ runtime: runtime2,
559
+ instanceId = "nav-widget",
560
+ ...navConfig
561
+ } = config ?? {
562
+ expandBehavior: "single",
563
+ theme: "auto",
564
+ actions: []
145
565
  };
566
+ Object.assign(el, {
567
+ config: navConfig,
568
+ runtime: runtime2,
569
+ instanceId
570
+ });
571
+ container.appendChild(el);
572
+ return () => el.remove();
573
+ }
146
574
  };
147
- // ============================================================================
148
- // Lit Mountable Widget
149
- // ============================================================================
150
- /**
151
- * NavWidgetLitMountable — Mounts the `<syntro-nav-tips>` Lit web component.
152
- *
153
- * Drop-in companion to NavMountableWidget that avoids React/ReactDOM entirely.
154
- * Self-registers the custom element on first use.
155
- */
156
- export const NavWidgetLitMountable = {
157
- mount(container, config) {
158
- registerNavWidgetLit();
159
- const el = document.createElement('syntro-nav-tips');
160
- const { runtime, instanceId = 'nav-widget', ...navConfig } = config ?? {
161
- expandBehavior: 'single',
162
- theme: 'auto',
163
- actions: [],
164
- };
165
- // Assign structured props as JS properties (not HTML attributes)
166
- Object.assign(el, {
167
- config: navConfig,
168
- runtime,
169
- instanceId,
170
- });
171
- container.appendChild(el);
172
- return () => el.remove();
173
- },
174
- };
175
- // ============================================================================
176
- // Executor Definitions for Registration
177
- // ============================================================================
178
- /**
179
- * All executors provided by this app.
180
- * These are registered with the runtime's ExecutorRegistry.
181
- */
182
- export const executors = [
183
- { kind: 'navigation:scrollTo', executor: executeScrollTo },
184
- { kind: 'navigation:navigate', executor: executeNavigate },
575
+ var executors = [
576
+ { kind: "navigation:scrollTo", executor: executeScrollTo },
577
+ { kind: "navigation:navigate", executor: executeNavigate }
185
578
  ];
186
- // ============================================================================
187
- // App Runtime Manifest
188
- // ============================================================================
189
- /**
190
- * Runtime manifest for adaptive-nav.
191
- *
192
- * Provides:
193
- * - Navigation action executors (scrollTo, navigate)
194
- * - Widget-based nav tips accordion (compositional nav:tip actions)
195
- */
196
- export const runtime = {
197
- id: 'adaptive-nav',
198
- version: '2.0.0',
199
- name: 'Navigation Tips',
200
- description: 'Navigation actions and accordion-based tips with per-item conditional visibility',
201
- /**
202
- * Navigation action executors (scrollTo, navigate).
203
- */
204
- executors,
205
- /**
206
- * Widget definitions for the runtime's WidgetRegistry.
207
- */
208
- widgets: [
209
- {
210
- id: 'adaptive-nav:tips',
211
- component: NavMountableWidget,
212
- metadata: {
213
- name: 'Navigation Tips',
214
- description: 'Accordion of contextual navigation tips with per-item visibility',
215
- icon: '\u{1F9ED}',
216
- },
217
- },
218
- ],
219
- /**
220
- * Extract notify watcher entries from tile config props.
221
- * The runtime evaluates these continuously (even with drawer closed)
222
- * and publishes nav:tip_revealed when triggerWhen transitions false → true.
223
- */
224
- notifyWatchers(props) {
225
- const actions = (props.actions ?? []);
226
- return actions
227
- .filter((a) => a.notify && a.triggerWhen)
228
- .map((a) => ({
229
- id: `nav:${a.config.id}`,
230
- strategy: a.triggerWhen,
231
- eventName: 'nav:tip_revealed',
232
- eventProps: {
233
- tipId: a.config.id,
234
- title: a.notify.title,
235
- body: a.notify.body,
236
- icon: a.notify.icon,
237
- },
238
- }));
239
- },
240
- };
241
- export default runtime;
579
+ var runtime = {
580
+ id: "adaptive-nav",
581
+ version: "2.0.0",
582
+ name: "Navigation Tips",
583
+ description: "Navigation actions and accordion-based tips with per-item conditional visibility",
584
+ /**
585
+ * Navigation action executors (scrollTo, navigate).
586
+ */
587
+ executors,
588
+ /**
589
+ * Widget definitions for the runtime's WidgetRegistry.
590
+ */
591
+ widgets: [
592
+ {
593
+ id: "adaptive-nav:tips",
594
+ component: NavWidgetLitMountable,
595
+ metadata: {
596
+ name: "Navigation Tips",
597
+ description: "Accordion of contextual navigation tips with per-item visibility",
598
+ icon: "\u{1F9ED}"
599
+ }
600
+ }
601
+ ],
602
+ /**
603
+ * Extract notify watcher entries from tile config props.
604
+ * The runtime evaluates these continuously (even with drawer closed)
605
+ * and publishes nav:tip_revealed when triggerWhen transitions false → true.
606
+ */
607
+ notifyWatchers(props) {
608
+ const actions = props.actions ?? [];
609
+ return actions.filter((a) => a.notify && a.triggerWhen).map((a) => ({
610
+ id: `nav:${a.config.id}`,
611
+ strategy: a.triggerWhen,
612
+ eventName: "nav:tip_revealed",
613
+ eventProps: {
614
+ tipId: a.config.id,
615
+ title: a.notify.title,
616
+ body: a.notify.body,
617
+ icon: a.notify.icon
618
+ }
619
+ }));
620
+ }
621
+ };
622
+ var runtime_default = runtime;
623
+ export {
624
+ NavWidgetLitMountable,
625
+ runtime_default as default,
626
+ executeNavigate,
627
+ executeScrollTo,
628
+ executors,
629
+ navigateWithFrameworkRouter,
630
+ runtime
631
+ };
632
+ //# sourceMappingURL=runtime.js.map