mobx-react-lite
Advanced tools
Comparing version 3.1.5 to 3.1.6
# mobx-react-lite | ||
## 3.1.6 | ||
### Patch Changes | ||
- [`2f3dcb27`](https://github.com/mobxjs/mobx/commit/2f3dcb274f795ffca4ae724b6b4795958620838d) Thanks [@FredyC](https://github.com/FredyC)! - Fix names of UMD exports [#2517](https://github.com/mobxjs/mobx/issues/2617) | ||
- Updated dependencies [[`79a09f49`](https://github.com/mobxjs/mobx/commit/79a09f49a9f2baddbab8d89e9a7ac07cffadf624)]: | ||
- mobx@6.0.4 | ||
## 3.1.5 | ||
@@ -4,0 +13,0 @@ |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx'), require('react'), require('react-dom')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'mobx', 'react', 'react-dom'], factory) : | ||
(global = global || self, factory(global.mobxreactlite = {}, global.mobx, global.React, global.ReactDOM)); | ||
(global = global || self, factory(global.mobxReactLite = {}, global.mobx, global.React, global.ReactDOM)); | ||
}(this, (function (exports, mobx, React, reactDom) { 'use strict'; | ||
@@ -6,0 +6,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("mobx"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","mobx","react","react-dom"],r):r((e=e||self).mobxreactlite={},e.mobx,e.React,e.ReactDOM)}(this,(function(e,r,n,t){"use strict";var o="default"in n?n.default:n;if(!n.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!r.makeObservable)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function i(e){e()}function u(e){e||(e=i),r.configure({reactionScheduler:e})}var a=[];function c(e){return r.getDependencyTree(e)}var f="undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry;function s(e){return{reaction:e,mounted:!1,changedBeforeMount:!1,cleanAt:Date.now()+d}}var d=1e4;function l(e){var r=new Map,n=1,t=new e((function(e){var n=r.get(e);n&&(n.reaction.dispose(),r.delete(e))}));return{addReactionToTrack:function(e,o,i){var u=n++;return t.register(i,u,e),e.current=s(o),e.current.finalizationRegistryCleanupToken=u,r.set(u,e.current),e.current},recordReactionAsCommitted:function(e){t.unregister(e),e.current&&e.current.finalizationRegistryCleanupToken&&r.delete(e.current.finalizationRegistryCleanupToken)},forceCleanupTimerToRunNowForTests:function(){},resetCleanupScheduleForTests:function(){}}}function v(){return(v=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function p(){var e,r=new Set;function n(){void 0===e&&(e=setTimeout(t,1e4))}function t(){e=void 0;var t=Date.now();r.forEach((function(e){var n=e.current;n&&t>=n.cleanAt&&(n.reaction.dispose(),e.current=null,r.delete(e))})),r.size>0&&n()}return{addReactionToTrack:function(e,t,o){return e.current=s(t),r.add(e),n(),e.current},recordReactionAsCommitted:function(e){r.delete(e)},forceCleanupTimerToRunNowForTests:function(){e&&(clearTimeout(e),t())},resetCleanupScheduleForTests:function(){if(r.size>0){for(var n,t=function(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return b(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,void 0):void 0}}(e))){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(r);!(n=t()).done;){var o=n.value,i=o.current;i&&(i.reaction.dispose(),o.current=null)}r.clear()}e&&(clearTimeout(e),e=void 0)}}}var m=f?l(f):p(),y=m.addReactionToTrack,g=m.recordReactionAsCommitted,h=m.resetCleanupScheduleForTests,R=!1;function w(e){R=e}function T(){return R}function S(e){return"observer"+e}var O=function(){};function A(e,t){if(void 0===t&&(t="observed"),T())return e();var i,u=o.useState(new O)[0],f=(i=n.useState(0)[1],n.useCallback((function(){i((function(e){return e+1}))}),a)),s=o.useRef(null);if(!s.current)var d=new r.Reaction(S(t),(function(){l.mounted?f():l.changedBeforeMount=!0})),l=y(s,d,u);var v,b,p=s.current.reaction;if(o.useDebugValue(p,c),o.useEffect((function(){return g(s),s.current?(s.current.mounted=!0,s.current.changedBeforeMount&&(s.current.changedBeforeMount=!1,f())):(s.current={reaction:new r.Reaction(S(t),(function(){f()})),mounted:!0,changedBeforeMount:!1,cleanAt:Infinity},f()),function(){s.current.reaction.dispose(),s.current=null}}),[]),p.track((function(){try{v=e()}catch(e){b=e}})),b)throw b;return v}var C={$$typeof:!0,render:!0,compare:!0,type:!0};function j(e){var r=e.children||e.render;return"function"!=typeof r?null:A(r)}function k(e){var t=n.useState((function(){return r.observable(e,{},{deep:!1})}))[0];return r.runInAction((function(){Object.assign(t,e)})),t}j.displayName="Observer",u(t.unstable_batchedUpdates),e.Observer=j,e.clearTimers=h,e.enableStaticRendering=w,e.isObserverBatched=function(){return!0},e.isUsingStaticRendering=T,e.observer=function(e,r){if(T())return e;var t,o,i,u=v({forwardRef:!1},r),a=e.displayName||e.name,c=function(r,n){return A((function(){return e(r,n)}),a)};return c.displayName=a,t=n.memo(u.forwardRef?n.forwardRef(c):c),o=e,i=t,Object.keys(o).forEach((function(e){C[e]||Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(o,e))})),t.displayName=a,t},e.observerBatching=u,e.useAsObservableSource=k,e.useLocalObservable=function(e,t){return n.useState((function(){return r.observable(e(),t,{autoBind:!0})}))[0]},e.useLocalStore=function(e,t){var o=t&&k(t);return n.useState((function(){return r.observable(e(o),void 0,{autoBind:!0})}))[0]},e.useObserver=function(e,r){return void 0===r&&(r="observed"),A(e,r)},e.useStaticRendering=function(e){w(e)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("mobx"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","mobx","react","react-dom"],r):r((e=e||self).mobxReactLite={},e.mobx,e.React,e.ReactDOM)}(this,(function(e,r,n,t){"use strict";var o="default"in n?n.default:n;if(!n.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!r.makeObservable)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function i(e){e()}function u(e){e||(e=i),r.configure({reactionScheduler:e})}var a=[];function c(e){return r.getDependencyTree(e)}var f="undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry;function s(e){return{reaction:e,mounted:!1,changedBeforeMount:!1,cleanAt:Date.now()+d}}var d=1e4;function l(e){var r=new Map,n=1,t=new e((function(e){var n=r.get(e);n&&(n.reaction.dispose(),r.delete(e))}));return{addReactionToTrack:function(e,o,i){var u=n++;return t.register(i,u,e),e.current=s(o),e.current.finalizationRegistryCleanupToken=u,r.set(u,e.current),e.current},recordReactionAsCommitted:function(e){t.unregister(e),e.current&&e.current.finalizationRegistryCleanupToken&&r.delete(e.current.finalizationRegistryCleanupToken)},forceCleanupTimerToRunNowForTests:function(){},resetCleanupScheduleForTests:function(){}}}function v(){return(v=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function p(){var e,r=new Set;function n(){void 0===e&&(e=setTimeout(t,1e4))}function t(){e=void 0;var t=Date.now();r.forEach((function(e){var n=e.current;n&&t>=n.cleanAt&&(n.reaction.dispose(),e.current=null,r.delete(e))})),r.size>0&&n()}return{addReactionToTrack:function(e,t,o){return e.current=s(t),r.add(e),n(),e.current},recordReactionAsCommitted:function(e){r.delete(e)},forceCleanupTimerToRunNowForTests:function(){e&&(clearTimeout(e),t())},resetCleanupScheduleForTests:function(){if(r.size>0){for(var n,t=function(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return b(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,void 0):void 0}}(e))){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(r);!(n=t()).done;){var o=n.value,i=o.current;i&&(i.reaction.dispose(),o.current=null)}r.clear()}e&&(clearTimeout(e),e=void 0)}}}var m=f?l(f):p(),y=m.addReactionToTrack,g=m.recordReactionAsCommitted,h=m.resetCleanupScheduleForTests,R=!1;function w(e){R=e}function T(){return R}function S(e){return"observer"+e}var O=function(){};function A(e,t){if(void 0===t&&(t="observed"),T())return e();var i,u=o.useState(new O)[0],f=(i=n.useState(0)[1],n.useCallback((function(){i((function(e){return e+1}))}),a)),s=o.useRef(null);if(!s.current)var d=new r.Reaction(S(t),(function(){l.mounted?f():l.changedBeforeMount=!0})),l=y(s,d,u);var v,b,p=s.current.reaction;if(o.useDebugValue(p,c),o.useEffect((function(){return g(s),s.current?(s.current.mounted=!0,s.current.changedBeforeMount&&(s.current.changedBeforeMount=!1,f())):(s.current={reaction:new r.Reaction(S(t),(function(){f()})),mounted:!0,changedBeforeMount:!1,cleanAt:Infinity},f()),function(){s.current.reaction.dispose(),s.current=null}}),[]),p.track((function(){try{v=e()}catch(e){b=e}})),b)throw b;return v}var C={$$typeof:!0,render:!0,compare:!0,type:!0};function j(e){var r=e.children||e.render;return"function"!=typeof r?null:A(r)}function k(e){var t=n.useState((function(){return r.observable(e,{},{deep:!1})}))[0];return r.runInAction((function(){Object.assign(t,e)})),t}j.displayName="Observer",u(t.unstable_batchedUpdates),e.Observer=j,e.clearTimers=h,e.enableStaticRendering=w,e.isObserverBatched=function(){return!0},e.isUsingStaticRendering=T,e.observer=function(e,r){if(T())return e;var t,o,i,u=v({forwardRef:!1},r),a=e.displayName||e.name,c=function(r,n){return A((function(){return e(r,n)}),a)};return c.displayName=a,t=n.memo(u.forwardRef?n.forwardRef(c):c),o=e,i=t,Object.keys(o).forEach((function(e){C[e]||Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(o,e))})),t.displayName=a,t},e.observerBatching=u,e.useAsObservableSource=k,e.useLocalObservable=function(e,t){return n.useState((function(){return r.observable(e(),t,{autoBind:!0})}))[0]},e.useLocalStore=function(e,t){var o=t&&k(t);return n.useState((function(){return r.observable(e(o),void 0,{autoBind:!0})}))[0]},e.useObserver=function(e,r){return void 0===r&&(r="observed"),A(e,r)},e.useStaticRendering=function(e){w(e)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=mobxreactlite.umd.production.min.js.map |
{ | ||
"name": "mobx-react-lite", | ||
"version": "3.1.5", | ||
"version": "3.1.6", | ||
"description": "Lightweight React bindings for MobX based on React 16.8+ and Hooks", | ||
@@ -42,3 +42,3 @@ "source": "src/index.ts", | ||
"peerDependencies": { | ||
"mobx": "^6.0.0", | ||
"mobx": "^6.0.4", | ||
"react": "^16.8.0 || ^17" | ||
@@ -55,3 +55,3 @@ }, | ||
"devDependencies": { | ||
"mobx": "^6.0.0", | ||
"mobx": "^6.0.4", | ||
"expose-gc": "^1.0.0" | ||
@@ -72,3 +72,3 @@ }, | ||
"lint": "eslint src/**/* --ext .js,.ts,.tsx", | ||
"build": "node ../../scripts/build.js mobxreactlite", | ||
"build": "node ../../scripts/build.js mobxReactLite", | ||
"build:test": "yarn build --target test", | ||
@@ -75,0 +75,0 @@ "build:cjs": "tsc --project tsconfig.build.cjs.json", |
467518