@fluixi/core 1.0.0-alpha.84 → 1.0.0-alpha.85

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 (49) hide show
  1. package/dist/cdn/core.global.js +2 -2
  2. package/dist/src/cdn/{chunk-VNLCQBFQ.mjs → chunk-MDJLC3PE.mjs} +87 -4
  3. package/dist/src/cdn/core.cjs +91 -5
  4. package/dist/src/cdn/core.mjs +3 -3
  5. package/dist/src/cdn/{router-WMN2AA7E.mjs → router-JYFZP3EZ.mjs} +5 -1
  6. package/dist/src/index.cjs +84 -5
  7. package/dist/src/index.mjs +86 -6
  8. package/dist/src/lib/client/{chunk-2C2KDDQV.mjs → chunk-7IUN2FLI.mjs} +1 -1
  9. package/dist/src/lib/client/index.cjs +92 -6
  10. package/dist/src/lib/client/index.mjs +4 -4
  11. package/dist/src/lib/client/{router-X526HSWQ.mjs → router-NOFEMOEH.mjs} +89 -6
  12. package/dist/src/lib/core.cjs +83 -4
  13. package/dist/src/lib/core.mjs +85 -5
  14. package/dist/src/lib/i18n/index.cjs +1 -1
  15. package/dist/src/lib/i18n/index.mjs +1 -1
  16. package/dist/src/lib/index.cjs +1 -1
  17. package/dist/src/lib/index.mjs +1 -1
  18. package/dist/src/lib/jsx-runtime/index.cjs +1 -1
  19. package/dist/src/lib/jsx-runtime/index.mjs +1 -1
  20. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.cjs +1 -1
  21. package/dist/src/lib/jsx-runtime/jsx-dev-runtime.mjs +1 -1
  22. package/dist/src/lib/plugins/index.cjs +1 -1
  23. package/dist/src/lib/plugins/index.mjs +1 -1
  24. package/dist/src/lib/render/index.cjs +1 -1
  25. package/dist/src/lib/render/index.mjs +1 -1
  26. package/dist/src/lib/render/versions.cjs +1 -1
  27. package/dist/src/lib/render/versions.mjs +1 -1
  28. package/dist/src/lib/router/index.cjs +86 -4
  29. package/dist/src/lib/router/index.d.ts +17 -14
  30. package/dist/src/lib/router/index.d.ts.map +1 -1
  31. package/dist/src/lib/router/index.js +76 -4
  32. package/dist/src/lib/router/index.mjs +88 -5
  33. package/dist/src/lib/router/transition.cjs +75 -0
  34. package/dist/src/lib/router/transition.d.ts +81 -0
  35. package/dist/src/lib/router/transition.d.ts.map +1 -0
  36. package/dist/src/lib/router/transition.js +136 -0
  37. package/dist/src/lib/router/transition.mjs +54 -0
  38. package/dist/src/lib/server/index.cjs +1 -1
  39. package/dist/src/lib/server/index.mjs +1 -1
  40. package/dist/src/routes.cjs +1 -1
  41. package/dist/src/routes.mjs +1 -1
  42. package/dist/src/utils.cjs +1 -1
  43. package/dist/src/utils.mjs +1 -1
  44. package/dist/src/version.generated.cjs +1 -1
  45. package/dist/src/version.generated.d.ts +1 -1
  46. package/dist/src/version.generated.js +1 -1
  47. package/dist/src/version.generated.mjs +1 -1
  48. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  49. package/package.json +11 -11
@@ -1,4 +1,4 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -150,6 +150,59 @@ var init_lazy = __esm({
150
150
  }
151
151
  });
152
152
 
153
+ // src/lib/router/transition.ts
154
+ function supportsViewTransitions() {
155
+ return typeof document !== "undefined" && typeof document.startViewTransition === "function";
156
+ }
157
+ function prefersReducedMotion() {
158
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
159
+ return false;
160
+ }
161
+ try {
162
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
163
+ } catch {
164
+ return false;
165
+ }
166
+ }
167
+ function shouldAnimate(mode) {
168
+ return mode !== "none" && supportsViewTransitions() && !prefersReducedMotion();
169
+ }
170
+ function prepareComponents(components) {
171
+ const pending = [];
172
+ for (const component of components) {
173
+ const preload = component?.preload;
174
+ if (typeof preload === "function") {
175
+ try {
176
+ const result = preload();
177
+ if (result && typeof result.then === "function") {
178
+ pending.push(result.catch(() => void 0));
179
+ }
180
+ } catch {
181
+ }
182
+ }
183
+ }
184
+ return pending.length ? Promise.all(pending).then(() => void 0) : null;
185
+ }
186
+ function runTransition(mode, commit) {
187
+ if (!shouldAnimate(mode)) {
188
+ return Promise.resolve(commit()).then(() => void 0);
189
+ }
190
+ const start = document.startViewTransition;
191
+ try {
192
+ const transition = start.call(document, () => commit());
193
+ transition.finished?.catch(() => void 0);
194
+ transition.ready?.catch(() => void 0);
195
+ return transition.updateCallbackDone.catch(() => void 0);
196
+ } catch {
197
+ return Promise.resolve(commit()).then(() => void 0);
198
+ }
199
+ }
200
+ var init_transition = __esm({
201
+ "src/lib/router/transition.ts"() {
202
+ "use strict";
203
+ }
204
+ });
205
+
153
206
  // src/lib/context/context.ts
154
207
  function createContext3(defaultValue, name) {
155
208
  const context = (0, import_signal7.createContext)(defaultValue, name);
@@ -320,10 +373,12 @@ __export(router_exports, {
320
373
  lazy: () => lazy,
321
374
  matchPath: () => import_router2.matchPath,
322
375
  matchRoutes: () => import_router2.matchRoutes,
376
+ prefersReducedMotion: () => prefersReducedMotion,
323
377
  preloadRoutes: () => preloadRoutes,
324
378
  revalidate: () => revalidate,
325
379
  runWithOwner: () => import_signal12.runWithOwner,
326
380
  select: () => select,
381
+ supportsViewTransitions: () => supportsViewTransitions,
327
382
  useAction: () => useAction,
328
383
  useLevelParams: () => useLevelParams,
329
384
  useLinkNavigation: () => useLinkNavigation,
@@ -382,7 +437,7 @@ function renderChild(ctx) {
382
437
  );
383
438
  (0, import_signal10.createEffect)(() => {
384
439
  const c = ctx.matched()[childIdx]?.component;
385
- setChildComp(() => c);
440
+ if ((0, import_signal10.untrack)(childComp) !== c) setChildComp(() => c);
386
441
  });
387
442
  return (0, import_signal10.createMemo)(() => {
388
443
  const component = childComp();
@@ -428,10 +483,35 @@ function Router(props) {
428
483
  history
429
484
  });
430
485
  const [state, setState] = (0, import_signal10.createSignal)(router.state());
431
- const unsub = router.subscribe(setState);
486
+ let navigationId = 0;
487
+ const takeMode = () => {
488
+ const mode = pendingTransitionMode ?? (props.transition ?? "auto");
489
+ pendingTransitionMode = void 0;
490
+ return mode;
491
+ };
492
+ const unsub = router.subscribe((next) => {
493
+ const id = ++navigationId;
494
+ const mode = takeMode();
495
+ const prepared = prepareComponents(
496
+ (next.match?.matched ?? []).map((m) => m.component).filter(Boolean)
497
+ );
498
+ const commit = () => {
499
+ setState(next);
500
+ return (0, import_signal10.flush)();
501
+ };
502
+ if (!prepared) {
503
+ void runTransition(mode, commit);
504
+ return;
505
+ }
506
+ void prepared.then(() => {
507
+ if (id !== navigationId) return;
508
+ return runTransition(mode, commit);
509
+ });
510
+ });
432
511
  (0, import_signal10.onCleanup)(() => {
433
512
  unsub();
434
513
  router.destroy();
514
+ navigationId++;
435
515
  });
436
516
  const matched = (0, import_signal10.createMemo)(
437
517
  () => (state().match?.matched ?? []).filter((m) => m.component)
@@ -558,12 +638,16 @@ function useLinkNavigation(options = {}) {
558
638
  if (url.hash && url.pathname === window.location.pathname && url.search === window.location.search) return;
559
639
  if (options.shouldNavigate && !options.shouldNavigate(url, anchor)) return;
560
640
  event.preventDefault();
641
+ pendingTransitionMode = options.transition;
561
642
  ctx.router.navigate(url.pathname + url.search + url.hash, { replace: options.replace });
562
643
  };
563
644
  }
564
645
  function useNavigate() {
565
646
  const { router } = useRouter();
566
- return (to, options) => router.navigate(to, options);
647
+ return (to, options) => {
648
+ pendingTransitionMode = options?.transition;
649
+ router.navigate(to, options);
650
+ };
567
651
  }
568
652
  function useRouteData() {
569
653
  const acc = (0, import_signal11.useContext)(RouteDataContext2);
@@ -642,11 +726,12 @@ async function preloadRoutes(routes, pathname) {
642
726
  }
643
727
  await Promise.all(loads);
644
728
  }
645
- var import_signal10, import_dom12, import_signal11, import_object, import_compare, import_router, import_router2, import_signal12, RouterContext, OutletContext, LevelParamsContext, RouteDataContext2, _ssrRouterStub, read, LINK_OWN_PROPS, A;
729
+ var import_signal10, import_dom12, import_signal11, import_object, import_compare, import_router, import_router2, import_signal12, RouterContext, OutletContext, LevelParamsContext, RouteDataContext2, pendingTransitionMode, _ssrRouterStub, read, LINK_OWN_PROPS, A;
646
730
  var init_router = __esm({
647
731
  "src/lib/router/index.ts"() {
648
732
  "use strict";
649
733
  import_signal10 = require("@fluixi/reactive/signal");
734
+ init_transition();
650
735
  import_dom12 = require("@fluixi/dom");
651
736
  import_signal11 = require("@fluixi/reactive/signal");
652
737
  import_object = require("@fluixi/utils/object");
@@ -655,6 +740,7 @@ var init_router = __esm({
655
740
  import_router2 = require("@fluixi/router");
656
741
  init_data();
657
742
  init_lazy();
743
+ init_transition();
658
744
  import_signal12 = require("@fluixi/reactive/signal");
659
745
  RouterContext = (0, import_signal11.createContext)(void 0, "router");
660
746
  OutletContext = (0, import_signal11.createContext)(void 0, "outlet");
@@ -695,7 +781,7 @@ var import_dom13 = require("@fluixi/dom");
695
781
  var import_dom = require("@fluixi/dom");
696
782
 
697
783
  // src/version.generated.ts
698
- var VERSION = "1.0.0-alpha.84";
784
+ var VERSION = "1.0.0-alpha.85";
699
785
 
700
786
  // src/lib/render/versions.ts
701
787
  var import_dom2 = require("@fluixi/dom");
@@ -1,9 +1,9 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  import {
3
3
  cleanupHydration,
4
4
  deserializeHydrationData,
5
5
  setHydrating
6
- } from "./chunk-2C2KDDQV.mjs";
6
+ } from "./chunk-7IUN2FLI.mjs";
7
7
 
8
8
  // src/lib/client/index.ts
9
9
  import {
@@ -15,7 +15,7 @@ import {
15
15
  import { registerCoreVersion } from "@fluixi/dom";
16
16
 
17
17
  // src/version.generated.ts
18
- var VERSION = "1.0.0-alpha.84";
18
+ var VERSION = "1.0.0-alpha.85";
19
19
 
20
20
  // src/lib/render/versions.ts
21
21
  import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
@@ -183,7 +183,7 @@ async function startClient(App, options = {}) {
183
183
  stripHeadMarker(container);
184
184
  if (shouldHydrate) {
185
185
  if (options.routes && options.routes.length) {
186
- const { preloadRoutes } = await import("./router-X526HSWQ.mjs");
186
+ const { preloadRoutes } = await import("./router-NOFEMOEH.mjs");
187
187
  await preloadRoutes(options.routes, window.location.pathname);
188
188
  }
189
189
  deserializeHydrationData();
@@ -1,11 +1,11 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  import {
3
3
  getHydrationData,
4
4
  isHydrating,
5
5
  isServerEnvironment,
6
6
  lazy,
7
7
  setHydrationData
8
- } from "./chunk-2C2KDDQV.mjs";
8
+ } from "./chunk-7IUN2FLI.mjs";
9
9
 
10
10
  // src/lib/router/index.ts
11
11
  import {
@@ -15,8 +15,59 @@ import {
15
15
  createEffect,
16
16
  getOwner,
17
17
  onCleanup,
18
- untrack
18
+ untrack,
19
+ flush
19
20
  } from "@fluixi/reactive/signal";
21
+
22
+ // src/lib/router/transition.ts
23
+ function supportsViewTransitions() {
24
+ return typeof document !== "undefined" && typeof document.startViewTransition === "function";
25
+ }
26
+ function prefersReducedMotion() {
27
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
28
+ return false;
29
+ }
30
+ try {
31
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
32
+ } catch {
33
+ return false;
34
+ }
35
+ }
36
+ function shouldAnimate(mode) {
37
+ return mode !== "none" && supportsViewTransitions() && !prefersReducedMotion();
38
+ }
39
+ function prepareComponents(components) {
40
+ const pending = [];
41
+ for (const component of components) {
42
+ const preload = component?.preload;
43
+ if (typeof preload === "function") {
44
+ try {
45
+ const result = preload();
46
+ if (result && typeof result.then === "function") {
47
+ pending.push(result.catch(() => void 0));
48
+ }
49
+ } catch {
50
+ }
51
+ }
52
+ }
53
+ return pending.length ? Promise.all(pending).then(() => void 0) : null;
54
+ }
55
+ function runTransition(mode, commit) {
56
+ if (!shouldAnimate(mode)) {
57
+ return Promise.resolve(commit()).then(() => void 0);
58
+ }
59
+ const start = document.startViewTransition;
60
+ try {
61
+ const transition = start.call(document, () => commit());
62
+ transition.finished?.catch(() => void 0);
63
+ transition.ready?.catch(() => void 0);
64
+ return transition.updateCallbackDone.catch(() => void 0);
65
+ } catch {
66
+ return Promise.resolve(commit()).then(() => void 0);
67
+ }
68
+ }
69
+
70
+ // src/lib/router/index.ts
20
71
  import {
21
72
  insert,
22
73
  createComponent,
@@ -235,7 +286,7 @@ function renderChild(ctx) {
235
286
  );
236
287
  createEffect(() => {
237
288
  const c = ctx.matched()[childIdx]?.component;
238
- setChildComp(() => c);
289
+ if (untrack(childComp) !== c) setChildComp(() => c);
239
290
  });
240
291
  return createMemo(() => {
241
292
  const component = childComp();
@@ -273,6 +324,7 @@ function buildDefaultNotFound() {
273
324
  el.appendChild(p);
274
325
  return el;
275
326
  }
327
+ var pendingTransitionMode;
276
328
  function Router(props) {
277
329
  const history = props.history ?? createBrowserHistory();
278
330
  const router = createCoreRouter({
@@ -281,10 +333,35 @@ function Router(props) {
281
333
  history
282
334
  });
283
335
  const [state, setState] = createSignal2(router.state());
284
- const unsub = router.subscribe(setState);
336
+ let navigationId = 0;
337
+ const takeMode = () => {
338
+ const mode = pendingTransitionMode ?? (props.transition ?? "auto");
339
+ pendingTransitionMode = void 0;
340
+ return mode;
341
+ };
342
+ const unsub = router.subscribe((next) => {
343
+ const id = ++navigationId;
344
+ const mode = takeMode();
345
+ const prepared = prepareComponents(
346
+ (next.match?.matched ?? []).map((m) => m.component).filter(Boolean)
347
+ );
348
+ const commit = () => {
349
+ setState(next);
350
+ return flush();
351
+ };
352
+ if (!prepared) {
353
+ void runTransition(mode, commit);
354
+ return;
355
+ }
356
+ void prepared.then(() => {
357
+ if (id !== navigationId) return;
358
+ return runTransition(mode, commit);
359
+ });
360
+ });
285
361
  onCleanup(() => {
286
362
  unsub();
287
363
  router.destroy();
364
+ navigationId++;
288
365
  });
289
366
  const matched = createMemo(
290
367
  () => (state().match?.matched ?? []).filter((m) => m.component)
@@ -417,12 +494,16 @@ function useLinkNavigation(options = {}) {
417
494
  if (url.hash && url.pathname === window.location.pathname && url.search === window.location.search) return;
418
495
  if (options.shouldNavigate && !options.shouldNavigate(url, anchor)) return;
419
496
  event.preventDefault();
497
+ pendingTransitionMode = options.transition;
420
498
  ctx.router.navigate(url.pathname + url.search + url.hash, { replace: options.replace });
421
499
  };
422
500
  }
423
501
  function useNavigate() {
424
502
  const { router } = useRouter();
425
- return (to, options) => router.navigate(to, options);
503
+ return (to, options) => {
504
+ pendingTransitionMode = options?.transition;
505
+ router.navigate(to, options);
506
+ };
426
507
  }
427
508
  function useRouteData() {
428
509
  const acc = useContext2(RouteDataContext2);
@@ -528,10 +609,12 @@ export {
528
609
  lazy,
529
610
  matchPath2 as matchPath,
530
611
  matchRoutes2 as matchRoutes,
612
+ prefersReducedMotion,
531
613
  preloadRoutes,
532
614
  revalidate,
533
615
  runWithOwner,
534
616
  select,
617
+ supportsViewTransitions,
535
618
  useAction,
536
619
  useLevelParams,
537
620
  useLinkNavigation,
@@ -150,7 +150,7 @@ var import_signal6 = require("@fluixi/reactive/signal");
150
150
  var import_dom = require("@fluixi/dom");
151
151
 
152
152
  // src/version.generated.ts
153
- var VERSION = "1.0.0-alpha.84";
153
+ var VERSION = "1.0.0-alpha.85";
154
154
 
155
155
  // src/lib/render/versions.ts
156
156
  var import_dom2 = require("@fluixi/dom");
@@ -886,6 +886,56 @@ function createTheme(options) {
886
886
 
887
887
  // src/lib/router/index.ts
888
888
  var import_signal12 = require("@fluixi/reactive/signal");
889
+
890
+ // src/lib/router/transition.ts
891
+ function supportsViewTransitions() {
892
+ return typeof document !== "undefined" && typeof document.startViewTransition === "function";
893
+ }
894
+ function prefersReducedMotion() {
895
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
896
+ return false;
897
+ }
898
+ try {
899
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
900
+ } catch {
901
+ return false;
902
+ }
903
+ }
904
+ function shouldAnimate(mode) {
905
+ return mode !== "none" && supportsViewTransitions() && !prefersReducedMotion();
906
+ }
907
+ function prepareComponents(components) {
908
+ const pending = [];
909
+ for (const component of components) {
910
+ const preload = component?.preload;
911
+ if (typeof preload === "function") {
912
+ try {
913
+ const result = preload();
914
+ if (result && typeof result.then === "function") {
915
+ pending.push(result.catch(() => void 0));
916
+ }
917
+ } catch {
918
+ }
919
+ }
920
+ }
921
+ return pending.length ? Promise.all(pending).then(() => void 0) : null;
922
+ }
923
+ function runTransition(mode, commit) {
924
+ if (!shouldAnimate(mode)) {
925
+ return Promise.resolve(commit()).then(() => void 0);
926
+ }
927
+ const start = document.startViewTransition;
928
+ try {
929
+ const transition = start.call(document, () => commit());
930
+ transition.finished?.catch(() => void 0);
931
+ transition.ready?.catch(() => void 0);
932
+ return transition.updateCallbackDone.catch(() => void 0);
933
+ } catch {
934
+ return Promise.resolve(commit()).then(() => void 0);
935
+ }
936
+ }
937
+
938
+ // src/lib/router/index.ts
889
939
  var import_dom15 = require("@fluixi/dom");
890
940
  var import_signal13 = require("@fluixi/reactive/signal");
891
941
  var import_object = require("@fluixi/utils/object");
@@ -988,7 +1038,7 @@ function renderChild(ctx) {
988
1038
  );
989
1039
  (0, import_signal12.createEffect)(() => {
990
1040
  const c = ctx.matched()[childIdx]?.component;
991
- setChildComp(() => c);
1041
+ if ((0, import_signal12.untrack)(childComp) !== c) setChildComp(() => c);
992
1042
  });
993
1043
  return (0, import_signal12.createMemo)(() => {
994
1044
  const component = childComp();
@@ -1026,6 +1076,7 @@ function buildDefaultNotFound() {
1026
1076
  el.appendChild(p);
1027
1077
  return el;
1028
1078
  }
1079
+ var pendingTransitionMode;
1029
1080
  function Router(props) {
1030
1081
  const history = props.history ?? (0, import_router.createBrowserHistory)();
1031
1082
  const router = (0, import_router.createRouter)({
@@ -1034,10 +1085,35 @@ function Router(props) {
1034
1085
  history
1035
1086
  });
1036
1087
  const [state, setState] = (0, import_signal12.createSignal)(router.state());
1037
- const unsub = router.subscribe(setState);
1088
+ let navigationId = 0;
1089
+ const takeMode = () => {
1090
+ const mode = pendingTransitionMode ?? (props.transition ?? "auto");
1091
+ pendingTransitionMode = void 0;
1092
+ return mode;
1093
+ };
1094
+ const unsub = router.subscribe((next) => {
1095
+ const id = ++navigationId;
1096
+ const mode = takeMode();
1097
+ const prepared = prepareComponents(
1098
+ (next.match?.matched ?? []).map((m) => m.component).filter(Boolean)
1099
+ );
1100
+ const commit = () => {
1101
+ setState(next);
1102
+ return (0, import_signal12.flush)();
1103
+ };
1104
+ if (!prepared) {
1105
+ void runTransition(mode, commit);
1106
+ return;
1107
+ }
1108
+ void prepared.then(() => {
1109
+ if (id !== navigationId) return;
1110
+ return runTransition(mode, commit);
1111
+ });
1112
+ });
1038
1113
  (0, import_signal12.onCleanup)(() => {
1039
1114
  unsub();
1040
1115
  router.destroy();
1116
+ navigationId++;
1041
1117
  });
1042
1118
  const matched = (0, import_signal12.createMemo)(
1043
1119
  () => (state().match?.matched ?? []).filter((m) => m.component)
@@ -1092,7 +1168,10 @@ function useLocation() {
1092
1168
  }
1093
1169
  function useNavigate() {
1094
1170
  const { router } = useRouter();
1095
- return (to, options) => router.navigate(to, options);
1171
+ return (to, options) => {
1172
+ pendingTransitionMode = options?.transition;
1173
+ router.navigate(to, options);
1174
+ };
1096
1175
  }
1097
1176
  var read = (v) => typeof v === "function" ? v() : v;
1098
1177
  var LINK_OWN_PROPS = /* @__PURE__ */ new Set([
@@ -38,7 +38,7 @@ import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
38
38
  import { registerCoreVersion } from "@fluixi/dom";
39
39
 
40
40
  // src/version.generated.ts
41
- var VERSION = "1.0.0-alpha.84";
41
+ var VERSION = "1.0.0-alpha.85";
42
42
 
43
43
  // src/lib/render/versions.ts
44
44
  import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
@@ -820,8 +820,59 @@ import {
820
820
  createEffect as createEffect3,
821
821
  getOwner as getOwner2,
822
822
  onCleanup as onCleanup2,
823
- untrack as untrack3
823
+ untrack as untrack3,
824
+ flush
824
825
  } from "@fluixi/reactive/signal";
826
+
827
+ // src/lib/router/transition.ts
828
+ function supportsViewTransitions() {
829
+ return typeof document !== "undefined" && typeof document.startViewTransition === "function";
830
+ }
831
+ function prefersReducedMotion() {
832
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
833
+ return false;
834
+ }
835
+ try {
836
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
837
+ } catch {
838
+ return false;
839
+ }
840
+ }
841
+ function shouldAnimate(mode) {
842
+ return mode !== "none" && supportsViewTransitions() && !prefersReducedMotion();
843
+ }
844
+ function prepareComponents(components) {
845
+ const pending = [];
846
+ for (const component of components) {
847
+ const preload = component?.preload;
848
+ if (typeof preload === "function") {
849
+ try {
850
+ const result = preload();
851
+ if (result && typeof result.then === "function") {
852
+ pending.push(result.catch(() => void 0));
853
+ }
854
+ } catch {
855
+ }
856
+ }
857
+ }
858
+ return pending.length ? Promise.all(pending).then(() => void 0) : null;
859
+ }
860
+ function runTransition(mode, commit) {
861
+ if (!shouldAnimate(mode)) {
862
+ return Promise.resolve(commit()).then(() => void 0);
863
+ }
864
+ const start = document.startViewTransition;
865
+ try {
866
+ const transition = start.call(document, () => commit());
867
+ transition.finished?.catch(() => void 0);
868
+ transition.ready?.catch(() => void 0);
869
+ return transition.updateCallbackDone.catch(() => void 0);
870
+ } catch {
871
+ return Promise.resolve(commit()).then(() => void 0);
872
+ }
873
+ }
874
+
875
+ // src/lib/router/index.ts
825
876
  import {
826
877
  insert as insert2,
827
878
  createComponent as createComponent4,
@@ -942,7 +993,7 @@ function renderChild(ctx) {
942
993
  );
943
994
  createEffect3(() => {
944
995
  const c = ctx.matched()[childIdx]?.component;
945
- setChildComp(() => c);
996
+ if (untrack3(childComp) !== c) setChildComp(() => c);
946
997
  });
947
998
  return createMemo6(() => {
948
999
  const component = childComp();
@@ -980,6 +1031,7 @@ function buildDefaultNotFound() {
980
1031
  el.appendChild(p);
981
1032
  return el;
982
1033
  }
1034
+ var pendingTransitionMode;
983
1035
  function Router(props) {
984
1036
  const history = props.history ?? createBrowserHistory();
985
1037
  const router = createCoreRouter({
@@ -988,10 +1040,35 @@ function Router(props) {
988
1040
  history
989
1041
  });
990
1042
  const [state, setState] = createSignal7(router.state());
991
- const unsub = router.subscribe(setState);
1043
+ let navigationId = 0;
1044
+ const takeMode = () => {
1045
+ const mode = pendingTransitionMode ?? (props.transition ?? "auto");
1046
+ pendingTransitionMode = void 0;
1047
+ return mode;
1048
+ };
1049
+ const unsub = router.subscribe((next) => {
1050
+ const id = ++navigationId;
1051
+ const mode = takeMode();
1052
+ const prepared = prepareComponents(
1053
+ (next.match?.matched ?? []).map((m) => m.component).filter(Boolean)
1054
+ );
1055
+ const commit = () => {
1056
+ setState(next);
1057
+ return flush();
1058
+ };
1059
+ if (!prepared) {
1060
+ void runTransition(mode, commit);
1061
+ return;
1062
+ }
1063
+ void prepared.then(() => {
1064
+ if (id !== navigationId) return;
1065
+ return runTransition(mode, commit);
1066
+ });
1067
+ });
992
1068
  onCleanup2(() => {
993
1069
  unsub();
994
1070
  router.destroy();
1071
+ navigationId++;
995
1072
  });
996
1073
  const matched = createMemo6(
997
1074
  () => (state().match?.matched ?? []).filter((m) => m.component)
@@ -1046,7 +1123,10 @@ function useLocation() {
1046
1123
  }
1047
1124
  function useNavigate() {
1048
1125
  const { router } = useRouter();
1049
- return (to, options) => router.navigate(to, options);
1126
+ return (to, options) => {
1127
+ pendingTransitionMode = options?.transition;
1128
+ router.navigate(to, options);
1129
+ };
1050
1130
  }
1051
1131
  var read = (v) => typeof v === "function" ? v() : v;
1052
1132
  var LINK_OWN_PROPS = /* @__PURE__ */ new Set([
@@ -1,4 +1,4 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,4 +1,4 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
 
3
3
  // src/lib/i18n/index.ts
4
4
  import { createSignal } from "@fluixi/reactive/signal";
@@ -116,7 +116,7 @@ var import_signal6 = require("@fluixi/reactive/signal");
116
116
  var import_dom = require("@fluixi/dom");
117
117
 
118
118
  // src/version.generated.ts
119
- var VERSION = "1.0.0-alpha.84";
119
+ var VERSION = "1.0.0-alpha.85";
120
120
 
121
121
  // src/lib/render/versions.ts
122
122
  var import_dom2 = require("@fluixi/dom");
@@ -44,7 +44,7 @@ import { createRoot as createRoot2 } from "@fluixi/reactive/signal";
44
44
  import { registerCoreVersion } from "@fluixi/dom";
45
45
 
46
46
  // src/version.generated.ts
47
- var VERSION = "1.0.0-alpha.84";
47
+ var VERSION = "1.0.0-alpha.85";
48
48
 
49
49
  // src/lib/render/versions.ts
50
50
  import { stampVersions, warnOnVersionSkew, versions } from "@fluixi/dom";
@@ -1,4 +1,4 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,4 +1,4 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
 
3
3
  // src/lib/jsx-runtime/index.ts
4
4
  export * from "@fluixi/jsx/jsx-runtime";
@@ -1,4 +1,4 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,4 +1,4 @@
1
- /*! @fluixi/core v1.0.0-alpha.84 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/core v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
 
3
3
  // src/lib/jsx-runtime/jsx-dev-runtime.ts
4
4
  export * from "@fluixi/jsx/jsx-dev-runtime";