diff --git a/react-redux-versions/react-redux-7.0.0-beta.0.min.js b/react-redux-versions/react-redux-7.0.0-beta.0.min.js deleted file mode 100644 index 58abb43..0000000 --- a/react-redux-versions/react-redux-7.0.0-beta.0.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("redux"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","redux","react-dom"],t):t((e=e||self).ReactRedux={},e.React,e.Redux,e.ReactDOM)}(this,function(e,t,r,n){"use strict";var o="default"in t?t.default:t;function i(e,t){return e(t={exports:{}},t.exports),t.exports}var s="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";function u(){}function a(){}a.resetWarningCache=u;var c=i(function(e){e.exports=function(){function e(e,t,r,n,o,i){if(i!==s){var u=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:u};return r.PropTypes=r,r}()}),p=o.createContext(null);var f=function(e){e()},d=function(){return f},l=null,y={notify:function(){}};var h=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=y,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){var e,t,r;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(e=d(),t=[],r=[],{clear:function(){r=l,t=l},notify:function(){var n=t=r;e(function(){for(var e=0;n.length>e;e++)n[e]()})},get:function(){return r},subscribe:function(e){var n=!0;return r===t&&(r=t.slice()),r.push(e),function(){n&&t!==l&&(n=!1,r===t&&(r=t.slice()),r.splice(r.indexOf(e),1))}}}))},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=y)},e}(),b=function(e){var t,r;function n(t){var r;r=e.call(this,t)||this;var n=t.store;r.notifySubscribers=r.notifySubscribers.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r));var o=new h(n);return o.onStateChange=r.notifySubscribers,r.state={store:n,subscription:o},r.previousState=n.getState(),r}(t=n).prototype=Object.create((r=e).prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.componentDidMount=function(){this._isMounted=!0,this.state.subscription.trySubscribe(),this.previousState!==this.props.store.getState()&&this.state.subscription.notifyNestedSubs()},i.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.state.subscription.tryUnsubscribe(),this._isMounted=!1},i.componentDidUpdate=function(e){if(this.props.store!==e.store){this.state.subscription.tryUnsubscribe();var t=new h(this.props.store);t.onStateChange=this.notifySubscribers,this.setState({store:this.props.store,subscription:t})}},i.notifySubscribers=function(){this.state.subscription.notifyNestedSubs()},i.render=function(){return o.createElement((this.props.context||p).Provider,{value:this.state},this.props.children)},n}(t.Component);function m(){return(m=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function v(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&(o[r]=e[r]);return o}b.propTypes={store:c.shape({subscribe:c.func.isRequired,dispatch:c.func.isRequired,getState:c.func.isRequired}),context:c.object,children:c.any};var P,S=i(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,s=r?Symbol.for("react.strict_mode"):60108,u=r?Symbol.for("react.profiler"):60114,a=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,l=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116;function b(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case p:case f:case i:case u:case s:case l:return e;default:switch(e=e&&e.$$typeof){case c:case d:case a:return e;default:return t}}case h:case y:case o:return t}}}function m(e){return b(e)===f}t.typeOf=b,t.AsyncMode=p,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=a,t.Element=n,t.ForwardRef=d,t.Fragment=i,t.Lazy=h,t.Memo=y,t.Portal=o,t.Profiler=u,t.StrictMode=s,t.Suspense=l,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===f||e===u||e===s||e===l||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===a||e.$$typeof===c||e.$$typeof===d)},t.isAsyncMode=function(e){return m(e)||b(e)===p},t.isConcurrentMode=m,t.isContextConsumer=function(e){return b(e)===c},t.isContextProvider=function(e){return b(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return b(e)===d},t.isFragment=function(e){return b(e)===i},t.isLazy=function(e){return b(e)===h},t.isMemo=function(e){return b(e)===y},t.isPortal=function(e){return b(e)===o},t.isProfiler=function(e){return b(e)===u},t.isStrictMode=function(e){return b(e)===s},t.isSuspense=function(e){return b(e)===l}});(P=S)&&P.__esModule&&Object.prototype.hasOwnProperty.call(P,"default");var g=i(function(e){e.exports=S}),O=g.isContextConsumer,C={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},w={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},x={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},R={};function E(e){return g.isMemo(e)?x:R[e.$$typeof]||C}R[g.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var M=Object.defineProperty,T=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols,j=Object.getOwnPropertyDescriptor,N=Object.getPrototypeOf,q=Object.prototype;var $=function e(t,r,n){if("string"!=typeof r){if(q){var o=N(r);o&&o!==q&&e(t,o,n)}var i=T(r);_&&(i=i.concat(_(r)));for(var s=E(t),u=E(r),a=0;i.length>a;++a){var c=i[a];if(!(w[c]||n&&n[c]||u&&u[c]||s&&s[c])){var p=j(r,c);try{M(t,c,p)}catch(e){}}}return t}return t},D=function(e,t,r,n,o,i,s,u){if(!e){var a;if(void 0===t)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,i,s,u],p=0;(a=Error(t.replace(/%s/g,function(){return c[p++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},F=[],W=[null,null];function U(e,t){return[t.payload,e[1]+1]}var k=function(){return[null,0]},A="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function H(e,r){void 0===r&&(r={});var n=r.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,s=r.methodName,u=void 0===s?"connectAdvanced":s,a=r.renderCountProp,c=void 0===a?void 0:a,f=r.shouldHandleStateChanges,d=void 0===f||f,l=r.storeKey,y=void 0===l?"store":l,b=r.withRef,P=void 0!==b&&b,S=r.forwardRef,g=void 0!==S&&S,C=r.context,w=void 0===C?p:C,x=v(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]);D(void 0===c,"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension"),D(!P,"withRef is removed. To access the wrapped instance, use a ref on the connected component");D("store"===y,"storeKey has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React Redux's Provider and specific components like: . You may also pass a {context : MyContext} option to connect");var R=w;return function(r){var n=r.displayName||r.name||"Component",s=i(n),a=m({},x,{getDisplayName:i,methodName:u,renderCountProp:c,shouldHandleStateChanges:d,storeKey:y,displayName:s,wrappedComponentName:n,WrappedComponent:r}),p=x.pure;var f=p?t.useMemo:function(e){return e()};function l(n){var i=t.useMemo(function(){return[n.context,n.forwardedRef,v(n,["context","forwardedRef"])]},[n]),u=i[0],c=i[1],p=i[2],l=t.useMemo(function(){return u&&u.Consumer&&O(o.createElement(u.Consumer,null))?u:R},[u,R]),y=t.useContext(l),b=!!n.store;D(b||!!y&&!!y.store,'Could not find "store" in the context of "'+s+'". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to '+s+" in connect options.");var P=n.store||y.store,S=t.useMemo(function(){return function(t){return e(t.dispatch,a)}(P)},[P]),g=t.useMemo(function(){if(!d)return W;var e=new h(P,b?null:y.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[P,b,y]),C=g[0],w=g[1],x=t.useMemo(function(){return b?y:m({},y,{subscription:C})},[b,y,C]),E=t.useReducer(U,F,k),M=E[0][0],T=E[1];if(M&&M.error)throw M.error;var _=t.useRef(),j=t.useRef(p),N=t.useRef(),q=f(function(){return N.current&&p===j.current?N.current:S(P.getState(),p)},[P,M,p]);return A(function(){j.current=p,_.current=q,N.current&&(N.current=null,w())}),t.useEffect(function(){if(d){var e=!1,t=null,r=function(){if(!e){var r,n,o=P.getState();try{r=S(o,j.current)}catch(e){n=e,t=e}n||(t=null),r===_.current?w():(T({type:"STORE_UPDATED",payload:{latestStoreState:o,error:n}}),_.current=r,N.current=r)}};C.onStateChange=r,C.trySubscribe(),r();return function(){if(e=!0,C.tryUnsubscribe(),t)throw t}}},[P,C,S]),t.useMemo(function(){var e=o.createElement(r,m({},q,{ref:c}));return d?o.createElement(l.Provider,{value:x},e):e},[l,r,q,c,x])}var b=p?o.memo(l):l;if(b.WrappedComponent=r,b.displayName=s,g){var P=o.forwardRef(function(e,t){return o.createElement(b,m({},e,{forwardedRef:t}))});return P.displayName=s,P.WrappedComponent=r,$(P,r)}return $(b,r)}}var I=Object.prototype.hasOwnProperty;function L(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function K(e,t){if(L(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(var n=0;r.length>n;n++)if(!I.call(t,r[n])||!L(e[r[n]],t[r[n]]))return!1;return!0}function z(e){return function(t,r){var n=e(t,r);function o(){return n}return o.dependsOnOwnProps=!1,o}}function V(e){return null!=e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function Y(e,t){return function(t,r){var n=function(e,t){return n.dependsOnOwnProps?n.mapToProps(e,t):n.mapToProps(e)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,r){n.mapToProps=e,n.dependsOnOwnProps=V(e);var o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=V(o),o=n(t,r)),o},n}}function B(e,t,r){return m({},r,e,t)}var G=[function(e){return"function"==typeof e?function(e){return function(t,r){var n,o=r.pure,i=r.areMergedPropsEqual,s=!1;return function(t,r,u){var a=e(t,r,u);return s?o&&i(a,n)||(n=a):(s=!0,n=a),n}}}(e):void 0},function(e){return e?void 0:function(){return B}}];function J(e,t,r,n){return function(o,i){return r(e(o,i),t(n,i),i)}}function Q(e,t,r,n,o){var i,s,u,a,c,p=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,l=!1;function y(o,l){var y,h,b=!f(l,s),m=!p(o,i);return i=o,s=l,b&&m?(u=e(i,s),t.dependsOnOwnProps&&(a=t(n,s)),c=r(u,a,s)):b?(e.dependsOnOwnProps&&(u=e(i,s)),t.dependsOnOwnProps&&(a=t(n,s)),c=r(u,a,s)):m?(y=e(i,s),h=!d(y,u),u=y,h&&(c=r(u,a,s)),c):c}return function(o,p){return l?y(o,p):(u=e(i=o,s=p),a=t(n,s),c=r(u,a,s),l=!0,c)}}function X(e,t){var r=t.initMapStateToProps,n=t.initMapDispatchToProps,o=t.initMergeProps,i=v(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),s=r(e,i),u=n(e,i),a=o(e,i);return(i.pure?Q:J)(s,u,a,e,i)}function Z(e,t,r){for(var n=t.length-1;n>=0;n--){var o=t[n](e);if(o)return o}return function(t,n){throw Error("Invalid value of type "+typeof e+" for "+r+" argument when connecting component "+n.wrappedComponentName+".")}}function ee(e,t){return e===t}var te,re,ne,oe,ie,se,ue,ae,ce,pe,fe,de,le=(oe=void 0===(ne=(re=void 0===te?{}:te).connectHOC)?H:ne,se=void 0===(ie=re.mapStateToPropsFactories)?[function(e){return"function"==typeof e?Y(e):void 0},function(e){return e?void 0:z(function(){return{}})}]:ie,ae=void 0===(ue=re.mapDispatchToPropsFactories)?[function(e){return"function"==typeof e?Y(e):void 0},function(e){return e?void 0:z(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?z(function(t){return r.bindActionCreators(e,t)}):void 0}]:ue,pe=void 0===(ce=re.mergePropsFactories)?G:ce,de=void 0===(fe=re.selectorFactory)?X:fe,function(e,t,r,n){void 0===n&&(n={});var o=n.pure,i=void 0===o||o,s=n.areStatesEqual,u=void 0===s?ee:s,a=n.areOwnPropsEqual,c=void 0===a?K:a,p=n.areStatePropsEqual,f=void 0===p?K:p,d=n.areMergedPropsEqual,l=void 0===d?K:d,y=v(n,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),h=Z(e,se,"mapStateToProps"),b=Z(t,ae,"mapDispatchToProps"),P=Z(r,pe,"mergeProps");return oe(de,m({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:!!e,initMapStateToProps:h,initMapDispatchToProps:b,initMergeProps:P,pure:i,areStatesEqual:u,areOwnPropsEqual:c,areStatePropsEqual:f,areMergedPropsEqual:l},y))});f=n.unstable_batchedUpdates,e.batch=n.unstable_batchedUpdates,e.Provider=b,e.connectAdvanced=H,e.ReactReduxContext=p,e.connect=le,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/react-redux-versions/react-redux-7.0.0.alpha-3.min.js b/react-redux-versions/react-redux-7.0.0.alpha-3.min.js deleted file mode 100644 index 466e3b4..0000000 --- a/react-redux-versions/react-redux-7.0.0.alpha-3.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react-dom"),require("react"),require("redux")):"function"==typeof define&&define.amd?define(["exports","react-dom","react","redux"],t):t(e.ReactRedux={},e.ReactDOM,e.React,e.Redux)}(this,function(e,o,E,r){"use strict";var M="default"in E?E.default:E;function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t(e,t){return e(t={exports:{}},t.exports),t.exports}function n(){}var s=t(function(e){e.exports=function(){function e(e,t,r,n,o,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}var r={array:e.isRequired=e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r}()}),m=M.createContext(null),u=null,a={notify:function(){}};var T=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=a,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return!!this.unsubscribe},t.trySubscribe=function(){var r,n;this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=(r=[],n=[],{clear:function(){r=n=u},notify:function(){var t=r=n;o.unstable_batchedUpdates(function(){for(var e=0;e. You may also pass a {context : MyContext} option to connect");var R=h;return function(S){var e=S.displayName||S.name||"Component",g=i(e),O=j({},b,{getDisplayName:i,methodName:s,renderCountProp:u,shouldHandleStateChanges:x,storeKey:c,displayName:g,wrappedComponentName:e,WrappedComponent:S}),t=b.pure;var C=t?E.useMemo:function(e){return e()};function r(e){var t=E.useMemo(function(){return[e.context,e.forwardedRef,_(e,["context","forwardedRef"])]},[e]),r=t[0],n=t[1],o=t[2],i=E.useMemo(function(){return r&&r.Consumer&&N(M.createElement(r.Consumer,null))?r:R},[r,R]),s=E.useContext(i);$(e.store||s,'Could not find "store" in the context of "'+g+'". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to '+g+" in connect options.");var u=e.store||s.store,a=E.useMemo(function(){return w(u.dispatch,O)},[u]),c=E.useMemo(function(){if(!x)return F;var e=new T(u,s.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[u,s.subscription]),p=c[0],f=c[1],d=E.useMemo(function(){return j({},s,{subscription:p})},[s,p]),l=E.useReducer(U,D,W),y=l[0][0],h=l[1];if(y&&y.error)throw y.error;var b=E.useRef(),m=E.useRef(o),v=E.useRef(),P=C(function(){return v.current&&o===m.current?v.current:a(u.getState(),o)},[u,y,o]);return E.useEffect(function(){m.current=o,b.current=P,v.current&&(v.current=null,f())}),E.useEffect(function(){if(x){var n=!1,e=function(){if(!n){var e,t,r=u.getState();try{e=a(r,m.current)}catch(e){t=e}e===b.current?f():(h({type:"STORE_UPDATED",payload:{latestStoreState:r,error:t}}),v.current=b.current=e)}};p.onStateChange=e,p.trySubscribe(),e();return function(){n=!0,p.tryUnsubscribe()}}},[u,p,a]),E.useMemo(function(){var e=M.createElement(S,j({},P,{ref:n}));return x?M.createElement(i.Provider,{value:d},e):e},[i,S,P,n,d])}var n=t?M.memo(r):r;if(n.WrappedComponent=S,n.displayName=g,l){var o=M.forwardRef(function(e,t){return M.createElement(n,{wrapperProps:e,forwardedRef:t})});return o.displayName=g,o.WrappedComponent=S,q(o,S)}return q(n,S)}}var w=Object.prototype.hasOwnProperty;function x(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function R(e,t){if(x(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(var n=0;ne;e++)n[e]()})},get:function(){return r},subscribe:function(e){var n=!0;return r===t&&(r=t.slice()),r.push(e),function(){n&&t!==l&&(n=!1,r===t&&(r=t.slice()),r.splice(r.indexOf(e),1))}}}}())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=y)},e}(),v=function(e){var t,r;function n(t){var r;r=e.call(this,t)||this;var n=t.store;r.notifySubscribers=r.notifySubscribers.bind(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r));var o=new h(n);return o.onStateChange=r.notifySubscribers,r.state={store:n,subscription:o},r.previousState=n.getState(),r}(t=n).prototype=Object.create((r=e).prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.componentDidMount=function(){this._isMounted=!0,this.state.subscription.trySubscribe(),this.previousState!==this.props.store.getState()&&this.state.subscription.notifyNestedSubs()},i.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.state.subscription.tryUnsubscribe(),this._isMounted=!1},i.componentDidUpdate=function(e){if(this.props.store!==e.store){this.state.subscription.tryUnsubscribe();var t=new h(this.props.store);t.onStateChange=this.notifySubscribers,this.setState({store:this.props.store,subscription:t})}},i.notifySubscribers=function(){this.state.subscription.notifyNestedSubs()},i.render=function(){return o.createElement((this.props.context||p).Provider,{value:this.state},this.props.children)},n}(t.Component);function m(){return(m=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function b(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;i.length>n;n++)0>t.indexOf(r=i[n])&&(o[r]=e[r]);return o}v.propTypes={store:c.shape({subscribe:c.func.isRequired,dispatch:c.func.isRequired,getState:c.func.isRequired}),context:c.object,children:c.any};var P,S=i(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,i=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,a=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,p=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,d=r?Symbol.for("react.forward_ref"):60112,l=r?Symbol.for("react.suspense"):60113,y=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116;function v(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case p:case f:case i:case s:case u:case l:return e;default:switch(e=e&&e.$$typeof){case c:case d:case a:return e;default:return t}}case h:case y:case o:return t}}}function m(e){return v(e)===f}t.typeOf=v,t.AsyncMode=p,t.ConcurrentMode=f,t.ContextConsumer=c,t.ContextProvider=a,t.Element=n,t.ForwardRef=d,t.Fragment=i,t.Lazy=h,t.Memo=y,t.Portal=o,t.Profiler=s,t.StrictMode=u,t.Suspense=l,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===f||e===s||e===u||e===l||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===a||e.$$typeof===c||e.$$typeof===d)},t.isAsyncMode=function(e){return m(e)||v(e)===p},t.isConcurrentMode=m,t.isContextConsumer=function(e){return v(e)===c},t.isContextProvider=function(e){return v(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return v(e)===d},t.isFragment=function(e){return v(e)===i},t.isLazy=function(e){return v(e)===h},t.isMemo=function(e){return v(e)===y},t.isPortal=function(e){return v(e)===o},t.isProfiler=function(e){return v(e)===s},t.isStrictMode=function(e){return v(e)===u},t.isSuspense=function(e){return v(e)===l}});(P=S)&&P.__esModule&&Object.prototype.hasOwnProperty.call(P,"default");var g=i(function(e){e.exports=S}),w=g.isContextConsumer,O={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},C={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},x={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},R={};function E(e){return g.isMemo(e)?x:R[e.$$typeof]||O}R[g.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var M=Object.defineProperty,T=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols,_=Object.getOwnPropertyDescriptor,N=Object.getPrototypeOf,q=Object.prototype;var D=function e(t,r,n){if("string"!=typeof r){if(q){var o=N(r);o&&o!==q&&e(t,o,n)}var i=T(r);j&&(i=i.concat(j(r)));for(var u=E(t),s=E(r),a=0;i.length>a;++a){var c=i[a];if(!(C[c]||n&&n[c]||s&&s[c]||u&&u[c])){var p=_(r,c);try{M(t,c,p)}catch(e){}}}return t}return t},$=function(e,t,r,n,o,i,u,s){if(!e){var a;if(void 0===t)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,i,u,s],p=0;(a=Error(t.replace(/%s/g,function(){return c[p++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},F=[],U=[null,null];function W(e,t){return[t.payload,e[1]+1]}var k=function(){return[null,0]},A="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function H(e,r){void 0===r&&(r={});var n=r.getDisplayName,i=void 0===n?function(e){return"ConnectAdvanced("+e+")"}:n,u=r.methodName,s=void 0===u?"connectAdvanced":u,a=r.renderCountProp,c=void 0===a?void 0:a,f=r.shouldHandleStateChanges,d=void 0===f||f,l=r.storeKey,y=void 0===l?"store":l,v=r.withRef,P=void 0!==v&&v,S=r.forwardRef,g=void 0!==S&&S,O=r.context,C=void 0===O?p:O,x=b(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]);$(void 0===c,"renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension"),$(!P,"withRef is removed. To access the wrapped instance, use a ref on the connected component");$("store"===y,"storeKey has been removed and does not do anything. To use a custom Redux store for specific components, create a custom React context with React.createContext(), and pass the context object to React Redux's Provider and specific components like: . You may also pass a {context : MyContext} option to connect");var R=C;return function(r){var n=r.displayName||r.name||"Component",u=i(n),a=m({},x,{getDisplayName:i,methodName:s,renderCountProp:c,shouldHandleStateChanges:d,storeKey:y,displayName:u,wrappedComponentName:n,WrappedComponent:r}),p=x.pure;var f=p?t.useMemo:function(e){return e()};function l(n){var i=t.useMemo(function(){var e=n.forwardedRef,t=b(n,["forwardedRef"]);return[n.context,e,t]},[n]),s=i[0],c=i[1],p=i[2],l=t.useMemo(function(){return s&&s.Consumer&&w(o.createElement(s.Consumer,null))?s:R},[s,R]),y=t.useContext(l),v=!!n.store;$(v||!!y&&!!y.store,'Could not find "store" in the context of "'+u+'". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to '+u+" in connect options.");var P=n.store||y.store,S=t.useMemo(function(){return function(t){return e(t.dispatch,a)}(P)},[P]),g=t.useMemo(function(){if(!d)return U;var e=new h(P,v?null:y.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]},[P,v,y]),O=g[0],C=g[1],x=t.useMemo(function(){return v?y:m({},y,{subscription:O})},[v,y,O]),E=t.useReducer(W,F,k),M=E[0][0],T=E[1];if(M&&M.error)throw M.error;var j=t.useRef(),_=t.useRef(p),N=t.useRef(),q=t.useRef(!1),D=f(function(){return N.current&&p===_.current?N.current:S(P.getState(),p)},[P,M,p]);A(function(){_.current=p,j.current=D,q.current=!1,N.current&&(N.current=null,C())}),A(function(){if(d){var e=!1,t=null,r=function(){if(!e){var r,n,o=P.getState();try{r=S(o,_.current)}catch(e){n=e,t=e}n||(t=null),r===j.current?q.current||C():(j.current=r,N.current=r,q.current=!0,T({type:"STORE_UPDATED",payload:{latestStoreState:o,error:n}}))}};O.onStateChange=r,O.trySubscribe(),r();return function(){if(e=!0,O.tryUnsubscribe(),t)throw t}}},[P,O,S]);var H=t.useMemo(function(){return o.createElement(r,m({},D,{ref:c}))},[c,r,D]);return t.useMemo(function(){return d?o.createElement(l.Provider,{value:x},H):H},[l,H,x])}var v=p?o.memo(l):l;if(v.WrappedComponent=r,v.displayName=u,g){var P=o.forwardRef(function(e,t){return o.createElement(v,m({},e,{forwardedRef:t}))});return P.displayName=u,P.WrappedComponent=r,D(P,r)}return D(v,r)}}var I=Object.prototype.hasOwnProperty;function L(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function K(e,t){if(L(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(var n=0;r.length>n;n++)if(!I.call(t,r[n])||!L(e[r[n]],t[r[n]]))return!1;return!0}function z(e){return function(t,r){var n=e(t,r);function o(){return n}return o.dependsOnOwnProps=!1,o}}function V(e){return null!=e.dependsOnOwnProps?!!e.dependsOnOwnProps:1!==e.length}function Y(e,t){return function(t,r){var n=function(e,t){return n.dependsOnOwnProps?n.mapToProps(e,t):n.mapToProps(e)};return n.dependsOnOwnProps=!0,n.mapToProps=function(t,r){n.mapToProps=e,n.dependsOnOwnProps=V(e);var o=n(t,r);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=V(o),o=n(t,r)),o},n}}function B(e,t,r){return m({},r,e,t)}var G=[function(e){return"function"==typeof e?function(e){return function(t,r){var n,o=r.pure,i=r.areMergedPropsEqual,u=!1;return function(t,r,s){var a=e(t,r,s);return u?o&&i(a,n)||(n=a):(u=!0,n=a),n}}}(e):void 0},function(e){return e?void 0:function(){return B}}];function J(e,t,r,n){return function(o,i){return r(e(o,i),t(n,i),i)}}function Q(e,t,r,n,o){var i,u,s,a,c,p=o.areStatesEqual,f=o.areOwnPropsEqual,d=o.areStatePropsEqual,l=!1;function y(o,l){var y,h,v=!f(l,u),m=!p(o,i);return i=o,u=l,v&&m?(s=e(i,u),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):v?(e.dependsOnOwnProps&&(s=e(i,u)),t.dependsOnOwnProps&&(a=t(n,u)),c=r(s,a,u)):m?(y=e(i,u),h=!d(y,s),s=y,h&&(c=r(s,a,u)),c):c}return function(o,p){return l?y(o,p):(s=e(i=o,u=p),a=t(n,u),c=r(s,a,u),l=!0,c)}}function X(e,t){var r=t.initMapStateToProps,n=t.initMapDispatchToProps,o=t.initMergeProps,i=b(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),u=r(e,i),s=n(e,i),a=o(e,i);return(i.pure?Q:J)(u,s,a,e,i)}function Z(e,t,r){for(var n=t.length-1;n>=0;n--){var o=t[n](e);if(o)return o}return function(t,n){throw Error("Invalid value of type "+typeof e+" for "+r+" argument when connecting component "+n.wrappedComponentName+".")}}function ee(e,t){return e===t}var te,re,ne,oe,ie,ue,se,ae,ce,pe,fe,de,le=(oe=void 0===(ne=(re=void 0===te?{}:te).connectHOC)?H:ne,ue=void 0===(ie=re.mapStateToPropsFactories)?[function(e){return"function"==typeof e?Y(e):void 0},function(e){return e?void 0:z(function(){return{}})}]:ie,ae=void 0===(se=re.mapDispatchToPropsFactories)?[function(e){return"function"==typeof e?Y(e):void 0},function(e){return e?void 0:z(function(e){return{dispatch:e}})},function(e){return e&&"object"==typeof e?z(function(t){return r.bindActionCreators(e,t)}):void 0}]:se,pe=void 0===(ce=re.mergePropsFactories)?G:ce,de=void 0===(fe=re.selectorFactory)?X:fe,function(e,t,r,n){void 0===n&&(n={});var o=n.pure,i=void 0===o||o,u=n.areStatesEqual,s=void 0===u?ee:u,a=n.areOwnPropsEqual,c=void 0===a?K:a,p=n.areStatePropsEqual,f=void 0===p?K:p,d=n.areMergedPropsEqual,l=void 0===d?K:d,y=b(n,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),h=Z(e,ue,"mapStateToProps"),v=Z(t,ae,"mapDispatchToProps"),P=Z(r,pe,"mergeProps");return oe(de,m({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:!!e,initMapStateToProps:h,initMapDispatchToProps:v,initMergeProps:P,pure:i,areStatesEqual:s,areOwnPropsEqual:c,areStatePropsEqual:f,areMergedPropsEqual:l},y))});function ye(){var e=t.useContext(p);return $(e,"could not find react-redux context value; please ensure the component is wrapped in a "),e}function he(){return ye().store}var ve="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,me=function(e,t){return e===t};f=n.unstable_batchedUpdates,Object.defineProperty(e,"batch",{enumerable:!0,get:function(){return n.unstable_batchedUpdates}}),e.Provider=v,e.ReactReduxContext=p,e.connect=le,e.connectAdvanced=H,e.shallowEqual=K,e.useDispatch=function(){return he().dispatch},e.useSelector=function(e,r){void 0===r&&(r=me),$(e,"You must pass a selector to useSelectors");var n,o=ye(),i=o.store,u=o.subscription,s=t.useReducer(function(e){return e+1},0)[1],a=t.useMemo(function(){return new h(i,u)},[i,u]),c=t.useRef(),p=t.useRef(),f=t.useRef();try{n=e!==p.current||c.current?e(i.getState()):f.current}catch(e){var d="An error occured while selecting the store state: "+e.message+".";throw c.current&&(d+="\nThe error may be correlated with this previous error:\n"+c.current.stack+"\n\nOriginal stack trace:"),Error(d)}return ve(function(){p.current=e,f.current=n,c.current=void 0}),ve(function(){function e(){try{var e=p.current(i.getState());if(r(e,f.current))return;f.current=e}catch(e){c.current=e}s({})}return a.onStateChange=e,a.trySubscribe(),e(),function(){return a.tryUnsubscribe()}},[i,a]),n},e.useStore=he,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/react-redux-versions/react-redux-rrr-4.2.0.min.js b/react-redux-versions/react-redux-rrr-4.2.0.min.js new file mode 100644 index 0000000..2fa1c96 --- /dev/null +++ b/react-redux-versions/react-redux-rrr-4.2.0.min.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e=e||self).ReactRedux={},e.React)}(this,function(e,t){"use strict";var r="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,n=function(e){return e+1},o=function(){return t.useReducer(n,0)[1]},u={get state(){throw Error("Please use ")},get dispatch(){throw Error("Please use ")},get subscribe(){throw Error("Please use ")}},c=function(e,t){return e.dispatch!==t.dispatch||e.subscribe!==t.subscribe?1:0},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;return t.createContext(e,r)},s=i();function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var f=Symbol("OWN_KEYS"),l=function(){return{recordUsage:function(e){var t=this.affected.get(this.originalObj);t||(t=new Set,this.affected.set(this.originalObj,t)),t.add(e)},get:function(e,t){return this.recordUsage(t),d(e[t],this.affected,this.proxyCache)},has:function(e,t){return this.recordUsage(t),t in e},ownKeys:function(e){return this.recordUsage(f),Reflect.ownKeys(e)}}},d=function(e,t,r){if(!function(e){try{var t=Object.getPrototypeOf(e);return t===Object.prototype||t===Array.prototype}catch(e){return!1}}(e))return e;var n=r&&r.get(e);return n||((n=l()).proxy=new Proxy(function(e){return Object.isFrozen(e)?Array.isArray(e)?Array.from(e):Object.assign({},e):e}(e),n),n.originalObj=e,r&&r.set(e,n)),n.affected=t,n.proxyCache=r,n.proxy},y=function(e,t){var r=Reflect.ownKeys(e),n=Reflect.ownKeys(t);return r.length!==n.length||r.some(function(e,t){return e!==n[t]})},b=function e(t,r,n,o,u){if(t===r)return!1;if("object"!==a(t)||null===t)return!0;if("object"!==a(r)||null===r)return!0;var c=n.get(t);if(!c)return!!u;if(o){var i=o.get(t);if(i&&i.nextObj===r)return i.changed;o.set(t,{nextObj:r})}var s=null,l=!0,d=!1,b=void 0;try{for(var h,p=c[Symbol.iterator]();!(l=(h=p.next()).done);l=!0){var v=h.value,g=v===f?y(t,r):e(t[v],r[v],n,o,!1!==u);if("boolean"==typeof g&&(s=g),s)break}}catch(e){d=!0,b=e}finally{try{l||null==p.return||p.return()}finally{if(d)throw b}}return null===s&&(s=!!u),o&&o.set(t,{nextObj:r,changed:s}),s},h=function(e){return"function"==typeof e},p=function(e,t){return e===t};e.Provider=function(e){var r=e.store,n=e.customContext,u=void 0===n?s:n,c=e.children,i=o(),a=r.getState(),f=t.useRef([]);f.current.forEach(function(e){return e(a)});var l=t.useCallback(function(e){return f.current.push(e),e(r.getState()),function(){var t=f.current.indexOf(e);f.current.splice(t,1)}},[r]);return t.useEffect(function(){return r.subscribe(function(){i()})},[r,i]),t.createElement(u.Provider,{value:{state:a,dispatch:r.dispatch,subscribe:l}},c)},e.createCustomContext=i,e.useDispatch=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.customContext,n=void 0===r?s:r,o=t.useContext(n),u=o.dispatch;return u},e.useSelector=function(e,n,u){var c=u||!h(n)&&n||{},i=c.equalityFn,a=void 0===i?h(n)?n:p:i,f=c.customContext,l=void 0===f?s:f,d=o(),y=t.useContext(l),b=y.state,v=y.subscribe,g=e(b),x=t.useRef(null);return r(function(){x.current={equalityFn:a,selector:e,state:b,selected:g}}),t.useEffect(function(){return v(function(e){try{if(x.current.state===e||x.current.equalityFn(x.current.selected,x.current.selector(e)))return}catch(e){}d()})},[v,d]),g},e.useTrackedState=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.customContext,u=void 0===n?s:n,c=o(),i=t.useContext(u),a=i.state,f=i.subscribe,l=new WeakMap,y=t.useRef(null);r(function(){y.current={state:a,affected:l,cache:new WeakMap,assumeChangedIfNotAffected:!!e.unstable_forceUpdateForStateChange||!e.unstable_ignoreIntermediateObjectUsage&&null}}),t.useEffect(function(){return f(function(e){y.current.state!==e&&b(y.current.state,e,y.current.affected,y.current.cache,y.current.assumeChangedIfNotAffected)&&c()})},[f,c]);var h=t.useRef(new WeakMap);return d(a,l,h.current)},Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/runBenchmarks.js b/runBenchmarks.js index 4c13cf6..c39ac51 100644 --- a/runBenchmarks.js +++ b/runBenchmarks.js @@ -10,6 +10,9 @@ const _ = require("lodash"); const serverUtils = require("./utils/server.js"); const sources = readdirSync(join(__dirname, "sources")); +const benchmarks = [...new Set(sources.map( + s => s.replace(/-(connect|useSelector|useTrackedState)$/, '') +))]; const VERSIONS_FOLDER = join(__dirname, "react-redux-versions"); @@ -20,9 +23,19 @@ const versions = readdirSync(VERSIONS_FOLDER).map(version => const reduxVersions = process.env.REDUX ? process.env.REDUX.trim().split(":") : versions; +const reduxTypeVersions = reduxVersions.reduce((a, v) => { + if (v.startsWith("rrr-")) { + return a.concat([["useSelector", v], ["useTrackedState", v]]); + } + const [, major, minor] = /^(\d+)\.(\d+)\./.exec(v); + if (major >= 7 && minor >= 1) { + return a.concat([["connect", v], ["useSelector", v]]); + } + return a.concat([["connect", v]]); +}, []); const benchmarksToRun = process.env.BENCHMARKS ? process.env.BENCHMARKS.split(":") - : sources; + : benchmarks; const length = process.env.SECONDS ? process.env.SECONDS : 30; const trace = process.env.BENCHMARK_TRACE ? process.env.BENCHMARK_TRACE === "true" @@ -51,7 +64,7 @@ function printBenchmarkResults(benchmark, versionPerfEntries) { const table = new Table({ head: [ - "Version", + "Type-Version", "Avg FPS", "Render\n(Mount, Avg)", ...traceCategories, @@ -150,13 +163,13 @@ async function runBenchmarks() { const versionPerfEntries = {}; - const source = join(__dirname, "runs", benchmark); console.log(`Running benchmark ${benchmark}`); - for (let i = 0; i < reduxVersions.length; i++) { - const version = reduxVersions[i]; + for (let i = 0; i < reduxTypeVersions.length; i++) { + const [type, version] = reduxTypeVersions[i]; + const source = join(__dirname, "runs", `${benchmark}-${type}`); const toRun = join(source, version); - console.log(` react-redux version: ${version}`); + console.log(` react-redux type-version: ${type}-${version}`); const browser = await puppeteer.launch({ //headless: false }); @@ -187,7 +200,7 @@ async function runBenchmarks() { const traceFilename = join( __dirname, "runs", - `trace-${benchmark}-${version}.json` + `trace-${benchmark}-${type}-${version}.json` ); traceRunResults = await serverUtils.capturePageStats( browser, @@ -197,7 +210,7 @@ async function runBenchmarks() { ); } - versionPerfEntries[version] = calculateBenchmarkStats( + versionPerfEntries[`${type}-${version}`] = calculateBenchmarkStats( fpsRunResults, categories, traceRunResults diff --git a/sources/deeptree-nested/.gitignore b/sources/deeptree-connect/.gitignore similarity index 100% rename from sources/deeptree-nested/.gitignore rename to sources/deeptree-connect/.gitignore diff --git a/sources/deeptree-nested/README.md b/sources/deeptree-connect/README.md similarity index 100% rename from sources/deeptree-nested/README.md rename to sources/deeptree-connect/README.md diff --git a/sources/deeptree/config-overrides.js b/sources/deeptree-connect/config-overrides.js similarity index 100% rename from sources/deeptree/config-overrides.js rename to sources/deeptree-connect/config-overrides.js diff --git a/sources/deeptree/package.json b/sources/deeptree-connect/package.json similarity index 100% rename from sources/deeptree/package.json rename to sources/deeptree-connect/package.json diff --git a/sources/deeptree-nested/public/bootstrap.min.css b/sources/deeptree-connect/public/bootstrap.min.css similarity index 100% rename from sources/deeptree-nested/public/bootstrap.min.css rename to sources/deeptree-connect/public/bootstrap.min.css diff --git a/sources/deeptree-nested/public/favicon.ico b/sources/deeptree-connect/public/favicon.ico similarity index 100% rename from sources/deeptree-nested/public/favicon.ico rename to sources/deeptree-connect/public/favicon.ico diff --git a/sources/deeptree-nested/public/index.html b/sources/deeptree-connect/public/index.html similarity index 100% rename from sources/deeptree-nested/public/index.html rename to sources/deeptree-connect/public/index.html diff --git a/sources/deeptree-nested/public/manifest.json b/sources/deeptree-connect/public/manifest.json similarity index 100% rename from sources/deeptree-nested/public/manifest.json rename to sources/deeptree-connect/public/manifest.json diff --git a/sources/deeptree-nested/public/static/css/bootstrap.min.css b/sources/deeptree-connect/public/static/css/bootstrap.min.css similarity index 100% rename from sources/deeptree-nested/public/static/css/bootstrap.min.css rename to sources/deeptree-connect/public/static/css/bootstrap.min.css diff --git a/sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.eot b/sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.eot rename to sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.eot diff --git a/sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.svg b/sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.svg rename to sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.svg diff --git a/sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.ttf b/sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.ttf rename to sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.ttf diff --git a/sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.woff b/sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.woff rename to sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.woff diff --git a/sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.woff2 b/sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from sources/deeptree-nested/public/static/fonts/glyphicons-halflings-regular.woff2 rename to sources/deeptree-connect/public/static/fonts/glyphicons-halflings-regular.woff2 diff --git a/sources/deeptree-nested/src/App.css b/sources/deeptree-connect/src/App.css similarity index 100% rename from sources/deeptree-nested/src/App.css rename to sources/deeptree-connect/src/App.css diff --git a/sources/deeptree/src/App.js b/sources/deeptree-connect/src/App.js similarity index 100% rename from sources/deeptree/src/App.js rename to sources/deeptree-connect/src/App.js diff --git a/sources/deeptree/src/Slice.jsx b/sources/deeptree-connect/src/Slice.jsx similarity index 100% rename from sources/deeptree/src/Slice.jsx rename to sources/deeptree-connect/src/Slice.jsx diff --git a/sources/deeptree/src/configureStore.js b/sources/deeptree-connect/src/configureStore.js similarity index 100% rename from sources/deeptree/src/configureStore.js rename to sources/deeptree-connect/src/configureStore.js diff --git a/sources/deeptree/src/constants.js b/sources/deeptree-connect/src/constants.js similarity index 100% rename from sources/deeptree/src/constants.js rename to sources/deeptree-connect/src/constants.js diff --git a/sources/deeptree/src/counters.js b/sources/deeptree-connect/src/counters.js similarity index 100% rename from sources/deeptree/src/counters.js rename to sources/deeptree-connect/src/counters.js diff --git a/sources/deeptree-nested/src/index.css b/sources/deeptree-connect/src/index.css similarity index 100% rename from sources/deeptree-nested/src/index.css rename to sources/deeptree-connect/src/index.css diff --git a/sources/deeptree/src/index.js b/sources/deeptree-connect/src/index.js similarity index 100% rename from sources/deeptree/src/index.js rename to sources/deeptree-connect/src/index.js diff --git a/sources/deeptree-nested/yarn.lock b/sources/deeptree-connect/yarn.lock similarity index 100% rename from sources/deeptree-nested/yarn.lock rename to sources/deeptree-connect/yarn.lock diff --git a/sources/deeptree/.gitignore b/sources/deeptree-nested-connect/.gitignore similarity index 100% rename from sources/deeptree/.gitignore rename to sources/deeptree-nested-connect/.gitignore diff --git a/sources/deeptree/README.md b/sources/deeptree-nested-connect/README.md similarity index 100% rename from sources/deeptree/README.md rename to sources/deeptree-nested-connect/README.md diff --git a/sources/deeptree-nested/config-overrides.js b/sources/deeptree-nested-connect/config-overrides.js similarity index 100% rename from sources/deeptree-nested/config-overrides.js rename to sources/deeptree-nested-connect/config-overrides.js diff --git a/sources/deeptree-nested/package.json b/sources/deeptree-nested-connect/package.json similarity index 100% rename from sources/deeptree-nested/package.json rename to sources/deeptree-nested-connect/package.json diff --git a/sources/deeptree/public/bootstrap.min.css b/sources/deeptree-nested-connect/public/bootstrap.min.css similarity index 100% rename from sources/deeptree/public/bootstrap.min.css rename to sources/deeptree-nested-connect/public/bootstrap.min.css diff --git a/sources/deeptree/public/favicon.ico b/sources/deeptree-nested-connect/public/favicon.ico similarity index 100% rename from sources/deeptree/public/favicon.ico rename to sources/deeptree-nested-connect/public/favicon.ico diff --git a/sources/deeptree/public/index.html b/sources/deeptree-nested-connect/public/index.html similarity index 100% rename from sources/deeptree/public/index.html rename to sources/deeptree-nested-connect/public/index.html diff --git a/sources/deeptree/public/manifest.json b/sources/deeptree-nested-connect/public/manifest.json similarity index 100% rename from sources/deeptree/public/manifest.json rename to sources/deeptree-nested-connect/public/manifest.json diff --git a/sources/deeptree/public/static/css/bootstrap.min.css b/sources/deeptree-nested-connect/public/static/css/bootstrap.min.css similarity index 100% rename from sources/deeptree/public/static/css/bootstrap.min.css rename to sources/deeptree-nested-connect/public/static/css/bootstrap.min.css diff --git a/sources/deeptree/public/static/fonts/glyphicons-halflings-regular.eot b/sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from sources/deeptree/public/static/fonts/glyphicons-halflings-regular.eot rename to sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.eot diff --git a/sources/deeptree/public/static/fonts/glyphicons-halflings-regular.svg b/sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from sources/deeptree/public/static/fonts/glyphicons-halflings-regular.svg rename to sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.svg diff --git a/sources/deeptree/public/static/fonts/glyphicons-halflings-regular.ttf b/sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from sources/deeptree/public/static/fonts/glyphicons-halflings-regular.ttf rename to sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.ttf diff --git a/sources/deeptree/public/static/fonts/glyphicons-halflings-regular.woff b/sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from sources/deeptree/public/static/fonts/glyphicons-halflings-regular.woff rename to sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.woff diff --git a/sources/deeptree/public/static/fonts/glyphicons-halflings-regular.woff2 b/sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from sources/deeptree/public/static/fonts/glyphicons-halflings-regular.woff2 rename to sources/deeptree-nested-connect/public/static/fonts/glyphicons-halflings-regular.woff2 diff --git a/sources/deeptree/src/App.css b/sources/deeptree-nested-connect/src/App.css similarity index 100% rename from sources/deeptree/src/App.css rename to sources/deeptree-nested-connect/src/App.css diff --git a/sources/deeptree-nested/src/App.js b/sources/deeptree-nested-connect/src/App.js similarity index 100% rename from sources/deeptree-nested/src/App.js rename to sources/deeptree-nested-connect/src/App.js diff --git a/sources/deeptree-nested/src/Slice.jsx b/sources/deeptree-nested-connect/src/Slice.jsx similarity index 100% rename from sources/deeptree-nested/src/Slice.jsx rename to sources/deeptree-nested-connect/src/Slice.jsx diff --git a/sources/deeptree-nested/src/configureStore.js b/sources/deeptree-nested-connect/src/configureStore.js similarity index 100% rename from sources/deeptree-nested/src/configureStore.js rename to sources/deeptree-nested-connect/src/configureStore.js diff --git a/sources/deeptree-nested/src/constants.js b/sources/deeptree-nested-connect/src/constants.js similarity index 100% rename from sources/deeptree-nested/src/constants.js rename to sources/deeptree-nested-connect/src/constants.js diff --git a/sources/deeptree-nested/src/counters.js b/sources/deeptree-nested-connect/src/counters.js similarity index 100% rename from sources/deeptree-nested/src/counters.js rename to sources/deeptree-nested-connect/src/counters.js diff --git a/sources/deeptree/src/index.css b/sources/deeptree-nested-connect/src/index.css similarity index 100% rename from sources/deeptree/src/index.css rename to sources/deeptree-nested-connect/src/index.css diff --git a/sources/deeptree-nested/src/index.js b/sources/deeptree-nested-connect/src/index.js similarity index 100% rename from sources/deeptree-nested/src/index.js rename to sources/deeptree-nested-connect/src/index.js diff --git a/sources/deeptree-nested/src/strings.js b/sources/deeptree-nested-connect/src/strings.js similarity index 100% rename from sources/deeptree-nested/src/strings.js rename to sources/deeptree-nested-connect/src/strings.js diff --git a/sources/deeptree/yarn.lock b/sources/deeptree-nested-connect/yarn.lock similarity index 100% rename from sources/deeptree/yarn.lock rename to sources/deeptree-nested-connect/yarn.lock diff --git a/sources/stockticker/.gitignore b/sources/deeptree-nested-useSelector/.gitignore similarity index 100% rename from sources/stockticker/.gitignore rename to sources/deeptree-nested-useSelector/.gitignore diff --git a/sources/stockticker/README.md b/sources/deeptree-nested-useSelector/README.md similarity index 100% rename from sources/stockticker/README.md rename to sources/deeptree-nested-useSelector/README.md diff --git a/sources/forms/config-overrides.js b/sources/deeptree-nested-useSelector/config-overrides.js similarity index 100% rename from sources/forms/config-overrides.js rename to sources/deeptree-nested-useSelector/config-overrides.js diff --git a/sources/deeptree-nested-useSelector/package.json b/sources/deeptree-nested-useSelector/package.json new file mode 100644 index 0000000..5c72519 --- /dev/null +++ b/sources/deeptree-nested-useSelector/package.json @@ -0,0 +1,38 @@ +{ + "name": "deeptree-nested", + "version": "0.1.0", + "private": true, + "dependencies": { + "chance": "^1.0.16", + "fps-emit": "file:../../fps-emit", + "react": "^16.6.0", + "react-dom": "^16.6.0", + "react-redux": "^5.1.0", + "react-scripts": "2.0.3", + "redux": "^4.0.0", + "redux-starter-kit": "^0.4.3", + "reselect": "^3.0.1" + }, + "scripts": { + "start": "react-app-rewired start", + "build": "react-app-rewired build", + "test": "react-app-rewired --env=jsdom", + "eject": "react-scripts eject", + "test:e2e": "jest --watch" + }, + "browserslist": { + "development": [ + "last 2 chrome versions", + "last 2 firefox versions", + "last 2 edge versions" + ], + "production": [ + ">0.25%", + "not op_mini all", + "ie 11" + ] + }, + "devDependencies": { + "react-app-rewired": "^1.5.2" + } +} diff --git a/sources/stockticker/public/bootstrap.min.css b/sources/deeptree-nested-useSelector/public/bootstrap.min.css similarity index 100% rename from sources/stockticker/public/bootstrap.min.css rename to sources/deeptree-nested-useSelector/public/bootstrap.min.css diff --git a/sources/forms/public/favicon.ico b/sources/deeptree-nested-useSelector/public/favicon.ico similarity index 100% rename from sources/forms/public/favicon.ico rename to sources/deeptree-nested-useSelector/public/favicon.ico diff --git a/sources/stockticker/public/index.html b/sources/deeptree-nested-useSelector/public/index.html similarity index 100% rename from sources/stockticker/public/index.html rename to sources/deeptree-nested-useSelector/public/index.html diff --git a/sources/forms/public/manifest.json b/sources/deeptree-nested-useSelector/public/manifest.json similarity index 100% rename from sources/forms/public/manifest.json rename to sources/deeptree-nested-useSelector/public/manifest.json diff --git a/sources/stockticker/public/static/css/bootstrap.min.css b/sources/deeptree-nested-useSelector/public/static/css/bootstrap.min.css similarity index 100% rename from sources/stockticker/public/static/css/bootstrap.min.css rename to sources/deeptree-nested-useSelector/public/static/css/bootstrap.min.css diff --git a/sources/stockticker/public/static/fonts/glyphicons-halflings-regular.eot b/sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from sources/stockticker/public/static/fonts/glyphicons-halflings-regular.eot rename to sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.eot diff --git a/sources/stockticker/public/static/fonts/glyphicons-halflings-regular.svg b/sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from sources/stockticker/public/static/fonts/glyphicons-halflings-regular.svg rename to sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.svg diff --git a/sources/stockticker/public/static/fonts/glyphicons-halflings-regular.ttf b/sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from sources/stockticker/public/static/fonts/glyphicons-halflings-regular.ttf rename to sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.ttf diff --git a/sources/stockticker/public/static/fonts/glyphicons-halflings-regular.woff b/sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from sources/stockticker/public/static/fonts/glyphicons-halflings-regular.woff rename to sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.woff diff --git a/sources/stockticker/public/static/fonts/glyphicons-halflings-regular.woff2 b/sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.woff2 similarity index 100% rename from sources/stockticker/public/static/fonts/glyphicons-halflings-regular.woff2 rename to sources/deeptree-nested-useSelector/public/static/fonts/glyphicons-halflings-regular.woff2 diff --git a/sources/stockticker/src/App.css b/sources/deeptree-nested-useSelector/src/App.css similarity index 100% rename from sources/stockticker/src/App.css rename to sources/deeptree-nested-useSelector/src/App.css diff --git a/sources/deeptree-nested-useSelector/src/App.js b/sources/deeptree-nested-useSelector/src/App.js new file mode 100644 index 0000000..888c9b5 --- /dev/null +++ b/sources/deeptree-nested-useSelector/src/App.js @@ -0,0 +1,76 @@ +import React from "react"; +import { useSelector, useDispatch } from "react-redux"; + +import Slice from "./Slice"; +import * as c from "./constants"; +import { incrementMany, incrementRandomCounter } from "./counters"; +import { appendRandomCharacter, appendRandomCharToMany } from "./strings"; + +let slicesNaiveCache; + +const App = () => { + const dispatch = useDispatch(); + const slices = useSelector(state => { + if (!slicesNaiveCache) { + slicesNaiveCache = Array.from({ length: c.NUMBER_OF_SLICES }).map( + (dummy, idx) => idx + ); + //slicesNaiveCache.sort(); + } + return slicesNaiveCache; + }); + const actionIncrementRandomCounter = () => { + dispatch(incrementRandomCounter()); + }; + const actionIncrementFifth = () => { + dispatch(incrementMany({ mod: 5 })); + }; + const actionIncrementThird = () => { + dispatch(incrementMany({ mod: 3 })); + }; + const actionAppendRandomCharacter = () => { + dispatch(appendRandomCharacter()); + }; + const actionAppendMany = () => { + dispatch(appendRandomCharToMany(4)); + }; + return ( +
+
+ + + + + +
+
+ {slices.map((slice, idx) => { + return ( +
+ +
+ ); + })} +
+
+ ); +}; +App.displayName = "App"; + +export default App; diff --git a/sources/deeptree-nested-useSelector/src/Slice.jsx b/sources/deeptree-nested-useSelector/src/Slice.jsx new file mode 100644 index 0000000..482895a --- /dev/null +++ b/sources/deeptree-nested-useSelector/src/Slice.jsx @@ -0,0 +1,73 @@ +import React, { useEffect } from "react"; +import { shallowEqual, useSelector, useDispatch } from "react-redux"; + +import { initialize, createStringId } from "./strings"; +import { TEXT_INPUT_MOD } from "./constants"; + +const naiveShallowObjEqual = (a, b) => { + // reactive-react-redux doesn't export shallowEqual + const keysA = Object.keys(a); + const keysB = Object.keys(b); + if (keysA.length !== keysB.length) return false; + return keysA.every(key => a[key] === b[key]); +}; + +const Counter = ({ idx }) => { + const value = useSelector(state => state.counters[idx]); + return
Value: {value}
; +}; + +Counter.displayName = "Counter"; + +const TextDisplay = ({ idx, inputId, children }) => { + const dispatch = useDispatch(); + const { text, stringId } = useSelector(state => { + const stringId = createStringId(idx, inputId); //`${idx}-${remainingDepth}`; + const text = state.strings[stringId] || "unknown"; + return { text, stringId }; + }, shallowEqual || naiveShallowObjEqual); + + useEffect(() => { + dispatch(initialize({ stringId })); + }, []); + + return ( +
+ Text {stringId}:
+