From a8e195e687103742504a2c2c22e693a6e7467b3b Mon Sep 17 00:00:00 2001 From: Mujahid Anuar <17759705+mujahidfa@users.noreply.github.com> Date: Fri, 14 Oct 2022 18:12:06 +0800 Subject: [PATCH] Update to @preact/signals v1.1.2 --- dist/standalone.js | 2 +- dist/standalone.umd.js | 2 +- package.json | 4 ++-- pnpm-lock.yaml | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dist/standalone.js b/dist/standalone.js index 005abe7..91bcc15 100644 --- a/dist/standalone.js +++ b/dist/standalone.js @@ -1 +1 @@ -var t,n,e,_,i,r,o={},u=[],f=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(t,n){for(var e in n)t[e]=n[e];return t}function l(t){var n=t.parentNode;n&&n.removeChild(t)}function c(n,e,_){var i,r,o,u={};for(o in e)"key"==o?i=e[o]:"ref"==o?r=e[o]:u[o]=e[o];if(arguments.length>2&&(u.children=arguments.length>3?t.call(arguments,2):_),"function"==typeof n&&null!=n.defaultProps)for(o in n.defaultProps)void 0===u[o]&&(u[o]=n.defaultProps[o]);return a(n,u,i,r,null)}function a(t,_,i,r,o){var u={type:t,props:_,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++e:o};return null==o&&null!=n.vnode&&n.vnode(u),u}function h(){return{current:null}}function v(t){return t.children}function p(t,n){this.props=t,this.context=n}function d(t,n){if(null==n)return t.__?d(t.__,t.__.__k.indexOf(t)+1):null;for(var e;n0?a(m.type,m.props,m.key,m.ref?m.ref:null,m.__v):m)){if(m.__=e,m.__b=e.__b+1,null===(y=C[h])||y&&m.key==y.key&&m.type===y.type)C[h]=void 0;else for(p=0;p=_.__.length&&_.__.push({__V:R}),_.__[t]}function J(t){return L=1,K(ct,t)}function K(t,n,e){var _=z(V++,2);if(_.t=t,!_.__c&&(_.__=[e?e(n):ct(void 0,n),function(t){var n=_.__N?_.__N[0]:_.__[0],e=_.t(n,t);n!==e&&(_.__N=[e,_.__[1]],_.__c.setState({}))}],_.__c=M,!M.u)){M.u=!0;var i=M.shouldComponentUpdate;M.shouldComponentUpdate=function(t,n,e){if(!_.__c.__H)return!0;var r=_.__c.__H.__.filter(function(t){return t.__c});if(r.every(function(t){return!t.__N}))return!i||i.call(this,t,n,e);var o=!1;return r.forEach(function(t){if(t.__N){var n=t.__[0];t.__=t.__N,t.__N=void 0,n!==t.__[0]&&(o=!0)}}),!!o&&(!i||i.call(this,t,n,e))}}return _.__N||_.__}function Q(t,e){var _=z(V++,3);!n.__s&<(_.__H,e)&&(_.__=t,_.i=e,M.__H.__h.push(_))}function X(t,e){var _=z(V++,4);!n.__s&<(_.__H,e)&&(_.__=t,_.i=e,M.__h.push(_))}function Y(t){return L=5,tt(function(){return{current:t}},[])}function Z(t,n,e){L=6,X(function(){return"function"==typeof t?(t(n()),function(){return t(null)}):t?(t.current=n(),function(){return t.current=null}):void 0},null==e?e:e.concat(t))}function tt(t,n){var e=z(V++,7);return lt(e.__H,n)?(e.__V=t(),e.i=n,e.__h=t,e.__V):e.__}function nt(t,n){return L=8,tt(function(){return t},n)}function et(t){var n=M.context[t.__c],e=z(V++,9);return e.c=t,n?(null==e.__&&(e.__=!0,n.sub(M)),n.props.value):t.__}function _t(t,e){n.useDebugValue&&n.useDebugValue(e?e(t):t)}function it(t){var n=z(V++,10),e=J();return n.__=t,M.componentDidCatch||(M.componentDidCatch=function(t,_){n.__&&n.__(t,_),e[1](t)}),[e[0],function(){e[1](void 0)}]}function rt(){for(var t;t=W.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ft),t.__H.__h.forEach(st),t.__H.__h=[]}catch(e){t.__H.__h=[],n.__e(e,t.__v)}}n.__b=function(t){"function"!=typeof t.type||t.o||t.type===v?t.o||(t.o=t.__&&t.__.o?t.__.o:""):t.o=(t.__&&t.__.o?t.__.o:"")+(t.__&&t.__.__k?t.__.__k.indexOf(t):0),M=null,j&&j(t)},n.__r=function(t){I&&I(t),V=0;var n=(M=t.__c).__H;n&&(F===M?(n.__h=[],M.__h=[],n.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=R,t.__N=t.i=void 0})):(n.__h.forEach(ft),n.__h.forEach(st),n.__h=[])),F=M},n.diffed=function(t){q&&q(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==W.push(e)&&O===n.requestAnimationFrame||((O=n.requestAnimationFrame)||ut)(rt)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==R&&(t.__=t.__V),t.i=void 0,t.__V=R})),F=M=null},n.__c=function(t,e){e.some(function(t){try{t.__h.forEach(ft),t.__h=t.__h.filter(function(t){return!t.__||st(t)})}catch(_){e.some(function(t){t.__h&&(t.__h=[])}),e=[],n.__e(_,t.__v)}}),B&&B(t,e)},n.unmount=function(t){G&&G(t);var e,_=t.__c;_&&_.__H&&(_.__H.__.forEach(function(t){try{ft(t)}catch(t){e=t}}),_.__H=void 0,e&&n.__e(e,_.__v))};var ot="function"==typeof requestAnimationFrame;function ut(t){var n,e=function(){clearTimeout(_),ot&&cancelAnimationFrame(n),setTimeout(t)},_=setTimeout(e,100);ot&&(n=requestAnimationFrame(e))}function ft(t){var n=M,e=t.__c;"function"==typeof e&&(t.__c=void 0,e()),M=n}function st(t){var n=M;t.__c=t.__(),M=n}function lt(t,n){return!t||t.length!==n.length||n.some(function(n,e){return n!==t[e]})}function ct(t,n){return"function"==typeof n?n(t):n}var at=function(t,n,e,_){var i;n[0]=0;for(var r=1;r1)kt--;else{for(var t,n=!1;void 0!==bt;){var e=bt;for(bt=void 0,St++;void 0!==e;){var _=e.o;if(e.o=void 0,e.f&=-3,!(8&e.f)&&4&e.f&&Et(e))try{e.c()}catch(e){n||(t=e,n=!0)}e=_}}if(St=0,kt--,n)throw t}}function dt(t){if(kt>0)return t();kt++;try{return t()}finally{pt()}}var yt,mt,gt=void 0,bt=void 0,kt=0,St=0,xt=0;function Ct(t){if(void 0!==gt){var n=t.n;if(void 0===n||n.t!==gt)return gt.s=n={f:0,i:0,S:t,p:void 0,n:gt.s,t:gt,e:void 0,x:void 0,r:n},t.n=n,32>.f&&t.S(n),n;if(1&n.f){n.f&=-2;var e=gt.s;if(n!==e){var _=n.p,i=n.n;void 0!==_&&(_.n=i),void 0!==i&&(i.p=_),void 0!==e&&(e.p=n),n.p=void 0,n.n=e,gt.s=n}return n}}}function wt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}function Ht(t){return new wt(t)}function Et(t){for(var n=t.s;void 0!==n&&n.S.i===n.i&&n.S.h()&&n.S.i===n.i;)n=n.n;return void 0!==n}function Ut(t){for(var n=t.s;void 0!==n;n=n.n){var e=n.S.n;void 0!==e&&(n.r=e),n.S.n=n,n.f|=1}}function Nt(t){for(var n=t.s,e=void 0;void 0!==n;){var _=n.n;1&n.f?(n.S.U(n),n.n=void 0):(void 0!==e&&(e.p=n),n.p=void 0,n.n=e,e=n),n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=_}t.s=e}function Pt(t){wt.call(this,void 0),this.x=t,this.s=void 0,this.g=xt-1,this.f=4}function Dt(t){return new Pt(t)}function $t(t){var n=t.u;if(t.u=void 0,"function"==typeof n){kt++;var e=gt;gt=void 0;try{n()}catch(n){throw t.f&=-2,t.f|=8,At(t),n}finally{gt=e,pt()}}}function At(t){for(var n=t.s;void 0!==n;n=n.n)n.S.U(n);t.x=void 0,t.s=void 0,$t(t)}function Tt(t){if(gt!==this)throw new Error("Out-of-order effect");Nt(this),gt=t,this.f&=-2,8&this.f&&At(this),pt()}function Vt(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=36}function Mt(t){var n=new Vt(t);return n.c(),n.d.bind(n)}function Ft(t,e){n[t]=e.bind(null,n[t]||function(){})}function Ot(t){mt&&mt(),mt=t&&t.S()}function Lt(t){var n=this,e=t.data,_=Rt(e);_.value=e;var i=tt(function(){for(var t=n.__v;t=t.__;)if(t.__c){t.__c.__$f|=4;break}return n.__$u.c=function(){n.base.data=i.peek()},Dt(function(){var t=_.value.value;return 0===t?0:!0===t?"":t||""})},[]);return i.value}function Wt(t,n,e,_){var i=n in t&&void 0===t.ownerSVGElement,r=Ht(e);return{o:function(t,n){r.value=t,_=n},d:Mt(function(){var e=r.value.value;_[n]!==e&&(_[n]=e,i?t[n]=e:e?t.setAttribute(n,e):t.removeAttribute(n))})}}function Rt(t){return tt(function(){return Ht(t)},[])}function jt(t){var n=Y(t);return n.current=t,yt.__$f|=4,tt(function(){return Dt(function(){return n.current()})},[])}wt.prototype.h=function(){return!0},wt.prototype.S=function(t){2&t.f||(t.f|=2,t.x=this.t,void 0!==this.t&&(this.t.e=t),this.t=t)},wt.prototype.U=function(t){if(2&t.f){t.f&=-3;var n=t.e,e=t.x;void 0!==n&&(n.x=e,t.e=void 0),void 0!==e&&(e.e=n,t.x=void 0),t===this.t&&(this.t=e)}},wt.prototype.subscribe=function(t){var n=this;return Mt(function(){var e=n.value,_=32&this.f;this.f&=-33;try{t(e)}finally{this.f|=_}})},wt.prototype.valueOf=function(){return this.value},wt.prototype.toString=function(){return this.value+""},wt.prototype.peek=function(){return this.v},Object.defineProperty(wt.prototype,"value",{get:function(){var t=Ct(this);return void 0!==t&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){St>100&&vt(),this.v=t,this.i++,xt++,kt++;try{for(var n=this.t;void 0!==n;n=n.x)n.t.N()}finally{pt()}}}}),(Pt.prototype=new wt).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===xt)return!0;if(this.g=xt,this.f|=1,this.i>0&&!Et(this))return this.f&=-2,!0;var t=gt;try{Ut(this),gt=this;var n=this.x();(16&this.f||this.v!==n||0===this.i)&&(this.v=n,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return gt=t,Nt(this),this.f&=-2,!0},Pt.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(var n=this.s;void 0!==n;n=n.n)n.S.S(n)}wt.prototype.S.call(this,t)},Pt.prototype.U=function(t){if(wt.prototype.U.call(this,t),void 0===this.t){this.f&=-33;for(var n=this.s;void 0!==n;n=n.n)n.S.U(n)}},Pt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;void 0!==t;t=t.x)t.t.N()}},Pt.prototype.peek=function(){if(this.h()||vt(),16&this.f)throw this.v;return this.v},Object.defineProperty(Pt.prototype,"value",{get:function(){1&this.f&&vt();var t=Ct(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),Vt.prototype.c=function(){var t=this.S();try{8&this.f||void 0===this.x||(this.u=this.x())}finally{t()}},Vt.prototype.S=function(){1&this.f&&vt(),this.f|=1,this.f&=-9,$t(this),Ut(this),kt++,this.f&=-5;var t=gt;return gt=this,Tt.bind(this,t)},Vt.prototype.N=function(){2&this.f||(this.f|=6,this.o=bt,bt=this)},Vt.prototype.d=function(){this.f|=8,1&this.f||At(this)},Lt.displayName="_st",Object.defineProperties(wt.prototype,{constructor:{configurable:!0},type:{configurable:!0,value:Lt},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),Ft("__b",function(t,n){if("string"==typeof n.type){var e,_=n.props;for(var i in _)if("children"!==i){var r=_[i];r instanceof wt&&(e||(n.__np=e={}),e[i]=r,_[i]=r.peek())}}t(n)}),Ft("__r",function(t,n){Ot();var e,_=n.__c;_&&(_.__$f&=-2,void 0===(e=_.__$u)&&(_.__$u=e=function(t){var n;return Mt(function(){n=this}),n.c=function(){_.__$f|=1,_.setState({})},n}())),yt=_,Ot(e),t(n)}),Ft("__e",function(t,n,e,_){Ot(),yt=void 0,t(n,e,_)}),Ft("diffed",function(t,n){var e;if(Ot(),yt=void 0,"string"==typeof n.type&&(e=n.__e)){var _=n.__np,i=n.props;if(_){var r=e.U;if(r)for(var o in r){var u=r[o];void 0===u||o in _||(u.d(),r[o]=void 0)}else e.U=r={};for(var f in _){var s=r[f],l=_[f];void 0===s?(s=Wt(e,f,l,i),r[f]=s):s.o(l,i)}}}t(n)}),Ft("unmount",function(t,n){if("string"==typeof n.type){var e=n.__e;if(e){var _=e.U;if(_)for(var i in e.U=void 0,_){var r=_[i];r&&r.d()}}}else{var o=n.__c;if(o){var u=o.__$u;u&&(o.__$u=void 0,u.d())}}t(n)}),Ft("__h",function(t,n,e,_){_<3&&(n.__$f|=2),t(n,e,_)}),p.prototype.shouldComponentUpdate=function(t,n){var e=this.__$u;if(!(e&&void 0!==e.s||4&this.__$f))return!0;if(3&this.__$f)return!0;for(var _ in n)return!0;for(var i in t)if("__source"!==i&&t[i]!==this.props[i])return!0;for(var r in this.props)if(!(r in t))return!0;return!1};var It=function(t){var n=ht.get(this);return n||(n=new Map,ht.set(this,n)),(n=at(this,n.get(t)||(n.set(t,n=function(t){for(var n,e,_=1,i="",r="",o=[0],u=function(t){1===_&&(t||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?o.push(0,t,i):3===_&&(t||i)?(o.push(3,t,i),_=2):2===_&&"..."===i&&t?o.push(4,t,0):2===_&&i&&!t?o.push(5,0,!0,i):_>=5&&((i||!t&&5===_)&&(o.push(_,0,i,e),_=6),t&&(o.push(_,t,0,e),_=6)),i=""},f=0;f"===n?(_=1,i=""):i=n+i[0]:r?n===r?r="":i+=n:'"'===n||"'"===n?r=n:">"===n?(u(),_=1):_&&("="===n?(_=5,e=i,i=""):"/"===n&&(_<5||">"===t[f][s+1])?(u(),3===_&&(o=o[0]),_=o,(o=o[0]).push(2,0,_),_=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(u(),_=2):i+=n),3===_&&"!--"===i&&(_=4,o=o[0])}return u(),o}(t)),n),arguments,[])).length>1?n:n[0]}.bind(c);export{p as Component,dt as batch,Dt as computed,T as createContext,h as createRef,Mt as effect,c as h,It as html,A as render,Ht as signal,nt as useCallback,jt as useComputed,et as useContext,_t as useDebugValue,Q as useEffect,it as useErrorBoundary,Z as useImperativeHandle,X as useLayoutEffect,tt as useMemo,K as useReducer,Y as useRef,Rt as useSignal,J as useState}; +var t,n,e,_,i,r,o={},u=[],f=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(t,n){for(var e in n)t[e]=n[e];return t}function l(t){var n=t.parentNode;n&&n.removeChild(t)}function c(n,e,_){var i,r,o,u={};for(o in e)"key"==o?i=e[o]:"ref"==o?r=e[o]:u[o]=e[o];if(arguments.length>2&&(u.children=arguments.length>3?t.call(arguments,2):_),"function"==typeof n&&null!=n.defaultProps)for(o in n.defaultProps)void 0===u[o]&&(u[o]=n.defaultProps[o]);return a(n,u,i,r,null)}function a(t,_,i,r,o){var u={type:t,props:_,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++e:o};return null==o&&null!=n.vnode&&n.vnode(u),u}function h(){return{current:null}}function v(t){return t.children}function p(t,n){this.props=t,this.context=n}function d(t,n){if(null==n)return t.__?d(t.__,t.__.__k.indexOf(t)+1):null;for(var e;n0?a(m.type,m.props,m.key,m.ref?m.ref:null,m.__v):m)){if(m.__=e,m.__b=e.__b+1,null===(y=C[h])||y&&m.key==y.key&&m.type===y.type)C[h]=void 0;else for(p=0;p=_.__.length&&_.__.push({__V:R}),_.__[t]}function J(t){return L=1,K(ct,t)}function K(t,n,e){var _=z(V++,2);if(_.t=t,!_.__c&&(_.__=[e?e(n):ct(void 0,n),function(t){var n=_.__N?_.__N[0]:_.__[0],e=_.t(n,t);n!==e&&(_.__N=[e,_.__[1]],_.__c.setState({}))}],_.__c=M,!M.u)){M.u=!0;var i=M.shouldComponentUpdate;M.shouldComponentUpdate=function(t,n,e){if(!_.__c.__H)return!0;var r=_.__c.__H.__.filter(function(t){return t.__c});if(r.every(function(t){return!t.__N}))return!i||i.call(this,t,n,e);var o=!1;return r.forEach(function(t){if(t.__N){var n=t.__[0];t.__=t.__N,t.__N=void 0,n!==t.__[0]&&(o=!0)}}),!!o&&(!i||i.call(this,t,n,e))}}return _.__N||_.__}function Q(t,e){var _=z(V++,3);!n.__s&<(_.__H,e)&&(_.__=t,_.i=e,M.__H.__h.push(_))}function X(t,e){var _=z(V++,4);!n.__s&<(_.__H,e)&&(_.__=t,_.i=e,M.__h.push(_))}function Y(t){return L=5,tt(function(){return{current:t}},[])}function Z(t,n,e){L=6,X(function(){return"function"==typeof t?(t(n()),function(){return t(null)}):t?(t.current=n(),function(){return t.current=null}):void 0},null==e?e:e.concat(t))}function tt(t,n){var e=z(V++,7);return lt(e.__H,n)?(e.__V=t(),e.i=n,e.__h=t,e.__V):e.__}function nt(t,n){return L=8,tt(function(){return t},n)}function et(t){var n=M.context[t.__c],e=z(V++,9);return e.c=t,n?(null==e.__&&(e.__=!0,n.sub(M)),n.props.value):t.__}function _t(t,e){n.useDebugValue&&n.useDebugValue(e?e(t):t)}function it(t){var n=z(V++,10),e=J();return n.__=t,M.componentDidCatch||(M.componentDidCatch=function(t,_){n.__&&n.__(t,_),e[1](t)}),[e[0],function(){e[1](void 0)}]}function rt(){for(var t;t=W.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ft),t.__H.__h.forEach(st),t.__H.__h=[]}catch(e){t.__H.__h=[],n.__e(e,t.__v)}}n.__b=function(t){"function"!=typeof t.type||t.o||t.type===v?t.o||(t.o=t.__&&t.__.o?t.__.o:""):t.o=(t.__&&t.__.o?t.__.o:"")+(t.__&&t.__.__k?t.__.__k.indexOf(t):0),M=null,j&&j(t)},n.__r=function(t){I&&I(t),V=0;var n=(M=t.__c).__H;n&&(F===M?(n.__h=[],M.__h=[],n.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=R,t.__N=t.i=void 0})):(n.__h.forEach(ft),n.__h.forEach(st),n.__h=[])),F=M},n.diffed=function(t){q&&q(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==W.push(e)&&O===n.requestAnimationFrame||((O=n.requestAnimationFrame)||ut)(rt)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==R&&(t.__=t.__V),t.i=void 0,t.__V=R})),F=M=null},n.__c=function(t,e){e.some(function(t){try{t.__h.forEach(ft),t.__h=t.__h.filter(function(t){return!t.__||st(t)})}catch(_){e.some(function(t){t.__h&&(t.__h=[])}),e=[],n.__e(_,t.__v)}}),B&&B(t,e)},n.unmount=function(t){G&&G(t);var e,_=t.__c;_&&_.__H&&(_.__H.__.forEach(function(t){try{ft(t)}catch(t){e=t}}),_.__H=void 0,e&&n.__e(e,_.__v))};var ot="function"==typeof requestAnimationFrame;function ut(t){var n,e=function(){clearTimeout(_),ot&&cancelAnimationFrame(n),setTimeout(t)},_=setTimeout(e,100);ot&&(n=requestAnimationFrame(e))}function ft(t){var n=M,e=t.__c;"function"==typeof e&&(t.__c=void 0,e()),M=n}function st(t){var n=M;t.__c=t.__(),M=n}function lt(t,n){return!t||t.length!==n.length||n.some(function(n,e){return n!==t[e]})}function ct(t,n){return"function"==typeof n?n(t):n}var at=function(t,n,e,_){var i;n[0]=0;for(var r=1;r1)kt--;else{for(var t,n=!1;void 0!==bt;){var e=bt;for(bt=void 0,St++;void 0!==e;){var _=e.o;if(e.o=void 0,e.f&=-3,!(8&e.f)&&Et(e))try{e.c()}catch(e){n||(t=e,n=!0)}e=_}}if(St=0,kt--,n)throw t}}function dt(t){if(kt>0)return t();kt++;try{return t()}finally{pt()}}var yt,mt,gt=void 0,bt=void 0,kt=0,St=0,xt=0;function Ct(t){if(void 0!==gt){var n=t.n;if(void 0===n||n.t!==gt)return gt.s=n={i:0,S:t,p:void 0,n:gt.s,t:gt,e:void 0,x:void 0,r:n},t.n=n,32>.f&&t.S(n),n;if(-1===n.i)return n.i=0,void 0!==n.p&&(n.p.n=n.n,void 0!==n.n&&(n.n.p=n.p),n.p=void 0,n.n=gt.s,gt.s.p=n,gt.s=n),n}}function wt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}function Ht(t){return new wt(t)}function Et(t){for(var n=t.s;void 0!==n;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function Ut(t){for(var n=t.s;void 0!==n;n=n.n){var e=n.S.n;void 0!==e&&(n.r=e),n.S.n=n,n.i=-1}}function Nt(t){for(var n=t.s,e=void 0;void 0!==n;){var _=n.n;-1===n.i?(n.S.U(n),n.n=void 0):(void 0!==e&&(e.p=n),n.p=void 0,n.n=e,e=n),n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=_}t.s=e}function Pt(t){wt.call(this,void 0),this.x=t,this.s=void 0,this.g=xt-1,this.f=4}function Dt(t){return new Pt(t)}function $t(t){var n=t.u;if(t.u=void 0,"function"==typeof n){kt++;var e=gt;gt=void 0;try{n()}catch(n){throw t.f&=-2,t.f|=8,At(t),n}finally{gt=e,pt()}}}function At(t){for(var n=t.s;void 0!==n;n=n.n)n.S.U(n);t.x=void 0,t.s=void 0,$t(t)}function Tt(t){if(gt!==this)throw new Error("Out-of-order effect");Nt(this),gt=t,this.f&=-2,8&this.f&&At(this),pt()}function Vt(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Mt(t){var n=new Vt(t);return n.c(),n.d.bind(n)}function Ft(t,e){n[t]=e.bind(null,n[t]||function(){})}function Ot(t){mt&&mt(),mt=t&&t.S()}function Lt(t){var n=this,e=t.data,_=Rt(e);_.value=e;var i=tt(function(){for(var t=n.__v;t=t.__;)if(t.__c){t.__c.__$f|=4;break}return n.__$u.c=function(){n.base.data=i.peek()},Dt(function(){var t=_.value.value;return 0===t?0:!0===t?"":t||""})},[]);return i.value}function Wt(t,n,e,_){var i=n in t&&void 0===t.ownerSVGElement,r=Ht(e);return{o:function(t,n){r.value=t,_=n},d:Mt(function(){var e=r.value.value;_[n]!==e&&(_[n]=e,i?t[n]=e:e?t.setAttribute(n,e):t.removeAttribute(n))})}}function Rt(t){return tt(function(){return Ht(t)},[])}function jt(t){var n=Y(t);return n.current=t,yt.__$f|=4,tt(function(){return Dt(function(){return n.current()})},[])}wt.prototype.h=function(){return!0},wt.prototype.S=function(t){this.t!==t&&void 0===t.e&&(t.x=this.t,void 0!==this.t&&(this.t.e=t),this.t=t)},wt.prototype.U=function(t){var n=t.e,e=t.x;void 0!==n&&(n.x=e,t.e=void 0),void 0!==e&&(e.e=n,t.x=void 0),t===this.t&&(this.t=e)},wt.prototype.subscribe=function(t){var n=this;return Mt(function(){var e=n.value,_=32&this.f;this.f&=-33;try{t(e)}finally{this.f|=_}})},wt.prototype.valueOf=function(){return this.value},wt.prototype.toString=function(){return this.value+""},wt.prototype.peek=function(){return this.v},Object.defineProperty(wt.prototype,"value",{get:function(){var t=Ct(this);return void 0!==t&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){St>100&&vt(),this.v=t,this.i++,xt++,kt++;try{for(var n=this.t;void 0!==n;n=n.x)n.t.N()}finally{pt()}}}}),(Pt.prototype=new wt).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===xt)return!0;if(this.g=xt,this.f|=1,this.i>0&&!Et(this))return this.f&=-2,!0;var t=gt;try{Ut(this),gt=this;var n=this.x();(16&this.f||this.v!==n||0===this.i)&&(this.v=n,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return gt=t,Nt(this),this.f&=-2,!0},Pt.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(var n=this.s;void 0!==n;n=n.n)n.S.S(n)}wt.prototype.S.call(this,t)},Pt.prototype.U=function(t){if(wt.prototype.U.call(this,t),void 0===this.t){this.f&=-33;for(var n=this.s;void 0!==n;n=n.n)n.S.U(n)}},Pt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;void 0!==t;t=t.x)t.t.N()}},Pt.prototype.peek=function(){if(this.h()||vt(),16&this.f)throw this.v;return this.v},Object.defineProperty(Pt.prototype,"value",{get:function(){1&this.f&&vt();var t=Ct(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),Vt.prototype.c=function(){var t=this.S();try{8&this.f||void 0===this.x||(this.u=this.x())}finally{t()}},Vt.prototype.S=function(){1&this.f&&vt(),this.f|=1,this.f&=-9,$t(this),Ut(this),kt++;var t=gt;return gt=this,Tt.bind(this,t)},Vt.prototype.N=function(){2&this.f||(this.f|=2,this.o=bt,bt=this)},Vt.prototype.d=function(){this.f|=8,1&this.f||At(this)},Lt.displayName="_st",Object.defineProperties(wt.prototype,{constructor:{configurable:!0},type:{configurable:!0,value:Lt},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),Ft("__b",function(t,n){if("string"==typeof n.type){var e,_=n.props;for(var i in _)if("children"!==i){var r=_[i];r instanceof wt&&(e||(n.__np=e={}),e[i]=r,_[i]=r.peek())}}t(n)}),Ft("__r",function(t,n){Ot();var e,_=n.__c;_&&(_.__$f&=-2,void 0===(e=_.__$u)&&(_.__$u=e=function(t){var n;return Mt(function(){n=this}),n.c=function(){_.__$f|=1,_.setState({})},n}())),yt=_,Ot(e),t(n)}),Ft("__e",function(t,n,e,_){Ot(),yt=void 0,t(n,e,_)}),Ft("diffed",function(t,n){var e;if(Ot(),yt=void 0,"string"==typeof n.type&&(e=n.__e)){var _=n.__np,i=n.props;if(_){var r=e.U;if(r)for(var o in r){var u=r[o];void 0===u||o in _||(u.d(),r[o]=void 0)}else e.U=r={};for(var f in _){var s=r[f],l=_[f];void 0===s?(s=Wt(e,f,l,i),r[f]=s):s.o(l,i)}}}t(n)}),Ft("unmount",function(t,n){if("string"==typeof n.type){var e=n.__e;if(e){var _=e.U;if(_)for(var i in e.U=void 0,_){var r=_[i];r&&r.d()}}}else{var o=n.__c;if(o){var u=o.__$u;u&&(o.__$u=void 0,u.d())}}t(n)}),Ft("__h",function(t,n,e,_){_<3&&(n.__$f|=2),t(n,e,_)}),p.prototype.shouldComponentUpdate=function(t,n){var e=this.__$u;if(!(e&&void 0!==e.s||4&this.__$f))return!0;if(3&this.__$f)return!0;for(var _ in n)return!0;for(var i in t)if("__source"!==i&&t[i]!==this.props[i])return!0;for(var r in this.props)if(!(r in t))return!0;return!1};var It=function(t){var n=ht.get(this);return n||(n=new Map,ht.set(this,n)),(n=at(this,n.get(t)||(n.set(t,n=function(t){for(var n,e,_=1,i="",r="",o=[0],u=function(t){1===_&&(t||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?o.push(0,t,i):3===_&&(t||i)?(o.push(3,t,i),_=2):2===_&&"..."===i&&t?o.push(4,t,0):2===_&&i&&!t?o.push(5,0,!0,i):_>=5&&((i||!t&&5===_)&&(o.push(_,0,i,e),_=6),t&&(o.push(_,t,0,e),_=6)),i=""},f=0;f"===n?(_=1,i=""):i=n+i[0]:r?n===r?r="":i+=n:'"'===n||"'"===n?r=n:">"===n?(u(),_=1):_&&("="===n?(_=5,e=i,i=""):"/"===n&&(_<5||">"===t[f][s+1])?(u(),3===_&&(o=o[0]),_=o,(o=o[0]).push(2,0,_),_=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(u(),_=2):i+=n),3===_&&"!--"===i&&(_=4,o=o[0])}return u(),o}(t)),n),arguments,[])).length>1?n:n[0]}.bind(c);export{p as Component,dt as batch,Dt as computed,T as createContext,h as createRef,Mt as effect,c as h,It as html,A as render,Ht as signal,nt as useCallback,jt as useComputed,et as useContext,_t as useDebugValue,Q as useEffect,it as useErrorBoundary,Z as useImperativeHandle,X as useLayoutEffect,tt as useMemo,K as useReducer,Y as useRef,Rt as useSignal,J as useState}; diff --git a/dist/standalone.umd.js b/dist/standalone.umd.js index 8db31f8..7a18578 100644 --- a/dist/standalone.umd.js +++ b/dist/standalone.umd.js @@ -1 +1 @@ -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t||self).preactHtmSignalsStandalone={})}(this,function(t){var n,e,_,i,o,r,u={},f=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(t,n){for(var e in n)t[e]=n[e];return t}function c(t){var n=t.parentNode;n&&n.removeChild(t)}function a(t,e,_){var i,o,r,u={};for(r in e)"key"==r?i=e[r]:"ref"==r?o=e[r]:u[r]=e[r];if(arguments.length>2&&(u.children=arguments.length>3?n.call(arguments,2):_),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===u[r]&&(u[r]=t.defaultProps[r]);return h(t,u,i,o,null)}function h(t,n,i,o,r){var u={type:t,props:n,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++_:r};return null==r&&null!=e.vnode&&e.vnode(u),u}function p(t){return t.children}function v(t,n){this.props=t,this.context=n}function d(t,n){if(null==n)return t.__?d(t.__,t.__.__k.indexOf(t)+1):null;for(var e;n0?h(m.type,m.props,m.key,m.ref?m.ref:null,m.__v):m)){if(m.__=e,m.__b=e.__b+1,null===(y=C[a])||y&&m.key==y.key&&m.type===y.type)C[a]=void 0;else for(v=0;v=_.__.length&&_.__.push({__V:L}),_.__[t]}function G(t){return F=1,z(_t,t)}function z(t,n,e){var _=B($++,2);if(_.t=t,!_.__c&&(_.__=[e?e(n):_t(void 0,n),function(t){var n=_.__N?_.__N[0]:_.__[0],e=_.t(n,t);n!==e&&(_.__N=[e,_.__[1]],_.__c.setState({}))}],_.__c=A,!A.u)){A.u=!0;var i=A.shouldComponentUpdate;A.shouldComponentUpdate=function(t,n,e){if(!_.__c.__H)return!0;var o=_.__c.__H.__.filter(function(t){return t.__c});if(o.every(function(t){return!t.__N}))return!i||i.call(this,t,n,e);var r=!1;return o.forEach(function(t){if(t.__N){var n=t.__[0];t.__=t.__N,t.__N=void 0,n!==t.__[0]&&(r=!0)}}),!!r&&(!i||i.call(this,t,n,e))}}return _.__N||_.__}function J(t,n){var _=B($++,4);!e.__s&&et(_.__H,n)&&(_.__=t,_.i=n,A.__h.push(_))}function K(t){return F=5,Q(function(){return{current:t}},[])}function Q(t,n){var e=B($++,7);return et(e.__H,n)?(e.__V=t(),e.i=n,e.__h=t,e.__V):e.__}function X(){for(var t;t=O.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(tt),t.__H.__h.forEach(nt),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}}e.__b=function(t){"function"!=typeof t.type||t.o||t.type===p?t.o||(t.o=t.__&&t.__.o?t.__.o:""):t.o=(t.__&&t.__.o?t.__.o:"")+(t.__&&t.__.__k?t.__.__k.indexOf(t):0),A=null,W&&W(t)},e.__r=function(t){R&&R(t),$=0;var n=(A=t.__c).__H;n&&(V===A?(n.__h=[],A.__h=[],n.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=L,t.__N=t.i=void 0})):(n.__h.forEach(tt),n.__h.forEach(nt),n.__h=[])),V=A},e.diffed=function(t){j&&j(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(1!==O.push(n)&&M===e.requestAnimationFrame||((M=e.requestAnimationFrame)||Z)(X)),n.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==L&&(t.__=t.__V),t.i=void 0,t.__V=L})),V=A=null},e.__c=function(t,n){n.some(function(t){try{t.__h.forEach(tt),t.__h=t.__h.filter(function(t){return!t.__||nt(t)})}catch(_){n.some(function(t){t.__h&&(t.__h=[])}),n=[],e.__e(_,t.__v)}}),I&&I(t,n)},e.unmount=function(t){q&&q(t);var n,_=t.__c;_&&_.__H&&(_.__H.__.forEach(function(t){try{tt(t)}catch(t){n=t}}),_.__H=void 0,n&&e.__e(n,_.__v))};var Y="function"==typeof requestAnimationFrame;function Z(t){var n,e=function(){clearTimeout(_),Y&&cancelAnimationFrame(n),setTimeout(t)},_=setTimeout(e,100);Y&&(n=requestAnimationFrame(e))}function tt(t){var n=A,e=t.__c;"function"==typeof e&&(t.__c=void 0,e()),A=n}function nt(t){var n=A;t.__c=t.__(),A=n}function et(t,n){return!t||t.length!==n.length||n.some(function(n,e){return n!==t[e]})}function _t(t,n){return"function"==typeof n?n(t):n}var it=function(t,n,e,_){var i;n[0]=0;for(var o=1;o1)at--;else{for(var t,n=!1;void 0!==ct;){var e=ct;for(ct=void 0,ht++;void 0!==e;){var _=e.o;if(e.o=void 0,e.f&=-3,!(8&e.f)&&4&e.f&&mt(e))try{e.c()}catch(e){n||(t=e,n=!0)}e=_}}if(ht=0,at--,n)throw t}}var ft,lt,st=void 0,ct=void 0,at=0,ht=0,pt=0;function vt(t){if(void 0!==st){var n=t.n;if(void 0===n||n.t!==st)return st.s=n={f:0,i:0,S:t,p:void 0,n:st.s,t:st,e:void 0,x:void 0,r:n},t.n=n,32&st.f&&t.S(n),n;if(1&n.f){n.f&=-2;var e=st.s;if(n!==e){var _=n.p,i=n.n;void 0!==_&&(_.n=i),void 0!==i&&(i.p=_),void 0!==e&&(e.p=n),n.p=void 0,n.n=e,st.s=n}return n}}}function dt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}function yt(t){return new dt(t)}function mt(t){for(var n=t.s;void 0!==n&&n.S.i===n.i&&n.S.h()&&n.S.i===n.i;)n=n.n;return void 0!==n}function gt(t){for(var n=t.s;void 0!==n;n=n.n){var e=n.S.n;void 0!==e&&(n.r=e),n.S.n=n,n.f|=1}}function bt(t){for(var n=t.s,e=void 0;void 0!==n;){var _=n.n;1&n.f?(n.S.U(n),n.n=void 0):(void 0!==e&&(e.p=n),n.p=void 0,n.n=e,e=n),n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=_}t.s=e}function kt(t){dt.call(this,void 0),this.x=t,this.s=void 0,this.g=pt-1,this.f=4}function St(t){return new kt(t)}function xt(t){var n=t.u;if(t.u=void 0,"function"==typeof n){at++;var e=st;st=void 0;try{n()}catch(n){throw t.f&=-2,t.f|=8,Ct(t),n}finally{st=e,ut()}}}function Ct(t){for(var n=t.s;void 0!==n;n=n.n)n.S.U(n);t.x=void 0,t.s=void 0,xt(t)}function wt(t){if(st!==this)throw new Error("Out-of-order effect");bt(this),st=t,this.f&=-2,8&this.f&&Ct(this),ut()}function Ht(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=36}function Et(t){var n=new Ht(t);return n.c(),n.d.bind(n)}function Ut(t,n){e[t]=n.bind(null,e[t]||function(){})}function Nt(t){lt&<(),lt=t&&t.S()}function Pt(t){var n=this,e=t.data,_=Tt(e);_.value=e;var i=Q(function(){for(var t=n.__v;t=t.__;)if(t.__c){t.__c.__$f|=4;break}return n.__$u.c=function(){n.base.data=i.peek()},St(function(){var t=_.value.value;return 0===t?0:!0===t?"":t||""})},[]);return i.value}function Dt(t,n,e,_){var i=n in t&&void 0===t.ownerSVGElement,o=yt(e);return{o:function(t,n){o.value=t,_=n},d:Et(function(){var e=o.value.value;_[n]!==e&&(_[n]=e,i?t[n]=e:e?t.setAttribute(n,e):t.removeAttribute(n))})}}function Tt(t){return Q(function(){return yt(t)},[])}dt.prototype.h=function(){return!0},dt.prototype.S=function(t){2&t.f||(t.f|=2,t.x=this.t,void 0!==this.t&&(this.t.e=t),this.t=t)},dt.prototype.U=function(t){if(2&t.f){t.f&=-3;var n=t.e,e=t.x;void 0!==n&&(n.x=e,t.e=void 0),void 0!==e&&(e.e=n,t.x=void 0),t===this.t&&(this.t=e)}},dt.prototype.subscribe=function(t){var n=this;return Et(function(){var e=n.value,_=32&this.f;this.f&=-33;try{t(e)}finally{this.f|=_}})},dt.prototype.valueOf=function(){return this.value},dt.prototype.toString=function(){return this.value+""},dt.prototype.peek=function(){return this.v},Object.defineProperty(dt.prototype,"value",{get:function(){var t=vt(this);return void 0!==t&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){ht>100&&rt(),this.v=t,this.i++,pt++,at++;try{for(var n=this.t;void 0!==n;n=n.x)n.t.N()}finally{ut()}}}}),(kt.prototype=new dt).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===pt)return!0;if(this.g=pt,this.f|=1,this.i>0&&!mt(this))return this.f&=-2,!0;var t=st;try{gt(this),st=this;var n=this.x();(16&this.f||this.v!==n||0===this.i)&&(this.v=n,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return st=t,bt(this),this.f&=-2,!0},kt.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(var n=this.s;void 0!==n;n=n.n)n.S.S(n)}dt.prototype.S.call(this,t)},kt.prototype.U=function(t){if(dt.prototype.U.call(this,t),void 0===this.t){this.f&=-33;for(var n=this.s;void 0!==n;n=n.n)n.S.U(n)}},kt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;void 0!==t;t=t.x)t.t.N()}},kt.prototype.peek=function(){if(this.h()||rt(),16&this.f)throw this.v;return this.v},Object.defineProperty(kt.prototype,"value",{get:function(){1&this.f&&rt();var t=vt(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),Ht.prototype.c=function(){var t=this.S();try{8&this.f||void 0===this.x||(this.u=this.x())}finally{t()}},Ht.prototype.S=function(){1&this.f&&rt(),this.f|=1,this.f&=-9,xt(this),gt(this),at++,this.f&=-5;var t=st;return st=this,wt.bind(this,t)},Ht.prototype.N=function(){2&this.f||(this.f|=6,this.o=ct,ct=this)},Ht.prototype.d=function(){this.f|=8,1&this.f||Ct(this)},Pt.displayName="_st",Object.defineProperties(dt.prototype,{constructor:{configurable:!0},type:{configurable:!0,value:Pt},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),Ut("__b",function(t,n){if("string"==typeof n.type){var e,_=n.props;for(var i in _)if("children"!==i){var o=_[i];o instanceof dt&&(e||(n.__np=e={}),e[i]=o,_[i]=o.peek())}}t(n)}),Ut("__r",function(t,n){Nt();var e,_=n.__c;_&&(_.__$f&=-2,void 0===(e=_.__$u)&&(_.__$u=e=function(t){var n;return Et(function(){n=this}),n.c=function(){_.__$f|=1,_.setState({})},n}())),ft=_,Nt(e),t(n)}),Ut("__e",function(t,n,e,_){Nt(),ft=void 0,t(n,e,_)}),Ut("diffed",function(t,n){var e;if(Nt(),ft=void 0,"string"==typeof n.type&&(e=n.__e)){var _=n.__np,i=n.props;if(_){var o=e.U;if(o)for(var r in o){var u=o[r];void 0===u||r in _||(u.d(),o[r]=void 0)}else e.U=o={};for(var f in _){var l=o[f],s=_[f];void 0===l?(l=Dt(e,f,s,i),o[f]=l):l.o(s,i)}}}t(n)}),Ut("unmount",function(t,n){if("string"==typeof n.type){var e=n.__e;if(e){var _=e.U;if(_)for(var i in e.U=void 0,_){var o=_[i];o&&o.d()}}}else{var r=n.__c;if(r){var u=r.__$u;u&&(r.__$u=void 0,u.d())}}t(n)}),Ut("__h",function(t,n,e,_){_<3&&(n.__$f|=2),t(n,e,_)}),v.prototype.shouldComponentUpdate=function(t,n){var e=this.__$u;if(!(e&&void 0!==e.s||4&this.__$f))return!0;if(3&this.__$f)return!0;for(var _ in n)return!0;for(var i in t)if("__source"!==i&&t[i]!==this.props[i])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};var $t=function(t){var n=ot.get(this);return n||(n=new Map,ot.set(this,n)),(n=it(this,n.get(t)||(n.set(t,n=function(t){for(var n,e,_=1,i="",o="",r=[0],u=function(t){1===_&&(t||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?r.push(0,t,i):3===_&&(t||i)?(r.push(3,t,i),_=2):2===_&&"..."===i&&t?r.push(4,t,0):2===_&&i&&!t?r.push(5,0,!0,i):_>=5&&((i||!t&&5===_)&&(r.push(_,0,i,e),_=6),t&&(r.push(_,t,0,e),_=6)),i=""},f=0;f"===n?(_=1,i=""):i=n+i[0]:o?n===o?o="":i+=n:'"'===n||"'"===n?o=n:">"===n?(u(),_=1):_&&("="===n?(_=5,e=i,i=""):"/"===n&&(_<5||">"===t[f][l+1])?(u(),3===_&&(r=r[0]),_=r,(r=r[0]).push(2,0,_),_=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(u(),_=2):i+=n),3===_&&"!--"===i&&(_=4,r=r[0])}return u(),r}(t)),n),arguments,[])).length>1?n:n[0]}.bind(a);t.Component=v,t.batch=function(t){if(at>0)return t();at++;try{return t()}finally{ut()}},t.computed=St,t.createContext=function(t,n){var e={__c:n="__cC"+r++,__:t,Consumer:function(t,n){return t.children(n)},Provider:function(t){var e,_;return this.getChildContext||(e=[],(_={})[n]=this,this.getChildContext=function(){return _},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&e.some(m)},this.sub=function(t){e.push(t);var n=t.componentWillUnmount;t.componentWillUnmount=function(){e.splice(e.indexOf(t),1),n&&n.call(t)}}),t.children}};return e.Provider.__=e.Consumer.contextType=e},t.createRef=function(){return{current:null}},t.effect=Et,t.h=a,t.html=$t,t.render=function(t,_,i){var o,r,f;e.__&&e.__(t,_),r=(o="function"==typeof i)?null:i&&i.__k||_.__k,f=[],E(_,t=(!o&&i||_).__k=a(p,null,[t]),r||u,u,void 0!==_.ownerSVGElement,!o&&i?[i]:r?null:_.firstChild?n.call(_.childNodes):null,f,!o&&i?i:r?r.__e:_.firstChild,o),U(f,t)},t.signal=yt,t.useCallback=function(t,n){return F=8,Q(function(){return t},n)},t.useComputed=function(t){var n=K(t);return n.current=t,ft.__$f|=4,Q(function(){return St(function(){return n.current()})},[])},t.useContext=function(t){var n=A.context[t.__c],e=B($++,9);return e.c=t,n?(null==e.__&&(e.__=!0,n.sub(A)),n.props.value):t.__},t.useDebugValue=function(t,n){e.useDebugValue&&e.useDebugValue(n?n(t):t)},t.useEffect=function(t,n){var _=B($++,3);!e.__s&&et(_.__H,n)&&(_.__=t,_.i=n,A.__H.__h.push(_))},t.useErrorBoundary=function(t){var n=B($++,10),e=G();return n.__=t,A.componentDidCatch||(A.componentDidCatch=function(t,_){n.__&&n.__(t,_),e[1](t)}),[e[0],function(){e[1](void 0)}]},t.useImperativeHandle=function(t,n,e){F=6,J(function(){return"function"==typeof t?(t(n()),function(){return t(null)}):t?(t.current=n(),function(){return t.current=null}):void 0},null==e?e:e.concat(t))},t.useLayoutEffect=J,t.useMemo=Q,t.useReducer=z,t.useRef=K,t.useSignal=Tt,t.useState=G}); +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t||self).preactHtmSignalsStandalone={})}(this,function(t){var n,e,_,i,o,r,u={},f=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(t,n){for(var e in n)t[e]=n[e];return t}function c(t){var n=t.parentNode;n&&n.removeChild(t)}function a(t,e,_){var i,o,r,u={};for(r in e)"key"==r?i=e[r]:"ref"==r?o=e[r]:u[r]=e[r];if(arguments.length>2&&(u.children=arguments.length>3?n.call(arguments,2):_),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===u[r]&&(u[r]=t.defaultProps[r]);return h(t,u,i,o,null)}function h(t,n,i,o,r){var u={type:t,props:n,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++_:r};return null==r&&null!=e.vnode&&e.vnode(u),u}function p(t){return t.children}function v(t,n){this.props=t,this.context=n}function d(t,n){if(null==n)return t.__?d(t.__,t.__.__k.indexOf(t)+1):null;for(var e;n0?h(m.type,m.props,m.key,m.ref?m.ref:null,m.__v):m)){if(m.__=e,m.__b=e.__b+1,null===(y=C[a])||y&&m.key==y.key&&m.type===y.type)C[a]=void 0;else for(v=0;v=_.__.length&&_.__.push({__V:L}),_.__[t]}function G(t){return F=1,z(_t,t)}function z(t,n,e){var _=B($++,2);if(_.t=t,!_.__c&&(_.__=[e?e(n):_t(void 0,n),function(t){var n=_.__N?_.__N[0]:_.__[0],e=_.t(n,t);n!==e&&(_.__N=[e,_.__[1]],_.__c.setState({}))}],_.__c=A,!A.u)){A.u=!0;var i=A.shouldComponentUpdate;A.shouldComponentUpdate=function(t,n,e){if(!_.__c.__H)return!0;var o=_.__c.__H.__.filter(function(t){return t.__c});if(o.every(function(t){return!t.__N}))return!i||i.call(this,t,n,e);var r=!1;return o.forEach(function(t){if(t.__N){var n=t.__[0];t.__=t.__N,t.__N=void 0,n!==t.__[0]&&(r=!0)}}),!!r&&(!i||i.call(this,t,n,e))}}return _.__N||_.__}function J(t,n){var _=B($++,4);!e.__s&&et(_.__H,n)&&(_.__=t,_.i=n,A.__h.push(_))}function K(t){return F=5,Q(function(){return{current:t}},[])}function Q(t,n){var e=B($++,7);return et(e.__H,n)?(e.__V=t(),e.i=n,e.__h=t,e.__V):e.__}function X(){for(var t;t=O.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(tt),t.__H.__h.forEach(nt),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}}e.__b=function(t){"function"!=typeof t.type||t.o||t.type===p?t.o||(t.o=t.__&&t.__.o?t.__.o:""):t.o=(t.__&&t.__.o?t.__.o:"")+(t.__&&t.__.__k?t.__.__k.indexOf(t):0),A=null,W&&W(t)},e.__r=function(t){R&&R(t),$=0;var n=(A=t.__c).__H;n&&(V===A?(n.__h=[],A.__h=[],n.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=L,t.__N=t.i=void 0})):(n.__h.forEach(tt),n.__h.forEach(nt),n.__h=[])),V=A},e.diffed=function(t){j&&j(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(1!==O.push(n)&&M===e.requestAnimationFrame||((M=e.requestAnimationFrame)||Z)(X)),n.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==L&&(t.__=t.__V),t.i=void 0,t.__V=L})),V=A=null},e.__c=function(t,n){n.some(function(t){try{t.__h.forEach(tt),t.__h=t.__h.filter(function(t){return!t.__||nt(t)})}catch(_){n.some(function(t){t.__h&&(t.__h=[])}),n=[],e.__e(_,t.__v)}}),I&&I(t,n)},e.unmount=function(t){q&&q(t);var n,_=t.__c;_&&_.__H&&(_.__H.__.forEach(function(t){try{tt(t)}catch(t){n=t}}),_.__H=void 0,n&&e.__e(n,_.__v))};var Y="function"==typeof requestAnimationFrame;function Z(t){var n,e=function(){clearTimeout(_),Y&&cancelAnimationFrame(n),setTimeout(t)},_=setTimeout(e,100);Y&&(n=requestAnimationFrame(e))}function tt(t){var n=A,e=t.__c;"function"==typeof e&&(t.__c=void 0,e()),A=n}function nt(t){var n=A;t.__c=t.__(),A=n}function et(t,n){return!t||t.length!==n.length||n.some(function(n,e){return n!==t[e]})}function _t(t,n){return"function"==typeof n?n(t):n}var it=function(t,n,e,_){var i;n[0]=0;for(var o=1;o1)at--;else{for(var t,n=!1;void 0!==ct;){var e=ct;for(ct=void 0,ht++;void 0!==e;){var _=e.o;if(e.o=void 0,e.f&=-3,!(8&e.f)&&mt(e))try{e.c()}catch(e){n||(t=e,n=!0)}e=_}}if(ht=0,at--,n)throw t}}var ft,lt,st=void 0,ct=void 0,at=0,ht=0,pt=0;function vt(t){if(void 0!==st){var n=t.n;if(void 0===n||n.t!==st)return st.s=n={i:0,S:t,p:void 0,n:st.s,t:st,e:void 0,x:void 0,r:n},t.n=n,32&st.f&&t.S(n),n;if(-1===n.i)return n.i=0,void 0!==n.p&&(n.p.n=n.n,void 0!==n.n&&(n.n.p=n.p),n.p=void 0,n.n=st.s,st.s.p=n,st.s=n),n}}function dt(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}function yt(t){return new dt(t)}function mt(t){for(var n=t.s;void 0!==n;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function gt(t){for(var n=t.s;void 0!==n;n=n.n){var e=n.S.n;void 0!==e&&(n.r=e),n.S.n=n,n.i=-1}}function bt(t){for(var n=t.s,e=void 0;void 0!==n;){var _=n.n;-1===n.i?(n.S.U(n),n.n=void 0):(void 0!==e&&(e.p=n),n.p=void 0,n.n=e,e=n),n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=_}t.s=e}function kt(t){dt.call(this,void 0),this.x=t,this.s=void 0,this.g=pt-1,this.f=4}function St(t){return new kt(t)}function xt(t){var n=t.u;if(t.u=void 0,"function"==typeof n){at++;var e=st;st=void 0;try{n()}catch(n){throw t.f&=-2,t.f|=8,Ct(t),n}finally{st=e,ut()}}}function Ct(t){for(var n=t.s;void 0!==n;n=n.n)n.S.U(n);t.x=void 0,t.s=void 0,xt(t)}function wt(t){if(st!==this)throw new Error("Out-of-order effect");bt(this),st=t,this.f&=-2,8&this.f&&Ct(this),ut()}function Ht(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Et(t){var n=new Ht(t);return n.c(),n.d.bind(n)}function Ut(t,n){e[t]=n.bind(null,e[t]||function(){})}function Nt(t){lt&<(),lt=t&&t.S()}function Pt(t){var n=this,e=t.data,_=Tt(e);_.value=e;var i=Q(function(){for(var t=n.__v;t=t.__;)if(t.__c){t.__c.__$f|=4;break}return n.__$u.c=function(){n.base.data=i.peek()},St(function(){var t=_.value.value;return 0===t?0:!0===t?"":t||""})},[]);return i.value}function Dt(t,n,e,_){var i=n in t&&void 0===t.ownerSVGElement,o=yt(e);return{o:function(t,n){o.value=t,_=n},d:Et(function(){var e=o.value.value;_[n]!==e&&(_[n]=e,i?t[n]=e:e?t.setAttribute(n,e):t.removeAttribute(n))})}}function Tt(t){return Q(function(){return yt(t)},[])}dt.prototype.h=function(){return!0},dt.prototype.S=function(t){this.t!==t&&void 0===t.e&&(t.x=this.t,void 0!==this.t&&(this.t.e=t),this.t=t)},dt.prototype.U=function(t){var n=t.e,e=t.x;void 0!==n&&(n.x=e,t.e=void 0),void 0!==e&&(e.e=n,t.x=void 0),t===this.t&&(this.t=e)},dt.prototype.subscribe=function(t){var n=this;return Et(function(){var e=n.value,_=32&this.f;this.f&=-33;try{t(e)}finally{this.f|=_}})},dt.prototype.valueOf=function(){return this.value},dt.prototype.toString=function(){return this.value+""},dt.prototype.peek=function(){return this.v},Object.defineProperty(dt.prototype,"value",{get:function(){var t=vt(this);return void 0!==t&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){ht>100&&rt(),this.v=t,this.i++,pt++,at++;try{for(var n=this.t;void 0!==n;n=n.x)n.t.N()}finally{ut()}}}}),(kt.prototype=new dt).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===pt)return!0;if(this.g=pt,this.f|=1,this.i>0&&!mt(this))return this.f&=-2,!0;var t=st;try{gt(this),st=this;var n=this.x();(16&this.f||this.v!==n||0===this.i)&&(this.v=n,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return st=t,bt(this),this.f&=-2,!0},kt.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(var n=this.s;void 0!==n;n=n.n)n.S.S(n)}dt.prototype.S.call(this,t)},kt.prototype.U=function(t){if(dt.prototype.U.call(this,t),void 0===this.t){this.f&=-33;for(var n=this.s;void 0!==n;n=n.n)n.S.U(n)}},kt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;void 0!==t;t=t.x)t.t.N()}},kt.prototype.peek=function(){if(this.h()||rt(),16&this.f)throw this.v;return this.v},Object.defineProperty(kt.prototype,"value",{get:function(){1&this.f&&rt();var t=vt(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),Ht.prototype.c=function(){var t=this.S();try{8&this.f||void 0===this.x||(this.u=this.x())}finally{t()}},Ht.prototype.S=function(){1&this.f&&rt(),this.f|=1,this.f&=-9,xt(this),gt(this),at++;var t=st;return st=this,wt.bind(this,t)},Ht.prototype.N=function(){2&this.f||(this.f|=2,this.o=ct,ct=this)},Ht.prototype.d=function(){this.f|=8,1&this.f||Ct(this)},Pt.displayName="_st",Object.defineProperties(dt.prototype,{constructor:{configurable:!0},type:{configurable:!0,value:Pt},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),Ut("__b",function(t,n){if("string"==typeof n.type){var e,_=n.props;for(var i in _)if("children"!==i){var o=_[i];o instanceof dt&&(e||(n.__np=e={}),e[i]=o,_[i]=o.peek())}}t(n)}),Ut("__r",function(t,n){Nt();var e,_=n.__c;_&&(_.__$f&=-2,void 0===(e=_.__$u)&&(_.__$u=e=function(t){var n;return Et(function(){n=this}),n.c=function(){_.__$f|=1,_.setState({})},n}())),ft=_,Nt(e),t(n)}),Ut("__e",function(t,n,e,_){Nt(),ft=void 0,t(n,e,_)}),Ut("diffed",function(t,n){var e;if(Nt(),ft=void 0,"string"==typeof n.type&&(e=n.__e)){var _=n.__np,i=n.props;if(_){var o=e.U;if(o)for(var r in o){var u=o[r];void 0===u||r in _||(u.d(),o[r]=void 0)}else e.U=o={};for(var f in _){var l=o[f],s=_[f];void 0===l?(l=Dt(e,f,s,i),o[f]=l):l.o(s,i)}}}t(n)}),Ut("unmount",function(t,n){if("string"==typeof n.type){var e=n.__e;if(e){var _=e.U;if(_)for(var i in e.U=void 0,_){var o=_[i];o&&o.d()}}}else{var r=n.__c;if(r){var u=r.__$u;u&&(r.__$u=void 0,u.d())}}t(n)}),Ut("__h",function(t,n,e,_){_<3&&(n.__$f|=2),t(n,e,_)}),v.prototype.shouldComponentUpdate=function(t,n){var e=this.__$u;if(!(e&&void 0!==e.s||4&this.__$f))return!0;if(3&this.__$f)return!0;for(var _ in n)return!0;for(var i in t)if("__source"!==i&&t[i]!==this.props[i])return!0;for(var o in this.props)if(!(o in t))return!0;return!1};var $t=function(t){var n=ot.get(this);return n||(n=new Map,ot.set(this,n)),(n=it(this,n.get(t)||(n.set(t,n=function(t){for(var n,e,_=1,i="",o="",r=[0],u=function(t){1===_&&(t||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?r.push(0,t,i):3===_&&(t||i)?(r.push(3,t,i),_=2):2===_&&"..."===i&&t?r.push(4,t,0):2===_&&i&&!t?r.push(5,0,!0,i):_>=5&&((i||!t&&5===_)&&(r.push(_,0,i,e),_=6),t&&(r.push(_,t,0,e),_=6)),i=""},f=0;f"===n?(_=1,i=""):i=n+i[0]:o?n===o?o="":i+=n:'"'===n||"'"===n?o=n:">"===n?(u(),_=1):_&&("="===n?(_=5,e=i,i=""):"/"===n&&(_<5||">"===t[f][l+1])?(u(),3===_&&(r=r[0]),_=r,(r=r[0]).push(2,0,_),_=0):" "===n||"\t"===n||"\n"===n||"\r"===n?(u(),_=2):i+=n),3===_&&"!--"===i&&(_=4,r=r[0])}return u(),r}(t)),n),arguments,[])).length>1?n:n[0]}.bind(a);t.Component=v,t.batch=function(t){if(at>0)return t();at++;try{return t()}finally{ut()}},t.computed=St,t.createContext=function(t,n){var e={__c:n="__cC"+r++,__:t,Consumer:function(t,n){return t.children(n)},Provider:function(t){var e,_;return this.getChildContext||(e=[],(_={})[n]=this,this.getChildContext=function(){return _},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&e.some(m)},this.sub=function(t){e.push(t);var n=t.componentWillUnmount;t.componentWillUnmount=function(){e.splice(e.indexOf(t),1),n&&n.call(t)}}),t.children}};return e.Provider.__=e.Consumer.contextType=e},t.createRef=function(){return{current:null}},t.effect=Et,t.h=a,t.html=$t,t.render=function(t,_,i){var o,r,f;e.__&&e.__(t,_),r=(o="function"==typeof i)?null:i&&i.__k||_.__k,f=[],E(_,t=(!o&&i||_).__k=a(p,null,[t]),r||u,u,void 0!==_.ownerSVGElement,!o&&i?[i]:r?null:_.firstChild?n.call(_.childNodes):null,f,!o&&i?i:r?r.__e:_.firstChild,o),U(f,t)},t.signal=yt,t.useCallback=function(t,n){return F=8,Q(function(){return t},n)},t.useComputed=function(t){var n=K(t);return n.current=t,ft.__$f|=4,Q(function(){return St(function(){return n.current()})},[])},t.useContext=function(t){var n=A.context[t.__c],e=B($++,9);return e.c=t,n?(null==e.__&&(e.__=!0,n.sub(A)),n.props.value):t.__},t.useDebugValue=function(t,n){e.useDebugValue&&e.useDebugValue(n?n(t):t)},t.useEffect=function(t,n){var _=B($++,3);!e.__s&&et(_.__H,n)&&(_.__=t,_.i=n,A.__H.__h.push(_))},t.useErrorBoundary=function(t){var n=B($++,10),e=G();return n.__=t,A.componentDidCatch||(A.componentDidCatch=function(t,_){n.__&&n.__(t,_),e[1](t)}),[e[0],function(){e[1](void 0)}]},t.useImperativeHandle=function(t,n,e){F=6,J(function(){return"function"==typeof t?(t(n()),function(){return t(null)}):t?(t.current=n(),function(){return t.current=null}):void 0},null==e?e:e.concat(t))},t.useLayoutEffect=J,t.useMemo=Q,t.useReducer=z,t.useRef=K,t.useSignal=Tt,t.useState=G}); diff --git a/package.json b/package.json index 94d5afe..b68a654 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "preact-htm-signals-standalone", - "version": "0.0.6", + "version": "0.0.7", "description": "A single, standalone version of Preact, HTM and Preact Signals. No external dependencies, just one single file.", "type": "module", "main": "dist/standalone.js", @@ -36,7 +36,7 @@ "hyperscript" ], "devDependencies": { - "@preact/signals": "1.1.1", + "@preact/signals": "^1.1.2", "htm": "3.1.1", "microbundle": "^0.15.1", "preact": "10.11.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6733f6..a5ddbec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,13 +1,13 @@ lockfileVersion: 5.4 specifiers: - '@preact/signals': 1.1.1 + '@preact/signals': ^1.1.2 htm: 3.1.1 microbundle: ^0.15.1 preact: 10.11.0 devDependencies: - '@preact/signals': 1.1.1_preact@10.11.0 + '@preact/signals': 1.1.2_preact@10.11.0 htm: 3.1.1 microbundle: 0.15.1 preact: 10.11.0 @@ -1331,16 +1331,16 @@ packages: '@jridgewell/sourcemap-codec': 1.4.14 dev: true - /@preact/signals-core/1.2.1: - resolution: {integrity: sha512-aqzRMNFU1hoQyP4Kb1ldJrUTCnA9vqPDa7qHEQzHJ3upnBOcC2pjmvjAuTqGuY4AVTtUkCQV0FvOCuIQQ2hSdA==} + /@preact/signals-core/1.2.2: + resolution: {integrity: sha512-z3/bCj7rRA21RJb4FeJ4guCrD1CQbaURHkCTunUWQpxUMAFOPXCD8tSFqERyGrrcSb4T3Hrmdc1OAl0LXBHwiw==} dev: true - /@preact/signals/1.1.1_preact@10.11.0: - resolution: {integrity: sha512-I1DhYo2d1t9qDkEq1jYDVTQdBGmo4NlqatNEtulsS/87kVdwhZluP6TTDS4/5sc2h86TlBF6UA6LO+tDpIt/Gw==} + /@preact/signals/1.1.2_preact@10.11.0: + resolution: {integrity: sha512-MLNNrICSllHBhpXBvXbl7K5L1HmIjuTzgBw+zdODqjM/cLGPXdYiAWt4lqXlrxNavYdoU4eljb+TLE+DRL+6yw==} peerDependencies: preact: 10.x dependencies: - '@preact/signals-core': 1.2.1 + '@preact/signals-core': 1.2.2 preact: 10.11.0 dev: true