Socket
Socket
Sign inDemoInstall

rax

Package Overview
Dependencies
Maintainers
1
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rax - npm Package Compare versions

Comparing version 1.0.0-beta.9 to 1.0.0-beta.10

2

dist/rax.min.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).Rax={})}(this,function(t){"use strict";var U={mountID:1,component:null,isUpdating:!1,dirtyComponents:[],rootComponents:{},rootInstances:{},driver:null};function h(t,e,n,r,o){return{type:t,key:e,ref:n,props:r,_owner:o}}function d(t){if(null==t)return t;var e=[];return function t(e,n){if(Array.isArray(e))for(var r=0,o=e.length;r<o;r++)t(e[r],n);else n.push(e)}(t,e),1===e.length&&(e=e[0]),e}var f={key:!0,ref:!0};function l(t,e,n){if(null==t)throw Error("createElement: type should not be null or undefined."+function(){var t=U.component;if(t){var e=t.getName();if(e)return" Check the render method of `"+e+"`."}return""}());var r,o={},i=null,u=null,a=U.component;if(null!=e)for(r in u=void 0===e.ref?null:e.ref,i=void 0===e.key?null:String(e.key),"string"!=typeof u||a||console.warn("createElement: adding a string ref outside the component’s render() method."),e)f[r]||(o[r]=e[r]);var s=arguments.length-2;if(0<s)if(1!==s||Array.isArray(n)){var l=n;if(1<s){l=new Array(s);for(var c=0;c<s;c++)l[c]=arguments[c+2]}o.children=d(l)}else o.children=n;if(t&&t.defaultProps){var p=t.defaultProps;for(r in p)void 0===o[r]&&(o[r]=p[r])}return new h(t,i,u,o,a)}function u(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}var a=function(){function t(t,e,n){this.props=t,this.context=e,this.refs={},this.updater=n}var e=t.prototype;return e.isComponentClass=function(){},e.setState=function(t,e){this.updater.setState(this,t,e)},e.forceUpdate=function(t){this.updater.forceUpdate(this,t)},t}(),s=function(){function t(t){this.handlers=[],this.value=t}var e=t.prototype;return e.on=function(t){this.handlers.push(t)},e.off=function(e){this.handlers=this.handlers.filter(function(t){return t!==e})},e.emit=function(){var e=this;this.handlers.forEach(function(t){return t(e.value)})},t}(),c=0;var e,n=null,r="undefined"==typeof setImmediate?function(t){return setTimeout(t,0)}:setImmediate,o="undefined"==typeof clearImmediate?clearTimeout:clearImmediate,i=[];function p(){var t=i;i=[],t.forEach(function(t){return t()}),t=null,n()}var v=function(t){0===i.length&&(e=r(p)),i.push(t)};function _(){0!==i.length&&(o(e),p())}function m(){var t=U.component._instance;if(t)return t;throw Error("Hooks can only be called inside a component.")}function y(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=e[n];if((r!==o||0===r&&1/r!=1/o)&&(r==r||o==o))return!1}return!0}function C(t,e){g(t,e)}function g(t,e,o){var n=m(),i=n.getHookID(),u=n.getHooks();if(e=null!=e?e:[t],u[i]){var r=u[i],a=r.create,s=r.inputs;r.inputs=e,r.prevInputs=s,a.current=t}else{var l=function t(e){if(!e&&o)return v(function(){return t(!0)});var n=t.current;if(n){var r=U.isUpdating;U.isUpdating=!0,c.current=n(),t.current=null,U.isUpdating=r}},c=function t(e){if(!e&&o)return v(function(){return t(!0)});var n=t.current;if(n){var r=U.isUpdating;U.isUpdating=!0,n(),t.current=null,U.isUpdating=r}};l.current=t,u[i]={create:l,destory:c,prevInputs:e,inputs:e},n.didMount.push(l),n.willUnmount.push(c),n.didUpdate.push(function(){var t=u[i],e=t.prevInputs,n=t.inputs,r=t.create;null!=e&&y(n,e)||(c(),r())})}}function N(t,e){var n=m(),r=n.getHookID(),o=n.getHooks();if(o[r]){var i=o[r];y(e,i[1])||(i[0]=t())}else o[r]=[t(),e];return o[r][0]}var x=Object.prototype.hasOwnProperty;function I(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function w(t,e){if(I(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0;o<n.length;o++)if(!x.call(e,n[o])||!I(t[n[o]],e[n[o]]))return!1;return!0}var b=function(){function t(){this._currentElement=null}var e=t.prototype;return e.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n;var o={_internal:this},i=this.getNativeNode();return r?r(i,t):U.driver.appendChild(i,t),o},e.unmountComponent=function(t){this._nativeNode&&!t&&U.driver.removeChild(this._nativeNode,this._parent),this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null},e.updateComponent=function(){},e.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=U.driver.createEmpty()),this._nativeNode},t}(),E={update:function(t,e,n){var r=t&&t.ref||null,o=e&&e.ref||null;r!==o&&(null!=r&&this.detach(t._owner,r,n),null!=o&&this.attach(e._owner,o,n))},attach:function(t,e,n){if(!t)throw Error("Multiple version of Rax used in project.");var r=n.getPublicInstance();"function"==typeof e?e(r):"object"==typeof e?e.current=r:t._instance.refs[e]=r},detach:function(t,e,n){if("function"==typeof e)e(null);else{var r=n.getPublicInstance();"object"==typeof e&&e.current===r?e.current=null:t._instance.refs[e]===r&&delete t._instance.refs[e]}}};function D(t){var e;return null==t||!1===t||!0===t?e=new U.Empty:Array.isArray(t)?e=new U.Fragment(t):"object"==typeof t&&t.type?e="string"==typeof t.type?new U.Native(t):new U.Composite(t):"string"==typeof t||"number"==typeof t?e=new U.Text(t):k(t),e._mountIndex=0,e}function k(t){throw Error("Invalid element type: "+t+". (current: "+("object"==typeof t&&Object.keys(t)||typeof t)+")")}function S(t,e){var n=null===t,r=null===e;if(n||r)return n===r;var o=typeof t,i=typeof e;return"string"===o||"number"===o?"string"===i||"number"===i:"object"===o&&"object"===i&&t.type===e.type&&t.key===e.key}var A=function(t,e,n){var r=e&&e.key,o="."+n.toString(36);if("string"!=typeof r)return o;var i="$"+r,u=void 0===t[i];return u||console.warn('Encountered two children with the same key "'+r+'".'),u?i:o},P=1,R=function(e){function t(){var t;return(t=e.call(this)||this).state={element:[]},t.rootID=P++,t}u(t,e);var n=t.prototype;return n.getPublicInstance=function(){return this.getRenderedComponent().getPublicInstance()},n.getRenderedComponent=function(){return this._internal._renderedComponent},n.update=function(t){this.setState({element:t})},n.render=function(){return this.state.element},t}(a),O="__r",j={set:function(t,e){t[O]||(t[O]=e).rootID&&(U.rootInstances[e.rootID]=e,U.rootComponents[e.rootID]=e._internal)},get:function(t){return t[O]},remove:function(t){var e=this.get(t);e&&(t[O]=null,e.rootID&&(delete U.rootComponents[e.rootID],delete U.rootInstances[e.rootID]))},mount:function(t,e,n){var r,o=U.driver;if(o.beforeRender&&o.beforeRender(),null==e&&(e=o.createBody()),n){var i=n._internal;r=i._processChildContext(i._context)}var u=this.get(e);if(u&&u.rootID)return r&&(u._internal._penddingContext=r),u.update(t),u;var a=r||{},s=D(l(R)).mountComponent(e,null,a);return this.set(e,s),s.update(t),o.afterRender&&o.afterRender(s),s}},H="style",M="children",W="tree",F=/^on[A-Z]/,T=function(){function t(t){this._currentElement=t}var e=t.prototype;return e.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++;var o=this._currentElement.props,i={_internal:this,type:this._currentElement.type,props:o},u=o.append||W;this._instance=i,this._prevStyleCopy=Object.assign({},o.style);var a=this.getNativeNode();u!==W&&(r?r(a,t):U.driver.appendChild(a,t)),this._currentElement&&this._currentElement.ref&&E.attach(this._currentElement._owner,this._currentElement.ref,this);var s=o.children;return null!=s&&this.mountChildren(s,n),u===W&&(r?r(a,t):U.driver.appendChild(a,t)),i},e.mountChildren=function(t,o){var i=this;Array.isArray(t)||(t=[t]);var u=this._renderedChildren={},a=this.getNativeNode();return t.map(function(t,e){var n=D(t),r=A(u,t,e);return(u[r]=n)._mountIndex=e,n.mountComponent(a,i._instance,o)})},e.unmountChildren=function(t){var e=this._renderedChildren;if(e){for(var n in e){e[n].unmountComponent(t)}this._renderedChildren=null}},e.unmountComponent=function(t){if(this._nativeNode){var e=this._currentElement.ref;e&&E.detach(this._currentElement._owner,e,this),j.remove(this._nativeNode),t||U.driver.removeChild(this._nativeNode,this._parent)}this.unmountChildren(t),this._currentElement=null,this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null,this._instance=null,this._prevStyleCopy=null},e.updateComponent=function(t,e,n,r){this._currentElement=e,E.update(t,e,this);var o=t.props,i=e.props;this.updateProperties(o,i),this.updateChildren(i.children,r)},e.updateProperties=function(t,e){var n,r,o,i=U.driver,u=this.getNativeNode();for(n in t)if(n!==M&&!e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&null!=t[n])if(n===H){var a=this._prevStyleCopy;for(r in a)a.hasOwnProperty(r)&&((o=o||{})[r]="");this._prevStyleCopy=null}else F.test(n)?"function"==typeof t[n]&&i.removeEventListener(u,n.slice(2).toLowerCase(),t[n]):i.removeAttribute(u,n,t[n]);for(n in e){var s=e[n],l=n===H?this._prevStyleCopy:null!=t?t[n]:void 0;if(n!==M&&e.hasOwnProperty(n)&&s!==l&&(null!=s||null!=l))if(n===H)if(s?s=this._prevStyleCopy=Object.assign({},s):this._prevStyleCopy=null,null!=l){for(r in l)!l.hasOwnProperty(r)||s&&s.hasOwnProperty(r)||((o=o||{})[r]="");for(r in s)s.hasOwnProperty(r)&&l[r]!==s[r]&&((o=o||{})[r]=s[r])}else o=s;else if(F.test(n)){var c=n.slice(2).toLowerCase();"function"==typeof l&&i.removeEventListener(u,c,l,e),"function"==typeof s&&i.addEventListener(u,c,s,e)}else{null!=s?i.setAttribute(u,n,s):i.removeAttribute(u,n,t[n])}}o&&i.setStyles(u,o)},e.updateChildren=function(t,e){var n=this._renderedChildren,i=U.driver;if(null!=t||null!=n){var r,u,o,a={};if(null!=t){Array.isArray(t)||(t=[t]);for(var s=0,l=t.length;s<l;s++){var c=t[s],p=A(a,c,s),h=n&&n[p],d=h&&h._currentElement,f=h&&h._context;null!=h&&S(d,c)?(d===c&&f===e||h.updateComponent(d,c,e,e),a[p]=h):(h&&(h._unmount=!0),a[p]=D(c))}}if(null!=n)for(var v in n)if(n.hasOwnProperty(v)){var _=n[v],m=_._unmount||!a[v];r?m&&_.unmountComponent():(o=m,u=(r=_).getNativeNode(),Array.isArray(u)&&(u=u[0]))}if(null!=a){var y=function(t,e){if(Array.isArray(t)||(t=[t]),g)for(var n=t.length-1;0<=n;n--)i.insertAfter(t[n],g);else if(u)for(var r=0;r<t.length;r++)i.insertBefore(t[r],u);else if(e)for(var o=0;o<t.length;o++)i.appendChild(t[o],e)},C=0,g=null,N=[];for(var x in a)if(a.hasOwnProperty(x)){var I=a[x],w=n&&n[x];if(w===I){var b=w.getNativeNode();w._mountIndex!==C&&y(b)}else{var E=this.getNativeNode();Array.isArray(E)&&(E=this._parent),I.mountComponent(E,this._instance,e,y)}I._mountIndex=C++,g=I.getNativeNode(),N=N.concat(g),Array.isArray(g)&&(g=g[g.length-1])}if(Array.isArray(this._nativeNode)){this._nativeNode.splice(0,this._nativeNode.length);for(var k=0;k<N.length;k++)this._nativeNode.push(N[k])}}o&&r.unmountComponent(),this._renderedChildren=a}},e.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=U.driver.createElement(this._instance),j.set(this._nativeNode,this._instance)),this._nativeNode},e.getPublicInstance=function(){return this.getNativeNode()},e.getName=function(){return this._currentElement.type},t}(),L=function(){function t(t){this._currentElement=t,this._text=String(t)}var e=t.prototype;return e.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++;var o=this.getNativeNode();return r?r(o,t):U.driver.appendChild(o,t),{_internal:this}},e.unmountComponent=function(t){this._nativeNode&&!t&&U.driver.removeChild(this._nativeNode,this._parent),this._currentElement=null,this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null,this._text=null},e.updateComponent=function(t,e,n){t!==e&&(this._currentElement=e,this._text=String(e),U.driver.updateText(this.getNativeNode(),this._text))},e.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=U.driver.createText(this._text)),this._nativeNode},t}(),Q=function(n){function t(t,e){var r;(r=n.call(this)||this)._render=t,r._hookID=0,r._reRenders=0,r._hooks={},r.didMount=[],r.didUpdate=[],r.willUnmount=[],r.isScheduled=!1,t.forwardRef&&(r.prevForwardRef=r.forwardRef=e);var o=t.compares;return o&&(r.shouldComponentUpdate=function(t){for(var e=!0,n=o.length-1;-1<n&&!(e=o[n](r.props,t));n--);return!e||r.prevForwardRef!==r.forwardRef}),r}u(t,n);var e=t.prototype;return e.getHooks=function(){return this._hooks},e.getHookID=function(){return++this._hookID},e.readContext=function(t){var e=this,n=t.Provider,r=this._internal._context[n.contextProp];if(r){var o=this._internal._mountID;if(!r[o]){r[o]={};var i=function(t){t!==r[o].renderedContext&&e.update()};r.on(i),this.willUnmount.push(function(){delete r[o],r.off(i)})}return r[o].renderedContext=r.value}return n.defaultValue},e.componentDidMount=function(){this.didMount.forEach(function(t){return t()})},e.componentDidUpdate=function(){this.didUpdate.forEach(function(t){return t()})},e.componentWillUnmount=function(){this.willUnmount.forEach(function(t){return t()})},e.update=function(){this.forceUpdate()},e.render=function(){this._hookID=0,this._reRenders=0,this.isScheduled=!1;for(var t=this._render(this.props,this.forwardRef?this.forwardRef:this.context);this.isScheduled;){if(this._reRenders++,24<this._reRenders)throw Error("Too many re-renders, the number of renders is limited to prevent an infinite loop.");this._hookID=0,this.isScheduled=!1,t=this._render(this.props,this.forwardRef?this.forwardRef:this.context)}return t},t}(a);function B(t,e){if(t)for(var n=0;n<t.length;n++)t[n].call(e)}function V(t){var e=t._internal;if(e){U.isUpdating=!0;var n=e._pendingCallbacks;e._pendingCallbacks=null;var r=e._currentElement,o=e._context,i=e._penddingContext||o;e._penddingContext=void 0,(e._pendingStateQueue||e._pendingForceUpdate)&&e.updateComponent(r,r,o,i),B(n,t),U.isUpdating=!1}}function Z(t,e){return e._internal._mountID-t._internal._mountID}function $(){if(!U.isUpdating)for(var t,e;0<U.dirtyComponents.length;)for(_(),(t=U.dirtyComponents).sort(Z),U.dirtyComponents=[];e=t.pop();)V(e)}function q(t){var e=U.dirtyComponents;e.indexOf(t)<0&&e.push(t),$()}function z(t,e,n){var r=t._internal;if(r){var o,i;!U.isUpdating&&_(),n&&(i=n,((o=r)._pendingCallbacks||(o._pendingCallbacks=[])).push(i));var u,a,s=r._renderedComponent;e?(a=e,((u=r)._pendingStateQueue||(u._pendingStateQueue=[])).push(a),!r._pendingState&&s&&q(t)):(r._pendingForceUpdate=!0,s&&q(t))}}n=$;var G={setState:z,forceUpdate:function(t,e){z(t,null,e)},runCallbacks:B};function J(t,e,n){try{return t()}catch(t){n?n(t):K(e,t)}}function K(t,e){for(var n;t;){var r=t._internal;if("function"==typeof t.componentDidCatch){n=t;break}if(!r||!r._parentInstance)break;t=r._parentInstance}if(n){var o=n._internal;if(o)(o._pendingCallbacks||(o._pendingCallbacks=[])).push(function(){return n.componentDidCatch(e)})}else setTimeout(function(){throw e},0)}var X=function(){function t(t){this._currentElement=t}var e=t.prototype;return e.getName=function(){var t=this._currentElement.type,e=this._instance,n=e&&e.constructor;return t.displayName||n&&n.displayName||t.name||n&&n.name||null},e.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++,this._updateCount=0;var o,i,u=this._currentElement,a=u.type,s=u.ref,l=u.props,c=a.prototype,p=c&&a.prototype.isComponentClass,h=c&&a.prototype.render,d=this._processContext(n);try{p||h?o=new a(l,d,G):"function"==typeof a?o=new Q(a,s):k(a)}catch(t){return K(e,t),o}o.props=l,o.context=d,o.refs={},o.updater=G;var f=((o._internal=this)._instance=o).state;void 0===f&&(o.state=f=null);var v=null,_=function(t){v=t};o.componentWillMount&&J(function(){o.componentWillMount()},o,_),null==i&&(U.component=this,o.state=this._processPendingState(l,d),J(function(){i=o.render()},o,_),U.component=null),this._renderedComponent=D(i),this._renderedComponent.mountComponent(this._parent,o,this._processChildContext(n),r),v&&K(o,v),!u.type.forwardRef&&s&&E.attach(u._owner,s,this),o.componentDidMount&&J(function(){o.componentDidMount()},o);var m=this._pendingCallbacks;return m&&(this._pendingCallbacks=null,G.runCallbacks(m,o)),o},e.unmountComponent=function(t){var e=this._instance;if(e){if(e.componentWillUnmount&&J(function(){e.componentWillUnmount()},e),(e._internal=null)!=this._renderedComponent){var n=this._currentElement,r=n.ref;!n.type.forwardRef&&r&&E.detach(n._owner,r,this),this._renderedComponent.unmountComponent(t),this._renderedComponent=null,this._instance=null}this._currentElement=null,this._parentInstance=null,this._pendingStateQueue=null,this._pendingForceUpdate=!1,this._context=null}},e._processContext=function(t){var e=this._currentElement.type.contextTypes;if(!e)return{};var n={};for(var r in e)n[r]=t[r];return n},e._processChildContext=function(t){var e=this._instance,n=e.getChildContext&&e.getChildContext();return n?Object.assign({},t,n):t},e._processPendingState=function(t,e){var n=this._instance,r=this._pendingStateQueue;if(!r)return n.state;this._pendingStateQueue=null;for(var o=Object.assign({},n.state),i=0;i<r.length;i++){var u=r[i];Object.assign(o,"function"==typeof u?u.call(n,o,t,e):u)}return o},e.updateComponent=function(t,e,n,r){var o=this._instance;o||console.error("Update component '"+this.getName()+"' that has already been unmounted (or failed to mount).");var i,u,a=!1;this._context===r?i=o.context:(i=this._processContext(r),a=!0),t===e?u=e.props:(u=e.props,a=!0),a&&o.componentWillReceiveProps&&(this._pendingState=!0,J(function(){o.componentWillReceiveProps(u,i)},o),this._pendingState=!1),this._currentElement.type.forwardRef?(o.prevForwardRef=t.ref,o.forwardRef=e.ref):E.update(t,e,this);var s=!0,l=o.props,c=o.state,p=this._processPendingState(u,i);if(this._pendingForceUpdate||(o.shouldComponentUpdate?s=J(function(){return o.shouldComponentUpdate(u,p,i)},o):o.isPureComponentClass&&(s=!w(l,u)||!w(c,p))),s){this._pendingForceUpdate=!1;var h=o.context;J(function(){o.componentWillUpdate&&o.componentWillUpdate(u,p,i)},o),this._currentElement=e,this._context=r,o.props=u,o.state=p,o.context=i,this._updateRenderedComponent(r),J(function(){o.componentDidUpdate&&o.componentDidUpdate(l,c,h)},o),this._updateCount++}else this._currentElement=e,this._context=r,o.props=u,o.state=p,o.context=i;var d=this._pendingCallbacks;d&&(this._pendingCallbacks=null,G.runCallbacks(d,o))},e._updateRenderedComponent=function(t){var e,n=this._renderedComponent,r=n._currentElement,o=this._instance;if(U.component=this,J(function(){e=o.render()},o),U.component=null,S(r,e)){var i=n._context,u=this._processChildContext(t);r===e&&i===u||n.updateComponent(r,e,i,u)}else{var a=n.getNativeNode();n.unmountComponent(!0),this._renderedComponent=D(e),this._renderedComponent.mountComponent(this._parent,o,this._processChildContext(t),function(t,e){Array.isArray(t)||(t=[t]),Array.isArray(a)||(a=[a]);for(var n,r=U.driver,o=0;o<t.length;o++){var i=t[o];a[o]?r.replaceChild(i,a[o]):n?r.insertAfter(i,n):r.appendChild(i,e),n=i}if(t.length<a.length)for(var u=t.length;u<a.length;u++)r.removeChild(a[u])})}},e.getNativeNode=function(){var t=this._renderedComponent;if(t)return t.getNativeNode()},e.getPublicInstance=function(){var t=this._instance;return t instanceof Q?null:t},t}(),Y=function(e){function t(t){return e.call(this,t)||this}u(t,e);var n=t.prototype;return n.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++;var o={_internal:this};this._instance=o;var i=this.getNativeNode(),u=this._currentElement;if(this.mountChildren(u,n),r)r(i,t);else for(var a=0;a<i.length;a++){var s=i[a];U.driver.appendChild(s,t)}return o},n.mountChildren=function(t,o){var i=this,u=this._renderedChildren={},a=this.getNativeNode();return t.map(function(t,e){var n=D(t),r=A(u,t,e);return(u[r]=n)._mountIndex=e,n.mountComponent(i._parent,i._instance,o,function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)a.push(t[e]);else a.push(t)})})},n.unmountComponent=function(t){if(this._nativeNode&&(j.remove(this._nativeNode),!t))for(var e=0;e<this._nativeNode.length;e++)U.driver.removeChild(this._nativeNode[e]);this.unmountChildren(!0),this._currentElement=null,this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null,this._instance=null},n.updateComponent=function(t,e,n,r){this._currentElement=e,this.updateChildren(this._currentElement,r)},n.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=[]),this._nativeNode},n.getPublicInstance=function(){return this.getNativeNode()},n.getName=function(){return"fragment"},t}(T);var tt={Host:U,Instance:j,Element:h,flattenChildren:d};t.createElement=l,t.createRef=function(){return{current:null}},t.createContext=function(o){var t,e,i="__context_"+c+++"__",n=function(e){function t(){var t;return(t=e.call(this)||this).emitter=new s(o),t}u(t,e);var n=t.prototype;return n.getChildContext=function(){var t;return(t={})[i]=this.emitter,t},n.componentWillMount=function(){void 0!==this.props.value&&(this.emitter.value=this.props.value)},n.componentWillReceiveProps=function(t){this.props.value!==t.value&&(this.emitter.value=t.value)},n.componentDidUpdate=function(t){this.props.value!==t.value&&this.emitter.emit()},n.render=function(){return this.props.children},t}(a);n.childContextTypes=((t={})[i]=function(){},t),n.contextProp=i,n.defaultValue=o;var r=function(r){function t(t,e){var n;return(n=r.call(this,t,e)||this).state={value:n.readContext(n.context)},n.onUpdate=function(t){return n.state.value!==t&&n.setState({value:t})},n}u(t,r);var e=t.prototype;return e.readContext=function(t){return t[i]?t[i].value:o},e.componentDidMount=function(){this.context[i]&&this.context[i].on(this.onUpdate)},e.componentWillReceiveProps=function(t,e){var n=this.readContext(e);this.state.value!==n&&this.setState({value:n})},e.componentWillUnmount=function(){this.context[i]&&this.context[i].off(this.onUpdate)},e.render=function(){var t=this.props.children,e=Array.isArray(t)?t[0]:t;if("function"==typeof e)return e(this.state.value)},t}(a);return r.contextTypes=((e={})[i]=function(){},e),{Provider:n,Consumer:r}},t.useState=function(t){var n=m(),r=n.getHookID(),o=n.getHooks();o[r]||("function"==typeof t&&(t=t()),o[r]=[t,function(t){var e=o[r][0];"function"==typeof t&&(t=t(e)),t!==e&&(U.component&&U.component._instance===n?(o[r][0]=t,n.isScheduled=!0):(!U.isUpdating&&_(),o[r][0]=t,n.update()))}]);return o[r]},t.useContext=function(t){return m().readContext(t)},t.useEffect=function(t,e){g(t,e,!0)},t.useLayoutEffect=C,t.useRef=function(t){var e=m(),n=e.getHookID(),r=e.getHooks();return r[n]||(r[n]={current:t}),r[n]},t.useCallback=function(t,e){return N(function(){return t},e)},t.useMemo=N,t.useReducer=function(t,e,n){var r=m(),o=r.getHookID(),i=r.getHooks();if(!i[o])return n&&(e=t(e,n)),i[o]=[e,function(t){var e=i[o][2];U.component&&U.component._instance===r?(e.push(t),r.isScheduled=!0):(!U.isUpdating&&_(),e.push(t),r.update())},[]];for(var u=i[o],a=u[2],s=u[0],l=0;l<a.length;l++)s=t(s,a[l]);return u[0]=s,u[2]=[],i[o]},t.useImperativeHandle=function(t,e,n){C(function(){return"function"==typeof t?(t(e()),function(){return t(null)}):null!=t?(t.current=e(),function(){t.current=null}):void 0},null!=n?n.concat([t]):[t,e])},t.Fragment=function(t){return t.children},t.memo=function(t,e){return void 0===e&&(e=w),t.compares?t.compares.push(e):t.compares=[e],t},t.render=function(t,e,n,r){"function"==typeof n&&(r=n,n=null),function(t){var e=t.driver;if(t.measurer,U.Empty=b,U.Native=T,U.Text=L,U.Fragment=Y,U.Composite=X,U.driver=e||U.driver,!U.driver)throw Error("Driver not found.")}(n=n||{});var o=j.mount(t,e,n.parent).getPublicInstance();return r&&r.call(o),o},t.version="1.0.0-beta",t.shared=tt,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).Rax={})}(this,function(t){"use strict";var U={mountID:1,component:null,isUpdating:!1,rootComponents:{},rootInstances:{},driver:null};function h(t,e,n,r,o){return{type:t,key:e,ref:n,props:r,_owner:o}}function d(t){if(null==t)return t;var e=[];return function t(e,n){if(Array.isArray(e))for(var r=0,o=e.length;r<o;r++)t(e[r],n);else n.push(e)}(t,e),1===e.length&&(e=e[0]),e}var f={key:!0,ref:!0};function l(t,e,n){if(null==t)throw Error("createElement: type should not be null or undefined."+function(){var t=U.component;if(t){var e=t.getName();if(e)return" Check the render method of `"+e+"`."}return""}());var r,o={},i=null,u=null,a=U.component;if(null!=e)for(r in u=void 0===e.ref?null:e.ref,i=void 0===e.key?null:String(e.key),"string"!=typeof u||a||console.warn("createElement: adding a string ref outside the component’s render() method."),e)f[r]||(o[r]=e[r]);var s=arguments.length-2;if(0<s)if(1!==s||Array.isArray(n)){var l=n;if(1<s){l=new Array(s);for(var c=0;c<s;c++)l[c]=arguments[c+2]}o.children=d(l)}else o.children=n;if(t&&t.defaultProps){var p=t.defaultProps;for(r in p)void 0===o[r]&&(o[r]=p[r])}return new h(t,i,u,o,a)}function u(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}var a=function(){function t(t,e,n){this.props=t,this.context=e,this.refs={},this.updater=n}var e=t.prototype;return e.isComponentClass=function(){},e.setState=function(t,e){this.updater.setState(this,t,e)},e.forceUpdate=function(t){this.updater.forceUpdate(this,t)},t}(),s=function(){function t(t){this.handlers=[],this.value=t}var e=t.prototype;return e.on=function(t){this.handlers.push(t)},e.off=function(e){this.handlers=this.handlers.filter(function(t){return t!==e})},e.emit=function(){var e=this;this.handlers.forEach(function(t){return t(e.value)})},t}(),c=0;var e,n=null,r="undefined"==typeof setImmediate?function(t){return setTimeout(t,0)}:setImmediate,o="undefined"==typeof clearImmediate?clearTimeout:clearImmediate,i=[];function p(){var t=i;i=[],t.forEach(function(t){return t()}),t=null,n()}var v=function(t){0===i.length&&(e=r(p)),i.push(t)};function _(){0!==i.length&&(o(e),p())}function m(){var t=U.component._instance;if(t)return t;throw Error("Hooks can only be called inside a component.")}function y(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=e[n];if((r!==o||0===r&&1/r!=1/o)&&(r==r||o==o))return!1}return!0}function C(t,e){g(t,e)}function g(t,e,o){var n=m(),i=n.getHookID(),u=n.getHooks();if(e=null!=e?e:[t],u[i]){var r=u[i],a=r.create,s=r.inputs;r.inputs=e,r.prevInputs=s,a.current=t}else{var l=function t(e){if(!e&&o)return v(function(){return t(!0)});var n=t.current;if(n){var r=U.isUpdating;U.isUpdating=!0,c.current=n(),t.current=null,U.isUpdating=r}},c=function t(e){if(!e&&o)return v(function(){return t(!0)});var n=t.current;if(n){var r=U.isUpdating;U.isUpdating=!0,n(),t.current=null,U.isUpdating=r}};l.current=t,u[i]={create:l,destory:c,prevInputs:e,inputs:e},n.didMount.push(l),n.willUnmount.push(c),n.didUpdate.push(function(){var t=u[i],e=t.prevInputs,n=t.inputs,r=t.create;null!=e&&y(n,e)||(c(),r())})}}function N(t,e){var n=m(),r=n.getHookID(),o=n.getHooks();if(o[r]){var i=o[r];y(e,i[1])||(i[0]=t())}else o[r]=[t(),e];return o[r][0]}var x=Object.prototype.hasOwnProperty;function I(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function w(t,e){if(I(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=0;o<n.length;o++)if(!x.call(e,n[o])||!I(t[n[o]],e[n[o]]))return!1;return!0}var b=function(){function t(){this._currentElement=null}var e=t.prototype;return e.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n;var o={_internal:this},i=this.getNativeNode();return r?r(i,t):U.driver.appendChild(i,t),o},e.unmountComponent=function(t){this._nativeNode&&!t&&U.driver.removeChild(this._nativeNode,this._parent),this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null},e.updateComponent=function(){},e.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=U.driver.createEmpty()),this._nativeNode},t}(),E={update:function(t,e,n){var r=t&&t.ref||null,o=e&&e.ref||null;r!==o&&(null!=r&&this.detach(t._owner,r,n),null!=o&&this.attach(e._owner,o,n))},attach:function(t,e,n){if(!t)throw Error("Multiple version of Rax used in project.");var r=n.getPublicInstance();"function"==typeof e?e(r):"object"==typeof e?e.current=r:t._instance.refs[e]=r},detach:function(t,e,n){if("function"==typeof e)e(null);else{var r=n.getPublicInstance();"object"==typeof e&&e.current===r?e.current=null:t._instance.refs[e]===r&&delete t._instance.refs[e]}}};function D(t){var e;return null==t||!1===t||!0===t?e=new U.Empty:Array.isArray(t)?e=new U.Fragment(t):"object"==typeof t&&t.type?e="string"==typeof t.type?new U.Native(t):new U.Composite(t):"string"==typeof t||"number"==typeof t?e=new U.Text(t):k(t),e._mountIndex=0,e}function k(t){throw Error("Invalid element type: "+t+". (current: "+("object"==typeof t&&Object.keys(t)||typeof t)+")")}function S(t,e){var n=null===t,r=null===e;if(n||r)return n===r;var o=typeof t,i=typeof e;return"string"===o||"number"===o?"string"===i||"number"===i:"object"===o&&"object"===i&&t.type===e.type&&t.key===e.key}var A=function(t,e,n){var r=e&&e.key,o="."+n.toString(36);if("string"!=typeof r)return o;var i="$"+r,u=void 0===t[i];return u||console.warn('Encountered two children with the same key "'+r+'".'),u?i:o},P=1,R=function(e){function t(){var t;return(t=e.call(this)||this).state={element:[]},t.rootID=P++,t}u(t,e);var n=t.prototype;return n.getPublicInstance=function(){return this.getRenderedComponent().getPublicInstance()},n.getRenderedComponent=function(){return this._internal._renderedComponent},n.update=function(t){this.setState({element:t})},n.render=function(){return this.state.element},t}(a),O="__r",j={set:function(t,e){t[O]||(t[O]=e).rootID&&(U.rootInstances[e.rootID]=e,U.rootComponents[e.rootID]=e._internal)},get:function(t){return t[O]},remove:function(t){var e=this.get(t);e&&(t[O]=null,e.rootID&&(delete U.rootComponents[e.rootID],delete U.rootInstances[e.rootID]))},mount:function(t,e,n){var r,o=U.driver;if(o.beforeRender&&o.beforeRender(),null==e&&(e=o.createBody()),n){var i=n._internal;r=i._processChildContext(i._context)}var u=this.get(e);if(u&&u.rootID)return r&&(u._internal._penddingContext=r),u.update(t),u;var a=r||{},s=D(l(R)).mountComponent(e,null,a);return this.set(e,s),s.update(t),o.afterRender&&o.afterRender(s),s}},H="style",M="children",W="tree",F=/^on[A-Z]/,T=function(){function t(t){this._currentElement=t}var e=t.prototype;return e.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++;var o=this._currentElement.props,i={_internal:this,type:this._currentElement.type,props:o},u=o.append||W;this._instance=i,this._prevStyleCopy=Object.assign({},o.style);var a=this.getNativeNode();u!==W&&(r?r(a,t):U.driver.appendChild(a,t)),this._currentElement&&this._currentElement.ref&&E.attach(this._currentElement._owner,this._currentElement.ref,this);var s=o.children;return null!=s&&this.mountChildren(s,n),u===W&&(r?r(a,t):U.driver.appendChild(a,t)),i},e.mountChildren=function(t,o){var i=this;Array.isArray(t)||(t=[t]);var u=this._renderedChildren={},a=this.getNativeNode();return t.map(function(t,e){var n=D(t),r=A(u,t,e);return(u[r]=n)._mountIndex=e,n.mountComponent(a,i._instance,o)})},e.unmountChildren=function(t){var e=this._renderedChildren;if(e){for(var n in e){e[n].unmountComponent(t)}this._renderedChildren=null}},e.unmountComponent=function(t){if(this._nativeNode){var e=this._currentElement.ref;e&&E.detach(this._currentElement._owner,e,this),j.remove(this._nativeNode),t||U.driver.removeChild(this._nativeNode,this._parent)}this.unmountChildren(t),this._currentElement=null,this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null,this._instance=null,this._prevStyleCopy=null},e.updateComponent=function(t,e,n,r){this._currentElement=e,E.update(t,e,this);var o=t.props,i=e.props;this.updateProperties(o,i),this.updateChildren(i.children,r)},e.updateProperties=function(t,e){var n,r,o,i=U.driver,u=this.getNativeNode();for(n in t)if(n!==M&&!e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&null!=t[n])if(n===H){var a=this._prevStyleCopy;for(r in a)a.hasOwnProperty(r)&&((o=o||{})[r]="");this._prevStyleCopy=null}else F.test(n)?"function"==typeof t[n]&&i.removeEventListener(u,n.slice(2).toLowerCase(),t[n]):i.removeAttribute(u,n,t[n]);for(n in e){var s=e[n],l=n===H?this._prevStyleCopy:null!=t?t[n]:void 0;if(n!==M&&e.hasOwnProperty(n)&&s!==l&&(null!=s||null!=l))if(n===H)if(s?s=this._prevStyleCopy=Object.assign({},s):this._prevStyleCopy=null,null!=l){for(r in l)!l.hasOwnProperty(r)||s&&s.hasOwnProperty(r)||((o=o||{})[r]="");for(r in s)s.hasOwnProperty(r)&&l[r]!==s[r]&&((o=o||{})[r]=s[r])}else o=s;else if(F.test(n)){var c=n.slice(2).toLowerCase();"function"==typeof l&&i.removeEventListener(u,c,l,e),"function"==typeof s&&i.addEventListener(u,c,s,e)}else{null!=s?i.setAttribute(u,n,s):i.removeAttribute(u,n,t[n])}}o&&i.setStyles(u,o)},e.updateChildren=function(t,e){var n=this._renderedChildren,i=U.driver;if(null!=t||null!=n){var r,u,o,a={};if(null!=t){Array.isArray(t)||(t=[t]);for(var s=0,l=t.length;s<l;s++){var c=t[s],p=A(a,c,s),h=n&&n[p],d=h&&h._currentElement,f=h&&h._context;null!=h&&S(d,c)?(d===c&&f===e||h.updateComponent(d,c,e,e),a[p]=h):(h&&(h._unmount=!0),a[p]=D(c))}}if(null!=n)for(var v in n)if(n.hasOwnProperty(v)){var _=n[v],m=_._unmount||!a[v];r?m&&_.unmountComponent():(o=m,u=(r=_).getNativeNode(),Array.isArray(u)&&(u=u[0]))}if(null!=a){var y=function(t,e){if(Array.isArray(t)||(t=[t]),g)for(var n=t.length-1;0<=n;n--)i.insertAfter(t[n],g);else if(u)for(var r=0;r<t.length;r++)i.insertBefore(t[r],u);else if(e)for(var o=0;o<t.length;o++)i.appendChild(t[o],e)},C=0,g=null,N=[];for(var x in a)if(a.hasOwnProperty(x)){var I=a[x],w=n&&n[x];if(w===I){var b=w.getNativeNode();w._mountIndex!==C&&y(b)}else{var E=this.getNativeNode();Array.isArray(E)&&(E=this._parent),I.mountComponent(E,this._instance,e,y)}I._mountIndex=C++,g=I.getNativeNode(),N=N.concat(g),Array.isArray(g)&&(g=g[g.length-1])}if(Array.isArray(this._nativeNode)){this._nativeNode.splice(0,this._nativeNode.length);for(var k=0;k<N.length;k++)this._nativeNode.push(N[k])}}o&&r.unmountComponent(),this._renderedChildren=a}},e.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=U.driver.createElement(this._instance),j.set(this._nativeNode,this._instance)),this._nativeNode},e.getPublicInstance=function(){return this.getNativeNode()},e.getName=function(){return this._currentElement.type},t}(),L=function(){function t(t){this._currentElement=t,this._text=String(t)}var e=t.prototype;return e.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++;var o=this.getNativeNode();return r?r(o,t):U.driver.appendChild(o,t),{_internal:this}},e.unmountComponent=function(t){this._nativeNode&&!t&&U.driver.removeChild(this._nativeNode,this._parent),this._currentElement=null,this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null,this._text=null},e.updateComponent=function(t,e,n){t!==e&&(this._currentElement=e,this._text=String(e),U.driver.updateText(this.getNativeNode(),this._text))},e.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=U.driver.createText(this._text)),this._nativeNode},t}(),Q=function(n){function t(t,e){var r;(r=n.call(this)||this)._render=t,r._hookID=0,r._reRenders=0,r._hooks={},r.didMount=[],r.didUpdate=[],r.willUnmount=[],r.isScheduled=!1,t.forwardRef&&(r.prevForwardRef=r.forwardRef=e);var o=t.compares;return o&&(r.shouldComponentUpdate=function(t){for(var e=!0,n=o.length-1;-1<n&&!(e=o[n](r.props,t));n--);return!e||r.prevForwardRef!==r.forwardRef}),r}u(t,n);var e=t.prototype;return e.getHooks=function(){return this._hooks},e.getHookID=function(){return++this._hookID},e.readContext=function(t){var e=this,n=t.Provider,r=this._internal._context[n.contextProp];if(r){var o=this._internal._mountID;if(!r[o]){r[o]={};var i=function(t){t!==r[o].renderedContext&&e.update()};r.on(i),this.willUnmount.push(function(){delete r[o],r.off(i)})}return r[o].renderedContext=r.value}return n.defaultValue},e.componentDidMount=function(){this.didMount.forEach(function(t){return t()})},e.componentDidUpdate=function(){this.didUpdate.forEach(function(t){return t()})},e.componentWillUnmount=function(){this.willUnmount.forEach(function(t){return t()})},e.update=function(){this.forceUpdate()},e.render=function(){this._hookID=0,this._reRenders=0,this.isScheduled=!1;for(var t=this._render(this.props,this.forwardRef?this.forwardRef:this.context);this.isScheduled;){if(this._reRenders++,24<this._reRenders)throw Error("Too many re-renders, the number of renders is limited to prevent an infinite loop.");this._hookID=0,this.isScheduled=!1,t=this._render(this.props,this.forwardRef?this.forwardRef:this.context)}return t},t}(a),B=[];function V(t,e){if(t)for(var n=0;n<t.length;n++)t[n].call(e)}function Z(t){var e=t._internal;if(e){U.isUpdating=!0;var n=e._pendingCallbacks;e._pendingCallbacks=null;var r=e._currentElement,o=e._context,i=e._penddingContext||o;e._penddingContext=void 0,(e._pendingStateQueue||e._pendingForceUpdate)&&e.updateComponent(r,r,o,i),V(n,t),U.isUpdating=!1}}function $(t,e){return e._internal._mountID-t._internal._mountID}function q(){if(!U.isUpdating)for(var t,e;0<B.length;)for(_(),t=B.sort($),B=[];e=t.pop();)Z(e)}function z(t){B.indexOf(t)<0&&B.push(t),q()}function G(t,e,n){var r=t._internal;if(r){var o,i;!U.isUpdating&&_(),n&&(i=n,((o=r)._pendingCallbacks||(o._pendingCallbacks=[])).push(i));var u,a,s=r._renderedComponent;e?(a=e,((u=r)._pendingStateQueue||(u._pendingStateQueue=[])).push(a),!r._pendingState&&s&&z(t)):(r._pendingForceUpdate=!0,s&&z(t))}}n=q;var J={setState:G,forceUpdate:function(t,e){G(t,null,e)},runCallbacks:V};function K(t,e,n){try{return t()}catch(t){n?n(t):X(e,t)}}function X(t,e){for(var n;t;){var r=t._internal;if("function"==typeof t.componentDidCatch){n=t;break}if(!r||!r._parentInstance)break;t=r._parentInstance}if(n){var o=n._internal;if(o)(o._pendingCallbacks||(o._pendingCallbacks=[])).push(function(){return n.componentDidCatch(e)})}else setTimeout(function(){throw e},0)}var Y=function(){function t(t){this._currentElement=t}var e=t.prototype;return e.getName=function(){var t=this._currentElement.type,e=this._instance,n=e&&e.constructor;return t.displayName||n&&n.displayName||t.name||n&&n.name||null},e.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++,this._updateCount=0;var o,i,u=this._currentElement,a=u.type,s=u.ref,l=u.props,c=a.prototype,p=c&&a.prototype.isComponentClass,h=c&&a.prototype.render,d=this._processContext(n);try{p||h?o=new a(l,d,J):"function"==typeof a?o=new Q(a,s):k(a)}catch(t){return X(e,t),o}o.props=l,o.context=d,o.refs={},o.updater=J;var f=((o._internal=this)._instance=o).state;void 0===f&&(o.state=f=null);var v=null,_=function(t){v=t};o.componentWillMount&&K(function(){o.componentWillMount()},o,_),null==i&&(U.component=this,o.state=this._processPendingState(l,d),K(function(){i=o.render()},o,_),U.component=null),this._renderedComponent=D(i),this._renderedComponent.mountComponent(this._parent,o,this._processChildContext(n),r),v&&X(o,v),!u.type.forwardRef&&s&&E.attach(u._owner,s,this),o.componentDidMount&&K(function(){o.componentDidMount()},o);var m=this._pendingCallbacks;return m&&(this._pendingCallbacks=null,J.runCallbacks(m,o)),o},e.unmountComponent=function(t){var e=this._instance;if(e){if(e.componentWillUnmount&&K(function(){e.componentWillUnmount()},e),(e._internal=null)!=this._renderedComponent){var n=this._currentElement,r=n.ref;!n.type.forwardRef&&r&&E.detach(n._owner,r,this),this._renderedComponent.unmountComponent(t),this._renderedComponent=null,this._instance=null}this._currentElement=null,this._parentInstance=null,this._pendingStateQueue=null,this._pendingForceUpdate=!1,this._context=null}},e._processContext=function(t){var e=this._currentElement.type.contextTypes;if(!e)return{};var n={};for(var r in e)n[r]=t[r];return n},e._processChildContext=function(t){var e=this._instance,n=e.getChildContext&&e.getChildContext();return n?Object.assign({},t,n):t},e._processPendingState=function(t,e){var n=this._instance,r=this._pendingStateQueue;if(!r)return n.state;this._pendingStateQueue=null;for(var o=Object.assign({},n.state),i=0;i<r.length;i++){var u=r[i];Object.assign(o,"function"==typeof u?u.call(n,o,t,e):u)}return o},e.updateComponent=function(t,e,n,r){var o=this._instance;o||console.error("Update component '"+this.getName()+"' that has already been unmounted (or failed to mount).");var i,u,a=!1;this._context===r?i=o.context:(i=this._processContext(r),a=!0),t===e?u=e.props:(u=e.props,a=!0),a&&o.componentWillReceiveProps&&(this._pendingState=!0,K(function(){o.componentWillReceiveProps(u,i)},o),this._pendingState=!1),this._currentElement.type.forwardRef?(o.prevForwardRef=t.ref,o.forwardRef=e.ref):E.update(t,e,this);var s=!0,l=o.props,c=o.state,p=this._processPendingState(u,i);if(this._pendingForceUpdate||(o.shouldComponentUpdate?s=K(function(){return o.shouldComponentUpdate(u,p,i)},o):o.isPureComponentClass&&(s=!w(l,u)||!w(c,p))),s){this._pendingForceUpdate=!1;var h=o.context;K(function(){o.componentWillUpdate&&o.componentWillUpdate(u,p,i)},o),this._currentElement=e,this._context=r,o.props=u,o.state=p,o.context=i,this._updateRenderedComponent(r),K(function(){o.componentDidUpdate&&o.componentDidUpdate(l,c,h)},o),this._updateCount++}else this._currentElement=e,this._context=r,o.props=u,o.state=p,o.context=i;var d=this._pendingCallbacks;d&&(this._pendingCallbacks=null,J.runCallbacks(d,o))},e._updateRenderedComponent=function(t){var e,n=this._renderedComponent,r=n._currentElement,o=this._instance;if(U.component=this,K(function(){e=o.render()},o),U.component=null,S(r,e)){var i=n._context,u=this._processChildContext(t);r===e&&i===u||n.updateComponent(r,e,i,u)}else{var a=n.getNativeNode();n.unmountComponent(!0),this._renderedComponent=D(e),this._renderedComponent.mountComponent(this._parent,o,this._processChildContext(t),function(t,e){Array.isArray(t)||(t=[t]),Array.isArray(a)||(a=[a]);for(var n,r=U.driver,o=0;o<t.length;o++){var i=t[o];a[o]?r.replaceChild(i,a[o]):n?r.insertAfter(i,n):r.appendChild(i,e),n=i}if(t.length<a.length)for(var u=t.length;u<a.length;u++)r.removeChild(a[u])})}},e.getNativeNode=function(){var t=this._renderedComponent;if(t)return t.getNativeNode()},e.getPublicInstance=function(){var t=this._instance;return t instanceof Q?null:t},t}(),tt=function(e){function t(t){return e.call(this,t)||this}u(t,e);var n=t.prototype;return n.mountComponent=function(t,e,n,r){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++;var o={_internal:this};this._instance=o;var i=this.getNativeNode(),u=this._currentElement;if(this.mountChildren(u,n),r)r(i,t);else for(var a=0;a<i.length;a++){var s=i[a];U.driver.appendChild(s,t)}return o},n.mountChildren=function(t,o){var i=this,u=this._renderedChildren={},a=this.getNativeNode();return t.map(function(t,e){var n=D(t),r=A(u,t,e);return(u[r]=n)._mountIndex=e,n.mountComponent(i._parent,i._instance,o,function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)a.push(t[e]);else a.push(t)})})},n.unmountComponent=function(t){if(this._nativeNode&&(j.remove(this._nativeNode),!t))for(var e=0;e<this._nativeNode.length;e++)U.driver.removeChild(this._nativeNode[e]);this.unmountChildren(!0),this._currentElement=null,this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null,this._instance=null},n.updateComponent=function(t,e,n,r){this._currentElement=e,this.updateChildren(this._currentElement,r)},n.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=[]),this._nativeNode},n.getPublicInstance=function(){return this.getNativeNode()},n.getName=function(){return"fragment"},t}(T);var et={Host:U,Instance:j,Element:h,flattenChildren:d};t.createElement=l,t.createRef=function(){return{current:null}},t.createContext=function(o){var t,e,i="__context_"+c+++"__",n=function(e){function t(){var t;return(t=e.call(this)||this).emitter=new s(o),t}u(t,e);var n=t.prototype;return n.getChildContext=function(){var t;return(t={})[i]=this.emitter,t},n.componentWillMount=function(){void 0!==this.props.value&&(this.emitter.value=this.props.value)},n.componentWillReceiveProps=function(t){this.props.value!==t.value&&(this.emitter.value=t.value)},n.componentDidUpdate=function(t){this.props.value!==t.value&&this.emitter.emit()},n.render=function(){return this.props.children},t}(a);n.childContextTypes=((t={})[i]=function(){},t),n.contextProp=i,n.defaultValue=o;var r=function(r){function t(t,e){var n;return(n=r.call(this,t,e)||this).state={value:n.readContext(n.context)},n.onUpdate=function(t){return n.state.value!==t&&n.setState({value:t})},n}u(t,r);var e=t.prototype;return e.readContext=function(t){return t[i]?t[i].value:o},e.componentDidMount=function(){this.context[i]&&this.context[i].on(this.onUpdate)},e.componentWillReceiveProps=function(t,e){var n=this.readContext(e);this.state.value!==n&&this.setState({value:n})},e.componentWillUnmount=function(){this.context[i]&&this.context[i].off(this.onUpdate)},e.render=function(){var t=this.props.children,e=Array.isArray(t)?t[0]:t;if("function"==typeof e)return e(this.state.value)},t}(a);return r.contextTypes=((e={})[i]=function(){},e),{Provider:n,Consumer:r}},t.useState=function(t){var n=m(),r=n.getHookID(),o=n.getHooks();o[r]||("function"==typeof t&&(t=t()),o[r]=[t,function(t){var e=o[r][0];"function"==typeof t&&(t=t(e)),t!==e&&(U.component&&U.component._instance===n?(o[r][0]=t,n.isScheduled=!0):(!U.isUpdating&&_(),o[r][0]=t,n.update()))}]);return o[r]},t.useContext=function(t){return m().readContext(t)},t.useEffect=function(t,e){g(t,e,!0)},t.useLayoutEffect=C,t.useRef=function(t){var e=m(),n=e.getHookID(),r=e.getHooks();return r[n]||(r[n]={current:t}),r[n]},t.useCallback=function(t,e){return N(function(){return t},e)},t.useMemo=N,t.useReducer=function(t,e,n){var r=m(),o=r.getHookID(),i=r.getHooks();if(!i[o])return n&&(e=t(e,n)),i[o]=[e,function(t){var e=i[o][2];U.component&&U.component._instance===r?(e.push(t),r.isScheduled=!0):(!U.isUpdating&&_(),e.push(t),r.update())},[]];for(var u=i[o],a=u[2],s=u[0],l=0;l<a.length;l++)s=t(s,a[l]);return u[0]=s,u[2]=[],i[o]},t.useImperativeHandle=function(t,e,n){C(function(){return"function"==typeof t?(t(e()),function(){return t(null)}):null!=t?(t.current=e(),function(){t.current=null}):void 0},null!=n?n.concat([t]):[t,e])},t.Fragment=function(t){return t.children},t.memo=function(t,e){return void 0===e&&(e=w),t.compares?t.compares.push(e):t.compares=[e],t},t.render=function(t,e,n,r){"function"==typeof n&&(r=n,n=null),function(t){var e=t.driver;if(t.measurer,U.Empty=b,U.Native=T,U.Text=L,U.Fragment=tt,U.Composite=Y,U.driver=e||U.driver,!U.driver)throw Error("Driver not found.")}(n=n||{});var o=j.mount(t,e,n.parent).getPublicInstance();return r&&r.call(o),o},t.version="1.0.0-beta",t.shared=et,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=rax.min.js.map

@@ -13,3 +13,2 @@ "use strict";

isUpdating: false,
dirtyComponents: [],
// Roots

@@ -16,0 +15,0 @@ rootComponents: {},

@@ -12,2 +12,5 @@ "use strict";

// Dirty components store
var dirtyComponents = [];
function enqueueCallback(internal, callback) {

@@ -66,19 +69,17 @@ var callbackQueue = internal._pendingCallbacks || (internal._pendingCallbacks = []);

var dirtyComponents;
var dirties;
var component;
while (_host.default.dirtyComponents.length > 0) {
while (dirtyComponents.length > 0) {
// Before next render, we will flush all the PassiveEffects
(0, _scheduler.flush)(); // Stash the dirtyComponents first
dirtyComponents = _host.default.dirtyComponents; // Since reconciling a component higher in the owner hierarchy usually (not
(0, _scheduler.flush)(); // Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
// them before their children by sorting the array.
dirtyComponents.sort(mountOrderComparator); // Reset Host.dirtyComponents, using to collect dirtyComponent
dirties = dirtyComponents.sort(mountOrderComparator); // Reset dirtyComponents, using to collect dirtyComponent
// generated by the next render
_host.default.dirtyComponents = [];
dirtyComponents = [];
while (component = dirtyComponents.pop()) {
while (component = dirties.pop()) {
runUpdate(component);

@@ -90,4 +91,2 @@ }

function scheduleUpdate(component) {
var dirtyComponents = _host.default.dirtyComponents;
if (dirtyComponents.indexOf(component) < 0) {

@@ -94,0 +93,0 @@ dirtyComponents.push(component);

{
"name": "rax",
"version": "1.0.0-beta.9",
"version": "1.0.0-beta.10",
"description": "A universal React-compatible render engine.",

@@ -5,0 +5,0 @@ "license": "BSD-3-Clause",

@@ -8,3 +8,2 @@ /*

isUpdating: false,
dirtyComponents: [],
// Roots

@@ -11,0 +10,0 @@ rootComponents: {},

import Host from './host';
import { flush, setUpdater } from './scheduler';
// Dirty components store
let dirtyComponents = [];
function enqueueCallback(internal, callback) {

@@ -68,17 +71,16 @@ let callbackQueue =

let dirtyComponents;
let dirties;
let component;
while (Host.dirtyComponents.length > 0) {
while (dirtyComponents.length > 0) {
// Before next render, we will flush all the PassiveEffects
flush();
// Stash the dirtyComponents first
dirtyComponents = Host.dirtyComponents;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
// them before their children by sorting the array.
dirtyComponents.sort(mountOrderComparator);
// Reset Host.dirtyComponents, using to collect dirtyComponent
dirties = dirtyComponents.sort(mountOrderComparator);
// Reset dirtyComponents, using to collect dirtyComponent
// generated by the next render
Host.dirtyComponents = [];
while (component = dirtyComponents.pop()) {
dirtyComponents = [];
while (component = dirties.pop()) {
runUpdate(component);

@@ -90,3 +92,2 @@ }

function scheduleUpdate(component) {
const dirtyComponents = Host.dirtyComponents;
if (dirtyComponents.indexOf(component) < 0) {

@@ -138,3 +139,2 @@ dirtyComponents.push(component);

},
runCallbacks: runCallbacks

@@ -141,0 +141,0 @@ };

Sorry, the diff of this file is too big to display

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc