@@ -4,24 +4,38 @@ declare module 'aurelia-templating' {
4
4
import { Metadata , Origin , Decorators } from 'aurelia-metadata' ;
5
5
import { relativeToFile } from 'aurelia-path' ;
6
6
import { TemplateRegistryEntry , Loader } from 'aurelia-loader' ;
7
- import { ValueConverter , bindingMode , ObserverLocator , BindingExpression , Binding , ValueConverterResource , EventManager } from 'aurelia-binding' ;
8
- import { Container } from 'aurelia-dependency-injection' ;
7
+ import { ValueConverter , Binding , bindingMode , ObserverLocator , BindingExpression , ValueConverterResource , EventManager } from 'aurelia-binding' ;
8
+ import { Container , inject } from 'aurelia-dependency-injection' ;
9
9
import { TaskQueue } from 'aurelia-task-queue' ;
10
-
11
- // this will be replaced soon
12
10
export interface ViewCreateInstruction {
13
11
suppressBind ?: boolean ;
14
12
systemControlled ?: boolean ;
15
13
enhance ?: boolean ;
16
14
partReplacements ?: Object ;
17
15
initiatedByBehavior ?: boolean ;
18
16
}
17
+ export interface ViewEngineHooks {
18
+ beforeCompile ( content : DocumentFragment , resources : ViewResources , instruction : ViewCompileInstruction ) : void ;
19
+ afterCompile ( viewFactory : ViewFactory ) : void ;
20
+ beforeCreate ( viewFactory : ViewFactory , container : Container , content : DocumentFragment , instruction : ViewCreateInstruction , bindingContext ?: Object ) : void ;
21
+ afterCreate ( view : View ) : void ;
22
+ }
23
+
24
+ // NOTE: Adding a fragment to the document causes the nodes to be removed from the fragment.
25
+ // NOTE: Adding to the fragment, causes the nodes to be removed from the document.
26
+ export interface ViewNode {
27
+ bind ( bindingContext : Object , systemUpdate ?: boolean ) : void ;
28
+ attached ( ) : void ;
29
+ detached ( ) : void ;
30
+ unbind ( ) : void ;
31
+ }
19
32
export let DOMBoundary : any ;
20
33
export let hasShadowDOM : any ;
21
34
export function nextElementSibling ( element : Node ) : Element ;
22
35
export function createTemplateFromMarkup ( markup : string ) : Element ;
23
36
export function replaceNode ( newNode : Node , node : Node , parentNode : Node ) : void ;
24
37
export function removeNode ( node : Node , parentNode : Node ) : void ;
38
+ export function injectStyles ( styles : string , destination ?: Element , prepend ?: boolean ) : any ;
25
39
export const animationEvent : any ;
26
40
export class Animator {
27
41
static configureDefault ( container : any , animatorInstance : any ) : any ;
@@ -112,14 +126,14 @@ declare module 'aurelia-templating' {
112
126
}
113
127
export class ViewCompileInstruction {
114
128
static normal : any ;
115
- constructor ( targetShadowDOM ?: boolean , compileSurrogate ?: boolean , beforeCompile ?: boolean ) ;
129
+ constructor ( targetShadowDOM ?: boolean , compileSurrogate ?: boolean ) ;
116
130
}
117
131
export class BehaviorInstruction {
118
132
static normal : any ;
119
133
static contentSelector : any ;
120
134
static element ( node : Node , type : HtmlBehaviorResource ) : BehaviorInstruction ;
121
135
static attribute ( attrName : string , type ?: HtmlBehaviorResource ) : BehaviorInstruction ;
122
- static dynamic ( host : any , executionContext : any , viewFactory : any ) : any ;
136
+ static dynamic ( host : any , bindingContext : any , viewFactory : any ) : any ;
123
137
constructor ( suppressBind ?: boolean ) ;
124
138
}
125
139
export class TargetInstruction {
@@ -165,7 +179,12 @@ declare module 'aurelia-templating' {
165
179
}
166
180
export class ViewResources {
167
181
constructor ( parent ?: ViewResources , viewUrl ?: string ) ;
168
- getBindingLanguage ( bindingLanguageFallback : any ) : any ;
182
+ onBeforeCompile ( content : DocumentFragment , resources : ViewResources , instruction : ViewCompileInstruction ) : void ;
183
+ onAfterCompile ( viewFactory : ViewFactory ) : void ;
184
+ onBeforeCreate ( viewFactory : ViewFactory , container : Container , content : DocumentFragment , instruction : ViewCreateInstruction , bindingContext ?: Object ) : void ;
185
+ onAfterCreate ( view : View ) : void ;
186
+ registerViewEngineHooks ( hooks : ViewEngineHooks ) : void ;
187
+ getBindingLanguage ( bindingLanguageFallback : BindingLanguage ) : BindingLanguage ;
169
188
patchInParent ( newParent : ViewResources ) : void ;
170
189
relativeToView ( path : string ) : string ;
171
190
registerElement ( tagName : string , behavior : HtmlBehaviorResource ) : void ;
@@ -176,20 +195,18 @@ declare module 'aurelia-templating' {
176
195
registerValueConverter ( name : string , valueConverter : ValueConverter ) : void ;
177
196
getValueConverter ( name : string ) : ValueConverter ;
178
197
}
179
-
180
- // NOTE: Adding a fragment to the document causes the nodes to be removed from the fragment.
181
- // NOTE: Adding to the fragment, causes the nodes to be removed from the document.
182
198
export class View {
183
- constructor ( container : any , fragment : any , behaviors : any , bindings : any , children : any , systemControlled : any , contentSelectors : any ) ;
184
- created ( ) : any ;
185
- bind ( executionContext : any , systemUpdate : any ) : any ;
186
- addBinding ( binding : any ) : any ;
187
- unbind ( ) : any ;
188
- insertNodesBefore ( refNode : any ) : any ;
189
- appendNodesTo ( parent : any ) : any ;
190
- removeNodes ( ) : any ;
191
- attached ( ) : any ;
192
- detached ( ) : any ;
199
+ constructor ( viewFactory : ViewFactory , container : Container , fragment : DocumentFragment , behaviors : BehaviorInstance [ ] , bindings : Binding [ ] , children : ViewNode [ ] , systemControlled : boolean , contentSelectors : ContentSelector [ ] ) ;
200
+ returnToCache ( ) : void ;
201
+ created ( ) : void ;
202
+ bind ( bindingContext : Object , systemUpdate ?: boolean ) : void ;
203
+ addBinding ( binding : Binding ) : void ;
204
+ unbind ( ) : void ;
205
+ insertNodesBefore ( refNode : Node ) : void ;
206
+ appendNodesTo ( parent : Element ) : void ;
207
+ removeNodes ( ) : void ;
208
+ attached ( ) : void ;
209
+ detached ( ) : void ;
193
210
}
194
211
export class ContentSelector {
195
212
static applySelectors ( view : any , contentSelectors : any , callback : any ) : any ;
@@ -201,35 +218,36 @@ declare module 'aurelia-templating' {
201
218
removeAt ( index : any , fragment : any ) : any ;
202
219
}
203
220
export class ViewSlot {
204
- constructor ( anchor : any , anchorIsContainer : any , executionContext : any , animator ?: any ) ;
205
- transformChildNodesIntoView ( ) : any ;
206
- bind ( executionContext : any ) : any ;
207
- unbind ( ) : any ;
208
- add ( view : any ) : any ;
209
- insert ( index : any , view : any ) : any ;
210
- remove ( view : any ) : any ;
211
- removeAt ( index : any ) : any ;
212
- removeAll ( ) : any ;
213
- swap ( view : any ) : any ;
214
- attached ( ) : any ;
215
- detached ( ) : any ;
216
- installContentSelectors ( contentSelectors : any ) : any ;
217
- contentSelectorAdd ( view : any ) : any ;
218
- contentSelectorInsert ( index : any , view : any ) : any ;
219
- contentSelectorRemove ( view : any ) : any ;
220
- contentSelectorRemoveAt ( index : any ) : any ;
221
- contentSelectorRemoveAll ( ) : any ;
221
+ constructor ( anchor : Node , anchorIsContainer : boolean , bindingContext ?: Object , animator ?: Animator ) ;
222
+ transformChildNodesIntoView ( ) : void ;
223
+ bind ( bindingContext : Object ) : void ;
224
+ unbind ( ) : void ;
225
+ add ( view : View ) : void ;
226
+ insert ( index : number , view : View ) : void | Promise < any > ;
227
+ remove ( view : View , returnToCache ?: boolean , skipAnimation ?: boolean ) : void | Promise < View > ;
228
+ removeAt ( index : number , returnToCache ?: boolean , skipAnimation ?: boolean ) : void | Promise < View > ;
229
+ removeAll ( returnToCache ?: boolean , skipAnimation ?: boolean ) : void | Promise < any > ;
230
+ swap ( view : View , returnToCache ?: boolean ) : void | Promise < any > ;
231
+ attached ( ) : void ;
232
+ detached ( ) : void ;
233
+ installContentSelectors ( contentSelectors : ContentSelector [ ] ) : void ;
222
234
}
223
235
export class BoundViewFactory {
224
- constructor ( parentContainer : Container , viewFactory : ViewFactory , executionContext : Object , partReplacements ?: Object ) ;
225
- create ( executionContext ?: Object ) : View ;
236
+ constructor ( parentContainer : Container , viewFactory : ViewFactory , bindingContext : Object , partReplacements ?: Object ) ;
237
+ create ( bindingContext ?: Object ) : View ;
238
+ isCaching ( ) : any ;
239
+ setCacheSize ( size : number | string , doNotOverrideIfAlreadySet : boolean ) : void ;
240
+ getCachedView ( ) : View ;
241
+ returnViewToCache ( view : View ) : void ;
226
242
}
227
243
export class ViewFactory {
228
244
constructor ( template : DocumentFragment , instructions : Object , resources : ViewResources ) ;
229
- create ( container : Container , executionContext ?: Object , createInstruction ?: ViewCreateInstruction , element ?: Element ) : View ;
245
+ setCacheSize ( size : number | string , doNotOverrideIfAlreadySet : boolean ) : void ;
246
+ getCachedView ( ) : View ;
247
+ returnViewToCache ( view : View ) : void ;
248
+ create ( container : Container , bindingContext ?: Object , createInstruction ?: ViewCreateInstruction , element ?: Element ) : View ;
230
249
}
231
250
export class ViewCompiler {
232
- static inject ( ) : any ;
233
251
constructor ( bindingLanguage : BindingLanguage , resources : ViewResources ) ;
234
252
compile ( source : Element | DocumentFragment | string , resources ?: ViewResources , compileInstruction ?: ViewCompileInstruction ) : ViewFactory ;
235
253
compileNode ( node : any , resources : any , instructions : any , parentNode : any , parentInjectorId : any , targetLightDOM : any ) : any ;
@@ -243,14 +261,15 @@ declare module 'aurelia-templating' {
243
261
export class ViewEngine {
244
262
static inject ( ) : any ;
245
263
constructor ( loader : Loader , container : Container , viewCompiler : ViewCompiler , moduleAnalyzer : ModuleAnalyzer , appResources : ViewResources ) ;
264
+ addResourcePlugin ( extension : string , implementation : string ) : any ;
246
265
enhance ( container : Container , element : Element , resources : ViewResources , bindingContext ?: Object ) : View ;
247
266
loadViewFactory ( urlOrRegistryEntry : string | TemplateRegistryEntry , compileInstruction ?: ViewCompileInstruction , loadContext ?: ResourceLoadContext ) : Promise < ViewFactory > ;
248
267
loadTemplateResources ( viewRegistryEntry : TemplateRegistryEntry , compileInstruction ?: ViewCompileInstruction , loadContext ?: ResourceLoadContext ) : Promise < ViewResources > ;
249
268
importViewModelResource ( moduleImport : string , moduleMember : string ) : Promise < ResourceDescription > ;
250
269
importViewResources ( moduleIds : string [ ] , names : string [ ] , resources : ViewResources , compileInstruction ?: ViewCompileInstruction , loadContext ?: ResourceLoadContext ) : Promise < ViewResources > ;
251
270
}
252
271
export class BehaviorInstance {
253
- constructor ( behavior : any , executionContext : any , instruction : any ) ;
272
+ constructor ( behavior : any , bindingContext : any , instruction : any ) ;
254
273
static createForUnitTest ( type : any , attributes : any , bindingContext : any ) : any ;
255
274
created ( context : any ) : any ;
256
275
bind ( context : any ) : any ;
@@ -263,9 +282,9 @@ declare module 'aurelia-templating' {
263
282
registerWith ( target : any , behavior : any , descriptor : any ) : any ;
264
283
configureDescriptor ( behavior : any , descriptor : any ) : any ;
265
284
defineOn ( target : any , behavior : any ) : any ;
266
- createObserver ( executionContext : any ) : any ;
267
- initialize ( executionContext : any , observerLookup : any , attributes : any , behaviorHandlesBind : any , boundProperties : any ) : any ;
268
- createDynamicProperty ( executionContext : any , observerLookup : any , behaviorHandlesBind : any , name : any , attribute : any , boundProperties : any ) : any ;
285
+ createObserver ( bindingContext : any ) : any ;
286
+ initialize ( bindingContext : any , observerLookup : any , attributes : any , behaviorHandlesBind : any , boundProperties : any ) : any ;
287
+ createDynamicProperty ( bindingContext : any , observerLookup : any , behaviorHandlesBind : any , name : any , attribute : any , boundProperties : any ) : any ;
269
288
}
270
289
class BehaviorPropertyObserver {
271
290
constructor ( taskQueue : any , obj : any , propertyName : any , selfSubscriber : any , initialValue : any ) ;
@@ -329,9 +348,10 @@ declare module 'aurelia-templating' {
329
348
load ( container : any , target : any ) : any ;
330
349
register ( ) : any ;
331
350
}
351
+ export function resource ( instance : any ) : any ;
332
352
export function behavior ( override : any ) : any ;
333
353
export function customElement ( name : any ) : any ;
334
- export function customAttribute ( name : any , defaultBindingMode : any ) : any ;
354
+ export function customAttribute ( name : any , defaultBindingMode ? : any ) : any ;
335
355
export function templateController ( target : any ) : any ;
336
356
export function bindable ( nameOrConfigOrTarget ?: any , key ?: any , descriptor ?: any ) : any ;
337
357
export function dynamicOptions ( target : any ) : any ;
0 commit comments