@ckeditor/ckeditor5-ui 36.0.0 → 37.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 (114) hide show
  1. package/package.json +23 -22
  2. package/src/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
  3. package/src/bindings/addkeyboardhandlingforgrid.js +42 -34
  4. package/src/bindings/clickoutsidehandler.d.ts +28 -0
  5. package/src/bindings/clickoutsidehandler.js +5 -6
  6. package/src/bindings/csstransitiondisablermixin.d.ts +40 -0
  7. package/src/bindings/csstransitiondisablermixin.js +55 -0
  8. package/src/bindings/injectcsstransitiondisabler.d.ts +59 -0
  9. package/src/bindings/injectcsstransitiondisabler.js +23 -20
  10. package/src/bindings/preventdefault.d.ts +33 -0
  11. package/src/bindings/preventdefault.js +13 -15
  12. package/src/bindings/submithandler.d.ts +57 -0
  13. package/src/bindings/submithandler.js +22 -23
  14. package/src/button/button.d.ts +154 -0
  15. package/src/button/buttonview.d.ts +155 -0
  16. package/src/button/buttonview.js +16 -60
  17. package/src/button/switchbuttonview.d.ts +45 -0
  18. package/src/button/switchbuttonview.js +9 -18
  19. package/src/colorgrid/colorgridview.d.ts +132 -0
  20. package/src/colorgrid/colorgridview.js +8 -40
  21. package/src/colorgrid/colortileview.d.ts +28 -0
  22. package/src/colorgrid/colortileview.js +0 -13
  23. package/src/colorgrid/utils.d.ts +47 -0
  24. package/src/colorgrid/utils.js +7 -13
  25. package/src/componentfactory.d.ts +81 -0
  26. package/src/componentfactory.js +21 -35
  27. package/src/dropdown/button/dropdownbutton.d.ts +25 -0
  28. package/src/dropdown/button/dropdownbuttonview.d.ts +48 -0
  29. package/src/dropdown/button/dropdownbuttonview.js +11 -21
  30. package/src/dropdown/button/splitbuttonview.d.ts +145 -0
  31. package/src/dropdown/button/splitbuttonview.js +10 -51
  32. package/src/dropdown/dropdownpanelfocusable.d.ts +21 -0
  33. package/src/dropdown/dropdownpanelview.d.ts +62 -0
  34. package/src/dropdown/dropdownpanelview.js +2 -30
  35. package/src/dropdown/dropdownview.d.ts +315 -0
  36. package/src/dropdown/dropdownview.js +121 -222
  37. package/src/dropdown/utils.d.ts +219 -0
  38. package/src/dropdown/utils.js +112 -106
  39. package/src/editableui/editableuiview.d.ts +71 -0
  40. package/src/editableui/editableuiview.js +14 -43
  41. package/src/editableui/inline/inlineeditableuiview.d.ts +40 -0
  42. package/src/editableui/inline/inlineeditableuiview.js +5 -15
  43. package/src/editorui/bodycollection.d.ts +51 -0
  44. package/src/editorui/bodycollection.js +2 -16
  45. package/src/editorui/boxed/boxededitoruiview.d.ts +40 -0
  46. package/src/editorui/boxed/boxededitoruiview.js +1 -27
  47. package/src/editorui/editorui.d.ts +264 -0
  48. package/src/editorui/editorui.js +21 -128
  49. package/src/editorui/editoruiview.d.ts +39 -0
  50. package/src/editorui/editoruiview.js +1 -10
  51. package/src/focuscycler.d.ts +183 -0
  52. package/src/focuscycler.js +34 -90
  53. package/src/formheader/formheaderview.d.ts +53 -0
  54. package/src/formheader/formheaderview.js +3 -24
  55. package/src/icon/iconview.d.ts +78 -0
  56. package/src/icon/iconview.js +0 -50
  57. package/src/iframe/iframeview.d.ts +50 -0
  58. package/src/iframe/iframeview.js +2 -2
  59. package/src/index.d.ts +54 -0
  60. package/src/index.js +1 -0
  61. package/src/input/inputview.d.ts +121 -0
  62. package/src/input/inputview.js +0 -82
  63. package/src/inputnumber/inputnumberview.d.ts +49 -0
  64. package/src/inputnumber/inputnumberview.js +5 -28
  65. package/src/inputtext/inputtextview.d.ts +18 -0
  66. package/src/inputtext/inputtextview.js +0 -2
  67. package/src/label/labelview.d.ts +36 -0
  68. package/src/label/labelview.js +0 -20
  69. package/src/labeledfield/labeledfieldview.d.ts +182 -0
  70. package/src/labeledfield/labeledfieldview.js +20 -126
  71. package/src/labeledfield/utils.d.ts +93 -0
  72. package/src/labeledfield/utils.js +24 -18
  73. package/src/labeledinput/labeledinputview.d.ts +125 -0
  74. package/src/labeledinput/labeledinputview.js +7 -90
  75. package/src/list/listitemview.d.ts +35 -0
  76. package/src/list/listitemview.js +0 -16
  77. package/src/list/listseparatorview.d.ts +18 -0
  78. package/src/list/listseparatorview.js +0 -2
  79. package/src/list/listview.d.ts +59 -0
  80. package/src/list/listview.js +0 -33
  81. package/src/model.d.ts +22 -0
  82. package/src/model.js +2 -4
  83. package/src/notification/notification.d.ts +216 -0
  84. package/src/notification/notification.js +64 -51
  85. package/src/panel/balloon/balloonpanelview.d.ts +685 -0
  86. package/src/panel/balloon/balloonpanelview.js +146 -168
  87. package/src/panel/balloon/contextualballoon.d.ts +240 -0
  88. package/src/panel/balloon/contextualballoon.js +41 -171
  89. package/src/panel/sticky/stickypanelview.d.ts +132 -0
  90. package/src/panel/sticky/stickypanelview.js +0 -115
  91. package/src/template.d.ts +940 -0
  92. package/src/template.js +396 -460
  93. package/src/toolbar/balloon/balloontoolbar.d.ts +124 -0
  94. package/src/toolbar/balloon/balloontoolbar.js +15 -81
  95. package/src/toolbar/block/blockbuttonview.d.ts +35 -0
  96. package/src/toolbar/block/blockbuttonview.js +1 -13
  97. package/src/toolbar/block/blocktoolbar.d.ts +159 -0
  98. package/src/toolbar/block/blocktoolbar.js +32 -69
  99. package/src/toolbar/normalizetoolbarconfig.d.ts +39 -0
  100. package/src/toolbar/normalizetoolbarconfig.js +12 -8
  101. package/src/toolbar/toolbarlinebreakview.d.ts +18 -0
  102. package/src/toolbar/toolbarlinebreakview.js +0 -2
  103. package/src/toolbar/toolbarseparatorview.d.ts +18 -0
  104. package/src/toolbar/toolbarseparatorview.js +0 -2
  105. package/src/toolbar/toolbarview.d.ts +241 -0
  106. package/src/toolbar/toolbarview.js +54 -305
  107. package/src/tooltipmanager.d.ts +180 -0
  108. package/src/tooltipmanager.js +47 -94
  109. package/src/uiconfig.d.ts +82 -0
  110. package/src/uiconfig.js +5 -0
  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
@@ -0,0 +1,39 @@
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/editorui/editoruiview
7
+ */
8
+ import View from '../view';
9
+ import BodyCollection from './bodycollection';
10
+ import type EditableUIView from '../editableui/editableuiview';
11
+ import type { Locale, LocaleTranslate } from '@ckeditor/ckeditor5-utils';
12
+ import '../../theme/components/editorui/editorui.css';
13
+ /**
14
+ * The editor UI view class. Base class for the editor main views.
15
+ */
16
+ export default abstract class EditorUIView extends View {
17
+ /**
18
+ * Collection of the child views, detached from the DOM
19
+ * structure of the editor, like panels, icons etc.
20
+ */
21
+ readonly body: BodyCollection;
22
+ locale: Locale;
23
+ t: LocaleTranslate;
24
+ abstract get editable(): EditableUIView;
25
+ /**
26
+ * Creates an instance of the editor UI view class.
27
+ *
28
+ * @param locale The locale instance.
29
+ */
30
+ constructor(locale: Locale);
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ render(): void;
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ destroy(): void;
39
+ }
@@ -10,24 +10,15 @@ import BodyCollection from './bodycollection';
10
10
  import '../../theme/components/editorui/editorui.css';
11
11
  /**
12
12
  * The editor UI view class. Base class for the editor main views.
13
- *
14
- * @extends module:ui/view~View
15
13
  */
16
14
  export default class EditorUIView extends View {
17
15
  /**
18
16
  * Creates an instance of the editor UI view class.
19
17
  *
20
- * @param {module:utils/locale~Locale} [locale] The locale instance.
18
+ * @param locale The locale instance.
21
19
  */
22
20
  constructor(locale) {
23
21
  super(locale);
24
- /**
25
- * Collection of the child views, detached from the DOM
26
- * structure of the editor, like panels, icons etc.
27
- *
28
- * @readonly
29
- * @member {module:ui/viewcollection~ViewCollection} #body
30
- */
31
22
  this.body = new BodyCollection(locale);
32
23
  }
33
24
  /**
@@ -0,0 +1,183 @@
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/focuscycler
7
+ */
8
+ import { type ArrayOrItem, type FocusTracker, type KeystrokeHandler } from '@ckeditor/ckeditor5-utils';
9
+ import type View from './view';
10
+ import type ViewCollection from './viewcollection';
11
+ /**
12
+ * A utility class that helps cycling over focusable {@link module:ui/view~View views} in a
13
+ * {@link module:ui/viewcollection~ViewCollection} when the focus is tracked by the
14
+ * {@link module:utils/focustracker~FocusTracker} instance. It helps implementing keyboard
15
+ * navigation in HTML forms, toolbars, lists and the like.
16
+ *
17
+ * To work properly it requires:
18
+ * * a collection of focusable (HTML `tabindex` attribute) views that implement the `focus()` method,
19
+ * * an associated focus tracker to determine which view is focused.
20
+ *
21
+ * A simple cycler setup can look like this:
22
+ *
23
+ * ```ts
24
+ * const focusables = new ViewCollection();
25
+ * const focusTracker = new FocusTracker();
26
+ *
27
+ * // Add focusable views to the focus tracker.
28
+ * focusTracker.add( ... );
29
+ * ```
30
+ *
31
+ * Then, the cycler can be used manually:
32
+ *
33
+ * ```ts
34
+ * const cycler = new FocusCycler( { focusables, focusTracker } );
35
+ *
36
+ * // Will focus the first focusable view in #focusables.
37
+ * cycler.focusFirst();
38
+ *
39
+ * // Will log the next focusable item in #focusables.
40
+ * console.log( cycler.next );
41
+ * ```
42
+ *
43
+ * Alternatively, it can work side by side with the {@link module:utils/keystrokehandler~KeystrokeHandler}:
44
+ *
45
+ * ```ts
46
+ * const keystrokeHandler = new KeystrokeHandler();
47
+ *
48
+ * // Activate the keystroke handler.
49
+ * keystrokeHandler.listenTo( sourceOfEvents );
50
+ *
51
+ * const cycler = new FocusCycler( {
52
+ * focusables, focusTracker, keystrokeHandler,
53
+ * actions: {
54
+ * // When arrowup of arrowleft is detected by the #keystrokeHandler,
55
+ * // focusPrevious() will be called on the cycler.
56
+ * focusPrevious: [ 'arrowup', 'arrowleft' ],
57
+ * }
58
+ * } );
59
+ * ```
60
+ *
61
+ * Check out the {@glink framework/deep-dive/ui/focus-tracking "Deep dive into focus tracking"} guide to learn more.
62
+ */
63
+ export default class FocusCycler {
64
+ /**
65
+ * A {@link module:ui/view~View view} collection that the cycler operates on.
66
+ */
67
+ readonly focusables: ViewCollection;
68
+ /**
69
+ * A focus tracker instance that the cycler uses to determine the current focus
70
+ * state in {@link #focusables}.
71
+ */
72
+ readonly focusTracker: FocusTracker;
73
+ /**
74
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}
75
+ * which can respond to certain keystrokes and cycle the focus.
76
+ */
77
+ readonly keystrokeHandler?: KeystrokeHandler;
78
+ /**
79
+ * Actions that the cycler can take when a keystroke is pressed. Requires
80
+ * `options.keystrokeHandler` to be passed and working. When an action is
81
+ * performed, `preventDefault` and `stopPropagation` will be called on the event
82
+ * the keystroke fired in the DOM.
83
+ *
84
+ * ```ts
85
+ * actions: {
86
+ * // Will call #focusPrevious() when arrowleft or arrowup is pressed.
87
+ * focusPrevious: [ 'arrowleft', 'arrowup' ],
88
+ *
89
+ * // Will call #focusNext() when arrowdown is pressed.
90
+ * focusNext: 'arrowdown'
91
+ * }
92
+ * ```
93
+ */
94
+ readonly actions?: FocusCyclerActions;
95
+ /**
96
+ * Creates an instance of the focus cycler utility.
97
+ *
98
+ * @param options Configuration options.
99
+ */
100
+ constructor(options: {
101
+ focusables: ViewCollection;
102
+ focusTracker: FocusTracker;
103
+ keystrokeHandler?: KeystrokeHandler;
104
+ actions?: FocusCyclerActions;
105
+ });
106
+ /**
107
+ * Returns the first focusable view in {@link #focusables}.
108
+ * Returns `null` if there is none.
109
+ *
110
+ * **Note**: Hidden views (e.g. with `display: none`) are ignored.
111
+ */
112
+ get first(): FocusableView | null;
113
+ /**
114
+ * Returns the last focusable view in {@link #focusables}.
115
+ * Returns `null` if there is none.
116
+ *
117
+ * **Note**: Hidden views (e.g. with `display: none`) are ignored.
118
+ */
119
+ get last(): FocusableView | null;
120
+ /**
121
+ * Returns the next focusable view in {@link #focusables} based on {@link #current}.
122
+ * Returns `null` if there is none.
123
+ *
124
+ * **Note**: Hidden views (e.g. with `display: none`) are ignored.
125
+ */
126
+ get next(): FocusableView | null;
127
+ /**
128
+ * Returns the previous focusable view in {@link #focusables} based on {@link #current}.
129
+ * Returns `null` if there is none.
130
+ *
131
+ * **Note**: Hidden views (e.g. with `display: none`) are ignored.
132
+ */
133
+ get previous(): FocusableView | null;
134
+ /**
135
+ * An index of the view in the {@link #focusables} which is focused according
136
+ * to {@link #focusTracker}. Returns `null` when there is no such view.
137
+ */
138
+ get current(): number | null;
139
+ /**
140
+ * Focuses the {@link #first} item in {@link #focusables}.
141
+ *
142
+ * **Note**: Hidden views (e.g. with `display: none`) are ignored.
143
+ */
144
+ focusFirst(): void;
145
+ /**
146
+ * Focuses the {@link #last} item in {@link #focusables}.
147
+ *
148
+ * **Note**: Hidden views (e.g. with `display: none`) are ignored.
149
+ */
150
+ focusLast(): void;
151
+ /**
152
+ * Focuses the {@link #next} item in {@link #focusables}.
153
+ *
154
+ * **Note**: Hidden views (e.g. with `display: none`) are ignored.
155
+ */
156
+ focusNext(): void;
157
+ /**
158
+ * Focuses the {@link #previous} item in {@link #focusables}.
159
+ *
160
+ * **Note**: Hidden views (e.g. with `display: none`) are ignored.
161
+ */
162
+ focusPrevious(): void;
163
+ /**
164
+ * Focuses the given view if it exists.
165
+ */
166
+ private _focus;
167
+ /**
168
+ * Returns the next or previous focusable view in {@link #focusables} with respect
169
+ * to {@link #current}.
170
+ *
171
+ * @param step Either `1` for checking forward from {@link #current} or `-1` for checking backwards.
172
+ */
173
+ private _getFocusableItem;
174
+ }
175
+ export type FocusableView = View & {
176
+ focus(): void;
177
+ };
178
+ export interface FocusCyclerActions {
179
+ focusFirst?: ArrayOrItem<string>;
180
+ focusLast?: ArrayOrItem<string>;
181
+ focusNext?: ArrayOrItem<string>;
182
+ focusPrevious?: ArrayOrItem<string>;
183
+ }
@@ -18,92 +18,57 @@ import { isVisible } from '@ckeditor/ckeditor5-utils';
18
18
  *
19
19
  * A simple cycler setup can look like this:
20
20
  *
21
- * const focusables = new ViewCollection();
22
- * const focusTracker = new FocusTracker();
21
+ * ```ts
22
+ * const focusables = new ViewCollection();
23
+ * const focusTracker = new FocusTracker();
23
24
  *
24
- * // Add focusable views to the focus tracker.
25
- * focusTracker.add( ... );
25
+ * // Add focusable views to the focus tracker.
26
+ * focusTracker.add( ... );
27
+ * ```
26
28
  *
27
29
  * Then, the cycler can be used manually:
28
30
  *
29
- * const cycler = new FocusCycler( { focusables, focusTracker } );
31
+ * ```ts
32
+ * const cycler = new FocusCycler( { focusables, focusTracker } );
30
33
  *
31
- * // Will focus the first focusable view in #focusables.
32
- * cycler.focusFirst();
34
+ * // Will focus the first focusable view in #focusables.
35
+ * cycler.focusFirst();
33
36
  *
34
- * // Will log the next focusable item in #focusables.
35
- * console.log( cycler.next );
37
+ * // Will log the next focusable item in #focusables.
38
+ * console.log( cycler.next );
39
+ * ```
36
40
  *
37
41
  * Alternatively, it can work side by side with the {@link module:utils/keystrokehandler~KeystrokeHandler}:
38
42
  *
39
- * const keystrokeHandler = new KeystrokeHandler();
43
+ * ```ts
44
+ * const keystrokeHandler = new KeystrokeHandler();
40
45
  *
41
- * // Activate the keystroke handler.
42
- * keystrokeHandler.listenTo( sourceOfEvents );
46
+ * // Activate the keystroke handler.
47
+ * keystrokeHandler.listenTo( sourceOfEvents );
43
48
  *
44
- * const cycler = new FocusCycler( {
45
- * focusables, focusTracker, keystrokeHandler,
46
- * actions: {
47
- * // When arrowup of arrowleft is detected by the #keystrokeHandler,
48
- * // focusPrevious() will be called on the cycler.
49
- * focusPrevious: [ 'arrowup', 'arrowleft' ],
50
- * }
51
- * } );
49
+ * const cycler = new FocusCycler( {
50
+ * focusables, focusTracker, keystrokeHandler,
51
+ * actions: {
52
+ * // When arrowup of arrowleft is detected by the #keystrokeHandler,
53
+ * // focusPrevious() will be called on the cycler.
54
+ * focusPrevious: [ 'arrowup', 'arrowleft' ],
55
+ * }
56
+ * } );
57
+ * ```
52
58
  *
53
- * Check out the {@glink framework/guides/deep-dive/ui/focus-tracking "Deep dive into focus tracking" guide} to learn more.
59
+ * Check out the {@glink framework/deep-dive/ui/focus-tracking "Deep dive into focus tracking"} guide to learn more.
54
60
  */
55
61
  export default class FocusCycler {
56
62
  /**
57
63
  * Creates an instance of the focus cycler utility.
58
64
  *
59
- * @param {Object} options Configuration options.
60
- * @param {module:utils/collection~Collection|Object} options.focusables
61
- * @param {module:utils/focustracker~FocusTracker} options.focusTracker
62
- * @param {module:utils/keystrokehandler~KeystrokeHandler} [options.keystrokeHandler]
63
- * @param {Object} [options.actions]
65
+ * @param options Configuration options.
64
66
  */
65
67
  constructor(options) {
66
68
  this.focusables = options.focusables;
67
69
  this.focusTracker = options.focusTracker;
68
70
  this.keystrokeHandler = options.keystrokeHandler;
69
71
  this.actions = options.actions;
70
- /**
71
- * A {@link module:ui/view~View view} collection that the cycler operates on.
72
- *
73
- * @readonly
74
- * @member {module:utils/collection~Collection} #focusables
75
- */
76
- /**
77
- * A focus tracker instance that the cycler uses to determine the current focus
78
- * state in {@link #focusables}.
79
- *
80
- * @readonly
81
- * @member {module:utils/focustracker~FocusTracker} #focusTracker
82
- */
83
- /**
84
- * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}
85
- * which can respond to certain keystrokes and cycle the focus.
86
- *
87
- * @readonly
88
- * @member {module:utils/keystrokehandler~KeystrokeHandler} #keystrokeHandler
89
- */
90
- /**
91
- * Actions that the cycler can take when a keystroke is pressed. Requires
92
- * `options.keystrokeHandler` to be passed and working. When an action is
93
- * performed, `preventDefault` and `stopPropagation` will be called on the event
94
- * the keystroke fired in the DOM.
95
- *
96
- * actions: {
97
- * // Will call #focusPrevious() when arrowleft or arrowup is pressed.
98
- * focusPrevious: [ 'arrowleft', 'arrowup' ],
99
- *
100
- * // Will call #focusNext() when arrowdown is pressed.
101
- * focusNext: 'arrowdown'
102
- * }
103
- *
104
- * @readonly
105
- * @member {Object} #actions
106
- */
107
72
  if (options.actions && options.keystrokeHandler) {
108
73
  for (const methodName in options.actions) {
109
74
  let actions = options.actions[methodName];
@@ -124,9 +89,6 @@ export default class FocusCycler {
124
89
  * Returns `null` if there is none.
125
90
  *
126
91
  * **Note**: Hidden views (e.g. with `display: none`) are ignored.
127
- *
128
- * @readonly
129
- * @member {module:ui/view~View|null} #first
130
92
  */
131
93
  get first() {
132
94
  return (this.focusables.find(isFocusable) || null);
@@ -136,9 +98,6 @@ export default class FocusCycler {
136
98
  * Returns `null` if there is none.
137
99
  *
138
100
  * **Note**: Hidden views (e.g. with `display: none`) are ignored.
139
- *
140
- * @readonly
141
- * @member {module:ui/view~View|null} #last
142
101
  */
143
102
  get last() {
144
103
  return (this.focusables.filter(isFocusable).slice(-1)[0] || null);
@@ -148,9 +107,6 @@ export default class FocusCycler {
148
107
  * Returns `null` if there is none.
149
108
  *
150
109
  * **Note**: Hidden views (e.g. with `display: none`) are ignored.
151
- *
152
- * @readonly
153
- * @member {module:ui/view~View|null} #next
154
110
  */
155
111
  get next() {
156
112
  return this._getFocusableItem(1);
@@ -160,9 +116,6 @@ export default class FocusCycler {
160
116
  * Returns `null` if there is none.
161
117
  *
162
118
  * **Note**: Hidden views (e.g. with `display: none`) are ignored.
163
- *
164
- * @readonly
165
- * @member {module:ui/view~View|null} #previous
166
119
  */
167
120
  get previous() {
168
121
  return this._getFocusableItem(-1);
@@ -170,9 +123,6 @@ export default class FocusCycler {
170
123
  /**
171
124
  * An index of the view in the {@link #focusables} which is focused according
172
125
  * to {@link #focusTracker}. Returns `null` when there is no such view.
173
- *
174
- * @readonly
175
- * @member {Number|null} #current
176
126
  */
177
127
  get current() {
178
128
  let index = null;
@@ -223,9 +173,6 @@ export default class FocusCycler {
223
173
  }
224
174
  /**
225
175
  * Focuses the given view if it exists.
226
- *
227
- * @protected
228
- * @param {module:ui/view~View} view
229
176
  */
230
177
  _focus(view) {
231
178
  if (view) {
@@ -236,10 +183,7 @@ export default class FocusCycler {
236
183
  * Returns the next or previous focusable view in {@link #focusables} with respect
237
184
  * to {@link #current}.
238
185
  *
239
- * @protected
240
- * @param {Number} step Either `1` for checking forward from {@link #current} or
241
- * `-1` for checking backwards.
242
- * @returns {module:ui/view~View|null}
186
+ * @param step Either `1` for checking forward from {@link #current} or `-1` for checking backwards.
243
187
  */
244
188
  _getFocusableItem(step) {
245
189
  // Cache for speed.
@@ -266,11 +210,11 @@ export default class FocusCycler {
266
210
  return null;
267
211
  }
268
212
  }
269
- // Checks whether a view is focusable.
270
- //
271
- // @private
272
- // @param {module:ui/view~View} view A view to be checked.
273
- // @returns {Boolean}
213
+ /**
214
+ * Checks whether a view is focusable.
215
+ *
216
+ * @param view A view to be checked.
217
+ */
274
218
  function isFocusable(view) {
275
219
  return !!(view.focus && isVisible(view.element));
276
220
  }
@@ -0,0 +1,53 @@
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/formheader/formheaderview
7
+ */
8
+ import View from '../view';
9
+ import type ViewCollection from '../viewcollection';
10
+ import type { Locale } from '@ckeditor/ckeditor5-utils';
11
+ import '../../theme/components/formheader/formheader.css';
12
+ /**
13
+ * The class component representing a form header view. It should be used in more advanced forms to
14
+ * describe the main purpose of the form.
15
+ *
16
+ * By default the component contains a bolded label view that has to be set. The label is usually a short (at most 3-word) string.
17
+ * The component can also be extended by any other elements, like: icons, dropdowns, etc.
18
+ *
19
+ * It is used i.a.
20
+ * by {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView}
21
+ * and {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}.
22
+ *
23
+ * The latter is an example, where the component has been extended by {@link module:ui/dropdown/dropdownview~DropdownView} view.
24
+ */
25
+ export default class FormHeaderView extends View {
26
+ /**
27
+ * A collection of header items.
28
+ */
29
+ readonly children: ViewCollection;
30
+ /**
31
+ * The label of the header.
32
+ *
33
+ * @observable
34
+ */
35
+ label: string;
36
+ /**
37
+ * An additional CSS class added to the {@link #element}.
38
+ *
39
+ * @observable
40
+ */
41
+ class: string | null;
42
+ /**
43
+ * Creates an instance of the form header class.
44
+ *
45
+ * @param locale The locale instance.
46
+ * @param options.label A label.
47
+ * @param options.class An additional class.
48
+ */
49
+ constructor(locale: Locale | undefined, options?: {
50
+ label?: string | null;
51
+ class?: string | null;
52
+ });
53
+ }
@@ -19,41 +19,20 @@ import '../../theme/components/formheader/formheader.css';
19
19
  * and {@link module:special-characters/ui/specialcharactersnavigationview~SpecialCharactersNavigationView}.
20
20
  *
21
21
  * The latter is an example, where the component has been extended by {@link module:ui/dropdown/dropdownview~DropdownView} view.
22
- *
23
- * @extends module:ui/view~View
24
22
  */
25
23
  export default class FormHeaderView extends View {
26
24
  /**
27
25
  * Creates an instance of the form header class.
28
26
  *
29
- * @param {module:utils/locale~Locale} locale The locale instance.
30
- * @param {Object} options
31
- * @param {String} options.label A label.
32
- * @param {String} [options.class] An additional class.
27
+ * @param locale The locale instance.
28
+ * @param options.label A label.
29
+ * @param options.class An additional class.
33
30
  */
34
31
  constructor(locale, options = {}) {
35
32
  super(locale);
36
33
  const bind = this.bindTemplate;
37
- /**
38
- * The label of the header.
39
- *
40
- * @observable
41
- * @member {String} #label
42
- */
43
34
  this.set('label', options.label || '');
44
- /**
45
- * An additional CSS class added to the {@link #element}.
46
- *
47
- * @observable
48
- * @member {String} #class
49
- */
50
35
  this.set('class', options.class || null);
51
- /**
52
- * A collection of header items.
53
- *
54
- * @readonly
55
- * @member {module:ui/viewcollection~ViewCollection}
56
- */
57
36
  this.children = this.createCollection();
58
37
  this.setTemplate({
59
38
  tag: 'div',
@@ -0,0 +1,78 @@
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/icon/iconview
7
+ */
8
+ import View from '../view';
9
+ import '../../theme/components/icon/icon.css';
10
+ /**
11
+ * The icon view class.
12
+ */
13
+ export default class IconView extends View {
14
+ /**
15
+ * The SVG source of the icon.
16
+ *
17
+ * @observable
18
+ */
19
+ content: string | undefined;
20
+ /**
21
+ * This attribute specifies the boundaries to which the
22
+ * icon content should stretch.
23
+ *
24
+ * @observable
25
+ * @default '0 0 20 20'
26
+ */
27
+ viewBox: string;
28
+ /**
29
+ * The fill color of the child `path.ck-icon__fill`.
30
+ *
31
+ * @observable
32
+ * @default ''
33
+ */
34
+ fillColor: string;
35
+ /**
36
+ * When set true (default), all parts of the icon inherit the fill color from the CSS `color` property of the
37
+ * icon's DOM parent.
38
+ *
39
+ * This effectively makes the icon monochromatic and allows it to change its fill color dynamically, for instance,
40
+ * when a {@link module:ui/button/buttonview~ButtonView} displays an icon and it switches between different states
41
+ * (pushed, hovered, etc.) the icon will follow along.
42
+ *
43
+ * **Note**: For the monochromatic icon to render properly, it must be made up of shapes that can be filled
44
+ * with color instead of, for instance, paths with strokes. Be sure to use the *outline stroke* tool
45
+ * (the name could be different in your vector graphics editor) before exporting your icon. Also, remove any
46
+ * excess `fill="..."` attributes that could break the color inheritance.
47
+ *
48
+ * **Note**: If you want to preserve the original look of your icon and disable dynamic color inheritance,
49
+ * set this flag to `false`.
50
+ *
51
+ * @observable
52
+ * @default true
53
+ */
54
+ isColorInherited: boolean;
55
+ /**
56
+ * A list of presentational attributes that can be set on the `<svg>` element and should be preserved
57
+ * when the icon {@link module:ui/icon/iconview~IconView#content content} is loaded.
58
+ *
59
+ * See the [specification](https://www.w3.org/TR/SVG/styling.html#TermPresentationAttribute) to learn more.
60
+ */
61
+ private static presentationalAttributeNames;
62
+ /**
63
+ * @inheritDoc
64
+ */
65
+ constructor();
66
+ /**
67
+ * @inheritDoc
68
+ */
69
+ render(): void;
70
+ /**
71
+ * Updates the {@link #element} with the value of {@link #content}.
72
+ */
73
+ private _updateXMLContent;
74
+ /**
75
+ * Fills all child `path.ck-icon__fill` with the `#fillColor`.
76
+ */
77
+ private _colorFillPaths;
78
+ }