@tanstack/redact 0.0.14 → 0.0.16

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 (90) hide show
  1. package/dist/core/internal.d.ts +23 -39
  2. package/dist/core/internal.js +7 -23
  3. package/dist/core/internal.js.map +3 -3
  4. package/dist/dom/dispatcher.d.ts +3 -1
  5. package/dist/dom/dispatcher.js +104 -97
  6. package/dist/dom/dispatcher.js.map +2 -2
  7. package/dist/dom/dom.js +1 -1
  8. package/dist/dom/dom.js.map +2 -2
  9. package/dist/dom/event-replay.js +7 -29
  10. package/dist/dom/event-replay.js.map +2 -2
  11. package/dist/dom/features/class/full.js +16 -16
  12. package/dist/dom/features/class/full.js.map +2 -2
  13. package/dist/dom/features/class/stub.js +7 -7
  14. package/dist/dom/features/class/stub.js.map +2 -2
  15. package/dist/dom/features/context/full.js +7 -7
  16. package/dist/dom/features/context/full.js.map +2 -2
  17. package/dist/dom/features/context/stub.js +3 -3
  18. package/dist/dom/features/context/stub.js.map +2 -2
  19. package/dist/dom/features/forward-ref/full.js +11 -11
  20. package/dist/dom/features/forward-ref/full.js.map +2 -2
  21. package/dist/dom/features/hydration/full.d.ts +26 -14
  22. package/dist/dom/features/hydration/full.js +417 -92
  23. package/dist/dom/features/hydration/full.js.map +2 -2
  24. package/dist/dom/features/hydration/stub.d.ts +13 -12
  25. package/dist/dom/features/hydration/stub.js +23 -8
  26. package/dist/dom/features/hydration/stub.js.map +2 -2
  27. package/dist/dom/features/lazy/full.js +3 -43
  28. package/dist/dom/features/lazy/full.js.map +2 -2
  29. package/dist/dom/features/lazy/stub.js +1 -1
  30. package/dist/dom/features/lazy/stub.js.map +2 -2
  31. package/dist/dom/features/memo/full.js +3 -3
  32. package/dist/dom/features/memo/full.js.map +2 -2
  33. package/dist/dom/features/memo/stub.js +1 -1
  34. package/dist/dom/features/memo/stub.js.map +2 -2
  35. package/dist/dom/features/portal/full.js +2 -2
  36. package/dist/dom/features/portal/full.js.map +2 -2
  37. package/dist/dom/features/suspense/full.js +151 -111
  38. package/dist/dom/features/suspense/full.js.map +2 -2
  39. package/dist/dom/reconcile.d.ts +3 -1
  40. package/dist/dom/reconcile.js +141 -129
  41. package/dist/dom/reconcile.js.map +2 -2
  42. package/dist/dom/root-internal.d.ts +9 -0
  43. package/dist/dom/root-internal.js +31 -0
  44. package/dist/dom/root-internal.js.map +7 -0
  45. package/dist/dom/root.d.ts +1 -1
  46. package/dist/dom/root.js +4 -136
  47. package/dist/dom/root.js.map +2 -2
  48. package/dist/dom/test-utils.js +1 -1
  49. package/dist/dom/test-utils.js.map +2 -2
  50. package/dist/react/children.js +4 -1
  51. package/dist/react/children.js.map +2 -2
  52. package/dist/react/class.js +8 -2
  53. package/dist/react/class.js.map +2 -2
  54. package/dist/react/context.js +4 -1
  55. package/dist/react/context.js.map +2 -2
  56. package/dist/react/index.js +1 -1
  57. package/dist/react/index.js.map +2 -2
  58. package/dist/react/shared-internals.d.ts +4 -7
  59. package/dist/react/shared-internals.js +4 -7
  60. package/dist/react/shared-internals.js.map +2 -2
  61. package/dist/server/stream.d.ts +5 -1
  62. package/dist/server/stream.js.map +2 -2
  63. package/package.json +1 -1
  64. package/src/core/internal.ts +30 -50
  65. package/src/dom/dispatcher.ts +114 -105
  66. package/src/dom/dom.ts +1 -1
  67. package/src/dom/event-replay.ts +14 -30
  68. package/src/dom/features/class/full.ts +16 -16
  69. package/src/dom/features/class/stub.ts +7 -7
  70. package/src/dom/features/context/full.ts +7 -7
  71. package/src/dom/features/context/stub.ts +3 -3
  72. package/src/dom/features/forward-ref/full.ts +11 -11
  73. package/src/dom/features/hydration/full.ts +519 -104
  74. package/src/dom/features/hydration/stub.ts +28 -14
  75. package/src/dom/features/lazy/full.ts +3 -56
  76. package/src/dom/features/lazy/stub.ts +1 -1
  77. package/src/dom/features/memo/full.ts +3 -3
  78. package/src/dom/features/memo/stub.ts +1 -1
  79. package/src/dom/features/portal/full.ts +2 -2
  80. package/src/dom/features/suspense/full.ts +176 -131
  81. package/src/dom/reconcile.ts +164 -170
  82. package/src/dom/root-internal.ts +40 -0
  83. package/src/dom/root.ts +5 -165
  84. package/src/dom/test-utils.ts +1 -1
  85. package/src/react/children.ts +4 -1
  86. package/src/react/class.ts +8 -2
  87. package/src/react/context.ts +4 -1
  88. package/src/react/index.ts +1 -1
  89. package/src/react/shared-internals.ts +8 -14
  90. package/src/server/stream.ts +9 -4
@@ -20,7 +20,8 @@ import {
20
20
  setHydrationCursor,
21
21
  getHydrationCursor,
22
22
  clearHydrationCursor,
23
- findHostParent as findHydrationHost
23
+ findHostParent as findHydrationHost,
24
+ abortHydration
24
25
  } from "./features/hydration";
25
26
  var currentRoot = null;
26
27
  var flushing = false;
@@ -28,15 +29,15 @@ var isBatching = false;
28
29
  var pendingRoots = /* @__PURE__ */ new Set();
29
30
  var forceRerenderingFiber = null;
30
31
  function scheduleUpdate(fiber) {
31
- if (fiber.unmounted) return;
32
+ if (fiber.um) return;
32
33
  const root = findRoot(fiber);
33
34
  if (!root) return;
34
- root.pending.add(fiber);
35
- fiber.dirty = true;
35
+ root.p.add(fiber);
36
+ fiber.dy = true;
36
37
  pendingRoots.add(root);
37
38
  if (isBatching) return;
38
- if (!root.scheduled) {
39
- root.scheduled = true;
39
+ if (!root.s) {
40
+ root.s = true;
40
41
  queueMicrotask(flushPending);
41
42
  }
42
43
  }
@@ -67,14 +68,17 @@ function flushPending() {
67
68
  let guard = 0;
68
69
  while (pendingRoots.size > 0) {
69
70
  if (++guard > 50) {
70
- throw new Error("flushPending exceeded 50 iterations \u2014 suspected infinite update loop.");
71
+ if (true) {
72
+ throw new Error("flushPending exceeded 50 iterations \u2014 suspected infinite update loop.");
73
+ }
74
+ throw new Error();
71
75
  }
72
76
  const roots = [...pendingRoots];
73
77
  pendingRoots.clear();
74
78
  for (const root of roots) {
75
- root.scheduled = false;
76
- const pending = [...root.pending];
77
- root.pending.clear();
79
+ root.s = false;
80
+ const pending = [...root.p];
81
+ root.p.clear();
78
82
  pending.sort((a, b) => fiberDepth(a) - fiberDepth(b));
79
83
  for (const fiber of pending) {
80
84
  rerenderFiber(fiber, root);
@@ -86,6 +90,11 @@ function flushPending() {
86
90
  flushing = false;
87
91
  }
88
92
  }
93
+ function discardPendingWork(root) {
94
+ root.p.clear();
95
+ root.s = false;
96
+ pendingRoots.delete(root);
97
+ }
89
98
  function fiberDepth(fiber) {
90
99
  let d = 0;
91
100
  let p = fiber.parent;
@@ -104,28 +113,28 @@ function findRoot(fiber) {
104
113
  return null;
105
114
  }
106
115
  function renderRoot(root, children) {
107
- const rootFiber = root.current;
108
- rootFiber.pendingProps = { children };
116
+ const rootFiber = root.r;
117
+ rootFiber.pp = { children };
109
118
  currentRoot = root;
110
119
  try {
111
- reconcileChildren(rootFiber, childrenToArray(children), root.container, null);
112
- rootFiber.memoizedProps = rootFiber.pendingProps;
113
- rootFiber.dirty = false;
120
+ reconcileChildren(rootFiber, childrenToArray(children), root.c, null);
121
+ rootFiber.mp = rootFiber.pp;
122
+ rootFiber.dy = false;
114
123
  } finally {
115
124
  currentRoot = null;
116
125
  }
117
126
  runEffects(root);
118
127
  }
119
128
  function rerenderFiber(fiber, root) {
120
- if (!fiber.dirty) return;
121
- if (fiber.unmounted) return;
122
- fiber.dirty = false;
129
+ if (!fiber.dy) return;
130
+ if (fiber.um) return;
131
+ fiber.dy = false;
123
132
  currentRoot = root;
124
- const resumeHydration = fiber.memoizedState && fiber.memoizedState._pendingHydration === true;
125
- const prevHydrating = root.hydrating;
133
+ const resumeHydration = fiber.ms && fiber.ms.p === true;
134
+ const prevHydrating = root.h;
126
135
  if (resumeHydration) {
127
- delete fiber.memoizedState._pendingHydration;
128
- root.hydrating = true;
136
+ delete fiber.ms.p;
137
+ root.h = true;
129
138
  }
130
139
  const prevForcing = forceRerenderingFiber;
131
140
  forceRerenderingFiber = fiber;
@@ -134,7 +143,7 @@ function rerenderFiber(fiber, root) {
134
143
  } finally {
135
144
  forceRerenderingFiber = prevForcing;
136
145
  if (resumeHydration) {
137
- root.hydrating = prevHydrating;
146
+ root.h = prevHydrating;
138
147
  clearHydrationCursor(fiber);
139
148
  }
140
149
  currentRoot = null;
@@ -182,7 +191,7 @@ function pushChildren(node, out) {
182
191
  }
183
192
  }
184
193
  function isIterable(obj) {
185
- return obj != null && typeof obj !== "string" && typeof obj[Symbol.iterator] === "function";
194
+ return obj != null && typeof obj[Symbol.iterator] == "function";
186
195
  }
187
196
  function sameType(fiber, child) {
188
197
  if (!child) return false;
@@ -196,7 +205,7 @@ function fiberFromChild(child, parent) {
196
205
  if (!child) return createFiber(FiberTag.Fragment, null, null);
197
206
  if (isTextChild(child)) {
198
207
  const f2 = createFiber(FiberTag.Text, null, null);
199
- f2.pendingProps = child;
208
+ f2.pp = child;
200
209
  f2.parent = parent;
201
210
  return f2;
202
211
  }
@@ -213,18 +222,18 @@ function fiberFromChild(child, parent) {
213
222
  if (matched !== null) break;
214
223
  }
215
224
  if (matched !== null) tag = matched;
216
- else if (typeof type === "function") {
225
+ else if (typeof type == "function") {
217
226
  tag = type.prototype && type.prototype.isReactComponent ? FiberTag.Class : FiberTag.Function;
218
227
  }
219
228
  }
220
229
  const f = createFiber(tag, type, child.key ?? null);
221
230
  f.ref = child.ref ?? null;
222
- f.pendingProps = child.props;
231
+ f.pp = child.props;
223
232
  f.parent = parent;
224
233
  return f;
225
234
  }
226
235
  function reconcileChildren(parent, newChildren, domParent, anchor) {
227
- if (!currentRoot?.hydrating) {
236
+ if (!currentRoot?.h) {
228
237
  let f = parent.child;
229
238
  let ok = true;
230
239
  for (let i = 0; i < newChildren.length; i++) {
@@ -238,7 +247,7 @@ function reconcileChildren(parent, newChildren, domParent, anchor) {
238
247
  ok = false;
239
248
  break;
240
249
  }
241
- f.pendingProps = child;
250
+ f.pp = child;
242
251
  } else {
243
252
  if (child.key != null) {
244
253
  ok = false;
@@ -248,7 +257,7 @@ function reconcileChildren(parent, newChildren, domParent, anchor) {
248
257
  ok = false;
249
258
  break;
250
259
  }
251
- f.pendingProps = child.props;
260
+ f.pp = child.props;
252
261
  f.ref = child.ref ?? null;
253
262
  }
254
263
  f = f.sibling;
@@ -319,10 +328,10 @@ function reconcileChildren(parent, newChildren, domParent, anchor) {
319
328
  claimed.add(match);
320
329
  fiber = match;
321
330
  if (isTextChild(child)) {
322
- fiber.pendingProps = child;
331
+ fiber.pp = child;
323
332
  } else {
324
333
  fiber.type = child.type;
325
- fiber.pendingProps = child.props;
334
+ fiber.pp = child.props;
326
335
  fiber.ref = child.ref ?? null;
327
336
  }
328
337
  } else {
@@ -336,7 +345,7 @@ function reconcileChildren(parent, newChildren, domParent, anchor) {
336
345
  else parent.child = fiber;
337
346
  prevNewFiber = fiber;
338
347
  }
339
- const hydrating = !!currentRoot?.hydrating;
348
+ const hydrating = !!currentRoot?.h;
340
349
  for (let f = parent.child; f; f = f.sibling) {
341
350
  let a = anchor;
342
351
  if (!hydrating) {
@@ -367,8 +376,8 @@ function reconcileChildren(parent, newChildren, domParent, anchor) {
367
376
  }
368
377
  }
369
378
  }
370
- const parentIsHead = domParent.nodeType === 1 && domParent.tagName.toLowerCase() === "head";
371
- if (structurallyChanged && !currentRoot?.hydrating && !parentIsHead) {
379
+ const parentIsHead = domParent.nodeName === "HEAD";
380
+ if (structurallyChanged && !currentRoot?.h && !parentIsHead) {
372
381
  placeChildrenInOrder(parent, domParent, anchor);
373
382
  }
374
383
  }
@@ -466,10 +475,10 @@ function renderFiber(fiber, domParent, anchor) {
466
475
  if (fn) fn(fiber, domParent, anchor);
467
476
  }
468
477
  function renderText(fiber, domParent, anchor) {
469
- const text = fiber.pendingProps;
470
- if (fiber.dom && fiber.memoizedProps === text) return;
478
+ const text = fiber.pp;
479
+ if (fiber.dom && fiber.mp === text) return;
471
480
  if (!fiber.dom) {
472
- const hydrated = currentRoot?.hydrating ? adoptTextDom(fiber, fiber.parent, text) : false;
481
+ const hydrated = currentRoot?.h ? adoptTextDom(fiber, fiber.parent, text) : false;
473
482
  if (!hydrated) {
474
483
  fiber.dom = document.createTextNode(text);
475
484
  insertInto(domParent, fiber.dom, anchor);
@@ -478,17 +487,17 @@ function renderText(fiber, domParent, anchor) {
478
487
  ;
479
488
  fiber.dom.data = text;
480
489
  }
481
- fiber.memoizedProps = text;
490
+ fiber.mp = text;
482
491
  }
483
492
  function renderHost(fiber, domParent, anchor) {
484
- const props = fiber.pendingProps ?? {};
485
- const prev = fiber.memoizedProps ?? {};
493
+ const props = fiber.pp ?? {};
494
+ const prev = fiber.mp ?? {};
486
495
  const type = fiber.type;
487
496
  const isSvg = type === "svg" || domParent.namespaceURI === "http://www.w3.org/2000/svg";
488
497
  const isSelect = type === "select";
489
498
  const deferredSelectValue = isSelect && (props.value !== void 0 || props.defaultValue !== void 0) ? props.value !== void 0 ? props.value : props.defaultValue : void 0;
490
499
  if (!fiber.dom) {
491
- const hydrated = currentRoot?.hydrating ? adoptHostDom(fiber, fiber.parent) : false;
500
+ const hydrated = currentRoot?.h ? adoptHostDom(fiber, fiber.parent) : false;
492
501
  if (!hydrated) {
493
502
  fiber.dom = createHostNode(type, isSvg);
494
503
  for (const k in props) {
@@ -529,21 +538,18 @@ function renderHost(fiber, domParent, anchor) {
529
538
  syncRefIfChanged(fiber, fiber.dom);
530
539
  }
531
540
  reconcileChildren(fiber, childrenToArray(props.children), fiber.dom, null);
532
- if (currentRoot?.hydrating) {
541
+ if (currentRoot?.h) {
533
542
  const parentTag = fiber.type.toLowerCase();
534
- if (parentTag !== "head" && parentTag !== "html") {
543
+ const hasOpaqueHydrationChildren = props.dangerouslySetInnerHTML != null || parentTag === "textarea" && (props.value != null || props.defaultValue != null);
544
+ if (parentTag !== "head" && parentTag !== "html" && !hasOpaqueHydrationChildren) {
535
545
  const cursor = getHydrationCursor(fiber);
536
546
  if (cursor) {
537
- const leftover = cursor.remaining().filter(
538
- (n) => n.nodeType === 1 || n.nodeType === 3
539
- );
540
- if (leftover.length > 0 && currentRoot.onRecoverableError) {
541
- currentRoot.onRecoverableError(
542
- new Error(
543
- `Hydration mismatch: server rendered ${leftover.length} extra ${leftover.length === 1 ? "node" : "nodes"} inside <${parentTag}> that the client tree did not.`
544
- )
547
+ if (cursor.has()) {
548
+ const error = new Error(
549
+ true ? `Hydration mismatch: server rendered extra nodes inside <${parentTag}>.` : "Hydration mismatch."
545
550
  );
546
- for (const n of leftover) n.parentNode?.removeChild(n);
551
+ if (currentRoot.re) currentRoot.re(error);
552
+ abortHydration(error, fiber);
547
553
  }
548
554
  }
549
555
  }
@@ -559,47 +565,24 @@ function renderHost(fiber, domParent, anchor) {
559
565
  select.value = "" + deferredSelectValue;
560
566
  }
561
567
  }
562
- fiber.memoizedProps = props;
568
+ fiber.mp = props;
563
569
  }
564
570
  function renderFunction(fiber, domParent, anchor) {
565
571
  const prevDispatcher = ReactSharedInternals.H;
566
- const prevFiber = ReactSharedInternals.currentFiber;
567
- const prevHook = ReactSharedInternals.currentHook;
568
- const prevIndex = ReactSharedInternals.hookIndex;
572
+ const prevFiber = ReactSharedInternals.F;
573
+ const prevHook = ReactSharedInternals.K;
574
+ const prevIndex = ReactSharedInternals.I;
569
575
  ReactSharedInternals.H = makeDispatcher();
570
- ReactSharedInternals.currentFiber = fiber;
571
- ReactSharedInternals.currentHook = null;
572
- ReactSharedInternals.hookIndex = 0;
576
+ ReactSharedInternals.F = fiber;
577
+ ReactSharedInternals.K = null;
578
+ ReactSharedInternals.I = 0;
573
579
  let rendered;
574
580
  let deferredForHydration = false;
575
581
  try {
576
- rendered = fiber.type(fiber.pendingProps ?? {});
582
+ rendered = fiber.type(fiber.pp ?? {});
577
583
  } catch (e) {
578
584
  if (isThenable(e)) {
579
- if (currentRoot?.hydrating) {
580
- const hostParent = findHydrationHost(fiber);
581
- const inheritedCursor = getHydrationCursor(hostParent);
582
- if (inheritedCursor) {
583
- setHydrationCursor(fiber, inheritedCursor);
584
- }
585
- fiber.memoizedState = {
586
- ...fiber.memoizedState ?? {},
587
- _pendingHydration: true
588
- };
589
- let sus = fiber.parent;
590
- while (sus && sus.tag !== FiberTag.Suspense) sus = sus.parent;
591
- if (sus && sus.memoizedState) {
592
- ;
593
- sus.memoizedState._awaitingLazyHydration = true;
594
- }
595
- const clearAwait = () => {
596
- if (sus && sus.memoizedState) {
597
- ;
598
- sus.memoizedState._awaitingLazyHydration = false;
599
- }
600
- scheduleUpdate(fiber);
601
- };
602
- e.then(clearAwait, clearAwait);
585
+ if (deferHydration(fiber, e)) {
603
586
  deferredForHydration = true;
604
587
  } else {
605
588
  CAPABILITIES.handleSuspended(fiber, e);
@@ -611,18 +594,40 @@ function renderFunction(fiber, domParent, anchor) {
611
594
  }
612
595
  } finally {
613
596
  ReactSharedInternals.H = prevDispatcher;
614
- ReactSharedInternals.currentFiber = prevFiber;
615
- ReactSharedInternals.currentHook = prevHook;
616
- ReactSharedInternals.hookIndex = prevIndex;
597
+ ReactSharedInternals.F = prevFiber;
598
+ ReactSharedInternals.K = prevHook;
599
+ ReactSharedInternals.I = prevIndex;
617
600
  }
618
601
  if (deferredForHydration) return;
619
602
  reconcileChildren(fiber, childrenToArray(rendered), domParent, anchor);
620
- fiber.memoizedProps = fiber.pendingProps;
603
+ fiber.mp = fiber.pp;
604
+ }
605
+ function deferHydration(fiber, thenable) {
606
+ if (!currentRoot?.h) return false;
607
+ const hostParent = findHydrationHost(fiber);
608
+ const inheritedCursor = getHydrationCursor(hostParent);
609
+ if (inheritedCursor) setHydrationCursor(fiber, inheritedCursor);
610
+ (fiber.ms ??= {}).p = true;
611
+ let sus = fiber.parent;
612
+ while (sus && sus.tag !== FiberTag.Suspense) sus = sus.parent;
613
+ if (sus && sus.ms) {
614
+ ;
615
+ sus.ms.a = true;
616
+ }
617
+ const clearAwait = () => {
618
+ if (sus && sus.ms) {
619
+ ;
620
+ sus.ms.a = false;
621
+ }
622
+ scheduleUpdate(fiber);
623
+ };
624
+ thenable.then(clearAwait, clearAwait);
625
+ return true;
621
626
  }
622
627
  function renderFragment(fiber, domParent, anchor) {
623
- const props = fiber.pendingProps ?? {};
628
+ const props = fiber.pp ?? {};
624
629
  reconcileChildren(fiber, childrenToArray(props.children), domParent, anchor);
625
- fiber.memoizedProps = props;
630
+ fiber.mp = props;
626
631
  }
627
632
  function defaultHandleSuspended(fiber, thenable) {
628
633
  thenable.then(
@@ -641,11 +646,14 @@ function handleSuspended(fiber, thenable) {
641
646
  CAPABILITIES.handleSuspended(fiber, thenable);
642
647
  }
643
648
  function handleErrorInRender(fiber, err) {
649
+ if (currentRoot?.h) {
650
+ abortHydration(err, fiber);
651
+ }
644
652
  let f = fiber.parent;
645
653
  while (f) {
646
654
  if (f.tag === FiberTag.Class) {
647
655
  const Ctor = f.type;
648
- const instance = f.stateNode;
656
+ const instance = f.sn;
649
657
  if (Ctor.getDerivedStateFromError) {
650
658
  const update = Ctor.getDerivedStateFromError(err);
651
659
  instance.state = { ...instance.state, ...update };
@@ -661,14 +669,14 @@ function handleErrorInRender(fiber, err) {
661
669
  }
662
670
  f = f.parent;
663
671
  }
664
- if (currentRoot?.onUncaughtError) currentRoot.onUncaughtError(err);
672
+ if (currentRoot?.ue) currentRoot.ue(err);
665
673
  else throw err;
666
674
  }
667
675
  function isThenable(x) {
668
- return x != null && typeof x.then === "function";
676
+ return x != null && typeof x.then == "function";
669
677
  }
670
678
  function unmountFiber(fiber, domParent) {
671
- fiber.unmounted = true;
679
+ fiber.um = true;
672
680
  let c = fiber.child;
673
681
  while (c) {
674
682
  const next = c.sibling;
@@ -676,25 +684,25 @@ function unmountFiber(fiber, domParent) {
676
684
  c = next;
677
685
  }
678
686
  fiber.child = null;
679
- if (fiber.cleanups) {
680
- for (const cleanup of fiber.cleanups) {
687
+ if (fiber.cu) {
688
+ for (const cleanup of fiber.cu) {
681
689
  try {
682
690
  cleanup();
683
691
  } catch (e) {
684
- if (currentRoot?.onRecoverableError) currentRoot.onRecoverableError(e);
692
+ if (currentRoot?.re) currentRoot.re(e);
685
693
  }
686
694
  }
687
- fiber.cleanups = null;
695
+ fiber.cu = null;
688
696
  }
689
- if (fiber.tag === FiberTag.Class && fiber.stateNode?.componentWillUnmount) {
697
+ if (fiber.tag === FiberTag.Class && fiber.sn?.componentWillUnmount) {
690
698
  try {
691
- fiber.stateNode.componentWillUnmount();
699
+ fiber.sn.componentWillUnmount();
692
700
  } catch (e) {
693
- if (currentRoot?.onRecoverableError) currentRoot.onRecoverableError(e);
701
+ if (currentRoot?.re) currentRoot.re(e);
694
702
  }
695
- fiber.stateNode._fiber = null;
696
- fiber.stateNode._enqueueUpdate = null;
697
- fiber.stateNode._forceUpdate = null;
703
+ fiber.sn._fiber = null;
704
+ fiber.sn._enqueueUpdate = null;
705
+ fiber.sn._forceUpdate = null;
698
706
  }
699
707
  if (fiber.ref) detachRef(fiber.ref);
700
708
  if (fiber.tag === FiberTag.Host && fiber.dom && fiber.dom.parentNode) {
@@ -736,14 +744,17 @@ function getHostParent(fiber) {
736
744
  while (p) {
737
745
  if (p.tag === FiberTag.Host) return p.dom;
738
746
  if (p.tag === FiberTag.Root)
739
- return p.stateNode || p.dom || p.root?.container;
747
+ return p.sn || p.dom || p.root?.c;
740
748
  if (p.tag === FiberTag.Portal) {
741
- const props = p.pendingProps ?? p.memoizedProps;
742
- return props?.container || p.stateNode || p.dom || p.root?.container;
749
+ const props = p.pp ?? p.mp;
750
+ return props?.container || p.sn || p.dom || p.root?.c;
743
751
  }
744
752
  p = p.parent;
745
753
  }
746
- throw new Error("No host parent found.");
754
+ if (true) {
755
+ throw new Error("No host parent found.");
756
+ }
757
+ throw new Error();
747
758
  }
748
759
  function getAnchor(fiber) {
749
760
  let f = fiber.sibling;
@@ -779,20 +790,20 @@ function defaultReadContext(_fiber, ctx) {
779
790
  return ctx._currentValue;
780
791
  }
781
792
  function attachRef(fiber, value) {
782
- const ref = fiber.ref ?? (fiber.pendingProps?.ref ?? null);
793
+ const ref = fiber.ref ?? (fiber.pp?.ref ?? null);
783
794
  if (!ref) return;
784
- if (typeof ref === "function") {
795
+ if (typeof ref == "function") {
785
796
  scheduleLifecycle(fiber, () => {
786
797
  const cleanup = ref(value);
787
- fiber.cleanups ||= [];
788
- fiber.cleanups.push(typeof cleanup === "function" ? cleanup : () => ref(null));
798
+ fiber.cu ||= [];
799
+ fiber.cu.push(typeof cleanup == "function" ? cleanup : () => ref(null));
789
800
  });
790
801
  } else {
791
802
  ref.current = value;
792
803
  }
793
804
  }
794
805
  function syncRefIfChanged(fiber, value) {
795
- const ref = fiber.ref ?? (fiber.pendingProps?.ref ?? null);
806
+ const ref = fiber.ref ?? (fiber.pp?.ref ?? null);
796
807
  if (!ref) return;
797
808
  if (typeof ref === "object" && ref.current !== value) ref.current = value;
798
809
  }
@@ -805,45 +816,44 @@ var pendingEffects = [];
805
816
  var pendingLayoutEffects = [];
806
817
  var pendingLifecycles = [];
807
818
  function enqueueEffect(fiber, effect) {
808
- if (effect.tag === "layout" || effect.tag === "insertion") {
809
- pendingLayoutEffects.push({ fiber, effect });
819
+ if (effect.t) {
820
+ pendingLayoutEffects.push([fiber, effect]);
810
821
  } else {
811
- pendingEffects.push({ fiber, effect });
822
+ pendingEffects.push([fiber, effect]);
812
823
  }
813
824
  }
814
- function scheduleLifecycle(fiber, fn) {
815
- pendingLifecycles.push({ fiber, fn });
825
+ function scheduleLifecycle(_fiber, fn) {
826
+ pendingLifecycles.push(fn);
816
827
  }
817
828
  function runEffects(root) {
818
829
  while (pendingLayoutEffects.length) {
819
- const { fiber, effect } = pendingLayoutEffects.shift();
830
+ const [fiber, effect] = pendingLayoutEffects.shift();
820
831
  runEffect(fiber, effect, root);
821
832
  }
822
833
  while (pendingLifecycles.length) {
823
- const { fn } = pendingLifecycles.shift();
834
+ const fn = pendingLifecycles.shift();
824
835
  try {
825
836
  fn();
826
837
  } catch (e) {
827
- if (root.onCaughtError) root.onCaughtError(e);
838
+ if (root.ce) root.ce(e);
828
839
  }
829
840
  }
830
841
  if (pendingEffects.length) {
831
842
  const batch = pendingEffects.splice(0);
832
843
  queueMicrotask(() => {
833
- for (const { fiber, effect } of batch) runEffect(fiber, effect, root);
844
+ for (const [fiber, effect] of batch) runEffect(fiber, effect, root);
834
845
  });
835
846
  }
836
847
  }
837
848
  function runEffect(fiber, effect, root) {
838
849
  try {
839
- const cleanup = effect.create();
840
- effect.destroy = typeof cleanup === "function" ? cleanup : void 0;
841
- if (effect.destroy) {
842
- fiber.cleanups ||= [];
843
- fiber.cleanups.push(effect.destroy);
850
+ const cleanup = effect.c();
851
+ if (typeof cleanup == "function") {
852
+ fiber.cu ||= [];
853
+ fiber.cu.push(cleanup);
844
854
  }
845
855
  } catch (e) {
846
- if (root.onCaughtError) root.onCaughtError(e);
856
+ if (root.ce) root.ce(e);
847
857
  }
848
858
  }
849
859
  function isEventProp(name) {
@@ -852,6 +862,8 @@ function isEventProp(name) {
852
862
  export {
853
863
  batchedUpdates,
854
864
  childrenToArray,
865
+ deferHydration,
866
+ discardPendingWork,
855
867
  enqueueEffect,
856
868
  findRoot,
857
869
  flushSyncWork,