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
  */
@@ -34,7 +34,7 @@ function styleInject(css, ref) {
34
34
  }
35
35
  }
36
36
 
37
- var css_248z = ".dockview-svg {\n display: inline-block;\n fill: currentcolor;\n line-height: 1;\n stroke: currentcolor;\n stroke-width: 0;\n}\n.dockview-theme-dark {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-group-view-background-color: #1e1e1e;\n --dv-tabs-and-actions-container-background-color: #252526;\n --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-tab-divider-color: #1e1e1e;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: #969696;\n --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;\n --dv-inactivegroup-hiddenpanel-tab-color: #626262;\n --dv-separator-border: rgb(68, 68, 68);\n --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);\n}\n\n.dockview-theme-light {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-group-view-background-color: white;\n --dv-tabs-and-actions-container-background-color: #f3f3f3;\n --dv-activegroup-visiblepanel-tab-background-color: white;\n --dv-activegroup-hiddenpanel-tab-background-color: #ececec;\n --dv-inactivegroup-visiblepanel-tab-background-color: white;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;\n --dv-tab-divider-color: white;\n --dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);\n --dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.7);\n --dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, 0.7);\n --dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.35);\n --dv-separator-border: rgba(128, 128, 128, 0.35);\n --dv-paneview-header-border-color: rgb(51, 51, 51);\n}\n\n.dockview-theme-vs {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-group-view-background-color: #1e1e1e;\n --dv-tabs-and-actions-container-background-color: #252526;\n --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-tab-divider-color: #1e1e1e;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: #969696;\n --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;\n --dv-inactivegroup-hiddenpanel-tab-color: #626262;\n --dv-separator-border: rgb(68, 68, 68);\n --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);\n --dv-tabs-and-actions-container-background-color: #2d2d30;\n --dv-tabs-and-actions-container-height: 20px;\n --dv-tabs-and-actions-container-font-size: 11px;\n --dv-activegroup-visiblepanel-tab-background-color: #007acc;\n --dv-inactivegroup-visiblepanel-tab-background-color: #3f3f46;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: white;\n --dv-inactivegroup-visiblepanel-tab-color: white;\n --dv-inactivegroup-hiddenpanel-tab-color: white;\n}\n.dockview-theme-vs .groupview.active-group > .tabs-and-actions-container {\n box-sizing: content-box;\n border-bottom: 2px solid var(--dv-activegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .groupview.active-group > .tabs-and-actions-container .tab.active-tab {\n border-top: 2px solid var(--dv-activegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .groupview.active-group > .tabs-and-actions-container .tab.inactive-tab {\n border-top: 2px solid var(--dv-activegroup-hiddenpanel-tab-background-color);\n}\n.dockview-theme-vs .groupview.inactive-group > .tabs-and-actions-container {\n box-sizing: content-box;\n border-bottom: 2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .groupview.inactive-group > .tabs-and-actions-container .tab.active-tab {\n border-top: 2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .groupview.inactive-group > .tabs-and-actions-container .tab.inactive-tab {\n border-top: 2px solid var(--dv-inactivegroup-hiddenpanel-tab-background-color);\n}\n\n.dockview-theme-abyss {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-group-view-background-color: #000c18;\n --dv-tabs-and-actions-container-background-color: #1c1c2a;\n --dv-activegroup-visiblepanel-tab-background-color: #000c18;\n --dv-activegroup-hiddenpanel-tab-background-color: #10192c;\n --dv-inactivegroup-visiblepanel-tab-background-color: #000c18;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #10192c;\n --dv-tab-divider-color: #2b2b4a;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: rgba(255, 255, 255, 0.5);\n --dv-inactivegroup-visiblepanel-tab-color: rgba(255, 255, 255, 0.5);\n --dv-inactivegroup-hiddenpanel-tab-color: rgba(255, 255, 255, 0.25);\n --dv-separator-border: #2b2b4a;\n --dv-paneview-header-border-color: #2b2b4a;\n --dv-paneview-active-outline-color: #596f99;\n}\n\n.dockview-theme-dracula {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: white;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-group-view-background-color: #282a36;\n --dv-tabs-and-actions-container-background-color: #191a21;\n --dv-activegroup-visiblepanel-tab-background-color: #282a36;\n --dv-activegroup-hiddenpanel-tab-background-color: #21222c;\n --dv-inactivegroup-visiblepanel-tab-background-color: #282a36;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #21222c;\n --dv-tab-divider-color: #191a21;\n --dv-activegroup-visiblepanel-tab-color: rgb(248, 248, 242);\n --dv-activegroup-hiddenpanel-tab-color: rgb(98, 114, 164);\n --dv-inactivegroup-visiblepanel-tab-color: rgba(248, 248, 242, 0.5);\n --dv-inactivegroup-hiddenpanel-tab-color: rgba(98, 114, 164, 0.5);\n --dv-separator-border: #bd93f9;\n --dv-paneview-header-border-color: #bd93f9;\n --dv-paneview-active-outline-color: #6272a4;\n}\n.dockview-theme-dracula .groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab {\n position: relative;\n}\n.dockview-theme-dracula .groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab::after {\n position: absolute;\n left: 0px;\n top: 0px;\n content: \"\";\n width: 100%;\n height: 1px;\n background-color: #94527e;\n z-index: 999;\n}\n.dockview-theme-dracula .groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab {\n position: relative;\n}\n.dockview-theme-dracula .groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab::after {\n position: absolute;\n left: 0px;\n bottom: 0px;\n content: \"\";\n width: 100%;\n height: 1px;\n background-color: #5e3d5a;\n z-index: 999;\n}\n.actions-bar {\n text-align: right;\n width: 28px;\n display: flex;\n align-items: center;\n flex-shrink: 0;\n}\n.actions-bar .actions-container {\n display: flex;\n padding: 0px;\n margin: 0px;\n justify-content: flex-end;\n}\n.actions-bar .actions-container .close-action {\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n cursor: pointer;\n color: var(--dv-activegroup-hiddenpanel-tab-color);\n}\n.actions-bar .actions-container .close-action:hover {\n border-radius: 2px;\n background-color: var(--dv-icon-hover-background-color);\n}\n.drop-target {\n position: relative;\n}\n.drop-target > .drop-target-dropzone {\n position: absolute;\n left: 0px;\n top: 0px;\n height: 100%;\n width: 100%;\n z-index: 10000;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection {\n position: relative;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n background-color: var(--dv-drag-over-background-color);\n transition: top 70ms ease-out, left 70ms ease-out, width 70ms ease-out, height 70ms ease-out, opacity 0.15s ease-out;\n will-change: transform;\n pointer-events: none;\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-top {\n border-top: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-bottom {\n border-bottom: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-left {\n border-left: 1px solid var(--dv-drag-over-border-color);\n}\n.drop-target > .drop-target-dropzone > .drop-target-selection.small-right {\n border-right: 1px solid var(--dv-drag-over-border-color);\n}\n.dv-dockview {\n position: relative;\n background-color: var(--dv-group-view-background-color);\n}\n.dv-dockview .dv-watermark-container {\n position: absolute;\n top: 0px;\n left: 0px;\n height: 100%;\n width: 100%;\n}\n\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.groupview.active-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab {\n background-color: var(--dv-activegroup-hiddenpanel-tab-background-color);\n color: var(--dv-activegroup-hiddenpanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.active-tab {\n background-color: var(--dv-inactivegroup-visiblepanel-tab-background-color);\n color: var(--dv-inactivegroup-visiblepanel-tab-color);\n}\n.groupview.inactive-group > .tabs-and-actions-container > .tabs-container > .tab.inactive-tab {\n background-color: var(--dv-inactivegroup-hiddenpanel-tab-background-color);\n color: var(--dv-inactivegroup-hiddenpanel-tab-color);\n}\n\n/**\n * when a tab is dragged we lose the above stylings because they are conditional on parent elements\n * therefore we also set some stylings for the dragging event\n **/\n.tab.dv-tab-dragging {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.grid-view,\n.branch-node {\n height: 100%;\n width: 100%;\n}\n.groupview {\n display: flex;\n flex-direction: column;\n height: 100%;\n background-color: var(--dv-group-view-background-color);\n overflow: hidden;\n}\n.groupview:focus {\n outline: none;\n}\n.groupview.empty > .tabs-and-actions-container {\n display: none;\n}\n.groupview > .content-container {\n flex-grow: 1;\n overflow: hidden;\n outline: none;\n}\n.pane-container {\n height: 100%;\n width: 100%;\n}\n.pane-container.animated .view {\n transition-duration: 0.15s;\n transition-timing-function: ease-out;\n}\n.pane-container .view {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n padding: 0px !important;\n}\n.pane-container .view:not(:first-child)::before {\n background-color: transparent !important;\n}\n.pane-container .view:not(:first-child) .pane > .pane-header {\n border-top: 1px solid var(--dv-paneview-header-border-color);\n}\n.pane-container .view .default-header {\n background-color: var(--dv-group-view-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n display: flex;\n padding: 0px 8px;\n cursor: pointer;\n}\n.pane-container .view .default-header .dockview-pane-header-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.pane-container .view .default-header > span {\n padding-left: 8px;\n flex-grow: 1;\n}\n.pane-container:first-of-type > .pane > .pane-header {\n border-top: none !important;\n}\n.pane-container .pane {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n height: 100%;\n}\n.pane-container .pane .pane-header {\n box-sizing: border-box;\n user-select: none;\n position: relative;\n outline: none;\n}\n.pane-container .pane .pane-header.pane-draggable {\n cursor: pointer;\n}\n.pane-container .pane .pane-header:focus:before, .pane-container .pane .pane-header:focus-within:before {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 5;\n content: \"\";\n pointer-events: none;\n outline: 1px solid;\n outline-width: -1px;\n outline-style: solid;\n outline-offset: -1px;\n outline-color: var(--dv-paneview-active-outline-color);\n}\n.pane-container .pane .pane-body {\n overflow-y: auto;\n overflow-x: hidden;\n flex-grow: 1;\n position: relative;\n outline: none;\n}\n.pane-container .pane .pane-body:focus:before, .pane-container .pane .pane-body:focus-within:before {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 5;\n content: \"\";\n pointer-events: none;\n outline: 1px solid;\n outline-width: -1px;\n outline-style: solid;\n outline-offset: -1px;\n outline-color: var(--dv-paneview-active-outline-color);\n}\n.tabs-and-actions-container {\n display: flex;\n background-color: var(--dv-tabs-and-actions-container-background-color);\n flex-shrink: 0;\n box-sizing: border-box;\n height: var(--dv-tabs-and-actions-container-height);\n font-size: var(--dv-tabs-and-actions-container-font-size);\n}\n.tabs-and-actions-container.hidden {\n display: none;\n}\n.tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .tabs-container {\n flex-grow: 1;\n}\n.tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .tabs-container .tab {\n flex-grow: 1;\n}\n.tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .void-container {\n flex-grow: 0;\n}\n.tabs-and-actions-container .void-container {\n display: flex;\n flex-grow: 1;\n cursor: grab;\n}\n.tabs-and-actions-container .tabs-container {\n display: flex;\n overflow-x: overlay;\n overflow-y: hidden;\n scrollbar-width: thin;\n /* Track */\n /* Handle */\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar {\n height: 3px;\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar-track {\n background: transparent;\n}\n.tabs-and-actions-container .tabs-container::-webkit-scrollbar-thumb {\n background: var(--dv-tabs-container-scrollbar-color);\n}\n.tabs-and-actions-container .tabs-container .tab {\n -webkit-user-drag: element;\n outline: none;\n min-width: 75px;\n cursor: pointer;\n position: relative;\n box-sizing: border-box;\n}\n.tabs-and-actions-container .tabs-container .tab:not(:first-child)::before {\n content: \" \";\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n pointer-events: none;\n background-color: var(--dv-tab-divider-color);\n width: 1px;\n height: 100%;\n}\n.tab .dockview-react-tab {\n display: flex;\n padding: 0px 8px;\n align-items: center;\n height: 100%;\n}\n.tab .dockview-react-tab .dockview-react-tab-title {\n padding: 0px 8px;\n flex-grow: 1;\n}\n.tab .dockview-react-tab .dockview-react-tab-action {\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n.tab .dockview-react-tab .dockview-react-tab-action:hover {\n border-radius: 2px;\n background-color: var(--dv-icon-hover-background-color);\n}\n.tab.inactive-tab:not(:hover) .dockview-react-tab-action {\n visibility: hidden;\n}\n.dockview-react-part {\n height: 100%;\n width: 100%;\n}\n.split-view-container {\n position: relative;\n overflow: hidden;\n height: 100%;\n width: 100%;\n}\n.split-view-container.animation .view,\n.split-view-container.animation .sash {\n transition-duration: 0.15s;\n transition-timing-function: ease-out;\n}\n.split-view-container.horizontal {\n height: 100%;\n}\n.split-view-container.horizontal > .sash-container > .sash {\n height: 100%;\n width: 4px;\n}\n.split-view-container.horizontal > .sash-container > .sash.enabled {\n cursor: ew-resize;\n}\n.split-view-container.horizontal > .sash-container > .sash.disabled {\n cursor: default;\n}\n.split-view-container.horizontal > .sash-container > .sash.maximum {\n cursor: w-resize;\n}\n.split-view-container.horizontal > .sash-container > .sash.minimum {\n cursor: e-resize;\n}\n.split-view-container.horizontal > .view-container > .view:not(:first-child)::before {\n height: 100%;\n width: 1px;\n}\n.split-view-container.vertical {\n width: 100%;\n}\n.split-view-container.vertical > .sash-container > .sash {\n width: 100%;\n height: 4px;\n}\n.split-view-container.vertical > .sash-container > .sash.enabled {\n cursor: ns-resize;\n}\n.split-view-container.vertical > .sash-container > .sash.disabled {\n cursor: default;\n}\n.split-view-container.vertical > .sash-container > .sash.maximum {\n cursor: n-resize;\n}\n.split-view-container.vertical > .sash-container > .sash.minimum {\n cursor: s-resize;\n}\n.split-view-container.vertical > .view-container > .view {\n width: 100%;\n}\n.split-view-container.vertical > .view-container > .view:not(:first-child)::before {\n height: 1px;\n width: 100%;\n}\n.split-view-container .sash-container {\n height: 100%;\n width: 100%;\n position: absolute;\n}\n.split-view-container .sash-container .sash {\n position: absolute;\n z-index: 99;\n outline: none;\n}\n.split-view-container .sash-container .sash:active {\n transition: background-color 0.1s ease-in-out;\n background-color: var(--dv-active-sash-color, transparent);\n}\n.split-view-container .sash-container .sash:hover {\n background-color: var(--dv-active-sash-color, transparent);\n transition: background-color 0.1s ease-in-out;\n transition-delay: 0.5s;\n}\n.split-view-container .view-container {\n position: relative;\n height: 100%;\n width: 100%;\n}\n.split-view-container .view-container .view {\n height: 100%;\n box-sizing: border-box;\n overflow: auto;\n position: absolute;\n}\n.split-view-container.separator-border .view:not(:first-child)::before {\n content: \" \";\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n pointer-events: none;\n background-color: var(--dv-separator-border);\n}\n.dv-dragged {\n transform: translate3d(0px, 0px, 0px); /* forces tab to be drawn on a separate layer (see https://github.com/microsoft/vscode/issues/18733) */\n}\n\n.tab {\n flex-shrink: 0;\n}\n.tab.dv-tab-dragging .tab-action {\n background-color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.tab.active-tab > .default-tab .tab-action {\n visibility: visible;\n}\n.tab.inactive-tab > .default-tab .tab-action {\n visibility: hidden;\n}\n.tab.inactive-tab > .default-tab:hover .tab-action {\n visibility: visible;\n}\n.tab .default-tab {\n position: relative;\n height: 100%;\n display: flex;\n min-width: 80px;\n align-items: center;\n padding: 0px 8px;\n white-space: nowrap;\n text-overflow: elipsis;\n}\n.tab .default-tab .tab-content {\n padding: 0px 8px;\n flex-grow: 1;\n}\n.tab .default-tab .action-container {\n text-align: right;\n display: flex;\n}\n.tab .default-tab .action-container .tab-list {\n display: flex;\n padding: 0px;\n margin: 0px;\n justify-content: flex-end;\n}\n.tab .default-tab .action-container .tab-list .tab-action {\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n.tab .default-tab .action-container .tab-list .tab-action:hover {\n border-radius: 2px;\n background-color: var(--dv-icon-hover-background-color);\n}\n.watermark {\n display: flex;\n width: 100%;\n}\n.watermark.has-actions .watermark-title .actions-bar {\n display: none;\n}\n.watermark .watermark-title {\n height: 35px;\n width: 100%;\n display: flex;\n}\n.watermark .watermark-content {\n flex-grow: 1;\n}";
37
+ var css_248z = "@import \"dockview-core/dist/styles/dockview.css\";\n.tab .dockview-react-tab {\n display: flex;\n padding: 0px 8px;\n align-items: center;\n height: 100%;\n}\n.tab .dockview-react-tab .dockview-react-tab-title {\n padding: 0px 8px;\n flex-grow: 1;\n}\n.tab .dockview-react-tab .dockview-react-tab-action {\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n.tab .dockview-react-tab .dockview-react-tab-action:hover {\n border-radius: 2px;\n background-color: var(--dv-icon-hover-background-color);\n}\n.tab.inactive-tab:not(:hover) .dockview-react-tab-action {\n visibility: hidden;\n}\n.dockview-react-part {\n height: 100%;\n width: 100%;\n}";
38
38
  styleInject(css_248z);
39
39
 
40
40
  class TransferObject {
@@ -348,16 +348,30 @@ class FocusTracker extends CompositeDisposable {
348
348
  }
349
349
  }
350
350
 
351
- const clamp = (value, min, max) => {
352
- if (min > max) {
353
- throw new Error(`${min} > ${max} is an invalid condition`);
351
+ function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
352
+ const Component = typeof componentName === 'string'
353
+ ? components[componentName]
354
+ : undefined;
355
+ const FrameworkComponent = typeof componentName === 'string'
356
+ ? frameworkComponents[componentName]
357
+ : undefined;
358
+ if (Component && FrameworkComponent) {
359
+ throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
354
360
  }
355
- return Math.min(max, Math.max(value, min));
356
- };
357
- const sequentialNumberGenerator = () => {
358
- let value = 1;
359
- return { next: () => (value++).toString() };
360
- };
361
+ if (FrameworkComponent) {
362
+ if (!createFrameworkComponent) {
363
+ throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
364
+ }
365
+ return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
366
+ }
367
+ if (!Component) {
368
+ if (fallback) {
369
+ return fallback();
370
+ }
371
+ throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
372
+ }
373
+ return new Component(id, componentName);
374
+ }
361
375
 
362
376
  function tail(arr) {
363
377
  if (arr.length === 0) {
@@ -399,6 +413,26 @@ function pushToEnd(arr, value) {
399
413
  arr.push(value);
400
414
  }
401
415
  }
416
+ function firstIndex(array, fn) {
417
+ for (let i = 0; i < array.length; i++) {
418
+ const element = array[i];
419
+ if (fn(element)) {
420
+ return i;
421
+ }
422
+ }
423
+ return -1;
424
+ }
425
+
426
+ const clamp = (value, min, max) => {
427
+ if (min > max) {
428
+ throw new Error(`${min} > ${max} is an invalid condition`);
429
+ }
430
+ return Math.min(max, Math.max(value, min));
431
+ };
432
+ const sequentialNumberGenerator = () => {
433
+ let value = 1;
434
+ return { next: () => (value++).toString() };
435
+ };
402
436
  const range = (from, to) => {
403
437
  const result = [];
404
438
  if (typeof to !== 'number') {
@@ -417,15 +451,6 @@ const range = (from, to) => {
417
451
  }
418
452
  return result;
419
453
  };
420
- function firstIndex(array, fn) {
421
- for (let i = 0; i < array.length; i++) {
422
- const element = array[i];
423
- if (fn(element)) {
424
- return i;
425
- }
426
- }
427
- return -1;
428
- }
429
454
 
430
455
  class ViewItem {
431
456
  set size(size) {
@@ -440,25 +465,6 @@ class ViewItem {
440
465
  get visible() {
441
466
  return typeof this._cachedVisibleSize === 'undefined';
442
467
  }
443
- setVisible(visible, size) {
444
- var _a;
445
- if (visible === this.visible) {
446
- return;
447
- }
448
- if (visible) {
449
- this.size = clamp((_a = this._cachedVisibleSize) !== null && _a !== void 0 ? _a : 0, this.viewMinimumSize, this.viewMaximumSize);
450
- this._cachedVisibleSize = undefined;
451
- }
452
- else {
453
- this._cachedVisibleSize =
454
- typeof size === 'number' ? size : this.size;
455
- this.size = 0;
456
- }
457
- this.container.classList.toggle('visible', visible);
458
- if (this.view.setVisible) {
459
- this.view.setVisible(visible);
460
- }
461
- }
462
468
  get minimumSize() {
463
469
  return this.visible ? this.view.minimumSize : 0;
464
470
  }
@@ -495,11 +501,25 @@ class ViewItem {
495
501
  this._cachedVisibleSize = size.cachedVisibleSize;
496
502
  }
497
503
  }
498
- // layout(offset: number, layoutContext: TLayoutContext | undefined): void {
499
- // this.layoutContainer(offset);
500
- // this.view.layout(this.size, offset, layoutContext);
501
- // }
502
- // abstract layoutContainer(offset: number): void;
504
+ setVisible(visible, size) {
505
+ var _a;
506
+ if (visible === this.visible) {
507
+ return;
508
+ }
509
+ if (visible) {
510
+ this.size = clamp((_a = this._cachedVisibleSize) !== null && _a !== void 0 ? _a : 0, this.viewMinimumSize, this.viewMaximumSize);
511
+ this._cachedVisibleSize = undefined;
512
+ }
513
+ else {
514
+ this._cachedVisibleSize =
515
+ typeof size === 'number' ? size : this.size;
516
+ this.size = 0;
517
+ }
518
+ this.container.classList.toggle('visible', visible);
519
+ if (this.view.setVisible) {
520
+ this.view.setVisible(visible);
521
+ }
522
+ }
503
523
  dispose() {
504
524
  this.disposable.dispose();
505
525
  return this.view;
@@ -608,14 +628,14 @@ class Splitview {
608
628
  this._orthogonalSize = 0;
609
629
  this.contentSize = 0;
610
630
  this._proportions = undefined;
631
+ this._startSnappingEnabled = true;
632
+ this._endSnappingEnabled = true;
611
633
  this._onDidSashEnd = new Emitter();
612
634
  this.onDidSashEnd = this._onDidSashEnd.event;
613
635
  this._onDidAddView = new Emitter();
614
636
  this.onDidAddView = this._onDidAddView.event;
615
637
  this._onDidRemoveView = new Emitter();
616
638
  this.onDidRemoveView = this._onDidRemoveView.event;
617
- this._startSnappingEnabled = true;
618
- this._endSnappingEnabled = true;
619
639
  this.resize = (index, delta, sizes = this.views.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
620
640
  if (index < 0 || index > this.views.length) {
621
641
  return 0;
@@ -1510,10 +1530,10 @@ class BranchNode extends CompositeDisposable {
1510
1530
  this.orientation = orientation;
1511
1531
  this.proportionalLayout = proportionalLayout;
1512
1532
  this.styles = styles;
1533
+ this._childrenDisposable = Disposable.NONE;
1513
1534
  this.children = [];
1514
1535
  this._onDidChange = new Emitter();
1515
1536
  this.onDidChange = this._onDidChange.event;
1516
- this._childrenDisposable = Disposable.NONE;
1517
1537
  this._orthogonalSize = orthogonalSize;
1518
1538
  this._size = size;
1519
1539
  this.element = document.createElement('div');
@@ -1772,6 +1792,35 @@ class Gridview {
1772
1792
  get length() {
1773
1793
  return this._root ? this._root.children.length : 0;
1774
1794
  }
1795
+ get orientation() {
1796
+ return this.root.orientation;
1797
+ }
1798
+ set orientation(orientation) {
1799
+ if (this.root.orientation === orientation) {
1800
+ return;
1801
+ }
1802
+ const { size, orthogonalSize } = this.root;
1803
+ this.root = flipNode(this.root, orthogonalSize, size);
1804
+ this.root.layout(size, orthogonalSize);
1805
+ }
1806
+ get width() {
1807
+ return this.root.width;
1808
+ }
1809
+ get height() {
1810
+ return this.root.height;
1811
+ }
1812
+ get minimumWidth() {
1813
+ return this.root.minimumWidth;
1814
+ }
1815
+ get minimumHeight() {
1816
+ return this.root.minimumHeight;
1817
+ }
1818
+ get maximumWidth() {
1819
+ return this.root.maximumHeight;
1820
+ }
1821
+ get maximumHeight() {
1822
+ return this.root.maximumHeight;
1823
+ }
1775
1824
  serialize() {
1776
1825
  const root = serializeBranchNode(this.getView(), this.orientation);
1777
1826
  return {
@@ -1818,17 +1867,6 @@ class Gridview {
1818
1867
  }
1819
1868
  return result;
1820
1869
  }
1821
- get orientation() {
1822
- return this.root.orientation;
1823
- }
1824
- set orientation(orientation) {
1825
- if (this.root.orientation === orientation) {
1826
- return;
1827
- }
1828
- const { size, orthogonalSize } = this.root;
1829
- this.root = flipNode(this.root, orthogonalSize, size);
1830
- this.root.layout(size, orthogonalSize);
1831
- }
1832
1870
  get root() {
1833
1871
  return this._root;
1834
1872
  }
@@ -1910,24 +1948,6 @@ class Gridview {
1910
1948
  }
1911
1949
  return findLeaf(this.root, reverse);
1912
1950
  }
1913
- get width() {
1914
- return this.root.width;
1915
- }
1916
- get height() {
1917
- return this.root.height;
1918
- }
1919
- get minimumWidth() {
1920
- return this.root.minimumWidth;
1921
- }
1922
- get minimumHeight() {
1923
- return this.root.minimumHeight;
1924
- }
1925
- get maximumWidth() {
1926
- return this.root.maximumHeight;
1927
- }
1928
- get maximumHeight() {
1929
- return this.root.maximumHeight;
1930
- }
1931
1951
  constructor(proportionalLayout, styles, orientation) {
1932
1952
  this.proportionalLayout = proportionalLayout;
1933
1953
  this.styles = styles;
@@ -2432,10 +2452,6 @@ class DragAndDropObserver extends CompositeDisposable {
2432
2452
  }
2433
2453
  }
2434
2454
 
2435
- function isBooleanValue(value) {
2436
- return typeof value === 'boolean';
2437
- }
2438
-
2439
2455
  function numberOrFallback(maybeNumber, fallback) {
2440
2456
  return typeof maybeNumber === 'number' ? maybeNumber : fallback;
2441
2457
  }
@@ -2500,7 +2516,7 @@ class Droptarget extends CompositeDisposable {
2500
2516
  this.removeDropTarget();
2501
2517
  return;
2502
2518
  }
2503
- if (isBooleanValue(this.options.canDisplayOverlay)) {
2519
+ if (typeof this.options.canDisplayOverlay === 'boolean') {
2504
2520
  if (!this.options.canDisplayOverlay) {
2505
2521
  return;
2506
2522
  }
@@ -2508,20 +2524,20 @@ class Droptarget extends CompositeDisposable {
2508
2524
  else if (!this.options.canDisplayOverlay(e, quadrant)) {
2509
2525
  return;
2510
2526
  }
2511
- if (!this.target) {
2512
- this.target = document.createElement('div');
2513
- this.target.className = 'drop-target-dropzone';
2514
- this.overlay = document.createElement('div');
2515
- this.overlay.className = 'drop-target-selection';
2527
+ if (!this.targetElement) {
2528
+ this.targetElement = document.createElement('div');
2529
+ this.targetElement.className = 'drop-target-dropzone';
2530
+ this.overlayElement = document.createElement('div');
2531
+ this.overlayElement.className = 'drop-target-selection';
2516
2532
  this._state = 'center';
2517
- this.target.appendChild(this.overlay);
2533
+ this.targetElement.appendChild(this.overlayElement);
2518
2534
  this.element.classList.add('drop-target');
2519
- this.element.append(this.target);
2535
+ this.element.append(this.targetElement);
2520
2536
  }
2521
2537
  if (this.options.acceptedTargetZones.length === 0) {
2522
2538
  return;
2523
2539
  }
2524
- if (!this.target || !this.overlay) {
2540
+ if (!this.targetElement || !this.overlayElement) {
2525
2541
  return;
2526
2542
  }
2527
2543
  this.toggleClasses(quadrant, width, height);
@@ -2535,10 +2551,12 @@ class Droptarget extends CompositeDisposable {
2535
2551
  },
2536
2552
  onDrop: (e) => {
2537
2553
  e.preventDefault();
2538
- e.stopPropagation();
2539
2554
  const state = this._state;
2540
2555
  this.removeDropTarget();
2541
2556
  if (state) {
2557
+ // only stop the propagation of the event if we are dealing with it
2558
+ // which is only when the target has state
2559
+ e.stopPropagation();
2542
2560
  this._onDrop.fire({ position: state, nativeEvent: e });
2543
2561
  }
2544
2562
  },
@@ -2549,7 +2567,7 @@ class Droptarget extends CompositeDisposable {
2549
2567
  }
2550
2568
  toggleClasses(quadrant, width, height) {
2551
2569
  var _a, _b, _c, _d;
2552
- if (!this.overlay) {
2570
+ if (!this.overlayElement) {
2553
2571
  return;
2554
2572
  }
2555
2573
  const isSmallX = width < 100;
@@ -2596,11 +2614,11 @@ class Droptarget extends CompositeDisposable {
2596
2614
  else {
2597
2615
  transform = '';
2598
2616
  }
2599
- this.overlay.style.transform = transform;
2600
- toggleClass(this.overlay, 'small-right', isSmallX && isRight);
2601
- toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
2602
- toggleClass(this.overlay, 'small-top', isSmallY && isTop);
2603
- toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
2617
+ this.overlayElement.style.transform = transform;
2618
+ toggleClass(this.overlayElement, 'small-right', isSmallX && isRight);
2619
+ toggleClass(this.overlayElement, 'small-left', isSmallX && isLeft);
2620
+ toggleClass(this.overlayElement, 'small-top', isSmallY && isTop);
2621
+ toggleClass(this.overlayElement, 'small-bottom', isSmallY && isBottom);
2604
2622
  }
2605
2623
  setState(quadrant) {
2606
2624
  switch (quadrant) {
@@ -2632,11 +2650,11 @@ class Droptarget extends CompositeDisposable {
2632
2650
  return calculateQuadrantAsPixels(overlayType, x, y, width, height, value);
2633
2651
  }
2634
2652
  removeDropTarget() {
2635
- if (this.target) {
2653
+ if (this.targetElement) {
2636
2654
  this._state = undefined;
2637
- this.element.removeChild(this.target);
2638
- this.target = undefined;
2639
- this.overlay = undefined;
2655
+ this.element.removeChild(this.targetElement);
2656
+ this.targetElement = undefined;
2657
+ this.overlayElement = undefined;
2640
2658
  this.element.classList.remove('drop-target');
2641
2659
  }
2642
2660
  }
@@ -2783,6 +2801,16 @@ class DragHandler extends CompositeDisposable {
2783
2801
  this.disposable.value = this.getData(event.dataTransfer);
2784
2802
  if (event.dataTransfer) {
2785
2803
  event.dataTransfer.effectAllowed = 'move';
2804
+ /**
2805
+ * Although this is not used by dockview many third party dnd libraries will check
2806
+ * dataTransfer.types to determine valid drag events.
2807
+ *
2808
+ * For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
2809
+ * through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
2810
+ * dnd logic. You can see the code at
2811
+ * https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
2812
+ */
2813
+ event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
2786
2814
  }
2787
2815
  }), addDisposableListener(this.el, 'dragend', () => {
2788
2816
  for (const iframe of this.iframes) {
@@ -2888,6 +2916,7 @@ function addGhostImage(dataTransfer, ghostElement) {
2888
2916
  document.body.appendChild(ghostElement);
2889
2917
  dataTransfer.setDragImage(ghostElement, 0, 0);
2890
2918
  setTimeout(() => {
2919
+ removeClasses(ghostElement, 'dv-dragged');
2891
2920
  ghostElement.remove();
2892
2921
  }, 0);
2893
2922
  }
@@ -3023,10 +3052,6 @@ class TabsContainer extends CompositeDisposable {
3023
3052
  return (this.selectedIndex > -1 &&
3024
3053
  this.tabs[this.selectedIndex].value === tab);
3025
3054
  }
3026
- at(index) {
3027
- var _a;
3028
- return (_a = this.tabs[index]) === null || _a === void 0 ? void 0 : _a.value;
3029
- }
3030
3055
  indexOf(id) {
3031
3056
  return this.tabs.findIndex((tab) => tab.value.panelId === id);
3032
3057
  }
@@ -3148,7 +3173,7 @@ class TabsContainer extends CompositeDisposable {
3148
3173
  }
3149
3174
  }
3150
3175
 
3151
- class Groupview extends CompositeDisposable {
3176
+ class DockviewGroupPanelModel extends CompositeDisposable {
3152
3177
  get element() {
3153
3178
  throw new Error('not supported');
3154
3179
  }
@@ -3174,18 +3199,6 @@ class Groupview extends CompositeDisposable {
3174
3199
  get isEmpty() {
3175
3200
  return this._panels.length === 0;
3176
3201
  }
3177
- get minimumHeight() {
3178
- return 100;
3179
- }
3180
- get maximumHeight() {
3181
- return Number.MAX_SAFE_INTEGER;
3182
- }
3183
- get minimumWidth() {
3184
- return 100;
3185
- }
3186
- get maximumWidth() {
3187
- return Number.MAX_SAFE_INTEGER;
3188
- }
3189
3202
  get hasWatermark() {
3190
3203
  return !!(this.watermark && this.container.contains(this.watermark.element));
3191
3204
  }
@@ -3358,8 +3371,8 @@ class Groupview extends CompositeDisposable {
3358
3371
  //noop
3359
3372
  }
3360
3373
  focus() {
3361
- var _a;
3362
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
3374
+ var _a, _b;
3375
+ (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3363
3376
  }
3364
3377
  openPanel(panel, options = {}) {
3365
3378
  if (typeof options.index !== 'number' ||
@@ -3420,10 +3433,10 @@ class Groupview extends CompositeDisposable {
3420
3433
  this.tabsContainer.setActionElement(element);
3421
3434
  }
3422
3435
  setActive(isGroupActive, skipFocus = false, force = false) {
3423
- var _a, _b;
3436
+ var _a, _b, _c, _d;
3424
3437
  if (!force && this.isActive === isGroupActive) {
3425
3438
  if (!skipFocus) {
3426
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
3439
+ (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3427
3440
  }
3428
3441
  return;
3429
3442
  }
@@ -3437,7 +3450,7 @@ class Groupview extends CompositeDisposable {
3437
3450
  this.updateContainer();
3438
3451
  if (isGroupActive) {
3439
3452
  if (!skipFocus) {
3440
- (_b = this._activePanel) === null || _b === void 0 ? void 0 : _b.focus();
3453
+ (_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
3441
3454
  }
3442
3455
  }
3443
3456
  }
@@ -3508,15 +3521,14 @@ class Groupview extends CompositeDisposable {
3508
3521
  this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
3509
3522
  }
3510
3523
  updateContainer() {
3524
+ var _a, _b;
3511
3525
  toggleClass(this.container, 'empty', this.isEmpty);
3512
3526
  this.panels.forEach((panel) => panel.updateParentGroup(this.groupPanel, this.isActive));
3513
3527
  if (this.isEmpty && !this.watermark) {
3514
3528
  const watermark = this.accessor.createWatermarkComponent();
3515
3529
  watermark.init({
3516
3530
  containerApi: new DockviewApi(this.accessor),
3517
- params: {},
3518
- title: '',
3519
- api: null,
3531
+ group: this.groupPanel,
3520
3532
  });
3521
3533
  this.watermark = watermark;
3522
3534
  addDisposableListener(this.watermark.element, 'click', () => {
@@ -3530,7 +3542,7 @@ class Groupview extends CompositeDisposable {
3530
3542
  }
3531
3543
  if (!this.isEmpty && this.watermark) {
3532
3544
  this.watermark.element.remove();
3533
- this.watermark.dispose();
3545
+ (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
3534
3546
  this.watermark = undefined;
3535
3547
  this.tabsContainer.show();
3536
3548
  }
@@ -3590,9 +3602,9 @@ class Groupview extends CompositeDisposable {
3590
3602
  }
3591
3603
  }
3592
3604
  dispose() {
3593
- var _a;
3605
+ var _a, _b;
3594
3606
  super.dispose();
3595
- (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.dispose();
3607
+ (_b = (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
3596
3608
  for (const panel of this.panels) {
3597
3609
  panel.dispose();
3598
3610
  }
@@ -3713,19 +3725,20 @@ class BaseGrid extends CompositeDisposable {
3713
3725
  return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
3714
3726
  }
3715
3727
  doSetGroupActive(group, skipFocus) {
3728
+ var _a, _b, _c;
3716
3729
  if (this._activeGroup === group) {
3717
3730
  return;
3718
3731
  }
3719
3732
  if (this._activeGroup) {
3720
3733
  this._activeGroup.setActive(false);
3721
3734
  if (!skipFocus) {
3722
- this._activeGroup.focus();
3735
+ (_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3723
3736
  }
3724
3737
  }
3725
3738
  if (group) {
3726
3739
  group.setActive(true);
3727
3740
  if (!skipFocus) {
3728
- group.focus();
3741
+ (_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
3729
3742
  }
3730
3743
  }
3731
3744
  this._activeGroup = group;
@@ -3786,31 +3799,6 @@ class BaseGrid extends CompositeDisposable {
3786
3799
  }
3787
3800
  }
3788
3801
 
3789
- function isPanelOptionsWithPanel(data) {
3790
- if (data.referencePanel) {
3791
- return true;
3792
- }
3793
- return false;
3794
- }
3795
- function isPanelOptionsWithGroup(data) {
3796
- if (data.referenceGroup) {
3797
- return true;
3798
- }
3799
- return false;
3800
- }
3801
- function isGroupOptionsWithPanel(data) {
3802
- if (data.referencePanel) {
3803
- return true;
3804
- }
3805
- return false;
3806
- }
3807
- function isGroupOptionsWithGroup(data) {
3808
- if (data.referenceGroup) {
3809
- return true;
3810
- }
3811
- return false;
3812
- }
3813
-
3814
3802
  /**
3815
3803
  * A core api implementation that should be used across all panel-like objects
3816
3804
  */
@@ -3905,21 +3893,21 @@ class PanelApiImpl extends CompositeDisposable {
3905
3893
  }
3906
3894
  }
3907
3895
 
3908
- class GridviewPanelApiImpl extends PanelApiImpl {
3909
- constructor(id, panel) {
3896
+ class SplitviewPanelApiImpl extends PanelApiImpl {
3897
+ //
3898
+ constructor(id) {
3910
3899
  super(id);
3911
3900
  this._onDidConstraintsChangeInternal = new Emitter();
3912
3901
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
3902
+ //
3913
3903
  this._onDidConstraintsChange = new Emitter({
3914
3904
  replay: true,
3915
3905
  });
3916
3906
  this.onDidConstraintsChange = this._onDidConstraintsChange.event;
3907
+ //
3917
3908
  this._onDidSizeChange = new Emitter();
3918
3909
  this.onDidSizeChange = this._onDidSizeChange.event;
3919
3910
  this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
3920
- if (panel) {
3921
- this.initialize(panel);
3922
- }
3923
3911
  }
3924
3912
  setConstraints(value) {
3925
3913
  this._onDidConstraintsChangeInternal.fire(value);
@@ -3929,450 +3917,401 @@ class GridviewPanelApiImpl extends PanelApiImpl {
3929
3917
  }
3930
3918
  }
3931
3919
 
3932
- class DockviewPanelApiImpl extends GridviewPanelApiImpl {
3933
- get title() {
3934
- return this.panel.title;
3920
+ class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
3921
+ set pane(pane) {
3922
+ this._pane = pane;
3935
3923
  }
3936
- get isGroupActive() {
3924
+ constructor(id) {
3925
+ super(id);
3926
+ this._onDidExpansionChange = new Emitter({
3927
+ replay: true,
3928
+ });
3929
+ this.onDidExpansionChange = this._onDidExpansionChange.event;
3930
+ this._onMouseEnter = new Emitter({});
3931
+ this.onMouseEnter = this._onMouseEnter.event;
3932
+ this._onMouseLeave = new Emitter({});
3933
+ this.onMouseLeave = this._onMouseLeave.event;
3934
+ this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
3935
+ }
3936
+ setExpanded(isExpanded) {
3937
3937
  var _a;
3938
- return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
3938
+ (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
3939
3939
  }
3940
- set group(value) {
3941
- const isOldGroupActive = this.isGroupActive;
3942
- this._group = value;
3943
- this._onDidGroupChange.fire();
3944
- if (this._group) {
3945
- this.disposable.value = this._group.api.onDidActiveChange(() => {
3946
- this._onDidActiveGroupChange.fire();
3947
- });
3948
- if (this.isGroupActive !== isOldGroupActive) {
3949
- this._onDidActiveGroupChange.fire();
3950
- }
3951
- }
3952
- }
3953
- get group() {
3954
- return this._group;
3955
- }
3956
- constructor(panel, group) {
3957
- super(panel.id);
3958
- this.panel = panel;
3959
- this._onDidTitleChange = new Emitter();
3960
- this.onDidTitleChange = this._onDidTitleChange.event;
3961
- this._onDidActiveGroupChange = new Emitter();
3962
- this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3963
- this._onDidGroupChange = new Emitter();
3964
- this.onDidGroupChange = this._onDidGroupChange.event;
3965
- this.disposable = new MutableDisposable();
3966
- this.initialize(panel);
3967
- this._group = group;
3968
- this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3969
- }
3970
- setTitle(title) {
3971
- this.panel.update({ params: { title } });
3972
- }
3973
- close() {
3974
- this.group.model.closePanel(this.panel);
3940
+ get isExpanded() {
3941
+ var _a;
3942
+ return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
3975
3943
  }
3976
3944
  }
3977
3945
 
3978
- class DockviewPanel extends CompositeDisposable {
3979
- get params() {
3980
- return this._params;
3946
+ class BasePanelView extends CompositeDisposable {
3947
+ get element() {
3948
+ return this._element;
3981
3949
  }
3982
- get title() {
3983
- return this._title;
3950
+ get width() {
3951
+ return this._width;
3984
3952
  }
3985
- get group() {
3986
- return this._group;
3953
+ get height() {
3954
+ return this._height;
3987
3955
  }
3988
- get view() {
3989
- return this._view;
3956
+ get params() {
3957
+ var _a;
3958
+ return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
3990
3959
  }
3991
- constructor(id, accessor, containerApi, group) {
3960
+ constructor(id, component, api) {
3992
3961
  super();
3993
3962
  this.id = id;
3994
- this.containerApi = containerApi;
3995
- this.mutableDisposable = new MutableDisposable();
3996
- this._title = '';
3997
- this._group = group;
3998
- this.api = new DockviewPanelApiImpl(this, this._group);
3999
- this.addDisposables(this.api.onActiveChange(() => {
4000
- accessor.setActivePanel(this);
4001
- }), this.api.onDidSizeChange((event) => {
4002
- // forward the resize event to the group since if you want to resize a panel
4003
- // you are actually just resizing the panels parent which is the group
4004
- this.group.api.setSize(event);
3963
+ this.component = component;
3964
+ this.api = api;
3965
+ this._height = 0;
3966
+ this._width = 0;
3967
+ this._element = document.createElement('div');
3968
+ this._element.tabIndex = -1;
3969
+ this._element.style.outline = 'none';
3970
+ this._element.style.height = '100%';
3971
+ this._element.style.width = '100%';
3972
+ this._element.style.overflow = 'hidden';
3973
+ const { onDidFocus, onDidBlur } = trackFocus(this._element);
3974
+ this.addDisposables(this.api, onDidFocus(() => {
3975
+ this.api._onDidChangeFocus.fire({ isFocused: true });
3976
+ }), onDidBlur(() => {
3977
+ this.api._onDidChangeFocus.fire({ isFocused: false });
4005
3978
  }));
4006
3979
  }
4007
- init(params) {
4008
- var _a;
4009
- this._params = params.params;
4010
- this._view = params.view;
4011
- this.setTitle(params.title);
4012
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
4013
- }
4014
3980
  focus() {
4015
3981
  this.api._onFocusEvent.fire();
4016
3982
  }
4017
- toJSON() {
4018
- return {
4019
- id: this.id,
4020
- view: this.view.toJSON(),
4021
- params: Object.keys(this._params || {}).length > 0
4022
- ? this._params
4023
- : undefined,
4024
- title: this.title,
4025
- };
4026
- }
4027
- setTitle(title) {
4028
- var _a, _b;
4029
- const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
4030
- if (didTitleChange) {
4031
- this._title = title;
4032
- (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
4033
- params: {
4034
- params: this._params,
4035
- title: this.title,
4036
- },
4037
- });
4038
- this.api._onDidTitleChange.fire({ title });
4039
- }
4040
- }
4041
- update(event) {
4042
- var _a;
4043
- const params = event.params;
4044
- this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
4045
- if (typeof params.title === 'string') {
4046
- if (params.title !== this.title) {
4047
- this._title = params.title;
4048
- this.api._onDidTitleChange.fire({ title: this.title });
3983
+ layout(width, height) {
3984
+ this._width = width;
3985
+ this._height = height;
3986
+ this.api._onDidDimensionChange.fire({ width, height });
3987
+ if (this.part) {
3988
+ if (this._params) {
3989
+ this.part.update(this._params.params);
4049
3990
  }
4050
3991
  }
4051
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
4052
- params: {
4053
- params: this._params,
4054
- title: this.title,
4055
- },
4056
- });
4057
3992
  }
4058
- updateParentGroup(group, isGroupActive) {
4059
- var _a;
4060
- this._group = group;
4061
- this.api.group = group;
4062
- const isPanelVisible = this._group.model.isPanelActive(this);
4063
- this.api._onDidActiveChange.fire({
4064
- isActive: isGroupActive && isPanelVisible,
4065
- });
4066
- this.api._onDidVisibilityChange.fire({
4067
- isVisible: isPanelVisible,
4068
- });
4069
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.updateParentGroup(this._group, this._group.model.isPanelActive(this));
3993
+ init(parameters) {
3994
+ this._params = parameters;
3995
+ this.part = this.getComponent();
4070
3996
  }
4071
- layout(width, height) {
4072
- var _a;
4073
- // the obtain the correct dimensions of the content panel we must deduct the tab height
4074
- this.api._onDidDimensionChange.fire({
4075
- width,
4076
- height: height - (this.group.model.header.height || 0),
4077
- });
4078
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.layout(width, height);
3997
+ update(event) {
3998
+ var _a, _b;
3999
+ 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) });
4000
+ (_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
4001
+ }
4002
+ toJSON() {
4003
+ var _a, _b;
4004
+ const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
4005
+ return {
4006
+ id: this.id,
4007
+ component: this.component,
4008
+ params: Object.keys(params).length > 0 ? params : undefined,
4009
+ };
4079
4010
  }
4080
4011
  dispose() {
4081
4012
  var _a;
4013
+ super.dispose();
4082
4014
  this.api.dispose();
4083
- this.mutableDisposable.dispose();
4084
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
4015
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
4085
4016
  }
4086
4017
  }
4087
4018
 
4088
- class ActionContainer {
4089
- get element() {
4090
- return this._element;
4019
+ class PaneviewPanel extends BasePanelView {
4020
+ set orientation(value) {
4021
+ this._orientation = value;
4091
4022
  }
4092
- constructor() {
4093
- this._element = document.createElement('div');
4094
- this._element.className = 'actions-bar';
4095
- this._list = document.createElement('ul');
4096
- this._list.className = 'actions-container';
4097
- this._element.appendChild(this._list);
4023
+ get orientation() {
4024
+ return this._orientation;
4098
4025
  }
4099
- add(element) {
4100
- const listItem = document.createElement('li');
4101
- listItem.className = 'action-item';
4102
- this._list.appendChild(element);
4026
+ get minimumSize() {
4027
+ const headerSize = this.headerSize;
4028
+ const expanded = this.isExpanded();
4029
+ const minimumBodySize = expanded ? this._minimumBodySize : 0;
4030
+ return headerSize + minimumBodySize;
4103
4031
  }
4104
- }
4105
-
4106
- const createSvgElementFromPath = (params) => {
4107
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
4108
- svg.setAttributeNS(null, 'height', params.height);
4109
- svg.setAttributeNS(null, 'width', params.width);
4110
- svg.setAttributeNS(null, 'viewBox', params.viewbox);
4111
- svg.setAttributeNS(null, 'aria-hidden', 'false');
4112
- svg.setAttributeNS(null, 'focusable', 'false');
4113
- svg.classList.add('dockview-svg');
4114
- const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
4115
- path.setAttributeNS(null, 'd', params.path);
4116
- svg.appendChild(path);
4117
- return svg;
4118
- };
4119
- const createCloseButton = () => createSvgElementFromPath({
4120
- width: '11',
4121
- height: '11',
4122
- viewbox: '0 0 28 28',
4123
- 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',
4124
- });
4125
- const createExpandMoreButton = () => createSvgElementFromPath({
4126
- width: '11',
4127
- height: '11',
4128
- viewbox: '0 0 24 15',
4129
- path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
4130
- });
4131
- const createChevronRightButton = () => createSvgElementFromPath({
4132
- width: '11',
4133
- height: '11',
4134
- viewbox: '0 0 15 25',
4135
- path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
4136
- });
4137
-
4138
- class Watermark extends CompositeDisposable {
4139
- get id() {
4140
- return 'watermark';
4032
+ get maximumSize() {
4033
+ const headerSize = this.headerSize;
4034
+ const expanded = this.isExpanded();
4035
+ const maximumBodySize = expanded ? this._maximumBodySize : 0;
4036
+ return headerSize + maximumBodySize;
4141
4037
  }
4142
- constructor() {
4143
- super();
4144
- this._element = document.createElement('div');
4145
- this._element.className = 'watermark';
4146
- const title = document.createElement('div');
4147
- title.className = 'watermark-title';
4148
- const emptySpace = document.createElement('span');
4149
- emptySpace.style.flexGrow = '1';
4150
- const content = document.createElement('div');
4151
- content.className = 'watermark-content';
4152
- this._element.appendChild(title);
4153
- this._element.appendChild(content);
4154
- const actions = new ActionContainer();
4155
- title.appendChild(emptySpace);
4156
- title.appendChild(actions.element);
4157
- const closeAnchor = document.createElement('div');
4158
- closeAnchor.className = 'close-action';
4159
- closeAnchor.appendChild(createCloseButton());
4160
- actions.add(closeAnchor);
4161
- this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
4162
- var _a;
4163
- ev.preventDefault();
4164
- if (this.group) {
4165
- (_a = this.params) === null || _a === void 0 ? void 0 : _a.containerApi.removeGroup(this.group);
4166
- }
4167
- }));
4038
+ get size() {
4039
+ return this._size;
4168
4040
  }
4169
- update(_event) {
4170
- // noop
4041
+ get orthogonalSize() {
4042
+ return this._orthogonalSize;
4171
4043
  }
4172
- focus() {
4173
- // noop
4044
+ set orthogonalSize(size) {
4045
+ this._orthogonalSize = size;
4174
4046
  }
4175
- toJSON() {
4176
- return {};
4047
+ get minimumBodySize() {
4048
+ return this._minimumBodySize;
4177
4049
  }
4178
- layout(_width, _height) {
4179
- // noop
4050
+ set minimumBodySize(value) {
4051
+ this._minimumBodySize = typeof value === 'number' ? value : 0;
4180
4052
  }
4181
- init(params) {
4182
- this.params = params;
4183
- this.addDisposables(this.params.containerApi.onDidLayoutChange(() => {
4184
- this.render();
4185
- }));
4186
- this.render();
4053
+ get maximumBodySize() {
4054
+ return this._maximumBodySize;
4187
4055
  }
4188
- updateParentGroup(group, _visible) {
4189
- this.group = group;
4190
- this.render();
4191
- }
4192
- get element() {
4193
- return this._element;
4194
- }
4195
- render() {
4196
- const isOneGroup = !!(this.params && this.params.containerApi.size <= 1);
4197
- toggleClass(this.element, 'has-actions', isOneGroup);
4198
- }
4199
- dispose() {
4200
- super.dispose();
4201
- }
4202
- }
4203
-
4204
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
4205
- const Component = typeof componentName === 'string'
4206
- ? components[componentName]
4207
- : undefined;
4208
- const FrameworkComponent = typeof componentName === 'string'
4209
- ? frameworkComponents[componentName]
4210
- : undefined;
4211
- if (Component && FrameworkComponent) {
4212
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
4213
- }
4214
- if (FrameworkComponent) {
4215
- if (!createFrameworkComponent) {
4216
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
4217
- }
4218
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
4219
- }
4220
- if (!Component) {
4221
- if (fallback) {
4222
- return fallback();
4223
- }
4224
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
4056
+ set maximumBodySize(value) {
4057
+ this._maximumBodySize =
4058
+ typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
4225
4059
  }
4226
- return new Component(id, componentName);
4227
- }
4228
-
4229
- const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
4230
- class DefaultTab extends CompositeDisposable {
4231
- get element() {
4232
- return this._element;
4060
+ get headerVisible() {
4061
+ return this._headerVisible;
4233
4062
  }
4234
- get id() {
4235
- return DEFAULT_TAB_IDENTIFIER;
4063
+ set headerVisible(value) {
4064
+ this._headerVisible = value;
4065
+ this.header.style.display = value ? '' : 'none';
4236
4066
  }
4237
- constructor() {
4238
- super();
4239
- this._isPanelVisible = false;
4240
- this._isGroupActive = false;
4241
- //
4242
- this.params = {};
4243
- this._element = document.createElement('div');
4244
- this._element.className = 'default-tab';
4245
- //
4246
- this._content = document.createElement('div');
4247
- this._content.className = 'tab-content';
4248
- //
4249
- this._actionContainer = document.createElement('div');
4250
- this._actionContainer.className = 'action-container';
4251
- //
4252
- this._list = document.createElement('ul');
4253
- this._list.className = 'tab-list';
4254
- //
4255
- this.action = document.createElement('div');
4256
- this.action.className = 'tab-action';
4257
- this.action.appendChild(createCloseButton());
4258
- //
4259
- this._element.appendChild(this._content);
4260
- this._element.appendChild(this._actionContainer);
4261
- this._actionContainer.appendChild(this._list);
4262
- this._list.appendChild(this.action);
4263
- //
4264
- this.addDisposables(addDisposableListener(this._actionContainer, 'mousedown', (ev) => {
4265
- ev.preventDefault();
4067
+ constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
4068
+ super(id, component, new PaneviewPanelApiImpl(id));
4069
+ this.headerComponent = headerComponent;
4070
+ this._onDidChangeExpansionState = new Emitter({ replay: true });
4071
+ this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
4072
+ this._onDidChange = new Emitter();
4073
+ this.onDidChange = this._onDidChange.event;
4074
+ this.headerSize = 22;
4075
+ this._orthogonalSize = 0;
4076
+ this._size = 0;
4077
+ this._minimumBodySize = 100;
4078
+ this._maximumBodySize = Number.POSITIVE_INFINITY;
4079
+ this._isExpanded = false;
4080
+ this.expandedSize = 0;
4081
+ this.api.pane = this; // TODO cannot use 'this' before 'super'
4082
+ this.api.initialize(this);
4083
+ this._isExpanded = isExpanded;
4084
+ this._headerVisible = isHeaderVisible;
4085
+ this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
4086
+ this._orientation = orientation;
4087
+ this.element.classList.add('pane');
4088
+ this.addDisposables(this.api.onDidSizeChange((event) => {
4089
+ this._onDidChange.fire({ size: event.size });
4090
+ }), addDisposableListener(this.element, 'mouseenter', (ev) => {
4091
+ this.api._onMouseEnter.fire(ev);
4092
+ }), addDisposableListener(this.element, 'mouseleave', (ev) => {
4093
+ this.api._onMouseLeave.fire(ev);
4266
4094
  }));
4267
- this.render();
4268
- }
4269
- update(event) {
4270
- this.params = Object.assign(Object.assign({}, this.params), event.params);
4271
- this.render();
4095
+ this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
4096
+ this.api._onDidExpansionChange.fire({
4097
+ isExpanded: isPanelExpanded,
4098
+ });
4099
+ }), this.api.onDidFocusChange((e) => {
4100
+ if (!this.header) {
4101
+ return;
4102
+ }
4103
+ if (e.isFocused) {
4104
+ addClasses(this.header, 'focused');
4105
+ }
4106
+ else {
4107
+ removeClasses(this.header, 'focused');
4108
+ }
4109
+ }));
4110
+ this.renderOnce();
4272
4111
  }
4273
- toJSON() {
4274
- return { id: this.id };
4112
+ setVisible(isVisible) {
4113
+ this.api._onDidVisibilityChange.fire({ isVisible });
4275
4114
  }
4276
- focus() {
4277
- //noop
4115
+ setActive(isActive) {
4116
+ this.api._onDidActiveChange.fire({ isActive });
4278
4117
  }
4279
- init(params) {
4280
- this.params = params;
4281
- this._content.textContent = params.title;
4282
- addDisposableListener(this.action, 'click', (ev) => {
4283
- ev.preventDefault(); //
4284
- this.params.api.close();
4285
- });
4118
+ isExpanded() {
4119
+ return this._isExpanded;
4286
4120
  }
4287
- updateParentGroup(group, isPanelVisible) {
4288
- const changed = this._isPanelVisible !== isPanelVisible ||
4289
- this._isGroupActive !== group.isActive;
4290
- this._isPanelVisible = isPanelVisible;
4291
- this._isGroupActive = group.isActive;
4292
- if (changed) {
4293
- this.render();
4121
+ setExpanded(expanded) {
4122
+ if (this._isExpanded === expanded) {
4123
+ return;
4124
+ }
4125
+ this._isExpanded = expanded;
4126
+ if (expanded) {
4127
+ if (this.animationTimer) {
4128
+ clearTimeout(this.animationTimer);
4129
+ }
4130
+ if (this.body) {
4131
+ this.element.appendChild(this.body);
4132
+ }
4294
4133
  }
4134
+ else {
4135
+ this.animationTimer = setTimeout(() => {
4136
+ var _a;
4137
+ (_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
4138
+ }, 200);
4139
+ }
4140
+ this._onDidChange.fire(expanded ? { size: this.width } : {});
4141
+ this._onDidChangeExpansionState.fire(expanded);
4295
4142
  }
4296
- layout(_width, _height) {
4297
- // noop
4143
+ layout(size, orthogonalSize) {
4144
+ this._size = size;
4145
+ this._orthogonalSize = orthogonalSize;
4146
+ const [width, height] = this.orientation === Orientation.HORIZONTAL
4147
+ ? [size, orthogonalSize]
4148
+ : [orthogonalSize, size];
4149
+ if (this.isExpanded()) {
4150
+ this.expandedSize = width;
4151
+ }
4152
+ super.layout(width, height);
4298
4153
  }
4299
- render() {
4300
- if (this._content.textContent !== this.params.title) {
4301
- this._content.textContent = this.params.title;
4154
+ init(parameters) {
4155
+ var _a, _b;
4156
+ super.init(parameters);
4157
+ if (typeof parameters.minimumBodySize === 'number') {
4158
+ this.minimumBodySize = parameters.minimumBodySize;
4159
+ }
4160
+ if (typeof parameters.maximumBodySize === 'number') {
4161
+ this.maximumBodySize = parameters.maximumBodySize;
4162
+ }
4163
+ this.bodyPart = this.getBodyComponent();
4164
+ this.headerPart = this.getHeaderComponent();
4165
+ this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
4166
+ this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
4167
+ (_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);
4168
+ (_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
4169
+ if (typeof parameters.isExpanded === 'boolean') {
4170
+ this.setExpanded(parameters.isExpanded);
4302
4171
  }
4303
4172
  }
4304
- }
4305
-
4306
- class BasePanelView extends CompositeDisposable {
4307
- get element() {
4308
- return this._element;
4173
+ toJSON() {
4174
+ const params = this._params;
4175
+ return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
4309
4176
  }
4310
- get width() {
4311
- return this._width;
4177
+ renderOnce() {
4178
+ this.header = document.createElement('div');
4179
+ this.header.tabIndex = 0;
4180
+ this.header.className = 'pane-header';
4181
+ this.header.style.height = `${this.headerSize}px`;
4182
+ this.header.style.lineHeight = `${this.headerSize}px`;
4183
+ this.header.style.minHeight = `${this.headerSize}px`;
4184
+ this.header.style.maxHeight = `${this.headerSize}px`;
4185
+ this.element.appendChild(this.header);
4186
+ this.body = document.createElement('div');
4187
+ this.body.className = 'pane-body';
4188
+ this.element.appendChild(this.body);
4312
4189
  }
4313
- get height() {
4314
- return this._height;
4190
+ // TODO slightly hacky by-pass of the component to create a body and header component
4191
+ getComponent() {
4192
+ return {
4193
+ update: (params) => {
4194
+ var _a, _b;
4195
+ (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
4196
+ (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
4197
+ },
4198
+ dispose: () => {
4199
+ var _a, _b;
4200
+ (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
4201
+ (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
4202
+ },
4203
+ };
4315
4204
  }
4316
- get params() {
4317
- var _a;
4318
- return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
4205
+ }
4206
+
4207
+ class DraggablePaneviewPanel extends PaneviewPanel {
4208
+ constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
4209
+ super(id, component, headerComponent, orientation, isExpanded, true);
4210
+ this.accessor = accessor;
4211
+ this._onDidDrop = new Emitter();
4212
+ this.onDidDrop = this._onDidDrop.event;
4213
+ if (!disableDnd) {
4214
+ this.initDragFeatures();
4215
+ }
4319
4216
  }
4320
- constructor(id, component, api) {
4321
- super();
4322
- this.id = id;
4323
- this.component = component;
4324
- this.api = api;
4325
- this._height = 0;
4326
- this._width = 0;
4327
- this._element = document.createElement('div');
4328
- this._element.tabIndex = -1;
4329
- this._element.style.outline = 'none';
4330
- this._element.style.height = '100%';
4331
- this._element.style.width = '100%';
4332
- this._element.style.overflow = 'hidden';
4333
- const { onDidFocus, onDidBlur } = trackFocus(this._element);
4334
- this.addDisposables(this.api, onDidFocus(() => {
4335
- this.api._onDidChangeFocus.fire({ isFocused: true });
4336
- }), onDidBlur(() => {
4337
- this.api._onDidChangeFocus.fire({ isFocused: false });
4217
+ initDragFeatures() {
4218
+ if (!this.header) {
4219
+ return;
4220
+ }
4221
+ const id = this.id;
4222
+ const accessorId = this.accessor.id;
4223
+ this.header.draggable = true;
4224
+ this.handler = new (class PaneDragHandler extends DragHandler {
4225
+ getData() {
4226
+ LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
4227
+ return {
4228
+ dispose: () => {
4229
+ LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
4230
+ },
4231
+ };
4232
+ }
4233
+ })(this.header);
4234
+ this.target = new Droptarget(this.element, {
4235
+ acceptedTargetZones: ['top', 'bottom'],
4236
+ overlayModel: {
4237
+ activationSize: { type: 'percentage', value: 50 },
4238
+ },
4239
+ canDisplayOverlay: (event) => {
4240
+ const data = getPaneData();
4241
+ if (data) {
4242
+ if (data.paneId !== this.id &&
4243
+ data.viewId === this.accessor.id) {
4244
+ return true;
4245
+ }
4246
+ }
4247
+ if (this.accessor.options.showDndOverlay) {
4248
+ return this.accessor.options.showDndOverlay({
4249
+ nativeEvent: event,
4250
+ getData: getPaneData,
4251
+ panel: this,
4252
+ });
4253
+ }
4254
+ return false;
4255
+ },
4256
+ });
4257
+ this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
4258
+ this.onDrop(event);
4338
4259
  }));
4339
4260
  }
4340
- focus() {
4341
- this.api._onFocusEvent.fire();
4342
- }
4343
- layout(width, height) {
4344
- this._width = width;
4345
- this._height = height;
4346
- this.api._onDidDimensionChange.fire({ width, height });
4347
- if (this.part) {
4348
- if (this._params) {
4349
- this.part.update(this._params.params);
4261
+ onDrop(event) {
4262
+ const data = getPaneData();
4263
+ if (!data || data.viewId !== this.accessor.id) {
4264
+ // if there is no local drag event for this panel
4265
+ // or if the drag event was creating by another Paneview instance
4266
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));
4267
+ return;
4268
+ }
4269
+ const containerApi = this._params
4270
+ .containerApi;
4271
+ const panelId = data.paneId;
4272
+ const existingPanel = containerApi.getPanel(panelId);
4273
+ if (!existingPanel) {
4274
+ // if the panel doesn't exist
4275
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData, api: new PaneviewApi(this.accessor) }));
4276
+ return;
4277
+ }
4278
+ const allPanels = containerApi.panels;
4279
+ const fromIndex = allPanels.indexOf(existingPanel);
4280
+ let toIndex = containerApi.panels.indexOf(this);
4281
+ if (event.position === 'left' || event.position === 'top') {
4282
+ toIndex = Math.max(0, toIndex - 1);
4283
+ }
4284
+ if (event.position === 'right' || event.position === 'bottom') {
4285
+ if (fromIndex > toIndex) {
4286
+ toIndex++;
4350
4287
  }
4288
+ toIndex = Math.min(allPanels.length - 1, toIndex);
4351
4289
  }
4290
+ containerApi.movePanel(fromIndex, toIndex);
4352
4291
  }
4353
- init(parameters) {
4354
- this._params = parameters;
4355
- this.part = this.getComponent();
4356
- }
4357
- update(event) {
4358
- var _a, _b;
4359
- 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) });
4360
- (_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
4292
+ }
4293
+
4294
+ class GridviewPanelApiImpl extends PanelApiImpl {
4295
+ constructor(id, panel) {
4296
+ super(id);
4297
+ this._onDidConstraintsChangeInternal = new Emitter();
4298
+ this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
4299
+ this._onDidConstraintsChange = new Emitter({
4300
+ replay: true,
4301
+ });
4302
+ this.onDidConstraintsChange = this._onDidConstraintsChange.event;
4303
+ this._onDidSizeChange = new Emitter();
4304
+ this.onDidSizeChange = this._onDidSizeChange.event;
4305
+ this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
4306
+ if (panel) {
4307
+ this.initialize(panel);
4308
+ }
4361
4309
  }
4362
- toJSON() {
4363
- var _a, _b;
4364
- const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
4365
- return {
4366
- id: this.id,
4367
- component: this.component,
4368
- params: Object.keys(params).length > 0 ? params : undefined,
4369
- };
4310
+ setConstraints(value) {
4311
+ this._onDidConstraintsChangeInternal.fire(value);
4370
4312
  }
4371
- dispose() {
4372
- var _a;
4373
- super.dispose();
4374
- this.api.dispose();
4375
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
4313
+ setSize(event) {
4314
+ this._onDidSizeChange.fire(event);
4376
4315
  }
4377
4316
  }
4378
4317
 
@@ -4426,8 +4365,8 @@ class GridviewPanel extends BasePanelView {
4426
4365
  get isActive() {
4427
4366
  return this.api.isActive;
4428
4367
  }
4429
- constructor(id, component, api) {
4430
- super(id, component, api);
4368
+ constructor(id, component, options) {
4369
+ super(id, component, new GridviewPanelApiImpl(id));
4431
4370
  this._evaluatedMinimumWidth = 0;
4432
4371
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
4433
4372
  this._evaluatedMinimumHeight = 0;
@@ -4439,6 +4378,18 @@ class GridviewPanel extends BasePanelView {
4439
4378
  this._snap = false;
4440
4379
  this._onDidChange = new Emitter();
4441
4380
  this.onDidChange = this._onDidChange.event;
4381
+ if (typeof (options === null || options === void 0 ? void 0 : options.minimumWidth) === 'number') {
4382
+ this._minimumWidth = options.minimumWidth;
4383
+ }
4384
+ if (typeof (options === null || options === void 0 ? void 0 : options.maximumWidth) === 'number') {
4385
+ this._maximumWidth = options.maximumWidth;
4386
+ }
4387
+ if (typeof (options === null || options === void 0 ? void 0 : options.minimumHeight) === 'number') {
4388
+ this._minimumHeight = options.minimumHeight;
4389
+ }
4390
+ if (typeof (options === null || options === void 0 ? void 0 : options.maximumHeight) === 'number') {
4391
+ this._maximumHeight = options.maximumHeight;
4392
+ }
4442
4393
  this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
4443
4394
  this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
4444
4395
  const { isVisible } = event;
@@ -4477,142 +4428,518 @@ class GridviewPanel extends BasePanelView {
4477
4428
  setActive(isActive) {
4478
4429
  this.api._onDidActiveChange.fire({ isActive });
4479
4430
  }
4480
- init(parameters) {
4481
- if (parameters.maximumHeight) {
4482
- this._maximumHeight = parameters.maximumHeight;
4483
- }
4484
- if (parameters.minimumHeight) {
4485
- this._minimumHeight = parameters.minimumHeight;
4486
- }
4487
- if (parameters.maximumWidth) {
4488
- this._maximumWidth = parameters.maximumWidth;
4489
- }
4490
- if (parameters.minimumWidth) {
4491
- this._minimumWidth = parameters.minimumWidth;
4431
+ init(parameters) {
4432
+ if (parameters.maximumHeight) {
4433
+ this._maximumHeight = parameters.maximumHeight;
4434
+ }
4435
+ if (parameters.minimumHeight) {
4436
+ this._minimumHeight = parameters.minimumHeight;
4437
+ }
4438
+ if (parameters.maximumWidth) {
4439
+ this._maximumWidth = parameters.maximumWidth;
4440
+ }
4441
+ if (parameters.minimumWidth) {
4442
+ this._minimumWidth = parameters.minimumWidth;
4443
+ }
4444
+ this._priority = parameters.priority;
4445
+ this._snap = !!parameters.snap;
4446
+ super.init(parameters);
4447
+ if (typeof parameters.isVisible === 'boolean') {
4448
+ this.setVisible(parameters.isVisible);
4449
+ }
4450
+ }
4451
+ updateConstraints() {
4452
+ this.api._onDidConstraintsChange.fire({
4453
+ minimumWidth: this._evaluatedMinimumWidth,
4454
+ maximumWidth: this._evaluatedMaximumWidth,
4455
+ minimumHeight: this._evaluatedMinimumHeight,
4456
+ maximumHeight: this._evaluatedMaximumHeight,
4457
+ });
4458
+ }
4459
+ toJSON() {
4460
+ const state = super.toJSON();
4461
+ const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? undefined : value;
4462
+ const minimum = (value) => (value <= 0 ? undefined : value);
4463
+ 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 });
4464
+ }
4465
+ }
4466
+
4467
+ class DockviewGroupPanel extends GridviewPanel {
4468
+ get panels() {
4469
+ return this._model.panels;
4470
+ }
4471
+ get activePanel() {
4472
+ return this._model.activePanel;
4473
+ }
4474
+ get size() {
4475
+ return this._model.size;
4476
+ }
4477
+ get model() {
4478
+ return this._model;
4479
+ }
4480
+ get locked() {
4481
+ return this._model.locked;
4482
+ }
4483
+ set locked(value) {
4484
+ this._model.locked = value;
4485
+ }
4486
+ get header() {
4487
+ return this._model.header;
4488
+ }
4489
+ constructor(accessor, id, options) {
4490
+ super(id, 'groupview_default', {
4491
+ minimumHeight: 100,
4492
+ minimumWidth: 100,
4493
+ });
4494
+ this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
4495
+ }
4496
+ initialize() {
4497
+ this._model.initialize();
4498
+ }
4499
+ setActive(isActive) {
4500
+ super.setActive(isActive);
4501
+ this.model.setActive(isActive);
4502
+ }
4503
+ layout(width, height) {
4504
+ super.layout(width, height);
4505
+ this.model.layout(width, height);
4506
+ }
4507
+ getComponent() {
4508
+ return this._model;
4509
+ }
4510
+ toJSON() {
4511
+ // TODO fix typing
4512
+ return this.model.toJSON();
4513
+ }
4514
+ }
4515
+
4516
+ function isPanelOptionsWithPanel(data) {
4517
+ if (data.referencePanel) {
4518
+ return true;
4519
+ }
4520
+ return false;
4521
+ }
4522
+ function isPanelOptionsWithGroup(data) {
4523
+ if (data.referenceGroup) {
4524
+ return true;
4525
+ }
4526
+ return false;
4527
+ }
4528
+ function isGroupOptionsWithPanel(data) {
4529
+ if (data.referencePanel) {
4530
+ return true;
4531
+ }
4532
+ return false;
4533
+ }
4534
+ function isGroupOptionsWithGroup(data) {
4535
+ if (data.referenceGroup) {
4536
+ return true;
4537
+ }
4538
+ return false;
4539
+ }
4540
+
4541
+ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
4542
+ get title() {
4543
+ return this.panel.title;
4544
+ }
4545
+ get isGroupActive() {
4546
+ var _a;
4547
+ return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
4548
+ }
4549
+ set group(value) {
4550
+ const isOldGroupActive = this.isGroupActive;
4551
+ this._group = value;
4552
+ this._onDidGroupChange.fire();
4553
+ if (this._group) {
4554
+ this.disposable.value = this._group.api.onDidActiveChange(() => {
4555
+ this._onDidActiveGroupChange.fire();
4556
+ });
4557
+ if (this.isGroupActive !== isOldGroupActive) {
4558
+ this._onDidActiveGroupChange.fire();
4559
+ }
4560
+ }
4561
+ }
4562
+ get group() {
4563
+ return this._group;
4564
+ }
4565
+ constructor(panel, group) {
4566
+ super(panel.id);
4567
+ this.panel = panel;
4568
+ this._onDidTitleChange = new Emitter();
4569
+ this.onDidTitleChange = this._onDidTitleChange.event;
4570
+ this._onDidActiveGroupChange = new Emitter();
4571
+ this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
4572
+ this._onDidGroupChange = new Emitter();
4573
+ this.onDidGroupChange = this._onDidGroupChange.event;
4574
+ this.disposable = new MutableDisposable();
4575
+ this.initialize(panel);
4576
+ this._group = group;
4577
+ this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
4578
+ }
4579
+ setTitle(title) {
4580
+ this.panel.update({ params: { title } });
4581
+ }
4582
+ close() {
4583
+ this.group.model.closePanel(this.panel);
4584
+ }
4585
+ }
4586
+
4587
+ class DockviewPanel extends CompositeDisposable {
4588
+ get params() {
4589
+ return this._params;
4590
+ }
4591
+ get title() {
4592
+ return this._title;
4593
+ }
4594
+ get group() {
4595
+ return this._group;
4596
+ }
4597
+ constructor(id, accessor, containerApi, group, view) {
4598
+ super();
4599
+ this.id = id;
4600
+ this.containerApi = containerApi;
4601
+ this.view = view;
4602
+ this._title = '';
4603
+ this._group = group;
4604
+ this.api = new DockviewPanelApiImpl(this, this._group);
4605
+ this.addDisposables(this.api.onActiveChange(() => {
4606
+ accessor.setActivePanel(this);
4607
+ }), this.api.onDidSizeChange((event) => {
4608
+ // forward the resize event to the group since if you want to resize a panel
4609
+ // you are actually just resizing the panels parent which is the group
4610
+ this.group.api.setSize(event);
4611
+ }));
4612
+ }
4613
+ init(params) {
4614
+ var _a;
4615
+ this._params = params.params;
4616
+ this.setTitle(params.title);
4617
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
4618
+ }
4619
+ focus() {
4620
+ this.api._onFocusEvent.fire();
4621
+ }
4622
+ toJSON() {
4623
+ return {
4624
+ id: this.id,
4625
+ contentComponent: this.view.contentComponent,
4626
+ tabComponent: this.view.tabComponent,
4627
+ params: Object.keys(this._params || {}).length > 0
4628
+ ? this._params
4629
+ : undefined,
4630
+ title: this.title,
4631
+ };
4632
+ }
4633
+ setTitle(title) {
4634
+ var _a, _b;
4635
+ const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
4636
+ if (didTitleChange) {
4637
+ this._title = title;
4638
+ (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
4639
+ params: {
4640
+ params: this._params,
4641
+ title: this.title,
4642
+ },
4643
+ });
4644
+ this.api._onDidTitleChange.fire({ title });
4492
4645
  }
4493
- this._priority = parameters.priority;
4494
- this._snap = !!parameters.snap;
4495
- super.init(parameters);
4496
- if (typeof parameters.isVisible === 'boolean') {
4497
- this.setVisible(parameters.isVisible);
4646
+ }
4647
+ update(event) {
4648
+ var _a;
4649
+ const params = event.params;
4650
+ this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
4651
+ if (params.title !== this.title) {
4652
+ this._title = params.title;
4653
+ this.api._onDidTitleChange.fire({ title: this.title });
4498
4654
  }
4655
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
4656
+ params: {
4657
+ params: this._params,
4658
+ title: this.title,
4659
+ },
4660
+ });
4499
4661
  }
4500
- updateConstraints() {
4501
- this.api._onDidConstraintsChange.fire({
4502
- minimumWidth: this._evaluatedMinimumWidth,
4503
- maximumWidth: this._evaluatedMaximumWidth,
4504
- minimumHeight: this._evaluatedMinimumHeight,
4505
- maximumHeight: this._evaluatedMaximumHeight,
4662
+ updateParentGroup(group, isGroupActive) {
4663
+ this._group = group;
4664
+ this.api.group = group;
4665
+ const isPanelVisible = this._group.model.isPanelActive(this);
4666
+ this.api._onDidActiveChange.fire({
4667
+ isActive: isGroupActive && isPanelVisible,
4668
+ });
4669
+ this.api._onDidVisibilityChange.fire({
4670
+ isVisible: isPanelVisible,
4506
4671
  });
4672
+ this.view.updateParentGroup(this._group, this._group.model.isPanelActive(this));
4507
4673
  }
4508
- toJSON() {
4509
- const state = super.toJSON();
4510
- const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? undefined : value;
4511
- const minimum = (value) => (value <= 0 ? undefined : value);
4512
- 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 });
4674
+ layout(width, height) {
4675
+ var _a;
4676
+ // the obtain the correct dimensions of the content panel we must deduct the tab height
4677
+ this.api._onDidDimensionChange.fire({
4678
+ width,
4679
+ height: height - (this.group.model.header.height || 0),
4680
+ });
4681
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.layout(width, height);
4682
+ }
4683
+ dispose() {
4684
+ var _a;
4685
+ this.api.dispose();
4686
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
4513
4687
  }
4514
4688
  }
4515
4689
 
4516
- class GroupviewApi extends GridviewPanelApiImpl {
4517
- }
4518
- class GroupPanel extends GridviewPanel {
4519
- get panels() {
4520
- return this._model.panels;
4690
+ const createSvgElementFromPath = (params) => {
4691
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
4692
+ svg.setAttributeNS(null, 'height', params.height);
4693
+ svg.setAttributeNS(null, 'width', params.width);
4694
+ svg.setAttributeNS(null, 'viewBox', params.viewbox);
4695
+ svg.setAttributeNS(null, 'aria-hidden', 'false');
4696
+ svg.setAttributeNS(null, 'focusable', 'false');
4697
+ svg.classList.add('dockview-svg');
4698
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
4699
+ path.setAttributeNS(null, 'd', params.path);
4700
+ svg.appendChild(path);
4701
+ return svg;
4702
+ };
4703
+ const createCloseButton = () => createSvgElementFromPath({
4704
+ width: '11',
4705
+ height: '11',
4706
+ viewbox: '0 0 28 28',
4707
+ 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',
4708
+ });
4709
+ const createExpandMoreButton = () => createSvgElementFromPath({
4710
+ width: '11',
4711
+ height: '11',
4712
+ viewbox: '0 0 24 15',
4713
+ path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
4714
+ });
4715
+ const createChevronRightButton = () => createSvgElementFromPath({
4716
+ width: '11',
4717
+ height: '11',
4718
+ viewbox: '0 0 15 25',
4719
+ path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
4720
+ });
4721
+
4722
+ class DefaultTab extends CompositeDisposable {
4723
+ get element() {
4724
+ return this._element;
4521
4725
  }
4522
- get activePanel() {
4523
- return this._model.activePanel;
4726
+ constructor() {
4727
+ super();
4728
+ //
4729
+ this.params = {};
4730
+ this._element = document.createElement('div');
4731
+ this._element.className = 'default-tab';
4732
+ //
4733
+ this._content = document.createElement('div');
4734
+ this._content.className = 'tab-content';
4735
+ //
4736
+ this._actionContainer = document.createElement('div');
4737
+ this._actionContainer.className = 'action-container';
4738
+ //
4739
+ this._list = document.createElement('ul');
4740
+ this._list.className = 'tab-list';
4741
+ //
4742
+ this.action = document.createElement('div');
4743
+ this.action.className = 'tab-action';
4744
+ this.action.appendChild(createCloseButton());
4745
+ //
4746
+ this._element.appendChild(this._content);
4747
+ this._element.appendChild(this._actionContainer);
4748
+ this._actionContainer.appendChild(this._list);
4749
+ this._list.appendChild(this.action);
4750
+ //
4751
+ this.addDisposables(addDisposableListener(this._actionContainer, 'mousedown', (ev) => {
4752
+ ev.preventDefault();
4753
+ }));
4754
+ this.render();
4524
4755
  }
4525
- get size() {
4526
- return this._model.size;
4756
+ update(event) {
4757
+ this.params = Object.assign(Object.assign({}, this.params), event.params);
4758
+ this.render();
4527
4759
  }
4528
- get model() {
4529
- return this._model;
4760
+ focus() {
4761
+ //noop
4530
4762
  }
4531
- get minimumHeight() {
4532
- return this._model.minimumHeight;
4763
+ init(params) {
4764
+ this.params = params;
4765
+ this._content.textContent = params.title;
4766
+ addDisposableListener(this.action, 'click', (ev) => {
4767
+ ev.preventDefault(); //
4768
+ this.params.api.close();
4769
+ });
4533
4770
  }
4534
- get maximumHeight() {
4535
- return this._model.maximumHeight;
4771
+ onGroupChange(_group) {
4772
+ this.render();
4536
4773
  }
4537
- get minimumWidth() {
4538
- return this._model.minimumWidth;
4774
+ onPanelVisibleChange(_isPanelVisible) {
4775
+ this.render();
4539
4776
  }
4540
- get maximumWidth() {
4541
- return this._model.maximumWidth;
4777
+ layout(_width, _height) {
4778
+ // noop
4542
4779
  }
4543
- get locked() {
4544
- return this._model.locked;
4780
+ render() {
4781
+ if (this._content.textContent !== this.params.title) {
4782
+ this._content.textContent = this.params.title;
4783
+ }
4545
4784
  }
4546
- set locked(value) {
4547
- this._model.locked = value;
4785
+ }
4786
+
4787
+ class DockviewPanelModel {
4788
+ get content() {
4789
+ return this._content;
4548
4790
  }
4549
- get header() {
4550
- return this._model.header;
4791
+ get tab() {
4792
+ return this._tab;
4551
4793
  }
4552
- constructor(accessor, id, options) {
4553
- super(id, 'groupview_default', new GroupviewApi(id));
4554
- this._model = new Groupview(this.element, accessor, id, options, this);
4794
+ constructor(accessor, id, contentComponent, tabComponent) {
4795
+ var _a;
4796
+ this.accessor = accessor;
4797
+ this.id = id;
4798
+ this.contentComponent = contentComponent;
4799
+ this.tabComponent = tabComponent;
4800
+ this._group = null;
4801
+ this._isPanelVisible = null;
4802
+ this._content = this.createContentComponent(this.id, contentComponent);
4803
+ this._tab =
4804
+ (_a = this.createTabComponent(this.id, tabComponent)) !== null && _a !== void 0 ? _a : new DefaultTab();
4555
4805
  }
4556
- initialize() {
4557
- this._model.initialize();
4806
+ init(params) {
4807
+ this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4808
+ this.tab.init(params);
4558
4809
  }
4559
- setActive(isActive) {
4560
- super.setActive(isActive);
4561
- this.model.setActive(isActive);
4810
+ updateParentGroup(group, isPanelVisible) {
4811
+ if (group !== this._group) {
4812
+ this._group = group;
4813
+ if (this._content.onGroupChange) {
4814
+ this._content.onGroupChange(group);
4815
+ }
4816
+ if (this._tab.onGroupChange) {
4817
+ this._tab.onGroupChange(group);
4818
+ }
4819
+ }
4820
+ if (isPanelVisible !== this._isPanelVisible) {
4821
+ this._isPanelVisible = isPanelVisible;
4822
+ if (this._content.onPanelVisibleChange) {
4823
+ this._content.onPanelVisibleChange(isPanelVisible);
4824
+ }
4825
+ if (this._tab.onPanelVisibleChange) {
4826
+ this._tab.onPanelVisibleChange(isPanelVisible);
4827
+ }
4828
+ }
4562
4829
  }
4563
4830
  layout(width, height) {
4564
- super.layout(width, height);
4565
- this.model.layout(width, height);
4831
+ var _a, _b;
4832
+ (_b = (_a = this.content).layout) === null || _b === void 0 ? void 0 : _b.call(_a, width, height);
4566
4833
  }
4567
- getComponent() {
4568
- return this._model;
4834
+ update(event) {
4835
+ var _a, _b, _c, _d;
4836
+ (_b = (_a = this.content).update) === null || _b === void 0 ? void 0 : _b.call(_a, event);
4837
+ (_d = (_c = this.tab).update) === null || _d === void 0 ? void 0 : _d.call(_c, event);
4569
4838
  }
4570
- toJSON() {
4571
- return this.model.toJSON();
4839
+ dispose() {
4840
+ var _a, _b, _c, _d;
4841
+ (_b = (_a = this.content).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
4842
+ (_d = (_c = this.tab).dispose) === null || _d === void 0 ? void 0 : _d.call(_c);
4843
+ }
4844
+ createContentComponent(id, componentName) {
4845
+ var _a;
4846
+ 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);
4847
+ }
4848
+ createTabComponent(id, componentName) {
4849
+ var _a;
4850
+ 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());
4572
4851
  }
4573
4852
  }
4574
4853
 
4575
- class DefaultGroupPanelView {
4576
- get content() {
4577
- return this._content;
4854
+ class DefaultDockviewDeserialzier {
4855
+ constructor(layout) {
4856
+ this.layout = layout;
4578
4857
  }
4579
- get tab() {
4580
- return this._tab;
4858
+ fromJSON(panelData, group) {
4859
+ var _a, _b, _c;
4860
+ const panelId = panelData.id;
4861
+ const params = panelData.params;
4862
+ const title = panelData.title;
4863
+ const viewData = panelData.view;
4864
+ const contentComponent = viewData
4865
+ ? viewData.content.id
4866
+ : panelData.contentComponent || 'unknown';
4867
+ const tabComponent = viewData
4868
+ ? (_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id
4869
+ : panelData.tabComponent;
4870
+ if (tabComponent) {
4871
+ 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());
4872
+ }
4873
+ else if (this.layout.options.defaultTabComponent) {
4874
+ 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());
4875
+ }
4876
+ else {
4877
+ new DefaultTab();
4878
+ }
4879
+ const view = new DockviewPanelModel(this.layout, panelId, contentComponent, tabComponent);
4880
+ const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group, view);
4881
+ panel.init({
4882
+ title: title || panelId,
4883
+ params: params || {},
4884
+ });
4885
+ return panel;
4581
4886
  }
4582
- constructor(renderers) {
4583
- var _a;
4584
- this._content = renderers.content;
4585
- this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4887
+ }
4888
+
4889
+ class Watermark extends CompositeDisposable {
4890
+ get element() {
4891
+ return this._element;
4892
+ }
4893
+ constructor() {
4894
+ super();
4895
+ this._element = document.createElement('div');
4896
+ this._element.className = 'watermark';
4897
+ const title = document.createElement('div');
4898
+ title.className = 'watermark-title';
4899
+ const emptySpace = document.createElement('span');
4900
+ emptySpace.style.flexGrow = '1';
4901
+ const content = document.createElement('div');
4902
+ content.className = 'watermark-content';
4903
+ this._element.appendChild(title);
4904
+ this._element.appendChild(content);
4905
+ const actionsContainer = document.createElement('div');
4906
+ actionsContainer.className = 'actions-container';
4907
+ const closeAnchor = document.createElement('div');
4908
+ closeAnchor.className = 'close-action';
4909
+ closeAnchor.appendChild(createCloseButton());
4910
+ actionsContainer.appendChild(closeAnchor);
4911
+ title.appendChild(emptySpace);
4912
+ title.appendChild(actionsContainer);
4913
+ this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
4914
+ var _a;
4915
+ ev.preventDefault();
4916
+ if (this.group) {
4917
+ (_a = this.params) === null || _a === void 0 ? void 0 : _a.containerApi.removeGroup(this.group);
4918
+ }
4919
+ }));
4586
4920
  }
4587
- init(params) {
4588
- this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4589
- this.tab.init(params);
4921
+ update(_event) {
4922
+ // noop
4590
4923
  }
4591
- updateParentGroup(group, isPanelVisible) {
4592
- var _a;
4593
- this._content.updateParentGroup(group, isPanelVisible);
4594
- (_a = this._tab) === null || _a === void 0 ? void 0 : _a.updateParentGroup(group, isPanelVisible);
4924
+ focus() {
4925
+ // noop
4595
4926
  }
4596
- layout(width, height) {
4597
- this.content.layout(width, height);
4927
+ layout(_width, _height) {
4928
+ // noop
4598
4929
  }
4599
- update(event) {
4600
- this.content.update(event);
4601
- this.tab.update(event);
4930
+ init(_params) {
4931
+ this.render();
4602
4932
  }
4603
- toJSON() {
4604
- let tab = this.tab instanceof DefaultTab ? undefined : this.tab.toJSON();
4605
- if (tab && Object.keys(tab).length === 0) {
4606
- tab = undefined;
4607
- }
4608
- return {
4609
- content: this.content.toJSON(),
4610
- tab,
4611
- };
4933
+ updateParentGroup(group, _visible) {
4934
+ this.group = group;
4935
+ this.render();
4612
4936
  }
4613
4937
  dispose() {
4614
- this.content.dispose();
4615
- this.tab.dispose();
4938
+ super.dispose();
4939
+ }
4940
+ render() {
4941
+ const isOneGroup = !!(this.params && this.params.containerApi.size <= 1);
4942
+ toggleClass(this.element, 'has-actions', isOneGroup);
4616
4943
  }
4617
4944
  }
4618
4945
 
@@ -4626,12 +4953,6 @@ class DockviewComponent extends BaseGrid {
4626
4953
  get panels() {
4627
4954
  return this.groups.flatMap((group) => group.panels);
4628
4955
  }
4629
- get deserializer() {
4630
- return this._deserializer;
4631
- }
4632
- set deserializer(value) {
4633
- this._deserializer = value;
4634
- }
4635
4956
  get options() {
4636
4957
  return this._options;
4637
4958
  }
@@ -4658,6 +4979,7 @@ class DockviewComponent extends BaseGrid {
4658
4979
  styles: options.styles,
4659
4980
  });
4660
4981
  this.nextGroupId = sequentialNumberGenerator();
4982
+ this._deserializer = new DefaultDockviewDeserialzier(this);
4661
4983
  this.watermark = null;
4662
4984
  this._onDidDrop = new Emitter();
4663
4985
  this.onDidDrop = this._onDidDrop.event;
@@ -4839,9 +5161,6 @@ class DockviewComponent extends BaseGrid {
4839
5161
  }
4840
5162
  fromJSON(data) {
4841
5163
  this.clear();
4842
- if (!this.deserializer) {
4843
- throw new Error('no deserializer provided');
4844
- }
4845
5164
  const { grid, panels, options, activeGroup } = data;
4846
5165
  if (typeof (options === null || options === void 0 ? void 0 : options.tabHeight) === 'number') {
4847
5166
  this.tabHeight = options.tabHeight;
@@ -4859,7 +5178,7 @@ class DockviewComponent extends BaseGrid {
4859
5178
  });
4860
5179
  this._onDidAddGroup.fire(group);
4861
5180
  for (const child of views) {
4862
- const panel = this.deserializer.fromJSON(panels[child], group);
5181
+ const panel = this._deserializer.fromJSON(panels[child], group);
4863
5182
  const isActive = typeof activeView === 'string' &&
4864
5183
  activeView === panel.id;
4865
5184
  group.model.openPanel(panel, {
@@ -4986,14 +5305,12 @@ class DockviewComponent extends BaseGrid {
4986
5305
  : {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
4987
5306
  }
4988
5307
  updateWatermark() {
5308
+ var _a, _b;
4989
5309
  if (this.groups.length === 0) {
4990
5310
  if (!this.watermark) {
4991
5311
  this.watermark = this.createWatermarkComponent();
4992
5312
  this.watermark.init({
4993
5313
  containerApi: new DockviewApi(this),
4994
- params: {},
4995
- title: '',
4996
- api: null,
4997
5314
  });
4998
5315
  const watermarkContainer = document.createElement('div');
4999
5316
  watermarkContainer.className = 'dv-watermark-container';
@@ -5003,7 +5320,7 @@ class DockviewComponent extends BaseGrid {
5003
5320
  }
5004
5321
  else if (this.watermark) {
5005
5322
  this.watermark.element.parentElement.remove();
5006
- this.watermark.dispose();
5323
+ (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
5007
5324
  this.watermark = null;
5008
5325
  }
5009
5326
  }
@@ -5165,7 +5482,7 @@ class DockviewComponent extends BaseGrid {
5165
5482
  id = this.nextGroupId.next();
5166
5483
  }
5167
5484
  }
5168
- const view = new GroupPanel(this, id, options);
5485
+ const view = new DockviewGroupPanel(this, id, options);
5169
5486
  view.init({ params: {}, accessor: null }); // required to initialized .part and allow for correct disposal of group
5170
5487
  if (!this._groups.has(view.id)) {
5171
5488
  const disposable = new CompositeDisposable(view.model.onMove((event) => {
@@ -5178,857 +5495,522 @@ class DockviewComponent extends BaseGrid {
5178
5495
  }), view.model.onDidRemovePanel((event) => {
5179
5496
  this._onDidRemovePanel.fire(event.panel);
5180
5497
  }), view.model.onDidActivePanelChange((event) => {
5181
- this._onDidActivePanelChange.fire(event.panel);
5182
- }));
5183
- this._groups.set(view.id, { value: view, disposable });
5184
- }
5185
- // TODO: must be called after the above listeners have been setup,
5186
- // not an ideal pattern
5187
- view.initialize();
5188
- if (typeof this.options.tabHeight === 'number') {
5189
- view.model.header.height = this.options.tabHeight;
5190
- }
5191
- return view;
5192
- }
5193
- createPanel(options, group) {
5194
- const view = new DefaultGroupPanelView({
5195
- content: this.createContentComponent(options.id, options.component),
5196
- tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
5197
- });
5198
- const panel = new DockviewPanel(options.id, this, this._api, group);
5199
- panel.init({
5200
- view,
5201
- title: options.title || options.id,
5202
- params: (options === null || options === void 0 ? void 0 : options.params) || {},
5203
- });
5204
- return panel;
5205
- }
5206
- createContentComponent(id, componentName) {
5207
- var _a;
5208
- return createComponent(id, componentName, this.options.components || {}, this.options.frameworkComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.content);
5209
- }
5210
- createTabComponent(id, componentName) {
5211
- var _a;
5212
- return createComponent(id, componentName, this.options.tabComponents || {}, this.options.frameworkTabComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.tab, () => new DefaultTab());
5213
- }
5214
- createGroupAtLocation(location = [0]) {
5215
- const group = this.createGroup();
5216
- this.doAddGroup(group, location);
5217
- return group;
5218
- }
5219
- findGroup(panel) {
5220
- var _a;
5221
- return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
5222
- }
5223
- dispose() {
5224
- super.dispose();
5225
- this._onDidActivePanelChange.dispose();
5226
- this._onDidAddPanel.dispose();
5227
- this._onDidRemovePanel.dispose();
5228
- this._onDidLayoutFromJSON.dispose();
5229
- }
5230
- }
5231
-
5232
- class GridviewComponent extends BaseGrid {
5233
- get orientation() {
5234
- return this.gridview.orientation;
5235
- }
5236
- set orientation(value) {
5237
- this.gridview.orientation = value;
5238
- }
5239
- get options() {
5240
- return this._options;
5241
- }
5242
- get deserializer() {
5243
- return this._deserializer;
5244
- }
5245
- set deserializer(value) {
5246
- this._deserializer = value;
5247
- }
5248
- constructor(element, options) {
5249
- super(element, {
5250
- proportionalLayout: options.proportionalLayout,
5251
- orientation: options.orientation,
5252
- styles: options.styles,
5253
- });
5254
- this._onDidLayoutfromJSON = new Emitter();
5255
- this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5256
- this._options = options;
5257
- if (!this.options.components) {
5258
- this.options.components = {};
5259
- }
5260
- if (!this.options.frameworkComponents) {
5261
- this.options.frameworkComponents = {};
5262
- }
5263
- }
5264
- updateOptions(options) {
5265
- const hasOrientationChanged = typeof options.orientation === 'string' &&
5266
- this.gridview.orientation !== options.orientation;
5267
- this._options = Object.assign(Object.assign({}, this.options), options);
5268
- if (hasOrientationChanged) {
5269
- this.gridview.orientation = options.orientation;
5270
- }
5271
- this.layout(this.gridview.width, this.gridview.height, true);
5272
- }
5273
- removePanel(panel) {
5274
- this.removeGroup(panel);
5275
- }
5276
- /**
5277
- * Serialize the current state of the layout
5278
- *
5279
- * @returns A JSON respresentation of the layout
5280
- */
5281
- toJSON() {
5282
- var _a;
5283
- const data = this.gridview.serialize();
5284
- return {
5285
- grid: data,
5286
- activePanel: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
5287
- };
5288
- }
5289
- setVisible(panel, visible) {
5290
- this.gridview.setViewVisible(getGridLocation(panel.element), visible);
5291
- }
5292
- setActive(panel) {
5293
- this._groups.forEach((value, _key) => {
5294
- value.value.setActive(panel === value.value);
5295
- });
5296
- }
5297
- focus() {
5298
- var _a;
5299
- (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
5300
- }
5301
- fromJSON(serializedGridview) {
5302
- this.clear();
5303
- const { grid, activePanel } = serializedGridview;
5304
- const queue = [];
5305
- this.gridview.deserialize(grid, {
5306
- fromJSON: (node) => {
5307
- const { data } = node;
5308
- const view = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5309
- ? {
5310
- createComponent: this.options.frameworkComponentFactory
5311
- .createComponent,
5312
- }
5313
- : undefined);
5314
- queue.push(() => view.init({
5315
- params: data.params,
5316
- minimumWidth: data.minimumWidth,
5317
- maximumWidth: data.maximumWidth,
5318
- minimumHeight: data.minimumHeight,
5319
- maximumHeight: data.maximumHeight,
5320
- priority: data.priority,
5321
- snap: !!data.snap,
5322
- accessor: this,
5323
- isVisible: node.visible,
5324
- }));
5325
- this._onDidAddGroup.fire(view);
5326
- this.registerPanel(view);
5327
- return view;
5328
- },
5329
- });
5330
- this.layout(this.width, this.height, true);
5331
- queue.forEach((f) => f());
5332
- if (typeof activePanel === 'string') {
5333
- const panel = this.getPanel(activePanel);
5334
- if (panel) {
5335
- this.doSetGroupActive(panel);
5336
- }
5337
- }
5338
- this._onDidLayoutfromJSON.fire();
5339
- }
5340
- clear() {
5341
- const hasActiveGroup = this.activeGroup;
5342
- const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
5343
- for (const group of groups) {
5344
- group.disposable.dispose();
5345
- this.doRemoveGroup(group.value, { skipActive: true });
5346
- }
5347
- if (hasActiveGroup) {
5348
- this.doSetGroupActive(undefined);
5349
- }
5350
- this.gridview.clear();
5351
- }
5352
- movePanel(panel, options) {
5353
- var _a;
5354
- let relativeLocation;
5355
- const removedPanel = this.gridview.remove(panel);
5356
- const referenceGroup = (_a = this._groups.get(options.reference)) === null || _a === void 0 ? void 0 : _a.value;
5357
- if (!referenceGroup) {
5358
- throw new Error(`reference group ${options.reference} does not exist`);
5359
- }
5360
- const target = toTarget(options.direction);
5361
- if (target === 'center') {
5362
- throw new Error(`${target} not supported as an option`);
5363
- }
5364
- else {
5365
- const location = getGridLocation(referenceGroup.element);
5366
- relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5367
- }
5368
- this.doAddGroup(removedPanel, relativeLocation, options.size);
5369
- }
5370
- addPanel(options) {
5371
- var _a, _b;
5372
- let relativeLocation = options.location || [0];
5373
- if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
5374
- const referenceGroup = (_b = this._groups.get(options.position.referencePanel)) === null || _b === void 0 ? void 0 : _b.value;
5375
- if (!referenceGroup) {
5376
- throw new Error(`reference group ${options.position.referencePanel} does not exist`);
5377
- }
5378
- const target = toTarget(options.position.direction);
5379
- if (target === 'center') {
5380
- throw new Error(`${target} not supported as an option`);
5381
- }
5382
- else {
5383
- const location = getGridLocation(referenceGroup.element);
5384
- relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5385
- }
5498
+ this._onDidActivePanelChange.fire(event.panel);
5499
+ }));
5500
+ this._groups.set(view.id, { value: view, disposable });
5501
+ }
5502
+ // TODO: must be called after the above listeners have been setup,
5503
+ // not an ideal pattern
5504
+ view.initialize();
5505
+ if (typeof this.options.tabHeight === 'number') {
5506
+ view.model.header.height = this.options.tabHeight;
5386
5507
  }
5387
- const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5388
- ? {
5389
- createComponent: this.options.frameworkComponentFactory
5390
- .createComponent,
5391
- }
5392
- : undefined);
5393
- view.init({
5394
- params: options.params || {},
5395
- minimumWidth: options.minimumWidth,
5396
- maximumWidth: options.maximumWidth,
5397
- minimumHeight: options.minimumHeight,
5398
- maximumHeight: options.maximumHeight,
5399
- priority: options.priority,
5400
- snap: !!options.snap,
5401
- accessor: this,
5402
- isVisible: true,
5403
- });
5404
- this.registerPanel(view);
5405
- this.doAddGroup(view, relativeLocation, options.size);
5406
5508
  return view;
5407
5509
  }
5408
- registerPanel(panel) {
5409
- const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {
5410
- if (!event.isFocused) {
5411
- return;
5412
- }
5413
- this._groups.forEach((groupItem) => {
5414
- const group = groupItem.value;
5415
- if (group !== panel) {
5416
- group.setActive(false);
5417
- }
5418
- else {
5419
- group.setActive(true);
5420
- }
5421
- });
5422
- }));
5423
- this._groups.set(panel.id, {
5424
- value: panel,
5425
- disposable,
5510
+ createPanel(options, group) {
5511
+ const contentComponent = options.component;
5512
+ const tabComponent = options.tabComponent || this.options.defaultTabComponent;
5513
+ const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
5514
+ const panel = new DockviewPanel(options.id, this, this._api, group, view);
5515
+ panel.init({
5516
+ title: options.title || options.id,
5517
+ params: (options === null || options === void 0 ? void 0 : options.params) || {},
5426
5518
  });
5519
+ return panel;
5427
5520
  }
5428
- moveGroup(referenceGroup, groupId, target) {
5429
- const sourceGroup = this.getPanel(groupId);
5430
- if (!sourceGroup) {
5431
- throw new Error('invalid operation');
5432
- }
5433
- const referenceLocation = getGridLocation(referenceGroup.element);
5434
- const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5435
- const [targetParentLocation, to] = tail(targetLocation);
5436
- const sourceLocation = getGridLocation(sourceGroup.element);
5437
- const [sourceParentLocation, from] = tail(sourceLocation);
5438
- if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
5439
- // special case when 'swapping' two views within same grid location
5440
- // if a group has one tab - we are essentially moving the 'group'
5441
- // which is equivalent to swapping two views in this case
5442
- this.gridview.moveView(sourceParentLocation, from, to);
5443
- return;
5444
- }
5445
- // source group will become empty so delete the group
5446
- const targetGroup = this.doRemoveGroup(sourceGroup, {
5447
- skipActive: true,
5448
- skipDispose: true,
5449
- });
5450
- // after deleting the group we need to re-evaulate the ref location
5451
- const updatedReferenceLocation = getGridLocation(referenceGroup.element);
5452
- const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
5453
- this.doAddGroup(targetGroup, location);
5521
+ createGroupAtLocation(location = [0]) {
5522
+ const group = this.createGroup();
5523
+ this.doAddGroup(group, location);
5524
+ return group;
5454
5525
  }
5455
- removeGroup(group) {
5456
- super.removeGroup(group);
5526
+ findGroup(panel) {
5527
+ var _a;
5528
+ return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
5457
5529
  }
5458
5530
  dispose() {
5459
5531
  super.dispose();
5460
- this._onDidLayoutfromJSON.dispose();
5532
+ this._onDidActivePanelChange.dispose();
5533
+ this._onDidAddPanel.dispose();
5534
+ this._onDidRemovePanel.dispose();
5535
+ this._onDidLayoutFromJSON.dispose();
5461
5536
  }
5462
5537
  }
5463
5538
 
5464
- /**
5465
- * A high-level implementation of splitview that works using 'panels'
5466
- */
5467
- class SplitviewComponent extends CompositeDisposable {
5468
- get panels() {
5469
- return this.splitview.getViews();
5470
- }
5471
- get options() {
5472
- return this._options;
5473
- }
5474
- get length() {
5475
- return this._panels.size;
5476
- }
5539
+ class GridviewComponent extends BaseGrid {
5477
5540
  get orientation() {
5478
- return this.splitview.orientation;
5479
- }
5480
- get splitview() {
5481
- return this._splitview;
5482
- }
5483
- set splitview(value) {
5484
- this._splitview = value;
5485
- this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
5486
- this._onDidLayoutChange.fire(undefined);
5487
- }), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
5541
+ return this.gridview.orientation;
5488
5542
  }
5489
- get minimumSize() {
5490
- return this.splitview.minimumSize;
5543
+ set orientation(value) {
5544
+ this.gridview.orientation = value;
5491
5545
  }
5492
- get maximumSize() {
5493
- return this.splitview.maximumSize;
5546
+ get options() {
5547
+ return this._options;
5494
5548
  }
5495
- get height() {
5496
- return this.splitview.orientation === Orientation.HORIZONTAL
5497
- ? this.splitview.orthogonalSize
5498
- : this.splitview.size;
5549
+ get deserializer() {
5550
+ return this._deserializer;
5499
5551
  }
5500
- get width() {
5501
- return this.splitview.orientation === Orientation.HORIZONTAL
5502
- ? this.splitview.size
5503
- : this.splitview.orthogonalSize;
5552
+ set deserializer(value) {
5553
+ this._deserializer = value;
5504
5554
  }
5505
5555
  constructor(element, options) {
5506
- super();
5507
- this.element = element;
5508
- this._disposable = new MutableDisposable();
5509
- this._panels = new Map();
5556
+ super(element, {
5557
+ proportionalLayout: options.proportionalLayout,
5558
+ orientation: options.orientation,
5559
+ styles: options.styles,
5560
+ });
5510
5561
  this._onDidLayoutfromJSON = new Emitter();
5511
5562
  this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5512
- this._onDidAddView = new Emitter();
5513
- this.onDidAddView = this._onDidAddView.event;
5514
- this._onDidRemoveView = new Emitter();
5515
- this.onDidRemoveView = this._onDidRemoveView.event;
5516
- this._onDidLayoutChange = new Emitter();
5517
- this.onDidLayoutChange = this._onDidLayoutChange.event;
5518
5563
  this._options = options;
5519
- if (!options.components) {
5520
- options.components = {};
5564
+ if (!this.options.components) {
5565
+ this.options.components = {};
5521
5566
  }
5522
- if (!options.frameworkComponents) {
5523
- options.frameworkComponents = {};
5567
+ if (!this.options.frameworkComponents) {
5568
+ this.options.frameworkComponents = {};
5524
5569
  }
5525
- this.splitview = new Splitview(this.element, options);
5526
- this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5527
5570
  }
5528
5571
  updateOptions(options) {
5529
5572
  const hasOrientationChanged = typeof options.orientation === 'string' &&
5530
- this.options.orientation !== options.orientation;
5573
+ this.gridview.orientation !== options.orientation;
5531
5574
  this._options = Object.assign(Object.assign({}, this.options), options);
5532
5575
  if (hasOrientationChanged) {
5533
- this.splitview.orientation = options.orientation;
5534
- }
5535
- this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
5536
- }
5537
- focus() {
5538
- var _a;
5539
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
5540
- }
5541
- movePanel(from, to) {
5542
- this.splitview.moveView(from, to);
5543
- }
5544
- setVisible(panel, visible) {
5545
- const index = this.panels.indexOf(panel);
5546
- this.splitview.setViewVisible(index, visible);
5547
- }
5548
- setActive(view, skipFocus) {
5549
- this._activePanel = view;
5550
- this.panels
5551
- .filter((v) => v !== view)
5552
- .forEach((v) => {
5553
- v.api._onDidActiveChange.fire({ isActive: false });
5554
- if (!skipFocus) {
5555
- v.focus();
5556
- }
5557
- });
5558
- view.api._onDidActiveChange.fire({ isActive: true });
5559
- if (!skipFocus) {
5560
- view.focus();
5561
- }
5562
- }
5563
- removePanel(panel, sizing) {
5564
- const disposable = this._panels.get(panel.id);
5565
- if (!disposable) {
5566
- throw new Error(`unknown splitview panel ${panel.id}`);
5567
- }
5568
- disposable.disposable.dispose();
5569
- disposable.value.dispose();
5570
- this._panels.delete(panel.id);
5571
- const index = this.panels.findIndex((_) => _ === panel);
5572
- this.splitview.removeView(index, sizing);
5573
- const panels = this.panels;
5574
- if (panels.length > 0) {
5575
- this.setActive(panels[panels.length - 1]);
5576
- }
5577
- }
5578
- getPanel(id) {
5579
- return this.panels.find((view) => view.id === id);
5580
- }
5581
- addPanel(options) {
5582
- if (this._panels.has(options.id)) {
5583
- throw new Error(`panel ${options.id} already exists`);
5576
+ this.gridview.orientation = options.orientation;
5584
5577
  }
5585
- const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5586
- ? {
5587
- createComponent: this.options.frameworkWrapper.createComponent,
5588
- }
5589
- : undefined);
5590
- view.orientation = this.splitview.orientation;
5591
- view.init({
5592
- params: options.params || {},
5593
- minimumSize: options.minimumSize,
5594
- maximumSize: options.maximumSize,
5595
- snap: options.snap,
5596
- priority: options.priority,
5597
- accessor: this,
5598
- });
5599
- const size = typeof options.size === 'number' ? options.size : Sizing.Distribute;
5600
- const index = typeof options.index === 'number' ? options.index : undefined;
5601
- this.splitview.addView(view, size, index);
5602
- this.doAddView(view);
5603
- this.setActive(view);
5604
- return view;
5605
- }
5606
- layout(width, height) {
5607
- const [size, orthogonalSize] = this.splitview.orientation === Orientation.HORIZONTAL
5608
- ? [width, height]
5609
- : [height, width];
5610
- this.splitview.layout(size, orthogonalSize);
5578
+ this.layout(this.gridview.width, this.gridview.height, true);
5611
5579
  }
5612
- doAddView(view) {
5613
- const disposable = view.api.onDidFocusChange((event) => {
5614
- if (!event.isFocused) {
5615
- return;
5616
- }
5617
- this.setActive(view, true);
5618
- });
5619
- this._panels.set(view.id, { disposable, value: view });
5580
+ removePanel(panel) {
5581
+ this.removeGroup(panel);
5620
5582
  }
5583
+ /**
5584
+ * Serialize the current state of the layout
5585
+ *
5586
+ * @returns A JSON respresentation of the layout
5587
+ */
5621
5588
  toJSON() {
5622
5589
  var _a;
5623
- const views = this.splitview
5624
- .getViews()
5625
- .map((view, i) => {
5626
- const size = this.splitview.getViewSize(i);
5627
- return {
5628
- size,
5629
- data: view.toJSON(),
5630
- snap: !!view.snap,
5631
- priority: view.priority,
5632
- };
5633
- });
5590
+ const data = this.gridview.serialize();
5634
5591
  return {
5635
- views,
5636
- activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
5637
- size: this.splitview.size,
5638
- orientation: this.splitview.orientation,
5592
+ grid: data,
5593
+ activePanel: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
5639
5594
  };
5640
5595
  }
5641
- fromJSON(serializedSplitview) {
5596
+ setVisible(panel, visible) {
5597
+ this.gridview.setViewVisible(getGridLocation(panel.element), visible);
5598
+ }
5599
+ setActive(panel) {
5600
+ this._groups.forEach((value, _key) => {
5601
+ value.value.setActive(panel === value.value);
5602
+ });
5603
+ }
5604
+ focus() {
5605
+ var _a;
5606
+ (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
5607
+ }
5608
+ fromJSON(serializedGridview) {
5642
5609
  this.clear();
5643
- const { views, orientation, size, activeView } = serializedSplitview;
5610
+ const { grid, activePanel } = serializedGridview;
5644
5611
  const queue = [];
5645
- this.splitview = new Splitview(this.element, {
5646
- orientation,
5647
- proportionalLayout: this.options.proportionalLayout,
5648
- descriptor: {
5649
- size,
5650
- views: views.map((view) => {
5651
- const data = view.data;
5652
- if (this._panels.has(data.id)) {
5653
- throw new Error(`panel ${data.id} already exists`);
5612
+ this.gridview.deserialize(grid, {
5613
+ fromJSON: (node) => {
5614
+ const { data } = node;
5615
+ const view = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5616
+ ? {
5617
+ createComponent: this.options.frameworkComponentFactory
5618
+ .createComponent,
5654
5619
  }
5655
- const panel = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5656
- ? {
5657
- createComponent: this.options.frameworkWrapper
5658
- .createComponent,
5659
- }
5660
- : undefined);
5661
- queue.push(() => {
5662
- panel.init({
5663
- params: data.params || {},
5664
- minimumSize: data.minimumSize,
5665
- maximumSize: data.maximumSize,
5666
- snap: view.snap,
5667
- priority: view.priority,
5668
- accessor: this,
5669
- });
5670
- });
5671
- panel.orientation = orientation;
5672
- this.doAddView(panel);
5673
- setTimeout(() => {
5674
- // the original onDidAddView events are missed since they are fired before we can subcribe to them
5675
- this._onDidAddView.fire(panel);
5676
- }, 0);
5677
- return { size: view.size, view: panel };
5678
- }),
5620
+ : undefined);
5621
+ queue.push(() => view.init({
5622
+ params: data.params,
5623
+ minimumWidth: data.minimumWidth,
5624
+ maximumWidth: data.maximumWidth,
5625
+ minimumHeight: data.minimumHeight,
5626
+ maximumHeight: data.maximumHeight,
5627
+ priority: data.priority,
5628
+ snap: !!data.snap,
5629
+ accessor: this,
5630
+ isVisible: node.visible,
5631
+ }));
5632
+ this._onDidAddGroup.fire(view);
5633
+ this.registerPanel(view);
5634
+ return view;
5679
5635
  },
5680
5636
  });
5681
- this.layout(this.width, this.height);
5637
+ this.layout(this.width, this.height, true);
5682
5638
  queue.forEach((f) => f());
5683
- if (typeof activeView === 'string') {
5684
- const panel = this.getPanel(activeView);
5639
+ if (typeof activePanel === 'string') {
5640
+ const panel = this.getPanel(activePanel);
5685
5641
  if (panel) {
5686
- this.setActive(panel);
5642
+ this.doSetGroupActive(panel);
5687
5643
  }
5688
5644
  }
5689
5645
  this._onDidLayoutfromJSON.fire();
5690
5646
  }
5691
5647
  clear() {
5692
- for (const [_, value] of this._panels.entries()) {
5693
- value.disposable.dispose();
5694
- value.value.dispose();
5648
+ const hasActiveGroup = this.activeGroup;
5649
+ const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
5650
+ for (const group of groups) {
5651
+ group.disposable.dispose();
5652
+ this.doRemoveGroup(group.value, { skipActive: true });
5695
5653
  }
5696
- this._panels.clear();
5697
- this.splitview.dispose();
5654
+ if (hasActiveGroup) {
5655
+ this.doSetGroupActive(undefined);
5656
+ }
5657
+ this.gridview.clear();
5698
5658
  }
5699
- dispose() {
5700
- for (const [_, value] of this._panels.entries()) {
5701
- value.disposable.dispose();
5702
- value.value.dispose();
5659
+ movePanel(panel, options) {
5660
+ var _a;
5661
+ let relativeLocation;
5662
+ const removedPanel = this.gridview.remove(panel);
5663
+ const referenceGroup = (_a = this._groups.get(options.reference)) === null || _a === void 0 ? void 0 : _a.value;
5664
+ if (!referenceGroup) {
5665
+ throw new Error(`reference group ${options.reference} does not exist`);
5703
5666
  }
5704
- this._panels.clear();
5705
- this.splitview.dispose();
5706
- super.dispose();
5667
+ const target = toTarget(options.direction);
5668
+ if (target === 'center') {
5669
+ throw new Error(`${target} not supported as an option`);
5670
+ }
5671
+ else {
5672
+ const location = getGridLocation(referenceGroup.element);
5673
+ relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5674
+ }
5675
+ this.doAddGroup(removedPanel, relativeLocation, options.size);
5707
5676
  }
5708
- }
5709
-
5710
- class SplitviewPanelApiImpl extends PanelApiImpl {
5711
- //
5712
- constructor(id) {
5713
- super(id);
5714
- this._onDidConstraintsChangeInternal = new Emitter();
5715
- this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5716
- //
5717
- this._onDidConstraintsChange = new Emitter({
5718
- replay: true,
5677
+ addPanel(options) {
5678
+ var _a, _b;
5679
+ let relativeLocation = options.location || [0];
5680
+ if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
5681
+ const referenceGroup = (_b = this._groups.get(options.position.referencePanel)) === null || _b === void 0 ? void 0 : _b.value;
5682
+ if (!referenceGroup) {
5683
+ throw new Error(`reference group ${options.position.referencePanel} does not exist`);
5684
+ }
5685
+ const target = toTarget(options.position.direction);
5686
+ if (target === 'center') {
5687
+ throw new Error(`${target} not supported as an option`);
5688
+ }
5689
+ else {
5690
+ const location = getGridLocation(referenceGroup.element);
5691
+ relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5692
+ }
5693
+ }
5694
+ const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5695
+ ? {
5696
+ createComponent: this.options.frameworkComponentFactory
5697
+ .createComponent,
5698
+ }
5699
+ : undefined);
5700
+ view.init({
5701
+ params: options.params || {},
5702
+ minimumWidth: options.minimumWidth,
5703
+ maximumWidth: options.maximumWidth,
5704
+ minimumHeight: options.minimumHeight,
5705
+ maximumHeight: options.maximumHeight,
5706
+ priority: options.priority,
5707
+ snap: !!options.snap,
5708
+ accessor: this,
5709
+ isVisible: true,
5719
5710
  });
5720
- this.onDidConstraintsChange = this._onDidConstraintsChange.event;
5721
- //
5722
- this._onDidSizeChange = new Emitter();
5723
- this.onDidSizeChange = this._onDidSizeChange.event;
5724
- this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
5725
- }
5726
- setConstraints(value) {
5727
- this._onDidConstraintsChangeInternal.fire(value);
5728
- }
5729
- setSize(event) {
5730
- this._onDidSizeChange.fire(event);
5711
+ this.registerPanel(view);
5712
+ this.doAddGroup(view, relativeLocation, options.size);
5713
+ return view;
5731
5714
  }
5732
- }
5733
-
5734
- class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5735
- set pane(pane) {
5736
- this._pane = pane;
5715
+ registerPanel(panel) {
5716
+ const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {
5717
+ if (!event.isFocused) {
5718
+ return;
5719
+ }
5720
+ this._groups.forEach((groupItem) => {
5721
+ const group = groupItem.value;
5722
+ if (group !== panel) {
5723
+ group.setActive(false);
5724
+ }
5725
+ else {
5726
+ group.setActive(true);
5727
+ }
5728
+ });
5729
+ }));
5730
+ this._groups.set(panel.id, {
5731
+ value: panel,
5732
+ disposable,
5733
+ });
5737
5734
  }
5738
- constructor(id) {
5739
- super(id);
5740
- this._onDidExpansionChange = new Emitter({
5741
- replay: true,
5735
+ moveGroup(referenceGroup, groupId, target) {
5736
+ const sourceGroup = this.getPanel(groupId);
5737
+ if (!sourceGroup) {
5738
+ throw new Error('invalid operation');
5739
+ }
5740
+ const referenceLocation = getGridLocation(referenceGroup.element);
5741
+ const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5742
+ const [targetParentLocation, to] = tail(targetLocation);
5743
+ const sourceLocation = getGridLocation(sourceGroup.element);
5744
+ const [sourceParentLocation, from] = tail(sourceLocation);
5745
+ if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
5746
+ // special case when 'swapping' two views within same grid location
5747
+ // if a group has one tab - we are essentially moving the 'group'
5748
+ // which is equivalent to swapping two views in this case
5749
+ this.gridview.moveView(sourceParentLocation, from, to);
5750
+ return;
5751
+ }
5752
+ // source group will become empty so delete the group
5753
+ const targetGroup = this.doRemoveGroup(sourceGroup, {
5754
+ skipActive: true,
5755
+ skipDispose: true,
5742
5756
  });
5743
- this.onDidExpansionChange = this._onDidExpansionChange.event;
5744
- this._onMouseEnter = new Emitter({});
5745
- this.onMouseEnter = this._onMouseEnter.event;
5746
- this._onMouseLeave = new Emitter({});
5747
- this.onMouseLeave = this._onMouseLeave.event;
5748
- this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
5757
+ // after deleting the group we need to re-evaulate the ref location
5758
+ const updatedReferenceLocation = getGridLocation(referenceGroup.element);
5759
+ const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
5760
+ this.doAddGroup(targetGroup, location);
5749
5761
  }
5750
- setExpanded(isExpanded) {
5751
- var _a;
5752
- (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
5762
+ removeGroup(group) {
5763
+ super.removeGroup(group);
5753
5764
  }
5754
- get isExpanded() {
5755
- var _a;
5756
- return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
5765
+ dispose() {
5766
+ super.dispose();
5767
+ this._onDidLayoutfromJSON.dispose();
5757
5768
  }
5758
5769
  }
5759
5770
 
5760
- class PaneviewPanel extends BasePanelView {
5761
- set orientation(value) {
5762
- this._orientation = value;
5763
- }
5764
- get orientation() {
5765
- return this._orientation;
5766
- }
5767
- get minimumSize() {
5768
- const headerSize = this.headerSize;
5769
- const expanded = this.isExpanded();
5770
- const minimumBodySize = expanded ? this._minimumBodySize : 0;
5771
- return headerSize + minimumBodySize;
5771
+ /**
5772
+ * A high-level implementation of splitview that works using 'panels'
5773
+ */
5774
+ class SplitviewComponent extends CompositeDisposable {
5775
+ get panels() {
5776
+ return this.splitview.getViews();
5772
5777
  }
5773
- get maximumSize() {
5774
- const headerSize = this.headerSize;
5775
- const expanded = this.isExpanded();
5776
- const maximumBodySize = expanded ? this._maximumBodySize : 0;
5777
- return headerSize + maximumBodySize;
5778
+ get options() {
5779
+ return this._options;
5778
5780
  }
5779
- get size() {
5780
- return this._size;
5781
+ get length() {
5782
+ return this._panels.size;
5781
5783
  }
5782
- get orthogonalSize() {
5783
- return this._orthogonalSize;
5784
+ get orientation() {
5785
+ return this.splitview.orientation;
5784
5786
  }
5785
- set orthogonalSize(size) {
5786
- this._orthogonalSize = size;
5787
+ get splitview() {
5788
+ return this._splitview;
5787
5789
  }
5788
- get minimumBodySize() {
5789
- return this._minimumBodySize;
5790
+ set splitview(value) {
5791
+ this._splitview = value;
5792
+ this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
5793
+ this._onDidLayoutChange.fire(undefined);
5794
+ }), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
5790
5795
  }
5791
- set minimumBodySize(value) {
5792
- this._minimumBodySize = typeof value === 'number' ? value : 0;
5796
+ get minimumSize() {
5797
+ return this.splitview.minimumSize;
5793
5798
  }
5794
- get maximumBodySize() {
5795
- return this._maximumBodySize;
5799
+ get maximumSize() {
5800
+ return this.splitview.maximumSize;
5796
5801
  }
5797
- set maximumBodySize(value) {
5798
- this._maximumBodySize =
5799
- typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
5802
+ get height() {
5803
+ return this.splitview.orientation === Orientation.HORIZONTAL
5804
+ ? this.splitview.orthogonalSize
5805
+ : this.splitview.size;
5800
5806
  }
5801
- get headerVisible() {
5802
- return this._headerVisible;
5807
+ get width() {
5808
+ return this.splitview.orientation === Orientation.HORIZONTAL
5809
+ ? this.splitview.size
5810
+ : this.splitview.orthogonalSize;
5803
5811
  }
5804
- set headerVisible(value) {
5805
- this._headerVisible = value;
5806
- this.header.style.display = value ? '' : 'none';
5812
+ constructor(element, options) {
5813
+ super();
5814
+ this.element = element;
5815
+ this._disposable = new MutableDisposable();
5816
+ this._panels = new Map();
5817
+ this._onDidLayoutfromJSON = new Emitter();
5818
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5819
+ this._onDidAddView = new Emitter();
5820
+ this.onDidAddView = this._onDidAddView.event;
5821
+ this._onDidRemoveView = new Emitter();
5822
+ this.onDidRemoveView = this._onDidRemoveView.event;
5823
+ this._onDidLayoutChange = new Emitter();
5824
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
5825
+ this._options = options;
5826
+ if (!options.components) {
5827
+ options.components = {};
5828
+ }
5829
+ if (!options.frameworkComponents) {
5830
+ options.frameworkComponents = {};
5831
+ }
5832
+ this.splitview = new Splitview(this.element, options);
5833
+ this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5807
5834
  }
5808
- constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5809
- super(id, component, new PaneviewPanelApiImpl(id));
5810
- this.headerComponent = headerComponent;
5811
- this._onDidChangeExpansionState = new Emitter({ replay: true });
5812
- this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
5813
- this._onDidChange = new Emitter();
5814
- this.onDidChange = this._onDidChange.event;
5815
- this.headerSize = 22;
5816
- this._orthogonalSize = 0;
5817
- this._size = 0;
5818
- this._minimumBodySize = 100;
5819
- this._maximumBodySize = Number.POSITIVE_INFINITY;
5820
- this._isExpanded = false;
5821
- this.expandedSize = 0;
5822
- this.api.pane = this; // TODO cannot use 'this' before 'super'
5823
- this.api.initialize(this);
5824
- this._isExpanded = isExpanded;
5825
- this._headerVisible = isHeaderVisible;
5826
- this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
5827
- this._orientation = orientation;
5828
- this.element.classList.add('pane');
5829
- this.addDisposables(this.api.onDidSizeChange((event) => {
5830
- this._onDidChange.fire({ size: event.size });
5831
- }), addDisposableListener(this.element, 'mouseenter', (ev) => {
5832
- this.api._onMouseEnter.fire(ev);
5833
- }), addDisposableListener(this.element, 'mouseleave', (ev) => {
5834
- this.api._onMouseLeave.fire(ev);
5835
- }));
5836
- this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
5837
- this.api._onDidExpansionChange.fire({
5838
- isExpanded: isPanelExpanded,
5839
- });
5840
- }), this.api.onDidFocusChange((e) => {
5841
- if (!this.header) {
5842
- return;
5843
- }
5844
- if (e.isFocused) {
5845
- addClasses(this.header, 'focused');
5846
- }
5847
- else {
5848
- removeClasses(this.header, 'focused');
5849
- }
5850
- }));
5851
- this.renderOnce();
5835
+ updateOptions(options) {
5836
+ const hasOrientationChanged = typeof options.orientation === 'string' &&
5837
+ this.options.orientation !== options.orientation;
5838
+ this._options = Object.assign(Object.assign({}, this.options), options);
5839
+ if (hasOrientationChanged) {
5840
+ this.splitview.orientation = options.orientation;
5841
+ }
5842
+ this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
5852
5843
  }
5853
- setVisible(isVisible) {
5854
- this.api._onDidVisibilityChange.fire({ isVisible });
5844
+ focus() {
5845
+ var _a;
5846
+ (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
5855
5847
  }
5856
- setActive(isActive) {
5857
- this.api._onDidActiveChange.fire({ isActive });
5848
+ movePanel(from, to) {
5849
+ this.splitview.moveView(from, to);
5858
5850
  }
5859
- isExpanded() {
5860
- return this._isExpanded;
5851
+ setVisible(panel, visible) {
5852
+ const index = this.panels.indexOf(panel);
5853
+ this.splitview.setViewVisible(index, visible);
5861
5854
  }
5862
- setExpanded(expanded) {
5863
- if (this._isExpanded === expanded) {
5864
- return;
5865
- }
5866
- this._isExpanded = expanded;
5867
- if (expanded) {
5868
- if (this.animationTimer) {
5869
- clearTimeout(this.animationTimer);
5870
- }
5871
- if (this.body) {
5872
- this.element.appendChild(this.body);
5855
+ setActive(view, skipFocus) {
5856
+ this._activePanel = view;
5857
+ this.panels
5858
+ .filter((v) => v !== view)
5859
+ .forEach((v) => {
5860
+ v.api._onDidActiveChange.fire({ isActive: false });
5861
+ if (!skipFocus) {
5862
+ v.focus();
5873
5863
  }
5864
+ });
5865
+ view.api._onDidActiveChange.fire({ isActive: true });
5866
+ if (!skipFocus) {
5867
+ view.focus();
5874
5868
  }
5875
- else {
5876
- this.animationTimer = setTimeout(() => {
5877
- var _a;
5878
- (_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
5879
- }, 200);
5880
- }
5881
- this._onDidChange.fire(expanded ? { size: this.width } : {});
5882
- this._onDidChangeExpansionState.fire(expanded);
5883
- }
5884
- layout(size, orthogonalSize) {
5885
- this._size = size;
5886
- this._orthogonalSize = orthogonalSize;
5887
- const [width, height] = this.orientation === Orientation.HORIZONTAL
5888
- ? [size, orthogonalSize]
5889
- : [orthogonalSize, size];
5890
- if (this.isExpanded()) {
5891
- this.expandedSize = width;
5892
- }
5893
- super.layout(width, height);
5894
5869
  }
5895
- init(parameters) {
5896
- var _a, _b;
5897
- super.init(parameters);
5898
- if (typeof parameters.minimumBodySize === 'number') {
5899
- this.minimumBodySize = parameters.minimumBodySize;
5870
+ removePanel(panel, sizing) {
5871
+ const disposable = this._panels.get(panel.id);
5872
+ if (!disposable) {
5873
+ throw new Error(`unknown splitview panel ${panel.id}`);
5900
5874
  }
5901
- if (typeof parameters.maximumBodySize === 'number') {
5902
- this.maximumBodySize = parameters.maximumBodySize;
5875
+ disposable.disposable.dispose();
5876
+ disposable.value.dispose();
5877
+ this._panels.delete(panel.id);
5878
+ const index = this.panels.findIndex((_) => _ === panel);
5879
+ this.splitview.removeView(index, sizing);
5880
+ const panels = this.panels;
5881
+ if (panels.length > 0) {
5882
+ this.setActive(panels[panels.length - 1]);
5903
5883
  }
5904
- this.bodyPart = this.getBodyComponent();
5905
- this.headerPart = this.getHeaderComponent();
5906
- this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
5907
- this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
5908
- (_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);
5909
- (_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
5910
- if (typeof parameters.isExpanded === 'boolean') {
5911
- this.setExpanded(parameters.isExpanded);
5884
+ }
5885
+ getPanel(id) {
5886
+ return this.panels.find((view) => view.id === id);
5887
+ }
5888
+ addPanel(options) {
5889
+ if (this._panels.has(options.id)) {
5890
+ throw new Error(`panel ${options.id} already exists`);
5912
5891
  }
5892
+ const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5893
+ ? {
5894
+ createComponent: this.options.frameworkWrapper.createComponent,
5895
+ }
5896
+ : undefined);
5897
+ view.orientation = this.splitview.orientation;
5898
+ view.init({
5899
+ params: options.params || {},
5900
+ minimumSize: options.minimumSize,
5901
+ maximumSize: options.maximumSize,
5902
+ snap: options.snap,
5903
+ priority: options.priority,
5904
+ accessor: this,
5905
+ });
5906
+ const size = typeof options.size === 'number' ? options.size : Sizing.Distribute;
5907
+ const index = typeof options.index === 'number' ? options.index : undefined;
5908
+ this.splitview.addView(view, size, index);
5909
+ this.doAddView(view);
5910
+ this.setActive(view);
5911
+ return view;
5913
5912
  }
5914
- toJSON() {
5915
- const params = this._params;
5916
- return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
5913
+ layout(width, height) {
5914
+ const [size, orthogonalSize] = this.splitview.orientation === Orientation.HORIZONTAL
5915
+ ? [width, height]
5916
+ : [height, width];
5917
+ this.splitview.layout(size, orthogonalSize);
5917
5918
  }
5918
- renderOnce() {
5919
- this.header = document.createElement('div');
5920
- this.header.tabIndex = 0;
5921
- this.header.className = 'pane-header';
5922
- this.header.style.height = `${this.headerSize}px`;
5923
- this.header.style.lineHeight = `${this.headerSize}px`;
5924
- this.header.style.minHeight = `${this.headerSize}px`;
5925
- this.header.style.maxHeight = `${this.headerSize}px`;
5926
- this.element.appendChild(this.header);
5927
- this.body = document.createElement('div');
5928
- this.body.className = 'pane-body';
5929
- this.element.appendChild(this.body);
5919
+ doAddView(view) {
5920
+ const disposable = view.api.onDidFocusChange((event) => {
5921
+ if (!event.isFocused) {
5922
+ return;
5923
+ }
5924
+ this.setActive(view, true);
5925
+ });
5926
+ this._panels.set(view.id, { disposable, value: view });
5930
5927
  }
5931
- // TODO slightly hacky by-pass of the component to create a body and header component
5932
- getComponent() {
5928
+ toJSON() {
5929
+ var _a;
5930
+ const views = this.splitview
5931
+ .getViews()
5932
+ .map((view, i) => {
5933
+ const size = this.splitview.getViewSize(i);
5934
+ return {
5935
+ size,
5936
+ data: view.toJSON(),
5937
+ snap: !!view.snap,
5938
+ priority: view.priority,
5939
+ };
5940
+ });
5933
5941
  return {
5934
- update: (params) => {
5935
- var _a, _b;
5936
- (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
5937
- (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
5938
- },
5939
- dispose: () => {
5940
- var _a, _b;
5941
- (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
5942
- (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
5943
- },
5942
+ views,
5943
+ activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
5944
+ size: this.splitview.size,
5945
+ orientation: this.splitview.orientation,
5944
5946
  };
5945
5947
  }
5946
- }
5947
-
5948
- class DraggablePaneviewPanel extends PaneviewPanel {
5949
- constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
5950
- super(id, component, headerComponent, orientation, isExpanded, true);
5951
- this.accessor = accessor;
5952
- this._onDidDrop = new Emitter();
5953
- this.onDidDrop = this._onDidDrop.event;
5954
- if (!disableDnd) {
5955
- this.initDragFeatures();
5956
- }
5957
- }
5958
- initDragFeatures() {
5959
- if (!this.header) {
5960
- return;
5961
- }
5962
- const id = this.id;
5963
- const accessorId = this.accessor.id;
5964
- this.header.draggable = true;
5965
- this.handler = new (class PaneDragHandler extends DragHandler {
5966
- getData() {
5967
- LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
5968
- return {
5969
- dispose: () => {
5970
- LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
5971
- },
5972
- };
5973
- }
5974
- })(this.header);
5975
- this.target = new Droptarget(this.element, {
5976
- acceptedTargetZones: ['top', 'bottom'],
5977
- overlayModel: {
5978
- activationSize: { type: 'percentage', value: 50 },
5979
- },
5980
- canDisplayOverlay: (event) => {
5981
- const data = getPaneData();
5982
- if (data) {
5983
- if (data.paneId !== this.id &&
5984
- data.viewId === this.accessor.id) {
5985
- return true;
5948
+ fromJSON(serializedSplitview) {
5949
+ this.clear();
5950
+ const { views, orientation, size, activeView } = serializedSplitview;
5951
+ const queue = [];
5952
+ this.splitview = new Splitview(this.element, {
5953
+ orientation,
5954
+ proportionalLayout: this.options.proportionalLayout,
5955
+ descriptor: {
5956
+ size,
5957
+ views: views.map((view) => {
5958
+ const data = view.data;
5959
+ if (this._panels.has(data.id)) {
5960
+ throw new Error(`panel ${data.id} already exists`);
5986
5961
  }
5987
- }
5988
- if (this.accessor.options.showDndOverlay) {
5989
- return this.accessor.options.showDndOverlay({
5990
- nativeEvent: event,
5991
- getData: getPaneData,
5992
- panel: this,
5962
+ const panel = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5963
+ ? {
5964
+ createComponent: this.options.frameworkWrapper
5965
+ .createComponent,
5966
+ }
5967
+ : undefined);
5968
+ queue.push(() => {
5969
+ panel.init({
5970
+ params: data.params || {},
5971
+ minimumSize: data.minimumSize,
5972
+ maximumSize: data.maximumSize,
5973
+ snap: view.snap,
5974
+ priority: view.priority,
5975
+ accessor: this,
5976
+ });
5993
5977
  });
5994
- }
5995
- return false;
5978
+ panel.orientation = orientation;
5979
+ this.doAddView(panel);
5980
+ setTimeout(() => {
5981
+ // the original onDidAddView events are missed since they are fired before we can subcribe to them
5982
+ this._onDidAddView.fire(panel);
5983
+ }, 0);
5984
+ return { size: view.size, view: panel };
5985
+ }),
5996
5986
  },
5997
5987
  });
5998
- this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
5999
- this.onDrop(event);
6000
- }));
6001
- }
6002
- onDrop(event) {
6003
- const data = getPaneData();
6004
- if (!data || data.viewId !== this.accessor.id) {
6005
- // if there is no local drag event for this panel
6006
- // or if the drag event was creating by another Paneview instance
6007
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
6008
- return;
6009
- }
6010
- const containerApi = this._params
6011
- .containerApi;
6012
- const panelId = data.paneId;
6013
- const existingPanel = containerApi.getPanel(panelId);
6014
- if (!existingPanel) {
6015
- // if the panel doesn't exist
6016
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
6017
- return;
5988
+ this.layout(this.width, this.height);
5989
+ queue.forEach((f) => f());
5990
+ if (typeof activeView === 'string') {
5991
+ const panel = this.getPanel(activeView);
5992
+ if (panel) {
5993
+ this.setActive(panel);
5994
+ }
6018
5995
  }
6019
- const allPanels = containerApi.panels;
6020
- const fromIndex = allPanels.indexOf(existingPanel);
6021
- let toIndex = containerApi.panels.indexOf(this);
6022
- if (event.position === 'left' || event.position === 'top') {
6023
- toIndex = Math.max(0, toIndex - 1);
5996
+ this._onDidLayoutfromJSON.fire();
5997
+ }
5998
+ clear() {
5999
+ for (const [_, value] of this._panels.entries()) {
6000
+ value.disposable.dispose();
6001
+ value.value.dispose();
6024
6002
  }
6025
- if (event.position === 'right' || event.position === 'bottom') {
6026
- if (fromIndex > toIndex) {
6027
- toIndex++;
6028
- }
6029
- toIndex = Math.min(allPanels.length - 1, toIndex);
6003
+ this._panels.clear();
6004
+ this.splitview.dispose();
6005
+ }
6006
+ dispose() {
6007
+ for (const [_, value] of this._panels.entries()) {
6008
+ value.disposable.dispose();
6009
+ value.value.dispose();
6030
6010
  }
6031
- containerApi.movePanel(fromIndex, toIndex);
6011
+ this._panels.clear();
6012
+ this.splitview.dispose();
6013
+ super.dispose();
6032
6014
  }
6033
6015
  }
6034
6016
 
@@ -6171,7 +6153,7 @@ class PaneviewComponent extends CompositeDisposable {
6171
6153
  this.addDisposables(this._disposable);
6172
6154
  }
6173
6155
  focus() {
6174
- //
6156
+ //noop
6175
6157
  }
6176
6158
  updateOptions(options) {
6177
6159
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -6490,7 +6472,10 @@ ReactComponentBridge.displayName = 'DockviewReactJsBridge';
6490
6472
  * require a key property like any other React element rendered in an array
6491
6473
  * to prevent excessive re-rendering
6492
6474
  */
6493
- const uniquePortalKeyGenerator = sequentialNumberGenerator();
6475
+ const uniquePortalKeyGenerator = (() => {
6476
+ let value = 1;
6477
+ return { next: () => `dockview_react_portal_key_${(value++).toString()}` };
6478
+ })();
6494
6479
  const ReactPartContext = React.createContext({});
6495
6480
  class ReactPart {
6496
6481
  constructor(parent, portalStore, component, parameters, context) {
@@ -6607,18 +6592,10 @@ class ReactPanelContentPart {
6607
6592
  containerApi: parameters.containerApi,
6608
6593
  });
6609
6594
  }
6610
- toJSON() {
6611
- return {
6612
- id: this.id,
6613
- };
6614
- }
6615
6595
  update(event) {
6616
6596
  var _a;
6617
6597
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6618
6598
  }
6619
- updateParentGroup(group, _isPanelVisible) {
6620
- this._group = group;
6621
- }
6622
6599
  layout(_width, _height) {
6623
6600
  // noop
6624
6601
  }
@@ -6655,60 +6632,15 @@ class ReactPanelHeaderPart {
6655
6632
  var _a;
6656
6633
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6657
6634
  }
6658
- toJSON() {
6659
- if (this.id === DEFAULT_TAB_IDENTIFIER) {
6660
- return {};
6661
- }
6662
- return {
6663
- id: this.id,
6664
- };
6665
- }
6666
6635
  layout(_width, _height) {
6667
6636
  // noop - retrieval from api
6668
6637
  }
6669
- updateParentGroup(_group, _isPanelVisible) {
6670
- // noop - retrieval from api
6671
- }
6672
6638
  dispose() {
6673
6639
  var _a;
6674
6640
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
6675
6641
  }
6676
6642
  }
6677
6643
 
6678
- class ReactPanelDeserialzier {
6679
- constructor(layout) {
6680
- this.layout = layout;
6681
- }
6682
- fromJSON(panelData, group) {
6683
- var _a, _b, _c, _d;
6684
- const panelId = panelData.id;
6685
- const params = panelData.params;
6686
- const title = panelData.title;
6687
- const viewData = panelData.view;
6688
- let tab;
6689
- if ((_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id) {
6690
- 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());
6691
- }
6692
- else if (this.layout.options.defaultTabComponent) {
6693
- 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());
6694
- }
6695
- else {
6696
- tab = new DefaultTab();
6697
- }
6698
- const view = new DefaultGroupPanelView({
6699
- 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),
6700
- tab,
6701
- });
6702
- const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6703
- panel.init({
6704
- view,
6705
- title,
6706
- params: params || {},
6707
- });
6708
- return panel;
6709
- }
6710
- }
6711
-
6712
6644
  class ReactWatermarkPart {
6713
6645
  get element() {
6714
6646
  return this._element;
@@ -6717,21 +6649,16 @@ class ReactWatermarkPart {
6717
6649
  this.id = id;
6718
6650
  this.component = component;
6719
6651
  this.reactPortalStore = reactPortalStore;
6720
- this._groupRef = {
6721
- value: undefined,
6722
- };
6723
6652
  this._element = document.createElement('div');
6724
6653
  this._element.className = 'dockview-react-part';
6725
6654
  }
6726
6655
  init(parameters) {
6727
- this.parameters = parameters;
6728
6656
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6729
- params: parameters.params,
6730
- api: parameters.api,
6657
+ group: parameters.group,
6731
6658
  containerApi: parameters.containerApi,
6732
6659
  close: () => {
6733
- if (this._groupRef.value) {
6734
- parameters.containerApi.removeGroup(this._groupRef.value);
6660
+ if (parameters.group) {
6661
+ parameters.containerApi.removeGroup(parameters.group);
6735
6662
  }
6736
6663
  },
6737
6664
  });
@@ -6746,17 +6673,11 @@ class ReactWatermarkPart {
6746
6673
  }
6747
6674
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: ((_b = this.parameters) === null || _b === void 0 ? void 0 : _b.params) || {} });
6748
6675
  }
6749
- toJSON() {
6750
- return {
6751
- id: this.id,
6752
- };
6753
- }
6754
6676
  layout(_width, _height) {
6755
6677
  // noop - retrieval from api
6756
6678
  }
6757
- updateParentGroup(group, _isPanelVisible) {
6758
- // noop - retrieval from api
6759
- this._groupRef.value = group;
6679
+ updateParentGroup(_group, _isPanelVisible) {
6680
+ // noop
6760
6681
  }
6761
6682
  dispose() {
6762
6683
  var _a;
@@ -6838,6 +6759,7 @@ function createGroupControlElement(component, store) {
6838
6759
  }
6839
6760
  : undefined;
6840
6761
  }
6762
+ const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
6841
6763
  const DockviewReact = React.forwardRef((props, ref) => {
6842
6764
  const domRef = React.useRef(null);
6843
6765
  const dockviewRef = React.useRef();
@@ -6884,13 +6806,20 @@ const DockviewReact = React.forwardRef((props, ref) => {
6884
6806
  },
6885
6807
  };
6886
6808
  const element = document.createElement('div');
6809
+ const frameworkTabComponents = props.tabComponents || {};
6810
+ if (props.defaultTabComponent) {
6811
+ frameworkTabComponents[DEFAULT_REACT_TAB] =
6812
+ props.defaultTabComponent;
6813
+ }
6887
6814
  const dockview = new DockviewComponent(element, {
6888
6815
  frameworkComponentFactory: factory,
6889
6816
  frameworkComponents: props.components,
6890
- frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6817
+ frameworkTabComponents,
6891
6818
  tabHeight: props.tabHeight,
6892
6819
  watermarkFrameworkComponent: props.watermarkComponent,
6893
- defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6820
+ defaultTabComponent: props.defaultTabComponent
6821
+ ? DEFAULT_REACT_TAB
6822
+ : undefined,
6894
6823
  styles: props.hideBorders
6895
6824
  ? { separatorBorder: 'transparent' }
6896
6825
  : undefined,
@@ -6899,7 +6828,6 @@ const DockviewReact = React.forwardRef((props, ref) => {
6899
6828
  singleTabMode: props.singleTabMode,
6900
6829
  });
6901
6830
  (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
6902
- dockview.deserializer = new ReactPanelDeserialzier(dockview);
6903
6831
  const { clientWidth, clientHeight } = domRef.current;
6904
6832
  dockview.layout(clientWidth, clientHeight);
6905
6833
  if (props.onReady) {
@@ -6962,9 +6890,16 @@ const DockviewReact = React.forwardRef((props, ref) => {
6962
6890
  if (!dockviewRef.current) {
6963
6891
  return;
6964
6892
  }
6893
+ const frameworkTabComponents = props.tabComponents || {};
6894
+ if (props.defaultTabComponent) {
6895
+ frameworkTabComponents[DEFAULT_REACT_TAB] =
6896
+ props.defaultTabComponent;
6897
+ }
6965
6898
  dockviewRef.current.updateOptions({
6966
- defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6967
- frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6899
+ defaultTabComponent: props.defaultTabComponent
6900
+ ? DEFAULT_REACT_TAB
6901
+ : undefined,
6902
+ frameworkTabComponents,
6968
6903
  });
6969
6904
  }, [props.defaultTabComponent]);
6970
6905
  React.useEffect(() => {
@@ -7109,7 +7044,7 @@ SplitviewReact.displayName = 'SplitviewComponent';
7109
7044
 
7110
7045
  class ReactGridPanelView extends GridviewPanel {
7111
7046
  constructor(id, component, reactComponent, reactPortalStore) {
7112
- super(id, component, new GridviewPanelApiImpl(id));
7047
+ super(id, component);
7113
7048
  this.reactComponent = reactComponent;
7114
7049
  this.reactPortalStore = reactPortalStore;
7115
7050
  }
@@ -7317,4 +7252,4 @@ const PaneviewReact = React.forwardRef((props, ref) => {
7317
7252
  });
7318
7253
  PaneviewReact.displayName = 'PaneviewComponent';
7319
7254
 
7320
- export { BaseGrid, ContentContainer, DockviewApi, DockviewComponent, DockviewDefaultTab, DockviewDropTargets, DockviewReact, Event, Gridview, GridviewApi, GridviewComponent, GridviewPanel, GridviewReact, Groupview, LayoutPriority, LocalSelectionTransfer, Orientation, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewReact, ReactPart, ReactPartContext, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, SplitviewReact, Tab, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, isReactElement, orthogonal, positionToDirection, toTarget, usePortalsLifecycle };
7255
+ export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDefaultTab, DockviewDropTargets, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewReact, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, GridviewReact, LayoutPriority, LocalSelectionTransfer, Orientation, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewReact, ReactPart, ReactPartContext, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, SplitviewReact, Tab, createComponent, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, isReactElement, orthogonal, positionToDirection, toTarget, usePortalsLifecycle, watchElementResize };