@askrjs/askr 0.0.92 → 0.0.95

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 (89) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +3 -1
  3. package/dist/{access-DSkccuEI.js → access-d_DCdwqn.js} +3 -0
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.js +3 -2
  6. package/dist/{activity-DxUcygE5.d.ts → activity-D_5x2HXQ.d.ts} +5 -1
  7. package/dist/{activity-DodHdC0L.js → activity-d4t3CdzK.js} +4 -2
  8. package/dist/benchmark.d.ts +1 -1
  9. package/dist/benchmark.js +8 -8
  10. package/dist/boot/index.d.ts +12 -3
  11. package/dist/boot/index.js +1 -1
  12. package/dist/{boot-D71bjP4r.js → boot-C1wT3Vfs.js} +23 -15
  13. package/dist/{cleanup-DAAhJjx5.js → cleanup-D7uN-Z1s.js} +4 -4
  14. package/dist/{component-cleanup-CJCfu5ed.js → component-cleanup-DYG80yhG.js} +4 -2
  15. package/dist/{component-internal-DlAkCgBE.js → component-internal-D0yE2Ch3.js} +79 -13
  16. package/dist/components/index.d.ts +11 -3
  17. package/dist/components/index.js +5 -2
  18. package/dist/{compose-ref-Cc_YkUpM.js → compose-ref-1Fhs7mbF.js} +13 -0
  19. package/dist/{compose-ref-Cizq72-x.d.ts → compose-ref-DOJHoW5X.d.ts} +3 -0
  20. package/dist/control/index.d.ts +1 -1
  21. package/dist/control/index.js +1 -1
  22. package/dist/{control-Dv540XtV.js → control-C0klPV7Q.js} +9 -5
  23. package/dist/{control-CdzY49Q2.d.ts → control-DdFw-Caz.d.ts} +1 -1
  24. package/dist/{csp-nonce-ByMbWv8s.js → csp-nonce-BVybpV1v.js} +8 -1
  25. package/dist/data/index.d.ts +1 -1
  26. package/dist/data/index.js +3 -3
  27. package/dist/{data-DcikEH9N.js → data-Bm8L6JOm.js} +15 -4
  28. package/dist/{data-runtime-oIdQWnPW.js → data-runtime-JxoRgrrt.js} +2 -0
  29. package/dist/{deferred-B6CafO5u.js → deferred-p8hyanxJ.js} +8 -3
  30. package/dist/{effect-BdZcHblj.js → effect-BdvdgMvV.js} +2 -2
  31. package/dist/{fastlane-B2s24fWt.js → fastlane-DGo7SxBQ.js} +3 -3
  32. package/dist/{for-internal-T1C7jd7x.js → for-internal-DkBwTG4S.js} +5 -5
  33. package/dist/foundations/icon/index.d.ts +14 -2
  34. package/dist/foundations/icon/index.js +8 -0
  35. package/dist/foundations/index.d.ts +2 -2
  36. package/dist/foundations/index.js +1 -1
  37. package/dist/foundations/interactions/index.d.ts +18 -2
  38. package/dist/foundations/interactions/index.js +1 -1
  39. package/dist/foundations/state/index.d.ts +8 -1
  40. package/dist/foundations/state/index.js +7 -1
  41. package/dist/foundations/structures/index.d.ts +2 -2
  42. package/dist/foundations/structures/index.js +1 -1
  43. package/dist/foundations/utilities/index.d.ts +2 -2
  44. package/dist/foundations/utilities/index.js +1 -1
  45. package/dist/fx/index.d.ts +10 -1
  46. package/dist/fx/index.js +7 -1
  47. package/dist/{index-DA3g8lm8.d.ts → index-CTIBOqUB.d.ts} +418 -5
  48. package/dist/{index-BnU0NPwM.d.ts → index-CzH-0LcA.d.ts} +18 -0
  49. package/dist/{index-oswRaMn6.d.ts → index-S2IqSJib.d.ts} +30 -2
  50. package/dist/index.d.ts +3 -4
  51. package/dist/index.js +13 -12
  52. package/dist/{interactions-CWkNEq_C.js → interactions-B4XaFxt1.js} +6 -1
  53. package/dist/{jsx-C3IECePB.js → jsx-DRS-qjiN.js} +2 -0
  54. package/dist/jsx-dev-runtime.d.ts +2 -2
  55. package/dist/jsx-dev-runtime.js +1 -1
  56. package/dist/jsx-runtime-BTzDdBJ_.d.ts +2 -0
  57. package/dist/{jsx-runtime-Cfb2umb4.d.ts → jsx-runtime-Cdd6Gkb0.d.ts} +4 -2
  58. package/dist/jsx-runtime.d.ts +2 -2
  59. package/dist/jsx-runtime.js +1 -1
  60. package/dist/{lifecycle-batch-Cyfd07rf.js → lifecycle-batch-BH0fax4F.js} +2 -2
  61. package/dist/{lifecycle-operations-CQ8fsc94.js → lifecycle-operations-CBzG5PyB.js} +6 -1
  62. package/dist/{manifest-Dv0bO6kg.js → manifest-D6rfj_jC.js} +4 -0
  63. package/dist/{navigate-BbWj-QU-.js → navigate-DChM5m8m.js} +13 -10
  64. package/dist/{navigate-CZHPEUC4.d.ts → navigate-eGm4omPj.d.ts} +6 -1
  65. package/dist/{query-registry-qm13pEdK.js → query-registry-CimB1YeW.js} +11 -1
  66. package/dist/{readable-B99wh5Z_.js → readable-BsdGWsDE.js} +1 -1
  67. package/dist/{renderer-C6jz9nIN.js → renderer-tXX_xj86.js} +10 -37
  68. package/dist/{resolution-B21kmOkp.js → resolution-BQyo7qNn.js} +11 -5
  69. package/dist/{resource-operation-CaAttQqz.js → resource-operation-B62UQKHV.js} +4 -4
  70. package/dist/resources/index.d.ts +15 -2
  71. package/dist/resources/index.js +6 -5
  72. package/dist/router/index.d.ts +46 -4
  73. package/dist/router/index.js +15 -8
  74. package/dist/{selector-BLWwI55m.js → selector-CyK-sDwB.js} +4 -3
  75. package/dist/ssg/index.d.ts +5 -1
  76. package/dist/ssg/index.js +5 -5
  77. package/dist/ssr/index.d.ts +16 -3
  78. package/dist/ssr/index.js +1 -1
  79. package/dist/{ssr-CaZfvQWn.js → ssr-DYcK20IX.js} +18 -10
  80. package/dist/{state-XPZYUzHL.js → state-DmkGM_LN.js} +3 -3
  81. package/dist/{structures-DKjkAmM5.js → structures-CPycoyZj.js} +63 -14
  82. package/dist/testing/index.d.ts +31 -2
  83. package/dist/testing/index.js +23 -5
  84. package/dist/{types-BA9FJtfR.d.ts → types-DkVJhVs9.d.ts} +4 -0
  85. package/dist/{verify-hydration-CcF-HJil.js → verify-hydration-m-wVbYOD.js} +1 -1
  86. package/package.json +1 -1
  87. package/dist/index-2bk8nldG.d.ts +0 -241
  88. package/dist/jsx-runtime-C_0v1pMN.d.ts +0 -2
  89. package/dist/scheduler-CmLO4Dfm.d.ts +0 -65
@@ -1,20 +1,20 @@
1
1
  import { t as __CONTROL_BOUNDARY__ } from "./control-C-ApnFs1.js";
2
2
  import { t as __ERROR_BOUNDARY__ } from "./vnode-D24p6IW2.js";
3
- import { y as logger } from "./access-DSkccuEI.js";
3
+ import { y as logger } from "./access-d_DCdwqn.js";
4
4
  import { f as getCurrentComponentInstance, w as setCurrentComponentInstance } from "./component-scope-4I3yEMkb.js";
5
- import { i as isFragmentType, n as Fragment, t as ELEMENT_TYPE } from "./jsx-C3IECePB.js";
6
- import { g as markVNodeTreeWithContextFrame, m as getVNodeContextFrame, n as createComponentInstance, p as getExecutionContextFrame, u as callWithContext } from "./component-internal-DlAkCgBE.js";
7
- import { t as cleanupComponent } from "./component-cleanup-CJCfu5ed.js";
8
- import { p as isPromiseLike } from "./lifecycle-batch-Cyfd07rf.js";
9
- import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-T1C7jd7x.js";
5
+ import { i as isFragmentType, n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
6
+ import { f as callWithContext, g as getVNodeContextFrame, h as getExecutionContextFrame, n as createComponentInstance, v as markVNodeTreeWithContextFrame } from "./component-internal-D0yE2Ch3.js";
7
+ import { t as cleanupComponent } from "./component-cleanup-DYG80yhG.js";
8
+ import { p as isPromiseLike } from "./lifecycle-batch-BH0fax4F.js";
9
+ import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-DkBwTG4S.js";
10
10
  import { C as SSRDataMissingError, _ as isEmptyPageRenderEnvelope, f as stopRenderPhase$1, h as createPageRenderEnvelope, t as configureRenderContextProvider, u as startRenderPhase$1, v as isPageRenderEnvelope, x as withHydrationRenderUrl } from "./render-context-B7ohlh6t.js";
11
11
  import { n as getPublicAttributeName, t as sanitizeCssValue } from "./css-BuPaTOfe.js";
12
- import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-ByMbWv8s.js";
12
+ import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-BVybpV1v.js";
13
13
  import { n as SSR_PORTAL_HOST, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.js";
14
- import { t as createDataRuntime } from "./data-runtime-oIdQWnPW.js";
15
- import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-qm13pEdK.js";
14
+ import { t as createDataRuntime } from "./data-runtime-JxoRgrrt.js";
15
+ import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-CimB1YeW.js";
16
16
  import { a as resolveRouteFromRoutes, c as removeRouteBasePath, s as normalizeRouteBasePath, t as _resolveRouteMatchFromRoutes } from "./route-matching-Bo6UqG-5.js";
17
- import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-B21kmOkp.js";
17
+ import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-BQyo7qNn.js";
18
18
  import { n as disposeRegisteredDefaultPortalScope, r as getDefaultPortalHost } from "./default-portal-runtime-DvMvWJVp.js";
19
19
  import { n as renderDocument, t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
20
20
  //#region src/ssr/escape.ts
@@ -182,6 +182,7 @@ function ensureRenderContextAccessor() {
182
182
  }
183
183
  } catch {}
184
184
  }
185
+ /** Build a fresh SSR render context (data cache, routes, seed) for a render pass. */
185
186
  function createRenderContext(seed = 12345, opts = {}) {
186
187
  clearEscapeCache();
187
188
  const queryCache = /* @__PURE__ */ new Map();
@@ -257,6 +258,7 @@ async function getAsyncRenderContextAccessor() {
257
258
  })();
258
259
  return asyncRenderContextAccessor;
259
260
  }
261
+ /** Run `fn` with `ctx` as the active SSR render context, using async-local storage. */
260
262
  async function withRenderContextAsync(ctx, fn) {
261
263
  const accessor = await getAsyncRenderContextAccessor();
262
264
  if (accessor) return accessor.run(ctx, () => Promise.resolve(fn()));
@@ -428,6 +430,7 @@ var StreamSink = class {
428
430
  };
429
431
  //#endregion
430
432
  //#region src/ssr/route-render.ts
433
+ /** Resolve a URL against a route registry for SSR, applying auth/policies before render. */
431
434
  async function resolveRequest(opts) {
432
435
  if (!opts?.registry) throw new TypeError("resolveRequest requires opts.registry.");
433
436
  const { url, auth, authContext, request, signal } = opts;
@@ -1184,6 +1187,7 @@ function renderNodeSyncToSink(node, sink, ctx) {
1184
1187
  renderChildrenSyncToSink(children, sink, ctx);
1185
1188
  sinkWrite3(sink, "</", typeStr, ">");
1186
1189
  }
1190
+ /** Synchronously render a component to an HTML string, without route resolution. */
1187
1191
  function renderToStringSync(component, props, options) {
1188
1192
  const seed = options?.seed ?? 12345;
1189
1193
  const nonce = validateCspNonce(options?.cspNonce);
@@ -1250,6 +1254,7 @@ function sameRouteParams(left, right) {
1250
1254
  for (const key of leftKeys) if (left[key] !== right[key]) return false;
1251
1255
  return true;
1252
1256
  }
1257
+ /** Synchronously render an already-resolved route handler to an HTML string. */
1253
1258
  function renderResolvedToStringSync(opts) {
1254
1259
  const { url, registry, handler, params, options } = opts;
1255
1260
  const routes = registry.routes;
@@ -1402,9 +1407,11 @@ function createDeferredRenderStream(initialHtml, boundaries, signal, seed, data,
1402
1407
  }
1403
1408
  });
1404
1409
  }
1410
+ /** Resolve and render a route request for SSR, streaming the body when possible. */
1405
1411
  async function renderRouteRequest(options) {
1406
1412
  return renderRouteRequestInternal(options);
1407
1413
  }
1414
+ /** Resolve and render a route request for SSR, always fully buffering the HTML. */
1408
1415
  async function renderRouteRequestToString(options) {
1409
1416
  const result = await renderRouteRequestInternal(options);
1410
1417
  if (result.kind !== "render" || !result.stream) return result;
@@ -1490,6 +1497,7 @@ function renderToString(arg) {
1490
1497
  if (typeof arg === "function") return renderToStringSync(arg);
1491
1498
  return renderRouteToString(arg, routeRenderHost);
1492
1499
  }
1500
+ /** Stream a route request's rendered HTML to the response sink described by `opts`. */
1493
1501
  function renderToStream(opts) {
1494
1502
  renderRouteToStream(opts, routeRenderHost);
1495
1503
  }
@@ -1,7 +1,7 @@
1
- import { S as isProductionEnvironment } from "./access-DSkccuEI.js";
2
- import { n as isBulkCommitActive, t as deferBulkCommitReadableNotification } from "./fastlane-B2s24fWt.js";
1
+ import { S as isProductionEnvironment } from "./access-d_DCdwqn.js";
2
+ import { n as isBulkCommitActive, t as deferBulkCommitReadableNotification } from "./fastlane-DGo7SxBQ.js";
3
3
  import { i as claimHookIndex, p as getCurrentInstance } from "./component-scope-4I3yEMkb.js";
4
- import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-B99wh5Z_.js";
4
+ import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BsdGWsDE.js";
5
5
  //#region src/runtime/state.ts
6
6
  /**
7
7
  * State primitive for Askr components
@@ -1,16 +1,18 @@
1
- import { o as getRuntimeRenderer } from "./access-DSkccuEI.js";
1
+ import { o as getRuntimeRenderer } from "./access-d_DCdwqn.js";
2
2
  import { f as getCurrentComponentInstance, m as getCurrentPortalScope } from "./component-scope-4I3yEMkb.js";
3
- import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-C3IECePB.js";
4
- import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-B99wh5Z_.js";
5
- import { t as cleanupComponent } from "./component-cleanup-CJCfu5ed.js";
6
- import { c as getCurrentLifecycleCommitBatch, u as registerLifecycleTransaction } from "./lifecycle-batch-Cyfd07rf.js";
3
+ import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
4
+ import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BsdGWsDE.js";
5
+ import { t as cleanupComponent } from "./component-cleanup-DYG80yhG.js";
6
+ import { c as getCurrentLifecycleCommitBatch, u as registerLifecycleTransaction } from "./lifecycle-batch-BH0fax4F.js";
7
7
  import { n as getActiveRenderContext } from "./render-context-B7ohlh6t.js";
8
8
  import { i as createSSRPortalHostToken, n as SSR_PORTAL_HOST, r as createSSRPortalAnchorToken, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.js";
9
9
  import { i as registerDefaultPortalRuntime } from "./default-portal-runtime-DvMvWJVp.js";
10
10
  //#region src/jsx/utils.ts
11
+ /** Check whether `value` is a JSX element vnode. */
11
12
  function isElement(value) {
12
13
  return typeof value === "object" && value !== null && value.$$typeof === ELEMENT_TYPE;
13
14
  }
15
+ /** Clone a JSX element, shallow-merging `props` over its existing props. */
14
16
  function cloneElement(element, props) {
15
17
  return {
16
18
  $$typeof: element.$$typeof,
@@ -24,6 +26,10 @@ function cloneElement(element, props) {
24
26
  }
25
27
  //#endregion
26
28
  //#region src/foundations/structures/layout.tsx
29
+ /**
30
+ * Wrap a {@link LayoutComponent} so it can be invoked as `(children, props)`,
31
+ * matching route layout conventions.
32
+ */
27
33
  function layout(Layout) {
28
34
  return (children, props) => {
29
35
  return Layout({
@@ -104,6 +110,16 @@ function Presence({ present, children }) {
104
110
  //#endregion
105
111
  //#region src/runtime/portal.ts
106
112
  const DEFAULT_SSR_PORTAL_KEY = {};
113
+ function setPortalErrorParent(host, owner) {
114
+ if (!host) return;
115
+ if (owner && owner.instance._ownershipGeneration === owner.generation && owner.instance.notifyUpdate !== null) {
116
+ host._portalErrorParent = owner.instance;
117
+ host._portalErrorParentGeneration = owner.generation;
118
+ return;
119
+ }
120
+ host._portalErrorParent = null;
121
+ host._portalErrorParentGeneration = void 0;
122
+ }
107
123
  function getSSRPortalSlot(key) {
108
124
  const context = getActiveRenderContext();
109
125
  if (context?.mode !== "ssr") return null;
@@ -154,6 +170,7 @@ function createSSRPortalAnchor() {
154
170
  }
155
171
  function createPortalSlot() {
156
172
  let currentValue;
173
+ let currentOwner = null;
157
174
  const source = (() => {
158
175
  recordReadableRead(source);
159
176
  return currentValue;
@@ -162,15 +179,21 @@ function createPortalSlot() {
162
179
  read() {
163
180
  return source();
164
181
  },
165
- write(value) {
166
- if (Object.is(currentValue, value)) return;
182
+ write(value, owner) {
183
+ const ownerChanged = currentOwner?.instance !== owner?.instance || currentOwner?.generation !== owner?.generation;
184
+ currentOwner = owner;
185
+ if (Object.is(currentValue, value) && !ownerChanged) return;
167
186
  currentValue = value;
168
187
  markReadableDerivedSubscribersDirty(source);
169
188
  markReactivePropsDirtySource(source);
170
189
  notifyReadableReaders(source);
190
+ },
191
+ getOwner() {
192
+ return currentOwner;
171
193
  }
172
194
  };
173
195
  }
196
+ /** Create a new named {@link Portal} channel with its own host and content. */
174
197
  function definePortal() {
175
198
  const ssrPortalKey = {};
176
199
  if (typeof createPortalSlot === "function") {
@@ -178,11 +201,17 @@ function definePortal() {
178
201
  function PortalHost() {
179
202
  const serverHost = createSSRPortalHost(ssrPortalKey, false);
180
203
  if (serverHost) return serverHost;
204
+ const host = getCurrentComponentInstance();
205
+ if (host?.fn === PortalHost) setPortalErrorParent(host, slot.getOwner());
181
206
  return slot.read();
182
207
  }
183
208
  PortalHost.render = function PortalRender(props) {
184
209
  if (writeSSRPortal(ssrPortalKey, props.children)) return null;
185
- slot.write(props.children);
210
+ const owner = getCurrentComponentInstance();
211
+ slot.write(props.children, owner ? {
212
+ instance: owner,
213
+ generation: owner._ownershipGeneration
214
+ } : null);
186
215
  return null;
187
216
  };
188
217
  return PortalHost;
@@ -225,7 +254,7 @@ function clearTrackedBatchPortalWrite(transaction) {
225
254
  batch = batch.parent;
226
255
  }
227
256
  }
228
- function createExplicitHostSource(readCount) {
257
+ function createPortalStateSource(readCount) {
229
258
  let source = (() => {
230
259
  recordReadableRead(source);
231
260
  return readCount();
@@ -240,6 +269,14 @@ function notifyExplicitDefaultPortalHostReaders(state) {
240
269
  markReactivePropsDirtySource(state.explicitHostSource);
241
270
  notifyReadableReaders(state.explicitHostSource);
242
271
  }
272
+ function setDefaultPortalOwner(state, owner) {
273
+ if (state.owner?.instance === owner?.instance && state.owner?.generation === owner?.generation) return;
274
+ state.owner = owner;
275
+ state.ownerVersion += 1;
276
+ markReadableDerivedSubscribersDirty(state.ownerSource);
277
+ markReactivePropsDirtySource(state.ownerSource);
278
+ notifyReadableReaders(state.ownerSource);
279
+ }
243
280
  function createDefaultPortalState() {
244
281
  const state = {
245
282
  portal: definePortal(),
@@ -248,9 +285,12 @@ function createDefaultPortalState() {
248
285
  cleanupOwners: /* @__PURE__ */ new WeakSet(),
249
286
  explicitHostOwners: /* @__PURE__ */ new Map(),
250
287
  explicitHostCleanupOwners: /* @__PURE__ */ new WeakSet(),
251
- explicitHostSource: (() => 0)
288
+ explicitHostSource: (() => 0),
289
+ ownerVersion: 0,
290
+ ownerSource: (() => 0)
252
291
  };
253
- state.explicitHostSource = createExplicitHostSource(() => state.explicitHostOwners.size);
292
+ state.explicitHostSource = createPortalStateSource(() => state.explicitHostOwners.size);
293
+ state.ownerSource = createPortalStateSource(() => state.ownerVersion);
254
294
  return state;
255
295
  }
256
296
  function disposeDefaultPortalScope(scope) {
@@ -288,7 +328,7 @@ function detachDefaultPortalHostOutput(state) {
288
328
  }
289
329
  function applyDefaultPortalWrite(state, children, owner) {
290
330
  state.portal.render({ children });
291
- state.owner = owner;
331
+ setDefaultPortalOwner(state, owner);
292
332
  if (isEmptyPortalValue(children)) detachDefaultPortalHostOutput(state);
293
333
  }
294
334
  function isStaleDefaultPortalScope(scope) {
@@ -398,7 +438,7 @@ function applyPendingDefaultPortalValue(scope) {
398
438
  if (!_hasPendingDefaultPortalValue) return;
399
439
  const state = getDefaultPortalState(scope);
400
440
  state.portal.render({ children: _pendingDefaultPortalValue });
401
- state.owner = null;
441
+ setDefaultPortalOwner(state, null);
402
442
  _hasPendingDefaultPortalValue = false;
403
443
  _pendingDefaultPortalValue = void 0;
404
444
  }
@@ -453,9 +493,13 @@ function clearDefaultPortalForInstance(instance) {
453
493
  _hasPendingDefaultPortalValue = false;
454
494
  _pendingDefaultPortalValue = void 0;
455
495
  state.portal.render({ children: void 0 });
456
- state.owner = null;
496
+ setDefaultPortalOwner(state, null);
457
497
  detachDefaultPortalHostOutput(state);
458
498
  }
499
+ /**
500
+ * The implicit portal channel that {@link Portal} writes to and that any
501
+ * host rendered without an explicit portal falls back to.
502
+ */
459
503
  const DefaultPortal = (() => {
460
504
  function Host(props) {
461
505
  const serverHost = createSSRPortalHost(DEFAULT_SSR_PORTAL_KEY, props?.__askrAutoDefaultPortal === true);
@@ -471,6 +515,8 @@ const DefaultPortal = (() => {
471
515
  if (!(props?.__askrAutoDefaultPortal === true)) registerExplicitDefaultPortalHost(scope, state, owner);
472
516
  else if (readExplicitDefaultPortalHosts(state) > 0) return null;
473
517
  applyPendingDefaultPortalValue(scope);
518
+ state.ownerSource();
519
+ setPortalErrorParent(owner, state.owner);
474
520
  const value = state.portal();
475
521
  return value === void 0 ? null : value;
476
522
  }
@@ -481,6 +527,7 @@ const DefaultPortal = (() => {
481
527
  };
482
528
  return Host;
483
529
  })();
530
+ /** Write children to the {@link DefaultPortal} host wherever it is rendered. */
484
531
  function Portal(props) {
485
532
  if (writeSSRPortal(DEFAULT_SSR_PORTAL_KEY, props.children)) return createSSRPortalAnchor();
486
533
  const owner = getCurrentComponentInstance();
@@ -497,6 +544,7 @@ registerDefaultPortalRuntime({
497
544
  });
498
545
  //#endregion
499
546
  //#region src/foundations/structures/collection.ts
547
+ /** Create an empty, insertion-ordered {@link Collection} registry. */
500
548
  function createCollection() {
501
549
  const registry = /* @__PURE__ */ new Map();
502
550
  function register(node, metadata) {
@@ -545,6 +593,7 @@ function createCollection() {
545
593
  */
546
594
  //#endregion
547
595
  //#region src/foundations/structures/layer.ts
596
+ /** Create a new, empty {@link LayerManager} for coordinating overlay stacking. */
548
597
  function createLayer() {
549
598
  const stack = [];
550
599
  let nextId = 1;
@@ -1,6 +1,6 @@
1
- import { pt as RouteRegistry, q as RouteAuthOptions, tt as RouteMatch, wt as ComponentFunction } from "../index-DA3g8lm8.js";
2
- import { A as QueryStaleReason, S as Mutation, v as DataRuntime, w as Query } from "../index-2bk8nldG.js";
1
+ import { At as RouteRegistry, Gt as Query, Ut as Mutation, Zt as QueryStaleReason, nn as ComponentFunction, ut as RouteAuthOptions, vt as RouteMatch, zt as DataRuntime } from "../index-CTIBOqUB.js";
3
2
  //#region src/testing/render.d.ts
3
+ /** Options for {@link render} and {@link mount}. */
4
4
  interface RenderOptions {
5
5
  /**
6
6
  * Existing element to own for the duration of the render. When omitted, the
@@ -10,6 +10,7 @@ interface RenderOptions {
10
10
  /** Surface lifecycle cleanup errors during unmount. */
11
11
  cleanupStrict?: boolean;
12
12
  }
13
+ /** Options for {@link renderRoute}. */
13
14
  interface RouteRenderOptions extends RenderOptions {
14
15
  registry: RouteRegistry;
15
16
  /** Initial path, query, and hash for the routed render. */
@@ -18,6 +19,7 @@ interface RouteRenderOptions extends RenderOptions {
18
19
  dataRuntime?: DataRuntime;
19
20
  }
20
21
  type DispatchEventInit = EventInit | UIEventInit | FocusEventInit | MouseEventInit | WheelEventInit | KeyboardEventInit | InputEventInit | CompositionEventInit | PointerEventInit | TouchEventInit | DragEventInit;
22
+ /** Handle to a mounted test render, returned by {@link render}/{@link mount}/{@link renderRoute}. */
21
23
  interface RenderResult {
22
24
  readonly container: HTMLElement;
23
25
  readonly root: HTMLElement;
@@ -26,11 +28,17 @@ interface RenderResult {
26
28
  unmount(): void;
27
29
  cleanup(): void;
28
30
  }
31
+ /** Synchronously flush the runtime's scheduled work (renders, effects). */
29
32
  declare function flush(): void;
33
+ /** Dispatch an event (constructed from a type string, or given directly) on `target`. */
30
34
  declare function dispatch(target: EventTarget, event: Event | string, init?: DispatchEventInit): boolean;
35
+ /** Tear down a test render, given either its {@link RenderResult} or container element. */
31
36
  declare function cleanup(target: RenderResult | HTMLElement): void;
37
+ /** Mount `component` as an island into a test container and flush pending work. */
32
38
  declare function render(component: ComponentFunction, options?: RenderOptions): RenderResult;
39
+ /** Alias for {@link render}. */
33
40
  declare function mount(component: ComponentFunction, options?: RenderOptions): RenderResult;
41
+ /** Mount a routed app (via {@link createSPA}) into a test container for the given route registry. */
34
42
  declare function renderRoute(options: RouteRenderOptions): Promise<RenderResult>;
35
43
  //#endregion
36
44
  //#region src/testing/index.d.ts
@@ -40,6 +48,7 @@ declare function click(element: Element): boolean;
40
48
  declare function type(element: HTMLInputElement | HTMLTextAreaElement, text: string): void;
41
49
  /** Dispatch a cancelable bubbling submit event on a form. */
42
50
  declare function submit(form: HTMLFormElement): boolean;
51
+ /** Keyed query fixture registry returned by {@link createQueryTestRegistry}. */
43
52
  interface QueryTestRegistry {
44
53
  readonly runtime: DataRuntime;
45
54
  set<T extends {}>(key: string, query: Query<T>): void;
@@ -48,6 +57,7 @@ interface QueryTestRegistry {
48
57
  }
49
58
  /** Create a keyed query fixture registry for a test render runtime. */
50
59
  declare function createQueryTestRegistry(): QueryTestRegistry;
60
+ /** Keyed mutation fixture registry returned by {@link createMutationTestRegistry}. */
51
61
  interface MutationTestRegistry {
52
62
  readonly runtime: DataRuntime;
53
63
  set<TInput, TResult>(key: string, mutation: Mutation<TInput, TResult>): void;
@@ -56,11 +66,13 @@ interface MutationTestRegistry {
56
66
  }
57
67
  /** Create a keyed mutation fixture registry for a test render runtime. */
58
68
  declare function createMutationTestRegistry(): MutationTestRegistry;
69
+ /** Initial state for {@link mutationState}; exactly one of `pending`/`error`/`result` may be set. */
59
70
  type MutationFixtureInitial<TResult> = {
60
71
  pending?: boolean;
61
72
  error?: {} | null;
62
73
  result?: TResult;
63
74
  };
75
+ /** A {@link Mutation} whose state is driven manually via `setPending`/`succeed`/`fail`. */
64
76
  type MutationFixture<TInput, TResult> = Mutation<TInput, TResult> & {
65
77
  /** Inputs received by the fixture's execute method. */
66
78
  readonly inputs: readonly TInput[];
@@ -72,20 +84,28 @@ type MutationFixture<TInput, TResult> = Mutation<TInput, TResult> & {
72
84
  fail(error: {}): void;
73
85
  };
74
86
  declare function createMutationFixture<TInput = unknown, TResult = unknown>(initial?: MutationFixtureInitial<TResult>): MutationFixture<TInput, TResult>;
87
+ /**
88
+ * Build a {@link MutationFixture} for tests: call directly with initial
89
+ * state, or use `.idle()`/`.pending()`/`.success(result)`/`.error(error)`.
90
+ */
75
91
  declare const mutationState: typeof createMutationFixture & {
76
92
  idle<TInput = unknown, TResult = unknown>(): MutationFixture<TInput, TResult>;
77
93
  pending<TInput = unknown, TResult = unknown>(): MutationFixture<TInput, TResult>;
78
94
  success<TInput = unknown, TResult = unknown>(result: TResult): MutationFixture<TInput, TResult>;
79
95
  error<TInput = unknown, TResult = unknown>(error: {}): MutationFixture<TInput, TResult>;
80
96
  };
97
+ /** Refresh callback for a {@link mockQuery} fixture, invoked by the query's `refresh()`. */
81
98
  type MockRefresh = () => void | Promise<void>;
99
+ /** Options for {@link mockQuery} fixtures. */
82
100
  interface MockQueryOptions {
83
101
  refresh?: MockRefresh;
84
102
  }
103
+ /** A single recorded call to {@link invalidate}, captured by {@link createInvalidationRecorder}. */
85
104
  interface InvalidationRecord {
86
105
  prefix: string;
87
106
  markPendingWrite: boolean;
88
107
  }
108
+ /** Recorder returned by {@link createInvalidationRecorder}. */
89
109
  interface InvalidationRecorder {
90
110
  readonly calls: readonly InvalidationRecord[];
91
111
  readonly prefixes: readonly string[];
@@ -95,6 +115,7 @@ interface InvalidationRecorder {
95
115
  interface MatchRouteOptions {
96
116
  registry: RouteRegistry;
97
117
  }
118
+ /** A splat-route/static-route path collision reported by {@link getRouteWarnings}. */
98
119
  interface RoutePatternWarning {
99
120
  kind: 'route-collision';
100
121
  path: string;
@@ -105,6 +126,10 @@ interface RoutePatternWarning {
105
126
  }
106
127
  type StaleValueReason = Exclude<QueryStaleReason, 'error'>;
107
128
  declare function createFreshQuery<T extends {}>(data: T, options?: MockQueryOptions): Query<T>;
129
+ /**
130
+ * Build a fresh {@link Query} fixture for tests: call directly with data, or
131
+ * use `.loading()`/`.error()`/`.refreshing()`/`.stale()`/`.pendingWrite()`.
132
+ */
108
133
  declare const mockQuery: typeof createFreshQuery & {
109
134
  loading<T extends {} = {}>(options?: MockQueryOptions): Query<T>;
110
135
  error<T extends {} = {}>(error: {}, previousData?: T, options?: MockQueryOptions): Query<T>;
@@ -112,6 +137,7 @@ declare const mockQuery: typeof createFreshQuery & {
112
137
  stale<T extends {}>(data: T, reason?: StaleValueReason, options?: MockQueryOptions): Query<T>;
113
138
  pendingWrite<T extends {}>(data: T, options?: MockQueryOptions): Query<T>;
114
139
  };
140
+ /** Alias table mirroring {@link mockQuery}'s state builders (`fresh`, `loading`, `error`, ...). */
115
141
  declare const queryState: {
116
142
  fresh: typeof createFreshQuery;
117
143
  loading: <T extends {} = {}>(options?: MockQueryOptions) => Query<T>;
@@ -120,8 +146,11 @@ declare const queryState: {
120
146
  stale: <T extends {}>(data: T, reason?: StaleValueReason, options?: MockQueryOptions) => Query<T>;
121
147
  pendingWrite: <T extends {}>(data: T, options?: MockQueryOptions) => Query<T>;
122
148
  };
149
+ /** Start recording {@link invalidate} calls for assertions; call `stop()` when done. */
123
150
  declare function createInvalidationRecorder(): InvalidationRecorder;
151
+ /** Match `path` against a route registry for tests, without mounting the app. */
124
152
  declare function matchRoute(path: string, options: MatchRouteOptions): RouteMatch | null;
153
+ /** Find named-splat routes whose reserved segments collide with sibling static routes. */
125
154
  declare function getRouteWarnings(options: MatchRouteOptions): RoutePatternWarning[];
126
155
  //#endregion
127
156
  export { InvalidationRecord, InvalidationRecorder, MockQueryOptions, MockRefresh, MutationFixture, MutationFixtureInitial, MutationTestRegistry, QueryTestRegistry, type RenderOptions, type RenderResult, RoutePatternWarning, type RouteRenderOptions, cleanup, click, createInvalidationRecorder, createMutationTestRegistry, createQueryTestRegistry, dispatch, flush, getRouteWarnings, matchRoute, mockQuery, mount, mutationState, queryState, render, renderRoute, submit, type };
@@ -1,9 +1,9 @@
1
- import { r as flushRuntimeScheduler } from "../access-DSkccuEI.js";
2
- import { u as recordReadableRead } from "../readable-B99wh5Z_.js";
3
- import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-oIdQWnPW.js";
4
- import { a as notifySource, i as normalizeAsyncDataError, r as createReadableSource } from "../data-DcikEH9N.js";
1
+ import { r as flushRuntimeScheduler } from "../access-d_DCdwqn.js";
2
+ import { u as recordReadableRead } from "../readable-BsdGWsDE.js";
3
+ import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-JxoRgrrt.js";
4
+ import { a as notifySource, i as normalizeAsyncDataError, r as createReadableSource } from "../data-Bm8L6JOm.js";
5
5
  import { r as computeRouteActivityMatches } from "../route-matching-Bo6UqG-5.js";
6
- import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-D71bjP4r.js";
6
+ import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-C1wT3Vfs.js";
7
7
  //#region src/testing/render.ts
8
8
  const renderStates = /* @__PURE__ */ new WeakMap();
9
9
  const eventConstructorNames = {
@@ -96,9 +96,11 @@ function isEventForTarget(target, value) {
96
96
  if (value instanceof getBaseEventConstructor(target)) return true;
97
97
  return typeof Event !== "undefined" && value instanceof Event;
98
98
  }
99
+ /** Synchronously flush the runtime's scheduled work (renders, effects). */
99
100
  function flush() {
100
101
  flushRuntimeScheduler();
101
102
  }
103
+ /** Dispatch an event (constructed from a type string, or given directly) on `target`. */
102
104
  function dispatch(target, event, init = {}) {
103
105
  if (!target || typeof target.dispatchEvent !== "function") throw new TypeError("@askrjs/askr/testing dispatch requires an EventTarget.");
104
106
  if (typeof event !== "string" && !isEventForTarget(target, event)) throw new TypeError("@askrjs/askr/testing dispatch requires an Event instance or event type string.");
@@ -125,6 +127,7 @@ function cleanupContainer(container) {
125
127
  function isRenderResult(target) {
126
128
  return "container" in target && "cleanup" in target;
127
129
  }
130
+ /** Tear down a test render, given either its {@link RenderResult} or container element. */
128
131
  function cleanup(target) {
129
132
  cleanupContainer(isRenderResult(target) ? target.container : target);
130
133
  }
@@ -138,6 +141,7 @@ function createRenderResult(container) {
138
141
  cleanup: () => cleanupContainer(container)
139
142
  };
140
143
  }
144
+ /** Mount `component` as an island into a test container and flush pending work. */
141
145
  function render(component, options) {
142
146
  if (typeof component !== "function") throw new TypeError("@askrjs/askr/testing render requires a component function.");
143
147
  const { container } = prepareContainer(options);
@@ -154,9 +158,11 @@ function render(component, options) {
154
158
  throw error;
155
159
  }
156
160
  }
161
+ /** Alias for {@link render}. */
157
162
  function mount(component, options) {
158
163
  return render(component, options);
159
164
  }
165
+ /** Mount a routed app (via {@link createSPA}) into a test container for the given route registry. */
160
166
  async function renderRoute(options) {
161
167
  if (!options?.registry) throw new TypeError("@askrjs/askr/testing renderRoute requires a route registry.");
162
168
  const currentWindow = requireWindow();
@@ -351,6 +357,10 @@ var MutableMutationFixture = class {
351
357
  function createMutationFixture(initial = {}) {
352
358
  return new MutableMutationFixture(initial);
353
359
  }
360
+ /**
361
+ * Build a {@link MutationFixture} for tests: call directly with initial
362
+ * state, or use `.idle()`/`.pending()`/`.success(result)`/`.error(error)`.
363
+ */
354
364
  const mutationState = Object.assign(createMutationFixture, {
355
365
  idle() {
356
366
  return createMutationFixture();
@@ -387,6 +397,10 @@ function createFreshQuery(data, options) {
387
397
  staleReason: null
388
398
  }, options);
389
399
  }
400
+ /**
401
+ * Build a fresh {@link Query} fixture for tests: call directly with data, or
402
+ * use `.loading()`/`.error()`/`.refreshing()`/`.stale()`/`.pendingWrite()`.
403
+ */
390
404
  const mockQuery = Object.assign(createFreshQuery, {
391
405
  loading(options) {
392
406
  return makeQuery({
@@ -444,6 +458,7 @@ const mockQuery = Object.assign(createFreshQuery, {
444
458
  }, options);
445
459
  }
446
460
  });
461
+ /** Alias table mirroring {@link mockQuery}'s state builders (`fresh`, `loading`, `error`, ...). */
447
462
  const queryState = {
448
463
  fresh: createFreshQuery,
449
464
  loading: mockQuery.loading,
@@ -452,6 +467,7 @@ const queryState = {
452
467
  stale: mockQuery.stale,
453
468
  pendingWrite: mockQuery.pendingWrite
454
469
  };
470
+ /** Start recording {@link invalidate} calls for assertions; call `stop()` when done. */
455
471
  function createInvalidationRecorder() {
456
472
  const records = [];
457
473
  let active = true;
@@ -478,6 +494,7 @@ function createInvalidationRecorder() {
478
494
  }
479
495
  };
480
496
  }
497
+ /** Match `path` against a route registry for tests, without mounting the app. */
481
498
  function matchRoute(path, options) {
482
499
  if (!options?.registry) throw new TypeError("matchRoute requires options.registry.");
483
500
  return computeRouteActivityMatches(path, { registry: options.registry })[0] ?? null;
@@ -499,6 +516,7 @@ function routePrefixMatches(splatPrefix, routeSegments) {
499
516
  }
500
517
  return true;
501
518
  }
519
+ /** Find named-splat routes whose reserved segments collide with sibling static routes. */
502
520
  function getRouteWarnings(options) {
503
521
  const records = getRoutePatternRecords(options);
504
522
  const warnings = [];
@@ -326,11 +326,15 @@ interface KnownIntrinsicElementProps {
326
326
  }
327
327
  //#endregion
328
328
  //#region src/common/jsx.d.ts
329
+ /** The element type marker for JSX fragments (`<>...</>`), groups children without a wrapper element. */
329
330
  declare const Fragment: unique symbol;
331
+ /** A component function accepting `TProps`, usable as a JSX element's `type`. */
330
332
  type JSXComponent<TProps extends object = Props> = {
331
333
  bivarianceHack(props: TProps): unknown;
332
334
  }['bivarianceHack'];
335
+ /** Valid `type` values for a JSX element: a tag name, a component, or a symbol (e.g. `Fragment`). */
333
336
  type JSXElementType = string | JSXComponent | symbol;
337
+ /** The vnode shape produced by JSX/`jsx()` calls. */
334
338
  interface JSXElement {
335
339
  /** Internal element marker */
336
340
  $$typeof: symbol;
@@ -1,6 +1,6 @@
1
1
  import { g as getHydrationRenderUrl, m as withHydrationVerificationRender } from "./render-context-B7ohlh6t.js";
2
2
  import { t as SSR_RENDER_DATA_ATTR } from "./ssr-DSHd_Q9K.js";
3
- import { a as renderResolvedToStringSync } from "./ssr-CaZfvQWn.js";
3
+ import { a as renderResolvedToStringSync } from "./ssr-DYcK20IX.js";
4
4
  //#region src/ssr/verify-hydration.ts
5
5
  function normalizeHydrationHtml(html) {
6
6
  const template = document.createElement("template");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askrjs/askr",
3
- "version": "0.0.92",
3
+ "version": "0.0.95",
4
4
  "description": "Actor-backed deterministic UI framework",
5
5
  "keywords": [
6
6
  "askr",