document-model 1.0.26 → 1.0.28
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/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +8 -9
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +9 -12
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +8 -13
- package/dist/browser/internal/index-FBdtB-Z0.js +38 -0
- package/dist/browser/internal/index-MQO6aDba.js +1 -0
- package/dist/browser/internal/{index-gREVUw-G.js → index-oR1tzXEU.js} +1 -1
- package/dist/browser/internal/{index-IVF7gvRz.js → index-qiOnVXbI.js} +2 -2
- package/dist/browser/internal/object-P7bHOWu_.js +1912 -0
- package/dist/browser/internal/object-RV2GJjkF.js +6 -0
- package/dist/browser/src/document/actions/index.d.ts +3 -3
- package/dist/browser/src/document/object.d.ts +63 -0
- package/dist/browser/src/document/reducer.d.ts +16 -0
- package/dist/browser/src/document/schema/types.d.ts +9 -12
- package/dist/browser/src/document/signal.d.ts +1 -0
- package/dist/browser/src/document/types.d.ts +9 -0
- package/dist/browser/src/document/utils/base.d.ts +7 -4
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +12 -13
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +9 -16
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +8 -17
- package/dist/node/internal/index-E6Dehju3.js +1 -0
- package/dist/node/internal/index-Rc3pWGDQ.js +38 -0
- package/dist/node/internal/{index-VzErJ06c.js → index-r_Cve_NX.js} +1 -1
- package/dist/node/internal/{index-AWkBpPdl.js → index-uFGJxYP7.js} +3 -3
- package/dist/node/internal/object-51-uoy0f.js +1 -0
- package/dist/node/internal/object-qR4Tf50L.js +911 -0
- package/dist/node/src/document/actions/index.d.ts +3 -3
- package/dist/node/src/document/object.d.ts +63 -0
- package/dist/node/src/document/reducer.d.ts +16 -0
- package/dist/node/src/document/schema/types.d.ts +9 -12
- package/dist/node/src/document/signal.d.ts +1 -0
- package/dist/node/src/document/types.d.ts +9 -0
- package/dist/node/src/document/utils/base.d.ts +7 -4
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/browser/internal/index-JkTAMqR0.js +0 -36
- package/dist/browser/internal/index-ZuT5Pi3Z.js +0 -1
- package/dist/browser/internal/object-1Edh7roc.js +0 -1844
- package/dist/browser/internal/object-v0zgcnse.js +0 -6
- package/dist/browser/test/document/undo.test.d.ts +0 -1
- package/dist/jest.config.d.ts +0 -8
- package/dist/node/internal/index-8_P5_maf.js +0 -1
- package/dist/node/internal/index-y-8qoZvC.js +0 -36
- package/dist/node/internal/object-6KU11KDZ.js +0 -843
- package/dist/node/internal/object-YfG4E2oW.js +0 -1
- package/dist/node/test/document/redo.test.d.ts +0 -1
- package/dist/node/test/document/undo.test.d.ts +0 -1
- package/dist/src/document/actions/creators.d.ts +0 -47
- package/dist/src/document/actions/index.d.ts +0 -10
- package/dist/src/document/actions/types.d.ts +0 -8
- package/dist/src/document/index.d.ts +0 -6
- package/dist/src/document/object.d.ts +0 -510
- package/dist/src/document/reducer.d.ts +0 -32
- package/dist/src/document/schema/index.d.ts +0 -2
- package/dist/src/document/schema/types.d.ts +0 -177
- package/dist/src/document/schema/zod.d.ts +0 -113
- package/dist/src/document/signal.d.ts +0 -28
- package/dist/src/document/types.d.ts +0 -210
- package/dist/src/document/utils/base.d.ts +0 -77
- package/dist/src/document/utils/browser.d.ts +0 -10
- package/dist/src/document/utils/file.d.ts +0 -47
- package/dist/src/document/utils/index.d.ts +0 -3
- package/dist/src/document/utils/node.d.ts +0 -9
- package/dist/src/document-model/custom/reducers/header.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/module.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/operation-error.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/operation-example.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/operation.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/state.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/versioning.d.ts +0 -7
- package/dist/src/document-model/custom/utils.d.ts +0 -1
- package/dist/src/document-model/gen/actions.d.ts +0 -15
- package/dist/src/document-model/gen/creators.d.ts +0 -7
- package/dist/src/document-model/gen/document-model.d.ts +0 -2
- package/dist/src/document-model/gen/header/actions.d.ts +0 -9
- package/dist/src/document-model/gen/header/creators.d.ts +0 -8
- package/dist/src/document-model/gen/header/object.d.ts +0 -12
- package/dist/src/document-model/gen/header/operations.d.ts +0 -10
- package/dist/src/document-model/gen/index.d.ts +0 -5
- package/dist/src/document-model/gen/module/actions.d.ts +0 -8
- package/dist/src/document-model/gen/module/creators.d.ts +0 -7
- package/dist/src/document-model/gen/module/object.d.ts +0 -11
- package/dist/src/document-model/gen/module/operations.d.ts +0 -9
- package/dist/src/document-model/gen/object.d.ts +0 -28
- package/dist/src/document-model/gen/operation/actions.d.ts +0 -13
- package/dist/src/document-model/gen/operation/creators.d.ts +0 -12
- package/dist/src/document-model/gen/operation/object.d.ts +0 -16
- package/dist/src/document-model/gen/operation/operations.d.ts +0 -14
- package/dist/src/document-model/gen/operation-error/actions.d.ts +0 -10
- package/dist/src/document-model/gen/operation-error/creators.d.ts +0 -9
- package/dist/src/document-model/gen/operation-error/object.d.ts +0 -13
- package/dist/src/document-model/gen/operation-error/operations.d.ts +0 -11
- package/dist/src/document-model/gen/operation-example/actions.d.ts +0 -7
- package/dist/src/document-model/gen/operation-example/creators.d.ts +0 -6
- package/dist/src/document-model/gen/operation-example/object.d.ts +0 -10
- package/dist/src/document-model/gen/operation-example/operations.d.ts +0 -8
- package/dist/src/document-model/gen/reducer.d.ts +0 -5
- package/dist/src/document-model/gen/schema/index.d.ts +0 -2
- package/dist/src/document-model/gen/schema/types.d.ts +0 -453
- package/dist/src/document-model/gen/schema/zod.d.ts +0 -453
- package/dist/src/document-model/gen/state/actions.d.ts +0 -9
- package/dist/src/document-model/gen/state/creators.d.ts +0 -8
- package/dist/src/document-model/gen/state/object.d.ts +0 -12
- package/dist/src/document-model/gen/state/operations.d.ts +0 -10
- package/dist/src/document-model/gen/types.d.ts +0 -8
- package/dist/src/document-model/gen/utils.d.ts +0 -6
- package/dist/src/document-model/gen/versioning/actions.d.ts +0 -8
- package/dist/src/document-model/gen/versioning/creators.d.ts +0 -7
- package/dist/src/document-model/gen/versioning/object.d.ts +0 -11
- package/dist/src/document-model/gen/versioning/operations.d.ts +0 -9
- package/dist/src/document-model/index.d.ts +0 -75
- package/dist/src/index.d.ts +0 -25
- package/dist/test/document/local.test.d.ts +0 -1
- package/dist/test/document/object.test.d.ts +0 -1
- package/dist/test/document/prune.test.d.ts +0 -1
- package/dist/test/document/redo.test.d.ts +0 -1
- package/dist/test/document/reducer.test.d.ts +0 -1
- package/dist/test/document/skip-operations.test.d.ts +0 -1
- package/dist/test/document/undo.test.d.ts +0 -1
- package/dist/test/document/utils.test.d.ts +0 -1
- package/dist/test/document-model/object.test.d.ts +0 -1
- package/dist/test/document-model/skip-operations.test.d.ts +0 -1
- package/dist/test/document-model/zip.test.d.ts +0 -1
- package/dist/test/helpers.d.ts +0 -32
- package/dist/vite.config.d.ts +0 -2
- package/dist/vitest.config.d.ts +0 -2
- /package/dist/{test → browser/test}/document/undo-redo.test.d.ts +0 -0
- /package/dist/{browser/test/document/redo.test.d.ts → node/test/document/undo-redo.test.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Action, Document, ImmutableStateReducer, PruneAction, RedoAction, State, UndoAction } from '../types';
|
|
1
|
+
import { Action, Document, ImmutableStateReducer, PruneAction, RedoAction, State, UndoAction, UndoRedoProcessResult } from '../types';
|
|
2
2
|
export declare function setNameOperation<T>(document: T, name: string): T;
|
|
3
|
-
export declare function undoOperation<T, A extends Action, L>(document: Document<T, A, L>, action: UndoAction,
|
|
4
|
-
export declare function redoOperation<T, A extends Action, L>(document: Document<T, A, L>, action: RedoAction,
|
|
3
|
+
export declare function undoOperation<T, A extends Action, L>(document: Document<T, A, L>, action: UndoAction, skip: number): UndoRedoProcessResult<T, A, L>;
|
|
4
|
+
export declare function redoOperation<T, A extends Action, L>(document: Document<T, A, L>, action: RedoAction, skip: number): UndoRedoProcessResult<T, A, L>;
|
|
5
5
|
export declare function pruneOperation<T, A extends Action, L>(document: Document<T, A, L>, action: PruneAction, wrappedReducer: ImmutableStateReducer<T, A, L>): Document<T, A, L>;
|
|
6
6
|
export declare function loadStateOperation<T, A extends Action, L>(oldDocument: Document<T, A, L>, newDocument: {
|
|
7
7
|
name: string;
|
|
@@ -400,6 +400,69 @@ export declare abstract class BaseDocument<T, A extends Action, L = unknown> {
|
|
|
400
400
|
};
|
|
401
401
|
};
|
|
402
402
|
};
|
|
403
|
+
readonly clipboard: readonly ({
|
|
404
|
+
readonly input: {
|
|
405
|
+
readonly operations: number;
|
|
406
|
+
readonly state: {
|
|
407
|
+
readonly data?: unknown;
|
|
408
|
+
readonly name: string;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
readonly type: "LOAD_STATE";
|
|
412
|
+
readonly scope: OperationScope;
|
|
413
|
+
readonly index: number;
|
|
414
|
+
readonly timestamp: string;
|
|
415
|
+
readonly hash: string;
|
|
416
|
+
readonly skip: number;
|
|
417
|
+
} | {
|
|
418
|
+
readonly input: {
|
|
419
|
+
readonly end?: import("./types").InputMaybe<number>;
|
|
420
|
+
readonly start?: import("./types").InputMaybe<number>;
|
|
421
|
+
};
|
|
422
|
+
readonly type: "PRUNE";
|
|
423
|
+
readonly scope: OperationScope;
|
|
424
|
+
readonly index: number;
|
|
425
|
+
readonly timestamp: string;
|
|
426
|
+
readonly hash: string;
|
|
427
|
+
readonly skip: number;
|
|
428
|
+
} | {
|
|
429
|
+
readonly input: number;
|
|
430
|
+
readonly type: "REDO";
|
|
431
|
+
readonly scope: OperationScope;
|
|
432
|
+
readonly index: number;
|
|
433
|
+
readonly timestamp: string;
|
|
434
|
+
readonly hash: string;
|
|
435
|
+
readonly skip: number;
|
|
436
|
+
} | {
|
|
437
|
+
readonly input: string;
|
|
438
|
+
readonly type: "SET_NAME";
|
|
439
|
+
readonly scope: "global";
|
|
440
|
+
readonly index: number;
|
|
441
|
+
readonly timestamp: string;
|
|
442
|
+
readonly hash: string;
|
|
443
|
+
readonly skip: number;
|
|
444
|
+
} | {
|
|
445
|
+
readonly input: number;
|
|
446
|
+
readonly type: "UNDO";
|
|
447
|
+
readonly scope: OperationScope;
|
|
448
|
+
readonly index: number;
|
|
449
|
+
readonly timestamp: string;
|
|
450
|
+
readonly hash: string;
|
|
451
|
+
readonly skip: number;
|
|
452
|
+
} | {
|
|
453
|
+
readonly input: unknown;
|
|
454
|
+
readonly type: "NOOP";
|
|
455
|
+
readonly scope: OperationScope;
|
|
456
|
+
readonly index: number;
|
|
457
|
+
readonly timestamp: string;
|
|
458
|
+
readonly hash: string;
|
|
459
|
+
readonly skip: number;
|
|
460
|
+
} | import("immer").Immutable<A & {
|
|
461
|
+
index: number;
|
|
462
|
+
timestamp: string;
|
|
463
|
+
hash: string;
|
|
464
|
+
skip: number;
|
|
465
|
+
}>)[];
|
|
403
466
|
};
|
|
404
467
|
/**
|
|
405
468
|
* Gets the attachment associated with the given key.
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { BaseAction } from './actions/types';
|
|
2
|
+
import { UndoRedoAction } from './schema';
|
|
2
3
|
import { Action, Document, ImmutableStateReducer, ReducerOptions } from './types';
|
|
3
4
|
import { SignalDispatch } from './signal';
|
|
5
|
+
type UndoRedoProcessResult<T, A extends Action, L> = {
|
|
6
|
+
document: Document<T, A, L>;
|
|
7
|
+
action: A | BaseAction;
|
|
8
|
+
skip: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Processes an UNDO or REDO action.
|
|
12
|
+
*
|
|
13
|
+
* @param document The current state of the document.
|
|
14
|
+
* @param action The action being applied to the document.
|
|
15
|
+
* @param skip The number of operations to skip before applying the action.
|
|
16
|
+
* @returns The updated document, calculated skip value and transformed action (if apply).
|
|
17
|
+
*/
|
|
18
|
+
export declare function processUndoRedo<T, A extends Action, L>(document: Document<T, A, L>, action: UndoRedoAction, skip: number): UndoRedoProcessResult<T, A, L>;
|
|
4
19
|
/**
|
|
5
20
|
* Base document reducer that wraps a custom document reducer and handles
|
|
6
21
|
* document-level actions such as undo, redo, prune, and set name.
|
|
@@ -14,3 +29,4 @@ import { SignalDispatch } from './signal';
|
|
|
14
29
|
* @returns The new state of the document.
|
|
15
30
|
*/
|
|
16
31
|
export declare function baseReducer<T, A extends Action, L>(document: Document<T, A, L>, action: A | BaseAction, customReducer: ImmutableStateReducer<T, A, L>, dispatch?: SignalDispatch, options?: ReducerOptions): Document<T, A, L>;
|
|
32
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { OperationScope } from '..';
|
|
2
2
|
export type Maybe<T> = T | null;
|
|
3
3
|
export type InputMaybe<T> = T | null | undefined;
|
|
4
|
-
export type Exact<T extends {
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
}> = {
|
|
4
|
+
export type Exact<T extends Record<string, unknown>> = {
|
|
7
5
|
[K in keyof T]: T[K];
|
|
8
6
|
};
|
|
9
7
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
@@ -12,9 +10,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
|
12
10
|
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
13
11
|
[SubKey in K]: Maybe<T[SubKey]>;
|
|
14
12
|
};
|
|
15
|
-
export type MakeEmpty<T extends {
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
}, K extends keyof T> = {
|
|
13
|
+
export type MakeEmpty<T extends Record<string, unknown>, K extends keyof T> = {
|
|
18
14
|
[_ in K]?: never;
|
|
19
15
|
};
|
|
20
16
|
export type Incremental<T> = T | {
|
|
@@ -64,6 +60,7 @@ export type Action = IAction & {
|
|
|
64
60
|
type: Scalars['String']['output'];
|
|
65
61
|
};
|
|
66
62
|
export type BaseAction = LoadStateAction | PruneAction | RedoAction | SetNameAction | UndoAction | NOOPAction;
|
|
63
|
+
export type UndoRedoAction = RedoAction | UndoAction;
|
|
67
64
|
export type DocumentFile = {
|
|
68
65
|
__typename?: 'DocumentFile';
|
|
69
66
|
data: Scalars['String']['output'];
|
|
@@ -91,7 +88,7 @@ export type IOperation = {
|
|
|
91
88
|
export type Load_State = 'LOAD_STATE';
|
|
92
89
|
export type LoadStateAction = {
|
|
93
90
|
input: LoadStateActionInput;
|
|
94
|
-
type: Load_State
|
|
91
|
+
type: Load_State;
|
|
95
92
|
scope: OperationScope;
|
|
96
93
|
};
|
|
97
94
|
export type LoadStateActionInput = {
|
|
@@ -135,7 +132,7 @@ export type Operation = IOperation & {
|
|
|
135
132
|
export type Prune = 'PRUNE';
|
|
136
133
|
export type PruneAction = {
|
|
137
134
|
input: PruneActionInput;
|
|
138
|
-
type: Prune
|
|
135
|
+
type: Prune;
|
|
139
136
|
scope: OperationScope;
|
|
140
137
|
};
|
|
141
138
|
export type PruneActionInput = {
|
|
@@ -149,13 +146,13 @@ export type Query = {
|
|
|
149
146
|
export type Redo = 'REDO';
|
|
150
147
|
export type RedoAction = {
|
|
151
148
|
input: Scalars['Int']['input'];
|
|
152
|
-
type: Redo
|
|
149
|
+
type: Redo;
|
|
153
150
|
scope: OperationScope;
|
|
154
151
|
};
|
|
155
152
|
export type Set_Name = 'SET_NAME';
|
|
156
153
|
export type SetNameAction = {
|
|
157
154
|
input: Scalars['String']['input'];
|
|
158
|
-
type: Set_Name
|
|
155
|
+
type: Set_Name;
|
|
159
156
|
scope: 'global';
|
|
160
157
|
};
|
|
161
158
|
export type SetNameOperation = IOperation & {
|
|
@@ -169,12 +166,12 @@ export type SetNameOperation = IOperation & {
|
|
|
169
166
|
export type Undo = 'UNDO';
|
|
170
167
|
export type UndoAction = {
|
|
171
168
|
input: Scalars['Int']['input'];
|
|
172
|
-
type: Undo
|
|
169
|
+
type: Undo;
|
|
173
170
|
scope: OperationScope;
|
|
174
171
|
};
|
|
175
172
|
export type NOOP = 'NOOP';
|
|
176
173
|
export type NOOPAction = {
|
|
177
174
|
input: Scalars['Unknown']['input'];
|
|
178
|
-
type: NOOP
|
|
175
|
+
type: NOOP;
|
|
179
176
|
scope: OperationScope;
|
|
180
177
|
};
|
|
@@ -22,6 +22,7 @@ export type DeleteChildDocumentSignal = ISignal<'DELETE_CHILD_DOCUMENT', DeleteC
|
|
|
22
22
|
export type CopyChildDocumentInput = {
|
|
23
23
|
id: string;
|
|
24
24
|
newId: string;
|
|
25
|
+
synchronizationUnits: SynchronizationUnit[];
|
|
25
26
|
};
|
|
26
27
|
export type CopyChildDocumentSignal = ISignal<'COPY_CHILD_DOCUMENT', CopyChildDocumentInput>;
|
|
27
28
|
export type Signal = CreateChildDocumentSignal | DeleteChildDocumentSignal | CopyChildDocumentSignal;
|
|
@@ -30,6 +30,8 @@ export type ActionWithAttachment<T extends string = string, I = unknown, S exten
|
|
|
30
30
|
export type ReducerOptions = {
|
|
31
31
|
/** The number of operations to skip before this new action is applied */
|
|
32
32
|
skip?: number;
|
|
33
|
+
/** When true the skip count is ignored and the action is applied regardless of the skip count */
|
|
34
|
+
ignoreSkipOperations?: boolean;
|
|
33
35
|
};
|
|
34
36
|
/**
|
|
35
37
|
* A pure function that takes an action and the previous state
|
|
@@ -151,6 +153,8 @@ ExtendedState<GlobalState, LocalState> & {
|
|
|
151
153
|
operations: DocumentOperations<A>;
|
|
152
154
|
/** The initial state of the document, enabling replaying operations. */
|
|
153
155
|
initialState: ExtendedState<GlobalState, LocalState>;
|
|
156
|
+
/** A list of undone operations */
|
|
157
|
+
clipboard: Operation<BaseAction | A>[];
|
|
154
158
|
};
|
|
155
159
|
/**
|
|
156
160
|
* String type representing an attachment in a Document.
|
|
@@ -199,3 +203,8 @@ export type DocumentModelLib = {
|
|
|
199
203
|
documentModels: DocumentModel[];
|
|
200
204
|
editors: Editor[];
|
|
201
205
|
};
|
|
206
|
+
export type UndoRedoProcessResult<T, A extends Action, L> = {
|
|
207
|
+
document: Document<T, A, L>;
|
|
208
|
+
action: A | BaseAction;
|
|
209
|
+
skip: number;
|
|
210
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { baseReducer } from '../reducer';
|
|
2
|
-
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope, State, CreateState, PartialState, DocumentOperations, DocumentHeader, DocumentOperationsIgnoreMap, Operation, MappedOperation } from '../types';
|
|
2
|
+
import { Action, BaseAction, UndoRedoAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope, State, CreateState, PartialState, DocumentOperations, DocumentHeader, DocumentOperationsIgnoreMap, Operation, MappedOperation } from '../types';
|
|
3
3
|
import { SignalDispatch } from '../signal';
|
|
4
|
+
export declare function isUndoRedo(action: Action): action is UndoRedoAction;
|
|
4
5
|
export declare function isBaseAction(action: Action): action is BaseAction;
|
|
5
6
|
/**
|
|
6
7
|
* Helper function to be used by action creators.
|
|
@@ -64,11 +65,13 @@ export declare function readOnly<T>(value: T): Immutable<T>;
|
|
|
64
65
|
* Maps skipped operations in an array of operations.
|
|
65
66
|
* Skipped operations are operations that are ignored during processing.
|
|
66
67
|
* @param operations - The array of operations to map.
|
|
68
|
+
* @param skippedHeadOperations - The number of operations to skip at the head of the array of operations.
|
|
67
69
|
* @returns An array of mapped operations with ignore flag indicating if the operation is skipped.
|
|
68
70
|
* @throws Error if the operation index is invalid and there are missing operations.
|
|
69
71
|
*/
|
|
70
|
-
export declare function mapSkippedOperations<A extends Action>(operations: Operation<BaseAction | A>[]): MappedOperation<A>[];
|
|
72
|
+
export declare function mapSkippedOperations<A extends Action>(operations: Operation<BaseAction | A>[], skippedHeadOperations?: number): MappedOperation<A>[];
|
|
71
73
|
export declare function sortOperations<A extends Action>(operations: DocumentOperations<A>): Operation<BaseAction | A>[];
|
|
72
74
|
export declare function sortMappedOperations<A extends Action>(operations: DocumentOperationsIgnoreMap<A>): MappedOperation<A>[];
|
|
73
|
-
export declare function replayOperations<T, A extends Action, L>(initialState: ExtendedState<T, L>, operations: DocumentOperations<A>, reducer: ImmutableStateReducer<T, A, L>, dispatch?: SignalDispatch, header?: DocumentHeader, documentReducer?: typeof baseReducer): Document<T, A, L>;
|
|
74
|
-
export
|
|
75
|
+
export declare function replayOperations<T, A extends Action, L>(initialState: ExtendedState<T, L>, operations: DocumentOperations<A>, reducer: ImmutableStateReducer<T, A, L>, dispatch?: SignalDispatch, header?: DocumentHeader, documentReducer?: typeof baseReducer, skipHeaderOperations?: SkipHeaderOperations): Document<T, A, L>;
|
|
76
|
+
export type SkipHeaderOperations = Partial<Record<OperationScope, number>>;
|
|
77
|
+
export declare function replayDocument<T, A extends Action, L>(initialState: ExtendedState<T, L>, operations: DocumentOperations<A>, reducer: Reducer<T, A, L>, dispatch?: SignalDispatch, header?: DocumentHeader, skipHeaderOperations?: SkipHeaderOperations): Document<T, A, L>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export * from './base';
|
|
2
|
+
export { createAction, createDocument, createExtendedState, createReducer, hashDocument, hashKey, isBaseAction, mapSkippedOperations, readOnly, replayDocument, replayOperations, sortMappedOperations, sortOperations, } from './base';
|
|
2
3
|
export * from './file';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-model",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"private": false,
|
|
6
6
|
"files": [
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"immer": "^10.0.3",
|
|
84
|
-
"json-stringify-deterministic": "
|
|
84
|
+
"json-stringify-deterministic": "1.0.10",
|
|
85
85
|
"jszip": "^3.10.1",
|
|
86
86
|
"mime": "^4.0.1",
|
|
87
87
|
"zod": "^3.22.4"
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { f as e, b as a, a as s, c as t, j as o, k as r, m as n, n as i, o as l, i as c, l as p, e as d, p as u, r as m, q as y, t as O, s as b, d as _, u as g, v as F, B as f, h as D, g as S, w as h, z as j } from "./object-1Edh7roc.js";
|
|
2
|
-
const v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3
|
-
__proto__: null,
|
|
4
|
-
createAction: e,
|
|
5
|
-
createDocument: a,
|
|
6
|
-
createExtendedState: s,
|
|
7
|
-
createReducer: t,
|
|
8
|
-
createZip: o,
|
|
9
|
-
getLocalFile: r,
|
|
10
|
-
getRemoteFile: n,
|
|
11
|
-
hashDocument: i,
|
|
12
|
-
hashKey: l,
|
|
13
|
-
isBaseAction: c,
|
|
14
|
-
loadFromFile: p,
|
|
15
|
-
loadFromInput: d,
|
|
16
|
-
mapSkippedOperations: u,
|
|
17
|
-
readOnly: m,
|
|
18
|
-
replayDocument: y,
|
|
19
|
-
replayOperations: O,
|
|
20
|
-
saveToFile: b,
|
|
21
|
-
saveToFileHandle: _,
|
|
22
|
-
sortMappedOperations: g,
|
|
23
|
-
sortOperations: F
|
|
24
|
-
}, Symbol.toStringTag, { value: "Module" })), x = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
25
|
-
__proto__: null,
|
|
26
|
-
BaseDocument: f,
|
|
27
|
-
actions: D,
|
|
28
|
-
applyMixins: S,
|
|
29
|
-
baseReducer: h,
|
|
30
|
-
utils: v,
|
|
31
|
-
z: j
|
|
32
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
33
|
-
export {
|
|
34
|
-
x as D,
|
|
35
|
-
v as i
|
|
36
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./object-v0zgcnse.js"),t=Object.freeze(Object.defineProperty({__proto__:null,createAction:e.createAction,createDocument:e.createDocument,createExtendedState:e.createExtendedState,createReducer:e.createReducer,createZip:e.createZip,getLocalFile:e.getLocalFile,getRemoteFile:e.getRemoteFile,hashDocument:e.hashDocument,hashKey:e.hashKey,isBaseAction:e.isBaseAction,loadFromFile:e.loadFromFile,loadFromInput:e.loadFromInput,mapSkippedOperations:e.mapSkippedOperations,readOnly:e.readOnly,replayDocument:e.replayDocument,replayOperations:e.replayOperations,saveToFile:e.saveToFile,saveToFileHandle:e.saveToFileHandle,sortMappedOperations:e.sortMappedOperations,sortOperations:e.sortOperations},Symbol.toStringTag,{value:"Module"})),o=Object.freeze(Object.defineProperty({__proto__:null,BaseDocument:e.BaseDocument,actions:e.BaseActions,applyMixins:e.applyMixins,baseReducer:e.baseReducer,utils:t,z:e.zod},Symbol.toStringTag,{value:"Module"}));exports.Document=o;exports.index=t;
|