UNPKG

3.08 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2018 Google Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23import { MDCTopAppBarAdapter } from '../adapter';
24import { MDCTopAppBarBaseFoundation } from '../foundation';
25export declare class MDCTopAppBarFoundation extends MDCTopAppBarBaseFoundation {
26 /**
27 * Indicates if the top app bar was docked in the previous scroll handler iteration.
28 */
29 private wasDocked;
30 /**
31 * Indicates if the top app bar is docked in the fully shown position.
32 */
33 private isDockedShowing;
34 /**
35 * Variable for current scroll position of the top app bar
36 */
37 private currentAppBarOffsetTop;
38 /**
39 * Used to prevent the top app bar from being scrolled out of view during resize events
40 */
41 private isCurrentlyBeingResized;
42 /**
43 * The timeout that's used to throttle the resize events
44 */
45 private resizeThrottleId;
46 /**
47 * Used for diffs of current scroll position vs previous scroll position
48 */
49 private lastScrollPosition;
50 /**
51 * Used to verify when the top app bar is completely showing or completely hidden
52 */
53 private topAppBarHeight;
54 /**
55 * The timeout that's used to debounce toggling the isCurrentlyBeingResized
56 * variable after a resize
57 */
58 private resizeDebounceId;
59 constructor(adapter?: Partial<MDCTopAppBarAdapter>);
60 destroy(): void;
61 /**
62 * Scroll handler for the default scroll behavior of the top app bar.
63 */
64 handleTargetScroll(): void;
65 /**
66 * Top app bar resize handler that throttle/debounce functions that execute updates.
67 */
68 handleWindowResize(): void;
69 /**
70 * Function to determine if the DOM needs to update.
71 */
72 private checkForUpdate;
73 /**
74 * Function to move the top app bar if needed.
75 */
76 private moveTopAppBar;
77 /**
78 * Throttled function that updates the top app bar scrolled values if the
79 * top app bar height changes.
80 */
81 private throttledResizeHandler;
82}
83export default MDCTopAppBarFoundation;