-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
700b356
commit 0b7c430
Showing
7 changed files
with
37 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
var htm=function(e){const t=arguments,n=this;let l,r,i=1,s="",d="",c=[0];const commit=e=>{1===i&&(e||(s=s.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(e?t[e]:s):3===i&&(e||s)?(c[1]=e?t[e]:s,i=2):2===i&&"..."===s&&e?c[2]=Object.assign(c[2]||{},t[e]):2===i&&s&&!e?(c[2]=c[2]||{})[s]=!0:i>=5&&(5===i?((c[2]=c[2]||{})[r]=e?s?s+t[e]:t[e]:s,i=6):(e||s)&&(c[2][r]+=e?s+t[e]:s)),s=""};for(let t=0;t<e.length;t++){t&&(1===i&&commit(),commit(t));for(let o=0;o<e[t].length;o++)l=e[t][o],1===i?"<"===l?(commit(),c=[c,"",null],i=3):s+=l:4===i?"--"===s&&">"===l?(i=1,s=""):s=l+s[0]:d?l===d?d="":s+=l:'"'===l||"'"===l?d=l:">"===l?(commit(),i=1):i&&("="===l?(i=5,r=s,s=""):"/"===l&&(i<5||">"===e[t][o+1])?(commit(),3===i&&(c=c[0]),i=c,(c=c[0]).push(n.apply(null,i.slice(1))),i=0):" "===l||"\t"===l||"\n"===l||"\r"===l?(commit(),i=2):s+=l),3===i&&"!--"===s&&(i=4,c=c[0])}return commit(),c.length>2?c.slice(1):c[1]};const e=htm.bind(((e,t,...n)=>{let l=null,r=!1;["svg","use","symbol","path","g","defs","title"].indexOf(e)>-1?(l=document.createElementNS("http://www.w3.org/2000/svg",e),r=!0):l=document.createElement(e);for(const e in t)if("on"===e.slice(0,2)){const n=e.slice(2),r=t[e];if(null==r)continue;l.addEventListener(n,r)}else if(["disabled","selected","checked"].indexOf(e)>-1)t[e]&&l.setAttribute(e,e);else if("xlinkHref"===e&&r)t[e]&&l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t[e]);else if("href"===e&&r)t[e]&&l.setAttributeNS("http://www.w3.org/1999/xlink","href",t[e]);else{if(null==t[e])continue;l.setAttribute(e,t[e])}if(0===n.length)return l;return n.flat(1).forEach((e=>{e instanceof Node?l.appendChild(e):l.appendChild(document.createTextNode(e))})),null==e?l.children:l}));function renderer(e,t){for(;t.firstChild;)t.removeChild(t.firstChild);Array.isArray(e)?e.forEach((e=>t.appendChild(e))):t.appendChild(e)}export{e as html,renderer}; | ||
const e=function(e){for(var t,n,l=arguments,r=1,i="",s="",d=[0],c=function(e){1===r&&(e||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?d.push(e?l[e]:i):3===r&&(e||i)?(d[1]=e?l[e]:i,r=2):2===r&&"..."===i&&e?d[2]=Object.assign(d[2]||{},l[e]):2===r&&i&&!e?(d[2]=d[2]||{})[i]=!0:r>=5&&(5===r?((d[2]=d[2]||{})[n]=e?i?i+l[e]:l[e]:i,r=6):(e||i)&&(d[2][n]+=e?i+l[e]:i)),i=""},f=0;f<e.length;f++){f&&(1===r&&c(),c(f));for(var o=0;o<e[f].length;o++)t=e[f][o],1===r?"<"===t?(c(),d=[d,"",null],r=3):i+=t:4===r?"--"===i&&">"===t?(r=1,i=""):i=t+i[0]:s?t===s?s="":i+=t:'"'===t||"'"===t?s=t:">"===t?(c(),r=1):r&&("="===t?(r=5,n=i,i=""):"/"===t&&(r<5||">"===e[f][o+1])?(c(),3===r&&(d=d[0]),r=d,(d=d[0]).push(this.apply(null,r.slice(1))),r=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(c(),r=2):i+=t),3===r&&"!--"===i&&(r=4,d=d[0])}return c(),d.length>2?d.slice(1):d[1]}.bind(((e,t,...n)=>{let l=null,r=!1;["svg","use","symbol","path","g","defs","title"].indexOf(e)>-1?(l=document.createElementNS("http://www.w3.org/2000/svg",e),r=!0):l=document.createElement(e);for(const e in t)if("on"===e.slice(0,2)){const n=e.slice(2),r=t[e];if(null==r)continue;l.addEventListener(n,r)}else if(["disabled","selected","checked"].indexOf(e)>-1)t[e]&&l.setAttribute(e,e);else if("xlinkHref"===e&&r)t[e]&&l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t[e]);else if("href"===e&&r)t[e]&&l.setAttributeNS("http://www.w3.org/1999/xlink","href",t[e]);else{if(null==t[e])continue;l.setAttribute(e,t[e])}if(0===n.length)return l;return n.flat(1).forEach((e=>{e instanceof Node?l.appendChild(e):l.appendChild(document.createTextNode(e))})),null==e?l.children:l}));function renderer(e,t){for(;t.firstChild;)t.removeChild(t.firstChild);Array.isArray(e)?e.forEach((e=>t.appendChild(e))):t.appendChild(e)}export{e as html,renderer}; | ||
//# sourceMappingURL=htm.mjs.map |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import { html, render as renderer } from 'htm/preact/standalone.mjs' | ||
import { html, render as renderer } from 'htm/preact/standalone' | ||
export { html, renderer } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters