// @ts-ignore
import { c as _c } from "react/compiler-runtime";
import React, {
Activity,
createContext,
forwardRef,
memo,
Profiler,
StrictMode,
use,
useCallback,
useEffect,
useId,
useMemo,
useReducer,
useRef,
useState,
type ErrorInfo,
type JSX,
type PropsWithChildren,
type ReactNode,
} from "react";
// @ts-ignore
import { createRoot as createRootDev } from "./dist/index.development.js";
// @ts-ignore
import { createRoot as createRootProd } from "./dist/index.production.js";
import type { createRoot as createRootType } from "./src/index.ts";
import { renderToStaticMarkup } from "react-dom/server";
import { Fragment } from "react";
import { domHost } from "./src/dom.ts";
import confetti from "canvas-confetti";
import { jsx } from "react/jsx-runtime";
// A simple wrapper component to test deleting components that contain host nodes
function Box({ id, children }: { id: string; children?: ReactNode }) {
return (
// @ts-ignore
{children}
);
}
function App({ step }: { step: number }) {
const phase = step % 5;
let items: ReactNode[] = [];
// 1. Falsy Key Test: React allows `0` as a valid key.
// If your reconciler uses `if (key)`, this will break.
items.push(
Falsy Key (0)
,
);
if (phase !== 1) {
// 2. Removal Test: Removed entirely on phase 1.
// This tests if the reconciler recursively deletes the
inside the Box component.
items.push(
Key A
,
);
}
if (phase === 2) {
// 3. Positioning Test: Moved to the front on phase 2.
// This forces the reconciler to calculate `getNextHostSibling` correctly
// when moving an element to the very beginning of the list.
items.unshift(
Key C (Moved to front)
,
);
} else {
items.push(
Key C
,
);
}
// Always render B so we have at least one stable node in the middle
items.push(
Key B
,
);
// 4. Fragment Test: Tests inserting and removing fragments on phase 3.
// Fragments don't have host nodes, so inserting nodes before/after them
// is the ultimate test for your `#getNextHostSibling` traversal.
if (phase === 3) {
items.push(
Fragment Child 1
Fragment Child 2
,
);
}
// 5. Unkeyed Removal Test: On phase 4, add unkeyed items.
// On phase 0, they are removed. This tests the `oldUnkeyed.pop()` deletion logic.
if (phase === 4) {
items.push(