@lightningjs/blits 1.7.1 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/docs/essentials/displaying_text.md +53 -1
- package/docs/transitions_animations/transitions.md +21 -1
- package/index.d.ts +819 -14
- package/package.json +5 -4
- package/src/components/FPScounter.js +12 -0
- package/src/engines/L3/element.js +9 -1
- package/src/helpers/deepEqualArray.js +50 -0
- package/src/helpers/deepEqualArray.test.js +127 -0
- package/src/lib/codegenerator/generator.js +5 -6
- package/src/lib/reactivity/reactive.js +15 -8
- package/vite/msdfGenerator.js +89 -10
- package/src/application.d.ts +0 -174
- package/src/component.d.ts +0 -455
- package/src/launch.d.ts +0 -273
- package/src/plugin.d.ts +0 -71
package/src/application.d.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import {default as Component} from './component'
|
|
20
|
-
|
|
21
|
-
declare namespace Application {
|
|
22
|
-
|
|
23
|
-
interface Transition {
|
|
24
|
-
/**
|
|
25
|
-
* Name of the prop to transition (i.e. 'x', 'y', 'alpha', 'color')
|
|
26
|
-
*/
|
|
27
|
-
prop: string,
|
|
28
|
-
/**
|
|
29
|
-
* Value the prop should transition to (i.e. 0, 100, '#223388')
|
|
30
|
-
*/
|
|
31
|
-
value: any,
|
|
32
|
-
/**
|
|
33
|
-
* Duration of the transition in milliseconds, defaults to 300
|
|
34
|
-
*/
|
|
35
|
-
duration?: number,
|
|
36
|
-
/**
|
|
37
|
-
* Easing function to apply to the transition
|
|
38
|
-
*/
|
|
39
|
-
easing?: string,
|
|
40
|
-
/**
|
|
41
|
-
* Delay before the transition starts in milliseconds
|
|
42
|
-
*/
|
|
43
|
-
delay?: number
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
interface Before {
|
|
47
|
-
/**
|
|
48
|
-
* Name of the prop to set before the transition starts
|
|
49
|
-
*/
|
|
50
|
-
prop: string,
|
|
51
|
-
/**
|
|
52
|
-
* Value the prop to set before the transition starts
|
|
53
|
-
*/
|
|
54
|
-
value: any,
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
interface RouteTransition {
|
|
58
|
-
/**
|
|
59
|
-
* Setting or Array of Settings before new view enters into the router view
|
|
60
|
-
*/
|
|
61
|
-
before: Before | Before[],
|
|
62
|
-
/**
|
|
63
|
-
* Transition or Array of Transitions for new view to enters into the router view
|
|
64
|
-
*/
|
|
65
|
-
in: Transition | Transition[],
|
|
66
|
-
/**
|
|
67
|
-
* Transition or Array of Transitions for old view to leave the router view
|
|
68
|
-
*/
|
|
69
|
-
out: Transition | Transition[],
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
type RouteTransitionFunction = (previousRoute: Route, currentRoute: Route) => RequireAtLeastOne<RouteTransition>
|
|
73
|
-
|
|
74
|
-
interface RouteAnnounce {
|
|
75
|
-
/**
|
|
76
|
-
* Message to be announced
|
|
77
|
-
*/
|
|
78
|
-
message: String,
|
|
79
|
-
/**
|
|
80
|
-
* Politeness level
|
|
81
|
-
*
|
|
82
|
-
* Defaults to 'off'
|
|
83
|
-
*/
|
|
84
|
-
politeness?: 'off' | 'polite' | 'assertive'
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
type RequireAtLeastOne<T> = {
|
|
88
|
-
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>
|
|
89
|
-
}[keyof T]
|
|
90
|
-
|
|
91
|
-
interface RouteHooks {
|
|
92
|
-
before?: (to: Route, from: Route) => string | Route;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
type Route = {
|
|
96
|
-
/**
|
|
97
|
-
* URI path for the route
|
|
98
|
-
*/
|
|
99
|
-
path: string,
|
|
100
|
-
/**
|
|
101
|
-
* Component to load when activating the route
|
|
102
|
-
*/
|
|
103
|
-
component: Component,
|
|
104
|
-
/**
|
|
105
|
-
* Transition configuration for the route
|
|
106
|
-
*/
|
|
107
|
-
transition?: RequireAtLeastOne<RouteTransition> | RouteTransitionFunction,
|
|
108
|
-
/**
|
|
109
|
-
* Extra route options
|
|
110
|
-
*/
|
|
111
|
-
options?: object // todo: specify which options are available,
|
|
112
|
-
/**
|
|
113
|
-
* Message to be announced when visiting the route (often used for accessibility purposes)
|
|
114
|
-
*
|
|
115
|
-
* Can be either a `String` with the message or an object that defines the message and the
|
|
116
|
-
* politeness level
|
|
117
|
-
*/
|
|
118
|
-
announce?: String | RouteAnnounce
|
|
119
|
-
/**
|
|
120
|
-
* Register hooks for the route
|
|
121
|
-
*/
|
|
122
|
-
hooks?: RouteHooks
|
|
123
|
-
/**
|
|
124
|
-
* Route path parameters
|
|
125
|
-
*/
|
|
126
|
-
readonly params?: {
|
|
127
|
-
[key: string]: string | number
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Allows for attaching custom data to a route, either hardcoded in the
|
|
131
|
-
* route definition or asigned to the route object in a before hook
|
|
132
|
-
*
|
|
133
|
-
* Will be merged with the route params and navigation data and passed as
|
|
134
|
-
* props into the route component
|
|
135
|
-
*/
|
|
136
|
-
data?: {
|
|
137
|
-
[key: string]: any
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface ApplicationInstance extends Component.ComponentInstance {}
|
|
142
|
-
|
|
143
|
-
export interface ApplicationConfig<Props extends string, S, M> extends Component.ComponentConfig<Props, S, M> {
|
|
144
|
-
/**
|
|
145
|
-
* Routes definition
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
*
|
|
149
|
-
* ```js
|
|
150
|
-
* routes: [
|
|
151
|
-
* { path: '/', component: Home },
|
|
152
|
-
* { path: '/details', component: Details },
|
|
153
|
-
* { path: '/account', component: Account },
|
|
154
|
-
* ]
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
routes?: Route[]
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Blits.Application()
|
|
163
|
-
*
|
|
164
|
-
* Root App component
|
|
165
|
-
*/
|
|
166
|
-
declare function Application<
|
|
167
|
-
Props extends string,
|
|
168
|
-
S extends Component.State,
|
|
169
|
-
M extends Component.Methods
|
|
170
|
-
>(
|
|
171
|
-
config: Application.ApplicationConfig<Props, S, M>
|
|
172
|
-
) : Application.ApplicationInstance
|
|
173
|
-
|
|
174
|
-
export default Application;
|
package/src/component.d.ts
DELETED
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Comcast Cable Communications Management, LLC
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*
|
|
15
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
declare namespace Component {
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Name of the Component
|
|
22
|
-
*/
|
|
23
|
-
type Name = string
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
interface Announcer {
|
|
27
|
-
/**
|
|
28
|
-
* Announce a message to screen readers by specifying the politeness level
|
|
29
|
-
*/
|
|
30
|
-
speak: (message: string, politeness?: 'polite' | 'assertive') => void
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Announce a message to screen readers with a polite politeness level
|
|
34
|
-
*/
|
|
35
|
-
polite: (message: string) => void
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Announce a message to screen readers with an assertive politeness level
|
|
39
|
-
*/
|
|
40
|
-
assertive: (message: string) => void
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Stop all announcements
|
|
44
|
-
*/
|
|
45
|
-
stop: () => void
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface Log {
|
|
49
|
-
/**
|
|
50
|
-
* Log an info message
|
|
51
|
-
*/
|
|
52
|
-
info(...args): typeof console.info
|
|
53
|
-
/**
|
|
54
|
-
* Log an error message
|
|
55
|
-
*/
|
|
56
|
-
error(...args): typeof console.error
|
|
57
|
-
/**
|
|
58
|
-
* Log a warning
|
|
59
|
-
*/
|
|
60
|
-
warn(...args): typeof console.warn
|
|
61
|
-
/**
|
|
62
|
-
* Log a debug message
|
|
63
|
-
*/
|
|
64
|
-
debug(...args): typeof console.debug
|
|
65
|
-
}
|
|
66
|
-
interface AdvancedProp {
|
|
67
|
-
/**
|
|
68
|
-
* Name of the prop
|
|
69
|
-
*/
|
|
70
|
-
key: string,
|
|
71
|
-
/**
|
|
72
|
-
* Whether the prop is required to be passed
|
|
73
|
-
*/
|
|
74
|
-
required?: boolean,
|
|
75
|
-
/**
|
|
76
|
-
* Default value for the prop when omited
|
|
77
|
-
*/
|
|
78
|
-
default?: any,
|
|
79
|
-
/**
|
|
80
|
-
* Cast the value of the prop
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```js
|
|
84
|
-
* {
|
|
85
|
-
* cast: Number, // casts to a number
|
|
86
|
-
* cast: (v) => v.toUpperCase() // casts to uppercase
|
|
87
|
-
* }
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
cast?: () => any
|
|
91
|
-
}
|
|
92
|
-
type PropsArray<T extends string> = T[]
|
|
93
|
-
type AdvancedProps = AdvancedProp[]
|
|
94
|
-
type MixedProps<T extends string> = (T | AdvancedProp)[];
|
|
95
|
-
|
|
96
|
-
// type ExtractPropNames<T extends Prop[]> = T extends (infer U)[]
|
|
97
|
-
// ? U extends string
|
|
98
|
-
// ? U
|
|
99
|
-
// : U extends AdvancedProp
|
|
100
|
-
// ? U['key']
|
|
101
|
-
// : never
|
|
102
|
-
// : never;
|
|
103
|
-
|
|
104
|
-
type NotFunction<T> = T extends Function ? never : T;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Internal state of a Component instance
|
|
108
|
-
*/
|
|
109
|
-
interface State {
|
|
110
|
-
[key: string]: any
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
interface Computed<S, M, P> {
|
|
114
|
-
[key: string]: (this: ComponentInstance & S & M & P) => any
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
interface Watch<S, M, P> {
|
|
118
|
-
[key: string]: (this: ComponentInstance & S & M & P, value: any, oldValue: any) => void
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
interface Methods {
|
|
122
|
-
[key: string]: (this: ComponentInstance & State & Methods, ...args: any) => any;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// interface MethodsExtended<S, M, P> extends Methods {
|
|
126
|
-
// [key: string]: (this: ComponentInstance & S & M & P) => any;
|
|
127
|
-
// }
|
|
128
|
-
|
|
129
|
-
interface Input<S, M, P> {
|
|
130
|
-
[key: string]: ((this: ComponentInstance & S & M & P, event: KeyboardEvent) => void) | undefined,
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Catch all input function
|
|
134
|
-
*
|
|
135
|
-
* Will be invoked when there is no dedicated function for a certain key
|
|
136
|
-
*/
|
|
137
|
-
any?: (this: ComponentInstance & S & M & P, event: KeyboardEvent) => void,
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
interface Log {
|
|
141
|
-
/**
|
|
142
|
-
* Log an info message
|
|
143
|
-
*/
|
|
144
|
-
info(...args): typeof console.info
|
|
145
|
-
/**
|
|
146
|
-
* Log an error message
|
|
147
|
-
*/
|
|
148
|
-
error(...args): typeof console.error
|
|
149
|
-
/**
|
|
150
|
-
* Log a warning
|
|
151
|
-
*/
|
|
152
|
-
warn(...args): typeof console.warn
|
|
153
|
-
/**
|
|
154
|
-
* Log a debug message
|
|
155
|
-
*/
|
|
156
|
-
debug(...args): typeof console.debug
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
interface Hooks<S, M, P> {
|
|
160
|
-
/**
|
|
161
|
-
* Fires when the Component is being instantiated.
|
|
162
|
-
* At this moment child elements will not be available yet
|
|
163
|
-
*/
|
|
164
|
-
init?: (this: ComponentInstance & S & M & P, ...args: any) => void
|
|
165
|
-
/**
|
|
166
|
-
* Fires when the Component is fully initialized and ready for interaction.
|
|
167
|
-
*/
|
|
168
|
-
ready?: (this: ComponentInstance & S & M & P, ...args: any) => void
|
|
169
|
-
/**
|
|
170
|
-
* Triggers when the Component receives focus.
|
|
171
|
-
*
|
|
172
|
-
* This event can fire multiple times during the component's lifecycle
|
|
173
|
-
*/
|
|
174
|
-
focus?: (this: ComponentInstance & S & M & P, ...args: any) => void
|
|
175
|
-
/**
|
|
176
|
-
* Triggers when the Component loses focus.
|
|
177
|
-
*
|
|
178
|
-
* This event can fire multiple times during the component's lifecycle
|
|
179
|
-
*/
|
|
180
|
-
unfocus?: (this: ComponentInstance & S & M & P, ...args: any) => void
|
|
181
|
-
/**
|
|
182
|
-
* Fires when the Component is being destroyed and removed.
|
|
183
|
-
*/
|
|
184
|
-
destroy?: (this: ComponentInstance & S & M & P, ...args: any) => void,
|
|
185
|
-
/**
|
|
186
|
-
* Fires upon each frame start (allowing you to tap directly into the renderloop)
|
|
187
|
-
*
|
|
188
|
-
* Note: This hook will fire continuously, multiple times per second!
|
|
189
|
-
*/
|
|
190
|
-
frameTick?: (this: ComponentInstance & S & M & P, ...args: any) => void,
|
|
191
|
-
/**
|
|
192
|
-
* Fires when the component enters the viewport _margin_ and is attached to the render tree
|
|
193
|
-
*
|
|
194
|
-
* This event can fire multiple times during the component's lifecycle
|
|
195
|
-
*/
|
|
196
|
-
attach?: (this: ComponentInstance & S & M & P, ...args: any) => void,
|
|
197
|
-
/**
|
|
198
|
-
* Fires when the component leaves the viewport _margin_ and is detached from the render tree
|
|
199
|
-
*
|
|
200
|
-
* This event can fire multiple times during the component's lifecycle
|
|
201
|
-
*/
|
|
202
|
-
detach?: (this: ComponentInstance & S & M & P, ...args: any) => void,
|
|
203
|
-
/**
|
|
204
|
-
* Fires when the component enters the visible viewport
|
|
205
|
-
*
|
|
206
|
-
* This event can fire multiple times during the component's lifecycle
|
|
207
|
-
*/
|
|
208
|
-
enter?: (this: ComponentInstance & S & M & P, ...args: any) => void,
|
|
209
|
-
/**
|
|
210
|
-
* Fires when the component leaves the visible viewport
|
|
211
|
-
*
|
|
212
|
-
* This event can fire multiple times during the component's lifecycle
|
|
213
|
-
*/
|
|
214
|
-
exit?: (this: ComponentInstance & S & M & P, ...args: any) => void,
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Route object
|
|
219
|
-
*/
|
|
220
|
-
interface Route {
|
|
221
|
-
path: string,
|
|
222
|
-
params: Record<string, string>,
|
|
223
|
-
options?: {
|
|
224
|
-
inHistory?: boolean,
|
|
225
|
-
keepAlive?: boolean,
|
|
226
|
-
[key: string]: any,
|
|
227
|
-
},
|
|
228
|
-
data?: Record<string, any>,
|
|
229
|
-
component?: (args: { props: any }, holder: any, context: any) => Promise<any>,
|
|
230
|
-
hooks?: {
|
|
231
|
-
before?: (route: Route, previousRoute: Route) => Promise<string | Route | void>,
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
interface Router {
|
|
237
|
-
/**
|
|
238
|
-
* Navigate to a different location
|
|
239
|
-
*/
|
|
240
|
-
to(location: string, data?: Record<string, any>, options?: Record<string, any>): void;
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Navigate to the previous location
|
|
244
|
-
*/
|
|
245
|
-
back(): boolean;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Get the current route read-only
|
|
249
|
-
*/
|
|
250
|
-
readonly currentRoute: Route;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Get the list of all routes
|
|
254
|
-
*/
|
|
255
|
-
readonly routes: Route[];
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Get navigating state
|
|
259
|
-
*/
|
|
260
|
-
readonly navigating: boolean;
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export interface ComponentInstance {
|
|
265
|
-
/**
|
|
266
|
-
* Listen to events emitted by other components
|
|
267
|
-
*/
|
|
268
|
-
$listen: {
|
|
269
|
-
(event: string, callback: (args: any) => void, priority?: number): void;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Emit events that other components can listen to
|
|
274
|
-
*/
|
|
275
|
-
$emit: (event: string, args?: any) => void
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Set a timeout that is automatically cleaned upon component destroy
|
|
279
|
-
*/
|
|
280
|
-
$setTimeout: (callback: (args: any) => void, ms?: number | undefined) => ReturnType<typeof setTimeout>
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Clear a timeout
|
|
284
|
-
*/
|
|
285
|
-
$clearTimeout: (id: ReturnType<typeof setTimeout>) => void
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Set an interval that is automatically cleaned upon component destroy
|
|
289
|
-
*/
|
|
290
|
-
$setInterval: (callback: (args: any) => void, ms?: number | undefined) => ReturnType<typeof setInterval>
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Clear a interval
|
|
294
|
-
*/
|
|
295
|
-
$clearInterval: (id: ReturnType<typeof setInterval>) => void
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Log to the console with prettier output and configurable debug levels in Settings
|
|
299
|
-
*/
|
|
300
|
-
$log: Log
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Set focus to the Component, optionally pass a KeyboardEvent for instant event bubbling
|
|
304
|
-
*/
|
|
305
|
-
$focus: (event?: KeyboardEvent) => void
|
|
306
|
-
/**
|
|
307
|
-
* @deprecated
|
|
308
|
-
* Deprecated: use `this.$focus()` instead
|
|
309
|
-
*/
|
|
310
|
-
focus: (event?: KeyboardEvent) => void
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Select a child Element or Component by ref
|
|
314
|
-
*
|
|
315
|
-
* Elements and Components in the template can have an optional ref argument.
|
|
316
|
-
* Returns an Element Instance or Component Instance.
|
|
317
|
-
* Useful for passing on the focus to a Child component.
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* ```js
|
|
321
|
-
* const menu = this.select('Menu')
|
|
322
|
-
* if(menu) {
|
|
323
|
-
* menu.focus()
|
|
324
|
-
* }
|
|
325
|
-
* ```
|
|
326
|
-
*/
|
|
327
|
-
$select: (ref: string) => ComponentInstance | ElementInstance
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* @deprecated
|
|
331
|
-
* Deprecated: use `this.$select()` instead
|
|
332
|
-
*/
|
|
333
|
-
select: (ref: string) => ComponentInstance | ElementInstance
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Announcer methods for screen reader support
|
|
337
|
-
*/
|
|
338
|
-
$announcer: Announcer
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Triggers a forced update on state variables.
|
|
342
|
-
*/
|
|
343
|
-
$trigger: (key: string) => void
|
|
344
|
-
/**
|
|
345
|
-
* @deprecated
|
|
346
|
-
*
|
|
347
|
-
* Triggers a forced update on state variables.
|
|
348
|
-
* Deprecated: use `this.$trigger()` instead
|
|
349
|
-
*/
|
|
350
|
-
trigger: (key: string) => void
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Router instance
|
|
354
|
-
*/
|
|
355
|
-
$router: Router
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
export interface ElementInstance {
|
|
360
|
-
focus?: () => void
|
|
361
|
-
$focus?: () => void
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
export interface ComponentConfig<Props extends string, S, M> {
|
|
365
|
-
components?: any,
|
|
366
|
-
/**
|
|
367
|
-
* XML-based template string of the Component
|
|
368
|
-
*
|
|
369
|
-
* @example
|
|
370
|
-
* ```xml
|
|
371
|
-
* <Element :x="$x" w="400" h="1080" color="#64748b">
|
|
372
|
-
* <Element x="50" y="40">
|
|
373
|
-
* <Button color="#e4e4e7" />
|
|
374
|
-
* <Button color="#e4e4e7" y="100" />
|
|
375
|
-
* <Button color="#e4e4e7" y="200" />
|
|
376
|
-
* <Button color="#e4e4e7" y="300" />
|
|
377
|
-
* </Element>
|
|
378
|
-
* </Element>
|
|
379
|
-
* ```
|
|
380
|
-
*/
|
|
381
|
-
template?: String,
|
|
382
|
-
/**
|
|
383
|
-
* Reactive internal state of the Component instance
|
|
384
|
-
*
|
|
385
|
-
* Should return an object (literal) with key value pairs.
|
|
386
|
-
* Can contain nested objects, but beware that too deep nesting can have
|
|
387
|
-
* a negative impact on performance
|
|
388
|
-
*
|
|
389
|
-
* @example
|
|
390
|
-
* ```js
|
|
391
|
-
* state() {
|
|
392
|
-
* return {
|
|
393
|
-
* items: [],
|
|
394
|
-
* color: 'red',
|
|
395
|
-
* alpha: 0.1
|
|
396
|
-
* }
|
|
397
|
-
* }
|
|
398
|
-
* ```
|
|
399
|
-
*/
|
|
400
|
-
state?: (this: { [K in Props]: any}) => S,
|
|
401
|
-
/**
|
|
402
|
-
* Allowed props to be passed into the Component by the parent
|
|
403
|
-
*
|
|
404
|
-
* Can be a simple array with `prop` keys as strings.
|
|
405
|
-
* Alternatively objects can be used to specify `required` props and `default` values
|
|
406
|
-
*
|
|
407
|
-
* @example
|
|
408
|
-
* ```js
|
|
409
|
-
* props: ['index', {
|
|
410
|
-
* key: 'alpha',
|
|
411
|
-
* required: true
|
|
412
|
-
* }, {
|
|
413
|
-
* key: 'color',
|
|
414
|
-
* default: 'red'
|
|
415
|
-
* }]
|
|
416
|
-
* ```
|
|
417
|
-
*/
|
|
418
|
-
props?: PropsArray<Props> | AdvancedProps | MixedProps<Props>
|
|
419
|
-
/**
|
|
420
|
-
* Computed properties
|
|
421
|
-
*/
|
|
422
|
-
computed?: Computed<S, M, { [K in Props]: any}>,
|
|
423
|
-
/**
|
|
424
|
-
* Watchers for changes to state variables, props or computed properties
|
|
425
|
-
*/
|
|
426
|
-
watch?: Watch<S, M, { [K in Props]: any}>,
|
|
427
|
-
/**
|
|
428
|
-
* Hooking into Lifecycle events
|
|
429
|
-
*/
|
|
430
|
-
hooks?: Hooks<S, M, { [K in Props]: any}>,
|
|
431
|
-
/**
|
|
432
|
-
* Methods for abstracting more complex business logic into separate function
|
|
433
|
-
*/
|
|
434
|
-
methods?: M //MethodsExtended<S, M, { [K in Props]: any}>,
|
|
435
|
-
/**
|
|
436
|
-
* Tapping into user input
|
|
437
|
-
*/
|
|
438
|
-
input?: Input<S, M, { [K in Props]: any}>
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Blits.Component()
|
|
445
|
-
*/
|
|
446
|
-
declare function Component<
|
|
447
|
-
Props extends string,
|
|
448
|
-
S extends Component.State,
|
|
449
|
-
M extends Component.Methods
|
|
450
|
-
>(
|
|
451
|
-
name: Component.Name,
|
|
452
|
-
config: Component.ComponentConfig<Props, S, M>
|
|
453
|
-
) : Component.ComponentInstance
|
|
454
|
-
|
|
455
|
-
export default Component;
|