UNPKG

reblendjs

Version:

This is build using react way of handling dom but with web components

96 lines (95 loc) 5.05 kB
import { IAny } from '../interface/IAny'; import { ChildrenPropsUpdateType, ReblendTyping } from 'reblend-typing'; import { Reblend } from './Reblend'; import { CSSProperties } from 'react'; export interface BaseComponent<P, S> extends HTMLElement { nearestStandardParent?: HTMLElement; onStateChangeRunning: boolean | undefined; elementChildren: Set<ReblendTyping.Component<P, S>> | null; reactElementChildrenWrapper: ReblendTyping.Component<any, any> | null; directParent: ReblendTyping.Component<any, any>; childrenInitialize: boolean; dataIdQuerySelector: string; props: Readonly<P>; reactDomCreateRoot_root: import('react-dom/client').Root | null; renderingError: ReblendTyping.ReblendRenderingException<P, S>; displayName: string; renderingErrorHandler: (e: ReblendTyping.ReblendRenderingException<P, S>) => void; removePlaceholder: () => Promise<void>; attached: boolean; isPlaceholder: boolean; placeholderAttached: boolean; ReactClass: any; ReblendPlaceholder?: ReblendTyping.VNode | typeof Reblend; defaultReblendPlaceholderStyle: CSSProperties | string; ref: ReblendTyping.Ref<HTMLElement> | ((node: HTMLElement) => any); effectState: { [key: string]: { cache: ReblendTyping.Primitive | Array<ReblendTyping.Primitive>; cacher: () => ReblendTyping.Primitive | Array<ReblendTyping.Primitive>; }; }; effectsFn: Set<ReblendTyping.StateEffectiveFunction>; disconnectEffects: Set<ReblendTyping.StateEffectiveFunction>; checkPropsChange(): Promise<void>; hasDisconnected: boolean; htmlElements: ReblendTyping.Component<P, S>[]; childrenPropsUpdate: Set<ChildrenPropsUpdateType>; numAwaitingUpdates: number; stateEffectRunning: boolean; mountingEffects: boolean; initStateRunning: boolean; awaitingInitState: boolean; state: S; reactReblendMount: undefined | ((afterNode?: HTMLElement) => any); } export declare class BaseComponent<P = Record<string, never>, S extends { renderingErrorHandler?: (error: Error) => void; } = Record<string, never>> implements ReblendTyping.Component<P, S> { [reblendComponent: symbol]: boolean; static ELEMENT_NAME: string; static props: IAny; static config?: ReblendTyping.ReblendComponentConfig; static wrapChildrenToReact(components: JSX.Element | ReblendTyping.JSXElementConstructor<Record<string, never>>): Promise<import("react").ReactElement<{ ref: (node: HTMLElement) => Promise<void>; value?: any; reblendchildrenwrapperforreactcomponent: string; }, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<{ ref: (node: HTMLElement) => Promise<void>; value?: any; reblendchildrenwrapperforreactcomponent: string; }, string | import("react").JSXElementConstructor<any>>[] | undefined>; static construct(displayName: typeof Reblend | string | ReblendTyping.VNode[], props: IAny, ...children: ReblendTyping.VNodeChildren): ReblendTyping.VNode | ReblendTyping.VNodeChildren; static mountOn(elementId: string, app: typeof Reblend | ReblendTyping.FunctionComponent, props?: IAny): Promise<void>; createInnerHtmlElements(): Promise<ReblendTyping.Component<P, S>[]>; populateHtmlElements(): Promise<void>; connectedCallback(): void; addDisconnectedEffect(effect: () => void): void; addStyle(style: string[] | IAny | string): void; initState(): Promise<void>; initProps(props: P): Promise<void>; componentDidMount(): void; setState(value: S): void; applyEffects(): void; handleError(error: Error): void; catchErrorFrom(fn: () => void): void; cacheEffectDependencies(): void; onStateChange(): Promise<void>; html(): Promise<ReblendTyping.ReblendNode>; mountEffects(): void; disconnectedCallback(fromCleanUp?: boolean): void; cleanUp(): void; componentWillUnmount(): void; dependenciesChanged(currentDependencies: Array<any> | undefined, previousDependencies: Array<any> | undefined): boolean; useState<T>(initial: ReblendTyping.StateFunctionValue<T>, ...dependencyStringAndOrStateKey: string[]): [T, ReblendTyping.StateFunction<T>]; useEffect(fn: ReblendTyping.StateEffectiveFunction, dependencies: any[], ..._dependencyStringAndOrStateKey: string[]): void; useReducer<T, I>(reducer: ReblendTyping.StateReducerFunction<T, I>, initial: ReblendTyping.StateFunctionValue<T>, ...dependencyStringAndOrStateKey: string[]): [T, ReblendTyping.StateFunction<I>]; useMemo<T>(fn: ReblendTyping.StateEffectiveMemoFunction<T>, dependencies?: any[], ...dependencyStringAndOrStateKey: string[]): T; useRef<T>(initial: T, stateKey: string): ReblendTyping.Ref<T>; useCallback<T extends Function>(fn: T): T; /** * Initializes the component, preparing effect management. * For compatibility in case a standard element inherits this prototype; can manually execute this constructor. */ _constructor(): void; }