@absolutejs/absolute 0.19.0-beta.422 → 0.19.0-beta.424

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.
@@ -1703,6 +1703,11 @@ var streamSwapRuntime = () => {
1703
1703
  const consumers = window.__ABS_SLOT_CONSUMERS__;
1704
1704
  const pending = window.__ABS_SLOT_PENDING__;
1705
1705
  const canApplyImmediately = () => window.__ABS_SLOT_HYDRATION_PENDING__ !== true;
1706
+ const isAngularDeferPayload = (payload) => {
1707
+ if (!payload || typeof payload !== "object")
1708
+ return false;
1709
+ return payload.kind === "angular-defer";
1710
+ };
1706
1711
  const resolveHtml = (payload) => {
1707
1712
  if (!payload || typeof payload !== "object") {
1708
1713
  return typeof payload === "string" ? payload : "";
@@ -1726,6 +1731,10 @@ var streamSwapRuntime = () => {
1726
1731
  return;
1727
1732
  }
1728
1733
  }
1734
+ if (isAngularDeferPayload(payload)) {
1735
+ pending[id] = payload;
1736
+ return;
1737
+ }
1729
1738
  const node = document.getElementById(`slot-${id}`);
1730
1739
  if (!node) {
1731
1740
  pending[id] = payload;
@@ -1788,7 +1797,13 @@ var createSlotPatchStatement = (id, payload) => `(window.${STREAMING_RUNTIME_GLO
1788
1797
  var createNonceAttr = (nonce) => nonce ? ` nonce="${nonce}"` : "";
1789
1798
  var createStreamingSlotId = () => `${SLOT_ID_PREFIX}${Math.random().toString(36).slice(2, 10)}`;
1790
1799
  var getStreamingSlotsRuntimeScript = () => getStreamSwapRuntimeScript();
1791
- var renderStreamingSlotsRuntimeTag = (nonce) => `<script${createNonceAttr(nonce)}>${escapeScriptContent(getStreamingSlotsRuntimeScript())}</script>`;
1800
+ var renderStreamingSlotsRuntimeTag = (nonce, runtimePreludeScript) => {
1801
+ const runtimeBody = [
1802
+ runtimePreludeScript?.trim() ? runtimePreludeScript.trim() : "",
1803
+ getStreamingSlotsRuntimeScript()
1804
+ ].filter(Boolean).join(";");
1805
+ return `<script${createNonceAttr(nonce)}>${escapeScriptContent(runtimeBody)}</script>`;
1806
+ };
1792
1807
  var renderStreamingSlotPlaceholder = (id, fallbackHtml = "") => `<div id="${createSlotPlaceholderId(id)}" data-absolute-slot="true">${fallbackHtml}</div>`;
1793
1808
  var renderStreamingSlotPatchTag = (id, payload, nonce) => `<script${createNonceAttr(nonce)}>${escapeScriptContent(createSlotPatchStatement(id, payload))}</script>`;
1794
1809
  var injectHtmlIntoHead = (html, injection) => {
@@ -2093,8 +2108,8 @@ var streamOutOfOrderSlots = ({
2093
2108
  }
2094
2109
  });
2095
2110
  };
2096
- var injectStreamingRuntimeIntoStream = (stream, nonce, runtimePlacement = "head") => {
2097
- const runtimeTag = renderStreamingSlotsRuntimeTag(nonce);
2111
+ var injectStreamingRuntimeIntoStream = (stream, nonce, runtimePlacement = "head", runtimePreludeScript) => {
2112
+ const runtimeTag = renderStreamingSlotsRuntimeTag(nonce, runtimePreludeScript);
2098
2113
  const encoder = new TextEncoder;
2099
2114
  const decoder = new TextDecoder;
2100
2115
  const closingTag = runtimePlacement === "body" ? CLOSING_BODY_TAG : CLOSING_HEAD_TAG;
@@ -2151,6 +2166,7 @@ var appendStreamingSlotPatchesToStream = (stream, slots = [], {
2151
2166
  onError,
2152
2167
  onSlotMetric,
2153
2168
  policy,
2169
+ runtimePreludeScript,
2154
2170
  runtimePlacement = "head"
2155
2171
  } = {}) => {
2156
2172
  const resolvedPolicy = resolveStreamingSlotPolicy(policy);
@@ -2168,7 +2184,7 @@ var appendStreamingSlotPatchesToStream = (stream, slots = [], {
2168
2184
  });
2169
2185
  if (preparedSlots.length === 0)
2170
2186
  return stream;
2171
- const source = injectRuntime ? injectStreamingRuntimeIntoStream(stream, nonce, runtimePlacement) : stream;
2187
+ const source = injectRuntime ? injectStreamingRuntimeIntoStream(stream, nonce, runtimePlacement, runtimePreludeScript) : stream;
2172
2188
  const encoder = new TextEncoder;
2173
2189
  const decoder = new TextDecoder;
2174
2190
  const reader = source.getReader();
@@ -2257,6 +2273,7 @@ var enhanceHtmlResponseWithStreamingSlots = (response, {
2257
2273
  nonce,
2258
2274
  onError,
2259
2275
  runtimePlacement,
2276
+ runtimePreludeScript,
2260
2277
  streamingSlots = [],
2261
2278
  policy
2262
2279
  } = {}) => {
@@ -2267,6 +2284,7 @@ var enhanceHtmlResponseWithStreamingSlots = (response, {
2267
2284
  nonce,
2268
2285
  onError,
2269
2286
  policy,
2287
+ runtimePreludeScript,
2270
2288
  runtimePlacement
2271
2289
  });
2272
2290
  return new Response(body, {
@@ -2466,5 +2484,5 @@ export {
2466
2484
  Island
2467
2485
  };
2468
2486
 
2469
- //# debugId=F64A8D5C1FABA7DD64756E2164756E21
2487
+ //# debugId=51DCC5805478704D64756E2164756E21
2470
2488
  //# sourceMappingURL=index.js.map