@ckeditor/ckeditor5-utils 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.
Files changed (82) hide show
  1. package/dist/abortabledebounce.d.ts +19 -13
  2. package/dist/areconnectedthroughproperties.d.ts +7 -7
  3. package/dist/ckeditorerror.d.ts +113 -113
  4. package/dist/collection.d.ts +419 -415
  5. package/dist/collectstylesheets.d.ts +9 -9
  6. package/dist/comparearrays.d.ts +25 -25
  7. package/dist/config.d.ts +159 -156
  8. package/dist/count.d.ts +14 -14
  9. package/dist/crc32.d.ts +19 -19
  10. package/dist/decodelicensekey.d.ts +7 -7
  11. package/dist/delay.d.ts +13 -13
  12. package/dist/diff.d.ts +32 -27
  13. package/dist/difftochanges.d.ts +47 -47
  14. package/dist/dom/createelement.d.ts +43 -43
  15. package/dist/dom/emittermixin.d.ts +144 -135
  16. package/dist/dom/findclosestscrollableancestor.d.ts +8 -8
  17. package/dist/dom/getancestors.d.ts +13 -13
  18. package/dist/dom/getborderwidths.d.ts +16 -16
  19. package/dist/dom/getcommonancestor.d.ts +9 -9
  20. package/dist/dom/getdatafromelement.d.ts +10 -10
  21. package/dist/dom/getpositionedancestor.d.ts +7 -7
  22. package/dist/dom/getrangefrommouseevent.d.ts +12 -12
  23. package/dist/dom/getvisualviewportoffset.d.ts +7 -7
  24. package/dist/dom/global.d.ts +24 -24
  25. package/dist/dom/indexof.d.ts +10 -10
  26. package/dist/dom/insertat.d.ts +11 -11
  27. package/dist/dom/iscomment.d.ts +7 -7
  28. package/dist/dom/isnode.d.ts +7 -7
  29. package/dist/dom/isrange.d.ts +7 -7
  30. package/dist/dom/istext.d.ts +7 -7
  31. package/dist/dom/isvalidattributename.d.ts +7 -7
  32. package/dist/dom/isvisible.d.ts +12 -12
  33. package/dist/dom/iswindow.d.ts +7 -7
  34. package/dist/dom/position.d.ts +200 -200
  35. package/dist/dom/rect.d.ts +194 -194
  36. package/dist/dom/remove.d.ts +9 -9
  37. package/dist/dom/resizeobserver.d.ts +70 -70
  38. package/dist/dom/scroll.d.ts +75 -72
  39. package/dist/dom/setdatainelement.d.ts +10 -10
  40. package/dist/dom/tounit.d.ts +16 -16
  41. package/dist/elementreplacer.d.ts +26 -26
  42. package/dist/emittermixin.d.ts +290 -280
  43. package/dist/env.d.ts +124 -124
  44. package/dist/eventinfo.d.ts +58 -55
  45. package/dist/fastdiff.d.ts +112 -109
  46. package/dist/first.d.ts +7 -7
  47. package/dist/focustracker.d.ts +133 -131
  48. package/dist/formathtml.d.ts +15 -15
  49. package/dist/index-content.css +1 -0
  50. package/dist/index-editor.css +1 -0
  51. package/dist/index.css +0 -2
  52. package/dist/index.d.ts +78 -77
  53. package/dist/index.js +5695 -6360
  54. package/dist/index.js.map +1 -1
  55. package/dist/inserttopriorityarray.d.ts +23 -23
  56. package/dist/isfeatureblockedbylicensekey.d.ts +10 -10
  57. package/dist/isiterable.d.ts +10 -10
  58. package/dist/keyboard.d.ts +107 -109
  59. package/dist/keystrokehandler.d.ts +90 -90
  60. package/dist/language.d.ts +12 -12
  61. package/dist/legacyerrors.d.ts +0 -4
  62. package/dist/locale.d.ts +122 -122
  63. package/dist/mapsequal.d.ts +11 -11
  64. package/dist/mix.d.ts +54 -53
  65. package/dist/nth.d.ts +12 -12
  66. package/dist/objecttomap.d.ts +18 -18
  67. package/dist/observablemixin.d.ts +621 -539
  68. package/dist/parsebase64encodedobject.d.ts +7 -7
  69. package/dist/parsedimensionwithunit.d.ts +40 -0
  70. package/dist/priorities.d.ts +24 -24
  71. package/dist/retry.d.ts +27 -27
  72. package/dist/splicearray.d.ts +22 -22
  73. package/dist/spy.d.ts +15 -15
  74. package/dist/toarray.d.ts +17 -17
  75. package/dist/tomap.d.ts +15 -15
  76. package/dist/translation-service.d.ts +157 -157
  77. package/dist/uid.d.ts +12 -12
  78. package/dist/unicode.d.ts +42 -42
  79. package/dist/version.d.ts +5 -5
  80. package/dist/wait.d.ts +11 -11
  81. package/package.json +2 -2
  82. package/dist/index.css.map +0 -1
@@ -1,11 +1,11 @@
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 utils/parsebase64encodedobject
7
- */
6
+ * @module utils/parsebase64encodedobject
7
+ */
8
8
  /**
9
- * Parses a base64-encoded object and returns the decoded object, or null if the decoding was unsuccessful.
10
- */
9
+ * Parses a base64-encoded object and returns the decoded object, or null if the decoding was unsuccessful.
10
+ */
11
11
  export declare function parseBase64EncodedObject(encoded: string): Record<string, any> | null;
@@ -0,0 +1,40 @@
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
+ /**
6
+ * @module utils/parsedimensionwithunit
7
+ */
8
+ /**
9
+ * Parses provided string with dimension value and returns extracted numeric value and unit.
10
+ *
11
+ * * If non-string dimension is passed then `null` value is returned.
12
+ * * If unit is missing then `null` is returned.
13
+ * * If numeric value part of string is not a number then `null` is returned.
14
+ *
15
+ * Example:
16
+ * `"222px"` => `{ value: 222, unit: "px" }`
17
+ * `"99%"` => `{ value: 99, unit: "%" }`
18
+
19
+ * @param dimension Unsafe string with dimension.
20
+ * @returns Parsed dimension with extracted numeric value and units.
21
+ * @internal
22
+ */
23
+ export declare function tryParseDimensionWithUnit(dimension: string | null | undefined): DimensionWithUnit | null;
24
+ /**
25
+ * Converts dimension between `px` -> `%` and `%` -> `px`.
26
+ *
27
+ * @param parentDimensionPx Dimension of parent element that contains measured element.
28
+ * @param dimension Measured element dimension.
29
+ * @param targetUnit Target unit for conversion.
30
+ * @returns Casted dimension.
31
+ * @internal
32
+ */
33
+ export declare function tryCastDimensionsToUnit(parentDimensionPx: number, dimension: DimensionWithUnit, targetUnit: string): DimensionWithUnit;
34
+ /**
35
+ * @internal
36
+ */
37
+ export type DimensionWithUnit = {
38
+ value: number;
39
+ unit: string;
40
+ };
@@ -1,32 +1,32 @@
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 utils/priorities
7
- */
6
+ * @module utils/priorities
7
+ */
8
8
  /**
9
- * String representing a priority value.
10
- */
11
- export type PriorityString = 'highest' | 'high' | 'normal' | 'low' | 'lowest' | number;
9
+ * String representing a priority value.
10
+ */
11
+ export type PriorityString = "highest" | "high" | "normal" | "low" | "lowest" | number;
12
12
  /**
13
- * Provides group of constants to use instead of hardcoding numeric priority values.
14
- */
13
+ * Provides group of constants to use instead of hardcoding numeric priority values.
14
+ */
15
15
  export interface PrioritiesType {
16
- /**
17
- * Converts a string with priority name to it's numeric value. If `Number` is given, it just returns it.
18
- *
19
- * @param priority Priority to convert.
20
- * @returns Converted priority.
21
- */
22
- get(priority?: PriorityString): number;
23
- readonly highest: number;
24
- readonly high: number;
25
- readonly normal: number;
26
- readonly low: number;
27
- readonly lowest: number;
16
+ /**
17
+ * Converts a string with priority name to it's numeric value. If `Number` is given, it just returns it.
18
+ *
19
+ * @param priority Priority to convert.
20
+ * @returns Converted priority.
21
+ */
22
+ get(priority?: PriorityString): number;
23
+ readonly highest: number;
24
+ readonly high: number;
25
+ readonly normal: number;
26
+ readonly low: number;
27
+ readonly lowest: number;
28
28
  }
29
29
  /**
30
- * Provides group of constants to use instead of hardcoding numeric priority values.
31
- */
30
+ * Provides group of constants to use instead of hardcoding numeric priority values.
31
+ */
32
32
  export declare const priorities: PrioritiesType;
package/dist/retry.d.ts CHANGED
@@ -1,34 +1,34 @@
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
- * Tries calling the given callback until it sucessfully resolves.
7
- *
8
- * If the callback fails `maxAttempts` times, the returned promise is rejected with the last error.
9
- *
10
- * @typeParam TResult The result of a successful callback invocation.
11
- * @param callback The function to call until it succeeds.
12
- * @param options Configuration options.
13
- * @param options.maxAttempts Maximum number of attempts.
14
- * @param options.retryDelay The time in milliseconds between attempts. By default it implements exponential back-off policy.
15
- * @param options.signal The signal to abort further retries. The callback itself is not aborted automatically.
16
- */
6
+ * Tries calling the given callback until it sucessfully resolves.
7
+ *
8
+ * If the callback fails `maxAttempts` times, the returned promise is rejected with the last error.
9
+ *
10
+ * @typeParam TResult The result of a successful callback invocation.
11
+ * @param callback The function to call until it succeeds.
12
+ * @param options Configuration options.
13
+ * @param options.maxAttempts Maximum number of attempts.
14
+ * @param options.retryDelay The time in milliseconds between attempts. By default it implements exponential back-off policy.
15
+ * @param options.signal The signal to abort further retries. The callback itself is not aborted automatically.
16
+ */
17
17
  export declare function retry<TResult>(callback: () => Promise<TResult>, options?: {
18
- maxAttempts?: number;
19
- retryDelay?: (attempt: number) => number;
20
- signal?: AbortSignal;
18
+ maxAttempts?: number;
19
+ retryDelay?: (attempt: number) => number;
20
+ signal?: AbortSignal;
21
21
  }): Promise<TResult>;
22
22
  /**
23
- * Creates a function that calculates exponential back-off delay. Pass it as `options.retryDelay` to {@link ~retry}.
24
- *
25
- * @param options.delay Base delay between invocations. Defaults to 1s.
26
- * @param options.factor How much to increase the delay. Defaults to 2x.
27
- * @param options.maxDelay Maximum timeout. Even if higher timeout is calculated, it cannot get higher than this value. Default to 10s.
28
- * @returns The function calculating the delay.
29
- */
23
+ * Creates a function that calculates exponential back-off delay. Pass it as `options.retryDelay` to {@link ~retry}.
24
+ *
25
+ * @param options.delay Base delay between invocations. Defaults to 1s.
26
+ * @param options.factor How much to increase the delay. Defaults to 2x.
27
+ * @param options.maxDelay Maximum timeout. Even if higher timeout is calculated, it cannot get higher than this value. Default to 10s.
28
+ * @returns The function calculating the delay.
29
+ */
30
30
  export declare function exponentialDelay(options?: {
31
- delay?: number;
32
- factor?: number;
33
- maxDelay?: number;
31
+ delay?: number;
32
+ factor?: number;
33
+ maxDelay?: number;
34
34
  }): (attempt: number) => number;
@@ -1,26 +1,26 @@
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 utils/splicearray
7
- */
6
+ * @module utils/splicearray
7
+ */
8
8
  /**
9
- * Splices one array into another. To be used instead of `Array.prototype.splice` for better
10
- * performance and because the latter may throw "Maximum call stack size exceeded" error when
11
- * passing huge number of items to insert.
12
- *
13
- * ```ts
14
- * spliceArray( [ 1, 2 ], [ 3, 4 ], 0 ); // [ 3, 4, 1, 2 ]
15
- * spliceArray( [ 1, 2 ], [ 3, 4 ], 1 ); // [ 1, 3, 4, 2 ]
16
- * spliceArray( [ 1, 2 ], [ 3, 4 ], 2 ); // [ 1, 2, 3, 4 ]
17
- * spliceArray( [ 1, 2 ], [], 0 ); // [ 1, 2 ]
18
- * ```
19
- *
20
- * @param targetArray Array to be spliced.
21
- * @param insertArray Array of elements to be inserted to target.
22
- * @param index Index at which nodes should be inserted.
23
- *
24
- * @returns New spliced array.
25
- */
9
+ * Splices one array into another. To be used instead of `Array.prototype.splice` for better
10
+ * performance and because the latter may throw "Maximum call stack size exceeded" error when
11
+ * passing huge number of items to insert.
12
+ *
13
+ * ```ts
14
+ * spliceArray( [ 1, 2 ], [ 3, 4 ], 0 ); // [ 3, 4, 1, 2 ]
15
+ * spliceArray( [ 1, 2 ], [ 3, 4 ], 1 ); // [ 1, 3, 4, 2 ]
16
+ * spliceArray( [ 1, 2 ], [ 3, 4 ], 2 ); // [ 1, 2, 3, 4 ]
17
+ * spliceArray( [ 1, 2 ], [], 0 ); // [ 1, 2 ]
18
+ * ```
19
+ *
20
+ * @param targetArray Array to be spliced.
21
+ * @param insertArray Array of elements to be inserted to target.
22
+ * @param index Index at which nodes should be inserted.
23
+ *
24
+ * @returns New spliced array.
25
+ */
26
26
  export declare function spliceArray<T>(targetArray: Array<T>, insertArray: Array<T>, index: number): void;
package/dist/spy.d.ts CHANGED
@@ -1,20 +1,20 @@
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 utils/spy
7
- */
6
+ * @module utils/spy
7
+ */
8
8
  /**
9
- * Creates a spy function (ala Sinon.js) that can be used to inspect call to it.
10
- *
11
- * The following are the present features:
12
- *
13
- * * spy.called: property set to `true` if the function has been called at least once.
14
- *
15
- * @returns The spy function.
16
- */
9
+ * Creates a spy function (ala Sinon.js) that can be used to inspect call to it.
10
+ *
11
+ * The following are the present features:
12
+ *
13
+ * * spy.called: property set to `true` if the function has been called at least once.
14
+ *
15
+ * @returns The spy function.
16
+ */
17
17
  export declare function spy(): {
18
- (): void;
19
- called?: boolean;
18
+ (): void;
19
+ called?: boolean;
20
20
  };
package/dist/toarray.d.ts CHANGED
@@ -1,25 +1,25 @@
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 utils/toarray
7
- */
6
+ * @module utils/toarray
7
+ */
8
8
  /**
9
- * Transforms any value to an array. If the provided value is already an array, it is returned unchanged.
10
- *
11
- * @label MUTABLE
12
- * @param data The value to transform to an array.
13
- * @returns An array created from data.
14
- */
9
+ * Transforms any value to an array. If the provided value is already an array, it is returned unchanged.
10
+ *
11
+ * @label MUTABLE
12
+ * @param data The value to transform to an array.
13
+ * @returns An array created from data.
14
+ */
15
15
  export declare function toArray<T>(data: ArrayOrItem<T>): Array<T>;
16
16
  /**
17
- * Transforms any value to an array. If the provided value is already an array, it is returned unchanged.
18
- *
19
- * @label IMMUTABLE
20
- * @param data The value to transform to an array.
21
- * @returns An array created from data.
22
- */
17
+ * Transforms any value to an array. If the provided value is already an array, it is returned unchanged.
18
+ *
19
+ * @label IMMUTABLE
20
+ * @param data The value to transform to an array.
21
+ * @returns An array created from data.
22
+ */
23
23
  export declare function toArray<T>(data: ReadonlyArrayOrItem<T>): ReadonlyArray<T>;
24
24
  export type ArrayOrItem<T> = T | Array<T>;
25
25
  export type ReadonlyArrayOrItem<T> = T | ReadonlyArray<T>;
package/dist/tomap.d.ts CHANGED
@@ -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
- * Transforms object or iterable to map. Iterable needs to be in the format acceptable by the `Map` constructor.
7
- *
8
- * ```ts
9
- * map = toMap( { 'foo': 1, 'bar': 2 } );
10
- * map = toMap( [ [ 'foo', 1 ], [ 'bar', 2 ] ] );
11
- * map = toMap( anotherMap );
12
- * ```
13
- *
14
- * @param data Object or iterable to transform.
15
- * @returns Map created from data.
16
- */
6
+ * Transforms object or iterable to map. Iterable needs to be in the format acceptable by the `Map` constructor.
7
+ *
8
+ * ```ts
9
+ * map = toMap( { 'foo': 1, 'bar': 2 } );
10
+ * map = toMap( [ [ 'foo', 1 ], [ 'bar', 2 ] ] );
11
+ * map = toMap( anotherMap );
12
+ * ```
13
+ *
14
+ * @param data Object or iterable to transform.
15
+ * @returns Map created from data.
16
+ */
17
17
  export declare function toMap<T>(data: {
18
- readonly [key: string]: T;
18
+ readonly [key: string]: T;
19
19
  } | Iterable<readonly [string, T]> | null | undefined): Map<string, T>;