@jbrowse/mobx-state-tree 6.0.0 → 6.2.0

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/index.d.ts CHANGED
@@ -604,7 +604,7 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
604
604
  applySnapshot(snapshot: C): void;
605
605
  private _autoUnbox;
606
606
  _isRunningAction: boolean;
607
- private _hasSnapshotReaction;
607
+ private _snapshotReactionDisposer?;
608
608
  private _observableInstanceState;
609
609
  private _childNodes;
610
610
  private _initialSnapshot;
@@ -663,6 +663,7 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
663
663
  addMiddleWare(handler: IMiddlewareHandler, includeHooks?: boolean): IDisposer;
664
664
  applyPatchLocally(subpath: string, patch: IJsonPatch): void;
665
665
  private _addSnapshotReaction;
666
+ private _removeSnapshotReaction;
666
667
  private _internalEvents?;
667
668
  private _internalEventsHasSubscribers;
668
669
  private _internalEventsRegister;
@@ -913,14 +914,36 @@ type SnapshotOrInstance<T> = SnapshotIn<T> | Instance<T>;
913
914
  * @hidden
914
915
  */
915
916
  declare abstract class BaseType<C, S, T, N extends BaseNode<any, any, any> = BaseNode<C, S, T>> implements IType<C, S, T> {
916
- [$type]: undefined;
917
+ readonly [$type]: undefined;
917
918
  readonly C: C;
918
919
  readonly S: S;
919
920
  readonly T: T;
920
921
  readonly N: N;
921
- readonly isType = true;
922
- readonly name: string;
923
- constructor(name: string);
922
+ readonly isType: true;
923
+ private _name?;
924
+ /**
925
+ * Builds the name of a type that does not get one handed to it. Composite
926
+ * types (`union`, `array`, `map`, `reference`, ...) override this to fold
927
+ * their members' names; see {@link name}. It runs after construction, so
928
+ * unlike a `super(...)` argument it can read the subclass's own fields.
929
+ */
930
+ protected computeName(): string;
931
+ /**
932
+ * Friendly type name.
933
+ *
934
+ * A composite type folds its members' names, which for a union is a map +
935
+ * join over every member — and the result is read only by error messages and
936
+ * `describe()`. So those types leave it unset and it is built on first read
937
+ * and cached: a union that never fails a typecheck never builds one, and
938
+ * jbrowse builds a union per config slot, tens of thousands per session load.
939
+ *
940
+ * Deliberately not a lambda passed to the constructor: that allocated a
941
+ * closure per type (the very cost being avoided) and made two separately
942
+ * built but equivalent types compare unequal, since the closures differ.
943
+ */
944
+ get name(): string;
945
+ set name(value: string);
946
+ constructor(name?: string);
924
947
  create(snapshot?: C, environment?: any): any;
925
948
  getSnapshot(_node: N, _applyPostProcess?: boolean): S;
926
949
  abstract reconcile(current: N, newValue: C | T, parent: AnyObjectNode, subpath: string): N;
@@ -945,7 +968,6 @@ declare abstract class BaseType<C, S, T, N extends BaseNode<any, any, any> = Bas
945
968
  */
946
969
  declare abstract class ComplexType<C, S, T> extends BaseType<C, S, T, ObjectNode<C, S, T>> {
947
970
  identifierAttribute?: string;
948
- constructor(name: string);
949
971
  create(snapshot?: C, environment?: any): any;
950
972
  getValue(node: this["N"]): T;
951
973
  abstract getDefaultSnapshot(): C;
@@ -953,7 +975,7 @@ declare abstract class ComplexType<C, S, T> extends BaseType<C, S, T, ObjectNode
953
975
  abstract finalizeNewInstance(node: this["N"], instance: any): void;
954
976
  abstract applySnapshot(node: this["N"], snapshot: C): void;
955
977
  abstract applyPatchLocally(node: this["N"], subpath: string, patch: IJsonPatch): void;
956
- abstract processInitialSnapshot(childNodes: IChildNodesMap, snapshot: C): S;
978
+ abstract processInitialSnapshot(childNodes: IChildNodesMap): S;
957
979
  abstract getChildren(node: this["N"]): ReadonlyArray<AnyNode>;
958
980
  abstract getChildNode(node: this["N"], key: string): AnyNode;
959
981
  abstract getChildType(propertyName?: string): IAnyType;
@@ -1245,7 +1267,6 @@ declare class IdentifierCache {
1245
1267
  private cacheId;
1246
1268
  private cache;
1247
1269
  private lastCacheModificationPerId;
1248
- constructor();
1249
1270
  private updateLastCacheModificationPerId;
1250
1271
  getLastCacheModificationPerId(identifier: string): string;
1251
1272
  addNodeToCache(node: AnyObjectNode, lastCacheUpdate?: boolean): void;