lit-element
Advanced tools
Comparing version
@@ -61,2 +61,4 @@ /** | ||
const DEV_MODE = true; | ||
// Allows minifiers to rename references to globalThis | ||
const global = globalThis; | ||
let issueWarning; | ||
@@ -66,9 +68,14 @@ if (DEV_MODE) { | ||
// are loaded. | ||
const issuedWarnings = (globalThis.litIssuedWarnings ??= new Set()); | ||
// Issue a warning, if we haven't already. | ||
global.litIssuedWarnings ??= new Set(); | ||
/** | ||
* Issue a warning if we haven't already, based either on `code` or `warning`. | ||
* Warnings are disabled automatically only by `warning`; disabling via `code` | ||
* can be done by users. | ||
*/ | ||
issueWarning = (code, warning) => { | ||
warning += ` See https://lit.dev/msg/${code} for more information.`; | ||
if (!issuedWarnings.has(warning)) { | ||
if (!global.litIssuedWarnings.has(warning) && | ||
!global.litIssuedWarnings.has(code)) { | ||
console.warn(warning); | ||
issuedWarnings.add(warning); | ||
global.litIssuedWarnings.add(warning); | ||
} | ||
@@ -195,7 +202,7 @@ }; | ||
// Install hydration if available | ||
globalThis.litElementHydrateSupport?.({ LitElement }); | ||
global.litElementHydrateSupport?.({ LitElement }); | ||
// Apply polyfills if available | ||
const polyfillSupport = DEV_MODE | ||
? globalThis.litElementPolyfillSupportDevMode | ||
: globalThis.litElementPolyfillSupport; | ||
? global.litElementPolyfillSupportDevMode | ||
: global.litElementPolyfillSupport; | ||
polyfillSupport?.({ LitElement }); | ||
@@ -230,7 +237,9 @@ /** | ||
// This line will be used in regexes to search for LitElement usage. | ||
(globalThis.litElementVersions ??= []).push('4.1.1'); | ||
if (DEV_MODE && globalThis.litElementVersions.length > 1) { | ||
issueWarning('multiple-versions', `Multiple versions of Lit loaded. Loading multiple versions ` + | ||
`is not recommended.`); | ||
(global.litElementVersions ??= []).push('4.2.0'); | ||
if (DEV_MODE && global.litElementVersions.length > 1) { | ||
queueMicrotask(() => { | ||
issueWarning('multiple-versions', `Multiple versions of Lit loaded. Loading multiple versions ` + | ||
`is not recommended.`); | ||
}); | ||
} | ||
//# sourceMappingURL=lit-element.js.map |
@@ -1,2 +0,2 @@ | ||
import{ReactiveElement as t}from"@lit/reactive-element";export*from"@lit/reactive-element";import{render as e,noChange as s}from"lit-html";export*from"lit-html"; | ||
import{ReactiveElement as t}from"@lit/reactive-element";export*from"@lit/reactive-element";import{render as e,noChange as r}from"lit-html";export*from"lit-html"; | ||
/** | ||
@@ -6,3 +6,3 @@ * @license | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/class r extends t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=e(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return s}}r._$litElement$=!0,r["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r});const i=globalThis.litElementPolyfillSupport;i?.({LitElement:r});const o={_$AK:(t,e,s)=>{t._$AK(e,s)},_$AL:t=>t._$AL};(globalThis.litElementVersions??=[]).push("4.1.1");export{r as LitElement,o as _$LE}; | ||
*/const s=globalThis;class i extends t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=e(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return r}}i._$litElement$=!0,i["finalized"]=!0,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});const n={_$AK:(t,e,r)=>{t._$AK(e,r)},_$AL:t=>t._$AL};(s.litElementVersions??=[]).push("4.2.0");export{i as LitElement,n as _$LE}; | ||
//# sourceMappingURL=lit-element.js.map |
{ | ||
"name": "lit-element", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"publishConfig": { | ||
@@ -11,3 +11,3 @@ "access": "public" | ||
"type": "git", | ||
"url": "https://github.com/lit/lit.git", | ||
"url": "git+https://github.com/lit/lit.git", | ||
"directory": "packages/lit-element" | ||
@@ -253,4 +253,4 @@ }, | ||
"@lit-labs/ssr-dom-shim": "^1.2.0", | ||
"@lit/reactive-element": "^2.0.4", | ||
"lit-html": "^3.2.0" | ||
"@lit/reactive-element": "^2.1.0", | ||
"lit-html": "^3.3.0" | ||
}, | ||
@@ -257,0 +257,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
123325
0.87%1049
0.87%Updated
Updated