@vuu-ui/vuu-layout 0.13.6 → 0.13.8

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 (245) hide show
  1. package/cjs/index.js +5513 -113
  2. package/cjs/index.js.map +1 -1
  3. package/esm/index.js +5436 -32
  4. package/esm/index.js.map +1 -1
  5. package/package.json +9 -9
  6. package/cjs/Component.js +0 -14
  7. package/cjs/Component.js.map +0 -1
  8. package/cjs/LayoutContainer.css.js +0 -6
  9. package/cjs/LayoutContainer.css.js.map +0 -1
  10. package/cjs/LayoutContainer.js +0 -33
  11. package/cjs/LayoutContainer.js.map +0 -1
  12. package/cjs/dock-layout/DockLayout.css.js +0 -6
  13. package/cjs/dock-layout/DockLayout.css.js.map +0 -1
  14. package/cjs/dock-layout/DockLayout.js +0 -41
  15. package/cjs/dock-layout/DockLayout.js.map +0 -1
  16. package/cjs/dock-layout/Drawer.css.js +0 -6
  17. package/cjs/dock-layout/Drawer.css.js.map +0 -1
  18. package/cjs/dock-layout/Drawer.js +0 -95
  19. package/cjs/dock-layout/Drawer.js.map +0 -1
  20. package/cjs/drag-drop/BoxModel.js +0 -416
  21. package/cjs/drag-drop/BoxModel.js.map +0 -1
  22. package/cjs/drag-drop/DragState.js +0 -161
  23. package/cjs/drag-drop/DragState.js.map +0 -1
  24. package/cjs/drag-drop/Draggable.js +0 -192
  25. package/cjs/drag-drop/Draggable.js.map +0 -1
  26. package/cjs/drag-drop/DropTarget.js +0 -257
  27. package/cjs/drag-drop/DropTarget.js.map +0 -1
  28. package/cjs/drag-drop/DropTargetRenderer.js +0 -218
  29. package/cjs/drag-drop/DropTargetRenderer.js.map +0 -1
  30. package/cjs/flexbox/Flexbox.css.js +0 -6
  31. package/cjs/flexbox/Flexbox.css.js.map +0 -1
  32. package/cjs/flexbox/Flexbox.js +0 -69
  33. package/cjs/flexbox/Flexbox.js.map +0 -1
  34. package/cjs/flexbox/FlexboxLayout.js +0 -30
  35. package/cjs/flexbox/FlexboxLayout.js.map +0 -1
  36. package/cjs/flexbox/Splitter.css.js +0 -6
  37. package/cjs/flexbox/Splitter.css.js.map +0 -1
  38. package/cjs/flexbox/Splitter.js +0 -122
  39. package/cjs/flexbox/Splitter.js.map +0 -1
  40. package/cjs/flexbox/flexbox-utils.js +0 -95
  41. package/cjs/flexbox/flexbox-utils.js.map +0 -1
  42. package/cjs/flexbox/useSplitterResizing.js +0 -198
  43. package/cjs/flexbox/useSplitterResizing.js.map +0 -1
  44. package/cjs/layout-action.js +0 -24
  45. package/cjs/layout-action.js.map +0 -1
  46. package/cjs/layout-header/Header.css.js +0 -6
  47. package/cjs/layout-header/Header.css.js.map +0 -1
  48. package/cjs/layout-header/Header.js +0 -152
  49. package/cjs/layout-header/Header.js.map +0 -1
  50. package/cjs/layout-header/useHeader.js +0 -86
  51. package/cjs/layout-header/useHeader.js.map +0 -1
  52. package/cjs/layout-provider/LayoutProvider.js +0 -306
  53. package/cjs/layout-provider/LayoutProvider.js.map +0 -1
  54. package/cjs/layout-provider/LayoutProviderContext.js +0 -23
  55. package/cjs/layout-provider/LayoutProviderContext.js.map +0 -1
  56. package/cjs/layout-provider/useLayoutDragDrop.js +0 -177
  57. package/cjs/layout-provider/useLayoutDragDrop.js.map +0 -1
  58. package/cjs/layout-reducer/flexUtils.js +0 -227
  59. package/cjs/layout-reducer/flexUtils.js.map +0 -1
  60. package/cjs/layout-reducer/insert-layout-element.js +0 -286
  61. package/cjs/layout-reducer/insert-layout-element.js.map +0 -1
  62. package/cjs/layout-reducer/layout-reducer.js +0 -202
  63. package/cjs/layout-reducer/layout-reducer.js.map +0 -1
  64. package/cjs/layout-reducer/layoutTypes.js +0 -40
  65. package/cjs/layout-reducer/layoutTypes.js.map +0 -1
  66. package/cjs/layout-reducer/layoutUtils.js +0 -237
  67. package/cjs/layout-reducer/layoutUtils.js.map +0 -1
  68. package/cjs/layout-reducer/move-layout-element.js +0 -31
  69. package/cjs/layout-reducer/move-layout-element.js.map +0 -1
  70. package/cjs/layout-reducer/remove-layout-element.js +0 -237
  71. package/cjs/layout-reducer/remove-layout-element.js.map +0 -1
  72. package/cjs/layout-reducer/replace-layout-element.js +0 -96
  73. package/cjs/layout-reducer/replace-layout-element.js.map +0 -1
  74. package/cjs/layout-reducer/resize-flex-children.js +0 -62
  75. package/cjs/layout-reducer/resize-flex-children.js.map +0 -1
  76. package/cjs/layout-reducer/wrap-layout-element.js +0 -211
  77. package/cjs/layout-reducer/wrap-layout-element.js.map +0 -1
  78. package/cjs/layout-view/View.css.js +0 -6
  79. package/cjs/layout-view/View.css.js.map +0 -1
  80. package/cjs/layout-view/View.js +0 -167
  81. package/cjs/layout-view/View.js.map +0 -1
  82. package/cjs/layout-view/useView.js +0 -91
  83. package/cjs/layout-view/useView.js.map +0 -1
  84. package/cjs/layout-view/useViewBroadcastChannel.js +0 -35
  85. package/cjs/layout-view/useViewBroadcastChannel.js.map +0 -1
  86. package/cjs/layout-view/useViewResize.js +0 -42
  87. package/cjs/layout-view/useViewResize.js.map +0 -1
  88. package/cjs/layout-view-actions/ViewContext.js +0 -16
  89. package/cjs/layout-view-actions/ViewContext.js.map +0 -1
  90. package/cjs/layout-view-actions/useViewActionDispatcher.js +0 -129
  91. package/cjs/layout-view-actions/useViewActionDispatcher.js.map +0 -1
  92. package/cjs/palette/Palette.css.js +0 -6
  93. package/cjs/palette/Palette.css.js.map +0 -1
  94. package/cjs/palette/Palette.js +0 -132
  95. package/cjs/palette/Palette.js.map +0 -1
  96. package/cjs/placeholder/LayoutStartPanel.css.js +0 -6
  97. package/cjs/placeholder/LayoutStartPanel.css.js.map +0 -1
  98. package/cjs/placeholder/LayoutStartPanel.js +0 -56
  99. package/cjs/placeholder/LayoutStartPanel.js.map +0 -1
  100. package/cjs/placeholder/Placeholder.css.js +0 -6
  101. package/cjs/placeholder/Placeholder.css.js.map +0 -1
  102. package/cjs/placeholder/Placeholder.js +0 -34
  103. package/cjs/placeholder/Placeholder.js.map +0 -1
  104. package/cjs/responsive/useResizeObserver.js +0 -118
  105. package/cjs/responsive/useResizeObserver.js.map +0 -1
  106. package/cjs/responsive/utils.js +0 -34
  107. package/cjs/responsive/utils.js.map +0 -1
  108. package/cjs/stack/Stack.css.js +0 -6
  109. package/cjs/stack/Stack.css.js.map +0 -1
  110. package/cjs/stack/Stack.js +0 -150
  111. package/cjs/stack/Stack.js.map +0 -1
  112. package/cjs/stack/StackLayout.js +0 -118
  113. package/cjs/stack/StackLayout.js.map +0 -1
  114. package/cjs/use-persistent-state.js +0 -112
  115. package/cjs/use-persistent-state.js.map +0 -1
  116. package/cjs/utils/pathUtils.js +0 -293
  117. package/cjs/utils/pathUtils.js.map +0 -1
  118. package/cjs/utils/propUtils.js +0 -27
  119. package/cjs/utils/propUtils.js.map +0 -1
  120. package/cjs/utils/refUtils.js +0 -12
  121. package/cjs/utils/refUtils.js.map +0 -1
  122. package/cjs/utils/styleUtils.js +0 -15
  123. package/cjs/utils/styleUtils.js.map +0 -1
  124. package/cjs/utils/typeOf.js +0 -27
  125. package/cjs/utils/typeOf.js.map +0 -1
  126. package/esm/Component.js +0 -12
  127. package/esm/Component.js.map +0 -1
  128. package/esm/LayoutContainer.css.js +0 -4
  129. package/esm/LayoutContainer.css.js.map +0 -1
  130. package/esm/LayoutContainer.js +0 -31
  131. package/esm/LayoutContainer.js.map +0 -1
  132. package/esm/dock-layout/DockLayout.css.js +0 -4
  133. package/esm/dock-layout/DockLayout.css.js.map +0 -1
  134. package/esm/dock-layout/DockLayout.js +0 -39
  135. package/esm/dock-layout/DockLayout.js.map +0 -1
  136. package/esm/dock-layout/Drawer.css.js +0 -4
  137. package/esm/dock-layout/Drawer.css.js.map +0 -1
  138. package/esm/dock-layout/Drawer.js +0 -93
  139. package/esm/dock-layout/Drawer.js.map +0 -1
  140. package/esm/drag-drop/BoxModel.js +0 -409
  141. package/esm/drag-drop/BoxModel.js.map +0 -1
  142. package/esm/drag-drop/DragState.js +0 -159
  143. package/esm/drag-drop/DragState.js.map +0 -1
  144. package/esm/drag-drop/Draggable.js +0 -190
  145. package/esm/drag-drop/Draggable.js.map +0 -1
  146. package/esm/drag-drop/DropTarget.js +0 -253
  147. package/esm/drag-drop/DropTarget.js.map +0 -1
  148. package/esm/drag-drop/DropTargetRenderer.js +0 -216
  149. package/esm/drag-drop/DropTargetRenderer.js.map +0 -1
  150. package/esm/flexbox/Flexbox.css.js +0 -4
  151. package/esm/flexbox/Flexbox.css.js.map +0 -1
  152. package/esm/flexbox/Flexbox.js +0 -67
  153. package/esm/flexbox/Flexbox.js.map +0 -1
  154. package/esm/flexbox/FlexboxLayout.js +0 -28
  155. package/esm/flexbox/FlexboxLayout.js.map +0 -1
  156. package/esm/flexbox/Splitter.css.js +0 -4
  157. package/esm/flexbox/Splitter.css.js.map +0 -1
  158. package/esm/flexbox/Splitter.js +0 -120
  159. package/esm/flexbox/Splitter.js.map +0 -1
  160. package/esm/flexbox/flexbox-utils.js +0 -89
  161. package/esm/flexbox/flexbox-utils.js.map +0 -1
  162. package/esm/flexbox/useSplitterResizing.js +0 -196
  163. package/esm/flexbox/useSplitterResizing.js.map +0 -1
  164. package/esm/layout-action.js +0 -22
  165. package/esm/layout-action.js.map +0 -1
  166. package/esm/layout-header/Header.css.js +0 -4
  167. package/esm/layout-header/Header.css.js.map +0 -1
  168. package/esm/layout-header/Header.js +0 -150
  169. package/esm/layout-header/Header.js.map +0 -1
  170. package/esm/layout-header/useHeader.js +0 -84
  171. package/esm/layout-header/useHeader.js.map +0 -1
  172. package/esm/layout-provider/LayoutProvider.js +0 -299
  173. package/esm/layout-provider/LayoutProvider.js.map +0 -1
  174. package/esm/layout-provider/LayoutProviderContext.js +0 -20
  175. package/esm/layout-provider/LayoutProviderContext.js.map +0 -1
  176. package/esm/layout-provider/useLayoutDragDrop.js +0 -175
  177. package/esm/layout-provider/useLayoutDragDrop.js.map +0 -1
  178. package/esm/layout-reducer/flexUtils.js +0 -218
  179. package/esm/layout-reducer/flexUtils.js.map +0 -1
  180. package/esm/layout-reducer/insert-layout-element.js +0 -282
  181. package/esm/layout-reducer/insert-layout-element.js.map +0 -1
  182. package/esm/layout-reducer/layout-reducer.js +0 -200
  183. package/esm/layout-reducer/layout-reducer.js.map +0 -1
  184. package/esm/layout-reducer/layoutTypes.js +0 -36
  185. package/esm/layout-reducer/layoutTypes.js.map +0 -1
  186. package/esm/layout-reducer/layoutUtils.js +0 -226
  187. package/esm/layout-reducer/layoutUtils.js.map +0 -1
  188. package/esm/layout-reducer/move-layout-element.js +0 -29
  189. package/esm/layout-reducer/move-layout-element.js.map +0 -1
  190. package/esm/layout-reducer/remove-layout-element.js +0 -235
  191. package/esm/layout-reducer/remove-layout-element.js.map +0 -1
  192. package/esm/layout-reducer/replace-layout-element.js +0 -92
  193. package/esm/layout-reducer/replace-layout-element.js.map +0 -1
  194. package/esm/layout-reducer/resize-flex-children.js +0 -59
  195. package/esm/layout-reducer/resize-flex-children.js.map +0 -1
  196. package/esm/layout-reducer/wrap-layout-element.js +0 -209
  197. package/esm/layout-reducer/wrap-layout-element.js.map +0 -1
  198. package/esm/layout-view/View.css.js +0 -4
  199. package/esm/layout-view/View.css.js.map +0 -1
  200. package/esm/layout-view/View.js +0 -165
  201. package/esm/layout-view/View.js.map +0 -1
  202. package/esm/layout-view/useView.js +0 -89
  203. package/esm/layout-view/useView.js.map +0 -1
  204. package/esm/layout-view/useViewBroadcastChannel.js +0 -33
  205. package/esm/layout-view/useViewBroadcastChannel.js.map +0 -1
  206. package/esm/layout-view/useViewResize.js +0 -40
  207. package/esm/layout-view/useViewResize.js.map +0 -1
  208. package/esm/layout-view-actions/ViewContext.js +0 -12
  209. package/esm/layout-view-actions/ViewContext.js.map +0 -1
  210. package/esm/layout-view-actions/useViewActionDispatcher.js +0 -127
  211. package/esm/layout-view-actions/useViewActionDispatcher.js.map +0 -1
  212. package/esm/palette/Palette.css.js +0 -4
  213. package/esm/palette/Palette.css.js.map +0 -1
  214. package/esm/palette/Palette.js +0 -129
  215. package/esm/palette/Palette.js.map +0 -1
  216. package/esm/placeholder/LayoutStartPanel.css.js +0 -4
  217. package/esm/placeholder/LayoutStartPanel.css.js.map +0 -1
  218. package/esm/placeholder/LayoutStartPanel.js +0 -54
  219. package/esm/placeholder/LayoutStartPanel.js.map +0 -1
  220. package/esm/placeholder/Placeholder.css.js +0 -4
  221. package/esm/placeholder/Placeholder.css.js.map +0 -1
  222. package/esm/placeholder/Placeholder.js +0 -32
  223. package/esm/placeholder/Placeholder.js.map +0 -1
  224. package/esm/responsive/useResizeObserver.js +0 -112
  225. package/esm/responsive/useResizeObserver.js.map +0 -1
  226. package/esm/responsive/utils.js +0 -31
  227. package/esm/responsive/utils.js.map +0 -1
  228. package/esm/stack/Stack.css.js +0 -4
  229. package/esm/stack/Stack.css.js.map +0 -1
  230. package/esm/stack/Stack.js +0 -148
  231. package/esm/stack/Stack.js.map +0 -1
  232. package/esm/stack/StackLayout.js +0 -116
  233. package/esm/stack/StackLayout.js.map +0 -1
  234. package/esm/use-persistent-state.js +0 -107
  235. package/esm/use-persistent-state.js.map +0 -1
  236. package/esm/utils/pathUtils.js +0 -280
  237. package/esm/utils/pathUtils.js.map +0 -1
  238. package/esm/utils/propUtils.js +0 -23
  239. package/esm/utils/propUtils.js.map +0 -1
  240. package/esm/utils/refUtils.js +0 -10
  241. package/esm/utils/refUtils.js.map +0 -1
  242. package/esm/utils/styleUtils.js +0 -13
  243. package/esm/utils/styleUtils.js.map +0 -1
  244. package/esm/utils/typeOf.js +0 -23
  245. package/esm/utils/typeOf.js.map +0 -1
@@ -1,299 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { logger, VuuShellLocation, usePlaceholderJSON } from '@vuu-ui/vuu-utils';
3
- import { useRef, useState, useCallback, useEffect, useContext, useMemo } from 'react';
4
- import { findTarget } from '../utils/pathUtils.js';
5
- import { getProps, getChildProp, getProp } from '../utils/propUtils.js';
6
- import { typeOf } from '../utils/typeOf.js';
7
- import { layoutReducer } from '../layout-reducer/layout-reducer.js';
8
- import { LayoutActionType } from '../layout-reducer/layoutTypes.js';
9
- import { layoutToJSON, layoutQuery, layoutFromJson, cloneElementAddLayoutProps } from '../layout-reducer/layoutUtils.js';
10
- import { LayoutProviderContext } from './LayoutProviderContext.js';
11
- import { useLayoutDragDrop } from './useLayoutDragDrop.js';
12
-
13
- const { info } = logger("LayoutProvider");
14
- const isWorkspaceContainer = (props) => props.id === VuuShellLocation.WorkspaceContainer;
15
- const isMultiWorkspaceContainer = (props) => props.id === VuuShellLocation.MultiWorkspaceContainer;
16
- const shouldSave = (action) => [
17
- "add",
18
- "drag-drop",
19
- "remove",
20
- "set-title",
21
- "splitter-resize",
22
- "switch-tab"
23
- ].includes(action.type);
24
- const getLayoutChangeReason = (action) => {
25
- switch (action.type) {
26
- case "switch-tab":
27
- if (action.id === VuuShellLocation.Workspace) {
28
- return "switch-active-layout";
29
- } else {
30
- return "switch-active-tab";
31
- }
32
- case "save":
33
- return "save-feature-props";
34
- case "drag-drop":
35
- return "drag-drop-operation";
36
- case "add":
37
- return "add-component";
38
- case "remove":
39
- return "remove-component";
40
- case "splitter-resize":
41
- return "resize-component";
42
- case "set-title":
43
- return "edit-feature-title";
44
- default:
45
- throw Error("unknown layout action");
46
- }
47
- };
48
- const LayoutProviderVersion = () => {
49
- const version = useLayoutProviderVersion();
50
- return /* @__PURE__ */ jsx("div", { children: `Context: ${version} ` });
51
- };
52
- const pathToDropTarget = `#${VuuShellLocation.Workspace}.ACTIVE_CHILD`;
53
- const LayoutProvider = (props) => {
54
- const { children, createNewChild, workspaceJSON, onLayoutChange } = props;
55
- const state = useRef(void 0);
56
- const childrenRef = useRef(children);
57
- const [, forceRefresh] = useState(null);
58
- const serializeState = useCallback(
59
- (source, layoutChangeReason) => {
60
- if (onLayoutChange) {
61
- const workspaceContainer = findTarget(source, isWorkspaceContainer) || state.current;
62
- const isLayoutContainer = typeOf(workspaceContainer) === "LayoutContainer";
63
- const target = isLayoutContainer ? getProps(workspaceContainer).children[0] : workspaceContainer;
64
- const serializedModel = layoutToJSON(target);
65
- onLayoutChange(serializedModel, layoutChangeReason);
66
- }
67
- },
68
- [onLayoutChange]
69
- );
70
- const dispatchLayoutAction = useCallback(
71
- (action, suppressSave = false) => {
72
- const nextState = layoutReducer(state.current, action);
73
- if (nextState !== state.current) {
74
- state.current = nextState;
75
- forceRefresh({});
76
- if (!suppressSave && shouldSave(action)) {
77
- serializeState(nextState, getLayoutChangeReason(action));
78
- }
79
- }
80
- },
81
- [forceRefresh, serializeState]
82
- );
83
- const addComponentToWorkspace = useCallback(
84
- (component) => {
85
- dispatchLayoutAction({
86
- type: "add",
87
- path: `#${VuuShellLocation.Workspace}`,
88
- component
89
- });
90
- },
91
- [dispatchLayoutAction]
92
- );
93
- const switchWorkspace = useCallback(
94
- (idx) => {
95
- dispatchLayoutAction({
96
- type: "switch-tab",
97
- nextIdx: idx,
98
- path: `#${VuuShellLocation.MultiWorkspaceContainer}`
99
- });
100
- },
101
- [dispatchLayoutAction]
102
- );
103
- const showComponentInContextPanel = useCallback(
104
- (component, title, onContextPanelClose) => {
105
- dispatchLayoutAction({
106
- type: "set-props",
107
- path: `#${VuuShellLocation.ContextPanel}`,
108
- props: {
109
- expanded: true,
110
- content: component,
111
- onClose: onContextPanelClose,
112
- title
113
- }
114
- });
115
- },
116
- [dispatchLayoutAction]
117
- );
118
- const layoutActionDispatcher = useCallback(
119
- (action) => {
120
- switch (action.type) {
121
- case "drag-start": {
122
- prepareToDragLayout(action);
123
- break;
124
- }
125
- case "save": {
126
- if (state.current) {
127
- serializeState(state.current, getLayoutChangeReason(action));
128
- }
129
- break;
130
- }
131
- case "query":
132
- if (action.query === "PARENT_CONTAINER") {
133
- return layoutQuery(action.query, action.path, state.current);
134
- }
135
- break;
136
- default: {
137
- dispatchLayoutAction(action);
138
- break;
139
- }
140
- }
141
- },
142
- // eslint-disable-next-line react-hooks/exhaustive-deps
143
- [dispatchLayoutAction, serializeState]
144
- );
145
- const prepareToDragLayout = useLayoutDragDrop(
146
- state,
147
- layoutActionDispatcher,
148
- pathToDropTarget
149
- );
150
- useEffect(() => {
151
- if (workspaceJSON) {
152
- info?.("workspaceJSON changed. inject new layout into application");
153
- if (Array.isArray(workspaceJSON)) {
154
- const targetContainer = findTarget(
155
- state.current,
156
- isMultiWorkspaceContainer
157
- );
158
- if (targetContainer) {
159
- const { path: targetContainerPath } = targetContainer.props;
160
- const target = getChildProp(targetContainer);
161
- const newLayouts = workspaceJSON.map(
162
- (ws, i) => layoutFromJson(ws, `${targetContainerPath}.${i}`)
163
- );
164
- const action = target ? {
165
- type: LayoutActionType.REPLACE,
166
- target,
167
- replacement: newLayouts
168
- } : {
169
- type: LayoutActionType.ADD,
170
- path: targetContainerPath,
171
- component: newLayouts
172
- };
173
- dispatchLayoutAction(action, true);
174
- }
175
- } else {
176
- const targetContainer = findTarget(
177
- state.current,
178
- isWorkspaceContainer
179
- );
180
- if (targetContainer) {
181
- const { path: targetContainerPath } = targetContainer.props;
182
- const target = getChildProp(targetContainer);
183
- const newLayout = layoutFromJson(
184
- workspaceJSON,
185
- `${targetContainerPath}.0`
186
- );
187
- const action = target ? {
188
- type: LayoutActionType.REPLACE,
189
- target,
190
- replacement: newLayout
191
- } : {
192
- type: LayoutActionType.ADD,
193
- path: targetContainerPath,
194
- component: newLayout
195
- };
196
- dispatchLayoutAction(action, true);
197
- } else if (workspaceJSON.id === getProp(state.current, "id")) {
198
- const newLayout = layoutFromJson(workspaceJSON, "0");
199
- const action = {
200
- type: LayoutActionType.REPLACE,
201
- target: state.current,
202
- replacement: newLayout
203
- };
204
- dispatchLayoutAction(action, true);
205
- } else {
206
- throw Error(
207
- `LayoutProvider unable to render new workspaceJson, no valid target container. Use a valid Shell Layout Template or include a container with the standard workspace id '${VuuShellLocation.Workspace}' `
208
- );
209
- }
210
- }
211
- }
212
- }, [dispatchLayoutAction, workspaceJSON]);
213
- if (state.current === void 0) {
214
- state.current = cloneElementAddLayoutProps(children);
215
- } else if (children !== childrenRef.current) {
216
- state.current = cloneElementAddLayoutProps(children, state.current);
217
- childrenRef.current = children;
218
- }
219
- return /* @__PURE__ */ jsx(
220
- LayoutProviderContext.Provider,
221
- {
222
- value: {
223
- addComponentToWorkspace,
224
- createNewChild,
225
- dispatchLayoutProvider: layoutActionDispatcher,
226
- showComponentInContextPanel,
227
- switchWorkspace,
228
- version: 0
229
- },
230
- children: state.current
231
- }
232
- );
233
- };
234
- const useLayoutProviderDispatch = () => {
235
- const { dispatchLayoutProvider } = useContext(LayoutProviderContext);
236
- return dispatchLayoutProvider;
237
- };
238
- const useLayoutOperation = () => {
239
- const {
240
- addComponentToWorkspace,
241
- showComponentInContextPanel,
242
- switchWorkspace
243
- } = useContext(LayoutProviderContext);
244
- return {
245
- addComponentToWorkspace,
246
- showComponentInContextPanel,
247
- switchWorkspace
248
- };
249
- };
250
- const useLayoutCreateNewChild = () => {
251
- const layoutPlaceholderJSON = usePlaceholderJSON();
252
- const { createNewChild } = useContext(LayoutProviderContext);
253
- const defaultCreateNewChild = useMemo(
254
- () => function createNewChild2() {
255
- if (layoutPlaceholderJSON) {
256
- const { props } = layoutPlaceholderJSON;
257
- return layoutFromJson(
258
- {
259
- ...layoutPlaceholderJSON,
260
- props: {
261
- ...props,
262
- resizeable: true,
263
- style: {
264
- ...props?.style,
265
- flexGrow: 1,
266
- flexShrink: 0,
267
- flexBasis: 0
268
- }
269
- }
270
- },
271
- "0"
272
- );
273
- }
274
- return layoutFromJson(
275
- {
276
- type: "Placeholder",
277
- props: {
278
- resizeable: true,
279
- style: {
280
- flexGrow: 1,
281
- flexShrink: 0,
282
- flexBasis: 0
283
- }
284
- }
285
- },
286
- "0"
287
- );
288
- },
289
- [layoutPlaceholderJSON]
290
- );
291
- return createNewChild ?? defaultCreateNewChild;
292
- };
293
- const useLayoutProviderVersion = () => {
294
- const { version } = useContext(LayoutProviderContext);
295
- return version;
296
- };
297
-
298
- export { LayoutProvider, LayoutProviderVersion, useLayoutCreateNewChild, useLayoutOperation, useLayoutProviderDispatch, useLayoutProviderVersion };
299
- //# sourceMappingURL=LayoutProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutProvider.js","sources":["../../src/layout-provider/LayoutProvider.tsx"],"sourcesContent":["import {\n VuuShellLocation,\n logger,\n usePlaceholderJSON,\n type LayoutJSON,\n} from \"@vuu-ui/vuu-utils\";\nimport {\n RefObject,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactElement,\n} from \"react\";\nimport {\n LayoutActionType,\n LayoutProps,\n cloneElementAddLayoutProps,\n layoutFromJson,\n layoutQuery,\n layoutReducer,\n layoutToJSON,\n type LayoutChangeHandler,\n type LayoutChangeReason,\n type LayoutReducerAction,\n} from \"../layout-reducer\";\nimport type { SaveAction } from \"../layout-view\";\nimport { findTarget, getChildProp, getProp, getProps, typeOf } from \"../utils\";\nimport {\n LayoutProviderContext,\n LayoutProviderDispatch,\n} from \"./LayoutProviderContext\";\nimport { useLayoutDragDrop } from \"./useLayoutDragDrop\";\n\nconst { info } = logger(\"LayoutProvider\");\n\nconst isWorkspaceContainer = (props: LayoutProps) =>\n props.id === VuuShellLocation.WorkspaceContainer;\n\nconst isMultiWorkspaceContainer = (props: LayoutProps) =>\n props.id === VuuShellLocation.MultiWorkspaceContainer;\n\nconst shouldSave = (action: LayoutReducerAction) =>\n [\n \"add\",\n \"drag-drop\",\n \"remove\",\n \"set-title\",\n \"splitter-resize\",\n \"switch-tab\",\n ].includes(action.type);\n\nconst getLayoutChangeReason = (\n action: LayoutReducerAction | SaveAction,\n): LayoutChangeReason => {\n switch (action.type) {\n case \"switch-tab\":\n if (action.id === VuuShellLocation.Workspace) {\n return \"switch-active-layout\";\n } else {\n return \"switch-active-tab\";\n }\n case \"save\":\n return \"save-feature-props\";\n case \"drag-drop\":\n return \"drag-drop-operation\";\n case \"add\":\n return \"add-component\";\n case \"remove\":\n return \"remove-component\";\n case \"splitter-resize\":\n return \"resize-component\";\n case \"set-title\":\n return \"edit-feature-title\";\n default:\n throw Error(\"unknown layout action\");\n }\n};\n\nexport interface LayoutProviderProps {\n children: ReactElement;\n createNewChild?: (index?: number) => ReactElement;\n workspaceJSON?: LayoutJSON | LayoutJSON[];\n onLayoutChange?: LayoutChangeHandler;\n}\n\nexport const LayoutProviderVersion = () => {\n const version = useLayoutProviderVersion();\n return <div>{`Context: ${version} `}</div>;\n};\n\nconst pathToDropTarget = `#${VuuShellLocation.Workspace}.ACTIVE_CHILD`;\n\nexport const LayoutProvider = (props: LayoutProviderProps): ReactElement => {\n const { children, createNewChild, workspaceJSON, onLayoutChange } = props;\n const state = useRef<ReactElement | undefined>(undefined);\n const childrenRef = useRef<ReactElement>(children);\n\n const [, forceRefresh] = useState<unknown>(null);\n\n const serializeState = useCallback(\n (source: ReactElement, layoutChangeReason: LayoutChangeReason) => {\n if (onLayoutChange) {\n const workspaceContainer =\n findTarget(source, isWorkspaceContainer) || state.current;\n const isLayoutContainer =\n typeOf(workspaceContainer) === \"LayoutContainer\";\n const target = isLayoutContainer\n ? getProps(workspaceContainer).children[0]\n : workspaceContainer;\n const serializedModel = layoutToJSON(target);\n onLayoutChange(serializedModel, layoutChangeReason);\n }\n },\n [onLayoutChange],\n );\n\n const dispatchLayoutAction = useCallback(\n (action: LayoutReducerAction, suppressSave = false) => {\n const nextState = layoutReducer(state.current as ReactElement, action);\n if (nextState !== state.current) {\n state.current = nextState;\n forceRefresh({});\n if (!suppressSave && shouldSave(action)) {\n serializeState(nextState, getLayoutChangeReason(action));\n }\n }\n },\n [forceRefresh, serializeState],\n );\n\n const addComponentToWorkspace = useCallback(\n (component: ReactElement) => {\n dispatchLayoutAction({\n type: \"add\",\n path: `#${VuuShellLocation.Workspace}`,\n component,\n });\n },\n [dispatchLayoutAction],\n );\n\n const switchWorkspace = useCallback(\n (idx: number) => {\n dispatchLayoutAction({\n type: \"switch-tab\",\n nextIdx: idx,\n path: `#${VuuShellLocation.MultiWorkspaceContainer}`,\n });\n },\n [dispatchLayoutAction],\n );\n\n const showComponentInContextPanel = useCallback(\n (\n component: ReactElement | LayoutJSON,\n title?: string,\n onContextPanelClose?: () => void,\n ) => {\n dispatchLayoutAction({\n type: \"set-props\",\n path: `#${VuuShellLocation.ContextPanel}`,\n props: {\n expanded: true,\n content: component,\n onClose: onContextPanelClose,\n title,\n },\n });\n },\n [dispatchLayoutAction],\n );\n\n const layoutActionDispatcher = useCallback<LayoutProviderDispatch>(\n (action) => {\n switch (action.type) {\n case \"drag-start\": {\n prepareToDragLayout(action);\n break;\n }\n case \"save\": {\n if (state.current) {\n serializeState(state.current, getLayoutChangeReason(action));\n }\n break;\n }\n case \"query\":\n if (action.query === \"PARENT_CONTAINER\") {\n return layoutQuery(action.query, action.path, state.current);\n }\n break;\n\n default: {\n dispatchLayoutAction(action);\n break;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dispatchLayoutAction, serializeState],\n );\n\n const prepareToDragLayout = useLayoutDragDrop(\n state as RefObject<ReactElement>,\n layoutActionDispatcher,\n pathToDropTarget,\n );\n\n useEffect(() => {\n if (workspaceJSON) {\n info?.(\"workspaceJSON changed. inject new layout into application\");\n if (Array.isArray(workspaceJSON)) {\n const targetContainer = findTarget(\n state.current,\n isMultiWorkspaceContainer,\n ) as ReactElement;\n if (targetContainer) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { path: targetContainerPath } = targetContainer.props as any;\n const target = getChildProp(targetContainer);\n const newLayouts = workspaceJSON.map((ws, i) =>\n layoutFromJson(ws, `${targetContainerPath}.${i}`),\n );\n const action = target\n ? {\n type: LayoutActionType.REPLACE,\n target,\n replacement: newLayouts,\n }\n : {\n type: LayoutActionType.ADD,\n path: targetContainerPath,\n component: newLayouts,\n };\n dispatchLayoutAction(action, true);\n }\n } else {\n const targetContainer = findTarget(\n state.current,\n isWorkspaceContainer,\n ) as ReactElement;\n if (targetContainer) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { path: targetContainerPath } = targetContainer.props as any;\n const target = getChildProp(targetContainer);\n const newLayout = layoutFromJson(\n workspaceJSON,\n `${targetContainerPath}.0`,\n );\n const action = target\n ? {\n type: LayoutActionType.REPLACE,\n target,\n replacement: newLayout,\n }\n : {\n type: LayoutActionType.ADD,\n path: targetContainerPath,\n component: newLayout,\n };\n dispatchLayoutAction(action, true);\n } else if (workspaceJSON.id === getProp(state.current, \"id\")) {\n const newLayout = layoutFromJson(workspaceJSON, \"0\");\n const action = {\n type: LayoutActionType.REPLACE,\n target: state.current,\n replacement: newLayout,\n };\n dispatchLayoutAction(action, true);\n } else {\n throw Error(\n `LayoutProvider unable to render new workspaceJson, no valid target container. Use a valid Shell Layout Template or include a container with the standard workspace id '${VuuShellLocation.Workspace}' `,\n );\n }\n }\n }\n }, [dispatchLayoutAction, workspaceJSON]);\n\n if (state.current === undefined) {\n state.current = cloneElementAddLayoutProps(children);\n } else if (children !== childrenRef.current) {\n state.current = cloneElementAddLayoutProps(children, state.current);\n childrenRef.current = children;\n }\n\n return (\n <LayoutProviderContext.Provider\n value={{\n addComponentToWorkspace,\n createNewChild,\n dispatchLayoutProvider: layoutActionDispatcher,\n showComponentInContextPanel,\n switchWorkspace,\n version: 0,\n }}\n >\n {state.current}\n </LayoutProviderContext.Provider>\n );\n};\n\nexport const useLayoutProviderDispatch = () => {\n const { dispatchLayoutProvider } = useContext(LayoutProviderContext);\n return dispatchLayoutProvider;\n};\n\nexport const useLayoutOperation = () => {\n const {\n addComponentToWorkspace,\n showComponentInContextPanel,\n switchWorkspace,\n } = useContext(LayoutProviderContext);\n return {\n addComponentToWorkspace,\n showComponentInContextPanel,\n switchWorkspace,\n };\n};\n\nexport const useLayoutCreateNewChild = () => {\n const layoutPlaceholderJSON = usePlaceholderJSON();\n const { createNewChild } = useContext(LayoutProviderContext);\n\n const defaultCreateNewChild = useMemo(\n () =>\n function createNewChild() {\n if (layoutPlaceholderJSON) {\n const { props } = layoutPlaceholderJSON;\n return layoutFromJson(\n {\n ...layoutPlaceholderJSON,\n props: {\n ...props,\n resizeable: true,\n style: {\n ...props?.style,\n flexGrow: 1,\n flexShrink: 0,\n flexBasis: 0,\n },\n },\n },\n \"0\",\n );\n }\n return layoutFromJson(\n {\n type: \"Placeholder\",\n props: {\n resizeable: true,\n style: {\n flexGrow: 1,\n flexShrink: 0,\n flexBasis: 0,\n },\n },\n },\n \"0\",\n );\n },\n [layoutPlaceholderJSON],\n );\n\n return createNewChild ?? defaultCreateNewChild;\n};\n\nexport const useLayoutProviderVersion = () => {\n const { version } = useContext(LayoutProviderContext);\n return version;\n};\n"],"names":["createNewChild"],"mappings":";;;;;;;;;;;;AAoCA,MAAM,EAAE,IAAA,EAAS,GAAA,MAAA,CAAO,gBAAgB,CAAA;AAExC,MAAM,oBAAuB,GAAA,CAAC,KAC5B,KAAA,KAAA,CAAM,OAAO,gBAAiB,CAAA,kBAAA;AAEhC,MAAM,yBAA4B,GAAA,CAAC,KACjC,KAAA,KAAA,CAAM,OAAO,gBAAiB,CAAA,uBAAA;AAEhC,MAAM,UAAA,GAAa,CAAC,MAClB,KAAA;AAAA,EACE,KAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA,WAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAE,CAAA,QAAA,CAAS,OAAO,IAAI,CAAA;AAExB,MAAM,qBAAA,GAAwB,CAC5B,MACuB,KAAA;AACvB,EAAA,QAAQ,OAAO,IAAM;AAAA,IACnB,KAAK,YAAA;AACH,MAAI,IAAA,MAAA,CAAO,EAAO,KAAA,gBAAA,CAAiB,SAAW,EAAA;AAC5C,QAAO,OAAA,sBAAA;AAAA,OACF,MAAA;AACL,QAAO,OAAA,mBAAA;AAAA;AACT,IACF,KAAK,MAAA;AACH,MAAO,OAAA,oBAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAO,OAAA,qBAAA;AAAA,IACT,KAAK,KAAA;AACH,MAAO,OAAA,eAAA;AAAA,IACT,KAAK,QAAA;AACH,MAAO,OAAA,kBA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GACxB;AAEA,EAAA,OAAO,cAAkB,IAAA,qBAAA;AAC3B;AAEO,MAAM,2BAA2B,MAAM;AAC5C,EAAA,MAAM,EAAE,OAAA,EAAY,GAAA,UAAA,CAAW,qBAAqB,CAAA;AACpD,EAAO,OAAA,OAAA;AACT;;;;"}
@@ -1,20 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- const unconfiguredLayoutProviderDispatch = (action) => console.log(
4
- `dispatch ${action.type}, have you forgotten to provide a LayoutProvider ?`
5
- );
6
- const unconfiguredService = (message) => () => console.log(`${message}, have you forgotten to provide a LayoutProvider ?`);
7
- const MissingLayoutContextPanel = unconfiguredService(
8
- "showComponentInContextPanel"
9
- );
10
- const isUnconfiguredProperty = (property) => property === MissingLayoutContextPanel;
11
- const LayoutProviderContext = createContext({
12
- addComponentToWorkspace: unconfiguredService("addComponentToWorkspace"),
13
- dispatchLayoutProvider: unconfiguredLayoutProviderDispatch,
14
- showComponentInContextPanel: MissingLayoutContextPanel,
15
- switchWorkspace: unconfiguredService("switchWorkspace"),
16
- version: -1
17
- });
18
-
19
- export { LayoutProviderContext, isUnconfiguredProperty };
20
- //# sourceMappingURL=LayoutProviderContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LayoutProviderContext.js","sources":["../../src/layout-provider/LayoutProviderContext.ts"],"sourcesContent":["import { createContext, Dispatch, ReactElement } from \"react\";\nimport {\n DragStartAction,\n LayoutReducerAction,\n QueryAction,\n} from \"../layout-reducer\";\nimport { SaveAction } from \"../layout-view\";\nimport { LayoutJSON } from \"@vuu-ui/vuu-utils\";\n\nconst unconfiguredLayoutProviderDispatch: LayoutProviderDispatch = (action) =>\n console.log(\n `dispatch ${action.type}, have you forgotten to provide a LayoutProvider ?`,\n );\n\nconst unconfiguredService = (message: string) => () =>\n console.log(`${message}, have you forgotten to provide a LayoutProvider ?`);\n\nconst MissingLayoutContextPanel = unconfiguredService(\n \"showComponentInContextPanel\",\n);\n\nexport const isUnconfiguredProperty = (property: unknown): boolean =>\n property === MissingLayoutContextPanel;\n\nexport type LayoutProviderDispatch = Dispatch<\n LayoutReducerAction | SaveAction | DragStartAction | QueryAction\n>;\n\nexport interface LayoutProviderContextProps {\n addComponentToWorkspace: (component: ReactElement) => void;\n createNewChild?: (index?: number) => ReactElement;\n dispatchLayoutProvider: LayoutProviderDispatch;\n showComponentInContextPanel: (\n component: ReactElement | LayoutJSON,\n title?: string,\n onContextPanelClose?: () => void,\n ) => void;\n switchWorkspace: (idx: number) => void;\n version: number;\n}\n\nexport const LayoutProviderContext = createContext<LayoutProviderContextProps>({\n addComponentToWorkspace: unconfiguredService(\"addComponentToWorkspace\"),\n dispatchLayoutProvider: unconfiguredLayoutProviderDispatch,\n showComponentInContextPanel: MissingLayoutContextPanel,\n switchWorkspace: unconfiguredService(\"switchWorkspace\"),\n version: -1,\n});\n"],"names":[],"mappings":";;AASA,MAAM,kCAAA,GAA6D,CAAC,MAAA,KAClE,OAAQ,CAAA,GAAA;AAAA,EACN,CAAA,SAAA,EAAY,OAAO,IAAI,CAAA,kDAAA;AACzB,CAAA;AAEF,MAAM,mBAAA,GAAsB,CAAC,OAAoB,KAAA,MAC/C,QAAQ,GAAI,CAAA,CAAA,EAAG,OAAO,CAAoD,kDAAA,CAAA,CAAA;AAE5E,MAAM,yBAA4B,GAAA,mBAAA;AAAA,EAChC;AACF,CAAA;AAEa,MAAA,sBAAA,GAAyB,CAAC,QAAA,KACrC,QAAa,KAAA;AAmBR,MAAM,wBAAwB,aAA0C,CAAA;AAAA,EAC7E,uBAAA,EAAyB,oBAAoB,yBAAyB,CAAA;AAAA,EACtE,sBAAwB,EAAA,kCAAA;AAAA,EACxB,2BAA6B,EAAA,yBAAA;AAAA,EAC7B,eAAA,EAAiB,oBAAoB,iBAAiB,CAAA;AAAA,EACtD,OAAS,EAAA,CAAA;AACX,CAAC;;;;"}
@@ -1,175 +0,0 @@
1
- import { useRef, useCallback } from 'react';
2
- import { Draggable } from '../drag-drop/Draggable.js';
3
- import { followPath, resolvePath } from '../utils/pathUtils.js';
4
- import '../drag-drop/BoxModel.js';
5
- import { getIntrinsicSize } from '../layout-reducer/flexUtils.js';
6
-
7
- const NO_INSTRUCTIONS = {};
8
- const NO_OFFSETS = [0, 0];
9
- const getDragElement = (rect, id, dragElement) => {
10
- const wrapper = document.createElement("div");
11
- wrapper.className = "vuuSimpleDraggableWrapper";
12
- wrapper.classList.add(
13
- "vuuSimpleDraggableWrapper",
14
- "salt-theme",
15
- "salt-density-medium"
16
- );
17
- wrapper.dataset.dragging = "true";
18
- const div = dragElement ?? document.createElement("div");
19
- div.id = id;
20
- wrapper.appendChild(div);
21
- document.body.appendChild(wrapper);
22
- const cssText = `top:${rect.top}px;left:${rect.left}px;width:${rect.width}px;height:${rect.height}px;`;
23
- return [wrapper, cssText, rect.left, rect.top];
24
- };
25
- const determineDragOffsets = (draggedElement) => {
26
- const { offsetParent } = draggedElement;
27
- if (offsetParent === null) {
28
- return NO_OFFSETS;
29
- } else {
30
- const { left: offsetLeft, top: offsetTop } = offsetParent.getBoundingClientRect();
31
- return [offsetLeft, offsetTop];
32
- }
33
- };
34
- const useLayoutDragDrop = (rootLayoutRef, dispatch, pathToDropTarget) => {
35
- const dragActionRef = useRef(void 0);
36
- const dragOperationRef = useRef(void 0);
37
- const draggableHTMLElementRef = useRef(void 0);
38
- const handleDrag = useCallback((x, y) => {
39
- if (dragOperationRef.current && draggableHTMLElementRef.current) {
40
- const {
41
- dragOffsets: [offsetX, offsetY],
42
- targetPosition
43
- } = dragOperationRef.current;
44
- const left = typeof x === "number" ? x - offsetX : targetPosition.left;
45
- const top = typeof y === "number" ? y - offsetY : targetPosition.top;
46
- if (left !== targetPosition.left || top !== targetPosition.top) {
47
- dragOperationRef.current.targetPosition.left = left;
48
- dragOperationRef.current.targetPosition.top = top;
49
- draggableHTMLElementRef.current.style.top = top + "px";
50
- draggableHTMLElementRef.current.style.left = left + "px";
51
- }
52
- }
53
- }, []);
54
- const handleDrop = useCallback(
55
- (dropTarget) => {
56
- if (dragOperationRef.current) {
57
- const {
58
- dragInstructions,
59
- payload: draggedReactElement,
60
- originalCSS
61
- } = dragOperationRef.current;
62
- if (dropTarget) {
63
- dispatch({
64
- type: "drag-drop",
65
- draggedReactElement,
66
- dragInstructions,
67
- dropTarget
68
- });
69
- }
70
- if (draggableHTMLElementRef.current) {
71
- if (!dropTarget && dragInstructions.DriftHomeIfNoDropTarget) {
72
- console.log("drift back to start");
73
- document.body.removeChild(draggableHTMLElementRef.current);
74
- } else if (dragInstructions.RemoveDraggableOnDragEnd) {
75
- document.body.removeChild(draggableHTMLElementRef.current);
76
- } else {
77
- draggableHTMLElementRef.current.style.cssText = originalCSS;
78
- delete draggableHTMLElementRef.current.dataset.dragging;
79
- }
80
- }
81
- dragActionRef.current = void 0;
82
- dragOperationRef.current = void 0;
83
- draggableHTMLElementRef.current = void 0;
84
- }
85
- },
86
- [dispatch]
87
- );
88
- const handleDragStart = useCallback(
89
- (evt) => {
90
- if (dragActionRef.current) {
91
- const {
92
- payload: component,
93
- dragContainerPath,
94
- dragElement,
95
- dragRect,
96
- instructions = NO_INSTRUCTIONS,
97
- path
98
- } = dragActionRef.current;
99
- const { current: rootLayout } = rootLayoutRef;
100
- const dragPos = { x: evt.clientX, y: evt.clientY };
101
- const dragPayload = component ?? followPath(rootLayout, path, true);
102
- const { id: dragPayloadId } = dragPayload.props;
103
- const intrinsicSize = getIntrinsicSize(dragPayload);
104
- let originalCSS = "", dragCSS = "", dragTransform = "";
105
- let dragStartLeft = -1;
106
- let dragStartTop = -1;
107
- let dragOffsets = NO_OFFSETS;
108
- let element = document.getElementById(dragPayloadId);
109
- if (element === null) {
110
- [element, dragCSS, dragStartLeft, dragStartTop] = getDragElement(
111
- dragRect,
112
- dragPayloadId,
113
- dragElement
114
- );
115
- } else {
116
- dragOffsets = determineDragOffsets(element);
117
- const [offsetLeft, offsetTop] = dragOffsets;
118
- const { width, height, left, top } = element.getBoundingClientRect();
119
- dragStartLeft = left - offsetLeft;
120
- dragStartTop = top - offsetTop;
121
- dragCSS = `width:${width}px;height:${height}px;left:${dragStartLeft}px;top:${dragStartTop}px;z-index: 100;background-color:#ccc;opacity: 0.6;`;
122
- element.dataset.dragging = "true";
123
- originalCSS = element.style.cssText;
124
- }
125
- dragTransform = Draggable.initDrag(
126
- rootLayoutRef.current,
127
- dragContainerPath,
128
- dragRect,
129
- dragPos,
130
- {
131
- drag: handleDrag,
132
- drop: handleDrop
133
- },
134
- intrinsicSize
135
- // dropTargets
136
- );
137
- element.style.cssText = dragCSS + dragTransform;
138
- draggableHTMLElementRef.current = element;
139
- dragOperationRef.current = {
140
- payload: dragPayload,
141
- originalCSS,
142
- dragRect,
143
- dragOffsets,
144
- dragInstructions: instructions,
145
- targetPosition: { left: dragStartLeft, top: dragStartTop }
146
- };
147
- }
148
- },
149
- [handleDrag, handleDrop, rootLayoutRef]
150
- );
151
- const prepareToDrag = useCallback(
152
- (action) => {
153
- const { evt, ...options } = action;
154
- try {
155
- dragActionRef.current = {
156
- ...options,
157
- dragContainerPath: resolvePath(
158
- rootLayoutRef.current,
159
- pathToDropTarget
160
- )
161
- };
162
- Draggable.handleMousedown(evt, handleDragStart, options.instructions);
163
- } catch (err) {
164
- console.warn(
165
- `[useLayoutDragDrop] path ${pathToDropTarget} not resolved, the application layout does not have the required elements to support drag drop`
166
- );
167
- }
168
- },
169
- [handleDragStart, pathToDropTarget, rootLayoutRef]
170
- );
171
- return prepareToDrag;
172
- };
173
-
174
- export { useLayoutDragDrop };
175
- //# sourceMappingURL=useLayoutDragDrop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLayoutDragDrop.js","sources":["../../src/layout-provider/useLayoutDragDrop.ts"],"sourcesContent":["import { MutableRefObject, ReactElement, useCallback, useRef } from \"react\";\nimport {\n DragDropRect,\n DragEndCallback,\n Draggable,\n DragInstructions,\n DragMoveCallback,\n} from \"../drag-drop\";\nimport { DragStartAction } from \"../layout-reducer\";\nimport { getIntrinsicSize } from \"../layout-reducer/flexUtils\";\nimport { followPath, resolvePath } from \"../utils\";\nimport { LayoutProviderDispatch } from \"./LayoutProviderContext\";\n\nconst NO_INSTRUCTIONS = {} as DragInstructions;\nconst NO_OFFSETS: [number, number] = [0, 0];\n\ninterface CurrentDragAction extends Omit<DragStartAction, \"evt\" | \"type\"> {\n dragContainerPath: string;\n}\n\ninterface DragOperation {\n payload: ReactElement;\n originalCSS: string;\n dragRect: unknown;\n dragInstructions: DragInstructions;\n dragOffsets: [number, number];\n targetPosition: { left: number; top: number };\n}\n\nconst getDragElement = (\n rect: DragDropRect,\n id: string,\n dragElement?: HTMLElement,\n): [HTMLElement, string, number, number] => {\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"vuuSimpleDraggableWrapper\";\n wrapper.classList.add(\n \"vuuSimpleDraggableWrapper\",\n \"salt-theme\",\n \"salt-density-medium\",\n );\n wrapper.dataset.dragging = \"true\";\n\n const div = dragElement ?? document.createElement(\"div\");\n div.id = id;\n\n wrapper.appendChild(div);\n document.body.appendChild(wrapper);\n const cssText = `top:${rect.top}px;left:${rect.left}px;width:${rect.width}px;height:${rect.height}px;`;\n return [wrapper, cssText, rect.left, rect.top];\n};\n\nconst determineDragOffsets = (\n draggedElement: HTMLElement,\n): [number, number] => {\n const { offsetParent } = draggedElement;\n if (offsetParent === null) {\n return NO_OFFSETS;\n } else {\n const { left: offsetLeft, top: offsetTop } =\n offsetParent.getBoundingClientRect();\n return [offsetLeft, offsetTop];\n }\n};\n\nexport const useLayoutDragDrop = (\n rootLayoutRef: MutableRefObject<ReactElement>,\n dispatch: LayoutProviderDispatch,\n pathToDropTarget?: string,\n) => {\n const dragActionRef = useRef<CurrentDragAction>(undefined);\n const dragOperationRef = useRef<DragOperation>(undefined);\n const draggableHTMLElementRef = useRef<HTMLElement>(undefined);\n\n const handleDrag = useCallback<DragMoveCallback>((x, y) => {\n if (dragOperationRef.current && draggableHTMLElementRef.current) {\n const {\n dragOffsets: [offsetX, offsetY],\n targetPosition,\n } = dragOperationRef.current;\n const left = typeof x === \"number\" ? x - offsetX : targetPosition.left;\n const top = typeof y === \"number\" ? y - offsetY : targetPosition.top;\n if (left !== targetPosition.left || top !== targetPosition.top) {\n dragOperationRef.current.targetPosition.left = left;\n dragOperationRef.current.targetPosition.top = top;\n draggableHTMLElementRef.current.style.top = top + \"px\";\n draggableHTMLElementRef.current.style.left = left + \"px\";\n }\n }\n }, []);\n\n const handleDrop: DragEndCallback = useCallback(\n (dropTarget) => {\n if (dragOperationRef.current) {\n const {\n dragInstructions,\n payload: draggedReactElement,\n originalCSS,\n } = dragOperationRef.current;\n\n if (dropTarget) {\n dispatch({\n type: \"drag-drop\",\n draggedReactElement,\n dragInstructions,\n dropTarget,\n });\n }\n\n if (draggableHTMLElementRef.current) {\n if (!dropTarget && dragInstructions.DriftHomeIfNoDropTarget) {\n console.log(\"drift back to start\");\n document.body.removeChild(draggableHTMLElementRef.current);\n } else if (dragInstructions.RemoveDraggableOnDragEnd) {\n document.body.removeChild(draggableHTMLElementRef.current);\n } else {\n draggableHTMLElementRef.current.style.cssText = originalCSS;\n delete draggableHTMLElementRef.current.dataset.dragging;\n }\n }\n\n dragActionRef.current = undefined;\n dragOperationRef.current = undefined;\n draggableHTMLElementRef.current = undefined;\n }\n },\n [dispatch],\n );\n\n const handleDragStart = useCallback(\n (evt: MouseEvent) => {\n if (dragActionRef.current) {\n const {\n payload: component,\n dragContainerPath,\n dragElement,\n dragRect,\n instructions = NO_INSTRUCTIONS,\n path,\n } = dragActionRef.current;\n const { current: rootLayout } = rootLayoutRef;\n const dragPos = { x: evt.clientX, y: evt.clientY };\n const dragPayload = component ?? followPath(rootLayout, path, true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { id: dragPayloadId } = dragPayload.props as any;\n const intrinsicSize = getIntrinsicSize(dragPayload);\n let originalCSS = \"\",\n dragCSS = \"\",\n dragTransform = \"\";\n\n let dragStartLeft = -1;\n let dragStartTop = -1;\n let dragOffsets: [number, number] = NO_OFFSETS;\n\n let element = document.getElementById(dragPayloadId);\n\n if (element === null) {\n [element, dragCSS, dragStartLeft, dragStartTop] = getDragElement(\n dragRect,\n dragPayloadId,\n dragElement,\n );\n } else {\n dragOffsets = determineDragOffsets(element);\n const [offsetLeft, offsetTop] = dragOffsets;\n const { width, height, left, top } = element.getBoundingClientRect();\n dragStartLeft = left - offsetLeft;\n dragStartTop = top - offsetTop;\n dragCSS = `width:${width}px;height:${height}px;left:${dragStartLeft}px;top:${dragStartTop}px;z-index: 100;background-color:#ccc;opacity: 0.6;`;\n element.dataset.dragging = \"true\";\n originalCSS = element.style.cssText;\n }\n\n dragTransform = Draggable.initDrag(\n rootLayoutRef.current,\n dragContainerPath,\n dragRect,\n dragPos,\n {\n drag: handleDrag,\n drop: handleDrop,\n },\n intrinsicSize,\n // dropTargets\n );\n\n element.style.cssText = dragCSS + dragTransform;\n draggableHTMLElementRef.current = element;\n\n dragOperationRef.current = {\n payload: dragPayload,\n originalCSS,\n dragRect,\n dragOffsets,\n dragInstructions: instructions,\n targetPosition: { left: dragStartLeft, top: dragStartTop },\n };\n }\n },\n [handleDrag, handleDrop, rootLayoutRef],\n );\n\n const prepareToDrag = useCallback(\n (action: DragStartAction) => {\n const { evt, ...options } = action;\n try {\n dragActionRef.current = {\n ...options,\n dragContainerPath: resolvePath(\n rootLayoutRef.current,\n pathToDropTarget,\n ),\n };\n Draggable.handleMousedown(evt, handleDragStart, options.instructions);\n } catch (err) {\n console.warn(\n `[useLayoutDragDrop] path ${pathToDropTarget} not resolved, the application layout does not have the required elements to support drag drop`,\n );\n }\n },\n [handleDragStart, pathToDropTarget, rootLayoutRef],\n );\n\n return prepareToDrag;\n};\n"],"names":[],"mappings":";;;;;;AAaA,MAAM,kBAAkB,EAAC;AACzB,MAAM,UAAA,GAA+B,CAAC,CAAA,EAAG,CAAC,CAAA;AAe1C,MAAM,cAAiB,GAAA,CACrB,IACA,EAAA,EAAA,EACA,WAC0C,KAAA;AAC1C,EAAM,MAAA,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