@ckeditor/ckeditor5-utils 41.4.0 → 41.4.2

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.
@@ -6,9 +6,6 @@
6
6
  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
7
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
8
  */
9
- /**
10
- * @module utils/env
11
- */
12
9
  /**
13
10
  * Safely returns `userAgent` from browser's navigator API in a lower case.
14
11
  * If navigator API is not available it will return an empty string.
@@ -35,7 +32,7 @@ export interface EnvType {
35
32
  */
36
33
  readonly isSafari: boolean;
37
34
  /**
38
- * Indicates the the application is running in iOS.
35
+ * Indicates that the application is running in iOS.
39
36
  */
40
37
  readonly isiOS: boolean;
41
38
  /**
@@ -47,11 +44,17 @@ export interface EnvType {
47
44
  */
48
45
  readonly isBlink: boolean;
49
46
  /**
50
- * Indicates that the the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
47
+ * Indicates that the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
48
+ *
49
+ * Note that the value of this property is evaluated each time it is accessed, and it may change over time, if the environment
50
+ * settings have changed.
51
51
  */
52
52
  readonly isMediaForcedColors: boolean;
53
53
  /**
54
54
  * Indicates that "prefer reduced motion" browser setting is active.
55
+ *
56
+ * Note that the value of this property is evaluated each time it is accessed, and it may change over time, if the environment
57
+ * settings have changed.
55
58
  */
56
59
  readonly isMotionReduced: boolean;
57
60
  /**
@@ -129,9 +132,13 @@ export declare function isBlink(userAgent: string): boolean;
129
132
  export declare function isRegExpUnicodePropertySupported(): boolean;
130
133
  /**
131
134
  * Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
135
+ *
136
+ * Returns `false` in environments where `window` global object is not available.
132
137
  */
133
138
  export declare function isMediaForcedColors(): boolean;
134
139
  /**
135
- * Checks if user enabled "prefers reduced motion" setting in browser.
140
+ * Checks if the user enabled "prefers reduced motion" setting in browser.
141
+ *
142
+ * Returns `false` in environments where `window` global object is not available.
136
143
  */
137
144
  export declare function isMotionReduced(): boolean;
@@ -6,7 +6,7 @@
6
6
  * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
7
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
8
  */
9
- declare const version = "41.4.0";
9
+ declare const version = "41.4.2";
10
10
  export default version;
11
11
  export declare const releaseDate: Date;
12
12
  declare global {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-utils",
3
- "version": "41.4.0",
3
+ "version": "41.4.2",
4
4
  "description": "Miscellaneous utilities used by CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
package/src/env.d.ts CHANGED
@@ -2,9 +2,6 @@
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
- /**
6
- * @module utils/env
7
- */
8
5
  /**
9
6
  * Safely returns `userAgent` from browser's navigator API in a lower case.
10
7
  * If navigator API is not available it will return an empty string.
@@ -31,7 +28,7 @@ export interface EnvType {
31
28
  */
32
29
  readonly isSafari: boolean;
33
30
  /**
34
- * Indicates the the application is running in iOS.
31
+ * Indicates that the application is running in iOS.
35
32
  */
36
33
  readonly isiOS: boolean;
37
34
  /**
@@ -43,11 +40,17 @@ export interface EnvType {
43
40
  */
44
41
  readonly isBlink: boolean;
45
42
  /**
46
- * Indicates that the the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
43
+ * Indicates that the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
44
+ *
45
+ * Note that the value of this property is evaluated each time it is accessed, and it may change over time, if the environment
46
+ * settings have changed.
47
47
  */
48
48
  readonly isMediaForcedColors: boolean;
49
49
  /**
50
50
  * Indicates that "prefer reduced motion" browser setting is active.
51
+ *
52
+ * Note that the value of this property is evaluated each time it is accessed, and it may change over time, if the environment
53
+ * settings have changed.
51
54
  */
52
55
  readonly isMotionReduced: boolean;
53
56
  /**
@@ -125,9 +128,13 @@ export declare function isBlink(userAgent: string): boolean;
125
128
  export declare function isRegExpUnicodePropertySupported(): boolean;
126
129
  /**
127
130
  * Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
131
+ *
132
+ * Returns `false` in environments where `window` global object is not available.
128
133
  */
129
134
  export declare function isMediaForcedColors(): boolean;
130
135
  /**
131
- * Checks if user enabled "prefers reduced motion" setting in browser.
136
+ * Checks if the user enabled "prefers reduced motion" setting in browser.
137
+ *
138
+ * Returns `false` in environments where `window` global object is not available.
132
139
  */
133
140
  export declare function isMotionReduced(): boolean;
package/src/env.js CHANGED
@@ -6,6 +6,7 @@
6
6
  /**
7
7
  * @module utils/env
8
8
  */
9
+ import global from './dom/global.js';
9
10
  /**
10
11
  * Safely returns `userAgent` from browser's navigator API in a lower case.
11
12
  * If navigator API is not available it will return an empty string.
@@ -31,7 +32,9 @@ const env = {
31
32
  isiOS: isiOS(userAgent),
32
33
  isAndroid: isAndroid(userAgent),
33
34
  isBlink: isBlink(userAgent),
34
- isMediaForcedColors: isMediaForcedColors(),
35
+ get isMediaForcedColors() {
36
+ return isMediaForcedColors();
37
+ },
35
38
  get isMotionReduced() {
36
39
  return isMotionReduced();
37
40
  },
@@ -126,13 +129,17 @@ export function isRegExpUnicodePropertySupported() {
126
129
  }
127
130
  /**
128
131
  * Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).
132
+ *
133
+ * Returns `false` in environments where `window` global object is not available.
129
134
  */
130
135
  export function isMediaForcedColors() {
131
- return window.matchMedia('(forced-colors: active)').matches;
136
+ return global.window.matchMedia ? global.window.matchMedia('(forced-colors: active)').matches : false;
132
137
  }
133
138
  /**
134
- * Checks if user enabled "prefers reduced motion" setting in browser.
139
+ * Checks if the user enabled "prefers reduced motion" setting in browser.
140
+ *
141
+ * Returns `false` in environments where `window` global object is not available.
135
142
  */
136
143
  export function isMotionReduced() {
137
- return window.matchMedia('(prefers-reduced-motion)').matches;
144
+ return global.window.matchMedia ? global.window.matchMedia('(prefers-reduced-motion)').matches : false;
138
145
  }
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.4.0";
5
+ declare const version = "41.4.2";
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.4.0';
9
+ const version = '41.4.2';
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, 4, 15);
12
+ export const releaseDate = new Date(2024, 4, 17);
13
13
  /* istanbul ignore next -- @preserve */
14
14
  if (globalThis.CKEDITOR_VERSION) {
15
15
  /**