@vuu-ui/vuu-layout 2.1.19-beta.2 → 2.1.19-beta.3

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 (353) hide show
  1. package/cjs/Component.js +14 -0
  2. package/cjs/Component.js.map +1 -0
  3. package/cjs/LayoutContainer.css.js +6 -0
  4. package/cjs/LayoutContainer.css.js.map +1 -0
  5. package/cjs/LayoutContainer.js +33 -0
  6. package/cjs/LayoutContainer.js.map +1 -0
  7. package/cjs/dock-layout/DockLayout.css.js +6 -0
  8. package/cjs/dock-layout/DockLayout.css.js.map +1 -0
  9. package/cjs/dock-layout/DockLayout.js +41 -0
  10. package/cjs/dock-layout/DockLayout.js.map +1 -0
  11. package/cjs/dock-layout/Drawer.css.js +6 -0
  12. package/cjs/dock-layout/Drawer.css.js.map +1 -0
  13. package/cjs/dock-layout/Drawer.js +95 -0
  14. package/cjs/dock-layout/Drawer.js.map +1 -0
  15. package/cjs/drag-drop/BoxModel.js +416 -0
  16. package/cjs/drag-drop/BoxModel.js.map +1 -0
  17. package/cjs/drag-drop/DragState.js +161 -0
  18. package/cjs/drag-drop/DragState.js.map +1 -0
  19. package/cjs/drag-drop/Draggable.js +192 -0
  20. package/cjs/drag-drop/Draggable.js.map +1 -0
  21. package/cjs/drag-drop/DropTarget.js +257 -0
  22. package/cjs/drag-drop/DropTarget.js.map +1 -0
  23. package/cjs/drag-drop/DropTargetRenderer.js +218 -0
  24. package/cjs/drag-drop/DropTargetRenderer.js.map +1 -0
  25. package/cjs/flexbox/Flexbox.css.js +6 -0
  26. package/cjs/flexbox/Flexbox.css.js.map +1 -0
  27. package/cjs/flexbox/Flexbox.js +69 -0
  28. package/cjs/flexbox/Flexbox.js.map +1 -0
  29. package/cjs/flexbox/FlexboxLayout.js +30 -0
  30. package/cjs/flexbox/FlexboxLayout.js.map +1 -0
  31. package/cjs/flexbox/Splitter.css.js +6 -0
  32. package/cjs/flexbox/Splitter.css.js.map +1 -0
  33. package/cjs/flexbox/Splitter.js +122 -0
  34. package/cjs/flexbox/Splitter.js.map +1 -0
  35. package/cjs/flexbox/flexbox-utils.js +95 -0
  36. package/cjs/flexbox/flexbox-utils.js.map +1 -0
  37. package/cjs/flexbox/useSplitterResizing.js +197 -0
  38. package/cjs/flexbox/useSplitterResizing.js.map +1 -0
  39. package/cjs/index.js +122 -0
  40. package/cjs/index.js.map +1 -0
  41. package/cjs/layout-action.js +24 -0
  42. package/cjs/layout-action.js.map +1 -0
  43. package/cjs/layout-header/Header.css.js +6 -0
  44. package/cjs/layout-header/Header.css.js.map +1 -0
  45. package/cjs/layout-header/Header.js +152 -0
  46. package/cjs/layout-header/Header.js.map +1 -0
  47. package/cjs/layout-header/useHeader.js +85 -0
  48. package/cjs/layout-header/useHeader.js.map +1 -0
  49. package/cjs/layout-provider/LayoutProvider.js +304 -0
  50. package/cjs/layout-provider/LayoutProvider.js.map +1 -0
  51. package/cjs/layout-provider/LayoutProviderContext.js +23 -0
  52. package/cjs/layout-provider/LayoutProviderContext.js.map +1 -0
  53. package/cjs/layout-provider/useLayoutDragDrop.js +177 -0
  54. package/cjs/layout-provider/useLayoutDragDrop.js.map +1 -0
  55. package/cjs/layout-reducer/flexUtils.js +227 -0
  56. package/cjs/layout-reducer/flexUtils.js.map +1 -0
  57. package/cjs/layout-reducer/insert-layout-element.js +286 -0
  58. package/cjs/layout-reducer/insert-layout-element.js.map +1 -0
  59. package/cjs/layout-reducer/layout-reducer.js +202 -0
  60. package/cjs/layout-reducer/layout-reducer.js.map +1 -0
  61. package/cjs/layout-reducer/layoutTypes.js +40 -0
  62. package/cjs/layout-reducer/layoutTypes.js.map +1 -0
  63. package/cjs/layout-reducer/layoutUtils.js +237 -0
  64. package/cjs/layout-reducer/layoutUtils.js.map +1 -0
  65. package/cjs/layout-reducer/move-layout-element.js +31 -0
  66. package/cjs/layout-reducer/move-layout-element.js.map +1 -0
  67. package/cjs/layout-reducer/remove-layout-element.js +237 -0
  68. package/cjs/layout-reducer/remove-layout-element.js.map +1 -0
  69. package/cjs/layout-reducer/replace-layout-element.js +96 -0
  70. package/cjs/layout-reducer/replace-layout-element.js.map +1 -0
  71. package/cjs/layout-reducer/resize-flex-children.js +62 -0
  72. package/cjs/layout-reducer/resize-flex-children.js.map +1 -0
  73. package/cjs/layout-reducer/wrap-layout-element.js +211 -0
  74. package/cjs/layout-reducer/wrap-layout-element.js.map +1 -0
  75. package/cjs/layout-view/View.css.js +6 -0
  76. package/cjs/layout-view/View.css.js.map +1 -0
  77. package/cjs/layout-view/View.js +160 -0
  78. package/cjs/layout-view/View.js.map +1 -0
  79. package/cjs/layout-view/useView.js +75 -0
  80. package/cjs/layout-view/useView.js.map +1 -0
  81. package/cjs/layout-view/useViewBroadcastChannel.js +35 -0
  82. package/cjs/layout-view/useViewBroadcastChannel.js.map +1 -0
  83. package/cjs/layout-view/useViewResize.js +42 -0
  84. package/cjs/layout-view/useViewResize.js.map +1 -0
  85. package/cjs/layout-view-actions/ViewContext.js +16 -0
  86. package/cjs/layout-view-actions/ViewContext.js.map +1 -0
  87. package/cjs/layout-view-actions/useViewActionDispatcher.js +112 -0
  88. package/cjs/layout-view-actions/useViewActionDispatcher.js.map +1 -0
  89. package/cjs/layout-view-actions/useViewContributions.js +33 -0
  90. package/cjs/layout-view-actions/useViewContributions.js.map +1 -0
  91. package/cjs/palette/Palette.css.js +6 -0
  92. package/cjs/palette/Palette.css.js.map +1 -0
  93. package/cjs/palette/Palette.js +115 -0
  94. package/cjs/palette/Palette.js.map +1 -0
  95. package/cjs/placeholder/LayoutStartPanel.css.js +6 -0
  96. package/cjs/placeholder/LayoutStartPanel.css.js.map +1 -0
  97. package/cjs/placeholder/LayoutStartPanel.js +56 -0
  98. package/cjs/placeholder/LayoutStartPanel.js.map +1 -0
  99. package/cjs/placeholder/Placeholder.css.js +6 -0
  100. package/cjs/placeholder/Placeholder.css.js.map +1 -0
  101. package/cjs/placeholder/Placeholder.js +34 -0
  102. package/cjs/placeholder/Placeholder.js.map +1 -0
  103. package/cjs/responsive/useResizeObserver.js +118 -0
  104. package/cjs/responsive/useResizeObserver.js.map +1 -0
  105. package/cjs/responsive/utils.js +34 -0
  106. package/cjs/responsive/utils.js.map +1 -0
  107. package/cjs/stack/Stack.css.js +6 -0
  108. package/cjs/stack/Stack.css.js.map +1 -0
  109. package/cjs/stack/Stack.js +150 -0
  110. package/cjs/stack/Stack.js.map +1 -0
  111. package/cjs/stack/StackLayout.js +116 -0
  112. package/cjs/stack/StackLayout.js.map +1 -0
  113. package/cjs/use-persistent-state.js +63 -0
  114. package/cjs/use-persistent-state.js.map +1 -0
  115. package/cjs/utils/pathUtils.js +293 -0
  116. package/cjs/utils/pathUtils.js.map +1 -0
  117. package/cjs/utils/propUtils.js +27 -0
  118. package/cjs/utils/propUtils.js.map +1 -0
  119. package/cjs/utils/refUtils.js +12 -0
  120. package/cjs/utils/refUtils.js.map +1 -0
  121. package/cjs/utils/styleUtils.js +15 -0
  122. package/cjs/utils/styleUtils.js.map +1 -0
  123. package/cjs/utils/typeOf.js +27 -0
  124. package/cjs/utils/typeOf.js.map +1 -0
  125. package/esm/Component.js +12 -0
  126. package/esm/Component.js.map +1 -0
  127. package/esm/LayoutContainer.css.js +4 -0
  128. package/esm/LayoutContainer.css.js.map +1 -0
  129. package/esm/LayoutContainer.js +31 -0
  130. package/esm/LayoutContainer.js.map +1 -0
  131. package/esm/dock-layout/DockLayout.css.js +4 -0
  132. package/esm/dock-layout/DockLayout.css.js.map +1 -0
  133. package/esm/dock-layout/DockLayout.js +39 -0
  134. package/esm/dock-layout/DockLayout.js.map +1 -0
  135. package/esm/dock-layout/Drawer.css.js +4 -0
  136. package/esm/dock-layout/Drawer.css.js.map +1 -0
  137. package/esm/dock-layout/Drawer.js +93 -0
  138. package/esm/dock-layout/Drawer.js.map +1 -0
  139. package/esm/drag-drop/BoxModel.js +409 -0
  140. package/esm/drag-drop/BoxModel.js.map +1 -0
  141. package/esm/drag-drop/DragState.js +159 -0
  142. package/esm/drag-drop/DragState.js.map +1 -0
  143. package/esm/drag-drop/Draggable.js +190 -0
  144. package/esm/drag-drop/Draggable.js.map +1 -0
  145. package/esm/drag-drop/DropTarget.js +253 -0
  146. package/esm/drag-drop/DropTarget.js.map +1 -0
  147. package/esm/drag-drop/DropTargetRenderer.js +216 -0
  148. package/esm/drag-drop/DropTargetRenderer.js.map +1 -0
  149. package/esm/flexbox/Flexbox.css.js +4 -0
  150. package/esm/flexbox/Flexbox.css.js.map +1 -0
  151. package/esm/flexbox/Flexbox.js +67 -0
  152. package/esm/flexbox/Flexbox.js.map +1 -0
  153. package/esm/flexbox/FlexboxLayout.js +28 -0
  154. package/esm/flexbox/FlexboxLayout.js.map +1 -0
  155. package/esm/flexbox/Splitter.css.js +4 -0
  156. package/esm/flexbox/Splitter.css.js.map +1 -0
  157. package/esm/flexbox/Splitter.js +120 -0
  158. package/esm/flexbox/Splitter.js.map +1 -0
  159. package/esm/flexbox/flexbox-utils.js +89 -0
  160. package/esm/flexbox/flexbox-utils.js.map +1 -0
  161. package/esm/flexbox/useSplitterResizing.js +195 -0
  162. package/esm/flexbox/useSplitterResizing.js.map +1 -0
  163. package/esm/index.js +33 -0
  164. package/esm/index.js.map +1 -0
  165. package/esm/layout-action.js +22 -0
  166. package/esm/layout-action.js.map +1 -0
  167. package/esm/layout-header/Header.css.js +4 -0
  168. package/esm/layout-header/Header.css.js.map +1 -0
  169. package/esm/layout-header/Header.js +150 -0
  170. package/esm/layout-header/Header.js.map +1 -0
  171. package/esm/layout-header/useHeader.js +83 -0
  172. package/esm/layout-header/useHeader.js.map +1 -0
  173. package/esm/layout-provider/LayoutProvider.js +297 -0
  174. package/esm/layout-provider/LayoutProvider.js.map +1 -0
  175. package/esm/layout-provider/LayoutProviderContext.js +20 -0
  176. package/esm/layout-provider/LayoutProviderContext.js.map +1 -0
  177. package/esm/layout-provider/useLayoutDragDrop.js +175 -0
  178. package/esm/layout-provider/useLayoutDragDrop.js.map +1 -0
  179. package/esm/layout-reducer/flexUtils.js +218 -0
  180. package/esm/layout-reducer/flexUtils.js.map +1 -0
  181. package/esm/layout-reducer/insert-layout-element.js +282 -0
  182. package/esm/layout-reducer/insert-layout-element.js.map +1 -0
  183. package/esm/layout-reducer/layout-reducer.js +200 -0
  184. package/esm/layout-reducer/layout-reducer.js.map +1 -0
  185. package/esm/layout-reducer/layoutTypes.js +36 -0
  186. package/esm/layout-reducer/layoutTypes.js.map +1 -0
  187. package/esm/layout-reducer/layoutUtils.js +226 -0
  188. package/esm/layout-reducer/layoutUtils.js.map +1 -0
  189. package/esm/layout-reducer/move-layout-element.js +29 -0
  190. package/esm/layout-reducer/move-layout-element.js.map +1 -0
  191. package/esm/layout-reducer/remove-layout-element.js +235 -0
  192. package/esm/layout-reducer/remove-layout-element.js.map +1 -0
  193. package/esm/layout-reducer/replace-layout-element.js +92 -0
  194. package/esm/layout-reducer/replace-layout-element.js.map +1 -0
  195. package/esm/layout-reducer/resize-flex-children.js +59 -0
  196. package/esm/layout-reducer/resize-flex-children.js.map +1 -0
  197. package/esm/layout-reducer/wrap-layout-element.js +209 -0
  198. package/esm/layout-reducer/wrap-layout-element.js.map +1 -0
  199. package/esm/layout-view/View.css.js +4 -0
  200. package/esm/layout-view/View.css.js.map +1 -0
  201. package/esm/layout-view/View.js +158 -0
  202. package/esm/layout-view/View.js.map +1 -0
  203. package/esm/layout-view/useView.js +73 -0
  204. package/esm/layout-view/useView.js.map +1 -0
  205. package/esm/layout-view/useViewBroadcastChannel.js +33 -0
  206. package/esm/layout-view/useViewBroadcastChannel.js.map +1 -0
  207. package/esm/layout-view/useViewResize.js +40 -0
  208. package/esm/layout-view/useViewResize.js.map +1 -0
  209. package/esm/layout-view-actions/ViewContext.js +12 -0
  210. package/esm/layout-view-actions/ViewContext.js.map +1 -0
  211. package/esm/layout-view-actions/useViewActionDispatcher.js +110 -0
  212. package/esm/layout-view-actions/useViewActionDispatcher.js.map +1 -0
  213. package/esm/layout-view-actions/useViewContributions.js +31 -0
  214. package/esm/layout-view-actions/useViewContributions.js.map +1 -0
  215. package/esm/palette/Palette.css.js +4 -0
  216. package/esm/palette/Palette.css.js.map +1 -0
  217. package/esm/palette/Palette.js +112 -0
  218. package/esm/palette/Palette.js.map +1 -0
  219. package/esm/placeholder/LayoutStartPanel.css.js +4 -0
  220. package/esm/placeholder/LayoutStartPanel.css.js.map +1 -0
  221. package/esm/placeholder/LayoutStartPanel.js +54 -0
  222. package/esm/placeholder/LayoutStartPanel.js.map +1 -0
  223. package/esm/placeholder/Placeholder.css.js +4 -0
  224. package/esm/placeholder/Placeholder.css.js.map +1 -0
  225. package/esm/placeholder/Placeholder.js +32 -0
  226. package/esm/placeholder/Placeholder.js.map +1 -0
  227. package/esm/responsive/useResizeObserver.js +112 -0
  228. package/esm/responsive/useResizeObserver.js.map +1 -0
  229. package/esm/responsive/utils.js +31 -0
  230. package/esm/responsive/utils.js.map +1 -0
  231. package/esm/stack/Stack.css.js +4 -0
  232. package/esm/stack/Stack.css.js.map +1 -0
  233. package/esm/stack/Stack.js +148 -0
  234. package/esm/stack/Stack.js.map +1 -0
  235. package/esm/stack/StackLayout.js +114 -0
  236. package/esm/stack/StackLayout.js.map +1 -0
  237. package/esm/use-persistent-state.js +58 -0
  238. package/esm/use-persistent-state.js.map +1 -0
  239. package/esm/utils/pathUtils.js +280 -0
  240. package/esm/utils/pathUtils.js.map +1 -0
  241. package/esm/utils/propUtils.js +23 -0
  242. package/esm/utils/propUtils.js.map +1 -0
  243. package/esm/utils/refUtils.js +10 -0
  244. package/esm/utils/refUtils.js.map +1 -0
  245. package/esm/utils/styleUtils.js +13 -0
  246. package/esm/utils/styleUtils.js.map +1 -0
  247. package/esm/utils/typeOf.js +23 -0
  248. package/esm/utils/typeOf.js.map +1 -0
  249. package/package.json +18 -15
  250. package/types/dock-layout/DockLayout.d.ts +4 -4
  251. package/types/dock-layout/Drawer.d.ts +4 -4
  252. package/types/drag-drop/BoxModel.d.ts +7 -7
  253. package/types/flexbox/FlexboxLayout.d.ts +4 -4
  254. package/types/flexbox/Splitter.d.ts +1 -1
  255. package/types/layout-reducer/layoutUtils.d.ts +1 -1
  256. package/types/layout-reducer/remove-layout-element.d.ts +1 -1
  257. package/types/layout-reducer/replace-layout-element.d.ts +2 -2
  258. package/types/layout-reducer/resize-flex-children.d.ts +2 -2
  259. package/types/layout-view/useView.d.ts +1 -1
  260. package/types/placeholder/Placeholder.d.ts +4 -4
  261. package/types/responsive/overflowUtils.d.ts +2 -2
  262. package/types/stack/StackLayout.d.ts +4 -4
  263. package/types/tools/devtools-box/layout-configurator.d.ts +26 -26
  264. package/types/tools/devtools-tree/layout-tree-viewer.d.ts +2 -2
  265. package/types/utils/pathUtils.d.ts +1 -1
  266. package/src/Component.js +0 -14
  267. package/src/LayoutContainer.css.js +0 -24
  268. package/src/LayoutContainer.js +0 -26
  269. package/src/debug.js +0 -16
  270. package/src/dock-layout/DockLayout.css.js +0 -36
  271. package/src/dock-layout/DockLayout.js +0 -43
  272. package/src/dock-layout/Drawer.css.js +0 -150
  273. package/src/dock-layout/Drawer.js +0 -82
  274. package/src/dock-layout/index.js +0 -2
  275. package/src/drag-drop/BoxModel.js +0 -337
  276. package/src/drag-drop/DragState.js +0 -119
  277. package/src/drag-drop/Draggable.js +0 -140
  278. package/src/drag-drop/DropTarget.js +0 -286
  279. package/src/drag-drop/DropTargetRenderer.js +0 -275
  280. package/src/drag-drop/dragDropTypes.js +0 -0
  281. package/src/drag-drop/index.js +0 -3
  282. package/src/flexbox/Flexbox.css.js +0 -45
  283. package/src/flexbox/Flexbox.js +0 -45
  284. package/src/flexbox/FlexboxLayout.js +0 -27
  285. package/src/flexbox/Splitter.css.js +0 -57
  286. package/src/flexbox/Splitter.js +0 -112
  287. package/src/flexbox/flexbox-utils.js +0 -92
  288. package/src/flexbox/flexboxTypes.js +0 -0
  289. package/src/flexbox/index.js +0 -2
  290. package/src/flexbox/useSplitterResizing.js +0 -181
  291. package/src/index.js +0 -20
  292. package/src/layout-action.js +0 -20
  293. package/src/layout-header/ActionButton.js +0 -15
  294. package/src/layout-header/Header.css.js +0 -32
  295. package/src/layout-header/Header.js +0 -99
  296. package/src/layout-header/index.js +0 -1
  297. package/src/layout-header/useHeader.js +0 -76
  298. package/src/layout-provider/LayoutProvider.js +0 -242
  299. package/src/layout-provider/LayoutProviderContext.js +0 -13
  300. package/src/layout-provider/index.js +0 -2
  301. package/src/layout-provider/useLayoutDragDrop.js +0 -147
  302. package/src/layout-reducer/flexUtils.js +0 -186
  303. package/src/layout-reducer/index.js +0 -4
  304. package/src/layout-reducer/insert-layout-element.js +0 -179
  305. package/src/layout-reducer/layout-reducer.js +0 -121
  306. package/src/layout-reducer/layoutTypes.js +0 -34
  307. package/src/layout-reducer/layoutUtils.js +0 -178
  308. package/src/layout-reducer/move-layout-element.js +0 -18
  309. package/src/layout-reducer/remove-layout-element.js +0 -161
  310. package/src/layout-reducer/replace-layout-element.js +0 -70
  311. package/src/layout-reducer/resize-flex-children.js +0 -48
  312. package/src/layout-reducer/wrap-layout-element.js +0 -134
  313. package/src/layout-view/View.css.js +0 -76
  314. package/src/layout-view/View.js +0 -116
  315. package/src/layout-view/useView.js +0 -69
  316. package/src/layout-view/useViewBroadcastChannel.js +0 -29
  317. package/src/layout-view/useViewResize.js +0 -27
  318. package/src/layout-view/viewTypes.js +0 -0
  319. package/src/layout-view-actions/ViewContext.js +0 -11
  320. package/src/layout-view-actions/useViewActionDispatcher.js +0 -116
  321. package/src/layout-view-actions/useViewContributions.js +0 -31
  322. package/src/palette/Palette.css.js +0 -31
  323. package/src/palette/Palette.js +0 -85
  324. package/src/palette/index.js +0 -1
  325. package/src/placeholder/LayoutStartPanel.css.js +0 -35
  326. package/src/placeholder/LayoutStartPanel.js +0 -57
  327. package/src/placeholder/Placeholder.css.js +0 -20
  328. package/src/placeholder/Placeholder.js +0 -33
  329. package/src/placeholder/index.js +0 -1
  330. package/src/responsive/index.js +0 -2
  331. package/src/responsive/measureMinimumNodeSize.js +0 -24
  332. package/src/responsive/useResizeObserver.js +0 -109
  333. package/src/responsive/utils.js +0 -27
  334. package/src/stack/Stack.css.js +0 -44
  335. package/src/stack/Stack.js +0 -98
  336. package/src/stack/StackLayout.js +0 -116
  337. package/src/stack/index.js +0 -3
  338. package/src/stack/stackTypes.js +0 -0
  339. package/src/tabs/TabPanel.css.js +0 -17
  340. package/src/tabs/TabPanel.js +0 -11
  341. package/src/tabs/index.js +0 -1
  342. package/src/tools/config-wrapper/ConfigWrapper.js +0 -55
  343. package/src/tools/config-wrapper/index.js +0 -1
  344. package/src/tools/devtools-box/layout-configurator.css.js +0 -113
  345. package/src/tools/devtools-tree/layout-tree-viewer.css.js +0 -17
  346. package/src/tools/index.js +0 -3
  347. package/src/use-persistent-state.js +0 -43
  348. package/src/utils/index.js +0 -5
  349. package/src/utils/pathUtils.js +0 -212
  350. package/src/utils/propUtils.js +0 -15
  351. package/src/utils/refUtils.js +0 -5
  352. package/src/utils/styleUtils.js +0 -9
  353. package/src/utils/typeOf.js +0 -15
@@ -1,286 +0,0 @@
1
- import { getProps, typeOf } from "../utils/index.js";
2
- import { BoxModel, Position, RelativeDropPosition, getPosition, positionValues } from "./BoxModel.js";
3
- const isTabstrip = (dropTarget)=>dropTarget.pos.tab && "Stack" === typeOf(dropTarget.component) && dropTarget.pos.position.Header;
4
- const { north: north, south: south, east: east, west: west } = positionValues;
5
- const eastwest = east + west;
6
- const northsouth = north + south;
7
- class DropTarget {
8
- active;
9
- box;
10
- clientRect;
11
- component;
12
- dropRect;
13
- nextDropTarget;
14
- pos;
15
- constructor({ component, pos, clientRect, nextDropTarget }){
16
- this.component = component;
17
- this.pos = pos;
18
- this.clientRect = clientRect;
19
- this.nextDropTarget = nextDropTarget;
20
- this.active = false;
21
- this.dropRect = void 0;
22
- }
23
- targetTabPos(tab) {
24
- const { left: tabLeft, width: tabWidth, positionRelativeToTab } = tab;
25
- return positionRelativeToTab === RelativeDropPosition.BEFORE ? tabLeft : tabLeft + tabWidth;
26
- }
27
- getTargetDropOutline(lineWidth, dragState) {
28
- if (this.pos.tab) return this.getDropTabOutline(lineWidth, this.pos.tab);
29
- {
30
- if (dragState && dragState.hasIntrinsicSize()) return this.getIntrinsicDropRect(dragState);
31
- const [l, t, r, b] = this.getDropRectOutline(lineWidth, dragState);
32
- return {
33
- l,
34
- t,
35
- r,
36
- b
37
- };
38
- }
39
- }
40
- getDropTabOutline(lineWidth, tab) {
41
- const { clientRect: { top, left, right, bottom, header } } = this;
42
- const inset = 0;
43
- const gap = Math.round(lineWidth / 2) + inset;
44
- const t = Math.round(top);
45
- const l = Math.round(left + gap);
46
- const r = Math.round(right - gap);
47
- const b = Math.round(bottom - gap);
48
- const tabLeft = this.targetTabPos(tab);
49
- const tabWidth = 60;
50
- const tabHeight = (header?.bottom ?? 0) - (header?.top ?? 0);
51
- return {
52
- l,
53
- t,
54
- r,
55
- b,
56
- tabLeft,
57
- tabWidth,
58
- tabHeight
59
- };
60
- }
61
- getIntrinsicDropRect(dragState) {
62
- const { pos, clientRect: rect } = this;
63
- const { x, y } = dragState;
64
- let height = dragState.intrinsicSize?.height ?? 0;
65
- let width = dragState.intrinsicSize?.height ?? 0;
66
- if (height && height > rect.height) {
67
- console.log("DropTarget: we're going to blow the gaff");
68
- height = rect.height;
69
- } else if (width && width > rect.width) {
70
- console.log("DropTarget: we're going to blow the gaff");
71
- width = rect.width;
72
- }
73
- const left = Math.min(rect.right - width, Math.max(rect.left, Math.round(pos.x - x.mousePct * width)));
74
- const top = Math.min(rect.bottom - height, Math.max(rect.top, Math.round(pos.y - y.mousePct * height)));
75
- const [l, t, r, b] = this.dropRect = [
76
- left,
77
- top,
78
- left + width,
79
- top + height
80
- ];
81
- const guideLines = pos.position.EastOrWest ? [
82
- l,
83
- rect.top,
84
- l,
85
- rect.bottom,
86
- r,
87
- rect.top,
88
- r,
89
- rect.bottom
90
- ] : [
91
- rect.left,
92
- t,
93
- rect.right,
94
- t,
95
- rect.left,
96
- b,
97
- rect.right,
98
- b
99
- ];
100
- return {
101
- l,
102
- r,
103
- t,
104
- b,
105
- guideLines
106
- };
107
- }
108
- getDropRectOutline(lineWidth, dragState) {
109
- const { pos, clientRect: rect } = this;
110
- const { width: suggestedWidth, height: suggestedHeight, position } = pos;
111
- const { width: intrinsicWidth, height: intrinsicHeight } = dragState?.intrinsicSize ?? {};
112
- const sizeHeight = intrinsicHeight ?? suggestedHeight ?? 0;
113
- const sizeWidth = intrinsicWidth ?? suggestedWidth ?? 0;
114
- this.dropRect = void 0;
115
- const { top: t, left: l, right: r, bottom: b } = rect;
116
- const inset = 0;
117
- const gap = Math.round(lineWidth / 2) + inset;
118
- switch(position){
119
- case Position.North:
120
- case Position.Header:
121
- {
122
- const halfHeight = Math.round((b - t) / 2);
123
- const height = sizeHeight ? Math.min(halfHeight, Math.round(sizeHeight)) : halfHeight;
124
- return sizeWidth && l + sizeWidth < r ? [
125
- l + gap,
126
- t + gap,
127
- l + sizeWidth - gap,
128
- t + gap + height
129
- ] : [
130
- l + gap,
131
- t + gap,
132
- r - gap,
133
- t + gap + height
134
- ];
135
- }
136
- case Position.West:
137
- {
138
- const halfWidth = Math.round((r - l) / 2);
139
- const width = sizeWidth ? Math.min(halfWidth, Math.round(sizeWidth)) : halfWidth;
140
- return sizeHeight && t + sizeHeight < b ? [
141
- l + gap,
142
- t + gap,
143
- l - gap + width,
144
- t + sizeHeight + gap
145
- ] : [
146
- l + gap,
147
- t + gap,
148
- l - gap + width,
149
- b - gap
150
- ];
151
- }
152
- case Position.East:
153
- {
154
- const halfWidth = Math.round((r - l) / 2);
155
- const width = sizeWidth ? Math.min(halfWidth, Math.round(sizeWidth)) : halfWidth;
156
- return sizeHeight && t + sizeHeight < b ? [
157
- r - gap - width,
158
- t + gap,
159
- r - gap,
160
- t + sizeHeight + gap
161
- ] : [
162
- r - gap - width,
163
- t + gap,
164
- r - gap,
165
- b - gap
166
- ];
167
- }
168
- case Position.South:
169
- {
170
- const halfHeight = Math.round((b - t) / 2);
171
- const height = sizeHeight ? Math.min(halfHeight, Math.round(sizeHeight)) : halfHeight;
172
- return sizeWidth && l + sizeWidth < r ? [
173
- l + gap,
174
- b - gap - height,
175
- l + sizeWidth - gap,
176
- b - gap
177
- ] : [
178
- l + gap,
179
- b - gap - height,
180
- r - gap,
181
- b - gap
182
- ];
183
- }
184
- case Position.Centre:
185
- return [
186
- l + gap,
187
- t + gap,
188
- r - gap,
189
- b - gap
190
- ];
191
- default:
192
- console.warn(`DropTarget does not recognize position ${position}`);
193
- return null;
194
- }
195
- }
196
- activate() {
197
- this.active = true;
198
- return this;
199
- }
200
- toArray() {
201
- let dropTarget = this;
202
- const dropTargets = [
203
- dropTarget
204
- ];
205
- while(dropTarget = dropTarget.nextDropTarget)dropTargets.push(dropTarget);
206
- return dropTargets;
207
- }
208
- static getActiveDropTarget(dropTarget) {
209
- return null === dropTarget ? null : dropTarget?.active ? dropTarget : DropTarget.getActiveDropTarget(dropTarget.nextDropTarget);
210
- }
211
- }
212
- function identifyDropTarget(x, y, rootLayout, measurements, intrinsicSize, validDropTargets) {
213
- let dropTarget = null;
214
- const allBoxesContainingPoint = BoxModel.allBoxesContainingPoint(rootLayout, measurements, x, y, validDropTargets);
215
- if (allBoxesContainingPoint.length) {
216
- const [component, ...containers] = allBoxesContainingPoint;
217
- const { "data-path": dataPath, path = dataPath, "data-row-placeholder": isRowPlaceholder } = getProps(component);
218
- const clientRect = measurements[path];
219
- const placeholderOrientation = intrinsicSize && isRowPlaceholder ? "row" : void 0;
220
- const pos = getPosition(x, y, clientRect, placeholderOrientation);
221
- const box = measurements[path];
222
- const nextDropTarget = ([nextTarget, ...targets])=>{
223
- if (pos.position?.Header || pos.closeToTheEdge) {
224
- const targetPosition = getTargetPosition(nextTarget, pos, box, measurements, x, y);
225
- if (targetPosition) {
226
- const [containerPos, clientRect] = targetPosition;
227
- return new DropTarget({
228
- component: nextTarget,
229
- pos: containerPos,
230
- clientRect,
231
- nextDropTarget: nextDropTarget(targets) ?? null
232
- });
233
- }
234
- if (targets.length) return nextDropTarget(targets);
235
- }
236
- };
237
- dropTarget = new DropTarget({
238
- component,
239
- pos,
240
- clientRect,
241
- nextDropTarget: nextDropTarget(containers) ?? null
242
- }).activate();
243
- }
244
- return dropTarget;
245
- }
246
- function getTargetPosition(container, { closeToTheEdge, position }, box, measurements, x, y) {
247
- if (!container || "LayoutContainer" === container.type) return;
248
- const containingBox = measurements[container.props.path];
249
- const closeToTop = closeToTheEdge & positionValues.north;
250
- const closeToRight = closeToTheEdge & positionValues.east;
251
- const closeToBottom = closeToTheEdge & positionValues.south;
252
- const closeToLeft = closeToTheEdge & positionValues.west;
253
- const atTop = (closeToTop || position.Header) && Math.round(box.top) === Math.round(containingBox.top);
254
- const atRight = closeToRight && Math.round(box.right) === Math.round(containingBox.right);
255
- const atBottom = closeToBottom && Math.round(box.bottom) === Math.round(containingBox.bottom);
256
- const atLeft = closeToLeft && Math.round(box.left) === Math.round(containingBox.left);
257
- if (atTop || atRight || atBottom || atLeft) {
258
- const { "data-path": dataPath, path = dataPath } = container.props;
259
- const clientRect = measurements[path];
260
- const containerPos = getPosition(x, y, clientRect);
261
- if ((isVBox(container) || isTabbedContainer(container)) && closeToTheEdge & eastwest) {
262
- containerPos.width = 120;
263
- return [
264
- containerPos,
265
- clientRect
266
- ];
267
- }
268
- if ((isHBox(container) || isTabbedContainer(container)) && (position.Header || closeToTheEdge & northsouth)) {
269
- containerPos.height = 120;
270
- return [
271
- containerPos,
272
- clientRect
273
- ];
274
- }
275
- }
276
- }
277
- function isTabbedContainer(component) {
278
- return "Stack" === typeOf(component);
279
- }
280
- function isVBox(component) {
281
- return "Flexbox" === typeOf(component) && "column" === component.props.style.flexDirection;
282
- }
283
- function isHBox(component) {
284
- return "Flexbox" === typeOf(component) && "row" === component.props.style.flexDirection;
285
- }
286
- export { DropTarget, identifyDropTarget, isTabstrip };
@@ -1,275 +0,0 @@
1
- import { RelativeDropPosition } from "./BoxModel.js";
2
- let _hoverDropTarget = null;
3
- let _shiftedTab = null;
4
- const start = ([x, y])=>`M${x},${y}`;
5
- const point = ([x, y])=>`L${x},${y}`;
6
- const pathFromPoints = ([p1, ...points])=>`${start(p1)} ${points.map(point)}Z`;
7
- const pathFromGuideLines = (guideLines)=>{
8
- if (!guideLines) return "";
9
- {
10
- const [x1, y1, x2, y2, x3, y3, x4, y4] = guideLines;
11
- return `M${x1},${y1} L${x2},${y2} M${x3},${y3} L${x4},${y4}`;
12
- }
13
- };
14
- function insertSVGRoot() {
15
- if (null === document.getElementById("hw-drag-canvas")) {
16
- const root = document.getElementById("root");
17
- const container = document.createElement("div");
18
- container.id = "hw-drag-canvas";
19
- container.style.cssText = "visibility:hidden;z-index:10;position:absolute;top:0px;left:0;right:0;bottom:0;background-color:transparent";
20
- container.innerHTML = `
21
- <svg width="100%" height="100%" style="position: absolute;">
22
- <path id="hw-drop-guides" style="fill: none; stroke: rgba(0, 0, 0, 0.3);stroke-dasharray: 2 3"/>
23
- <path
24
- id="vuu-drop-outline"
25
- style="fill:rgba(0,0,255,.3);stroke:none;stroke-dasharray:4 2"
26
- d="M300,132 L380,132 L380,100 L460,100 L460,132, L550,132 L550,350 L300,350z">
27
- <animate
28
- attributeName="d"
29
- id="hw-drop-outline-animate"
30
- begin="indefinite"
31
- dur="300ms"
32
- fill="freeze"
33
- to="M255,33 L255,33,L255,1,L315,1,L315,1,L794,1,L794,164,L255,164Z"
34
- />
35
- </path>
36
- </svg>
37
- `;
38
- document.body.insertBefore(container, root);
39
- }
40
- }
41
- class DropTargetCanvas {
42
- currentPath = null;
43
- tabMode = null;
44
- constructor(){
45
- insertSVGRoot();
46
- }
47
- prepare(dragRect, tabMode = "full-view") {
48
- const dragCanvas = document.getElementById("hw-drag-canvas");
49
- if (dragCanvas) dragCanvas.style.visibility = "visible";
50
- else throw Error("DropTargetRenderer.prepare no drag canvas detected");
51
- document.body.classList.add("drawing");
52
- this.currentPath = null;
53
- this.tabMode = tabMode;
54
- const points = this.getPoints(0, 0, 0, 0);
55
- const d = pathFromPoints(points);
56
- const dropOutlinePath = document.getElementById("vuu-drop-outline");
57
- dropOutlinePath?.setAttribute("d", d);
58
- this.currentPath = d;
59
- }
60
- clear() {
61
- _hoverDropTarget = null;
62
- clearShiftedTab();
63
- const dragCanvas = document.getElementById("hw-drag-canvas");
64
- if (dragCanvas) dragCanvas.style.visibility = "hidden";
65
- }
66
- get hoverDropTarget() {
67
- return _hoverDropTarget;
68
- }
69
- getPoints(x, y, width, height, tabLeft = 0, tabWidth = 0, tabHeight = 0) {
70
- const tabOnly = "tab-only" === this.tabMode;
71
- if (0 === tabWidth) return [
72
- [
73
- x,
74
- y + tabHeight
75
- ],
76
- [
77
- x,
78
- y + tabHeight
79
- ],
80
- [
81
- x,
82
- y
83
- ],
84
- [
85
- x + tabWidth,
86
- y
87
- ],
88
- [
89
- x + tabWidth,
90
- y
91
- ],
92
- [
93
- x + width,
94
- y
95
- ],
96
- [
97
- x + width,
98
- y + height
99
- ],
100
- [
101
- x,
102
- y + height
103
- ]
104
- ];
105
- if (tabOnly) {
106
- const left = tabLeft;
107
- return [
108
- [
109
- left,
110
- y
111
- ],
112
- [
113
- left,
114
- y
115
- ],
116
- [
117
- left + tabWidth,
118
- y
119
- ],
120
- [
121
- left + tabWidth,
122
- y
123
- ],
124
- [
125
- left + tabWidth,
126
- y + tabHeight
127
- ],
128
- [
129
- left + tabWidth,
130
- y + tabHeight
131
- ],
132
- [
133
- left,
134
- y + tabHeight
135
- ],
136
- [
137
- left,
138
- y + tabHeight
139
- ]
140
- ];
141
- }
142
- if (0 === tabLeft) return [
143
- [
144
- x,
145
- y + tabHeight
146
- ],
147
- [
148
- x,
149
- y + tabHeight
150
- ],
151
- [
152
- x,
153
- y
154
- ],
155
- [
156
- x + tabWidth,
157
- y
158
- ],
159
- [
160
- x + tabWidth,
161
- y + tabHeight
162
- ],
163
- [
164
- x + width,
165
- y + tabHeight
166
- ],
167
- [
168
- x + width,
169
- y + height
170
- ],
171
- [
172
- x,
173
- y + height
174
- ]
175
- ];
176
- return [
177
- [
178
- x,
179
- y + tabHeight
180
- ],
181
- [
182
- x + tabLeft,
183
- y + tabHeight
184
- ],
185
- [
186
- x + tabLeft,
187
- y
188
- ],
189
- [
190
- x + tabLeft,
191
- y
192
- ],
193
- [
194
- x + tabLeft,
195
- y + tabHeight
196
- ],
197
- [
198
- x + width,
199
- y + tabHeight
200
- ],
201
- [
202
- x + width,
203
- y + height
204
- ],
205
- [
206
- x,
207
- y + height
208
- ]
209
- ];
210
- }
211
- draw(dropTarget, dragState) {
212
- const sameDropTarget = false;
213
- if (null !== _hoverDropTarget) this.drawTarget(_hoverDropTarget);
214
- else if (false === sameDropTarget) {
215
- if (dropTarget.pos.tab) moveExistingTabs(dropTarget);
216
- else if (_shiftedTab) clearShiftedTab();
217
- this.drawTarget(dropTarget, dragState);
218
- }
219
- }
220
- drawTarget(dropTarget, dragState) {
221
- const lineWidth = 6;
222
- const targetDropOutline = dropTarget.getTargetDropOutline(lineWidth, dragState);
223
- if (targetDropOutline) {
224
- const { l, t, r, b, tabLeft, tabWidth, tabHeight, guideLines } = targetDropOutline;
225
- const w = r - l;
226
- const h = b - t;
227
- if (this.currentPath) {
228
- const path = document.getElementById("vuu-drop-outline");
229
- path?.setAttribute("d", this.currentPath);
230
- }
231
- const points = this.getPoints(l, t, w, h, tabLeft, tabWidth, tabHeight);
232
- const path = pathFromPoints(points);
233
- const animation = document.getElementById("hw-drop-outline-animate");
234
- animation?.setAttribute("to", path);
235
- animation?.beginElement();
236
- this.currentPath = path;
237
- const dropGuidePath = document.getElementById("hw-drop-guides");
238
- dropGuidePath?.setAttribute("d", pathFromGuideLines(guideLines));
239
- }
240
- }
241
- }
242
- const cssShiftRight = "transition:margin-left .4s ease-out;margin-left: 63px";
243
- const cssShiftBack = "transition:margin-left .4s ease-out;margin-left: 0px";
244
- function moveExistingTabs(dropTarget) {
245
- const { AFTER, BEFORE } = RelativeDropPosition;
246
- const { clientRect: { Stack }, pos: { tab } } = dropTarget;
247
- const { id } = dropTarget.component.props;
248
- let tabEl = null;
249
- if (Stack && tab && tab.positionRelativeToTab !== AFTER) {
250
- const tabOffset = tab.positionRelativeToTab === BEFORE ? 1 : 2;
251
- const selector = `:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${tab.index + tabOffset})`;
252
- tabEl = document.getElementById(id)?.querySelector(selector);
253
- if (tabEl) {
254
- if (null === _shiftedTab || _shiftedTab !== tabEl) {
255
- tabEl.style.cssText = cssShiftRight;
256
- if (_shiftedTab) _shiftedTab.style.cssText = cssShiftBack;
257
- _shiftedTab = tabEl;
258
- }
259
- } else clearShiftedTab();
260
- } else if (tab?.positionRelativeToTab === BEFORE) {
261
- if (null === _shiftedTab) {
262
- const selector = ".vuuHeader-title";
263
- tabEl = document.getElementById(id)?.querySelector(selector);
264
- tabEl.style.cssText = cssShiftRight;
265
- _shiftedTab = tabEl;
266
- }
267
- } else clearShiftedTab();
268
- }
269
- function clearShiftedTab() {
270
- if (_shiftedTab) {
271
- _shiftedTab.style.cssText = cssShiftBack;
272
- _shiftedTab = null;
273
- }
274
- }
275
- export default DropTargetCanvas;
File without changes
@@ -1,3 +0,0 @@
1
- export * from "./dragDropTypes.js";
2
- export * from "./Draggable.js";
3
- export * from "./DropTarget.js";
@@ -1,45 +0,0 @@
1
- const css = `
2
- :root {
3
- --hw-space-unit: 4px;
4
- --hw-flex-gap: 3;
5
- --hw-fluid-grid-col-bg: #c8c8c84d;
6
- }
7
-
8
- .hwFlexbox {
9
- box-sizing: border-box;
10
- gap: calc(var(--spacing) * var(--space));
11
- min-width: 0;
12
- min-height: 0;
13
- display: flex;
14
- overflow: hidden;
15
- }
16
-
17
- .hwFlexbox-column {
18
- flex-direction: column;
19
- }
20
-
21
- .hwFlexbox-row {
22
- flex-direction: row;
23
- }
24
-
25
- .hwFlexbox > .Splitter {
26
- flex: none;
27
- }
28
-
29
- .hwFlexbox.full-page {
30
- width: 100vw;
31
- height: 100vh;
32
- }
33
-
34
- .flex-fill {
35
- border-color: red;
36
- flex: 1;
37
- }
38
-
39
- .vuuView.flex-fill {
40
- border-color: red;
41
- }
42
-
43
-
44
- `;
45
- export default css;
@@ -1,45 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useForkRef } from "@salt-ds/core";
3
- import { useComponentCssInjection } from "@salt-ds/styles";
4
- import { useWindow } from "@salt-ds/window";
5
- import clsx from "clsx";
6
- import { forwardRef } from "react";
7
- import { useSplitterResizing } from "./useSplitterResizing.js";
8
- import Flexbox_0 from "./Flexbox.css";
9
- const classBase = "hwFlexbox";
10
- const Flexbox_Flexbox = /*#__PURE__*/ forwardRef(function(props, ref) {
11
- const { breakPoints, children, column, className: classNameProp, flexFill, gap, fullPage, id, onSplitterMoved, resizeable, row, spacing, splitterSize, style, ...htmlAttributes } = props;
12
- const targetWindow = useWindow();
13
- useComponentCssInjection({
14
- testId: "vuu-flexbox",
15
- css: Flexbox_0,
16
- window: targetWindow
17
- });
18
- const { content, rootRef } = useSplitterResizing({
19
- children,
20
- onSplitterMoved,
21
- style
22
- });
23
- const className = clsx(classBase, classNameProp, {
24
- [`${classBase}-column`]: column,
25
- [`${classBase}-row`]: row,
26
- "flex-fill": flexFill,
27
- "full-page": fullPage
28
- });
29
- return /*#__PURE__*/ jsx("div", {
30
- ...htmlAttributes,
31
- className: className,
32
- "data-resizeable": resizeable || void 0,
33
- id: id,
34
- ref: useForkRef(rootRef, ref),
35
- style: {
36
- ...style,
37
- gap,
38
- "--spacing": spacing
39
- },
40
- children: content
41
- });
42
- });
43
- Flexbox_Flexbox.displayName = "Flexbox";
44
- var flexbox_Flexbox = Flexbox_Flexbox;
45
- export default flexbox_Flexbox;
@@ -1,27 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useCallback } from "react";
3
- import { Action } from "../layout-action.js";
4
- import { useLayoutProviderDispatch } from "../layout-provider/index.js";
5
- import { registerComponent } from "@vuu-ui/vuu-utils";
6
- import Flexbox from "./Flexbox.js";
7
- const FlexboxLayout_FlexboxLayout = function(props) {
8
- const { path } = props;
9
- const dispatch = useLayoutProviderDispatch();
10
- const handleSplitterMoved = useCallback((sizes)=>{
11
- dispatch({
12
- type: Action.SPLITTER_RESIZE,
13
- path,
14
- sizes
15
- });
16
- }, [
17
- dispatch,
18
- path
19
- ]);
20
- return /*#__PURE__*/ jsx(Flexbox, {
21
- ...props,
22
- onSplitterMoved: handleSplitterMoved
23
- });
24
- };
25
- FlexboxLayout_FlexboxLayout.displayName = "Flexbox";
26
- registerComponent("Flexbox", FlexboxLayout_FlexboxLayout, "container");
27
- export { FlexboxLayout_FlexboxLayout as FlexboxLayout };