@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,59 +1,59 @@
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/difftochanges
7
- */
8
- import type { DiffResult } from './diff.js';
6
+ * @module utils/difftochanges
7
+ */
8
+ import type { DiffResult } from "./diff.js";
9
9
  /**
10
- * Creates a set of changes which need to be applied to the input in order to transform
11
- * it into the output. This function can be used with strings or arrays.
12
- *
13
- * ```ts
14
- * const input = Array.from( 'abc' );
15
- * const output = Array.from( 'xaby' );
16
- * const changes = diffToChanges( diff( input, output ), output );
17
- *
18
- * changes.forEach( change => {
19
- * if ( change.type == 'insert' ) {
20
- * input.splice( change.index, 0, ...change.values );
21
- * } else if ( change.type == 'delete' ) {
22
- * input.splice( change.index, change.howMany );
23
- * }
24
- * } );
25
- *
26
- * input.join( '' ) == output.join( '' ); // -> true
27
- * ```
28
- *
29
- * @typeParam T The type of output array element.
30
- * @param diff Result of {@link module:utils/diff~diff}.
31
- * @param output The string or array which was passed as diff's output.
32
- * @returns Set of changes (insert or delete) which need to be applied to the input
33
- * in order to transform it into the output.
34
- */
10
+ * Creates a set of changes which need to be applied to the input in order to transform
11
+ * it into the output. This function can be used with strings or arrays.
12
+ *
13
+ * ```ts
14
+ * const input = Array.from( 'abc' );
15
+ * const output = Array.from( 'xaby' );
16
+ * const changes = diffToChanges( diff( input, output ), output );
17
+ *
18
+ * changes.forEach( change => {
19
+ * if ( change.type == 'insert' ) {
20
+ * input.splice( change.index, 0, ...change.values );
21
+ * } else if ( change.type == 'delete' ) {
22
+ * input.splice( change.index, change.howMany );
23
+ * }
24
+ * } );
25
+ *
26
+ * input.join( '' ) == output.join( '' ); // -> true
27
+ * ```
28
+ *
29
+ * @typeParam T The type of output array element.
30
+ * @param diff Result of {@link module:utils/diff~diff}.
31
+ * @param output The string or array which was passed as diff's output.
32
+ * @returns Set of changes (insert or delete) which need to be applied to the input
33
+ * in order to transform it into the output.
34
+ */
35
35
  export declare function diffToChanges<T>(diff: ReadonlyArray<DiffResult>, output: ArrayLike<T>): Array<Change<T>>;
36
36
  /**
37
- * An object describing insertion change.
38
- *
39
- * @typeParam T The type of output array element.
40
- */
37
+ * An object describing insertion change.
38
+ *
39
+ * @typeParam T The type of output array element.
40
+ */
41
41
  export interface InsertChange<T> {
42
- type: 'insert';
43
- index: number;
44
- values: Array<T>;
42
+ type: "insert";
43
+ index: number;
44
+ values: Array<T>;
45
45
  }
46
46
  /**
47
- * An object describing deletion change.
48
- */
47
+ * An object describing deletion change.
48
+ */
49
49
  export interface DeleteChange {
50
- type: 'delete';
51
- index: number;
52
- howMany: number;
50
+ type: "delete";
51
+ index: number;
52
+ howMany: number;
53
53
  }
54
54
  /**
55
- * The element of the result of {@link module:utils/difftochanges~diffToChanges} function.
56
- *
57
- * @typeParam T The type of output array element.
58
- */
55
+ * The element of the result of {@link module:utils/difftochanges~diffToChanges} function.
56
+ *
57
+ * @typeParam T The type of output array element.
58
+ */
59
59
  export type Change<T> = InsertChange<T> | DeleteChange;
@@ -1,56 +1,56 @@
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
- * Attributes to be applied to the HTML element.
7
- */
6
+ * Attributes to be applied to the HTML element.
7
+ */
8
8
  export type HTMLElementAttributes = {
9
- readonly [key: string]: string;
9
+ readonly [key: string]: string;
10
10
  };
11
11
  /**
12
- * Attributes to be applied to the SVG element.
13
- */
12
+ * Attributes to be applied to the SVG element.
13
+ */
14
14
  export type SVGElementAttributes = HTMLElementAttributes & {
15
- xmlns: string;
15
+ xmlns: string;
16
16
  };
17
17
  /**
18
- * Element or elements that will be added to the created element as children. Strings will be automatically turned into Text nodes.
19
- */
18
+ * Element or elements that will be added to the created element as children. Strings will be automatically turned into Text nodes.
19
+ */
20
20
  export type ChildrenElements = Node | string | Iterable<Node | string>;
21
21
  /**
22
- * Creates an SVG element with attributes and children elements.
23
- *
24
- * ```ts
25
- * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' } ); // <mask>
26
- * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg', id: 'foo' } ); // <mask id="foo">
27
- * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' }, 'foo' ); // <mask>foo</mask>
28
- * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' }, [ createElement(...) ] ); // <mask><...></mask>
29
- * ```
30
- *
31
- * @label SVG_ELEMENT
32
- * @param doc Document used to create the element.
33
- * @param name Name of the SVG element.
34
- * @param attributes Object where keys represent attribute keys and values represent attribute values.
35
- * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
36
- * @returns SVG element.
37
- */
22
+ * Creates an SVG element with attributes and children elements.
23
+ *
24
+ * ```ts
25
+ * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' } ); // <mask>
26
+ * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg', id: 'foo' } ); // <mask id="foo">
27
+ * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' }, 'foo' ); // <mask>foo</mask>
28
+ * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' }, [ createElement(...) ] ); // <mask><...></mask>
29
+ * ```
30
+ *
31
+ * @label SVG_ELEMENT
32
+ * @param doc Document used to create the element.
33
+ * @param name Name of the SVG element.
34
+ * @param attributes Object where keys represent attribute keys and values represent attribute values.
35
+ * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
36
+ * @returns SVG element.
37
+ */
38
38
  export declare function createElement<T extends keyof SVGElementTagNameMap>(doc: Document, name: T, attributes: SVGElementAttributes, children?: ChildrenElements): SVGElementTagNameMap[T];
39
39
  /**
40
- * Creates an HTML element with attributes and children elements.
41
- *
42
- * ```ts
43
- * createElement( document, 'p' ); // <p>
44
- * createElement( document, 'p', { class: 'foo' } ); // <p class="foo">
45
- * createElement( document, 'p', null, 'foo' ); // <p>foo</p>
46
- * createElement( document, 'p', null, [ createElement(...) ] ); // <p><...></p>
47
- * ```
48
- *
49
- * @label HTML_ELEMENT
50
- * @param doc Document used to create the element.
51
- * @param name Name of the HTML element.
52
- * @param attributes Object where keys represent attribute keys and values represent attribute values.
53
- * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
54
- * @returns HTML element.
55
- */
40
+ * Creates an HTML element with attributes and children elements.
41
+ *
42
+ * ```ts
43
+ * createElement( document, 'p' ); // <p>
44
+ * createElement( document, 'p', { class: 'foo' } ); // <p class="foo">
45
+ * createElement( document, 'p', null, 'foo' ); // <p>foo</p>
46
+ * createElement( document, 'p', null, [ createElement(...) ] ); // <p><...></p>
47
+ * ```
48
+ *
49
+ * @label HTML_ELEMENT
50
+ * @param doc Document used to create the element.
51
+ * @param name Name of the HTML element.
52
+ * @param attributes Object where keys represent attribute keys and values represent attribute values.
53
+ * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
54
+ * @returns HTML element.
55
+ */
56
56
  export declare function createElement<T extends keyof HTMLElementTagNameMap>(doc: Document, name: T, attributes?: HTMLElementAttributes, children?: ChildrenElements): HTMLElementTagNameMap[T];
@@ -1,142 +1,151 @@
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/dom/emittermixin
7
- */
8
- import { type Emitter, type CallbackOptions, type BaseEvent, type GetCallback } from '../emittermixin.js';
9
- import { type EventInfo } from '../eventinfo.js';
10
- import type { Constructor, Mixed } from '../mix.js';
6
+ * @module utils/dom/emittermixin
7
+ */
8
+ import { type Emitter, type CallbackOptions, type BaseEvent, type GetCallback } from "../emittermixin.js";
9
+ import { type EventInfo } from "../eventinfo.js";
10
+ import type { Constructor, Mixed } from "../mix.js";
11
11
  /**
12
- * Mixin that injects the DOM events API into its host. It provides the API
13
- * compatible with {@link module:utils/emittermixin~Emitter}.
14
- *
15
- * This function creates a class that inherits from the provided `base` and implements `Emitter` interface.
16
- *
17
- * DOM emitter mixin is by default available in the {@link module:ui/view~View} class,
18
- * but it can also be mixed into any other class:
19
- *
20
- * ```ts
21
- * import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
22
- *
23
- * class BaseClass { ... }
24
- *
25
- * class SomeView extends DomEmitterMixin( BaseClass ) {}
26
- *
27
- * const view = new SomeView();
28
- * view.listenTo( domElement, ( evt, domEvt ) => {
29
- * console.log( evt, domEvt );
30
- * } );
31
- * ```
32
- *
33
- * @label EXTENDS
34
- */
35
- export declare function DomEmitterMixin<Base extends Constructor<Emitter>>(base: Base): Mixed<Base, DomEmitter>;
36
- /**
37
- * Mixin that injects the DOM events API into its host. It provides the API
38
- * compatible with {@link module:utils/emittermixin~Emitter}.
39
- *
40
- * This function creates a class that implements `Emitter` interface.
41
- *
42
- * DOM emitter mixin is by default available in the {@link module:ui/view~View} class,
43
- * but it can also be mixed into any other class:
44
- *
45
- * ```ts
46
- * import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
47
- *
48
- * class SomeView extends DomEmitterMixin() {}
49
- *
50
- * const view = new SomeView();
51
- * view.listenTo( domElement, ( evt, domEvt ) => {
52
- * console.log( evt, domEvt );
53
- * } );
54
- * ```
55
- *
56
- * @label NO_ARGUMENTS
57
- */
58
- export declare function DomEmitterMixin(): {
59
- new (): DomEmitter;
60
- prototype: DomEmitter;
12
+ * Constructor returned by {@link ~DomEmitterMixin}. Use it to name a mixin base class before extending it.
13
+ *
14
+ * ```ts
15
+ * const MyDomEmitterBase: DomEmitterMixinConstructor<typeof BaseClass> = DomEmitterMixin( BaseClass );
16
+ *
17
+ * class MyDomEmitter extends MyDomEmitterBase {}
18
+ * ```
19
+ */
20
+ export type DomEmitterMixinConstructor<Base extends Constructor<Emitter> | undefined = undefined> = Base extends Constructor<Emitter> ? Mixed<Base, DomEmitter> : {
21
+ new (): DomEmitter;
22
+ prototype: DomEmitter;
61
23
  };
62
- export interface DomEventMap extends HTMLElementEventMap, WindowEventMap {
63
- }
64
24
  /**
65
- * Interface representing classes which mix in {@link module:utils/dom/emittermixin~DomEmitterMixin}.
66
- *
67
- * Can be easily implemented by a class by mixing the {@link module:utils/dom/emittermixin~DomEmitterMixin} mixin.
68
- *
69
- * ```ts
70
- * class MyClass extends DomEmitterMixin( OtherBaseClass ) {
71
- * // This class now implements the `Emitter` interface.
72
- * }
73
- * ```
74
- */
25
+ * Mixin that injects the DOM events API into its host. It provides the API
26
+ * compatible with {@link module:utils/emittermixin~Emitter}.
27
+ *
28
+ * This function creates a class that inherits from the provided `base` and implements `Emitter` interface.
29
+ *
30
+ * DOM emitter mixin is by default available in the {@link module:ui/view~View} class,
31
+ * but it can also be mixed into any other class:
32
+ *
33
+ * ```ts
34
+ * import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
35
+ *
36
+ * class BaseClass { ... }
37
+ *
38
+ * class SomeView extends DomEmitterMixin( BaseClass ) {}
39
+ *
40
+ * const view = new SomeView();
41
+ * view.listenTo( domElement, ( evt, domEvt ) => {
42
+ * console.log( evt, domEvt );
43
+ * } );
44
+ * ```
45
+ *
46
+ * @label EXTENDS
47
+ */
48
+ export declare function DomEmitterMixin<Base extends Constructor<Emitter>>(base: Base): DomEmitterMixinConstructor<Base>;
49
+ /**
50
+ * Mixin that injects the DOM events API into its host. It provides the API
51
+ * compatible with {@link module:utils/emittermixin~Emitter}.
52
+ *
53
+ * This function creates a class that implements `Emitter` interface.
54
+ *
55
+ * DOM emitter mixin is by default available in the {@link module:ui/view~View} class,
56
+ * but it can also be mixed into any other class:
57
+ *
58
+ * ```ts
59
+ * import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
60
+ *
61
+ * class SomeView extends DomEmitterMixin() {}
62
+ *
63
+ * const view = new SomeView();
64
+ * view.listenTo( domElement, ( evt, domEvt ) => {
65
+ * console.log( evt, domEvt );
66
+ * } );
67
+ * ```
68
+ *
69
+ * @label NO_ARGUMENTS
70
+ */
71
+ export declare function DomEmitterMixin(): DomEmitterMixinConstructor;
72
+ export interface DomEventMap extends HTMLElementEventMap, WindowEventMap {}
73
+ /**
74
+ * Interface representing classes which mix in {@link module:utils/dom/emittermixin~DomEmitterMixin}.
75
+ *
76
+ * Can be easily implemented by a class by mixing the {@link module:utils/dom/emittermixin~DomEmitterMixin} mixin.
77
+ *
78
+ * ```ts
79
+ * class MyClass extends DomEmitterMixin( OtherBaseClass ) {
80
+ * // This class now implements the `Emitter` interface.
81
+ * }
82
+ * ```
83
+ */
75
84
  export interface DomEmitter extends Emitter {
76
- /**
77
- * Registers a callback function to be executed when an event is fired in a specific Emitter or DOM Node.
78
- * It is backwards compatible with {@link module:utils/emittermixin~Emitter#listenTo}.
79
- *
80
- * @label HTML_EMITTER
81
- * @param emitter The object that fires the event.
82
- * @param event The name of the event.
83
- * @param callback The function to be called on event.
84
- * @param options Additional options.
85
- * @param options.useCapture Indicates that events of this type will be dispatched to the registered
86
- * listener before being dispatched to any EventTarget beneath it in the DOM tree.
87
- * @param options.usePassive Indicates that the function specified by listener will never call preventDefault()
88
- * and prevents blocking browser's main thread by this event handler.
89
- */
90
- listenTo<K extends keyof DomEventMap>(emitter: Node | Window | EventTarget, event: K, callback: (this: this, ev: EventInfo, event: DomEventMap[K]) => void, options?: CallbackOptions & {
91
- readonly useCapture?: boolean;
92
- readonly usePassive?: boolean;
93
- }): void;
94
- /**
95
- * Registers a callback function to be executed when an event is fired in a specific (emitter) object.
96
- *
97
- * Events can be grouped in namespaces using `:`.
98
- * When namespaced event is fired, it additionally fires all callbacks for that namespace.
99
- *
100
- * ```ts
101
- * // myEmitter.on( ... ) is a shorthand for myEmitter.listenTo( myEmitter, ... ).
102
- * myEmitter.on( 'myGroup', genericCallback );
103
- * myEmitter.on( 'myGroup:myEvent', specificCallback );
104
- *
105
- * // genericCallback is fired.
106
- * myEmitter.fire( 'myGroup' );
107
- * // both genericCallback and specificCallback are fired.
108
- * myEmitter.fire( 'myGroup:myEvent' );
109
- * // genericCallback is fired even though there are no callbacks for "foo".
110
- * myEmitter.fire( 'myGroup:foo' );
111
- * ```
112
- *
113
- * An event callback can {@link module:utils/eventinfo~EventInfo#stop stop the event} and
114
- * set the {@link module:utils/eventinfo~EventInfo#return return value} of the {@link #fire} method.
115
- *
116
- * @label DOM_EMITTER
117
- * @typeParam TEvent The type describing the event. See {@link module:utils/emittermixin~BaseEvent}.
118
- * @param emitter The object that fires the event.
119
- * @param event The name of the event.
120
- * @param callback The function to be called on event.
121
- * @param options Additional options.
122
- */
123
- listenTo<TEvent extends BaseEvent>(emitter: Emitter, event: TEvent['name'], callback: GetCallback<TEvent>, options?: CallbackOptions): void;
124
- /**
125
- * Stops listening for events. It can be used at different levels:
126
- * It is backwards compatible with {@link module:utils/emittermixin~Emitter#listenTo}.
127
- *
128
- * * To stop listening to a specific callback.
129
- * * To stop listening to a specific event.
130
- * * To stop listening to all events fired by a specific object.
131
- * * To stop listening to all events fired by all objects.
132
- *
133
- * @label DOM_STOP
134
- * @param emitter The object to stop listening to.
135
- * If omitted, stops it for all objects.
136
- * @param event (Requires the `emitter`) The name of the event to stop listening to. If omitted, stops it
137
- * for all events from `emitter`.
138
- * @param callback (Requires the `event`) The function to be removed from the call list for the given
139
- * `event`.
140
- */
141
- stopListening(emitter?: Emitter | Node | Window | EventTarget, event?: string, callback?: Function): void;
85
+ /**
86
+ * Registers a callback function to be executed when an event is fired in a specific Emitter or DOM Node.
87
+ * It is backwards compatible with {@link module:utils/emittermixin~Emitter#listenTo}.
88
+ *
89
+ * @label HTML_EMITTER
90
+ * @param emitter The object that fires the event.
91
+ * @param event The name of the event.
92
+ * @param callback The function to be called on event.
93
+ * @param options Additional options.
94
+ * @param options.useCapture Indicates that events of this type will be dispatched to the registered
95
+ * listener before being dispatched to any EventTarget beneath it in the DOM tree.
96
+ * @param options.usePassive Indicates that the function specified by listener will never call preventDefault()
97
+ * and prevents blocking browser's main thread by this event handler.
98
+ */
99
+ listenTo<K extends keyof DomEventMap>(emitter: Node | Window | EventTarget, event: K, callback: (this: this, ev: EventInfo, event: DomEventMap[K]) => void, options?: CallbackOptions & {
100
+ readonly useCapture?: boolean;
101
+ readonly usePassive?: boolean;
102
+ }): void;
103
+ /**
104
+ * Registers a callback function to be executed when an event is fired in a specific (emitter) object.
105
+ *
106
+ * Events can be grouped in namespaces using `:`.
107
+ * When namespaced event is fired, it additionally fires all callbacks for that namespace.
108
+ *
109
+ * ```ts
110
+ * // myEmitter.on( ... ) is a shorthand for myEmitter.listenTo( myEmitter, ... ).
111
+ * myEmitter.on( 'myGroup', genericCallback );
112
+ * myEmitter.on( 'myGroup:myEvent', specificCallback );
113
+ *
114
+ * // genericCallback is fired.
115
+ * myEmitter.fire( 'myGroup' );
116
+ * // both genericCallback and specificCallback are fired.
117
+ * myEmitter.fire( 'myGroup:myEvent' );
118
+ * // genericCallback is fired even though there are no callbacks for "foo".
119
+ * myEmitter.fire( 'myGroup:foo' );
120
+ * ```
121
+ *
122
+ * An event callback can {@link module:utils/eventinfo~EventInfo#stop stop the event} and
123
+ * set the {@link module:utils/eventinfo~EventInfo#return return value} of the {@link #fire} method.
124
+ *
125
+ * @label DOM_EMITTER
126
+ * @typeParam TEvent The type describing the event. See {@link module:utils/emittermixin~BaseEvent}.
127
+ * @param emitter The object that fires the event.
128
+ * @param event The name of the event.
129
+ * @param callback The function to be called on event.
130
+ * @param options Additional options.
131
+ */
132
+ listenTo<TEvent extends BaseEvent>(emitter: Emitter, event: TEvent["name"], callback: GetCallback<TEvent>, options?: CallbackOptions): void;
133
+ /**
134
+ * Stops listening for events. It can be used at different levels:
135
+ * It is backwards compatible with {@link module:utils/emittermixin~Emitter#listenTo}.
136
+ *
137
+ * * To stop listening to a specific callback.
138
+ * * To stop listening to a specific event.
139
+ * * To stop listening to all events fired by a specific object.
140
+ * * To stop listening to all events fired by all objects.
141
+ *
142
+ * @label DOM_STOP
143
+ * @param emitter The object to stop listening to.
144
+ * If omitted, stops it for all objects.
145
+ * @param event (Requires the `emitter`) The name of the event to stop listening to. If omitted, stops it
146
+ * for all events from `emitter`.
147
+ * @param callback (Requires the `event`) The function to be removed from the call list for the given
148
+ * `event`.
149
+ */
150
+ stopListening(emitter?: Emitter | Node | Window | EventTarget, event?: string, callback?: Function): void;
142
151
  }
@@ -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
- * Returns the closest scrollable ancestor of a DOM element.
7
- *
8
- * @param domElement DOM element.
9
- * @returns First ancestor of `domElement` that is scrollable or null if such ancestor doesn't exist.
10
- */
6
+ * Returns the closest scrollable ancestor of a DOM element.
7
+ *
8
+ * @param domElement DOM element.
9
+ * @returns First ancestor of `domElement` that is scrollable or null if such ancestor doesn't exist.
10
+ */
11
11
  export declare function findClosestScrollableAncestor(domElement: HTMLElement): HTMLElement | null;
@@ -1,17 +1,17 @@
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/dom/getancestors
7
- */
6
+ * @module utils/dom/getancestors
7
+ */
8
8
  /**
9
- * Returns all ancestors of given DOM node, starting from the top-most (root). Includes the given node itself. If the
10
- * node is a part of `DocumentFragment` that `DocumentFragment` will be returned. In contrary, if the node is
11
- * appended to a `Document`, that `Document` will not be returned (algorithms operating on DOM tree care for `Document#documentElement`
12
- * at most, which will be returned).
13
- *
14
- * @param node DOM node.
15
- * @returns Array of given `node` parents.
16
- */
9
+ * Returns all ancestors of given DOM node, starting from the top-most (root). Includes the given node itself. If the
10
+ * node is a part of `DocumentFragment` that `DocumentFragment` will be returned. In contrary, if the node is
11
+ * appended to a `Document`, that `Document` will not be returned (algorithms operating on DOM tree care for `Document#documentElement`
12
+ * at most, which will be returned).
13
+ *
14
+ * @param node DOM node.
15
+ * @returns Array of given `node` parents.
16
+ */
17
17
  export declare function getAncestors(node: Node): Array<Node>;
@@ -1,24 +1,24 @@
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/dom/getborderwidths
7
- */
6
+ * @module utils/dom/getborderwidths
7
+ */
8
8
  /**
9
- * Returns an object containing CSS border widths of a specified HTML element.
10
- *
11
- * @param element An element which has CSS borders.
12
- * @returns An object containing `top`, `left`, `right` and `bottom` properties
13
- * with numerical values of the `border-[top,left,right,bottom]-width` CSS styles.
14
- */
9
+ * Returns an object containing CSS border widths of a specified HTML element.
10
+ *
11
+ * @param element An element which has CSS borders.
12
+ * @returns An object containing `top`, `left`, `right` and `bottom` properties
13
+ * with numerical values of the `border-[top,left,right,bottom]-width` CSS styles.
14
+ */
15
15
  export declare function getBorderWidths(element: HTMLElement): BorderWidths;
16
16
  /**
17
- * An object describing widths of `HTMLElement` borders.
17
+ * An object describing widths of `HTMLElement` borders.
18
18
  */
19
19
  export interface BorderWidths {
20
- top: number;
21
- right: number;
22
- bottom: number;
23
- left: number;
20
+ top: number;
21
+ right: number;
22
+ bottom: number;
23
+ left: number;
24
24
  }
@@ -1,12 +1,12 @@
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
- * Searches and returns the lowest common ancestor of two given nodes.
7
- *
8
- * @param nodeA First node.
9
- * @param nodeB Second node.
10
- * @returns Lowest common ancestor of both nodes or `null` if nodes do not have a common ancestor.
11
- */
6
+ * Searches and returns the lowest common ancestor of two given nodes.
7
+ *
8
+ * @param nodeA First node.
9
+ * @param nodeB Second node.
10
+ * @returns Lowest common ancestor of both nodes or `null` if nodes do not have a common ancestor.
11
+ */
12
12
  export declare function getCommonAncestor(nodeA: Node, nodeB: Node): Node | null;
@@ -1,14 +1,14 @@
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/dom/getdatafromelement
7
- */
6
+ * @module utils/dom/getdatafromelement
7
+ */
8
8
  /**
9
- * Gets data from a given source element.
10
- *
11
- * @param el The element from which the data will be retrieved.
12
- * @returns The data string.
13
- */
9
+ * Gets data from a given source element.
10
+ *
11
+ * @param el The element from which the data will be retrieved.
12
+ * @returns The data string.
13
+ */
14
14
  export declare function getDataFromElement(el: HTMLElement): string;