import { Fragment } from './core/create-element'; import { PropertyDeclaration } from "./models"; import { EventHandler } from "./eventController"; import { UserWatcherOptions } from './computed'; import type { ReactiveControllerHost, ReactiveController } from "./reactiveController"; export type { ReactiveControllerHost, ReactiveController }; export interface Ref { current: T; } export declare function createRef(): Ref; export { Fragment }; export declare const property: (options?: PropertyDeclaration) => (target: QuarkElement, propName: string) => void; export declare const internalProp: () => (target: QuarkElement, propName: string) => void; export declare const state: () => (target: QuarkElement, propName: string) => void; export declare const computed: () => (target: QuarkElement, propName: string, descriptor: PropertyDescriptor) => void; export declare const watch: (path: string, options?: Omit) => (target: QuarkElement, propName: string, descriptor: PropertyDescriptor) => void; export declare function customElement(params: string | { tag: string; style?: string; }): (target: typeof QuarkElement) => void; export declare class QuarkElement extends HTMLElement implements ReactiveControllerHost { static h: any; static Fragment: any; private _updatedQueue; /** 组件是否已挂载 */ private _mounted; private _renderWatcher; private queueUpdated; private hasOwnLifeCycleMethod; private hasDidUpdateCb; /** handler for processing tasks after render */ postRender(): void; protected static getStateDescriptor(propName: string): (defaultValue?: any) => { get(this: QuarkElement): any; set(this: QuarkElement, newValue: string | boolean | null): void; configurable: boolean; enumerable: boolean; }; static createProperty(propName: string, options: PropertyDeclaration): void; static createState(propName: string): void; static computed(propName: string, descriptor: PropertyDescriptor): void; static watch(propName: string, descriptor: PropertyDescriptor, path: string, options?: UserWatcherOptions): void; private eventController; private _controllers?; private rootPatch; private _render; /** sync property with its attribute counterpart */ private _updateObservedProps; /** * Registers a `ReactiveController` to participate in the element's reactive * update cycle. The element automatically calls into any registered * controllers during its lifecycle callbacks. * * If the element is connected when `addController()` is called, the * controller's `hostConnected()` callback will be immediately called. * @category controllers */ addController(controller: ReactiveController): void; /** * Removes a `ReactiveController` from the element. * @category controllers */ removeController(controller: ReactiveController): void; requestUpdate(): void; update(): void; $on: (eventName: string, eventHandler: EventHandler, el?: Element) => void; $emit(eventName: string, customEventInit?: CustomEventInit): boolean; $nextTick(cb: (...args: any[]) => any): false | Promise; /** * 此时组件 dom 已插入到页面中,等同于 connectedCallback() { super.connectedCallback(); } */ componentDidMount(): void; /** * disconnectedCallback 触发时、dom 移除前执行,等同于 disconnectedCallback() { super.disconnectedCallback(); } */ componentWillUnmount(): void; /** * @deprecated * since we have embraced more precisely controlled render scheduler mechanism, * there's no need to use shouldComponentUpdate any more, * and will be removed in next major version. * * 控制当前属性变化是否导致组件渲染 * @param propName 属性名 * @param oldValue 属性旧值 * @param newValue 属性新值 * @returns boolean */ shouldComponentUpdate(propName: string, oldValue: any, newValue: any): boolean; shouldPreventUpdate(propName: string, oldValue: any, newValue: any): boolean; /** @deprecated use \@watch directive instead for same purposes */ componentDidUpdate(propName: string, oldValue: any, newValue: any): void; /** called when all props and states updated */ componentUpdated(): void; /** * 组件的 render 方法, * 自动执行 this.shadowRoot.innerHTML = this.render() * @returns VNode */ render(): any; private getOrInitRenderWatcher; connectedCallback(): void; /** log old 'false' attribute value before resetting and removing it */ private _oldVals; attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void; disconnectedCallback(): void; }