dockview-core 7.0.3 → 8.0.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 (374) hide show
  1. package/LICENCE.md +21 -0
  2. package/README.md +17 -86
  3. package/dist/cjs/api/component.api.d.ts +100 -9
  4. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +45 -1
  5. package/dist/cjs/api/dockviewPanelApi.d.ts +21 -0
  6. package/dist/cjs/dismissableLayer.d.ts +57 -0
  7. package/dist/cjs/dnd/backend.d.ts +2 -2
  8. package/dist/cjs/dnd/dropTargetAnchorContainer.d.ts +12 -0
  9. package/dist/cjs/dnd/droptarget.d.ts +94 -0
  10. package/dist/cjs/dnd/ghost.d.ts +1 -0
  11. package/dist/cjs/dnd/pointer/longPress.d.ts +2 -2
  12. package/dist/cjs/dnd/pointer/pointerDragController.d.ts +5 -2
  13. package/dist/cjs/dnd/pointer/pointerDragSource.d.ts +1 -1
  14. package/dist/cjs/dnd/pointer/pointerDropTarget.d.ts +30 -1
  15. package/dist/cjs/dnd/pointer/pointerGhost.d.ts +1 -1
  16. package/dist/cjs/dockview/accessibilityMessages.d.ts +6 -0
  17. package/dist/cjs/dockview/advancedDnDService.d.ts +46 -0
  18. package/dist/cjs/dockview/components/panel/content.d.ts +1 -1
  19. package/dist/cjs/dockview/components/tab/defaultTab.d.ts +2 -0
  20. package/dist/cjs/dockview/components/tab/tab.d.ts +2 -0
  21. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.d.ts +2 -2
  22. package/dist/cjs/dockview/components/titlebar/groupDragSource.d.ts +1 -1
  23. package/dist/cjs/dockview/components/titlebar/tabGroupChip.d.ts +1 -1
  24. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +73 -2
  25. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +1 -1
  26. package/dist/cjs/dockview/components/titlebar/tabReorderController.d.ts +295 -0
  27. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +120 -50
  28. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +48 -0
  29. package/dist/cjs/dockview/dndCapabilities.d.ts +1 -1
  30. package/dist/cjs/dockview/dockviewComponent.d.ts +303 -19
  31. package/dist/cjs/dockview/dockviewGroupPanel.d.ts +5 -0
  32. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +52 -2
  33. package/dist/cjs/dockview/dockviewPanel.d.ts +12 -0
  34. package/dist/cjs/dockview/dockviewShell.d.ts +48 -24
  35. package/dist/cjs/dockview/edgeGroupService.d.ts +20 -0
  36. package/dist/cjs/dockview/events.d.ts +6 -0
  37. package/dist/cjs/dockview/liveRegionService.d.ts +18 -5
  38. package/dist/cjs/dockview/moduleContracts.d.ts +480 -14
  39. package/dist/cjs/dockview/modules.d.ts +101 -22
  40. package/dist/cjs/dockview/options.d.ts +337 -30
  41. package/dist/cjs/dockview/optionsModules.d.ts +73 -0
  42. package/dist/cjs/dockview/popoutWindowService.d.ts +15 -10
  43. package/dist/cjs/dockview/rootDropTargetService.d.ts +11 -0
  44. package/dist/cjs/dockview/tabGroupAccent.d.ts +1 -1
  45. package/dist/cjs/dockview/tabGroupChipsService.d.ts +10 -0
  46. package/dist/cjs/dockview/theme.d.ts +2 -2
  47. package/dist/cjs/dockview/types.d.ts +3 -0
  48. package/dist/cjs/dom.d.ts +9 -1
  49. package/dist/cjs/gridview/baseComponentGridview.d.ts +2 -2
  50. package/dist/cjs/gridview/gridview.d.ts +2 -0
  51. package/dist/cjs/index.d.ts +35 -29
  52. package/dist/cjs/lifecycle.d.ts +1 -0
  53. package/dist/cjs/overlay/overlay.d.ts +4 -2
  54. package/dist/cjs/overlay/overlayRenderContainer.d.ts +8 -0
  55. package/dist/cjs/paneview/paneview.d.ts +2 -1
  56. package/dist/cjs/paneview/paneviewComponent.d.ts +3 -0
  57. package/dist/cjs/paneview/paneviewPanel.d.ts +5 -0
  58. package/dist/cjs/svg.d.ts +1 -0
  59. package/dist/cjs/types.d.ts +8 -0
  60. package/dist/dockview-core.js +18391 -19679
  61. package/dist/dockview-core.min.js +4138 -6
  62. package/dist/dockview-core.min.noStyle.js +6 -7
  63. package/dist/dockview-core.noStyle.js +18390 -19656
  64. package/dist/package/main.cjs.js +18002 -19268
  65. package/dist/package/main.cjs.min.js +6 -6
  66. package/dist/package/main.esm.min.mjs +6 -6
  67. package/dist/package/main.esm.mjs +17959 -19260
  68. package/package.json +81 -77
  69. package/dist/cjs/api/component.api.js +0 -1242
  70. package/dist/cjs/api/dockviewGroupPanelApi.js +0 -200
  71. package/dist/cjs/api/dockviewPanelApi.js +0 -172
  72. package/dist/cjs/api/entryPoints.js +0 -27
  73. package/dist/cjs/api/gridviewPanelApi.js +0 -45
  74. package/dist/cjs/api/panelApi.js +0 -133
  75. package/dist/cjs/api/paneviewPanelApi.js +0 -57
  76. package/dist/cjs/api/splitviewPanelApi.js +0 -47
  77. package/dist/cjs/array.js +0 -66
  78. package/dist/cjs/constants.js +0 -11
  79. package/dist/cjs/dnd/backend.js +0 -171
  80. package/dist/cjs/dnd/dataTransfer.js +0 -100
  81. package/dist/cjs/dnd/dnd.js +0 -74
  82. package/dist/cjs/dnd/dropOverlay.js +0 -197
  83. package/dist/cjs/dnd/dropTargetAnchorContainer.js +0 -104
  84. package/dist/cjs/dnd/droptarget.js +0 -362
  85. package/dist/cjs/dnd/ghost.js +0 -17
  86. package/dist/cjs/dnd/pointer/index.js +0 -13
  87. package/dist/cjs/dnd/pointer/longPress.js +0 -151
  88. package/dist/cjs/dnd/pointer/pointerDragController.js +0 -243
  89. package/dist/cjs/dnd/pointer/pointerDragSource.js +0 -197
  90. package/dist/cjs/dnd/pointer/pointerDropTarget.js +0 -198
  91. package/dist/cjs/dnd/pointer/pointerGhost.js +0 -44
  92. package/dist/cjs/dnd/pointer/types.js +0 -2
  93. package/dist/cjs/dockview/accessibilityMessages.js +0 -51
  94. package/dist/cjs/dockview/allModules.js +0 -25
  95. package/dist/cjs/dockview/components/panel/content.js +0 -213
  96. package/dist/cjs/dockview/components/popupService.js +0 -132
  97. package/dist/cjs/dockview/components/tab/defaultTab.js +0 -70
  98. package/dist/cjs/dockview/components/tab/tab.js +0 -281
  99. package/dist/cjs/dockview/components/titlebar/floatingTitleBar.js +0 -95
  100. package/dist/cjs/dockview/components/titlebar/groupDragSource.js +0 -218
  101. package/dist/cjs/dockview/components/titlebar/tabGroupChip.js +0 -104
  102. package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +0 -477
  103. package/dist/cjs/dockview/components/titlebar/tabGroups.js +0 -854
  104. package/dist/cjs/dockview/components/titlebar/tabOverflowControl.js +0 -19
  105. package/dist/cjs/dockview/components/titlebar/tabs.js +0 -2016
  106. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +0 -458
  107. package/dist/cjs/dockview/components/titlebar/voidContainer.js +0 -120
  108. package/dist/cjs/dockview/components/watermark/watermark.js +0 -40
  109. package/dist/cjs/dockview/deserializer.js +0 -39
  110. package/dist/cjs/dockview/dndCapabilities.js +0 -39
  111. package/dist/cjs/dockview/dockviewComponent.js +0 -3896
  112. package/dist/cjs/dockview/dockviewFloatingGroupPanel.js +0 -70
  113. package/dist/cjs/dockview/dockviewGroupPanel.js +0 -204
  114. package/dist/cjs/dockview/dockviewGroupPanelModel.js +0 -1514
  115. package/dist/cjs/dockview/dockviewPanel.js +0 -265
  116. package/dist/cjs/dockview/dockviewPanelModel.js +0 -105
  117. package/dist/cjs/dockview/dockviewShell.js +0 -744
  118. package/dist/cjs/dockview/edgeGroupService.js +0 -128
  119. package/dist/cjs/dockview/events.js +0 -67
  120. package/dist/cjs/dockview/floatingGroupService.js +0 -231
  121. package/dist/cjs/dockview/framework.js +0 -2
  122. package/dist/cjs/dockview/headerActionsService.js +0 -149
  123. package/dist/cjs/dockview/liveRegionService.js +0 -185
  124. package/dist/cjs/dockview/moduleContracts.js +0 -2
  125. package/dist/cjs/dockview/modules.js +0 -304
  126. package/dist/cjs/dockview/options.js +0 -103
  127. package/dist/cjs/dockview/popoutWindowService.js +0 -261
  128. package/dist/cjs/dockview/rootDropTargetService.js +0 -87
  129. package/dist/cjs/dockview/strictEventsSequencing.js +0 -63
  130. package/dist/cjs/dockview/tabGroup.js +0 -219
  131. package/dist/cjs/dockview/tabGroupAccent.js +0 -126
  132. package/dist/cjs/dockview/theme.js +0 -139
  133. package/dist/cjs/dockview/types.js +0 -2
  134. package/dist/cjs/dockview/validate.js +0 -76
  135. package/dist/cjs/dockview/watermarkService.js +0 -61
  136. package/dist/cjs/dom.js +0 -543
  137. package/dist/cjs/events.js +0 -296
  138. package/dist/cjs/framwork.js +0 -2
  139. package/dist/cjs/gridview/baseComponentGridview.js +0 -330
  140. package/dist/cjs/gridview/basePanelView.js +0 -162
  141. package/dist/cjs/gridview/branchNode.js +0 -372
  142. package/dist/cjs/gridview/gridview.js +0 -776
  143. package/dist/cjs/gridview/gridviewComponent.js +0 -363
  144. package/dist/cjs/gridview/gridviewPanel.js +0 -249
  145. package/dist/cjs/gridview/leafNode.js +0 -169
  146. package/dist/cjs/gridview/options.js +0 -17
  147. package/dist/cjs/gridview/types.js +0 -2
  148. package/dist/cjs/index.js +0 -105
  149. package/dist/cjs/lifecycle.js +0 -80
  150. package/dist/cjs/math.js +0 -38
  151. package/dist/cjs/overlay/overlay.js +0 -602
  152. package/dist/cjs/overlay/overlayRenderContainer.js +0 -309
  153. package/dist/cjs/panel/types.js +0 -2
  154. package/dist/cjs/paneview/defaultPaneviewHeader.js +0 -92
  155. package/dist/cjs/paneview/draggablePaneviewPanel.js +0 -141
  156. package/dist/cjs/paneview/options.js +0 -44
  157. package/dist/cjs/paneview/paneview.js +0 -203
  158. package/dist/cjs/paneview/paneviewComponent.js +0 -430
  159. package/dist/cjs/paneview/paneviewPanel.js +0 -275
  160. package/dist/cjs/popoutWindow.js +0 -244
  161. package/dist/cjs/resizable.js +0 -97
  162. package/dist/cjs/scrollbar.js +0 -169
  163. package/dist/cjs/splitview/options.js +0 -19
  164. package/dist/cjs/splitview/splitview.js +0 -999
  165. package/dist/cjs/splitview/splitviewComponent.js +0 -401
  166. package/dist/cjs/splitview/splitviewPanel.js +0 -179
  167. package/dist/cjs/splitview/viewItem.js +0 -119
  168. package/dist/cjs/svg.js +0 -43
  169. package/dist/cjs/types.js +0 -2
  170. package/dist/dockview-core.min.js.map +0 -1
  171. package/dist/dockview-core.min.noStyle.js.map +0 -1
  172. package/dist/esm/api/component.api.d.ts +0 -640
  173. package/dist/esm/api/component.api.js +0 -887
  174. package/dist/esm/api/dockviewGroupPanelApi.d.ts +0 -109
  175. package/dist/esm/api/dockviewGroupPanelApi.js +0 -155
  176. package/dist/esm/api/dockviewPanelApi.d.ts +0 -84
  177. package/dist/esm/api/dockviewPanelApi.js +0 -124
  178. package/dist/esm/api/entryPoints.d.ts +0 -9
  179. package/dist/esm/api/entryPoints.js +0 -21
  180. package/dist/esm/api/gridviewPanelApi.d.ts +0 -37
  181. package/dist/esm/api/gridviewPanelApi.js +0 -23
  182. package/dist/esm/api/panelApi.d.ts +0 -100
  183. package/dist/esm/api/panelApi.js +0 -87
  184. package/dist/esm/api/paneviewPanelApi.d.ts +0 -26
  185. package/dist/esm/api/paneviewPanelApi.js +0 -27
  186. package/dist/esm/api/splitviewPanelApi.d.ts +0 -32
  187. package/dist/esm/api/splitviewPanelApi.js +0 -25
  188. package/dist/esm/array.d.ts +0 -13
  189. package/dist/esm/array.js +0 -57
  190. package/dist/esm/constants.d.ts +0 -8
  191. package/dist/esm/constants.js +0 -8
  192. package/dist/esm/dnd/backend.d.ts +0 -70
  193. package/dist/esm/dnd/backend.js +0 -148
  194. package/dist/esm/dnd/dataTransfer.d.ts +0 -31
  195. package/dist/esm/dnd/dataTransfer.js +0 -67
  196. package/dist/esm/dnd/dnd.d.ts +0 -32
  197. package/dist/esm/dnd/dnd.js +0 -51
  198. package/dist/esm/dnd/dropOverlay.d.ts +0 -20
  199. package/dist/esm/dnd/dropOverlay.js +0 -192
  200. package/dist/esm/dnd/dropTargetAnchorContainer.d.ts +0 -16
  201. package/dist/esm/dnd/dropTargetAnchorContainer.js +0 -73
  202. package/dist/esm/dnd/droptarget.d.ts +0 -116
  203. package/dist/esm/dnd/droptarget.js +0 -316
  204. package/dist/esm/dnd/ghost.d.ts +0 -4
  205. package/dist/esm/dnd/ghost.js +0 -14
  206. package/dist/esm/dnd/pointer/index.d.ts +0 -11
  207. package/dist/esm/dnd/pointer/index.js +0 -5
  208. package/dist/esm/dnd/pointer/longPress.d.ts +0 -32
  209. package/dist/esm/dnd/pointer/longPress.js +0 -127
  210. package/dist/esm/dnd/pointer/pointerDragController.d.ts +0 -60
  211. package/dist/esm/dnd/pointer/pointerDragController.js +0 -193
  212. package/dist/esm/dnd/pointer/pointerDragSource.d.ts +0 -61
  213. package/dist/esm/dnd/pointer/pointerDragSource.js +0 -173
  214. package/dist/esm/dnd/pointer/pointerDropTarget.d.ts +0 -39
  215. package/dist/esm/dnd/pointer/pointerDropTarget.js +0 -168
  216. package/dist/esm/dnd/pointer/pointerGhost.d.ts +0 -30
  217. package/dist/esm/dnd/pointer/pointerGhost.js +0 -39
  218. package/dist/esm/dnd/pointer/types.d.ts +0 -16
  219. package/dist/esm/dnd/pointer/types.js +0 -1
  220. package/dist/esm/dockview/accessibilityMessages.d.ts +0 -32
  221. package/dist/esm/dockview/accessibilityMessages.js +0 -30
  222. package/dist/esm/dockview/allModules.d.ts +0 -8
  223. package/dist/esm/dockview/allModules.js +0 -22
  224. package/dist/esm/dockview/components/panel/content.d.ts +0 -54
  225. package/dist/esm/dockview/components/panel/content.js +0 -185
  226. package/dist/esm/dockview/components/popupService.d.ts +0 -21
  227. package/dist/esm/dockview/components/popupService.js +0 -108
  228. package/dist/esm/dockview/components/tab/defaultTab.d.ts +0 -12
  229. package/dist/esm/dockview/components/tab/defaultTab.js +0 -43
  230. package/dist/esm/dockview/components/tab/tab.d.ts +0 -44
  231. package/dist/esm/dockview/components/tab/tab.js +0 -242
  232. package/dist/esm/dockview/components/titlebar/floatingTitleBar.d.ts +0 -34
  233. package/dist/esm/dockview/components/titlebar/floatingTitleBar.js +0 -65
  234. package/dist/esm/dockview/components/titlebar/groupDragSource.d.ts +0 -51
  235. package/dist/esm/dockview/components/titlebar/groupDragSource.js +0 -178
  236. package/dist/esm/dockview/components/titlebar/tabGroupChip.d.ts +0 -37
  237. package/dist/esm/dockview/components/titlebar/tabGroupChip.js +0 -77
  238. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +0 -72
  239. package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +0 -360
  240. package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +0 -107
  241. package/dist/esm/dockview/components/titlebar/tabGroups.js +0 -621
  242. package/dist/esm/dockview/components/titlebar/tabOverflowControl.d.ts +0 -8
  243. package/dist/esm/dockview/components/titlebar/tabOverflowControl.js +0 -16
  244. package/dist/esm/dockview/components/titlebar/tabs.d.ts +0 -167
  245. package/dist/esm/dockview/components/titlebar/tabs.js +0 -1653
  246. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +0 -104
  247. package/dist/esm/dockview/components/titlebar/tabsContainer.js +0 -359
  248. package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +0 -21
  249. package/dist/esm/dockview/components/titlebar/voidContainer.js +0 -92
  250. package/dist/esm/dockview/components/watermark/watermark.d.ts +0 -8
  251. package/dist/esm/dockview/components/watermark/watermark.js +0 -14
  252. package/dist/esm/dockview/deserializer.d.ts +0 -12
  253. package/dist/esm/dockview/deserializer.js +0 -34
  254. package/dist/esm/dockview/dndCapabilities.d.ts +0 -19
  255. package/dist/esm/dockview/dndCapabilities.js +0 -36
  256. package/dist/esm/dockview/dockviewComponent.d.ts +0 -626
  257. package/dist/esm/dockview/dockviewComponent.js +0 -3214
  258. package/dist/esm/dockview/dockviewFloatingGroupPanel.d.ts +0 -45
  259. package/dist/esm/dockview/dockviewFloatingGroupPanel.js +0 -44
  260. package/dist/esm/dockview/dockviewGroupPanel.d.ts +0 -35
  261. package/dist/esm/dockview/dockviewGroupPanel.js +0 -142
  262. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +0 -358
  263. package/dist/esm/dockview/dockviewGroupPanelModel.js +0 -1180
  264. package/dist/esm/dockview/dockviewPanel.d.ts +0 -69
  265. package/dist/esm/dockview/dockviewPanel.js +0 -178
  266. package/dist/esm/dockview/dockviewPanelModel.d.ts +0 -37
  267. package/dist/esm/dockview/dockviewPanelModel.js +0 -81
  268. package/dist/esm/dockview/dockviewShell.d.ts +0 -150
  269. package/dist/esm/dockview/dockviewShell.js +0 -678
  270. package/dist/esm/dockview/edgeGroupService.d.ts +0 -38
  271. package/dist/esm/dockview/edgeGroupService.js +0 -63
  272. package/dist/esm/dockview/events.d.ts +0 -38
  273. package/dist/esm/dockview/events.js +0 -34
  274. package/dist/esm/dockview/floatingGroupService.d.ts +0 -37
  275. package/dist/esm/dockview/floatingGroupService.js +0 -150
  276. package/dist/esm/dockview/framework.d.ts +0 -65
  277. package/dist/esm/dockview/framework.js +0 -1
  278. package/dist/esm/dockview/headerActionsService.d.ts +0 -32
  279. package/dist/esm/dockview/headerActionsService.js +0 -86
  280. package/dist/esm/dockview/liveRegionService.d.ts +0 -53
  281. package/dist/esm/dockview/liveRegionService.js +0 -159
  282. package/dist/esm/dockview/moduleContracts.d.ts +0 -119
  283. package/dist/esm/dockview/moduleContracts.js +0 -1
  284. package/dist/esm/dockview/modules.d.ts +0 -110
  285. package/dist/esm/dockview/modules.js +0 -170
  286. package/dist/esm/dockview/options.d.ts +0 -474
  287. package/dist/esm/dockview/options.js +0 -77
  288. package/dist/esm/dockview/popoutWindowService.d.ts +0 -95
  289. package/dist/esm/dockview/popoutWindowService.js +0 -175
  290. package/dist/esm/dockview/rootDropTargetService.d.ts +0 -35
  291. package/dist/esm/dockview/rootDropTargetService.js +0 -82
  292. package/dist/esm/dockview/strictEventsSequencing.d.ts +0 -7
  293. package/dist/esm/dockview/strictEventsSequencing.js +0 -41
  294. package/dist/esm/dockview/tabGroup.d.ts +0 -99
  295. package/dist/esm/dockview/tabGroup.js +0 -144
  296. package/dist/esm/dockview/tabGroupAccent.d.ts +0 -65
  297. package/dist/esm/dockview/tabGroupAccent.js +0 -114
  298. package/dist/esm/dockview/theme.d.ts +0 -86
  299. package/dist/esm/dockview/theme.js +0 -136
  300. package/dist/esm/dockview/types.d.ts +0 -53
  301. package/dist/esm/dockview/types.js +0 -1
  302. package/dist/esm/dockview/validate.d.ts +0 -0
  303. package/dist/esm/dockview/validate.js +0 -76
  304. package/dist/esm/dockview/watermarkService.d.ts +0 -30
  305. package/dist/esm/dockview/watermarkService.js +0 -56
  306. package/dist/esm/dom.d.ts +0 -60
  307. package/dist/esm/dom.js +0 -375
  308. package/dist/esm/events.d.ts +0 -79
  309. package/dist/esm/events.js +0 -219
  310. package/dist/esm/framwork.d.ts +0 -4
  311. package/dist/esm/framwork.js +0 -1
  312. package/dist/esm/gridview/baseComponentGridview.d.ts +0 -111
  313. package/dist/esm/gridview/baseComponentGridview.js +0 -237
  314. package/dist/esm/gridview/basePanelView.d.ts +0 -40
  315. package/dist/esm/gridview/basePanelView.js +0 -91
  316. package/dist/esm/gridview/branchNode.d.ts +0 -57
  317. package/dist/esm/gridview/branchNode.js +0 -257
  318. package/dist/esm/gridview/gridview.d.ts +0 -158
  319. package/dist/esm/gridview/gridview.js +0 -681
  320. package/dist/esm/gridview/gridviewComponent.d.ts +0 -88
  321. package/dist/esm/gridview/gridviewComponent.js +0 -265
  322. package/dist/esm/gridview/gridviewPanel.d.ts +0 -77
  323. package/dist/esm/gridview/gridviewPanel.js +0 -182
  324. package/dist/esm/gridview/leafNode.d.ts +0 -34
  325. package/dist/esm/gridview/leafNode.js +0 -102
  326. package/dist/esm/gridview/options.d.ts +0 -15
  327. package/dist/esm/gridview/options.js +0 -14
  328. package/dist/esm/gridview/types.d.ts +0 -3
  329. package/dist/esm/gridview/types.js +0 -1
  330. package/dist/esm/index.d.ts +0 -58
  331. package/dist/esm/index.js +0 -44
  332. package/dist/esm/lifecycle.d.ts +0 -25
  333. package/dist/esm/lifecycle.js +0 -56
  334. package/dist/esm/math.d.ts +0 -5
  335. package/dist/esm/math.js +0 -32
  336. package/dist/esm/overlay/overlay.d.ts +0 -91
  337. package/dist/esm/overlay/overlay.js +0 -520
  338. package/dist/esm/overlay/overlayRenderContainer.d.ts +0 -24
  339. package/dist/esm/overlay/overlayRenderContainer.js +0 -249
  340. package/dist/esm/panel/types.d.ts +0 -33
  341. package/dist/esm/panel/types.js +0 -1
  342. package/dist/esm/paneview/defaultPaneviewHeader.d.ts +0 -21
  343. package/dist/esm/paneview/defaultPaneviewHeader.js +0 -65
  344. package/dist/esm/paneview/draggablePaneviewPanel.d.ts +0 -38
  345. package/dist/esm/paneview/draggablePaneviewPanel.js +0 -107
  346. package/dist/esm/paneview/options.d.ts +0 -30
  347. package/dist/esm/paneview/options.js +0 -22
  348. package/dist/esm/paneview/paneview.d.ts +0 -41
  349. package/dist/esm/paneview/paneview.js +0 -148
  350. package/dist/esm/paneview/paneviewComponent.d.ts +0 -133
  351. package/dist/esm/paneview/paneviewComponent.js +0 -306
  352. package/dist/esm/paneview/paneviewPanel.d.ts +0 -98
  353. package/dist/esm/paneview/paneviewPanel.js +0 -192
  354. package/dist/esm/popoutWindow.d.ts +0 -38
  355. package/dist/esm/popoutWindow.js +0 -170
  356. package/dist/esm/resizable.d.ts +0 -12
  357. package/dist/esm/resizable.js +0 -66
  358. package/dist/esm/scrollbar.d.ts +0 -15
  359. package/dist/esm/scrollbar.js +0 -139
  360. package/dist/esm/splitview/options.d.ts +0 -21
  361. package/dist/esm/splitview/options.js +0 -16
  362. package/dist/esm/splitview/splitview.d.ts +0 -145
  363. package/dist/esm/splitview/splitview.js +0 -770
  364. package/dist/esm/splitview/splitviewComponent.d.ts +0 -101
  365. package/dist/esm/splitview/splitviewComponent.js +0 -267
  366. package/dist/esm/splitview/splitviewPanel.d.ts +0 -45
  367. package/dist/esm/splitview/splitviewPanel.js +0 -108
  368. package/dist/esm/splitview/viewItem.d.ts +0 -25
  369. package/dist/esm/splitview/viewItem.js +0 -74
  370. package/dist/esm/svg.d.ts +0 -3
  371. package/dist/esm/svg.js +0 -31
  372. package/dist/esm/types.d.ts +0 -31
  373. package/dist/esm/types.js +0 -1
  374. package/dist/styles/dockview.css +0 -3436
@@ -1,681 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:
3
- * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid
4
- *--------------------------------------------------------------------------------------------*/
5
- import { Orientation, Sizing, } from '../splitview/splitview';
6
- import { tail } from '../array';
7
- import { LeafNode } from './leafNode';
8
- import { BranchNode } from './branchNode';
9
- import { Emitter } from '../events';
10
- import { MutableDisposable } from '../lifecycle';
11
- function findLeaf(candiateNode, last) {
12
- if (candiateNode instanceof LeafNode) {
13
- return candiateNode;
14
- }
15
- if (candiateNode instanceof BranchNode) {
16
- return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);
17
- }
18
- throw new Error('invalid node');
19
- }
20
- function cloneNode(node, size, orthogonalSize) {
21
- if (node instanceof BranchNode) {
22
- const result = new BranchNode(node.orientation, node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
23
- for (let i = node.children.length - 1; i >= 0; i--) {
24
- const child = node.children[i];
25
- result.addChild(cloneNode(child, child.size, child.orthogonalSize), child.size, 0, true);
26
- }
27
- return result;
28
- }
29
- else {
30
- return new LeafNode(node.view, node.orientation, orthogonalSize);
31
- }
32
- }
33
- function flipNode(node, size, orthogonalSize) {
34
- if (node instanceof BranchNode) {
35
- const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);
36
- let totalSize = 0;
37
- for (let i = node.children.length - 1; i >= 0; i--) {
38
- const child = node.children[i];
39
- const childSize = child instanceof BranchNode ? child.orthogonalSize : child.size;
40
- let newSize = node.size === 0
41
- ? 0
42
- : Math.round((size * childSize) / node.size);
43
- totalSize += newSize;
44
- // The last view to add should adjust to rounding errors
45
- if (i === 0) {
46
- newSize += size - totalSize;
47
- }
48
- result.addChild(flipNode(child, orthogonalSize, newSize), newSize, 0, true);
49
- }
50
- return result;
51
- }
52
- else {
53
- return new LeafNode(node.view, orthogonal(node.orientation), orthogonalSize);
54
- }
55
- }
56
- export function indexInParent(element) {
57
- const parentElement = element.parentElement;
58
- if (!parentElement) {
59
- throw new Error('Invalid grid element');
60
- }
61
- let el = parentElement.firstElementChild;
62
- let index = 0;
63
- while (el !== element && el !== parentElement.lastElementChild && el) {
64
- el = el.nextElementSibling;
65
- index++;
66
- }
67
- return index;
68
- }
69
- /**
70
- * Find the grid location of a specific DOM element by traversing the parent
71
- * chain and finding each child index on the way.
72
- *
73
- * This will break as soon as DOM structures of the Splitview or Gridview change.
74
- */
75
- export function getGridLocation(element) {
76
- const parentElement = element.parentElement;
77
- if (!parentElement) {
78
- throw new Error('Invalid grid element');
79
- }
80
- if (/\bdv-grid-view\b/.test(parentElement.className)) {
81
- return [];
82
- }
83
- const index = indexInParent(parentElement);
84
- const ancestor = parentElement.parentElement.parentElement.parentElement;
85
- return [...getGridLocation(ancestor), index];
86
- }
87
- export function getRelativeLocation(rootOrientation, location, direction) {
88
- const orientation = getLocationOrientation(rootOrientation, location);
89
- const directionOrientation = getDirectionOrientation(direction);
90
- if (orientation === directionOrientation) {
91
- const [rest, _index] = tail(location);
92
- let index = _index;
93
- if (direction === 'right' || direction === 'bottom') {
94
- index += 1;
95
- }
96
- return [...rest, index];
97
- }
98
- else {
99
- const index = direction === 'right' || direction === 'bottom' ? 1 : 0;
100
- return [...location, index];
101
- }
102
- }
103
- export function getDirectionOrientation(direction) {
104
- return direction === 'top' || direction === 'bottom'
105
- ? Orientation.VERTICAL
106
- : Orientation.HORIZONTAL;
107
- }
108
- export function getLocationOrientation(rootOrientation, location) {
109
- return location.length % 2 === 0
110
- ? orthogonal(rootOrientation)
111
- : rootOrientation;
112
- }
113
- export const orthogonal = (orientation) => orientation === Orientation.HORIZONTAL
114
- ? Orientation.VERTICAL
115
- : Orientation.HORIZONTAL;
116
- export function isGridBranchNode(node) {
117
- return !!node.children;
118
- }
119
- const serializeBranchNode = (node, orientation) => {
120
- const size = orientation === Orientation.VERTICAL ? node.box.width : node.box.height;
121
- if (!isGridBranchNode(node)) {
122
- if (typeof node.cachedVisibleSize === 'number') {
123
- return {
124
- type: 'leaf',
125
- data: node.view.toJSON(),
126
- size: node.cachedVisibleSize,
127
- visible: false,
128
- };
129
- }
130
- return { type: 'leaf', data: node.view.toJSON(), size };
131
- }
132
- return {
133
- type: 'branch',
134
- data: node.children.map((c) => serializeBranchNode(c, orthogonal(orientation))),
135
- size,
136
- };
137
- };
138
- export class Gridview {
139
- get length() {
140
- return this._root ? this._root.children.length : 0;
141
- }
142
- get orientation() {
143
- return this.root.orientation;
144
- }
145
- set orientation(orientation) {
146
- if (this.root.orientation === orientation) {
147
- return;
148
- }
149
- const { size, orthogonalSize } = this.root;
150
- this.root = flipNode(this.root, orthogonalSize, size);
151
- this.root.layout(size, orthogonalSize);
152
- }
153
- get width() {
154
- return this.root.width;
155
- }
156
- get height() {
157
- return this.root.height;
158
- }
159
- get minimumWidth() {
160
- return this.root.minimumWidth;
161
- }
162
- get minimumHeight() {
163
- return this.root.minimumHeight;
164
- }
165
- get maximumWidth() {
166
- return this.root.maximumHeight;
167
- }
168
- get maximumHeight() {
169
- return this.root.maximumHeight;
170
- }
171
- get locked() {
172
- return this._locked;
173
- }
174
- set locked(value) {
175
- this._locked = value;
176
- const branch = [this.root];
177
- /**
178
- * simple depth-first-search to cover all nodes
179
- *
180
- * @see https://en.wikipedia.org/wiki/Depth-first_search
181
- */
182
- while (branch.length > 0) {
183
- const node = branch.pop();
184
- if (node instanceof BranchNode) {
185
- node.disabled = value;
186
- branch.push(...node.children);
187
- }
188
- }
189
- }
190
- get margin() {
191
- return this._margin;
192
- }
193
- set margin(value) {
194
- this._margin = value;
195
- this.root.margin = value;
196
- }
197
- maximizedView() {
198
- var _a;
199
- return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;
200
- }
201
- hasMaximizedView() {
202
- return this._maximizedNode !== undefined;
203
- }
204
- maximizeView(view) {
205
- var _a;
206
- const location = getGridLocation(view.element);
207
- const [_, node] = this.getNode(location);
208
- if (!(node instanceof LeafNode)) {
209
- return;
210
- }
211
- if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {
212
- return;
213
- }
214
- if (this.hasMaximizedView()) {
215
- this.exitMaximizedView();
216
- }
217
- serializeBranchNode(this.getView(), this.orientation);
218
- const hiddenOnMaximize = [];
219
- function hideAllViewsBut(parent, exclude) {
220
- for (let i = 0; i < parent.children.length; i++) {
221
- const child = parent.children[i];
222
- if (child instanceof LeafNode) {
223
- if (child !== exclude) {
224
- if (parent.isChildVisible(i)) {
225
- parent.setChildVisible(i, false);
226
- }
227
- else {
228
- hiddenOnMaximize.push(child);
229
- }
230
- }
231
- }
232
- else {
233
- hideAllViewsBut(child, exclude);
234
- }
235
- }
236
- }
237
- hideAllViewsBut(this.root, node);
238
- this._maximizedNode = { leaf: node, hiddenOnMaximize };
239
- this._onDidMaximizedNodeChange.fire({
240
- view: node.view,
241
- isMaximized: true,
242
- });
243
- }
244
- exitMaximizedView() {
245
- if (!this._maximizedNode) {
246
- return;
247
- }
248
- const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;
249
- function showViewsInReverseOrder(parent) {
250
- for (let index = parent.children.length - 1; index >= 0; index--) {
251
- const child = parent.children[index];
252
- if (child instanceof LeafNode) {
253
- if (!hiddenOnMaximize.includes(child)) {
254
- parent.setChildVisible(index, true);
255
- }
256
- }
257
- else {
258
- showViewsInReverseOrder(child);
259
- }
260
- }
261
- }
262
- showViewsInReverseOrder(this.root);
263
- const tmp = this._maximizedNode.leaf;
264
- this._maximizedNode = undefined;
265
- this._onDidMaximizedNodeChange.fire({
266
- view: tmp.view,
267
- isMaximized: false,
268
- });
269
- }
270
- serialize() {
271
- const maximizedView = this.maximizedView();
272
- let maxmizedViewLocation;
273
- if (maximizedView) {
274
- /**
275
- * The minimum information we can get away with in order to serialize a maxmized view is it's location within the grid
276
- * which is represented as a branch of indices
277
- */
278
- maxmizedViewLocation = getGridLocation(maximizedView.element);
279
- }
280
- /**
281
- * We pause the onDidMaximizedNodeChange events because this method needs to
282
- * call `this.exitMaximizedView()`. We don't want this to invoke any listeners
283
- * since we undo it before leaving this method
284
- */
285
- const pauseToken = this._onDidMaximizedNodeChange.pause();
286
- try {
287
- if (this.hasMaximizedView()) {
288
- /**
289
- * the saved layout cannot be in its maxmized state otherwise all of the underlying
290
- * view dimensions will be wrong
291
- *
292
- * To counteract this we temporaily remove the maximized view to compute the serialized output
293
- * of the grid before adding back the maxmized view as to not alter the layout from the users
294
- * perspective when `.toJSON()` is called
295
- */
296
- this.exitMaximizedView();
297
- }
298
- const root = serializeBranchNode(this.getView(), this.orientation);
299
- const result = {
300
- root,
301
- width: this.width,
302
- height: this.height,
303
- orientation: this.orientation,
304
- };
305
- if (maxmizedViewLocation) {
306
- result.maximizedNode = {
307
- location: maxmizedViewLocation,
308
- };
309
- }
310
- if (maximizedView) {
311
- // replace any maximzied view that was removed for serialization purposes
312
- this.maximizeView(maximizedView);
313
- }
314
- return result;
315
- }
316
- finally {
317
- pauseToken.dispose();
318
- }
319
- }
320
- dispose() {
321
- this.disposable.dispose();
322
- this._onDidChange.dispose();
323
- this._onDidMaximizedNodeChange.dispose();
324
- this._onDidViewVisibilityChange.dispose();
325
- this.root.dispose();
326
- this._maximizedNode = undefined;
327
- this.element.remove();
328
- }
329
- clear() {
330
- const orientation = this.root.orientation;
331
- this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.locked, this.margin);
332
- }
333
- deserialize(json, deserializer) {
334
- const orientation = json.orientation;
335
- const height = orientation === Orientation.VERTICAL ? json.height : json.width;
336
- this._deserialize(json.root, orientation, deserializer, height);
337
- /**
338
- * The deserialied layout must be positioned through this.layout(...)
339
- * before any maximizedNode can be positioned
340
- */
341
- this.layout(json.width, json.height);
342
- if (json.maximizedNode) {
343
- const location = json.maximizedNode.location;
344
- const [_, node] = this.getNode(location);
345
- if (!(node instanceof LeafNode)) {
346
- return;
347
- }
348
- this.maximizeView(node.view);
349
- }
350
- }
351
- _deserialize(root, orientation, deserializer, orthogonalSize) {
352
- this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);
353
- }
354
- _deserializeNode(node, orientation, deserializer, orthogonalSize) {
355
- var _a;
356
- let result;
357
- if (node.type === 'branch') {
358
- const serializedChildren = node.data;
359
- const children = serializedChildren.map((serializedChild) => {
360
- return {
361
- node: this._deserializeNode(serializedChild, orthogonal(orientation), deserializer, node.size),
362
- visible: serializedChild.visible,
363
- };
364
- });
365
- result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth
366
- orthogonalSize, // <- size - flips at each depth,
367
- this.locked, this.margin, children);
368
- }
369
- else {
370
- const view = deserializer.fromJSON(node);
371
- if (typeof node.visible === 'boolean') {
372
- (_a = view.setVisible) === null || _a === void 0 ? void 0 : _a.call(view, node.visible);
373
- }
374
- result = new LeafNode(view, orientation, orthogonalSize, node.size);
375
- }
376
- return result;
377
- }
378
- get root() {
379
- return this._root;
380
- }
381
- set root(root) {
382
- const oldRoot = this._root;
383
- if (oldRoot) {
384
- oldRoot.dispose();
385
- this._maximizedNode = undefined;
386
- oldRoot.element.remove();
387
- }
388
- this._root = root;
389
- this.element.appendChild(this._root.element);
390
- this.disposable.value = this._root.onDidChange((e) => {
391
- this._onDidChange.fire(e);
392
- });
393
- }
394
- normalize() {
395
- if (!this._root) {
396
- return;
397
- }
398
- if (this._root.children.length !== 1) {
399
- return;
400
- }
401
- const oldRoot = this.root;
402
- // can remove one level of redundant branching if there is only a single child
403
- const childReference = oldRoot.children[0];
404
- if (childReference instanceof LeafNode) {
405
- return;
406
- }
407
- oldRoot.element.remove();
408
- const child = oldRoot.removeChild(0); // Remove child to prevent double disposal
409
- oldRoot.dispose(); // Dispose old root (won't dispose removed child)
410
- child.dispose(); // Dispose the removed child
411
- this._root = cloneNode(childReference, childReference.size, childReference.orthogonalSize);
412
- this.element.appendChild(this._root.element);
413
- this.disposable.value = this._root.onDidChange((e) => {
414
- this._onDidChange.fire(e);
415
- });
416
- }
417
- /**
418
- * If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node
419
- * If the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node
420
- */
421
- insertOrthogonalSplitviewAtRoot() {
422
- if (!this._root) {
423
- return;
424
- }
425
- const oldRoot = this.root;
426
- oldRoot.element.remove();
427
- this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.locked, this.margin);
428
- if (oldRoot.children.length === 0) {
429
- // no data so no need to add anything back in
430
- }
431
- else if (oldRoot.children.length === 1) {
432
- // can remove one level of redundant branching if there is only a single child
433
- const childReference = oldRoot.children[0];
434
- const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root
435
- child.dispose();
436
- oldRoot.dispose();
437
- this._root.addChild(
438
- /**
439
- * the child node will have the same orientation as the new root since
440
- * we are removing the inbetween node.
441
- * the entire 'tree' must be flipped recursively to ensure that the orientation
442
- * flips at each level
443
- */
444
- flipNode(childReference, childReference.orthogonalSize, childReference.size), Sizing.Distribute, 0);
445
- }
446
- else {
447
- this._root.addChild(oldRoot, Sizing.Distribute, 0);
448
- }
449
- this.element.appendChild(this._root.element);
450
- this.disposable.value = this._root.onDidChange((e) => {
451
- this._onDidChange.fire(e);
452
- });
453
- }
454
- next(location) {
455
- return this.progmaticSelect(location);
456
- }
457
- previous(location) {
458
- return this.progmaticSelect(location, true);
459
- }
460
- getView(location) {
461
- const node = location ? this.getNode(location)[1] : this.root;
462
- return this._getViews(node, this.orientation);
463
- }
464
- _getViews(node, orientation, cachedVisibleSize) {
465
- const box = { height: node.height, width: node.width };
466
- if (node instanceof LeafNode) {
467
- return { box, view: node.view, cachedVisibleSize };
468
- }
469
- const children = [];
470
- for (let i = 0; i < node.children.length; i++) {
471
- const child = node.children[i];
472
- const nodeCachedVisibleSize = node.getChildCachedVisibleSize(i);
473
- children.push(this._getViews(child, orthogonal(orientation), nodeCachedVisibleSize));
474
- }
475
- return { box, children };
476
- }
477
- progmaticSelect(location, reverse = false) {
478
- const [path, node] = this.getNode(location);
479
- if (!(node instanceof LeafNode)) {
480
- throw new TypeError('invalid location');
481
- }
482
- for (let i = path.length - 1; i > -1; i--) {
483
- const n = path[i];
484
- const l = location[i] || 0;
485
- const canProgressInCurrentLevel = reverse
486
- ? l - 1 > -1
487
- : l + 1 < n.children.length;
488
- if (canProgressInCurrentLevel) {
489
- return findLeaf(n.children[reverse ? l - 1 : l + 1], reverse);
490
- }
491
- }
492
- return findLeaf(this.root, reverse);
493
- }
494
- constructor(proportionalLayout, styles, orientation, locked, margin) {
495
- this.proportionalLayout = proportionalLayout;
496
- this.styles = styles;
497
- this._locked = false;
498
- this._margin = 0;
499
- this._maximizedNode = undefined;
500
- this.disposable = new MutableDisposable();
501
- this._onDidChange = new Emitter();
502
- this.onDidChange = this._onDidChange.event;
503
- this._onDidViewVisibilityChange = new Emitter();
504
- this.onDidViewVisibilityChange = this._onDidViewVisibilityChange.event;
505
- this._onDidMaximizedNodeChange = new Emitter();
506
- this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;
507
- this.element = document.createElement('div');
508
- this.element.className = 'dv-grid-view';
509
- this._locked = locked !== null && locked !== void 0 ? locked : false;
510
- this._margin = margin !== null && margin !== void 0 ? margin : 0;
511
- this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this.locked, this.margin);
512
- }
513
- isViewVisible(location) {
514
- const [rest, index] = tail(location);
515
- const [, parent] = this.getNode(rest);
516
- if (!(parent instanceof BranchNode)) {
517
- throw new TypeError('Invalid from location');
518
- }
519
- return parent.isChildVisible(index);
520
- }
521
- setViewVisible(location, visible) {
522
- if (this.hasMaximizedView()) {
523
- this.exitMaximizedView();
524
- }
525
- const [rest, index] = tail(location);
526
- const [, parent] = this.getNode(rest);
527
- if (!(parent instanceof BranchNode)) {
528
- throw new TypeError('Invalid from location');
529
- }
530
- this._onDidViewVisibilityChange.fire();
531
- parent.setChildVisible(index, visible);
532
- }
533
- moveView(parentLocation, from, to) {
534
- if (this.hasMaximizedView()) {
535
- this.exitMaximizedView();
536
- }
537
- const [, parent] = this.getNode(parentLocation);
538
- if (!(parent instanceof BranchNode)) {
539
- throw new TypeError('Invalid location');
540
- }
541
- parent.moveChild(from, to);
542
- }
543
- addView(view, size, location) {
544
- if (this.hasMaximizedView()) {
545
- this.exitMaximizedView();
546
- }
547
- const [rest, index] = tail(location);
548
- const [pathToParent, parent] = this.getNode(rest);
549
- if (parent instanceof BranchNode) {
550
- const node = new LeafNode(view, orthogonal(parent.orientation), parent.orthogonalSize);
551
- parent.addChild(node, size, index);
552
- }
553
- else {
554
- const [grandParent, ..._] = [...pathToParent].reverse();
555
- const [parentIndex, ...__] = [...rest].reverse();
556
- let newSiblingSize = 0;
557
- const newSiblingCachedVisibleSize = grandParent.getChildCachedVisibleSize(parentIndex);
558
- if (typeof newSiblingCachedVisibleSize === 'number') {
559
- newSiblingSize = Sizing.Invisible(newSiblingCachedVisibleSize);
560
- }
561
- const child = grandParent.removeChild(parentIndex);
562
- child.dispose();
563
- const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.locked, this.margin);
564
- grandParent.addChild(newParent, parent.size, parentIndex);
565
- const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);
566
- newParent.addChild(newSibling, newSiblingSize, 0);
567
- if (typeof size !== 'number' && size.type === 'split') {
568
- size = { type: 'split', index: 0 };
569
- }
570
- const node = new LeafNode(view, grandParent.orientation, parent.size);
571
- newParent.addChild(node, size, index);
572
- }
573
- }
574
- remove(view, sizing) {
575
- const location = getGridLocation(view.element);
576
- return this.removeView(location, sizing);
577
- }
578
- removeView(location, sizing) {
579
- if (this.hasMaximizedView()) {
580
- this.exitMaximizedView();
581
- }
582
- const [rest, index] = tail(location);
583
- const [pathToParent, parent] = this.getNode(rest);
584
- if (!(parent instanceof BranchNode)) {
585
- throw new TypeError('Invalid location');
586
- }
587
- const nodeToRemove = parent.children[index];
588
- if (!(nodeToRemove instanceof LeafNode)) {
589
- throw new TypeError('Invalid location');
590
- }
591
- parent.removeChild(index, sizing);
592
- nodeToRemove.dispose();
593
- if (parent.children.length !== 1) {
594
- return nodeToRemove.view;
595
- }
596
- // if the parent has only one child and we know the parent is a BranchNode we can make the tree
597
- // more efficiently spaced by replacing the parent BranchNode with the child.
598
- // if that child is a LeafNode then we simply replace the BranchNode with the child otherwise if the child
599
- // is a BranchNode too we should spread it's children into the grandparent.
600
- // refer to the remaining child as the sibling
601
- const sibling = parent.children[0];
602
- if (pathToParent.length === 0) {
603
- // if the parent is root
604
- if (sibling instanceof LeafNode) {
605
- // if the sibling is a leaf node no action is required
606
- return nodeToRemove.view;
607
- }
608
- // otherwise the sibling is a branch node. since the parent is the root and the root has only one child
609
- // which is a branch node we can just set this branch node to be the new root node
610
- // for good housekeeping we'll removing the sibling from it's existing tree
611
- parent.removeChild(0, sizing);
612
- // and set that sibling node to be root
613
- this.root = sibling;
614
- return nodeToRemove.view;
615
- }
616
- // otherwise the parent is apart of a large sub-tree
617
- const [grandParent, ..._] = [...pathToParent].reverse();
618
- const [parentIndex, ...__] = [...rest].reverse();
619
- const isSiblingVisible = parent.isChildVisible(0);
620
- // either way we need to remove the sibling from it's existing tree
621
- parent.removeChild(0, sizing);
622
- // note the sizes of all of the grandparents children
623
- const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
624
- // remove the parent from the grandparent since we are moving the sibling to take the parents place
625
- // this parent is no longer used and can be disposed of
626
- grandParent.removeChild(parentIndex, sizing).dispose();
627
- if (sibling instanceof BranchNode) {
628
- // replace the parent with the siblings children
629
- sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
630
- // and add those siblings to the grandparent
631
- for (let i = 0; i < sibling.children.length; i++) {
632
- const child = sibling.children[i];
633
- grandParent.addChild(child, child.size, parentIndex + i);
634
- }
635
- /**
636
- * clean down the branch node since we need to dipose of it and
637
- * when .dispose() it called on a branch it will dispose of any
638
- * views it is holding onto.
639
- */
640
- while (sibling.children.length > 0) {
641
- sibling.removeChild(0);
642
- }
643
- }
644
- else {
645
- // otherwise create a new leaf node and add that to the grandparent
646
- const newSibling = new LeafNode(sibling.view, orthogonal(sibling.orientation), sibling.size);
647
- const siblingSizing = isSiblingVisible
648
- ? sibling.orthogonalSize
649
- : Sizing.Invisible(sibling.orthogonalSize);
650
- grandParent.addChild(newSibling, siblingSizing, parentIndex);
651
- }
652
- // the containing node of the sibling is no longer required and can be disposed of
653
- sibling.dispose();
654
- // resize everything
655
- for (let i = 0; i < sizes.length; i++) {
656
- grandParent.resizeChild(i, sizes[i]);
657
- }
658
- return nodeToRemove.view;
659
- }
660
- layout(width, height) {
661
- const [size, orthogonalSize] = this.root.orientation === Orientation.HORIZONTAL
662
- ? [height, width]
663
- : [width, height];
664
- this.root.layout(size, orthogonalSize);
665
- }
666
- getNode(location, node = this.root, path = []) {
667
- if (location.length === 0) {
668
- return [path, node];
669
- }
670
- if (!(node instanceof BranchNode)) {
671
- throw new TypeError('Invalid location');
672
- }
673
- const [index, ...rest] = location;
674
- if (index < 0 || index >= node.children.length) {
675
- throw new Error('Invalid location');
676
- }
677
- const child = node.children[index];
678
- path.push(node);
679
- return this.getNode(rest, child, path);
680
- }
681
- }