mobx 6.10.2 → 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/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 +422 -252
- 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 +422 -252
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +422 -252
- 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 +422 -252
- 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/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,15 +467,15 @@
|
|
|
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
481
|
if (!globalState.inBatch || this.batchId_ !== globalState.batchId) {
|
|
@@ -609,7 +623,8 @@
|
|
|
609
623
|
var override = /*#__PURE__*/createDecoratorAnnotation({
|
|
610
624
|
annotationType_: OVERRIDE,
|
|
611
625
|
make_: make_,
|
|
612
|
-
extend_: extend_
|
|
626
|
+
extend_: extend_,
|
|
627
|
+
decorate_20223_: decorate_20223_
|
|
613
628
|
});
|
|
614
629
|
function isOverride(annotation) {
|
|
615
630
|
return annotation.annotationType_ === OVERRIDE;
|
|
@@ -623,47 +638,87 @@
|
|
|
623
638
|
if ( !hasProp(adm.appliedAnnotations_, key)) {
|
|
624
639
|
die("'" + adm.name_ + "." + key.toString() + "' is annotated with '" + this.annotationType_ + "', " + "but no such annotated member was found on prototype.");
|
|
625
640
|
}
|
|
626
|
-
return 0 /* Cancel */;
|
|
641
|
+
return 0 /* MakeResult.Cancel */;
|
|
627
642
|
}
|
|
628
643
|
|
|
629
644
|
function extend_(adm, key, descriptor, proxyTrap) {
|
|
630
645
|
die("'" + this.annotationType_ + "' can only be used with 'makeObservable'");
|
|
631
646
|
}
|
|
647
|
+
function decorate_20223_(desc, context) {
|
|
648
|
+
console.warn("'" + this.annotationType_ + "' cannot be used with decorators - this is a no-op");
|
|
649
|
+
}
|
|
632
650
|
|
|
633
651
|
function createActionAnnotation(name, options) {
|
|
634
652
|
return {
|
|
635
653
|
annotationType_: name,
|
|
636
654
|
options_: options,
|
|
637
655
|
make_: make_$1,
|
|
638
|
-
extend_: extend_$1
|
|
656
|
+
extend_: extend_$1,
|
|
657
|
+
decorate_20223_: decorate_20223_$1
|
|
639
658
|
};
|
|
640
659
|
}
|
|
641
660
|
function make_$1(adm, key, descriptor, source) {
|
|
642
661
|
var _this$options_;
|
|
643
662
|
// bound
|
|
644
663
|
if ((_this$options_ = this.options_) != null && _this$options_.bound) {
|
|
645
|
-
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 */;
|
|
646
665
|
}
|
|
647
666
|
// own
|
|
648
667
|
if (source === adm.target_) {
|
|
649
|
-
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 */;
|
|
650
669
|
}
|
|
651
670
|
// prototype
|
|
652
671
|
if (isAction(descriptor.value)) {
|
|
653
672
|
// A prototype could have been annotated already by other constructor,
|
|
654
673
|
// rest of the proto chain must be annotated already
|
|
655
|
-
return 1 /* Break */;
|
|
674
|
+
return 1 /* MakeResult.Break */;
|
|
656
675
|
}
|
|
657
676
|
|
|
658
677
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);
|
|
659
678
|
defineProperty(source, key, actionDescriptor);
|
|
660
|
-
return 2 /* Continue */;
|
|
679
|
+
return 2 /* MakeResult.Continue */;
|
|
661
680
|
}
|
|
662
681
|
|
|
663
682
|
function extend_$1(adm, key, descriptor, proxyTrap) {
|
|
664
683
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);
|
|
665
684
|
return adm.defineProperty_(key, actionDescriptor, proxyTrap);
|
|
666
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
|
+
}
|
|
667
722
|
function assertActionDescriptor(adm, _ref, key, _ref2) {
|
|
668
723
|
var annotationType_ = _ref.annotationType_;
|
|
669
724
|
var value = _ref2.value;
|
|
@@ -704,32 +759,33 @@
|
|
|
704
759
|
annotationType_: name,
|
|
705
760
|
options_: options,
|
|
706
761
|
make_: make_$2,
|
|
707
|
-
extend_: extend_$2
|
|
762
|
+
extend_: extend_$2,
|
|
763
|
+
decorate_20223_: decorate_20223_$2
|
|
708
764
|
};
|
|
709
765
|
}
|
|
710
766
|
function make_$2(adm, key, descriptor, source) {
|
|
711
767
|
var _this$options_;
|
|
712
768
|
// own
|
|
713
769
|
if (source === adm.target_) {
|
|
714
|
-
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 */;
|
|
715
771
|
}
|
|
716
772
|
// prototype
|
|
717
773
|
// bound - must annotate protos to support super.flow()
|
|
718
774
|
if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
|
|
719
775
|
if (this.extend_(adm, key, descriptor, false) === null) {
|
|
720
|
-
return 0 /* Cancel */;
|
|
776
|
+
return 0 /* MakeResult.Cancel */;
|
|
721
777
|
}
|
|
722
778
|
}
|
|
723
779
|
|
|
724
780
|
if (isFlow(descriptor.value)) {
|
|
725
781
|
// A prototype could have been annotated already by other constructor,
|
|
726
782
|
// rest of the proto chain must be annotated already
|
|
727
|
-
return 1 /* Break */;
|
|
783
|
+
return 1 /* MakeResult.Break */;
|
|
728
784
|
}
|
|
729
785
|
|
|
730
786
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);
|
|
731
787
|
defineProperty(source, key, flowDescriptor);
|
|
732
|
-
return 2 /* Continue */;
|
|
788
|
+
return 2 /* MakeResult.Continue */;
|
|
733
789
|
}
|
|
734
790
|
|
|
735
791
|
function extend_$2(adm, key, descriptor, proxyTrap) {
|
|
@@ -737,6 +793,26 @@
|
|
|
737
793
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);
|
|
738
794
|
return adm.defineProperty_(key, flowDescriptor, proxyTrap);
|
|
739
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
|
+
}
|
|
740
816
|
function assertFlowDescriptor(adm, _ref, key, _ref2) {
|
|
741
817
|
var annotationType_ = _ref.annotationType_;
|
|
742
818
|
var value = _ref2.value;
|
|
@@ -781,11 +857,12 @@
|
|
|
781
857
|
annotationType_: name,
|
|
782
858
|
options_: options,
|
|
783
859
|
make_: make_$3,
|
|
784
|
-
extend_: extend_$3
|
|
860
|
+
extend_: extend_$3,
|
|
861
|
+
decorate_20223_: decorate_20223_$3
|
|
785
862
|
};
|
|
786
863
|
}
|
|
787
864
|
function make_$3(adm, key, descriptor) {
|
|
788
|
-
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 */;
|
|
789
866
|
}
|
|
790
867
|
|
|
791
868
|
function extend_$3(adm, key, descriptor, proxyTrap) {
|
|
@@ -795,6 +872,26 @@
|
|
|
795
872
|
set: descriptor.set
|
|
796
873
|
}), proxyTrap);
|
|
797
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
|
+
}
|
|
798
895
|
function assertComputedDescriptor(adm, _ref, key, _ref2) {
|
|
799
896
|
var annotationType_ = _ref.annotationType_;
|
|
800
897
|
var get = _ref2.get;
|
|
@@ -808,11 +905,12 @@
|
|
|
808
905
|
annotationType_: name,
|
|
809
906
|
options_: options,
|
|
810
907
|
make_: make_$4,
|
|
811
|
-
extend_: extend_$4
|
|
908
|
+
extend_: extend_$4,
|
|
909
|
+
decorate_20223_: decorate_20223_$4
|
|
812
910
|
};
|
|
813
911
|
}
|
|
814
912
|
function make_$4(adm, key, descriptor) {
|
|
815
|
-
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 */;
|
|
816
914
|
}
|
|
817
915
|
|
|
818
916
|
function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
@@ -820,6 +918,58 @@
|
|
|
820
918
|
assertObservableDescriptor(adm, this, key, descriptor);
|
|
821
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);
|
|
822
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
|
+
}
|
|
823
973
|
function assertObservableDescriptor(adm, _ref, key, descriptor) {
|
|
824
974
|
var annotationType_ = _ref.annotationType_;
|
|
825
975
|
if ( !("value" in descriptor)) {
|
|
@@ -834,7 +984,8 @@
|
|
|
834
984
|
annotationType_: AUTO,
|
|
835
985
|
options_: options,
|
|
836
986
|
make_: make_$5,
|
|
837
|
-
extend_: extend_$5
|
|
987
|
+
extend_: extend_$5,
|
|
988
|
+
decorate_20223_: decorate_20223_$5
|
|
838
989
|
};
|
|
839
990
|
}
|
|
840
991
|
function make_$5(adm, key, descriptor, source) {
|
|
@@ -852,14 +1003,14 @@
|
|
|
852
1003
|
return adm.defineProperty_(key, {
|
|
853
1004
|
configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,
|
|
854
1005
|
set: set
|
|
855
|
-
}) === null ? 0 /* Cancel */ : 2 /* Continue */;
|
|
1006
|
+
}) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;
|
|
856
1007
|
}
|
|
857
1008
|
// proto
|
|
858
1009
|
defineProperty(source, key, {
|
|
859
1010
|
configurable: true,
|
|
860
1011
|
set: set
|
|
861
1012
|
});
|
|
862
|
-
return 2 /* Continue */;
|
|
1013
|
+
return 2 /* MakeResult.Continue */;
|
|
863
1014
|
}
|
|
864
1015
|
// function on proto -> autoAction/flow
|
|
865
1016
|
if (source !== adm.target_ && typeof descriptor.value === "function") {
|
|
@@ -906,6 +1057,9 @@
|
|
|
906
1057
|
var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;
|
|
907
1058
|
return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);
|
|
908
1059
|
}
|
|
1060
|
+
function decorate_20223_$5(desc, context) {
|
|
1061
|
+
die("'" + this.annotationType_ + "' cannot be used as a decorator");
|
|
1062
|
+
}
|
|
909
1063
|
|
|
910
1064
|
var OBSERVABLE = "observable";
|
|
911
1065
|
var OBSERVABLE_REF = "observable.ref";
|
|
@@ -945,11 +1099,15 @@
|
|
|
945
1099
|
var _annotation$options_$, _annotation$options_;
|
|
946
1100
|
return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;
|
|
947
1101
|
}
|
|
948
|
-
/**
|
|
949
|
-
* Turns an object, array or function into a reactive structure.
|
|
950
|
-
* @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.
|
|
951
1105
|
*/
|
|
952
1106
|
function createObservable(v, arg2, arg3) {
|
|
1107
|
+
// @observable someProp; (2022.3 Decorators)
|
|
1108
|
+
if (is20223Decorator(arg2)) {
|
|
1109
|
+
return observableAnnotation.decorate_20223_(v, arg2);
|
|
1110
|
+
}
|
|
953
1111
|
// @observable someProp;
|
|
954
1112
|
if (isStringish(arg2)) {
|
|
955
1113
|
storeAnnotation(v, arg2, observableAnnotation);
|
|
@@ -1019,11 +1177,15 @@
|
|
|
1019
1177
|
var computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {
|
|
1020
1178
|
equals: comparer.structural
|
|
1021
1179
|
});
|
|
1022
|
-
/**
|
|
1023
|
-
* Decorator for class properties: @computed get value() { return expr; }.
|
|
1024
|
-
* 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)`;
|
|
1025
1183
|
*/
|
|
1026
1184
|
var computed = function computed(arg1, arg2) {
|
|
1185
|
+
if (is20223Decorator(arg2)) {
|
|
1186
|
+
// @computed (2022.3 Decorators)
|
|
1187
|
+
return computedAnnotation.decorate_20223_(arg1, arg2);
|
|
1188
|
+
}
|
|
1027
1189
|
if (isStringish(arg2)) {
|
|
1028
1190
|
// @computed
|
|
1029
1191
|
return storeAnnotation(arg1, arg2, computedAnnotation);
|
|
@@ -1310,24 +1472,24 @@
|
|
|
1310
1472
|
var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
|
|
1311
1473
|
|
|
1312
1474
|
var _Symbol$toPrimitive$1;
|
|
1313
|
-
/**
|
|
1314
|
-
* A node in the state dependency root that observes other nodes, and can be observed itself.
|
|
1315
|
-
*
|
|
1316
|
-
* ComputedValue will remember the result of the computation for the duration of the batch, or
|
|
1317
|
-
* while being observed.
|
|
1318
|
-
*
|
|
1319
|
-
* During this time it will recompute only when one of its direct dependencies changed,
|
|
1320
|
-
* but only when it is being accessed with `ComputedValue.get()`.
|
|
1321
|
-
*
|
|
1322
|
-
* Implementation description:
|
|
1323
|
-
* 1. First time it's being accessed it will compute and remember result
|
|
1324
|
-
* give back remembered result until 2. happens
|
|
1325
|
-
* 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.
|
|
1326
|
-
* 3. When it's being accessed, recompute if any shallow dependency changed.
|
|
1327
|
-
* if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.
|
|
1328
|
-
* go to step 2. either way
|
|
1329
|
-
*
|
|
1330
|
-
* 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.
|
|
1331
1493
|
*/
|
|
1332
1494
|
_Symbol$toPrimitive$1 = Symbol.toPrimitive;
|
|
1333
1495
|
var ComputedValue = /*#__PURE__*/function () {
|
|
@@ -1338,17 +1500,17 @@
|
|
|
1338
1500
|
|
|
1339
1501
|
// N.B: unminified as it is used by MST
|
|
1340
1502
|
|
|
1341
|
-
/**
|
|
1342
|
-
* Create a new computed value based on a function expression.
|
|
1343
|
-
*
|
|
1344
|
-
* The `name` property is for debug purposes only.
|
|
1345
|
-
*
|
|
1346
|
-
* The `equals` property specifies the comparer function to use to determine if a newly produced
|
|
1347
|
-
* value differs from the previous value. Two comparers are provided in the library; `defaultComparer`
|
|
1348
|
-
* compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.
|
|
1349
|
-
* Structural comparison can be convenient if you always produce a new aggregated object and
|
|
1350
|
-
* don't want to notify observers if it is structurally the same.
|
|
1351
|
-
* 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.
|
|
1352
1514
|
*/
|
|
1353
1515
|
function ComputedValue(options) {
|
|
1354
1516
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
@@ -1407,9 +1569,9 @@
|
|
|
1407
1569
|
});
|
|
1408
1570
|
}
|
|
1409
1571
|
}
|
|
1410
|
-
/**
|
|
1411
|
-
* Returns the current value of this computed value.
|
|
1412
|
-
* 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.
|
|
1413
1575
|
*/;
|
|
1414
1576
|
_proto.get = function get() {
|
|
1415
1577
|
if (this.isComputing_) {
|
|
@@ -1589,16 +1751,16 @@
|
|
|
1589
1751
|
function isCaughtException(e) {
|
|
1590
1752
|
return e instanceof CaughtException;
|
|
1591
1753
|
}
|
|
1592
|
-
/**
|
|
1593
|
-
* Finds out whether any dependency of the derivation has actually changed.
|
|
1594
|
-
* If dependenciesState is 1 then it will recalculate dependencies,
|
|
1595
|
-
* if any dependency changed it will propagate it by changing dependenciesState to 2.
|
|
1596
|
-
*
|
|
1597
|
-
* By iterating over the dependencies in the same order that they were reported and
|
|
1598
|
-
* stopping on the first change, all the recalculations are only called for ComputedValues
|
|
1599
|
-
* that will be tracked by derivation. That is because we assume that if the first x
|
|
1600
|
-
* dependencies of the derivation doesn't change then the derivation should run the same way
|
|
1601
|
-
* 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.
|
|
1602
1764
|
*/
|
|
1603
1765
|
function shouldCompute(derivation) {
|
|
1604
1766
|
switch (derivation.dependenciesState_) {
|
|
@@ -1662,10 +1824,10 @@
|
|
|
1662
1824
|
console.warn("[mobx] Observable '" + observable.name_ + "' being read outside a reactive context.");
|
|
1663
1825
|
}
|
|
1664
1826
|
}
|
|
1665
|
-
/**
|
|
1666
|
-
* Executes the provided function `f` and tracks which observables are being accessed.
|
|
1667
|
-
* The tracking information is stored on the `derivation` object and the derivation is registered
|
|
1668
|
-
* 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.
|
|
1669
1831
|
*/
|
|
1670
1832
|
function trackDerivedFunction(derivation, f, context) {
|
|
1671
1833
|
var prevAllowStateReads = allowStateReadsStart(true);
|
|
@@ -1703,10 +1865,10 @@
|
|
|
1703
1865
|
console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
|
|
1704
1866
|
}
|
|
1705
1867
|
}
|
|
1706
|
-
/**
|
|
1707
|
-
* diffs newObserving with observing.
|
|
1708
|
-
* update observing to be newObserving with unique observables
|
|
1709
|
-
* 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
|
|
1710
1872
|
*/
|
|
1711
1873
|
function bindDependencies(derivation) {
|
|
1712
1874
|
// invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1");
|
|
@@ -1797,9 +1959,9 @@
|
|
|
1797
1959
|
function allowStateReadsEnd(prev) {
|
|
1798
1960
|
globalState.allowStateReads = prev;
|
|
1799
1961
|
}
|
|
1800
|
-
/**
|
|
1801
|
-
* needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
|
|
1802
|
-
*
|
|
1962
|
+
/**
|
|
1963
|
+
* needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
|
|
1964
|
+
*
|
|
1803
1965
|
*/
|
|
1804
1966
|
function changeDependenciesStateTo0(derivation) {
|
|
1805
1967
|
if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
|
|
@@ -1813,8 +1975,8 @@
|
|
|
1813
1975
|
}
|
|
1814
1976
|
}
|
|
1815
1977
|
|
|
1816
|
-
/**
|
|
1817
|
-
* These values will persist if global state is reset
|
|
1978
|
+
/**
|
|
1979
|
+
* These values will persist if global state is reset
|
|
1818
1980
|
*/
|
|
1819
1981
|
var persistentKeys = ["mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED", "useProxies"];
|
|
1820
1982
|
var MobXGlobals = function MobXGlobals() {
|
|
@@ -1890,9 +2052,9 @@
|
|
|
1890
2052
|
function getGlobalState() {
|
|
1891
2053
|
return globalState;
|
|
1892
2054
|
}
|
|
1893
|
-
/**
|
|
1894
|
-
* For testing purposes only; this will break the internal state of existing observables,
|
|
1895
|
-
* 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
|
|
1896
2058
|
*/
|
|
1897
2059
|
function resetGlobalState() {
|
|
1898
2060
|
var defaultGlobals = new MobXGlobals();
|
|
@@ -1959,10 +2121,10 @@
|
|
|
1959
2121
|
globalState.pendingUnobservations.push(observable);
|
|
1960
2122
|
}
|
|
1961
2123
|
}
|
|
1962
|
-
/**
|
|
1963
|
-
* Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.
|
|
1964
|
-
* During a batch `onBecomeUnobserved` will be called at most once per observable.
|
|
1965
|
-
* 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.
|
|
1966
2128
|
*/
|
|
1967
2129
|
function startBatch() {
|
|
1968
2130
|
if (globalState.inBatch === 0) {
|
|
@@ -1998,10 +2160,10 @@
|
|
|
1998
2160
|
checkIfStateReadsAreAllowed(observable);
|
|
1999
2161
|
var derivation = globalState.trackingDerivation;
|
|
2000
2162
|
if (derivation !== null) {
|
|
2001
|
-
/**
|
|
2002
|
-
* Simple optimization, give each derivation run an unique id (runId)
|
|
2003
|
-
* Check if last time this observable was accessed the same runId is used
|
|
2004
|
-
* 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
|
|
2005
2167
|
*/
|
|
2006
2168
|
if (derivation.runId_ !== observable.lastAccessedBy_) {
|
|
2007
2169
|
observable.lastAccessedBy_ = derivation.runId_;
|
|
@@ -2031,12 +2193,12 @@
|
|
|
2031
2193
|
// observable.lowestObserverState
|
|
2032
2194
|
// )
|
|
2033
2195
|
// }
|
|
2034
|
-
/**
|
|
2035
|
-
* NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly
|
|
2036
|
-
* It will propagate changes to observers from previous run
|
|
2037
|
-
* It's hard or maybe impossible (with reasonable perf) to get it right with current approach
|
|
2038
|
-
* Hopefully self reruning autoruns aren't a feature people should depend on
|
|
2039
|
-
* 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
|
|
2040
2202
|
*/
|
|
2041
2203
|
// Called by Atom when its value changes
|
|
2042
2204
|
function propagateChanged(observable) {
|
|
@@ -2156,8 +2318,8 @@
|
|
|
2156
2318
|
_proto.isScheduled = function isScheduled() {
|
|
2157
2319
|
return this.isScheduled_;
|
|
2158
2320
|
}
|
|
2159
|
-
/**
|
|
2160
|
-
* internal, use schedule() if you intend to kick off a reaction
|
|
2321
|
+
/**
|
|
2322
|
+
* internal, use schedule() if you intend to kick off a reaction
|
|
2161
2323
|
*/;
|
|
2162
2324
|
_proto.runReaction_ = function runReaction_() {
|
|
2163
2325
|
if (!this.isDisposed_) {
|
|
@@ -2290,10 +2452,10 @@
|
|
|
2290
2452
|
}
|
|
2291
2453
|
};
|
|
2292
2454
|
}
|
|
2293
|
-
/**
|
|
2294
|
-
* Magic number alert!
|
|
2295
|
-
* Defines within how many times a reaction is allowed to re-trigger itself
|
|
2296
|
-
* 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...
|
|
2297
2459
|
*/
|
|
2298
2460
|
var MAX_REACTION_ITERATIONS = 100;
|
|
2299
2461
|
var reactionScheduler = function reactionScheduler(f) {
|
|
@@ -2405,6 +2567,10 @@
|
|
|
2405
2567
|
if (isFunction(arg2)) {
|
|
2406
2568
|
return createAction(arg1, arg2, autoAction);
|
|
2407
2569
|
}
|
|
2570
|
+
// @action (2022.3 Decorators)
|
|
2571
|
+
if (is20223Decorator(arg2)) {
|
|
2572
|
+
return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);
|
|
2573
|
+
}
|
|
2408
2574
|
// @action
|
|
2409
2575
|
if (isStringish(arg2)) {
|
|
2410
2576
|
return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
|
|
@@ -2435,11 +2601,11 @@
|
|
|
2435
2601
|
return isFunction(thing) && thing.isMobxAction === true;
|
|
2436
2602
|
}
|
|
2437
2603
|
|
|
2438
|
-
/**
|
|
2439
|
-
* Creates a named reactive view and keeps it alive, so that the view is always
|
|
2440
|
-
* updated if one of the dependencies changes, even when the view is not further used by something else.
|
|
2441
|
-
* @param view The reactive view
|
|
2442
|
-
* @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.
|
|
2443
2609
|
*/
|
|
2444
2610
|
function autorun(view, opts) {
|
|
2445
2611
|
var _opts$name, _opts, _opts2, _opts2$signal, _opts3;
|
|
@@ -2695,6 +2861,10 @@
|
|
|
2695
2861
|
bound: true
|
|
2696
2862
|
});
|
|
2697
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
|
+
}
|
|
2698
2868
|
// @flow
|
|
2699
2869
|
if (isStringish(arg2)) {
|
|
2700
2870
|
return storeAnnotation(arg1, arg2, flowAnnotation);
|
|
@@ -3081,11 +3251,11 @@
|
|
|
3081
3251
|
return _res3;
|
|
3082
3252
|
}
|
|
3083
3253
|
}
|
|
3084
|
-
/**
|
|
3085
|
-
* Recursively converts an observable to it's non-observable native counterpart.
|
|
3086
|
-
* It does NOT recurse into non-observables, these are left as they are, even if they contain observables.
|
|
3087
|
-
* Computed and other non-enumerable properties are completely ignored.
|
|
3088
|
-
* 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.
|
|
3089
3259
|
*/
|
|
3090
3260
|
function toJS(source, options) {
|
|
3091
3261
|
if ( options) {
|
|
@@ -3122,12 +3292,12 @@
|
|
|
3122
3292
|
}
|
|
3123
3293
|
}
|
|
3124
3294
|
|
|
3125
|
-
/**
|
|
3126
|
-
* During a transaction no views are updated until the end of the transaction.
|
|
3127
|
-
* The transaction will be run synchronously nonetheless.
|
|
3128
|
-
*
|
|
3129
|
-
* @param action a function that updates some reactive state
|
|
3130
|
-
* @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.
|
|
3131
3301
|
*/
|
|
3132
3302
|
function transaction(action, thisArg) {
|
|
3133
3303
|
if (thisArg === void 0) {
|
|
@@ -3715,11 +3885,11 @@
|
|
|
3715
3885
|
toJSON: function toJSON() {
|
|
3716
3886
|
return this.slice();
|
|
3717
3887
|
},
|
|
3718
|
-
/*
|
|
3719
|
-
* functions that do alter the internal structure of the array, (based on lib.es6.d.ts)
|
|
3720
|
-
* since these functions alter the inner structure of the array, the have side effects.
|
|
3721
|
-
* Because the have side effects, they should not be used in computed function,
|
|
3722
|
-
* 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
|
|
3723
3893
|
*/
|
|
3724
3894
|
splice: function splice(index, deleteCount) {
|
|
3725
3895
|
for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
@@ -3791,10 +3961,10 @@
|
|
|
3791
3961
|
return false;
|
|
3792
3962
|
}
|
|
3793
3963
|
};
|
|
3794
|
-
/**
|
|
3795
|
-
* Wrap function from prototype
|
|
3796
|
-
* Without this, everything works as well, but this works
|
|
3797
|
-
* 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
|
|
3798
3968
|
*/
|
|
3799
3969
|
addArrayExtension("concat", simpleFunc);
|
|
3800
3970
|
addArrayExtension("flat", simpleFunc);
|
|
@@ -4234,10 +4404,10 @@
|
|
|
4234
4404
|
_proto.toJSON = function toJSON() {
|
|
4235
4405
|
return Array.from(this);
|
|
4236
4406
|
};
|
|
4237
|
-
/**
|
|
4238
|
-
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
|
|
4239
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
|
|
4240
|
-
* 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
|
|
4241
4411
|
*/
|
|
4242
4412
|
_proto.observe_ = function observe_(listener, fireImmediately) {
|
|
4243
4413
|
if ( fireImmediately === true) {
|
|
@@ -4613,12 +4783,12 @@
|
|
|
4613
4783
|
}
|
|
4614
4784
|
return this.target_[key];
|
|
4615
4785
|
}
|
|
4616
|
-
/**
|
|
4617
|
-
* @param {PropertyKey} key
|
|
4618
|
-
* @param {any} value
|
|
4619
|
-
* @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
|
|
4620
|
-
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4621
|
-
* @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
|
|
4622
4792
|
*/;
|
|
4623
4793
|
_proto.set_ = function set_(key, value, proxyTrap) {
|
|
4624
4794
|
if (proxyTrap === void 0) {
|
|
@@ -4663,9 +4833,9 @@
|
|
|
4663
4833
|
}
|
|
4664
4834
|
return entry.get();
|
|
4665
4835
|
}
|
|
4666
|
-
/**
|
|
4667
|
-
* @param {PropertyKey} key
|
|
4668
|
-
* @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
|
|
4669
4839
|
*/;
|
|
4670
4840
|
_proto.make_ = function make_(key, annotation) {
|
|
4671
4841
|
if (annotation === true) {
|
|
@@ -4693,10 +4863,10 @@
|
|
|
4693
4863
|
var descriptor = getDescriptor(source, key);
|
|
4694
4864
|
if (descriptor) {
|
|
4695
4865
|
var outcome = annotation.make_(this, key, descriptor, source);
|
|
4696
|
-
if (outcome === 0 /* Cancel */) {
|
|
4866
|
+
if (outcome === 0 /* MakeResult.Cancel */) {
|
|
4697
4867
|
return;
|
|
4698
4868
|
}
|
|
4699
|
-
if (outcome === 1 /* Break */) {
|
|
4869
|
+
if (outcome === 1 /* MakeResult.Break */) {
|
|
4700
4870
|
break;
|
|
4701
4871
|
}
|
|
4702
4872
|
}
|
|
@@ -4704,12 +4874,12 @@
|
|
|
4704
4874
|
}
|
|
4705
4875
|
recordAnnotationApplied(this, annotation, key);
|
|
4706
4876
|
}
|
|
4707
|
-
/**
|
|
4708
|
-
* @param {PropertyKey} key
|
|
4709
|
-
* @param {PropertyDescriptor} descriptor
|
|
4710
|
-
* @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
|
|
4711
|
-
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4712
|
-
* @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
|
|
4713
4883
|
*/;
|
|
4714
4884
|
_proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {
|
|
4715
4885
|
if (proxyTrap === void 0) {
|
|
@@ -4728,11 +4898,11 @@
|
|
|
4728
4898
|
}
|
|
4729
4899
|
return outcome;
|
|
4730
4900
|
}
|
|
4731
|
-
/**
|
|
4732
|
-
* @param {PropertyKey} key
|
|
4733
|
-
* @param {PropertyDescriptor} descriptor
|
|
4734
|
-
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4735
|
-
* @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
|
|
4736
4906
|
*/;
|
|
4737
4907
|
_proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {
|
|
4738
4908
|
if (proxyTrap === void 0) {
|
|
@@ -4884,11 +5054,11 @@
|
|
|
4884
5054
|
}
|
|
4885
5055
|
return true;
|
|
4886
5056
|
}
|
|
4887
|
-
/**
|
|
4888
|
-
* @param {PropertyKey} key
|
|
4889
|
-
* @param {PropertyDescriptor} descriptor
|
|
4890
|
-
* @param {boolean} proxyTrap whether it's called from proxy trap
|
|
4891
|
-
* @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
|
|
4892
5062
|
*/;
|
|
4893
5063
|
_proto.delete_ = function delete_(key, proxyTrap) {
|
|
4894
5064
|
if (proxyTrap === void 0) {
|
|
@@ -4977,10 +5147,10 @@
|
|
|
4977
5147
|
}
|
|
4978
5148
|
return true;
|
|
4979
5149
|
}
|
|
4980
|
-
/**
|
|
4981
|
-
* Observes this object. Triggers for the events 'add', 'update' and 'delete'.
|
|
4982
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
|
|
4983
|
-
* 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
|
|
4984
5154
|
*/;
|
|
4985
5155
|
_proto.observe_ = function observe_(callback, fireImmediately) {
|
|
4986
5156
|
if ( fireImmediately === true) {
|
|
@@ -5083,35 +5253,35 @@
|
|
|
5083
5253
|
if ( !isAnnotation(annotation)) {
|
|
5084
5254
|
die("Cannot annotate '" + adm.name_ + "." + key.toString() + "': Invalid annotation.");
|
|
5085
5255
|
}
|
|
5086
|
-
/*
|
|
5087
|
-
// Configurable, not sealed, not frozen
|
|
5088
|
-
// Possibly not needed, just a little better error then the one thrown by engine.
|
|
5089
|
-
// Cases where this would be useful the most (subclass field initializer) are not interceptable by this.
|
|
5090
|
-
if (__DEV__) {
|
|
5091
|
-
const configurable = getDescriptor(adm.target_, key)?.configurable
|
|
5092
|
-
const frozen = Object.isFrozen(adm.target_)
|
|
5093
|
-
const sealed = Object.isSealed(adm.target_)
|
|
5094
|
-
if (!configurable || frozen || sealed) {
|
|
5095
|
-
const fieldName = `${adm.name_}.${key.toString()}`
|
|
5096
|
-
const requestedAnnotationType = annotation.annotationType_
|
|
5097
|
-
let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`
|
|
5098
|
-
if (frozen) {
|
|
5099
|
-
error += `\nObject is frozen.`
|
|
5100
|
-
}
|
|
5101
|
-
if (sealed) {
|
|
5102
|
-
error += `\nObject is sealed.`
|
|
5103
|
-
}
|
|
5104
|
-
if (!configurable) {
|
|
5105
|
-
error += `\nproperty is not configurable.`
|
|
5106
|
-
// Mention only if caused by us to avoid confusion
|
|
5107
|
-
if (hasProp(adm.appliedAnnotations!, key)) {
|
|
5108
|
-
error += `\nTo prevent accidental re-definition of a field by a subclass, `
|
|
5109
|
-
error += `all annotated fields of non-plain objects (classes) are not configurable.`
|
|
5110
|
-
}
|
|
5111
|
-
}
|
|
5112
|
-
die(error)
|
|
5113
|
-
}
|
|
5114
|
-
}
|
|
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
|
+
}
|
|
5115
5285
|
*/
|
|
5116
5286
|
// Not annotated
|
|
5117
5287
|
if ( !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {
|
|
@@ -5135,10 +5305,10 @@
|
|
|
5135
5305
|
/*#__PURE__*/Object.create(p)["0"] = 1;
|
|
5136
5306
|
return v === false;
|
|
5137
5307
|
}();
|
|
5138
|
-
/**
|
|
5139
|
-
* This array buffer contains two lists of properties, so that all arrays
|
|
5140
|
-
* can recycle their property definitions, which significantly improves performance of creating
|
|
5141
|
-
* 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.
|
|
5142
5312
|
*/
|
|
5143
5313
|
var OBSERVABLE_ARRAY_BUFFER_SIZE = 0;
|
|
5144
5314
|
// Typescript workaround to make sure ObservableArray extends Array
|
|
@@ -5335,11 +5505,11 @@
|
|
|
5335
5505
|
}
|
|
5336
5506
|
return named.name_;
|
|
5337
5507
|
}
|
|
5338
|
-
/**
|
|
5339
|
-
* Helper function for initializing observable structures, it applies:
|
|
5340
|
-
* 1. allowStateChanges so we don't violate enforceActions.
|
|
5341
|
-
* 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.
|
|
5342
|
-
* 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
|
|
5343
5513
|
*/
|
|
5344
5514
|
function initObservable(cb) {
|
|
5345
5515
|
var derivation = untrackedStart();
|
|
@@ -5521,22 +5691,22 @@
|
|
|
5521
5691
|
);
|
|
5522
5692
|
}
|
|
5523
5693
|
|
|
5524
|
-
/**
|
|
5525
|
-
* (c) Michel Weststrate 2015 - 2020
|
|
5526
|
-
* MIT Licensed
|
|
5527
|
-
*
|
|
5528
|
-
* Welcome to the mobx sources! To get a global overview of how MobX internally works,
|
|
5529
|
-
* this is a good place to start:
|
|
5530
|
-
* https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
|
|
5531
|
-
*
|
|
5532
|
-
* Source folders:
|
|
5533
|
-
* ===============
|
|
5534
|
-
*
|
|
5535
|
-
* - api/ Most of the public static methods exposed by the module can be found here.
|
|
5536
|
-
* - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
|
|
5537
|
-
* - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
|
|
5538
|
-
* - utils/ Utility stuff.
|
|
5539
|
-
*
|
|
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
|
+
*
|
|
5540
5710
|
*/
|
|
5541
5711
|
["Symbol", "Map", "Set"].forEach(function (m) {
|
|
5542
5712
|
var g = getGlobal();
|