-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5653 from Polymer/remove-gen-tsd
Remove automatic TypeScript type generation
- Loading branch information
Showing
52 changed files
with
6,083 additions
and
560 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
This file was deleted.
Oops, something went wrong.
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,213 @@ | ||
// tslint:disable:variable-name Describing an API that's defined elsewhere. | ||
// tslint:disable:no-any describes the API as best we are able today | ||
|
||
import {PolymerElement} from '../../polymer-element.js'; | ||
|
||
import {dedupingMixin} from '../utils/mixin.js'; | ||
|
||
import {calculateSplices} from '../utils/array-splice.js'; | ||
|
||
import {ElementMixin} from '../mixins/element-mixin.js'; | ||
|
||
|
||
/** | ||
* 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. | ||
*/ | ||
declare function ArraySelectorMixin<T extends new (...args: any[]) => {}>(base: T): T & ArraySelectorMixinConstructor & ElementMixinConstructor & PropertyEffectsConstructor & TemplateStampConstructor & PropertyAccessorsConstructor & PropertiesChangedConstructor & PropertiesMixinConstructor; | ||
|
||
import {ElementMixinConstructor} from '../mixins/element-mixin.js'; | ||
|
||
import {PropertyEffectsConstructor, PropertyEffects} from '../mixins/property-effects.js'; | ||
|
||
import {TemplateStampConstructor, TemplateStamp} from '../mixins/template-stamp.js'; | ||
|
||
import {PropertyAccessorsConstructor, PropertyAccessors} from '../mixins/property-accessors.js'; | ||
|
||
import {PropertiesChangedConstructor, PropertiesChanged} from '../mixins/properties-changed.js'; | ||
|
||
import {PropertiesMixinConstructor, PropertiesMixin} from '../mixins/properties-mixin.js'; | ||
|
||
interface ArraySelectorMixinConstructor { | ||
new(...args: any[]): ArraySelectorMixin; | ||
} | ||
|
||
export {ArraySelectorMixinConstructor}; | ||
|
||
interface ArraySelectorMixin extends ElementMixin, PropertyEffects, TemplateStamp, PropertyAccessors, PropertiesChanged, PropertiesMixin { | ||
|
||
/** | ||
* An array containing items from which selection will be made. | ||
*/ | ||
items: any[]|null|undefined; | ||
|
||
/** | ||
* 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|null|undefined; | ||
|
||
/** | ||
* 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|null|undefined; | ||
|
||
/** | ||
* Clears the selection state. | ||
*/ | ||
clearSelection(): void; | ||
|
||
/** | ||
* 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; | ||
|
||
/** | ||
* Deselects the given index if it is already selected. | ||
* | ||
* @param idx Index from `items` array to deselect | ||
*/ | ||
deselectIndex(idx: number): void; | ||
|
||
/** | ||
* 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; | ||
|
||
/** | ||
* 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; | ||
} | ||
|
||
export {ArraySelectorMixin}; | ||
|
||
/** | ||
* Element implementing the `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: | ||
* | ||
* ```js | ||
* import {PolymerElement} from '@polymer/polymer'; | ||
* import '@polymer/polymer/lib/elements/array-selector.js'; | ||
* | ||
* class EmployeeList extends PolymerElement { | ||
* static get _template() { | ||
* return html` | ||
* <div> Employee list: </div> | ||
* <dom-repeat id="employeeList" items="{{employees}}"> | ||
* <template> | ||
* <div>First name: <span>{{item.first}}</span></div> | ||
* <div>Last name: <span>{{item.last}}</span></div> | ||
* <button on-click="toggleSelection">Select</button> | ||
* </template> | ||
* </dom-repeat> | ||
* | ||
* <array-selector id="selector" | ||
* items="{{employees}}" | ||
* selected="{{selected}}" | ||
* multi toggle></array-selector> | ||
* | ||
* <div> Selected employees: </div> | ||
* <dom-repeat items="{{selected}}"> | ||
* <template> | ||
* <div>First name: <span>{{item.first}}</span></div> | ||
* <div>Last name: <span>{{item.last}}</span></div> | ||
* </template> | ||
* </dom-repeat>`; | ||
* } | ||
* static get is() { return 'employee-list'; } | ||
* static get properties() { | ||
* return { | ||
* employees: { | ||
* value() { | ||
* return [ | ||
* {first: 'Bob', last: 'Smith'}, | ||
* {first: 'Sally', last: 'Johnson'}, | ||
* ... | ||
* ]; | ||
* } | ||
* } | ||
* }; | ||
* } | ||
* toggleSelection(e) { | ||
* const item = this.$.employeeList.itemForElement(e.target); | ||
* this.$.selector.select(item); | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
declare class ArraySelector extends | ||
ArraySelectorMixin( | ||
PolymerElement) { | ||
} | ||
|
||
declare global { | ||
|
||
interface HTMLElementTagNameMap { | ||
"array-selector": ArraySelector; | ||
} | ||
} | ||
|
||
export {ArraySelector}; |
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,65 @@ | ||
// tslint:disable:variable-name Describing an API that's defined elsewhere. | ||
|
||
import {cssFromModules} from '../utils/style-gather.js'; | ||
|
||
export {CustomStyle}; | ||
|
||
/** | ||
* 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: | ||
* | ||
* ```html | ||
* <!-- 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> | ||
* ``` | ||
*/ | ||
declare 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; | ||
} | ||
|
||
declare global { | ||
|
||
interface HTMLElementTagNameMap { | ||
"custom-style": CustomStyle; | ||
} | ||
} |
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,51 @@ | ||
// tslint:disable:variable-name Describing an API that's defined elsewhere. | ||
|
||
import {PropertyEffects} from '../mixins/property-effects.js'; | ||
|
||
import {OptionalMutableData} from '../mixins/mutable-data.js'; | ||
|
||
import {GestureEventListeners} from '../mixins/gesture-event-listeners.js'; | ||
|
||
import {hideElementsGlobally} from '../utils/hide-template-controls.js'; | ||
|
||
export {DomBind}; | ||
|
||
/** | ||
* 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. | ||
*/ | ||
declare class DomBind extends | ||
PropertyEffects( | ||
OptionalMutableData( | ||
GestureEventListeners( | ||
HTMLElement))) { | ||
|
||
/** | ||
* @param name Name of attribute that changed | ||
* @param old Old attribute value | ||
* @param value New attribute value | ||
* @param namespace Attribute namespace. | ||
*/ | ||
attributeChangedCallback(name: string, old: string|null, value: string|null, namespace: string|null): void; | ||
connectedCallback(): void; | ||
disconnectedCallback(): void; | ||
|
||
/** | ||
* Forces the element to render its content. This is typically only | ||
* necessary to call if HTMLImports with the async attribute are used. | ||
*/ | ||
render(): void; | ||
} | ||
|
||
declare global { | ||
|
||
interface HTMLElementTagNameMap { | ||
"dom-bind": DomBind; | ||
} | ||
} |
Oops, something went wrong.