@askrjs/askr 0.2.2 → 0.2.4

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 (80) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +32 -4
  3. package/dist/{access-d_DCdwqn.js → access-BucjYZcX.js} +15 -10
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.js +5 -4
  6. package/dist/{activity-CAJ5eho-.d.ts → activity-DooIuxQO.d.ts} +2 -2
  7. package/dist/{activity-B2Yy7Wz9.js → activity-FirwPXA_.js} +14 -2
  8. package/dist/{compose-ref-1Fhs7mbF.js → aria-hKjThHcp.js} +1 -18
  9. package/dist/benchmark.d.ts +1 -1
  10. package/dist/benchmark.js +8 -8
  11. package/dist/boot/index.d.ts +4 -2
  12. package/dist/boot/index.js +1 -1
  13. package/dist/{boot-DVwjHCNh.js → boot-tWyF6121.js} +14 -15
  14. package/dist/{cleanup-DPtpXtA4.js → cleanup-TXSsApEl.js} +6 -11
  15. package/dist/{component-cleanup-DPe8claJ.js → component-cleanup-jdbgjkT1.js} +2 -2
  16. package/dist/{component-internal-xW_OnTmC.js → component-internal-C4hKKQBF.js} +16 -7
  17. package/dist/components/index.d.ts +2 -2
  18. package/dist/compose-ref-Bfaf4kUC.js +20 -0
  19. package/dist/control/index.d.ts +1 -1
  20. package/dist/control/index.js +1 -1
  21. package/dist/{control-BLVTE1gO.js → control-C-wSaq9V.js} +4 -4
  22. package/dist/{control-DdFw-Caz.d.ts → control-Cxag1yqV.d.ts} +1 -1
  23. package/dist/{csp-nonce-CCnMtOW-.js → csp-nonce-9NFUb7hJ.js} +1 -1
  24. package/dist/data/index.d.ts +1 -1
  25. package/dist/data/index.js +1 -1
  26. package/dist/{data-BjUf0PPS.js → data-ghKopAbp.js} +49 -49
  27. package/dist/{deferred-BRw0gbn5.js → deferred-CxjWCkIn.js} +2 -2
  28. package/dist/{effect-BQP5o0Kx.js → effect-CNwstBBD.js} +2 -2
  29. package/dist/{fastlane-DUxiFV9S.js → fastlane-BKZduiBQ.js} +2 -2
  30. package/dist/{for-internal-DKcYl3nl.js → for-internal-DyBHfKJA.js} +33 -25
  31. package/dist/foundations/icon/index.d.ts +1 -1
  32. package/dist/foundations/index.d.ts +2 -2
  33. package/dist/foundations/index.js +1 -1
  34. package/dist/foundations/interactions/index.d.ts +1 -1
  35. package/dist/foundations/interactions/index.js +1 -1
  36. package/dist/foundations/state/index.d.ts +1 -1
  37. package/dist/foundations/state/index.js +1 -1
  38. package/dist/foundations/structures/index.d.ts +2 -2
  39. package/dist/foundations/structures/index.js +1 -1
  40. package/dist/foundations/utilities/index.d.ts +1 -1
  41. package/dist/foundations/utilities/index.js +2 -1
  42. package/dist/fx/index.d.ts +1 -1
  43. package/dist/fx/index.js +1 -1
  44. package/dist/{index-CzH-0LcA.d.ts → index-B1gu0_m0.d.ts} +2 -0
  45. package/dist/{index-r5THqzPN.d.ts → index-CTpMmzgN.d.ts} +2 -2
  46. package/dist/{index-DSqXWc77.d.ts → index-Dgjbo2gU.d.ts} +58 -4
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.js +10 -10
  49. package/dist/{interactions-B-7vkBgx.js → interactions-D102JxBR.js} +10 -3
  50. package/dist/jsx-dev-runtime.d.ts +2 -2
  51. package/dist/jsx-runtime-Cg7GqY1S.d.ts +2 -0
  52. package/dist/{jsx-runtime-Cdd6Gkb0.d.ts → jsx-runtime-gVIaTPw0.d.ts} +2 -2
  53. package/dist/jsx-runtime.d.ts +2 -2
  54. package/dist/{lifecycle-batch-BYECQw8T.js → lifecycle-batch-63aXFf2S.js} +2 -2
  55. package/dist/{lifecycle-operations-DJk_5MrD.js → lifecycle-operations-Q0k3EFnG.js} +94 -2
  56. package/dist/{navigate-wel1e6cU.d.ts → navigate-F4sHgWbw.d.ts} +3 -1
  57. package/dist/{navigate-DvJvo--6.js → navigate-ZZu1IV0B.js} +88 -13
  58. package/dist/{readable-D-JIKCg2.js → readable-Di1fzSwm.js} +1 -1
  59. package/dist/{renderer-RjZ8LHbt.js → renderer-Cl23O0hV.js} +154 -137
  60. package/dist/{resolution-dVYwYXrI.js → resolution-ClD-K7Lz.js} +3 -3
  61. package/dist/{resource-operation-4qFIM02d.js → resource-operation-Vz1S5h2k.js} +4 -4
  62. package/dist/resources/index.d.ts +3 -37
  63. package/dist/resources/index.js +6 -6
  64. package/dist/router/index.d.ts +4 -4
  65. package/dist/router/index.js +7 -7
  66. package/dist/{selector-NQiYHwZC.js → selector-CsKuomw0.js} +17 -16
  67. package/dist/shared-CYBH3F8I.js +27 -0
  68. package/dist/ssg/index.d.ts +1 -1
  69. package/dist/ssg/index.js +4 -4
  70. package/dist/ssr/index.d.ts +8 -2
  71. package/dist/ssr/index.js +1 -1
  72. package/dist/{ssr-F87AcFMt.js → ssr-Doog-AfJ.js} +26 -15
  73. package/dist/{state-Ks-sWTQi.js → state-BGJgYSyQ.js} +3 -3
  74. package/dist/{structures-C-wmHCi6.js → structures-DFyK5AdQ.js} +4 -4
  75. package/dist/testing/index.d.ts +3 -1
  76. package/dist/testing/index.js +6 -5
  77. package/dist/{types-DkVJhVs9.d.ts → types-DWVrKn9N.d.ts} +5 -0
  78. package/dist/{verify-hydration-CThsx0pq.js → verify-hydration-BZPJ_kYa.js} +1 -1
  79. package/package.json +7 -7
  80. package/dist/jsx-runtime-BTzDdBJ_.d.ts +0 -2
@@ -1,4 +1,5 @@
1
- import { o as mergeProps, r as ariaDisabled, s as composeHandlers, t as composeRefs } from "./compose-ref-1Fhs7mbF.js";
1
+ import { t as composeRefs } from "./compose-ref-Bfaf4kUC.js";
2
+ import { a as composeHandlers, i as mergeProps, t as ariaDisabled } from "./aria-hKjThHcp.js";
2
3
  //#region src/foundations/interactions/pressable.ts
3
4
  /** Produce click/keyboard props implementing 'press' semantics for an element. */
4
5
  function pressable({ disabled, onPress, isNativeButton = false }) {
@@ -121,8 +122,9 @@ function rovingFocus(options) {
121
122
  const { key } = e;
122
123
  let direction;
123
124
  if (orientation === "horizontal" || orientation === "both") {
124
- if (key === "ArrowRight") direction = 1;
125
- if (key === "ArrowLeft") direction = -1;
125
+ const textDirection = resolveTextDirection(e);
126
+ if (key === "ArrowRight") direction = textDirection === "rtl" ? -1 : 1;
127
+ if (key === "ArrowLeft") direction = textDirection === "rtl" ? 1 : -1;
126
128
  }
127
129
  if (orientation === "vertical" || orientation === "both") {
128
130
  if (key === "ArrowDown") direction = 1;
@@ -143,6 +145,11 @@ function rovingFocus(options) {
143
145
  })
144
146
  };
145
147
  }
148
+ function resolveTextDirection(event) {
149
+ const candidate = event.currentTarget ?? event.target;
150
+ if (typeof Element === "undefined" || !(candidate instanceof Element)) return "ltr";
151
+ return candidate.ownerDocument.defaultView?.getComputedStyle(candidate).direction === "rtl" ? "rtl" : "ltr";
152
+ }
146
153
  /**
147
154
  * USAGE EXAMPLE:
148
155
  *
@@ -1,5 +1,5 @@
1
- import { a as IntrinsicFallbackProps, i as JSXElementType, n as JSXComponent, o as KnownIntrinsicElementProps, r as JSXElement, s as Props, t as Fragment } from "./types-DkVJhVs9.js";
2
- import { t as EagerControlPrimitive } from "./control-DdFw-Caz.js";
1
+ import { a as IntrinsicFallbackProps, i as JSXElementType, n as JSXComponent, o as KnownIntrinsicElementProps, r as JSXElement, s as Props, t as Fragment } from "./types-DWVrKn9N.js";
2
+ import { t as EagerControlPrimitive } from "./control-Cxag1yqV.js";
3
3
  //#region src/jsx/jsx-dev-runtime.d.ts
4
4
  declare namespace JSX {
5
5
  type ElementType = string | symbol | ((props: never) => unknown);
@@ -0,0 +1,2 @@
1
+ import "./types-DWVrKn9N.js";
2
+ import "./jsx-runtime-gVIaTPw0.js";
@@ -1,5 +1,5 @@
1
- import { a as IntrinsicFallbackProps, o as KnownIntrinsicElementProps, r as JSXElement, s as Props } from "./types-DkVJhVs9.js";
2
- import { t as EagerControlPrimitive } from "./control-DdFw-Caz.js";
1
+ import { a as IntrinsicFallbackProps, o as KnownIntrinsicElementProps, r as JSXElement, s as Props } from "./types-DWVrKn9N.js";
2
+ import { t as EagerControlPrimitive } from "./control-Cxag1yqV.js";
3
3
  //#region src/jsx/jsx-runtime.d.ts
4
4
  declare namespace JSX {
5
5
  type ElementType = string | symbol | ((props: never) => unknown);
@@ -1,3 +1,3 @@
1
- import { i as JSXElementType, n as JSXComponent, r as JSXElement, t as Fragment } from "./types-DkVJhVs9.js";
2
- import { i as jsxs, n as jsx, r as jsxDEV, t as JSX } from "./jsx-runtime-Cdd6Gkb0.js";
1
+ import { i as JSXElementType, n as JSXComponent, r as JSXElement, t as Fragment } from "./types-DWVrKn9N.js";
2
+ import { i as jsxs, n as jsx, r as jsxDEV, t as JSX } from "./jsx-runtime-gVIaTPw0.js";
3
3
  export { Fragment, JSX, type JSXComponent, type JSXElement, type JSXElementType, jsx, jsxDEV, jsxs };
@@ -1,5 +1,5 @@
1
- import { y as logger } from "./access-d_DCdwqn.js";
2
- import { a as finalizeReadableSubscriptionsFromSnapshot } from "./readable-D-JIKCg2.js";
1
+ import { y as logger } from "./access-BucjYZcX.js";
2
+ import { a as finalizeReadableSubscriptionsFromSnapshot } from "./readable-Di1fzSwm.js";
3
3
  //#region src/common/promise.ts
4
4
  function isPromiseLike(value) {
5
5
  return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
@@ -1,5 +1,6 @@
1
1
  import { f as getCurrentComponentInstance, i as claimHookIndex } from "./component-scope-4I3yEMkb.js";
2
- import { a as registerCommitOperation } from "./component-internal-xW_OnTmC.js";
2
+ import { a as registerCommitOperation, u as routeComponentErrorToBoundary } from "./component-internal-C4hKKQBF.js";
3
+ import { t as createFineGrainedEffect } from "./effect-CNwstBBD.js";
3
4
  import { t as isRouteActivityActive } from "./route-activity-CNJfpwx-.js";
4
5
  //#region src/runtime/lifecycle-operations.ts
5
6
  function normalizePredicates(predicates) {
@@ -177,6 +178,97 @@ function task(fn) {
177
178
  });
178
179
  }
179
180
  }
181
+ function watchValuesEqual(previous, next) {
182
+ if (previous.length !== next.length) return false;
183
+ for (let index = 0; index < previous.length; index += 1) if (!Object.is(previous[index], next[index])) return false;
184
+ return true;
185
+ }
186
+ function stopWatchGeneration(slot) {
187
+ const controller = slot.controller;
188
+ slot.controller = null;
189
+ if (controller && !controller.signal.aborted) controller.abort();
190
+ const cleanup = slot.cleanup;
191
+ slot.cleanup = null;
192
+ cleanup?.();
193
+ }
194
+ function stopWatchSlot(slot) {
195
+ stopWatchGeneration(slot);
196
+ slot.effect?.cleanup();
197
+ slot.effect = null;
198
+ }
199
+ function reportWatchError(instance, error) {
200
+ if (!routeComponentErrorToBoundary(instance, error)) throw error;
201
+ }
202
+ function commitWatchSlot(instance, slot) {
203
+ slot.callback = slot.pendingCallback;
204
+ slot.sources = slot.pendingSources;
205
+ const compute = () => {
206
+ const values = slot.sources.map((source) => source());
207
+ return values.length === 1 ? values[0] : values;
208
+ };
209
+ const observe = (value, previous) => {
210
+ stopWatchGeneration(slot);
211
+ const controller = new AbortController();
212
+ slot.controller = controller;
213
+ const initial = !slot.hasObserved;
214
+ slot.hasObserved = true;
215
+ let result;
216
+ try {
217
+ result = slot.callback(value, {
218
+ initial,
219
+ previous,
220
+ signal: controller.signal
221
+ });
222
+ } catch (error) {
223
+ reportWatchError(instance, error);
224
+ return;
225
+ }
226
+ if (typeof result === "function") {
227
+ slot.cleanup = result;
228
+ return;
229
+ }
230
+ if (result && typeof result.then === "function") Promise.resolve(result).catch((error) => {
231
+ if (!controller.signal.aborted) reportWatchError(instance, error);
232
+ });
233
+ };
234
+ if (!slot.effect) slot.effect = createFineGrainedEffect({
235
+ lane: "post",
236
+ compute,
237
+ commit: observe,
238
+ equals: (previous, next) => Array.isArray(previous) && Array.isArray(next) ? watchValuesEqual(previous, next) : Object.is(previous, next),
239
+ onError: (error) => reportWatchError(instance, error)
240
+ });
241
+ else slot.effect.updateCompute(compute);
242
+ if (!slot.cleanupRegistered) {
243
+ slot.cleanupRegistered = true;
244
+ (instance.cleanupFns ??= []).push(() => {
245
+ stopWatchSlot(slot);
246
+ slot.cleanupRegistered = false;
247
+ });
248
+ }
249
+ }
250
+ function watch(sourceOrSources, callback) {
251
+ const instance = getCurrentComponentInstance();
252
+ if (!instance) return;
253
+ const index = claimHookIndex(instance, "watch");
254
+ const sources = Array.isArray(sourceOrSources) ? sourceOrSources : [sourceOrSources];
255
+ const slot = getLifecycleSlot(instance, index, "watch", () => ({
256
+ kind: "watch",
257
+ sources,
258
+ pendingSources: sources,
259
+ callback,
260
+ pendingCallback: callback,
261
+ effect: null,
262
+ controller: null,
263
+ cleanup: null,
264
+ cleanupRegistered: false,
265
+ hasObserved: false
266
+ }));
267
+ slot.pendingSources = sources;
268
+ slot.pendingCallback = callback;
269
+ if (instance.ssr) return;
270
+ registerCommitOperation(() => commitWatchSlot(instance, slot));
271
+ }
180
272
  /**
181
273
  * Capture the result of a synchronous expression at call time and return a
182
274
  * thunk that returns the captured value later. This is a low-level helper for
@@ -192,4 +284,4 @@ function capture(fn) {
192
284
  return () => value;
193
285
  }
194
286
  //#endregion
195
- export { task as a, routeActive as i, documentVisible as n, timer as o, on as r, windowFocused as s, capture as t };
287
+ export { task as a, windowFocused as c, routeActive as i, documentVisible as n, timer as o, on as r, watch as s, capture as t };
@@ -1,4 +1,4 @@
1
- import "./index-DSqXWc77.js";
1
+ import "./index-Dgjbo2gU.js";
2
2
  //#region src/router/navigation-scroll.d.ts
3
3
  /** Scroll behavior for programmatic navigations (`navigate()`). */
4
4
  type NavigationScrollBehavior = 'top' | 'preserve';
@@ -16,6 +16,8 @@ type NavigateOptions = {
16
16
  history?: 'push' | 'replace';
17
17
  replace?: boolean;
18
18
  scroll?: NavigationScrollBehavior;
19
+ /** Entry-local browser history state. It is not serialized into the URL or sent to the server. */
20
+ state?: unknown;
19
21
  };
20
22
  //#endregion
21
23
  //#region src/router/navigate.d.ts
@@ -1,14 +1,14 @@
1
- import { S as isProductionEnvironment, r as flushRuntimeScheduler, x as isDevelopmentEnvironment, y as logger } from "./access-d_DCdwqn.js";
1
+ import { S as isProductionEnvironment, r as flushRuntimeScheduler, s as isRuntimeSchedulerExecuting, x as isDevelopmentEnvironment, y as logger } from "./access-BucjYZcX.js";
2
2
  import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
3
- import { r as executeComponent } from "./component-internal-xW_OnTmC.js";
4
- import { t as cleanupReadableSubscriptionSources } from "./readable-D-JIKCg2.js";
5
- import { n as cleanupComponentGeneration, t as cleanupComponent } from "./component-cleanup-DPe8claJ.js";
6
- import { i as drainLifecycleCommitErrors, p as isPromiseLike, r as discardLifecycleCommitBatch, s as flushLifecycleCommitBatch, t as beginLifecycleCommitBatch } from "./lifecycle-batch-BYECQw8T.js";
7
- import { _ as teardownNodeSubtree } from "./cleanup-DPtpXtA4.js";
8
- import { t as CspNonceScope } from "./csp-nonce-CCnMtOW-.js";
3
+ import { r as executeComponent } from "./component-internal-C4hKKQBF.js";
4
+ import { t as cleanupReadableSubscriptionSources } from "./readable-Di1fzSwm.js";
5
+ import { n as cleanupComponentGeneration, t as cleanupComponent } from "./component-cleanup-jdbgjkT1.js";
6
+ import { i as drainLifecycleCommitErrors, p as isPromiseLike, r as discardLifecycleCommitBatch, s as flushLifecycleCommitBatch, t as beginLifecycleCommitBatch } from "./lifecycle-batch-63aXFf2S.js";
7
+ import { _ as teardownNodeSubtree } from "./cleanup-TXSsApEl.js";
8
+ import { t as CspNonceScope } from "./csp-nonce-9NFUb7hJ.js";
9
9
  import { I as lockRouteRegistration, o as addRouteBasePath, r as computeRouteActivityMatches, y as getActiveRouteBasePath } from "./route-matching-Bo6UqG-5.js";
10
- import { a as resolveRouteRequest, i as hasRouteRenderData, n as getRouteRenderContext, r as getRouteRenderData, u as withoutRouteHydrationMetadata } from "./resolution-dVYwYXrI.js";
11
- import { a as clearStagedAppRenderRouteLocation, i as syncCurrentRouteSnapshot, o as createAppRenderRuntime, s as stageAppRenderRouteLocation } from "./activity-B2Yy7Wz9.js";
10
+ import { a as resolveRouteRequest, i as hasRouteRenderData, n as getRouteRenderContext, r as getRouteRenderData, u as withoutRouteHydrationMetadata } from "./resolution-ClD-K7Lz.js";
11
+ import { a as clearStagedAppRenderRouteLocation, i as syncCurrentRouteSnapshot, o as createAppRenderRuntime, s as stageAppRenderRouteLocation } from "./activity-FirwPXA_.js";
12
12
  import { r as getDefaultPortalHost, t as clearRegisteredDefaultPortalForInstance } from "./default-portal-runtime-DvMvWJVp.js";
13
13
  //#region src/router/navigation-registry.ts
14
14
  let currentInstance = null;
@@ -112,6 +112,58 @@ const DEFAULT_SCROLL_RESTORATION = {
112
112
  };
113
113
  let scrollRestorationOptions = { ...DEFAULT_SCROLL_RESTORATION };
114
114
  const scrollPositions = /* @__PURE__ */ new Map();
115
+ let capturedActivationFocus;
116
+ let pendingNavigationFocus;
117
+ let focusAtHistoryNavigationStart = null;
118
+ function readFocusDescriptor() {
119
+ if (typeof document === "undefined" || !(document.activeElement instanceof HTMLElement)) return;
120
+ const active = document.activeElement;
121
+ for (const attribute of [
122
+ "data-askr-focus-key",
123
+ "id",
124
+ "name",
125
+ "aria-label"
126
+ ]) {
127
+ const value = active.getAttribute(attribute);
128
+ if (value) return {
129
+ attribute,
130
+ value
131
+ };
132
+ }
133
+ if ("labels" in active) {
134
+ const label = Array.from(active.labels ?? []).map((element) => element.textContent?.trim()).find(Boolean);
135
+ if (label) return {
136
+ attribute: "label",
137
+ value: label
138
+ };
139
+ }
140
+ }
141
+ function clearCapturedNavigationFocus() {
142
+ capturedActivationFocus = void 0;
143
+ }
144
+ function isPrimaryPointerActivation(event) {
145
+ if (event instanceof MouseEvent && (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) return false;
146
+ return true;
147
+ }
148
+ /** Stage entry-owned focus for the duration of one primary pointer activation. */
149
+ function captureNavigationFocus(event) {
150
+ clearCapturedNavigationFocus();
151
+ if (!isPrimaryPointerActivation(event)) return;
152
+ capturedActivationFocus = readFocusDescriptor();
153
+ }
154
+ /** Release pointer activation state after its click has finished dispatching. */
155
+ function releaseNavigationFocusCapture() {
156
+ clearCapturedNavigationFocus();
157
+ }
158
+ /** Preserve the active control before route content can be replaced. */
159
+ function prepareNavigationFocus() {
160
+ pendingNavigationFocus = capturedActivationFocus ?? readFocusDescriptor();
161
+ clearCapturedNavigationFocus();
162
+ }
163
+ /** Mark the active element so restoration can avoid overwriting focus moved during route commit. */
164
+ function beginHistoryFocusRestoration() {
165
+ focusAtHistoryNavigationStart = typeof document === "undefined" ? null : document.activeElement;
166
+ }
115
167
  function getWindowHref() {
116
168
  if (typeof window === "undefined") return "/";
117
169
  return `${window.location.pathname}${window.location.search}${window.location.hash}`;
@@ -146,8 +198,10 @@ function writeHistoryScrollPosition(href, position) {
146
198
  window.history.replaceState({
147
199
  ...state,
148
200
  path: href,
149
- scroll: position
201
+ scroll: position,
202
+ focus: pendingNavigationFocus ?? readFocusDescriptor()
150
203
  }, "", href);
204
+ pendingNavigationFocus = void 0;
151
205
  }
152
206
  function saveScrollPosition(href) {
153
207
  if (!scrollRestorationOptions.enabled || typeof window === "undefined") return;
@@ -194,6 +248,12 @@ function applyHistoryScroll(href, state) {
194
248
  x: 0,
195
249
  y: 0
196
250
  });
251
+ const focus = state && typeof state === "object" && state.focus && typeof state.focus === "object" ? state.focus : void 0;
252
+ if (focus && (focus.attribute === "data-askr-focus-key" || focus.attribute === "id" || focus.attribute === "name" || focus.attribute === "aria-label" || focus.attribute === "label") && typeof focus.value === "string" && typeof document !== "undefined" && (document.activeElement === document.body || document.activeElement === document.documentElement || document.activeElement === focusAtHistoryNavigationStart)) {
253
+ const target = focus.attribute === "label" ? Array.from(document.querySelectorAll("input,select,textarea,button")).find((element) => "labels" in element && Array.from(element.labels ?? []).some((label) => label.textContent?.trim() === focus.value)) : Array.from(document.querySelectorAll(`[${focus.attribute}]`)).find((element) => element.getAttribute(focus.attribute) === focus.value);
254
+ if (target?.isConnected && !target.hasAttribute("disabled") && target.getAttribute("aria-hidden") !== "true" && target.getClientRects().length > 0) target.focus({ preventScroll: true });
255
+ }
256
+ focusAtHistoryNavigationStart = null;
197
257
  }
198
258
  function configureScrollRestoration(options) {
199
259
  scrollRestorationOptions = normalizeScrollRestorationOptions(options);
@@ -865,7 +925,11 @@ function applyNavigationTargets(requestId, path, options, redirectState, pathnam
865
925
  if (isStaleRouteRequest(requestId)) return;
866
926
  saveScrollPosition(previousHref);
867
927
  const historyMethod = getNavigationHistoryMode(options) === "replace" ? "replaceState" : "pushState";
868
- window.history[historyMethod]({ path: href }, "", href);
928
+ window.history[historyMethod]({
929
+ path: href,
930
+ askrHasState: Object.prototype.hasOwnProperty.call(options, "state"),
931
+ askrState: options.state
932
+ }, "", href);
869
933
  setCurrentRouteLocation(pathname, href);
870
934
  clearStagedRouteLocations(matchedTargets);
871
935
  syncRegisteredRouteSnapshot();
@@ -998,12 +1062,20 @@ configureNavigationRegistryHost({ cancelRouteRequests });
998
1062
  /** Navigate the client-side router to `path` using the History API. */
999
1063
  function navigate(path, options = {}) {
1000
1064
  if (typeof window === "undefined") return;
1065
+ prepareNavigationFocus();
1001
1066
  const targetPath = addRouteBasePath(path, getActiveRouteBasePath());
1002
1067
  const initialTarget = parseTargetUrl(targetPath);
1003
- navigateWithRedirectState(targetPath, options, {
1068
+ const redirectState = {
1004
1069
  redirects: 0,
1005
1070
  visited: /* @__PURE__ */ new Set([`${initialTarget.pathname}${initialTarget.search}${initialTarget.hash}`])
1006
- });
1071
+ };
1072
+ if (isRuntimeSchedulerExecuting()) {
1073
+ queueMicrotask(() => {
1074
+ navigateWithRedirectState(targetPath, options, redirectState);
1075
+ });
1076
+ return;
1077
+ }
1078
+ navigateWithRedirectState(targetPath, options, redirectState);
1007
1079
  }
1008
1080
  function navigateWithRedirectState(path, options, redirectState) {
1009
1081
  if (typeof window === "undefined") return;
@@ -1028,6 +1100,7 @@ function navigateWithRedirectState(path, options, redirectState) {
1028
1100
  applyNavigationTargets(request.id, path, options, redirectState, pathname, href, resolvedTargets, navigateWithRedirectState);
1029
1101
  }
1030
1102
  function handlePopState(event) {
1103
+ beginHistoryFocusRestoration();
1031
1104
  const request = beginRouteRequest();
1032
1105
  const previousHref = getCurrentHref();
1033
1106
  const pathname = window.location.pathname;
@@ -1055,6 +1128,8 @@ function initializeNavigation() {
1055
1128
  if (typeof window === "undefined" || navigationInitialized) return;
1056
1129
  navigationInitialized = true;
1057
1130
  window.addEventListener("popstate", handlePopState);
1131
+ document.addEventListener("pointerdown", captureNavigationFocus, true);
1132
+ document.addEventListener("click", releaseNavigationFocusCapture);
1058
1133
  }
1059
1134
  //#endregion
1060
1135
  export { serializeRouteMeta as a, getCurrentHref as c, parseTargetUrl as d, registerAppInstance as f, unregisterAppInstance as g, syncRegisteredRouteSnapshot as h, resolveRouteMeta as i, getRegisteredAppsSnapshot as l, syncAppRegistrationLocation as m, navigate as n, configureScrollRestoration as o, setCurrentRouteLocation as p, reconcileRouteMeta as r, saveScrollPosition as s, initializeNavigation as t, getWindowHref$1 as u };
@@ -1,4 +1,4 @@
1
- import { c as markRuntimeReactivePropsDirtySource, n as enqueueRuntimeTask, s as isRuntimeSchedulerExecuting } from "./access-d_DCdwqn.js";
1
+ import { c as markRuntimeReactivePropsDirtySource, n as enqueueRuntimeTask, s as isRuntimeSchedulerExecuting } from "./access-BucjYZcX.js";
2
2
  import { p as getCurrentInstance } from "./component-scope-4I3yEMkb.js";
3
3
  //#region src/runtime/readable.ts
4
4
  const DEVELOPMENT_BUILD_ENABLED = false;