@askrjs/askr 0.0.91 → 0.0.94

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 (95) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/{access-Dpfoi4cA.js → access-d_DCdwqn.js} +8 -2
  3. package/dist/actions/index.d.ts +1 -1
  4. package/dist/actions/index.js +4 -3
  5. package/dist/{activity-dKH6nlpj.js → activity-BshyLB3_.js} +9 -5
  6. package/dist/{activity-CF2_JvJs.d.ts → activity-CJIQyo5X.d.ts} +5 -1
  7. package/dist/benchmark.d.ts +1 -1
  8. package/dist/benchmark.js +8 -8
  9. package/dist/boot/index.d.ts +12 -4
  10. package/dist/boot/index.js +1 -1
  11. package/dist/{boot-D3zVVWuN.js → boot-BsMB_ySP.js} +34 -22
  12. package/dist/{cleanup-c837KVij.js → cleanup-DefafSjG.js} +8 -5
  13. package/dist/{component-cleanup-BUfUleGZ.js → component-cleanup-hrqSikl2.js} +3 -3
  14. package/dist/{component-internal-C4uwwUaK.js → component-internal-DOVVMjG7.js} +8 -6
  15. package/dist/{component-scope-DzJEbYGE.js → component-scope-4I3yEMkb.js} +13 -1
  16. package/dist/components/index.d.ts +7 -2
  17. package/dist/components/index.js +2 -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-CsGs2bLS.d.ts → control-DdFw-Caz.d.ts} +1 -1
  23. package/dist/{control-CON10J1p.js → control-DqOzkgc7.js} +9 -5
  24. package/dist/{csp-nonce-DH0TrDij.js → csp-nonce-BBxq1zq4.js} +8 -1
  25. package/dist/data/index.d.ts +1 -2
  26. package/dist/data/index.js +3 -3
  27. package/dist/{data-Bh_3OETq.js → data-DYqokZzc.js} +23 -12
  28. package/dist/{data-runtime-wbooGyu7.js → data-runtime-JxoRgrrt.js} +3 -1
  29. package/dist/{deferred-D6nZaIPs.js → deferred-BS0Xpstg.js} +10 -5
  30. package/dist/{effect-lnxQIpJG.js → effect-BdvdgMvV.js} +73 -14
  31. package/dist/{fastlane-CrfB3QG0.js → fastlane-DGo7SxBQ.js} +23 -4
  32. package/dist/{for-internal-Bsm0B8GZ.js → for-internal-jrliHZmF.js} +6 -6
  33. package/dist/foundations/icon/index.d.ts +14 -3
  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 +8 -2
  47. package/dist/{index-Cf2ANwPL.d.ts → index-C29SEGIv.d.ts} +30 -3
  48. package/dist/{index-BnU0NPwM.d.ts → index-CzH-0LcA.d.ts} +18 -0
  49. package/dist/index-KQ7Vl4-8.d.ts +1364 -0
  50. package/dist/index.d.ts +3 -7
  51. package/dist/index.js +34 -18
  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 -3
  55. package/dist/jsx-dev-runtime.js +1 -1
  56. package/dist/jsx-runtime-BTzDdBJ_.d.ts +2 -0
  57. package/dist/{jsx-runtime-LHh5tcTe.d.ts → jsx-runtime-Cdd6Gkb0.d.ts} +4 -3
  58. package/dist/jsx-runtime.d.ts +2 -2
  59. package/dist/jsx-runtime.js +1 -1
  60. package/dist/{lifecycle-batch-Dfpid9-A.js → lifecycle-batch-BH0fax4F.js} +2 -2
  61. package/dist/{lifecycle-operations-CMK1AN2C.js → lifecycle-operations-Qxq6ABrC.js} +7 -2
  62. package/dist/{manifest-fBb2ynKL.js → manifest-D6rfj_jC.js} +5 -1
  63. package/dist/{navigate-BO7M2iUG.d.ts → navigate-BL_FIIJ6.d.ts} +6 -1
  64. package/dist/{navigate-CnQMXze1.js → navigate-CECCMPAr.js} +16 -11
  65. package/dist/{query-registry-B4LpVtlT.js → query-registry-CimB1YeW.js} +11 -1
  66. package/dist/{readable-B5NtV7V0.js → readable-BsdGWsDE.js} +9 -6
  67. package/dist/{renderer-y2DL627q.js → renderer-CLvq458M.js} +235 -189
  68. package/dist/{resolution-C9A31xQi.js → resolution-D8PgnTzh.js} +12 -6
  69. package/dist/{resource-operation-whZDJAYv.js → resource-operation-CLQXCn1p.js} +5 -5
  70. package/dist/resources/index.d.ts +15 -2
  71. package/dist/resources/index.js +7 -6
  72. package/dist/{route-matching-xlgdQXg_.js → route-matching-Bo6UqG-5.js} +13 -4
  73. package/dist/router/index.d.ts +46 -6
  74. package/dist/router/index.js +16 -9
  75. package/dist/{selector-BLNkRZ2i.js → selector-CyK-sDwB.js} +24 -6
  76. package/dist/ssg/index.d.ts +5 -2
  77. package/dist/ssg/index.js +6 -6
  78. package/dist/ssr/index.d.ts +16 -5
  79. package/dist/ssr/index.js +1 -1
  80. package/dist/{ssr-DNJUPmMq.js → ssr-8_vHDWqV.js} +20 -12
  81. package/dist/{state-DCjONcHK.js → state-DmkGM_LN.js} +5 -5
  82. package/dist/{structures-m-cphWI-.js → structures-umvVUD-M.js} +20 -6
  83. package/dist/testing/index.d.ts +31 -3
  84. package/dist/testing/index.js +24 -6
  85. package/dist/{jsx-BYXe_Nnk.d.ts → types-DkVJhVs9.d.ts} +20 -0
  86. package/dist/{verify-hydration-D8938Fw2.js → verify-hydration-jf8X2V3x.js} +1 -1
  87. package/package.json +1 -1
  88. package/dist/control-D-FIa-n-.d.ts +0 -451
  89. package/dist/index-BU17hud9.d.ts +0 -52
  90. package/dist/index-CPlPDbEY.d.ts +0 -64
  91. package/dist/index-Izwp_ESC.d.ts +0 -458
  92. package/dist/jsx-runtime-BqhMEuT4.d.ts +0 -2
  93. package/dist/scheduler-CmLO4Dfm.d.ts +0 -65
  94. package/dist/types-CsPtBGWb.d.ts +0 -16
  95. package/dist/types-iAmDSV6o.d.ts +0 -179
@@ -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 { v as logger } from "./access-Dpfoi4cA.js";
4
- import { f as getCurrentComponentInstance, w as setCurrentComponentInstance } from "./component-scope-DzJEbYGE.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-C4uwwUaK.js";
7
- import { t as cleanupComponent } from "./component-cleanup-BUfUleGZ.js";
8
- import { p as isPromiseLike } from "./lifecycle-batch-Dfpid9-A.js";
9
- import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-Bsm0B8GZ.js";
3
+ import { y as logger } from "./access-d_DCdwqn.js";
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-DRS-qjiN.js";
6
+ import { g as markVNodeTreeWithContextFrame, m as getVNodeContextFrame, n as createComponentInstance, p as getExecutionContextFrame, u as callWithContext } from "./component-internal-DOVVMjG7.js";
7
+ import { t as cleanupComponent } from "./component-cleanup-hrqSikl2.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-jrliHZmF.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-DH0TrDij.js";
12
+ import { o as isUnsafeUrlAttribute, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-BBxq1zq4.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-wbooGyu7.js";
15
- import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-B4LpVtlT.js";
16
- import { a as resolveRouteFromRoutes, c as removeRouteBasePath, s as normalizeRouteBasePath, t as _resolveRouteMatchFromRoutes } from "./route-matching-xlgdQXg_.js";
17
- import { a as resolveRouteRequest, d as DEFERRED_BOUNDARY, l as validateRouteHydrationData, o as getRouteHydrationMetadata, p as isDeferred } from "./resolution-C9A31xQi.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
+ 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-D8PgnTzh.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 { v as logger, x as isProductionEnvironment } from "./access-Dpfoi4cA.js";
2
- import { t as isBulkCommitActive } from "./fastlane-CrfB3QG0.js";
3
- import { i as claimHookIndex, p as getCurrentInstance } from "./component-scope-DzJEbYGE.js";
4
- import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-B5NtV7V0.js";
1
+ import { S as isProductionEnvironment } from "./access-d_DCdwqn.js";
2
+ import { n as isBulkCommitActive, t as deferBulkCommitReadableNotification } from "./fastlane-DGo7SxBQ.js";
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-BsdGWsDE.js";
5
5
  //#region src/runtime/state.ts
6
6
  /**
7
7
  * State primitive for Askr components
@@ -77,8 +77,8 @@ function createStateCell(initialValue, instance) {
77
77
  else newValue = newValueOrUpdater;
78
78
  if (Object.is(value, newValue)) return;
79
79
  if (isBulkCommitActive()) {
80
- if (!isProductionEnvironment()) logger.warn("[Askr] state.set() was called while a bulk commit (fast-lane reorder) was in progress. The value updated, but subscribers were not notified, so this change will not be reflected in the UI until an unrelated update triggers a re-render. This usually happens from a ref callback or a native focus/blur event fired synchronously during a large keyed-list reorder.");
81
80
  value = newValue;
81
+ deferBulkCommitReadableNotification(read);
82
82
  return;
83
83
  }
84
84
  value = newValue;
@@ -1,16 +1,18 @@
1
- import { o as getRuntimeRenderer } from "./access-Dpfoi4cA.js";
2
- import { f as getCurrentComponentInstance, m as getCurrentPortalScope } from "./component-scope-DzJEbYGE.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-B5NtV7V0.js";
5
- import { t as cleanupComponent } from "./component-cleanup-BUfUleGZ.js";
6
- import { c as getCurrentLifecycleCommitBatch, u as registerLifecycleTransaction } from "./lifecycle-batch-Dfpid9-A.js";
1
+ import { o as getRuntimeRenderer } from "./access-d_DCdwqn.js";
2
+ import { f as getCurrentComponentInstance, m as getCurrentPortalScope } from "./component-scope-4I3yEMkb.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-hrqSikl2.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({
@@ -171,6 +177,7 @@ function createPortalSlot() {
171
177
  }
172
178
  };
173
179
  }
180
+ /** Create a new named {@link Portal} channel with its own host and content. */
174
181
  function definePortal() {
175
182
  const ssrPortalKey = {};
176
183
  if (typeof createPortalSlot === "function") {
@@ -456,6 +463,10 @@ function clearDefaultPortalForInstance(instance) {
456
463
  state.owner = null;
457
464
  detachDefaultPortalHostOutput(state);
458
465
  }
466
+ /**
467
+ * The implicit portal channel that {@link Portal} writes to and that any
468
+ * host rendered without an explicit portal falls back to.
469
+ */
459
470
  const DefaultPortal = (() => {
460
471
  function Host(props) {
461
472
  const serverHost = createSSRPortalHost(DEFAULT_SSR_PORTAL_KEY, props?.__askrAutoDefaultPortal === true);
@@ -481,6 +492,7 @@ const DefaultPortal = (() => {
481
492
  };
482
493
  return Host;
483
494
  })();
495
+ /** Write children to the {@link DefaultPortal} host wherever it is rendered. */
484
496
  function Portal(props) {
485
497
  if (writeSSRPortal(DEFAULT_SSR_PORTAL_KEY, props.children)) return createSSRPortalAnchor();
486
498
  const owner = getCurrentComponentInstance();
@@ -497,6 +509,7 @@ registerDefaultPortalRuntime({
497
509
  });
498
510
  //#endregion
499
511
  //#region src/foundations/structures/collection.ts
512
+ /** Create an empty, insertion-ordered {@link Collection} registry. */
500
513
  function createCollection() {
501
514
  const registry = /* @__PURE__ */ new Map();
502
515
  function register(node, metadata) {
@@ -545,6 +558,7 @@ function createCollection() {
545
558
  */
546
559
  //#endregion
547
560
  //#region src/foundations/structures/layer.ts
561
+ /** Create a new, empty {@link LayerManager} for coordinating overlay stacking. */
548
562
  function createLayer() {
549
563
  const stack = [];
550
564
  let nextId = 1;
@@ -1,7 +1,6 @@
1
- import { l as ComponentFunction } from "../control-D-FIa-n-.js";
2
- import { a as Mutation, m as QueryStaleReason, s as Query, t as DataRuntime } from "../types-iAmDSV6o.js";
3
- import { M as RouteMatch, W as RouteRegistry, w as RouteAuthOptions } from "../index-Izwp_ESC.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-KQ7Vl4-8.js";
4
2
  //#region src/testing/render.d.ts
3
+ /** Options for {@link render} and {@link mount}. */
5
4
  interface RenderOptions {
6
5
  /**
7
6
  * Existing element to own for the duration of the render. When omitted, the
@@ -11,6 +10,7 @@ interface RenderOptions {
11
10
  /** Surface lifecycle cleanup errors during unmount. */
12
11
  cleanupStrict?: boolean;
13
12
  }
13
+ /** Options for {@link renderRoute}. */
14
14
  interface RouteRenderOptions extends RenderOptions {
15
15
  registry: RouteRegistry;
16
16
  /** Initial path, query, and hash for the routed render. */
@@ -19,6 +19,7 @@ interface RouteRenderOptions extends RenderOptions {
19
19
  dataRuntime?: DataRuntime;
20
20
  }
21
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}. */
22
23
  interface RenderResult {
23
24
  readonly container: HTMLElement;
24
25
  readonly root: HTMLElement;
@@ -27,11 +28,17 @@ interface RenderResult {
27
28
  unmount(): void;
28
29
  cleanup(): void;
29
30
  }
31
+ /** Synchronously flush the runtime's scheduled work (renders, effects). */
30
32
  declare function flush(): void;
33
+ /** Dispatch an event (constructed from a type string, or given directly) on `target`. */
31
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. */
32
36
  declare function cleanup(target: RenderResult | HTMLElement): void;
37
+ /** Mount `component` as an island into a test container and flush pending work. */
33
38
  declare function render(component: ComponentFunction, options?: RenderOptions): RenderResult;
39
+ /** Alias for {@link render}. */
34
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. */
35
42
  declare function renderRoute(options: RouteRenderOptions): Promise<RenderResult>;
36
43
  //#endregion
37
44
  //#region src/testing/index.d.ts
@@ -41,6 +48,7 @@ declare function click(element: Element): boolean;
41
48
  declare function type(element: HTMLInputElement | HTMLTextAreaElement, text: string): void;
42
49
  /** Dispatch a cancelable bubbling submit event on a form. */
43
50
  declare function submit(form: HTMLFormElement): boolean;
51
+ /** Keyed query fixture registry returned by {@link createQueryTestRegistry}. */
44
52
  interface QueryTestRegistry {
45
53
  readonly runtime: DataRuntime;
46
54
  set<T extends {}>(key: string, query: Query<T>): void;
@@ -49,6 +57,7 @@ interface QueryTestRegistry {
49
57
  }
50
58
  /** Create a keyed query fixture registry for a test render runtime. */
51
59
  declare function createQueryTestRegistry(): QueryTestRegistry;
60
+ /** Keyed mutation fixture registry returned by {@link createMutationTestRegistry}. */
52
61
  interface MutationTestRegistry {
53
62
  readonly runtime: DataRuntime;
54
63
  set<TInput, TResult>(key: string, mutation: Mutation<TInput, TResult>): void;
@@ -57,11 +66,13 @@ interface MutationTestRegistry {
57
66
  }
58
67
  /** Create a keyed mutation fixture registry for a test render runtime. */
59
68
  declare function createMutationTestRegistry(): MutationTestRegistry;
69
+ /** Initial state for {@link mutationState}; exactly one of `pending`/`error`/`result` may be set. */
60
70
  type MutationFixtureInitial<TResult> = {
61
71
  pending?: boolean;
62
72
  error?: {} | null;
63
73
  result?: TResult;
64
74
  };
75
+ /** A {@link Mutation} whose state is driven manually via `setPending`/`succeed`/`fail`. */
65
76
  type MutationFixture<TInput, TResult> = Mutation<TInput, TResult> & {
66
77
  /** Inputs received by the fixture's execute method. */
67
78
  readonly inputs: readonly TInput[];
@@ -73,20 +84,28 @@ type MutationFixture<TInput, TResult> = Mutation<TInput, TResult> & {
73
84
  fail(error: {}): void;
74
85
  };
75
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
+ */
76
91
  declare const mutationState: typeof createMutationFixture & {
77
92
  idle<TInput = unknown, TResult = unknown>(): MutationFixture<TInput, TResult>;
78
93
  pending<TInput = unknown, TResult = unknown>(): MutationFixture<TInput, TResult>;
79
94
  success<TInput = unknown, TResult = unknown>(result: TResult): MutationFixture<TInput, TResult>;
80
95
  error<TInput = unknown, TResult = unknown>(error: {}): MutationFixture<TInput, TResult>;
81
96
  };
97
+ /** Refresh callback for a {@link mockQuery} fixture, invoked by the query's `refresh()`. */
82
98
  type MockRefresh = () => void | Promise<void>;
99
+ /** Options for {@link mockQuery} fixtures. */
83
100
  interface MockQueryOptions {
84
101
  refresh?: MockRefresh;
85
102
  }
103
+ /** A single recorded call to {@link invalidate}, captured by {@link createInvalidationRecorder}. */
86
104
  interface InvalidationRecord {
87
105
  prefix: string;
88
106
  markPendingWrite: boolean;
89
107
  }
108
+ /** Recorder returned by {@link createInvalidationRecorder}. */
90
109
  interface InvalidationRecorder {
91
110
  readonly calls: readonly InvalidationRecord[];
92
111
  readonly prefixes: readonly string[];
@@ -96,6 +115,7 @@ interface InvalidationRecorder {
96
115
  interface MatchRouteOptions {
97
116
  registry: RouteRegistry;
98
117
  }
118
+ /** A splat-route/static-route path collision reported by {@link getRouteWarnings}. */
99
119
  interface RoutePatternWarning {
100
120
  kind: 'route-collision';
101
121
  path: string;
@@ -106,6 +126,10 @@ interface RoutePatternWarning {
106
126
  }
107
127
  type StaleValueReason = Exclude<QueryStaleReason, 'error'>;
108
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
+ */
109
133
  declare const mockQuery: typeof createFreshQuery & {
110
134
  loading<T extends {} = {}>(options?: MockQueryOptions): Query<T>;
111
135
  error<T extends {} = {}>(error: {}, previousData?: T, options?: MockQueryOptions): Query<T>;
@@ -113,6 +137,7 @@ declare const mockQuery: typeof createFreshQuery & {
113
137
  stale<T extends {}>(data: T, reason?: StaleValueReason, options?: MockQueryOptions): Query<T>;
114
138
  pendingWrite<T extends {}>(data: T, options?: MockQueryOptions): Query<T>;
115
139
  };
140
+ /** Alias table mirroring {@link mockQuery}'s state builders (`fresh`, `loading`, `error`, ...). */
116
141
  declare const queryState: {
117
142
  fresh: typeof createFreshQuery;
118
143
  loading: <T extends {} = {}>(options?: MockQueryOptions) => Query<T>;
@@ -121,8 +146,11 @@ declare const queryState: {
121
146
  stale: <T extends {}>(data: T, reason?: StaleValueReason, options?: MockQueryOptions) => Query<T>;
122
147
  pendingWrite: <T extends {}>(data: T, options?: MockQueryOptions) => Query<T>;
123
148
  };
149
+ /** Start recording {@link invalidate} calls for assertions; call `stop()` when done. */
124
150
  declare function createInvalidationRecorder(): InvalidationRecorder;
151
+ /** Match `path` against a route registry for tests, without mounting the app. */
125
152
  declare function matchRoute(path: string, options: MatchRouteOptions): RouteMatch | null;
153
+ /** Find named-splat routes whose reserved segments collide with sibling static routes. */
126
154
  declare function getRouteWarnings(options: MatchRouteOptions): RoutePatternWarning[];
127
155
  //#endregion
128
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-Dpfoi4cA.js";
2
- import { u as recordReadableRead } from "../readable-B5NtV7V0.js";
3
- import { l as addInvalidationListener, t as createDataRuntime } from "../data-runtime-wbooGyu7.js";
4
- import { a as notifySource, i as normalizeAsyncDataError, r as createReadableSource } from "../data-Bh_3OETq.js";
5
- import { r as computeRouteActivityMatches } from "../route-matching-xlgdQXg_.js";
6
- import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-D3zVVWuN.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-DYqokZzc.js";
5
+ import { r as computeRouteActivityMatches } from "../route-matching-Bo6UqG-5.js";
6
+ import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-BsMB_ySP.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;
@@ -342,4 +346,20 @@ interface JSXElement {
342
346
  key?: string | number | null;
343
347
  }
344
348
  //#endregion
349
+ //#region src/jsx/types.d.ts
350
+ declare global {
351
+ namespace JSX {
352
+ interface Element extends JSXElement {
353
+ readonly __askrJsxElementBrand?: never;
354
+ }
355
+ interface IntrinsicElements extends KnownIntrinsicElementProps {}
356
+ interface ElementAttributesProperty {
357
+ props: Props;
358
+ }
359
+ interface ElementChildrenAttribute {
360
+ children: unknown;
361
+ }
362
+ }
363
+ }
364
+ //#endregion
345
365
  export { IntrinsicFallbackProps as a, JSXElementType as i, JSXComponent as n, KnownIntrinsicElementProps as o, JSXElement as r, Props as s, Fragment as t };
@@ -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-DNJUPmMq.js";
3
+ import { a as renderResolvedToStringSync } from "./ssr-8_vHDWqV.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.91",
3
+ "version": "0.0.94",
4
4
  "description": "Actor-backed deterministic UI framework",
5
5
  "keywords": [
6
6
  "askr",