@ckeditor/ckeditor5-ui 41.2.0 → 41.3.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.
- package/dist/content-index.css +4 -0
- package/dist/editor-index.css +445 -0
- package/dist/index.css +844 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +13857 -0
- package/dist/index.js.map +1 -0
- package/dist/types/arialiveannouncer.d.ts +98 -0
- package/dist/types/augmentation.d.ts +88 -0
- package/dist/types/autocomplete/autocompleteview.d.ts +81 -0
- package/dist/types/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
- package/dist/types/bindings/clickoutsidehandler.d.ts +28 -0
- package/dist/types/bindings/csstransitiondisablermixin.d.ts +40 -0
- package/dist/types/bindings/draggableviewmixin.d.ts +46 -0
- package/dist/types/bindings/injectcsstransitiondisabler.d.ts +59 -0
- package/dist/types/bindings/preventdefault.d.ts +33 -0
- package/dist/types/bindings/submithandler.d.ts +57 -0
- package/dist/types/button/button.d.ts +175 -0
- package/dist/types/button/buttonlabel.d.ts +34 -0
- package/dist/types/button/buttonlabelview.d.ts +31 -0
- package/dist/types/button/buttonview.d.ts +181 -0
- package/dist/types/button/switchbuttonview.d.ts +45 -0
- package/dist/types/collapsible/collapsibleview.d.ts +70 -0
- package/dist/types/colorgrid/colorgridview.d.ts +132 -0
- package/dist/types/colorgrid/colortileview.d.ts +28 -0
- package/dist/types/colorgrid/utils.d.ts +47 -0
- package/dist/types/colorpicker/colorpickerview.d.ts +142 -0
- package/dist/types/colorpicker/utils.d.ts +48 -0
- package/dist/types/colorselector/colorgridsfragmentview.d.ts +195 -0
- package/dist/types/colorselector/colorpickerfragmentview.d.ts +129 -0
- package/dist/types/colorselector/colorselectorview.d.ts +242 -0
- package/dist/types/colorselector/documentcolorcollection.d.ts +70 -0
- package/dist/types/componentfactory.d.ts +81 -0
- package/dist/types/dialog/dialog.d.ts +273 -0
- package/dist/types/dialog/dialogactionsview.d.ts +69 -0
- package/dist/types/dialog/dialogcontentview.d.ts +27 -0
- package/dist/types/dialog/dialogview.d.ts +256 -0
- package/dist/types/dropdown/button/dropdownbutton.d.ts +25 -0
- package/dist/types/dropdown/button/dropdownbuttonview.d.ts +48 -0
- package/dist/types/dropdown/button/splitbuttonview.d.ts +162 -0
- package/dist/types/dropdown/dropdownpanelfocusable.d.ts +21 -0
- package/dist/types/dropdown/dropdownpanelview.d.ts +62 -0
- package/dist/types/dropdown/dropdownview.d.ts +315 -0
- package/dist/types/dropdown/utils.d.ts +235 -0
- package/dist/types/editableui/editableuiview.d.ts +72 -0
- package/dist/types/editableui/inline/inlineeditableuiview.d.ts +40 -0
- package/dist/types/editorui/accessibilityhelp/accessibilityhelp.d.ts +47 -0
- package/dist/types/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +35 -0
- package/dist/types/editorui/bodycollection.d.ts +55 -0
- package/dist/types/editorui/boxed/boxededitoruiview.d.ts +40 -0
- package/dist/types/editorui/editorui.d.ts +288 -0
- package/dist/types/editorui/editoruiview.d.ts +39 -0
- package/dist/types/editorui/poweredby.d.ts +71 -0
- package/dist/types/focuscycler.d.ts +245 -0
- package/dist/types/formheader/formheaderview.d.ts +59 -0
- package/dist/types/highlightedtext/highlightedtextview.d.ts +38 -0
- package/dist/types/icon/iconview.d.ts +88 -0
- package/dist/types/iframe/iframeview.d.ts +50 -0
- package/dist/types/index.d.ts +74 -0
- package/dist/types/input/inputbase.d.ts +107 -0
- package/dist/types/input/inputview.d.ts +36 -0
- package/dist/types/inputnumber/inputnumberview.d.ts +49 -0
- package/dist/types/inputtext/inputtextview.d.ts +18 -0
- package/dist/types/label/labelview.d.ts +36 -0
- package/dist/types/labeledfield/labeledfieldview.d.ts +187 -0
- package/dist/types/labeledfield/utils.d.ts +123 -0
- package/dist/types/labeledinput/labeledinputview.d.ts +125 -0
- package/dist/types/list/listitemgroupview.d.ts +59 -0
- package/dist/types/list/listitemview.d.ts +36 -0
- package/dist/types/list/listseparatorview.d.ts +18 -0
- package/dist/types/list/listview.d.ts +124 -0
- package/dist/types/model.d.ts +22 -0
- package/dist/types/notification/notification.d.ts +211 -0
- package/dist/types/panel/balloon/balloonpanelview.d.ts +685 -0
- package/dist/types/panel/balloon/contextualballoon.d.ts +299 -0
- package/dist/types/panel/sticky/stickypanelview.d.ts +156 -0
- package/dist/types/search/filteredview.d.ts +31 -0
- package/dist/types/search/searchinfoview.d.ts +45 -0
- package/dist/types/search/searchresultsview.d.ts +54 -0
- package/dist/types/search/text/searchtextqueryview.d.ts +76 -0
- package/dist/types/search/text/searchtextview.d.ts +219 -0
- package/dist/types/spinner/spinnerview.d.ts +25 -0
- package/dist/types/template.d.ts +942 -0
- package/dist/types/textarea/textareaview.d.ts +104 -0
- package/dist/types/toolbar/balloon/balloontoolbar.d.ts +117 -0
- package/dist/types/toolbar/block/blockbuttonview.d.ts +35 -0
- package/dist/types/toolbar/block/blocktoolbar.d.ts +153 -0
- package/dist/types/toolbar/normalizetoolbarconfig.d.ts +40 -0
- package/dist/types/toolbar/toolbarlinebreakview.d.ts +18 -0
- package/dist/types/toolbar/toolbarseparatorview.d.ts +18 -0
- package/dist/types/toolbar/toolbarview.d.ts +267 -0
- package/dist/types/tooltipmanager.d.ts +184 -0
- package/dist/types/view.d.ts +422 -0
- package/dist/types/viewcollection.d.ts +139 -0
- package/package.json +4 -3
- package/src/colorpicker/colorpickerview.js +0 -1
- package/src/index.d.ts +2 -2
- package/src/index.js +2 -1
- package/src/toolbar/toolbarview.js +2 -3
- package/theme/globals/globals.css +0 -1
- package/theme/globals/_reset.css +0 -13
|
@@ -0,0 +1,175 @@
|
|
|
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
|
+
* @module ui/button/button
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The button interface. Implemented by, among others, {@link module:ui/button/buttonview~ButtonView},
|
|
10
|
+
* {@link module:ui/dropdown/button/splitbuttonview~SplitButtonView} and
|
|
11
|
+
* {@link module:ui/dropdown/button/dropdownbuttonview~DropdownButtonView}.
|
|
12
|
+
*/
|
|
13
|
+
export default interface Button {
|
|
14
|
+
/**
|
|
15
|
+
* The label of the button view visible to the user when {@link #withText} is `true`.
|
|
16
|
+
* It can also be used to create a {@link #tooltip}.
|
|
17
|
+
*
|
|
18
|
+
* @observable
|
|
19
|
+
*/
|
|
20
|
+
label: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* (Optional) The keystroke associated with the button, i.e. <kbd>CTRL+B</kbd>,
|
|
23
|
+
* in the string format compatible with {@link module:utils/keyboard}.
|
|
24
|
+
*
|
|
25
|
+
* **Note**: Use {@link module:ui/button/button~Button#withKeystroke} if you want to display
|
|
26
|
+
* the keystroke information next to the {@link module:ui/button/button~Button#label label}.
|
|
27
|
+
*
|
|
28
|
+
* @observable
|
|
29
|
+
*/
|
|
30
|
+
keystroke: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* (Optional) Tooltip of the button, i.e. displayed when hovering the button with the mouse cursor.
|
|
33
|
+
*
|
|
34
|
+
* * If defined as a `Boolean` (e.g. `true`), then combination of `label` and `keystroke` will be set as a tooltip.
|
|
35
|
+
* * If defined as a `String`, tooltip will equal the exact text of that `String`.
|
|
36
|
+
* * If defined as a `Function`, `label` and `keystroke` will be passed to that function, which is to return
|
|
37
|
+
* a string with the tooltip text.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* const view = new ButtonView( locale );
|
|
41
|
+
* view.tooltip = ( label, keystroke ) => `A tooltip for ${ label } and ${ keystroke }.`
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @observable
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
tooltip: boolean | string | ((label: string, keystroke: string | undefined) => string);
|
|
48
|
+
/**
|
|
49
|
+
* (Optional) The position of the tooltip. See {@link module:ui/tooltipmanager~TooltipManager}
|
|
50
|
+
* to learn more about the tooltip system.
|
|
51
|
+
*
|
|
52
|
+
* **Note:** It makes sense only when the {@link #tooltip `tooltip` attribute} is defined.
|
|
53
|
+
*
|
|
54
|
+
* @observable
|
|
55
|
+
* @default 's'
|
|
56
|
+
*/
|
|
57
|
+
tooltipPosition: 's' | 'n' | 'e' | 'w' | 'sw' | 'se';
|
|
58
|
+
/**
|
|
59
|
+
* The HTML type of the button.
|
|
60
|
+
*
|
|
61
|
+
* @observable
|
|
62
|
+
* @default 'button'
|
|
63
|
+
*/
|
|
64
|
+
type: 'button' | 'submit' | 'reset' | 'menu';
|
|
65
|
+
/**
|
|
66
|
+
* Controls whether the button view is "on". It makes sense when a feature it represents
|
|
67
|
+
* is currently active, e.g. a bold button is "on" when the selection is in the bold text.
|
|
68
|
+
*
|
|
69
|
+
* To disable the button, use {@link #isEnabled} instead.
|
|
70
|
+
*
|
|
71
|
+
* @observable
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
isOn: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Controls whether the button view is enabled, i.e. it can be clicked and execute an action.
|
|
77
|
+
*
|
|
78
|
+
* To change the "on" state of the button, use {@link #isOn} instead.
|
|
79
|
+
*
|
|
80
|
+
* @observable
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
isEnabled: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Controls whether the button view is visible. Visible by default, buttons are hidden
|
|
86
|
+
* using a CSS class.
|
|
87
|
+
*
|
|
88
|
+
* @observable
|
|
89
|
+
* @default true
|
|
90
|
+
*/
|
|
91
|
+
isVisible: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Controls whether the button view is a toggle button (two–state) for assistive technologies.
|
|
94
|
+
*
|
|
95
|
+
* @observable
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
isToggleable: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* (Optional) Controls whether the label of the button is hidden (e.g. an icon–only button).
|
|
101
|
+
*
|
|
102
|
+
* @observable
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
withText: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* (Optional) Controls whether the keystroke of the button is displayed next to its
|
|
108
|
+
* {@link module:ui/button/button~Button#label label}.
|
|
109
|
+
*
|
|
110
|
+
* **Note**: This property requires a {@link module:ui/button/button~Button#keystroke keystroke}
|
|
111
|
+
* to be defined in the first place.
|
|
112
|
+
*
|
|
113
|
+
* @observable
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
withKeystroke: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* (Optional) An XML {@link module:ui/icon/iconview~IconView#content content} of the icon.
|
|
119
|
+
* When defined, an `iconView` should be added to the button.
|
|
120
|
+
*
|
|
121
|
+
* The user must provide the entire XML string, not just the path. See the
|
|
122
|
+
* {@glink framework/architecture/ui-library#setting-label-icon-and-tooltip UI library} guide for details.
|
|
123
|
+
*
|
|
124
|
+
* @observable
|
|
125
|
+
*/
|
|
126
|
+
icon: string | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* (Optional) Controls the `tabindex` HTML attribute of the button. By default, the button is focusable
|
|
129
|
+
* but does not included in the <kbd>Tab</kbd> order.
|
|
130
|
+
*
|
|
131
|
+
* @observable
|
|
132
|
+
* @default -1
|
|
133
|
+
*/
|
|
134
|
+
tabindex: number;
|
|
135
|
+
/**
|
|
136
|
+
* (Optional) The additional CSS class set on the button.
|
|
137
|
+
*
|
|
138
|
+
* @observable
|
|
139
|
+
*/
|
|
140
|
+
class: string | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* (Optional) The ARIA property reflected by the `aria-label` DOM attribute used by assistive technologies.
|
|
143
|
+
*
|
|
144
|
+
* @observable
|
|
145
|
+
*/
|
|
146
|
+
ariaLabel?: string | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* (Optional) The ARIA property reflected by the `aria-ariaLabelledBy` DOM attribute used by assistive technologies.
|
|
149
|
+
*
|
|
150
|
+
* @observable
|
|
151
|
+
*/
|
|
152
|
+
ariaLabelledBy?: string | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* (Optional) The property reflected by the `role` DOM attribute to be used by assistive technologies.
|
|
155
|
+
*
|
|
156
|
+
* @observable
|
|
157
|
+
*/
|
|
158
|
+
role?: string | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* (Optional) The value of the `style` attribute of the label.
|
|
161
|
+
*
|
|
162
|
+
* @observable
|
|
163
|
+
*/
|
|
164
|
+
labelStyle: string | undefined;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Fired when the button view is clicked. It won't be fired when the button {@link module:ui/button/button~Button#isEnabled}
|
|
168
|
+
* is `false`.
|
|
169
|
+
*
|
|
170
|
+
* @eventName ~Button#execute
|
|
171
|
+
*/
|
|
172
|
+
export type ButtonExecuteEvent = {
|
|
173
|
+
name: 'execute';
|
|
174
|
+
args: [];
|
|
175
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
* @module ui/button/buttonlabel
|
|
7
|
+
*/
|
|
8
|
+
import type View from '../view.js';
|
|
9
|
+
/**
|
|
10
|
+
* The button label interface. Implemented by the {@link module:ui/button/buttonlabelview~ButtonLabelView}
|
|
11
|
+
* and any label view that can be used with the {@link module:ui/button/buttonview~ButtonView}.
|
|
12
|
+
*/
|
|
13
|
+
export default interface ButtonLabel extends View {
|
|
14
|
+
/**
|
|
15
|
+
* The `id` attribute of the button label. It is used for accessibility purposes
|
|
16
|
+
* to describe the button.
|
|
17
|
+
*
|
|
18
|
+
* @observable
|
|
19
|
+
*/
|
|
20
|
+
id: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The `style` attribute of the button label. It allows customizing the presentation
|
|
23
|
+
* of the label.
|
|
24
|
+
*
|
|
25
|
+
* @observable
|
|
26
|
+
*/
|
|
27
|
+
style: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The human-readable text of the label.
|
|
30
|
+
*
|
|
31
|
+
* @observable
|
|
32
|
+
*/
|
|
33
|
+
text: string | undefined;
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
* @module ui/button/buttonlabelview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view.js';
|
|
9
|
+
import type ButtonLabel from './buttonlabel.js';
|
|
10
|
+
/**
|
|
11
|
+
* A default implementation of the button view's label. It comes with a dynamic text support
|
|
12
|
+
* via {@link module:ui/button/buttonlabelview~ButtonLabelView#text} property.
|
|
13
|
+
*/
|
|
14
|
+
export default class ButtonLabelView extends View implements ButtonLabel {
|
|
15
|
+
/**
|
|
16
|
+
* @inheritDoc
|
|
17
|
+
*/
|
|
18
|
+
id: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
style: string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
text: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
constructor();
|
|
31
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
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
|
+
* @module ui/button/buttonview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view.js';
|
|
9
|
+
import IconView from '../icon/iconview.js';
|
|
10
|
+
import type ViewCollection from '../viewcollection.js';
|
|
11
|
+
import type { default as Button } from './button.js';
|
|
12
|
+
import type ButtonLabel from './buttonlabel.js';
|
|
13
|
+
import { type Locale } from '@ckeditor/ckeditor5-utils';
|
|
14
|
+
import '../../theme/components/button/button.css';
|
|
15
|
+
/**
|
|
16
|
+
* The button view class.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* const view = new ButtonView();
|
|
20
|
+
*
|
|
21
|
+
* view.set( {
|
|
22
|
+
* label: 'A button',
|
|
23
|
+
* keystroke: 'Ctrl+B',
|
|
24
|
+
* tooltip: true,
|
|
25
|
+
* withText: true
|
|
26
|
+
* } );
|
|
27
|
+
*
|
|
28
|
+
* view.render();
|
|
29
|
+
*
|
|
30
|
+
* document.body.append( view.element );
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export default class ButtonView extends View<HTMLButtonElement> implements Button {
|
|
34
|
+
/**
|
|
35
|
+
* Collection of the child views inside of the button {@link #element}.
|
|
36
|
+
*/
|
|
37
|
+
readonly children: ViewCollection;
|
|
38
|
+
/**
|
|
39
|
+
* Label of the button view. Its text is configurable using the {@link #label label attribute}.
|
|
40
|
+
*
|
|
41
|
+
* If not configured otherwise in the `constructor()`, by default the label is an instance
|
|
42
|
+
* of {@link module:ui/button/buttonlabelview~ButtonLabelView}.
|
|
43
|
+
*/
|
|
44
|
+
readonly labelView: ButtonLabel;
|
|
45
|
+
/**
|
|
46
|
+
* The icon view of the button. Will be added to {@link #children} when the
|
|
47
|
+
* {@link #icon icon attribute} is defined.
|
|
48
|
+
*/
|
|
49
|
+
readonly iconView: IconView;
|
|
50
|
+
/**
|
|
51
|
+
* A view displaying the keystroke of the button next to the {@link #labelView label}.
|
|
52
|
+
* Added to {@link #children} when the {@link #withKeystroke `withKeystroke` attribute}
|
|
53
|
+
* is defined.
|
|
54
|
+
*/
|
|
55
|
+
readonly keystrokeView: View;
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
class: string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* @inheritDoc
|
|
62
|
+
*/
|
|
63
|
+
labelStyle: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
icon: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* @inheritDoc
|
|
70
|
+
*/
|
|
71
|
+
isEnabled: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* @inheritDoc
|
|
74
|
+
*/
|
|
75
|
+
isOn: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* @inheritDoc
|
|
78
|
+
*/
|
|
79
|
+
isVisible: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* @inheritDoc
|
|
82
|
+
*/
|
|
83
|
+
isToggleable: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* @inheritDoc
|
|
86
|
+
*/
|
|
87
|
+
keystroke: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* @inheritDoc
|
|
90
|
+
*/
|
|
91
|
+
label: string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* @inheritDoc
|
|
94
|
+
*/
|
|
95
|
+
tabindex: number;
|
|
96
|
+
/**
|
|
97
|
+
* @inheritDoc
|
|
98
|
+
*/
|
|
99
|
+
tooltip: Button['tooltip'];
|
|
100
|
+
/**
|
|
101
|
+
* @inheritDoc
|
|
102
|
+
*/
|
|
103
|
+
tooltipPosition: Button['tooltipPosition'];
|
|
104
|
+
/**
|
|
105
|
+
* @inheritDoc
|
|
106
|
+
*/
|
|
107
|
+
type: Button['type'];
|
|
108
|
+
/**
|
|
109
|
+
* @inheritDoc
|
|
110
|
+
*/
|
|
111
|
+
withText: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* @inheritDoc
|
|
114
|
+
*/
|
|
115
|
+
withKeystroke: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* @inheritDoc
|
|
118
|
+
*/
|
|
119
|
+
role: string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* @inheritDoc
|
|
122
|
+
*/
|
|
123
|
+
ariaLabel?: string | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* @inheritDoc
|
|
126
|
+
*/
|
|
127
|
+
ariaLabelledBy: string | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Tooltip of the button bound to the template.
|
|
130
|
+
*
|
|
131
|
+
* @see #tooltip
|
|
132
|
+
* @see module:ui/button/buttonview~ButtonView#_getTooltipString
|
|
133
|
+
* @internal
|
|
134
|
+
* @observable
|
|
135
|
+
*/
|
|
136
|
+
_tooltipString: string;
|
|
137
|
+
/**
|
|
138
|
+
* Delayed focus function for focus handling in Safari.
|
|
139
|
+
*/
|
|
140
|
+
private _focusDelayed;
|
|
141
|
+
/**
|
|
142
|
+
* Creates an instance of the button view class.
|
|
143
|
+
*
|
|
144
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
145
|
+
* @param labelView The instance of the button's label. If not provided, an instance of
|
|
146
|
+
* {@link module:ui/button/buttonlabelview~ButtonLabelView} is used.
|
|
147
|
+
*/
|
|
148
|
+
constructor(locale?: Locale, labelView?: ButtonLabel);
|
|
149
|
+
/**
|
|
150
|
+
* @inheritDoc
|
|
151
|
+
*/
|
|
152
|
+
render(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Focuses the {@link #element} of the button.
|
|
155
|
+
*/
|
|
156
|
+
focus(): void;
|
|
157
|
+
/**
|
|
158
|
+
* @inheritDoc
|
|
159
|
+
*/
|
|
160
|
+
destroy(): void;
|
|
161
|
+
/**
|
|
162
|
+
* Binds the label view instance it with button attributes.
|
|
163
|
+
*/
|
|
164
|
+
private _setupLabelView;
|
|
165
|
+
/**
|
|
166
|
+
* Creates a view that displays a keystroke next to a {@link #labelView label }
|
|
167
|
+
* and binds it with button attributes.
|
|
168
|
+
*/
|
|
169
|
+
private _createKeystrokeView;
|
|
170
|
+
/**
|
|
171
|
+
* Gets the text for the tooltip from the combination of
|
|
172
|
+
* {@link #tooltip}, {@link #label} and {@link #keystroke} attributes.
|
|
173
|
+
*
|
|
174
|
+
* @see #tooltip
|
|
175
|
+
* @see #_tooltipString
|
|
176
|
+
* @param tooltip Button tooltip.
|
|
177
|
+
* @param label Button label.
|
|
178
|
+
* @param keystroke Button keystroke.
|
|
179
|
+
*/
|
|
180
|
+
private _getTooltipString;
|
|
181
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
* @module ui/button/switchbuttonview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view.js';
|
|
9
|
+
import ButtonView from './buttonview.js';
|
|
10
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
11
|
+
import '../../theme/components/button/switchbutton.css';
|
|
12
|
+
/**
|
|
13
|
+
* The switch button view class.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const view = new SwitchButtonView();
|
|
17
|
+
*
|
|
18
|
+
* view.set( {
|
|
19
|
+
* withText: true,
|
|
20
|
+
* label: 'Switch me!'
|
|
21
|
+
* } );
|
|
22
|
+
*
|
|
23
|
+
* view.render();
|
|
24
|
+
*
|
|
25
|
+
* document.body.append( view.element );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export default class SwitchButtonView extends ButtonView {
|
|
29
|
+
/**
|
|
30
|
+
* The toggle switch of the button.
|
|
31
|
+
*/
|
|
32
|
+
readonly toggleSwitchView: View;
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
constructor(locale?: Locale);
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
render(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a toggle child view.
|
|
43
|
+
*/
|
|
44
|
+
private _createToggleView;
|
|
45
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
* @module ui/collapsible/collapsibleview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
import View from '../view.js';
|
|
10
|
+
import ButtonView from '../button/buttonview.js';
|
|
11
|
+
import type ViewCollection from '../viewcollection.js';
|
|
12
|
+
import type { FocusableView } from '../focuscycler.js';
|
|
13
|
+
import '../../theme/components/collapsible/collapsible.css';
|
|
14
|
+
/**
|
|
15
|
+
* A collapsible UI component. Consists of a labeled button and a container which can be collapsed
|
|
16
|
+
* by clicking the button. The collapsible container can be a host to other UI views.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export default class CollapsibleView extends View {
|
|
21
|
+
/**
|
|
22
|
+
* `true` when the container with {@link #children} is collapsed. `false` otherwise.
|
|
23
|
+
*
|
|
24
|
+
* @observable
|
|
25
|
+
*/
|
|
26
|
+
isCollapsed: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The text label of the {@link #buttonView}.
|
|
29
|
+
*
|
|
30
|
+
* @observable
|
|
31
|
+
* @default 'Show more'
|
|
32
|
+
*/
|
|
33
|
+
label: string;
|
|
34
|
+
/**
|
|
35
|
+
* The ID of the label inside the {@link #buttonView} that describes the collapsible
|
|
36
|
+
* container for assistive technologies. Set after the button was {@link #render rendered}.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
* @readonly
|
|
40
|
+
* @observable
|
|
41
|
+
*/
|
|
42
|
+
_collapsibleAriaLabelUid: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The main button that, when clicked, collapses or expands the container with {@link #children}.
|
|
45
|
+
*/
|
|
46
|
+
readonly buttonView: ButtonView;
|
|
47
|
+
/**
|
|
48
|
+
* A collection of the child views that can be collapsed by clicking the {@link #buttonView}.
|
|
49
|
+
*/
|
|
50
|
+
readonly children: ViewCollection<FocusableView>;
|
|
51
|
+
/**
|
|
52
|
+
* Creates an instance of the collapsible view.
|
|
53
|
+
*
|
|
54
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
55
|
+
* @param childViews An optional array of initial child views to be inserted into the collapsible.
|
|
56
|
+
*/
|
|
57
|
+
constructor(locale: Locale, childViews?: Array<FocusableView>);
|
|
58
|
+
/**
|
|
59
|
+
* @inheritDoc
|
|
60
|
+
*/
|
|
61
|
+
render(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Focuses the first focusable.
|
|
64
|
+
*/
|
|
65
|
+
focus(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Creates the main {@link #buttonView} of the collapsible.
|
|
68
|
+
*/
|
|
69
|
+
private _createButtonView;
|
|
70
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
* @module ui/colorgrid/colorgridview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view.js';
|
|
9
|
+
import ColorTileView from './colortileview.js';
|
|
10
|
+
import type DropdownPanelFocusable from '../dropdown/dropdownpanelfocusable.js';
|
|
11
|
+
import type ViewCollection from '../viewcollection.js';
|
|
12
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from '@ckeditor/ckeditor5-utils';
|
|
13
|
+
import '../../theme/components/colorgrid/colorgrid.css';
|
|
14
|
+
/**
|
|
15
|
+
* A grid of {@link module:ui/colorgrid/colortileview~ColorTileView color tiles}.
|
|
16
|
+
*/
|
|
17
|
+
export default class ColorGridView extends View implements DropdownPanelFocusable {
|
|
18
|
+
/**
|
|
19
|
+
* A number of columns for the tiles grid.
|
|
20
|
+
*/
|
|
21
|
+
readonly columns: number;
|
|
22
|
+
/**
|
|
23
|
+
* Collection of the child tile views.
|
|
24
|
+
*/
|
|
25
|
+
readonly items: ViewCollection<ColorTileView>;
|
|
26
|
+
/**
|
|
27
|
+
* Tracks information about DOM focus in the grid.
|
|
28
|
+
*/
|
|
29
|
+
readonly focusTracker: FocusTracker;
|
|
30
|
+
/**
|
|
31
|
+
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
32
|
+
*/
|
|
33
|
+
readonly keystrokes: KeystrokeHandler;
|
|
34
|
+
/**
|
|
35
|
+
* The color of the currently selected color tile in {@link #items}.
|
|
36
|
+
*
|
|
37
|
+
* @observable
|
|
38
|
+
*/
|
|
39
|
+
selectedColor: string | undefined | null;
|
|
40
|
+
/**
|
|
41
|
+
* Creates an instance of a color grid containing {@link module:ui/colorgrid/colortileview~ColorTileView tiles}.
|
|
42
|
+
*
|
|
43
|
+
* @fires execute
|
|
44
|
+
* @param locale The localization services instance.
|
|
45
|
+
* @param options Component configuration
|
|
46
|
+
* @param options.colorDefinitions Array with definitions
|
|
47
|
+
* required to create the {@link module:ui/colorgrid/colortileview~ColorTileView tiles}.
|
|
48
|
+
* @param options.columns A number of columns to display the tiles.
|
|
49
|
+
*/
|
|
50
|
+
constructor(locale?: Locale, options?: {
|
|
51
|
+
colorDefinitions?: Array<ColorDefinition>;
|
|
52
|
+
columns?: number;
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Focuses the first focusable in {@link #items}.
|
|
56
|
+
*/
|
|
57
|
+
focus(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Focuses the last focusable in {@link #items}.
|
|
60
|
+
*/
|
|
61
|
+
focusLast(): void;
|
|
62
|
+
/**
|
|
63
|
+
* @inheritDoc
|
|
64
|
+
*/
|
|
65
|
+
render(): void;
|
|
66
|
+
/**
|
|
67
|
+
* @inheritDoc
|
|
68
|
+
*/
|
|
69
|
+
destroy(): void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A color definition used to create a {@link module:ui/colorgrid/colortileview~ColorTileView}.
|
|
73
|
+
*
|
|
74
|
+
* ```json
|
|
75
|
+
* {
|
|
76
|
+
* color: 'hsl(0, 0%, 75%)',
|
|
77
|
+
* label: 'Light Grey',
|
|
78
|
+
* options: {
|
|
79
|
+
* hasBorder: true
|
|
80
|
+
* }
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export interface ColorDefinition {
|
|
85
|
+
/**
|
|
86
|
+
* String representing a color.
|
|
87
|
+
* It is used as value of background-color style in {@link module:ui/colorgrid/colortileview~ColorTileView}.
|
|
88
|
+
*/
|
|
89
|
+
color: string;
|
|
90
|
+
/**
|
|
91
|
+
* String used as label for {@link module:ui/colorgrid/colortileview~ColorTileView}.
|
|
92
|
+
*/
|
|
93
|
+
label: string;
|
|
94
|
+
/**
|
|
95
|
+
* Additional options passed to create a {@link module:ui/colorgrid/colortileview~ColorTileView}.
|
|
96
|
+
*/
|
|
97
|
+
options: {
|
|
98
|
+
/**
|
|
99
|
+
* A flag that indicates if special a CSS class should be added
|
|
100
|
+
* to {@link module:ui/colorgrid/colortileview~ColorTileView}, which renders a border around it.
|
|
101
|
+
*/
|
|
102
|
+
hasBorder: boolean;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Fired when the `ColorTileView` for the picked item is executed.
|
|
107
|
+
*
|
|
108
|
+
* @eventName ~ColorGridView#execute
|
|
109
|
+
* @param data Additional information about the event.
|
|
110
|
+
*/
|
|
111
|
+
export type ColorGridViewExecuteEvent = {
|
|
112
|
+
name: 'execute';
|
|
113
|
+
args: [data: ColorGridViewExecuteEventData];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The data of {@link ~ColorGridViewExecuteEvent execute event}.
|
|
117
|
+
*/
|
|
118
|
+
export interface ColorGridViewExecuteEventData {
|
|
119
|
+
/**
|
|
120
|
+
* The value of the selected color ({@link module:ui/colorgrid/colorgridview~ColorDefinition#color `color.color`}).
|
|
121
|
+
*/
|
|
122
|
+
value: string;
|
|
123
|
+
/**
|
|
124
|
+
* The `hasBorder` property of the selected color
|
|
125
|
+
* ({@link module:ui/colorgrid/colorgridview~ColorDefinition#options `color.options.hasBorder`}).
|
|
126
|
+
*/
|
|
127
|
+
hasBorder: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* The label of the selected color ({@link module:ui/colorgrid/colorgridview~ColorDefinition#label `color.label`})
|
|
130
|
+
*/
|
|
131
|
+
label: string;
|
|
132
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
* @module ui/colorgrid/colortileview
|
|
7
|
+
*/
|
|
8
|
+
import ButtonView from '../button/buttonview.js';
|
|
9
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
/**
|
|
11
|
+
* This class represents a single color tile in the {@link module:ui/colorgrid/colorgridview~ColorGridView}.
|
|
12
|
+
*/
|
|
13
|
+
export default class ColorTileView extends ButtonView {
|
|
14
|
+
/**
|
|
15
|
+
* String representing a color shown as tile's background.
|
|
16
|
+
*/
|
|
17
|
+
color: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* A flag that toggles a special CSS class responsible for displaying
|
|
20
|
+
* a border around the button.
|
|
21
|
+
*/
|
|
22
|
+
hasBorder: boolean;
|
|
23
|
+
constructor(locale?: Locale);
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
render(): void;
|
|
28
|
+
}
|