@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,29 +0,0 @@
1
- import { useCallback, useEffect, useRef } from "react";
2
- const isMessageForSelf = (message, id, path)=>{
3
- if (id && message.targetId === id) return true;
4
- if (message.path && path?.startsWith(message.path)) return true;
5
- return false;
6
- };
7
- const useViewBroadcastChannel = (id, path, onMessageReceived)=>{
8
- const broadcastChannelRef = useRef(void 0);
9
- useEffect(()=>{
10
- const broadcastChannel = new BroadcastChannel("vuu");
11
- broadcastChannel.onmessage = (evt)=>{
12
- if (isMessageForSelf(evt.data, id, path)) onMessageReceived?.(evt.data);
13
- };
14
- broadcastChannelRef.current = broadcastChannel;
15
- return ()=>{
16
- broadcastChannel.close();
17
- broadcastChannelRef.current = void 0;
18
- };
19
- }, [
20
- id,
21
- onMessageReceived,
22
- path
23
- ]);
24
- const sendMessage = useCallback((message)=>{
25
- broadcastChannelRef.current?.postMessage(message);
26
- }, []);
27
- return sendMessage;
28
- };
29
- export { useViewBroadcastChannel };
@@ -1,27 +0,0 @@
1
- import { WidthHeight, useResizeObserver } from "../responsive/index.js";
2
- import { useCallback, useRef } from "react";
3
- const NO_MEASUREMENT = [];
4
- const useViewResize = ({ mainRef, resize = "responsive", rootRef })=>{
5
- const deferResize = "defer" === resize;
6
- const mainSize = useRef({});
7
- const resizeHandle = useRef(void 0);
8
- const setMainSize = useCallback(()=>{
9
- if (mainRef.current) {
10
- mainRef.current.style.height = mainSize.current.height + "px";
11
- mainRef.current.style.width = mainSize.current.width + "px";
12
- }
13
- resizeHandle.current = void 0;
14
- }, [
15
- mainRef
16
- ]);
17
- const onResize = useCallback(({ height, width })=>{
18
- mainSize.current.height = height;
19
- mainSize.current.width = width;
20
- if (null !== resizeHandle.current) clearTimeout(resizeHandle.current);
21
- resizeHandle.current = window.setTimeout(setMainSize, 40);
22
- }, [
23
- setMainSize
24
- ]);
25
- useResizeObserver(rootRef, deferResize ? WidthHeight : NO_MEASUREMENT, onResize, deferResize);
26
- };
27
- export { useViewResize };
File without changes
@@ -1,11 +0,0 @@
1
- import react, { useContext } from "react";
2
- const NO_CONTEXT = {
3
- dispatch: null
4
- };
5
- const ViewContext = react.createContext(NO_CONTEXT);
6
- const useViewDispatch = ()=>{
7
- const context = useContext(ViewContext);
8
- return context?.dispatch ?? null;
9
- };
10
- const useViewContext = ()=>useContext(ViewContext);
11
- export { ViewContext, useViewContext, useViewDispatch };
@@ -1,116 +0,0 @@
1
- import { useSessionDataSource } from "@vuu-ui/vuu-data-react";
2
- import { useCallback } from "react";
3
- import { useLayoutProviderDispatch } from "../layout-provider/LayoutProvider.js";
4
- import { useViewBroadcastChannel } from "../layout-view/useViewBroadcastChannel.js";
5
- import { usePersistentState } from "../use-persistent-state.js";
6
- import { useViewContributions } from "./useViewContributions.js";
7
- const useViewActionDispatcher = (id, rootRef, viewPath, dropTargets)=>{
8
- const { purgeState } = usePersistentState();
9
- const { clearDataSource: clearDataSourceFromSessionState } = useSessionDataSource();
10
- const { clearContributions, contributions, updateContributions } = useViewContributions({
11
- sessionKey: id
12
- });
13
- const dispatchLayoutAction = useLayoutProviderDispatch();
14
- const unsubscribeAndClearState = useCallback(()=>{
15
- clearDataSourceFromSessionState(id, true);
16
- purgeState(id);
17
- }, [
18
- clearDataSourceFromSessionState,
19
- id,
20
- purgeState
21
- ]);
22
- const handleRemove = useCallback(()=>{
23
- unsubscribeAndClearState();
24
- dispatchLayoutAction({
25
- type: "remove",
26
- path: viewPath
27
- });
28
- }, [
29
- unsubscribeAndClearState,
30
- dispatchLayoutAction,
31
- viewPath
32
- ]);
33
- const handleMouseDown = useCallback(async (evt, index, preDragActivity)=>{
34
- evt.stopPropagation();
35
- const dragRect = rootRef.current?.getBoundingClientRect();
36
- return new Promise((resolve, reject)=>{
37
- dispatchLayoutAction({
38
- type: "drag-start",
39
- evt,
40
- path: void 0 === index ? viewPath : `${viewPath}.${index}`,
41
- dragRect,
42
- preDragActivity,
43
- dropTargets,
44
- resolveDragStart: resolve,
45
- rejectDragStart: reject
46
- });
47
- });
48
- }, [
49
- rootRef,
50
- dispatchLayoutAction,
51
- viewPath,
52
- dropTargets
53
- ]);
54
- const handleMessageReceived = useCallback((message)=>{
55
- switch(message.type){
56
- case "highlight-on":
57
- rootRef?.current?.classList.add("vuuHighlighted");
58
- break;
59
- case "highlight-off":
60
- rootRef?.current?.classList.remove("vuuHighlighted");
61
- break;
62
- case "layout-closed":
63
- unsubscribeAndClearState();
64
- break;
65
- default:
66
- console.log(`received ${message.type} message`);
67
- }
68
- }, [
69
- rootRef,
70
- unsubscribeAndClearState
71
- ]);
72
- const sendMessage = useViewBroadcastChannel(id, viewPath, handleMessageReceived);
73
- const dispatchAction = useCallback(async (action, evt)=>{
74
- const { type } = action;
75
- switch(type){
76
- case "collapse":
77
- case "expand":
78
- return dispatchLayoutAction({
79
- type,
80
- path: action.path ?? viewPath
81
- });
82
- case "remove":
83
- return handleRemove();
84
- case "mousedown":
85
- return handleMouseDown(evt, action.index, action.preDragActivity);
86
- case "add-toolbar-contribution":
87
- return updateContributions(action.location, action.content);
88
- case "remove-toolbar-contribution":
89
- return clearContributions();
90
- case "query":
91
- return dispatchLayoutAction({
92
- type,
93
- path: action.path,
94
- query: action.query
95
- });
96
- case "broadcast-message":
97
- sendMessage(action.message);
98
- break;
99
- default:
100
- return;
101
- }
102
- }, [
103
- dispatchLayoutAction,
104
- viewPath,
105
- handleRemove,
106
- handleMouseDown,
107
- updateContributions,
108
- clearContributions,
109
- sendMessage
110
- ]);
111
- return [
112
- dispatchAction,
113
- contributions
114
- ];
115
- };
116
- export { useViewActionDispatcher };
@@ -1,31 +0,0 @@
1
- import { useCallback, useState } from "react";
2
- const sessionState = new Map();
3
- const EMPTY_ARRAY = [];
4
- const useViewContributions = ({ sessionKey })=>{
5
- const [contributions, setContributions] = useState(EMPTY_ARRAY);
6
- const updateContributions = useCallback((location, content)=>{
7
- const updatedContributions = contributions.concat([
8
- {
9
- location,
10
- content
11
- }
12
- ]);
13
- sessionState.set(sessionKey, updatedContributions);
14
- setContributions(updatedContributions);
15
- }, [
16
- contributions,
17
- sessionKey
18
- ]);
19
- const clearContributions = useCallback(()=>{
20
- sessionState.delete(sessionKey);
21
- setContributions([]);
22
- }, [
23
- sessionKey
24
- ]);
25
- return {
26
- clearContributions,
27
- contributions,
28
- updateContributions
29
- };
30
- };
31
- export { useViewContributions };
@@ -1,31 +0,0 @@
1
- const css = `
2
- .vuuPalette {
3
- --vuuList-borderStyle: none;
4
- }
5
-
6
- .vuuPalette-horizontal {
7
- align-items: center;
8
- display: flex;
9
- }
10
-
11
- .vuuPaletteItem {
12
- --vuu-icon-color: var(--salt-content-secondary-foreground);
13
- --list-item-text-padding: 0 0 0 calc(var(--salt-size-unit) * 3);
14
- gap: var(--salt-spacing-200);
15
- padding-left: 12px;
16
- font-size: 12px;
17
- font-weight: 600;
18
- }
19
-
20
- .vuuSimpleDraggableWrapper > .vuuPaletteItem {
21
- --vuu-icon-color: var(--salt-selectable-foreground);
22
- }
23
-
24
- .salt-theme .vuuPaletteItem {
25
- font-size: 11px;
26
- font-weight: normal;
27
- }
28
-
29
-
30
- `;
31
- export default css;
@@ -1,85 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { ListBox, Option } from "@salt-ds/core";
3
- import { queryClosest, registerComponent, uuid } from "@vuu-ui/vuu-utils";
4
- import { useComponentCssInjection } from "@salt-ds/styles";
5
- import { useWindow } from "@salt-ds/window";
6
- import clsx from "clsx";
7
- import { cloneElement, memo, useCallback } from "react";
8
- import { useLayoutProviderDispatch } from "../layout-provider/index.js";
9
- import { View } from "../layout-view/View.js";
10
- import Palette from "./Palette.css";
11
- const classBase = "vuuPalette";
12
- const clonePaletteItem = (paletteItem)=>{
13
- const dolly = paletteItem.cloneNode(true);
14
- dolly.id = "";
15
- delete dolly.dataset.idx;
16
- return dolly;
17
- };
18
- const wrapInView = (component, viewProps)=>{
19
- const id = uuid();
20
- return /*#__PURE__*/ jsx(View, {
21
- id: id,
22
- ...viewProps,
23
- children: component
24
- }, id);
25
- };
26
- const PaletteItem = /*#__PURE__*/ memo(({ className, component, idx, key, value, ViewProps, ...props })=>{
27
- const targetWindow = useWindow();
28
- useComponentCssInjection({
29
- testId: "vuu-palette",
30
- css: Palette,
31
- window: targetWindow
32
- });
33
- const dispatch = useLayoutProviderDispatch();
34
- const handleMouseDown = useCallback((e)=>{
35
- const el = queryClosest(e.target, ".vuuPaletteItem", true);
36
- const { height, left, top, width } = el.getBoundingClientRect();
37
- dispatch({
38
- dragRect: {
39
- left,
40
- top,
41
- right: left + width,
42
- bottom: top + 150,
43
- width,
44
- height
45
- },
46
- dragElement: clonePaletteItem(el),
47
- evt: e.nativeEvent,
48
- instructions: {
49
- DoNotRemove: true,
50
- DoNotTransform: true,
51
- DriftHomeIfNoDropTarget: true,
52
- RemoveDraggableOnDragEnd: true,
53
- dragThreshold: 10
54
- },
55
- path: "*",
56
- payload: wrapInView(component, ViewProps),
57
- type: "drag-start"
58
- });
59
- }, [
60
- ViewProps,
61
- component,
62
- dispatch
63
- ]);
64
- return /*#__PURE__*/ jsx(Option, {
65
- className: clsx("vuuPaletteItem", className),
66
- "data-draggable": true,
67
- "data-index": idx,
68
- onMouseDown: handleMouseDown,
69
- value: value,
70
- ...props
71
- });
72
- });
73
- PaletteItem.displayName = "PaletteItem";
74
- const Palette_Palette = ({ ListBoxProps, ViewProps, children, className, orientation = "horizontal", ...props })=>/*#__PURE__*/ jsx(ListBox, {
75
- ...ListBoxProps,
76
- ...props,
77
- className: clsx(classBase, className, `${classBase}-${orientation}`),
78
- selected: [],
79
- children: children.map((child, idx)=>child.type === PaletteItem ? /*#__PURE__*/ cloneElement(child, {
80
- idx,
81
- key: idx
82
- }) : child)
83
- });
84
- registerComponent("Palette", Palette_Palette, "view");
85
- export { PaletteItem, Palette_Palette as Palette };
@@ -1 +0,0 @@
1
- export * from "./Palette.js";
@@ -1,35 +0,0 @@
1
- const css = `
2
- .vuuLayoutStartPanel {
3
- flex-direction: column;
4
- align-items: center;
5
- gap: 12px;
6
- font-weight: 700;
7
- display: flex;
8
- flex: none !important;
9
- }
10
-
11
- .vuuLayoutStartPanel-title {
12
- color: var(--vuu-color-gray-80);
13
- text-align: center;
14
- font-size: 28px;
15
- line-height: 1.5;
16
- }
17
-
18
- .vuuLayoutStartPanel-text {
19
- color: var(--vuu-color-gray-50);
20
- max-width: 460px;
21
- font-size: 18px;
22
- line-height: 1.5;
23
- }
24
-
25
- .vuuLayoutStartPanel-addButton {
26
- --vuu-icon-size: 20px;
27
- --saltButton-height: 56px;
28
- --saltButton-width: 56px;
29
- box-shadow: 0 4px 4px #00000040;
30
- --saltButton-borderRadius: 28px !important;
31
- }
32
-
33
-
34
- `;
35
- export default css;
@@ -1,57 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { IconButton } from "@vuu-ui/vuu-ui-controls";
3
- import { VuuShellLocation } from "@vuu-ui/vuu-utils";
4
- import { useComponentCssInjection } from "@salt-ds/styles";
5
- import { useWindow } from "@salt-ds/window";
6
- import { useMemo, useState } from "react";
7
- import { useViewContext } from "../layout-view-actions/ViewContext.js";
8
- import LayoutStartPanel from "./LayoutStartPanel.css";
9
- const classBase = "vuuLayoutStartPanel";
10
- const LayoutStartPanel_LayoutStartPanel = (htmlAttributes)=>{
11
- const targetWindow = useWindow();
12
- useComponentCssInjection({
13
- testId: "vuu-layout-start-panel",
14
- css: LayoutStartPanel,
15
- window: targetWindow
16
- });
17
- const { dispatch, path } = useViewContext();
18
- const [displayState, setDisplayState] = useState();
19
- useMemo(()=>{
20
- dispatch?.({
21
- type: "query",
22
- path,
23
- query: "PARENT_CONTAINER"
24
- }).then((response)=>{
25
- response?.parentContainerId === VuuShellLocation.Workspace ? setDisplayState("initial") : setDisplayState("nested");
26
- });
27
- }, [
28
- dispatch,
29
- path
30
- ]);
31
- if (void 0 === displayState) return null;
32
- const showInitialState = "initial" === displayState;
33
- return /*#__PURE__*/ jsxs("div", {
34
- ...htmlAttributes,
35
- className: classBase,
36
- children: [
37
- showInitialState ? /*#__PURE__*/ jsxs(Fragment, {
38
- children: [
39
- /*#__PURE__*/ jsx("div", {
40
- className: `${classBase}-title`,
41
- children: "Start by adding a table"
42
- }),
43
- /*#__PURE__*/ jsx("div", {
44
- className: `${classBase}-text`,
45
- children: "To add a table, drag any of the Vuu Tables to this area or click the button below"
46
- })
47
- ]
48
- }) : null,
49
- /*#__PURE__*/ jsx(IconButton, {
50
- className: `${classBase}-addButton`,
51
- icon: "add",
52
- variant: "cta"
53
- })
54
- ]
55
- });
56
- };
57
- export { LayoutStartPanel_LayoutStartPanel as LayoutStartPanel };
@@ -1,20 +0,0 @@
1
- const css = `
2
- .vuuPlaceholder {
3
- --vuuView-justify: center;
4
- flex: 1 1 0;
5
- align-items: center;
6
- display: flex;
7
- }
8
-
9
- .vuuPlaceholder-nested {
10
- background-color: red;
11
- }
12
-
13
- .vuuPlaceholder-shim {
14
- flex-grow: 0;
15
- flex-shrink: 0;
16
- }
17
-
18
-
19
- `;
20
- export default css;
@@ -1,33 +0,0 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
2
- import clsx from "clsx";
3
- import { useComponentCssInjection } from "@salt-ds/styles";
4
- import { useWindow } from "@salt-ds/window";
5
- import { registerComponent } from "@vuu-ui/vuu-utils";
6
- import { LayoutStartPanel } from "./LayoutStartPanel.js";
7
- import { View } from "../layout-view/View.js";
8
- import Placeholder from "./Placeholder.css";
9
- const classBase = "vuuPlaceholder";
10
- const PlaceholderCore = ({ showStartMenu = true })=>/*#__PURE__*/ jsx(Fragment, {
11
- children: showStartMenu ? /*#__PURE__*/ jsx(LayoutStartPanel, {}) : null
12
- });
13
- const Placeholder_Placeholder = ({ className: classNameProp, showStartMenu, ...viewProps })=>{
14
- const targetWindow = useWindow();
15
- useComponentCssInjection({
16
- testId: "vuu-placeholder",
17
- css: Placeholder,
18
- window: targetWindow
19
- });
20
- const className = clsx(classBase, classNameProp);
21
- return /*#__PURE__*/ jsx(View, {
22
- ...viewProps,
23
- className: className,
24
- "data-placeholder": true,
25
- resizeable: true,
26
- children: /*#__PURE__*/ jsx(PlaceholderCore, {
27
- showStartMenu: showStartMenu
28
- })
29
- });
30
- };
31
- Placeholder_Placeholder.displayName = "Placeholder";
32
- registerComponent("Placeholder", Placeholder_Placeholder, "component");
33
- export { Placeholder_Placeholder as Placeholder };
@@ -1 +0,0 @@
1
- export * from "./Placeholder.js";
@@ -1,2 +0,0 @@
1
- export * from "./useResizeObserver.js";
2
- export * from "./utils.js";
@@ -1,24 +0,0 @@
1
- const LEFT_RIGHT = [
2
- 'left',
3
- 'right'
4
- ];
5
- const TOP_BOTTOM = [
6
- 'top',
7
- 'bottom'
8
- ];
9
- function measureMinimumNodeSize(node, dimension = 'width') {
10
- const { [dimension]: size } = node.getBoundingClientRect();
11
- const { padRight = false, padLeft = false } = node.dataset;
12
- const style = getComputedStyle(node);
13
- const [start, end] = 'width' === dimension ? LEFT_RIGHT : TOP_BOTTOM;
14
- const marginStart = padLeft ? 0 : parseInt(style.getPropertyValue(`margin-${start}`), 10);
15
- const marginEnd = padRight ? 0 : parseInt(style.getPropertyValue(`margin-${end}`), 10);
16
- let minWidth = size;
17
- const flexShrink = parseInt(style.getPropertyValue('flex-shrink'), 10);
18
- if (flexShrink > 0) {
19
- const flexBasis = parseInt(style.getPropertyValue('flex-basis'), 10);
20
- if (!isNaN(flexBasis)) minWidth = flexBasis;
21
- }
22
- return marginStart + minWidth + marginEnd;
23
- }
24
- export { measureMinimumNodeSize };
@@ -1,109 +0,0 @@
1
- import { useCallback, useLayoutEffect, useRef } from "react";
2
- const WidthHeight = [
3
- "height",
4
- "width"
5
- ];
6
- const HeightOnly = [
7
- "height"
8
- ];
9
- const WidthOnly = [
10
- "width"
11
- ];
12
- const observedMap = new WeakMap();
13
- const getTargetSize = (element, contentRect, dimension)=>{
14
- switch(dimension){
15
- case "height":
16
- return contentRect.height;
17
- case "scrollHeight":
18
- return element.scrollHeight;
19
- case "scrollWidth":
20
- return element.scrollWidth;
21
- case "width":
22
- return contentRect.width;
23
- default:
24
- return 0;
25
- }
26
- };
27
- const resizeObserver = new ResizeObserver((entries)=>{
28
- for (const entry of entries){
29
- const { target, contentRect } = entry;
30
- const observedTarget = observedMap.get(target);
31
- if (observedTarget) {
32
- const { onResize, measurements } = observedTarget;
33
- let sizeChanged = false;
34
- for (const [dimension, size] of Object.entries(measurements)){
35
- const newSize = getTargetSize(target, contentRect, dimension);
36
- if (newSize !== size) {
37
- sizeChanged = true;
38
- measurements[dimension] = newSize;
39
- }
40
- }
41
- if (sizeChanged) onResize && onResize(measurements);
42
- }
43
- }
44
- });
45
- function useResizeObserver(ref, dimensions, onResize, reportInitialSize = false) {
46
- const dimensionsRef = useRef(dimensions);
47
- const measure = useCallback((target)=>{
48
- const rect = target.getBoundingClientRect();
49
- return dimensionsRef.current.reduce((map, dim)=>{
50
- map[dim] = getTargetSize(target, rect, dim);
51
- return map;
52
- }, {});
53
- }, []);
54
- useLayoutEffect(()=>{
55
- const target = ref.current;
56
- let cleanedUp = false;
57
- async function registerObserver() {
58
- observedMap.set(target, {
59
- measurements: {}
60
- });
61
- cleanedUp = false;
62
- const { fonts } = document;
63
- if (fonts) await fonts.ready;
64
- if (!cleanedUp) {
65
- const observedTarget = observedMap.get(target);
66
- if (observedTarget) {
67
- const measurements = measure(target);
68
- observedTarget.measurements = measurements;
69
- resizeObserver.observe(target);
70
- if (reportInitialSize) onResize(measurements);
71
- }
72
- }
73
- }
74
- if (target) {
75
- if (observedMap.has(target)) throw Error("useResizeObserver attemping to observe same element twice");
76
- registerObserver();
77
- }
78
- return ()=>{
79
- if (target && observedMap.has(target)) {
80
- resizeObserver.unobserve(target);
81
- observedMap.delete(target);
82
- cleanedUp = true;
83
- }
84
- };
85
- }, [
86
- ref,
87
- measure,
88
- reportInitialSize,
89
- onResize
90
- ]);
91
- useLayoutEffect(()=>{
92
- const target = ref.current;
93
- const record = observedMap.get(target);
94
- if (record) {
95
- if (dimensionsRef.current !== dimensions) {
96
- dimensionsRef.current = dimensions;
97
- const measurements = measure(target);
98
- record.measurements = measurements;
99
- }
100
- record.onResize = onResize;
101
- }
102
- }, [
103
- dimensions,
104
- measure,
105
- ref,
106
- onResize
107
- ]);
108
- }
109
- export { HeightOnly, WidthHeight, WidthOnly, resizeObserver, useResizeObserver };
@@ -1,27 +0,0 @@
1
- const COLLAPSIBLE = 'data-collapsible';
2
- const RESPONSIVE_ATTRIBUTE = {
3
- [COLLAPSIBLE]: true,
4
- 'data-pad-start': true,
5
- 'data-pad-end': true
6
- };
7
- const isResponsiveAttribute = (propName)=>RESPONSIVE_ATTRIBUTE[propName] ?? false;
8
- const isCollapsible = (propName)=>propName === COLLAPSIBLE;
9
- const COLLAPSIBLE_VALUE = {
10
- dynamic: 'dynamic',
11
- instant: 'instant',
12
- true: 'instant'
13
- };
14
- const collapsibleValue = (value)=>COLLAPSIBLE_VALUE[value] ?? 'none';
15
- const extractResponsiveProps = (props)=>Object.keys(props).reduce((result, propName)=>{
16
- const [toolbarProps, rest] = result;
17
- if (isResponsiveAttribute(propName)) {
18
- const value = isCollapsible(propName) ? collapsibleValue(props[propName]) : props[propName];
19
- toolbarProps[propName] = value;
20
- rest[propName] = void 0;
21
- }
22
- return result;
23
- }, [
24
- {},
25
- {}
26
- ]);
27
- export { extractResponsiveProps, isResponsiveAttribute };