foundation.d.ts 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. */
  23. import { MDCTopAppBarAdapter } from '../adapter';
  24. import { MDCTopAppBarBaseFoundation } from '../foundation';
  25. /** MDC Top App Bar Foundation */
  26. export declare class MDCTopAppBarFoundation extends MDCTopAppBarBaseFoundation {
  27. /**
  28. * Indicates if the top app bar was docked in the previous scroll handler
  29. * iteration.
  30. */
  31. private wasDocked;
  32. /**
  33. * Indicates if the top app bar is docked in the fully shown position.
  34. */
  35. private isDockedShowing;
  36. /**
  37. * Variable for current scroll position of the top app bar
  38. */
  39. private currentAppBarOffsetTop;
  40. /**
  41. * Used to prevent the top app bar from being scrolled out of view during
  42. * resize events
  43. */
  44. private isCurrentlyBeingResized;
  45. /**
  46. * The timeout that's used to throttle the resize events
  47. */
  48. private resizeThrottleId;
  49. /**
  50. * Used for diffs of current scroll position vs previous scroll position
  51. */
  52. private lastScrollPosition;
  53. /**
  54. * Used to verify when the top app bar is completely showing or completely
  55. * hidden
  56. */
  57. private topAppBarHeight;
  58. /**
  59. * The timeout that's used to debounce toggling the isCurrentlyBeingResized
  60. * variable after a resize
  61. */
  62. private resizeDebounceId;
  63. constructor(adapter?: Partial<MDCTopAppBarAdapter>);
  64. destroy(): void;
  65. /**
  66. * Scroll handler for the default scroll behavior of the top app bar.
  67. */
  68. handleTargetScroll(): void;
  69. /**
  70. * Top app bar resize handler that throttle/debounce functions that execute
  71. * updates.
  72. */
  73. handleWindowResize(): void;
  74. /**
  75. * Function to determine if the DOM needs to update.
  76. */
  77. private checkForUpdate;
  78. /**
  79. * Function to move the top app bar if needed.
  80. */
  81. private moveTopAppBar;
  82. /**
  83. * Throttled function that updates the top app bar scrolled values if the
  84. * top app bar height changes.
  85. */
  86. private throttledResizeHandler;
  87. }
  88. export default MDCTopAppBarFoundation;