octane 0.3.0 → 0.3.2

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 (55) hide show
  1. package/dist/cjs/constants.cjs +18 -25
  2. package/dist/cjs/css.cjs +6 -0
  3. package/dist/cjs/dom-binding-protocol.cjs +37 -14
  4. package/dist/cjs/hydration/control-capture.cjs +12 -4
  5. package/dist/cjs/hydration/event-capture.cjs +6 -7
  6. package/dist/cjs/hydration-markers.cjs +40 -2
  7. package/dist/cjs/index.cjs +2 -0
  8. package/dist/cjs/runtime-tags.cjs +55 -0
  9. package/dist/cjs/runtime.cjs +235 -148
  10. package/dist/cjs/runtime.server.cjs +110 -80
  11. package/dist/cjs/server/streamed-signals.cjs +102 -64
  12. package/dist/cjs/signals/control-binding.cjs +2 -1
  13. package/dist/cjs/stream-protocol.cjs +9 -8
  14. package/dist/cjs/version.cjs +1 -1
  15. package/dist/compiler/compile.js +550 -35
  16. package/dist/compiler/dom-bindings.js +5 -0
  17. package/dist/compiler/hydrate-boundaries.js +118 -0
  18. package/dist/compiler/private-context.js +160 -0
  19. package/dist/constants.d.ts +7 -18
  20. package/dist/constants.js +11 -9
  21. package/dist/css.d.ts +7 -0
  22. package/dist/css.js +4 -0
  23. package/dist/dom-binding-program.js +12 -5
  24. package/dist/dom-binding-protocol.d.ts +14 -1
  25. package/dist/dom-binding-protocol.js +40 -14
  26. package/dist/hydration/control-capture.d.ts +2 -0
  27. package/dist/hydration/control-capture.js +18 -5
  28. package/dist/hydration/event-capture.js +1 -2
  29. package/dist/hydration/independent-island.js +5 -5
  30. package/dist/hydration/stream-delivery.d.ts +1 -1
  31. package/dist/hydration/stream-delivery.js +16 -9
  32. package/dist/hydration/stream-result-receiver.d.ts +1 -0
  33. package/dist/hydration/stream-result-receiver.js +8 -4
  34. package/dist/hydration-markers.d.ts +30 -0
  35. package/dist/hydration-markers.js +27 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.js +2 -0
  38. package/dist/react/index.js +1 -1
  39. package/dist/react/react-compat-shared.js +5 -3
  40. package/dist/react/shared.d.ts +1 -3
  41. package/dist/react/shared.js +1 -1
  42. package/dist/runtime-tags.d.ts +34 -0
  43. package/dist/runtime-tags.js +22 -0
  44. package/dist/runtime.d.ts +9 -14
  45. package/dist/runtime.js +213 -106
  46. package/dist/runtime.server.d.ts +10 -5
  47. package/dist/runtime.server.js +101 -56
  48. package/dist/server/streamed-signals.d.ts +1 -0
  49. package/dist/server/streamed-signals.js +102 -64
  50. package/dist/signals/control-binding.js +4 -2
  51. package/dist/stream-protocol.js +20 -9
  52. package/dist/universal-core.js +8 -4
  53. package/dist/universal-native.js +1 -1
  54. package/dist/version.js +1 -1
  55. package/package.json +3 -3
@@ -19,8 +19,7 @@ import {
19
19
  snapshotHydrationControl
20
20
  } from "./control-capture.js";
21
21
  import { HYDRATE_STREAM_TOKEN_ATTR, isRendererStreamBoundaryTemplate } from "../stream-protocol.js";
22
- const HYDRATE_MARKER_SELECTOR = "[data-octane-hydrate-id]";
23
- const HYDRATE_WHEN_ATTR = "data-octane-hydrate-when";
22
+ import { HYDRATE_MARKER_SELECTOR, HYDRATE_WHEN_ATTR } from "../hydration-markers.js";
24
23
  function isHydrationNode(target) {
25
24
  return target !== null && typeof target.nodeType === "number";
26
25
  }
@@ -1,5 +1,7 @@
1
1
  import { decodeSignalValue } from "../data-encoding.js";
2
2
  import {
3
+ HYDRATE_ID_ATTR,
4
+ HYDRATE_WHEN_ATTR,
3
5
  HYDRATE_INDEPENDENT_ATTR,
4
6
  INDEPENDENT_HYDRATE_MANIFEST_ATTR
5
7
  } from "../hydration-markers.js";
@@ -19,7 +21,7 @@ function registerIndependentHydrationIsland(element, manifest, registration) {
19
21
  if (!isIndependentHydrateManifest(manifest)) {
20
22
  throw new TypeError("Invalid independent Hydrate manifest.");
21
23
  }
22
- if (element.getAttribute("data-octane-hydrate-id") !== manifest.boundaryId) {
24
+ if (element.getAttribute(HYDRATE_ID_ATTR) !== manifest.boundaryId) {
23
25
  throw new Error("Independent Hydrate boundary identity mismatch.");
24
26
  }
25
27
  element.setAttribute(HYDRATE_INDEPENDENT_ATTR, "");
@@ -85,8 +87,7 @@ function registerIndependentHydrationIsland(element, manifest, registration) {
85
87
  return status;
86
88
  };
87
89
  registerHydrationIntentBoundary(element, boundary);
88
- if (intents.length !== 0 || element.getAttribute("data-octane-hydrate-when") === "load")
89
- activate();
90
+ if (intents.length !== 0 || element.getAttribute(HYDRATE_WHEN_ATTR) === "load") activate();
90
91
  return Object.assign(
91
92
  () => {
92
93
  if (disposed) return;
@@ -107,8 +108,7 @@ function registerIndependentHydrationIsland(element, manifest, registration) {
107
108
  resume() {
108
109
  if (disposed || !paused) return;
109
110
  paused = false;
110
- if (intents.length || element.getAttribute("data-octane-hydrate-when") === "load")
111
- activate();
111
+ if (intents.length || element.getAttribute(HYDRATE_WHEN_ATTR) === "load") activate();
112
112
  }
113
113
  }
114
114
  );
@@ -10,7 +10,7 @@ export interface StreamedRendererDeliveryOptions {
10
10
  /** Includes style/composition waits; also caps unfinished inline result channels. */
11
11
  readonly maxPendingFrames?: number;
12
12
  readonly maxPendingBytes?: number;
13
- /** Maximum queue/placement and inline result lifetime; readers also bound the response. */
13
+ /** Maximum queue/placement wait and result inactivity; readers also bound each pending read. */
14
14
  readonly timeoutMs?: number;
15
15
  }
16
16
  export interface StreamedRendererReadOptions extends StreamedRendererDeliveryOptions {
@@ -145,8 +145,11 @@ function installStreamedRendererGlobal(receiver, target = globalThis, options =
145
145
  if (disposition === "stale" || frame.channel !== "result") return;
146
146
  if (frame.kind === "complete" || frame.kind === "error") {
147
147
  forgetResult(frame.identity);
148
- } else if (frame.kind === "open") {
149
- if (openResults.size >= maxOpenResults)
148
+ } else {
149
+ const key = streamFrameIdentityKey(frame.identity);
150
+ const previous2 = openResults.get(key);
151
+ if (previous2 !== void 0) clearTimeout(previous2.timer);
152
+ else if (openResults.size >= maxOpenResults)
150
153
  throw new StreamedReceiverError(
151
154
  "overflow",
152
155
  "Streamed renderer exceeded its open result budget."
@@ -161,7 +164,7 @@ function installStreamedRendererGlobal(receiver, target = globalThis, options =
161
164
  } catch {
162
165
  }
163
166
  }, resultTimeoutMs);
164
- openResults.set(streamFrameIdentityKey(frame.identity), { identity: frame.identity, timer });
167
+ openResults.set(key, { identity: frame.identity, timer });
165
168
  }
166
169
  });
167
170
  let removed = false;
@@ -259,17 +262,22 @@ async function readStreamedRendererResponse(response, receiver, options = {}) {
259
262
  void reader.cancel(options.signal?.reason).catch(() => {
260
263
  });
261
264
  };
262
- const timer = setTimeout(() => {
263
- failure ??= new StreamedReceiverError("timeout", "Streamed renderer response timed out.");
264
- abort();
265
- }, timeoutMs);
266
265
  options.signal?.addEventListener("abort", abort, { once: true });
267
266
  if (options.signal?.aborted) abort();
268
267
  try {
269
268
  for (; ; ) {
270
269
  if (failure !== void 0 && options.signal?.aborted) throw failure;
271
270
  options.signal?.throwIfAborted();
272
- const next = await reader.read();
271
+ const timer = setTimeout(() => {
272
+ failure ??= new StreamedReceiverError("timeout", "Streamed renderer response timed out.");
273
+ abort();
274
+ }, timeoutMs);
275
+ let next;
276
+ try {
277
+ next = await reader.read();
278
+ } finally {
279
+ clearTimeout(timer);
280
+ }
273
281
  if (next.done) break;
274
282
  totalBytes += next.value.byteLength;
275
283
  if (totalBytes > maxTotalBytes) {
@@ -314,7 +322,6 @@ async function readStreamedRendererResponse(response, receiver, options = {}) {
314
322
  failOpenResults(error);
315
323
  throw error;
316
324
  } finally {
317
- clearTimeout(timer);
318
325
  options.signal?.removeEventListener("abort", abort);
319
326
  if (!finished) {
320
327
  try {
@@ -13,6 +13,7 @@ export interface StreamedResultReceiverOptions {
13
13
  readonly ownerKey: string;
14
14
  readonly maxPendingFrames?: number;
15
15
  readonly maxPendingBytes?: number;
16
+ /** Maximum inactivity before the first result frame or between accepted result frames. */
16
17
  readonly pendingTimeoutMs?: number;
17
18
  readonly onError?: (error: StreamedReceiverError) => void;
18
19
  }
@@ -69,6 +69,12 @@ function createStreamedResultReceiverState(options, commitPlacement) {
69
69
  return state !== void 0 && sameStreamFrameIdentity(state.identity, identity) ? state : void 0;
70
70
  };
71
71
  const isCurrent = (state, identity) => !disposed && state.failure === void 0 && current(identity) === state;
72
+ const renewResultTimeout = (state) => {
73
+ if (state.result.timer !== void 0) clearTimeout(state.result.timer);
74
+ state.result.timer = setTimeout(() => {
75
+ report(new StreamedReceiverError("timeout", "Streamed result timed out."), state);
76
+ }, timeoutMs);
77
+ };
72
78
  const registerSelection = (identity, contentRevision = 0) => {
73
79
  if (!isStreamedRendererFrame({
74
80
  identity,
@@ -95,9 +101,7 @@ function createStreamedResultReceiverState(options, commitPlacement) {
95
101
  contentRevision
96
102
  };
97
103
  selections.set(key, state);
98
- state.result.timer = setTimeout(() => {
99
- report(new StreamedReceiverError("timeout", "Streamed result timed out."), state);
100
- }, timeoutMs);
104
+ renewResultTimeout(state);
101
105
  };
102
106
  const attachResult = (identity, consumer) => {
103
107
  const state = current(identity);
@@ -175,7 +179,7 @@ function createStreamedResultReceiverState(options, commitPlacement) {
175
179
  if (frame.kind === "complete" || frame.kind === "error") {
176
180
  result.terminal = true;
177
181
  if (result.timer !== void 0) clearTimeout(result.timer);
178
- }
182
+ } else if (!result.terminal && isCurrent(state, frame.identity)) renewResultTimeout(state);
179
183
  if (frame.kind === "complete") retainCompletedResult(result);
180
184
  return "accepted";
181
185
  };
@@ -5,3 +5,33 @@ export declare const HYDRATE_INDEPENDENT_ATTR = "data-octane-hydrate-independent
5
5
  export declare const HYDRATE_INPUT_ATTR = "data-octane-input";
6
6
  /** Server-only writable-signal identity joined to a compiler control site. */
7
7
  export declare const SIGNAL_CONTROL_ATTR = "data-octane-signal-control";
8
+ /** Stable id of a server-rendered deferred hydration boundary. */
9
+ export declare const HYDRATE_ID_ATTR = "data-octane-hydrate-id";
10
+ /** Serialized strategy kind (`visible`, `idle`, `dynamic`, …). */
11
+ export declare const HYDRATE_WHEN_ATTR = "data-octane-hydrate-when";
12
+ /** Number of `useId()` slots consumed while rendering the deferred child. */
13
+ export declare const HYDRATE_ID_COUNT_ATTR = "data-octane-hydrate-id-count";
14
+ /** Direct-child JSON script carrying this boundary's `use()` seed slice. */
15
+ export declare const HYDRATE_SEED_ATTR = "data-octane-hydrate-seed";
16
+ /** Matches any server-rendered deferred hydration boundary wrapper. */
17
+ export declare const HYDRATE_MARKER_SELECTOR = "[data-octane-hydrate-id]";
18
+ /** Single-character payload of a block-open comment. */
19
+ export declare const HYDRATION_START = "[";
20
+ /** Single-character payload of a block-close comment. */
21
+ export declare const HYDRATION_END = "]";
22
+ /** Leading payload shared by both `@for` outer-open markers. */
23
+ export declare const HYDRATION_FOR_PREFIX = "[f";
24
+ /** @for outer-open payload: the server rendered its @empty arm. */
25
+ export declare const HYDRATION_FOR_EMPTY = "[f0";
26
+ /** @for outer-open payload: the server rendered one or more direct-host items. */
27
+ export declare const HYDRATION_FOR_ITEMS = "[f1";
28
+ /** Index of the arm digit ('0' or '1') inside either @for outer-open payload. */
29
+ export declare const HYDRATION_FOR_ARM_INDEX: number;
30
+ /**
31
+ * Serialize one `useId()` value. The client regenerates the id the server
32
+ * already wrote, so the namespace prefix, the `in-` infix, the base-36 ordinal,
33
+ * and both colons must be produced in exactly one place: a divergence here
34
+ * survives every test that only checks one side and then mismatches every
35
+ * `useId` consumer at hydration.
36
+ */
37
+ export declare function formatUseId(prefix: string, ordinal: number): string;
@@ -2,9 +2,35 @@ const INDEPENDENT_HYDRATE_MANIFEST_ATTR = "data-octane-independent";
2
2
  const HYDRATE_INDEPENDENT_ATTR = "data-octane-hydrate-independent";
3
3
  const HYDRATE_INPUT_ATTR = "data-octane-input";
4
4
  const SIGNAL_CONTROL_ATTR = "data-octane-signal-control";
5
+ const HYDRATE_ID_ATTR = "data-octane-hydrate-id";
6
+ const HYDRATE_WHEN_ATTR = "data-octane-hydrate-when";
7
+ const HYDRATE_ID_COUNT_ATTR = "data-octane-hydrate-id-count";
8
+ const HYDRATE_SEED_ATTR = "data-octane-hydrate-seed";
9
+ const HYDRATE_MARKER_SELECTOR = "[data-octane-hydrate-id]";
10
+ const HYDRATION_START = "[";
11
+ const HYDRATION_END = "]";
12
+ const HYDRATION_FOR_PREFIX = "[f";
13
+ const HYDRATION_FOR_EMPTY = "[f0";
14
+ const HYDRATION_FOR_ITEMS = "[f1";
15
+ const HYDRATION_FOR_ARM_INDEX = HYDRATION_FOR_PREFIX.length;
16
+ function formatUseId(prefix, ordinal) {
17
+ return ":" + prefix + "in-" + ordinal.toString(36) + ":";
18
+ }
5
19
  export {
20
+ HYDRATE_ID_ATTR,
21
+ HYDRATE_ID_COUNT_ATTR,
6
22
  HYDRATE_INDEPENDENT_ATTR,
7
23
  HYDRATE_INPUT_ATTR,
24
+ HYDRATE_MARKER_SELECTOR,
25
+ HYDRATE_SEED_ATTR,
26
+ HYDRATE_WHEN_ATTR,
27
+ HYDRATION_END,
28
+ HYDRATION_FOR_ARM_INDEX,
29
+ HYDRATION_FOR_EMPTY,
30
+ HYDRATION_FOR_ITEMS,
31
+ HYDRATION_FOR_PREFIX,
32
+ HYDRATION_START,
8
33
  INDEPENDENT_HYDRATE_MANIFEST_ATTR,
9
- SIGNAL_CONTROL_ATTR
34
+ SIGNAL_CONTROL_ATTR,
35
+ formatUseId
10
36
  };
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { initializeHydrationEventCapture } from './hydration/event-capture.js';
6
6
  export { attachBehaviorRoot } from './behavior-root.js';
7
7
  export type * from './behavior-root.js';
8
8
  export { createSubSlot, subSlot, type SubSlot, type SlotlessSubSlot, type SubSlotOptions, } from './sub-slot.js';
9
- export { createRoot, hydrateRoot, flushSync, act, isInActScope, type Root, type RootContainer, type RootOptions, useState, useLinkedState, type LinkedStatePrevious, type LinkedStateOptions, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useMemo, useCallback, useRef, useId, useImperativeHandle, useEffectEvent, useSyncExternalStore, useDeferredValue, useTransition, useActionState, useActionState as useFormState, useFormStatus, useOptimistic, useDebugValue, type FormStatus, startTransition, requestFormReset, memo, lazy, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, createContext, use, useContext, type Context, type ForeignHostContext, Suspense, ErrorBoundary, Hydrate, Activity, Activity as unstable_Activity, ViewTransition, addTransitionType, ViewTransition as unstable_ViewTransition, addTransitionType as unstable_addTransitionType, ViewTransitionPseudoElement, type ViewTransitionProps, type ViewTransitionInstance, Fragment, createPortal, type PortalDescriptor, createElement, cloneElement, isValidElement, isChildrenBlock, descriptorChildren, Children, type ElementDescriptor, type ComponentBody, type OctaneNode, TsrxErrorBoundary, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, __createVoidRoot, __hydrateVoidRoot, bindRendererRegionOwner, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, createHostContextRequest, __vtSeen, template, clone, drainFrag, bag0, bag1, bag2, bag3, bag4, bag5, bag6, bag7, bag8, bag9, bag10, bag11, bag12, bag13, bag14, bag15, bag16, bagOf, evt0, evt0u, evt1, evt1u, evt2, evt2u, evt1e, evt2e, evtN, evtNu, setEventHandler, devEventListener, devHtmlNesting, htext, htextSwap, child, sibling, setText, setScriptText, setHTML, setDangerouslySetInnerHTML, setDangerouslySetInnerHTMLSources, markDangerouslySetInnerHTMLChildren, setAttribute, setStringData, setBooleanAttribute, setAriaAttribute, setClassName, setClassAttr, normalizeClass, isHydratingStyle, setStyle, setStyleProperty, setStyleProperties, setSpread, snapshotSpread, setHostPropSources, queueNativeChangeDiagnostic, queueFormAuthoringDiagnostic, markNativeChangeDiagnosticStatic, setFormAction, setValue, setFormControlSources, setChecked, setCheckedCheckable, setSelectValue, setDefaultValue, setDefaultValueUncontrolled, setDefaultChecked, setAutoFocus, attachRef, queueRefAttach, queueRefDetach, replaceRef, queueOwnRefDetach, injectStyle, headBlock, stylesheetResource, styleResource, scriptResource, namespaceHead, namespaceHeadElement, delegateEvents, delegateCaptureEvents, fastForBlock, fastKeyedForBlock, fastMapSlot, forBlock, keyedForBlock, mapSlot, ifBlock, errorBlock, tryBlock, switchBlock, activityBlock, componentSlot, componentSlotVoid, componentSlotLite, compilerCacheArray, compilerCacheImmutableArrayFilter, compilerCacheMappedArray, compilerCacheContext, compilerOwnsContextProvider, markSingleRoot, markWarm, markSingleRoot as __s, markChildrenBlock, createScopedValue, createScopedElement, childSlot, positionalChildren, textSlot, textHole, childTextHole, hostComponent, renderBlock, portal, hookSlots, withSlot, manualHook, invokeManualHook, useBatch, registerWarmPlan, seedOrCreate, warmMemo, warmChild, puMiss, puTake0, puTake1, puTake2, puTake3, puTake4, puPub, provideContext, mountFragmentRef, FragmentInstance, hmr, HMR, hasPendingWork, type Scope, type Block, drainPassiveEffects, setIsOctaneActEnvironment, resetFloatResourceState, setTransitionFallbackTimeout, getTransitionFallbackTimeout, } from './runtime.js';
9
+ export { createRoot, hydrateRoot, flushSync, act, isInActScope, type Root, type RootContainer, type RootOptions, useState, useLinkedState, type LinkedStatePrevious, type LinkedStateOptions, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useMemo, useCallback, useRef, useId, useImperativeHandle, useEffectEvent, useSyncExternalStore, useDeferredValue, useTransition, useActionState, useActionState as useFormState, useFormStatus, useOptimistic, useDebugValue, type FormStatus, startTransition, requestFormReset, memo, lazy, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, createContext, use, useContext, type Context, type ForeignHostContext, Suspense, ErrorBoundary, Hydrate, __HydrateCompiled, Activity, Activity as unstable_Activity, ViewTransition, addTransitionType, ViewTransition as unstable_ViewTransition, addTransitionType as unstable_addTransitionType, ViewTransitionPseudoElement, type ViewTransitionProps, type ViewTransitionInstance, Fragment, createPortal, type PortalDescriptor, createElement, cloneElement, isValidElement, isChildrenBlock, descriptorChildren, Children, type ElementDescriptor, type ComponentBody, type OctaneNode, TsrxErrorBoundary, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, __createVoidRoot, __hydrateVoidRoot, bindRendererRegionOwner, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, createHostContextRequest, __vtSeen, template, clone, drainFrag, bag0, bag1, bag2, bag3, bag4, bag5, bag6, bag7, bag8, bag9, bag10, bag11, bag12, bag13, bag14, bag15, bag16, bagOf, evt0, evt0u, evt1, evt1u, evt2, evt2u, evt1e, evt2e, evtN, evtNu, setEventHandler, devEventListener, devHtmlNesting, htext, htextSwap, child, sibling, setText, setScriptText, setHTML, setDangerouslySetInnerHTML, setDangerouslySetInnerHTMLSources, markDangerouslySetInnerHTMLChildren, setAttribute, setStringData, setBooleanAttribute, setAriaAttribute, setClassName, setClassAttr, normalizeClass, isHydratingStyle, setStyle, setStyleProperty, setStyleProperties, setSpread, snapshotSpread, setHostPropSources, queueNativeChangeDiagnostic, queueFormAuthoringDiagnostic, markNativeChangeDiagnosticStatic, setFormAction, setValue, setFormControlSources, setChecked, setCheckedCheckable, setSelectValue, setDefaultValue, setDefaultValueUncontrolled, setDefaultChecked, setAutoFocus, attachRef, queueRefAttach, queueRefDetach, replaceRef, queueOwnRefDetach, injectStyle, headBlock, stylesheetResource, styleResource, scriptResource, namespaceHead, namespaceHeadElement, delegateEvents, delegateCaptureEvents, fastForBlock, fastKeyedForBlock, fastMapSlot, forBlock, keyedForBlock, mapSlot, ifBlock, errorBlock, tryBlock, switchBlock, activityBlock, componentSlot, componentSlotVoid, componentSlotLite, compilerCacheArray, compilerCacheImmutableArrayFilter, compilerCacheMappedArray, compilerCacheContext, compilerOwnsContextProvider, markSingleRoot, markWarm, markSingleRoot as __s, markChildrenBlock, createScopedValue, createScopedElement, childSlot, positionalChildren, textSlot, textHole, childTextHole, hostComponent, renderBlock, portal, hookSlots, withSlot, manualHook, invokeManualHook, useBatch, registerWarmPlan, seedOrCreate, warmMemo, warmChild, puMiss, puTake0, puTake1, puTake2, puTake3, puTake4, puPub, provideContext, mountFragmentRef, FragmentInstance, hmr, HMR, hasPendingWork, type Scope, type Block, drainPassiveEffects, setIsOctaneActEnvironment, resetFloatResourceState, setTransitionFallbackTimeout, getTransitionFallbackTimeout, } from './runtime.js';
10
10
  export type { HydrateOptions, HydrateProps, HydrateWhen, HydrationInteractionEvent, HydrationInteractionEvents, HydrationPrefetchContext, HydrationPrefetchFunction, HydrationPrefetchStrategy, HydrationPrefetchWaitReason, HydrationStrategy, HydrationWhen, } from './hydration/types.js';
11
11
  export { __serverRpc } from './server-rpc-client.js';
12
12
  export { ServerCallUncertainError } from './server-rpc-protocol.js';
package/dist/index.js CHANGED
@@ -49,6 +49,7 @@ import {
49
49
  Suspense,
50
50
  ErrorBoundary,
51
51
  Hydrate,
52
+ __HydrateCompiled,
52
53
  Activity,
53
54
  Activity as Activity2,
54
55
  ViewTransition,
@@ -241,6 +242,7 @@ export {
241
242
  TsrxErrorBoundary,
242
243
  ViewTransition,
243
244
  ViewTransitionPseudoElement,
245
+ __HydrateCompiled,
244
246
  __createVoidRoot,
245
247
  __hydrateVoidRoot,
246
248
  __methodDep,
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { RENDERER_REGION_OWNER_TAG as RENDERER_REGION_OWNER } from "../runtime-tags.js";
2
3
  import { ReactCompat } from "./react-compat.js";
3
4
  import { bridgeReactContext } from "./react-compat-shared.js";
4
5
  import * as React from "react";
@@ -21,7 +22,6 @@ import {
21
22
  import { drainPassiveEffects } from "../runtime.js";
22
23
  import { readNearestProviderValue } from "./fiber-adapter.js";
23
24
  import { __hostContextFiberWalks } from "./fiber-adapter.js";
24
- const RENDERER_REGION_OWNER = /* @__PURE__ */ Symbol.for("octane.renderer-region.owner");
25
25
  const EMPTY_SNAPSHOT = { entries: [], values: [] };
26
26
  function hostedRootEnvelope(props) {
27
27
  bindRendererRegionOwner(props);
@@ -1,7 +1,9 @@
1
1
  import * as React from "react";
2
- const OCTANE_ELEMENT_TAG = /* @__PURE__ */ Symbol.for("octane.element");
3
- const OCTANE_CONTEXT_TAG = /* @__PURE__ */ Symbol.for("octane.context");
4
- const REACT_CONTEXT_TAG = /* @__PURE__ */ Symbol.for("react.context");
2
+ import {
3
+ CONTEXT_TAG as OCTANE_CONTEXT_TAG,
4
+ ELEMENT_TAG as OCTANE_ELEMENT_TAG,
5
+ REACT_CONTEXT_TAG
6
+ } from "../runtime-tags.js";
5
7
  const REACT_MEMO_TAG = /* @__PURE__ */ Symbol.for("react.memo");
6
8
  const REACT_LAZY_TAG = /* @__PURE__ */ Symbol.for("react.lazy");
7
9
  const REACT_FORWARD_REF_TAG = /* @__PURE__ */ Symbol.for("react.forward_ref");
@@ -64,8 +64,7 @@ export type OctaneRenderedNode = React.ReactElement & {
64
64
  * `ComponentBody<P>` so one declaration can serve both hosts.
65
65
  */
66
66
  export type OctaneReactComponent<P = Record<string, never>> = (props: P) => OctaneRenderedNode;
67
- /** React 19 context objects carry $$typeof: Symbol.for('react.context'). */
68
- export declare const REACT_CONTEXT_TAG: unique symbol;
67
+ export { REACT_CONTEXT_TAG } from '../runtime-tags.js';
69
68
  /** The client's stable opaque-host sentinel; the server writes real island HTML. */
70
69
  export declare const OPAQUE_HOST_SENTINEL_COMMENT = "octane-compat-island";
71
70
  export declare const OPAQUE_HOST_SENTINEL: Readonly<{
@@ -86,4 +85,3 @@ export declare function validateIslandChild(children: React.ReactNode): Transpor
86
85
  * itself, which React resolves by remounting the wrapper.
87
86
  */
88
87
  export declare function resolveHostedIsland(props: OctaneCompatProps | OctaneCompatComponentProps<unknown>): TransportedChild;
89
- export {};
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- const REACT_CONTEXT_TAG = /* @__PURE__ */ Symbol.for("react.context");
2
+ import { REACT_CONTEXT_TAG } from "../runtime-tags.js";
3
3
  const OPAQUE_HOST_SENTINEL_COMMENT = "octane-compat-island";
4
4
  const OPAQUE_HOST_SENTINEL = Object.freeze({
5
5
  __html: `<!--${OPAQUE_HOST_SENTINEL_COMMENT}-->`
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Cross-realm value-kind tags. Every one of these is a `Symbol.for` registry
3
+ * key, which makes the STRING the contract: the client runtime, the SSR
4
+ * serializer, the universal core, and the React compat layers all recognize a
5
+ * value by looking its tag up in the same global registry. A typo in any one of
6
+ * them mints a different symbol and silently fails every `$$kind` identity
7
+ * check that module performs, so each key is spelled exactly once, here.
8
+ *
9
+ * This leaf has no imports on purpose: a consumer that needs one tag must not
10
+ * pull in the DOM tables or the renderer graph to get it.
11
+ */
12
+ /** `createElement` descriptor marker. */
13
+ export declare const ELEMENT_TAG: unique symbol;
14
+ /** `createPortal` descriptor marker. */
15
+ export declare const PORTAL_TAG: unique symbol;
16
+ /** React-compatible Fragment sentinel. */
17
+ export declare const FRAGMENT_TAG: unique symbol;
18
+ /** React-19 `<Activity>` sentinel. */
19
+ export declare const ACTIVITY_TAG: unique symbol;
20
+ /** Native Octane context object marker. */
21
+ export declare const CONTEXT_TAG: unique symbol;
22
+ /** `lazy()` wrapper marker. */
23
+ export declare const LAZY_COMPONENT_TAG: unique symbol;
24
+ /** Suspense boundary component type. */
25
+ export declare const SUSPENSE_TAG: unique symbol;
26
+ /** Lexical children body marker. */
27
+ export declare const CHILDREN_BLOCK_TAG: unique symbol;
28
+ /** Owner stamp for a renderer region's host boundary. */
29
+ export declare const RENDERER_REGION_OWNER_TAG: unique symbol;
30
+ /**
31
+ * React 19 context objects carry this `$$typeof`. Octane only ever READS it to
32
+ * recognize a foreign React context, but it is the same registry contract.
33
+ */
34
+ export declare const REACT_CONTEXT_TAG: unique symbol;
@@ -0,0 +1,22 @@
1
+ const ELEMENT_TAG = /* @__PURE__ */ Symbol.for("octane.element");
2
+ const PORTAL_TAG = /* @__PURE__ */ Symbol.for("octane.portal");
3
+ const FRAGMENT_TAG = /* @__PURE__ */ Symbol.for("octane.Fragment");
4
+ const ACTIVITY_TAG = /* @__PURE__ */ Symbol.for("octane.Activity");
5
+ const CONTEXT_TAG = /* @__PURE__ */ Symbol.for("octane.context");
6
+ const LAZY_COMPONENT_TAG = /* @__PURE__ */ Symbol.for("octane.lazy");
7
+ const SUSPENSE_TAG = /* @__PURE__ */ Symbol.for("octane.suspense");
8
+ const CHILDREN_BLOCK_TAG = /* @__PURE__ */ Symbol.for("octane.childrenBlock");
9
+ const RENDERER_REGION_OWNER_TAG = /* @__PURE__ */ Symbol.for("octane.renderer-region.owner");
10
+ const REACT_CONTEXT_TAG = /* @__PURE__ */ Symbol.for("react.context");
11
+ export {
12
+ ACTIVITY_TAG,
13
+ CHILDREN_BLOCK_TAG,
14
+ CONTEXT_TAG,
15
+ ELEMENT_TAG,
16
+ FRAGMENT_TAG,
17
+ LAZY_COMPONENT_TAG,
18
+ PORTAL_TAG,
19
+ REACT_CONTEXT_TAG,
20
+ RENDERER_REGION_OWNER_TAG,
21
+ SUSPENSE_TAG
22
+ };
package/dist/runtime.d.ts CHANGED
@@ -19,6 +19,7 @@ import { EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY } from './constant
19
19
  import type { HydrateProps } from './hydration/types.js';
20
20
  import type { IndependentHydrateActivator } from './hydration/independent-island.js';
21
21
  import { snapshotHydrationControl } from './hydration/event-capture.js';
22
+ import { CONTEXT_TAG, ELEMENT_TAG, PORTAL_TAG } from './runtime-tags.js';
22
23
  import { validateNativeReadWitness, type NativeReadWitness } from './signals/native-read-collector.js';
23
24
  import { type NativeReadRetry } from './signals/native-read-retry.js';
24
25
  import type { SignalActionFrame } from './signals/transition-action.js';
@@ -935,7 +936,6 @@ export declare function useSyncExternalStore<T>(subscribe: (onStoreChange: () =>
935
936
  * suspended or failed render from leaking an uncommitted closure.
936
937
  */
937
938
  export declare function useEffectEvent<F extends (...args: any[]) => any>(fn: F, slot?: symbol): F;
938
- declare const CONTEXT_TAG: unique symbol;
939
939
  export interface Context<T> {
940
940
  (props: {
941
941
  value: T;
@@ -961,6 +961,8 @@ export interface Context<T> {
961
961
  * walks the Block parent chain to find the nearest Provider for that context.
962
962
  */
963
963
  export declare function createContext<T>(defaultValue: T): Context<T>;
964
+ /** Compiler-owned private Context whose children are always compiled bodies. */
965
+ export declare function __createCompiledContext<T>(defaultValue: T): Context<T>;
964
966
  /**
965
967
  * Identify the Context already provided by this deferred child's own scope
966
968
  * without observing userland Provider accessors or Proxy traps.
@@ -1008,6 +1010,8 @@ export declare function descriptorChildren<T>(component: T): T;
1008
1010
  */
1009
1011
  export declare function isChildrenBlock(value: unknown): boolean;
1010
1012
  export declare const Hydrate: ComponentBody<HydrateProps>;
1013
+ /** Compiler-owned template children with no authored fallback; never a descriptor entry point. */
1014
+ export declare const __HydrateCompiled: ComponentBody<HydrateProps>;
1011
1015
  /**
1012
1016
  * `<Suspense fallback={…}>…</Suspense>` — the JSX component form of
1013
1017
  * `@try { … } @pending { fallback }`, for authors writing JSX rather than the
@@ -1473,6 +1477,8 @@ export declare function child<T extends Node>(node: T): Node | null;
1473
1477
  export declare function sibling(node: Node, n?: number): Node | null;
1474
1478
  export declare function setText(node: Text, value: any): void;
1475
1479
  declare const DIRECT_SIGNAL_BINDING: unique symbol;
1480
+ /** @internal Invalidate scalar-view caches when hydration retained a claimed publication. */
1481
+ export declare function hydrateClaimedBindingCaches(scope: Scope, fields: readonly (string | number)[]): void;
1476
1482
  type DirectSignalBindingKind = 'text' | 'textOnlyChild' | 'attribute' | 'value' | 'checked';
1477
1483
  type DirectSignalAttributeKind = 'attr' | 'class' | 'booleanAttr' | 'ariaAttr' | 'stringData';
1478
1484
  interface DirectSignalBindingPolicy {
@@ -1779,7 +1785,7 @@ type HostPropSource = readonly [
1779
1785
  value?: unknown,
1780
1786
  merge?: boolean
1781
1787
  ];
1782
- export declare function setHostPropSources(el: Element, sources: readonly HostPropSource[], prev: Record<string, unknown> | undefined, scope: Scope, hasNestedChildren?: boolean, readStyle?: (value: unknown) => unknown, deferControl?: boolean, writableTextareaValue?: boolean): Record<string, unknown>;
1788
+ export declare function setHostPropSources(el: Element, sources: readonly HostPropSource[], prev: Record<string, unknown> | undefined, scope: Scope, hasNestedChildren?: boolean, readStyle?: (value: unknown) => unknown, deferControl?: boolean): Record<string, unknown>;
1783
1789
  /** @internal Compiler target for spread-bearing hosts containing direct signals. */
1784
1790
  export declare function bindSignalHostPropSources(scope: Scope, previous: unknown, element: Element, sources: readonly HostPropSource[], site: string, hasNestedChildren?: boolean, readStyle?: (value: unknown) => unknown): unknown;
1785
1791
  export declare function setSpread(el: Element, value: any, prev: any, mountScope?: Scope, skipDangerouslySetInnerHTML?: boolean, skipFormControls?: boolean): void;
@@ -1880,7 +1886,7 @@ export declare function markNativeChangeDiagnosticStatic(el: Element): void;
1880
1886
  * attribute write never clobbers what the user typed, and it keeps SSR
1881
1887
  * output, form.reset() baselines, and differential byte-compares aligned.
1882
1888
  */
1883
- export declare function setValue(el: Element, value: unknown, writableTextareaEcho?: boolean): void;
1889
+ export declare function setValue(el: Element, value: unknown): void;
1884
1890
  export declare function setChecked(el: Element, value: unknown): void;
1885
1891
  /**
1886
1892
  * Compiler-only checked binding for a statically-known checkbox/radio whose
@@ -1935,16 +1941,6 @@ interface PortalSlot {
1935
1941
  * down and removes its DOM from `target`.
1936
1942
  */
1937
1943
  export declare function portal(parentScope: Scope, slotKey: number, target: Element | DocumentFragment, body: ComponentBody, props: any, host?: Node, env?: any[], fragmentOwners?: FragmentInstance | readonly FragmentInstance[], fragmentAnchor?: Node): void;
1938
- /**
1939
- * `createPortal(children, target, keyOrProps?)`. A string/number third argument
1940
- * is a reconciliation key. An object remains Octane's optional props for a
1941
- * function portal body. The
1942
- * compiler recognises `{createPortal(...)}` at JSX child position and lowers it to a
1943
- * direct `portal(...)` runtime call — no descriptor allocation on the hot path. This
1944
- * function exists so non-JSX call sites (storing in a variable, passing through props,
1945
- * etc.) still produce something the runtime can dispatch on.
1946
- */
1947
- declare const PORTAL_TAG: unique symbol;
1948
1944
  export interface PortalDescriptor {
1949
1945
  $$kind: typeof PORTAL_TAG;
1950
1946
  key: string | null;
@@ -1953,7 +1949,6 @@ export interface PortalDescriptor {
1953
1949
  props: any;
1954
1950
  }
1955
1951
  export declare function createPortal(body: ComponentBody | ElementDescriptor | unknown, target: Element | DocumentFragment, props?: any): PortalDescriptor;
1956
- declare const ELEMENT_TAG: unique symbol;
1957
1952
  export interface ElementDescriptor<P = any> {
1958
1953
  $$kind: typeof ELEMENT_TAG;
1959
1954
  type: ComponentBody<P> | string | typeof Fragment;