@ckeditor/ckeditor5-utils 48.2.0 → 48.3.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 (82) hide show
  1. package/dist/abortabledebounce.d.ts +19 -13
  2. package/dist/areconnectedthroughproperties.d.ts +7 -7
  3. package/dist/ckeditorerror.d.ts +113 -113
  4. package/dist/collection.d.ts +419 -415
  5. package/dist/collectstylesheets.d.ts +9 -9
  6. package/dist/comparearrays.d.ts +25 -25
  7. package/dist/config.d.ts +159 -156
  8. package/dist/count.d.ts +14 -14
  9. package/dist/crc32.d.ts +19 -19
  10. package/dist/decodelicensekey.d.ts +7 -7
  11. package/dist/delay.d.ts +13 -13
  12. package/dist/diff.d.ts +32 -27
  13. package/dist/difftochanges.d.ts +47 -47
  14. package/dist/dom/createelement.d.ts +43 -43
  15. package/dist/dom/emittermixin.d.ts +144 -135
  16. package/dist/dom/findclosestscrollableancestor.d.ts +8 -8
  17. package/dist/dom/getancestors.d.ts +13 -13
  18. package/dist/dom/getborderwidths.d.ts +16 -16
  19. package/dist/dom/getcommonancestor.d.ts +9 -9
  20. package/dist/dom/getdatafromelement.d.ts +10 -10
  21. package/dist/dom/getpositionedancestor.d.ts +7 -7
  22. package/dist/dom/getrangefrommouseevent.d.ts +12 -12
  23. package/dist/dom/getvisualviewportoffset.d.ts +7 -7
  24. package/dist/dom/global.d.ts +24 -24
  25. package/dist/dom/indexof.d.ts +10 -10
  26. package/dist/dom/insertat.d.ts +11 -11
  27. package/dist/dom/iscomment.d.ts +7 -7
  28. package/dist/dom/isnode.d.ts +7 -7
  29. package/dist/dom/isrange.d.ts +7 -7
  30. package/dist/dom/istext.d.ts +7 -7
  31. package/dist/dom/isvalidattributename.d.ts +7 -7
  32. package/dist/dom/isvisible.d.ts +12 -12
  33. package/dist/dom/iswindow.d.ts +7 -7
  34. package/dist/dom/position.d.ts +200 -200
  35. package/dist/dom/rect.d.ts +194 -194
  36. package/dist/dom/remove.d.ts +9 -9
  37. package/dist/dom/resizeobserver.d.ts +70 -70
  38. package/dist/dom/scroll.d.ts +75 -72
  39. package/dist/dom/setdatainelement.d.ts +10 -10
  40. package/dist/dom/tounit.d.ts +16 -16
  41. package/dist/elementreplacer.d.ts +26 -26
  42. package/dist/emittermixin.d.ts +290 -280
  43. package/dist/env.d.ts +124 -124
  44. package/dist/eventinfo.d.ts +58 -55
  45. package/dist/fastdiff.d.ts +112 -109
  46. package/dist/first.d.ts +7 -7
  47. package/dist/focustracker.d.ts +133 -131
  48. package/dist/formathtml.d.ts +15 -15
  49. package/dist/index-content.css +1 -0
  50. package/dist/index-editor.css +1 -0
  51. package/dist/index.css +0 -2
  52. package/dist/index.d.ts +78 -77
  53. package/dist/index.js +5695 -6360
  54. package/dist/index.js.map +1 -1
  55. package/dist/inserttopriorityarray.d.ts +23 -23
  56. package/dist/isfeatureblockedbylicensekey.d.ts +10 -10
  57. package/dist/isiterable.d.ts +10 -10
  58. package/dist/keyboard.d.ts +107 -109
  59. package/dist/keystrokehandler.d.ts +90 -90
  60. package/dist/language.d.ts +12 -12
  61. package/dist/legacyerrors.d.ts +0 -4
  62. package/dist/locale.d.ts +122 -122
  63. package/dist/mapsequal.d.ts +11 -11
  64. package/dist/mix.d.ts +54 -53
  65. package/dist/nth.d.ts +12 -12
  66. package/dist/objecttomap.d.ts +18 -18
  67. package/dist/observablemixin.d.ts +621 -539
  68. package/dist/parsebase64encodedobject.d.ts +7 -7
  69. package/dist/parsedimensionwithunit.d.ts +40 -0
  70. package/dist/priorities.d.ts +24 -24
  71. package/dist/retry.d.ts +27 -27
  72. package/dist/splicearray.d.ts +22 -22
  73. package/dist/spy.d.ts +15 -15
  74. package/dist/toarray.d.ts +17 -17
  75. package/dist/tomap.d.ts +15 -15
  76. package/dist/translation-service.d.ts +157 -157
  77. package/dist/uid.d.ts +12 -12
  78. package/dist/unicode.d.ts +42 -42
  79. package/dist/version.d.ts +5 -5
  80. package/dist/wait.d.ts +11 -11
  81. package/package.json +2 -2
  82. package/dist/index.css.map +0 -1
@@ -1,215 +1,215 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import { Rect, type RectSource } from './rect.js';
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
+ import { Rect, type RectSource } from "./rect.js";
6
6
  /**
7
- * Calculates the `position: absolute` coordinates of a given element so it can be positioned with respect to the
8
- * target in the visually most efficient way, taking various restrictions like viewport or limiter geometry
9
- * into consideration.
10
- *
11
- * **Note**: If there are no position coordinates found that meet the requirements (arguments of this helper),
12
- * `null` is returned.
13
- *
14
- * ```ts
15
- * // The element which is to be positioned.
16
- * const element = document.body.querySelector( '#toolbar' );
17
- *
18
- * // A target to which the element is positioned relatively.
19
- * const target = document.body.querySelector( '#container' );
20
- *
21
- * // Finding the optimal coordinates for the positioning.
22
- * const { left, top, name } = getOptimalPosition( {
23
- * element: element,
24
- * target: target,
25
- *
26
- * // The algorithm will chose among these positions to meet the requirements such
27
- * // as "limiter" element or "fitInViewport", set below. The positions are considered
28
- * // in the order of the array.
29
- * positions: [
30
- * //
31
- * // [ Target ]
32
- * // +-----------------+
33
- * // | Element |
34
- * // +-----------------+
35
- * //
36
- * targetRect => ( {
37
- * top: targetRect.bottom,
38
- * left: targetRect.left,
39
- * name: 'mySouthEastPosition'
40
- * } ),
41
- *
42
- * //
43
- * // +-----------------+
44
- * // | Element |
45
- * // +-----------------+
46
- * // [ Target ]
47
- * //
48
- * ( targetRect, elementRect ) => ( {
49
- * top: targetRect.top - elementRect.height,
50
- * left: targetRect.left,
51
- * name: 'myNorthEastPosition'
52
- * } )
53
- * ],
54
- *
55
- * // Find a position such guarantees the element remains within visible boundaries of <body>.
56
- * limiter: document.body,
57
- *
58
- * // Find a position such guarantees the element remains within visible boundaries of the browser viewport.
59
- * fitInViewport: true
60
- * } );
61
- *
62
- * // The best position which fits into document.body and the viewport. May be useful
63
- * // to set proper class on the `element`.
64
- * console.log( name ); // -> "myNorthEastPosition"
65
- *
66
- * // Using the absolute coordinates which has been found to position the element
67
- * // as in the diagram depicting the "myNorthEastPosition" position.
68
- * element.style.top = top;
69
- * element.style.left = left;
70
- * ```
71
- *
72
- * @param options The input data and configuration of the helper.
73
- */
7
+ * Calculates the `position: absolute` coordinates of a given element so it can be positioned with respect to the
8
+ * target in the visually most efficient way, taking various restrictions like viewport or limiter geometry
9
+ * into consideration.
10
+ *
11
+ * **Note**: If there are no position coordinates found that meet the requirements (arguments of this helper),
12
+ * `null` is returned.
13
+ *
14
+ * ```ts
15
+ * // The element which is to be positioned.
16
+ * const element = document.body.querySelector( '#toolbar' );
17
+ *
18
+ * // A target to which the element is positioned relatively.
19
+ * const target = document.body.querySelector( '#container' );
20
+ *
21
+ * // Finding the optimal coordinates for the positioning.
22
+ * const { left, top, name } = getOptimalPosition( {
23
+ * element: element,
24
+ * target: target,
25
+ *
26
+ * // The algorithm will chose among these positions to meet the requirements such
27
+ * // as "limiter" element or "fitInViewport", set below. The positions are considered
28
+ * // in the order of the array.
29
+ * positions: [
30
+ * //
31
+ * // [ Target ]
32
+ * // +-----------------+
33
+ * // | Element |
34
+ * // +-----------------+
35
+ * //
36
+ * targetRect => ( {
37
+ * top: targetRect.bottom,
38
+ * left: targetRect.left,
39
+ * name: 'mySouthEastPosition'
40
+ * } ),
41
+ *
42
+ * //
43
+ * // +-----------------+
44
+ * // | Element |
45
+ * // +-----------------+
46
+ * // [ Target ]
47
+ * //
48
+ * ( targetRect, elementRect ) => ( {
49
+ * top: targetRect.top - elementRect.height,
50
+ * left: targetRect.left,
51
+ * name: 'myNorthEastPosition'
52
+ * } )
53
+ * ],
54
+ *
55
+ * // Find a position such guarantees the element remains within visible boundaries of <body>.
56
+ * limiter: document.body,
57
+ *
58
+ * // Find a position such guarantees the element remains within visible boundaries of the browser viewport.
59
+ * fitInViewport: true
60
+ * } );
61
+ *
62
+ * // The best position which fits into document.body and the viewport. May be useful
63
+ * // to set proper class on the `element`.
64
+ * console.log( name ); // -> "myNorthEastPosition"
65
+ *
66
+ * // Using the absolute coordinates which has been found to position the element
67
+ * // as in the diagram depicting the "myNorthEastPosition" position.
68
+ * element.style.top = top;
69
+ * element.style.left = left;
70
+ * ```
71
+ *
72
+ * @param options The input data and configuration of the helper.
73
+ */
74
74
  export declare function getOptimalPosition({ element, target, positions, limiter, fitInViewport, viewportOffsetConfig }: DomOptimalPositionOptions): DomPoint | null;
75
75
  /**
76
- * Returns a viewport `Rect` shrunk by the viewport offset config from all sides.
77
- */
78
- export declare function getConstrainedViewportRect(viewportOffsetConfig: DomOptimalPositionOptions['viewportOffsetConfig']): Rect;
76
+ * Returns a viewport `Rect` shrunk by the viewport offset config from all sides.
77
+ */
78
+ export declare function getConstrainedViewportRect(viewportOffsetConfig: DomOptimalPositionOptions["viewportOffsetConfig"]): Rect;
79
79
  /**
80
- * A position object which instances are created and used by the {@link module:utils/dom/position~getOptimalPosition} helper.
81
- *
82
- * {@link module:utils/dom/position~DomPoint#top} and {@link module:utils/dom/position~DomPoint#left} properties of the position instance
83
- * translate directly to the `top` and `left` properties in CSS "`position: absolute` coordinate system". If set on the positioned element
84
- * in DOM, they will make it display it in the right place in the viewport.
85
- */
80
+ * A position object which instances are created and used by the {@link module:utils/dom/position~getOptimalPosition} helper.
81
+ *
82
+ * {@link module:utils/dom/position~DomPoint#top} and {@link module:utils/dom/position~DomPoint#left} properties of the position instance
83
+ * translate directly to the `top` and `left` properties in CSS "`position: absolute` coordinate system". If set on the positioned element
84
+ * in DOM, they will make it display it in the right place in the viewport.
85
+ */
86
86
  export interface DomPoint {
87
- /**
88
- * Position name.
89
- */
90
- readonly name?: string;
91
- /**
92
- * Additional position configuration, as passed from the {@link module:utils/dom/position~PositioningFunction positioning function}.
93
- *
94
- * This object can be use, for instance, to pass through presentation options used by the consumer of the
95
- * {@link module:utils/dom/position~getOptimalPosition} helper.
96
- */
97
- readonly config?: object;
98
- /**
99
- * The left value in pixels in the CSS `position: absolute` coordinate system.
100
- * Set it on the positioned element in DOM to move it to the position.
101
- */
102
- readonly left: number;
103
- /**
104
- * The top value in pixels in the CSS `position: absolute` coordinate system.
105
- * Set it on the positioned element in DOM to move it to the position.
106
- */
107
- readonly top: number;
87
+ /**
88
+ * Position name.
89
+ */
90
+ readonly name?: string;
91
+ /**
92
+ * Additional position configuration, as passed from the {@link module:utils/dom/position~PositioningFunction positioning function}.
93
+ *
94
+ * This object can be use, for instance, to pass through presentation options used by the consumer of the
95
+ * {@link module:utils/dom/position~getOptimalPosition} helper.
96
+ */
97
+ readonly config?: object;
98
+ /**
99
+ * The left value in pixels in the CSS `position: absolute` coordinate system.
100
+ * Set it on the positioned element in DOM to move it to the position.
101
+ */
102
+ readonly left: number;
103
+ /**
104
+ * The top value in pixels in the CSS `position: absolute` coordinate system.
105
+ * Set it on the positioned element in DOM to move it to the position.
106
+ */
107
+ readonly top: number;
108
108
  }
109
109
  /**
110
- * The `getOptimalPosition()` helper options.
111
- */
110
+ * The `getOptimalPosition()` helper options.
111
+ */
112
112
  export interface DomOptimalPositionOptions {
113
- /**
114
- * Element that is to be positioned.
115
- */
116
- readonly element: HTMLElement;
117
- /**
118
- * Target with respect to which the `element` is to be positioned.
119
- */
120
- readonly target: RectSource | (() => RectSource);
121
- /**
122
- * An array of positioning functions.
123
- *
124
- * **Note**: Positioning functions are processed in the order of preference. The first function that works
125
- * in the current environment (e.g. offers the complete fit in the viewport geometry) will be picked by
126
- * `getOptimalPosition()`.
127
- *
128
- * **Note**: Any positioning function returning `null` is ignored.
129
- */
130
- readonly positions: ReadonlyArray<PositioningFunction>;
131
- /**
132
- * When set, the algorithm will chose position which fits the most in the
133
- * limiter's bounding rect.
134
- */
135
- readonly limiter?: RectSource | (() => (RectSource | null)) | null;
136
- /**
137
- * When set, the algorithm will chose such a position which fits `element`
138
- * the most inside visible viewport.
139
- */
140
- readonly fitInViewport?: boolean;
141
- /**
142
- * Viewport offset config object. It restricts the visible viewport available to the `getOptimalPosition()` from each side.
143
- *
144
- * ```ts
145
- * {
146
- * top: 50,
147
- * right: 50,
148
- * bottom: 50,
149
- * left: 50
150
- * }
151
- * ```
152
- */
153
- readonly viewportOffsetConfig?: {
154
- readonly top?: number;
155
- readonly right?: number;
156
- readonly bottom?: number;
157
- readonly left?: number;
158
- };
113
+ /**
114
+ * Element that is to be positioned.
115
+ */
116
+ readonly element: HTMLElement;
117
+ /**
118
+ * Target with respect to which the `element` is to be positioned.
119
+ */
120
+ readonly target: RectSource | (() => RectSource);
121
+ /**
122
+ * An array of positioning functions.
123
+ *
124
+ * **Note**: Positioning functions are processed in the order of preference. The first function that works
125
+ * in the current environment (e.g. offers the complete fit in the viewport geometry) will be picked by
126
+ * `getOptimalPosition()`.
127
+ *
128
+ * **Note**: Any positioning function returning `null` is ignored.
129
+ */
130
+ readonly positions: ReadonlyArray<PositioningFunction>;
131
+ /**
132
+ * When set, the algorithm will chose position which fits the most in the
133
+ * limiter's bounding rect.
134
+ */
135
+ readonly limiter?: RectSource | (() => (RectSource | null)) | null;
136
+ /**
137
+ * When set, the algorithm will chose such a position which fits `element`
138
+ * the most inside visible viewport.
139
+ */
140
+ readonly fitInViewport?: boolean;
141
+ /**
142
+ * Viewport offset config object. It restricts the visible viewport available to the `getOptimalPosition()` from each side.
143
+ *
144
+ * ```ts
145
+ * {
146
+ * top: 50,
147
+ * right: 50,
148
+ * bottom: 50,
149
+ * left: 50
150
+ * }
151
+ * ```
152
+ */
153
+ readonly viewportOffsetConfig?: {
154
+ readonly top?: number;
155
+ readonly right?: number;
156
+ readonly bottom?: number;
157
+ readonly left?: number;
158
+ };
159
159
  }
160
160
  /**
161
- * A positioning function which, based on positioned element and target {@link module:utils/dom/rect~Rect Rects}, returns rect coordinates
162
- * representing the geometrical relation between them. Used by the {@link module:utils/dom/position~getOptimalPosition} helper.
163
- *
164
- * ```ts
165
- * // This simple position will place the element directly under the target, in the middle:
166
- * //
167
- * // [ Target ]
168
- * // +-----------------+
169
- * // | Element |
170
- * // +-----------------+
171
- * //
172
- * const position = ( targetRect, elementRect, [ viewportRect ] ) => ( {
173
- * top: targetRect.bottom,
174
- * left: targetRect.left + targetRect.width / 2 - elementRect.width / 2,
175
- * name: 'bottomMiddle',
176
- *
177
- * // Note: The config is optional.
178
- * config: {
179
- * zIndex: '999'
180
- * }
181
- * } );
182
- * ```
183
- *
184
- * @param elementRect The rect of the element to be positioned.
185
- * @param targetRect The rect of the target the element (its rect) is relatively positioned to.
186
- * @param viewportRect The rect of the visual browser viewport.
187
- * @returns When the function returns `null`, it will not be considered by {@link module:utils/dom/position~getOptimalPosition}.
188
- */
161
+ * A positioning function which, based on positioned element and target {@link module:utils/dom/rect~Rect Rects}, returns rect coordinates
162
+ * representing the geometrical relation between them. Used by the {@link module:utils/dom/position~getOptimalPosition} helper.
163
+ *
164
+ * ```ts
165
+ * // This simple position will place the element directly under the target, in the middle:
166
+ * //
167
+ * // [ Target ]
168
+ * // +-----------------+
169
+ * // | Element |
170
+ * // +-----------------+
171
+ * //
172
+ * const position = ( targetRect, elementRect, [ viewportRect ] ) => ( {
173
+ * top: targetRect.bottom,
174
+ * left: targetRect.left + targetRect.width / 2 - elementRect.width / 2,
175
+ * name: 'bottomMiddle',
176
+ *
177
+ * // Note: The config is optional.
178
+ * config: {
179
+ * zIndex: '999'
180
+ * }
181
+ * } );
182
+ * ```
183
+ *
184
+ * @param elementRect The rect of the element to be positioned.
185
+ * @param targetRect The rect of the target the element (its rect) is relatively positioned to.
186
+ * @param viewportRect The rect of the visual browser viewport.
187
+ * @returns When the function returns `null`, it will not be considered by {@link module:utils/dom/position~getOptimalPosition}.
188
+ */
189
189
  export type PositioningFunction = (elementRect: Rect, targetRect: Rect, viewportRect: Rect, limiterRect?: Rect) => DomPositioningFunctionResult | null;
190
190
  /**
191
- * The result of {@link module:utils/dom/position~PositioningFunction}.
192
- */
191
+ * The result of {@link module:utils/dom/position~PositioningFunction}.
192
+ */
193
193
  export interface DomPositioningFunctionResult {
194
- /**
195
- * The `top` value of the element rect that would represent the position.
196
- */
197
- top: number;
198
- /**
199
- * The `left` value of the element rect that would represent the position.
200
- */
201
- left: number;
202
- /**
203
- * The name of the position. It helps the user of the {@link module:utils/dom/position~getOptimalPosition}
204
- * helper to recognize different positioning function results. It will pass through to the {@link module:utils/dom/position~DomPoint}
205
- * returned by the helper.
206
- */
207
- name?: string;
208
- /**
209
- * An optional configuration that will pass-through the {@link module:utils/dom/position~getOptimalPosition} helper
210
- * to the {@link module:utils/dom/position~DomPoint} returned by this helper.
211
- * This configuration may, for instance, let the user of {@link module:utils/dom/position~getOptimalPosition} know that this particular
212
- * position comes with a certain presentation.
213
- */
214
- config?: object;
194
+ /**
195
+ * The `top` value of the element rect that would represent the position.
196
+ */
197
+ top: number;
198
+ /**
199
+ * The `left` value of the element rect that would represent the position.
200
+ */
201
+ left: number;
202
+ /**
203
+ * The name of the position. It helps the user of the {@link module:utils/dom/position~getOptimalPosition}
204
+ * helper to recognize different positioning function results. It will pass through to the {@link module:utils/dom/position~DomPoint}
205
+ * returned by the helper.
206
+ */
207
+ name?: string;
208
+ /**
209
+ * An optional configuration that will pass-through the {@link module:utils/dom/position~getOptimalPosition} helper
210
+ * to the {@link module:utils/dom/position~DomPoint} returned by this helper.
211
+ * This configuration may, for instance, let the user of {@link module:utils/dom/position~getOptimalPosition} know that this particular
212
+ * position comes with a certain presentation.
213
+ */
214
+ config?: object;
215
215
  }