@ckeditor/ckeditor5-utils 48.8.1-alpha.4 → 49.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 (101) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/abortabledebounce.d.ts +19 -13
  3. package/dist/areconnectedthroughproperties.d.ts +7 -7
  4. package/dist/ckeditorerror.d.ts +114 -113
  5. package/dist/collection.d.ts +419 -415
  6. package/dist/collectstylesheets.d.ts +9 -9
  7. package/dist/comparearrays.d.ts +25 -25
  8. package/dist/config.d.ts +159 -156
  9. package/dist/count.d.ts +14 -14
  10. package/dist/crc32.d.ts +19 -19
  11. package/dist/decodelicensekey.d.ts +7 -7
  12. package/dist/delay.d.ts +13 -13
  13. package/dist/diff.d.ts +32 -27
  14. package/dist/difftochanges.d.ts +47 -47
  15. package/dist/dom/adoptglobalstylesheet.d.ts +19 -0
  16. package/dist/dom/containsnode.d.ts +18 -0
  17. package/dist/dom/createelement.d.ts +43 -43
  18. package/dist/dom/emittermixin.d.ts +141 -135
  19. package/dist/dom/findclosestscrollableancestor.d.ts +13 -8
  20. package/dist/dom/getactiveelement.d.ts +17 -0
  21. package/dist/dom/getancestors.d.ts +13 -13
  22. package/dist/dom/getborderwidths.d.ts +16 -16
  23. package/dist/dom/getdatafromelement.d.ts +10 -10
  24. package/dist/dom/getelementfrompoint.d.ts +23 -0
  25. package/dist/dom/getlayoutparentelement.d.ts +18 -0
  26. package/dist/dom/getlayoutparentnode.d.ts +24 -0
  27. package/dist/dom/getoverlaymountroot.d.ts +24 -0
  28. package/dist/dom/getparentelement.d.ts +13 -0
  29. package/dist/dom/getparentnode.d.ts +15 -0
  30. package/dist/dom/getpositionedancestor.d.ts +18 -7
  31. package/dist/dom/getrangefrommouseevent.d.ts +15 -13
  32. package/dist/dom/getselection.d.ts +106 -0
  33. package/dist/dom/getshadowroots.d.ts +19 -0
  34. package/dist/dom/getvisualviewportoffset.d.ts +7 -7
  35. package/dist/dom/global.d.ts +24 -24
  36. package/dist/dom/indexof.d.ts +10 -10
  37. package/dist/dom/insertat.d.ts +11 -11
  38. package/dist/dom/iscomment.d.ts +7 -7
  39. package/dist/dom/isdomselectionbackward.d.ts +18 -0
  40. package/dist/dom/isnode.d.ts +7 -7
  41. package/dist/dom/isoffline.d.ts +8 -0
  42. package/dist/dom/isrange.d.ts +7 -7
  43. package/dist/dom/isshadowhostof.d.ts +18 -0
  44. package/dist/dom/isshadowroot.d.ts +41 -0
  45. package/dist/dom/istext.d.ts +7 -7
  46. package/dist/dom/isvalidattributename.d.ts +7 -7
  47. package/dist/dom/isvisible.d.ts +16 -12
  48. package/dist/dom/iswindow.d.ts +7 -7
  49. package/dist/dom/position.d.ts +200 -200
  50. package/dist/dom/rect.d.ts +198 -194
  51. package/dist/dom/remove.d.ts +7 -10
  52. package/dist/dom/resizeobserver.d.ts +70 -70
  53. package/dist/dom/scroll.d.ts +83 -72
  54. package/dist/dom/setdatainelement.d.ts +8 -11
  55. package/dist/dom/shadowrootregistry.d.ts +125 -0
  56. package/dist/dom/tounit.d.ts +16 -16
  57. package/dist/dom/trustedtypes.d.ts +65 -0
  58. package/dist/dom/whenelementconnected.d.ts +26 -0
  59. package/dist/elementreplacer.d.ts +24 -27
  60. package/dist/emittermixin.d.ts +287 -280
  61. package/dist/env.d.ts +124 -124
  62. package/dist/eventinfo.d.ts +58 -55
  63. package/dist/fastdiff.d.ts +112 -109
  64. package/dist/first.d.ts +7 -7
  65. package/dist/focustracker.d.ts +133 -131
  66. package/dist/formathtml.d.ts +15 -15
  67. package/dist/index-content.css +3 -0
  68. package/dist/index-content.css.map +1 -0
  69. package/dist/index-editor.css +3 -0
  70. package/dist/index-editor.css.map +1 -0
  71. package/dist/index.d.ts +95 -77
  72. package/dist/index.js +6788 -6360
  73. package/dist/index.js.map +1 -1
  74. package/dist/inserttopriorityarray.d.ts +23 -23
  75. package/dist/isfeatureblockedbylicensekey.d.ts +10 -10
  76. package/dist/isiterable.d.ts +10 -10
  77. package/dist/keyboard.d.ts +107 -109
  78. package/dist/keystrokehandler.d.ts +90 -90
  79. package/dist/language.d.ts +12 -12
  80. package/dist/legacyerrors.d.ts +0 -4
  81. package/dist/locale.d.ts +122 -122
  82. package/dist/mapsequal.d.ts +11 -11
  83. package/dist/mix.d.ts +54 -53
  84. package/dist/nth.d.ts +12 -12
  85. package/dist/objecttomap.d.ts +18 -18
  86. package/dist/observablemixin.d.ts +618 -539
  87. package/dist/parsebase64encodedobject.d.ts +7 -7
  88. package/dist/parsedimensionwithunit.d.ts +40 -0
  89. package/dist/priorities.d.ts +24 -24
  90. package/dist/retry.d.ts +27 -27
  91. package/dist/splicearray.d.ts +22 -22
  92. package/dist/spy.d.ts +15 -15
  93. package/dist/toarray.d.ts +17 -17
  94. package/dist/tomap.d.ts +15 -15
  95. package/dist/translation-service.d.ts +157 -157
  96. package/dist/uid.d.ts +12 -12
  97. package/dist/unicode.d.ts +42 -42
  98. package/dist/version.d.ts +5 -5
  99. package/dist/wait.d.ts +11 -11
  100. package/package.json +3 -3
  101. package/dist/dom/getcommonancestor.d.ts +0 -12
@@ -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;
@@ -0,0 +1,19 @@
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
+ * Ships a stylesheet that has to reach the light DOM, whatever tree the editor itself lives in.
7
+ *
8
+ * For the few rules that a shadow-scoped theme stylesheet cannot express, because they style nodes no shadow
9
+ * root can contain: the `<html>` and `<body>` elements, or third-party UI mounted in `document.body`. Anything
10
+ * that styles the editor UI belongs in a theme stylesheet instead, where an integrator can see and override it.
11
+ *
12
+ * Safe to call from any number of editors sharing a document, and at any time: the same stylesheet text is
13
+ * adopted once per document. The stylesheet then stays for the lifetime of the document, inert unless the
14
+ * classes it targets are present.
15
+ *
16
+ * @param doc The document to adopt the stylesheet into.
17
+ * @param css The stylesheet text. Pass a constant – repeated calls with the same text are a no-op.
18
+ */
19
+ export declare function adoptGlobalStyleSheet(doc: Document, css: string): void;
@@ -0,0 +1,18 @@
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
+ * Checks whether `node` is inside `container`, looking through shadow roots on the way.
7
+ *
8
+ * Use it instead of `Node#contains()`, which stops at a shadow root: that one says `false` even when
9
+ * `container` really is an ancestor, as long as a shadow root sits between the two. A node contains itself
10
+ * here, just like it does there.
11
+ *
12
+ * `container` can also be a `Document` or a `ShadowRoot` – useful for a `scroll` event, for example, whose
13
+ * target is the document and not an element. Works with open and closed shadow roots.
14
+ *
15
+ * @param container The node that may be the ancestor.
16
+ * @param node The node to look for. May be `null`, which always gives `false`.
17
+ */
18
+ export declare function containsNode(container: Node, node: Node | null): boolean;
@@ -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,148 @@
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>;
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> = new () => Emitter> = Mixed<Base, DomEmitter>;
36
21
  /**
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;
61
- };
62
- export interface DomEventMap extends HTMLElementEventMap, WindowEventMap {
63
- }
22
+ * Mixin that injects the DOM events API into its host. It provides the API
23
+ * compatible with {@link module:utils/emittermixin~Emitter}.
24
+ *
25
+ * This function creates a class that inherits from the provided `base` and implements `Emitter` interface.
26
+ *
27
+ * DOM emitter mixin is by default available in the {@link module:ui/view~View} class,
28
+ * but it can also be mixed into any other class:
29
+ *
30
+ * ```ts
31
+ * import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
32
+ *
33
+ * class BaseClass { ... }
34
+ *
35
+ * class SomeView extends DomEmitterMixin( BaseClass ) {}
36
+ *
37
+ * const view = new SomeView();
38
+ * view.listenTo( domElement, ( evt, domEvt ) => {
39
+ * console.log( evt, domEvt );
40
+ * } );
41
+ * ```
42
+ *
43
+ * @label EXTENDS
44
+ */
45
+ export declare function DomEmitterMixin<Base extends Constructor<Emitter>>(base: Base): DomEmitterMixinConstructor<Base>;
46
+ /**
47
+ * Mixin that injects the DOM events API into its host. It provides the API
48
+ * compatible with {@link module:utils/emittermixin~Emitter}.
49
+ *
50
+ * This function creates a class that implements `Emitter` interface.
51
+ *
52
+ * DOM emitter mixin is by default available in the {@link module:ui/view~View} class,
53
+ * but it can also be mixed into any other class:
54
+ *
55
+ * ```ts
56
+ * import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
57
+ *
58
+ * class SomeView extends DomEmitterMixin() {}
59
+ *
60
+ * const view = new SomeView();
61
+ * view.listenTo( domElement, ( evt, domEvt ) => {
62
+ * console.log( evt, domEvt );
63
+ * } );
64
+ * ```
65
+ *
66
+ * @label NO_ARGUMENTS
67
+ */
68
+ export declare function DomEmitterMixin(): DomEmitterMixinConstructor;
69
+ export interface DomEventMap extends HTMLElementEventMap, WindowEventMap {}
64
70
  /**
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
- */
71
+ * Interface representing classes which mix in {@link module:utils/dom/emittermixin~DomEmitterMixin}.
72
+ *
73
+ * Can be easily implemented by a class by mixing the {@link module:utils/dom/emittermixin~DomEmitterMixin} mixin.
74
+ *
75
+ * ```ts
76
+ * class MyClass extends DomEmitterMixin( OtherBaseClass ) {
77
+ * // This class now implements the `Emitter` interface.
78
+ * }
79
+ * ```
80
+ */
75
81
  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;
82
+ /**
83
+ * Registers a callback function to be executed when an event is fired in a specific Emitter or DOM Node.
84
+ * It is backwards compatible with {@link module:utils/emittermixin~Emitter#listenTo}.
85
+ *
86
+ * @label HTML_EMITTER
87
+ * @param emitter The object that fires the event.
88
+ * @param event The name of the event.
89
+ * @param callback The function to be called on event.
90
+ * @param options Additional options.
91
+ * @param options.useCapture Indicates that events of this type will be dispatched to the registered
92
+ * listener before being dispatched to any EventTarget beneath it in the DOM tree.
93
+ * @param options.usePassive Indicates that the function specified by listener will never call preventDefault()
94
+ * and prevents blocking browser's main thread by this event handler.
95
+ */
96
+ listenTo<K extends keyof DomEventMap>(emitter: Node | Window | EventTarget, event: K, callback: (this: this, ev: EventInfo, event: DomEventMap[K]) => void, options?: CallbackOptions & {
97
+ readonly useCapture?: boolean;
98
+ readonly usePassive?: boolean;
99
+ }): void;
100
+ /**
101
+ * Registers a callback function to be executed when an event is fired in a specific (emitter) object.
102
+ *
103
+ * Events can be grouped in namespaces using `:`.
104
+ * When namespaced event is fired, it additionally fires all callbacks for that namespace.
105
+ *
106
+ * ```ts
107
+ * // myEmitter.on( ... ) is a shorthand for myEmitter.listenTo( myEmitter, ... ).
108
+ * myEmitter.on( 'myGroup', genericCallback );
109
+ * myEmitter.on( 'myGroup:myEvent', specificCallback );
110
+ *
111
+ * // genericCallback is fired.
112
+ * myEmitter.fire( 'myGroup' );
113
+ * // both genericCallback and specificCallback are fired.
114
+ * myEmitter.fire( 'myGroup:myEvent' );
115
+ * // genericCallback is fired even though there are no callbacks for "foo".
116
+ * myEmitter.fire( 'myGroup:foo' );
117
+ * ```
118
+ *
119
+ * An event callback can {@link module:utils/eventinfo~EventInfo#stop stop the event} and
120
+ * set the {@link module:utils/eventinfo~EventInfo#return return value} of the {@link #fire} method.
121
+ *
122
+ * @label DOM_EMITTER
123
+ * @typeParam TEvent The type describing the event. See {@link module:utils/emittermixin~BaseEvent}.
124
+ * @param emitter The object that fires the event.
125
+ * @param event The name of the event.
126
+ * @param callback The function to be called on event.
127
+ * @param options Additional options.
128
+ */
129
+ listenTo<TEvent extends BaseEvent>(emitter: Emitter, event: TEvent["name"], callback: GetCallback<TEvent>, options?: CallbackOptions): void;
130
+ /**
131
+ * Stops listening for events. It can be used at different levels:
132
+ * It is backwards compatible with {@link module:utils/emittermixin~Emitter#listenTo}.
133
+ *
134
+ * * To stop listening to a specific callback.
135
+ * * To stop listening to a specific event.
136
+ * * To stop listening to all events fired by a specific object.
137
+ * * To stop listening to all events fired by all objects.
138
+ *
139
+ * @label DOM_STOP
140
+ * @param emitter The object to stop listening to.
141
+ * If omitted, stops it for all objects.
142
+ * @param event (Requires the `emitter`) The name of the event to stop listening to. If omitted, stops it
143
+ * for all events from `emitter`.
144
+ * @param callback (Requires the `event`) The function to be removed from the call list for the given
145
+ * `event`.
146
+ */
147
+ stopListening(emitter?: Emitter | Node | Window | EventTarget, event?: string, callback?: Function): void;
142
148
  }
@@ -1,11 +1,16 @@
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
+ * The search crosses shadow DOM boundaries, continuing from the host element of a shadow root instead of
9
+ * stopping at it. Without that, an element rendered inside a shadow tree would report no scrollable ancestor at
10
+ * all, even when one exists further up in the surrounding document, because the walk goes over `parentElement`,
11
+ * which is `null` for a direct child of a shadow root. Works for both open and closed shadow roots.
12
+ *
13
+ * @param domElement DOM element.
14
+ * @returns First ancestor of `domElement` that is scrollable or null if such ancestor doesn't exist.
15
+ */
11
16
  export declare function findClosestScrollableAncestor(domElement: HTMLElement): HTMLElement | null;
@@ -0,0 +1,17 @@
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/dom/getactiveelement
7
+ */
8
+ /**
9
+ * Returns the focused element in the tree the given node lives in.
10
+ *
11
+ * The shadow-aware replacement for `document.activeElement`, which reports the host of a shadow tree rather
12
+ * than the focused element inside it. Pass any node from the tree whose focus is in question – typically the
13
+ * element being checked itself. Works for open and closed roots alike.
14
+ *
15
+ * @param node The node whose tree's active element should be returned.
16
+ */
17
+ export declare function getActiveElement(node: Node): Element | 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>;