@ckeditor/ckeditor5-utils 45.2.1-alpha.9 → 46.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 (143) hide show
  1. package/dist/index.js +191 -158
  2. package/dist/index.js.map +1 -1
  3. package/package.json +3 -3
  4. package/src/abortabledebounce.d.ts +1 -1
  5. package/src/abortabledebounce.js +1 -1
  6. package/src/areconnectedthroughproperties.d.ts +1 -1
  7. package/src/areconnectedthroughproperties.js +1 -1
  8. package/src/ckeditorerror.d.ts +5 -4
  9. package/src/ckeditorerror.js +18 -14
  10. package/src/collection.d.ts +1 -1
  11. package/src/collection.js +5 -5
  12. package/src/collectstylesheets.d.ts +1 -1
  13. package/src/collectstylesheets.js +1 -1
  14. package/src/comparearrays.d.ts +1 -1
  15. package/src/comparearrays.js +1 -1
  16. package/src/config.d.ts +1 -1
  17. package/src/config.js +1 -1
  18. package/src/count.d.ts +1 -1
  19. package/src/count.js +1 -1
  20. package/src/crc32.d.ts +2 -3
  21. package/src/crc32.js +1 -1
  22. package/src/delay.d.ts +1 -1
  23. package/src/delay.js +1 -1
  24. package/src/diff.d.ts +3 -4
  25. package/src/diff.js +2 -2
  26. package/src/difftochanges.d.ts +1 -1
  27. package/src/difftochanges.js +1 -1
  28. package/src/dom/createelement.d.ts +5 -6
  29. package/src/dom/createelement.js +2 -2
  30. package/src/dom/emittermixin.d.ts +5 -5
  31. package/src/dom/emittermixin.js +6 -15
  32. package/src/dom/findclosestscrollableancestor.d.ts +1 -1
  33. package/src/dom/findclosestscrollableancestor.js +2 -2
  34. package/src/dom/getancestors.d.ts +1 -1
  35. package/src/dom/getancestors.js +1 -1
  36. package/src/dom/getborderwidths.d.ts +1 -1
  37. package/src/dom/getborderwidths.js +1 -1
  38. package/src/dom/getcommonancestor.d.ts +1 -1
  39. package/src/dom/getcommonancestor.js +2 -2
  40. package/src/dom/getdatafromelement.d.ts +1 -1
  41. package/src/dom/getdatafromelement.js +1 -1
  42. package/src/dom/getpositionedancestor.d.ts +1 -1
  43. package/src/dom/getpositionedancestor.js +2 -2
  44. package/src/dom/getrangefrommouseevent.d.ts +1 -1
  45. package/src/dom/getrangefrommouseevent.js +1 -1
  46. package/src/dom/getvisualviewportoffset.d.ts +1 -1
  47. package/src/dom/getvisualviewportoffset.js +3 -3
  48. package/src/dom/global.d.ts +2 -2
  49. package/src/dom/global.js +4 -4
  50. package/src/dom/indexof.d.ts +1 -1
  51. package/src/dom/indexof.js +1 -1
  52. package/src/dom/insertat.d.ts +1 -1
  53. package/src/dom/insertat.js +1 -1
  54. package/src/dom/iscomment.d.ts +1 -1
  55. package/src/dom/iscomment.js +1 -1
  56. package/src/dom/isnode.d.ts +1 -1
  57. package/src/dom/isnode.js +1 -1
  58. package/src/dom/isrange.d.ts +1 -1
  59. package/src/dom/isrange.js +1 -1
  60. package/src/dom/istext.d.ts +1 -1
  61. package/src/dom/istext.js +1 -1
  62. package/src/dom/isvalidattributename.d.ts +1 -1
  63. package/src/dom/isvalidattributename.js +2 -2
  64. package/src/dom/isvisible.d.ts +1 -1
  65. package/src/dom/isvisible.js +2 -2
  66. package/src/dom/iswindow.d.ts +1 -1
  67. package/src/dom/iswindow.js +1 -1
  68. package/src/dom/position.d.ts +5 -5
  69. package/src/dom/position.js +3 -3
  70. package/src/dom/rect.d.ts +3 -3
  71. package/src/dom/rect.js +7 -7
  72. package/src/dom/remove.d.ts +1 -1
  73. package/src/dom/remove.js +1 -1
  74. package/src/dom/resizeobserver.d.ts +1 -1
  75. package/src/dom/resizeobserver.js +2 -2
  76. package/src/dom/scroll.d.ts +1 -2
  77. package/src/dom/scroll.js +3 -3
  78. package/src/dom/setdatainelement.d.ts +1 -1
  79. package/src/dom/setdatainelement.js +1 -1
  80. package/src/dom/tounit.d.ts +1 -1
  81. package/src/dom/tounit.js +1 -1
  82. package/src/elementreplacer.d.ts +1 -1
  83. package/src/elementreplacer.js +1 -1
  84. package/src/emittermixin.d.ts +3 -3
  85. package/src/emittermixin.js +6 -14
  86. package/src/env.d.ts +16 -2
  87. package/src/env.js +17 -3
  88. package/src/eventinfo.d.ts +1 -1
  89. package/src/eventinfo.js +2 -2
  90. package/src/fastdiff.d.ts +1 -1
  91. package/src/fastdiff.js +1 -1
  92. package/src/first.d.ts +1 -1
  93. package/src/first.js +1 -1
  94. package/src/focustracker.d.ts +1 -1
  95. package/src/focustracker.js +4 -4
  96. package/src/formathtml.d.ts +1 -1
  97. package/src/formathtml.js +1 -1
  98. package/src/index.d.ts +69 -62
  99. package/src/index.js +68 -61
  100. package/src/inserttopriorityarray.d.ts +1 -1
  101. package/src/inserttopriorityarray.js +2 -2
  102. package/src/isiterable.d.ts +1 -1
  103. package/src/isiterable.js +1 -1
  104. package/src/keyboard.d.ts +2 -2
  105. package/src/keyboard.js +4 -4
  106. package/src/keystrokehandler.d.ts +2 -2
  107. package/src/keystrokehandler.js +3 -3
  108. package/src/legacyerrors.d.ts +5 -0
  109. package/src/legacyerrors.js +18 -0
  110. package/src/locale.d.ts +1 -10
  111. package/src/locale.js +2 -23
  112. package/src/mapsequal.d.ts +1 -1
  113. package/src/mapsequal.js +1 -1
  114. package/src/mix.d.ts +0 -27
  115. package/src/mix.js +1 -46
  116. package/src/nth.d.ts +1 -1
  117. package/src/nth.js +1 -1
  118. package/src/objecttomap.d.ts +1 -1
  119. package/src/objecttomap.js +1 -1
  120. package/src/observablemixin.d.ts +8 -9
  121. package/src/observablemixin.js +3 -12
  122. package/src/parsebase64encodedobject.d.ts +1 -1
  123. package/src/parsebase64encodedobject.js +1 -1
  124. package/src/priorities.d.ts +1 -2
  125. package/src/priorities.js +1 -2
  126. package/src/retry.d.ts +1 -1
  127. package/src/retry.js +2 -2
  128. package/src/splicearray.d.ts +1 -1
  129. package/src/splicearray.js +1 -1
  130. package/src/spy.d.ts +1 -2
  131. package/src/spy.js +1 -2
  132. package/src/toarray.d.ts +2 -2
  133. package/src/toarray.js +1 -1
  134. package/src/tomap.d.ts +1 -1
  135. package/src/tomap.js +3 -3
  136. package/src/translation-service.d.ts +1 -1
  137. package/src/translation-service.js +3 -3
  138. package/src/uid.d.ts +1 -1
  139. package/src/uid.js +1 -1
  140. package/src/version.d.ts +1 -2
  141. package/src/version.js +12 -13
  142. package/src/wait.d.ts +1 -1
  143. package/src/wait.js +1 -1
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import { isObject, isString, isPlainObject, cloneDeepWith, isElement as isElement$1, isFunction, merge } from 'es-toolkit/compat';
5
+ import { isObject as isObject$1, isString, isPlainObject, cloneDeepWith, isElement as isElement$1, isFunction, merge } from 'es-toolkit/compat';
6
6
 
7
7
  /**
8
8
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
@@ -27,10 +27,10 @@ import { isObject, isString, isPlainObject, cloneDeepWith, isElement as isElemen
27
27
  *
28
28
  * console.log( global.window.innerWidth );
29
29
  * ```
30
- */ let globalVar; // named globalVar instead of global: https://github.com/ckeditor/ckeditor5/issues/12971
30
+ */ let global; // named globalVar instead of global: https://github.com/ckeditor/ckeditor5/issues/12971
31
31
  // In some environments window and document API might not be available.
32
32
  try {
33
- globalVar = {
33
+ global = {
34
34
  window,
35
35
  document
36
36
  };
@@ -40,16 +40,17 @@ try {
40
40
  // We only handle this so loading editor in environments without window and document doesn't fail.
41
41
  // For better DX we shouldn't introduce mixed types and require developers to check the type manually.
42
42
  // This module should not be used on purpose in any environment outside browser.
43
- globalVar = {
43
+ global = {
44
44
  window: {},
45
45
  document: {}
46
46
  };
47
47
  }
48
- var global = globalVar;
49
48
 
50
49
  /**
51
50
  * Safely returns `userAgent` from browser's navigator API in a lower case.
52
51
  * If navigator API is not available it will return an empty string.
52
+ *
53
+ * @internal
53
54
  */ function getUserAgent() {
54
55
  // In some environments navigator API might not be available.
55
56
  try {
@@ -82,6 +83,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
82
83
  /**
83
84
  * Checks if User Agent represented by the string is running on Macintosh.
84
85
  *
86
+ * @internal
85
87
  * @param userAgent **Lowercase** `navigator.userAgent` string.
86
88
  * @returns Whether User Agent is running on Macintosh or not.
87
89
  */ function isMac(userAgent) {
@@ -90,6 +92,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
90
92
  /**
91
93
  * Checks if User Agent represented by the string is running on Windows.
92
94
  *
95
+ * @internal
93
96
  * @param userAgent **Lowercase** `navigator.userAgent` string.
94
97
  * @returns Whether User Agent is running on Windows or not.
95
98
  */ function isWindows(userAgent) {
@@ -98,6 +101,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
98
101
  /**
99
102
  * Checks if User Agent represented by the string is Firefox (Gecko).
100
103
  *
104
+ * @internal
101
105
  * @param userAgent **Lowercase** `navigator.userAgent` string.
102
106
  * @returns Whether User Agent is Firefox or not.
103
107
  */ function isGecko(userAgent) {
@@ -106,6 +110,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
106
110
  /**
107
111
  * Checks if User Agent represented by the string is Safari.
108
112
  *
113
+ * @internal
109
114
  * @param userAgent **Lowercase** `navigator.userAgent` string.
110
115
  * @returns Whether User Agent is Safari or not.
111
116
  */ function isSafari(userAgent) {
@@ -114,6 +119,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
114
119
  /**
115
120
  * Checks if User Agent represented by the string is running in iOS.
116
121
  *
122
+ * @internal
117
123
  * @param userAgent **Lowercase** `navigator.userAgent` string.
118
124
  * @returns Whether User Agent is running in iOS or not.
119
125
  */ function isiOS(userAgent) {
@@ -123,6 +129,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
123
129
  /**
124
130
  * Checks if User Agent represented by the string is Android mobile device.
125
131
  *
132
+ * @internal
126
133
  * @param userAgent **Lowercase** `navigator.userAgent` string.
127
134
  * @returns Whether User Agent is Safari or not.
128
135
  */ function isAndroid(userAgent) {
@@ -131,6 +138,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
131
138
  /**
132
139
  * Checks if User Agent represented by the string is Blink engine.
133
140
  *
141
+ * @internal
134
142
  * @param userAgent **Lowercase** `navigator.userAgent` string.
135
143
  * @returns Whether User Agent is Blink engine or not.
136
144
  */ function isBlink(userAgent) {
@@ -142,6 +150,8 @@ const userAgent = /* #__PURE__ */ getUserAgent();
142
150
  * Checks if the current environment supports ES2018 Unicode properties like `\p{P}` or `\p{L}`.
143
151
  * More information about unicode properties might be found
144
152
  * [in Unicode Standard Annex #44](https://www.unicode.org/reports/tr44/#GC_Values_Table).
153
+ *
154
+ * @internal
145
155
  */ function isRegExpUnicodePropertySupported() {
146
156
  let isSupported = false;
147
157
  // Feature detection for Unicode properties. Added in ES2018. Currently Firefox does not support it.
@@ -158,6 +168,8 @@ const userAgent = /* #__PURE__ */ getUserAgent();
158
168
  * Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
159
169
  *
160
170
  * Returns `false` in environments where `window` global object is not available.
171
+ *
172
+ * @internal
161
173
  */ function isMediaForcedColors() {
162
174
  return global.window.matchMedia ? global.window.matchMedia('(forced-colors: active)').matches : false;
163
175
  }
@@ -165,6 +177,8 @@ const userAgent = /* #__PURE__ */ getUserAgent();
165
177
  * Checks if the user enabled "prefers reduced motion" setting in browser.
166
178
  *
167
179
  * Returns `false` in environments where `window` global object is not available.
180
+ *
181
+ * @internal
168
182
  */ function isMotionReduced() {
169
183
  return global.window.matchMedia ? global.window.matchMedia('(prefers-reduced-motion)').matches : false;
170
184
  }
@@ -601,48 +615,58 @@ diff.fastDiff = fastDiff;
601
615
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
602
616
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
603
617
  */ /**
604
- * @module utils/mix
618
+ * @module utils/areconnectedthroughproperties
605
619
  */ /**
606
- * Copies enumerable properties and symbols from the objects given as 2nd+ parameters to the
607
- * prototype of first object (a constructor).
608
- *
609
- * ```
610
- * class Editor {
611
- * ...
612
- * }
613
- *
614
- * const SomeMixin = {
615
- * a() {
616
- * return 'a';
617
- * }
618
- * };
619
- *
620
- * mix( Editor, SomeMixin, ... );
621
- *
622
- * new Editor().a(); // -> 'a'
623
- * ```
624
- *
625
- * Note: Properties which already exist in the base class will not be overriden.
626
- *
627
- * @deprecated Use mixin pattern, see: https://www.typescriptlang.org/docs/handbook/mixins.html.
628
- * @param baseClass Class which prototype will be extended.
629
- * @param mixins Objects from which to get properties.
630
- */ function mix(baseClass, ...mixins) {
631
- mixins.forEach((mixin)=>{
632
- const propertyNames = Object.getOwnPropertyNames(mixin);
633
- const propertySymbols = Object.getOwnPropertySymbols(mixin);
634
- propertyNames.concat(propertySymbols).forEach((key)=>{
635
- if (key in baseClass.prototype) {
636
- return;
637
- }
638
- if (typeof mixin == 'function' && (key == 'length' || key == 'name' || key == 'prototype')) {
639
- return;
640
- }
641
- const sourceDescriptor = Object.getOwnPropertyDescriptor(mixin, key);
642
- sourceDescriptor.enumerable = false;
643
- Object.defineProperty(baseClass.prototype, key, sourceDescriptor);
644
- });
645
- });
620
+ * Traverses both structures to find out whether there is a reference that is shared between both structures.
621
+ */ function areConnectedThroughProperties(obj1, obj2) {
622
+ if (obj1 === obj2 && isObject(obj1)) {
623
+ return true;
624
+ }
625
+ const subNodes1 = getSubNodes(obj1);
626
+ const subNodes2 = getSubNodes(obj2);
627
+ for (const node of subNodes1){
628
+ if (subNodes2.has(node)) {
629
+ return true;
630
+ }
631
+ }
632
+ return false;
633
+ }
634
+ /**
635
+ * Traverses JS structure and stores all sub-nodes, including the head node.
636
+ * It walks into each iterable structures with the `try catch` block to omit errors that might be thrown during
637
+ * tree walking. All primitives, functions and built-ins are skipped.
638
+ */ function getSubNodes(head) {
639
+ const nodes = [
640
+ head
641
+ ];
642
+ // Nodes are stored to prevent infinite looping.
643
+ const subNodes = new Set();
644
+ while(nodes.length > 0){
645
+ const node = nodes.shift();
646
+ if (subNodes.has(node) || shouldNodeBeSkipped(node)) {
647
+ continue;
648
+ }
649
+ subNodes.add(node);
650
+ // Handle arrays, maps, sets, custom collections that implements `[ Symbol.iterator ]()`, etc.
651
+ if (node[Symbol.iterator]) {
652
+ // The custom editor iterators might cause some problems if the editor is crashed.
653
+ try {
654
+ nodes.push(...node);
655
+ } // eslint-disable-next-line no-empty
656
+ catch {}
657
+ } else {
658
+ nodes.push(...Object.values(node));
659
+ }
660
+ }
661
+ return subNodes;
662
+ }
663
+ function shouldNodeBeSkipped(node) {
664
+ const type = Object.prototype.toString.call(node);
665
+ return type === '[object Number]' || type === '[object Boolean]' || type === '[object String]' || type === '[object Symbol]' || type === '[object Function]' || type === '[object Date]' || type === '[object RegExp]' || node === undefined || node === null || // Skip native DOM objects, e.g. Window, nodes, events, etc.
666
+ node instanceof EventTarget || node instanceof Event;
667
+ }
668
+ function isObject(structure) {
669
+ return typeof structure === 'object' && structure !== null;
646
670
  }
647
671
 
648
672
  /**
@@ -838,11 +862,18 @@ diff.fastDiff = fastDiff;
838
862
  * @param data Additional data describing the error. A stringified version of this object
839
863
  * will be appended to the error message, so the data are quickly visible in the console. The original
840
864
  * data object will also be later available under the {@link #data} property.
841
- */ constructor(errorName, context, data){
842
- super(getErrorMessage(errorName, data));
865
+ * @param originalError An optional original error that is being wrapped in the `CKEditorError` instance.
866
+ */ constructor(errorName, context, data, originalError){
867
+ super(getErrorMessage(errorName, data, originalError));
843
868
  this.name = 'CKEditorError';
844
869
  this.context = context;
845
870
  this.data = data;
871
+ // Wrapping an original error in a CKEditorError instance.
872
+ if (originalError) {
873
+ // Restore the original stack trace to make the error look like the original one.
874
+ // See https://github.com/ckeditor/ckeditor5/issues/5595 for more details.
875
+ this.stack = originalError.stack;
876
+ }
846
877
  }
847
878
  /**
848
879
  * Checks if the error is of the `CKEditorError` type.
@@ -854,12 +885,12 @@ diff.fastDiff = fastDiff;
854
885
  * It is useful when combined with the {@link module:watchdog/watchdog~Watchdog} feature, which can restart the editor in case
855
886
  * of a {@link module:utils/ckeditorerror~CKEditorError} error.
856
887
  *
857
- * @param err The error to rethrow.
888
+ * @param error The error to rethrow.
858
889
  * @param context An object connected through properties with the editor instance. This context will be used
859
890
  * by the watchdog to verify which editor should be restarted.
860
- */ static rethrowUnexpectedError(err, context) {
861
- if (err.is && err.is('CKEditorError')) {
862
- throw err;
891
+ */ static rethrowUnexpectedError(error, context) {
892
+ if (error.is && error.is('CKEditorError')) {
893
+ throw error;
863
894
  }
864
895
  /**
865
896
  * An unexpected error occurred inside the CKEditor 5 codebase. This error will look like the original one
@@ -869,11 +900,7 @@ diff.fastDiff = fastDiff;
869
900
  * In case of such error (or any {@link module:utils/ckeditorerror~CKEditorError} error) the watchdog should restart the editor.
870
901
  *
871
902
  * @error unexpected-error
872
- */ const error = new CKEditorError(err.message, context);
873
- // Restore the original stack trace to make the error look like the original one.
874
- // See https://github.com/ckeditor/ckeditor5/issues/5595 for more details.
875
- error.stack = err.stack;
876
- throw error;
903
+ */ throw new CKEditorError('unexpected-error', context, undefined, error);
877
904
  }
878
905
  }
879
906
  /**
@@ -930,7 +957,7 @@ diff.fastDiff = fastDiff;
930
957
  }
931
958
  /**
932
959
  * Returns formatted error message.
933
- */ function getErrorMessage(errorName, data) {
960
+ */ function getErrorMessage(errorName, data, originalError) {
934
961
  const processedObjects = new WeakSet();
935
962
  const circularReferencesReplacer = (key, value)=>{
936
963
  if (typeof value === 'object' && value !== null) {
@@ -943,7 +970,8 @@ diff.fastDiff = fastDiff;
943
970
  };
944
971
  const stringifiedData = data ? ` ${JSON.stringify(data, circularReferencesReplacer)}` : '';
945
972
  const documentationLink = getLinkToDocumentationMessage(errorName);
946
- return errorName + stringifiedData + documentationLink;
973
+ const originalErrorMessage = originalError ? `\nOriginal error: ${originalError.name}: ${originalError.message}` : '';
974
+ return errorName + stringifiedData + documentationLink + originalErrorMessage;
947
975
  }
948
976
  /**
949
977
  * Returns formatted console error arguments.
@@ -959,9 +987,9 @@ diff.fastDiff = fastDiff;
959
987
  ];
960
988
  }
961
989
 
962
- const version = '45.2.1-alpha.9';
990
+ const version = '46.0.0-alpha.0';
963
991
  // The second argument is not a month. It is `monthIndex` and starts from `0`.
964
- const releaseDate = new Date(2025, 5, 23);
992
+ const releaseDate = new Date(2025, 6, 1);
965
993
  /* istanbul ignore next -- @preserve */ if (globalThis.CKEDITOR_VERSION) {
966
994
  /**
967
995
  * This error is thrown when, due to a mistake in the way CKEditor 5 was installed,
@@ -1021,8 +1049,8 @@ const releaseDate = new Date(2025, 5, 23);
1021
1049
  * <summary>New installation methods and optimized builds</summary>
1022
1050
  *
1023
1051
  * If you use the {@glink updating/nim-migration/migration-to-new-installation-methods new installation methods},
1024
- * you should only import code from the `ckeditor5` and `ckeditor5-premium-features` packages.
1025
- * Do not import code from the `@ckeditor/ckeditor5-<NAME>` packages unless you follow
1052
+ * you should only import { code } from the `ckeditor5` and `ckeditor5-premium-features` packages.
1053
+ * Do not import { code } from the `@ckeditor/ckeditor5-<NAME>` packages unless you follow
1026
1054
  * the {@glink getting-started/setup/optimizing-build-size Optimizing build size} guide and the imports from
1027
1055
  * the `@ckeditor/ckeditor5-<NAME>` packages end with `/dist/index.js`.
1028
1056
  *
@@ -1033,7 +1061,7 @@ const releaseDate = new Date(2025, 5, 23);
1033
1061
  * ```js
1034
1062
  * import { ClassicEditor, Highlight } from 'ckeditor5'; // ✅
1035
1063
  * import { Highlight } from '@ckeditor/ckeditor5-highlight/dist/index.js'; // ✅
1036
- * import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ❌
1064
+ * import { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ❌
1037
1065
  * import { Highlight } from '@ckeditor/ckeditor5-highlight'; // ❌
1038
1066
  * import '@ckeditor/ckeditor5-highlight/build/highlight.js'; // ❌
1039
1067
  * ```
@@ -1053,11 +1081,11 @@ const releaseDate = new Date(2025, 5, 23);
1053
1081
  * Examples of valid and invalid import paths:
1054
1082
  *
1055
1083
  * ```js
1056
- * import ClassicEditor from '@ckeditor/ckeditor5-build-classic'; // ✅
1084
+ * import { ClassicEditor } from '@ckeditor/ckeditor5-build-classic'; // ✅
1057
1085
  * import { Highlight } from 'ckeditor5'; // ❌
1058
1086
  * import { Highlight } from '@ckeditor/ckeditor5-highlight/dist/index.js'; // ❌
1059
1087
  * import { Highlight } from '@ckeditor/ckeditor5-highlight'; // ❌
1060
- * import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight'; // ❌
1088
+ * import { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight'; // ❌
1061
1089
  * import '@ckeditor/ckeditor5-highlight/build/highlight'; // ❌
1062
1090
  * ```
1063
1091
  *
@@ -1070,18 +1098,18 @@ const releaseDate = new Date(2025, 5, 23);
1070
1098
  * <summary>(Legacy) Default imports and `src` imports</summary>
1071
1099
  *
1072
1100
  * If you use the {@glink getting-started/legacy/installation-methods/quick-start-other legacy customized installation}
1073
- * method, you should only import code from the `@ckeditor/ckeditor5-<NAME>` packages. While you can import code from
1101
+ * method, you should only import { code from the `@ckeditor/ckeditor5-<NAME>` packages. While you can import code } from
1074
1102
  * the `@ckeditor/ckeditor5-<NAME>/src/*` files, it is not recommended as it can make migration to the new installation
1075
1103
  * methods more difficult.
1076
1104
  *
1077
- * If you use this installation method, you should not import code from the `ckeditor5` or `ckeditor5-premium-features` packages.
1105
+ * If you use this installation method, you should not import { code } from the `ckeditor5` or `ckeditor5-premium-features` packages.
1078
1106
  *
1079
1107
  * Examples of valid and invalid import paths:
1080
1108
  *
1081
1109
  * ```js
1082
1110
  * import { ClassicEditor } from '@ckeditor/ckeditor5-editor-classic'; // ✅
1083
1111
  * import { Highlight } from '@ckeditor/ckeditor5-highlight'; // ✅
1084
- * import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ✅ (not recommended)
1112
+ * import { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ✅ (not recommended)
1085
1113
  * import { Highlight } from 'ckeditor5'; // ❌
1086
1114
  * import { Highlight } from '@ckeditor/ckeditor5-highlight/dist/index.js'; // ❌
1087
1115
  * import '@ckeditor/ckeditor5-highlight/build/highlight'; // ❌
@@ -1103,7 +1131,7 @@ const releaseDate = new Date(2025, 5, 23);
1103
1131
  * import { Highlight } from 'ckeditor5'; // ❌
1104
1132
  * import { Highlight } from '@ckeditor/ckeditor5-highlight/dist/index.js'; // ❌
1105
1133
  * import { Highlight } from '@ckeditor/ckeditor5-highlight'; // ❌
1106
- * import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ❌
1134
+ * import { Highlight } from '@ckeditor/ckeditor5-highlight/src/highlight.js'; // ❌
1107
1135
  * ```
1108
1136
  * </details>
1109
1137
  *
@@ -1348,21 +1376,6 @@ function EmitterMixin(base) {
1348
1376
  }
1349
1377
  return Mixin;
1350
1378
  }
1351
- // Backward compatibility with `mix`
1352
- [
1353
- 'on',
1354
- 'once',
1355
- 'off',
1356
- 'listenTo',
1357
- 'stopListening',
1358
- 'fire',
1359
- 'delegate',
1360
- 'stopDelegating',
1361
- '_addEventListener',
1362
- '_removeEventListener'
1363
- ].forEach((key)=>{
1364
- EmitterMixin[key] = defaultEmitterClass$1.prototype[key];
1365
- });
1366
1379
  /**
1367
1380
  * Checks if `listeningEmitter` listens to an emitter with given `listenedToEmitterId` and if so, returns that emitter.
1368
1381
  * If not, returns `null`.
@@ -1564,7 +1577,7 @@ function ObservableMixin(base) {
1564
1577
  class Mixin extends base {
1565
1578
  set(name, value) {
1566
1579
  // If the first parameter is an Object, iterate over its properties.
1567
- if (isObject(name)) {
1580
+ if (isObject$1(name)) {
1568
1581
  Object.keys(name).forEach((property)=>{
1569
1582
  this.set(property, name[property]);
1570
1583
  }, this);
@@ -1752,25 +1765,6 @@ function ObservableMixin(base) {
1752
1765
  }
1753
1766
  return Mixin;
1754
1767
  }
1755
- // Backward compatibility with `mix`
1756
- [
1757
- 'set',
1758
- 'bind',
1759
- 'unbind',
1760
- 'decorate',
1761
- 'on',
1762
- 'once',
1763
- 'off',
1764
- 'listenTo',
1765
- 'stopListening',
1766
- 'fire',
1767
- 'delegate',
1768
- 'stopDelegating',
1769
- '_addEventListener',
1770
- '_removeEventListener'
1771
- ].forEach((key)=>{
1772
- ObservableMixin[key] = defaultObservableClass.prototype[key];
1773
- });
1774
1768
  // Init symbol properties needed for the observable mechanism to work.
1775
1769
  function initObservable(observable) {
1776
1770
  // Do nothing if already inited.
@@ -2563,23 +2557,6 @@ function DomEmitterMixin(base) {
2563
2557
  }
2564
2558
  return Mixin;
2565
2559
  }
2566
- // Backward compatibility with `mix`
2567
- [
2568
- '_getProxyEmitter',
2569
- '_getAllProxyEmitters',
2570
- 'on',
2571
- 'once',
2572
- 'off',
2573
- 'listenTo',
2574
- 'stopListening',
2575
- 'fire',
2576
- 'delegate',
2577
- 'stopDelegating',
2578
- '_addEventListener',
2579
- '_removeEventListener'
2580
- ].forEach((key)=>{
2581
- DomEmitterMixin[key] = defaultEmitterClass.prototype[key];
2582
- });
2583
2560
  /**
2584
2561
  * Creates a ProxyEmitter instance. Such an instance is a bridge between a DOM Node firing events
2585
2562
  * and any Host listening to them. It is backwards compatible with {@link module:utils/emittermixin~Emitter#on}.
@@ -2847,6 +2824,37 @@ function DomEmitterMixin(base) {
2847
2824
  return domRange;
2848
2825
  }
2849
2826
 
2827
+ /**
2828
+ * Searches and returns the lowest common ancestor of two given nodes.
2829
+ *
2830
+ * @param nodeA First node.
2831
+ * @param nodeB Second node.
2832
+ * @returns Lowest common ancestor of both nodes or `null` if nodes do not have a common ancestor.
2833
+ */ function getCommonAncestor(nodeA, nodeB) {
2834
+ const ancestorsA = getAncestors(nodeA);
2835
+ const ancestorsB = getAncestors(nodeB);
2836
+ let i = 0;
2837
+ // It does not matter which array is shorter.
2838
+ while(ancestorsA[i] == ancestorsB[i] && ancestorsA[i]){
2839
+ i++;
2840
+ }
2841
+ return i === 0 ? null : ancestorsA[i - 1];
2842
+ }
2843
+
2844
+ /**
2845
+ * For a given element, returns the nearest ancestor element which CSS position is not "static".
2846
+ *
2847
+ * @param element The native DOM element to be checked.
2848
+ */ function getPositionedAncestor(element) {
2849
+ if (!element || !element.parentNode) {
2850
+ return null;
2851
+ }
2852
+ if (element.offsetParent === global.document.body) {
2853
+ return null;
2854
+ }
2855
+ return element.offsetParent;
2856
+ }
2857
+
2850
2858
  /**
2851
2859
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
2852
2860
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
@@ -2869,20 +2877,6 @@ function DomEmitterMixin(base) {
2869
2877
  return Object.prototype.toString.apply(obj) == '[object Range]';
2870
2878
  }
2871
2879
 
2872
- /**
2873
- * For a given element, returns the nearest ancestor element which CSS position is not "static".
2874
- *
2875
- * @param element The native DOM element to be checked.
2876
- */ function getPositionedAncestor(element) {
2877
- if (!element || !element.parentNode) {
2878
- return null;
2879
- }
2880
- if (element.offsetParent === global.document.body) {
2881
- return null;
2882
- }
2883
- return element.offsetParent;
2884
- }
2885
-
2886
2880
  const rectProperties = [
2887
2881
  'top',
2888
2882
  'right',
@@ -4407,7 +4401,7 @@ const keyCodeNames = /* #__PURE__ */ Object.fromEntries(/* #__PURE__ */ Object.e
4407
4401
  return keyCode == keyCodes.arrowright || keyCode == keyCodes.arrowleft || keyCode == keyCodes.arrowup || keyCode == keyCodes.arrowdown;
4408
4402
  }
4409
4403
  /**
4410
- * Returns the direction in which the {@link module:engine/model/documentselection~DocumentSelection selection}
4404
+ * Returns the direction in which the {@link module:engine/model/documentselection~ModelDocumentSelection selection}
4411
4405
  * will move when the provided arrow key code is pressed considering the language direction of the editor content.
4412
4406
  *
4413
4407
  * For instance, in right–to–left (RTL) content languages, pressing the left arrow means moving the selection right (forward)
@@ -4446,7 +4440,7 @@ const keyCodeNames = /* #__PURE__ */ Object.fromEntries(/* #__PURE__ */ Object.e
4446
4440
  return (env.isMac || env.isiOS) && code == keyCodes.ctrl ? keyCodes.cmd : code;
4447
4441
  }
4448
4442
  /**
4449
- * Determines if the provided key code moves the {@link module:engine/model/documentselection~DocumentSelection selection}
4443
+ * Determines if the provided key code moves the {@link module:engine/model/documentselection~ModelDocumentSelection selection}
4450
4444
  * forward or backward considering the language direction of the editor content.
4451
4445
  *
4452
4446
  * For instance, in right–to–left (RTL) languages, pressing the left arrow means moving forward
@@ -4622,7 +4616,7 @@ function splitKeystrokeText(keystroke) {
4622
4616
  * }
4623
4617
  * ```
4624
4618
  *
4625
- * If you cannot import this function from this module (e.g. because you use a CKEditor 5 build), you can
4619
+ * If you cannot import { this function } from this module (e.g. because you use a CKEditor 5 build), you can
4626
4620
  * still add translations by extending the global `window.CKEDITOR_TRANSLATIONS` object by using a function like
4627
4621
  * the one below:
4628
4622
  *
@@ -4734,6 +4728,15 @@ function splitKeystrokeText(keystroke) {
4734
4728
  // Note: The `translate` function is not responsible for replacing `%0, %1, ...` with values.
4735
4729
  return translation[pluralFormIndex];
4736
4730
  }
4731
+ /**
4732
+ * Clears dictionaries for test purposes.
4733
+ *
4734
+ * @internal
4735
+ */ function _clear() {
4736
+ if (global.window.CKEDITOR_TRANSLATIONS) {
4737
+ global.window.CKEDITOR_TRANSLATIONS = {};
4738
+ }
4739
+ }
4737
4740
  /**
4738
4741
  * If array then merge objects which are inside otherwise return given object.
4739
4742
  *
@@ -4846,23 +4849,6 @@ function getNumberOfLanguages(translations) {
4846
4849
  this.translations = _unifyTranslations(translations);
4847
4850
  this.t = (message, values)=>this._t(message, values);
4848
4851
  }
4849
- /**
4850
- * The editor UI language code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
4851
- *
4852
- * **Note**: This property was deprecated. Please use {@link #uiLanguage} and {@link #contentLanguage}
4853
- * properties instead.
4854
- *
4855
- * @deprecated
4856
- */ get language() {
4857
- /**
4858
- * The {@link module:utils/locale~Locale#language `Locale#language`} property was deprecated and will
4859
- * be removed in the near future. Please use the {@link module:utils/locale~Locale#uiLanguage `Locale#uiLanguage`} and
4860
- * {@link module:utils/locale~Locale#contentLanguage `Locale#contentLanguage`} properties instead.
4861
- *
4862
- * @error locale-deprecated-language-property
4863
- */ console.warn('locale-deprecated-language-property: ' + 'The Locale#language property has been deprecated and will be removed in the near future. ' + 'Please use #uiLanguage and #contentLanguage properties instead.');
4864
- return this.uiLanguage;
4865
- }
4866
4852
  /**
4867
4853
  * An unbound version of the {@link #t} method.
4868
4854
  */ _t(message, values = []) {
@@ -5475,6 +5461,28 @@ function getNumberOfLanguages(translations) {
5475
5461
  return iteratorItem.value;
5476
5462
  }
5477
5463
 
5464
+ /**
5465
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
5466
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
5467
+ */ /**
5468
+ * @module utils/nth
5469
+ */ /**
5470
+ * Returns `nth` (starts from `0` of course) item of the given `iterable`.
5471
+ *
5472
+ * If the iterable is a generator, then it consumes **all its items**.
5473
+ * If it's a normal iterator, then it consumes **all items up to the given index**.
5474
+ * Refer to the [Iterators and Generators](https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Iterators_and_Generators)
5475
+ * guide to learn differences between these interfaces.
5476
+ */ function nth(index, iterable) {
5477
+ for (const item of iterable){
5478
+ if (index === 0) {
5479
+ return item;
5480
+ }
5481
+ index -= 1;
5482
+ }
5483
+ return null;
5484
+ }
5485
+
5478
5486
  /**
5479
5487
  * Allows observing a group of DOM `Element`s or {@link module:ui/view~View view instances} whether at least one of them (or their child)
5480
5488
  * is focused.
@@ -5837,7 +5845,7 @@ function isFocusedView(subTreeRoot, view) {
5837
5845
  * @param keystroke Keystroke defined in a format accepted by
5838
5846
  * the {@link module:utils/keyboard~parseKeystroke} function.
5839
5847
  * @param callback A function called with the
5840
- * {@link module:engine/view/observer/keyobserver~KeyEventData key event data} object and
5848
+ * {@link module:engine/view/observer/keyobserver~ViewDocumentKeyEventData key event data} object and
5841
5849
  * a helper function to call both `preventDefault()` and `stopPropagation()` on the underlying event.
5842
5850
  * @param options Additional options.
5843
5851
  */ set(keystroke, callback, options = {}) {
@@ -5928,6 +5936,31 @@ function isFocusedView(subTreeRoot, view) {
5928
5936
  }
5929
5937
  }
5930
5938
 
5939
+ /**
5940
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
5941
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
5942
+ */ /**
5943
+ * @module utils/mapsequal
5944
+ */ /**
5945
+ * Checks whether given `Map`s are equal, that is has same size and same key-value pairs.
5946
+ *
5947
+ * @param mapA The first map to compare.
5948
+ * @param mapB The second map to compare.
5949
+ * @returns `true` if given maps are equal, `false` otherwise.
5950
+ */ function mapsEqual(mapA, mapB) {
5951
+ if (mapA.size != mapB.size) {
5952
+ return false;
5953
+ }
5954
+ for (const attr of mapA.entries()){
5955
+ const valA = JSON.stringify(attr[1]);
5956
+ const valB = JSON.stringify(mapB.get(attr[0]));
5957
+ if (valA !== valB) {
5958
+ return false;
5959
+ }
5960
+ }
5961
+ return true;
5962
+ }
5963
+
5931
5964
  /**
5932
5965
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
5933
5966
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
@@ -6520,5 +6553,5 @@ function buildEmojiRegexp() {
6520
6553
  return new RegExp(sequence, 'ug');
6521
6554
  }
6522
6555
 
6523
- export { CKEditorError, Collection, Config, DomEmitterMixin, ElementReplacer, EmitterMixin, EventInfo, FocusTracker, KeystrokeHandler, Locale, ObservableMixin, Rect, ResizeObserver, abortableDebounce, add, collectStylesheets, compareArrays, count, crc32, createElement, delay, diff, diffToChanges, env, exponentialDelay, fastDiff, findClosestScrollableAncestor, first, formatHtml, getAncestors, getBorderWidths, getCode, getDataFromElement, getEnvKeystrokeText, getLanguageDirection, getLocalizedArrowKeyCodeDirection, getOptimalPosition, getRangeFromMouseEvent, getVisualViewportOffset, global, indexOf, insertAt, insertToPriorityArray, isArrowKeyCode, isCombiningMark, isComment, isForwardArrowKeyCode, isHighSurrogateHalf, isInsideCombinedSymbol, isInsideEmojiSequence, isInsideSurrogatePair, isIterable, isLowSurrogateHalf, isNode, isRange, isText, isValidAttributeName, isViewWithFocusTracker, isVisible, keyCodes, logError, logWarning, mix, parseBase64EncodedObject, parseKeystroke, priorities, releaseDate, remove, retry, scrollAncestorsToShowTarget, scrollViewportToShowTarget, setDataInElement, spliceArray, toArray, toMap, toUnit, uid, version, wait };
6556
+ export { CKEditorError, Collection, Config, DOCUMENTATION_URL, DomEmitterMixin, ElementReplacer, EmitterMixin, EventInfo, FocusTracker, KeystrokeHandler, Locale, ObservableMixin, Rect, ResizeObserver, _clear as _clearTranslations, _getEmitterId, _getEmitterListenedTo, getUserAgent as _getUserAgent, isAndroid as _isAndroid, isBlink as _isBlink, isGecko as _isGecko, isMac as _isMac, isMediaForcedColors as _isMediaForcedColors, isMotionReduced as _isMotionReduced, isRegExpUnicodePropertySupported as _isRegExpUnicodePropertySupported, isSafari as _isSafari, isWindows as _isWindows, isiOS as _isiOS, _setEmitterId, _translate, _unifyTranslations, abortableDebounce, add, areConnectedThroughProperties, collectStylesheets, compareArrays, count, crc32, createElement, delay, diff, diffToChanges, env, exponentialDelay, fastDiff, findClosestScrollableAncestor, first, formatHtml, getAncestors, getBorderWidths, getCode, getCommonAncestor, getDataFromElement, getEnvKeystrokeText, getLanguageDirection, getLocalizedArrowKeyCodeDirection, getOptimalPosition, getPositionedAncestor, getRangeFromMouseEvent, getVisualViewportOffset, global, indexOf, insertAt, insertToPriorityArray, isArrowKeyCode, isCombiningMark, isComment, isForwardArrowKeyCode, isHighSurrogateHalf, isInsideCombinedSymbol, isInsideEmojiSequence, isInsideSurrogatePair, isIterable, isLowSurrogateHalf, isNode, isRange, isText, isValidAttributeName, isViewWithFocusTracker, isVisible, isWindow, keyCodes, logError, logWarning, mapsEqual, nth, objectToMap, parseBase64EncodedObject, parseKeystroke, priorities, releaseDate, remove, retry, scrollAncestorsToShowTarget, scrollViewportToShowTarget, setDataInElement, spliceArray, spy, toArray, toMap, toUnit, uid, version, wait };
6524
6557
  //# sourceMappingURL=index.js.map