@askrjs/askr 0.0.70 → 0.0.72

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 (67) hide show
  1. package/capabilities.json +66 -0
  2. package/dist/actions/index.d.ts +1 -1
  3. package/dist/actions/index.js +9 -2
  4. package/dist/activity-C2tPn9Fr.js +152 -0
  5. package/dist/activity-CaeDxh-g.d.ts +10 -0
  6. package/dist/{authoring-uaJ556aG.js → authoring-CXmUcaCe.js} +2 -2
  7. package/dist/benchmark.d.ts +1 -1
  8. package/dist/benchmark.js +6 -6
  9. package/dist/boot/index.d.ts +2 -2
  10. package/dist/boot/index.js +1 -1
  11. package/dist/{boot-8gP6mB3c.js → boot-DIKbEA4Y.js} +11 -10
  12. package/dist/{cleanup-B4BiQHx-.js → cleanup-D8Ufd9Ix.js} +16 -2
  13. package/dist/components/index.d.ts +1 -0
  14. package/dist/components/index.js +1 -0
  15. package/dist/control/index.d.ts +1 -1
  16. package/dist/control/index.js +1 -1
  17. package/dist/{control-CA45Yvvu.js → control-DVRBkN2X.js} +7 -2
  18. package/dist/{csp-nonce-HGZ0vbqT.js → csp-nonce-CwSRP3Jl.js} +16 -1
  19. package/dist/css-BuPaTOfe.js +70 -0
  20. package/dist/data/index.js +3 -3
  21. package/dist/{data-DHt_zO1G.js → data-DFcSmGvN.js} +2 -2
  22. package/dist/{data-runtime-SJ1BSUvk.js → data-runtime-rpV6-3XW.js} +13 -2
  23. package/dist/{deferred-zHtUheIQ.js → deferred-Cr58yIQD.js} +3 -4
  24. package/dist/foundations/icon/index.d.ts +1 -1
  25. package/dist/foundations/index.d.ts +1 -1
  26. package/dist/foundations/index.js +1 -1
  27. package/dist/foundations/structures/index.d.ts +1 -1
  28. package/dist/foundations/structures/index.js +1 -1
  29. package/dist/{index-DjusBb1I.d.ts → index-5TeJ46BR.d.ts} +2 -2
  30. package/dist/{index-BFnTM1a8.d.ts → index-BHQmliBq.d.ts} +34 -2
  31. package/dist/{index-DSClfSoC.d.ts → index-DSyleBRD.d.ts} +1 -1
  32. package/dist/{index-Dh6ZF9yW.d.ts → index-UmwPZ8ZN.d.ts} +5 -0
  33. package/dist/index.d.ts +4 -5
  34. package/dist/index.js +12 -7
  35. package/dist/jsx-dev-runtime.d.ts +4 -2
  36. package/dist/jsx-runtime-C-oIHX9X.d.ts +2 -0
  37. package/dist/{jsx-runtime-aYZ8zb4q.d.ts → jsx-runtime-Cr1jspx9.d.ts} +4 -2
  38. package/dist/jsx-runtime.d.ts +1 -1
  39. package/dist/{lifecycle-operations-SlPEK68H.js → lifecycle-operations-Db-_MG-O.js} +9 -12
  40. package/dist/{navigate-CV-RDqYP.d.ts → navigate-CPpT8BpL.d.ts} +1 -1
  41. package/dist/{navigate-BTPrVhqI.js → navigate-CuGQzS_Y.js} +8 -104
  42. package/dist/{portal-D7TC986A.js → portal-wY3j0vvp.js} +59 -1
  43. package/dist/{query-registry-CQIT4mXr.js → query-registry-Bu_cuMch.js} +1 -1
  44. package/dist/{renderer-DF0hyjEr.js → renderer-BJYY2Y8s.js} +91 -10
  45. package/dist/resources/index.d.ts +27 -8
  46. package/dist/resources/index.js +218 -4
  47. package/dist/{route-matching-DLBWDeXX.js → route-matching-M-f1VQRu.js} +276 -2
  48. package/dist/router/index.d.ts +8 -8
  49. package/dist/router/index.js +28 -17
  50. package/dist/{router-C0XQA62W.d.ts → router-wmx6Uher.d.ts} +1 -1
  51. package/dist/{selector-DueeR6Oz.js → selector-DEfqO1rA.js} +8 -0
  52. package/dist/ssg/index.d.ts +8 -1
  53. package/dist/ssg/index.js +53 -17
  54. package/dist/ssr/index.d.ts +15 -1
  55. package/dist/ssr/index.js +1 -1
  56. package/dist/{ssr-vE-KUgDV.js → ssr-BSUA9Y64.js} +72 -78
  57. package/dist/testing/index.d.ts +35 -2
  58. package/dist/testing/index.js +182 -3
  59. package/dist/types-C9YcqVpk.d.ts +16 -0
  60. package/dist/{verify-hydration-ChyEiBAn.js → verify-hydration-CVSGv6Vs.js} +1 -1
  61. package/package.json +4 -2
  62. package/dist/attr-names-CjhzmHOn.js +0 -15
  63. package/dist/component-scope-CvPba6O6.d.ts +0 -12
  64. package/dist/invalidation-listeners-Des3AHYs.js +0 -13
  65. package/dist/jsx-runtime-X2SX2y8V.d.ts +0 -2
  66. package/dist/resource-operation-BJiLoLYZ.js +0 -276
  67. package/dist/types-DEhT-Nrv.d.ts +0 -63
@@ -1,3 +1,3 @@
1
- import { i as definePortal, n as Portal, t as DefaultPortal } from "../portal-D7TC986A.js";
1
+ import { i as definePortal, n as Portal, t as DefaultPortal } from "../portal-wY3j0vvp.js";
2
2
  import { a as layout, i as Slot, r as Presence } from "../structures-DUB3HchX.js";
3
3
  export { DefaultPortal, Portal, Presence, Slot, definePortal, layout };
@@ -1,3 +1,3 @@
1
1
  import { r as JSXElement } from "../../jsx-Dvr2SGRG.js";
2
- import { _ as definePortal, a as Collection, c as Presence, d as SlotProps, f as LayoutComponent, g as PortalProps, h as Portal, i as createLayer, l as PresenceProps, m as DefaultPortal, n as LayerManager, o as CollectionItem, p as layout, r as LayerOptions, s as createCollection, t as Layer, u as Slot } from "../../index-DjusBb1I.js";
2
+ import { _ as definePortal, a as Collection, c as Presence, d as SlotProps, f as LayoutComponent, g as PortalProps, h as Portal, i as createLayer, l as PresenceProps, m as DefaultPortal, n as LayerManager, o as CollectionItem, p as layout, r as LayerOptions, s as createCollection, t as Layer, u as Slot } from "../../index-5TeJ46BR.js";
3
3
  export { type Collection, type CollectionItem, DefaultPortal, type JSXElement, type Layer, type LayerManager, type LayerOptions, type LayoutComponent, Portal, type PortalProps, Presence, type PresenceProps, Slot, type SlotProps, createCollection, createLayer, definePortal, layout };
@@ -1,3 +1,3 @@
1
- import { i as definePortal, n as Portal, t as DefaultPortal } from "../../portal-D7TC986A.js";
1
+ import { i as definePortal, n as Portal, t as DefaultPortal } from "../../portal-wY3j0vvp.js";
2
2
  import { a as layout, i as Slot, n as createCollection, r as Presence, t as createLayer } from "../../structures-DUB3HchX.js";
3
3
  export { DefaultPortal, Portal, Presence, Slot, createCollection, createLayer, definePortal, layout };
@@ -1,9 +1,9 @@
1
1
  import { c as RenderableChild } from "./control-DO-iBEtV.js";
2
2
  import { r as JSXElement } from "./jsx-Dvr2SGRG.js";
3
- import "./types-DEhT-Nrv.js";
3
+ import "./types-C9YcqVpk.js";
4
4
  //#region src/runtime/portal.d.ts
5
5
  interface Portal<T extends RenderableChild = RenderableChild> {
6
- (): unknown;
6
+ (): T | JSXElement | null | undefined;
7
7
  render(props: {
8
8
  children?: T;
9
9
  }): unknown;
@@ -1,6 +1,17 @@
1
1
  import { i as Scope, n as ReadableSource, r as ComponentInstance } from "./control-DO-iBEtV.js";
2
2
  import { t as Scheduler } from "./scheduler-CmLO4Dfm.js";
3
- import "./jsx-runtime-X2SX2y8V.js";
3
+ import "./jsx-runtime-C-oIHX9X.js";
4
+ //#region src/runtime/component-scope.d.ts
5
+ /**
6
+ * Get the abort signal for the current component.
7
+ *
8
+ * The signal is guaranteed to be aborted when:
9
+ * - Component unmounts
10
+ * - Navigation occurs (different route)
11
+ * - Parent is destroyed
12
+ */
13
+ declare function getSignal(): AbortSignal;
14
+ //#endregion
4
15
  //#region src/runtime/runtime.d.ts
5
16
  interface RuntimeKeyedReorderDecision {
6
17
  useFastPath: boolean;
@@ -51,6 +62,7 @@ type SnapshotSource<T> = {
51
62
  pending?: boolean;
52
63
  error?: Error | null;
53
64
  } & SnapshotSourceBrand;
65
+ /** Creates a render-scoped derived value; must be called during component render. */
54
66
  declare function derive<TOut>(fn: () => TOut): Derived<TOut>;
55
67
  declare function derive<TIn, TOut>(source: SnapshotSource<TIn> | TIn | (() => TIn), map: (value: TIn) => TOut): Derived<TOut | null>;
56
68
  //#endregion
@@ -61,10 +73,30 @@ interface Selector<T> {
61
73
  type SelectorEquals<T> = {
62
74
  bivarianceHack(a: T, b: T): boolean;
63
75
  }['bivarianceHack'];
76
+ /**
77
+ * Creates a render-scoped predicate for keyed membership in reactive list rows.
78
+ *
79
+ * Use this when a `<For>` child needs to compare each stable item with a
80
+ * changing selected value. Unlike a plain closure capture, the predicate
81
+ * subscribes the affected rows and updates them without rebuilding the list.
82
+ * Must be called during component render.
83
+ */
64
84
  declare function selector<T>(source: () => T, equals?: SelectorEquals<T>): Selector<T>;
65
85
  //#endregion
66
86
  //#region src/csp-nonce.d.ts
67
87
  declare const CspNonceScope: Scope<string | undefined>;
68
88
  declare function cspNonce(): string | undefined;
69
89
  //#endregion
70
- export { Derived as a, AskrRuntimeOptions as c, createRuntime as d, getDefaultRuntime as f, selector as i, RuntimeKeyedReorderDecision as l, cspNonce as n, derive as o, Selector as r, AskrRuntime as s, CspNonceScope as t, RuntimeRendererHost as u };
90
+ //#region src/ref.d.ts
91
+ /**
92
+ * Creates a stable holder for an intrinsic element ref.
93
+ *
94
+ * The renderer mutates `current` during commit and clears it during cleanup.
95
+ * Updating the holder never schedules a render.
96
+ */
97
+ interface Ref<T extends Element = Element> {
98
+ current: T | null;
99
+ }
100
+ declare function createRef<T extends Element = Element>(): Ref<T>;
101
+ //#endregion
102
+ export { Selector as a, derive as c, RuntimeKeyedReorderDecision as d, RuntimeRendererHost as f, getSignal as h, cspNonce as i, AskrRuntime as l, getDefaultRuntime as m, createRef as n, selector as o, createRuntime as p, CspNonceScope as r, Derived as s, Ref as t, AskrRuntimeOptions as u };
@@ -1,6 +1,6 @@
1
1
  import { c as RenderableChild, g as StateTuple } from "./control-DO-iBEtV.js";
2
2
  import { r as JSXElement } from "./jsx-Dvr2SGRG.js";
3
- import "./index-BFnTM1a8.js";
3
+ import "./index-BHQmliBq.js";
4
4
  import { ObjectSchema } from "@askrjs/schema";
5
5
  //#region src/actions/index.d.ts
6
6
  interface ActionDescriptor<TInput extends Record<string, unknown> = Record<string, unknown>> {
@@ -7,6 +7,11 @@ type BoundaryChild = RenderableChild;
7
7
  type ForBaseProps<T> = {
8
8
  each: ForEachSource<T>;
9
9
  fallback?: BoundaryChild;
10
+ /**
11
+ * Row renderer. Parent reactive reads must use `selector()` or thunk props;
12
+ * closure-captured values are snapshotted when the row is created or
13
+ * reconciled; changing the parent source does not rerun an existing row.
14
+ */
10
15
  children: (item: T, index: () => number) => VNode;
11
16
  };
12
17
  type KeyedForProps<T, K extends string | number> = ForBaseProps<T> & {
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { _ as state, a as defineScope, g as StateTuple, h as StateSetter, i as Scope, m as State, o as readScope } from "./control-DO-iBEtV.js";
2
2
  import { s as Props, t as Fragment } from "./jsx-Dvr2SGRG.js";
3
- import { t as getSignal } from "./component-scope-CvPba6O6.js";
4
- import { a as Derived, c as AskrRuntimeOptions, d as createRuntime, f as getDefaultRuntime, i as selector, l as RuntimeKeyedReorderDecision, n as cspNonce, o as derive, r as Selector, s as AskrRuntime, t as CspNonceScope, u as RuntimeRendererHost } from "./index-BFnTM1a8.js";
5
- import { a as Show, c as ForProps, i as MatchProps, n as CaseProps, o as ShowProps, r as Match, s as For, t as Case } from "./index-Dh6ZF9yW.js";
6
- import { i as jsxs, n as jsx } from "./jsx-runtime-aYZ8zb4q.js";
3
+ import { a as Selector, c as derive, d as RuntimeKeyedReorderDecision, f as RuntimeRendererHost, h as getSignal, i as cspNonce, l as AskrRuntime, m as getDefaultRuntime, n as createRef, o as selector, p as createRuntime, r as CspNonceScope, s as Derived, t as Ref, u as AskrRuntimeOptions } from "./index-BHQmliBq.js";
4
+ import { a as Show, c as ForProps, i as MatchProps, n as CaseProps, o as ShowProps, r as Match, s as For, t as Case } from "./index-UmwPZ8ZN.js";
5
+ import { i as jsxs, n as jsx } from "./jsx-runtime-Cr1jspx9.js";
7
6
  import { A as ServerQueryHandler, D as QueryPrefetchContext, T as QueryDefinition, a as defineServerQueries, c as prefetchQuery, g as createQuery, i as defineQuery, l as serveQuery, o as dehydrateDataRuntime, s as hydrateDataRuntime, v as DataRuntime } from "./index-Bki2rqcr.js";
8
- export { AskrRuntime, type AskrRuntimeOptions, Case, type CaseProps, CspNonceScope, type DataRuntime, type Derived, For, type ForProps, Fragment, Match, type MatchProps, type Props, type QueryDefinition, type QueryPrefetchContext, type RuntimeKeyedReorderDecision, type RuntimeRendererHost, type Scope, type Selector, type ServerQueryHandler, Show, type ShowProps, type State, type StateSetter, type StateTuple, createQuery, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, selector, serveQuery, state };
7
+ export { AskrRuntime, type AskrRuntimeOptions, Case, type CaseProps, CspNonceScope, type DataRuntime, type Derived, For, type ForProps, Fragment, Match, type MatchProps, type Props, type QueryDefinition, type QueryPrefetchContext, type Ref, type RuntimeKeyedReorderDecision, type RuntimeRendererHost, type Scope, type Selector, type ServerQueryHandler, Show, type ShowProps, type State, type StateSetter, type StateTuple, createQuery, createRef, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, selector, serveQuery, state };
package/dist/index.js CHANGED
@@ -4,14 +4,14 @@ import { h as readScope, u as defineScope } from "./component-internal-CPjM4n8M.
4
4
  import { f as syncDerivedDependencySubscriptions, l as notifyReadableReaders, o as markReactivePropsDirtySource, p as withDerivedReadTracking, r as clearDerivedDependencySubscriptions, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BYSoWJSv.js";
5
5
  import { g as getSignal, i as claimHookIndex, p as getCurrentInstance } from "./component-scope-CC3cojX9.js";
6
6
  import { n as isSnapshotSource } from "./snapshot-source-BB42xgwb.js";
7
- import { t as installRendererBridge } from "./renderer-DF0hyjEr.js";
7
+ import { t as installRendererBridge } from "./renderer-BJYY2Y8s.js";
8
8
  import { t as state } from "./state-CVuQVjvK.js";
9
- import { t as selector } from "./selector-DueeR6Oz.js";
9
+ import { t as selector } from "./selector-DEfqO1rA.js";
10
10
  import { jsx, jsxs } from "./jsx-runtime.js";
11
- import { n as cspNonce, t as CspNonceScope } from "./csp-nonce-HGZ0vbqT.js";
12
- import { i as For, n as Match, r as Show, t as Case } from "./control-CA45Yvvu.js";
13
- import { t as createQuery } from "./data-DHt_zO1G.js";
14
- import { a as hydrateDataRuntime, i as dehydrateDataRuntime, n as defineQuery, o as prefetchQuery, r as defineServerQueries, s as serveQuery } from "./query-registry-CQIT4mXr.js";
11
+ import { n as cspNonce, t as CspNonceScope } from "./csp-nonce-CwSRP3Jl.js";
12
+ import { i as For, n as Match, r as Show, t as Case } from "./control-DVRBkN2X.js";
13
+ import { t as createQuery } from "./data-DFcSmGvN.js";
14
+ import { a as hydrateDataRuntime, i as dehydrateDataRuntime, n as defineQuery, o as prefetchQuery, r as defineServerQueries, s as serveQuery } from "./query-registry-Bu_cuMch.js";
15
15
  //#region src/runtime/derive.ts
16
16
  const deriveCells = /* @__PURE__ */ new WeakMap();
17
17
  const dirtyDerivedCells = /* @__PURE__ */ new Set();
@@ -149,6 +149,11 @@ function derive(source, map) {
149
149
  return cell;
150
150
  }
151
151
  //#endregion
152
+ //#region src/ref.ts
153
+ function createRef() {
154
+ return { current: null };
155
+ }
156
+ //#endregion
152
157
  //#region src/index.ts
153
158
  /**
154
159
  * Askr: Actor-backed deterministic UI framework
@@ -157,4 +162,4 @@ function derive(source, map) {
157
162
  */
158
163
  installRendererBridge();
159
164
  //#endregion
160
- export { AskrRuntime, Case, CspNonceScope, For, Fragment, Match, Show, createQuery, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, selector, serveQuery, state };
165
+ export { AskrRuntime, Case, CspNonceScope, For, Fragment, Match, Show, createQuery, createRef, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, selector, serveQuery, state };
@@ -1,12 +1,14 @@
1
1
  import { a as IntrinsicFallbackProps, i as JSXElementType, n as JSXComponent, o as KnownIntrinsicElementProps, r as JSXElement, s as Props, t as Fragment } from "./jsx-Dvr2SGRG.js";
2
2
  import { t as EagerControlPrimitive } from "./control-BjYBlytA.js";
3
- import "./types-DEhT-Nrv.js";
3
+ import "./types-C9YcqVpk.js";
4
4
  //#region src/jsx/jsx-dev-runtime.d.ts
5
5
  declare namespace JSX {
6
+ type ElementType = string | symbol | ((props: never) => unknown);
6
7
  interface Element extends JSXElement {
7
8
  readonly __askrJsxElementBrand?: never;
8
9
  }
9
- interface IntrinsicElements extends KnownIntrinsicElementProps {
10
+ interface KnownIntrinsicElements extends KnownIntrinsicElementProps {}
11
+ interface IntrinsicElements extends KnownIntrinsicElements {
10
12
  [elem: string]: IntrinsicFallbackProps | KnownIntrinsicElementProps[keyof KnownIntrinsicElementProps];
11
13
  }
12
14
  interface ElementAttributesProperty {
@@ -0,0 +1,2 @@
1
+ import "./types-C9YcqVpk.js";
2
+ import "./jsx-runtime-Cr1jspx9.js";
@@ -1,12 +1,14 @@
1
1
  import { a as IntrinsicFallbackProps, o as KnownIntrinsicElementProps, r as JSXElement, s as Props } from "./jsx-Dvr2SGRG.js";
2
2
  import { t as EagerControlPrimitive } from "./control-BjYBlytA.js";
3
- import "./types-DEhT-Nrv.js";
3
+ import "./types-C9YcqVpk.js";
4
4
  //#region src/jsx/jsx-runtime.d.ts
5
5
  declare namespace JSX {
6
+ type ElementType = string | symbol | ((props: never) => unknown);
6
7
  interface Element extends JSXElement {
7
8
  readonly __askrJsxElementBrand?: never;
8
9
  }
9
- interface IntrinsicElements extends KnownIntrinsicElementProps {
10
+ interface KnownIntrinsicElements extends KnownIntrinsicElementProps {}
11
+ interface IntrinsicElements extends KnownIntrinsicElements {
10
12
  [elem: string]: IntrinsicFallbackProps | KnownIntrinsicElementProps[keyof KnownIntrinsicElementProps];
11
13
  }
12
14
  interface ElementAttributesProperty {
@@ -1,3 +1,3 @@
1
1
  import { i as JSXElementType, n as JSXComponent, r as JSXElement, t as Fragment } from "./jsx-Dvr2SGRG.js";
2
- import { i as jsxs, n as jsx, r as jsxDEV, t as JSX } from "./jsx-runtime-aYZ8zb4q.js";
2
+ import { i as jsxs, n as jsx, r as jsxDEV, t as JSX } from "./jsx-runtime-Cr1jspx9.js";
3
3
  export { Fragment, JSX, type JSXComponent, type JSXElement, type JSXElementType, jsx, jsxDEV, jsxs };
@@ -53,13 +53,16 @@ function detachListenerSlot(slot) {
53
53
  }
54
54
  function commitListenerSlot(instance, slot) {
55
55
  slot.handler = slot.pendingHandler;
56
- if (!slot.attached || slot.target !== slot.pendingTarget || slot.event !== slot.pendingEvent || !listenerOptionsEqual(slot.options, slot.pendingOptions)) {
56
+ const resolvedTarget = typeof slot.pendingTarget === "function" ? typeof window === "undefined" ? null : slot.pendingTarget() ?? null : slot.pendingTarget;
57
+ if (!slot.attached || slot.target !== resolvedTarget || slot.event !== slot.pendingEvent || !listenerOptionsEqual(slot.options, slot.pendingOptions)) {
57
58
  detachListenerSlot(slot);
58
- slot.target = slot.pendingTarget;
59
+ slot.target = resolvedTarget;
59
60
  slot.event = slot.pendingEvent;
60
61
  slot.options = slot.pendingOptions;
61
- slot.target.addEventListener(slot.event, slot.listener, slot.options);
62
- slot.attached = true;
62
+ if (slot.target) {
63
+ slot.target.addEventListener(slot.event, slot.listener, slot.options);
64
+ slot.attached = true;
65
+ }
63
66
  }
64
67
  if (!slot.cleanupRegistered) {
65
68
  slot.cleanupRegistered = true;
@@ -151,13 +154,7 @@ function timer(intervalMs, fn, options) {
151
154
  commitTimerSlot(instance, slot);
152
155
  });
153
156
  }
154
- function stream(_source, _options) {
155
- return {
156
- value: null,
157
- pending: true,
158
- error: null
159
- };
160
- }
157
+ /** Runs an owned task after commit. */
161
158
  function task(fn) {
162
159
  const instance = getCurrentComponentInstance();
163
160
  if (!instance) return;
@@ -190,4 +187,4 @@ function capture(fn) {
190
187
  return () => value;
191
188
  }
192
189
  //#endregion
193
- export { stream as a, windowFocused as c, routeActive as i, documentVisible as n, task as o, on as r, timer as s, capture as t };
190
+ export { task as a, routeActive as i, documentVisible as n, timer as o, on as r, windowFocused as s, capture as t };
@@ -1,4 +1,4 @@
1
- import "./router-C0XQA62W.js";
1
+ import "./router-wmx6Uher.js";
2
2
  //#region src/router/navigation-scroll.d.ts
3
3
  type NavigationScrollBehavior = 'top' | 'preserve';
4
4
  type HistoryScrollBehavior = 'restore' | 'top' | 'preserve';
@@ -1,111 +1,15 @@
1
1
  import { b as isDevelopmentEnvironment, r as flushRuntimeScheduler, v as logger, x as isProductionEnvironment } from "./access-ePqdQqkV.js";
2
2
  import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-CUpRxrLH.js";
3
3
  import { r as executeComponent } from "./component-internal-CPjM4n8M.js";
4
- import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, t as cleanupReadableSubscriptionSources, u as recordReadableRead } from "./readable-BYSoWJSv.js";
5
- import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance } from "./component-scope-CC3cojX9.js";
4
+ import { t as cleanupReadableSubscriptionSources } from "./readable-BYSoWJSv.js";
6
5
  import { n as cleanupComponentGeneration, t as cleanupComponent } from "./component-cleanup-1ZFoLLHt.js";
7
6
  import { i as drainLifecycleCommitErrors, p as isPromiseLike, r as discardLifecycleCommitBatch, s as flushLifecycleCommitBatch, t as beginLifecycleCommitBatch } from "./lifecycle-batch-COgl8jMS.js";
8
- import { _ as teardownNodeSubtree } from "./cleanup-B4BiQHx-.js";
9
- import { d as getRouteRenderContext, f as getRouteRenderData, m as resolveRouteRequest, p as hasRouteRenderData } from "./deferred-zHtUheIQ.js";
10
- import { n as getActiveRenderContext } from "./render-context-Clw3rFiO.js";
11
- import { n as syncRouteActivitySnapshot } from "./route-activity-CNJfpwx-.js";
12
- import { r as clearDefaultPortalForInstance, t as DefaultPortal } from "./portal-D7TC986A.js";
13
- import { t as CspNonceScope } from "./csp-nonce-HGZ0vbqT.js";
14
- import { c as deepFreeze, g as getActiveRoutes, j as lockRouteRegistration, l as makeQuery, n as computeMatchesFromRoutes, r as computeRouteActivityMatches, u as parseLocation } from "./route-matching-DLBWDeXX.js";
15
- //#region src/common/app-render-runtime.ts
16
- const stagedRouteLocations = /* @__PURE__ */ new WeakMap();
17
- function createAppRenderRuntime(input = {}) {
18
- return {
19
- framework: Object.freeze({ ...input.framework }),
20
- route: input.route,
21
- hasRoute: input.hasRoute ?? false
22
- };
23
- }
24
- function stageAppRenderRouteLocation(runtime, href) {
25
- stagedRouteLocations.set(runtime, href);
26
- }
27
- function getStagedAppRenderRouteLocation(runtime) {
28
- return runtime ? stagedRouteLocations.get(runtime) : void 0;
29
- }
30
- function clearStagedAppRenderRouteLocation(runtime) {
31
- if (runtime) stagedRouteLocations.delete(runtime);
32
- }
33
- //#endregion
34
- //#region src/router/activity.ts
35
- let currentRouteSnapshot = buildRouteSnapshot("/", "", "");
36
- const currentRouteSource = (() => currentRouteSnapshot);
37
- currentRouteSource._readers = /* @__PURE__ */ new Map();
38
- let serverLocation = null;
39
- function setServerLocation(url) {
40
- serverLocation = url;
41
- if (url) {
42
- const parsed = parseLocation(url);
43
- syncRouteActivitySnapshot(parsed.pathname, computeMatchesFromRoutes(parsed.pathname, getActiveRoutes()));
44
- return;
45
- }
46
- syncRouteActivitySnapshot(currentRouteSnapshot.path, currentRouteSnapshot.matches);
47
- }
48
- function buildRouteSnapshot(pathname, search, hash) {
49
- const query = makeQuery(search);
50
- const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
51
- return Object.freeze({
52
- path: pathname,
53
- params: deepFreeze({ ...matches[0]?.params }),
54
- query,
55
- hash: hash || null,
56
- matches: Object.freeze(matches)
57
- });
58
- }
59
- function setCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
60
- currentRouteSnapshot = buildRouteSnapshot(pathname, search, hash);
61
- syncRouteActivitySnapshot(pathname, activityMatches ?? currentRouteSnapshot.matches);
62
- const instance = getCurrentComponentInstance();
63
- markReadableDerivedSubscribersDirty(currentRouteSource);
64
- markReactivePropsDirtySource(currentRouteSource);
65
- notifyReadableReaders(currentRouteSource, instance);
66
- }
67
- function readCurrentRouteLocation() {
68
- const renderContext = getActiveRenderContext();
69
- if (renderContext?.url) return parseLocation(renderContext.url);
70
- const stagedRouteLocation = getStagedAppRenderRouteLocation(getCurrentAppRenderRuntime());
71
- if (stagedRouteLocation) return parseLocation(stagedRouteLocation);
72
- if (typeof window !== "undefined" && window.location) return {
73
- pathname: window.location.pathname || "/",
74
- search: window.location.search || "",
75
- hash: window.location.hash || ""
76
- };
77
- if (serverLocation) return parseLocation(serverLocation);
78
- return {
79
- pathname: currentRouteSnapshot.path,
80
- search: "",
81
- hash: currentRouteSnapshot.hash ?? ""
82
- };
83
- }
84
- function readCurrentRouteSnapshot() {
85
- if (!getCurrentComponentInstance()) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
86
- const { pathname, search, hash } = readCurrentRouteLocation();
87
- const query = makeQuery(search);
88
- const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
89
- const params = deepFreeze({ ...getActiveRenderContext()?.params ?? matches[0]?.params ?? {} });
90
- return Object.freeze({
91
- path: pathname,
92
- params,
93
- query,
94
- hash: hash || null,
95
- matches: Object.freeze(matches)
96
- });
97
- }
98
- function currentRoute() {
99
- const instance = getCurrentComponentInstance();
100
- if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
101
- if (typeof window === "undefined" || instance.ssr) return readCurrentRouteSnapshot();
102
- recordReadableRead(currentRouteSource);
103
- return readCurrentRouteSnapshot();
104
- }
105
- function syncCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
106
- setCurrentRouteSnapshot(pathname, search, hash, activityMatches);
107
- }
108
- //#endregion
7
+ import { _ as teardownNodeSubtree } from "./cleanup-D8Ufd9Ix.js";
8
+ import { d as getRouteRenderContext, f as getRouteRenderData, m as resolveRouteRequest, p as hasRouteRenderData } from "./deferred-Cr58yIQD.js";
9
+ import { j as lockRouteRegistration, r as computeRouteActivityMatches } from "./route-matching-M-f1VQRu.js";
10
+ import { r as clearDefaultPortalForInstance, t as DefaultPortal } from "./portal-wY3j0vvp.js";
11
+ import { t as CspNonceScope } from "./csp-nonce-CwSRP3Jl.js";
12
+ import { a as clearStagedAppRenderRouteLocation, i as syncCurrentRouteSnapshot, o as createAppRenderRuntime, s as stageAppRenderRouteLocation } from "./activity-C2tPn9Fr.js";
109
13
  //#region src/router/navigation-registry.ts
110
14
  let currentInstance = null;
111
15
  let currentPathname = "/";
@@ -1139,4 +1043,4 @@ function initializeNavigation() {
1139
1043
  window.addEventListener("popstate", handlePopState);
1140
1044
  }
1141
1045
  //#endregion
1142
- export { currentRoute as _, 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, setServerLocation as v, createAppRenderRuntime as y };
1046
+ 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,9 +1,59 @@
1
1
  import { o as getRuntimeRenderer } from "./access-ePqdQqkV.js";
2
+ import { t as ELEMENT_TYPE } from "./jsx-CUpRxrLH.js";
2
3
  import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BYSoWJSv.js";
3
4
  import { f as getCurrentComponentInstance, m as getCurrentPortalScope } from "./component-scope-CC3cojX9.js";
4
5
  import { t as cleanupComponent } from "./component-cleanup-1ZFoLLHt.js";
5
6
  import { c as getCurrentLifecycleCommitBatch, u as registerLifecycleTransaction } from "./lifecycle-batch-COgl8jMS.js";
7
+ import { n as getActiveRenderContext } from "./render-context-Clw3rFiO.js";
8
+ //#region src/common/portal.ts
9
+ /**
10
+ * Internal marker used to defer server portal host output until all writes in
11
+ * the current render root are known.
12
+ *
13
+ * @internal
14
+ */
15
+ const SSR_PORTAL_HOST = Symbol.for("askr.ssr-portal-host");
16
+ //#endregion
6
17
  //#region src/runtime/portal.ts
18
+ const DEFAULT_SSR_PORTAL_KEY = {};
19
+ function getSSRPortalSlot(key) {
20
+ const context = getActiveRenderContext();
21
+ if (context?.mode !== "ssr") return null;
22
+ let slot = context.ssrPortals.slots.get(key);
23
+ if (!slot) {
24
+ slot = {
25
+ hasValue: false,
26
+ value: void 0,
27
+ hosts: []
28
+ };
29
+ context.ssrPortals.slots.set(key, slot);
30
+ }
31
+ return {
32
+ context,
33
+ slot
34
+ };
35
+ }
36
+ function createSSRPortalHost(key, automatic) {
37
+ const current = getSSRPortalSlot(key);
38
+ if (!current) return null;
39
+ const token = `<!--askr-portal:${current.context.ssrPortals.nextHostId++}-->`;
40
+ current.slot.hosts.push({
41
+ token,
42
+ automatic
43
+ });
44
+ return {
45
+ $$typeof: ELEMENT_TYPE,
46
+ type: SSR_PORTAL_HOST,
47
+ props: { token }
48
+ };
49
+ }
50
+ function writeSSRPortal(key, children) {
51
+ const current = getSSRPortalSlot(key);
52
+ if (!current) return false;
53
+ current.slot.hasValue = true;
54
+ current.slot.value = children;
55
+ return true;
56
+ }
7
57
  function createPortalSlot() {
8
58
  let currentValue;
9
59
  const source = (() => {
@@ -24,12 +74,16 @@ function createPortalSlot() {
24
74
  };
25
75
  }
26
76
  function definePortal() {
77
+ const ssrPortalKey = {};
27
78
  if (typeof createPortalSlot === "function") {
28
79
  const slot = createPortalSlot();
29
80
  function PortalHost() {
81
+ const serverHost = createSSRPortalHost(ssrPortalKey, false);
82
+ if (serverHost) return serverHost;
30
83
  return slot.read();
31
84
  }
32
85
  PortalHost.render = function PortalRender(props) {
86
+ if (writeSSRPortal(ssrPortalKey, props.children)) return null;
33
87
  slot.write(props.children);
34
88
  return null;
35
89
  };
@@ -306,6 +360,8 @@ function clearDefaultPortalForInstance(instance) {
306
360
  }
307
361
  const DefaultPortal = (() => {
308
362
  function Host(props) {
363
+ const serverHost = createSSRPortalHost(DEFAULT_SSR_PORTAL_KEY, props?.__askrAutoDefaultPortal === true);
364
+ if (serverHost) return serverHost;
309
365
  const owner = getCurrentComponentInstance();
310
366
  const scope = resolveDefaultPortalScope(owner);
311
367
  if (!scope) return null;
@@ -321,16 +377,18 @@ const DefaultPortal = (() => {
321
377
  return value === void 0 ? null : value;
322
378
  }
323
379
  Host.render = function Render(props) {
380
+ if (writeSSRPortal(DEFAULT_SSR_PORTAL_KEY, props.children)) return null;
324
381
  writeDefaultPortal(props, getCurrentComponentInstance());
325
382
  return null;
326
383
  };
327
384
  return Host;
328
385
  })();
329
386
  function Portal(props) {
387
+ if (writeSSRPortal(DEFAULT_SSR_PORTAL_KEY, props.children)) return null;
330
388
  const owner = getCurrentComponentInstance();
331
389
  if (owner) registerDefaultPortalOwner(owner);
332
390
  writeDefaultPortal(props, owner);
333
391
  return null;
334
392
  }
335
393
  //#endregion
336
- export { disposeDefaultPortalScope as a, definePortal as i, Portal as n, clearDefaultPortalForInstance as r, DefaultPortal as t };
394
+ export { disposeDefaultPortalScope as a, definePortal as i, Portal as n, SSR_PORTAL_HOST as o, clearDefaultPortalForInstance as r, DefaultPortal as t };
@@ -1,4 +1,4 @@
1
- import { i as getDefaultDataRuntime, t as createDataRuntime } from "./data-runtime-SJ1BSUvk.js";
1
+ import { i as getDefaultDataRuntime, t as createDataRuntime } from "./data-runtime-rpV6-3XW.js";
2
2
  //#region src/common/telemetry.ts
3
3
  function withTelemetry(span, fields, work) {
4
4
  return span ? span(fields, work) : work();