import Vnmf from '../../index' declare module '../../index' { namespace createIntersectionObserver { /** Options */ interface Option { /** Initial intersection ratio,If the intersection ratio detected on call is not equal to this value and reaches threshold,and triggers the echo function of a listening device。 */ initialRatio?: number /** Whether multiple target nodes are observed at the same time(Not one.),If set true ,observe It's... it's... targetSelector Several Nodes will be selected(Attention.:Selecting too many nodes at the same time will affect rendering performance.) */ observeAll?: boolean /** A numeric array,Include all thresholds。 */ thresholds?: number[] } } /** `IntersectionObserver` Object,Use to extrapolate whether certain nodes can be seen by the user、What's the percentage you can be seen by user?。 * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html */ interface IntersectionObserver { /** Stop listening.。The echo function will no longer trigger. * @supported weapp, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html */ disconnect(): void /** Specify target node and start listening to interlocking state changes * @supported weapp, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html */ observe( /** Selector */ targetSelector: string, /** A echo function to listen changes in the intersection status */ callback: IntersectionObserver.ObserveCallback, ): void /** Specify a node with the Selector,As one of the reference areas。 * @supported weapp, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html */ relativeTo( /** Selector */ selector: string, /** For extension(Or shrink.)Border of the area node layout by reference */ margins?: IntersectionObserver.RelativeToMargins, ): IntersectionObserver /** Specifies a page display area as one of the reference areas * @supported weapp, tt * @example * In the following example code:,If the target node(Use Selector .target-class Assign)Enter below display area 100px Hour,It triggers the echo function.。 * * ```tsx * Vnmf.createIntersectionObserver().relativeToViewport({bottom: 100}).observe('.target-class', (res) => { * res.intersectionRatio // Concurrent area as a proportion of the layout target node * res.intersectionRect // Intersection * res.intersectionRect.left // Coordinates of the left boundary conjoining area * res.intersectionRect.top // Upper boundary coordinates of the area intersection * res.intersectionRect.width // Width of the intersection area * res.intersectionRect.height // Height of the intersection area * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeToViewport.html */ relativeToViewport( /** For extension(Or shrink.)Border of the area node layout by reference */ margins?: IntersectionObserver.RelativeToViewportMargins, ): IntersectionObserver } namespace IntersectionObserver { /** A echo function to listen changes in the intersection status */ type ObserveCallback = (result: ObserveCallbackResult) => void interface ObserveCallbackResult { /** Target boundary */ boundingClientRect: BoundingClientRectResult /** Intersection Ratio */ intersectionRatio: number /** Boundary of the conjoined area */ intersectionRect: IntersectionRectResult /** Borders of the reference area */ relativeRect: RelativeRectResult /** Time stamp at intersection detection */ time: number } /** Borders of the reference area */ interface RelativeRectResult { /** Lower border. */ bottom: number /** Left boundary */ left: number /** Right Boundary */ right: number /** Upper border */ top: number } /** Boundary of the conjoined area */ interface IntersectionRectResult { /** Lower border. */ bottom: number /** Height */ height: number /** Left boundary */ left: number /** Right Boundary */ right: number /** Upper border */ top: number /** Width */ width: number } /** Target boundary */ interface BoundingClientRectResult { /** Lower border. */ bottom: number /** Height */ height: number /** Left boundary */ left: number /** Right Boundary */ right: number /** Upper border */ top: number /** Width */ width: number } /** For extension(Or shrink.)Border of the area node layout by reference */ interface RelativeToMargins { /** Lower boundary of node layout area */ bottom?: number /** Left boundary of node layout area */ left?: number /** Right boundary of node layout area */ right?: number /** Upper boundary of node layout area */ top?: number } /** For extension(Or shrink.)Border of the area node layout by reference */ interface RelativeToViewportMargins { /** Lower boundary of node layout area */ bottom?: number /** Left boundary of node layout area */ left?: number /** Right boundary of node layout area */ right?: number /** Upper boundary of node layout area */ top?: number } } /** `MediaQueryObserver` Object,For listening to pages media query Changes in status,If the width of interface is within a specified range。 */ interface MediaQueryObserver { /** Start listening to pages media query Change */ observe(descriptor: MediaQueryObserver.descriptor, callback: MediaQueryObserver.observeCallback): void /** Stop listening.。The echo function will no longer trigger. */ disconnect(): void } namespace MediaQueryObserver { /** media query Descriptor */ interface descriptor { /** Minimum Width of Pages (Units: px) */ minWidth: number /** Maximum width of the page (Units: px) */ maxWidth: number /** Page Width (Units: px) */ width: number /** Minimum height of the page (Units: px) */ minHeight: number /** Maximum height of the page(px in units) */ maxHeight: number /** Page Height(px in units) */ height: number /** Screen Orientation */ orientation: 'landscape' | 'portrait' } /** Listening. media query Echo function for state change */ type observeCallback = (res: { /** Whether the current status of page meets specified media query */ matches: boolean }) => void } /** Use to get `WXML` Object of node information * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html */ interface NodesRef { /** Query request to add the layout of node。Relative to Show Area,Pixels。It's similar to the function. DOM It's... it's... `getBoundingClientRect`。Back `NodesRef` Corresponding `SelectorQuery`。 * @supported weapp, h5, tt * @example * ```tsx * Vnmf.createSelectorQuery().select('#the-id').boundingClientRect(function(rect){ * rect.id // NodeID * rect.dataset // Nodedataset * rect.left // Left boundary coordinates of nodes * rect.right // Right boundary coordinates of nodes * rect.top // Upper boundary coordinates of nodes * rect.bottom // Lower boundary coordinates of nodes * rect.width // Width of nodes * rect.height // Height of the Node * }).exec() * @example * ``` * ```tsx * Vnmf.createSelectorQuery().selectAll('.a-class').boundingClientRect(function(rects){ * rects.forEach(function(rect){ * rect.id // NodeID * rect.dataset // Nodedataset * rect.left // Left boundary coordinates of nodes * rect.right // Right boundary coordinates of nodes * rect.top // Upper boundary coordinates of nodes * rect.bottom // Lower boundary coordinates of nodes * rect.width // Width of nodes * rect.height // Height of the Node * }) * }).exec() * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.boundingClientRect.html */ boundingClientRect( /** Reciprocal function,Under implementation `SelectorQuery.exec` After methodology,Node information will be available. `callback` Back in, back in.。 */ callback?: NodesRef.BoundingClientRectCallback, ): SelectorQuery /** Add Node Context Object Query Request。Current Support [VideoContext](/docs/apis/media/video/VideoContext)、[CanvasContext](/docs/apis/canvas/CanvasContext)、[LivePlayerContext](/docs/apis/media/live/LivePlayerContext)、[EditorContext](/docs/apis/media/editor/EditorContext)and [MapContext](/docs/apis/media/map/MapContext) Retrieve。 * @supported weapp, h5, tt * @example * ```tsx * Vnmf.createSelectorQuery().select('.the-video-class').context(function (res) { * console.log(res.context) // Node corresponding Context Object。Like:The selected node is