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