mdc.ripple.d.ts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. // Generated by dts-bundle v0.7.3
  2. // Dependencies for this module:
  3. // ../../@material/base/types
  4. // ../../@material/base/component
  5. // ../../@material/base/foundation
  6. declare module '@material/ripple' {
  7. /**
  8. * @license
  9. * Copyright 2019 Google Inc.
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12. * of this software and associated documentation files (the "Software"), to deal
  13. * in the Software without restriction, including without limitation the rights
  14. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. * copies of the Software, and to permit persons to whom the Software is
  16. * furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be included in
  19. * all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27. * THE SOFTWARE.
  28. */
  29. import * as util from '@material/ripple/util';
  30. export { util };
  31. export * from '@material/ripple/adapter';
  32. export * from '@material/ripple/component';
  33. export * from '@material/ripple/constants';
  34. export * from '@material/ripple/foundation';
  35. export * from '@material/ripple/types';
  36. }
  37. declare module '@material/ripple/util' {
  38. /**
  39. * @license
  40. * Copyright 2016 Google Inc.
  41. *
  42. * Permission is hereby granted, free of charge, to any person obtaining a copy
  43. * of this software and associated documentation files (the "Software"), to deal
  44. * in the Software without restriction, including without limitation the rights
  45. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46. * copies of the Software, and to permit persons to whom the Software is
  47. * furnished to do so, subject to the following conditions:
  48. *
  49. * The above copyright notice and this permission notice shall be included in
  50. * all copies or substantial portions of the Software.
  51. *
  52. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  54. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  55. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  56. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  57. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  58. * THE SOFTWARE.
  59. */
  60. import { MDCRipplePoint } from '@material/ripple/types';
  61. export function supportsCssVariables(windowObj: Window, forceRefresh?: boolean): boolean;
  62. export function getNormalizedEventCoords(evt: Event | undefined, pageOffset: MDCRipplePoint, clientRect: ClientRect): MDCRipplePoint;
  63. }
  64. declare module '@material/ripple/adapter' {
  65. /**
  66. * @license
  67. * Copyright 2016 Google Inc.
  68. *
  69. * Permission is hereby granted, free of charge, to any person obtaining a copy
  70. * of this software and associated documentation files (the "Software"), to deal
  71. * in the Software without restriction, including without limitation the rights
  72. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  73. * copies of the Software, and to permit persons to whom the Software is
  74. * furnished to do so, subject to the following conditions:
  75. *
  76. * The above copyright notice and this permission notice shall be included in
  77. * all copies or substantial portions of the Software.
  78. *
  79. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  80. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  81. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  82. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  83. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  84. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  85. * THE SOFTWARE.
  86. */
  87. import { EventType, SpecificEventListener } from '@material/base/types';
  88. import { MDCRipplePoint } from '@material/ripple/types';
  89. /**
  90. * Defines the shape of the adapter expected by the foundation.
  91. * Implement this adapter for your framework of choice to delegate updates to
  92. * the component in your framework of choice. See architecture documentation
  93. * for more details.
  94. * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
  95. */
  96. export interface MDCRippleAdapter {
  97. browserSupportsCssVars(): boolean;
  98. isUnbounded(): boolean;
  99. isSurfaceActive(): boolean;
  100. isSurfaceDisabled(): boolean;
  101. addClass(className: string): void;
  102. removeClass(className: string): void;
  103. containsEventTarget(target: EventTarget | null): boolean;
  104. registerInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void;
  105. deregisterInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void;
  106. registerDocumentInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void;
  107. deregisterDocumentInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void;
  108. registerResizeHandler(handler: SpecificEventListener<'resize'>): void;
  109. deregisterResizeHandler(handler: SpecificEventListener<'resize'>): void;
  110. updateCssVariable(varName: string, value: string | null): void;
  111. computeBoundingRect(): ClientRect;
  112. getWindowPageOffset(): MDCRipplePoint;
  113. }
  114. }
  115. declare module '@material/ripple/component' {
  116. /**
  117. * @license
  118. * Copyright 2016 Google Inc.
  119. *
  120. * Permission is hereby granted, free of charge, to any person obtaining a copy
  121. * of this software and associated documentation files (the "Software"), to deal
  122. * in the Software without restriction, including without limitation the rights
  123. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  124. * copies of the Software, and to permit persons to whom the Software is
  125. * furnished to do so, subject to the following conditions:
  126. *
  127. * The above copyright notice and this permission notice shall be included in
  128. * all copies or substantial portions of the Software.
  129. *
  130. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  131. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  132. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  133. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  134. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  135. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  136. * THE SOFTWARE.
  137. */
  138. import { MDCComponent } from '@material/base/component';
  139. import { MDCRippleAdapter } from '@material/ripple/adapter';
  140. import { MDCRippleFoundation } from '@material/ripple/foundation';
  141. import { MDCRippleAttachOpts, MDCRippleCapableSurface } from '@material/ripple/types';
  142. export type MDCRippleFactory = (el: Element, foundation?: MDCRippleFoundation) => MDCRipple;
  143. export class MDCRipple extends MDCComponent<MDCRippleFoundation> implements MDCRippleCapableSurface {
  144. static attachTo(root: Element, opts?: MDCRippleAttachOpts): MDCRipple;
  145. static createAdapter(instance: MDCRippleCapableSurface): MDCRippleAdapter;
  146. root_: Element;
  147. disabled: boolean;
  148. unbounded: boolean;
  149. activate(): void;
  150. deactivate(): void;
  151. layout(): void;
  152. getDefaultFoundation(): MDCRippleFoundation;
  153. initialSyncWithDOM(): void;
  154. }
  155. }
  156. declare module '@material/ripple/constants' {
  157. /**
  158. * @license
  159. * Copyright 2016 Google Inc.
  160. *
  161. * Permission is hereby granted, free of charge, to any person obtaining a copy
  162. * of this software and associated documentation files (the "Software"), to deal
  163. * in the Software without restriction, including without limitation the rights
  164. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  165. * copies of the Software, and to permit persons to whom the Software is
  166. * furnished to do so, subject to the following conditions:
  167. *
  168. * The above copyright notice and this permission notice shall be included in
  169. * all copies or substantial portions of the Software.
  170. *
  171. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  172. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  173. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  174. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  175. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  176. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  177. * THE SOFTWARE.
  178. */
  179. export const cssClasses: {
  180. BG_FOCUSED: string;
  181. FG_ACTIVATION: string;
  182. FG_DEACTIVATION: string;
  183. ROOT: string;
  184. UNBOUNDED: string;
  185. };
  186. export const strings: {
  187. VAR_FG_SCALE: string;
  188. VAR_FG_SIZE: string;
  189. VAR_FG_TRANSLATE_END: string;
  190. VAR_FG_TRANSLATE_START: string;
  191. VAR_LEFT: string;
  192. VAR_TOP: string;
  193. };
  194. export const numbers: {
  195. DEACTIVATION_TIMEOUT_MS: number;
  196. FG_DEACTIVATION_MS: number;
  197. INITIAL_ORIGIN_SCALE: number;
  198. PADDING: number;
  199. TAP_DELAY_MS: number;
  200. };
  201. }
  202. declare module '@material/ripple/foundation' {
  203. /**
  204. * @license
  205. * Copyright 2016 Google Inc.
  206. *
  207. * Permission is hereby granted, free of charge, to any person obtaining a copy
  208. * of this software and associated documentation files (the "Software"), to deal
  209. * in the Software without restriction, including without limitation the rights
  210. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  211. * copies of the Software, and to permit persons to whom the Software is
  212. * furnished to do so, subject to the following conditions:
  213. *
  214. * The above copyright notice and this permission notice shall be included in
  215. * all copies or substantial portions of the Software.
  216. *
  217. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  218. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  219. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  220. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  221. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  222. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  223. * THE SOFTWARE.
  224. */
  225. import { MDCFoundation } from '@material/base/foundation';
  226. import { MDCRippleAdapter } from '@material/ripple/adapter';
  227. export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> {
  228. static readonly cssClasses: {
  229. BG_FOCUSED: string;
  230. FG_ACTIVATION: string;
  231. FG_DEACTIVATION: string;
  232. ROOT: string;
  233. UNBOUNDED: string;
  234. };
  235. static readonly strings: {
  236. VAR_FG_SCALE: string;
  237. VAR_FG_SIZE: string;
  238. VAR_FG_TRANSLATE_END: string;
  239. VAR_FG_TRANSLATE_START: string;
  240. VAR_LEFT: string;
  241. VAR_TOP: string;
  242. };
  243. static readonly numbers: {
  244. DEACTIVATION_TIMEOUT_MS: number;
  245. FG_DEACTIVATION_MS: number;
  246. INITIAL_ORIGIN_SCALE: number;
  247. PADDING: number;
  248. TAP_DELAY_MS: number;
  249. };
  250. static readonly defaultAdapter: MDCRippleAdapter;
  251. constructor(adapter?: Partial<MDCRippleAdapter>);
  252. init(): void;
  253. destroy(): void;
  254. /**
  255. * @param evt Optional event containing position information.
  256. */
  257. activate(evt?: Event): void;
  258. deactivate(): void;
  259. layout(): void;
  260. setUnbounded(unbounded: boolean): void;
  261. handleFocus(): void;
  262. handleBlur(): void;
  263. }
  264. export default MDCRippleFoundation;
  265. }
  266. declare module '@material/ripple/types' {
  267. /**
  268. * @license
  269. * Copyright 2019 Google Inc.
  270. *
  271. * Permission is hereby granted, free of charge, to any person obtaining a copy
  272. * of this software and associated documentation files (the "Software"), to deal
  273. * in the Software without restriction, including without limitation the rights
  274. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  275. * copies of the Software, and to permit persons to whom the Software is
  276. * furnished to do so, subject to the following conditions:
  277. *
  278. * The above copyright notice and this permission notice shall be included in
  279. * all copies or substantial portions of the Software.
  280. *
  281. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  282. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  283. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  284. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  285. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  286. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  287. * THE SOFTWARE.
  288. */
  289. export interface MDCRipplePoint {
  290. x: number;
  291. y: number;
  292. }
  293. /**
  294. * Options passed in when attaching a ripple to an object.
  295. */
  296. export interface MDCRippleAttachOpts {
  297. isUnbounded?: boolean;
  298. }
  299. /**
  300. * See Material Design spec for more details on when to use ripples.
  301. * https://material.io/guidelines/motion/choreography.html#choreography-creation
  302. * unbounded Whether or not the ripple bleeds out of the bounds of the element.
  303. * disabled Whether or not the ripple is attached to a disabled component.
  304. */
  305. export interface MDCRippleCapableSurface {
  306. readonly root_: Element;
  307. unbounded?: boolean;
  308. disabled?: boolean;
  309. }
  310. }