@ckeditor/ckeditor5-utils 41.3.1 → 41.4.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 (77) hide show
  1. package/dist/index-content.css +4 -0
  2. package/dist/index-editor.css +4 -0
  3. package/dist/index.css +4 -0
  4. package/dist/index.js +5491 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/types/abortabledebounce.d.ts +21 -0
  7. package/dist/types/areconnectedthroughproperties.d.ts +15 -0
  8. package/dist/types/ckeditorerror.d.ts +127 -0
  9. package/dist/types/collection.d.ts +437 -0
  10. package/dist/types/comparearrays.d.ts +34 -0
  11. package/dist/types/config.d.ts +167 -0
  12. package/dist/types/count.d.ts +22 -0
  13. package/dist/types/delay.d.ts +23 -0
  14. package/dist/types/diff.d.ts +35 -0
  15. package/dist/types/difftochanges.d.ts +63 -0
  16. package/dist/types/dom/createelement.d.ts +61 -0
  17. package/dist/types/dom/emittermixin.d.ts +146 -0
  18. package/dist/types/dom/findclosestscrollableancestor.d.ts +15 -0
  19. package/dist/types/dom/getancestors.d.ts +21 -0
  20. package/dist/types/dom/getborderwidths.d.ts +28 -0
  21. package/dist/types/dom/getcommonancestor.d.ts +16 -0
  22. package/dist/types/dom/getdatafromelement.d.ts +18 -0
  23. package/dist/types/dom/getpositionedancestor.d.ts +14 -0
  24. package/dist/types/dom/global.d.ts +36 -0
  25. package/dist/types/dom/indexof.d.ts +18 -0
  26. package/dist/types/dom/insertat.d.ts +19 -0
  27. package/dist/types/dom/iscomment.d.ts +15 -0
  28. package/dist/types/dom/isnode.d.ts +15 -0
  29. package/dist/types/dom/isrange.d.ts +15 -0
  30. package/dist/types/dom/istext.d.ts +15 -0
  31. package/dist/types/dom/isvalidattributename.d.ts +14 -0
  32. package/dist/types/dom/isvisible.d.ts +22 -0
  33. package/dist/types/dom/iswindow.d.ts +15 -0
  34. package/dist/types/dom/position.d.ts +215 -0
  35. package/dist/types/dom/rect.d.ts +199 -0
  36. package/dist/types/dom/remove.d.ts +17 -0
  37. package/dist/types/dom/resizeobserver.d.ts +78 -0
  38. package/dist/types/dom/scroll.d.ts +77 -0
  39. package/dist/types/dom/setdatainelement.d.ts +18 -0
  40. package/dist/types/dom/tounit.d.ts +26 -0
  41. package/dist/types/elementreplacer.d.ts +35 -0
  42. package/dist/types/emittermixin.d.ts +316 -0
  43. package/dist/types/env.d.ts +137 -0
  44. package/dist/types/eventinfo.d.ts +62 -0
  45. package/dist/types/fastdiff.d.ts +116 -0
  46. package/dist/types/first.d.ts +15 -0
  47. package/dist/types/focustracker.d.ts +79 -0
  48. package/dist/types/index.d.ts +68 -0
  49. package/dist/types/inserttopriorityarray.d.ts +34 -0
  50. package/dist/types/isiterable.d.ts +18 -0
  51. package/dist/types/keyboard.d.ts +130 -0
  52. package/dist/types/keystrokehandler.d.ts +91 -0
  53. package/dist/types/language.d.ts +21 -0
  54. package/dist/types/locale.d.ts +145 -0
  55. package/dist/types/mapsequal.d.ts +19 -0
  56. package/dist/types/mix.d.ts +89 -0
  57. package/dist/types/nth.d.ts +20 -0
  58. package/dist/types/objecttomap.d.ts +27 -0
  59. package/dist/types/observablemixin.d.ts +564 -0
  60. package/dist/types/priorities.d.ts +37 -0
  61. package/dist/types/retry.d.ts +37 -0
  62. package/dist/types/splicearray.d.ts +30 -0
  63. package/dist/types/spy.d.ts +25 -0
  64. package/dist/types/toarray.d.ts +29 -0
  65. package/dist/types/tomap.d.ts +23 -0
  66. package/dist/types/translation-service.d.ts +178 -0
  67. package/dist/types/uid.d.ts +19 -0
  68. package/dist/types/unicode.d.ts +58 -0
  69. package/dist/types/verifylicense.d.ts +19 -0
  70. package/dist/types/version.d.ts +14 -0
  71. package/dist/types/wait.d.ts +20 -0
  72. package/package.json +2 -1
  73. package/src/env.d.ts +16 -0
  74. package/src/env.js +16 -0
  75. package/src/locale.d.ts +1 -1
  76. package/src/version.d.ts +1 -1
  77. package/src/version.js +2 -2
@@ -0,0 +1,25 @@
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/spy
11
+ */
12
+ /**
13
+ * Creates a spy function (ala Sinon.js) that can be used to inspect call to it.
14
+ *
15
+ * The following are the present features:
16
+ *
17
+ * * spy.called: property set to `true` if the function has been called at least once.
18
+ *
19
+ * @returns The spy function.
20
+ */
21
+ declare function spy(): {
22
+ (): void;
23
+ called?: boolean;
24
+ };
25
+ export default spy;
@@ -0,0 +1,29 @@
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/toarray
11
+ */
12
+ /**
13
+ * Transforms any value to an array. If the provided value is already an array, it is returned unchanged.
14
+ *
15
+ * @label MUTABLE
16
+ * @param data The value to transform to an array.
17
+ * @returns An array created from data.
18
+ */
19
+ export default function toArray<T>(data: ArrayOrItem<T>): Array<T>;
20
+ /**
21
+ * Transforms any value to an array. If the provided value is already an array, it is returned unchanged.
22
+ *
23
+ * @label IMMUTABLE
24
+ * @param data The value to transform to an array.
25
+ * @returns An array created from data.
26
+ */
27
+ export default function toArray<T>(data: ReadonlyArrayOrItem<T>): ReadonlyArray<T>;
28
+ export type ArrayOrItem<T> = T | Array<T>;
29
+ export type ReadonlyArrayOrItem<T> = T | ReadonlyArray<T>;
@@ -0,0 +1,23 @@
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
+ * Transforms object or iterable to map. Iterable needs to be in the format acceptable by the `Map` constructor.
11
+ *
12
+ * ```ts
13
+ * map = toMap( { 'foo': 1, 'bar': 2 } );
14
+ * map = toMap( [ [ 'foo', 1 ], [ 'bar', 2 ] ] );
15
+ * map = toMap( anotherMap );
16
+ * ```
17
+ *
18
+ * @param data Object or iterable to transform.
19
+ * @returns Map created from data.
20
+ */
21
+ export default function toMap<T>(data: {
22
+ readonly [key: string]: T;
23
+ } | Iterable<readonly [string, T]> | null | undefined): Map<string, T>;
@@ -0,0 +1,178 @@
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/translation-service
11
+ */
12
+ import type { Translations } from './locale.js';
13
+ import { type ArrayOrItem } from './toarray.js';
14
+ declare global {
15
+ var CKEDITOR_TRANSLATIONS: Translations;
16
+ }
17
+ /**
18
+ * Adds translations to existing ones or overrides the existing translations. These translations will later
19
+ * be available for the {@link module:utils/locale~Locale#t `t()`} function.
20
+ *
21
+ * The `translations` is an object which consists of `messageId: translation` pairs. Note that the message ID can be
22
+ * either constructed from the message string or from the message ID if it was passed
23
+ * (this happens rarely and mostly for short messages or messages with placeholders).
24
+ * Since the editor displays only the message string, the message ID can be found either in the source code or in the
25
+ * built translations for another language.
26
+ *
27
+ * ```ts
28
+ * add( 'pl', {
29
+ * 'Cancel': 'Anuluj',
30
+ * 'IMAGE': 'obraz', // Note that the `IMAGE` comes from the message ID, while the string can be `image`.
31
+ * } );
32
+ * ```
33
+ *
34
+ * If the message is supposed to support various plural forms, make sure to provide an array with the singular form and all plural forms:
35
+ *
36
+ * ```ts
37
+ * add( 'pl', {
38
+ * 'Add space': [ 'Dodaj spację', 'Dodaj %0 spacje', 'Dodaj %0 spacji' ]
39
+ * } );
40
+ * ```
41
+ *
42
+ * You should also specify the third argument (the `getPluralForm()` function) that will be used to determine the plural form if no
43
+ * language file was loaded for that language. All language files coming from CKEditor 5 sources will have this option set, so
44
+ * these plural form rules will be reused by other translations added to the registered languages. The `getPluralForm()` function
45
+ * can return either a Boolean or a number.
46
+ *
47
+ * ```ts
48
+ * add( 'en', {
49
+ * // ... Translations.
50
+ * }, n => n !== 1 );
51
+ * add( 'pl', {
52
+ * // ... Translations.
53
+ * }, n => n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && ( n % 100 < 10 || n % 100 >= 20 ) ? 1 : 2 );
54
+ * ```
55
+ *
56
+ * All translations extend the global `window.CKEDITOR_TRANSLATIONS` object. An example of this object can be found below:
57
+ *
58
+ * ```ts
59
+ * {
60
+ * pl: {
61
+ * dictionary: {
62
+ * 'Cancel': 'Anuluj',
63
+ * 'Add space': [ 'Dodaj spację', 'Dodaj %0 spacje', 'Dodaj %0 spacji' ]
64
+ * },
65
+ * // A function that returns the plural form index.
66
+ * getPluralForm: n => n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && ( n % 100 < 10 || n % 100 >= 20 ) ? 1 : 2 );
67
+ * }
68
+ * // Other languages.
69
+ * }
70
+ * ```
71
+ *
72
+ * If you cannot import this function from this module (e.g. because you use a CKEditor 5 build), you can
73
+ * still add translations by extending the global `window.CKEDITOR_TRANSLATIONS` object by using a function like
74
+ * the one below:
75
+ *
76
+ * ```ts
77
+ * function addTranslations( language, translations, getPluralForm ) {
78
+ * if ( !global.window.CKEDITOR_TRANSLATIONS ) {
79
+ * global.window.CKEDITOR_TRANSLATIONS = {};
80
+ * }
81
+
82
+ * if ( !global.window.CKEDITOR_TRANSLATIONS[ language ] ) {
83
+ * global.window.CKEDITOR_TRANSLATIONS[ language ] = {};
84
+ * }
85
+ *
86
+ * const languageTranslations = global.window.CKEDITOR_TRANSLATIONS[ language ];
87
+ *
88
+ * languageTranslations.dictionary = languageTranslations.dictionary || {};
89
+ * languageTranslations.getPluralForm = getPluralForm || languageTranslations.getPluralForm;
90
+ *
91
+ * // Extend the dictionary for the given language.
92
+ * Object.assign( languageTranslations.dictionary, translations );
93
+ * }
94
+ * ```
95
+ *
96
+ * @param language Target language.
97
+ * @param translations An object with translations which will be added to the dictionary.
98
+ * For each message ID the value should be either a translation or an array of translations if the message
99
+ * should support plural forms.
100
+ * @param getPluralForm A function that returns the plural form index (a number).
101
+ */
102
+ export declare function add(language: string, translations: {
103
+ readonly [messageId: string]: string | ReadonlyArray<string>;
104
+ }, getPluralForm?: (n: number) => number): void;
105
+ /**
106
+ * **Note:** This method is internal, use {@link module:utils/locale~Locale#t the `t()` function} instead to translate
107
+ * the editor UI parts.
108
+ *
109
+ * This function is responsible for translating messages to the specified language. It uses translations added perviously
110
+ * by {@link module:utils/translation-service~add} (a translations dictionary and the `getPluralForm()` function
111
+ * to provide accurate translations of plural forms).
112
+ *
113
+ * When no translation is defined in the dictionary or the dictionary does not exist, this function returns
114
+ * the original message string or the message plural depending on the number of elements.
115
+ *
116
+ * ```ts
117
+ * translate( 'pl', { string: 'Cancel' } ); // 'Cancel'
118
+ * ```
119
+ *
120
+ * The third optional argument is the number of elements, based on which the single form or one of the plural forms
121
+ * should be picked when the message is supposed to support various plural forms.
122
+ *
123
+ * ```ts
124
+ * translate( 'en', { string: 'Add a space', plural: 'Add %0 spaces' }, 1 ); // 'Add a space'
125
+ * translate( 'en', { string: 'Add a space', plural: 'Add %0 spaces' }, 3 ); // 'Add %0 spaces'
126
+ * ```
127
+ *
128
+ * The message should provide an ID using the `id` property when the message strings are not unique and their
129
+ * translations should be different.
130
+ *
131
+ * ```ts
132
+ * translate( 'en', { string: 'image', id: 'ADD_IMAGE' } );
133
+ * translate( 'en', { string: 'image', id: 'AN_IMAGE' } );
134
+ * ```
135
+ *
136
+ * @internal
137
+ * @param language Target language.
138
+ * @param message A message that will be translated.
139
+ * @param quantity The number of elements for which a plural form should be picked from the target language dictionary.
140
+ * @param translations Translations passed in editor config, if not provided use the global `window.CKEDITOR_TRANSLATIONS`.
141
+ * @returns Translated sentence.
142
+ */
143
+ export declare function _translate(language: string, message: Message, quantity?: number, translations?: Translations): string;
144
+ /**
145
+ * Clears dictionaries for test purposes.
146
+ *
147
+ * @internal
148
+ */
149
+ export declare function _clear(): void;
150
+ /**
151
+ * If array then merge objects which are inside otherwise return given object.
152
+ *
153
+ * @internal
154
+ * @param translations Translations passed in editor config.
155
+ */
156
+ export declare function _unifyTranslations(translations?: ArrayOrItem<Translations>): Translations | undefined;
157
+ /**
158
+ * The internationalization message interface. A message that implements this interface can be passed to the `t()` function
159
+ * to be translated to the target UI language.
160
+ */
161
+ export interface Message {
162
+ /**
163
+ * The message string to translate. Acts as a default translation if the translation for a given language
164
+ * is not defined. When the message is supposed to support plural forms, the string should be the English singular form of the message.
165
+ */
166
+ readonly string: string;
167
+ /**
168
+ * The message ID. If passed, the message ID is taken from this property instead of the `message.string`.
169
+ * This property is useful when various messages share the same message string, for example, the `editor` string in `in the editor`
170
+ * and `my editor` sentences.
171
+ */
172
+ readonly id?: string;
173
+ /**
174
+ * The plural form of the message. This property should be skipped when a message is not supposed
175
+ * to support plural forms. Otherwise it should always be set to a string with the English plural form of the message.
176
+ */
177
+ readonly plural?: string;
178
+ }
@@ -0,0 +1,19 @@
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
+ * Returns a unique id. The id starts with an "e" character and a randomly generated string of
11
+ * 32 alphanumeric characters.
12
+ *
13
+ * **Note**: The characters the unique id is built from correspond to the hex number notation
14
+ * (from "0" to "9", from "a" to "f"). In other words, each id corresponds to an "e" followed
15
+ * by 16 8-bit numbers next to each other.
16
+ *
17
+ * @returns An unique id string.
18
+ */
19
+ export default function uid(): string;
@@ -0,0 +1,58 @@
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
+ * Set of utils to handle unicode characters.
11
+ *
12
+ * @module utils/unicode
13
+ */
14
+ /**
15
+ * Checks whether given `character` is a combining mark.
16
+ *
17
+ * @param character Character to check.
18
+ */
19
+ export declare function isCombiningMark(character: string): boolean;
20
+ /**
21
+ * Checks whether given `character` is a high half of surrogate pair.
22
+ *
23
+ * Using UTF-16 terminology, a surrogate pair denotes UTF-16 character using two UTF-8 characters. The surrogate pair
24
+ * consist of high surrogate pair character followed by low surrogate pair character.
25
+ *
26
+ * @param character Character to check.
27
+ */
28
+ export declare function isHighSurrogateHalf(character: string): boolean;
29
+ /**
30
+ * Checks whether given `character` is a low half of surrogate pair.
31
+ *
32
+ * Using UTF-16 terminology, a surrogate pair denotes UTF-16 character using two UTF-8 characters. The surrogate pair
33
+ * consist of high surrogate pair character followed by low surrogate pair character.
34
+ *
35
+ * @param character Character to check.
36
+ */
37
+ export declare function isLowSurrogateHalf(character: string): boolean;
38
+ /**
39
+ * Checks whether given offset in a string is inside a surrogate pair (between two surrogate halves).
40
+ *
41
+ * @param string String to check.
42
+ * @param offset Offset to check.
43
+ */
44
+ export declare function isInsideSurrogatePair(string: string, offset: number): boolean;
45
+ /**
46
+ * Checks whether given offset in a string is between base character and combining mark or between two combining marks.
47
+ *
48
+ * @param string String to check.
49
+ * @param offset Offset to check.
50
+ */
51
+ export declare function isInsideCombinedSymbol(string: string, offset: number): boolean;
52
+ /**
53
+ * Checks whether given offset in a string is inside multi-character emoji sequence.
54
+ *
55
+ * @param string String to check.
56
+ * @param offset Offset to check.
57
+ */
58
+ export declare function isInsideEmojiSequence(string: string, offset: number): boolean;
@@ -0,0 +1,19 @@
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
+ * Possible states of the key after verification.
11
+ */
12
+ export type VerifiedKeyStatus = 'VALID' | 'INVALID';
13
+ /**
14
+ * Checks whether the given string contains information that allows you to verify the license status.
15
+ *
16
+ * @param token The string to check.
17
+ * @returns String that represents the state of given `token` parameter.
18
+ */
19
+ export default function verifyLicense(token: string | undefined): VerifiedKeyStatus;
@@ -0,0 +1,14 @@
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 version = "41.4.0";
10
+ export default version;
11
+ export declare const releaseDate: Date;
12
+ declare global {
13
+ var CKEDITOR_VERSION: string;
14
+ }
@@ -0,0 +1,20 @@
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/wait
11
+ */
12
+ /**
13
+ * Returns a promise that is resolved after the specified time.
14
+ *
15
+ * @param timeout The time in milliseconds to wait.
16
+ * @param options.signal A signal to abort the waiting.
17
+ */
18
+ export default function wait(timeout: number, options?: {
19
+ signal?: AbortSignal;
20
+ }): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-utils",
3
- "version": "41.3.1",
3
+ "version": "41.4.0",
4
4
  "description": "Miscellaneous utilities used by CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -24,6 +24,7 @@
24
24
  "directory": "packages/ckeditor5-utils"
25
25
  },
26
26
  "files": [
27
+ "dist",
27
28
  "lang",
28
29
  "src/**/*.js",
29
30
  "src/**/*.d.ts",
package/src/env.d.ts CHANGED
@@ -42,6 +42,14 @@ export interface EnvType {
42
42
  * Indicates that the application is running in a browser using the Blink engine.
43
43
  */
44
44
  readonly isBlink: boolean;
45
+ /**
46
+ * Indicates that the the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
47
+ */
48
+ readonly isMediaForcedColors: boolean;
49
+ /**
50
+ * Indicates that "prefer reduced motion" browser setting is active.
51
+ */
52
+ readonly isMotionReduced: boolean;
45
53
  /**
46
54
  * Environment features information.
47
55
  */
@@ -115,3 +123,11 @@ export declare function isBlink(userAgent: string): boolean;
115
123
  * [in Unicode Standard Annex #44](https://www.unicode.org/reports/tr44/#GC_Values_Table).
116
124
  */
117
125
  export declare function isRegExpUnicodePropertySupported(): boolean;
126
+ /**
127
+ * Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
128
+ */
129
+ export declare function isMediaForcedColors(): boolean;
130
+ /**
131
+ * Checks if user enabled "prefers reduced motion" setting in browser.
132
+ */
133
+ export declare function isMotionReduced(): boolean;
package/src/env.js CHANGED
@@ -31,6 +31,10 @@ const env = {
31
31
  isiOS: isiOS(userAgent),
32
32
  isAndroid: isAndroid(userAgent),
33
33
  isBlink: isBlink(userAgent),
34
+ isMediaForcedColors: isMediaForcedColors(),
35
+ get isMotionReduced() {
36
+ return isMotionReduced();
37
+ },
34
38
  features: {
35
39
  isRegExpUnicodePropertySupported: isRegExpUnicodePropertySupported()
36
40
  }
@@ -120,3 +124,15 @@ export function isRegExpUnicodePropertySupported() {
120
124
  }
121
125
  return isSupported;
122
126
  }
127
+ /**
128
+ * Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
129
+ */
130
+ export function isMediaForcedColors() {
131
+ return window.matchMedia('(forced-colors: active)').matches;
132
+ }
133
+ /**
134
+ * Checks if user enabled "prefers reduced motion" setting in browser.
135
+ */
136
+ export function isMotionReduced() {
137
+ return window.matchMedia('(prefers-reduced-motion)').matches;
138
+ }
package/src/locale.d.ts CHANGED
@@ -136,6 +136,6 @@ export type Translations = {
136
136
  dictionary: {
137
137
  [messageId: string]: string | ReadonlyArray<string>;
138
138
  };
139
- getPluralForm?: (n: number) => number;
139
+ getPluralForm?: ((n: number) => number | boolean) | null;
140
140
  };
141
141
  };
package/src/version.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- declare const version = "41.3.1";
5
+ declare const version = "41.4.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 = '41.3.1';
9
+ const version = '41.4.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(2024, 3, 16);
12
+ export const releaseDate = new Date(2024, 4, 15);
13
13
  /* istanbul ignore next -- @preserve */
14
14
  if (globalThis.CKEDITOR_VERSION) {
15
15
  /**