1 | import * as _hooks from '../../hooks';
|
2 | import * as preact from '../../src';
|
3 | import { JSXInternal } from '../../src/jsx';
|
4 | import * as _Suspense from './suspense';
|
5 | import * as _SuspenseList from './suspense-list';
|
6 |
|
7 |
|
8 | export = React;
|
9 | export as namespace React;
|
10 | declare namespace React {
|
11 |
|
12 | export import JSX = JSXInternal;
|
13 |
|
14 |
|
15 | export import CreateHandle = _hooks.CreateHandle;
|
16 | export import EffectCallback = _hooks.EffectCallback;
|
17 | export import Inputs = _hooks.Inputs;
|
18 | export import PropRef = _hooks.PropRef;
|
19 | export import Reducer = _hooks.Reducer;
|
20 | export import Ref = _hooks.Ref;
|
21 | export import StateUpdater = _hooks.StateUpdater;
|
22 | export import useCallback = _hooks.useCallback;
|
23 | export import useContext = _hooks.useContext;
|
24 | export import useDebugValue = _hooks.useDebugValue;
|
25 | export import useEffect = _hooks.useEffect;
|
26 | export import useImperativeHandle = _hooks.useImperativeHandle;
|
27 | export import useId = _hooks.useId;
|
28 | export import useLayoutEffect = _hooks.useLayoutEffect;
|
29 | export import useMemo = _hooks.useMemo;
|
30 | export import useReducer = _hooks.useReducer;
|
31 | export import useRef = _hooks.useRef;
|
32 | export import useState = _hooks.useState;
|
33 |
|
34 | export import useInsertionEffect = _hooks.useLayoutEffect;
|
35 | export function useTransition(): [false, typeof startTransition];
|
36 | export function useDeferredValue<T = any>(val: T): T;
|
37 | export function useSyncExternalStore<T>(
|
38 | subscribe: (flush: () => void) => () => void,
|
39 | getSnapshot: () => T
|
40 | ): T;
|
41 |
|
42 |
|
43 | export import ContextType = preact.ContextType;
|
44 | export import RefObject = preact.RefObject;
|
45 | export import Component = preact.Component;
|
46 | export import FunctionComponent = preact.FunctionComponent;
|
47 | export import FC = preact.FunctionComponent;
|
48 | export import createContext = preact.createContext;
|
49 | export import createRef = preact.createRef;
|
50 | export import Fragment = preact.Fragment;
|
51 | export import createElement = preact.createElement;
|
52 | export import cloneElement = preact.cloneElement;
|
53 | export import ComponentProps = preact.ComponentProps;
|
54 |
|
55 |
|
56 | export import Suspense = _Suspense.Suspense;
|
57 | export import lazy = _Suspense.lazy;
|
58 | export import SuspenseList = _SuspenseList.SuspenseList;
|
59 |
|
60 |
|
61 | export import StrictMode = preact.Fragment;
|
62 | export const version: string;
|
63 | export function startTransition(cb: () => void): void;
|
64 |
|
65 |
|
66 | export import HTMLAttributes = JSXInternal.HTMLAttributes;
|
67 | export import DetailedHTMLProps = JSXInternal.DetailedHTMLProps;
|
68 | export import CSSProperties = JSXInternal.CSSProperties;
|
69 |
|
70 |
|
71 | export import TargetedEvent = JSXInternal.TargetedEvent;
|
72 | export import ChangeEvent = JSXInternal.TargetedEvent;
|
73 | export import ChangeEventHandler = JSXInternal.GenericEventHandler;
|
74 |
|
75 | export function createPortal(
|
76 | vnode: preact.VNode,
|
77 | container: Element
|
78 | ): preact.VNode<any>;
|
79 |
|
80 | export function render(
|
81 | vnode: preact.VNode<any>,
|
82 | parent: Element,
|
83 | callback?: () => void
|
84 | ): Component | null;
|
85 |
|
86 | export function hydrate(
|
87 | vnode: preact.VNode<any>,
|
88 | parent: Element,
|
89 | callback?: () => void
|
90 | ): Component | null;
|
91 |
|
92 | export function unmountComponentAtNode(
|
93 | container: Element | Document | ShadowRoot | DocumentFragment
|
94 | ): boolean;
|
95 |
|
96 | export function createFactory(
|
97 | type: preact.VNode<any>['type']
|
98 | ): (
|
99 | props?: any,
|
100 | ...children: preact.ComponentChildren[]
|
101 | ) => preact.VNode<any>;
|
102 | export function isValidElement(element: any): boolean;
|
103 | export function findDOMNode(
|
104 | component: preact.Component | Element
|
105 | ): Element | null;
|
106 |
|
107 | export abstract class PureComponent<P = {}, S = {}> extends preact.Component<
|
108 | P,
|
109 | S
|
110 | > {
|
111 | isPureReactComponent: boolean;
|
112 | }
|
113 |
|
114 | export function memo<P = {}>(
|
115 | component: preact.FunctionalComponent<P>,
|
116 | comparer?: (prev: P, next: P) => boolean
|
117 | ): preact.FunctionComponent<P>;
|
118 | export function memo<C extends preact.FunctionalComponent<any>>(
|
119 | component: C,
|
120 | comparer?: (
|
121 | prev: preact.ComponentProps<C>,
|
122 | next: preact.ComponentProps<C>
|
123 | ) => boolean
|
124 | ): C;
|
125 |
|
126 | export interface ForwardFn<P = {}, T = any> {
|
127 | (props: P, ref: ForwardedRef<T>): preact.ComponentChild;
|
128 | displayName?: string;
|
129 | }
|
130 |
|
131 | export function forwardRef<R, P = {}>(
|
132 | fn: ForwardFn<P, R>
|
133 | ): preact.FunctionalComponent<Omit<P, 'ref'> & { ref?: preact.Ref<R> }>;
|
134 |
|
135 | interface MutableRefObject<T> {
|
136 | current: T;
|
137 | }
|
138 |
|
139 | export type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null;
|
140 |
|
141 | export function unstable_batchedUpdates(
|
142 | callback: (arg?: any) => void,
|
143 | arg?: any
|
144 | ): void;
|
145 |
|
146 | export type PropsWithChildren<P = unknown> = P & {
|
147 | children?: preact.ComponentChild | undefined
|
148 | };
|
149 |
|
150 | export const Children: {
|
151 | map<T extends preact.ComponentChild, R>(
|
152 | children: T | T[],
|
153 | fn: (child: T, i: number) => R
|
154 | ): R[];
|
155 | forEach<T extends preact.ComponentChild>(
|
156 | children: T | T[],
|
157 | fn: (child: T, i: number) => void
|
158 | ): void;
|
159 | count: (children: preact.ComponentChildren) => number;
|
160 | only: (children: preact.ComponentChildren) => preact.ComponentChild;
|
161 | toArray: (children: preact.ComponentChildren) => preact.VNode<{}>[];
|
162 | };
|
163 |
|
164 |
|
165 | export const unstable_ImmediatePriority: number;
|
166 | export const unstable_UserBlockingPriority: number;
|
167 | export const unstable_NormalPriority: number;
|
168 | export const unstable_LowPriority: number;
|
169 | export const unstable_IdlePriority: number;
|
170 | export function unstable_runWithPriority(
|
171 | priority: number,
|
172 | callback: () => void
|
173 | ): void;
|
174 | export const unstable_now: () => number;
|
175 | }
|