mobx 6.10.1 → 6.11.0-pre
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 +6 -0
- package/dist/api/action.d.ts +16 -15
- package/dist/api/annotation.d.ts +19 -18
- package/dist/api/autorun.d.ts +25 -25
- package/dist/api/become-observed.d.ts +5 -5
- package/dist/api/computed.d.ts +14 -13
- package/dist/api/configure.d.ts +17 -17
- package/dist/api/decorators.d.ts +20 -17
- package/dist/api/extendobservable.d.ts +2 -2
- package/dist/api/extras.d.ts +10 -10
- package/dist/api/flow.d.ts +19 -18
- package/dist/api/intercept-read.d.ts +8 -8
- package/dist/api/intercept.d.ts +8 -8
- package/dist/api/iscomputed.d.ts +3 -3
- package/dist/api/isobservable.d.ts +2 -2
- package/dist/api/makeObservable.d.ts +6 -6
- package/dist/api/object-api.d.ts +36 -36
- package/dist/api/observable.d.ts +45 -44
- package/dist/api/observe.d.ts +8 -8
- package/dist/api/tojs.d.ts +7 -7
- package/dist/api/trace.d.ts +3 -3
- package/dist/api/transaction.d.ts +8 -8
- package/dist/api/when.d.ts +11 -11
- package/dist/core/action.d.ts +20 -20
- package/dist/core/atom.d.ts +37 -37
- package/dist/core/computedvalue.d.ts +99 -99
- package/dist/core/derivation.d.ts +73 -73
- package/dist/core/globalstate.d.ts +121 -121
- package/dist/core/observable.d.ts +45 -45
- package/dist/core/reaction.d.ts +62 -62
- package/dist/core/spy.d.ts +37 -37
- package/dist/errors.d.ts +42 -42
- package/dist/internal.d.ts +54 -54
- package/dist/mobx.cjs.development.js +428 -260
- 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 +2 -2
- package/dist/mobx.esm.development.js +428 -260
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +428 -260
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.esm.production.min.js +1 -1
- package/dist/mobx.esm.production.min.js.map +1 -1
- package/dist/mobx.umd.development.js +428 -260
- 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/actionannotation.d.ts +8 -8
- package/dist/types/autoannotation.d.ts +3 -3
- package/dist/types/computedannotation.d.ts +2 -2
- package/dist/types/decorator_fills.d.ts +6 -0
- package/dist/types/dynamicobject.d.ts +2 -2
- package/dist/types/flowannotation.d.ts +2 -2
- package/dist/types/generic-abort-signal.d.ts +6 -6
- package/dist/types/intercept-utils.d.ts +8 -8
- package/dist/types/legacyobservablearray.d.ts +14 -3
- package/dist/types/listen-utils.d.ts +7 -7
- package/dist/types/modifiers.d.ts +7 -7
- package/dist/types/observableannotation.d.ts +2 -2
- package/dist/types/observablearray.d.ts +85 -85
- package/dist/types/observablemap.d.ts +78 -78
- package/dist/types/observableobject.d.ts +99 -98
- package/dist/types/observableset.d.ts +53 -53
- package/dist/types/observablevalue.d.ts +49 -49
- package/dist/types/overrideannotation.d.ts +4 -3
- package/dist/types/type-utils.d.ts +11 -11
- package/dist/utils/comparer.d.ts +14 -14
- package/dist/utils/eq.d.ts +1 -1
- package/dist/utils/global.d.ts +1 -1
- package/dist/utils/iterable.d.ts +1 -1
- package/dist/utils/utils.d.ts +45 -45
- package/package.json +1 -1
- package/src/api/action.ts +21 -4
- package/src/api/annotation.ts +1 -0
- package/src/api/computed.ts +11 -4
- package/src/api/decorators.ts +29 -8
- package/src/api/flow.ts +10 -3
- package/src/api/observable.ts +19 -6
- package/src/core/atom.ts +9 -11
- package/src/types/actionannotation.ts +48 -2
- package/src/types/autoannotation.ts +8 -2
- package/src/types/computedannotation.ts +39 -2
- package/src/types/decorator_fills.ts +33 -0
- package/src/types/flowannotation.ts +28 -2
- package/src/types/legacyobservablearray.ts +1 -1
- package/src/types/observableannotation.ts +75 -2
- package/src/types/observableobject.ts +16 -0
- package/src/types/overrideannotation.ts +15 -7
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
1: function _(annotationType, key) {
|
|
10
10
|
return "Cannot apply '" + annotationType + "' to '" + key.toString() + "': Field not found.";
|
|
11
11
|
},
|
|
12
|
-
/*
|
|
13
|
-
2(prop) {
|
|
14
|
-
return `invalid decorator for '${prop.toString()}'`
|
|
15
|
-
},
|
|
16
|
-
3(prop) {
|
|
17
|
-
return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`
|
|
18
|
-
},
|
|
19
|
-
4(prop) {
|
|
20
|
-
return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`
|
|
21
|
-
},
|
|
12
|
+
/*
|
|
13
|
+
2(prop) {
|
|
14
|
+
return `invalid decorator for '${prop.toString()}'`
|
|
15
|
+
},
|
|
16
|
+
3(prop) {
|
|
17
|
+
return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`
|
|
18
|
+
},
|
|
19
|
+
4(prop) {
|
|
20
|
+
return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`
|
|
21
|
+
},
|
|
22
22
|
*/
|
|
23
23
|
5: "'keys()' can only be used on observable objects, arrays, sets and maps",
|
|
24
24
|
6: "'values()' can only be used on observable objects, arrays, sets and maps",
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
function getNextId() {
|
|
134
134
|
return ++globalState.mobxGuid;
|
|
135
135
|
}
|
|
136
|
-
/**
|
|
137
|
-
* Makes sure that the provided function is invoked at most once.
|
|
136
|
+
/**
|
|
137
|
+
* Makes sure that the provided function is invoked at most once.
|
|
138
138
|
*/
|
|
139
139
|
function once(func) {
|
|
140
140
|
var invoked = false;
|
|
@@ -215,8 +215,8 @@
|
|
|
215
215
|
return thing instanceof Set;
|
|
216
216
|
}
|
|
217
217
|
var hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== "undefined";
|
|
218
|
-
/**
|
|
219
|
-
* Returns the following: own enumerable keys and symbols.
|
|
218
|
+
/**
|
|
219
|
+
* Returns the following: own enumerable keys and symbols.
|
|
220
220
|
*/
|
|
221
221
|
function getPlainObjectKeys(object) {
|
|
222
222
|
var keys = Object.keys(object);
|
|
@@ -359,20 +359,24 @@
|
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
|
|
362
|
-
/**
|
|
363
|
-
* Creates a function that acts as
|
|
364
|
-
* - decorator
|
|
365
|
-
* - annotation object
|
|
362
|
+
/**
|
|
363
|
+
* Creates a function that acts as
|
|
364
|
+
* - decorator
|
|
365
|
+
* - annotation object
|
|
366
366
|
*/
|
|
367
367
|
function createDecoratorAnnotation(annotation) {
|
|
368
368
|
function decorator(target, property) {
|
|
369
|
-
|
|
369
|
+
if (is20223Decorator(property)) {
|
|
370
|
+
return annotation.decorate_20223_(target, property);
|
|
371
|
+
} else {
|
|
372
|
+
storeAnnotation(target, property, annotation);
|
|
373
|
+
}
|
|
370
374
|
}
|
|
371
375
|
return Object.assign(decorator, annotation);
|
|
372
376
|
}
|
|
373
|
-
/**
|
|
374
|
-
* Stores annotation to prototype,
|
|
375
|
-
* so it can be inspected later by `makeObservable` called from constructor
|
|
377
|
+
/**
|
|
378
|
+
* Stores annotation to prototype,
|
|
379
|
+
* so it can be inspected later by `makeObservable` called from constructor
|
|
376
380
|
*/
|
|
377
381
|
function storeAnnotation(prototype, key, annotation) {
|
|
378
382
|
if (!hasProp(prototype, storedAnnotationsSymbol)) {
|
|
@@ -398,27 +402,37 @@
|
|
|
398
402
|
die("Cannot apply '@" + requestedAnnotationType + "' to '" + fieldName + "':" + ("\nThe field is already decorated with '@" + currentAnnotationType + "'.") + "\nRe-decorating fields is not allowed." + "\nUse '@override' decorator for methods overridden by subclass.");
|
|
399
403
|
}
|
|
400
404
|
}
|
|
401
|
-
/**
|
|
402
|
-
* Collects annotations from prototypes and stores them on target (instance)
|
|
405
|
+
/**
|
|
406
|
+
* Collects annotations from prototypes and stores them on target (instance)
|
|
403
407
|
*/
|
|
404
408
|
function collectStoredAnnotations(target) {
|
|
405
409
|
if (!hasProp(target, storedAnnotationsSymbol)) {
|
|
406
|
-
if ( !target[storedAnnotationsSymbol]) {
|
|
407
|
-
|
|
408
|
-
|
|
410
|
+
// if (__DEV__ && !target[storedAnnotationsSymbol]) {
|
|
411
|
+
// die(
|
|
412
|
+
// `No annotations were passed to makeObservable, but no decorated members have been found either`
|
|
413
|
+
// )
|
|
414
|
+
// }
|
|
409
415
|
// We need a copy as we will remove annotation from the list once it's applied.
|
|
410
416
|
addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));
|
|
411
417
|
}
|
|
412
418
|
return target[storedAnnotationsSymbol];
|
|
413
419
|
}
|
|
420
|
+
function is20223Decorator(context) {
|
|
421
|
+
return typeof context == "object" && typeof context["kind"] == "string";
|
|
422
|
+
}
|
|
423
|
+
function assert20223DecoratorType(context, types) {
|
|
424
|
+
if ( !types.includes(context.kind)) {
|
|
425
|
+
die("Decorator may not be used like this");
|
|
426
|
+
}
|
|
427
|
+
}
|
|
414
428
|
|
|
415
429
|
var $mobx = /*#__PURE__*/Symbol("mobx administration");
|
|
416
430
|
var Atom = /*#__PURE__*/function () {
|
|
417
431
|
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
418
432
|
|
|
419
|
-
/**
|
|
420
|
-
* Create a new atom. For debugging purposes it is recommended to give it a name.
|
|
421
|
-
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
|
|
433
|
+
/**
|
|
434
|
+
* Create a new atom. For debugging purposes it is recommended to give it a name.
|
|
435
|
+
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
|
|
422
436
|
*/
|
|
423
437
|
function Atom(name_) {
|
|
424
438
|
if (name_ === void 0) {
|
|
@@ -453,28 +467,26 @@
|
|
|
453
467
|
});
|
|
454
468
|
}
|
|
455
469
|
}
|
|
456
|
-
/**
|
|
457
|
-
* Invoke this method to notify mobx that your atom has been used somehow.
|
|
458
|
-
* Returns true if there is currently a reactive context.
|
|
470
|
+
/**
|
|
471
|
+
* Invoke this method to notify mobx that your atom has been used somehow.
|
|
472
|
+
* Returns true if there is currently a reactive context.
|
|
459
473
|
*/;
|
|
460
474
|
_proto.reportObserved = function reportObserved$1() {
|
|
461
475
|
return reportObserved(this);
|
|
462
476
|
}
|
|
463
|
-
/**
|
|
464
|
-
* Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
|
|
477
|
+
/**
|
|
478
|
+
* Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
|
|
465
479
|
*/;
|
|
466
480
|
_proto.reportChanged = function reportChanged() {
|
|
467
|
-
if (globalState.inBatch
|
|
468
|
-
//
|
|
469
|
-
|
|
481
|
+
if (!globalState.inBatch || this.batchId_ !== globalState.batchId) {
|
|
482
|
+
// We could update state version only at the end of batch,
|
|
483
|
+
// but we would still have to switch some global flag here to signal a change.
|
|
484
|
+
globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
|
|
485
|
+
// Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
|
|
486
|
+
this.batchId_ = NaN;
|
|
470
487
|
}
|
|
471
|
-
// Avoids the possibility of hitting the same globalState.batchId when it cycled through all integers (necessary?)
|
|
472
|
-
this.batchId_ = NaN;
|
|
473
488
|
startBatch();
|
|
474
489
|
propagateChanged(this);
|
|
475
|
-
// We could update state version only at the end of batch,
|
|
476
|
-
// but we would still have to switch some global flag here to signal a change.
|
|
477
|
-
globalState.stateVersion = globalState.stateVersion < Number.MAX_SAFE_INTEGER ? globalState.stateVersion + 1 : Number.MIN_SAFE_INTEGER;
|
|
478
490
|
endBatch();
|
|
479
491
|
};
|
|
480
492
|
_proto.toString = function toString() {
|
|
@@ -611,7 +623,8 @@
|
|
|
611
623
|
var override = /*#__PURE__*/createDecoratorAnnotation({
|
|
612
624
|
annotationType_: OVERRIDE,
|
|
613
625
|
make_: make_,
|
|
614
|
-
extend_: extend_
|
|
626
|
+
extend_: extend_,
|
|
627
|
+
decorate_20223_: decorate_20223_
|
|
615
628
|
});
|
|
616
629
|
function isOverride(annotation) {
|
|
617
630
|
return annotation.annotationType_ === OVERRIDE;
|
|
@@ -625,47 +638,87 @@
|
|
|
625
638
|
if ( !hasProp(adm.appliedAnnotations_, key)) {
|
|
626
639
|
die("'" + adm.name_ + "." + key.toString() + "' is annotated with '" + this.annotationType_ + "', " + "but no such annotated member was found on prototype.");
|
|
627
640
|
}
|
|
628
|
-
return 0 /* Cancel */;
|
|
641
|
+
return 0 /* MakeResult.Cancel */;
|
|
629
642
|
}
|
|
630
643
|
|
|
631
644
|
function extend_(adm, key, descriptor, proxyTrap) {
|
|
632
645
|
die("'" + this.annotationType_ + "' can only be used with 'makeObservable'");
|
|
633
646
|
}
|
|
647
|
+
function decorate_20223_(desc, context) {
|
|
648
|
+
console.warn("'" + this.annotationType_ + "' cannot be used with decorators - this is a no-op");
|
|
649
|
+
}
|
|
634
650
|
|
|
635
651
|
function createActionAnnotation(name, options) {
|
|
636
652
|
return {
|
|
637
653
|
annotationType_: name,
|
|
638
654
|
options_: options,
|
|
639
655
|
make_: make_$1,
|
|
640
|
-
extend_: extend_$1
|
|
656
|
+
extend_: extend_$1,
|
|
657
|
+
decorate_20223_: decorate_20223_$1
|
|
641
658
|
};
|
|
642
659
|
}
|
|
643
660
|
function make_$1(adm, key, descriptor, source) {
|
|
644
661
|
var _this$options_;
|
|
645
662
|
// bound
|
|
646
663
|
if ((_this$options_ = this.options_) != null && _this$options_.bound) {
|
|
647
|
-
return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 1 /* Break */;
|
|
664
|
+
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
648
665
|
}
|
|
649
666
|
// own
|
|
650
667
|
if (source === adm.target_) {
|
|
651
|
-
return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 2 /* Continue */;
|
|
668
|
+
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;
|
|
652
669
|
}
|
|
653
670
|
// prototype
|
|
654
671
|
if (isAction(descriptor.value)) {
|
|
655
672
|
// A prototype could have been annotated already by other constructor,
|
|
656
673
|
// rest of the proto chain must be annotated already
|
|
657
|
-
return 1 /* Break */;
|
|
674
|
+
return 1 /* MakeResult.Break */;
|
|
658
675
|
}
|
|
659
676
|
|
|
660
677
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);
|
|
661
678
|
defineProperty(source, key, actionDescriptor);
|
|
662
|
-
return 2 /* Continue */;
|
|
679
|
+
return 2 /* MakeResult.Continue */;
|
|
663
680
|
}
|
|
664
681
|
|
|
665
682
|
function extend_$1(adm, key, descriptor, proxyTrap) {
|
|
666
683
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);
|
|
667
684
|
return adm.defineProperty_(key, actionDescriptor, proxyTrap);
|
|
668
685
|
}
|
|
686
|
+
function decorate_20223_$1(mthd, context) {
|
|
687
|
+
{
|
|
688
|
+
assert20223DecoratorType(context, ["method", "field"]);
|
|
689
|
+
}
|
|
690
|
+
var kind = context.kind,
|
|
691
|
+
name = context.name,
|
|
692
|
+
addInitializer = context.addInitializer;
|
|
693
|
+
var ann = this;
|
|
694
|
+
var _createAction = function _createAction(m) {
|
|
695
|
+
var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;
|
|
696
|
+
return createAction((_ann$options_$name = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.name) != null ? _ann$options_$name : name.toString(), m, (_ann$options_$autoAct = (_ann$options_2 = ann.options_) == null ? void 0 : _ann$options_2.autoAction) != null ? _ann$options_$autoAct : false);
|
|
697
|
+
};
|
|
698
|
+
// Backwards/Legacy behavior, expects makeObservable(this)
|
|
699
|
+
if (kind == "field") {
|
|
700
|
+
addInitializer(function () {
|
|
701
|
+
storeAnnotation(this, name, ann);
|
|
702
|
+
});
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
if (kind == "method") {
|
|
706
|
+
var _this$options_2;
|
|
707
|
+
if (!isAction(mthd)) {
|
|
708
|
+
mthd = _createAction(mthd);
|
|
709
|
+
}
|
|
710
|
+
if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {
|
|
711
|
+
addInitializer(function () {
|
|
712
|
+
var self = this;
|
|
713
|
+
var bound = self[name].bind(self);
|
|
714
|
+
bound.isMobxAction = true;
|
|
715
|
+
self[name] = bound;
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
return mthd;
|
|
719
|
+
}
|
|
720
|
+
die("Cannot apply '" + ann.annotationType_ + "' to '" + String(name) + "' (kind: " + kind + "):" + ("\n'" + ann.annotationType_ + "' can only be used on properties with a function value."));
|
|
721
|
+
}
|
|
669
722
|
function assertActionDescriptor(adm, _ref, key, _ref2) {
|
|
670
723
|
var annotationType_ = _ref.annotationType_;
|
|
671
724
|
var value = _ref2.value;
|
|
@@ -706,32 +759,33 @@
|
|
|
706
759
|
annotationType_: name,
|
|
707
760
|
options_: options,
|
|
708
761
|
make_: make_$2,
|
|
709
|
-
extend_: extend_$2
|
|
762
|
+
extend_: extend_$2,
|
|
763
|
+
decorate_20223_: decorate_20223_$2
|
|
710
764
|
};
|
|
711
765
|
}
|
|
712
766
|
function make_$2(adm, key, descriptor, source) {
|
|
713
767
|
var _this$options_;
|
|
714
768
|
// own
|
|
715
769
|
if (source === adm.target_) {
|
|
716
|
-
return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 2 /* Continue */;
|
|
770
|
+
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;
|
|
717
771
|
}
|
|
718
772
|
// prototype
|
|
719
773
|
// bound - must annotate protos to support super.flow()
|
|
720
774
|
if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
|
|
721
775
|
if (this.extend_(adm, key, descriptor, false) === null) {
|
|
722
|
-
return 0 /* Cancel */;
|
|
776
|
+
return 0 /* MakeResult.Cancel */;
|
|
723
777
|
}
|
|
724
778
|
}
|
|
725
779
|
|
|
726
780
|
if (isFlow(descriptor.value)) {
|
|
727
781
|
// A prototype could have been annotated already by other constructor,
|
|
728
782
|
// rest of the proto chain must be annotated already
|
|
729
|
-
return 1 /* Break */;
|
|
783
|
+
return 1 /* MakeResult.Break */;
|
|
730
784
|
}
|
|
731
785
|
|
|
732
786
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);
|
|
733
787
|
defineProperty(source, key, flowDescriptor);
|
|
734
|
-
return 2 /* Continue */;
|
|
788
|
+
return 2 /* MakeResult.Continue */;
|
|
735
789
|
}
|
|
736
790
|
|
|
737
791
|
function extend_$2(adm, key, descriptor, proxyTrap) {
|
|
@@ -739,6 +793,26 @@
|
|
|
739
793
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);
|
|
740
794
|
return adm.defineProperty_(key, flowDescriptor, proxyTrap);
|
|
741
795
|
}
|
|
796
|
+
function decorate_20223_$2(mthd, context) {
|
|
797
|
+
var _this$options_3;
|
|
798
|
+
{
|
|
799
|
+
assert20223DecoratorType(context, ["method"]);
|
|
800
|
+
}
|
|
801
|
+
var name = context.name,
|
|
802
|
+
addInitializer = context.addInitializer;
|
|
803
|
+
if (!isFlow(mthd)) {
|
|
804
|
+
mthd = flow(mthd);
|
|
805
|
+
}
|
|
806
|
+
if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {
|
|
807
|
+
addInitializer(function () {
|
|
808
|
+
var self = this;
|
|
809
|
+
var bound = self[name].bind(self);
|
|
810
|
+
bound.isMobXFlow = true;
|
|
811
|
+
self[name] = bound;
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
return mthd;
|
|
815
|
+
}
|
|
742
816
|
function assertFlowDescriptor(adm, _ref, key, _ref2) {
|
|
743
817
|
var annotationType_ = _ref.annotationType_;
|
|
744
818
|
var value = _ref2.value;
|
|
@@ -783,11 +857,12 @@
|
|
|
783
857
|
annotationType_: name,
|
|
784
858
|
options_: options,
|
|
785
859
|
make_: make_$3,
|
|
786
|
-
extend_: extend_$3
|
|
860
|
+
extend_: extend_$3,
|
|
861
|
+
decorate_20223_: decorate_20223_$3
|
|
787
862
|
};
|
|
788
863
|
}
|
|
789
864
|
function make_$3(adm, key, descriptor) {
|
|
790
|
-
return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 1 /* Break */;
|
|
865
|
+
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
791
866
|
}
|
|
792
867
|
|
|
793
868
|
function extend_$3(adm, key, descriptor, proxyTrap) {
|
|
@@ -797,6 +872,26 @@
|
|
|
797
872
|
set: descriptor.set
|
|
798
873
|
}), proxyTrap);
|
|
799
874
|
}
|
|
875
|
+
function decorate_20223_$3(get, context) {
|
|
876
|
+
{
|
|
877
|
+
assert20223DecoratorType(context, ["getter"]);
|
|
878
|
+
}
|
|
879
|
+
var ann = this;
|
|
880
|
+
var key = context.name,
|
|
881
|
+
addInitializer = context.addInitializer;
|
|
882
|
+
addInitializer(function () {
|
|
883
|
+
var adm = asObservableObject(this)[$mobx];
|
|
884
|
+
var options = _extends({}, ann.options_, {
|
|
885
|
+
get: get,
|
|
886
|
+
context: this
|
|
887
|
+
});
|
|
888
|
+
options.name || (options.name = adm.name_ + "." + key.toString() );
|
|
889
|
+
adm.values_.set(key, new ComputedValue(options));
|
|
890
|
+
});
|
|
891
|
+
return function () {
|
|
892
|
+
return this[$mobx].getObservablePropValue_(key);
|
|
893
|
+
};
|
|
894
|
+
}
|
|
800
895
|
function assertComputedDescriptor(adm, _ref, key, _ref2) {
|
|
801
896
|
var annotationType_ = _ref.annotationType_;
|
|
802
897
|
var get = _ref2.get;
|
|
@@ -810,11 +905,12 @@
|
|
|
810
905
|
annotationType_: name,
|
|
811
906
|
options_: options,
|
|
812
907
|
make_: make_$4,
|
|
813
|
-
extend_: extend_$4
|
|
908
|
+
extend_: extend_$4,
|
|
909
|
+
decorate_20223_: decorate_20223_$4
|
|
814
910
|
};
|
|
815
911
|
}
|
|
816
912
|
function make_$4(adm, key, descriptor) {
|
|
817
|
-
return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 1 /* Break */;
|
|
913
|
+
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
818
914
|
}
|
|
819
915
|
|
|
820
916
|
function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
@@ -822,6 +918,58 @@
|
|
|
822
918
|
assertObservableDescriptor(adm, this, key, descriptor);
|
|
823
919
|
return adm.defineObservableProperty_(key, descriptor.value, (_this$options_$enhanc = (_this$options_ = this.options_) == null ? void 0 : _this$options_.enhancer) != null ? _this$options_$enhanc : deepEnhancer, proxyTrap);
|
|
824
920
|
}
|
|
921
|
+
function decorate_20223_$4(desc, context) {
|
|
922
|
+
{
|
|
923
|
+
assert20223DecoratorType(context, ["accessor", "field"]);
|
|
924
|
+
}
|
|
925
|
+
var ann = this;
|
|
926
|
+
var kind = context.kind,
|
|
927
|
+
name = context.name,
|
|
928
|
+
addInitializer = context.addInitializer;
|
|
929
|
+
// Backwards/Legacy behavior, expects makeObservable(this)
|
|
930
|
+
if (kind == "field") {
|
|
931
|
+
addInitializer(function () {
|
|
932
|
+
storeAnnotation(this, name, ann);
|
|
933
|
+
});
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
// The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:
|
|
937
|
+
// `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).
|
|
938
|
+
// This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot
|
|
939
|
+
// before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member
|
|
940
|
+
// from an object whose class did not declare it` error.
|
|
941
|
+
var initializedObjects = new WeakSet();
|
|
942
|
+
function initializeObservable(target, value) {
|
|
943
|
+
var _ann$options_$enhance, _ann$options_;
|
|
944
|
+
var adm = asObservableObject(target)[$mobx];
|
|
945
|
+
var observable = new ObservableValue(value, (_ann$options_$enhance = (_ann$options_ = ann.options_) == null ? void 0 : _ann$options_.enhancer) != null ? _ann$options_$enhance : deepEnhancer, adm.name_ + "." + name.toString() , false);
|
|
946
|
+
adm.values_.set(name, observable);
|
|
947
|
+
initializedObjects.add(target);
|
|
948
|
+
}
|
|
949
|
+
if (kind == "accessor") {
|
|
950
|
+
return {
|
|
951
|
+
get: function get() {
|
|
952
|
+
if (!initializedObjects.has(this)) {
|
|
953
|
+
initializeObservable(this, desc.get.call(this));
|
|
954
|
+
}
|
|
955
|
+
return this[$mobx].getObservablePropValue_(name);
|
|
956
|
+
},
|
|
957
|
+
set: function set(value) {
|
|
958
|
+
if (!initializedObjects.has(this)) {
|
|
959
|
+
initializeObservable(this, value);
|
|
960
|
+
}
|
|
961
|
+
return this[$mobx].setObservablePropValue_(name, value);
|
|
962
|
+
},
|
|
963
|
+
init: function init(value) {
|
|
964
|
+
if (!initializedObjects.has(this)) {
|
|
965
|
+
initializeObservable(this, value);
|
|
966
|
+
}
|
|
967
|
+
return value;
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
825
973
|
function assertObservableDescriptor(adm, _ref, key, descriptor) {
|
|
826
974
|
var annotationType_ = _ref.annotationType_;
|
|
827
975
|
if ( !("value" in descriptor)) {
|
|
@@ -836,7 +984,8 @@
|
|
|
836
984
|
annotationType_: AUTO,
|
|
837
985
|
options_: options,
|
|
838
986
|
make_: make_$5,
|
|
839
|
-
extend_: extend_$5
|
|
987
|
+
extend_: extend_$5,
|
|
988
|
+
decorate_20223_: decorate_20223_$5
|
|
840
989
|
};
|
|
841
990
|
}
|
|
842
991
|
function make_$5(adm, key, descriptor, source) {
|
|
@@ -854,14 +1003,14 @@
|
|
|
854
1003
|
return adm.defineProperty_(key, {
|
|
855
1004
|
configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,
|
|
856
1005
|
set: set
|
|
857
|
-
}) === null ? 0 /* Cancel */ : 2 /* Continue */;
|
|
1006
|
+
}) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;
|
|
858
1007
|
}
|
|
859
1008
|
// proto
|
|
860
1009
|
defineProperty(source, key, {
|
|
861
1010
|
configurable: true,
|
|
862
1011
|
set: set
|
|
863
1012
|
});
|
|
864
|
-
return 2 /* Continue */;
|
|
1013
|
+
return 2 /* MakeResult.Continue */;
|
|
865
1014
|
}
|
|
866
1015
|
// function on proto -> autoAction/flow
|
|
867
1016
|
if (source !== adm.target_ && typeof descriptor.value === "function") {
|
|
@@ -908,6 +1057,9 @@
|
|
|
908
1057
|
var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;
|
|
909
1058
|
return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);
|
|
910
1059
|
}
|
|
1060
|
+
function decorate_20223_$5(desc, context) {
|
|
1061
|
+
die("'" + this.annotationType_ + "' cannot be used as a decorator");
|
|
1062
|
+
}
|
|
911
1063
|
|
|
912
1064
|
var OBSERVABLE = "observable";
|
|
913
1065
|
var OBSERVABLE_REF = "observable.ref";
|
|
@@ -947,11 +1099,15 @@
|
|
|
947
1099
|
var _annotation$options_$, _annotation$options_;
|
|
948
1100
|
return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;
|
|
949
1101
|
}
|
|
950
|
-
/**
|
|
951
|
-
* Turns an object, array or function into a reactive structure.
|
|
952
|
-
* @param v the value which should become observable.
|
|
1102
|
+
/**
|
|
1103
|
+
* Turns an object, array or function into a reactive structure.
|
|
1104
|
+
* @param v the value which should become observable.
|
|
953
1105
|
*/
|
|
954
1106
|
function createObservable(v, arg2, arg3) {
|
|
1107
|
+
// @observable someProp; (2022.3 Decorators)
|
|
1108
|
+
if (is20223Decorator(arg2)) {
|
|
1109
|
+
return observableAnnotation.decorate_20223_(v, arg2);
|
|
1110
|
+
}
|
|
955
1111
|
// @observable someProp;
|
|
956
1112
|
if (isStringish(arg2)) {
|
|
957
1113
|
storeAnnotation(v, arg2, observableAnnotation);
|
|
@@ -1021,11 +1177,15 @@
|
|
|
1021
1177
|
var computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {
|
|
1022
1178
|
equals: comparer.structural
|
|
1023
1179
|
});
|
|
1024
|
-
/**
|
|
1025
|
-
* Decorator for class properties: @computed get value() { return expr; }.
|
|
1026
|
-
* For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
|
|
1180
|
+
/**
|
|
1181
|
+
* Decorator for class properties: @computed get value() { return expr; }.
|
|
1182
|
+
* For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
|
|
1027
1183
|
*/
|
|
1028
1184
|
var computed = function computed(arg1, arg2) {
|
|
1185
|
+
if (is20223Decorator(arg2)) {
|
|
1186
|
+
// @computed (2022.3 Decorators)
|
|
1187
|
+
return computedAnnotation.decorate_20223_(arg1, arg2);
|
|
1188
|
+
}
|
|
1029
1189
|
if (isStringish(arg2)) {
|
|
1030
1190
|
// @computed
|
|
1031
1191
|
return storeAnnotation(arg1, arg2, computedAnnotation);
|
|
@@ -1312,24 +1472,24 @@
|
|
|
1312
1472
|
var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
|
|
1313
1473
|
|
|
1314
1474
|
var _Symbol$toPrimitive$1;
|
|
1315
|
-
/**
|
|
1316
|
-
* A node in the state dependency root that observes other nodes, and can be observed itself.
|
|
1317
|
-
*
|
|
1318
|
-
* ComputedValue will remember the result of the computation for the duration of the batch, or
|
|
1319
|
-
* while being observed.
|
|
1320
|
-
*
|
|
1321
|
-
* During this time it will recompute only when one of its direct dependencies changed,
|
|
1322
|
-
* but only when it is being accessed with `ComputedValue.get()`.
|
|
1323
|
-
*
|
|
1324
|
-
* Implementation description:
|
|
1325
|
-
* 1. First time it's being accessed it will compute and remember result
|
|
1326
|
-
* give back remembered result until 2. happens
|
|
1327
|
-
* 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.
|
|
1328
|
-
* 3. When it's being accessed, recompute if any shallow dependency changed.
|
|
1329
|
-
* if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.
|
|
1330
|
-
* go to step 2. either way
|
|
1331
|
-
*
|
|
1332
|
-
* If at any point it's outside batch and it isn't observed: reset everything and go to 1.
|
|
1475
|
+
/**
|
|
1476
|
+
* A node in the state dependency root that observes other nodes, and can be observed itself.
|
|
1477
|
+
*
|
|
1478
|
+
* ComputedValue will remember the result of the computation for the duration of the batch, or
|
|
1479
|
+
* while being observed.
|
|
1480
|
+
*
|
|
1481
|
+
* During this time it will recompute only when one of its direct dependencies changed,
|
|
1482
|
+
* but only when it is being accessed with `ComputedValue.get()`.
|
|
1483
|
+
*
|
|
1484
|
+
* Implementation description:
|
|
1485
|
+
* 1. First time it's being accessed it will compute and remember result
|
|
1486
|
+
* give back remembered result until 2. happens
|
|
1487
|
+
* 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.
|
|
1488
|
+
* 3. When it's being accessed, recompute if any shallow dependency changed.
|
|
1489
|
+
* if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.
|
|
1490
|
+
* go to step 2. either way
|
|
1491
|
+
*
|
|
1492
|
+
* If at any point it's outside batch and it isn't observed: reset everything and go to 1.
|
|
1333
1493
|
*/
|
|
1334
1494
|
_Symbol$toPrimitive$1 = Symbol.toPrimitive;
|
|
1335
1495
|
var ComputedValue = /*#__PURE__*/function () {
|
|
@@ -1340,17 +1500,17 @@
|
|
|
1340
1500
|
|
|
1341
1501
|
// N.B: unminified as it is used by MST
|
|
1342
1502
|
|
|
1343
|
-
/**
|
|
1344
|
-
* Create a new computed value based on a function expression.
|
|
1345
|
-
*
|
|
1346
|
-
* The `name` property is for debug purposes only.
|
|
1347
|
-
*
|
|
1348
|
-
* The `equals` property specifies the comparer function to use to determine if a newly produced
|
|
1349
|
-
* value differs from the previous value. Two comparers are provided in the library; `defaultComparer`
|
|
1350
|
-
* compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.
|
|
1351
|
-
* Structural comparison can be convenient if you always produce a new aggregated object and
|
|
1352
|
-
* don't want to notify observers if it is structurally the same.
|
|
1353
|
-
* This is useful for working with vectors, mouse coordinates etc.
|
|
1503
|
+
/**
|
|
1504
|
+
* Create a new computed value based on a function expression.
|
|
1505
|
+
*
|
|
1506
|
+
* The `name` property is for debug purposes only.
|
|
1507
|
+
*
|
|
1508
|
+
* The `equals` property specifies the comparer function to use to determine if a newly produced
|
|
1509
|
+
* value differs from the previous value. Two comparers are provided in the library; `defaultComparer`
|
|
1510
|
+
* compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.
|
|
1511
|
+
* Structural comparison can be convenient if you always produce a new aggregated object and
|
|
1512
|
+
* don't want to notify observers if it is structurally the same.
|
|
1513
|
+
* This is useful for working with vectors, mouse coordinates etc.
|
|
1354
1514
|
*/
|
|
1355
1515
|
function ComputedValue(options) {
|
|
1356
1516
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
@@ -1409,9 +1569,9 @@
|
|
|
1409
1569
|
});
|
|
1410
1570
|
}
|
|
1411
1571
|
}
|
|
1412
|
-
/**
|
|
1413
|
-
* Returns the current value of this computed value.
|
|
1414
|
-
* Will evaluate its computation first if needed.
|
|
1572
|
+
/**
|
|
1573
|
+
* Returns the current value of this computed value.
|
|
1574
|
+
* Will evaluate its computation first if needed.
|
|
1415
1575
|
*/;
|
|
1416
1576
|
_proto.get = function get() {
|
|
1417
1577
|
if (this.isComputing_) {
|
|
@@ -1591,16 +1751,16 @@
|
|
|
1591
1751
|
function isCaughtException(e) {
|
|
1592
1752
|
return e instanceof CaughtException;
|
|
1593
1753
|
}
|
|
1594
|
-
/**
|
|
1595
|
-
* Finds out whether any dependency of the derivation has actually changed.
|
|
1596
|
-
* If dependenciesState is 1 then it will recalculate dependencies,
|
|
1597
|
-
* if any dependency changed it will propagate it by changing dependenciesState to 2.
|
|
1598
|
-
*
|
|
1599
|
-
* By iterating over the dependencies in the same order that they were reported and
|
|
1600
|
-
* stopping on the first change, all the recalculations are only called for ComputedValues
|
|
1601
|
-
* that will be tracked by derivation. That is because we assume that if the first x
|
|
1602
|
-
* dependencies of the derivation doesn't change then the derivation should run the same way
|
|
1603
|
-
* up until accessing x-th dependency.
|
|
1754
|
+
/**
|
|
1755
|
+
* Finds out whether any dependency of the derivation has actually changed.
|
|
1756
|
+
* If dependenciesState is 1 then it will recalculate dependencies,
|
|
1757
|
+
* if any dependency changed it will propagate it by changing dependenciesState to 2.
|
|
1758
|
+
*
|
|
1759
|
+
* By iterating over the dependencies in the same order that they were reported and
|
|
1760
|
+
* stopping on the first change, all the recalculations are only called for ComputedValues
|
|
1761
|
+
* that will be tracked by derivation. That is because we assume that if the first x
|
|
1762
|
+
* dependencies of the derivation doesn't change then the derivation should run the same way
|
|
1763
|
+
* up until accessing x-th dependency.
|
|
1604
1764
|
*/
|
|
1605
1765
|
function shouldCompute(derivation) {
|
|
1606
1766
|
switch (derivation.dependenciesState_) {
|
|
@@ -1664,10 +1824,10 @@
|
|
|
1664
1824
|
console.warn("[mobx] Observable '" + observable.name_ + "' being read outside a reactive context.");
|
|
1665
1825
|
}
|
|
1666
1826
|
}
|
|
1667
|
-
/**
|
|
1668
|
-
* Executes the provided function `f` and tracks which observables are being accessed.
|
|
1669
|
-
* The tracking information is stored on the `derivation` object and the derivation is registered
|
|
1670
|
-
* as observer of any of the accessed observables.
|
|
1827
|
+
/**
|
|
1828
|
+
* Executes the provided function `f` and tracks which observables are being accessed.
|
|
1829
|
+
* The tracking information is stored on the `derivation` object and the derivation is registered
|
|
1830
|
+
* as observer of any of the accessed observables.
|
|
1671
1831
|
*/
|
|
1672
1832
|
function trackDerivedFunction(derivation, f, context) {
|
|
1673
1833
|
var prevAllowStateReads = allowStateReadsStart(true);
|
|
@@ -1705,10 +1865,10 @@
|
|
|
1705
1865
|
console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
|
|
1706
1866
|
}
|
|
1707
1867
|
}
|
|
1708
|
-
/**
|
|
1709
|
-
* diffs newObserving with observing.
|
|
1710
|
-
* update observing to be newObserving with unique observables
|
|
1711
|
-
* notify observers that become observed/unobserved
|
|
1868
|
+
/**
|
|
1869
|
+
* diffs newObserving with observing.
|
|
1870
|
+
* update observing to be newObserving with unique observables
|
|
1871
|
+
* notify observers that become observed/unobserved
|
|
1712
1872
|
*/
|
|
1713
1873
|
function bindDependencies(derivation) {
|
|
1714
1874
|
// invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1");
|
|
@@ -1799,9 +1959,9 @@
|
|
|
1799
1959
|
function allowStateReadsEnd(prev) {
|
|
1800
1960
|
globalState.allowStateReads = prev;
|
|
1801
1961
|
}
|
|
1802
|
-
/**
|
|
1803
|
-
* needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
|
|
1804
|
-
*
|
|
1962
|
+
/**
|
|
1963
|
+
* needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
|
|
1964
|
+
*
|
|
1805
1965
|
*/
|
|
1806
1966
|
function changeDependenciesStateTo0(derivation) {
|
|
1807
1967
|
if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
|
|
@@ -1815,8 +1975,8 @@
|
|
|
1815
1975
|
}
|
|
1816
1976
|
}
|
|
1817
1977
|
|
|
1818
|
-
/**
|
|
1819
|
-
* These values will persist if global state is reset
|
|
1978
|
+
/**
|
|
1979
|
+
* These values will persist if global state is reset
|
|
1820
1980
|
*/
|
|
1821
1981
|
var persistentKeys = ["mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED", "useProxies"];
|
|
1822
1982
|
var MobXGlobals = function MobXGlobals() {
|
|
@@ -1892,9 +2052,9 @@
|
|
|
1892
2052
|
function getGlobalState() {
|
|
1893
2053
|
return globalState;
|
|
1894
2054
|
}
|
|
1895
|
-
/**
|
|
1896
|
-
* For testing purposes only; this will break the internal state of existing observables,
|
|
1897
|
-
* but can be used to get back at a stable state after throwing errors
|
|
2055
|
+
/**
|
|
2056
|
+
* For testing purposes only; this will break the internal state of existing observables,
|
|
2057
|
+
* but can be used to get back at a stable state after throwing errors
|
|
1898
2058
|
*/
|
|
1899
2059
|
function resetGlobalState() {
|
|
1900
2060
|
var defaultGlobals = new MobXGlobals();
|
|
@@ -1961,10 +2121,10 @@
|
|
|
1961
2121
|
globalState.pendingUnobservations.push(observable);
|
|
1962
2122
|
}
|
|
1963
2123
|
}
|
|
1964
|
-
/**
|
|
1965
|
-
* Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.
|
|
1966
|
-
* During a batch `onBecomeUnobserved` will be called at most once per observable.
|
|
1967
|
-
* Avoids unnecessary recalculations.
|
|
2124
|
+
/**
|
|
2125
|
+
* Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.
|
|
2126
|
+
* During a batch `onBecomeUnobserved` will be called at most once per observable.
|
|
2127
|
+
* Avoids unnecessary recalculations.
|
|
1968
2128
|
*/
|
|
1969
2129
|
function startBatch() {
|
|
1970
2130
|
if (globalState.inBatch === 0) {
|
|
@@ -2000,10 +2160,10 @@
|
|
|
2000
2160
|
checkIfStateReadsAreAllowed(observable);
|
|
2001
2161
|
var derivation = globalState.trackingDerivation;
|
|
2002
2162
|
if (derivation !== null) {
|
|
2003
|
-
/**
|
|
2004
|
-
* Simple optimization, give each derivation run an unique id (runId)
|
|
2005
|
-
* Check if last time this observable was accessed the same runId is used
|
|
2006
|
-
* if this is the case, the relation is already known
|
|
2163
|
+
/**
|
|
2164
|
+
* Simple optimization, give each derivation run an unique id (runId)
|
|
2165
|
+
* Check if last time this observable was accessed the same runId is used
|
|
2166
|
+
* if this is the case, the relation is already known
|
|
2007
2167
|
*/
|
|
2008
2168
|
if (derivation.runId_ !== observable.lastAccessedBy_) {
|
|
2009
2169
|
observable.lastAccessedBy_ = derivation.runId_;
|
|
@@ -2033,12 +2193,12 @@
|
|
|
2033
2193
|
// observable.lowestObserverState
|
|
2034
2194
|
// )
|
|
2035
2195
|
// }
|
|
2036
|
-
/**
|
|
2037
|
-
* NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly
|
|
2038
|
-
* It will propagate changes to observers from previous run
|
|
2039
|
-
* It's hard or maybe impossible (with reasonable perf) to get it right with current approach
|
|
2040
|
-
* Hopefully self reruning autoruns aren't a feature people should depend on
|
|
2041
|
-
* Also most basic use cases should be ok
|
|
2196
|
+
/**
|
|
2197
|
+
* NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly
|
|
2198
|
+
* It will propagate changes to observers from previous run
|
|
2199
|
+
* It's hard or maybe impossible (with reasonable perf) to get it right with current approach
|
|
2200
|
+
* Hopefully self reruning autoruns aren't a feature people should depend on
|
|
2201
|
+
* Also most basic use cases should be ok
|
|
2042
2202
|
*/
|
|
2043
2203
|
// Called by Atom when its value changes
|
|
2044
2204
|
function propagateChanged(observable) {
|
|
@@ -2158,8 +2318,8 @@
|
|
|
2158
2318
|
_proto.isScheduled = function isScheduled() {
|
|
2159
2319
|
return this.isScheduled_;
|
|
2160
2320
|
}
|
|
2161
|
-
/**
|
|
2162
|
-
* internal, use schedule() if you intend to kick off a reaction
|
|
2321
|
+
/**
|
|
2322
|
+
* internal, use schedule() if you intend to kick off a reaction
|
|
2163
2323
|
*/;
|
|
2164
2324
|
_proto.runReaction_ = function runReaction_() {
|
|
2165
2325
|
if (!this.isDisposed_) {
|
|
@@ -2292,10 +2452,10 @@
|
|
|
2292
2452
|
}
|
|
2293
2453
|
};
|
|
2294
2454
|
}
|
|
2295
|
-
/**
|
|
2296
|
-
* Magic number alert!
|
|
2297
|
-
* Defines within how many times a reaction is allowed to re-trigger itself
|
|
2298
|
-
* until it is assumed that this is gonna be a never ending loop...
|
|
2455
|
+
/**
|
|
2456
|
+
* Magic number alert!
|
|
2457
|
+
* Defines within how many times a reaction is allowed to re-trigger itself
|
|
2458
|
+
* until it is assumed that this is gonna be a never ending loop...
|
|
2299
2459
|
*/
|
|
2300
2460
|
var MAX_REACTION_ITERATIONS = 100;
|
|
2301
2461
|
var reactionScheduler = function reactionScheduler(f) {
|
|
@@ -2407,6 +2567,10 @@
|
|
|
2407
2567
|
if (isFunction(arg2)) {
|
|
2408
2568
|
return createAction(arg1, arg2, autoAction);
|
|
2409
2569
|
}
|
|
2570
|
+
// @action (2022.3 Decorators)
|
|
2571
|
+
if (is20223Decorator(arg2)) {
|
|
2572
|
+
return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);
|
|
2573
|
+
}
|
|
2410
2574
|
// @action
|
|
2411
2575
|
if (isStringish(arg2)) {
|
|
2412
2576
|
return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
|
|
@@ -2437,11 +2601,11 @@
|
|
|
2437
2601
|
return isFunction(thing) && thing.isMobxAction === true;
|
|
2438
2602
|
}
|
|
2439
2603
|
|
|
2440
|
-
/**
|
|
2441
|
-
* Creates a named reactive view and keeps it alive, so that the view is always
|
|
2442
|
-
* updated if one of the dependencies changes, even when the view is not further used by something else.
|
|
2443
|
-
* @param view The reactive view
|
|
2444
|
-
* @returns disposer function, which can be used to stop the view from being updated in the future.
|
|
2604
|
+
/**
|
|
2605
|
+
* Creates a named reactive view and keeps it alive, so that the view is always
|
|
2606
|
+
* updated if one of the dependencies changes, even when the view is not further used by something else.
|
|
2607
|
+
* @param view The reactive view
|
|
2608
|
+
* @returns disposer function, which can be used to stop the view from being updated in the future.
|
|
2445
2609
|
*/
|
|
2446
2610
|
function autorun(view, opts) {
|
|
2447
2611
|
var _opts$name, _opts, _opts2, _opts2$signal, _opts3;
|
|
@@ -2697,6 +2861,10 @@
|
|
|
2697
2861
|
bound: true
|
|
2698
2862
|
});
|
|
2699
2863
|
var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
2864
|
+
// @flow (2022.3 Decorators)
|
|
2865
|
+
if (is20223Decorator(arg2)) {
|
|
2866
|
+
return flowAnnotation.decorate_20223_(arg1, arg2);
|
|
2867
|
+
}
|
|
2700
2868
|
// @flow
|
|
2701
2869
|
if (isStringish(arg2)) {
|
|
2702
2870
|
return storeAnnotation(arg1, arg2, flowAnnotation);
|
|
@@ -3083,11 +3251,11 @@
|
|
|
3083
3251
|
return _res3;
|
|
3084
3252
|
}
|
|
3085
3253
|
}
|
|
3086
|
-
/**
|
|
3087
|
-
* Recursively converts an observable to it's non-observable native counterpart.
|
|
3088
|
-
* It does NOT recurse into non-observables, these are left as they are, even if they contain observables.
|
|
3089
|
-
* Computed and other non-enumerable properties are completely ignored.
|
|
3090
|
-
* Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.
|
|
3254
|
+
/**
|
|
3255
|
+
* Recursively converts an observable to it's non-observable native counterpart.
|
|
3256
|
+
* It does NOT recurse into non-observables, these are left as they are, even if they contain observables.
|
|
3257
|
+
* Computed and other non-enumerable properties are completely ignored.
|
|
3258
|
+
* Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.
|
|
3091
3259
|
*/
|
|
3092
3260
|
function toJS(source, options) {
|
|
3093
3261
|
if ( options) {
|
|
@@ -3124,12 +3292,12 @@
|
|
|
3124
3292
|
}
|
|
3125
3293
|
}
|
|
3126
3294
|
|
|
3127
|
-
/**
|
|
3128
|
-
* During a transaction no views are updated until the end of the transaction.
|
|
3129
|
-
* The transaction will be run synchronously nonetheless.
|
|
3130
|
-
*
|
|
3131
|
-
* @param action a function that updates some reactive state
|
|
3132
|
-
* @returns any value that was returned by the 'action' parameter.
|
|
3295
|
+
/**
|
|
3296
|
+
* During a transaction no views are updated until the end of the transaction.
|
|
3297
|
+
* The transaction will be run synchronously nonetheless.
|
|
3298
|
+
*
|
|
3299
|
+
* @param action a function that updates some reactive state
|
|
3300
|
+
* @returns any value that was returned by the 'action' parameter.
|
|
3133
3301
|
*/
|
|
3134
3302
|
function transaction(action, thisArg) {
|
|
3135
3303
|
if (thisArg === void 0) {
|
|
@@ -3717,11 +3885,11 @@
|
|
|
3717
3885
|
toJSON: function toJSON() {
|
|
3718
3886
|
return this.slice();
|
|
3719
3887
|
},
|
|
3720
|
-
/*
|
|
3721
|
-
* functions that do alter the internal structure of the array, (based on lib.es6.d.ts)
|
|
3722
|
-
* since these functions alter the inner structure of the array, the have side effects.
|
|
3723
|
-
* Because the have side effects, they should not be used in computed function,
|
|
3724
|
-
* and for that reason the do not call dependencyState.notifyObserved
|
|
3888
|
+
/*
|
|
3889
|
+
* functions that do alter the internal structure of the array, (based on lib.es6.d.ts)
|
|
3890
|
+
* since these functions alter the inner structure of the array, the have side effects.
|
|
3891
|
+
* Because the have side effects, they should not be used in computed function,
|
|
3892
|
+
* and for that reason the do not call dependencyState.notifyObserved
|
|
3725
3893
|
*/
|
|
3726
3894
|
splice: function splice(index, deleteCount) {
|
|
3727
3895
|
for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
@@ -3793,10 +3961,10 @@
|
|
|
3793
3961
|
return false;
|
|
3794
3962
|
}
|
|
3795
3963
|
};
|
|
3796
|
-
/**
|
|
3797
|
-
* Wrap function from prototype
|
|
3798
|
-
* Without this, everything works as well, but this works
|
|
3799
|
-
* faster as everything works on unproxied values
|
|
3964
|
+
/**
|
|
3965
|
+
* Wrap function from prototype
|
|
3966
|
+
* Without this, everything works as well, but this works
|
|
3967
|
+
* faster as everything works on unproxied values
|
|
3800
3968
|
*/
|
|
3801
3969
|
addArrayExtension("concat", simpleFunc);
|
|
3802
3970
|
addArrayExtension("flat", simpleFunc);
|
|
@@ -4236,10 +4404,10 @@
|
|
|
4236
4404
|
_proto.toJSON = function toJSON() {
|
|
4237
4405
|
return Array.from(this);
|
|
4238
4406
|
};
|
|
4239
|
-
/**
|
|
4240
|
-
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
|
|
4241
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
|
|
4242
|
-
* for callback details
|
|
4407
|
+
/**
|
|
4408
|
+
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
|
|
4409
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
|
|
4410
|
+
* for callback details
|
|
4243
4411
|
*/
|
|
4244
4412
|
_proto.observe_ = function observe_(listener, fireImmediately) {
|
|
4245
4413
|
if ( fireImmediately === true) {
|
|
@@ -4615,12 +4783,12 @@
|
|
|
4615
4783
|
}
|
|
4616
4784
|
return this.target_[key];
|
|
4617
4785
|
}
|
|
4618
|
-
/**
|
|
4619
|
-
* @param {PropertyKey} key
|
|
4620
|
-
* @param {any} value
|
|
4621
|
-
* @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
|
|
4622
|
-
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4623
|
-
* @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
|
|
4786
|
+
/**
|
|
4787
|
+
* @param {PropertyKey} key
|
|
4788
|
+
* @param {any} value
|
|
4789
|
+
* @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
|
|
4790
|
+
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4791
|
+
* @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
|
|
4624
4792
|
*/;
|
|
4625
4793
|
_proto.set_ = function set_(key, value, proxyTrap) {
|
|
4626
4794
|
if (proxyTrap === void 0) {
|
|
@@ -4665,9 +4833,9 @@
|
|
|
4665
4833
|
}
|
|
4666
4834
|
return entry.get();
|
|
4667
4835
|
}
|
|
4668
|
-
/**
|
|
4669
|
-
* @param {PropertyKey} key
|
|
4670
|
-
* @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop
|
|
4836
|
+
/**
|
|
4837
|
+
* @param {PropertyKey} key
|
|
4838
|
+
* @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop
|
|
4671
4839
|
*/;
|
|
4672
4840
|
_proto.make_ = function make_(key, annotation) {
|
|
4673
4841
|
if (annotation === true) {
|
|
@@ -4695,10 +4863,10 @@
|
|
|
4695
4863
|
var descriptor = getDescriptor(source, key);
|
|
4696
4864
|
if (descriptor) {
|
|
4697
4865
|
var outcome = annotation.make_(this, key, descriptor, source);
|
|
4698
|
-
if (outcome === 0 /* Cancel */) {
|
|
4866
|
+
if (outcome === 0 /* MakeResult.Cancel */) {
|
|
4699
4867
|
return;
|
|
4700
4868
|
}
|
|
4701
|
-
if (outcome === 1 /* Break */) {
|
|
4869
|
+
if (outcome === 1 /* MakeResult.Break */) {
|
|
4702
4870
|
break;
|
|
4703
4871
|
}
|
|
4704
4872
|
}
|
|
@@ -4706,12 +4874,12 @@
|
|
|
4706
4874
|
}
|
|
4707
4875
|
recordAnnotationApplied(this, annotation, key);
|
|
4708
4876
|
}
|
|
4709
|
-
/**
|
|
4710
|
-
* @param {PropertyKey} key
|
|
4711
|
-
* @param {PropertyDescriptor} descriptor
|
|
4712
|
-
* @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
|
|
4713
|
-
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4714
|
-
* @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
|
|
4877
|
+
/**
|
|
4878
|
+
* @param {PropertyKey} key
|
|
4879
|
+
* @param {PropertyDescriptor} descriptor
|
|
4880
|
+
* @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
|
|
4881
|
+
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4882
|
+
* @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
|
|
4715
4883
|
*/;
|
|
4716
4884
|
_proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {
|
|
4717
4885
|
if (proxyTrap === void 0) {
|
|
@@ -4730,11 +4898,11 @@
|
|
|
4730
4898
|
}
|
|
4731
4899
|
return outcome;
|
|
4732
4900
|
}
|
|
4733
|
-
/**
|
|
4734
|
-
* @param {PropertyKey} key
|
|
4735
|
-
* @param {PropertyDescriptor} descriptor
|
|
4736
|
-
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4737
|
-
* @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
|
|
4901
|
+
/**
|
|
4902
|
+
* @param {PropertyKey} key
|
|
4903
|
+
* @param {PropertyDescriptor} descriptor
|
|
4904
|
+
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4905
|
+
* @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
|
|
4738
4906
|
*/;
|
|
4739
4907
|
_proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {
|
|
4740
4908
|
if (proxyTrap === void 0) {
|
|
@@ -4886,11 +5054,11 @@
|
|
|
4886
5054
|
}
|
|
4887
5055
|
return true;
|
|
4888
5056
|
}
|
|
4889
|
-
/**
|
|
4890
|
-
* @param {PropertyKey} key
|
|
4891
|
-
* @param {PropertyDescriptor} descriptor
|
|
4892
|
-
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4893
|
-
* @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
|
|
5057
|
+
/**
|
|
5058
|
+
* @param {PropertyKey} key
|
|
5059
|
+
* @param {PropertyDescriptor} descriptor
|
|
5060
|
+
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
5061
|
+
* @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
|
|
4894
5062
|
*/;
|
|
4895
5063
|
_proto.delete_ = function delete_(key, proxyTrap) {
|
|
4896
5064
|
if (proxyTrap === void 0) {
|
|
@@ -4979,10 +5147,10 @@
|
|
|
4979
5147
|
}
|
|
4980
5148
|
return true;
|
|
4981
5149
|
}
|
|
4982
|
-
/**
|
|
4983
|
-
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
|
|
4984
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
|
|
4985
|
-
* for callback details
|
|
5150
|
+
/**
|
|
5151
|
+
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
|
|
5152
|
+
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
|
|
5153
|
+
* for callback details
|
|
4986
5154
|
*/;
|
|
4987
5155
|
_proto.observe_ = function observe_(callback, fireImmediately) {
|
|
4988
5156
|
if ( fireImmediately === true) {
|
|
@@ -5085,35 +5253,35 @@
|
|
|
5085
5253
|
if ( !isAnnotation(annotation)) {
|
|
5086
5254
|
die("Cannot annotate '" + adm.name_ + "." + key.toString() + "': Invalid annotation.");
|
|
5087
5255
|
}
|
|
5088
|
-
/*
|
|
5089
|
-
// Configurable, not sealed, not frozen
|
|
5090
|
-
// Possibly not needed, just a little better error then the one thrown by engine.
|
|
5091
|
-
// Cases where this would be useful the most (subclass field initializer) are not interceptable by this.
|
|
5092
|
-
if (__DEV__) {
|
|
5093
|
-
const configurable = getDescriptor(adm.target_, key)?.configurable
|
|
5094
|
-
const frozen = Object.isFrozen(adm.target_)
|
|
5095
|
-
const sealed = Object.isSealed(adm.target_)
|
|
5096
|
-
if (!configurable || frozen || sealed) {
|
|
5097
|
-
const fieldName = `${adm.name_}.${key.toString()}`
|
|
5098
|
-
const requestedAnnotationType = annotation.annotationType_
|
|
5099
|
-
let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`
|
|
5100
|
-
if (frozen) {
|
|
5101
|
-
error += `\nObject is frozen.`
|
|
5102
|
-
}
|
|
5103
|
-
if (sealed) {
|
|
5104
|
-
error += `\nObject is sealed.`
|
|
5105
|
-
}
|
|
5106
|
-
if (!configurable) {
|
|
5107
|
-
error += `\nproperty is not configurable.`
|
|
5108
|
-
// Mention only if caused by us to avoid confusion
|
|
5109
|
-
if (hasProp(adm.appliedAnnotations!, key)) {
|
|
5110
|
-
error += `\nTo prevent accidental re-definition of a field by a subclass, `
|
|
5111
|
-
error += `all annotated fields of non-plain objects (classes) are not configurable.`
|
|
5112
|
-
}
|
|
5113
|
-
}
|
|
5114
|
-
die(error)
|
|
5115
|
-
}
|
|
5116
|
-
}
|
|
5256
|
+
/*
|
|
5257
|
+
// Configurable, not sealed, not frozen
|
|
5258
|
+
// Possibly not needed, just a little better error then the one thrown by engine.
|
|
5259
|
+
// Cases where this would be useful the most (subclass field initializer) are not interceptable by this.
|
|
5260
|
+
if (__DEV__) {
|
|
5261
|
+
const configurable = getDescriptor(adm.target_, key)?.configurable
|
|
5262
|
+
const frozen = Object.isFrozen(adm.target_)
|
|
5263
|
+
const sealed = Object.isSealed(adm.target_)
|
|
5264
|
+
if (!configurable || frozen || sealed) {
|
|
5265
|
+
const fieldName = `${adm.name_}.${key.toString()}`
|
|
5266
|
+
const requestedAnnotationType = annotation.annotationType_
|
|
5267
|
+
let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`
|
|
5268
|
+
if (frozen) {
|
|
5269
|
+
error += `\nObject is frozen.`
|
|
5270
|
+
}
|
|
5271
|
+
if (sealed) {
|
|
5272
|
+
error += `\nObject is sealed.`
|
|
5273
|
+
}
|
|
5274
|
+
if (!configurable) {
|
|
5275
|
+
error += `\nproperty is not configurable.`
|
|
5276
|
+
// Mention only if caused by us to avoid confusion
|
|
5277
|
+
if (hasProp(adm.appliedAnnotations!, key)) {
|
|
5278
|
+
error += `\nTo prevent accidental re-definition of a field by a subclass, `
|
|
5279
|
+
error += `all annotated fields of non-plain objects (classes) are not configurable.`
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5282
|
+
die(error)
|
|
5283
|
+
}
|
|
5284
|
+
}
|
|
5117
5285
|
*/
|
|
5118
5286
|
// Not annotated
|
|
5119
5287
|
if ( !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {
|
|
@@ -5137,10 +5305,10 @@
|
|
|
5137
5305
|
/*#__PURE__*/Object.create(p)["0"] = 1;
|
|
5138
5306
|
return v === false;
|
|
5139
5307
|
}();
|
|
5140
|
-
/**
|
|
5141
|
-
* This array buffer contains two lists of properties, so that all arrays
|
|
5142
|
-
* can recycle their property definitions, which significantly improves performance of creating
|
|
5143
|
-
* properties on the fly.
|
|
5308
|
+
/**
|
|
5309
|
+
* This array buffer contains two lists of properties, so that all arrays
|
|
5310
|
+
* can recycle their property definitions, which significantly improves performance of creating
|
|
5311
|
+
* properties on the fly.
|
|
5144
5312
|
*/
|
|
5145
5313
|
var OBSERVABLE_ARRAY_BUFFER_SIZE = 0;
|
|
5146
5314
|
// Typescript workaround to make sure ObservableArray extends Array
|
|
@@ -5337,11 +5505,11 @@
|
|
|
5337
5505
|
}
|
|
5338
5506
|
return named.name_;
|
|
5339
5507
|
}
|
|
5340
|
-
/**
|
|
5341
|
-
* Helper function for initializing observable structures, it applies:
|
|
5342
|
-
* 1. allowStateChanges so we don't violate enforceActions.
|
|
5343
|
-
* 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.
|
|
5344
|
-
* 3. batch to avoid state version updates
|
|
5508
|
+
/**
|
|
5509
|
+
* Helper function for initializing observable structures, it applies:
|
|
5510
|
+
* 1. allowStateChanges so we don't violate enforceActions.
|
|
5511
|
+
* 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.
|
|
5512
|
+
* 3. batch to avoid state version updates
|
|
5345
5513
|
*/
|
|
5346
5514
|
function initObservable(cb) {
|
|
5347
5515
|
var derivation = untrackedStart();
|
|
@@ -5523,22 +5691,22 @@
|
|
|
5523
5691
|
);
|
|
5524
5692
|
}
|
|
5525
5693
|
|
|
5526
|
-
/**
|
|
5527
|
-
* (c) Michel Weststrate 2015 - 2020
|
|
5528
|
-
* MIT Licensed
|
|
5529
|
-
*
|
|
5530
|
-
* Welcome to the mobx sources! To get a global overview of how MobX internally works,
|
|
5531
|
-
* this is a good place to start:
|
|
5532
|
-
* https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
|
|
5533
|
-
*
|
|
5534
|
-
* Source folders:
|
|
5535
|
-
* ===============
|
|
5536
|
-
*
|
|
5537
|
-
* - api/ Most of the public static methods exposed by the module can be found here.
|
|
5538
|
-
* - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
|
|
5539
|
-
* - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
|
|
5540
|
-
* - utils/ Utility stuff.
|
|
5541
|
-
*
|
|
5694
|
+
/**
|
|
5695
|
+
* (c) Michel Weststrate 2015 - 2020
|
|
5696
|
+
* MIT Licensed
|
|
5697
|
+
*
|
|
5698
|
+
* Welcome to the mobx sources! To get a global overview of how MobX internally works,
|
|
5699
|
+
* this is a good place to start:
|
|
5700
|
+
* https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
|
|
5701
|
+
*
|
|
5702
|
+
* Source folders:
|
|
5703
|
+
* ===============
|
|
5704
|
+
*
|
|
5705
|
+
* - api/ Most of the public static methods exposed by the module can be found here.
|
|
5706
|
+
* - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
|
|
5707
|
+
* - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
|
|
5708
|
+
* - utils/ Utility stuff.
|
|
5709
|
+
*
|
|
5542
5710
|
*/
|
|
5543
5711
|
["Symbol", "Map", "Set"].forEach(function (m) {
|
|
5544
5712
|
var g = getGlobal();
|