@askrjs/askr 0.4.0 → 0.4.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/dist/actions/index.js +4 -4
  3. package/dist/benchmark.js +6 -6
  4. package/dist/boot/index.js +1 -1
  5. package/dist/{boot-DaoTYoCw.js → boot-C5HnQZio.js} +79 -36
  6. package/dist/{browser-activity-CB8e-V4f.js → browser-activity-2r5gA1Cb.js} +6 -4
  7. package/dist/components/index.js +1 -1
  8. package/dist/{compose-ref-DWzdbxsD.js → compose-ref-ccRU59BM.js} +7 -1
  9. package/dist/control/index.js +1 -1
  10. package/dist/{control-nfpT2fbK.js → control-hr3B0QaD.js} +4 -2
  11. package/dist/{csp-nonce-DwGw1A6Q.js → csp-nonce-D-XM_uuJ.js} +1 -1
  12. package/dist/data/index.js +3 -3
  13. package/dist/{data-BCwClJiF.js → data-BsnOUpQ6.js} +18 -8
  14. package/dist/{data-runtime-C1bFAlba.js → data-runtime-i-RD0Ffm.js} +1 -1
  15. package/dist/{deferred-bEEHHvic.js → deferred-nGZglpj6.js} +5 -5
  16. package/dist/{error-boundary-Bpwofwps.js → error-boundary-ChXoIFVl.js} +2 -2
  17. package/dist/foundations/index.js +2 -2
  18. package/dist/foundations/interactions/index.js +1 -1
  19. package/dist/foundations/state/index.js +1 -1
  20. package/dist/foundations/structures/index.js +2 -2
  21. package/dist/foundations/utilities/index.js +1 -1
  22. package/dist/fx/index.js +2 -2
  23. package/dist/{hooks-BimKStr4.js → hooks-kjLigwDJ.js} +1 -1
  24. package/dist/index.js +5 -5
  25. package/dist/{instance-BAnfmXOR.js → instance-DL-YKrj6.js} +6 -2
  26. package/dist/{interactions-D2BoREb-.js → interactions-BAa2xuJ-.js} +1 -1
  27. package/dist/{manifest-CW9gyNBY.js → manifest-BNupb86f.js} +1 -1
  28. package/dist/{navigate-CP_0Zy5U.js → navigate-DsfO12hB.js} +95 -79
  29. package/dist/{portal-DuOKfnLa.js → portal-LYf4cbHd.js} +3 -3
  30. package/dist/{query-registry-WMCN0BJL.js → query-registry-tzSiVrV_.js} +7 -2
  31. package/dist/{render-sync-IC5lMFpq.js → render-sync-CUxvoVab.js} +28 -12
  32. package/dist/{resolution-Cx82-xjW.js → resolution-CF1BqHLm.js} +22 -8
  33. package/dist/{resource-CLjB7RBQ.js → resource-BhcaFqdB.js} +2 -2
  34. package/dist/resources/index.js +25 -27
  35. package/dist/router/index.js +8 -8
  36. package/dist/{scope-CwpVSHVf.js → scope-ila_zaId.js} +2 -2
  37. package/dist/ssg/index.js +43 -14
  38. package/dist/ssr/index.js +2 -2
  39. package/dist/{ssr-BJ8ug7zH.js → ssr-9LOx_bEu.js} +6 -6
  40. package/dist/{ssr-DoV-vJ-5.js → ssr-DPfdcq0e.js} +1 -1
  41. package/dist/{state-DWO1KzkX.js → state-i9D4EtY6.js} +19 -1
  42. package/dist/{structures-D4dDMqHX.js → structures-CkehlOT3.js} +1 -1
  43. package/dist/testing/index.js +6 -6
  44. package/dist/{url-CnbfpX0K.js → url-C9xMpMMv.js} +6 -6
  45. package/dist/{verify-hydration-DpVaDnqz.js → verify-hydration-D_cyn1OX.js} +4 -4
  46. package/package.json +1 -1
@@ -251,6 +251,10 @@ function runWithOwner(owner, fn) {
251
251
  currentOwner = previous;
252
252
  }
253
253
  }
254
+ function throwCollected(errors, message) {
255
+ if (errors.length === 1) throw errors[0];
256
+ if (errors.length > 1) throw new AggregateError(errors, message);
257
+ }
254
258
  //#endregion
255
259
  //#region src/core/reactive/graph.ts
256
260
  /**
@@ -476,7 +480,7 @@ var Computation = class Computation extends Owner {
476
480
  if (!wasClean && !dropped) return;
477
481
  this._dropped = false;
478
482
  if (this._schedule) this._schedule(this);
479
- if (!wasClean) return;
483
+ if (!wasClean && !dropped) return;
480
484
  const observers = this._observers;
481
485
  if (observers) for (const observer of observers) observer._mark(CHECK);
482
486
  }
@@ -985,4 +989,4 @@ function getRenderHost() {
985
989
  return renderHost;
986
990
  }
987
991
  //#endregion
988
- export { untrack as A, schedule as C, isTracking as D, getTrackingComputation as E, logger as F, isDevelopmentEnvironment as I, isProductionEnvironment as L, getOwner as M, runWithOwner as N, notifySource as O, configureRenderDiagnostics as P, queueTask as S, Signal as T, batch as _, getCurrentInstance as a, getFlushVersion as b, setRenderHost as c, recordUndo as d, rewindJournal as f, outsideRendering as g, isRendering as h, getContextEpoch as i, Owner as j, trackSource as k, createRenderJournal as l, withRenderJournal as m, HookOrderChangeError as n, getRenderHost as o, settleJournal as p, claimHook as r, requireInstance as s, ComponentInstance as t, journalMark as u, effectScheduler as v, Computation as w, isFlushing as x, flushSync as y };
992
+ export { untrack as A, schedule as C, isTracking as D, getTrackingComputation as E, configureRenderDiagnostics as F, logger as I, isDevelopmentEnvironment as L, getOwner as M, runWithOwner as N, notifySource as O, throwCollected as P, isProductionEnvironment as R, queueTask as S, Signal as T, batch as _, getCurrentInstance as a, getFlushVersion as b, setRenderHost as c, recordUndo as d, rewindJournal as f, outsideRendering as g, isRendering as h, getContextEpoch as i, Owner as j, trackSource as k, createRenderJournal as l, withRenderJournal as m, HookOrderChangeError as n, getRenderHost as o, settleJournal as p, claimHook as r, requireInstance as s, ComponentInstance as t, journalMark as u, effectScheduler as v, Computation as w, isFlushing as x, flushSync as y };
@@ -1,4 +1,4 @@
1
- import { o as mergeProps, r as ariaDisabled, s as composeHandlers, t as composeRefs } from "./compose-ref-DWzdbxsD.js";
1
+ import { o as mergeProps, r as ariaDisabled, s as composeHandlers, t as composeRefs } from "./compose-ref-ccRU59BM.js";
2
2
  //#region src/foundations/interactions/pressable.ts
3
3
  /** Produce click/keyboard props implementing 'press' semantics for an element. */
4
4
  function pressable({ disabled, onPress, isNativeButton = false }) {
@@ -1,4 +1,4 @@
1
- import { $ as withRouteTable, G as getRouteRecords, H as getDefaultRouteAuthOptions, J as insertRecordSorted, O as addRouteToStores, Q as setDefaultRouteBasePath, S as normalizeRouteBasePath, U as getDefaultRouteBasePath, W as getRouteList, Z as setDefaultRouteAuthOptions, j as createRouteTable } from "./resolution-Cx82-xjW.js";
1
+ import { $ as withRouteTable, G as getRouteRecords, H as getDefaultRouteAuthOptions, J as insertRecordSorted, O as addRouteToStores, Q as setDefaultRouteBasePath, S as normalizeRouteBasePath, U as getDefaultRouteBasePath, W as getRouteList, Z as setDefaultRouteAuthOptions, j as createRouteTable } from "./resolution-CF1BqHLm.js";
2
2
  //#region src/common/execution-model.ts
3
3
  const EXECUTION_MODEL_KEY = Symbol.for("__ASKR_EXECUTION_MODEL__");
4
4
  function getExecutionModel() {
@@ -1,10 +1,10 @@
1
- import { F as logger, I as isDevelopmentEnvironment, L as isProductionEnvironment, x as isFlushing, y as flushSync } from "./instance-BAnfmXOR.js";
2
- import { b as reportUncaughtErrorLater, c as onCommit, i as currentComponent, n as createSource, o as hookSlot, r as currentAppRuntime, s as notify, u as readSource } from "./hooks-BimKStr4.js";
1
+ import { I as logger, L as isDevelopmentEnvironment, R as isProductionEnvironment, x as isFlushing, y as flushSync } from "./instance-DL-YKrj6.js";
2
+ import { b as reportUncaughtErrorLater, c as onCommit, i as currentComponent, n as createSource, o as hookSlot, r as currentAppRuntime, s as notify, u as readSource } from "./hooks-kjLigwDJ.js";
3
3
  import { n as getActiveRenderContext } from "./render-context-DGHnEveC.js";
4
4
  import { n as isPromiseLike } from "./promise-Dz8iIHAm.js";
5
- import { C as removeRouteBasePath, E as parseLocation, M as getActiveRouteBasePath, N as getActiveRoutes, T as makeQuery, Y as lockRouteRegistration, a as resolveRouteRequest, b as addLogicalRouteBasePath, g as computeRouteActivityMatches, h as computeMatchesFromRoutes, i as hasRouteRenderData, n as getRouteRenderContext, r as getRouteRenderData, w as deepFreeze } from "./resolution-Cx82-xjW.js";
5
+ import { C as removeRouteBasePath, E as parseLocation, M as getActiveRouteBasePath, N as getActiveRoutes, T as makeQuery, Y as lockRouteRegistration, a as resolveRouteRequest, b as addLogicalRouteBasePath, g as computeRouteActivityMatches, h as computeMatchesFromRoutes, i as hasRouteRenderData, n as getRouteRenderContext, r as getRouteRenderData, w as deepFreeze } from "./resolution-CF1BqHLm.js";
6
6
  import { n as syncRouteActivitySnapshot } from "./route-activity-CNJfpwx-.js";
7
- import { c as resolveNavigationUrl } from "./url-CnbfpX0K.js";
7
+ import { c as resolveNavigationUrl } from "./url-C9xMpMMv.js";
8
8
  //#region src/common/app-render-runtime.ts
9
9
  const stagedRouteLocations = /* @__PURE__ */ new WeakMap();
10
10
  function createAppRenderRuntime(input = {}) {
@@ -19,11 +19,17 @@ function createAppRenderRuntime(input = {}) {
19
19
  lifetime: input.lifetime
20
20
  };
21
21
  }
22
- function stageAppRenderRouteLocation(runtime, href) {
23
- stagedRouteLocations.set(runtime, href);
22
+ function stageAppRenderRouteLocation(runtime, href, state) {
23
+ stagedRouteLocations.set(runtime, {
24
+ href,
25
+ state
26
+ });
24
27
  }
25
28
  function getStagedAppRenderRouteLocation(runtime) {
26
- return runtime ? stagedRouteLocations.get(runtime) : void 0;
29
+ return runtime ? stagedRouteLocations.get(runtime)?.href : void 0;
30
+ }
31
+ function getStagedAppRenderRouteState(runtime) {
32
+ return runtime ? stagedRouteLocations.get(runtime)?.state : void 0;
27
33
  }
28
34
  function clearStagedAppRenderRouteLocation(runtime) {
29
35
  if (runtime) stagedRouteLocations.delete(runtime);
@@ -53,15 +59,10 @@ function onRouteChange(fn, options = {}) {
53
59
  const slot = hookSlot(instance, "onRouteChange", () => ({
54
60
  kind: "route-change",
55
61
  previous: null,
56
- pending: null,
57
62
  cleanup: null,
58
- cleanupRegistered: false,
59
- callback: fn,
60
- immediate: options.immediate === true
63
+ cleanupRegistered: false
61
64
  }));
62
- slot.pending = route;
63
- slot.callback = fn;
64
- slot.immediate = options.immediate === true;
65
+ const immediate = options.immediate === true;
65
66
  if (!slot.cleanupRegistered) {
66
67
  instance.onCleanup(() => {
67
68
  slot.cleanup?.();
@@ -69,27 +70,27 @@ function onRouteChange(fn, options = {}) {
69
70
  });
70
71
  slot.cleanupRegistered = true;
71
72
  }
72
- if (!slot.previous) {
73
- onCommit(instance, () => {
74
- const committed = slot.pending;
75
- if (!committed) return;
76
- if (slot.immediate) slot.cleanup = slot.callback(committed, null) ?? null;
77
- slot.previous = committed;
78
- });
79
- return;
80
- }
81
- if (routeSignature(slot.previous) === routeSignature(route)) return;
82
73
  onCommit(instance, () => {
83
74
  const previous = slot.previous;
84
- const committed = slot.pending;
85
- if (!previous || !committed || routeSignature(previous) === routeSignature(committed)) return;
75
+ if (!previous) {
76
+ if (immediate) slot.cleanup = fn(route, null) ?? null;
77
+ slot.previous = route;
78
+ return;
79
+ }
80
+ if (routeSignature(previous) === routeSignature(route)) return;
86
81
  slot.cleanup?.();
87
- slot.cleanup = slot.callback(committed, previous) ?? null;
88
- slot.previous = committed;
82
+ slot.cleanup = fn(route, previous) ?? null;
83
+ slot.previous = route;
89
84
  });
90
85
  }
91
86
  let serverLocation = null;
92
87
  function readLocationState() {
88
+ if (getActiveRenderContext()?.mode === "ssr") return {
89
+ hasState: false,
90
+ state: void 0
91
+ };
92
+ const staged = getStagedAppRenderRouteState(currentAppRuntime());
93
+ if (staged) return staged;
93
94
  const historyState = typeof window !== "undefined" && window.history?.state ? window.history.state : null;
94
95
  const hasState = historyState?.askrHasState === true;
95
96
  return {
@@ -863,11 +864,12 @@ function getResolvedRouteHandler(resolved) {
863
864
  params: resolved.params
864
865
  };
865
866
  }
866
- function prepareNavigationRoot(target, href, replaceLifetime) {
867
+ function prepareNavigationRoot(target, href, replaceLifetime, locationState) {
867
868
  const resolved = target.resolved;
868
869
  return prepareRootUpdate(target.app.instance, {
869
870
  handler: bindResolvedRouteHandler(getResolvedRouteHandler(resolved)),
870
871
  href,
872
+ locationState,
871
873
  routeData: isRenderResult(resolved) ? getRouteRenderData(resolved) : void 0,
872
874
  hasRouteData: isRenderResult(resolved) && hasRouteRenderData(resolved),
873
875
  replaceLifetime
@@ -927,14 +929,19 @@ function applyNavigationTargets(requestId, path, options, redirectState, pathnam
927
929
  return;
928
930
  }
929
931
  if (isStaleRouteRequest(requestId)) return;
930
- commitNavigationRoots(requestId, pathname, href, matchedTargets, () => {
932
+ const hasState = Object.prototype.hasOwnProperty.call(options, "state");
933
+ const locationState = {
934
+ hasState,
935
+ state: hasState ? options.state : void 0
936
+ };
937
+ commitNavigationRoots(requestId, pathname, href, matchedTargets, locationState, () => {
931
938
  saveScrollPosition(previousHref);
932
939
  const historyMode = getNavigationHistoryMode(options);
933
940
  const historyIndex = nextHistoryIndex(historyMode);
934
941
  window.history[historyMode === "replace" ? "replaceState" : "pushState"]({
935
942
  path: href,
936
- askrHasState: Object.prototype.hasOwnProperty.call(options, "state"),
937
- askrState: options.state,
943
+ askrHasState: locationState.hasState,
944
+ askrState: locationState.state,
938
945
  askrIndex: historyIndex
939
946
  }, "", toDocumentUrl(href));
940
947
  commitHistoryIndex(historyIndex);
@@ -961,7 +968,12 @@ function applyPopStateNavigationTargets(requestId, previousHref, historyIndex, p
961
968
  return;
962
969
  }
963
970
  saveScrollPosition(previousHref);
964
- commitNavigationRoots(requestId, pathname, href, matchedTargets, () => commitHistoryIndex(historyIndex), () => applyHistoryScroll(href, state), () => {
971
+ const historyState = state;
972
+ const hasState = historyState?.askrHasState === true;
973
+ commitNavigationRoots(requestId, pathname, href, matchedTargets, {
974
+ hasState,
975
+ state: hasState ? historyState?.askrState : void 0
976
+ }, () => commitHistoryIndex(historyIndex), () => applyHistoryScroll(href, state), () => {
965
977
  if (isStaleRouteRequest(requestId)) return;
966
978
  if (!returnToRenderedHistoryEntry()) reloadDocument();
967
979
  });
@@ -971,7 +983,7 @@ function applyPopStateNavigationTargets(requestId, previousHref, historyIndex, p
971
983
  * work of the committed destination runs before history is updated, so a
972
984
  * navigation it starts supersedes this one.
973
985
  */
974
- function commitNavigationRoots(requestId, pathname, href, targets, updateHistory, updateScroll, restoreHistory) {
986
+ function commitNavigationRoots(requestId, pathname, href, targets, locationState, updateHistory, updateScroll, restoreHistory) {
975
987
  const previousPathname = getCurrentPathname();
976
988
  const previousHref = getCurrentHref();
977
989
  const roots = targets.map((target) => {
@@ -979,58 +991,62 @@ function commitNavigationRoots(requestId, pathname, href, targets, updateHistory
979
991
  return {
980
992
  target,
981
993
  replaceLifetime,
982
- prepared: prepareNavigationRoot(target, href, replaceLifetime)
994
+ prepared: prepareNavigationRoot(target, href, replaceLifetime, locationState)
983
995
  };
984
996
  });
985
- const rollback = () => {
986
- const errors = [];
987
- for (let index = roots.length - 1; index >= 0; index--) errors.push(...roots[index].prepared.rollback());
988
- setCurrentRouteLocation(previousPathname, previousHref);
997
+ try {
998
+ const rollback = () => {
999
+ const errors = [];
1000
+ for (let index = roots.length - 1; index >= 0; index--) errors.push(...roots[index].prepared.rollback());
1001
+ setCurrentRouteLocation(previousPathname, previousHref);
1002
+ try {
1003
+ restoreHistory?.();
1004
+ } catch (error) {
1005
+ errors.push(error);
1006
+ }
1007
+ reportRouteCleanupErrors(errors);
1008
+ };
989
1009
  try {
990
- restoreHistory?.();
1010
+ for (const replaceLifetime of [true, false]) for (const root of roots) if (root.replaceLifetime === replaceLifetime) root.prepared.apply();
991
1011
  } catch (error) {
992
- errors.push(error);
1012
+ rollback();
1013
+ logger.error("[Askr] navigation failed:", error);
1014
+ throw error;
993
1015
  }
994
- reportRouteCleanupErrors(errors);
995
- };
996
- try {
997
- for (const replaceLifetime of [true, false]) for (const root of roots) if (root.replaceLifetime === replaceLifetime) root.prepared.apply();
998
- } catch (error) {
999
- rollback();
1000
- logger.error("[Askr] navigation failed:", error);
1001
- throw error;
1002
- }
1003
- if (isStaleRouteRequest(requestId)) {
1004
- rollback();
1005
- return;
1006
- }
1007
- const committedFailures = [];
1008
- for (const root of roots) {
1009
- const result = root.prepared.publish();
1010
- if (result.aborted) {
1016
+ if (isStaleRouteRequest(requestId)) {
1011
1017
  rollback();
1012
- const failure = result.errors[0];
1013
- logger.error("[Askr] navigation failed:", failure);
1014
- throw failure;
1018
+ return;
1015
1019
  }
1016
- committedFailures.push(...result.errors);
1017
- syncAppRegistrationLocation(root.target.app, pathname, href);
1018
- }
1019
- for (const failure of committedFailures) reportUncaughtErrorLater(failure);
1020
- const retired = [];
1021
- for (const root of roots) retired.push(...root.prepared.retire());
1022
- if (retired.length) reportUncaughtErrorLater(retired.length === 1 ? retired[0] : new AggregateError(retired, "Route cleanup failed"));
1023
- flushSync();
1024
- if (isStaleRouteRequest(requestId)) return;
1025
- try {
1026
- updateHistory();
1027
- setCurrentRouteLocation(pathname, href);
1028
- syncRegisteredRouteSnapshot();
1029
- reconcileNavigationMetadata(targets);
1030
- updateScroll();
1031
- } catch (error) {
1032
- logger.error("[Askr] navigation failed:", error);
1033
- throw error;
1020
+ const committedFailures = [];
1021
+ for (const root of roots) {
1022
+ const result = root.prepared.publish();
1023
+ if (result.aborted) {
1024
+ rollback();
1025
+ const failure = result.errors[0];
1026
+ logger.error("[Askr] navigation failed:", failure);
1027
+ throw failure;
1028
+ }
1029
+ committedFailures.push(...result.errors);
1030
+ syncAppRegistrationLocation(root.target.app, pathname, href);
1031
+ }
1032
+ for (const failure of committedFailures) reportUncaughtErrorLater(failure);
1033
+ const retired = [];
1034
+ for (const root of roots) retired.push(...root.prepared.retire());
1035
+ if (retired.length) reportUncaughtErrorLater(retired.length === 1 ? retired[0] : new AggregateError(retired, "Route cleanup failed"));
1036
+ flushSync();
1037
+ if (isStaleRouteRequest(requestId)) return;
1038
+ try {
1039
+ updateHistory();
1040
+ setCurrentRouteLocation(pathname, href);
1041
+ syncRegisteredRouteSnapshot();
1042
+ reconcileNavigationMetadata(targets);
1043
+ updateScroll();
1044
+ } catch (error) {
1045
+ logger.error("[Askr] navigation failed:", error);
1046
+ throw error;
1047
+ }
1048
+ } finally {
1049
+ for (const root of roots) root.prepared.complete();
1034
1050
  }
1035
1051
  }
1036
1052
  //#endregion
@@ -1,8 +1,8 @@
1
- import { M as getOwner, T as Signal, d as recordUndo, o as getRenderHost } from "./instance-BAnfmXOR.js";
1
+ import { M as getOwner, T as Signal, d as recordUndo, o as getRenderHost } from "./instance-DL-YKrj6.js";
2
2
  import { t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
3
- import { i as currentComponent, m as deliverToBoundary } from "./hooks-BimKStr4.js";
3
+ import { i as currentComponent, m as deliverToBoundary } from "./hooks-kjLigwDJ.js";
4
4
  import { n as getActiveRenderContext } from "./render-context-DGHnEveC.js";
5
- import { i as OWNED_TYPE, n as holdUntilBoundaryRecovers, r as nearestErrorBoundary, t as ErrorBoundary } from "./error-boundary-Bpwofwps.js";
5
+ import { i as OWNED_TYPE, n as holdUntilBoundaryRecovers, r as nearestErrorBoundary, t as ErrorBoundary } from "./error-boundary-ChXoIFVl.js";
6
6
  //#region src/common/portal.ts
7
7
  /**
8
8
  * Internal marker used to defer server portal host output until all writes in
@@ -1,4 +1,4 @@
1
- import { a as getDefaultDataRuntime, d as writePrefetchedQueryData, i as findDataRuntimeState, t as createDataRuntime } from "./data-runtime-C1bFAlba.js";
1
+ import { a as getDefaultDataRuntime, d as writePrefetchedQueryData, i as findDataRuntimeState, t as createDataRuntime } from "./data-runtime-i-RD0Ffm.js";
2
2
  //#region src/common/deferred-value.ts
3
3
  const DEFERRED_VALUE = Symbol.for("@askrjs/askr/deferred-value");
4
4
  const DEFERRED_BOUNDARY = Symbol.for("@askrjs/askr/deferred-boundary");
@@ -303,7 +303,12 @@ function dehydrateDataRuntime(runtime) {
303
303
  const result = {};
304
304
  for (const [key, value] of runtime.queryData) {
305
305
  assertQueryDataTransportSafe(key, value);
306
- result[key] = value;
306
+ Object.defineProperty(result, key, {
307
+ value,
308
+ enumerable: true,
309
+ configurable: true,
310
+ writable: true
311
+ });
307
312
  }
308
313
  return result;
309
314
  }
@@ -1,17 +1,17 @@
1
- import { A as untrack, F as logger, j as Owner, t as ComponentInstance } from "./instance-BAnfmXOR.js";
1
+ import { A as untrack, I as logger, j as Owner, t as ComponentInstance } from "./instance-DL-YKrj6.js";
2
2
  import { n as readValue } from "./readable-DFWOsTac.js";
3
3
  import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
4
- import { v as clarifyRenderOverflow } from "./hooks-BimKStr4.js";
5
- import { r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-DwGw1A6Q.js";
4
+ import { v as clarifyRenderOverflow } from "./hooks-kjLigwDJ.js";
5
+ import { r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-D-XM_uuJ.js";
6
6
  import { C as withHydrationRenderUrl, T as SSRDataMissingError, _ as createPageRenderEnvelope, b as isPageRenderEnvelope, f as startRenderPhase$1, m as stopRenderPhase$1, r as getCurrentRenderData, t as configureRenderContextProvider, w as withPageFramework, y as isEmptyPageRenderEnvelope } from "./render-context-DGHnEveC.js";
7
- import { o as functionChildOutput, s as normalizeChildren } from "./error-boundary-Bpwofwps.js";
7
+ import { o as functionChildOutput, s as normalizeChildren } from "./error-boundary-ChXoIFVl.js";
8
8
  import { n as isPromiseLike } from "./promise-Dz8iIHAm.js";
9
- import { d as DEFERRED_BOUNDARY, i as dehydrateDataRuntime, p as isDeferred } from "./query-registry-WMCN0BJL.js";
10
- import { ft as getRouteHydrationMetadata, ht as validateRouteHydrationData } from "./resolution-Cx82-xjW.js";
11
- import { a as SSR_PORTAL_HOST, n as Portal, o as comparePortalWriterOrder, s as createSSRPortalAnchorToken, t as DefaultPortal } from "./portal-DuOKfnLa.js";
12
- import { t as createDataRuntime } from "./data-runtime-C1bFAlba.js";
13
- import { d as isCustomElementName, o as isUnsafeUrlAttribute, s as rejectUnsafeUrlAttribute, u as getPublicAttributeName } from "./url-CnbfpX0K.js";
14
- import { d as booleanAttributeValue, f as isSkippedProp, h as styleValueText, l as isPropertyOnlyProp, m as normalizeStylePropertyName, p as keepsFalseValue, r as sanitizeCssValue, t as SSR_RENDER_DATA_ATTR } from "./ssr-DoV-vJ-5.js";
9
+ import { d as DEFERRED_BOUNDARY, i as dehydrateDataRuntime, p as isDeferred } from "./query-registry-tzSiVrV_.js";
10
+ import { ft as getRouteHydrationMetadata, ht as validateRouteHydrationData } from "./resolution-CF1BqHLm.js";
11
+ import { a as SSR_PORTAL_HOST, n as Portal, o as comparePortalWriterOrder, s as createSSRPortalAnchorToken, t as DefaultPortal } from "./portal-LYf4cbHd.js";
12
+ import { t as createDataRuntime } from "./data-runtime-i-RD0Ffm.js";
13
+ import { d as isCustomElementName, o as isUnsafeUrlAttribute, s as rejectUnsafeUrlAttribute, u as getPublicAttributeName } from "./url-C9xMpMMv.js";
14
+ import { d as booleanAttributeValue, f as isSkippedProp, h as styleValueText, l as isPropertyOnlyProp, m as normalizeStylePropertyName, p as keepsFalseValue, r as sanitizeCssValue, t as SSR_RENDER_DATA_ATTR } from "./ssr-DPfdcq0e.js";
15
15
  //#region src/ssr/escape.ts
16
16
  /**
17
17
  * HTML escaping utilities for SSR
@@ -321,7 +321,7 @@ const REDACTED_DEFERRED_ERROR = "Deferred value rejected.";
321
321
  function exposedDeferredError(error) {
322
322
  return error instanceof Error && error.expose === true ? error.message : REDACTED_DEFERRED_ERROR;
323
323
  }
324
- function hydrationReplacer(_key, value) {
324
+ function hydrationReplacer(value) {
325
325
  if (!isDeferred(value)) return value;
326
326
  if (value.state === "fulfilled") return {
327
327
  [DEFERRED_PAYLOAD]: "fulfilled",
@@ -368,7 +368,23 @@ function serializeHydrationRenderData(data, runtime) {
368
368
  const routeHydration = getRouteHydrationMetadata(payload.framework);
369
369
  if (routeHydration) validateRouteHydrationData(payload.route, routeHydration.r);
370
370
  if (isEmptyPageRenderEnvelope(payload)) return "";
371
- return `<script type="application/json" ${SSR_RENDER_DATA_ATTR}="true">${JSON.stringify(payload, hydrationReplacer).replace(/</g, "\\u003C").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029")}<\/script>`;
371
+ const deferredPaths = [];
372
+ const paths = /* @__PURE__ */ new WeakMap();
373
+ let hasDeferredMarker = false;
374
+ return `<script type="application/json" ${SSR_RENDER_DATA_ATTR}="true">${JSON.stringify({
375
+ ...payload,
376
+ get deferredPaths() {
377
+ return deferredPaths.length > 0 || hasDeferredMarker ? deferredPaths : void 0;
378
+ }
379
+ }, function(key, value) {
380
+ if (key === DEFERRED_PAYLOAD && (value === "fulfilled" || value === "rejected")) hasDeferredMarker = true;
381
+ const parentPath = paths.get(this);
382
+ const path = parentPath ? [...parentPath, key] : [];
383
+ if (isDeferred(value)) deferredPaths.push(path);
384
+ const encoded = hydrationReplacer(value);
385
+ if (encoded && typeof encoded === "object") paths.set(encoded, path);
386
+ return encoded;
387
+ }).replace(/</g, "\\u003C").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029")}<\/script>`;
372
388
  }
373
389
  //#endregion
374
390
  //#region src/ssr/sink.ts
@@ -1,10 +1,10 @@
1
1
  import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
2
- import { r as currentAppRuntime } from "./hooks-BimKStr4.js";
3
- import { r as readScope, t as defineScope } from "./scope-CwpVSHVf.js";
2
+ import { r as currentAppRuntime } from "./hooks-kjLigwDJ.js";
3
+ import { r as readScope, t as defineScope } from "./scope-ila_zaId.js";
4
4
  import { S as replacePageRoute, n as getActiveRenderContext, w as withPageFramework } from "./render-context-DGHnEveC.js";
5
5
  import { n as isPromiseLike } from "./promise-Dz8iIHAm.js";
6
- import { c as withTelemetry, l as jsonTransportPropertyPath, p as isDeferred, t as createQueryPrefetchContext, u as validateJsonTransportValue } from "./query-registry-WMCN0BJL.js";
7
- import { c as resolveNavigationUrl, i as formatNavigationUrl } from "./url-CnbfpX0K.js";
6
+ import { c as withTelemetry, l as jsonTransportPropertyPath, p as isDeferred, t as createQueryPrefetchContext, u as validateJsonTransportValue } from "./query-registry-tzSiVrV_.js";
7
+ import { c as resolveNavigationUrl, i as formatNavigationUrl } from "./url-C9xMpMMv.js";
8
8
  //#region src/router/route-hydration.ts
9
9
  function isDeferredHydrationValue(value) {
10
10
  return isDeferred(value);
@@ -71,7 +71,7 @@ function guardOmissions(value, omissions, route, path = "$") {
71
71
  if (cached) return cached;
72
72
  const guarded = new Proxy(value, { get(target, property, receiver) {
73
73
  if (typeof property === "string") {
74
- const omitted = omissions[property];
74
+ const omitted = Object.prototype.hasOwnProperty.call(omissions, property) ? omissions[property] : void 0;
75
75
  if (omitted && !Object.prototype.hasOwnProperty.call(target, property)) omittedRead(route, propertyPath(path, property));
76
76
  const child = Reflect.get(target, property, receiver);
77
77
  return omitted === 1 ? child : guardOmissions(child, omitted, route, propertyPath(path, property));
@@ -276,6 +276,15 @@ function formatCatchAllCapture(parts) {
276
276
  if (parts.length === 1) return decodePathSegment(parts[0]);
277
277
  return "/" + parts.map(decodePathSegment).join("/");
278
278
  }
279
+ function setCapturedParameter(params, name, value) {
280
+ if (name === "__proto__") Object.defineProperty(params, name, {
281
+ value,
282
+ enumerable: true,
283
+ configurable: true,
284
+ writable: true
285
+ });
286
+ else params[name] = value;
287
+ }
279
288
  /**
280
289
  * Match pre-split URL parts against pre-parsed route segments.
281
290
  *
@@ -308,11 +317,11 @@ function matchSegments(urlParts, segments) {
308
317
  if (!staticSegmentMatches(seg.value, part)) return null;
309
318
  } else if (seg.kind === "splat") {
310
319
  if (params === null) params = {};
311
- params[seg.value] = normalizeCapturedSplatParts(urlParts.slice(i).map(decodePathSegment)).join("/");
320
+ setCapturedParameter(params, seg.value, normalizeCapturedSplatParts(urlParts.slice(i).map(decodePathSegment)).join("/"));
312
321
  return params;
313
322
  } else {
314
323
  if (params === null) params = {};
315
- if (seg.kind === "param") params[seg.value] = decodePathSegment(part);
324
+ if (seg.kind === "param") setCapturedParameter(params, seg.value, decodePathSegment(part));
316
325
  else params["*"] = decodePathSegment(part);
317
326
  }
318
327
  }
@@ -702,7 +711,12 @@ function makeQuery(search) {
702
711
  },
703
712
  toJSON() {
704
713
  const output = {};
705
- for (const [key, values] of mapping.entries()) output[key] = values.length > 1 ? [...values] : values[0];
714
+ for (const [key, values] of mapping.entries()) Object.defineProperty(output, key, {
715
+ value: values.length > 1 ? [...values] : values[0],
716
+ enumerable: true,
717
+ configurable: true,
718
+ writable: true
719
+ });
706
720
  return output;
707
721
  }
708
722
  });
@@ -1,6 +1,6 @@
1
- import { A as untrack, F as logger, N as runWithOwner, S as queueTask, d as recordUndo } from "./instance-BAnfmXOR.js";
1
+ import { A as untrack, I as logger, N as runWithOwner, S as queueTask, d as recordUndo } from "./instance-DL-YKrj6.js";
2
2
  import { t as brandSnapshotSource } from "./snapshot-Cjx4N988.js";
3
- import { c as onCommit, i as currentComponent, n as createSource, o as hookSlot, r as currentAppRuntime, s as notify, u as readSource } from "./hooks-BimKStr4.js";
3
+ import { c as onCommit, i as currentComponent, n as createSource, o as hookSlot, r as currentAppRuntime, s as notify, u as readSource } from "./hooks-kjLigwDJ.js";
4
4
  import { T as SSRDataMissingError, a as getResourceVerificationSnapshot, h as throwSSRDataMissing, i as getNextRenderKey, n as getActiveRenderContext, o as isHydrationVerificationRender, r as getCurrentRenderData, s as recordResourceVerificationSnapshot } from "./render-context-DGHnEveC.js";
5
5
  import { n as isPromiseLike } from "./promise-Dz8iIHAm.js";
6
6
  //#region src/core/api/resource-cell.ts
@@ -1,7 +1,7 @@
1
- import { S as queueTask } from "../instance-BAnfmXOR.js";
2
- import { c as onCommit, i as currentComponent, n as createSource, o as hookSlot, s as notify, u as readSource } from "../hooks-BimKStr4.js";
3
- import { a as routeActive, c as watch, i as on, n as windowFocused, o as task, r as capture, s as timer, t as documentVisible } from "../browser-activity-CB8e-V4f.js";
4
- import { t as resource } from "../resource-CLjB7RBQ.js";
1
+ import { S as queueTask } from "../instance-DL-YKrj6.js";
2
+ import { c as onCommit, i as currentComponent, n as createSource, o as hookSlot, s as notify, u as readSource } from "../hooks-kjLigwDJ.js";
3
+ import { a as routeActive, c as watch, i as on, n as windowFocused, o as task, r as capture, s as timer, t as documentVisible } from "../browser-activity-2r5gA1Cb.js";
4
+ import { t as resource } from "../resource-BhcaFqdB.js";
5
5
  //#region src/core/api/stream.ts
6
6
  /**
7
7
  * stream(): a component-owned async iterable. It connects after the render
@@ -74,6 +74,17 @@ async function consume(slot, generation, iterable) {
74
74
  publish(slot);
75
75
  }
76
76
  }
77
+ function failGeneration(slot, generation, error) {
78
+ if (!isCurrent(slot, generation)) return;
79
+ stopGeneration(generation);
80
+ if (slot.disposed || slot.current !== generation || slot.generation !== generation.id) return;
81
+ slot.current = null;
82
+ slot.snapshot.status = "error";
83
+ slot.snapshot.pending = false;
84
+ slot.snapshot.stale = slot.hasValue;
85
+ slot.snapshot.error = toError(error);
86
+ publish(slot);
87
+ }
77
88
  function startSlot(slot) {
78
89
  if (!slot.activated || slot.disposed) return;
79
90
  const previous = slot.current;
@@ -94,23 +105,11 @@ function startSlot(slot) {
94
105
  try {
95
106
  result = slot.source({ signal: generation.controller.signal });
96
107
  } catch (error) {
97
- if (!isCurrent(slot, generation)) return;
98
- slot.current = null;
99
- slot.snapshot.status = "error";
100
- slot.snapshot.pending = false;
101
- slot.snapshot.stale = slot.hasValue;
102
- slot.snapshot.error = toError(error);
103
- publish(slot);
108
+ failGeneration(slot, generation, error);
104
109
  return;
105
110
  }
106
111
  Promise.resolve(result).then((iterable) => consume(slot, generation, iterable)).catch((error) => {
107
- if (!isCurrent(slot, generation)) return;
108
- slot.current = null;
109
- slot.snapshot.status = "error";
110
- slot.snapshot.pending = false;
111
- slot.snapshot.stale = slot.hasValue;
112
- slot.snapshot.error = toError(error);
113
- publish(slot);
112
+ failGeneration(slot, generation, error);
114
113
  });
115
114
  }
116
115
  function queueStart(slot) {
@@ -152,9 +151,7 @@ function createSlot(source, options) {
152
151
  const slot = {
153
152
  kind: "stream",
154
153
  source,
155
- pendingSource: source,
156
154
  deps: (options.deps ?? []).slice(),
157
- pendingDeps: (options.deps ?? []).slice(),
158
155
  snapshot,
159
156
  generation: 0,
160
157
  current: null,
@@ -190,12 +187,12 @@ function requireStreamOwner() {
190
187
  if (!instance) throw new Error("[Askr] stream() must be called during component render inside an app.");
191
188
  return instance;
192
189
  }
193
- function commitSlot(instance, slot) {
194
- const depsChanged = !depsEqual(slot.deps, slot.pendingDeps);
190
+ function commitSlot(instance, slot, source, deps) {
191
+ const depsChanged = !depsEqual(slot.deps, deps);
195
192
  const firstCommit = !slot.activated;
196
193
  slot.owner = instance;
197
- slot.source = slot.pendingSource;
198
- slot.deps = slot.pendingDeps;
194
+ slot.source = source;
195
+ slot.deps = deps;
199
196
  if (firstCommit) slot.activated = true;
200
197
  if (!slot.cleanupRegistered) {
201
198
  slot.cleanupRegistered = true;
@@ -217,9 +214,10 @@ function stream(sourceOrGetter, connectOrOptions, drivenOptions) {
217
214
  function createStream(instance, source, options) {
218
215
  const slot = hookSlot(instance, "stream", () => createSlot(source, options));
219
216
  readSource(slot.readers);
220
- slot.pendingSource = source;
221
- slot.pendingDeps = (options.deps ?? []).slice();
222
- if (!instance.server) onCommit(instance, () => commitSlot(instance, slot));
217
+ if (!instance.server) {
218
+ const deps = (options.deps ?? []).slice();
219
+ onCommit(instance, () => commitSlot(instance, slot, source, deps));
220
+ }
223
221
  return slot.snapshot;
224
222
  }
225
223
  //#endregion
@@ -1,12 +1,12 @@
1
1
  import { n as jsx } from "../jsx-runtime-C4idqHY0.js";
2
- import { C as currentRoute, a as nextHistoryIndex, b as syncRegisteredRouteSnapshot, c as reconcileRouteMeta, f as saveScrollPosition, g as parseTargetUrl, h as getWindowHref, i as commitHistoryIndex, l as resolveRouteMeta, m as getRegisteredAppsSnapshot, n as navigate, p as getCurrentHref, r as navigateToPublicHref, u as serializeRouteMeta, v as setCurrentRouteLocation, w as onRouteChange, x as toDocumentUrl, y as syncAppRegistrationLocation } from "../navigate-CP_0Zy5U.js";
3
- import { f as defer, p as isDeferred } from "../query-registry-WMCN0BJL.js";
4
- import { M as getActiveRouteBasePath, a as resolveRouteRequest, at as lazyRouteData, b as addLogicalRouteBasePath, c as forbidden, ct as encodePathSegment, d as unauthorized, et as Outlet, f as currentAuth, it as lazy, l as notFound, o as allow, ot as RouteDataLoadError, s as deny, u as redirect, v as matchRoute, x as addRouteBasePath } from "../resolution-Cx82-xjW.js";
5
- import { n as createRouteRegistry } from "../manifest-CW9gyNBY.js";
6
- import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-bEEHHvic.js";
7
- import { a as isSafeHref, r as assertPathHrefStaysOnOrigin } from "../url-CnbfpX0K.js";
8
- import { o as mergeProps } from "../compose-ref-DWzdbxsD.js";
9
- import { t as applyInteractionPolicy } from "../interactions-D2BoREb-.js";
2
+ import { C as currentRoute, a as nextHistoryIndex, b as syncRegisteredRouteSnapshot, c as reconcileRouteMeta, f as saveScrollPosition, g as parseTargetUrl, h as getWindowHref, i as commitHistoryIndex, l as resolveRouteMeta, m as getRegisteredAppsSnapshot, n as navigate, p as getCurrentHref, r as navigateToPublicHref, u as serializeRouteMeta, v as setCurrentRouteLocation, w as onRouteChange, x as toDocumentUrl, y as syncAppRegistrationLocation } from "../navigate-DsfO12hB.js";
3
+ import { f as defer, p as isDeferred } from "../query-registry-tzSiVrV_.js";
4
+ import { M as getActiveRouteBasePath, a as resolveRouteRequest, at as lazyRouteData, b as addLogicalRouteBasePath, c as forbidden, ct as encodePathSegment, d as unauthorized, et as Outlet, f as currentAuth, it as lazy, l as notFound, o as allow, ot as RouteDataLoadError, s as deny, u as redirect, v as matchRoute, x as addRouteBasePath } from "../resolution-CF1BqHLm.js";
5
+ import { n as createRouteRegistry } from "../manifest-BNupb86f.js";
6
+ import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-nGZglpj6.js";
7
+ import { a as isSafeHref, r as assertPathHrefStaysOnOrigin } from "../url-C9xMpMMv.js";
8
+ import { o as mergeProps } from "../compose-ref-ccRU59BM.js";
9
+ import { t as applyInteractionPolicy } from "../interactions-BAa2xuJ-.js";
10
10
  //#region src/router/route-query.ts
11
11
  function getRouteQueryHistoryMode(options) {
12
12
  if (options.history) return options.history;
@@ -1,6 +1,6 @@
1
- import { M as getOwner } from "./instance-BAnfmXOR.js";
1
+ import { M as getOwner } from "./instance-DL-YKrj6.js";
2
2
  import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
3
- import { i as currentComponent } from "./hooks-BimKStr4.js";
3
+ import { i as currentComponent } from "./hooks-kjLigwDJ.js";
4
4
  //#region src/core/api/scope.ts
5
5
  /**
6
6
  * Lexical scopes. A scope's provider is a component that records its value