@manuscripts/track-changes-plugin 1.7.2 → 1.7.3

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.
Files changed (118) hide show
  1. package/dist/cjs/ChangeSet.js +155 -0
  2. package/dist/cjs/actions.js +23 -0
  3. package/dist/cjs/change-steps/diffChangeSteps.js +63 -0
  4. package/dist/cjs/change-steps/matchInserted.js +70 -0
  5. package/dist/cjs/change-steps/processChangeSteps.js +141 -0
  6. package/dist/cjs/changes/applyChanges.js +81 -0
  7. package/dist/cjs/changes/findChanges.js +72 -0
  8. package/dist/cjs/changes/fixInconsistentChanges.js +21 -0
  9. package/dist/cjs/changes/updateChangeAttrs.js +65 -0
  10. package/dist/cjs/commands.js +47 -0
  11. package/dist/cjs/compute/nodeHelpers.js +77 -0
  12. package/dist/cjs/compute/setFragmentAsInserted.js +53 -0
  13. package/dist/cjs/compute/splitSliceIntoMergedParts.js +57 -0
  14. package/dist/cjs/index.js +41 -0
  15. package/dist/cjs/mutate/deleteAndMergeSplitNodes.js +105 -0
  16. package/dist/cjs/mutate/deleteNode.js +43 -0
  17. package/dist/cjs/mutate/deleteText.js +29 -0
  18. package/dist/cjs/mutate/mergeNode.js +21 -0
  19. package/dist/cjs/mutate/mergeTrackedMarks.js +25 -0
  20. package/dist/cjs/plugin.js +118 -0
  21. package/dist/cjs/steps/trackReplaceAroundStep.js +72 -0
  22. package/dist/cjs/steps/trackReplaceStep.js +79 -0
  23. package/dist/cjs/steps/trackTransaction.js +88 -0
  24. package/dist/cjs/types/change.js +15 -0
  25. package/dist/cjs/types/pm.js +2 -0
  26. package/dist/cjs/types/step.js +2 -0
  27. package/dist/cjs/types/track.js +9 -0
  28. package/dist/cjs/utils/logger.js +43 -0
  29. package/dist/cjs/utils/track-utils.js +28 -0
  30. package/dist/cjs/utils/uuidv4.js +10 -0
  31. package/dist/es/ChangeSet.js +151 -0
  32. package/dist/es/actions.js +17 -0
  33. package/dist/es/change-steps/diffChangeSteps.js +59 -0
  34. package/dist/es/change-steps/matchInserted.js +66 -0
  35. package/dist/es/change-steps/processChangeSteps.js +114 -0
  36. package/dist/es/changes/applyChanges.js +77 -0
  37. package/dist/es/changes/findChanges.js +68 -0
  38. package/dist/es/changes/fixInconsistentChanges.js +17 -0
  39. package/dist/es/changes/updateChangeAttrs.js +60 -0
  40. package/dist/es/commands.js +39 -0
  41. package/dist/es/compute/nodeHelpers.js +67 -0
  42. package/dist/es/compute/setFragmentAsInserted.js +49 -0
  43. package/dist/es/compute/splitSliceIntoMergedParts.js +53 -0
  44. package/dist/es/index.js +7 -0
  45. package/dist/es/mutate/deleteAndMergeSplitNodes.js +78 -0
  46. package/dist/es/mutate/deleteNode.js +38 -0
  47. package/dist/es/mutate/deleteText.js +25 -0
  48. package/dist/es/mutate/mergeNode.js +17 -0
  49. package/dist/es/mutate/mergeTrackedMarks.js +21 -0
  50. package/dist/es/plugin.js +114 -0
  51. package/dist/es/steps/trackReplaceAroundStep.js +45 -0
  52. package/dist/es/steps/trackReplaceStep.js +52 -0
  53. package/dist/es/steps/trackTransaction.js +84 -0
  54. package/dist/es/types/change.js +12 -0
  55. package/dist/es/types/pm.js +1 -0
  56. package/dist/es/types/step.js +1 -0
  57. package/dist/es/types/track.js +6 -0
  58. package/dist/es/utils/logger.js +36 -0
  59. package/dist/es/utils/track-utils.js +22 -0
  60. package/dist/es/utils/uuidv4.js +6 -0
  61. package/dist/types/ChangeSet.d.ts +28 -0
  62. package/dist/{actions.d.ts → types/actions.d.ts} +27 -60
  63. package/dist/{change-steps → types/change-steps}/diffChangeSteps.d.ts +2 -2
  64. package/dist/types/change-steps/matchInserted.d.ts +3 -0
  65. package/dist/types/change-steps/processChangeSteps.d.ts +6 -0
  66. package/dist/types/changes/applyChanges.d.ts +5 -0
  67. package/dist/types/changes/findChanges.d.ts +3 -0
  68. package/dist/types/changes/fixInconsistentChanges.d.ts +4 -0
  69. package/dist/types/changes/updateChangeAttrs.d.ts +6 -0
  70. package/dist/types/commands.d.ts +8 -0
  71. package/dist/{compute → types/compute}/nodeHelpers.d.ts +13 -28
  72. package/dist/types/compute/setFragmentAsInserted.d.ts +3 -0
  73. package/dist/types/compute/splitSliceIntoMergedParts.d.ts +13 -0
  74. package/dist/types/index.d.ts +7 -0
  75. package/dist/types/mutate/deleteAndMergeSplitNodes.d.ts +13 -0
  76. package/dist/types/mutate/deleteNode.d.ts +5 -0
  77. package/dist/types/mutate/deleteText.d.ts +4 -0
  78. package/dist/types/mutate/mergeNode.d.ts +3 -0
  79. package/dist/types/mutate/mergeTrackedMarks.d.ts +3 -0
  80. package/dist/types/plugin.d.ts +4 -0
  81. package/dist/{steps → types/steps}/trackReplaceAroundStep.d.ts +5 -5
  82. package/dist/types/steps/trackReplaceStep.d.ts +6 -0
  83. package/dist/types/steps/trackTransaction.d.ts +2 -0
  84. package/dist/types/types/change.d.ts +61 -0
  85. package/dist/types/types/pm.d.ts +12 -0
  86. package/dist/types/{step.d.ts → types/step.d.ts} +38 -53
  87. package/dist/types/types/track.d.ts +30 -0
  88. package/dist/types/utils/logger.d.ts +8 -0
  89. package/dist/{utils → types/utils}/track-utils.d.ts +4 -4
  90. package/dist/types/utils/uuidv4.d.ts +1 -0
  91. package/package.json +18 -39
  92. package/LICENSE +0 -201
  93. package/dist/ChangeSet.d.ts +0 -71
  94. package/dist/change-steps/matchInserted.d.ts +0 -13
  95. package/dist/change-steps/processChangeSteps.d.ts +0 -21
  96. package/dist/changes/applyChanges.d.ts +0 -28
  97. package/dist/changes/findChanges.d.ts +0 -27
  98. package/dist/changes/fixInconsistentChanges.d.ts +0 -29
  99. package/dist/changes/updateChangeAttrs.d.ts +0 -21
  100. package/dist/commands.d.ts +0 -47
  101. package/dist/compute/setFragmentAsInserted.d.ts +0 -18
  102. package/dist/compute/splitSliceIntoMergedParts.d.ts +0 -41
  103. package/dist/index.cjs +0 -2026
  104. package/dist/index.d.ts +0 -22
  105. package/dist/index.js +0 -2013
  106. package/dist/mutate/deleteAndMergeSplitNodes.d.ts +0 -53
  107. package/dist/mutate/deleteNode.d.ts +0 -36
  108. package/dist/mutate/deleteText.d.ts +0 -33
  109. package/dist/mutate/mergeNode.d.ts +0 -25
  110. package/dist/mutate/mergeTrackedMarks.d.ts +0 -29
  111. package/dist/plugin.d.ts +0 -25
  112. package/dist/steps/trackReplaceStep.d.ts +0 -21
  113. package/dist/steps/trackTransaction.d.ts +0 -17
  114. package/dist/types/change.d.ts +0 -76
  115. package/dist/types/pm.d.ts +0 -27
  116. package/dist/types/track.d.ts +0 -45
  117. package/dist/utils/logger.d.ts +0 -27
  118. package/dist/utils/uuidv4.d.ts +0 -16
@@ -1,53 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Fragment, Node as PMNode, Schema } from 'prosemirror-model';
17
- import type { Transaction } from 'prosemirror-state';
18
- import { ExposedSlice } from '../types/pm';
19
- import { NewEmptyAttrs } from '../types/track';
20
- import { ChangeStep } from '../types/step';
21
- /**
22
- * Applies deletion to the doc without actually deleting nodes that have not been inserted
23
- *
24
- * The hairiest part of this whole library which does a fair bit of magic to split the inserted slice
25
- * into pieces that can be inserted without deleting nodes in the doc. Basically we first split the
26
- * inserted slice into merged pieces _if_ the slice was open on either end. Then, we iterate over the deleted
27
- * range and see if the node in question was completely wrapped in the range (therefore fully deleted)
28
- * or only partially deleted by the slice. In that case, we merge the content from the inserted slice
29
- * and keep the original nodes if they do not contain insert attributes.
30
- *
31
- * It is definitely a messy function but so far this seems to have been the best approach to prevent
32
- * deletion of nodes with open slices. Other option would be to allow the deletions to take place but that
33
- * requires then inserting the deleted nodes back to the doc if their deletion should be prevented, which does
34
- * not seem trivial either.
35
- *
36
- * @param from start of the deleted range
37
- * @param to end of the deleted range
38
- * @param gap retained content in a ReplaceAroundStep, not deleted
39
- * @param startDoc doc before the deletion
40
- * @param newTr the new track transaction
41
- * @param schema ProseMirror schema
42
- * @param deleteAttrs attributes for the dataTracked object
43
- * @param insertSlice the inserted slice from ReplaceStep
44
- * @returns mapping adjusted by the applied operations & modified insert slice
45
- */
46
- export declare function deleteAndMergeSplitNodes(from: number, to: number, gap: {
47
- start: number;
48
- end: number;
49
- } | undefined, startDoc: PMNode, newTr: Transaction, schema: Schema, trackAttrs: NewEmptyAttrs, insertSlice: ExposedSlice): {
50
- sliceWasSplit: boolean;
51
- newSliceContent: Fragment;
52
- steps: ChangeStep[];
53
- };
@@ -1,36 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Node as PMNode } from 'prosemirror-model';
17
- import { Transaction } from 'prosemirror-state';
18
- import { NewDeleteAttrs } from '../types/track';
19
- /**
20
- * Deletes node but tries to leave its content intact by trying to unwrap it first
21
- *
22
- * Incase unwrapping doesn't work deletes the whole node.
23
- * @param node
24
- * @param pos
25
- * @param tr
26
- * @returns
27
- */
28
- export declare function deleteNode(node: PMNode, pos: number, tr: Transaction): Transaction;
29
- /**
30
- * Deletes inserted block or inline node, otherwise adds `dataTracked` object with CHANGE_STATUS 'deleted'
31
- * @param node
32
- * @param pos
33
- * @param newTr
34
- * @param deleteAttrs
35
- */
36
- export declare function deleteOrSetNodeDeleted(node: PMNode, pos: number, newTr: Transaction, deleteAttrs: NewDeleteAttrs): Transaction | undefined;
@@ -1,33 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Node as PMNode, Schema } from 'prosemirror-model';
17
- import type { Transaction } from 'prosemirror-state';
18
- import { NewDeleteAttrs } from '../types/track';
19
- /**
20
- * Deletes inserted text directly, otherwise wraps it with tracked_delete mark
21
- *
22
- * This would work for general inline nodes too, but since node marks don't work properly
23
- * with Yjs, attributes are used instead.
24
- * @param node
25
- * @param pos
26
- * @param newTr
27
- * @param schema
28
- * @param deleteAttrs
29
- * @param from
30
- * @param to
31
- * @returns position at the end of the possibly deleted text
32
- */
33
- export declare function deleteTextIfInserted(node: PMNode, pos: number, newTr: Transaction, schema: Schema, deleteAttrs: NewDeleteAttrs, from?: number, to?: number): number;
@@ -1,25 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Node as PMNode } from 'prosemirror-model';
17
- import { Transaction } from 'prosemirror-state';
18
- /**
19
- * Deletes node but tries to leave its content intact by moving/wrapping it to a node before or after
20
- * @param node
21
- * @param pos
22
- * @param tr
23
- * @returns
24
- */
25
- export declare function mergeNode(node: PMNode, pos: number, tr: Transaction): Transaction | undefined;
@@ -1,29 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Node as PMNode, Schema } from 'prosemirror-model';
17
- import type { Transaction } from 'prosemirror-state';
18
- /**
19
- * Merges tracked marks between text nodes at a position
20
- *
21
- * Will work for any nodes that use tracked_insert or tracked_delete marks which may not be preferrable
22
- * if used for block nodes (since we possibly want to show the individual changed nodes).
23
- * Merging is done based on the userID, operation type and status.
24
- * @param pos
25
- * @param doc
26
- * @param newTr
27
- * @param schema
28
- */
29
- export declare function mergeTrackedMarks(pos: number, doc: PMNode, newTr: Transaction, schema: Schema): void;
package/dist/plugin.d.ts DELETED
@@ -1,25 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Plugin, PluginKey } from 'prosemirror-state';
17
- import { TrackChangesOptions, TrackChangesState } from './types/track';
18
- export declare const trackChangesPluginKey: PluginKey<TrackChangesState>;
19
- /**
20
- * The ProseMirror plugin needed to enable track-changes.
21
- *
22
- * Accepts an empty options object as an argument but note that this uses 'anonymous:Anonymous' as the default userID.
23
- * @param opts
24
- */
25
- export declare const trackChangesPlugin: (opts?: TrackChangesOptions) => Plugin<TrackChangesState>;
@@ -1,21 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Node as PMNode } from 'prosemirror-model';
17
- import type { EditorState, Transaction } from 'prosemirror-state';
18
- import { ReplaceStep, StepResult } from 'prosemirror-transform';
19
- import { NewEmptyAttrs } from '../types/track';
20
- import { ChangeStep } from '../types/step';
21
- export declare function trackReplaceStep(step: ReplaceStep, oldState: EditorState, newTr: Transaction, attrs: NewEmptyAttrs, stepResult: StepResult, currentStepDoc: PMNode): [ChangeStep[], number];
@@ -1,17 +0,0 @@
1
- import type { EditorState, Transaction } from 'prosemirror-state';
2
- /**
3
- * Inverts transactions to wrap their contents/operations with track data instead
4
- *
5
- * The main function of track changes that holds the most complex parts of this whole library.
6
- * Takes in as arguments the data from appendTransaction to reapply it with the track marks/attributes.
7
- * We could prevent the initial transaction from being applied all together but since invert works just
8
- * as well and we can use the intermediate doc for checking which nodes are changed, it's not prevented.
9
- *
10
- *
11
- * @param tr Original transaction
12
- * @param oldState State before transaction
13
- * @param newTr Transaction created from the new editor state
14
- * @param authorID User id
15
- * @returns newTr that inverts the initial tr and applies track attributes/marks
16
- */
17
- export declare function trackTransaction(tr: Transaction, oldState: EditorState, newTr: Transaction, authorID: string): Transaction;
@@ -1,76 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export declare enum CHANGE_OPERATION {
17
- insert = "insert",
18
- delete = "delete",
19
- set_node_attributes = "set_attrs"
20
- }
21
- export declare enum CHANGE_STATUS {
22
- accepted = "accepted",
23
- rejected = "rejected",
24
- pending = "pending"
25
- }
26
- declare type InsertDeleteAttrs = {
27
- id: string;
28
- authorID: string;
29
- reviewedByID: string | null;
30
- operation: CHANGE_OPERATION.insert | CHANGE_OPERATION.delete;
31
- status: CHANGE_STATUS;
32
- createdAt: number;
33
- updatedAt: number;
34
- };
35
- export declare type UpdateAttrs = Omit<InsertDeleteAttrs, 'operation'> & {
36
- operation: CHANGE_OPERATION.set_node_attributes;
37
- oldAttrs: Record<string, any>;
38
- };
39
- export declare type TrackedAttrs = InsertDeleteAttrs | UpdateAttrs;
40
- declare type Change = {
41
- id: string;
42
- from: number;
43
- to: number;
44
- dataTracked: TrackedAttrs;
45
- };
46
- export declare type TextChange = Change & {
47
- type: 'text-change';
48
- text: string;
49
- };
50
- export declare type NodeChange = Change & {
51
- type: 'node-change';
52
- nodeType: string;
53
- children: TrackedChange[];
54
- };
55
- export declare type NodeAttrChange = Change & {
56
- type: 'node-attr-change';
57
- nodeType: string;
58
- oldAttrs: Record<string, any>;
59
- newAttrs: Record<string, any>;
60
- };
61
- export declare type WrapChange = Change & {
62
- type: 'wrap-change';
63
- wrapperNode: string;
64
- };
65
- export declare type MarkChange = Change & {
66
- type: 'mark-change';
67
- };
68
- export declare type TrackedChange = TextChange | NodeChange | NodeAttrChange | WrapChange | MarkChange;
69
- export declare type PartialChange<T extends TrackedChange> = Omit<T, 'dataTracked'> & {
70
- dataTracked: Partial<TrackedAttrs>;
71
- };
72
- export declare type IncompleteChange = Omit<TrackedChange, 'dataTracked'> & {
73
- dataTracked: Partial<TrackedAttrs>;
74
- };
75
- export declare type ChangeType = TrackedChange['type'];
76
- export {};
@@ -1,27 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
17
- import { ReplaceStep } from 'prosemirror-transform';
18
- export declare type ExposedReplaceStep = ReplaceStep & {
19
- slice: ExposedSlice;
20
- };
21
- export declare type ExposedSlice = Slice & {
22
- content: ExposedFragment;
23
- insertAt(pos: number, fragment: Fragment | ExposedFragment): ExposedSlice;
24
- };
25
- export declare type ExposedFragment = Fragment & {
26
- content: PMNode[];
27
- };
@@ -1,45 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { PluginKey } from 'prosemirror-state';
17
- import { ChangeSet } from '../ChangeSet';
18
- import { CHANGE_OPERATION, TrackedAttrs } from './change';
19
- export interface TrackChangesOptions {
20
- debug?: boolean;
21
- userID: string;
22
- skipTrsWithMetas?: (PluginKey | string)[];
23
- }
24
- export interface TrackChangesState {
25
- status: TrackChangesStatus;
26
- userID: string;
27
- changeSet: ChangeSet;
28
- }
29
- export declare type NewEmptyAttrs = Omit<TrackedAttrs, 'id' | 'operation'>;
30
- export declare type NewInsertAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
31
- operation: CHANGE_OPERATION.insert;
32
- };
33
- export declare type NewDeleteAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
34
- operation: CHANGE_OPERATION.delete;
35
- };
36
- export declare type NewUpdateAttrs = Omit<TrackedAttrs, 'id' | 'operation'> & {
37
- operation: CHANGE_OPERATION.set_node_attributes;
38
- oldAttrs: Record<string, any>;
39
- };
40
- export declare type NewTrackedAttrs = NewInsertAttrs | NewDeleteAttrs | NewUpdateAttrs;
41
- export declare enum TrackChangesStatus {
42
- enabled = "enabled",
43
- viewSnapshots = "view-snapshots",
44
- disabled = "disabled"
45
- }
@@ -1,27 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import debug from 'debug';
17
- export declare const logger: debug.Debugger;
18
- export declare const log: {
19
- info(str: string, obj?: any): void;
20
- warn(str: string, obj?: any): void;
21
- error(str: string, obj?: any): void;
22
- };
23
- /**
24
- * Sets debug logging enabled/disabled.
25
- * @param enabled
26
- */
27
- export declare const enableDebug: (enabled: boolean) => void;
@@ -1,16 +0,0 @@
1
- /*!
2
- * © 2021 Atypon Systems LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export declare function uuidv4(): string;