Skip to content

Commit

Permalink
feat: update renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
ducksoupdev committed Jun 5, 2022
1 parent 931ea1a commit 84b09b1
Show file tree
Hide file tree
Showing 14 changed files with 1,360 additions and 1,296 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.0.0] - 2022-06-05

### Updates
- Uplift `htm` to v3.1.1
- Uplift `lit-html` to v2.2.5
- Uplift `uhtml` to v3.0.1
- Uplift NPM dev dependencies

## [4.4.0] - 2022-03-24

### New
Expand Down
6 changes: 6 additions & 0 deletions cypress.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'cypress'

export default defineConfig({
video: false,
e2e: {}
})
3 changes: 0 additions & 3 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dist/lit-html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var t;const e=globalThis.trustedTypes,i=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,s=`lit$${(Math.random()+"").slice(9)}$`,n="?"+s,o=`<${n}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,$=Array.isArray,d=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,a=/-->/g,A=/>/g,c=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,u=/'/g,_=/"/g,v=/^(?:script|style|textarea|title)$/i,p=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),g=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),f=new WeakMap,x=(t,e,i)=>{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let l=o._$litPart$;if(void 0===l){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=l=new b(e.insertBefore(h(),t),t,void 0,null!=i?i:{})}return l._$AI(t),l},y=l.createTreeWalker(l,129,null,!1),C=(t,e)=>{const n=t.length-1,l=[];let $,p=2===e?"<svg>":"",g=d;for(let e=0;e<n;e++){const i=t[e];let n,m,f=-1,y=0;for(;y<i.length&&(g.lastIndex=y,m=g.exec(i),null!==m);)y=g.lastIndex,g===d?"!--"===m[1]?g=a:void 0!==m[1]?g=A:void 0!==m[2]?(v.test(m[2])&&($=RegExp("</"+m[2],"g")),g=c):void 0!==m[3]&&(g=c):g===c?">"===m[0]?(g=null!=$?$:d,f=-1):void 0===m[1]?f=-2:(f=g.lastIndex-m[2].length,n=m[1],g=void 0===m[3]?c:'"'===m[3]?_:u):g===_||g===u?g=c:g===a||g===A?g=d:(g=c,$=void 0);const H=g===c&&t[e+1].startsWith("/>")?" ":"";p+=g===d?i+o:f>=0?(l.push(n),i.slice(0,f)+"$lit$"+i.slice(f)+s+H):i+s+(-2===f?(l.push(void 0),e):H)}const m=p+(t[n]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==i?i.createHTML(m):m,l]};class H{constructor({strings:t,_$litType$:i},o){let l;this.parts=[];let $=0,d=0;const a=t.length-1,A=this.parts,[c,u]=C(t,i);if(this.el=H.createElement(c,o),y.currentNode=this.el.content,2===i){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(l=y.nextNode())&&A.length<a;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const e of l.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(s)){const i=u[d++];if(t.push(e),void 0!==i){const t=l.getAttribute(i.toLowerCase()+"$lit$").split(s),e=/([.?@])?(.*)/.exec(i);A.push({type:1,index:$,name:e[2],strings:t,ctor:"."===e[1]?w:"?"===e[1]?S:"@"===e[1]?I:T})}else A.push({type:6,index:$})}for(const e of t)l.removeAttribute(e)}if(v.test(l.tagName)){const t=l.textContent.split(s),i=t.length-1;if(i>0){l.textContent=e?e.emptyScript:"";for(let e=0;e<i;e++)l.append(t[e],h()),y.nextNode(),A.push({type:2,index:++$});l.append(t[i],h())}}}else if(8===l.nodeType)if(l.data===n)A.push({type:2,index:$});else{let t=-1;for(;-1!==(t=l.data.indexOf(s,t+1));)A.push({type:7,index:$}),t+=s.length-1}$++}}static createElement(t,e){const i=l.createElement("template");return i.innerHTML=t,i}}function P(t,e,i=t,s){var n,o,l,$;if(e===g)return e;let d=void 0!==s?null===(n=i._$Cl)||void 0===n?void 0:n[s]:i._$Cu;const a=r(e)?void 0:e._$litDirective$;return(null==d?void 0:d.constructor)!==a&&(null===(o=null==d?void 0:d._$AO)||void 0===o||o.call(d,!1),void 0===a?d=void 0:(d=new a(t),d._$AT(t,i,s)),void 0!==s?(null!==(l=($=i)._$Cl)&&void 0!==l?l:$._$Cl=[])[s]=d:i._$Cu=d),void 0!==d&&(e=P(t,d._$AS(t,e.values),d,s)),e}class N{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:s}=this._$AD,n=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:l).importNode(i,!0);y.currentNode=n;let o=y.nextNode(),$=0,d=0,a=s[0];for(;void 0!==a;){if($===a.index){let e;2===a.type?e=new b(o,o.nextSibling,this,t):1===a.type?e=new a.ctor(o,a.name,a.strings,this,t):6===a.type&&(e=new E(o,this,t)),this.v.push(e),a=s[++d]}$!==(null==a?void 0:a.index)&&(o=y.nextNode(),$++)}return n}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class b{constructor(t,e,i,s){var n;this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cg=null===(n=null==s?void 0:s.isConnected)||void 0===n||n}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=P(this,t,e),r(t)?t===m||null==t||""===t?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==g&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return $(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==m&&r(this._$AH)?this._$AA.nextSibling.data=t:this.k(l.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=H.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.m(i);else{const t=new N(n,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=f.get(t.strings);return void 0===e&&f.set(t.strings,e=new H(t)),e}S(t){$(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new b(this.A(h()),this.A(h()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class T{constructor(t,e,i,s,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=m}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=P(this,t,e,0),o=!r(t)||t!==this._$AH&&t!==g,o&&(this._$AH=t);else{const s=t;let l,$;for(t=n[0],l=0;l<n.length-1;l++)$=P(this,s[i+l],e,l),$===g&&($=this._$AH[l]),o||(o=!r($)||$!==this._$AH[l]),$===m?t=m:t!==m&&(t+=(null!=$?$:"")+n[l+1]),this._$AH[l]=$}o&&!s&&this.C(t)}C(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class w extends T{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===m?void 0:t}}const M=e?e.emptyScript:"";class S extends T{constructor(){super(...arguments),this.type=4}C(t){t&&t!==m?this.element.setAttribute(this.name,M):this.element.removeAttribute(this.name)}}class I extends T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=P(this,t,e,0))&&void 0!==i?i:m)===g)return;const s=this._$AH,n=t===m&&s!==m||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==m&&(s===m||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class E{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t)}}const B=window.litHtmlPolyfillSupport;null==B||B(H,b),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.2.1");export{p as html,x as renderer};
var t;const e=globalThis.trustedTypes,i=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,s=`lit$${(Math.random()+"").slice(9)}$`,n="?"+s,o=`<${n}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,$=Array.isArray,d=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,a=/-->/g,A=/>/g,c=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,u=/'/g,_=/"/g,v=/^(?:script|style|textarea|title)$/i,p=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),g=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),f=new WeakMap,x=(t,e,i)=>{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let l=o._$litPart$;if(void 0===l){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=l=new b(e.insertBefore(h(),t),t,void 0,null!=i?i:{})}return l._$AI(t),l},y=l.createTreeWalker(l,129,null,!1),C=(t,e)=>{const n=t.length-1,l=[];let $,p=2===e?"<svg>":"",g=d;for(let e=0;e<n;e++){const i=t[e];let n,m,f=-1,y=0;for(;y<i.length&&(g.lastIndex=y,m=g.exec(i),null!==m);)y=g.lastIndex,g===d?"!--"===m[1]?g=a:void 0!==m[1]?g=A:void 0!==m[2]?(v.test(m[2])&&($=RegExp("</"+m[2],"g")),g=c):void 0!==m[3]&&(g=c):g===c?">"===m[0]?(g=null!=$?$:d,f=-1):void 0===m[1]?f=-2:(f=g.lastIndex-m[2].length,n=m[1],g=void 0===m[3]?c:'"'===m[3]?_:u):g===_||g===u?g=c:g===a||g===A?g=d:(g=c,$=void 0);const H=g===c&&t[e+1].startsWith("/>")?" ":"";p+=g===d?i+o:f>=0?(l.push(n),i.slice(0,f)+"$lit$"+i.slice(f)+s+H):i+s+(-2===f?(l.push(void 0),e):H)}const m=p+(t[n]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==i?i.createHTML(m):m,l]};class H{constructor({strings:t,_$litType$:i},o){let l;this.parts=[];let $=0,d=0;const a=t.length-1,A=this.parts,[c,u]=C(t,i);if(this.el=H.createElement(c,o),y.currentNode=this.el.content,2===i){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(l=y.nextNode())&&A.length<a;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const e of l.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(s)){const i=u[d++];if(t.push(e),void 0!==i){const t=l.getAttribute(i.toLowerCase()+"$lit$").split(s),e=/([.?@])?(.*)/.exec(i);A.push({type:1,index:$,name:e[2],strings:t,ctor:"."===e[1]?T:"?"===e[1]?S:"@"===e[1]?I:M})}else A.push({type:6,index:$})}for(const e of t)l.removeAttribute(e)}if(v.test(l.tagName)){const t=l.textContent.split(s),i=t.length-1;if(i>0){l.textContent=e?e.emptyScript:"";for(let e=0;e<i;e++)l.append(t[e],h()),y.nextNode(),A.push({type:2,index:++$});l.append(t[i],h())}}}else if(8===l.nodeType)if(l.data===n)A.push({type:2,index:$});else{let t=-1;for(;-1!==(t=l.data.indexOf(s,t+1));)A.push({type:7,index:$}),t+=s.length-1}$++}}static createElement(t,e){const i=l.createElement("template");return i.innerHTML=t,i}}function P(t,e,i=t,s){var n,o,l,$;if(e===g)return e;let d=void 0!==s?null===(n=i._$Cl)||void 0===n?void 0:n[s]:i._$Cu;const a=r(e)?void 0:e._$litDirective$;return(null==d?void 0:d.constructor)!==a&&(null===(o=null==d?void 0:d._$AO)||void 0===o||o.call(d,!1),void 0===a?d=void 0:(d=new a(t),d._$AT(t,i,s)),void 0!==s?(null!==(l=($=i)._$Cl)&&void 0!==l?l:$._$Cl=[])[s]=d:i._$Cu=d),void 0!==d&&(e=P(t,d._$AS(t,e.values),d,s)),e}class N{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:s}=this._$AD,n=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:l).importNode(i,!0);y.currentNode=n;let o=y.nextNode(),$=0,d=0,a=s[0];for(;void 0!==a;){if($===a.index){let e;2===a.type?e=new b(o,o.nextSibling,this,t):1===a.type?e=new a.ctor(o,a.name,a.strings,this,t):6===a.type&&(e=new E(o,this,t)),this.v.push(e),a=s[++d]}$!==(null==a?void 0:a.index)&&(o=y.nextNode(),$++)}return n}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class b{constructor(t,e,i,s){var n;this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cg=null===(n=null==s?void 0:s.isConnected)||void 0===n||n}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=P(this,t,e),r(t)?t===m||null==t||""===t?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==g&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>{var e;return $(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.S(t):this.$(t)}M(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==m&&r(this._$AH)?this._$AA.nextSibling.data=t:this.k(l.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=H.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.m(i);else{const t=new N(n,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=f.get(t.strings);return void 0===e&&f.set(t.strings,e=new H(t)),e}S(t){$(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new b(this.M(h()),this.M(h()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class M{constructor(t,e,i,s,n){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=m}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=P(this,t,e,0),o=!r(t)||t!==this._$AH&&t!==g,o&&(this._$AH=t);else{const s=t;let l,$;for(t=n[0],l=0;l<n.length-1;l++)$=P(this,s[i+l],e,l),$===g&&($=this._$AH[l]),o||(o=!r($)||$!==this._$AH[l]),$===m?t=m:t!==m&&(t+=(null!=$?$:"")+n[l+1]),this._$AH[l]=$}o&&!s&&this.C(t)}C(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class T extends M{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===m?void 0:t}}const w=e?e.emptyScript:"";class S extends M{constructor(){super(...arguments),this.type=4}C(t){t&&t!==m?this.element.setAttribute(this.name,w):this.element.removeAttribute(this.name)}}class I extends M{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=P(this,t,e,0))&&void 0!==i?i:m)===g)return;const s=this._$AH,n=t===m&&s!==m||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==m&&(s===m||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class E{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t)}}const B=window.litHtmlPolyfillSupport;null==B||B(H,b),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.2.5");export{p as html,x as renderer};
Loading

0 comments on commit 84b09b1

Please sign in to comment.