diff --git a/lib/elements/array-selector.d.ts b/lib/elements/array-selector.d.ts new file mode 100644 index 0000000000..7151205058 --- /dev/null +++ b/lib/elements/array-selector.d.ts @@ -0,0 +1,190 @@ +/** + * 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): + * lib/elements/array-selector.html + */ + +/// +/// +/// + +declare namespace Polymer { + + /** + * Element mixin for recording dynamic associations between item paths in a + * master `items` array and a `selected` array such that path changes to the + * master array (at the host) element or elsewhere via data-binding) are + * correctly propagated to items in the selected array and vice-versa. + * + * The `items` property accepts an array of user data, and via the + * `select(item)` and `deselect(item)` API, updates the `selected` property + * which may be bound to other parts of the application, and any changes to + * sub-fields of `selected` item(s) will be kept in sync with items in the + * `items` array. When `multi` is false, `selected` is a property + * representing the last selected item. When `multi` is true, `selected` + * is an array of multiply selected items. + */ + function ArraySelectorMixin {}>(base: T): { + new(...args: any[]): { + + /** + * An array containing items from which selection will be made. + */ + items: any[]|null; + + /** + * When `true`, multiple items may be selected at once (in this case, + * `selected` is an array of currently selected items). When `false`, + * only one item may be selected at a time. + */ + multi: boolean; + + /** + * When `multi` is true, this is an array that contains any selected. + * When `multi` is false, this is the currently selected item, or `null` + * if no item is selected. + */ + selected: Object|Object[]|null; + + /** + * When `multi` is false, this is the currently selected item, or `null` + * if no item is selected. + */ + selectedItem: Object|null; + + /** + * When `true`, calling `select` on an item that is already selected + * will deselect the item. + */ + toggle: boolean; + __updateSelection(multi: any, itemsInfo: any): any; + __applySplices(splices: any): any; + __updateLinks(): any; + + /** + * Clears the selection state. + */ + clearSelection(): any; + + /** + * Returns whether the item is currently selected. + * + * @param item Item from `items` array to test + * @returns Whether the item is selected + */ + isSelected(item: any): boolean; + + /** + * Returns whether the item is currently selected. + * + * @param idx Index from `items` array to test + * @returns Whether the item is selected + */ + isIndexSelected(idx: number): boolean; + __deselectChangedIdx(idx: any): any; + __selectedIndexForItemIndex(idx: any): any; + + /** + * Deselects the given item if it is already selected. + * + * @param item Item from `items` array to deselect + */ + deselect(item: any): any; + + /** + * Deselects the given index if it is already selected. + * + * @param idx Index from `items` array to deselect + */ + deselectIndex(idx: number): any; + + /** + * Selects the given item. When `toggle` is true, this will automatically + * deselect the item if already selected. + * + * @param item Item from `items` array to select + */ + select(item: any): any; + + /** + * Selects the given index. When `toggle` is true, this will automatically + * deselect the item if already selected. + * + * @param idx Index from `items` array to select + */ + selectIndex(idx: number): any; + } + } & T + + /** + * Element implementing the `Polymer.ArraySelector` mixin, which records + * dynamic associations between item paths in a master `items` array and a + * `selected` array such that path changes to the master array (at the host) + * element or elsewhere via data-binding) are correctly propagated to items + * in the selected array and vice-versa. + * + * The `items` property accepts an array of user data, and via the + * `select(item)` and `deselect(item)` API, updates the `selected` property + * which may be bound to other parts of the application, and any changes to + * sub-fields of `selected` item(s) will be kept in sync with items in the + * `items` array. When `multi` is false, `selected` is a property + * representing the last selected item. When `multi` is true, `selected` + * is an array of multiply selected items. + * + * Example: + * + * ```html + * + * + * + * + * + * ``` + * + * ```js + * Polymer({ + * is: 'employee-list', + * ready() { + * this.employees = [ + * {first: 'Bob', last: 'Smith'}, + * {first: 'Sally', last: 'Johnson'}, + * ... + * ]; + * }, + * toggleSelection(e) { + * let item = this.$.employeeList.itemForElement(e.target); + * this.$.selector.select(item); + * } + * }); + * ``` + */ + class ArraySelector extends + Polymer.ArraySelectorMixin( + Polymer.Element) { + } +} + +interface HTMLElementTagNameMap { + "array-selector": Polymer.ArraySelector; +} diff --git a/lib/elements/custom-style.d.ts b/lib/elements/custom-style.d.ts new file mode 100644 index 0000000000..3b983a99ad --- /dev/null +++ b/lib/elements/custom-style.d.ts @@ -0,0 +1,72 @@ +/** + * 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): + * lib/elements/custom-style.html + */ + +/// +/// + +declare namespace Polymer { + + /** + * Custom element for defining styles in the main document that can take + * advantage of [shady DOM](https://github.com/webcomponents/shadycss) shims + * for style encapsulation, custom properties, and custom mixins. + * + * - Document styles defined in a `` are shimmed to ensure they + * do not leak into local DOM when running on browsers without native + * Shadow DOM. + * - Custom properties can be defined in a ``. Use the `html` selector + * to define custom properties that apply to all custom elements. + * - Custom mixins can be defined in a ``, if you import the optional + * [apply shim](https://github.com/webcomponents/shadycss#about-applyshim) + * (`shadycss/apply-shim.html`). + * + * To use: + * + * - Import `custom-style.html`. + * - Place a `` element in the main document, wrapping an inline ` + * + * ``` + */ + class CustomStyle extends HTMLElement { + + /** + * Returns the light-DOM `