UNPKG

@polymer/polymer

Version:

The Polymer library makes it easy to create your own web components. Give your element some markup and properties, and then use it on a site. Polymer provides features like dynamic templates and data binding to reduce the amount of boilerplate you need to

82 lines (73 loc) 2.49 kB
// tslint:disable:variable-name Describing an API that's defined elsewhere. // tslint:disable:no-any describes the API as best we are able today /** * Class representing a static string value which can be used to filter * strings by asseting that they have been created via this class. The * `value` property returns the string passed to the constructor. */ declare class LiteralString { value: string; constructor(string: any); /** * @returns LiteralString string value */ toString(): string; } export {html}; /** * A template literal tag that creates an HTML <template> element from the * contents of the string. * * This allows you to write a Polymer Template in JavaScript. * * Templates can be composed by interpolating `HTMLTemplateElement`s in * expressions in the JavaScript template literal. The nested template's * `innerHTML` is included in the containing template. The only other * values allowed in expressions are those returned from `htmlLiteral` * which ensures only literal values from JS source ever reach the HTML, to * guard against XSS risks. * * All other values are disallowed in expressions to help prevent XSS * attacks; however, `htmlLiteral` can be used to compose static * string values into templates. This is useful to compose strings into * places that do not accept html, like the css text of a `style` * element. * * Example: * * static get template() { * return html` * <style>:host{ content:"..." }</style> * <div class="shadowed">${this.partialTemplate}</div> * ${super.template} * `; * } * static get partialTemplate() { return html`<span>Partial!</span>`; } * * @returns Constructed HTMLTemplateElement */ declare function html(strings: TemplateStringsArray, ...values: any[]): HTMLTemplateElement; export {htmlLiteral}; /** * An html literal tag that can be used with `html` to compose. * a literal string. * * Example: * * static get template() { * return html` * <style> * :host { display: block; } * ${this.styleTemplate()} * </style> * <div class="shadowed">${staticValue}</div> * ${super.template} * `; * } * static get styleTemplate() { * return htmlLiteral`.shadowed { background: gray; }`; * } * * @returns Constructed literal string */ declare function htmlLiteral(strings: TemplateStringsArray, ...values: any[]): LiteralString;