Skip to content

Commit

Permalink
Add generated TypeScript declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
aomarks committed Dec 8, 2017
1 parent 1f9be78 commit 60450bf
Show file tree
Hide file tree
Showing 39 changed files with 4,282 additions and 0 deletions.
187 changes: 187 additions & 0 deletions types/lib/elements/array-selector.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/**
* 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
*/

/// <reference path="../../polymer-element.d.ts" />
/// <reference path="../utils/mixin.d.ts" />
/// <reference path="../utils/array-splice.d.ts" />

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<T extends new(...args: any[]) => {}>(base: T): {
new(...args: any[]): ArraySelectorMixin & Polymer.ElementMixin
} & T

interface ArraySelectorMixin {

/**
* 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;

/**
* 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;

/**
* Deselects the given item if it is already selected.
*
* @param item Item from `items` array to deselect
*/
deselect(item: any): void|null;

/**
* Deselects the given index if it is already selected.
*
* @param idx Index from `items` array to deselect
*/
deselectIndex(idx: number): void|null;

/**
* 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): void|null;

/**
* 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): void|null;
}

/**
* 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
* <dom-module id="employee-list">
*
* <template>
*
* <div> Employee list: </div>
* <template is="dom-repeat" id="employeeList" items="{{employees}}">
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* <button on-click="toggleSelection">Select</button>
* </template>
*
* <array-selector id="selector" items="{{employees}}" selected="{{selected}}" multi toggle></array-selector>
*
* <div> Selected employees: </div>
* <template is="dom-repeat" items="{{selected}}">
* <div>First name: <span>{{item.first}}</span></div>
* <div>Last name: <span>{{item.last}}</span></div>
* </template>
*
* </template>
*
* </dom-module>
* ```
*
* ```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;
}
71 changes: 71 additions & 0 deletions types/lib/elements/custom-style.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* 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
*/

/// <reference path="../utils/style-gather.d.ts" />

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 `<custom-style>` 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 `<custom-style>`. Use the `html` selector
* to define custom properties that apply to all custom elements.
* - Custom mixins can be defined in a `<custom-style>`, 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 `<custom-style>` element in the main document, wrapping an inline `<style>` tag that
* contains the CSS rules you want to shim.
*
* For example:
*
* ```
* <!-- import apply shim--only required if using mixins -->
* <link rel="import href="bower_components/shadycss/apply-shim.html">
* <!-- import custom-style element -->
* <link rel="import" href="bower_components/polymer/lib/elements/custom-style.html">
* ...
* <custom-style>
* <style>
* html {
* --custom-color: blue;
* --custom-mixin: {
* font-weight: bold;
* color: red;
* };
* }
* </style>
* </custom-style>
* ```
*/
class CustomStyle extends HTMLElement {

/**
* Returns the light-DOM `<style>` child this element wraps. Upon first
* call any style modules referenced via the `include` attribute will be
* concatenated to this element's `<style>`.
*
* @returns This element's light-DOM `<style>`
*/
getStyle(): HTMLStyleElement|null;
}
}

interface HTMLElementTagNameMap {
"custom-style": Polymer.CustomStyle;
}
51 changes: 51 additions & 0 deletions types/lib/elements/dom-bind.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* 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/dom-bind.html
*/

/// <reference path="../utils/boot.d.ts" />
/// <reference path="../mixins/property-effects.d.ts" />
/// <reference path="../mixins/mutable-data.d.ts" />
/// <reference path="../mixins/gesture-event-listeners.d.ts" />

declare namespace Polymer {

/**
* Custom element to allow using Polymer's template features (data binding,
* declarative event listeners, etc.) in the main document without defining
* a new custom element.
*
* `<template>` tags utilizing bindings may be wrapped with the `<dom-bind>`
* element, which will immediately stamp the wrapped template into the main
* document and bind elements to the `dom-bind` element itself as the
* binding scope.
*/
class DomBind extends
Polymer.PropertyEffects(
Polymer.OptionalMutableData(
Polymer.GestureEventListeners(
Polymer.Element))) {

/**
* assumes only one observed attribute
*/
attributeChangedCallback(): any;
connectedCallback(): any;
disconnectedCallback(): any;

/**
* Forces the element to render its content. This is typically only
* necessary to call if HTMLImports with the async attribute are used.
*/
render(): void|null;
}
}

interface HTMLElementTagNameMap {
"dom-bind": Polymer.DomBind;
}
65 changes: 65 additions & 0 deletions types/lib/elements/dom-if.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* 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/dom-if.html
*/

/// <reference path="../../polymer-element.d.ts" />
/// <reference path="../utils/templatize.d.ts" />
/// <reference path="../utils/debounce.d.ts" />
/// <reference path="../utils/flush.d.ts" />

declare namespace Polymer {

/**
* The `<dom-if>` element will stamp a light-dom `<template>` child when
* the `if` property becomes truthy, and the template can use Polymer
* data-binding and declarative event features when used in the context of
* a Polymer element's template.
*
* When `if` becomes falsy, the stamped content is hidden but not
* removed from dom. When `if` subsequently becomes truthy again, the content
* is simply re-shown. This approach is used due to its favorable performance
* characteristics: the expense of creating template content is paid only
* once and lazily.
*
* Set the `restamp` property to true to force the stamped content to be
* created / destroyed when the `if` condition changes.
*/
class DomIf extends Polymer.Element {

/**
* A boolean indicating whether this template should stamp.
*/
if: boolean;

/**
* When true, elements will be removed from DOM and discarded when `if`
* becomes false and re-created and added back to the DOM when `if`
* becomes true. By default, stamped elements will be hidden but left
* in the DOM when `if` becomes false, which is generally results
* in better performance.
*/
restamp: boolean;
connectedCallback(): any;
disconnectedCallback(): any;

/**
* Forces the element to render its content. Normally rendering is
* asynchronous to a provoking change. This is done for efficiency so
* that multiple changes trigger only a single render. The render method
* should be called if, for example, template rendering is required to
* validate application state.
*/
render(): void|null;
_showHideChildren(): any;
}
}

interface HTMLElementTagNameMap {
"dom-if": Polymer.DomIf;
}
Loading

0 comments on commit 60450bf

Please sign in to comment.