UNPKG

20.3 kBTypeScriptView Raw
1// Generated by dts-bundle-generator v6.7.0
2
3import { OverrideContext, bindingMode } from 'aurelia-binding';
4import { View, ViewFactory, ViewSlot } from 'aurelia-templating';
5
6declare enum ActivationStrategy {
7 /**
8 * Default activation strategy; the 'activate' lifecycle hook will be invoked when the model changes.
9 */
10 InvokeLifecycle = "invoke-lifecycle",
11 /**
12 * The view/view-model will be recreated, when the "model" changes.
13 */
14 Replace = "replace"
15}
16/**
17 * Used to compose a new view / view-model template or bind to an existing instance.
18 */
19export declare class Compose {
20 /**
21 * Model to bind the custom element to.
22 *
23 * @property model
24 * @type {CustomElement}
25 */
26 model: any;
27 /**
28 * View to bind the custom element to.
29 *
30 * @property view
31 * @type {HtmlElement}
32 */
33 view: any;
34 /**
35 * View-model to bind the custom element's template to.
36 *
37 * @property viewModel
38 * @type {Class}
39 */
40 viewModel: any;
41 /**
42 * Strategy to activate the view-model. Default is "invoke-lifecycle".
43 * Bind "replace" to recreate the view/view-model when the model changes.
44 *
45 * @property activationStrategy
46 * @type {ActivationStrategy}
47 */
48 activationStrategy: ActivationStrategy;
49 /**
50 * SwapOrder to control the swapping order of the custom element's view.
51 *
52 * @property view
53 * @type {String}
54 */
55 swapOrder: any;
56 /**
57 * Creates an instance of Compose.
58 * @param element The Compose element.
59 * @param container The dependency injection container instance.
60 * @param compositionEngine CompositionEngine instance to compose the element.
61 * @param viewSlot The slot the view is injected in to.
62 * @param viewResources Collection of resources used to compile the the view.
63 * @param taskQueue The TaskQueue instance.
64 */
65 constructor(element: any, container: any, compositionEngine: any, viewSlot: any, viewResources: any, taskQueue: any);
66 /**
67 * Invoked when the component has been created.
68 *
69 * @param owningView The view that this component was created inside of.
70 */
71 created(owningView: View): void;
72 /**
73 * Used to set the bindingContext.
74 *
75 * @param bindingContext The context in which the view model is executed in.
76 * @param overrideContext The context in which the view model is executed in.
77 */
78 bind(bindingContext: any, overrideContext: any): void;
79 /**
80 * Unbinds the Compose.
81 */
82 unbind(): void;
83 /**
84 * Invoked everytime the bound model changes.
85 * @param newValue The new value.
86 * @param oldValue The old value.
87 */
88 modelChanged(newValue: any, oldValue: any): void;
89 /**
90 * Invoked everytime the bound view changes.
91 * @param newValue The new value.
92 * @param oldValue The old value.
93 */
94 viewChanged(newValue: any, oldValue: any): void;
95 /**
96 * Invoked everytime the bound view model changes.
97 * @param newValue The new value.
98 * @param oldValue The old value.
99 */
100 viewModelChanged(newValue: any, oldValue: any): void;
101}
102declare class IfCore {
103 constructor(viewFactory: ViewFactory, viewSlot: ViewSlot);
104 bind(bindingContext: any, overrideContext: any): void;
105 unbind(): void;
106}
107/**
108 * Binding to conditionally include or not include template logic depending on returned result
109 * - value should be Boolean or will be treated as such (truthy / falsey)
110 */
111export declare class If extends IfCore {
112 condition: any;
113 swapOrder: "before" | "with" | "after";
114 cache: boolean | string;
115 /**
116 * Binds the if to the binding context and override context
117 * @param bindingContext The binding context
118 * @param overrideContext An override context for binding.
119 */
120 bind(bindingContext: any, overrideContext: any): void;
121 /**
122 * Invoked everytime value property changes.
123 * @param newValue The new value
124 */
125 conditionChanged(newValue: any): void;
126}
127export declare class Else extends IfCore {
128 constructor(viewFactory: any, viewSlot: any);
129 bind(bindingContext: any, overrideContext: any): void;
130}
131/**
132 * Creates a binding context for decandant elements to bind to.
133 */
134export declare class With {
135 value: any;
136 /**
137 * Creates an instance of With.
138 * @param viewFactory The factory generating the view.
139 * @param viewSlot The slot the view is injected in to.
140 */
141 constructor(viewFactory: ViewFactory, viewSlot: ViewSlot);
142 /**
143 * Binds the With with provided binding context and override context.
144 * @param bindingContext The binding context.
145 * @param overrideContext An override context for binding.
146 */
147 bind(bindingContext: any, overrideContext: any): void;
148 /**
149 * Invoked everytime the bound value changes.
150 * @param newValue The new value.
151 */
152 valueChanged(newValue: any): void;
153 /**
154 * Unbinds With
155 */
156 unbind(): void;
157}
158/**
159* An abstract base class for elements and attributes that repeat
160* views.
161*/
162export declare class AbstractRepeater {
163 constructor(options: any);
164 /**
165 * Returns the number of views the repeater knows about.
166 *
167 * @return the number of views.
168 */
169 viewCount(): number;
170 /**
171 * Returns all of the repeaters views as an array.
172 *
173 * @return The repeater's array of views;
174 */
175 views(): any[];
176 /**
177 * Returns a single view from the repeater at the provided index.
178 *
179 * @param index The index of the requested view.
180 * @return {View|ViewSlot} The requested view.
181 */
182 view(index: number): any;
183 /**
184 * Returns the matcher function to be used by the repeater, or null if strict matching is to be performed.
185 *
186 * @return The requested matcher function.
187 */
188 matcher(): Function | null;
189 /**
190 * Adds a view to the repeater, binding the view to the
191 * provided contexts.
192 *
193 * @param {Object} bindingContext The binding context to bind the new view to.
194 * @param {Object} overrideContext A secondary binding context that can override the primary context.
195 */
196 addView(bindingContext: any, overrideContext: any): any;
197 /**
198 * Inserts a view to the repeater at a specific index, binding the view to the
199 * provided contexts.
200 *
201 * @param {Number} index The index at which to create the new view at.
202 * @param {Object} bindingContext The binding context to bind the new view to.
203 * @param {Object} overrideContext A secondary binding context that can override the primary context.
204 */
205 insertView(index: any, bindingContext: any, overrideContext: any): any;
206 /**
207 * Moves a view across the repeater.
208 *
209 * @param {Number} sourceIndex The index of the view to be moved.
210 * @param {Number} sourceIndex The index where the view should be placed at.
211 */
212 moveView(sourceIndex: any, targetIndex: any): any;
213 /**
214 * Removes all views from the repeater.
215 * @param {Boolean} returnToCache Should the view be returned to the view cache?
216 * @param {Boolean} skipAnimation Should the removal animation be skipped?
217 * @return {Promise|null}
218 */
219 removeAllViews(returnToCache?: boolean, skipAnimation?: boolean): any;
220 /**
221 * Removes an array of Views from the repeater.
222 *
223 * @param {Array} viewsToRemove The array of views to be removed.
224 * @param {Boolean} returnToCache Should the view be returned to the view cache?
225 * @param {Boolean} skipAnimation Should the removal animation be skipped?
226 */
227 removeViews(viewsToRemove: Array<View>, returnToCache?: boolean, skipAnimation?: boolean): any;
228 /**
229 * Removes a view from the repeater at a specific index.
230 *
231 * @param {Number} index The index of the view to be removed.
232 * @param {Boolean} returnToCache Should the view be returned to the view cache?
233 * @param {Boolean} skipAnimation Should the removal animation be skipped?
234 */
235 removeView(index: number, returnToCache?: boolean, skipAnimation?: boolean): any;
236 /**
237 * Forces a particular view to update it's bindings, called as part of
238 * an in-place processing of items for better performance
239 *
240 * @param {Object} view the target view for bindings updates
241 */
242 updateBindings(view: View): void;
243}
244/**
245 * Binding to iterate over iterable objects (Array, Map and Number) to genereate a template for each iteration.
246 */
247export declare class Repeat extends AbstractRepeater {
248 /**
249 * Setting this to `true` to enable legacy behavior, where a repeat would take first `matcher` binding
250 * any where inside its view if there's no `matcher` binding on the repeated element itself.
251 *
252 * Default value is true to avoid breaking change
253 * @default true
254 */
255 static useInnerMatcher: boolean;
256 /**
257 * List of items to bind the repeater to.
258 *
259 * @property items
260 */
261 items: any;
262 /**
263 * Local variable which gets assigned on each iteration.
264 *
265 * @property local
266 */
267 local: any;
268 /**
269 * Key when iterating over Maps.
270 *
271 * @property key
272 */
273 key: any;
274 /**
275 * Value when iterating over Maps.
276 *
277 * @property value
278 */
279 value: any;
280 /**
281 * Creates an instance of Repeat.
282 * @param viewFactory The factory generating the view
283 * @param instruction The instructions for how the element should be enhanced.
284 * @param viewResources Collection of resources used to compile the the views.
285 * @param viewSlot The slot the view is injected in to.
286 * @param observerLocator The observer locator instance.
287 * @param collectionStrategyLocator The strategy locator to locate best strategy to iterate the collection.
288 */
289 constructor(viewFactory: any, instruction: any, viewSlot: any, viewResources: any, observerLocator: any, strategyLocator: any);
290 call(context: any, changes: any): void;
291 /**
292 * Binds the repeat to the binding context and override context.
293 * @param bindingContext The binding context.
294 * @param overrideContext An override context for binding.
295 */
296 bind(bindingContext: any, overrideContext: any): void;
297 /**
298 * Unbinds the repeat
299 */
300 unbind(): void;
301 /**
302 * Invoked everytime the item property changes.
303 */
304 itemsChanged(): void;
305 /**
306 * Invoked when the underlying collection changes.
307 */
308 handleCollectionMutated(collection: any, changes: any): void;
309 /**
310 * Invoked when the underlying inner collection changes.
311 */
312 handleInnerCollectionMutated(collection: any, changes: any): void;
313 viewCount(): any;
314 views(): any;
315 view(index: any): any;
316 matcher(): any;
317 addView(bindingContext: any, overrideContext: any): void;
318 insertView(index: any, bindingContext: any, overrideContext: any): void;
319 moveView(sourceIndex: any, targetIndex: any): void;
320 removeAllViews(returnToCache: any, skipAnimation: any): any;
321 removeViews(viewsToRemove: any, returnToCache: any, skipAnimation: any): any;
322 removeView(index: any, returnToCache: any, skipAnimation: any): any;
323 updateBindings(view: View): void;
324}
325/**
326 * Binding to conditionally show markup in the DOM based on the value.
327 * - different from "if" in that the markup is still added to the DOM, simply not shown.
328 */
329export declare class Show {
330 value: any;
331 /**
332 * Creates a new instance of Show.
333 * @param element Target element to conditionally show.
334 * @param animator The animator that conditionally adds or removes the aurelia-hide css class.
335 * @param domBoundary The DOM boundary. Used when the behavior appears within a component that utilizes the shadow DOM.
336 */
337 constructor(element: any, animator: any, domBoundary: any);
338 /**
339 * Invoked when the behavior is created.
340 */
341 created(): void;
342 /**
343 * Invoked everytime the bound value changes.
344 * @param newValue The new value.
345 */
346 valueChanged(newValue: any): void;
347 /**
348 * Binds the Show attribute.
349 */
350 bind(bindingContext: any): void;
351}
352/**
353 * Binding to conditionally show markup in the DOM based on the value.
354 * - different from "if" in that the markup is still added to the DOM, simply not shown.
355 */
356export declare class Hide {
357 /**
358 * Creates a new instance of Hide.
359 * @param element Target element to conditionally hide.
360 * @param animator The animator that conditionally adds or removes the aurelia-hide css class.
361 * @param domBoundary The DOM boundary. Used when the behavior appears within a component that utilizes the shadow DOM.
362 */
363 constructor(element: any, animator: any, domBoundary: any);
364 /**
365 * Invoked when the behavior is created.
366 */
367 created(): void;
368 /**
369 * Invoked everytime the bound value changes.
370 * @param newValue The new value.
371 */
372 valueChanged(newValue: any): void;
373 /**
374 * Binds the Hide attribute.
375 */
376 bind(bindingContext: any): void;
377 value(value: any): void;
378}
379/**
380 * Default Html Sanitizer to prevent script injection.
381 */
382export declare class HTMLSanitizer {
383 /**
384 * Sanitizes the provided input.
385 * @param input The input to be sanitized.
386 */
387 sanitize(input: any): any;
388}
389/**
390 * Simple html sanitization converter to preserve whitelisted elements and attributes on a bound property containing html.
391 */
392export declare class SanitizeHTMLValueConverter {
393 /**
394 * Creates an instanse of the value converter.
395 * @param sanitizer The html sanitizer.
396 */
397 constructor(sanitizer: HTMLSanitizer);
398 /**
399 * Process the provided markup that flows to the view.
400 * @param untrustedMarkup The untrusted markup to be sanitized.
401 */
402 toView(untrustedMarkup: any): any;
403}
404/**
405 * Marks any part of a view to be replacable by the consumer.
406 */
407export declare class Replaceable {
408 /**
409 * @param viewFactory target The factory generating the view.
410 * @param viewSlot viewSlot The slot the view is injected in to.
411 */
412 constructor(viewFactory: ViewFactory, viewSlot: ViewSlot);
413 /**
414 * Binds the replaceable to the binding context and override context.
415 * @param bindingContext The binding context.
416 * @param overrideContext An override context for binding.
417 */
418 bind(bindingContext: any, overrideContext: any): void;
419 /**
420 * Unbinds the replaceable.
421 */
422 unbind(): void;
423}
424/**
425 * CustomAttribute that binds provided DOM element's focus attribute with a property on the viewmodel.
426 */
427export declare class Focus {
428 /**
429 * Creates an instance of Focus.
430 * @paramelement Target element on where attribute is placed on.
431 * @param taskQueue The TaskQueue instance.
432 */
433 constructor(element: any, taskQueue: any);
434 /**
435 * Invoked everytime the bound value changes.
436 */
437 valueChanged(): void;
438 /**
439 * Invoked when the attribute is attached to the DOM.
440 */
441 attached(): void;
442 /**
443 * Invoked when the attribute is detached from the DOM.
444 */
445 detached(): void;
446 handleEvent(e: any): void;
447}
448export declare class AttrBindingBehavior {
449 bind(binding: any, source: any): void;
450 unbind(binding: any, source: any): void;
451}
452export declare class OneTimeBindingBehavior {
453 mode: bindingMode;
454 constructor();
455}
456export declare class OneWayBindingBehavior {
457 mode: bindingMode;
458 constructor();
459}
460export declare class ToViewBindingBehavior {
461 mode: bindingMode;
462 constructor();
463}
464export declare class FromViewBindingBehavior {
465 mode: bindingMode;
466 constructor();
467}
468export declare class TwoWayBindingBehavior {
469 mode: bindingMode;
470 constructor();
471}
472export declare class ThrottleBindingBehavior {
473 bind(binding: any, source: any, delay?: number): void;
474 unbind(binding: any, source: any): void;
475}
476export declare class DebounceBindingBehavior {
477 bind(binding: any, source: any, delay?: number): void;
478 unbind(binding: any, source: any): void;
479}
480export declare class SelfBindingBehavior {
481 bind(binding: any, source: any): void;
482 unbind(binding: any, source: any): void;
483}
484export declare class SignalBindingBehavior {
485 signals: any;
486 constructor(bindingSignaler: any);
487 bind(binding: any, source: any, ...names: any[]): void;
488 unbind(binding: any, source: any): void;
489}
490export declare class BindingSignaler {
491 signals: {};
492 signal(name: string): void;
493}
494export declare class UpdateTriggerBindingBehavior {
495 bind(binding: any, source: any, ...events: any[]): void;
496 unbind(binding: any, source: any): void;
497}
498/**
499 * A strategy is for repeating a template over an iterable or iterable-like object.
500 */
501export interface RepeatStrategy {
502 instanceChanged(repeat: Repeat, items: any): void;
503 instanceMutated(repeat: Repeat, items: any, changes: any): void;
504 getCollectionObserver(observerLocator: any, items: any): any;
505}
506/**
507 * Locates the best strategy to best repeating a template over different types of collections.
508 * Custom strategies can be plugged in as well.
509 */
510export declare class RepeatStrategyLocator {
511 /**
512 * Creates a new RepeatStrategyLocator.
513 */
514 constructor();
515 /**
516 * Adds a repeat strategy to be located when repeating a template over different collection types.
517 * @param strategy A repeat strategy that can iterate a specific collection type.
518 */
519 addStrategy(matcher: (items: any) => boolean, strategy: RepeatStrategy): void;
520 /**
521 * Gets the best strategy to handle iteration.
522 */
523 getStrategy(items: any): RepeatStrategy;
524}
525/**
526 * A strategy for repeating a template over null or undefined (does nothing)
527 */
528export declare class NullRepeatStrategy {
529 instanceChanged(repeat: any, items: any): void;
530 getCollectionObserver(observerLocator: any, items: any): void;
531}
532/**
533 * A strategy for repeating a template over an array.
534 */
535export declare class ArrayRepeatStrategy {
536 /**
537 * Gets an observer for the specified collection.
538 * @param observerLocator The observer locator instance.
539 * @param items The items to be observed.
540 */
541 getCollectionObserver(observerLocator: any, items: any): any;
542 /**
543 * Handle the repeat's collection instance changing.
544 * @param repeat The repeater instance.
545 * @param items The new array instance.
546 */
547 instanceChanged(repeat: any, items: any): void;
548 /**
549 * Handle the repeat's collection instance mutating.
550 * @param repeat The repeat instance.
551 * @param array The modified array.
552 * @param splices Records of array changes.
553 */
554 instanceMutated(repeat: any, array: any, splices: any): void;
555}
556/**
557 * A strategy for repeating a template over a Map.
558 */
559export declare class MapRepeatStrategy {
560 /**
561 * Gets a Map observer.
562 * @param items The items to be observed.
563 */
564 getCollectionObserver(observerLocator: any, items: any): any;
565 /**
566 * Process the provided Map entries.
567 * @param items The entries to process.
568 */
569 instanceChanged(repeat: any, items: any): void;
570 /**
571 * Handle changes in a Map collection.
572 * @param map The underlying Map collection.
573 * @param records The change records.
574 */
575 instanceMutated(repeat: any, map: any, records: any): void;
576}
577/**
578 * A strategy for repeating a template over a Set.
579 */
580export declare class SetRepeatStrategy {
581 /**
582 * Gets a Set observer.
583 * @param items The items to be observed.
584 */
585 getCollectionObserver(observerLocator: any, items: any): any;
586 /**
587 * Process the provided Set entries.
588 * @param items The entries to process.
589 */
590 instanceChanged(repeat: any, items: any): void;
591 /**
592 * Handle changes in a Set collection.
593 * @param repeat The repeat instance.
594 * @param set The underlying Set collection.
595 * @param records The change records.
596 */
597 instanceMutated(repeat: any, set: any, records: any): void;
598}
599/**
600 * A strategy for repeating a template over a number.
601 */
602export declare class NumberRepeatStrategy {
603 /**
604 * Return the strategies collection observer. In this case none.
605 */
606 getCollectionObserver(): any;
607 /**
608 * Process the provided Number.
609 * @param value The Number of how many time to iterate.
610 */
611 instanceChanged(repeat: any, value: any): void;
612}
613/**
614 * Creates a complete override context.
615 * @param data The item's value.
616 * @param index The item's index.
617 * @param length The collections total length.
618 * @param key The key in a key/value pair.
619 */
620export declare function createFullOverrideContext(repeat: any, data: any, index: any, length: any, key?: string): OverrideContext;
621/**
622 * Updates the override context.
623 * @param context The context to be updated.
624 * @param index The context's index.
625 * @param length The collection's length.
626 */
627export declare function updateOverrideContext(overrideContext: any, index: any, length: any): void;
628/**
629 * Gets a repeat instruction's source expression.
630 */
631export declare function getItemsSourceExpression(instruction: any, attrName: any): any;
632/**
633 * Unwraps an expression to expose the inner, pre-converted / behavior-free expression.
634 */
635export declare function unwrapExpression(expression: any): any;
636/**
637 * Returns whether an expression has the OneTimeBindingBehavior applied.
638 */
639export declare function isOneTime(expression: any): boolean;
640/**
641 * Forces a binding instance to reevaluate.
642 */
643export declare function updateOneTimeBinding(binding: any): void;
644export declare function viewsRequireLifecycle(viewFactory: any): any;
645export declare function configure(config: any): void;
646
647export {};