@sprig-and-prose/tutorial-svelte 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprig-and-prose/tutorial-svelte",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "A calm SvelteKit package that transforms markdown files into paged tutorial routes",
6
6
  "main": "src/index.js",
@@ -108,14 +108,27 @@
108
108
  const anchor = (event.target as HTMLElement)?.closest('a');
109
109
  if (!anchor) return;
110
110
 
111
- if (anchor.closest('.tutorial-nav')) return;
112
-
113
111
  const href = anchor.getAttribute('href');
114
112
  if (!href) return;
115
113
 
116
114
  if (anchor.hasAttribute('download')) return;
117
115
  if (anchor.getAttribute('target') === '_blank') return;
118
116
 
117
+ const isInNav = anchor.closest('.tutorial-nav');
118
+ if (isInNav) {
119
+ try {
120
+ const currentUrl = new URL(window.location.href);
121
+ const targetUrl = new URL(href, currentUrl);
122
+ const targetPath = normalizePath(targetUrl.pathname + targetUrl.search + targetUrl.hash);
123
+
124
+ if (targetPath !== experientialPrevious && targetPath !== experientialNext) {
125
+ return;
126
+ }
127
+ } catch {
128
+ return;
129
+ }
130
+ }
131
+
119
132
  try {
120
133
  const currentUrl = new URL(window.location.href);
121
134
  const targetUrl = new URL(href, currentUrl);