dockview 1.6.0 → 1.7.0

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