@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
@@ -6,27 +6,26 @@
6
6
  * @module ui/dropdown/button/dropdownbuttonview
7
7
  */
8
8
  import ButtonView from '../../button/buttonview';
9
- import dropdownArrowIcon from '../../../theme/icons/dropdown-arrow.svg';
10
9
  import IconView from '../../icon/iconview';
10
+ import dropdownArrowIcon from '../../../theme/icons/dropdown-arrow.svg';
11
11
  /**
12
12
  * The default dropdown button view class.
13
13
  *
14
- * const view = new DropdownButtonView();
14
+ * ```ts
15
+ * const view = new DropdownButtonView();
15
16
  *
16
- * view.set( {
17
- * label: 'A button',
18
- * keystroke: 'Ctrl+B',
19
- * tooltip: true
20
- * } );
17
+ * view.set( {
18
+ * label: 'A button',
19
+ * keystroke: 'Ctrl+B',
20
+ * tooltip: true
21
+ * } );
21
22
  *
22
- * view.render();
23
+ * view.render();
23
24
  *
24
- * document.body.append( view.element );
25
+ * document.body.append( view.element );
26
+ * ```
25
27
  *
26
28
  * Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.
27
- *
28
- * @implements module:ui/dropdown/button/dropdownbutton~DropdownButton
29
- * @extends module:ui/button/buttonview~ButtonView
30
29
  */
31
30
  export default class DropdownButtonView extends ButtonView {
32
31
  /**
@@ -34,12 +33,6 @@ export default class DropdownButtonView extends ButtonView {
34
33
  */
35
34
  constructor(locale) {
36
35
  super(locale);
37
- /**
38
- * An icon that displays arrow to indicate a dropdown button.
39
- *
40
- * @readonly
41
- * @member {module:ui/icon/iconview~IconView}
42
- */
43
36
  this.arrowView = this._createArrowView();
44
37
  this.extendTemplate({
45
38
  attributes: {
@@ -59,9 +52,6 @@ export default class DropdownButtonView extends ButtonView {
59
52
  }
60
53
  /**
61
54
  * Creates a {@link module:ui/icon/iconview~IconView} instance as {@link #arrowView}.
62
- *
63
- * @private
64
- * @returns {module:ui/icon/iconview~IconView}
65
55
  */
66
56
  _createArrowView() {
67
57
  const arrowView = new IconView();
@@ -0,0 +1,145 @@
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/dropdown/button/splitbuttonview
7
+ */
8
+ import View from '../../view';
9
+ import ButtonView from '../../button/buttonview';
10
+ import type ViewCollection from '../../viewcollection';
11
+ import type Button from '../../button/button';
12
+ import type DropdownButton from './dropdownbutton';
13
+ import { KeystrokeHandler, FocusTracker, type Locale } from '@ckeditor/ckeditor5-utils';
14
+ import '../../../theme/components/dropdown/splitbutton.css';
15
+ /**
16
+ * The split button view class.
17
+ *
18
+ * ```ts
19
+ * const view = new SplitButtonView();
20
+ *
21
+ * view.set( {
22
+ * label: 'A button',
23
+ * keystroke: 'Ctrl+B',
24
+ * tooltip: true
25
+ * } );
26
+ *
27
+ * view.render();
28
+ *
29
+ * document.body.append( view.element );
30
+ * ```
31
+ *
32
+ * Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.
33
+ */
34
+ export default class SplitButtonView extends View<HTMLDivElement> implements DropdownButton {
35
+ /**
36
+ * Collection of the child views inside of the split button {@link #element}.
37
+ */
38
+ readonly children: ViewCollection;
39
+ /**
40
+ * A main button of split button.
41
+ */
42
+ readonly actionView: ButtonView;
43
+ /**
44
+ * A secondary button of split button that opens dropdown.
45
+ */
46
+ readonly arrowView: ButtonView;
47
+ /**
48
+ * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
49
+ * keystrokes of the split button:
50
+ *
51
+ * * <kbd>▶</kbd> moves focus to arrow view when action view is focused,
52
+ * * <kbd>◀</kbd> moves focus to action view when arrow view is focused.
53
+ */
54
+ readonly keystrokes: KeystrokeHandler;
55
+ /**
56
+ * Tracks information about DOM focus in the dropdown.
57
+ */
58
+ readonly focusTracker: FocusTracker;
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ label: string | undefined;
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ keystroke: string | undefined;
67
+ /**
68
+ * @inheritDoc
69
+ */
70
+ tooltip: Button['tooltip'];
71
+ /**
72
+ * @inheritDoc
73
+ */
74
+ tooltipPosition: Button['tooltipPosition'];
75
+ /**
76
+ * @inheritDoc
77
+ */
78
+ type: Button['type'];
79
+ /**
80
+ * @inheritDoc
81
+ */
82
+ isOn: boolean;
83
+ /**
84
+ * @inheritDoc
85
+ */
86
+ isEnabled: boolean;
87
+ /**
88
+ * @inheritDoc
89
+ */
90
+ isVisible: boolean;
91
+ /**
92
+ * @inheritDoc
93
+ */
94
+ isToggleable: boolean;
95
+ /**
96
+ * @inheritDoc
97
+ */
98
+ withText: boolean;
99
+ /**
100
+ * @inheritDoc
101
+ */
102
+ withKeystroke: boolean;
103
+ /**
104
+ * @inheritDoc
105
+ */
106
+ icon: string | undefined;
107
+ /**
108
+ * @inheritDoc
109
+ */
110
+ tabindex: number;
111
+ /**
112
+ * @inheritDoc
113
+ */
114
+ class: string | undefined;
115
+ /**
116
+ * @inheritDoc
117
+ */
118
+ labelStyle: string | undefined;
119
+ /**
120
+ * @inheritDoc
121
+ */
122
+ constructor(locale?: Locale);
123
+ /**
124
+ * @inheritDoc
125
+ */
126
+ render(): void;
127
+ /**
128
+ * @inheritDoc
129
+ */
130
+ destroy(): void;
131
+ /**
132
+ * Focuses the {@link module:ui/button/buttonview~ButtonView#element} of the action part of split button.
133
+ */
134
+ focus(): void;
135
+ /**
136
+ * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #actionView} and binds it with main split button
137
+ * attributes.
138
+ */
139
+ private _createActionView;
140
+ /**
141
+ * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #arrowView} and binds it with main split button
142
+ * attributes.
143
+ */
144
+ private _createArrowView;
145
+ }
@@ -13,22 +13,21 @@ import '../../../theme/components/dropdown/splitbutton.css';
13
13
  /**
14
14
  * The split button view class.
15
15
  *
16
- * const view = new SplitButtonView();
16
+ * ```ts
17
+ * const view = new SplitButtonView();
17
18
  *
18
- * view.set( {
19
- * label: 'A button',
20
- * keystroke: 'Ctrl+B',
21
- * tooltip: true
22
- * } );
19
+ * view.set( {
20
+ * label: 'A button',
21
+ * keystroke: 'Ctrl+B',
22
+ * tooltip: true
23
+ * } );
23
24
  *
24
- * view.render();
25
+ * view.render();
25
26
  *
26
- * document.body.append( view.element );
27
+ * document.body.append( view.element );
28
+ * ```
27
29
  *
28
30
  * Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.
29
- *
30
- * @implements module:ui/dropdown/button/dropdownbutton~DropdownButton
31
- * @extends module:ui/view~View
32
31
  */
33
32
  export default class SplitButtonView extends View {
34
33
  /**
@@ -53,44 +52,10 @@ export default class SplitButtonView extends View {
53
52
  this.set('tooltipPosition', 's');
54
53
  this.set('type', 'button');
55
54
  this.set('withText', false);
56
- /**
57
- * Collection of the child views inside of the split button {@link #element}.
58
- *
59
- * @readonly
60
- * @member {module:ui/viewcollection~ViewCollection}
61
- */
62
55
  this.children = this.createCollection();
63
- /**
64
- * A main button of split button.
65
- *
66
- * @readonly
67
- * @member {module:ui/button/buttonview~ButtonView}
68
- */
69
56
  this.actionView = this._createActionView();
70
- /**
71
- * A secondary button of split button that opens dropdown.
72
- *
73
- * @readonly
74
- * @member {module:ui/button/buttonview~ButtonView}
75
- */
76
57
  this.arrowView = this._createArrowView();
77
- /**
78
- * Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
79
- * keystrokes of the split button:
80
- *
81
- * * <kbd>▶</kbd> moves focus to arrow view when action view is focused,
82
- * * <kbd>◀</kbd> moves focus to action view when arrow view is focused.
83
- *
84
- * @readonly
85
- * @member {module:utils/keystrokehandler~KeystrokeHandler}
86
- */
87
58
  this.keystrokes = new KeystrokeHandler();
88
- /**
89
- * Tracks information about DOM focus in the dropdown.
90
- *
91
- * @readonly
92
- * @member {module:utils/focustracker~FocusTracker}
93
- */
94
59
  this.focusTracker = new FocusTracker();
95
60
  this.setTemplate({
96
61
  tag: 'div',
@@ -140,7 +105,7 @@ export default class SplitButtonView extends View {
140
105
  this.keystrokes.destroy();
141
106
  }
142
107
  /**
143
- * Focuses the {@link #actionView#element} of the action part of split button.
108
+ * Focuses the {@link module:ui/button/buttonview~ButtonView#element} of the action part of split button.
144
109
  */
145
110
  focus() {
146
111
  this.actionView.focus();
@@ -148,9 +113,6 @@ export default class SplitButtonView extends View {
148
113
  /**
149
114
  * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #actionView} and binds it with main split button
150
115
  * attributes.
151
- *
152
- * @private
153
- * @returns {module:ui/button/buttonview~ButtonView}
154
116
  */
155
117
  _createActionView() {
156
118
  const actionView = new ButtonView();
@@ -166,9 +128,6 @@ export default class SplitButtonView extends View {
166
128
  /**
167
129
  * Creates a {@link module:ui/button/buttonview~ButtonView} instance as {@link #arrowView} and binds it with main split button
168
130
  * attributes.
169
- *
170
- * @private
171
- * @returns {module:ui/button/buttonview~ButtonView}
172
131
  */
173
132
  _createArrowView() {
174
133
  const arrowView = new ButtonView();
@@ -0,0 +1,21 @@
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/dropdown/dropdownpanelfocusable
7
+ */
8
+ /**
9
+ * The dropdown panel interface for focusable contents. It provides two methods for managing focus of the contents
10
+ * of dropdown's panel.
11
+ */
12
+ export default interface DropdownPanelFocusable {
13
+ /**
14
+ * Focuses the view element or first item in view collection on opening dropdown's panel.
15
+ */
16
+ focus(): void;
17
+ /**
18
+ * Focuses the view element or last item in view collection on opening dropdown's panel.
19
+ */
20
+ focusLast(): void;
21
+ }
@@ -0,0 +1,62 @@
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/dropdown/dropdownpanelview
7
+ */
8
+ import View from '../view';
9
+ import type ViewCollection from '../viewcollection';
10
+ import type DropdownPanelFocusable from './dropdownpanelfocusable';
11
+ import { type Locale } from '@ckeditor/ckeditor5-utils';
12
+ /**
13
+ * The dropdown panel view class.
14
+ *
15
+ * See {@link module:ui/dropdown/dropdownview~DropdownView} to learn about the common usage.
16
+ */
17
+ export default class DropdownPanelView extends View implements DropdownPanelFocusable {
18
+ /**
19
+ * Collection of the child views in this panel.
20
+ *
21
+ * A common child type is the {@link module:ui/list/listview~ListView} and {@link module:ui/toolbar/toolbarview~ToolbarView}.
22
+ * See {@link module:ui/dropdown/utils~addListToDropdown} and
23
+ * {@link module:ui/dropdown/utils~addToolbarToDropdown} to learn more about child views of dropdowns.
24
+ */
25
+ readonly children: ViewCollection;
26
+ /**
27
+ * Controls whether the panel is visible.
28
+ *
29
+ * @observable
30
+ */
31
+ isVisible: boolean;
32
+ /**
33
+ * The position of the panel, relative to the parent.
34
+ *
35
+ * This property is reflected in the CSS class set to {@link #element} that controls
36
+ * the position of the panel.
37
+ *
38
+ * @observable
39
+ * @default 'se'
40
+ */
41
+ position: PanelPosition;
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ constructor(locale?: Locale);
46
+ /**
47
+ * Focuses the first view in the {@link #children} collection.
48
+ *
49
+ * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.
50
+ */
51
+ focus(): void;
52
+ /**
53
+ * Focuses the view element or last item in view collection on opening dropdown's panel.
54
+ *
55
+ * See also {@link module:ui/dropdown/dropdownpanelfocusable~DropdownPanelFocusable}.
56
+ */
57
+ focusLast(): void;
58
+ }
59
+ /**
60
+ * The position of the panel, relative to the parent.
61
+ */
62
+ export type PanelPosition = 's' | 'se' | 'sw' | 'sme' | 'smw' | 'n' | 'ne' | 'nw' | 'nme' | 'nmw';
@@ -11,8 +11,6 @@ import { logWarning } from '@ckeditor/ckeditor5-utils';
11
11
  * The dropdown panel view class.
12
12
  *
13
13
  * See {@link module:ui/dropdown/dropdownview~DropdownView} to learn about the common usage.
14
- *
15
- * @extends module:ui/view~View
16
14
  */
17
15
  export default class DropdownPanelView extends View {
18
16
  /**
@@ -21,34 +19,8 @@ export default class DropdownPanelView extends View {
21
19
  constructor(locale) {
22
20
  super(locale);
23
21
  const bind = this.bindTemplate;
24
- /**
25
- * Controls whether the panel is visible.
26
- *
27
- * @observable
28
- * @member {Boolean} #isVisible
29
- */
30
22
  this.set('isVisible', false);
31
- /**
32
- * The position of the panel, relative to the parent.
33
- *
34
- * This property is reflected in the CSS class set to {@link #element} that controls
35
- * the position of the panel.
36
- *
37
- * @observable
38
- * @default 'se'
39
- * @member {'s'|'se'|'sw'|'sme'|'smw'|'n'|'ne'|'nw'|'nme'|'nmw'} #position
40
- */
41
23
  this.set('position', 'se');
42
- /**
43
- * Collection of the child views in this panel.
44
- *
45
- * A common child type is the {@link module:ui/list/listview~ListView} and {@link module:ui/toolbar/toolbarview~ToolbarView}.
46
- * See {@link module:ui/dropdown/utils~addListToDropdown} and
47
- * {@link module:ui/dropdown/utils~addToolbarToDropdown} to learn more about child views of dropdowns.
48
- *
49
- * @readonly
50
- * @member {module:ui/viewcollection~ViewCollection}
51
- */
52
24
  this.children = this.createCollection();
53
25
  this.setTemplate({
54
26
  tag: 'div',
@@ -93,8 +65,8 @@ export default class DropdownPanelView extends View {
93
65
  * provides the `focus()` method for the best user experience.
94
66
  *
95
67
  * @error ui-dropdown-panel-focus-child-missing-focus
96
- * @param {module:ui/view~View} childView
97
- * @param {module:ui/dropdown/dropdownpanelview~DropdownPanelView} dropdownPanel
68
+ * @param childView
69
+ * @param dropdownPanel
98
70
  */
99
71
  logWarning('ui-dropdown-panel-focus-child-missing-focus', { childView: this.children.first, dropdownPanel: this });
100
72
  }