@ckeditor/ckeditor5-utils 45.0.0 → 45.1.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.
- package/dist/index.js +34 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/dom/getvisualviewportoffset.d.ts +11 -0
- package/src/dom/getvisualviewportoffset.js +21 -0
- package/src/index.d.ts +2 -1
- package/src/index.js +2 -1
- package/src/keyboard.js +1 -1
- package/src/language.js +2 -1
- package/src/locale.d.ts +1 -1
- package/src/locale.js +1 -1
- package/src/observablemixin.js +2 -2
- package/src/retry.d.ts +3 -2
- package/src/retry.js +3 -2
- package/src/splicearray.d.ts +3 -4
- package/src/splicearray.js +3 -4
- package/src/version.d.ts +1 -1
- package/src/version.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-utils",
|
|
3
|
-
"version": "45.0.0",
|
|
3
|
+
"version": "45.1.0-alpha.0",
|
|
4
4
|
"description": "Miscellaneous utilities used by CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@ckeditor/ckeditor5-ui": "45.0.0",
|
|
15
|
+
"@ckeditor/ckeditor5-ui": "45.1.0-alpha.0",
|
|
16
16
|
"es-toolkit": "1.32.0"
|
|
17
17
|
},
|
|
18
18
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Returns the visual viewport offsets to adjust elements with `position: fixed` style.
|
|
7
|
+
*/
|
|
8
|
+
export default function getVisualViewportOffset(): {
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module utils/dom/getvisualviewportoffset
|
|
7
|
+
*/
|
|
8
|
+
import global from './global.js';
|
|
9
|
+
import env from '../env.js';
|
|
10
|
+
/**
|
|
11
|
+
* Returns the visual viewport offsets to adjust elements with `position: fixed` style.
|
|
12
|
+
*/
|
|
13
|
+
export default function getVisualViewportOffset() {
|
|
14
|
+
const visualViewport = global.window.visualViewport;
|
|
15
|
+
if (!visualViewport || !(env.isiOS || env.isSafari)) {
|
|
16
|
+
return { left: 0, top: 0 };
|
|
17
|
+
}
|
|
18
|
+
const left = Math.max(Math.round(visualViewport.offsetLeft), 0);
|
|
19
|
+
const top = Math.max(Math.round(visualViewport.offsetTop), 0);
|
|
20
|
+
return { left, top };
|
|
21
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* @module utils
|
|
6
|
+
* @module utils/index
|
|
7
7
|
*/
|
|
8
8
|
export { default as env } from './env.js';
|
|
9
9
|
export { default as diff, type DiffResult } from './diff.js';
|
|
@@ -43,6 +43,7 @@ export { default as isValidAttributeName } from './dom/isvalidattributename.js';
|
|
|
43
43
|
export { default as isVisible } from './dom/isvisible.js';
|
|
44
44
|
export { getOptimalPosition, type Options as PositionOptions, type PositioningFunction, type DomPoint } from './dom/position.js';
|
|
45
45
|
export { default as remove } from './dom/remove.js';
|
|
46
|
+
export { default as getVisualViewportOffset } from './dom/getvisualviewportoffset.js';
|
|
46
47
|
export * from './dom/scroll.js';
|
|
47
48
|
export * from './keyboard.js';
|
|
48
49
|
export * from './language.js';
|
package/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* @module utils
|
|
6
|
+
* @module utils/index
|
|
7
7
|
*/
|
|
8
8
|
export { default as env } from './env.js';
|
|
9
9
|
export { default as diff } from './diff.js';
|
|
@@ -42,6 +42,7 @@ export { default as isValidAttributeName } from './dom/isvalidattributename.js';
|
|
|
42
42
|
export { default as isVisible } from './dom/isvisible.js';
|
|
43
43
|
export { getOptimalPosition } from './dom/position.js';
|
|
44
44
|
export { default as remove } from './dom/remove.js';
|
|
45
|
+
export { default as getVisualViewportOffset } from './dom/getvisualviewportoffset.js';
|
|
45
46
|
export * from './dom/scroll.js';
|
|
46
47
|
export * from './keyboard.js';
|
|
47
48
|
export * from './language.js';
|
package/src/keyboard.js
CHANGED
|
@@ -66,7 +66,7 @@ export function getCode(key) {
|
|
|
66
66
|
* Unknown key name. Only key names included in the {@link module:utils/keyboard#keyCodes} can be used.
|
|
67
67
|
*
|
|
68
68
|
* @error keyboard-unknown-key
|
|
69
|
-
* @param {
|
|
69
|
+
* @param {string} key Ths specified key name.
|
|
70
70
|
*/
|
|
71
71
|
throw new CKEditorError('keyboard-unknown-key', null, { key });
|
|
72
72
|
}
|
package/src/language.js
CHANGED
package/src/locale.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export default class Locale {
|
|
|
101
101
|
* @param options.contentLanguage The editor content language code in the
|
|
102
102
|
* [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format. If not specified, the same as `options.language`.
|
|
103
103
|
* See {@link #contentLanguage}.
|
|
104
|
-
* @param translations Translations passed as a editor config parameter.
|
|
104
|
+
* @param options.translations Translations passed as a editor config parameter.
|
|
105
105
|
*/
|
|
106
106
|
constructor({ uiLanguage, contentLanguage, translations }?: {
|
|
107
107
|
readonly uiLanguage?: string;
|
package/src/locale.js
CHANGED
|
@@ -102,7 +102,7 @@ export default class Locale {
|
|
|
102
102
|
* @param options.contentLanguage The editor content language code in the
|
|
103
103
|
* [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format. If not specified, the same as `options.language`.
|
|
104
104
|
* See {@link #contentLanguage}.
|
|
105
|
-
* @param translations Translations passed as a editor config parameter.
|
|
105
|
+
* @param options.translations Translations passed as a editor config parameter.
|
|
106
106
|
*/
|
|
107
107
|
constructor({ uiLanguage = 'en', contentLanguage, translations } = {}) {
|
|
108
108
|
this.uiLanguage = uiLanguage;
|
package/src/observablemixin.js
CHANGED
|
@@ -172,8 +172,8 @@ export default function ObservableMixin(base) {
|
|
|
172
172
|
* Cannot decorate an undefined method.
|
|
173
173
|
*
|
|
174
174
|
* @error observablemixin-cannot-decorate-undefined
|
|
175
|
-
* @param {
|
|
176
|
-
* @param {
|
|
175
|
+
* @param {object} object The object which method should be decorated.
|
|
176
|
+
* @param {string} methodName Name of the method which does not exist.
|
|
177
177
|
*/
|
|
178
178
|
throw new CKEditorError('observablemixin-cannot-decorate-undefined', this, { object: this, methodName });
|
|
179
179
|
}
|
package/src/retry.d.ts
CHANGED
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Tries calling the given callback until it sucessfully resolves.
|
|
7
7
|
*
|
|
8
|
-
* If the callback fails `
|
|
8
|
+
* If the callback fails `maxAttempts` times, the returned promise is rejected with the last error.
|
|
9
9
|
*
|
|
10
10
|
* @typeParam TResult The result of a successful callback invocation.
|
|
11
11
|
* @param callback The function to call until it succeeds.
|
|
12
|
-
* @param options
|
|
12
|
+
* @param options Configuration options.
|
|
13
|
+
* @param options.maxAttempts Maximum number of attempts.
|
|
13
14
|
* @param options.retryDelay The time in milliseconds between attempts. By default it implements exponential back-off policy.
|
|
14
15
|
* @param options.signal The signal to abort further retries. The callback itself is not aborted automatically.
|
|
15
16
|
*/
|
package/src/retry.js
CHANGED
|
@@ -9,11 +9,12 @@ import wait from './wait.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* Tries calling the given callback until it sucessfully resolves.
|
|
11
11
|
*
|
|
12
|
-
* If the callback fails `
|
|
12
|
+
* If the callback fails `maxAttempts` times, the returned promise is rejected with the last error.
|
|
13
13
|
*
|
|
14
14
|
* @typeParam TResult The result of a successful callback invocation.
|
|
15
15
|
* @param callback The function to call until it succeeds.
|
|
16
|
-
* @param options
|
|
16
|
+
* @param options Configuration options.
|
|
17
|
+
* @param options.maxAttempts Maximum number of attempts.
|
|
17
18
|
* @param options.retryDelay The time in milliseconds between attempts. By default it implements exponential back-off policy.
|
|
18
19
|
* @param options.signal The signal to abort further retries. The callback itself is not aborted automatically.
|
|
19
20
|
*/
|
package/src/splicearray.d.ts
CHANGED
|
@@ -17,10 +17,9 @@
|
|
|
17
17
|
* spliceArray( [ 1, 2 ], [], 0 ); // [ 1, 2 ]
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param count Number of items.
|
|
20
|
+
* @param targetArray Array to be spliced.
|
|
21
|
+
* @param insertArray Array of elements to be inserted to target.
|
|
22
|
+
* @param index Index at which nodes should be inserted.
|
|
24
23
|
*
|
|
25
24
|
* @returns New spliced array.
|
|
26
25
|
*/
|
package/src/splicearray.js
CHANGED
|
@@ -17,10 +17,9 @@
|
|
|
17
17
|
* spliceArray( [ 1, 2 ], [], 0 ); // [ 1, 2 ]
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param count Number of items.
|
|
20
|
+
* @param targetArray Array to be spliced.
|
|
21
|
+
* @param insertArray Array of elements to be inserted to target.
|
|
22
|
+
* @param index Index at which nodes should be inserted.
|
|
24
23
|
*
|
|
25
24
|
* @returns New spliced array.
|
|
26
25
|
*/
|
package/src/version.d.ts
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
|
-
declare const version = "45.0.0";
|
|
5
|
+
declare const version = "45.1.0-alpha.0";
|
|
6
6
|
export default version;
|
|
7
7
|
export declare const releaseDate: Date;
|
|
8
8
|
declare global {
|
package/src/version.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @module utils/version
|
|
7
7
|
*/
|
|
8
8
|
import CKEditorError from './ckeditorerror.js';
|
|
9
|
-
const version = '45.0.0';
|
|
9
|
+
const version = '45.1.0-alpha.0';
|
|
10
10
|
export default version;
|
|
11
11
|
// The second argument is not a month. It is `monthIndex` and starts from `0`.
|
|
12
|
-
export const releaseDate = new Date(2025,
|
|
12
|
+
export const releaseDate = new Date(2025, 4, 7);
|
|
13
13
|
/* istanbul ignore next -- @preserve */
|
|
14
14
|
if (globalThis.CKEDITOR_VERSION) {
|
|
15
15
|
/**
|