@flight-framework/router 0.3.0 → 0.3.1

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.
@@ -1,9 +1,4 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
1
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
2
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
3
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
4
  }) : x)(function(x) {
@@ -13,22 +8,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
13
8
  var __commonJS = (cb, mod) => function __require2() {
14
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
10
  };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from))
19
- if (!__hasOwnProp.call(to, key) && key !== except)
20
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
- mod
31
- ));
32
11
 
33
12
  // src/context.ts
34
13
  var isBrowser = typeof window !== "undefined";
@@ -488,7 +467,6 @@ function redirect(url) {
488
467
  export {
489
468
  __require,
490
469
  __commonJS,
491
- __toESM,
492
470
  subscribe,
493
471
  getRouterContext,
494
472
  initRouter,
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  redirect,
20
20
  setupIntentPrefetch,
21
21
  useRouter
22
- } from "./chunk-YXMDNDIZ.js";
22
+ } from "./chunk-6WPAKUMC.js";
23
23
 
24
24
  // src/link.ts
25
25
  var isBrowser = typeof window !== "undefined";
@@ -17,7 +17,7 @@ import {
17
17
  redirect,
18
18
  setupIntentPrefetch,
19
19
  subscribe
20
- } from "../chunk-YXMDNDIZ.js";
20
+ } from "../chunk-6WPAKUMC.js";
21
21
 
22
22
  // src/preact/Link.tsx
23
23
  import { h } from "preact";
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  __commonJS,
3
3
  __require,
4
- __toESM,
5
4
  clearPrefetchCache,
6
5
  findRoute,
7
6
  generatePath,
@@ -20,7 +19,7 @@ import {
20
19
  redirect,
21
20
  setupIntentPrefetch,
22
21
  subscribe
23
- } from "../chunk-YXMDNDIZ.js";
22
+ } from "../chunk-6WPAKUMC.js";
24
23
 
25
24
  // ../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js
26
25
  var require_react_dom_production = __commonJS({
@@ -442,10 +441,19 @@ var require_react_dom = __commonJS({
442
441
  });
443
442
 
444
443
  // src/react/Link.tsx
445
- var import_react_dom = __toESM(require_react_dom(), 1);
446
444
  import { useCallback, useEffect, useRef } from "react";
447
445
  import { jsx } from "react/jsx-runtime";
448
446
  var isBrowser = typeof window !== "undefined";
447
+ var flushSyncFn = null;
448
+ if (isBrowser) {
449
+ try {
450
+ const ReactDOM = require_react_dom();
451
+ if (ReactDOM && "flushSync" in ReactDOM) {
452
+ flushSyncFn = ReactDOM.flushSync;
453
+ }
454
+ } catch {
455
+ }
456
+ }
449
457
  function isViewTransitionSupported() {
450
458
  return isBrowser && "startViewTransition" in document;
451
459
  }
@@ -470,14 +478,18 @@ function handleLinkClick(href, options, event) {
470
478
  const { viewTransition, ...navOptions } = options;
471
479
  if (viewTransition && isViewTransitionSupported()) {
472
480
  document.startViewTransition(() => {
473
- (0, import_react_dom.flushSync)(() => {
481
+ if (flushSyncFn) {
482
+ flushSyncFn(() => {
483
+ navigate2(href, navOptions);
484
+ });
485
+ } else {
474
486
  navigate2(href, navOptions);
475
- });
487
+ }
476
488
  });
477
489
  } else {
478
490
  navigate2(href, navOptions);
479
491
  }
480
- if (options.scroll !== false) {
492
+ if (options.scroll !== false && isBrowser) {
481
493
  window.scrollTo({ top: 0, left: 0, behavior: "instant" });
482
494
  }
483
495
  }
@@ -17,7 +17,7 @@ import {
17
17
  redirect,
18
18
  setupIntentPrefetch,
19
19
  subscribe
20
- } from "../chunk-YXMDNDIZ.js";
20
+ } from "../chunk-6WPAKUMC.js";
21
21
 
22
22
  // src/solid/Link.ts
23
23
  import { onCleanup } from "solid-js";
@@ -17,7 +17,7 @@ import {
17
17
  redirect,
18
18
  setupIntentPrefetch,
19
19
  subscribe
20
- } from "../chunk-YXMDNDIZ.js";
20
+ } from "../chunk-6WPAKUMC.js";
21
21
 
22
22
  // src/svelte/Link.ts
23
23
  var isBrowser = typeof window !== "undefined";
package/dist/vue/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  redirect,
18
18
  setupIntentPrefetch,
19
19
  subscribe
20
- } from "../chunk-YXMDNDIZ.js";
20
+ } from "../chunk-6WPAKUMC.js";
21
21
 
22
22
  // src/vue/Link.ts
23
23
  import { defineComponent, ref, onMounted, onUnmounted, h } from "vue";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flight-framework/router",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Agnostic client-side routing primitives for Flight Framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",