@ckeditor/ckeditor5-utils 40.0.0 → 40.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +26 -26
  2. package/LICENSE.md +3 -3
  3. package/package.json +1 -1
  4. package/src/abortabledebounce.d.ts +17 -0
  5. package/src/abortabledebounce.js +22 -0
  6. package/src/areconnectedthroughproperties.d.ts +11 -11
  7. package/src/areconnectedthroughproperties.js +73 -73
  8. package/src/ckeditorerror.d.ts +123 -123
  9. package/src/ckeditorerror.js +176 -176
  10. package/src/collection.d.ts +433 -427
  11. package/src/collection.js +583 -575
  12. package/src/comparearrays.d.ts +30 -30
  13. package/src/comparearrays.js +47 -47
  14. package/src/config.d.ts +163 -163
  15. package/src/config.js +163 -162
  16. package/src/count.d.ts +18 -18
  17. package/src/count.js +24 -24
  18. package/src/delay.d.ts +19 -19
  19. package/src/delay.js +26 -26
  20. package/src/diff.d.ts +31 -31
  21. package/src/diff.js +115 -115
  22. package/src/difftochanges.d.ts +59 -59
  23. package/src/difftochanges.js +79 -79
  24. package/src/dom/createelement.d.ts +57 -57
  25. package/src/dom/createelement.js +40 -40
  26. package/src/dom/emittermixin.d.ts +142 -142
  27. package/src/dom/emittermixin.js +239 -239
  28. package/src/dom/findclosestscrollableancestor.d.ts +11 -11
  29. package/src/dom/findclosestscrollableancestor.js +31 -31
  30. package/src/dom/getancestors.d.ts +17 -17
  31. package/src/dom/getancestors.js +27 -27
  32. package/src/dom/getborderwidths.d.ts +24 -24
  33. package/src/dom/getborderwidths.js +24 -24
  34. package/src/dom/getcommonancestor.d.ts +12 -12
  35. package/src/dom/getcommonancestor.js +25 -25
  36. package/src/dom/getdatafromelement.d.ts +14 -14
  37. package/src/dom/getdatafromelement.js +20 -20
  38. package/src/dom/getpositionedancestor.d.ts +10 -10
  39. package/src/dom/getpositionedancestor.js +22 -22
  40. package/src/dom/global.d.ts +32 -32
  41. package/src/dom/global.js +35 -35
  42. package/src/dom/indexof.d.ts +14 -14
  43. package/src/dom/indexof.js +21 -21
  44. package/src/dom/insertat.d.ts +15 -15
  45. package/src/dom/insertat.js +17 -17
  46. package/src/dom/iscomment.d.ts +11 -11
  47. package/src/dom/iscomment.js +14 -14
  48. package/src/dom/isnode.d.ts +11 -11
  49. package/src/dom/isnode.js +21 -21
  50. package/src/dom/isrange.d.ts +11 -11
  51. package/src/dom/isrange.js +13 -13
  52. package/src/dom/istext.d.ts +11 -11
  53. package/src/dom/istext.js +13 -13
  54. package/src/dom/isvalidattributename.d.ts +10 -10
  55. package/src/dom/isvalidattributename.js +22 -22
  56. package/src/dom/isvisible.d.ts +18 -18
  57. package/src/dom/isvisible.js +20 -20
  58. package/src/dom/iswindow.d.ts +11 -11
  59. package/src/dom/iswindow.js +22 -22
  60. package/src/dom/position.d.ts +211 -211
  61. package/src/dom/position.js +313 -313
  62. package/src/dom/rect.d.ts +195 -195
  63. package/src/dom/rect.js +474 -474
  64. package/src/dom/remove.d.ts +13 -13
  65. package/src/dom/remove.js +18 -18
  66. package/src/dom/resizeobserver.d.ts +74 -74
  67. package/src/dom/resizeobserver.js +126 -126
  68. package/src/dom/scroll.d.ts +73 -73
  69. package/src/dom/scroll.js +383 -383
  70. package/src/dom/setdatainelement.d.ts +14 -14
  71. package/src/dom/setdatainelement.js +20 -20
  72. package/src/dom/tounit.d.ts +22 -22
  73. package/src/dom/tounit.js +16 -16
  74. package/src/elementreplacer.d.ts +31 -31
  75. package/src/elementreplacer.js +43 -43
  76. package/src/emittermixin.d.ts +312 -312
  77. package/src/emittermixin.js +453 -453
  78. package/src/env.d.ts +117 -117
  79. package/src/env.js +122 -122
  80. package/src/eventinfo.d.ts +58 -58
  81. package/src/eventinfo.js +26 -26
  82. package/src/fastdiff.d.ts +112 -112
  83. package/src/fastdiff.js +248 -248
  84. package/src/first.d.ts +11 -11
  85. package/src/first.js +17 -17
  86. package/src/focustracker.d.ts +75 -75
  87. package/src/focustracker.js +95 -95
  88. package/src/index.d.ts +64 -61
  89. package/src/index.js +63 -60
  90. package/src/inserttopriorityarray.d.ts +30 -30
  91. package/src/inserttopriorityarray.js +21 -21
  92. package/src/isiterable.d.ts +14 -14
  93. package/src/isiterable.js +16 -16
  94. package/src/keyboard.d.ts +126 -126
  95. package/src/keyboard.js +221 -221
  96. package/src/keystrokehandler.d.ts +87 -87
  97. package/src/keystrokehandler.js +122 -122
  98. package/src/language.d.ts +17 -17
  99. package/src/language.js +19 -19
  100. package/src/locale.d.ts +120 -120
  101. package/src/locale.js +76 -76
  102. package/src/mapsequal.d.ts +15 -15
  103. package/src/mapsequal.js +27 -27
  104. package/src/mix.d.ts +85 -85
  105. package/src/mix.js +50 -50
  106. package/src/nth.d.ts +16 -16
  107. package/src/nth.js +24 -24
  108. package/src/objecttomap.d.ts +23 -23
  109. package/src/objecttomap.js +27 -27
  110. package/src/observablemixin.d.ts +560 -560
  111. package/src/observablemixin.js +580 -580
  112. package/src/priorities.d.ts +33 -33
  113. package/src/priorities.js +23 -23
  114. package/src/retry.d.ts +33 -0
  115. package/src/retry.js +47 -0
  116. package/src/splicearray.d.ts +26 -26
  117. package/src/splicearray.js +40 -40
  118. package/src/spy.d.ts +21 -21
  119. package/src/spy.js +22 -22
  120. package/src/toarray.d.ts +25 -25
  121. package/src/toarray.js +7 -7
  122. package/src/tomap.d.ts +19 -19
  123. package/src/tomap.js +29 -29
  124. package/src/translation-service.d.ts +168 -168
  125. package/src/translation-service.js +198 -198
  126. package/src/uid.d.ts +15 -15
  127. package/src/uid.js +57 -57
  128. package/src/unicode.d.ts +54 -54
  129. package/src/unicode.js +85 -85
  130. package/src/verifylicense.d.ts +15 -15
  131. package/src/verifylicense.js +87 -87
  132. package/src/version.d.ts +10 -10
  133. package/src/version.js +153 -153
  134. package/src/wait.d.ts +16 -0
  135. package/src/wait.js +29 -0
package/CHANGELOG.md CHANGED
@@ -5,7 +5,7 @@ All changes in the package are documented in the main repository. See: https://g
5
5
 
6
6
  Changes for the past releases are available below.
7
7
 
8
- ## [19.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v18.0.0...v19.0.0) (2020-04-29)
8
+ ## [19.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v18.0.0...v19.0.0) (April 29, 2020)
9
9
 
10
10
  ### MINOR BREAKING CHANGES
11
11
 
@@ -35,12 +35,12 @@ Changes for the past releases are available below.
35
35
  * The `getPositionedAncestor()` helper should use `offsetParent` instead of `getComputedStyle()` for performance reasons. Closes [ckeditor/ckeditor5#6573](https://github.com/ckeditor/ckeditor5/issues/6573). ([7939756](https://github.com/ckeditor/ckeditor5-utils/commit/7939756))
36
36
 
37
37
 
38
- ## [18.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v17.0.0...v18.0.0) (2020-03-19)
38
+ ## [18.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v17.0.0...v18.0.0) (March 19, 2020)
39
39
 
40
40
  Internal changes only (updated dependencies, documentation, etc.).
41
41
 
42
42
 
43
- ## [17.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v16.0.0...v17.0.0) (2020-02-19)
43
+ ## [17.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v16.0.0...v17.0.0) (February 19, 2020)
44
44
 
45
45
  ### MINOR BREAKING CHANGES
46
46
 
@@ -57,14 +57,14 @@ Internal changes only (updated dependencies, documentation, etc.).
57
57
  * The `uid()` helper should be a lot faster. Closes [ckeditor/ckeditor5#6188](https://github.com/ckeditor/ckeditor5/issues/6188). ([b57fc3f](https://github.com/ckeditor/ckeditor5-utils/commit/b57fc3f))
58
58
 
59
59
 
60
- ## [16.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v15.0.0...v16.0.0) (2019-12-04)
60
+ ## [16.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v15.0.0...v16.0.0) (December 4, 2019)
61
61
 
62
62
  ### Bug fixes
63
63
 
64
64
  * Improved error rethrowing by replacing the error stack. Closes [ckeditor/ckeditor5#5595](https://github.com/ckeditor/ckeditor5/issues/5595). ([7685c0d](https://github.com/ckeditor/ckeditor5-utils/commit/7685c0d))
65
65
 
66
66
 
67
- ## [15.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v14.0.0...v15.0.0) (2019-10-23)
67
+ ## [15.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v14.0.0...v15.0.0) (October 23, 2019)
68
68
 
69
69
  ### Features
70
70
 
@@ -83,7 +83,7 @@ Internal changes only (updated dependencies, documentation, etc.).
83
83
  * Introduced the `CKEditorError.rethrowUnexpectedError()` helper. Added custom error handling for the `Emitter#fire()` function. Part of [ckeditor/ckeditor5#1304](https://github.com/ckeditor/ckeditor5/issues/1304). ([1d84705](https://github.com/ckeditor/ckeditor5-utils/commit/1d84705))
84
84
 
85
85
 
86
- ## [14.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v13.0.1...v14.0.0) (2019-08-26)
86
+ ## [14.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v13.0.1...v14.0.0) (August 26, 2019)
87
87
 
88
88
  ### Features
89
89
 
@@ -102,12 +102,12 @@ Internal changes only (updated dependencies, documentation, etc.).
102
102
  * Removed the CKEditor 5 logger utility.
103
103
 
104
104
 
105
- ## [13.0.1](https://github.com/ckeditor/ckeditor5-utils/compare/v13.0.0...v13.0.1) (2019-07-10)
105
+ ## [13.0.1](https://github.com/ckeditor/ckeditor5-utils/compare/v13.0.0...v13.0.1) (July 10, 2019)
106
106
 
107
107
  Internal changes only (updated dependencies, documentation, etc.).
108
108
 
109
109
 
110
- ## [13.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v12.1.1...v13.0.0) (2019-07-04)
110
+ ## [13.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v12.1.1...v13.0.0) (July 4, 2019)
111
111
 
112
112
  ### Features
113
113
 
@@ -122,12 +122,12 @@ Internal changes only (updated dependencies, documentation, etc.).
122
122
  * The list of `CKEditorError()`'s parameters was changed – now it requires the message, context and then data. The `isCKEditorError()` method was renamed to `is()`.
123
123
 
124
124
 
125
- ## [12.1.1](https://github.com/ckeditor/ckeditor5-utils/compare/v12.1.0...v12.1.1) (2019-06-05)
125
+ ## [12.1.1](https://github.com/ckeditor/ckeditor5-utils/compare/v12.1.0...v12.1.1) (June 6, 2019)
126
126
 
127
127
  Internal changes only (updated dependencies, documentation, etc.).
128
128
 
129
129
 
130
- ## [12.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v12.0.0...v12.1.0) (2019-04-10)
130
+ ## [12.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v12.0.0...v12.1.0) (April 4, 2019)
131
131
 
132
132
  ### Features
133
133
 
@@ -135,7 +135,7 @@ Internal changes only (updated dependencies, documentation, etc.).
135
135
  * Made `FocusTracker#focusedElement` observable to bring support for multi-root editors (see [ckeditor/ckeditor5#1599](https://github.com/ckeditor/ckeditor5/issues/1599)). ([952d440](https://github.com/ckeditor/ckeditor5-utils/commit/952d440))
136
136
 
137
137
 
138
- ## [12.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v11.1.0...v12.0.0) (2019-02-28)
138
+ ## [12.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v11.1.0...v12.0.0) (February 28, 2019)
139
139
 
140
140
  ### Features
141
141
 
@@ -158,7 +158,7 @@ Internal changes only (updated dependencies, documentation, etc.).
158
158
  * Upgraded minimal versions of Node to `8.0.0` and npm to `5.7.1`. See: [ckeditor/ckeditor5#1507](https://github.com/ckeditor/ckeditor5/issues/1507). ([612ea3c](https://github.com/ckeditor/ckeditor5-cloud-services/commit/612ea3c))
159
159
 
160
160
 
161
- ## [11.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v11.0.0...v11.1.0) (2018-12-05)
161
+ ## [11.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v11.0.0...v11.1.0) (December 5, 2018)
162
162
 
163
163
  ### Features
164
164
 
@@ -169,7 +169,7 @@ Internal changes only (updated dependencies, documentation, etc.).
169
169
  * Various fixes in the API docs. Thanks to [@denisname](https://github.com/denisname)!
170
170
 
171
171
 
172
- ## [11.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.2.1...v11.0.0) (2018-10-08)
172
+ ## [11.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.2.1...v11.0.0) (October 8, 2018)
173
173
 
174
174
  ### Other changes
175
175
 
@@ -180,12 +180,12 @@ Internal changes only (updated dependencies, documentation, etc.).
180
180
  * Removed the `lodash` library from this package (a modular `lodash` build has been kept under `src/lib/lodash/`). We now recommend using `lodash-es` directly.
181
181
 
182
182
 
183
- ## [10.2.1](https://github.com/ckeditor/ckeditor5-utils/compare/v10.2.0...v10.2.1) (2018-07-18)
183
+ ## [10.2.1](https://github.com/ckeditor/ckeditor5-utils/compare/v10.2.0...v10.2.1) (July 18, 2018)
184
184
 
185
185
  Internal changes only (updated dependencies, documentation, etc.).
186
186
 
187
187
 
188
- ## [10.2.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.1.0...v10.2.0) (2018-07-18)
188
+ ## [10.2.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.1.0...v10.2.0) (July 18, 2018)
189
189
 
190
190
  ### Features
191
191
 
@@ -197,7 +197,7 @@ Internal changes only (updated dependencies, documentation, etc.).
197
197
  * The `isWindow()` helper should work in the Electron environment. Closes [ckeditor/ckeditor5#879](https://github.com/ckeditor/ckeditor5/issues/879). ([d561151](https://github.com/ckeditor/ckeditor5-utils/commit/d561151))
198
198
 
199
199
 
200
- ## [10.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.0.0...v10.1.0) (2018-06-21)
200
+ ## [10.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.0.0...v10.1.0) (June 21, 2018)
201
201
 
202
202
  ### Features
203
203
 
@@ -209,7 +209,7 @@ Internal changes only (updated dependencies, documentation, etc.).
209
209
  * Error should not be thrown when scrolling the viewport from within an iframe in a different domain. Closes [ckeditor/ckeditor5#930](https://github.com/ckeditor/ckeditor5/issues/930). ([ad4656e](https://github.com/ckeditor/ckeditor5-utils/commit/ad4656e))
210
210
 
211
211
 
212
- ## [10.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.4...v10.0.0) (2018-04-25)
212
+ ## [10.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
213
213
 
214
214
  ### Other changes
215
215
 
@@ -220,17 +220,17 @@ Internal changes only (updated dependencies, documentation, etc.).
220
220
  * The license under which CKEditor 5 is released has been changed from a triple GPL, LGPL and MPL license to a GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991) for more information.
221
221
 
222
222
 
223
- ## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018-04-19)
223
+ ## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
224
224
 
225
225
  Internal changes only (updated dependencies, documentation, etc.).
226
226
 
227
227
 
228
- ## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018-04-10)
228
+ ## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
229
229
 
230
230
  Internal changes only (updated dependencies, documentation, etc.).
231
231
 
232
232
 
233
- ## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018-03-15)
233
+ ## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
234
234
 
235
235
  ### Features
236
236
 
@@ -260,14 +260,14 @@ Internal changes only (updated dependencies, documentation, etc.).
260
260
  * `isDomNode()` was renamed to `isNode()`.
261
261
 
262
262
 
263
- ## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017-11-14)
263
+ ## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-utils/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
264
264
 
265
265
  ### Bug fixes
266
266
 
267
267
  * Removed a period at the end of an error message because some browsers included the period in links to errors. Closes [#193](https://github.com/ckeditor/ckeditor5-utils/issues/193). ([fdebc2f](https://github.com/ckeditor/ckeditor5-utils/commit/fdebc2f))
268
268
 
269
269
 
270
- ## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-utils/compare/v0.10.0...v1.0.0-alpha.1) (2017-10-03)
270
+ ## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-utils/compare/v0.10.0...v1.0.0-alpha.1) (October 3, 2017)
271
271
 
272
272
  ### Features
273
273
 
@@ -278,7 +278,7 @@ Internal changes only (updated dependencies, documentation, etc.).
278
278
  * `CKEditorError#message`, `log.error()` and `log.warn()` will contain a link to the error documentation. Closes [#185](https://github.com/ckeditor/ckeditor5-utils/issues/185). ([b7a00c9](https://github.com/ckeditor/ckeditor5-utils/commit/b7a00c9))
279
279
 
280
280
 
281
- ## [0.10.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.9.1...v0.10.0) (2017-09-03)
281
+ ## [0.10.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.9.1...v0.10.0) (September 3, 2017)
282
282
 
283
283
  ### Bug fixes
284
284
 
@@ -296,7 +296,7 @@ Internal changes only (updated dependencies, documentation, etc.).
296
296
  * The `getOptimalPosition()` utility should accept the target option defined as a function. Closes [#157](https://github.com/ckeditor/ckeditor5-utils/issues/157). ([d63abae](https://github.com/ckeditor/ckeditor5-utils/commit/d63abae))
297
297
 
298
298
 
299
- ## [0.9.1](https://github.com/ckeditor/ckeditor5-utils/compare/v0.9.0...v0.9.1) (2017-05-07)
299
+ ## [0.9.1](https://github.com/ckeditor/ckeditor5-utils/compare/v0.9.0...v0.9.1) (May 7, 2017)
300
300
 
301
301
  ### Bug fixes
302
302
 
@@ -304,7 +304,7 @@ Internal changes only (updated dependencies, documentation, etc.).
304
304
  * The `getOptimalPosition()` utility should consider limiter ancestors with CSS overflow. Closes [#148](https://github.com/ckeditor/ckeditor5-utils/issues/148). ([6bf1741](https://github.com/ckeditor/ckeditor5-utils/commit/6bf1741))
305
305
 
306
306
 
307
- ## [0.9.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.8.0...v0.9.0) (2017-04-05)
307
+ ## [0.9.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.8.0...v0.9.0) (April 5, 2017)
308
308
 
309
309
  ### Bug fixes
310
310
 
@@ -317,7 +317,7 @@ Internal changes only (updated dependencies, documentation, etc.).
317
317
  * Two–way data binding between `Collection` instances. Closes [#132](https://github.com/ckeditor/ckeditor5-utils/issues/132). ([6b79624](https://github.com/ckeditor/ckeditor5-utils/commit/6b79624))
318
318
 
319
319
 
320
- ## [0.8.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.7.0...v0.8.0) (2017-03-06)
320
+ ## [0.8.0](https://github.com/ckeditor/ckeditor5-utils/compare/v0.7.0...v0.8.0) (March 6, 2017)
321
321
 
322
322
  ### Features
323
323
 
package/LICENSE.md CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor&nbsp;5 utilities** – https://github.com/ckeditor/ckeditor5-utils <br>
5
- Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 20032023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
8
 
@@ -13,9 +13,9 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
13
13
 
14
14
  The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
15
15
 
16
- * lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
16
+ * Lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
17
17
 
18
18
  Trademarks
19
19
  ----------
20
20
 
21
- **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
21
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-utils",
3
- "version": "40.0.0",
3
+ "version": "40.2.0",
4
4
  "description": "Miscellaneous utilities used by CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -0,0 +1,17 @@
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/abortabledebounce
7
+ */
8
+ /**
9
+ * Returns a function wrapper that will execute the provided function and abort any previous call that is still in progress.
10
+ *
11
+ * @param func The function to be called. It will be provided with `AbortSignal` as the first parameter.
12
+ */
13
+ export default function abortableDebounce<Args extends Array<any>, Ret>(func: (signal: AbortSignal, ...args: Args) => Ret): AbortableFunc<Args, Ret>;
14
+ export interface AbortableFunc<Args extends Array<any>, Ret> {
15
+ (...args: Args): Ret;
16
+ abort(): void;
17
+ }
@@ -0,0 +1,22 @@
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/abortabledebounce
7
+ */
8
+ /**
9
+ * Returns a function wrapper that will execute the provided function and abort any previous call that is still in progress.
10
+ *
11
+ * @param func The function to be called. It will be provided with `AbortSignal` as the first parameter.
12
+ */
13
+ export default function abortableDebounce(func) {
14
+ let controller = new AbortController();
15
+ function abortable(...args) {
16
+ controller.abort();
17
+ controller = new AbortController();
18
+ return func(controller.signal, ...args);
19
+ }
20
+ abortable.abort = () => controller.abort();
21
+ return abortable;
22
+ }
@@ -1,11 +1,11 @@
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/areconnectedthroughproperties
7
- */
8
- /**
9
- * Traverses both structures to find out whether there is a reference that is shared between both structures.
10
- */
11
- export default function areConnectedThroughProperties(obj1: object, obj2: object): boolean;
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/areconnectedthroughproperties
7
+ */
8
+ /**
9
+ * Traverses both structures to find out whether there is a reference that is shared between both structures.
10
+ */
11
+ export default function areConnectedThroughProperties(obj1: object, obj2: object): boolean;
@@ -1,73 +1,73 @@
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/areconnectedthroughproperties
7
- */
8
- /* globals EventTarget, Event */
9
- /**
10
- * Traverses both structures to find out whether there is a reference that is shared between both structures.
11
- */
12
- export default function areConnectedThroughProperties(obj1, obj2) {
13
- if (obj1 === obj2 && isObject(obj1)) {
14
- return true;
15
- }
16
- const subNodes1 = getSubNodes(obj1);
17
- const subNodes2 = getSubNodes(obj2);
18
- for (const node of subNodes1) {
19
- if (subNodes2.has(node)) {
20
- return true;
21
- }
22
- }
23
- return false;
24
- }
25
- /**
26
- * Traverses JS structure and stores all sub-nodes, including the head node.
27
- * It walks into each iterable structures with the `try catch` block to omit errors that might be thrown during
28
- * tree walking. All primitives, functions and built-ins are skipped.
29
- */
30
- function getSubNodes(head) {
31
- const nodes = [head];
32
- // Nodes are stored to prevent infinite looping.
33
- const subNodes = new Set();
34
- while (nodes.length > 0) {
35
- const node = nodes.shift();
36
- if (subNodes.has(node) || shouldNodeBeSkipped(node)) {
37
- continue;
38
- }
39
- subNodes.add(node);
40
- // Handle arrays, maps, sets, custom collections that implements `[ Symbol.iterator ]()`, etc.
41
- if (node[Symbol.iterator]) {
42
- // The custom editor iterators might cause some problems if the editor is crashed.
43
- try {
44
- nodes.push(...node);
45
- }
46
- catch (err) {
47
- // eslint-disable-line no-empty
48
- }
49
- }
50
- else {
51
- nodes.push(...Object.values(node));
52
- }
53
- }
54
- return subNodes;
55
- }
56
- function shouldNodeBeSkipped(node) {
57
- const type = Object.prototype.toString.call(node);
58
- return (type === '[object Number]' ||
59
- type === '[object Boolean]' ||
60
- type === '[object String]' ||
61
- type === '[object Symbol]' ||
62
- type === '[object Function]' ||
63
- type === '[object Date]' ||
64
- type === '[object RegExp]' ||
65
- node === undefined ||
66
- node === null ||
67
- // Skip native DOM objects, e.g. Window, nodes, events, etc.
68
- node instanceof EventTarget ||
69
- node instanceof Event);
70
- }
71
- function isObject(structure) {
72
- return typeof structure === 'object' && structure !== null;
73
- }
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/areconnectedthroughproperties
7
+ */
8
+ /* globals EventTarget, Event */
9
+ /**
10
+ * Traverses both structures to find out whether there is a reference that is shared between both structures.
11
+ */
12
+ export default function areConnectedThroughProperties(obj1, obj2) {
13
+ if (obj1 === obj2 && isObject(obj1)) {
14
+ return true;
15
+ }
16
+ const subNodes1 = getSubNodes(obj1);
17
+ const subNodes2 = getSubNodes(obj2);
18
+ for (const node of subNodes1) {
19
+ if (subNodes2.has(node)) {
20
+ return true;
21
+ }
22
+ }
23
+ return false;
24
+ }
25
+ /**
26
+ * Traverses JS structure and stores all sub-nodes, including the head node.
27
+ * It walks into each iterable structures with the `try catch` block to omit errors that might be thrown during
28
+ * tree walking. All primitives, functions and built-ins are skipped.
29
+ */
30
+ function getSubNodes(head) {
31
+ const nodes = [head];
32
+ // Nodes are stored to prevent infinite looping.
33
+ const subNodes = new Set();
34
+ while (nodes.length > 0) {
35
+ const node = nodes.shift();
36
+ if (subNodes.has(node) || shouldNodeBeSkipped(node)) {
37
+ continue;
38
+ }
39
+ subNodes.add(node);
40
+ // Handle arrays, maps, sets, custom collections that implements `[ Symbol.iterator ]()`, etc.
41
+ if (node[Symbol.iterator]) {
42
+ // The custom editor iterators might cause some problems if the editor is crashed.
43
+ try {
44
+ nodes.push(...node);
45
+ }
46
+ catch (err) {
47
+ // eslint-disable-line no-empty
48
+ }
49
+ }
50
+ else {
51
+ nodes.push(...Object.values(node));
52
+ }
53
+ }
54
+ return subNodes;
55
+ }
56
+ function shouldNodeBeSkipped(node) {
57
+ const type = Object.prototype.toString.call(node);
58
+ return (type === '[object Number]' ||
59
+ type === '[object Boolean]' ||
60
+ type === '[object String]' ||
61
+ type === '[object Symbol]' ||
62
+ type === '[object Function]' ||
63
+ type === '[object Date]' ||
64
+ type === '[object RegExp]' ||
65
+ node === undefined ||
66
+ node === null ||
67
+ // Skip native DOM objects, e.g. Window, nodes, events, etc.
68
+ node instanceof EventTarget ||
69
+ node instanceof Event);
70
+ }
71
+ function isObject(structure) {
72
+ return typeof structure === 'object' && structure !== null;
73
+ }