UNPKG

4.57 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at
5 * http://polymer.github.io/LICENSE.txt
6 * The complete set of authors may be found at
7 * http://polymer.github.io/AUTHORS.txt
8 * The complete set of contributors may be found at
9 * http://polymer.github.io/CONTRIBUTORS.txt
10 * Code distributed by Google as part of the polymer project is also
11 * subject to an additional IP rights grant found at
12 * http://polymer.github.io/PATENTS.txt
13 */
14import { ShadyRenderOptions } from 'lit-html/lib/shady-render.js';
15import { PropertyValues, UpdatingElement } from './lib/updating-element.js';
16export * from './lib/updating-element.js';
17export * from './lib/decorators.js';
18export { html, svg, TemplateResult, SVGTemplateResult } from 'lit-html/lit-html.js';
19import { CSSResult } from './lib/css-tag.js';
20export * from './lib/css-tag.js';
21declare global {
22 interface Window {
23 litElementVersions: string[];
24 }
25}
26export interface CSSResultArray extends Array<CSSResult | CSSResultArray> {
27}
28export declare class LitElement extends UpdatingElement {
29 /**
30 * Ensure this class is marked as `finalized` as an optimization ensuring
31 * it will not needlessly try to `finalize`.
32 *
33 * Note this property name is a string to prevent breaking Closure JS Compiler
34 * optimizations. See updating-element.ts for more information.
35 */
36 protected static ['finalized']: boolean;
37 /**
38 * Render method used to render the value to the element's DOM.
39 * @param result The value to render.
40 * @param container Node into which to render.
41 * @param options Element name.
42 * @nocollapse
43 */
44 static render: (result: unknown, container: Element | DocumentFragment, options: ShadyRenderOptions) => void;
45 /**
46 * Array of styles to apply to the element. The styles should be defined
47 * using the `css` tag function.
48 */
49 static styles?: CSSResult | CSSResultArray;
50 private static _styles;
51 /**
52 * Return the array of styles to apply to the element.
53 * Override this method to integrate into a style management system.
54 *
55 * @nocollapse
56 */
57 static getStyles(): CSSResult | CSSResultArray | undefined;
58 /** @nocollapse */
59 private static _getUniqueStyles;
60 private _needsShimAdoptedStyleSheets?;
61 /**
62 * Node or ShadowRoot into which element DOM should be rendered. Defaults
63 * to an open shadowRoot.
64 */
65 readonly renderRoot: Element | DocumentFragment;
66 /**
67 * Performs element initialization. By default this calls `createRenderRoot`
68 * to create the element `renderRoot` node and captures any pre-set values for
69 * registered properties.
70 */
71 protected initialize(): void;
72 /**
73 * Returns the node into which the element should render and by default
74 * creates and returns an open shadowRoot. Implement to customize where the
75 * element's DOM is rendered. For example, to render into the element's
76 * childNodes, return `this`.
77 * @returns {Element|DocumentFragment} Returns a node into which to render.
78 */
79 protected createRenderRoot(): Element | ShadowRoot;
80 /**
81 * Applies styling to the element shadowRoot using the `static get styles`
82 * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where
83 * available and will fallback otherwise. When Shadow DOM is polyfilled,
84 * ShadyCSS scopes styles and adds them to the document. When Shadow DOM
85 * is available but `adoptedStyleSheets` is not, styles are appended to the
86 * end of the `shadowRoot` to [mimic spec
87 * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).
88 */
89 protected adoptStyles(): void;
90 connectedCallback(): void;
91 /**
92 * Updates the element. This method reflects property values to attributes
93 * and calls `render` to render DOM via lit-html. Setting properties inside
94 * this method will *not* trigger another update.
95 * @param _changedProperties Map of changed properties with old values
96 */
97 protected update(changedProperties: PropertyValues): void;
98 /**
99 * Invoked on each update to perform rendering tasks. This method may return
100 * any value renderable by lit-html's NodePart - typically a TemplateResult.
101 * Setting properties inside this method will *not* trigger the element to
102 * update.
103 */
104 protected render(): unknown;
105}
106//# sourceMappingURL=lit-element.d.ts.map
\No newline at end of file