update reconciler

This commit is contained in:
itsMapleLeaf
2022-07-23 13:49:56 -05:00
committed by Darius
parent bab134d697
commit b275d9b330
2 changed files with 23 additions and 4 deletions

View File

@@ -47,7 +47,19 @@ export abstract class Reacord {
this.renderers.push(renderer) this.renderers.push(renderer)
const container = reconciler.createContainer(renderer, 0, false, {}) const container = reconciler.createContainer(
renderer,
0,
// eslint-disable-next-line unicorn/no-null
null,
false,
// eslint-disable-next-line unicorn/no-null
null,
"reacord",
() => {},
// eslint-disable-next-line unicorn/no-null
null,
)
const instance: ReacordInstance = { const instance: ReacordInstance = {
render: (content: ReactNode) => { render: (content: ReactNode) => {

View File

@@ -1,5 +1,6 @@
import type { HostConfig } from "react-reconciler" import type { HostConfig } from "react-reconciler"
import ReactReconciler from "react-reconciler" import ReactReconciler from "react-reconciler"
import { DefaultEventPriority } from "react-reconciler/constants"
import { raise } from "../../helpers/raise.js" import { raise } from "../../helpers/raise.js"
import { Node } from "./node.js" import { Node } from "./node.js"
import type { Renderer } from "./renderers/renderer" import type { Renderer } from "./renderers/renderer"
@@ -20,8 +21,6 @@ const config: HostConfig<
number, // TimeoutHandle, number, // TimeoutHandle,
number // NoTimeout, number // NoTimeout,
> = { > = {
// config
now: Date.now,
supportsMutation: true, supportsMutation: true,
supportsPersistence: false, supportsPersistence: false,
supportsHydration: false, supportsHydration: false,
@@ -52,8 +51,13 @@ const config: HostConfig<
}, },
createTextInstance: (text) => new TextNode(text), createTextInstance: (text) => new TextNode(text),
shouldSetTextContent: () => false, shouldSetTextContent: () => false,
// @ts-expect-error
detachDeletedInstance: (instance) => {}, detachDeletedInstance: (instance) => {},
beforeActiveInstanceBlur: () => {},
afterActiveInstanceBlur: () => {},
// eslint-disable-next-line unicorn/no-null
getInstanceFromNode: (node: any) => null,
// eslint-disable-next-line unicorn/no-null
getInstanceFromScope: (scopeInstance: any) => null,
clearContainer: (renderer) => { clearContainer: (renderer) => {
renderer.nodes.clear() renderer.nodes.clear()
@@ -94,11 +98,14 @@ const config: HostConfig<
resetAfterCommit: (renderer) => { resetAfterCommit: (renderer) => {
renderer.render() renderer.render()
}, },
prepareScopeUpdate: (scopeInstance: any, instance: any) => {},
preparePortalMount: () => raise("Portals are not supported"), preparePortalMount: () => raise("Portals are not supported"),
getPublicInstance: () => raise("Refs are currently not supported"), getPublicInstance: () => raise("Refs are currently not supported"),
finalizeInitialChildren: () => false, finalizeInitialChildren: () => false,
getCurrentEventPriority: () => DefaultEventPriority,
} }
export const reconciler = ReactReconciler(config) export const reconciler = ReactReconciler(config)