-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathClientContext.d.ts
More file actions
136 lines (120 loc) · 3.21 KB
/
ClientContext.d.ts
File metadata and controls
136 lines (120 loc) · 3.21 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import { NullstackEnvironment } from './Environment'
import { NullstackInstances } from './Instances'
import { NullstackFragment } from './JSX'
import { NullstackPage } from './Page'
import { NullstackParams } from './Params'
import { NullstackProject } from './Project'
import { NullstackRouter } from './Router'
import { NullstackSettings } from './Settings'
import { NullstackWorker } from './Worker'
/**
* @see https://nullstack.app/context
*/
interface BaseNullstackClientContext<TProps = unknown> {
/**
* Callback function that bootstrap the context for the application.
*/
start?: () => Promise<void>
/**
* Information about the document `head` metatags.
*
* @see https://nullstack.app/context-page
*/
page: NullstackPage
/**
* Information about the app manifest and some metatags.
*
* @see https://nullstack.app/context-project
*/
project: NullstackProject
/**
* Gives you granular control of your PWA behavior.
*
* @see https://nullstack.app/service-worker
*/
worker: NullstackWorker
/**
* It gives you information about the element dataset.
* Any `data-*` attributes will receive a respective camelized key on this object.
*
* @scope client
* @see https://nullstack.app/context-data
*/
data?: Record<string, string>
/**
* It gives you all active instances of the application.
* Adding a [key](https://nullstack.app/instance-self#instance-key) to a Component adds it here.
*
* @scope client
* @see https://nullstack.app/context-instances
*/
instances: NullstackInstances
/**
* It gives you information about the current environment.
*
* @see https://nullstack.app/context-environment
*/
environment: NullstackEnvironment
/**
* Each query string param is mapped to this object.
*
* @see https://nullstack.app/routes-and-params#params
* @example
* ```
* "/?expanded=true&page=2" ===
* {expanded: true, page: 2}
* ```
*/
params: NullstackParams
/**
* Nullstack router.
*
* @see https://nullstack.app/routes-and-params#router
*/
router: NullstackRouter
/**
* You can assign any key with any type of public information.
*
* @example
* ```
* // .env NULLSTACK_SETTINGS_PUBLIC_KEY
* settings.publicKey
* ```
* @see https://nullstack.app/context-settings
*/
settings: NullstackSettings
/**
* Children elements of this component.
*
* @see https://nullstack.app/renderable-components#components-with-children
*/
children: NullstackFragment
/**
* Bind object.
*
* @see https://nullstack.app/two-way-bindings#complex-bindable-components
*/
bind?: { property?: string | number; object?: any }
/**
* Bind value.
*
* @see https://nullstack.app/two-way-bindings#complex-bindable-components
*/
value?: any
/**
* Ref object.
*
* @see https://nullstack.app/refs#complex-refable-components
*/
ref?: TProps extends { ref: any } ? TProps['ref'] : {
object: any
property: string | number
}
/**
* Ref element.
*
* @see https://nullstack.app/refs#complex-refable-components
*/
element?: HTMLElement
}
export type NullstackClientContext<TProps = unknown> = BaseNullstackClientContext<TProps> & TProps