diff --git a/resources/todomvc/architecture-examples/lit/dist/index.js b/resources/todomvc/architecture-examples/lit/dist/index.js index a209c647c..bda40dcb2 100644 --- a/resources/todomvc/architecture-examples/lit/dist/index.js +++ b/resources/todomvc/architecture-examples/lit/dist/index.js @@ -1,65 +1,70 @@ -function t(t,e,i,o){var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r +function t(t,e,s,i,o,n){function r(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,l=i.kind,d="getter"===l?"get":"setter"===l?"set":"value",c=!e&&t?i.static?t:t.prototype:null,h=e||(c?Object.getOwnPropertyDescriptor(c,i.name):{}),p=!1,u=s.length-1;u>=0;u--){var g={};for(var f in i)g[f]="access"===f?{}:i[f];for(var f in i.access)g.access[f]=i.access[f];g.addInitializer=function(t){if(p)throw new TypeError("Cannot add initializers after decoration has completed");n.push(r(t||null))};var m=(0,s[u])("accessor"===l?{get:h.get,set:h.set}:h[d],g);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=r(m.get))&&(h.get=a),(a=r(m.set))&&(h.set=a),(a=r(m.init))&&o.unshift(a)}else(a=r(m))&&("field"===l?o.unshift(a):h[d]=a)}c&&Object.defineProperty(c,i.name,h),p=!0}function e(t,e,s){for(var i=arguments.length>2,o=0;onew n("string"==typeof t?t:t+"",void 0,o),l=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new n(i,t,o)},a=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return r(e)})(t):t + */ +const s=globalThis,i=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),n=new WeakMap;class r{constructor(t,e,s){if(this._$cssResult$=!0,s!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=n.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&n.set(e,t))}return t}toString(){return this.cssText}}const a=t=>new r("string"==typeof t?t:t+"",void 0,o),l=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,s,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[i+1]),t[0]);return new r(s,t,o)},d=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return a(e)})(t):t /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */,d=globalThis,h=d.trustedTypes,c=h?h.emptyScript:"",p=d.reactiveElementPolyfillSupport,u={toAttribute(t,e){switch(e){case Boolean:t=t?c:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},g=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:g},m="finalized";class $ extends HTMLElement{static addInitializer(t){this.finalize(),(this.i??=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];for(const[e,i]of this.elementProperties){const o=this._$El(e,i);void 0!==o&&(this._$Eh.set(o,e),t.push(o))}return t}static createProperty(t,e=f){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=Symbol(),o=this.getPropertyDescriptor(t,i,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(o){const s=this[t];this[e]=o,this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty(m))return!1;this[m]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.i&&(this.i=[...t.i]),this.elementProperties=new Map(t.elementProperties),this._$Eh=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$El(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this.v()}v(){this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),this.constructor.i?.forEach((t=>t(this)))}addController(t){(this._$ES??=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$ES?.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){const t=this.constructor.elementProperties;for(const e of t.keys())this.hasOwnProperty(e)&&(this._$Ep.set(e,this[e]),delete this[e])}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,o)=>{if(i)t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of o){const o=document.createElement("style"),s=e.litNonce;void 0!==s&&o.setAttribute("nonce",s),o.textContent=i.cssText,t.appendChild(o)}})(t,this.constructor.elementStyles),t}connectedCallback(){void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$ES?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$ES?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=f){const o=this.constructor._$El(t,i);if(void 0!==o&&!0===i.reflect){const s=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(e,i.type);this._$Em=t,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,e){const i=this.constructor,o=i._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=i.getPropertyOptions(o),s="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=o,this[o]=s.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i){let o=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||g)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Em!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;this.hasUpdated,this._$Ep&&=this._$Ep.forEach(((t,e)=>this[e]=t));let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$ES?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$ES?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC&&=this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$Ek()}updated(t){}firstUpdated(t){}}$[m]=!0,$.elementProperties=new Map,$.elementStyles=[],$.shadowRootOptions={mode:"open"},p?.({ReactiveElement:$}),(d.reactiveElementVersions??=[]).push("2.0.0-pre.0"); + */,{is:c,defineProperty:h,getOwnPropertyDescriptor:p,getOwnPropertyNames:u,getOwnPropertySymbols:g,getPrototypeOf:f}=Object,m=globalThis,b=m.trustedTypes,_=b?b.emptyScript:"",$=m.reactiveElementPolyfillSupport,v=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?_:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},x=(t,e)=>!c(t,e),A={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:x};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;class w extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=A){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&h(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const n=i?.call(this);o?.call(this,e),this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??A}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...u(t),...g(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(i)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),o=s.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:y).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=i,this[i]=o.fromAttribute(e,t.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??x)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),!0!==o||void 0!==n)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[v("elementProperties")]=new Map,w[v("finalized")]=new Map,$?.({ReactiveElement:w}),(m.reactiveElementVersions??=[]).push("2.1.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const b=globalThis,v=void 0,y=b.trustedTypes,_=y?y.createPolicy("lit-html",{createHTML:t=>t}):void 0,x="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,w="?"+A,E=`<${w}>`,C=document,k=()=>C.createComment(""),S=t=>null===t||"object"!=typeof t&&"function"!=typeof t,L=Array.isArray,T=t=>L(t)||"function"==typeof t?.[Symbol.iterator],P="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,H=/>/g,D=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),O=/'/g,M=/"/g,R=/^(?:script|style|textarea|title)$/i,z=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),I=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),B=new WeakMap,F=C.createTreeWalker(C,129),V=(t,e)=>{const i=t.length-1,o=[];let s,n=2===e?"":"",r=U;for(let e=0;e"===a[0]?(r=s??U,d=-1):void 0===a[1]?d=-2:(d=r.lastIndex-a[2].length,l=a[1],r=void 0===a[3]?D:'"'===a[3]?M:O):r===M||r===O?r=D:r===N||r===H?r=U:(r=D,s=void 0);const c=r===D&&t[e+1].startsWith("/>")?" ":"";n+=r===U?i+E:d>=0?(o.push(l),i.slice(0,d)+x+i.slice(d)+A+c):i+A+(-2===d?e:c)}const l=n+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==_?_.createHTML(l):l,o]};class W{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let s=0,n=0;const r=t.length-1,l=this.parts,[a,d]=V(t,e);if(this.el=W.createElement(a,i),F.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(o=F.nextNode())&&l.length0){o.textContent=y?y.emptyScript:"";for(let i=0;i2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=j}_$AI(t,e=this,i,o){const s=this.strings;let n=!1;if(void 0===s)t=q(this,t,e,0),n=!S(t)||t!==this._$AH&&t!==I,n&&(this._$AH=t);else{const o=t;let r,l;for(t=s[0],r=0;rt}):void 0,L="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+k,P=`<${T}>`,O=document,U=()=>O.createComment(""),N=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,D=t=>M(t)||"function"==typeof t?.[Symbol.iterator],I="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,z=/>/g,R=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),B=/'/g,F=/"/g,q=/^(?:script|style|textarea|title)$/i,W=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),V=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),J=new WeakMap,Z=O.createTreeWalker(O,129);function Q(t,e){if(!M(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const G=(t,e)=>{const s=t.length-1,i=[];let o,n=2===e?"":3===e?"":"",r=H;for(let e=0;e"===l[0]?(r=o??H,d=-1):void 0===l[1]?d=-2:(d=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?R:'"'===l[3]?F:B):r===F||r===B?r=R:r===j||r===z?r=H:(r=R,o=void 0);const h=r===R&&t[e+1].startsWith("/>")?" ":"";n+=r===H?s+P:d>=0?(i.push(a),s.slice(0,d)+L+s.slice(d)+k+h):s+k+(-2===d?e:h)}return[Q(t,n+(t[s]||"")+(2===e?"":3===e?"":"")),i]};class X{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const r=t.length-1,a=this.parts,[l,d]=G(t,e);if(this.el=X.createElement(l,s),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=Z.nextNode())&&a.length0){i.textContent=C?C.emptyScript:"";for(let s=0;s2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=K}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(void 0===o)t=Y(this,t,e,0),n=!N(t)||t!==this._$AH&&t!==V,n&&(this._$AH=t);else{const i=t;let r,a;for(t=o[0],r=0;r{const o=i?.renderBefore??e;let s=o._$litPart$;if(v?.({kind:"begin render",id:0,value:t,container:e,options:i,part:s}),void 0===s){const t=i?.renderBefore??null;o._$litPart$=s=new J(e.insertBefore(k(),t),t,void 0,i??{})}return s._$AI(t),v?.({kind:"end render",id:0,value:t,container:e,options:i,part:s}),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return I}}it.finalized=!0,it._$litElement$=!0,globalThis.litElementHydrateSupport?.({LitElement:it});const ot=globalThis.litElementPolyfillSupport;ot?.({LitElement:it}),(globalThis.litElementVersions??=[]).push("4.0.0-pre.0"); + */class ct extends w{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 e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const i=s?.renderBefore??e;let o=i._$litPart$;if(void 0===o){const t=s?.renderBefore??null;i._$litPart$=o=new et(e.insertBefore(U(),t),t,void 0,s??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}}ct._$litElement$=!0,ct.finalized=!0,dt.litElementHydrateSupport?.({LitElement:ct});const ht=dt.litElementPolyfillSupport;ht?.({LitElement:ct}),(dt.litElementVersions??=[]).push("4.2.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const st=1,nt=2,rt=t=>(...e)=>({_$litDirective$:t,values:e});class lt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} +const pt=1,ut=2,gt=t=>(...e)=>({_$litDirective$:t,values:e});class ft{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const at=rt(class extends lt{constructor(t){if(super(t),t.type!==st||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.st=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.st?.has(t)&&this.it.add(t);return this.render(e)}const i=t.element.classList;for(const t of this.it)t in e||(i.remove(t),this.it.delete(t));for(const t in e){const o=!!e[t];o===this.it.has(t)||this.st?.has(t)||(o?(i.add(t),this.it.add(t)):(i.remove(t),this.it.delete(t)))}return I}}),dt=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){customElements.define(t,e)}}})(t,e) + */const mt=gt(class extends ft{constructor(t){if(super(t),t.type!==pt||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const s=t.element.classList;for(const t of this.st)t in e||(s.remove(t),this.st.delete(t));for(const t in e){const i=!!e[t];i===this.st.has(t)||this.nt?.has(t)||(i?(s.add(t),this.st.add(t)):(s.remove(t),this.st.delete(t)))}return V}}),bt=t=>(e,s)=>{void 0!==s?s.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */,ht=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},ct=(t,e,i)=>{e.constructor.createProperty(i,t)}; + */,_t={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:x},$t=(t=_t,e,s)=>{const{kind:i,metadata:o}=s;let n=globalThis.litPropertyMetadata.get(o);if(void 0===n&&globalThis.litPropertyMetadata.set(o,n=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),n.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const o=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,o,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=s;return function(s){const o=this[i];e.call(this,s),this.requestUpdate(i,o,t)}}throw Error("Unsupported decorator location: "+i)}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */function pt(t){return(e,i)=>void 0!==i?ct(t,e,i):ht(t,e) + */function vt(t){return(e,s)=>"object"==typeof s?$t(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s) /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */}function ut(t){return pt({...t,state:!0})}const gt=l`button{margin:0;padding:0;border:0;background:0 0;font-size:100%;vertical-align:baseline;font-family:inherit;font-weight:inherit;color:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.toggle-all:focus+label,.toggle:focus+label,:focus{box-shadow:0 0 2px 2px #cf7d7d;outline:0}.edit,.new-todo{position:relative;margin:0;width:100%;font-size:24px;font-family:inherit;font-weight:inherit;line-height:1.4em;border:0;color:inherit;padding:6px;border:1px solid #999;box-shadow:inset 0 -1px 5px 0 rgba(0,0,0,.2);box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.new-todo{padding:16px 16px 16px 60px;border:none;background:rgba(0,0,0,.003);box-shadow:inset 0 -2px 1px rgba(0,0,0,.03)}@media screen and (-webkit-min-device-pixel-ratio:0){.toggle-all,li .toggle{background:0 0}li .toggle{height:40px}}@media (max-width:430px){.footer{height:50px}.filters{bottom:10px}}`;function ft(t=21){let e="",i=t;for(;i--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return e}const mt=["all","active","completed"];class $t extends EventTarget{#t=[];#e=this.#i();get all(){return this.#t}get active(){return this.#t.filter((t=>!t.completed))}get completed(){return this.#t.filter((t=>t.completed))}get allCompleted(){return this.#t.every((t=>t.completed))}connect(){window.addEventListener("hashchange",this.#o)}disconnect(){window.removeEventListener("hashchange",this.#o)}filtered(){switch(this.#e){case"active":return this.active;case"completed":return this.completed}return this.all}#s(){this.dispatchEvent(new Event("change"))}add(t){this.#t.push({text:t,completed:!1,id:ft()}),this.#s()}delete(t){const e=this.#t.findIndex((e=>e.id===t));this.#t.splice(e>>>0,1),this.#s()}update(t){const e=this.#t.find((e=>e.id===t.id));void 0!==e&&(Object.assign(e,t),this.#s())}toggle(t){const e=this.#t.find((e=>e.id===t));void 0!==e&&(e.completed=!e.completed,this.#s())}toggleAll(){const t=this.#t.every((t=>t.completed));this.#t=this.#t.map((e=>({...e,completed:!t}))),this.#s()}clearCompleted(){this.#t=this.active,this.#s()}get filter(){return this.#e}set filter(t){this.#e=t,this.#s()}#o=()=>{this.filter=this.#i()};#i(){let t=/#\/(.*)/.exec(window.location.hash)?.[1];return e=t,mt.includes(e)?t:"all";var e}} + */}function yt(t){return vt({...t,state:!0,attribute:!1})}const xt=l`button{margin:0;padding:0;border:0;background:0 0;font-size:100%;vertical-align:baseline;font-family:inherit;font-weight:inherit;color:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.toggle-all:focus+label,.toggle:focus+label,:focus{box-shadow:0 0 2px 2px #cf7d7d;outline:0}.edit,.new-todo{position:relative;margin:0;width:100%;font-size:24px;font-family:inherit;font-weight:inherit;line-height:1.4em;border:0;color:inherit;padding:6px;border:1px solid #999;box-shadow:inset 0 -1px 5px 0 rgba(0,0,0,.2);box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.new-todo{padding:16px 16px 16px 60px;border:none;background:rgba(0,0,0,.003);box-shadow:inset 0 -2px 1px rgba(0,0,0,.03)}@media screen and (-webkit-min-device-pixel-ratio:0){.toggle-all,li .toggle{background:0 0}li .toggle{height:40px}}@media (max-width:430px){.footer{height:50px}.filters{bottom:10px}}`;function At(t=21){let e="",s=t;for(;s--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return e}const wt=["all","active","completed"];class Et extends EventTarget{#t=[];#e=this.#s();get all(){return this.#t}get active(){return this.#t.filter((t=>!t.completed))}get completed(){return this.#t.filter((t=>t.completed))}get allCompleted(){return this.#t.every((t=>t.completed))}connect(){window.addEventListener("hashchange",this.#i)}disconnect(){window.removeEventListener("hashchange",this.#i)}filtered(){switch(this.#e){case"active":return this.active;case"completed":return this.completed}return this.all}#o(){this.dispatchEvent(new Event("change"))}add(t){this.#t.push({text:t,completed:!1,id:At()}),this.#o()}delete(t){const e=this.#t.findIndex((e=>e.id===t));this.#t.splice(e>>>0,1),this.#o()}update(t){const e=this.#t.find((e=>e.id===t.id));void 0!==e&&(Object.assign(e,t),this.#o())}toggle(t){const e=this.#t.find((e=>e.id===t));void 0!==e&&(e.completed=!e.completed,this.#o())}toggleAll(){const t=this.#t.every((t=>t.completed));this.#t=this.#t.map((e=>({...e,completed:!t}))),this.#o()}clearCompleted(){this.#t=this.active,this.#o()}get filter(){return this.#e}set filter(t){this.#e=t,this.#o()}#i=()=>{this.filter=this.#s()};#s(){let t=/#\/(.*)/.exec(window.location.hash)?.[1];return e=t,wt.includes(e)?t:"all";var e}} /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */const{R:bt}=tt,vt=()=>document.createComment(""),yt=(t,e,i)=>{const o=t._$AA.parentNode,s=void 0===e?t._$AB:e._$AA;if(void 0===i){const e=o.insertBefore(vt(),s),n=o.insertBefore(vt(),s);i=new bt(e,n,t,t.options)}else{const e=i._$AB.nextSibling,n=i._$AM,r=n!==t;if(r){let e;i._$AQ?.(t),i._$AM=t,void 0!==i._$AP&&(e=t._$AU)!==n._$AU&&i._$AP(e)}if(e!==s||r){let t=i._$AA;for(;t!==e;){const e=t.nextSibling;o.insertBefore(t,s),t=e}}}return i},_t=(t,e,i=t)=>(t._$AI(e,i),t),xt={},At=(t,e=xt)=>t._$AH=e,wt=t=>{t._$AP?.(!1,!0);let e=t._$AA;const i=t._$AB.nextSibling;for(;e!==i;){const t=e.nextSibling;e.remove(),e=t}},Et=(t,e,i)=>{const o=new Map;for(let s=e;s<=i;s++)o.set(t[s],s);return o},Ct=rt(class extends lt{constructor(t){if(super(t),t.type!==nt)throw Error("repeat() can only be used in text expressions")}ht(t,e,i){let o;void 0===i?i=e:void 0!==e&&(o=e);const s=[],n=[];let r=0;for(const e of t)s[r]=o?o(e,r):r,n[r]=i(e,r),r++;return{values:n,keys:s}}render(t,e,i){return this.ht(t,e,i).values}update(t,[e,i,o]){const s=(t=>t._$AH)(t),{values:n,keys:r}=this.ht(e,i,o);if(!Array.isArray(s))return this.dt=r,n;const l=this.dt??=[],a=[];let d,h,c=0,p=s.length-1,u=0,g=n.length-1;for(;c<=p&&u<=g;)if(null===s[c])c++;else if(null===s[p])p--;else if(l[c]===r[u])a[u]=_t(s[c],n[u]),c++,u++;else if(l[p]===r[g])a[g]=_t(s[p],n[g]),p--,g--;else if(l[c]===r[g])a[g]=_t(s[c],n[g]),yt(t,a[g+1],s[c]),c++,g--;else if(l[p]===r[u])a[u]=_t(s[p],n[u]),yt(t,s[c],s[p]),p--,u++;else if(void 0===d&&(d=Et(r,u,g),h=Et(l,c,p)),d.has(l[c]))if(d.has(l[p])){const e=h.get(r[u]),i=void 0!==e?s[e]:null;if(null===i){const e=yt(t,s[c]);_t(e,n[u]),a[u]=e}else a[u]=_t(i,n[u]),yt(t,s[c],i),s[e]=null;u++}else wt(s[p]),p--;else wt(s[c]),c++;for(;u<=g;){const e=yt(t,a[g+1]);_t(e,n[u]),a[u++]=e}for(;c<=p;){const t=s[c++];null!==t&&wt(t)}return this.dt=r,At(t,a),I}}); + */const{I:Ct}=at,St=()=>document.createComment(""),Lt=(t,e,s)=>{const i=t._$AA.parentNode,o=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=i.insertBefore(St(),o),n=i.insertBefore(St(),o);s=new Ct(e,n,t,t.options)}else{const e=s._$AB.nextSibling,n=s._$AM,r=n!==t;if(r){let e;s._$AQ?.(t),s._$AM=t,void 0!==s._$AP&&(e=t._$AU)!==n._$AU&&s._$AP(e)}if(e!==o||r){let t=s._$AA;for(;t!==e;){const e=t.nextSibling;i.insertBefore(t,o),t=e}}}return s},kt=(t,e,s=t)=>(t._$AI(e,s),t),Tt={},Pt=t=>{t._$AP?.(!1,!0);let e=t._$AA;const s=t._$AB.nextSibling;for(;e!==s;){const t=e.nextSibling;e.remove(),e=t}},Ot=(t,e,s)=>{const i=new Map;for(let o=e;o<=s;o++)i.set(t[o],o);return i},Ut=gt(class extends ft{constructor(t){if(super(t),t.type!==ut)throw Error("repeat() can only be used in text expressions")}dt(t,e,s){let i;void 0===s?s=e:void 0!==e&&(i=e);const o=[],n=[];let r=0;for(const e of t)o[r]=i?i(e,r):r,n[r]=s(e,r),r++;return{values:n,keys:o}}render(t,e,s){return this.dt(t,e,s).values}update(t,[e,s,i]){const o=(t=>t._$AH)(t),{values:n,keys:r}=this.dt(e,s,i);if(!Array.isArray(o))return this.ut=r,n;const a=this.ut??=[],l=[];let d,c,h=0,p=o.length-1,u=0,g=n.length-1;for(;h<=p&&u<=g;)if(null===o[h])h++;else if(null===o[p])p--;else if(a[h]===r[u])l[u]=kt(o[h],n[u]),h++,u++;else if(a[p]===r[g])l[g]=kt(o[p],n[g]),p--,g--;else if(a[h]===r[g])l[g]=kt(o[h],n[g]),Lt(t,l[g+1],o[h]),h++,g--;else if(a[p]===r[u])l[u]=kt(o[p],n[u]),Lt(t,o[h],o[p]),p--,u++;else if(void 0===d&&(d=Ot(r,u,g),c=Ot(a,h,p)),d.has(a[h]))if(d.has(a[p])){const e=c.get(r[u]),s=void 0!==e?o[e]:null;if(null===s){const e=Lt(t,o[h]);kt(e,n[u]),l[u]=e}else l[u]=kt(s,n[u]),Lt(t,o[h],s),o[e]=null;u++}else Pt(o[p]),p--;else Pt(o[h]),h++;for(;u<=g;){const e=Lt(t,l[g+1]);kt(e,n[u]),l[u++]=e}for(;h<=p;){const t=o[h++];null!==t&&Pt(t)}return this.ut=r,((t,e=Tt)=>{t._$AH=e})(t,l),V}}); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */class kt extends Event{static{this.eventName="todo-add"}constructor(t){super(kt.eventName,{bubbles:!0,composed:!0}),this.text=t}}class St extends Event{static{this.eventName="todo-delete"}constructor(t){super(St.eventName,{bubbles:!0,composed:!0}),this.id=t}}class Lt extends Event{static{this.eventName="todo-edit"}constructor(t){super(Lt.eventName,{bubbles:!0,composed:!0}),this.edit=t}}class Tt extends Event{static{this.eventName="todo-toggle-all"}constructor(){super(Tt.eventName,{bubbles:!0,composed:!0})}}class Pt extends Event{static{this.eventName="clear-completed"}constructor(){super(Pt.eventName,{bubbles:!0,composed:!0})}}let Ut=class extends it{constructor(){super(...arguments),this.todoId="",this.text="",this.completed=!1,this.isEditing=!1}static{this.styles=[gt,l`:host{display:block}li{position:relative;font-size:24px}.editing{border-bottom:none;padding:0}.editing .edit{display:block;width:calc(100% - 43px);padding:12px 16px;margin:0 0 0 43px}.editing .view{display:none}.toggle{text-align:center;width:40px;height:auto;position:absolute;top:0;bottom:0;margin:auto 0;border:none;-webkit-appearance:none;appearance:none}.toggle{opacity:0}.toggle+label{background-image:url(data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23949494%22%20stroke-width%3D%223%22/%3E%3C/svg%3E);background-repeat:no-repeat;background-position:center left}.toggle:checked+label{background-image:url(data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%2359A193%22%20stroke-width%3D%223%22%2F%3E%3Cpath%20fill%3D%22%233EA390%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22%2F%3E%3C%2Fsvg%3E)}label{word-break:break-all;padding:15px 15px 15px 60px;display:block;line-height:1.2;transition:color .4s;font-weight:400;color:#484848}.completed label{color:#949494;text-decoration:line-through}.destroy{display:none;position:absolute;top:0;right:10px;bottom:0;width:40px;height:40px;margin:auto 0;font-size:30px;color:#949494;transition:color .2s ease-out}.destroy:focus,.destroy:hover{color:#c18585}.destroy:after{content:"×";display:block;height:100%;line-height:1.1}li:hover .destroy{display:block}.edit{display:none}:host(:last-child) .editing{margin-bottom:-1px}`,window.extraTodoItemCssToAdopt?l`${r(window.extraTodoItemCssToAdopt)}`:l``]}render(){const t={todo:!0,completed:this.completed??!1,editing:this.isEditing};return z`
  • `}#n(){this.dispatchEvent(new Lt({id:this.todoId,completed:!this.completed}))}#l(){this.dispatchEvent(new St(this.todoId))}#r(){this.isEditing=!0}#a(t){const e=t.target.value;this.dispatchEvent(new Lt({id:this.todoId,text:e})),this.isEditing=!1}#d(t){"escape"===t.key&&this.#h(t)}#h(t){t.target.value=this.text??""}};t([pt()],Ut.prototype,"todoId",void 0),t([pt()],Ut.prototype,"text",void 0),t([pt({type:Boolean})],Ut.prototype,"completed",void 0),t([ut()],Ut.prototype,"isEditing",void 0),Ut=t([dt("todo-item")],Ut);const Nt=t=>(e,i)=>{const o=Object.getOwnPropertyDescriptor(e,i),{get:s,set:n}=o,r={...o,set(e){const i=this.__updateOnEventListener??=()=>this.requestUpdate(),o=s.call(this);return o?.removeEventListener?.(t,i),e?.addEventListener?.(t,i),n.call(this,e)}};Object.defineProperty(e,i,r)};let Ht=class extends it{static{this.styles=[gt,l`:host{display:block}:focus{box-shadow:none!important}.todo-list{margin:0;padding:0;list-style:none}.toggle-all{width:1px;height:1px;border:none;opacity:0;position:absolute;right:100%;bottom:100%}.toggle-all+label{display:flex;align-items:center;justify-content:center;width:45px;height:65px;font-size:0;position:absolute;top:-65px;left:0}.toggle-all+label:before{content:"❯";display:inline-block;font-size:22px;color:#949494;padding:10px 27px 10px 27px;transform:rotate(90deg)}.toggle-all:checked+label:before{color:#484848}todo-item{border-bottom:1px solid #ededed}todo-item:last-child{border-bottom:none}`,window.extraTodoListCssToAdopt?l`${r(window.extraTodoListCssToAdopt)}`:l``]}render(){return z`${(this.todoList?.all.length??0)>0?z` `:j}
      ${Ct(this.todoList?.filtered()??[],(t=>t.id),((t,e)=>z``))}
    `}#c(){this.dispatchEvent(new Tt)}};t([Nt("change"),pt({attribute:!1})],Ht.prototype,"todoList",void 0),Ht=t([dt("todo-list")],Ht);let Dt=class extends it{static{this.styles=[gt,l`:host{display:block}input::-webkit-input-placeholder{font-style:italic;font-weight:400;color:rgba(0,0,0,.4)}input::-moz-placeholder{font-style:italic;font-weight:400;color:rgba(0,0,0,.4)}input::input-placeholder{font-style:italic;font-weight:400;color:rgba(0,0,0,.4)}`]}render(){return z``}#p(){const{value:t}=this.newTodoInput;t.length>0&&this.dispatchEvent(new kt(t)),this.newTodoInput.value=""}#u(t){"Enter"===t.key&&this.#p()}};t([Nt("change"),pt({attribute:!1})],Dt.prototype,"todoList",void 0),t([ + */class Nt extends Event{static eventName="todo-add";text;constructor(t){super(Nt.eventName,{bubbles:!0,composed:!0}),this.text=t}}class Mt extends Event{static eventName="todo-delete";id;constructor(t){super(Mt.eventName,{bubbles:!0,composed:!0}),this.id=t}}class Dt extends Event{static eventName="todo-edit";edit;constructor(t){super(Dt.eventName,{bubbles:!0,composed:!0}),this.edit=t}}class It extends Event{static eventName="todo-toggle-all";constructor(){super(It.eventName,{bubbles:!0,composed:!0})}}class Ht extends Event{static eventName="clear-completed";constructor(){super(Ht.eventName,{bubbles:!0,composed:!0})}}(()=>{let s,i,o,n,r,d,c=[bt("todo-item")],h=[],p=ct,u=[],g=[],f=[],m=[],b=[],_=[],$=[],v=[];(class extends p{static{i=this}static{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;o=[vt()],n=[vt()],r=[vt({type:Boolean})],d=[yt()],t(this,null,o,{kind:"accessor",name:"todoId",static:!1,private:!1,access:{has:t=>"todoId"in t,get:t=>t.todoId,set:(t,e)=>{t.todoId=e}},metadata:e},u,g),t(this,null,n,{kind:"accessor",name:"text",static:!1,private:!1,access:{has:t=>"text"in t,get:t=>t.text,set:(t,e)=>{t.text=e}},metadata:e},f,m),t(this,null,r,{kind:"accessor",name:"completed",static:!1,private:!1,access:{has:t=>"completed"in t,get:t=>t.completed,set:(t,e)=>{t.completed=e}},metadata:e},b,_),t(this,null,d,{kind:"accessor",name:"isEditing",static:!1,private:!1,access:{has:t=>"isEditing"in t,get:t=>t.isEditing,set:(t,e)=>{t.isEditing=e}},metadata:e},$,v),t(null,s={value:i},c,{kind:"class",name:i.name,metadata:e},null,h),i=s.value,e&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}static styles=[xt,l`:host{display:block}li{position:relative;font-size:24px}.editing{border-bottom:none;padding:0}.editing .edit{display:block;width:calc(100% - 43px);padding:12px 16px;margin:0 0 0 43px}.editing .view{display:none}.toggle{text-align:center;width:40px;height:auto;position:absolute;top:0;bottom:0;margin:auto 0;border:none;-webkit-appearance:none;appearance:none}.toggle{opacity:0}.toggle+label{background-image:url(data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23949494%22%20stroke-width%3D%223%22/%3E%3C/svg%3E);background-repeat:no-repeat;background-position:center left}.toggle:checked+label{background-image:url(data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%2359A193%22%20stroke-width%3D%223%22%2F%3E%3Cpath%20fill%3D%22%233EA390%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22%2F%3E%3C%2Fsvg%3E)}label{word-break:break-all;padding:15px 15px 15px 60px;display:block;line-height:1.2;transition:color .4s;font-weight:400;color:#484848}.completed label{color:#949494;text-decoration:line-through}.destroy{display:none;position:absolute;top:0;right:10px;bottom:0;width:40px;height:40px;margin:auto 0;font-size:30px;color:#949494;transition:color .2s ease-out}.destroy:focus,.destroy:hover{color:#c18585}.destroy:after{content:"×";display:block;height:100%;line-height:1.1}li:hover .destroy{display:block}.edit{display:none}:host(:last-child) .editing{margin-bottom:-1px}`,window.extraTodoItemCssToAdopt?l`${a(window.extraTodoItemCssToAdopt)}`:l``];#n=e(this,u,"");get todoId(){return this.#n}set todoId(t){this.#n=t}#r=(e(this,g),e(this,f,""));get text(){return this.#r}set text(t){this.#r=t}#a=(e(this,m),e(this,b,!1));get completed(){return this.#a}set completed(t){this.#a=t}#l=(e(this,_),e(this,$,!1));get isEditing(){return this.#l}set isEditing(t){this.#l=t}render(){const t={todo:!0,completed:this.completed??!1,editing:this.isEditing};return W`
  • `}#d(){this.dispatchEvent(new Dt({id:this.todoId,completed:!this.completed}))}#h(){this.dispatchEvent(new Mt(this.todoId))}#c(){this.isEditing=!0}#p(t){const e=t.target.value;this.dispatchEvent(new Dt({id:this.todoId,text:e})),this.isEditing=!1}#u(t){"escape"===t.key&&this.#g(t)}#g(t){t.target.value=this.text??""}constructor(){super(...arguments),e(this,v)}static{e(i,h)}})})();const jt=t=>function(e,s){const{get:i,set:o}=e;return{get(){return i.call(this)},set(e){const s=this.__updateOnEventListener??=()=>this.requestUpdate(),n=i.call(this);n?.removeEventListener(t,s),e?.addEventListener(t,s),o.call(this,e)}}};(()=>{let s,i,o,n=[bt("todo-list")],r=[],d=ct,c=[],h=[];(class extends d{static{i=this}static{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;o=[jt("change"),vt({attribute:!1})],t(this,null,o,{kind:"accessor",name:"todoList",static:!1,private:!1,access:{has:t=>"todoList"in t,get:t=>t.todoList,set:(t,e)=>{t.todoList=e}},metadata:e},c,h),t(null,s={value:i},n,{kind:"class",name:i.name,metadata:e},null,r),i=s.value,e&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}static styles=[xt,l`:host{display:block}:focus{box-shadow:none!important}.todo-list{margin:0;padding:0;list-style:none}.toggle-all{width:1px;height:1px;border:none;opacity:0;position:absolute;right:100%;bottom:100%}.toggle-all+label{display:flex;align-items:center;justify-content:center;width:45px;height:65px;font-size:0;position:absolute;top:-65px;left:0}.toggle-all+label:before{content:"❯";display:inline-block;font-size:22px;color:#949494;padding:10px 27px 10px 27px;transform:rotate(90deg)}.toggle-all:checked+label:before{color:#484848}todo-item{border-bottom:1px solid #ededed}todo-item:last-child{border-bottom:none}`,window.extraTodoListCssToAdopt?l`${a(window.extraTodoListCssToAdopt)}`:l``];#f=e(this,c,void 0);get todoList(){return this.#f}set todoList(t){this.#f=t}render(){return W`${(this.todoList?.all.length??0)>0?W` `:K}
      ${Ut(this.todoList?.filtered()??[],(t=>t.id),((t,e)=>W``))}
    `}#m(){this.dispatchEvent(new It)}constructor(){super(...arguments),e(this,h)}static{e(i,r)}})})(); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -function(t,e){return(({finisher:t,descriptor:e})=>(i,o)=>{if(void 0===o){const o=i.originalKey??i.key,s=null!=e?{kind:"method",placement:"prototype",key:o,descriptor:e(i.key)}:{...i,key:o};return null!=t&&(s.finisher=function(e){t(e,o)}),s}{const s=i.constructor;void 0!==e&&Object.defineProperty(i,o,e(o)),t?.(s,o)}})({descriptor:i=>{const o={get(){return this.renderRoot?.querySelector(t)??null},enumerable:!0,configurable:!0};if(e){const e=Symbol();o.get=function(){return void 0===this[e]&&(this[e]=this.renderRoot?.querySelector(t)??null),this[e]}}return o}})}("input",!0)],Dt.prototype,"newTodoInput",void 0),Dt=t([dt("todo-form")],Dt);let Ot=class extends it{static{this.styles=[gt,l`:host{display:block;padding:10px 15px;height:20px;text-align:center;font-size:15px;border-top:1px solid #e6e6e6}:host:before{content:"";position:absolute;right:0;bottom:0;left:0;height:50px;overflow:hidden;box-shadow:0 1px 1px rgba(0,0,0,.2),0 8px 0 -3px #f6f6f6,0 9px 1px -3px rgba(0,0,0,.2),0 16px 0 -6px #f6f6f6,0 17px 2px -6px rgba(0,0,0,.2)}.todo-count{float:left;text-align:left}.todo-count strong{font-weight:300}.filters{margin:0;padding:0;list-style:none;position:absolute;right:0;left:0}li{display:inline}li a{color:inherit;margin:3px;padding:3px 7px;text-decoration:none;border:1px solid transparent;border-radius:3px}a:hover{border-color:#db7676}a.selected{border-color:#ce4646}.clear-completed,:host .clear-completed:active{float:right;position:relative;line-height:19px;text-decoration:none;cursor:pointer}.clear-completed:hover{text-decoration:underline}`]}render(){if(void 0===this.todoList||0===this.todoList.all.length)return j;const t=Mt({text:"All",filter:"all",selectedFilter:this.todoList?.filter}),e=Mt({text:"Active",filter:"active",selectedFilter:this.todoList?.filter}),i=Mt({text:"Completed",filter:"completed",selectedFilter:this.todoList?.filter});return z`${this.todoList?.active.length} items left
    • ${t}
    • ${e}
    • ${i}
    ${(this.todoList?.completed.length??0)>0?z``:j}`}#g(){this.dispatchEvent(new Pt)}};function Mt({text:t,filter:e,selectedFilter:i}){return z`${t}`}t([Nt("change"),pt({attribute:!1})],Ot.prototype,"todoList",void 0),Ot=t([dt("todo-footer")],Ot);let Rt=class extends it{static{this.styles=[gt,l`:host{display:block;background:#fff;margin:130px 0 40px 0;position:relative;box-shadow:0 2px 4px 0 rgba(0,0,0,.2),0 25px 50px 0 rgba(0,0,0,.1)}h1{position:absolute;top:-140px;width:100%;font-size:80px;font-weight:200;text-align:center;color:#b83f45;-webkit-text-rendering:optimizeLegibility;-moz-text-rendering:optimizeLegibility;text-rendering:optimizeLegibility}main{position:relative;z-index:2;border-top:1px solid #e6e6e6}.hidden{display:none}:focus{box-shadow:none!important}`]}constructor(){super(),this.todoList=new $t,this.#f=t=>{this.todoList.add(t.text)},this.#m=t=>{this.todoList.delete(t.id)},this.#$=t=>{this.todoList.update(t.edit)},this.#b=t=>{this.todoList.toggleAll()},this.#v=t=>{this.todoList.clearCompleted()},this.addEventListener(kt.eventName,this.#f),this.addEventListener(St.eventName,this.#m),this.addEventListener(Lt.eventName,this.#$),this.addEventListener(Tt.eventName,this.#b),this.addEventListener(Pt.eventName,this.#v)}connectedCallback(){super.connectedCallback(),this.todoList.connect()}disconnectedCallback(){super.disconnectedCallback(),this.todoList.disconnect()}render(){return z`

    todos

    `}#f;#m;#$;#b;#v};t([Nt("change"),ut()],Rt.prototype,"todoList",void 0),Rt=t([dt("todo-app")],Rt);export{Rt as TodoApp}; +const zt=(t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s) +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */;function Rt(t,e){return(s,i,o)=>{const n=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof i?s:o??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return zt(s,i,{get(){let s=t.call(this);return void 0===s&&(s=n(this),(null!==s||this.hasUpdated)&&e.call(this,s)),s}})}return zt(s,i,{get(){return n(this)}})}}function Bt({text:t,filter:e,selectedFilter:s}){return W`${t}`}(()=>{let s,i,o,n,r=[bt("todo-form")],a=[],d=ct,c=[],h=[],p=[],u=[];(class extends d{static{i=this}static{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;o=[jt("change"),vt({attribute:!1})],n=[Rt("input",!0)],t(this,null,o,{kind:"accessor",name:"todoList",static:!1,private:!1,access:{has:t=>"todoList"in t,get:t=>t.todoList,set:(t,e)=>{t.todoList=e}},metadata:e},c,h),t(this,null,n,{kind:"accessor",name:"newTodoInput",static:!1,private:!1,access:{has:t=>"newTodoInput"in t,get:t=>t.newTodoInput,set:(t,e)=>{t.newTodoInput=e}},metadata:e},p,u),t(null,s={value:i},r,{kind:"class",name:i.name,metadata:e},null,a),i=s.value,e&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}static styles=[xt,l`:host{display:block}input::-webkit-input-placeholder{font-style:italic;font-weight:400;color:rgba(0,0,0,.4)}input::-moz-placeholder{font-style:italic;font-weight:400;color:rgba(0,0,0,.4)}input::input-placeholder{font-style:italic;font-weight:400;color:rgba(0,0,0,.4)}`];#f=e(this,c,void 0);get todoList(){return this.#f}set todoList(t){this.#f=t}render(){return W``}#$=(e(this,h),e(this,p,void 0));get newTodoInput(){return this.#$}set newTodoInput(t){this.#$=t}#b(){const{value:t}=this.newTodoInput;t.length>0&&this.dispatchEvent(new Nt(t)),this.newTodoInput.value=""}#_(t){"Enter"===t.key&&this.#b()}constructor(){super(...arguments),e(this,u)}static{e(i,a)}})})(),(()=>{let s,i,o,n=[bt("todo-footer")],r=[],a=ct,d=[],c=[];(class extends a{static{i=this}static{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;o=[jt("change"),vt({attribute:!1})],t(this,null,o,{kind:"accessor",name:"todoList",static:!1,private:!1,access:{has:t=>"todoList"in t,get:t=>t.todoList,set:(t,e)=>{t.todoList=e}},metadata:e},d,c),t(null,s={value:i},n,{kind:"class",name:i.name,metadata:e},null,r),i=s.value,e&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}static styles=[xt,l`:host{display:block;padding:10px 15px;height:20px;text-align:center;font-size:15px;border-top:1px solid #e6e6e6}:host:before{content:"";position:absolute;right:0;bottom:0;left:0;height:50px;overflow:hidden;box-shadow:0 1px 1px rgba(0,0,0,.2),0 8px 0 -3px #f6f6f6,0 9px 1px -3px rgba(0,0,0,.2),0 16px 0 -6px #f6f6f6,0 17px 2px -6px rgba(0,0,0,.2)}.todo-count{float:left;text-align:left}.todo-count strong{font-weight:300}.filters{margin:0;padding:0;list-style:none;position:absolute;right:0;left:0}li{display:inline}li a{color:inherit;margin:3px;padding:3px 7px;text-decoration:none;border:1px solid transparent;border-radius:3px}a:hover{border-color:#db7676}a.selected{border-color:#ce4646}.clear-completed,:host .clear-completed:active{float:right;position:relative;line-height:19px;text-decoration:none;cursor:pointer}.clear-completed:hover{text-decoration:underline}`];#f=e(this,d,void 0);get todoList(){return this.#f}set todoList(t){this.#f=t}render(){if(void 0===this.todoList||0===this.todoList.all.length)return K;const t=Bt({text:"All",filter:"all",selectedFilter:this.todoList?.filter}),e=Bt({text:"Active",filter:"active",selectedFilter:this.todoList?.filter}),s=Bt({text:"Completed",filter:"completed",selectedFilter:this.todoList?.filter});return W`${this.todoList?.active.length} items left
    • ${t}
    • ${e}
    • ${s}
    ${(this.todoList?.completed.length??0)>0?W``:K}`}#v(){this.dispatchEvent(new Ht)}constructor(){super(...arguments),e(this,c)}static{e(i,r)}})})();let Ft=(()=>{let s,i,o,n=[bt("todo-app")],r=[],a=ct,d=[],c=[];return class extends a{static{i=this}static{const e="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;o=[jt("change"),yt()],t(this,null,o,{kind:"accessor",name:"todoList",static:!1,private:!1,access:{has:t=>"todoList"in t,get:t=>t.todoList,set:(t,e)=>{t.todoList=e}},metadata:e},d,c),t(null,s={value:i},n,{kind:"class",name:i.name,metadata:e},null,r),i=s.value,e&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}static styles=[xt,l`:host{display:block;background:#fff;margin:130px 0 40px 0;position:relative;box-shadow:0 2px 4px 0 rgba(0,0,0,.2),0 25px 50px 0 rgba(0,0,0,.1)}h1{position:absolute;top:-140px;width:100%;font-size:80px;font-weight:200;text-align:center;color:#b83f45;-webkit-text-rendering:optimizeLegibility;-moz-text-rendering:optimizeLegibility;text-rendering:optimizeLegibility}main{position:relative;z-index:2;border-top:1px solid #e6e6e6}.hidden{display:none}:focus{box-shadow:none!important}`];#f=e(this,d,new Et);get todoList(){return this.#f}set todoList(t){this.#f=t}constructor(){super(),this.addEventListener(Nt.eventName,this.#y),this.addEventListener(Mt.eventName,this.#x),this.addEventListener(Dt.eventName,this.#A),this.addEventListener(It.eventName,this.#w),this.addEventListener(Ht.eventName,this.#E)}connectedCallback(){super.connectedCallback(),this.todoList.connect()}disconnectedCallback(){super.disconnectedCallback(),this.todoList.disconnect()}render(){return W`

    todos

    `}#y=(e(this,c),t=>{this.todoList.add(t.text)});#x=t=>{this.todoList.delete(t.id)};#A=t=>{this.todoList.update(t.edit)};#w=t=>{this.todoList.toggleAll()};#E=t=>{this.todoList.clearCompleted()};static{e(i,r)}},i})();export{Ft as TodoApp}; diff --git a/resources/todomvc/architecture-examples/lit/package-lock.json b/resources/todomvc/architecture-examples/lit/package-lock.json index 99aada2b7..1695b1c8f 100644 --- a/resources/todomvc/architecture-examples/lit/package-lock.json +++ b/resources/todomvc/architecture-examples/lit/package-lock.json @@ -6,8 +6,8 @@ "": { "name": "todomvc-lit", "dependencies": { - "lit": "^3.0.0-pre.0", - "tslib": "^2.5.2" + "lit": "^3.3.0", + "tslib": "^2.8.1" }, "devDependencies": { "@rollup/plugin-node-resolve": "^15.1.0", @@ -16,8 +16,8 @@ "@web/dev-server": "^0.2.1", "rollup": "^2.79.1", "rollup-plugin-minify-html-literals": "^1.2.6", - "typescript": "^5.0.4", - "wireit": "^0.9.5" + "typescript": "^5.8.3", + "wireit": "^0.14.12" }, "engines": { "node": ">=18.13.0", @@ -146,16 +146,18 @@ "dev": true }, "node_modules/@lit-labs/ssr-dom-shim": { - "version": "1.1.2-pre.0", - "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.2-pre.0.tgz", - "integrity": "sha512-3FSKQV90k20guBluMFzd9paVuzZTxeL1vDuqNc8SbwpiCmZkY7CJH7HH4HVD35D4hU8d8JTKKL51eXRWzXBZXQ==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.3.0.tgz", + "integrity": "sha512-nQIWonJ6eFAvUUrSlwyHDm/aE8PBDu5kRpL0vHMg6K8fK3Diq1xdPjTnsJSwxABhaZ+5eBi1btQB5ShUTKo4nQ==", + "license": "BSD-3-Clause" }, "node_modules/@lit/reactive-element": { - "version": "2.0.0-pre.0", - "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.0-pre.0.tgz", - "integrity": "sha512-Buhl2svhltEDA+4hkVaABgmpCWpBcMiU1emOisA/izBXkAxh69Qgqrb7aZajBijex9pvFI7HK4SrM+/IDT0YFQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.1.0.tgz", + "integrity": "sha512-L2qyoZSQClcBmq0qajBVbhYEcG6iK0XfLn66ifLe/RfC0/ihpc+pl0Wdn8bJ8o+hj38cG0fGXRgSS20MuXn7qA==", + "license": "BSD-3-Clause", "dependencies": { - "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0" + "@lit-labs/ssr-dom-shim": "^1.2.0" } }, "node_modules/@nodelib/fs.scandir": { @@ -497,9 +499,10 @@ } }, "node_modules/@types/trusted-types": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.3.tgz", - "integrity": "sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g==" + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT" }, "node_modules/@types/uglify-js": { "version": "3.17.1", @@ -703,6 +706,16 @@ "lodash": "^4.17.14" } }, + "node_modules/balanced-match": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-3.0.1.tgz", + "integrity": "sha512-vjtV3hiLqYDNRoiAv0zC4QaGAMPomEoq83PRmYIofPswwZurCeWR5LByXm7SyoL0Zh5+2z0+HC7jG8gSZJUh0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -712,6 +725,19 @@ "node": ">=8" } }, + "node_modules/brace-expansion": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-4.0.0.tgz", + "integrity": "sha512-l/mOwLWs7BQIgOKrL46dIAbyCKvPV7YJPDspkuc88rHsZRlg3hptUGdU7Trv0VFP4d3xnSGBQrKu5ZvGB7UeIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^3.0.0" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", @@ -1660,28 +1686,32 @@ } }, "node_modules/lit": { - "version": "3.0.0-pre.0", - "resolved": "https://registry.npmjs.org/lit/-/lit-3.0.0-pre.0.tgz", - "integrity": "sha512-dW3TR4LhMcc7bE4QYfzC2AWGMzpmUmYLTok537nFcmHHoNO9eARbA7bi5eQmvEtWhySbRQ1SFHSPvp7bTFpcHw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lit/-/lit-3.3.0.tgz", + "integrity": "sha512-DGVsqsOIHBww2DqnuZzW7QsuCdahp50ojuDaBPC7jUDRpYoH0z7kHBBYZewRzer75FwtrkmkKk7iOAwSaWdBmw==", + "license": "BSD-3-Clause", "dependencies": { - "@lit/reactive-element": "^2.0.0-pre.0", - "lit-element": "^4.0.0-pre.0", - "lit-html": "^3.0.0-pre.0" + "@lit/reactive-element": "^2.1.0", + "lit-element": "^4.2.0", + "lit-html": "^3.3.0" } }, "node_modules/lit-element": { - "version": "4.0.0-pre.0", - "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.0.0-pre.0.tgz", - "integrity": "sha512-+FoW5lK5EBvEqJIK5XWYgl5uW5LpqzxCymLIS1ra9XnDEqIIA4kDlkkhTg2VBBVHAHkCFxCn6KVPr/miFQreMQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.2.0.tgz", + "integrity": "sha512-MGrXJVAI5x+Bfth/pU9Kst1iWID6GHDLEzFEnyULB/sFiRLgkd8NPK/PeeXxktA3T6EIIaq8U3KcbTU5XFcP2Q==", + "license": "BSD-3-Clause", "dependencies": { - "@lit/reactive-element": "^2.0.0-pre.0", - "lit-html": "^3.0.0-pre.0" + "@lit-labs/ssr-dom-shim": "^1.2.0", + "@lit/reactive-element": "^2.1.0", + "lit-html": "^3.3.0" } }, "node_modules/lit-html": { - "version": "3.0.0-pre.0", - "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.0.0-pre.0.tgz", - "integrity": "sha512-9rpjrE/l0WaJznK2A/IeR7lV0doCeC8HABfK46iE90O/9awaNKsFYB7Rhj3WSe94nJ7WBNOYT3TBPINgUMx3lw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.3.0.tgz", + "integrity": "sha512-RHoswrFAxY2d8Cf2mm4OZ1DgzCoBKUKSPvA1fhtSELxUERq2aQQ2h05pO9j81gS1o7RIRJ+CePLogfyahwmynw==", + "license": "BSD-3-Clause", "dependencies": { "@types/trusted-types": "^2.0.2" } @@ -2438,9 +2468,10 @@ } }, "node_modules/tslib": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", - "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/tsscmp": { "version": "1.0.6", @@ -2465,10 +2496,11 @@ } }, "node_modules/typescript": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz", - "integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==", + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -2536,12 +2568,17 @@ } }, "node_modules/wireit": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/wireit/-/wireit-0.9.5.tgz", - "integrity": "sha512-dKKNAwLxQjbPPMrltPxMUFKvLy2z6hlVjvR/qitvPm8GEQyb/1QYBG7ObvOQLsi95uAXpkWLJXBYkCKeVcMVgA==", - "dev": true, + "version": "0.14.12", + "resolved": "https://registry.npmjs.org/wireit/-/wireit-0.14.12.tgz", + "integrity": "sha512-gNSd+nZmMo6cuICezYXRIayu6TSOeCSCDzjSF0q6g8FKDsRbdqrONrSZYzdk/uBISmRcv4vZtsno6GyGvdXwGA==", + "dev": true, + "license": "Apache-2.0", + "workspaces": [ + "vscode-extension", + "website" + ], "dependencies": { - "braces": "^3.0.2", + "brace-expansion": "^4.0.0", "chokidar": "^3.5.3", "fast-glob": "^3.2.11", "jsonc-parser": "^3.0.0", @@ -2551,7 +2588,7 @@ "wireit": "bin/wireit.js" }, "engines": { - "node": ">=14.14.0" + "node": ">=18.0.0" } }, "node_modules/wordwrapjs": { diff --git a/resources/todomvc/architecture-examples/lit/package.json b/resources/todomvc/architecture-examples/lit/package.json index df279b7da..3dd06a50e 100644 --- a/resources/todomvc/architecture-examples/lit/package.json +++ b/resources/todomvc/architecture-examples/lit/package.json @@ -18,15 +18,15 @@ "@rollup/plugin-node-resolve": "^15.1.0", "@rollup/plugin-terser": "^0.4.3", "@rollup/plugin-typescript": "^11.1.1", + "@web/dev-server": "^0.2.1", "rollup": "^2.79.1", "rollup-plugin-minify-html-literals": "^1.2.6", - "@web/dev-server": "^0.2.1", - "typescript": "^5.0.4", - "wireit": "^0.9.5" + "typescript": "^5.8.3", + "wireit": "^0.14.12" }, "dependencies": { - "lit": "^3.0.0-pre.0", - "tslib": "^2.5.2" + "lit": "^3.3.0", + "tslib": "^2.8.1" }, "wireit": { "serve": { @@ -69,7 +69,7 @@ ".tsbuildinfo" ], "clean": false, - "command": "tsc" + "command": "tsc --pretty" }, "rollup": { "files": [ diff --git a/resources/todomvc/architecture-examples/lit/src/lib/todo-app.ts b/resources/todomvc/architecture-examples/lit/src/lib/todo-app.ts index 36a50f75f..7cb0916c9 100644 --- a/resources/todomvc/architecture-examples/lit/src/lib/todo-app.ts +++ b/resources/todomvc/architecture-examples/lit/src/lib/todo-app.ts @@ -52,7 +52,7 @@ export class TodoApp extends LitElement { @updateOnEvent("change") @state() - readonly todoList = new Todos(); + accessor todoList = new Todos(); constructor() { super(); diff --git a/resources/todomvc/architecture-examples/lit/src/lib/todo-footer.ts b/resources/todomvc/architecture-examples/lit/src/lib/todo-footer.ts index db8c243a7..da29121fd 100644 --- a/resources/todomvc/architecture-examples/lit/src/lib/todo-footer.ts +++ b/resources/todomvc/architecture-examples/lit/src/lib/todo-footer.ts @@ -85,7 +85,7 @@ export class TodoFooter extends LitElement { @updateOnEvent("change") @property({ attribute: false }) - todoList?: Todos; + accessor todoList: Todos | undefined; override render() { if (this.todoList === undefined || this.todoList.all.length === 0) diff --git a/resources/todomvc/architecture-examples/lit/src/lib/todo-form.ts b/resources/todomvc/architecture-examples/lit/src/lib/todo-form.ts index cd661fda9..027de1eba 100644 --- a/resources/todomvc/architecture-examples/lit/src/lib/todo-form.ts +++ b/resources/todomvc/architecture-examples/lit/src/lib/todo-form.ts @@ -36,13 +36,14 @@ export class TodoForm extends LitElement { @updateOnEvent("change") @property({ attribute: false }) - todoList?: Todos; + accessor todoList: Todos | undefined; override render() { return html``; } - @query("input", true) newTodoInput!: HTMLInputElement; + @query("input", true) + accessor newTodoInput!: HTMLInputElement; #onChange() { const { value } = this.newTodoInput; diff --git a/resources/todomvc/architecture-examples/lit/src/lib/todo-item.ts b/resources/todomvc/architecture-examples/lit/src/lib/todo-item.ts index ee3a0395a..8d759f08c 100644 --- a/resources/todomvc/architecture-examples/lit/src/lib/todo-item.ts +++ b/resources/todomvc/architecture-examples/lit/src/lib/todo-item.ts @@ -139,16 +139,16 @@ export class TodoItem extends LitElement { ]; @property() - todoId = ""; + accessor todoId = ""; @property() - text = ""; + accessor text = ""; @property({ type: Boolean }) - completed = false; + accessor completed = false; @state() - isEditing: boolean = false; + accessor isEditing: boolean = false; override render() { const itemClassList = { diff --git a/resources/todomvc/architecture-examples/lit/src/lib/todo-list.ts b/resources/todomvc/architecture-examples/lit/src/lib/todo-list.ts index 3be86c024..37b888558 100644 --- a/resources/todomvc/architecture-examples/lit/src/lib/todo-list.ts +++ b/resources/todomvc/architecture-examples/lit/src/lib/todo-list.ts @@ -88,7 +88,7 @@ export class TodoList extends LitElement { @updateOnEvent("change") @property({ attribute: false }) - todoList?: Todos; + accessor todoList: Todos | undefined; override render() { return html` diff --git a/resources/todomvc/architecture-examples/lit/src/lib/utils.ts b/resources/todomvc/architecture-examples/lit/src/lib/utils.ts index 16a753cbf..8a6c83288 100644 --- a/resources/todomvc/architecture-examples/lit/src/lib/utils.ts +++ b/resources/todomvc/architecture-examples/lit/src/lib/utils.ts @@ -1,29 +1,35 @@ import type { ReactiveElement } from "lit"; interface ListenerCarryingElement extends ReactiveElement { + // This property will be used by the decorator to store the event listener. + // It can be dynamically added or explicitly declared by the class using the decorator. __updateOnEventListener?: () => void; } /** - * A property decorator that subscribes to an event on the property value and + * An accessor decorator that subscribes to an event on the property value and * calls `requestUpdate` when the event fires. - * - * If we were using this outside of just this one app we'd use the type system - * to enforce that the property value is an `EventTarget`. + * + * The accessor type must be an `EventTarget`. */ -export const updateOnEvent = (eventName: string) => (target: ListenerCarryingElement, propertyKey: string) => { - const descriptor = Object.getOwnPropertyDescriptor(target, propertyKey)!; +export const updateOnEvent = (eventName: string) => + function ( + target: ClassAccessorDecoratorTarget, + _context: ClassAccessorDecoratorContext + ) { + const {get, set} = target; - const { get, set } = descriptor; - const newDescriptor = { - ...descriptor, - set(this: ListenerCarryingElement, v: EventTarget) { - const listener = this.__updateOnEventListener ??= () => this.requestUpdate(); - const oldValue = get!.call(this); - oldValue?.removeEventListener?.(eventName, listener); - v?.addEventListener?.(eventName, listener); - return set!.call(this, v); - }, + return { + get(this: T): V { + return get.call(this); + }, + set(this: T, newValue: V): void { + const listener = this.__updateOnEventListener ??= () => this.requestUpdate(); + const oldValue = get.call(this); + oldValue?.removeEventListener(eventName, listener); + newValue?.addEventListener(eventName, listener); + set.call(this, newValue); + } }; - Object.defineProperty(target, propertyKey, newDescriptor); -}; + }; + \ No newline at end of file diff --git a/resources/todomvc/architecture-examples/lit/tsconfig.json b/resources/todomvc/architecture-examples/lit/tsconfig.json index 84588eded..c9dd5ff7e 100644 --- a/resources/todomvc/architecture-examples/lit/tsconfig.json +++ b/resources/todomvc/architecture-examples/lit/tsconfig.json @@ -2,11 +2,11 @@ "compilerOptions": { "incremental": true, "tsBuildInfoFile": "./.tsbuildinfo", - "target": "ES2022", - "module": "ES2022", - "lib": ["DOM", "DOM.Iterable"], + "target": "ES2024", + "module": "NodeNext", + "lib": ["ES2024", "DOM", "DOM.Iterable"], "rootDir": "./src", - "moduleResolution": "node", + "moduleResolution": "NodeNext", "sourceMap": true, "outDir": "./", "importHelpers": true, @@ -21,9 +21,6 @@ "noFallthroughCasesInSwitch": true, "noImplicitOverride": true, "skipLibCheck": true, - // Once standard decorators ship, we can remove these two. - "experimentalDecorators": true, - "useDefineForClassFields": false }, "include": ["src/**/*.ts"], "exclude": []