mobx 6.13.7 → 6.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +2 -1
- package/dist/api/flow.d.ts +4 -4
- package/dist/api/observable.d.ts +10 -2
- package/dist/mobx.cjs.development.js +75 -10
- package/dist/mobx.cjs.development.js.map +1 -1
- package/dist/mobx.cjs.production.min.js +1 -1
- package/dist/mobx.cjs.production.min.js.map +1 -1
- package/dist/mobx.d.ts +1 -1
- package/dist/mobx.esm.js +75 -10
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.umd.development.js +75 -10
- package/dist/mobx.umd.development.js.map +1 -1
- package/dist/mobx.umd.production.min.js +1 -1
- package/dist/mobx.umd.production.min.js.map +1 -1
- package/dist/types/observablemap.d.ts +1 -1
- package/package.json +5 -5
- package/src/api/flow.ts +10 -3
- package/src/api/observable.ts +22 -4
- package/src/core/reaction.ts +4 -0
- package/src/mobx.ts +1 -0
- package/src/types/autoannotation.ts +5 -2
- package/src/types/observablemap.ts +1 -1
- package/src/types/observablevalue.ts +1 -1
- package/dist/mobx.esm.development.js +0 -5935
- package/dist/mobx.esm.development.js.map +0 -1
- package/dist/mobx.esm.production.min.js +0 -2
- package/dist/mobx.esm.production.min.js.map +0 -1
package/dist/mobx.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { IObservable, IDepTreeNode, Reaction, IReactionPublic, IReactionDisposer, untracked, IAtom, createAtom, spy, IComputedValue, IEqualsComparer, comparer, IEnhancer, IInterceptable, IInterceptor, IListenable, IObjectWillChange, IObjectDidChange, isObservableObject, IValueDidChange, IValueWillChange, IObservableValue, isObservableValue as isBoxedObservable, IObservableArray, IArrayWillChange, IArrayWillSplice, IArraySplice, IArrayUpdate, IArrayDidChange, isObservableArray, IKeyValueMap, ObservableMap, IMapEntries, IMapEntry, IMapWillChange, IMapDidChange, isObservableMap, IObservableMapInitialValues, ObservableSet, isObservableSet, ISetDidChange, ISetWillChange, IObservableSetInitialValues, transaction, observable, IObservableFactory, CreateObservableOptions, computed, IComputedFactory, isObservable, isObservableProp, isComputed, isComputedProp, extendObservable, observe, intercept, autorun, IAutorunOptions, reaction, IReactionOptions, when, IWhenOptions, action, isAction, runInAction, IActionFactory, keys, values, entries, set, remove, has, get, apiOwnKeys as ownKeys, apiDefineProperty as defineProperty, configure, onBecomeObserved, onBecomeUnobserved, flow, isFlow, flowResult, FlowCancellationError, isFlowCancellationError, toJS, trace, IObserverTree, IDependencyTree, getDependencyTree, getObserverTree, resetGlobalState as _resetGlobalState, getGlobalState as _getGlobalState, getDebugName, getAtom, getAdministration as _getAdministration, allowStateChanges as _allowStateChanges, runInAction as _allowStateChangesInsideComputed, // This has become the default behavior in Mobx 6
|
|
1
|
+
export { IObservable, IDepTreeNode, Reaction, IReactionPublic, IReactionDisposer, untracked, IAtom, createAtom, spy, IComputedValue, IEqualsComparer, comparer, IEnhancer, IInterceptable, IInterceptor, IListenable, IObjectWillChange, IObjectDidChange, isObservableObject, IValueDidChange, IValueWillChange, IObservableValue, isObservableValue as isBoxedObservable, IObservableArray, IArrayWillChange, IArrayWillSplice, IArraySplice, IArrayUpdate, IArrayDidChange, isObservableArray, IKeyValueMap, ObservableMap, IMapEntries, IMapEntry, IMapWillChange, IMapDidChange, isObservableMap, IObservableMapInitialValues, ObservableSet, isObservableSet, ISetDidChange, ISetWillChange, IObservableSetInitialValues, transaction, observable, IObservableFactory, CreateObservableOptions, computed, IComputedFactory, isObservable, isObservableProp, isComputed, isComputedProp, extendObservable, observe, intercept, autorun, IAutorunOptions, reaction, IReactionOptions, when, IWhenOptions, action, isAction, runInAction, IActionFactory, keys, values, entries, set, remove, has, get, apiOwnKeys as ownKeys, apiDefineProperty as defineProperty, configure, onBecomeObserved, onBecomeUnobserved, flow, isFlow, flowResult, CancellablePromise, FlowCancellationError, isFlowCancellationError, toJS, trace, IObserverTree, IDependencyTree, getDependencyTree, getObserverTree, resetGlobalState as _resetGlobalState, getGlobalState as _getGlobalState, getDebugName, getAtom, getAdministration as _getAdministration, allowStateChanges as _allowStateChanges, runInAction as _allowStateChangesInsideComputed, // This has become the default behavior in Mobx 6
|
|
2
2
|
Lambda, $mobx, isComputingDerivation as _isComputingDerivation, onReactionError, interceptReads as _interceptReads, IComputedValueOptions, IActionRunInfo, _startAction, _endAction, allowStateReadsStart as _allowStateReadsStart, allowStateReadsEnd as _allowStateReadsEnd, makeObservable, makeAutoObservable, autoAction as _autoAction, AnnotationsMap, AnnotationMapEntry, override } from "./internal";
|
package/dist/mobx.esm.js
CHANGED
|
@@ -289,6 +289,13 @@ function _arrayLikeToArray(r, a) {
|
|
|
289
289
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
290
290
|
return n;
|
|
291
291
|
}
|
|
292
|
+
function _construct(t, e, r) {
|
|
293
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
294
|
+
var o = [null];
|
|
295
|
+
o.push.apply(o, e);
|
|
296
|
+
var p = new (t.bind.apply(t, o))();
|
|
297
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
298
|
+
}
|
|
292
299
|
function _defineProperties(e, r) {
|
|
293
300
|
for (var t = 0; t < r.length; t++) {
|
|
294
301
|
var o = r[t];
|
|
@@ -326,9 +333,29 @@ function _extends() {
|
|
|
326
333
|
return n;
|
|
327
334
|
}, _extends.apply(null, arguments);
|
|
328
335
|
}
|
|
336
|
+
function _getPrototypeOf(t) {
|
|
337
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
338
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
339
|
+
}, _getPrototypeOf(t);
|
|
340
|
+
}
|
|
329
341
|
function _inheritsLoose(t, o) {
|
|
330
342
|
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
331
343
|
}
|
|
344
|
+
function _isNativeFunction(t) {
|
|
345
|
+
try {
|
|
346
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
347
|
+
} catch (n) {
|
|
348
|
+
return "function" == typeof t;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function _isNativeReflectConstruct() {
|
|
352
|
+
try {
|
|
353
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
354
|
+
} catch (t) {}
|
|
355
|
+
return (_isNativeReflectConstruct = function () {
|
|
356
|
+
return !!t;
|
|
357
|
+
})();
|
|
358
|
+
}
|
|
332
359
|
function _setPrototypeOf(t, e) {
|
|
333
360
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
334
361
|
return t.__proto__ = e, t;
|
|
@@ -355,6 +382,28 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
355
382
|
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
356
383
|
}
|
|
357
384
|
}
|
|
385
|
+
function _wrapNativeSuper(t) {
|
|
386
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
387
|
+
return _wrapNativeSuper = function (t) {
|
|
388
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
389
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
390
|
+
if (void 0 !== r) {
|
|
391
|
+
if (r.has(t)) return r.get(t);
|
|
392
|
+
r.set(t, Wrapper);
|
|
393
|
+
}
|
|
394
|
+
function Wrapper() {
|
|
395
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
396
|
+
}
|
|
397
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
398
|
+
constructor: {
|
|
399
|
+
value: Wrapper,
|
|
400
|
+
enumerable: !1,
|
|
401
|
+
writable: !0,
|
|
402
|
+
configurable: !0
|
|
403
|
+
}
|
|
404
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
405
|
+
}, _wrapNativeSuper(t);
|
|
406
|
+
}
|
|
358
407
|
|
|
359
408
|
var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
|
|
360
409
|
/**
|
|
@@ -1007,7 +1056,8 @@ function make_$5(adm, key, descriptor, source) {
|
|
|
1007
1056
|
// lone setter -> action setter
|
|
1008
1057
|
if (descriptor.set) {
|
|
1009
1058
|
// TODO make action applicable to setter and delegate to action.make_
|
|
1010
|
-
var set =
|
|
1059
|
+
var set = isAction(descriptor.set) ? descriptor.set // See #4553
|
|
1060
|
+
: createAction(key.toString(), descriptor.set);
|
|
1011
1061
|
// own
|
|
1012
1062
|
if (source === adm.target_) {
|
|
1013
1063
|
return adm.defineProperty_(key, {
|
|
@@ -1372,13 +1422,14 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1372
1422
|
_this.equals = equals;
|
|
1373
1423
|
_this.value_ = enhancer(value, undefined, name_);
|
|
1374
1424
|
if (process.env.NODE_ENV !== "production" && notifySpy && isSpyEnabled()) {
|
|
1425
|
+
var _this$value_;
|
|
1375
1426
|
// only notify spy if this is a stand-alone observable
|
|
1376
1427
|
spyReport({
|
|
1377
1428
|
type: CREATE,
|
|
1378
1429
|
object: _this,
|
|
1379
1430
|
observableKind: "value",
|
|
1380
1431
|
debugObjectName: _this.name_,
|
|
1381
|
-
newValue: "" + _this.value_
|
|
1432
|
+
newValue: "" + ((_this$value_ = _this.value_) == null ? void 0 : _this$value_.toString())
|
|
1382
1433
|
});
|
|
1383
1434
|
}
|
|
1384
1435
|
return _this;
|
|
@@ -1571,7 +1622,7 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1571
1622
|
}
|
|
1572
1623
|
}
|
|
1573
1624
|
// to check for cycles
|
|
1574
|
-
|
|
1625
|
+
;
|
|
1575
1626
|
/**
|
|
1576
1627
|
* Returns the current value of this computed value.
|
|
1577
1628
|
* Will evaluate its computation first if needed.
|
|
@@ -2555,6 +2606,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2555
2606
|
};
|
|
2556
2607
|
abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
|
|
2557
2608
|
dispose[$mobx] = this;
|
|
2609
|
+
if ("dispose" in Symbol && typeof Symbol.dispose === "symbol") {
|
|
2610
|
+
dispose[Symbol.dispose] = dispose;
|
|
2611
|
+
}
|
|
2558
2612
|
return dispose;
|
|
2559
2613
|
};
|
|
2560
2614
|
_proto.toString = function toString() {
|
|
@@ -3029,10 +3083,21 @@ function unique(list) {
|
|
|
3029
3083
|
}
|
|
3030
3084
|
|
|
3031
3085
|
var generatorId = 0;
|
|
3032
|
-
function
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3086
|
+
var FlowCancellationError = /*#__PURE__*/function (_Error) {
|
|
3087
|
+
function FlowCancellationError() {
|
|
3088
|
+
var _this;
|
|
3089
|
+
_this = _Error.call(this, "FLOW_CANCELLED") || this;
|
|
3090
|
+
Object.setPrototypeOf(_this, (this instanceof FlowCancellationError ? this.constructor : void 0).prototype);
|
|
3091
|
+
_this.name = "FlowCancellationError";
|
|
3092
|
+
return _this;
|
|
3093
|
+
}
|
|
3094
|
+
_inheritsLoose(FlowCancellationError, _Error);
|
|
3095
|
+
var _proto = FlowCancellationError.prototype;
|
|
3096
|
+
_proto.toString = function toString() {
|
|
3097
|
+
return "Error: " + this.message;
|
|
3098
|
+
};
|
|
3099
|
+
return FlowCancellationError;
|
|
3100
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
3036
3101
|
function isFlowCancellationError(error) {
|
|
3037
3102
|
return error instanceof FlowCancellationError;
|
|
3038
3103
|
}
|
|
@@ -5047,7 +5112,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5047
5112
|
}
|
|
5048
5113
|
}
|
|
5049
5114
|
// Trap for "in"
|
|
5050
|
-
|
|
5115
|
+
;
|
|
5051
5116
|
_proto.has_ = function has_(key) {
|
|
5052
5117
|
if (!globalState.trackingDerivation) {
|
|
5053
5118
|
// Skip key subscription outside derivation
|
|
@@ -5179,7 +5244,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5179
5244
|
return true;
|
|
5180
5245
|
}
|
|
5181
5246
|
// If original descriptor becomes relevant, move this to annotation directly
|
|
5182
|
-
|
|
5247
|
+
;
|
|
5183
5248
|
_proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {
|
|
5184
5249
|
if (proxyTrap === void 0) {
|
|
5185
5250
|
proxyTrap = false;
|
|
@@ -5231,7 +5296,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5231
5296
|
return true;
|
|
5232
5297
|
}
|
|
5233
5298
|
// If original descriptor becomes relevant, move this to annotation directly
|
|
5234
|
-
|
|
5299
|
+
;
|
|
5235
5300
|
_proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {
|
|
5236
5301
|
if (proxyTrap === void 0) {
|
|
5237
5302
|
proxyTrap = false;
|