import { createApp, ComponentPublicInstance } from 'vue' export interface Vue { createApp: typeof createApp } export interface NVueEnvironment { platform: string // could be "Web", "iOS", "Android" osName: string // could be "iOS", "Android" or others osVersion: string appName: string // mobile app name or browser name appVersion: string // informations of current running device deviceModel: string // phone device model deviceWidth: number deviceHeight: number scale: number // only available on the web userAgent?: string dpr?: number rem?: number } export interface NVueConfigAPI { bundleUrl: string // document.URL bundleType: string env: NVueEnvironment } export interface NVue { config: NVueConfigAPI document: NVueDocument requireModule: (name: string) => Record | void supports: (condition: string) => boolean | void isRegisteredModule: (name: string, method?: string) => boolean isRegisteredComponent: (name: string) => boolean } export interface NVueTaskCenter { instanceId: string callbackManager: unknown send: ( type: string, params: Record, args: any[], options?: Record ) => void registerHook: ( componentId: string, type: string, hook: string, fn: Function ) => void updateData: ( componentId: string, data: Record | void, callback?: Function ) => void } export interface NVueDocument { id: string URL: string taskCenter: NVueTaskCenter open: () => void close: () => void createElement: ( tagName: string, props?: Record ) => NVueElement createText: (text: string) => Record createComment: (text: string) => Record fireEvent: (type: string) => void destroy: () => void } export interface NVueElement { nodeType: number nodeId: string type: string ref: string text?: string parentNode: NVueElement | null children: Array previousSibling: NVueElement | null nextSibling: NVueElement | null appendChild: (node: NVueElement) => void removeChild: (node: NVueElement, preserved?: boolean) => void insertBefore: (node: NVueElement, before: NVueElement) => void insertAfter: (node: NVueElement, after: NVueElement) => void setAttr: (key: string, value: any, silent?: boolean) => void setAttrs: (attrs: Record, silent?: boolean) => void setStyle: (key: string, value: any, silent?: boolean) => void setStyles: (attrs: Record, silent?: boolean) => void addEvent: (type: string, handler: Function, args?: Array) => void removeEvent: (type: string) => void fireEvent: (type: string) => void destroy: () => void } export interface NVueInstanceOption { instanceId: string config: NVueConfigAPI document?: NVueDocument Vue?: Vue app?: ComponentPublicInstance data?: Record } export interface NVueRuntimeContext { nvue: NVue service: Record BroadcastChannel?: Function SharedObject: Record } export interface NVueInstanceContext { Vue: Vue }