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