1 | import * as LogManager from 'aurelia-logging';
|
2 | import {
|
3 | metadata,
|
4 | Origin,
|
5 | protocol
|
6 | } from 'aurelia-metadata';
|
7 | import {
|
8 | DOM,
|
9 | PLATFORM,
|
10 | FEATURE
|
11 | } from 'aurelia-pal';
|
12 | import {
|
13 | TemplateRegistryEntry,
|
14 | Loader
|
15 | } from 'aurelia-loader';
|
16 | import {
|
17 | relativeToFile
|
18 | } from 'aurelia-path';
|
19 | import {
|
20 | Container,
|
21 | resolver,
|
22 | inject
|
23 | } from 'aurelia-dependency-injection';
|
24 | import {
|
25 | ValueConverterResource,
|
26 | BindingBehaviorResource,
|
27 | camelCase,
|
28 | Binding,
|
29 | createOverrideContext,
|
30 | subscriberCollection,
|
31 | bindingMode,
|
32 | ObserverLocator,
|
33 | EventManager
|
34 | } from 'aurelia-binding';
|
35 | import {
|
36 | TaskQueue
|
37 | } from 'aurelia-task-queue';
|
38 | export declare interface EventHandler {
|
39 | eventName: string;
|
40 | bubbles: boolean;
|
41 | capture: boolean;
|
42 | dispose: Function;
|
43 | handler: Function;
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export declare interface ViewCreateInstruction {
|
50 |
|
51 | |
52 |
|
53 |
|
54 | enhance?: boolean;
|
55 |
|
56 | |
57 |
|
58 |
|
59 | partReplacements?: Object;
|
60 | }
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | export declare interface ViewStrategy {
|
66 |
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise<ViewFactory>;
|
76 | }
|
77 | export declare interface IStaticViewConfig {
|
78 | template: string | HTMLTemplateElement;
|
79 | dependencies?: Function[] | (() => Array<Function | Promise<Function | Record<string, Function>>>);
|
80 | }
|
81 |
|
82 | /**
|
83 | * View engine hooks that enable a view resource to provide custom processing during the compilation or creation of a view.
|
84 | */
|
85 | export declare interface ViewEngineHooks {
|
86 |
|
87 | /**
|
88 | * Invoked before a template is compiled.
|
89 | * @param content The DocumentFragment to compile.
|
90 | * @param resources The resources to compile the view against.
|
91 | * @param instruction The compilation instruction associated with the compilation process.
|
92 | */
|
93 | beforeCompile?: (content: DocumentFragment, resources: ViewResources, instruction: ViewCompileInstruction) => void;
|
94 |
|
95 | |
96 |
|
97 |
|
98 |
|
99 | afterCompile?: (viewFactory: ViewFactory) => void;
|
100 |
|
101 | |
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | beforeCreate?: (viewFactory: ViewFactory, container: Container, content: DocumentFragment, instruction: ViewCreateInstruction) => void;
|
109 |
|
110 | |
111 |
|
112 |
|
113 |
|
114 | afterCreate?: (view: View) => void;
|
115 |
|
116 | |
117 |
|
118 |
|
119 |
|
120 | beforeBind?: (view: View) => void;
|
121 |
|
122 | |
123 |
|
124 |
|
125 |
|
126 | beforeUnbind?: (view: View) => void;
|
127 | }
|
128 | export declare interface IBindablePropertyConfig {
|
129 |
|
130 | |
131 |
|
132 |
|
133 | name?: string;
|
134 | attribute?: string;
|
135 |
|
136 | |
137 |
|
138 |
|
139 | defaultBindingMode?: bindingMode | 'oneTime' | 'oneWay' | 'twoWay' | 'fromView' | 'toView';
|
140 |
|
141 | |
142 |
|
143 |
|
144 | changeHandler?: string;
|
145 |
|
146 | |
147 |
|
148 |
|
149 | defaultValue?: any;
|
150 |
|
151 | |
152 |
|
153 |
|
154 | primaryProperty?: boolean;
|
155 |
|
156 |
|
157 | [key: string]: any;
|
158 | }
|
159 | export declare interface IStaticResourceConfig {
|
160 |
|
161 | |
162 |
|
163 |
|
164 | type?: 'element' | 'attribute' | 'valueConverter' | 'bindingBehavior' | 'viewEngineHooks';
|
165 |
|
166 | |
167 |
|
168 |
|
169 | name?: string;
|
170 |
|
171 | |
172 |
|
173 |
|
174 | templateController?: boolean;
|
175 |
|
176 | |
177 |
|
178 |
|
179 | defaultBindingMode?: bindingMode | 'oneTime' | 'oneWay' | 'twoWay' | 'fromView' | 'toView';
|
180 |
|
181 | |
182 |
|
183 |
|
184 | hasDynamicOptions?: boolean;
|
185 |
|
186 | |
187 |
|
188 |
|
189 | usesShadowDOM?: boolean;
|
190 |
|
191 | |
192 |
|
193 |
|
194 | shadowDOMOptions?: ShadowRootInit;
|
195 |
|
196 | |
197 |
|
198 |
|
199 | containerless?: boolean;
|
200 |
|
201 | |
202 |
|
203 |
|
204 | processAttributes?: (viewCompiler: ViewCompiler, resources: ViewResources, node: Element, attributes: NamedNodeMap, elementInstruction: BehaviorInstruction) => void;
|
205 |
|
206 | |
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 | processContent?: (viewCompiler: ViewCompiler, resources: ViewResources, node: Element, instruction: BehaviorInstruction) => boolean;
|
214 |
|
215 | |
216 |
|
217 |
|
218 | bindables?: string | IBindablePropertyConfig[];
|
219 | }
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 | export declare interface ViewNode {
|
226 |
|
227 | |
228 |
|
229 |
|
230 |
|
231 |
|
232 | bind(bindingContext: Object, overrideContext?: Object): void;
|
233 |
|
234 | |
235 |
|
236 |
|
237 | attached(): void;
|
238 |
|
239 | |
240 |
|
241 |
|
242 | detached(): void;
|
243 |
|
244 | |
245 |
|
246 |
|
247 | unbind(): void;
|
248 | }
|
249 |
|
250 |
|
251 |
|
252 |
|
253 | export declare interface ComponentCreated {
|
254 |
|
255 | |
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 | created(owningView: View, myView: View): void;
|
263 | }
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 | export declare interface ComponentBind {
|
272 |
|
273 | |
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | bind(bindingContext: any, overrideContext: any): void;
|
280 | }
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 | export declare interface ComponentAttached {
|
289 |
|
290 | |
291 |
|
292 |
|
293 | attached(): void;
|
294 | }
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 | export declare interface ComponentDetached {
|
303 |
|
304 | |
305 |
|
306 |
|
307 | detached(): void;
|
308 | }
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 | export declare interface ComponentUnbind {
|
317 |
|
318 | |
319 |
|
320 |
|
321 | unbind(): void;
|
322 | }
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 | export declare interface DynamicComponentGetViewStrategy {
|
331 |
|
332 | |
333 |
|
334 |
|
335 | getViewStrategy(): string | ViewStrategy;
|
336 | }
|
337 |
|
338 |
|
339 |
|
340 |
|
341 | export declare interface CompositionContext {
|
342 |
|
343 | |
344 |
|
345 |
|
346 | container: Container;
|
347 |
|
348 | |
349 |
|
350 |
|
351 | childContainer?: Container;
|
352 |
|
353 | |
354 |
|
355 |
|
356 | bindingContext: any;
|
357 |
|
358 | |
359 |
|
360 |
|
361 | overrideContext?: any;
|
362 |
|
363 | |
364 |
|
365 |
|
366 | viewModel?: any;
|
367 |
|
368 | |
369 |
|
370 |
|
371 | model?: any;
|
372 |
|
373 | |
374 |
|
375 |
|
376 | viewModelResource?: HtmlBehaviorResource;
|
377 |
|
378 | |
379 |
|
380 |
|
381 | viewResources: ViewResources;
|
382 |
|
383 | |
384 |
|
385 |
|
386 | owningView?: View;
|
387 |
|
388 | |
389 |
|
390 |
|
391 | view?: string | ViewStrategy;
|
392 |
|
393 | |
394 |
|
395 |
|
396 | viewSlot: ViewSlot;
|
397 |
|
398 | |
399 |
|
400 |
|
401 | skipActivation?: boolean;
|
402 |
|
403 | |
404 |
|
405 |
|
406 |
|
407 | host?: Element;
|
408 | }
|
409 | export declare interface IStaticViewStrategyConfig {
|
410 | template: string | HTMLTemplateElement;
|
411 | dependencies?: Function[] | {};
|
412 | }
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | export declare interface EnhanceInstruction {
|
418 |
|
419 | |
420 |
|
421 |
|
422 | container?: Container;
|
423 |
|
424 | |
425 |
|
426 |
|
427 | element: Element;
|
428 |
|
429 | |
430 |
|
431 |
|
432 | resources?: ViewResources;
|
433 |
|
434 | |
435 |
|
436 |
|
437 | bindingContext?: Object;
|
438 |
|
439 | |
440 |
|
441 |
|
442 | overrideContext?: any;
|
443 | }
|
444 |
|
445 |
|
446 |
|
447 |
|
448 | export declare const animationEvent: any;
|
449 |
|
450 |
|
451 |
|
452 |
|
453 | export declare class Animator {
|
454 |
|
455 | |
456 |
|
457 |
|
458 |
|
459 |
|
460 | enter(element: HTMLElement): Promise<boolean>;
|
461 |
|
462 | |
463 |
|
464 |
|
465 |
|
466 |
|
467 | leave(element: HTMLElement): Promise<boolean>;
|
468 |
|
469 | |
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 | removeClass(element: HTMLElement, className: string): Promise<boolean>;
|
476 |
|
477 | |
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 | addClass(element: HTMLElement, className: string): Promise<boolean>;
|
484 |
|
485 | |
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 | animate(element: HTMLElement | Array<HTMLElement>, className: string): Promise<boolean>;
|
493 |
|
494 | |
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | runSequence(animations: Array<any>): Promise<boolean>;
|
501 |
|
502 | |
503 |
|
504 |
|
505 |
|
506 |
|
507 | registerEffect(effectName: string, properties: Object): void;
|
508 |
|
509 | |
510 |
|
511 |
|
512 |
|
513 | unregisterEffect(effectName: string): void;
|
514 | }
|
515 |
|
516 |
|
517 |
|
518 |
|
519 | export declare class CompositionTransactionNotifier {
|
520 | constructor(owner?: any);
|
521 |
|
522 | /**
|
523 | * Notifies the owning transaction that its work is done.
|
524 | */
|
525 | done(): void;
|
526 | }
|
527 |
|
528 | /**
|
529 | * Referenced by the subsytem which wishes to control a composition transaction.
|
530 | */
|
531 | export declare class CompositionTransactionOwnershipToken {
|
532 | constructor(owner?: any);
|
533 |
|
534 | /**
|
535 | * Allows the transaction owner to wait for the completion of all child compositions.
|
536 | * @return A promise that resolves when all child compositions are done.
|
537 | */
|
538 | waitForCompositionComplete(): Promise<void>;
|
539 |
|
540 | /**
|
541 | * Used internall to resolve the composition complete promise.
|
542 | */
|
543 | resolve(): void;
|
544 | }
|
545 |
|
546 | /**
|
547 | * Enables an initiator of a view composition to track any internal async rendering processes for completion.
|
548 | */
|
549 | export declare class CompositionTransaction {
|
550 |
|
551 | |
552 |
|
553 |
|
554 | constructor();
|
555 |
|
556 | /**
|
557 | * Attempt to take ownership of the composition transaction.
|
558 | * @return An ownership token if successful, otherwise null.
|
559 | */
|
560 | tryCapture(): CompositionTransactionOwnershipToken;
|
561 |
|
562 | /**
|
563 | * Enlist an async render operation into the transaction.
|
564 | * @return A completion notifier.
|
565 | */
|
566 | enlist(): CompositionTransactionNotifier;
|
567 | }
|
568 | export declare class ViewEngineHooksResource {
|
569 | constructor();
|
570 | initialize(container?: any, target?: any): any;
|
571 | register(registry?: any, name?: any): any;
|
572 | load(container?: any, target?: any): any;
|
573 | static convention(name?: any): any;
|
574 | }
|
575 | export declare function viewEngineHooks(target?: any): any;
|
576 |
|
577 | /**
|
578 | * Dispatches subscribets to and publishes events in the DOM.
|
579 | * @param element
|
580 | */
|
581 | /**
|
582 | * Dispatches subscribets to and publishes events in the DOM.
|
583 | * @param element
|
584 | */
|
585 | export declare class ElementEvents {
|
586 | constructor(element: EventTarget);
|
587 |
|
588 | /**
|
589 | * Dispatches an Event on the context element.
|
590 | * @param eventName
|
591 | * @param detail
|
592 | * @param bubbles
|
593 | * @param cancelable
|
594 | */
|
595 | publish(eventName: string, detail?: Object, bubbles?: boolean, cancelable?: boolean): any;
|
596 |
|
597 | /**
|
598 | * Adds and Event Listener on the context element.
|
599 | * @return Returns the eventHandler containing a dispose method
|
600 | */
|
601 | subscribe(eventName: string, handler: Function, captureOrOptions?: boolean): EventHandler;
|
602 |
|
603 | /**
|
604 | * Adds an Event Listener on the context element, that will be disposed on the first trigger.
|
605 | * @return Returns the eventHandler containing a dispose method
|
606 | */
|
607 | subscribeOnce(eventName: string, handler: Function, captureOrOptions?: boolean): EventHandler;
|
608 |
|
609 | /**
|
610 | * Removes all events that are listening to the specified eventName.
|
611 | * @param eventName
|
612 | */
|
613 | dispose(eventName: string): void;
|
614 |
|
615 | /**
|
616 | * Removes all event handlers.
|
617 | */
|
618 | disposeAll(): any;
|
619 | }
|
620 |
|
621 | /**
|
622 | * A context that flows through the view resource load process.
|
623 | */
|
624 | export declare class ResourceLoadContext {
|
625 | dependencies: Object;
|
626 |
|
627 | |
628 |
|
629 |
|
630 | constructor();
|
631 |
|
632 | /**
|
633 | * Tracks a dependency that is being loaded.
|
634 | * @param url The url of the dependency.
|
635 | */
|
636 | addDependency(url: string): void;
|
637 |
|
638 | /**
|
639 | * Checks if the current context includes a load of the specified url.
|
640 | * @return True if the url is being loaded in the context; false otherwise.
|
641 | */
|
642 | hasDependency(url: string): boolean;
|
643 | }
|
644 |
|
645 | /**
|
646 | * Specifies how a view should be compiled.
|
647 | */
|
648 | export declare class ViewCompileInstruction {
|
649 | targetShadowDOM: boolean;
|
650 | compileSurrogate: boolean;
|
651 | associatedModuleId: any;
|
652 |
|
653 | |
654 |
|
655 |
|
656 | static normal: ViewCompileInstruction;
|
657 |
|
658 | |
659 |
|
660 |
|
661 |
|
662 |
|
663 | constructor(targetShadowDOM?: boolean, compileSurrogate?: boolean);
|
664 | }
|
665 |
|
666 | /**
|
667 | * Indicates how a custom attribute or element should be instantiated in a view.
|
668 | */
|
669 | /**
|
670 | * Indicates how a custom attribute or element should be instantiated in a view.
|
671 | */
|
672 | export declare class BehaviorInstruction {
|
673 | initiatedByBehavior: boolean;
|
674 | enhance: boolean;
|
675 | partReplacements: any;
|
676 | viewFactory: ViewFactory;
|
677 | originalAttrName: string;
|
678 | skipContentProcessing: boolean;
|
679 | contentFactory: any;
|
680 | viewModel: Object;
|
681 | anchorIsContainer: boolean;
|
682 | host: Element;
|
683 | attributes: Object;
|
684 | type: HtmlBehaviorResource;
|
685 | attrName: string;
|
686 | inheritBindingContext: boolean;
|
687 |
|
688 | |
689 |
|
690 |
|
691 | static normal: BehaviorInstruction;
|
692 |
|
693 | |
694 |
|
695 |
|
696 |
|
697 | static enhance(): BehaviorInstruction;
|
698 |
|
699 | |
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 | static unitTest(type: HtmlBehaviorResource, attributes: Object): BehaviorInstruction;
|
706 |
|
707 | |
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 | static element(node: Node, type: HtmlBehaviorResource): BehaviorInstruction;
|
714 |
|
715 | |
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 | static attribute(attrName: string, type?: HtmlBehaviorResource): BehaviorInstruction;
|
722 |
|
723 | |
724 |
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 | static dynamic(host: Element, viewModel: Object, viewFactory: ViewFactory): BehaviorInstruction;
|
731 |
|
732 | |
733 |
|
734 |
|
735 | constructor();
|
736 | }
|
737 |
|
738 | /**
|
739 | * Provides all the instructions for how a target element should be enhanced inside of a view.
|
740 | */
|
741 | export declare class TargetInstruction {
|
742 | injectorId: number;
|
743 | parentInjectorId: number;
|
744 | shadowSlot: boolean;
|
745 | slotName: string;
|
746 | slotFallbackFactory: any;
|
747 | contentExpression: any;
|
748 | expressions: Array<Object>;
|
749 | behaviorInstructions: Array<BehaviorInstruction>;
|
750 | providers: Array<Function>;
|
751 | viewFactory: ViewFactory;
|
752 | anchorIsContainer: boolean;
|
753 | elementInstruction: BehaviorInstruction;
|
754 | lifting: boolean;
|
755 | values: Object;
|
756 |
|
757 | |
758 |
|
759 |
|
760 | static noExpressions: any;
|
761 |
|
762 | |
763 |
|
764 |
|
765 |
|
766 |
|
767 | static shadowSlot(parentInjectorId: number): TargetInstruction;
|
768 |
|
769 | |
770 |
|
771 |
|
772 |
|
773 |
|
774 | static contentExpression(expression?: any): TargetInstruction;
|
775 |
|
776 | |
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 | static lifting(parentInjectorId: number, liftingInstruction: BehaviorInstruction): TargetInstruction;
|
783 |
|
784 | |
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 | static normal(injectorId: number, parentInjectorId: number, providers: Array<Function>, behaviorInstructions: Array<BehaviorInstruction>, expressions: Array<Object>, elementInstruction: BehaviorInstruction): TargetInstruction;
|
795 |
|
796 | |
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 | static surrogate(providers: Array<Function>, behaviorInstructions: Array<BehaviorInstruction>, expressions: Array<Object>, values: Object): TargetInstruction;
|
805 |
|
806 | |
807 |
|
808 |
|
809 | constructor();
|
810 | }
|
811 |
|
812 | /**
|
813 | * Decorator: Indicates that the decorated class/object is a view strategy.
|
814 | */
|
815 | /**
|
816 | * Decorator: Indicates that the decorated class/object is a view strategy.
|
817 | */
|
818 | export declare const viewStrategy: Function;
|
819 |
|
820 | /**
|
821 | * A view strategy that loads a view relative to its associated view-model.
|
822 | */
|
823 | export declare class RelativeViewStrategy {
|
824 |
|
825 | |
826 |
|
827 |
|
828 |
|
829 | constructor(path: string);
|
830 |
|
831 | /**
|
832 | * Loads a view factory.
|
833 | * @param viewEngine The view engine to use during the load process.
|
834 | * @param compileInstruction Additional instructions to use during compilation of the view.
|
835 | * @param loadContext The loading context used for loading all resources and dependencies.
|
836 | * @param target A class from which to extract metadata of additional resources to load.
|
837 | * @return A promise for the view factory that is produced by this strategy.
|
838 | */
|
839 | loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise<ViewFactory>;
|
840 |
|
841 | /**
|
842 | * Makes the view loaded by this strategy relative to the provided file path.
|
843 | * @param file The path to load the view relative to.
|
844 | */
|
845 | makeRelativeTo(file: string): void;
|
846 | }
|
847 |
|
848 | /**
|
849 | * A view strategy based on naming conventions.
|
850 | */
|
851 | export declare class ConventionalViewStrategy {
|
852 |
|
853 | |
854 |
|
855 |
|
856 |
|
857 |
|
858 | constructor(viewLocator: ViewLocator, origin: Origin);
|
859 |
|
860 | /**
|
861 | * Loads a view factory.
|
862 | * @param viewEngine The view engine to use during the load process.
|
863 | * @param compileInstruction Additional instructions to use during compilation of the view.
|
864 | * @param loadContext The loading context used for loading all resources and dependencies.
|
865 | * @param target A class from which to extract metadata of additional resources to load.
|
866 | * @return A promise for the view factory that is produced by this strategy.
|
867 | */
|
868 | loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise<ViewFactory>;
|
869 | }
|
870 |
|
871 | /**
|
872 | * A view strategy that indicates that the component has no view that the templating engine needs to manage.
|
873 | * Typically used when the component author wishes to take over fine-grained rendering control.
|
874 | */
|
875 | export declare class NoViewStrategy {
|
876 |
|
877 | |
878 |
|
879 |
|
880 |
|
881 |
|
882 | constructor(dependencies?: Array<string | Function | Object>, dependencyBaseUrl?: string);
|
883 |
|
884 | /**
|
885 | * Loads a view factory.
|
886 | * @param viewEngine The view engine to use during the load process.
|
887 | * @param compileInstruction Additional instructions to use during compilation of the view.
|
888 | * @param loadContext The loading context used for loading all resources and dependencies.
|
889 | * @param target A class from which to extract metadata of additional resources to load.
|
890 | * @return A promise for the view factory that is produced by this strategy.
|
891 | */
|
892 | loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise<ViewFactory>;
|
893 | }
|
894 |
|
895 | /**
|
896 | * A view strategy created directly from the template registry entry.
|
897 | */
|
898 | export declare class TemplateRegistryViewStrategy {
|
899 |
|
900 | |
901 |
|
902 |
|
903 |
|
904 |
|
905 | constructor(moduleId: string, entry: TemplateRegistryEntry);
|
906 |
|
907 | /**
|
908 | * Loads a view factory.
|
909 | * @param viewEngine The view engine to use during the load process.
|
910 | * @param compileInstruction Additional instructions to use during compilation of the view.
|
911 | * @param loadContext The loading context used for loading all resources and dependencies.
|
912 | * @param target A class from which to extract metadata of additional resources to load.
|
913 | * @return A promise for the view factory that is produced by this strategy.
|
914 | */
|
915 | loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise<ViewFactory>;
|
916 | }
|
917 |
|
918 | /**
|
919 | * A view strategy that allows the component author to inline the html for the view.
|
920 | */
|
921 | export declare class InlineViewStrategy {
|
922 |
|
923 | |
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 | constructor(markup: string, dependencies?: Array<string | Function | Object>, dependencyBaseUrl?: string);
|
930 |
|
931 | /**
|
932 | * Loads a view factory.
|
933 | * @param viewEngine The view engine to use during the load process.
|
934 | * @param compileInstruction Additional instructions to use during compilation of the view.
|
935 | * @param loadContext The loading context used for loading all resources and dependencies.
|
936 | * @param target A class from which to extract metadata of additional resources to load.
|
937 | * @return A promise for the view factory that is produced by this strategy.
|
938 | */
|
939 | loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise<ViewFactory>;
|
940 | }
|
941 | export declare class StaticViewStrategy {
|
942 |
|
943 |
|
944 | template: string | HTMLTemplateElement;
|
945 |
|
946 |
|
947 | dependencies: Function[] | (() => Array<Function | Promise<Function | Record<string, Function>>>);
|
948 | factoryIsReady: boolean;
|
949 | factory: ViewFactory;
|
950 | constructor(config: string | HTMLTemplateElement | IStaticViewConfig);
|
951 |
|
952 | /**
|
953 | * Loads a view factory.
|
954 | * @param viewEngine The view engine to use during the load process.
|
955 | * @param compileInstruction Additional instructions to use during compilation of the view.
|
956 | * @param loadContext The loading context used for loading all resources and dependencies.
|
957 | * @param target A class from which to extract metadata of additional resources to load.
|
958 | * @return A promise for the view factory that is produced by this strategy.
|
959 | */
|
960 | loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext: ResourceLoadContext, target: any): Promise<ViewFactory>;
|
961 | }
|
962 |
|
963 | /**
|
964 | * Locates a view for an object.
|
965 | */
|
966 | export declare class ViewLocator {
|
967 |
|
968 | /**
|
969 | * The metadata key for storing/finding view strategies associated with an class/object.
|
970 | */
|
971 | static viewStrategyMetadataKey: any;
|
972 |
|
973 | /**
|
974 | * Gets the view strategy for the value.
|
975 | * @param value The value to locate the view strategy for.
|
976 | * @return The located ViewStrategy instance.
|
977 | */
|
978 | getViewStrategy(value: any): ViewStrategy;
|
979 |
|
980 | /**
|
981 | * Creates a fallback View Strategy. Used when unable to locate a configured strategy.
|
982 | * The default implementation returns and instance of ConventionalViewStrategy.
|
983 | * @param origin The origin of the view model to return the strategy for.
|
984 | * @return The fallback ViewStrategy.
|
985 | */
|
986 | createFallbackViewStrategy(origin: Origin): ViewStrategy;
|
987 |
|
988 | /**
|
989 | * Conventionally converts a view model origin to a view url.
|
990 | * Used by the ConventionalViewStrategy.
|
991 | * @param origin The origin of the view model to convert.
|
992 | * @return The view url.
|
993 | */
|
994 | convertOriginToViewUrl(origin: Origin): string;
|
995 | }
|
996 |
|
997 | /**
|
998 | * An abstract base class for implementations of a binding language.
|
999 | */
|
1000 | export declare class BindingLanguage {
|
1001 |
|
1002 | /**
|
1003 | * Inspects an attribute for bindings.
|
1004 | * @param resources The ViewResources for the view being compiled.
|
1005 | * @param elementName The element name to inspect.
|
1006 | * @param attrName The attribute name to inspect.
|
1007 | * @param attrValue The attribute value to inspect.
|
1008 | * @return An info object with the results of the inspection.
|
1009 | */
|
1010 | inspectAttribute(resources: ViewResources, elementName: string, attrName: string, attrValue: string): Object;
|
1011 |
|
1012 | /**
|
1013 | * Creates an attribute behavior instruction.
|
1014 | * @param resources The ViewResources for the view being compiled.
|
1015 | * @param element The element that the attribute is defined on.
|
1016 | * @param info The info object previously returned from inspectAttribute.
|
1017 | * @param existingInstruction A previously created instruction for this attribute.
|
1018 | * @return The instruction instance.
|
1019 | */
|
1020 | createAttributeInstruction(resources: ViewResources, element: Element, info: Object, existingInstruction?: Object): BehaviorInstruction;
|
1021 |
|
1022 | /**
|
1023 | * Parses the text for bindings.
|
1024 | * @param resources The ViewResources for the view being compiled.
|
1025 | * @param value The value of the text to parse.
|
1026 | * @return A binding expression.
|
1027 | */
|
1028 | inspectTextContent(resources: ViewResources, value: string): Object;
|
1029 | }
|
1030 | export declare class SlotCustomAttribute {
|
1031 | static inject(): any;
|
1032 | constructor(element?: any);
|
1033 | valueChanged(newValue?: any, oldValue?: any): any;
|
1034 | }
|
1035 | export declare class PassThroughSlot {
|
1036 | constructor(anchor?: any, name?: any, destinationName?: any, fallbackFactory?: any);
|
1037 | needsFallbackRendering: any;
|
1038 | renderFallbackContent(view?: any, nodes?: any, projectionSource?: any, index?: any): any;
|
1039 | passThroughTo(destinationSlot?: any): any;
|
1040 | addNode(view?: any, node?: any, projectionSource?: any, index?: any): any;
|
1041 | removeView(view?: any, projectionSource?: any): any;
|
1042 | removeAll(projectionSource?: any): any;
|
1043 | projectFrom(view?: any, projectionSource?: any): any;
|
1044 | created(ownerView?: any): any;
|
1045 | bind(view?: any): any;
|
1046 | attached(): any;
|
1047 | detached(): any;
|
1048 | unbind(): any;
|
1049 | }
|
1050 | export declare class ShadowSlot {
|
1051 | constructor(anchor?: any, name?: any, fallbackFactory?: any);
|
1052 | needsFallbackRendering: any;
|
1053 | addNode(view?: any, node?: any, projectionSource?: any, index?: any, destination?: any): any;
|
1054 | removeView(view?: any, projectionSource?: any): any;
|
1055 | removeAll(projectionSource?: any): any;
|
1056 | projectTo(slots?: any): any;
|
1057 | projectFrom(view?: any, projectionSource?: any): any;
|
1058 | renderFallbackContent(view?: any, nodes?: any, projectionSource?: any, index?: any): any;
|
1059 | created(ownerView?: any): any;
|
1060 | bind(view?: any): any;
|
1061 | attached(): any;
|
1062 | detached(): any;
|
1063 | unbind(): any;
|
1064 | }
|
1065 | export declare class ShadowDOM {
|
1066 | static defaultSlotKey: any;
|
1067 | static getSlotName(node?: any): any;
|
1068 | static distributeView(view?: any, slots?: any, projectionSource?: any, index?: any, destinationOverride?: any): any;
|
1069 | static undistributeView(view?: any, slots?: any, projectionSource?: any): any;
|
1070 | static undistributeAll(slots?: any, projectionSource?: any): any;
|
1071 | static distributeNodes(view?: any, nodes?: any, slots?: any, projectionSource?: any, index?: any, destinationOverride?: any): any;
|
1072 | }
|
1073 | export declare function validateBehaviorName(name: string, type: string): any;
|
1074 |
|
1075 | /**
|
1076 | * Represents a collection of resources used during the compilation of a view.
|
1077 | * Will optinally add information to an existing HtmlBehaviorResource if given
|
1078 | */
|
1079 | export declare class ViewResources {
|
1080 |
|
1081 | /**
|
1082 | * Checks whether the provided class contains any resource conventions
|
1083 | * @param target Target class to extract metadata based on convention
|
1084 | * @param existing If supplied, all custom element / attribute metadata extracted from convention will be apply to this instance
|
1085 | */
|
1086 | static convention(target: Function, existing?: HtmlBehaviorResource): HtmlBehaviorResource | ValueConverterResource | BindingBehaviorResource | ViewEngineHooksResource;
|
1087 |
|
1088 | /**
|
1089 | * A custom binding language used in the view.
|
1090 | */
|
1091 | bindingLanguage: any;
|
1092 |
|
1093 | /**
|
1094 | * Creates an instance of ViewResources.
|
1095 | * @param parent The parent resources. This resources can override them, but if a resource is not found, it will be looked up in the parent.
|
1096 | * @param viewUrl The url of the view to which these resources apply.
|
1097 | */
|
1098 | constructor(parent?: ViewResources, viewUrl?: string);
|
1099 |
|
1100 | /**
|
1101 | * Registers view engine hooks for the view.
|
1102 | * @param hooks The hooks to register.
|
1103 | */
|
1104 | registerViewEngineHooks(hooks: ViewEngineHooks): void;
|
1105 |
|
1106 | /**
|
1107 | * Gets the binding language associated with these resources, or return the provided fallback implementation.
|
1108 | * @param bindingLanguageFallback The fallback binding language implementation to use if no binding language is configured locally.
|
1109 | * @return The binding language.
|
1110 | */
|
1111 | getBindingLanguage(bindingLanguageFallback: BindingLanguage): BindingLanguage;
|
1112 |
|
1113 | /**
|
1114 | * Patches an immediate parent into the view resource resolution hierarchy.
|
1115 | * @param newParent The new parent resources to patch in.
|
1116 | */
|
1117 | patchInParent(newParent: ViewResources): void;
|
1118 |
|
1119 | /**
|
1120 | * Maps a path relative to the associated view's origin.
|
1121 | * @param path The relative path.
|
1122 | * @return The calcualted path.
|
1123 | */
|
1124 | relativeToView(path: string): string;
|
1125 |
|
1126 | /**
|
1127 | * Registers an HTML element.
|
1128 | * @param tagName The name of the custom element.
|
1129 | * @param behavior The behavior of the element.
|
1130 | */
|
1131 | registerElement(tagName: string, behavior: HtmlBehaviorResource): void;
|
1132 |
|
1133 | /**
|
1134 | * Gets an HTML element behavior.
|
1135 | * @param tagName The tag name to search for.
|
1136 | * @return The HtmlBehaviorResource for the tag name or null.
|
1137 | */
|
1138 | getElement(tagName: string): HtmlBehaviorResource;
|
1139 |
|
1140 | /**
|
1141 | * Gets the known attribute name based on the local attribute name.
|
1142 | * @param attribute The local attribute name to lookup.
|
1143 | * @return The known name.
|
1144 | */
|
1145 | mapAttribute(attribute: string): string;
|
1146 |
|
1147 | /**
|
1148 | * Registers an HTML attribute.
|
1149 | * @param attribute The name of the attribute.
|
1150 | * @param behavior The behavior of the attribute.
|
1151 | * @param knownAttribute The well-known name of the attribute (in lieu of the local name).
|
1152 | */
|
1153 | registerAttribute(attribute: string, behavior: HtmlBehaviorResource, knownAttribute: string): void;
|
1154 |
|
1155 | /**
|
1156 | * Gets an HTML attribute behavior.
|
1157 | * @param attribute The name of the attribute to lookup.
|
1158 | * @return The HtmlBehaviorResource for the attribute or null.
|
1159 | */
|
1160 | getAttribute(attribute: string): HtmlBehaviorResource;
|
1161 |
|
1162 | /**
|
1163 | * Registers a value converter.
|
1164 | * @param name The name of the value converter.
|
1165 | * @param valueConverter The value converter instance.
|
1166 | */
|
1167 | registerValueConverter(name: string, valueConverter: Object): void;
|
1168 |
|
1169 | /**
|
1170 | * Gets a value converter.
|
1171 | * @param name The name of the value converter.
|
1172 | * @return The value converter instance.
|
1173 | */
|
1174 | getValueConverter(name: string): Object;
|
1175 |
|
1176 | /**
|
1177 | * Registers a binding behavior.
|
1178 | * @param name The name of the binding behavior.
|
1179 | * @param bindingBehavior The binding behavior instance.
|
1180 | */
|
1181 | registerBindingBehavior(name: string, bindingBehavior: Object): void;
|
1182 |
|
1183 | /**
|
1184 | * Gets a binding behavior.
|
1185 | * @param name The name of the binding behavior.
|
1186 | * @return The binding behavior instance.
|
1187 | */
|
1188 | getBindingBehavior(name: string): Object;
|
1189 |
|
1190 | /**
|
1191 | * Registers a value.
|
1192 | * @param name The name of the value.
|
1193 | * @param value The value.
|
1194 | */
|
1195 | registerValue(name: string, value: any): void;
|
1196 |
|
1197 | /**
|
1198 | * Gets a value.
|
1199 | * @param name The name of the value.
|
1200 | * @return The value.
|
1201 | */
|
1202 | getValue(name: string): any;
|
1203 |
|
1204 | /**
|
1205 | * @internal
|
1206 | * Not supported for public use. Can be changed without warning.
|
1207 | *
|
1208 | * Auto register a resources based on its metadata or convention
|
1209 | * Will fallback to custom element if no metadata found and all conventions fail
|
1210 | * @param {Container} container
|
1211 | * @param {Function} impl
|
1212 | * @returns {HtmlBehaviorResource | ValueConverterResource | BindingBehaviorResource | ViewEngineHooksResource}
|
1213 | */
|
1214 | autoRegister(container?: any, impl?: any): any;
|
1215 | }
|
1216 | export declare class View {
|
1217 |
|
1218 | /**
|
1219 | * The Dependency Injection Container that was used to create this View instance.
|
1220 | */
|
1221 | container: Container;
|
1222 |
|
1223 | /**
|
1224 | * The ViewFactory that built this View instance.
|
1225 | */
|
1226 | viewFactory: ViewFactory;
|
1227 |
|
1228 | /**
|
1229 | * Contains the DOM Nodes which represent this View. If the view was created via the "enhance" API, this will be an Element, otherwise it will be a DocumentFragment. If not created via "enhance" then the fragment will only contain nodes when the View is detached from the DOM.
|
1230 | */
|
1231 | fragment: DocumentFragment | Element;
|
1232 |
|
1233 | /**
|
1234 | * The primary binding context that this view is data-bound to.
|
1235 | */
|
1236 | bindingContext: Object;
|
1237 |
|
1238 | /**
|
1239 | * The override context which contains properties capable of overriding those found on the binding context.
|
1240 | */
|
1241 | overrideContext: Object;
|
1242 |
|
1243 | /**
|
1244 | * The Controller instance that owns this View.
|
1245 | */
|
1246 | controller: Controller;
|
1247 |
|
1248 | /**
|
1249 | * Creates a View instance.
|
1250 | * @param container The container from which the view was created.
|
1251 | * @param viewFactory The factory that created this view.
|
1252 | * @param fragment The DOM fragement representing the view.
|
1253 | * @param controllers The controllers inside this view.
|
1254 | * @param bindings The bindings inside this view.
|
1255 | * @param children The children of this view.
|
1256 | */
|
1257 | constructor(container: Container, viewFactory: ViewFactory, fragment: DocumentFragment, controllers: Controller[], bindings: Binding[], children: ViewNode[], slots: Object);
|
1258 |
|
1259 | /**
|
1260 | * Returns this view to the appropriate view cache.
|
1261 | */
|
1262 | returnToCache(): void;
|
1263 |
|
1264 | /**
|
1265 | * Triggers the created callback for this view and its children.
|
1266 | */
|
1267 | created(): void;
|
1268 |
|
1269 | /**
|
1270 | * Binds the view and it's children.
|
1271 | * @param bindingContext The binding context to bind to.
|
1272 | * @param overrideContext A secondary binding context that can override the standard context.
|
1273 | */
|
1274 | bind(bindingContext: Object, overrideContext?: Object, _systemUpdate?: boolean): void;
|
1275 |
|
1276 | /**
|
1277 | * Adds a binding instance to this view.
|
1278 | * @param binding The binding instance.
|
1279 | */
|
1280 | addBinding(binding: Object): void;
|
1281 |
|
1282 | /**
|
1283 | * Unbinds the view and its children.
|
1284 | */
|
1285 | unbind(): void;
|
1286 |
|
1287 | /**
|
1288 | * Inserts this view's nodes before the specified DOM node.
|
1289 | * @param refNode The node to insert this view's nodes before.
|
1290 | */
|
1291 | insertNodesBefore(refNode: Node): void;
|
1292 |
|
1293 | /**
|
1294 | * Appends this view's to the specified DOM node.
|
1295 | * @param parent The parent element to append this view's nodes to.
|
1296 | */
|
1297 | appendNodesTo(parent: Element): void;
|
1298 |
|
1299 | /**
|
1300 | * Removes this view's nodes from the DOM.
|
1301 | */
|
1302 | removeNodes(): void;
|
1303 |
|
1304 | /**
|
1305 | * Triggers the attach for the view and its children.
|
1306 | */
|
1307 | attached(): void;
|
1308 |
|
1309 | /**
|
1310 | * Triggers the detach for the view and its children.
|
1311 | */
|
1312 | detached(): void;
|
1313 | }
|
1314 |
|
1315 | /**
|
1316 | * Represents a slot or location within the DOM to which views can be added and removed.
|
1317 | * Manages the view lifecycle for its children.
|
1318 | */
|
1319 | export declare class ViewSlot {
|
1320 |
|
1321 | /**
|
1322 | * Creates an instance of ViewSlot.
|
1323 | * @param anchor The DOM node which will server as the anchor or container for insertion.
|
1324 | * @param anchorIsContainer Indicates whether the node is a container.
|
1325 | * @param animator The animator that will controll enter/leave transitions for this slot.
|
1326 | */
|
1327 | constructor(anchor: Node, anchorIsContainer: boolean, animator?: Animator);
|
1328 |
|
1329 | /**
|
1330 | * Runs the animator against the first animatable element found within the view's fragment
|
1331 | * @param view The view to use when searching for the element.
|
1332 | * @param direction The animation direction enter|leave.
|
1333 | * @returns An animation complete Promise or undefined if no animation was run.
|
1334 | */
|
1335 | animateView(view: View, direction?: string): void | Promise<any>;
|
1336 |
|
1337 | /**
|
1338 | * Takes the child nodes of an existing element that has been converted into a ViewSlot
|
1339 | * and makes those nodes into a View within the slot.
|
1340 | */
|
1341 | transformChildNodesIntoView(): void;
|
1342 |
|
1343 | /**
|
1344 | * Binds the slot and it's children.
|
1345 | * @param bindingContext The binding context to bind to.
|
1346 | * @param overrideContext A secondary binding context that can override the standard context.
|
1347 | */
|
1348 | bind(bindingContext: Object, overrideContext: Object): void;
|
1349 |
|
1350 | /**
|
1351 | * Unbinds the slot and its children.
|
1352 | */
|
1353 | unbind(): void;
|
1354 |
|
1355 | /**
|
1356 | * Adds a view to the slot.
|
1357 | * @param view The view to add.
|
1358 | * @return May return a promise if the view addition triggered an animation.
|
1359 | */
|
1360 | add(view: View): void | Promise<any>;
|
1361 |
|
1362 | /**
|
1363 | * Inserts a view into the slot.
|
1364 | * @param index The index to insert the view at.
|
1365 | * @param view The view to insert.
|
1366 | * @return May return a promise if the view insertion triggered an animation.
|
1367 | */
|
1368 | insert(index: number, view: View): void | Promise<any>;
|
1369 |
|
1370 | /**
|
1371 | * Moves a view across the slot.
|
1372 | * @param sourceIndex The index the view is currently at.
|
1373 | * @param targetIndex The index to insert the view at.
|
1374 | */
|
1375 | move(sourceIndex?: any, targetIndex?: any): any;
|
1376 |
|
1377 | /**
|
1378 | * Removes a view from the slot.
|
1379 | * @param view The view to remove.
|
1380 | * @param returnToCache Should the view be returned to the view cache?
|
1381 | * @param skipAnimation Should the removal animation be skipped?
|
1382 | * @return May return a promise if the view removal triggered an animation.
|
1383 | */
|
1384 | remove(view: View, returnToCache?: boolean, skipAnimation?: boolean): View | Promise<View>;
|
1385 |
|
1386 | /**
|
1387 | * Removes many views from the slot.
|
1388 | * @param viewsToRemove The array of views to remove.
|
1389 | * @param returnToCache Should the views be returned to the view cache?
|
1390 | * @param skipAnimation Should the removal animation be skipped?
|
1391 | * @return May return a promise if the view removal triggered an animation.
|
1392 | */
|
1393 | removeMany(viewsToRemove: View[], returnToCache?: boolean, skipAnimation?: boolean): void | Promise<void>;
|
1394 |
|
1395 | /**
|
1396 | * Removes a view an a specified index from the slot.
|
1397 | * @param index The index to remove the view at.
|
1398 | * @param returnToCache Should the view be returned to the view cache?
|
1399 | * @param skipAnimation Should the removal animation be skipped?
|
1400 | * @return May return a promise if the view removal triggered an animation.
|
1401 | */
|
1402 | removeAt(index: number, returnToCache?: boolean, skipAnimation?: boolean): View | Promise<View>;
|
1403 |
|
1404 | /**
|
1405 | * Removes all views from the slot.
|
1406 | * @param returnToCache Should the view be returned to the view cache?
|
1407 | * @param skipAnimation Should the removal animation be skipped?
|
1408 | * @return May return a promise if the view removals triggered an animation.
|
1409 | */
|
1410 | removeAll(returnToCache?: boolean, skipAnimation?: boolean): void | Promise<any>;
|
1411 |
|
1412 | /**
|
1413 | * Triggers the attach for the slot and its children.
|
1414 | */
|
1415 | attached(): void;
|
1416 |
|
1417 | /**
|
1418 | * Triggers the detach for the slot and its children.
|
1419 | */
|
1420 | detached(): void;
|
1421 | projectTo(slots: Object): void;
|
1422 | }
|
1423 |
|
1424 | /**
|
1425 | * A factory capable of creating View instances, bound to a location within another view hierarchy.
|
1426 | */
|
1427 | export declare class BoundViewFactory {
|
1428 |
|
1429 | /**
|
1430 | * Creates an instance of BoundViewFactory.
|
1431 | * @param parentContainer The parent DI container.
|
1432 | * @param viewFactory The internal unbound factory.
|
1433 | * @param partReplacements Part replacement overrides for the internal factory.
|
1434 | */
|
1435 | constructor(parentContainer: Container, viewFactory: ViewFactory, partReplacements?: Object);
|
1436 |
|
1437 | /**
|
1438 | * Creates a view or returns one from the internal cache, if available.
|
1439 | * @return The created view.
|
1440 | */
|
1441 | create(): View;
|
1442 |
|
1443 | /**
|
1444 | * Indicates whether this factory is currently using caching.
|
1445 | */
|
1446 | isCaching: any;
|
1447 |
|
1448 | /**
|
1449 | * Sets the cache size for this factory.
|
1450 | * @param size The number of views to cache or "*" to cache all.
|
1451 | * @param doNotOverrideIfAlreadySet Indicates that setting the cache should not override the setting if previously set.
|
1452 | */
|
1453 | setCacheSize(size: number | string, doNotOverrideIfAlreadySet: boolean): void;
|
1454 |
|
1455 | /**
|
1456 | * Gets a cached view if available...
|
1457 | * @return A cached view or null if one isn't available.
|
1458 | */
|
1459 | getCachedView(): View;
|
1460 |
|
1461 | /**
|
1462 | * Returns a view to the cache.
|
1463 | * @param view The view to return to the cache if space is available.
|
1464 | */
|
1465 | returnViewToCache(view: View): void;
|
1466 | }
|
1467 |
|
1468 | /**
|
1469 | * A factory capable of creating View instances.
|
1470 | */
|
1471 | export declare class ViewFactory {
|
1472 |
|
1473 | /**
|
1474 | * Indicates whether this factory is currently using caching.
|
1475 | */
|
1476 | isCaching: any;
|
1477 |
|
1478 | /**
|
1479 | * Creates an instance of ViewFactory.
|
1480 | * @param template The document fragment that serves as a template for the view to be created.
|
1481 | * @param instructions The instructions to be applied ot the template during the creation of a view.
|
1482 | * @param resources The resources used to compile this factory.
|
1483 | */
|
1484 | constructor(template: DocumentFragment, instructions: Object, resources: ViewResources);
|
1485 |
|
1486 | /**
|
1487 | * Sets the cache size for this factory.
|
1488 | * @param size The number of views to cache or "*" to cache all.
|
1489 | * @param doNotOverrideIfAlreadySet Indicates that setting the cache should not override the setting if previously set.
|
1490 | */
|
1491 | setCacheSize(size: number | string, doNotOverrideIfAlreadySet: boolean): void;
|
1492 |
|
1493 | /**
|
1494 | * Gets a cached view if available...
|
1495 | * @return A cached view or null if one isn't available.
|
1496 | */
|
1497 | getCachedView(): View;
|
1498 |
|
1499 | /**
|
1500 | * Returns a view to the cache.
|
1501 | * @param view The view to return to the cache if space is available.
|
1502 | */
|
1503 | returnViewToCache(view: View): void;
|
1504 |
|
1505 | /**
|
1506 | * Creates a view or returns one from the internal cache, if available.
|
1507 | * @param container The container to create the view from.
|
1508 | * @param createInstruction The instruction used to customize view creation.
|
1509 | * @param element The custom element that hosts the view.
|
1510 | * @return The created view.
|
1511 | */
|
1512 | create(container: Container, createInstruction?: ViewCreateInstruction, element?: Element): View;
|
1513 | }
|
1514 |
|
1515 | /**
|
1516 | * Compiles html templates, dom fragments and strings into ViewFactory instances, capable of instantiating Views.
|
1517 | */
|
1518 | export declare class ViewCompiler {
|
1519 |
|
1520 | /**
|
1521 | * Creates an instance of ViewCompiler.
|
1522 | * @param bindingLanguage The default data binding language and syntax used during view compilation.
|
1523 | * @param resources The global resources used during compilation when none are provided for compilation.
|
1524 | */
|
1525 | constructor(bindingLanguage: BindingLanguage, resources: ViewResources);
|
1526 |
|
1527 | /**
|
1528 | * Compiles an html template, dom fragment or string into ViewFactory instances, capable of instantiating Views.
|
1529 | * @param source The template, fragment or string to compile.
|
1530 | * @param resources The view resources used during compilation.
|
1531 | * @param compileInstruction A set of instructions that customize how compilation occurs.
|
1532 | * @return The compiled ViewFactory.
|
1533 | */
|
1534 | compile(source: Element | DocumentFragment | string, resources?: ViewResources, compileInstruction?: ViewCompileInstruction): ViewFactory;
|
1535 | }
|
1536 |
|
1537 | /**
|
1538 | * Represents a module with view resources.
|
1539 | */
|
1540 | export declare class ResourceModule {
|
1541 |
|
1542 | /**
|
1543 | * Creates an instance of ResourceModule.
|
1544 | * @param moduleId The id of the module that contains view resources.
|
1545 | */
|
1546 | constructor(moduleId: string);
|
1547 |
|
1548 | /**
|
1549 | * Initializes the resources within the module.
|
1550 | * @param container The dependency injection container usable during resource initialization.
|
1551 | */
|
1552 | initialize(container: Container): void;
|
1553 |
|
1554 | /**
|
1555 | * Registers the resources in the module with the view resources.
|
1556 | * @param registry The registry of view resources to regiser within.
|
1557 | * @param name The name to use in registering the default resource.
|
1558 | */
|
1559 | register(registry: ViewResources, name?: string): void;
|
1560 |
|
1561 | /**
|
1562 | * Loads any dependencies of the resources within this module.
|
1563 | * @param container The DI container to use during dependency resolution.
|
1564 | * @param loadContext The loading context used for loading all resources and dependencies.
|
1565 | * @return A promise that resolves when all loading is complete.
|
1566 | */
|
1567 | load(container: Container, loadContext?: ResourceLoadContext): Promise<void>;
|
1568 | }
|
1569 |
|
1570 | /**
|
1571 | * Represents a single view resource with a ResourceModule.
|
1572 | */
|
1573 | export declare class ResourceDescription {
|
1574 |
|
1575 | /**
|
1576 | * Creates an instance of ResourceDescription.
|
1577 | * @param key The key that the resource was exported as.
|
1578 | * @param exportedValue The exported resource.
|
1579 | * @param resourceTypeMeta The metadata located on the resource.
|
1580 | */
|
1581 | constructor(key: string, exportedValue: any, resourceTypeMeta?: Object);
|
1582 |
|
1583 | /**
|
1584 | * Initializes the resource.
|
1585 | * @param container The dependency injection container usable during resource initialization.
|
1586 | */
|
1587 | initialize(container: Container): void;
|
1588 |
|
1589 | /**
|
1590 | * Registrers the resource with the view resources.
|
1591 | * @param registry The registry of view resources to regiser within.
|
1592 | * @param name The name to use in registering the resource.
|
1593 | */
|
1594 | register(registry: ViewResources, name?: string): void;
|
1595 |
|
1596 | /**
|
1597 | * Loads any dependencies of the resource.
|
1598 | * @param container The DI container to use during dependency resolution.
|
1599 | * @param loadContext The loading context used for loading all resources and dependencies.
|
1600 | * @return A promise that resolves when all loading is complete.
|
1601 | */
|
1602 | load(container: Container, loadContext?: ResourceLoadContext): Promise<void> | void;
|
1603 | }
|
1604 |
|
1605 | /**
|
1606 | * Analyzes a module in order to discover the view resources that it exports.
|
1607 | */
|
1608 | export declare class ModuleAnalyzer {
|
1609 |
|
1610 | /**
|
1611 | * Creates an instance of ModuleAnalyzer.
|
1612 | */
|
1613 | constructor();
|
1614 |
|
1615 | /**
|
1616 | * Retrieves the ResourceModule analysis for a previously analyzed module.
|
1617 | * @param moduleId The id of the module to lookup.
|
1618 | * @return The ResouceModule if found, undefined otherwise.
|
1619 | */
|
1620 | getAnalysis(moduleId: string): ResourceModule;
|
1621 |
|
1622 | /**
|
1623 | * Analyzes a module.
|
1624 | * @param moduleId The id of the module to analyze.
|
1625 | * @param moduleInstance The module instance to analyze.
|
1626 | * @param mainResourceKey The name of the main resource.
|
1627 | * @return The ResouceModule representing the analysis.
|
1628 | */
|
1629 | analyze(moduleId: string, moduleInstance: any, mainResourceKey?: string): ResourceModule;
|
1630 | }
|
1631 |
|
1632 | /**
|
1633 | * Controls the view resource loading pipeline.
|
1634 | */
|
1635 | export declare class ViewEngine {
|
1636 |
|
1637 | /**
|
1638 | * The metadata key for storing requires declared in a ViewModel.
|
1639 | */
|
1640 | static viewModelRequireMetadataKey: any;
|
1641 |
|
1642 | /**
|
1643 | * Creates an instance of ViewEngine.
|
1644 | * @param loader The module loader.
|
1645 | * @param container The root DI container for the app.
|
1646 | * @param viewCompiler The view compiler.
|
1647 | * @param moduleAnalyzer The module analyzer.
|
1648 | * @param appResources The app-level global resources.
|
1649 | */
|
1650 | constructor(loader: Loader, container: Container, viewCompiler: ViewCompiler, moduleAnalyzer: ModuleAnalyzer, appResources: ViewResources);
|
1651 |
|
1652 | /**
|
1653 | * Adds a resource plugin to the resource loading pipeline.
|
1654 | * @param extension The file extension to match in require elements.
|
1655 | * @param implementation The plugin implementation that handles the resource type.
|
1656 | */
|
1657 | addResourcePlugin(extension: string, implementation: Object): void;
|
1658 |
|
1659 | /**
|
1660 | * Loads and compiles a ViewFactory from a url or template registry entry.
|
1661 | * @param urlOrRegistryEntry A url or template registry entry to generate the view factory for.
|
1662 | * @param compileInstruction Instructions detailing how the factory should be compiled.
|
1663 | * @param loadContext The load context if this factory load is happening within the context of a larger load operation.
|
1664 | * @param target A class from which to extract metadata of additional resources to load.
|
1665 | * @return A promise for the compiled view factory.
|
1666 | */
|
1667 | loadViewFactory(urlOrRegistryEntry: string | TemplateRegistryEntry, compileInstruction?: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise<ViewFactory>;
|
1668 |
|
1669 | /**
|
1670 | * Loads all the resources specified by the registry entry.
|
1671 | * @param registryEntry The template registry entry to load the resources for.
|
1672 | * @param compileInstruction The compile instruction associated with the load.
|
1673 | * @param loadContext The load context if this is happening within the context of a larger load operation.
|
1674 | * @param target A class from which to extract metadata of additional resources to load.
|
1675 | * @return A promise of ViewResources for the registry entry.
|
1676 | */
|
1677 | loadTemplateResources(registryEntry: TemplateRegistryEntry, compileInstruction?: ViewCompileInstruction, loadContext?: ResourceLoadContext, target?: any): Promise<ViewResources>;
|
1678 |
|
1679 | /**
|
1680 | * Loads a view model as a resource.
|
1681 | * @param moduleImport The module to import.
|
1682 | * @param moduleMember The export from the module to generate the resource for.
|
1683 | * @return A promise for the ResourceDescription.
|
1684 | */
|
1685 | importViewModelResource(moduleImport: string, moduleMember: string): Promise<ResourceDescription>;
|
1686 |
|
1687 | /**
|
1688 | * Imports the specified resources with the specified names into the view resources object.
|
1689 | * @param moduleIds The modules to load.
|
1690 | * @param names The names associated with resource modules to import.
|
1691 | * @param resources The resources lookup to add the loaded resources to.
|
1692 | * @param compileInstruction The compilation instruction associated with the resource imports.
|
1693 | * @return A promise for the ViewResources.
|
1694 | */
|
1695 | importViewResources(moduleIds: string[], names: string[], resources: ViewResources, compileInstruction?: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise<ViewResources>;
|
1696 | }
|
1697 |
|
1698 | /**
|
1699 | * Controls a view model (and optionally its view), according to a particular behavior and by following a set of instructions.
|
1700 | */
|
1701 | export declare class Controller {
|
1702 |
|
1703 | /**
|
1704 | * The HtmlBehaviorResource that provides the base behavior for this controller.
|
1705 | */
|
1706 | behavior: HtmlBehaviorResource;
|
1707 |
|
1708 | /**
|
1709 | * The developer's view model instance which provides the custom behavior for this controller.
|
1710 | */
|
1711 | viewModel: Object;
|
1712 |
|
1713 | /**
|
1714 | * The view associated with the component being controlled by this controller.
|
1715 | * Note: Not all components will have a view, so the value may be null.
|
1716 | */
|
1717 | view: View;
|
1718 |
|
1719 | /**
|
1720 | * Creates an instance of Controller.
|
1721 | * @param behavior The HtmlBehaviorResource that provides the base behavior for this controller.
|
1722 | * @param instruction The instructions pertaining to the controller's behavior.
|
1723 | * @param viewModel The developer's view model instance which provides the custom behavior for this controller.
|
1724 | * @param container The container that the controller's view was created from.
|
1725 | */
|
1726 | constructor(behavior: HtmlBehaviorResource, instruction: BehaviorInstruction, viewModel: Object, container: Container);
|
1727 |
|
1728 | /**
|
1729 | * Invoked when the view which contains this controller is created.
|
1730 | * @param owningView The view inside which this controller resides.
|
1731 | */
|
1732 | created(owningView: View): void;
|
1733 |
|
1734 | /**
|
1735 | * Used to automate the proper binding of this controller and its view. Used by the composition engine for dynamic component creation.
|
1736 | * This should be considered a semi-private API and is subject to change without notice, even across minor or patch releases.
|
1737 | * @param overrideContext An override context for binding.
|
1738 | * @param owningView The view inside which this controller resides.
|
1739 | */
|
1740 | automate(overrideContext?: Object, owningView?: View): void;
|
1741 |
|
1742 | /**
|
1743 | * Binds the controller to the scope.
|
1744 | * @param scope The binding scope.
|
1745 | */
|
1746 | bind(scope: Object): void;
|
1747 |
|
1748 | /**
|
1749 | * Unbinds the controller.
|
1750 | */
|
1751 | unbind(): void;
|
1752 |
|
1753 | /**
|
1754 | * Attaches the controller.
|
1755 | */
|
1756 | attached(): void;
|
1757 |
|
1758 | /**
|
1759 | * Detaches the controller.
|
1760 | */
|
1761 | detached(): void;
|
1762 | }
|
1763 |
|
1764 | /**
|
1765 | * An implementation of Aurelia's Observer interface that is used to back bindable properties defined on a behavior.
|
1766 | */
|
1767 | export declare class BehaviorPropertyObserver {
|
1768 |
|
1769 | /**
|
1770 | * Creates an instance of BehaviorPropertyObserver.
|
1771 | * @param taskQueue The task queue used to schedule change notifications.
|
1772 | * @param obj The object that the property is defined on.
|
1773 | * @param propertyName The name of the property.
|
1774 | * @param selfSubscriber The callback function that notifies the object which defines the properties, if present.
|
1775 | * @param initialValue The initial value of the property.
|
1776 | */
|
1777 | constructor(taskQueue: TaskQueue, obj: Object, propertyName: string, selfSubscriber: Function, initialValue: any);
|
1778 |
|
1779 | /**
|
1780 | * Gets the property's value.
|
1781 | */
|
1782 | getValue(): any;
|
1783 |
|
1784 | /**
|
1785 | * Sets the property's value.
|
1786 | * @param newValue The new value to set.
|
1787 | */
|
1788 | setValue(newValue: any): void;
|
1789 |
|
1790 | /**
|
1791 | * Invoked by the TaskQueue to publish changes to subscribers.
|
1792 | */
|
1793 | call(): void;
|
1794 |
|
1795 | /**
|
1796 | * Subscribes to the observerable.
|
1797 | * @param context A context object to pass along to the subscriber when it's called.
|
1798 | * @param callable A function or object with a "call" method to be invoked for delivery of changes.
|
1799 | */
|
1800 | subscribe(context: any, callable: Function): void;
|
1801 |
|
1802 | /**
|
1803 | * Unsubscribes from the observerable.
|
1804 | * @param context The context object originally subscribed with.
|
1805 | * @param callable The callable that was originally subscribed with.
|
1806 | */
|
1807 | unsubscribe(context: any, callable: Function): void;
|
1808 | }
|
1809 |
|
1810 | /**
|
1811 | * Represents a bindable property on a behavior.
|
1812 | */
|
1813 | export declare class BindableProperty {
|
1814 |
|
1815 | /**
|
1816 | * Creates an instance of BindableProperty.
|
1817 | * @param nameOrConfig The name of the property or a cofiguration object.
|
1818 | */
|
1819 | constructor(nameOrConfig: string | Object);
|
1820 |
|
1821 | /**
|
1822 | * Registers this bindable property with particular Class and Behavior instance.
|
1823 | * @param target The class to register this behavior with.
|
1824 | * @param behavior The behavior instance to register this property with.
|
1825 | * @param descriptor The property descriptor for this property.
|
1826 | */
|
1827 | registerWith(target: Function, behavior: HtmlBehaviorResource, descriptor?: Object): void;
|
1828 |
|
1829 | /**
|
1830 | * Defines this property on the specified class and behavior.
|
1831 | * @param target The class to define the property on.
|
1832 | * @param behavior The behavior to define the property on.
|
1833 | */
|
1834 | defineOn(target: Function, behavior: HtmlBehaviorResource): void;
|
1835 |
|
1836 | /**
|
1837 | * Creates an observer for this property.
|
1838 | * @param viewModel The view model instance on which to create the observer.
|
1839 | * @return The property observer.
|
1840 | */
|
1841 | createObserver(viewModel: Object): BehaviorPropertyObserver;
|
1842 | }
|
1843 |
|
1844 | /**
|
1845 | * Identifies a class as a resource that implements custom element or custom
|
1846 | * attribute functionality.
|
1847 | */
|
1848 | export declare class HtmlBehaviorResource {
|
1849 |
|
1850 | /**
|
1851 | * Creates an instance of HtmlBehaviorResource.
|
1852 | */
|
1853 | constructor();
|
1854 |
|
1855 | /**
|
1856 | * Checks whether the provided name matches any naming conventions for HtmlBehaviorResource.
|
1857 | * @param name The name of the potential resource.
|
1858 | * @param existing An already existing resource that may need a convention name applied.
|
1859 | */
|
1860 | static convention(name: string, existing?: HtmlBehaviorResource): HtmlBehaviorResource;
|
1861 |
|
1862 | /**
|
1863 | * Adds a binding expression to the component created by this resource.
|
1864 | * @param behavior The binding expression.
|
1865 | */
|
1866 | addChildBinding(behavior: Object): void;
|
1867 |
|
1868 | /**
|
1869 | * Provides an opportunity for the resource to initialize iteself.
|
1870 | * @param container The dependency injection container from which the resource
|
1871 | * can aquire needed services.
|
1872 | * @param target The class to which this resource metadata is attached.
|
1873 | */
|
1874 | initialize(container: Container, target: Function): void;
|
1875 |
|
1876 | /**
|
1877 | * Allows the resource to be registered in the view resources for the particular
|
1878 | * view into which it was required.
|
1879 | * @param registry The view resource registry for the view that required this resource.
|
1880 | * @param name The name provided by the end user for this resource, within the
|
1881 | * particular view it's being used.
|
1882 | */
|
1883 | register(registry: ViewResources, name?: string): void;
|
1884 |
|
1885 | /**
|
1886 | * Enables the resource to asynchronously load additional resources.
|
1887 | * @param container The dependency injection container from which the resource
|
1888 | * can aquire needed services.
|
1889 | * @param target The class to which this resource metadata is attached.
|
1890 | * @param loadContext The loading context object provided by the view engine.
|
1891 | * @param viewStrategy A view strategy to overload the default strategy defined by the resource.
|
1892 | * @param transientView Indicated whether the view strategy is transient or
|
1893 | * permanently tied to this component.
|
1894 | */
|
1895 | load(container: Container, target: Function, loadContext?: ResourceLoadContext, viewStrategy?: ViewStrategy, transientView?: boolean): Promise<HtmlBehaviorResource>;
|
1896 |
|
1897 | /**
|
1898 | * Plugs into the compiler and enables custom processing of the node on which this behavior is located.
|
1899 | * @param compiler The compiler that is currently compiling the view that this behavior exists within.
|
1900 | * @param resources The resources for the view that this behavior exists within.
|
1901 | * @param node The node on which this behavior exists.
|
1902 | * @param instruction The behavior instruction created for this behavior.
|
1903 | * @param parentNode The parent node of the current node.
|
1904 | * @return The current node.
|
1905 | */
|
1906 | compile(compiler: ViewCompiler, resources: ViewResources, node: Node, instruction: BehaviorInstruction, parentNode?: Node): Node;
|
1907 |
|
1908 | /**
|
1909 | * Creates an instance of this behavior.
|
1910 | * @param container The DI container to create the instance in.
|
1911 | * @param instruction The instruction for this behavior that was constructed during compilation.
|
1912 | * @param element The element on which this behavior exists.
|
1913 | * @param bindings The bindings that are associated with the view in which this behavior exists.
|
1914 | * @return The Controller of this behavior.
|
1915 | */
|
1916 | create(container: Container, instruction?: BehaviorInstruction, element?: Element, bindings?: Binding[]): Controller;
|
1917 | }
|
1918 |
|
1919 | /**
|
1920 | * Creates a behavior property that references an array of immediate content child elements that matches the provided selector.
|
1921 | */
|
1922 | export declare function children(selectorOrConfig: string | Object): any;
|
1923 |
|
1924 | /**
|
1925 | * Creates a behavior property that references an immediate content child element that matches the provided selector.
|
1926 | */
|
1927 | export declare function child(selectorOrConfig: string | Object): any;
|
1928 | export declare const SwapStrategies: any;
|
1929 |
|
1930 | /**
|
1931 | * Used to dynamically compose components.
|
1932 | */
|
1933 | export declare class CompositionEngine {
|
1934 |
|
1935 | /**
|
1936 | * Creates an instance of the CompositionEngine.
|
1937 | * @param viewEngine The ViewEngine used during composition.
|
1938 | */
|
1939 | constructor(viewEngine: ViewEngine, viewLocator: ViewLocator);
|
1940 |
|
1941 | /**
|
1942 | * Creates a controller instance for the component described in the context.
|
1943 | * @param context The CompositionContext that describes the component.
|
1944 | * @return A Promise for the Controller.
|
1945 | */
|
1946 | createController(context: CompositionContext): Promise<Controller>;
|
1947 |
|
1948 | /**
|
1949 | * Ensures that the view model and its resource are loaded for this context.
|
1950 | * @param context The CompositionContext to load the view model and its resource for.
|
1951 | * @return A Promise for the context.
|
1952 | */
|
1953 | ensureViewModel(context: CompositionContext): Promise<CompositionContext>;
|
1954 |
|
1955 | /**
|
1956 | * Dynamically composes a component.
|
1957 | * @param context The CompositionContext providing information on how the composition should occur.
|
1958 | * @return A Promise for the View or the Controller that results from the dynamic composition.
|
1959 | */
|
1960 | compose(context: CompositionContext): Promise<View | Controller>;
|
1961 | }
|
1962 |
|
1963 | /**
|
1964 | * Identifies a class as a resource that configures the EventManager with information
|
1965 | * about how events relate to properties for the purpose of two-way data-binding
|
1966 | * to Web Components.
|
1967 | */
|
1968 | export declare class ElementConfigResource {
|
1969 |
|
1970 | /**
|
1971 | * Provides an opportunity for the resource to initialize iteself.
|
1972 | * @param container The dependency injection container from which the resource
|
1973 | * can aquire needed services.
|
1974 | * @param target The class to which this resource metadata is attached.
|
1975 | */
|
1976 | initialize(container: Container, target: Function): void;
|
1977 |
|
1978 | /**
|
1979 | * Allows the resource to be registered in the view resources for the particular
|
1980 | * view into which it was required.
|
1981 | * @param registry The view resource registry for the view that required this resource.
|
1982 | * @param name The name provided by the end user for this resource, within the
|
1983 | * particular view it's being used.
|
1984 | */
|
1985 | register(registry: ViewResources, name?: string): void;
|
1986 |
|
1987 | /**
|
1988 | * Enables the resource to asynchronously load additional resources.
|
1989 | * @param container The dependency injection container from which the resource
|
1990 | * can aquire needed services.
|
1991 | * @param target The class to which this resource metadata is attached.
|
1992 | */
|
1993 | load(container: Container, target: Function): void;
|
1994 | }
|
1995 |
|
1996 | /**
|
1997 | * Decorator: Specifies a resource instance that describes the decorated class.
|
1998 | * @param instanceOrConfig The resource instance.
|
1999 | */
|
2000 | export declare function resource(instanceOrConfig: string | object): any;
|
2001 |
|
2002 | /**
|
2003 | * Decorator: Specifies a custom HtmlBehaviorResource instance or an object that overrides various implementation details of the default HtmlBehaviorResource.
|
2004 | * @param override The customized HtmlBehaviorResource or an object to override the default with.
|
2005 | */
|
2006 | export declare function behavior(override: HtmlBehaviorResource | Object): any;
|
2007 |
|
2008 | /**
|
2009 | * Decorator: Indicates that the decorated class is a custom element.
|
2010 | * @param name The name of the custom element.
|
2011 | */
|
2012 | export declare function customElement(name: string): any;
|
2013 |
|
2014 | /**
|
2015 | * Decorator: Indicates that the decorated class is a custom attribute.
|
2016 | * @param name The name of the custom attribute.
|
2017 | * @param defaultBindingMode The default binding mode to use when the attribute is bound with .bind.
|
2018 | * @param aliases The array of aliases to associate to the custom attribute.
|
2019 | */
|
2020 | export declare function customAttribute(name: string, defaultBindingMode?: number, aliases?: string[]): any;
|
2021 |
|
2022 | /**
|
2023 | * Decorator: Applied to custom attributes. Indicates that whatever element the
|
2024 | * attribute is placed on should be converted into a template and that this
|
2025 | * attribute controls the instantiation of the template.
|
2026 | */
|
2027 | export declare function templateController(target?: any): any;
|
2028 |
|
2029 | /**
|
2030 | * Decorator: Specifies that a property is bindable through HTML.
|
2031 | * @param nameOrConfigOrTarget The name of the property, or a configuration object.
|
2032 | */
|
2033 | export declare function bindable(nameOrConfigOrTarget?: string | Object, key?: any, descriptor?: any): any;
|
2034 |
|
2035 | /**
|
2036 | * Decorator: Specifies that the decorated custom attribute has options that
|
2037 | * are dynamic, based on their presence in HTML and not statically known.
|
2038 | */
|
2039 | export declare function dynamicOptions(target?: any): any;
|
2040 |
|
2041 | /**
|
2042 | * Decorator: Indicates that the custom element should render its view in Shadow
|
2043 | * DOM. This decorator may change slightly when Aurelia updates to Shadow DOM v1.
|
2044 | */
|
2045 | export declare function useShadowDOM(targetOrOptions?: any): any;
|
2046 |
|
2047 | /**
|
2048 | * Decorator: Enables custom processing of the attributes on an element before the framework inspects them.
|
2049 | * @param processor Pass a function which can provide custom processing of the content.
|
2050 | */
|
2051 | export declare function processAttributes(processor: Function): any;
|
2052 |
|
2053 | /**
|
2054 | * Decorator: Enables custom processing of the content that is places inside the
|
2055 | * custom element by its consumer.
|
2056 | * @param processor Pass a boolean to direct the template compiler to not process
|
2057 | * the content placed inside this element. Alternatively, pass a function which
|
2058 | * can provide custom processing of the content. This function should then return
|
2059 | * a boolean indicating whether the compiler should also process the content.
|
2060 | */
|
2061 | export declare function processContent(processor: boolean | Function): any;
|
2062 |
|
2063 | /**
|
2064 | * Decorator: Indicates that the custom element should be rendered without its
|
2065 | * element container.
|
2066 | */
|
2067 | export declare function containerless(target?: any): any;
|
2068 |
|
2069 | /**
|
2070 | * Decorator: Associates a custom view strategy with the component.
|
2071 | * @param strategy The view strategy instance.
|
2072 | */
|
2073 | export declare function useViewStrategy(strategy: Object): any;
|
2074 |
|
2075 | /**
|
2076 | * Decorator: Provides a relative path to a view for the component.
|
2077 | * @param path The path to the view.
|
2078 | */
|
2079 | export declare function useView(path: string): any;
|
2080 |
|
2081 | /**
|
2082 | * Decorator: Provides a view template, directly inline, for the component. Be
|
2083 | * sure to wrap the markup in a template element.
|
2084 | * @param markup The markup for the view.
|
2085 | * @param dependencies A list of dependencies that the template has.
|
2086 | * @param dependencyBaseUrl A base url from which the dependencies will be loaded.
|
2087 | */
|
2088 | export declare function inlineView(markup: string, dependencies?: Array<string | Function | Object>, dependencyBaseUrl?: string): any;
|
2089 |
|
2090 | /**
|
2091 | * Decorator: Indicates that the component has no view.
|
2092 | */
|
2093 | export declare function noView(targetOrDependencies?: Function | Array<any>, dependencyBaseUrl?: string): any;
|
2094 |
|
2095 | /**
|
2096 | * Decorator: Indicates that the element use static view
|
2097 | */
|
2098 | /**
|
2099 | * Decorator: Indicates that the element use static view
|
2100 | */
|
2101 | export declare function view(templateOrConfig: string | HTMLTemplateElement | IStaticViewStrategyConfig): any;
|
2102 |
|
2103 | /**
|
2104 | * Decorator: Indicates that the decorated class provides element configuration
|
2105 | * to the EventManager for one or more Web Components.
|
2106 | */
|
2107 | export declare function elementConfig(target?: any): any;
|
2108 |
|
2109 | /**
|
2110 | * Decorator: Provides the ability to add resources to the related View
|
2111 | * Same as: <require from="..."></require>
|
2112 | * @param resources Either: strings with moduleIds, Objects with 'src' and optionally 'as' properties or one of the classes of the module to be included.
|
2113 | */
|
2114 | export declare function viewResources(...resources: any[]): any;
|
2115 |
|
2116 | /**
|
2117 | * A facade of the templating engine capabilties which provides a more user friendly API for common use cases.
|
2118 | */
|
2119 |
|
2120 | /**
|
2121 | * A facade of the templating engine capabilties which provides a more user friendly API for common use cases.
|
2122 | */
|
2123 | export declare class TemplatingEngine {
|
2124 |
|
2125 | /**
|
2126 | * Creates an instance of TemplatingEngine.
|
2127 | * @param container The root DI container.
|
2128 | * @param moduleAnalyzer The module analyzer for discovering view resources.
|
2129 | * @param viewCompiler The view compiler for compiling views.
|
2130 | * @param compositionEngine The composition engine used during dynamic component composition.
|
2131 | */
|
2132 | constructor(container: Container, moduleAnalyzer: ModuleAnalyzer, viewCompiler: ViewCompiler, compositionEngine: CompositionEngine);
|
2133 |
|
2134 | /**
|
2135 | * Configures the default animator.
|
2136 | * @param animator The animator instance.
|
2137 | */
|
2138 | configureAnimator(animator: Animator): void;
|
2139 |
|
2140 | /**
|
2141 | * Dynamically composes components and views.
|
2142 | * @param context The composition context to use.
|
2143 | * @return A promise for the resulting Controller or View. Consumers of this API
|
2144 | * are responsible for enforcing the Controller/View lifecycle.
|
2145 | */
|
2146 | compose(context: CompositionContext): Promise<View | Controller>;
|
2147 |
|
2148 | /**
|
2149 | * Enhances existing DOM with behaviors and bindings.
|
2150 | * @param instruction The element to enhance or a set of instructions for the enhancement process.
|
2151 | * @return A View representing the enhanced UI. Consumers of this API
|
2152 | * are responsible for enforcing the View lifecycle.
|
2153 | */
|
2154 | enhance(instruction: Element | EnhanceInstruction): View;
|
2155 | } |
\ | No newline at end of file |