astro-tractstack 2.0.0-rc.19 → 2.0.0-rc.20

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": "astro-tractstack",
3
- "version": "2.0.0-rc.19",
3
+ "version": "2.0.0-rc.20",
4
4
  "description": "Astro integration for TractStack - redeeming the web from boring experiences",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -275,8 +275,10 @@ const fullCanonicalUrl = brandConfig?.SITE_URL
275
275
  <div
276
276
  id="loading-indicator"
277
277
  class="bg-myorange fixed left-0 top-0 z-50 h-1 w-full scale-x-0 transform transition-transform duration-300 ease-out"
278
+ style="opacity: 0.5; filter: blur(0.5px);"
278
279
  >
279
280
  </div>
281
+
280
282
  <div id="content" class="transition-opacity duration-300">
281
283
  <slot />
282
284
  </div>
@@ -297,5 +299,101 @@ const fullCanonicalUrl = brandConfig?.SITE_URL
297
299
  import '/client/belief-events.js';
298
300
  import '/client/analytics-events.js';
299
301
  </script>
302
+
303
+ <script is:inline is:persist>
304
+ // Navigation loading animation - exact copy of helpers.ts implementation
305
+ let navProgressInterval = null;
306
+ let navSafetyTimeout = null;
307
+
308
+ function startNavLoadingAnimation() {
309
+ const loadingIndicator = document.getElementById('loading-indicator');
310
+
311
+ if (
312
+ window.matchMedia('(prefers-reduced-motion: no-preference)')
313
+ .matches &&
314
+ loadingIndicator
315
+ ) {
316
+ // Clear any existing safety timeout
317
+ if (navSafetyTimeout !== null) {
318
+ clearTimeout(navSafetyTimeout);
319
+ navSafetyTimeout = null;
320
+ }
321
+
322
+ loadingIndicator.style.transform = 'scaleX(0)';
323
+ loadingIndicator.style.display = 'block';
324
+
325
+ let progress = 0;
326
+ navProgressInterval = setInterval(() => {
327
+ progress += 2;
328
+ if (progress > 90) {
329
+ if (navProgressInterval !== null) {
330
+ clearInterval(navProgressInterval);
331
+ }
332
+ return;
333
+ }
334
+ loadingIndicator.style.transform = `scaleX(${progress / 100})`;
335
+ }, 20);
336
+
337
+ // AUTOMATIC SHUTOFF: Always stop after 10 seconds
338
+ navSafetyTimeout = setTimeout(() => {
339
+ stopNavLoadingAnimation();
340
+ }, 10000);
341
+ }
342
+ }
343
+
344
+ function stopNavLoadingAnimation() {
345
+ const loadingIndicator = document.getElementById('loading-indicator');
346
+ const content = document.getElementById('content');
347
+
348
+ // Clear safety timeout
349
+ if (navSafetyTimeout !== null) {
350
+ clearTimeout(navSafetyTimeout);
351
+ navSafetyTimeout = null;
352
+ }
353
+
354
+ if (
355
+ window.matchMedia('(prefers-reduced-motion: no-preference)')
356
+ .matches &&
357
+ loadingIndicator
358
+ ) {
359
+ if (navProgressInterval !== null) {
360
+ clearInterval(navProgressInterval);
361
+ navProgressInterval = null;
362
+ }
363
+ loadingIndicator.style.transform = 'scaleX(1)';
364
+ content.style.opacity = '1';
365
+
366
+ setTimeout(() => {
367
+ loadingIndicator.style.display = 'none';
368
+ loadingIndicator.style.transform = 'scaleX(0)';
369
+ }, 300);
370
+ }
371
+ }
372
+
373
+ // Set up navigation loading
374
+ function setupNavigationLoading() {
375
+ document.addEventListener('astro:before-preparation', () => {
376
+ startNavLoadingAnimation();
377
+ });
378
+
379
+ document.addEventListener('astro:page-load', () => {
380
+ stopNavLoadingAnimation();
381
+ });
382
+
383
+ document.addEventListener('astro:after-swap', () => {
384
+ stopNavLoadingAnimation();
385
+ });
386
+ }
387
+
388
+ // Initialize
389
+ if (document.readyState === 'loading') {
390
+ document.addEventListener('DOMContentLoaded', setupNavigationLoading);
391
+ } else {
392
+ setupNavigationLoading();
393
+ }
394
+
395
+ // Re-setup after navigation
396
+ document.addEventListener('astro:page-load', setupNavigationLoading);
397
+ </script>
300
398
  </body>
301
399
  </html>