-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(menu): annotate mdc-menu for closure compiler
Resolves #339 Added new annotations to mdc-menu. Corrected a couple of annotations in base.
- Loading branch information
1 parent
94d62ad
commit b188d4f
Showing
7 changed files
with
356 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,7 @@ | |
}, | ||
"closureWhitelist": [ | ||
"mdc-animation", | ||
"mdc-base" | ||
"mdc-base", | ||
"mdc-menu" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* eslint no-unused-vars: [2, {"args": "none"}] */ | ||
|
||
/** | ||
* Adapter for MDC Simple Menu. Provides an interface for managing | ||
* - classes | ||
* - dom | ||
* - focus | ||
* - position | ||
* - dimensions | ||
* - event handlers | ||
* | ||
* Additionally, provides type information for the adapter to the Closure | ||
* compiler. | ||
* | ||
* Implement this adapter for your framework of choice to delegate updates to | ||
* the component in your framework of choice. See architecture documentation | ||
* for more details. | ||
* https://github.com/material-components/material-components-web/blob/master/docs/architecture.md | ||
* | ||
* @record | ||
*/ | ||
export default class MDCSimpleMenuAdapter { | ||
/** @param {string} className */ | ||
addClass(className) {} | ||
|
||
/** @param {string} className */ | ||
removeClass(className) {} | ||
|
||
/** | ||
* @param {string} className | ||
* @return {boolean} | ||
*/ | ||
hasClass(className) {} | ||
|
||
/** @return {boolean} */ | ||
hasNecessaryDom() {} | ||
|
||
/** | ||
* @param {EventTarget} target | ||
* @param {string} attributeName | ||
* @return {string} | ||
*/ | ||
getAttributeForEventTarget(target, attributeName) {} | ||
|
||
/** @return {{ width: number, height: number }} */ | ||
getInnerDimensions() {} | ||
|
||
/** @return {boolean} */ | ||
hasAnchor() {} | ||
|
||
/** @return {{width: number, height: number, top: number, right: number, bottom: number, left: number}} */ | ||
getAnchorDimensions() {} | ||
|
||
/** @return {{ width: number, height: number }} */ | ||
getWindowDimensions() {} | ||
|
||
/** | ||
* @param {number} x | ||
* @param {number} y | ||
*/ | ||
setScale(x, y) {} | ||
|
||
/** | ||
* @param {number} x | ||
* @param {number} y | ||
*/ | ||
setInnerScale(x, y) {} | ||
|
||
/** @return {number} */ | ||
getNumberOfItems() {} | ||
|
||
/** | ||
* @param {string} type | ||
* @param {function(!Event)} handler | ||
*/ | ||
registerInteractionHandler(type, handler) {} | ||
|
||
/** | ||
* @param {string} type | ||
* @param {function(!Event)} handler | ||
*/ | ||
deregisterInteractionHandler(type, handler) {} | ||
|
||
/** @param {function(!Event)} handler */ | ||
registerBodyClickHandler(handler) {} | ||
|
||
/** @param {function(!Event)} handler */ | ||
deregisterBodyClickHandler(handler) {} | ||
|
||
/** | ||
* @param {number} index | ||
* @return {{top: number, height: number}} | ||
*/ | ||
getYParamsForItemAtIndex(index) {} | ||
|
||
/** | ||
* @param {number} index | ||
* @param {string|null} value | ||
*/ | ||
setTransitionDelayForItemAtIndex(index, value) {} | ||
|
||
/** | ||
* @param {EventTarget} target | ||
* @return {number} | ||
*/ | ||
getIndexForEventTarget(target) {} | ||
|
||
/** @param {{index: number}} evtData */ | ||
notifySelected(evtData) {} | ||
|
||
notifyCancel() {} | ||
|
||
saveFocus() {} | ||
|
||
restoreFocus() {} | ||
|
||
/** @return {boolean} */ | ||
isFocused() {} | ||
|
||
focus() {} | ||
|
||
/** @return {number} */ | ||
getFocusedItemIndex() /* number */ {} | ||
|
||
/** @param {number} index */ | ||
focusItemAtIndex(index) {} | ||
|
||
/** @return {boolean} */ | ||
isRtl() {} | ||
|
||
/** @param {string} origin */ | ||
setTransformOrigin(origin) {} | ||
|
||
/** @param {{ | ||
* top: (string|undefined), | ||
* right: (string|undefined), | ||
* bottom: (string|undefined), | ||
* left: (string|undefined) | ||
* }} position */ | ||
setPosition(position) {} | ||
|
||
/** @return {number} */ | ||
getAccurateTime() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.