@ckeditor/ckeditor5-ui 36.0.0 → 37.0.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 (114) hide show
  1. package/package.json +23 -22
  2. package/src/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
  3. package/src/bindings/addkeyboardhandlingforgrid.js +42 -34
  4. package/src/bindings/clickoutsidehandler.d.ts +28 -0
  5. package/src/bindings/clickoutsidehandler.js +5 -6
  6. package/src/bindings/csstransitiondisablermixin.d.ts +40 -0
  7. package/src/bindings/csstransitiondisablermixin.js +55 -0
  8. package/src/bindings/injectcsstransitiondisabler.d.ts +59 -0
  9. package/src/bindings/injectcsstransitiondisabler.js +23 -20
  10. package/src/bindings/preventdefault.d.ts +33 -0
  11. package/src/bindings/preventdefault.js +13 -15
  12. package/src/bindings/submithandler.d.ts +57 -0
  13. package/src/bindings/submithandler.js +22 -23
  14. package/src/button/button.d.ts +154 -0
  15. package/src/button/buttonview.d.ts +155 -0
  16. package/src/button/buttonview.js +16 -60
  17. package/src/button/switchbuttonview.d.ts +45 -0
  18. package/src/button/switchbuttonview.js +9 -18
  19. package/src/colorgrid/colorgridview.d.ts +132 -0
  20. package/src/colorgrid/colorgridview.js +8 -40
  21. package/src/colorgrid/colortileview.d.ts +28 -0
  22. package/src/colorgrid/colortileview.js +0 -13
  23. package/src/colorgrid/utils.d.ts +47 -0
  24. package/src/colorgrid/utils.js +7 -13
  25. package/src/componentfactory.d.ts +81 -0
  26. package/src/componentfactory.js +21 -35
  27. package/src/dropdown/button/dropdownbutton.d.ts +25 -0
  28. package/src/dropdown/button/dropdownbuttonview.d.ts +48 -0
  29. package/src/dropdown/button/dropdownbuttonview.js +11 -21
  30. package/src/dropdown/button/splitbuttonview.d.ts +145 -0
  31. package/src/dropdown/button/splitbuttonview.js +10 -51
  32. package/src/dropdown/dropdownpanelfocusable.d.ts +21 -0
  33. package/src/dropdown/dropdownpanelview.d.ts +62 -0
  34. package/src/dropdown/dropdownpanelview.js +2 -30
  35. package/src/dropdown/dropdownview.d.ts +315 -0
  36. package/src/dropdown/dropdownview.js +121 -222
  37. package/src/dropdown/utils.d.ts +219 -0
  38. package/src/dropdown/utils.js +112 -106
  39. package/src/editableui/editableuiview.d.ts +71 -0
  40. package/src/editableui/editableuiview.js +14 -43
  41. package/src/editableui/inline/inlineeditableuiview.d.ts +40 -0
  42. package/src/editableui/inline/inlineeditableuiview.js +5 -15
  43. package/src/editorui/bodycollection.d.ts +51 -0
  44. package/src/editorui/bodycollection.js +2 -16
  45. package/src/editorui/boxed/boxededitoruiview.d.ts +40 -0
  46. package/src/editorui/boxed/boxededitoruiview.js +1 -27
  47. package/src/editorui/editorui.d.ts +264 -0
  48. package/src/editorui/editorui.js +21 -128
  49. package/src/editorui/editoruiview.d.ts +39 -0
  50. package/src/editorui/editoruiview.js +1 -10
  51. package/src/focuscycler.d.ts +183 -0
  52. package/src/focuscycler.js +34 -90
  53. package/src/formheader/formheaderview.d.ts +53 -0
  54. package/src/formheader/formheaderview.js +3 -24
  55. package/src/icon/iconview.d.ts +78 -0
  56. package/src/icon/iconview.js +0 -50
  57. package/src/iframe/iframeview.d.ts +50 -0
  58. package/src/iframe/iframeview.js +2 -2
  59. package/src/index.d.ts +54 -0
  60. package/src/index.js +1 -0
  61. package/src/input/inputview.d.ts +121 -0
  62. package/src/input/inputview.js +0 -82
  63. package/src/inputnumber/inputnumberview.d.ts +49 -0
  64. package/src/inputnumber/inputnumberview.js +5 -28
  65. package/src/inputtext/inputtextview.d.ts +18 -0
  66. package/src/inputtext/inputtextview.js +0 -2
  67. package/src/label/labelview.d.ts +36 -0
  68. package/src/label/labelview.js +0 -20
  69. package/src/labeledfield/labeledfieldview.d.ts +182 -0
  70. package/src/labeledfield/labeledfieldview.js +20 -126
  71. package/src/labeledfield/utils.d.ts +93 -0
  72. package/src/labeledfield/utils.js +24 -18
  73. package/src/labeledinput/labeledinputview.d.ts +125 -0
  74. package/src/labeledinput/labeledinputview.js +7 -90
  75. package/src/list/listitemview.d.ts +35 -0
  76. package/src/list/listitemview.js +0 -16
  77. package/src/list/listseparatorview.d.ts +18 -0
  78. package/src/list/listseparatorview.js +0 -2
  79. package/src/list/listview.d.ts +59 -0
  80. package/src/list/listview.js +0 -33
  81. package/src/model.d.ts +22 -0
  82. package/src/model.js +2 -4
  83. package/src/notification/notification.d.ts +216 -0
  84. package/src/notification/notification.js +64 -51
  85. package/src/panel/balloon/balloonpanelview.d.ts +685 -0
  86. package/src/panel/balloon/balloonpanelview.js +146 -168
  87. package/src/panel/balloon/contextualballoon.d.ts +240 -0
  88. package/src/panel/balloon/contextualballoon.js +41 -171
  89. package/src/panel/sticky/stickypanelview.d.ts +132 -0
  90. package/src/panel/sticky/stickypanelview.js +0 -115
  91. package/src/template.d.ts +940 -0
  92. package/src/template.js +396 -460
  93. package/src/toolbar/balloon/balloontoolbar.d.ts +124 -0
  94. package/src/toolbar/balloon/balloontoolbar.js +15 -81
  95. package/src/toolbar/block/blockbuttonview.d.ts +35 -0
  96. package/src/toolbar/block/blockbuttonview.js +1 -13
  97. package/src/toolbar/block/blocktoolbar.d.ts +159 -0
  98. package/src/toolbar/block/blocktoolbar.js +32 -69
  99. package/src/toolbar/normalizetoolbarconfig.d.ts +39 -0
  100. package/src/toolbar/normalizetoolbarconfig.js +12 -8
  101. package/src/toolbar/toolbarlinebreakview.d.ts +18 -0
  102. package/src/toolbar/toolbarlinebreakview.js +0 -2
  103. package/src/toolbar/toolbarseparatorview.d.ts +18 -0
  104. package/src/toolbar/toolbarseparatorview.js +0 -2
  105. package/src/toolbar/toolbarview.d.ts +241 -0
  106. package/src/toolbar/toolbarview.js +54 -305
  107. package/src/tooltipmanager.d.ts +180 -0
  108. package/src/tooltipmanager.js +47 -94
  109. package/src/uiconfig.d.ts +82 -0
  110. package/src/uiconfig.js +5 -0
  111. package/src/view.d.ts +422 -0
  112. package/src/view.js +182 -251
  113. package/src/viewcollection.d.ts +139 -0
  114. package/src/viewcollection.js +62 -56
@@ -0,0 +1,132 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ui/panel/sticky/stickypanelview
7
+ */
8
+ import View from '../../view';
9
+ import type ViewCollection from '../../viewcollection';
10
+ import { type Locale } from '@ckeditor/ckeditor5-utils';
11
+ import '../../../theme/components/panel/stickypanel.css';
12
+ /**
13
+ * The sticky panel view class.
14
+ */
15
+ export default class StickyPanelView extends View {
16
+ /**
17
+ * Collection of the child views which creates balloon panel contents.
18
+ */
19
+ readonly content: ViewCollection;
20
+ /**
21
+ * Controls whether the sticky panel should be active.
22
+ *
23
+ * @readonly
24
+ * @observable
25
+ */
26
+ isActive: boolean;
27
+ /**
28
+ * Controls whether the sticky panel is in the "sticky" state.
29
+ *
30
+ * @readonly
31
+ * @observable
32
+ */
33
+ isSticky: boolean;
34
+ /**
35
+ * The limiter element for the sticky panel instance. Its bounding rect limits
36
+ * the "stickyness" of the panel, i.e. when the panel reaches the bottom
37
+ * edge of the limiter, it becomes sticky to that edge and does not float
38
+ * off the limiter. It is mandatory for the panel to work properly and once
39
+ * set, it cannot be changed.
40
+ *
41
+ * @readonly
42
+ * @observable
43
+ */
44
+ limiterElement: HTMLElement | null;
45
+ /**
46
+ * The offset from the bottom edge of {@link #limiterElement}
47
+ * which stops the panel from stickying any further to prevent limiter's content
48
+ * from being completely covered.
49
+ *
50
+ * @readonly
51
+ * @observable
52
+ * @default 50
53
+ */
54
+ limiterBottomOffset: number;
55
+ /**
56
+ * The offset from the top edge of the web browser's viewport which makes the
57
+ * panel become sticky. The default value is `0`, which means the panel becomes
58
+ * sticky when it's upper edge touches the top of the page viewport.
59
+ *
60
+ * This attribute is useful when the web page has UI elements positioned to the top
61
+ * either using `position: fixed` or `position: sticky`, which would cover the
62
+ * sticky panel or vice–versa (depending on the `z-index` hierarchy).
63
+ *
64
+ * Bound to {@link module:core/editor/editorui~EditorUI#viewportOffset `EditorUI#viewportOffset`}.
65
+ *
66
+ * If {@link module:core/editor/editorconfig~EditorConfig#ui `EditorConfig#ui.viewportOffset.top`} is defined, then
67
+ * it will override the default value.
68
+ *
69
+ * @observable
70
+ * @default 0
71
+ */
72
+ viewportTopOffset: number;
73
+ /**
74
+ * Controls the `margin-left` CSS style of the panel.
75
+ *
76
+ * @private
77
+ * @readonly
78
+ * @observable
79
+ */
80
+ _marginLeft: string | null;
81
+ /**
82
+ * Set `true` if the sticky panel reached the bottom edge of the
83
+ * {@link #limiterElement}.
84
+ *
85
+ * @private
86
+ * @readonly
87
+ * @observable
88
+ */
89
+ _isStickyToTheLimiter: boolean;
90
+ /**
91
+ * Set `true` if the sticky panel uses the {@link #viewportTopOffset},
92
+ * i.e. not {@link #_isStickyToTheLimiter} and the {@link #viewportTopOffset}
93
+ * is not `0`.
94
+ *
95
+ * @private
96
+ * @readonly
97
+ * @observable
98
+ */
99
+ _hasViewportTopOffset: boolean;
100
+ /**
101
+ * The DOM bounding client rect of the {@link module:ui/view~View#element} of the panel.
102
+ */
103
+ private _panelRect?;
104
+ /**
105
+ * The DOM bounding client rect of the {@link #limiterElement}
106
+ * of the panel.
107
+ */
108
+ private _limiterRect?;
109
+ /**
110
+ * A dummy element which visually fills the space as long as the
111
+ * actual panel is sticky. It prevents flickering of the UI.
112
+ */
113
+ private _contentPanelPlaceholder;
114
+ /**
115
+ * The panel which accepts children into {@link #content} collection.
116
+ * Also an element which is positioned when {@link #isSticky}.
117
+ */
118
+ private _contentPanel;
119
+ /**
120
+ * @inheritDoc
121
+ */
122
+ constructor(locale?: Locale);
123
+ /**
124
+ * @inheritDoc
125
+ */
126
+ render(): void;
127
+ /**
128
+ * Analyzes the environment to decide whether the panel should
129
+ * be sticky or not.
130
+ */
131
+ private _checkIfShouldBeSticky;
132
+ }
@@ -20,121 +20,15 @@ export default class StickyPanelView extends View {
20
20
  constructor(locale) {
21
21
  super(locale);
22
22
  const bind = this.bindTemplate;
23
- /**
24
- * Controls whether the sticky panel should be active.
25
- *
26
- * @readonly
27
- * @observable
28
- * @member {Boolean} #isActive
29
- */
30
23
  this.set('isActive', false);
31
- /**
32
- * Controls whether the sticky panel is in the "sticky" state.
33
- *
34
- * @readonly
35
- * @observable
36
- * @member {Boolean} #isSticky
37
- */
38
24
  this.set('isSticky', false);
39
- /**
40
- * The limiter element for the sticky panel instance. Its bounding rect limits
41
- * the "stickyness" of the panel, i.e. when the panel reaches the bottom
42
- * edge of the limiter, it becomes sticky to that edge and does not float
43
- * off the limiter. It is mandatory for the panel to work properly and once
44
- * set, it cannot be changed.
45
- *
46
- * @readonly
47
- * @observable
48
- * @member {HTMLElement} #limiterElement
49
- */
50
25
  this.set('limiterElement', null);
51
- /**
52
- * The offset from the bottom edge of {@link #limiterElement}
53
- * which stops the panel from stickying any further to prevent limiter's content
54
- * from being completely covered.
55
- *
56
- * @readonly
57
- * @observable
58
- * @default 50
59
- * @member {Number} #limiterBottomOffset
60
- */
61
26
  this.set('limiterBottomOffset', 50);
62
- /**
63
- * The offset from the top edge of the web browser's viewport which makes the
64
- * panel become sticky. The default value is `0`, which means the panel becomes
65
- * sticky when it's upper edge touches the top of the page viewport.
66
- *
67
- * This attribute is useful when the web page has UI elements positioned to the top
68
- * either using `position: fixed` or `position: sticky`, which would cover the
69
- * sticky panel or vice–versa (depending on the `z-index` hierarchy).
70
- *
71
- * Bound to {@link module:core/editor/editorui~EditorUI#viewportOffset `EditorUI#viewportOffset`}.
72
- *
73
- * If {@link module:core/editor/editorconfig~EditorConfig#ui `EditorConfig#ui.viewportOffset.top`} is defined, then
74
- * it will override the default value.
75
- *
76
- * @observable
77
- * @default 0
78
- * @member {Number} #viewportTopOffset
79
- */
80
27
  this.set('viewportTopOffset', 0);
81
- /**
82
- * Controls the `margin-left` CSS style of the panel.
83
- *
84
- * @protected
85
- * @readonly
86
- * @observable
87
- * @member {String} #_marginLeft
88
- */
89
28
  this.set('_marginLeft', null);
90
- /**
91
- * Set `true` if the sticky panel reached the bottom edge of the
92
- * {@link #limiterElement}.
93
- *
94
- * @protected
95
- * @readonly
96
- * @observable
97
- * @member {Boolean} #_isStickyToTheLimiter
98
- */
99
29
  this.set('_isStickyToTheLimiter', false);
100
- /**
101
- * Set `true` if the sticky panel uses the {@link #viewportTopOffset},
102
- * i.e. not {@link #_isStickyToTheLimiter} and the {@link #viewportTopOffset}
103
- * is not `0`.
104
- *
105
- * @protected
106
- * @readonly
107
- * @observable
108
- * @member {Boolean} #_hasViewportTopOffset
109
- */
110
30
  this.set('_hasViewportTopOffset', false);
111
- /**
112
- * Collection of the child views which creates balloon panel contents.
113
- *
114
- * @readonly
115
- * @member {module:ui/viewcollection~ViewCollection}
116
- */
117
31
  this.content = this.createCollection();
118
- /**
119
- * The DOM bounding client rect of the {@link module:ui/view~View#element} of the panel.
120
- *
121
- * @protected
122
- * @member {Object} #_panelRect
123
- */
124
- /**
125
- * The DOM bounding client rect of the {@link #limiterElement}
126
- * of the panel.
127
- *
128
- * @protected
129
- * @member {Object} #_limiterRect
130
- */
131
- /**
132
- * A dummy element which visually fills the space as long as the
133
- * actual panel is sticky. It prevents flickering of the UI.
134
- *
135
- * @protected
136
- * @property {HTMLElement}
137
- */
138
32
  this._contentPanelPlaceholder = new Template({
139
33
  tag: 'div',
140
34
  attributes: {
@@ -150,13 +44,6 @@ export default class StickyPanelView extends View {
150
44
  }
151
45
  }
152
46
  }).render();
153
- /**
154
- * The panel which accepts children into {@link #content} collection.
155
- * Also an element which is positioned when {@link #isSticky}.
156
- *
157
- * @protected
158
- * @property {HTMLElement}
159
- */
160
47
  this._contentPanel = new Template({
161
48
  tag: 'div',
162
49
  attributes: {
@@ -215,8 +102,6 @@ export default class StickyPanelView extends View {
215
102
  /**
216
103
  * Analyzes the environment to decide whether the panel should
217
104
  * be sticky or not.
218
- *
219
- * @protected
220
105
  */
221
106
  _checkIfShouldBeSticky() {
222
107
  const panelRect = this._panelRect = this._contentPanel.getBoundingClientRect();