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
package/dist/dockview.js CHANGED
@@ -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
  */
@@ -57,7 +57,7 @@
57
57
  }
58
58
  }
59
59
 
60
- 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}";
60
+ 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}";
61
61
  styleInject(css_248z);
62
62
 
63
63
  class TransferObject {
@@ -130,7 +130,7 @@
130
130
  return paneTransfer.getData(PaneTransfer.prototype)[0];
131
131
  }
132
132
 
133
- exports.Event = void 0;
133
+ exports.DockviewEvent = void 0;
134
134
  (function (Event) {
135
135
  Event.any = (...children) => {
136
136
  return (listener) => {
@@ -144,7 +144,7 @@
144
144
  };
145
145
  };
146
146
  };
147
- })(exports.Event || (exports.Event = {}));
147
+ })(exports.DockviewEvent || (exports.DockviewEvent = {}));
148
148
  // dumb event emitter with better typings than nodes event emitter
149
149
  // https://github.com/microsoft/vscode/blob/master/src/vs/base/common/event.ts
150
150
  class Emitter {
@@ -371,16 +371,30 @@
371
371
  }
372
372
  }
373
373
 
374
- const clamp = (value, min, max) => {
375
- if (min > max) {
376
- throw new Error(`${min} > ${max} is an invalid condition`);
374
+ function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
375
+ const Component = typeof componentName === 'string'
376
+ ? components[componentName]
377
+ : undefined;
378
+ const FrameworkComponent = typeof componentName === 'string'
379
+ ? frameworkComponents[componentName]
380
+ : undefined;
381
+ if (Component && FrameworkComponent) {
382
+ throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
377
383
  }
378
- return Math.min(max, Math.max(value, min));
379
- };
380
- const sequentialNumberGenerator = () => {
381
- let value = 1;
382
- return { next: () => (value++).toString() };
383
- };
384
+ if (FrameworkComponent) {
385
+ if (!createFrameworkComponent) {
386
+ throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
387
+ }
388
+ return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
389
+ }
390
+ if (!Component) {
391
+ if (fallback) {
392
+ return fallback();
393
+ }
394
+ throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
395
+ }
396
+ return new Component(id, componentName);
397
+ }
384
398
 
385
399
  function tail(arr) {
386
400
  if (arr.length === 0) {
@@ -422,6 +436,26 @@
422
436
  arr.push(value);
423
437
  }
424
438
  }
439
+ function firstIndex(array, fn) {
440
+ for (let i = 0; i < array.length; i++) {
441
+ const element = array[i];
442
+ if (fn(element)) {
443
+ return i;
444
+ }
445
+ }
446
+ return -1;
447
+ }
448
+
449
+ const clamp = (value, min, max) => {
450
+ if (min > max) {
451
+ throw new Error(`${min} > ${max} is an invalid condition`);
452
+ }
453
+ return Math.min(max, Math.max(value, min));
454
+ };
455
+ const sequentialNumberGenerator = () => {
456
+ let value = 1;
457
+ return { next: () => (value++).toString() };
458
+ };
425
459
  const range = (from, to) => {
426
460
  const result = [];
427
461
  if (typeof to !== 'number') {
@@ -440,15 +474,6 @@
440
474
  }
441
475
  return result;
442
476
  };
443
- function firstIndex(array, fn) {
444
- for (let i = 0; i < array.length; i++) {
445
- const element = array[i];
446
- if (fn(element)) {
447
- return i;
448
- }
449
- }
450
- return -1;
451
- }
452
477
 
453
478
  class ViewItem {
454
479
  set size(size) {
@@ -463,25 +488,6 @@
463
488
  get visible() {
464
489
  return typeof this._cachedVisibleSize === 'undefined';
465
490
  }
466
- setVisible(visible, size) {
467
- var _a;
468
- if (visible === this.visible) {
469
- return;
470
- }
471
- if (visible) {
472
- this.size = clamp((_a = this._cachedVisibleSize) !== null && _a !== void 0 ? _a : 0, this.viewMinimumSize, this.viewMaximumSize);
473
- this._cachedVisibleSize = undefined;
474
- }
475
- else {
476
- this._cachedVisibleSize =
477
- typeof size === 'number' ? size : this.size;
478
- this.size = 0;
479
- }
480
- this.container.classList.toggle('visible', visible);
481
- if (this.view.setVisible) {
482
- this.view.setVisible(visible);
483
- }
484
- }
485
491
  get minimumSize() {
486
492
  return this.visible ? this.view.minimumSize : 0;
487
493
  }
@@ -518,11 +524,25 @@
518
524
  this._cachedVisibleSize = size.cachedVisibleSize;
519
525
  }
520
526
  }
521
- // layout(offset: number, layoutContext: TLayoutContext | undefined): void {
522
- // this.layoutContainer(offset);
523
- // this.view.layout(this.size, offset, layoutContext);
524
- // }
525
- // abstract layoutContainer(offset: number): void;
527
+ setVisible(visible, size) {
528
+ var _a;
529
+ if (visible === this.visible) {
530
+ return;
531
+ }
532
+ if (visible) {
533
+ this.size = clamp((_a = this._cachedVisibleSize) !== null && _a !== void 0 ? _a : 0, this.viewMinimumSize, this.viewMaximumSize);
534
+ this._cachedVisibleSize = undefined;
535
+ }
536
+ else {
537
+ this._cachedVisibleSize =
538
+ typeof size === 'number' ? size : this.size;
539
+ this.size = 0;
540
+ }
541
+ this.container.classList.toggle('visible', visible);
542
+ if (this.view.setVisible) {
543
+ this.view.setVisible(visible);
544
+ }
545
+ }
526
546
  dispose() {
527
547
  this.disposable.dispose();
528
548
  return this.view;
@@ -631,14 +651,14 @@
631
651
  this._orthogonalSize = 0;
632
652
  this.contentSize = 0;
633
653
  this._proportions = undefined;
654
+ this._startSnappingEnabled = true;
655
+ this._endSnappingEnabled = true;
634
656
  this._onDidSashEnd = new Emitter();
635
657
  this.onDidSashEnd = this._onDidSashEnd.event;
636
658
  this._onDidAddView = new Emitter();
637
659
  this.onDidAddView = this._onDidAddView.event;
638
660
  this._onDidRemoveView = new Emitter();
639
661
  this.onDidRemoveView = this._onDidRemoveView.event;
640
- this._startSnappingEnabled = true;
641
- this._endSnappingEnabled = true;
642
662
  this.resize = (index, delta, sizes = this.views.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {
643
663
  if (index < 0 || index > this.views.length) {
644
664
  return 0;
@@ -1533,10 +1553,10 @@
1533
1553
  this.orientation = orientation;
1534
1554
  this.proportionalLayout = proportionalLayout;
1535
1555
  this.styles = styles;
1556
+ this._childrenDisposable = Disposable.NONE;
1536
1557
  this.children = [];
1537
1558
  this._onDidChange = new Emitter();
1538
1559
  this.onDidChange = this._onDidChange.event;
1539
- this._childrenDisposable = Disposable.NONE;
1540
1560
  this._orthogonalSize = orthogonalSize;
1541
1561
  this._size = size;
1542
1562
  this.element = document.createElement('div');
@@ -1657,7 +1677,7 @@
1657
1677
  }
1658
1678
  setupChildrenEvents() {
1659
1679
  this._childrenDisposable.dispose();
1660
- this._childrenDisposable = exports.Event.any(...this.children.map((c) => c.onDidChange))((e) => {
1680
+ this._childrenDisposable = exports.DockviewEvent.any(...this.children.map((c) => c.onDidChange))((e) => {
1661
1681
  /**
1662
1682
  * indicate a change has occured to allows any re-rendering but don't bubble
1663
1683
  * event because that was specific to this branch
@@ -1795,6 +1815,35 @@
1795
1815
  get length() {
1796
1816
  return this._root ? this._root.children.length : 0;
1797
1817
  }
1818
+ get orientation() {
1819
+ return this.root.orientation;
1820
+ }
1821
+ set orientation(orientation) {
1822
+ if (this.root.orientation === orientation) {
1823
+ return;
1824
+ }
1825
+ const { size, orthogonalSize } = this.root;
1826
+ this.root = flipNode(this.root, orthogonalSize, size);
1827
+ this.root.layout(size, orthogonalSize);
1828
+ }
1829
+ get width() {
1830
+ return this.root.width;
1831
+ }
1832
+ get height() {
1833
+ return this.root.height;
1834
+ }
1835
+ get minimumWidth() {
1836
+ return this.root.minimumWidth;
1837
+ }
1838
+ get minimumHeight() {
1839
+ return this.root.minimumHeight;
1840
+ }
1841
+ get maximumWidth() {
1842
+ return this.root.maximumHeight;
1843
+ }
1844
+ get maximumHeight() {
1845
+ return this.root.maximumHeight;
1846
+ }
1798
1847
  serialize() {
1799
1848
  const root = serializeBranchNode(this.getView(), this.orientation);
1800
1849
  return {
@@ -1841,17 +1890,6 @@
1841
1890
  }
1842
1891
  return result;
1843
1892
  }
1844
- get orientation() {
1845
- return this.root.orientation;
1846
- }
1847
- set orientation(orientation) {
1848
- if (this.root.orientation === orientation) {
1849
- return;
1850
- }
1851
- const { size, orthogonalSize } = this.root;
1852
- this.root = flipNode(this.root, orthogonalSize, size);
1853
- this.root.layout(size, orthogonalSize);
1854
- }
1855
1893
  get root() {
1856
1894
  return this._root;
1857
1895
  }
@@ -1933,24 +1971,6 @@
1933
1971
  }
1934
1972
  return findLeaf(this.root, reverse);
1935
1973
  }
1936
- get width() {
1937
- return this.root.width;
1938
- }
1939
- get height() {
1940
- return this.root.height;
1941
- }
1942
- get minimumWidth() {
1943
- return this.root.minimumWidth;
1944
- }
1945
- get minimumHeight() {
1946
- return this.root.minimumHeight;
1947
- }
1948
- get maximumWidth() {
1949
- return this.root.maximumHeight;
1950
- }
1951
- get maximumHeight() {
1952
- return this.root.maximumHeight;
1953
- }
1954
1974
  constructor(proportionalLayout, styles, orientation) {
1955
1975
  this.proportionalLayout = proportionalLayout;
1956
1976
  this.styles = styles;
@@ -2455,10 +2475,6 @@
2455
2475
  }
2456
2476
  }
2457
2477
 
2458
- function isBooleanValue(value) {
2459
- return typeof value === 'boolean';
2460
- }
2461
-
2462
2478
  function numberOrFallback(maybeNumber, fallback) {
2463
2479
  return typeof maybeNumber === 'number' ? maybeNumber : fallback;
2464
2480
  }
@@ -2523,7 +2539,7 @@
2523
2539
  this.removeDropTarget();
2524
2540
  return;
2525
2541
  }
2526
- if (isBooleanValue(this.options.canDisplayOverlay)) {
2542
+ if (typeof this.options.canDisplayOverlay === 'boolean') {
2527
2543
  if (!this.options.canDisplayOverlay) {
2528
2544
  return;
2529
2545
  }
@@ -2531,20 +2547,20 @@
2531
2547
  else if (!this.options.canDisplayOverlay(e, quadrant)) {
2532
2548
  return;
2533
2549
  }
2534
- if (!this.target) {
2535
- this.target = document.createElement('div');
2536
- this.target.className = 'drop-target-dropzone';
2537
- this.overlay = document.createElement('div');
2538
- this.overlay.className = 'drop-target-selection';
2550
+ if (!this.targetElement) {
2551
+ this.targetElement = document.createElement('div');
2552
+ this.targetElement.className = 'drop-target-dropzone';
2553
+ this.overlayElement = document.createElement('div');
2554
+ this.overlayElement.className = 'drop-target-selection';
2539
2555
  this._state = 'center';
2540
- this.target.appendChild(this.overlay);
2556
+ this.targetElement.appendChild(this.overlayElement);
2541
2557
  this.element.classList.add('drop-target');
2542
- this.element.append(this.target);
2558
+ this.element.append(this.targetElement);
2543
2559
  }
2544
2560
  if (this.options.acceptedTargetZones.length === 0) {
2545
2561
  return;
2546
2562
  }
2547
- if (!this.target || !this.overlay) {
2563
+ if (!this.targetElement || !this.overlayElement) {
2548
2564
  return;
2549
2565
  }
2550
2566
  this.toggleClasses(quadrant, width, height);
@@ -2558,10 +2574,12 @@
2558
2574
  },
2559
2575
  onDrop: (e) => {
2560
2576
  e.preventDefault();
2561
- e.stopPropagation();
2562
2577
  const state = this._state;
2563
2578
  this.removeDropTarget();
2564
2579
  if (state) {
2580
+ // only stop the propagation of the event if we are dealing with it
2581
+ // which is only when the target has state
2582
+ e.stopPropagation();
2565
2583
  this._onDrop.fire({ position: state, nativeEvent: e });
2566
2584
  }
2567
2585
  },
@@ -2572,7 +2590,7 @@
2572
2590
  }
2573
2591
  toggleClasses(quadrant, width, height) {
2574
2592
  var _a, _b, _c, _d;
2575
- if (!this.overlay) {
2593
+ if (!this.overlayElement) {
2576
2594
  return;
2577
2595
  }
2578
2596
  const isSmallX = width < 100;
@@ -2619,11 +2637,11 @@
2619
2637
  else {
2620
2638
  transform = '';
2621
2639
  }
2622
- this.overlay.style.transform = transform;
2623
- toggleClass(this.overlay, 'small-right', isSmallX && isRight);
2624
- toggleClass(this.overlay, 'small-left', isSmallX && isLeft);
2625
- toggleClass(this.overlay, 'small-top', isSmallY && isTop);
2626
- toggleClass(this.overlay, 'small-bottom', isSmallY && isBottom);
2640
+ this.overlayElement.style.transform = transform;
2641
+ toggleClass(this.overlayElement, 'small-right', isSmallX && isRight);
2642
+ toggleClass(this.overlayElement, 'small-left', isSmallX && isLeft);
2643
+ toggleClass(this.overlayElement, 'small-top', isSmallY && isTop);
2644
+ toggleClass(this.overlayElement, 'small-bottom', isSmallY && isBottom);
2627
2645
  }
2628
2646
  setState(quadrant) {
2629
2647
  switch (quadrant) {
@@ -2655,11 +2673,11 @@
2655
2673
  return calculateQuadrantAsPixels(overlayType, x, y, width, height, value);
2656
2674
  }
2657
2675
  removeDropTarget() {
2658
- if (this.target) {
2676
+ if (this.targetElement) {
2659
2677
  this._state = undefined;
2660
- this.element.removeChild(this.target);
2661
- this.target = undefined;
2662
- this.overlay = undefined;
2678
+ this.element.removeChild(this.targetElement);
2679
+ this.targetElement = undefined;
2680
+ this.overlayElement = undefined;
2663
2681
  this.element.classList.remove('drop-target');
2664
2682
  }
2665
2683
  }
@@ -2806,6 +2824,16 @@
2806
2824
  this.disposable.value = this.getData(event.dataTransfer);
2807
2825
  if (event.dataTransfer) {
2808
2826
  event.dataTransfer.effectAllowed = 'move';
2827
+ /**
2828
+ * Although this is not used by dockview many third party dnd libraries will check
2829
+ * dataTransfer.types to determine valid drag events.
2830
+ *
2831
+ * For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
2832
+ * through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
2833
+ * dnd logic. You can see the code at
2834
+ * https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
2835
+ */
2836
+ event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
2809
2837
  }
2810
2838
  }), addDisposableListener(this.el, 'dragend', () => {
2811
2839
  for (const iframe of this.iframes) {
@@ -2911,6 +2939,7 @@
2911
2939
  document.body.appendChild(ghostElement);
2912
2940
  dataTransfer.setDragImage(ghostElement, 0, 0);
2913
2941
  setTimeout(() => {
2942
+ removeClasses(ghostElement, 'dv-dragged');
2914
2943
  ghostElement.remove();
2915
2944
  }, 0);
2916
2945
  }
@@ -3046,10 +3075,6 @@
3046
3075
  return (this.selectedIndex > -1 &&
3047
3076
  this.tabs[this.selectedIndex].value === tab);
3048
3077
  }
3049
- at(index) {
3050
- var _a;
3051
- return (_a = this.tabs[index]) === null || _a === void 0 ? void 0 : _a.value;
3052
- }
3053
3078
  indexOf(id) {
3054
3079
  return this.tabs.findIndex((tab) => tab.value.panelId === id);
3055
3080
  }
@@ -3171,7 +3196,7 @@
3171
3196
  }
3172
3197
  }
3173
3198
 
3174
- class Groupview extends CompositeDisposable {
3199
+ class DockviewGroupPanelModel extends CompositeDisposable {
3175
3200
  get element() {
3176
3201
  throw new Error('not supported');
3177
3202
  }
@@ -3197,18 +3222,6 @@
3197
3222
  get isEmpty() {
3198
3223
  return this._panels.length === 0;
3199
3224
  }
3200
- get minimumHeight() {
3201
- return 100;
3202
- }
3203
- get maximumHeight() {
3204
- return Number.MAX_SAFE_INTEGER;
3205
- }
3206
- get minimumWidth() {
3207
- return 100;
3208
- }
3209
- get maximumWidth() {
3210
- return Number.MAX_SAFE_INTEGER;
3211
- }
3212
3225
  get hasWatermark() {
3213
3226
  return !!(this.watermark && this.container.contains(this.watermark.element));
3214
3227
  }
@@ -3381,8 +3394,8 @@
3381
3394
  //noop
3382
3395
  }
3383
3396
  focus() {
3384
- var _a;
3385
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
3397
+ var _a, _b;
3398
+ (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3386
3399
  }
3387
3400
  openPanel(panel, options = {}) {
3388
3401
  if (typeof options.index !== 'number' ||
@@ -3443,10 +3456,10 @@
3443
3456
  this.tabsContainer.setActionElement(element);
3444
3457
  }
3445
3458
  setActive(isGroupActive, skipFocus = false, force = false) {
3446
- var _a, _b;
3459
+ var _a, _b, _c, _d;
3447
3460
  if (!force && this.isActive === isGroupActive) {
3448
3461
  if (!skipFocus) {
3449
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
3462
+ (_b = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3450
3463
  }
3451
3464
  return;
3452
3465
  }
@@ -3460,7 +3473,7 @@
3460
3473
  this.updateContainer();
3461
3474
  if (isGroupActive) {
3462
3475
  if (!skipFocus) {
3463
- (_b = this._activePanel) === null || _b === void 0 ? void 0 : _b.focus();
3476
+ (_d = (_c = this._activePanel) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
3464
3477
  }
3465
3478
  }
3466
3479
  }
@@ -3531,15 +3544,14 @@
3531
3544
  this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
3532
3545
  }
3533
3546
  updateContainer() {
3547
+ var _a, _b;
3534
3548
  toggleClass(this.container, 'empty', this.isEmpty);
3535
3549
  this.panels.forEach((panel) => panel.updateParentGroup(this.groupPanel, this.isActive));
3536
3550
  if (this.isEmpty && !this.watermark) {
3537
3551
  const watermark = this.accessor.createWatermarkComponent();
3538
3552
  watermark.init({
3539
3553
  containerApi: new DockviewApi(this.accessor),
3540
- params: {},
3541
- title: '',
3542
- api: null,
3554
+ group: this.groupPanel,
3543
3555
  });
3544
3556
  this.watermark = watermark;
3545
3557
  addDisposableListener(this.watermark.element, 'click', () => {
@@ -3553,7 +3565,7 @@
3553
3565
  }
3554
3566
  if (!this.isEmpty && this.watermark) {
3555
3567
  this.watermark.element.remove();
3556
- this.watermark.dispose();
3568
+ (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
3557
3569
  this.watermark = undefined;
3558
3570
  this.tabsContainer.show();
3559
3571
  }
@@ -3613,9 +3625,9 @@
3613
3625
  }
3614
3626
  }
3615
3627
  dispose() {
3616
- var _a;
3628
+ var _a, _b;
3617
3629
  super.dispose();
3618
- (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.dispose();
3630
+ (_b = (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
3619
3631
  for (const panel of this.panels) {
3620
3632
  panel.dispose();
3621
3633
  }
@@ -3695,7 +3707,7 @@
3695
3707
  this.addDisposables(this.gridview.onDidChange(() => {
3696
3708
  this._bufferOnDidLayoutChange.fire();
3697
3709
  }));
3698
- this.addDisposables(exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3710
+ this.addDisposables(exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup, this.onDidActiveGroupChange)(() => {
3699
3711
  this._bufferOnDidLayoutChange.fire();
3700
3712
  }), this._bufferOnDidLayoutChange.onEvent(() => {
3701
3713
  this._onDidLayoutChange.fire();
@@ -3736,19 +3748,20 @@
3736
3748
  return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
3737
3749
  }
3738
3750
  doSetGroupActive(group, skipFocus) {
3751
+ var _a, _b, _c;
3739
3752
  if (this._activeGroup === group) {
3740
3753
  return;
3741
3754
  }
3742
3755
  if (this._activeGroup) {
3743
3756
  this._activeGroup.setActive(false);
3744
3757
  if (!skipFocus) {
3745
- this._activeGroup.focus();
3758
+ (_b = (_a = this._activeGroup).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
3746
3759
  }
3747
3760
  }
3748
3761
  if (group) {
3749
3762
  group.setActive(true);
3750
3763
  if (!skipFocus) {
3751
- group.focus();
3764
+ (_c = group.focus) === null || _c === void 0 ? void 0 : _c.call(group);
3752
3765
  }
3753
3766
  }
3754
3767
  this._activeGroup = group;
@@ -3809,31 +3822,6 @@
3809
3822
  }
3810
3823
  }
3811
3824
 
3812
- function isPanelOptionsWithPanel(data) {
3813
- if (data.referencePanel) {
3814
- return true;
3815
- }
3816
- return false;
3817
- }
3818
- function isPanelOptionsWithGroup(data) {
3819
- if (data.referenceGroup) {
3820
- return true;
3821
- }
3822
- return false;
3823
- }
3824
- function isGroupOptionsWithPanel(data) {
3825
- if (data.referencePanel) {
3826
- return true;
3827
- }
3828
- return false;
3829
- }
3830
- function isGroupOptionsWithGroup(data) {
3831
- if (data.referenceGroup) {
3832
- return true;
3833
- }
3834
- return false;
3835
- }
3836
-
3837
3825
  /**
3838
3826
  * A core api implementation that should be used across all panel-like objects
3839
3827
  */
@@ -3928,21 +3916,21 @@
3928
3916
  }
3929
3917
  }
3930
3918
 
3931
- class GridviewPanelApiImpl extends PanelApiImpl {
3932
- constructor(id, panel) {
3919
+ class SplitviewPanelApiImpl extends PanelApiImpl {
3920
+ //
3921
+ constructor(id) {
3933
3922
  super(id);
3934
3923
  this._onDidConstraintsChangeInternal = new Emitter();
3935
3924
  this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
3925
+ //
3936
3926
  this._onDidConstraintsChange = new Emitter({
3937
3927
  replay: true,
3938
3928
  });
3939
3929
  this.onDidConstraintsChange = this._onDidConstraintsChange.event;
3930
+ //
3940
3931
  this._onDidSizeChange = new Emitter();
3941
3932
  this.onDidSizeChange = this._onDidSizeChange.event;
3942
3933
  this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
3943
- if (panel) {
3944
- this.initialize(panel);
3945
- }
3946
3934
  }
3947
3935
  setConstraints(value) {
3948
3936
  this._onDidConstraintsChangeInternal.fire(value);
@@ -3952,450 +3940,401 @@
3952
3940
  }
3953
3941
  }
3954
3942
 
3955
- class DockviewPanelApiImpl extends GridviewPanelApiImpl {
3956
- get title() {
3957
- return this.panel.title;
3943
+ class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
3944
+ set pane(pane) {
3945
+ this._pane = pane;
3958
3946
  }
3959
- get isGroupActive() {
3947
+ constructor(id) {
3948
+ super(id);
3949
+ this._onDidExpansionChange = new Emitter({
3950
+ replay: true,
3951
+ });
3952
+ this.onDidExpansionChange = this._onDidExpansionChange.event;
3953
+ this._onMouseEnter = new Emitter({});
3954
+ this.onMouseEnter = this._onMouseEnter.event;
3955
+ this._onMouseLeave = new Emitter({});
3956
+ this.onMouseLeave = this._onMouseLeave.event;
3957
+ this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
3958
+ }
3959
+ setExpanded(isExpanded) {
3960
3960
  var _a;
3961
- return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
3961
+ (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
3962
3962
  }
3963
- set group(value) {
3964
- const isOldGroupActive = this.isGroupActive;
3965
- this._group = value;
3966
- this._onDidGroupChange.fire();
3967
- if (this._group) {
3968
- this.disposable.value = this._group.api.onDidActiveChange(() => {
3969
- this._onDidActiveGroupChange.fire();
3970
- });
3971
- if (this.isGroupActive !== isOldGroupActive) {
3972
- this._onDidActiveGroupChange.fire();
3973
- }
3974
- }
3975
- }
3976
- get group() {
3977
- return this._group;
3978
- }
3979
- constructor(panel, group) {
3980
- super(panel.id);
3981
- this.panel = panel;
3982
- this._onDidTitleChange = new Emitter();
3983
- this.onDidTitleChange = this._onDidTitleChange.event;
3984
- this._onDidActiveGroupChange = new Emitter();
3985
- this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
3986
- this._onDidGroupChange = new Emitter();
3987
- this.onDidGroupChange = this._onDidGroupChange.event;
3988
- this.disposable = new MutableDisposable();
3989
- this.initialize(panel);
3990
- this._group = group;
3991
- this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
3992
- }
3993
- setTitle(title) {
3994
- this.panel.update({ params: { title } });
3995
- }
3996
- close() {
3997
- this.group.model.closePanel(this.panel);
3963
+ get isExpanded() {
3964
+ var _a;
3965
+ return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
3998
3966
  }
3999
3967
  }
4000
3968
 
4001
- class DockviewPanel extends CompositeDisposable {
4002
- get params() {
4003
- return this._params;
3969
+ class BasePanelView extends CompositeDisposable {
3970
+ get element() {
3971
+ return this._element;
4004
3972
  }
4005
- get title() {
4006
- return this._title;
3973
+ get width() {
3974
+ return this._width;
4007
3975
  }
4008
- get group() {
4009
- return this._group;
3976
+ get height() {
3977
+ return this._height;
4010
3978
  }
4011
- get view() {
4012
- return this._view;
3979
+ get params() {
3980
+ var _a;
3981
+ return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
4013
3982
  }
4014
- constructor(id, accessor, containerApi, group) {
3983
+ constructor(id, component, api) {
4015
3984
  super();
4016
3985
  this.id = id;
4017
- this.containerApi = containerApi;
4018
- this.mutableDisposable = new MutableDisposable();
4019
- this._title = '';
4020
- this._group = group;
4021
- this.api = new DockviewPanelApiImpl(this, this._group);
4022
- this.addDisposables(this.api.onActiveChange(() => {
4023
- accessor.setActivePanel(this);
4024
- }), this.api.onDidSizeChange((event) => {
4025
- // forward the resize event to the group since if you want to resize a panel
4026
- // you are actually just resizing the panels parent which is the group
4027
- this.group.api.setSize(event);
3986
+ this.component = component;
3987
+ this.api = api;
3988
+ this._height = 0;
3989
+ this._width = 0;
3990
+ this._element = document.createElement('div');
3991
+ this._element.tabIndex = -1;
3992
+ this._element.style.outline = 'none';
3993
+ this._element.style.height = '100%';
3994
+ this._element.style.width = '100%';
3995
+ this._element.style.overflow = 'hidden';
3996
+ const { onDidFocus, onDidBlur } = trackFocus(this._element);
3997
+ this.addDisposables(this.api, onDidFocus(() => {
3998
+ this.api._onDidChangeFocus.fire({ isFocused: true });
3999
+ }), onDidBlur(() => {
4000
+ this.api._onDidChangeFocus.fire({ isFocused: false });
4028
4001
  }));
4029
4002
  }
4030
- init(params) {
4031
- var _a;
4032
- this._params = params.params;
4033
- this._view = params.view;
4034
- this.setTitle(params.title);
4035
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
4036
- }
4037
4003
  focus() {
4038
4004
  this.api._onFocusEvent.fire();
4039
4005
  }
4040
- toJSON() {
4041
- return {
4042
- id: this.id,
4043
- view: this.view.toJSON(),
4044
- params: Object.keys(this._params || {}).length > 0
4045
- ? this._params
4046
- : undefined,
4047
- title: this.title,
4048
- };
4049
- }
4050
- setTitle(title) {
4051
- var _a, _b;
4052
- const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
4053
- if (didTitleChange) {
4054
- this._title = title;
4055
- (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
4056
- params: {
4057
- params: this._params,
4058
- title: this.title,
4059
- },
4060
- });
4061
- this.api._onDidTitleChange.fire({ title });
4062
- }
4063
- }
4064
- update(event) {
4065
- var _a;
4066
- const params = event.params;
4067
- this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
4068
- if (typeof params.title === 'string') {
4069
- if (params.title !== this.title) {
4070
- this._title = params.title;
4071
- this.api._onDidTitleChange.fire({ title: this.title });
4006
+ layout(width, height) {
4007
+ this._width = width;
4008
+ this._height = height;
4009
+ this.api._onDidDimensionChange.fire({ width, height });
4010
+ if (this.part) {
4011
+ if (this._params) {
4012
+ this.part.update(this._params.params);
4072
4013
  }
4073
4014
  }
4074
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
4075
- params: {
4076
- params: this._params,
4077
- title: this.title,
4078
- },
4079
- });
4080
4015
  }
4081
- updateParentGroup(group, isGroupActive) {
4082
- var _a;
4083
- this._group = group;
4084
- this.api.group = group;
4085
- const isPanelVisible = this._group.model.isPanelActive(this);
4086
- this.api._onDidActiveChange.fire({
4087
- isActive: isGroupActive && isPanelVisible,
4088
- });
4089
- this.api._onDidVisibilityChange.fire({
4090
- isVisible: isPanelVisible,
4091
- });
4092
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.updateParentGroup(this._group, this._group.model.isPanelActive(this));
4016
+ init(parameters) {
4017
+ this._params = parameters;
4018
+ this.part = this.getComponent();
4093
4019
  }
4094
- layout(width, height) {
4095
- var _a;
4096
- // the obtain the correct dimensions of the content panel we must deduct the tab height
4097
- this.api._onDidDimensionChange.fire({
4098
- width,
4099
- height: height - (this.group.model.header.height || 0),
4100
- });
4101
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.layout(width, height);
4020
+ update(event) {
4021
+ var _a, _b;
4022
+ 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) });
4023
+ (_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
4024
+ }
4025
+ toJSON() {
4026
+ var _a, _b;
4027
+ const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
4028
+ return {
4029
+ id: this.id,
4030
+ component: this.component,
4031
+ params: Object.keys(params).length > 0 ? params : undefined,
4032
+ };
4102
4033
  }
4103
4034
  dispose() {
4104
4035
  var _a;
4036
+ super.dispose();
4105
4037
  this.api.dispose();
4106
- this.mutableDisposable.dispose();
4107
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
4038
+ (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
4108
4039
  }
4109
4040
  }
4110
4041
 
4111
- class ActionContainer {
4112
- get element() {
4113
- return this._element;
4042
+ class PaneviewPanel extends BasePanelView {
4043
+ set orientation(value) {
4044
+ this._orientation = value;
4114
4045
  }
4115
- constructor() {
4116
- this._element = document.createElement('div');
4117
- this._element.className = 'actions-bar';
4118
- this._list = document.createElement('ul');
4119
- this._list.className = 'actions-container';
4120
- this._element.appendChild(this._list);
4046
+ get orientation() {
4047
+ return this._orientation;
4121
4048
  }
4122
- add(element) {
4123
- const listItem = document.createElement('li');
4124
- listItem.className = 'action-item';
4125
- this._list.appendChild(element);
4049
+ get minimumSize() {
4050
+ const headerSize = this.headerSize;
4051
+ const expanded = this.isExpanded();
4052
+ const minimumBodySize = expanded ? this._minimumBodySize : 0;
4053
+ return headerSize + minimumBodySize;
4126
4054
  }
4127
- }
4128
-
4129
- const createSvgElementFromPath = (params) => {
4130
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
4131
- svg.setAttributeNS(null, 'height', params.height);
4132
- svg.setAttributeNS(null, 'width', params.width);
4133
- svg.setAttributeNS(null, 'viewBox', params.viewbox);
4134
- svg.setAttributeNS(null, 'aria-hidden', 'false');
4135
- svg.setAttributeNS(null, 'focusable', 'false');
4136
- svg.classList.add('dockview-svg');
4137
- const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
4138
- path.setAttributeNS(null, 'd', params.path);
4139
- svg.appendChild(path);
4140
- return svg;
4141
- };
4142
- const createCloseButton = () => createSvgElementFromPath({
4143
- width: '11',
4144
- height: '11',
4145
- viewbox: '0 0 28 28',
4146
- 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',
4147
- });
4148
- const createExpandMoreButton = () => createSvgElementFromPath({
4149
- width: '11',
4150
- height: '11',
4151
- viewbox: '0 0 24 15',
4152
- path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
4153
- });
4154
- const createChevronRightButton = () => createSvgElementFromPath({
4155
- width: '11',
4156
- height: '11',
4157
- viewbox: '0 0 15 25',
4158
- path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
4159
- });
4160
-
4161
- class Watermark extends CompositeDisposable {
4162
- get id() {
4163
- return 'watermark';
4055
+ get maximumSize() {
4056
+ const headerSize = this.headerSize;
4057
+ const expanded = this.isExpanded();
4058
+ const maximumBodySize = expanded ? this._maximumBodySize : 0;
4059
+ return headerSize + maximumBodySize;
4164
4060
  }
4165
- constructor() {
4166
- super();
4167
- this._element = document.createElement('div');
4168
- this._element.className = 'watermark';
4169
- const title = document.createElement('div');
4170
- title.className = 'watermark-title';
4171
- const emptySpace = document.createElement('span');
4172
- emptySpace.style.flexGrow = '1';
4173
- const content = document.createElement('div');
4174
- content.className = 'watermark-content';
4175
- this._element.appendChild(title);
4176
- this._element.appendChild(content);
4177
- const actions = new ActionContainer();
4178
- title.appendChild(emptySpace);
4179
- title.appendChild(actions.element);
4180
- const closeAnchor = document.createElement('div');
4181
- closeAnchor.className = 'close-action';
4182
- closeAnchor.appendChild(createCloseButton());
4183
- actions.add(closeAnchor);
4184
- this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
4185
- var _a;
4186
- ev.preventDefault();
4187
- if (this.group) {
4188
- (_a = this.params) === null || _a === void 0 ? void 0 : _a.containerApi.removeGroup(this.group);
4189
- }
4190
- }));
4061
+ get size() {
4062
+ return this._size;
4191
4063
  }
4192
- update(_event) {
4193
- // noop
4064
+ get orthogonalSize() {
4065
+ return this._orthogonalSize;
4194
4066
  }
4195
- focus() {
4196
- // noop
4067
+ set orthogonalSize(size) {
4068
+ this._orthogonalSize = size;
4197
4069
  }
4198
- toJSON() {
4199
- return {};
4070
+ get minimumBodySize() {
4071
+ return this._minimumBodySize;
4200
4072
  }
4201
- layout(_width, _height) {
4202
- // noop
4073
+ set minimumBodySize(value) {
4074
+ this._minimumBodySize = typeof value === 'number' ? value : 0;
4203
4075
  }
4204
- init(params) {
4205
- this.params = params;
4206
- this.addDisposables(this.params.containerApi.onDidLayoutChange(() => {
4207
- this.render();
4208
- }));
4209
- this.render();
4076
+ get maximumBodySize() {
4077
+ return this._maximumBodySize;
4210
4078
  }
4211
- updateParentGroup(group, _visible) {
4212
- this.group = group;
4213
- this.render();
4214
- }
4215
- get element() {
4216
- return this._element;
4217
- }
4218
- render() {
4219
- const isOneGroup = !!(this.params && this.params.containerApi.size <= 1);
4220
- toggleClass(this.element, 'has-actions', isOneGroup);
4221
- }
4222
- dispose() {
4223
- super.dispose();
4224
- }
4225
- }
4226
-
4227
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
4228
- const Component = typeof componentName === 'string'
4229
- ? components[componentName]
4230
- : undefined;
4231
- const FrameworkComponent = typeof componentName === 'string'
4232
- ? frameworkComponents[componentName]
4233
- : undefined;
4234
- if (Component && FrameworkComponent) {
4235
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
4236
- }
4237
- if (FrameworkComponent) {
4238
- if (!createFrameworkComponent) {
4239
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
4240
- }
4241
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
4242
- }
4243
- if (!Component) {
4244
- if (fallback) {
4245
- return fallback();
4246
- }
4247
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
4079
+ set maximumBodySize(value) {
4080
+ this._maximumBodySize =
4081
+ typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
4248
4082
  }
4249
- return new Component(id, componentName);
4250
- }
4251
-
4252
- const DEFAULT_TAB_IDENTIFIER = '__default__tab__';
4253
- class DefaultTab extends CompositeDisposable {
4254
- get element() {
4255
- return this._element;
4083
+ get headerVisible() {
4084
+ return this._headerVisible;
4256
4085
  }
4257
- get id() {
4258
- return DEFAULT_TAB_IDENTIFIER;
4086
+ set headerVisible(value) {
4087
+ this._headerVisible = value;
4088
+ this.header.style.display = value ? '' : 'none';
4259
4089
  }
4260
- constructor() {
4261
- super();
4262
- this._isPanelVisible = false;
4263
- this._isGroupActive = false;
4264
- //
4265
- this.params = {};
4266
- this._element = document.createElement('div');
4267
- this._element.className = 'default-tab';
4268
- //
4269
- this._content = document.createElement('div');
4270
- this._content.className = 'tab-content';
4271
- //
4272
- this._actionContainer = document.createElement('div');
4273
- this._actionContainer.className = 'action-container';
4274
- //
4275
- this._list = document.createElement('ul');
4276
- this._list.className = 'tab-list';
4277
- //
4278
- this.action = document.createElement('div');
4279
- this.action.className = 'tab-action';
4280
- this.action.appendChild(createCloseButton());
4281
- //
4282
- this._element.appendChild(this._content);
4283
- this._element.appendChild(this._actionContainer);
4284
- this._actionContainer.appendChild(this._list);
4285
- this._list.appendChild(this.action);
4286
- //
4287
- this.addDisposables(addDisposableListener(this._actionContainer, 'mousedown', (ev) => {
4288
- ev.preventDefault();
4090
+ constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
4091
+ super(id, component, new PaneviewPanelApiImpl(id));
4092
+ this.headerComponent = headerComponent;
4093
+ this._onDidChangeExpansionState = new Emitter({ replay: true });
4094
+ this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
4095
+ this._onDidChange = new Emitter();
4096
+ this.onDidChange = this._onDidChange.event;
4097
+ this.headerSize = 22;
4098
+ this._orthogonalSize = 0;
4099
+ this._size = 0;
4100
+ this._minimumBodySize = 100;
4101
+ this._maximumBodySize = Number.POSITIVE_INFINITY;
4102
+ this._isExpanded = false;
4103
+ this.expandedSize = 0;
4104
+ this.api.pane = this; // TODO cannot use 'this' before 'super'
4105
+ this.api.initialize(this);
4106
+ this._isExpanded = isExpanded;
4107
+ this._headerVisible = isHeaderVisible;
4108
+ this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
4109
+ this._orientation = orientation;
4110
+ this.element.classList.add('pane');
4111
+ this.addDisposables(this.api.onDidSizeChange((event) => {
4112
+ this._onDidChange.fire({ size: event.size });
4113
+ }), addDisposableListener(this.element, 'mouseenter', (ev) => {
4114
+ this.api._onMouseEnter.fire(ev);
4115
+ }), addDisposableListener(this.element, 'mouseleave', (ev) => {
4116
+ this.api._onMouseLeave.fire(ev);
4289
4117
  }));
4290
- this.render();
4291
- }
4292
- update(event) {
4293
- this.params = Object.assign(Object.assign({}, this.params), event.params);
4294
- this.render();
4118
+ this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
4119
+ this.api._onDidExpansionChange.fire({
4120
+ isExpanded: isPanelExpanded,
4121
+ });
4122
+ }), this.api.onDidFocusChange((e) => {
4123
+ if (!this.header) {
4124
+ return;
4125
+ }
4126
+ if (e.isFocused) {
4127
+ addClasses(this.header, 'focused');
4128
+ }
4129
+ else {
4130
+ removeClasses(this.header, 'focused');
4131
+ }
4132
+ }));
4133
+ this.renderOnce();
4295
4134
  }
4296
- toJSON() {
4297
- return { id: this.id };
4135
+ setVisible(isVisible) {
4136
+ this.api._onDidVisibilityChange.fire({ isVisible });
4298
4137
  }
4299
- focus() {
4300
- //noop
4138
+ setActive(isActive) {
4139
+ this.api._onDidActiveChange.fire({ isActive });
4301
4140
  }
4302
- init(params) {
4303
- this.params = params;
4304
- this._content.textContent = params.title;
4305
- addDisposableListener(this.action, 'click', (ev) => {
4306
- ev.preventDefault(); //
4307
- this.params.api.close();
4308
- });
4141
+ isExpanded() {
4142
+ return this._isExpanded;
4309
4143
  }
4310
- updateParentGroup(group, isPanelVisible) {
4311
- const changed = this._isPanelVisible !== isPanelVisible ||
4312
- this._isGroupActive !== group.isActive;
4313
- this._isPanelVisible = isPanelVisible;
4314
- this._isGroupActive = group.isActive;
4315
- if (changed) {
4316
- this.render();
4144
+ setExpanded(expanded) {
4145
+ if (this._isExpanded === expanded) {
4146
+ return;
4147
+ }
4148
+ this._isExpanded = expanded;
4149
+ if (expanded) {
4150
+ if (this.animationTimer) {
4151
+ clearTimeout(this.animationTimer);
4152
+ }
4153
+ if (this.body) {
4154
+ this.element.appendChild(this.body);
4155
+ }
4317
4156
  }
4157
+ else {
4158
+ this.animationTimer = setTimeout(() => {
4159
+ var _a;
4160
+ (_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
4161
+ }, 200);
4162
+ }
4163
+ this._onDidChange.fire(expanded ? { size: this.width } : {});
4164
+ this._onDidChangeExpansionState.fire(expanded);
4318
4165
  }
4319
- layout(_width, _height) {
4320
- // noop
4166
+ layout(size, orthogonalSize) {
4167
+ this._size = size;
4168
+ this._orthogonalSize = orthogonalSize;
4169
+ const [width, height] = this.orientation === exports.Orientation.HORIZONTAL
4170
+ ? [size, orthogonalSize]
4171
+ : [orthogonalSize, size];
4172
+ if (this.isExpanded()) {
4173
+ this.expandedSize = width;
4174
+ }
4175
+ super.layout(width, height);
4321
4176
  }
4322
- render() {
4323
- if (this._content.textContent !== this.params.title) {
4324
- this._content.textContent = this.params.title;
4177
+ init(parameters) {
4178
+ var _a, _b;
4179
+ super.init(parameters);
4180
+ if (typeof parameters.minimumBodySize === 'number') {
4181
+ this.minimumBodySize = parameters.minimumBodySize;
4182
+ }
4183
+ if (typeof parameters.maximumBodySize === 'number') {
4184
+ this.maximumBodySize = parameters.maximumBodySize;
4185
+ }
4186
+ this.bodyPart = this.getBodyComponent();
4187
+ this.headerPart = this.getHeaderComponent();
4188
+ this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
4189
+ this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
4190
+ (_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);
4191
+ (_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
4192
+ if (typeof parameters.isExpanded === 'boolean') {
4193
+ this.setExpanded(parameters.isExpanded);
4325
4194
  }
4326
4195
  }
4327
- }
4328
-
4329
- class BasePanelView extends CompositeDisposable {
4330
- get element() {
4331
- return this._element;
4196
+ toJSON() {
4197
+ const params = this._params;
4198
+ return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
4332
4199
  }
4333
- get width() {
4334
- return this._width;
4200
+ renderOnce() {
4201
+ this.header = document.createElement('div');
4202
+ this.header.tabIndex = 0;
4203
+ this.header.className = 'pane-header';
4204
+ this.header.style.height = `${this.headerSize}px`;
4205
+ this.header.style.lineHeight = `${this.headerSize}px`;
4206
+ this.header.style.minHeight = `${this.headerSize}px`;
4207
+ this.header.style.maxHeight = `${this.headerSize}px`;
4208
+ this.element.appendChild(this.header);
4209
+ this.body = document.createElement('div');
4210
+ this.body.className = 'pane-body';
4211
+ this.element.appendChild(this.body);
4335
4212
  }
4336
- get height() {
4337
- return this._height;
4213
+ // TODO slightly hacky by-pass of the component to create a body and header component
4214
+ getComponent() {
4215
+ return {
4216
+ update: (params) => {
4217
+ var _a, _b;
4218
+ (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
4219
+ (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
4220
+ },
4221
+ dispose: () => {
4222
+ var _a, _b;
4223
+ (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
4224
+ (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
4225
+ },
4226
+ };
4338
4227
  }
4339
- get params() {
4340
- var _a;
4341
- return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
4228
+ }
4229
+
4230
+ class DraggablePaneviewPanel extends PaneviewPanel {
4231
+ constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
4232
+ super(id, component, headerComponent, orientation, isExpanded, true);
4233
+ this.accessor = accessor;
4234
+ this._onDidDrop = new Emitter();
4235
+ this.onDidDrop = this._onDidDrop.event;
4236
+ if (!disableDnd) {
4237
+ this.initDragFeatures();
4238
+ }
4342
4239
  }
4343
- constructor(id, component, api) {
4344
- super();
4345
- this.id = id;
4346
- this.component = component;
4347
- this.api = api;
4348
- this._height = 0;
4349
- this._width = 0;
4350
- this._element = document.createElement('div');
4351
- this._element.tabIndex = -1;
4352
- this._element.style.outline = 'none';
4353
- this._element.style.height = '100%';
4354
- this._element.style.width = '100%';
4355
- this._element.style.overflow = 'hidden';
4356
- const { onDidFocus, onDidBlur } = trackFocus(this._element);
4357
- this.addDisposables(this.api, onDidFocus(() => {
4358
- this.api._onDidChangeFocus.fire({ isFocused: true });
4359
- }), onDidBlur(() => {
4360
- this.api._onDidChangeFocus.fire({ isFocused: false });
4240
+ initDragFeatures() {
4241
+ if (!this.header) {
4242
+ return;
4243
+ }
4244
+ const id = this.id;
4245
+ const accessorId = this.accessor.id;
4246
+ this.header.draggable = true;
4247
+ this.handler = new (class PaneDragHandler extends DragHandler {
4248
+ getData() {
4249
+ LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
4250
+ return {
4251
+ dispose: () => {
4252
+ LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
4253
+ },
4254
+ };
4255
+ }
4256
+ })(this.header);
4257
+ this.target = new Droptarget(this.element, {
4258
+ acceptedTargetZones: ['top', 'bottom'],
4259
+ overlayModel: {
4260
+ activationSize: { type: 'percentage', value: 50 },
4261
+ },
4262
+ canDisplayOverlay: (event) => {
4263
+ const data = getPaneData();
4264
+ if (data) {
4265
+ if (data.paneId !== this.id &&
4266
+ data.viewId === this.accessor.id) {
4267
+ return true;
4268
+ }
4269
+ }
4270
+ if (this.accessor.options.showDndOverlay) {
4271
+ return this.accessor.options.showDndOverlay({
4272
+ nativeEvent: event,
4273
+ getData: getPaneData,
4274
+ panel: this,
4275
+ });
4276
+ }
4277
+ return false;
4278
+ },
4279
+ });
4280
+ this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
4281
+ this.onDrop(event);
4361
4282
  }));
4362
4283
  }
4363
- focus() {
4364
- this.api._onFocusEvent.fire();
4365
- }
4366
- layout(width, height) {
4367
- this._width = width;
4368
- this._height = height;
4369
- this.api._onDidDimensionChange.fire({ width, height });
4370
- if (this.part) {
4371
- if (this._params) {
4372
- this.part.update(this._params.params);
4284
+ onDrop(event) {
4285
+ const data = getPaneData();
4286
+ if (!data || data.viewId !== this.accessor.id) {
4287
+ // if there is no local drag event for this panel
4288
+ // or if the drag event was creating by another Paneview instance
4289
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));
4290
+ return;
4291
+ }
4292
+ const containerApi = this._params
4293
+ .containerApi;
4294
+ const panelId = data.paneId;
4295
+ const existingPanel = containerApi.getPanel(panelId);
4296
+ if (!existingPanel) {
4297
+ // if the panel doesn't exist
4298
+ this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData, api: new PaneviewApi(this.accessor) }));
4299
+ return;
4300
+ }
4301
+ const allPanels = containerApi.panels;
4302
+ const fromIndex = allPanels.indexOf(existingPanel);
4303
+ let toIndex = containerApi.panels.indexOf(this);
4304
+ if (event.position === 'left' || event.position === 'top') {
4305
+ toIndex = Math.max(0, toIndex - 1);
4306
+ }
4307
+ if (event.position === 'right' || event.position === 'bottom') {
4308
+ if (fromIndex > toIndex) {
4309
+ toIndex++;
4373
4310
  }
4311
+ toIndex = Math.min(allPanels.length - 1, toIndex);
4374
4312
  }
4313
+ containerApi.movePanel(fromIndex, toIndex);
4375
4314
  }
4376
- init(parameters) {
4377
- this._params = parameters;
4378
- this.part = this.getComponent();
4379
- }
4380
- update(event) {
4381
- var _a, _b;
4382
- 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) });
4383
- (_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
4315
+ }
4316
+
4317
+ class GridviewPanelApiImpl extends PanelApiImpl {
4318
+ constructor(id, panel) {
4319
+ super(id);
4320
+ this._onDidConstraintsChangeInternal = new Emitter();
4321
+ this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
4322
+ this._onDidConstraintsChange = new Emitter({
4323
+ replay: true,
4324
+ });
4325
+ this.onDidConstraintsChange = this._onDidConstraintsChange.event;
4326
+ this._onDidSizeChange = new Emitter();
4327
+ this.onDidSizeChange = this._onDidSizeChange.event;
4328
+ this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
4329
+ if (panel) {
4330
+ this.initialize(panel);
4331
+ }
4384
4332
  }
4385
- toJSON() {
4386
- var _a, _b;
4387
- const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
4388
- return {
4389
- id: this.id,
4390
- component: this.component,
4391
- params: Object.keys(params).length > 0 ? params : undefined,
4392
- };
4333
+ setConstraints(value) {
4334
+ this._onDidConstraintsChangeInternal.fire(value);
4393
4335
  }
4394
- dispose() {
4395
- var _a;
4396
- super.dispose();
4397
- this.api.dispose();
4398
- (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
4336
+ setSize(event) {
4337
+ this._onDidSizeChange.fire(event);
4399
4338
  }
4400
4339
  }
4401
4340
 
@@ -4449,8 +4388,8 @@
4449
4388
  get isActive() {
4450
4389
  return this.api.isActive;
4451
4390
  }
4452
- constructor(id, component, api) {
4453
- super(id, component, api);
4391
+ constructor(id, component, options) {
4392
+ super(id, component, new GridviewPanelApiImpl(id));
4454
4393
  this._evaluatedMinimumWidth = 0;
4455
4394
  this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;
4456
4395
  this._evaluatedMinimumHeight = 0;
@@ -4462,6 +4401,18 @@
4462
4401
  this._snap = false;
4463
4402
  this._onDidChange = new Emitter();
4464
4403
  this.onDidChange = this._onDidChange.event;
4404
+ if (typeof (options === null || options === void 0 ? void 0 : options.minimumWidth) === 'number') {
4405
+ this._minimumWidth = options.minimumWidth;
4406
+ }
4407
+ if (typeof (options === null || options === void 0 ? void 0 : options.maximumWidth) === 'number') {
4408
+ this._maximumWidth = options.maximumWidth;
4409
+ }
4410
+ if (typeof (options === null || options === void 0 ? void 0 : options.minimumHeight) === 'number') {
4411
+ this._minimumHeight = options.minimumHeight;
4412
+ }
4413
+ if (typeof (options === null || options === void 0 ? void 0 : options.maximumHeight) === 'number') {
4414
+ this._maximumHeight = options.maximumHeight;
4415
+ }
4465
4416
  this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
4466
4417
  this.addDisposables(this._onDidChange, this.api.onVisibilityChange((event) => {
4467
4418
  const { isVisible } = event;
@@ -4500,142 +4451,518 @@
4500
4451
  setActive(isActive) {
4501
4452
  this.api._onDidActiveChange.fire({ isActive });
4502
4453
  }
4503
- init(parameters) {
4504
- if (parameters.maximumHeight) {
4505
- this._maximumHeight = parameters.maximumHeight;
4506
- }
4507
- if (parameters.minimumHeight) {
4508
- this._minimumHeight = parameters.minimumHeight;
4509
- }
4510
- if (parameters.maximumWidth) {
4511
- this._maximumWidth = parameters.maximumWidth;
4512
- }
4513
- if (parameters.minimumWidth) {
4514
- this._minimumWidth = parameters.minimumWidth;
4454
+ init(parameters) {
4455
+ if (parameters.maximumHeight) {
4456
+ this._maximumHeight = parameters.maximumHeight;
4457
+ }
4458
+ if (parameters.minimumHeight) {
4459
+ this._minimumHeight = parameters.minimumHeight;
4460
+ }
4461
+ if (parameters.maximumWidth) {
4462
+ this._maximumWidth = parameters.maximumWidth;
4463
+ }
4464
+ if (parameters.minimumWidth) {
4465
+ this._minimumWidth = parameters.minimumWidth;
4466
+ }
4467
+ this._priority = parameters.priority;
4468
+ this._snap = !!parameters.snap;
4469
+ super.init(parameters);
4470
+ if (typeof parameters.isVisible === 'boolean') {
4471
+ this.setVisible(parameters.isVisible);
4472
+ }
4473
+ }
4474
+ updateConstraints() {
4475
+ this.api._onDidConstraintsChange.fire({
4476
+ minimumWidth: this._evaluatedMinimumWidth,
4477
+ maximumWidth: this._evaluatedMaximumWidth,
4478
+ minimumHeight: this._evaluatedMinimumHeight,
4479
+ maximumHeight: this._evaluatedMaximumHeight,
4480
+ });
4481
+ }
4482
+ toJSON() {
4483
+ const state = super.toJSON();
4484
+ const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? undefined : value;
4485
+ const minimum = (value) => (value <= 0 ? undefined : value);
4486
+ 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 });
4487
+ }
4488
+ }
4489
+
4490
+ class DockviewGroupPanel extends GridviewPanel {
4491
+ get panels() {
4492
+ return this._model.panels;
4493
+ }
4494
+ get activePanel() {
4495
+ return this._model.activePanel;
4496
+ }
4497
+ get size() {
4498
+ return this._model.size;
4499
+ }
4500
+ get model() {
4501
+ return this._model;
4502
+ }
4503
+ get locked() {
4504
+ return this._model.locked;
4505
+ }
4506
+ set locked(value) {
4507
+ this._model.locked = value;
4508
+ }
4509
+ get header() {
4510
+ return this._model.header;
4511
+ }
4512
+ constructor(accessor, id, options) {
4513
+ super(id, 'groupview_default', {
4514
+ minimumHeight: 100,
4515
+ minimumWidth: 100,
4516
+ });
4517
+ this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
4518
+ }
4519
+ initialize() {
4520
+ this._model.initialize();
4521
+ }
4522
+ setActive(isActive) {
4523
+ super.setActive(isActive);
4524
+ this.model.setActive(isActive);
4525
+ }
4526
+ layout(width, height) {
4527
+ super.layout(width, height);
4528
+ this.model.layout(width, height);
4529
+ }
4530
+ getComponent() {
4531
+ return this._model;
4532
+ }
4533
+ toJSON() {
4534
+ // TODO fix typing
4535
+ return this.model.toJSON();
4536
+ }
4537
+ }
4538
+
4539
+ function isPanelOptionsWithPanel(data) {
4540
+ if (data.referencePanel) {
4541
+ return true;
4542
+ }
4543
+ return false;
4544
+ }
4545
+ function isPanelOptionsWithGroup(data) {
4546
+ if (data.referenceGroup) {
4547
+ return true;
4548
+ }
4549
+ return false;
4550
+ }
4551
+ function isGroupOptionsWithPanel(data) {
4552
+ if (data.referencePanel) {
4553
+ return true;
4554
+ }
4555
+ return false;
4556
+ }
4557
+ function isGroupOptionsWithGroup(data) {
4558
+ if (data.referenceGroup) {
4559
+ return true;
4560
+ }
4561
+ return false;
4562
+ }
4563
+
4564
+ class DockviewPanelApiImpl extends GridviewPanelApiImpl {
4565
+ get title() {
4566
+ return this.panel.title;
4567
+ }
4568
+ get isGroupActive() {
4569
+ var _a;
4570
+ return !!((_a = this.group) === null || _a === void 0 ? void 0 : _a.isActive);
4571
+ }
4572
+ set group(value) {
4573
+ const isOldGroupActive = this.isGroupActive;
4574
+ this._group = value;
4575
+ this._onDidGroupChange.fire();
4576
+ if (this._group) {
4577
+ this.disposable.value = this._group.api.onDidActiveChange(() => {
4578
+ this._onDidActiveGroupChange.fire();
4579
+ });
4580
+ if (this.isGroupActive !== isOldGroupActive) {
4581
+ this._onDidActiveGroupChange.fire();
4582
+ }
4583
+ }
4584
+ }
4585
+ get group() {
4586
+ return this._group;
4587
+ }
4588
+ constructor(panel, group) {
4589
+ super(panel.id);
4590
+ this.panel = panel;
4591
+ this._onDidTitleChange = new Emitter();
4592
+ this.onDidTitleChange = this._onDidTitleChange.event;
4593
+ this._onDidActiveGroupChange = new Emitter();
4594
+ this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;
4595
+ this._onDidGroupChange = new Emitter();
4596
+ this.onDidGroupChange = this._onDidGroupChange.event;
4597
+ this.disposable = new MutableDisposable();
4598
+ this.initialize(panel);
4599
+ this._group = group;
4600
+ this.addDisposables(this.disposable, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange);
4601
+ }
4602
+ setTitle(title) {
4603
+ this.panel.update({ params: { title } });
4604
+ }
4605
+ close() {
4606
+ this.group.model.closePanel(this.panel);
4607
+ }
4608
+ }
4609
+
4610
+ class DockviewPanel extends CompositeDisposable {
4611
+ get params() {
4612
+ return this._params;
4613
+ }
4614
+ get title() {
4615
+ return this._title;
4616
+ }
4617
+ get group() {
4618
+ return this._group;
4619
+ }
4620
+ constructor(id, accessor, containerApi, group, view) {
4621
+ super();
4622
+ this.id = id;
4623
+ this.containerApi = containerApi;
4624
+ this.view = view;
4625
+ this._title = '';
4626
+ this._group = group;
4627
+ this.api = new DockviewPanelApiImpl(this, this._group);
4628
+ this.addDisposables(this.api.onActiveChange(() => {
4629
+ accessor.setActivePanel(this);
4630
+ }), this.api.onDidSizeChange((event) => {
4631
+ // forward the resize event to the group since if you want to resize a panel
4632
+ // you are actually just resizing the panels parent which is the group
4633
+ this.group.api.setSize(event);
4634
+ }));
4635
+ }
4636
+ init(params) {
4637
+ var _a;
4638
+ this._params = params.params;
4639
+ this.setTitle(params.title);
4640
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
4641
+ }
4642
+ focus() {
4643
+ this.api._onFocusEvent.fire();
4644
+ }
4645
+ toJSON() {
4646
+ return {
4647
+ id: this.id,
4648
+ contentComponent: this.view.contentComponent,
4649
+ tabComponent: this.view.tabComponent,
4650
+ params: Object.keys(this._params || {}).length > 0
4651
+ ? this._params
4652
+ : undefined,
4653
+ title: this.title,
4654
+ };
4655
+ }
4656
+ setTitle(title) {
4657
+ var _a, _b;
4658
+ const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
4659
+ if (didTitleChange) {
4660
+ this._title = title;
4661
+ (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
4662
+ params: {
4663
+ params: this._params,
4664
+ title: this.title,
4665
+ },
4666
+ });
4667
+ this.api._onDidTitleChange.fire({ title });
4515
4668
  }
4516
- this._priority = parameters.priority;
4517
- this._snap = !!parameters.snap;
4518
- super.init(parameters);
4519
- if (typeof parameters.isVisible === 'boolean') {
4520
- this.setVisible(parameters.isVisible);
4669
+ }
4670
+ update(event) {
4671
+ var _a;
4672
+ const params = event.params;
4673
+ this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
4674
+ if (params.title !== this.title) {
4675
+ this._title = params.title;
4676
+ this.api._onDidTitleChange.fire({ title: this.title });
4521
4677
  }
4678
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
4679
+ params: {
4680
+ params: this._params,
4681
+ title: this.title,
4682
+ },
4683
+ });
4522
4684
  }
4523
- updateConstraints() {
4524
- this.api._onDidConstraintsChange.fire({
4525
- minimumWidth: this._evaluatedMinimumWidth,
4526
- maximumWidth: this._evaluatedMaximumWidth,
4527
- minimumHeight: this._evaluatedMinimumHeight,
4528
- maximumHeight: this._evaluatedMaximumHeight,
4685
+ updateParentGroup(group, isGroupActive) {
4686
+ this._group = group;
4687
+ this.api.group = group;
4688
+ const isPanelVisible = this._group.model.isPanelActive(this);
4689
+ this.api._onDidActiveChange.fire({
4690
+ isActive: isGroupActive && isPanelVisible,
4691
+ });
4692
+ this.api._onDidVisibilityChange.fire({
4693
+ isVisible: isPanelVisible,
4529
4694
  });
4695
+ this.view.updateParentGroup(this._group, this._group.model.isPanelActive(this));
4530
4696
  }
4531
- toJSON() {
4532
- const state = super.toJSON();
4533
- const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? undefined : value;
4534
- const minimum = (value) => (value <= 0 ? undefined : value);
4535
- 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 });
4697
+ layout(width, height) {
4698
+ var _a;
4699
+ // the obtain the correct dimensions of the content panel we must deduct the tab height
4700
+ this.api._onDidDimensionChange.fire({
4701
+ width,
4702
+ height: height - (this.group.model.header.height || 0),
4703
+ });
4704
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.layout(width, height);
4705
+ }
4706
+ dispose() {
4707
+ var _a;
4708
+ this.api.dispose();
4709
+ (_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
4536
4710
  }
4537
4711
  }
4538
4712
 
4539
- class GroupviewApi extends GridviewPanelApiImpl {
4540
- }
4541
- class GroupPanel extends GridviewPanel {
4542
- get panels() {
4543
- return this._model.panels;
4713
+ const createSvgElementFromPath = (params) => {
4714
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
4715
+ svg.setAttributeNS(null, 'height', params.height);
4716
+ svg.setAttributeNS(null, 'width', params.width);
4717
+ svg.setAttributeNS(null, 'viewBox', params.viewbox);
4718
+ svg.setAttributeNS(null, 'aria-hidden', 'false');
4719
+ svg.setAttributeNS(null, 'focusable', 'false');
4720
+ svg.classList.add('dockview-svg');
4721
+ const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
4722
+ path.setAttributeNS(null, 'd', params.path);
4723
+ svg.appendChild(path);
4724
+ return svg;
4725
+ };
4726
+ const createCloseButton = () => createSvgElementFromPath({
4727
+ width: '11',
4728
+ height: '11',
4729
+ viewbox: '0 0 28 28',
4730
+ 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',
4731
+ });
4732
+ const createExpandMoreButton = () => createSvgElementFromPath({
4733
+ width: '11',
4734
+ height: '11',
4735
+ viewbox: '0 0 24 15',
4736
+ path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',
4737
+ });
4738
+ const createChevronRightButton = () => createSvgElementFromPath({
4739
+ width: '11',
4740
+ height: '11',
4741
+ viewbox: '0 0 15 25',
4742
+ path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',
4743
+ });
4744
+
4745
+ class DefaultTab extends CompositeDisposable {
4746
+ get element() {
4747
+ return this._element;
4544
4748
  }
4545
- get activePanel() {
4546
- return this._model.activePanel;
4749
+ constructor() {
4750
+ super();
4751
+ //
4752
+ this.params = {};
4753
+ this._element = document.createElement('div');
4754
+ this._element.className = 'default-tab';
4755
+ //
4756
+ this._content = document.createElement('div');
4757
+ this._content.className = 'tab-content';
4758
+ //
4759
+ this._actionContainer = document.createElement('div');
4760
+ this._actionContainer.className = 'action-container';
4761
+ //
4762
+ this._list = document.createElement('ul');
4763
+ this._list.className = 'tab-list';
4764
+ //
4765
+ this.action = document.createElement('div');
4766
+ this.action.className = 'tab-action';
4767
+ this.action.appendChild(createCloseButton());
4768
+ //
4769
+ this._element.appendChild(this._content);
4770
+ this._element.appendChild(this._actionContainer);
4771
+ this._actionContainer.appendChild(this._list);
4772
+ this._list.appendChild(this.action);
4773
+ //
4774
+ this.addDisposables(addDisposableListener(this._actionContainer, 'mousedown', (ev) => {
4775
+ ev.preventDefault();
4776
+ }));
4777
+ this.render();
4547
4778
  }
4548
- get size() {
4549
- return this._model.size;
4779
+ update(event) {
4780
+ this.params = Object.assign(Object.assign({}, this.params), event.params);
4781
+ this.render();
4550
4782
  }
4551
- get model() {
4552
- return this._model;
4783
+ focus() {
4784
+ //noop
4553
4785
  }
4554
- get minimumHeight() {
4555
- return this._model.minimumHeight;
4786
+ init(params) {
4787
+ this.params = params;
4788
+ this._content.textContent = params.title;
4789
+ addDisposableListener(this.action, 'click', (ev) => {
4790
+ ev.preventDefault(); //
4791
+ this.params.api.close();
4792
+ });
4556
4793
  }
4557
- get maximumHeight() {
4558
- return this._model.maximumHeight;
4794
+ onGroupChange(_group) {
4795
+ this.render();
4559
4796
  }
4560
- get minimumWidth() {
4561
- return this._model.minimumWidth;
4797
+ onPanelVisibleChange(_isPanelVisible) {
4798
+ this.render();
4562
4799
  }
4563
- get maximumWidth() {
4564
- return this._model.maximumWidth;
4800
+ layout(_width, _height) {
4801
+ // noop
4565
4802
  }
4566
- get locked() {
4567
- return this._model.locked;
4803
+ render() {
4804
+ if (this._content.textContent !== this.params.title) {
4805
+ this._content.textContent = this.params.title;
4806
+ }
4568
4807
  }
4569
- set locked(value) {
4570
- this._model.locked = value;
4808
+ }
4809
+
4810
+ class DockviewPanelModel {
4811
+ get content() {
4812
+ return this._content;
4571
4813
  }
4572
- get header() {
4573
- return this._model.header;
4814
+ get tab() {
4815
+ return this._tab;
4574
4816
  }
4575
- constructor(accessor, id, options) {
4576
- super(id, 'groupview_default', new GroupviewApi(id));
4577
- this._model = new Groupview(this.element, accessor, id, options, this);
4817
+ constructor(accessor, id, contentComponent, tabComponent) {
4818
+ var _a;
4819
+ this.accessor = accessor;
4820
+ this.id = id;
4821
+ this.contentComponent = contentComponent;
4822
+ this.tabComponent = tabComponent;
4823
+ this._group = null;
4824
+ this._isPanelVisible = null;
4825
+ this._content = this.createContentComponent(this.id, contentComponent);
4826
+ this._tab =
4827
+ (_a = this.createTabComponent(this.id, tabComponent)) !== null && _a !== void 0 ? _a : new DefaultTab();
4578
4828
  }
4579
- initialize() {
4580
- this._model.initialize();
4829
+ init(params) {
4830
+ this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4831
+ this.tab.init(params);
4581
4832
  }
4582
- setActive(isActive) {
4583
- super.setActive(isActive);
4584
- this.model.setActive(isActive);
4833
+ updateParentGroup(group, isPanelVisible) {
4834
+ if (group !== this._group) {
4835
+ this._group = group;
4836
+ if (this._content.onGroupChange) {
4837
+ this._content.onGroupChange(group);
4838
+ }
4839
+ if (this._tab.onGroupChange) {
4840
+ this._tab.onGroupChange(group);
4841
+ }
4842
+ }
4843
+ if (isPanelVisible !== this._isPanelVisible) {
4844
+ this._isPanelVisible = isPanelVisible;
4845
+ if (this._content.onPanelVisibleChange) {
4846
+ this._content.onPanelVisibleChange(isPanelVisible);
4847
+ }
4848
+ if (this._tab.onPanelVisibleChange) {
4849
+ this._tab.onPanelVisibleChange(isPanelVisible);
4850
+ }
4851
+ }
4585
4852
  }
4586
4853
  layout(width, height) {
4587
- super.layout(width, height);
4588
- this.model.layout(width, height);
4854
+ var _a, _b;
4855
+ (_b = (_a = this.content).layout) === null || _b === void 0 ? void 0 : _b.call(_a, width, height);
4589
4856
  }
4590
- getComponent() {
4591
- return this._model;
4857
+ update(event) {
4858
+ var _a, _b, _c, _d;
4859
+ (_b = (_a = this.content).update) === null || _b === void 0 ? void 0 : _b.call(_a, event);
4860
+ (_d = (_c = this.tab).update) === null || _d === void 0 ? void 0 : _d.call(_c, event);
4592
4861
  }
4593
- toJSON() {
4594
- return this.model.toJSON();
4862
+ dispose() {
4863
+ var _a, _b, _c, _d;
4864
+ (_b = (_a = this.content).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
4865
+ (_d = (_c = this.tab).dispose) === null || _d === void 0 ? void 0 : _d.call(_c);
4866
+ }
4867
+ createContentComponent(id, componentName) {
4868
+ var _a;
4869
+ 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);
4870
+ }
4871
+ createTabComponent(id, componentName) {
4872
+ var _a;
4873
+ 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());
4595
4874
  }
4596
4875
  }
4597
4876
 
4598
- class DefaultGroupPanelView {
4599
- get content() {
4600
- return this._content;
4877
+ class DefaultDockviewDeserialzier {
4878
+ constructor(layout) {
4879
+ this.layout = layout;
4601
4880
  }
4602
- get tab() {
4603
- return this._tab;
4881
+ fromJSON(panelData, group) {
4882
+ var _a, _b, _c;
4883
+ const panelId = panelData.id;
4884
+ const params = panelData.params;
4885
+ const title = panelData.title;
4886
+ const viewData = panelData.view;
4887
+ const contentComponent = viewData
4888
+ ? viewData.content.id
4889
+ : panelData.contentComponent || 'unknown';
4890
+ const tabComponent = viewData
4891
+ ? (_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id
4892
+ : panelData.tabComponent;
4893
+ if (tabComponent) {
4894
+ 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());
4895
+ }
4896
+ else if (this.layout.options.defaultTabComponent) {
4897
+ 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());
4898
+ }
4899
+ else {
4900
+ new DefaultTab();
4901
+ }
4902
+ const view = new DockviewPanelModel(this.layout, panelId, contentComponent, tabComponent);
4903
+ const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group, view);
4904
+ panel.init({
4905
+ title: title || panelId,
4906
+ params: params || {},
4907
+ });
4908
+ return panel;
4604
4909
  }
4605
- constructor(renderers) {
4606
- var _a;
4607
- this._content = renderers.content;
4608
- this._tab = (_a = renderers.tab) !== null && _a !== void 0 ? _a : new DefaultTab();
4910
+ }
4911
+
4912
+ class Watermark extends CompositeDisposable {
4913
+ get element() {
4914
+ return this._element;
4915
+ }
4916
+ constructor() {
4917
+ super();
4918
+ this._element = document.createElement('div');
4919
+ this._element.className = 'watermark';
4920
+ const title = document.createElement('div');
4921
+ title.className = 'watermark-title';
4922
+ const emptySpace = document.createElement('span');
4923
+ emptySpace.style.flexGrow = '1';
4924
+ const content = document.createElement('div');
4925
+ content.className = 'watermark-content';
4926
+ this._element.appendChild(title);
4927
+ this._element.appendChild(content);
4928
+ const actionsContainer = document.createElement('div');
4929
+ actionsContainer.className = 'actions-container';
4930
+ const closeAnchor = document.createElement('div');
4931
+ closeAnchor.className = 'close-action';
4932
+ closeAnchor.appendChild(createCloseButton());
4933
+ actionsContainer.appendChild(closeAnchor);
4934
+ title.appendChild(emptySpace);
4935
+ title.appendChild(actionsContainer);
4936
+ this.addDisposables(addDisposableListener(closeAnchor, 'click', (ev) => {
4937
+ var _a;
4938
+ ev.preventDefault();
4939
+ if (this.group) {
4940
+ (_a = this.params) === null || _a === void 0 ? void 0 : _a.containerApi.removeGroup(this.group);
4941
+ }
4942
+ }));
4609
4943
  }
4610
- init(params) {
4611
- this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
4612
- this.tab.init(params);
4944
+ update(_event) {
4945
+ // noop
4613
4946
  }
4614
- updateParentGroup(group, isPanelVisible) {
4615
- var _a;
4616
- this._content.updateParentGroup(group, isPanelVisible);
4617
- (_a = this._tab) === null || _a === void 0 ? void 0 : _a.updateParentGroup(group, isPanelVisible);
4947
+ focus() {
4948
+ // noop
4618
4949
  }
4619
- layout(width, height) {
4620
- this.content.layout(width, height);
4950
+ layout(_width, _height) {
4951
+ // noop
4621
4952
  }
4622
- update(event) {
4623
- this.content.update(event);
4624
- this.tab.update(event);
4953
+ init(_params) {
4954
+ this.render();
4625
4955
  }
4626
- toJSON() {
4627
- let tab = this.tab instanceof DefaultTab ? undefined : this.tab.toJSON();
4628
- if (tab && Object.keys(tab).length === 0) {
4629
- tab = undefined;
4630
- }
4631
- return {
4632
- content: this.content.toJSON(),
4633
- tab,
4634
- };
4956
+ updateParentGroup(group, _visible) {
4957
+ this.group = group;
4958
+ this.render();
4635
4959
  }
4636
4960
  dispose() {
4637
- this.content.dispose();
4638
- this.tab.dispose();
4961
+ super.dispose();
4962
+ }
4963
+ render() {
4964
+ const isOneGroup = !!(this.params && this.params.containerApi.size <= 1);
4965
+ toggleClass(this.element, 'has-actions', isOneGroup);
4639
4966
  }
4640
4967
  }
4641
4968
 
@@ -4649,12 +4976,6 @@
4649
4976
  get panels() {
4650
4977
  return this.groups.flatMap((group) => group.panels);
4651
4978
  }
4652
- get deserializer() {
4653
- return this._deserializer;
4654
- }
4655
- set deserializer(value) {
4656
- this._deserializer = value;
4657
- }
4658
4979
  get options() {
4659
4980
  return this._options;
4660
4981
  }
@@ -4681,6 +5002,7 @@
4681
5002
  styles: options.styles,
4682
5003
  });
4683
5004
  this.nextGroupId = sequentialNumberGenerator();
5005
+ this._deserializer = new DefaultDockviewDeserialzier(this);
4684
5006
  this.watermark = null;
4685
5007
  this._onDidDrop = new Emitter();
4686
5008
  this.onDidDrop = this._onDidDrop.event;
@@ -4693,9 +5015,9 @@
4693
5015
  this._onDidActivePanelChange = new Emitter();
4694
5016
  this.onDidActivePanelChange = this._onDidActivePanelChange.event;
4695
5017
  this.element.classList.add('dv-dockview');
4696
- this.addDisposables(this._onDidDrop, exports.Event.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
5018
+ this.addDisposables(this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
4697
5019
  this.updateWatermark();
4698
- }), exports.Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
5020
+ }), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
4699
5021
  this._bufferOnDidLayoutChange.fire();
4700
5022
  }));
4701
5023
  this._options = options;
@@ -4862,9 +5184,6 @@
4862
5184
  }
4863
5185
  fromJSON(data) {
4864
5186
  this.clear();
4865
- if (!this.deserializer) {
4866
- throw new Error('no deserializer provided');
4867
- }
4868
5187
  const { grid, panels, options, activeGroup } = data;
4869
5188
  if (typeof (options === null || options === void 0 ? void 0 : options.tabHeight) === 'number') {
4870
5189
  this.tabHeight = options.tabHeight;
@@ -4882,7 +5201,7 @@
4882
5201
  });
4883
5202
  this._onDidAddGroup.fire(group);
4884
5203
  for (const child of views) {
4885
- const panel = this.deserializer.fromJSON(panels[child], group);
5204
+ const panel = this._deserializer.fromJSON(panels[child], group);
4886
5205
  const isActive = typeof activeView === 'string' &&
4887
5206
  activeView === panel.id;
4888
5207
  group.model.openPanel(panel, {
@@ -5009,14 +5328,12 @@
5009
5328
  : {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
5010
5329
  }
5011
5330
  updateWatermark() {
5331
+ var _a, _b;
5012
5332
  if (this.groups.length === 0) {
5013
5333
  if (!this.watermark) {
5014
5334
  this.watermark = this.createWatermarkComponent();
5015
5335
  this.watermark.init({
5016
5336
  containerApi: new DockviewApi(this),
5017
- params: {},
5018
- title: '',
5019
- api: null,
5020
5337
  });
5021
5338
  const watermarkContainer = document.createElement('div');
5022
5339
  watermarkContainer.className = 'dv-watermark-container';
@@ -5026,7 +5343,7 @@
5026
5343
  }
5027
5344
  else if (this.watermark) {
5028
5345
  this.watermark.element.parentElement.remove();
5029
- this.watermark.dispose();
5346
+ (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
5030
5347
  this.watermark = null;
5031
5348
  }
5032
5349
  }
@@ -5188,7 +5505,7 @@
5188
5505
  id = this.nextGroupId.next();
5189
5506
  }
5190
5507
  }
5191
- const view = new GroupPanel(this, id, options);
5508
+ const view = new DockviewGroupPanel(this, id, options);
5192
5509
  view.init({ params: {}, accessor: null }); // required to initialized .part and allow for correct disposal of group
5193
5510
  if (!this._groups.has(view.id)) {
5194
5511
  const disposable = new CompositeDisposable(view.model.onMove((event) => {
@@ -5201,857 +5518,522 @@
5201
5518
  }), view.model.onDidRemovePanel((event) => {
5202
5519
  this._onDidRemovePanel.fire(event.panel);
5203
5520
  }), view.model.onDidActivePanelChange((event) => {
5204
- this._onDidActivePanelChange.fire(event.panel);
5205
- }));
5206
- this._groups.set(view.id, { value: view, disposable });
5207
- }
5208
- // TODO: must be called after the above listeners have been setup,
5209
- // not an ideal pattern
5210
- view.initialize();
5211
- if (typeof this.options.tabHeight === 'number') {
5212
- view.model.header.height = this.options.tabHeight;
5213
- }
5214
- return view;
5215
- }
5216
- createPanel(options, group) {
5217
- const view = new DefaultGroupPanelView({
5218
- content: this.createContentComponent(options.id, options.component),
5219
- tab: this.createTabComponent(options.id, options.tabComponent || this.options.defaultTabComponent),
5220
- });
5221
- const panel = new DockviewPanel(options.id, this, this._api, group);
5222
- panel.init({
5223
- view,
5224
- title: options.title || options.id,
5225
- params: (options === null || options === void 0 ? void 0 : options.params) || {},
5226
- });
5227
- return panel;
5228
- }
5229
- createContentComponent(id, componentName) {
5230
- var _a;
5231
- return createComponent(id, componentName, this.options.components || {}, this.options.frameworkComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.content);
5232
- }
5233
- createTabComponent(id, componentName) {
5234
- var _a;
5235
- return createComponent(id, componentName, this.options.tabComponents || {}, this.options.frameworkTabComponents, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.tab, () => new DefaultTab());
5236
- }
5237
- createGroupAtLocation(location = [0]) {
5238
- const group = this.createGroup();
5239
- this.doAddGroup(group, location);
5240
- return group;
5241
- }
5242
- findGroup(panel) {
5243
- var _a;
5244
- return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
5245
- }
5246
- dispose() {
5247
- super.dispose();
5248
- this._onDidActivePanelChange.dispose();
5249
- this._onDidAddPanel.dispose();
5250
- this._onDidRemovePanel.dispose();
5251
- this._onDidLayoutFromJSON.dispose();
5252
- }
5253
- }
5254
-
5255
- class GridviewComponent extends BaseGrid {
5256
- get orientation() {
5257
- return this.gridview.orientation;
5258
- }
5259
- set orientation(value) {
5260
- this.gridview.orientation = value;
5261
- }
5262
- get options() {
5263
- return this._options;
5264
- }
5265
- get deserializer() {
5266
- return this._deserializer;
5267
- }
5268
- set deserializer(value) {
5269
- this._deserializer = value;
5270
- }
5271
- constructor(element, options) {
5272
- super(element, {
5273
- proportionalLayout: options.proportionalLayout,
5274
- orientation: options.orientation,
5275
- styles: options.styles,
5276
- });
5277
- this._onDidLayoutfromJSON = new Emitter();
5278
- this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5279
- this._options = options;
5280
- if (!this.options.components) {
5281
- this.options.components = {};
5282
- }
5283
- if (!this.options.frameworkComponents) {
5284
- this.options.frameworkComponents = {};
5285
- }
5286
- }
5287
- updateOptions(options) {
5288
- const hasOrientationChanged = typeof options.orientation === 'string' &&
5289
- this.gridview.orientation !== options.orientation;
5290
- this._options = Object.assign(Object.assign({}, this.options), options);
5291
- if (hasOrientationChanged) {
5292
- this.gridview.orientation = options.orientation;
5293
- }
5294
- this.layout(this.gridview.width, this.gridview.height, true);
5295
- }
5296
- removePanel(panel) {
5297
- this.removeGroup(panel);
5298
- }
5299
- /**
5300
- * Serialize the current state of the layout
5301
- *
5302
- * @returns A JSON respresentation of the layout
5303
- */
5304
- toJSON() {
5305
- var _a;
5306
- const data = this.gridview.serialize();
5307
- return {
5308
- grid: data,
5309
- activePanel: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
5310
- };
5311
- }
5312
- setVisible(panel, visible) {
5313
- this.gridview.setViewVisible(getGridLocation(panel.element), visible);
5314
- }
5315
- setActive(panel) {
5316
- this._groups.forEach((value, _key) => {
5317
- value.value.setActive(panel === value.value);
5318
- });
5319
- }
5320
- focus() {
5321
- var _a;
5322
- (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
5323
- }
5324
- fromJSON(serializedGridview) {
5325
- this.clear();
5326
- const { grid, activePanel } = serializedGridview;
5327
- const queue = [];
5328
- this.gridview.deserialize(grid, {
5329
- fromJSON: (node) => {
5330
- const { data } = node;
5331
- const view = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5332
- ? {
5333
- createComponent: this.options.frameworkComponentFactory
5334
- .createComponent,
5335
- }
5336
- : undefined);
5337
- queue.push(() => view.init({
5338
- params: data.params,
5339
- minimumWidth: data.minimumWidth,
5340
- maximumWidth: data.maximumWidth,
5341
- minimumHeight: data.minimumHeight,
5342
- maximumHeight: data.maximumHeight,
5343
- priority: data.priority,
5344
- snap: !!data.snap,
5345
- accessor: this,
5346
- isVisible: node.visible,
5347
- }));
5348
- this._onDidAddGroup.fire(view);
5349
- this.registerPanel(view);
5350
- return view;
5351
- },
5352
- });
5353
- this.layout(this.width, this.height, true);
5354
- queue.forEach((f) => f());
5355
- if (typeof activePanel === 'string') {
5356
- const panel = this.getPanel(activePanel);
5357
- if (panel) {
5358
- this.doSetGroupActive(panel);
5359
- }
5360
- }
5361
- this._onDidLayoutfromJSON.fire();
5362
- }
5363
- clear() {
5364
- const hasActiveGroup = this.activeGroup;
5365
- const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
5366
- for (const group of groups) {
5367
- group.disposable.dispose();
5368
- this.doRemoveGroup(group.value, { skipActive: true });
5369
- }
5370
- if (hasActiveGroup) {
5371
- this.doSetGroupActive(undefined);
5372
- }
5373
- this.gridview.clear();
5374
- }
5375
- movePanel(panel, options) {
5376
- var _a;
5377
- let relativeLocation;
5378
- const removedPanel = this.gridview.remove(panel);
5379
- const referenceGroup = (_a = this._groups.get(options.reference)) === null || _a === void 0 ? void 0 : _a.value;
5380
- if (!referenceGroup) {
5381
- throw new Error(`reference group ${options.reference} does not exist`);
5382
- }
5383
- const target = toTarget(options.direction);
5384
- if (target === 'center') {
5385
- throw new Error(`${target} not supported as an option`);
5386
- }
5387
- else {
5388
- const location = getGridLocation(referenceGroup.element);
5389
- relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5390
- }
5391
- this.doAddGroup(removedPanel, relativeLocation, options.size);
5392
- }
5393
- addPanel(options) {
5394
- var _a, _b;
5395
- let relativeLocation = options.location || [0];
5396
- if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
5397
- const referenceGroup = (_b = this._groups.get(options.position.referencePanel)) === null || _b === void 0 ? void 0 : _b.value;
5398
- if (!referenceGroup) {
5399
- throw new Error(`reference group ${options.position.referencePanel} does not exist`);
5400
- }
5401
- const target = toTarget(options.position.direction);
5402
- if (target === 'center') {
5403
- throw new Error(`${target} not supported as an option`);
5404
- }
5405
- else {
5406
- const location = getGridLocation(referenceGroup.element);
5407
- relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5408
- }
5521
+ this._onDidActivePanelChange.fire(event.panel);
5522
+ }));
5523
+ this._groups.set(view.id, { value: view, disposable });
5524
+ }
5525
+ // TODO: must be called after the above listeners have been setup,
5526
+ // not an ideal pattern
5527
+ view.initialize();
5528
+ if (typeof this.options.tabHeight === 'number') {
5529
+ view.model.header.height = this.options.tabHeight;
5409
5530
  }
5410
- const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5411
- ? {
5412
- createComponent: this.options.frameworkComponentFactory
5413
- .createComponent,
5414
- }
5415
- : undefined);
5416
- view.init({
5417
- params: options.params || {},
5418
- minimumWidth: options.minimumWidth,
5419
- maximumWidth: options.maximumWidth,
5420
- minimumHeight: options.minimumHeight,
5421
- maximumHeight: options.maximumHeight,
5422
- priority: options.priority,
5423
- snap: !!options.snap,
5424
- accessor: this,
5425
- isVisible: true,
5426
- });
5427
- this.registerPanel(view);
5428
- this.doAddGroup(view, relativeLocation, options.size);
5429
5531
  return view;
5430
5532
  }
5431
- registerPanel(panel) {
5432
- const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {
5433
- if (!event.isFocused) {
5434
- return;
5435
- }
5436
- this._groups.forEach((groupItem) => {
5437
- const group = groupItem.value;
5438
- if (group !== panel) {
5439
- group.setActive(false);
5440
- }
5441
- else {
5442
- group.setActive(true);
5443
- }
5444
- });
5445
- }));
5446
- this._groups.set(panel.id, {
5447
- value: panel,
5448
- disposable,
5533
+ createPanel(options, group) {
5534
+ const contentComponent = options.component;
5535
+ const tabComponent = options.tabComponent || this.options.defaultTabComponent;
5536
+ const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);
5537
+ const panel = new DockviewPanel(options.id, this, this._api, group, view);
5538
+ panel.init({
5539
+ title: options.title || options.id,
5540
+ params: (options === null || options === void 0 ? void 0 : options.params) || {},
5449
5541
  });
5542
+ return panel;
5450
5543
  }
5451
- moveGroup(referenceGroup, groupId, target) {
5452
- const sourceGroup = this.getPanel(groupId);
5453
- if (!sourceGroup) {
5454
- throw new Error('invalid operation');
5455
- }
5456
- const referenceLocation = getGridLocation(referenceGroup.element);
5457
- const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5458
- const [targetParentLocation, to] = tail(targetLocation);
5459
- const sourceLocation = getGridLocation(sourceGroup.element);
5460
- const [sourceParentLocation, from] = tail(sourceLocation);
5461
- if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
5462
- // special case when 'swapping' two views within same grid location
5463
- // if a group has one tab - we are essentially moving the 'group'
5464
- // which is equivalent to swapping two views in this case
5465
- this.gridview.moveView(sourceParentLocation, from, to);
5466
- return;
5467
- }
5468
- // source group will become empty so delete the group
5469
- const targetGroup = this.doRemoveGroup(sourceGroup, {
5470
- skipActive: true,
5471
- skipDispose: true,
5472
- });
5473
- // after deleting the group we need to re-evaulate the ref location
5474
- const updatedReferenceLocation = getGridLocation(referenceGroup.element);
5475
- const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
5476
- this.doAddGroup(targetGroup, location);
5544
+ createGroupAtLocation(location = [0]) {
5545
+ const group = this.createGroup();
5546
+ this.doAddGroup(group, location);
5547
+ return group;
5477
5548
  }
5478
- removeGroup(group) {
5479
- super.removeGroup(group);
5549
+ findGroup(panel) {
5550
+ var _a;
5551
+ return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
5480
5552
  }
5481
5553
  dispose() {
5482
5554
  super.dispose();
5483
- this._onDidLayoutfromJSON.dispose();
5555
+ this._onDidActivePanelChange.dispose();
5556
+ this._onDidAddPanel.dispose();
5557
+ this._onDidRemovePanel.dispose();
5558
+ this._onDidLayoutFromJSON.dispose();
5484
5559
  }
5485
5560
  }
5486
5561
 
5487
- /**
5488
- * A high-level implementation of splitview that works using 'panels'
5489
- */
5490
- class SplitviewComponent extends CompositeDisposable {
5491
- get panels() {
5492
- return this.splitview.getViews();
5493
- }
5494
- get options() {
5495
- return this._options;
5496
- }
5497
- get length() {
5498
- return this._panels.size;
5499
- }
5562
+ class GridviewComponent extends BaseGrid {
5500
5563
  get orientation() {
5501
- return this.splitview.orientation;
5502
- }
5503
- get splitview() {
5504
- return this._splitview;
5505
- }
5506
- set splitview(value) {
5507
- this._splitview = value;
5508
- this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
5509
- this._onDidLayoutChange.fire(undefined);
5510
- }), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
5564
+ return this.gridview.orientation;
5511
5565
  }
5512
- get minimumSize() {
5513
- return this.splitview.minimumSize;
5566
+ set orientation(value) {
5567
+ this.gridview.orientation = value;
5514
5568
  }
5515
- get maximumSize() {
5516
- return this.splitview.maximumSize;
5569
+ get options() {
5570
+ return this._options;
5517
5571
  }
5518
- get height() {
5519
- return this.splitview.orientation === exports.Orientation.HORIZONTAL
5520
- ? this.splitview.orthogonalSize
5521
- : this.splitview.size;
5572
+ get deserializer() {
5573
+ return this._deserializer;
5522
5574
  }
5523
- get width() {
5524
- return this.splitview.orientation === exports.Orientation.HORIZONTAL
5525
- ? this.splitview.size
5526
- : this.splitview.orthogonalSize;
5575
+ set deserializer(value) {
5576
+ this._deserializer = value;
5527
5577
  }
5528
5578
  constructor(element, options) {
5529
- super();
5530
- this.element = element;
5531
- this._disposable = new MutableDisposable();
5532
- this._panels = new Map();
5579
+ super(element, {
5580
+ proportionalLayout: options.proportionalLayout,
5581
+ orientation: options.orientation,
5582
+ styles: options.styles,
5583
+ });
5533
5584
  this._onDidLayoutfromJSON = new Emitter();
5534
5585
  this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5535
- this._onDidAddView = new Emitter();
5536
- this.onDidAddView = this._onDidAddView.event;
5537
- this._onDidRemoveView = new Emitter();
5538
- this.onDidRemoveView = this._onDidRemoveView.event;
5539
- this._onDidLayoutChange = new Emitter();
5540
- this.onDidLayoutChange = this._onDidLayoutChange.event;
5541
5586
  this._options = options;
5542
- if (!options.components) {
5543
- options.components = {};
5587
+ if (!this.options.components) {
5588
+ this.options.components = {};
5544
5589
  }
5545
- if (!options.frameworkComponents) {
5546
- options.frameworkComponents = {};
5590
+ if (!this.options.frameworkComponents) {
5591
+ this.options.frameworkComponents = {};
5547
5592
  }
5548
- this.splitview = new Splitview(this.element, options);
5549
- this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5550
5593
  }
5551
5594
  updateOptions(options) {
5552
5595
  const hasOrientationChanged = typeof options.orientation === 'string' &&
5553
- this.options.orientation !== options.orientation;
5596
+ this.gridview.orientation !== options.orientation;
5554
5597
  this._options = Object.assign(Object.assign({}, this.options), options);
5555
5598
  if (hasOrientationChanged) {
5556
- this.splitview.orientation = options.orientation;
5557
- }
5558
- this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
5559
- }
5560
- focus() {
5561
- var _a;
5562
- (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
5563
- }
5564
- movePanel(from, to) {
5565
- this.splitview.moveView(from, to);
5566
- }
5567
- setVisible(panel, visible) {
5568
- const index = this.panels.indexOf(panel);
5569
- this.splitview.setViewVisible(index, visible);
5570
- }
5571
- setActive(view, skipFocus) {
5572
- this._activePanel = view;
5573
- this.panels
5574
- .filter((v) => v !== view)
5575
- .forEach((v) => {
5576
- v.api._onDidActiveChange.fire({ isActive: false });
5577
- if (!skipFocus) {
5578
- v.focus();
5579
- }
5580
- });
5581
- view.api._onDidActiveChange.fire({ isActive: true });
5582
- if (!skipFocus) {
5583
- view.focus();
5584
- }
5585
- }
5586
- removePanel(panel, sizing) {
5587
- const disposable = this._panels.get(panel.id);
5588
- if (!disposable) {
5589
- throw new Error(`unknown splitview panel ${panel.id}`);
5590
- }
5591
- disposable.disposable.dispose();
5592
- disposable.value.dispose();
5593
- this._panels.delete(panel.id);
5594
- const index = this.panels.findIndex((_) => _ === panel);
5595
- this.splitview.removeView(index, sizing);
5596
- const panels = this.panels;
5597
- if (panels.length > 0) {
5598
- this.setActive(panels[panels.length - 1]);
5599
- }
5600
- }
5601
- getPanel(id) {
5602
- return this.panels.find((view) => view.id === id);
5603
- }
5604
- addPanel(options) {
5605
- if (this._panels.has(options.id)) {
5606
- throw new Error(`panel ${options.id} already exists`);
5599
+ this.gridview.orientation = options.orientation;
5607
5600
  }
5608
- const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5609
- ? {
5610
- createComponent: this.options.frameworkWrapper.createComponent,
5611
- }
5612
- : undefined);
5613
- view.orientation = this.splitview.orientation;
5614
- view.init({
5615
- params: options.params || {},
5616
- minimumSize: options.minimumSize,
5617
- maximumSize: options.maximumSize,
5618
- snap: options.snap,
5619
- priority: options.priority,
5620
- accessor: this,
5621
- });
5622
- const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
5623
- const index = typeof options.index === 'number' ? options.index : undefined;
5624
- this.splitview.addView(view, size, index);
5625
- this.doAddView(view);
5626
- this.setActive(view);
5627
- return view;
5628
- }
5629
- layout(width, height) {
5630
- const [size, orthogonalSize] = this.splitview.orientation === exports.Orientation.HORIZONTAL
5631
- ? [width, height]
5632
- : [height, width];
5633
- this.splitview.layout(size, orthogonalSize);
5601
+ this.layout(this.gridview.width, this.gridview.height, true);
5634
5602
  }
5635
- doAddView(view) {
5636
- const disposable = view.api.onDidFocusChange((event) => {
5637
- if (!event.isFocused) {
5638
- return;
5639
- }
5640
- this.setActive(view, true);
5641
- });
5642
- this._panels.set(view.id, { disposable, value: view });
5603
+ removePanel(panel) {
5604
+ this.removeGroup(panel);
5643
5605
  }
5606
+ /**
5607
+ * Serialize the current state of the layout
5608
+ *
5609
+ * @returns A JSON respresentation of the layout
5610
+ */
5644
5611
  toJSON() {
5645
5612
  var _a;
5646
- const views = this.splitview
5647
- .getViews()
5648
- .map((view, i) => {
5649
- const size = this.splitview.getViewSize(i);
5650
- return {
5651
- size,
5652
- data: view.toJSON(),
5653
- snap: !!view.snap,
5654
- priority: view.priority,
5655
- };
5656
- });
5613
+ const data = this.gridview.serialize();
5657
5614
  return {
5658
- views,
5659
- activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
5660
- size: this.splitview.size,
5661
- orientation: this.splitview.orientation,
5615
+ grid: data,
5616
+ activePanel: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,
5662
5617
  };
5663
5618
  }
5664
- fromJSON(serializedSplitview) {
5619
+ setVisible(panel, visible) {
5620
+ this.gridview.setViewVisible(getGridLocation(panel.element), visible);
5621
+ }
5622
+ setActive(panel) {
5623
+ this._groups.forEach((value, _key) => {
5624
+ value.value.setActive(panel === value.value);
5625
+ });
5626
+ }
5627
+ focus() {
5628
+ var _a;
5629
+ (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();
5630
+ }
5631
+ fromJSON(serializedGridview) {
5665
5632
  this.clear();
5666
- const { views, orientation, size, activeView } = serializedSplitview;
5633
+ const { grid, activePanel } = serializedGridview;
5667
5634
  const queue = [];
5668
- this.splitview = new Splitview(this.element, {
5669
- orientation,
5670
- proportionalLayout: this.options.proportionalLayout,
5671
- descriptor: {
5672
- size,
5673
- views: views.map((view) => {
5674
- const data = view.data;
5675
- if (this._panels.has(data.id)) {
5676
- throw new Error(`panel ${data.id} already exists`);
5635
+ this.gridview.deserialize(grid, {
5636
+ fromJSON: (node) => {
5637
+ const { data } = node;
5638
+ const view = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5639
+ ? {
5640
+ createComponent: this.options.frameworkComponentFactory
5641
+ .createComponent,
5677
5642
  }
5678
- const panel = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5679
- ? {
5680
- createComponent: this.options.frameworkWrapper
5681
- .createComponent,
5682
- }
5683
- : undefined);
5684
- queue.push(() => {
5685
- panel.init({
5686
- params: data.params || {},
5687
- minimumSize: data.minimumSize,
5688
- maximumSize: data.maximumSize,
5689
- snap: view.snap,
5690
- priority: view.priority,
5691
- accessor: this,
5692
- });
5693
- });
5694
- panel.orientation = orientation;
5695
- this.doAddView(panel);
5696
- setTimeout(() => {
5697
- // the original onDidAddView events are missed since they are fired before we can subcribe to them
5698
- this._onDidAddView.fire(panel);
5699
- }, 0);
5700
- return { size: view.size, view: panel };
5701
- }),
5643
+ : undefined);
5644
+ queue.push(() => view.init({
5645
+ params: data.params,
5646
+ minimumWidth: data.minimumWidth,
5647
+ maximumWidth: data.maximumWidth,
5648
+ minimumHeight: data.minimumHeight,
5649
+ maximumHeight: data.maximumHeight,
5650
+ priority: data.priority,
5651
+ snap: !!data.snap,
5652
+ accessor: this,
5653
+ isVisible: node.visible,
5654
+ }));
5655
+ this._onDidAddGroup.fire(view);
5656
+ this.registerPanel(view);
5657
+ return view;
5702
5658
  },
5703
5659
  });
5704
- this.layout(this.width, this.height);
5660
+ this.layout(this.width, this.height, true);
5705
5661
  queue.forEach((f) => f());
5706
- if (typeof activeView === 'string') {
5707
- const panel = this.getPanel(activeView);
5662
+ if (typeof activePanel === 'string') {
5663
+ const panel = this.getPanel(activePanel);
5708
5664
  if (panel) {
5709
- this.setActive(panel);
5665
+ this.doSetGroupActive(panel);
5710
5666
  }
5711
5667
  }
5712
5668
  this._onDidLayoutfromJSON.fire();
5713
5669
  }
5714
5670
  clear() {
5715
- for (const [_, value] of this._panels.entries()) {
5716
- value.disposable.dispose();
5717
- value.value.dispose();
5671
+ const hasActiveGroup = this.activeGroup;
5672
+ const groups = Array.from(this._groups.values()); // reassign since group panels will mutate
5673
+ for (const group of groups) {
5674
+ group.disposable.dispose();
5675
+ this.doRemoveGroup(group.value, { skipActive: true });
5718
5676
  }
5719
- this._panels.clear();
5720
- this.splitview.dispose();
5677
+ if (hasActiveGroup) {
5678
+ this.doSetGroupActive(undefined);
5679
+ }
5680
+ this.gridview.clear();
5721
5681
  }
5722
- dispose() {
5723
- for (const [_, value] of this._panels.entries()) {
5724
- value.disposable.dispose();
5725
- value.value.dispose();
5682
+ movePanel(panel, options) {
5683
+ var _a;
5684
+ let relativeLocation;
5685
+ const removedPanel = this.gridview.remove(panel);
5686
+ const referenceGroup = (_a = this._groups.get(options.reference)) === null || _a === void 0 ? void 0 : _a.value;
5687
+ if (!referenceGroup) {
5688
+ throw new Error(`reference group ${options.reference} does not exist`);
5726
5689
  }
5727
- this._panels.clear();
5728
- this.splitview.dispose();
5729
- super.dispose();
5690
+ const target = toTarget(options.direction);
5691
+ if (target === 'center') {
5692
+ throw new Error(`${target} not supported as an option`);
5693
+ }
5694
+ else {
5695
+ const location = getGridLocation(referenceGroup.element);
5696
+ relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5697
+ }
5698
+ this.doAddGroup(removedPanel, relativeLocation, options.size);
5730
5699
  }
5731
- }
5732
-
5733
- class SplitviewPanelApiImpl extends PanelApiImpl {
5734
- //
5735
- constructor(id) {
5736
- super(id);
5737
- this._onDidConstraintsChangeInternal = new Emitter();
5738
- this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
5739
- //
5740
- this._onDidConstraintsChange = new Emitter({
5741
- replay: true,
5700
+ addPanel(options) {
5701
+ var _a, _b;
5702
+ let relativeLocation = options.location || [0];
5703
+ if ((_a = options.position) === null || _a === void 0 ? void 0 : _a.referencePanel) {
5704
+ const referenceGroup = (_b = this._groups.get(options.position.referencePanel)) === null || _b === void 0 ? void 0 : _b.value;
5705
+ if (!referenceGroup) {
5706
+ throw new Error(`reference group ${options.position.referencePanel} does not exist`);
5707
+ }
5708
+ const target = toTarget(options.position.direction);
5709
+ if (target === 'center') {
5710
+ throw new Error(`${target} not supported as an option`);
5711
+ }
5712
+ else {
5713
+ const location = getGridLocation(referenceGroup.element);
5714
+ relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
5715
+ }
5716
+ }
5717
+ const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkComponentFactory
5718
+ ? {
5719
+ createComponent: this.options.frameworkComponentFactory
5720
+ .createComponent,
5721
+ }
5722
+ : undefined);
5723
+ view.init({
5724
+ params: options.params || {},
5725
+ minimumWidth: options.minimumWidth,
5726
+ maximumWidth: options.maximumWidth,
5727
+ minimumHeight: options.minimumHeight,
5728
+ maximumHeight: options.maximumHeight,
5729
+ priority: options.priority,
5730
+ snap: !!options.snap,
5731
+ accessor: this,
5732
+ isVisible: true,
5742
5733
  });
5743
- this.onDidConstraintsChange = this._onDidConstraintsChange.event;
5744
- //
5745
- this._onDidSizeChange = new Emitter();
5746
- this.onDidSizeChange = this._onDidSizeChange.event;
5747
- this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
5748
- }
5749
- setConstraints(value) {
5750
- this._onDidConstraintsChangeInternal.fire(value);
5751
- }
5752
- setSize(event) {
5753
- this._onDidSizeChange.fire(event);
5734
+ this.registerPanel(view);
5735
+ this.doAddGroup(view, relativeLocation, options.size);
5736
+ return view;
5754
5737
  }
5755
- }
5756
-
5757
- class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
5758
- set pane(pane) {
5759
- this._pane = pane;
5738
+ registerPanel(panel) {
5739
+ const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {
5740
+ if (!event.isFocused) {
5741
+ return;
5742
+ }
5743
+ this._groups.forEach((groupItem) => {
5744
+ const group = groupItem.value;
5745
+ if (group !== panel) {
5746
+ group.setActive(false);
5747
+ }
5748
+ else {
5749
+ group.setActive(true);
5750
+ }
5751
+ });
5752
+ }));
5753
+ this._groups.set(panel.id, {
5754
+ value: panel,
5755
+ disposable,
5756
+ });
5760
5757
  }
5761
- constructor(id) {
5762
- super(id);
5763
- this._onDidExpansionChange = new Emitter({
5764
- replay: true,
5758
+ moveGroup(referenceGroup, groupId, target) {
5759
+ const sourceGroup = this.getPanel(groupId);
5760
+ if (!sourceGroup) {
5761
+ throw new Error('invalid operation');
5762
+ }
5763
+ const referenceLocation = getGridLocation(referenceGroup.element);
5764
+ const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
5765
+ const [targetParentLocation, to] = tail(targetLocation);
5766
+ const sourceLocation = getGridLocation(sourceGroup.element);
5767
+ const [sourceParentLocation, from] = tail(sourceLocation);
5768
+ if (sequenceEquals(sourceParentLocation, targetParentLocation)) {
5769
+ // special case when 'swapping' two views within same grid location
5770
+ // if a group has one tab - we are essentially moving the 'group'
5771
+ // which is equivalent to swapping two views in this case
5772
+ this.gridview.moveView(sourceParentLocation, from, to);
5773
+ return;
5774
+ }
5775
+ // source group will become empty so delete the group
5776
+ const targetGroup = this.doRemoveGroup(sourceGroup, {
5777
+ skipActive: true,
5778
+ skipDispose: true,
5765
5779
  });
5766
- this.onDidExpansionChange = this._onDidExpansionChange.event;
5767
- this._onMouseEnter = new Emitter({});
5768
- this.onMouseEnter = this._onMouseEnter.event;
5769
- this._onMouseLeave = new Emitter({});
5770
- this.onMouseLeave = this._onMouseLeave.event;
5771
- this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
5780
+ // after deleting the group we need to re-evaulate the ref location
5781
+ const updatedReferenceLocation = getGridLocation(referenceGroup.element);
5782
+ const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);
5783
+ this.doAddGroup(targetGroup, location);
5772
5784
  }
5773
- setExpanded(isExpanded) {
5774
- var _a;
5775
- (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
5785
+ removeGroup(group) {
5786
+ super.removeGroup(group);
5776
5787
  }
5777
- get isExpanded() {
5778
- var _a;
5779
- return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
5788
+ dispose() {
5789
+ super.dispose();
5790
+ this._onDidLayoutfromJSON.dispose();
5780
5791
  }
5781
5792
  }
5782
5793
 
5783
- class PaneviewPanel extends BasePanelView {
5784
- set orientation(value) {
5785
- this._orientation = value;
5786
- }
5787
- get orientation() {
5788
- return this._orientation;
5789
- }
5790
- get minimumSize() {
5791
- const headerSize = this.headerSize;
5792
- const expanded = this.isExpanded();
5793
- const minimumBodySize = expanded ? this._minimumBodySize : 0;
5794
- return headerSize + minimumBodySize;
5794
+ /**
5795
+ * A high-level implementation of splitview that works using 'panels'
5796
+ */
5797
+ class SplitviewComponent extends CompositeDisposable {
5798
+ get panels() {
5799
+ return this.splitview.getViews();
5795
5800
  }
5796
- get maximumSize() {
5797
- const headerSize = this.headerSize;
5798
- const expanded = this.isExpanded();
5799
- const maximumBodySize = expanded ? this._maximumBodySize : 0;
5800
- return headerSize + maximumBodySize;
5801
+ get options() {
5802
+ return this._options;
5801
5803
  }
5802
- get size() {
5803
- return this._size;
5804
+ get length() {
5805
+ return this._panels.size;
5804
5806
  }
5805
- get orthogonalSize() {
5806
- return this._orthogonalSize;
5807
+ get orientation() {
5808
+ return this.splitview.orientation;
5807
5809
  }
5808
- set orthogonalSize(size) {
5809
- this._orthogonalSize = size;
5810
+ get splitview() {
5811
+ return this._splitview;
5810
5812
  }
5811
- get minimumBodySize() {
5812
- return this._minimumBodySize;
5813
+ set splitview(value) {
5814
+ this._splitview = value;
5815
+ this._disposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {
5816
+ this._onDidLayoutChange.fire(undefined);
5817
+ }), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));
5813
5818
  }
5814
- set minimumBodySize(value) {
5815
- this._minimumBodySize = typeof value === 'number' ? value : 0;
5819
+ get minimumSize() {
5820
+ return this.splitview.minimumSize;
5816
5821
  }
5817
- get maximumBodySize() {
5818
- return this._maximumBodySize;
5822
+ get maximumSize() {
5823
+ return this.splitview.maximumSize;
5819
5824
  }
5820
- set maximumBodySize(value) {
5821
- this._maximumBodySize =
5822
- typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
5825
+ get height() {
5826
+ return this.splitview.orientation === exports.Orientation.HORIZONTAL
5827
+ ? this.splitview.orthogonalSize
5828
+ : this.splitview.size;
5823
5829
  }
5824
- get headerVisible() {
5825
- return this._headerVisible;
5830
+ get width() {
5831
+ return this.splitview.orientation === exports.Orientation.HORIZONTAL
5832
+ ? this.splitview.size
5833
+ : this.splitview.orthogonalSize;
5826
5834
  }
5827
- set headerVisible(value) {
5828
- this._headerVisible = value;
5829
- this.header.style.display = value ? '' : 'none';
5835
+ constructor(element, options) {
5836
+ super();
5837
+ this.element = element;
5838
+ this._disposable = new MutableDisposable();
5839
+ this._panels = new Map();
5840
+ this._onDidLayoutfromJSON = new Emitter();
5841
+ this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;
5842
+ this._onDidAddView = new Emitter();
5843
+ this.onDidAddView = this._onDidAddView.event;
5844
+ this._onDidRemoveView = new Emitter();
5845
+ this.onDidRemoveView = this._onDidRemoveView.event;
5846
+ this._onDidLayoutChange = new Emitter();
5847
+ this.onDidLayoutChange = this._onDidLayoutChange.event;
5848
+ this._options = options;
5849
+ if (!options.components) {
5850
+ options.components = {};
5851
+ }
5852
+ if (!options.frameworkComponents) {
5853
+ options.frameworkComponents = {};
5854
+ }
5855
+ this.splitview = new Splitview(this.element, options);
5856
+ this.addDisposables(this._disposable, this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
5830
5857
  }
5831
- constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
5832
- super(id, component, new PaneviewPanelApiImpl(id));
5833
- this.headerComponent = headerComponent;
5834
- this._onDidChangeExpansionState = new Emitter({ replay: true });
5835
- this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
5836
- this._onDidChange = new Emitter();
5837
- this.onDidChange = this._onDidChange.event;
5838
- this.headerSize = 22;
5839
- this._orthogonalSize = 0;
5840
- this._size = 0;
5841
- this._minimumBodySize = 100;
5842
- this._maximumBodySize = Number.POSITIVE_INFINITY;
5843
- this._isExpanded = false;
5844
- this.expandedSize = 0;
5845
- this.api.pane = this; // TODO cannot use 'this' before 'super'
5846
- this.api.initialize(this);
5847
- this._isExpanded = isExpanded;
5848
- this._headerVisible = isHeaderVisible;
5849
- this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
5850
- this._orientation = orientation;
5851
- this.element.classList.add('pane');
5852
- this.addDisposables(this.api.onDidSizeChange((event) => {
5853
- this._onDidChange.fire({ size: event.size });
5854
- }), addDisposableListener(this.element, 'mouseenter', (ev) => {
5855
- this.api._onMouseEnter.fire(ev);
5856
- }), addDisposableListener(this.element, 'mouseleave', (ev) => {
5857
- this.api._onMouseLeave.fire(ev);
5858
- }));
5859
- this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
5860
- this.api._onDidExpansionChange.fire({
5861
- isExpanded: isPanelExpanded,
5862
- });
5863
- }), this.api.onDidFocusChange((e) => {
5864
- if (!this.header) {
5865
- return;
5866
- }
5867
- if (e.isFocused) {
5868
- addClasses(this.header, 'focused');
5869
- }
5870
- else {
5871
- removeClasses(this.header, 'focused');
5872
- }
5873
- }));
5874
- this.renderOnce();
5858
+ updateOptions(options) {
5859
+ const hasOrientationChanged = typeof options.orientation === 'string' &&
5860
+ this.options.orientation !== options.orientation;
5861
+ this._options = Object.assign(Object.assign({}, this.options), options);
5862
+ if (hasOrientationChanged) {
5863
+ this.splitview.orientation = options.orientation;
5864
+ }
5865
+ this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);
5875
5866
  }
5876
- setVisible(isVisible) {
5877
- this.api._onDidVisibilityChange.fire({ isVisible });
5867
+ focus() {
5868
+ var _a;
5869
+ (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
5878
5870
  }
5879
- setActive(isActive) {
5880
- this.api._onDidActiveChange.fire({ isActive });
5871
+ movePanel(from, to) {
5872
+ this.splitview.moveView(from, to);
5881
5873
  }
5882
- isExpanded() {
5883
- return this._isExpanded;
5874
+ setVisible(panel, visible) {
5875
+ const index = this.panels.indexOf(panel);
5876
+ this.splitview.setViewVisible(index, visible);
5884
5877
  }
5885
- setExpanded(expanded) {
5886
- if (this._isExpanded === expanded) {
5887
- return;
5888
- }
5889
- this._isExpanded = expanded;
5890
- if (expanded) {
5891
- if (this.animationTimer) {
5892
- clearTimeout(this.animationTimer);
5893
- }
5894
- if (this.body) {
5895
- this.element.appendChild(this.body);
5878
+ setActive(view, skipFocus) {
5879
+ this._activePanel = view;
5880
+ this.panels
5881
+ .filter((v) => v !== view)
5882
+ .forEach((v) => {
5883
+ v.api._onDidActiveChange.fire({ isActive: false });
5884
+ if (!skipFocus) {
5885
+ v.focus();
5896
5886
  }
5887
+ });
5888
+ view.api._onDidActiveChange.fire({ isActive: true });
5889
+ if (!skipFocus) {
5890
+ view.focus();
5897
5891
  }
5898
- else {
5899
- this.animationTimer = setTimeout(() => {
5900
- var _a;
5901
- (_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
5902
- }, 200);
5903
- }
5904
- this._onDidChange.fire(expanded ? { size: this.width } : {});
5905
- this._onDidChangeExpansionState.fire(expanded);
5906
- }
5907
- layout(size, orthogonalSize) {
5908
- this._size = size;
5909
- this._orthogonalSize = orthogonalSize;
5910
- const [width, height] = this.orientation === exports.Orientation.HORIZONTAL
5911
- ? [size, orthogonalSize]
5912
- : [orthogonalSize, size];
5913
- if (this.isExpanded()) {
5914
- this.expandedSize = width;
5915
- }
5916
- super.layout(width, height);
5917
5892
  }
5918
- init(parameters) {
5919
- var _a, _b;
5920
- super.init(parameters);
5921
- if (typeof parameters.minimumBodySize === 'number') {
5922
- this.minimumBodySize = parameters.minimumBodySize;
5893
+ removePanel(panel, sizing) {
5894
+ const disposable = this._panels.get(panel.id);
5895
+ if (!disposable) {
5896
+ throw new Error(`unknown splitview panel ${panel.id}`);
5923
5897
  }
5924
- if (typeof parameters.maximumBodySize === 'number') {
5925
- this.maximumBodySize = parameters.maximumBodySize;
5898
+ disposable.disposable.dispose();
5899
+ disposable.value.dispose();
5900
+ this._panels.delete(panel.id);
5901
+ const index = this.panels.findIndex((_) => _ === panel);
5902
+ this.splitview.removeView(index, sizing);
5903
+ const panels = this.panels;
5904
+ if (panels.length > 0) {
5905
+ this.setActive(panels[panels.length - 1]);
5926
5906
  }
5927
- this.bodyPart = this.getBodyComponent();
5928
- this.headerPart = this.getHeaderComponent();
5929
- this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
5930
- this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
5931
- (_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);
5932
- (_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
5933
- if (typeof parameters.isExpanded === 'boolean') {
5934
- this.setExpanded(parameters.isExpanded);
5907
+ }
5908
+ getPanel(id) {
5909
+ return this.panels.find((view) => view.id === id);
5910
+ }
5911
+ addPanel(options) {
5912
+ if (this._panels.has(options.id)) {
5913
+ throw new Error(`panel ${options.id} already exists`);
5935
5914
  }
5915
+ const view = createComponent(options.id, options.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5916
+ ? {
5917
+ createComponent: this.options.frameworkWrapper.createComponent,
5918
+ }
5919
+ : undefined);
5920
+ view.orientation = this.splitview.orientation;
5921
+ view.init({
5922
+ params: options.params || {},
5923
+ minimumSize: options.minimumSize,
5924
+ maximumSize: options.maximumSize,
5925
+ snap: options.snap,
5926
+ priority: options.priority,
5927
+ accessor: this,
5928
+ });
5929
+ const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
5930
+ const index = typeof options.index === 'number' ? options.index : undefined;
5931
+ this.splitview.addView(view, size, index);
5932
+ this.doAddView(view);
5933
+ this.setActive(view);
5934
+ return view;
5936
5935
  }
5937
- toJSON() {
5938
- const params = this._params;
5939
- return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
5936
+ layout(width, height) {
5937
+ const [size, orthogonalSize] = this.splitview.orientation === exports.Orientation.HORIZONTAL
5938
+ ? [width, height]
5939
+ : [height, width];
5940
+ this.splitview.layout(size, orthogonalSize);
5940
5941
  }
5941
- renderOnce() {
5942
- this.header = document.createElement('div');
5943
- this.header.tabIndex = 0;
5944
- this.header.className = 'pane-header';
5945
- this.header.style.height = `${this.headerSize}px`;
5946
- this.header.style.lineHeight = `${this.headerSize}px`;
5947
- this.header.style.minHeight = `${this.headerSize}px`;
5948
- this.header.style.maxHeight = `${this.headerSize}px`;
5949
- this.element.appendChild(this.header);
5950
- this.body = document.createElement('div');
5951
- this.body.className = 'pane-body';
5952
- this.element.appendChild(this.body);
5942
+ doAddView(view) {
5943
+ const disposable = view.api.onDidFocusChange((event) => {
5944
+ if (!event.isFocused) {
5945
+ return;
5946
+ }
5947
+ this.setActive(view, true);
5948
+ });
5949
+ this._panels.set(view.id, { disposable, value: view });
5953
5950
  }
5954
- // TODO slightly hacky by-pass of the component to create a body and header component
5955
- getComponent() {
5951
+ toJSON() {
5952
+ var _a;
5953
+ const views = this.splitview
5954
+ .getViews()
5955
+ .map((view, i) => {
5956
+ const size = this.splitview.getViewSize(i);
5957
+ return {
5958
+ size,
5959
+ data: view.toJSON(),
5960
+ snap: !!view.snap,
5961
+ priority: view.priority,
5962
+ };
5963
+ });
5956
5964
  return {
5957
- update: (params) => {
5958
- var _a, _b;
5959
- (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
5960
- (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
5961
- },
5962
- dispose: () => {
5963
- var _a, _b;
5964
- (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
5965
- (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
5966
- },
5965
+ views,
5966
+ activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
5967
+ size: this.splitview.size,
5968
+ orientation: this.splitview.orientation,
5967
5969
  };
5968
5970
  }
5969
- }
5970
-
5971
- class DraggablePaneviewPanel extends PaneviewPanel {
5972
- constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
5973
- super(id, component, headerComponent, orientation, isExpanded, true);
5974
- this.accessor = accessor;
5975
- this._onDidDrop = new Emitter();
5976
- this.onDidDrop = this._onDidDrop.event;
5977
- if (!disableDnd) {
5978
- this.initDragFeatures();
5979
- }
5980
- }
5981
- initDragFeatures() {
5982
- if (!this.header) {
5983
- return;
5984
- }
5985
- const id = this.id;
5986
- const accessorId = this.accessor.id;
5987
- this.header.draggable = true;
5988
- this.handler = new (class PaneDragHandler extends DragHandler {
5989
- getData() {
5990
- LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
5991
- return {
5992
- dispose: () => {
5993
- LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
5994
- },
5995
- };
5996
- }
5997
- })(this.header);
5998
- this.target = new Droptarget(this.element, {
5999
- acceptedTargetZones: ['top', 'bottom'],
6000
- overlayModel: {
6001
- activationSize: { type: 'percentage', value: 50 },
6002
- },
6003
- canDisplayOverlay: (event) => {
6004
- const data = getPaneData();
6005
- if (data) {
6006
- if (data.paneId !== this.id &&
6007
- data.viewId === this.accessor.id) {
6008
- return true;
5971
+ fromJSON(serializedSplitview) {
5972
+ this.clear();
5973
+ const { views, orientation, size, activeView } = serializedSplitview;
5974
+ const queue = [];
5975
+ this.splitview = new Splitview(this.element, {
5976
+ orientation,
5977
+ proportionalLayout: this.options.proportionalLayout,
5978
+ descriptor: {
5979
+ size,
5980
+ views: views.map((view) => {
5981
+ const data = view.data;
5982
+ if (this._panels.has(data.id)) {
5983
+ throw new Error(`panel ${data.id} already exists`);
6009
5984
  }
6010
- }
6011
- if (this.accessor.options.showDndOverlay) {
6012
- return this.accessor.options.showDndOverlay({
6013
- nativeEvent: event,
6014
- getData: getPaneData,
6015
- panel: this,
5985
+ const panel = createComponent(data.id, data.component, this.options.components || {}, this.options.frameworkComponents || {}, this.options.frameworkWrapper
5986
+ ? {
5987
+ createComponent: this.options.frameworkWrapper
5988
+ .createComponent,
5989
+ }
5990
+ : undefined);
5991
+ queue.push(() => {
5992
+ panel.init({
5993
+ params: data.params || {},
5994
+ minimumSize: data.minimumSize,
5995
+ maximumSize: data.maximumSize,
5996
+ snap: view.snap,
5997
+ priority: view.priority,
5998
+ accessor: this,
5999
+ });
6016
6000
  });
6017
- }
6018
- return false;
6001
+ panel.orientation = orientation;
6002
+ this.doAddView(panel);
6003
+ setTimeout(() => {
6004
+ // the original onDidAddView events are missed since they are fired before we can subcribe to them
6005
+ this._onDidAddView.fire(panel);
6006
+ }, 0);
6007
+ return { size: view.size, view: panel };
6008
+ }),
6019
6009
  },
6020
6010
  });
6021
- this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
6022
- this.onDrop(event);
6023
- }));
6024
- }
6025
- onDrop(event) {
6026
- const data = getPaneData();
6027
- if (!data || data.viewId !== this.accessor.id) {
6028
- // if there is no local drag event for this panel
6029
- // or if the drag event was creating by another Paneview instance
6030
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
6031
- return;
6032
- }
6033
- const containerApi = this._params
6034
- .containerApi;
6035
- const panelId = data.paneId;
6036
- const existingPanel = containerApi.getPanel(panelId);
6037
- if (!existingPanel) {
6038
- // if the panel doesn't exist
6039
- this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData }));
6040
- return;
6011
+ this.layout(this.width, this.height);
6012
+ queue.forEach((f) => f());
6013
+ if (typeof activeView === 'string') {
6014
+ const panel = this.getPanel(activeView);
6015
+ if (panel) {
6016
+ this.setActive(panel);
6017
+ }
6041
6018
  }
6042
- const allPanels = containerApi.panels;
6043
- const fromIndex = allPanels.indexOf(existingPanel);
6044
- let toIndex = containerApi.panels.indexOf(this);
6045
- if (event.position === 'left' || event.position === 'top') {
6046
- toIndex = Math.max(0, toIndex - 1);
6019
+ this._onDidLayoutfromJSON.fire();
6020
+ }
6021
+ clear() {
6022
+ for (const [_, value] of this._panels.entries()) {
6023
+ value.disposable.dispose();
6024
+ value.value.dispose();
6047
6025
  }
6048
- if (event.position === 'right' || event.position === 'bottom') {
6049
- if (fromIndex > toIndex) {
6050
- toIndex++;
6051
- }
6052
- toIndex = Math.min(allPanels.length - 1, toIndex);
6026
+ this._panels.clear();
6027
+ this.splitview.dispose();
6028
+ }
6029
+ dispose() {
6030
+ for (const [_, value] of this._panels.entries()) {
6031
+ value.disposable.dispose();
6032
+ value.value.dispose();
6053
6033
  }
6054
- containerApi.movePanel(fromIndex, toIndex);
6034
+ this._panels.clear();
6035
+ this.splitview.dispose();
6036
+ super.dispose();
6055
6037
  }
6056
6038
  }
6057
6039
 
@@ -6194,7 +6176,7 @@
6194
6176
  this.addDisposables(this._disposable);
6195
6177
  }
6196
6178
  focus() {
6197
- //
6179
+ //noop
6198
6180
  }
6199
6181
  updateOptions(options) {
6200
6182
  this._options = Object.assign(Object.assign({}, this.options), options);
@@ -6513,7 +6495,10 @@
6513
6495
  * require a key property like any other React element rendered in an array
6514
6496
  * to prevent excessive re-rendering
6515
6497
  */
6516
- const uniquePortalKeyGenerator = sequentialNumberGenerator();
6498
+ const uniquePortalKeyGenerator = (() => {
6499
+ let value = 1;
6500
+ return { next: () => `dockview_react_portal_key_${(value++).toString()}` };
6501
+ })();
6517
6502
  const ReactPartContext = React__namespace.createContext({});
6518
6503
  class ReactPart {
6519
6504
  constructor(parent, portalStore, component, parameters, context) {
@@ -6630,18 +6615,10 @@
6630
6615
  containerApi: parameters.containerApi,
6631
6616
  });
6632
6617
  }
6633
- toJSON() {
6634
- return {
6635
- id: this.id,
6636
- };
6637
- }
6638
6618
  update(event) {
6639
6619
  var _a;
6640
6620
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6641
6621
  }
6642
- updateParentGroup(group, _isPanelVisible) {
6643
- this._group = group;
6644
- }
6645
6622
  layout(_width, _height) {
6646
6623
  // noop
6647
6624
  }
@@ -6678,60 +6655,15 @@
6678
6655
  var _a;
6679
6656
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(event.params);
6680
6657
  }
6681
- toJSON() {
6682
- if (this.id === DEFAULT_TAB_IDENTIFIER) {
6683
- return {};
6684
- }
6685
- return {
6686
- id: this.id,
6687
- };
6688
- }
6689
6658
  layout(_width, _height) {
6690
6659
  // noop - retrieval from api
6691
6660
  }
6692
- updateParentGroup(_group, _isPanelVisible) {
6693
- // noop - retrieval from api
6694
- }
6695
6661
  dispose() {
6696
6662
  var _a;
6697
6663
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
6698
6664
  }
6699
6665
  }
6700
6666
 
6701
- class ReactPanelDeserialzier {
6702
- constructor(layout) {
6703
- this.layout = layout;
6704
- }
6705
- fromJSON(panelData, group) {
6706
- var _a, _b, _c, _d;
6707
- const panelId = panelData.id;
6708
- const params = panelData.params;
6709
- const title = panelData.title;
6710
- const viewData = panelData.view;
6711
- let tab;
6712
- if ((_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id) {
6713
- 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());
6714
- }
6715
- else if (this.layout.options.defaultTabComponent) {
6716
- 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());
6717
- }
6718
- else {
6719
- tab = new DefaultTab();
6720
- }
6721
- const view = new DefaultGroupPanelView({
6722
- 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),
6723
- tab,
6724
- });
6725
- const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group);
6726
- panel.init({
6727
- view,
6728
- title,
6729
- params: params || {},
6730
- });
6731
- return panel;
6732
- }
6733
- }
6734
-
6735
6667
  class ReactWatermarkPart {
6736
6668
  get element() {
6737
6669
  return this._element;
@@ -6740,21 +6672,16 @@
6740
6672
  this.id = id;
6741
6673
  this.component = component;
6742
6674
  this.reactPortalStore = reactPortalStore;
6743
- this._groupRef = {
6744
- value: undefined,
6745
- };
6746
6675
  this._element = document.createElement('div');
6747
6676
  this._element.className = 'dockview-react-part';
6748
6677
  }
6749
6678
  init(parameters) {
6750
- this.parameters = parameters;
6751
6679
  this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
6752
- params: parameters.params,
6753
- api: parameters.api,
6680
+ group: parameters.group,
6754
6681
  containerApi: parameters.containerApi,
6755
6682
  close: () => {
6756
- if (this._groupRef.value) {
6757
- parameters.containerApi.removeGroup(this._groupRef.value);
6683
+ if (parameters.group) {
6684
+ parameters.containerApi.removeGroup(parameters.group);
6758
6685
  }
6759
6686
  },
6760
6687
  });
@@ -6769,17 +6696,11 @@
6769
6696
  }
6770
6697
  (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: ((_b = this.parameters) === null || _b === void 0 ? void 0 : _b.params) || {} });
6771
6698
  }
6772
- toJSON() {
6773
- return {
6774
- id: this.id,
6775
- };
6776
- }
6777
6699
  layout(_width, _height) {
6778
6700
  // noop - retrieval from api
6779
6701
  }
6780
- updateParentGroup(group, _isPanelVisible) {
6781
- // noop - retrieval from api
6782
- this._groupRef.value = group;
6702
+ updateParentGroup(_group, _isPanelVisible) {
6703
+ // noop
6783
6704
  }
6784
6705
  dispose() {
6785
6706
  var _a;
@@ -6861,6 +6782,7 @@
6861
6782
  }
6862
6783
  : undefined;
6863
6784
  }
6785
+ const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
6864
6786
  const DockviewReact = React__namespace.forwardRef((props, ref) => {
6865
6787
  const domRef = React__namespace.useRef(null);
6866
6788
  const dockviewRef = React__namespace.useRef();
@@ -6907,13 +6829,20 @@
6907
6829
  },
6908
6830
  };
6909
6831
  const element = document.createElement('div');
6832
+ const frameworkTabComponents = props.tabComponents || {};
6833
+ if (props.defaultTabComponent) {
6834
+ frameworkTabComponents[DEFAULT_REACT_TAB] =
6835
+ props.defaultTabComponent;
6836
+ }
6910
6837
  const dockview = new DockviewComponent(element, {
6911
6838
  frameworkComponentFactory: factory,
6912
6839
  frameworkComponents: props.components,
6913
- frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6840
+ frameworkTabComponents,
6914
6841
  tabHeight: props.tabHeight,
6915
6842
  watermarkFrameworkComponent: props.watermarkComponent,
6916
- defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6843
+ defaultTabComponent: props.defaultTabComponent
6844
+ ? DEFAULT_REACT_TAB
6845
+ : undefined,
6917
6846
  styles: props.hideBorders
6918
6847
  ? { separatorBorder: 'transparent' }
6919
6848
  : undefined,
@@ -6922,7 +6851,6 @@
6922
6851
  singleTabMode: props.singleTabMode,
6923
6852
  });
6924
6853
  (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.appendChild(dockview.element);
6925
- dockview.deserializer = new ReactPanelDeserialzier(dockview);
6926
6854
  const { clientWidth, clientHeight } = domRef.current;
6927
6855
  dockview.layout(clientWidth, clientHeight);
6928
6856
  if (props.onReady) {
@@ -6985,9 +6913,16 @@
6985
6913
  if (!dockviewRef.current) {
6986
6914
  return;
6987
6915
  }
6916
+ const frameworkTabComponents = props.tabComponents || {};
6917
+ if (props.defaultTabComponent) {
6918
+ frameworkTabComponents[DEFAULT_REACT_TAB] =
6919
+ props.defaultTabComponent;
6920
+ }
6988
6921
  dockviewRef.current.updateOptions({
6989
- defaultTabComponent: DEFAULT_TAB_IDENTIFIER,
6990
- frameworkTabComponents: Object.assign(Object.assign({}, (props.tabComponents || {})), { [DEFAULT_TAB_IDENTIFIER]: props.defaultTabComponent }),
6922
+ defaultTabComponent: props.defaultTabComponent
6923
+ ? DEFAULT_REACT_TAB
6924
+ : undefined,
6925
+ frameworkTabComponents,
6991
6926
  });
6992
6927
  }, [props.defaultTabComponent]);
6993
6928
  React__namespace.useEffect(() => {
@@ -7132,7 +7067,7 @@
7132
7067
 
7133
7068
  class ReactGridPanelView extends GridviewPanel {
7134
7069
  constructor(id, component, reactComponent, reactPortalStore) {
7135
- super(id, component, new GridviewPanelApiImpl(id));
7070
+ super(id, component);
7136
7071
  this.reactComponent = reactComponent;
7137
7072
  this.reactPortalStore = reactPortalStore;
7138
7073
  }
@@ -7342,16 +7277,24 @@
7342
7277
 
7343
7278
  exports.BaseGrid = BaseGrid;
7344
7279
  exports.ContentContainer = ContentContainer;
7280
+ exports.DefaultDockviewDeserialzier = DefaultDockviewDeserialzier;
7281
+ exports.DefaultTab = DefaultTab;
7345
7282
  exports.DockviewApi = DockviewApi;
7346
7283
  exports.DockviewComponent = DockviewComponent;
7284
+ exports.DockviewCompositeDisposable = CompositeDisposable;
7347
7285
  exports.DockviewDefaultTab = DockviewDefaultTab;
7286
+ exports.DockviewEmitter = Emitter;
7287
+ exports.DockviewGroupPanel = DockviewGroupPanel;
7288
+ exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
7289
+ exports.DockviewMutableDisposable = MutableDisposable;
7290
+ exports.DockviewPanel = DockviewPanel;
7348
7291
  exports.DockviewReact = DockviewReact;
7292
+ exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
7349
7293
  exports.Gridview = Gridview;
7350
7294
  exports.GridviewApi = GridviewApi;
7351
7295
  exports.GridviewComponent = GridviewComponent;
7352
7296
  exports.GridviewPanel = GridviewPanel;
7353
7297
  exports.GridviewReact = GridviewReact;
7354
- exports.Groupview = Groupview;
7355
7298
  exports.LocalSelectionTransfer = LocalSelectionTransfer;
7356
7299
  exports.PaneFramework = PaneFramework;
7357
7300
  exports.PaneTransfer = PaneTransfer;
@@ -7369,6 +7312,7 @@
7369
7312
  exports.SplitviewPanel = SplitviewPanel;
7370
7313
  exports.SplitviewReact = SplitviewReact;
7371
7314
  exports.Tab = Tab;
7315
+ exports.createComponent = createComponent;
7372
7316
  exports.directionToPosition = directionToPosition;
7373
7317
  exports.getDirectionOrientation = getDirectionOrientation;
7374
7318
  exports.getGridLocation = getGridLocation;
@@ -7387,5 +7331,6 @@
7387
7331
  exports.positionToDirection = positionToDirection;
7388
7332
  exports.toTarget = toTarget;
7389
7333
  exports.usePortalsLifecycle = usePortalsLifecycle;
7334
+ exports.watchElementResize = watchElementResize;
7390
7335
 
7391
7336
  }));