octane 0.2.2 → 0.2.4

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 (59) hide show
  1. package/dist/cjs/compatibility.cjs +35 -0
  2. package/dist/cjs/component-flags.cjs +8 -1
  3. package/dist/cjs/css.cjs +9 -0
  4. package/dist/cjs/dom-tables.cjs +8 -1
  5. package/dist/cjs/error-codes.client.generated.cjs +15 -2
  6. package/dist/cjs/error-codes.server.generated.cjs +5 -0
  7. package/dist/cjs/event-names.cjs +39 -0
  8. package/dist/cjs/index.cjs +13 -0
  9. package/dist/cjs/runtime.cjs +1345 -359
  10. package/dist/cjs/runtime.server.cjs +620 -183
  11. package/dist/cjs/server/index.cjs +26 -0
  12. package/dist/cjs/version.cjs +1 -1
  13. package/dist/compatibility.d.ts +7 -0
  14. package/dist/compatibility.js +10 -0
  15. package/dist/compiler/bundler.js +20 -30
  16. package/dist/compiler/compile-renderer-boundaries.js +1 -0
  17. package/dist/compiler/compile-universal.js +3 -0
  18. package/dist/compiler/compile.js +877 -627
  19. package/dist/compiler/hook-deps.js +100 -3
  20. package/dist/compiler/hook-names.js +1 -0
  21. package/dist/compiler/hydrate-boundaries.js +165 -15
  22. package/dist/compiler/manual-hooks.js +171 -0
  23. package/dist/compiler/parser.node.js +34 -8
  24. package/dist/compiler/plain-hook-memo.js +54 -5
  25. package/dist/compiler/slot-hooks.d.ts +43 -0
  26. package/dist/compiler/slot-hooks.js +154 -35
  27. package/dist/compiler/strong-mode.js +836 -3
  28. package/dist/compiler/style-scopes.js +1134 -0
  29. package/dist/compiler/volar.LICENSES.txt +1 -1
  30. package/dist/compiler/volar.js +4543 -2839
  31. package/dist/component-flags.d.ts +1 -1
  32. package/dist/component-flags.js +8 -1
  33. package/dist/css.d.ts +7 -0
  34. package/dist/css.js +8 -0
  35. package/dist/dom-tables.js +8 -1
  36. package/dist/error-codes.client.generated.d.ts +3 -1
  37. package/dist/error-codes.client.generated.js +15 -2
  38. package/dist/error-codes.server.generated.d.ts +1 -0
  39. package/dist/error-codes.server.generated.js +5 -0
  40. package/dist/event-names.d.ts +1 -0
  41. package/dist/event-names.js +15 -0
  42. package/dist/html-tree-validation.d.ts +17 -34
  43. package/dist/index.d.ts +3 -1
  44. package/dist/index.js +12 -1
  45. package/dist/jsx-runtime.d.ts +6 -1
  46. package/dist/public-types.d.ts +188 -0
  47. package/dist/public-types.js +0 -0
  48. package/dist/runtime.d.ts +128 -69
  49. package/dist/runtime.js +1349 -360
  50. package/dist/runtime.server.d.ts +67 -15
  51. package/dist/runtime.server.js +619 -184
  52. package/dist/server/index.d.ts +4 -2
  53. package/dist/server/index.js +23 -0
  54. package/dist/static/index.d.ts +2 -1
  55. package/dist/static/index.js +3 -1
  56. package/dist/universal-core.d.ts +8 -1
  57. package/dist/universal-core.js +95 -9
  58. package/dist/version.js +1 -1
  59. package/package.json +4 -3
package/dist/runtime.d.ts CHANGED
@@ -387,10 +387,25 @@ interface PendingEffect {
387
387
  }
388
388
  interface TransitionActionSlot<T> {
389
389
  value: T;
390
+ renderTransition?: {
391
+ value: T;
392
+ };
390
393
  pendingActionBatch?: TransitionActionBatch;
391
394
  pendingActionValue?: T;
392
395
  }
393
396
  interface TransitionActionUpdate<T = unknown> {
397
+ /** An urgent replacement can cancel a held value even when its base is equal. */
398
+ superseded?: boolean;
399
+ state?: StateSlot<T>;
400
+ /** Already queued work precedes this batch; later urgent work stays on the cell. */
401
+ previous?: TransitionActionUpdate<T>;
402
+ next?: TransitionActionUpdate<T>;
403
+ stateUpdates?: Array<T | ((previous: T) => T)>;
404
+ reducerActions?: any[];
405
+ replayBaseValue?: T;
406
+ urgentOperations?: number[];
407
+ batch?: TransitionActionBatch;
408
+ reducer?: ReducerSlot<T, any>;
394
409
  slot: TransitionActionSlot<T>;
395
410
  block: Block;
396
411
  operations: Array<(value: T) => T>;
@@ -405,6 +420,17 @@ interface TransitionActionBatch {
405
420
  pendingActions: number;
406
421
  closed: boolean;
407
422
  flushed: boolean;
423
+ /**
424
+ * Only hook-started actions own pending indicators. Nearly every batch has
425
+ * exactly one starting hook, so the first is a plain field and only a second
426
+ * distinct hook (a nested start from another component) allocates the list.
427
+ */
428
+ hook: TransitionHookSlot | null;
429
+ hooks: TransitionHookSlot[] | null;
430
+ /** True while this batch is counted in its hooks' pending batch counts. */
431
+ hooksPending: boolean;
432
+ pendingHolds?: number;
433
+ workComplete?: boolean;
408
434
  }
409
435
  type TransitionMemoSwap = [kind: 0, hooks: Map<HookSlot, unknown>, slot: HookSlot, previous: unknown, next: unknown] | [kind: 1, cells: any[], base: number, previous: any[], next: any[]];
410
436
  interface WarmHarvestEntry {
@@ -416,6 +442,8 @@ interface WarmHarvestEntry {
416
442
  }
417
443
  /** The same single-origin staged cells as P1, owned by a root rather than a TrySlot. */
418
444
  interface RootTransitionHold {
445
+ /** Coalesce retries when an urgent action changes the retained forward value. */
446
+ replayScheduled?: boolean;
419
447
  origin: Block;
420
448
  entries: Array<TransitionActionUpdate<any>>;
421
449
  memoSwaps: TransitionMemoSwap[] | null;
@@ -599,8 +627,8 @@ export declare function scheduleRenderCleanup(schedule: (callback: () => void) =
599
627
  */
600
628
  export declare function setIsOctaneActEnvironment(value: boolean): void;
601
629
  /**
602
- * React-DOM parity. Runs `fn` and synchronously drains any renders/effects it scheduled
603
- * before returning. Bypasses the microtask-batched flush — used by the benchmark
630
+ * Runs `fn` and synchronously drains scheduled renders and insertion/layout work.
631
+ * Newly queued passive effects retain Octane's post-paint scheduling. Bypasses the microtask-batched flush — used by the benchmark
604
632
  * timing rig to measure operation wall-clock without microtask coalescing. Also the
605
633
  * controlled-restore commit path: maybeFlushDiscrete flushes through here at the
606
634
  * outermost boundary of a discrete event that armed a controlled `value`/`checked`
@@ -676,9 +704,27 @@ export declare function act<T>(fn: () => T | Promise<T>): Promise<T>;
676
704
  export declare function renderBlock(block: Block): void;
677
705
  export declare function componentSlotLite<P>(parentScope: Scope, slotKey: number, host: Node, comp: ComponentBody<P>, props: P, anchor?: Node): void;
678
706
  declare const SLOT_FLAG_TEARDOWN: number;
707
+ /** @internal Invoke a provider that owns the trailing hook-slot ABI. */
708
+ export declare function invokeManualHook<T>(fn: (...args: any[]) => T, receiver: unknown, args: IArguments): T;
709
+ /** @internal Adapt an expression provider that owns the trailing hook-slot ABI. */
710
+ export declare function manualHook<F extends (...args: any[]) => any>(fn: F, name?: string): F;
679
711
  export declare function withSlot<T>(sym: symbol, fn: (...a: any[]) => T, ...args: any[]): T;
680
712
  /** @internal Optional native hooks use the existing compiler slot and Scope lifetime. */
681
713
  export declare function nativeLocalHook<T>(name: string, initialize: () => T, dispose: (value: T) => void, slot?: HookSlot): T;
714
+ interface StateSlot<T> {
715
+ value: T;
716
+ setter: (next: T | ((prev: T) => T)) => void;
717
+ /** Queued functional work is evaluated in the owner's next render. */
718
+ updates?: Array<T | ((previous: T) => T)>;
719
+ /** Promoted transition work folds with the inputs of the rendering owner. */
720
+ renderTransition?: TransitionActionUpdate<T>;
721
+ /** An urgent ancestor reads queued urgent operations without consuming the transition. */
722
+ urgentTransition?: boolean;
723
+ /** Allocated only for compiler-selected third-tuple consumers. */
724
+ getter?: () => T;
725
+ pendingActionBatch?: TransitionActionBatch;
726
+ pendingActionValue?: T;
727
+ }
682
728
  type StateSetter<T> = (next: T | ((prev: T) => T)) => void;
683
729
  type StateTuple<T> = [T, StateSetter<T>, () => T];
684
730
  export declare function useState<T = undefined>(): StateTuple<T | undefined>;
@@ -705,6 +751,20 @@ type LinkedStateTuple<Value> = [Value, StateSetter<Value>, () => Value];
705
751
  export declare function useLinkedState<Source, Value>(source: Source, reconcile: (source: Source, previous: LinkedStatePrevious<Source, Value> | undefined) => Value, options?: LinkedStateOptions<Source, Value>, slot?: symbol): LinkedStateTuple<Value>;
706
752
  /** Compiler-selected linked-state variant when the current-value getter is observed. */
707
753
  export declare function __useLinkedStateWithGetter<Source, Value>(source: Source, reconcile: (source: Source, previous: LinkedStatePrevious<Source, Value> | undefined) => Value, options?: LinkedStateOptions<Source, Value>, slot?: symbol): LinkedStateTuple<Value>;
754
+ interface ReducerSlot<S, A> {
755
+ value: S;
756
+ dispatch: (action: A) => void;
757
+ reducer: (state: S, action: A) => S;
758
+ /** Render-phase actions are reduced by the reducer from the replaying render. */
759
+ renderPhaseActions?: A[];
760
+ /** A promoted Action is reduced with this render's reducer before publication. */
761
+ renderTransition?: TransitionActionUpdate<S>;
762
+ urgentTransition?: boolean;
763
+ /** Allocated only for compiler-selected third-tuple consumers. */
764
+ getter?: () => S;
765
+ pendingActionBatch?: TransitionActionBatch;
766
+ pendingActionValue?: S;
767
+ }
708
768
  type ReducerTuple<S, A> = [S, (action: A) => void, () => S];
709
769
  export declare function useReducer<S, A, I = S>(reducer: (s: S, a: A) => S, initialArg: I, initOrSlot?: ((arg: I) => S) | symbol, slot?: symbol): ReducerTuple<S, A>;
710
770
  /** Compiler-emitted useReducer variant for a tuple whose third member is observable. */
@@ -739,6 +799,9 @@ export declare function hookMemoPublish4<T>(cells: any[], base: number, value: T
739
799
  export declare function hookMemoPublish<T>(cells: any[], base: number, value: T, ...deps: any[]): T;
740
800
  /** One-cell form for compiler-owned lifetime-invariant callback values. */
741
801
  export declare function hookMemoPublishInvariant<T>(cells: any[], base: number, value: T): T;
802
+ export declare function useRef<T = undefined>(): {
803
+ current: T | undefined;
804
+ };
742
805
  export declare function useRef<T>(initial: T, slot?: symbol): {
743
806
  current: T;
744
807
  };
@@ -760,47 +823,6 @@ type ImperativeRef<T> = {
760
823
  * nested array refs share one factory result across all non-null owners.
761
824
  */
762
825
  export declare function useImperativeHandle<T>(ref: ImperativeRef<T>, factory: () => T, deps?: any[] | null, slot?: symbol): void;
763
- /**
764
- * React 18+ `useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot?)`.
765
- *
766
- * Mirrors React's contract: subscribe is called on mount with an
767
- * `onStoreChange` callback; the returned function unsubscribes on unmount
768
- * (and on subscribe identity change). `getSnapshot()` is called on every
769
- * render to return the current snapshot. When the store calls
770
- * `onStoreChange`, the component re-renders and `getSnapshot()` runs again.
771
- *
772
- * `getServerSnapshot` IS used: on the server it supplies the SSR snapshot, and
773
- * during client hydration the first read uses it (see below) so the adopted DOM
774
- * matches the server value before the commit-time store-sync reconciles any
775
- * client/server difference. Client-only builds discard the capability method
776
- * that supplies this state.
777
- *
778
- * Implementation. A single identity-stable `inst` cell (StoreInst) holds the
779
- * last-COMMITTED snapshot, the latest getSnapshot, the block's forceUpdate, and a
780
- * stable onStoreChange handler. Two derived sub-slots host it: `<slot>:uses:inst`
781
- * (the cell, in the hooks map) and `<slot>:uses:effect` (the passive subscribe
782
- * effect). The value-sync that reconciles the render-read snapshot at commit does
783
- * NOT go through a layout effect — it rides the dedicated, sort-free
784
- * `storeSyncQueue` (drainStoreSyncs, run after the layout phase). Two payoffs:
785
- *
786
- * 1. The commit-sync entry carries no cleanup and never reorders, so the generic
787
- * effect machinery (deps compare, PendingEffect alloc, post-order sort,
788
- * per-entry cleanup/finalizer bookkeeping) is skipped for it.
789
- * 2. The enqueue is GATED: a re-render whose snapshot is Object.is-unchanged (and
790
- * whose store wasn't swapped) enqueues NOTHING, even with a fresh inline
791
- * getSnapshot every render (the dominant zustand/query pattern). getSnapshot is
792
- * refreshed in RENDER instead of at commit, so onStoreChange always dedups
793
- * against the freshest read while unchanged renders stay allocation-free.
794
- *
795
- * DIVERGENCE FROM REACT (documented in docs/react-parity-migration-plan.md):
796
- * React's updateSyncExternalStore re-pushes updateStoreInstance whenever
797
- * `inst.getSnapshot !== getSnapshot`, giving a commit-time snapshot re-read even
798
- * when the value was unchanged. We drop that: a store that mutates WITHOUT
799
- * notifying in the render→commit window is no longer caught on a render where ONLY
800
- * getSnapshot identity changed. Octane's synchronous renderer closes React's
801
- * motivating concurrent-interleaving window, and any store that actually notifies
802
- * is unaffected (onStoreChange uses the render-fresh getSnapshot).
803
- */
804
826
  export declare function useSyncExternalStore<T>(subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T, slot?: symbol): T;
805
827
  /**
806
828
  * React 19 `useEffectEvent` — returns a fresh wrapper each render whose shared
@@ -1061,6 +1083,8 @@ export declare function nativeWarmMemo(compute: () => any, deps: any[], slot: Ho
1061
1083
  * cannot prove finite.
1062
1084
  */
1063
1085
  export declare function warmChild(comp: any, props: any): void;
1086
+ /** Compiler-owned plans must not follow static hoisting onto unrelated HOCs. */
1087
+ export declare function markWarm<T extends Function>(component: T, plan: unknown): T;
1064
1088
  export declare const puMiss: unique symbol;
1065
1089
  export declare function puTake0(slot: HookSlot): any;
1066
1090
  export declare function puTake1(slot: HookSlot, d0: any): any;
@@ -1104,7 +1128,9 @@ export declare function memoPublishAlways<T>(slot: HookSlot, value: T): T;
1104
1128
  */
1105
1129
  export declare function lazy<C extends ComponentBody<any>>(load: () => PromiseLike<{
1106
1130
  default: C;
1107
- } | C>): C;
1131
+ } | C>): C & {
1132
+ displayName?: string;
1133
+ };
1108
1134
  export declare function useId(slot?: symbol): string;
1109
1135
  export declare function template(html: string, ns?: number, frag?: number): Element;
1110
1136
  export declare function clone<T extends Node>(node: T, loc?: string, partialStyles?: string): T;
@@ -1191,7 +1217,12 @@ export declare function setHTML(el: Element, value: any): void;
1191
1217
  /** Complete validated write used by direct, spread, and html-only compiler paths. */
1192
1218
  export declare function setDangerouslySetInnerHTML(el: Element, value: any): void;
1193
1219
  /** Resolve source-ordered direct/spread raw-HTML writers and apply only the winner. */
1194
- export declare function setDangerouslySetInnerHTMLSources(el: Element, sources: readonly (readonly [isSpread: boolean, sourceOrName: unknown, value?: unknown])[], ignoreSourceChildren?: boolean): void;
1220
+ export declare function setDangerouslySetInnerHTMLSources(el: Element, sources: readonly (readonly [
1221
+ isSpread: boolean,
1222
+ sourceOrName: unknown,
1223
+ value?: unknown,
1224
+ merge?: boolean
1225
+ ])[], ignoreSourceChildren?: boolean): void;
1195
1226
  /** Stamp a compiler-proven non-nullish child onto a potential raw-HTML host. */
1196
1227
  export declare function markDangerouslySetInnerHTMLChildren(el: Element): void;
1197
1228
  export declare function attachRef(ref: any, el: Element | FragmentInstance | null, prevTarget?: Element | FragmentInstance | null): void;
@@ -1381,9 +1412,7 @@ export declare function setStringData(el: Element, name: string, value: unknown)
1381
1412
  export declare function setBooleanAttribute(el: Element, name: string, value: unknown): void;
1382
1413
  /**
1383
1414
  * Compiler-only fast path for a valid, statically named lowercase `aria-*`
1384
- * attribute. ARIA values are enumerated: only nullish removes, while booleans,
1385
- * functions, symbols, numbers, and objects stringify exactly like the generic
1386
- * attribute path.
1415
+ * attribute. Booleans stringify; nullish, function, and symbol values remove.
1387
1416
  */
1388
1417
  export declare function setAriaAttribute(el: Element, name: string, value: unknown): void;
1389
1418
  import { normalizeClass } from './css.js';
@@ -1400,7 +1429,12 @@ export declare function setStyle(el: HTMLElement | SVGElement, value: any, prev:
1400
1429
  export declare function setStyleProperty(el: HTMLElement | SVGElement, name: string, value: any, staticCss: string, previous: any): void;
1401
1430
  /** Snapshot a JSX spread with own-enumerable Object.assign semantics. */
1402
1431
  export declare function snapshotSpread(value: unknown): Record<string, unknown> | null;
1403
- type HostPropSource = readonly [isSpread: boolean, sourceOrName: unknown, value?: unknown];
1432
+ type HostPropSource = readonly [
1433
+ isSpread: boolean,
1434
+ sourceOrName: unknown,
1435
+ value?: unknown,
1436
+ merge?: boolean
1437
+ ];
1404
1438
  /**
1405
1439
  * Resolve a spread-bearing compiled host's complete prop set before touching
1406
1440
  * the DOM. JSX spread merging is last-writer-wins, but aliases such as
@@ -1408,6 +1442,12 @@ type HostPropSource = readonly [isSpread: boolean, sourceOrName: unknown, value?
1408
1442
  * property. Canonical identities ensure a vanished earlier source cannot
1409
1443
  * remove an unchanged later winner, and hydration compares only the final
1410
1444
  * client value against the final server value.
1445
+ *
1446
+ * A synthesized scope-hash class (4th tuple flag) is not an authored later
1447
+ * writer: after identity last-writer-wins, it composes onto the winning class
1448
+ * instead of replacing a spread's class. An authored `class` beside a spread
1449
+ * stays last-writer-wins because its hash is baked into that authored value
1450
+ * and carries no merge flag.
1411
1451
  */
1412
1452
  export declare function setHostPropSources(el: Element, sources: readonly HostPropSource[], prev: Record<string, unknown> | undefined, scope: Scope, hasNestedChildren?: boolean): Record<string, unknown>;
1413
1453
  export declare function setSpread(el: Element, value: any, prev: any, mountScope?: Scope, skipDangerouslySetInnerHTML?: boolean, skipFormControls?: boolean): void;
@@ -1457,7 +1497,7 @@ export declare function delegateCaptureEvents(eventNames: string[]): void;
1457
1497
  export interface FormStatus {
1458
1498
  pending: boolean;
1459
1499
  data: FormData | null;
1460
- method: string;
1500
+ method: string | null;
1461
1501
  action: ((formData: FormData) => unknown) | string | null;
1462
1502
  }
1463
1503
  /**
@@ -1476,11 +1516,11 @@ export declare function requestFormReset(form: HTMLFormElement): void;
1476
1516
  /**
1477
1517
  * Compiler-emitted binding for `<form action={fn}>` / `<button formAction={fn}>`.
1478
1518
  * A FUNCTION value wires submit interception (stored on the element as
1479
- * `$$formAction`, with the form gaining a delegated `$$submit` handler once);
1519
+ * `$$formAction`, with submit delegation installed once);
1480
1520
  * a string/null value falls back to the native attribute so ordinary form posts
1481
- * still work. `prev` lets the update path clean up when switching function→string.
1521
+ * still work. The previous-value argument remains part of the compiler ABI.
1482
1522
  */
1483
- export declare function setFormAction(el: HTMLFormElement | HTMLButtonElement | HTMLInputElement, name: string, value: unknown, prev: unknown): void;
1523
+ export declare function setFormAction(el: HTMLFormElement | HTMLButtonElement | HTMLInputElement, name: string, value: unknown, _prev: unknown): void;
1484
1524
  /**
1485
1525
  * Compiler-emitted binding for `autoFocus` (React parity): client mounts never
1486
1526
  * write an attribute and focus supported controls once, before layout effects.
@@ -1525,12 +1565,7 @@ export declare function setSelectValue(el: Element, value: unknown): void;
1525
1565
  * option defaultSelected), never the live value: a dirty control keeps what
1526
1566
  * the user typed. Re-synced on updates (React parity; attribute-only).
1527
1567
  */
1528
- export declare function setDefaultValue(el: Element, value: unknown): void;
1529
- /**
1530
- * Compiler-only defaultValue binding for a statically-known input/textarea
1531
- * with no value writer or spread. The element is necessarily uncontrolled, so
1532
- * it needs neither a controlled-state record nor edit/composition listeners.
1533
- */
1568
+ export declare function setDefaultValue(el: Element, value: unknown, initial?: boolean): void;
1534
1569
  export declare function setDefaultValueUncontrolled(el: Element, value: unknown): void;
1535
1570
  /** Compiler-emitted binding for `defaultChecked` (uncontrolled checkables). */
1536
1571
  export declare function setDefaultChecked(el: Element, value: unknown): void;
@@ -1542,11 +1577,12 @@ export declare function setDefaultChecked(el: Element, value: unknown): void;
1542
1577
  * controlled value before its default fallback) while the compiler-owned
1543
1578
  * source bindings preserve authored evaluation order and single getter reads.
1544
1579
  */
1545
- export declare function setFormControlSources(el: Element, sources: ReadonlyArray<readonly [boolean, unknown, unknown?]>): void;
1580
+ export declare function setFormControlSources(el: Element, sources: ReadonlyArray<readonly [boolean, unknown, unknown?, boolean?]>): void;
1546
1581
  interface PortalSlot {
1547
1582
  __kind: 'portalSlotSlot';
1548
1583
  block: Block | null;
1549
1584
  target: Element | null;
1585
+ key: string | null;
1550
1586
  host: Node;
1551
1587
  start: Comment | null;
1552
1588
  end: Comment | null;
@@ -1563,10 +1599,9 @@ interface PortalSlot {
1563
1599
  */
1564
1600
  export declare function portal(parentScope: Scope, slotKey: number, target: Element, body: ComponentBody, props: any, host?: Node, env?: any[], fragmentOwners?: FragmentInstance | readonly FragmentInstance[], fragmentAnchor?: Node): void;
1565
1601
  /**
1566
- * `createPortal(children, target, props?)`. The first two arguments mirror ReactDOM's
1567
- * `createPortal(children, container)`; the OPTIONAL THIRD argument is Octane-specific
1568
- * `props` for the portal wrapper — NOT ReactDOM's `key`. That third slot is an
1569
- * intentional divergence from React (Octane has no `key`-as-third-arg portal form). The
1602
+ * `createPortal(children, target, keyOrProps?)`. A string/number third argument
1603
+ * is a reconciliation key. An object remains Octane's optional props for a
1604
+ * function portal body. The
1570
1605
  * compiler recognises `{createPortal(...)}` at JSX child position and lowers it to a
1571
1606
  * direct `portal(...)` runtime call — no descriptor allocation on the hot path. This
1572
1607
  * function exists so non-JSX call sites (storing in a variable, passing through props,
@@ -1575,6 +1610,7 @@ export declare function portal(parentScope: Scope, slotKey: number, target: Elem
1575
1610
  declare const PORTAL_TAG: unique symbol;
1576
1611
  export interface PortalDescriptor {
1577
1612
  $$kind: typeof PORTAL_TAG;
1613
+ key: string | null;
1578
1614
  body: ComponentBody | ElementDescriptor | unknown;
1579
1615
  target: Element;
1580
1616
  props: any;
@@ -1725,7 +1761,14 @@ export declare function compilerCacheContext(scope: Scope, slotKey: number, prev
1725
1761
  * "equal"), `false` to re-render. When omitted, a shallow Object.is comparison
1726
1762
  * of own enumerable keys is used.
1727
1763
  */
1728
- export declare function memo<P>(component: ComponentBody<P>, arePropsEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean): ComponentBody<P>;
1764
+ export declare function memo<C extends ComponentBody<any>>(component: C, arePropsEqual?: (prevProps: Readonly<Parameters<C>[0]>, nextProps: Readonly<Parameters<C>[0]>) => boolean): C & {
1765
+ readonly type: C;
1766
+ displayName?: string;
1767
+ };
1768
+ export declare function memo<P>(component: ComponentBody<P>, arePropsEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean): ComponentBody<P> & {
1769
+ readonly type: ComponentBody<P>;
1770
+ displayName?: string;
1771
+ };
1729
1772
  export declare const HMR: unique symbol;
1730
1773
  export declare function hmr<P>(fn: ComponentBody<P>): ComponentBody<P>;
1731
1774
  export declare function setTransitionFallbackTimeout(ms: number): void;
@@ -1856,6 +1899,21 @@ declare function teardownErrorSlot(state: ErrorSlot, detachDom: boolean): void;
1856
1899
  export declare function errorBlock(parentScope: Scope, slotKey: number, domParent: Node, tryBody: ComponentBody, catchBody: ComponentBody, anchor?: Node | null, env?: any[]): () => void;
1857
1900
  export declare function tryBlock(parentScope: Scope, slotKey: number, domParent: Node, tryBody: ComponentBody, catchBody: ComponentBody | null, pendingBody: ComponentBody | null, anchor?: Node | null, env?: any[], propagateSuspense?: boolean): () => void;
1858
1901
  export declare function startTransition(fn: () => void | Promise<unknown>): void;
1902
+ interface TransitionHookSlot {
1903
+ isPending: boolean;
1904
+ block: Block;
1905
+ /**
1906
+ * Action batches this hook started or was re-held into that have not
1907
+ * finished. The batches themselves list their hooks; the hook only needs
1908
+ * the count to publish its falling edge, so no per-hook collection exists.
1909
+ */
1910
+ pendingBatches: number;
1911
+ error?: {
1912
+ value: unknown;
1913
+ };
1914
+ start: (fn: () => void | Promise<unknown>) => void;
1915
+ publish: (pending: boolean) => void;
1916
+ }
1859
1917
  export declare function useTransition(slot?: symbol): [boolean, (fn: () => void | Promise<unknown>) => void];
1860
1918
  export declare function useActionState<S>(action: (prevState: S, payload: any) => S | Promise<S>, initialState: S, permalinkOrSlot?: string | symbol, slot?: symbol): [S, (payload?: any) => void, boolean];
1861
1919
  export declare function useFormStatus(slot?: symbol): FormStatus;
@@ -1954,11 +2012,12 @@ interface InlineCaughtErrorReport {
1954
2012
  handler: (error: unknown) => void;
1955
2013
  resume: EffectEventCommitAction;
1956
2014
  }
2015
+ export type RootContainer = Element | Document | DocumentFragment;
1957
2016
  /** Compiler ABI: validate an authored candidate and publish only from a DEV render. */
1958
2017
  export declare function devHtmlNesting(childTag: string, ancestors: string[], childLocation?: string, ancestorLocation?: string): void;
1959
- export declare function createRoot(container: Element, options?: RootOptions): Root;
2018
+ export declare function createRoot(container: RootContainer, options?: RootOptions): Root;
1960
2019
  /** Compiler-only root for a statically proven void `@{}` entry component. */
1961
- export declare function __createVoidRoot(container: Element, options?: RootOptions): Root;
2020
+ export declare function __createVoidRoot(container: RootContainer, options?: RootOptions): Root;
1962
2021
  /**
1963
2022
  * Hydrate a server-rendered container and return a live {@link Root} — the
1964
2023
  * React-18 `hydrateRoot(container, element)` shape (container FIRST). Instead of
@@ -1974,8 +2033,8 @@ export declare function __createVoidRoot(container: Element, options?: RootOptio
1974
2033
  * component updates props in place on the adopted DOM, a different component
1975
2034
  * tears down and remounts.
1976
2035
  */
1977
- export declare function hydrateRoot(container: Element, element: ElementDescriptor, options?: RootOptions): Root;
1978
- export declare function hydrateRoot(container: Element, body: ComponentBody, props?: any, options?: RootOptions): Root;
2036
+ export declare function hydrateRoot(container: RootContainer, element: ElementDescriptor, options?: RootOptions): Root;
2037
+ export declare function hydrateRoot(container: RootContainer, body: ComponentBody, props?: any, options?: RootOptions): Root;
1979
2038
  /** React DOM `preload(href, {as, …})` — `<link rel="preload">`. */
1980
2039
  export declare function preload(href: string, options: {
1981
2040
  as: string;