import React from 'react' import Vue from 'vue' import Vnmf, { Config } from './index' declare module './index' { // ref: packages/vnmf-runtime/src/current.ts interface RouterInfo> = Partial>> { /** Routing parameter */ params: TParams /** Page path */ path: string onReady: string onHide: string onShow: string shareTicket: string | undefined scene: number | undefined exitState?: any } interface Show { componentDidShow?(): void componentDidHide?(): void onShow?(): void onHide?(): void } interface AppInstance extends Show { mount(component: React.Component | Vue.ComponentOptions, id: string, cb: (...args: any[]) => void): void componentDidShow?(options?: Record): void onShow?(options?: Record): void unmount(id: string, cb?: () => void): void } type Target = Record & { dataset: Record; id: string } interface MpEvent { type: string detail: Record target: Target currentTarget: Target } interface PageLifeCycle extends Show { eh?(event: MpEvent): void onLoad(options: Record): void onOptionMenuClick?(): void onPageScroll?(opt: PageScrollObject): void onPopMenuClick?(): void onPullDownRefresh?(): void onPullIntercept?(): void onReachBottom?(): void onResize?(opt: PageResizeObject): void onShareAppMessage?(opt: ShareAppMessageObject): ShareAppMessageReturn onTabItemTap?(opt: TabItemTapObject): void onTitleClick?(): void onUnload(): void } interface ComponentInstance< TData extends Record = Record, TParams extends Record = Record > { /** The file path of the component */ is?: string /** node id */ id?: string /** node dataset */ dataset?: string /** Component data ,Including internal data and attribute values */ data?: TData /** Component data ,Including internal data and attribute values (and data Consistent ) */ properties?: TData /** Compared to the current custom component Router Object */ router?: RouterInfo /** Compared to the page where the current custom component is located Router Object */ pageRouter?: RouterInfo /** set up dataAnd execute the view layer rendering */ setData?(newData: Partial): void /** Check whether the component has behavior (When checking, recursive checks are all introduced directly or indirectly behavior) */ hasBehavior?(behavior: unknown): boolean /** trigger event ,See [Communication and events between components ](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) */ triggerEvent?(name: string, detail: Record, options: { /** Whether the event is bubbling */ bubbles?: boolean /** Whether the event can cross the component boundary ,for false Time ,The event will only be triggered on the node tree of the reference component ,Do not enter any other component */ composed?: boolean /** Whether the event has the capture stage */ capturePhase?: boolean }): void /** Create SelectorQuery Object ,Selector selection range is within this component instance */ createSelectorQuery?(): SelectorQuery /** Create IntersectionObserver Object ,Selector selection range is within this component instance */ createIntersectionObserver?(): IntersectionObserver /** Create MediaQueryObserver Object */ createMediaQueryObserver?(): MediaQueryObserver /** Use the selector to select the component instance node ,Return to the first component instance object of the matching (Will be wx://component-export influences ) */ selectComponent?< TD extends Record = Record, TP extends Record = Record >(selector: string): ComponentInstance /** Use the selector to select the component instance node ,Back to array composed of all component instance objects that match the matching (Will be wx://component-export influences ) */ selectAllComponents?< TD extends Record = Record, TP extends Record = Record >(selector: string): ComponentInstance /** Select the component instance where the current component node is located (That is the referencer of the component ),Return to its component instance object (Will be wx://component-export influences ) */ selectOwnerComponent?< TD extends Record = Record, TP extends Record = Record >(): ComponentInstance /** Obtain all the joint nodes corresponding to this relationship ,See [Inter -component relationship ](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/relations.html) */ getRelationNodes?(relationKey: string): NodesRef[] /** Execute immediately callback ,Many of them setData Do not trigger interface drawing between them (Only in some special scenes need ,Such as it is used for different components setData Drawing synchronization on the interface ) */ groupSetData?(callback: () => void): void /** Back to the current page custom-tab-bar Component instance ,For details [customize tabBar](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html) */ getTabBar?(): ComponentInstance /** Back to the page identifier (A string ),Can be used to determine whether several custom component instances are on the same page */ getPageId?(): string /** Execute key frame animation ,For details [Animation ](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */ animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void /** Rolling driver animation ,For details [Animation ](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */ animate?(selector: string, keyFrames: KeyFrame[], duration: number, scrollTimeline: ScrollTimelineOption): void /** Clear key frame animation ,For details [Animation ](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */ clearAnimation?(selector: string, callback: () => void): void /** Clear key frame animation ,For details [Animation ](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */ clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void /** Clear key frame animation ,For details [Animation ](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */ setUpdatePerformanceListener?(options: { /** Whether to return to change data Field information */ withDataPaths?: boolean }, listener: () => void): void } interface PageInstance extends PageLifeCycle, ComponentInstance { /** Page configuration */ config?: PageConfig /** Page initial data */ data?: Record /** Page path */ path?: string /** Page component options */ options?: Record } }