@ckeditor/ckeditor5-ui 41.2.0 → 41.3.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 (98) hide show
  1. package/dist/content-index.css +4 -0
  2. package/dist/editor-index.css +451 -0
  3. package/dist/index.css +856 -0
  4. package/dist/index.css.map +1 -0
  5. package/dist/index.js +13857 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/types/arialiveannouncer.d.ts +98 -0
  8. package/dist/types/augmentation.d.ts +88 -0
  9. package/dist/types/autocomplete/autocompleteview.d.ts +81 -0
  10. package/dist/types/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
  11. package/dist/types/bindings/clickoutsidehandler.d.ts +28 -0
  12. package/dist/types/bindings/csstransitiondisablermixin.d.ts +40 -0
  13. package/dist/types/bindings/draggableviewmixin.d.ts +46 -0
  14. package/dist/types/bindings/injectcsstransitiondisabler.d.ts +59 -0
  15. package/dist/types/bindings/preventdefault.d.ts +33 -0
  16. package/dist/types/bindings/submithandler.d.ts +57 -0
  17. package/dist/types/button/button.d.ts +175 -0
  18. package/dist/types/button/buttonlabel.d.ts +34 -0
  19. package/dist/types/button/buttonlabelview.d.ts +31 -0
  20. package/dist/types/button/buttonview.d.ts +181 -0
  21. package/dist/types/button/switchbuttonview.d.ts +45 -0
  22. package/dist/types/collapsible/collapsibleview.d.ts +70 -0
  23. package/dist/types/colorgrid/colorgridview.d.ts +132 -0
  24. package/dist/types/colorgrid/colortileview.d.ts +28 -0
  25. package/dist/types/colorgrid/utils.d.ts +47 -0
  26. package/dist/types/colorpicker/colorpickerview.d.ts +142 -0
  27. package/dist/types/colorpicker/utils.d.ts +48 -0
  28. package/dist/types/colorselector/colorgridsfragmentview.d.ts +195 -0
  29. package/dist/types/colorselector/colorpickerfragmentview.d.ts +129 -0
  30. package/dist/types/colorselector/colorselectorview.d.ts +242 -0
  31. package/dist/types/colorselector/documentcolorcollection.d.ts +70 -0
  32. package/dist/types/componentfactory.d.ts +81 -0
  33. package/dist/types/dialog/dialog.d.ts +273 -0
  34. package/dist/types/dialog/dialogactionsview.d.ts +69 -0
  35. package/dist/types/dialog/dialogcontentview.d.ts +27 -0
  36. package/dist/types/dialog/dialogview.d.ts +256 -0
  37. package/dist/types/dropdown/button/dropdownbutton.d.ts +25 -0
  38. package/dist/types/dropdown/button/dropdownbuttonview.d.ts +48 -0
  39. package/dist/types/dropdown/button/splitbuttonview.d.ts +162 -0
  40. package/dist/types/dropdown/dropdownpanelfocusable.d.ts +21 -0
  41. package/dist/types/dropdown/dropdownpanelview.d.ts +62 -0
  42. package/dist/types/dropdown/dropdownview.d.ts +315 -0
  43. package/dist/types/dropdown/utils.d.ts +235 -0
  44. package/dist/types/editableui/editableuiview.d.ts +72 -0
  45. package/dist/types/editableui/inline/inlineeditableuiview.d.ts +40 -0
  46. package/dist/types/editorui/accessibilityhelp/accessibilityhelp.d.ts +47 -0
  47. package/dist/types/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +35 -0
  48. package/dist/types/editorui/bodycollection.d.ts +55 -0
  49. package/dist/types/editorui/boxed/boxededitoruiview.d.ts +40 -0
  50. package/dist/types/editorui/editorui.d.ts +288 -0
  51. package/dist/types/editorui/editoruiview.d.ts +39 -0
  52. package/dist/types/editorui/poweredby.d.ts +71 -0
  53. package/dist/types/focuscycler.d.ts +245 -0
  54. package/dist/types/formheader/formheaderview.d.ts +59 -0
  55. package/dist/types/highlightedtext/highlightedtextview.d.ts +38 -0
  56. package/dist/types/icon/iconview.d.ts +88 -0
  57. package/dist/types/iframe/iframeview.d.ts +50 -0
  58. package/dist/types/index.d.ts +74 -0
  59. package/dist/types/input/inputbase.d.ts +107 -0
  60. package/dist/types/input/inputview.d.ts +36 -0
  61. package/dist/types/inputnumber/inputnumberview.d.ts +49 -0
  62. package/dist/types/inputtext/inputtextview.d.ts +18 -0
  63. package/dist/types/label/labelview.d.ts +36 -0
  64. package/dist/types/labeledfield/labeledfieldview.d.ts +187 -0
  65. package/dist/types/labeledfield/utils.d.ts +123 -0
  66. package/dist/types/labeledinput/labeledinputview.d.ts +125 -0
  67. package/dist/types/list/listitemgroupview.d.ts +59 -0
  68. package/dist/types/list/listitemview.d.ts +36 -0
  69. package/dist/types/list/listseparatorview.d.ts +18 -0
  70. package/dist/types/list/listview.d.ts +124 -0
  71. package/dist/types/model.d.ts +22 -0
  72. package/dist/types/notification/notification.d.ts +211 -0
  73. package/dist/types/panel/balloon/balloonpanelview.d.ts +685 -0
  74. package/dist/types/panel/balloon/contextualballoon.d.ts +299 -0
  75. package/dist/types/panel/sticky/stickypanelview.d.ts +156 -0
  76. package/dist/types/search/filteredview.d.ts +31 -0
  77. package/dist/types/search/searchinfoview.d.ts +45 -0
  78. package/dist/types/search/searchresultsview.d.ts +54 -0
  79. package/dist/types/search/text/searchtextqueryview.d.ts +76 -0
  80. package/dist/types/search/text/searchtextview.d.ts +219 -0
  81. package/dist/types/spinner/spinnerview.d.ts +25 -0
  82. package/dist/types/template.d.ts +942 -0
  83. package/dist/types/textarea/textareaview.d.ts +104 -0
  84. package/dist/types/toolbar/balloon/balloontoolbar.d.ts +117 -0
  85. package/dist/types/toolbar/block/blockbuttonview.d.ts +35 -0
  86. package/dist/types/toolbar/block/blocktoolbar.d.ts +153 -0
  87. package/dist/types/toolbar/normalizetoolbarconfig.d.ts +40 -0
  88. package/dist/types/toolbar/toolbarlinebreakview.d.ts +18 -0
  89. package/dist/types/toolbar/toolbarseparatorview.d.ts +18 -0
  90. package/dist/types/toolbar/toolbarview.d.ts +267 -0
  91. package/dist/types/tooltipmanager.d.ts +184 -0
  92. package/dist/types/view.d.ts +422 -0
  93. package/dist/types/viewcollection.d.ts +139 -0
  94. package/package.json +4 -3
  95. package/src/colorpicker/colorpickerview.js +0 -1
  96. package/src/index.d.ts +2 -2
  97. package/src/index.js +2 -1
  98. package/src/toolbar/toolbarview.js +2 -3
@@ -0,0 +1,47 @@
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/utils
7
+ */
8
+ import type { Locale } from '@ckeditor/ckeditor5-utils';
9
+ export type ColorOption = string | {
10
+ color: string;
11
+ label?: string;
12
+ hasBorder?: boolean;
13
+ };
14
+ export interface NormalizedColorOption {
15
+ model: string;
16
+ label: string;
17
+ hasBorder: boolean;
18
+ view: {
19
+ name: string;
20
+ styles: {
21
+ color: string;
22
+ };
23
+ };
24
+ }
25
+ /**
26
+ * Returns color configuration options as defined in `editor.config.(fontColor|fontBackgroundColor).colors` or
27
+ * `editor.config.table.(tableProperties|tableCellProperties).(background|border).colors
28
+ * but processed to account for editor localization in the correct language.
29
+ *
30
+ * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}
31
+ * when the user configuration is defined because the editor does not exist yet.
32
+ *
33
+ * @param locale The {@link module:core/editor/editor~Editor#locale} instance.
34
+ */
35
+ export declare function getLocalizedColorOptions(locale: Locale, options: Array<NormalizedColorOption>): Array<NormalizedColorOption>;
36
+ /**
37
+ * Creates a unified color definition object from color configuration options.
38
+ * The object contains the information necessary to both render the UI and initialize the conversion.
39
+ */
40
+ export declare function normalizeColorOptions(options: Array<ColorOption>): Array<NormalizedColorOption>;
41
+ /**
42
+ * Creates a normalized color definition from the user-defined configuration.
43
+ * The "normalization" means it will create full
44
+ * {@link module:ui/colorgrid/colorgridview~ColorDefinition `ColorDefinition-like`}
45
+ * object for string values, and add a `view` property, for each definition.
46
+ */
47
+ export declare function normalizeSingleColorDefinition(color: ColorOption): NormalizedColorOption;
@@ -0,0 +1,142 @@
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/colorpicker/colorpickerview
7
+ */
8
+ import { type ColorPickerViewConfig } from './utils.js';
9
+ import { type Locale } from '@ckeditor/ckeditor5-utils';
10
+ import View from '../view.js';
11
+ import type ViewCollection from '../viewcollection.js';
12
+ import { HexBase } from 'vanilla-colorful/lib/entrypoints/hex';
13
+ import '../../theme/components/colorpicker/colorpicker.css';
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ 'hex-color-picker': HexBase;
17
+ }
18
+ }
19
+ /**
20
+ * A class which represents a color picker with an input field for defining custom colors.
21
+ */
22
+ export default class ColorPickerView extends View {
23
+ /**
24
+ * Element with saturation and hue sliders.
25
+ */
26
+ picker: HexBase;
27
+ /**
28
+ * Container for a `#` sign prefix and an input for displaying and defining custom colors
29
+ * in HEX format.
30
+ */
31
+ hexInputRow: ColorPickerInputRowView;
32
+ /**
33
+ * Current color selected in the color picker. It can be set by the component itself
34
+ * (through the palette or input) or from the outside (e.g. to reflect the current selection color).
35
+ */
36
+ color: string;
37
+ /**
38
+ * List of slider views of the color picker.
39
+ */
40
+ slidersView: ViewCollection<SliderView>;
41
+ /**
42
+ * An internal representation of a color.
43
+ *
44
+ * Since the picker uses a hex format, that's how we store it.
45
+ *
46
+ * Since this is unified color format it won't fire a change event if color is changed
47
+ * from `#f00` to `#ff0000` (same value, different format).
48
+ *
49
+ * @observable
50
+ * @private
51
+ */
52
+ _hexColor: string;
53
+ /**
54
+ * Debounced function updating the `color` property in the component
55
+ * and firing the `ColorPickerColorSelectedEvent`. Executed whenever color in component
56
+ * is changed by the user interaction (through the palette or input).
57
+ *
58
+ * @private
59
+ */
60
+ private _debounceColorPickerEvent;
61
+ /**
62
+ * A reference to the configuration of the color picker specified in the constructor.
63
+ *
64
+ * @private
65
+ */
66
+ private _config;
67
+ /**
68
+ * Creates a view of color picker.
69
+ *
70
+ * @param locale
71
+ * @param config
72
+ */
73
+ constructor(locale: Locale | undefined, config?: ColorPickerViewConfig);
74
+ /**
75
+ * Renders color picker in the view.
76
+ */
77
+ render(): void;
78
+ /**
79
+ * Focuses the first pointer in color picker.
80
+ *
81
+ */
82
+ focus(): void;
83
+ /**
84
+ * Creates collection of sliders in color picker.
85
+ *
86
+ * @private
87
+ */
88
+ private _createSlidersView;
89
+ /**
90
+ * Creates input row for defining custom colors in color picker.
91
+ *
92
+ * @private
93
+ */
94
+ private _createInputRow;
95
+ /**
96
+ * Creates the input where user can type or paste the color in hex format.
97
+ *
98
+ * @private
99
+ */
100
+ private _createColorInput;
101
+ }
102
+ declare class SliderView extends View {
103
+ /**
104
+ * @param element HTML element of slider in color picker.
105
+ */
106
+ constructor(element: HTMLElement);
107
+ /**
108
+ * Focuses element.
109
+ */
110
+ focus(): void;
111
+ }
112
+ declare class ColorPickerInputRowView extends View {
113
+ /**
114
+ * A collection of row items (buttons, dropdowns, etc.).
115
+ */
116
+ readonly children: ViewCollection;
117
+ /**
118
+ * Creates an instance of the form row class.
119
+ *
120
+ * @param locale The locale instance.
121
+ */
122
+ constructor(locale: Locale, children?: Array<View>);
123
+ }
124
+ /**
125
+ * An event fired whenever the color was selected through the color picker palette
126
+ * or the color picker input.
127
+ *
128
+ * This even fires only when the user changes the color. It does not fire when the color
129
+ * is changed programmatically, e.g. via
130
+ * {@link module:ui/colorpicker/colorpickerview~ColorPickerView#color}.
131
+ *
132
+ * @eventName ~ColorPickerView#colorSelected
133
+ */
134
+ export type ColorPickerColorSelectedEvent = {
135
+ name: 'colorSelected';
136
+ args: [
137
+ {
138
+ color: string;
139
+ }
140
+ ];
141
+ };
142
+ export {};
@@ -0,0 +1,48 @@
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
+ * Color formats handled by color converter.
7
+ */
8
+ export type ColorPickerOutputFormat = 'hex' | 'rgb' | 'hsl' | 'hwb' | 'lab' | 'lch';
9
+ /**
10
+ * Configuration of the color picker feature.
11
+ *
12
+ * It can be forced to apply colors in the editor in a particular format.
13
+ *
14
+ * @default `{
15
+ * format: 'hsl'
16
+ * }`
17
+ */
18
+ export type ColorPickerConfig = {
19
+ format?: ColorPickerOutputFormat;
20
+ };
21
+ /**
22
+ * Configuration of the color picker view.
23
+ *
24
+ * It can be used to enforce a particular color format or hide the color input.
25
+ */
26
+ export type ColorPickerViewConfig = ColorPickerConfig & {
27
+ hideInput?: boolean;
28
+ };
29
+ /**
30
+ * Parses and converts the color string to requested format. Handles variety of color spaces
31
+ * like `hsl`, `hex` or `rgb`.
32
+ *
33
+ * @param color
34
+ * @returns A color string.
35
+ */
36
+ export declare function convertColor(color: string, outputFormat: ColorPickerOutputFormat): string;
37
+ /**
38
+ * Converts a color string to hex format.
39
+ *
40
+ * @param color
41
+ * @returns A color string.
42
+ */
43
+ export declare function convertToHex(color: string): string;
44
+ /**
45
+ * Registers the custom element in the
46
+ * [CustomElementsRegistry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry).
47
+ */
48
+ export declare function registerCustomElement(elementName: string, constructor: CustomElementConstructor): void;
@@ -0,0 +1,195 @@
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/colorselector/colorgridsfragmentview
7
+ */
8
+ import View from '../view.js';
9
+ import ButtonView from '../button/buttonview.js';
10
+ import ColorGridView, { type ColorDefinition } from '../colorgrid/colorgridview.js';
11
+ import DocumentColorCollection from './documentcolorcollection.js';
12
+ import type { Model } from '@ckeditor/ckeditor5-engine';
13
+ import type { FocusTracker, Locale } from '@ckeditor/ckeditor5-utils';
14
+ import type ViewCollection from '../viewcollection.js';
15
+ import type { FocusableView } from '../focuscycler.js';
16
+ /**
17
+ * One of the fragments of {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.
18
+ *
19
+ * It provides a UI that allows users to select colors from the a predefined set and from existing document colors.
20
+ *
21
+ * It consists of the following sub–components:
22
+ *
23
+ * * A "Remove color" button,
24
+ * * A static {@link module:ui/colorgrid/colorgridview~ColorGridView} of colors defined in the configuration,
25
+ * * A dynamic {@link module:ui/colorgrid/colorgridview~ColorGridView} of colors used in the document.
26
+ * * If color picker is configured, the "Color Picker" button is visible too.
27
+ */
28
+ export default class ColorGridsFragmentView extends View {
29
+ /**
30
+ * A collection of the children of the table.
31
+ */
32
+ readonly items: ViewCollection;
33
+ /**
34
+ * An array with objects representing colors to be displayed in the grid.
35
+ */
36
+ colorDefinitions: Array<ColorDefinition>;
37
+ /**
38
+ * Tracks information about the DOM focus in the list.
39
+ */
40
+ readonly focusTracker: FocusTracker;
41
+ /**
42
+ * The number of columns in the color grid.
43
+ */
44
+ columns: number;
45
+ /**
46
+ * Preserves the reference to {@link module:ui/colorselector/documentcolorcollection~DocumentColorCollection} used to collect
47
+ * definitions that store the document colors.
48
+ *
49
+ * @readonly
50
+ */
51
+ documentColors: DocumentColorCollection;
52
+ /**
53
+ * The maximum number of colors in the document colors section.
54
+ * If it equals 0, the document colors section is not added.
55
+ *
56
+ * @readonly
57
+ */
58
+ documentColorsCount?: number;
59
+ /**
60
+ * Keeps the value of the command associated with the table for the current selection.
61
+ */
62
+ selectedColor: string;
63
+ /**
64
+ * Preserves the reference to {@link module:ui/colorgrid/colorgridview~ColorGridView} used to create
65
+ * the default (static) color set.
66
+ *
67
+ * The property is loaded once the the parent dropdown is opened the first time.
68
+ *
69
+ * @readonly
70
+ */
71
+ staticColorsGrid: ColorGridView | undefined;
72
+ /**
73
+ * Preserves the reference to {@link module:ui/colorgrid/colorgridview~ColorGridView} used to create
74
+ * the document colors. It remains undefined if the document colors feature is disabled.
75
+ *
76
+ * The property is loaded once the the parent dropdown is opened the first time.
77
+ *
78
+ * @readonly
79
+ */
80
+ documentColorsGrid: ColorGridView | undefined;
81
+ /**
82
+ * The "Color picker" button view.
83
+ */
84
+ colorPickerButtonView?: ButtonView;
85
+ /**
86
+ * The "Remove color" button view.
87
+ */
88
+ removeColorButtonView: ButtonView;
89
+ /**
90
+ * The property which is responsible for is component visible or not.
91
+ */
92
+ isVisible: boolean;
93
+ /**
94
+ * A collection of views that can be focused in the view.
95
+ *
96
+ * @readonly
97
+ */
98
+ protected _focusables: ViewCollection<FocusableView>;
99
+ /**
100
+ * Document color section's label.
101
+ *
102
+ * @readonly
103
+ */
104
+ private _documentColorsLabel?;
105
+ /**
106
+ * The label of the button responsible for removing color attributes.
107
+ */
108
+ private _removeButtonLabel;
109
+ /**
110
+ * The label of the button responsible for switching to the color picker component.
111
+ */
112
+ private _colorPickerLabel;
113
+ /**
114
+ * Creates an instance of the view.
115
+ *
116
+ * @param locale The localization services instance.
117
+ * @param colors An array with definitions of colors to be displayed in the table.
118
+ * @param columns The number of columns in the color grid.
119
+ * @param removeButtonLabel The label of the button responsible for removing the color.
120
+ * @param colorPickerLabel The label of the button responsible for color picker appearing.
121
+ * @param documentColorsLabel The label for the section with the document colors.
122
+ * @param documentColorsCount The number of colors in the document colors section inside the color dropdown.
123
+ * @param focusTracker Tracks information about the DOM focus in the list.
124
+ * @param focusables A collection of views that can be focused in the view.
125
+ */
126
+ constructor(locale: Locale, { colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount, colorPickerLabel, focusTracker, focusables }: {
127
+ colors: Array<ColorDefinition>;
128
+ columns: number;
129
+ removeButtonLabel: string;
130
+ colorPickerLabel: string;
131
+ documentColorsLabel?: string;
132
+ documentColorsCount?: number;
133
+ focusTracker: FocusTracker;
134
+ focusables: ViewCollection<FocusableView>;
135
+ });
136
+ /**
137
+ * Scans through the editor model and searches for text node attributes with the given attribute name.
138
+ * Found entries are set as document colors.
139
+ *
140
+ * All the previously stored document colors will be lost in the process.
141
+ *
142
+ * @param model The model used as a source to obtain the document colors.
143
+ * @param attributeName Determines the name of the related model's attribute for a given dropdown.
144
+ */
145
+ updateDocumentColors(model: Model, attributeName: string): void;
146
+ /**
147
+ * Refreshes the state of the selected color in one or both {@link module:ui/colorgrid/colorgridview~ColorGridView}s
148
+ * available in the {@link module:ui/colorselector/colorselectorview~ColorSelectorView}. It guarantees that the selection will
149
+ * occur only in one of them.
150
+ */
151
+ updateSelectedColors(): void;
152
+ /**
153
+ * @inheritDoc
154
+ */
155
+ render(): void;
156
+ /**
157
+ * Focuses the component.
158
+ */
159
+ focus(): void;
160
+ /**
161
+ * @inheritDoc
162
+ */
163
+ destroy(): void;
164
+ /**
165
+ * Handles displaying the color picker button (if it was previously created) and making it focusable.
166
+ */
167
+ addColorPickerButton(): void;
168
+ /**
169
+ * Adds color selector elements to focus tracker.
170
+ */
171
+ private _addColorSelectorElementsToFocusTracker;
172
+ /**
173
+ * Creates the button responsible for displaying the color picker component.
174
+ */
175
+ private _createColorPickerButton;
176
+ /**
177
+ * Adds the remove color button as a child of the current view.
178
+ */
179
+ private _createRemoveColorButton;
180
+ /**
181
+ * Creates a static color grid based on the editor configuration.
182
+ */
183
+ private _createStaticColorsGrid;
184
+ /**
185
+ * Creates the document colors section view and binds it to {@link #documentColors}.
186
+ */
187
+ private _createDocumentColorsGrid;
188
+ /**
189
+ * Adds a given color to the document colors list. If possible, the method will attempt to use
190
+ * data from the {@link #colorDefinitions} (label, color options).
191
+ *
192
+ * @param color A string that stores the value of the recently applied color.
193
+ */
194
+ private _addColorToDocumentColors;
195
+ }
@@ -0,0 +1,129 @@
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/colorselector/colorpickerfragmentview
7
+ */
8
+ import View from '../view.js';
9
+ import ButtonView from '../button/buttonview.js';
10
+ import type ViewCollection from '../viewcollection.js';
11
+ import type { FocusableView } from '../focuscycler.js';
12
+ import { default as ColorPickerView } from '../colorpicker/colorpickerview.js';
13
+ import type { FocusTracker, KeystrokeHandler, Locale } from '@ckeditor/ckeditor5-utils';
14
+ import type { ColorPickerViewConfig } from '../colorpicker/utils.js';
15
+ /**
16
+ * One of the fragments of {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.
17
+ *
18
+ * It allows users to select a color from a color picker.
19
+ *
20
+ * It consists of the following sub–components:
21
+ *
22
+ * * A color picker saturation and hue sliders,
23
+ * * A text input accepting colors in HEX format,
24
+ * * "Save" and "Cancel" action buttons.
25
+ */
26
+ export default class ColorPickerFragmentView extends View {
27
+ /**
28
+ * A collection of component's children.
29
+ */
30
+ readonly items: ViewCollection;
31
+ /**
32
+ * A view with saturation and hue sliders and color input.
33
+ */
34
+ colorPickerView?: ColorPickerView;
35
+ /**
36
+ * The "Save" button view.
37
+ */
38
+ saveButtonView: ButtonView;
39
+ /**
40
+ * The "Cancel" button view.
41
+ */
42
+ cancelButtonView: ButtonView;
43
+ /**
44
+ * The action bar where are "Save" button and "Cancel" button.
45
+ */
46
+ actionBarView: View;
47
+ /**
48
+ * Tracks information about the DOM focus in the list.
49
+ */
50
+ readonly focusTracker: FocusTracker;
51
+ /**
52
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
53
+ */
54
+ readonly keystrokes: KeystrokeHandler;
55
+ /**
56
+ * Indicates whether the component is visible or not.
57
+ */
58
+ isVisible: boolean;
59
+ /**
60
+ * Keeps the value of the command associated with the component for the current selection.
61
+ */
62
+ selectedColor?: string;
63
+ /**
64
+ * A collection of views that can be focused in the view.
65
+ *
66
+ * @readonly
67
+ */
68
+ protected _focusables: ViewCollection<FocusableView>;
69
+ /**
70
+ * A reference to the configuration of {@link #colorPickerView}. `false` when the view was
71
+ * configured without a color picker.
72
+ *
73
+ * @readonly
74
+ */
75
+ private _colorPickerViewConfig;
76
+ /**
77
+ * Creates an instance of the view.
78
+ *
79
+ * @param locale The localization services instance.
80
+ * @param focusTracker Tracks information about the DOM focus in the list.
81
+ * @param focusables A collection of views that can be focused in the view..
82
+ * @param keystrokes An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
83
+ * @param colorPickerViewConfig The configuration of color picker feature. If set to `false`, the color picker
84
+ * will not be rendered.
85
+ */
86
+ constructor(locale: Locale, { focusTracker, focusables, keystrokes, colorPickerViewConfig }: {
87
+ focusTracker: FocusTracker;
88
+ focusables: ViewCollection<FocusableView>;
89
+ keystrokes: KeystrokeHandler;
90
+ colorPickerViewConfig: ColorPickerViewConfig | false;
91
+ });
92
+ /**
93
+ * @inheritDoc
94
+ */
95
+ render(): void;
96
+ /**
97
+ * @inheritDoc
98
+ */
99
+ destroy(): void;
100
+ /**
101
+ * Focuses the color picker.
102
+ */
103
+ focus(): void;
104
+ /**
105
+ * When color picker is focused and "enter" is pressed it executes command.
106
+ */
107
+ private _executeOnEnterPress;
108
+ /**
109
+ * Removes default behavior of arrow keys in dropdown.
110
+ */
111
+ private _stopPropagationOnArrowsKeys;
112
+ /**
113
+ * Adds color picker elements to focus tracker.
114
+ */
115
+ private _addColorPickersElementsToFocusTracker;
116
+ /**
117
+ * Creates bar containing "Save" and "Cancel" buttons.
118
+ */
119
+ private _createActionBarView;
120
+ /**
121
+ * Creates "Save" and "Cancel" buttons.
122
+ */
123
+ private _createActionButtons;
124
+ /**
125
+ * Fires the `execute` event if color in color picker has been changed
126
+ * by the user.
127
+ */
128
+ private _executeUponColorChange;
129
+ }