@ckeditor/ckeditor5-utils 48.8.1-alpha.4 → 49.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/abortabledebounce.d.ts +19 -13
  3. package/dist/areconnectedthroughproperties.d.ts +7 -7
  4. package/dist/ckeditorerror.d.ts +114 -113
  5. package/dist/collection.d.ts +419 -415
  6. package/dist/collectstylesheets.d.ts +9 -9
  7. package/dist/comparearrays.d.ts +25 -25
  8. package/dist/config.d.ts +159 -156
  9. package/dist/count.d.ts +14 -14
  10. package/dist/crc32.d.ts +19 -19
  11. package/dist/decodelicensekey.d.ts +7 -7
  12. package/dist/delay.d.ts +13 -13
  13. package/dist/diff.d.ts +32 -27
  14. package/dist/difftochanges.d.ts +47 -47
  15. package/dist/dom/adoptglobalstylesheet.d.ts +19 -0
  16. package/dist/dom/containsnode.d.ts +18 -0
  17. package/dist/dom/createelement.d.ts +43 -43
  18. package/dist/dom/emittermixin.d.ts +141 -135
  19. package/dist/dom/findclosestscrollableancestor.d.ts +13 -8
  20. package/dist/dom/getactiveelement.d.ts +17 -0
  21. package/dist/dom/getancestors.d.ts +13 -13
  22. package/dist/dom/getborderwidths.d.ts +16 -16
  23. package/dist/dom/getdatafromelement.d.ts +10 -10
  24. package/dist/dom/getelementfrompoint.d.ts +23 -0
  25. package/dist/dom/getlayoutparentelement.d.ts +18 -0
  26. package/dist/dom/getlayoutparentnode.d.ts +24 -0
  27. package/dist/dom/getoverlaymountroot.d.ts +24 -0
  28. package/dist/dom/getparentelement.d.ts +13 -0
  29. package/dist/dom/getparentnode.d.ts +15 -0
  30. package/dist/dom/getpositionedancestor.d.ts +18 -7
  31. package/dist/dom/getrangefrommouseevent.d.ts +15 -13
  32. package/dist/dom/getselection.d.ts +106 -0
  33. package/dist/dom/getshadowroots.d.ts +19 -0
  34. package/dist/dom/getvisualviewportoffset.d.ts +7 -7
  35. package/dist/dom/global.d.ts +24 -24
  36. package/dist/dom/indexof.d.ts +10 -10
  37. package/dist/dom/insertat.d.ts +11 -11
  38. package/dist/dom/iscomment.d.ts +7 -7
  39. package/dist/dom/isdomselectionbackward.d.ts +18 -0
  40. package/dist/dom/isnode.d.ts +7 -7
  41. package/dist/dom/isoffline.d.ts +8 -0
  42. package/dist/dom/isrange.d.ts +7 -7
  43. package/dist/dom/isshadowhostof.d.ts +18 -0
  44. package/dist/dom/isshadowroot.d.ts +41 -0
  45. package/dist/dom/istext.d.ts +7 -7
  46. package/dist/dom/isvalidattributename.d.ts +7 -7
  47. package/dist/dom/isvisible.d.ts +16 -12
  48. package/dist/dom/iswindow.d.ts +7 -7
  49. package/dist/dom/position.d.ts +200 -200
  50. package/dist/dom/rect.d.ts +198 -194
  51. package/dist/dom/remove.d.ts +7 -10
  52. package/dist/dom/resizeobserver.d.ts +70 -70
  53. package/dist/dom/scroll.d.ts +83 -72
  54. package/dist/dom/setdatainelement.d.ts +8 -11
  55. package/dist/dom/shadowrootregistry.d.ts +125 -0
  56. package/dist/dom/tounit.d.ts +16 -16
  57. package/dist/dom/trustedtypes.d.ts +65 -0
  58. package/dist/dom/whenelementconnected.d.ts +26 -0
  59. package/dist/elementreplacer.d.ts +24 -27
  60. package/dist/emittermixin.d.ts +287 -280
  61. package/dist/env.d.ts +124 -124
  62. package/dist/eventinfo.d.ts +58 -55
  63. package/dist/fastdiff.d.ts +112 -109
  64. package/dist/first.d.ts +7 -7
  65. package/dist/focustracker.d.ts +133 -131
  66. package/dist/formathtml.d.ts +15 -15
  67. package/dist/index-content.css +3 -0
  68. package/dist/index-content.css.map +1 -0
  69. package/dist/index-editor.css +3 -0
  70. package/dist/index-editor.css.map +1 -0
  71. package/dist/index.d.ts +95 -77
  72. package/dist/index.js +6788 -6360
  73. package/dist/index.js.map +1 -1
  74. package/dist/inserttopriorityarray.d.ts +23 -23
  75. package/dist/isfeatureblockedbylicensekey.d.ts +10 -10
  76. package/dist/isiterable.d.ts +10 -10
  77. package/dist/keyboard.d.ts +107 -109
  78. package/dist/keystrokehandler.d.ts +90 -90
  79. package/dist/language.d.ts +12 -12
  80. package/dist/legacyerrors.d.ts +0 -4
  81. package/dist/locale.d.ts +122 -122
  82. package/dist/mapsequal.d.ts +11 -11
  83. package/dist/mix.d.ts +54 -53
  84. package/dist/nth.d.ts +12 -12
  85. package/dist/objecttomap.d.ts +18 -18
  86. package/dist/observablemixin.d.ts +618 -539
  87. package/dist/parsebase64encodedobject.d.ts +7 -7
  88. package/dist/parsedimensionwithunit.d.ts +40 -0
  89. package/dist/priorities.d.ts +24 -24
  90. package/dist/retry.d.ts +27 -27
  91. package/dist/splicearray.d.ts +22 -22
  92. package/dist/spy.d.ts +15 -15
  93. package/dist/toarray.d.ts +17 -17
  94. package/dist/tomap.d.ts +15 -15
  95. package/dist/translation-service.d.ts +157 -157
  96. package/dist/uid.d.ts +12 -12
  97. package/dist/unicode.d.ts +42 -42
  98. package/dist/version.d.ts +5 -5
  99. package/dist/wait.d.ts +11 -11
  100. package/package.json +3 -3
  101. package/dist/dom/getcommonancestor.d.ts +0 -12
@@ -0,0 +1,41 @@
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
+ /**
6
+ * @module utils/dom/isshadowroot
7
+ */
8
+ /**
9
+ * Checks whether the given object is a native DOM `ShadowRoot`.
10
+ *
11
+ * A type guard, safe to call on any value, and correct for a root belonging to another document or iframe.
12
+ *
13
+ * @param obj The object to check.
14
+ */
15
+ export declare function isShadowRoot(obj: unknown): obj is ShadowRoot;
16
+ /**
17
+ * Checks whether the given object is a shadow root the platform itself accepts.
18
+ *
19
+ * A page may run a shadow DOM polyfill that emulates the boundary in the light DOM instead of asking the
20
+ * engine for one – a *synthetic* shadow root. Such a root passes {@link ~isShadowRoot}, because the polyfill
21
+ * replaces the global `ShadowRoot` with its own constructor and patches `Symbol.hasInstance` on it. It
22
+ * emulates the tree faithfully enough for traversal (`host`, `parentNode`, `contains`, `activeElement` all
23
+ * behave), which is why {@link ~isShadowRoot} stays truthful about it, but being no platform object it
24
+ * cannot be:
25
+ *
26
+ * * passed to a DOM API expecting a real root – `Selection#getComposedRanges()` and
27
+ * `Document#caretPositionFromPoint()` reject it while converting their arguments;
28
+ * * asked for its selection or stylesheets – those are the members a polyfill cannot emulate, so it
29
+ * usually makes them throw;
30
+ * * used as a mount target – its `appendChild()` delegates to the host element, so the node ends up in the
31
+ * surrounding tree rather than at the top of the one it was mounted in.
32
+ *
33
+ * Use it wherever a root crosses into one of those, and {@link ~isShadowRoot} everywhere else. Answering
34
+ * `false` here falls back to the light-DOM path, which is the correct answer for a synthetic root: the
35
+ * boundary it emulates is not one the engine actually has, so the document-level APIs already see the real
36
+ * nodes behind it.
37
+ *
38
+ * @internal
39
+ * @param obj The object to check.
40
+ */
41
+ export declare function isNativeShadowRoot(obj: unknown): obj is ShadowRoot;
@@ -1,11 +1,11 @@
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
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module utils/dom/istext
7
- */
6
+ * @module utils/dom/istext
7
+ */
8
8
  /**
9
- * Checks if the object is a native DOM Text node.
10
- */
9
+ * Checks if the object is a native DOM Text node.
10
+ */
11
11
  export declare function isText(obj: unknown): obj is Text;
@@ -1,10 +1,10 @@
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
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * Checks if the given attribute name is valid in terms of HTML.
7
- *
8
- * @param name Attribute name.
9
- */
6
+ * Checks if the given attribute name is valid in terms of HTML.
7
+ *
8
+ * @param name Attribute name.
9
+ */
10
10
  export declare function isValidAttributeName(name: string): boolean;
@@ -1,15 +1,19 @@
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
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * Checks whether the element is visible to the user in DOM:
7
- *
8
- * * connected to the root of the document,
9
- * * has no `display: none`,
10
- * * has no ancestors with `display: none`.
11
- *
12
- * **Note**: This helper does not check whether the element is hidden by cropping, overflow, etc..
13
- * To check that, use {@link module:utils/dom/rect~Rect} instead.
14
- */
6
+ * Checks whether the element is visible to the user in DOM:
7
+ *
8
+ * * connected to the root of the document,
9
+ * * has no `display: none`,
10
+ * * has no ancestors with `display: none`.
11
+ *
12
+ * **Note**: This helper does not check whether the element is hidden by cropping, overflow, etc..
13
+ * To check that, use {@link module:utils/dom/rect~Rect} instead.
14
+ *
15
+ * **Note**: The ancestor lookup crosses shadow DOM boundaries, so a text node sitting directly in a shadow root
16
+ * is resolved against that root's host rather than reported as invisible. Works for open and closed shadow roots
17
+ * alike.
18
+ */
15
19
  export declare function isVisible(element: Text | HTMLElement | null | undefined): boolean;
@@ -1,11 +1,11 @@
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
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module utils/dom/iswindow
7
- */
6
+ * @module utils/dom/iswindow
7
+ */
8
8
  /**
9
- * Checks if the object is a native DOM Window.
10
- */
9
+ * Checks if the object is a native DOM Window.
10
+ */
11
11
  export declare function isWindow(obj: unknown): obj is Window;
@@ -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
  }