@ckeditor/ckeditor5-utils 40.0.0 → 40.2.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 (135) hide show
  1. package/CHANGELOG.md +26 -26
  2. package/LICENSE.md +3 -3
  3. package/package.json +1 -1
  4. package/src/abortabledebounce.d.ts +17 -0
  5. package/src/abortabledebounce.js +22 -0
  6. package/src/areconnectedthroughproperties.d.ts +11 -11
  7. package/src/areconnectedthroughproperties.js +73 -73
  8. package/src/ckeditorerror.d.ts +123 -123
  9. package/src/ckeditorerror.js +176 -176
  10. package/src/collection.d.ts +433 -427
  11. package/src/collection.js +583 -575
  12. package/src/comparearrays.d.ts +30 -30
  13. package/src/comparearrays.js +47 -47
  14. package/src/config.d.ts +163 -163
  15. package/src/config.js +163 -162
  16. package/src/count.d.ts +18 -18
  17. package/src/count.js +24 -24
  18. package/src/delay.d.ts +19 -19
  19. package/src/delay.js +26 -26
  20. package/src/diff.d.ts +31 -31
  21. package/src/diff.js +115 -115
  22. package/src/difftochanges.d.ts +59 -59
  23. package/src/difftochanges.js +79 -79
  24. package/src/dom/createelement.d.ts +57 -57
  25. package/src/dom/createelement.js +40 -40
  26. package/src/dom/emittermixin.d.ts +142 -142
  27. package/src/dom/emittermixin.js +239 -239
  28. package/src/dom/findclosestscrollableancestor.d.ts +11 -11
  29. package/src/dom/findclosestscrollableancestor.js +31 -31
  30. package/src/dom/getancestors.d.ts +17 -17
  31. package/src/dom/getancestors.js +27 -27
  32. package/src/dom/getborderwidths.d.ts +24 -24
  33. package/src/dom/getborderwidths.js +24 -24
  34. package/src/dom/getcommonancestor.d.ts +12 -12
  35. package/src/dom/getcommonancestor.js +25 -25
  36. package/src/dom/getdatafromelement.d.ts +14 -14
  37. package/src/dom/getdatafromelement.js +20 -20
  38. package/src/dom/getpositionedancestor.d.ts +10 -10
  39. package/src/dom/getpositionedancestor.js +22 -22
  40. package/src/dom/global.d.ts +32 -32
  41. package/src/dom/global.js +35 -35
  42. package/src/dom/indexof.d.ts +14 -14
  43. package/src/dom/indexof.js +21 -21
  44. package/src/dom/insertat.d.ts +15 -15
  45. package/src/dom/insertat.js +17 -17
  46. package/src/dom/iscomment.d.ts +11 -11
  47. package/src/dom/iscomment.js +14 -14
  48. package/src/dom/isnode.d.ts +11 -11
  49. package/src/dom/isnode.js +21 -21
  50. package/src/dom/isrange.d.ts +11 -11
  51. package/src/dom/isrange.js +13 -13
  52. package/src/dom/istext.d.ts +11 -11
  53. package/src/dom/istext.js +13 -13
  54. package/src/dom/isvalidattributename.d.ts +10 -10
  55. package/src/dom/isvalidattributename.js +22 -22
  56. package/src/dom/isvisible.d.ts +18 -18
  57. package/src/dom/isvisible.js +20 -20
  58. package/src/dom/iswindow.d.ts +11 -11
  59. package/src/dom/iswindow.js +22 -22
  60. package/src/dom/position.d.ts +211 -211
  61. package/src/dom/position.js +313 -313
  62. package/src/dom/rect.d.ts +195 -195
  63. package/src/dom/rect.js +474 -474
  64. package/src/dom/remove.d.ts +13 -13
  65. package/src/dom/remove.js +18 -18
  66. package/src/dom/resizeobserver.d.ts +74 -74
  67. package/src/dom/resizeobserver.js +126 -126
  68. package/src/dom/scroll.d.ts +73 -73
  69. package/src/dom/scroll.js +383 -383
  70. package/src/dom/setdatainelement.d.ts +14 -14
  71. package/src/dom/setdatainelement.js +20 -20
  72. package/src/dom/tounit.d.ts +22 -22
  73. package/src/dom/tounit.js +16 -16
  74. package/src/elementreplacer.d.ts +31 -31
  75. package/src/elementreplacer.js +43 -43
  76. package/src/emittermixin.d.ts +312 -312
  77. package/src/emittermixin.js +453 -453
  78. package/src/env.d.ts +117 -117
  79. package/src/env.js +122 -122
  80. package/src/eventinfo.d.ts +58 -58
  81. package/src/eventinfo.js +26 -26
  82. package/src/fastdiff.d.ts +112 -112
  83. package/src/fastdiff.js +248 -248
  84. package/src/first.d.ts +11 -11
  85. package/src/first.js +17 -17
  86. package/src/focustracker.d.ts +75 -75
  87. package/src/focustracker.js +95 -95
  88. package/src/index.d.ts +64 -61
  89. package/src/index.js +63 -60
  90. package/src/inserttopriorityarray.d.ts +30 -30
  91. package/src/inserttopriorityarray.js +21 -21
  92. package/src/isiterable.d.ts +14 -14
  93. package/src/isiterable.js +16 -16
  94. package/src/keyboard.d.ts +126 -126
  95. package/src/keyboard.js +221 -221
  96. package/src/keystrokehandler.d.ts +87 -87
  97. package/src/keystrokehandler.js +122 -122
  98. package/src/language.d.ts +17 -17
  99. package/src/language.js +19 -19
  100. package/src/locale.d.ts +120 -120
  101. package/src/locale.js +76 -76
  102. package/src/mapsequal.d.ts +15 -15
  103. package/src/mapsequal.js +27 -27
  104. package/src/mix.d.ts +85 -85
  105. package/src/mix.js +50 -50
  106. package/src/nth.d.ts +16 -16
  107. package/src/nth.js +24 -24
  108. package/src/objecttomap.d.ts +23 -23
  109. package/src/objecttomap.js +27 -27
  110. package/src/observablemixin.d.ts +560 -560
  111. package/src/observablemixin.js +580 -580
  112. package/src/priorities.d.ts +33 -33
  113. package/src/priorities.js +23 -23
  114. package/src/retry.d.ts +33 -0
  115. package/src/retry.js +47 -0
  116. package/src/splicearray.d.ts +26 -26
  117. package/src/splicearray.js +40 -40
  118. package/src/spy.d.ts +21 -21
  119. package/src/spy.js +22 -22
  120. package/src/toarray.d.ts +25 -25
  121. package/src/toarray.js +7 -7
  122. package/src/tomap.d.ts +19 -19
  123. package/src/tomap.js +29 -29
  124. package/src/translation-service.d.ts +168 -168
  125. package/src/translation-service.js +198 -198
  126. package/src/uid.d.ts +15 -15
  127. package/src/uid.js +57 -57
  128. package/src/unicode.d.ts +54 -54
  129. package/src/unicode.js +85 -85
  130. package/src/verifylicense.d.ts +15 -15
  131. package/src/verifylicense.js +87 -87
  132. package/src/version.d.ts +10 -10
  133. package/src/version.js +153 -153
  134. package/src/wait.d.ts +16 -0
  135. package/src/wait.js +29 -0
package/src/dom/rect.d.ts CHANGED
@@ -1,195 +1,195 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- * A helper class representing a `ClientRect` object, e.g. value returned by
7
- * the native `object.getBoundingClientRect()` method. Provides a set of methods
8
- * to manipulate the rect and compare it against other rect instances.
9
- */
10
- export default class Rect {
11
- /**
12
- * The "top" value of the rect.
13
- *
14
- * @readonly
15
- */
16
- top: number;
17
- /**
18
- * The "right" value of the rect.
19
- *
20
- * @readonly
21
- */
22
- right: number;
23
- /**
24
- * The "bottom" value of the rect.
25
- *
26
- * @readonly
27
- */
28
- bottom: number;
29
- /**
30
- * The "left" value of the rect.
31
- *
32
- * @readonly
33
- */
34
- left: number;
35
- /**
36
- * The "width" value of the rect.
37
- *
38
- * @readonly
39
- */
40
- width: number;
41
- /**
42
- * The "height" value of the rect.
43
- *
44
- * @readonly
45
- */
46
- height: number;
47
- /**
48
- * The object this rect is for.
49
- *
50
- * @readonly
51
- */
52
- private _source;
53
- /**
54
- * Creates an instance of rect.
55
- *
56
- * ```ts
57
- * // Rect of an HTMLElement.
58
- * const rectA = new Rect( document.body );
59
- *
60
- * // Rect of a DOM Range.
61
- * const rectB = new Rect( document.getSelection().getRangeAt( 0 ) );
62
- *
63
- * // Rect of a window (web browser viewport).
64
- * const rectC = new Rect( window );
65
- *
66
- * // Rect out of an object.
67
- * const rectD = new Rect( { top: 0, right: 10, bottom: 10, left: 0, width: 10, height: 10 } );
68
- *
69
- * // Rect out of another Rect instance.
70
- * const rectE = new Rect( rectD );
71
- *
72
- * // Rect out of a ClientRect.
73
- * const rectF = new Rect( document.body.getClientRects().item( 0 ) );
74
- * ```
75
- *
76
- * **Note**: By default a rect of an HTML element includes its CSS borders and scrollbars (if any)
77
- * ant the rect of a `window` includes scrollbars too. Use {@link #excludeScrollbarsAndBorders}
78
- * to get the inner part of the rect.
79
- *
80
- * @param source A source object to create the rect.
81
- */
82
- constructor(source: RectSource);
83
- /**
84
- * Returns a clone of the rect.
85
- *
86
- * @returns A cloned rect.
87
- */
88
- clone(): Rect;
89
- /**
90
- * Moves the rect so that its upper–left corner lands in desired `[ x, y ]` location.
91
- *
92
- * @param x Desired horizontal location.
93
- * @param y Desired vertical location.
94
- * @returns A rect which has been moved.
95
- */
96
- moveTo(x: number, y: number): this;
97
- /**
98
- * Moves the rect in–place by a dedicated offset.
99
- *
100
- * @param x A horizontal offset.
101
- * @param y A vertical offset
102
- * @returns A rect which has been moved.
103
- */
104
- moveBy(x: number, y: number): this;
105
- /**
106
- * Returns a new rect a a result of intersection with another rect.
107
- */
108
- getIntersection(anotherRect: Rect): Rect | null;
109
- /**
110
- * Returns the area of intersection with another rect.
111
- *
112
- * @returns Area of intersection.
113
- */
114
- getIntersectionArea(anotherRect: Rect): number;
115
- /**
116
- * Returns the area of the rect.
117
- */
118
- getArea(): number;
119
- /**
120
- * Returns a new rect, a part of the original rect, which is actually visible to the user and is relative to the,`body`,
121
- * e.g. an original rect cropped by parent element rects which have `overflow` set in CSS
122
- * other than `"visible"`.
123
- *
124
- * If there's no such visible rect, which is when the rect is limited by one or many of
125
- * the ancestors, `null` is returned.
126
- *
127
- * **Note**: This method does not consider the boundaries of the viewport (window).
128
- * To get a rect cropped by all ancestors and the viewport, use an intersection such as:
129
- *
130
- * ```ts
131
- * const visibleInViewportRect = new Rect( window ).getIntersection( new Rect( source ).getVisible() );
132
- * ```
133
- *
134
- * @returns A visible rect instance or `null`, if there's none.
135
- */
136
- getVisible(): Rect | null;
137
- /**
138
- * Checks if all property values ({@link #top}, {@link #left}, {@link #right},
139
- * {@link #bottom}, {@link #width} and {@link #height}) are the equal in both rect
140
- * instances.
141
- *
142
- * @param anotherRect A rect instance to compare with.
143
- * @returns `true` when Rects are equal. `false` otherwise.
144
- */
145
- isEqual(anotherRect: Rect): boolean;
146
- /**
147
- * Checks whether a rect fully contains another rect instance.
148
- *
149
- * @param anotherRect
150
- * @returns `true` if contains, `false` otherwise.
151
- */
152
- contains(anotherRect: Rect): boolean;
153
- /**
154
- * Recalculates screen coordinates to coordinates relative to the positioned ancestor offset.
155
- */
156
- toAbsoluteRect(): Rect;
157
- /**
158
- * Excludes scrollbars and CSS borders from the rect.
159
- *
160
- * * Borders are removed when {@link #_source} is an HTML element.
161
- * * Scrollbars are excluded from HTML elements and the `window`.
162
- *
163
- * @returns A rect which has been updated.
164
- */
165
- excludeScrollbarsAndBorders(): this;
166
- /**
167
- * Returns an array of rects of the given native DOM Range.
168
- *
169
- * @param range A native DOM range.
170
- * @returns DOM Range rects.
171
- */
172
- static getDomRangeRects(range: Range): Array<Rect>;
173
- /**
174
- * Returns a bounding rectangle that contains all the given `rects`.
175
- *
176
- * @param rects A list of rectangles that should be contained in the result rectangle.
177
- * @returns Bounding rectangle or `null` if no `rects` were given.
178
- */
179
- static getBoundingRect(rects: Iterable<Rect>): Rect | null;
180
- }
181
- /**
182
- * A source of {@link module:utils/dom/rect~Rect}.
183
- */
184
- export type RectSource = HTMLElement | Range | Window | RectLike;
185
- /**
186
- * An object that describes properties of `ClientRect` object.
187
- */
188
- export interface RectLike {
189
- readonly top: number;
190
- readonly right: number;
191
- readonly bottom: number;
192
- readonly left: number;
193
- readonly width: number;
194
- readonly height: number;
195
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * A helper class representing a `ClientRect` object, e.g. value returned by
7
+ * the native `object.getBoundingClientRect()` method. Provides a set of methods
8
+ * to manipulate the rect and compare it against other rect instances.
9
+ */
10
+ export default class Rect {
11
+ /**
12
+ * The "top" value of the rect.
13
+ *
14
+ * @readonly
15
+ */
16
+ top: number;
17
+ /**
18
+ * The "right" value of the rect.
19
+ *
20
+ * @readonly
21
+ */
22
+ right: number;
23
+ /**
24
+ * The "bottom" value of the rect.
25
+ *
26
+ * @readonly
27
+ */
28
+ bottom: number;
29
+ /**
30
+ * The "left" value of the rect.
31
+ *
32
+ * @readonly
33
+ */
34
+ left: number;
35
+ /**
36
+ * The "width" value of the rect.
37
+ *
38
+ * @readonly
39
+ */
40
+ width: number;
41
+ /**
42
+ * The "height" value of the rect.
43
+ *
44
+ * @readonly
45
+ */
46
+ height: number;
47
+ /**
48
+ * The object this rect is for.
49
+ *
50
+ * @readonly
51
+ */
52
+ private _source;
53
+ /**
54
+ * Creates an instance of rect.
55
+ *
56
+ * ```ts
57
+ * // Rect of an HTMLElement.
58
+ * const rectA = new Rect( document.body );
59
+ *
60
+ * // Rect of a DOM Range.
61
+ * const rectB = new Rect( document.getSelection().getRangeAt( 0 ) );
62
+ *
63
+ * // Rect of a window (web browser viewport).
64
+ * const rectC = new Rect( window );
65
+ *
66
+ * // Rect out of an object.
67
+ * const rectD = new Rect( { top: 0, right: 10, bottom: 10, left: 0, width: 10, height: 10 } );
68
+ *
69
+ * // Rect out of another Rect instance.
70
+ * const rectE = new Rect( rectD );
71
+ *
72
+ * // Rect out of a ClientRect.
73
+ * const rectF = new Rect( document.body.getClientRects().item( 0 ) );
74
+ * ```
75
+ *
76
+ * **Note**: By default a rect of an HTML element includes its CSS borders and scrollbars (if any)
77
+ * ant the rect of a `window` includes scrollbars too. Use {@link #excludeScrollbarsAndBorders}
78
+ * to get the inner part of the rect.
79
+ *
80
+ * @param source A source object to create the rect.
81
+ */
82
+ constructor(source: RectSource);
83
+ /**
84
+ * Returns a clone of the rect.
85
+ *
86
+ * @returns A cloned rect.
87
+ */
88
+ clone(): Rect;
89
+ /**
90
+ * Moves the rect so that its upper–left corner lands in desired `[ x, y ]` location.
91
+ *
92
+ * @param x Desired horizontal location.
93
+ * @param y Desired vertical location.
94
+ * @returns A rect which has been moved.
95
+ */
96
+ moveTo(x: number, y: number): this;
97
+ /**
98
+ * Moves the rect in–place by a dedicated offset.
99
+ *
100
+ * @param x A horizontal offset.
101
+ * @param y A vertical offset
102
+ * @returns A rect which has been moved.
103
+ */
104
+ moveBy(x: number, y: number): this;
105
+ /**
106
+ * Returns a new rect a a result of intersection with another rect.
107
+ */
108
+ getIntersection(anotherRect: Rect): Rect | null;
109
+ /**
110
+ * Returns the area of intersection with another rect.
111
+ *
112
+ * @returns Area of intersection.
113
+ */
114
+ getIntersectionArea(anotherRect: Rect): number;
115
+ /**
116
+ * Returns the area of the rect.
117
+ */
118
+ getArea(): number;
119
+ /**
120
+ * Returns a new rect, a part of the original rect, which is actually visible to the user and is relative to the,`body`,
121
+ * e.g. an original rect cropped by parent element rects which have `overflow` set in CSS
122
+ * other than `"visible"`.
123
+ *
124
+ * If there's no such visible rect, which is when the rect is limited by one or many of
125
+ * the ancestors, `null` is returned.
126
+ *
127
+ * **Note**: This method does not consider the boundaries of the viewport (window).
128
+ * To get a rect cropped by all ancestors and the viewport, use an intersection such as:
129
+ *
130
+ * ```ts
131
+ * const visibleInViewportRect = new Rect( window ).getIntersection( new Rect( source ).getVisible() );
132
+ * ```
133
+ *
134
+ * @returns A visible rect instance or `null`, if there's none.
135
+ */
136
+ getVisible(): Rect | null;
137
+ /**
138
+ * Checks if all property values ({@link #top}, {@link #left}, {@link #right},
139
+ * {@link #bottom}, {@link #width} and {@link #height}) are the equal in both rect
140
+ * instances.
141
+ *
142
+ * @param anotherRect A rect instance to compare with.
143
+ * @returns `true` when Rects are equal. `false` otherwise.
144
+ */
145
+ isEqual(anotherRect: Rect): boolean;
146
+ /**
147
+ * Checks whether a rect fully contains another rect instance.
148
+ *
149
+ * @param anotherRect
150
+ * @returns `true` if contains, `false` otherwise.
151
+ */
152
+ contains(anotherRect: Rect): boolean;
153
+ /**
154
+ * Recalculates screen coordinates to coordinates relative to the positioned ancestor offset.
155
+ */
156
+ toAbsoluteRect(): Rect;
157
+ /**
158
+ * Excludes scrollbars and CSS borders from the rect.
159
+ *
160
+ * * Borders are removed when {@link #_source} is an HTML element.
161
+ * * Scrollbars are excluded from HTML elements and the `window`.
162
+ *
163
+ * @returns A rect which has been updated.
164
+ */
165
+ excludeScrollbarsAndBorders(): this;
166
+ /**
167
+ * Returns an array of rects of the given native DOM Range.
168
+ *
169
+ * @param range A native DOM range.
170
+ * @returns DOM Range rects.
171
+ */
172
+ static getDomRangeRects(range: Range): Array<Rect>;
173
+ /**
174
+ * Returns a bounding rectangle that contains all the given `rects`.
175
+ *
176
+ * @param rects A list of rectangles that should be contained in the result rectangle.
177
+ * @returns Bounding rectangle or `null` if no `rects` were given.
178
+ */
179
+ static getBoundingRect(rects: Iterable<Rect>): Rect | null;
180
+ }
181
+ /**
182
+ * A source of {@link module:utils/dom/rect~Rect}.
183
+ */
184
+ export type RectSource = HTMLElement | Range | Window | RectLike;
185
+ /**
186
+ * An object that describes properties of `ClientRect` object.
187
+ */
188
+ export interface RectLike {
189
+ readonly top: number;
190
+ readonly right: number;
191
+ readonly bottom: number;
192
+ readonly left: number;
193
+ readonly width: number;
194
+ readonly height: number;
195
+ }