UNPKG

9.6 kBTypeScriptView Raw
1// Generated by dts-bundle v0.7.3
2
3declare module '@material/base' {
4 /**
5 * @license
6 * Copyright 2019 Google Inc.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26 export * from '@material/base/component';
27 export * from '@material/base/foundation';
28 export * from '@material/base/types';
29}
30
31declare module '@material/base/component' {
32 /**
33 * @license
34 * Copyright 2016 Google Inc.
35 *
36 * Permission is hereby granted, free of charge, to any person obtaining a copy
37 * of this software and associated documentation files (the "Software"), to deal
38 * in the Software without restriction, including without limitation the rights
39 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40 * copies of the Software, and to permit persons to whom the Software is
41 * furnished to do so, subject to the following conditions:
42 *
43 * The above copyright notice and this permission notice shall be included in
44 * all copies or substantial portions of the Software.
45 *
46 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
52 * THE SOFTWARE.
53 */
54 import { MDCFoundation } from '@material/base/foundation';
55 import { CustomEventListener, EventType, SpecificEventListener } from '@material/base/types';
56 export class MDCComponent<FoundationType extends MDCFoundation> {
57 root: Element;
58 static attachTo(root: Element): MDCComponent<MDCFoundation<{}>>;
59 protected foundation: FoundationType;
60 constructor(root: Element, foundation?: FoundationType, ...args: unknown[]);
61 initialize(..._args: Array<unknown>): void;
62 getDefaultFoundation(): FoundationType;
63 initialSyncWithDOM(): void;
64 destroy(): void;
65 /**
66 * Wrapper method to add an event listener to the component's root element. This is most useful when
67 * listening for custom events.
68 */
69 listen<K extends EventType>(evtType: K, handler: SpecificEventListener<K>, options?: AddEventListenerOptions | boolean): void;
70 listen<E extends Event>(evtType: string, handler: CustomEventListener<E>, options?: AddEventListenerOptions | boolean): void;
71 /**
72 * Wrapper method to remove an event listener to the component's root element. This is most useful when
73 * unlistening for custom events.
74 */
75 unlisten<K extends EventType>(evtType: K, handler: SpecificEventListener<K>, options?: AddEventListenerOptions | boolean): void;
76 unlisten<E extends Event>(evtType: string, handler: CustomEventListener<E>, options?: AddEventListenerOptions | boolean): void;
77 /**
78 * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
79 */
80 emit<T extends object>(evtType: string, evtData: T, shouldBubble?: boolean): void;
81 }
82 export default MDCComponent;
83}
84
85declare module '@material/base/foundation' {
86 /**
87 * @license
88 * Copyright 2016 Google Inc.
89 *
90 * Permission is hereby granted, free of charge, to any person obtaining a copy
91 * of this software and associated documentation files (the "Software"), to deal
92 * in the Software without restriction, including without limitation the rights
93 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
94 * copies of the Software, and to permit persons to whom the Software is
95 * furnished to do so, subject to the following conditions:
96 *
97 * The above copyright notice and this permission notice shall be included in
98 * all copies or substantial portions of the Software.
99 *
100 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
101 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
102 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
103 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
104 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
105 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
106 * THE SOFTWARE.
107 */
108 export class MDCFoundation<AdapterType extends {} = {}> {
109 protected adapter: AdapterType;
110 static get cssClasses(): {
111 [key: string]: string;
112 };
113 static get strings(): {
114 [key: string]: string;
115 };
116 static get numbers(): {
117 [key: string]: number;
118 };
119 static get defaultAdapter(): {};
120 constructor(adapter?: AdapterType);
121 init(): void;
122 destroy(): void;
123 }
124 /**
125 * The constructor for MDCFoundation.
126 */
127 export interface MDCFoundationConstructor<AdapterType extends object = any> {
128 new (adapter: AdapterType): MDCFoundation<AdapterType>;
129 readonly prototype: MDCFoundation<AdapterType>;
130 }
131 /**
132 * The deprecated constructor for MDCFoundation.
133 */
134 export interface MDCFoundationDeprecatedConstructor<AdapterType extends object = any> {
135 readonly cssClasses: Record<string, string>;
136 readonly strings: Record<string, string>;
137 readonly numbers: Record<string, number>;
138 readonly defaultAdapter: AdapterType;
139 new (adapter?: Partial<AdapterType>): MDCFoundation<AdapterType>;
140 readonly prototype: MDCFoundation<AdapterType>;
141 }
142 /**
143 * Retrieves the AdapaterType from the provided MDCFoundation generic type.
144 */
145 export type MDCFoundationAdapter<T> = T extends MDCFoundation<infer A> ? A : never;
146 export default MDCFoundation;
147}
148
149declare module '@material/base/types' {
150 /**
151 * @license
152 * Copyright 2019 Google Inc.
153 *
154 * Permission is hereby granted, free of charge, to any person obtaining a copy
155 * of this software and associated documentation files (the "Software"), to deal
156 * in the Software without restriction, including without limitation the rights
157 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
158 * copies of the Software, and to permit persons to whom the Software is
159 * furnished to do so, subject to the following conditions:
160 *
161 * The above copyright notice and this permission notice shall be included in
162 * all copies or substantial portions of the Software.
163 *
164 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
165 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
166 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
167 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
168 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
169 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
170 * THE SOFTWARE.
171 */
172 export type EventType = keyof GlobalEventHandlersEventMap;
173 export type SpecificEventListener<K extends EventType> = (evt: GlobalEventHandlersEventMap[K]) => void;
174 export type CustomEventListener<E extends Event> = (evt: E) => void;
175 export type WindowEventType = keyof WindowEventMap;
176 export type SpecificWindowEventListener<K extends WindowEventType> = (evt: WindowEventMap[K]) => void;
177 /**
178 * A generic type for the constructor of an instance type. Note that this type
179 * does not preserve accurate constructor parameters.
180 *
181 * @template T The instance type.
182 */
183 export type Constructor<T = any> = {
184 new (...args: any[]): T;
185 };
186}
187