@ckeditor/ckeditor5-utils 0.0.0-internal-20241017.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 (213) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +22 -0
  4. package/dist/abortabledebounce.d.ts +21 -0
  5. package/dist/areconnectedthroughproperties.d.ts +15 -0
  6. package/dist/ckeditorerror.d.ts +127 -0
  7. package/dist/collection.d.ts +437 -0
  8. package/dist/comparearrays.d.ts +34 -0
  9. package/dist/config.d.ts +167 -0
  10. package/dist/count.d.ts +22 -0
  11. package/dist/crc32.d.ts +30 -0
  12. package/dist/delay.d.ts +23 -0
  13. package/dist/diff.d.ts +35 -0
  14. package/dist/difftochanges.d.ts +63 -0
  15. package/dist/dom/createelement.d.ts +61 -0
  16. package/dist/dom/emittermixin.d.ts +146 -0
  17. package/dist/dom/findclosestscrollableancestor.d.ts +15 -0
  18. package/dist/dom/getancestors.d.ts +21 -0
  19. package/dist/dom/getborderwidths.d.ts +28 -0
  20. package/dist/dom/getcommonancestor.d.ts +16 -0
  21. package/dist/dom/getdatafromelement.d.ts +18 -0
  22. package/dist/dom/getpositionedancestor.d.ts +14 -0
  23. package/dist/dom/getrangefrommouseevent.d.ts +21 -0
  24. package/dist/dom/global.d.ts +36 -0
  25. package/dist/dom/indexof.d.ts +18 -0
  26. package/dist/dom/insertat.d.ts +19 -0
  27. package/dist/dom/iscomment.d.ts +15 -0
  28. package/dist/dom/isnode.d.ts +15 -0
  29. package/dist/dom/isrange.d.ts +15 -0
  30. package/dist/dom/istext.d.ts +15 -0
  31. package/dist/dom/isvalidattributename.d.ts +14 -0
  32. package/dist/dom/isvisible.d.ts +19 -0
  33. package/dist/dom/iswindow.d.ts +15 -0
  34. package/dist/dom/position.d.ts +215 -0
  35. package/dist/dom/rect.d.ts +199 -0
  36. package/dist/dom/remove.d.ts +17 -0
  37. package/dist/dom/resizeobserver.d.ts +78 -0
  38. package/dist/dom/scroll.d.ts +77 -0
  39. package/dist/dom/setdatainelement.d.ts +18 -0
  40. package/dist/dom/tounit.d.ts +26 -0
  41. package/dist/elementreplacer.d.ts +35 -0
  42. package/dist/emittermixin.d.ts +316 -0
  43. package/dist/env.d.ts +144 -0
  44. package/dist/eventinfo.d.ts +62 -0
  45. package/dist/fastdiff.d.ts +116 -0
  46. package/dist/first.d.ts +15 -0
  47. package/dist/focustracker.d.ts +83 -0
  48. package/dist/index-content.css +4 -0
  49. package/dist/index-editor.css +4 -0
  50. package/dist/index.css +4 -0
  51. package/dist/index.d.ts +70 -0
  52. package/dist/index.js +5871 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/inserttopriorityarray.d.ts +34 -0
  55. package/dist/isiterable.d.ts +18 -0
  56. package/dist/keyboard.d.ts +130 -0
  57. package/dist/keystrokehandler.d.ts +101 -0
  58. package/dist/language.d.ts +21 -0
  59. package/dist/locale.d.ts +145 -0
  60. package/dist/mapsequal.d.ts +19 -0
  61. package/dist/mix.d.ts +89 -0
  62. package/dist/nth.d.ts +20 -0
  63. package/dist/objecttomap.d.ts +27 -0
  64. package/dist/observablemixin.d.ts +564 -0
  65. package/dist/parsebase64encodedobject.d.ts +15 -0
  66. package/dist/priorities.d.ts +37 -0
  67. package/dist/retry.d.ts +37 -0
  68. package/dist/splicearray.d.ts +30 -0
  69. package/dist/spy.d.ts +25 -0
  70. package/dist/toarray.d.ts +29 -0
  71. package/dist/tomap.d.ts +23 -0
  72. package/dist/translation-service.d.ts +178 -0
  73. package/dist/uid.d.ts +19 -0
  74. package/dist/unicode.d.ts +58 -0
  75. package/dist/version.d.ts +14 -0
  76. package/dist/wait.d.ts +20 -0
  77. package/package.json +36 -0
  78. package/src/abortabledebounce.d.ts +17 -0
  79. package/src/abortabledebounce.js +22 -0
  80. package/src/areconnectedthroughproperties.d.ts +11 -0
  81. package/src/areconnectedthroughproperties.js +73 -0
  82. package/src/ckeditorerror.d.ts +123 -0
  83. package/src/ckeditorerror.js +176 -0
  84. package/src/collection.d.ts +433 -0
  85. package/src/collection.js +583 -0
  86. package/src/comparearrays.d.ts +30 -0
  87. package/src/comparearrays.js +47 -0
  88. package/src/config.d.ts +163 -0
  89. package/src/config.js +163 -0
  90. package/src/count.d.ts +18 -0
  91. package/src/count.js +25 -0
  92. package/src/crc32.d.ts +26 -0
  93. package/src/crc32.js +61 -0
  94. package/src/delay.d.ts +19 -0
  95. package/src/delay.js +26 -0
  96. package/src/diff.d.ts +31 -0
  97. package/src/diff.js +115 -0
  98. package/src/difftochanges.d.ts +59 -0
  99. package/src/difftochanges.js +79 -0
  100. package/src/dom/createelement.d.ts +57 -0
  101. package/src/dom/createelement.js +40 -0
  102. package/src/dom/emittermixin.d.ts +142 -0
  103. package/src/dom/emittermixin.js +239 -0
  104. package/src/dom/findclosestscrollableancestor.d.ts +11 -0
  105. package/src/dom/findclosestscrollableancestor.js +31 -0
  106. package/src/dom/getancestors.d.ts +17 -0
  107. package/src/dom/getancestors.js +27 -0
  108. package/src/dom/getborderwidths.d.ts +24 -0
  109. package/src/dom/getborderwidths.js +24 -0
  110. package/src/dom/getcommonancestor.d.ts +12 -0
  111. package/src/dom/getcommonancestor.js +25 -0
  112. package/src/dom/getdatafromelement.d.ts +14 -0
  113. package/src/dom/getdatafromelement.js +20 -0
  114. package/src/dom/getpositionedancestor.d.ts +10 -0
  115. package/src/dom/getpositionedancestor.js +22 -0
  116. package/src/dom/getrangefrommouseevent.d.ts +17 -0
  117. package/src/dom/getrangefrommouseevent.js +33 -0
  118. package/src/dom/global.d.ts +32 -0
  119. package/src/dom/global.js +35 -0
  120. package/src/dom/indexof.d.ts +14 -0
  121. package/src/dom/indexof.js +21 -0
  122. package/src/dom/insertat.d.ts +15 -0
  123. package/src/dom/insertat.js +17 -0
  124. package/src/dom/iscomment.d.ts +11 -0
  125. package/src/dom/iscomment.js +14 -0
  126. package/src/dom/isnode.d.ts +11 -0
  127. package/src/dom/isnode.js +21 -0
  128. package/src/dom/isrange.d.ts +11 -0
  129. package/src/dom/isrange.js +13 -0
  130. package/src/dom/istext.d.ts +11 -0
  131. package/src/dom/istext.js +13 -0
  132. package/src/dom/isvalidattributename.d.ts +10 -0
  133. package/src/dom/isvalidattributename.js +22 -0
  134. package/src/dom/isvisible.d.ts +15 -0
  135. package/src/dom/isvisible.js +30 -0
  136. package/src/dom/iswindow.d.ts +11 -0
  137. package/src/dom/iswindow.js +22 -0
  138. package/src/dom/position.d.ts +211 -0
  139. package/src/dom/position.js +313 -0
  140. package/src/dom/rect.d.ts +195 -0
  141. package/src/dom/rect.js +474 -0
  142. package/src/dom/remove.d.ts +13 -0
  143. package/src/dom/remove.js +18 -0
  144. package/src/dom/resizeobserver.d.ts +74 -0
  145. package/src/dom/resizeobserver.js +127 -0
  146. package/src/dom/scroll.d.ts +73 -0
  147. package/src/dom/scroll.js +383 -0
  148. package/src/dom/setdatainelement.d.ts +14 -0
  149. package/src/dom/setdatainelement.js +20 -0
  150. package/src/dom/tounit.d.ts +22 -0
  151. package/src/dom/tounit.js +16 -0
  152. package/src/elementreplacer.d.ts +31 -0
  153. package/src/elementreplacer.js +43 -0
  154. package/src/emittermixin.d.ts +312 -0
  155. package/src/emittermixin.js +453 -0
  156. package/src/env.d.ts +140 -0
  157. package/src/env.js +145 -0
  158. package/src/eventinfo.d.ts +58 -0
  159. package/src/eventinfo.js +26 -0
  160. package/src/fastdiff.d.ts +112 -0
  161. package/src/fastdiff.js +248 -0
  162. package/src/first.d.ts +11 -0
  163. package/src/first.js +17 -0
  164. package/src/focustracker.d.ts +79 -0
  165. package/src/focustracker.js +101 -0
  166. package/src/index.d.ts +66 -0
  167. package/src/index.js +65 -0
  168. package/src/inserttopriorityarray.d.ts +30 -0
  169. package/src/inserttopriorityarray.js +21 -0
  170. package/src/isiterable.d.ts +14 -0
  171. package/src/isiterable.js +16 -0
  172. package/src/keyboard.d.ts +126 -0
  173. package/src/keyboard.js +252 -0
  174. package/src/keystrokehandler.d.ts +97 -0
  175. package/src/keystrokehandler.js +122 -0
  176. package/src/language.d.ts +17 -0
  177. package/src/language.js +20 -0
  178. package/src/locale.d.ts +141 -0
  179. package/src/locale.js +78 -0
  180. package/src/mapsequal.d.ts +15 -0
  181. package/src/mapsequal.js +27 -0
  182. package/src/mix.d.ts +85 -0
  183. package/src/mix.js +50 -0
  184. package/src/nth.d.ts +16 -0
  185. package/src/nth.js +24 -0
  186. package/src/objecttomap.d.ts +23 -0
  187. package/src/objecttomap.js +27 -0
  188. package/src/observablemixin.d.ts +560 -0
  189. package/src/observablemixin.js +580 -0
  190. package/src/parsebase64encodedobject.d.ts +11 -0
  191. package/src/parsebase64encodedobject.js +22 -0
  192. package/src/priorities.d.ts +33 -0
  193. package/src/priorities.js +23 -0
  194. package/src/retry.d.ts +33 -0
  195. package/src/retry.js +47 -0
  196. package/src/splicearray.d.ts +26 -0
  197. package/src/splicearray.js +40 -0
  198. package/src/spy.d.ts +21 -0
  199. package/src/spy.js +22 -0
  200. package/src/toarray.d.ts +25 -0
  201. package/src/toarray.js +7 -0
  202. package/src/tomap.d.ts +19 -0
  203. package/src/tomap.js +29 -0
  204. package/src/translation-service.d.ts +174 -0
  205. package/src/translation-service.js +209 -0
  206. package/src/uid.d.ts +15 -0
  207. package/src/uid.js +45 -0
  208. package/src/unicode.d.ts +54 -0
  209. package/src/unicode.js +85 -0
  210. package/src/version.d.ts +10 -0
  211. package/src/version.js +179 -0
  212. package/src/wait.d.ts +16 -0
  213. package/src/wait.js +29 -0
package/dist/env.d.ts ADDED
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * Safely returns `userAgent` from browser's navigator API in a lower case.
11
+ * If navigator API is not available it will return an empty string.
12
+ */
13
+ export declare function getUserAgent(): string;
14
+ /**
15
+ * A namespace containing environment and browser information.
16
+ */
17
+ export interface EnvType {
18
+ /**
19
+ * Indicates that the application is running on Macintosh.
20
+ */
21
+ readonly isMac: boolean;
22
+ /**
23
+ * Indicates that the application is running on Windows.
24
+ */
25
+ readonly isWindows: boolean;
26
+ /**
27
+ * Indicates that the application is running in Firefox (Gecko).
28
+ */
29
+ readonly isGecko: boolean;
30
+ /**
31
+ * Indicates that the application is running in Safari.
32
+ */
33
+ readonly isSafari: boolean;
34
+ /**
35
+ * Indicates that the application is running in iOS.
36
+ */
37
+ readonly isiOS: boolean;
38
+ /**
39
+ * Indicates that the application is running on Android mobile device.
40
+ */
41
+ readonly isAndroid: boolean;
42
+ /**
43
+ * Indicates that the application is running in a browser using the Blink engine.
44
+ */
45
+ readonly isBlink: boolean;
46
+ /**
47
+ * Indicates that the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
48
+ *
49
+ * Note that the value of this property is evaluated each time it is accessed, and it may change over time, if the environment
50
+ * settings have changed.
51
+ */
52
+ readonly isMediaForcedColors: boolean;
53
+ /**
54
+ * Indicates that "prefer reduced motion" browser setting is active.
55
+ *
56
+ * Note that the value of this property is evaluated each time it is accessed, and it may change over time, if the environment
57
+ * settings have changed.
58
+ */
59
+ readonly isMotionReduced: boolean;
60
+ /**
61
+ * Environment features information.
62
+ */
63
+ readonly features: EnvFeaturesType;
64
+ }
65
+ export interface EnvFeaturesType {
66
+ /**
67
+ * Indicates that the environment supports ES2018 Unicode property escapes — like `\p{P}` or `\p{L}`.
68
+ * More information about unicode properties might be found
69
+ * [in Unicode Standard Annex #44](https://www.unicode.org/reports/tr44/#GC_Values_Table).
70
+ */
71
+ readonly isRegExpUnicodePropertySupported: boolean;
72
+ }
73
+ /**
74
+ * A namespace containing environment and browser information.
75
+ */
76
+ declare const env: EnvType;
77
+ export default env;
78
+ /**
79
+ * Checks if User Agent represented by the string is running on Macintosh.
80
+ *
81
+ * @param userAgent **Lowercase** `navigator.userAgent` string.
82
+ * @returns Whether User Agent is running on Macintosh or not.
83
+ */
84
+ export declare function isMac(userAgent: string): boolean;
85
+ /**
86
+ * Checks if User Agent represented by the string is running on Windows.
87
+ *
88
+ * @param userAgent **Lowercase** `navigator.userAgent` string.
89
+ * @returns Whether User Agent is running on Windows or not.
90
+ */
91
+ export declare function isWindows(userAgent: string): boolean;
92
+ /**
93
+ * Checks if User Agent represented by the string is Firefox (Gecko).
94
+ *
95
+ * @param userAgent **Lowercase** `navigator.userAgent` string.
96
+ * @returns Whether User Agent is Firefox or not.
97
+ */
98
+ export declare function isGecko(userAgent: string): boolean;
99
+ /**
100
+ * Checks if User Agent represented by the string is Safari.
101
+ *
102
+ * @param userAgent **Lowercase** `navigator.userAgent` string.
103
+ * @returns Whether User Agent is Safari or not.
104
+ */
105
+ export declare function isSafari(userAgent: string): boolean;
106
+ /**
107
+ * Checks if User Agent represented by the string is running in iOS.
108
+ *
109
+ * @param userAgent **Lowercase** `navigator.userAgent` string.
110
+ * @returns Whether User Agent is running in iOS or not.
111
+ */
112
+ export declare function isiOS(userAgent: string): boolean;
113
+ /**
114
+ * Checks if User Agent represented by the string is Android mobile device.
115
+ *
116
+ * @param userAgent **Lowercase** `navigator.userAgent` string.
117
+ * @returns Whether User Agent is Safari or not.
118
+ */
119
+ export declare function isAndroid(userAgent: string): boolean;
120
+ /**
121
+ * Checks if User Agent represented by the string is Blink engine.
122
+ *
123
+ * @param userAgent **Lowercase** `navigator.userAgent` string.
124
+ * @returns Whether User Agent is Blink engine or not.
125
+ */
126
+ export declare function isBlink(userAgent: string): boolean;
127
+ /**
128
+ * Checks if the current environment supports ES2018 Unicode properties like `\p{P}` or `\p{L}`.
129
+ * More information about unicode properties might be found
130
+ * [in Unicode Standard Annex #44](https://www.unicode.org/reports/tr44/#GC_Values_Table).
131
+ */
132
+ export declare function isRegExpUnicodePropertySupported(): boolean;
133
+ /**
134
+ * Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
135
+ *
136
+ * Returns `false` in environments where `window` global object is not available.
137
+ */
138
+ export declare function isMediaForcedColors(): boolean;
139
+ /**
140
+ * Checks if the user enabled "prefers reduced motion" setting in browser.
141
+ *
142
+ * Returns `false` in environments where `window` global object is not available.
143
+ */
144
+ export declare function isMotionReduced(): boolean;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * The event object passed to event callbacks. It is used to provide information about the event as well as a tool to
11
+ * manipulate it.
12
+ */
13
+ export default class EventInfo<TName extends string = string, TReturn = unknown> {
14
+ /**
15
+ * The object that fired the event.
16
+ */
17
+ readonly source: object;
18
+ /**
19
+ * The event name.
20
+ */
21
+ readonly name: TName;
22
+ /**
23
+ * Path this event has followed. See {@link module:utils/emittermixin~Emitter#delegate}.
24
+ */
25
+ path: Array<object>;
26
+ /**
27
+ * Stops the event emitter to call further callbacks for this event interaction.
28
+ */
29
+ readonly stop: {
30
+ (): void;
31
+ called?: boolean;
32
+ };
33
+ /**
34
+ * Removes the current callback from future interactions of this event.
35
+ */
36
+ readonly off: {
37
+ (): void;
38
+ called?: boolean;
39
+ };
40
+ /**
41
+ * The value which will be returned by {@link module:utils/emittermixin~Emitter#fire}.
42
+ *
43
+ * It's `undefined` by default and can be changed by an event listener:
44
+ *
45
+ * ```ts
46
+ * dataController.fire( 'getSelectedContent', ( evt ) => {
47
+ * // This listener will make `dataController.fire( 'getSelectedContent' )`
48
+ * // always return an empty DocumentFragment.
49
+ * evt.return = new DocumentFragment();
50
+ *
51
+ * // Make sure no other listeners are executed.
52
+ * evt.stop();
53
+ * } );
54
+ * ```
55
+ */
56
+ return: TReturn | undefined;
57
+ /**
58
+ * @param source The emitter.
59
+ * @param name The event name.
60
+ */
61
+ constructor(source: object, name: TName);
62
+ }
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ import type { DiffResult } from './diff.js';
10
+ import type { Change } from './difftochanges.js';
11
+ /**
12
+ * @module utils/fastdiff
13
+ */
14
+ /**
15
+ * Finds positions of the first and last change in the given string/array and generates a set of changes:
16
+ *
17
+ * ```ts
18
+ * fastDiff( '12a', '12xyza' );
19
+ * // [ { index: 2, type: 'insert', values: [ 'x', 'y', 'z' ] } ]
20
+ *
21
+ * fastDiff( '12a', '12aa' );
22
+ * // [ { index: 3, type: 'insert', values: [ 'a' ] } ]
23
+ *
24
+ * fastDiff( '12xyza', '12a' );
25
+ * // [ { index: 2, type: 'delete', howMany: 3 } ]
26
+ *
27
+ * fastDiff( [ '1', '2', 'a', 'a' ], [ '1', '2', 'a' ] );
28
+ * // [ { index: 3, type: 'delete', howMany: 1 } ]
29
+ *
30
+ * fastDiff( [ '1', '2', 'a', 'b', 'c', '3' ], [ '2', 'a', 'b' ] );
31
+ * // [ { index: 0, type: 'insert', values: [ '2', 'a', 'b' ] }, { index: 3, type: 'delete', howMany: 6 } ]
32
+ * ```
33
+ *
34
+ * Passed arrays can contain any type of data, however to compare them correctly custom comparator function
35
+ * should be passed as a third parameter:
36
+ *
37
+ * ```ts
38
+ * fastDiff( [ { value: 1 }, { value: 2 } ], [ { value: 1 }, { value: 3 } ], ( a, b ) => {
39
+ * return a.value === b.value;
40
+ * } );
41
+ * // [ { index: 1, type: 'insert', values: [ { value: 3 } ] }, { index: 2, type: 'delete', howMany: 1 } ]
42
+ * ```
43
+ *
44
+ * The resulted set of changes can be applied to the input in order to transform it into the output, for example:
45
+ *
46
+ * ```ts
47
+ * let input = '12abc3';
48
+ * const output = '2ab';
49
+ * const changes = fastDiff( input, output );
50
+ *
51
+ * changes.forEach( change => {
52
+ * if ( change.type == 'insert' ) {
53
+ * input = input.substring( 0, change.index ) + change.values.join( '' ) + input.substring( change.index );
54
+ * } else if ( change.type == 'delete' ) {
55
+ * input = input.substring( 0, change.index ) + input.substring( change.index + change.howMany );
56
+ * }
57
+ * } );
58
+ *
59
+ * // input equals output now
60
+ * ```
61
+ *
62
+ * or in case of arrays:
63
+ *
64
+ * ```ts
65
+ * let input = [ '1', '2', 'a', 'b', 'c', '3' ];
66
+ * const output = [ '2', 'a', 'b' ];
67
+ * const changes = fastDiff( input, output );
68
+ *
69
+ * changes.forEach( change => {
70
+ * if ( change.type == 'insert' ) {
71
+ * input = input.slice( 0, change.index ).concat( change.values, input.slice( change.index ) );
72
+ * } else if ( change.type == 'delete' ) {
73
+ * input = input.slice( 0, change.index ).concat( input.slice( change.index + change.howMany ) );
74
+ * }
75
+ * } );
76
+ *
77
+ * // input equals output now
78
+ * ```
79
+ *
80
+ * By passing `true` as the fourth parameter (`atomicChanges`) the output of this function will become compatible with
81
+ * the {@link module:utils/diff~diff `diff()`} function:
82
+ *
83
+ * ```ts
84
+ * fastDiff( '12a', '12xyza', undefined, true );
85
+ * // [ 'equal', 'equal', 'insert', 'insert', 'insert', 'equal' ]
86
+ * ```
87
+ *
88
+ * The default output format of this function is compatible with the output format of
89
+ * {@link module:utils/difftochanges~diffToChanges `diffToChanges()`}. The `diffToChanges()` input format is, in turn,
90
+ * compatible with the output of {@link module:utils/diff~diff `diff()`}:
91
+ *
92
+ * ```ts
93
+ * const a = '1234';
94
+ * const b = '12xyz34';
95
+ *
96
+ * // Both calls will return the same results (grouped changes format).
97
+ * fastDiff( a, b );
98
+ * diffToChanges( diff( a, b ) );
99
+ *
100
+ * // Again, both calls will return the same results (atomic changes format).
101
+ * fastDiff( a, b, undefined, true );
102
+ * diff( a, b );
103
+ * ```
104
+ *
105
+ * @typeParam T The type of array elements.
106
+ * @typeParam AtomicChanges The type of `atomicChanges` parameter (selects the result type).
107
+ * @param a Input array or string.
108
+ * @param b Input array or string.
109
+ * @param cmp Optional function used to compare array values, by default `===` (strict equal operator) is used.
110
+ * @param atomicChanges Whether an array of `inset|delete|equal` operations should
111
+ * be returned instead of changes set. This makes this function compatible with {@link module:utils/diff~diff `diff()`}.
112
+ * Defaults to `false`.
113
+ * @returns Array of changes. The elements are either {@link module:utils/diff~DiffResult} or {@link module:utils/difftochanges~Change},
114
+ * depending on `atomicChanges` parameter.
115
+ */
116
+ export default function fastDiff<T, AtomicChanges extends boolean = false>(a: ArrayLike<T>, b: ArrayLike<T>, cmp?: (a: T, b: T) => boolean, atomicChanges?: AtomicChanges): Array<AtomicChanges extends true ? DiffResult : Change<T>>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module utils/first
11
+ */
12
+ /**
13
+ * Returns first item of the given `iterator`.
14
+ */
15
+ export default function first<T>(iterator: Iterator<T>): T | null;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ declare const FocusTracker_base: import("./mix.js").Mixed<{
10
+ new (): import("./observablemixin.js").Observable;
11
+ prototype: import("./observablemixin.js").Observable;
12
+ }, import("./dom/emittermixin.js").DomEmitter>;
13
+ /**
14
+ * Allows observing a group of `Element`s whether at least one of them is focused.
15
+ *
16
+ * Used by the {@link module:core/editor/editor~Editor} in order to track whether the focus is still within the application,
17
+ * or were used outside of its UI.
18
+ *
19
+ * **Note** `focus` and `blur` listeners use event capturing, so it is only needed to register wrapper `Element`
20
+ * which contain other `focusable` elements. But note that this wrapper element has to be focusable too
21
+ * (have e.g. `tabindex="-1"`).
22
+ *
23
+ * Check out the {@glink framework/deep-dive/ui/focus-tracking "Deep dive into focus tracking"} guide to learn more.
24
+ */
25
+ export default class FocusTracker extends /* #__PURE__ */ FocusTracker_base {
26
+ /**
27
+ * True when one of the registered elements is focused.
28
+ *
29
+ * @readonly
30
+ * @observable
31
+ */
32
+ isFocused: boolean;
33
+ /**
34
+ * The currently focused element.
35
+ *
36
+ * While {@link #isFocused `isFocused`} remains `true`, the focus can
37
+ * move between different UI elements. This property tracks those
38
+ * elements and tells which one is currently focused.
39
+ *
40
+ * @readonly
41
+ * @observable
42
+ */
43
+ focusedElement: Element | null;
44
+ /**
45
+ * List of registered elements.
46
+ *
47
+ * @internal
48
+ */
49
+ _elements: Set<Element>;
50
+ /**
51
+ * Event loop timeout.
52
+ */
53
+ private _nextEventLoopTimeout;
54
+ constructor();
55
+ /**
56
+ * List of registered elements.
57
+ */
58
+ get elements(): Array<Element>;
59
+ /**
60
+ * Starts tracking the specified element.
61
+ */
62
+ add(element: Element): void;
63
+ /**
64
+ * Stops tracking the specified element and stops listening on this element.
65
+ */
66
+ remove(element: Element): void;
67
+ /**
68
+ * Destroys the focus tracker by:
69
+ * - Disabling all event listeners attached to tracked elements.
70
+ * - Removing all tracked elements that were previously added.
71
+ */
72
+ destroy(): void;
73
+ /**
74
+ * Stores currently focused element and set {@link #isFocused} as `true`.
75
+ */
76
+ private _focus;
77
+ /**
78
+ * Clears currently focused element and set {@link #isFocused} as `false`.
79
+ * This method uses `setTimeout` to change order of fires `blur` and `focus` events.
80
+ */
81
+ private _blur;
82
+ }
83
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
package/dist/index.css ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module utils
11
+ */
12
+ export { default as env } from './env.js';
13
+ export { default as diff, type DiffResult } from './diff.js';
14
+ export { default as fastDiff } from './fastdiff.js';
15
+ export { default as diffToChanges } from './difftochanges.js';
16
+ export { default as mix } from './mix.js';
17
+ export type { Constructor, Mixed } from './mix.js';
18
+ export { default as EmitterMixin, type Emitter, type BaseEvent, type CallbackOptions, type EmitterMixinDelegateChain, type GetCallback, type GetCallbackOptions, type GetEventInfo, type GetNameOrEventInfo } from './emittermixin.js';
19
+ export { default as EventInfo } from './eventinfo.js';
20
+ export { default as ObservableMixin, type Observable, type DecoratedMethodEvent, type ObservableChangeEvent, type ObservableSetEvent } from './observablemixin.js';
21
+ export { default as CKEditorError, logError, logWarning } from './ckeditorerror.js';
22
+ export { default as ElementReplacer } from './elementreplacer.js';
23
+ export { default as abortableDebounce, type AbortableFunc } from './abortabledebounce.js';
24
+ export { default as count } from './count.js';
25
+ export { default as compareArrays } from './comparearrays.js';
26
+ export { default as createElement } from './dom/createelement.js';
27
+ export { default as Config } from './config.js';
28
+ export { default as isIterable } from './isiterable.js';
29
+ export { default as DomEmitterMixin, type DomEmitter } from './dom/emittermixin.js';
30
+ export { default as findClosestScrollableAncestor } from './dom/findclosestscrollableancestor.js';
31
+ export { default as global } from './dom/global.js';
32
+ export { default as getAncestors } from './dom/getancestors.js';
33
+ export { default as getDataFromElement } from './dom/getdatafromelement.js';
34
+ export { default as getBorderWidths } from './dom/getborderwidths.js';
35
+ export { default as getRangeFromMouseEvent } from './dom/getrangefrommouseevent.js';
36
+ export { default as isText } from './dom/istext.js';
37
+ export { default as Rect, type RectSource } from './dom/rect.js';
38
+ export { default as ResizeObserver } from './dom/resizeobserver.js';
39
+ export { default as setDataInElement } from './dom/setdatainelement.js';
40
+ export { default as toUnit } from './dom/tounit.js';
41
+ export { default as indexOf } from './dom/indexof.js';
42
+ export { default as insertAt } from './dom/insertat.js';
43
+ export { default as isComment } from './dom/iscomment.js';
44
+ export { default as isNode } from './dom/isnode.js';
45
+ export { default as isRange } from './dom/isrange.js';
46
+ export { default as isValidAttributeName } from './dom/isvalidattributename.js';
47
+ export { default as isVisible } from './dom/isvisible.js';
48
+ export { getOptimalPosition, type Options as PositionOptions, type PositioningFunction, type DomPoint } from './dom/position.js';
49
+ export { default as remove } from './dom/remove.js';
50
+ export * from './dom/scroll.js';
51
+ export * from './keyboard.js';
52
+ export * from './language.js';
53
+ export { default as Locale, type LocaleTranslate, type Translations } from './locale.js';
54
+ export { default as Collection, type CollectionAddEvent, type CollectionChangeEvent, type CollectionRemoveEvent } from './collection.js';
55
+ export { default as first } from './first.js';
56
+ export { default as FocusTracker } from './focustracker.js';
57
+ export { default as KeystrokeHandler, type KeystrokeHandlerOptions } from './keystrokehandler.js';
58
+ export { default as toArray, type ArrayOrItem, type ReadonlyArrayOrItem } from './toarray.js';
59
+ export { default as toMap } from './tomap.js';
60
+ export { default as priorities, type PriorityString } from './priorities.js';
61
+ export { default as retry, exponentialDelay } from './retry.js';
62
+ export { default as insertToPriorityArray } from './inserttopriorityarray.js';
63
+ export { default as spliceArray } from './splicearray.js';
64
+ export { default as uid } from './uid.js';
65
+ export { default as delay, type DelayedFunc } from './delay.js';
66
+ export { default as wait } from './wait.js';
67
+ export { default as parseBase64EncodedObject } from './parsebase64encodedobject.js';
68
+ export { default as crc32, type CRCData } from './crc32.js';
69
+ export * from './unicode.js';
70
+ export { default as version, releaseDate } from './version.js';