@ckeditor/ckeditor5-ui 35.2.1 → 35.3.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 (59) hide show
  1. package/package.json +31 -23
  2. package/src/bindings/addkeyboardhandlingforgrid.js +45 -57
  3. package/src/bindings/clickoutsidehandler.js +15 -21
  4. package/src/bindings/injectcsstransitiondisabler.js +16 -20
  5. package/src/bindings/preventdefault.js +6 -8
  6. package/src/bindings/submithandler.js +5 -7
  7. package/src/button/button.js +5 -0
  8. package/src/button/buttonview.js +220 -259
  9. package/src/button/switchbuttonview.js +56 -71
  10. package/src/colorgrid/colorgridview.js +135 -197
  11. package/src/colorgrid/colortileview.js +37 -47
  12. package/src/colorgrid/utils.js +57 -66
  13. package/src/componentfactory.js +79 -93
  14. package/src/dropdown/button/dropdownbutton.js +5 -0
  15. package/src/dropdown/button/dropdownbuttonview.js +44 -57
  16. package/src/dropdown/button/splitbuttonview.js +159 -207
  17. package/src/dropdown/dropdownpanelfocusable.js +5 -0
  18. package/src/dropdown/dropdownpanelview.js +101 -112
  19. package/src/dropdown/dropdownview.js +396 -438
  20. package/src/dropdown/utils.js +164 -213
  21. package/src/editableui/editableuiview.js +125 -141
  22. package/src/editableui/inline/inlineeditableuiview.js +44 -54
  23. package/src/editorui/bodycollection.js +61 -75
  24. package/src/editorui/boxed/boxededitoruiview.js +91 -104
  25. package/src/editorui/editoruiview.js +30 -39
  26. package/src/focuscycler.js +214 -245
  27. package/src/formheader/formheaderview.js +58 -70
  28. package/src/icon/iconview.js +145 -111
  29. package/src/iframe/iframeview.js +37 -49
  30. package/src/index.js +0 -17
  31. package/src/input/inputview.js +170 -198
  32. package/src/inputnumber/inputnumberview.js +48 -56
  33. package/src/inputtext/inputtextview.js +14 -18
  34. package/src/label/labelview.js +44 -53
  35. package/src/labeledfield/labeledfieldview.js +212 -235
  36. package/src/labeledfield/utils.js +39 -57
  37. package/src/labeledinput/labeledinputview.js +190 -221
  38. package/src/list/listitemview.js +40 -50
  39. package/src/list/listseparatorview.js +15 -19
  40. package/src/list/listview.js +94 -115
  41. package/src/model.js +19 -25
  42. package/src/notification/notification.js +151 -202
  43. package/src/panel/balloon/balloonpanelview.js +535 -628
  44. package/src/panel/balloon/contextualballoon.js +611 -732
  45. package/src/panel/sticky/stickypanelview.js +238 -270
  46. package/src/template.js +1049 -1479
  47. package/src/toolbar/balloon/balloontoolbar.js +337 -424
  48. package/src/toolbar/block/blockbuttonview.js +32 -42
  49. package/src/toolbar/block/blocktoolbar.js +375 -477
  50. package/src/toolbar/normalizetoolbarconfig.js +17 -21
  51. package/src/toolbar/toolbarlinebreakview.js +15 -19
  52. package/src/toolbar/toolbarseparatorview.js +15 -19
  53. package/src/toolbar/toolbarview.js +866 -1053
  54. package/src/tooltipmanager.js +324 -353
  55. package/src/view.js +389 -430
  56. package/src/viewcollection.js +147 -178
  57. package/src/button/button.jsdoc +0 -165
  58. package/src/dropdown/button/dropdownbutton.jsdoc +0 -22
  59. package/src/dropdown/dropdownpanelfocusable.jsdoc +0 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-ui",
3
- "version": "35.2.1",
3
+ "version": "35.3.1",
4
4
  "description": "The UI framework and standard UI library of CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -11,29 +11,32 @@
11
11
  ],
12
12
  "main": "src/index.js",
13
13
  "dependencies": {
14
- "@ckeditor/ckeditor5-utils": "^35.2.1",
15
- "@ckeditor/ckeditor5-core": "^35.2.1",
14
+ "@ckeditor/ckeditor5-utils": "^35.3.1",
15
+ "@ckeditor/ckeditor5-core": "^35.3.1",
16
16
  "lodash-es": "^4.17.15"
17
17
  },
18
18
  "devDependencies": {
19
- "@ckeditor/ckeditor5-basic-styles": "^35.2.1",
20
- "@ckeditor/ckeditor5-block-quote": "^35.2.1",
21
- "@ckeditor/ckeditor5-editor-balloon": "^35.2.1",
22
- "@ckeditor/ckeditor5-editor-classic": "^35.2.1",
23
- "@ckeditor/ckeditor5-engine": "^35.2.1",
24
- "@ckeditor/ckeditor5-enter": "^35.2.1",
25
- "@ckeditor/ckeditor5-essentials": "^35.2.1",
26
- "@ckeditor/ckeditor5-font": "^35.2.1",
27
- "@ckeditor/ckeditor5-find-and-replace": "^35.2.1",
28
- "@ckeditor/ckeditor5-heading": "^35.2.1",
29
- "@ckeditor/ckeditor5-image": "^35.2.1",
30
- "@ckeditor/ckeditor5-link": "^35.2.1",
31
- "@ckeditor/ckeditor5-list": "^35.2.1",
32
- "@ckeditor/ckeditor5-mention": "^35.2.1",
33
- "@ckeditor/ckeditor5-paragraph": "^35.2.1",
34
- "@ckeditor/ckeditor5-horizontal-line": "^35.2.1",
35
- "@ckeditor/ckeditor5-table": "^35.2.1",
36
- "@ckeditor/ckeditor5-typing": "^35.2.1"
19
+ "@ckeditor/ckeditor5-basic-styles": "^35.3.1",
20
+ "@ckeditor/ckeditor5-block-quote": "^35.3.1",
21
+ "@ckeditor/ckeditor5-editor-balloon": "^35.3.1",
22
+ "@ckeditor/ckeditor5-editor-classic": "^35.3.1",
23
+ "@ckeditor/ckeditor5-engine": "^35.3.1",
24
+ "@ckeditor/ckeditor5-enter": "^35.3.1",
25
+ "@ckeditor/ckeditor5-essentials": "^35.3.1",
26
+ "@ckeditor/ckeditor5-font": "^35.3.1",
27
+ "@ckeditor/ckeditor5-find-and-replace": "^35.3.1",
28
+ "@ckeditor/ckeditor5-heading": "^35.3.1",
29
+ "@ckeditor/ckeditor5-image": "^35.3.1",
30
+ "@ckeditor/ckeditor5-link": "^35.3.1",
31
+ "@ckeditor/ckeditor5-list": "^35.3.1",
32
+ "@ckeditor/ckeditor5-mention": "^35.3.1",
33
+ "@ckeditor/ckeditor5-paragraph": "^35.3.1",
34
+ "@ckeditor/ckeditor5-horizontal-line": "^35.3.1",
35
+ "@ckeditor/ckeditor5-table": "^35.3.1",
36
+ "@ckeditor/ckeditor5-typing": "^35.3.1",
37
+ "typescript": "^4.8.4",
38
+ "webpack": "^5.58.1",
39
+ "webpack-cli": "^4.9.0"
37
40
  },
38
41
  "engines": {
39
42
  "node": ">=14.0.0",
@@ -50,9 +53,14 @@
50
53
  },
51
54
  "files": [
52
55
  "lang",
53
- "src",
56
+ "src/**/*.js",
57
+ "src/**/*.d.ts",
54
58
  "theme",
55
59
  "ckeditor5-metadata.json",
56
60
  "CHANGELOG.md"
57
- ]
61
+ ],
62
+ "scripts": {
63
+ "build": "tsc -p ./tsconfig.release.json",
64
+ "postversion": "npm run build"
65
+ }
58
66
  }
@@ -2,11 +2,9 @@
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module ui/bindings/addkeyboardhandlingforgrid
8
7
  */
9
-
10
8
  /**
11
9
  * A helper that adds a keyboard navigation support (arrow up/down/left/right) for grids.
12
10
  *
@@ -18,59 +16,49 @@
18
16
  * @param {Number|Function} options.numberOfColumns Number of columns in the grid. Can be specified as a function that returns
19
17
  * the number (e.g. for responsive grids).
20
18
  */
21
- export default function addKeyboardHandlingForGrid( { keystrokeHandler, focusTracker, gridItems, numberOfColumns } ) {
22
- const getNumberOfColumns = typeof numberOfColumns === 'number' ? () => numberOfColumns : numberOfColumns;
23
-
24
- keystrokeHandler.set( 'arrowright', getGridItemFocuser( ( focusedElementIndex, gridItems ) => {
25
- if ( focusedElementIndex === gridItems.length - 1 ) {
26
- return 0;
27
- } else {
28
- return focusedElementIndex + 1;
29
- }
30
- } ) );
31
-
32
- keystrokeHandler.set( 'arrowleft', getGridItemFocuser( ( focusedElementIndex, gridItems ) => {
33
- if ( focusedElementIndex === 0 ) {
34
- return gridItems.length - 1;
35
- } else {
36
- return focusedElementIndex - 1;
37
- }
38
- } ) );
39
-
40
- keystrokeHandler.set( 'arrowup', getGridItemFocuser( ( focusedElementIndex, gridItems ) => {
41
- let nextIndex = focusedElementIndex - getNumberOfColumns();
42
-
43
- if ( nextIndex < 0 ) {
44
- nextIndex = focusedElementIndex + getNumberOfColumns() * Math.floor( gridItems.length / getNumberOfColumns() );
45
-
46
- if ( nextIndex > gridItems.length - 1 ) {
47
- nextIndex -= getNumberOfColumns();
48
- }
49
- }
50
-
51
- return nextIndex;
52
- } ) );
53
-
54
- keystrokeHandler.set( 'arrowdown', getGridItemFocuser( ( focusedElementIndex, gridItems ) => {
55
- let nextIndex = focusedElementIndex + getNumberOfColumns();
56
-
57
- if ( nextIndex > gridItems.length - 1 ) {
58
- nextIndex = focusedElementIndex % getNumberOfColumns();
59
- }
60
-
61
- return nextIndex;
62
- } ) );
63
-
64
- function getGridItemFocuser( getIndexToFocus ) {
65
- return evt => {
66
- const focusedElement = gridItems.find( item => item.element === focusTracker.focusedElement );
67
- const focusedElementIndex = gridItems.getIndex( focusedElement );
68
- const nextIndexToFocus = getIndexToFocus( focusedElementIndex, gridItems );
69
-
70
- gridItems.get( nextIndexToFocus ).focus();
71
-
72
- evt.stopPropagation();
73
- evt.preventDefault();
74
- };
75
- }
19
+ export default function addKeyboardHandlingForGrid({ keystrokeHandler, focusTracker, gridItems, numberOfColumns }) {
20
+ const getNumberOfColumns = typeof numberOfColumns === 'number' ? () => numberOfColumns : numberOfColumns;
21
+ keystrokeHandler.set('arrowright', getGridItemFocuser((focusedElementIndex, gridItems) => {
22
+ if (focusedElementIndex === gridItems.length - 1) {
23
+ return 0;
24
+ }
25
+ else {
26
+ return focusedElementIndex + 1;
27
+ }
28
+ }));
29
+ keystrokeHandler.set('arrowleft', getGridItemFocuser((focusedElementIndex, gridItems) => {
30
+ if (focusedElementIndex === 0) {
31
+ return gridItems.length - 1;
32
+ }
33
+ else {
34
+ return focusedElementIndex - 1;
35
+ }
36
+ }));
37
+ keystrokeHandler.set('arrowup', getGridItemFocuser((focusedElementIndex, gridItems) => {
38
+ let nextIndex = focusedElementIndex - getNumberOfColumns();
39
+ if (nextIndex < 0) {
40
+ nextIndex = focusedElementIndex + getNumberOfColumns() * Math.floor(gridItems.length / getNumberOfColumns());
41
+ if (nextIndex > gridItems.length - 1) {
42
+ nextIndex -= getNumberOfColumns();
43
+ }
44
+ }
45
+ return nextIndex;
46
+ }));
47
+ keystrokeHandler.set('arrowdown', getGridItemFocuser((focusedElementIndex, gridItems) => {
48
+ let nextIndex = focusedElementIndex + getNumberOfColumns();
49
+ if (nextIndex > gridItems.length - 1) {
50
+ nextIndex = focusedElementIndex % getNumberOfColumns();
51
+ }
52
+ return nextIndex;
53
+ }));
54
+ function getGridItemFocuser(getIndexToFocus) {
55
+ return (evt) => {
56
+ const focusedElement = gridItems.find(item => item.element === focusTracker.focusedElement);
57
+ const focusedElementIndex = gridItems.getIndex(focusedElement);
58
+ const nextIndexToFocus = getIndexToFocus(focusedElementIndex, gridItems);
59
+ gridItems.get(nextIndexToFocus).focus();
60
+ evt.stopPropagation();
61
+ evt.preventDefault();
62
+ };
63
+ }
76
64
  }
@@ -2,13 +2,10 @@
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module ui/bindings/clickoutsidehandler
8
7
  */
9
-
10
8
  /* global document */
11
-
12
9
  /**
13
10
  * Handles clicking **outside** of a specified set of elements, then fires an action.
14
11
  *
@@ -24,22 +21,19 @@
24
21
  * handler. Clicking any of them or their descendants will **not** fire the callback.
25
22
  * @param {Function} options.callback An action executed by the handler.
26
23
  */
27
- export default function clickOutsideHandler( { emitter, activator, callback, contextElements } ) {
28
- emitter.listenTo( document, 'mousedown', ( evt, domEvt ) => {
29
- if ( !activator() ) {
30
- return;
31
- }
32
-
33
- // Check if `composedPath` is `undefined` in case the browser does not support native shadow DOM.
34
- // Can be removed when all supported browsers support native shadow DOM.
35
- const path = typeof domEvt.composedPath == 'function' ? domEvt.composedPath() : [];
36
-
37
- for ( const contextElement of contextElements ) {
38
- if ( contextElement.contains( domEvt.target ) || path.includes( contextElement ) ) {
39
- return;
40
- }
41
- }
42
-
43
- callback();
44
- } );
24
+ export default function clickOutsideHandler({ emitter, activator, callback, contextElements }) {
25
+ emitter.listenTo(document, 'mousedown', (evt, domEvt) => {
26
+ if (!activator()) {
27
+ return;
28
+ }
29
+ // Check if `composedPath` is `undefined` in case the browser does not support native shadow DOM.
30
+ // Can be removed when all supported browsers support native shadow DOM.
31
+ const path = typeof domEvt.composedPath == 'function' ? domEvt.composedPath() : [];
32
+ for (const contextElement of contextElements) {
33
+ if (contextElement.contains(domEvt.target) || path.includes(contextElement)) {
34
+ return;
35
+ }
36
+ }
37
+ callback();
38
+ });
45
39
  }
@@ -2,11 +2,9 @@
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module ui/bindings/injectcsstransitiondisabler
8
7
  */
9
-
10
8
  /**
11
9
  * A decorator that brings the possibility to temporarily disable CSS transitions using
12
10
  * {@link module:ui/view~View} methods. It is helpful when, for instance, the transitions should not happen
@@ -51,22 +49,20 @@
51
49
  *
52
50
  * @param {module:ui/view~View} view View instance that should get this functionality.
53
51
  */
54
- export default function injectCssTransitionDisabler( view ) {
55
- view.set( '_isCssTransitionsDisabled', false );
56
-
57
- view.disableCssTransitions = () => {
58
- view._isCssTransitionsDisabled = true;
59
- };
60
-
61
- view.enableCssTransitions = () => {
62
- view._isCssTransitionsDisabled = false;
63
- };
64
-
65
- view.extendTemplate( {
66
- attributes: {
67
- class: [
68
- view.bindTemplate.if( '_isCssTransitionsDisabled', 'ck-transitions-disabled' )
69
- ]
70
- }
71
- } );
52
+ export default function injectCssTransitionDisabler(view) {
53
+ const decorated = view;
54
+ decorated.set('_isCssTransitionsDisabled', false);
55
+ decorated.disableCssTransitions = () => {
56
+ decorated._isCssTransitionsDisabled = true;
57
+ };
58
+ decorated.enableCssTransitions = () => {
59
+ decorated._isCssTransitionsDisabled = false;
60
+ };
61
+ decorated.extendTemplate({
62
+ attributes: {
63
+ class: [
64
+ decorated.bindTemplate.if('_isCssTransitionsDisabled', 'ck-transitions-disabled')
65
+ ]
66
+ }
67
+ });
72
68
  }
@@ -2,11 +2,9 @@
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module ui/bindings/preventdefault
8
7
  */
9
-
10
8
  /**
11
9
  * A helper which executes a native `Event.preventDefault()` if the target of an event equals the
12
10
  * {@link module:ui/view~View#element element of the view}. It shortens the definition of a
@@ -29,10 +27,10 @@
29
27
  * @param {module:ui/view~View} view View instance that defines the template.
30
28
  * @returns {module:ui/template~TemplateToBinding}
31
29
  */
32
- export default function preventDefault( view ) {
33
- return view.bindTemplate.to( evt => {
34
- if ( evt.target === view.element ) {
35
- evt.preventDefault();
36
- }
37
- } );
30
+ export default function preventDefault(view) {
31
+ return view.bindTemplate.to(evt => {
32
+ if (evt.target === view.element) {
33
+ evt.preventDefault();
34
+ }
35
+ });
38
36
  }
@@ -2,11 +2,9 @@
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
-
6
5
  /**
7
6
  * @module ui/bindings/submithandler
8
7
  */
9
-
10
8
  /**
11
9
  * A handler useful for {@link module:ui/view~View views} working as HTML forms. It intercepts a native DOM
12
10
  * `submit` event, prevents the default web browser behavior (navigation and page reload) and
@@ -42,9 +40,9 @@
42
40
  * @param {Object} [options] Configuration options.
43
41
  * @param {module:ui/view~View} options.view The view which DOM `submit` events should be handled.
44
42
  */
45
- export default function submitHandler( { view } ) {
46
- view.listenTo( view.element, 'submit', ( evt, domEvt ) => {
47
- domEvt.preventDefault();
48
- view.fire( 'submit' );
49
- }, { useCapture: true } );
43
+ export default function submitHandler({ view }) {
44
+ view.listenTo(view.element, 'submit', (evt, domEvt) => {
45
+ domEvt.preventDefault();
46
+ view.fire('submit');
47
+ }, { useCapture: true });
50
48
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, 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
+ export {};