@@ -195,7 +195,7 @@ console.log(`Menu is ${menu.open ? 'open' : 'closed'}.`);
195
195
##### ES2015
196
196
197
197
``` javascript
198
- import {MDCSimpleMenu , MDCSimpleMenuFoundation } from ' mdc-menu' ;
198
+ import {MDCSimpleMenu , MDCSimpleMenuFoundation , util } from ' mdc-menu' ;
199
199
```
200
200
201
201
##### CommonJS
@@ -204,6 +204,7 @@ import {MDCSimpleMenu, MDCSimpleMenuFoundation} from 'mdc-menu';
204
204
const mdcMenu = require (' mdc-menu' );
205
205
const MDCSimpleMenu = mdcMenu .MDCSimpleMenu ;
206
206
const MDCSimpleMenuFoundation = mdcMenu .MDCSimpleMenuFoundation ;
207
+ const util = mdcMenu .util ;
207
208
```
208
209
209
210
##### AMD
@@ -212,6 +213,7 @@ const MDCSimpleMenuFoundation = mdcMenu.MDCSimpleMenuFoundation;
212
213
require ([' path/to/mdc-menu' ], mdcMenu => {
213
214
const MDCSimpleMenu = mdcMenu .MDCSimpleMenu ;
214
215
const MDCSimpleMenuFoundation = mdcMenu .MDCSimpleMenuFoundation ;
216
+ const util = mdcMenu .util ;
215
217
});
216
218
```
217
219
@@ -220,6 +222,7 @@ require(['path/to/mdc-menu'], mdcMenu => {
220
222
``` javascript
221
223
const MDCSimpleMenu = mdc .Menu .MDCSimpleMenu ;
222
224
const MDCSimpleMenuFoundation = mdc .Menu .MDCSimpleMenuFoundation ;
225
+ const util = mdc .menu .util ;
223
226
```
224
227
225
228
#### Automatic Instantiation
@@ -306,3 +309,29 @@ Closes the menu.
306
309
#### MDCSimpleMenuFoundation.isOpen() => boolean
307
310
308
311
Returns whether or not the menu is open.
312
+
313
+
314
+ ### The util API
315
+ External frameworks and libraries can use the following utility methods when integrating a component.
316
+
317
+ #### util.getTransformPropertyName(globalObj, forceRefresh = false) => String
318
+
319
+ Returns the name of the correct transform property to use on the current browser.
320
+
321
+ #### util.clamp(value, min = 0, max = 1) => Number
322
+
323
+ Clamps a value between the minimum and the maximum, returning the clamped value.
324
+
325
+ #### util.bezierProgress(time, x1, y1, x2, y2) => Number
326
+
327
+ Returns the easing value to apply at time t, for a given cubic bezier curve.
328
+
329
+ ```
330
+ Control points P0 and P3 are assumed to be (0,0) and (1,1), respectively.
331
+ Parameters are as follows:
332
+ - time: The current time in the animation, scaled between 0 and 1.
333
+ - x1: The x value of control point P1.
334
+ - y1: The y value of control point P1.
335
+ - x2: The x value of control point P2.
336
+ - y2: The y value of control point P2.
337
+ ```
0 commit comments