@ckeditor/ckeditor5-utils 45.2.1 → 46.0.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 (143) hide show
  1. package/dist/index.js +191 -158
  2. package/dist/index.js.map +1 -1
  3. package/package.json +3 -3
  4. package/src/abortabledebounce.d.ts +1 -1
  5. package/src/abortabledebounce.js +1 -1
  6. package/src/areconnectedthroughproperties.d.ts +1 -1
  7. package/src/areconnectedthroughproperties.js +1 -1
  8. package/src/ckeditorerror.d.ts +5 -4
  9. package/src/ckeditorerror.js +18 -14
  10. package/src/collection.d.ts +1 -1
  11. package/src/collection.js +5 -5
  12. package/src/collectstylesheets.d.ts +1 -1
  13. package/src/collectstylesheets.js +1 -1
  14. package/src/comparearrays.d.ts +1 -1
  15. package/src/comparearrays.js +1 -1
  16. package/src/config.d.ts +1 -1
  17. package/src/config.js +1 -1
  18. package/src/count.d.ts +1 -1
  19. package/src/count.js +1 -1
  20. package/src/crc32.d.ts +2 -3
  21. package/src/crc32.js +1 -1
  22. package/src/delay.d.ts +1 -1
  23. package/src/delay.js +1 -1
  24. package/src/diff.d.ts +3 -4
  25. package/src/diff.js +2 -2
  26. package/src/difftochanges.d.ts +1 -1
  27. package/src/difftochanges.js +1 -1
  28. package/src/dom/createelement.d.ts +5 -6
  29. package/src/dom/createelement.js +2 -2
  30. package/src/dom/emittermixin.d.ts +5 -5
  31. package/src/dom/emittermixin.js +6 -15
  32. package/src/dom/findclosestscrollableancestor.d.ts +1 -1
  33. package/src/dom/findclosestscrollableancestor.js +2 -2
  34. package/src/dom/getancestors.d.ts +1 -1
  35. package/src/dom/getancestors.js +1 -1
  36. package/src/dom/getborderwidths.d.ts +1 -1
  37. package/src/dom/getborderwidths.js +1 -1
  38. package/src/dom/getcommonancestor.d.ts +1 -1
  39. package/src/dom/getcommonancestor.js +2 -2
  40. package/src/dom/getdatafromelement.d.ts +1 -1
  41. package/src/dom/getdatafromelement.js +1 -1
  42. package/src/dom/getpositionedancestor.d.ts +1 -1
  43. package/src/dom/getpositionedancestor.js +2 -2
  44. package/src/dom/getrangefrommouseevent.d.ts +1 -1
  45. package/src/dom/getrangefrommouseevent.js +1 -1
  46. package/src/dom/getvisualviewportoffset.d.ts +1 -1
  47. package/src/dom/getvisualviewportoffset.js +3 -3
  48. package/src/dom/global.d.ts +2 -2
  49. package/src/dom/global.js +4 -4
  50. package/src/dom/indexof.d.ts +1 -1
  51. package/src/dom/indexof.js +1 -1
  52. package/src/dom/insertat.d.ts +1 -1
  53. package/src/dom/insertat.js +1 -1
  54. package/src/dom/iscomment.d.ts +1 -1
  55. package/src/dom/iscomment.js +1 -1
  56. package/src/dom/isnode.d.ts +1 -1
  57. package/src/dom/isnode.js +1 -1
  58. package/src/dom/isrange.d.ts +1 -1
  59. package/src/dom/isrange.js +1 -1
  60. package/src/dom/istext.d.ts +1 -1
  61. package/src/dom/istext.js +1 -1
  62. package/src/dom/isvalidattributename.d.ts +1 -1
  63. package/src/dom/isvalidattributename.js +2 -2
  64. package/src/dom/isvisible.d.ts +1 -1
  65. package/src/dom/isvisible.js +2 -2
  66. package/src/dom/iswindow.d.ts +1 -1
  67. package/src/dom/iswindow.js +1 -1
  68. package/src/dom/position.d.ts +5 -5
  69. package/src/dom/position.js +3 -3
  70. package/src/dom/rect.d.ts +3 -3
  71. package/src/dom/rect.js +7 -7
  72. package/src/dom/remove.d.ts +1 -1
  73. package/src/dom/remove.js +1 -1
  74. package/src/dom/resizeobserver.d.ts +1 -1
  75. package/src/dom/resizeobserver.js +2 -2
  76. package/src/dom/scroll.d.ts +1 -2
  77. package/src/dom/scroll.js +3 -3
  78. package/src/dom/setdatainelement.d.ts +1 -1
  79. package/src/dom/setdatainelement.js +1 -1
  80. package/src/dom/tounit.d.ts +1 -1
  81. package/src/dom/tounit.js +1 -1
  82. package/src/elementreplacer.d.ts +1 -1
  83. package/src/elementreplacer.js +1 -1
  84. package/src/emittermixin.d.ts +3 -3
  85. package/src/emittermixin.js +6 -14
  86. package/src/env.d.ts +16 -2
  87. package/src/env.js +17 -3
  88. package/src/eventinfo.d.ts +1 -1
  89. package/src/eventinfo.js +2 -2
  90. package/src/fastdiff.d.ts +1 -1
  91. package/src/fastdiff.js +1 -1
  92. package/src/first.d.ts +1 -1
  93. package/src/first.js +1 -1
  94. package/src/focustracker.d.ts +1 -1
  95. package/src/focustracker.js +4 -4
  96. package/src/formathtml.d.ts +1 -1
  97. package/src/formathtml.js +1 -1
  98. package/src/index.d.ts +69 -62
  99. package/src/index.js +68 -61
  100. package/src/inserttopriorityarray.d.ts +1 -1
  101. package/src/inserttopriorityarray.js +2 -2
  102. package/src/isiterable.d.ts +1 -1
  103. package/src/isiterable.js +1 -1
  104. package/src/keyboard.d.ts +2 -2
  105. package/src/keyboard.js +4 -4
  106. package/src/keystrokehandler.d.ts +2 -2
  107. package/src/keystrokehandler.js +3 -3
  108. package/src/legacyerrors.d.ts +5 -0
  109. package/src/legacyerrors.js +18 -0
  110. package/src/locale.d.ts +1 -10
  111. package/src/locale.js +2 -23
  112. package/src/mapsequal.d.ts +1 -1
  113. package/src/mapsequal.js +1 -1
  114. package/src/mix.d.ts +0 -27
  115. package/src/mix.js +1 -46
  116. package/src/nth.d.ts +1 -1
  117. package/src/nth.js +1 -1
  118. package/src/objecttomap.d.ts +1 -1
  119. package/src/objecttomap.js +1 -1
  120. package/src/observablemixin.d.ts +8 -9
  121. package/src/observablemixin.js +3 -12
  122. package/src/parsebase64encodedobject.d.ts +1 -1
  123. package/src/parsebase64encodedobject.js +1 -1
  124. package/src/priorities.d.ts +1 -2
  125. package/src/priorities.js +1 -2
  126. package/src/retry.d.ts +1 -1
  127. package/src/retry.js +2 -2
  128. package/src/splicearray.d.ts +1 -1
  129. package/src/splicearray.js +1 -1
  130. package/src/spy.d.ts +1 -2
  131. package/src/spy.js +1 -2
  132. package/src/toarray.d.ts +2 -2
  133. package/src/toarray.js +1 -1
  134. package/src/tomap.d.ts +1 -1
  135. package/src/tomap.js +3 -3
  136. package/src/translation-service.d.ts +1 -1
  137. package/src/translation-service.js +3 -3
  138. package/src/uid.d.ts +1 -1
  139. package/src/uid.js +1 -1
  140. package/src/version.d.ts +1 -2
  141. package/src/version.js +12 -13
  142. package/src/wait.d.ts +1 -1
  143. package/src/wait.js +1 -1
package/src/isiterable.js CHANGED
@@ -11,6 +11,6 @@
11
11
  * @param value The value to check.
12
12
  * @returns True if value implements iterator interface.
13
13
  */
14
- export default function isIterable(value) {
14
+ export function isIterable(value) {
15
15
  return !!(value && value[Symbol.iterator]);
16
16
  }
package/src/keyboard.d.ts CHANGED
@@ -76,7 +76,7 @@ export declare function isArrowKeyCode(keyCode: number): boolean;
76
76
  */
77
77
  export type ArrowKeyCodeDirection = 'left' | 'up' | 'right' | 'down';
78
78
  /**
79
- * Returns the direction in which the {@link module:engine/model/documentselection~DocumentSelection selection}
79
+ * Returns the direction in which the {@link module:engine/model/documentselection~ModelDocumentSelection selection}
80
80
  * will move when the provided arrow key code is pressed considering the language direction of the editor content.
81
81
  *
82
82
  * For instance, in right–to–left (RTL) content languages, pressing the left arrow means moving the selection right (forward)
@@ -89,7 +89,7 @@ export type ArrowKeyCodeDirection = 'left' | 'up' | 'right' | 'down';
89
89
  */
90
90
  export declare function getLocalizedArrowKeyCodeDirection(keyCode: number, contentLanguageDirection: LanguageDirection): ArrowKeyCodeDirection | undefined;
91
91
  /**
92
- * Determines if the provided key code moves the {@link module:engine/model/documentselection~DocumentSelection selection}
92
+ * Determines if the provided key code moves the {@link module:engine/model/documentselection~ModelDocumentSelection selection}
93
93
  * forward or backward considering the language direction of the editor content.
94
94
  *
95
95
  * For instance, in right–to–left (RTL) languages, pressing the left arrow means moving forward
package/src/keyboard.js CHANGED
@@ -2,8 +2,8 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import CKEditorError from './ckeditorerror.js';
6
- import env from './env.js';
5
+ import { CKEditorError } from './ckeditorerror.js';
6
+ import { env } from './env.js';
7
7
  const modifiersToGlyphsMac = {
8
8
  ctrl: '⌃',
9
9
  cmd: '⌘',
@@ -144,7 +144,7 @@ export function isArrowKeyCode(keyCode) {
144
144
  keyCode == keyCodes.arrowdown;
145
145
  }
146
146
  /**
147
- * Returns the direction in which the {@link module:engine/model/documentselection~DocumentSelection selection}
147
+ * Returns the direction in which the {@link module:engine/model/documentselection~ModelDocumentSelection selection}
148
148
  * will move when the provided arrow key code is pressed considering the language direction of the editor content.
149
149
  *
150
150
  * For instance, in right–to–left (RTL) content languages, pressing the left arrow means moving the selection right (forward)
@@ -185,7 +185,7 @@ function getEnvKeyCode(key) {
185
185
  return (env.isMac || env.isiOS) && code == keyCodes.ctrl ? keyCodes.cmd : code;
186
186
  }
187
187
  /**
188
- * Determines if the provided key code moves the {@link module:engine/model/documentselection~DocumentSelection selection}
188
+ * Determines if the provided key code moves the {@link module:engine/model/documentselection~ModelDocumentSelection selection}
189
189
  * forward or backward considering the language direction of the editor content.
190
190
  *
191
191
  * For instance, in right–to–left (RTL) languages, pressing the left arrow means moving forward
@@ -40,7 +40,7 @@ import type { PriorityString } from './priorities.js';
40
40
  * That keystroke handler will listen to `keydown` events fired in this view's main element.
41
41
  *
42
42
  */
43
- export default class KeystrokeHandler {
43
+ export declare class KeystrokeHandler {
44
44
  /**
45
45
  * Listener used to listen to events for easier keystroke handler destruction.
46
46
  */
@@ -59,7 +59,7 @@ export default class KeystrokeHandler {
59
59
  * @param keystroke Keystroke defined in a format accepted by
60
60
  * the {@link module:utils/keyboard~parseKeystroke} function.
61
61
  * @param callback A function called with the
62
- * {@link module:engine/view/observer/keyobserver~KeyEventData key event data} object and
62
+ * {@link module:engine/view/observer/keyobserver~ViewDocumentKeyEventData key event data} object and
63
63
  * a helper function to call both `preventDefault()` and `stopPropagation()` on the underlying event.
64
64
  * @param options Additional options.
65
65
  */
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module utils/keystrokehandler
7
7
  */
8
- import DomEmitterMixin from './dom/emittermixin.js';
8
+ import { DomEmitterMixin } from './dom/emittermixin.js';
9
9
  import { getCode, parseKeystroke } from './keyboard.js';
10
10
  /**
11
11
  * Keystroke handler allows registering callbacks for given keystrokes.
@@ -42,7 +42,7 @@ import { getCode, parseKeystroke } from './keyboard.js';
42
42
  * That keystroke handler will listen to `keydown` events fired in this view's main element.
43
43
  *
44
44
  */
45
- export default class KeystrokeHandler {
45
+ export class KeystrokeHandler {
46
46
  /**
47
47
  * Listener used to listen to events for easier keystroke handler destruction.
48
48
  */
@@ -76,7 +76,7 @@ export default class KeystrokeHandler {
76
76
  * @param keystroke Keystroke defined in a format accepted by
77
77
  * the {@link module:utils/keyboard~parseKeystroke} function.
78
78
  * @param callback A function called with the
79
- * {@link module:engine/view/observer/keyobserver~KeyEventData key event data} object and
79
+ * {@link module:engine/view/observer/keyobserver~ViewDocumentKeyEventData key event data} object and
80
80
  * a helper function to call both `preventDefault()` and `stopPropagation()` on the underlying event.
81
81
  * @param options Additional options.
82
82
  */
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, 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
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, 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/legacyerrors
7
+ */
8
+ import { CKEditorError } from './ckeditorerror.js';
9
+ if (false) {
10
+ /**
11
+ * The `Locale#language` property was deprecated and will
12
+ * be removed in the near future. Please use the {@link module:utils/locale~Locale#uiLanguage `Locale#uiLanguage`} and
13
+ * {@link module:utils/locale~Locale#contentLanguage `Locale#contentLanguage`} properties instead.
14
+ *
15
+ * @error locale-deprecated-language-property
16
+ */
17
+ throw new CKEditorError('locale-deprecated-language-property', null);
18
+ }
package/src/locale.d.ts CHANGED
@@ -11,7 +11,7 @@ import { type LanguageDirection } from './language.js';
11
11
  /**
12
12
  * Represents the localization services.
13
13
  */
14
- export default class Locale {
14
+ export declare class Locale {
15
15
  /**
16
16
  * The editor UI language code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
17
17
  *
@@ -108,15 +108,6 @@ export default class Locale {
108
108
  readonly contentLanguage?: string;
109
109
  readonly translations?: ArrayOrItem<Translations>;
110
110
  });
111
- /**
112
- * The editor UI language code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
113
- *
114
- * **Note**: This property was deprecated. Please use {@link #uiLanguage} and {@link #contentLanguage}
115
- * properties instead.
116
- *
117
- * @deprecated
118
- */
119
- get language(): string;
120
111
  /**
121
112
  * An unbound version of the {@link #t} method.
122
113
  */
package/src/locale.js CHANGED
@@ -5,13 +5,13 @@
5
5
  /**
6
6
  * @module utils/locale
7
7
  */
8
- import toArray from './toarray.js';
8
+ import { toArray } from './toarray.js';
9
9
  import { _translate, _unifyTranslations } from './translation-service.js';
10
10
  import { getLanguageDirection } from './language.js';
11
11
  /**
12
12
  * Represents the localization services.
13
13
  */
14
- export default class Locale {
14
+ export class Locale {
15
15
  /**
16
16
  * The editor UI language code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
17
17
  *
@@ -111,27 +111,6 @@ export default class Locale {
111
111
  this.translations = _unifyTranslations(translations);
112
112
  this.t = (message, values) => this._t(message, values);
113
113
  }
114
- /**
115
- * The editor UI language code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
116
- *
117
- * **Note**: This property was deprecated. Please use {@link #uiLanguage} and {@link #contentLanguage}
118
- * properties instead.
119
- *
120
- * @deprecated
121
- */
122
- get language() {
123
- /**
124
- * The {@link module:utils/locale~Locale#language `Locale#language`} property was deprecated and will
125
- * be removed in the near future. Please use the {@link module:utils/locale~Locale#uiLanguage `Locale#uiLanguage`} and
126
- * {@link module:utils/locale~Locale#contentLanguage `Locale#contentLanguage`} properties instead.
127
- *
128
- * @error locale-deprecated-language-property
129
- */
130
- console.warn('locale-deprecated-language-property: ' +
131
- 'The Locale#language property has been deprecated and will be removed in the near future. ' +
132
- 'Please use #uiLanguage and #contentLanguage properties instead.');
133
- return this.uiLanguage;
134
- }
135
114
  /**
136
115
  * An unbound version of the {@link #t} method.
137
116
  */
@@ -12,4 +12,4 @@
12
12
  * @param mapB The second map to compare.
13
13
  * @returns `true` if given maps are equal, `false` otherwise.
14
14
  */
15
- export default function mapsEqual<Key>(mapA: Map<Key, unknown>, mapB: Map<Key, unknown>): boolean;
15
+ export declare function mapsEqual<Key>(mapA: Map<Key, unknown>, mapB: Map<Key, unknown>): boolean;
package/src/mapsequal.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * @param mapB The second map to compare.
13
13
  * @returns `true` if given maps are equal, `false` otherwise.
14
14
  */
15
- export default function mapsEqual(mapA, mapB) {
15
+ export function mapsEqual(mapA, mapB) {
16
16
  if (mapA.size != mapB.size) {
17
17
  return false;
18
18
  }
package/src/mix.d.ts CHANGED
@@ -5,33 +5,6 @@
5
5
  /**
6
6
  * @module utils/mix
7
7
  */
8
- /**
9
- * Copies enumerable properties and symbols from the objects given as 2nd+ parameters to the
10
- * prototype of first object (a constructor).
11
- *
12
- * ```
13
- * class Editor {
14
- * ...
15
- * }
16
- *
17
- * const SomeMixin = {
18
- * a() {
19
- * return 'a';
20
- * }
21
- * };
22
- *
23
- * mix( Editor, SomeMixin, ... );
24
- *
25
- * new Editor().a(); // -> 'a'
26
- * ```
27
- *
28
- * Note: Properties which already exist in the base class will not be overriden.
29
- *
30
- * @deprecated Use mixin pattern, see: https://www.typescriptlang.org/docs/handbook/mixins.html.
31
- * @param baseClass Class which prototype will be extended.
32
- * @param mixins Objects from which to get properties.
33
- */
34
- export default function mix(baseClass: Function, ...mixins: Array<object>): void;
35
8
  /**
36
9
  * Helper type that represents constructor creating given objects. Can be used as a type constraint.
37
10
  *
package/src/mix.js CHANGED
@@ -2,49 +2,4 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- /**
6
- * @module utils/mix
7
- */
8
- /**
9
- * Copies enumerable properties and symbols from the objects given as 2nd+ parameters to the
10
- * prototype of first object (a constructor).
11
- *
12
- * ```
13
- * class Editor {
14
- * ...
15
- * }
16
- *
17
- * const SomeMixin = {
18
- * a() {
19
- * return 'a';
20
- * }
21
- * };
22
- *
23
- * mix( Editor, SomeMixin, ... );
24
- *
25
- * new Editor().a(); // -> 'a'
26
- * ```
27
- *
28
- * Note: Properties which already exist in the base class will not be overriden.
29
- *
30
- * @deprecated Use mixin pattern, see: https://www.typescriptlang.org/docs/handbook/mixins.html.
31
- * @param baseClass Class which prototype will be extended.
32
- * @param mixins Objects from which to get properties.
33
- */
34
- export default function mix(baseClass, ...mixins) {
35
- mixins.forEach(mixin => {
36
- const propertyNames = Object.getOwnPropertyNames(mixin);
37
- const propertySymbols = Object.getOwnPropertySymbols(mixin);
38
- propertyNames.concat(propertySymbols).forEach(key => {
39
- if (key in baseClass.prototype) {
40
- return;
41
- }
42
- if (typeof mixin == 'function' && (key == 'length' || key == 'name' || key == 'prototype')) {
43
- return;
44
- }
45
- const sourceDescriptor = Object.getOwnPropertyDescriptor(mixin, key);
46
- sourceDescriptor.enumerable = false;
47
- Object.defineProperty(baseClass.prototype, key, sourceDescriptor);
48
- });
49
- });
50
- }
5
+ export {};
package/src/nth.d.ts CHANGED
@@ -13,4 +13,4 @@
13
13
  * Refer to the [Iterators and Generators](https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Iterators_and_Generators)
14
14
  * guide to learn differences between these interfaces.
15
15
  */
16
- export default function nth<T>(index: number, iterable: Iterable<T>): T | null;
16
+ export declare function nth<T>(index: number, iterable: Iterable<T>): T | null;
package/src/nth.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * Refer to the [Iterators and Generators](https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Iterators_and_Generators)
14
14
  * guide to learn differences between these interfaces.
15
15
  */
16
- export default function nth(index, iterable) {
16
+ export function nth(index, iterable) {
17
17
  for (const item of iterable) {
18
18
  if (index === 0) {
19
19
  return item;
@@ -18,6 +18,6 @@
18
18
  * @param obj Object to transform.
19
19
  * @returns Map created from object.
20
20
  */
21
- export default function objectToMap<T>(obj: {
21
+ export declare function objectToMap<T>(obj: {
22
22
  readonly [key: string]: T;
23
23
  } | null | undefined): Map<string, T>;
@@ -18,7 +18,7 @@
18
18
  * @param obj Object to transform.
19
19
  * @returns Map created from object.
20
20
  */
21
- export default function objectToMap(obj) {
21
+ export function objectToMap(obj) {
22
22
  const map = new Map();
23
23
  for (const key in obj) {
24
24
  map.set(key, obj[key]);
@@ -28,7 +28,7 @@ import type { Constructor, Mixed } from './mix.js';
28
28
  *
29
29
  * @label EXTENDS
30
30
  */
31
- export default function ObservableMixin<Base extends Constructor<Emitter>>(base: Base): Mixed<Base, Observable>;
31
+ export declare function ObservableMixin<Base extends Constructor<Emitter>>(base: Base): Mixed<Base, Observable>;
32
32
  /**
33
33
  * A mixin that injects the "observable properties" and data binding functionality described in the
34
34
  * {@link ~Observable} interface.
@@ -48,7 +48,7 @@ export default function ObservableMixin<Base extends Constructor<Emitter>>(base:
48
48
  *
49
49
  * @label NO_ARGUMENTS
50
50
  */
51
- export default function ObservableMixin(): {
51
+ export declare function ObservableMixin(): {
52
52
  new (): Observable;
53
53
  prototype: Observable;
54
54
  };
@@ -194,7 +194,7 @@ export interface Observable extends Emitter {
194
194
  * @param bindProperty Observable property that will be bound to other observable(s).
195
195
  * @returns The bind chain with the `to()` and `toMany()` methods.
196
196
  */
197
- bind<K extends keyof this & string>(bindProperty: K): SingleBindChain<K, this[K]>;
197
+ bind<K extends keyof this & string>(bindProperty: K): ObservableSingleBindChain<K, this[K]>;
198
198
  /**
199
199
  * Binds {@link #set observable properties} to other objects implementing the
200
200
  * {@link module:utils/observablemixin~Observable} interface.
@@ -269,7 +269,7 @@ export interface Observable extends Emitter {
269
269
  * @param bindProperty2 Observable property that will be bound to other observable(s).
270
270
  * @returns The bind chain with the `to()` and `toMany()` methods.
271
271
  */
272
- bind<K1 extends keyof this & string, K2 extends keyof this & string>(bindProperty1: K1, bindProperty2: K2): DualBindChain<K1, this[K1], K2, this[K2]>;
272
+ bind<K1 extends keyof this & string, K2 extends keyof this & string>(bindProperty1: K1, bindProperty2: K2): ObservableDualBindChain<K1, this[K1], K2, this[K2]>;
273
273
  /**
274
274
  * Binds {@link #set observable properties} to other objects implementing the
275
275
  * {@link module:utils/observablemixin~Observable} interface.
@@ -343,7 +343,7 @@ export interface Observable extends Emitter {
343
343
  * @param bindProperties Observable properties that will be bound to other observable(s).
344
344
  * @returns The bind chain with the `to()` and `toMany()` methods.
345
345
  */
346
- bind(...bindProperties: Array<keyof this & string>): MultiBindChain;
346
+ bind(...bindProperties: Array<keyof this & string>): ObservableMultiBindChain;
347
347
  /**
348
348
  * Removes the binding created with {@link #bind}.
349
349
  *
@@ -519,7 +519,7 @@ export type DecoratedMethodEvent<TObservable extends Observable & {
519
519
  args: [Parameters<TObservable[TName]>];
520
520
  return: ReturnType<TObservable[TName]>;
521
521
  };
522
- interface SingleBindChain<TKey extends string, TVal> {
522
+ export interface ObservableSingleBindChain<TKey extends string, TVal> {
523
523
  toMany<O extends Observable, K extends keyof O>(observables: ReadonlyArray<O>, key: K, callback: (...values: Array<O[K]>) => TVal): void;
524
524
  to<O extends ObservableWithProperty<TKey, TVal>>(observable: O): void;
525
525
  to<O extends ObservableWithProperty<TKey>>(observable: O, callback: (value: O[TKey]) => TVal): void;
@@ -550,11 +550,10 @@ export type ObservableWithProperty<TKey extends PropertyKey, TVal = any> = undef
550
550
  } : Observable & {
551
551
  [P in TKey]: TVal;
552
552
  };
553
- interface DualBindChain<TKey1 extends string, TVal1, TKey2 extends string, TVal2> {
553
+ export interface ObservableDualBindChain<TKey1 extends string, TVal1, TKey2 extends string, TVal2> {
554
554
  to<O extends ObservableWithProperty<K1, TVal1> & ObservableWithProperty<K2, TVal2>, K1 extends keyof O, K2 extends keyof O>(observable: O, key1: K1, key2: K2): void;
555
555
  to<O extends ObservableWithProperty<TKey1, TVal1> & ObservableWithProperty<TKey2, TVal2>>(observable: O): void;
556
556
  }
557
- interface MultiBindChain {
557
+ export interface ObservableMultiBindChain {
558
558
  to<O extends Observable>(observable: O, ...properties: Array<keyof O>): void;
559
559
  }
560
- export {};
@@ -6,8 +6,8 @@
6
6
  /**
7
7
  * @module utils/observablemixin
8
8
  */
9
- import EmitterMixin from './emittermixin.js';
10
- import CKEditorError from './ckeditorerror.js';
9
+ import { EmitterMixin } from './emittermixin.js';
10
+ import { CKEditorError } from './ckeditorerror.js';
11
11
  import { isObject } from 'es-toolkit/compat';
12
12
  const observablePropertiesSymbol = Symbol('observableProperties');
13
13
  const boundObservablesSymbol = Symbol('boundObservables');
@@ -15,7 +15,7 @@ const boundPropertiesSymbol = Symbol('boundProperties');
15
15
  const decoratedMethods = Symbol('decoratedMethods');
16
16
  const decoratedOriginal = Symbol('decoratedOriginal');
17
17
  const defaultObservableClass = /* #__PURE__ */ ObservableMixin(/* #__PURE__ */ EmitterMixin());
18
- export default function ObservableMixin(base) {
18
+ export function ObservableMixin(base) {
19
19
  if (!base) {
20
20
  return defaultObservableClass;
21
21
  }
@@ -211,15 +211,6 @@ export default function ObservableMixin(base) {
211
211
  }
212
212
  return Mixin;
213
213
  }
214
- // Backward compatibility with `mix`
215
- ([
216
- 'set', 'bind', 'unbind', 'decorate',
217
- 'on', 'once', 'off', 'listenTo',
218
- 'stopListening', 'fire', 'delegate', 'stopDelegating',
219
- '_addEventListener', '_removeEventListener'
220
- ]).forEach(key => {
221
- ObservableMixin[key] = defaultObservableClass.prototype[key];
222
- });
223
214
  // Init symbol properties needed for the observable mechanism to work.
224
215
  function initObservable(observable) {
225
216
  // Do nothing if already inited.
@@ -8,4 +8,4 @@
8
8
  /**
9
9
  * Parses a base64-encoded object and returns the decoded object, or null if the decoding was unsuccessful.
10
10
  */
11
- export default function parseBase64EncodedObject(encoded: string): Record<string, any> | null;
11
+ export declare function parseBase64EncodedObject(encoded: string): Record<string, any> | null;
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * Parses a base64-encoded object and returns the decoded object, or null if the decoding was unsuccessful.
10
10
  */
11
- export default function parseBase64EncodedObject(encoded) {
11
+ export function parseBase64EncodedObject(encoded) {
12
12
  try {
13
13
  if (!encoded.startsWith('ey')) {
14
14
  return null;
@@ -29,5 +29,4 @@ export interface PrioritiesType {
29
29
  /**
30
30
  * Provides group of constants to use instead of hardcoding numeric priority values.
31
31
  */
32
- declare const priorities: PrioritiesType;
33
- export default priorities;
32
+ export declare const priorities: PrioritiesType;
package/src/priorities.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Provides group of constants to use instead of hardcoding numeric priority values.
7
7
  */
8
- const priorities = {
8
+ export const priorities = {
9
9
  get(priority = 'normal') {
10
10
  if (typeof priority != 'number') {
11
11
  return this[priority] || this.normal;
@@ -20,4 +20,3 @@ const priorities = {
20
20
  low: -1000,
21
21
  lowest: -100000
22
22
  };
23
- export default priorities;
package/src/retry.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * @param options.retryDelay The time in milliseconds between attempts. By default it implements exponential back-off policy.
15
15
  * @param options.signal The signal to abort further retries. The callback itself is not aborted automatically.
16
16
  */
17
- export default function retry<TResult>(callback: () => Promise<TResult>, options?: {
17
+ export declare function retry<TResult>(callback: () => Promise<TResult>, options?: {
18
18
  maxAttempts?: number;
19
19
  retryDelay?: (attempt: number) => number;
20
20
  signal?: AbortSignal;
package/src/retry.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module utils/retry
7
7
  */
8
- import wait from './wait.js';
8
+ import { wait } from './wait.js';
9
9
  /**
10
10
  * Tries calling the given callback until it sucessfully resolves.
11
11
  *
@@ -18,7 +18,7 @@ import wait from './wait.js';
18
18
  * @param options.retryDelay The time in milliseconds between attempts. By default it implements exponential back-off policy.
19
19
  * @param options.signal The signal to abort further retries. The callback itself is not aborted automatically.
20
20
  */
21
- export default async function retry(callback, options = {}) {
21
+ export async function retry(callback, options = {}) {
22
22
  const { maxAttempts = 4, retryDelay = exponentialDelay(), signal = (new AbortController()).signal } = options;
23
23
  signal.throwIfAborted();
24
24
  for (let attempt = 0;; attempt++) {
@@ -23,4 +23,4 @@
23
23
  *
24
24
  * @returns New spliced array.
25
25
  */
26
- export default function spliceArray<T>(targetArray: Array<T>, insertArray: Array<T>, index: number): void;
26
+ export declare function spliceArray<T>(targetArray: Array<T>, insertArray: Array<T>, index: number): void;
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * @returns New spliced array.
25
25
  */
26
- export default function spliceArray(targetArray, insertArray, index) {
26
+ export function spliceArray(targetArray, insertArray, index) {
27
27
  const originalLength = targetArray.length;
28
28
  const insertLength = insertArray.length;
29
29
  // Shift elements in the target array to make space for insertArray
package/src/spy.d.ts CHANGED
@@ -14,8 +14,7 @@
14
14
  *
15
15
  * @returns The spy function.
16
16
  */
17
- declare function spy(): {
17
+ export declare function spy(): {
18
18
  (): void;
19
19
  called?: boolean;
20
20
  };
21
- export default spy;
package/src/spy.js CHANGED
@@ -14,9 +14,8 @@
14
14
  *
15
15
  * @returns The spy function.
16
16
  */
17
- function spy() {
17
+ export function spy() {
18
18
  return function spy() {
19
19
  spy.called = true;
20
20
  };
21
21
  }
22
- export default spy;
package/src/toarray.d.ts CHANGED
@@ -12,7 +12,7 @@
12
12
  * @param data The value to transform to an array.
13
13
  * @returns An array created from data.
14
14
  */
15
- export default function toArray<T>(data: ArrayOrItem<T>): Array<T>;
15
+ export declare function toArray<T>(data: ArrayOrItem<T>): Array<T>;
16
16
  /**
17
17
  * Transforms any value to an array. If the provided value is already an array, it is returned unchanged.
18
18
  *
@@ -20,6 +20,6 @@ export default function toArray<T>(data: ArrayOrItem<T>): Array<T>;
20
20
  * @param data The value to transform to an array.
21
21
  * @returns An array created from data.
22
22
  */
23
- export default function toArray<T>(data: ReadonlyArrayOrItem<T>): ReadonlyArray<T>;
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/src/toarray.js CHANGED
@@ -2,6 +2,6 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- export default function toArray(data) {
5
+ export function toArray(data) {
6
6
  return Array.isArray(data) ? data : [data];
7
7
  }
package/src/tomap.d.ts CHANGED
@@ -14,6 +14,6 @@
14
14
  * @param data Object or iterable to transform.
15
15
  * @returns Map created from data.
16
16
  */
17
- export default function toMap<T>(data: {
17
+ export declare function toMap<T>(data: {
18
18
  readonly [key: string]: T;
19
19
  } | Iterable<readonly [string, T]> | null | undefined): Map<string, T>;
package/src/tomap.js CHANGED
@@ -5,8 +5,8 @@
5
5
  /**
6
6
  * @module utils/tomap
7
7
  */
8
- import objectToMap from './objecttomap.js';
9
- import isIterable from './isiterable.js';
8
+ import { objectToMap } from './objecttomap.js';
9
+ import { isIterable } from './isiterable.js';
10
10
  /**
11
11
  * Transforms object or iterable to map. Iterable needs to be in the format acceptable by the `Map` constructor.
12
12
  *
@@ -19,7 +19,7 @@ import isIterable from './isiterable.js';
19
19
  * @param data Object or iterable to transform.
20
20
  * @returns Map created from data.
21
21
  */
22
- export default function toMap(data) {
22
+ export function toMap(data) {
23
23
  if (isIterable(data)) {
24
24
  return new Map(data);
25
25
  }
@@ -65,7 +65,7 @@ declare global {
65
65
  * }
66
66
  * ```
67
67
  *
68
- * If you cannot import this function from this module (e.g. because you use a CKEditor 5 build), you can
68
+ * If you cannot import { this function } from this module (e.g. because you use a CKEditor 5 build), you can
69
69
  * still add translations by extending the global `window.CKEDITOR_TRANSLATIONS` object by using a function like
70
70
  * the one below:
71
71
  *
@@ -2,8 +2,8 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import CKEditorError from './ckeditorerror.js';
6
- import global from './dom/global.js';
5
+ import { CKEditorError } from './ckeditorerror.js';
6
+ import { global } from './dom/global.js';
7
7
  import { merge } from 'es-toolkit/compat';
8
8
  /* istanbul ignore else -- @preserve */
9
9
  if (!global.window.CKEDITOR_TRANSLATIONS) {
@@ -64,7 +64,7 @@ if (!global.window.CKEDITOR_TRANSLATIONS) {
64
64
  * }
65
65
  * ```
66
66
  *
67
- * If you cannot import this function from this module (e.g. because you use a CKEditor 5 build), you can
67
+ * If you cannot import { this function } from this module (e.g. because you use a CKEditor 5 build), you can
68
68
  * still add translations by extending the global `window.CKEDITOR_TRANSLATIONS` object by using a function like
69
69
  * the one below:
70
70
  *
package/src/uid.d.ts CHANGED
@@ -12,4 +12,4 @@
12
12
  *
13
13
  * @returns An unique id string.
14
14
  */
15
- export default function uid(): string;
15
+ export declare function uid(): string;