@syntrologie/adapt-nav 2.2.0-canary.8 → 2.2.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 (62) hide show
  1. package/dist/NavWidget.js +1 -1
  2. package/dist/cdn.d.ts +1 -6
  3. package/dist/cdn.d.ts.map +1 -1
  4. package/dist/cdn.js +1 -21
  5. package/dist/editor.js +2 -2
  6. package/dist/runtime.d.ts +16 -0
  7. package/dist/runtime.d.ts.map +1 -1
  8. package/dist/runtime.js +41 -1
  9. package/dist/schema.d.ts +417 -33
  10. package/dist/schema.d.ts.map +1 -1
  11. package/dist/schema.js +8 -3
  12. package/dist/types.d.ts +4 -2
  13. package/dist/types.d.ts.map +1 -1
  14. package/node_modules/@syntro/design-system/dist/tailwind-preset.d.ts.map +1 -1
  15. package/node_modules/@syntro/design-system/dist/tailwind-preset.js +23 -2
  16. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/BeforeAfterToggle.test.js +1 -0
  17. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ConditionStatusLine.test.d.ts +2 -0
  18. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ConditionStatusLine.test.d.ts.map +1 -0
  19. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ConditionStatusLine.test.js +158 -0
  20. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/DismissedSection.test.js +6 -0
  21. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorCard.test.js +1 -1
  22. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorHeader.test.js +4 -5
  23. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorPanelShell.test.d.ts +2 -0
  24. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorPanelShell.test.d.ts.map +1 -0
  25. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/EditorPanelShell.test.js +25 -0
  26. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/ElementHighlight.test.js +22 -0
  27. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/TriggerJourney.test.js +77 -14
  28. package/node_modules/@syntrologie/shared-editor-ui/dist/__tests__/formatConditionLabel.test.js +1 -1
  29. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +1 -2
  30. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +1 -1
  31. package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +4 -4
  32. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +1 -1
  33. package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +4 -4
  34. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +5 -5
  35. package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +1 -1
  36. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +1 -1
  37. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +1 -1
  38. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +1 -1
  39. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +10 -1
  40. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +1 -1
  41. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +1 -1
  42. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +1 -1
  43. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +1 -1
  44. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +5 -2
  45. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +1 -1
  46. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +4 -4
  47. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +1 -1
  48. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +1 -1
  49. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +5 -2
  50. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +1 -1
  51. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +1 -1
  52. package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +6 -4
  53. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +1 -1
  54. package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +24 -12
  55. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +1 -1
  56. package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +4 -4
  57. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +1 -1
  58. package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +12 -20
  59. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +1 -1
  60. package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +1 -1
  61. package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +1 -1
  62. package/package.json +1 -1
package/dist/NavWidget.js CHANGED
@@ -303,7 +303,7 @@ export function NavWidget({ config, runtime, instanceId }) {
303
303
  const hasCategories = useMemo(() => visibleTips.some((t) => t.config.category), [visibleTips]);
304
304
  // Resolve theme (auto → detect system preference)
305
305
  const resolvedTheme = useMemo(() => {
306
- if (config.theme !== 'auto')
306
+ if (config.theme && config.theme !== 'auto')
307
307
  return config.theme;
308
308
  if (typeof window !== 'undefined') {
309
309
  return window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
package/dist/cdn.d.ts CHANGED
@@ -33,12 +33,7 @@ export declare const manifest: {
33
33
  icon: string;
34
34
  };
35
35
  }[];
36
- /**
37
- * Extract notify watcher entries from tile config props.
38
- * The runtime evaluates these continuously (even with drawer closed)
39
- * and publishes nav:tip_revealed when showWhen transitions false → true.
40
- */
41
- notifyWatchers(props: Record<string, unknown>): {
36
+ notifyWatchers: (props: Record<string, unknown>) => {
42
37
  id: string;
43
38
  strategy: import("./types").DecisionStrategy<boolean>;
44
39
  eventName: string;
package/dist/cdn.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAIlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;2BA0DqsY,CAAC;8BAA8B,CAAC;;;;;;;;;QA/CtvY;;;;WAIG;8BACmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;+BAoBtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CAQjD,CAAC;AAaF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAGlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;2BAsC07Z,CAAC;8BAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAtBp9Z,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CAQjD,CAAC;AAaF,eAAe,QAAQ,CAAC"}
package/dist/cdn.js CHANGED
@@ -21,27 +21,7 @@ export const manifest = {
21
21
  executor,
22
22
  })),
23
23
  widgets: runtime.widgets,
24
- /**
25
- * Extract notify watcher entries from tile config props.
26
- * The runtime evaluates these continuously (even with drawer closed)
27
- * and publishes nav:tip_revealed when showWhen transitions false → true.
28
- */
29
- notifyWatchers(props) {
30
- const actions = (props.actions ?? []);
31
- return actions
32
- .filter((a) => a.notify && a.showWhen)
33
- .map((a) => ({
34
- id: `nav:${a.config.id}`,
35
- strategy: a.showWhen,
36
- eventName: 'nav:tip_revealed',
37
- eventProps: {
38
- tipId: a.config.id,
39
- title: a.notify.title,
40
- body: a.notify.body,
41
- icon: a.notify.icon,
42
- },
43
- }));
44
- },
24
+ notifyWatchers: runtime.notifyWatchers,
45
25
  },
46
26
  editor: {
47
27
  component: NavEditor,
package/dist/editor.js CHANGED
@@ -124,7 +124,7 @@ export function NavEditor({ config, onChange, editor }) {
124
124
  const typedConfig = config;
125
125
  const [dismissedKeys, setDismissedKeys] = useState(() => editor.getDismissedKeys?.() ?? new Set());
126
126
  const [editingKey, setEditingKey] = useState(null);
127
- const [previewMode, setPreviewMode] = useState('after');
127
+ const [_previewMode, setPreviewMode] = useState('after');
128
128
  const [_hoveredKey, setHoveredKey] = useState(null);
129
129
  // Sync dismissed keys back to navigation context on every change
130
130
  useEffect(() => {
@@ -209,7 +209,7 @@ export function NavEditor({ config, onChange, editor }) {
209
209
  editor.setBackHandler?.(editingKey !== null ? handleBackToList : null);
210
210
  return () => editor.setBackHandler?.(null);
211
211
  }, [editingKey, handleBackToList, editor]);
212
- const handleBeforeAfter = useCallback((mode) => {
212
+ const _handleBeforeAfter = useCallback((mode) => {
213
213
  setPreviewMode(mode);
214
214
  if (mode === 'before') {
215
215
  const filtered = filterConfig(typedConfig, new Set([editingKey]));
package/dist/runtime.d.ts CHANGED
@@ -64,6 +64,22 @@ export declare const runtime: {
64
64
  icon: string;
65
65
  };
66
66
  }[];
67
+ /**
68
+ * Extract notify watcher entries from tile config props.
69
+ * The runtime evaluates these continuously (even with drawer closed)
70
+ * and publishes nav:tip_revealed when showWhen transitions false → true.
71
+ */
72
+ notifyWatchers(props: Record<string, unknown>): {
73
+ id: string;
74
+ strategy: import("./types").DecisionStrategy<boolean>;
75
+ eventName: string;
76
+ eventProps: {
77
+ tipId: string;
78
+ title: string | undefined;
79
+ body: string | undefined;
80
+ icon: string | undefined;
81
+ };
82
+ }[];
67
83
  };
68
84
  export default runtime;
69
85
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAkB,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAM9F;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CA4B1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CAgC1D,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;EAGZ,CAAC;AAMX;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;IAMlB;;OAEG;;;;;;;;IAGH;;OAEG;;;;;uBAe0rV,CAAC;0BAA8B,CAAC;;;;;;;;;CAH9tV,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EACV,cAAc,EAEd,cAAc,EAEd,cAAc,EACf,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CA4B1D,CAAC;AAgBF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CAoC1D,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;EAGZ,CAAC;AAMX;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;IAMlB;;OAEG;;;;;;;;IAGH;;OAEG;;;;;uBAqCu1S,CAAC;0BAA8B,CAAC;;;;;;;;;IAxB13S;;;;OAIG;0BACmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;CAgB9C,CAAC;AAEF,eAAe,OAAO,CAAC"}
package/dist/runtime.js CHANGED
@@ -35,6 +35,20 @@ export const executeScrollTo = async (action, context) => {
35
35
  },
36
36
  };
37
37
  };
38
+ /**
39
+ * Check if a URL is same-origin as the current page.
40
+ * Relative URLs (e.g. "/dashboard") are always same-origin.
41
+ */
42
+ function isSameOrigin(url) {
43
+ try {
44
+ const parsed = new URL(url, window.location.origin);
45
+ return parsed.origin === window.location.origin;
46
+ }
47
+ catch {
48
+ // If URL parsing fails, fall back to full navigation
49
+ return false;
50
+ }
51
+ }
38
52
  /**
39
53
  * Execute a navigate action
40
54
  */
@@ -55,8 +69,13 @@ export const executeNavigate = async (action, context) => {
55
69
  // Open in new tab
56
70
  window.open(url, '_blank', 'noopener,noreferrer');
57
71
  }
72
+ else if (!action.forceFullNavigation && isSameOrigin(url)) {
73
+ // SPA-aware: use pushState for same-origin URLs to avoid full page reload
74
+ window.history.pushState(null, '', url);
75
+ window.dispatchEvent(new PopStateEvent('popstate'));
76
+ }
58
77
  else {
59
- // Navigate in current tab
78
+ // Full navigation for cross-origin URLs or when explicitly requested
60
79
  window.location.href = url;
61
80
  }
62
81
  return {
@@ -109,5 +128,26 @@ export const runtime = {
109
128
  },
110
129
  },
111
130
  ],
131
+ /**
132
+ * Extract notify watcher entries from tile config props.
133
+ * The runtime evaluates these continuously (even with drawer closed)
134
+ * and publishes nav:tip_revealed when showWhen transitions false → true.
135
+ */
136
+ notifyWatchers(props) {
137
+ const actions = (props.actions ?? []);
138
+ return actions
139
+ .filter((a) => a.notify && a.showWhen)
140
+ .map((a) => ({
141
+ id: `nav:${a.config.id}`,
142
+ strategy: a.showWhen,
143
+ eventName: 'nav:tip_revealed',
144
+ eventProps: {
145
+ tipId: a.config.id,
146
+ title: a.notify.title,
147
+ body: a.notify.body,
148
+ icon: a.notify.icon,
149
+ },
150
+ }));
151
+ },
112
152
  };
113
153
  export default runtime;