mobx-keystone 1.24.0 → 1.25.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.25.0
4
+
5
+ - Performance: reduced scalar mutation overhead by returning primitive values before entering internal MobX actions used for tree bookkeeping.
6
+ - Performance: applying the current snapshot by reference skips model-pool construction, avoiding a tree traversal on first use. Pending child changes are still flushed before treating the snapshot as unchanged.
7
+ - Performance: reduced automatic type-checking overhead for nested model mutations by traversing logical parents directly.
8
+ - Performance: reduce reconciliation work for non-null primitive model fields during snapshot updates, skipping unchanged fields and directly assigning changed scalar values.
9
+ - Performance: reduced construction work for models created from empty data with primitive defaults, reusing their initialization snapshot instead of rereading observable fields. Structured defaults retain the general initialization path.
10
+ - Performance: `findParent` no longer constructs a discarded path array while searching ancestors. `findParentPath` shares the same traversal and retains its existing path output.
11
+ - Performance: reduced child-set copying overhead in `onChildAttachedTo`, improving attachment tracking for large collections.
12
+ - Performance: path construction now scales linearly with tree depth, avoiding repeated array front insertions in `getRootPath`, `getParentToChildPath`, and `findParentPath`.
13
+ - Performance: reduced `applySnapshot` traversal overhead by using internal snapshots for reconciliation comparisons, avoiding unnecessary snapshot freezing and observation metadata. Fresh 10,000-item editor snapshot refreshes take about 9–17% less time in local benchmarks.
14
+ - Performance: reduced snapshot hydration work for models with primitive defaults or regenerated IDs by updating the existing initialization snapshot instead of rebuilding it from observable data. Initialization bookkeeping also allocates fewer temporary objects.
15
+ - Performance: reduced large-array insertion and removal overhead by batching parent-path reindexing for unchanged children. Moving the first model to the end of a 10k–50k-item editor list is about 30% faster with undo and snapshot observation enabled.
16
+
17
+ ## 1.24.1
18
+
19
+ - Fixed a serious type-safety regression in the declarations published with versions 1.20.0 through 1.24.0, where `types.object(...)` data, snapshot, and stored-data types could collapse to `{ [x: string]: any }`. This allowed incorrect property values, unknown properties, and arbitrary property access to pass TypeScript checks. The missing declaration dependencies are now retained, restoring the exact object shape and optional-property inference, and package builds now fully type-check every generated declaration to prevent this from recurring.
20
+
3
21
  ## 1.24.0
4
22
 
5
23
  - Added MobX 7 compatibility with standard-decorator coverage across TypeScript, Babel, and SWC.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Javier González Garcés
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Javier González Garcés
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,9 +1,13 @@
1
1
  <p align="center">
2
- <img src="./apps/site/static/img/logo.png" height="128" />
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="./apps/site/static/img/logo-dark.png" />
4
+ <source media="(prefers-color-scheme: light)" srcset="./apps/site/static/img/logo-light.png" />
5
+ <img src="./apps/site/static/img/logo-light.png" alt="mobx-keystone" height="128" />
6
+ </picture>
3
7
  <h1 align="center">mobx-keystone</h1>
4
8
  </p>
5
9
  <p align="center">
6
- <i>A MobX powered state management solution based on data trees with first-class support for TypeScript, snapshots, patches and much more</i>
10
+ <i>A MobX-powered state management solution based on data trees, with first-class support for TypeScript, snapshots, patches, and much more</i>
7
11
  </p>
8
12
 
9
13
  <p align="center">
@@ -32,9 +36,7 @@
32
36
  >
33
37
  > ## [mobx-keystone.js.org](https://mobx-keystone.js.org)
34
38
 
35
- #### New! Y.js bindings for `mobx-keystone` are now available in the `mobx-keystone-yjs` package as well as a working example in the examples section of the online docs.
36
-
37
- #### New! Loro CRDT bindings for `mobx-keystone` are now available in the `mobx-keystone-loro` package with native move operation support for arrays, as well as a working example in the examples section of the online docs.
39
+ Collaborative editing is available through the [`mobx-keystone-yjs`](https://mobx-keystone.js.org/integrations/yjs-binding) and [`mobx-keystone-loro`](https://mobx-keystone.js.org/integrations/loro-binding) CRDT bindings, with complete examples in the online docs.
38
40
 
39
41
  ## Introduction
40
42
 
@@ -46,6 +48,7 @@ You can think of it as a TypeScript-first model layer on top of MobX that scales
46
48
  ### Quick links
47
49
 
48
50
  - [Installation](https://mobx-keystone.js.org/installation)
51
+ - [Getting Started](https://mobx-keystone.js.org/getting-started)
49
52
  - [Class Models](https://mobx-keystone.js.org/class-models)
50
53
  - [Todo List Example](https://mobx-keystone.js.org/examples/todo-list)
51
54
  - [MST Migration Guide](https://mobx-keystone.js.org/mst-migration-guide)
@@ -124,21 +127,23 @@ Model instances are created from props, protect their own updates, and reconcile
124
127
 
125
128
  ## Requirements
126
129
 
127
- This library requires a more or less modern JavaScript environment to work, namely one with support for:
130
+ This library requires a modern JavaScript environment with support for:
128
131
 
129
132
  - MobX 7, 6, 5 (or 4 with its gotchas)
130
133
  - Proxies
131
134
  - Symbols
132
135
  - WeakMap/WeakSet
133
136
 
134
- In other words, it should work on mostly anything except _it won't work in Internet Explorer_.
137
+ In practice, this covers current browsers and Node.js releases, but not Internet Explorer.
135
138
 
136
- If you are using TypeScript, then version >= 4.2.0 is recommended, though it _might_ work with older versions.
139
+ TypeScript 5.0 or newer is recommended so you can use standard decorators. Legacy decorators remain supported by `mobx-keystone`; see the [installation guide](https://mobx-keystone.js.org/installation) for the required compiler configuration and the MobX 7 compatibility note.
137
140
 
138
141
  ## Installation
139
142
 
140
- > `npm install mobx-keystone`
143
+ > `npm install mobx mobx-keystone`
144
+
145
+ > `yarn add mobx mobx-keystone`
141
146
 
142
- > `yarn add mobx-keystone`
147
+ > `pnpm add mobx mobx-keystone`
143
148
 
144
- > `pnpm add mobx-keystone`
149
+ `mobx` is a peer dependency and must be installed alongside `mobx-keystone`.