1 | import { Component, ReactNode } from "react";
|
2 |
|
3 |
|
4 | declare function ReactReconciler<
|
5 | Type,
|
6 | Props,
|
7 | Container,
|
8 | Instance,
|
9 | TextInstance,
|
10 | SuspenseInstance,
|
11 | HydratableInstance,
|
12 | PublicInstance,
|
13 | HostContext,
|
14 | UpdatePayload,
|
15 | ChildSet,
|
16 | TimeoutHandle,
|
17 | NoTimeout,
|
18 | >(
|
19 |
|
20 | config: ReactReconciler.HostConfig<
|
21 | Type,
|
22 | Props,
|
23 | Container,
|
24 | Instance,
|
25 | TextInstance,
|
26 | SuspenseInstance,
|
27 | HydratableInstance,
|
28 | PublicInstance,
|
29 | HostContext,
|
30 | UpdatePayload,
|
31 | ChildSet,
|
32 | TimeoutHandle,
|
33 | NoTimeout
|
34 | >,
|
35 | ): ReactReconciler.Reconciler<Container, Instance, TextInstance, SuspenseInstance, PublicInstance>;
|
36 |
|
37 | declare namespace ReactReconciler {
|
38 | interface HostConfig<
|
39 | Type,
|
40 | Props,
|
41 | Container,
|
42 | Instance,
|
43 | TextInstance,
|
44 | SuspenseInstance,
|
45 | HydratableInstance,
|
46 | PublicInstance,
|
47 | HostContext,
|
48 | UpdatePayload,
|
49 | ChildSet,
|
50 | TimeoutHandle,
|
51 | NoTimeout,
|
52 | > {
|
53 |
|
54 |
|
55 |
|
56 | |
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | supportsMutation: boolean;
|
74 |
|
75 | |
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | supportsPersistence: boolean;
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 | |
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | createInstance(
|
110 | type: Type,
|
111 | props: Props,
|
112 | rootContainer: Container,
|
113 | hostContext: HostContext,
|
114 | internalHandle: OpaqueHandle,
|
115 | ): Instance;
|
116 |
|
117 | |
118 |
|
119 |
|
120 | createTextInstance(
|
121 | text: string,
|
122 | rootContainer: Container,
|
123 | hostContext: HostContext,
|
124 | internalHandle: OpaqueHandle,
|
125 | ): TextInstance;
|
126 |
|
127 | |
128 |
|
129 |
|
130 |
|
131 |
|
132 | appendInitialChild(parentInstance: Instance, child: Instance | TextInstance): void;
|
133 |
|
134 | |
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 | finalizeInitialChildren(
|
144 | instance: Instance,
|
145 | type: Type,
|
146 | props: Props,
|
147 | rootContainer: Container,
|
148 | hostContext: HostContext,
|
149 | ): boolean;
|
150 |
|
151 | |
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 | prepareUpdate(
|
159 | instance: Instance,
|
160 | type: Type,
|
161 | oldProps: Props,
|
162 | newProps: Props,
|
163 | rootContainer: Container,
|
164 | hostContext: HostContext,
|
165 | ): UpdatePayload | null;
|
166 |
|
167 | |
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 | shouldSetTextContent(type: Type, props: Props): boolean;
|
177 |
|
178 | |
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | getRootHostContext(rootContainer: Container): HostContext | null;
|
186 |
|
187 | |
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 | getChildHostContext(parentHostContext: HostContext, type: Type, rootContainer: Container): HostContext;
|
197 |
|
198 | |
199 |
|
200 |
|
201 |
|
202 |
|
203 | getPublicInstance(instance: Instance | TextInstance): PublicInstance;
|
204 |
|
205 | |
206 |
|
207 |
|
208 |
|
209 |
|
210 | prepareForCommit(containerInfo: Container): Record<string, any> | null;
|
211 |
|
212 | |
213 |
|
214 |
|
215 |
|
216 |
|
217 | resetAfterCommit(containerInfo: Container): void;
|
218 |
|
219 | |
220 |
|
221 |
|
222 | preparePortalMount(containerInfo: Container): void;
|
223 |
|
224 | |
225 |
|
226 |
|
227 | scheduleTimeout(fn: (...args: unknown[]) => unknown, delay?: number): TimeoutHandle;
|
228 |
|
229 | |
230 |
|
231 |
|
232 | cancelTimeout(id: TimeoutHandle): void;
|
233 |
|
234 | |
235 |
|
236 |
|
237 | noTimeout: NoTimeout;
|
238 |
|
239 | |
240 |
|
241 |
|
242 | supportsMicrotasks?: boolean;
|
243 |
|
244 | |
245 |
|
246 |
|
247 | scheduleMicrotask?(fn: () => unknown): void;
|
248 |
|
249 | /**
|
250 | * This is a property (not a function) that should be set to `true` if your renderer is the main one on the page. For example, if you're writing a renderer for the Terminal, it makes sense to set it to `true`, but if your renderer is used *on top of* React DOM or some other existing renderer, set it to `false`.
|
251 | */
|
252 | isPrimaryRenderer: boolean;
|
253 |
|
254 | /**
|
255 | * Whether the renderer shouldn't trigger missing `act()` warnings
|
256 | */
|
257 | warnsIfNotActing?: boolean;
|
258 |
|
259 | /**
|
260 | * To implement this method, you'll need some constants available on the special `react-reconciler/constants` entry point:
|
261 | *
|
262 | * ```
|
263 | * import {
|
264 | * DiscreteEventPriority,
|
265 | * ContinuousEventPriority,
|
266 | * DefaultEventPriority,
|
267 | * } from 'react-reconciler/constants';
|
268 | *
|
269 | * const HostConfig = {
|
270 | * // ...
|
271 | * getCurrentEventPriority() {
|
272 | * return DefaultEventPriority;
|
273 | * },
|
274 | * // ...
|
275 | * }
|
276 | *
|
277 | * const MyRenderer = Reconciler(HostConfig);
|
278 | * ```
|
279 | *
|
280 | * The constant you return depends on which event, if any, is being handled right now. (In the browser, you can check this using `window.event && window.event.type`).
|
281 | *
|
282 | * - **Discrete events**: If the active event is directly caused by the user (such as mouse and keyboard events) and each event in a sequence is intentional (e.g. click), return DiscreteEventPriority. This tells React that they should interrupt any background work and cannot be batched across time.
|
283 | *
|
284 | * - **Continuous events**: If the active event is directly caused by the user but the user can't distinguish between individual events in a sequence (e.g. mouseover), return ContinuousEventPriority. This tells React they should interrupt any background work but can be batched across time.
|
285 | *
|
286 | * - **Other events / No active event**: In all other cases, return DefaultEventPriority. This tells React that this event is considered background work, and interactive events will be prioritized over it.
|
287 | *
|
288 | * You can consult the `getCurrentEventPriority()` implementation in `ReactDOMHostConfig.js` for a reference implementation.
|
289 | */
|
290 | getCurrentEventPriority(): Lane;
|
291 |
|
292 | getInstanceFromNode(node: any): Fiber | null | undefined;
|
293 |
|
294 | beforeActiveInstanceBlur(): void;
|
295 |
|
296 | afterActiveInstanceBlur(): void;
|
297 |
|
298 | prepareScopeUpdate(scopeInstance: any, instance: any): void;
|
299 |
|
300 | getInstanceFromScope(scopeInstance: any): null | Instance;
|
301 |
|
302 | detachDeletedInstance(node: Instance): void;
|
303 |
|
304 | // -------------------
|
305 | // Mutation Methods
|
306 | // (optional)
|
307 | // If you're using React in mutation mode (you probably do), you'll need to implement a few more methods.
|
308 | // -------------------
|
309 |
|
310 | /**
|
311 | * This method should mutate the `parentInstance` and add the child to its list of children. For example, in the DOM this would translate to a `parentInstance.appendChild(child)` call.
|
312 | *
|
313 | * Although this method currently runs in the commit phase, you still should not mutate any other nodes in it. If you need to do some additional work when a node is definitely connected to the visible tree, look at `commitMount`.
|
314 | */
|
315 | appendChild?(parentInstance: Instance, child: Instance | TextInstance): void;
|
316 |
|
317 | /**
|
318 | * Same as `appendChild`, but for when a node is attached to the root container. This is useful if attaching to the root has a slightly different implementation, or if the root container nodes are of a different type than the rest of the tree.
|
319 | */
|
320 | appendChildToContainer?(container: Container, child: Instance | TextInstance): void;
|
321 |
|
322 | /**
|
323 | * This method should mutate the `parentInstance` and place the `child` before `beforeChild` in the list of its children. For example, in the DOM this would translate to a `parentInstance.insertBefore(child, beforeChild)` call.
|
324 | *
|
325 | * Note that React uses this method both for insertions and for reordering nodes. Similar to DOM, it is expected that you can call `insertBefore` to reposition an existing child. Do not mutate any other parts of the tree from it.
|
326 | */
|
327 | insertBefore?(
|
328 | parentInstance: Instance,
|
329 | child: Instance | TextInstance,
|
330 | beforeChild: Instance | TextInstance | SuspenseInstance,
|
331 | ): void;
|
332 |
|
333 | /**
|
334 | * Same as `insertBefore`, but for when a node is attached to the root container. This is useful if attaching to the root has a slightly different implementation, or if the root container nodes are of a different type than the rest of the tree.
|
335 | */
|
336 | insertInContainerBefore?(
|
337 | container: Container,
|
338 | child: Instance | TextInstance,
|
339 | beforeChild: Instance | TextInstance | SuspenseInstance,
|
340 | ): void;
|
341 |
|
342 | /**
|
343 | * This method should mutate the `parentInstance` to remove the `child` from the list of its children.
|
344 | *
|
345 | * React will only call it for the top-level node that is being removed. It is expected that garbage collection would take care of the whole subtree. You are not expected to traverse the child tree in it.
|
346 | */
|
347 | removeChild?(parentInstance: Instance, child: Instance | TextInstance | SuspenseInstance): void;
|
348 |
|
349 | /**
|
350 | * Same as `removeChild`, but for when a node is detached from the root container. This is useful if attaching to the root has a slightly different implementation, or if the root container nodes are of a different type than the rest of the tree.
|
351 | */
|
352 | removeChildFromContainer?(container: Container, child: Instance | TextInstance | SuspenseInstance): void;
|
353 |
|
354 | /**
|
355 | * If you returned `true` from `shouldSetTextContent` for the previous props, but returned `false` from `shouldSetTextContent` for the next props, React will call this method so that you can clear the text content you were managing manually. For example, in the DOM you could set `node.textContent = ''`.
|
356 | *
|
357 | * If you never return `true` from `shouldSetTextContent`, you can leave it empty.
|
358 | */
|
359 | resetTextContent?(instance: Instance): void;
|
360 |
|
361 | /**
|
362 | * This method should mutate the `textInstance` and update its text content to `nextText`.
|
363 | *
|
364 | * Here, `textInstance` is a node created by `createTextInstance`.
|
365 | */
|
366 | commitTextUpdate?(textInstance: TextInstance, oldText: string, newText: string): void;
|
367 |
|
368 | /**
|
369 | * This method is only called if you returned `true` from `finalizeInitialChildren` for this instance.
|
370 | *
|
371 | * It lets you do some additional work after the node is actually attached to the tree on the screen for the first time. For example, the DOM renderer uses it to trigger focus on nodes with the `autoFocus` attribute.
|
372 | *
|
373 | * Note that `commitMount` does not mirror `removeChild` one to one because `removeChild` is only called for the top-level removed node. This is why ideally `commitMount` should not mutate any nodes other than the `instance` itself. For example, if it registers some events on some node above, it will be your responsibility to traverse the tree in `removeChild` and clean them up, which is not ideal.
|
374 | *
|
375 | * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal fields, be aware that it may change significantly between versions. You're taking on additional maintenance risk by reading from it, and giving up all guarantees if you write something to it.
|
376 | *
|
377 | * If you never return `true` from `finalizeInitialChildren`, you can leave it empty.
|
378 | */
|
379 | commitMount?(instance: Instance, type: Type, props: Props, internalInstanceHandle: OpaqueHandle): void;
|
380 |
|
381 | /**
|
382 | * This method should mutate the `instance` according to the set of changes in `updatePayload`. Here, `updatePayload` is the object that you've returned from `prepareUpdate` and has an arbitrary structure that makes sense for your renderer. For example, the DOM renderer returns an update payload like `[prop1, value1, prop2, value2, ...]` from `prepareUpdate`, and that structure gets passed into `commitUpdate`. Ideally, all the diffing and calculation should happen inside `prepareUpdate` so that `commitUpdate` can be fast and straightforward.
|
383 | *
|
384 | * The `internalHandle` data structure is meant to be opaque. If you bend the rules and rely on its internal fields, be aware that it may change significantly between versions. You're taking on additional maintenance risk by reading from it, and giving up all guarantees if you write something to it.
|
385 | */
|
386 | commitUpdate?(
|
387 | instance: Instance,
|
388 | updatePayload: UpdatePayload,
|
389 | type: Type,
|
390 | prevProps: Props,
|
391 | nextProps: Props,
|
392 | internalHandle: OpaqueHandle,
|
393 | ): void;
|
394 |
|
395 | /**
|
396 | * This method should make the `instance` invisible without removing it from the tree. For example, it can apply visual styling to hide it. It is used by Suspense to hide the tree while the fallback is visible.
|
397 | */
|
398 | hideInstance?(instance: Instance): void;
|
399 |
|
400 | /**
|
401 | * Same as `hideInstance`, but for nodes created by `createTextInstance`.
|
402 | */
|
403 | hideTextInstance?(textInstance: TextInstance): void;
|
404 |
|
405 | /**
|
406 | * This method should make the `instance` visible, undoing what `hideInstance` did.
|
407 | */
|
408 | unhideInstance?(instance: Instance, props: Props): void;
|
409 |
|
410 | /**
|
411 | * Same as `unhideInstance`, but for nodes created by `createTextInstance`.
|
412 | */
|
413 | unhideTextInstance?(textInstance: TextInstance, text: string): void;
|
414 |
|
415 | /**
|
416 | * This method should mutate the `container` root node and remove all children from it.
|
417 | */
|
418 | clearContainer?(container: Container): void;
|
419 |
|
420 | // -------------------
|
421 | // Persistence Methods
|
422 | // (optional)
|
423 | // If you use the persistent mode instead of the mutation mode, you would still need the "Core Methods". However, instead of the Mutation Methods above you will implement a different set of methods that performs cloning nodes and replacing them at the root level. You can find a list of them in the "Persistence" section [listed in this file](https:
|
424 |
|
425 | cloneInstance?(
|
426 | instance: Instance,
|
427 | updatePayload: UpdatePayload,
|
428 | type: Type,
|
429 | oldProps: Props,
|
430 | newProps: Props,
|
431 | internalInstanceHandle: OpaqueHandle,
|
432 | keepChildren: boolean,
|
433 | recyclableInstance: null | Instance,
|
434 | ): Instance;
|
435 | createContainerChildSet?(container: Container): ChildSet;
|
436 | appendChildToContainerChildSet?(childSet: ChildSet, child: Instance | TextInstance): void;
|
437 | finalizeContainerChildren?(container: Container, newChildren: ChildSet): void;
|
438 | replaceContainerChildren?(container: Container, newChildren: ChildSet): void;
|
439 | cloneHiddenInstance?(
|
440 | instance: Instance,
|
441 | type: Type,
|
442 | props: Props,
|
443 | internalInstanceHandle: OpaqueHandle,
|
444 | ): Instance;
|
445 | cloneHiddenTextInstance?(instance: Instance, text: Type, internalInstanceHandle: OpaqueHandle): TextInstance;
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 | supportsHydration: boolean;
|
455 |
|
456 | canHydrateInstance?(instance: HydratableInstance, type: Type, props: Props): null | Instance;
|
457 |
|
458 | canHydrateTextInstance?(instance: HydratableInstance, text: string): null | TextInstance;
|
459 |
|
460 | canHydrateSuspenseInstance?(instance: HydratableInstance): null | SuspenseInstance;
|
461 |
|
462 | isSuspenseInstancePending?(instance: SuspenseInstance): boolean;
|
463 |
|
464 | isSuspenseInstanceFallback?(instance: SuspenseInstance): boolean;
|
465 |
|
466 | registerSuspenseInstanceRetry?(instance: SuspenseInstance, callback: () => void): void;
|
467 |
|
468 | getNextHydratableSibling?(instance: HydratableInstance): null | HydratableInstance;
|
469 |
|
470 | getFirstHydratableChild?(parentInstance: Container | Instance): null | HydratableInstance;
|
471 |
|
472 | hydrateInstance?(
|
473 | instance: Instance,
|
474 | type: Type,
|
475 | props: Props,
|
476 | rootContainerInstance: Container,
|
477 | hostContext: HostContext,
|
478 | internalInstanceHandle: any,
|
479 | ): null | any[];
|
480 |
|
481 | hydrateTextInstance?(textInstance: TextInstance, text: string, internalInstanceHandle: any): boolean;
|
482 |
|
483 | hydrateSuspenseInstance?(suspenseInstance: SuspenseInstance, internalInstanceHandle: any): void;
|
484 |
|
485 | getNextHydratableInstanceAfterSuspenseInstance?(suspenseInstance: SuspenseInstance): null | HydratableInstance;
|
486 |
|
487 |
|
488 |
|
489 |
|
490 | getParentSuspenseInstance?(targetInstance: any): null | SuspenseInstance;
|
491 |
|
492 | commitHydratedContainer?(container: Container): void;
|
493 |
|
494 | commitHydratedSuspenseInstance?(suspenseInstance: SuspenseInstance): void;
|
495 |
|
496 | didNotMatchHydratedContainerTextInstance?(
|
497 | parentContainer: Container,
|
498 | textInstance: TextInstance,
|
499 | text: string,
|
500 | ): void;
|
501 |
|
502 | didNotMatchHydratedTextInstance?(
|
503 | parentType: Type,
|
504 | parentProps: Props,
|
505 | parentInstance: Instance,
|
506 | textInstance: TextInstance,
|
507 | text: string,
|
508 | ): void;
|
509 |
|
510 | didNotHydrateContainerInstance?(parentContainer: Container, instance: HydratableInstance): void;
|
511 |
|
512 | didNotHydrateInstance?(
|
513 | parentType: Type,
|
514 | parentProps: Props,
|
515 | parentInstance: Instance,
|
516 | instance: HydratableInstance,
|
517 | ): void;
|
518 |
|
519 | didNotFindHydratableContainerInstance?(parentContainer: Container, type: Type, props: Props): void;
|
520 |
|
521 | didNotFindHydratableContainerTextInstance?(parentContainer: Container, text: string): void;
|
522 |
|
523 | didNotFindHydratableContainerSuspenseInstance?(parentContainer: Container): void;
|
524 |
|
525 | didNotFindHydratableInstance?(
|
526 | parentType: Type,
|
527 | parentProps: Props,
|
528 | parentInstance: Instance,
|
529 | type: Type,
|
530 | props: Props,
|
531 | ): void;
|
532 |
|
533 | didNotFindHydratableTextInstance?(
|
534 | parentType: Type,
|
535 | parentProps: Props,
|
536 | parentInstance: Instance,
|
537 | text: string,
|
538 | ): void;
|
539 |
|
540 | didNotFindHydratableSuspenseInstance?(parentType: Type, parentProps: Props, parentInstance: Instance): void;
|
541 |
|
542 | errorHydratingContainer?(parentContainer: Container): void;
|
543 | }
|
544 |
|
545 | interface Thenable<T> {
|
546 | then(resolve: () => T, reject?: () => T): T;
|
547 | }
|
548 |
|
549 | type RootTag = 0 | 1 | 2;
|
550 |
|
551 | type WorkTag =
|
552 | | 0
|
553 | | 1
|
554 | | 2
|
555 | | 3
|
556 | | 4
|
557 | | 5
|
558 | | 6
|
559 | | 7
|
560 | | 8
|
561 | | 9
|
562 | | 10
|
563 | | 11
|
564 | | 12
|
565 | | 13
|
566 | | 14
|
567 | | 15
|
568 | | 16
|
569 | | 17
|
570 | | 18
|
571 | | 19
|
572 | | 20
|
573 | | 21
|
574 | | 22
|
575 | | 23
|
576 | | 24;
|
577 |
|
578 | type HookType =
|
579 | | "useState"
|
580 | | "useReducer"
|
581 | | "useContext"
|
582 | | "useRef"
|
583 | | "useEffect"
|
584 | | "useLayoutEffect"
|
585 | | "useCallback"
|
586 | | "useMemo"
|
587 | | "useImperativeHandle"
|
588 | | "useDebugValue"
|
589 | | "useDeferredValue"
|
590 | | "useTransition"
|
591 | | "useMutableSource"
|
592 | | "useOpaqueIdentifier"
|
593 | | "useCacheRefresh";
|
594 |
|
595 | interface Source {
|
596 | fileName: string;
|
597 | lineNumber: number;
|
598 | }
|
599 |
|
600 |
|
601 |
|
602 | type LanePriority = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17;
|
603 |
|
604 | type Lanes = number;
|
605 | type Lane = number;
|
606 |
|
607 | type Flags = number;
|
608 |
|
609 | type TypeOfMode = number;
|
610 |
|
611 | interface ReactProvider<T> {
|
612 | $$typeof: symbol | number;
|
613 | type: ReactProviderType<T>;
|
614 | key: null | string;
|
615 | ref: null;
|
616 | props: {
|
617 | value: T;
|
618 | children?: ReactNode;
|
619 | };
|
620 | }
|
621 |
|
622 | interface ReactProviderType<T> {
|
623 | $$typeof: symbol | number;
|
624 | _context: ReactContext<T>;
|
625 | }
|
626 |
|
627 | interface ReactConsumer<T> {
|
628 | $$typeof: symbol | number;
|
629 | type: ReactContext<T>;
|
630 | key: null | string;
|
631 | ref: null;
|
632 | props: {
|
633 | children: (value: T) => ReactNode;
|
634 | unstable_observedBits?: number;
|
635 | };
|
636 | }
|
637 |
|
638 | interface ReactContext<T> {
|
639 | $$typeof: symbol | number;
|
640 | Consumer: ReactContext<T>;
|
641 | Provider: ReactProviderType<T>;
|
642 | _calculateChangedBits: ((a: T, b: T) => number) | null;
|
643 | _currentValue: T;
|
644 | _currentValue2: T;
|
645 | _threadCount: number;
|
646 |
|
647 | _currentRenderer?: {
|
648 | [key: string]: any;
|
649 | } | null;
|
650 | _currentRenderer2?: {
|
651 | [key: string]: any;
|
652 | } | null;
|
653 |
|
654 |
|
655 | displayName?: string;
|
656 | }
|
657 |
|
658 | interface ReactPortal {
|
659 | $$typeof: symbol | number;
|
660 | key: null | string;
|
661 | containerInfo: any;
|
662 | children: ReactNode;
|
663 |
|
664 | implementation: any;
|
665 | }
|
666 |
|
667 | interface RefObject {
|
668 | current: any;
|
669 | }
|
670 |
|
671 | interface ContextDependency<T> {
|
672 | context: ReactContext<T>;
|
673 | observedBits: number;
|
674 | next: ContextDependency<unknown> | null;
|
675 | }
|
676 |
|
677 | interface Dependencies {
|
678 | lanes: Lanes;
|
679 | firstContext: ContextDependency<unknown> | null;
|
680 | }
|
681 |
|
682 | interface Fiber {
|
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 | tag: WorkTag;
|
695 |
|
696 |
|
697 | key: null | string;
|
698 |
|
699 |
|
700 |
|
701 | elementType: any;
|
702 |
|
703 |
|
704 | type: any;
|
705 |
|
706 |
|
707 | stateNode: any;
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 | return: Fiber | null;
|
720 |
|
721 |
|
722 | child: Fiber | null;
|
723 | sibling: Fiber | null;
|
724 | index: number;
|
725 |
|
726 |
|
727 |
|
728 | ref:
|
729 | | null
|
730 | | (((handle: unknown) => void) & {
|
731 | _stringRef?: string | null;
|
732 | })
|
733 | | RefObject;
|
734 |
|
735 |
|
736 | pendingProps: any;
|
737 | memoizedProps: any;
|
738 |
|
739 |
|
740 | updateQueue: unknown;
|
741 |
|
742 |
|
743 | memoizedState: any;
|
744 |
|
745 |
|
746 | dependencies: Dependencies | null;
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 | mode: TypeOfMode;
|
755 |
|
756 |
|
757 | flags: Flags;
|
758 | subtreeFlags: Flags;
|
759 | deletions: Fiber[] | null;
|
760 |
|
761 |
|
762 | nextEffect: Fiber | null;
|
763 |
|
764 |
|
765 |
|
766 |
|
767 | firstEffect: Fiber | null;
|
768 | lastEffect: Fiber | null;
|
769 |
|
770 | lanes: Lanes;
|
771 | childLanes: Lanes;
|
772 |
|
773 |
|
774 |
|
775 |
|
776 | alternate: Fiber | null;
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 | actualDuration?: number;
|
783 |
|
784 |
|
785 |
|
786 |
|
787 | actualStartTime?: number;
|
788 |
|
789 |
|
790 |
|
791 |
|
792 | selfBaseDuration?: number;
|
793 |
|
794 |
|
795 |
|
796 |
|
797 | treeBaseDuration?: number;
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 | _debugID?: number;
|
804 | _debugSource?: Source | null;
|
805 | _debugOwner?: Fiber | null;
|
806 | _debugIsCurrentlyTiming?: boolean;
|
807 | _debugNeedsRemount?: boolean;
|
808 |
|
809 |
|
810 | _debugHookTypes?: HookType[] | null;
|
811 | }
|
812 |
|
813 | type FiberRoot = any;
|
814 |
|
815 |
|
816 | type MutableSource = any;
|
817 |
|
818 | type OpaqueHandle = any;
|
819 | type OpaqueRoot = any;
|
820 |
|
821 |
|
822 |
|
823 | type BundleType = 0 | 1;
|
824 |
|
825 | interface DevToolsConfig<Instance, TextInstance, RendererInspectionConfig> {
|
826 | bundleType: BundleType;
|
827 | version: string;
|
828 | rendererPackageName: string;
|
829 |
|
830 |
|
831 | findFiberByHostInstance?: (instance: Instance | TextInstance) => Fiber | null;
|
832 | rendererConfig?: RendererInspectionConfig;
|
833 | }
|
834 |
|
835 | interface SuspenseHydrationCallbacks<SuspenseInstance> {
|
836 | onHydrated?: (suspenseInstance: SuspenseInstance) => void;
|
837 | onDeleted?: (suspenseInstance: SuspenseInstance) => void;
|
838 | }
|
839 |
|
840 | interface TransitionTracingCallbacks {
|
841 | onTransitionStart?: (transitionName: string, startTime: number) => void;
|
842 | onTransitionProgress?: (
|
843 | transitionName: string,
|
844 | startTime: number,
|
845 | currentTime: number,
|
846 | pending: Array<{ name: null | string }>,
|
847 | ) => void;
|
848 | onTransitionIncomplete?: (
|
849 | transitionName: string,
|
850 | startTime: number,
|
851 | deletions: Array<{
|
852 | type: string;
|
853 | name?: string;
|
854 | newName?: string;
|
855 | endTime: number;
|
856 | }>,
|
857 | ) => void;
|
858 | onTransitionComplete?: (transitionName: string, startTime: number, endTime: number) => void;
|
859 | onMarkerProgress?: (
|
860 | transitionName: string,
|
861 | marker: string,
|
862 | startTime: number,
|
863 | currentTime: number,
|
864 | pending: Array<{ name: null | string }>,
|
865 | ) => void;
|
866 | onMarkerIncomplete?: (
|
867 | transitionName: string,
|
868 | marker: string,
|
869 | startTime: number,
|
870 | deletions: Array<{
|
871 | type: string;
|
872 | name?: string;
|
873 | newName?: string;
|
874 | endTime: number;
|
875 | }>,
|
876 | ) => void;
|
877 | onMarkerComplete?: (transitionName: string, marker: string, startTime: number, endTime: number) => void;
|
878 | }
|
879 |
|
880 | interface ComponentSelector {
|
881 | $$typeof: symbol | number;
|
882 | value: React$AbstractComponent<never, unknown>;
|
883 | }
|
884 |
|
885 | interface HasPseudoClassSelector {
|
886 | $$typeof: symbol | number;
|
887 | value: Selector[];
|
888 | }
|
889 |
|
890 | interface RoleSelector {
|
891 | $$typeof: symbol | number;
|
892 | value: string;
|
893 | }
|
894 |
|
895 | interface TextSelector {
|
896 | $$typeof: symbol | number;
|
897 | value: string;
|
898 | }
|
899 |
|
900 | interface TestNameSelector {
|
901 | $$typeof: symbol | number;
|
902 | value: string;
|
903 | }
|
904 |
|
905 | type Selector = ComponentSelector | HasPseudoClassSelector | RoleSelector | TextSelector | TestNameSelector;
|
906 |
|
907 |
|
908 | type React$AbstractComponent<Config, Instance = any> = any;
|
909 |
|
910 | interface BoundingRect {
|
911 | x: number;
|
912 | y: number;
|
913 | width: number;
|
914 | height: number;
|
915 | }
|
916 |
|
917 | type IntersectionObserverOptions = any;
|
918 |
|
919 | interface Reconciler<Container, Instance, TextInstance, SuspenseInstance, PublicInstance> {
|
920 | createContainer(
|
921 | containerInfo: Container,
|
922 | tag: RootTag,
|
923 | hydrationCallbacks: null | SuspenseHydrationCallbacks<SuspenseInstance>,
|
924 | isStrictMode: boolean,
|
925 | concurrentUpdatesByDefaultOverride: null | boolean,
|
926 | identifierPrefix: string,
|
927 | onRecoverableError: (error: Error) => void,
|
928 | transitionCallbacks: null | TransitionTracingCallbacks,
|
929 | ): OpaqueRoot;
|
930 |
|
931 | createPortal(
|
932 | children: ReactNode,
|
933 | containerInfo: any,
|
934 | implementation: any,
|
935 | key?: string | null,
|
936 | ): ReactPortal;
|
937 |
|
938 | registerMutableSourceForHydration(root: FiberRoot, mutableSource: MutableSource): void;
|
939 |
|
940 | createComponentSelector(component: React$AbstractComponent<never, unknown>): ComponentSelector;
|
941 |
|
942 | createHasPseudoClassSelector(selectors: Selector[]): HasPseudoClassSelector;
|
943 |
|
944 | createRoleSelector(role: string): RoleSelector;
|
945 |
|
946 | createTextSelector(text: string): TextSelector;
|
947 |
|
948 | createTestNameSelector(id: string): TestNameSelector;
|
949 |
|
950 | getFindAllNodesFailureDescription(hostRoot: Instance, selectors: Selector[]): string | null;
|
951 |
|
952 | findAllNodes(hostRoot: Instance, selectors: Selector[]): Instance[];
|
953 |
|
954 | findBoundingRects(hostRoot: Instance, selectors: Selector[]): BoundingRect[];
|
955 |
|
956 | focusWithin(hostRoot: Instance, selectors: Selector[]): boolean;
|
957 |
|
958 | observeVisibleRects(
|
959 | hostRoot: Instance,
|
960 | selectors: Selector[],
|
961 | callback: (intersections: Array<{ ratio: number; rect: BoundingRect }>) => void,
|
962 | options?: IntersectionObserverOptions,
|
963 | ): { disconnect: () => void };
|
964 |
|
965 | createHydrationContainer(
|
966 | initialChildren: ReactNode,
|
967 | callback: (() => void) | null | undefined,
|
968 | containerInfo: Container,
|
969 | tag: RootTag,
|
970 | hydrationCallbacks: null | SuspenseHydrationCallbacks<SuspenseInstance>,
|
971 | isStrictMode: boolean,
|
972 | concurrentUpdatesByDefaultOverride: null | boolean,
|
973 | identifierPrefix: string,
|
974 | onRecoverableError: (error: Error) => void,
|
975 | transitionCallbacks: null | TransitionTracingCallbacks,
|
976 | ): OpaqueRoot;
|
977 |
|
978 | updateContainer(
|
979 | element: ReactNode,
|
980 | container: OpaqueRoot,
|
981 | parentComponent?: Component<any, any> | null,
|
982 | callback?: (() => void) | null,
|
983 | ): Lane;
|
984 |
|
985 | batchedUpdates<A, R>(fn: (a: A) => R, a: A): R;
|
986 |
|
987 | deferredUpdates<A>(fn: () => A): A;
|
988 |
|
989 | discreteUpdates<A, B, C, D, R>(fn: (arg0: A, arg1: B, arg2: C, arg3: D) => R, a: A, b: B, c: C, d: D): R;
|
990 |
|
991 | flushControlled(fn: () => any): void;
|
992 |
|
993 | flushSync(): void;
|
994 | flushSync<R>(fn: () => R): R;
|
995 |
|
996 | isAlreadyRendering(): boolean;
|
997 |
|
998 | flushPassiveEffects(): boolean;
|
999 |
|
1000 | getPublicRootInstance(container: OpaqueRoot): Component<any, any> | PublicInstance | null;
|
1001 |
|
1002 | attemptSynchronousHydration(fiber: Fiber): void;
|
1003 |
|
1004 | attemptDiscreteHydration(fiber: Fiber): void;
|
1005 |
|
1006 | attemptContinuousHydration(fiber: Fiber): void;
|
1007 |
|
1008 | attemptHydrationAtCurrentPriority(fiber: Fiber): void;
|
1009 |
|
1010 | getCurrentUpdatePriority(): LanePriority;
|
1011 |
|
1012 | runWithPriority<T>(priority: LanePriority, fn: () => T): T;
|
1013 |
|
1014 | findHostInstance(component: any): PublicInstance | null;
|
1015 |
|
1016 | findHostInstanceWithWarning(component: any, methodName: string): PublicInstance | null;
|
1017 |
|
1018 | findHostInstanceWithNoPortals(fiber: Fiber): PublicInstance | null;
|
1019 |
|
1020 | shouldError(fiber: Fiber): boolean | undefined;
|
1021 |
|
1022 | shouldSuspend(fiber: Fiber): boolean;
|
1023 |
|
1024 | injectIntoDevTools(devToolsConfig: DevToolsConfig<Instance, TextInstance, any>): boolean;
|
1025 | }
|
1026 | }
|
1027 |
|
1028 | export = ReactReconciler;
|
1029 |
|
\ | No newline at end of file |