lit-element
Advanced tools
+16
-0
@@ -16,2 +16,18 @@ # Change Log | ||
| <!-- ### Fixed --> | ||
| ## Unreleased | ||
| ## [2.1.0] - 2019-03-21 | ||
| ### Changed | ||
| * `LitElement.renderRoot` is now `public readonly` instead of `protected`. | ||
| ### Fixed | ||
| * Exceptions generated during update/render do not block subsequent updates ([#262](https://github.com/Polymer/lit-element/issues/262)). | ||
| * Initial update is scheduled at construction time rather than connected time ([#594](https://github.com/Polymer/lit-element/issues/594)). | ||
| * A reflecting property set immediately after a corresponding attribute | ||
| now reflects properly ([#592](https://github.com/Polymer/lit-element/issues/592)). | ||
| * Properties annotated with the `@query` and `@queryAll` decorators will now | ||
| survive property renaming optimizations when used with tsickle and Closure JS | ||
| Compiler. | ||
| ## [2.0.1] - 2019-02-05 | ||
@@ -18,0 +34,0 @@ ### Fixed |
+1
-1
@@ -17,3 +17,3 @@ /** | ||
| readonly styleSheet: CSSStyleSheet | null; | ||
| toString(): String; | ||
| toString(): string; | ||
| } | ||
@@ -20,0 +20,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"css-tag.js","sourceRoot":"","sources":["../src/lib/css-tag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;EASE;AAEF,MAAM,CAAC,MAAM,2BAA2B,GACpC,CAAC,oBAAoB,IAAI,QAAQ,CAAC,SAAS,CAAC;IAC5C,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;AAE3C,MAAM,iBAAiB,GAAG,MAAM,EAAE,CAAC;AAEnC,MAAM,OAAO,SAAS;IAKpB,YAAY,OAAe,EAAE,SAAiB;QAC5C,IAAI,SAAS,KAAK,iBAAiB,EAAE;YACnC,MAAM,IAAI,KAAK,CACX,mEAAmE,CAAC,CAAC;SAC1E;QACD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,oEAAoE;IACpE,wEAAwE;IACxE,IAAI,UAAU;QACZ,IAAI,IAAI,CAAC,WAAW,KAAK,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ved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\nexport const supportsAdoptingStyleSheets =\n ('adoptedStyleSheets' in Document.prototype) &&\n ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n _styleSheet?: CSSStyleSheet|null;\n\n readonly cssText: string;\n\n constructor(cssText: string, safeToken: symbol) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n this.cssText = cssText;\n }\n\n // Note, this is a getter so that it's lazy. In practice, this means\n // stylesheets are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet|null {\n if (this._styleSheet === undefined) {\n // Note, if `adoptedStyleSheets` is supported then we assume CSSStyleSheet\n // is constructable.\n if (supportsAdoptingStyleSheets) {\n this._styleSheet = new CSSStyleSheet();\n this._styleSheet.replaceSync(this.cssText);\n } else {\n this._styleSheet = null;\n }\n }\n return this._styleSheet;\n }\n\n toString(): String {\n return this.cssText;\n }\n}\n\n/**\n * Wrap a value for interpolation in a css tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult) => {\n if (value instanceof CSSResult) {\n return value.cssText;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ${\n value}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`);\n }\n};\n\n/**\n * Template tag which which can be used with LitElement's `style` property to\n * set element styles. For security reasons, only literal string values may be\n * used. To incorporate non-literal values `unsafeCSS` may be used inside a\n * template string part.\n */\nexport const css = (strings: TemplateStringsArray, ...values: CSSResult[]) => {\n const cssText = values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]);\n return new CSSResult(cssText, constructionToken);\n};\n"]} | ||
| {"version":3,"file":"css-tag.js","sourceRoot":"","sources":["../src/lib/css-tag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;EASE;AAEF,MAAM,CAAC,MAAM,2BAA2B,GACpC,CAAC,oBAAoB,IAAI,QAAQ,CAAC,SAAS,CAAC;IAC5C,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;AAE3C,MAAM,iBAAiB,GAAG,MAAM,EAAE,CAAC;AAEnC,MAAM,OAAO,SAAS;IAKpB,YAAY,OAAe,EAAE,SAAiB;QAC5C,IAAI,SAAS,KAAK,iBAAiB,EAAE;YACnC,MAAM,IAAI,KAAK,CACX,mEAAmE,CAAC,CAAC;SAC1E;QACD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,oEAAoE;IACpE,wEAAwE;IACxE,IAAI,UAAU;QACZ,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE;YAClC,0EAA0E;YAC1E,oBAAoB;YACpB,IAAI,2BAA2B,EAAE;gBAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,aAAa,EAAE,CAAC;gBACvC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAC5C;iBAAM;gBACL,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;aACzB;SACF;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAE,EAAE;IAC1C,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,KAAgB,EAAE,EAAE;IAC7C,IAAI,KAAK,YAAY,SAAS,EAAE;QAC9B,OAAO,KAAK,CAAC,OAAO,CAAC;KACtB;SAAM;QACL,MAAM,IAAI,KAAK,CACX,mEACI,KAAK;+CAC8B,CAAC,CAAC;KAC9C;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,OAA6B,EAAE,GAAG,MAAmB,EAAE,EAAE;IAC3E,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CACzB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,EAC9D,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAChB,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACnD,CAAC,CAAC","sourcesContent":["/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\nexport const supportsAdoptingStyleSheets =\n ('adoptedStyleSheets' in Document.prototype) &&\n ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n _styleSheet?: CSSStyleSheet|null;\n\n readonly cssText: string;\n\n constructor(cssText: string, safeToken: symbol) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n this.cssText = cssText;\n }\n\n // Note, this is a getter so that it's lazy. In practice, this means\n // stylesheets are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet|null {\n if (this._styleSheet === undefined) {\n // Note, if `adoptedStyleSheets` is supported then we assume CSSStyleSheet\n // is constructable.\n if (supportsAdoptingStyleSheets) {\n this._styleSheet = new CSSStyleSheet();\n this._styleSheet.replaceSync(this.cssText);\n } else {\n this._styleSheet = null;\n }\n }\n return this._styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\n/**\n * Wrap a value for interpolation in a css tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult) => {\n if (value instanceof CSSResult) {\n return value.cssText;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ${\n value}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`);\n }\n};\n\n/**\n * Template tag which which can be used with LitElement's `style` property to\n * set element styles. For security reasons, only literal string values may be\n * used. To incorporate non-literal values `unsafeCSS` may be used inside a\n * template string part.\n */\nexport const css = (strings: TemplateStringsArray, ...values: CSSResult[]) => {\n const cssText = values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]);\n return new CSSResult(cssText, constructionToken);\n};\n"]} |
@@ -49,9 +49,13 @@ /** | ||
| * executes a querySelector on the element's renderRoot. | ||
| * | ||
| * @ExportDecoratedItems | ||
| */ | ||
| export declare const query: (selector: string) => (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; | ||
| export declare function query(selector: string): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; | ||
| /** | ||
| * A property decorator that converts a class property into a getter | ||
| * that executes a querySelectorAll on the element's renderRoot. | ||
| * | ||
| * @ExportDecoratedItems | ||
| */ | ||
| export declare const queryAll: (selector: string) => (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; | ||
| export declare function queryAll(selector: string): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; | ||
| /** | ||
@@ -58,0 +62,0 @@ * Adds event listener options to a method used as an event listener in a |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/lib/decorators.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAC,mBAAmB,EAAkB,MAAM,uBAAuB,CAAC;AAE3E,oBAAY,WAAW,CAAC,CAAC,IAAI;IAC3B,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAAA;CAC5B,CAAC;AAGF,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;CACrE;AAGD,UAAU,YAAY;IACpB,IAAI,EAAE,OAAO,GAAC,QAAQ,CAAC;IACvB,GAAG,EAAE,WAAW,CAAC;IACjB,SAAS,EAAE,QAAQ,GAAC,WAAW,GAAC,KAAK,CAAC;IACtC,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACpE,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC;AA2BD;;;;GAIG;AACH,eAAO,MAAM,aAAa,6FAK8C,CAAC;AAoDzE;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,kGAMrD;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,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AerC;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,kGAexC;AAgCD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,2CAWd,CAAC"} |
+31
-21
@@ -103,28 +103,29 @@ /** | ||
| * executes a querySelector on the element's renderRoot. | ||
| * | ||
| * @ExportDecoratedItems | ||
| */ | ||
| export const query = _query((target, selector) => target.querySelector(selector)); | ||
| export function query(selector) { | ||
| return (protoOrDescriptor, | ||
| // tslint:disable-next-line:no-any decorator | ||
| name) => { | ||
| const descriptor = { | ||
| get() { | ||
| return this.renderRoot.querySelector(selector); | ||
| }, | ||
| enumerable: true, | ||
| configurable: true, | ||
| }; | ||
| return (name !== undefined) ? | ||
| legacyQuery(descriptor, protoOrDescriptor, name) : | ||
| standardQuery(descriptor, protoOrDescriptor); | ||
| }; | ||
| } | ||
| /** | ||
| * A property decorator that converts a class property into a getter | ||
| * that executes a querySelectorAll on the element's renderRoot. | ||
| */ | ||
| export const queryAll = _query((target, selector) => target.querySelectorAll(selector)); | ||
| const legacyQuery = (descriptor, proto, name) => { | ||
| Object.defineProperty(proto, name, descriptor); | ||
| }; | ||
| const standardQuery = (descriptor, element) => ({ | ||
| kind: 'method', | ||
| placement: 'prototype', | ||
| key: element.key, | ||
| descriptor, | ||
| }); | ||
| /** | ||
| * Base-implementation of `@query` and `@queryAll` decorators. | ||
| * | ||
| * @param queryFn exectute a `selector` (ie, querySelector or querySelectorAll) | ||
| * against `target`. | ||
| * @suppress {visibility} The descriptor accesses an internal field on the | ||
| * element. | ||
| * @ExportDecoratedItems | ||
| */ | ||
| function _query(queryFn) { | ||
| return (selector) => (protoOrDescriptor, | ||
| export function queryAll(selector) { | ||
| return (protoOrDescriptor, | ||
| // tslint:disable-next-line:no-any decorator | ||
@@ -134,3 +135,3 @@ name) => { | ||
| get() { | ||
| return queryFn(this.renderRoot, selector); | ||
| return this.renderRoot.querySelectorAll(selector); | ||
| }, | ||
@@ -145,2 +146,11 @@ enumerable: true, | ||
| } | ||
| const legacyQuery = (descriptor, proto, name) => { | ||
| Object.defineProperty(proto, name, descriptor); | ||
| }; | ||
| const standardQuery = (descriptor, element) => ({ | ||
| kind: 'method', | ||
| placement: 'prototype', | ||
| key: element.key, | ||
| descriptor, | ||
| }); | ||
| const standardEventOptions = (options, element) => { | ||
@@ -147,0 +157,0 @@ return Object.assign({}, element, { finisher(clazz) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/lib/decorators.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AA4BH,MAAM,mBAAmB,GACrB,CAAC,OAAe,EAAE,KAA+B,EAAE,EAAE;IACnD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,sEAAsE;IACtE,wDAAwD;IACxD,8CAA8C;IAC9C,sEAAsE;IACtE,+BAA+B;IAC/B,kCAAkC;IAClC,OAAO,KAAY,CAAC;AACtB,CAAC,CAAC;AAEN,MAAM,qBAAqB,GACvB,CAAC,OAAe,EAAE,UAA2B,EAAE,EAAE;IAC/C,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,UAAU,CAAC;IACpC,OAAO;QACL,IAAI;QACJ,QAAQ;QACR,oEAAoE;QACpE,QAAQ,CAAC,KAA+B;YACtC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEN;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE,CAC7C,CAAC,iBAA2D,EAAE,EAAE,CAC5D,CAAC,OAAO,iBAAiB,KAAK,UAAU,CAAC,CAAC,CAAC;IAC/C,mBAAmB,CACf,OAAO,EAAE,iBAA6C,CAAC,CAAC,CAAC;IAC7D,qBAAqB,CAAC,OAAO,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I;YAChB,YAAY,EAAE,IAAI;SACnB,CAAC;QACF,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;YACzB,WAAW,CAAC,UAAU,EAAE,iBAA2B,EAAE,IAAI,CAAC,CAAC,CAAC;YAC5D,aAAa,CAAC,UAAU,EAAE,iBAAiC,CAAC,CAAC;IACnE,CAAC,CAAC;AACf,CAAC;AAED,MAAM,oBAAoB,GACtB,CAAC,OAAgC,EAAE,OAAqB,EAAE,EAAE;IAC1D,yBACK,OAAO,IACV,QAAQ,CAAC,KAA6B;YACpC,MAAM,CAAC,MAAM,CACT,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAA4B,CAAC,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC,IACD;AACJ,CAAC,CAAC;AAEN,MAAM,kBAAkB;AACpB,mDAAmD;AACnD,CAAC,OAAgC,EAAE,KAAU,EAAE,IAAiB,EAAE,EAAE;IAClE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAgC,EAAE,EAAE;AAC7D,wEAAwE;AACxE,4EAA4E;AAC5E,YAAY;AACZ,2EAA2E;AAC3E,aAAa;AACb,CAAC,CAAC,iBAAsC,EAAE,IAAa,EAAE,EAAE,CACtD,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;IACtB,kBAAkB,CAAC,OAAO,EAAE,iBAA2B,EAAE,IAAI,CAAC,CAAC,CAAC;IAChE,oBAAoB,CAAC,OAAO,EAAE,iBAAiC,CAAC,CAE9D,CAAC","sourcesContent":["\n/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {LitElement} from '../lit-element.js';\n\nimport {PropertyDeclaration, UpdatingElement} from './updating-element.js';\n\nexport type Constructor<T> = {\n new (...args: unknown[]): T\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n kind: 'field'|'method';\n key: PropertyKey;\n placement: 'static'|'prototype'|'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement =\n (tagName: string, clazz: Constructor<HTMLElement>) => {\n window.customElements.define(tagName, clazz);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // tslint:disable-next-line:no-any\n return clazz as any;\n };\n\nconst standardCustomElement =\n (tagName: string, descriptor: ClassDescriptor) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n window.customElements.define(tagName, clazz);\n }\n };\n };\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * @param tagName the name of the custom element to define\n */\nexport const customElement = (tagName: string) =>\n (classOrDescriptor: Constructor<HTMLElement>|ClassDescriptor) =>\n (typeof classOrDescriptor === 'function') ?\n legacyCustomElement(\n tagName, classOrDescriptor as Constructor<HTMLElement>) :\n standardCustomElement(tagName, classOrDescriptor as ClassDescriptor);\n\nconst standardProperty =\n (options: PropertyDeclaration, element: ClassElement) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (element.kind === 'method' && element.descriptor &&\n !('value' in element.descriptor)) {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n // tslint:disable-next-line:no-any decorator\n initializer(this: any) {\n if (typeof element.initializer === 'function') {\n this[element.key] = element.initializer!.call(this);\n }\n },\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n }\n };\n\nconst legacyProperty =\n (options: PropertyDeclaration, proto: Object, name: PropertyKey) => {\n (proto.constructor as typeof UpdatingElement)\n .createProperty(name!, options);\n };\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A `PropertyDeclaration` may optionally be\n * supplied to configure property features.\n *\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // tslint:disable-next-line:no-any decorator\n return (protoOrDescriptor: Object|ClassElement, name?: PropertyKey): any =>\n (name !== undefined) ?\n legacyProperty(options!, protoOrDescriptor as Object, name) :\n standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n */\nexport const query = _query(\n (target: NodeSelector, selector: string) => target.querySelector(selector));\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n */\nexport const queryAll = _query(\n (target: NodeSelector, selector: string) =>\n target.querySelectorAll(selector));\n\nconst legacyQuery =\n (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => {\n Object.defineProperty(proto, name, descriptor);\n };\n\nconst standardQuery = (descriptor: PropertyDescriptor, element: ClassElement) =>\n ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n });\n\n/**\n * Base-implementation of `@query` and `@queryAll` decorators.\n *\n * @param queryFn exectute a `selector` (ie, querySelector or querySelectorAll)\n * against `target`.\n * @suppress {visibility} The descriptor accesses an internal field on the\n * element.\n */\nfunction _query<T>(queryFn: (target: NodeSelector, selector: string) => T) {\n return (selector: string) =>\n (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return queryFn(this.renderRoot!, selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\nconst standardEventOptions =\n (options: AddEventListenerOptions, element: ClassElement) => {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n Object.assign(\n clazz.prototype[element.key as keyof UpdatingElement], options);\n }\n };\n };\n\nconst legacyEventOptions =\n // tslint:disable-next-line:no-any legacy decorator\n (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n Object.assign(proto[name], options);\n };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifis event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * @example\n *\n * class MyElement {\n *\n * clicked = false;\n *\n * render() {\n * return html`<div @click=${this._onClick}`><button></button></div>`;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n */\nexport const eventOptions = (options: AddEventListenerOptions) =>\n // Return value typed as any to prevent TypeScript from complaining that\n // standard decorator function signature does not match TypeScript decorator\n // signature\n // TODO(kschaaf): unclear why it was only failing on this decorator and not\n // the others\n ((protoOrDescriptor: Object|ClassElement, name?: string) =>\n (name !== undefined) ?\n legacyEventOptions(options, protoOrDescriptor as Object, name) :\n standardEventOptions(options, protoOrDescriptor as ClassElement)) as\n // tslint:disable-next-line:no-any decorator\n any;\n"]} | ||
| {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/lib/decorators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4BH,MAAM,mBAAmB,GACrB,CAAC,OAAe,EAAE,KAA+B,EAAE,EAAE;IACnD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,sEAAsE;IACtE,wDAAwD;IACxD,8CAA8C;IAC9C,sEAAsE;IACtE,+BAA+B;IAC/B,kCAAkC;IAClC,OAAO,KAAY,CAAC;AACtB,CAAC,CAAC;AAEN,MAAM,qBAAqB,GACvB,CAAC,OAAe,EAAE,UAA2B,EAAE,EAAE;IAC/C,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,UAAU,CAAC;IACpC,OAAO;QACL,IAAI;QACJ,QAAQ;QACR,oEAAoE;QACpE,QAAQ,CAAC,KAA+B;YACtC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEN;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE,CAC7C,CAAC,iBAA2D,EAAE,EAAE,CAC5D,CAAC,OAAO,iBAAiB,KAAK,UAAU,CAAC,CAAC,CAAC;IAC/C,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACjD,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAEtD,MAAM,gBAAgB,GAClB,CAAC,OAA4B,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AC,UAA8B,EAAE,KAAa,EAAE,IAAiB,EAAE,EAAE;IACnE,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AACjD,CAAC,CAAC;AAEN,MAAM,aAAa,GAAG,CAAC,UAA8B,EAAE,OAAqB,EAAE,EAAE,CAC5E,CAAC;IACC,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,WAAW;IACtB,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,UAAU;CACX,CAAC,CAAC;AAEP,MAAM,oBAAoB,GACtB,CAAC,OAAgC,EAAE,OAAqB,EAAE,EAAE;IAC1D,yBACK,OAAO,IACV,QAAQ,CAAC,KAA6B;YACpC,MAAM,CAAC,MAAM,CACT,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAA4B,CAAC,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC,IACD;AACJ,CAAC,CAAC;AAEN,MAAM,kBAAkB;AACpB,mDAAmD;AACnD,CAAC,OAAgC,EAAE,KAAU,EAAE,IAAiB,EAAE,EAAE;IAClE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAgC,EAAE,EAAE;AAC7D,wEAAwE;AACxE,4EAA4E;AAC5E,YAAY;AACZ,2EAA2E;AAC3E,aAAa;AACb,CAAC,CAAC,iBAAsC,EAAE,IAAa,EAAE,EAAE,CACtD,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC;IACtB,kBAAkB,CAAC,OAAO,EAAE,iBAA2B,EAAE,IAAI,CAAC,CAAC,CAAC;IAChE,oBAAoB,CAAC,OAAO,EAAE,iBAAiC,CAAC,CAE9D,CAAC","sourcesContent":["/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {LitElement} from '../lit-element.js';\n\nimport {PropertyDeclaration, UpdatingElement} from './updating-element.js';\n\nexport type Constructor<T> = {\n new (...args: unknown[]): T\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n kind: 'field'|'method';\n key: PropertyKey;\n placement: 'static'|'prototype'|'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement =\n (tagName: string, clazz: Constructor<HTMLElement>) => {\n window.customElements.define(tagName, clazz);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // tslint:disable-next-line:no-any\n return clazz as any;\n };\n\nconst standardCustomElement =\n (tagName: string, descriptor: ClassDescriptor) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n window.customElements.define(tagName, clazz);\n }\n };\n };\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * @param tagName the name of the custom element to define\n */\nexport const customElement = (tagName: string) =>\n (classOrDescriptor: Constructor<HTMLElement>|ClassDescriptor) =>\n (typeof classOrDescriptor === 'function') ?\n legacyCustomElement(tagName, classOrDescriptor) :\n standardCustomElement(tagName, classOrDescriptor);\n\nconst standardProperty =\n (options: PropertyDeclaration, element: ClassElement) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (element.kind === 'method' && element.descriptor &&\n !('value' in element.descriptor)) {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n // tslint:disable-next-line:no-any decorator\n initializer(this: any) {\n if (typeof element.initializer === 'function') {\n this[element.key] = element.initializer.call(this);\n }\n },\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n }\n };\n\nconst legacyProperty =\n (options: PropertyDeclaration, proto: Object, name: PropertyKey) => {\n (proto.constructor as typeof UpdatingElement)\n .createProperty(name, options);\n };\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A `PropertyDeclaration` may optionally be\n * supplied to configure property features.\n *\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // tslint:disable-next-line:no-any decorator\n return (protoOrDescriptor: Object|ClassElement, name?: PropertyKey): any =>\n (name !== undefined) ?\n legacyProperty(options!, protoOrDescriptor as Object, name) :\n standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @ExportDecoratedItems\n */\nexport function query(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @ExportDecoratedItems\n */\nexport function queryAll(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelectorAll(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\nconst legacyQuery =\n (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => {\n Object.defineProperty(proto, name, descriptor);\n };\n\nconst standardQuery = (descriptor: PropertyDescriptor, element: ClassElement) =>\n ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n });\n\nconst standardEventOptions =\n (options: AddEventListenerOptions, element: ClassElement) => {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n Object.assign(\n clazz.prototype[element.key as keyof UpdatingElement], options);\n }\n };\n };\n\nconst legacyEventOptions =\n // tslint:disable-next-line:no-any legacy decorator\n (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n Object.assign(proto[name], options);\n };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifis event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * @example\n *\n * class MyElement {\n *\n * clicked = false;\n *\n * render() {\n * return html`<div @click=${this._onClick}`><button></button></div>`;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n */\nexport const eventOptions = (options: AddEventListenerOptions) =>\n // Return value typed as any to prevent TypeScript from complaining that\n // standard decorator function signature does not match TypeScript decorator\n // signature\n // TODO(kschaaf): unclear why it was only failing on this decorator and not\n // the others\n ((protoOrDescriptor: Object|ClassElement, name?: string) =>\n (name !== undefined) ?\n legacyEventOptions(options, protoOrDescriptor as Object, name) :\n standardEventOptions(options, protoOrDescriptor as ClassElement)) as\n // tslint:disable-next-line:no-any decorator\n any;\n"]} |
@@ -242,2 +242,8 @@ /** | ||
| /** | ||
| * This private version of `requestUpdate` does not access or return the | ||
| * `updateComplete` promise. This promise can be overridden and is therefore | ||
| * not free to access. | ||
| */ | ||
| private _requestUpdate; | ||
| /** | ||
| * Requests an update which is processed asynchronously. This should | ||
@@ -264,7 +270,10 @@ * be called when an element should update based on some state not triggered | ||
| /** | ||
| * Performs an element update. | ||
| * Performs an element update. Note, if an exception is thrown during the | ||
| * update, `firstUpdated` and `updated` will not be called. | ||
| * | ||
| * You can override this method to change the timing of updates. For instance, | ||
| * to schedule updates to occur just before the next frame: | ||
| * You can override this method to change the timing of updates. If this | ||
| * method is overridden, `super.performUpdate()` must be called. | ||
| * | ||
| * For instance, to schedule updates to occur just before the next frame: | ||
| * | ||
| * ``` | ||
@@ -283,3 +292,4 @@ * protected async performUpdate(): Promise<unknown> { | ||
| * update without triggering another update. The Promise result is `false` if | ||
| * a property was set inside `updated()`. This getter can be implemented to | ||
| * a property was set inside `updated()`. If the Promise is rejected, an | ||
| * exception was thrown during the update. This getter can be implemented to | ||
| * await additional state. For example, it is sometimes useful to await a | ||
@@ -286,0 +296,0 @@ * rendered element before fulfilling this Promise. To do this, first await |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"updating-element.d.ts","sourceRoot":"","sources":["../src/lib/updating-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAWH,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,yBAAyB,EAAE,CAAC,CAA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E1D"} |
+85
-45
@@ -153,3 +153,2 @@ /** | ||
| get() { | ||
| // tslint:disable-next-line:no-any no symbol in index | ||
| return this[key]; | ||
@@ -162,3 +161,3 @@ }, | ||
| this[key] = value; | ||
| this.requestUpdate(name, oldValue); | ||
| this._requestUpdate(name, oldValue); | ||
| }, | ||
@@ -267,2 +266,4 @@ configurable: true, | ||
| this._saveInstanceProperties(); | ||
| // ensures first update will be caught by an early access of `updateComplete` | ||
| this._requestUpdate(); | ||
| } | ||
@@ -308,3 +309,3 @@ /** | ||
| this._updateState = this._updateState | STATE_HAS_CONNECTED; | ||
| // Ensure connection triggers an update. Updates cannot complete before | ||
| // Ensure first connection completes an update. Updates cannot complete before | ||
| // connection and if one is pending connection the `_hasConnectionResolver` | ||
@@ -317,5 +318,2 @@ // will exist. If so, resolve it to complete the update, otherwise | ||
| } | ||
| else { | ||
| this.requestUpdate(); | ||
| } | ||
| } | ||
@@ -385,24 +383,20 @@ /** | ||
| /** | ||
| * Requests an update which is processed asynchronously. This should | ||
| * be called when an element should update based on some state not triggered | ||
| * by setting a property. In this case, pass no arguments. It should also be | ||
| * called when manually implementing a property setter. In this case, pass the | ||
| * property `name` and `oldValue` to ensure that any configured property | ||
| * options are honored. Returns the `updateComplete` Promise which is resolved | ||
| * when the update completes. | ||
| * | ||
| * @param name {PropertyKey} (optional) name of requesting property | ||
| * @param oldValue {any} (optional) old value of requesting property | ||
| * @returns {Promise} A Promise that is resolved when the update completes. | ||
| * This private version of `requestUpdate` does not access or return the | ||
| * `updateComplete` promise. This promise can be overridden and is therefore | ||
| * not free to access. | ||
| */ | ||
| requestUpdate(name, oldValue) { | ||
| _requestUpdate(name, oldValue) { | ||
| let shouldRequestUpdate = true; | ||
| // if we have a property key, perform property update steps. | ||
| if (name !== undefined && !this._changedProperties.has(name)) { | ||
| // If we have a property key, perform property update steps. | ||
| if (name !== undefined) { | ||
| const ctor = this.constructor; | ||
| const options = ctor._classProperties.get(name) || defaultPropertyDeclaration; | ||
| if (ctor._valueHasChanged(this[name], oldValue, options.hasChanged)) { | ||
| // track old value when changing. | ||
| this._changedProperties.set(name, oldValue); | ||
| // add to reflecting properties set | ||
| if (!this._changedProperties.has(name)) { | ||
| this._changedProperties.set(name, oldValue); | ||
| } | ||
| // Add to reflecting properties set. | ||
| // Note, it's important that every change has a chance to add the | ||
| // property to `_reflectingProperties`. This ensures setting | ||
| // attribute + property reflects correctly. | ||
| if (options.reflect === true && | ||
@@ -415,5 +409,5 @@ !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) { | ||
| } | ||
| // abort the request if the property should not be considered changed. | ||
| } | ||
| else { | ||
| // Abort the request if the property should not be considered changed. | ||
| shouldRequestUpdate = false; | ||
@@ -425,2 +419,18 @@ } | ||
| } | ||
| } | ||
| /** | ||
| * Requests an update which is processed asynchronously. This should | ||
| * be called when an element should update based on some state not triggered | ||
| * by setting a property. In this case, pass no arguments. It should also be | ||
| * called when manually implementing a property setter. In this case, pass the | ||
| * property `name` and `oldValue` to ensure that any configured property | ||
| * options are honored. Returns the `updateComplete` Promise which is resolved | ||
| * when the update completes. | ||
| * | ||
| * @param name {PropertyKey} (optional) name of requesting property | ||
| * @param oldValue {any} (optional) old value of requesting property | ||
| * @returns {Promise} A Promise that is resolved when the update completes. | ||
| */ | ||
| requestUpdate(name, oldValue) { | ||
| this._requestUpdate(name, oldValue); | ||
| return this.updateComplete; | ||
@@ -435,7 +445,17 @@ } | ||
| let resolve; | ||
| let reject; | ||
| const previousUpdatePromise = this._updatePromise; | ||
| this._updatePromise = new Promise((res) => resolve = res); | ||
| // Ensure any previous update has resolved before updating. | ||
| // This `await` also ensures that property changes are batched. | ||
| await previousUpdatePromise; | ||
| this._updatePromise = new Promise((res, rej) => { | ||
| resolve = res; | ||
| reject = rej; | ||
| }); | ||
| try { | ||
| // Ensure any previous update has resolved before updating. | ||
| // This `await` also ensures that property changes are batched. | ||
| await previousUpdatePromise; | ||
| } | ||
| catch (e) { | ||
| // Ignore any previous errors. We only care that the previous cycle is | ||
| // done. Any error should have been handled in the previous update. | ||
| } | ||
| // Make sure the element has connected before updating. | ||
@@ -445,10 +465,14 @@ if (!this._hasConnected) { | ||
| } | ||
| // Allow `performUpdate` to be asynchronous to enable scheduling of updates. | ||
| const result = this.performUpdate(); | ||
| // Note, this is to avoid delaying an additional microtask unless we need | ||
| // to. | ||
| if (result != null && | ||
| typeof result.then === 'function') { | ||
| await result; | ||
| try { | ||
| const result = this.performUpdate(); | ||
| // If `performUpdate` returns a Promise, we await it. This is done to | ||
| // enable coordinating updates with a scheduler. Note, the result is | ||
| // checked to avoid delaying an additional microtask unless we need to. | ||
| if (result != null) { | ||
| await result; | ||
| } | ||
| } | ||
| catch (e) { | ||
| reject(e); | ||
| } | ||
| resolve(!this._hasRequestedUpdate); | ||
@@ -466,7 +490,10 @@ } | ||
| /** | ||
| * Performs an element update. | ||
| * Performs an element update. Note, if an exception is thrown during the | ||
| * update, `firstUpdated` and `updated` will not be called. | ||
| * | ||
| * You can override this method to change the timing of updates. For instance, | ||
| * to schedule updates to occur just before the next frame: | ||
| * You can override this method to change the timing of updates. If this | ||
| * method is overridden, `super.performUpdate()` must be called. | ||
| * | ||
| * For instance, to schedule updates to occur just before the next frame: | ||
| * | ||
| * ``` | ||
@@ -484,6 +511,21 @@ * protected async performUpdate(): Promise<unknown> { | ||
| } | ||
| if (this.shouldUpdate(this._changedProperties)) { | ||
| const changedProperties = this._changedProperties; | ||
| this.update(changedProperties); | ||
| let shouldUpdate = false; | ||
| const changedProperties = this._changedProperties; | ||
| try { | ||
| shouldUpdate = this.shouldUpdate(changedProperties); | ||
| if (shouldUpdate) { | ||
| this.update(changedProperties); | ||
| } | ||
| } | ||
| catch (e) { | ||
| // Prevent `firstUpdated` and `updated` from running when there's an | ||
| // update exception. | ||
| shouldUpdate = false; | ||
| throw e; | ||
| } | ||
| finally { | ||
| // Ensure element can accept additional updates after an exception. | ||
| this._markUpdated(); | ||
| } | ||
| if (shouldUpdate) { | ||
| if (!(this._updateState & STATE_HAS_UPDATED)) { | ||
@@ -495,5 +537,2 @@ this._updateState = this._updateState | STATE_HAS_UPDATED; | ||
| } | ||
| else { | ||
| this._markUpdated(); | ||
| } | ||
| } | ||
@@ -508,3 +547,4 @@ _markUpdated() { | ||
| * update without triggering another update. The Promise result is `false` if | ||
| * a property was set inside `updated()`. This getter can be implemented to | ||
| * a property was set inside `updated()`. If the Promise is rejected, an | ||
| * exception was thrown during the update. This getter can be implemented to | ||
| * await additional state. For example, it is sometimes useful to await a | ||
@@ -511,0 +551,0 @@ * rendered element before fulfilling this Promise. To do this, first await |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"updating-element.js","sourceRoot":"","sources":["../src/lib/updating-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,yBAAyB;IAC5B,CAAwB,IAAO,EAAE,IAAa,EAAK,EAAE,CAAC,IAAI,CAAC;AA8G/D,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IAEzD,WAAW,CAAC,KAAc,EAAE,IAAc;QACxC,QAAQ,IAAI,EAAE;YACZ,KAAK,OAAO;gBACV,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC3B,KAAK,MAAM,CAAC;YACZ,KAAK,KAAK;gBACR,0DAA0D;gBAC1D,wCAAwC;gBACxC,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SACxD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa,CAAC,KAAkB,EAAE,IAAc;QAC9C,QAAQ,IAAI,EAAE;YACZ,KAAK,OAAO;gBACV,OAAO,KAAK,KAAK,IAAI,CAAC;YACxB,KAAK,MAAM;gBACT,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,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AC;YACtE,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;SACxC;IACH,CAAC;IAED;;;;;;;;OAQG;IACO,OAAO,CAAC,kBAAkC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACO,YAAY,CAAC,kBAAkC;IACzD,CAAC;;AA9hBD;;GAEG;AACc,yBAAS,GAAG,IAAI,CAAC","sourcesContent":["/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n var JSCompiler_renameProperty: <P extends PropertyKey>(\n prop: P, _obj: unknown) => P;\n\n interface Window {\n JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Function called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n /**\n * Function called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n ComplexAttributeConverter<Type>|((value: string, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean|string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\nexport type PropertyValues = Map<PropertyKey, unknown>;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n return value ? '' : null;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n return value == null ? value : JSON.stringify(value);\n }\n return value;\n },\n\n fromAttribute(value: string|null, type?: unknown) {\n switch (type) {\n case Boolean:\n return value !== null;\n case Number:\n return value === null ? null : Number(value);\n case Object:\n case Array:\n return JSON.parse(value!);\n }\n return value;\n }\n\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual\n};\n\nconst microtaskPromise = Promise.resolve(true);\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\nconst STATE_HAS_CONNECTED = 1 << 5;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n typeof STATE_IS_REFLECTING_TO_PROPERTY|typeof STATE_HAS_CONNECTED;\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n */\nexport abstract class UpdatingElement extends HTMLElement {\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n */\n private static _attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static finalized = true;\n\n /**\n * Memoized list of all class properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n */\n private static _classProperties?: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring the property.\n */\n static properties: PropertyDeclarations;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this._classProperties!.forEach((v, p) => {\n const attr = this._attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this._attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Ensures the private `_classProperties` property metadata is created.\n * In addition to `finalize` this is also called in `createProperty` to\n * ensure the `@property` decorator can add property metadata.\n */\n /** @nocollapse */\n private static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(\n JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties: PropertyDeclarationMap =\n Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach(\n (v: PropertyDeclaration, k: PropertyKey) =>\n this._classProperties!.set(k, v));\n }\n }\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist.\n * The property setter calls the property's `hasChanged` property option\n * or uses a strict identity check to determine whether or not to request\n * an update.\n * @nocollapse\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties!.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n Object.defineProperty(this.prototype, name, {\n // tslint:disable-next-line:no-any no symbol in index\n get(): any {\n // tslint:disable-next-line:no-any no symbol in index\n return (this as any)[key];\n },\n set(this: UpdatingElement, value: unknown) {\n // tslint:disable-next-line:no-any no symbol in index\n const oldValue = (this as any)[name];\n // tslint:disable-next-line:no-any no symbol in index\n (this as any)[key] = value;\n this.requestUpdate(name, oldValue);\n },\n configurable: true,\n enumerable: true\n });\n }\n\n /**\n * Creates property accessors for registered properties and ensures\n * any superclasses are also finalized.\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('finalized', this)) &&\n this.finalized) {\n return;\n }\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n if (typeof superCtor.finalize === 'function') {\n superCtor.finalize();\n }\n this.finalized = true;\n this._ensureClassProperties();\n // initialize Map populated in observedAttributes\n this._attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...(typeof Object.getOwnPropertySymbols === 'function') ?\n Object.getOwnPropertySymbols(props) :\n []\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeSript lack of support for symbol in\n // index types\n // tslint:disable-next-line:no-any no symbol in index\n this.createProperty(p, (props as any)[p]);\n }\n }\n }\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static _attributeNameForProperty(\n name: PropertyKey, options: PropertyDeclaration) {\n const attribute = options.attribute;\n return attribute === false ?\n undefined :\n (typeof attribute === 'string' ?\n attribute :\n (typeof name === 'string' ? name.toLowerCase() : undefined));\n }\n\n /**\n * Returns true if a property should request an update.\n * Called when a property value is set and uses the `hasChanged`\n * option for the property if present or a strict identity check.\n * @nocollapse\n */\n private static _valueHasChanged(\n value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n return hasChanged(value, old);\n }\n\n /**\n * Returns the property value for the given attribute value.\n * Called via the `attributeChangedCallback` and uses the property's\n * `converter` or `converter.fromAttribute` property option.\n * @nocollapse\n */\n private static _propertyValueFromAttribute(\n value: string|null, options: PropertyDeclaration) {\n const type = options.type;\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n (typeof converter === 'function' ? converter : converter.fromAttribute);\n return fromAttribute ? fromAttribute(value, type) : value;\n }\n\n /**\n * Returns the attribute value for the given property value. If this\n * returns undefined, the property will *not* be reflected to an attribute.\n * If this returns null, the attribute will be removed, otherwise the\n * attribute will be set to the value.\n * This uses the property's `reflect` and `type.toAttribute` property options.\n * @nocollapse\n */\n private static _propertyValueToAttribute(\n value: unknown, options: PropertyDeclaration) {\n if (options.reflect === undefined) {\n return;\n }\n const type = options.type;\n const converter = options.converter;\n const toAttribute =\n converter && (converter as ComplexAttributeConverter).toAttribute ||\n defaultConverter.toAttribute;\n return toAttribute!(value, type);\n }\n\n private _updateState: UpdateState = 0;\n private _instanceProperties: PropertyValues|undefined = undefined;\n private _updatePromise: Promise<unknown> = microtaskPromise;\n private _hasConnectedResolver: (() => void)|undefined = undefined;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n */\n private _changedProperties: PropertyValues = new Map();\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private _reflectingProperties: Map<PropertyKey, PropertyDeclaration>|\n undefined = undefined;\n\n constructor() {\n super();\n this.initialize();\n }\n\n /**\n * Performs element initialization. By default captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n this._saveInstanceProperties();\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private _saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof UpdatingElement)\n ._classProperties!.forEach((_v, p) => {\n if (this.hasOwnProperty(p)) {\n const value = this[p as keyof this];\n delete this[p as keyof this];\n if (!this._instanceProperties) {\n this._instanceProperties = new Map();\n }\n this._instanceProperties.set(p, value);\n }\n });\n }\n\n /**\n * Applies previously saved instance properties.\n */\n private _applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n this._instanceProperties = undefined;\n }\n\n connectedCallback() {\n this._updateState = this._updateState | STATE_HAS_CONNECTED;\n // Ensure connection triggers an update. Updates cannot complete before\n // connection and if one is pending connection the `_hasConnectionResolver`\n // will exist. If so, resolve it to complete the update, otherwise\n // requestUpdate.\n if (this._hasConnectedResolver) {\n this._hasConnectedResolver();\n this._hasConnectedResolver = undefined;\n } else {\n this.requestUpdate();\n }\n }\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n */\n disconnectedCallback() {\n }\n\n /**\n * Synchronizes property values when attributes change.\n */\n attributeChangedCallback(name: string, old: string|null, value: string|null) {\n if (old !== value) {\n this._attributeToProperty(name, value);\n }\n }\n\n private _propertyToAttribute(\n name: PropertyKey, value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n const ctor = (this.constructor as typeof UpdatingElement);\n const attr = ctor._attributeNameForProperty(name, options);\n if (attr !== undefined) {\n const attrValue = ctor._propertyValueToAttribute(value, options);\n // an undefined value does not change the attribute.\n if (attrValue === undefined) {\n return;\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n }\n }\n\n private _attributeToProperty(name: string, value: string|null) {\n // Use tracking info to avoid deserializing attribute value if it was\n // just set from a property setter.\n if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n return;\n }\n const ctor = (this.constructor as typeof UpdatingElement);\n const propName = ctor._attributeToPropertyMap.get(name);\n if (propName !== undefined) {\n const options =\n ctor._classProperties!.get(propName) || defaultPropertyDeclaration;\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n this[propName as keyof this] =\n // tslint:disable-next-line:no-any\n ctor._propertyValueFromAttribute(value, options) as any;\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should\n * be called when an element should update based on some state not triggered\n * by setting a property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored. Returns the `updateComplete` Promise which is resolved\n * when the update completes.\n *\n * @param name {PropertyKey} (optional) name of requesting property\n * @param oldValue {any} (optional) old value of requesting property\n * @returns {Promise} A Promise that is resolved when the update completes.\n */\n requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n let shouldRequestUpdate = true;\n // if we have a property key, perform property update steps.\n if (name !== undefined && !this._changedProperties.has(name)) {\n const ctor = this.constructor as typeof UpdatingElement;\n const options =\n ctor._classProperties!.get(name) || defaultPropertyDeclaration;\n if (ctor._valueHasChanged(\n this[name as keyof this], oldValue, options.hasChanged)) {\n // track old value when changing.\n this._changedProperties.set(name, oldValue);\n // add to reflecting properties set\n if (options.reflect === true &&\n !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n if (this._reflectingProperties === undefined) {\n this._reflectingProperties = new Map();\n }\n this._reflectingProperties.set(name, options);\n }\n // abort the request if the property should not be considered changed.\n } else {\n shouldRequestUpdate = false;\n }\n }\n if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n this._enqueueUpdate();\n }\n return this.updateComplete;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async _enqueueUpdate() {\n // Mark state updating...\n this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n let resolve: (r: boolean) => void;\n const previousUpdatePromise = this._updatePromise;\n this._updatePromise = new Promise((res) => resolve = res);\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await previousUpdatePromise;\n // Make sure the element has connected before updating.\n if (!this._hasConnected) {\n await new Promise((res) => this._hasConnectedResolver = res);\n }\n // Allow `performUpdate` to be asynchronous to enable scheduling of updates.\n const result = this.performUpdate();\n // Note, this is to avoid delaying an additional microtask unless we need\n // to.\n if (result != null &&\n typeof (result as PromiseLike<unknown>).then === 'function') {\n await result;\n }\n resolve!(!this._hasRequestedUpdate);\n }\n\n private get _hasConnected() {\n return (this._updateState & STATE_HAS_CONNECTED);\n }\n\n private get _hasRequestedUpdate() {\n return (this._updateState & STATE_UPDATE_REQUESTED);\n }\n\n protected get hasUpdated() {\n return (this._updateState & STATE_HAS_UPDATED);\n }\n\n /**\n * Performs an element update.\n *\n * You can override this method to change the timing of updates. For instance,\n * to schedule updates to occur just before the next frame:\n *\n * ```\n * protected async performUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.performUpdate();\n * }\n * ```\n */\n protected performUpdate(): void|Promise<unknown> {\n // Mixin instance properties once, if they exist.\n if (this._instanceProperties) {\n this._applyInstanceProperties();\n }\n if (this.shouldUpdate(this._changedProperties)) {\n const changedProperties = this._changedProperties;\n this.update(changedProperties);\n this._markUpdated();\n if (!(this._updateState & STATE_HAS_UPDATED)) {\n this._updateState = this._updateState | STATE_HAS_UPDATED;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n } else {\n this._markUpdated();\n }\n }\n\n private _markUpdated() {\n this._changedProperties = new Map();\n this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. This getter can be implemented to\n * await additional state. For example, it is sometimes useful to await a\n * rendered element before fulfilling this Promise. To do this, first await\n * `super.updateComplete` then any subsequent state.\n *\n * @returns {Promise} The Promise returns a boolean that indicates if the\n * update resolved without triggering another update.\n */\n get updateComplete() {\n return this._updatePromise;\n }\n\n /**\n * Controls whether or not `update` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected update(_changedProperties: PropertyValues) {\n if (this._reflectingProperties !== undefined &&\n this._reflectingProperties.size > 0) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this._reflectingProperties.forEach(\n (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n this._reflectingProperties = undefined;\n }\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected updated(_changedProperties: PropertyValues) {\n }\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected firstUpdated(_changedProperties: PropertyValues) {\n }\n}\n"]} | ||
| {"version":3,"file":"updating-element.js","sourceRoot":"","sources":["../src/lib/updating-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,yBAAyB;IAC5B,CAAwB,IAAO,EAAE,IAAa,EAAK,EAAE,CAAC,IAAI,CAAC;AA8G/D,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IAEzD,WAAW,CAAC,KAAc,EAAE,IAAc;QACxC,QAAQ,IAAI,EAAE;YACZ,KAAK,OAAO;gBACV,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC3B,KAAK,MAAM,CAAC;YACZ,KAAK,KAAK;gBACR,0DAA0D;gBAC1D,wCAAwC;gBACxC,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;SACxD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa,CAAC,KAAkB,EAAE,IAAc;QAC9C,QAAQ,IAAI,EAAE;YACZ,KAAK,OAAO;gBACV,OAAO,KAAK,KAAK,IAAI,CAAC;YACxB,KAAK,MAAM;gBACT,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/C,KAAK,MAAM,CAAC;YACZ,KAAK,KAA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AAI,cAAc;QAChB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACO,YAAY,CAAC,kBAAkC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACO,MAAM,CAAC,kBAAkC;QACjD,IAAI,IAAI,CAAC,qBAAqB,KAAK,SAAS;YACxC,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,CAAC,EAAE;YACvC,qEAAqE;YACrE,yBAAyB;YACzB,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAC9B,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAe,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACtE,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;SACxC;IACH,CAAC;IAED;;;;;;;;OAQG;IACO,OAAO,CAAC,kBAAkC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACO,YAAY,CAAC,kBAAkC;IACzD,CAAC;;AArkBD;;GAEG;AACc,yBAAS,GAAG,IAAI,CAAC","sourcesContent":["/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n var JSCompiler_renameProperty: <P extends PropertyKey>(\n prop: P, _obj: unknown) => P;\n\n interface Window {\n JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Function called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n /**\n * Function called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n ComplexAttributeConverter<Type>|((value: string, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean|string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\nexport type PropertyValues = Map<PropertyKey, unknown>;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n return value ? '' : null;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n return value == null ? value : JSON.stringify(value);\n }\n return value;\n },\n\n fromAttribute(value: string|null, type?: unknown) {\n switch (type) {\n case Boolean:\n return value !== null;\n case Number:\n return value === null ? null : Number(value);\n case Object:\n case Array:\n return JSON.parse(value!);\n }\n return value;\n }\n\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual\n};\n\nconst microtaskPromise = Promise.resolve(true);\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\nconst STATE_HAS_CONNECTED = 1 << 5;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n typeof STATE_IS_REFLECTING_TO_PROPERTY|typeof STATE_HAS_CONNECTED;\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n */\nexport abstract class UpdatingElement extends HTMLElement {\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n */\n private static _attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static finalized = true;\n\n /**\n * Memoized list of all class properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n */\n private static _classProperties?: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring the property.\n */\n static properties: PropertyDeclarations;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this._classProperties!.forEach((v, p) => {\n const attr = this._attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this._attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Ensures the private `_classProperties` property metadata is created.\n * In addition to `finalize` this is also called in `createProperty` to\n * ensure the `@property` decorator can add property metadata.\n */\n /** @nocollapse */\n private static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(\n JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties: PropertyDeclarationMap =\n Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach(\n (v: PropertyDeclaration, k: PropertyKey) =>\n this._classProperties!.set(k, v));\n }\n }\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist.\n * The property setter calls the property's `hasChanged` property option\n * or uses a strict identity check to determine whether or not to request\n * an update.\n * @nocollapse\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties!.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n Object.defineProperty(this.prototype, name, {\n // tslint:disable-next-line:no-any no symbol in index\n get(): any {\n return this[key];\n },\n set(this: UpdatingElement, value: unknown) {\n // tslint:disable-next-line:no-any no symbol in index\n const oldValue = (this as any)[name];\n // tslint:disable-next-line:no-any no symbol in index\n (this as any)[key] = value;\n this._requestUpdate(name, oldValue);\n },\n configurable: true,\n enumerable: true\n });\n }\n\n /**\n * Creates property accessors for registered properties and ensures\n * any superclasses are also finalized.\n * @nocollapse\n */\n protected static finalize() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('finalized', this)) &&\n this.finalized) {\n return;\n }\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n if (typeof superCtor.finalize === 'function') {\n superCtor.finalize();\n }\n this.finalized = true;\n this._ensureClassProperties();\n // initialize Map populated in observedAttributes\n this._attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...(typeof Object.getOwnPropertySymbols === 'function') ?\n Object.getOwnPropertySymbols(props) :\n []\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeSript lack of support for symbol in\n // index types\n // tslint:disable-next-line:no-any no symbol in index\n this.createProperty(p, (props as any)[p]);\n }\n }\n }\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static _attributeNameForProperty(\n name: PropertyKey, options: PropertyDeclaration) {\n const attribute = options.attribute;\n return attribute === false ?\n undefined :\n (typeof attribute === 'string' ?\n attribute :\n (typeof name === 'string' ? name.toLowerCase() : undefined));\n }\n\n /**\n * Returns true if a property should request an update.\n * Called when a property value is set and uses the `hasChanged`\n * option for the property if present or a strict identity check.\n * @nocollapse\n */\n private static _valueHasChanged(\n value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n return hasChanged(value, old);\n }\n\n /**\n * Returns the property value for the given attribute value.\n * Called via the `attributeChangedCallback` and uses the property's\n * `converter` or `converter.fromAttribute` property option.\n * @nocollapse\n */\n private static _propertyValueFromAttribute(\n value: string|null, options: PropertyDeclaration) {\n const type = options.type;\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n (typeof converter === 'function' ? converter : converter.fromAttribute);\n return fromAttribute ? fromAttribute(value, type) : value;\n }\n\n /**\n * Returns the attribute value for the given property value. If this\n * returns undefined, the property will *not* be reflected to an attribute.\n * If this returns null, the attribute will be removed, otherwise the\n * attribute will be set to the value.\n * This uses the property's `reflect` and `type.toAttribute` property options.\n * @nocollapse\n */\n private static _propertyValueToAttribute(\n value: unknown, options: PropertyDeclaration) {\n if (options.reflect === undefined) {\n return;\n }\n const type = options.type;\n const converter = options.converter;\n const toAttribute =\n converter && (converter as ComplexAttributeConverter).toAttribute ||\n defaultConverter.toAttribute;\n return toAttribute!(value, type);\n }\n\n private _updateState: UpdateState = 0;\n private _instanceProperties: PropertyValues|undefined = undefined;\n private _updatePromise: Promise<unknown> = microtaskPromise;\n private _hasConnectedResolver: (() => void)|undefined = undefined;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n */\n private _changedProperties: PropertyValues = new Map();\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private _reflectingProperties: Map<PropertyKey, PropertyDeclaration>|\n undefined = undefined;\n\n constructor() {\n super();\n this.initialize();\n }\n\n /**\n * Performs element initialization. By default captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of `updateComplete`\n this._requestUpdate();\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private _saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof UpdatingElement)\n ._classProperties!.forEach((_v, p) => {\n if (this.hasOwnProperty(p)) {\n const value = this[p as keyof this];\n delete this[p as keyof this];\n if (!this._instanceProperties) {\n this._instanceProperties = new Map();\n }\n this._instanceProperties.set(p, value);\n }\n });\n }\n\n /**\n * Applies previously saved instance properties.\n */\n private _applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n this._instanceProperties = undefined;\n }\n\n connectedCallback() {\n this._updateState = this._updateState | STATE_HAS_CONNECTED;\n // Ensure first connection completes an update. Updates cannot complete before\n // connection and if one is pending connection the `_hasConnectionResolver`\n // will exist. If so, resolve it to complete the update, otherwise\n // requestUpdate.\n if (this._hasConnectedResolver) {\n this._hasConnectedResolver();\n this._hasConnectedResolver = undefined;\n }\n }\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n */\n disconnectedCallback() {\n }\n\n /**\n * Synchronizes property values when attributes change.\n */\n attributeChangedCallback(name: string, old: string|null, value: string|null) {\n if (old !== value) {\n this._attributeToProperty(name, value);\n }\n }\n\n private _propertyToAttribute(\n name: PropertyKey, value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n const ctor = (this.constructor as typeof UpdatingElement);\n const attr = ctor._attributeNameForProperty(name, options);\n if (attr !== undefined) {\n const attrValue = ctor._propertyValueToAttribute(value, options);\n // an undefined value does not change the attribute.\n if (attrValue === undefined) {\n return;\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n }\n }\n\n private _attributeToProperty(name: string, value: string|null) {\n // Use tracking info to avoid deserializing attribute value if it was\n // just set from a property setter.\n if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n return;\n }\n const ctor = (this.constructor as typeof UpdatingElement);\n const propName = ctor._attributeToPropertyMap.get(name);\n if (propName !== undefined) {\n const options =\n ctor._classProperties!.get(propName) || defaultPropertyDeclaration;\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n this[propName as keyof this] =\n // tslint:disable-next-line:no-any\n ctor._propertyValueFromAttribute(value, options) as any;\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n }\n }\n\n /**\n * This private version of `requestUpdate` does not access or return the\n * `updateComplete` promise. This promise can be overridden and is therefore\n * not free to access.\n */\n private _requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n const ctor = this.constructor as typeof UpdatingElement;\n const options =\n ctor._classProperties!.get(name) || defaultPropertyDeclaration;\n if (ctor._valueHasChanged(\n this[name as keyof this], oldValue, options.hasChanged)) {\n if (!this._changedProperties.has(name)) {\n this._changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true &&\n !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n if (this._reflectingProperties === undefined) {\n this._reflectingProperties = new Map();\n }\n this._reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n this._enqueueUpdate();\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should\n * be called when an element should update based on some state not triggered\n * by setting a property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored. Returns the `updateComplete` Promise which is resolved\n * when the update completes.\n *\n * @param name {PropertyKey} (optional) name of requesting property\n * @param oldValue {any} (optional) old value of requesting property\n * @returns {Promise} A Promise that is resolved when the update completes.\n */\n requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n this._requestUpdate(name, oldValue);\n return this.updateComplete;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async _enqueueUpdate() {\n // Mark state updating...\n this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n let resolve!: (r: boolean) => void;\n let reject!: (e: Error) => void;\n const previousUpdatePromise = this._updatePromise;\n this._updatePromise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await previousUpdatePromise;\n } catch (e) {\n // Ignore any previous errors. We only care that the previous cycle is\n // done. Any error should have been handled in the previous update.\n }\n // Make sure the element has connected before updating.\n if (!this._hasConnected) {\n await new Promise((res) => this._hasConnectedResolver = res);\n }\n try {\n const result = this.performUpdate();\n // If `performUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n } catch (e) {\n reject(e);\n }\n resolve(!this._hasRequestedUpdate);\n }\n\n private get _hasConnected() {\n return (this._updateState & STATE_HAS_CONNECTED);\n }\n\n private get _hasRequestedUpdate() {\n return (this._updateState & STATE_UPDATE_REQUESTED);\n }\n\n protected get hasUpdated() {\n return (this._updateState & STATE_HAS_UPDATED);\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * You can override this method to change the timing of updates. If this\n * method is overridden, `super.performUpdate()` must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```\n * protected async performUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.performUpdate();\n * }\n * ```\n */\n protected performUpdate(): void|Promise<unknown> {\n // Mixin instance properties once, if they exist.\n if (this._instanceProperties) {\n this._applyInstanceProperties();\n }\n let shouldUpdate = false;\n const changedProperties = this._changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.update(changedProperties);\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n throw e;\n } finally {\n // Ensure element can accept additional updates after an exception.\n this._markUpdated();\n }\n if (shouldUpdate) {\n if (!(this._updateState & STATE_HAS_UPDATED)) {\n this._updateState = this._updateState | STATE_HAS_UPDATED;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n }\n }\n\n private _markUpdated() {\n this._changedProperties = new Map();\n this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update. This getter can be implemented to\n * await additional state. For example, it is sometimes useful to await a\n * rendered element before fulfilling this Promise. To do this, first await\n * `super.updateComplete` then any subsequent state.\n *\n * @returns {Promise} The Promise returns a boolean that indicates if the\n * update resolved without triggering another update.\n */\n get updateComplete() {\n return this._updatePromise;\n }\n\n /**\n * Controls whether or not `update` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected update(_changedProperties: PropertyValues) {\n if (this._reflectingProperties !== undefined &&\n this._reflectingProperties.size > 0) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this._reflectingProperties.forEach(\n (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n this._reflectingProperties = undefined;\n }\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected updated(_changedProperties: PropertyValues) {\n }\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * * @param _changedProperties Map of changed properties with old values\n */\n protected firstUpdated(_changedProperties: PropertyValues) {\n }\n}\n"]} |
+2
-2
@@ -18,3 +18,3 @@ /** | ||
| export * from './lib/decorators.js'; | ||
| export { html, svg, TemplateResult, SVGTemplateResult } from 'lit-html/lit-html'; | ||
| export { html, svg, TemplateResult, SVGTemplateResult } from 'lit-html/lit-html.js'; | ||
| import { CSSResult } from './lib/css-tag.js'; | ||
@@ -59,3 +59,3 @@ export * from './lib/css-tag.js'; | ||
| */ | ||
| protected renderRoot?: Element | DocumentFragment; | ||
| readonly renderRoot: Element | DocumentFragment; | ||
| /** | ||
@@ -62,0 +62,0 @@ * Performs element initialization. By default this calls `createRenderRoot` |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"lit-element.d.ts","sourceRoot":"","sources":["src/lit-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1E,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,cAAc,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAA8B,SAAS,EAAC,MAAM,kBAAkB,CAAC;AACxE,cAAc,kBAAkB,CAAC;AAEjC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,kBAAkB,EAAE,MAAM,EAAE,CAAC;KAC9B;CACF;AAQD,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,SAAS,GAAC,cAAc,CAAC;CAAG;AAwB1E,qBAAa,UAAW,SAAQ,eAAe;IAC7C;;;OAGG;IACH,SAAS,CAAC,MAAM,CAAC,SAAS,UAAQ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AQD,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,SAAS,GAAC,cAAc,CAAC;CAAG;AAwB1E,qBAAa,UAAW,SAAQ,eAAe;IAC7C;;;OAGG;IACH,SAAS,CAAC,MAAM,CAAC,SAAS,UAAQ;IAElC;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,2IAAU;IAEvB;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,GAAC,cAAc,CAAC;IAEzC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAwB;IAE9C,kBAAkB;IAClB,SAAS,CAAC,MAAM,CAAC,QAAQ;IAUzB,kBAAkB;IAClB,OAAO,CAAC,MAAM,CAAC,gBAAgB;IA6B/B,OAAO,CAAC,4BAA4B,CAAC,CAAU;IAE/C;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAG,OAAO,GAAC,gBAAgB,CAAC;IAE/C;;;;OAIG;IACH,SAAS,CAAC,UAAU;IAYpB;;;;;;OAMG;IACH,SAAS,CAAC,gBAAgB,IAAI,OAAO,GAAC,UAAU;IAIhD;;;;;;;;OAQG;IACH,SAAS,CAAC,WAAW;IAuBrB,iBAAiB;IASjB;;;;;OAKG;IACH,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc;IAuBlD;;;;OAIG;IACH,SAAS,CAAC,MAAM,IAAI,cAAc,GAAC,IAAI;CAExC"} |
+4
-3
@@ -15,7 +15,7 @@ /** | ||
| import { TemplateResult } from 'lit-html'; | ||
| import { render } from 'lit-html/lib/shady-render'; | ||
| import { render } from 'lit-html/lib/shady-render.js'; | ||
| import { UpdatingElement } from './lib/updating-element.js'; | ||
| export * from './lib/updating-element.js'; | ||
| export * from './lib/decorators.js'; | ||
| export { html, svg, TemplateResult, SVGTemplateResult } from 'lit-html/lit-html'; | ||
| export { html, svg, TemplateResult, SVGTemplateResult } from 'lit-html/lit-html.js'; | ||
| import { supportsAdoptingStyleSheets } from './lib/css-tag.js'; | ||
@@ -95,3 +95,4 @@ export * from './lib/css-tag.js'; | ||
| super.initialize(); | ||
| this.renderRoot = this.createRenderRoot(); | ||
| this.renderRoot = | ||
| this.createRenderRoot(); | ||
| // Note, if renderRoot is not a shadowRoot, styles would/could apply to the | ||
@@ -98,0 +99,0 @@ // element's getRootNode(). While this could be done, we're choosing not to |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"lit-element.js","sourceRoot":"","sources":["src/lit-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAEjD,OAAO,EAAiB,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1E,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,cAAc,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAC,2BAA2B,EAAY,MAAM,kBAAkB,CAAC;AACxE,cAAc,kBAAkB,CAAC;AAQjC,2EAA2E;AAC3E,oEAAoE;AACpE,2DAA2D;AAC3D,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,CAAC,CAAC;KAChE,IAAI,CAAC,OAAO,CAAC,CAAC;AAInB;;;;GAIG;AACH,SAAS,SAAS,CACd,MAAsB,EAAE,SAAsB,EAAE;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QACvD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SAC1B;aAAM;YACL,MAA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AC;IAED;;;;OAIG;IACO,MAAM;IAChB,CAAC;;AAhLD;;;GAGG;AACc,oBAAS,GAAG,IAAI,CAAC;AAElC;;;;;;;GAOG;AACI,iBAAM,GAAG,MAAM,CAAC","sourcesContent":["/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport {TemplateResult} from 'lit-html';\nimport {render} from 'lit-html/lib/shady-render';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html';\nimport {supportsAdoptingStyleSheets, CSSResult} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n interface Window {\n litElementVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n .push('2.0.1');\n\nexport interface CSSResultArray extends Array<CSSResult|CSSResultArray> {}\n\n/**\n * Minimal implementation of Array.prototype.flat\n * @param arr the array to flatten\n * @param result the accumlated result\n */\nfunction arrayFlat(\n styles: CSSResultArray, result: CSSResult[] = []): CSSResult[] {\n for (let i = 0, length = styles.length; i < length; i++) {\n const value = styles[i];\n if (Array.isArray(value)) {\n arrayFlat(value, result);\n } else {\n result.push(value);\n }\n }\n return result;\n}\n\n/** Deeply flattens styles array. Uses native flat if available. */\nconst flattenStyles = (styles: CSSResultArray): CSSResult[] =>\n styles.flat ? styles.flat(Infinity) : arrayFlat(styles);\n\nexport class LitElement extends UpdatingElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n */\n protected static finalized = true;\n\n /**\n * Render method used to render the lit-html TemplateResult to the element's\n * DOM.\n * @param {TemplateResult} Template to render.\n * @param {Element|DocumentFragment} Node into which to render.\n * @param {String} Element name.\n * @nocollapse\n */\n static render = render;\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the `css` tag function.\n */\n static styles?: CSSResult|CSSResultArray;\n\n private static _styles: CSSResult[]|undefined;\n\n /** @nocollapse */\n protected static finalize() {\n super.finalize();\n // Prepare styling that is stamped at first render time. Styling\n // is built from user provided `styles` or is inherited from the superclass.\n this._styles =\n this.hasOwnProperty(JSCompiler_renameProperty('styles', this)) ?\n this._getUniqueStyles() :\n this._styles || [];\n }\n\n /** @nocollapse */\n private static _getUniqueStyles(): CSSResult[] {\n // Take care not to call `this.styles` multiple times since this generates\n // new CSSResults each time.\n // TODO(sorvell): Since we do not cache CSSResults by input, any\n // shared styles will generate new stylesheet objects, which is wasteful.\n // This should be addressed when a browser ships constructable\n // stylesheets.\n const userStyles = this.styles;\n const styles: CSSResult[] = [];\n if (Array.isArray(userStyles)) {\n const flatStyles = flattenStyles(userStyles);\n // As a performance optimization to avoid duplicated styling that can\n // occur especially when composing via subclassing, de-duplicate styles\n // preserving the last item in the list. The last item is kept to\n // try to preserve cascade order with the assumption that it's most\n // important that last added styles override previous styles.\n const styleSet = flatStyles.reduceRight((set, s) => {\n set.add(s);\n // on IE set.add does not return the set.\n return set;\n }, new Set<CSSResult>());\n // Array.from does not work on Set in IE\n styleSet.forEach((v) => styles!.unshift(v));\n } else if (userStyles) {\n styles.push(userStyles);\n }\n return styles;\n }\n\n private _needsShimAdoptedStyleSheets?: boolean;\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n */\n protected renderRoot?: Element|DocumentFragment;\n\n /**\n * Performs element initialization. By default this calls `createRenderRoot`\n * to create the element `renderRoot` node and captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n super.initialize();\n this.renderRoot = this.createRenderRoot();\n // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n // element's getRootNode(). While this could be done, we're choosing not to\n // support this now since it would require different logic around de-duping.\n if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n this.adoptStyles();\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n * @returns {Element|DocumentFragment} Returns a node into which to render.\n */\n protected createRenderRoot(): Element|ShadowRoot {\n return this.attachShadow({mode: 'open'});\n }\n\n /**\n * Applies styling to the element shadowRoot using the `static get styles`\n * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n * available and will fallback otherwise. When Shadow DOM is polyfilled,\n * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n * is available but `adoptedStyleSheets` is not, styles are appended to the\n * end of the `shadowRoot` to [mimic spec\n * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n */\n protected adoptStyles() {\n const styles = (this.constructor as typeof LitElement)._styles!;\n if (styles.length === 0) {\n return;\n }\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it.\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.ScopingShim.prepareAdoptedCssText(\n styles.map((s) => s.cssText), this.localName);\n } else if (supportsAdoptingStyleSheets) {\n (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n styles.map((s) => s.styleSheet!);\n } else {\n // This must be done after rendering so the actual style insertion is done\n // in `update`.\n this._needsShimAdoptedStyleSheets = true;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n if (this.hasUpdated && window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * * @param _changedProperties Map of changed properties with old values\n */\n protected update(changedProperties: PropertyValues) {\n super.update(changedProperties);\n const templateResult = this.render() as unknown;\n if (templateResult instanceof TemplateResult) {\n (this.constructor as typeof LitElement)\n .render(\n templateResult,\n this.renderRoot!,\n {scopeName: this.localName!, eventContext: this});\n }\n // When native Shadow DOM is used but adoptedStyles are not supported,\n // insert styling after rendering to ensure adoptedStyles have highest\n // priority.\n if (this._needsShimAdoptedStyleSheets) {\n this._needsShimAdoptedStyleSheets = false;\n (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = s.cssText;\n this.renderRoot!.appendChild(style);\n });\n }\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method must return\n * a lit-html TemplateResult. Setting properties inside this method will *not*\n * trigger the element to update.\n */\n protected render(): TemplateResult|void {\n }\n}\n"]} | ||
| {"version":3,"file":"lit-element.js","sourceRoot":"","sources":["src/lit-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,OAAO,EAAiB,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1E,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,cAAc,EAAE,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAC,2BAA2B,EAAY,MAAM,kBAAkB,CAAC;AACxE,cAAc,kBAAkB,CAAC;AAQjC,2EAA2E;AAC3E,oEAAoE;AACpE,2DAA2D;AAC3D,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAA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C;SAC1D;QACD,sEAAsE;QACtE,sEAAsE;QACtE,YAAY;QACZ,IAAI,IAAI,CAAC,4BAA4B,EAAE;YACrC,IAAI,CAAC,4BAA4B,GAAG,KAAK,CAAC;YACzC,IAAI,CAAC,WAAiC,CAAC,OAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAC9C,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC,OAAO,CAAC;gBAC9B,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED;;;;OAIG;IACO,MAAM;IAChB,CAAC;;AAjLD;;;GAGG;AACc,oBAAS,GAAG,IAAI,CAAC;AAElC;;;;;;;GAOG;AACI,iBAAM,GAAG,MAAM,CAAC","sourcesContent":["/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport {TemplateResult} from 'lit-html';\nimport {render} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n interface Window {\n litElementVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n .push('2.0.1');\n\nexport interface CSSResultArray extends Array<CSSResult|CSSResultArray> {}\n\n/**\n * Minimal implementation of Array.prototype.flat\n * @param arr the array to flatten\n * @param result the accumlated result\n */\nfunction arrayFlat(\n styles: CSSResultArray, result: CSSResult[] = []): CSSResult[] {\n for (let i = 0, length = styles.length; i < length; i++) {\n const value = styles[i];\n if (Array.isArray(value)) {\n arrayFlat(value, result);\n } else {\n result.push(value);\n }\n }\n return result;\n}\n\n/** Deeply flattens styles array. Uses native flat if available. */\nconst flattenStyles = (styles: CSSResultArray): CSSResult[] =>\n styles.flat ? styles.flat(Infinity) : arrayFlat(styles);\n\nexport class LitElement extends UpdatingElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n */\n protected static finalized = true;\n\n /**\n * Render method used to render the lit-html TemplateResult to the element's\n * DOM.\n * @param {TemplateResult} Template to render.\n * @param {Element|DocumentFragment} Node into which to render.\n * @param {String} Element name.\n * @nocollapse\n */\n static render = render;\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the `css` tag function.\n */\n static styles?: CSSResult|CSSResultArray;\n\n private static _styles: CSSResult[]|undefined;\n\n /** @nocollapse */\n protected static finalize() {\n super.finalize();\n // Prepare styling that is stamped at first render time. Styling\n // is built from user provided `styles` or is inherited from the superclass.\n this._styles =\n this.hasOwnProperty(JSCompiler_renameProperty('styles', this)) ?\n this._getUniqueStyles() :\n this._styles || [];\n }\n\n /** @nocollapse */\n private static _getUniqueStyles(): CSSResult[] {\n // Take care not to call `this.styles` multiple times since this generates\n // new CSSResults each time.\n // TODO(sorvell): Since we do not cache CSSResults by input, any\n // shared styles will generate new stylesheet objects, which is wasteful.\n // This should be addressed when a browser ships constructable\n // stylesheets.\n const userStyles = this.styles;\n const styles: CSSResult[] = [];\n if (Array.isArray(userStyles)) {\n const flatStyles = flattenStyles(userStyles);\n // As a performance optimization to avoid duplicated styling that can\n // occur especially when composing via subclassing, de-duplicate styles\n // preserving the last item in the list. The last item is kept to\n // try to preserve cascade order with the assumption that it's most\n // important that last added styles override previous styles.\n const styleSet = flatStyles.reduceRight((set, s) => {\n set.add(s);\n // on IE set.add does not return the set.\n return set;\n }, new Set<CSSResult>());\n // Array.from does not work on Set in IE\n styleSet.forEach((v) => styles.unshift(v));\n } else if (userStyles) {\n styles.push(userStyles);\n }\n return styles;\n }\n\n private _needsShimAdoptedStyleSheets?: boolean;\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n */\n readonly renderRoot!: Element|DocumentFragment;\n\n /**\n * Performs element initialization. By default this calls `createRenderRoot`\n * to create the element `renderRoot` node and captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n super.initialize();\n (this as {renderRoot: Element | DocumentFragment}).renderRoot =\n this.createRenderRoot();\n // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n // element's getRootNode(). While this could be done, we're choosing not to\n // support this now since it would require different logic around de-duping.\n if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n this.adoptStyles();\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n * @returns {Element|DocumentFragment} Returns a node into which to render.\n */\n protected createRenderRoot(): Element|ShadowRoot {\n return this.attachShadow({mode: 'open'});\n }\n\n /**\n * Applies styling to the element shadowRoot using the `static get styles`\n * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n * available and will fallback otherwise. When Shadow DOM is polyfilled,\n * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n * is available but `adoptedStyleSheets` is not, styles are appended to the\n * end of the `shadowRoot` to [mimic spec\n * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n */\n protected adoptStyles() {\n const styles = (this.constructor as typeof LitElement)._styles!;\n if (styles.length === 0) {\n return;\n }\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it.\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.ScopingShim.prepareAdoptedCssText(\n styles.map((s) => s.cssText), this.localName);\n } else if (supportsAdoptingStyleSheets) {\n (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n styles.map((s) => s.styleSheet!);\n } else {\n // This must be done after rendering so the actual style insertion is done\n // in `update`.\n this._needsShimAdoptedStyleSheets = true;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n if (this.hasUpdated && window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * * @param _changedProperties Map of changed properties with old values\n */\n protected update(changedProperties: PropertyValues) {\n super.update(changedProperties);\n const templateResult = this.render() as unknown;\n if (templateResult instanceof TemplateResult) {\n (this.constructor as typeof LitElement)\n .render(\n templateResult,\n this.renderRoot,\n {scopeName: this.localName, eventContext: this});\n }\n // When native Shadow DOM is used but adoptedStyles are not supported,\n // insert styling after rendering to ensure adoptedStyles have highest\n // priority.\n if (this._needsShimAdoptedStyleSheets) {\n this._needsShimAdoptedStyleSheets = false;\n (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = s.cssText;\n this.renderRoot.appendChild(style);\n });\n }\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method must return\n * a lit-html TemplateResult. Setting properties inside this method will *not*\n * trigger the element to update.\n */\n protected render(): TemplateResult|void {\n }\n}\n"]} |
+2
-2
| { | ||
| "name": "lit-element", | ||
| "version": "2.0.1", | ||
| "description": "Polymer based lit-html custom element", | ||
| "version": "2.1.0", | ||
| "description": "A simple base class for creating fast, lightweight web components", | ||
| "license": "BSD-3-Clause", | ||
@@ -6,0 +6,0 @@ "repository": "Polymer/lit-element", |
+1
-1
@@ -25,3 +25,3 @@ # LitElement | ||
| // This decorator defines the element. | ||
| @customElement('my-element'); | ||
| @customElement('my-element') | ||
| export class MyElement extends LitElement { | ||
@@ -28,0 +28,0 @@ |
@@ -47,3 +47,3 @@ /** | ||
| toString(): String { | ||
| toString(): string { | ||
| return this.cssText; | ||
@@ -50,0 +50,0 @@ } |
+40
-37
@@ -1,2 +0,1 @@ | ||
| /** | ||
@@ -75,5 +74,4 @@ * @license | ||
| (typeof classOrDescriptor === 'function') ? | ||
| legacyCustomElement( | ||
| tagName, classOrDescriptor as Constructor<HTMLElement>) : | ||
| standardCustomElement(tagName, classOrDescriptor as ClassDescriptor); | ||
| legacyCustomElement(tagName, classOrDescriptor) : | ||
| standardCustomElement(tagName, classOrDescriptor); | ||
@@ -114,3 +112,3 @@ const standardProperty = | ||
| if (typeof element.initializer === 'function') { | ||
| this[element.key] = element.initializer!.call(this); | ||
| this[element.key] = element.initializer.call(this); | ||
| } | ||
@@ -128,3 +126,3 @@ }, | ||
| (proto.constructor as typeof UpdatingElement) | ||
| .createProperty(name!, options); | ||
| .createProperty(name, options); | ||
| }; | ||
@@ -150,5 +148,21 @@ | ||
| * executes a querySelector on the element's renderRoot. | ||
| * | ||
| * @ExportDecoratedItems | ||
| */ | ||
| export const query = _query( | ||
| (target: NodeSelector, selector: string) => target.querySelector(selector)); | ||
| export function query(selector: string) { | ||
| return (protoOrDescriptor: Object|ClassElement, | ||
| // tslint:disable-next-line:no-any decorator | ||
| name?: PropertyKey): any => { | ||
| const descriptor = { | ||
| get(this: LitElement) { | ||
| return this.renderRoot.querySelector(selector); | ||
| }, | ||
| enumerable: true, | ||
| configurable: true, | ||
| }; | ||
| return (name !== undefined) ? | ||
| legacyQuery(descriptor, protoOrDescriptor as Object, name) : | ||
| standardQuery(descriptor, protoOrDescriptor as ClassElement); | ||
| }; | ||
| } | ||
@@ -158,6 +172,21 @@ /** | ||
| * that executes a querySelectorAll on the element's renderRoot. | ||
| * | ||
| * @ExportDecoratedItems | ||
| */ | ||
| export const queryAll = _query( | ||
| (target: NodeSelector, selector: string) => | ||
| target.querySelectorAll(selector)); | ||
| export function queryAll(selector: string) { | ||
| return (protoOrDescriptor: Object|ClassElement, | ||
| // tslint:disable-next-line:no-any decorator | ||
| name?: PropertyKey): any => { | ||
| const descriptor = { | ||
| get(this: LitElement) { | ||
| return this.renderRoot.querySelectorAll(selector); | ||
| }, | ||
| enumerable: true, | ||
| configurable: true, | ||
| }; | ||
| return (name !== undefined) ? | ||
| legacyQuery(descriptor, protoOrDescriptor as Object, name) : | ||
| standardQuery(descriptor, protoOrDescriptor as ClassElement); | ||
| }; | ||
| } | ||
@@ -177,28 +206,2 @@ const legacyQuery = | ||
| /** | ||
| * Base-implementation of `@query` and `@queryAll` decorators. | ||
| * | ||
| * @param queryFn exectute a `selector` (ie, querySelector or querySelectorAll) | ||
| * against `target`. | ||
| * @suppress {visibility} The descriptor accesses an internal field on the | ||
| * element. | ||
| */ | ||
| function _query<T>(queryFn: (target: NodeSelector, selector: string) => T) { | ||
| return (selector: string) => | ||
| (protoOrDescriptor: Object|ClassElement, | ||
| // tslint:disable-next-line:no-any decorator | ||
| name?: PropertyKey): any => { | ||
| const descriptor = { | ||
| get(this: LitElement) { | ||
| return queryFn(this.renderRoot!, selector); | ||
| }, | ||
| enumerable: true, | ||
| configurable: true, | ||
| }; | ||
| return (name !== undefined) ? | ||
| legacyQuery(descriptor, protoOrDescriptor as Object, name) : | ||
| standardQuery(descriptor, protoOrDescriptor as ClassElement); | ||
| }; | ||
| } | ||
| const standardEventOptions = | ||
@@ -205,0 +208,0 @@ (options: AddEventListenerOptions, element: ClassElement) => { |
@@ -299,4 +299,3 @@ /** | ||
| get(): any { | ||
| // tslint:disable-next-line:no-any no symbol in index | ||
| return (this as any)[key]; | ||
| return this[key]; | ||
| }, | ||
@@ -308,3 +307,3 @@ set(this: UpdatingElement, value: unknown) { | ||
| (this as any)[key] = value; | ||
| this.requestUpdate(name, oldValue); | ||
| this._requestUpdate(name, oldValue); | ||
| }, | ||
@@ -447,2 +446,4 @@ configurable: true, | ||
| this._saveInstanceProperties(); | ||
| // ensures first update will be caught by an early access of `updateComplete` | ||
| this._requestUpdate(); | ||
| } | ||
@@ -491,3 +492,3 @@ | ||
| this._updateState = this._updateState | STATE_HAS_CONNECTED; | ||
| // Ensure connection triggers an update. Updates cannot complete before | ||
| // Ensure first connection completes an update. Updates cannot complete before | ||
| // connection and if one is pending connection the `_hasConnectionResolver` | ||
@@ -499,4 +500,2 @@ // will exist. If so, resolve it to complete the update, otherwise | ||
| this._hasConnectedResolver = undefined; | ||
| } else { | ||
| this.requestUpdate(); | ||
| } | ||
@@ -574,18 +573,10 @@ } | ||
| /** | ||
| * Requests an update which is processed asynchronously. This should | ||
| * be called when an element should update based on some state not triggered | ||
| * by setting a property. In this case, pass no arguments. It should also be | ||
| * called when manually implementing a property setter. In this case, pass the | ||
| * property `name` and `oldValue` to ensure that any configured property | ||
| * options are honored. Returns the `updateComplete` Promise which is resolved | ||
| * when the update completes. | ||
| * | ||
| * @param name {PropertyKey} (optional) name of requesting property | ||
| * @param oldValue {any} (optional) old value of requesting property | ||
| * @returns {Promise} A Promise that is resolved when the update completes. | ||
| * This private version of `requestUpdate` does not access or return the | ||
| * `updateComplete` promise. This promise can be overridden and is therefore | ||
| * not free to access. | ||
| */ | ||
| requestUpdate(name?: PropertyKey, oldValue?: unknown) { | ||
| private _requestUpdate(name?: PropertyKey, oldValue?: unknown) { | ||
| let shouldRequestUpdate = true; | ||
| // if we have a property key, perform property update steps. | ||
| if (name !== undefined && !this._changedProperties.has(name)) { | ||
| // If we have a property key, perform property update steps. | ||
| if (name !== undefined) { | ||
| const ctor = this.constructor as typeof UpdatingElement; | ||
@@ -596,5 +587,9 @@ const options = | ||
| this[name as keyof this], oldValue, options.hasChanged)) { | ||
| // track old value when changing. | ||
| this._changedProperties.set(name, oldValue); | ||
| // add to reflecting properties set | ||
| if (!this._changedProperties.has(name)) { | ||
| this._changedProperties.set(name, oldValue); | ||
| } | ||
| // Add to reflecting properties set. | ||
| // Note, it's important that every change has a chance to add the | ||
| // property to `_reflectingProperties`. This ensures setting | ||
| // attribute + property reflects correctly. | ||
| if (options.reflect === true && | ||
@@ -607,4 +602,4 @@ !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) { | ||
| } | ||
| // abort the request if the property should not be considered changed. | ||
| } else { | ||
| // Abort the request if the property should not be considered changed. | ||
| shouldRequestUpdate = false; | ||
@@ -616,2 +611,19 @@ } | ||
| } | ||
| } | ||
| /** | ||
| * Requests an update which is processed asynchronously. This should | ||
| * be called when an element should update based on some state not triggered | ||
| * by setting a property. In this case, pass no arguments. It should also be | ||
| * called when manually implementing a property setter. In this case, pass the | ||
| * property `name` and `oldValue` to ensure that any configured property | ||
| * options are honored. Returns the `updateComplete` Promise which is resolved | ||
| * when the update completes. | ||
| * | ||
| * @param name {PropertyKey} (optional) name of requesting property | ||
| * @param oldValue {any} (optional) old value of requesting property | ||
| * @returns {Promise} A Promise that is resolved when the update completes. | ||
| */ | ||
| requestUpdate(name?: PropertyKey, oldValue?: unknown) { | ||
| this._requestUpdate(name, oldValue); | ||
| return this.updateComplete; | ||
@@ -626,8 +638,17 @@ } | ||
| this._updateState = this._updateState | STATE_UPDATE_REQUESTED; | ||
| let resolve: (r: boolean) => void; | ||
| let resolve!: (r: boolean) => void; | ||
| let reject!: (e: Error) => void; | ||
| const previousUpdatePromise = this._updatePromise; | ||
| this._updatePromise = new Promise((res) => resolve = res); | ||
| // Ensure any previous update has resolved before updating. | ||
| // This `await` also ensures that property changes are batched. | ||
| await previousUpdatePromise; | ||
| this._updatePromise = new Promise((res, rej) => { | ||
| resolve = res; | ||
| reject = rej; | ||
| }); | ||
| try { | ||
| // Ensure any previous update has resolved before updating. | ||
| // This `await` also ensures that property changes are batched. | ||
| await previousUpdatePromise; | ||
| } catch (e) { | ||
| // Ignore any previous errors. We only care that the previous cycle is | ||
| // done. Any error should have been handled in the previous update. | ||
| } | ||
| // Make sure the element has connected before updating. | ||
@@ -637,11 +658,14 @@ if (!this._hasConnected) { | ||
| } | ||
| // Allow `performUpdate` to be asynchronous to enable scheduling of updates. | ||
| const result = this.performUpdate(); | ||
| // Note, this is to avoid delaying an additional microtask unless we need | ||
| // to. | ||
| if (result != null && | ||
| typeof (result as PromiseLike<unknown>).then === 'function') { | ||
| await result; | ||
| try { | ||
| const result = this.performUpdate(); | ||
| // If `performUpdate` returns a Promise, we await it. This is done to | ||
| // enable coordinating updates with a scheduler. Note, the result is | ||
| // checked to avoid delaying an additional microtask unless we need to. | ||
| if (result != null) { | ||
| await result; | ||
| } | ||
| } catch (e) { | ||
| reject(e); | ||
| } | ||
| resolve!(!this._hasRequestedUpdate); | ||
| resolve(!this._hasRequestedUpdate); | ||
| } | ||
@@ -662,7 +686,10 @@ | ||
| /** | ||
| * Performs an element update. | ||
| * Performs an element update. Note, if an exception is thrown during the | ||
| * update, `firstUpdated` and `updated` will not be called. | ||
| * | ||
| * You can override this method to change the timing of updates. For instance, | ||
| * to schedule updates to occur just before the next frame: | ||
| * You can override this method to change the timing of updates. If this | ||
| * method is overridden, `super.performUpdate()` must be called. | ||
| * | ||
| * For instance, to schedule updates to occur just before the next frame: | ||
| * | ||
| * ``` | ||
@@ -680,6 +707,19 @@ * protected async performUpdate(): Promise<unknown> { | ||
| } | ||
| if (this.shouldUpdate(this._changedProperties)) { | ||
| const changedProperties = this._changedProperties; | ||
| this.update(changedProperties); | ||
| let shouldUpdate = false; | ||
| const changedProperties = this._changedProperties; | ||
| try { | ||
| shouldUpdate = this.shouldUpdate(changedProperties); | ||
| if (shouldUpdate) { | ||
| this.update(changedProperties); | ||
| } | ||
| } catch (e) { | ||
| // Prevent `firstUpdated` and `updated` from running when there's an | ||
| // update exception. | ||
| shouldUpdate = false; | ||
| throw e; | ||
| } finally { | ||
| // Ensure element can accept additional updates after an exception. | ||
| this._markUpdated(); | ||
| } | ||
| if (shouldUpdate) { | ||
| if (!(this._updateState & STATE_HAS_UPDATED)) { | ||
@@ -690,4 +730,2 @@ this._updateState = this._updateState | STATE_HAS_UPDATED; | ||
| this.updated(changedProperties); | ||
| } else { | ||
| this._markUpdated(); | ||
| } | ||
@@ -705,3 +743,4 @@ } | ||
| * update without triggering another update. The Promise result is `false` if | ||
| * a property was set inside `updated()`. This getter can be implemented to | ||
| * a property was set inside `updated()`. If the Promise is rejected, an | ||
| * exception was thrown during the update. This getter can be implemented to | ||
| * await additional state. For example, it is sometimes useful to await a | ||
@@ -708,0 +747,0 @@ * rendered element before fulfilling this Promise. To do this, first await |
@@ -15,3 +15,3 @@ /** | ||
| import {TemplateResult} from 'lit-html'; | ||
| import {render} from 'lit-html/lib/shady-render'; | ||
| import {render} from 'lit-html/lib/shady-render.js'; | ||
@@ -22,3 +22,3 @@ import {PropertyValues, UpdatingElement} from './lib/updating-element.js'; | ||
| export * from './lib/decorators.js'; | ||
| export {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html'; | ||
| export {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js'; | ||
| import {supportsAdoptingStyleSheets, CSSResult} from './lib/css-tag.js'; | ||
@@ -122,3 +122,3 @@ export * from './lib/css-tag.js'; | ||
| // Array.from does not work on Set in IE | ||
| styleSet.forEach((v) => styles!.unshift(v)); | ||
| styleSet.forEach((v) => styles.unshift(v)); | ||
| } else if (userStyles) { | ||
@@ -136,3 +136,3 @@ styles.push(userStyles); | ||
| */ | ||
| protected renderRoot?: Element|DocumentFragment; | ||
| readonly renderRoot!: Element|DocumentFragment; | ||
@@ -146,3 +146,4 @@ /** | ||
| super.initialize(); | ||
| this.renderRoot = this.createRenderRoot(); | ||
| (this as {renderRoot: Element | DocumentFragment}).renderRoot = | ||
| this.createRenderRoot(); | ||
| // Note, if renderRoot is not a shadowRoot, styles would/could apply to the | ||
@@ -221,4 +222,4 @@ // element's getRootNode(). While this could be done, we're choosing not to | ||
| templateResult, | ||
| this.renderRoot!, | ||
| {scopeName: this.localName!, eventContext: this}); | ||
| this.renderRoot, | ||
| {scopeName: this.localName, eventContext: this}); | ||
| } | ||
@@ -233,3 +234,3 @@ // When native Shadow DOM is used but adoptedStyles are not supported, | ||
| style.textContent = s.cssText; | ||
| this.renderRoot!.appendChild(style); | ||
| this.renderRoot.appendChild(style); | ||
| }); | ||
@@ -236,0 +237,0 @@ } |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
215373
3.04%2905
3.9%