UNPKG

@hippy/vue-next

Version:

Vue-Next binding for Hippy native framework

1,478 lines (1,364 loc) 39.2 kB
import { App } from '@vue/runtime-core'; import { Component } from '@vue/runtime-core'; import type { ComponentPublicInstance } from '@vue/runtime-core'; export declare interface AnimationInstance { create: () => void; start: () => void; reset: () => void; resume: () => void; pause: () => void; destroy: () => void; addAnimationEvent: () => void; removeAnimationEvent: () => void; } declare interface AnimationModule { createAnimation: (flag: boolean, mode: string, fullOption: Record<string, NeedToTyped>) => number; startAnimation: (animationId: number) => void; createAnimationSet: (flag: boolean, options: CreateAnimationSetOptions) => number; resumeAnimation: (animationId: number) => void; pauseAnimation: (animationId: number) => void; destroyAnimation: (animationId: number) => void; } declare interface AnimationStyle { animationId: number; animation: HippyTypes.AnimationInstance; } declare interface AsyncStorage { getAllKeys: () => Promise<string[]>; getItem: (key: string) => Promise<string>; multiGet: (keys: string[]) => Promise<string[]>; multiRemove: (keys: string[]) => Promise<void>; multiSet: (keys: { [key: string]: string | number; }) => Promise<void>; removeItem: (key: string) => Promise<void>; setItem: (key: string, value: string | number) => Promise<void>; } /** * physical return button processing * * @public */ export declare const BackAndroid: { /** * exit APP */ exitApp(): void; /** * Add physical button listener events * * @param handler - handler method * */ addListener(handler: any): { remove(): void; }; /** * Remove physical button listener events * * @param handler - handler method */ removeListener(handler: any): void; /** * Initialize event listeners */ initEventListener(): void; }; /** * @public */ export declare type CallbackType = Function; declare type CallNativeFunctionSignature<K extends keyof NativeInterfaceMap, T extends keyof NativeInterfaceMap[K]> = NativeInterfaceMap[K][T] extends (...args: NeedToTyped[]) => NeedToTyped ? NativeInterfaceMap[K][T] : never; declare interface CallNativeFunctionType { <K extends keyof NativeInterfaceMap, T extends keyof NativeInterfaceMap[K]>(moduleName: K, methodName: T, ...args: Parameters<CallNativeFunctionSignature<K, T>>): void; call: <K extends keyof NativeInterfaceMap, T extends keyof NativeInterfaceMap[K], U>(thisType: U, moduleName: K, methodName: T, ...args: Parameters<CallNativeFunctionSignature<K, T>>) => void; } declare interface CallNativeWithPromiseType { <K extends keyof NativeInterfaceMap, T extends keyof NativeInterfaceMap[K]>(moduleName: K, methodName: T, ...args: Parameters<CallNativeFunctionSignature<K, T>>): Promise<ReturnType<CallNativeFunctionSignature<K, T>>>; call: <K extends keyof NativeInterfaceMap, T extends keyof NativeInterfaceMap[K], U>(thisType: U, moduleName: K, methodName: T, ...args: Parameters<CallNativeFunctionSignature<K, T>>) => Promise<ReturnType<CallNativeFunctionSignature<K, T>>>; } declare type CallUIFunctionArgs = [nodeId: number, funcName: string, args: NeedToTyped] | [ componentName: string, nodeId: number, funcName: string, args: NeedToTyped ]; declare interface ClipboardModule { getString: () => string; setString: (content: string) => void; } declare interface CloseArgs { id: number; reason: string; code: number; } /** * @public */ export declare interface CommonMapParams { [key: string]: NeedToTyped; } /** * common map param type * * @public */ declare interface CommonMapParams_2 { [key: string]: any; } declare interface ConnectArgs { headers: { [x: string]: NeedToTyped; }; url: string; } declare interface ConnectResp { id: number; code: number; } export declare class ContentSizeEvent extends HippyEvent { width?: number; height?: number; } declare type convertToNativeNodesReturnedVal = [ nativeLanguages: HippyTypes.TranslatedNodes[], eventLanguages: HippyTypes.EventNode[], printedLanguages: HippyTypes.PrintedNode[] ]; declare interface CreateAnimationSetOptions { repeatCount: string | number; children: AnimationStyle[]; } /** * create client side render vue app instance * * @param vueRootComponent - vue root component * @param options - hippy init options * * @public */ export declare const createApp: (vueRootComponent: Component, options: HippyAppOptions) => HippyApp; /** * Create Hippy Vue instance * * @param app - instance of vue app * @param options - initialization parameters * * @public */ export declare const createHippyApp: (app: App, options: HippyAppOptions) => HippyApp; /** * create server side render vue app instance * * @param vueRootComponent - vue root component * @param options - hippy init options * * @public */ export declare const createSSRApp: (vueRootComponent: Component, options: HippyAppOptions) => HippyApp; declare type CssAttribute = CommonMapParams_2; /** * css node declaration type * * @public */ declare interface CssDeclarationType { type: string; property: string; value: string | number; } /** * CSS node * * @public */ declare interface CssNode { [key: string]: NeedToTyped_2; } /** * CSS AST type * * @public */ export declare interface CssNodeType { type: string; selectors: string[]; declarations: CssDeclarationType[]; } /** * parse css options * * @public */ declare interface CssParserOption { source: number; silent?: boolean; } declare interface DeviceEventModule { invokeDefaultBackPressHandler: () => void; setListenBackPress: (flag: boolean) => void; } declare interface Dimensions { window: ScreenInfo; screen: ScreenInfo; } declare interface DocSelector { sel: SelectorCore; pos: number; } declare interface DOMRect_2 { x: number | undefined; y: number | undefined; top: number | undefined; left: number | undefined; bottom: number | undefined; right: number | undefined; width: number | undefined; height: number | undefined; } export { DOMRect_2 as DOMRect } export declare interface ElementComponent { component: TagComponent; } /** * EventBus for global event handle */ export declare const EventBus: { /** * add event listener * * @param event - event name * @param callback - callback function * @param ctx - context */ $on(event: string | Array<string>, callback: CallbackType, ctx?: NeedToTyped): any; /** * add event listener, only execute once * * @param event - event name * @param callback - callback function * @param ctx - context */ $once(event: string, callback: CallbackType, ctx?: NeedToTyped): any; /** * emit event * * @param event - event name * @param args - event params */ $emit(event: string, ...args: NeedToTyped): any; /** * remove global event listener. remove all if no params * * @param event - event name * @param callback - callback function */ $off(event?: string | Array<string>, callback?: CallbackType): any; }; export declare function eventIsKeyboardEvent(event: HippyEvent): event is HippyKeyboardEvent; declare interface EventListener_2 { callback: CallbackType; options?: EventListenerOptions_2; } declare interface EventListenerOptions_2 { [key: string]: string | boolean; } declare interface EventListeners { [eventName: string]: EventListener_2[] | undefined; } export declare type EventsUnionType = MapToUnion<HippyGlobalEventHandlersEventMap>; export declare class ExposureEvent extends HippyEvent { exposureInfo?: { [key: string]: NeedToTyped; }; } declare class FocusEvent_2 extends HippyEvent { isFocused?: boolean; } export { FocusEvent_2 as FocusEvent } /** * get css map * * @param styles - style list * @param beforeLoadStyle - before load style hook * @public */ export declare function getCssMap(styles?: any[], beforeLoadStyle?: Function): SelectorsMap; /** * get the component information of the specified tag * * @param tagName - tag name */ export declare function getTagComponent(tagName: string): TagComponent; export declare const HIPPY_DEBUG_ADDRESS: string; /** * The name of the global to-be-removed style store identifier * When using hot update, expired styles will be added to the global dispose style * * @public */ export declare const HIPPY_GLOBAL_DISPOSE_STYLE_NAME = "__HIPPY_VUE_DISPOSE_STYLES__"; /** * Global style store identifier name * * @public */ export declare const HIPPY_GLOBAL_STYLE_NAME = "__HIPPY_VUE_STYLES__"; export declare const HIPPY_STATIC_PROTOCOL = "hpfile://"; /** * the key of generate hippy unique id */ export declare const HIPPY_UNIQUE_ID_KEY = "hippyUniqueId"; export declare const HIPPY_VUE_VERSION = "3.3.2"; /** * Hippy App type, override the mount method of Vue * * @public */ export declare type HippyApp = App & { $start: (afterCallback?: CallbackType) => Promise<{ superProps: NeedToTyped; rootViewId: number; }>; }; /** * options type of initialization parameters * * @public */ export declare interface HippyAppOptions { appName: string; iPhone?: IphoneOptions; styleOptions?: { beforeLoadStyle?: (decl: CssDeclarationType) => CssDeclarationType; ratioBaseWidth?: number; }; silent?: boolean; trimWhitespace?: boolean; ssrNodeList?: SsrNode[]; } /** * @public * * cache initialization parameters passed by native, instance */ export declare interface HippyCachedInstanceType { rootContainer?: string; rootViewId: number; superProps: NeedToTyped; app: App; instance?: ComponentPublicInstance; ratioBaseWidth: number; } /** * HippyElement * * @public */ export declare class HippyElement extends HippyNode { /** * process the rem in the style unit and return the actual size value * * @param styleObject - style */ static parseRem(styleObject: NativeNodeProps): NativeNodeProps; tagName: string; id: string; classList: Set<string>; attributes: NativeNodeProps; style: NativeNodeProps; processedStyle: NativeNodeProps; events: NativeNodeProps; value?: string; filterAttribute?: CallbackType; beforeLoadStyle: CallbackType; textContent?: string; ssrInlineStyle?: NativeNodeProps; protected polyfillNativeEvents?: (method: string, eventNames: string, callback: CallbackType, options?: EventListenerOptions_2) => { eventNames: string; callback: CallbackType; options?: EventListenerOptions_2; }; private scopedIdList; constructor(tagName: string, ssrNode?: SsrNode); /** * get component info */ get component(): TagComponent; /** * determine whether the current node is the root node */ isRootNode(): boolean; /** * append child node * * @param child - child node * @param isHydrate - is hydrate or not */ appendChild(child: HippyNode, isHydrate?: boolean): void; /** * Insert the node before the specified node * * @param child - node to be added * @param referenceNode - reference node */ insertBefore(child: HippyNode, referenceNode: HippyNode | null): void; /** * move child node before specified node * * @param child - child node that needs to be moved * @param referenceNode - reference node */ moveChild(child: HippyNode, referenceNode: HippyNode): void; /** * remove child node * * @param child - node to be removed */ removeChild(child: HippyNode): void; /** * Check if an attribute is included * * @param key - attribute name */ hasAttribute(key: string): boolean; /** * get value of attribute * * @param key - attribute name */ getAttribute(key: string): NeedToTyped; /** * remove specified attribute * * @param key - attribute name */ removeAttribute(key: string): void; /** * set attribute * * @param rawKey - attribute name * @param rawValue - attribute value * @param options - options */ setAttribute(rawKey: string, rawValue: NeedToTyped, options?: NeedToTyped): void; /** * set text * * @param text - text content * @param options - options */ setText(text: string, options?: NeedToTyped): void; /** * remove style attr */ removeStyle(notToNative?: boolean): void; /** * set styles batch * * @param batchStyles - batched style to set */ setStyles(batchStyles: Record<string, NeedToTyped>): void; /** * set style * * @param property - property name * @param value - property value * @param notToNative - not pass to native */ setStyle(property: string, value: NeedToTyped, notToNative?: boolean): void; /** * Scroll children to specific position. */ scrollToPosition(x?: number | undefined, y?: number | undefined, rawDuration?: number | boolean): void; /** * Native implementation for the Chrome/Firefox Element.scrollTop method */ scrollTo(x: number | { left: number; top: number; behavior: string; duration: number | boolean; }, y?: number, duration?: number | boolean): void; setListenerHandledType(key: string, type: any): void; isListenerHandled(key: string, type: any): boolean; /** * parse vue event name to native event name and return * * @param eventName - vue event name */ getNativeEventName(eventName: string): string; /** * add element event listener * * @param rawEventNames - event names * @param rawCallback - callback * @param rawOptions - options */ addEventListener(rawEventNames: string, rawCallback: CallbackType, rawOptions?: EventListenerOptions_2): void; /** * remove event listener * * @param rawEventNames - event type * @param rawCallback - callback * @param rawOptions - options */ removeEventListener(rawEventNames: string, rawCallback: CallbackType, rawOptions?: EventListenerOptions_2): void; /** * dispatch event * * @param rawEvent - event object * @param targetNode - target hippy element * @param domEvent - raw dom event object */ dispatchEvent(rawEvent: HippyEvent, targetNode: HippyElement, domEvent: HippyTypes.DOMEvent): void; /** * convert hippy vue node to Native Node * * @param isIncludeChild - should or no convert child node recursive */ convertToNativeNodes(isIncludeChild: boolean, refInfo?: HippyTypes.ReferenceInfo): convertToNativeNodesReturnedVal; /** * When loaded via HMR or dynamically, redraw the element with the latest style map */ repaintWithChildren(): void; /** * set native style props */ setNativeProps(nativeProps: NeedToTyped): void; /** * Set pressed state * * @param pressed - whether to press */ setPressed(pressed: boolean): void; /** * Set hot zone * * @param x - x coordinate * @param y - y coordinate */ setHotspot(x: number, y: number): void; /** * save scoped id for element * * @param scopeStyleId - scoped style id */ setStyleScope(scopeStyleId: NeedToTyped): void; /** * get style scoped id */ get styleScopeId(): any[]; /** * get the inline style */ private getInlineStyle; /** * get the style attribute of the node according to the global style sheet */ private getNativeStyles; /** * get the props of the Native node, the properties include the properties of the node and * the default properties of the component to which the node belongs */ private getNativeProps; /** * Get the attributes of the target node for chrome inspector */ private getNodeAttributes; /** * Get the list of events bound to the node and convert it to the list required by the native node event properties */ private getNativeEvents; /** * Unified invocation of logic that requires special handling */ private hackSpecialIssue; /** * Fix the problem that the v-show does not take effect * */ private fixVShowDirectiveIssue; } /** * Hippy event base class * * @public */ export declare class HippyEvent { timeStamp: number; type: string; target: HippyElement | null; currentTarget: HippyElement | null; originalTarget: HippyElement | null; bubbles: boolean; nativeParams?: NeedToTyped; protected cancelable: boolean; protected eventPhase: number; private isCanceled; constructor(eventName: string); get canceled(): boolean; /** * Prevent events from continuing to bubble up */ stopPropagation(): void; /** * Block default behavior of events */ preventDefault(): void; } /** * Hippy Event Target */ declare abstract class HippyEventTarget { /** * Find the index position of the matching callback in the event callback list * * @param list - list of event listeners * @param callback - call back * @param options - options * */ private static indexOfListener; protected listeners: EventListeners; /** * add event listener * * @param type - event name * @param callback - callback * @param options - options */ addEventListener(type: string, callback: CallbackType, options?: EventListenerOptions_2): void; /** * remove event listener * * @param type - event name * @param callback - callback * @param options - options */ removeEventListener(type: string, callback: CallbackType, options?: EventListenerOptions_2): void; /** * emit event * * @param event - event object */ emitEvent(event: HippyEvent): void; /** * Get the list of events bound to the current node */ getEventListenerList(): EventListeners; } export declare interface HippyGlobalEventHandlersEventMap { onScroll: HippyTouchEvent; onMomentumScrollBegin: HippyTouchEvent; onMomentumScrollEnd: HippyTouchEvent; onScrollBeginDrag: HippyTouchEvent; onScrollEndDrag: HippyTouchEvent; onTouchDown: HippyTouchEvent; onTouchMove: HippyTouchEvent; onTouchEnd: HippyTouchEvent; onTouchCancel: HippyTouchEvent; onFocus: FocusEvent_2; onDelete: ListViewEvent; onChangeText: HippyKeyboardEvent; onEndEditing: HippyKeyboardEvent; onSelectionChange: HippyKeyboardEvent; onKeyboardWillShow: HippyKeyboardEvent; onContentSizeChange: ContentSizeEvent; onLoad: HippyLoadResourceEvent; onLoadStart: HippyLoadResourceEvent; onLoadEnd: HippyLoadResourceEvent; onExposureReport: ExposureEvent; onPageSelected: ViewPagerEvent; onPageScroll: ViewPagerEvent; onPageScrollStateChanged: ViewPagerEvent; onHeaderPulling: HippyTouchEvent; onFooterPulling: HippyTouchEvent; onLayout: HippyLayoutEvent; } /** * Hippy input element, such as input, textarea * * @public */ export declare class HippyInputElement extends HippyElement { /** * set text content of input element * * @param text - text content * @param options - options */ setText(text: string, options?: NeedToTyped): void; /** * get value of input element */ getValue(): Promise<string>; /** * set value of input element */ setValue(value: string): void; /** * get the focus */ focus(): void; /** * make the element lose focus */ blur(): void; /** * clear content */ clear(): void; /** * get text input focus status */ isFocused(): Promise<boolean>; } export declare class HippyKeyboardEvent extends HippyEvent { value?: string | NeedToTyped; start?: number; end?: number; keyboardHeight?: number; keyCode?: number; } /** * layout event */ export declare class HippyLayoutEvent extends HippyEvent { top?: number; left?: number; bottom?: number; right?: number; width?: number; height?: number; } /** * Hippy list element, such as ul * * @public */ export declare class HippyListElement extends HippyElement { /** * scroll to specified index */ scrollToIndex(indexLeft?: number, indexTop?: number, needAnimation?: boolean): void; /** * scroll to specified offset */ scrollToPosition(posX?: number | undefined, posY?: number | undefined, needAnimation?: boolean): void; } export declare class HippyLoadResourceEvent extends HippyEvent { url?: string; success?: boolean; error?: string; width?: number; height?: number; } /** * hippy node base class, including the basic Node operation methods * and attributes required to build a tree structure Node * inherited from the EventTarget class * * @public */ export declare class HippyNode extends HippyEventTarget { /** * get the unique node id, which is used to uniquely identify the terminal Native node */ private static getUniqueNodeId; isNeedInsertToNative: boolean; isMounted: boolean; nodeId: number; nodeType: NodeType; events: NativeNodeProps; childNodes: HippyNode[]; parentNode: HippyNode | null; prevSibling: HippyNode | null; nextSibling: HippyNode | null; protected tagComponent: TagComponent | null; constructor(nodeType: NodeType, ssrNode?: SsrNode); /** * get the first child node */ get firstChild(): HippyNode | null; /** * get the last child node */ get lastChild(): HippyNode | null; /** * get the native component information corresponding to the node */ get component(): TagComponent; /** * get the index of this node in the sibling node, starting from zero */ get index(): number; /** * whether the current node is the root node */ isRootNode(): boolean; /** * has child nodes or not, used for hydrate */ hasChildNodes(): boolean; /** * Insert the node before the specified node * * @param rawChild - node to be added * @param rawAnchor - anchor node */ insertBefore(rawChild: HippyNode, rawAnchor: HippyNode | null): void; /** * move child node before specified node * * @param rawChild - child node that needs to be moved * @param rawAnchor - anchor node */ moveChild(rawChild: HippyNode, rawAnchor: HippyNode | null): void; /** * append child node * * @param rawChild - child node to be added * @param isHydrate - is hydrate operate or not */ appendChild(rawChild: HippyNode, isHydrate?: boolean): void; /** * remove child node * * @param rawChild - child node to be removed */ removeChild(rawChild: HippyNode): void; /** * Find child nodes that match a given condition * * @param condition - condition callback */ findChild(condition: CallbackType): HippyNode | null; /** * Traverse all child nodes including its own node and execute the incoming callback * * @param callback - callback */ eachNode(callback: CallbackType): void; /** * insert native node * * @param child - to be inserted node */ insertChildNativeNode(child: HippyNode, refInfo?: HippyTypes.ReferenceInfo): void; /** * move native node * * @param child - to be removed node */ moveChildNativeNode(child: HippyNode, refInfo?: HippyTypes.ReferenceInfo): void; /** * remove native node * * @param child - to be removed node */ removeChildNativeNode(child: HippyNode): void; /** * update native node * * @param isIncludeChildren - whether to update all descendant nodes at the same time */ updateNativeNode(isIncludeChildren?: boolean): void; /** * update native event */ updateNativeEvent(): void; /** * get native nodes * @param isIncludeChild - whether to update all descendant nodes at the same time * @param refInfo - reference information * @param extraAttributes - extra attributes */ convertToNativeNodes(isIncludeChild: boolean, refInfo?: HippyTypes.ReferenceInfo, extraAttributes?: Partial<NativeNode>): convertToNativeNodesReturnedVal; } /** * touch event */ export declare class HippyTouchEvent extends HippyEvent { offsetX?: number; offsetY?: number; touches?: { [key: number]: { clientX: number; clientY: number; }; length: number; }; contentOffset?: { x: number; y: number; } | number; scrollHeight?: number; scrollWidth?: number; } declare interface Http { request: (params: HttpRequestParams, callback: (res: NativeRequestResponse) => void) => void; } declare interface HttpRequestParams { method: string; data?: Record<string, NeedToTyped>; headers: Record<string, string>; url: string; } declare interface ImageLoaderModule { getSize: (url: string) => { width: number; height: number; }; prefetch: (url: string) => void; } declare interface ImageSize { width: number; height: number; } /** * Additional configuration information for iPhone * * @public */ export declare interface IphoneOptions { statusBar?: { disabled?: boolean; backgroundColor?: number; backgroundImage?: string; }; } export declare const IS_PROD: boolean; /** * return tag is native tag or not * * @param tag - tag name */ export declare function isNativeTag(tag: string): boolean; export declare class ListViewEvent extends HippyEvent { index?: number; } export declare type MapToUnion<I> = { [k in keyof I]: { __evt: k; handler: I[k]; }; }[keyof I]; export declare interface MeasurePosition { top: number; left: number; bottom: number; right: number; width: number; height: number; } /** * Native interfaces * * @public */ export declare const Native: NativeApiType; export declare const NATIVE_COMPONENT_MAP: { View: string; Image: string; ListView: string; ListViewItem: string; Text: string; TextInput: string; WebView: string; VideoPlayer: string; ScrollView: string; }; /** * Native api type * * @public */ export declare interface NativeApiType { hippyNativeDocument: { createNode: () => void; updateNode: () => void; deleteNode: () => void; flushBatch: () => void; callUIFunction: (id: NeedToTyped, name: NeedToTyped, param?: NeedToTyped, cb?: NeedToTyped) => void; sendRenderError: (error: Error) => void; }; hippyNativeRegister: { regist: CallbackType; }; Localization: { direction: number; }; Platform: string; PixelRatio: number; AsyncStorage: AsyncStorage; Clipboard: { getString: () => Promise<string>; setString: (content: string) => void; }; Cookie: { getAll: (url: string) => Promise<string>; set: (url: string, keyValue: string, expireDate?: Date) => void; }; APILevel: string | null; Device: string | undefined; isIPhoneX: boolean; OnePixel: number; OSVersion: string | null; SDKVersion: string | null; screenIsVertical: boolean; NetInfo: { fetch: () => Promise<string>; addEventListener: (eventName: string, listener: CallbackType) => NetInfoRevoker; removeEventListener: (eventName: string, listener: CallbackType | NetInfoRevoker) => void; }; ImageLoader: { getSize: (url: string) => Promise<ImageSize>; prefetch: (url: string) => void; }; Dimensions: Dimensions; callNative: CallNativeFunctionType; callNativeWithPromise: CallNativeWithPromiseType; callNativeWithCallbackId: <K extends keyof NativeInterfaceMap, T extends keyof NativeInterfaceMap[K]>(moduleName: K, methodName: T, ...args: Parameters<CallNativeFunctionSignature<K, T>>) => number; callUIFunction: (el: Record<string, NeedToTyped>, funcName: NeedToTyped, ...args: NeedToTyped[]) => void; isAndroid: () => boolean; isIOS: () => boolean; measureInWindow: (el: HippyNode) => Promise<MeasurePosition>; measureInAppWindow: (el: HippyNode) => Promise<MeasurePosition>; getBoundingClientRect: (el: HippyNode, options?: { relToContainer?: boolean; }) => Promise<DOMRect_2>; parseColor: (color: string, options?: { platform: string; }) => number; getElemCss: (element: HippyElement) => NeedToTyped; version?: string; ConsoleModule: NeedToTyped; } export declare interface NativeInterfaceMap { UIManagerModule: UiManagerModule; ImageLoaderModule: ImageLoaderModule; websocket: Websocket; NetInfo: NetInfo; ClipboardModule: ClipboardModule; network: Network; AnimationModule: AnimationModule; DeviceEventModule: DeviceEventModule; http: Http; TestModule: TestModule; } /** * @public */ declare interface NativeNode { id: number; pId: number; index: number; name?: string; tagName?: string; props?: NativeNodeProps; } declare interface NativeNodeProps { [key: string]: NeedToTyped; } declare interface NativeRequestBaseResponse { success: boolean; code: number; } declare interface NativeRequestError extends NativeRequestBaseResponse { type: 'ERROR'; errorText: string; } declare type NativeRequestResponse = NativeRequestSuccess | NativeRequestError; declare interface NativeRequestSuccess extends NativeRequestBaseResponse { type: 'SUCCESS'; data: { code: number; result: { code: number; data: NeedToTyped; }[]; }; } /** * @public */ export declare type NeedToTyped = any; declare type NeedToTyped_2 = any; declare interface NetInfo { getCurrentConnectivity: () => NetStatus; addListener: (eventName: string) => void; removeListener: (eventName: string) => void; } /** * network info revoker */ declare interface NetInfoRevoker { eventName?: string; listener?: CallbackType; remove: () => void; } declare interface NetStatus { network_info: string; } declare interface Network { getCookie: (url: string) => string; setCookie: (url: string, keyValue: string, expireStr: string) => void; } declare enum NodeType { ElementNode = 1, TextNode = 3, CommentNode = 8, DocumentNode = 4 } /** * parse css code into AST tree * * @param css - css code * @param options - parse options * * @public */ export declare function parseCSS(css: string, options?: CssParserOption): CssNode; /** * register component information for the specified tag * * @param tagName - tag name * @param elementComponent - tag component */ export declare function registerElement(tagName: string, elementComponent: ElementComponent): void; /** * Rule Set */ declare class RuleSet { selectors: SelectorCore[]; declarations: CssDeclarationType[]; hash: string; constructor(selectors: RuleSetSelector[], declarations: CssDeclarationType[], hash: string); toString(): string; lookupSort(sorter: SelectorsMap): void; removeSort(sorter: SelectorsMap): void; } declare type RuleSetSelector = SelectorCore & { ruleSet: RuleSet; }; declare interface ScreenInfo { width: number; height: number; scale: number; fontScale: number; statusBarHeight: number; navigatorBarHeight: number; } export declare interface ScreenSize { width: number; height: number; } /** * Base classes */ declare class SelectorCore { dynamic?: boolean; specificity: number; ruleSet?: RuleSet; /** * Sort and store style rules according to categories, * such as id selectors are grouped into one category, class names are grouped into one category, etc. * * @param sorter - sort rules * @param base - base */ lookupSort(sorter: SelectorsMap, base?: SelectorCore): void; /** * remove sort * * @param sorter - sort rules * @param base - base */ removeSort(sorter: SelectorsMap, base?: SelectorCore): void; } /** * selectors map class * * @public * */ declare class SelectorsMap { /** * Remove the specified style from the style rules map * * @param map - style map * @param head - style key * @param sel - selector */ static removeFromMap(map: CssAttribute, head: string, sel: SelectorCore): void; id: CssAttribute; class: CssAttribute; type: CssAttribute; universal: DocSelector[]; position: number; ruleSets: RuleSet[]; constructor(ruleSets: RuleSet[]); /** * Append a new list of style rules * * @param appendRules - list of style rules */ append(appendRules: RuleSet[]): void; /** * Find the style in the list of style rules according to the hash value and delete it * * @param hash - hash of style chunk */ delete(hash: string): void; /** * Find the matching style information according to the id, class, attribute of the hippy node * * @param node - target node * @param ssrNodes - ssr node list */ query(node: StyleNode, ssrNodes?: StyleNodeList): SelectorsMatch; removeById(id: string, sel: SelectorCore): void; sortById(id: string, sel: SelectorCore): void; removeByClass(cssClass: string, sel: SelectorCore): void; sortByClass(cssClass: string, sel: SelectorCore): void; removeByType(cssType: string, sel: SelectorCore): void; sortByType(cssType: string, sel: SelectorCore): void; removeAsUniversal(sel: SelectorCore): void; sortAsUniversal(sel: SelectorCore): void; /** * add style selector to map * * @param map - style map * @param head - style key * @param sel - selector */ addToMap(map: CssAttribute, head: string, sel: SelectorCore): void; makeDocSelector(sel: SelectorCore): DocSelector; } /** * stores the Selector list matched by the node */ declare class SelectorsMatch { changeMap: any; selectors: any; constructor(); /** * Add attribute * * @param node - target node * @param attribute - attribute name */ addAttribute(node: StyleNode, attribute: any): void; /** * add pseudo class * * @param node - target node * @param pseudoClass - pseudo class */ addPseudoClass(node: StyleNode, pseudoClass: string): void; properties(node: StyleNode): CommonMapParams_2; } declare interface SendArgs { id: number; data: string; } export declare const _setBeforeRenderToNative: (hook: any, version: any) => void; /** * set size info of screen * * @param newScreenSize - size info * * @public */ export declare function setScreenSize(newScreenSize: ScreenSize): void; /** * SSR common type * * @public */ declare interface SsrCommonParams { [key: string]: NeedToTyped; } /** * SSR Node type * * @public */ export declare interface SsrNode { id: number; pId?: number; index: number; name: string; props: SsrNodeProps; tagName?: string; children?: SsrNode[]; } /** * SSR Node props type * * @public */ export declare type SsrNodeProps = SsrCommonParams; /** * style node type * * @public */ declare interface StyleNode { id: string; pId?: number; name?: string; tagName: string; classList: Set<string>; parentNode: StyleNode; nextSibling: StyleNode; props?: any; attributes?: any; } /** * style node list * * @public */ declare interface StyleNodeList { [key: string]: StyleNode; } export declare interface TagComponent { name: string; processEventData?: (evtData: EventsUnionType, nativeEventParams: NeedToTyped) => HippyEvent; eventNamesMap?: Map<string, string>; defaultNativeStyle?: NativeNodeProps; defaultNativeProps?: NativeNodeProps; nativeProps?: NativeNodeProps; attributeMaps?: NativeNodeProps; } declare interface TestModule { remoteDebug: (rootViewId: number, bundleUrl: string) => void; } /** * Convert css color value or string description to native supported color format * * @param color - color value or string description * * @public */ export declare function translateColor(color: string | number): number; declare interface UiManagerModule { callUIFunction: (args: CallUIFunctionArgs, callback?: (...params: NeedToTyped[]) => NeedToTyped) => void; measureInWindow: (nodeId: number, callback: CallbackType) => void; measureInAppWindow: (nodeId: number, callback: CallbackType) => void; getBoundingClientRect: (nodeId: number, options: NeedToTyped, callback: CallbackType) => void; } export declare class ViewPagerEvent extends HippyEvent { currentSlide?: number; nextSlide?: number; state?: string; offset?: number; } declare interface Websocket { connect: (args: ConnectArgs) => ConnectResp; send: (args: SendArgs) => void; close: (args: CloseArgs) => void; } export { }