This repository was archived by the owner on Dec 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TypeScript declarations to iron-selector. (#169)
* Generate minimal package.json from bower.json * Update and/or configure type declarations. * Add manual typings for IronSelection.
- Loading branch information
Showing
10 changed files
with
1,306 additions
and
0 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
bower_components* | ||
bower-*.json | ||
.DS_Store | ||
node_modules |
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,7 @@ | ||
{ | ||
"addReferences": { | ||
"iron-selection.d.ts": [ | ||
"iron-selection-extra.d.ts" | ||
] | ||
} | ||
} |
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,56 @@ | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file was automatically generated by | ||
* https://github.com/Polymer/gen-typescript-declarations | ||
* | ||
* To modify these typings, edit the source file(s): | ||
* iron-multi-selectable.html | ||
*/ | ||
|
||
/// <reference path="../polymer/types/polymer.d.ts" /> | ||
/// <reference path="iron-selectable.d.ts" /> | ||
|
||
declare namespace Polymer { | ||
|
||
interface IronMultiSelectableBehavior extends Polymer.IronSelectableBehavior { | ||
|
||
/** | ||
* UNUSED, FOR API COMPATIBILITY | ||
*/ | ||
readonly _shouldUpdateSelection: any; | ||
|
||
/** | ||
* If true, multiple selections are allowed. | ||
*/ | ||
multi: boolean|null|undefined; | ||
|
||
/** | ||
* Gets or sets the selected elements. This is used instead of `selected` when `multi` | ||
* is true. | ||
*/ | ||
selectedValues: any[]|null|undefined; | ||
|
||
/** | ||
* Returns an array of currently selected items. | ||
*/ | ||
readonly selectedItems: any[]|null|undefined; | ||
|
||
/** | ||
* Selects the given value. If the `multi` property is true, then the selected state of the | ||
* `value` will be toggled; otherwise the `value` will be selected. | ||
* | ||
* @param value the value to select. | ||
*/ | ||
select(value: string|number): void; | ||
_updateAttrForSelected(): void; | ||
_updateSelected(): void; | ||
_selectionChange(): void; | ||
multiChanged(multi: any): void; | ||
_selectMulti(values: any): void; | ||
_toggleSelected(value: any): void; | ||
_valuesToItems(values: any): any; | ||
} | ||
|
||
const IronMultiSelectableBehavior: object; | ||
} |
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,155 @@ | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file was automatically generated by | ||
* https://github.com/Polymer/gen-typescript-declarations | ||
* | ||
* To modify these typings, edit the source file(s): | ||
* iron-selectable.html | ||
*/ | ||
|
||
/// <reference path="../polymer/types/polymer.d.ts" /> | ||
/// <reference path="iron-selection.d.ts" /> | ||
|
||
declare namespace Polymer { | ||
|
||
interface IronSelectableBehavior { | ||
|
||
/** | ||
* If you want to use an attribute value or property of an element for | ||
* `selected` instead of the index, set this to the name of the attribute | ||
* or property. Hyphenated values are converted to camel case when used to | ||
* look up the property of a selectable element. Camel cased values are | ||
* *not* converted to hyphenated values for attribute lookup. It's | ||
* recommended that you provide the hyphenated form of the name so that | ||
* selection works in both cases. (Use `attr-or-property-name` instead of | ||
* `attrOrPropertyName`.) | ||
*/ | ||
attrForSelected: string|null|undefined; | ||
|
||
/** | ||
* Gets or sets the selected element. The default is to use the index of the item. | ||
*/ | ||
selected: string|number; | ||
|
||
/** | ||
* Returns the currently selected item. | ||
*/ | ||
readonly selectedItem: object|null; | ||
|
||
/** | ||
* The event that fires from items when they are selected. Selectable | ||
* will listen for this event from items and update the selection state. | ||
* Set to empty string to listen to no events. | ||
*/ | ||
activateEvent: string|null|undefined; | ||
|
||
/** | ||
* This is a CSS selector string. If this is set, only items that match the CSS selector | ||
* are selectable. | ||
*/ | ||
selectable: string|null|undefined; | ||
|
||
/** | ||
* The class to set on elements when selected. | ||
*/ | ||
selectedClass: string|null|undefined; | ||
|
||
/** | ||
* The attribute to set on elements when selected. | ||
*/ | ||
selectedAttribute: string|null|undefined; | ||
|
||
/** | ||
* Default fallback if the selection based on selected with `attrForSelected` | ||
* is not found. | ||
*/ | ||
fallbackSelection: string|null|undefined; | ||
|
||
/** | ||
* The list of items from which a selection can be made. | ||
*/ | ||
readonly items: any[]|null|undefined; | ||
|
||
/** | ||
* The set of excluded elements where the key is the `localName` | ||
* of the element that will be ignored from the item list. | ||
*/ | ||
_excludedLocalNames: object|null|undefined; | ||
|
||
/** | ||
* UNUSED, FOR API COMPATIBILITY | ||
*/ | ||
readonly _shouldUpdateSelection: any; | ||
created(): void; | ||
attached(): void; | ||
detached(): void; | ||
|
||
/** | ||
* Returns the index of the given item. | ||
* | ||
* @returns Returns the index of the item | ||
*/ | ||
indexOf(item: object|null): any; | ||
|
||
/** | ||
* Selects the given value. | ||
* | ||
* @param value the value to select. | ||
*/ | ||
select(value: string|number): void; | ||
|
||
/** | ||
* Selects the previous item. | ||
*/ | ||
selectPrevious(): void; | ||
|
||
/** | ||
* Selects the next item. | ||
*/ | ||
selectNext(): void; | ||
|
||
/** | ||
* Selects the item at the given index. | ||
*/ | ||
selectIndex(index: any): void; | ||
|
||
/** | ||
* Force a synchronous update of the `items` property. | ||
* | ||
* NOTE: Consider listening for the `iron-items-changed` event to respond to | ||
* updates to the set of selectable items after updates to the DOM list and | ||
* selection state have been made. | ||
* | ||
* WARNING: If you are using this method, you should probably consider an | ||
* alternate approach. Synchronously querying for items is potentially | ||
* slow for many use cases. The `items` property will update asynchronously | ||
* on its own to reflect selectable items in the DOM. | ||
*/ | ||
forceSynchronousItemUpdate(): void; | ||
_checkFallback(): void; | ||
_addListener(eventName: any): void; | ||
_removeListener(eventName: any): void; | ||
_activateEventChanged(eventName: any, old: any): void; | ||
_updateItems(): void; | ||
_updateAttrForSelected(): void; | ||
_updateSelected(): void; | ||
_selectSelected(selected: any): void; | ||
_filterItem(node: any): any; | ||
_valueToItem(value: any): any; | ||
_valueToIndex(value: any): any; | ||
_indexToValue(index: any): any; | ||
_valueForItem(item: any): any; | ||
_applySelection(item: any, isSelected: any): void; | ||
_selectionChange(): void; | ||
|
||
/** | ||
* observe items change under the given node. | ||
*/ | ||
_observeItems(node: any): any; | ||
_activateHandler(e: any): void; | ||
_itemActivate(value: any, item: any): void; | ||
} | ||
|
||
const IronSelectableBehavior: object; | ||
} |
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,60 @@ | ||
declare namespace Polymer { | ||
|
||
class IronSelection { | ||
constructor(selectCallback: Function); | ||
|
||
/** | ||
* If true, multiple selections are allowed. | ||
*/ | ||
multi: boolean; | ||
|
||
/** | ||
* Retrieves the selected item(s). | ||
* | ||
* @returns Returns the selected item(s). If the multi property is true, | ||
* `get` will return an array, otherwise it will return | ||
* the selected item or undefined if there is no selection. | ||
*/ | ||
get(): any|any[]|undefined; | ||
|
||
/** | ||
* Clears all the selection except the ones indicated. | ||
* | ||
* @param excludes items to be excluded. | ||
*/ | ||
clear(excludes: any[]|null): void; | ||
|
||
/** | ||
* Indicates if a given item is selected. | ||
* | ||
* @param item The item whose selection state should be checked. | ||
* @returns Returns true if `item` is selected. | ||
*/ | ||
isSelected(item: any): boolean; | ||
|
||
/** | ||
* Sets the selection state for a given item to either selected or | ||
* deselected. | ||
* | ||
* @param item The item to select. | ||
* @param isSelected True for selected, false for deselected. | ||
*/ | ||
setItemSelected(item: any, isSelected: boolean): void; | ||
|
||
/** | ||
* Sets the selection state for a given item. If the `multi` property | ||
* is true, then the selected state of `item` will be toggled; otherwise | ||
* the `item` will be selected. | ||
* | ||
* @param item The item to select. | ||
*/ | ||
select(item: any): void; | ||
|
||
/** | ||
* Toggles the selection state for `item`. | ||
* | ||
* @param item The item to toggle. | ||
*/ | ||
toggle(item: any): void; | ||
} | ||
} |
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,13 @@ | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file was automatically generated by | ||
* https://github.com/Polymer/gen-typescript-declarations | ||
* | ||
* To modify these typings, edit the source file(s): | ||
* iron-selection.html | ||
*/ | ||
|
||
/// <reference path="../polymer/types/polymer.d.ts" /> | ||
/// <reference path="iron-selection-extra.d.ts" /> | ||
|
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,19 @@ | ||
/** | ||
* DO NOT EDIT | ||
* | ||
* This file was automatically generated by | ||
* https://github.com/Polymer/gen-typescript-declarations | ||
* | ||
* To modify these typings, edit the source file(s): | ||
* iron-selector.html | ||
*/ | ||
|
||
/// <reference path="../polymer/types/polymer.d.ts" /> | ||
/// <reference path="iron-multi-selectable.d.ts" /> | ||
|
||
interface IronSelectorElement extends Polymer.Element, Polymer.IronMultiSelectableBehavior { | ||
} | ||
|
||
interface HTMLElementTagNameMap { | ||
"iron-selector": IronSelectorElement; | ||
} |
Oops, something went wrong.