@ckeditor/ckeditor5-utils 39.0.1 → 40.0.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 (134) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/LICENSE.md +1 -1
  3. package/README.md +3 -3
  4. package/package.json +1 -5
  5. package/src/areconnectedthroughproperties.d.ts +11 -11
  6. package/src/areconnectedthroughproperties.js +73 -73
  7. package/src/ckeditorerror.d.ts +123 -123
  8. package/src/ckeditorerror.js +176 -176
  9. package/src/collection.d.ts +427 -427
  10. package/src/collection.js +575 -575
  11. package/src/comparearrays.d.ts +30 -30
  12. package/src/comparearrays.js +47 -47
  13. package/src/config.d.ts +163 -163
  14. package/src/config.js +162 -162
  15. package/src/count.d.ts +18 -18
  16. package/src/count.js +24 -24
  17. package/src/delay.d.ts +19 -19
  18. package/src/delay.js +26 -26
  19. package/src/diff.d.ts +31 -31
  20. package/src/diff.js +115 -115
  21. package/src/difftochanges.d.ts +59 -59
  22. package/src/difftochanges.js +79 -79
  23. package/src/dom/createelement.d.ts +57 -57
  24. package/src/dom/createelement.js +40 -40
  25. package/src/dom/emittermixin.d.ts +142 -142
  26. package/src/dom/emittermixin.js +239 -239
  27. package/src/dom/findclosestscrollableancestor.d.ts +11 -11
  28. package/src/dom/findclosestscrollableancestor.js +31 -31
  29. package/src/dom/getancestors.d.ts +17 -17
  30. package/src/dom/getancestors.js +27 -27
  31. package/src/dom/getborderwidths.d.ts +24 -24
  32. package/src/dom/getborderwidths.js +24 -24
  33. package/src/dom/getcommonancestor.d.ts +12 -12
  34. package/src/dom/getcommonancestor.js +25 -25
  35. package/src/dom/getdatafromelement.d.ts +14 -14
  36. package/src/dom/getdatafromelement.js +20 -20
  37. package/src/dom/getpositionedancestor.d.ts +10 -10
  38. package/src/dom/getpositionedancestor.js +22 -22
  39. package/src/dom/global.d.ts +32 -32
  40. package/src/dom/global.js +35 -35
  41. package/src/dom/indexof.d.ts +14 -14
  42. package/src/dom/indexof.js +21 -21
  43. package/src/dom/insertat.d.ts +15 -15
  44. package/src/dom/insertat.js +17 -17
  45. package/src/dom/iscomment.d.ts +11 -11
  46. package/src/dom/iscomment.js +14 -14
  47. package/src/dom/isnode.d.ts +11 -11
  48. package/src/dom/isnode.js +21 -21
  49. package/src/dom/isrange.d.ts +11 -11
  50. package/src/dom/isrange.js +13 -13
  51. package/src/dom/istext.d.ts +11 -11
  52. package/src/dom/istext.js +13 -13
  53. package/src/dom/isvalidattributename.d.ts +10 -10
  54. package/src/dom/isvalidattributename.js +22 -22
  55. package/src/dom/isvisible.d.ts +18 -18
  56. package/src/dom/isvisible.js +20 -20
  57. package/src/dom/iswindow.d.ts +11 -11
  58. package/src/dom/iswindow.js +22 -22
  59. package/src/dom/position.d.ts +211 -208
  60. package/src/dom/position.js +313 -305
  61. package/src/dom/rect.d.ts +195 -191
  62. package/src/dom/rect.js +474 -388
  63. package/src/dom/remove.d.ts +13 -13
  64. package/src/dom/remove.js +18 -18
  65. package/src/dom/resizeobserver.d.ts +74 -74
  66. package/src/dom/resizeobserver.js +126 -126
  67. package/src/dom/scroll.d.ts +73 -73
  68. package/src/dom/scroll.js +383 -383
  69. package/src/dom/setdatainelement.d.ts +14 -14
  70. package/src/dom/setdatainelement.js +20 -20
  71. package/src/dom/tounit.d.ts +22 -22
  72. package/src/dom/tounit.js +16 -16
  73. package/src/elementreplacer.d.ts +31 -31
  74. package/src/elementreplacer.js +43 -43
  75. package/src/emittermixin.d.ts +312 -312
  76. package/src/emittermixin.js +453 -453
  77. package/src/env.d.ts +117 -117
  78. package/src/env.js +122 -122
  79. package/src/eventinfo.d.ts +58 -58
  80. package/src/eventinfo.js +26 -26
  81. package/src/fastdiff.d.ts +112 -112
  82. package/src/fastdiff.js +248 -248
  83. package/src/first.d.ts +11 -11
  84. package/src/first.js +17 -17
  85. package/src/focustracker.d.ts +75 -75
  86. package/src/focustracker.js +95 -95
  87. package/src/index.d.ts +61 -62
  88. package/src/index.js +60 -61
  89. package/src/inserttopriorityarray.d.ts +30 -30
  90. package/src/inserttopriorityarray.js +21 -21
  91. package/src/isiterable.d.ts +14 -14
  92. package/src/isiterable.js +16 -16
  93. package/src/keyboard.d.ts +126 -126
  94. package/src/keyboard.js +221 -221
  95. package/src/keystrokehandler.d.ts +87 -87
  96. package/src/keystrokehandler.js +122 -122
  97. package/src/language.d.ts +17 -17
  98. package/src/language.js +19 -19
  99. package/src/locale.d.ts +120 -120
  100. package/src/locale.js +76 -76
  101. package/src/mapsequal.d.ts +15 -15
  102. package/src/mapsequal.js +27 -27
  103. package/src/mix.d.ts +85 -85
  104. package/src/mix.js +50 -50
  105. package/src/nth.d.ts +16 -16
  106. package/src/nth.js +24 -24
  107. package/src/objecttomap.d.ts +23 -23
  108. package/src/objecttomap.js +27 -27
  109. package/src/observablemixin.d.ts +560 -560
  110. package/src/observablemixin.js +580 -580
  111. package/src/priorities.d.ts +33 -33
  112. package/src/priorities.js +23 -23
  113. package/src/splicearray.d.ts +26 -26
  114. package/src/splicearray.js +40 -40
  115. package/src/spy.d.ts +21 -21
  116. package/src/spy.js +22 -22
  117. package/src/toarray.d.ts +25 -25
  118. package/src/toarray.js +7 -7
  119. package/src/tomap.d.ts +19 -19
  120. package/src/tomap.js +29 -29
  121. package/src/translation-service.d.ts +168 -168
  122. package/src/translation-service.js +198 -198
  123. package/src/uid.d.ts +15 -15
  124. package/src/uid.js +57 -57
  125. package/src/unicode.d.ts +54 -54
  126. package/src/unicode.js +85 -85
  127. package/src/verifylicense.d.ts +15 -15
  128. package/src/verifylicense.js +87 -87
  129. package/src/version.d.ts +10 -10
  130. package/src/version.js +153 -156
  131. package/src/dom/getelementsintersectionrect.d.ts +0 -17
  132. package/src/dom/getelementsintersectionrect.js +0 -42
  133. package/src/dom/getscrollableancestors.d.ts +0 -14
  134. package/src/dom/getscrollableancestors.js +0 -28
package/src/version.js CHANGED
@@ -1,156 +1,153 @@
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
- * @module utils/version
7
- */
8
- /* globals window, global */
9
- import CKEditorError from './ckeditorerror';
10
- const version = '39.0.1';
11
- export default version;
12
- // The second argument is not a month. It is `monthIndex` and starts from `0`.
13
- export const releaseDate = new Date(2023, 7, 10);
14
- /* istanbul ignore next -- @preserve */
15
- const windowOrGlobal = typeof window === 'object' ? window : global;
16
- /* istanbul ignore next -- @preserve */
17
- if (windowOrGlobal.CKEDITOR_VERSION) {
18
- /**
19
- * This error is thrown when due to a mistake in how CKEditor 5 was installed or initialized, some
20
- * of its modules were duplicated (evaluated and executed twice). Module duplication leads to inevitable runtime
21
- * errors.
22
- *
23
- * There are many situations in which some modules can be loaded twice. In the worst case scenario,
24
- * you may need to check your project for each of these issues and fix them all.
25
- *
26
- * # Trying to add a plugin to an existing build
27
- *
28
- * If you import an existing CKEditor 5 build and a plugin like this:
29
- *
30
- * ```ts
31
- * import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
32
- * import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight';
33
- * ```
34
- *
35
- * Then your project loads some CKEditor 5 packages twice. How does it happen?
36
- *
37
- * The build package contains a file which is already compiled with webpack. This means
38
- * that it contains all the necessary code from e.g. `@ckeditor/ckeditor5-engine` and `@ckeditor/ckeditor5-utils`.
39
- *
40
- * However, the `Highlight` plugin imports some of the modules from these packages, too. If you ask webpack to
41
- * build such a project, you will end up with the modules being included (and run) twice — first, because they are
42
- * included inside the build package, and second, because they are required by the `Highlight` plugin.
43
- *
44
- * Therefore, **you must never add plugins to an existing build** unless your plugin has no dependencies.
45
- *
46
- * Adding plugins to a build is done by taking the source version of this build (so, before it was built with webpack)
47
- * and adding plugins there. In this situation, webpack will know that it only needs to load each plugin once.
48
- *
49
- * Read more in the {@glink installation/plugins/installing-plugins Installing plugins} guide.
50
- *
51
- * # Confused an editor build with an editor implementation
52
- *
53
- * This scenario is very similar to the previous one, but has a different origin.
54
- *
55
- * Let's assume that you wanted to use CKEditor 5 from source, as explained in the
56
- * {@glink installation/advanced/alternative-setups/integrating-from-source-webpack "Building from source"} section
57
- * or in the {@glink framework/quick-start "Quick start"} guide of CKEditor 5 Framework.
58
- *
59
- * The correct way to do so is to import an editor and plugins and run them together like this:
60
- *
61
- * ```ts
62
- * import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
63
- * import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
64
- * import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
65
- * import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
66
- * import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
67
- *
68
- * ClassicEditor
69
- * .create( document.querySelector( '#editor' ), {
70
- * plugins: [ Essentials, Paragraph, Bold, Italic ],
71
- * toolbar: [ 'bold', 'italic' ]
72
- * } )
73
- * .then( editor => {
74
- * console.log( 'Editor was initialized', editor );
75
- * } )
76
- * .catch( error => {
77
- * console.error( error.stack );
78
- * } );
79
- * ```
80
- *
81
- * However, you might have mistakenly imported a build instead of the source `ClassicEditor`. In this case
82
- * your imports will look like this:
83
- *
84
- * ```ts
85
- * import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
86
- * import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
87
- * import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
88
- * import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
89
- * import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
90
- * ```
91
- *
92
- * This creates the same situation as in the previous section because you use a build together with source plugins.
93
- *
94
- * Remember: `@ckeditor/ckeditor5-build-*` packages contain editor builds and `@ckeditor/ckeditor5-editor-*` contain source editors.
95
- *
96
- * # Loading two or more builds on one page
97
- *
98
- * If you use CKEditor 5 builds, you might have loaded two (or more) `ckeditor.js` files on one web page.
99
- * Check your web page for duplicated `<script>` elements or make sure your page builder/bundler includes CKEditor only once.
100
- *
101
- * If you want to use two different types of editors at once, see the
102
- * {@glink installation/advanced/using-two-editors "Using two different editors"}
103
- * section.
104
- *
105
- * # Using outdated packages
106
- *
107
- * Building CKEditor 5 from source requires using multiple npm packages. These packages have their dependencies
108
- * to other packages. If you use the latest version of, for example, `@ckeditor/ckeditor5-editor-classic` with
109
- * an outdated version of `@ckeditor/ckeditor5-image`, npm or yarn will need to install two different versions of
110
- * `@ckeditor/ckeditor5-core` because `@ckeditor/ckeditor5-editor-classic` and `@ckeditor/ckeditor5-image` may require
111
- * different versions of the core package.
112
- *
113
- * The solution to this issue is to update all packages to their latest version. We recommend
114
- * using tools like [`npm-check-updates`](https://www.npmjs.com/package/npm-check-updates) which simplify this process.
115
- *
116
- * # Conflicting version of dependencies
117
- *
118
- * This is a special case of the previous scenario. If you use CKEditor 5 with some third-party plugins,
119
- * it may happen that even if you use the latest versions of the official packages and the latest version of
120
- * these third-party packages, there will be a conflict between some of their dependencies.
121
- *
122
- * Such a problem can be resolved by either downgrading CKEditor 5 packages (which we do not recommend) or
123
- * asking the author of the third-party package to upgrade its depdendencies (or forking their project and doing this yourself).
124
- *
125
- * **Note:** All official CKEditor 5 packages (excluding integrations and `ckeditor5-dev-*` packages) are released in the
126
- * same major version. This is &mdash; in the `x.y.z`, the `x` is the same for all packages. This is the simplest way to check
127
- * whether you use packages coming from the same CKEditor 5 version. You can read more about versioning in the
128
- * {@glink updating/versioning-policy Versioning policy} guide.
129
- *
130
- * # Packages were duplicated in `node_modules`
131
- *
132
- * In some situations, especially when calling `npm install` multiple times, it may happen
133
- * that npm will not correctly "deduplicate" packages.
134
- *
135
- * Normally, npm deduplicates all packages so, for example, `@ckeditor/ckeditor5-core` is installed only once in `node_modules/`.
136
- * However, it is known to fail to do so from time to time.
137
- *
138
- * We recommend checking if any of the steps listed below help:
139
- *
140
- * * `rm -rf node_modules && npm install` to make sure you have a clean `node_modules/` directory. This step
141
- * is known to help in most cases.
142
- * * If you use `yarn.lock` or `package-lock.json`, remove it before `npm install`.
143
- * * Check whether all CKEditor 5 packages are up to date and reinstall them
144
- * if you changed anything (`rm -rf node_modules && npm install`).
145
- *
146
- * If all packages are correct and compatible with each other, the steps above are known to help. If not, you may
147
- * try to check with `npm ls` how many times packages like `@ckeditor/ckeditor5-core`, `@ckeditor/ckeditor5-engine` and
148
- *`@ckeditor/ckeditor5-utils` are installed. If more than once, verify which package causes that.
149
- *
150
- * @error ckeditor-duplicated-modules
151
- */
152
- throw new CKEditorError('ckeditor-duplicated-modules', null);
153
- }
154
- else {
155
- windowOrGlobal.CKEDITOR_VERSION = version;
156
- }
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
+ * @module utils/version
7
+ */
8
+ import CKEditorError from './ckeditorerror';
9
+ const version = '40.0.0';
10
+ export default version;
11
+ // The second argument is not a month. It is `monthIndex` and starts from `0`.
12
+ export const releaseDate = new Date(2023, 9, 4);
13
+ /* istanbul ignore next -- @preserve */
14
+ if (globalThis.CKEDITOR_VERSION) {
15
+ /**
16
+ * This error is thrown when due to a mistake in how CKEditor 5 was installed or initialized, some
17
+ * of its modules were duplicated (evaluated and executed twice). Module duplication leads to inevitable runtime
18
+ * errors.
19
+ *
20
+ * There are many situations in which some modules can be loaded twice. In the worst case scenario,
21
+ * you may need to check your project for each of these issues and fix them all.
22
+ *
23
+ * # Trying to add a plugin to an existing build
24
+ *
25
+ * If you import an existing CKEditor 5 build and a plugin like this:
26
+ *
27
+ * ```ts
28
+ * import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
29
+ * import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight';
30
+ * ```
31
+ *
32
+ * Then your project loads some CKEditor 5 packages twice. How does it happen?
33
+ *
34
+ * The build package contains a file which is already compiled with webpack. This means
35
+ * that it contains all the necessary code from e.g. `@ckeditor/ckeditor5-engine` and `@ckeditor/ckeditor5-utils`.
36
+ *
37
+ * However, the `Highlight` plugin imports some of the modules from these packages, too. If you ask webpack to
38
+ * build such a project, you will end up with the modules being included (and run) twice &mdash; first, because they are
39
+ * included inside the build package, and second, because they are required by the `Highlight` plugin.
40
+ *
41
+ * Therefore, **you must never add plugins to an existing build** unless your plugin has no dependencies.
42
+ *
43
+ * Adding plugins to a build is done by taking the source version of this build (so, before it was built with webpack)
44
+ * and adding plugins there. In this situation, webpack will know that it only needs to load each plugin once.
45
+ *
46
+ * Read more in the {@glink installation/plugins/installing-plugins Installing plugins} guide.
47
+ *
48
+ * # Confused an editor build with an editor implementation
49
+ *
50
+ * This scenario is very similar to the previous one, but has a different origin.
51
+ *
52
+ * Let's assume that you wanted to use CKEditor 5 from source, as explained in the
53
+ * {@glink installation/advanced/alternative-setups/integrating-from-source-webpack "Building from source"} section
54
+ * or in the {@glink framework/quick-start "Quick start"} guide of CKEditor 5 Framework.
55
+ *
56
+ * The correct way to do so is to import an editor and plugins and run them together like this:
57
+ *
58
+ * ```ts
59
+ * import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
60
+ * import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
61
+ * import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
62
+ * import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
63
+ * import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
64
+ *
65
+ * ClassicEditor
66
+ * .create( document.querySelector( '#editor' ), {
67
+ * plugins: [ Essentials, Paragraph, Bold, Italic ],
68
+ * toolbar: [ 'bold', 'italic' ]
69
+ * } )
70
+ * .then( editor => {
71
+ * console.log( 'Editor was initialized', editor );
72
+ * } )
73
+ * .catch( error => {
74
+ * console.error( error.stack );
75
+ * } );
76
+ * ```
77
+ *
78
+ * However, you might have mistakenly imported a build instead of the source `ClassicEditor`. In this case
79
+ * your imports will look like this:
80
+ *
81
+ * ```ts
82
+ * import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
83
+ * import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
84
+ * import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
85
+ * import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
86
+ * import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
87
+ * ```
88
+ *
89
+ * This creates the same situation as in the previous section because you use a build together with source plugins.
90
+ *
91
+ * Remember: `@ckeditor/ckeditor5-build-*` packages contain editor builds and `@ckeditor/ckeditor5-editor-*` contain source editors.
92
+ *
93
+ * # Loading two or more builds on one page
94
+ *
95
+ * If you use CKEditor 5 builds, you might have loaded two (or more) `ckeditor.js` files on one web page.
96
+ * Check your web page for duplicated `<script>` elements or make sure your page builder/bundler includes CKEditor only once.
97
+ *
98
+ * If you want to use two different types of editors at once, see the
99
+ * {@glink installation/advanced/using-two-editors "Using two different editors"}
100
+ * section.
101
+ *
102
+ * # Using outdated packages
103
+ *
104
+ * Building CKEditor 5 from source requires using multiple npm packages. These packages have their dependencies
105
+ * to other packages. If you use the latest version of, for example, `@ckeditor/ckeditor5-editor-classic` with
106
+ * an outdated version of `@ckeditor/ckeditor5-image`, npm or yarn will need to install two different versions of
107
+ * `@ckeditor/ckeditor5-core` because `@ckeditor/ckeditor5-editor-classic` and `@ckeditor/ckeditor5-image` may require
108
+ * different versions of the core package.
109
+ *
110
+ * The solution to this issue is to update all packages to their latest version. We recommend
111
+ * using tools like [`npm-check-updates`](https://www.npmjs.com/package/npm-check-updates) which simplify this process.
112
+ *
113
+ * # Conflicting version of dependencies
114
+ *
115
+ * This is a special case of the previous scenario. If you use CKEditor 5 with some third-party plugins,
116
+ * it may happen that even if you use the latest versions of the official packages and the latest version of
117
+ * these third-party packages, there will be a conflict between some of their dependencies.
118
+ *
119
+ * Such a problem can be resolved by either downgrading CKEditor 5 packages (which we do not recommend) or
120
+ * asking the author of the third-party package to upgrade its depdendencies (or forking their project and doing this yourself).
121
+ *
122
+ * **Note:** All official CKEditor 5 packages (excluding integrations and `ckeditor5-dev-*` packages) are released in the
123
+ * same major version. This is &mdash; in the `x.y.z`, the `x` is the same for all packages. This is the simplest way to check
124
+ * whether you use packages coming from the same CKEditor 5 version. You can read more about versioning in the
125
+ * {@glink updating/versioning-policy Versioning policy} guide.
126
+ *
127
+ * # Packages were duplicated in `node_modules`
128
+ *
129
+ * In some situations, especially when calling `npm install` multiple times, it may happen
130
+ * that npm will not correctly "deduplicate" packages.
131
+ *
132
+ * Normally, npm deduplicates all packages so, for example, `@ckeditor/ckeditor5-core` is installed only once in `node_modules/`.
133
+ * However, it is known to fail to do so from time to time.
134
+ *
135
+ * We recommend checking if any of the steps listed below help:
136
+ *
137
+ * * `rm -rf node_modules && npm install` to make sure you have a clean `node_modules/` directory. This step
138
+ * is known to help in most cases.
139
+ * * If you use `yarn.lock` or `package-lock.json`, remove it before `npm install`.
140
+ * * Check whether all CKEditor 5 packages are up to date and reinstall them
141
+ * if you changed anything (`rm -rf node_modules && npm install`).
142
+ *
143
+ * If all packages are correct and compatible with each other, the steps above are known to help. If not, you may
144
+ * try to check with `npm ls` how many times packages like `@ckeditor/ckeditor5-core`, `@ckeditor/ckeditor5-engine` and
145
+ *`@ckeditor/ckeditor5-utils` are installed. If more than once, verify which package causes that.
146
+ *
147
+ * @error ckeditor-duplicated-modules
148
+ */
149
+ throw new CKEditorError('ckeditor-duplicated-modules', null);
150
+ }
151
+ else {
152
+ globalThis.CKEDITOR_VERSION = version;
153
+ }
@@ -1,17 +0,0 @@
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
- * @module utils/dom/getelementsintersectionrect
7
- */
8
- import Rect from './rect';
9
- /**
10
- * Calculates the intersection `Rect` of a given set of elements (and/or a `document`).
11
- * Also, takes into account the viewport top offset configuration.
12
- *
13
- * @internal
14
- * @param elements
15
- * @param viewportTopOffset
16
- */
17
- export default function getElementsIntersectionRect(elements: Array<HTMLElement | Document>, viewportTopOffset?: number): Rect | null;
@@ -1,42 +0,0 @@
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
- * @module utils/dom/getelementsintersectionrect
7
- */
8
- import Rect from './rect';
9
- /**
10
- * Calculates the intersection `Rect` of a given set of elements (and/or a `document`).
11
- * Also, takes into account the viewport top offset configuration.
12
- *
13
- * @internal
14
- * @param elements
15
- * @param viewportTopOffset
16
- */
17
- export default function getElementsIntersectionRect(elements, viewportTopOffset = 0) {
18
- const elementRects = elements.map(element => {
19
- // The document (window) is yet another "element", but cropped by the top offset.
20
- if (element instanceof Document) {
21
- const windowRect = new Rect(global.window);
22
- windowRect.top += viewportTopOffset;
23
- windowRect.height -= viewportTopOffset;
24
- return windowRect;
25
- }
26
- else {
27
- return new Rect(element);
28
- }
29
- });
30
- let intersectionRect = elementRects[0];
31
- // @if CK_DEBUG_GETELEMENTSINTERSECTIONRECT // for ( const rect of elementRects ) {
32
- // @if CK_DEBUG_GETELEMENTSINTERSECTIONRECT // RectDrawer.draw( rect, {
33
- // @if CK_DEBUG_GETELEMENTSINTERSECTIONRECT // outlineWidth: '1px', opacity: '.7', outlineStyle: 'dashed'
34
- // @if CK_DEBUG_GETELEMENTSINTERSECTIONRECT // }, 'Scrollable element' );
35
- // @if CK_DEBUG_GETELEMENTSINTERSECTIONRECT // }
36
- for (const rect of elementRects.slice(1)) {
37
- if (intersectionRect) {
38
- intersectionRect = intersectionRect.getIntersection(rect);
39
- }
40
- }
41
- return intersectionRect;
42
- }
@@ -1,14 +0,0 @@
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
- * Loops over the given element's ancestors to find all the scrollable elements.
7
- *
8
- * **Note**: The `document` is always included in the returned array.
9
- *
10
- * @internal
11
- * @param element
12
- * @returns An array of scrollable element's ancestors (including the `document`).
13
- */
14
- export default function getScrollableAncestors(element: HTMLElement): Array<HTMLElement | Document>;
@@ -1,28 +0,0 @@
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
- * @module utils/dom/getscrollableancestors
7
- */
8
- import global from './global';
9
- import findClosestScrollableAncestor from './findclosestscrollableancestor';
10
- /**
11
- * Loops over the given element's ancestors to find all the scrollable elements.
12
- *
13
- * **Note**: The `document` is always included in the returned array.
14
- *
15
- * @internal
16
- * @param element
17
- * @returns An array of scrollable element's ancestors (including the `document`).
18
- */
19
- export default function getScrollableAncestors(element) {
20
- const scrollableAncestors = [];
21
- let scrollableAncestor = findClosestScrollableAncestor(element);
22
- while (scrollableAncestor && scrollableAncestor !== global.document.body) {
23
- scrollableAncestors.push(scrollableAncestor);
24
- scrollableAncestor = findClosestScrollableAncestor(scrollableAncestor);
25
- }
26
- scrollableAncestors.push(global.document);
27
- return scrollableAncestors;
28
- }