Comparing version 3.0.4 to 3.1.0
{ | ||
"name": "htm", | ||
"version": "3.0.4", | ||
"version": "3.1.0", | ||
"description": "The Tagged Template syntax for Virtual DOM. Only browser-compatible syntax.", | ||
@@ -9,2 +9,35 @@ "main": "dist/htm.js", | ||
"types": "dist/htm.d.ts", | ||
"exports": { | ||
".": { | ||
"browser": "./dist/htm.module.js", | ||
"umd": "./dist/htm.umd.js", | ||
"import": "./dist/htm.mjs", | ||
"require": "./dist/htm.js" | ||
}, | ||
"./": "./", | ||
"./preact": { | ||
"browser": "./preact/index.module.js", | ||
"umd": "./preact/index.umd.js", | ||
"import": "./preact/index.mjs", | ||
"require": "./preact/index.js" | ||
}, | ||
"./preact/standalone": { | ||
"browser": "./preact/standalone.module.js", | ||
"umd": "./preact/standalone.umd.js", | ||
"import": "./preact/standalone.mjs", | ||
"require": "./preact/standalone.js" | ||
}, | ||
"./react": { | ||
"browser": "./react/index.module.js", | ||
"umd": "./react/index.umd.js", | ||
"import": "./react/index.mjs", | ||
"require": "./react/index.js" | ||
}, | ||
"./mini": { | ||
"browser": "./mini/index.module.js", | ||
"umd": "./mini/index.umd.js", | ||
"import": "./mini/index.mjs", | ||
"require": "./mini/index.js" | ||
} | ||
}, | ||
"scripts": { | ||
@@ -19,4 +52,5 @@ "build": "npm run -s build:main && npm run -s build:mini && npm run -s build:preact && npm run -s build:react && npm run -s build:babel && npm run -s build:babel-transform-jsx && npm run -s build:mjsalias", | ||
"build:mjsalias": "cp dist/htm.module.js dist/htm.mjs && cp mini/index.module.js mini/index.mjs && cp preact/index.module.js preact/index.mjs && cp preact/standalone.module.js preact/standalone.mjs && cp react/index.module.js react/index.mjs", | ||
"test": "eslint src/**/*.mjs test/**/*.mjs && npm run build && jest test", | ||
"test": "eslint src/**/*.mjs test/**/*.mjs --ignore-path .gitignore && npm run build && jest test", | ||
"test:perf": "v8 test/__perftest.mjs", | ||
"test:dist": "npm pack && mv htm*.tgz test/fixtures/esm/htm.tgz && cd test/fixtures/esm && npm install && node index.js", | ||
"release": "npm t && git commit -am \"$npm_package_version\" && git tag $npm_package_version && git push && git push --tags && npm publish" | ||
@@ -77,2 +111,3 @@ }, | ||
"@babel/preset-env": "^7.1.6", | ||
"@types/jest": "^26.0.24", | ||
"babel-jest": "^24.1.0", | ||
@@ -84,5 +119,5 @@ "babel-preset-env": "^1.7.0", | ||
"microbundle": "^0.10.1", | ||
"preact": "^10.0.0", | ||
"preact": "^10.2.0", | ||
"react": "^16.8.3" | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
var e,n,t,_,o,r,u,l={},i=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function s(e,n){for(var t in n)e[t]=n[t];return e}function f(e){var n=e.parentNode;n&&n.removeChild(e)}function a(e,n,t){var _,o=arguments,r={};for(_ in n)"key"!==_&&"ref"!==_&&(r[_]=n[_]);if(arguments.length>3)for(t=[t],_=3;_<arguments.length;_++)t.push(o[_]);if(null!=t&&(r.children=t),"function"==typeof e&&null!=e.defaultProps)for(_ in e.defaultProps)void 0===r[_]&&(r[_]=e.defaultProps[_]);return p(e,r,n&&n.key,n&&n.ref,null)}function p(n,t,_,o,r){var u={type:n,props:t,key:_,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r};return null==r&&(u.__v=u),e.vnode&&e.vnode(u),u}function h(e){return e.children}function d(e,n){this.props=e,this.context=n}function v(e,n){if(null==n)return e.__?v(e.__,e.__.__k.indexOf(e)+1):null;for(var t;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e)return t.__e;return"function"==typeof e.type?v(e):null}function m(e){var n,t;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e){e.__e=e.__c.base=t.__e;break}return m(e)}}function y(r){(!r.__d&&(r.__d=!0)&&n.push(r)&&!t++||o!==e.debounceRendering)&&((o=e.debounceRendering)||_)(g)}function g(){for(var e;t=n.length;)e=n.sort(function(e,n){return e.__v.__b-n.__v.__b}),n=[],e.some(function(e){var n,t,_,o,r,u,l;e.__d&&(u=(r=(n=e).__v).__e,(l=n.__P)&&(t=[],(_=s({},r)).__v=_,o=H(l,r,_,n.__n,void 0!==l.ownerSVGElement,null,t,null==u?v(r):u),S(t,r),o!=u&&m(r)))})}function k(e,n,t,_,o,r,u,c,s){var a,p,h,d,m,y,g,k=t&&t.__k||i,x=k.length;if(c==l&&(c=null!=r?r[0]:x?v(t,0):null),a=0,n.__k=b(n.__k,function(t){if(null!=t){if(t.__=n,t.__b=n.__b+1,null===(h=k[a])||h&&t.key==h.key&&t.type===h.type)k[a]=void 0;else for(p=0;p<x;p++){if((h=k[p])&&t.key==h.key&&t.type===h.type){k[p]=void 0;break}h=null}if(d=H(e,t,h=h||l,_,o,r,u,c,s),(p=t.ref)&&h.ref!=p&&(g||(g=[]),h.ref&&g.push(h.ref,null,t),g.push(p,t.__c||d,t)),null!=d){var i;if(null==y&&(y=d),void 0!==t.__d)i=t.__d,t.__d=void 0;else if(r==h||d!=c||null==d.parentNode){e:if(null==c||c.parentNode!==e)e.appendChild(d),i=null;else{for(m=c,p=0;(m=m.nextSibling)&&p<x;p+=2)if(m==d)break e;e.insertBefore(d,c),i=c}"option"==n.type&&(e.value="")}c=void 0!==i?i:d.nextSibling,"function"==typeof n.type&&(n.__d=c)}else c&&h.__e==c&&c.parentNode!=e&&(c=v(h))}return a++,t}),n.__e=y,null!=r&&"function"!=typeof n.type)for(a=r.length;a--;)null!=r[a]&&f(r[a]);for(a=x;a--;)null!=k[a]&&D(k[a],k[a]);if(g)for(a=0;a<g.length;a++)P(g[a],g[++a],g[++a])}function b(e,n,t){if(null==t&&(t=[]),null==e||"boolean"==typeof e)n&&t.push(n(null));else if(Array.isArray(e))for(var _=0;_<e.length;_++)b(e[_],n,t);else t.push(n?n("string"==typeof e||"number"==typeof e?p(null,e,null,null,e):null!=e.__e||null!=e.__c?p(e.type,e.props,e.key,null,e.__v):e):e);return t}function x(e,n,t){"-"===n[0]?e.setProperty(n,t):e[n]="number"==typeof t&&!1===c.test(n)?t+"px":null==t?"":t}function w(e,n,t,_,o){var r,u,l,i,c;if(o?"className"===n&&(n="class"):"class"===n&&(n="className"),"style"===n)if(r=e.style,"string"==typeof t)r.cssText=t;else{if("string"==typeof _&&(r.cssText="",_=null),_)for(i in _)t&&i in t||x(r,i,"");if(t)for(c in t)_&&t[c]===_[c]||x(r,c,t[c])}else"o"===n[0]&&"n"===n[1]?(u=n!==(n=n.replace(/Capture$/,"")),l=n.toLowerCase(),n=(l in e?l:n).slice(2),t?(_||e.addEventListener(n,C,u),(e.l||(e.l={}))[n]=t):e.removeEventListener(n,C,u)):"list"!==n&&"tagName"!==n&&"form"!==n&&"type"!==n&&"size"!==n&&!o&&n in e?e[n]=null==t?"":t:"function"!=typeof t&&"dangerouslySetInnerHTML"!==n&&(n!==(n=n.replace(/^xlink:?/,""))?null==t||!1===t?e.removeAttributeNS("http://www.w3.org/1999/xlink",n.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",n.toLowerCase(),t):null==t||!1===t&&!/^ar/.test(n)?e.removeAttribute(n):e.setAttribute(n,t))}function C(n){this.l[n.type](e.event?e.event(n):n)}function H(n,t,_,o,r,u,l,i,c){var f,a,p,v,m,y,g,b,x,w,C=t.type;if(void 0!==t.constructor)return null;(f=e.__b)&&f(t);try{e:if("function"==typeof C){if(b=t.props,x=(f=C.contextType)&&o[f.__c],w=f?x?x.props.value:f.__:o,_.__c?g=(a=t.__c=_.__c).__=a.__E:("prototype"in C&&C.prototype.render?t.__c=a=new C(b,w):(t.__c=a=new d(b,w),a.constructor=C,a.render=N),x&&x.sub(a),a.props=b,a.state||(a.state={}),a.context=w,a.__n=o,p=a.__d=!0,a.__h=[]),null==a.__s&&(a.__s=a.state),null!=C.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=s({},a.__s)),s(a.__s,C.getDerivedStateFromProps(b,a.__s))),v=a.props,m=a.state,p)null==C.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else{if(null==C.getDerivedStateFromProps&&b!==v&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(b,w),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(b,a.__s,w)||t.__v===_.__v&&!a.__){for(a.props=b,a.state=a.__s,t.__v!==_.__v&&(a.__d=!1),a.__v=t,t.__e=_.__e,t.__k=_.__k,a.__h.length&&l.push(a),f=0;f<t.__k.length;f++)t.__k[f]&&(t.__k[f].__=t);break e}null!=a.componentWillUpdate&&a.componentWillUpdate(b,a.__s,w),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(v,m,y)})}a.context=w,a.props=b,a.state=a.__s,(f=e.__r)&&f(t),a.__d=!1,a.__v=t,a.__P=n,f=a.render(a.props,a.state,a.context),t.__k=null!=f&&f.type==h&&null==f.key?f.props.children:Array.isArray(f)?f:[f],null!=a.getChildContext&&(o=s(s({},o),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(y=a.getSnapshotBeforeUpdate(v,m)),k(n,t,_,o,r,u,l,i,c),a.base=t.__e,a.__h.length&&l.push(a),g&&(a.__E=a.__=null),a.__e=!1}else null==u&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=E(_.__e,t,_,o,r,u,l,c);(f=e.diffed)&&f(t)}catch(n){t.__v=null,e.__e(n,t,_)}return t.__e}function S(n,t){e.__c&&e.__c(t,n),n.some(function(t){try{n=t.__h,t.__h=[],n.some(function(e){e.call(t)})}catch(n){e.__e(n,t.__v)}})}function E(e,n,t,_,o,r,u,c){var s,f,a,p,h,d=t.props,v=n.props;if(o="svg"===n.type||o,null!=r)for(s=0;s<r.length;s++)if(null!=(f=r[s])&&((null===n.type?3===f.nodeType:f.localName===n.type)||e==f)){e=f,r[s]=null;break}if(null==e){if(null===n.type)return document.createTextNode(v);e=o?document.createElementNS("http://www.w3.org/2000/svg",n.type):document.createElement(n.type,v.is&&{is:v.is}),r=null,c=!1}if(null===n.type)d!==v&&e.data!=v&&(e.data=v);else{if(null!=r&&(r=i.slice.call(e.childNodes)),a=(d=t.props||l).dangerouslySetInnerHTML,p=v.dangerouslySetInnerHTML,!c){if(d===l)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(p||a)&&(p&&a&&p.__html==a.__html||(e.innerHTML=p&&p.__html||""))}(function(e,n,t,_,o){var r;for(r in t)"children"===r||"key"===r||r in n||w(e,r,null,t[r],_);for(r in n)o&&"function"!=typeof n[r]||"children"===r||"key"===r||"value"===r||"checked"===r||t[r]===n[r]||w(e,r,n[r],t[r],_)})(e,v,d,o,c),n.__k=n.props.children,p||k(e,n,t,_,"foreignObject"!==n.type&&o,r,u,l,c),c||("value"in v&&void 0!==v.value&&v.value!==e.value&&(e.value=null==v.value?"":v.value),"checked"in v&&void 0!==v.checked&&v.checked!==e.checked&&(e.checked=v.checked))}return e}function P(n,t,_){try{"function"==typeof n?n(t):n.current=t}catch(n){e.__e(n,_)}}function D(n,t,_){var o,r,u;if(e.unmount&&e.unmount(n),(o=n.ref)&&(o.current&&o.current!==n.__e||P(o,null,t)),_||"function"==typeof n.type||(_=null!=(r=n.__e)),n.__e=n.__d=void 0,null!=(o=n.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(n){e.__e(n,t)}o.base=o.__P=null}if(o=n.__k)for(u=0;u<o.length;u++)o[u]&&D(o[u],t,_);null!=r&&f(r)}function N(e,n,t){return this.constructor(e,t)}function T(n,t,_){var o,u,c;e.__&&e.__(n,t),u=(o=_===r)?null:_&&_.__k||t.__k,n=a(h,null,[n]),c=[],H(t,(o?t:_||t).__k=n,u||l,l,void 0!==t.ownerSVGElement,_&&!o?[_]:u?null:i.slice.call(t.childNodes),c,_||l,o),S(c,n)}function U(e){var n={},t={__c:"__cC"+u++,__:e,Consumer:function(e,n){return e.children(n)},Provider:function(e){var _,o=this;return this.getChildContext||(_=[],this.getChildContext=function(){return n[t.__c]=o,n},this.shouldComponentUpdate=function(e){o.props.value!==e.value&&_.some(function(n){n.context=e.value,y(n)})},this.sub=function(e){_.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){_.splice(_.indexOf(e),1),n&&n.call(e)}}),e.children}};return t.Consumer.contextType=t,t}e={__e:function(e,n){for(var t,_;n=n.__;)if((t=n.__c)&&!t.__)try{if(t.constructor&&null!=t.constructor.getDerivedStateFromError&&(_=!0,t.setState(t.constructor.getDerivedStateFromError(e))),null!=t.componentDidCatch&&(_=!0,t.componentDidCatch(e)),_)return y(t.__E=t)}catch(n){e=n}throw e}},d.prototype.setState=function(e,n){var t;t=this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof e&&(e=e(t,this.props)),e&&s(t,e),null!=e&&this.__v&&(n&&this.__h.push(n),y(this))},d.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),y(this))},d.prototype.render=h,n=[],t=0,_="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,r=l,u=0;var A,M,F,L=[],W=e.__r,R=e.diffed,V=e.__c,I=e.unmount;function O(n){e.__h&&e.__h(M);var t=M.__H||(M.__H={__:[],__h:[]});return n>=t.__.length&&t.__.push({}),t.__[n]}function q(e){return B(te,e)}function B(e,n,t){var _=O(A++);return _.__c||(_.__c=M,_.__=[t?t(n):te(void 0,n),function(n){var t=e(_.__[0],n);_.__[0]!==t&&(_.__[0]=t,_.__c.setState({}))}]),_.__}function $(e,n){var t=O(A++);ne(t.__H,n)&&(t.__=e,t.__H=n,M.__H.__h.push(t))}function j(e,n){var t=O(A++);ne(t.__H,n)&&(t.__=e,t.__H=n,M.__h.push(t))}function z(e){return J(function(){return{current:e}},[])}function G(e,n,t){j(function(){"function"==typeof e?e(n()):e&&(e.current=n())},null==t?t:t.concat(e))}function J(e,n){var t=O(A++);return ne(t.__H,n)?(t.__H=n,t.__h=e,t.__=e()):t.__}function K(e,n){return J(function(){return e},n)}function Q(e){var n=M.context[e.__c];if(!n)return e.__;var t=O(A++);return null==t.__&&(t.__=!0,n.sub(M)),n.props.value}function X(n,t){e.useDebugValue&&e.useDebugValue(t?t(n):n)}function Y(){L.some(function(n){if(n.__P)try{n.__H.__h.forEach(Z),n.__H.__h.forEach(ee),n.__H.__h=[]}catch(t){return n.__H.__h=[],e.__e(t,n.__v),!0}}),L=[]}function Z(e){e.t&&e.t()}function ee(e){var n=e.__();"function"==typeof n&&(e.t=n)}function ne(e,n){return!e||n.some(function(n,t){return n!==e[t]})}function te(e,n){return"function"==typeof n?n(e):n}e.__r=function(e){W&&W(e),A=0,(M=e.__c).__H&&(M.__H.__h.forEach(Z),M.__H.__h.forEach(ee),M.__H.__h=[])},e.diffed=function(n){R&&R(n);var t=n.__c;if(t){var _=t.__H;_&&_.__h.length&&(1!==L.push(t)&&F===e.requestAnimationFrame||((F=e.requestAnimationFrame)||function(e){var n,t=function(){clearTimeout(_),cancelAnimationFrame(n),setTimeout(e)},_=setTimeout(t,100);"undefined"!=typeof window&&(n=requestAnimationFrame(t))})(Y))}},e.__c=function(n,t){t.some(function(n){try{n.__h.forEach(Z),n.__h=n.__h.filter(function(e){return!e.__||ee(e)})}catch(_){t.some(function(e){e.__h&&(e.__h=[])}),t=[],e.__e(_,n.__v)}}),V&&V(n,t)},e.unmount=function(n){I&&I(n);var t=n.__c;if(t){var _=t.__H;if(_)try{_.__.forEach(function(e){return e.t&&e.t()})}catch(n){e.__e(n,t.__v)}}};var _e=function(e,n,t,_){var o;n[0]=0;for(var r=1;r<n.length;r++){var u=n[r++],l=n[r]?(n[0]|=u?1:2,t[n[r++]]):n[++r];3===u?_[0]=l:4===u?_[1]=Object.assign(_[1]||{},l):5===u?(_[1]=_[1]||{})[n[++r]]=l:6===u?_[1][n[++r]]+=l+"":u?(o=e.apply(l,_e(e,l,t,["",null])),_.push(o),l[0]?n[0]|=2:(n[r-2]=0,n[r]=o)):_.push(l)}return _},oe=new Map,re=function(e){var n=oe.get(this);return n||(n=new Map,oe.set(this,n)),(n=_e(this,n.get(e)||(n.set(e,n=function(e){for(var n,t,_=1,o="",r="",u=[0],l=function(e){1===_&&(e||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?u.push(0,e,o):3===_&&(e||o)?(u.push(3,e,o),_=2):2===_&&"..."===o&&e?u.push(4,e,0):2===_&&o&&!e?u.push(5,0,!0,o):_>=5&&((o||!e&&5===_)&&(u.push(_,0,o,t),_=6),e&&(u.push(_,e,0,t),_=6)),o=""},i=0;i<e.length;i++){i&&(1===_&&l(),l(i));for(var c=0;c<e[i].length;c++)n=e[i][c],1===_?"<"===n?(l(),u=[u],_=3):o+=n:4===_?"--"===o&&">"===n?(_=1,o=""):o=n+o[0]:r?n===r?r="":o+=n:'"'===n||"'"===n?r=n:">"===n?(l(),_=1):_&&("="===n?(_=5,t=o,o=""):"/"===n&&(_<5||">"===e[i][c+1])?(l(),3===_&&(u=u[0]),_=u,(u=u[0]).push(2,0,_),_=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(l(),_=2):o+=n),3===_&&"!--"===o&&(_=4,u=u[0])}return l(),u}(e)),n),arguments,[])).length>1?n:n[0]}.bind(a);export{a as h,re as html,T as render,d as Component,U as createContext,q as useState,B as useReducer,$ as useEffect,j as useLayoutEffect,z as useRef,G as useImperativeHandle,J as useMemo,K as useCallback,Q as useContext,X as useDebugValue}; | ||
var e,n,_,t,o,r,u,l={},i=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(e,n){for(var _ in n)e[_]=n[_];return e}function f(e){var n=e.parentNode;n&&n.removeChild(e)}function a(n,_,t){var o,r,u,l={};for(u in _)"key"==u?o=_[u]:"ref"==u?r=_[u]:l[u]=_[u];if(arguments.length>2&&(l.children=arguments.length>3?e.call(arguments,2):t),"function"==typeof n&&null!=n.defaultProps)for(u in n.defaultProps)void 0===l[u]&&(l[u]=n.defaultProps[u]);return p(n,l,o,r,null)}function p(e,t,o,r,u){var l={type:e,props:t,key:o,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==u?++_:u};return null!=n.vnode&&n.vnode(l),l}function h(e){return e.children}function d(e,n){this.props=e,this.context=n}function v(e,n){if(null==n)return e.__?v(e.__,e.__.__k.indexOf(e)+1):null;for(var _;n<e.__k.length;n++)if(null!=(_=e.__k[n])&&null!=_.__e)return _.__e;return"function"==typeof e.type?v(e):null}function y(e){var n,_;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(_=e.__k[n])&&null!=_.__e){e.__e=e.__c.base=_.__e;break}return y(e)}}function m(e){(!e.__d&&(e.__d=!0)&&t.push(e)&&!g.__r++||r!==n.debounceRendering)&&((r=n.debounceRendering)||o)(g)}function g(){for(var e;g.__r=t.length;)e=t.sort(function(e,n){return e.__v.__b-n.__v.__b}),t=[],e.some(function(e){var n,_,t,o,r,u;e.__d&&(r=(o=(n=e).__v).__e,(u=n.__P)&&(_=[],(t=s({},o)).__v=o.__v+1,P(u,o,t,n.__n,void 0!==u.ownerSVGElement,null!=o.__h?[r]:null,_,null==r?v(o):r,o.__h),D(_,o),o.__e!=r&&y(o)))})}function k(e,n,_,t,o,r,u,c,s,f){var a,d,y,m,g,k,x,H=t&&t.__k||i,E=H.length;for(_.__k=[],a=0;a<n.length;a++)if(null!=(m=_.__k[a]=null==(m=n[a])||"boolean"==typeof m?null:"string"==typeof m||"number"==typeof m||"bigint"==typeof m?p(null,m,null,null,m):Array.isArray(m)?p(h,{children:m},null,null,null):m.__b>0?p(m.type,m.props,m.key,null,m.__v):m)){if(m.__=_,m.__b=_.__b+1,null===(y=H[a])||y&&m.key==y.key&&m.type===y.type)H[a]=void 0;else for(d=0;d<E;d++){if((y=H[d])&&m.key==y.key&&m.type===y.type){H[d]=void 0;break}y=null}P(e,m,y=y||l,o,r,u,c,s,f),g=m.__e,(d=m.ref)&&y.ref!=d&&(x||(x=[]),y.ref&&x.push(y.ref,null,m),x.push(d,m.__c||g,m)),null!=g?(null==k&&(k=g),"function"==typeof m.type&&null!=m.__k&&m.__k===y.__k?m.__d=s=b(m,s,e):s=C(e,m,y,H,g,s),f||"option"!==_.type?"function"==typeof _.type&&(_.__d=s):e.value=""):s&&y.__e==s&&s.parentNode!=e&&(s=v(y))}for(_.__e=k,a=E;a--;)null!=H[a]&&("function"==typeof _.type&&null!=H[a].__e&&H[a].__e==_.__d&&(_.__d=v(t,a+1)),U(H[a],H[a]));if(x)for(a=0;a<x.length;a++)T(x[a],x[++a],x[++a])}function b(e,n,_){var t,o;for(t=0;t<e.__k.length;t++)(o=e.__k[t])&&(o.__=e,n="function"==typeof o.type?b(o,n,_):C(_,o,o,e.__k,o.__e,n));return n}function C(e,n,_,t,o,r){var u,l,i;if(void 0!==n.__d)u=n.__d,n.__d=void 0;else if(null==_||o!=r||null==o.parentNode)e:if(null==r||r.parentNode!==e)e.appendChild(o),u=null;else{for(l=r,i=0;(l=l.nextSibling)&&i<t.length;i+=2)if(l==o)break e;e.insertBefore(o,r),u=r}return void 0!==u?u:o.nextSibling}function x(e,n,_){"-"===n[0]?e.setProperty(n,_):e[n]=null==_?"":"number"!=typeof _||c.test(n)?_:_+"px"}function H(e,n,_,t,o){var r;e:if("style"===n)if("string"==typeof _)e.style.cssText=_;else{if("string"==typeof t&&(e.style.cssText=t=""),t)for(n in t)_&&n in _||x(e.style,n,"");if(_)for(n in _)t&&_[n]===t[n]||x(e.style,n,_[n])}else if("o"===n[0]&&"n"===n[1])r=n!==(n=n.replace(/Capture$/,"")),n=n.toLowerCase()in e?n.toLowerCase().slice(2):n.slice(2),e.l||(e.l={}),e.l[n+r]=_,_?t||e.addEventListener(n,r?S:E,r):e.removeEventListener(n,r?S:E,r);else if("dangerouslySetInnerHTML"!==n){if(o)n=n.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==n&&"list"!==n&&"form"!==n&&"tabIndex"!==n&&"download"!==n&&n in e)try{e[n]=null==_?"":_;break e}catch(e){}"function"==typeof _||(null!=_&&(!1!==_||"a"===n[0]&&"r"===n[1])?e.setAttribute(n,_):e.removeAttribute(n))}}function E(e){this.l[e.type+!1](n.event?n.event(e):e)}function S(e){this.l[e.type+!0](n.event?n.event(e):e)}function P(e,_,t,o,r,u,l,i,c){var f,a,p,v,y,m,g,b,C,x,H,E=_.type;if(void 0!==_.constructor)return null;null!=t.__h&&(c=t.__h,i=_.__e=t.__e,_.__h=null,u=[i]),(f=n.__b)&&f(_);try{e:if("function"==typeof E){if(b=_.props,C=(f=E.contextType)&&o[f.__c],x=f?C?C.props.value:f.__:o,t.__c?g=(a=_.__c=t.__c).__=a.__E:("prototype"in E&&E.prototype.render?_.__c=a=new E(b,x):(_.__c=a=new d(b,x),a.constructor=E,a.render=A),C&&C.sub(a),a.props=b,a.state||(a.state={}),a.context=x,a.__n=o,p=a.__d=!0,a.__h=[]),null==a.__s&&(a.__s=a.state),null!=E.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=s({},a.__s)),s(a.__s,E.getDerivedStateFromProps(b,a.__s))),v=a.props,y=a.state,p)null==E.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else{if(null==E.getDerivedStateFromProps&&b!==v&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(b,x),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(b,a.__s,x)||_.__v===t.__v){a.props=b,a.state=a.__s,_.__v!==t.__v&&(a.__d=!1),a.__v=_,_.__e=t.__e,_.__k=t.__k,_.__k.forEach(function(e){e&&(e.__=_)}),a.__h.length&&l.push(a);break e}null!=a.componentWillUpdate&&a.componentWillUpdate(b,a.__s,x),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(v,y,m)})}a.context=x,a.props=b,a.state=a.__s,(f=n.__r)&&f(_),a.__d=!1,a.__v=_,a.__P=e,f=a.render(a.props,a.state,a.context),a.state=a.__s,null!=a.getChildContext&&(o=s(s({},o),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(m=a.getSnapshotBeforeUpdate(v,y)),H=null!=f&&f.type===h&&null==f.key?f.props.children:f,k(e,Array.isArray(H)?H:[H],_,t,o,r,u,l,i,c),a.base=_.__e,_.__h=null,a.__h.length&&l.push(a),g&&(a.__E=a.__=null),a.__e=!1}else null==u&&_.__v===t.__v?(_.__k=t.__k,_.__e=t.__e):_.__e=w(t.__e,_,t,o,r,u,l,c);(f=n.diffed)&&f(_)}catch(e){_.__v=null,(c||null!=u)&&(_.__e=i,_.__h=!!c,u[u.indexOf(i)]=null),n.__e(e,_,t)}}function D(e,_){n.__c&&n.__c(_,e),e.some(function(_){try{e=_.__h,_.__h=[],e.some(function(e){e.call(_)})}catch(e){n.__e(e,_.__v)}})}function w(n,_,t,o,r,u,i,c){var s,a,p,h=t.props,d=_.props,y=_.type,m=0;if("svg"===y&&(r=!0),null!=u)for(;m<u.length;m++)if((s=u[m])&&(s===n||(y?s.localName==y:3==s.nodeType))){n=s,u[m]=null;break}if(null==n){if(null===y)return document.createTextNode(d);n=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,d.is&&d),u=null,c=!1}if(null===y)h===d||c&&n.data===d||(n.data=d);else{if(u=u&&e.call(n.childNodes),a=(h=t.props||l).dangerouslySetInnerHTML,p=d.dangerouslySetInnerHTML,!c){if(null!=u)for(h={},m=0;m<n.attributes.length;m++)h[n.attributes[m].name]=n.attributes[m].value;(p||a)&&(p&&(a&&p.__html==a.__html||p.__html===n.innerHTML)||(n.innerHTML=p&&p.__html||""))}if(function(e,n,_,t,o){var r;for(r in _)"children"===r||"key"===r||r in n||H(e,r,null,_[r],t);for(r in n)o&&"function"!=typeof n[r]||"children"===r||"key"===r||"value"===r||"checked"===r||_[r]===n[r]||H(e,r,n[r],_[r],t)}(n,d,h,r,c),p)_.__k=[];else if(m=_.props.children,k(n,Array.isArray(m)?m:[m],_,t,o,r&&"foreignObject"!==y,u,i,u?u[0]:t.__k&&v(t,0),c),null!=u)for(m=u.length;m--;)null!=u[m]&&f(u[m]);c||("value"in d&&void 0!==(m=d.value)&&(m!==n.value||"progress"===y&&!m)&&H(n,"value",m,h.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==n.checked&&H(n,"checked",m,h.checked,!1))}return n}function T(e,_,t){try{"function"==typeof e?e(_):e.current=_}catch(e){n.__e(e,t)}}function U(e,_,t){var o,r;if(n.unmount&&n.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||T(o,null,_)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){n.__e(e,_)}o.base=o.__P=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&U(o[r],_,"function"!=typeof e.type);t||null==e.__e||f(e.__e),e.__e=e.__d=void 0}function A(e,n,_){return this.constructor(e,_)}function M(_,t,o){var r,u,i;n.__&&n.__(_,t),u=(r="function"==typeof o)?null:o&&o.__k||t.__k,i=[],P(t,_=(!r&&o||t).__k=a(h,null,[_]),u||l,l,void 0!==t.ownerSVGElement,!r&&o?[o]:u?null:t.firstChild?e.call(t.childNodes):null,i,!r&&o?o:u?u.__e:t.firstChild,r),D(i,_)}function F(e,n){var _={__c:n="__cC"+u++,__:e,Consumer:function(e,n){return e.children(n)},Provider:function(e){var _,t;return this.getChildContext||(_=[],(t={})[n]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&_.some(m)},this.sub=function(e){_.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){_.splice(_.indexOf(e),1),n&&n.call(e)}}),e.children}};return _.Provider.__=_.Consumer.contextType=_}e=i.slice,n={__e:function(e,n){for(var _,t,o;n=n.__;)if((_=n.__c)&&!_.__)try{if((t=_.constructor)&&null!=t.getDerivedStateFromError&&(_.setState(t.getDerivedStateFromError(e)),o=_.__d),null!=_.componentDidCatch&&(_.componentDidCatch(e),o=_.__d),o)return _.__E=_}catch(n){e=n}throw e}},_=0,d.prototype.setState=function(e,n){var _;_=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof e&&(e=e(s({},_),this.props)),e&&s(_,e),null!=e&&this.__v&&(n&&this.__h.push(n),m(this))},d.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),m(this))},d.prototype.render=h,t=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0,u=0;var L,N,W,R=0,I=[],O=n.__b,V=n.__r,q=n.diffed,B=n.__c,$=n.unmount;function j(e,_){n.__h&&n.__h(N,e,R||_),R=0;var t=N.__H||(N.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function G(e){return R=1,z(ie,e)}function z(e,n,_){var t=j(L++,2);return t.t=e,t.__c||(t.__=[_?_(n):ie(void 0,n),function(e){var n=t.t(t.__[0],e);t.__[0]!==n&&(t.__=[n,t.__[1]],t.__c.setState({}))}],t.__c=N),t.__}function J(e,_){var t=j(L++,3);!n.__s&&le(t.__H,_)&&(t.__=e,t.__H=_,N.__H.__h.push(t))}function K(e,_){var t=j(L++,4);!n.__s&&le(t.__H,_)&&(t.__=e,t.__H=_,N.__h.push(t))}function Q(e){return R=5,Y(function(){return{current:e}},[])}function X(e,n,_){R=6,K(function(){"function"==typeof e?e(n()):e&&(e.current=n())},null==_?_:_.concat(e))}function Y(e,n){var _=j(L++,7);return le(_.__H,n)&&(_.__=e(),_.__H=n,_.__h=e),_.__}function Z(e,n){return R=8,Y(function(){return e},n)}function ee(e){var n=N.context[e.__c],_=j(L++,9);return _.c=e,n?(null==_.__&&(_.__=!0,n.sub(N)),n.props.value):e.__}function ne(e,_){n.useDebugValue&&n.useDebugValue(_?_(e):e)}function _e(e){var n=j(L++,10),_=G();return n.__=e,N.componentDidCatch||(N.componentDidCatch=function(e){n.__&&n.__(e),_[1](e)}),[_[0],function(){_[1](void 0)}]}function te(){I.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(re),e.__H.__h.forEach(ue),e.__H.__h=[]}catch(_){e.__H.__h=[],n.__e(_,e.__v)}}),I=[]}n.__b=function(e){N=null,O&&O(e)},n.__r=function(e){V&&V(e),L=0;var n=(N=e.__c).__H;n&&(n.__h.forEach(re),n.__h.forEach(ue),n.__h=[])},n.diffed=function(e){q&&q(e);var _=e.__c;_&&_.__H&&_.__H.__h.length&&(1!==I.push(_)&&W===n.requestAnimationFrame||((W=n.requestAnimationFrame)||function(e){var n,_=function(){clearTimeout(t),oe&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(_,100);oe&&(n=requestAnimationFrame(_))})(te)),N=void 0},n.__c=function(e,_){_.some(function(e){try{e.__h.forEach(re),e.__h=e.__h.filter(function(e){return!e.__||ue(e)})}catch(t){_.some(function(e){e.__h&&(e.__h=[])}),_=[],n.__e(t,e.__v)}}),B&&B(e,_)},n.unmount=function(e){$&&$(e);var _=e.__c;if(_&&_.__H)try{_.__H.__.forEach(re)}catch(e){n.__e(e,_.__v)}};var oe="function"==typeof requestAnimationFrame;function re(e){var n=N;"function"==typeof e.__c&&e.__c(),N=n}function ue(e){var n=N;e.__c=e.__(),N=n}function le(e,n){return!e||e.length!==n.length||n.some(function(n,_){return n!==e[_]})}function ie(e,n){return"function"==typeof n?n(e):n}var ce=function(e,n,_,t){var o;n[0]=0;for(var r=1;r<n.length;r++){var u=n[r++],l=n[r]?(n[0]|=u?1:2,_[n[r++]]):n[++r];3===u?t[0]=l:4===u?t[1]=Object.assign(t[1]||{},l):5===u?(t[1]=t[1]||{})[n[++r]]=l:6===u?t[1][n[++r]]+=l+"":u?(o=e.apply(l,ce(e,l,_,["",null])),t.push(o),l[0]?n[0]|=2:(n[r-2]=0,n[r]=o)):t.push(l)}return t},se=new Map,fe=function(e){var n=se.get(this);return n||(n=new Map,se.set(this,n)),(n=ce(this,n.get(e)||(n.set(e,n=function(e){for(var n,_,t=1,o="",r="",u=[0],l=function(e){1===t&&(e||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?u.push(0,e,o):3===t&&(e||o)?(u.push(3,e,o),t=2):2===t&&"..."===o&&e?u.push(4,e,0):2===t&&o&&!e?u.push(5,0,!0,o):t>=5&&((o||!e&&5===t)&&(u.push(t,0,o,_),t=6),e&&(u.push(t,e,0,_),t=6)),o=""},i=0;i<e.length;i++){i&&(1===t&&l(),l(i));for(var c=0;c<e[i].length;c++)n=e[i][c],1===t?"<"===n?(l(),u=[u],t=3):o+=n:4===t?"--"===o&&">"===n?(t=1,o=""):o=n+o[0]:r?n===r?r="":o+=n:'"'===n||"'"===n?r=n:">"===n?(l(),t=1):t&&("="===n?(t=5,_=o,o=""):"/"===n&&(t<5||">"===e[i][c+1])?(l(),3===t&&(u=u[0]),t=u,(u=u[0]).push(2,0,t),t=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(l(),t=2):o+=n),3===t&&"!--"===o&&(t=4,u=u[0])}return l(),u}(e)),n),arguments,[])).length>1?n:n[0]}.bind(a);export{a as h,fe as html,M as render,d as Component,F as createContext,G as useState,z as useReducer,J as useEffect,K as useLayoutEffect,Q as useRef,X as useImperativeHandle,Y as useMemo,Z as useCallback,ee as useContext,ne as useDebugValue,_e as useErrorBoundary}; |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.htmPreact={})}(this,function(e){var n,t,_,o,r,u,l,i={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function f(e,n){for(var t in n)e[t]=n[t];return e}function a(e){var n=e.parentNode;n&&n.removeChild(e)}function p(e,n,t){var _,o=arguments,r={};for(_ in n)"key"!==_&&"ref"!==_&&(r[_]=n[_]);if(arguments.length>3)for(t=[t],_=3;_<arguments.length;_++)t.push(o[_]);if(null!=t&&(r.children=t),"function"==typeof e&&null!=e.defaultProps)for(_ in e.defaultProps)void 0===r[_]&&(r[_]=e.defaultProps[_]);return h(e,r,n&&n.key,n&&n.ref,null)}function h(e,t,_,o,r){var u={type:e,props:t,key:_,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r};return null==r&&(u.__v=u),n.vnode&&n.vnode(u),u}function d(e){return e.children}function v(e,n){this.props=e,this.context=n}function m(e,n){if(null==n)return e.__?m(e.__,e.__.__k.indexOf(e)+1):null;for(var t;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e)return t.__e;return"function"==typeof e.type?m(e):null}function y(e){var n,t;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e){e.__e=e.__c.base=t.__e;break}return y(e)}}function g(e){(!e.__d&&(e.__d=!0)&&t.push(e)&&!_++||r!==n.debounceRendering)&&((r=n.debounceRendering)||o)(k)}function k(){for(var e;_=t.length;)e=t.sort(function(e,n){return e.__v.__b-n.__v.__b}),t=[],e.some(function(e){var n,t,_,o,r,u,l;e.__d&&(u=(r=(n=e).__v).__e,(l=n.__P)&&(t=[],(_=f({},r)).__v=_,o=S(l,r,_,n.__n,void 0!==l.ownerSVGElement,null,t,null==u?m(r):u),E(t,r),o!=u&&y(r)))})}function b(e,n,t,_,o,r,u,l,s){var f,p,h,d,v,y,g,k=t&&t.__k||c,b=k.length;if(l==i&&(l=null!=r?r[0]:b?m(t,0):null),f=0,n.__k=x(n.__k,function(t){if(null!=t){if(t.__=n,t.__b=n.__b+1,null===(h=k[f])||h&&t.key==h.key&&t.type===h.type)k[f]=void 0;else for(p=0;p<b;p++){if((h=k[p])&&t.key==h.key&&t.type===h.type){k[p]=void 0;break}h=null}if(d=S(e,t,h=h||i,_,o,r,u,l,s),(p=t.ref)&&h.ref!=p&&(g||(g=[]),h.ref&&g.push(h.ref,null,t),g.push(p,t.__c||d,t)),null!=d){var c;if(null==y&&(y=d),void 0!==t.__d)c=t.__d,t.__d=void 0;else if(r==h||d!=l||null==d.parentNode){e:if(null==l||l.parentNode!==e)e.appendChild(d),c=null;else{for(v=l,p=0;(v=v.nextSibling)&&p<b;p+=2)if(v==d)break e;e.insertBefore(d,l),c=l}"option"==n.type&&(e.value="")}l=void 0!==c?c:d.nextSibling,"function"==typeof n.type&&(n.__d=l)}else l&&h.__e==l&&l.parentNode!=e&&(l=m(h))}return f++,t}),n.__e=y,null!=r&&"function"!=typeof n.type)for(f=r.length;f--;)null!=r[f]&&a(r[f]);for(f=b;f--;)null!=k[f]&&N(k[f],k[f]);if(g)for(f=0;f<g.length;f++)D(g[f],g[++f],g[++f])}function x(e,n,t){if(null==t&&(t=[]),null==e||"boolean"==typeof e)n&&t.push(n(null));else if(Array.isArray(e))for(var _=0;_<e.length;_++)x(e[_],n,t);else t.push(n?n("string"==typeof e||"number"==typeof e?h(null,e,null,null,e):null!=e.__e||null!=e.__c?h(e.type,e.props,e.key,null,e.__v):e):e);return t}function w(e,n,t){"-"===n[0]?e.setProperty(n,t):e[n]="number"==typeof t&&!1===s.test(n)?t+"px":null==t?"":t}function C(e,n,t,_,o){var r,u,l,i,c;if(o?"className"===n&&(n="class"):"class"===n&&(n="className"),"style"===n)if(r=e.style,"string"==typeof t)r.cssText=t;else{if("string"==typeof _&&(r.cssText="",_=null),_)for(i in _)t&&i in t||w(r,i,"");if(t)for(c in t)_&&t[c]===_[c]||w(r,c,t[c])}else"o"===n[0]&&"n"===n[1]?(u=n!==(n=n.replace(/Capture$/,"")),l=n.toLowerCase(),n=(l in e?l:n).slice(2),t?(_||e.addEventListener(n,H,u),(e.l||(e.l={}))[n]=t):e.removeEventListener(n,H,u)):"list"!==n&&"tagName"!==n&&"form"!==n&&"type"!==n&&"size"!==n&&!o&&n in e?e[n]=null==t?"":t:"function"!=typeof t&&"dangerouslySetInnerHTML"!==n&&(n!==(n=n.replace(/^xlink:?/,""))?null==t||!1===t?e.removeAttributeNS("http://www.w3.org/1999/xlink",n.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",n.toLowerCase(),t):null==t||!1===t&&!/^ar/.test(n)?e.removeAttribute(n):e.setAttribute(n,t))}function H(e){this.l[e.type](n.event?n.event(e):e)}function S(e,t,_,o,r,u,l,i,c){var s,a,p,h,m,y,g,k,x,w,C=t.type;if(void 0!==t.constructor)return null;(s=n.__b)&&s(t);try{e:if("function"==typeof C){if(k=t.props,x=(s=C.contextType)&&o[s.__c],w=s?x?x.props.value:s.__:o,_.__c?g=(a=t.__c=_.__c).__=a.__E:("prototype"in C&&C.prototype.render?t.__c=a=new C(k,w):(t.__c=a=new v(k,w),a.constructor=C,a.render=T),x&&x.sub(a),a.props=k,a.state||(a.state={}),a.context=w,a.__n=o,p=a.__d=!0,a.__h=[]),null==a.__s&&(a.__s=a.state),null!=C.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=f({},a.__s)),f(a.__s,C.getDerivedStateFromProps(k,a.__s))),h=a.props,m=a.state,p)null==C.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else{if(null==C.getDerivedStateFromProps&&k!==h&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(k,w),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(k,a.__s,w)||t.__v===_.__v&&!a.__){for(a.props=k,a.state=a.__s,t.__v!==_.__v&&(a.__d=!1),a.__v=t,t.__e=_.__e,t.__k=_.__k,a.__h.length&&l.push(a),s=0;s<t.__k.length;s++)t.__k[s]&&(t.__k[s].__=t);break e}null!=a.componentWillUpdate&&a.componentWillUpdate(k,a.__s,w),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(h,m,y)})}a.context=w,a.props=k,a.state=a.__s,(s=n.__r)&&s(t),a.__d=!1,a.__v=t,a.__P=e,s=a.render(a.props,a.state,a.context),t.__k=null!=s&&s.type==d&&null==s.key?s.props.children:Array.isArray(s)?s:[s],null!=a.getChildContext&&(o=f(f({},o),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(y=a.getSnapshotBeforeUpdate(h,m)),b(e,t,_,o,r,u,l,i,c),a.base=t.__e,a.__h.length&&l.push(a),g&&(a.__E=a.__=null),a.__e=!1}else null==u&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=P(_.__e,t,_,o,r,u,l,c);(s=n.diffed)&&s(t)}catch(e){t.__v=null,n.__e(e,t,_)}return t.__e}function E(e,t){n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function P(e,n,t,_,o,r,u,l){var s,f,a,p,h,d=t.props,v=n.props;if(o="svg"===n.type||o,null!=r)for(s=0;s<r.length;s++)if(null!=(f=r[s])&&((null===n.type?3===f.nodeType:f.localName===n.type)||e==f)){e=f,r[s]=null;break}if(null==e){if(null===n.type)return document.createTextNode(v);e=o?document.createElementNS("http://www.w3.org/2000/svg",n.type):document.createElement(n.type,v.is&&{is:v.is}),r=null,l=!1}if(null===n.type)d!==v&&e.data!=v&&(e.data=v);else{if(null!=r&&(r=c.slice.call(e.childNodes)),a=(d=t.props||i).dangerouslySetInnerHTML,p=v.dangerouslySetInnerHTML,!l){if(d===i)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(p||a)&&(p&&a&&p.__html==a.__html||(e.innerHTML=p&&p.__html||""))}(function(e,n,t,_,o){var r;for(r in t)"children"===r||"key"===r||r in n||C(e,r,null,t[r],_);for(r in n)o&&"function"!=typeof n[r]||"children"===r||"key"===r||"value"===r||"checked"===r||t[r]===n[r]||C(e,r,n[r],t[r],_)})(e,v,d,o,l),n.__k=n.props.children,p||b(e,n,t,_,"foreignObject"!==n.type&&o,r,u,i,l),l||("value"in v&&void 0!==v.value&&v.value!==e.value&&(e.value=null==v.value?"":v.value),"checked"in v&&void 0!==v.checked&&v.checked!==e.checked&&(e.checked=v.checked))}return e}function D(e,t,_){try{"function"==typeof e?e(t):e.current=t}catch(e){n.__e(e,_)}}function N(e,t,_){var o,r,u;if(n.unmount&&n.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||D(o,null,t)),_||"function"==typeof e.type||(_=null!=(r=e.__e)),e.__e=e.__d=void 0,null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){n.__e(e,t)}o.base=o.__P=null}if(o=e.__k)for(u=0;u<o.length;u++)o[u]&&N(o[u],t,_);null!=r&&a(r)}function T(e,n,t){return this.constructor(e,t)}n={__e:function(e,n){for(var t,_;n=n.__;)if((t=n.__c)&&!t.__)try{if(t.constructor&&null!=t.constructor.getDerivedStateFromError&&(_=!0,t.setState(t.constructor.getDerivedStateFromError(e))),null!=t.componentDidCatch&&(_=!0,t.componentDidCatch(e)),_)return g(t.__E=t)}catch(n){e=n}throw e}},v.prototype.setState=function(e,n){var t;t=this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof e&&(e=e(t,this.props)),e&&f(t,e),null!=e&&this.__v&&(n&&this.__h.push(n),g(this))},v.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g(this))},v.prototype.render=d,t=[],_=0,o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=i,l=0;var U,A,M,F=[],L=n.__r,W=n.diffed,R=n.__c,V=n.unmount;function I(e){n.__h&&n.__h(A);var t=A.__H||(A.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function O(e,n,t){var _=I(U++);return _.__c||(_.__c=A,_.__=[t?t(n):J(void 0,n),function(n){var t=e(_.__[0],n);_.__[0]!==t&&(_.__[0]=t,_.__c.setState({}))}]),_.__}function j(e,n){var t=I(U++);G(t.__H,n)&&(t.__=e,t.__H=n,A.__h.push(t))}function q(e,n){var t=I(U++);return G(t.__H,n)?(t.__H=n,t.__h=e,t.__=e()):t.__}function B(){F.some(function(e){if(e.__P)try{e.__H.__h.forEach($),e.__H.__h.forEach(z),e.__H.__h=[]}catch(t){return e.__H.__h=[],n.__e(t,e.__v),!0}}),F=[]}function $(e){e.t&&e.t()}function z(e){var n=e.__();"function"==typeof n&&(e.t=n)}function G(e,n){return!e||n.some(function(n,t){return n!==e[t]})}function J(e,n){return"function"==typeof n?n(e):n}n.__r=function(e){L&&L(e),U=0,(A=e.__c).__H&&(A.__H.__h.forEach($),A.__H.__h.forEach(z),A.__H.__h=[])},n.diffed=function(e){W&&W(e);var t=e.__c;if(t){var _=t.__H;_&&_.__h.length&&(1!==F.push(t)&&M===n.requestAnimationFrame||((M=n.requestAnimationFrame)||function(e){var n,t=function(){clearTimeout(_),cancelAnimationFrame(n),setTimeout(e)},_=setTimeout(t,100);"undefined"!=typeof window&&(n=requestAnimationFrame(t))})(B))}},n.__c=function(e,t){t.some(function(e){try{e.__h.forEach($),e.__h=e.__h.filter(function(e){return!e.__||z(e)})}catch(_){t.some(function(e){e.__h&&(e.__h=[])}),t=[],n.__e(_,e.__v)}}),R&&R(e,t)},n.unmount=function(e){V&&V(e);var t=e.__c;if(t){var _=t.__H;if(_)try{_.__.forEach(function(e){return e.t&&e.t()})}catch(e){n.__e(e,t.__v)}}};var K=function(e,n,t,_){var o;n[0]=0;for(var r=1;r<n.length;r++){var u=n[r++],l=n[r]?(n[0]|=u?1:2,t[n[r++]]):n[++r];3===u?_[0]=l:4===u?_[1]=Object.assign(_[1]||{},l):5===u?(_[1]=_[1]||{})[n[++r]]=l:6===u?_[1][n[++r]]+=l+"":u?(o=e.apply(l,K(e,l,t,["",null])),_.push(o),l[0]?n[0]|=2:(n[r-2]=0,n[r]=o)):_.push(l)}return _},Q=new Map,X=function(e){var n=Q.get(this);return n||(n=new Map,Q.set(this,n)),(n=K(this,n.get(e)||(n.set(e,n=function(e){for(var n,t,_=1,o="",r="",u=[0],l=function(e){1===_&&(e||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?u.push(0,e,o):3===_&&(e||o)?(u.push(3,e,o),_=2):2===_&&"..."===o&&e?u.push(4,e,0):2===_&&o&&!e?u.push(5,0,!0,o):_>=5&&((o||!e&&5===_)&&(u.push(_,0,o,t),_=6),e&&(u.push(_,e,0,t),_=6)),o=""},i=0;i<e.length;i++){i&&(1===_&&l(),l(i));for(var c=0;c<e[i].length;c++)n=e[i][c],1===_?"<"===n?(l(),u=[u],_=3):o+=n:4===_?"--"===o&&">"===n?(_=1,o=""):o=n+o[0]:r?n===r?r="":o+=n:'"'===n||"'"===n?r=n:">"===n?(l(),_=1):_&&("="===n?(_=5,t=o,o=""):"/"===n&&(_<5||">"===e[i][c+1])?(l(),3===_&&(u=u[0]),_=u,(u=u[0]).push(2,0,_),_=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(l(),_=2):o+=n),3===_&&"!--"===o&&(_=4,u=u[0])}return l(),u}(e)),n),arguments,[])).length>1?n:n[0]}.bind(p);e.h=p,e.html=X,e.render=function(e,t,_){var o,r,l;n.__&&n.__(e,t),r=(o=_===u)?null:_&&_.__k||t.__k,e=p(d,null,[e]),l=[],S(t,(o?t:_||t).__k=e,r||i,i,void 0!==t.ownerSVGElement,_&&!o?[_]:r?null:c.slice.call(t.childNodes),l,_||i,o),E(l,e)},e.Component=v,e.createContext=function(e){var n={},t={__c:"__cC"+l++,__:e,Consumer:function(e,n){return e.children(n)},Provider:function(e){var _,o=this;return this.getChildContext||(_=[],this.getChildContext=function(){return n[t.__c]=o,n},this.shouldComponentUpdate=function(e){o.props.value!==e.value&&_.some(function(n){n.context=e.value,g(n)})},this.sub=function(e){_.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){_.splice(_.indexOf(e),1),n&&n.call(e)}}),e.children}};return t.Consumer.contextType=t,t},e.useState=function(e){return O(J,e)},e.useReducer=O,e.useEffect=function(e,n){var t=I(U++);G(t.__H,n)&&(t.__=e,t.__H=n,A.__H.__h.push(t))},e.useLayoutEffect=j,e.useRef=function(e){return q(function(){return{current:e}},[])},e.useImperativeHandle=function(e,n,t){j(function(){"function"==typeof e?e(n()):e&&(e.current=n())},null==t?t:t.concat(e))},e.useMemo=q,e.useCallback=function(e,n){return q(function(){return e},n)},e.useContext=function(e){var n=A.context[e.__c];if(!n)return e.__;var t=I(U++);return null==t.__&&(t.__=!0,n.sub(A)),n.props.value},e.useDebugValue=function(e,t){n.useDebugValue&&n.useDebugValue(t?t(e):e)}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.htmPreact={})}(this,function(e){var n,_,t,o,r,u,l,i={},c=[],f=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(e,n){for(var _ in n)e[_]=n[_];return e}function a(e){var n=e.parentNode;n&&n.removeChild(e)}function p(e,_,t){var o,r,u,l={};for(u in _)"key"==u?o=_[u]:"ref"==u?r=_[u]:l[u]=_[u];if(arguments.length>2&&(l.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof e&&null!=e.defaultProps)for(u in e.defaultProps)void 0===l[u]&&(l[u]=e.defaultProps[u]);return h(e,l,o,r,null)}function h(e,n,o,r,u){var l={type:e,props:n,key:o,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==u?++t:u};return null!=_.vnode&&_.vnode(l),l}function d(e){return e.children}function v(e,n){this.props=e,this.context=n}function y(e,n){if(null==n)return e.__?y(e.__,e.__.__k.indexOf(e)+1):null;for(var _;n<e.__k.length;n++)if(null!=(_=e.__k[n])&&null!=_.__e)return _.__e;return"function"==typeof e.type?y(e):null}function m(e){var n,_;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(_=e.__k[n])&&null!=_.__e){e.__e=e.__c.base=_.__e;break}return m(e)}}function g(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!k.__r++||u!==_.debounceRendering)&&((u=_.debounceRendering)||r)(k)}function k(){for(var e;k.__r=o.length;)e=o.sort(function(e,n){return e.__v.__b-n.__v.__b}),o=[],e.some(function(e){var n,_,t,o,r,u;e.__d&&(r=(o=(n=e).__v).__e,(u=n.__P)&&(_=[],(t=s({},o)).__v=o.__v+1,D(u,o,t,n.__n,void 0!==u.ownerSVGElement,null!=o.__h?[r]:null,_,null==r?y(o):r,o.__h),w(_,o),o.__e!=r&&m(o)))})}function b(e,n,_,t,o,r,u,l,f,s){var a,p,v,m,g,k,b,H=t&&t.__k||c,E=H.length;for(_.__k=[],a=0;a<n.length;a++)if(null!=(m=_.__k[a]=null==(m=n[a])||"boolean"==typeof m?null:"string"==typeof m||"number"==typeof m||"bigint"==typeof m?h(null,m,null,null,m):Array.isArray(m)?h(d,{children:m},null,null,null):m.__b>0?h(m.type,m.props,m.key,null,m.__v):m)){if(m.__=_,m.__b=_.__b+1,null===(v=H[a])||v&&m.key==v.key&&m.type===v.type)H[a]=void 0;else for(p=0;p<E;p++){if((v=H[p])&&m.key==v.key&&m.type===v.type){H[p]=void 0;break}v=null}D(e,m,v=v||i,o,r,u,l,f,s),g=m.__e,(p=m.ref)&&v.ref!=p&&(b||(b=[]),v.ref&&b.push(v.ref,null,m),b.push(p,m.__c||g,m)),null!=g?(null==k&&(k=g),"function"==typeof m.type&&null!=m.__k&&m.__k===v.__k?m.__d=f=C(m,f,e):f=x(e,m,v,H,g,f),s||"option"!==_.type?"function"==typeof _.type&&(_.__d=f):e.value=""):f&&v.__e==f&&f.parentNode!=e&&(f=y(v))}for(_.__e=k,a=E;a--;)null!=H[a]&&("function"==typeof _.type&&null!=H[a].__e&&H[a].__e==_.__d&&(_.__d=y(t,a+1)),A(H[a],H[a]));if(b)for(a=0;a<b.length;a++)U(b[a],b[++a],b[++a])}function C(e,n,_){var t,o;for(t=0;t<e.__k.length;t++)(o=e.__k[t])&&(o.__=e,n="function"==typeof o.type?C(o,n,_):x(_,o,o,e.__k,o.__e,n));return n}function x(e,n,_,t,o,r){var u,l,i;if(void 0!==n.__d)u=n.__d,n.__d=void 0;else if(null==_||o!=r||null==o.parentNode)e:if(null==r||r.parentNode!==e)e.appendChild(o),u=null;else{for(l=r,i=0;(l=l.nextSibling)&&i<t.length;i+=2)if(l==o)break e;e.insertBefore(o,r),u=r}return void 0!==u?u:o.nextSibling}function H(e,n,_){"-"===n[0]?e.setProperty(n,_):e[n]=null==_?"":"number"!=typeof _||f.test(n)?_:_+"px"}function E(e,n,_,t,o){var r;e:if("style"===n)if("string"==typeof _)e.style.cssText=_;else{if("string"==typeof t&&(e.style.cssText=t=""),t)for(n in t)_&&n in _||H(e.style,n,"");if(_)for(n in _)t&&_[n]===t[n]||H(e.style,n,_[n])}else if("o"===n[0]&&"n"===n[1])r=n!==(n=n.replace(/Capture$/,"")),n=n.toLowerCase()in e?n.toLowerCase().slice(2):n.slice(2),e.l||(e.l={}),e.l[n+r]=_,_?t||e.addEventListener(n,r?S:P,r):e.removeEventListener(n,r?S:P,r);else if("dangerouslySetInnerHTML"!==n){if(o)n=n.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==n&&"list"!==n&&"form"!==n&&"tabIndex"!==n&&"download"!==n&&n in e)try{e[n]=null==_?"":_;break e}catch(e){}"function"==typeof _||(null!=_&&(!1!==_||"a"===n[0]&&"r"===n[1])?e.setAttribute(n,_):e.removeAttribute(n))}}function P(e){this.l[e.type+!1](_.event?_.event(e):e)}function S(e){this.l[e.type+!0](_.event?_.event(e):e)}function D(e,n,t,o,r,u,l,i,c){var f,a,p,h,y,m,g,k,C,x,H,E=n.type;if(void 0!==n.constructor)return null;null!=t.__h&&(c=t.__h,i=n.__e=t.__e,n.__h=null,u=[i]),(f=_.__b)&&f(n);try{e:if("function"==typeof E){if(k=n.props,C=(f=E.contextType)&&o[f.__c],x=f?C?C.props.value:f.__:o,t.__c?g=(a=n.__c=t.__c).__=a.__E:("prototype"in E&&E.prototype.render?n.__c=a=new E(k,x):(n.__c=a=new v(k,x),a.constructor=E,a.render=M),C&&C.sub(a),a.props=k,a.state||(a.state={}),a.context=x,a.__n=o,p=a.__d=!0,a.__h=[]),null==a.__s&&(a.__s=a.state),null!=E.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=s({},a.__s)),s(a.__s,E.getDerivedStateFromProps(k,a.__s))),h=a.props,y=a.state,p)null==E.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else{if(null==E.getDerivedStateFromProps&&k!==h&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(k,x),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(k,a.__s,x)||n.__v===t.__v){a.props=k,a.state=a.__s,n.__v!==t.__v&&(a.__d=!1),a.__v=n,n.__e=t.__e,n.__k=t.__k,n.__k.forEach(function(e){e&&(e.__=n)}),a.__h.length&&l.push(a);break e}null!=a.componentWillUpdate&&a.componentWillUpdate(k,a.__s,x),null!=a.componentDidUpdate&&a.__h.push(function(){a.componentDidUpdate(h,y,m)})}a.context=x,a.props=k,a.state=a.__s,(f=_.__r)&&f(n),a.__d=!1,a.__v=n,a.__P=e,f=a.render(a.props,a.state,a.context),a.state=a.__s,null!=a.getChildContext&&(o=s(s({},o),a.getChildContext())),p||null==a.getSnapshotBeforeUpdate||(m=a.getSnapshotBeforeUpdate(h,y)),H=null!=f&&f.type===d&&null==f.key?f.props.children:f,b(e,Array.isArray(H)?H:[H],n,t,o,r,u,l,i,c),a.base=n.__e,n.__h=null,a.__h.length&&l.push(a),g&&(a.__E=a.__=null),a.__e=!1}else null==u&&n.__v===t.__v?(n.__k=t.__k,n.__e=t.__e):n.__e=T(t.__e,n,t,o,r,u,l,c);(f=_.diffed)&&f(n)}catch(e){n.__v=null,(c||null!=u)&&(n.__e=i,n.__h=!!c,u[u.indexOf(i)]=null),_.__e(e,n,t)}}function w(e,n){_.__c&&_.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){_.__e(e,n.__v)}})}function T(e,_,t,o,r,u,l,c){var f,s,p,h=t.props,d=_.props,v=_.type,m=0;if("svg"===v&&(r=!0),null!=u)for(;m<u.length;m++)if((f=u[m])&&(f===e||(v?f.localName==v:3==f.nodeType))){e=f,u[m]=null;break}if(null==e){if(null===v)return document.createTextNode(d);e=r?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,d.is&&d),u=null,c=!1}if(null===v)h===d||c&&e.data===d||(e.data=d);else{if(u=u&&n.call(e.childNodes),s=(h=t.props||i).dangerouslySetInnerHTML,p=d.dangerouslySetInnerHTML,!c){if(null!=u)for(h={},m=0;m<e.attributes.length;m++)h[e.attributes[m].name]=e.attributes[m].value;(p||s)&&(p&&(s&&p.__html==s.__html||p.__html===e.innerHTML)||(e.innerHTML=p&&p.__html||""))}if(function(e,n,_,t,o){var r;for(r in _)"children"===r||"key"===r||r in n||E(e,r,null,_[r],t);for(r in n)o&&"function"!=typeof n[r]||"children"===r||"key"===r||"value"===r||"checked"===r||_[r]===n[r]||E(e,r,n[r],_[r],t)}(e,d,h,r,c),p)_.__k=[];else if(m=_.props.children,b(e,Array.isArray(m)?m:[m],_,t,o,r&&"foreignObject"!==v,u,l,u?u[0]:t.__k&&y(t,0),c),null!=u)for(m=u.length;m--;)null!=u[m]&&a(u[m]);c||("value"in d&&void 0!==(m=d.value)&&(m!==e.value||"progress"===v&&!m)&&E(e,"value",m,h.value,!1),"checked"in d&&void 0!==(m=d.checked)&&m!==e.checked&&E(e,"checked",m,h.checked,!1))}return e}function U(e,n,t){try{"function"==typeof e?e(n):e.current=n}catch(e){_.__e(e,t)}}function A(e,n,t){var o,r;if(_.unmount&&_.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||U(o,null,n)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){_.__e(e,n)}o.base=o.__P=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&A(o[r],n,"function"!=typeof e.type);t||null==e.__e||a(e.__e),e.__e=e.__d=void 0}function M(e,n,_){return this.constructor(e,_)}n=c.slice,_={__e:function(e,n){for(var _,t,o;n=n.__;)if((_=n.__c)&&!_.__)try{if((t=_.constructor)&&null!=t.getDerivedStateFromError&&(_.setState(t.getDerivedStateFromError(e)),o=_.__d),null!=_.componentDidCatch&&(_.componentDidCatch(e),o=_.__d),o)return _.__E=_}catch(n){e=n}throw e}},t=0,v.prototype.setState=function(e,n){var _;_=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),"function"==typeof e&&(e=e(s({},_),this.props)),e&&s(_,e),null!=e&&this.__v&&(n&&this.__h.push(n),g(this))},v.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g(this))},v.prototype.render=d,o=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k.__r=0,l=0;var F,L,N,W=0,R=[],I=_.__b,O=_.__r,V=_.diffed,q=_.__c,B=_.unmount;function $(e,n){_.__h&&_.__h(L,e,W||n),W=0;var t=L.__H||(L.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function j(e){return W=1,G(ee,e)}function G(e,n,_){var t=$(F++,2);return t.t=e,t.__c||(t.__=[_?_(n):ee(void 0,n),function(e){var n=t.t(t.__[0],e);t.__[0]!==n&&(t.__=[n,t.__[1]],t.__c.setState({}))}],t.__c=L),t.__}function z(e,n){var t=$(F++,4);!_.__s&&Z(t.__H,n)&&(t.__=e,t.__H=n,L.__h.push(t))}function J(e,n){var _=$(F++,7);return Z(_.__H,n)&&(_.__=e(),_.__H=n,_.__h=e),_.__}function K(){R.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(X),e.__H.__h.forEach(Y),e.__H.__h=[]}catch(n){e.__H.__h=[],_.__e(n,e.__v)}}),R=[]}_.__b=function(e){L=null,I&&I(e)},_.__r=function(e){O&&O(e),F=0;var n=(L=e.__c).__H;n&&(n.__h.forEach(X),n.__h.forEach(Y),n.__h=[])},_.diffed=function(e){V&&V(e);var n=e.__c;n&&n.__H&&n.__H.__h.length&&(1!==R.push(n)&&N===_.requestAnimationFrame||((N=_.requestAnimationFrame)||function(e){var n,_=function(){clearTimeout(t),Q&&cancelAnimationFrame(n),setTimeout(e)},t=setTimeout(_,100);Q&&(n=requestAnimationFrame(_))})(K)),L=void 0},_.__c=function(e,n){n.some(function(e){try{e.__h.forEach(X),e.__h=e.__h.filter(function(e){return!e.__||Y(e)})}catch(t){n.some(function(e){e.__h&&(e.__h=[])}),n=[],_.__e(t,e.__v)}}),q&&q(e,n)},_.unmount=function(e){B&&B(e);var n=e.__c;if(n&&n.__H)try{n.__H.__.forEach(X)}catch(e){_.__e(e,n.__v)}};var Q="function"==typeof requestAnimationFrame;function X(e){var n=L;"function"==typeof e.__c&&e.__c(),L=n}function Y(e){var n=L;e.__c=e.__(),L=n}function Z(e,n){return!e||e.length!==n.length||n.some(function(n,_){return n!==e[_]})}function ee(e,n){return"function"==typeof n?n(e):n}var ne=function(e,n,_,t){var o;n[0]=0;for(var r=1;r<n.length;r++){var u=n[r++],l=n[r]?(n[0]|=u?1:2,_[n[r++]]):n[++r];3===u?t[0]=l:4===u?t[1]=Object.assign(t[1]||{},l):5===u?(t[1]=t[1]||{})[n[++r]]=l:6===u?t[1][n[++r]]+=l+"":u?(o=e.apply(l,ne(e,l,_,["",null])),t.push(o),l[0]?n[0]|=2:(n[r-2]=0,n[r]=o)):t.push(l)}return t},_e=new Map,te=function(e){var n=_e.get(this);return n||(n=new Map,_e.set(this,n)),(n=ne(this,n.get(e)||(n.set(e,n=function(e){for(var n,_,t=1,o="",r="",u=[0],l=function(e){1===t&&(e||(o=o.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?u.push(0,e,o):3===t&&(e||o)?(u.push(3,e,o),t=2):2===t&&"..."===o&&e?u.push(4,e,0):2===t&&o&&!e?u.push(5,0,!0,o):t>=5&&((o||!e&&5===t)&&(u.push(t,0,o,_),t=6),e&&(u.push(t,e,0,_),t=6)),o=""},i=0;i<e.length;i++){i&&(1===t&&l(),l(i));for(var c=0;c<e[i].length;c++)n=e[i][c],1===t?"<"===n?(l(),u=[u],t=3):o+=n:4===t?"--"===o&&">"===n?(t=1,o=""):o=n+o[0]:r?n===r?r="":o+=n:'"'===n||"'"===n?r=n:">"===n?(l(),t=1):t&&("="===n?(t=5,_=o,o=""):"/"===n&&(t<5||">"===e[i][c+1])?(l(),3===t&&(u=u[0]),t=u,(u=u[0]).push(2,0,t),t=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(l(),t=2):o+=n),3===t&&"!--"===o&&(t=4,u=u[0])}return l(),u}(e)),n),arguments,[])).length>1?n:n[0]}.bind(p);e.h=p,e.html=te,e.render=function(e,t,o){var r,u,l;_.__&&_.__(e,t),u=(r="function"==typeof o)?null:o&&o.__k||t.__k,l=[],D(t,e=(!r&&o||t).__k=p(d,null,[e]),u||i,i,void 0!==t.ownerSVGElement,!r&&o?[o]:u?null:t.firstChild?n.call(t.childNodes):null,l,!r&&o?o:u?u.__e:t.firstChild,r),w(l,e)},e.Component=v,e.createContext=function(e,n){var _={__c:n="__cC"+l++,__:e,Consumer:function(e,n){return e.children(n)},Provider:function(e){var _,t;return this.getChildContext||(_=[],(t={})[n]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&_.some(g)},this.sub=function(e){_.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){_.splice(_.indexOf(e),1),n&&n.call(e)}}),e.children}};return _.Provider.__=_.Consumer.contextType=_},e.useState=j,e.useReducer=G,e.useEffect=function(e,n){var t=$(F++,3);!_.__s&&Z(t.__H,n)&&(t.__=e,t.__H=n,L.__H.__h.push(t))},e.useLayoutEffect=z,e.useRef=function(e){return W=5,J(function(){return{current:e}},[])},e.useImperativeHandle=function(e,n,_){W=6,z(function(){"function"==typeof e?e(n()):e&&(e.current=n())},null==_?_:_.concat(e))},e.useMemo=J,e.useCallback=function(e,n){return W=8,J(function(){return e},n)},e.useContext=function(e){var n=L.context[e.__c],_=$(F++,9);return _.c=e,n?(null==_.__&&(_.__=!0,n.sub(L)),n.props.value):e.__},e.useDebugValue=function(e,n){_.useDebugValue&&_.useDebugValue(n?n(e):e)},e.useErrorBoundary=function(e){var n=$(F++,10),_=j();return n.__=e,L.componentDidCatch||(L.componentDidCatch=function(e){n.__&&n.__(e),_[1](e)}),[_[0],function(){_[1](void 0)}]}}); |
@@ -31,5 +31,5 @@ | ||
- Spread props: `<div ...${props}>` | ||
- Spread props: `<div ...${props}>` instead of `<div {...props}>` | ||
- Self-closing tags: `<div />` | ||
- Components: `<${Foo}>` _(where `Foo` is a component reference)_ | ||
- Components: `<${Foo}>` instead of `<Foo>` _(where `Foo` is a component reference)_ | ||
- Boolean attributes: `<div draggable />` | ||
@@ -157,2 +157,10 @@ | ||
### Caching | ||
The default build of `htm` caches template strings, which means that it can return the same Javascript object at multiple points in the tree. If you don't want this behaviour, you have three options: | ||
* Change your `h` function to copy nodes when needed. | ||
* Add the code `this[0] = 3;` at the beginning of your `h` function, which disables caching of created elements. | ||
* Use `htm/mini`, which disables caching by default. | ||
## Example | ||
@@ -182,3 +190,3 @@ | ||
${todos.map(todo => html` | ||
<li>${todo}</li> | ||
<li key=${todo}>${todo}</li> | ||
`)} | ||
@@ -185,0 +193,0 @@ </ul> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88297
581
288
11