@ckeditor/ckeditor5-utils 44.1.0 → 44.2.0-alpha.1

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 (213) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/index-content.css +2 -2
  3. package/dist/index-editor.css +2 -2
  4. package/dist/index.css +2 -2
  5. package/dist/index.js +194 -47
  6. package/dist/index.js.map +1 -1
  7. package/package.json +24 -4
  8. package/src/abortabledebounce.d.ts +1 -1
  9. package/src/abortabledebounce.js +1 -1
  10. package/src/areconnectedthroughproperties.d.ts +1 -1
  11. package/src/areconnectedthroughproperties.js +1 -1
  12. package/src/ckeditorerror.d.ts +1 -1
  13. package/src/ckeditorerror.js +1 -1
  14. package/src/collection.d.ts +1 -1
  15. package/src/collection.js +1 -1
  16. package/src/collectstylesheets.d.ts +13 -0
  17. package/src/collectstylesheets.js +52 -0
  18. package/src/comparearrays.d.ts +1 -1
  19. package/src/comparearrays.js +1 -1
  20. package/src/config.d.ts +1 -1
  21. package/src/config.js +1 -1
  22. package/src/count.d.ts +1 -1
  23. package/src/count.js +1 -1
  24. package/src/crc32.d.ts +1 -1
  25. package/src/crc32.js +1 -1
  26. package/src/delay.d.ts +1 -1
  27. package/src/delay.js +1 -1
  28. package/src/diff.d.ts +1 -1
  29. package/src/diff.js +1 -1
  30. package/src/difftochanges.d.ts +1 -1
  31. package/src/difftochanges.js +1 -1
  32. package/src/dom/createelement.d.ts +1 -1
  33. package/src/dom/createelement.js +1 -1
  34. package/src/dom/emittermixin.d.ts +1 -1
  35. package/src/dom/emittermixin.js +1 -1
  36. package/src/dom/findclosestscrollableancestor.d.ts +1 -1
  37. package/src/dom/findclosestscrollableancestor.js +1 -1
  38. package/src/dom/getancestors.d.ts +1 -1
  39. package/src/dom/getancestors.js +1 -1
  40. package/src/dom/getborderwidths.d.ts +1 -1
  41. package/src/dom/getborderwidths.js +1 -1
  42. package/src/dom/getcommonancestor.d.ts +1 -1
  43. package/src/dom/getcommonancestor.js +1 -1
  44. package/src/dom/getdatafromelement.d.ts +1 -1
  45. package/src/dom/getdatafromelement.js +1 -1
  46. package/src/dom/getpositionedancestor.d.ts +1 -1
  47. package/src/dom/getpositionedancestor.js +1 -1
  48. package/src/dom/getrangefrommouseevent.d.ts +1 -1
  49. package/src/dom/getrangefrommouseevent.js +1 -1
  50. package/src/dom/global.d.ts +1 -1
  51. package/src/dom/global.js +1 -1
  52. package/src/dom/indexof.d.ts +1 -1
  53. package/src/dom/indexof.js +1 -1
  54. package/src/dom/insertat.d.ts +1 -1
  55. package/src/dom/insertat.js +1 -1
  56. package/src/dom/iscomment.d.ts +1 -1
  57. package/src/dom/iscomment.js +1 -1
  58. package/src/dom/isnode.d.ts +1 -1
  59. package/src/dom/isnode.js +1 -1
  60. package/src/dom/isrange.d.ts +1 -1
  61. package/src/dom/isrange.js +1 -1
  62. package/src/dom/istext.d.ts +1 -1
  63. package/src/dom/istext.js +1 -1
  64. package/src/dom/isvalidattributename.d.ts +1 -1
  65. package/src/dom/isvalidattributename.js +1 -1
  66. package/src/dom/isvisible.d.ts +1 -1
  67. package/src/dom/isvisible.js +1 -1
  68. package/src/dom/iswindow.d.ts +1 -1
  69. package/src/dom/iswindow.js +1 -1
  70. package/src/dom/position.d.ts +1 -1
  71. package/src/dom/position.js +1 -1
  72. package/src/dom/rect.d.ts +1 -1
  73. package/src/dom/rect.js +1 -1
  74. package/src/dom/remove.d.ts +1 -1
  75. package/src/dom/remove.js +1 -1
  76. package/src/dom/resizeobserver.d.ts +1 -1
  77. package/src/dom/resizeobserver.js +1 -1
  78. package/src/dom/scroll.d.ts +1 -1
  79. package/src/dom/scroll.js +1 -1
  80. package/src/dom/setdatainelement.d.ts +1 -1
  81. package/src/dom/setdatainelement.js +1 -1
  82. package/src/dom/tounit.d.ts +1 -1
  83. package/src/dom/tounit.js +1 -1
  84. package/src/elementreplacer.d.ts +1 -1
  85. package/src/elementreplacer.js +1 -1
  86. package/src/emittermixin.d.ts +1 -1
  87. package/src/emittermixin.js +1 -1
  88. package/src/env.d.ts +1 -1
  89. package/src/env.js +1 -1
  90. package/src/eventinfo.d.ts +1 -1
  91. package/src/eventinfo.js +1 -1
  92. package/src/fastdiff.d.ts +1 -1
  93. package/src/fastdiff.js +1 -1
  94. package/src/first.d.ts +1 -1
  95. package/src/first.js +1 -1
  96. package/src/focustracker.d.ts +1 -1
  97. package/src/focustracker.js +1 -1
  98. package/src/index.d.ts +3 -1
  99. package/src/index.js +3 -1
  100. package/src/inserttopriorityarray.d.ts +1 -1
  101. package/src/inserttopriorityarray.js +1 -1
  102. package/src/isiterable.d.ts +1 -1
  103. package/src/isiterable.js +1 -1
  104. package/src/keyboard.d.ts +4 -3
  105. package/src/keyboard.js +8 -4
  106. package/src/keystrokehandler.d.ts +1 -1
  107. package/src/keystrokehandler.js +1 -1
  108. package/src/language.d.ts +1 -1
  109. package/src/language.js +1 -1
  110. package/src/locale.d.ts +1 -1
  111. package/src/locale.js +1 -1
  112. package/src/mapsequal.d.ts +1 -1
  113. package/src/mapsequal.js +1 -1
  114. package/src/mix.d.ts +1 -1
  115. package/src/mix.js +1 -1
  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 +1 -1
  121. package/src/observablemixin.js +1 -1
  122. package/src/parsebase64encodedobject.d.ts +1 -1
  123. package/src/parsebase64encodedobject.js +1 -1
  124. package/src/priorities.d.ts +1 -1
  125. package/src/priorities.js +1 -1
  126. package/src/retry.d.ts +1 -1
  127. package/src/retry.js +1 -1
  128. package/src/splicearray.d.ts +1 -1
  129. package/src/splicearray.js +1 -1
  130. package/src/spy.d.ts +1 -1
  131. package/src/spy.js +1 -1
  132. package/src/toarray.d.ts +1 -1
  133. package/src/toarray.js +1 -1
  134. package/src/tomap.d.ts +1 -1
  135. package/src/tomap.js +1 -1
  136. package/src/translation-service.d.ts +1 -1
  137. package/src/translation-service.js +1 -1
  138. package/src/uid.d.ts +1 -1
  139. package/src/uid.js +1 -1
  140. package/src/unicode.d.ts +1 -1
  141. package/src/unicode.js +1 -1
  142. package/src/version.d.ts +2 -2
  143. package/src/version.js +3 -3
  144. package/src/wait.d.ts +1 -1
  145. package/src/wait.js +1 -1
  146. package/dist/abortabledebounce.d.ts +0 -21
  147. package/dist/areconnectedthroughproperties.d.ts +0 -15
  148. package/dist/ckeditorerror.d.ts +0 -127
  149. package/dist/collection.d.ts +0 -437
  150. package/dist/comparearrays.d.ts +0 -34
  151. package/dist/config.d.ts +0 -167
  152. package/dist/count.d.ts +0 -22
  153. package/dist/crc32.d.ts +0 -30
  154. package/dist/delay.d.ts +0 -23
  155. package/dist/diff.d.ts +0 -35
  156. package/dist/difftochanges.d.ts +0 -63
  157. package/dist/dom/createelement.d.ts +0 -61
  158. package/dist/dom/emittermixin.d.ts +0 -146
  159. package/dist/dom/findclosestscrollableancestor.d.ts +0 -15
  160. package/dist/dom/getancestors.d.ts +0 -21
  161. package/dist/dom/getborderwidths.d.ts +0 -28
  162. package/dist/dom/getcommonancestor.d.ts +0 -16
  163. package/dist/dom/getdatafromelement.d.ts +0 -18
  164. package/dist/dom/getpositionedancestor.d.ts +0 -14
  165. package/dist/dom/getrangefrommouseevent.d.ts +0 -21
  166. package/dist/dom/global.d.ts +0 -36
  167. package/dist/dom/indexof.d.ts +0 -18
  168. package/dist/dom/insertat.d.ts +0 -19
  169. package/dist/dom/iscomment.d.ts +0 -15
  170. package/dist/dom/isnode.d.ts +0 -15
  171. package/dist/dom/isrange.d.ts +0 -15
  172. package/dist/dom/istext.d.ts +0 -15
  173. package/dist/dom/isvalidattributename.d.ts +0 -14
  174. package/dist/dom/isvisible.d.ts +0 -19
  175. package/dist/dom/iswindow.d.ts +0 -15
  176. package/dist/dom/position.d.ts +0 -215
  177. package/dist/dom/rect.d.ts +0 -199
  178. package/dist/dom/remove.d.ts +0 -17
  179. package/dist/dom/resizeobserver.d.ts +0 -78
  180. package/dist/dom/scroll.d.ts +0 -77
  181. package/dist/dom/setdatainelement.d.ts +0 -18
  182. package/dist/dom/tounit.d.ts +0 -26
  183. package/dist/elementreplacer.d.ts +0 -35
  184. package/dist/emittermixin.d.ts +0 -316
  185. package/dist/env.d.ts +0 -144
  186. package/dist/eventinfo.d.ts +0 -62
  187. package/dist/fastdiff.d.ts +0 -116
  188. package/dist/first.d.ts +0 -15
  189. package/dist/focustracker.d.ts +0 -144
  190. package/dist/index.d.ts +0 -70
  191. package/dist/inserttopriorityarray.d.ts +0 -34
  192. package/dist/isiterable.d.ts +0 -18
  193. package/dist/keyboard.d.ts +0 -130
  194. package/dist/keystrokehandler.d.ts +0 -101
  195. package/dist/language.d.ts +0 -21
  196. package/dist/locale.d.ts +0 -145
  197. package/dist/mapsequal.d.ts +0 -19
  198. package/dist/mix.d.ts +0 -89
  199. package/dist/nth.d.ts +0 -20
  200. package/dist/objecttomap.d.ts +0 -27
  201. package/dist/observablemixin.d.ts +0 -564
  202. package/dist/parsebase64encodedobject.d.ts +0 -15
  203. package/dist/priorities.d.ts +0 -37
  204. package/dist/retry.d.ts +0 -37
  205. package/dist/splicearray.d.ts +0 -31
  206. package/dist/spy.d.ts +0 -25
  207. package/dist/toarray.d.ts +0 -29
  208. package/dist/tomap.d.ts +0 -23
  209. package/dist/translation-service.d.ts +0 -178
  210. package/dist/uid.d.ts +0 -19
  211. package/dist/unicode.d.ts +0 -58
  212. package/dist/version.d.ts +0 -14
  213. package/dist/wait.d.ts +0 -20
package/dist/delay.d.ts DELETED
@@ -1,23 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/delay
11
- */
12
- /**
13
- * Returns a function wrapper that will trigger a function after a specified wait time.
14
- * The timeout can be canceled by calling the cancel function on the returned wrapped function.
15
- *
16
- * @param func The function to wrap.
17
- * @param wait The timeout in ms.
18
- */
19
- export default function delay<T extends (...args: Array<any>) => any>(func: T, wait: number): DelayedFunc<T>;
20
- export interface DelayedFunc<T extends (...args: Array<any>) => any> {
21
- (...args: Parameters<T>): void;
22
- cancel(): void;
23
- }
package/dist/diff.d.ts DELETED
@@ -1,35 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * Calculates the difference between two arrays or strings producing an array containing a list of changes
11
- * necessary to transform input into output.
12
- *
13
- * ```ts
14
- * diff( 'aba', 'acca' ); // [ 'equal', 'insert', 'insert', 'delete', 'equal' ]
15
- * ```
16
- *
17
- * This function is based on the "O(NP) Sequence Comparison Algorithm" by Sun Wu, Udi Manber, Gene Myers, Webb Miller.
18
- * Unfortunately, while it gives the most precise results, its to complex for longer strings/arrow (above 200 items).
19
- * Therefore, `diff()` automatically switches to {@link module:utils/fastdiff~fastDiff `fastDiff()`} when detecting
20
- * such a scenario. The return formats of both functions are identical.
21
- *
22
- * @param a Input array or string.
23
- * @param b Output array or string.
24
- * @param cmp Optional function used to compare array values, by default === is used.
25
- * @returns Array of changes.
26
- */
27
- declare function diff<T>(a: ArrayLike<T>, b: ArrayLike<T>, cmp?: (a: T, b: T) => boolean): Array<DiffResult>;
28
- declare namespace diff {
29
- var fastDiff: typeof import("./fastdiff.js").default;
30
- }
31
- export default diff;
32
- /**
33
- * The element of the result of {@link module:utils/diff~diff} function.
34
- */
35
- export type DiffResult = 'equal' | 'insert' | 'delete';
@@ -1,63 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- import type { DiffResult } from './diff.js';
10
- /**
11
- * @module utils/difftochanges
12
- */
13
- /**
14
- * Creates a set of changes which need to be applied to the input in order to transform
15
- * it into the output. This function can be used with strings or arrays.
16
- *
17
- * ```ts
18
- * const input = Array.from( 'abc' );
19
- * const output = Array.from( 'xaby' );
20
- * const changes = diffToChanges( diff( input, output ), output );
21
- *
22
- * changes.forEach( change => {
23
- * if ( change.type == 'insert' ) {
24
- * input.splice( change.index, 0, ...change.values );
25
- * } else if ( change.type == 'delete' ) {
26
- * input.splice( change.index, change.howMany );
27
- * }
28
- * } );
29
- *
30
- * input.join( '' ) == output.join( '' ); // -> true
31
- * ```
32
- *
33
- * @typeParam T The type of output array element.
34
- * @param diff Result of {@link module:utils/diff~diff}.
35
- * @param output The string or array which was passed as diff's output.
36
- * @returns Set of changes (insert or delete) which need to be applied to the input
37
- * in order to transform it into the output.
38
- */
39
- export default function diffToChanges<T>(diff: ReadonlyArray<DiffResult>, output: ArrayLike<T>): Array<Change<T>>;
40
- /**
41
- * An object describing insertion change.
42
- *
43
- * @typeParam T The type of output array element.
44
- */
45
- export interface InsertChange<T> {
46
- type: 'insert';
47
- index: number;
48
- values: Array<T>;
49
- }
50
- /**
51
- * An object describing deletion change.
52
- */
53
- export interface DeleteChange {
54
- type: 'delete';
55
- index: number;
56
- howMany: number;
57
- }
58
- /**
59
- * The element of the result of {@link module:utils/difftochanges~diffToChanges} function.
60
- *
61
- * @typeParam T The type of output array element.
62
- */
63
- export type Change<T> = InsertChange<T> | DeleteChange;
@@ -1,61 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * Attributes to be applied to the HTML element.
11
- */
12
- type HTMLElementAttributes = {
13
- readonly [key: string]: string;
14
- };
15
- /**
16
- * Attributes to be applied to the SVG element.
17
- */
18
- type SVGElementAttributes = HTMLElementAttributes & {
19
- xmlns: string;
20
- };
21
- /**
22
- * Element or elements that will be added to the created element as children. Strings will be automatically turned into Text nodes.
23
- */
24
- type ChildrenElements = Node | string | Iterable<Node | string>;
25
- /**
26
- * Creates an SVG element with attributes and children elements.
27
- *
28
- * ```ts
29
- * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' } ); // <mask>
30
- * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg', id: 'foo' } ); // <mask id="foo">
31
- * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' }, 'foo' ); // <mask>foo</mask>
32
- * createElement( document, 'mask', { xmlns: 'http://www.w3.org/2000/svg' }, [ createElement(...) ] ); // <mask><...></mask>
33
- * ```
34
- *
35
- * @label SVG_ELEMENT
36
- * @param doc Document used to create the element.
37
- * @param name Name of the SVG element.
38
- * @param attributes Object where keys represent attribute keys and values represent attribute values.
39
- * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
40
- * @returns SVG element.
41
- */
42
- export default function createElement<T extends keyof SVGElementTagNameMap>(doc: Document, name: T, attributes: SVGElementAttributes, children?: ChildrenElements): SVGElementTagNameMap[T];
43
- /**
44
- * Creates an HTML element with attributes and children elements.
45
- *
46
- * ```ts
47
- * createElement( document, 'p' ); // <p>
48
- * createElement( document, 'p', { class: 'foo' } ); // <p class="foo">
49
- * createElement( document, 'p', null, 'foo' ); // <p>foo</p>
50
- * createElement( document, 'p', null, [ createElement(...) ] ); // <p><...></p>
51
- * ```
52
- *
53
- * @label HTML_ELEMENT
54
- * @param doc Document used to create the element.
55
- * @param name Name of the HTML element.
56
- * @param attributes Object where keys represent attribute keys and values represent attribute values.
57
- * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
58
- * @returns HTML element.
59
- */
60
- export default function createElement<T extends keyof HTMLElementTagNameMap>(doc: Document, name: T, attributes?: HTMLElementAttributes, children?: ChildrenElements): HTMLElementTagNameMap[T];
61
- export {};
@@ -1,146 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/emittermixin
11
- */
12
- import { type Emitter, type CallbackOptions, type BaseEvent, type GetCallback } from '../emittermixin.js';
13
- import type EventInfo from '../eventinfo.js';
14
- import type { Constructor, Mixed } from '../mix.js';
15
- /**
16
- * Mixin that injects the DOM events API into its host. It provides the API
17
- * compatible with {@link module:utils/emittermixin~Emitter}.
18
- *
19
- * This function creates a class that inherits from the provided `base` and implements `Emitter` interface.
20
- *
21
- * DOM emitter mixin is by default available in the {@link module:ui/view~View} class,
22
- * but it can also be mixed into any other class:
23
- *
24
- * ```ts
25
- * import DomEmitterMixin from '../utils/dom/emittermixin.js';
26
- *
27
- * class BaseClass { ... }
28
- *
29
- * class SomeView extends DomEmitterMixin( BaseClass ) {}
30
- *
31
- * const view = new SomeView();
32
- * view.listenTo( domElement, ( evt, domEvt ) => {
33
- * console.log( evt, domEvt );
34
- * } );
35
- * ```
36
- *
37
- * @label EXTENDS
38
- */
39
- export default function DomEmitterMixin<Base extends Constructor<Emitter>>(base: Base): Mixed<Base, DomEmitter>;
40
- /**
41
- * Mixin that injects the DOM events API into its host. It provides the API
42
- * compatible with {@link module:utils/emittermixin~Emitter}.
43
- *
44
- * This function creates a class that implements `Emitter` interface.
45
- *
46
- * DOM emitter mixin is by default available in the {@link module:ui/view~View} class,
47
- * but it can also be mixed into any other class:
48
- *
49
- * ```ts
50
- * import DomEmitterMixin from '../utils/dom/emittermixin.js';
51
- *
52
- * class SomeView extends DomEmitterMixin() {}
53
- *
54
- * const view = new SomeView();
55
- * view.listenTo( domElement, ( evt, domEvt ) => {
56
- * console.log( evt, domEvt );
57
- * } );
58
- * ```
59
- *
60
- * @label NO_ARGUMENTS
61
- */
62
- export default function DomEmitterMixin(): {
63
- new (): DomEmitter;
64
- prototype: DomEmitter;
65
- };
66
- export interface DomEventMap extends HTMLElementEventMap, WindowEventMap {
67
- }
68
- /**
69
- * Interface representing classes which mix in {@link module:utils/dom/emittermixin~DomEmitterMixin}.
70
- *
71
- * Can be easily implemented by a class by mixing the {@link module:utils/dom/emittermixin~DomEmitterMixin} mixin.
72
- *
73
- * ```ts
74
- * class MyClass extends DomEmitterMixin( OtherBaseClass ) {
75
- * // This class now implements the `Emitter` interface.
76
- * }
77
- * ```
78
- */
79
- export interface DomEmitter extends Emitter {
80
- /**
81
- * Registers a callback function to be executed when an event is fired in a specific Emitter or DOM Node.
82
- * It is backwards compatible with {@link module:utils/emittermixin~Emitter#listenTo}.
83
- *
84
- * @label HTML_EMITTER
85
- * @param emitter The object that fires the event.
86
- * @param event The name of the event.
87
- * @param callback The function to be called on event.
88
- * @param options Additional options.
89
- * @param options.useCapture Indicates that events of this type will be dispatched to the registered
90
- * listener before being dispatched to any EventTarget beneath it in the DOM tree.
91
- * @param options.usePassive Indicates that the function specified by listener will never call preventDefault()
92
- * and prevents blocking browser's main thread by this event handler.
93
- */
94
- listenTo<K extends keyof DomEventMap>(emitter: Node | Window, event: K, callback: (this: this, ev: EventInfo, event: DomEventMap[K]) => void, options?: CallbackOptions & {
95
- readonly useCapture?: boolean;
96
- readonly usePassive?: boolean;
97
- }): void;
98
- /**
99
- * Registers a callback function to be executed when an event is fired in a specific (emitter) object.
100
- *
101
- * Events can be grouped in namespaces using `:`.
102
- * When namespaced event is fired, it additionally fires all callbacks for that namespace.
103
- *
104
- * ```ts
105
- * // myEmitter.on( ... ) is a shorthand for myEmitter.listenTo( myEmitter, ... ).
106
- * myEmitter.on( 'myGroup', genericCallback );
107
- * myEmitter.on( 'myGroup:myEvent', specificCallback );
108
- *
109
- * // genericCallback is fired.
110
- * myEmitter.fire( 'myGroup' );
111
- * // both genericCallback and specificCallback are fired.
112
- * myEmitter.fire( 'myGroup:myEvent' );
113
- * // genericCallback is fired even though there are no callbacks for "foo".
114
- * myEmitter.fire( 'myGroup:foo' );
115
- * ```
116
- *
117
- * An event callback can {@link module:utils/eventinfo~EventInfo#stop stop the event} and
118
- * set the {@link module:utils/eventinfo~EventInfo#return return value} of the {@link #fire} method.
119
- *
120
- * @label DOM_EMITTER
121
- * @typeParam TEvent The type describing the event. See {@link module:utils/emittermixin~BaseEvent}.
122
- * @param emitter The object that fires the event.
123
- * @param event The name of the event.
124
- * @param callback The function to be called on event.
125
- * @param options Additional options.
126
- */
127
- listenTo<TEvent extends BaseEvent>(emitter: Emitter, event: TEvent['name'], callback: GetCallback<TEvent>, options?: CallbackOptions): void;
128
- /**
129
- * Stops listening for events. It can be used at different levels:
130
- * It is backwards compatible with {@link module:utils/emittermixin~Emitter#listenTo}.
131
- *
132
- * * To stop listening to a specific callback.
133
- * * To stop listening to a specific event.
134
- * * To stop listening to all events fired by a specific object.
135
- * * To stop listening to all events fired by all objects.
136
- *
137
- * @label DOM_STOP
138
- * @param emitter The object to stop listening to.
139
- * If omitted, stops it for all objects.
140
- * @param event (Requires the `emitter`) The name of the event to stop listening to. If omitted, stops it
141
- * for all events from `emitter`.
142
- * @param callback (Requires the `event`) The function to be removed from the call list for the given
143
- * `event`.
144
- */
145
- stopListening(emitter?: Emitter | Node | Window, event?: string, callback?: Function): void;
146
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * Returns the closest scrollable ancestor of a DOM element.
11
- *
12
- * @param domElement DOM element.
13
- * @returns First ancestor of `domElement` that is scrollable or null if such ancestor doesn't exist.
14
- */
15
- export default function findClosestScrollableAncestor(domElement: HTMLElement): HTMLElement | null;
@@ -1,21 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/getancestors
11
- */
12
- /**
13
- * Returns all ancestors of given DOM node, starting from the top-most (root). Includes the given node itself. If the
14
- * node is a part of `DocumentFragment` that `DocumentFragment` will be returned. In contrary, if the node is
15
- * appended to a `Document`, that `Document` will not be returned (algorithms operating on DOM tree care for `Document#documentElement`
16
- * at most, which will be returned).
17
- *
18
- * @param node DOM node.
19
- * @returns Array of given `node` parents.
20
- */
21
- export default function getAncestors(node: Node): Array<Node>;
@@ -1,28 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/getborderwidths
11
- */
12
- /**
13
- * Returns an object containing CSS border widths of a specified HTML element.
14
- *
15
- * @param element An element which has CSS borders.
16
- * @returns An object containing `top`, `left`, `right` and `bottom` properties
17
- * with numerical values of the `border-[top,left,right,bottom]-width` CSS styles.
18
- */
19
- export default function getBorderWidths(element: HTMLElement): BorderWidths;
20
- /**
21
- * An object describing widths of `HTMLElement` borders.
22
- */
23
- export interface BorderWidths {
24
- top: number;
25
- right: number;
26
- bottom: number;
27
- left: number;
28
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * Searches and returns the lowest common ancestor of two given nodes.
11
- *
12
- * @param nodeA First node.
13
- * @param nodeB Second node.
14
- * @returns Lowest common ancestor of both nodes or `null` if nodes do not have a common ancestor.
15
- */
16
- export default function getCommonAncestor(nodeA: Node, nodeB: Node): Node | null;
@@ -1,18 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/getdatafromelement
11
- */
12
- /**
13
- * Gets data from a given source element.
14
- *
15
- * @param el The element from which the data will be retrieved.
16
- * @returns The data string.
17
- */
18
- export default function getDataFromElement(el: HTMLElement): string;
@@ -1,14 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * For a given element, returns the nearest ancestor element which CSS position is not "static".
11
- *
12
- * @param element The native DOM element to be checked.
13
- */
14
- export default function getPositionedAncestor(element?: HTMLElement): HTMLElement | null;
@@ -1,21 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/getrangefrommouseevent
11
- */
12
- /**
13
- * Returns a DOM range from a given point specified by a mouse event.
14
- *
15
- * @param domEvent The mouse event.
16
- * @returns The DOM range.
17
- */
18
- export default function getRangeFromMouseEvent(domEvent: MouseEvent & {
19
- rangeParent?: HTMLElement;
20
- rangeOffset?: number;
21
- }): Range | null;
@@ -1,36 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/global
11
- */
12
- /**
13
- * A helper (module) giving an access to the global DOM objects such as `window` and `document`.
14
- */
15
- export interface GlobalType {
16
- readonly window: Window & typeof globalThis;
17
- readonly document: Document;
18
- }
19
- /**
20
- * A helper (module) giving an access to the global DOM objects such as `window` and
21
- * `document`. Accessing these objects using this helper allows easy and bulletproof
22
- * testing, i.e. stubbing native properties:
23
- *
24
- * ```ts
25
- * import { global } from 'ckeditor5/utils';
26
- *
27
- * // This stub will work for any code using global module.
28
- * testUtils.sinon.stub( global, 'window', {
29
- * innerWidth: 10000
30
- * } );
31
- *
32
- * console.log( global.window.innerWidth );
33
- * ```
34
- */
35
- declare let globalVar: GlobalType;
36
- export default globalVar;
@@ -1,18 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/indexof
11
- */
12
- /**
13
- * Returns index of the node in the parent element.
14
- *
15
- * @param node Node which index is tested.
16
- * @returns Index of the node in the parent element. Returns 0 if node has no parent.
17
- */
18
- export default function indexOf(node: Node): number;
@@ -1,19 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/insertat
11
- */
12
- /**
13
- * Inserts node to the parent at given index.
14
- *
15
- * @param parentElement Parent element.
16
- * @param index Insertions index.
17
- * @param nodeToInsert Node to insert.
18
- */
19
- export default function insertAt(parentElement: Element, index: number, nodeToInsert: Node): void;
@@ -1,15 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/iscomment
11
- */
12
- /**
13
- * Checks whether the object is a native DOM Comment node.
14
- */
15
- export default function isComment(obj: any): obj is Comment;
@@ -1,15 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/isnode
11
- */
12
- /**
13
- * Checks if the object is a native DOM Node.
14
- */
15
- export default function isNode(obj: any): obj is Node;
@@ -1,15 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/isrange
11
- */
12
- /**
13
- * Checks if the object is a native DOM Range.
14
- */
15
- export default function isRange(obj: unknown): obj is Range;
@@ -1,15 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module utils/dom/istext
11
- */
12
- /**
13
- * Checks if the object is a native DOM Text node.
14
- */
15
- export default function isText(obj: unknown): obj is Text;
@@ -1,14 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * Checks if the given attribute name is valid in terms of HTML.
11
- *
12
- * @param name Attribute name.
13
- */
14
- export default function isValidAttributeName(name: string): boolean;
@@ -1,19 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * Checks whether the element is visible to the user in DOM:
11
- *
12
- * * connected to the root of the document,
13
- * * has no `display: none`,
14
- * * has no ancestors with `display: none`.
15
- *
16
- * **Note**: This helper does not check whether the element is hidden by cropping, overflow, etc..
17
- * To check that, use {@link module:utils/dom/rect~Rect} instead.
18
- */
19
- export default function isVisible(element: Text | HTMLElement | null | undefined): boolean;