Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 44170fb

Browse files
nckhlynnmercier
authored andcommitted
feat(ripple): Annotate mdc-ripple for closure (#856)
Resolved #341
1 parent 957d662 commit 44170fb

File tree

5 files changed

+266
-14
lines changed

5 files changed

+266
-14
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
"closureWhitelist": [
162162
"mdc-animation",
163163
"mdc-base",
164-
"mdc-menu"
164+
"mdc-menu",
165+
"mdc-ripple"
165166
]
166167
}

packages/mdc-ripple/adapter.js

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* Copyright 2016 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/* eslint no-unused-vars: [2, {"args": "none"}] */
18+
19+
/**
20+
* Adapter for MDC Ripple. Provides an interface for managing
21+
* - classes
22+
* - dom
23+
* - CSS variables
24+
* - position
25+
* - dimensions
26+
* - scroll position
27+
* - event handlers
28+
* - unbounded, active and disabled states
29+
*
30+
* Additionally, provides type information for the adapter to the Closure
31+
* compiler.
32+
*
33+
* Implement this adapter for your framework of choice to delegate updates to
34+
* the component in your framework of choice. See architecture documentation
35+
* for more details.
36+
* https://github.com/material-components/material-components-web/blob/master/docs/architecture.md
37+
*
38+
* @record
39+
*/
40+
export default class MDCRippleAdapter {
41+
42+
/** @return {boolean} */
43+
browserSupportsCssVars() {}
44+
45+
/** @return {boolean} */
46+
isUnbounded() {}
47+
48+
/** @return {boolean} */
49+
isSurfaceActive() {}
50+
51+
/** @return {boolean} */
52+
isSurfaceDisabled() {}
53+
54+
/** @param {string} className */
55+
addClass(className) {}
56+
57+
/** @param {string} className */
58+
removeClass(className) {}
59+
60+
/**
61+
* @param {string} evtType
62+
* @param {!Function} handler
63+
*/
64+
registerInteractionHandler(evtType, handler) {}
65+
66+
/**
67+
* @param {string} evtType
68+
* @param {!Function} handler
69+
*/
70+
deregisterInteractionHandler(evtType, handler) {}
71+
72+
/**
73+
* @param {!Function} handler
74+
*/
75+
registerResizeHandler(handler) {}
76+
77+
/**
78+
* @param {!Function} handler
79+
*/
80+
deregisterResizeHandler(handler) {}
81+
82+
/**
83+
* @param {string} varName
84+
* @param {?number|string} value
85+
*/
86+
updateCssVariable(varName, value) {}
87+
88+
/** @return {!ClientRect} */
89+
computeBoundingRect() {}
90+
91+
/** @return {{x: number, y: number}} */
92+
getWindowPageOffset() {}
93+
94+
}

0 commit comments

Comments
 (0)