Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.14 to 1.0.0-beta.15

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,owner:null,isUpdating:!1,rootComponents:{},rootInstances:{},driver:null};function p(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 h={key:!0,ref:!0};function f(t,e,n){if(null==t)throw Error("createElement: type should not be null or undefined."+function(){var t=U.owner;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.owner;if(null!=e)for(r in i=void 0===e.key?null:e.key+"","string"!=typeof(u=void 0===e.ref?null:e.ref)||a||console.warn("createElement: adding a string ref outside the component’s render() method."),e)h[r]||(o[r]=e[r]);var s=arguments.length-2;if(0<s)if(1!==s||Array.isArray(n)){var c=n;if(1<s){c=Array(s);for(var l=0;l<s;l++)c[l]=arguments[l+2]}o.children=d(c)}else o.children=n;if(t&&t.defaultProps){var f=t.defaultProps;for(r in f)void 0===o[r]&&(o[r]=f[r])}return new p(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){this.props=t,this.context=e,this.refs={}}var e=t.prototype;return 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 l(){var t=i;i=[],t.forEach(function(t){return t()}),t=null,n()}var v=function(t){0===i.length&&(e=r(l)),i.push(t)};function m(){0!==i.length&&(o(e),l())}var _=Object.prototype.hasOwnProperty;function C(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function y(t,e){if(C(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(var r=0;r<n.length;r++)if(!_.call(e,n[r])||!C(t[n[r]],e[n[r]]))return!1;return!0}function g(){var t=U.owner._instance;if(t)return t;throw Error("Hooks can only be called inside a component.")}function N(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!C(t[n],e[n]))return!1;return!0}function w(t,e){x(t,e)}function x(t,e,o){var n=g(),r=n.getHookID(),i=n.getHooks();if(e=null!=e?e:[t],i[r]){var u=i[r],a=u.create,s=u.inputs;u.inputs=e,u.prevInputs=s,a.current=t}else{var 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,l.current=n(),t.current=null,U.isUpdating=r}},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,n(),t.current=null,U.isUpdating=r}};c.current=t,i[r]={create:c,destory:l,prevInputs:e,inputs:e},n.didMount.push(c),n.willUnmount.push(l),n.didUpdate.push(function(){var t=i[r],e=t.prevInputs,n=t.create;null!=e&&N(t.inputs,e)||(l(),n())})}}function b(t,e){var n=g(),r=n.getHookID(),o=n.getHooks();if(o[r]){var i=o[r];N(e,i[1])||(i[0]=t())}else o[r]=[t(),e];return o[r][0]}var I=function(){function t(t){this._currentElement=t}var e=t.prototype;return e.initComponent=function(t,e,n){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++},e.destoryComponent=function(){this._currentElement=null,this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null,this._instance&&(this._instance._internal=null,this._instance=null)},e.mountComponent=function(t,e,n,r){return this.initComponent(t,e,n),this.mountNativeNode(r),{_internal:this}},e.unmountComponent=function(t){this._nativeNode&&!t&&U.driver.removeChild(this._nativeNode,this._parent),this.destoryComponent()},e.getName=function(){var t=this._currentElement,e=t&&t.type;return e&&e.displayName||e&&e.name||e||t},e.mountNativeNode=function(t){var e=this.getNativeNode(),n=this._parent;t?t(e,n):U.driver.appendChild(e,n)},e.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=this.createNativeNode()),this._nativeNode},e.getPublicInstance=function(){return this.getNativeNode()},t}(),E=function(t){function e(){return t.apply(this,arguments)||this}return u(e,t),e.prototype.createNativeNode=function(){return U.driver.createEmpty(this)},e}(I),k={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+""):R(t),e}function R(t){throw Error("Invalid element type: "+t+". (current: "+("object"==typeof t&&Object.keys(t)||typeof t)+")")}function P(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 S=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},A=1,j=function(e){function t(){var t;return(t=e.call(this)||this).state={element:[]},t.rootID=A++,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),H="__r",O={set:function(t,e){t[H]||(t[H]=e).rootID&&(U.rootInstances[e.rootID]=e,U.rootComponents[e.rootID]=e._internal)},get:function(t){return t[H]},remove:function(t){var e=this.get(t);e&&(t[H]=null,e.rootID&&(delete U.rootComponents[e.rootID],delete U.rootInstances[e.rootID]))},mount:function(t,e,n){var r=n.parent,o=n.hybrate,i=U.driver;null==e&&(e=i.createBody());var u,a={element:t,container:e,hybrate:o};if(i.beforeRender&&i.beforeRender(a),r){var s=r._internal;u=s._processChildContext(s._context)}var c=this.get(e);if(c&&c.rootID)return u&&(c._internal._penddingContext=u),c.update(t),c;var l=D(f(j)).mountComponent(e,null,u||{});return this.set(e,l),l.update(t),i.afterRender&&i.afterRender(a),l}};function M(t){return Array.isArray(t)||(t=[t]),t}var W="style",F="children",T=/^on[A-Z]/,L=function(t){function e(){return t.apply(this,arguments)||this}u(e,t);var n=e.prototype;return n.mountComponent=function(t,e,n,r){var o=this;this.initComponent(t,e,n);var i=this._currentElement,u=i.props,a=i.type,s=u.children,c=u.append||"tree";this._prevStyleCopy=Object.assign({},u.style);var l={_internal:this,type:a,props:u};this._instance=l;var f=function(){null!=s&&o.mountChildren(s,n)};return"tree"===c?(f(),this.mountNativeNode(r)):(this.mountNativeNode(r),f()),i&&i.ref&&k.attach(i._owner,i.ref,this),l},n.mountChildren=function(t,e){t=M(t);var n=this.getNativeNode();return this._mountChildren(n,t,e)},n._mountChildren=function(o,t,i,u){var a=this,s=this._renderedChildren={};return t.map(function(t,e){var n=D(t),r=S(s,t,e);return(s[r]=n)._mountIndex=e,n.mountComponent(o,a._instance,i,u)})},n.unmountChildren=function(t){var e=this._renderedChildren;if(e){for(var n in e){e[n].unmountComponent(t)}this._renderedChildren=null}},n.unmountComponent=function(t){if(this._nativeNode){var e=this._currentElement.ref;e&&k.detach(this._currentElement._owner,e,this),O.remove(this._nativeNode),t||U.driver.removeChild(this._nativeNode,this._parent)}this.unmountChildren(t),this._prevStyleCopy=null,this.destoryComponent()},n.updateComponent=function(t,e,n,r){k.update(t,this._currentElement=e,this);var o=e.props;this.updateProperties(t.props,o),this.updateChildren(o.children,r)},n.updateProperties=function(t,e){var n,r,o,i=U.driver,u=this.getNativeNode();for(n in t)if(n!==F&&null!=t[n]&&!e.hasOwnProperty(n))if(n===W){var a=this._prevStyleCopy;for(r in a)(o=o||{})[r]="";this._prevStyleCopy=null}else if(T.test(n)){var s=t[n];"function"==typeof s&&i.removeEventListener(u,n.slice(2).toLowerCase(),s)}else i.removeAttribute(u,n,t[n]);for(n in e){var c=e[n],l=n===W?this._prevStyleCopy:null!=t?t[n]:void 0;if(n!==F&&l!==c&&(null!=c||null!=l))if(n===W)if(c?c=this._prevStyleCopy=Object.assign({},c):this._prevStyleCopy=null,null!=l){for(r in l)c&&c[r]||((o=o||{})[r]="");for(r in c)l[r]!==c[r]&&((o=o||{})[r]=c[r])}else o=c;else if(T.test(n)){var f=n.slice(2).toLowerCase();"function"==typeof l&&i.removeEventListener(u,f,l,e),"function"==typeof c&&i.addEventListener(u,f,c,e)}else null!=c?i.setAttribute(u,n,c):i.removeAttribute(u,n,t[n])}o&&i.setStyle(u,o)},n.updateChildren=function(t,e){var n=this._renderedChildren,i=U.driver;if(null!=t||null!=n){var r,u,o,a={};if(null!=t)for(var s=0,c=(t=M(t)).length;s<c;s++){var l=t[s],f=S(a,l,s),p=n&&n[f],d=p&&p._currentElement,h=p&&p._context;a[f]=null!=p&&P(d,l)?(d===l&&h===e||p.updateComponent(d,l,e,e),p):(p&&(p._unmount=!0),D(l))}if(null!=n)for(var v in n){var m=n[v],_=m._unmount||!a[v];r?_&&m.unmountComponent():(o=_,u=(r=m).getNativeNode(),Array.isArray(u)&&(u=u[0]))}if(null!=a){var C=function(t,e){if(t=M(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)},y=0,g=null,N=[];for(var w in a){var x=a[w],b=n&&n[w];if(b===x){var I=b.getNativeNode();b._mountIndex!==y&&C(I)}else{var E=this.getNativeNode();Array.isArray(E)&&(E=this._parent),x.mountComponent(E,this._instance,e,C)}x._mountIndex=y++,g=x.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}},n.createNativeNode=function(){var t=this._instance,e=U.driver.createElement(t.type,t.props,this);return O.set(e,t),e},e}(I),Q=function(t){function e(){return t.apply(this,arguments)||this}u(e,t);var n=e.prototype;return n.updateComponent=function(t,e){t!==(e+="")&&(this._currentElement=e,U.driver.updateText(this.getNativeNode(),this._currentElement))},n.createNativeNode=function(){return U.driver.createText(this._currentElement,this)},e}(I),B=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;n--)if(e=o[n](r.props,t))break;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;var t=this._render(this.props,this.forwardRef?this.forwardRef:this.context);while(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),V=[];function Z(t){return t._pendingCallbacks}function $(t,e){return t._pendingCallbacks=e}function q(t){return t._pendingStateQueue}function z(t,e){if(t)for(var n=0;n<t.length;n++)t[n].call(e)}function G(t){var e=t._internal;if(e){U.isUpdating=!0;var n=Z(e);$(e,null);var r=e._currentElement,o=e._context,i=e._penddingContext||o;e._penddingContext=void 0,(q(e)||e._isPendingForceUpdate)&&e.updateComponent(r,r,o,i),z(n,t),U.isUpdating=!1}}function J(t,e){return e._internal._mountID-t._internal._mountID}function K(){var t,e;if(!U.isUpdating)while(0<V.length){m(),t=V.sort(J),V=[];while(e=t.pop())G(e)}}function X(t){V.indexOf(t)<0&&V.push(t),K()}function Y(t,e,n){var r=t._internal;if(r){var o,i;!U.isUpdating&&m(),n&&(i=n,(Z(o=r)||$(o,[])).push(i));var u,a,s=r._renderedComponent;e?(a=e,(q(u=r)||(u._pendingStateQueue=[])).push(a),!r._isPendingState&&s&&X(t)):(r._isPendingForceUpdate=!0,s&&X(t))}}n=K;var tt={setState:Y,forceUpdate:function(t,e){Y(t,null,e)},runCallbacks:z};function et(t,e,n){try{return t()}catch(t){n?n(t):nt(e,t)}}function nt(t,e){var n;while(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 rt=function(t){function e(){return t.apply(this,arguments)||this}u(e,t);var n=e.prototype;return n.mountComponent=function(t,e,n,r){this.initComponent(t,e,n),this._updateCount=0;var o,i,u=this._currentElement,a=u.type,s=u.ref,c=u.props,l=a.prototype,f=this._processContext(n);try{l&&l.render?o=new a(c,f):"function"==typeof a?o=new B(a,s):R(a)}catch(t){return nt(e,t)}o.props=c,o.context=f,o.refs={},o.updater=tt;var p=((o._internal=this)._instance=o).state;void 0===p&&(o.state=p=null);var d=null,h=function(t){d=t};o.componentWillMount&&et(function(){o.componentWillMount()},o,h),null==i&&(o.state=(U.owner=this)._processPendingState(c,f),et(function(){i=o.render()},o,h),U.owner=null),this._renderedComponent=D(i),this._renderedComponent.mountComponent(this._parent,o,this._processChildContext(n),r),d&&nt(o,d),!u.type.forwardRef&&s&&k.attach(u._owner,s,this),o.componentDidMount&&et(function(){o.componentDidMount()},o);var v=this._pendingCallbacks;return v&&(this._pendingCallbacks=null,tt.runCallbacks(v,o)),o},n.unmountComponent=function(t){var e=this._instance;if(e&&e.componentWillUnmount&&et(function(){e.componentWillUnmount()},e),null!=this._renderedComponent){var n=this._currentElement,r=n.ref;!n.type.forwardRef&&r&&k.detach(n._owner,r,this),this._renderedComponent.unmountComponent(t),this._renderedComponent=null}this._pendingStateQueue=null,this._isPendingForceUpdate=!1,this.destoryComponent()},n._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},n._processChildContext=function(t){var e=this._instance,n=e.getChildContext&&e.getChildContext();return n?Object.assign({},t,n):t},n._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},n.updateComponent=function(t,e,n,r){var o=this._instance;if(o){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._isPendingState=!0,et(function(){o.componentWillReceiveProps(u,i)},o),this._isPendingState=!1),this._currentElement.type.forwardRef?(o.prevForwardRef=t.ref,o.forwardRef=e.ref):k.update(t,e,this);var s=!0,c=o.props,l=o.state,f=this._processPendingState(u,i);if(this._isPendingForceUpdate||(o.shouldComponentUpdate?s=et(function(){return o.shouldComponentUpdate(u,f,i)},o):o.isPureComponent&&(s=!y(c,u)||!y(l,f))),s){this._isPendingForceUpdate=!1;var p=o.context;et(function(){o.componentWillUpdate&&o.componentWillUpdate(u,f,i)},o),this._currentElement=e,this._context=r,o.props=u,o.state=f,o.context=i,this._updateRenderedComponent(r),et(function(){o.componentDidUpdate&&o.componentDidUpdate(c,l,p)},o),this._updateCount++}else this._currentElement=e,this._context=r,o.props=u,o.state=f,o.context=i;var d=this._pendingCallbacks;d&&(this._pendingCallbacks=null,tt.runCallbacks(d,o))}},n._updateRenderedComponent=function(t){var e,n=this._renderedComponent,r=n._currentElement,o=this._instance;if(U.owner=this,et(function(){e=o.render()},o),U.owner=null,P(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){a=M(a),t=M(t);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])})}},n.getNativeNode=function(){var t=this._renderedComponent;if(t)return t.getNativeNode()},n.getPublicInstance=function(){var t=this._instance;return t instanceof B?null:t},e}(I),ot=function(t){function e(){return t.apply(this,arguments)||this}u(e,t);var n=e.prototype;return n.mountComponent=function(t,e,n,r){this.initComponent(t,e,n);var o={_internal:this};this._instance=o,this.mountChildren(this._currentElement,n);var i=this.getNativeNode();if(r)r(i,t);else for(var u=0;u<i.length;u++)U.driver.appendChild(i[u],t);return o},n.mountChildren=function(t,e){var n=this.getNativeNode();return this._mountChildren(this._parent,t,e,function(t){t=M(t);for(var e=0;e<t.length;e++)n.push(t[e])})},n.unmountComponent=function(t){var e=this._nativeNode;if(e&&(O.remove(e),!t))for(var n=0;n<e.length;n++)U.driver.removeChild(e[n]);this.unmountChildren(!0),this.destoryComponent()},n.updateComponent=function(t,e,n,r){this._currentElement=e,this.updateChildren(this._currentElement,r)},n.createNativeNode=function(){return[]},n.getName=function(){return"fragment"},e}(L);var it={Host:U,Instance:O,Element:p,flattenChildren:d};t.createElement=f,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=g(),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.owner&&U.owner._instance===n?(o[r][0]=t,n.isScheduled=!0):(!U.isUpdating&&m(),o[r][0]=t,n.update()))}]);return o[r]},t.useContext=function(t){return g().readContext(t)},t.useEffect=function(t,e){x(t,e,!0)},t.useLayoutEffect=w,t.useRef=function(t){var e=g(),n=e.getHookID(),r=e.getHooks();return r[n]||(r[n]={current:t}),r[n]},t.useCallback=function(t,e){return b(function(){return t},e)},t.useMemo=b,t.useReducer=function(t,e,n){var r=g(),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.owner&&U.owner._instance===r?(e.push(t),r.isScheduled=!0):(!U.isUpdating&&m(),e.push(t),r.update())},[]];for(var u=i[o],a=u[2],s=u[0],c=0;c<a.length;c++)s=t(s,a[c]);return u[0]=s,u[2]=[],i[o]},t.useImperativeHandle=function(t,e,n){w(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=y),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(U.Empty=E,U.Native=L,U.Text=Q,U.Fragment=ot,U.Composite=rt,U.driver=e||U.driver,!U.driver)throw Error("Driver not found.")}(n=n||{});var o=O.mount(t,e,n).getPublicInstance();return r&&r.call(o),o},t.version="1.0.0-beta",t.shared=it,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,owner:null,isUpdating:!1,rootComponents:{},rootInstances:{},driver:null};function p(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 h={key:!0,ref:!0};function f(t,e,n){if(null==t)throw Error("createElement: type should not be null or undefined."+function(){var t=U.owner;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.owner;if(null!=e)for(r in i=void 0===e.key?null:e.key+"","string"!=typeof(u=void 0===e.ref?null:e.ref)||a||console.warn("createElement: adding a string ref outside the component’s render() method."),e)h[r]||(o[r]=e[r]);var s=arguments.length-2;if(0<s)if(1!==s||Array.isArray(n)){var c=n;if(1<s){c=Array(s);for(var l=0;l<s;l++)c[l]=arguments[l+2]}o.children=d(c)}else o.children=n;if(t&&t.defaultProps){var f=t.defaultProps;for(r in f)void 0===o[r]&&(o[r]=f[r])}return new p(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){this.props=t,this.context=e,this.refs={}}var e=t.prototype;return 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 l(){var t=i;i=[],t.forEach(function(t){return t()}),t=null,n()}var v=function(t){0===i.length&&(e=r(l)),i.push(t)};function m(){0!==i.length&&(o(e),l())}var _=Object.prototype.hasOwnProperty;function C(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function y(t,e){if(C(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(var r=0;r<n.length;r++)if(!_.call(e,n[r])||!C(t[n[r]],e[n[r]]))return!1;return!0}function g(){var t=U.owner._instance;if(t)return t;throw Error("Hooks can only be called inside a component.")}function N(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!C(t[n],e[n]))return!1;return!0}function w(t,e){x(t,e)}function x(t,e,o){var n=g(),r=n.getHookID(),i=n.getHooks();if(e=null!=e?e:[t],i[r]){var u=i[r],a=u.create,s=u.inputs;u.inputs=e,u.prevInputs=s,a.current=t}else{var 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,l.current=n(),t.current=null,U.isUpdating=r}},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,n(),t.current=null,U.isUpdating=r}};c.current=t,i[r]={create:c,destory:l,prevInputs:e,inputs:e},n.didMount.push(c),n.willUnmount.push(l),n.didUpdate.push(function(){var t=i[r],e=t.prevInputs,n=t.create;null!=e&&N(t.inputs,e)||(l(),n())})}}function b(t,e){var n=g(),r=n.getHookID(),o=n.getHooks();if(o[r]){var i=o[r];N(e,i[1])||(i[0]=t())}else o[r]=[t(),e];return o[r][0]}var I=function(){function t(t){this._currentElement=t}var e=t.prototype;return e.initComponent=function(t,e,n){this._parent=t,this._parentInstance=e,this._context=n,this._mountID=U.mountID++},e.destoryComponent=function(){this._currentElement=null,this._nativeNode=null,this._parent=null,this._parentInstance=null,this._context=null,this._instance&&(this._instance._internal=null,this._instance=null)},e.mountComponent=function(t,e,n,r){return this.initComponent(t,e,n),this.mountNativeNode(r),{_internal:this}},e.unmountComponent=function(t){this._nativeNode&&!t&&U.driver.removeChild(this._nativeNode,this._parent),this.destoryComponent()},e.getName=function(){var t=this._currentElement,e=t&&t.type;return e&&e.displayName||e&&e.name||e||t},e.mountNativeNode=function(t){var e=this.getNativeNode(),n=this._parent;t?t(e,n):U.driver.appendChild(e,n)},e.getNativeNode=function(){return null==this._nativeNode&&(this._nativeNode=this.createNativeNode()),this._nativeNode},e.getPublicInstance=function(){return this.getNativeNode()},t}(),E=function(t){function e(){return t.apply(this,arguments)||this}return u(e,t),e.prototype.createNativeNode=function(){return U.driver.createEmpty(this)},e}(I),k={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+""):R(t),e}function R(t){throw Error("Invalid element type: "+t+". (current: "+("object"==typeof t&&Object.keys(t)||typeof t)+")")}function P(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 S=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},A=1,j=function(e){function t(){var t;return(t=e.call(this)||this).state={element:[]},t.rootID=A++,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),H="__r",O={set:function(t,e){t[H]||(t[H]=e).rootID&&(U.rootInstances[e.rootID]=e,U.rootComponents[e.rootID]=e._internal)},get:function(t){return t[H]},remove:function(t){var e=this.get(t);e&&(t[H]=null,e.rootID&&(delete U.rootComponents[e.rootID],delete U.rootInstances[e.rootID]))},mount:function(t,e,n){var r=n.parent,o=n.hydrate,i=U.driver;null==e&&(e=i.createBody());var u,a={element:t,container:e,hydrate:o};if(i.beforeRender&&i.beforeRender(a),r){var s=r._internal;u=s._processChildContext(s._context)}var c=this.get(e);if(c&&c.rootID)return u&&(c._internal._penddingContext=u),c.update(t),c;var l=D(f(j)).mountComponent(e,null,u||{});return this.set(e,l),l.update(t),i.afterRender&&i.afterRender(a),l}};function M(t){return Array.isArray(t)||(t=[t]),t}var W="style",F="children",T=/^on[A-Z]/,L=function(t){function e(){return t.apply(this,arguments)||this}u(e,t);var n=e.prototype;return n.mountComponent=function(t,e,n,r){var o=this;this.initComponent(t,e,n);var i=this._currentElement,u=i.props,a=i.type,s=u.children,c=u.append||"tree";this._prevStyleCopy=Object.assign({},u.style);var l={_internal:this,type:a,props:u};this._instance=l;var f=function(){null!=s&&o.mountChildren(s,n)};return"tree"===c?(f(),this.mountNativeNode(r)):(this.mountNativeNode(r),f()),i&&i.ref&&k.attach(i._owner,i.ref,this),l},n.mountChildren=function(t,e){t=M(t);var n=this.getNativeNode();return this._mountChildren(n,t,e)},n._mountChildren=function(o,t,i,u){var a=this,s=this._renderedChildren={};return t.map(function(t,e){var n=D(t),r=S(s,t,e);return(s[r]=n)._mountIndex=e,n.mountComponent(o,a._instance,i,u)})},n.unmountChildren=function(t){var e=this._renderedChildren;if(e){for(var n in e){e[n].unmountComponent(t)}this._renderedChildren=null}},n.unmountComponent=function(t){if(this._nativeNode){var e=this._currentElement.ref;e&&k.detach(this._currentElement._owner,e,this),O.remove(this._nativeNode),t||U.driver.removeChild(this._nativeNode,this._parent)}this.unmountChildren(t),this._prevStyleCopy=null,this.destoryComponent()},n.updateComponent=function(t,e,n,r){k.update(t,this._currentElement=e,this);var o=e.props;this.updateProperties(t.props,o),this.updateChildren(o.children,r)},n.updateProperties=function(t,e){var n,r,o,i=U.driver,u=this.getNativeNode();for(n in t)if(n!==F&&null!=t[n]&&!e.hasOwnProperty(n))if(n===W){var a=this._prevStyleCopy;for(r in a)(o=o||{})[r]="";this._prevStyleCopy=null}else if(T.test(n)){var s=t[n];"function"==typeof s&&i.removeEventListener(u,n.slice(2).toLowerCase(),s)}else i.removeAttribute(u,n,t[n]);for(n in e){var c=e[n],l=n===W?this._prevStyleCopy:null!=t?t[n]:void 0;if(n!==F&&l!==c&&(null!=c||null!=l))if(n===W)if(c?c=this._prevStyleCopy=Object.assign({},c):this._prevStyleCopy=null,null!=l){for(r in l)c&&c[r]||((o=o||{})[r]="");for(r in c)l[r]!==c[r]&&((o=o||{})[r]=c[r])}else o=c;else if(T.test(n)){var f=n.slice(2).toLowerCase();"function"==typeof l&&i.removeEventListener(u,f,l,e),"function"==typeof c&&i.addEventListener(u,f,c,e)}else null!=c?i.setAttribute(u,n,c):i.removeAttribute(u,n,t[n])}o&&i.setStyle(u,o)},n.updateChildren=function(t,e){var n=this._renderedChildren,i=U.driver;if(null!=t||null!=n){var r,u,o,a={};if(null!=t)for(var s=0,c=(t=M(t)).length;s<c;s++){var l=t[s],f=S(a,l,s),p=n&&n[f],d=p&&p._currentElement,h=p&&p._context;a[f]=null!=p&&P(d,l)?(d===l&&h===e||p.updateComponent(d,l,e,e),p):(p&&(p._unmount=!0),D(l))}if(null!=n)for(var v in n){var m=n[v],_=m._unmount||!a[v];r?_&&m.unmountComponent():(o=_,u=(r=m).getNativeNode(),Array.isArray(u)&&(u=u[0]))}if(null!=a){var C=function(t,e){if(t=M(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)},y=0,g=null,N=[];for(var w in a){var x=a[w],b=n&&n[w];if(b===x){var I=b.getNativeNode();b._mountIndex!==y&&C(I)}else{var E=this.getNativeNode();Array.isArray(E)&&(E=this._parent),x.mountComponent(E,this._instance,e,C)}x._mountIndex=y++,g=x.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}},n.createNativeNode=function(){var t=this._instance,e=U.driver.createElement(t.type,t.props,this);return O.set(e,t),e},e}(I),Q=function(t){function e(){return t.apply(this,arguments)||this}u(e,t);var n=e.prototype;return n.updateComponent=function(t,e){t!==(e+="")&&(this._currentElement=e,U.driver.updateText(this.getNativeNode(),this._currentElement))},n.createNativeNode=function(){return U.driver.createText(this._currentElement,this)},e}(I),B=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;n--)if(e=o[n](r.props,t))break;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;var t=this._render(this.props,this.forwardRef?this.forwardRef:this.context);while(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),V=[];function Z(t){return t._pendingCallbacks}function $(t,e){return t._pendingCallbacks=e}function q(t){return t._pendingStateQueue}function z(t,e){if(t)for(var n=0;n<t.length;n++)t[n].call(e)}function G(t){var e=t._internal;if(e){U.isUpdating=!0;var n=Z(e);$(e,null);var r=e._currentElement,o=e._context,i=e._penddingContext||o;e._penddingContext=void 0,(q(e)||e._isPendingForceUpdate)&&e.updateComponent(r,r,o,i),z(n,t),U.isUpdating=!1}}function J(t,e){return e._internal._mountID-t._internal._mountID}function K(){var t,e;if(!U.isUpdating)while(0<V.length){m(),t=V.sort(J),V=[];while(e=t.pop())G(e)}}function X(t){V.indexOf(t)<0&&V.push(t),K()}function Y(t,e,n){var r=t._internal;if(r){var o,i;!U.isUpdating&&m(),n&&(i=n,(Z(o=r)||$(o,[])).push(i));var u,a,s=r._renderedComponent;e?(a=e,(q(u=r)||(u._pendingStateQueue=[])).push(a),!r._isPendingState&&s&&X(t)):(r._isPendingForceUpdate=!0,s&&X(t))}}n=K;var tt={setState:Y,forceUpdate:function(t,e){Y(t,null,e)},runCallbacks:z};function et(t,e,n){try{return t()}catch(t){n?n(t):nt(e,t)}}function nt(t,e){var n;while(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 rt=function(t){function e(){return t.apply(this,arguments)||this}u(e,t);var n=e.prototype;return n.mountComponent=function(t,e,n,r){this.initComponent(t,e,n),this._updateCount=0;var o,i,u=this._currentElement,a=u.type,s=u.ref,c=u.props,l=a.prototype,f=this._processContext(n);try{l&&l.render?o=new a(c,f):"function"==typeof a?o=new B(a,s):R(a)}catch(t){return nt(e,t)}o.props=c,o.context=f,o.refs={},o.updater=tt;var p=((o._internal=this)._instance=o).state;void 0===p&&(o.state=p=null);var d=null,h=function(t){d=t};o.componentWillMount&&et(function(){o.componentWillMount()},o,h),null==i&&(o.state=(U.owner=this)._processPendingState(c,f),et(function(){i=o.render()},o,h),U.owner=null),this._renderedComponent=D(i),this._renderedComponent.mountComponent(this._parent,o,this._processChildContext(n),r),d&&nt(o,d),!u.type.forwardRef&&s&&k.attach(u._owner,s,this),o.componentDidMount&&et(function(){o.componentDidMount()},o);var v=this._pendingCallbacks;return v&&(this._pendingCallbacks=null,tt.runCallbacks(v,o)),o},n.unmountComponent=function(t){var e=this._instance;if(e&&e.componentWillUnmount&&et(function(){e.componentWillUnmount()},e),null!=this._renderedComponent){var n=this._currentElement,r=n.ref;!n.type.forwardRef&&r&&k.detach(n._owner,r,this),this._renderedComponent.unmountComponent(t),this._renderedComponent=null}this._pendingStateQueue=null,this._isPendingForceUpdate=!1,this.destoryComponent()},n._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},n._processChildContext=function(t){var e=this._instance,n=e.getChildContext&&e.getChildContext();return n?Object.assign({},t,n):t},n._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},n.updateComponent=function(t,e,n,r){var o=this._instance;if(o){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._isPendingState=!0,et(function(){o.componentWillReceiveProps(u,i)},o),this._isPendingState=!1),this._currentElement.type.forwardRef?(o.prevForwardRef=t.ref,o.forwardRef=e.ref):k.update(t,e,this);var s=!0,c=o.props,l=o.state,f=this._processPendingState(u,i);if(this._isPendingForceUpdate||(o.shouldComponentUpdate?s=et(function(){return o.shouldComponentUpdate(u,f,i)},o):o.isPureComponent&&(s=!y(c,u)||!y(l,f))),s){this._isPendingForceUpdate=!1;var p=o.context;et(function(){o.componentWillUpdate&&o.componentWillUpdate(u,f,i)},o),this._currentElement=e,this._context=r,o.props=u,o.state=f,o.context=i,this._updateRenderedComponent(r),et(function(){o.componentDidUpdate&&o.componentDidUpdate(c,l,p)},o),this._updateCount++}else this._currentElement=e,this._context=r,o.props=u,o.state=f,o.context=i;var d=this._pendingCallbacks;d&&(this._pendingCallbacks=null,tt.runCallbacks(d,o))}},n._updateRenderedComponent=function(t){var e,n=this._renderedComponent,r=n._currentElement,o=this._instance;if(U.owner=this,et(function(){e=o.render()},o),U.owner=null,P(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){a=M(a),t=M(t);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])})}},n.getNativeNode=function(){var t=this._renderedComponent;if(t)return t.getNativeNode()},n.getPublicInstance=function(){var t=this._instance;return t instanceof B?null:t},e}(I),ot=function(t){function e(){return t.apply(this,arguments)||this}u(e,t);var n=e.prototype;return n.mountComponent=function(t,e,n,r){this.initComponent(t,e,n);var o={_internal:this};this._instance=o,this.mountChildren(this._currentElement,n);var i=this.getNativeNode();if(r)r(i,t);else for(var u=0;u<i.length;u++)U.driver.appendChild(i[u],t);return o},n.mountChildren=function(t,e){var n=this.getNativeNode();return this._mountChildren(this._parent,t,e,function(t){t=M(t);for(var e=0;e<t.length;e++)n.push(t[e])})},n.unmountComponent=function(t){var e=this._nativeNode;if(e&&(O.remove(e),!t))for(var n=0;n<e.length;n++)U.driver.removeChild(e[n]);this.unmountChildren(!0),this.destoryComponent()},n.updateComponent=function(t,e,n,r){this._currentElement=e,this.updateChildren(this._currentElement,r)},n.createNativeNode=function(){return[]},n.getName=function(){return"fragment"},e}(L);var it={Host:U,Instance:O,Element:p,flattenChildren:d};t.createElement=f,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=g(),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.owner&&U.owner._instance===n?(o[r][0]=t,n.isScheduled=!0):(!U.isUpdating&&m(),o[r][0]=t,n.update()))}]);return o[r]},t.useContext=function(t){return g().readContext(t)},t.useEffect=function(t,e){x(t,e,!0)},t.useLayoutEffect=w,t.useRef=function(t){var e=g(),n=e.getHookID(),r=e.getHooks();return r[n]||(r[n]={current:t}),r[n]},t.useCallback=function(t,e){return b(function(){return t},e)},t.useMemo=b,t.useReducer=function(t,e,n){var r=g(),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.owner&&U.owner._instance===r?(e.push(t),r.isScheduled=!0):(!U.isUpdating&&m(),e.push(t),r.update())},[]];for(var u=i[o],a=u[2],s=u[0],c=0;c<a.length;c++)s=t(s,a[c]);return u[0]=s,u[2]=[],i[o]},t.useImperativeHandle=function(t,e,n){w(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=y),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(U.Empty=E,U.Native=L,U.Text=Q,U.Fragment=ot,U.Composite=rt,U.driver=e||U.driver,!U.driver)throw Error("Driver not found.")}(n=n||{});var o=O.mount(t,e,n).getPublicInstance();return r&&r.call(o),o},t.version="1.0.0-beta",t.shared=it,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=rax.min.js.map

@@ -48,3 +48,3 @@ "use strict";

var parent = _ref.parent,
hybrate = _ref.hybrate;
hydrate = _ref.hydrate;

@@ -64,3 +64,3 @@ if (process.env.NODE_ENV !== 'production') {

container: container,
hybrate: hybrate
hydrate: hydrate
}; // Before render callback

@@ -67,0 +67,0 @@

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

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

@@ -35,3 +35,3 @@ import Host from './host';

},
mount(element, container, { parent, hybrate }) {
mount(element, container, { parent, hydrate }) {
if (process.env.NODE_ENV !== 'production') {

@@ -51,3 +51,3 @@ Host.measurer && Host.measurer.beforeRender();

container,
hybrate
hydrate
};

@@ -54,0 +54,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