|
| 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 Simple Menu. Provides an interface for managing |
| 21 | + * - classes |
| 22 | + * - dom |
| 23 | + * - focus |
| 24 | + * - position |
| 25 | + * - dimensions |
| 26 | + * - event handlers |
| 27 | + * |
| 28 | + * Additionally, provides type information for the adapter to the Closure |
| 29 | + * compiler. |
| 30 | + * |
| 31 | + * Implement this adapter for your framework of choice to delegate updates to |
| 32 | + * the component in your framework of choice. See architecture documentation |
| 33 | + * for more details. |
| 34 | + * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md |
| 35 | + * |
| 36 | + * @record |
| 37 | + */ |
| 38 | +export default class MDCSimpleMenuAdapter { |
| 39 | + /** @param {string} className */ |
| 40 | + addClass(className) {} |
| 41 | + |
| 42 | + /** @param {string} className */ |
| 43 | + removeClass(className) {} |
| 44 | + |
| 45 | + /** |
| 46 | + * @param {string} className |
| 47 | + * @return {boolean} |
| 48 | + */ |
| 49 | + hasClass(className) {} |
| 50 | + |
| 51 | + /** @return {boolean} */ |
| 52 | + hasNecessaryDom() {} |
| 53 | + |
| 54 | + /** |
| 55 | + * @param {EventTarget} target |
| 56 | + * @param {string} attributeName |
| 57 | + * @return {string} |
| 58 | + */ |
| 59 | + getAttributeForEventTarget(target, attributeName) {} |
| 60 | + |
| 61 | + /** @return {{ width: number, height: number }} */ |
| 62 | + getInnerDimensions() {} |
| 63 | + |
| 64 | + /** @return {boolean} */ |
| 65 | + hasAnchor() {} |
| 66 | + |
| 67 | + /** @return {{width: number, height: number, top: number, right: number, bottom: number, left: number}} */ |
| 68 | + getAnchorDimensions() {} |
| 69 | + |
| 70 | + /** @return {{ width: number, height: number }} */ |
| 71 | + getWindowDimensions() {} |
| 72 | + |
| 73 | + /** |
| 74 | + * @param {number} x |
| 75 | + * @param {number} y |
| 76 | + */ |
| 77 | + setScale(x, y) {} |
| 78 | + |
| 79 | + /** |
| 80 | + * @param {number} x |
| 81 | + * @param {number} y |
| 82 | + */ |
| 83 | + setInnerScale(x, y) {} |
| 84 | + |
| 85 | + /** @return {number} */ |
| 86 | + getNumberOfItems() {} |
| 87 | + |
| 88 | + /** |
| 89 | + * @param {string} type |
| 90 | + * @param {function(!Event)} handler |
| 91 | + */ |
| 92 | + registerInteractionHandler(type, handler) {} |
| 93 | + |
| 94 | + /** |
| 95 | + * @param {string} type |
| 96 | + * @param {function(!Event)} handler |
| 97 | + */ |
| 98 | + deregisterInteractionHandler(type, handler) {} |
| 99 | + |
| 100 | + /** @param {function(!Event)} handler */ |
| 101 | + registerBodyClickHandler(handler) {} |
| 102 | + |
| 103 | + /** @param {function(!Event)} handler */ |
| 104 | + deregisterBodyClickHandler(handler) {} |
| 105 | + |
| 106 | + /** |
| 107 | + * @param {number} index |
| 108 | + * @return {{top: number, height: number}} |
| 109 | + */ |
| 110 | + getYParamsForItemAtIndex(index) {} |
| 111 | + |
| 112 | + /** |
| 113 | + * @param {number} index |
| 114 | + * @param {string|null} value |
| 115 | + */ |
| 116 | + setTransitionDelayForItemAtIndex(index, value) {} |
| 117 | + |
| 118 | + /** |
| 119 | + * @param {EventTarget} target |
| 120 | + * @return {number} |
| 121 | + */ |
| 122 | + getIndexForEventTarget(target) {} |
| 123 | + |
| 124 | + /** @param {{index: number}} evtData */ |
| 125 | + notifySelected(evtData) {} |
| 126 | + |
| 127 | + notifyCancel() {} |
| 128 | + |
| 129 | + saveFocus() {} |
| 130 | + |
| 131 | + restoreFocus() {} |
| 132 | + |
| 133 | + /** @return {boolean} */ |
| 134 | + isFocused() {} |
| 135 | + |
| 136 | + focus() {} |
| 137 | + |
| 138 | + /** @return {number} */ |
| 139 | + getFocusedItemIndex() /* number */ {} |
| 140 | + |
| 141 | + /** @param {number} index */ |
| 142 | + focusItemAtIndex(index) {} |
| 143 | + |
| 144 | + /** @return {boolean} */ |
| 145 | + isRtl() {} |
| 146 | + |
| 147 | + /** @param {string} origin */ |
| 148 | + setTransformOrigin(origin) {} |
| 149 | + |
| 150 | + /** @param {{ |
| 151 | + * top: (string|undefined), |
| 152 | + * right: (string|undefined), |
| 153 | + * bottom: (string|undefined), |
| 154 | + * left: (string|undefined) |
| 155 | + * }} position */ |
| 156 | + setPosition(position) {} |
| 157 | + |
| 158 | + /** @return {number} */ |
| 159 | + getAccurateTime() {} |
| 160 | +} |
0 commit comments