@ckeditor/ckeditor5-ui 36.0.1 → 37.0.0-alpha.1

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 (114) hide show
  1. package/package.json +24 -23
  2. package/src/augmentation.d.ts +86 -0
  3. package/src/augmentation.js +5 -0
  4. package/src/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
  5. package/src/bindings/addkeyboardhandlingforgrid.js +42 -34
  6. package/src/bindings/clickoutsidehandler.d.ts +28 -0
  7. package/src/bindings/clickoutsidehandler.js +5 -6
  8. package/src/bindings/csstransitiondisablermixin.d.ts +40 -0
  9. package/src/bindings/csstransitiondisablermixin.js +55 -0
  10. package/src/bindings/injectcsstransitiondisabler.d.ts +59 -0
  11. package/src/bindings/injectcsstransitiondisabler.js +23 -20
  12. package/src/bindings/preventdefault.d.ts +33 -0
  13. package/src/bindings/preventdefault.js +13 -15
  14. package/src/bindings/submithandler.d.ts +57 -0
  15. package/src/bindings/submithandler.js +23 -24
  16. package/src/button/button.d.ts +154 -0
  17. package/src/button/buttonview.d.ts +155 -0
  18. package/src/button/buttonview.js +16 -60
  19. package/src/button/switchbuttonview.d.ts +45 -0
  20. package/src/button/switchbuttonview.js +9 -18
  21. package/src/colorgrid/colorgridview.d.ts +132 -0
  22. package/src/colorgrid/colorgridview.js +13 -44
  23. package/src/colorgrid/colortileview.d.ts +28 -0
  24. package/src/colorgrid/colortileview.js +2 -15
  25. package/src/colorgrid/utils.d.ts +47 -0
  26. package/src/colorgrid/utils.js +7 -13
  27. package/src/componentfactory.d.ts +81 -0
  28. package/src/componentfactory.js +22 -36
  29. package/src/dropdown/button/dropdownbutton.d.ts +25 -0
  30. package/src/dropdown/button/dropdownbuttonview.d.ts +48 -0
  31. package/src/dropdown/button/dropdownbuttonview.js +11 -21
  32. package/src/dropdown/button/splitbuttonview.d.ts +145 -0
  33. package/src/dropdown/button/splitbuttonview.js +11 -52
  34. package/src/dropdown/dropdownpanelfocusable.d.ts +21 -0
  35. package/src/dropdown/dropdownpanelview.d.ts +62 -0
  36. package/src/dropdown/dropdownpanelview.js +2 -30
  37. package/src/dropdown/dropdownview.d.ts +315 -0
  38. package/src/dropdown/dropdownview.js +121 -222
  39. package/src/dropdown/utils.d.ts +219 -0
  40. package/src/dropdown/utils.js +112 -106
  41. package/src/editableui/editableuiview.d.ts +72 -0
  42. package/src/editableui/editableuiview.js +16 -44
  43. package/src/editableui/inline/inlineeditableuiview.d.ts +40 -0
  44. package/src/editableui/inline/inlineeditableuiview.js +5 -15
  45. package/src/editorui/bodycollection.d.ts +51 -0
  46. package/src/editorui/bodycollection.js +2 -16
  47. package/src/editorui/boxed/boxededitoruiview.d.ts +40 -0
  48. package/src/editorui/boxed/boxededitoruiview.js +1 -27
  49. package/src/editorui/editorui.d.ts +263 -0
  50. package/src/editorui/editorui.js +27 -134
  51. package/src/editorui/editoruiview.d.ts +39 -0
  52. package/src/editorui/editoruiview.js +1 -10
  53. package/src/focuscycler.d.ts +183 -0
  54. package/src/focuscycler.js +34 -90
  55. package/src/formheader/formheaderview.d.ts +53 -0
  56. package/src/formheader/formheaderview.js +3 -24
  57. package/src/icon/iconview.d.ts +78 -0
  58. package/src/icon/iconview.js +0 -50
  59. package/src/iframe/iframeview.d.ts +50 -0
  60. package/src/iframe/iframeview.js +2 -2
  61. package/src/index.d.ts +55 -0
  62. package/src/index.js +2 -0
  63. package/src/input/inputview.d.ts +121 -0
  64. package/src/input/inputview.js +0 -82
  65. package/src/inputnumber/inputnumberview.d.ts +49 -0
  66. package/src/inputnumber/inputnumberview.js +5 -28
  67. package/src/inputtext/inputtextview.d.ts +18 -0
  68. package/src/inputtext/inputtextview.js +0 -2
  69. package/src/label/labelview.d.ts +36 -0
  70. package/src/label/labelview.js +0 -20
  71. package/src/labeledfield/labeledfieldview.d.ts +182 -0
  72. package/src/labeledfield/labeledfieldview.js +20 -126
  73. package/src/labeledfield/utils.d.ts +93 -0
  74. package/src/labeledfield/utils.js +24 -18
  75. package/src/labeledinput/labeledinputview.d.ts +125 -0
  76. package/src/labeledinput/labeledinputview.js +7 -90
  77. package/src/list/listitemview.d.ts +35 -0
  78. package/src/list/listitemview.js +0 -16
  79. package/src/list/listseparatorview.d.ts +18 -0
  80. package/src/list/listseparatorview.js +0 -2
  81. package/src/list/listview.d.ts +59 -0
  82. package/src/list/listview.js +0 -33
  83. package/src/model.d.ts +22 -0
  84. package/src/model.js +2 -4
  85. package/src/notification/notification.d.ts +211 -0
  86. package/src/notification/notification.js +64 -51
  87. package/src/panel/balloon/balloonpanelview.d.ts +685 -0
  88. package/src/panel/balloon/balloonpanelview.js +146 -168
  89. package/src/panel/balloon/contextualballoon.d.ts +299 -0
  90. package/src/panel/balloon/contextualballoon.js +42 -172
  91. package/src/panel/sticky/stickypanelview.d.ts +132 -0
  92. package/src/panel/sticky/stickypanelview.js +0 -115
  93. package/src/template.d.ts +942 -0
  94. package/src/template.js +397 -461
  95. package/src/toolbar/balloon/balloontoolbar.d.ts +118 -0
  96. package/src/toolbar/balloon/balloontoolbar.js +14 -81
  97. package/src/toolbar/block/blockbuttonview.d.ts +35 -0
  98. package/src/toolbar/block/blockbuttonview.js +1 -13
  99. package/src/toolbar/block/blocktoolbar.d.ts +153 -0
  100. package/src/toolbar/block/blocktoolbar.js +31 -69
  101. package/src/toolbar/normalizetoolbarconfig.d.ts +39 -0
  102. package/src/toolbar/normalizetoolbarconfig.js +12 -8
  103. package/src/toolbar/toolbarlinebreakview.d.ts +18 -0
  104. package/src/toolbar/toolbarlinebreakview.js +0 -2
  105. package/src/toolbar/toolbarseparatorview.d.ts +18 -0
  106. package/src/toolbar/toolbarseparatorview.js +0 -2
  107. package/src/toolbar/toolbarview.d.ts +265 -0
  108. package/src/toolbar/toolbarview.js +54 -305
  109. package/src/tooltipmanager.d.ts +180 -0
  110. package/src/tooltipmanager.js +48 -95
  111. package/src/view.d.ts +422 -0
  112. package/src/view.js +182 -251
  113. package/src/viewcollection.d.ts +139 -0
  114. package/src/viewcollection.js +62 -56
@@ -8,8 +8,6 @@
8
8
  import View from '../view';
9
9
  /**
10
10
  * The list item view class.
11
- *
12
- * @extends module:ui/view~View
13
11
  */
14
12
  export default class ListItemView extends View {
15
13
  /**
@@ -18,21 +16,7 @@ export default class ListItemView extends View {
18
16
  constructor(locale) {
19
17
  super(locale);
20
18
  const bind = this.bindTemplate;
21
- /**
22
- * Controls whether the item view is visible. Visible by default, list items are hidden
23
- * using a CSS class.
24
- *
25
- * @observable
26
- * @default true
27
- * @member {Boolean} #isVisible
28
- */
29
19
  this.set('isVisible', true);
30
- /**
31
- * Collection of the child views inside of the list item {@link #element}.
32
- *
33
- * @readonly
34
- * @member {module:ui/viewcollection~ViewCollection}
35
- */
36
20
  this.children = this.createCollection();
37
21
  this.setTemplate({
38
22
  tag: 'li',
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ui/list/listseparatorview
7
+ */
8
+ import View from '../view';
9
+ import type { Locale } from '@ckeditor/ckeditor5-utils';
10
+ /**
11
+ * The list separator view class.
12
+ */
13
+ export default class ListSeparatorView extends View {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ constructor(locale?: Locale);
18
+ }
@@ -8,8 +8,6 @@
8
8
  import View from '../view';
9
9
  /**
10
10
  * The list separator view class.
11
- *
12
- * @extends module:ui/view~View
13
11
  */
14
12
  export default class ListSeparatorView extends View {
15
13
  /**
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ui/list/listview
7
+ */
8
+ import View from '../view';
9
+ import type DropdownPanelFocusable from '../dropdown/dropdownpanelfocusable';
10
+ import type ViewCollection from '../viewcollection';
11
+ import { FocusTracker, KeystrokeHandler, type Locale } from '@ckeditor/ckeditor5-utils';
12
+ import '../../theme/components/list/list.css';
13
+ /**
14
+ * The list view class.
15
+ */
16
+ export default class ListView extends View<HTMLUListElement> implements DropdownPanelFocusable {
17
+ /**
18
+ * Collection of the child list views.
19
+ */
20
+ readonly items: ViewCollection;
21
+ /**
22
+ * Tracks information about DOM focus in the list.
23
+ */
24
+ readonly focusTracker: FocusTracker;
25
+ /**
26
+ * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
27
+ */
28
+ readonly keystrokes: KeystrokeHandler;
29
+ /**
30
+ * Label used by assistive technologies to describe this list element.
31
+ *
32
+ * @observable
33
+ */
34
+ ariaLabel: string | undefined;
35
+ /**
36
+ * Helps cycling over focusable {@link #items} in the list.
37
+ */
38
+ private readonly _focusCycler;
39
+ /**
40
+ * @inheritDoc
41
+ */
42
+ constructor(locale?: Locale);
43
+ /**
44
+ * @inheritDoc
45
+ */
46
+ render(): void;
47
+ /**
48
+ * @inheritDoc
49
+ */
50
+ destroy(): void;
51
+ /**
52
+ * Focuses the first focusable in {@link #items}.
53
+ */
54
+ focus(): void;
55
+ /**
56
+ * Focuses the last focusable in {@link #items}.
57
+ */
58
+ focusLast(): void;
59
+ }
@@ -11,9 +11,6 @@ import { FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils';
11
11
  import '../../theme/components/list/list.css';
12
12
  /**
13
13
  * The list view class.
14
- *
15
- * @extends module:ui/view~View
16
- * @implements module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable
17
14
  */
18
15
  export default class ListView extends View {
19
16
  /**
@@ -22,34 +19,9 @@ export default class ListView extends View {
22
19
  constructor(locale) {
23
20
  super(locale);
24
21
  const bind = this.bindTemplate;
25
- /**
26
- * Collection of the child list views.
27
- *
28
- * @readonly
29
- * @member {module:ui/viewcollection~ViewCollection}
30
- */
31
22
  this.items = this.createCollection();
32
- /**
33
- * Tracks information about DOM focus in the list.
34
- *
35
- * @readonly
36
- * @member {module:utils/focustracker~FocusTracker}
37
- */
38
23
  this.focusTracker = new FocusTracker();
39
- /**
40
- * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
41
- *
42
- * @readonly
43
- * @member {module:utils/keystrokehandler~KeystrokeHandler}
44
- */
45
24
  this.keystrokes = new KeystrokeHandler();
46
- /**
47
- * Helps cycling over focusable {@link #items} in the list.
48
- *
49
- * @readonly
50
- * @protected
51
- * @member {module:ui/focuscycler~FocusCycler}
52
- */
53
25
  this._focusCycler = new FocusCycler({
54
26
  focusables: this.items,
55
27
  focusTracker: this.focusTracker,
@@ -61,11 +33,6 @@ export default class ListView extends View {
61
33
  focusNext: 'arrowdown'
62
34
  }
63
35
  });
64
- /**
65
- * Label used by assistive technologies to describe this list element.
66
- *
67
- * @member {String} #ariaLabel
68
- */
69
36
  this.set('ariaLabel', undefined);
70
37
  this.setTemplate({
71
38
  tag: 'ul',
package/src/model.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ declare const Model_base: {
6
+ new (): import("@ckeditor/ckeditor5-utils").Observable;
7
+ prototype: import("@ckeditor/ckeditor5-utils").Observable;
8
+ };
9
+ /**
10
+ * The base MVC model class.
11
+ */
12
+ export default class Model extends Model_base {
13
+ [x: string]: unknown;
14
+ /**
15
+ * Creates a new Model instance.
16
+ *
17
+ * @param attributes The model state attributes to be defined during the instance creation.
18
+ * @param properties The (out of state) properties to be appended to the instance during creation.
19
+ */
20
+ constructor(attributes?: Record<string, unknown>, properties?: Record<string, unknown>);
21
+ }
22
+ export {};
package/src/model.js CHANGED
@@ -9,15 +9,13 @@ import { ObservableMixin } from '@ckeditor/ckeditor5-utils';
9
9
  import { extend } from 'lodash-es';
10
10
  /**
11
11
  * The base MVC model class.
12
- *
13
- * @mixes module:utils/observablemixin~ObservableMixin
14
12
  */
15
13
  export default class Model extends ObservableMixin() {
16
14
  /**
17
15
  * Creates a new Model instance.
18
16
  *
19
- * @param {Object} [attributes] The model state attributes to be defined during the instance creation.
20
- * @param {Object} [properties] The (out of state) properties to be appended to the instance during creation.
17
+ * @param attributes The model state attributes to be defined during the instance creation.
18
+ * @param properties The (out of state) properties to be appended to the instance during creation.
21
19
  */
22
20
  constructor(attributes, properties) {
23
21
  super();
@@ -0,0 +1,211 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module ui/notification/notification
7
+ */
8
+ import { ContextPlugin } from '@ckeditor/ckeditor5-core';
9
+ /**
10
+ * The Notification plugin.
11
+ *
12
+ * This plugin sends a few types of notifications: `success`, `info` and `warning`. The notifications need to be
13
+ * handled and displayed by a plugin responsible for showing the UI of the notifications. Using this plugin for dispatching
14
+ * notifications makes it possible to switch the notifications UI.
15
+ *
16
+ * Note that every unhandled and not stopped `warning` notification will be displayed as a system alert.
17
+ * See {@link module:ui/notification/notification~Notification#showWarning}.
18
+ */
19
+ export default class Notification extends ContextPlugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName(): 'Notification';
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ init(): void;
28
+ /**
29
+ * Shows a success notification.
30
+ *
31
+ * By default, it fires the {@link #event:show:success `show:success` event} with the given `data`. The event namespace can be extended
32
+ * using the `data.namespace` option. For example:
33
+ *
34
+ * ```ts
35
+ * showSuccess( 'Image is uploaded.', {
36
+ * namespace: 'upload:image'
37
+ * } );
38
+ * ```
39
+ *
40
+ * will fire the `show:success:upload:image` event.
41
+ *
42
+ * You can provide the title of the notification:
43
+ *
44
+ * ```ts
45
+ * showSuccess( 'Image is uploaded.', {
46
+ * title: 'Image upload success'
47
+ * } );
48
+ * ```
49
+ *
50
+ * @param message The content of the notification.
51
+ * @param data Additional data.
52
+ * @param data.namespace Additional event namespace.
53
+ * @param data.title The title of the notification.
54
+ */
55
+ showSuccess(message: string, data?: {
56
+ namespace?: string;
57
+ title?: string;
58
+ }): void;
59
+ /**
60
+ * Shows an information notification.
61
+ *
62
+ * By default, it fires the {@link #event:show:info `show:info` event} with the given `data`. The event namespace can be extended
63
+ * using the `data.namespace` option. For example:
64
+ *
65
+ * ```ts
66
+ * showInfo( 'Editor is offline.', {
67
+ * namespace: 'editor:status'
68
+ * } );
69
+ * ```
70
+ *
71
+ * will fire the `show:info:editor:status` event.
72
+ *
73
+ * You can provide the title of the notification:
74
+ *
75
+ * ```ts
76
+ * showInfo( 'Editor is offline.', {
77
+ * title: 'Network information'
78
+ * } );
79
+ * ```
80
+ *
81
+ * @param message The content of the notification.
82
+ * @param data Additional data.
83
+ * @param data.namespace Additional event namespace.
84
+ * @param data.title The title of the notification.
85
+ */
86
+ showInfo(message: string, data?: {
87
+ namespace?: string;
88
+ title?: string;
89
+ }): void;
90
+ /**
91
+ * Shows a warning notification.
92
+ *
93
+ * By default, it fires the {@link #event:show:warning `show:warning` event}
94
+ * with the given `data`. The event namespace can be extended using the `data.namespace` option. For example:
95
+ *
96
+ * ```ts
97
+ * showWarning( 'Image upload error.', {
98
+ * namespace: 'upload:image'
99
+ * } );
100
+ * ```
101
+ *
102
+ * will fire the `show:warning:upload:image` event.
103
+ *
104
+ * You can provide the title of the notification:
105
+ *
106
+ * ```ts
107
+ * showWarning( 'Image upload error.', {
108
+ * title: 'Upload failed'
109
+ * } );
110
+ * ```
111
+ *
112
+ * Note that each unhandled and not stopped `warning` notification will be displayed as a system alert.
113
+ * The plugin responsible for displaying warnings should `stop()` the event to prevent displaying it as an alert:
114
+ *
115
+ * ```ts
116
+ * notifications.on( 'show:warning', ( evt, data ) => {
117
+ * // Do something with the data.
118
+ *
119
+ * // Stop this event to prevent displaying it as an alert.
120
+ * evt.stop();
121
+ * } );
122
+ * ```
123
+ *
124
+ * You can attach many listeners to the same event and `stop()` this event in a listener with a low priority:
125
+ *
126
+ * ```ts
127
+ * notifications.on( 'show:warning', ( evt, data ) => {
128
+ * // Show the warning in the UI, but do not stop it.
129
+ * } );
130
+ *
131
+ * notifications.on( 'show:warning', ( evt, data ) => {
132
+ * // Log the warning to some error tracker.
133
+ *
134
+ * // Stop this event to prevent displaying it as an alert.
135
+ * evt.stop();
136
+ * }, { priority: 'low' } );
137
+ * ```
138
+ *
139
+ * @param message The content of the notification.
140
+ * @param data Additional data.
141
+ * @param data.namespace Additional event namespace.
142
+ * @param data.title The title of the notification.
143
+ */
144
+ showWarning(message: string, data?: {
145
+ namespace?: string;
146
+ title?: string;
147
+ }): void;
148
+ /**
149
+ * Fires the `show` event with the specified type, namespace and message.
150
+ *
151
+ * @param data The message data.
152
+ * @param data.message The content of the notification.
153
+ * @param data.type The type of the message.
154
+ * @param data.namespace Additional event namespace.
155
+ * @param data.title The title of the notification.
156
+ */
157
+ private _showNotification;
158
+ }
159
+ export type NotificationEventType = 'success' | 'info' | 'warning';
160
+ /**
161
+ * Fired when one of the `showSuccess()`, `showInfo()`, `showWarning()` methods is called.
162
+ *
163
+ * @eventName ~Notification#show
164
+ * @param data The notification data.
165
+ */
166
+ export type NotificationShowEvent = {
167
+ name: 'show';
168
+ args: [data: NotificationShowEventData];
169
+ };
170
+ /**
171
+ * Fired when the `showSuccess()` method is called.
172
+ *
173
+ * @eventName ~Notification#show:success
174
+ * @param data The notification data.
175
+ */
176
+ export type NotificationShowSuccessEvent = NotificationShowTypeEvent<'success'>;
177
+ /**
178
+ * Fired when the `showInfo()` method is called.
179
+ *
180
+ * @eventName ~Notification#show:info
181
+ * @param data The notification data.
182
+ */
183
+ export type NotificationShowInfoEvent = NotificationShowTypeEvent<'info'>;
184
+ /**
185
+ * Fired when the `showWarning()` method is called.
186
+ *
187
+ * When this event is not handled or stopped by `event.stop()`, the `data.message` of this event will
188
+ * be automatically displayed as a system alert.
189
+ *
190
+ * @eventName ~Notification#show:warning
191
+ * @param data The notification data.
192
+ */
193
+ export type NotificationShowWarningEvent = NotificationShowTypeEvent<'warning'>;
194
+ export type NotificationShowTypeEvent<NotificationType extends NotificationEventType> = {
195
+ name: `show:${NotificationType}` | `show:${NotificationType}:${string}`;
196
+ args: [data: NotificationShowEventData<NotificationType>];
197
+ };
198
+ export type NotificationShowEventData<NotificationType extends NotificationEventType = NotificationEventType> = {
199
+ /**
200
+ * The content of the notification.
201
+ */
202
+ message: string;
203
+ /**
204
+ * The title of the notification.
205
+ */
206
+ title: string;
207
+ /**
208
+ * The type of the notification.
209
+ */
210
+ type: NotificationType;
211
+ };
@@ -16,8 +16,6 @@ import { ContextPlugin } from '@ckeditor/ckeditor5-core';
16
16
  *
17
17
  * Note that every unhandled and not stopped `warning` notification will be displayed as a system alert.
18
18
  * See {@link module:ui/notification/notification~Notification#showWarning}.
19
- *
20
- * @extends module:core/contextplugin~ContextPlugin
21
19
  */
22
20
  export default class Notification extends ContextPlugin {
23
21
  /**
@@ -41,22 +39,26 @@ export default class Notification extends ContextPlugin {
41
39
  * By default, it fires the {@link #event:show:success `show:success` event} with the given `data`. The event namespace can be extended
42
40
  * using the `data.namespace` option. For example:
43
41
  *
44
- * showSuccess( 'Image is uploaded.', {
45
- * namespace: 'upload:image'
46
- * } );
42
+ * ```ts
43
+ * showSuccess( 'Image is uploaded.', {
44
+ * namespace: 'upload:image'
45
+ * } );
46
+ * ```
47
47
  *
48
48
  * will fire the `show:success:upload:image` event.
49
49
  *
50
50
  * You can provide the title of the notification:
51
51
  *
52
- * showSuccess( 'Image is uploaded.', {
53
- * title: 'Image upload success'
54
- * } );
52
+ * ```ts
53
+ * showSuccess( 'Image is uploaded.', {
54
+ * title: 'Image upload success'
55
+ * } );
56
+ * ```
55
57
  *
56
- * @param {String} message The content of the notification.
57
- * @param {Object} [data={}] Additional data.
58
- * @param {String} [data.namespace] Additional event namespace.
59
- * @param {String} [data.title] The title of the notification.
58
+ * @param message The content of the notification.
59
+ * @param data Additional data.
60
+ * @param data.namespace Additional event namespace.
61
+ * @param data.title The title of the notification.
60
62
  */
61
63
  showSuccess(message, data = {}) {
62
64
  this._showNotification({
@@ -72,22 +74,26 @@ export default class Notification extends ContextPlugin {
72
74
  * By default, it fires the {@link #event:show:info `show:info` event} with the given `data`. The event namespace can be extended
73
75
  * using the `data.namespace` option. For example:
74
76
  *
75
- * showInfo( 'Editor is offline.', {
76
- * namespace: 'editor:status'
77
- * } );
77
+ * ```ts
78
+ * showInfo( 'Editor is offline.', {
79
+ * namespace: 'editor:status'
80
+ * } );
81
+ * ```
78
82
  *
79
83
  * will fire the `show:info:editor:status` event.
80
84
  *
81
85
  * You can provide the title of the notification:
82
86
  *
83
- * showInfo( 'Editor is offline.', {
84
- * title: 'Network information'
85
- * } );
87
+ * ```ts
88
+ * showInfo( 'Editor is offline.', {
89
+ * title: 'Network information'
90
+ * } );
91
+ * ```
86
92
  *
87
- * @param {String} message The content of the notification.
88
- * @param {Object} [data={}] Additional data.
89
- * @param {String} [data.namespace] Additional event namespace.
90
- * @param {String} [data.title] The title of the notification.
93
+ * @param message The content of the notification.
94
+ * @param data Additional data.
95
+ * @param data.namespace Additional event namespace.
96
+ * @param data.title The title of the notification.
91
97
  */
92
98
  showInfo(message, data = {}) {
93
99
  this._showNotification({
@@ -103,45 +109,53 @@ export default class Notification extends ContextPlugin {
103
109
  * By default, it fires the {@link #event:show:warning `show:warning` event}
104
110
  * with the given `data`. The event namespace can be extended using the `data.namespace` option. For example:
105
111
  *
106
- * showWarning( 'Image upload error.', {
107
- * namespace: 'upload:image'
108
- * } );
112
+ * ```ts
113
+ * showWarning( 'Image upload error.', {
114
+ * namespace: 'upload:image'
115
+ * } );
116
+ * ```
109
117
  *
110
118
  * will fire the `show:warning:upload:image` event.
111
119
  *
112
120
  * You can provide the title of the notification:
113
121
  *
114
- * showWarning( 'Image upload error.', {
115
- * title: 'Upload failed'
116
- * } );
122
+ * ```ts
123
+ * showWarning( 'Image upload error.', {
124
+ * title: 'Upload failed'
125
+ * } );
126
+ * ```
117
127
  *
118
128
  * Note that each unhandled and not stopped `warning` notification will be displayed as a system alert.
119
129
  * The plugin responsible for displaying warnings should `stop()` the event to prevent displaying it as an alert:
120
130
  *
121
- * notifications.on( 'show:warning', ( evt, data ) => {
122
- * // Do something with the data.
131
+ * ```ts
132
+ * notifications.on( 'show:warning', ( evt, data ) => {
133
+ * // Do something with the data.
123
134
  *
124
- * // Stop this event to prevent displaying it as an alert.
125
- * evt.stop();
126
- * } );
135
+ * // Stop this event to prevent displaying it as an alert.
136
+ * evt.stop();
137
+ * } );
138
+ * ```
127
139
  *
128
140
  * You can attach many listeners to the same event and `stop()` this event in a listener with a low priority:
129
141
  *
130
- * notifications.on( 'show:warning', ( evt, data ) => {
131
- * // Show the warning in the UI, but do not stop it.
132
- * } );
142
+ * ```ts
143
+ * notifications.on( 'show:warning', ( evt, data ) => {
144
+ * // Show the warning in the UI, but do not stop it.
145
+ * } );
133
146
  *
134
- * notifications.on( 'show:warning', ( evt, data ) => {
135
- * // Log the warning to some error tracker.
147
+ * notifications.on( 'show:warning', ( evt, data ) => {
148
+ * // Log the warning to some error tracker.
136
149
  *
137
- * // Stop this event to prevent displaying it as an alert.
138
- * evt.stop();
139
- * }, { priority: 'low' } );
150
+ * // Stop this event to prevent displaying it as an alert.
151
+ * evt.stop();
152
+ * }, { priority: 'low' } );
153
+ * ```
140
154
  *
141
- * @param {String} message The content of the notification.
142
- * @param {Object} [data={}] Additional data.
143
- * @param {String} [data.namespace] Additional event namespace.
144
- * @param {String} [data.title] The title of the notification.
155
+ * @param message The content of the notification.
156
+ * @param data Additional data.
157
+ * @param data.namespace Additional event namespace.
158
+ * @param data.title The title of the notification.
145
159
  */
146
160
  showWarning(message, data = {}) {
147
161
  this._showNotification({
@@ -154,12 +168,11 @@ export default class Notification extends ContextPlugin {
154
168
  /**
155
169
  * Fires the `show` event with the specified type, namespace and message.
156
170
  *
157
- * @private
158
- * @param {Object} data The message data.
159
- * @param {String} data.message The content of the notification.
160
- * @param {'success'|'info'|'warning'} data.type The type of the message.
161
- * @param {String} [data.namespace] Additional event namespace.
162
- * @param {String} [data.title=''] The title of the notification.
171
+ * @param data The message data.
172
+ * @param data.message The content of the notification.
173
+ * @param data.type The type of the message.
174
+ * @param data.namespace Additional event namespace.
175
+ * @param data.title The title of the notification.
163
176
  */
164
177
  _showNotification(data) {
165
178
  const event = data.namespace ?