@ckeditor/ckeditor5-utils 40.0.0 → 40.1.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 (128) hide show
  1. package/LICENSE.md +3 -3
  2. package/package.json +1 -1
  3. package/src/areconnectedthroughproperties.d.ts +11 -11
  4. package/src/areconnectedthroughproperties.js +73 -73
  5. package/src/ckeditorerror.d.ts +123 -123
  6. package/src/ckeditorerror.js +176 -176
  7. package/src/collection.d.ts +433 -427
  8. package/src/collection.js +583 -575
  9. package/src/comparearrays.d.ts +30 -30
  10. package/src/comparearrays.js +47 -47
  11. package/src/config.d.ts +163 -163
  12. package/src/config.js +163 -162
  13. package/src/count.d.ts +18 -18
  14. package/src/count.js +24 -24
  15. package/src/delay.d.ts +19 -19
  16. package/src/delay.js +26 -26
  17. package/src/diff.d.ts +31 -31
  18. package/src/diff.js +115 -115
  19. package/src/difftochanges.d.ts +59 -59
  20. package/src/difftochanges.js +79 -79
  21. package/src/dom/createelement.d.ts +57 -57
  22. package/src/dom/createelement.js +40 -40
  23. package/src/dom/emittermixin.d.ts +142 -142
  24. package/src/dom/emittermixin.js +239 -239
  25. package/src/dom/findclosestscrollableancestor.d.ts +11 -11
  26. package/src/dom/findclosestscrollableancestor.js +31 -31
  27. package/src/dom/getancestors.d.ts +17 -17
  28. package/src/dom/getancestors.js +27 -27
  29. package/src/dom/getborderwidths.d.ts +24 -24
  30. package/src/dom/getborderwidths.js +24 -24
  31. package/src/dom/getcommonancestor.d.ts +12 -12
  32. package/src/dom/getcommonancestor.js +25 -25
  33. package/src/dom/getdatafromelement.d.ts +14 -14
  34. package/src/dom/getdatafromelement.js +20 -20
  35. package/src/dom/getpositionedancestor.d.ts +10 -10
  36. package/src/dom/getpositionedancestor.js +22 -22
  37. package/src/dom/global.d.ts +32 -32
  38. package/src/dom/global.js +35 -35
  39. package/src/dom/indexof.d.ts +14 -14
  40. package/src/dom/indexof.js +21 -21
  41. package/src/dom/insertat.d.ts +15 -15
  42. package/src/dom/insertat.js +17 -17
  43. package/src/dom/iscomment.d.ts +11 -11
  44. package/src/dom/iscomment.js +14 -14
  45. package/src/dom/isnode.d.ts +11 -11
  46. package/src/dom/isnode.js +21 -21
  47. package/src/dom/isrange.d.ts +11 -11
  48. package/src/dom/isrange.js +13 -13
  49. package/src/dom/istext.d.ts +11 -11
  50. package/src/dom/istext.js +13 -13
  51. package/src/dom/isvalidattributename.d.ts +10 -10
  52. package/src/dom/isvalidattributename.js +22 -22
  53. package/src/dom/isvisible.d.ts +18 -18
  54. package/src/dom/isvisible.js +20 -20
  55. package/src/dom/iswindow.d.ts +11 -11
  56. package/src/dom/iswindow.js +22 -22
  57. package/src/dom/position.d.ts +211 -211
  58. package/src/dom/position.js +313 -313
  59. package/src/dom/rect.d.ts +195 -195
  60. package/src/dom/rect.js +474 -474
  61. package/src/dom/remove.d.ts +13 -13
  62. package/src/dom/remove.js +18 -18
  63. package/src/dom/resizeobserver.d.ts +74 -74
  64. package/src/dom/resizeobserver.js +126 -126
  65. package/src/dom/scroll.d.ts +73 -73
  66. package/src/dom/scroll.js +383 -383
  67. package/src/dom/setdatainelement.d.ts +14 -14
  68. package/src/dom/setdatainelement.js +20 -20
  69. package/src/dom/tounit.d.ts +22 -22
  70. package/src/dom/tounit.js +16 -16
  71. package/src/elementreplacer.d.ts +31 -31
  72. package/src/elementreplacer.js +43 -43
  73. package/src/emittermixin.d.ts +312 -312
  74. package/src/emittermixin.js +453 -453
  75. package/src/env.d.ts +117 -117
  76. package/src/env.js +122 -122
  77. package/src/eventinfo.d.ts +58 -58
  78. package/src/eventinfo.js +26 -26
  79. package/src/fastdiff.d.ts +112 -112
  80. package/src/fastdiff.js +248 -248
  81. package/src/first.d.ts +11 -11
  82. package/src/first.js +17 -17
  83. package/src/focustracker.d.ts +75 -75
  84. package/src/focustracker.js +95 -95
  85. package/src/index.d.ts +61 -61
  86. package/src/index.js +60 -60
  87. package/src/inserttopriorityarray.d.ts +30 -30
  88. package/src/inserttopriorityarray.js +21 -21
  89. package/src/isiterable.d.ts +14 -14
  90. package/src/isiterable.js +16 -16
  91. package/src/keyboard.d.ts +126 -126
  92. package/src/keyboard.js +221 -221
  93. package/src/keystrokehandler.d.ts +87 -87
  94. package/src/keystrokehandler.js +122 -122
  95. package/src/language.d.ts +17 -17
  96. package/src/language.js +19 -19
  97. package/src/locale.d.ts +120 -120
  98. package/src/locale.js +76 -76
  99. package/src/mapsequal.d.ts +15 -15
  100. package/src/mapsequal.js +27 -27
  101. package/src/mix.d.ts +85 -85
  102. package/src/mix.js +50 -50
  103. package/src/nth.d.ts +16 -16
  104. package/src/nth.js +24 -24
  105. package/src/objecttomap.d.ts +23 -23
  106. package/src/objecttomap.js +27 -27
  107. package/src/observablemixin.d.ts +560 -560
  108. package/src/observablemixin.js +580 -580
  109. package/src/priorities.d.ts +33 -33
  110. package/src/priorities.js +23 -23
  111. package/src/splicearray.d.ts +26 -26
  112. package/src/splicearray.js +40 -40
  113. package/src/spy.d.ts +21 -21
  114. package/src/spy.js +22 -22
  115. package/src/toarray.d.ts +25 -25
  116. package/src/toarray.js +7 -7
  117. package/src/tomap.d.ts +19 -19
  118. package/src/tomap.js +29 -29
  119. package/src/translation-service.d.ts +168 -168
  120. package/src/translation-service.js +198 -198
  121. package/src/uid.d.ts +15 -15
  122. package/src/uid.js +57 -57
  123. package/src/unicode.d.ts +54 -54
  124. package/src/unicode.js +85 -85
  125. package/src/verifylicense.d.ts +15 -15
  126. package/src/verifylicense.js +87 -87
  127. package/src/version.d.ts +10 -10
  128. package/src/version.js +153 -153
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
+ }