@ckeditor/ckeditor5-utils 45.2.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-utils",
3
- "version": "45.2.1",
3
+ "version": "46.0.0-alpha.0",
4
4
  "description": "Miscellaneous utilities used by CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,8 +12,8 @@
12
12
  "type": "module",
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "@ckeditor/ckeditor5-ui": "45.2.1",
16
- "es-toolkit": "1.32.0"
15
+ "@ckeditor/ckeditor5-ui": "46.0.0-alpha.0",
16
+ "es-toolkit": "1.39.5"
17
17
  },
18
18
  "author": "CKSource (http://cksource.com/)",
19
19
  "license": "SEE LICENSE IN LICENSE.md",
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @param func The function to be called. It will be provided with `AbortSignal` as the first parameter.
12
12
  */
13
- export default function abortableDebounce<Args extends Array<any>, Ret>(func: (signal: AbortSignal, ...args: Args) => Ret): AbortableFunc<Args, Ret>;
13
+ export declare function abortableDebounce<Args extends Array<any>, Ret>(func: (signal: AbortSignal, ...args: Args) => Ret): AbortableFunc<Args, Ret>;
14
14
  export interface AbortableFunc<Args extends Array<any>, Ret> {
15
15
  (...args: Args): Ret;
16
16
  abort(): void;
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @param func The function to be called. It will be provided with `AbortSignal` as the first parameter.
12
12
  */
13
- export default function abortableDebounce(func) {
13
+ export function abortableDebounce(func) {
14
14
  let controller = new AbortController();
15
15
  function abortable(...args) {
16
16
  controller.abort();
@@ -8,4 +8,4 @@
8
8
  /**
9
9
  * Traverses both structures to find out whether there is a reference that is shared between both structures.
10
10
  */
11
- export default function areConnectedThroughProperties(obj1: object, obj2: object): boolean;
11
+ export declare function areConnectedThroughProperties(obj1: object, obj2: object): boolean;
@@ -8,7 +8,7 @@
8
8
  /**
9
9
  * Traverses both structures to find out whether there is a reference that is shared between both structures.
10
10
  */
11
- export default function areConnectedThroughProperties(obj1, obj2) {
11
+ export function areConnectedThroughProperties(obj1, obj2) {
12
12
  if (obj1 === obj2 && isObject(obj1)) {
13
13
  return true;
14
14
  }
@@ -37,7 +37,7 @@ export declare const DOCUMENTATION_URL = "https://ckeditor.com/docs/ckeditor5/la
37
37
  * } );
38
38
  * ```
39
39
  */
40
- export default class CKEditorError extends Error {
40
+ export declare class CKEditorError extends Error {
41
41
  /**
42
42
  * A context of the error by which the Watchdog is able to determine which editor crashed.
43
43
  */
@@ -59,8 +59,9 @@ export default class CKEditorError extends Error {
59
59
  * @param data Additional data describing the error. A stringified version of this object
60
60
  * will be appended to the error message, so the data are quickly visible in the console. The original
61
61
  * data object will also be later available under the {@link #data} property.
62
+ * @param originalError An optional original error that is being wrapped in the `CKEditorError` instance.
62
63
  */
63
- constructor(errorName: string, context?: object | null, data?: object);
64
+ constructor(errorName: string, context?: object | null, data?: object, originalError?: Error);
64
65
  /**
65
66
  * Checks if the error is of the `CKEditorError` type.
66
67
  */
@@ -70,11 +71,11 @@ export default class CKEditorError extends Error {
70
71
  * It is useful when combined with the {@link module:watchdog/watchdog~Watchdog} feature, which can restart the editor in case
71
72
  * of a {@link module:utils/ckeditorerror~CKEditorError} error.
72
73
  *
73
- * @param err The error to rethrow.
74
+ * @param error The error to rethrow.
74
75
  * @param context An object connected through properties with the editor instance. This context will be used
75
76
  * by the watchdog to verify which editor should be restarted.
76
77
  */
77
- static rethrowUnexpectedError(err: Error, context: object): never;
78
+ static rethrowUnexpectedError(error: Error, context: object): never;
78
79
  }
79
80
  /**
80
81
  * Logs a warning to the console with a properly formatted message and adds a link to the documentation.
@@ -37,7 +37,7 @@ export const DOCUMENTATION_URL = 'https://ckeditor.com/docs/ckeditor5/latest/sup
37
37
  * } );
38
38
  * ```
39
39
  */
40
- export default class CKEditorError extends Error {
40
+ export class CKEditorError extends Error {
41
41
  /**
42
42
  * A context of the error by which the Watchdog is able to determine which editor crashed.
43
43
  */
@@ -59,12 +59,19 @@ export default class CKEditorError extends Error {
59
59
  * @param data Additional data describing the error. A stringified version of this object
60
60
  * will be appended to the error message, so the data are quickly visible in the console. The original
61
61
  * data object will also be later available under the {@link #data} property.
62
+ * @param originalError An optional original error that is being wrapped in the `CKEditorError` instance.
62
63
  */
63
- constructor(errorName, context, data) {
64
- super(getErrorMessage(errorName, data));
64
+ constructor(errorName, context, data, originalError) {
65
+ super(getErrorMessage(errorName, data, originalError));
65
66
  this.name = 'CKEditorError';
66
67
  this.context = context;
67
68
  this.data = data;
69
+ // Wrapping an original error in a CKEditorError instance.
70
+ if (originalError) {
71
+ // Restore the original stack trace to make the error look like the original one.
72
+ // See https://github.com/ckeditor/ckeditor5/issues/5595 for more details.
73
+ this.stack = originalError.stack;
74
+ }
68
75
  }
69
76
  /**
70
77
  * Checks if the error is of the `CKEditorError` type.
@@ -77,13 +84,13 @@ export default class CKEditorError extends Error {
77
84
  * It is useful when combined with the {@link module:watchdog/watchdog~Watchdog} feature, which can restart the editor in case
78
85
  * of a {@link module:utils/ckeditorerror~CKEditorError} error.
79
86
  *
80
- * @param err The error to rethrow.
87
+ * @param error The error to rethrow.
81
88
  * @param context An object connected through properties with the editor instance. This context will be used
82
89
  * by the watchdog to verify which editor should be restarted.
83
90
  */
84
- static rethrowUnexpectedError(err, context) {
85
- if (err.is && err.is('CKEditorError')) {
86
- throw err;
91
+ static rethrowUnexpectedError(error, context) {
92
+ if (error.is && error.is('CKEditorError')) {
93
+ throw error;
87
94
  }
88
95
  /**
89
96
  * An unexpected error occurred inside the CKEditor 5 codebase. This error will look like the original one
@@ -94,11 +101,7 @@ export default class CKEditorError extends Error {
94
101
  *
95
102
  * @error unexpected-error
96
103
  */
97
- const error = new CKEditorError(err.message, context);
98
- // Restore the original stack trace to make the error look like the original one.
99
- // See https://github.com/ckeditor/ckeditor5/issues/5595 for more details.
100
- error.stack = err.stack;
101
- throw error;
104
+ throw new CKEditorError('unexpected-error', context, undefined, error);
102
105
  }
103
106
  }
104
107
  /**
@@ -159,7 +162,7 @@ function getLinkToDocumentationMessage(errorName) {
159
162
  /**
160
163
  * Returns formatted error message.
161
164
  */
162
- function getErrorMessage(errorName, data) {
165
+ function getErrorMessage(errorName, data, originalError) {
163
166
  const processedObjects = new WeakSet();
164
167
  const circularReferencesReplacer = (key, value) => {
165
168
  if (typeof value === 'object' && value !== null) {
@@ -172,7 +175,8 @@ function getErrorMessage(errorName, data) {
172
175
  };
173
176
  const stringifiedData = data ? ` ${JSON.stringify(data, circularReferencesReplacer)}` : '';
174
177
  const documentationLink = getLinkToDocumentationMessage(errorName);
175
- return errorName + stringifiedData + documentationLink;
178
+ const originalErrorMessage = originalError ? `\nOriginal error: ${originalError.name}: ${originalError.message}` : '';
179
+ return errorName + stringifiedData + documentationLink + originalErrorMessage;
176
180
  }
177
181
  /**
178
182
  * Returns formatted console error arguments.
@@ -18,7 +18,7 @@ declare const Collection_base: {
18
18
  *
19
19
  * @typeParam T The type of the collection element.
20
20
  */
21
- export default class Collection<T extends Record<string, any>> extends /* #__PURE__ */ Collection_base implements Iterable<T> {
21
+ export declare class Collection<T extends Record<string, any>> extends /* #__PURE__ */ Collection_base implements Iterable<T> {
22
22
  /**
23
23
  * The internal list of items in the collection.
24
24
  */
package/src/collection.js CHANGED
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * @module utils/collection
7
7
  */
8
- import EmitterMixin from './emittermixin.js';
9
- import CKEditorError from './ckeditorerror.js';
10
- import uid from './uid.js';
11
- import isIterable from './isiterable.js';
8
+ import { EmitterMixin } from './emittermixin.js';
9
+ import { CKEditorError } from './ckeditorerror.js';
10
+ import { uid } from './uid.js';
11
+ import { isIterable } from './isiterable.js';
12
12
  /**
13
13
  * Collections are ordered sets of objects. Items in the collection can be retrieved by their indexes
14
14
  * in the collection (like in an array) or by their ids.
@@ -21,7 +21,7 @@ import isIterable from './isiterable.js';
21
21
  *
22
22
  * @typeParam T The type of the collection element.
23
23
  */
24
- export default class Collection extends /* #__PURE__ */ EmitterMixin() {
24
+ export class Collection extends /* #__PURE__ */ EmitterMixin() {
25
25
  /**
26
26
  * The internal list of items in the collection.
27
27
  */
@@ -10,4 +10,4 @@
10
10
  *
11
11
  * @param stylesheets An array of stylesheet paths delivered by the user through the plugin configuration.
12
12
  */
13
- export default function collectStylesheets(stylesheets?: Array<string>): Promise<string>;
13
+ export declare function collectStylesheets(stylesheets?: Array<string>): Promise<string>;
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @param stylesheets An array of stylesheet paths delivered by the user through the plugin configuration.
12
12
  */
13
- export default async function collectStylesheets(stylesheets) {
13
+ export async function collectStylesheets(stylesheets) {
14
14
  if (!stylesheets) {
15
15
  return '';
16
16
  }
@@ -23,7 +23,7 @@
23
23
  * @param b Array to compare with.
24
24
  * @returns How array `a` is related to `b`.
25
25
  */
26
- export default function compareArrays(a: ReadonlyArray<unknown>, b: ReadonlyArray<unknown>): ArrayRelation | number;
26
+ export declare function compareArrays(a: ReadonlyArray<unknown>, b: ReadonlyArray<unknown>): ArrayRelation | number;
27
27
  /**
28
28
  * Array relation.
29
29
  */
@@ -23,7 +23,7 @@
23
23
  * @param b Array to compare with.
24
24
  * @returns How array `a` is related to `b`.
25
25
  */
26
- export default function compareArrays(a, b) {
26
+ export function compareArrays(a, b) {
27
27
  const minLen = Math.min(a.length, b.length);
28
28
  for (let i = 0; i < minLen; i++) {
29
29
  if (a[i] != b[i]) {
package/src/config.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * @typeParam Cfg A type of the configuration dictionary.
9
9
  */
10
- export default class Config<Cfg> {
10
+ export declare class Config<Cfg> {
11
11
  /**
12
12
  * Store for the whole configuration.
13
13
  */
package/src/config.js CHANGED
@@ -11,7 +11,7 @@ import { isPlainObject, isElement, cloneDeepWith } from 'es-toolkit/compat';
11
11
  *
12
12
  * @typeParam Cfg A type of the configuration dictionary.
13
13
  */
14
- export default class Config {
14
+ export class Config {
15
15
  /**
16
16
  * Store for the whole configuration.
17
17
  */
package/src/count.d.ts CHANGED
@@ -15,4 +15,4 @@
15
15
  * @param iterable Any iterable.
16
16
  * @returns Number of items returned by that iterable.
17
17
  */
18
- export default function count(iterable: Iterable<unknown>): number;
18
+ export declare function count(iterable: Iterable<unknown>): number;
package/src/count.js CHANGED
@@ -15,7 +15,7 @@
15
15
  * @param iterable Any iterable.
16
16
  * @returns Number of items returned by that iterable.
17
17
  */
18
- export default function count(iterable) {
18
+ export function count(iterable) {
19
19
  let count = 0;
20
20
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
21
21
  for (const _ of iterable) {
package/src/crc32.d.ts CHANGED
@@ -16,11 +16,10 @@
16
16
  *
17
17
  * @returns The CRC-32 checksum, returned as a hexadecimal string.
18
18
  */
19
- export default function crc32(inputData: CRCData): string;
19
+ export declare function crc32(inputData: CRCData): string;
20
20
  /**
21
21
  * The input data for the CRC-32 checksum calculation.
22
22
  * Can be a single value (string, number, boolean), an array of strings, or an array of all of the above types.
23
23
  */
24
24
  export type CRCData = CRCValue | Array<CRCValue>;
25
- type CRCValue = string | number | boolean | Array<string>;
26
- export {};
25
+ export type CRCValue = string | number | boolean | Array<string>;
package/src/crc32.js CHANGED
@@ -40,7 +40,7 @@ function makeCrcTable() {
40
40
  *
41
41
  * @returns The CRC-32 checksum, returned as a hexadecimal string.
42
42
  */
43
- export default function crc32(inputData) {
43
+ export function crc32(inputData) {
44
44
  const dataArray = Array.isArray(inputData) ? inputData : [inputData];
45
45
  const crcTable = makeCrcTable();
46
46
  let crc = 0 ^ (-1);
package/src/delay.d.ts CHANGED
@@ -12,7 +12,7 @@
12
12
  * @param func The function to wrap.
13
13
  * @param wait The timeout in ms.
14
14
  */
15
- export default function delay<T extends (...args: Array<any>) => any>(func: T, wait: number): DelayedFunc<T>;
15
+ export declare function delay<T extends (...args: Array<any>) => any>(func: T, wait: number): DelayedFunc<T>;
16
16
  export interface DelayedFunc<T extends (...args: Array<any>) => any> {
17
17
  (...args: Parameters<T>): void;
18
18
  cancel(): void;
package/src/delay.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * @param func The function to wrap.
13
13
  * @param wait The timeout in ms.
14
14
  */
15
- export default function delay(func, wait) {
15
+ export function delay(func, wait) {
16
16
  let timer;
17
17
  function delayed(...args) {
18
18
  delayed.cancel();
package/src/diff.d.ts CHANGED
@@ -20,11 +20,10 @@
20
20
  * @param cmp Optional function used to compare array values, by default === is used.
21
21
  * @returns Array of changes.
22
22
  */
23
- declare function diff<T>(a: ArrayLike<T>, b: ArrayLike<T>, cmp?: (a: T, b: T) => boolean): Array<DiffResult>;
24
- declare namespace diff {
25
- var fastDiff: typeof import("./fastdiff.js").default;
23
+ export declare function diff<T>(a: ArrayLike<T>, b: ArrayLike<T>, cmp?: (a: T, b: T) => boolean): Array<DiffResult>;
24
+ export declare namespace diff {
25
+ var fastDiff: typeof import("./fastdiff.js").fastDiff;
26
26
  }
27
- export default diff;
28
27
  /**
29
28
  * The element of the result of {@link module:utils/diff~diff} function.
30
29
  */
package/src/diff.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module utils/diff
7
7
  */
8
- import fastDiff from './fastdiff.js';
8
+ import { fastDiff } from './fastdiff.js';
9
9
  // The following code is based on the "O(NP) Sequence Comparison Algorithm"
10
10
  // by Sun Wu, Udi Manber, Gene Myers, Webb Miller.
11
11
  /**
@@ -26,7 +26,7 @@ import fastDiff from './fastdiff.js';
26
26
  * @param cmp Optional function used to compare array values, by default === is used.
27
27
  * @returns Array of changes.
28
28
  */
29
- export default function diff(a, b, cmp) {
29
+ export function diff(a, b, cmp) {
30
30
  // Set the comparator function.
31
31
  cmp = cmp || function (a, b) {
32
32
  return a === b;
@@ -32,7 +32,7 @@ import type { DiffResult } from './diff.js';
32
32
  * @returns Set of changes (insert or delete) which need to be applied to the input
33
33
  * in order to transform it into the output.
34
34
  */
35
- export default function diffToChanges<T>(diff: ReadonlyArray<DiffResult>, output: ArrayLike<T>): Array<Change<T>>;
35
+ export declare function diffToChanges<T>(diff: ReadonlyArray<DiffResult>, output: ArrayLike<T>): Array<Change<T>>;
36
36
  /**
37
37
  * An object describing insertion change.
38
38
  *
@@ -31,7 +31,7 @@
31
31
  * @returns Set of changes (insert or delete) which need to be applied to the input
32
32
  * in order to transform it into the output.
33
33
  */
34
- export default function diffToChanges(diff, output) {
34
+ export function diffToChanges(diff, output) {
35
35
  const changes = [];
36
36
  let index = 0;
37
37
  let lastOperation = null;
@@ -5,19 +5,19 @@
5
5
  /**
6
6
  * Attributes to be applied to the HTML element.
7
7
  */
8
- type HTMLElementAttributes = {
8
+ export type HTMLElementAttributes = {
9
9
  readonly [key: string]: string;
10
10
  };
11
11
  /**
12
12
  * Attributes to be applied to the SVG element.
13
13
  */
14
- type SVGElementAttributes = HTMLElementAttributes & {
14
+ export type SVGElementAttributes = HTMLElementAttributes & {
15
15
  xmlns: string;
16
16
  };
17
17
  /**
18
18
  * Element or elements that will be added to the created element as children. Strings will be automatically turned into Text nodes.
19
19
  */
20
- type ChildrenElements = Node | string | Iterable<Node | string>;
20
+ export type ChildrenElements = Node | string | Iterable<Node | string>;
21
21
  /**
22
22
  * Creates an SVG element with attributes and children elements.
23
23
  *
@@ -35,7 +35,7 @@ type ChildrenElements = Node | string | Iterable<Node | string>;
35
35
  * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
36
36
  * @returns SVG element.
37
37
  */
38
- export default function createElement<T extends keyof SVGElementTagNameMap>(doc: Document, name: T, attributes: SVGElementAttributes, children?: ChildrenElements): SVGElementTagNameMap[T];
38
+ export declare function createElement<T extends keyof SVGElementTagNameMap>(doc: Document, name: T, attributes: SVGElementAttributes, children?: ChildrenElements): SVGElementTagNameMap[T];
39
39
  /**
40
40
  * Creates an HTML element with attributes and children elements.
41
41
  *
@@ -53,5 +53,4 @@ export default function createElement<T extends keyof SVGElementTagNameMap>(doc:
53
53
  * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
54
54
  * @returns HTML element.
55
55
  */
56
- export default function createElement<T extends keyof HTMLElementTagNameMap>(doc: Document, name: T, attributes?: HTMLElementAttributes, children?: ChildrenElements): HTMLElementTagNameMap[T];
57
- export {};
56
+ export declare function createElement<T extends keyof HTMLElementTagNameMap>(doc: Document, name: T, attributes?: HTMLElementAttributes, children?: ChildrenElements): HTMLElementTagNameMap[T];
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module utils/dom/createelement
7
7
  */
8
- import isIterable from '../isiterable.js';
8
+ import { isIterable } from '../isiterable.js';
9
9
  import { isString } from 'es-toolkit/compat';
10
10
  /**
11
11
  * Creates an HTML or SVG element with attributes and children elements.
@@ -21,7 +21,7 @@ import { isString } from 'es-toolkit/compat';
21
21
  * @param children Child or any iterable of children. Strings will be automatically turned into Text nodes.
22
22
  * @returns HTML or SVG element.
23
23
  */
24
- export default function createElement(doc, name, attributes = {}, children = []) {
24
+ export function createElement(doc, name, attributes = {}, children = []) {
25
25
  const namespace = attributes && attributes.xmlns;
26
26
  const element = namespace ? doc.createElementNS(namespace, name) : doc.createElement(name);
27
27
  for (const key in attributes) {
@@ -6,7 +6,7 @@
6
6
  * @module utils/dom/emittermixin
7
7
  */
8
8
  import { type Emitter, type CallbackOptions, type BaseEvent, type GetCallback } from '../emittermixin.js';
9
- import type EventInfo from '../eventinfo.js';
9
+ import { type EventInfo } from '../eventinfo.js';
10
10
  import type { Constructor, Mixed } from '../mix.js';
11
11
  /**
12
12
  * Mixin that injects the DOM events API into its host. It provides the API
@@ -18,7 +18,7 @@ import type { Constructor, Mixed } from '../mix.js';
18
18
  * but it can also be mixed into any other class:
19
19
  *
20
20
  * ```ts
21
- * import DomEmitterMixin from '../utils/dom/emittermixin.js';
21
+ * import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
22
22
  *
23
23
  * class BaseClass { ... }
24
24
  *
@@ -32,7 +32,7 @@ import type { Constructor, Mixed } from '../mix.js';
32
32
  *
33
33
  * @label EXTENDS
34
34
  */
35
- export default function DomEmitterMixin<Base extends Constructor<Emitter>>(base: Base): Mixed<Base, DomEmitter>;
35
+ export declare function DomEmitterMixin<Base extends Constructor<Emitter>>(base: Base): Mixed<Base, DomEmitter>;
36
36
  /**
37
37
  * Mixin that injects the DOM events API into its host. It provides the API
38
38
  * compatible with {@link module:utils/emittermixin~Emitter}.
@@ -43,7 +43,7 @@ export default function DomEmitterMixin<Base extends Constructor<Emitter>>(base:
43
43
  * but it can also be mixed into any other class:
44
44
  *
45
45
  * ```ts
46
- * import DomEmitterMixin from '../utils/dom/emittermixin.js';
46
+ * import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
47
47
  *
48
48
  * class SomeView extends DomEmitterMixin() {}
49
49
  *
@@ -55,7 +55,7 @@ export default function DomEmitterMixin<Base extends Constructor<Emitter>>(base:
55
55
  *
56
56
  * @label NO_ARGUMENTS
57
57
  */
58
- export default function DomEmitterMixin(): {
58
+ export declare function DomEmitterMixin(): {
59
59
  new (): DomEmitter;
60
60
  prototype: DomEmitter;
61
61
  };
@@ -5,13 +5,13 @@
5
5
  /**
6
6
  * @module utils/dom/emittermixin
7
7
  */
8
- import EmitterMixin, { _getEmitterListenedTo, _setEmitterId } from '../emittermixin.js';
9
- import uid from '../uid.js';
10
- import isNode from './isnode.js';
11
- import isWindow from './iswindow.js';
12
- import global from './global.js';
8
+ import { EmitterMixin, _getEmitterListenedTo, _setEmitterId } from '../emittermixin.js';
9
+ import { uid } from '../uid.js';
10
+ import { isNode } from './isnode.js';
11
+ import { isWindow } from './iswindow.js';
12
+ import { global } from './global.js';
13
13
  const defaultEmitterClass = /* #__PURE__ */ DomEmitterMixin(/* #__PURE__ */ EmitterMixin());
14
- export default function DomEmitterMixin(base) {
14
+ export function DomEmitterMixin(base) {
15
15
  if (!base) {
16
16
  return defaultEmitterClass;
17
17
  }
@@ -74,15 +74,6 @@ export default function DomEmitterMixin(base) {
74
74
  }
75
75
  return Mixin;
76
76
  }
77
- // Backward compatibility with `mix`
78
- ([
79
- '_getProxyEmitter', '_getAllProxyEmitters',
80
- 'on', 'once', 'off', 'listenTo',
81
- 'stopListening', 'fire', 'delegate', 'stopDelegating',
82
- '_addEventListener', '_removeEventListener'
83
- ]).forEach(key => {
84
- DomEmitterMixin[key] = defaultEmitterClass.prototype[key];
85
- });
86
77
  /**
87
78
  * Creates a ProxyEmitter instance. Such an instance is a bridge between a DOM Node firing events
88
79
  * and any Host listening to them. It is backwards compatible with {@link module:utils/emittermixin~Emitter#on}.
@@ -8,4 +8,4 @@
8
8
  * @param domElement DOM element.
9
9
  * @returns First ancestor of `domElement` that is scrollable or null if such ancestor doesn't exist.
10
10
  */
11
- export default function findClosestScrollableAncestor(domElement: HTMLElement): HTMLElement | null;
11
+ export declare function findClosestScrollableAncestor(domElement: HTMLElement): HTMLElement | null;
@@ -5,14 +5,14 @@
5
5
  /**
6
6
  * @module utils/dom/findclosestscrollableancestor
7
7
  */
8
- import global from './global.js';
8
+ import { global } from './global.js';
9
9
  /**
10
10
  * Returns the closest scrollable ancestor of a DOM element.
11
11
  *
12
12
  * @param domElement DOM element.
13
13
  * @returns First ancestor of `domElement` that is scrollable or null if such ancestor doesn't exist.
14
14
  */
15
- export default function findClosestScrollableAncestor(domElement) {
15
+ export function findClosestScrollableAncestor(domElement) {
16
16
  let element = domElement.parentElement;
17
17
  if (!element) {
18
18
  return null;
@@ -14,4 +14,4 @@
14
14
  * @param node DOM node.
15
15
  * @returns Array of given `node` parents.
16
16
  */
17
- export default function getAncestors(node: Node): Array<Node>;
17
+ export declare function getAncestors(node: Node): Array<Node>;
@@ -14,7 +14,7 @@
14
14
  * @param node DOM node.
15
15
  * @returns Array of given `node` parents.
16
16
  */
17
- export default function getAncestors(node) {
17
+ export function getAncestors(node) {
18
18
  const nodes = [];
19
19
  let currentNode = node;
20
20
  // We are interested in `Node`s `DocumentFragment`s only.
@@ -12,7 +12,7 @@
12
12
  * @returns An object containing `top`, `left`, `right` and `bottom` properties
13
13
  * with numerical values of the `border-[top,left,right,bottom]-width` CSS styles.
14
14
  */
15
- export default function getBorderWidths(element: HTMLElement): BorderWidths;
15
+ export declare function getBorderWidths(element: HTMLElement): BorderWidths;
16
16
  /**
17
17
  * An object describing widths of `HTMLElement` borders.
18
18
  */
@@ -12,7 +12,7 @@
12
12
  * @returns An object containing `top`, `left`, `right` and `bottom` properties
13
13
  * with numerical values of the `border-[top,left,right,bottom]-width` CSS styles.
14
14
  */
15
- export default function getBorderWidths(element) {
15
+ export function getBorderWidths(element) {
16
16
  // Call getComputedStyle on the window the element document belongs to.
17
17
  const style = element.ownerDocument.defaultView.getComputedStyle(element);
18
18
  return {
@@ -9,4 +9,4 @@
9
9
  * @param nodeB Second node.
10
10
  * @returns Lowest common ancestor of both nodes or `null` if nodes do not have a common ancestor.
11
11
  */
12
- export default function getCommonAncestor(nodeA: Node, nodeB: Node): Node | null;
12
+ export declare function getCommonAncestor(nodeA: Node, nodeB: Node): Node | null;
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module utils/dom/getcommonancestor
7
7
  */
8
- import getAncestors from './getancestors.js';
8
+ import { getAncestors } from './getancestors.js';
9
9
  /**
10
10
  * Searches and returns the lowest common ancestor of two given nodes.
11
11
  *
@@ -13,7 +13,7 @@ import getAncestors from './getancestors.js';
13
13
  * @param nodeB Second node.
14
14
  * @returns Lowest common ancestor of both nodes or `null` if nodes do not have a common ancestor.
15
15
  */
16
- export default function getCommonAncestor(nodeA, nodeB) {
16
+ export function getCommonAncestor(nodeA, nodeB) {
17
17
  const ancestorsA = getAncestors(nodeA);
18
18
  const ancestorsB = getAncestors(nodeB);
19
19
  let i = 0;
@@ -11,4 +11,4 @@
11
11
  * @param el The element from which the data will be retrieved.
12
12
  * @returns The data string.
13
13
  */
14
- export default function getDataFromElement(el: HTMLElement): string;
14
+ export declare function getDataFromElement(el: HTMLElement): string;
@@ -11,7 +11,7 @@
11
11
  * @param el The element from which the data will be retrieved.
12
12
  * @returns The data string.
13
13
  */
14
- export default function getDataFromElement(el) {
14
+ export function getDataFromElement(el) {
15
15
  if (el instanceof HTMLTextAreaElement) {
16
16
  return el.value;
17
17
  }
@@ -7,4 +7,4 @@
7
7
  *
8
8
  * @param element The native DOM element to be checked.
9
9
  */
10
- export default function getPositionedAncestor(element?: HTMLElement): HTMLElement | null;
10
+ export declare function getPositionedAncestor(element?: HTMLElement): HTMLElement | null;