mdc.base.d.ts 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. // Generated by dts-bundle v0.7.3
  2. declare module '@material/base' {
  3. /**
  4. * @license
  5. * Copyright 2019 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. export * from '@material/base/component';
  26. export * from '@material/base/foundation';
  27. export * from '@material/base/types';
  28. }
  29. declare module '@material/base/component' {
  30. /**
  31. * @license
  32. * Copyright 2016 Google Inc.
  33. *
  34. * Permission is hereby granted, free of charge, to any person obtaining a copy
  35. * of this software and associated documentation files (the "Software"), to deal
  36. * in the Software without restriction, including without limitation the rights
  37. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  38. * copies of the Software, and to permit persons to whom the Software is
  39. * furnished to do so, subject to the following conditions:
  40. *
  41. * The above copyright notice and this permission notice shall be included in
  42. * all copies or substantial portions of the Software.
  43. *
  44. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  50. * THE SOFTWARE.
  51. */
  52. import { MDCFoundation } from '@material/base/foundation';
  53. import { CustomEventListener, EventType, SpecificEventListener } from '@material/base/types';
  54. export class MDCComponent<FoundationType extends MDCFoundation> {
  55. static attachTo(root: Element): MDCComponent<MDCFoundation<{}>>;
  56. protected root_: Element;
  57. protected foundation_: FoundationType;
  58. constructor(root: Element, foundation?: FoundationType, ...args: Array<unknown>);
  59. initialize(..._args: Array<unknown>): void;
  60. getDefaultFoundation(): FoundationType;
  61. initialSyncWithDOM(): void;
  62. destroy(): void;
  63. /**
  64. * Wrapper method to add an event listener to the component's root element. This is most useful when
  65. * listening for custom events.
  66. */
  67. listen<K extends EventType>(evtType: K, handler: SpecificEventListener<K>, options?: AddEventListenerOptions | boolean): void;
  68. listen<E extends Event>(evtType: string, handler: CustomEventListener<E>, options?: AddEventListenerOptions | boolean): void;
  69. /**
  70. * Wrapper method to remove an event listener to the component's root element. This is most useful when
  71. * unlistening for custom events.
  72. */
  73. unlisten<K extends EventType>(evtType: K, handler: SpecificEventListener<K>, options?: AddEventListenerOptions | boolean): void;
  74. unlisten<E extends Event>(evtType: string, handler: CustomEventListener<E>, options?: AddEventListenerOptions | boolean): void;
  75. /**
  76. * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
  77. */
  78. emit<T extends object>(evtType: string, evtData: T, shouldBubble?: boolean): void;
  79. }
  80. export default MDCComponent;
  81. }
  82. declare module '@material/base/foundation' {
  83. /**
  84. * @license
  85. * Copyright 2016 Google Inc.
  86. *
  87. * Permission is hereby granted, free of charge, to any person obtaining a copy
  88. * of this software and associated documentation files (the "Software"), to deal
  89. * in the Software without restriction, including without limitation the rights
  90. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  91. * copies of the Software, and to permit persons to whom the Software is
  92. * furnished to do so, subject to the following conditions:
  93. *
  94. * The above copyright notice and this permission notice shall be included in
  95. * all copies or substantial portions of the Software.
  96. *
  97. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  98. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  99. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  100. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  101. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  102. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  103. * THE SOFTWARE.
  104. */
  105. export class MDCFoundation<AdapterType extends {} = {}> {
  106. static readonly cssClasses: {
  107. [key: string]: string;
  108. };
  109. static readonly strings: {
  110. [key: string]: string;
  111. };
  112. static readonly numbers: {
  113. [key: string]: number;
  114. };
  115. static readonly defaultAdapter: {};
  116. protected adapter_: AdapterType;
  117. constructor(adapter?: AdapterType);
  118. init(): void;
  119. destroy(): void;
  120. }
  121. export default MDCFoundation;
  122. }
  123. declare module '@material/base/types' {
  124. /**
  125. * @license
  126. * Copyright 2019 Google Inc.
  127. *
  128. * Permission is hereby granted, free of charge, to any person obtaining a copy
  129. * of this software and associated documentation files (the "Software"), to deal
  130. * in the Software without restriction, including without limitation the rights
  131. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  132. * copies of the Software, and to permit persons to whom the Software is
  133. * furnished to do so, subject to the following conditions:
  134. *
  135. * The above copyright notice and this permission notice shall be included in
  136. * all copies or substantial portions of the Software.
  137. *
  138. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  139. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  140. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  141. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  142. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  143. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  144. * THE SOFTWARE.
  145. */
  146. export type EventType = keyof GlobalEventHandlersEventMap;
  147. export type SpecificEventListener<K extends EventType> = (evt: GlobalEventHandlersEventMap[K]) => void;
  148. export type CustomEventListener<E extends Event> = (evt: E) => void;
  149. }