Skip to content

Commit 49c02a3

Browse files
committed
feat: bump lit-html to v3.2.1
1 parent b472c80 commit 49c02a3

File tree

6 files changed

+2441
-2091
lines changed

6 files changed

+2441
-2091
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [5.10.0] - 2024-10-10
9+
10+
### Updates
11+
- Uplift `lit-html` to v3.2.1
12+
- Uplift dev dependencies
13+
814
## [5.9.0] - 2023-09-09
915

1016
### Updates

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ This allows any renderer to be plugged into a component.
1111

1212
The following renderers have been tested with [FicusJS](https://docs.ficusjs.org) and are available as minified bundles in this package to make working with them much easier.
1313

14-
- [htm](https://www.npmjs.com/package/htm) (JSX-like syntax - no transpiler necessary) - 923 B gzipped
15-
- [htm](https://www.npmjs.com/package/htm) with [Preact](https://www.npmjs.com/package/preact) (JSX-like syntax - no transpiler necessary) - 4.45 KB gzipped
16-
- [lit-html](https://www.npmjs.com/package/lit-html) - 3.21 KB gzipped
17-
- [uhtml](https://www.npmjs.com/package/uhtml) - 2.71 KB gzipped
18-
- css - 204 B gzipped
14+
- [htm](https://www.npmjs.com/package/htm) (JSX-like syntax - no transpiler necessary) - 910 B gzipped
15+
- [htm](https://www.npmjs.com/package/htm) with [Preact](https://www.npmjs.com/package/preact) (JSX-like syntax - no transpiler necessary) - 4.46 KB gzipped
16+
- [lit-html](https://www.npmjs.com/package/lit-html) - 3.02 KB gzipped
17+
- [uhtml](https://www.npmjs.com/package/uhtml) - 2.76 KB gzipped
18+
- css - 198 B gzipped
1919

2020
## htm
2121

dist/lit-html.mjs

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

dist/lit-html.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)