@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.
- package/dist/abortabledebounce.d.ts +19 -13
- package/dist/areconnectedthroughproperties.d.ts +7 -7
- package/dist/ckeditorerror.d.ts +113 -113
- package/dist/collection.d.ts +419 -415
- package/dist/collectstylesheets.d.ts +9 -9
- package/dist/comparearrays.d.ts +25 -25
- package/dist/config.d.ts +159 -156
- package/dist/count.d.ts +14 -14
- package/dist/crc32.d.ts +19 -19
- package/dist/decodelicensekey.d.ts +7 -7
- package/dist/delay.d.ts +13 -13
- package/dist/diff.d.ts +32 -27
- package/dist/difftochanges.d.ts +47 -47
- package/dist/dom/createelement.d.ts +43 -43
- package/dist/dom/emittermixin.d.ts +144 -135
- package/dist/dom/findclosestscrollableancestor.d.ts +8 -8
- package/dist/dom/getancestors.d.ts +13 -13
- package/dist/dom/getborderwidths.d.ts +16 -16
- package/dist/dom/getcommonancestor.d.ts +9 -9
- package/dist/dom/getdatafromelement.d.ts +10 -10
- package/dist/dom/getpositionedancestor.d.ts +7 -7
- package/dist/dom/getrangefrommouseevent.d.ts +12 -12
- package/dist/dom/getvisualviewportoffset.d.ts +7 -7
- package/dist/dom/global.d.ts +24 -24
- package/dist/dom/indexof.d.ts +10 -10
- package/dist/dom/insertat.d.ts +11 -11
- package/dist/dom/iscomment.d.ts +7 -7
- package/dist/dom/isnode.d.ts +7 -7
- package/dist/dom/isrange.d.ts +7 -7
- package/dist/dom/istext.d.ts +7 -7
- package/dist/dom/isvalidattributename.d.ts +7 -7
- package/dist/dom/isvisible.d.ts +12 -12
- package/dist/dom/iswindow.d.ts +7 -7
- package/dist/dom/position.d.ts +200 -200
- package/dist/dom/rect.d.ts +194 -194
- package/dist/dom/remove.d.ts +9 -9
- package/dist/dom/resizeobserver.d.ts +70 -70
- package/dist/dom/scroll.d.ts +75 -72
- package/dist/dom/setdatainelement.d.ts +10 -10
- package/dist/dom/tounit.d.ts +16 -16
- package/dist/elementreplacer.d.ts +26 -26
- package/dist/emittermixin.d.ts +290 -280
- package/dist/env.d.ts +124 -124
- package/dist/eventinfo.d.ts +58 -55
- package/dist/fastdiff.d.ts +112 -109
- package/dist/first.d.ts +7 -7
- package/dist/focustracker.d.ts +133 -131
- package/dist/formathtml.d.ts +15 -15
- package/dist/index-content.css +1 -0
- package/dist/index-editor.css +1 -0
- package/dist/index.css +0 -2
- package/dist/index.d.ts +78 -77
- package/dist/index.js +5695 -6360
- package/dist/index.js.map +1 -1
- package/dist/inserttopriorityarray.d.ts +23 -23
- package/dist/isfeatureblockedbylicensekey.d.ts +10 -10
- package/dist/isiterable.d.ts +10 -10
- package/dist/keyboard.d.ts +107 -109
- package/dist/keystrokehandler.d.ts +90 -90
- package/dist/language.d.ts +12 -12
- package/dist/legacyerrors.d.ts +0 -4
- package/dist/locale.d.ts +122 -122
- package/dist/mapsequal.d.ts +11 -11
- package/dist/mix.d.ts +54 -53
- package/dist/nth.d.ts +12 -12
- package/dist/objecttomap.d.ts +18 -18
- package/dist/observablemixin.d.ts +621 -539
- package/dist/parsebase64encodedobject.d.ts +7 -7
- package/dist/parsedimensionwithunit.d.ts +40 -0
- package/dist/priorities.d.ts +24 -24
- package/dist/retry.d.ts +27 -27
- package/dist/splicearray.d.ts +22 -22
- package/dist/spy.d.ts +15 -15
- package/dist/toarray.d.ts +17 -17
- package/dist/tomap.d.ts +15 -15
- package/dist/translation-service.d.ts +157 -157
- package/dist/uid.d.ts +12 -12
- package/dist/unicode.d.ts +42 -42
- package/dist/version.d.ts +5 -5
- package/dist/wait.d.ts +11 -11
- package/package.json +2 -2
- package/dist/index.css.map +0 -1
package/dist/difftochanges.d.ts
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
import type { DiffResult } from
|
|
6
|
+
* @module utils/difftochanges
|
|
7
|
+
*/
|
|
8
|
+
import type { DiffResult } from "./diff.js";
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
type: "insert";
|
|
43
|
+
index: number;
|
|
44
|
+
values: Array<T>;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
* An object describing deletion change.
|
|
48
|
+
*/
|
|
49
49
|
export interface DeleteChange {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
type: "delete";
|
|
51
|
+
index: number;
|
|
52
|
+
howMany: number;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
6
|
+
* Attributes to be applied to the HTML element.
|
|
7
|
+
*/
|
|
8
8
|
export type HTMLElementAttributes = {
|
|
9
|
-
|
|
9
|
+
readonly [key: string]: string;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* Attributes to be applied to the SVG element.
|
|
13
|
+
*/
|
|
14
14
|
export type SVGElementAttributes = HTMLElementAttributes & {
|
|
15
|
-
|
|
15
|
+
xmlns: string;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
import { type Emitter, type CallbackOptions, type BaseEvent, type GetCallback } from
|
|
9
|
-
import { type EventInfo } from
|
|
10
|
-
import type { Constructor, Mixed } from
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/getancestors
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/getborderwidths
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
17
|
+
* An object describing widths of `HTMLElement` borders.
|
|
18
18
|
*/
|
|
19
19
|
export interface BorderWidths {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
top: number;
|
|
21
|
+
right: number;
|
|
22
|
+
bottom: number;
|
|
23
|
+
left: number;
|
|
24
24
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
6
|
+
* @module utils/dom/getdatafromelement
|
|
7
|
+
*/
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|