CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
canary.d.ts130 linesDownload Raw Back to react
1/**2 * These are types for things that are present in the React `canary` release channel.3 *4 * To load the types declared here in an actual project, there are three ways. The easiest one,5 * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,6 * is to add `"react/canary"` to the `"types"` array.7 *8 * Alternatively, a specific import syntax can to be used from a typescript file.9 * This module does not exist in reality, which is why the {} is important:10 *11 * ```ts12 * import {} from 'react/canary'13 * ```14 *15 * It is also possible to include it through a triple-slash reference:16 *17 * ```ts18 * /// <reference types="react/canary" />19 * ```20 *21 * Either the import or the reference only needs to appear once, anywhere in the project.22 */23 24// See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared,25 26import React = require(".");27 28export {};29 30declare const UNDEFINED_VOID_ONLY: unique symbol;31type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };32 33type NativeSubmitEvent = SubmitEvent;34 35declare module "." {36    export function unstable_useCacheRefresh(): () => void;37 38    // @enableViewTransition39    export interface ViewTransitionInstance {40        /**41         * The {@link ViewTransitionProps name} that was used in the corresponding {@link ViewTransition} component or `"auto"` if the `name` prop was omitted.42         */43        name: string;44    }45 46    export type ViewTransitionClassPerType = Record<"default" | (string & {}), "none" | "auto" | (string & {})>;47    export type ViewTransitionClass = ViewTransitionClassPerType | ViewTransitionClassPerType[string];48 49    export interface ViewTransitionProps {50        children?: ReactNode | undefined;51        /**52         * Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node.53         */54        default?: ViewTransitionClass | undefined;55        /**56         * Combined with {@link className} if this `<ViewTransition>` or its parent Component is mounted and there's no other with the same name being deleted.57         * `"none"` is a special value that deactivates the view transition name under that condition.58         */59        enter?: ViewTransitionClass | undefined;60        /**61         * Combined with {@link className} if this `<ViewTransition>` or its parent Component is unmounted and there's no other with the same name being deleted.62         * `"none"` is a special value that deactivates the view transition name under that condition.63         */64        exit?: ViewTransitionClass | undefined;65        /**66         * "auto" will automatically assign a view-transition-name to the inner DOM node.67         * That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise.68         *69         * A difference between this and the browser's built-in view-transition-name: auto is that switching the DOM nodes within the `<ViewTransition>` component preserves the same name so this example cross-fades between the DOM nodes instead of causing an exit and enter.70         * @default "auto"71         */72        name?: "auto" | (string & {}) | undefined;73        /**74         * The `<ViewTransition>` or its parent Component is mounted and there's no other `<ViewTransition>` with the same name being deleted.75         */76        onEnter?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);77        /**78         * The `<ViewTransition>` or its parent Component is unmounted and there's no other `<ViewTransition>` with the same name being deleted.79         */80        onExit?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);81        /**82         * This `<ViewTransition>` is being mounted and another `<ViewTransition>` instance with the same name is being unmounted elsewhere.83         */84        onShare?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);85        /**86         * The content of `<ViewTransition>` has changed either due to DOM mutations or because an inner child `<ViewTransition>` has resized.87         */88        onUpdate?: (instance: ViewTransitionInstance, types: Array<string>) => void | (() => void);89        ref?: Ref<ViewTransitionInstance> | undefined;90        /**91         * Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.92         * `"none"` is a special value that deactivates the view transition name under that condition.93         */94        share?: ViewTransitionClass | undefined;95        /**96         * Combined with {@link className} if the content of this `<ViewTransition>` has changed either due to DOM mutations or because an inner child has resized.97         * `"none"` is a special value that deactivates the view transition name under that condition.98         */99        update?: ViewTransitionClass | undefined;100    }101 102    /**103     * Opt-in for using {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API View Transitions} in React.104     * View Transitions only trigger for async updates like {@link startTransition}, {@link useDeferredValue}, Actions or <{@link Suspense}> revealing from fallback to content.105     * Synchronous updates provide an opt-out but also guarantee that they commit immediately which View Transitions can't.106     *107     * @see {@link https://react.dev/reference/react/ViewTransition `<ViewTransition>` reference documentation}108     */109    export const ViewTransition: ExoticComponent<ViewTransitionProps>;110 111    /**112     * @see {@link https://react.dev/reference/react/addTransitionType `addTransitionType` reference documentation}113     */114    export function addTransitionType(type: string): void;115 116    // @enableFragmentRefs117    export interface FragmentInstance {}118 119    export interface FragmentProps {120        ref?: Ref<FragmentInstance> | undefined;121    }122 123    interface SubmitEvent<T = Element> extends SyntheticEvent<T, NativeSubmitEvent> {124        /**125         * Only available in react@canary126         */127        submitter: HTMLElement | null;128    }129}130