mdc.dom.d.ts 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Generated by dts-bundle v0.7.3
  2. declare module '@material/dom' {
  3. /**
  4. * @license
  5. * Copyright 2018 Google Inc.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. * THE SOFTWARE.
  24. */
  25. import * as events from '@material/dom/events';
  26. import * as focusTrap from '@material/dom/focus-trap';
  27. import * as ponyfill from '@material/dom/ponyfill';
  28. export { events, focusTrap, ponyfill };
  29. }
  30. declare module '@material/dom/events' {
  31. /**
  32. * Determine whether the current browser supports passive event listeners, and
  33. * if so, use them.
  34. */
  35. export function applyPassive(globalObj?: Window): boolean | EventListenerOptions;
  36. }
  37. declare module '@material/dom/focus-trap' {
  38. /**
  39. * Utility to trap focus in a given root element, e.g. for modal components such
  40. * as dialogs. The root should have at least one focusable child element,
  41. * for setting initial focus when trapping focus.
  42. * Also tracks the previously focused element, and restores focus to that
  43. * element when releasing focus.
  44. */
  45. export class FocusTrap {
  46. constructor(root: HTMLElement, options?: FocusOptions);
  47. /**
  48. * Traps focus in `root`. Also focuses on either `initialFocusEl` if set;
  49. * otherwises sets initial focus to the first focusable child element.
  50. */
  51. trapFocus(): void;
  52. /**
  53. * Releases focus from `root`. Also restores focus to the previously focused
  54. * element.
  55. */
  56. releaseFocus(): void;
  57. }
  58. /** Customization options. */
  59. export interface FocusOptions {
  60. initialFocusEl?: HTMLElement;
  61. skipInitialFocus?: boolean;
  62. }
  63. }
  64. declare module '@material/dom/ponyfill' {
  65. /**
  66. * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
  67. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
  68. */
  69. export function closest(element: Element, selector: string): Element | null;
  70. export function matches(element: Element, selector: string): boolean;
  71. /**
  72. * Used to compute the estimated scroll width of elements. When an element is
  73. * hidden due to display: none; being applied to a parent element, the width is
  74. * returned as 0. However, the element will have a true width once no longer
  75. * inside a display: none context. This method computes an estimated width when
  76. * the element is hidden or returns the true width when the element is visble.
  77. * @param {Element} element the element whose width to estimate
  78. */
  79. export function estimateScrollWidth(element: Element): number;
  80. }