@loro-extended/change 0.9.0 → 0.9.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/dist/index.d.ts +9 -4
- package/dist/index.js +215 -187
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/conversion.test.ts +72 -72
- package/src/conversion.ts +5 -5
- package/src/overlay-recursion.test.ts +325 -0
- package/src/overlay.ts +45 -8
- package/src/typed-refs/base.ts +10 -0
- package/src/typed-refs/counter.ts +2 -2
- package/src/typed-refs/doc.ts +17 -24
- package/src/typed-refs/list-base.ts +42 -18
- package/src/typed-refs/map.ts +38 -65
- package/src/typed-refs/movable-list.ts +2 -2
- package/src/typed-refs/record.test.ts +9 -9
- package/src/typed-refs/record.ts +56 -69
- package/src/typed-refs/text.ts +6 -6
- package/src/typed-refs/tree.ts +3 -3
- package/src/typed-refs/utils.ts +93 -8
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,11 @@ declare abstract class TypedRef<Shape extends DocShape | ContainerShape> {
|
|
|
103
103
|
protected get shape(): Shape;
|
|
104
104
|
protected get placeholder(): Infer<Shape> | undefined;
|
|
105
105
|
protected get readonly(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Throws an error if this ref is in readonly mode.
|
|
108
|
+
* Call this at the start of any mutating method.
|
|
109
|
+
*/
|
|
110
|
+
protected assertMutable(): void;
|
|
106
111
|
protected get container(): ShapeToContainer<Shape>;
|
|
107
112
|
}
|
|
108
113
|
|
|
@@ -160,7 +165,7 @@ declare class MapRef<NestedShapes extends Record<string, ContainerOrValueShape>>
|
|
|
160
165
|
protected get container(): LoroMap;
|
|
161
166
|
absorbPlainValues(): void;
|
|
162
167
|
getTypedRefParams<S extends ContainerShape>(key: string, shape: S): TypedRefParams<ContainerShape>;
|
|
163
|
-
|
|
168
|
+
getOrCreateRef<Shape extends ContainerShape | ValueShape>(key: string, shape: Shape): any;
|
|
164
169
|
private createLazyProperties;
|
|
165
170
|
toJSON(): any;
|
|
166
171
|
get(key: string): any;
|
|
@@ -183,13 +188,13 @@ declare class MovableListRef<NestedShape extends ContainerOrValueShape, Item = N
|
|
|
183
188
|
|
|
184
189
|
declare class RecordRef<NestedShape extends ContainerOrValueShape> extends TypedRef<any> {
|
|
185
190
|
[key: string]: Infer<NestedShape> | any;
|
|
186
|
-
private
|
|
191
|
+
private refCache;
|
|
187
192
|
protected get shape(): RecordContainerShape<NestedShape>;
|
|
188
193
|
protected get container(): LoroMap;
|
|
189
194
|
absorbPlainValues(): void;
|
|
190
195
|
getTypedRefParams<S extends ContainerShape>(key: string, shape: S): TypedRefParams<ContainerShape>;
|
|
191
|
-
|
|
192
|
-
get(key: string):
|
|
196
|
+
getOrCreateRef(key: string): any;
|
|
197
|
+
get(key: string): InferMutableType<NestedShape>;
|
|
193
198
|
set(key: string, value: any): void;
|
|
194
199
|
setContainer<C extends Container>(key: string, container: C): C;
|
|
195
200
|
delete(key: string): void;
|