CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
experimental.d.ts185 linesDownload Raw Back to react
1/**2 * These are types for things that are present in the `experimental` builds of React but not yet3 * on a stable build.4 *5 * Once they are promoted to stable they can just be moved to the main index file.6 *7 * To load the types declared here in an actual project, there are three ways. The easiest one,8 * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,9 * is to add `"react/experimental"` to the `"types"` array.10 *11 * Alternatively, a specific import syntax can to be used from a typescript file.12 * This module does not exist in reality, which is why the {} is important:13 *14 * ```ts15 * import {} from 'react/experimental'16 * ```17 *18 * It is also possible to include it through a triple-slash reference:19 *20 * ```ts21 * /// <reference types="react/experimental" />22 * ```23 *24 * Either the import or the reference only needs to appear once, anywhere in the project.25 */26 27// See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared,28// and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are29// flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`.30//31// For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js32// is a good place to start looking for details; it generally calls prop validation functions or delegates33// all tasks done as part of the render phase (the concurrent part of the React update cycle).34//35// Suspense-related handling can be found in ReactFiberThrow.js.36 37import React = require("./canary");38 39export {};40 41declare const UNDEFINED_VOID_ONLY: unique symbol;42type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };43 44declare module "." {45    export interface SuspenseProps {46        // @enableCPUSuspense47        /**48         * The presence of this prop indicates that the content is computationally expensive to render.49         * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data).50         * @see {@link https://github.com/facebook/react/pull/19936}51         */52        defer?: boolean | undefined;53    }54 55    export type SuspenseListRevealOrder = "forwards" | "backwards" | "together" | "independent";56    export type SuspenseListTailMode = "collapsed" | "hidden" | "visible";57 58    export interface SuspenseListCommonProps {59    }60 61    interface DirectionalSuspenseListProps extends SuspenseListCommonProps {62        /**63         * Note that SuspenseList require more than one child;64         * it is a runtime warning to provide only a single child.65         *66         * It does, however, allow those children to be wrapped inside a single67         * level of `<React.Fragment>`.68         */69        children: Iterable<ReactElement> | AsyncIterable<ReactElement>;70        /**71         * Defines the order in which the `SuspenseList` children should be revealed.72         * @default "forwards"73         */74        revealOrder?: "forwards" | "backwards" | "unstable_legacy-backwards" | undefined;75        /**76         * Dictates how unloaded items in a SuspenseList is shown.77         *78         * - `collapsed` shows only the next fallback in the list.79         * - `hidden` doesn't show any unloaded items.80         * - `visible` shows all fallbacks in the list.81         *82         * @default "hidden"83         */84        tail?: SuspenseListTailMode | undefined;85    }86 87    interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps {88        children: ReactNode;89        /**90         * Defines the order in which the `SuspenseList` children should be revealed.91         */92        revealOrder: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]>;93        /**94         * The tail property is invalid when not using the `forwards` or `backwards` reveal orders.95         */96        tail?: never;97    }98 99    export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps;100 101    /**102     * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order103     * in which these components are revealed to the user.104     *105     * When multiple components need to fetch data, this data may arrive in an unpredictable order.106     * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list107     * until previous items have been displayed (this behavior is adjustable).108     *109     * @see {@link https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist}110     * @see {@link https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist}111     */112    export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>;113 114    type Reference = object;115    type TaintableUniqueValue = string | bigint | ArrayBufferView;116    function experimental_taintUniqueValue(117        message: string | undefined,118        lifetime: Reference,119        value: TaintableUniqueValue,120    ): void;121    function experimental_taintObjectReference(message: string | undefined, object: Reference): void;122 123    // @enableGestureTransition124    // Implemented by the specific renderer e.g. `react-dom`.125    // Keep in mind that augmented interfaces merge their JSDoc so if you put126    // JSDoc here and in the renderer, the IDE will display both.127    export interface GestureProvider {}128    export interface GestureOptions {129        rangeStart?: number | undefined;130        rangeEnd?: number | undefined;131    }132    export type GestureOptionsRequired = {133        [P in keyof GestureOptions]-?: NonNullable<GestureOptions[P]>;134    };135    /** */136    export function unstable_startGestureTransition(137        provider: GestureProvider,138        scope: () => void,139        options?: GestureOptions,140    ): () => void;141 142    interface ViewTransitionProps {143        onGestureEnter?: (144            timeline: GestureProvider,145            options: GestureOptionsRequired,146            instance: ViewTransitionInstance,147            types: Array<string>,148        ) => void | (() => void);149        onGestureExit?: (150            timeline: GestureProvider,151            options: GestureOptionsRequired,152            instance: ViewTransitionInstance,153            types: Array<string>,154        ) => void | (() => void);155        onGestureShare?: (156            timeline: GestureProvider,157            options: GestureOptionsRequired,158            instance: ViewTransitionInstance,159            types: Array<string>,160        ) => void | (() => void);161        onGestureUpdate?: (162            timeline: GestureProvider,163            options: GestureOptionsRequired,164            instance: ViewTransitionInstance,165            types: Array<string>,166        ) => void | (() => void);167    }168 169    // @enableSrcObject170    interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_IMG_SRC_TYPES {171        srcObject: Blob;172    }173 174    interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_MEDIA_SRC_TYPES {175        srcObject: Blob | MediaSource | MediaStream;176    }177 178    // @enableOptimisticKey179    export const optimisticKey: unique symbol;180 181    interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_KEY_TYPES {182        optimisticKey: typeof optimisticKey;183    }184}185