@ckeditor/ckeditor5-operations-compressor 48.2.0 → 48.3.0-alpha.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.
@@ -1,61 +1,61 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import type { CompressedOperationsData, Compressor, CompressionInput, DecompressionInput } from '../compressor.js';
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ import type { CompressedOperationsData, Compressor, CompressionInput, DecompressionInput } from "../compressor.js";
6
6
  /**
7
- * * Compresses and decompresses multiple operations into the one buffer.
8
- */
7
+ * * Compresses and decompresses multiple operations into the one buffer.
8
+ */
9
9
  export declare abstract class ActionCompressor {
10
- constructor(id: number, context: Compressor);
11
- /**
12
- * Combines and compress operations from the list.
13
- * Operations are consumed as long as match this compressor.
14
- *
15
- * @param result Object to which compression result should be added.
16
- * @param input Input data to compress. The action compressor will try to compress one or multiple operations starting from
17
- * `input.index`. After compression, `input.index` will be incremented by the number of operations compressed by the compressor.
18
- * @returns `true` when operation is consumed `false` otherwise.
19
- */
20
- compress(result: CompressedOperationsData, input: CompressionInput): boolean;
21
- /**
22
- * Decompress and split compressed operations. Decompressed operations are consumed (removed from the input data).
23
- *
24
- * @param result Decompressed operations in JSON format.
25
- * @param input Input data to be decompressed.
26
- */
27
- decompress(result: Array<any>, input: DecompressionInput): void;
28
- /**
29
- * Compresses single operation using a proper compressor.
30
- *
31
- * @param operation Operation in JSON format.
32
- * @returns Operation JSON compressed to the binary format.
33
- */
34
- protected abstract _compressSingleOperation(operation: any): Uint8Array;
35
- /**
36
- * Decompresses combined operation using a proper compressor.
37
- *
38
- * @param input Input data to decompress.
39
- * @returns Decompressed operation in JSON format.
40
- */
41
- protected abstract _decompressSingleOperation(input: DecompressionInput): any;
42
- /**
43
- * Combine next operation into the combined one.
44
- *
45
- * @param nextOperation Operation to combine in JSON format.
46
- * @param combined Combined operation in JSON format.
47
- * @returns Combined operation in JSON format.
48
- */
49
- protected abstract _combineNext(nextOperation: any, combined: any): any;
50
- /**
51
- * Split operation from combined one.
52
- *
53
- * @param combined Combined operation in JSON format.
54
- * @returns Split operation in JSON format.
55
- */
56
- protected abstract _splitCurrent(combined: any): any;
57
- /**
58
- * Checks if two operations can be combined.
59
- */
60
- protected abstract _compareOperations(opA: any, opB: any): boolean;
10
+ constructor(id: number, context: Compressor);
11
+ /**
12
+ * Combines and compress operations from the list.
13
+ * Operations are consumed as long as match this compressor.
14
+ *
15
+ * @param result Object to which compression result should be added.
16
+ * @param input Input data to compress. The action compressor will try to compress one or multiple operations starting from
17
+ * `input.index`. After compression, `input.index` will be incremented by the number of operations compressed by the compressor.
18
+ * @returns `true` when operation is consumed `false` otherwise.
19
+ */
20
+ compress(result: CompressedOperationsData, input: CompressionInput): boolean;
21
+ /**
22
+ * Decompress and split compressed operations. Decompressed operations are consumed (removed from the input data).
23
+ *
24
+ * @param result Decompressed operations in JSON format.
25
+ * @param input Input data to be decompressed.
26
+ */
27
+ decompress(result: Array<any>, input: DecompressionInput): void;
28
+ /**
29
+ * Compresses single operation using a proper compressor.
30
+ *
31
+ * @param operation Operation in JSON format.
32
+ * @returns Operation JSON compressed to the binary format.
33
+ */
34
+ protected abstract _compressSingleOperation(operation: any): Uint8Array;
35
+ /**
36
+ * Decompresses combined operation using a proper compressor.
37
+ *
38
+ * @param input Input data to decompress.
39
+ * @returns Decompressed operation in JSON format.
40
+ */
41
+ protected abstract _decompressSingleOperation(input: DecompressionInput): any;
42
+ /**
43
+ * Combine next operation into the combined one.
44
+ *
45
+ * @param nextOperation Operation to combine in JSON format.
46
+ * @param combined Combined operation in JSON format.
47
+ * @returns Combined operation in JSON format.
48
+ */
49
+ protected abstract _combineNext(nextOperation: any, combined: any): any;
50
+ /**
51
+ * Split operation from combined one.
52
+ *
53
+ * @param combined Combined operation in JSON format.
54
+ * @returns Split operation in JSON format.
55
+ */
56
+ protected abstract _splitCurrent(combined: any): any;
57
+ /**
58
+ * Checks if two operations can be combined.
59
+ */
60
+ protected abstract _compareOperations(opA: any, opB: any): boolean;
61
61
  }
@@ -1,31 +1,31 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module operations-compressor/actioncompressor/deletingactioncompressor
7
- */
8
- import { ActionCompressor } from './actioncompressor.js';
9
- import type { DecompressionInput } from '../compressor.js';
6
+ * @module operations-compressor/actioncompressor/deletingactioncompressor
7
+ */
8
+ import { ActionCompressor } from "./actioncompressor.js";
9
+ import type { DecompressionInput } from "../compressor.js";
10
10
  export declare class DeletingActionCompressor extends ActionCompressor {
11
- /**
12
- * @inheritDoc
13
- */
14
- protected _combineNext(nextOperation: any, combined: any): any;
15
- /**
16
- * @inheritDoc
17
- */
18
- protected _splitCurrent(combined: any): any;
19
- /**
20
- * @inheritDoc
21
- */
22
- protected _compareOperations(opA: any, opB: any): boolean;
23
- /**
24
- * @inheritDoc
25
- */
26
- protected _compressSingleOperation(operation: any): Uint8Array;
27
- /**
28
- * @inheritDoc
29
- */
30
- protected _decompressSingleOperation(input: DecompressionInput): any;
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ protected override _combineNext(nextOperation: any, combined: any): any;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ protected override _splitCurrent(combined: any): any;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ protected override _compareOperations(opA: any, opB: any): boolean;
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ protected override _compressSingleOperation(operation: any): Uint8Array;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ protected override _decompressSingleOperation(input: DecompressionInput): any;
31
31
  }
@@ -1,31 +1,31 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module operations-compressor/actioncompressor/forwarddeletingactioncompressor
7
- */
8
- import { ActionCompressor } from './actioncompressor.js';
9
- import type { DecompressionInput } from '../compressor.js';
6
+ * @module operations-compressor/actioncompressor/forwarddeletingactioncompressor
7
+ */
8
+ import { ActionCompressor } from "./actioncompressor.js";
9
+ import type { DecompressionInput } from "../compressor.js";
10
10
  export declare class ForwardDeletingActionCompressor extends ActionCompressor {
11
- /**
12
- * @inheritDoc
13
- */
14
- protected _combineNext(nextOperation: any, combined: any): any;
15
- /**
16
- * @inheritDoc
17
- */
18
- protected _splitCurrent(combined: any): any;
19
- /**
20
- * @inheritDoc
21
- */
22
- protected _compareOperations(opA: any, opB: any): boolean;
23
- /**
24
- * @inheritDoc
25
- */
26
- protected _compressSingleOperation(operation: any): Uint8Array;
27
- /**
28
- * @inheritDoc
29
- */
30
- protected _decompressSingleOperation(input: DecompressionInput): any;
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ protected override _combineNext(nextOperation: any, combined: any): any;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ protected override _splitCurrent(combined: any): any;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ protected override _compareOperations(opA: any, opB: any): boolean;
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ protected override _compressSingleOperation(operation: any): Uint8Array;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ protected override _decompressSingleOperation(input: DecompressionInput): any;
31
31
  }
@@ -1,31 +1,31 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module operations-compressor/actioncompressor/typingactioncompressor
7
- */
8
- import { ActionCompressor } from './actioncompressor.js';
9
- import type { DecompressionInput } from '../compressor.js';
6
+ * @module operations-compressor/actioncompressor/typingactioncompressor
7
+ */
8
+ import { ActionCompressor } from "./actioncompressor.js";
9
+ import type { DecompressionInput } from "../compressor.js";
10
10
  export declare class TypingActionCompressor extends ActionCompressor {
11
- /**
12
- * @inheritDoc
13
- */
14
- protected _combineNext(nextOperation: any, combined: any): any;
15
- /**
16
- * @inheritDoc
17
- */
18
- protected _splitCurrent(combined: any): any;
19
- /**
20
- * @inheritDoc
21
- */
22
- protected _compareOperations(opA: any, opB: any): boolean;
23
- /**
24
- * @inheritDoc
25
- */
26
- protected _compressSingleOperation(operation: any): Uint8Array;
27
- /**
28
- * @inheritDoc
29
- */
30
- protected _decompressSingleOperation(input: DecompressionInput): any;
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ protected override _combineNext(nextOperation: any, combined: any): any;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ protected override _splitCurrent(combined: any): any;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ protected override _compareOperations(opA: any, opB: any): boolean;
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ protected override _compressSingleOperation(operation: any): Uint8Array;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ protected override _decompressSingleOperation(input: DecompressionInput): any;
31
31
  }
@@ -1,19 +1,19 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module operations-compressor/actioncompressor/userselectionactioncompressor
7
- */
8
- import { ActionCompressor } from './actioncompressor.js';
9
- import type { CompressedOperationsData, CompressionInput, DecompressionInput } from '../compressor.js';
6
+ * @module operations-compressor/actioncompressor/userselectionactioncompressor
7
+ */
8
+ import { ActionCompressor } from "./actioncompressor.js";
9
+ import type { CompressedOperationsData, CompressionInput, DecompressionInput } from "../compressor.js";
10
10
  export declare class UserSelectionActionCompressor extends ActionCompressor {
11
- /**
12
- * @inheritDoc
13
- */
14
- compress(result: CompressedOperationsData, input: CompressionInput): boolean;
15
- /**
16
- * @inheritDoc
17
- */
18
- decompress(result: Array<any>, input: DecompressionInput): void;
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ override compress(result: CompressedOperationsData, input: CompressionInput): boolean;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ override decompress(result: Array<any>, input: DecompressionInput): void;
19
19
  }
@@ -1,73 +1,73 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * Compresses and decompresses given set of operations in JSON format to/from the binary format using `Protocol Buffers`.
7
- */
6
+ * Compresses and decompresses given set of operations in JSON format to/from the binary format using `Protocol Buffers`.
7
+ */
8
8
  export declare class Compressor {
9
- constructor();
10
- /**
11
- * Compress given list of operations in JSON format.
12
- *
13
- * It tries to combine typing-like or deleting-like operations into the one buffer.
14
- */
15
- compress(operations: Array<any>): CompressedOperationsData;
16
- /**
17
- * Decompress given data to the list of operations in JSON format.
18
- *
19
- * @param data Compressed operations.
20
- * @returns List of operations in JSON format.
21
- */
22
- decompress(data: CompressedOperationsData): Array<any>;
9
+ constructor();
10
+ /**
11
+ * Compress given list of operations in JSON format.
12
+ *
13
+ * It tries to combine typing-like or deleting-like operations into the one buffer.
14
+ */
15
+ compress(operations: Array<any>): CompressedOperationsData;
16
+ /**
17
+ * Decompress given data to the list of operations in JSON format.
18
+ *
19
+ * @param data Compressed operations.
20
+ * @returns List of operations in JSON format.
21
+ */
22
+ decompress(data: CompressedOperationsData): Array<any>;
23
23
  }
24
24
  /**
25
- * Compressed operations data.
26
- */
25
+ * Compressed operations data.
26
+ */
27
27
  export type CompressedOperationsData = {
28
- /**
29
- * List of operations compressed to the binary format.
30
- */
31
- buffers: Array<Uint8Array>;
32
- /**
33
- * List of compressor identifiers. According to this types a proper compressor will be used for the decompression.
34
- */
35
- types: Array<number>;
36
- /**
37
- * Base version of the first compressed operation.
38
- */
39
- baseVersion: number;
28
+ /**
29
+ * List of operations compressed to the binary format.
30
+ */
31
+ buffers: Array<Uint8Array>;
32
+ /**
33
+ * List of compressor identifiers. According to this types a proper compressor will be used for the decompression.
34
+ */
35
+ types: Array<number>;
36
+ /**
37
+ * Base version of the first compressed operation.
38
+ */
39
+ baseVersion: number;
40
40
  };
41
41
  /**
42
- * Input data to be compressed by `Compressor`.
43
- *
44
- * Includes operations to be compressed and index from which the compression should continue. This object is internally processed by
45
- * various classes to provide the compression result. `index` keeps being incremented to inform which operations where already processed.
46
- */
42
+ * Input data to be compressed by `Compressor`.
43
+ *
44
+ * Includes operations to be compressed and index from which the compression should continue. This object is internally processed by
45
+ * various classes to provide the compression result. `index` keeps being incremented to inform which operations where already processed.
46
+ */
47
47
  export type CompressionInput = {
48
- /**
49
- * Operations to be compressed.
50
- */
51
- operations: Array<any>;
52
- /**
53
- * Pointer to `operations` array. Specifies the next operation that should be processed.
54
- */
55
- index: number;
48
+ /**
49
+ * Operations to be compressed.
50
+ */
51
+ operations: Array<any>;
52
+ /**
53
+ * Pointer to `operations` array. Specifies the next operation that should be processed.
54
+ */
55
+ index: number;
56
56
  };
57
57
  /**
58
- * Input data to be decompressed by `Compressor`.
59
- *
60
- * Includes data for operations to be decompressed and indexes pointing to how much data was already decompressed. This object is internally
61
- * processed by various classes to provide the decompression result. Indexes keep being incremented to inform which part of the data was
62
- * already processed.
63
- */
58
+ * Input data to be decompressed by `Compressor`.
59
+ *
60
+ * Includes data for operations to be decompressed and indexes pointing to how much data was already decompressed. This object is internally
61
+ * processed by various classes to provide the decompression result. Indexes keep being incremented to inform which part of the data was
62
+ * already processed.
63
+ */
64
64
  export type DecompressionInput = CompressedOperationsData & {
65
- /**
66
- * Specifies the next item in `buffers` array to be processed.
67
- */
68
- bufferIndex: number;
69
- /**
70
- * Specifies the next item in `types` array to be processed.
71
- */
72
- typeIndex: number;
65
+ /**
66
+ * Specifies the next item in `buffers` array to be processed.
67
+ */
68
+ bufferIndex: number;
69
+ /**
70
+ * Specifies the next item in `types` array to be processed.
71
+ */
72
+ typeIndex: number;
73
73
  };
package/dist/errors.d.ts CHANGED
@@ -1,5 +1 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
1
  export {};
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module operations-compressor
7
- */
8
- export { Compressor, type CompressedOperationsData } from './compressor.js';
6
+ * @module operations-compressor
7
+ */
8
+ export { Compressor, type CompressedOperationsData } from "./compressor.js";