forked from nativescript-vue/nativescript-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
87 lines (69 loc) · 2.55 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import {
Page,
NavigationEntry,
BackstackEntry,
} from '@nativescript/core'
import { ItemEventData } from '@nativescript/core'
import { Frame } from '@nativescript/core'
import { View } from '@nativescript/core'
import { ShowModalOptions } from '@nativescript/core'
import { Vue, VueConstructor, VueConfiguration } from 'vue/types/vue'
import ElementNode from './platform/nativescript/renderer/ElementNode'
// ListView ItemEventData with the addition of the item property
export type NativeScriptVueItemEventData<T> = ItemEventData & { item: T }
// TODO: define fully.
type TargetFrame = any;
export interface NavigationEntryVue extends NavigationEntry {
props?: Record<string, any>,
frame?: TargetFrame,
resolveOnEvent?: "navigatingTo" | "navigatedTo" | string
// Page.navigatingToEvent | Page.navigatedToEvent
}
export type navigateTo = (
component: Parameters<import('vue').CreateElement>[0],
options?: NavigationEntryVue,
cb?: () => Page,
) => Promise<Page>
export type navigateBack = (
options?: {
frame?: TargetFrame
},
backstackEntry?: BackstackEntry,
) => void
export interface ModalOptions extends Partial<ShowModalOptions> {
target?: any; // optional Vue target to open the modal from
props?: Record<string, any>;
}
// create a nativescript vue class that extends vue.js
export interface NativeScriptVue<V = View> extends Vue {
nativeView: V
$el: ElementNode
$navigateTo: navigateTo
$navigateBack: navigateBack
$modal?: { close: (data?: any) => void };
$showModal: (component: import('vue').ComponentOptions<Vue> | string, options?: ModalOptions) => Promise<any>;
/**
* starts the nativescript application
*/
$start: () => void
}
export interface NativeScriptVueConstructor extends VueConstructor<NativeScriptVue>
{
options: any
navigateTo: navigateTo
navigateBack: navigateBack
/**
* Registers NativeScript Plugin.
* @param elementName Name of the element to use in your template
* @param resolver function to register the element
* @param meta meta associated with the element
*/
registerElement: (elementName: string, resolver: Function, meta?: any) => void
config: NativeScriptVueConfiguration
}
interface NativeScriptVueConfiguration extends VueConfiguration {
suppressRenderLogs: boolean;
}
export const NativeScriptVue: NativeScriptVueConstructor
// export as namespace NativeScriptVue;
export default NativeScriptVue;