1 | // tslint:disable:variable-name Describing an API that's defined elsewhere.
|
2 | // tslint:disable:no-any describes the API as best we are able today
|
3 |
|
4 | /**
|
5 | * Class representing a static string value which can be used to filter
|
6 | * strings by asseting that they have been created via this class. The
|
7 | * `value` property returns the string passed to the constructor.
|
8 | */
|
9 | declare class LiteralString {
|
10 | value: string;
|
11 | constructor(string: any);
|
12 |
|
13 | /**
|
14 | * @returns LiteralString string value
|
15 | */
|
16 | toString(): string;
|
17 | }
|
18 |
|
19 | export {html};
|
20 |
|
21 |
|
22 | /**
|
23 | * A template literal tag that creates an HTML <template> element from the
|
24 | * contents of the string.
|
25 | *
|
26 | * This allows you to write a Polymer Template in JavaScript.
|
27 | *
|
28 | * Templates can be composed by interpolating `HTMLTemplateElement`s in
|
29 | * expressions in the JavaScript template literal. The nested template's
|
30 | * `innerHTML` is included in the containing template. The only other
|
31 | * values allowed in expressions are those returned from `htmlLiteral`
|
32 | * which ensures only literal values from JS source ever reach the HTML, to
|
33 | * guard against XSS risks.
|
34 | *
|
35 | * All other values are disallowed in expressions to help prevent XSS
|
36 | * attacks; however, `htmlLiteral` can be used to compose static
|
37 | * string values into templates. This is useful to compose strings into
|
38 | * places that do not accept html, like the css text of a `style`
|
39 | * element.
|
40 | *
|
41 | * Example:
|
42 | *
|
43 | * static get template() {
|
44 | * return html`
|
45 | * <style>:host{ content:"..." }</style>
|
46 | * <div class="shadowed">${this.partialTemplate}</div>
|
47 | * ${super.template}
|
48 | * `;
|
49 | * }
|
50 | * static get partialTemplate() { return html`<span>Partial!</span>`; }
|
51 | *
|
52 | * @returns Constructed HTMLTemplateElement
|
53 | */
|
54 | declare function html(strings: TemplateStringsArray, ...values: any[]): HTMLTemplateElement;
|
55 |
|
56 | export {htmlLiteral};
|
57 |
|
58 |
|
59 | /**
|
60 | * An html literal tag that can be used with `html` to compose.
|
61 | * a literal string.
|
62 | *
|
63 | * Example:
|
64 | *
|
65 | * static get template() {
|
66 | * return html`
|
67 | * <style>
|
68 | * :host { display: block; }
|
69 | * ${this.styleTemplate()}
|
70 | * </style>
|
71 | * <div class="shadowed">${staticValue}</div>
|
72 | * ${super.template}
|
73 | * `;
|
74 | * }
|
75 | * static get styleTemplate() {
|
76 | * return htmlLiteral`.shadowed { background: gray; }`;
|
77 | * }
|
78 | *
|
79 | * @returns Constructed literal string
|
80 | */
|
81 | declare function htmlLiteral(strings: TemplateStringsArray, ...values: any[]): LiteralString;
|