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.
Files changed (87) hide show
  1. package/dist/api/action.d.ts +16 -15
  2. package/dist/api/annotation.d.ts +19 -18
  3. package/dist/api/autorun.d.ts +25 -25
  4. package/dist/api/become-observed.d.ts +5 -5
  5. package/dist/api/computed.d.ts +14 -13
  6. package/dist/api/configure.d.ts +17 -17
  7. package/dist/api/decorators.d.ts +20 -17
  8. package/dist/api/extendobservable.d.ts +2 -2
  9. package/dist/api/extras.d.ts +10 -10
  10. package/dist/api/flow.d.ts +19 -18
  11. package/dist/api/intercept-read.d.ts +8 -8
  12. package/dist/api/intercept.d.ts +8 -8
  13. package/dist/api/iscomputed.d.ts +3 -3
  14. package/dist/api/isobservable.d.ts +2 -2
  15. package/dist/api/makeObservable.d.ts +6 -6
  16. package/dist/api/object-api.d.ts +36 -36
  17. package/dist/api/observable.d.ts +45 -44
  18. package/dist/api/observe.d.ts +8 -8
  19. package/dist/api/tojs.d.ts +7 -7
  20. package/dist/api/trace.d.ts +3 -3
  21. package/dist/api/transaction.d.ts +8 -8
  22. package/dist/api/when.d.ts +11 -11
  23. package/dist/core/action.d.ts +20 -20
  24. package/dist/core/atom.d.ts +37 -37
  25. package/dist/core/computedvalue.d.ts +99 -99
  26. package/dist/core/derivation.d.ts +73 -73
  27. package/dist/core/globalstate.d.ts +121 -121
  28. package/dist/core/observable.d.ts +45 -45
  29. package/dist/core/reaction.d.ts +62 -62
  30. package/dist/core/spy.d.ts +37 -37
  31. package/dist/errors.d.ts +42 -42
  32. package/dist/internal.d.ts +54 -54
  33. package/dist/mobx.cjs.development.js +422 -252
  34. package/dist/mobx.cjs.development.js.map +1 -1
  35. package/dist/mobx.cjs.production.min.js +1 -1
  36. package/dist/mobx.cjs.production.min.js.map +1 -1
  37. package/dist/mobx.d.ts +2 -2
  38. package/dist/mobx.esm.development.js +422 -252
  39. package/dist/mobx.esm.development.js.map +1 -1
  40. package/dist/mobx.esm.js +422 -252
  41. package/dist/mobx.esm.js.map +1 -1
  42. package/dist/mobx.esm.production.min.js +1 -1
  43. package/dist/mobx.esm.production.min.js.map +1 -1
  44. package/dist/mobx.umd.development.js +422 -252
  45. package/dist/mobx.umd.development.js.map +1 -1
  46. package/dist/mobx.umd.production.min.js +1 -1
  47. package/dist/mobx.umd.production.min.js.map +1 -1
  48. package/dist/types/actionannotation.d.ts +8 -8
  49. package/dist/types/autoannotation.d.ts +3 -3
  50. package/dist/types/computedannotation.d.ts +2 -2
  51. package/dist/types/decorator_fills.d.ts +6 -0
  52. package/dist/types/dynamicobject.d.ts +2 -2
  53. package/dist/types/flowannotation.d.ts +2 -2
  54. package/dist/types/generic-abort-signal.d.ts +6 -6
  55. package/dist/types/intercept-utils.d.ts +8 -8
  56. package/dist/types/legacyobservablearray.d.ts +14 -3
  57. package/dist/types/listen-utils.d.ts +7 -7
  58. package/dist/types/modifiers.d.ts +7 -7
  59. package/dist/types/observableannotation.d.ts +2 -2
  60. package/dist/types/observablearray.d.ts +85 -85
  61. package/dist/types/observablemap.d.ts +78 -78
  62. package/dist/types/observableobject.d.ts +99 -98
  63. package/dist/types/observableset.d.ts +53 -53
  64. package/dist/types/observablevalue.d.ts +49 -49
  65. package/dist/types/overrideannotation.d.ts +4 -3
  66. package/dist/types/type-utils.d.ts +11 -11
  67. package/dist/utils/comparer.d.ts +14 -14
  68. package/dist/utils/eq.d.ts +1 -1
  69. package/dist/utils/global.d.ts +1 -1
  70. package/dist/utils/iterable.d.ts +1 -1
  71. package/dist/utils/utils.d.ts +45 -45
  72. package/package.json +1 -1
  73. package/src/api/action.ts +21 -4
  74. package/src/api/annotation.ts +1 -0
  75. package/src/api/computed.ts +11 -4
  76. package/src/api/decorators.ts +29 -8
  77. package/src/api/flow.ts +10 -3
  78. package/src/api/observable.ts +19 -6
  79. package/src/types/actionannotation.ts +48 -2
  80. package/src/types/autoannotation.ts +8 -2
  81. package/src/types/computedannotation.ts +39 -2
  82. package/src/types/decorator_fills.ts +33 -0
  83. package/src/types/flowannotation.ts +28 -2
  84. package/src/types/legacyobservablearray.ts +1 -1
  85. package/src/types/observableannotation.ts +75 -2
  86. package/src/types/observableobject.ts +16 -0
  87. package/src/types/overrideannotation.ts +15 -7
@@ -3,16 +3,16 @@ var niceErrors = {
3
3
  1: function _(annotationType, key) {
4
4
  return "Cannot apply '" + annotationType + "' to '" + key.toString() + "': Field not found.";
5
5
  },
6
- /*
7
- 2(prop) {
8
- return `invalid decorator for '${prop.toString()}'`
9
- },
10
- 3(prop) {
11
- return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`
12
- },
13
- 4(prop) {
14
- return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`
15
- },
6
+ /*
7
+ 2(prop) {
8
+ return `invalid decorator for '${prop.toString()}'`
9
+ },
10
+ 3(prop) {
11
+ return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`
12
+ },
13
+ 4(prop) {
14
+ return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`
15
+ },
16
16
  */
17
17
  5: "'keys()' can only be used on observable objects, arrays, sets and maps",
18
18
  6: "'values()' can only be used on observable objects, arrays, sets and maps",
@@ -127,8 +127,8 @@ function warnAboutProxyRequirement(msg) {
127
127
  function getNextId() {
128
128
  return ++globalState.mobxGuid;
129
129
  }
130
- /**
131
- * Makes sure that the provided function is invoked at most once.
130
+ /**
131
+ * Makes sure that the provided function is invoked at most once.
132
132
  */
133
133
  function once(func) {
134
134
  var invoked = false;
@@ -209,8 +209,8 @@ function isES6Set(thing) {
209
209
  return thing instanceof Set;
210
210
  }
211
211
  var hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== "undefined";
212
- /**
213
- * Returns the following: own enumerable keys and symbols.
212
+ /**
213
+ * Returns the following: own enumerable keys and symbols.
214
214
  */
215
215
  function getPlainObjectKeys(object) {
216
216
  var keys = Object.keys(object);
@@ -353,20 +353,24 @@ function _toPropertyKey(arg) {
353
353
  }
354
354
 
355
355
  var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
356
- /**
357
- * Creates a function that acts as
358
- * - decorator
359
- * - annotation object
356
+ /**
357
+ * Creates a function that acts as
358
+ * - decorator
359
+ * - annotation object
360
360
  */
361
361
  function createDecoratorAnnotation(annotation) {
362
362
  function decorator(target, property) {
363
- storeAnnotation(target, property, annotation);
363
+ if (is20223Decorator(property)) {
364
+ return annotation.decorate_20223_(target, property);
365
+ } else {
366
+ storeAnnotation(target, property, annotation);
367
+ }
364
368
  }
365
369
  return Object.assign(decorator, annotation);
366
370
  }
367
- /**
368
- * Stores annotation to prototype,
369
- * so it can be inspected later by `makeObservable` called from constructor
371
+ /**
372
+ * Stores annotation to prototype,
373
+ * so it can be inspected later by `makeObservable` called from constructor
370
374
  */
371
375
  function storeAnnotation(prototype, key, annotation) {
372
376
  if (!hasProp(prototype, storedAnnotationsSymbol)) {
@@ -392,27 +396,37 @@ function assertNotDecorated(prototype, annotation, key) {
392
396
  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.");
393
397
  }
394
398
  }
395
- /**
396
- * Collects annotations from prototypes and stores them on target (instance)
399
+ /**
400
+ * Collects annotations from prototypes and stores them on target (instance)
397
401
  */
398
402
  function collectStoredAnnotations(target) {
399
403
  if (!hasProp(target, storedAnnotationsSymbol)) {
400
- if ( !target[storedAnnotationsSymbol]) {
401
- die("No annotations were passed to makeObservable, but no decorated members have been found either");
402
- }
404
+ // if (__DEV__ && !target[storedAnnotationsSymbol]) {
405
+ // die(
406
+ // `No annotations were passed to makeObservable, but no decorated members have been found either`
407
+ // )
408
+ // }
403
409
  // We need a copy as we will remove annotation from the list once it's applied.
404
410
  addHiddenProp(target, storedAnnotationsSymbol, _extends({}, target[storedAnnotationsSymbol]));
405
411
  }
406
412
  return target[storedAnnotationsSymbol];
407
413
  }
414
+ function is20223Decorator(context) {
415
+ return typeof context == "object" && typeof context["kind"] == "string";
416
+ }
417
+ function assert20223DecoratorType(context, types) {
418
+ if ( !types.includes(context.kind)) {
419
+ die("Decorator may not be used like this");
420
+ }
421
+ }
408
422
 
409
423
  var $mobx = /*#__PURE__*/Symbol("mobx administration");
410
424
  var Atom = /*#__PURE__*/function () {
411
425
  // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
412
426
 
413
- /**
414
- * Create a new atom. For debugging purposes it is recommended to give it a name.
415
- * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
427
+ /**
428
+ * Create a new atom. For debugging purposes it is recommended to give it a name.
429
+ * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
416
430
  */
417
431
  function Atom(name_) {
418
432
  if (name_ === void 0) {
@@ -447,15 +461,15 @@ var Atom = /*#__PURE__*/function () {
447
461
  });
448
462
  }
449
463
  }
450
- /**
451
- * Invoke this method to notify mobx that your atom has been used somehow.
452
- * Returns true if there is currently a reactive context.
464
+ /**
465
+ * Invoke this method to notify mobx that your atom has been used somehow.
466
+ * Returns true if there is currently a reactive context.
453
467
  */;
454
468
  _proto.reportObserved = function reportObserved$1() {
455
469
  return reportObserved(this);
456
470
  }
457
- /**
458
- * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
471
+ /**
472
+ * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.
459
473
  */;
460
474
  _proto.reportChanged = function reportChanged() {
461
475
  if (!globalState.inBatch || this.batchId_ !== globalState.batchId) {
@@ -603,7 +617,8 @@ var OVERRIDE = "override";
603
617
  var override = /*#__PURE__*/createDecoratorAnnotation({
604
618
  annotationType_: OVERRIDE,
605
619
  make_: make_,
606
- extend_: extend_
620
+ extend_: extend_,
621
+ decorate_20223_: decorate_20223_
607
622
  });
608
623
  function isOverride(annotation) {
609
624
  return annotation.annotationType_ === OVERRIDE;
@@ -617,47 +632,87 @@ function make_(adm, key) {
617
632
  if ( !hasProp(adm.appliedAnnotations_, key)) {
618
633
  die("'" + adm.name_ + "." + key.toString() + "' is annotated with '" + this.annotationType_ + "', " + "but no such annotated member was found on prototype.");
619
634
  }
620
- return 0 /* Cancel */;
635
+ return 0 /* MakeResult.Cancel */;
621
636
  }
622
637
 
623
638
  function extend_(adm, key, descriptor, proxyTrap) {
624
639
  die("'" + this.annotationType_ + "' can only be used with 'makeObservable'");
625
640
  }
641
+ function decorate_20223_(desc, context) {
642
+ console.warn("'" + this.annotationType_ + "' cannot be used with decorators - this is a no-op");
643
+ }
626
644
 
627
645
  function createActionAnnotation(name, options) {
628
646
  return {
629
647
  annotationType_: name,
630
648
  options_: options,
631
649
  make_: make_$1,
632
- extend_: extend_$1
650
+ extend_: extend_$1,
651
+ decorate_20223_: decorate_20223_$1
633
652
  };
634
653
  }
635
654
  function make_$1(adm, key, descriptor, source) {
636
655
  var _this$options_;
637
656
  // bound
638
657
  if ((_this$options_ = this.options_) != null && _this$options_.bound) {
639
- return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 1 /* Break */;
658
+ return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
640
659
  }
641
660
  // own
642
661
  if (source === adm.target_) {
643
- return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 2 /* Continue */;
662
+ return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;
644
663
  }
645
664
  // prototype
646
665
  if (isAction(descriptor.value)) {
647
666
  // A prototype could have been annotated already by other constructor,
648
667
  // rest of the proto chain must be annotated already
649
- return 1 /* Break */;
668
+ return 1 /* MakeResult.Break */;
650
669
  }
651
670
 
652
671
  var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);
653
672
  defineProperty(source, key, actionDescriptor);
654
- return 2 /* Continue */;
673
+ return 2 /* MakeResult.Continue */;
655
674
  }
656
675
 
657
676
  function extend_$1(adm, key, descriptor, proxyTrap) {
658
677
  var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);
659
678
  return adm.defineProperty_(key, actionDescriptor, proxyTrap);
660
679
  }
680
+ function decorate_20223_$1(mthd, context) {
681
+ {
682
+ assert20223DecoratorType(context, ["method", "field"]);
683
+ }
684
+ var kind = context.kind,
685
+ name = context.name,
686
+ addInitializer = context.addInitializer;
687
+ var ann = this;
688
+ var _createAction = function _createAction(m) {
689
+ var _ann$options_$name, _ann$options_, _ann$options_$autoAct, _ann$options_2;
690
+ 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);
691
+ };
692
+ // Backwards/Legacy behavior, expects makeObservable(this)
693
+ if (kind == "field") {
694
+ addInitializer(function () {
695
+ storeAnnotation(this, name, ann);
696
+ });
697
+ return;
698
+ }
699
+ if (kind == "method") {
700
+ var _this$options_2;
701
+ if (!isAction(mthd)) {
702
+ mthd = _createAction(mthd);
703
+ }
704
+ if ((_this$options_2 = this.options_) != null && _this$options_2.bound) {
705
+ addInitializer(function () {
706
+ var self = this;
707
+ var bound = self[name].bind(self);
708
+ bound.isMobxAction = true;
709
+ self[name] = bound;
710
+ });
711
+ }
712
+ return mthd;
713
+ }
714
+ die("Cannot apply '" + ann.annotationType_ + "' to '" + String(name) + "' (kind: " + kind + "):" + ("\n'" + ann.annotationType_ + "' can only be used on properties with a function value."));
715
+ }
661
716
  function assertActionDescriptor(adm, _ref, key, _ref2) {
662
717
  var annotationType_ = _ref.annotationType_;
663
718
  var value = _ref2.value;
@@ -698,32 +753,33 @@ function createFlowAnnotation(name, options) {
698
753
  annotationType_: name,
699
754
  options_: options,
700
755
  make_: make_$2,
701
- extend_: extend_$2
756
+ extend_: extend_$2,
757
+ decorate_20223_: decorate_20223_$2
702
758
  };
703
759
  }
704
760
  function make_$2(adm, key, descriptor, source) {
705
761
  var _this$options_;
706
762
  // own
707
763
  if (source === adm.target_) {
708
- return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 2 /* Continue */;
764
+ return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;
709
765
  }
710
766
  // prototype
711
767
  // bound - must annotate protos to support super.flow()
712
768
  if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
713
769
  if (this.extend_(adm, key, descriptor, false) === null) {
714
- return 0 /* Cancel */;
770
+ return 0 /* MakeResult.Cancel */;
715
771
  }
716
772
  }
717
773
 
718
774
  if (isFlow(descriptor.value)) {
719
775
  // A prototype could have been annotated already by other constructor,
720
776
  // rest of the proto chain must be annotated already
721
- return 1 /* Break */;
777
+ return 1 /* MakeResult.Break */;
722
778
  }
723
779
 
724
780
  var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);
725
781
  defineProperty(source, key, flowDescriptor);
726
- return 2 /* Continue */;
782
+ return 2 /* MakeResult.Continue */;
727
783
  }
728
784
 
729
785
  function extend_$2(adm, key, descriptor, proxyTrap) {
@@ -731,6 +787,26 @@ function extend_$2(adm, key, descriptor, proxyTrap) {
731
787
  var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);
732
788
  return adm.defineProperty_(key, flowDescriptor, proxyTrap);
733
789
  }
790
+ function decorate_20223_$2(mthd, context) {
791
+ var _this$options_3;
792
+ {
793
+ assert20223DecoratorType(context, ["method"]);
794
+ }
795
+ var name = context.name,
796
+ addInitializer = context.addInitializer;
797
+ if (!isFlow(mthd)) {
798
+ mthd = flow(mthd);
799
+ }
800
+ if ((_this$options_3 = this.options_) != null && _this$options_3.bound) {
801
+ addInitializer(function () {
802
+ var self = this;
803
+ var bound = self[name].bind(self);
804
+ bound.isMobXFlow = true;
805
+ self[name] = bound;
806
+ });
807
+ }
808
+ return mthd;
809
+ }
734
810
  function assertFlowDescriptor(adm, _ref, key, _ref2) {
735
811
  var annotationType_ = _ref.annotationType_;
736
812
  var value = _ref2.value;
@@ -775,11 +851,12 @@ function createComputedAnnotation(name, options) {
775
851
  annotationType_: name,
776
852
  options_: options,
777
853
  make_: make_$3,
778
- extend_: extend_$3
854
+ extend_: extend_$3,
855
+ decorate_20223_: decorate_20223_$3
779
856
  };
780
857
  }
781
858
  function make_$3(adm, key, descriptor) {
782
- return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 1 /* Break */;
859
+ return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
783
860
  }
784
861
 
785
862
  function extend_$3(adm, key, descriptor, proxyTrap) {
@@ -789,6 +866,26 @@ function extend_$3(adm, key, descriptor, proxyTrap) {
789
866
  set: descriptor.set
790
867
  }), proxyTrap);
791
868
  }
869
+ function decorate_20223_$3(get, context) {
870
+ {
871
+ assert20223DecoratorType(context, ["getter"]);
872
+ }
873
+ var ann = this;
874
+ var key = context.name,
875
+ addInitializer = context.addInitializer;
876
+ addInitializer(function () {
877
+ var adm = asObservableObject(this)[$mobx];
878
+ var options = _extends({}, ann.options_, {
879
+ get: get,
880
+ context: this
881
+ });
882
+ options.name || (options.name = adm.name_ + "." + key.toString() );
883
+ adm.values_.set(key, new ComputedValue(options));
884
+ });
885
+ return function () {
886
+ return this[$mobx].getObservablePropValue_(key);
887
+ };
888
+ }
792
889
  function assertComputedDescriptor(adm, _ref, key, _ref2) {
793
890
  var annotationType_ = _ref.annotationType_;
794
891
  var get = _ref2.get;
@@ -802,11 +899,12 @@ function createObservableAnnotation(name, options) {
802
899
  annotationType_: name,
803
900
  options_: options,
804
901
  make_: make_$4,
805
- extend_: extend_$4
902
+ extend_: extend_$4,
903
+ decorate_20223_: decorate_20223_$4
806
904
  };
807
905
  }
808
906
  function make_$4(adm, key, descriptor) {
809
- return this.extend_(adm, key, descriptor, false) === null ? 0 /* Cancel */ : 1 /* Break */;
907
+ return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
810
908
  }
811
909
 
812
910
  function extend_$4(adm, key, descriptor, proxyTrap) {
@@ -814,6 +912,58 @@ function extend_$4(adm, key, descriptor, proxyTrap) {
814
912
  assertObservableDescriptor(adm, this, key, descriptor);
815
913
  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);
816
914
  }
915
+ function decorate_20223_$4(desc, context) {
916
+ {
917
+ assert20223DecoratorType(context, ["accessor", "field"]);
918
+ }
919
+ var ann = this;
920
+ var kind = context.kind,
921
+ name = context.name,
922
+ addInitializer = context.addInitializer;
923
+ // Backwards/Legacy behavior, expects makeObservable(this)
924
+ if (kind == "field") {
925
+ addInitializer(function () {
926
+ storeAnnotation(this, name, ann);
927
+ });
928
+ return;
929
+ }
930
+ // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:
931
+ // `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).
932
+ // This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot
933
+ // before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member
934
+ // from an object whose class did not declare it` error.
935
+ var initializedObjects = new WeakSet();
936
+ function initializeObservable(target, value) {
937
+ var _ann$options_$enhance, _ann$options_;
938
+ var adm = asObservableObject(target)[$mobx];
939
+ 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);
940
+ adm.values_.set(name, observable);
941
+ initializedObjects.add(target);
942
+ }
943
+ if (kind == "accessor") {
944
+ return {
945
+ get: function get() {
946
+ if (!initializedObjects.has(this)) {
947
+ initializeObservable(this, desc.get.call(this));
948
+ }
949
+ return this[$mobx].getObservablePropValue_(name);
950
+ },
951
+ set: function set(value) {
952
+ if (!initializedObjects.has(this)) {
953
+ initializeObservable(this, value);
954
+ }
955
+ return this[$mobx].setObservablePropValue_(name, value);
956
+ },
957
+ init: function init(value) {
958
+ if (!initializedObjects.has(this)) {
959
+ initializeObservable(this, value);
960
+ }
961
+ return value;
962
+ }
963
+ };
964
+ }
965
+ return;
966
+ }
817
967
  function assertObservableDescriptor(adm, _ref, key, descriptor) {
818
968
  var annotationType_ = _ref.annotationType_;
819
969
  if ( !("value" in descriptor)) {
@@ -828,7 +978,8 @@ function createAutoAnnotation(options) {
828
978
  annotationType_: AUTO,
829
979
  options_: options,
830
980
  make_: make_$5,
831
- extend_: extend_$5
981
+ extend_: extend_$5,
982
+ decorate_20223_: decorate_20223_$5
832
983
  };
833
984
  }
834
985
  function make_$5(adm, key, descriptor, source) {
@@ -846,14 +997,14 @@ function make_$5(adm, key, descriptor, source) {
846
997
  return adm.defineProperty_(key, {
847
998
  configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,
848
999
  set: set
849
- }) === null ? 0 /* Cancel */ : 2 /* Continue */;
1000
+ }) === null ? 0 /* MakeResult.Cancel */ : 2 /* MakeResult.Continue */;
850
1001
  }
851
1002
  // proto
852
1003
  defineProperty(source, key, {
853
1004
  configurable: true,
854
1005
  set: set
855
1006
  });
856
- return 2 /* Continue */;
1007
+ return 2 /* MakeResult.Continue */;
857
1008
  }
858
1009
  // function on proto -> autoAction/flow
859
1010
  if (source !== adm.target_ && typeof descriptor.value === "function") {
@@ -900,6 +1051,9 @@ function extend_$5(adm, key, descriptor, proxyTrap) {
900
1051
  var observableAnnotation = ((_this$options_6 = this.options_) == null ? void 0 : _this$options_6.deep) === false ? observable.ref : observable;
901
1052
  return observableAnnotation.extend_(adm, key, descriptor, proxyTrap);
902
1053
  }
1054
+ function decorate_20223_$5(desc, context) {
1055
+ die("'" + this.annotationType_ + "' cannot be used as a decorator");
1056
+ }
903
1057
 
904
1058
  var OBSERVABLE = "observable";
905
1059
  var OBSERVABLE_REF = "observable.ref";
@@ -939,11 +1093,15 @@ function getEnhancerFromAnnotation(annotation) {
939
1093
  var _annotation$options_$, _annotation$options_;
940
1094
  return !annotation ? deepEnhancer : (_annotation$options_$ = (_annotation$options_ = annotation.options_) == null ? void 0 : _annotation$options_.enhancer) != null ? _annotation$options_$ : deepEnhancer;
941
1095
  }
942
- /**
943
- * Turns an object, array or function into a reactive structure.
944
- * @param v the value which should become observable.
1096
+ /**
1097
+ * Turns an object, array or function into a reactive structure.
1098
+ * @param v the value which should become observable.
945
1099
  */
946
1100
  function createObservable(v, arg2, arg3) {
1101
+ // @observable someProp; (2022.3 Decorators)
1102
+ if (is20223Decorator(arg2)) {
1103
+ return observableAnnotation.decorate_20223_(v, arg2);
1104
+ }
947
1105
  // @observable someProp;
948
1106
  if (isStringish(arg2)) {
949
1107
  storeAnnotation(v, arg2, observableAnnotation);
@@ -1013,11 +1171,15 @@ var computedAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED);
1013
1171
  var computedStructAnnotation = /*#__PURE__*/createComputedAnnotation(COMPUTED_STRUCT, {
1014
1172
  equals: comparer.structural
1015
1173
  });
1016
- /**
1017
- * Decorator for class properties: @computed get value() { return expr; }.
1018
- * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
1174
+ /**
1175
+ * Decorator for class properties: @computed get value() { return expr; }.
1176
+ * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
1019
1177
  */
1020
1178
  var computed = function computed(arg1, arg2) {
1179
+ if (is20223Decorator(arg2)) {
1180
+ // @computed (2022.3 Decorators)
1181
+ return computedAnnotation.decorate_20223_(arg1, arg2);
1182
+ }
1021
1183
  if (isStringish(arg2)) {
1022
1184
  // @computed
1023
1185
  return storeAnnotation(arg1, arg2, computedAnnotation);
@@ -1304,24 +1466,24 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
1304
1466
  var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
1305
1467
 
1306
1468
  var _Symbol$toPrimitive$1;
1307
- /**
1308
- * A node in the state dependency root that observes other nodes, and can be observed itself.
1309
- *
1310
- * ComputedValue will remember the result of the computation for the duration of the batch, or
1311
- * while being observed.
1312
- *
1313
- * During this time it will recompute only when one of its direct dependencies changed,
1314
- * but only when it is being accessed with `ComputedValue.get()`.
1315
- *
1316
- * Implementation description:
1317
- * 1. First time it's being accessed it will compute and remember result
1318
- * give back remembered result until 2. happens
1319
- * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.
1320
- * 3. When it's being accessed, recompute if any shallow dependency changed.
1321
- * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.
1322
- * go to step 2. either way
1323
- *
1324
- * If at any point it's outside batch and it isn't observed: reset everything and go to 1.
1469
+ /**
1470
+ * A node in the state dependency root that observes other nodes, and can be observed itself.
1471
+ *
1472
+ * ComputedValue will remember the result of the computation for the duration of the batch, or
1473
+ * while being observed.
1474
+ *
1475
+ * During this time it will recompute only when one of its direct dependencies changed,
1476
+ * but only when it is being accessed with `ComputedValue.get()`.
1477
+ *
1478
+ * Implementation description:
1479
+ * 1. First time it's being accessed it will compute and remember result
1480
+ * give back remembered result until 2. happens
1481
+ * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.
1482
+ * 3. When it's being accessed, recompute if any shallow dependency changed.
1483
+ * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.
1484
+ * go to step 2. either way
1485
+ *
1486
+ * If at any point it's outside batch and it isn't observed: reset everything and go to 1.
1325
1487
  */
1326
1488
  _Symbol$toPrimitive$1 = Symbol.toPrimitive;
1327
1489
  var ComputedValue = /*#__PURE__*/function () {
@@ -1332,17 +1494,17 @@ var ComputedValue = /*#__PURE__*/function () {
1332
1494
 
1333
1495
  // N.B: unminified as it is used by MST
1334
1496
 
1335
- /**
1336
- * Create a new computed value based on a function expression.
1337
- *
1338
- * The `name` property is for debug purposes only.
1339
- *
1340
- * The `equals` property specifies the comparer function to use to determine if a newly produced
1341
- * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`
1342
- * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.
1343
- * Structural comparison can be convenient if you always produce a new aggregated object and
1344
- * don't want to notify observers if it is structurally the same.
1345
- * This is useful for working with vectors, mouse coordinates etc.
1497
+ /**
1498
+ * Create a new computed value based on a function expression.
1499
+ *
1500
+ * The `name` property is for debug purposes only.
1501
+ *
1502
+ * The `equals` property specifies the comparer function to use to determine if a newly produced
1503
+ * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`
1504
+ * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.
1505
+ * Structural comparison can be convenient if you always produce a new aggregated object and
1506
+ * don't want to notify observers if it is structurally the same.
1507
+ * This is useful for working with vectors, mouse coordinates etc.
1346
1508
  */
1347
1509
  function ComputedValue(options) {
1348
1510
  this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
@@ -1401,9 +1563,9 @@ var ComputedValue = /*#__PURE__*/function () {
1401
1563
  });
1402
1564
  }
1403
1565
  }
1404
- /**
1405
- * Returns the current value of this computed value.
1406
- * Will evaluate its computation first if needed.
1566
+ /**
1567
+ * Returns the current value of this computed value.
1568
+ * Will evaluate its computation first if needed.
1407
1569
  */;
1408
1570
  _proto.get = function get() {
1409
1571
  if (this.isComputing_) {
@@ -1583,16 +1745,16 @@ var CaughtException = function CaughtException(cause) {
1583
1745
  function isCaughtException(e) {
1584
1746
  return e instanceof CaughtException;
1585
1747
  }
1586
- /**
1587
- * Finds out whether any dependency of the derivation has actually changed.
1588
- * If dependenciesState is 1 then it will recalculate dependencies,
1589
- * if any dependency changed it will propagate it by changing dependenciesState to 2.
1590
- *
1591
- * By iterating over the dependencies in the same order that they were reported and
1592
- * stopping on the first change, all the recalculations are only called for ComputedValues
1593
- * that will be tracked by derivation. That is because we assume that if the first x
1594
- * dependencies of the derivation doesn't change then the derivation should run the same way
1595
- * up until accessing x-th dependency.
1748
+ /**
1749
+ * Finds out whether any dependency of the derivation has actually changed.
1750
+ * If dependenciesState is 1 then it will recalculate dependencies,
1751
+ * if any dependency changed it will propagate it by changing dependenciesState to 2.
1752
+ *
1753
+ * By iterating over the dependencies in the same order that they were reported and
1754
+ * stopping on the first change, all the recalculations are only called for ComputedValues
1755
+ * that will be tracked by derivation. That is because we assume that if the first x
1756
+ * dependencies of the derivation doesn't change then the derivation should run the same way
1757
+ * up until accessing x-th dependency.
1596
1758
  */
1597
1759
  function shouldCompute(derivation) {
1598
1760
  switch (derivation.dependenciesState_) {
@@ -1656,10 +1818,10 @@ function checkIfStateReadsAreAllowed(observable) {
1656
1818
  console.warn("[mobx] Observable '" + observable.name_ + "' being read outside a reactive context.");
1657
1819
  }
1658
1820
  }
1659
- /**
1660
- * Executes the provided function `f` and tracks which observables are being accessed.
1661
- * The tracking information is stored on the `derivation` object and the derivation is registered
1662
- * as observer of any of the accessed observables.
1821
+ /**
1822
+ * Executes the provided function `f` and tracks which observables are being accessed.
1823
+ * The tracking information is stored on the `derivation` object and the derivation is registered
1824
+ * as observer of any of the accessed observables.
1663
1825
  */
1664
1826
  function trackDerivedFunction(derivation, f, context) {
1665
1827
  var prevAllowStateReads = allowStateReadsStart(true);
@@ -1697,10 +1859,10 @@ function warnAboutDerivationWithoutDependencies(derivation) {
1697
1859
  console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
1698
1860
  }
1699
1861
  }
1700
- /**
1701
- * diffs newObserving with observing.
1702
- * update observing to be newObserving with unique observables
1703
- * notify observers that become observed/unobserved
1862
+ /**
1863
+ * diffs newObserving with observing.
1864
+ * update observing to be newObserving with unique observables
1865
+ * notify observers that become observed/unobserved
1704
1866
  */
1705
1867
  function bindDependencies(derivation) {
1706
1868
  // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1");
@@ -1791,9 +1953,9 @@ function allowStateReadsStart(allowStateReads) {
1791
1953
  function allowStateReadsEnd(prev) {
1792
1954
  globalState.allowStateReads = prev;
1793
1955
  }
1794
- /**
1795
- * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
1796
- *
1956
+ /**
1957
+ * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
1958
+ *
1797
1959
  */
1798
1960
  function changeDependenciesStateTo0(derivation) {
1799
1961
  if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
@@ -1807,8 +1969,8 @@ function changeDependenciesStateTo0(derivation) {
1807
1969
  }
1808
1970
  }
1809
1971
 
1810
- /**
1811
- * These values will persist if global state is reset
1972
+ /**
1973
+ * These values will persist if global state is reset
1812
1974
  */
1813
1975
  var persistentKeys = ["mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED", "useProxies"];
1814
1976
  var MobXGlobals = function MobXGlobals() {
@@ -1884,9 +2046,9 @@ function isolateGlobalState() {
1884
2046
  function getGlobalState() {
1885
2047
  return globalState;
1886
2048
  }
1887
- /**
1888
- * For testing purposes only; this will break the internal state of existing observables,
1889
- * but can be used to get back at a stable state after throwing errors
2049
+ /**
2050
+ * For testing purposes only; this will break the internal state of existing observables,
2051
+ * but can be used to get back at a stable state after throwing errors
1890
2052
  */
1891
2053
  function resetGlobalState() {
1892
2054
  var defaultGlobals = new MobXGlobals();
@@ -1953,10 +2115,10 @@ function queueForUnobservation(observable) {
1953
2115
  globalState.pendingUnobservations.push(observable);
1954
2116
  }
1955
2117
  }
1956
- /**
1957
- * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.
1958
- * During a batch `onBecomeUnobserved` will be called at most once per observable.
1959
- * Avoids unnecessary recalculations.
2118
+ /**
2119
+ * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.
2120
+ * During a batch `onBecomeUnobserved` will be called at most once per observable.
2121
+ * Avoids unnecessary recalculations.
1960
2122
  */
1961
2123
  function startBatch() {
1962
2124
  if (globalState.inBatch === 0) {
@@ -1992,10 +2154,10 @@ function reportObserved(observable) {
1992
2154
  checkIfStateReadsAreAllowed(observable);
1993
2155
  var derivation = globalState.trackingDerivation;
1994
2156
  if (derivation !== null) {
1995
- /**
1996
- * Simple optimization, give each derivation run an unique id (runId)
1997
- * Check if last time this observable was accessed the same runId is used
1998
- * if this is the case, the relation is already known
2157
+ /**
2158
+ * Simple optimization, give each derivation run an unique id (runId)
2159
+ * Check if last time this observable was accessed the same runId is used
2160
+ * if this is the case, the relation is already known
1999
2161
  */
2000
2162
  if (derivation.runId_ !== observable.lastAccessedBy_) {
2001
2163
  observable.lastAccessedBy_ = derivation.runId_;
@@ -2025,12 +2187,12 @@ function reportObserved(observable) {
2025
2187
  // observable.lowestObserverState
2026
2188
  // )
2027
2189
  // }
2028
- /**
2029
- * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly
2030
- * It will propagate changes to observers from previous run
2031
- * It's hard or maybe impossible (with reasonable perf) to get it right with current approach
2032
- * Hopefully self reruning autoruns aren't a feature people should depend on
2033
- * Also most basic use cases should be ok
2190
+ /**
2191
+ * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly
2192
+ * It will propagate changes to observers from previous run
2193
+ * It's hard or maybe impossible (with reasonable perf) to get it right with current approach
2194
+ * Hopefully self reruning autoruns aren't a feature people should depend on
2195
+ * Also most basic use cases should be ok
2034
2196
  */
2035
2197
  // Called by Atom when its value changes
2036
2198
  function propagateChanged(observable) {
@@ -2150,8 +2312,8 @@ var Reaction = /*#__PURE__*/function () {
2150
2312
  _proto.isScheduled = function isScheduled() {
2151
2313
  return this.isScheduled_;
2152
2314
  }
2153
- /**
2154
- * internal, use schedule() if you intend to kick off a reaction
2315
+ /**
2316
+ * internal, use schedule() if you intend to kick off a reaction
2155
2317
  */;
2156
2318
  _proto.runReaction_ = function runReaction_() {
2157
2319
  if (!this.isDisposed_) {
@@ -2284,10 +2446,10 @@ function onReactionError(handler) {
2284
2446
  }
2285
2447
  };
2286
2448
  }
2287
- /**
2288
- * Magic number alert!
2289
- * Defines within how many times a reaction is allowed to re-trigger itself
2290
- * until it is assumed that this is gonna be a never ending loop...
2449
+ /**
2450
+ * Magic number alert!
2451
+ * Defines within how many times a reaction is allowed to re-trigger itself
2452
+ * until it is assumed that this is gonna be a never ending loop...
2291
2453
  */
2292
2454
  var MAX_REACTION_ITERATIONS = 100;
2293
2455
  var reactionScheduler = function reactionScheduler(f) {
@@ -2399,6 +2561,10 @@ function createActionFactory(autoAction) {
2399
2561
  if (isFunction(arg2)) {
2400
2562
  return createAction(arg1, arg2, autoAction);
2401
2563
  }
2564
+ // @action (2022.3 Decorators)
2565
+ if (is20223Decorator(arg2)) {
2566
+ return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(arg1, arg2);
2567
+ }
2402
2568
  // @action
2403
2569
  if (isStringish(arg2)) {
2404
2570
  return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
@@ -2429,11 +2595,11 @@ function isAction(thing) {
2429
2595
  return isFunction(thing) && thing.isMobxAction === true;
2430
2596
  }
2431
2597
 
2432
- /**
2433
- * Creates a named reactive view and keeps it alive, so that the view is always
2434
- * updated if one of the dependencies changes, even when the view is not further used by something else.
2435
- * @param view The reactive view
2436
- * @returns disposer function, which can be used to stop the view from being updated in the future.
2598
+ /**
2599
+ * Creates a named reactive view and keeps it alive, so that the view is always
2600
+ * updated if one of the dependencies changes, even when the view is not further used by something else.
2601
+ * @param view The reactive view
2602
+ * @returns disposer function, which can be used to stop the view from being updated in the future.
2437
2603
  */
2438
2604
  function autorun(view, opts) {
2439
2605
  var _opts$name, _opts, _opts2, _opts2$signal, _opts3;
@@ -2689,6 +2855,10 @@ var flowBoundAnnotation = /*#__PURE__*/createFlowAnnotation("flow.bound", {
2689
2855
  bound: true
2690
2856
  });
2691
2857
  var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2858
+ // @flow (2022.3 Decorators)
2859
+ if (is20223Decorator(arg2)) {
2860
+ return flowAnnotation.decorate_20223_(arg1, arg2);
2861
+ }
2692
2862
  // @flow
2693
2863
  if (isStringish(arg2)) {
2694
2864
  return storeAnnotation(arg1, arg2, flowAnnotation);
@@ -3075,11 +3245,11 @@ function toJSHelper(source, __alreadySeen) {
3075
3245
  return _res3;
3076
3246
  }
3077
3247
  }
3078
- /**
3079
- * Recursively converts an observable to it's non-observable native counterpart.
3080
- * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.
3081
- * Computed and other non-enumerable properties are completely ignored.
3082
- * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.
3248
+ /**
3249
+ * Recursively converts an observable to it's non-observable native counterpart.
3250
+ * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.
3251
+ * Computed and other non-enumerable properties are completely ignored.
3252
+ * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.
3083
3253
  */
3084
3254
  function toJS(source, options) {
3085
3255
  if ( options) {
@@ -3116,12 +3286,12 @@ function getAtomFromArgs(args) {
3116
3286
  }
3117
3287
  }
3118
3288
 
3119
- /**
3120
- * During a transaction no views are updated until the end of the transaction.
3121
- * The transaction will be run synchronously nonetheless.
3122
- *
3123
- * @param action a function that updates some reactive state
3124
- * @returns any value that was returned by the 'action' parameter.
3289
+ /**
3290
+ * During a transaction no views are updated until the end of the transaction.
3291
+ * The transaction will be run synchronously nonetheless.
3292
+ *
3293
+ * @param action a function that updates some reactive state
3294
+ * @returns any value that was returned by the 'action' parameter.
3125
3295
  */
3126
3296
  function transaction(action, thisArg) {
3127
3297
  if (thisArg === void 0) {
@@ -3709,11 +3879,11 @@ var arrayExtensions = {
3709
3879
  toJSON: function toJSON() {
3710
3880
  return this.slice();
3711
3881
  },
3712
- /*
3713
- * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)
3714
- * since these functions alter the inner structure of the array, the have side effects.
3715
- * Because the have side effects, they should not be used in computed function,
3716
- * and for that reason the do not call dependencyState.notifyObserved
3882
+ /*
3883
+ * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)
3884
+ * since these functions alter the inner structure of the array, the have side effects.
3885
+ * Because the have side effects, they should not be used in computed function,
3886
+ * and for that reason the do not call dependencyState.notifyObserved
3717
3887
  */
3718
3888
  splice: function splice(index, deleteCount) {
3719
3889
  for (var _len = arguments.length, newItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
@@ -3785,10 +3955,10 @@ var arrayExtensions = {
3785
3955
  return false;
3786
3956
  }
3787
3957
  };
3788
- /**
3789
- * Wrap function from prototype
3790
- * Without this, everything works as well, but this works
3791
- * faster as everything works on unproxied values
3958
+ /**
3959
+ * Wrap function from prototype
3960
+ * Without this, everything works as well, but this works
3961
+ * faster as everything works on unproxied values
3792
3962
  */
3793
3963
  addArrayExtension("concat", simpleFunc);
3794
3964
  addArrayExtension("flat", simpleFunc);
@@ -4228,10 +4398,10 @@ var ObservableMap = /*#__PURE__*/function () {
4228
4398
  _proto.toJSON = function toJSON() {
4229
4399
  return Array.from(this);
4230
4400
  };
4231
- /**
4232
- * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
4233
- * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
4234
- * for callback details
4401
+ /**
4402
+ * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
4403
+ * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
4404
+ * for callback details
4235
4405
  */
4236
4406
  _proto.observe_ = function observe_(listener, fireImmediately) {
4237
4407
  if ( fireImmediately === true) {
@@ -4607,12 +4777,12 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4607
4777
  }
4608
4778
  return this.target_[key];
4609
4779
  }
4610
- /**
4611
- * @param {PropertyKey} key
4612
- * @param {any} value
4613
- * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
4614
- * @param {boolean} proxyTrap whether it's called from proxy trap
4615
- * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
4780
+ /**
4781
+ * @param {PropertyKey} key
4782
+ * @param {any} value
4783
+ * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
4784
+ * @param {boolean} proxyTrap whether it's called from proxy trap
4785
+ * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
4616
4786
  */;
4617
4787
  _proto.set_ = function set_(key, value, proxyTrap) {
4618
4788
  if (proxyTrap === void 0) {
@@ -4657,9 +4827,9 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4657
4827
  }
4658
4828
  return entry.get();
4659
4829
  }
4660
- /**
4661
- * @param {PropertyKey} key
4662
- * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop
4830
+ /**
4831
+ * @param {PropertyKey} key
4832
+ * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop
4663
4833
  */;
4664
4834
  _proto.make_ = function make_(key, annotation) {
4665
4835
  if (annotation === true) {
@@ -4687,10 +4857,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4687
4857
  var descriptor = getDescriptor(source, key);
4688
4858
  if (descriptor) {
4689
4859
  var outcome = annotation.make_(this, key, descriptor, source);
4690
- if (outcome === 0 /* Cancel */) {
4860
+ if (outcome === 0 /* MakeResult.Cancel */) {
4691
4861
  return;
4692
4862
  }
4693
- if (outcome === 1 /* Break */) {
4863
+ if (outcome === 1 /* MakeResult.Break */) {
4694
4864
  break;
4695
4865
  }
4696
4866
  }
@@ -4698,12 +4868,12 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4698
4868
  }
4699
4869
  recordAnnotationApplied(this, annotation, key);
4700
4870
  }
4701
- /**
4702
- * @param {PropertyKey} key
4703
- * @param {PropertyDescriptor} descriptor
4704
- * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
4705
- * @param {boolean} proxyTrap whether it's called from proxy trap
4706
- * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
4871
+ /**
4872
+ * @param {PropertyKey} key
4873
+ * @param {PropertyDescriptor} descriptor
4874
+ * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is
4875
+ * @param {boolean} proxyTrap whether it's called from proxy trap
4876
+ * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
4707
4877
  */;
4708
4878
  _proto.extend_ = function extend_(key, descriptor, annotation, proxyTrap) {
4709
4879
  if (proxyTrap === void 0) {
@@ -4722,11 +4892,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4722
4892
  }
4723
4893
  return outcome;
4724
4894
  }
4725
- /**
4726
- * @param {PropertyKey} key
4727
- * @param {PropertyDescriptor} descriptor
4728
- * @param {boolean} proxyTrap whether it's called from proxy trap
4729
- * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
4895
+ /**
4896
+ * @param {PropertyKey} key
4897
+ * @param {PropertyDescriptor} descriptor
4898
+ * @param {boolean} proxyTrap whether it's called from proxy trap
4899
+ * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
4730
4900
  */;
4731
4901
  _proto.defineProperty_ = function defineProperty_(key, descriptor, proxyTrap) {
4732
4902
  if (proxyTrap === void 0) {
@@ -4878,11 +5048,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4878
5048
  }
4879
5049
  return true;
4880
5050
  }
4881
- /**
4882
- * @param {PropertyKey} key
4883
- * @param {PropertyDescriptor} descriptor
4884
- * @param {boolean} proxyTrap whether it's called from proxy trap
4885
- * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
5051
+ /**
5052
+ * @param {PropertyKey} key
5053
+ * @param {PropertyDescriptor} descriptor
5054
+ * @param {boolean} proxyTrap whether it's called from proxy trap
5055
+ * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor
4886
5056
  */;
4887
5057
  _proto.delete_ = function delete_(key, proxyTrap) {
4888
5058
  if (proxyTrap === void 0) {
@@ -4971,10 +5141,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4971
5141
  }
4972
5142
  return true;
4973
5143
  }
4974
- /**
4975
- * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
4976
- * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
4977
- * for callback details
5144
+ /**
5145
+ * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
5146
+ * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
5147
+ * for callback details
4978
5148
  */;
4979
5149
  _proto.observe_ = function observe_(callback, fireImmediately) {
4980
5150
  if ( fireImmediately === true) {
@@ -5077,35 +5247,35 @@ function assertAnnotable(adm, annotation, key) {
5077
5247
  if ( !isAnnotation(annotation)) {
5078
5248
  die("Cannot annotate '" + adm.name_ + "." + key.toString() + "': Invalid annotation.");
5079
5249
  }
5080
- /*
5081
- // Configurable, not sealed, not frozen
5082
- // Possibly not needed, just a little better error then the one thrown by engine.
5083
- // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.
5084
- if (__DEV__) {
5085
- const configurable = getDescriptor(adm.target_, key)?.configurable
5086
- const frozen = Object.isFrozen(adm.target_)
5087
- const sealed = Object.isSealed(adm.target_)
5088
- if (!configurable || frozen || sealed) {
5089
- const fieldName = `${adm.name_}.${key.toString()}`
5090
- const requestedAnnotationType = annotation.annotationType_
5091
- let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`
5092
- if (frozen) {
5093
- error += `\nObject is frozen.`
5094
- }
5095
- if (sealed) {
5096
- error += `\nObject is sealed.`
5097
- }
5098
- if (!configurable) {
5099
- error += `\nproperty is not configurable.`
5100
- // Mention only if caused by us to avoid confusion
5101
- if (hasProp(adm.appliedAnnotations!, key)) {
5102
- error += `\nTo prevent accidental re-definition of a field by a subclass, `
5103
- error += `all annotated fields of non-plain objects (classes) are not configurable.`
5104
- }
5105
- }
5106
- die(error)
5107
- }
5108
- }
5250
+ /*
5251
+ // Configurable, not sealed, not frozen
5252
+ // Possibly not needed, just a little better error then the one thrown by engine.
5253
+ // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.
5254
+ if (__DEV__) {
5255
+ const configurable = getDescriptor(adm.target_, key)?.configurable
5256
+ const frozen = Object.isFrozen(adm.target_)
5257
+ const sealed = Object.isSealed(adm.target_)
5258
+ if (!configurable || frozen || sealed) {
5259
+ const fieldName = `${adm.name_}.${key.toString()}`
5260
+ const requestedAnnotationType = annotation.annotationType_
5261
+ let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`
5262
+ if (frozen) {
5263
+ error += `\nObject is frozen.`
5264
+ }
5265
+ if (sealed) {
5266
+ error += `\nObject is sealed.`
5267
+ }
5268
+ if (!configurable) {
5269
+ error += `\nproperty is not configurable.`
5270
+ // Mention only if caused by us to avoid confusion
5271
+ if (hasProp(adm.appliedAnnotations!, key)) {
5272
+ error += `\nTo prevent accidental re-definition of a field by a subclass, `
5273
+ error += `all annotated fields of non-plain objects (classes) are not configurable.`
5274
+ }
5275
+ }
5276
+ die(error)
5277
+ }
5278
+ }
5109
5279
  */
5110
5280
  // Not annotated
5111
5281
  if ( !isOverride(annotation) && hasProp(adm.appliedAnnotations_, key)) {
@@ -5129,10 +5299,10 @@ var safariPrototypeSetterInheritanceBug = /*#__PURE__*/function () {
5129
5299
  /*#__PURE__*/Object.create(p)["0"] = 1;
5130
5300
  return v === false;
5131
5301
  }();
5132
- /**
5133
- * This array buffer contains two lists of properties, so that all arrays
5134
- * can recycle their property definitions, which significantly improves performance of creating
5135
- * properties on the fly.
5302
+ /**
5303
+ * This array buffer contains two lists of properties, so that all arrays
5304
+ * can recycle their property definitions, which significantly improves performance of creating
5305
+ * properties on the fly.
5136
5306
  */
5137
5307
  var OBSERVABLE_ARRAY_BUFFER_SIZE = 0;
5138
5308
  // Typescript workaround to make sure ObservableArray extends Array
@@ -5329,11 +5499,11 @@ function getDebugName(thing, property) {
5329
5499
  }
5330
5500
  return named.name_;
5331
5501
  }
5332
- /**
5333
- * Helper function for initializing observable structures, it applies:
5334
- * 1. allowStateChanges so we don't violate enforceActions.
5335
- * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.
5336
- * 3. batch to avoid state version updates
5502
+ /**
5503
+ * Helper function for initializing observable structures, it applies:
5504
+ * 1. allowStateChanges so we don't violate enforceActions.
5505
+ * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.
5506
+ * 3. batch to avoid state version updates
5337
5507
  */
5338
5508
  function initObservable(cb) {
5339
5509
  var derivation = untrackedStart();
@@ -5515,22 +5685,22 @@ function isAnnotation(thing) {
5515
5685
  );
5516
5686
  }
5517
5687
 
5518
- /**
5519
- * (c) Michel Weststrate 2015 - 2020
5520
- * MIT Licensed
5521
- *
5522
- * Welcome to the mobx sources! To get a global overview of how MobX internally works,
5523
- * this is a good place to start:
5524
- * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
5525
- *
5526
- * Source folders:
5527
- * ===============
5528
- *
5529
- * - api/ Most of the public static methods exposed by the module can be found here.
5530
- * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
5531
- * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
5532
- * - utils/ Utility stuff.
5533
- *
5688
+ /**
5689
+ * (c) Michel Weststrate 2015 - 2020
5690
+ * MIT Licensed
5691
+ *
5692
+ * Welcome to the mobx sources! To get a global overview of how MobX internally works,
5693
+ * this is a good place to start:
5694
+ * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
5695
+ *
5696
+ * Source folders:
5697
+ * ===============
5698
+ *
5699
+ * - api/ Most of the public static methods exposed by the module can be found here.
5700
+ * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.
5701
+ * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.
5702
+ * - utils/ Utility stuff.
5703
+ *
5534
5704
  */
5535
5705
  ["Symbol", "Map", "Set"].forEach(function (m) {
5536
5706
  var g = getGlobal();