dockview 1.6.0 → 1.7.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 (425) hide show
  1. package/dist/cjs/dockview/defaultTab.js.map +1 -0
  2. package/dist/{esm/react → cjs}/dockview/dockview.d.ts +1 -4
  3. package/dist/cjs/{react/dockview → dockview}/dockview.js +25 -28
  4. package/dist/cjs/dockview/dockview.js.map +1 -0
  5. package/dist/cjs/{react/dockview → dockview}/groupControlsRenderer.d.ts +5 -16
  6. package/dist/cjs/{react/dockview → dockview}/groupControlsRenderer.js +3 -3
  7. package/dist/cjs/dockview/groupControlsRenderer.js.map +1 -0
  8. package/dist/{esm/react → cjs}/dockview/reactContentPart.d.ts +3 -11
  9. package/dist/cjs/{react/dockview → dockview}/reactContentPart.js +3 -11
  10. package/dist/cjs/dockview/reactContentPart.js.map +1 -0
  11. package/dist/cjs/{react/dockview → dockview}/reactHeaderPart.d.ts +1 -9
  12. package/dist/cjs/{react/dockview → dockview}/reactHeaderPart.js +0 -12
  13. package/dist/cjs/dockview/reactHeaderPart.js.map +1 -0
  14. package/dist/cjs/{react/dockview → dockview}/reactWatermarkPart.d.ts +6 -11
  15. package/dist/cjs/{react/dockview → dockview}/reactWatermarkPart.js +5 -17
  16. package/dist/cjs/dockview/reactWatermarkPart.js.map +1 -0
  17. package/dist/cjs/gridview/gridview.d.ts +22 -132
  18. package/dist/cjs/gridview/gridview.js +85 -486
  19. package/dist/cjs/gridview/gridview.js.map +1 -1
  20. package/dist/cjs/{react/gridview → gridview}/view.d.ts +1 -2
  21. package/dist/cjs/{react/gridview → gridview}/view.js +4 -6
  22. package/dist/cjs/gridview/view.js.map +1 -0
  23. package/dist/cjs/index.d.ts +8 -28
  24. package/dist/cjs/index.js +7 -30
  25. package/dist/cjs/index.js.map +1 -1
  26. package/dist/cjs/paneview/paneview.d.ts +22 -38
  27. package/dist/cjs/paneview/paneview.js +138 -186
  28. package/dist/cjs/paneview/paneview.js.map +1 -1
  29. package/dist/cjs/{react/paneview → paneview}/view.d.ts +1 -2
  30. package/dist/cjs/paneview/view.js.map +1 -0
  31. package/dist/{esm/react → cjs}/react.d.ts +3 -4
  32. package/dist/cjs/{react/react.js → react.js} +4 -2
  33. package/dist/cjs/react.js.map +1 -0
  34. package/dist/{esm/react → cjs}/splitview/splitview.d.ts +1 -3
  35. package/dist/cjs/{react/splitview → splitview}/splitview.js +5 -8
  36. package/dist/cjs/splitview/splitview.js.map +1 -0
  37. package/dist/{esm/react → cjs}/splitview/view.d.ts +2 -2
  38. package/dist/cjs/{react/splitview → splitview}/view.js +3 -4
  39. package/dist/cjs/splitview/view.js.map +1 -0
  40. package/dist/cjs/svg.d.ts +3 -3
  41. package/dist/cjs/svg.js +32 -40
  42. package/dist/cjs/svg.js.map +1 -1
  43. package/dist/cjs/types.d.ts +5 -6
  44. package/dist/cjs/types.js +0 -5
  45. package/dist/cjs/types.js.map +1 -1
  46. package/dist/dockview.amd.js +1442 -1497
  47. package/dist/dockview.amd.min.js +2 -2
  48. package/dist/dockview.amd.min.noStyle.js +2 -2
  49. package/dist/dockview.amd.noStyle.js +1441 -1496
  50. package/dist/dockview.cjs.js +1442 -1497
  51. package/dist/dockview.esm.js +1426 -1491
  52. package/dist/dockview.esm.min.js +2 -2
  53. package/dist/dockview.js +1442 -1497
  54. package/dist/dockview.min.js +2 -2
  55. package/dist/dockview.min.noStyle.js +2 -2
  56. package/dist/dockview.noStyle.js +1441 -1496
  57. package/dist/{cjs/react → esm}/dockview/dockview.d.ts +1 -4
  58. package/dist/esm/{react/dockview → dockview}/dockview.js +20 -10
  59. package/dist/esm/{react/dockview → dockview}/groupControlsRenderer.d.ts +5 -16
  60. package/dist/esm/{react/dockview → dockview}/groupControlsRenderer.js +3 -3
  61. package/dist/{cjs/react → esm}/dockview/reactContentPart.d.ts +3 -11
  62. package/dist/esm/{react/dockview → dockview}/reactContentPart.js +3 -11
  63. package/dist/esm/{react/dockview → dockview}/reactHeaderPart.d.ts +1 -9
  64. package/dist/esm/{react/dockview → dockview}/reactHeaderPart.js +0 -12
  65. package/dist/esm/{react/dockview → dockview}/reactWatermarkPart.d.ts +6 -11
  66. package/dist/esm/{react/dockview → dockview}/reactWatermarkPart.js +5 -16
  67. package/dist/esm/gridview/gridview.d.ts +22 -132
  68. package/dist/esm/gridview/gridview.js +60 -416
  69. package/dist/esm/{react/gridview → gridview}/view.d.ts +1 -2
  70. package/dist/esm/{react/gridview → gridview}/view.js +2 -4
  71. package/dist/esm/index.d.ts +8 -28
  72. package/dist/esm/index.js +7 -22
  73. package/dist/esm/paneview/paneview.d.ts +22 -38
  74. package/dist/esm/paneview/paneview.js +85 -132
  75. package/dist/esm/{react/paneview → paneview}/view.d.ts +1 -2
  76. package/dist/{cjs/react → esm}/react.d.ts +3 -4
  77. package/dist/esm/{react/react.js → react.js} +4 -2
  78. package/dist/{cjs/react → esm}/splitview/splitview.d.ts +1 -3
  79. package/dist/esm/{react/splitview → splitview}/splitview.js +1 -4
  80. package/dist/{cjs/react → esm}/splitview/view.d.ts +2 -2
  81. package/dist/esm/{react/splitview → splitview}/view.js +1 -2
  82. package/dist/esm/svg.d.ts +3 -3
  83. package/dist/esm/svg.js +6 -30
  84. package/dist/esm/types.d.ts +5 -6
  85. package/dist/esm/types.js +1 -3
  86. package/dist/styles/dockview.css +1 -617
  87. package/package.json +7 -3
  88. package/LICENSE +0 -21
  89. package/dist/cjs/actionbar/actionsContainer.d.ts +0 -7
  90. package/dist/cjs/actionbar/actionsContainer.js +0 -27
  91. package/dist/cjs/actionbar/actionsContainer.js.map +0 -1
  92. package/dist/cjs/api/component.api.d.ts +0 -145
  93. package/dist/cjs/api/component.api.js +0 -579
  94. package/dist/cjs/api/component.api.js.map +0 -1
  95. package/dist/cjs/api/dockviewPanelApi.d.ts +0 -34
  96. package/dist/cjs/api/dockviewPanelApi.js +0 -84
  97. package/dist/cjs/api/dockviewPanelApi.js.map +0 -1
  98. package/dist/cjs/api/gridviewPanelApi.d.ts +0 -37
  99. package/dist/cjs/api/gridviewPanelApi.js +0 -48
  100. package/dist/cjs/api/gridviewPanelApi.js.map +0 -1
  101. package/dist/cjs/api/panelApi.d.ts +0 -88
  102. package/dist/cjs/api/panelApi.js +0 -138
  103. package/dist/cjs/api/panelApi.js.map +0 -1
  104. package/dist/cjs/api/paneviewPanelApi.d.ts +0 -26
  105. package/dist/cjs/api/paneviewPanelApi.js +0 -58
  106. package/dist/cjs/api/paneviewPanelApi.js.map +0 -1
  107. package/dist/cjs/api/splitviewPanelApi.d.ts +0 -32
  108. package/dist/cjs/api/splitviewPanelApi.js +0 -48
  109. package/dist/cjs/api/splitviewPanelApi.js.map +0 -1
  110. package/dist/cjs/array.d.ts +0 -13
  111. package/dist/cjs/array.js +0 -78
  112. package/dist/cjs/array.js.map +0 -1
  113. package/dist/cjs/dnd/abstractDragHandler.d.ts +0 -11
  114. package/dist/cjs/dnd/abstractDragHandler.js +0 -116
  115. package/dist/cjs/dnd/abstractDragHandler.js.map +0 -1
  116. package/dist/cjs/dnd/dataTransfer.d.ts +0 -31
  117. package/dist/cjs/dnd/dataTransfer.js +0 -101
  118. package/dist/cjs/dnd/dataTransfer.js.map +0 -1
  119. package/dist/cjs/dnd/dnd.d.ts +0 -27
  120. package/dist/cjs/dnd/dnd.js +0 -60
  121. package/dist/cjs/dnd/dnd.js.map +0 -1
  122. package/dist/cjs/dnd/droptarget.d.ts +0 -42
  123. package/dist/cjs/dnd/droptarget.js +0 -280
  124. package/dist/cjs/dnd/droptarget.js.map +0 -1
  125. package/dist/cjs/dnd/ghost.d.ts +0 -1
  126. package/dist/cjs/dnd/ghost.js +0 -15
  127. package/dist/cjs/dnd/ghost.js.map +0 -1
  128. package/dist/cjs/dnd/groupDragHandler.d.ts +0 -11
  129. package/dist/cjs/dnd/groupDragHandler.js +0 -62
  130. package/dist/cjs/dnd/groupDragHandler.js.map +0 -1
  131. package/dist/cjs/dockview/components/tab/defaultTab.d.ts +0 -27
  132. package/dist/cjs/dockview/components/tab/defaultTab.js +0 -122
  133. package/dist/cjs/dockview/components/tab/defaultTab.js.map +0 -1
  134. package/dist/cjs/dockview/components/watermark/watermark.d.ts +0 -20
  135. package/dist/cjs/dockview/components/watermark/watermark.js +0 -102
  136. package/dist/cjs/dockview/components/watermark/watermark.js.map +0 -1
  137. package/dist/cjs/dockview/defaultGroupPanelView.d.ts +0 -29
  138. package/dist/cjs/dockview/defaultGroupPanelView.js +0 -69
  139. package/dist/cjs/dockview/defaultGroupPanelView.js.map +0 -1
  140. package/dist/cjs/dockview/deserializer.d.ts +0 -6
  141. package/dist/cjs/dockview/deserializer.js +0 -3
  142. package/dist/cjs/dockview/deserializer.js.map +0 -1
  143. package/dist/cjs/dockview/dockviewComponent.d.ts +0 -133
  144. package/dist/cjs/dockview/dockviewComponent.js +0 -796
  145. package/dist/cjs/dockview/dockviewComponent.js.map +0 -1
  146. package/dist/cjs/dockview/dockviewPanel.d.ts +0 -42
  147. package/dist/cjs/dockview/dockviewPanel.js +0 -161
  148. package/dist/cjs/dockview/dockviewPanel.js.map +0 -1
  149. package/dist/cjs/dockview/options.d.ts +0 -110
  150. package/dist/cjs/dockview/options.js +0 -32
  151. package/dist/cjs/dockview/options.js.map +0 -1
  152. package/dist/cjs/dockview/validation.d.ts +0 -2
  153. package/dist/cjs/dockview/validation.js +0 -135
  154. package/dist/cjs/dockview/validation.js.map +0 -1
  155. package/dist/cjs/dom.d.ts +0 -14
  156. package/dist/cjs/dom.js +0 -183
  157. package/dist/cjs/dom.js.map +0 -1
  158. package/dist/cjs/events.d.ts +0 -30
  159. package/dist/cjs/events.js +0 -130
  160. package/dist/cjs/events.js.map +0 -1
  161. package/dist/cjs/gridview/baseComponentGridview.d.ts +0 -87
  162. package/dist/cjs/gridview/baseComponentGridview.js +0 -279
  163. package/dist/cjs/gridview/baseComponentGridview.js.map +0 -1
  164. package/dist/cjs/gridview/basePanelView.d.ts +0 -43
  165. package/dist/cjs/gridview/basePanelView.js +0 -124
  166. package/dist/cjs/gridview/basePanelView.js.map +0 -1
  167. package/dist/cjs/gridview/branchNode.d.ts +0 -49
  168. package/dist/cjs/gridview/branchNode.js +0 -343
  169. package/dist/cjs/gridview/branchNode.js.map +0 -1
  170. package/dist/cjs/gridview/gridviewComponent.d.ts +0 -85
  171. package/dist/cjs/gridview/gridviewComponent.js +0 -325
  172. package/dist/cjs/gridview/gridviewComponent.js.map +0 -1
  173. package/dist/cjs/gridview/gridviewPanel.d.ts +0 -60
  174. package/dist/cjs/gridview/gridviewPanel.js +0 -202
  175. package/dist/cjs/gridview/gridviewPanel.js.map +0 -1
  176. package/dist/cjs/gridview/leafNode.d.ts +0 -34
  177. package/dist/cjs/gridview/leafNode.js +0 -171
  178. package/dist/cjs/gridview/leafNode.js.map +0 -1
  179. package/dist/cjs/gridview/options.d.ts +0 -18
  180. package/dist/cjs/gridview/options.js +0 -3
  181. package/dist/cjs/gridview/options.js.map +0 -1
  182. package/dist/cjs/gridview/types.d.ts +0 -3
  183. package/dist/cjs/gridview/types.js +0 -3
  184. package/dist/cjs/gridview/types.js.map +0 -1
  185. package/dist/cjs/groupview/dnd.d.ts +0 -6
  186. package/dist/cjs/groupview/dnd.js +0 -11
  187. package/dist/cjs/groupview/dnd.js.map +0 -1
  188. package/dist/cjs/groupview/groupview.d.ts +0 -177
  189. package/dist/cjs/groupview/groupview.js +0 -608
  190. package/dist/cjs/groupview/groupview.js.map +0 -1
  191. package/dist/cjs/groupview/groupviewPanel.d.ts +0 -35
  192. package/dist/cjs/groupview/groupviewPanel.js +0 -129
  193. package/dist/cjs/groupview/groupviewPanel.js.map +0 -1
  194. package/dist/cjs/groupview/panel/content.d.ts +0 -30
  195. package/dist/cjs/groupview/panel/content.js +0 -101
  196. package/dist/cjs/groupview/panel/content.js.map +0 -1
  197. package/dist/cjs/groupview/tab.d.ts +0 -31
  198. package/dist/cjs/groupview/tab.js +0 -125
  199. package/dist/cjs/groupview/tab.js.map +0 -1
  200. package/dist/cjs/groupview/titlebar/tabsContainer.d.ts +0 -65
  201. package/dist/cjs/groupview/titlebar/tabsContainer.js +0 -252
  202. package/dist/cjs/groupview/titlebar/tabsContainer.js.map +0 -1
  203. package/dist/cjs/groupview/titlebar/voidContainer.d.ts +0 -15
  204. package/dist/cjs/groupview/titlebar/voidContainer.js +0 -74
  205. package/dist/cjs/groupview/titlebar/voidContainer.js.map +0 -1
  206. package/dist/cjs/groupview/types.d.ts +0 -68
  207. package/dist/cjs/groupview/types.js +0 -3
  208. package/dist/cjs/groupview/types.js.map +0 -1
  209. package/dist/cjs/hostedContainer.d.ts +0 -23
  210. package/dist/cjs/hostedContainer.js +0 -74
  211. package/dist/cjs/hostedContainer.js.map +0 -1
  212. package/dist/cjs/lifecycle.d.ts +0 -22
  213. package/dist/cjs/lifecycle.js +0 -89
  214. package/dist/cjs/lifecycle.js.map +0 -1
  215. package/dist/cjs/math.d.ts +0 -4
  216. package/dist/cjs/math.js +0 -16
  217. package/dist/cjs/math.js.map +0 -1
  218. package/dist/cjs/panel/componentFactory.d.ts +0 -8
  219. package/dist/cjs/panel/componentFactory.js +0 -31
  220. package/dist/cjs/panel/componentFactory.js.map +0 -1
  221. package/dist/cjs/panel/types.d.ts +0 -33
  222. package/dist/cjs/panel/types.js +0 -3
  223. package/dist/cjs/panel/types.js.map +0 -1
  224. package/dist/cjs/paneview/defaultPaneviewHeader.d.ts +0 -21
  225. package/dist/cjs/paneview/defaultPaneviewHeader.js +0 -91
  226. package/dist/cjs/paneview/defaultPaneviewHeader.js.map +0 -1
  227. package/dist/cjs/paneview/draggablePaneviewPanel.d.ts +0 -19
  228. package/dist/cjs/paneview/draggablePaneviewPanel.js +0 -131
  229. package/dist/cjs/paneview/draggablePaneviewPanel.js.map +0 -1
  230. package/dist/cjs/paneview/options.d.ts +0 -27
  231. package/dist/cjs/paneview/options.js +0 -3
  232. package/dist/cjs/paneview/options.js.map +0 -1
  233. package/dist/cjs/paneview/paneviewComponent.d.ts +0 -129
  234. package/dist/cjs/paneview/paneviewComponent.js +0 -395
  235. package/dist/cjs/paneview/paneviewComponent.js.map +0 -1
  236. package/dist/cjs/paneview/paneviewPanel.d.ts +0 -92
  237. package/dist/cjs/paneview/paneviewPanel.js +0 -276
  238. package/dist/cjs/paneview/paneviewPanel.js.map +0 -1
  239. package/dist/cjs/react/deserializer.d.ts +0 -10
  240. package/dist/cjs/react/deserializer.js +0 -44
  241. package/dist/cjs/react/deserializer.js.map +0 -1
  242. package/dist/cjs/react/dockview/defaultTab.js.map +0 -1
  243. package/dist/cjs/react/dockview/dockview.js.map +0 -1
  244. package/dist/cjs/react/dockview/groupControlsRenderer.js.map +0 -1
  245. package/dist/cjs/react/dockview/reactContentPart.js.map +0 -1
  246. package/dist/cjs/react/dockview/reactHeaderPart.js.map +0 -1
  247. package/dist/cjs/react/dockview/reactWatermarkPart.js.map +0 -1
  248. package/dist/cjs/react/dockview/v2/reactContentRenderer.d.ts +0 -29
  249. package/dist/cjs/react/dockview/v2/reactContentRenderer.js +0 -88
  250. package/dist/cjs/react/dockview/v2/reactContentRenderer.js.map +0 -1
  251. package/dist/cjs/react/dockview/v2/reactGroupPanelView.d.ts +0 -7
  252. package/dist/cjs/react/dockview/v2/reactGroupPanelView.js +0 -35
  253. package/dist/cjs/react/dockview/v2/reactGroupPanelView.js.map +0 -1
  254. package/dist/cjs/react/dockview/v2/webviewContentRenderer.d.ts +0 -18
  255. package/dist/cjs/react/dockview/v2/webviewContentRenderer.js +0 -46
  256. package/dist/cjs/react/dockview/v2/webviewContentRenderer.js.map +0 -1
  257. package/dist/cjs/react/gridview/gridview.d.ts +0 -24
  258. package/dist/cjs/react/gridview/gridview.js +0 -113
  259. package/dist/cjs/react/gridview/gridview.js.map +0 -1
  260. package/dist/cjs/react/gridview/view.js.map +0 -1
  261. package/dist/cjs/react/index.d.ts +0 -9
  262. package/dist/cjs/react/index.js +0 -24
  263. package/dist/cjs/react/index.js.map +0 -1
  264. package/dist/cjs/react/paneview/paneview.d.ts +0 -30
  265. package/dist/cjs/react/paneview/paneview.js +0 -156
  266. package/dist/cjs/react/paneview/paneview.js.map +0 -1
  267. package/dist/cjs/react/paneview/view.js.map +0 -1
  268. package/dist/cjs/react/react.js.map +0 -1
  269. package/dist/cjs/react/splitview/splitview.js.map +0 -1
  270. package/dist/cjs/react/splitview/view.js.map +0 -1
  271. package/dist/cjs/react/svg.d.ts +0 -3
  272. package/dist/cjs/react/svg.js +0 -36
  273. package/dist/cjs/react/svg.js.map +0 -1
  274. package/dist/cjs/react/types.d.ts +0 -7
  275. package/dist/cjs/react/types.js +0 -3
  276. package/dist/cjs/react/types.js.map +0 -1
  277. package/dist/cjs/splitview/core/options.d.ts +0 -26
  278. package/dist/cjs/splitview/core/options.js +0 -3
  279. package/dist/cjs/splitview/core/options.js.map +0 -1
  280. package/dist/cjs/splitview/core/splitview.d.ts +0 -127
  281. package/dist/cjs/splitview/core/splitview.js +0 -909
  282. package/dist/cjs/splitview/core/splitview.js.map +0 -1
  283. package/dist/cjs/splitview/core/viewItem.d.ts +0 -25
  284. package/dist/cjs/splitview/core/viewItem.js +0 -125
  285. package/dist/cjs/splitview/core/viewItem.js.map +0 -1
  286. package/dist/cjs/splitview/splitviewComponent.d.ts +0 -101
  287. package/dist/cjs/splitview/splitviewComponent.js +0 -374
  288. package/dist/cjs/splitview/splitviewComponent.js.map +0 -1
  289. package/dist/cjs/splitview/splitviewPanel.d.ts +0 -45
  290. package/dist/cjs/splitview/splitviewPanel.js +0 -180
  291. package/dist/cjs/splitview/splitviewPanel.js.map +0 -1
  292. package/dist/esm/actionbar/actionsContainer.d.ts +0 -7
  293. package/dist/esm/actionbar/actionsContainer.js +0 -17
  294. package/dist/esm/api/component.api.d.ts +0 -145
  295. package/dist/esm/api/component.api.js +0 -329
  296. package/dist/esm/api/dockviewPanelApi.d.ts +0 -34
  297. package/dist/esm/api/dockviewPanelApi.js +0 -48
  298. package/dist/esm/api/gridviewPanelApi.d.ts +0 -37
  299. package/dist/esm/api/gridviewPanelApi.js +0 -25
  300. package/dist/esm/api/panelApi.d.ts +0 -88
  301. package/dist/esm/api/panelApi.js +0 -95
  302. package/dist/esm/api/paneviewPanelApi.d.ts +0 -26
  303. package/dist/esm/api/paneviewPanelApi.js +0 -27
  304. package/dist/esm/api/splitviewPanelApi.d.ts +0 -32
  305. package/dist/esm/api/splitviewPanelApi.js +0 -25
  306. package/dist/esm/array.d.ts +0 -13
  307. package/dist/esm/array.js +0 -67
  308. package/dist/esm/dnd/abstractDragHandler.d.ts +0 -11
  309. package/dist/esm/dnd/abstractDragHandler.js +0 -37
  310. package/dist/esm/dnd/dataTransfer.d.ts +0 -31
  311. package/dist/esm/dnd/dataTransfer.js +0 -69
  312. package/dist/esm/dnd/dnd.d.ts +0 -27
  313. package/dist/esm/dnd/dnd.js +0 -36
  314. package/dist/esm/dnd/droptarget.d.ts +0 -42
  315. package/dist/esm/dnd/droptarget.js +0 -249
  316. package/dist/esm/dnd/ghost.d.ts +0 -1
  317. package/dist/esm/dnd/ghost.js +0 -10
  318. package/dist/esm/dnd/groupDragHandler.d.ts +0 -11
  319. package/dist/esm/dnd/groupDragHandler.js +0 -38
  320. package/dist/esm/dockview/components/tab/defaultTab.d.ts +0 -27
  321. package/dist/esm/dockview/components/tab/defaultTab.js +0 -79
  322. package/dist/esm/dockview/components/watermark/watermark.d.ts +0 -20
  323. package/dist/esm/dockview/components/watermark/watermark.js +0 -70
  324. package/dist/esm/dockview/defaultGroupPanelView.d.ts +0 -29
  325. package/dist/esm/dockview/defaultGroupPanelView.js +0 -44
  326. package/dist/esm/dockview/deserializer.d.ts +0 -6
  327. package/dist/esm/dockview/deserializer.js +0 -1
  328. package/dist/esm/dockview/dockviewComponent.d.ts +0 -133
  329. package/dist/esm/dockview/dockviewComponent.js +0 -632
  330. package/dist/esm/dockview/dockviewPanel.d.ts +0 -42
  331. package/dist/esm/dockview/dockviewPanel.js +0 -111
  332. package/dist/esm/dockview/options.d.ts +0 -110
  333. package/dist/esm/dockview/options.js +0 -24
  334. package/dist/esm/dockview/validation.d.ts +0 -2
  335. package/dist/esm/dockview/validation.js +0 -86
  336. package/dist/esm/dom.d.ts +0 -14
  337. package/dist/esm/dom.js +0 -113
  338. package/dist/esm/events.d.ts +0 -30
  339. package/dist/esm/events.js +0 -88
  340. package/dist/esm/gridview/baseComponentGridview.d.ts +0 -87
  341. package/dist/esm/gridview/baseComponentGridview.js +0 -188
  342. package/dist/esm/gridview/basePanelView.d.ts +0 -43
  343. package/dist/esm/gridview/basePanelView.js +0 -74
  344. package/dist/esm/gridview/branchNode.d.ts +0 -49
  345. package/dist/esm/gridview/branchNode.js +0 -218
  346. package/dist/esm/gridview/gridviewComponent.d.ts +0 -85
  347. package/dist/esm/gridview/gridviewComponent.js +0 -237
  348. package/dist/esm/gridview/gridviewPanel.d.ts +0 -60
  349. package/dist/esm/gridview/gridviewPanel.js +0 -138
  350. package/dist/esm/gridview/leafNode.d.ts +0 -34
  351. package/dist/esm/gridview/leafNode.js +0 -103
  352. package/dist/esm/gridview/options.d.ts +0 -18
  353. package/dist/esm/gridview/options.js +0 -1
  354. package/dist/esm/gridview/types.d.ts +0 -3
  355. package/dist/esm/gridview/types.js +0 -1
  356. package/dist/esm/groupview/dnd.d.ts +0 -6
  357. package/dist/esm/groupview/dnd.js +0 -7
  358. package/dist/esm/groupview/groupview.d.ts +0 -177
  359. package/dist/esm/groupview/groupview.js +0 -462
  360. package/dist/esm/groupview/groupviewPanel.d.ts +0 -35
  361. package/dist/esm/groupview/groupviewPanel.js +0 -61
  362. package/dist/esm/groupview/panel/content.d.ts +0 -30
  363. package/dist/esm/groupview/panel/content.js +0 -73
  364. package/dist/esm/groupview/tab.d.ts +0 -31
  365. package/dist/esm/groupview/tab.js +0 -94
  366. package/dist/esm/groupview/titlebar/tabsContainer.d.ts +0 -65
  367. package/dist/esm/groupview/titlebar/tabsContainer.js +0 -183
  368. package/dist/esm/groupview/titlebar/voidContainer.d.ts +0 -15
  369. package/dist/esm/groupview/titlebar/voidContainer.js +0 -47
  370. package/dist/esm/groupview/types.d.ts +0 -68
  371. package/dist/esm/groupview/types.js +0 -1
  372. package/dist/esm/hostedContainer.d.ts +0 -23
  373. package/dist/esm/hostedContainer.js +0 -63
  374. package/dist/esm/lifecycle.d.ts +0 -22
  375. package/dist/esm/lifecycle.js +0 -39
  376. package/dist/esm/math.d.ts +0 -4
  377. package/dist/esm/math.js +0 -10
  378. package/dist/esm/panel/componentFactory.d.ts +0 -8
  379. package/dist/esm/panel/componentFactory.js +0 -24
  380. package/dist/esm/panel/types.d.ts +0 -33
  381. package/dist/esm/panel/types.js +0 -1
  382. package/dist/esm/paneview/defaultPaneviewHeader.d.ts +0 -21
  383. package/dist/esm/paneview/defaultPaneviewHeader.js +0 -63
  384. package/dist/esm/paneview/draggablePaneviewPanel.d.ts +0 -19
  385. package/dist/esm/paneview/draggablePaneviewPanel.js +0 -91
  386. package/dist/esm/paneview/options.d.ts +0 -27
  387. package/dist/esm/paneview/options.js +0 -1
  388. package/dist/esm/paneview/paneviewComponent.d.ts +0 -129
  389. package/dist/esm/paneview/paneviewComponent.js +0 -270
  390. package/dist/esm/paneview/paneviewPanel.d.ts +0 -92
  391. package/dist/esm/paneview/paneviewPanel.js +0 -192
  392. package/dist/esm/react/deserializer.d.ts +0 -10
  393. package/dist/esm/react/deserializer.js +0 -38
  394. package/dist/esm/react/dockview/v2/reactContentRenderer.d.ts +0 -29
  395. package/dist/esm/react/dockview/v2/reactContentRenderer.js +0 -69
  396. package/dist/esm/react/dockview/v2/reactGroupPanelView.d.ts +0 -7
  397. package/dist/esm/react/dockview/v2/reactGroupPanelView.js +0 -12
  398. package/dist/esm/react/dockview/v2/webviewContentRenderer.d.ts +0 -18
  399. package/dist/esm/react/dockview/v2/webviewContentRenderer.js +0 -36
  400. package/dist/esm/react/gridview/gridview.d.ts +0 -24
  401. package/dist/esm/react/gridview/gridview.js +0 -70
  402. package/dist/esm/react/index.d.ts +0 -9
  403. package/dist/esm/react/index.js +0 -7
  404. package/dist/esm/react/paneview/paneview.d.ts +0 -30
  405. package/dist/esm/react/paneview/paneview.js +0 -100
  406. package/dist/esm/react/svg.d.ts +0 -3
  407. package/dist/esm/react/svg.js +0 -7
  408. package/dist/esm/react/types.d.ts +0 -7
  409. package/dist/esm/react/types.js +0 -1
  410. package/dist/esm/splitview/core/options.d.ts +0 -26
  411. package/dist/esm/splitview/core/options.js +0 -1
  412. package/dist/esm/splitview/core/splitview.d.ts +0 -127
  413. package/dist/esm/splitview/core/splitview.js +0 -689
  414. package/dist/esm/splitview/core/viewItem.d.ts +0 -25
  415. package/dist/esm/splitview/core/viewItem.js +0 -79
  416. package/dist/esm/splitview/splitviewComponent.d.ts +0 -101
  417. package/dist/esm/splitview/splitviewComponent.js +0 -249
  418. package/dist/esm/splitview/splitviewPanel.d.ts +0 -45
  419. package/dist/esm/splitview/splitviewPanel.js +0 -108
  420. /package/dist/cjs/{react/dockview → dockview}/defaultTab.d.ts +0 -0
  421. /package/dist/cjs/{react/dockview → dockview}/defaultTab.js +0 -0
  422. /package/dist/cjs/{react/paneview → paneview}/view.js +0 -0
  423. /package/dist/esm/{react/dockview → dockview}/defaultTab.d.ts +0 -0
  424. /package/dist/esm/{react/dockview → dockview}/defaultTab.js +0 -0
  425. /package/dist/esm/{react/paneview → paneview}/view.js +0 -0
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview
3
- * @version 1.6.0
3
+ * @version 1.7.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -100,7 +100,7 @@
100
100
  return paneTransfer.getData(PaneTransfer.prototype)[0];
101
101
  }
102
102
 
103
- exports.Event = void 0;
103
+ exports.DockviewEvent = void 0;
104
104
  (function (Event) {
105
105
  Event.any = (...children) => {
106
106
  return (listener) => {
@@ -114,7 +114,7 @@
114
114
  };
115
115
  };
116
116
  };
117
- })(exports.Event || (exports.Event = {}));
117
+ })(exports.DockviewEvent || (exports.DockviewEvent = {}));
118
118
  // dumb event emitter with better typings than nodes event emitter
119
119
  // https://github.com/microsoft/vscode/blob/master/src/vs/base/common/event.ts
120
120
  class Emitter {
@@ -341,16 +341,30 @@
341
341
  }
342
342
  }
343
343
 
344
- const clamp = (value, min, max) => {
345
- if (min > max) {
346
- throw new Error(`${min} > ${max} is an invalid condition`);
344
+ function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
345
+ const Component = typeof componentName === 'string'
346
+ ? components[componentName]
347
+ : undefined;
348
+ const FrameworkComponent = typeof componentName === 'string'
349
+ ? frameworkComponents[componentName]
350
+ : undefined;
351
+ if (Component && FrameworkComponent) {
352
+ throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
347
353
  }
348
- return Math.min(max, Math.max(value, min));
349
- };
350
- const sequentialNumberGenerator = () => {
351
- let value = 1;
352
- return { next: () => (value++).toString() };
353
- };
354
+ if (FrameworkComponent) {
355
+ if (!createFrameworkComponent) {
356
+ throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
357
+ }
358
+ return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
359
+ }
360
+ if (!Component) {
361
+ if (fallback) {
362
+ return fallback();
363
+ }
364
+ throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
365
+ }
366
+ return new Component(id, componentName);
367
+ }
354
368
 
355
369
  function tail(arr) {
356
370
  if (arr.length === 0) {
@@ -392,6 +406,26 @@
392
406
  arr.push(value);
393
407
  }
394
408
  }
409
+ function firstIndex(array, fn) {
410
+ for (let i = 0; i < array.length; i++) {
411
+ const element = array[i];
412
+ if (fn(element)) {
413
+ return i;
414
+ }
415
+ }
416
+ return -1;
417
+ }
418
+
419
+ const clamp = (value, min, max) => {
420
+ if (min > max) {
421
+ throw new Error(`${min} > ${max} is an invalid condition`);
422
+ }
423
+ return Math.min(max, Math.max(value, min));
424
+ };
425
+ const sequentialNumberGenerator = () => {
426
+ let value = 1;
427
+ return { next: () => (value++).toString() };
428
+ };
395
429
  const range = (from, to) => {
396
430
  const result = [];
397
431
  if (typeof to !== 'number') {
@@ -410,15 +444,6 @@
410
444
  }
411
445
  return result;
412
446
  };
413
- function firstIndex(array, fn) {
414
- for (let i = 0; i < array.length; i++) {
415
- const element = array[i];
416
- if (fn(element)) {
417
- return i;
418
- }
419
- }
420
- return -1;
421
- }
422
447
 
423
448
  class ViewItem {
424
449
  set size(size) {
@@ -433,25 +458,6 @@
433
458
  get visible() {
434
459
  return typeof this._cachedVisibleSize === 'undefined';
435
460
  }
436
- setVisible(visible, size) {
437
- var _a;
438
- if (visible === this.visible) {
439
- return;
440
- }
441
- if (visible) {
442
- this.size = clamp((_a = this._cachedVisibleSize) !== null && _a !== void 0 ? _a : 0, this.viewMinimumSize, this.viewMaximumSize);
443
- this._cachedVisibleSize = undefined;
444
- }
445
- else {
446
- this._cachedVisibleSize =
447
- typeof size === 'number' ? size : this.size;
448
- this.size = 0;
449
- }
450
- this.container.classList.toggle('visible', visible);
451
- if (this.view.setVisible) {
452
- this.view.setVisible(visible);
453
- }
454
- }
455
461
  get minimumSize() {
456
462
  return this.visible ? this.view.minimumSize : 0;
457
463
  }
@@ -488,11 +494,25 @@
488
494
  this._cachedVisibleSize = size.cachedVisibleSize;
489
495
  }
490
496
  }
491
- // layout(offset: number, layoutContext: TLayoutContext | undefined): void {
492
- // this.layoutContainer(offset);
493
- // this.view.layout(this.size, offset, layoutContext);
494
- // }
495
- // abstract layoutContainer(offset: number): void;
497
+ setVisible(visible, size) {
498
+ var _a;
499
+ if (visible === this.visible) {
500
+ return;
501
+ }
502
+ if (visible) {
503
+ this.size = clamp((_a = this._cachedVisibleSize) !== null && _a !== void 0 ? _a : 0, this.viewMinimumSize, this.viewMaximumSize);
504
+ this._cachedVisibleSize = undefined;
505
+ }
506
+ else {
507
+ this._cachedVisibleSize =
508
+ typeof size === 'number' ? size : this.size;
509
+ this.size = 0;
510
+ }
511
+ this.container.classList.toggle('visible', visible);
512
+ if (this.view.setVisible) {
513
+ this.view.setVisible(visible);
514
+ }
515
+ }
496
516
  dispose() {
497
517
  this.disposable.dispose();
498
518
  return this.view;
@@ -601,14 +621,14 @@
601
621
  this._orthogonalSize = 0;
602
622
  this.contentSize = 0;
603
623
  this._proportions = undefined;
624
+ this._startSnappingEnabled = true;
625
+ this._endSnappingEnabled = true;
604
626
  this._onDidSashEnd = new Emitter();
605
627
  this.onDidSashEnd = this._onDidSashEnd.event;
606
628
  this._onDidAddView = new Emitter();
607
629
  this.onDidAddView = this._onDidAddView.event;
608
630
  this._onDidRemoveView = new Emitter();
609
631
  this.onDidRemoveView = this._onDidRemoveView.event;
610
- this._startSnappingEnabled = true;
611
- this._endSnappingEnabled = true;
612
632
  this.resize = (index, delta, sizes = this.views.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
613
633
  if (index < 0 || index > this.views.length) {
614
634
  return 0;
@@ -1503,10 +1523,10 @@
1503
1523
  this.orientation = orientation;
1504
1524
  this.proportionalLayout = proportionalLayout;
1505
1525
  this.styles = styles;
1526
+ this._childrenDisposable = Disposable.NONE;
1506
1527
  this.children = [];
1507
1528
  this._onDidChange = new Emitter();
1508
1529
  this.onDidChange = this._onDidChange.event;
1509
- this._childrenDisposable = Disposable.NONE;
1510
1530
  this._orthogonalSize = orthogonalSize;
1511
1531
  this._size = size;
1512
1532
  this.element = document.createElement('div');
@@ -1627,7 +1647,7 @@
1627
1647
  }
1628
1648
  setupChildrenEvents() {
1629
1649
  this._childrenDisposable.dispose();
1630
- this._childrenDisposable = exports.Event.any(...this.children.map((c) => c.onDidChange))((e) => {
1650
+ this._childrenDisposable = exports.DockviewEvent.any(...this.children.map((c) => c.onDidChange))((e) => {
1631
1651
  /**
1632
1652
  * indicate a change has occured to allows any re-rendering but don't bubble
1633
1653
  * event because that was specific to this branch
@@ -1765,6 +1785,35 @@
1765
1785
  get length() {
1766
1786
  return this._root ? this._root.children.length : 0;
1767
1787
  }
1788
+ get orientation() {
1789
+ return this.root.orientation;
1790
+ }
1791
+ set orientation(orientation) {
1792
+ if (this.root.orientation === orientation) {
1793
+ return;
1794
+ }
1795
+ const { size, orthogonalSize } = this.root;
1796
+ this.root = flipNode(this.root, orthogonalSize, size);
1797
+ this.root.layout(size, orthogonalSize);
1798
+ }
1799
+ get width() {
1800
+ return this.root.width;
1801
+ }
1802
+ get height() {
1803
+ return this.root.height;
1804
+ }
1805
+ get minimumWidth() {
1806
+ return this.root.minimumWidth;
1807
+ }
1808
+ get minimumHeight() {
1809
+ return this.root.minimumHeight;
1810
+ }
1811
+ get maximumWidth() {
1812
+ return this.root.maximumHeight;
1813
+ }
1814
+ get maximumHeight() {
1815
+ return this.root.maximumHeight;
1816
+ }
1768
1817
  serialize() {
1769
1818
  const root = serializeBranchNode(this.getView(), this.orientation);
1770
1819
  return {
@@ -1811,17 +1860,6 @@
1811
1860
  }
1812
1861
  return result;
1813
1862
  }
1814
- get orientation() {
1815
- return this.root.orientation;
1816
- }
1817
- set orientation(orientation) {
1818
- if (this.root.orientation === orientation) {
1819
- return;
1820
- }
1821
- const { size, orthogonalSize } = this.root;
1822
- this.root = flipNode(this.root, orthogonalSize, size);
1823
- this.root.layout(size, orthogonalSize);
1824
- }
1825
1863
  get root() {
1826
1864
  return this._root;
1827
1865
  }
@@ -1903,24 +1941,6 @@
1903
1941
  }
1904
1942
  return findLeaf(this.root, reverse);
1905
1943
  }
1906
- get width() {
1907
- return this.root.width;
1908
- }
1909
- get height() {
1910
- return this.root.height;
1911
- }
1912
- get minimumWidth() {
1913
- return this.root.minimumWidth;
1914
- }
1915
- get minimumHeight() {
1916
- return this.root.minimumHeight;
1917
- }
1918
- get maximumWidth() {
1919
- return this.root.maximumHeight;
1920
- }
1921
- get maximumHeight() {
1922
- return this.root.maximumHeight;
1923
- }
1924
1944
  constructor(proportionalLayout, styles, orientation) {
1925
1945
  this.proportionalLayout = proportionalLayout;
1926
1946
  this.styles = styles;
@@ -2425,10 +2445,6 @@
2425
2445
  }
2426
2446
  }
2427
2447
 
2428
- function isBooleanValue(value) {
2429
- return typeof value === 'boolean';
2430
- }
2431
-
2432
2448
  function numberOrFallback(maybeNumber, fallback) {
2433
2449
  return typeof maybeNumber === 'number' ? maybeNumber : fallback;
2434
2450
  }
@@ -2493,7 +2509,7 @@
2493
2509
  this.removeDropTarget();
2494
2510
  return;
2495
2511
  }
2496
- if (isBooleanValue(this.options.canDisplayOverlay)) {
2512
+ if (typeof this.options.canDisplayOverlay === 'boolean') {
2497
2513
  if (!this.options.canDisplayOverlay) {
2498
2514
  return;
2499
2515
  }
@@ -2501,20 +2517,20 @@
2501
2517
  else if (!this.options.canDisplayOverlay(e, quadrant)) {
2502
2518
  return;
2503
2519
  }
2504
- if (!this.target) {
2505
- this.target = document.createElement('div');
2506
- this.target.className = 'drop-target-dropzone';
2507
- this.overlay = document.createElement('div');
2508
- this.overlay.className = 'drop-target-selection';
2520
+ if (!this.targetElement) {
2521
+ this.targetElement = document.createElement('div');
2522
+ this.targetElement.className = 'drop-target-dropzone';
2523
+ this.overlayElement = document.createElement('div');
2524
+ this.overlayElement.className = 'drop-target-selection';
2509
2525
  this._state = 'center';
2510
- this.target.appendChild(this.overlay);
2526
+ this.targetElement.appendChild(this.overlayElement);
2511
2527
  this.element.classList.add('drop-target');
2512
- this.element.append(this.target);
2528
+ this.element.append(this.targetElement);
2513
2529
  }
2514
2530
  if (this.options.acceptedTargetZones.length === 0) {
2515
2531
  return;
2516
2532
  }
2517
- if (!this.target || !this.overlay) {
2533
+ if (!this.targetElement || !this.overlayElement) {
2518
2534
  return;
2519
2535
  }
2520
2536
  this.toggleClasses(quadrant, width, height);
@@ -2528,10 +2544,12 @@
2528
2544
  },
2529
2545
  onDrop: (e) => {
2530
2546
  e.preventDefault();
2531
- e.stopPropagation();
2532
2547
  const state = this._state;
2533
2548
  this.removeDropTarget();
2534
2549
  if (state) {
2550
+ // only stop the propagation of the event if we are dealing with it
2551
+ // which is only when the target has state
2552
+ e.stopPropagation();
2535
2553
  this._onDrop.fire({ position: state, nativeEvent: e });
2536
2554
  }
2537
2555
  },
@@ -2542,7 +2560,7 @@
2542
2560
  }
2543
2561
  toggleClasses(quadrant, width, height) {
2544
2562
  var _a, _b, _c, _d;
2545
- if (!this.overlay) {
2563
+ if (!this.overlayElement) {
2546
2564
  return;
2547
2565
  }
2548
2566
  const isSmallX = width < 100;
@@ -2589,11 +2607,11 @@
2589
2607
  else {
2590
2608
  transform = '';
2591
2609
  }
2592
- this.overlay.style.transform = transform;
2593
- toggleClass(this.overlay, 'small-right', isSmallX && isRight);
2594
- toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
2595
- toggleClass(this.overlay, 'small-top', isSmallY && isTop);
2596
- toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
2610
+ this.overlayElement.style.transform = transform;
2611
+ toggleClass(this.overlayElement, 'small-right', isSmallX && isRight);
2612
+ toggleClass(this.overlayElement, 'small-left', isSmallX && isLeft);
2613
+ toggleClass(this.overlayElement, 'small-top', isSmallY && isTop);
2614
+ toggleClass(this.overlayElement, 'small-bottom', isSmallY && isBottom);
2597
2615
  }
2598
2616
  setState(quadrant) {
2599
2617
  switch (quadrant) {
@@ -2625,11 +2643,11 @@
2625
2643
  return calculateQuadrantAsPixels(overlayType, x, y, width, height, value);
2626
2644
  }
2627
2645
  removeDropTarget() {
2628
- if (this.target) {
2646
+ if (this.targetElement) {
2629
2647
  this._state = undefined;
2630
- this.element.removeChild(this.target);
2631
- this.target = undefined;
2632
- this.overlay = undefined;
2648
+ this.element.removeChild(this.targetElement);
2649
+ this.targetElement = undefined;
2650
+ this.overlayElement = undefined;
2633
2651
  this.element.classList.remove('drop-target');
2634
2652
  }
2635
2653
  }
@@ -2776,6 +2794,16 @@
2776
2794
  this.disposable.value = this.getData(event.dataTransfer);
2777
2795
  if (event.dataTransfer) {
2778
2796
  event.dataTransfer.effectAllowed = 'move';
2797
+ /**
2798
+ * Although this is not used by dockview many third party dnd libraries will check
2799
+ * dataTransfer.types to determine valid drag events.
2800
+ *
2801
+ * For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
2802
+ * through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
2803
+ * dnd logic. You can see the code at
2804
+ * https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
2805
+ */
2806
+ event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
2779
2807
  }
2780
2808
  }), addDisposableListener(this.el, 'dragend', () => {
2781
2809
  for (const iframe of this.iframes) {
@@ -2881,6 +2909,7 @@
2881
2909
  document.body.appendChild(ghostElement);
2882
2910
  dataTransfer.setDragImage(ghostElement, 0, 0);
2883
2911
  setTimeout(() => {
2912
+ removeClasses(ghostElement, 'dv-dragged');
2884
2913
  ghostElement.remove();
2885
2914
  }, 0);
2886
2915
  }
@@ -3016,10 +3045,6 @@
3016
3045
  return (this.selectedIndex > -1 &&
3017
3046
  this.tabs[this.selectedIndex].value === tab);
3018
3047
  }
3019
- at(index) {
3020
- var _a;
3021
- return (_a = this.tabs[index]) === null || _a === void 0 ? void 0 : _a.value;
3022
- }
3023
3048
  indexOf(id) {
3024
3049
  return this.tabs.findIndex((tab) => tab.value.panelId === id);
3025
3050
  }
@@ -3141,7 +3166,7 @@
3141
3166
  }
3142
3167
  }
3143
3168
 
3144
- class Groupview extends CompositeDisposable {
3169
+ class DockviewGroupPanelModel extends CompositeDisposable {
3145
3170
  get element() {
3146
3171
  throw new Error('not supported');
3147
3172
  }
@@ -3167,18 +3192,6 @@
3167
3192
  get isEmpty() {
3168
3193
  return this._panels.length === 0;
3169
3194
  }
3170
- get minimumHeight() {
3171
- return 100;
3172
- }
3173
- get maximumHeight() {
3174
- return Number.MAX_SAFE_INTEGER;
3175
- }
3176
- get minimumWidth() {
3177
- return 100;
3178
- }
3179
- get maximumWidth() {
3180
- return Number.MAX_SAFE_INTEGER;
3181
- }
3182
3195
  get hasWatermark() {
3183
3196
  return !!(this.watermark && this.container.contains(this.watermark.element));
3184
3197
  }
@@ -3351,8 +3364,8 @@
3351
3364
  //noop
3352
3365
  }
3353
3366
  focus() {
3354
- var _a;
3355
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
3367
+ var _a, _b;
3368
+ (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3356
3369
  }
3357
3370
  openPanel(panel, options = {}) {
3358
3371
  if (typeof options.index !== 'number' ||
@@ -3413,10 +3426,10 @@
3413
3426
  this.tabsContainer.setActionElement(element);
3414
3427
  }
3415
3428
  setActive(isGroupActive, skipFocus = false, force = false) {
3416
- var _a, _b;
3429
+ var _a, _b, _c, _d;
3417
3430
  if (!force && this.isActive === isGroupActive) {
3418
3431
  if (!skipFocus) {
3419
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
3432
+ (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3420
3433
  }
3421
3434
  return;
3422
3435
  }
@@ -3430,7 +3443,7 @@
3430
3443
  this.updateContainer();
3431
3444
  if (isGroupActive) {
3432
3445
  if (!skipFocus) {
3433
- (_b = this._activePanel) === null || _b === void 0 ? void 0 : _b.focus();
3446
+ (_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
3434
3447
  }
3435
3448
  }
3436
3449
  }
@@ -3501,15 +3514,14 @@
3501
3514
  this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
3502
3515
  }
3503
3516
  updateContainer() {
3517
+ var _a, _b;
3504
3518
  toggleClass(this.container, 'empty', this.isEmpty);
3505
3519
  this.panels.forEach((panel) => panel.updateParentGroup(this.groupPanel, this.isActive));
3506
3520
  if (this.isEmpty && !this.watermark) {
3507
3521
  const watermark = this.accessor.createWatermarkComponent();
3508
3522
  watermark.init({
3509
3523
  containerApi: new DockviewApi(this.accessor),
3510
- params: {},
3511
- title: '',
3512
- api: null,
3524
+ group: this.groupPanel,
3513
3525
  });
3514
3526
  this.watermark = watermark;
3515
3527
  addDisposableListener(this.watermark.element, 'click', () => {
@@ -3523,7 +3535,7 @@
3523
3535
  }
3524
3536
  if (!this.isEmpty && this.watermark) {
3525
3537
  this.watermark.element.remove();
3526
- this.watermark.dispose();
3538
+ (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
3527
3539
  this.watermark = undefined;
3528
3540
  this.tabsContainer.show();
3529
3541
  }
@@ -3583,9 +3595,9 @@
3583
3595
  }
3584
3596
  }
3585
3597
  dispose() {
3586
- var _a;
3598
+ var _a, _b;
3587
3599
  super.dispose();
3588
- (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.dispose();
3600
+ (_b = (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
3589
3601
  for (const panel of this.panels) {
3590
3602
  panel.dispose();
3591
3603
  }
@@ -3665,7 +3677,7 @@
3665
3677
  this.addDisposables(this.gridview.onDidChange(() => {
3666
3678
  this._bufferOnDidLayoutChange.fire();
3667
3679
  }));
3668
- this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3680
+ this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3669
3681
  this._bufferOnDidLayoutChange.fire();
3670
3682
  }), this._bufferOnDidLayoutChange.onEvent(() => {
3671
3683
  this._onDidLayoutChange.fire();
@@ -3706,19 +3718,20 @@
3706
3718
  return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
3707
3719
  }
3708
3720
  doSetGroupActive(group, skipFocus) {
3721
+ var _a, _b, _c;
3709
3722
  if (this._activeGroup === group) {
3710
3723
  return;
3711
3724
  }
3712
3725
  if (this._activeGroup) {
3713
3726
  this._activeGroup.setActive(false);
3714
3727
  if (!skipFocus) {
3715
- this._activeGroup.focus();
3728
+ (_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3716
3729
  }
3717
3730
  }
3718
3731
  if (group) {
3719
3732
  group.setActive(true);
3720
3733
  if (!skipFocus) {
3721
- group.focus();
3734
+ (_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
3722
3735
  }
3723
3736
  }
3724
3737
  this._activeGroup = group;
@@ -3779,31 +3792,6 @@
3779
3792
  }
3780
3793
  }
3781
3794
 
3782
- function isPanelOptionsWithPanel(data) {
3783
- if (data.referencePanel) {
3784
- return true;
3785
- }
3786
- return false;
3787
- }
3788
- function isPanelOptionsWithGroup(data) {
3789
- if (data.referenceGroup) {
3790
- return true;
3791
- }
3792
- return false;
3793
- }
3794
- function isGroupOptionsWithPanel(data) {
3795
- if (data.referencePanel) {
3796
- return true;
3797
- }
3798
- return false;
3799
- }
3800
- function isGroupOptionsWithGroup(data) {
3801
- if (data.referenceGroup) {
3802
- return true;
3803
- }
3804
- return false;
3805
- }
3806
-
3807
3795
  /**
3808
3796
  * A core api implementation that should be used across all panel-like objects
3809
3797
  */
@@ -3898,21 +3886,21 @@
3898
3886
  }
3899
3887
  }
3900
3888
 
3901
- class GridviewPanelApiImpl extends PanelApiImpl {
3902
- constructor(id, panel) {
3889
+ class SplitviewPanelApiImpl extends PanelApiImpl {
3890
+ //
3891
+ constructor(id) {
3903
3892
  super(id);
3904
3893
  this._onDidConstraintsChangeInternal = new Emitter();
3905
3894
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
3895
+ //
3906
3896
  this._onDidConstraintsChange = new Emitter({
3907
3897
  replay: true,
3908
3898
  });
3909
3899
  this.onDidConstraintsChange = this._onDidConstraintsChange.event;
3900
+ //
3910
3901
  this._onDidSizeChange = new Emitter();
3911
3902
  this.onDidSizeChange = this._onDidSizeChange.event;
3912
3903
  this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
3913
- if (panel) {
3914
- this.initialize(panel);
3915
- }
3916
3904
  }
3917
3905
  setConstraints(value) {
3918
3906
  this._onDidConstraintsChangeInternal.fire(value);
@@ -3922,450 +3910,401 @@
3922
3910
  }
3923
3911
  }
3924
3912
 
3925
- class DockviewPanelApiImpl extends GridviewPanelApiImpl {
3926
- get title() {
3927
- return this.panel.title;
3913
+ class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
3914
+ set pane(pane) {
3915
+ this._pane = pane;
3928
3916
  }
3929
- get isGroupActive() {
3917
+ constructor(id) {
3918
+ super(id);
3919
+ this._onDidExpansionChange = new Emitter({
3920
+ replay: true,
3921
+ });
3922
+ this.onDidExpansionChange = this._onDidExpansionChange.event;
3923
+ this._onMouseEnter = new Emitter({});
3924
+ this.onMouseEnter = this._onMouseEnter.event;
3925
+ this._onMouseLeave = new Emitter({});
3926
+ this.onMouseLeave = this._onMouseLeave.event;
3927
+ this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
3928
+ }
3929
+ setExpanded(isExpanded) {
3930
3930
  var _a;
3931
- return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
3931
+ (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
3932
3932
  }
3933
- set group(value) {
3934
- const isOldGroupActive = this.isGroupActive;
3935
- this._group = value;
3936
- this._onDidGroupChange.fire();
3937
- if (this._group) {
3938
- this.disposable.value = this._group.api.onDidActiveChange(() => {
3939
- this._onDidActiveGroupChange.fire();
3940
- });
3941
- if (this.isGroupActive !== isOldGroupActive) {
3942
- this._onDidActiveGroupChange.fire();
3943
- }
3944
- }
3945
- }
3946
- get group() {
3947
- return this._group;
3948
- }
3949
- constructor(panel, group) {
3950
- super(panel.id);
3951
- this.panel = panel;
3952
- this._onDidTitleChange = new Emitter();
3953
- this.onDidTitleChange = this._onDidTitleChange.event;
3954
- this._onDidActiveGroupChange = new Emitter();
3955
- this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3956
- this._onDidGroupChange = new Emitter();
3957
- this.onDidGroupChange = this._onDidGroupChange.event;
3958
- this.disposable = new MutableDisposable();
3959
- this.initialize(panel);
3960
- this._group = group;
3961
- this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3962
- }
3963
- setTitle(title) {
3964
- this.panel.update({ params: { title } });
3965
- }
3966
- close() {
3967
- this.group.model.closePanel(this.panel);
3933
+ get isExpanded() {
3934
+ var _a;
3935
+ return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
3968
3936
  }
3969
3937
  }
3970
3938
 
3971
- class DockviewPanel extends CompositeDisposable {
3972
- get params() {
3973
- return this._params;
3939
+ class BasePanelView extends CompositeDisposable {
3940
+ get element() {
3941
+ return this._element;
3974
3942
  }
3975
- get title() {
3976
- return this._title;
3943
+ get width() {
3944
+ return this._width;
3977
3945
  }
3978
- get group() {
3979
- return this._group;
3946
+ get height() {
3947
+ return this._height;
3980
3948
  }
3981
- get view() {
3982
- return this._view;
3949
+ get params() {
3950
+ var _a;
3951
+ return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
3983
3952
  }
3984
- constructor(id, accessor, containerApi, group) {
3953
+ constructor(id, component, api) {
3985
3954
  super();
3986
3955
  this.id = id;
3987
- this.containerApi = containerApi;
3988
- this.mutableDisposable = new MutableDisposable();
3989
- this._title = '';
3990
- this._group = group;
3991
- this.api = new DockviewPanelApiImpl(this, this._group);
3992
- this.addDisposables(this.api.onActiveChange(() => {
3993
- accessor.setActivePanel(this);
3994
- }), this.api.onDidSizeChange((event) => {
3995
- // forward the resize event to the group since if you want to resize a panel
3996
- // you are actually just resizing the panels parent which is the group
3997
- this.group.api.setSize(event);
3956
+ this.component = component;
3957
+ this.api = api;
3958
+ this._height = 0;
3959
+ this._width = 0;
3960
+ this._element = document.createElement('div');
3961
+ this._element.tabIndex = -1;
3962
+ this._element.style.outline = 'none';
3963
+ this._element.style.height = '100%';
3964
+ this._element.style.width = '100%';
3965
+ this._element.style.overflow = 'hidden';
3966
+ const { onDidFocus, onDidBlur } = trackFocus(this._element);
3967
+ this.addDisposables(this.api, onDidFocus(() => {
3968
+ this.api._onDidChangeFocus.fire({ isFocused: true });
3969
+ }), onDidBlur(() => {
3970
+ this.api._onDidChangeFocus.fire({ isFocused: false });
3998
3971
  }));
3999
3972
  }
4000
- init(params) {
4001
- var _a;
4002
- this._params = params.params;
4003
- this._view = params.view;
4004
- this.setTitle(params.title);
4005
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
4006
- }
4007
3973
  focus() {
4008
3974
  this.api._onFocusEvent.fire();
4009
3975
  }
4010
- toJSON() {
4011
- return {
4012
- id: this.id,
4013
- view: this.view.toJSON(),
4014
- params: Object.keys(this._params || {}).length > 0
4015
- ? this._params
4016
- : undefined,
4017
- title: this.title,
4018
- };
4019
- }
4020
- setTitle(title) {
4021
- var _a, _b;
4022
- const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
4023
- if (didTitleChange) {
4024
- this._title = title;
4025
- (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
4026
- params: {
4027
- params: this._params,
4028
- title: this.title,
4029
- },
4030
- });
4031
- this.api._onDidTitleChange.fire({ title });
4032
- }
4033
- }
4034
- update(event) {
4035
- var _a;
4036
- const params = event.params;
4037
- this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
4038
- if (typeof params.title === 'string') {
4039
- if (params.title !== this.title) {
4040
- this._title = params.title;
4041
- this.api._onDidTitleChange.fire({ title: this.title });
3976
+ layout(width, height) {
3977
+ this._width = width;
3978
+ this._height = height;
3979
+ this.api._onDidDimensionChange.fire({ width, height });
3980
+ if (this.part) {
3981
+ if (this._params) {
3982
+ this.part.update(this._params.params);
4042
3983
  }
4043
3984
  }
4044
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
4045
- params: {
4046
- params: this._params,
4047
- title: this.title,
4048
- },
4049
- });
4050
3985
  }
4051
- updateParentGroup(group, isGroupActive) {
4052
- var _a;
4053
- this._group = group;
4054
- this.api.group = group;
4055
- const isPanelVisible = this._group.model.isPanelActive(this);
4056
- this.api._onDidActiveChange.fire({
4057
- isActive: isGroupActive && isPanelVisible,
4058
- });
4059
- this.api._onDidVisibilityChange.fire({
4060
- isVisible: isPanelVisible,
4061
- });
4062
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.updateParentGroup(this._group, this._group.model.isPanelActive(this));
3986
+ init(parameters) {
3987
+ this._params = parameters;
3988
+ this.part = this.getComponent();
4063
3989
  }
4064
- layout(width, height) {
4065
- var _a;
4066
- // the obtain the correct dimensions of the content panel we must deduct the tab height
4067
- this.api._onDidDimensionChange.fire({
4068
- width,
4069
- height: height - (this.group.model.header.height || 0),
4070
- });
4071
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.layout(width, height);
3990
+ update(event) {
3991
+ var _a, _b;
3992
+ this._params = Object.assign(Object.assign({}, this._params), { params: Object.assign(Object.assign({}, (_a = this._params) === null || _a === void 0 ? void 0 : _a.params), event.params) });
3993
+ (_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
3994
+ }
3995
+ toJSON() {
3996
+ var _a, _b;
3997
+ const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
3998
+ return {
3999
+ id: this.id,
4000
+ component: this.component,
4001
+ params: Object.keys(params).length > 0 ? params : undefined,
4002
+ };
4072
4003
  }
4073
4004
  dispose() {
4074
4005
  var _a;
4006
+ super.dispose();
4075
4007
  this.api.dispose();
4076
- this.mutableDisposable.dispose();
4077
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
4008
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
4078
4009
  }
4079
4010
  }
4080
4011
 
4081
- class ActionContainer {
4082
- get element() {
4083
- return this._element;
4012
+ class PaneviewPanel extends BasePanelView {
4013
+ set orientation(value) {
4014
+ this._orientation = value;
4084
4015
  }
4085
- constructor() {
4086
- this._element = document.createElement('div');
4087
- this._element.className = 'actions-bar';
4088
- this._list = document.createElement('ul');
4089
- this._list.className = 'actions-container';
4090
- this._element.appendChild(this._list);
4016
+ get orientation() {
4017
+ return this._orientation;
4091
4018
  }
4092
- add(element) {
4093
- const listItem = document.createElement('li');
4094
- listItem.className = 'action-item';
4095
- this._list.appendChild(element);
4019
+ get minimumSize() {
4020
+ const headerSize = this.headerSize;
4021
+ const expanded = this.isExpanded();
4022
+ const minimumBodySize = expanded ? this._minimumBodySize : 0;
4023
+ return headerSize + minimumBodySize;
4096
4024
  }
4097
- }
4098
-
4099
- const createSvgElementFromPath = (params) => {
4100
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
4101
- svg.setAttributeNS(null, 'height', params.height);
4102
- svg.setAttributeNS(null, 'width', params.width);
4103
- svg.setAttributeNS(null, 'viewBox', params.viewbox);
4104
- svg.setAttributeNS(null, 'aria-hidden', 'false');
4105
- svg.setAttributeNS(null, 'focusable', 'false');
4106
- svg.classList.add('dockview-svg');
4107
- const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
4108
- path.setAttributeNS(null, 'd', params.path);
4109
- svg.appendChild(path);
4110
- return svg;
4111
- };
4112
- const createCloseButton = () => createSvgElementFromPath({
4113
- width: '11',
4114
- height: '11',
4115
- viewbox: '0 0 28 28',
4116
- path: 'M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z',
4117
- });
4118
- const createExpandMoreButton = () => createSvgElementFromPath({
4119
- width: '11',
4120
- height: '11',
4121
- viewbox: '0 0 24 15',
4122
- path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
4123
- });
4124
- const createChevronRightButton = () => createSvgElementFromPath({
4125
- width: '11',
4126
- height: '11',
4127
- viewbox: '0 0 15 25',
4128
- path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
4129
- });
4130
-
4131
- class Watermark extends CompositeDisposable {
4132
- get id() {
4133
- return 'watermark';
4025
+ get maximumSize() {
4026
+ const headerSize = this.headerSize;
4027
+ const expanded = this.isExpanded();
4028
+ const maximumBodySize = expanded ? this._maximumBodySize : 0;
4029
+ return headerSize + maximumBodySize;
4134
4030
  }
4135
- constructor() {
4136
- super();
4137
- this._element = document.createElement('div');
4138
- this._element.className = 'watermark';
4139
- const title = document.createElement('div');
4140
- title.className = 'watermark-title';
4141
- const emptySpace = document.createElement('span');
4142
- emptySpace.style.flexGrow = '1';
4143
- const content = document.createElement('div');
4144
- content.className = 'watermark-content';
4145
- this._element.appendChild(title);
4146
- this._element.appendChild(content);
4147
- const actions = new ActionContainer();
4148
- title.appendChild(emptySpace);
4149
- title.appendChild(actions.element);
4150
- const closeAnchor = document.createElement('div');
4151
- closeAnchor.className = 'close-action';
4152
- closeAnchor.appendChild(createCloseButton());
4153
- actions.add(closeAnchor);
4154
- this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
4155
- var _a;
4156
- ev.preventDefault();
4157
- if (this.group) {
4158
- (_a = this.params) === null || _a === void 0 ? void 0 : _a.containerApi.removeGroup(this.group);
4159
- }
4160
- }));
4031
+ get size() {
4032
+ return this._size;
4161
4033
  }
4162
- update(_event) {
4163
- // noop
4034
+ get orthogonalSize() {
4035
+ return this._orthogonalSize;
4164
4036
  }
4165
- focus() {
4166
- // noop
4037
+ set orthogonalSize(size) {
4038
+ this._orthogonalSize = size;
4167
4039
  }
4168
- toJSON() {
4169
- return {};
4040
+ get minimumBodySize() {
4041
+ return this._minimumBodySize;
4170
4042
  }
4171
- layout(_width, _height) {
4172
- // noop
4043
+ set minimumBodySize(value) {
4044
+ this._minimumBodySize = typeof value === 'number' ? value : 0;
4173
4045
  }
4174
- init(params) {
4175
- this.params = params;
4176
- this.addDisposables(this.params.containerApi.onDidLayoutChange(() => {
4177
- this.render();
4178
- }));
4179
- this.render();
4046
+ get maximumBodySize() {
4047
+ return this._maximumBodySize;
4180
4048
  }
4181
- updateParentGroup(group, _visible) {
4182
- this.group = group;
4183
- this.render();
4184
- }
4185
- get element() {
4186
- return this._element;
4187
- }
4188
- render() {
4189
- const isOneGroup = !!(this.params && this.params.containerApi.size <= 1);
4190
- toggleClass(this.element, 'has-actions', isOneGroup);
4191
- }
4192
- dispose() {
4193
- super.dispose();
4194
- }
4195
- }
4196
-
4197
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
4198
- const Component = typeof componentName === 'string'
4199
- ? components[componentName]
4200
- : undefined;
4201
- const FrameworkComponent = typeof componentName === 'string'
4202
- ? frameworkComponents[componentName]
4203
- : undefined;
4204
- if (Component && FrameworkComponent) {
4205
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
4206
- }
4207
- if (FrameworkComponent) {
4208
- if (!createFrameworkComponent) {
4209
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
4210
- }
4211
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
4212
- }
4213
- if (!Component) {
4214
- if (fallback) {
4215
- return fallback();
4216
- }
4217
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
4049
+ set maximumBodySize(value) {
4050
+ this._maximumBodySize =
4051
+ typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
4218
4052
  }
4219
- return new Component(id, componentName);
4220
- }
4221
-
4222
- const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
4223
- class DefaultTab extends CompositeDisposable {
4224
- get element() {
4225
- return this._element;
4053
+ get headerVisible() {
4054
+ return this._headerVisible;
4226
4055
  }
4227
- get id() {
4228
- return DEFAULT_TAB_IDENTIFIER;
4056
+ set headerVisible(value) {
4057
+ this._headerVisible = value;
4058
+ this.header.style.display = value ? '' : 'none';
4229
4059
  }
4230
- constructor() {
4231
- super();
4232
- this._isPanelVisible = false;
4233
- this._isGroupActive = false;
4234
- //
4235
- this.params = {};
4236
- this._element = document.createElement('div');
4237
- this._element.className = 'default-tab';
4238
- //
4239
- this._content = document.createElement('div');
4240
- this._content.className = 'tab-content';
4241
- //
4242
- this._actionContainer = document.createElement('div');
4243
- this._actionContainer.className = 'action-container';
4244
- //
4245
- this._list = document.createElement('ul');
4246
- this._list.className = 'tab-list';
4247
- //
4248
- this.action = document.createElement('div');
4249
- this.action.className = 'tab-action';
4250
- this.action.appendChild(createCloseButton());
4251
- //
4252
- this._element.appendChild(this._content);
4253
- this._element.appendChild(this._actionContainer);
4254
- this._actionContainer.appendChild(this._list);
4255
- this._list.appendChild(this.action);
4256
- //
4257
- this.addDisposables(addDisposableListener(this._actionContainer, 'mousedown', (ev) => {
4258
- ev.preventDefault();
4060
+ constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
4061
+ super(id, component, new PaneviewPanelApiImpl(id));
4062
+ this.headerComponent = headerComponent;
4063
+ this._onDidChangeExpansionState = new Emitter({ replay: true });
4064
+ this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
4065
+ this._onDidChange = new Emitter();
4066
+ this.onDidChange = this._onDidChange.event;
4067
+ this.headerSize = 22;
4068
+ this._orthogonalSize = 0;
4069
+ this._size = 0;
4070
+ this._minimumBodySize = 100;
4071
+ this._maximumBodySize = Number.POSITIVE_INFINITY;
4072
+ this._isExpanded = false;
4073
+ this.expandedSize = 0;
4074
+ this.api.pane = this; // TODO cannot use 'this' before 'super'
4075
+ this.api.initialize(this);
4076
+ this._isExpanded = isExpanded;
4077
+ this._headerVisible = isHeaderVisible;
4078
+ this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
4079
+ this._orientation = orientation;
4080
+ this.element.classList.add('pane');
4081
+ this.addDisposables(this.api.onDidSizeChange((event) => {
4082
+ this._onDidChange.fire({ size: event.size });
4083
+ }), addDisposableListener(this.element, 'mouseenter', (ev) => {
4084
+ this.api._onMouseEnter.fire(ev);
4085
+ }), addDisposableListener(this.element, 'mouseleave', (ev) => {
4086
+ this.api._onMouseLeave.fire(ev);
4259
4087
  }));
4260
- this.render();
4261
- }
4262
- update(event) {
4263
- this.params = Object.assign(Object.assign({}, this.params), event.params);
4264
- this.render();
4088
+ this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
4089
+ this.api._onDidExpansionChange.fire({
4090
+ isExpanded: isPanelExpanded,
4091
+ });
4092
+ }), this.api.onDidFocusChange((e) => {
4093
+ if (!this.header) {
4094
+ return;
4095
+ }
4096
+ if (e.isFocused) {
4097
+ addClasses(this.header, 'focused');
4098
+ }
4099
+ else {
4100
+ removeClasses(this.header, 'focused');
4101
+ }
4102
+ }));
4103
+ this.renderOnce();
4265
4104
  }
4266
- toJSON() {
4267
- return { id: this.id };
4105
+ setVisible(isVisible) {
4106
+ this.api._onDidVisibilityChange.fire({ isVisible });
4268
4107
  }
4269
- focus() {
4270
- //noop
4108
+ setActive(isActive) {
4109
+ this.api._onDidActiveChange.fire({ isActive });
4271
4110
  }
4272
- init(params) {
4273
- this.params = params;
4274
- this._content.textContent = params.title;
4275
- addDisposableListener(this.action, 'click', (ev) => {
4276
- ev.preventDefault(); //
4277
- this.params.api.close();
4278
- });
4111
+ isExpanded() {
4112
+ return this._isExpanded;
4279
4113
  }
4280
- updateParentGroup(group, isPanelVisible) {
4281
- const changed = this._isPanelVisible !== isPanelVisible ||
4282
- this._isGroupActive !== group.isActive;
4283
- this._isPanelVisible = isPanelVisible;
4284
- this._isGroupActive = group.isActive;
4285
- if (changed) {
4286
- this.render();
4114
+ setExpanded(expanded) {
4115
+ if (this._isExpanded === expanded) {
4116
+ return;
4117
+ }
4118
+ this._isExpanded = expanded;
4119
+ if (expanded) {
4120
+ if (this.animationTimer) {
4121
+ clearTimeout(this.animationTimer);
4122
+ }
4123
+ if (this.body) {
4124
+ this.element.appendChild(this.body);
4125
+ }
4287
4126
  }
4127
+ else {
4128
+ this.animationTimer = setTimeout(() => {
4129
+ var _a;
4130
+ (_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
4131
+ }, 200);
4132
+ }
4133
+ this._onDidChange.fire(expanded ? { size: this.width } : {});
4134
+ this._onDidChangeExpansionState.fire(expanded);
4288
4135
  }
4289
- layout(_width, _height) {
4290
- // noop
4136
+ layout(size, orthogonalSize) {
4137
+ this._size = size;
4138
+ this._orthogonalSize = orthogonalSize;
4139
+ const [width, height] = this.orientation === exports.Orientation.HORIZONTAL
4140
+ ? [size, orthogonalSize]
4141
+ : [orthogonalSize, size];
4142
+ if (this.isExpanded()) {
4143
+ this.expandedSize = width;
4144
+ }
4145
+ super.layout(width, height);
4291
4146
  }
4292
- render() {
4293
- if (this._content.textContent !== this.params.title) {
4294
- this._content.textContent = this.params.title;
4147
+ init(parameters) {
4148
+ var _a, _b;
4149
+ super.init(parameters);
4150
+ if (typeof parameters.minimumBodySize === 'number') {
4151
+ this.minimumBodySize = parameters.minimumBodySize;
4152
+ }
4153
+ if (typeof parameters.maximumBodySize === 'number') {
4154
+ this.maximumBodySize = parameters.maximumBodySize;
4155
+ }
4156
+ this.bodyPart = this.getBodyComponent();
4157
+ this.headerPart = this.getHeaderComponent();
4158
+ this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
4159
+ this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
4160
+ (_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);
4161
+ (_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
4162
+ if (typeof parameters.isExpanded === 'boolean') {
4163
+ this.setExpanded(parameters.isExpanded);
4295
4164
  }
4296
4165
  }
4297
- }
4298
-
4299
- class BasePanelView extends CompositeDisposable {
4300
- get element() {
4301
- return this._element;
4166
+ toJSON() {
4167
+ const params = this._params;
4168
+ return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
4302
4169
  }
4303
- get width() {
4304
- return this._width;
4170
+ renderOnce() {
4171
+ this.header = document.createElement('div');
4172
+ this.header.tabIndex = 0;
4173
+ this.header.className = 'pane-header';
4174
+ this.header.style.height = `${this.headerSize}px`;
4175
+ this.header.style.lineHeight = `${this.headerSize}px`;
4176
+ this.header.style.minHeight = `${this.headerSize}px`;
4177
+ this.header.style.maxHeight = `${this.headerSize}px`;
4178
+ this.element.appendChild(this.header);
4179
+ this.body = document.createElement('div');
4180
+ this.body.className = 'pane-body';
4181
+ this.element.appendChild(this.body);
4305
4182
  }
4306
- get height() {
4307
- return this._height;
4183
+ // TODO slightly hacky by-pass of the component to create a body and header component
4184
+ getComponent() {
4185
+ return {
4186
+ update: (params) => {
4187
+ var _a, _b;
4188
+ (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
4189
+ (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
4190
+ },
4191
+ dispose: () => {
4192
+ var _a, _b;
4193
+ (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
4194
+ (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
4195
+ },
4196
+ };
4308
4197
  }
4309
- get params() {
4310
- var _a;
4311
- return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
4198
+ }
4199
+
4200
+ class DraggablePaneviewPanel extends PaneviewPanel {
4201
+ constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
4202
+ super(id, component, headerComponent, orientation, isExpanded, true);
4203
+ this.accessor = accessor;
4204
+ this._onDidDrop = new Emitter();
4205
+ this.onDidDrop = this._onDidDrop.event;
4206
+ if (!disableDnd) {
4207
+ this.initDragFeatures();
4208
+ }
4312
4209
  }
4313
- constructor(id, component, api) {
4314
- super();
4315
- this.id = id;
4316
- this.component = component;
4317
- this.api = api;
4318
- this._height = 0;
4319
- this._width = 0;
4320
- this._element = document.createElement('div');
4321
- this._element.tabIndex = -1;
4322
- this._element.style.outline = 'none';
4323
- this._element.style.height = '100%';
4324
- this._element.style.width = '100%';
4325
- this._element.style.overflow = 'hidden';
4326
- const { onDidFocus, onDidBlur } = trackFocus(this._element);
4327
- this.addDisposables(this.api, onDidFocus(() => {
4328
- this.api._onDidChangeFocus.fire({ isFocused: true });
4329
- }), onDidBlur(() => {
4330
- this.api._onDidChangeFocus.fire({ isFocused: false });
4210
+ initDragFeatures() {
4211
+ if (!this.header) {
4212
+ return;
4213
+ }
4214
+ const id = this.id;
4215
+ const accessorId = this.accessor.id;
4216
+ this.header.draggable = true;
4217
+ this.handler = new (class PaneDragHandler extends DragHandler {
4218
+ getData() {
4219
+ LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
4220
+ return {
4221
+ dispose: () => {
4222
+ LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
4223
+ },
4224
+ };
4225
+ }
4226
+ })(this.header);
4227
+ this.target = new Droptarget(this.element, {
4228
+ acceptedTargetZones: ['top', 'bottom'],
4229
+ overlayModel: {
4230
+ activationSize: { type: 'percentage', value: 50 },
4231
+ },
4232
+ canDisplayOverlay: (event) => {
4233
+ const data = getPaneData();
4234
+ if (data) {
4235
+ if (data.paneId !== this.id &&
4236
+ data.viewId === this.accessor.id) {
4237
+ return true;
4238
+ }
4239
+ }
4240
+ if (this.accessor.options.showDndOverlay) {
4241
+ return this.accessor.options.showDndOverlay({
4242
+ nativeEvent: event,
4243
+ getData: getPaneData,
4244
+ panel: this,
4245
+ });
4246
+ }
4247
+ return false;
4248
+ },
4249
+ });
4250
+ this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
4251
+ this.onDrop(event);
4331
4252
  }));
4332
4253
  }
4333
- focus() {
4334
- this.api._onFocusEvent.fire();
4335
- }
4336
- layout(width, height) {
4337
- this._width = width;
4338
- this._height = height;
4339
- this.api._onDidDimensionChange.fire({ width, height });
4340
- if (this.part) {
4341
- if (this._params) {
4342
- this.part.update(this._params.params);
4254
+ onDrop(event) {
4255
+ const data = getPaneData();
4256
+ if (!data || data.viewId !== this.accessor.id) {
4257
+ // if there is no local drag event for this panel
4258
+ // or if the drag event was creating by another Paneview instance
4259
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));
4260
+ return;
4261
+ }
4262
+ const containerApi = this._params
4263
+ .containerApi;
4264
+ const panelId = data.paneId;
4265
+ const existingPanel = containerApi.getPanel(panelId);
4266
+ if (!existingPanel) {
4267
+ // if the panel doesn't exist
4268
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData, api: new PaneviewApi(this.accessor) }));
4269
+ return;
4270
+ }
4271
+ const allPanels = containerApi.panels;
4272
+ const fromIndex = allPanels.indexOf(existingPanel);
4273
+ let toIndex = containerApi.panels.indexOf(this);
4274
+ if (event.position === 'left' || event.position === 'top') {
4275
+ toIndex = Math.max(0, toIndex - 1);
4276
+ }
4277
+ if (event.position === 'right' || event.position === 'bottom') {
4278
+ if (fromIndex > toIndex) {
4279
+ toIndex++;
4343
4280
  }
4281
+ toIndex = Math.min(allPanels.length - 1, toIndex);
4344
4282
  }
4283
+ containerApi.movePanel(fromIndex, toIndex);
4345
4284
  }
4346
- init(parameters) {
4347
- this._params = parameters;
4348
- this.part = this.getComponent();
4349
- }
4350
- update(event) {
4351
- var _a, _b;
4352
- this._params = Object.assign(Object.assign({}, this._params), { params: Object.assign(Object.assign({}, (_a = this._params) === null || _a === void 0 ? void 0 : _a.params), event.params) });
4353
- (_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
4285
+ }
4286
+
4287
+ class GridviewPanelApiImpl extends PanelApiImpl {
4288
+ constructor(id, panel) {
4289
+ super(id);
4290
+ this._onDidConstraintsChangeInternal = new Emitter();
4291
+ this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
4292
+ this._onDidConstraintsChange = new Emitter({
4293
+ replay: true,
4294
+ });
4295
+ this.onDidConstraintsChange = this._onDidConstraintsChange.event;
4296
+ this._onDidSizeChange = new Emitter();
4297
+ this.onDidSizeChange = this._onDidSizeChange.event;
4298
+ this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
4299
+ if (panel) {
4300
+ this.initialize(panel);
4301
+ }
4354
4302
  }
4355
- toJSON() {
4356
- var _a, _b;
4357
- const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
4358
- return {
4359
- id: this.id,
4360
- component: this.component,
4361
- params: Object.keys(params).length > 0 ? params : undefined,
4362
- };
4303
+ setConstraints(value) {
4304
+ this._onDidConstraintsChangeInternal.fire(value);
4363
4305
  }
4364
- dispose() {
4365
- var _a;
4366
- super.dispose();
4367
- this.api.dispose();
4368
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
4306
+ setSize(event) {
4307
+ this._onDidSizeChange.fire(event);
4369
4308
  }
4370
4309
  }
4371
4310
 
@@ -4419,8 +4358,8 @@
4419
4358
  get isActive() {
4420
4359
  return this.api.isActive;
4421
4360
  }
4422
- constructor(id, component, api) {
4423
- super(id, component, api);
4361
+ constructor(id, component, options) {
4362
+ super(id, component, new GridviewPanelApiImpl(id));
4424
4363
  this._evaluatedMinimumWidth = 0;
4425
4364
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
4426
4365
  this._evaluatedMinimumHeight = 0;
@@ -4432,6 +4371,18 @@
4432
4371
  this._snap = false;
4433
4372
  this._onDidChange = new Emitter();
4434
4373
  this.onDidChange = this._onDidChange.event;
4374
+ if (typeof (options === null || options === void 0 ? void 0 : options.minimumWidth) === 'number') {
4375
+ this._minimumWidth = options.minimumWidth;
4376
+ }
4377
+ if (typeof (options === null || options === void 0 ? void 0 : options.maximumWidth) === 'number') {
4378
+ this._maximumWidth = options.maximumWidth;
4379
+ }
4380
+ if (typeof (options === null || options === void 0 ? void 0 : options.minimumHeight) === 'number') {
4381
+ this._minimumHeight = options.minimumHeight;
4382
+ }
4383
+ if (typeof (options === null || options === void 0 ? void 0 : options.maximumHeight) === 'number') {
4384
+ this._maximumHeight = options.maximumHeight;
4385
+ }
4435
4386
  this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
4436
4387
  this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
4437
4388
  const { isVisible } = event;
@@ -4470,142 +4421,518 @@
4470
4421
  setActive(isActive) {
4471
4422
  this.api._onDidActiveChange.fire({ isActive });
4472
4423
  }
4473
- init(parameters) {
4474
- if (parameters.maximumHeight) {
4475
- this._maximumHeight = parameters.maximumHeight;
4476
- }
4477
- if (parameters.minimumHeight) {
4478
- this._minimumHeight = parameters.minimumHeight;
4479
- }
4480
- if (parameters.maximumWidth) {
4481
- this._maximumWidth = parameters.maximumWidth;
4482
- }
4483
- if (parameters.minimumWidth) {
4484
- this._minimumWidth = parameters.minimumWidth;
4424
+ init(parameters) {
4425
+ if (parameters.maximumHeight) {
4426
+ this._maximumHeight = parameters.maximumHeight;
4427
+ }
4428
+ if (parameters.minimumHeight) {
4429
+ this._minimumHeight = parameters.minimumHeight;
4430
+ }
4431
+ if (parameters.maximumWidth) {
4432
+ this._maximumWidth = parameters.maximumWidth;
4433
+ }
4434
+ if (parameters.minimumWidth) {
4435
+ this._minimumWidth = parameters.minimumWidth;
4436
+ }
4437
+ this._priority = parameters.priority;
4438
+ this._snap = !!parameters.snap;
4439
+ super.init(parameters);
4440
+ if (typeof parameters.isVisible === 'boolean') {
4441
+ this.setVisible(parameters.isVisible);
4442
+ }
4443
+ }
4444
+ updateConstraints() {
4445
+ this.api._onDidConstraintsChange.fire({
4446
+ minimumWidth: this._evaluatedMinimumWidth,
4447
+ maximumWidth: this._evaluatedMaximumWidth,
4448
+ minimumHeight: this._evaluatedMinimumHeight,
4449
+ maximumHeight: this._evaluatedMaximumHeight,
4450
+ });
4451
+ }
4452
+ toJSON() {
4453
+ const state = super.toJSON();
4454
+ const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? undefined : value;
4455
+ const minimum = (value) => (value <= 0 ? undefined : value);
4456
+ return Object.assign(Object.assign({}, state), { minimumHeight: minimum(this.minimumHeight), maximumHeight: maximum(this.maximumHeight), minimumWidth: minimum(this.minimumWidth), maximumWidth: maximum(this.maximumWidth), snap: this.snap, priority: this.priority });
4457
+ }
4458
+ }
4459
+
4460
+ class DockviewGroupPanel extends GridviewPanel {
4461
+ get panels() {
4462
+ return this._model.panels;
4463
+ }
4464
+ get activePanel() {
4465
+ return this._model.activePanel;
4466
+ }
4467
+ get size() {
4468
+ return this._model.size;
4469
+ }
4470
+ get model() {
4471
+ return this._model;
4472
+ }
4473
+ get locked() {
4474
+ return this._model.locked;
4475
+ }
4476
+ set locked(value) {
4477
+ this._model.locked = value;
4478
+ }
4479
+ get header() {
4480
+ return this._model.header;
4481
+ }
4482
+ constructor(accessor, id, options) {
4483
+ super(id, 'groupview_default', {
4484
+ minimumHeight: 100,
4485
+ minimumWidth: 100,
4486
+ });
4487
+ this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
4488
+ }
4489
+ initialize() {
4490
+ this._model.initialize();
4491
+ }
4492
+ setActive(isActive) {
4493
+ super.setActive(isActive);
4494
+ this.model.setActive(isActive);
4495
+ }
4496
+ layout(width, height) {
4497
+ super.layout(width, height);
4498
+ this.model.layout(width, height);
4499
+ }
4500
+ getComponent() {
4501
+ return this._model;
4502
+ }
4503
+ toJSON() {
4504
+ // TODO fix typing
4505
+ return this.model.toJSON();
4506
+ }
4507
+ }
4508
+
4509
+ function isPanelOptionsWithPanel(data) {
4510
+ if (data.referencePanel) {
4511
+ return true;
4512
+ }
4513
+ return false;
4514
+ }
4515
+ function isPanelOptionsWithGroup(data) {
4516
+ if (data.referenceGroup) {
4517
+ return true;
4518
+ }
4519
+ return false;
4520
+ }
4521
+ function isGroupOptionsWithPanel(data) {
4522
+ if (data.referencePanel) {
4523
+ return true;
4524
+ }
4525
+ return false;
4526
+ }
4527
+ function isGroupOptionsWithGroup(data) {
4528
+ if (data.referenceGroup) {
4529
+ return true;
4530
+ }
4531
+ return false;
4532
+ }
4533
+
4534
+ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
4535
+ get title() {
4536
+ return this.panel.title;
4537
+ }
4538
+ get isGroupActive() {
4539
+ var _a;
4540
+ return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
4541
+ }
4542
+ set group(value) {
4543
+ const isOldGroupActive = this.isGroupActive;
4544
+ this._group = value;
4545
+ this._onDidGroupChange.fire();
4546
+ if (this._group) {
4547
+ this.disposable.value = this._group.api.onDidActiveChange(() => {
4548
+ this._onDidActiveGroupChange.fire();
4549
+ });
4550
+ if (this.isGroupActive !== isOldGroupActive) {
4551
+ this._onDidActiveGroupChange.fire();
4552
+ }
4553
+ }
4554
+ }
4555
+ get group() {
4556
+ return this._group;
4557
+ }
4558
+ constructor(panel, group) {
4559
+ super(panel.id);
4560
+ this.panel = panel;
4561
+ this._onDidTitleChange = new Emitter();
4562
+ this.onDidTitleChange = this._onDidTitleChange.event;
4563
+ this._onDidActiveGroupChange = new Emitter();
4564
+ this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
4565
+ this._onDidGroupChange = new Emitter();
4566
+ this.onDidGroupChange = this._onDidGroupChange.event;
4567
+ this.disposable = new MutableDisposable();
4568
+ this.initialize(panel);
4569
+ this._group = group;
4570
+ this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
4571
+ }
4572
+ setTitle(title) {
4573
+ this.panel.update({ params: { title } });
4574
+ }
4575
+ close() {
4576
+ this.group.model.closePanel(this.panel);
4577
+ }
4578
+ }
4579
+
4580
+ class DockviewPanel extends CompositeDisposable {
4581
+ get params() {
4582
+ return this._params;
4583
+ }
4584
+ get title() {
4585
+ return this._title;
4586
+ }
4587
+ get group() {
4588
+ return this._group;
4589
+ }
4590
+ constructor(id, accessor, containerApi, group, view) {
4591
+ super();
4592
+ this.id = id;
4593
+ this.containerApi = containerApi;
4594
+ this.view = view;
4595
+ this._title = '';
4596
+ this._group = group;
4597
+ this.api = new DockviewPanelApiImpl(this, this._group);
4598
+ this.addDisposables(this.api.onActiveChange(() => {
4599
+ accessor.setActivePanel(this);
4600
+ }), this.api.onDidSizeChange((event) => {
4601
+ // forward the resize event to the group since if you want to resize a panel
4602
+ // you are actually just resizing the panels parent which is the group
4603
+ this.group.api.setSize(event);
4604
+ }));
4605
+ }
4606
+ init(params) {
4607
+ var _a;
4608
+ this._params = params.params;
4609
+ this.setTitle(params.title);
4610
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
4611
+ }
4612
+ focus() {
4613
+ this.api._onFocusEvent.fire();
4614
+ }
4615
+ toJSON() {
4616
+ return {
4617
+ id: this.id,
4618
+ contentComponent: this.view.contentComponent,
4619
+ tabComponent: this.view.tabComponent,
4620
+ params: Object.keys(this._params || {}).length > 0
4621
+ ? this._params
4622
+ : undefined,
4623
+ title: this.title,
4624
+ };
4625
+ }
4626
+ setTitle(title) {
4627
+ var _a, _b;
4628
+ const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
4629
+ if (didTitleChange) {
4630
+ this._title = title;
4631
+ (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
4632
+ params: {
4633
+ params: this._params,
4634
+ title: this.title,
4635
+ },
4636
+ });
4637
+ this.api._onDidTitleChange.fire({ title });
4485
4638
  }
4486
- this._priority = parameters.priority;
4487
- this._snap = !!parameters.snap;
4488
- super.init(parameters);
4489
- if (typeof parameters.isVisible === 'boolean') {
4490
- this.setVisible(parameters.isVisible);
4639
+ }
4640
+ update(event) {
4641
+ var _a;
4642
+ const params = event.params;
4643
+ this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
4644
+ if (params.title !== this.title) {
4645
+ this._title = params.title;
4646
+ this.api._onDidTitleChange.fire({ title: this.title });
4491
4647
  }
4648
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
4649
+ params: {
4650
+ params: this._params,
4651
+ title: this.title,
4652
+ },
4653
+ });
4492
4654
  }
4493
- updateConstraints() {
4494
- this.api._onDidConstraintsChange.fire({
4495
- minimumWidth: this._evaluatedMinimumWidth,
4496
- maximumWidth: this._evaluatedMaximumWidth,
4497
- minimumHeight: this._evaluatedMinimumHeight,
4498
- maximumHeight: this._evaluatedMaximumHeight,
4655
+ updateParentGroup(group, isGroupActive) {
4656
+ this._group = group;
4657
+ this.api.group = group;
4658
+ const isPanelVisible = this._group.model.isPanelActive(this);
4659
+ this.api._onDidActiveChange.fire({
4660
+ isActive: isGroupActive && isPanelVisible,
4661
+ });
4662
+ this.api._onDidVisibilityChange.fire({
4663
+ isVisible: isPanelVisible,
4499
4664
  });
4665
+ this.view.updateParentGroup(this._group, this._group.model.isPanelActive(this));
4500
4666
  }
4501
- toJSON() {
4502
- const state = super.toJSON();
4503
- const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? undefined : value;
4504
- const minimum = (value) => (value <= 0 ? undefined : value);
4505
- return Object.assign(Object.assign({}, state), { minimumHeight: minimum(this.minimumHeight), maximumHeight: maximum(this.maximumHeight), minimumWidth: minimum(this.minimumWidth), maximumWidth: maximum(this.maximumWidth), snap: this.snap, priority: this.priority });
4667
+ layout(width, height) {
4668
+ var _a;
4669
+ // the obtain the correct dimensions of the content panel we must deduct the tab height
4670
+ this.api._onDidDimensionChange.fire({
4671
+ width,
4672
+ height: height - (this.group.model.header.height || 0),
4673
+ });
4674
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.layout(width, height);
4675
+ }
4676
+ dispose() {
4677
+ var _a;
4678
+ this.api.dispose();
4679
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
4506
4680
  }
4507
4681
  }
4508
4682
 
4509
- class GroupviewApi extends GridviewPanelApiImpl {
4510
- }
4511
- class GroupPanel extends GridviewPanel {
4512
- get panels() {
4513
- return this._model.panels;
4683
+ const createSvgElementFromPath = (params) => {
4684
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
4685
+ svg.setAttributeNS(null, 'height', params.height);
4686
+ svg.setAttributeNS(null, 'width', params.width);
4687
+ svg.setAttributeNS(null, 'viewBox', params.viewbox);
4688
+ svg.setAttributeNS(null, 'aria-hidden', 'false');
4689
+ svg.setAttributeNS(null, 'focusable', 'false');
4690
+ svg.classList.add('dockview-svg');
4691
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
4692
+ path.setAttributeNS(null, 'd', params.path);
4693
+ svg.appendChild(path);
4694
+ return svg;
4695
+ };
4696
+ const createCloseButton = () => createSvgElementFromPath({
4697
+ width: '11',
4698
+ height: '11',
4699
+ viewbox: '0 0 28 28',
4700
+ path: 'M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z',
4701
+ });
4702
+ const createExpandMoreButton = () => createSvgElementFromPath({
4703
+ width: '11',
4704
+ height: '11',
4705
+ viewbox: '0 0 24 15',
4706
+ path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
4707
+ });
4708
+ const createChevronRightButton = () => createSvgElementFromPath({
4709
+ width: '11',
4710
+ height: '11',
4711
+ viewbox: '0 0 15 25',
4712
+ path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
4713
+ });
4714
+
4715
+ class DefaultTab extends CompositeDisposable {
4716
+ get element() {
4717
+ return this._element;
4514
4718
  }
4515
- get activePanel() {
4516
- return this._model.activePanel;
4719
+ constructor() {
4720
+ super();
4721
+ //
4722
+ this.params = {};
4723
+ this._element = document.createElement('div');
4724
+ this._element.className = 'default-tab';
4725
+ //
4726
+ this._content = document.createElement('div');
4727
+ this._content.className = 'tab-content';
4728
+ //
4729
+ this._actionContainer = document.createElement('div');
4730
+ this._actionContainer.className = 'action-container';
4731
+ //
4732
+ this._list = document.createElement('ul');
4733
+ this._list.className = 'tab-list';
4734
+ //
4735
+ this.action = document.createElement('div');
4736
+ this.action.className = 'tab-action';
4737
+ this.action.appendChild(createCloseButton());
4738
+ //
4739
+ this._element.appendChild(this._content);
4740
+ this._element.appendChild(this._actionContainer);
4741
+ this._actionContainer.appendChild(this._list);
4742
+ this._list.appendChild(this.action);
4743
+ //
4744
+ this.addDisposables(addDisposableListener(this._actionContainer, 'mousedown', (ev) => {
4745
+ ev.preventDefault();
4746
+ }));
4747
+ this.render();
4517
4748
  }
4518
- get size() {
4519
- return this._model.size;
4749
+ update(event) {
4750
+ this.params = Object.assign(Object.assign({}, this.params), event.params);
4751
+ this.render();
4520
4752
  }
4521
- get model() {
4522
- return this._model;
4753
+ focus() {
4754
+ //noop
4523
4755
  }
4524
- get minimumHeight() {
4525
- return this._model.minimumHeight;
4756
+ init(params) {
4757
+ this.params = params;
4758
+ this._content.textContent = params.title;
4759
+ addDisposableListener(this.action, 'click', (ev) => {
4760
+ ev.preventDefault(); //
4761
+ this.params.api.close();
4762
+ });
4526
4763
  }
4527
- get maximumHeight() {
4528
- return this._model.maximumHeight;
4764
+ onGroupChange(_group) {
4765
+ this.render();
4529
4766
  }
4530
- get minimumWidth() {
4531
- return this._model.minimumWidth;
4767
+ onPanelVisibleChange(_isPanelVisible) {
4768
+ this.render();
4532
4769
  }
4533
- get maximumWidth() {
4534
- return this._model.maximumWidth;
4770
+ layout(_width, _height) {
4771
+ // noop
4535
4772
  }
4536
- get locked() {
4537
- return this._model.locked;
4773
+ render() {
4774
+ if (this._content.textContent !== this.params.title) {
4775
+ this._content.textContent = this.params.title;
4776
+ }
4538
4777
  }
4539
- set locked(value) {
4540
- this._model.locked = value;
4778
+ }
4779
+
4780
+ class DockviewPanelModel {
4781
+ get content() {
4782
+ return this._content;
4541
4783
  }
4542
- get header() {
4543
- return this._model.header;
4784
+ get tab() {
4785
+ return this._tab;
4544
4786
  }
4545
- constructor(accessor, id, options) {
4546
- super(id, 'groupview_default', new GroupviewApi(id));
4547
- this._model = new Groupview(this.element, accessor, id, options, this);
4787
+ constructor(accessor, id, contentComponent, tabComponent) {
4788
+ var _a;
4789
+ this.accessor = accessor;
4790
+ this.id = id;
4791
+ this.contentComponent = contentComponent;
4792
+ this.tabComponent = tabComponent;
4793
+ this._group = null;
4794
+ this._isPanelVisible = null;
4795
+ this._content = this.createContentComponent(this.id, contentComponent);
4796
+ this._tab =
4797
+ (_a = this.createTabComponent(this.id, tabComponent)) !== null && _a !== void 0 ? _a : new DefaultTab();
4548
4798
  }
4549
- initialize() {
4550
- this._model.initialize();
4799
+ init(params) {
4800
+ this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4801
+ this.tab.init(params);
4551
4802
  }
4552
- setActive(isActive) {
4553
- super.setActive(isActive);
4554
- this.model.setActive(isActive);
4803
+ updateParentGroup(group, isPanelVisible) {
4804
+ if (group !== this._group) {
4805
+ this._group = group;
4806
+ if (this._content.onGroupChange) {
4807
+ this._content.onGroupChange(group);
4808
+ }
4809
+ if (this._tab.onGroupChange) {
4810
+ this._tab.onGroupChange(group);
4811
+ }
4812
+ }
4813
+ if (isPanelVisible !== this._isPanelVisible) {
4814
+ this._isPanelVisible = isPanelVisible;
4815
+ if (this._content.onPanelVisibleChange) {
4816
+ this._content.onPanelVisibleChange(isPanelVisible);
4817
+ }
4818
+ if (this._tab.onPanelVisibleChange) {
4819
+ this._tab.onPanelVisibleChange(isPanelVisible);
4820
+ }
4821
+ }
4555
4822
  }
4556
4823
  layout(width, height) {
4557
- super.layout(width, height);
4558
- this.model.layout(width, height);
4824
+ var _a, _b;
4825
+ (_b = (_a = this.content).layout) === null || _b === void 0 ? void 0 : _b.call(_a, width, height);
4559
4826
  }
4560
- getComponent() {
4561
- return this._model;
4827
+ update(event) {
4828
+ var _a, _b, _c, _d;
4829
+ (_b = (_a = this.content).update) === null || _b === void 0 ? void 0 : _b.call(_a, event);
4830
+ (_d = (_c = this.tab).update) === null || _d === void 0 ? void 0 : _d.call(_c, event);
4562
4831
  }
4563
- toJSON() {
4564
- return this.model.toJSON();
4832
+ dispose() {
4833
+ var _a, _b, _c, _d;
4834
+ (_b = (_a = this.content).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
4835
+ (_d = (_c = this.tab).dispose) === null || _d === void 0 ? void 0 : _d.call(_c);
4836
+ }
4837
+ createContentComponent(id, componentName) {
4838
+ var _a;
4839
+ return createComponent(id, componentName, this.accessor.options.components || {}, this.accessor.options.frameworkComponents, (_a = this.accessor.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.content);
4840
+ }
4841
+ createTabComponent(id, componentName) {
4842
+ var _a;
4843
+ return createComponent(id, componentName, this.accessor.options.tabComponents || {}, this.accessor.options.frameworkTabComponents, (_a = this.accessor.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.tab, () => new DefaultTab());
4565
4844
  }
4566
4845
  }
4567
4846
 
4568
- class DefaultGroupPanelView {
4569
- get content() {
4570
- return this._content;
4847
+ class DefaultDockviewDeserialzier {
4848
+ constructor(layout) {
4849
+ this.layout = layout;
4571
4850
  }
4572
- get tab() {
4573
- return this._tab;
4851
+ fromJSON(panelData, group) {
4852
+ var _a, _b, _c;
4853
+ const panelId = panelData.id;
4854
+ const params = panelData.params;
4855
+ const title = panelData.title;
4856
+ const viewData = panelData.view;
4857
+ const contentComponent = viewData
4858
+ ? viewData.content.id
4859
+ : panelData.contentComponent || 'unknown';
4860
+ const tabComponent = viewData
4861
+ ? (_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id
4862
+ : panelData.tabComponent;
4863
+ if (tabComponent) {
4864
+ createComponent(panelId, tabComponent, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_b = this.layout.options.frameworkComponentFactory) === null || _b === void 0 ? void 0 : _b.tab, () => new DefaultTab());
4865
+ }
4866
+ else if (this.layout.options.defaultTabComponent) {
4867
+ createComponent(panelId, this.layout.options.defaultTabComponent, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_c = this.layout.options.frameworkComponentFactory) === null || _c === void 0 ? void 0 : _c.tab, () => new DefaultTab());
4868
+ }
4869
+ else {
4870
+ new DefaultTab();
4871
+ }
4872
+ const view = new DockviewPanelModel(this.layout, panelId, contentComponent, tabComponent);
4873
+ const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group, view);
4874
+ panel.init({
4875
+ title: title || panelId,
4876
+ params: params || {},
4877
+ });
4878
+ return panel;
4574
4879
  }
4575
- constructor(renderers) {
4576
- var _a;
4577
- this._content = renderers.content;
4578
- this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4880
+ }
4881
+
4882
+ class Watermark extends CompositeDisposable {
4883
+ get element() {
4884
+ return this._element;
4885
+ }
4886
+ constructor() {
4887
+ super();
4888
+ this._element = document.createElement('div');
4889
+ this._element.className = 'watermark';
4890
+ const title = document.createElement('div');
4891
+ title.className = 'watermark-title';
4892
+ const emptySpace = document.createElement('span');
4893
+ emptySpace.style.flexGrow = '1';
4894
+ const content = document.createElement('div');
4895
+ content.className = 'watermark-content';
4896
+ this._element.appendChild(title);
4897
+ this._element.appendChild(content);
4898
+ const actionsContainer = document.createElement('div');
4899
+ actionsContainer.className = 'actions-container';
4900
+ const closeAnchor = document.createElement('div');
4901
+ closeAnchor.className = 'close-action';
4902
+ closeAnchor.appendChild(createCloseButton());
4903
+ actionsContainer.appendChild(closeAnchor);
4904
+ title.appendChild(emptySpace);
4905
+ title.appendChild(actionsContainer);
4906
+ this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
4907
+ var _a;
4908
+ ev.preventDefault();
4909
+ if (this.group) {
4910
+ (_a = this.params) === null || _a === void 0 ? void 0 : _a.containerApi.removeGroup(this.group);
4911
+ }
4912
+ }));
4579
4913
  }
4580
- init(params) {
4581
- this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4582
- this.tab.init(params);
4914
+ update(_event) {
4915
+ // noop
4583
4916
  }
4584
- updateParentGroup(group, isPanelVisible) {
4585
- var _a;
4586
- this._content.updateParentGroup(group, isPanelVisible);
4587
- (_a = this._tab) === null || _a === void 0 ? void 0 : _a.updateParentGroup(group, isPanelVisible);
4917
+ focus() {
4918
+ // noop
4588
4919
  }
4589
- layout(width, height) {
4590
- this.content.layout(width, height);
4920
+ layout(_width, _height) {
4921
+ // noop
4591
4922
  }
4592
- update(event) {
4593
- this.content.update(event);
4594
- this.tab.update(event);
4923
+ init(_params) {
4924
+ this.render();
4595
4925
  }
4596
- toJSON() {
4597
- let tab = this.tab instanceof DefaultTab ? undefined : this.tab.toJSON();
4598
- if (tab && Object.keys(tab).length === 0) {
4599
- tab = undefined;
4600
- }
4601
- return {
4602
- content: this.content.toJSON(),
4603
- tab,
4604
- };
4926
+ updateParentGroup(group, _visible) {
4927
+ this.group = group;
4928
+ this.render();
4605
4929
  }
4606
4930
  dispose() {
4607
- this.content.dispose();
4608
- this.tab.dispose();
4931
+ super.dispose();
4932
+ }
4933
+ render() {
4934
+ const isOneGroup = !!(this.params && this.params.containerApi.size <= 1);
4935
+ toggleClass(this.element, 'has-actions', isOneGroup);
4609
4936
  }
4610
4937
  }
4611
4938
 
@@ -4619,12 +4946,6 @@
4619
4946
  get panels() {
4620
4947
  return this.groups.flatMap((group) => group.panels);
4621
4948
  }
4622
- get deserializer() {
4623
- return this._deserializer;
4624
- }
4625
- set deserializer(value) {
4626
- this._deserializer = value;
4627
- }
4628
4949
  get options() {
4629
4950
  return this._options;
4630
4951
  }
@@ -4651,6 +4972,7 @@
4651
4972
  styles: options.styles,
4652
4973
  });
4653
4974
  this.nextGroupId = sequentialNumberGenerator();
4975
+ this._deserializer = new DefaultDockviewDeserialzier(this);
4654
4976
  this.watermark = null;
4655
4977
  this._onDidDrop = new Emitter();
4656
4978
  this.onDidDrop = this._onDidDrop.event;
@@ -4663,9 +4985,9 @@
4663
4985
  this._onDidActivePanelChange = new Emitter();
4664
4986
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
4665
4987
  this.element.classList.add('dv-dockview');
4666
- this.addDisposables(this._onDidDrop, exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
4988
+ this.addDisposables(this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
4667
4989
  this.updateWatermark();
4668
- }), exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4990
+ }), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4669
4991
  this._bufferOnDidLayoutChange.fire();
4670
4992
  }));
4671
4993
  this._options = options;
@@ -4832,9 +5154,6 @@
4832
5154
  }
4833
5155
  fromJSON(data) {
4834
5156
  this.clear();
4835
- if (!this.deserializer) {
4836
- throw new Error('no deserializer provided');
4837
- }
4838
5157
  const { grid, panels, options, activeGroup } = data;
4839
5158
  if (typeof (options === null || options === void 0 ? void 0 : options.tabHeight) === 'number') {
4840
5159
  this.tabHeight = options.tabHeight;
@@ -4852,7 +5171,7 @@
4852
5171
  });
4853
5172
  this._onDidAddGroup.fire(group);
4854
5173
  for (const child of views) {
4855
- const panel = this.deserializer.fromJSON(panels[child], group);
5174
+ const panel = this._deserializer.fromJSON(panels[child], group);
4856
5175
  const isActive = typeof activeView === 'string' &&
4857
5176
  activeView === panel.id;
4858
5177
  group.model.openPanel(panel, {
@@ -4979,14 +5298,12 @@
4979
5298
  : {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
4980
5299
  }
4981
5300
  updateWatermark() {
5301
+ var _a, _b;
4982
5302
  if (this.groups.length === 0) {
4983
5303
  if (!this.watermark) {
4984
5304
  this.watermark = this.createWatermarkComponent();
4985
5305
  this.watermark.init({
4986
5306
  containerApi: new DockviewApi(this),
4987
- params: {},
4988
- title: '',
4989
- api: null,
4990
5307
  });
4991
5308
  const watermarkContainer = document.createElement('div');
4992
5309
  watermarkContainer.className = 'dv-watermark-container';
@@ -4996,7 +5313,7 @@
4996
5313
  }
4997
5314
  else if (this.watermark) {
4998
5315
  this.watermark.element.parentElement.remove();
4999
- this.watermark.dispose();
5316
+ (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
5000
5317
  this.watermark = null;
5001
5318
  }
5002
5319
  }
@@ -5158,7 +5475,7 @@
5158
5475
  id = this.nextGroupId.next();
5159
5476
  }
5160
5477
  }
5161
- const view = new GroupPanel(this, id, options);
5478
+ const view = new DockviewGroupPanel(this, id, options);
5162
5479
  view.init({ params: {}, accessor: null }); // required to initialized .part and allow for correct disposal of group
5163
5480
  if (!this._groups.has(view.id)) {
5164
5481
  const disposable = new CompositeDisposable(view.model.onMove((event) => {
@@ -5171,857 +5488,522 @@
5171
5488
  }), view.model.onDidRemovePanel((event) => {
5172
5489
  this._onDidRemovePanel.fire(event.panel);
5173
5490
  }), view.model.onDidActivePanelChange((event) => {
5174
- this._onDidActivePanelChange.fire(event.panel);
5175
- }));
5176
- this._groups.set(view.id, { value: view, disposable });
5177
- }
5178
- // TODO: must be called after the above listeners have been setup,
5179
- // not an ideal pattern
5180
- view.initialize();
5181
- if (typeof this.options.tabHeight === 'number') {
5182
- view.model.header.height = this.options.tabHeight;
5183
- }
5184
- return view;
5185
- }
5186
- createPanel(options, group) {
5187
- const view = new DefaultGroupPanelView({
5188
- content: this.createContentComponent(options.id, options.component),
5189
- tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
5190
- });
5191
- const panel = new DockviewPanel(options.id, this, this._api, group);
5192
- panel.init({
5193
- view,
5194
- title: options.title || options.id,
5195
- params: (options === null || options === void 0 ? void 0 : options.params) || {},
5196
- });
5197
- return panel;
5198
- }
5199
- createContentComponent(id, componentName) {
5200
- var _a;
5201
- return createComponent(id, componentName, this.options.components || {}, this.options.frameworkComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.content);
5202
- }
5203
- createTabComponent(id, componentName) {
5204
- var _a;
5205
- return createComponent(id, componentName, this.options.tabComponents || {}, this.options.frameworkTabComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.tab, () => new DefaultTab());
5206
- }
5207
- createGroupAtLocation(location = [0]) {
5208
- const group = this.createGroup();
5209
- this.doAddGroup(group, location);
5210
- return group;
5211
- }
5212
- findGroup(panel) {
5213
- var _a;
5214
- return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
5215
- }
5216
- dispose() {
5217
- super.dispose();
5218
- this._onDidActivePanelChange.dispose();
5219
- this._onDidAddPanel.dispose();
5220
- this._onDidRemovePanel.dispose();
5221
- this._onDidLayoutFromJSON.dispose();
5222
- }
5223
- }
5224
-
5225
- class GridviewComponent extends BaseGrid {
5226
- get orientation() {
5227
- return this.gridview.orientation;
5228
- }
5229
- set orientation(value) {
5230
- this.gridview.orientation = value;
5231
- }
5232
- get options() {
5233
- return this._options;
5234
- }
5235
- get deserializer() {
5236
- return this._deserializer;
5237
- }
5238
- set deserializer(value) {
5239
- this._deserializer = value;
5240
- }
5241
- constructor(element, options) {
5242
- super(element, {
5243
- proportionalLayout: options.proportionalLayout,
5244
- orientation: options.orientation,
5245
- styles: options.styles,
5246
- });
5247
- this._onDidLayoutfromJSON = new Emitter();
5248
- this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5249
- this._options = options;
5250
- if (!this.options.components) {
5251
- this.options.components = {};
5252
- }
5253
- if (!this.options.frameworkComponents) {
5254
- this.options.frameworkComponents = {};
5255
- }
5256
- }
5257
- updateOptions(options) {
5258
- const hasOrientationChanged = typeof options.orientation === 'string' &&
5259
- this.gridview.orientation !== options.orientation;
5260
- this._options = Object.assign(Object.assign({}, this.options), options);
5261
- if (hasOrientationChanged) {
5262
- this.gridview.orientation = options.orientation;
5263
- }
5264
- this.layout(this.gridview.width, this.gridview.height, true);
5265
- }
5266
- removePanel(panel) {
5267
- this.removeGroup(panel);
5268
- }
5269
- /**
5270
- * Serialize the current state of the layout
5271
- *
5272
- * @returns A JSON respresentation of the layout
5273
- */
5274
- toJSON() {
5275
- var _a;
5276
- const data = this.gridview.serialize();
5277
- return {
5278
- grid: data,
5279
- activePanel: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
5280
- };
5281
- }
5282
- setVisible(panel, visible) {
5283
- this.gridview.setViewVisible(getGridLocation(panel.element), visible);
5284
- }
5285
- setActive(panel) {
5286
- this._groups.forEach((value, _key) => {
5287
- value.value.setActive(panel === value.value);
5288
- });
5289
- }
5290
- focus() {
5291
- var _a;
5292
- (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
5293
- }
5294
- fromJSON(serializedGridview) {
5295
- this.clear();
5296
- const { grid, activePanel } = serializedGridview;
5297
- const queue = [];
5298
- this.gridview.deserialize(grid, {
5299
- fromJSON: (node) => {
5300
- const { data } = node;
5301
- const view = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5302
- ? {
5303
- createComponent: this.options.frameworkComponentFactory
5304
- .createComponent,
5305
- }
5306
- : undefined);
5307
- queue.push(() => view.init({
5308
- params: data.params,
5309
- minimumWidth: data.minimumWidth,
5310
- maximumWidth: data.maximumWidth,
5311
- minimumHeight: data.minimumHeight,
5312
- maximumHeight: data.maximumHeight,
5313
- priority: data.priority,
5314
- snap: !!data.snap,
5315
- accessor: this,
5316
- isVisible: node.visible,
5317
- }));
5318
- this._onDidAddGroup.fire(view);
5319
- this.registerPanel(view);
5320
- return view;
5321
- },
5322
- });
5323
- this.layout(this.width, this.height, true);
5324
- queue.forEach((f) => f());
5325
- if (typeof activePanel === 'string') {
5326
- const panel = this.getPanel(activePanel);
5327
- if (panel) {
5328
- this.doSetGroupActive(panel);
5329
- }
5330
- }
5331
- this._onDidLayoutfromJSON.fire();
5332
- }
5333
- clear() {
5334
- const hasActiveGroup = this.activeGroup;
5335
- const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
5336
- for (const group of groups) {
5337
- group.disposable.dispose();
5338
- this.doRemoveGroup(group.value, { skipActive: true });
5339
- }
5340
- if (hasActiveGroup) {
5341
- this.doSetGroupActive(undefined);
5342
- }
5343
- this.gridview.clear();
5344
- }
5345
- movePanel(panel, options) {
5346
- var _a;
5347
- let relativeLocation;
5348
- const removedPanel = this.gridview.remove(panel);
5349
- const referenceGroup = (_a = this._groups.get(options.reference)) === null || _a === void 0 ? void 0 : _a.value;
5350
- if (!referenceGroup) {
5351
- throw new Error(`reference group ${options.reference} does not exist`);
5352
- }
5353
- const target = toTarget(options.direction);
5354
- if (target === 'center') {
5355
- throw new Error(`${target} not supported as an option`);
5356
- }
5357
- else {
5358
- const location = getGridLocation(referenceGroup.element);
5359
- relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5360
- }
5361
- this.doAddGroup(removedPanel, relativeLocation, options.size);
5362
- }
5363
- addPanel(options) {
5364
- var _a, _b;
5365
- let relativeLocation = options.location || [0];
5366
- if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
5367
- const referenceGroup = (_b = this._groups.get(options.position.referencePanel)) === null || _b === void 0 ? void 0 : _b.value;
5368
- if (!referenceGroup) {
5369
- throw new Error(`reference group ${options.position.referencePanel} does not exist`);
5370
- }
5371
- const target = toTarget(options.position.direction);
5372
- if (target === 'center') {
5373
- throw new Error(`${target} not supported as an option`);
5374
- }
5375
- else {
5376
- const location = getGridLocation(referenceGroup.element);
5377
- relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5378
- }
5491
+ this._onDidActivePanelChange.fire(event.panel);
5492
+ }));
5493
+ this._groups.set(view.id, { value: view, disposable });
5494
+ }
5495
+ // TODO: must be called after the above listeners have been setup,
5496
+ // not an ideal pattern
5497
+ view.initialize();
5498
+ if (typeof this.options.tabHeight === 'number') {
5499
+ view.model.header.height = this.options.tabHeight;
5379
5500
  }
5380
- const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5381
- ? {
5382
- createComponent: this.options.frameworkComponentFactory
5383
- .createComponent,
5384
- }
5385
- : undefined);
5386
- view.init({
5387
- params: options.params || {},
5388
- minimumWidth: options.minimumWidth,
5389
- maximumWidth: options.maximumWidth,
5390
- minimumHeight: options.minimumHeight,
5391
- maximumHeight: options.maximumHeight,
5392
- priority: options.priority,
5393
- snap: !!options.snap,
5394
- accessor: this,
5395
- isVisible: true,
5396
- });
5397
- this.registerPanel(view);
5398
- this.doAddGroup(view, relativeLocation, options.size);
5399
5501
  return view;
5400
5502
  }
5401
- registerPanel(panel) {
5402
- const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {
5403
- if (!event.isFocused) {
5404
- return;
5405
- }
5406
- this._groups.forEach((groupItem) => {
5407
- const group = groupItem.value;
5408
- if (group !== panel) {
5409
- group.setActive(false);
5410
- }
5411
- else {
5412
- group.setActive(true);
5413
- }
5414
- });
5415
- }));
5416
- this._groups.set(panel.id, {
5417
- value: panel,
5418
- disposable,
5503
+ createPanel(options, group) {
5504
+ const contentComponent = options.component;
5505
+ const tabComponent = options.tabComponent || this.options.defaultTabComponent;
5506
+ const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
5507
+ const panel = new DockviewPanel(options.id, this, this._api, group, view);
5508
+ panel.init({
5509
+ title: options.title || options.id,
5510
+ params: (options === null || options === void 0 ? void 0 : options.params) || {},
5419
5511
  });
5512
+ return panel;
5420
5513
  }
5421
- moveGroup(referenceGroup, groupId, target) {
5422
- const sourceGroup = this.getPanel(groupId);
5423
- if (!sourceGroup) {
5424
- throw new Error('invalid operation');
5425
- }
5426
- const referenceLocation = getGridLocation(referenceGroup.element);
5427
- const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5428
- const [targetParentLocation, to] = tail(targetLocation);
5429
- const sourceLocation = getGridLocation(sourceGroup.element);
5430
- const [sourceParentLocation, from] = tail(sourceLocation);
5431
- if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
5432
- // special case when 'swapping' two views within same grid location
5433
- // if a group has one tab - we are essentially moving the 'group'
5434
- // which is equivalent to swapping two views in this case
5435
- this.gridview.moveView(sourceParentLocation, from, to);
5436
- return;
5437
- }
5438
- // source group will become empty so delete the group
5439
- const targetGroup = this.doRemoveGroup(sourceGroup, {
5440
- skipActive: true,
5441
- skipDispose: true,
5442
- });
5443
- // after deleting the group we need to re-evaulate the ref location
5444
- const updatedReferenceLocation = getGridLocation(referenceGroup.element);
5445
- const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
5446
- this.doAddGroup(targetGroup, location);
5514
+ createGroupAtLocation(location = [0]) {
5515
+ const group = this.createGroup();
5516
+ this.doAddGroup(group, location);
5517
+ return group;
5447
5518
  }
5448
- removeGroup(group) {
5449
- super.removeGroup(group);
5519
+ findGroup(panel) {
5520
+ var _a;
5521
+ return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
5450
5522
  }
5451
5523
  dispose() {
5452
5524
  super.dispose();
5453
- this._onDidLayoutfromJSON.dispose();
5525
+ this._onDidActivePanelChange.dispose();
5526
+ this._onDidAddPanel.dispose();
5527
+ this._onDidRemovePanel.dispose();
5528
+ this._onDidLayoutFromJSON.dispose();
5454
5529
  }
5455
5530
  }
5456
5531
 
5457
- /**
5458
- * A high-level implementation of splitview that works using 'panels'
5459
- */
5460
- class SplitviewComponent extends CompositeDisposable {
5461
- get panels() {
5462
- return this.splitview.getViews();
5463
- }
5464
- get options() {
5465
- return this._options;
5466
- }
5467
- get length() {
5468
- return this._panels.size;
5469
- }
5532
+ class GridviewComponent extends BaseGrid {
5470
5533
  get orientation() {
5471
- return this.splitview.orientation;
5472
- }
5473
- get splitview() {
5474
- return this._splitview;
5475
- }
5476
- set splitview(value) {
5477
- this._splitview = value;
5478
- this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
5479
- this._onDidLayoutChange.fire(undefined);
5480
- }), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
5534
+ return this.gridview.orientation;
5481
5535
  }
5482
- get minimumSize() {
5483
- return this.splitview.minimumSize;
5536
+ set orientation(value) {
5537
+ this.gridview.orientation = value;
5484
5538
  }
5485
- get maximumSize() {
5486
- return this.splitview.maximumSize;
5539
+ get options() {
5540
+ return this._options;
5487
5541
  }
5488
- get height() {
5489
- return this.splitview.orientation === exports.Orientation.HORIZONTAL
5490
- ? this.splitview.orthogonalSize
5491
- : this.splitview.size;
5542
+ get deserializer() {
5543
+ return this._deserializer;
5492
5544
  }
5493
- get width() {
5494
- return this.splitview.orientation === exports.Orientation.HORIZONTAL
5495
- ? this.splitview.size
5496
- : this.splitview.orthogonalSize;
5545
+ set deserializer(value) {
5546
+ this._deserializer = value;
5497
5547
  }
5498
5548
  constructor(element, options) {
5499
- super();
5500
- this.element = element;
5501
- this._disposable = new MutableDisposable();
5502
- this._panels = new Map();
5549
+ super(element, {
5550
+ proportionalLayout: options.proportionalLayout,
5551
+ orientation: options.orientation,
5552
+ styles: options.styles,
5553
+ });
5503
5554
  this._onDidLayoutfromJSON = new Emitter();
5504
5555
  this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5505
- this._onDidAddView = new Emitter();
5506
- this.onDidAddView = this._onDidAddView.event;
5507
- this._onDidRemoveView = new Emitter();
5508
- this.onDidRemoveView = this._onDidRemoveView.event;
5509
- this._onDidLayoutChange = new Emitter();
5510
- this.onDidLayoutChange = this._onDidLayoutChange.event;
5511
5556
  this._options = options;
5512
- if (!options.components) {
5513
- options.components = {};
5557
+ if (!this.options.components) {
5558
+ this.options.components = {};
5514
5559
  }
5515
- if (!options.frameworkComponents) {
5516
- options.frameworkComponents = {};
5560
+ if (!this.options.frameworkComponents) {
5561
+ this.options.frameworkComponents = {};
5517
5562
  }
5518
- this.splitview = new Splitview(this.element, options);
5519
- this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5520
5563
  }
5521
5564
  updateOptions(options) {
5522
5565
  const hasOrientationChanged = typeof options.orientation === 'string' &&
5523
- this.options.orientation !== options.orientation;
5566
+ this.gridview.orientation !== options.orientation;
5524
5567
  this._options = Object.assign(Object.assign({}, this.options), options);
5525
5568
  if (hasOrientationChanged) {
5526
- this.splitview.orientation = options.orientation;
5527
- }
5528
- this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
5529
- }
5530
- focus() {
5531
- var _a;
5532
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
5533
- }
5534
- movePanel(from, to) {
5535
- this.splitview.moveView(from, to);
5536
- }
5537
- setVisible(panel, visible) {
5538
- const index = this.panels.indexOf(panel);
5539
- this.splitview.setViewVisible(index, visible);
5540
- }
5541
- setActive(view, skipFocus) {
5542
- this._activePanel = view;
5543
- this.panels
5544
- .filter((v) => v !== view)
5545
- .forEach((v) => {
5546
- v.api._onDidActiveChange.fire({ isActive: false });
5547
- if (!skipFocus) {
5548
- v.focus();
5549
- }
5550
- });
5551
- view.api._onDidActiveChange.fire({ isActive: true });
5552
- if (!skipFocus) {
5553
- view.focus();
5554
- }
5555
- }
5556
- removePanel(panel, sizing) {
5557
- const disposable = this._panels.get(panel.id);
5558
- if (!disposable) {
5559
- throw new Error(`unknown splitview panel ${panel.id}`);
5560
- }
5561
- disposable.disposable.dispose();
5562
- disposable.value.dispose();
5563
- this._panels.delete(panel.id);
5564
- const index = this.panels.findIndex((_) => _ === panel);
5565
- this.splitview.removeView(index, sizing);
5566
- const panels = this.panels;
5567
- if (panels.length > 0) {
5568
- this.setActive(panels[panels.length - 1]);
5569
- }
5570
- }
5571
- getPanel(id) {
5572
- return this.panels.find((view) => view.id === id);
5573
- }
5574
- addPanel(options) {
5575
- if (this._panels.has(options.id)) {
5576
- throw new Error(`panel ${options.id} already exists`);
5569
+ this.gridview.orientation = options.orientation;
5577
5570
  }
5578
- const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5579
- ? {
5580
- createComponent: this.options.frameworkWrapper.createComponent,
5581
- }
5582
- : undefined);
5583
- view.orientation = this.splitview.orientation;
5584
- view.init({
5585
- params: options.params || {},
5586
- minimumSize: options.minimumSize,
5587
- maximumSize: options.maximumSize,
5588
- snap: options.snap,
5589
- priority: options.priority,
5590
- accessor: this,
5591
- });
5592
- const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
5593
- const index = typeof options.index === 'number' ? options.index : undefined;
5594
- this.splitview.addView(view, size, index);
5595
- this.doAddView(view);
5596
- this.setActive(view);
5597
- return view;
5598
- }
5599
- layout(width, height) {
5600
- const [size, orthogonalSize] = this.splitview.orientation === exports.Orientation.HORIZONTAL
5601
- ? [width, height]
5602
- : [height, width];
5603
- this.splitview.layout(size, orthogonalSize);
5571
+ this.layout(this.gridview.width, this.gridview.height, true);
5604
5572
  }
5605
- doAddView(view) {
5606
- const disposable = view.api.onDidFocusChange((event) => {
5607
- if (!event.isFocused) {
5608
- return;
5609
- }
5610
- this.setActive(view, true);
5611
- });
5612
- this._panels.set(view.id, { disposable, value: view });
5573
+ removePanel(panel) {
5574
+ this.removeGroup(panel);
5613
5575
  }
5576
+ /**
5577
+ * Serialize the current state of the layout
5578
+ *
5579
+ * @returns A JSON respresentation of the layout
5580
+ */
5614
5581
  toJSON() {
5615
5582
  var _a;
5616
- const views = this.splitview
5617
- .getViews()
5618
- .map((view, i) => {
5619
- const size = this.splitview.getViewSize(i);
5620
- return {
5621
- size,
5622
- data: view.toJSON(),
5623
- snap: !!view.snap,
5624
- priority: view.priority,
5625
- };
5626
- });
5583
+ const data = this.gridview.serialize();
5627
5584
  return {
5628
- views,
5629
- activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
5630
- size: this.splitview.size,
5631
- orientation: this.splitview.orientation,
5585
+ grid: data,
5586
+ activePanel: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
5632
5587
  };
5633
5588
  }
5634
- fromJSON(serializedSplitview) {
5589
+ setVisible(panel, visible) {
5590
+ this.gridview.setViewVisible(getGridLocation(panel.element), visible);
5591
+ }
5592
+ setActive(panel) {
5593
+ this._groups.forEach((value, _key) => {
5594
+ value.value.setActive(panel === value.value);
5595
+ });
5596
+ }
5597
+ focus() {
5598
+ var _a;
5599
+ (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
5600
+ }
5601
+ fromJSON(serializedGridview) {
5635
5602
  this.clear();
5636
- const { views, orientation, size, activeView } = serializedSplitview;
5603
+ const { grid, activePanel } = serializedGridview;
5637
5604
  const queue = [];
5638
- this.splitview = new Splitview(this.element, {
5639
- orientation,
5640
- proportionalLayout: this.options.proportionalLayout,
5641
- descriptor: {
5642
- size,
5643
- views: views.map((view) => {
5644
- const data = view.data;
5645
- if (this._panels.has(data.id)) {
5646
- throw new Error(`panel ${data.id} already exists`);
5605
+ this.gridview.deserialize(grid, {
5606
+ fromJSON: (node) => {
5607
+ const { data } = node;
5608
+ const view = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5609
+ ? {
5610
+ createComponent: this.options.frameworkComponentFactory
5611
+ .createComponent,
5647
5612
  }
5648
- const panel = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5649
- ? {
5650
- createComponent: this.options.frameworkWrapper
5651
- .createComponent,
5652
- }
5653
- : undefined);
5654
- queue.push(() => {
5655
- panel.init({
5656
- params: data.params || {},
5657
- minimumSize: data.minimumSize,
5658
- maximumSize: data.maximumSize,
5659
- snap: view.snap,
5660
- priority: view.priority,
5661
- accessor: this,
5662
- });
5663
- });
5664
- panel.orientation = orientation;
5665
- this.doAddView(panel);
5666
- setTimeout(() => {
5667
- // the original onDidAddView events are missed since they are fired before we can subcribe to them
5668
- this._onDidAddView.fire(panel);
5669
- }, 0);
5670
- return { size: view.size, view: panel };
5671
- }),
5613
+ : undefined);
5614
+ queue.push(() => view.init({
5615
+ params: data.params,
5616
+ minimumWidth: data.minimumWidth,
5617
+ maximumWidth: data.maximumWidth,
5618
+ minimumHeight: data.minimumHeight,
5619
+ maximumHeight: data.maximumHeight,
5620
+ priority: data.priority,
5621
+ snap: !!data.snap,
5622
+ accessor: this,
5623
+ isVisible: node.visible,
5624
+ }));
5625
+ this._onDidAddGroup.fire(view);
5626
+ this.registerPanel(view);
5627
+ return view;
5672
5628
  },
5673
5629
  });
5674
- this.layout(this.width, this.height);
5630
+ this.layout(this.width, this.height, true);
5675
5631
  queue.forEach((f) => f());
5676
- if (typeof activeView === 'string') {
5677
- const panel = this.getPanel(activeView);
5632
+ if (typeof activePanel === 'string') {
5633
+ const panel = this.getPanel(activePanel);
5678
5634
  if (panel) {
5679
- this.setActive(panel);
5635
+ this.doSetGroupActive(panel);
5680
5636
  }
5681
5637
  }
5682
5638
  this._onDidLayoutfromJSON.fire();
5683
5639
  }
5684
5640
  clear() {
5685
- for (const [_, value] of this._panels.entries()) {
5686
- value.disposable.dispose();
5687
- value.value.dispose();
5641
+ const hasActiveGroup = this.activeGroup;
5642
+ const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
5643
+ for (const group of groups) {
5644
+ group.disposable.dispose();
5645
+ this.doRemoveGroup(group.value, { skipActive: true });
5688
5646
  }
5689
- this._panels.clear();
5690
- this.splitview.dispose();
5647
+ if (hasActiveGroup) {
5648
+ this.doSetGroupActive(undefined);
5649
+ }
5650
+ this.gridview.clear();
5691
5651
  }
5692
- dispose() {
5693
- for (const [_, value] of this._panels.entries()) {
5694
- value.disposable.dispose();
5695
- value.value.dispose();
5652
+ movePanel(panel, options) {
5653
+ var _a;
5654
+ let relativeLocation;
5655
+ const removedPanel = this.gridview.remove(panel);
5656
+ const referenceGroup = (_a = this._groups.get(options.reference)) === null || _a === void 0 ? void 0 : _a.value;
5657
+ if (!referenceGroup) {
5658
+ throw new Error(`reference group ${options.reference} does not exist`);
5696
5659
  }
5697
- this._panels.clear();
5698
- this.splitview.dispose();
5699
- super.dispose();
5660
+ const target = toTarget(options.direction);
5661
+ if (target === 'center') {
5662
+ throw new Error(`${target} not supported as an option`);
5663
+ }
5664
+ else {
5665
+ const location = getGridLocation(referenceGroup.element);
5666
+ relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5667
+ }
5668
+ this.doAddGroup(removedPanel, relativeLocation, options.size);
5700
5669
  }
5701
- }
5702
-
5703
- class SplitviewPanelApiImpl extends PanelApiImpl {
5704
- //
5705
- constructor(id) {
5706
- super(id);
5707
- this._onDidConstraintsChangeInternal = new Emitter();
5708
- this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5709
- //
5710
- this._onDidConstraintsChange = new Emitter({
5711
- replay: true,
5670
+ addPanel(options) {
5671
+ var _a, _b;
5672
+ let relativeLocation = options.location || [0];
5673
+ if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
5674
+ const referenceGroup = (_b = this._groups.get(options.position.referencePanel)) === null || _b === void 0 ? void 0 : _b.value;
5675
+ if (!referenceGroup) {
5676
+ throw new Error(`reference group ${options.position.referencePanel} does not exist`);
5677
+ }
5678
+ const target = toTarget(options.position.direction);
5679
+ if (target === 'center') {
5680
+ throw new Error(`${target} not supported as an option`);
5681
+ }
5682
+ else {
5683
+ const location = getGridLocation(referenceGroup.element);
5684
+ relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5685
+ }
5686
+ }
5687
+ const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5688
+ ? {
5689
+ createComponent: this.options.frameworkComponentFactory
5690
+ .createComponent,
5691
+ }
5692
+ : undefined);
5693
+ view.init({
5694
+ params: options.params || {},
5695
+ minimumWidth: options.minimumWidth,
5696
+ maximumWidth: options.maximumWidth,
5697
+ minimumHeight: options.minimumHeight,
5698
+ maximumHeight: options.maximumHeight,
5699
+ priority: options.priority,
5700
+ snap: !!options.snap,
5701
+ accessor: this,
5702
+ isVisible: true,
5712
5703
  });
5713
- this.onDidConstraintsChange = this._onDidConstraintsChange.event;
5714
- //
5715
- this._onDidSizeChange = new Emitter();
5716
- this.onDidSizeChange = this._onDidSizeChange.event;
5717
- this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
5718
- }
5719
- setConstraints(value) {
5720
- this._onDidConstraintsChangeInternal.fire(value);
5721
- }
5722
- setSize(event) {
5723
- this._onDidSizeChange.fire(event);
5704
+ this.registerPanel(view);
5705
+ this.doAddGroup(view, relativeLocation, options.size);
5706
+ return view;
5724
5707
  }
5725
- }
5726
-
5727
- class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5728
- set pane(pane) {
5729
- this._pane = pane;
5708
+ registerPanel(panel) {
5709
+ const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {
5710
+ if (!event.isFocused) {
5711
+ return;
5712
+ }
5713
+ this._groups.forEach((groupItem) => {
5714
+ const group = groupItem.value;
5715
+ if (group !== panel) {
5716
+ group.setActive(false);
5717
+ }
5718
+ else {
5719
+ group.setActive(true);
5720
+ }
5721
+ });
5722
+ }));
5723
+ this._groups.set(panel.id, {
5724
+ value: panel,
5725
+ disposable,
5726
+ });
5730
5727
  }
5731
- constructor(id) {
5732
- super(id);
5733
- this._onDidExpansionChange = new Emitter({
5734
- replay: true,
5728
+ moveGroup(referenceGroup, groupId, target) {
5729
+ const sourceGroup = this.getPanel(groupId);
5730
+ if (!sourceGroup) {
5731
+ throw new Error('invalid operation');
5732
+ }
5733
+ const referenceLocation = getGridLocation(referenceGroup.element);
5734
+ const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5735
+ const [targetParentLocation, to] = tail(targetLocation);
5736
+ const sourceLocation = getGridLocation(sourceGroup.element);
5737
+ const [sourceParentLocation, from] = tail(sourceLocation);
5738
+ if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
5739
+ // special case when 'swapping' two views within same grid location
5740
+ // if a group has one tab - we are essentially moving the 'group'
5741
+ // which is equivalent to swapping two views in this case
5742
+ this.gridview.moveView(sourceParentLocation, from, to);
5743
+ return;
5744
+ }
5745
+ // source group will become empty so delete the group
5746
+ const targetGroup = this.doRemoveGroup(sourceGroup, {
5747
+ skipActive: true,
5748
+ skipDispose: true,
5735
5749
  });
5736
- this.onDidExpansionChange = this._onDidExpansionChange.event;
5737
- this._onMouseEnter = new Emitter({});
5738
- this.onMouseEnter = this._onMouseEnter.event;
5739
- this._onMouseLeave = new Emitter({});
5740
- this.onMouseLeave = this._onMouseLeave.event;
5741
- this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
5750
+ // after deleting the group we need to re-evaulate the ref location
5751
+ const updatedReferenceLocation = getGridLocation(referenceGroup.element);
5752
+ const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
5753
+ this.doAddGroup(targetGroup, location);
5742
5754
  }
5743
- setExpanded(isExpanded) {
5744
- var _a;
5745
- (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
5755
+ removeGroup(group) {
5756
+ super.removeGroup(group);
5746
5757
  }
5747
- get isExpanded() {
5748
- var _a;
5749
- return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
5758
+ dispose() {
5759
+ super.dispose();
5760
+ this._onDidLayoutfromJSON.dispose();
5750
5761
  }
5751
5762
  }
5752
5763
 
5753
- class PaneviewPanel extends BasePanelView {
5754
- set orientation(value) {
5755
- this._orientation = value;
5756
- }
5757
- get orientation() {
5758
- return this._orientation;
5759
- }
5760
- get minimumSize() {
5761
- const headerSize = this.headerSize;
5762
- const expanded = this.isExpanded();
5763
- const minimumBodySize = expanded ? this._minimumBodySize : 0;
5764
- return headerSize + minimumBodySize;
5764
+ /**
5765
+ * A high-level implementation of splitview that works using 'panels'
5766
+ */
5767
+ class SplitviewComponent extends CompositeDisposable {
5768
+ get panels() {
5769
+ return this.splitview.getViews();
5765
5770
  }
5766
- get maximumSize() {
5767
- const headerSize = this.headerSize;
5768
- const expanded = this.isExpanded();
5769
- const maximumBodySize = expanded ? this._maximumBodySize : 0;
5770
- return headerSize + maximumBodySize;
5771
+ get options() {
5772
+ return this._options;
5771
5773
  }
5772
- get size() {
5773
- return this._size;
5774
+ get length() {
5775
+ return this._panels.size;
5774
5776
  }
5775
- get orthogonalSize() {
5776
- return this._orthogonalSize;
5777
+ get orientation() {
5778
+ return this.splitview.orientation;
5777
5779
  }
5778
- set orthogonalSize(size) {
5779
- this._orthogonalSize = size;
5780
+ get splitview() {
5781
+ return this._splitview;
5780
5782
  }
5781
- get minimumBodySize() {
5782
- return this._minimumBodySize;
5783
+ set splitview(value) {
5784
+ this._splitview = value;
5785
+ this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
5786
+ this._onDidLayoutChange.fire(undefined);
5787
+ }), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
5783
5788
  }
5784
- set minimumBodySize(value) {
5785
- this._minimumBodySize = typeof value === 'number' ? value : 0;
5789
+ get minimumSize() {
5790
+ return this.splitview.minimumSize;
5786
5791
  }
5787
- get maximumBodySize() {
5788
- return this._maximumBodySize;
5792
+ get maximumSize() {
5793
+ return this.splitview.maximumSize;
5789
5794
  }
5790
- set maximumBodySize(value) {
5791
- this._maximumBodySize =
5792
- typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
5795
+ get height() {
5796
+ return this.splitview.orientation === exports.Orientation.HORIZONTAL
5797
+ ? this.splitview.orthogonalSize
5798
+ : this.splitview.size;
5793
5799
  }
5794
- get headerVisible() {
5795
- return this._headerVisible;
5800
+ get width() {
5801
+ return this.splitview.orientation === exports.Orientation.HORIZONTAL
5802
+ ? this.splitview.size
5803
+ : this.splitview.orthogonalSize;
5796
5804
  }
5797
- set headerVisible(value) {
5798
- this._headerVisible = value;
5799
- this.header.style.display = value ? '' : 'none';
5805
+ constructor(element, options) {
5806
+ super();
5807
+ this.element = element;
5808
+ this._disposable = new MutableDisposable();
5809
+ this._panels = new Map();
5810
+ this._onDidLayoutfromJSON = new Emitter();
5811
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5812
+ this._onDidAddView = new Emitter();
5813
+ this.onDidAddView = this._onDidAddView.event;
5814
+ this._onDidRemoveView = new Emitter();
5815
+ this.onDidRemoveView = this._onDidRemoveView.event;
5816
+ this._onDidLayoutChange = new Emitter();
5817
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
5818
+ this._options = options;
5819
+ if (!options.components) {
5820
+ options.components = {};
5821
+ }
5822
+ if (!options.frameworkComponents) {
5823
+ options.frameworkComponents = {};
5824
+ }
5825
+ this.splitview = new Splitview(this.element, options);
5826
+ this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5800
5827
  }
5801
- constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5802
- super(id, component, new PaneviewPanelApiImpl(id));
5803
- this.headerComponent = headerComponent;
5804
- this._onDidChangeExpansionState = new Emitter({ replay: true });
5805
- this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
5806
- this._onDidChange = new Emitter();
5807
- this.onDidChange = this._onDidChange.event;
5808
- this.headerSize = 22;
5809
- this._orthogonalSize = 0;
5810
- this._size = 0;
5811
- this._minimumBodySize = 100;
5812
- this._maximumBodySize = Number.POSITIVE_INFINITY;
5813
- this._isExpanded = false;
5814
- this.expandedSize = 0;
5815
- this.api.pane = this; // TODO cannot use 'this' before 'super'
5816
- this.api.initialize(this);
5817
- this._isExpanded = isExpanded;
5818
- this._headerVisible = isHeaderVisible;
5819
- this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
5820
- this._orientation = orientation;
5821
- this.element.classList.add('pane');
5822
- this.addDisposables(this.api.onDidSizeChange((event) => {
5823
- this._onDidChange.fire({ size: event.size });
5824
- }), addDisposableListener(this.element, 'mouseenter', (ev) => {
5825
- this.api._onMouseEnter.fire(ev);
5826
- }), addDisposableListener(this.element, 'mouseleave', (ev) => {
5827
- this.api._onMouseLeave.fire(ev);
5828
- }));
5829
- this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
5830
- this.api._onDidExpansionChange.fire({
5831
- isExpanded: isPanelExpanded,
5832
- });
5833
- }), this.api.onDidFocusChange((e) => {
5834
- if (!this.header) {
5835
- return;
5836
- }
5837
- if (e.isFocused) {
5838
- addClasses(this.header, 'focused');
5839
- }
5840
- else {
5841
- removeClasses(this.header, 'focused');
5842
- }
5843
- }));
5844
- this.renderOnce();
5828
+ updateOptions(options) {
5829
+ const hasOrientationChanged = typeof options.orientation === 'string' &&
5830
+ this.options.orientation !== options.orientation;
5831
+ this._options = Object.assign(Object.assign({}, this.options), options);
5832
+ if (hasOrientationChanged) {
5833
+ this.splitview.orientation = options.orientation;
5834
+ }
5835
+ this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
5845
5836
  }
5846
- setVisible(isVisible) {
5847
- this.api._onDidVisibilityChange.fire({ isVisible });
5837
+ focus() {
5838
+ var _a;
5839
+ (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
5848
5840
  }
5849
- setActive(isActive) {
5850
- this.api._onDidActiveChange.fire({ isActive });
5841
+ movePanel(from, to) {
5842
+ this.splitview.moveView(from, to);
5851
5843
  }
5852
- isExpanded() {
5853
- return this._isExpanded;
5844
+ setVisible(panel, visible) {
5845
+ const index = this.panels.indexOf(panel);
5846
+ this.splitview.setViewVisible(index, visible);
5854
5847
  }
5855
- setExpanded(expanded) {
5856
- if (this._isExpanded === expanded) {
5857
- return;
5858
- }
5859
- this._isExpanded = expanded;
5860
- if (expanded) {
5861
- if (this.animationTimer) {
5862
- clearTimeout(this.animationTimer);
5863
- }
5864
- if (this.body) {
5865
- this.element.appendChild(this.body);
5848
+ setActive(view, skipFocus) {
5849
+ this._activePanel = view;
5850
+ this.panels
5851
+ .filter((v) => v !== view)
5852
+ .forEach((v) => {
5853
+ v.api._onDidActiveChange.fire({ isActive: false });
5854
+ if (!skipFocus) {
5855
+ v.focus();
5866
5856
  }
5857
+ });
5858
+ view.api._onDidActiveChange.fire({ isActive: true });
5859
+ if (!skipFocus) {
5860
+ view.focus();
5867
5861
  }
5868
- else {
5869
- this.animationTimer = setTimeout(() => {
5870
- var _a;
5871
- (_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
5872
- }, 200);
5873
- }
5874
- this._onDidChange.fire(expanded ? { size: this.width } : {});
5875
- this._onDidChangeExpansionState.fire(expanded);
5876
- }
5877
- layout(size, orthogonalSize) {
5878
- this._size = size;
5879
- this._orthogonalSize = orthogonalSize;
5880
- const [width, height] = this.orientation === exports.Orientation.HORIZONTAL
5881
- ? [size, orthogonalSize]
5882
- : [orthogonalSize, size];
5883
- if (this.isExpanded()) {
5884
- this.expandedSize = width;
5885
- }
5886
- super.layout(width, height);
5887
5862
  }
5888
- init(parameters) {
5889
- var _a, _b;
5890
- super.init(parameters);
5891
- if (typeof parameters.minimumBodySize === 'number') {
5892
- this.minimumBodySize = parameters.minimumBodySize;
5863
+ removePanel(panel, sizing) {
5864
+ const disposable = this._panels.get(panel.id);
5865
+ if (!disposable) {
5866
+ throw new Error(`unknown splitview panel ${panel.id}`);
5893
5867
  }
5894
- if (typeof parameters.maximumBodySize === 'number') {
5895
- this.maximumBodySize = parameters.maximumBodySize;
5868
+ disposable.disposable.dispose();
5869
+ disposable.value.dispose();
5870
+ this._panels.delete(panel.id);
5871
+ const index = this.panels.findIndex((_) => _ === panel);
5872
+ this.splitview.removeView(index, sizing);
5873
+ const panels = this.panels;
5874
+ if (panels.length > 0) {
5875
+ this.setActive(panels[panels.length - 1]);
5896
5876
  }
5897
- this.bodyPart = this.getBodyComponent();
5898
- this.headerPart = this.getHeaderComponent();
5899
- this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
5900
- this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
5901
- (_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);
5902
- (_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
5903
- if (typeof parameters.isExpanded === 'boolean') {
5904
- this.setExpanded(parameters.isExpanded);
5877
+ }
5878
+ getPanel(id) {
5879
+ return this.panels.find((view) => view.id === id);
5880
+ }
5881
+ addPanel(options) {
5882
+ if (this._panels.has(options.id)) {
5883
+ throw new Error(`panel ${options.id} already exists`);
5905
5884
  }
5885
+ const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5886
+ ? {
5887
+ createComponent: this.options.frameworkWrapper.createComponent,
5888
+ }
5889
+ : undefined);
5890
+ view.orientation = this.splitview.orientation;
5891
+ view.init({
5892
+ params: options.params || {},
5893
+ minimumSize: options.minimumSize,
5894
+ maximumSize: options.maximumSize,
5895
+ snap: options.snap,
5896
+ priority: options.priority,
5897
+ accessor: this,
5898
+ });
5899
+ const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
5900
+ const index = typeof options.index === 'number' ? options.index : undefined;
5901
+ this.splitview.addView(view, size, index);
5902
+ this.doAddView(view);
5903
+ this.setActive(view);
5904
+ return view;
5906
5905
  }
5907
- toJSON() {
5908
- const params = this._params;
5909
- return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
5906
+ layout(width, height) {
5907
+ const [size, orthogonalSize] = this.splitview.orientation === exports.Orientation.HORIZONTAL
5908
+ ? [width, height]
5909
+ : [height, width];
5910
+ this.splitview.layout(size, orthogonalSize);
5910
5911
  }
5911
- renderOnce() {
5912
- this.header = document.createElement('div');
5913
- this.header.tabIndex = 0;
5914
- this.header.className = 'pane-header';
5915
- this.header.style.height = `${this.headerSize}px`;
5916
- this.header.style.lineHeight = `${this.headerSize}px`;
5917
- this.header.style.minHeight = `${this.headerSize}px`;
5918
- this.header.style.maxHeight = `${this.headerSize}px`;
5919
- this.element.appendChild(this.header);
5920
- this.body = document.createElement('div');
5921
- this.body.className = 'pane-body';
5922
- this.element.appendChild(this.body);
5912
+ doAddView(view) {
5913
+ const disposable = view.api.onDidFocusChange((event) => {
5914
+ if (!event.isFocused) {
5915
+ return;
5916
+ }
5917
+ this.setActive(view, true);
5918
+ });
5919
+ this._panels.set(view.id, { disposable, value: view });
5923
5920
  }
5924
- // TODO slightly hacky by-pass of the component to create a body and header component
5925
- getComponent() {
5921
+ toJSON() {
5922
+ var _a;
5923
+ const views = this.splitview
5924
+ .getViews()
5925
+ .map((view, i) => {
5926
+ const size = this.splitview.getViewSize(i);
5927
+ return {
5928
+ size,
5929
+ data: view.toJSON(),
5930
+ snap: !!view.snap,
5931
+ priority: view.priority,
5932
+ };
5933
+ });
5926
5934
  return {
5927
- update: (params) => {
5928
- var _a, _b;
5929
- (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
5930
- (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
5931
- },
5932
- dispose: () => {
5933
- var _a, _b;
5934
- (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
5935
- (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
5936
- },
5935
+ views,
5936
+ activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
5937
+ size: this.splitview.size,
5938
+ orientation: this.splitview.orientation,
5937
5939
  };
5938
5940
  }
5939
- }
5940
-
5941
- class DraggablePaneviewPanel extends PaneviewPanel {
5942
- constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
5943
- super(id, component, headerComponent, orientation, isExpanded, true);
5944
- this.accessor = accessor;
5945
- this._onDidDrop = new Emitter();
5946
- this.onDidDrop = this._onDidDrop.event;
5947
- if (!disableDnd) {
5948
- this.initDragFeatures();
5949
- }
5950
- }
5951
- initDragFeatures() {
5952
- if (!this.header) {
5953
- return;
5954
- }
5955
- const id = this.id;
5956
- const accessorId = this.accessor.id;
5957
- this.header.draggable = true;
5958
- this.handler = new (class PaneDragHandler extends DragHandler {
5959
- getData() {
5960
- LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
5961
- return {
5962
- dispose: () => {
5963
- LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
5964
- },
5965
- };
5966
- }
5967
- })(this.header);
5968
- this.target = new Droptarget(this.element, {
5969
- acceptedTargetZones: ['top', 'bottom'],
5970
- overlayModel: {
5971
- activationSize: { type: 'percentage', value: 50 },
5972
- },
5973
- canDisplayOverlay: (event) => {
5974
- const data = getPaneData();
5975
- if (data) {
5976
- if (data.paneId !== this.id &&
5977
- data.viewId === this.accessor.id) {
5978
- return true;
5941
+ fromJSON(serializedSplitview) {
5942
+ this.clear();
5943
+ const { views, orientation, size, activeView } = serializedSplitview;
5944
+ const queue = [];
5945
+ this.splitview = new Splitview(this.element, {
5946
+ orientation,
5947
+ proportionalLayout: this.options.proportionalLayout,
5948
+ descriptor: {
5949
+ size,
5950
+ views: views.map((view) => {
5951
+ const data = view.data;
5952
+ if (this._panels.has(data.id)) {
5953
+ throw new Error(`panel ${data.id} already exists`);
5979
5954
  }
5980
- }
5981
- if (this.accessor.options.showDndOverlay) {
5982
- return this.accessor.options.showDndOverlay({
5983
- nativeEvent: event,
5984
- getData: getPaneData,
5985
- panel: this,
5955
+ const panel = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5956
+ ? {
5957
+ createComponent: this.options.frameworkWrapper
5958
+ .createComponent,
5959
+ }
5960
+ : undefined);
5961
+ queue.push(() => {
5962
+ panel.init({
5963
+ params: data.params || {},
5964
+ minimumSize: data.minimumSize,
5965
+ maximumSize: data.maximumSize,
5966
+ snap: view.snap,
5967
+ priority: view.priority,
5968
+ accessor: this,
5969
+ });
5986
5970
  });
5987
- }
5988
- return false;
5971
+ panel.orientation = orientation;
5972
+ this.doAddView(panel);
5973
+ setTimeout(() => {
5974
+ // the original onDidAddView events are missed since they are fired before we can subcribe to them
5975
+ this._onDidAddView.fire(panel);
5976
+ }, 0);
5977
+ return { size: view.size, view: panel };
5978
+ }),
5989
5979
  },
5990
5980
  });
5991
- this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
5992
- this.onDrop(event);
5993
- }));
5994
- }
5995
- onDrop(event) {
5996
- const data = getPaneData();
5997
- if (!data || data.viewId !== this.accessor.id) {
5998
- // if there is no local drag event for this panel
5999
- // or if the drag event was creating by another Paneview instance
6000
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
6001
- return;
6002
- }
6003
- const containerApi = this._params
6004
- .containerApi;
6005
- const panelId = data.paneId;
6006
- const existingPanel = containerApi.getPanel(panelId);
6007
- if (!existingPanel) {
6008
- // if the panel doesn't exist
6009
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
6010
- return;
5981
+ this.layout(this.width, this.height);
5982
+ queue.forEach((f) => f());
5983
+ if (typeof activeView === 'string') {
5984
+ const panel = this.getPanel(activeView);
5985
+ if (panel) {
5986
+ this.setActive(panel);
5987
+ }
6011
5988
  }
6012
- const allPanels = containerApi.panels;
6013
- const fromIndex = allPanels.indexOf(existingPanel);
6014
- let toIndex = containerApi.panels.indexOf(this);
6015
- if (event.position === 'left' || event.position === 'top') {
6016
- toIndex = Math.max(0, toIndex - 1);
5989
+ this._onDidLayoutfromJSON.fire();
5990
+ }
5991
+ clear() {
5992
+ for (const [_, value] of this._panels.entries()) {
5993
+ value.disposable.dispose();
5994
+ value.value.dispose();
6017
5995
  }
6018
- if (event.position === 'right' || event.position === 'bottom') {
6019
- if (fromIndex > toIndex) {
6020
- toIndex++;
6021
- }
6022
- toIndex = Math.min(allPanels.length - 1, toIndex);
5996
+ this._panels.clear();
5997
+ this.splitview.dispose();
5998
+ }
5999
+ dispose() {
6000
+ for (const [_, value] of this._panels.entries()) {
6001
+ value.disposable.dispose();
6002
+ value.value.dispose();
6023
6003
  }
6024
- containerApi.movePanel(fromIndex, toIndex);
6004
+ this._panels.clear();
6005
+ this.splitview.dispose();
6006
+ super.dispose();
6025
6007
  }
6026
6008
  }
6027
6009
 
@@ -6164,7 +6146,7 @@
6164
6146
  this.addDisposables(this._disposable);
6165
6147
  }
6166
6148
  focus() {
6167
- //
6149
+ //noop
6168
6150
  }
6169
6151
  updateOptions(options) {
6170
6152
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -6483,7 +6465,10 @@
6483
6465
  * require a key property like any other React element rendered in an array
6484
6466
  * to prevent excessive re-rendering
6485
6467
  */
6486
- const uniquePortalKeyGenerator = sequentialNumberGenerator();
6468
+ const uniquePortalKeyGenerator = (() => {
6469
+ let value = 1;
6470
+ return { next: () => `dockview_react_portal_key_${(value++).toString()}` };
6471
+ })();
6487
6472
  const ReactPartContext = React__namespace.createContext({});
6488
6473
  class ReactPart {
6489
6474
  constructor(parent, portalStore, component, parameters, context) {
@@ -6600,18 +6585,10 @@
6600
6585
  containerApi: parameters.containerApi,
6601
6586
  });
6602
6587
  }
6603
- toJSON() {
6604
- return {
6605
- id: this.id,
6606
- };
6607
- }
6608
6588
  update(event) {
6609
6589
  var _a;
6610
6590
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6611
6591
  }
6612
- updateParentGroup(group, _isPanelVisible) {
6613
- this._group = group;
6614
- }
6615
6592
  layout(_width, _height) {
6616
6593
  // noop
6617
6594
  }
@@ -6648,60 +6625,15 @@
6648
6625
  var _a;
6649
6626
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6650
6627
  }
6651
- toJSON() {
6652
- if (this.id === DEFAULT_TAB_IDENTIFIER) {
6653
- return {};
6654
- }
6655
- return {
6656
- id: this.id,
6657
- };
6658
- }
6659
6628
  layout(_width, _height) {
6660
6629
  // noop - retrieval from api
6661
6630
  }
6662
- updateParentGroup(_group, _isPanelVisible) {
6663
- // noop - retrieval from api
6664
- }
6665
6631
  dispose() {
6666
6632
  var _a;
6667
6633
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
6668
6634
  }
6669
6635
  }
6670
6636
 
6671
- class ReactPanelDeserialzier {
6672
- constructor(layout) {
6673
- this.layout = layout;
6674
- }
6675
- fromJSON(panelData, group) {
6676
- var _a, _b, _c, _d;
6677
- const panelId = panelData.id;
6678
- const params = panelData.params;
6679
- const title = panelData.title;
6680
- const viewData = panelData.view;
6681
- let tab;
6682
- if ((_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id) {
6683
- tab = createComponent(viewData.tab.id, viewData.tab.id, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_b = this.layout.options.frameworkComponentFactory) === null || _b === void 0 ? void 0 : _b.tab, () => new DefaultTab());
6684
- }
6685
- else if (this.layout.options.defaultTabComponent) {
6686
- tab = createComponent(this.layout.options.defaultTabComponent, this.layout.options.defaultTabComponent, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_c = this.layout.options.frameworkComponentFactory) === null || _c === void 0 ? void 0 : _c.tab, () => new DefaultTab());
6687
- }
6688
- else {
6689
- tab = new DefaultTab();
6690
- }
6691
- const view = new DefaultGroupPanelView({
6692
- content: createComponent(viewData.content.id, viewData.content.id, this.layout.options.components, this.layout.options.frameworkComponents, (_d = this.layout.options.frameworkComponentFactory) === null || _d === void 0 ? void 0 : _d.content),
6693
- tab,
6694
- });
6695
- const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6696
- panel.init({
6697
- view,
6698
- title,
6699
- params: params || {},
6700
- });
6701
- return panel;
6702
- }
6703
- }
6704
-
6705
6637
  class ReactWatermarkPart {
6706
6638
  get element() {
6707
6639
  return this._element;
@@ -6710,21 +6642,16 @@
6710
6642
  this.id = id;
6711
6643
  this.component = component;
6712
6644
  this.reactPortalStore = reactPortalStore;
6713
- this._groupRef = {
6714
- value: undefined,
6715
- };
6716
6645
  this._element = document.createElement('div');
6717
6646
  this._element.className = 'dockview-react-part';
6718
6647
  }
6719
6648
  init(parameters) {
6720
- this.parameters = parameters;
6721
6649
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6722
- params: parameters.params,
6723
- api: parameters.api,
6650
+ group: parameters.group,
6724
6651
  containerApi: parameters.containerApi,
6725
6652
  close: () => {
6726
- if (this._groupRef.value) {
6727
- parameters.containerApi.removeGroup(this._groupRef.value);
6653
+ if (parameters.group) {
6654
+ parameters.containerApi.removeGroup(parameters.group);
6728
6655
  }
6729
6656
  },
6730
6657
  });
@@ -6739,17 +6666,11 @@
6739
6666
  }
6740
6667
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: ((_b = this.parameters) === null || _b === void 0 ? void 0 : _b.params) || {} });
6741
6668
  }
6742
- toJSON() {
6743
- return {
6744
- id: this.id,
6745
- };
6746
- }
6747
6669
  layout(_width, _height) {
6748
6670
  // noop - retrieval from api
6749
6671
  }
6750
- updateParentGroup(group, _isPanelVisible) {
6751
- // noop - retrieval from api
6752
- this._groupRef.value = group;
6672
+ updateParentGroup(_group, _isPanelVisible) {
6673
+ // noop
6753
6674
  }
6754
6675
  dispose() {
6755
6676
  var _a;
@@ -6831,6 +6752,7 @@
6831
6752
  }
6832
6753
  : undefined;
6833
6754
  }
6755
+ const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
6834
6756
  const DockviewReact = React__namespace.forwardRef((props, ref) => {
6835
6757
  const domRef = React__namespace.useRef(null);
6836
6758
  const dockviewRef = React__namespace.useRef();
@@ -6877,13 +6799,20 @@
6877
6799
  },
6878
6800
  };
6879
6801
  const element = document.createElement('div');
6802
+ const frameworkTabComponents = props.tabComponents || {};
6803
+ if (props.defaultTabComponent) {
6804
+ frameworkTabComponents[DEFAULT_REACT_TAB] =
6805
+ props.defaultTabComponent;
6806
+ }
6880
6807
  const dockview = new DockviewComponent(element, {
6881
6808
  frameworkComponentFactory: factory,
6882
6809
  frameworkComponents: props.components,
6883
- frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6810
+ frameworkTabComponents,
6884
6811
  tabHeight: props.tabHeight,
6885
6812
  watermarkFrameworkComponent: props.watermarkComponent,
6886
- defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6813
+ defaultTabComponent: props.defaultTabComponent
6814
+ ? DEFAULT_REACT_TAB
6815
+ : undefined,
6887
6816
  styles: props.hideBorders
6888
6817
  ? { separatorBorder: 'transparent' }
6889
6818
  : undefined,
@@ -6892,7 +6821,6 @@
6892
6821
  singleTabMode: props.singleTabMode,
6893
6822
  });
6894
6823
  (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
6895
- dockview.deserializer = new ReactPanelDeserialzier(dockview);
6896
6824
  const { clientWidth, clientHeight } = domRef.current;
6897
6825
  dockview.layout(clientWidth, clientHeight);
6898
6826
  if (props.onReady) {
@@ -6955,9 +6883,16 @@
6955
6883
  if (!dockviewRef.current) {
6956
6884
  return;
6957
6885
  }
6886
+ const frameworkTabComponents = props.tabComponents || {};
6887
+ if (props.defaultTabComponent) {
6888
+ frameworkTabComponents[DEFAULT_REACT_TAB] =
6889
+ props.defaultTabComponent;
6890
+ }
6958
6891
  dockviewRef.current.updateOptions({
6959
- defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6960
- frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6892
+ defaultTabComponent: props.defaultTabComponent
6893
+ ? DEFAULT_REACT_TAB
6894
+ : undefined,
6895
+ frameworkTabComponents,
6961
6896
  });
6962
6897
  }, [props.defaultTabComponent]);
6963
6898
  React__namespace.useEffect(() => {
@@ -7102,7 +7037,7 @@
7102
7037
 
7103
7038
  class ReactGridPanelView extends GridviewPanel {
7104
7039
  constructor(id, component, reactComponent, reactPortalStore) {
7105
- super(id, component, new GridviewPanelApiImpl(id));
7040
+ super(id, component);
7106
7041
  this.reactComponent = reactComponent;
7107
7042
  this.reactPortalStore = reactPortalStore;
7108
7043
  }
@@ -7312,16 +7247,24 @@
7312
7247
 
7313
7248
  exports.BaseGrid = BaseGrid;
7314
7249
  exports.ContentContainer = ContentContainer;
7250
+ exports.DefaultDockviewDeserialzier = DefaultDockviewDeserialzier;
7251
+ exports.DefaultTab = DefaultTab;
7315
7252
  exports.DockviewApi = DockviewApi;
7316
7253
  exports.DockviewComponent = DockviewComponent;
7254
+ exports.DockviewCompositeDisposable = CompositeDisposable;
7317
7255
  exports.DockviewDefaultTab = DockviewDefaultTab;
7256
+ exports.DockviewEmitter = Emitter;
7257
+ exports.DockviewGroupPanel = DockviewGroupPanel;
7258
+ exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
7259
+ exports.DockviewMutableDisposable = MutableDisposable;
7260
+ exports.DockviewPanel = DockviewPanel;
7318
7261
  exports.DockviewReact = DockviewReact;
7262
+ exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
7319
7263
  exports.Gridview = Gridview;
7320
7264
  exports.GridviewApi = GridviewApi;
7321
7265
  exports.GridviewComponent = GridviewComponent;
7322
7266
  exports.GridviewPanel = GridviewPanel;
7323
7267
  exports.GridviewReact = GridviewReact;
7324
- exports.Groupview = Groupview;
7325
7268
  exports.LocalSelectionTransfer = LocalSelectionTransfer;
7326
7269
  exports.PaneFramework = PaneFramework;
7327
7270
  exports.PaneTransfer = PaneTransfer;
@@ -7339,6 +7282,7 @@
7339
7282
  exports.SplitviewPanel = SplitviewPanel;
7340
7283
  exports.SplitviewReact = SplitviewReact;
7341
7284
  exports.Tab = Tab;
7285
+ exports.createComponent = createComponent;
7342
7286
  exports.directionToPosition = directionToPosition;
7343
7287
  exports.getDirectionOrientation = getDirectionOrientation;
7344
7288
  exports.getGridLocation = getGridLocation;
@@ -7357,5 +7301,6 @@
7357
7301
  exports.positionToDirection = positionToDirection;
7358
7302
  exports.toTarget = toTarget;
7359
7303
  exports.usePortalsLifecycle = usePortalsLifecycle;
7304
+ exports.watchElementResize = watchElementResize;
7360
7305
 
7361
7306
  }));