@askrjs/askr 0.0.77 → 0.0.78

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 (61) hide show
  1. package/dist/actions/index.d.ts +1 -1
  2. package/dist/actions/index.js +2 -2
  3. package/dist/{activity-DaqZEUPh.d.ts → activity-CXEaU-Al.d.ts} +1 -1
  4. package/dist/{activity-BWQeEtNt.js → activity-DfrtblJA.js} +3 -3
  5. package/dist/{authoring-prA293gq.js → authoring-DE-LH_s-.js} +2 -2
  6. package/dist/benchmark.js +5 -5
  7. package/dist/boot/index.d.ts +4 -4
  8. package/dist/boot/index.js +1 -1
  9. package/dist/{boot-Cc5axhVo.js → boot-C5bZY3Uc.js} +12 -12
  10. package/dist/{component-internal-TurioKgs.js → component-internal-BuTG89T8.js} +11 -7
  11. package/dist/components/index.d.ts +1 -1
  12. package/dist/control/index.d.ts +1 -1
  13. package/dist/control/index.js +1 -1
  14. package/dist/control-C-ApnFs1.js +20 -0
  15. package/dist/{control-Uvq1GU4K.d.ts → control-Cix3yjVf.d.ts} +7 -1
  16. package/dist/{control-D9UorK1Q.js → control-DQIsWvhr.js} +2 -2
  17. package/dist/{csp-nonce-DYspaK0L.js → csp-nonce-BUsz0Em7.js} +1 -1
  18. package/dist/data/index.d.ts +1 -1
  19. package/dist/data/index.js +3 -3
  20. package/dist/{data-vaClyf1I.js → data-eBdygZ1f.js} +3 -3
  21. package/dist/{data-runtime-rpV6-3XW.js → data-runtime-D68YOo9L.js} +1 -1
  22. package/dist/{deferred-Dfk7vuTX.js → deferred-t79wHqe1.js} +5 -5
  23. package/dist/{for-internal-BM8KbadU.js → for-internal-BnXrQbgo.js} +1 -1
  24. package/dist/foundations/index.d.ts +1 -1
  25. package/dist/foundations/index.js +1 -1
  26. package/dist/foundations/state/index.d.ts +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-Bki2rqcr.d.ts → index-5S-fi2xy.d.ts} +17 -17
  30. package/dist/{router-Dd-LoJmM.d.ts → index-TlEvex-C.d.ts} +162 -4
  31. package/dist/{index-CbRdEUPB.d.ts → index-Vs1EeWEr.d.ts} +2 -2
  32. package/dist/{index-acX2RLxD.d.ts → index-ho0Htetw.d.ts} +1 -1
  33. package/dist/index.d.ts +5 -5
  34. package/dist/index.js +8 -7
  35. package/dist/jsx-dev-runtime.js +1 -1
  36. package/dist/jsx-runtime.js +1 -1
  37. package/dist/{lifecycle-operations-DxwqHvyx.js → lifecycle-operations-CN0PiLE_.js} +1 -1
  38. package/dist/{navigate-DlaVqF4n.d.ts → navigate-DfY1BUYc.d.ts} +1 -1
  39. package/dist/{navigate-CwddZjwU.js → navigate-ype2B_M8.js} +6 -6
  40. package/dist/{portal-BsSJusvs.js → portal-BZ_rN17v.js} +14 -13
  41. package/dist/portal-w3oQ6oQU.js +29 -0
  42. package/dist/{query-registry-Bu_cuMch.js → query-registry-BL6rjGsO.js} +1 -1
  43. package/dist/{render-context-Clw3rFiO.js → render-context-D-DFk2WN.js} +13 -1
  44. package/dist/{renderer-Ba-KixHB.js → renderer-_l_U-AbR.js} +210 -45
  45. package/dist/resources/index.d.ts +2 -2
  46. package/dist/resources/index.js +4 -4
  47. package/dist/{route-matching-DqM8k4tZ.js → route-matching-jqwlQJ5g.js} +2 -2
  48. package/dist/router/index.d.ts +4 -4
  49. package/dist/router/index.js +5 -5
  50. package/dist/ssg/index.d.ts +2 -2
  51. package/dist/ssg/index.js +7 -5
  52. package/dist/ssr/index.d.ts +8 -25
  53. package/dist/ssr/index.js +2 -2
  54. package/dist/{ssr-Cv5qWPxz.js → ssr-Dcmi1bZi.js} +53 -24
  55. package/dist/testing/index.d.ts +3 -3
  56. package/dist/testing/index.js +3 -3
  57. package/dist/{verify-hydration-BC5bmXr4.js → verify-hydration-Dfx-ZhbX.js} +1 -1
  58. package/package.json +1 -1
  59. package/dist/control-DhFRTIoE.js +0 -12
  60. package/dist/index-CDACZEF2.d.ts +0 -102
  61. package/dist/index-vo_FDR-B.d.ts +0 -40
@@ -1,7 +1,7 @@
1
- import { c as RenderableChild, d as DocumentRenderContext, f as DocumentRenderer, p as SSRData, u as DocumentRenderArgs } from "../control-Uvq1GU4K.js";
1
+ import { d as DocumentRenderContext, f as DocumentRenderer, m as SSRStyleRegistration, p as SSRData, u as DocumentRenderArgs } from "../control-Cix3yjVf.js";
2
2
  import { r as JSXElement, s as Props } from "../jsx-Dvr2SGRG.js";
3
- import { D as QueryPrefetchContext, n as ServerQueryRegistry, u as CoreTelemetry, v as DataRuntime } from "../index-Bki2rqcr.js";
4
- import { A as RouteRecord, L as RouteRequestResult, N as RouteRegistry, a as AccessRedirectDecision, f as Route, p as RouteAuthOptions, r as AccessDenyDecision, y as RouteHandler } from "../router-Dd-LoJmM.js";
3
+ import { A as RouteHandler, C as Route, J as RouteRequestResult, V as RouteRecord, W as RouteRegistry, g as AccessRedirectDecision, l as DeferredBoundaryRegistration, m as AccessDenyDecision, u as SSRPortalState, w as RouteAuthOptions } from "../index-TlEvex-C.js";
4
+ import { D as QueryPrefetchContext, _ as CoreTelemetry, n as ServerQueryRegistry, v as DataRuntime } from "../index-5S-fi2xy.js";
5
5
  import { AuthContext } from "@askrjs/auth";
6
6
  //#region src/common/page-render-envelope.d.ts
7
7
  declare const PAGE_RENDER_ENVELOPE_VERSION: 1;
@@ -12,27 +12,6 @@ interface PageRenderEnvelope {
12
12
  readonly framework: Readonly<Record<string, unknown>>;
13
13
  }
14
14
  //#endregion
15
- //#region src/common/render-context.d.ts
16
- interface DeferredBoundaryRegistration {
17
- id: string;
18
- promise: Promise<unknown>;
19
- fulfilled(value: unknown): RenderableChild;
20
- rejected(error: unknown): RenderableChild;
21
- }
22
- interface SSRPortalHostRegistration {
23
- token: string;
24
- automatic: boolean;
25
- }
26
- interface SSRPortalSlot {
27
- hasValue: boolean;
28
- value: RenderableChild | undefined;
29
- hosts: SSRPortalHostRegistration[];
30
- }
31
- interface SSRPortalState {
32
- slots: Map<object, SSRPortalSlot>;
33
- nextHostId: number;
34
- }
35
- //#endregion
36
15
  //#region src/common/ssr-errors.d.ts
37
16
  /**
38
17
  * Common call contracts: SSR error types
@@ -62,6 +41,7 @@ interface RenderContext {
62
41
  renderData: PageRenderEnvelope | null;
63
42
  hydrationData: PageRenderEnvelope | null;
64
43
  deferredBoundaries: DeferredBoundaryRegistration[];
44
+ ssrStyles: Map<string, SSRStyleRegistration>;
65
45
  ssrPortals: SSRPortalState;
66
46
  cspNonce?: string;
67
47
  }
@@ -150,6 +130,8 @@ declare function renderToStringSync(component: (props?: Record<string, unknown>)
150
130
  /** @internal A composed page render envelope. */
151
131
  envelope?: PageRenderEnvelope;
152
132
  cspNonce?: string;
133
+ /** @internal Capture request-local registrations produced by this pass. */
134
+ onContext?: (ctx: RenderContext) => void;
153
135
  }): string;
154
136
  //#endregion
155
137
  //#region src/ssr/render-resolved.d.ts
@@ -189,6 +171,7 @@ type RenderRouteRequestResult = {
189
171
  kind: 'render';
190
172
  html: string;
191
173
  stream?: ReadableStream<Uint8Array>;
174
+ styles: readonly SSRStyleRegistration[];
192
175
  params: Record<string, string>;
193
176
  record?: RouteRecord;
194
177
  } | AccessRedirectDecision | AccessDenyDecision | {
@@ -202,4 +185,4 @@ declare function renderToString(component: (props?: Record<string, unknown>) =>
202
185
  declare function renderToString(opts: RouteRenderOptions): string;
203
186
  declare function renderToStream(opts: RouteStreamOptions): void;
204
187
  //#endregion
205
- export { type DocumentRenderArgs, type DocumentRenderContext, type DocumentRenderer, type RenderRouteRequestOptions, type RenderRouteRequestResult, type SSRComponent, SSRDataMissingError, type SSRRoute, type VNode, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
188
+ export { type DocumentRenderArgs, type DocumentRenderContext, type DocumentRenderer, type RenderRouteRequestOptions, type RenderRouteRequestResult, type SSRComponent, SSRDataMissingError, type SSRRoute, type SSRStyleRegistration, type VNode, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
package/dist/ssr/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { u as SSRDataMissingError } from "../render-context-Clw3rFiO.js";
2
- import { a as renderResolvedToStringSync, c as createRenderContext, d as withRenderContextAsync, i as renderRouteRequestToString, l as getRenderContext, n as renderToString, o as renderToStringSync, r as renderRouteRequest, s as resolveRequest, t as renderToStream, u as withRenderContext } from "../ssr-Cv5qWPxz.js";
1
+ import { d as SSRDataMissingError } from "../render-context-D-DFk2WN.js";
2
+ import { a as renderResolvedToStringSync, c as createRenderContext, d as withRenderContextAsync, i as renderRouteRequestToString, l as getRenderContext, n as renderToString, o as renderToStringSync, r as renderRouteRequest, s as resolveRequest, t as renderToStream, u as withRenderContext } from "../ssr-Dcmi1bZi.js";
3
3
  export { SSRDataMissingError, createRenderContext, getRenderContext, renderResolvedToStringSync, renderRouteRequest, renderRouteRequestToString, renderToStream, renderToString, renderToStringSync, resolveRequest, withRenderContext, withRenderContextAsync };
@@ -1,21 +1,22 @@
1
- import { t as __CONTROL_BOUNDARY__ } from "./control-DhFRTIoE.js";
1
+ import { t as __CONTROL_BOUNDARY__ } from "./control-C-ApnFs1.js";
2
2
  import { t as __ERROR_BOUNDARY__ } from "./vnode-D24p6IW2.js";
3
3
  import { v as logger } from "./access-ePqdQqkV.js";
4
4
  import { i as isFragmentType, n as Fragment, t as ELEMENT_TYPE } from "./jsx-C3IECePB.js";
5
- import { f as getExecutionContextFrame, h as markVNodeTreeWithContextFrame, l as callWithContext, n as createComponentInstance, p as getVNodeContextFrame } from "./component-internal-TurioKgs.js";
5
+ import { f as getExecutionContextFrame, h as markVNodeTreeWithContextFrame, l as callWithContext, n as createComponentInstance, p as getVNodeContextFrame } from "./component-internal-BuTG89T8.js";
6
6
  import { f as getCurrentComponentInstance, w as setCurrentComponentInstance } from "./component-scope-DzJEbYGE.js";
7
7
  import { t as cleanupComponent } from "./component-cleanup-oWN45rfa.js";
8
8
  import { p as isPromiseLike } from "./lifecycle-batch-CwHCDseR.js";
9
- import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-BM8KbadU.js";
10
- import { _ as isPageRenderEnvelope, g as isEmptyPageRenderEnvelope, h as createPageRenderEnvelope, i as isDeferred, l as createRouteRegistry, m as resolveRouteRequest, t as DEFERRED_BOUNDARY } from "./deferred-Dfk7vuTX.js";
11
- import { c as stopRenderPhase$1, o as startRenderPhase$1, t as configureRenderContextProvider, u as SSRDataMissingError } from "./render-context-Clw3rFiO.js";
12
- import { a as resolveRouteFromRoutes, t as _resolveRouteMatchFromRoutes } from "./route-matching-DqM8k4tZ.js";
13
- import { a as disposeDefaultPortalScope, o as SSR_PORTAL_HOST, t as DefaultPortal } from "./portal-BsSJusvs.js";
9
+ import { _ as setControlBoundaryContextFrame, g as evaluateShowState, h as evaluateCaseState, i as evaluateForState, o as rollbackForStateTransaction, r as commitForStateTransaction } from "./for-internal-BnXrQbgo.js";
10
+ import { _ as isPageRenderEnvelope, g as isEmptyPageRenderEnvelope, h as createPageRenderEnvelope, i as isDeferred, l as createRouteRegistry, m as resolveRouteRequest, t as DEFERRED_BOUNDARY } from "./deferred-t79wHqe1.js";
11
+ import { d as SSRDataMissingError, l as stopRenderPhase$1, s as startRenderPhase$1, t as configureRenderContextProvider } from "./render-context-D-DFk2WN.js";
12
+ import { a as resolveRouteFromRoutes, t as _resolveRouteMatchFromRoutes } from "./route-matching-jqwlQJ5g.js";
13
+ import { n as SSR_PORTAL_HOST, t as SSR_PORTAL_ANCHOR } from "./portal-w3oQ6oQU.js";
14
+ import { a as disposeDefaultPortalScope, t as DefaultPortal } from "./portal-BZ_rN17v.js";
14
15
  import { n as getPublicAttributeName, t as sanitizeCssValue } from "./css-BuPaTOfe.js";
15
- import { a as isSafeHref, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-DYspaK0L.js";
16
- import { t as createDataRuntime } from "./data-runtime-rpV6-3XW.js";
17
- import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-Bu_cuMch.js";
18
- import { a as route } from "./authoring-prA293gq.js";
16
+ import { a as isSafeHref, r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-BUsz0Em7.js";
17
+ import { t as createDataRuntime } from "./data-runtime-D68YOo9L.js";
18
+ import { c as withTelemetry, i as dehydrateDataRuntime, t as createQueryPrefetchContext } from "./query-registry-BL6rjGsO.js";
19
+ import { a as route } from "./authoring-DE-LH_s-.js";
19
20
  import { n as renderDocument, t as SSR_RENDER_DATA_ATTR } from "./ssr-CbQO5xd3.js";
20
21
  //#region src/ssr/escape.ts
21
22
  /**
@@ -207,6 +208,7 @@ function createRenderContext(seed = 12345, opts = {}) {
207
208
  renderData: envelope,
208
209
  hydrationData: envelope,
209
210
  deferredBoundaries: [],
211
+ ssrStyles: /* @__PURE__ */ new Map(),
210
212
  ssrPortals: {
211
213
  slots: /* @__PURE__ */ new Map(),
212
214
  nextHostId: 0
@@ -487,7 +489,8 @@ function buildDocumentRenderArgs(resolved, appHtml) {
487
489
  path: resolved.route.path,
488
490
  namespace: resolved.route.namespace
489
491
  },
490
- cspNonce: resolved.cspNonce
492
+ cspNonce: resolved.cspNonce,
493
+ styles: Array.from(resolved.ctx.ssrStyles.values())
491
494
  }
492
495
  };
493
496
  }
@@ -928,7 +931,7 @@ function resolveSSRPortals(html, ctx) {
928
931
  if (renderedHosts.has(host.token)) continue;
929
932
  foundHost = true;
930
933
  const content = activeHosts.has(host.token) && slot.hasValue ? renderRenderableSync(slot.value, ctx) : "";
931
- resolved = resolved.replace(host.token, () => content);
934
+ resolved = resolved.replace(host.token, () => host.automatic && content === "" && slot.hasValue && explicitHosts.length === 0 ? host.token : content);
932
935
  renderedHosts.add(host.token);
933
936
  }
934
937
  }
@@ -1026,6 +1029,7 @@ function renderNodeSync(node, ctx) {
1026
1029
  if (typeof type === "function") return renderRenderableSync(inheritRenderableKey(node, executeComponentSync(type, props, ctx, getVNodeContextFrame(node) ?? null)), ctx);
1027
1030
  if (typeof type === "symbol") {
1028
1031
  if (type === SSR_PORTAL_HOST) return String(props?.token ?? "");
1032
+ if (type === SSR_PORTAL_ANCHOR) return String(props?.token ?? "");
1029
1033
  if (isFragmentType(type)) return renderChildrenSync(getRenderableChildren(node), ctx);
1030
1034
  if (type === __CONTROL_BOUNDARY__) return renderControlChildrenSync(node, ctx);
1031
1035
  if (type === DEFERRED_BOUNDARY) return renderDeferredBoundarySync(node, ctx);
@@ -1072,6 +1076,10 @@ function renderNodeSyncToSink(node, sink, ctx) {
1072
1076
  else sink.write(token);
1073
1077
  return;
1074
1078
  }
1079
+ if (type === SSR_PORTAL_ANCHOR) {
1080
+ sink.write(String(props?.token ?? ""));
1081
+ return;
1082
+ }
1075
1083
  if (isFragmentType(type)) {
1076
1084
  renderChildrenSyncToSink(getRenderableChildren(node), sink, ctx);
1077
1085
  return;
@@ -1166,7 +1174,8 @@ function renderToStringSync(component, props, options) {
1166
1174
  const nonce = validateCspNonce(options?.cspNonce);
1167
1175
  const ctx = createRenderContext(seed, {
1168
1176
  data: options?.data,
1169
- envelope: options?.envelope
1177
+ envelope: options?.envelope,
1178
+ cspNonce: nonce
1170
1179
  });
1171
1180
  return withRenderContext(ctx, () => {
1172
1181
  startRenderPhase(ctx.renderData);
@@ -1179,7 +1188,9 @@ function renderToStringSync(component, props, options) {
1179
1188
  const sink = new StringSink();
1180
1189
  renderNodeSyncToSink(node, sink, ctx);
1181
1190
  sink.end();
1182
- return resolveSSRPortals(sink.toString(), ctx) + serializeHydrationRenderData(ctx.hydrationData ?? void 0, ctx.dataRuntime);
1191
+ const html = resolveSSRPortals(sink.toString(), ctx);
1192
+ options?.onContext?.(ctx);
1193
+ return html + serializeHydrationRenderData(ctx.hydrationData ?? void 0, ctx.dataRuntime);
1183
1194
  } finally {
1184
1195
  try {
1185
1196
  stopRenderPhase();
@@ -1274,15 +1285,26 @@ function stripHydrationPayload(html) {
1274
1285
  return html.replace(/<script type="application\/json" data-askr-render-data="true">[\s\S]*?<\/script>$/, "");
1275
1286
  }
1276
1287
  function renderBoundary(boundary, state, payload, seed, data, cspNonce) {
1277
- return stripHydrationPayload(renderToStringSync(() => state === "fulfilled" ? boundary.fulfilled(payload) : boundary.rejected(payload), {}, {
1278
- seed,
1279
- envelope: data ?? void 0,
1280
- cspNonce
1281
- }));
1288
+ const styles = [];
1289
+ return {
1290
+ html: stripHydrationPayload(renderToStringSync(() => state === "fulfilled" ? boundary.fulfilled(payload) : boundary.rejected(payload), {}, {
1291
+ seed,
1292
+ envelope: data ?? void 0,
1293
+ cspNonce,
1294
+ onContext: (context) => styles.push(...context.ssrStyles.values())
1295
+ })),
1296
+ styles
1297
+ };
1298
+ }
1299
+ function escapeHtmlAttribute(value) {
1300
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1282
1301
  }
1283
- function patchChunk(id, html, cspNonce) {
1302
+ function escapeStyleRawText(value) {
1303
+ return value.replace(/<\/style/gi, "<\\/style");
1304
+ }
1305
+ function patchChunk(id, html, styles, cspNonce) {
1284
1306
  const selector = `askr-resolve[data-askr-deferred=${JSON.stringify(id)}]`;
1285
- return `<template data-askr-deferred-patch="${id}">${html}</template><script${cspNonce ? ` nonce="${cspNonce}"` : ""} data-askr-deferred-apply="${id}">(function(s){var t=s.previousElementSibling;var b=document.querySelector(${JSON.stringify(selector)});if(b&&t){b.replaceWith(t.content.cloneNode(true));}if(t)t.remove();s.remove();})(document.currentScript)<\/script>`;
1307
+ return `${styles.length === 0 ? "" : `<style data-askr-style-registry="true" data-askr-deferred-style="true"${cspNonce ? ` nonce="${escapeHtmlAttribute(cspNonce)}"` : ""}>${escapeStyleRawText(styles.map((style) => style.cssText).join("\n"))}\n</style>`}<template data-askr-deferred-patch="${escapeHtmlAttribute(id)}">${html}</template><script${cspNonce ? ` nonce="${escapeHtmlAttribute(cspNonce)}"` : ""} data-askr-deferred-apply="${escapeHtmlAttribute(id)}">(function(s){var t=s.previousElementSibling;var c=t&&t.previousElementSibling;var r=document.querySelector('style[data-askr-style-registry="true"]:not([data-askr-deferred-style])');if(c&&c.tagName==='STYLE'&&r&&r!==c){r.append(c.textContent||'');c.remove();}else if(c&&c.tagName==='STYLE'){c.removeAttribute('data-askr-deferred-style');}var b=document.querySelector(${JSON.stringify(selector)});if(b&&t){b.replaceWith(t.content.cloneNode(true));}if(t)t.remove();s.remove();})(document.currentScript)<\/script>`;
1286
1308
  }
1287
1309
  function createDeferredRenderStream(initialHtml, boundaries, signal, seed, data, runtime, cspNonce) {
1288
1310
  const encoder = new TextEncoder();
@@ -1320,13 +1342,19 @@ function createDeferredRenderStream(initialHtml, boundaries, signal, seed, data,
1320
1342
  boundaryIndex += 1;
1321
1343
  try {
1322
1344
  const value = await settleWithSignal(boundary.promise, local.signal);
1323
- if (!cancelled && !closed) controller.enqueue(encoder.encode(patchChunk(boundary.id, renderBoundary(boundary, "fulfilled", value, seed, data, cspNonce), cspNonce)));
1345
+ if (!cancelled && !closed) {
1346
+ const rendered = renderBoundary(boundary, "fulfilled", value, seed, data, cspNonce);
1347
+ controller.enqueue(encoder.encode(patchChunk(boundary.id, rendered.html, rendered.styles, cspNonce)));
1348
+ }
1324
1349
  } catch (error) {
1325
1350
  if (local.signal.aborted) {
1326
1351
  if (!cancelled && !closed) close(controller);
1327
1352
  return;
1328
1353
  }
1329
- if (!cancelled && !closed) controller.enqueue(encoder.encode(patchChunk(boundary.id, renderBoundary(boundary, "rejected", error, seed, data, cspNonce), cspNonce)));
1354
+ if (!cancelled && !closed) {
1355
+ const rendered = renderBoundary(boundary, "rejected", error, seed, data, cspNonce);
1356
+ controller.enqueue(encoder.encode(patchChunk(boundary.id, rendered.html, rendered.styles, cspNonce)));
1357
+ }
1330
1358
  }
1331
1359
  return;
1332
1360
  }
@@ -1407,6 +1435,7 @@ async function renderRouteRequestInternal(options) {
1407
1435
  const result = {
1408
1436
  kind: "render",
1409
1437
  html,
1438
+ styles: Array.from(context.ssrStyles.values()),
1410
1439
  ...boundaries.length > 0 ? { stream: createDeferredRenderStream(html, boundaries, signal, options.seed, context.hydrationData, runtime, cspNonce) } : {},
1411
1440
  params: resolved.params
1412
1441
  };
@@ -1,6 +1,6 @@
1
- import { s as ComponentFunction } from "../control-Uvq1GU4K.js";
2
- import { C as Query, k as QueryStaleReason } from "../index-Bki2rqcr.js";
3
- import { N as RouteRegistry, p as RouteAuthOptions, x as RouteMatch } from "../router-Dd-LoJmM.js";
1
+ import { s as ComponentFunction } from "../control-Cix3yjVf.js";
2
+ import { M as RouteMatch, W as RouteRegistry, w as RouteAuthOptions } from "../index-TlEvex-C.js";
3
+ import { C as Query, k as QueryStaleReason } from "../index-5S-fi2xy.js";
4
4
  //#region src/testing/render.d.ts
5
5
  interface RenderOptions {
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { r as flushRuntimeScheduler } from "../access-ePqdQqkV.js";
2
- import { r as computeRouteActivityMatches } from "../route-matching-DqM8k4tZ.js";
3
- import { l as addInvalidationListener } from "../data-runtime-rpV6-3XW.js";
4
- import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-Cc5axhVo.js";
2
+ import { r as computeRouteActivityMatches } from "../route-matching-jqwlQJ5g.js";
3
+ import { l as addInvalidationListener } from "../data-runtime-D68YOo9L.js";
4
+ import { a as cleanupApp, r as createSPA, t as createIsland } from "../boot-C5bZY3Uc.js";
5
5
  //#region src/testing/render.ts
6
6
  const renderStates = /* @__PURE__ */ new WeakMap();
7
7
  const eventConstructorNames = {
@@ -1,5 +1,5 @@
1
1
  import { t as SSR_RENDER_DATA_ATTR } from "./ssr-CbQO5xd3.js";
2
- import { a as renderResolvedToStringSync } from "./ssr-Cv5qWPxz.js";
2
+ import { a as renderResolvedToStringSync } from "./ssr-Dcmi1bZi.js";
3
3
  //#region src/ssr/verify-hydration.ts
4
4
  function normalizeHydrationHtml(html) {
5
5
  const template = document.createElement("template");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askrjs/askr",
3
- "version": "0.0.77",
3
+ "version": "0.0.78",
4
4
  "description": "Actor-backed deterministic UI framework",
5
5
  "keywords": [
6
6
  "askr",
@@ -1,12 +0,0 @@
1
- //#region src/common/control.ts
2
- const __CONTROL_BOUNDARY__ = Symbol("__CONTROL_BOUNDARY__");
3
- const EAGER_CONTROL_PRIMITIVE = Symbol("__ASKR_EAGER_CONTROL_PRIMITIVE__");
4
- function markEagerControlPrimitive(primitive) {
5
- primitive[EAGER_CONTROL_PRIMITIVE] = true;
6
- return primitive;
7
- }
8
- function isEagerControlPrimitive(value) {
9
- return typeof value === "function" && Boolean(value[EAGER_CONTROL_PRIMITIVE]);
10
- }
11
- //#endregion
12
- export { isEagerControlPrimitive as n, markEagerControlPrimitive as r, __CONTROL_BOUNDARY__ as t };
@@ -1,102 +0,0 @@
1
- import { i as Scope, n as ReadableSource, r as ComponentInstance } from "./control-Uvq1GU4K.js";
2
- import { t as Scheduler } from "./scheduler-CmLO4Dfm.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
15
- //#region src/runtime/runtime.d.ts
16
- interface RuntimeKeyedReorderDecision {
17
- useFastPath: boolean;
18
- totalKeyed: number;
19
- totalChildren: number;
20
- currentKeyCount: number;
21
- moveCount: number;
22
- lisLen: number;
23
- hasPropChanges: boolean;
24
- isWholeKeyedList: boolean;
25
- }
26
- interface RuntimeRendererHost {
27
- evaluate(node: unknown, target: Element | null, context?: object, retainedOwner?: ComponentInstance): void;
28
- cleanupInstancesUnder(node: Node): void;
29
- replaceComponentRange(instance: ComponentInstance, result: unknown, placeholder: Comment): Node | null;
30
- teardownNodeSubtree(root: Node): void;
31
- populateKeyMapForElement(parent: Element): void;
32
- getKeyMapForElement(parent: Element): Map<string | number, Element> | undefined;
33
- isKeyedReorderFastPathEligible(parent: Element, children: unknown[], oldKeyMap: Map<string | number, Element> | undefined): RuntimeKeyedReorderDecision;
34
- markReactivePropsDirtySource(source: ReadableSource<unknown>): void;
35
- }
36
- interface AskrRuntimeOptions {
37
- scheduler?: Scheduler;
38
- renderer?: RuntimeRendererHost;
39
- }
40
- declare class AskrRuntime {
41
- readonly scheduler: Scheduler;
42
- private rendererHost;
43
- constructor(options?: AskrRuntimeOptions);
44
- get renderer(): RuntimeRendererHost;
45
- configureRenderer(renderer: RuntimeRendererHost): void;
46
- }
47
- declare function createRuntime(options?: AskrRuntimeOptions): AskrRuntime;
48
- declare function getDefaultRuntime(): AskrRuntime;
49
- //#endregion
50
- //#region src/runtime/snapshot-source.d.ts
51
- declare const SNAPSHOT_SOURCE_BRAND: unique symbol;
52
- type SnapshotSourceBrand = {
53
- readonly [SNAPSHOT_SOURCE_BRAND]: true;
54
- };
55
- //#endregion
56
- //#region src/runtime/derive.d.ts
57
- interface Derived<T> extends ReadableSource<T> {
58
- (): T;
59
- }
60
- type SnapshotSource<T> = {
61
- value: T | null;
62
- pending?: boolean;
63
- error?: Error | null;
64
- } & SnapshotSourceBrand;
65
- /** Creates a render-scoped derived value; must be called during component render. */
66
- declare function derive<TOut>(fn: () => TOut): Derived<TOut>;
67
- declare function derive<TIn, TOut>(source: SnapshotSource<TIn> | TIn | (() => TIn), map: (value: TIn) => TOut): Derived<TOut | null>;
68
- //#endregion
69
- //#region src/runtime/selector.d.ts
70
- interface Selector<T> {
71
- (candidate: T): boolean;
72
- }
73
- type SelectorEquals<T> = {
74
- bivarianceHack(a: T, b: T): boolean;
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
- */
84
- declare function selector<T>(source: () => T, equals?: SelectorEquals<T>): Selector<T>;
85
- //#endregion
86
- //#region src/csp-nonce.d.ts
87
- declare const CspNonceScope: Scope<string | undefined>;
88
- declare function cspNonce(): string | undefined;
89
- //#endregion
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,40 +0,0 @@
1
- import { c as RenderableChild, g as StateTuple } from "./control-Uvq1GU4K.js";
2
- import { r as JSXElement } from "./jsx-Dvr2SGRG.js";
3
- import "./index-CDACZEF2.js";
4
- import { ObjectSchema } from "@askrjs/schema";
5
- //#region src/actions/index.d.ts
6
- interface ActionDescriptor<TInput extends Record<string, unknown> = Record<string, unknown>> {
7
- readonly id: string;
8
- readonly input: ObjectSchema<TInput>;
9
- readonly invalidates: readonly string[];
10
- }
11
- declare function defineAction<TInput extends Record<string, unknown>>(options: {
12
- readonly id: string;
13
- readonly input: ObjectSchema<TInput>;
14
- readonly invalidates?: readonly string[];
15
- }): ActionDescriptor<TInput>;
16
- /** A native form bound to a declared action; it is not a synthetic event API. */
17
- declare function ActionForm<TInput extends Record<string, unknown>>({ action, children, ...props }: {
18
- readonly action: ActionDescriptor<TInput>;
19
- readonly children?: RenderableChild;
20
- readonly [key: string]: unknown;
21
- }): JSXElement;
22
- interface ActionValidationError {
23
- readonly kind: 'invalid';
24
- readonly action: string;
25
- readonly values: Readonly<Record<string, unknown>>;
26
- readonly issues: readonly unknown[];
27
- readonly fieldErrors: Readonly<Record<string, readonly string[]>>;
28
- }
29
- interface ActionStatus<TResult = unknown> {
30
- readonly pending: boolean;
31
- readonly result?: TResult;
32
- readonly error?: unknown;
33
- }
34
- /** Returns a command handle, rather than a hook. */
35
- declare function action<TInput extends Record<string, unknown>, TResult = unknown>(descriptor: ActionDescriptor<TInput>): {
36
- state: StateTuple<ActionStatus<TResult>>;
37
- submit(input: TInput): Promise<TResult>;
38
- };
39
- //#endregion
40
- export { action as a, ActionValidationError as i, ActionForm as n, defineAction as o, ActionStatus as r, ActionDescriptor as t };