@ckeditor/ckeditor5-ui 47.6.1 → 48.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 (367) hide show
  1. package/LICENSE.md +1 -1
  2. package/ckeditor5-metadata.json +3 -3
  3. package/{src → dist}/colorselector/documentcolorcollection.d.ts +4 -4
  4. package/{src → dist}/dialog/dialog.d.ts +1 -1
  5. package/dist/index-editor.css +2728 -587
  6. package/dist/index.css +2673 -850
  7. package/dist/index.css.map +1 -1
  8. package/dist/index.js +11 -1
  9. package/dist/index.js.map +1 -1
  10. package/{src → dist}/menubar/menubarmenuview.d.ts +4 -0
  11. package/{src → dist}/view.d.ts +1 -1
  12. package/package.json +25 -47
  13. package/lang/contexts.json +0 -51
  14. package/lang/translations/af.po +0 -208
  15. package/lang/translations/ar.po +0 -208
  16. package/lang/translations/ast.po +0 -208
  17. package/lang/translations/az.po +0 -208
  18. package/lang/translations/be.po +0 -208
  19. package/lang/translations/bg.po +0 -208
  20. package/lang/translations/bn.po +0 -208
  21. package/lang/translations/bs.po +0 -208
  22. package/lang/translations/ca.po +0 -208
  23. package/lang/translations/cs.po +0 -208
  24. package/lang/translations/da.po +0 -208
  25. package/lang/translations/de-ch.po +0 -208
  26. package/lang/translations/de.po +0 -208
  27. package/lang/translations/el.po +0 -208
  28. package/lang/translations/en-au.po +0 -208
  29. package/lang/translations/en-gb.po +0 -208
  30. package/lang/translations/en.po +0 -208
  31. package/lang/translations/eo.po +0 -208
  32. package/lang/translations/es-co.po +0 -208
  33. package/lang/translations/es.po +0 -208
  34. package/lang/translations/et.po +0 -208
  35. package/lang/translations/eu.po +0 -208
  36. package/lang/translations/fa.po +0 -208
  37. package/lang/translations/fi.po +0 -208
  38. package/lang/translations/fr.po +0 -208
  39. package/lang/translations/gl.po +0 -208
  40. package/lang/translations/gu.po +0 -208
  41. package/lang/translations/he.po +0 -208
  42. package/lang/translations/hi.po +0 -208
  43. package/lang/translations/hr.po +0 -208
  44. package/lang/translations/hu.po +0 -208
  45. package/lang/translations/hy.po +0 -208
  46. package/lang/translations/id.po +0 -208
  47. package/lang/translations/it.po +0 -208
  48. package/lang/translations/ja.po +0 -208
  49. package/lang/translations/jv.po +0 -208
  50. package/lang/translations/kk.po +0 -208
  51. package/lang/translations/km.po +0 -208
  52. package/lang/translations/kn.po +0 -208
  53. package/lang/translations/ko.po +0 -208
  54. package/lang/translations/ku.po +0 -208
  55. package/lang/translations/lt.po +0 -208
  56. package/lang/translations/lv.po +0 -208
  57. package/lang/translations/ms.po +0 -208
  58. package/lang/translations/nb.po +0 -208
  59. package/lang/translations/ne.po +0 -208
  60. package/lang/translations/nl.po +0 -208
  61. package/lang/translations/no.po +0 -208
  62. package/lang/translations/oc.po +0 -208
  63. package/lang/translations/pl.po +0 -208
  64. package/lang/translations/pt-br.po +0 -208
  65. package/lang/translations/pt.po +0 -208
  66. package/lang/translations/ro.po +0 -208
  67. package/lang/translations/ru.po +0 -208
  68. package/lang/translations/si.po +0 -208
  69. package/lang/translations/sk.po +0 -208
  70. package/lang/translations/sl.po +0 -208
  71. package/lang/translations/sq.po +0 -208
  72. package/lang/translations/sr-latn.po +0 -208
  73. package/lang/translations/sr.po +0 -208
  74. package/lang/translations/sv.po +0 -208
  75. package/lang/translations/th.po +0 -208
  76. package/lang/translations/ti.po +0 -208
  77. package/lang/translations/tk.po +0 -208
  78. package/lang/translations/tr.po +0 -208
  79. package/lang/translations/tt.po +0 -208
  80. package/lang/translations/ug.po +0 -208
  81. package/lang/translations/uk.po +0 -208
  82. package/lang/translations/ur.po +0 -208
  83. package/lang/translations/uz.po +0 -208
  84. package/lang/translations/vi.po +0 -208
  85. package/lang/translations/zh-cn.po +0 -208
  86. package/lang/translations/zh.po +0 -208
  87. package/src/arialiveannouncer.js +0 -189
  88. package/src/augmentation.js +0 -5
  89. package/src/autocomplete/autocompleteview.js +0 -157
  90. package/src/badge/badge.js +0 -226
  91. package/src/bindings/addkeyboardhandlingforgrid.js +0 -107
  92. package/src/bindings/clickoutsidehandler.js +0 -36
  93. package/src/bindings/csstransitiondisablermixin.js +0 -58
  94. package/src/bindings/draggableviewmixin.js +0 -144
  95. package/src/bindings/preventdefault.js +0 -35
  96. package/src/bindings/submithandler.js +0 -47
  97. package/src/button/button.js +0 -5
  98. package/src/button/buttonlabel.js +0 -5
  99. package/src/button/buttonlabelview.js +0 -42
  100. package/src/button/buttonview.js +0 -278
  101. package/src/button/filedialogbuttonview.js +0 -147
  102. package/src/button/listitembuttonview.js +0 -136
  103. package/src/button/switchbuttonview.js +0 -79
  104. package/src/collapsible/collapsibleview.js +0 -106
  105. package/src/colorgrid/colorgridview.js +0 -140
  106. package/src/colorgrid/colortileview.js +0 -42
  107. package/src/colorgrid/utils.js +0 -84
  108. package/src/colorpicker/colorpickerview.js +0 -356
  109. package/src/colorpicker/utils.js +0 -108
  110. package/src/colorselector/colorgridsfragmentview.js +0 -368
  111. package/src/colorselector/colorpickerfragmentview.js +0 -254
  112. package/src/colorselector/colorselectorview.js +0 -294
  113. package/src/colorselector/documentcolorcollection.js +0 -42
  114. package/src/componentfactory.js +0 -108
  115. package/src/dialog/dialog.js +0 -325
  116. package/src/dialog/dialogactionsview.js +0 -118
  117. package/src/dialog/dialogcontentview.js +0 -39
  118. package/src/dialog/dialogview.js +0 -507
  119. package/src/dropdown/button/dropdownbutton.js +0 -5
  120. package/src/dropdown/button/dropdownbuttonview.js +0 -70
  121. package/src/dropdown/button/splitbuttonview.js +0 -178
  122. package/src/dropdown/dropdownpanelfocusable.js +0 -5
  123. package/src/dropdown/dropdownpanelview.js +0 -106
  124. package/src/dropdown/dropdownview.js +0 -438
  125. package/src/dropdown/menu/dropdownmenubehaviors.js +0 -125
  126. package/src/dropdown/menu/dropdownmenubuttonview.js +0 -69
  127. package/src/dropdown/menu/dropdownmenulistitembuttonview.js +0 -30
  128. package/src/dropdown/menu/dropdownmenulistitemview.js +0 -38
  129. package/src/dropdown/menu/dropdownmenulistview.js +0 -29
  130. package/src/dropdown/menu/dropdownmenunestedmenupanelview.js +0 -63
  131. package/src/dropdown/menu/dropdownmenunestedmenuview.js +0 -214
  132. package/src/dropdown/menu/dropdownmenurootlistview.js +0 -168
  133. package/src/dropdown/menu/utils.js +0 -61
  134. package/src/dropdown/utils.js +0 -654
  135. package/src/editableui/editableuiview.js +0 -130
  136. package/src/editableui/inline/inlineeditableuiview.js +0 -75
  137. package/src/editorui/accessibilityhelp/accessibilityhelp.js +0 -142
  138. package/src/editorui/accessibilityhelp/accessibilityhelpcontentview.js +0 -112
  139. package/src/editorui/bodycollection.js +0 -128
  140. package/src/editorui/boxed/boxededitoruiview.js +0 -95
  141. package/src/editorui/editorui.js +0 -586
  142. package/src/editorui/editoruiview.js +0 -60
  143. package/src/editorui/evaluationbadge.js +0 -99
  144. package/src/editorui/poweredby.js +0 -120
  145. package/src/focuscycler.js +0 -383
  146. package/src/formheader/formheaderview.js +0 -77
  147. package/src/formrow/formrowview.js +0 -56
  148. package/src/highlightedtext/buttonlabelwithhighlightview.js +0 -31
  149. package/src/highlightedtext/highlightedtextview.js +0 -102
  150. package/src/highlightedtext/labelwithhighlightview.js +0 -37
  151. package/src/icon/iconview.js +0 -123
  152. package/src/iframe/iframeview.js +0 -63
  153. package/src/index.js +0 -132
  154. package/src/input/inputbase.js +0 -119
  155. package/src/input/inputview.js +0 -24
  156. package/src/inputnumber/inputnumberview.js +0 -40
  157. package/src/inputtext/inputtextview.js +0 -27
  158. package/src/label/labelview.js +0 -46
  159. package/src/labeledfield/labeledfieldview.js +0 -177
  160. package/src/labeledfield/utils.js +0 -176
  161. package/src/labeledinput/labeledinputview.js +0 -138
  162. package/src/legacyerrors.js +0 -20
  163. package/src/list/listitemgroupview.js +0 -82
  164. package/src/list/listitemview.js +0 -46
  165. package/src/list/listseparatorview.js +0 -28
  166. package/src/list/listview.js +0 -210
  167. package/src/menubar/menubarmenubuttonview.js +0 -68
  168. package/src/menubar/menubarmenulistitembuttonview.js +0 -30
  169. package/src/menubar/menubarmenulistitemfiledialogbuttonview.js +0 -32
  170. package/src/menubar/menubarmenulistitemview.js +0 -34
  171. package/src/menubar/menubarmenulistview.js +0 -72
  172. package/src/menubar/menubarmenupanelview.js +0 -64
  173. package/src/menubar/menubarmenuview.js +0 -198
  174. package/src/menubar/menubarview.js +0 -281
  175. package/src/menubar/utils.js +0 -1432
  176. package/src/model.js +0 -31
  177. package/src/notification/notification.js +0 -192
  178. package/src/panel/balloon/balloonpanelview.js +0 -1077
  179. package/src/panel/balloon/contextualballoon.js +0 -616
  180. package/src/panel/sticky/stickypanelview.js +0 -246
  181. package/src/search/filteredview.js +0 -5
  182. package/src/search/filtergroupanditemnames.js +0 -38
  183. package/src/search/searchinfoview.js +0 -59
  184. package/src/search/searchresultsview.js +0 -83
  185. package/src/search/text/searchtextqueryview.js +0 -87
  186. package/src/search/text/searchtextview.js +0 -242
  187. package/src/spinner/spinnerview.js +0 -38
  188. package/src/template.js +0 -1396
  189. package/src/textarea/textareaview.js +0 -189
  190. package/src/toolbar/balloon/balloontoolbar.js +0 -358
  191. package/src/toolbar/block/blockbuttonview.js +0 -41
  192. package/src/toolbar/block/blocktoolbar.js +0 -507
  193. package/src/toolbar/normalizetoolbarconfig.js +0 -52
  194. package/src/toolbar/toolbarlinebreakview.js +0 -28
  195. package/src/toolbar/toolbarseparatorview.js +0 -28
  196. package/src/toolbar/toolbarview.js +0 -873
  197. package/src/tooltipmanager.js +0 -454
  198. package/src/view.js +0 -471
  199. package/src/viewcollection.js +0 -210
  200. package/theme/components/arialiveannouncer/arialiveannouncer.css +0 -14
  201. package/theme/components/autocomplete/autocomplete.css +0 -22
  202. package/theme/components/button/button.css +0 -39
  203. package/theme/components/button/listitembutton.css +0 -48
  204. package/theme/components/button/switchbutton.css +0 -14
  205. package/theme/components/collapsible/collapsible.css +0 -10
  206. package/theme/components/colorgrid/colorgrid.css +0 -8
  207. package/theme/components/colorpicker/colorpicker.css +0 -34
  208. package/theme/components/colorselector/colorselector.css +0 -35
  209. package/theme/components/dialog/dialog.css +0 -42
  210. package/theme/components/dialog/dialogactions.css +0 -11
  211. package/theme/components/dropdown/dropdown.css +0 -95
  212. package/theme/components/dropdown/listdropdown.css +0 -10
  213. package/theme/components/dropdown/menu/dropdownmenu.css +0 -8
  214. package/theme/components/dropdown/menu/dropdownmenubutton.css +0 -9
  215. package/theme/components/dropdown/menu/dropdownmenulistitem.css +0 -10
  216. package/theme/components/dropdown/menu/dropdownmenulistitembutton.css +0 -10
  217. package/theme/components/dropdown/menu/dropdownmenupanel.css +0 -11
  218. package/theme/components/dropdown/splitbutton.css +0 -14
  219. package/theme/components/dropdown/toolbardropdown.css +0 -20
  220. package/theme/components/editorui/accessibilityhelp.css +0 -10
  221. package/theme/components/editorui/editorui.css +0 -10
  222. package/theme/components/form/form.css +0 -87
  223. package/theme/components/formheader/formheader.css +0 -18
  224. package/theme/components/formrow/formrow.css +0 -32
  225. package/theme/components/highlightedtext/highlightedtext.css +0 -12
  226. package/theme/components/icon/icon.css +0 -8
  227. package/theme/components/input/input.css +0 -10
  228. package/theme/components/label/label.css +0 -12
  229. package/theme/components/labeledfield/labeledfieldview.css +0 -16
  230. package/theme/components/labeledinput/labeledinput.css +0 -10
  231. package/theme/components/list/list.css +0 -26
  232. package/theme/components/menubar/menubar.css +0 -10
  233. package/theme/components/menubar/menubarmenu.css +0 -9
  234. package/theme/components/menubar/menubarmenubutton.css +0 -11
  235. package/theme/components/menubar/menubarmenulistitem.css +0 -10
  236. package/theme/components/menubar/menubarmenulistitembutton.css +0 -10
  237. package/theme/components/menubar/menubarmenupanel.css +0 -62
  238. package/theme/components/panel/balloonpanel.css +0 -56
  239. package/theme/components/panel/balloonrotator.css +0 -17
  240. package/theme/components/panel/fakepanel.css +0 -23
  241. package/theme/components/panel/stickypanel.css +0 -17
  242. package/theme/components/responsive-form/responsiveform.css +0 -42
  243. package/theme/components/search/search.css +0 -43
  244. package/theme/components/spinner/spinner.css +0 -23
  245. package/theme/components/textarea/textarea.css +0 -10
  246. package/theme/components/toolbar/blocktoolbar.css +0 -9
  247. package/theme/components/toolbar/toolbar.css +0 -58
  248. package/theme/components/tooltip/tooltip.css +0 -12
  249. package/theme/globals/_evaluationbadge.css +0 -54
  250. package/theme/globals/_hidden.css +0 -13
  251. package/theme/globals/_poweredby.css +0 -84
  252. package/theme/globals/_transition.css +0 -12
  253. package/theme/globals/_zindex.css +0 -10
  254. package/theme/globals/globals.css +0 -10
  255. package/theme/mixins/_dir.css +0 -10
  256. package/theme/mixins/_mediacolors.css +0 -20
  257. package/theme/mixins/_rwd.css +0 -10
  258. package/theme/mixins/_unselectable.css +0 -14
  259. /package/{src → dist}/arialiveannouncer.d.ts +0 -0
  260. /package/{src → dist}/augmentation.d.ts +0 -0
  261. /package/{src → dist}/autocomplete/autocompleteview.d.ts +0 -0
  262. /package/{src → dist}/badge/badge.d.ts +0 -0
  263. /package/{src → dist}/bindings/addkeyboardhandlingforgrid.d.ts +0 -0
  264. /package/{src → dist}/bindings/clickoutsidehandler.d.ts +0 -0
  265. /package/{src → dist}/bindings/csstransitiondisablermixin.d.ts +0 -0
  266. /package/{src → dist}/bindings/draggableviewmixin.d.ts +0 -0
  267. /package/{src → dist}/bindings/preventdefault.d.ts +0 -0
  268. /package/{src → dist}/bindings/submithandler.d.ts +0 -0
  269. /package/{src → dist}/button/button.d.ts +0 -0
  270. /package/{src → dist}/button/buttonlabel.d.ts +0 -0
  271. /package/{src → dist}/button/buttonlabelview.d.ts +0 -0
  272. /package/{src → dist}/button/buttonview.d.ts +0 -0
  273. /package/{src → dist}/button/filedialogbuttonview.d.ts +0 -0
  274. /package/{src → dist}/button/listitembuttonview.d.ts +0 -0
  275. /package/{src → dist}/button/switchbuttonview.d.ts +0 -0
  276. /package/{src → dist}/collapsible/collapsibleview.d.ts +0 -0
  277. /package/{src → dist}/colorgrid/colorgridview.d.ts +0 -0
  278. /package/{src → dist}/colorgrid/colortileview.d.ts +0 -0
  279. /package/{src → dist}/colorgrid/utils.d.ts +0 -0
  280. /package/{src → dist}/colorpicker/colorpickerview.d.ts +0 -0
  281. /package/{src → dist}/colorpicker/utils.d.ts +0 -0
  282. /package/{src → dist}/colorselector/colorgridsfragmentview.d.ts +0 -0
  283. /package/{src → dist}/colorselector/colorpickerfragmentview.d.ts +0 -0
  284. /package/{src → dist}/colorselector/colorselectorview.d.ts +0 -0
  285. /package/{src → dist}/componentfactory.d.ts +0 -0
  286. /package/{src → dist}/dialog/dialogactionsview.d.ts +0 -0
  287. /package/{src → dist}/dialog/dialogcontentview.d.ts +0 -0
  288. /package/{src → dist}/dialog/dialogview.d.ts +0 -0
  289. /package/{src → dist}/dropdown/button/dropdownbutton.d.ts +0 -0
  290. /package/{src → dist}/dropdown/button/dropdownbuttonview.d.ts +0 -0
  291. /package/{src → dist}/dropdown/button/splitbuttonview.d.ts +0 -0
  292. /package/{src → dist}/dropdown/dropdownpanelfocusable.d.ts +0 -0
  293. /package/{src → dist}/dropdown/dropdownpanelview.d.ts +0 -0
  294. /package/{src → dist}/dropdown/dropdownview.d.ts +0 -0
  295. /package/{src → dist}/dropdown/menu/dropdownmenubehaviors.d.ts +0 -0
  296. /package/{src → dist}/dropdown/menu/dropdownmenubuttonview.d.ts +0 -0
  297. /package/{src → dist}/dropdown/menu/dropdownmenulistitembuttonview.d.ts +0 -0
  298. /package/{src → dist}/dropdown/menu/dropdownmenulistitemview.d.ts +0 -0
  299. /package/{src → dist}/dropdown/menu/dropdownmenulistview.d.ts +0 -0
  300. /package/{src → dist}/dropdown/menu/dropdownmenunestedmenupanelview.d.ts +0 -0
  301. /package/{src → dist}/dropdown/menu/dropdownmenunestedmenuview.d.ts +0 -0
  302. /package/{src → dist}/dropdown/menu/dropdownmenurootlistview.d.ts +0 -0
  303. /package/{src → dist}/dropdown/menu/utils.d.ts +0 -0
  304. /package/{src → dist}/dropdown/utils.d.ts +0 -0
  305. /package/{src → dist}/editableui/editableuiview.d.ts +0 -0
  306. /package/{src → dist}/editableui/inline/inlineeditableuiview.d.ts +0 -0
  307. /package/{src → dist}/editorui/accessibilityhelp/accessibilityhelp.d.ts +0 -0
  308. /package/{src → dist}/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +0 -0
  309. /package/{src → dist}/editorui/bodycollection.d.ts +0 -0
  310. /package/{src → dist}/editorui/boxed/boxededitoruiview.d.ts +0 -0
  311. /package/{src → dist}/editorui/editorui.d.ts +0 -0
  312. /package/{src → dist}/editorui/editoruiview.d.ts +0 -0
  313. /package/{src → dist}/editorui/evaluationbadge.d.ts +0 -0
  314. /package/{src → dist}/editorui/poweredby.d.ts +0 -0
  315. /package/{src → dist}/focuscycler.d.ts +0 -0
  316. /package/{src → dist}/formheader/formheaderview.d.ts +0 -0
  317. /package/{src → dist}/formrow/formrowview.d.ts +0 -0
  318. /package/{src → dist}/highlightedtext/buttonlabelwithhighlightview.d.ts +0 -0
  319. /package/{src → dist}/highlightedtext/highlightedtextview.d.ts +0 -0
  320. /package/{src → dist}/highlightedtext/labelwithhighlightview.d.ts +0 -0
  321. /package/{src → dist}/icon/iconview.d.ts +0 -0
  322. /package/{src → dist}/iframe/iframeview.d.ts +0 -0
  323. /package/{src → dist}/index.d.ts +0 -0
  324. /package/{src → dist}/input/inputbase.d.ts +0 -0
  325. /package/{src → dist}/input/inputview.d.ts +0 -0
  326. /package/{src → dist}/inputnumber/inputnumberview.d.ts +0 -0
  327. /package/{src → dist}/inputtext/inputtextview.d.ts +0 -0
  328. /package/{src → dist}/label/labelview.d.ts +0 -0
  329. /package/{src → dist}/labeledfield/labeledfieldview.d.ts +0 -0
  330. /package/{src → dist}/labeledfield/utils.d.ts +0 -0
  331. /package/{src → dist}/labeledinput/labeledinputview.d.ts +0 -0
  332. /package/{src → dist}/legacyerrors.d.ts +0 -0
  333. /package/{src → dist}/list/listitemgroupview.d.ts +0 -0
  334. /package/{src → dist}/list/listitemview.d.ts +0 -0
  335. /package/{src → dist}/list/listseparatorview.d.ts +0 -0
  336. /package/{src → dist}/list/listview.d.ts +0 -0
  337. /package/{src → dist}/menubar/menubarmenubuttonview.d.ts +0 -0
  338. /package/{src → dist}/menubar/menubarmenulistitembuttonview.d.ts +0 -0
  339. /package/{src → dist}/menubar/menubarmenulistitemfiledialogbuttonview.d.ts +0 -0
  340. /package/{src → dist}/menubar/menubarmenulistitemview.d.ts +0 -0
  341. /package/{src → dist}/menubar/menubarmenulistview.d.ts +0 -0
  342. /package/{src → dist}/menubar/menubarmenupanelview.d.ts +0 -0
  343. /package/{src → dist}/menubar/menubarview.d.ts +0 -0
  344. /package/{src → dist}/menubar/utils.d.ts +0 -0
  345. /package/{src → dist}/model.d.ts +0 -0
  346. /package/{src → dist}/notification/notification.d.ts +0 -0
  347. /package/{src → dist}/panel/balloon/balloonpanelview.d.ts +0 -0
  348. /package/{src → dist}/panel/balloon/contextualballoon.d.ts +0 -0
  349. /package/{src → dist}/panel/sticky/stickypanelview.d.ts +0 -0
  350. /package/{src → dist}/search/filteredview.d.ts +0 -0
  351. /package/{src → dist}/search/filtergroupanditemnames.d.ts +0 -0
  352. /package/{src → dist}/search/searchinfoview.d.ts +0 -0
  353. /package/{src → dist}/search/searchresultsview.d.ts +0 -0
  354. /package/{src → dist}/search/text/searchtextqueryview.d.ts +0 -0
  355. /package/{src → dist}/search/text/searchtextview.d.ts +0 -0
  356. /package/{src → dist}/spinner/spinnerview.d.ts +0 -0
  357. /package/{src → dist}/template.d.ts +0 -0
  358. /package/{src → dist}/textarea/textareaview.d.ts +0 -0
  359. /package/{src → dist}/toolbar/balloon/balloontoolbar.d.ts +0 -0
  360. /package/{src → dist}/toolbar/block/blockbuttonview.d.ts +0 -0
  361. /package/{src → dist}/toolbar/block/blocktoolbar.d.ts +0 -0
  362. /package/{src → dist}/toolbar/normalizetoolbarconfig.d.ts +0 -0
  363. /package/{src → dist}/toolbar/toolbarlinebreakview.d.ts +0 -0
  364. /package/{src → dist}/toolbar/toolbarseparatorview.d.ts +0 -0
  365. /package/{src → dist}/toolbar/toolbarview.d.ts +0 -0
  366. /package/{src → dist}/tooltipmanager.d.ts +0 -0
  367. /package/{src → dist}/viewcollection.d.ts +0 -0
@@ -1,1077 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module ui/panel/balloon/balloonpanelview
7
- */
8
- import { View } from '../../view.js';
9
- import { getOptimalPosition, global, isRange, toUnit, isVisible, isText, ResizeObserver, Rect } from '@ckeditor/ckeditor5-utils';
10
- import { isElement } from 'es-toolkit/compat';
11
- import '../../../theme/components/panel/balloonpanel.css';
12
- const toPx = /* #__PURE__ */ toUnit('px');
13
- // A static balloon panel positioning function that moves the balloon far off the viewport.
14
- // It is used as a fallback when there is no way to position the balloon using provided
15
- // positioning functions (see: `getOptimalPosition()`), for instance, when the target the
16
- // balloon should be attached to gets obscured by scrollable containers or the viewport.
17
- //
18
- // It prevents the balloon from being attached to the void and possible degradation of the UX.
19
- // At the same time, it keeps the balloon physically visible in the DOM so the focus remains
20
- // uninterrupted.
21
- const POSITION_OFF_SCREEN = {
22
- top: -99999,
23
- left: -99999,
24
- name: 'arrowless',
25
- config: {
26
- withArrow: false
27
- }
28
- };
29
- /**
30
- * The balloon panel view class.
31
- *
32
- * A floating container which can
33
- * {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#pin pin} to any
34
- * {@link module:utils/dom/position~DomOptimalPositionOptions#target target} in the DOM and remain in that position
35
- * e.g. when the web page is scrolled.
36
- *
37
- * The balloon panel can be used to display contextual, non-blocking UI like forms, toolbars and
38
- * the like in its {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#content} view
39
- * collection.
40
- *
41
- * There is a number of {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}
42
- * that the balloon can use, automatically switching from one to another when the viewport space becomes
43
- * scarce to keep the balloon visible to the user as long as it is possible. The balloon will also
44
- * accept any custom position set provided by the user compatible with the
45
- * {@link module:utils/dom/position~DomOptimalPositionOptions options}.
46
- *
47
- * ```ts
48
- * const panel = new BalloonPanelView( locale );
49
- * const childView = new ChildView();
50
- * const positions = BalloonPanelView.defaultPositions;
51
- *
52
- * panel.render();
53
- *
54
- * // Add a child view to the panel's content collection.
55
- * panel.content.add( childView );
56
- *
57
- * // Start pinning the panel to an element with the "target" id DOM.
58
- * // The balloon will remain pinned until unpin() is called.
59
- * panel.pin( {
60
- * target: document.querySelector( '#target' ),
61
- * positions: [
62
- * positions.northArrowSouth,
63
- * positions.southArrowNorth
64
- * ]
65
- * } );
66
- * ```
67
- */
68
- export class BalloonPanelView extends View {
69
- /**
70
- * A collection of the child views that creates the balloon panel contents.
71
- */
72
- content;
73
- /**
74
- * A callback that starts pinning the panel when {@link #isVisible} gets
75
- * `true`. Used by {@link #pin}.
76
- *
77
- * @private
78
- */
79
- _pinWhenIsVisibleCallback;
80
- /**
81
- * An instance of resize observer used to detect if target element is still visible.
82
- */
83
- _resizeObserver;
84
- /**
85
- * @inheritDoc
86
- */
87
- constructor(locale) {
88
- super(locale);
89
- const bind = this.bindTemplate;
90
- this.set('top', 0);
91
- this.set('left', 0);
92
- this.set('position', 'arrow_nw');
93
- this.set('isVisible', false);
94
- this.set('withArrow', true);
95
- this.set('class', undefined);
96
- this._pinWhenIsVisibleCallback = null;
97
- this._resizeObserver = null;
98
- this.content = this.createCollection();
99
- this.setTemplate({
100
- tag: 'div',
101
- attributes: {
102
- class: [
103
- 'ck',
104
- 'ck-balloon-panel',
105
- bind.to('position', value => `ck-balloon-panel_${value}`),
106
- bind.if('isVisible', 'ck-balloon-panel_visible'),
107
- bind.if('withArrow', 'ck-balloon-panel_with-arrow'),
108
- bind.to('class')
109
- ],
110
- style: {
111
- top: bind.to('top', toPx),
112
- left: bind.to('left', toPx)
113
- }
114
- },
115
- children: this.content
116
- });
117
- }
118
- /**
119
- * @inheritDoc
120
- */
121
- destroy() {
122
- this.hide();
123
- super.destroy();
124
- }
125
- /**
126
- * Shows the panel.
127
- *
128
- * See {@link #isVisible}.
129
- */
130
- show() {
131
- this.isVisible = true;
132
- }
133
- /**
134
- * Hides the panel.
135
- *
136
- * See {@link #isVisible}.
137
- */
138
- hide() {
139
- this.isVisible = false;
140
- }
141
- /**
142
- * Attaches the panel to a specified {@link module:utils/dom/position~DomOptimalPositionOptions#target} with a
143
- * smart positioning heuristics that chooses from available positions to make sure the panel
144
- * is visible to the user i.e. within the limits of the viewport.
145
- *
146
- * This method accepts configuration {@link module:utils/dom/position~DomOptimalPositionOptions options}
147
- * to set the `target`, optional `limiter` and `positions` the balloon should choose from.
148
- *
149
- * ```ts
150
- * const panel = new BalloonPanelView( locale );
151
- * const positions = BalloonPanelView.defaultPositions;
152
- *
153
- * panel.render();
154
- *
155
- * // Attach the panel to an element with the "target" id DOM.
156
- * panel.attachTo( {
157
- * target: document.querySelector( '#target' ),
158
- * positions: [
159
- * positions.northArrowSouth,
160
- * positions.southArrowNorth
161
- * ]
162
- * } );
163
- * ```
164
- *
165
- * **Note**: Attaching the panel will also automatically {@link #show} it.
166
- *
167
- * **Note**: An attached panel will not follow its target when the window is scrolled or resized.
168
- * See the {@link #pin} method for a more permanent positioning strategy.
169
- *
170
- * @param options Positioning options compatible with {@link module:utils/dom/position~getOptimalPosition}.
171
- * Default `positions` array is {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}.
172
- * @returns Whether the balloon was shown and successfully attached or not. Attaching can fail if the target
173
- * provided in the options is invisible (e.g. element detached from DOM).
174
- */
175
- attachTo(options) {
176
- const target = getDomElement(options.target);
177
- if (target && !isVisible(target)) {
178
- return false;
179
- }
180
- this.show();
181
- const defaultPositions = BalloonPanelView.defaultPositions;
182
- const positionOptions = Object.assign({}, {
183
- element: this.element,
184
- positions: [
185
- defaultPositions.southArrowNorth,
186
- defaultPositions.southArrowNorthMiddleWest,
187
- defaultPositions.southArrowNorthMiddleEast,
188
- defaultPositions.southArrowNorthWest,
189
- defaultPositions.southArrowNorthEast,
190
- defaultPositions.northArrowSouth,
191
- defaultPositions.northArrowSouthMiddleWest,
192
- defaultPositions.northArrowSouthMiddleEast,
193
- defaultPositions.northArrowSouthWest,
194
- defaultPositions.northArrowSouthEast,
195
- defaultPositions.viewportStickyNorth
196
- ],
197
- limiter: global.document.body,
198
- fitInViewport: true
199
- }, options);
200
- const optimalPosition = BalloonPanelView._getOptimalPosition(positionOptions) || POSITION_OFF_SCREEN;
201
- // Usually browsers make some problems with super accurate values like 104.345px
202
- // so it is better to use int values.
203
- const left = parseInt(optimalPosition.left);
204
- const top = parseInt(optimalPosition.top);
205
- const position = optimalPosition.name;
206
- const config = optimalPosition.config || {};
207
- const { withArrow = true } = config;
208
- this.top = top;
209
- this.left = left;
210
- this.position = position;
211
- this.withArrow = withArrow;
212
- return true;
213
- }
214
- /**
215
- * Works the same way as the {@link #attachTo} method except that the position of the panel is
216
- * continuously updated when:
217
- *
218
- * * any ancestor of the {@link module:utils/dom/position~DomOptimalPositionOptions#target}
219
- * or {@link module:utils/dom/position~DomOptimalPositionOptions#limiter} is scrolled,
220
- * * the browser window gets resized or scrolled.
221
- *
222
- * Thanks to that, the panel always sticks to the {@link module:utils/dom/position~DomOptimalPositionOptions#target}
223
- * and is immune to the changing environment.
224
- *
225
- * ```ts
226
- * const panel = new BalloonPanelView( locale );
227
- * const positions = BalloonPanelView.defaultPositions;
228
- *
229
- * panel.render();
230
- *
231
- * // Pin the panel to an element with the "target" id DOM.
232
- * panel.pin( {
233
- * target: document.querySelector( '#target' ),
234
- * positions: [
235
- * positions.northArrowSouth,
236
- * positions.southArrowNorth
237
- * ]
238
- * } );
239
- * ```
240
- *
241
- * To leave the pinned state, use the {@link #unpin} method.
242
- *
243
- * **Note**: Pinning the panel will also automatically {@link #show} it.
244
- *
245
- * @param options Positioning options compatible with {@link module:utils/dom/position~getOptimalPosition}.
246
- * Default `positions` array is {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}.
247
- */
248
- pin(options) {
249
- this.unpin();
250
- if (!this._startPinning(options)) {
251
- return;
252
- }
253
- this._pinWhenIsVisibleCallback = () => {
254
- if (this.isVisible) {
255
- this._startPinning(options);
256
- }
257
- else {
258
- this._stopPinning();
259
- }
260
- };
261
- // Control the state of the listeners depending on whether the panel is visible
262
- // or not.
263
- // TODO: Use on() (https://github.com/ckeditor/ckeditor5-utils/issues/144).
264
- this.listenTo(this, 'change:isVisible', this._pinWhenIsVisibleCallback);
265
- }
266
- /**
267
- * Stops pinning the panel, as set up by {@link #pin}.
268
- */
269
- unpin() {
270
- if (this._pinWhenIsVisibleCallback) {
271
- // Deactivate listeners attached by pin().
272
- this._stopPinning();
273
- // Deactivate the panel pin() control logic.
274
- // TODO: Use off() (https://github.com/ckeditor/ckeditor5-utils/issues/144).
275
- this.stopListening(this, 'change:isVisible', this._pinWhenIsVisibleCallback);
276
- this._pinWhenIsVisibleCallback = null;
277
- this.hide();
278
- }
279
- }
280
- /**
281
- * Starts managing the pinned state of the panel. See {@link #pin}.
282
- *
283
- * @param options Positioning options compatible with {@link module:utils/dom/position~getOptimalPosition}.
284
- * @returns Whether the balloon was shown and successfully attached or not. Attaching can fail if the target
285
- * provided in the options is invisible (e.g. element detached from DOM).
286
- */
287
- _startPinning(options) {
288
- if (!this.attachTo(options)) {
289
- return false;
290
- }
291
- let targetElement = getDomElement(options.target);
292
- const limiterElement = options.limiter ? getDomElement(options.limiter) : global.document.body;
293
- // Then we need to listen on scroll event of eny element in the document.
294
- this.listenTo(global.document, 'scroll', (evt, domEvt) => {
295
- const scrollTarget = domEvt.target;
296
- // The position needs to be updated if the positioning target is within the scrolled element.
297
- const isWithinScrollTarget = targetElement && scrollTarget.contains(targetElement);
298
- // The position needs to be updated if the positioning limiter is within the scrolled element.
299
- const isLimiterWithinScrollTarget = limiterElement && scrollTarget.contains(limiterElement);
300
- // The positioning target and/or limiter can be a Rect, object etc..
301
- // There's no way to optimize the listener then.
302
- if (isWithinScrollTarget || isLimiterWithinScrollTarget || !targetElement || !limiterElement) {
303
- this.attachTo(options);
304
- }
305
- }, { useCapture: true });
306
- // We need to listen on window resize event and update position.
307
- this.listenTo(global.window, 'resize', () => {
308
- this.attachTo(options);
309
- });
310
- // Hide the panel if the target element is no longer visible.
311
- if (!this._resizeObserver) {
312
- // If the target element is a text node, we need to check the parent element.
313
- // It's because `ResizeObserver` accept only elements, not text nodes.
314
- if (targetElement && isText(targetElement)) {
315
- targetElement = targetElement.parentElement;
316
- }
317
- if (targetElement) {
318
- const checkVisibility = () => {
319
- // If the target element is no longer visible, hide the panel.
320
- if (!isVisible(targetElement)) {
321
- this.unpin();
322
- }
323
- };
324
- // Element is being resized to 0x0 after it's parent became hidden,
325
- // so we need to check size in order to determine if it's visible or not.
326
- this._resizeObserver = new ResizeObserver(targetElement, checkVisibility);
327
- }
328
- }
329
- return true;
330
- }
331
- /**
332
- * Stops managing the pinned state of the panel. See {@link #pin}.
333
- */
334
- _stopPinning() {
335
- this.stopListening(global.document, 'scroll');
336
- this.stopListening(global.window, 'resize');
337
- if (this._resizeObserver) {
338
- this._resizeObserver.destroy();
339
- this._resizeObserver = null;
340
- }
341
- }
342
- /**
343
- * Returns available {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView}
344
- * {@link module:utils/dom/position~PositioningFunction positioning functions} adjusted by the specific offsets.
345
- *
346
- * @internal
347
- * @param options Options to generate positions. If not specified, this helper will simply return
348
- * {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}.
349
- * @param options.sideOffset A custom side offset (in pixels) of each position. If
350
- * not specified, {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.arrowSideOffset the default value}
351
- * will be used.
352
- * @param options.heightOffset A custom height offset (in pixels) of each position. If
353
- * not specified, {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.arrowHeightOffset the default value}
354
- * will be used.
355
- * @param options.stickyVerticalOffset A custom offset (in pixels) of the `viewportStickyNorth` positioning function.
356
- * If not specified, {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.stickyVerticalOffset the default value}
357
- * will be used.
358
- * @param options.config Additional configuration of the balloon balloon panel view.
359
- * Currently only {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#withArrow} is supported. Learn more
360
- * about {@link module:utils/dom/position~PositioningFunction positioning functions}.
361
- */
362
- static generatePositions(options = {}) {
363
- const { sideOffset = BalloonPanelView.arrowSideOffset, heightOffset = BalloonPanelView.arrowHeightOffset, stickyVerticalOffset = BalloonPanelView.stickyVerticalOffset, config } = options;
364
- return {
365
- // ------- North west
366
- northWestArrowSouthWest: (targetRect, balloonRect) => ({
367
- top: getNorthTop(targetRect, balloonRect),
368
- left: targetRect.left - sideOffset,
369
- name: 'arrow_sw',
370
- ...(config && { config })
371
- }),
372
- northWestArrowSouthMiddleWest: (targetRect, balloonRect) => ({
373
- top: getNorthTop(targetRect, balloonRect),
374
- left: targetRect.left - (balloonRect.width * .25) - sideOffset,
375
- name: 'arrow_smw',
376
- ...(config && { config })
377
- }),
378
- northWestArrowSouth: (targetRect, balloonRect) => ({
379
- top: getNorthTop(targetRect, balloonRect),
380
- left: targetRect.left - balloonRect.width / 2,
381
- name: 'arrow_s',
382
- ...(config && { config })
383
- }),
384
- northWestArrowSouthMiddleEast: (targetRect, balloonRect) => ({
385
- top: getNorthTop(targetRect, balloonRect),
386
- left: targetRect.left - (balloonRect.width * .75) + sideOffset,
387
- name: 'arrow_sme',
388
- ...(config && { config })
389
- }),
390
- northWestArrowSouthEast: (targetRect, balloonRect) => ({
391
- top: getNorthTop(targetRect, balloonRect),
392
- left: targetRect.left - balloonRect.width + sideOffset,
393
- name: 'arrow_se',
394
- ...(config && { config })
395
- }),
396
- // ------- North
397
- northArrowSouthWest: (targetRect, balloonRect) => ({
398
- top: getNorthTop(targetRect, balloonRect),
399
- left: targetRect.left + targetRect.width / 2 - sideOffset,
400
- name: 'arrow_sw',
401
- ...(config && { config })
402
- }),
403
- northArrowSouthMiddleWest: (targetRect, balloonRect) => ({
404
- top: getNorthTop(targetRect, balloonRect),
405
- left: targetRect.left + targetRect.width / 2 - (balloonRect.width * .25) - sideOffset,
406
- name: 'arrow_smw',
407
- ...(config && { config })
408
- }),
409
- northArrowSouth: (targetRect, balloonRect) => ({
410
- top: getNorthTop(targetRect, balloonRect),
411
- left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2,
412
- name: 'arrow_s',
413
- ...(config && { config })
414
- }),
415
- northArrowSouthMiddleEast: (targetRect, balloonRect) => ({
416
- top: getNorthTop(targetRect, balloonRect),
417
- left: targetRect.left + targetRect.width / 2 - (balloonRect.width * .75) + sideOffset,
418
- name: 'arrow_sme',
419
- ...(config && { config })
420
- }),
421
- northArrowSouthEast: (targetRect, balloonRect) => ({
422
- top: getNorthTop(targetRect, balloonRect),
423
- left: targetRect.left + targetRect.width / 2 - balloonRect.width + sideOffset,
424
- name: 'arrow_se',
425
- ...(config && { config })
426
- }),
427
- // ------- North east
428
- northEastArrowSouthWest: (targetRect, balloonRect) => ({
429
- top: getNorthTop(targetRect, balloonRect),
430
- left: targetRect.right - sideOffset,
431
- name: 'arrow_sw',
432
- ...(config && { config })
433
- }),
434
- northEastArrowSouthMiddleWest: (targetRect, balloonRect) => ({
435
- top: getNorthTop(targetRect, balloonRect),
436
- left: targetRect.right - (balloonRect.width * .25) - sideOffset,
437
- name: 'arrow_smw',
438
- ...(config && { config })
439
- }),
440
- northEastArrowSouth: (targetRect, balloonRect) => ({
441
- top: getNorthTop(targetRect, balloonRect),
442
- left: targetRect.right - balloonRect.width / 2,
443
- name: 'arrow_s',
444
- ...(config && { config })
445
- }),
446
- northEastArrowSouthMiddleEast: (targetRect, balloonRect) => ({
447
- top: getNorthTop(targetRect, balloonRect),
448
- left: targetRect.right - (balloonRect.width * .75) + sideOffset,
449
- name: 'arrow_sme',
450
- ...(config && { config })
451
- }),
452
- northEastArrowSouthEast: (targetRect, balloonRect) => ({
453
- top: getNorthTop(targetRect, balloonRect),
454
- left: targetRect.right - balloonRect.width + sideOffset,
455
- name: 'arrow_se',
456
- ...(config && { config })
457
- }),
458
- // ------- South west
459
- southWestArrowNorthWest: targetRect => ({
460
- top: getSouthTop(targetRect),
461
- left: targetRect.left - sideOffset,
462
- name: 'arrow_nw',
463
- ...(config && { config })
464
- }),
465
- southWestArrowNorthMiddleWest: (targetRect, balloonRect) => ({
466
- top: getSouthTop(targetRect),
467
- left: targetRect.left - (balloonRect.width * .25) - sideOffset,
468
- name: 'arrow_nmw',
469
- ...(config && { config })
470
- }),
471
- southWestArrowNorth: (targetRect, balloonRect) => ({
472
- top: getSouthTop(targetRect),
473
- left: targetRect.left - balloonRect.width / 2,
474
- name: 'arrow_n',
475
- ...(config && { config })
476
- }),
477
- southWestArrowNorthMiddleEast: (targetRect, balloonRect) => ({
478
- top: getSouthTop(targetRect),
479
- left: targetRect.left - (balloonRect.width * .75) + sideOffset,
480
- name: 'arrow_nme',
481
- ...(config && { config })
482
- }),
483
- southWestArrowNorthEast: (targetRect, balloonRect) => ({
484
- top: getSouthTop(targetRect),
485
- left: targetRect.left - balloonRect.width + sideOffset,
486
- name: 'arrow_ne',
487
- ...(config && { config })
488
- }),
489
- // ------- South
490
- southArrowNorthWest: targetRect => ({
491
- top: getSouthTop(targetRect),
492
- left: targetRect.left + targetRect.width / 2 - sideOffset,
493
- name: 'arrow_nw',
494
- ...(config && { config })
495
- }),
496
- southArrowNorthMiddleWest: (targetRect, balloonRect) => ({
497
- top: getSouthTop(targetRect),
498
- left: targetRect.left + targetRect.width / 2 - (balloonRect.width * 0.25) - sideOffset,
499
- name: 'arrow_nmw',
500
- ...(config && { config })
501
- }),
502
- southArrowNorth: (targetRect, balloonRect) => ({
503
- top: getSouthTop(targetRect),
504
- left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2,
505
- name: 'arrow_n',
506
- ...(config && { config })
507
- }),
508
- southArrowNorthMiddleEast: (targetRect, balloonRect) => ({
509
- top: getSouthTop(targetRect),
510
- left: targetRect.left + targetRect.width / 2 - (balloonRect.width * 0.75) + sideOffset,
511
- name: 'arrow_nme',
512
- ...(config && { config })
513
- }),
514
- southArrowNorthEast: (targetRect, balloonRect) => ({
515
- top: getSouthTop(targetRect),
516
- left: targetRect.left + targetRect.width / 2 - balloonRect.width + sideOffset,
517
- name: 'arrow_ne',
518
- ...(config && { config })
519
- }),
520
- // ------- South east
521
- southEastArrowNorthWest: targetRect => ({
522
- top: getSouthTop(targetRect),
523
- left: targetRect.right - sideOffset,
524
- name: 'arrow_nw',
525
- ...(config && { config })
526
- }),
527
- southEastArrowNorthMiddleWest: (targetRect, balloonRect) => ({
528
- top: getSouthTop(targetRect),
529
- left: targetRect.right - (balloonRect.width * .25) - sideOffset,
530
- name: 'arrow_nmw',
531
- ...(config && { config })
532
- }),
533
- southEastArrowNorth: (targetRect, balloonRect) => ({
534
- top: getSouthTop(targetRect),
535
- left: targetRect.right - balloonRect.width / 2,
536
- name: 'arrow_n',
537
- ...(config && { config })
538
- }),
539
- southEastArrowNorthMiddleEast: (targetRect, balloonRect) => ({
540
- top: getSouthTop(targetRect),
541
- left: targetRect.right - (balloonRect.width * .75) + sideOffset,
542
- name: 'arrow_nme',
543
- ...(config && { config })
544
- }),
545
- southEastArrowNorthEast: (targetRect, balloonRect) => ({
546
- top: getSouthTop(targetRect),
547
- left: targetRect.right - balloonRect.width + sideOffset,
548
- name: 'arrow_ne',
549
- ...(config && { config })
550
- }),
551
- // ------- West
552
- westArrowEast: (targetRect, balloonRect) => ({
553
- top: targetRect.top + targetRect.height / 2 - balloonRect.height / 2,
554
- left: targetRect.left - balloonRect.width - heightOffset,
555
- name: 'arrow_e',
556
- ...(config && { config })
557
- }),
558
- // ------- East
559
- eastArrowWest: (targetRect, balloonRect) => ({
560
- top: targetRect.top + targetRect.height / 2 - balloonRect.height / 2,
561
- left: targetRect.right + heightOffset,
562
- name: 'arrow_w',
563
- ...(config && { config })
564
- }),
565
- // ------- Sticky
566
- viewportStickyNorth: (targetRect, balloonRect, viewportRect) => {
567
- // Get the intersection of the viewport and the document body.
568
- const boundaryRect = new Rect(global.document.body).getIntersection(viewportRect.getVisible());
569
- if (!boundaryRect) {
570
- return null;
571
- }
572
- // Get the visible intersection of the boundary and the document body.
573
- const visibleBoundaryRect = boundaryRect.getVisible();
574
- // Check if the target is in the boundary.
575
- if (!targetRect.getIntersection(visibleBoundaryRect)) {
576
- return null;
577
- }
578
- // Checks if there is enough space to put the balloon on the top or bottom of the target.
579
- // If not, makes the balloon sticky.
580
- if (!(visibleBoundaryRect.top - targetRect.top - stickyVerticalOffset < balloonRect.height &&
581
- visibleBoundaryRect.bottom - targetRect.bottom < balloonRect.height)) {
582
- return null;
583
- }
584
- return {
585
- top: visibleBoundaryRect.top + stickyVerticalOffset,
586
- left: targetRect.left + targetRect.width / 2 - balloonRect.width / 2,
587
- name: 'arrowless',
588
- config: {
589
- withArrow: false,
590
- ...config
591
- }
592
- };
593
- }
594
- };
595
- /**
596
- * Returns the top coordinate for positions starting with `north*`.
597
- *
598
- * @param targetRect A rect of the target.
599
- * @param balloonRect A rect of the balloon.
600
- */
601
- function getNorthTop(targetRect, balloonRect) {
602
- return targetRect.top - balloonRect.height - heightOffset;
603
- }
604
- /**
605
- * Returns the top coordinate for positions starting with `south*`.
606
- *
607
- * @param targetRect A rect of the target.
608
- */
609
- function getSouthTop(targetRect) {
610
- return targetRect.bottom + heightOffset;
611
- }
612
- }
613
- /**
614
- * A side offset of the arrow tip from the edge of the balloon. Controlled by CSS.
615
- *
616
- * ```
617
- * ┌───────────────────────┐
618
- * │ │
619
- * │ Balloon │
620
- * │ Content │
621
- * │ │
622
- * └──+ +───────────────┘
623
- * | \ /
624
- * | \/
625
- * >┼─────┼< ─────────────────────── side offset
626
- *
627
- * ```
628
- *
629
- * @default 25
630
- */
631
- static arrowSideOffset = 25;
632
- /**
633
- * A height offset of the arrow from the edge of the balloon. Controlled by CSS.
634
- *
635
- * ```
636
- * ┌───────────────────────┐
637
- * │ │
638
- * │ Balloon │
639
- * │ Content │ ╱-- arrow height offset
640
- * │ │ V
641
- * └──+ +───────────────┘ --- ─┼───────
642
- * \ / │
643
- * \/ │
644
- * ────────────────────────────────┼───────
645
- * ^
646
- *
647
- *
648
- * >┼────┼< arrow height offset
649
- * │ │
650
- * │ ┌────────────────────────┐
651
- * │ │ │
652
- * │ ╱ │
653
- * │ ╱ Balloon │
654
- * │ ╲ Content │
655
- * │ ╲ │
656
- * │ │ │
657
- * │ └────────────────────────┘
658
- * ```
659
- *
660
- * @default 10
661
- */
662
- static arrowHeightOffset = 10;
663
- /**
664
- * A vertical offset of the balloon panel from the edge of the viewport if sticky.
665
- * It helps in accessing toolbar buttons underneath the balloon panel.
666
- *
667
- * ```
668
- * ┌───────────────────────────────────────────────────┐
669
- * │ Target │
670
- * │ │
671
- * │ /── vertical offset │
672
- * ┌─────────────────────────────V─────────────────────────┐
673
- * │ Toolbar ┌─────────────┐ │
674
- * ├────────────────────│ Balloon │────────────────────┤
675
- * │ │ └─────────────┘ │ │
676
- * │ │ │ │
677
- * │ │ │ │
678
- * │ │ │ │
679
- * │ └───────────────────────────────────────────────────┘ │
680
- * │ Viewport │
681
- * └───────────────────────────────────────────────────────┘
682
- * ```
683
- *
684
- * @default 20
685
- */
686
- static stickyVerticalOffset = 20;
687
- /**
688
- * Function used to calculate the optimal position for the balloon.
689
- */
690
- static _getOptimalPosition = getOptimalPosition;
691
- /**
692
- * A default set of positioning functions used by the balloon panel view
693
- * when attaching using the {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#attachTo} method.
694
- *
695
- * The available positioning functions are as follows:
696
- *
697
- * **North west**
698
- *
699
- * * `northWestArrowSouthWest`
700
- *
701
- * ```
702
- * +-----------------+
703
- * | Balloon |
704
- * +-----------------+
705
- * V
706
- * [ Target ]
707
- * ```
708
- *
709
- * * `northWestArrowSouthMiddleWest`
710
- *
711
- * ```
712
- * +-----------------+
713
- * | Balloon |
714
- * +-----------------+
715
- * V
716
- * [ Target ]
717
- * ```
718
- *
719
- * * `northWestArrowSouth`
720
- *
721
- * ```
722
- * +-----------------+
723
- * | Balloon |
724
- * +-----------------+
725
- * V
726
- * [ Target ]
727
- * ```
728
- *
729
- * * `northWestArrowSouthMiddleEast`
730
- *
731
- * ```
732
- * +-----------------+
733
- * | Balloon |
734
- * +-----------------+
735
- * V
736
- * [ Target ]
737
- * ```
738
- *
739
- * * `northWestArrowSouthEast`
740
- *
741
- * ```
742
- * +-----------------+
743
- * | Balloon |
744
- * +-----------------+
745
- * V
746
- * [ Target ]
747
- * ```
748
- *
749
- * **North**
750
- *
751
- * * `northArrowSouthWest`
752
- *
753
- * ```
754
- * +-----------------+
755
- * | Balloon |
756
- * +-----------------+
757
- * V
758
- * [ Target ]
759
- * ```
760
- *
761
- * * `northArrowSouthMiddleWest`
762
- *
763
- * ```
764
- * +-----------------+
765
- * | Balloon |
766
- * +-----------------+
767
- * V
768
- * [ Target ]
769
- * ```
770
- * * `northArrowSouth`
771
- *
772
- * ```
773
- * +-----------------+
774
- * | Balloon |
775
- * +-----------------+
776
- * V
777
- * [ Target ]
778
- * ```
779
- *
780
- * * `northArrowSouthMiddleEast`
781
- *
782
- * ```
783
- * +-----------------+
784
- * | Balloon |
785
- * +-----------------+
786
- * V
787
- * [ Target ]
788
- * ```
789
- *
790
- * * `northArrowSouthEast`
791
- *
792
- * ```
793
- * +-----------------+
794
- * | Balloon |
795
- * +-----------------+
796
- * V
797
- * [ Target ]
798
- * ```
799
- *
800
- * **North east**
801
- *
802
- * * `northEastArrowSouthWest`
803
- *
804
- * ```
805
- * +-----------------+
806
- * | Balloon |
807
- * +-----------------+
808
- * V
809
- * [ Target ]
810
- * ```
811
- *
812
- * * `northEastArrowSouthMiddleWest`
813
- *
814
- * ```
815
- * +-----------------+
816
- * | Balloon |
817
- * +-----------------+
818
- * V
819
- * [ Target ]
820
- * ```
821
- *
822
- * * `northEastArrowSouth`
823
- *
824
- * ```
825
- * +-----------------+
826
- * | Balloon |
827
- * +-----------------+
828
- * V
829
- * [ Target ]
830
- * ```
831
- *
832
- * * `northEastArrowSouthMiddleEast`
833
- *
834
- * ```
835
- * +-----------------+
836
- * | Balloon |
837
- * +-----------------+
838
- * V
839
- * [ Target ]
840
- * ```
841
- *
842
- * * `northEastArrowSouthEast`
843
- *
844
- * ```
845
- * +-----------------+
846
- * | Balloon |
847
- * +-----------------+
848
- * V
849
- * [ Target ]
850
- * ```
851
- *
852
- * **South**
853
- *
854
- * * `southArrowNorthWest`
855
- *
856
- * ```
857
- * [ Target ]
858
- * ^
859
- * +-----------------+
860
- * | Balloon |
861
- * +-----------------+
862
- * ```
863
- *
864
- * * `southArrowNorthMiddleWest`
865
- *
866
- * ```
867
- * [ Target ]
868
- * ^
869
- * +-----------------+
870
- * | Balloon |
871
- * +-----------------+
872
- * ```
873
- *
874
- * * `southArrowNorth`
875
- *
876
- * ```
877
- * [ Target ]
878
- * ^
879
- * +-----------------+
880
- * | Balloon |
881
- * +-----------------+
882
- * ```
883
- *
884
- * * `southArrowNorthMiddleEast`
885
- *
886
- * ```
887
- * [ Target ]
888
- * ^
889
- * +-----------------+
890
- * | Balloon |
891
- * +-----------------+
892
- * ```
893
- *
894
- * * `southArrowNorthEast`
895
- *
896
- * ```
897
- * [ Target ]
898
- * ^
899
- * +-----------------+
900
- * | Balloon |
901
- * +-----------------+
902
- * ```
903
- *
904
- * **South west**
905
- *
906
- * * `southWestArrowNorthWest`
907
- *
908
- *
909
- * ```
910
- * [ Target ]
911
- * ^
912
- * +-----------------+
913
- * | Balloon |
914
- * +-----------------+
915
- * ```
916
- *
917
- * * `southWestArrowNorthMiddleWest`
918
- *
919
- * ```
920
- * [ Target ]
921
- * ^
922
- * +-----------------+
923
- * | Balloon |
924
- * +-----------------+
925
- * ```
926
- *
927
- * * `southWestArrowNorth`
928
- *
929
- * ```
930
- * [ Target ]
931
- * ^
932
- * +-----------------+
933
- * | Balloon |
934
- * +-----------------+
935
- * ```
936
- *
937
- * * `southWestArrowNorthMiddleEast`
938
- *
939
- * ```
940
- * [ Target ]
941
- * ^
942
- * +-----------------+
943
- * | Balloon |
944
- * +-----------------+
945
- * ```
946
- *
947
- * * `southWestArrowNorthEast`
948
- *
949
- * ```
950
- * [ Target ]
951
- * ^
952
- * +-----------------+
953
- * | Balloon |
954
- * +-----------------+
955
- * ```
956
- *
957
- * **South east**
958
- *
959
- * * `southEastArrowNorthWest`
960
- *
961
- * ```
962
- * [ Target ]
963
- * ^
964
- * +-----------------+
965
- * | Balloon |
966
- * +-----------------+
967
- * ```
968
- *
969
- * * `southEastArrowNorthMiddleWest`
970
- *
971
- * ```
972
- * [ Target ]
973
- * ^
974
- * +-----------------+
975
- * | Balloon |
976
- * +-----------------+
977
- * ```
978
- *
979
- * * `southEastArrowNorth`
980
- *
981
- * ```
982
- * [ Target ]
983
- * ^
984
- * +-----------------+
985
- * | Balloon |
986
- * +-----------------+
987
- * ```
988
- *
989
- * * `southEastArrowNorthMiddleEast`
990
- *
991
- * ```
992
- * [ Target ]
993
- * ^
994
- * +-----------------+
995
- * | Balloon |
996
- * +-----------------+
997
- * ```
998
- *
999
- * * `southEastArrowNorthEast`
1000
- *
1001
- * ```
1002
- * [ Target ]
1003
- * ^
1004
- * +-----------------+
1005
- * | Balloon |
1006
- * +-----------------+
1007
- * ```
1008
- *
1009
- * **West**
1010
- *
1011
- * * `westArrowEast`
1012
- *
1013
- * ```
1014
- * +-----------------+
1015
- * | Balloon |>[ Target ]
1016
- * +-----------------+
1017
- * ```
1018
- *
1019
- * **East**
1020
- *
1021
- * * `eastArrowWest`
1022
- *
1023
- * ```
1024
- * +-----------------+
1025
- * [ Target ]<| Balloon |
1026
- * +-----------------+
1027
- * ```
1028
- *
1029
- * **Sticky**
1030
- *
1031
- * * `viewportStickyNorth`
1032
- *
1033
- * ```
1034
- * +---------------------------+
1035
- * | [ Target ] |
1036
- * | |
1037
- * +-----------------------------------+
1038
- * | | +-----------------+ | |
1039
- * | | | Balloon | | |
1040
- * | | +-----------------+ | |
1041
- * | | | |
1042
- * | | | |
1043
- * | | | |
1044
- * | | | |
1045
- * | +---------------------------+ |
1046
- * | Viewport |
1047
- * +-----------------------------------+
1048
- * ```
1049
- *
1050
- * See {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#attachTo}.
1051
- *
1052
- * Positioning functions must be compatible with {@link module:utils/dom/position~DomPoint}.
1053
- *
1054
- * Default positioning functions with customized offsets can be generated using
1055
- * {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.generatePositions}.
1056
- *
1057
- * The name that the position function returns will be reflected in the balloon panel's class that
1058
- * controls the placement of the "arrow". See {@link #position} to learn more.
1059
- */
1060
- static defaultPositions = /* #__PURE__ */ BalloonPanelView.generatePositions();
1061
- }
1062
- /**
1063
- * Returns the DOM element for given object or null, if there is none,
1064
- * e.g. when the passed object is a Rect instance or so.
1065
- */
1066
- function getDomElement(object) {
1067
- if (isElement(object)) {
1068
- return object;
1069
- }
1070
- if (isRange(object)) {
1071
- return object.commonAncestorContainer;
1072
- }
1073
- if (typeof object == 'function') {
1074
- return getDomElement(object());
1075
- }
1076
- return null;
1077
- }