@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.
Files changed (100) hide show
  1. package/dist/content-index.css +4 -0
  2. package/dist/editor-index.css +445 -0
  3. package/dist/index.css +844 -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
  99. package/theme/globals/globals.css +0 -1
  100. package/theme/globals/_reset.css +0 -13
@@ -0,0 +1,98 @@
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/arialiveannouncer
7
+ */
8
+ import type { Editor } from '@ckeditor/ckeditor5-core';
9
+ import type { Locale } from '@ckeditor/ckeditor5-utils';
10
+ import type ViewCollection from './viewcollection.js';
11
+ import View from './view.js';
12
+ import '../theme/components/arialiveannouncer/arialiveannouncer.css';
13
+ /**
14
+ * The politeness level of an `aria-live` announcement.
15
+ *
16
+ * Available keys are:
17
+ * * `AriaLiveAnnouncerPoliteness.POLITE`,
18
+ * * `AriaLiveAnnouncerPoliteness.ASSERTIVE`
19
+ *
20
+ * [Learn more](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Politeness_levels).
21
+ */
22
+ export declare const AriaLiveAnnouncerPoliteness: {
23
+ readonly POLITE: "polite";
24
+ readonly ASSERTIVE: "assertive";
25
+ };
26
+ /**
27
+ * An accessibility helper that manages all ARIA live regions associated with an editor instance. ARIA live regions announce changes
28
+ * to the state of the editor features.
29
+ *
30
+ * These announcements are consumed and propagated by screen readers and give users a better understanding of the current
31
+ * state of the editor.
32
+ *
33
+ * To announce a state change to an editor feature named `'Some feature'`, use the {@link #announce} method:
34
+ * ```ts
35
+ * editor.ui.ariaLiveAnnouncer.announce( 'Some feature', 'Text of an announcement.' );
36
+ * ```
37
+ */
38
+ export default class AriaLiveAnnouncer {
39
+ /**
40
+ * The editor instance.
41
+ */
42
+ readonly editor: Editor;
43
+ /**
44
+ * The view that aggregates all `aria-live` regions.
45
+ */
46
+ view?: AriaLiveAnnouncerView;
47
+ /**
48
+ * @inheritDoc
49
+ */
50
+ constructor(editor: Editor);
51
+ /**
52
+ * Sets an announcement text to an aria region associated with a specific editor feature. The text is then
53
+ * announced by a screen reader to the user.
54
+ *
55
+ * If the aria region of a given name does not exist, it will be created and can be re-used later. The name of the region
56
+ * groups announcements originating from a specific editor feature and does not get announced by a screen reader.
57
+ *
58
+ * Using multiple regions allows for many announcements to be emitted in a short period of time. Changes to ARIA-live announcements
59
+ * are captured by a screen reader and read out in the order they were emitted.
60
+ *
61
+ * The default announcement politeness level is `'polite'`.
62
+ *
63
+ * ```ts
64
+ * // Most screen readers will queue announcements from multiple aria-live regions and read them out in the order they were emitted.
65
+ * editor.ui.ariaLiveAnnouncer.announce( 'image', 'Image uploaded.' );
66
+ * editor.ui.ariaLiveAnnouncer.announce( 'network', 'Connection lost. Reconnecting.' );
67
+ * ```
68
+ */
69
+ announce(regionName: string, announcementText: string, politeness?: typeof AriaLiveAnnouncerPoliteness[keyof typeof AriaLiveAnnouncerPoliteness]): void;
70
+ }
71
+ /**
72
+ * The view that aggregates all `aria-live` regions.
73
+ */
74
+ export declare class AriaLiveAnnouncerView extends View {
75
+ /**
76
+ * A collection of all views that represent individual `aria-live` regions.
77
+ */
78
+ readonly regionViews: ViewCollection<AriaLiveAnnouncerRegionView>;
79
+ constructor(locale: Locale);
80
+ }
81
+ /**
82
+ * The view that represents a single `aria-live` region (e.g. for a specific editor feature) and its text.
83
+ */
84
+ export declare class AriaLiveAnnouncerRegionView extends View {
85
+ /**
86
+ * Current text of the region.
87
+ */
88
+ text: string;
89
+ /**
90
+ * Current politeness level of the region.
91
+ */
92
+ politeness: typeof AriaLiveAnnouncerPoliteness[keyof typeof AriaLiveAnnouncerPoliteness];
93
+ /**
94
+ * A unique name of the region, usually associated with a specific editor feature or system.
95
+ */
96
+ regionName: string;
97
+ constructor(locale: Locale);
98
+ }
@@ -0,0 +1,88 @@
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
+ import type { BalloonToolbar, BlockToolbar, ContextualBalloon, Notification, Dialog, AccessibilityHelp } from './index.js';
6
+ import type { ToolbarConfig } from '@ckeditor/ckeditor5-core';
7
+ declare module '@ckeditor/ckeditor5-core' {
8
+ interface EditorConfig {
9
+ /**
10
+ * Contextual toolbar configuration. Used by the {@link module:ui/toolbar/balloon/balloontoolbar~BalloonToolbar}
11
+ * feature.
12
+ *
13
+ * ## Configuring toolbar items
14
+ *
15
+ * ```ts
16
+ * const config = {
17
+ * balloonToolbar: [ 'bold', 'italic', 'undo', 'redo' ]
18
+ * };
19
+ * ```
20
+ *
21
+ * You can also use `'|'` to create a separator between groups of items:
22
+ *
23
+ * ```ts
24
+ * const config = {
25
+ * balloonToolbar: [ 'bold', 'italic', '|', 'undo', 'redo' ]
26
+ * };
27
+ * ```
28
+ *
29
+ * Read also about configuring the main editor toolbar in {@link module:core/editor/editorconfig~EditorConfig#toolbar}.
30
+ *
31
+ * ## Configuring items grouping
32
+ *
33
+ * You can prevent automatic items grouping by setting the `shouldNotGroupWhenFull` option:
34
+ *
35
+ * ```ts
36
+ * const config = {
37
+ * balloonToolbar: {
38
+ * items: [ 'bold', 'italic', 'undo', 'redo' ],
39
+ * shouldNotGroupWhenFull: true
40
+ * },
41
+ * };
42
+ * ```
43
+ */
44
+ balloonToolbar?: ToolbarConfig;
45
+ /**
46
+ * The block toolbar configuration. Used by the {@link module:ui/toolbar/block/blocktoolbar~BlockToolbar}
47
+ * feature.
48
+ *
49
+ * ```ts
50
+ * const config = {
51
+ * blockToolbar: [ 'paragraph', 'heading1', 'heading2', 'bulletedList', 'numberedList' ]
52
+ * };
53
+ * ```
54
+ *
55
+ * You can also use `'|'` to create a separator between groups of items:
56
+ *
57
+ * ```ts
58
+ * const config = {
59
+ * blockToolbar: [ 'paragraph', 'heading1', 'heading2', '|', 'bulletedList', 'numberedList' ]
60
+ * };
61
+ * ```
62
+ *
63
+ * ## Configuring items grouping
64
+ *
65
+ * You can prevent automatic items grouping by setting the `shouldNotGroupWhenFull` option:
66
+ *
67
+ * ```ts
68
+ * const config = {
69
+ * blockToolbar: {
70
+ * items: [ 'paragraph', 'heading1', 'heading2', '|', 'bulletedList', 'numberedList' ],
71
+ * shouldNotGroupWhenFull: true
72
+ * },
73
+ * };
74
+ * ```
75
+ *
76
+ * Read more about configuring the main editor toolbar in {@link module:core/editor/editorconfig~EditorConfig#toolbar}.
77
+ */
78
+ blockToolbar?: ToolbarConfig;
79
+ }
80
+ interface PluginsMap {
81
+ [BalloonToolbar.pluginName]: BalloonToolbar;
82
+ [BlockToolbar.pluginName]: BlockToolbar;
83
+ [ContextualBalloon.pluginName]: ContextualBalloon;
84
+ [Dialog.pluginName]: Dialog;
85
+ [Notification.pluginName]: Notification;
86
+ [AccessibilityHelp.pluginName]: AccessibilityHelp;
87
+ }
88
+ }
@@ -0,0 +1,81 @@
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/autocomplete/autocompleteview
7
+ */
8
+ import { type PositioningFunction, type Locale } from '@ckeditor/ckeditor5-utils';
9
+ import SearchTextView, { type SearchTextViewConfig } from '../search/text/searchtextview.js';
10
+ import type SearchResultsView from '../search/searchresultsview.js';
11
+ import type InputBase from '../input/inputbase.js';
12
+ import '../../theme/components/autocomplete/autocomplete.css';
13
+ /**
14
+ * The autocomplete component's view class. It extends the {@link module:ui/search/text/searchtextview~SearchTextView} class
15
+ * with a floating {@link #resultsView} that shows up when the user starts typing and hides when they blur
16
+ * the component.
17
+ */
18
+ export default class AutocompleteView<TQueryFieldView extends InputBase<HTMLInputElement | HTMLTextAreaElement>> extends SearchTextView<TQueryFieldView> {
19
+ /**
20
+ * The configuration of the autocomplete view.
21
+ */
22
+ protected _config: AutocompleteViewConfig<TQueryFieldView>;
23
+ resultsView: AutocompleteResultsView;
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ constructor(locale: Locale, config: AutocompleteViewConfig<TQueryFieldView>);
28
+ /**
29
+ * Updates the position of the results view on demand.
30
+ */
31
+ private _updateResultsViewWidthAndPosition;
32
+ /**
33
+ * Updates the visibility of the results view on demand.
34
+ */
35
+ private _updateResultsVisibility;
36
+ /**
37
+ * Positions for the autocomplete results view. Two positions are defined by default:
38
+ * * `s` - below the search field,
39
+ * * `n` - above the search field.
40
+ */
41
+ static defaultResultsPositions: Array<PositioningFunction>;
42
+ /**
43
+ * A function used to calculate the optimal position for the dropdown panel.
44
+ */
45
+ private static _getOptimalPosition;
46
+ }
47
+ /**
48
+ * An interface describing additional properties of the floating search results view used by the autocomplete plugin.
49
+ */
50
+ export interface AutocompleteResultsView extends SearchResultsView {
51
+ /**
52
+ * Controls the visibility of the results view.
53
+ *
54
+ * @observable
55
+ */
56
+ isVisible: boolean;
57
+ /**
58
+ * Controls the position (CSS class suffix) of the results view.
59
+ *
60
+ * @internal
61
+ */
62
+ _position?: string;
63
+ /**
64
+ * The observable property determining the CSS width of the results view.
65
+ *
66
+ * @internal
67
+ */
68
+ _width: number;
69
+ }
70
+ export interface AutocompleteViewConfig<TConfigInputCreator extends InputBase<HTMLInputElement | HTMLTextAreaElement>> extends SearchTextViewConfig<TConfigInputCreator> {
71
+ /**
72
+ * When set `true`, the query view will be reset when the autocomplete view loses focus.
73
+ */
74
+ resetOnBlur?: boolean;
75
+ /**
76
+ * Minimum number of characters that need to be typed before the search is performed.
77
+ *
78
+ * @default 0
79
+ */
80
+ queryMinChars?: number;
81
+ }
@@ -0,0 +1,27 @@
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/bindings/addkeyboardhandlingforgrid
7
+ */
8
+ import type { FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils';
9
+ import type ViewCollection from '../viewcollection.js';
10
+ /**
11
+ * A helper that adds a keyboard navigation support (arrow up/down/left/right) for grids.
12
+ *
13
+ * @param options Configuration options.
14
+ * @param options.keystrokeHandler Keystroke handler to register navigation with arrow keys.
15
+ * @param options.focusTracker A focus tracker for grid elements.
16
+ * @param options.gridItems A collection of grid items.
17
+ * @param options.numberOfColumns Number of columns in the grid. Can be specified as a function that returns
18
+ * the number (e.g. for responsive grids).
19
+ * @param options.uiLanguageDirection String of ui language direction.
20
+ */
21
+ export default function addKeyboardHandlingForGrid({ keystrokeHandler, focusTracker, gridItems, numberOfColumns, uiLanguageDirection }: {
22
+ keystrokeHandler: KeystrokeHandler;
23
+ focusTracker: FocusTracker;
24
+ gridItems: ViewCollection;
25
+ numberOfColumns: number | (() => number);
26
+ uiLanguageDirection?: string;
27
+ }): void;
@@ -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/bindings/clickoutsidehandler
7
+ */
8
+ import type { DomEmitter } from '@ckeditor/ckeditor5-utils';
9
+ /**
10
+ * Handles clicking **outside** of a specified set of elements, then fires an action.
11
+ *
12
+ * **Note**: Actually, the action is executed upon `mousedown`, not `click`. It prevents
13
+ * certain issues when the user keeps holding the mouse button and the UI cannot react
14
+ * properly.
15
+ *
16
+ * @param options Configuration options.
17
+ * @param options.emitter The emitter to which this behavior should be added.
18
+ * @param options.activator Function returning a `Boolean`, to determine whether the handler is active.
19
+ * @param options.contextElements Array of HTML elements or a callback returning an array of HTML elements
20
+ * that determine the scope of the handler. Clicking any of them or their descendants will **not** fire the callback.
21
+ * @param options.callback An action executed by the handler.
22
+ */
23
+ export default function clickOutsideHandler({ emitter, activator, callback, contextElements }: {
24
+ emitter: DomEmitter;
25
+ activator: () => boolean;
26
+ contextElements: Array<HTMLElement> | (() => Array<HTMLElement>);
27
+ callback: () => void;
28
+ }): void;
@@ -0,0 +1,40 @@
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/bindings/csstransitiondisablermixin
7
+ */
8
+ import type { Constructor, Mixed } from '@ckeditor/ckeditor5-utils';
9
+ import type View from '../view.js';
10
+ /**
11
+ * A mixin that brings the possibility to temporarily disable CSS transitions using
12
+ * {@link module:ui/view~View} methods. It is helpful when, for instance, the transitions should not happen
13
+ * when the view is first displayed but they should work normal in other cases.
14
+ *
15
+ * The methods to control the CSS transitions are:
16
+ * * `disableCssTransitions()` – Adds the `.ck-transitions-disabled` class to the
17
+ * {@link module:ui/view~View#element view element}.
18
+ * * `enableCssTransitions()` – Removes the `.ck-transitions-disabled` class from the
19
+ * {@link module:ui/view~View#element view element}.
20
+ *
21
+ * The usage comes down to:
22
+ *
23
+ * ```ts
24
+ * const MyViewWithCssTransitionDisabler = CssTransitionDisablerMixin( MyView );
25
+ * const view = new MyViewWithCssTransitionDisabler();
26
+ *
27
+ * // ...
28
+ *
29
+ * view.disableCssTransitions();
30
+ * view.show();
31
+ * view.enableCssTransitions();
32
+ * ```
33
+ *
34
+ * @param view View instance that should get this functionality.
35
+ */
36
+ export default function CssTransitionDisablerMixin<Base extends Constructor<View>>(view: Base): Mixed<Base, ViewWithCssTransitionDisabler>;
37
+ export type ViewWithCssTransitionDisabler = View & {
38
+ disableCssTransitions(): void;
39
+ enableCssTransitions(): void;
40
+ };
@@ -0,0 +1,46 @@
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/bindings/draggableviewmixin
7
+ */
8
+ import type View from '../view.js';
9
+ import { type Constructor, type Mixed } from '@ckeditor/ckeditor5-utils';
10
+ /**
11
+ * A mixin that brings the possibility to observe dragging of the view element.
12
+ * The view has to implement the {@link ~DraggableView} interface to use it:
13
+ *
14
+ * ```js
15
+ * export default class MyDraggableView extends DraggableViewMixin( View ) implements DraggableView {
16
+ * // ...
17
+ * }
18
+ * ```
19
+ *
20
+ * Creating a class extending it attaches a set of mouse and touch listeners allowing to observe dragging of the view element:
21
+ * * `mousedown` and `touchstart` on the view element - starting the dragging.
22
+ * * `mousemove` and `touchmove` on the document - updating the view coordinates.
23
+ * * `mouseup` and `touchend` on the document - stopping the dragging.
24
+ *
25
+ * The mixin itself does not provide a visual feedback (that is, the dragged element does not change its position) -
26
+ * it is up to the developer to implement it.
27
+ */
28
+ export default function DraggableViewMixin<Base extends Constructor<View>>(view: Base): Mixed<Base, DraggableView>;
29
+ /**
30
+ * An interface that should be implemented by views that want to be draggable.
31
+ */
32
+ export interface DraggableView extends View {
33
+ get dragHandleElement(): HTMLElement | null;
34
+ }
35
+ /**
36
+ * An event data object for the {@link ~DraggableView} `drag` event. Fired when the view is dragged.
37
+ */
38
+ export type DraggableViewDragEvent = {
39
+ name: 'drag';
40
+ args: [
41
+ {
42
+ deltaX: number;
43
+ deltaY: number;
44
+ }
45
+ ];
46
+ };
@@ -0,0 +1,59 @@
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/bindings/injectcsstransitiondisabler
7
+ */
8
+ import type View from '../view.js';
9
+ /**
10
+ * A decorator that brings the possibility to temporarily disable CSS transitions using
11
+ * {@link module:ui/view~View} methods. It is helpful when, for instance, the transitions should not happen
12
+ * when the view is first displayed but they should work normal in other cases.
13
+ *
14
+ * The methods to control the CSS transitions are:
15
+ * * `disableCssTransitions()` – Adds the `.ck-transitions-disabled` class to the
16
+ * {@link module:ui/view~View#element view element}.
17
+ * * `enableCssTransitions()` – Removes the `.ck-transitions-disabled` class from the
18
+ * {@link module:ui/view~View#element view element}.
19
+ *
20
+ * **Note**: This helper extends the {@link module:ui/view~View#template template} and must be used **after**
21
+ * {@link module:ui/view~View#setTemplate} is called:
22
+ *
23
+ * ```ts
24
+ * import injectCssTransitionDisabler from '@ckeditor/ckeditor5-ui/src/bindings/injectcsstransitiondisabler';
25
+ *
26
+ * class MyView extends View {
27
+ * constructor() {
28
+ * super();
29
+ *
30
+ * // ...
31
+ *
32
+ * this.setTemplate( { ... } );
33
+ *
34
+ * // ...
35
+ *
36
+ * injectCssTransitionDisabler( this );
37
+ *
38
+ * // ...
39
+ * }
40
+ * }
41
+ * ```
42
+ *
43
+ * The usage comes down to:
44
+ *
45
+ * ```ts
46
+ * const view = new MyView();
47
+ *
48
+ * // ...
49
+ *
50
+ * view.disableCssTransitions();
51
+ * view.show();
52
+ * view.enableCssTransitions();
53
+ * ```
54
+ *
55
+ * @deprecated
56
+ * @see module:ui/bindings/csstransitiondisablermixin~CssTransitionDisablerMixin
57
+ * @param view View instance that should get this functionality.
58
+ */
59
+ export default function injectCssTransitionDisabler(view: View): void;
@@ -0,0 +1,33 @@
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/bindings/preventdefault
7
+ */
8
+ import type { ListenerBinding } from '../template.js';
9
+ import type View from '../view.js';
10
+ /**
11
+ * A helper which executes a native `Event.preventDefault()` if the target of an event equals the
12
+ * {@link module:ui/view~View#element element of the view}. It shortens the definition of a
13
+ * {@link module:ui/view~View#template template}.
14
+ *
15
+ * ```ts
16
+ * // In a class extending View.
17
+ * import preventDefault from '@ckeditor/ckeditor5-ui/src/bindings/preventdefault';
18
+ *
19
+ * // ...
20
+ *
21
+ * this.setTemplate( {
22
+ * tag: 'div',
23
+ *
24
+ * on: {
25
+ * // Prevent the default mousedown action on this view.
26
+ * mousedown: preventDefault( this )
27
+ * }
28
+ * } );
29
+ * ```
30
+ *
31
+ * @param view View instance that defines the template.
32
+ */
33
+ export default function preventDefault(view: View): ListenerBinding;
@@ -0,0 +1,57 @@
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/bindings/submithandler
7
+ */
8
+ import type View from '../view.js';
9
+ /**
10
+ * A handler useful for {@link module:ui/view~View views} working as HTML forms. It intercepts a native DOM
11
+ * `submit` event, prevents the default web browser behavior (navigation and page reload) and
12
+ * fires the `submit` event on a view instead. Such a custom event can be then used by any
13
+ * {@link module:utils/dom/emittermixin~DomEmitter emitter}, e.g. to serialize the form data.
14
+ *
15
+ * ```ts
16
+ * import submitHandler from '@ckeditor/ckeditor5-ui/src/bindings/submithandler';
17
+ *
18
+ * // ...
19
+ *
20
+ * class AnyFormView extends View {
21
+ * constructor() {
22
+ * super();
23
+ *
24
+ * // ...
25
+ *
26
+ * submitHandler( {
27
+ * view: this
28
+ * } );
29
+ * }
30
+ * }
31
+ *
32
+ * // ...
33
+ *
34
+ * const view = new AnyFormView();
35
+ *
36
+ * // A sample listener attached by an emitter working with the view.
37
+ * this.listenTo( view, 'submit', () => {
38
+ * saveTheFormData();
39
+ * hideTheForm();
40
+ * } );
41
+ * ```
42
+ *
43
+ * @param options Configuration options.
44
+ * @param options.view The view which DOM `submit` events should be handled.
45
+ */
46
+ export default function submitHandler({ view }: {
47
+ view: View;
48
+ }): void;
49
+ /**
50
+ * Fired by {@link module:ui/bindings/submithandler~submitHandler} helper.
51
+ *
52
+ * @eventName module:ui/view~View#submit
53
+ */
54
+ export type SubmitHandlerEvent = {
55
+ name: 'submit';
56
+ args: [];
57
+ };