1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | export declare function animate(timings: string | number, styles?: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null): AnimationAnimateMetadata;
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | export declare function animateChild(options?: AnimateChildOptions | null): AnimationAnimateChildMetadata;
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | export declare interface AnimateChildOptions extends AnimationOptions {
|
97 | duration?: number | string;
|
98 | }
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 | export declare type AnimateTimings = {
|
107 | |
108 |
|
109 |
|
110 |
|
111 |
|
112 | duration: number;
|
113 | |
114 |
|
115 |
|
116 |
|
117 | delay: number;
|
118 | |
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | easing: string | null;
|
127 | };
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | export declare function animation(steps: AnimationMetadata | AnimationMetadata[], options?: AnimationOptions | null): AnimationReferenceMetadata;
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 | export declare interface AnimationAnimateChildMetadata extends AnimationMetadata {
|
183 | |
184 |
|
185 |
|
186 |
|
187 |
|
188 | options: AnimationOptions | null;
|
189 | }
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 | export declare interface AnimationAnimateMetadata extends AnimationMetadata {
|
198 | |
199 |
|
200 |
|
201 | timings: string | number | AnimateTimings;
|
202 | |
203 |
|
204 |
|
205 | styles: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null;
|
206 | }
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 | export declare interface AnimationAnimateRefMetadata extends AnimationMetadata {
|
215 | |
216 |
|
217 |
|
218 | animation: AnimationReferenceMetadata;
|
219 | |
220 |
|
221 |
|
222 |
|
223 |
|
224 | options: AnimationOptions | null;
|
225 | }
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 | export declare abstract class AnimationBuilder {
|
274 | |
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 | abstract build(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory;
|
281 | }
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 | declare interface AnimationEvent_2 {
|
316 | |
317 |
|
318 |
|
319 | fromState: string;
|
320 | |
321 |
|
322 |
|
323 | toState: string;
|
324 | |
325 |
|
326 |
|
327 | totalTime: number;
|
328 | |
329 |
|
330 |
|
331 |
|
332 | phaseName: string;
|
333 | |
334 |
|
335 |
|
336 | element: any;
|
337 | |
338 |
|
339 |
|
340 | triggerName: string;
|
341 | |
342 |
|
343 |
|
344 | disabled: boolean;
|
345 | }
|
346 | export { AnimationEvent_2 as AnimationEvent }
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 | export declare abstract class AnimationFactory {
|
356 | |
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 | abstract create(element: any, options?: AnimationOptions): AnimationPlayer;
|
366 | }
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 | export declare interface AnimationGroupMetadata extends AnimationMetadata {
|
375 | |
376 |
|
377 |
|
378 | steps: AnimationMetadata[];
|
379 | |
380 |
|
381 |
|
382 |
|
383 |
|
384 | options: AnimationOptions | null;
|
385 | }
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 | export declare interface AnimationKeyframesSequenceMetadata extends AnimationMetadata {
|
394 | |
395 |
|
396 |
|
397 | steps: AnimationStyleMetadata[];
|
398 | }
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 | export declare interface AnimationMetadata {
|
406 | type: AnimationMetadataType;
|
407 | }
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | export declare const enum AnimationMetadataType {
|
418 | |
419 |
|
420 |
|
421 |
|
422 | State = 0,
|
423 | |
424 |
|
425 |
|
426 |
|
427 | Transition = 1,
|
428 | |
429 |
|
430 |
|
431 |
|
432 | Sequence = 2,
|
433 | |
434 |
|
435 |
|
436 |
|
437 | Group = 3,
|
438 | |
439 |
|
440 |
|
441 |
|
442 | Animate = 4,
|
443 | |
444 |
|
445 |
|
446 |
|
447 | Keyframes = 5,
|
448 | |
449 |
|
450 |
|
451 |
|
452 | Style = 6,
|
453 | |
454 |
|
455 |
|
456 |
|
457 | Trigger = 7,
|
458 | |
459 |
|
460 |
|
461 |
|
462 | Reference = 8,
|
463 | |
464 |
|
465 |
|
466 |
|
467 | AnimateChild = 9,
|
468 | |
469 |
|
470 |
|
471 |
|
472 | AnimateRef = 10,
|
473 | |
474 |
|
475 |
|
476 |
|
477 | Query = 11,
|
478 | |
479 |
|
480 |
|
481 |
|
482 | Stagger = 12
|
483 | }
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 | export declare interface AnimationOptions {
|
504 | |
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 | delay?: number | string;
|
511 | |
512 |
|
513 |
|
514 |
|
515 |
|
516 | params?: {
|
517 | [name: string]: any;
|
518 | };
|
519 | }
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 | export declare interface AnimationPlayer {
|
535 | |
536 |
|
537 |
|
538 |
|
539 |
|
540 | onDone(fn: () => void): void;
|
541 | |
542 |
|
543 |
|
544 |
|
545 |
|
546 | onStart(fn: () => void): void;
|
547 | |
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 | onDestroy(fn: () => void): void;
|
554 | |
555 |
|
556 |
|
557 | init(): void;
|
558 | |
559 |
|
560 |
|
561 |
|
562 | hasStarted(): boolean;
|
563 | |
564 |
|
565 |
|
566 | play(): void;
|
567 | |
568 |
|
569 |
|
570 | pause(): void;
|
571 | |
572 |
|
573 |
|
574 | restart(): void;
|
575 | |
576 |
|
577 |
|
578 | finish(): void;
|
579 | |
580 |
|
581 |
|
582 |
|
583 | destroy(): void;
|
584 | |
585 |
|
586 |
|
587 | reset(): void;
|
588 | |
589 |
|
590 |
|
591 |
|
592 | setPosition(position: any ): void;
|
593 | |
594 |
|
595 |
|
596 |
|
597 | getPosition(): number;
|
598 | |
599 |
|
600 |
|
601 | parentPlayer: AnimationPlayer | null;
|
602 | |
603 |
|
604 |
|
605 | readonly totalTime: number;
|
606 | |
607 |
|
608 |
|
609 | beforeDestroy?: () => any;
|
610 | }
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 | export declare interface AnimationQueryMetadata extends AnimationMetadata {
|
619 | |
620 |
|
621 |
|
622 | selector: string;
|
623 | |
624 |
|
625 |
|
626 | animation: AnimationMetadata | AnimationMetadata[];
|
627 | |
628 |
|
629 |
|
630 | options: AnimationQueryOptions | null;
|
631 | }
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 | export declare interface AnimationQueryOptions extends AnimationOptions {
|
640 | |
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 | optional?: boolean;
|
647 | |
648 |
|
649 |
|
650 |
|
651 |
|
652 | limit?: number;
|
653 | }
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 | export declare interface AnimationReferenceMetadata extends AnimationMetadata {
|
663 | |
664 |
|
665 |
|
666 | animation: AnimationMetadata | AnimationMetadata[];
|
667 | |
668 |
|
669 |
|
670 |
|
671 |
|
672 | options: AnimationOptions | null;
|
673 | }
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 | export declare interface AnimationSequenceMetadata extends AnimationMetadata {
|
682 | |
683 |
|
684 |
|
685 | steps: AnimationMetadata[];
|
686 | |
687 |
|
688 |
|
689 |
|
690 |
|
691 | options: AnimationOptions | null;
|
692 | }
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 | export declare interface AnimationStaggerMetadata extends AnimationMetadata {
|
701 | |
702 |
|
703 |
|
704 | timings: string | number;
|
705 | |
706 |
|
707 |
|
708 | animation: AnimationMetadata | AnimationMetadata[];
|
709 | }
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 | export declare interface AnimationStateMetadata extends AnimationMetadata {
|
718 | |
719 |
|
720 |
|
721 | name: string;
|
722 | |
723 |
|
724 |
|
725 | styles: AnimationStyleMetadata;
|
726 | |
727 |
|
728 |
|
729 |
|
730 |
|
731 | options?: {
|
732 | params: {
|
733 | [name: string]: any;
|
734 | };
|
735 | };
|
736 | }
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 | export declare interface AnimationStyleMetadata extends AnimationMetadata {
|
745 | |
746 |
|
747 |
|
748 | styles: '*' | {
|
749 | [key: string]: string | number;
|
750 | } | Array<{
|
751 | [key: string]: string | number;
|
752 | } | '*'>;
|
753 | |
754 |
|
755 |
|
756 | offset: number | null;
|
757 | }
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 | export declare interface AnimationTransitionMetadata extends AnimationMetadata {
|
766 | |
767 |
|
768 |
|
769 | expr: string | ((fromState: string, toState: string, element?: any, params?: {
|
770 | [key: string]: any;
|
771 | }) => boolean);
|
772 | |
773 |
|
774 |
|
775 | animation: AnimationMetadata | AnimationMetadata[];
|
776 | |
777 |
|
778 |
|
779 |
|
780 |
|
781 | options: AnimationOptions | null;
|
782 | }
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 | export declare interface AnimationTriggerMetadata extends AnimationMetadata {
|
791 | |
792 |
|
793 |
|
794 | name: string;
|
795 | |
796 |
|
797 |
|
798 | definitions: AnimationMetadata[];
|
799 | |
800 |
|
801 |
|
802 |
|
803 |
|
804 | options: {
|
805 | params?: {
|
806 | [name: string]: any;
|
807 | };
|
808 | } | null;
|
809 | }
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 | export declare const AUTO_STYLE = "*";
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 | export declare function group(steps: AnimationMetadata[], options?: AnimationOptions | null): AnimationGroupMetadata;
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 | export declare function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata;
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 | export declare class NoopAnimationPlayer implements AnimationPlayer {
|
912 | private _onDoneFns;
|
913 | private _onStartFns;
|
914 | private _onDestroyFns;
|
915 | private _originalOnDoneFns;
|
916 | private _originalOnStartFns;
|
917 | private _started;
|
918 | private _destroyed;
|
919 | private _finished;
|
920 | private _position;
|
921 | parentPlayer: AnimationPlayer | null;
|
922 | readonly totalTime: number;
|
923 | constructor(duration?: number, delay?: number);
|
924 | private _onFinish;
|
925 | onStart(fn: () => void): void;
|
926 | onDone(fn: () => void): void;
|
927 | onDestroy(fn: () => void): void;
|
928 | hasStarted(): boolean;
|
929 | init(): void;
|
930 | play(): void;
|
931 | private _onStart;
|
932 | pause(): void;
|
933 | restart(): void;
|
934 | finish(): void;
|
935 | destroy(): void;
|
936 | reset(): void;
|
937 | setPosition(position: number): void;
|
938 | getPosition(): number;
|
939 | }
|
940 |
|
941 | /**
|
942 | * Finds one or more inner elements within the current element that is
|
943 | * being animated within a sequence. Use with `animate()`.
|
944 | *
|
945 | * @param selector The element to query, or a set of elements that contain Angular-specific
|
946 | * characteristics, specified with one or more of the following tokens.
|
947 | * - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements (not
|
948 | * all elements can be queried via these tokens, see
|
949 | * [Entering and Leaving Elements](#entering-and-leaving-elements))
|
950 | * - `query(":animating")` : Query all currently animating elements.
|
951 | * - `query("@triggerName")` : Query elements that contain an animation trigger.
|
952 | * - `query("@*")` : Query all elements that contain an animation triggers.
|
953 | * - `query(":self")` : Include the current element into the animation sequence.
|
954 | *
|
955 | * @param animation One or more animation steps to apply to the queried element or elements.
|
956 | * An array is treated as an animation sequence.
|
957 | * @param options An options object. Use the 'limit' field to limit the total number of
|
958 | * items to collect.
|
959 | * @return An object that encapsulates the query data.
|
960 | *
|
961 | * @usageNotes
|
962 | *
|
963 | * ### Multiple Tokens
|
964 | *
|
965 | * Tokens can be merged into a combined query selector string. For example:
|
966 | *
|
967 | * ```typescript
|
968 | * query(':self, .record:enter, .record:leave, @subTrigger', [...])
|
969 | * ```
|
970 | *
|
971 | * The `query()` function collects multiple elements and works internally by using
|
972 | * `element.querySelectorAll`. Use the `limit` field of an options object to limit
|
973 | * the total number of items to be collected. For example:
|
974 | *
|
975 | * ```js
|
976 | * query('div', [
|
977 | * animate(...),
|
978 | * animate(...)
|
979 | * ], { limit: 1 })
|
980 | * ```
|
981 | *
|
982 | * By default, throws an error when zero items are found. Set the
|
983 | * `optional` flag to ignore this error. For example:
|
984 | *
|
985 | * ```js
|
986 | * query('.some-element-that-may-not-be-there', [
|
987 | * animate(...),
|
988 | * animate(...)
|
989 | * ], { optional: true })
|
990 | * ```
|
991 | *
|
992 | * ### Entering and Leaving Elements
|
993 | *
|
994 | * Not all elements can be queried via the `:enter` and `:leave` tokens, the only ones
|
995 | * that can are those that Angular assumes can enter/leave based on their own logic
|
996 | * (if their insertion/removal is simply a consequence of that of their parent they
|
997 | * should be queried via a different token in their parent's `:enter`/`:leave` transitions).
|
998 | *
|
999 | * The only elements Angular assumes can enter/leave based on their own logic (thus the only
|
1000 | * ones that can be queried via the `:enter` and `:leave` tokens) are:
|
1001 | * - Those inserted dynamically (via `ViewContainerRef`)
|
1002 | * - Those that have a structural directive (which, under the hood, are a subset of the above ones)
|
1003 | *
|
1004 | * <div class="alert is-helpful">
|
1005 | *
|
1006 | * Note that elements will be successfully queried via `:enter`/`:leave` even if their
|
1007 | * insertion/removal is not done manually via `ViewContainerRef`or caused by their structural
|
1008 | * directive (e.g. they enter/exit alongside their parent).
|
1009 | *
|
1010 | * </div>
|
1011 | *
|
1012 | * <div class="alert is-important">
|
1013 | *
|
1014 | * There is an exception to what previously mentioned, besides elements entering/leaving based on
|
1015 | * their own logic, elements with an animation trigger can always be queried via `:leave` when
|
1016 | * their parent is also leaving.
|
1017 | *
|
1018 | * </div>
|
1019 | *
|
1020 | * ### Usage Example
|
1021 | *
|
1022 | * The following example queries for inner elements and animates them
|
1023 | * individually using `animate()`.
|
1024 | *
|
1025 | * ```typescript
|
1026 | * @Component({
|
1027 | * selector: 'inner',
|
1028 | * template: `
|
1029 | * <div [@queryAnimation]="exp">
|
1030 | * <h1>Title</h1>
|
1031 | * <div class="content">
|
1032 | * Blah blah blah
|
1033 | * </div>
|
1034 | * </div>
|
1035 | * `,
|
1036 | * animations: [
|
1037 | * trigger('queryAnimation', [
|
1038 | * transition('* => goAnimate', [
|
1039 | * // hide the inner elements
|
1040 | * query('h1', style({ opacity: 0 })),
|
1041 | * query('.content', style({ opacity: 0 })),
|
1042 | *
|
1043 | * // animate the inner elements in, one by one
|
1044 | * query('h1', animate(1000, style({ opacity: 1 }))),
|
1045 | * query('.content', animate(1000, style({ opacity: 1 }))),
|
1046 | * ])
|
1047 | * ])
|
1048 | * ]
|
1049 | * })
|
1050 | * class Cmp {
|
1051 | * exp = '';
|
1052 | *
|
1053 | * goAnimate() {
|
1054 | * this.exp = 'goAnimate';
|
1055 | * }
|
1056 | * }
|
1057 | * ```
|
1058 | *
|
1059 | * @publicApi
|
1060 | */
|
1061 | export declare function query(selector: string, animation: AnimationMetadata | AnimationMetadata[], options?: AnimationQueryOptions | null): AnimationQueryMetadata;
|
1062 |
|
1063 | /**
|
1064 | * Defines a list of animation steps to be run sequentially, one by one.
|
1065 | *
|
1066 | * @param steps An array of animation step objects.
|
1067 | * - Steps defined by `style()` calls apply the styling data immediately.
|
1068 | * - Steps defined by `animate()` calls apply the styling data over time
|
1069 | * as specified by the timing data.
|
1070 | *
|
1071 | * ```typescript
|
1072 | * sequence([
|
1073 | * style({ opacity: 0 }),
|
1074 | * animate("1s", style({ opacity: 1 }))
|
1075 | * ])
|
1076 | * ```
|
1077 | *
|
1078 | * @param options An options object containing a delay and
|
1079 | * developer-defined parameters that provide styling defaults and
|
1080 | * can be overridden on invocation.
|
1081 | *
|
1082 | * @return An object that encapsulates the sequence data.
|
1083 | *
|
1084 | * @usageNotes
|
1085 | * When you pass an array of steps to a
|
1086 | * `transition()` call, the steps run sequentially by default.
|
1087 | * Compare this to the `{@link animations/group group()}` call, which runs animation steps in
|
1088 | *parallel.
|
1089 | *
|
1090 | * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call,
|
1091 | * execution continues to the next instruction only after each of the inner animation
|
1092 | * steps have completed.
|
1093 | *
|
1094 | * @publicApi
|
1095 | **/
|
1096 | export declare function sequence(steps: AnimationMetadata[], options?: AnimationOptions | null): AnimationSequenceMetadata;
|
1097 |
|
1098 | /**
|
1099 | * Use within an animation `query()` call to issue a timing gap after
|
1100 | * each queried item is animated.
|
1101 | *
|
1102 | * @param timings A delay value.
|
1103 | * @param animation One ore more animation steps.
|
1104 | * @returns An object that encapsulates the stagger data.
|
1105 | *
|
1106 | * @usageNotes
|
1107 | * In the following example, a container element wraps a list of items stamped out
|
1108 | * by an `ngFor`. The container element contains an animation trigger that will later be set
|
1109 | * to query for each of the inner items.
|
1110 | *
|
1111 | * Each time items are added, the opacity fade-in animation runs,
|
1112 | * and each removed item is faded out.
|
1113 | * When either of these animations occur, the stagger effect is
|
1114 | * applied after each item's animation is started.
|
1115 | *
|
1116 | * ```html
|
1117 | * <!-- list.component.html -->
|
1118 | * <button (click)="toggle()">Show / Hide Items</button>
|
1119 | * <hr />
|
1120 | * <div [@listAnimation]="items.length">
|
1121 | * <div *ngFor="let item of items">
|
1122 | * {{ item }}
|
1123 | * </div>
|
1124 | * </div>
|
1125 | * ```
|
1126 | *
|
1127 | * Here is the component code:
|
1128 | *
|
1129 | * ```typescript
|
1130 | * import {trigger, transition, style, animate, query, stagger} from '@angular/animations';
|
1131 | * @Component({
|
1132 | * templateUrl: 'list.component.html',
|
1133 | * animations: [
|
1134 | * trigger('listAnimation', [
|
1135 | * ...
|
1136 | * ])
|
1137 | * ]
|
1138 | * })
|
1139 | * class ListComponent {
|
1140 | * items = [];
|
1141 | *
|
1142 | * showItems() {
|
1143 | * this.items = [0,1,2,3,4];
|
1144 | * }
|
1145 | *
|
1146 | * hideItems() {
|
1147 | * this.items = [];
|
1148 | * }
|
1149 | *
|
1150 | * toggle() {
|
1151 | * this.items.length ? this.hideItems() : this.showItems();
|
1152 | * }
|
1153 | * }
|
1154 | * ```
|
1155 | *
|
1156 | * Here is the animation trigger code:
|
1157 | *
|
1158 | * ```typescript
|
1159 | * trigger('listAnimation', [
|
1160 | * transition('* => *', [
|
1161 | * query(':leave', [
|
1162 | * stagger(100, [
|
1163 | * animate('0.5s', style({ opacity: 0 }))
|
1164 | * ])
|
1165 | * ]),
|
1166 | * query(':enter', [
|
1167 | * style({ opacity: 0 }),
|
1168 | * stagger(100, [
|
1169 | * animate('0.5s', style({ opacity: 1 }))
|
1170 | * ])
|
1171 | * ])
|
1172 | * ])
|
1173 | * ])
|
1174 | * ```
|
1175 | *
|
1176 | * @publicApi
|
1177 | */
|
1178 | export declare function stagger(timings: string | number, animation: AnimationMetadata | AnimationMetadata[]): AnimationStaggerMetadata;
|
1179 |
|
1180 | /**
|
1181 | * Declares an animation state within a trigger attached to an element.
|
1182 | *
|
1183 | * @param name One or more names for the defined state in a comma-separated string.
|
1184 | * The following reserved state names can be supplied to define a style for specific use
|
1185 | * cases:
|
1186 | *
|
1187 | * - `void` You can associate styles with this name to be used when
|
1188 | * the element is detached from the application. For example, when an `ngIf` evaluates
|
1189 | * to false, the state of the associated element is void.
|
1190 | * - `*` (asterisk) Indicates the default state. You can associate styles with this name
|
1191 | * to be used as the fallback when the state that is being animated is not declared
|
1192 | * within the trigger.
|
1193 | *
|
1194 | * @param styles A set of CSS styles associated with this state, created using the
|
1195 | * `style()` function.
|
1196 | * This set of styles persists on the element once the state has been reached.
|
1197 | * @param options Parameters that can be passed to the state when it is invoked.
|
1198 | * 0 or more key-value pairs.
|
1199 | * @return An object that encapsulates the new state data.
|
1200 | *
|
1201 | * @usageNotes
|
1202 | * Use the `trigger()` function to register states to an animation trigger.
|
1203 | * Use the `transition()` function to animate between states.
|
1204 | * When a state is active within a component, its associated styles persist on the element,
|
1205 | * even when the animation ends.
|
1206 | *
|
1207 | * @publicApi
|
1208 | **/
|
1209 | export declare function state(name: string, styles: AnimationStyleMetadata, options?: {
|
1210 | params: {
|
1211 | [name: string]: any;
|
1212 | };
|
1213 | }): AnimationStateMetadata;
|
1214 |
|
1215 | /**
|
1216 | * Declares a key/value object containing CSS properties/styles that
|
1217 | * can then be used for an animation [`state`](api/animations/state), within an animation
|
1218 | *`sequence`, or as styling data for calls to `animate()` and `keyframes()`.
|
1219 | *
|
1220 | * @param tokens A set of CSS styles or HTML styles associated with an animation state.
|
1221 | * The value can be any of the following:
|
1222 | * - A key-value style pair associating a CSS property with a value.
|
1223 | * - An array of key-value style pairs.
|
1224 | * - An asterisk (*), to use auto-styling, where styles are derived from the element
|
1225 | * being animated and applied to the animation when it starts.
|
1226 | *
|
1227 | * Auto-styling can be used to define a state that depends on layout or other
|
1228 | * environmental factors.
|
1229 | *
|
1230 | * @return An object that encapsulates the style data.
|
1231 | *
|
1232 | * @usageNotes
|
1233 | * The following examples create animation styles that collect a set of
|
1234 | * CSS property values:
|
1235 | *
|
1236 | * ```typescript
|
1237 | *
|
1238 | * style({ background: "red", color: "blue" })
|
1239 | *
|
1240 | *
|
1241 | * style({ width: 100, height: 0 })
|
1242 | * ```
|
1243 | *
|
1244 | * The following example uses auto-styling to allow an element to animate from
|
1245 | * a height of 0 up to its full height:
|
1246 | *
|
1247 | * ```
|
1248 | * style({ height: 0 }),
|
1249 | * animate("1s", style({ height: "*" }))
|
1250 | * ```
|
1251 | *
|
1252 | * @publicApi
|
1253 | **/
|
1254 | export declare function style(tokens: '*' | {
|
1255 | [key: string]: string | number;
|
1256 | } | Array<'*' | {
|
1257 | [key: string]: string | number;
|
1258 | }>): AnimationStyleMetadata;
|
1259 |
|
1260 | /**
|
1261 | * Declares an animation transition which is played when a certain specified condition is met.
|
1262 | *
|
1263 | * @param stateChangeExpr A string with a specific format or a function that specifies when the
|
1264 | * animation transition should occur (see [State Change Expression](#state-change-expression)).
|
1265 | *
|
1266 | * @param steps One or more animation objects that represent the animation's instructions.
|
1267 | *
|
1268 | * @param options An options object that can be used to specify a delay for the animation or provide
|
1269 | * custom parameters for it.
|
1270 | *
|
1271 | * @returns An object that encapsulates the transition data.
|
1272 | *
|
1273 | * @usageNotes
|
1274 | *
|
1275 | * ### State Change Expression
|
1276 | *
|
1277 | * The State Change Expression instructs Angular when to run the transition's animations, it can
|
1278 | *either be
|
1279 | * - a string with a specific syntax
|
1280 | * - or a function that compares the previous and current state (value of the expression bound to
|
1281 | * the element's trigger) and returns `true` if the transition should occur or `false` otherwise
|
1282 | *
|
1283 | * The string format can be:
|
1284 | * - `fromState => toState`, which indicates that the transition's animations should occur then the
|
1285 | * expression bound to the trigger's element goes from `fromState` to `toState`
|
1286 | *
|
1287 | * _Example:_
|
1288 | * ```typescript
|
1289 | * transition('open => closed', animate('.5s ease-out', style({ height: 0 }) ))
|
1290 | * ```
|
1291 | *
|
1292 | * - `fromState <=> toState`, which indicates that the transition's animations should occur then
|
1293 | * the expression bound to the trigger's element goes from `fromState` to `toState` or vice versa
|
1294 | *
|
1295 | * _Example:_
|
1296 | * ```typescript
|
1297 | * transition('enabled <=> disabled', animate('1s cubic-bezier(0.8,0.3,0,1)'))
|
1298 | * ```
|
1299 | *
|
1300 | * - `:enter`/`:leave`, which indicates that the transition's animations should occur when the
|
1301 | * element enters or exists the DOM
|
1302 | *
|
1303 | * _Example:_
|
1304 | * ```typescript
|
1305 | * transition(':enter', [
|
1306 | * style({ opacity: 0 }),
|
1307 | * animate('500ms', style({ opacity: 1 }))
|
1308 | * ])
|
1309 | * ```
|
1310 | *
|
1311 | * - `:increment`/`:decrement`, which indicates that the transition's animations should occur when
|
1312 | * the numerical expression bound to the trigger's element has increased in value or decreased
|
1313 | *
|
1314 | * _Example:_
|
1315 | * ```typescript
|
1316 | * transition(':increment', query('@counter', animateChild()))
|
1317 | * ```
|
1318 | *
|
1319 | * - a sequence of any of the above divided by commas, which indicates that transition's animations
|
1320 | * should occur whenever one of the state change expressions matches
|
1321 | *
|
1322 | * _Example:_
|
1323 | * ```typescript
|
1324 | * transition(':increment, * => enabled, :enter', animate('1s ease', keyframes([
|
1325 | * style({ transform: 'scale(1)', offset: 0}),
|
1326 | * style({ transform: 'scale(1.1)', offset: 0.7}),
|
1327 | * style({ transform: 'scale(1)', offset: 1})
|
1328 | * ]))),
|
1329 | * ```
|
1330 | *
|
1331 | * Also note that in such context:
|
1332 | * - `void` can be used to indicate the absence of the element
|
1333 | * - asterisks can be used as wildcards that match any state
|
1334 | * - (as a consequence of the above, `void => *` is equivalent to `:enter` and `* => void` is
|
1335 | * equivalent to `:leave`)
|
1336 | * - `true` and `false` also match expression values of `1` and `0` respectively (but do not match
|
1337 | * _truthy_ and _falsy_ values)
|
1338 | *
|
1339 | * <div class="alert is-helpful">
|
1340 | *
|
1341 | * Be careful about entering end leaving elements as their transitions present a common
|
1342 | * pitfall for developers.
|
1343 | *
|
1344 | * Note that when an element with a trigger enters the DOM its `:enter` transition always
|
1345 | * gets executed, but its `:leave` transition will not be executed if the element is removed
|
1346 | * alongside its parent (as it will be removed "without warning" before its transition has
|
1347 | * a chance to be executed, the only way that such transition can occur is if the element
|
1348 | * is exiting the DOM on its own).
|
1349 | *
|
1350 | *
|
1351 | * </div>
|
1352 | *
|
1353 | * ### Animating to a Final State
|
1354 | *
|
1355 | * If the final step in a transition is a call to `animate()` that uses a timing value
|
1356 | * with no `style` data, that step is automatically considered the final animation arc,
|
1357 | * for the element to reach the final state, in such case Angular automatically adds or removes
|
1358 | * CSS styles to ensure that the element is in the correct final state.
|
1359 | *
|
1360 | *
|
1361 | * ### Usage Examples
|
1362 | *
|
1363 | * - Transition animations applied based on
|
1364 | * the trigger's expression value
|
1365 | *
|
1366 | * ```HTML
|
1367 | * <div [@myAnimationTrigger]="myStatusExp">
|
1368 | * ...
|
1369 | * </div>
|
1370 | * ```
|
1371 | *
|
1372 | * ```typescript
|
1373 | * trigger("myAnimationTrigger", [
|
1374 | * ...,
|
1375 | * transition("on => off, open => closed", animate(500)),
|
1376 | * transition("* <=> error", query('.indicator', animateChild()))
|
1377 | * ])
|
1378 | * ```
|
1379 | *
|
1380 | * - Transition animations applied based on custom logic dependent
|
1381 | * on the trigger's expression value and provided parameters
|
1382 | *
|
1383 | * ```HTML
|
1384 | * <div [@myAnimationTrigger]="{
|
1385 | * value: stepName,
|
1386 | * params: { target: currentTarget }
|
1387 | * }">
|
1388 | * ...
|
1389 | * </div>
|
1390 | * ```
|
1391 | *
|
1392 | * ```typescript
|
1393 | * trigger("myAnimationTrigger", [
|
1394 | * ...,
|
1395 | * transition(
|
1396 | * (fromState, toState, _element, params) =>
|
1397 | * ['firststep', 'laststep'].includes(fromState.toLowerCase())
|
1398 | * && toState === params?.['target'],
|
1399 | * animate('1s')
|
1400 | * )
|
1401 | * ])
|
1402 | * ```
|
1403 | *
|
1404 | * @publicApi
|
1405 | **/
|
1406 | export declare function transition(stateChangeExpr: string | ((fromState: string, toState: string, element?: any, params?: {
|
1407 | [key: string]: any;
|
1408 | }) => boolean), steps: AnimationMetadata | AnimationMetadata[], options?: AnimationOptions | null): AnimationTransitionMetadata;
|
1409 |
|
1410 | /**
|
1411 | * Creates a named animation trigger, containing a list of [`state()`](api/animations/state)
|
1412 | * and `transition()` entries to be evaluated when the expression
|
1413 | * bound to the trigger changes.
|
1414 | *
|
1415 | * @param name An identifying string.
|
1416 | * @param definitions An animation definition object, containing an array of
|
1417 | * [`state()`](api/animations/state) and `transition()` declarations.
|
1418 | *
|
1419 | * @return An object that encapsulates the trigger data.
|
1420 | *
|
1421 | * @usageNotes
|
1422 | * Define an animation trigger in the `animations` section of `@Component` metadata.
|
1423 | * In the template, reference the trigger by name and bind it to a trigger expression that
|
1424 | * evaluates to a defined animation state, using the following format:
|
1425 | *
|
1426 | * `[@triggerName]="expression"`
|
1427 | *
|
1428 | * Animation trigger bindings convert all values to strings, and then match the
|
1429 | * previous and current values against any linked transitions.
|
1430 | * Booleans can be specified as `1` or `true` and `0` or `false`.
|
1431 | *
|
1432 | * ### Usage Example
|
1433 | *
|
1434 | * The following example creates an animation trigger reference based on the provided
|
1435 | * name value.
|
1436 | * The provided animation value is expected to be an array consisting of state and
|
1437 | * transition declarations.
|
1438 | *
|
1439 | * ```typescript
|
1440 | * @Component({
|
1441 | * selector: "my-component",
|
1442 | * templateUrl: "my-component-tpl.html",
|
1443 | * animations: [
|
1444 | * trigger("myAnimationTrigger", [
|
1445 | * state(...),
|
1446 | * state(...),
|
1447 | * transition(...),
|
1448 | * transition(...)
|
1449 | * ])
|
1450 | * ]
|
1451 | * })
|
1452 | * class MyComponent {
|
1453 | * myStatusExp = "something";
|
1454 | * }
|
1455 | * ```
|
1456 | *
|
1457 | * The template associated with this component makes use of the defined trigger
|
1458 | * by binding to an element within its template code.
|
1459 | *
|
1460 | * ```html
|
1461 | * <!-- somewhere inside of my-component-tpl.html -->
|
1462 | * <div [@myAnimationTrigger]="myStatusExp">...</div>
|
1463 | * ```
|
1464 | *
|
1465 | * ### Using an inline function
|
1466 | * The `transition` animation method also supports reading an inline function which can decide
|
1467 | * if its associated animation should be run.
|
1468 | *
|
1469 | * ```typescript
|
1470 | *
|
1471 | * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:
|
1472 | string]: any}): boolean {
|
1473 | *
|
1474 | * return toState == 'yes-please-animate';
|
1475 | * }
|
1476 | *
|
1477 | * @Component({
|
1478 | * selector: 'my-component',
|
1479 | * templateUrl: 'my-component-tpl.html',
|
1480 | * animations: [
|
1481 | * trigger('myAnimationTrigger', [
|
1482 | * transition(myInlineMatcherFn, [
|
1483 | *
|
1484 | * ]),
|
1485 | * ])
|
1486 | * ]
|
1487 | * })
|
1488 | * class MyComponent {
|
1489 | * myStatusExp = "yes-please-animate";
|
1490 | * }
|
1491 | * ```
|
1492 | *
|
1493 | * ### Disabling Animations
|
1494 | * When true, the special animation control binding `@.disabled` binding prevents
|
1495 | * all animations from rendering.
|
1496 | * Place the `@.disabled` binding on an element to disable
|
1497 | * animations on the element itself, as well as any inner animation triggers
|
1498 | * within the element.
|
1499 | *
|
1500 | * The following example shows how to use this feature:
|
1501 | *
|
1502 | * ```typescript
|
1503 | * @Component({
|
1504 | * selector: 'my-component',
|
1505 | * template: `
|
1506 | * <div [@.disabled]="isDisabled">
|
1507 | * <div [@childAnimation]="exp"></div>
|
1508 | * </div>
|
1509 | * `,
|
1510 | * animations: [
|
1511 | * trigger("childAnimation", [
|
1512 | *
|
1513 | * ])
|
1514 | * ]
|
1515 | * })
|
1516 | * class MyComponent {
|
1517 | * isDisabled = true;
|
1518 | * exp = '...';
|
1519 | * }
|
1520 | * ```
|
1521 | *
|
1522 | * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating,
|
1523 | * along with any inner animations.
|
1524 | *
|
1525 | * ### Disable animations application-wide
|
1526 | * When an area of the template is set to have animations disabled,
|
1527 | * **all** inner components have their animations disabled as well.
|
1528 | * This means that you can disable all animations for an app
|
1529 | * by placing a host binding set on `@.disabled` on the topmost Angular component.
|
1530 | *
|
1531 | * ```typescript
|
1532 | * import {Component, HostBinding} from '@angular/core';
|
1533 | *
|
1534 | * @Component({
|
1535 | * selector: 'app-component',
|
1536 | * templateUrl: 'app.component.html',
|
1537 | * })
|
1538 | * class AppComponent {
|
1539 | * @HostBinding('@.disabled')
|
1540 | * public animationsDisabled = true;
|
1541 | * }
|
1542 | * ```
|
1543 | *
|
1544 | * ### Overriding disablement of inner animations
|
1545 | * Despite inner animations being disabled, a parent animation can `query()`
|
1546 | * for inner elements located in disabled areas of the template and still animate
|
1547 | * them if needed. This is also the case for when a sub animation is
|
1548 | * queried by a parent and then later animated using `animateChild()`.
|
1549 | *
|
1550 | * ### Detecting when an animation is disabled
|
1551 | * If a region of the DOM (or the entire application) has its animations disabled, the animation
|
1552 | * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides
|
1553 | * an instance of an `AnimationEvent`. If animations are disabled,
|
1554 | * the `.disabled` flag on the event is true.
|
1555 | *
|
1556 | * @publicApi
|
1557 | */
|
1558 | export declare function trigger(name: string, definitions: AnimationMetadata[]): AnimationTriggerMetadata;
|
1559 |
|
1560 | /**
|
1561 | * Starts a reusable animation that is created using the `animation()` function.
|
1562 | *
|
1563 | * @param animation The reusable animation to start.
|
1564 | * @param options An options object that can contain a delay value for the start of
|
1565 | * the animation, and additional override values for developer-defined parameters.
|
1566 | * @return An object that contains the animation parameters.
|
1567 | *
|
1568 | * @publicApi
|
1569 | */
|
1570 | export declare function useAnimation(animation: AnimationReferenceMetadata, options?: AnimationOptions | null): AnimationAnimateRefMetadata;
|
1571 |
|
1572 | /**
|
1573 | * A programmatic controller for a group of reusable animations.
|
1574 | * Used internally to control animations.
|
1575 | *
|
1576 | * @see `AnimationPlayer`
|
1577 | * @see `{@link animations/group group()}`
|
1578 | *
|
1579 | */
|
1580 | export declare class ɵAnimationGroupPlayer implements AnimationPlayer {
|
1581 | private _onDoneFns;
|
1582 | private _onStartFns;
|
1583 | private _finished;
|
1584 | private _started;
|
1585 | private _destroyed;
|
1586 | private _onDestroyFns;
|
1587 | parentPlayer: AnimationPlayer | null;
|
1588 | totalTime: number;
|
1589 | readonly players: AnimationPlayer[];
|
1590 | constructor(_players: AnimationPlayer[]);
|
1591 | private _onFinish;
|
1592 | init(): void;
|
1593 | onStart(fn: () => void): void;
|
1594 | private _onStart;
|
1595 | onDone(fn: () => void): void;
|
1596 | onDestroy(fn: () => void): void;
|
1597 | hasStarted(): boolean;
|
1598 | play(): void;
|
1599 | pause(): void;
|
1600 | restart(): void;
|
1601 | finish(): void;
|
1602 | destroy(): void;
|
1603 | private _onDestroy;
|
1604 | reset(): void;
|
1605 | setPosition(p: number): void;
|
1606 | getPosition(): number;
|
1607 | beforeDestroy(): void;
|
1608 | }
|
1609 |
|
1610 | export declare const ɵPRE_STYLE = "!";
|
1611 |
|
1612 |
|
1613 | /**
|
1614 | * Represents a set of CSS styles for use in an animation style as a generic.
|
1615 | */
|
1616 | export declare interface ɵStyleData {
|
1617 | [key: string]: string | number;
|
1618 | }
|
1619 |
|
1620 | /**
|
1621 | * Represents a set of CSS styles for use in an animation style as a Map.
|
1622 | */
|
1623 | export declare type ɵStyleDataMap = Map<string, string | number>;
|
1624 |
|
1625 | export { }
|
1626 |
|
\ | No newline at end of file |