@vuu-ui/vuu-layout 0.8.32 → 0.8.34
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.
- package/cjs/Component.js +14 -0
- package/cjs/Component.js.map +1 -0
- package/cjs/DraggableLayout.css +18 -0
- package/cjs/DraggableLayout.js +24 -0
- package/cjs/DraggableLayout.js.map +1 -0
- package/cjs/dock-layout/DockLayout.css +36 -0
- package/cjs/dock-layout/DockLayout.js +27 -0
- package/cjs/dock-layout/DockLayout.js.map +1 -0
- package/cjs/dock-layout/Drawer.css +159 -0
- package/cjs/dock-layout/Drawer.js +87 -0
- package/cjs/dock-layout/Drawer.js.map +1 -0
- package/cjs/drag-drop/BoxModel.js +422 -0
- package/cjs/drag-drop/BoxModel.js.map +1 -0
- package/cjs/drag-drop/DragState.js +154 -0
- package/cjs/drag-drop/DragState.js.map +1 -0
- package/cjs/drag-drop/Draggable.js +192 -0
- package/cjs/drag-drop/Draggable.js.map +1 -0
- package/cjs/drag-drop/DropMenu.css +71 -0
- package/cjs/drag-drop/DropMenu.js +46 -0
- package/cjs/drag-drop/DropMenu.js.map +1 -0
- package/cjs/drag-drop/DropTarget.js +244 -0
- package/cjs/drag-drop/DropTarget.js.map +1 -0
- package/cjs/drag-drop/DropTargetRenderer.css +40 -0
- package/cjs/drag-drop/DropTargetRenderer.js +233 -0
- package/cjs/drag-drop/DropTargetRenderer.js.map +1 -0
- package/cjs/flexbox/Flexbox.css +45 -0
- package/cjs/flexbox/Flexbox.js +61 -0
- package/cjs/flexbox/Flexbox.js.map +1 -0
- package/cjs/flexbox/FlexboxLayout.js +30 -0
- package/cjs/flexbox/FlexboxLayout.js.map +1 -0
- package/cjs/flexbox/FluidGrid.css +134 -0
- package/cjs/flexbox/FluidGrid.js +78 -0
- package/cjs/flexbox/FluidGrid.js.map +1 -0
- package/cjs/flexbox/FluidGridLayout.js +14 -0
- package/cjs/flexbox/FluidGridLayout.js.map +1 -0
- package/cjs/flexbox/Splitter.css +148 -0
- package/cjs/flexbox/Splitter.js +113 -0
- package/cjs/flexbox/Splitter.js.map +1 -0
- package/cjs/flexbox/flexbox-utils.js +109 -0
- package/cjs/flexbox/flexbox-utils.js.map +1 -0
- package/cjs/flexbox/useResponsiveSizing.js +62 -0
- package/cjs/flexbox/useResponsiveSizing.js.map +1 -0
- package/cjs/flexbox/useSplitterResizing.js +209 -0
- package/cjs/flexbox/useSplitterResizing.js.map +1 -0
- package/cjs/index.js +132 -19
- package/cjs/index.js.map +1 -7
- package/cjs/layout-action.js +27 -0
- package/cjs/layout-action.js.map +1 -0
- package/cjs/layout-header/Header.css +9 -0
- package/cjs/layout-header/Header.js +122 -0
- package/cjs/layout-header/Header.js.map +1 -0
- package/cjs/layout-provider/LayoutProvider.js +178 -0
- package/cjs/layout-provider/LayoutProvider.js.map +1 -0
- package/cjs/layout-provider/LayoutProviderContext.js +14 -0
- package/cjs/layout-provider/LayoutProviderContext.js.map +1 -0
- package/cjs/layout-provider/useLayoutDragDrop.js +170 -0
- package/cjs/layout-provider/useLayoutDragDrop.js.map +1 -0
- package/cjs/layout-reducer/flexUtils.js +219 -0
- package/cjs/layout-reducer/flexUtils.js.map +1 -0
- package/cjs/layout-reducer/insert-layout-element.js +273 -0
- package/cjs/layout-reducer/insert-layout-element.js.map +1 -0
- package/cjs/layout-reducer/layout-reducer.js +198 -0
- package/cjs/layout-reducer/layout-reducer.js.map +1 -0
- package/cjs/layout-reducer/layoutTypes.js +41 -0
- package/cjs/layout-reducer/layoutTypes.js.map +1 -0
- package/cjs/layout-reducer/layoutUtils.js +226 -0
- package/cjs/layout-reducer/layoutUtils.js.map +1 -0
- package/cjs/layout-reducer/move-layout-element.js +31 -0
- package/cjs/layout-reducer/move-layout-element.js.map +1 -0
- package/cjs/layout-reducer/remove-layout-element.js +223 -0
- package/cjs/layout-reducer/remove-layout-element.js.map +1 -0
- package/cjs/layout-reducer/replace-layout-element.js +91 -0
- package/cjs/layout-reducer/replace-layout-element.js.map +1 -0
- package/cjs/layout-reducer/resize-flex-children.js +61 -0
- package/cjs/layout-reducer/resize-flex-children.js.map +1 -0
- package/cjs/layout-reducer/wrap-layout-element.js +212 -0
- package/cjs/layout-reducer/wrap-layout-element.js.map +1 -0
- package/cjs/layout-view/View.css +62 -0
- package/cjs/layout-view/View.js +155 -0
- package/cjs/layout-view/View.js.map +1 -0
- package/cjs/layout-view/useView.js +92 -0
- package/cjs/layout-view/useView.js.map +1 -0
- package/cjs/layout-view/useViewResize.js +42 -0
- package/cjs/layout-view/useViewResize.js.map +1 -0
- package/cjs/layout-view-actions/ViewContext.js +16 -0
- package/cjs/layout-view-actions/ViewContext.js.map +1 -0
- package/cjs/layout-view-actions/useViewActionDispatcher.js +103 -0
- package/cjs/layout-view-actions/useViewActionDispatcher.js.map +1 -0
- package/cjs/palette/Palette.css +33 -0
- package/cjs/palette/Palette.js +118 -0
- package/cjs/palette/Palette.js.map +1 -0
- package/cjs/placeholder/LayoutStartPanel.css +30 -0
- package/cjs/placeholder/LayoutStartPanel.js +51 -0
- package/cjs/placeholder/LayoutStartPanel.js.map +1 -0
- package/cjs/placeholder/Placeholder.css +17 -0
- package/cjs/placeholder/Placeholder.js +25 -0
- package/cjs/placeholder/Placeholder.js.map +1 -0
- package/cjs/registry/ComponentRegistry.js +27 -0
- package/cjs/registry/ComponentRegistry.js.map +1 -0
- package/cjs/responsive/breakpoints.js +36 -0
- package/cjs/responsive/breakpoints.js.map +1 -0
- package/cjs/responsive/use-breakpoints.js +76 -0
- package/cjs/responsive/use-breakpoints.js.map +1 -0
- package/cjs/responsive/useResizeObserver.js +118 -0
- package/cjs/responsive/useResizeObserver.js.map +1 -0
- package/cjs/responsive/utils.js +34 -0
- package/cjs/responsive/utils.js.map +1 -0
- package/cjs/stack/Stack.css +39 -0
- package/cjs/stack/Stack.js +139 -0
- package/cjs/stack/Stack.js.map +1 -0
- package/cjs/stack/StackLayout.js +122 -0
- package/cjs/stack/StackLayout.js.map +1 -0
- package/cjs/use-persistent-state.js +109 -0
- package/cjs/use-persistent-state.js.map +1 -0
- package/cjs/utils/pathUtils.js +293 -0
- package/cjs/utils/pathUtils.js.map +1 -0
- package/cjs/utils/propUtils.js +27 -0
- package/cjs/utils/propUtils.js.map +1 -0
- package/cjs/utils/refUtils.js +12 -0
- package/cjs/utils/refUtils.js.map +1 -0
- package/cjs/utils/styleUtils.js +15 -0
- package/cjs/utils/styleUtils.js.map +1 -0
- package/cjs/utils/typeOf.js +27 -0
- package/cjs/utils/typeOf.js.map +1 -0
- package/esm/Component.js +12 -0
- package/esm/Component.js.map +1 -0
- package/esm/DraggableLayout.css +18 -0
- package/esm/DraggableLayout.js +22 -0
- package/esm/DraggableLayout.js.map +1 -0
- package/esm/dock-layout/DockLayout.css +36 -0
- package/esm/dock-layout/DockLayout.js +25 -0
- package/esm/dock-layout/DockLayout.js.map +1 -0
- package/esm/dock-layout/Drawer.css +159 -0
- package/esm/dock-layout/Drawer.js +85 -0
- package/esm/dock-layout/Drawer.js.map +1 -0
- package/esm/drag-drop/BoxModel.js +415 -0
- package/esm/drag-drop/BoxModel.js.map +1 -0
- package/esm/drag-drop/DragState.js +152 -0
- package/esm/drag-drop/DragState.js.map +1 -0
- package/esm/drag-drop/Draggable.js +190 -0
- package/esm/drag-drop/Draggable.js.map +1 -0
- package/esm/drag-drop/DropMenu.css +71 -0
- package/esm/drag-drop/DropMenu.js +43 -0
- package/esm/drag-drop/DropMenu.js.map +1 -0
- package/esm/drag-drop/DropTarget.js +240 -0
- package/esm/drag-drop/DropTarget.js.map +1 -0
- package/esm/drag-drop/DropTargetRenderer.css +40 -0
- package/esm/drag-drop/DropTargetRenderer.js +231 -0
- package/esm/drag-drop/DropTargetRenderer.js.map +1 -0
- package/esm/flexbox/Flexbox.css +45 -0
- package/esm/flexbox/Flexbox.js +59 -0
- package/esm/flexbox/Flexbox.js.map +1 -0
- package/esm/flexbox/FlexboxLayout.js +28 -0
- package/esm/flexbox/FlexboxLayout.js.map +1 -0
- package/esm/flexbox/FluidGrid.css +134 -0
- package/esm/flexbox/FluidGrid.js +76 -0
- package/esm/flexbox/FluidGrid.js.map +1 -0
- package/esm/flexbox/FluidGridLayout.js +12 -0
- package/esm/flexbox/FluidGridLayout.js.map +1 -0
- package/esm/flexbox/Splitter.css +148 -0
- package/esm/flexbox/Splitter.js +111 -0
- package/esm/flexbox/Splitter.js.map +1 -0
- package/esm/flexbox/flexbox-utils.js +103 -0
- package/esm/flexbox/flexbox-utils.js.map +1 -0
- package/esm/flexbox/useResponsiveSizing.js +60 -0
- package/esm/flexbox/useResponsiveSizing.js.map +1 -0
- package/esm/flexbox/useSplitterResizing.js +207 -0
- package/esm/flexbox/useSplitterResizing.js.map +1 -0
- package/esm/index.js +36 -19
- package/esm/index.js.map +1 -7
- package/esm/layout-action.js +25 -0
- package/esm/layout-action.js.map +1 -0
- package/esm/layout-header/Header.css +9 -0
- package/esm/layout-header/Header.js +120 -0
- package/esm/layout-header/Header.js.map +1 -0
- package/esm/layout-provider/LayoutProvider.js +172 -0
- package/esm/layout-provider/LayoutProvider.js.map +1 -0
- package/esm/layout-provider/LayoutProviderContext.js +12 -0
- package/esm/layout-provider/LayoutProviderContext.js.map +1 -0
- package/esm/layout-provider/useLayoutDragDrop.js +168 -0
- package/esm/layout-provider/useLayoutDragDrop.js.map +1 -0
- package/esm/layout-reducer/flexUtils.js +210 -0
- package/esm/layout-reducer/flexUtils.js.map +1 -0
- package/esm/layout-reducer/insert-layout-element.js +269 -0
- package/esm/layout-reducer/insert-layout-element.js.map +1 -0
- package/esm/layout-reducer/layout-reducer.js +196 -0
- package/esm/layout-reducer/layout-reducer.js.map +1 -0
- package/esm/layout-reducer/layoutTypes.js +37 -0
- package/esm/layout-reducer/layoutTypes.js.map +1 -0
- package/esm/layout-reducer/layoutUtils.js +215 -0
- package/esm/layout-reducer/layoutUtils.js.map +1 -0
- package/esm/layout-reducer/move-layout-element.js +29 -0
- package/esm/layout-reducer/move-layout-element.js.map +1 -0
- package/esm/layout-reducer/remove-layout-element.js +221 -0
- package/esm/layout-reducer/remove-layout-element.js.map +1 -0
- package/esm/layout-reducer/replace-layout-element.js +87 -0
- package/esm/layout-reducer/replace-layout-element.js.map +1 -0
- package/esm/layout-reducer/resize-flex-children.js +58 -0
- package/esm/layout-reducer/resize-flex-children.js.map +1 -0
- package/esm/layout-reducer/wrap-layout-element.js +210 -0
- package/esm/layout-reducer/wrap-layout-element.js.map +1 -0
- package/esm/layout-view/View.css +62 -0
- package/esm/layout-view/View.js +153 -0
- package/esm/layout-view/View.js.map +1 -0
- package/esm/layout-view/useView.js +90 -0
- package/esm/layout-view/useView.js.map +1 -0
- package/esm/layout-view/useViewResize.js +40 -0
- package/esm/layout-view/useViewResize.js.map +1 -0
- package/esm/layout-view-actions/ViewContext.js +12 -0
- package/esm/layout-view-actions/ViewContext.js.map +1 -0
- package/esm/layout-view-actions/useViewActionDispatcher.js +101 -0
- package/esm/layout-view-actions/useViewActionDispatcher.js.map +1 -0
- package/esm/palette/Palette.css +33 -0
- package/esm/palette/Palette.js +115 -0
- package/esm/palette/Palette.js.map +1 -0
- package/esm/placeholder/LayoutStartPanel.css +30 -0
- package/esm/placeholder/LayoutStartPanel.js +49 -0
- package/esm/placeholder/LayoutStartPanel.js.map +1 -0
- package/esm/placeholder/Placeholder.css +17 -0
- package/esm/placeholder/Placeholder.js +23 -0
- package/esm/placeholder/Placeholder.js.map +1 -0
- package/esm/registry/ComponentRegistry.js +21 -0
- package/esm/registry/ComponentRegistry.js.map +1 -0
- package/esm/responsive/breakpoints.js +33 -0
- package/esm/responsive/breakpoints.js.map +1 -0
- package/esm/responsive/use-breakpoints.js +74 -0
- package/esm/responsive/use-breakpoints.js.map +1 -0
- package/esm/responsive/useResizeObserver.js +112 -0
- package/esm/responsive/useResizeObserver.js.map +1 -0
- package/esm/responsive/utils.js +31 -0
- package/esm/responsive/utils.js.map +1 -0
- package/esm/stack/Stack.css +39 -0
- package/esm/stack/Stack.js +137 -0
- package/esm/stack/Stack.js.map +1 -0
- package/esm/stack/StackLayout.js +120 -0
- package/esm/stack/StackLayout.js.map +1 -0
- package/esm/use-persistent-state.js +104 -0
- package/esm/use-persistent-state.js.map +1 -0
- package/esm/utils/pathUtils.js +280 -0
- package/esm/utils/pathUtils.js.map +1 -0
- package/esm/utils/propUtils.js +23 -0
- package/esm/utils/propUtils.js.map +1 -0
- package/esm/utils/refUtils.js +10 -0
- package/esm/utils/refUtils.js.map +1 -0
- package/esm/utils/styleUtils.js +13 -0
- package/esm/utils/styleUtils.js.map +1 -0
- package/esm/utils/typeOf.js +23 -0
- package/esm/utils/typeOf.js.map +1 -0
- package/package.json +12 -15
- package/types/index.d.ts +1 -1
- package/types/layout-header/Header.d.ts +1 -1
- package/types/layout-reducer/layoutTypes.d.ts +1 -1
- package/types/layout-view/index.d.ts +2 -4
- package/types/layout-view/useView.d.ts +2 -2
- package/types/{layout-view → layout-view-actions}/ViewContext.d.ts +1 -1
- package/types/layout-view-actions/index.d.ts +2 -0
- package/LICENSE +0 -201
- package/README.md +0 -1
- package/index.css +0 -2
- package/index.css.map +0 -7
- /package/types/{layout-view → layout-view-actions}/useViewActionDispatcher.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-layout-element.js","sources":["../../src/layout-reducer/wrap-layout-element.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { rectTuple, uuid } from \"@vuu-ui/vuu-utils\";\nimport React, { ReactElement } from \"react\";\nimport { DropPos } from \"../drag-drop/dragDropTypes\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\nimport { ComponentRegistry } from \"../registry/ComponentRegistry\";\nimport { getProp, getProps, nextStep, resetPath, typeOf } from \"../utils\";\nimport {\n createFlexbox,\n createPlaceHolder,\n flexDirection,\n getFlexStyle,\n getIntrinsicSize,\n wrapIntrinsicSizeComponentWithFlexbox,\n} from \"./flexUtils\";\nimport { LayoutModel } from \"./layoutTypes\";\nimport { applyLayoutProps, LayoutProps } from \"./layoutUtils\";\n\nexport interface LayoutSpec {\n type: \"Stack\" | \"Flexbox\";\n flexDirection: \"column\" | \"row\";\n showTabs?: boolean;\n}\n\nconst isHtmlElement = (component: LayoutModel) => {\n const [firstLetter] = typeOf(component) as string;\n return firstLetter === firstLetter.toLowerCase();\n};\n\nexport function wrap(\n container: ReactElement,\n existingComponent: ReactElement,\n newComponent: any,\n pos: DropPos,\n clientRect?: DropTarget[\"clientRect\"],\n dropRect?: DropTarget[\"dropRect\"]\n): ReactElement {\n const { children: containerChildren, path: containerPath } =\n getProps(container);\n\n const existingComponentPath = getProp(existingComponent, \"path\");\n const { idx, finalStep } = nextStep(containerPath, existingComponentPath);\n const children = finalStep\n ? updateChildren(\n container,\n containerChildren,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n )\n : containerChildren.map((child: ReactElement, index: number) =>\n index === idx\n ? wrap(\n child,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n )\n : child\n );\n\n return React.cloneElement(container, undefined, children);\n}\n\nfunction updateChildren(\n container: LayoutModel,\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos,\n clientRect?: DropTarget[\"clientRect\"],\n dropRect?: rectTuple\n) {\n const intrinsicSize = getIntrinsicSize(newComponent);\n\n if (intrinsicSize?.width && intrinsicSize?.height) {\n if (clientRect === undefined || dropRect === undefined) {\n throw Error(\n \"wrap-layout-element, updateChildren clientRect and dropRect must both be available\"\n );\n }\n return wrapIntrinsicSizedComponent(\n containerChildren,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n );\n }\n return wrapFlexComponent(\n container,\n containerChildren,\n existingComponent,\n newComponent,\n pos\n );\n}\n\nfunction wrapFlexComponent(\n container: LayoutModel,\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos\n) {\n const { version = 0 } = getProps(newComponent);\n const { path: existingComponentPath, title } = getProps(existingComponent);\n const {\n type,\n flexDirection,\n showTabs: showTabsProp,\n } = getLayoutSpecForWrapper(pos);\n const [style, existingComponentStyle, newComponentStyle] =\n getWrappedFlexStyles(\n type,\n existingComponent,\n newComponent,\n flexDirection,\n pos\n );\n const targetFirst = isTargetFirst(pos);\n const active = targetFirst ? 1 : 0;\n\n const newComponentProps = {\n resizeable: true,\n style: newComponentStyle,\n version: version + 1,\n };\n const resizeProp = isHtmlElement(existingComponent)\n ? \"data-resizeable\"\n : \"resizeable\";\n\n const existingComponentProps = {\n [resizeProp]: true,\n style: existingComponentStyle,\n };\n\n const showTabs = type === \"Stack\" ? { showTabs: showTabsProp } : undefined;\n const splitterSize =\n type === \"Flexbox\"\n ? {\n splitterSize:\n (typeOf(container) === \"Flexbox\" && container.props.splitterSize) ??\n undefined,\n }\n : undefined;\n\n const id = uuid();\n const wrapper = React.createElement(\n ComponentRegistry[type],\n {\n active,\n id,\n key: id,\n path: getProp(existingComponent, \"path\"),\n flexFill: getProp(existingComponent, \"flexFill\"),\n ...splitterSize,\n ...showTabs,\n style,\n title,\n resizeable: getProp(existingComponent, \"resizeable\"),\n } as LayoutProps,\n targetFirst\n ? [\n resetPath(\n existingComponent,\n `${existingComponentPath}.0`,\n existingComponentProps\n ),\n applyLayoutProps(\n React.cloneElement(newComponent, newComponentProps),\n `${existingComponentPath}.1`\n ),\n ]\n : [\n applyLayoutProps(\n React.cloneElement(newComponent, newComponentProps),\n `${existingComponentPath}.0`\n ),\n resetPath(\n existingComponent,\n `${existingComponentPath}.1`,\n existingComponentProps\n ),\n ]\n );\n return containerChildren.map((child: ReactElement) =>\n child === existingComponent ? wrapper : child\n );\n}\n\nfunction wrapIntrinsicSizedComponent(\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos,\n clientRect: DropTarget[\"clientRect\"],\n dropRect: rectTuple\n) {\n const { flexDirection } = getLayoutSpecForWrapper(pos);\n const contraDirection = flexDirection === \"column\" ? \"row\" : \"column\";\n const targetFirst = isTargetFirst(pos);\n\n const [dropLeft, dropTop, dropRight, dropBottom] = dropRect;\n const [startPlaceholder, endPlaceholder] =\n flexDirection === \"column\"\n ? [dropTop - clientRect.top, clientRect.bottom - dropBottom]\n : [dropLeft - clientRect.left, clientRect.right - dropRight];\n const pathRoot = getProp(existingComponent, \"path\");\n let pathIndex = 0;\n\n const resizeProp = isHtmlElement(existingComponent)\n ? \"data-resizeable\"\n : \"resizeable\";\n\n const wrappedChildren = [];\n if (startPlaceholder) {\n wrappedChildren.push(\n targetFirst\n ? resetPath(existingComponent, `${pathRoot}.${pathIndex++}`, {\n [resizeProp]: true,\n style: { flexBasis: startPlaceholder, flexGrow: 1, flexShrink: 1 },\n })\n : createPlaceHolder(`${pathRoot}.${pathIndex++}`, startPlaceholder, {\n flexGrow: 0,\n flexShrink: 0,\n })\n );\n }\n wrappedChildren.push(\n wrapIntrinsicSizeComponentWithFlexbox(\n newComponent,\n contraDirection,\n `${pathRoot}.${pathIndex++}`,\n clientRect,\n dropRect\n )\n );\n if (endPlaceholder) {\n wrappedChildren.push(\n targetFirst\n ? createPlaceHolder(`${pathRoot}.${pathIndex++}`, 0)\n : resetPath(existingComponent, `${pathRoot}.${pathIndex++}`, {\n [resizeProp]: true,\n style: { flexBasis: 0, flexGrow: 1, flexShrink: 1 },\n })\n );\n }\n\n const wrapper = createFlexbox(\n flexDirection,\n existingComponent.props,\n wrappedChildren,\n pathRoot\n );\n return containerChildren.map((child) =>\n child === existingComponent ? wrapper : child\n );\n}\n\nfunction getWrappedFlexStyles(\n type: string,\n existingComponent: ReactElement,\n newComponent: ReactElement,\n flexDirection: flexDirection,\n pos: DropPos\n) {\n const style = {\n ...existingComponent.props.style,\n flexDirection,\n };\n\n const dimension =\n type === \"Flexbox\" && flexDirection === \"column\" ? \"height\" : \"width\";\n const newComponentStyle = getFlexStyle(newComponent, dimension, pos);\n const existingComponentStyle = getFlexStyle(existingComponent, dimension);\n\n return [style, existingComponentStyle, newComponentStyle];\n}\n\nconst isTargetFirst = (pos: DropPos) =>\n pos.position.SouthOrEast\n ? true\n : pos?.tab?.positionRelativeToTab === \"before\"\n ? false\n : pos.position.Header\n ? true\n : false;\n\nfunction getLayoutSpecForWrapper(pos: DropPos): LayoutSpec {\n if (pos.position.Header) {\n return {\n type: \"Stack\",\n flexDirection: \"column\",\n showTabs: true,\n };\n } else {\n return {\n type: \"Flexbox\",\n flexDirection: pos.position.EastOrWest ? \"row\" : \"column\",\n };\n }\n}\n"],"names":["typeOf","getProps","getProp","nextStep","getIntrinsicSize","flexDirection","uuid","ComponentRegistry","resetPath","applyLayoutProps","createPlaceHolder","wrapIntrinsicSizeComponentWithFlexbox","createFlexbox","getFlexStyle"],"mappings":";;;;;;;;;;;AAwBA,MAAM,aAAA,GAAgB,CAAC,SAA2B,KAAA;AAChD,EAAA,MAAM,CAAC,WAAW,CAAI,GAAAA,aAAA,CAAO,SAAS,CAAA,CAAA;AACtC,EAAO,OAAA,WAAA,KAAgB,YAAY,WAAY,EAAA,CAAA;AACjD,CAAA,CAAA;AAEO,SAAS,KACd,SACA,EAAA,iBAAA,EACA,YACA,EAAA,GAAA,EACA,YACA,QACc,EAAA;AACd,EAAA,MAAM,EAAE,QAAU,EAAA,iBAAA,EAAmB,MAAM,aAAc,EAAA,GACvDC,mBAAS,SAAS,CAAA,CAAA;AAEpB,EAAM,MAAA,qBAAA,GAAwBC,iBAAQ,CAAA,iBAAA,EAAmB,MAAM,CAAA,CAAA;AAC/D,EAAA,MAAM,EAAE,GAAK,EAAA,SAAA,EAAc,GAAAC,kBAAA,CAAS,eAAe,qBAAqB,CAAA,CAAA;AACxE,EAAA,MAAM,WAAW,SACb,GAAA,cAAA;AAAA,IACE,SAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,YAAA;AAAA,IACA,GAAA;AAAA,IACA,UAAA;AAAA,IACA,QAAA;AAAA,MAEF,iBAAkB,CAAA,GAAA;AAAA,IAAI,CAAC,KAAA,EAA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AA,iBAAA,EAAmB,SAAS,CAAA,CAAA;AAExE,EAAO,OAAA,CAAC,KAAO,EAAA,sBAAA,EAAwB,iBAAiB,CAAA,CAAA;AAC1D,CAAA;AAEA,MAAM,aAAgB,GAAA,CAAC,GACrB,KAAA,GAAA,CAAI,SAAS,WACT,GAAA,IAAA,GACA,GAAK,EAAA,GAAA,EAAK,0BAA0B,QACpC,GAAA,KAAA,GACA,GAAI,CAAA,QAAA,CAAS,SACb,IACA,GAAA,KAAA,CAAA;AAEN,SAAS,wBAAwB,GAA0B,EAAA;AACzD,EAAI,IAAA,GAAA,CAAI,SAAS,MAAQ,EAAA;AACvB,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,aAAe,EAAA,QAAA;AAAA,MACf,QAAU,EAAA,IAAA;AAAA,KACZ,CAAA;AAAA,GACK,MAAA;AACL,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,SAAA;AAAA,MACN,aAAe,EAAA,GAAA,CAAI,QAAS,CAAA,UAAA,GAAa,KAAQ,GAAA,QAAA;AAAA,KACnD,CAAA;AAAA,GACF;AACF;;;;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.vuuView {
|
|
2
|
+
border-color: var(--vuuView-borderColor, var(--salt-container-primary-borderColor));
|
|
3
|
+
border-width: var(--vuuView-borderWidth, 1px);
|
|
4
|
+
border-style: var(--vuuView-borderStyle, none);
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
margin: var(--vuuView-margin, 0px);
|
|
9
|
+
min-height: 50px;
|
|
10
|
+
min-width: 50px;
|
|
11
|
+
outline: none;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.vuuView.focus-visible:after {
|
|
17
|
+
content: '';
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
border: dotted cornflowerblue 2px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vuuView.dragging {
|
|
27
|
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.vuuView-main {
|
|
31
|
+
/* height: var(--view-content-height);
|
|
32
|
+
width: var(--view-content-width); */
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: var(--vuuView-flexDirection, column);
|
|
35
|
+
flex-wrap: var(--vuuView-flex-wrap, nowrap);
|
|
36
|
+
flex: 1;
|
|
37
|
+
justify-content: var(--vuuView-justify, flex-start);
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
position: relative;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.vuuView-main > * {
|
|
43
|
+
flex-basis: auto;
|
|
44
|
+
flex-grow: var(--vuuView-flex-grow, 1);
|
|
45
|
+
flex-shrink: var(--vuuView-flex-shrink, 1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.vuuView-collapsed .vuuView-main {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.vuuView-collapsed + .Splitter {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.vuuView-collapsed .Toolbar-vertical {
|
|
57
|
+
border-right: solid 1px var(--grey40);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.vuuView-collapsed .Toolbar-vertical .toolbar-title {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var vuuUtils = require('@vuu-ui/vuu-utils');
|
|
5
|
+
var core = require('@salt-ds/core');
|
|
6
|
+
var cx = require('clsx');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var Header = require('../layout-header/Header.js');
|
|
9
|
+
var ComponentRegistry = require('../registry/ComponentRegistry.js');
|
|
10
|
+
var useView = require('./useView.js');
|
|
11
|
+
var useViewResize = require('./useViewResize.js');
|
|
12
|
+
require('../layout-provider/LayoutProviderContext.js');
|
|
13
|
+
require('../drag-drop/Draggable.js');
|
|
14
|
+
require('../drag-drop/BoxModel.js');
|
|
15
|
+
var ViewContext = require('../layout-view-actions/ViewContext.js');
|
|
16
|
+
|
|
17
|
+
const classBase = "vuuView";
|
|
18
|
+
const getProps = (state, props) => {
|
|
19
|
+
if (state && props) {
|
|
20
|
+
return {
|
|
21
|
+
...state,
|
|
22
|
+
...props
|
|
23
|
+
};
|
|
24
|
+
} else
|
|
25
|
+
return state || props;
|
|
26
|
+
};
|
|
27
|
+
const View = React.forwardRef(function View2(props, forwardedRef) {
|
|
28
|
+
const {
|
|
29
|
+
Header: Header$1 = Header.Header,
|
|
30
|
+
children,
|
|
31
|
+
className,
|
|
32
|
+
collapsed,
|
|
33
|
+
closeable,
|
|
34
|
+
"data-path": dataPath,
|
|
35
|
+
"data-resizeable": dataResizeable,
|
|
36
|
+
dropTargets,
|
|
37
|
+
expanded,
|
|
38
|
+
flexFill,
|
|
39
|
+
id: idProp,
|
|
40
|
+
header,
|
|
41
|
+
orientation = "horizontal",
|
|
42
|
+
path = dataPath,
|
|
43
|
+
resize = "responsive",
|
|
44
|
+
resizeable = dataResizeable,
|
|
45
|
+
tearOut,
|
|
46
|
+
style = {},
|
|
47
|
+
title: titleProp,
|
|
48
|
+
...restProps
|
|
49
|
+
} = props;
|
|
50
|
+
const id = vuuUtils.useId(idProp);
|
|
51
|
+
const rootRef = React.useRef(null);
|
|
52
|
+
const mainRef = React.useRef(null);
|
|
53
|
+
const [componentProps, _setComponentProps] = React.useState();
|
|
54
|
+
const {
|
|
55
|
+
contributions,
|
|
56
|
+
dispatchViewAction,
|
|
57
|
+
load,
|
|
58
|
+
loadSession,
|
|
59
|
+
onConfigChange,
|
|
60
|
+
onEditTitle,
|
|
61
|
+
purge,
|
|
62
|
+
restoredState,
|
|
63
|
+
save,
|
|
64
|
+
saveSession,
|
|
65
|
+
title
|
|
66
|
+
} = useView.useView({
|
|
67
|
+
id,
|
|
68
|
+
rootRef,
|
|
69
|
+
path,
|
|
70
|
+
dropTargets,
|
|
71
|
+
title: titleProp
|
|
72
|
+
});
|
|
73
|
+
useViewResize.useViewResize({ mainRef, resize, rootRef });
|
|
74
|
+
const setComponentProps = React.useCallback((props2) => {
|
|
75
|
+
_setComponentProps(props2);
|
|
76
|
+
}, []);
|
|
77
|
+
const getContent = () => {
|
|
78
|
+
if (React.isValidElement(children) && (restoredState || componentProps)) {
|
|
79
|
+
return React.cloneElement(
|
|
80
|
+
children,
|
|
81
|
+
getProps(restoredState, componentProps)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return children;
|
|
85
|
+
};
|
|
86
|
+
const viewContextValue = React.useMemo(
|
|
87
|
+
() => ({
|
|
88
|
+
dispatch: dispatchViewAction,
|
|
89
|
+
id,
|
|
90
|
+
path,
|
|
91
|
+
title,
|
|
92
|
+
load,
|
|
93
|
+
loadSession,
|
|
94
|
+
onConfigChange,
|
|
95
|
+
purge,
|
|
96
|
+
save,
|
|
97
|
+
saveSession,
|
|
98
|
+
setComponentProps
|
|
99
|
+
}),
|
|
100
|
+
[
|
|
101
|
+
dispatchViewAction,
|
|
102
|
+
id,
|
|
103
|
+
load,
|
|
104
|
+
loadSession,
|
|
105
|
+
onConfigChange,
|
|
106
|
+
path,
|
|
107
|
+
purge,
|
|
108
|
+
save,
|
|
109
|
+
saveSession,
|
|
110
|
+
setComponentProps,
|
|
111
|
+
title
|
|
112
|
+
]
|
|
113
|
+
);
|
|
114
|
+
const headerProps = typeof header === "object" ? header : {};
|
|
115
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
...restProps,
|
|
119
|
+
className: cx(classBase, className, {
|
|
120
|
+
[`${classBase}-collapsed`]: collapsed,
|
|
121
|
+
[`${classBase}-expanded`]: expanded,
|
|
122
|
+
[`${classBase}-resize-defer`]: resize === "defer"
|
|
123
|
+
}),
|
|
124
|
+
"data-resizeable": resizeable,
|
|
125
|
+
id,
|
|
126
|
+
ref: core.useForkRef(forwardedRef, rootRef),
|
|
127
|
+
style,
|
|
128
|
+
tabIndex: -1,
|
|
129
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ViewContext.ViewContext.Provider, { value: viewContextValue, children: [
|
|
130
|
+
header ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
+
Header$1,
|
|
132
|
+
{
|
|
133
|
+
...headerProps,
|
|
134
|
+
collapsed,
|
|
135
|
+
contributions,
|
|
136
|
+
expanded,
|
|
137
|
+
closeable,
|
|
138
|
+
onEditTitle,
|
|
139
|
+
orientation,
|
|
140
|
+
tearOut,
|
|
141
|
+
title
|
|
142
|
+
}
|
|
143
|
+
) : null,
|
|
144
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase}-main`, ref: mainRef, children: getContent() })
|
|
145
|
+
] })
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
View.displayName = "View";
|
|
150
|
+
const MemoView = React.memo(View);
|
|
151
|
+
MemoView.displayName = "View";
|
|
152
|
+
ComponentRegistry.registerComponent("View", MemoView, "view");
|
|
153
|
+
|
|
154
|
+
exports.View = MemoView;
|
|
155
|
+
//# sourceMappingURL=View.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"View.js","sources":["../../src/layout-view/View.tsx"],"sourcesContent":["import { useId } from \"@vuu-ui/vuu-utils\";\nimport { useForkRef } from \"@salt-ds/core\";\nimport cx from \"clsx\";\nimport React, {\n ForwardedRef,\n forwardRef,\n ReactElement,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Header as VuuHeader } from \"../layout-header/Header\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\nimport { useView } from \"./useView\";\nimport { useViewResize } from \"./useViewResize\";\nimport { ViewContext, ViewContextAPI } from \"../layout-view-actions\";\nimport { ViewProps } from \"./viewTypes\";\n\nimport \"./View.css\";\n\nconst classBase = \"vuuView\";\n\ntype Props = { [key: string]: unknown };\n\nconst getProps = (state?: Props, props?: Props) => {\n if (state && props) {\n return {\n ...state,\n ...props,\n };\n } else return state || props;\n};\n\n/**\n * View is the leaf-level entity managed by the Vuu layout system. It may represent a component\n * or a group of components. It also offers an API (via useViewContext) for persistence.\n */\nconst View = forwardRef(function View(\n props: ViewProps,\n forwardedRef: ForwardedRef<HTMLDivElement>\n) {\n const {\n Header = VuuHeader,\n children,\n className,\n collapsed,\n closeable,\n \"data-path\": dataPath,\n \"data-resizeable\": dataResizeable,\n dropTargets,\n expanded,\n flexFill,\n id: idProp,\n header,\n orientation = \"horizontal\",\n path = dataPath,\n resize = \"responsive\",\n resizeable = dataResizeable,\n tearOut,\n style = {},\n title: titleProp,\n ...restProps\n } = props;\n\n const id = useId(idProp);\n const rootRef = useRef<HTMLDivElement>(null);\n const mainRef = useRef<HTMLDivElement>(null);\n const [componentProps, _setComponentProps] = useState<Props>();\n const {\n contributions,\n dispatchViewAction,\n load,\n loadSession,\n onConfigChange,\n onEditTitle,\n purge,\n restoredState,\n save,\n saveSession,\n title,\n } = useView({\n id,\n rootRef,\n path,\n dropTargets,\n title: titleProp,\n });\n\n useViewResize({ mainRef, resize, rootRef });\n\n const setComponentProps = useCallback((props?: Props) => {\n _setComponentProps(props);\n }, []);\n\n const getContent = () => {\n if (React.isValidElement(children) && (restoredState || componentProps)) {\n return React.cloneElement(\n children,\n getProps(restoredState, componentProps)\n );\n }\n return children;\n };\n\n const viewContextValue: ViewContextAPI = useMemo(\n () => ({\n dispatch: dispatchViewAction,\n id,\n path,\n title,\n load,\n loadSession,\n onConfigChange,\n purge,\n save,\n saveSession,\n setComponentProps,\n }),\n [\n dispatchViewAction,\n id,\n load,\n loadSession,\n onConfigChange,\n path,\n purge,\n save,\n saveSession,\n setComponentProps,\n title,\n ]\n );\n\n const headerProps = typeof header === \"object\" ? header : {};\n\n return (\n <div\n {...restProps}\n className={cx(classBase, className, {\n [`${classBase}-collapsed`]: collapsed,\n [`${classBase}-expanded`]: expanded,\n [`${classBase}-resize-defer`]: resize === \"defer\",\n })}\n data-resizeable={resizeable}\n id={id}\n ref={useForkRef(forwardedRef, rootRef)}\n style={style}\n tabIndex={-1}\n >\n <ViewContext.Provider value={viewContextValue}>\n {header ? (\n <Header\n {...headerProps}\n collapsed={collapsed}\n contributions={contributions}\n expanded={expanded}\n closeable={closeable}\n onEditTitle={onEditTitle}\n orientation={orientation}\n tearOut={tearOut}\n title={title}\n />\n ) : null}\n <div className={`${classBase}-main`} ref={mainRef}>\n {getContent()}\n </div>\n </ViewContext.Provider>\n </div>\n );\n});\nView.displayName = \"View\";\n\ninterface ViewComponentType {\n (\n props: ViewProps & {\n ref?: ForwardedRef<HTMLDivElement>;\n }\n ): ReactElement<ViewProps>;\n displayName?: string;\n}\n\nconst MemoView = React.memo(View) as ViewComponentType;\n\nMemoView.displayName = \"View\";\n\nregisterComponent(\"View\", MemoView, \"view\");\n\nexport { MemoView as View };\n"],"names":["forwardRef","View","Header","VuuHeader","useId","useRef","useState","useView","useViewResize","useCallback","props","useMemo","jsx","useForkRef","jsxs","ViewContext","registerComponent"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAM,SAAY,GAAA,SAAA,CAAA;AAIlB,MAAM,QAAA,GAAW,CAAC,KAAA,EAAe,KAAkB,KAAA;AACjD,EAAA,IAAI,SAAS,KAAO,EAAA;AAClB,IAAO,OAAA;AAAA,MACL,GAAG,KAAA;AAAA,MACH,GAAG,KAAA;AAAA,KACL,CAAA;AAAA,GACF;AAAO,IAAA,OAAO,KAAS,IAAA,KAAA,CAAA;AACzB,CAAA,CAAA;AAMA,MAAM,IAAO,GAAAA,gBAAA,CAAW,SAASC,KAAAA,CAC/B,OACA,YACA,EAAA;AACA,EAAM,M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,QAAA;AAAA,QAC3B,CAAC,CAAA,EAAG,SAAS,CAAA,aAAA,CAAe,GAAG,MAAW,KAAA,OAAA;AAAA,OAC3C,CAAA;AAAA,MACD,iBAAiB,EAAA,UAAA;AAAA,MACjB,EAAA;AAAA,MACA,GAAA,EAAKC,eAAW,CAAA,YAAA,EAAc,OAAO,CAAA;AAAA,MACrC,KAAA;AAAA,MACA,QAAU,EAAA,CAAA,CAAA;AAAA,MAEV,QAAC,kBAAAC,eAAA,CAAAC,uBAAA,CAAY,QAAZ,EAAA,EAAqB,OAAO,gBAC1B,EAAA,QAAA,EAAA;AAAA,QACC,MAAA,mBAAAH,cAAA;AAAA,UAACV,QAAA;AAAA,UAAA;AAAA,YACE,GAAG,WAAA;AAAA,YACJ,SAAA;AAAA,YACA,aAAA;AAAA,YACA,QAAA;AAAA,YACA,SAAA;AAAA,YACA,WAAA;AAAA,YACA,WAAA;AAAA,YACA,OAAA;AAAA,YACA,KAAA;AAAA,WAAA;AAAA,SAEA,GAAA,IAAA;AAAA,wBACJU,cAAA,CAAC,SAAI,SAAW,EAAA,CAAA,EAAG,SAAS,CAAS,KAAA,CAAA,EAAA,GAAA,EAAK,OACvC,EAAA,QAAA,EAAA,UAAA,EACH,EAAA,CAAA;AAAA,OACF,EAAA,CAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ,CAAC,CAAA,CAAA;AACD,IAAA,CAAK,WAAc,GAAA,MAAA,CAAA;AAWb,MAAA,QAAA,GAAW,KAAM,CAAA,IAAA,CAAK,IAAI,EAAA;AAEhC,QAAA,CAAS,WAAc,GAAA,MAAA,CAAA;AAEvBI,mCAAkB,CAAA,MAAA,EAAQ,UAAU,MAAM,CAAA;;;;"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var LayoutProvider = require('../layout-provider/LayoutProvider.js');
|
|
5
|
+
require('../layout-provider/LayoutProviderContext.js');
|
|
6
|
+
var usePersistentState = require('../use-persistent-state.js');
|
|
7
|
+
var useViewActionDispatcher = require('../layout-view-actions/useViewActionDispatcher.js');
|
|
8
|
+
|
|
9
|
+
const useView = ({
|
|
10
|
+
id,
|
|
11
|
+
rootRef,
|
|
12
|
+
path,
|
|
13
|
+
dropTargets,
|
|
14
|
+
title: titleProp
|
|
15
|
+
}) => {
|
|
16
|
+
const layoutDispatch = LayoutProvider.useLayoutProviderDispatch();
|
|
17
|
+
const {
|
|
18
|
+
loadState,
|
|
19
|
+
loadSessionState,
|
|
20
|
+
purgeState,
|
|
21
|
+
saveState,
|
|
22
|
+
saveSessionState
|
|
23
|
+
} = usePersistentState.usePersistentState();
|
|
24
|
+
const [dispatchViewAction, contributions] = useViewActionDispatcher.useViewActionDispatcher(
|
|
25
|
+
id,
|
|
26
|
+
rootRef,
|
|
27
|
+
path,
|
|
28
|
+
dropTargets
|
|
29
|
+
);
|
|
30
|
+
const title = React.useMemo(
|
|
31
|
+
() => loadState("view-title") ?? titleProp,
|
|
32
|
+
[loadState, titleProp]
|
|
33
|
+
);
|
|
34
|
+
const onEditTitle = React.useCallback(
|
|
35
|
+
(title2) => {
|
|
36
|
+
if (path) {
|
|
37
|
+
layoutDispatch({ type: "set-title", path, title: title2 });
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[layoutDispatch, path]
|
|
41
|
+
);
|
|
42
|
+
const restoredState = React.useMemo(() => loadState(id), [id, loadState]);
|
|
43
|
+
const load = React.useCallback(
|
|
44
|
+
(key) => loadState(id, key),
|
|
45
|
+
[id, loadState]
|
|
46
|
+
);
|
|
47
|
+
const purge = React.useCallback(
|
|
48
|
+
(key) => {
|
|
49
|
+
purgeState(id, key);
|
|
50
|
+
layoutDispatch({ type: "save" });
|
|
51
|
+
},
|
|
52
|
+
[id, layoutDispatch, purgeState]
|
|
53
|
+
);
|
|
54
|
+
const save = React.useCallback(
|
|
55
|
+
(state, key) => {
|
|
56
|
+
saveState(id, key, state);
|
|
57
|
+
layoutDispatch({ type: "save" });
|
|
58
|
+
},
|
|
59
|
+
[id, layoutDispatch, saveState]
|
|
60
|
+
);
|
|
61
|
+
const loadSession = React.useCallback(
|
|
62
|
+
(key) => loadSessionState(id, key),
|
|
63
|
+
[id, loadSessionState]
|
|
64
|
+
);
|
|
65
|
+
const saveSession = React.useCallback(
|
|
66
|
+
(state, key) => saveSessionState(id, key, state),
|
|
67
|
+
[id, saveSessionState]
|
|
68
|
+
);
|
|
69
|
+
const onConfigChange = React.useCallback(
|
|
70
|
+
({ type: key, ...config }) => {
|
|
71
|
+
const { [key]: data } = config;
|
|
72
|
+
save(data, key);
|
|
73
|
+
},
|
|
74
|
+
[save]
|
|
75
|
+
);
|
|
76
|
+
return {
|
|
77
|
+
contributions,
|
|
78
|
+
dispatchViewAction,
|
|
79
|
+
load,
|
|
80
|
+
loadSession,
|
|
81
|
+
onConfigChange,
|
|
82
|
+
onEditTitle,
|
|
83
|
+
purge,
|
|
84
|
+
restoredState,
|
|
85
|
+
save,
|
|
86
|
+
saveSession,
|
|
87
|
+
title
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
exports.useView = useView;
|
|
92
|
+
//# sourceMappingURL=useView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useView.js","sources":["../../src/layout-view/useView.tsx"],"sourcesContent":["import { RefObject, useCallback, useMemo } from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { usePersistentState } from \"../use-persistent-state\";\nimport { useViewActionDispatcher } from \"../layout-view-actions/useViewActionDispatcher\";\n\nexport interface ViewHookProps {\n id: string;\n rootRef: RefObject<HTMLDivElement>;\n path?: string;\n dropTargets?: string[];\n title?: string;\n}\n\nexport const useView = ({\n id,\n rootRef,\n path,\n dropTargets,\n title: titleProp,\n}: ViewHookProps) => {\n const layoutDispatch = useLayoutProviderDispatch();\n\n const {\n loadState,\n loadSessionState,\n purgeState,\n saveState,\n saveSessionState,\n } = usePersistentState();\n\n const [dispatchViewAction, contributions] = useViewActionDispatcher(\n id,\n rootRef,\n path,\n dropTargets\n );\n\n const title = useMemo(\n () => loadState(\"view-title\") ?? titleProp,\n [loadState, titleProp]\n );\n\n const onEditTitle = useCallback(\n (title: string) => {\n if (path) {\n layoutDispatch({ type: \"set-title\", path, title });\n }\n },\n [layoutDispatch, path]\n );\n\n const restoredState = useMemo(() => loadState(id), [id, loadState]);\n\n const load = useCallback(\n (key?: string) => loadState(id, key),\n [id, loadState]\n );\n\n const purge = useCallback(\n (key) => {\n purgeState(id, key);\n layoutDispatch({ type: \"save\" });\n },\n [id, layoutDispatch, purgeState]\n );\n\n const save = useCallback(\n (state, key) => {\n saveState(id, key, state);\n layoutDispatch({ type: \"save\" });\n },\n [id, layoutDispatch, saveState]\n );\n const loadSession = useCallback(\n (key?: string) => loadSessionState(id, key),\n [id, loadSessionState]\n );\n const saveSession = useCallback(\n (state, key) => saveSessionState(id, key, state),\n [id, saveSessionState]\n );\n\n const onConfigChange = useCallback(\n ({ type: key, ...config }) => {\n const { [key]: data } = config;\n save(data, key);\n },\n [save]\n );\n\n return {\n contributions,\n dispatchViewAction,\n load,\n loadSession,\n onConfigChange,\n onEditTitle,\n purge,\n restoredState,\n save,\n saveSession,\n title,\n };\n};\n"],"names":["useLayoutProviderDispatch","usePersistentState","useViewActionDispatcher","useMemo","useCallback","title"],"mappings":";;;;;;;;AAaO,MAAM,UAAU,CAAC;AAAA,EACtB,EAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAO,EAAA,SAAA;AACT,CAAqB,KAAA;AACnB,EAAA,MAAM,iBAAiBA,wCAA0B,EAAA,CAAA;AAEjD,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,gBAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,gBAAA;AAAA,MACEC,qCAAmB,EAAA,CAAA;AAEvB,EAAM,MAAA,CAAC,kBAAoB,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cAAA,CAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,CAAA,CAAA;AAAA,KACjC;AAAA,IACA,CAAC,EAAI,EAAA,cAAA,EAAgB,SAAS,CAAA;AAAA,GAChC,CAAA;AACA,EAAA,MAAM,WAAc,GAAAA,iBAAA;AAAA,IAClB,CAAC,GAAA,KAAiB,gBAAiB,CAAA,EAAA,EAAI,GAAG,CAAA;AAAA,IAC1C,CAAC,IAAI,gBAAgB,CAAA;AAAA,GACvB,CAAA;AACA,EAAA,MAAM,WAAc,GAAAA,iBAAA;AAAA,IAClB,CAAC,KAAO,EAAA,GAAA,KAAQ,gBAAiB,CAAA,EAAA,EAAI,KAAK,KAAK,CAAA;AAAA,IAC/C,CAAC,IAAI,gBAAgB,CAAA;AAAA,GACvB,CAAA;AAEA,EAAA,MAAM,cAAiB,GAAAA,iBAAA;AAAA,IACrB,CAAC,EAAE,IAAA,EAAM,GAAK,EAAA,GAAG,QAAa,KAAA;AAC5B,MAAA,MAAM,EAAE,CAAC,GAAG,GAAG,MAAS,GAAA,MAAA,CAAA;AACxB,MAAA,IAAA,CAAK,MAAM,GAAG,CAAA,CAAA;AAAA,KAChB;AAAA,IACA,CAAC,IAAI,CAAA;AAAA,GACP,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,aAAA;AAAA,IACA,kBAAA;AAAA,IACA,IAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,aAAA;AAAA,IACA,IAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var useResizeObserver = require('../responsive/useResizeObserver.js');
|
|
5
|
+
|
|
6
|
+
const NO_MEASUREMENT = [];
|
|
7
|
+
const useViewResize = ({
|
|
8
|
+
mainRef,
|
|
9
|
+
resize = "responsive",
|
|
10
|
+
rootRef
|
|
11
|
+
}) => {
|
|
12
|
+
const deferResize = resize === "defer";
|
|
13
|
+
const mainSize = React.useRef({});
|
|
14
|
+
const resizeHandle = React.useRef();
|
|
15
|
+
const setMainSize = React.useCallback(() => {
|
|
16
|
+
if (mainRef.current) {
|
|
17
|
+
mainRef.current.style.height = mainSize.current.height + "px";
|
|
18
|
+
mainRef.current.style.width = mainSize.current.width + "px";
|
|
19
|
+
}
|
|
20
|
+
resizeHandle.current = void 0;
|
|
21
|
+
}, [mainRef]);
|
|
22
|
+
const onResize = React.useCallback(
|
|
23
|
+
({ height, width }) => {
|
|
24
|
+
mainSize.current.height = height;
|
|
25
|
+
mainSize.current.width = width;
|
|
26
|
+
if (resizeHandle.current !== null) {
|
|
27
|
+
clearTimeout(resizeHandle.current);
|
|
28
|
+
}
|
|
29
|
+
resizeHandle.current = window.setTimeout(setMainSize, 40);
|
|
30
|
+
},
|
|
31
|
+
[setMainSize]
|
|
32
|
+
);
|
|
33
|
+
useResizeObserver.useResizeObserver(
|
|
34
|
+
rootRef,
|
|
35
|
+
deferResize ? useResizeObserver.WidthHeight : NO_MEASUREMENT,
|
|
36
|
+
onResize,
|
|
37
|
+
deferResize
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.useViewResize = useViewResize;
|
|
42
|
+
//# sourceMappingURL=useViewResize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useViewResize.js","sources":["../../src/layout-view/useViewResize.ts"],"sourcesContent":["import { useResizeObserver, WidthHeight } from \"../responsive\";\nimport { RefObject, useCallback, useRef } from \"react\";\n\nconst NO_MEASUREMENT: string[] = [];\n\ntype size = {\n height?: number;\n width?: number;\n};\n\nexport interface ViewResizeHookProps {\n mainRef: RefObject<HTMLDivElement>;\n resize?: \"defer\" | \"responsive\";\n rootRef: RefObject<HTMLDivElement>;\n}\n\nexport const useViewResize = ({\n mainRef,\n resize = \"responsive\",\n rootRef,\n}: ViewResizeHookProps) => {\n const deferResize = resize === \"defer\";\n\n const mainSize = useRef<size>({});\n const resizeHandle = useRef<number>();\n\n const setMainSize = useCallback(() => {\n if (mainRef.current) {\n mainRef.current.style.height = mainSize.current.height + \"px\";\n mainRef.current.style.width = mainSize.current.width + \"px\";\n }\n resizeHandle.current = undefined;\n }, [mainRef]);\n\n const onResize = useCallback(\n ({ height, width }) => {\n mainSize.current.height = height;\n mainSize.current.width = width;\n if (resizeHandle.current !== null) {\n clearTimeout(resizeHandle.current);\n }\n resizeHandle.current = window.setTimeout(setMainSize, 40);\n },\n [setMainSize]\n );\n\n useResizeObserver(\n rootRef,\n deferResize ? WidthHeight : NO_MEASUREMENT,\n onResize,\n deferResize\n );\n};\n"],"names":["useRef","useCallback","useResizeObserver","WidthHeight"],"mappings":";;;;;AAGA,MAAM,iBAA2B,EAAC,CAAA;AAa3B,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA,MAAS,GAAA,YAAA;AAAA,EACT,OAAA;AACF,CAA2B,KAAA;AACzB,EAAA,MAAM,cAAc,MAAW,KAAA,OAAA,CAAA;AAE/B,EAAM,MAAA,QAAA,GAAWA,YAAa,CAAA,EAAE,CAAA,CAAA;AAChC,EAAA,MAAM,eAAeA,YAAe,EAAA,CAAA;AAEpC,EAAM,MAAA,WAAA,GAAcC,kBAAY,MAAM;AACpC,IAAA,IAAI,QAAQ,OAAS,EAAA;AACnB,MAAA,OAAA,CAAQ,OAAQ,CAAA,KAAA,CAAM,MAAS,GAAA,QAAA,CAAS,QAAQ,MAAS,GAAA,IAAA,CAAA;AACzD,MAAA,OAAA,CAAQ,OAAQ,CAAA,KAAA,CAAM,KAAQ,GAAA,QAAA,CAAS,QAAQ,KAAQ,GAAA,IAAA,CAAA;AAAA,KACzD;AACA,IAAA,YAAA,CAAa,OAAU,GAAA,KAAA,CAAA,CAAA;AAAA,GACzB,EAAG,CAAC,OAAO,CAAC,CAAA,CAAA;AAEZ,EAAA,MAAM,QAAW,GAAAA,iBAAA;AAAA,IACf,CAAC,EAAE,MAAQ,EAAA,KAAA,EAAY,KAAA;AACrB,MAAA,QAAA,CAAS,QAAQ,MAAS,GAAA,MAAA,CAAA;AAC1B,MAAA,QAAA,CAAS,QAAQ,KAAQ,GAAA,KAAA,CAAA;AACzB,MAAI,IAAA,YAAA,CAAa,YAAY,IAAM,EAAA;AACjC,QAAA,YAAA,CAAa,aAAa,OAAO,CAAA,CAAA;AAAA,OACnC;AACA,MAAA,YAAA,CAAa,OAAU,GAAA,MAAA,CAAO,UAAW,CAAA,WAAA,EAAa,EAAE,CAAA,CAAA;AAAA,KAC1D;AAAA,IACA,CAAC,WAAW,CAAA;AAAA,GACd,CAAA;AAEA,EAAAC,mCAAA;AAAA,IACE,OAAA;AAAA,IACA,cAAcC,6BAAc,GAAA,cAAA;AAAA,IAC5B,QAAA;AAAA,IACA,WAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const NO_CONTEXT = { dispatch: null };
|
|
6
|
+
const ViewContext = React.createContext(NO_CONTEXT);
|
|
7
|
+
const useViewDispatch = () => {
|
|
8
|
+
const context = React.useContext(ViewContext);
|
|
9
|
+
return context?.dispatch ?? null;
|
|
10
|
+
};
|
|
11
|
+
const useViewContext = () => React.useContext(ViewContext);
|
|
12
|
+
|
|
13
|
+
exports.ViewContext = ViewContext;
|
|
14
|
+
exports.useViewContext = useViewContext;
|
|
15
|
+
exports.useViewDispatch = useViewDispatch;
|
|
16
|
+
//# sourceMappingURL=ViewContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewContext.js","sources":["../../src/layout-view-actions/ViewContext.ts"],"sourcesContent":["import React, { SyntheticEvent, useContext } from \"react\";\nimport { ViewAction } from \"../layout-view/viewTypes\";\n\nexport type QueryReponse = { [key: string]: unknown };\n\nexport type ViewDispatch = <Action extends ViewAction = ViewAction>(\n action: Action,\n evt?: SyntheticEvent\n) => Promise<boolean | QueryReponse | void>;\n\n/**\n * This API is available to any Feature hosted within Vuu (as all Features are wrapped\n * with View component). It offers metadata about the View as well as access to the\n * Vuu persistencew API;\n */\nexport interface ViewContextAPI {\n /**\n * dispatcher for View actions. These are a subset of LayoutActions, specifically for\n * View manipulation\n */\n dispatch?: ViewDispatch | null;\n id?: string;\n load?: (key?: string) => unknown;\n loadSession?: (key?: string) => unknown;\n onConfigChange?: (config: unknown) => void;\n path?: string;\n purge?: (key: string) => void;\n save?: (state: unknown, key: string) => void;\n saveSession?: (state: unknown, key: string) => void;\n setComponentProps: (props: { [key: string]: unknown }) => void;\n title?: string;\n}\n\nconst NO_CONTEXT = { dispatch: null } as ViewContextAPI;\nexport const ViewContext = React.createContext<ViewContextAPI>(NO_CONTEXT);\n\nexport const useViewDispatch = () => {\n const context = useContext(ViewContext);\n return context?.dispatch ?? null;\n};\n\nexport const useViewContext = () => useContext(ViewContext);\n"],"names":["useContext"],"mappings":";;;;AAiCA,MAAM,UAAA,GAAa,EAAE,QAAA,EAAU,IAAK,EAAA,CAAA;AACvB,MAAA,WAAA,GAAc,KAAM,CAAA,aAAA,CAA8B,UAAU,EAAA;AAElE,MAAM,kBAAkB,MAAM;AACnC,EAAM,MAAA,OAAA,GAAUA,iBAAW,WAAW,CAAA,CAAA;AACtC,EAAA,OAAO,SAAS,QAAY,IAAA,IAAA,CAAA;AAC9B,EAAA;AAEa,MAAA,cAAA,GAAiB,MAAMA,gBAAA,CAAW,WAAW;;;;;;"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var LayoutProvider = require('../layout-provider/LayoutProvider.js');
|
|
5
|
+
require('../layout-provider/LayoutProviderContext.js');
|
|
6
|
+
var usePersistentState = require('../use-persistent-state.js');
|
|
7
|
+
|
|
8
|
+
const useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
9
|
+
const { loadSessionState, purgeSessionState, purgeState, saveSessionState } = usePersistentState.usePersistentState();
|
|
10
|
+
const [contributions, setContributions] = React.useState(
|
|
11
|
+
loadSessionState(id, "contributions") ?? []
|
|
12
|
+
);
|
|
13
|
+
const dispatchLayoutAction = LayoutProvider.useLayoutProviderDispatch();
|
|
14
|
+
const updateContributions = React.useCallback(
|
|
15
|
+
(location, content) => {
|
|
16
|
+
const updatedContributions = contributions.concat([
|
|
17
|
+
{ location, content }
|
|
18
|
+
]);
|
|
19
|
+
saveSessionState(id, "contributions", updatedContributions);
|
|
20
|
+
setContributions(updatedContributions);
|
|
21
|
+
},
|
|
22
|
+
[contributions, id, saveSessionState]
|
|
23
|
+
);
|
|
24
|
+
const clearContributions = React.useCallback(() => {
|
|
25
|
+
purgeSessionState(id, "contributions");
|
|
26
|
+
setContributions([]);
|
|
27
|
+
}, [id, purgeSessionState]);
|
|
28
|
+
const handleRemove = React.useCallback(() => {
|
|
29
|
+
const ds = loadSessionState(id, "data-source");
|
|
30
|
+
if (ds) {
|
|
31
|
+
ds.unsubscribe();
|
|
32
|
+
}
|
|
33
|
+
purgeSessionState(id);
|
|
34
|
+
purgeState(id);
|
|
35
|
+
dispatchLayoutAction({ type: "remove", path: viewPath });
|
|
36
|
+
}, [
|
|
37
|
+
dispatchLayoutAction,
|
|
38
|
+
id,
|
|
39
|
+
loadSessionState,
|
|
40
|
+
purgeSessionState,
|
|
41
|
+
purgeState,
|
|
42
|
+
viewPath
|
|
43
|
+
]);
|
|
44
|
+
const handleMouseDown = React.useCallback(
|
|
45
|
+
async (evt, index, preDragActivity) => {
|
|
46
|
+
evt.stopPropagation();
|
|
47
|
+
const dragRect = root.current?.getBoundingClientRect();
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
dispatchLayoutAction({
|
|
50
|
+
type: "drag-start",
|
|
51
|
+
evt,
|
|
52
|
+
path: index === void 0 ? viewPath : `${viewPath}.${index}`,
|
|
53
|
+
dragRect,
|
|
54
|
+
preDragActivity,
|
|
55
|
+
dropTargets,
|
|
56
|
+
resolveDragStart: resolve,
|
|
57
|
+
rejectDragStart: reject
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
[root, dispatchLayoutAction, viewPath, dropTargets]
|
|
62
|
+
);
|
|
63
|
+
const dispatchAction = React.useCallback(
|
|
64
|
+
async (action, evt) => {
|
|
65
|
+
const { type } = action;
|
|
66
|
+
switch (type) {
|
|
67
|
+
case "maximize":
|
|
68
|
+
case "minimize":
|
|
69
|
+
case "restore":
|
|
70
|
+
return dispatchLayoutAction({ type, path: action.path ?? viewPath });
|
|
71
|
+
case "remove":
|
|
72
|
+
return handleRemove();
|
|
73
|
+
case "mousedown":
|
|
74
|
+
return handleMouseDown(evt, action.index, action.preDragActivity);
|
|
75
|
+
case "add-toolbar-contribution":
|
|
76
|
+
return updateContributions(action.location, action.content);
|
|
77
|
+
case "remove-toolbar-contribution":
|
|
78
|
+
return clearContributions();
|
|
79
|
+
case "query":
|
|
80
|
+
return dispatchLayoutAction({
|
|
81
|
+
type,
|
|
82
|
+
path: action.path,
|
|
83
|
+
query: action.query
|
|
84
|
+
});
|
|
85
|
+
default: {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
[
|
|
91
|
+
dispatchLayoutAction,
|
|
92
|
+
viewPath,
|
|
93
|
+
handleRemove,
|
|
94
|
+
handleMouseDown,
|
|
95
|
+
updateContributions,
|
|
96
|
+
clearContributions
|
|
97
|
+
]
|
|
98
|
+
);
|
|
99
|
+
return [dispatchAction, contributions];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
exports.useViewActionDispatcher = useViewActionDispatcher;
|
|
103
|
+
//# sourceMappingURL=useViewActionDispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useViewActionDispatcher.js","sources":["../../src/layout-view-actions/useViewActionDispatcher.ts"],"sourcesContent":["import { DataSource } from \"@vuu-ui/vuu-data-types\";\nimport {\n ReactElement,\n RefObject,\n SyntheticEvent,\n useCallback,\n useState,\n} from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { DragStartAction } from \"../layout-reducer\";\nimport { usePersistentState } from \"../use-persistent-state\";\nimport { QueryReponse, ViewDispatch } from \"./ViewContext\";\nimport { ViewAction } from \"../layout-view/viewTypes\";\n\nexport type ContributionLocation = \"post-title\" | \"pre-title\";\n\nexport type Contribution = {\n index?: number;\n location?: ContributionLocation;\n content: ReactElement;\n};\n\nexport const useViewActionDispatcher = (\n id: string,\n root: RefObject<HTMLDivElement>,\n viewPath?: string,\n dropTargets?: string[]\n): [ViewDispatch, Contribution[] | undefined] => {\n const { loadSessionState, purgeSessionState, purgeState, saveSessionState } =\n usePersistentState();\n\n const [contributions, setContributions] = useState<Contribution[]>(\n loadSessionState(id, \"contributions\") ?? []\n );\n const dispatchLayoutAction = useLayoutProviderDispatch();\n const updateContributions = useCallback(\n (location: ContributionLocation, content: ReactElement) => {\n const updatedContributions = contributions.concat([\n { location, content },\n ]);\n saveSessionState(id, \"contributions\", updatedContributions);\n setContributions(updatedContributions);\n },\n [contributions, id, saveSessionState]\n );\n\n const clearContributions = useCallback(() => {\n purgeSessionState(id, \"contributions\");\n setContributions([]);\n }, [id, purgeSessionState]);\n\n const handleRemove = useCallback(() => {\n const ds = loadSessionState(id, \"data-source\") as DataSource;\n if (ds) {\n ds.unsubscribe();\n }\n purgeSessionState(id);\n purgeState(id);\n dispatchLayoutAction({ type: \"remove\", path: viewPath });\n }, [\n dispatchLayoutAction,\n id,\n loadSessionState,\n purgeSessionState,\n purgeState,\n viewPath,\n ]);\n\n const handleMouseDown = useCallback(\n async (evt, index, preDragActivity): Promise<boolean> => {\n evt.stopPropagation();\n const dragRect = root.current?.getBoundingClientRect();\n return new Promise((resolve, reject) => {\n dispatchLayoutAction({\n type: \"drag-start\",\n evt,\n path: index === undefined ? viewPath : `${viewPath}.${index}`,\n dragRect,\n preDragActivity,\n dropTargets,\n resolveDragStart: resolve,\n rejectDragStart: reject,\n } as DragStartAction);\n });\n },\n [root, dispatchLayoutAction, viewPath, dropTargets]\n );\n\n const dispatchAction = useCallback(\n async <A extends ViewAction = ViewAction>(\n action: A,\n evt?: SyntheticEvent\n ): Promise<boolean | QueryReponse | void> => {\n const { type } = action;\n switch (type) {\n case \"maximize\":\n case \"minimize\":\n case \"restore\":\n return dispatchLayoutAction({ type, path: action.path ?? viewPath });\n case \"remove\":\n return handleRemove();\n case \"mousedown\":\n return handleMouseDown(evt, action.index, action.preDragActivity);\n case \"add-toolbar-contribution\":\n return updateContributions(action.location, action.content);\n case \"remove-toolbar-contribution\":\n return clearContributions();\n case \"query\":\n return dispatchLayoutAction({\n type,\n path: action.path,\n query: action.query,\n });\n return;\n default: {\n return undefined;\n }\n }\n },\n [\n dispatchLayoutAction,\n viewPath,\n handleRemove,\n handleMouseDown,\n updateContributions,\n clearContributions,\n ]\n );\n\n return [dispatchAction, contributions];\n};\n"],"names":["usePersistentState","useState","useLayoutProviderDispatch","useCallback"],"mappings":";;;;;;;AAsBO,MAAM,uBAA0B,GAAA,CACrC,EACA,EAAA,IAAA,EACA,UACA,WAC+C,KAAA;AAC/C,EAAA,MAAM,EAAE,gBAAkB,EAAA,iBAAA,EAAmB,UAAY,EAAA,gBAAA,KACvDA,qCAAmB,EAAA,CAAA;AAErB,EAAM,MAAA,CAAC,aAAe,EAAA,gBAAgB,CAAI,GAAAC,cAAA;AAAA,IACxC,gBAAiB,CAAA,EAAA,EAAI,eAAe,CAAA,IAAK,EAAC;AAAA,GAC5C,CAAA;AACA,EAAA,MAAM,uBAAuBC,wCAA0B,EAAA,CAAA;AACvD,EAAA,MAAM,mBAAsB,GAAAC,iBAAA;AAAA,IAC1B,CAAC,UAAgC,OAA0B,KAAA;AACzD,MAAM,MAAA,oBAAA,GAAuB,cAAc,MAAO,CAA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AO,CAAA,IAAA;AAAA,YACb,OAAO,MAAO,CAAA,KAAA;AAAA,WACf,CAAA,CAAA;AACD,QACF,SAAS;AACP,UAAO,OAAA,KAAA,CAAA,CAAA;AAAA,SACT;AAAA,OACF;AAAA,KACF;AAAA,IACA;AAAA,MACE,oBAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,mBAAA;AAAA,MACA,kBAAA;AAAA,KACF;AAAA,GACF,CAAA;AAEA,EAAO,OAAA,CAAC,gBAAgB,aAAa,CAAA,CAAA;AACvC;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.vuuPalette {
|
|
2
|
+
--vuuList-borderStyle: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.vuuPalette-horizontal {
|
|
6
|
+
align-items: center;
|
|
7
|
+
display: flex;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.vuuPaletteItem {
|
|
11
|
+
--vuu-icon-color: var(--salt-content-primary-foreground);
|
|
12
|
+
--vuu-icon-left: 0;
|
|
13
|
+
--vuu-icon-size: 16px;
|
|
14
|
+
--vuu-icon-top: 11px;
|
|
15
|
+
--list-item-text-padding: 0 0 0 calc(var(--salt-size-unit) * 3);
|
|
16
|
+
border-bottom: solid 1px var(--salt-separable-tertiary-borderColor);
|
|
17
|
+
padding-left: 12px;
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.vuuSimpleDraggableWrapper > .vuuPaletteItem {
|
|
23
|
+
--vuu-icon-color: var(--salt-selectable-foreground);
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.salt-theme .vuuPaletteItem {
|
|
28
|
+
font-size: 11px;
|
|
29
|
+
font-weight: normal;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|