UNPKG

@donverduyn/react-runtime

Version:
24 lines (23 loc) 1.13 kB
import * as React from 'react'; import type { DeclarationId, RegisterId, RuntimeContext, ScopeId } from '@/types'; import { type RootOpts } from '@/utils/dom'; import type { EdgeDataFields } from '@/utils/hash'; import type { PropService } from 'utils/effect'; import { type DryRunTracker } from '../hooks/useDryRunTracker'; import type { DryRunCandidate, DryRunCandidateAncestor } from './DryRunCandidate'; export type DryRunApi = { getOffTreeData(rootModules: Set<RuntimeContext<any, never, PropService>>): readonly [ Map<RegisterId, DryRunCandidateAncestor>, DryRunCandidate, boolean ]; promoteByRoot(self: EdgeDataFields): void; getRootAncestors(): DryRunCandidateAncestor[]; getRoot(): DryRunCandidateAncestor; }; export declare const createDryRunApi: (tracker: DryRunTracker) => DryRunApi; export declare function createReactDryRunRoot(opts: RootOpts): { render: (children: React.ReactNode) => void; unmount(): void; }; export declare function createDryRunFactory<P extends object>(scopeId: ScopeId, Component: React.FC<P>, props: P, declarationId: DeclarationId): DryRunApi;