Skip to content

Commit

Permalink
feat: update htm imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ducksoupdev committed Jan 7, 2023
1 parent 700b356 commit 0b7c430
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 31 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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.6.0] - 2023-01-07

### Updates
- Uplift dev dependencies
- Update `htm` imports

## [5.5.0] - 2022-12-18

### Updates
Expand Down
2 changes: 1 addition & 1 deletion dist/htm.mjs
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
2 changes: 1 addition & 1 deletion dist/htm.mjs.map

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ficusjs/renderers",
"version": "5.5.0",
"version": "5.6.0",
"description": "Minified ES module renderers for FicusJS",
"type": "module",
"main": "dist/uhtml.mjs",
Expand Down Expand Up @@ -76,17 +76,17 @@
"devDependencies": {
"ava": "5.1.0",
"@rollup/plugin-alias": "4.0.2",
"@rollup/plugin-commonjs": "23.0.7",
"@rollup/plugin-commonjs": "24.0.0",
"@rollup/plugin-node-resolve": "15.0.1",
"c8": "7.12.0",
"cypress": "12.1.0",
"cypress": "12.3.0",
"http-server": "14.1.1",
"htm": "3.1.1",
"jsdom": "20.0.3",
"lit-html": "2.5.0",
"npm-run-all": "4.1.5",
"open-cli": "7.1.0",
"rollup": "3.7.5",
"rollup": "3.9.1",
"rollup-plugin-filesize": "9.1.2",
"rollup-plugin-terser": "7.0.2",
"standard": "16.0.4",
Expand Down
2 changes: 1 addition & 1 deletion src/htm-preact.mjs
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 }
2 changes: 1 addition & 1 deletion src/htm.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import htm from 'htm/src/index.mjs'
import htm from 'htm/mini'
import { h } from './jsx-dom.mjs'

const html = htm.bind(h)
Expand Down

0 comments on commit 0b7c430

Please sign in to comment.