@ckeditor/ckeditor5-ui 36.0.1 → 37.0.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 (114) hide show
  1. package/package.json +24 -23
  2. package/src/augmentation.d.ts +86 -0
  3. package/src/augmentation.js +5 -0
  4. package/src/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
  5. package/src/bindings/addkeyboardhandlingforgrid.js +42 -34
  6. package/src/bindings/clickoutsidehandler.d.ts +28 -0
  7. package/src/bindings/clickoutsidehandler.js +5 -6
  8. package/src/bindings/csstransitiondisablermixin.d.ts +40 -0
  9. package/src/bindings/csstransitiondisablermixin.js +55 -0
  10. package/src/bindings/injectcsstransitiondisabler.d.ts +59 -0
  11. package/src/bindings/injectcsstransitiondisabler.js +23 -20
  12. package/src/bindings/preventdefault.d.ts +33 -0
  13. package/src/bindings/preventdefault.js +13 -15
  14. package/src/bindings/submithandler.d.ts +57 -0
  15. package/src/bindings/submithandler.js +23 -24
  16. package/src/button/button.d.ts +154 -0
  17. package/src/button/buttonview.d.ts +155 -0
  18. package/src/button/buttonview.js +16 -60
  19. package/src/button/switchbuttonview.d.ts +45 -0
  20. package/src/button/switchbuttonview.js +9 -18
  21. package/src/colorgrid/colorgridview.d.ts +132 -0
  22. package/src/colorgrid/colorgridview.js +13 -44
  23. package/src/colorgrid/colortileview.d.ts +28 -0
  24. package/src/colorgrid/colortileview.js +2 -15
  25. package/src/colorgrid/utils.d.ts +47 -0
  26. package/src/colorgrid/utils.js +7 -13
  27. package/src/componentfactory.d.ts +81 -0
  28. package/src/componentfactory.js +22 -36
  29. package/src/dropdown/button/dropdownbutton.d.ts +25 -0
  30. package/src/dropdown/button/dropdownbuttonview.d.ts +48 -0
  31. package/src/dropdown/button/dropdownbuttonview.js +11 -21
  32. package/src/dropdown/button/splitbuttonview.d.ts +145 -0
  33. package/src/dropdown/button/splitbuttonview.js +11 -52
  34. package/src/dropdown/dropdownpanelfocusable.d.ts +21 -0
  35. package/src/dropdown/dropdownpanelview.d.ts +62 -0
  36. package/src/dropdown/dropdownpanelview.js +2 -30
  37. package/src/dropdown/dropdownview.d.ts +315 -0
  38. package/src/dropdown/dropdownview.js +121 -222
  39. package/src/dropdown/utils.d.ts +219 -0
  40. package/src/dropdown/utils.js +112 -106
  41. package/src/editableui/editableuiview.d.ts +72 -0
  42. package/src/editableui/editableuiview.js +16 -44
  43. package/src/editableui/inline/inlineeditableuiview.d.ts +40 -0
  44. package/src/editableui/inline/inlineeditableuiview.js +5 -15
  45. package/src/editorui/bodycollection.d.ts +51 -0
  46. package/src/editorui/bodycollection.js +2 -16
  47. package/src/editorui/boxed/boxededitoruiview.d.ts +40 -0
  48. package/src/editorui/boxed/boxededitoruiview.js +1 -27
  49. package/src/editorui/editorui.d.ts +263 -0
  50. package/src/editorui/editorui.js +27 -134
  51. package/src/editorui/editoruiview.d.ts +39 -0
  52. package/src/editorui/editoruiview.js +1 -10
  53. package/src/focuscycler.d.ts +183 -0
  54. package/src/focuscycler.js +34 -90
  55. package/src/formheader/formheaderview.d.ts +53 -0
  56. package/src/formheader/formheaderview.js +3 -24
  57. package/src/icon/iconview.d.ts +78 -0
  58. package/src/icon/iconview.js +0 -50
  59. package/src/iframe/iframeview.d.ts +50 -0
  60. package/src/iframe/iframeview.js +2 -2
  61. package/src/index.d.ts +55 -0
  62. package/src/index.js +2 -0
  63. package/src/input/inputview.d.ts +121 -0
  64. package/src/input/inputview.js +0 -82
  65. package/src/inputnumber/inputnumberview.d.ts +49 -0
  66. package/src/inputnumber/inputnumberview.js +5 -28
  67. package/src/inputtext/inputtextview.d.ts +18 -0
  68. package/src/inputtext/inputtextview.js +0 -2
  69. package/src/label/labelview.d.ts +36 -0
  70. package/src/label/labelview.js +0 -20
  71. package/src/labeledfield/labeledfieldview.d.ts +182 -0
  72. package/src/labeledfield/labeledfieldview.js +20 -126
  73. package/src/labeledfield/utils.d.ts +93 -0
  74. package/src/labeledfield/utils.js +24 -18
  75. package/src/labeledinput/labeledinputview.d.ts +125 -0
  76. package/src/labeledinput/labeledinputview.js +7 -90
  77. package/src/list/listitemview.d.ts +35 -0
  78. package/src/list/listitemview.js +0 -16
  79. package/src/list/listseparatorview.d.ts +18 -0
  80. package/src/list/listseparatorview.js +0 -2
  81. package/src/list/listview.d.ts +59 -0
  82. package/src/list/listview.js +0 -33
  83. package/src/model.d.ts +22 -0
  84. package/src/model.js +2 -4
  85. package/src/notification/notification.d.ts +211 -0
  86. package/src/notification/notification.js +64 -51
  87. package/src/panel/balloon/balloonpanelview.d.ts +685 -0
  88. package/src/panel/balloon/balloonpanelview.js +146 -168
  89. package/src/panel/balloon/contextualballoon.d.ts +299 -0
  90. package/src/panel/balloon/contextualballoon.js +42 -172
  91. package/src/panel/sticky/stickypanelview.d.ts +132 -0
  92. package/src/panel/sticky/stickypanelview.js +0 -115
  93. package/src/template.d.ts +942 -0
  94. package/src/template.js +397 -461
  95. package/src/toolbar/balloon/balloontoolbar.d.ts +118 -0
  96. package/src/toolbar/balloon/balloontoolbar.js +14 -81
  97. package/src/toolbar/block/blockbuttonview.d.ts +35 -0
  98. package/src/toolbar/block/blockbuttonview.js +1 -13
  99. package/src/toolbar/block/blocktoolbar.d.ts +153 -0
  100. package/src/toolbar/block/blocktoolbar.js +31 -69
  101. package/src/toolbar/normalizetoolbarconfig.d.ts +39 -0
  102. package/src/toolbar/normalizetoolbarconfig.js +12 -8
  103. package/src/toolbar/toolbarlinebreakview.d.ts +18 -0
  104. package/src/toolbar/toolbarlinebreakview.js +0 -2
  105. package/src/toolbar/toolbarseparatorview.d.ts +18 -0
  106. package/src/toolbar/toolbarseparatorview.js +0 -2
  107. package/src/toolbar/toolbarview.d.ts +265 -0
  108. package/src/toolbar/toolbarview.js +54 -305
  109. package/src/tooltipmanager.d.ts +180 -0
  110. package/src/tooltipmanager.js +48 -95
  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
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * @module ui/panel/balloon/contextualballoon
7
7
  */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
8
  import BalloonPanelView from './balloonpanelview';
10
9
  import View from '../../view';
11
10
  import ButtonView from '../../button/buttonview';
11
+ import { Plugin } from '@ckeditor/ckeditor5-core';
12
12
  import { CKEditorError, FocusTracker, Rect, toUnit } from '@ckeditor/ckeditor5-utils';
13
13
  import prevIcon from '../../../theme/icons/previous-arrow.svg';
14
14
  import nextIcon from '../../../theme/icons/next-arrow.svg';
@@ -48,8 +48,6 @@ const toPx = toUnit('px');
48
48
  * used to manage multiple panel stacks. Rotator view is a child of the balloon panel view and the parent of the specific
49
49
  * view you want to display. If there is more than one panel stack to be displayed, the rotator view will add a
50
50
  * navigation bar. If there is only one stack, the rotator view is transparent (it does not add any UI elements).
51
- *
52
- * @extends module:core/plugin~Plugin
53
51
  */
54
52
  export default class ContextualBalloon extends Plugin {
55
53
  /**
@@ -63,84 +61,39 @@ export default class ContextualBalloon extends Plugin {
63
61
  */
64
62
  constructor(editor) {
65
63
  super(editor);
66
- this._view = null;
67
- this._rotatorView = null;
68
- this._fakePanelsView = null;
69
- /**
70
- * The {@link module:utils/dom/position~Options#limiter position limiter}
71
- * for the {@link #view balloon}, used when no `limiter` has been passed into {@link #add}
72
- * or {@link #updatePosition}.
73
- *
74
- * By default, a function that obtains the farthest DOM
75
- * {@link module:engine/view/rooteditableelement~RootEditableElement}
76
- * of the {@link module:engine/view/document~Document#selection}.
77
- *
78
- * @member {module:utils/dom/position~Options#limiter} #positionLimiter
79
- */
80
- this.positionLimiter = () => {
81
- const view = this.editor.editing.view;
82
- const viewDocument = view.document;
83
- const editableElement = viewDocument.selection.editableElement;
84
- if (editableElement) {
85
- return view.domConverter.mapViewToDom(editableElement.root);
86
- }
87
- return null;
88
- };
89
- /**
90
- * The currently visible view or `null` when there are no views in any stack.
91
- *
92
- * @readonly
93
- * @observable
94
- * @member {module:ui/view~View|null} #visibleView
95
- */
96
- this.set('visibleView', null);
97
64
  /**
98
65
  * The map of views and their stacks.
99
- *
100
- * @private
101
- * @type {Map.<module:ui/view~View,Set>}
102
66
  */
103
67
  this._viewToStack = new Map();
104
68
  /**
105
69
  * The map of IDs and stacks.
106
- *
107
- * @private
108
- * @type {Map.<String,Set>}
109
70
  */
110
71
  this._idToStack = new Map();
111
72
  /**
112
- * A total number of all stacks in the balloon.
113
- *
114
- * @private
115
- * @readonly
116
- * @observable
117
- * @member {Number} #_numberOfStacks
73
+ * The common balloon panel view.
118
74
  */
119
- this.set('_numberOfStacks', 0);
120
- /**
121
- * A flag that controls the single view mode.
122
- *
123
- * @private
124
- * @readonly
125
- * @observable
126
- * @member {Boolean} #_singleViewMode
127
- */
128
- this.set('_singleViewMode', false);
75
+ this._view = null;
129
76
  /**
130
77
  * Rotator view embedded in the contextual balloon.
131
78
  * Displays the currently visible view in the balloon and provides navigation for switching stacks.
132
- *
133
- * @private
134
- * @type {module:ui/panel/balloon/contextualballoon~RotatorView}
135
79
  */
136
80
  this._rotatorView = null;
137
81
  /**
138
82
  * Displays fake panels under the balloon panel view when multiple stacks are added to the balloon.
139
- *
140
- * @private
141
- * @type {module:ui/view~View}
142
83
  */
143
84
  this._fakePanelsView = null;
85
+ this.positionLimiter = () => {
86
+ const view = this.editor.editing.view;
87
+ const viewDocument = view.document;
88
+ const editableElement = viewDocument.selection.editableElement;
89
+ if (editableElement) {
90
+ return view.domConverter.mapViewToDom(editableElement.root);
91
+ }
92
+ return null;
93
+ };
94
+ this.set('visibleView', null);
95
+ this.set('_numberOfStacks', 0);
96
+ this.set('_singleViewMode', false);
144
97
  }
145
98
  /**
146
99
  * @inheritDoc
@@ -168,9 +121,6 @@ export default class ContextualBalloon extends Plugin {
168
121
  }
169
122
  /**
170
123
  * Returns `true` when the given view is in one of the stacks. Otherwise returns `false`.
171
- *
172
- * @param {module:ui/view~View} view
173
- * @returns {Boolean}
174
124
  */
175
125
  hasView(view) {
176
126
  return Array.from(this._viewToStack.keys()).includes(view);
@@ -179,13 +129,13 @@ export default class ContextualBalloon extends Plugin {
179
129
  * Adds a new view to the stack and makes it visible if the current stack is visible
180
130
  * or it is the first view in the balloon.
181
131
  *
182
- * @param {Object} data The configuration of the view.
183
- * @param {String} [data.stackId='main'] The ID of the stack that the view is added to.
184
- * @param {module:ui/view~View} [data.view] The content of the balloon.
185
- * @param {module:utils/dom/position~Options} [data.position] Positioning options.
186
- * @param {String} [data.balloonClassName] An additional CSS class added to the {@link #view balloon} when visible.
187
- * @param {Boolean} [data.withArrow=true] Whether the {@link #view balloon} should be rendered with an arrow.
188
- * @param {Boolean} [data.singleViewMode=false] Whether the view should be the only visible view even if other stacks were added.
132
+ * @param data The configuration of the view.
133
+ * @param data.stackId The ID of the stack that the view is added to. Defaults to `'main'`.
134
+ * @param data.view The content of the balloon.
135
+ * @param data.position Positioning options.
136
+ * @param data.balloonClassName An additional CSS class added to the {@link #view balloon} when visible.
137
+ * @param data.withArrow Whether the {@link #view balloon} should be rendered with an arrow. Defaults to `true`.
138
+ * @param data.singleViewMode Whether the view should be the only visible view even if other stacks were added. Defaults to `false`.
189
139
  */
190
140
  add(data) {
191
141
  if (!this._view) {
@@ -228,7 +178,7 @@ export default class ContextualBalloon extends Plugin {
228
178
  * When there is no view in the stack, the next stack will be displayed.
229
179
  * When there are no more stacks, the balloon will hide.
230
180
  *
231
- * @param {module:ui/view~View} view A view to be removed from the balloon.
181
+ * @param view A view to be removed from the balloon.
232
182
  */
233
183
  remove(view) {
234
184
  if (!this.hasView(view)) {
@@ -273,7 +223,7 @@ export default class ContextualBalloon extends Plugin {
273
223
  * Updates the position of the balloon using the position data of the first visible view in the stack.
274
224
  * When new position data is given, the position data of the currently visible view will be updated.
275
225
  *
276
- * @param {module:utils/dom/position~Options} [position] position options.
226
+ * @param position Position options.
277
227
  */
278
228
  updatePosition(position) {
279
229
  if (position) {
@@ -284,8 +234,6 @@ export default class ContextualBalloon extends Plugin {
284
234
  }
285
235
  /**
286
236
  * Shows the last view from the stack of a given ID.
287
- *
288
- * @param {String} id
289
237
  */
290
238
  showStack(id) {
291
239
  this.visibleStack = id;
@@ -315,19 +263,12 @@ export default class ContextualBalloon extends Plugin {
315
263
  }
316
264
  /**
317
265
  * Returns the stack of the currently visible view.
318
- *
319
- * @private
320
- * @type {Set}
321
266
  */
322
267
  get _visibleStack() {
323
268
  return this._viewToStack.get(this.visibleView);
324
269
  }
325
270
  /**
326
271
  * Returns the ID of the given stack.
327
- *
328
- * @private
329
- * @param {Set} stack
330
- * @returns {String}
331
272
  */
332
273
  _getStackId(stack) {
333
274
  const entry = Array.from(this._idToStack.entries()).find(entry => entry[1] === stack);
@@ -335,8 +276,6 @@ export default class ContextualBalloon extends Plugin {
335
276
  }
336
277
  /**
337
278
  * Shows the last view from the next stack.
338
- *
339
- * @private
340
279
  */
341
280
  _showNextStack() {
342
281
  const stacks = Array.from(this._idToStack.values());
@@ -348,8 +287,6 @@ export default class ContextualBalloon extends Plugin {
348
287
  }
349
288
  /**
350
289
  * Shows the last view from the previous stack.
351
- *
352
- * @private
353
290
  */
354
291
  _showPrevStack() {
355
292
  const stacks = Array.from(this._idToStack.values());
@@ -361,9 +298,6 @@ export default class ContextualBalloon extends Plugin {
361
298
  }
362
299
  /**
363
300
  * Creates a rotator view.
364
- *
365
- * @private
366
- * @returns {module:ui/panel/balloon/contextualballoon~RotatorView}
367
301
  */
368
302
  _createRotatorView() {
369
303
  const view = new RotatorView(this.editor.locale);
@@ -402,8 +336,7 @@ export default class ContextualBalloon extends Plugin {
402
336
  return view;
403
337
  }
404
338
  /**
405
- * @private
406
- * @returns {module:ui/view~View}
339
+ * Creates a fake panels view.
407
340
  */
408
341
  _createFakePanelsView() {
409
342
  const view = new FakePanelsView(this.editor.locale, this.view);
@@ -420,11 +353,10 @@ export default class ContextualBalloon extends Plugin {
420
353
  * Sets the view as the content of the balloon and attaches the balloon using position
421
354
  * options of the first view.
422
355
  *
423
- * @private
424
- * @param {Object} data Configuration.
425
- * @param {module:ui/view~View} [data.view] The view to show in the balloon.
426
- * @param {String} [data.balloonClassName=''] Additional class name which will be added to the {@link #view balloon}.
427
- * @param {Boolean} [data.withArrow=true] Whether the {@link #view balloon} should be rendered with an arrow.
356
+ * @param data Configuration.
357
+ * @param data.view The view to show in the balloon.
358
+ * @param data.balloonClassName Additional class name which will be added to the {@link #view balloon}.
359
+ * @param data.withArrow Whether the {@link #view balloon} should be rendered with an arrow.
428
360
  */
429
361
  _showView({ view, balloonClassName = '', withArrow = true, singleViewMode = false }) {
430
362
  this.view.class = balloonClassName;
@@ -440,9 +372,6 @@ export default class ContextualBalloon extends Plugin {
440
372
  /**
441
373
  * Returns position options of the last view in the stack.
442
374
  * This keeps the balloon in the same position when the view is changed.
443
- *
444
- * @private
445
- * @returns {module:utils/dom/position~Options}
446
375
  */
447
376
  _getBalloonPosition() {
448
377
  let position = Array.from(this._visibleStack.values()).pop().position;
@@ -466,10 +395,8 @@ export default class ContextualBalloon extends Plugin {
466
395
  * Rotator view is a helper class for the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon ContextualBalloon}.
467
396
  * It is used for displaying the last view from the current stack and providing navigation buttons for switching stacks.
468
397
  * See the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon ContextualBalloon} documentation to learn more.
469
- *
470
- * @extends module:ui/view~View
471
398
  */
472
- class RotatorView extends View {
399
+ export class RotatorView extends View {
473
400
  /**
474
401
  * @inheritDoc
475
402
  */
@@ -477,36 +404,10 @@ class RotatorView extends View {
477
404
  super(locale);
478
405
  const t = locale.t;
479
406
  const bind = this.bindTemplate;
480
- /**
481
- * Defines whether navigation is visible or not.
482
- *
483
- * @member {Boolean} #isNavigationVisible
484
- */
485
407
  this.set('isNavigationVisible', true);
486
- /**
487
- * Used for checking if a view is focused or not.
488
- *
489
- * @type {module:utils/focustracker~FocusTracker}
490
- */
491
408
  this.focusTracker = new FocusTracker();
492
- /**
493
- * Navigation button for switching the stack to the previous one.
494
- *
495
- * @type {module:ui/button/buttonview~ButtonView}
496
- */
497
409
  this.buttonPrevView = this._createButtonView(t('Previous'), prevIcon);
498
- /**
499
- * Navigation button for switching the stack to the next one.
500
- *
501
- * @type {module:ui/button/buttonview~ButtonView}
502
- */
503
410
  this.buttonNextView = this._createButtonView(t('Next'), nextIcon);
504
- /**
505
- * A collection of the child views that creates the rotator content.
506
- *
507
- * @readonly
508
- * @type {module:ui/viewcollection~ViewCollection}
509
- */
510
411
  this.content = this.createCollection();
511
412
  this.setTemplate({
512
413
  tag: 'div',
@@ -571,7 +472,7 @@ class RotatorView extends View {
571
472
  /**
572
473
  * Shows a given view.
573
474
  *
574
- * @param {module:ui/view~View} view The view to show.
475
+ * @param view The view to show.
575
476
  */
576
477
  showView(view) {
577
478
  this.hideView();
@@ -586,10 +487,8 @@ class RotatorView extends View {
586
487
  /**
587
488
  * Creates a navigation button view.
588
489
  *
589
- * @private
590
- * @param {String} label The button label.
591
- * @param {String} icon The button icon.
592
- * @returns {module:ui/button/buttonview~ButtonView}
490
+ * @param label The button label.
491
+ * @param icon The button icon.
593
492
  */
594
493
  _createButtonView(label, icon) {
595
494
  const view = new ButtonView(this.locale);
@@ -601,49 +500,22 @@ class RotatorView extends View {
601
500
  return view;
602
501
  }
603
502
  }
604
- // Displays additional layers under the balloon when multiple stacks are added to the balloon.
605
- //
606
- // @private
607
- // @extends module:ui/view~View
503
+ /**
504
+ * Displays additional layers under the balloon when multiple stacks are added to the balloon.
505
+ */
608
506
  class FakePanelsView extends View {
609
- // @inheritDoc
507
+ /**
508
+ * @inheritDoc
509
+ */
610
510
  constructor(locale, balloonPanelView) {
611
511
  super(locale);
612
512
  const bind = this.bindTemplate;
613
- // Fake panels top offset.
614
- //
615
- // @observable
616
- // @member {Number} #top
617
513
  this.set('top', 0);
618
- // Fake panels left offset.
619
- //
620
- // @observable
621
- // @member {Number} #left
622
514
  this.set('left', 0);
623
- // Fake panels height.
624
- //
625
- // @observable
626
- // @member {Number} #height
627
515
  this.set('height', 0);
628
- // Fake panels width.
629
- //
630
- // @observable
631
- // @member {Number} #width
632
516
  this.set('width', 0);
633
- // Number of rendered fake panels.
634
- //
635
- // @observable
636
- // @member {Number} #numberOfPanels
637
517
  this.set('numberOfPanels', 0);
638
- // Collection of the child views which creates fake panel content.
639
- //
640
- // @readonly
641
- // @type {module:ui/viewcollection~ViewCollection}
642
518
  this.content = this.createCollection();
643
- // Context.
644
- //
645
- // @private
646
- // @type {module:ui/panel/balloon/balloonpanelview~BalloonPanelView}
647
519
  this._balloonPanelView = balloonPanelView;
648
520
  this.setTemplate({
649
521
  tag: 'div',
@@ -671,8 +543,6 @@ class FakePanelsView extends View {
671
543
  this.updatePosition();
672
544
  });
673
545
  }
674
- // @private
675
- // @param {Number} number
676
546
  _addPanels(number) {
677
547
  while (number--) {
678
548
  const view = new View();
@@ -681,8 +551,6 @@ class FakePanelsView extends View {
681
551
  this.registerChild(view);
682
552
  }
683
553
  }
684
- // @private
685
- // @param {Number} number
686
554
  _removePanels(number) {
687
555
  while (number--) {
688
556
  const view = this.content.last;
@@ -691,7 +559,9 @@ class FakePanelsView extends View {
691
559
  view.destroy();
692
560
  }
693
561
  }
694
- // Updates coordinates of fake panels.
562
+ /**
563
+ * Updates coordinates of fake panels.
564
+ */
695
565
  updatePosition() {
696
566
  if (this.numberOfPanels) {
697
567
  const { top, left } = this._balloonPanelView;
@@ -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:ui/editorui/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();