diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index d288dfcde5..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/* -bower_components/* diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..4046195b53 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Code owners for Polymer +* @sorvell @kevinpschaaf @TimvdLippe @azakus \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index dcdd713500..8d68054f92 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,6 +1,6 @@ @@ -9,8 +9,11 @@ If you are asking a question rather than filing a bug, try one of these instead: #### Live Demo - -http://jsbin.com/luhaxab/1/edit + +https://jsbin.com/luhaxab/1/edit + +https://glitch.com/edit/#!/polymer-repro?path=my-element.html:2:0 + #### Steps to Reproduce + + + + + @@ -129,6 +147,20 @@ }); }); + test('shouldPropertiesChange', function(done) { + const el = document.createElement('should-properties-change'); + document.body.appendChild(el); + assert.isTrue(el._propertiesChanged.calledOnce); + el._invalidateProperties(); + setTimeout(function() { + assert.isTrue(el._propertiesChanged.calledTwice); + el._setProperty('foo', true); + setTimeout(function() { + assert.isTrue(el._propertiesChanged.calledThrice); + done(); + }); + }); + }); }); diff --git a/test/unit/property-effects-elements.html b/test/unit/property-effects-elements.html index 1a52caf3c7..aeeee70e43 100644 --- a/test/unit/property-effects-elements.html +++ b/test/unit/property-effects-elements.html @@ -1038,4 +1038,27 @@ this.xChanged = sinon.spy(); } }); - \ No newline at end of file + + + diff --git a/test/unit/property-effects.html b/test/unit/property-effects.html index 3e18d333af..2a7581fbb5 100644 --- a/test/unit/property-effects.html +++ b/test/unit/property-effects.html @@ -409,6 +409,16 @@ } }); + suite('observer inheritance', function() { + setup(function() { + el = document.createElement('sub-observer-element'); + document.body.appendChild(el); + }); + + test('does not invoke observer twice', function() { + assert.equal(el.__observerCalled, 1); + }); + }); }); suite('computed bindings with dynamic functions', function() { diff --git a/test/unit/resolveurl.html b/test/unit/resolveurl.html index 8b08f692d3..703e20c13d 100644 --- a/test/unit/resolveurl.html +++ b/test/unit/resolveurl.html @@ -55,19 +55,25 @@ test('Urls in styles and attributes', function() { var el = document.createElement('p-r'); document.body.appendChild(el); - var rx = /sub\/foo\.z/; + var resolvedUrl = /sub\/foo\.z/; + var styleHashUrl = /url\('#bar'\)/; + var styleAbsUrl = /url\('\/zot'\)/; var style = el.shadowRoot.querySelector('style') || document.querySelector('style[scope=p-r]'); - assert.match(style.textContent, rx, 'url not relative to main document'); - assert.match(el.$.div.getAttribute('style'), rx, 'style url not relative to main document'); - assert.match(el.$.img.src, rx, 'src url not relative to main document'); - assert.match(el.$.a.href, rx, 'href url not relative to main document'); - assert.match(el.$.import.getAttribute('url'), rx, 'url url not relative to main document'); - assert.match(el.$.resolveUrl.getAttribute('url'), rx, 'url url not relative to main document'); - assert.notMatch(el.$.root.getAttribute('url'), rx, 'url url not relative to main document'); - assert.notMatch(el.$.rel.href, rx, 'relative href url not relative to main document'); + assert.match(style.textContent, resolvedUrl, 'url not relative to main document'); + assert.match(style.textContent, styleHashUrl, 'hash url incorrectly resolved'); + assert.match(style.textContent, styleAbsUrl, 'absolute url incorrectly resolved'); + assert.match(el.$.div.getAttribute('style'), resolvedUrl, 'style url not relative to main document'); + assert.match(el.$.img.src, resolvedUrl, 'src url not relative to main document'); + assert.match(el.$.a.href, resolvedUrl, 'href url not relative to main document'); + assert.match(el.$.import.getAttribute('url'), resolvedUrl, 'url url not relative to main document'); + assert.match(el.$.resolveUrl.getAttribute('url'), resolvedUrl, 'url url not relative to main document'); + assert.equal(el.$.resolveUrlHash.getAttribute('url'), '#foo', 'url url not relative to main document'); + assert.equal(el.$.resolveUrlAbs.getAttribute('url'), '/foo', 'url url not relative to main document'); + assert.notMatch(el.$.root.getAttribute('url'), resolvedUrl, 'url url not relative to main document'); + assert.notMatch(el.$.rel.href, resolvedUrl, 'relative href url not relative to main document'); assert.match(el.$.rel.href, /\?123$/, 'relative href does not preserve query string'); assert.equal(el.$.action.getAttribute('action'), 'foo.z', 'action attribute relativized for incorrect element type'); - assert.match(el.$.formAction.action, rx, 'action attribute relativized for incorrect element type'); + assert.match(el.$.formAction.action, resolvedUrl, 'action attribute relativized for incorrect element type'); assert.equal(el.$.hash.getAttribute('href'), '#foo.z', 'hash-only url should not be resolved'); assert.equal(el.$.absolute.getAttribute('href'), '/foo.z', 'absolute urls should not be resolved'); assert.equal(el.$.protocol.getAttribute('href'), 'data:foo.z', 'urls with other protocols should not be resolved'); diff --git a/test/unit/styling-cross-scope-apply.html b/test/unit/styling-cross-scope-apply.html index 9e4ec756e5..8cd5d27906 100644 --- a/test/unit/styling-cross-scope-apply.html +++ b/test/unit/styling-cross-scope-apply.html @@ -588,6 +588,11 @@ }); test('mixins apply to @keyframe rules', function(done) { + if (navigator.userAgent.match('Edge/16') && (!window.ShadyCSS || window.ShadyCSS.nativeCss)) { + // skip test due to missing variable support in keyframes + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12084341/ + this.skip(); + } var xKeyframes1 = styled.$.keyframes1; var xKeyframes2 = styled.$.keyframes2; var completed = 0; diff --git a/test/unit/styling-scoped.html b/test/unit/styling-scoped.html index 6e6d5c5edc..aefc3891f7 100644 --- a/test/unit/styling-scoped.html +++ b/test/unit/styling-scoped.html @@ -859,6 +859,11 @@ }); test('keyframes change scope', function(done) { + if (navigator.userAgent.match('Edge/16') && (!window.ShadyCSS || window.ShadyCSS.nativeCss)) { + // skip test due to missing variable support in keyframes + // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12084341/ + this.skip(); + } var xKeyframes = styled.$.keyframes; var onAnimationEnd = function() { diff --git a/test/unit/sub/resolveurl-elements.html b/test/unit/sub/resolveurl-elements.html index b0dc0c7324..de5017d7b1 100644 --- a/test/unit/sub/resolveurl-elements.html +++ b/test/unit/sub/resolveurl-elements.html @@ -13,6 +13,8 @@ @@ -20,6 +22,8 @@ Foo + + Foo Foo diff --git a/test/unit/templatize.html b/test/unit/templatize.html index df7be63f41..d825839a9b 100644 --- a/test/unit/templatize.html +++ b/test/unit/templatize.html @@ -18,6 +18,8 @@ + + diff --git a/types/extra-types.d.ts b/types/extra-types.d.ts new file mode 100644 index 0000000000..c4d38f5fb5 --- /dev/null +++ b/types/extra-types.d.ts @@ -0,0 +1,147 @@ +/** + * This file contains the types that are required for compilation of the + * Polymer generated type declarations, but which could not themselves be + * automatically generated. + */ + +// Types from "externs/polymer-externs.js" + +interface PolymerElementPropertiesMeta { + type?: Function; + value?: any; + readOnly?: boolean; + computed?: string; + reflectToAttribute?: boolean; + notify?: boolean; + observer?: string|((val: any, old: any) => void); +} + +type PolymerElementProperties = { + [key: string]: PolymerElementPropertiesMeta +}; + +// TODO Document these properties. +interface PolymerInit { + is: string; + extends?: string; + properties?: PolymerElementProperties; + observers?: string[]; + template?: HTMLTemplateElement|string; + hostAttributes?: {[key: string]: any}; + listeners?: {[key: string]: string}; +} + +// Types from "externs/polymer-internal-shared-types.js" + +interface StampedTemplate extends DocumentFragment { + __noInsertionPoint: boolean; + nodeList: Node[]; + $: {[key: string]: Node}; + templateInfo?: TemplateInfo; +} + +interface NodeInfo { + id: string; + events: {name: string, value: string}[]; + hasInsertionPoint: boolean; + templateInfo: TemplateInfo; + parentInfo: NodeInfo; + parentIndex: number; + infoIndex: number; + bindings: Binding[]; +} + +interface TemplateInfo { + nodeInfoList: NodeInfo[]; + nodeList: Node[]; + stripWhitespace: boolean; + hasInsertionPoint?: boolean; + hostProps: Object; + propertyEffects: Object; + nextTemplateInfo?: TemplateInfo; + previousTemplateInfo?: TemplateInfo; + childNodes: Node[]; + wasPreBound: boolean; +} + +interface LiteralBindingPart { + literal: string; + compoundIndex?: number; +} + +interface MethodArg { + literal: boolean; + name: string; + value: string|number; + rootProperty?: string; + structured?: boolean; + wildcard?: boolean; +} + +interface MethodSignature { + methodName: string; + static: boolean; + args: MethodArg[]; + dynamicFn?: boolean; +} + +interface ExpressionBindingPart { + mode: string; + negate: boolean; + source: string; + dependencies: Array; + customEvent: boolean; + signature: Object|null; + event: string; +} + +type BindingPart = LiteralBindingPart|ExpressionBindingPart; + +interface Binding { + kind: string; + target: string; + parts: BindingPart[]; + literal?: string; + isCompound: boolean; + listenerEvent?: string; + listenerNegate?: boolean; +} + +interface AsyncInterface { + run: (fn: Function, delay?: number) => number; + cancel: (handle: number) => void; +} + +// Types from "lib/utils/gestures.html" + +interface GestureRecognizer { + reset: () => void; + mousedown?: (e: MouseEvent) => void; + mousemove?: (e: MouseEvent) => void; + mouseup?: (e: MouseEvent) => void; + touchstart?: (e: TouchEvent) => void; + touchmove?: (e: TouchEvent) => void; + touchend?: (e: TouchEvent) => void; + click?: (e: MouseEvent) => void; +} + +/** + * Not defined in the TypeScript DOM library. + * See https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline + */ +interface IdleDeadline { + didTimeout: boolean; + timeRemaining(): number; +} + +/** + * Polymer defines its own `Element` class, shadowing the standard global + * `Element` class. This means that references to `Element` within the `Polymer` + * namespace inadvertently reference `Polymer.Element`. Here we define an alias + * of the global `Element`, so that we can reference it from declarations within + * the `Polymer` namespace. + * + * See https://github.com/Microsoft/TypeScript/issues/983 for general discussion + * of this shadowing problem in TypeScript. + */ +type _Element = Element; diff --git a/types/lib/elements/array-selector.d.ts b/types/lib/elements/array-selector.d.ts new file mode 100644 index 0000000000..1d99ee52e4 --- /dev/null +++ b/types/lib/elements/array-selector.d.ts @@ -0,0 +1,200 @@ +/** + * 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): T & ArraySelectorMixinConstructor & Polymer.ElementMixinConstructor & Polymer.PropertyEffectsConstructor & Polymer.TemplateStampConstructor & Polymer.PropertyAccessorsConstructor & Polymer.PropertiesChangedConstructor & Polymer.PropertiesMixinConstructor; + + interface ArraySelectorMixinConstructor { + new(...args: any[]): ArraySelectorMixin; + } + + interface ArraySelectorMixin { + + /** + * 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; + } + + /** + * 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 + * class EmployeeList extends Polymer.Element { + * static get is() { return 'employee-list'; } + * static get properties() { + * return { + * employees: { + * value() { + * return [ + * {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/types/lib/elements/custom-style.d.ts b/types/lib/elements/custom-style.d.ts new file mode 100644 index 0000000000..0ceeae111c --- /dev/null +++ b/types/lib/elements/custom-style.d.ts @@ -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 + */ + +/// + +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 ` + *
${this.partialTemplate}
+ * ${super.template} + * `; + * } + * static get partialTemplate() { return Polymer.html`Partial!`; } + * + * @returns Constructed HTMLTemplateElement + */ + function html(strings: TemplateStringsArray, ...values: any[]): HTMLTemplateElement; + + + /** + * An html literal tag that can be used with `Polymer.html` to compose. + * a literal string. + * + * Example: + * + * static get template() { + * return Polymer.html` + * + *
${staticValue}
+ * ${super.template} + * `; + * } + * static get styleTemplate() { return Polymer.htmlLiteral`.shadowed { background: gray; }`; } + * + * @returns Constructed literal string + */ + function htmlLiteral(strings: TemplateStringsArray, ...values: any[]): LiteralString; +} diff --git a/types/lib/utils/import-href.d.ts b/types/lib/utils/import-href.d.ts new file mode 100644 index 0000000000..16a0ae3e71 --- /dev/null +++ b/types/lib/utils/import-href.d.ts @@ -0,0 +1,27 @@ +/** + * 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/utils/import-href.html + */ + +/// + +declare namespace Polymer { + + + /** + * Convenience method for importing an HTML document imperatively. + * + * This method creates a new `` element with + * the provided URL and appends it to the document to start loading. + * In the `onload` callback, the `import` property of the `link` + * element will contain the imported document contents. + * + * @returns The link element for the URL to be loaded. + */ + function importHref(href: string, onload?: ((p0: Event) => void)|null, onerror?: ((p0: ErrorEvent) => void)|null, optAsync?: boolean): HTMLLinkElement; +} diff --git a/types/lib/utils/mixin.d.ts b/types/lib/utils/mixin.d.ts new file mode 100644 index 0000000000..a42c969c20 --- /dev/null +++ b/types/lib/utils/mixin.d.ts @@ -0,0 +1,22 @@ +/** + * 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/utils/mixin.html + */ + +/// + +declare namespace Polymer { + + + /** + * Wraps an ES6 class expression mixin such that the mixin is only applied + * if it has not already been applied its base argument. Also memoizes mixin + * applications. + */ + function dedupingMixin(mixin: T): T; +} diff --git a/types/lib/utils/path.d.ts b/types/lib/utils/path.d.ts new file mode 100644 index 0000000000..afcc5efbac --- /dev/null +++ b/types/lib/utils/path.d.ts @@ -0,0 +1,151 @@ +/** + * 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/utils/path.html + */ + +/// + +declare namespace Polymer { + + /** + * Module with utilities for manipulating structured data path strings. + */ + namespace Path { + + + /** + * Returns true if the given string is a structured data path (has dots). + * + * Example: + * + * ``` + * Polymer.Path.isPath('foo.bar.baz') // true + * Polymer.Path.isPath('foo') // false + * ``` + * + * @returns True if the string contained one or more dots + */ + function isPath(path: string): boolean; + + + /** + * Returns the root property name for the given path. + * + * Example: + * + * ``` + * Polymer.Path.root('foo.bar.baz') // 'foo' + * Polymer.Path.root('foo') // 'foo' + * ``` + * + * @returns Root property name + */ + function root(path: string): string; + + + /** + * Given `base` is `foo.bar`, `foo` is an ancestor, `foo.bar` is not + * Returns true if the given path is an ancestor of the base path. + * + * Example: + * + * ``` + * Polymer.Path.isAncestor('foo.bar', 'foo') // true + * Polymer.Path.isAncestor('foo.bar', 'foo.bar') // false + * Polymer.Path.isAncestor('foo.bar', 'foo.bar.baz') // false + * ``` + * + * @returns True if `path` is an ancestor of `base`. + */ + function isAncestor(base: string, path: string): boolean; + + + /** + * Given `base` is `foo.bar`, `foo.bar.baz` is an descendant + * + * Example: + * + * ``` + * Polymer.Path.isDescendant('foo.bar', 'foo.bar.baz') // true + * Polymer.Path.isDescendant('foo.bar', 'foo.bar') // false + * Polymer.Path.isDescendant('foo.bar', 'foo') // false + * ``` + * + * @returns True if `path` is a descendant of `base`. + */ + function isDescendant(base: string, path: string): boolean; + + + /** + * Replaces a previous base path with a new base path, preserving the + * remainder of the path. + * + * User must ensure `path` has a prefix of `base`. + * + * Example: + * + * ``` + * Polymer.Path.translate('foo.bar', 'zot', 'foo.bar.baz') // 'zot.baz' + * ``` + * + * @returns Translated string + */ + function translate(base: string, newBase: string, path: string): string; + + + /** + * Converts array-based paths to flattened path. String-based paths + * are returned as-is. + * + * Example: + * + * ``` + * Polymer.Path.normalize(['foo.bar', 0, 'baz']) // 'foo.bar.0.baz' + * Polymer.Path.normalize('foo.bar.0.baz') // 'foo.bar.0.baz' + * ``` + * + * @returns Flattened path + */ + function normalize(path: string|Array): string; + + + /** + * Splits a path into an array of property names. Accepts either arrays + * of path parts or strings. + * + * Example: + * + * ``` + * Polymer.Path.split(['foo.bar', 0, 'baz']) // ['foo', 'bar', '0', 'baz'] + * Polymer.Path.split('foo.bar.0.baz') // ['foo', 'bar', '0', 'baz'] + * ``` + * + * @returns Array of path parts + */ + function split(path: string|Array): string[]; + + + /** + * Reads a value from a path. If any sub-property in the path is `undefined`, + * this method returns `undefined` (will never throw. + * + * @returns Value at path, or `undefined` if the path could not be + * fully dereferenced. + */ + function get(root: object|null, path: string|Array, info?: object|null): any; + + + /** + * Sets a value to a path. If any sub-property in the path is `undefined`, + * this method will no-op. + * + * @returns The normalized version of the input path + */ + function set(root: object|null, path: string|Array, value: any): string|undefined; + } +} diff --git a/types/lib/utils/render-status.d.ts b/types/lib/utils/render-status.d.ts new file mode 100644 index 0000000000..5d4424fcb2 --- /dev/null +++ b/types/lib/utils/render-status.d.ts @@ -0,0 +1,45 @@ +/** + * 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/utils/render-status.html + */ + +/// + +declare namespace Polymer { + + /** + * Module for scheduling flushable pre-render and post-render tasks. + */ + namespace RenderStatus { + + + /** + * Enqueues a callback which will be run before the next render, at + * `requestAnimationFrame` timing. + * + * This method is useful for enqueuing work that requires DOM measurement, + * since measurement may not be reliable in custom element callbacks before + * the first render, as well as for batching measurement tasks in general. + * + * Tasks in this queue may be flushed by calling `Polymer.RenderStatus.flush()`. + */ + function beforeNextRender(context: any, callback: (...p0: any[]) => void, args?: any[]): void; + + + /** + * Enqueues a callback which will be run after the next render, equivalent + * to one task (`setTimeout`) after the next `requestAnimationFrame`. + * + * This method is useful for tuning the first-render performance of an + * element or application by deferring non-critical work until after the + * first paint. Typical non-render-critical work may include adding UI + * event listeners and aria attributes. + */ + function afterNextRender(context: any, callback: (...p0: any[]) => void, args?: any[]): void; + } +} diff --git a/types/lib/utils/resolve-url.d.ts b/types/lib/utils/resolve-url.d.ts new file mode 100644 index 0000000000..5aae176fff --- /dev/null +++ b/types/lib/utils/resolve-url.d.ts @@ -0,0 +1,50 @@ +/** + * 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/utils/resolve-url.html + */ + +/// + +declare namespace Polymer { + + /** + * Module with utilities for resolving relative URL's. + */ + namespace ResolveUrl { + + + /** + * Resolves the given URL against the provided `baseUri'. + * + * Note that this function performs no resolution for URLs that start + * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose + * URL resolution, use `window.URL`. + * + * @returns resolved URL + */ + function resolveUrl(url: string, baseURI?: string|null): string; + + + /** + * Resolves any relative URL's in the given CSS text against the provided + * `ownerDocument`'s `baseURI`. + * + * @returns Processed CSS text with resolved URL's + */ + function resolveCss(cssText: string, baseURI: string): string; + + + /** + * Returns a path from a given `url`. The path includes the trailing + * `/` from the url. + * + * @returns resolved path + */ + function pathFromUrl(url: string): string; + } +} diff --git a/types/lib/utils/settings.d.ts b/types/lib/utils/settings.d.ts new file mode 100644 index 0000000000..b2f90ffe76 --- /dev/null +++ b/types/lib/utils/settings.d.ts @@ -0,0 +1,40 @@ +/** + * 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/utils/settings.html + */ + +/// +/// + +declare namespace Polymer { + + /** + * Sets the global, legacy settings. + */ + namespace Settings { + } + + + /** + * Sets the global rootPath property used by `Polymer.ElementMixin` and + * available via `Polymer.rootPath`. + */ + function setRootPath(path: string): void; + + + /** + * Sets the global sanitizeDOMValue available via `Polymer.sanitizeDOMValue`. + */ + function setSanitizeDOMValue(newSanitizeDOMValue: ((p0: any, p1: string, p2: string, p3: Node|null) => any)|undefined): void; + + + /** + * Sets `passiveTouchGestures` globally for all elements using Polymer Gestures. + */ + function setPassiveTouchGestures(usePassive: boolean): void; +} diff --git a/types/lib/utils/style-gather.d.ts b/types/lib/utils/style-gather.d.ts new file mode 100644 index 0000000000..842a70d472 --- /dev/null +++ b/types/lib/utils/style-gather.d.ts @@ -0,0 +1,113 @@ +/** + * 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/utils/style-gather.html + */ + +/// + +declare namespace Polymer { + + /** + * Module with utilities for collection CSS text from ``, external + * stylesheets, and `dom-module`s. + */ + namespace StyleGather { + + + /** + * Returns a list of