import { FacetProp, Unsubscribe } from '@react-facet/core'; import { FiberRoot, Reconciler } from 'react-reconciler'; import { MutableRefObject, ReactElement, ReactNode, ReactPortal } from 'react'; export type FacetFiberRoot = FiberRoot; export type TypeHTML = 'fast-a' | 'fast-div' | 'fast-span' | 'fast-p' | 'fast-img' | 'fast-textarea' | 'fast-input' | 'fast-text' | 'a' | 'div' | 'p' | 'img' | 'textarea' | 'input' | 'style'; export type TypeSVG = 'fast-circle' | 'fast-ellipse' | 'fast-line' | 'fast-path' | 'fast-rect' | 'fast-svg' | 'fast-foreignObject' | 'fast-use' | 'fast-polyline' | 'fast-polygon' | 'fast-linearGradient' | 'fast-radialGradient' | 'fast-stop' | 'fast-svg-text' | 'fast-pattern' | 'circle' | 'ellipse' | 'line' | 'path' | 'rect' | 'svg' | 'defs' | 'g' | 'symbol' | 'use' | 'polyline' | 'polygon' | 'linearGradient' | 'radialGradient' | 'foreignObject' | 'stop' | 'text' | 'pattern'; export type Type = TypeHTML | TypeSVG; export type InputType = 'text' | 'button' | 'password' | 'checkbox' | 'radio' | 'number'; export interface Style { [key: string]: FacetProp; } export interface Callback { (): void; } export interface NoTimeout { (): void; } export type FocusCallback = (e: FocusEvent) => void; export type TouchCallback = (e: TouchEvent) => void; export type MouseCallback = (event: MouseEvent) => void; export interface PointerEvents { onClick?: MouseCallback; onAuxClick?: MouseCallback; onMouseDown?: MouseCallback; onMouseMove?: MouseCallback; onMouseUp?: MouseCallback; onTouchStart?: TouchCallback; onTouchMove?: TouchCallback; onTouchEnd?: TouchCallback; onMouseEnter?: MouseCallback; onMouseLeave?: MouseCallback; } export interface FocusEvents { onFocus?: FocusCallback; onBlur?: FocusCallback; } export type KeyboardCallback = (event: KeyboardEvent) => void; export interface KeyboardEvents { onKeyPress?: KeyboardCallback; onKeyDown?: KeyboardCallback; onKeyUp?: KeyboardCallback; } interface StrictReactElement

{ type: T; props: P; key: string | null; } export type FastTextElement = ReactElement; /** * More strict type than default React.ReactNode * * It prevents passing a function as a Node. This allow us to catch accidental passing of facets as children. */ export type StrictReactNode = StrictReactElement | string | number | Iterable | ReactPortal | boolean | null | undefined | FastTextElement; export type ElementProps = PointerEvents & FocusEvents & KeyboardEvents & { key?: string | number; /** * More strict children that doesn't support passing facets */ children?: StrictReactNode; style?: Style; ref?: React.Ref; dangerouslySetInnerHTML?: { __html: string; }; className?: FacetProp; cx?: FacetProp; cy?: FacetProp; d?: FacetProp; ['data-narrate']?: FacetProp; ['data-narrate-as']?: FacetProp; ['data-narrate-before']?: FacetProp; ['data-narrate-after']?: FacetProp; ['data-droppable']?: FacetProp; ['data-testid']?: FacetProp; ['data-x-ray']?: FacetProp; fill?: FacetProp; id?: FacetProp; src?: FacetProp; height?: FacetProp; href?: FacetProp; target?: FacetProp; autoPlay?: FacetProp; loop?: FacetProp; disabled?: FacetProp; maxLength?: FacetProp; r?: FacetProp; rx?: FacetProp; ry?: FacetProp; rows?: FacetProp; stroke?: FacetProp; strokeWidth?: FacetProp; type?: FacetProp; value?: FacetProp; x?: FacetProp; x1?: FacetProp; x2?: FacetProp; width?: FacetProp; y?: FacetProp; y1?: FacetProp; y2?: FacetProp; viewBox?: FacetProp; xLinkHref?: FacetProp; fillOpacity?: FacetProp; strokeOpacity?: FacetProp; strokeLinecap?: FacetProp; strokeLinejoin?: FacetProp; points?: FacetProp; offset?: FacetProp; stopColor?: FacetProp; stopOpacity?: FacetProp; fontFamily?: FacetProp; fontSize?: FacetProp; /** * Support for Gameface's Experimental inline layout for paragraph elements * More info: https://docs.coherent-labs.com/cpp-gameface/what_is_gfp/htmlfeaturesupport/#experimental-inline-layout-for-paragraph-elements */ cohinline?: FacetProp; }; export type TextProps = { text: FacetProp; }; export type Props = ElementProps & TextProps; export type ValidPropsNames = keyof Props; export type ElementContainer = { children: Set; element: HTMLElement | SVGElement | Text; style?: CSSStyleDeclaration; styleUnsubscribers?: Map; className?: Unsubscribe; cx?: Unsubscribe; cy?: Unsubscribe; d?: Unsubscribe; ['data-droppable']?: Unsubscribe; ['data-narrate']?: Unsubscribe; ['data-narrate-as']?: Unsubscribe; ['data-narrate-after']?: Unsubscribe; ['data-narrate-before']?: Unsubscribe; ['data-testid']?: Unsubscribe; ['data-x-ray']?: Unsubscribe; fill?: Unsubscribe; id?: Unsubscribe; src?: Unsubscribe; height?: Unsubscribe; href?: Unsubscribe; target?: Unsubscribe; autoPlay?: Unsubscribe; loop?: Unsubscribe; disabled?: Unsubscribe; maxLength?: Unsubscribe; r?: Unsubscribe; rx?: Unsubscribe; ry?: Unsubscribe; rows?: Unsubscribe; stroke?: Unsubscribe; strokeWidth?: Unsubscribe; type?: Unsubscribe; text?: Unsubscribe; value?: Unsubscribe; x?: Unsubscribe; x1?: Unsubscribe; x2?: Unsubscribe; width?: Unsubscribe; y?: Unsubscribe; y1?: Unsubscribe; y2?: Unsubscribe; viewBox?: Unsubscribe; xLinkHref?: Unsubscribe; fillOpacity?: Unsubscribe; strokeOpacity?: Unsubscribe; strokeLinecap?: Unsubscribe; strokeLinejoin?: Unsubscribe; points?: Unsubscribe; offset?: Unsubscribe; stopColor?: Unsubscribe; stopOpacity?: Unsubscribe; fontFamily?: Unsubscribe; fontSize?: Unsubscribe; cohinline?: Unsubscribe; }; export declare const isElementContainer: (value: ElementContainer | TextContainer) => value is ElementContainer; export type TextContainer = { element: Text; }; export type Instance = ElementContainer; export type Container = Instance; export type TextInstance = TextContainer; export type HydratableInstance = Instance; export type SuspenseInstance = Instance; export type PublicInstance = HTMLElement | SVGElement | Text; export type ReactFacetReconciler = Reconciler & { flushPassiveEffects: () => boolean; IsThisRendererActing: MutableRefObject; }; export interface HostContext { type?: Type; } export type UpdatePayload = boolean; export type FastAProps = ElementProps; export type FastCircleProps = ElementProps; export type FastDivProps = ElementProps; export type FastEllipseProps = ElementProps; export type FastLineProps = ElementProps; export type FastImgProps = ElementProps; export type FastTextareaProps = ElementProps; export type FastInputProps = ElementProps; export type FastPProps = ElementProps; export type FastPathProps = ElementProps; export type FastRectProps = ElementProps; export type FastSpanProps = ElementProps; export type FastSvgProps = ElementProps; export type FastForeignObjectProps = ElementProps; export type FastTextProps = TextProps; export type FastUseProps = ElementProps; export type FastPolylineProps = ElementProps; export type FastPolyGonProps = ElementProps; export type FastLinearGradientProps = ElementProps; export type FastRadialGradientProps = ElementProps; export type FastStopProps = ElementProps; export type FastSvgTextProps = ElementProps; export type FastPatternProps = ElementProps; /** * Extends React global namespace with the "fast" types */ declare global { namespace JSX { interface IntrinsicElements { 'fast-a': FastAProps; 'fast-circle': FastCircleProps; 'fast-ellipse': FastEllipseProps; 'fast-line': FastLineProps; 'fast-div': FastDivProps; 'fast-img': FastImgProps; 'fast-textarea': FastTextareaProps; 'fast-input': FastInputProps; 'fast-p': FastPProps; 'fast-path': FastPathProps; 'fast-rect': FastRectProps; 'fast-span': FastSpanProps; 'fast-text': FastTextProps; 'fast-svg': FastSvgProps; 'fast-foreignObject': FastForeignObjectProps; 'fast-use': FastUseProps; 'fast-polyline': FastPolylineProps; 'fast-polygon': FastPolyGonProps; 'fast-linearGradient': FastLinearGradientProps; 'fast-radialGradient': FastRadialGradientProps; 'fast-stop': FastStopProps; 'fast-svg-text': FastSvgTextProps; 'fast-pattern': FastPatternProps; } } } export {};