mobx-keystone 1.23.0 → 1.24.1
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 +9 -0
- package/README.md +12 -11
- package/dist/mobx-keystone.esm.js +187 -144
- package/dist/mobx-keystone.esm.mjs +187 -144
- package/dist/mobx-keystone.umd.js +189 -143
- package/dist/types/modelShared/BaseModelShared.d.ts +7 -1
- package/dist/types/modelShared/modelDecorator.d.ts +1 -1
- package/dist/types/modelShared/prop.d.ts +5 -0
- package/dist/types/types/TypeChecker.d.ts +79 -0
- package/dist/types/types/schemas.d.ts +15 -0
- package/dist/types/utils/index.d.ts +24 -0
- package/package.json +10 -6
- package/src/actionMiddlewares/undoMiddleware.ts +19 -13
- package/src/modelShared/BaseModelShared.ts +1 -1
- package/src/modelShared/modelDecorator.ts +64 -53
- package/src/modelShared/prop.ts +1 -1
- package/src/ref/Ref.ts +4 -5
- package/src/ref/core.ts +2 -2
- package/src/treeUtils/draft.ts +7 -8
- package/src/tweaker/tweakPlainObject.ts +3 -2
- package/src/types/TypeChecker.ts +6 -6
- package/src/types/schemas.ts +2 -2
- package/src/utils/index.ts +134 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 1.24.1
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
|
|
7
|
+
## 1.24.0
|
|
8
|
+
|
|
9
|
+
- Added MobX 7 compatibility with standard-decorator coverage across TypeScript, Babel, and SWC.
|
|
10
|
+
- Performance: reduced fresh model creation overhead by skipping redundant primitive writes when initial data is already observable.
|
|
11
|
+
|
|
3
12
|
## 1.23.0
|
|
4
13
|
|
|
5
14
|
- Behavioral change: snapshot processors are now required to be pure and deterministic, and to round-trip canonical output without changing stored data. This applies to model `fromSnapshotProcessor` / `toSnapshotProcessor`, property-level `withSnapshotProcessor(...)`, typed-property processors, and `types.codec(...)` transforms. To make snapshot work faster, the library now treats processors as replaceable by their result: it may skip the input processor when the incoming snapshot already equals the model's current canonical output snapshot, may cache `toSnapshotProcessor` results, and may not compile a processor at all until it is first needed. A processor that relies on running on every invocation — logging, counters, ID generation, reads or writes of external mutable state — will therefore be called fewer times than before, or not at all. This is silent: there is no error, only the missing side effect. Review any processor that does more than convert its input before upgrading.
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<h1 align="center">mobx-keystone</h1>
|
|
4
4
|
</p>
|
|
5
5
|
<p align="center">
|
|
6
|
-
<i>A MobX
|
|
6
|
+
<i>A MobX-powered state management solution based on data trees, with first-class support for TypeScript, snapshots, patches, and much more</i>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
@@ -32,9 +32,7 @@
|
|
|
32
32
|
>
|
|
33
33
|
> ## [mobx-keystone.js.org](https://mobx-keystone.js.org)
|
|
34
34
|
|
|
35
|
-
|
|
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.
|
|
35
|
+
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
36
|
|
|
39
37
|
## Introduction
|
|
40
38
|
|
|
@@ -46,6 +44,7 @@ You can think of it as a TypeScript-first model layer on top of MobX that scales
|
|
|
46
44
|
### Quick links
|
|
47
45
|
|
|
48
46
|
- [Installation](https://mobx-keystone.js.org/installation)
|
|
47
|
+
- [Getting Started](https://mobx-keystone.js.org/getting-started)
|
|
49
48
|
- [Class Models](https://mobx-keystone.js.org/class-models)
|
|
50
49
|
- [Todo List Example](https://mobx-keystone.js.org/examples/todo-list)
|
|
51
50
|
- [MST Migration Guide](https://mobx-keystone.js.org/mst-migration-guide)
|
|
@@ -124,21 +123,23 @@ Model instances are created from props, protect their own updates, and reconcile
|
|
|
124
123
|
|
|
125
124
|
## Requirements
|
|
126
125
|
|
|
127
|
-
This library requires a
|
|
126
|
+
This library requires a modern JavaScript environment with support for:
|
|
128
127
|
|
|
129
|
-
- MobX 6, 5
|
|
128
|
+
- MobX 7, 6, 5 (or 4 with its gotchas)
|
|
130
129
|
- Proxies
|
|
131
130
|
- Symbols
|
|
132
131
|
- WeakMap/WeakSet
|
|
133
132
|
|
|
134
|
-
In
|
|
133
|
+
In practice, this covers current browsers and Node.js releases, but not Internet Explorer.
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
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
136
|
|
|
138
137
|
## Installation
|
|
139
138
|
|
|
140
|
-
> `npm install mobx-keystone`
|
|
139
|
+
> `npm install mobx mobx-keystone`
|
|
140
|
+
|
|
141
|
+
> `yarn add mobx mobx-keystone`
|
|
141
142
|
|
|
142
|
-
> `
|
|
143
|
+
> `pnpm add mobx mobx-keystone`
|
|
143
144
|
|
|
144
|
-
|
|
145
|
+
`mobx` is a peer dependency and must be installed alongside `mobx-keystone`.
|