@vuu-ui/vuu-layout 0.0.26
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/LICENSE +201 -0
- package/README.md +1 -0
- package/cjs/Component.js +14 -0
- package/cjs/Component.js.map +1 -0
- package/cjs/DraggableLayout.css.js +6 -0
- package/cjs/DraggableLayout.css.js.map +1 -0
- package/cjs/DraggableLayout.js +33 -0
- package/cjs/DraggableLayout.js.map +1 -0
- package/cjs/dock-layout/DockLayout.css.js +6 -0
- package/cjs/dock-layout/DockLayout.css.js.map +1 -0
- package/cjs/dock-layout/DockLayout.js +36 -0
- package/cjs/dock-layout/DockLayout.js.map +1 -0
- package/cjs/dock-layout/Drawer.css.js +6 -0
- package/cjs/dock-layout/Drawer.css.js.map +1 -0
- package/cjs/dock-layout/Drawer.js +96 -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.js +6 -0
- package/cjs/drag-drop/DropMenu.css.js.map +1 -0
- package/cjs/drag-drop/DropMenu.js +55 -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.js +244 -0
- package/cjs/drag-drop/DropTargetRenderer.js.map +1 -0
- package/cjs/flexbox/Flexbox.css.js +6 -0
- package/cjs/flexbox/Flexbox.css.js.map +1 -0
- package/cjs/flexbox/Flexbox.js +70 -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.js +6 -0
- package/cjs/flexbox/FluidGrid.css.js.map +1 -0
- package/cjs/flexbox/FluidGrid.js +87 -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.js +6 -0
- package/cjs/flexbox/Splitter.css.js.map +1 -0
- package/cjs/flexbox/Splitter.js +122 -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 +133 -0
- package/cjs/index.js.map +1 -0
- package/cjs/layout-action.js +27 -0
- package/cjs/layout-action.js.map +1 -0
- package/cjs/layout-header/Header.css.js +6 -0
- package/cjs/layout-header/Header.css.js.map +1 -0
- package/cjs/layout-header/Header.js +131 -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 +172 -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.js +6 -0
- package/cjs/layout-view/View.css.js.map +1 -0
- package/cjs/layout-view/View.js +164 -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.js +6 -0
- package/cjs/palette/Palette.css.js.map +1 -0
- package/cjs/palette/Palette.js +127 -0
- package/cjs/palette/Palette.js.map +1 -0
- package/cjs/placeholder/LayoutStartPanel.css.js +6 -0
- package/cjs/placeholder/LayoutStartPanel.css.js.map +1 -0
- package/cjs/placeholder/LayoutStartPanel.js +60 -0
- package/cjs/placeholder/LayoutStartPanel.js.map +1 -0
- package/cjs/placeholder/Placeholder.css.js +6 -0
- package/cjs/placeholder/Placeholder.css.js.map +1 -0
- package/cjs/placeholder/Placeholder.js +34 -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.js +6 -0
- package/cjs/stack/Stack.css.js.map +1 -0
- package/cjs/stack/Stack.js +148 -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.js +4 -0
- package/esm/DraggableLayout.css.js.map +1 -0
- package/esm/DraggableLayout.js +31 -0
- package/esm/DraggableLayout.js.map +1 -0
- package/esm/dock-layout/DockLayout.css.js +4 -0
- package/esm/dock-layout/DockLayout.css.js.map +1 -0
- package/esm/dock-layout/DockLayout.js +34 -0
- package/esm/dock-layout/DockLayout.js.map +1 -0
- package/esm/dock-layout/Drawer.css.js +4 -0
- package/esm/dock-layout/Drawer.css.js.map +1 -0
- package/esm/dock-layout/Drawer.js +94 -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.js +4 -0
- package/esm/drag-drop/DropMenu.css.js.map +1 -0
- package/esm/drag-drop/DropMenu.js +52 -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.js +242 -0
- package/esm/drag-drop/DropTargetRenderer.js.map +1 -0
- package/esm/flexbox/Flexbox.css.js +4 -0
- package/esm/flexbox/Flexbox.css.js.map +1 -0
- package/esm/flexbox/Flexbox.js +68 -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.js +4 -0
- package/esm/flexbox/FluidGrid.css.js.map +1 -0
- package/esm/flexbox/FluidGrid.js +85 -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.js +4 -0
- package/esm/flexbox/Splitter.css.js.map +1 -0
- package/esm/flexbox/Splitter.js +120 -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 +37 -0
- package/esm/index.js.map +1 -0
- package/esm/layout-action.js +25 -0
- package/esm/layout-action.js.map +1 -0
- package/esm/layout-header/Header.css.js +4 -0
- package/esm/layout-header/Header.css.js.map +1 -0
- package/esm/layout-header/Header.js +129 -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 +170 -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.js +4 -0
- package/esm/layout-view/View.css.js.map +1 -0
- package/esm/layout-view/View.js +162 -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.js +4 -0
- package/esm/palette/Palette.css.js.map +1 -0
- package/esm/palette/Palette.js +124 -0
- package/esm/palette/Palette.js.map +1 -0
- package/esm/placeholder/LayoutStartPanel.css.js +4 -0
- package/esm/placeholder/LayoutStartPanel.css.js.map +1 -0
- package/esm/placeholder/LayoutStartPanel.js +58 -0
- package/esm/placeholder/LayoutStartPanel.js.map +1 -0
- package/esm/placeholder/Placeholder.css.js +4 -0
- package/esm/placeholder/Placeholder.css.js.map +1 -0
- package/esm/placeholder/Placeholder.js +32 -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.js +4 -0
- package/esm/stack/Stack.css.js.map +1 -0
- package/esm/stack/Stack.js +146 -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 +43 -0
- package/types/Component.d.ts +7 -0
- package/types/DraggableLayout.d.ts +6 -0
- package/types/debug.d.ts +2 -0
- package/types/dock-layout/DockLayout.d.ts +9 -0
- package/types/dock-layout/Drawer.d.ts +17 -0
- package/types/dock-layout/index.d.ts +2 -0
- package/types/drag-drop/BoxModel.d.ts +143 -0
- package/types/drag-drop/DragState.d.ts +46 -0
- package/types/drag-drop/Draggable.d.ts +24 -0
- package/types/drag-drop/DropMenu.d.ts +9 -0
- package/types/drag-drop/DropTarget.d.ts +61 -0
- package/types/drag-drop/DropTargetRenderer.d.ts +17 -0
- package/types/drag-drop/dragDropTypes.d.ts +51 -0
- package/types/drag-drop/index.d.ts +4 -0
- package/types/flexbox/Flexbox.d.ts +4 -0
- package/types/flexbox/FlexboxLayout.d.ts +6 -0
- package/types/flexbox/FluidGrid.d.ts +6 -0
- package/types/flexbox/FluidGridLayout.d.ts +6 -0
- package/types/flexbox/Splitter.d.ts +12 -0
- package/types/flexbox/flexbox-utils.d.ts +12 -0
- package/types/flexbox/flexboxTypes.d.ts +51 -0
- package/types/flexbox/index.d.ts +4 -0
- package/types/flexbox/useResponsiveSizing.d.ts +10 -0
- package/types/flexbox/useSplitterResizing.d.ts +2 -0
- package/types/index.d.ts +18 -0
- package/types/layout-action.d.ts +22 -0
- package/types/layout-header/ActionButton.d.ts +8 -0
- package/types/layout-header/Header.d.ts +12 -0
- package/types/layout-header/index.d.ts +1 -0
- package/types/layout-provider/LayoutProvider.d.ts +15 -0
- package/types/layout-provider/LayoutProviderContext.d.ts +9 -0
- package/types/layout-provider/index.d.ts +2 -0
- package/types/layout-provider/useLayoutDragDrop.d.ts +4 -0
- package/types/layout-reducer/flexUtils.d.ts +22 -0
- package/types/layout-reducer/index.d.ts +4 -0
- package/types/layout-reducer/insert-layout-element.d.ts +8 -0
- package/types/layout-reducer/layout-reducer.d.ts +3 -0
- package/types/layout-reducer/layoutTypes.d.ts +193 -0
- package/types/layout-reducer/layoutUtils.d.ts +38 -0
- package/types/layout-reducer/move-layout-element.d.ts +3 -0
- package/types/layout-reducer/remove-layout-element.d.ts +3 -0
- package/types/layout-reducer/replace-layout-element.d.ts +6 -0
- package/types/layout-reducer/resize-flex-children.d.ts +4 -0
- package/types/layout-reducer/wrap-layout-element.d.ts +9 -0
- package/types/layout-view/View.d.ts +10 -0
- package/types/layout-view/index.d.ts +2 -0
- package/types/layout-view/useView.d.ts +21 -0
- package/types/layout-view/useViewResize.d.ts +7 -0
- package/types/layout-view/viewTypes.d.ts +21 -0
- package/types/layout-view-actions/ViewContext.d.ts +33 -0
- package/types/layout-view-actions/index.d.ts +2 -0
- package/types/layout-view-actions/useViewActionDispatcher.d.ts +9 -0
- package/types/palette/Palette.d.ts +21 -0
- package/types/palette/index.d.ts +1 -0
- package/types/placeholder/LayoutStartPanel.d.ts +5 -0
- package/types/placeholder/Placeholder.d.ts +17 -0
- package/types/placeholder/index.d.ts +1 -0
- package/types/registry/ComponentRegistry.d.ts +13 -0
- package/types/registry/index.d.ts +1 -0
- package/types/responsive/breakpoints.d.ts +4 -0
- package/types/responsive/index.d.ts +3 -0
- package/types/responsive/measureMinimumNodeSize.d.ts +1 -0
- package/types/responsive/overflowUtils.d.ts +2 -0
- package/types/responsive/use-breakpoints.d.ts +7 -0
- package/types/responsive/useResizeObserver.d.ts +13 -0
- package/types/responsive/utils.d.ts +6 -0
- package/types/stack/Stack.d.ts +3 -0
- package/types/stack/StackLayout.d.ts +6 -0
- package/types/stack/index.d.ts +3 -0
- package/types/stack/stackTypes.d.ts +22 -0
- package/types/tabs/TabPanel.d.ts +7 -0
- package/types/tabs/index.d.ts +1 -0
- package/types/tools/config-wrapper/ConfigWrapper.d.ts +2 -0
- package/types/tools/config-wrapper/index.d.ts +1 -0
- package/types/tools/devtools-box/layout-configurator.d.ts +31 -0
- package/types/tools/devtools-tree/layout-tree-viewer.d.ts +5 -0
- package/types/tools/index.d.ts +3 -0
- package/types/use-persistent-state.d.ts +11 -0
- package/types/utils/index.d.ts +5 -0
- package/types/utils/pathUtils.d.ts +31 -0
- package/types/utils/propUtils.d.ts +5 -0
- package/types/utils/refUtils.d.ts +2 -0
- package/types/utils/styleUtils.d.ts +3 -0
- package/types/utils/typeOf.d.ts +5 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import React, { isValidElement } from 'react';
|
|
2
|
+
import { isContainer } from '../registry/ComponentRegistry.js';
|
|
3
|
+
import { getProps, getProp } from './propUtils.js';
|
|
4
|
+
import { typeOf } from './typeOf.js';
|
|
5
|
+
|
|
6
|
+
const removeFinalPathSegment = (path) => {
|
|
7
|
+
const pos = path.lastIndexOf(".");
|
|
8
|
+
if (pos === -1) {
|
|
9
|
+
return path;
|
|
10
|
+
} else {
|
|
11
|
+
return path.slice(0, pos);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const getChildren = (c) => React.isValidElement(c.props.children) ? [c.props.children] : c.props.children;
|
|
15
|
+
const resolvePath = (source, path = "") => {
|
|
16
|
+
const [step1, ...steps] = path.split(".");
|
|
17
|
+
if (step1?.startsWith("#")) {
|
|
18
|
+
const node = findTargetById(source, step1.slice(1), true);
|
|
19
|
+
if (node && steps.length) {
|
|
20
|
+
return resolvePath(node, steps.join("."));
|
|
21
|
+
}
|
|
22
|
+
} else if (step1 === "ACTIVE_CHILD") {
|
|
23
|
+
const { active } = getProps(source);
|
|
24
|
+
const children = getChildren(source);
|
|
25
|
+
const { path: path2 } = getProps(children[active]);
|
|
26
|
+
return path2;
|
|
27
|
+
}
|
|
28
|
+
return "";
|
|
29
|
+
};
|
|
30
|
+
const resolveJSONPath = (source, path = "") => {
|
|
31
|
+
const [step1, ...steps] = path.split(".");
|
|
32
|
+
if (step1?.startsWith("#")) {
|
|
33
|
+
const node = findTargetJSONById(source, step1.slice(1), true);
|
|
34
|
+
if (node && steps.length) {
|
|
35
|
+
return resolveJSONPath(node, steps.join("."));
|
|
36
|
+
}
|
|
37
|
+
} else if (step1 === "ACTIVE_CHILD") {
|
|
38
|
+
const { children, props } = source;
|
|
39
|
+
const { active } = props;
|
|
40
|
+
if (typeof active === "number" && children?.[active]) {
|
|
41
|
+
return children[active];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
};
|
|
46
|
+
function followPathToParent(source, path) {
|
|
47
|
+
const { "data-path": dataPath, path: sourcePath = dataPath } = getProps(source);
|
|
48
|
+
if (path === "0")
|
|
49
|
+
return null;
|
|
50
|
+
if (path === sourcePath)
|
|
51
|
+
return null;
|
|
52
|
+
return followPath(source, removeFinalPathSegment(path), true);
|
|
53
|
+
}
|
|
54
|
+
function findTarget(source, test) {
|
|
55
|
+
const { children, ...props } = getProps(source);
|
|
56
|
+
if (test(props)) {
|
|
57
|
+
return source;
|
|
58
|
+
}
|
|
59
|
+
if (React.Children.count(children) > 0) {
|
|
60
|
+
const array = React.isValidElement(children) ? [children] : children;
|
|
61
|
+
for (const child of array) {
|
|
62
|
+
const target = findTarget(child, test);
|
|
63
|
+
if (target) {
|
|
64
|
+
return target;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function containerOf(source, target) {
|
|
70
|
+
if (target === source) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const { path: sourcePath, children } = getProps(source);
|
|
74
|
+
const { idx, finalStep } = nextStep(sourcePath, getProp(target, "path"));
|
|
75
|
+
if (finalStep) {
|
|
76
|
+
return source;
|
|
77
|
+
}
|
|
78
|
+
if (children === void 0 || children[idx] === void 0) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return containerOf(children[idx], target);
|
|
82
|
+
}
|
|
83
|
+
const getChild = (children, idx) => {
|
|
84
|
+
if (React.isValidElement(children) && idx == 0) {
|
|
85
|
+
return children;
|
|
86
|
+
}
|
|
87
|
+
if (Array.isArray(children)) {
|
|
88
|
+
return children[idx];
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
function followPathToComponent(component, path) {
|
|
92
|
+
const paths = path.split(".");
|
|
93
|
+
let children = [component];
|
|
94
|
+
for (let i = 0; i < paths.length; i++) {
|
|
95
|
+
const idx = parseInt(paths[i]);
|
|
96
|
+
const child = children[idx];
|
|
97
|
+
if (i === paths.length - 1) {
|
|
98
|
+
return child;
|
|
99
|
+
}
|
|
100
|
+
children = getChildren(child);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const findTargetById = (source, id, throwIfNotFound = true) => {
|
|
104
|
+
const { children, id: idProp } = source.props;
|
|
105
|
+
if (idProp === id) {
|
|
106
|
+
return source;
|
|
107
|
+
}
|
|
108
|
+
if (React.Children.count(children) > 0) {
|
|
109
|
+
const childArray = isValidElement(children) ? [children] : children;
|
|
110
|
+
for (const child of childArray) {
|
|
111
|
+
if (isValidElement(child)) {
|
|
112
|
+
const target = findTargetById(child, id, false);
|
|
113
|
+
if (target) {
|
|
114
|
+
return target;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (throwIfNotFound === true) {
|
|
120
|
+
throw Error(`pathUtils.findTargetById id #${id} not found in source`);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const findTargetJSONById = (source, id, throwIfNotFound = true) => {
|
|
124
|
+
const { children, id: idProp } = source;
|
|
125
|
+
if (idProp === id) {
|
|
126
|
+
return source;
|
|
127
|
+
}
|
|
128
|
+
if (Array.isArray(children) && children.length > 0) {
|
|
129
|
+
for (const child of children) {
|
|
130
|
+
if (child !== null && typeof child === "object") {
|
|
131
|
+
const target = findTargetJSONById(child, id, false);
|
|
132
|
+
if (target) {
|
|
133
|
+
return target;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (throwIfNotFound === true) {
|
|
139
|
+
throw Error(`pathUtils.findTargetJSONById id #${id} not found in source`);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
function followPath(source, path, throwIfNotFound = false) {
|
|
143
|
+
if (path.startsWith("#")) {
|
|
144
|
+
return findTargetById(source, path.slice(1), throwIfNotFound);
|
|
145
|
+
}
|
|
146
|
+
const { "data-path": dataPath, path: sourcePath = dataPath } = getProps(source);
|
|
147
|
+
if (path.indexOf(sourcePath) !== 0) {
|
|
148
|
+
throw Error(
|
|
149
|
+
`pathUtils.followPath path ${path} is not within source path ${sourcePath}`
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
const route = path.slice(sourcePath.length + 1);
|
|
153
|
+
if (route === "") {
|
|
154
|
+
return source;
|
|
155
|
+
}
|
|
156
|
+
let target = source;
|
|
157
|
+
const paths = route.split(".");
|
|
158
|
+
for (let i = 0; i < paths.length; i++) {
|
|
159
|
+
if (React.Children.count(target.props.children) === 0) {
|
|
160
|
+
const message = `element at 0.${paths.slice(0, i).join(".")} has no children, so cannot fulfill rest of path ${paths.slice(i).join(".")}`;
|
|
161
|
+
if (throwIfNotFound) {
|
|
162
|
+
throw Error(message);
|
|
163
|
+
} else {
|
|
164
|
+
console.warn(message);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
target = getChild(target.props.children, parseInt(paths[i]));
|
|
169
|
+
if (target === void 0) {
|
|
170
|
+
const message = `model at 0.${paths.slice(0, i).join(".")} has no children that fulfill next step of path ${paths.slice(i).join(".")}`;
|
|
171
|
+
if (throwIfNotFound) {
|
|
172
|
+
throw Error(message);
|
|
173
|
+
} else {
|
|
174
|
+
console.warn(message);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return target;
|
|
179
|
+
}
|
|
180
|
+
function nextLeaf(root, path) {
|
|
181
|
+
const parent = followPathToParent(root, path);
|
|
182
|
+
let pathIndices = path.split(".").map((idx) => parseInt(idx, 10));
|
|
183
|
+
if (parent) {
|
|
184
|
+
const lastIdx = pathIndices.pop();
|
|
185
|
+
const { children } = parent.props;
|
|
186
|
+
if (children.length - 1 > lastIdx) {
|
|
187
|
+
return firstLeaf(children[lastIdx + 1]);
|
|
188
|
+
} else {
|
|
189
|
+
const parentIdx = pathIndices.pop();
|
|
190
|
+
const nextParent = followPathToParent(root, getProp(parent, "path"));
|
|
191
|
+
if (nextParent && typeof parentIdx === "number") {
|
|
192
|
+
pathIndices = nextParent.props.path.split(".").map((idx) => parseInt(idx, 10));
|
|
193
|
+
if (nextParent.props.children.length - 1 > parentIdx) {
|
|
194
|
+
const nextStep2 = nextParent.props.children[parentIdx + 1];
|
|
195
|
+
if (isContainer(typeOf(nextStep2))) {
|
|
196
|
+
return firstLeaf(nextStep2);
|
|
197
|
+
} else {
|
|
198
|
+
return nextStep2;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return firstLeaf(root);
|
|
205
|
+
}
|
|
206
|
+
function previousLeaf(root, path) {
|
|
207
|
+
const pathIndices = path.split(".").map((idx) => parseInt(idx, 10));
|
|
208
|
+
let lastIdx = pathIndices.pop();
|
|
209
|
+
let parent = followPathToParent(root, path);
|
|
210
|
+
if (parent != null && typeof lastIdx === "number") {
|
|
211
|
+
const { children } = parent.props;
|
|
212
|
+
if (lastIdx > 0) {
|
|
213
|
+
return lastLeaf(children[lastIdx - 1]);
|
|
214
|
+
} else {
|
|
215
|
+
while (pathIndices.length > 1) {
|
|
216
|
+
lastIdx = pathIndices.pop();
|
|
217
|
+
parent = followPathToParent(
|
|
218
|
+
root,
|
|
219
|
+
getProp(parent, "path")
|
|
220
|
+
);
|
|
221
|
+
if (lastIdx > 0) {
|
|
222
|
+
const nextStep2 = parent.props.children[lastIdx - 1];
|
|
223
|
+
if (isContainer(typeOf(nextStep2))) {
|
|
224
|
+
return lastLeaf(nextStep2);
|
|
225
|
+
}
|
|
226
|
+
return nextStep2;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return lastLeaf(root);
|
|
232
|
+
}
|
|
233
|
+
function firstLeaf(layoutRoot) {
|
|
234
|
+
if (isContainer(typeOf(layoutRoot))) {
|
|
235
|
+
const { children } = layoutRoot.props || layoutRoot;
|
|
236
|
+
return firstLeaf(children[0]);
|
|
237
|
+
}
|
|
238
|
+
return layoutRoot;
|
|
239
|
+
}
|
|
240
|
+
function lastLeaf(root) {
|
|
241
|
+
if (isContainer(typeOf(root))) {
|
|
242
|
+
const { children } = root.props || root;
|
|
243
|
+
return lastLeaf(children[children.length - 1]);
|
|
244
|
+
}
|
|
245
|
+
return root;
|
|
246
|
+
}
|
|
247
|
+
function nextStep(pathSoFar, targetPath, followPathToEnd = false) {
|
|
248
|
+
if (pathSoFar === targetPath) {
|
|
249
|
+
return { idx: -1, finalStep: true };
|
|
250
|
+
}
|
|
251
|
+
const pathVisited = `${pathSoFar}.`;
|
|
252
|
+
if (!targetPath.startsWith(pathVisited)) {
|
|
253
|
+
throw Error("pathUtils nextStep has strayed from the path");
|
|
254
|
+
}
|
|
255
|
+
const endOfTheLine = followPathToEnd ? 0 : 1;
|
|
256
|
+
const paths = targetPath.replace(pathVisited, "").split(".").map((n) => parseInt(n, 10));
|
|
257
|
+
return { idx: paths[0], finalStep: paths.length === endOfTheLine };
|
|
258
|
+
}
|
|
259
|
+
function resetPath(model, path, additionalProps) {
|
|
260
|
+
if (getProp(model, "path") === path) {
|
|
261
|
+
return model;
|
|
262
|
+
}
|
|
263
|
+
const children = [];
|
|
264
|
+
React.Children.forEach(model.props.children, (child, i) => {
|
|
265
|
+
if (!getProp(child, "path")) {
|
|
266
|
+
children.push(child);
|
|
267
|
+
} else {
|
|
268
|
+
children.push(resetPath(child, `${path}.${i}`));
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
const pathPropName = model.props["data-path"] ? "data-path" : "path";
|
|
272
|
+
return React.cloneElement(
|
|
273
|
+
model,
|
|
274
|
+
{ [pathPropName]: path, ...additionalProps },
|
|
275
|
+
children
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export { containerOf, findTarget, followPath, followPathToComponent, followPathToParent, getChild, nextLeaf, nextStep, previousLeaf, resetPath, resolveJSONPath, resolvePath };
|
|
280
|
+
//# sourceMappingURL=pathUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathUtils.js","sources":["../../src/utils/pathUtils.ts"],"sourcesContent":["import React, { isValidElement, ReactElement } from \"react\";\nimport { LayoutJSON, LayoutModel, WithActive } from \"../layout-reducer\";\nimport { isContainer } from \"../registry/ComponentRegistry\";\nimport { getProp, getProps } from \"./propUtils\";\nimport { typeOf } from \"./typeOf\";\n\nconst removeFinalPathSegment = (path: string) => {\n const pos = path.lastIndexOf(\".\");\n if (pos === -1) {\n return path;\n } else {\n return path.slice(0, pos);\n }\n};\n\nconst getChildren = (c: ReactElement) =>\n React.isValidElement(c.props.children)\n ? [c.props.children]\n : c.props.children;\n\n/**\n * This is a very specific function at the moment. It resolves a path of the form\n * '#{componentid}.ACTIVE_CHILD'\n * It allows a templated path to be resolved to a concrete path at runtime.\n * The above pattern is used to identify a layout drop target. Further patterns\n * will be added if needed.\n */\nexport const resolvePath = (source: ReactElement, path = \"\"): string => {\n const [step1, ...steps] = path.split(\".\");\n if (step1?.startsWith(\"#\")) {\n const node = findTargetById(source, step1.slice(1), true);\n if (node && steps.length) {\n return resolvePath(node, steps.join(\".\"));\n }\n } else if (step1 === \"ACTIVE_CHILD\") {\n const { active } = getProps(source);\n const children = getChildren(source);\n const { path } = getProps(children[active]);\n return path;\n }\n\n return \"\";\n};\n\n/**\n * Similar to resolvePath but operates on a JSON\n * layout structure and returns the matching JSON node.\n */\nexport const resolveJSONPath = (\n source: LayoutJSON,\n path = \"\"\n): LayoutJSON | undefined => {\n const [step1, ...steps] = path.split(\".\");\n if (step1?.startsWith(\"#\")) {\n const node = findTargetJSONById(source, step1.slice(1), true);\n if (node && steps.length) {\n return resolveJSONPath(node, steps.join(\".\"));\n }\n } else if (step1 === \"ACTIVE_CHILD\") {\n const { children, props } = source;\n const { active } = props as WithActive;\n if (typeof active === \"number\" && children?.[active]) {\n return children[active];\n }\n }\n return;\n};\n\nexport function followPathToParent(\n source: ReactElement,\n path: string\n): ReactElement | null {\n const { \"data-path\": dataPath, path: sourcePath = dataPath } =\n getProps(source);\n\n if (path === \"0\") return null;\n if (path === sourcePath) return null;\n\n return followPath(source, removeFinalPathSegment(path), true);\n}\n\nexport function findTarget(\n source: LayoutModel,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n test: (props: any) => boolean\n): LayoutModel | undefined {\n const { children, ...props } = getProps(source);\n if (test(props)) {\n return source;\n }\n if (React.Children.count(children) > 0) {\n const array = React.isValidElement(children) ? [children] : children;\n for (const child of array) {\n const target = findTarget(child, test);\n if (target) {\n return target;\n }\n }\n }\n}\n\nexport function containerOf(\n source: LayoutModel,\n target: LayoutModel\n): LayoutModel | null {\n if (target === source) {\n return null;\n }\n const { path: sourcePath, children } = getProps(source);\n const { idx, finalStep } = nextStep(sourcePath, getProp(target, \"path\"));\n if (finalStep) {\n return source;\n }\n if (children === undefined || children[idx] === undefined) {\n return null;\n }\n return containerOf(children[idx], target);\n}\n\nexport const getChild = (\n children: ReactElement[],\n idx: number\n): ReactElement | undefined => {\n if (React.isValidElement(children) && idx == 0) {\n return children;\n }\n if (Array.isArray(children)) {\n return children[idx];\n }\n};\n\nexport function followPathToComponent(component: ReactElement, path: string) {\n const paths = path.split(\".\");\n let children = [component];\n\n for (let i = 0; i < paths.length; i++) {\n const idx = parseInt(paths[i]);\n const child = children[idx];\n if (i === paths.length - 1) {\n return child;\n }\n children = getChildren(child);\n }\n}\n\nconst findTargetById = (\n source: ReactElement,\n id: string,\n throwIfNotFound = true\n): ReactElement | undefined => {\n const { children, id: idProp } = source.props;\n if (idProp === id) {\n return source;\n }\n\n if (React.Children.count(children) > 0) {\n const childArray = isValidElement(children) ? [children] : children;\n for (const child of childArray) {\n if (isValidElement(child)) {\n const target = findTargetById(child, id, false);\n if (target) {\n return target;\n }\n }\n }\n }\n\n if (throwIfNotFound === true) {\n throw Error(`pathUtils.findTargetById id #${id} not found in source`);\n }\n};\n\nconst findTargetJSONById = (\n source: LayoutJSON,\n id: string,\n throwIfNotFound = true\n): LayoutJSON | undefined => {\n const { children, id: idProp } = source;\n if (idProp === id) {\n return source;\n }\n\n if (Array.isArray(children) && children.length > 0) {\n for (const child of children) {\n if (child !== null && typeof child === \"object\") {\n const target = findTargetJSONById(child, id, false);\n if (target) {\n return target;\n }\n }\n }\n }\n\n if (throwIfNotFound === true) {\n throw Error(`pathUtils.findTargetJSONById id #${id} not found in source`);\n }\n};\n\nexport function followPath(\n source: LayoutModel,\n path: string\n): LayoutModel | undefined;\nexport function followPath(\n source: ReactElement,\n path: string,\n throwIfNotFound: true\n): ReactElement;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function followPath(source: any, path: any, throwIfNotFound = false) {\n if (path.startsWith(\"#\")) {\n return findTargetById(source, path.slice(1), throwIfNotFound);\n }\n\n const { \"data-path\": dataPath, path: sourcePath = dataPath } =\n getProps(source);\n if (path.indexOf(sourcePath) !== 0) {\n throw Error(\n `pathUtils.followPath path ${path} is not within source path ${sourcePath}`\n );\n }\n const route = path.slice(sourcePath.length + 1);\n if (route === \"\") {\n return source;\n }\n\n let target = source;\n const paths = route.split(\".\");\n\n for (let i = 0; i < paths.length; i++) {\n if (React.Children.count(target.props.children) === 0) {\n const message = `element at 0.${paths\n .slice(0, i)\n .join(\".\")} has no children, so cannot fulfill rest of path ${paths\n .slice(i)\n .join(\".\")}`;\n\n if (throwIfNotFound) {\n throw Error(message);\n } else {\n console.warn(message);\n return;\n }\n }\n\n target = getChild(target.props.children, parseInt(paths[i]));\n\n if (target === undefined) {\n const message = `model at 0.${paths\n .slice(0, i)\n .join(\".\")} has no children that fulfill next step of path ${paths\n .slice(i)\n .join(\".\")}`;\n\n if (throwIfNotFound) {\n throw Error(message);\n } else {\n console.warn(message);\n }\n }\n }\n return target;\n}\n\nexport function nextLeaf(root: ReactElement, path: string) {\n const parent = followPathToParent(root, path);\n let pathIndices = path.split(\".\").map((idx) => parseInt(idx, 10));\n if (parent) {\n const lastIdx = pathIndices.pop();\n const { children } = parent.props;\n if (children.length - 1 > lastIdx!) {\n return firstLeaf(children[lastIdx! + 1]);\n } else {\n const parentIdx = pathIndices.pop();\n const nextParent = followPathToParent(root, getProp(parent, \"path\"));\n if (nextParent && typeof parentIdx === \"number\") {\n pathIndices = nextParent.props.path\n .split(\".\")\n .map((idx: string) => parseInt(idx, 10));\n if (nextParent.props.children.length - 1 > parentIdx) {\n const nextStep = nextParent.props.children[parentIdx + 1];\n if (isContainer(typeOf(nextStep) as string)) {\n return firstLeaf(nextStep);\n } else {\n return nextStep;\n }\n }\n }\n }\n }\n\n return firstLeaf(root);\n}\n\nexport function previousLeaf(root: ReactElement, path: string) {\n const pathIndices = path.split(\".\").map((idx) => parseInt(idx, 10));\n let lastIdx = pathIndices.pop();\n let parent = followPathToParent(root, path);\n if (parent != null && typeof lastIdx === \"number\") {\n const { children } = parent.props;\n if (lastIdx > 0) {\n return lastLeaf(children[lastIdx - 1]);\n } else {\n while (pathIndices.length > 1) {\n lastIdx = pathIndices.pop() as number;\n parent = followPathToParent(\n root,\n getProp(parent, \"path\")\n ) as ReactElement;\n if (lastIdx > 0) {\n const nextStep = parent.props.children[lastIdx - 1];\n if (isContainer(typeOf(nextStep) as string)) {\n return lastLeaf(nextStep);\n }\n return nextStep;\n }\n }\n }\n }\n return lastLeaf(root);\n}\n\nfunction firstLeaf(layoutRoot: ReactElement): ReactElement {\n if (isContainer(typeOf(layoutRoot) as string)) {\n const { children } = layoutRoot.props || layoutRoot;\n return firstLeaf(children[0]);\n }\n return layoutRoot;\n}\n\nfunction lastLeaf(root: ReactElement): ReactElement {\n if (isContainer(typeOf(root) as string)) {\n const { children } = root.props || root;\n return lastLeaf(children[children.length - 1]);\n }\n return root;\n}\n\ntype NextStepResult = {\n idx: number;\n finalStep: boolean;\n};\n\nexport function nextStep(\n pathSoFar: string,\n targetPath: string,\n followPathToEnd = false\n): NextStepResult {\n if (pathSoFar === targetPath) {\n return { idx: -1, finalStep: true };\n }\n\n const pathVisited = `${pathSoFar}.`;\n if (!targetPath.startsWith(pathVisited)) {\n throw Error(\"pathUtils nextStep has strayed from the path\");\n }\n\n const endOfTheLine = followPathToEnd ? 0 : 1;\n const paths = targetPath\n .replace(pathVisited, \"\")\n .split(\".\")\n .map((n) => parseInt(n, 10));\n return { idx: paths[0], finalStep: paths.length === endOfTheLine };\n}\n\nexport function resetPath(\n model: ReactElement,\n path: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalProps?: any\n): ReactElement {\n if (getProp(model, \"path\") === path) {\n return model;\n }\n const children: ReactElement[] = [];\n React.Children.forEach(model.props.children, (child, i) => {\n if (!getProp(child, \"path\")) {\n children.push(child);\n } else {\n children.push(resetPath(child, `${path}.${i}`));\n }\n });\n const pathPropName = model.props[\"data-path\"] ? \"data-path\" : \"path\";\n return React.cloneElement(\n model,\n { [pathPropName]: path, ...additionalProps },\n children\n );\n}\n"],"names":["path","nextStep"],"mappings":";;;;;AAMA,MAAM,sBAAA,GAAyB,CAAC,IAAiB,KAAA;AAC/C,EAAM,MAAA,GAAA,GAAM,IAAK,CAAA,WAAA,CAAY,GAAG,CAAA,CAAA;AAChC,EAAA,IAAI,QAAQ,CAAI,CAAA,EAAA;AACd,IAAO,OAAA,IAAA,CAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA,IAAA,CAAK,KAAM,CAAA,CAAA,EAAG,GAAG,CAAA,CAAA;AAAA,GAC1B;AACF,CAAA,CAAA;AAEA,MAAM,WAAc,GAAA,CAAC,CACnB,KAAA,KAAA,CAAM,eAAe,CAAE,CAAA,KAAA,CAAM,QAAQ,CAAA,GACjC,CAAC,CAAE,CAAA,KAAA,CAAM,QAAQ,CAAA,GACjB,EAAE,KAAM,CAAA,QAAA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A;AAAA,KAChD;AAAA,GACD,CAAA,CAAA;AACD,EAAA,MAAM,YAAe,GAAA,KAAA,CAAM,KAAM,CAAA,WAAW,IAAI,WAAc,GAAA,MAAA,CAAA;AAC9D,EAAA,OAAO,KAAM,CAAA,YAAA;AAAA,IACX,KAAA;AAAA,IACA,EAAE,CAAC,YAAY,GAAG,IAAA,EAAM,GAAG,eAAgB,EAAA;AAAA,IAC3C,QAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const NO_PROPS = {};
|
|
2
|
+
const getProp = (component, propName) => {
|
|
3
|
+
const props = getProps(component);
|
|
4
|
+
return props[propName] ?? props[`data-${propName}`];
|
|
5
|
+
};
|
|
6
|
+
const getProps = (component) => component?.props || component || NO_PROPS;
|
|
7
|
+
const getChildProp = (container) => {
|
|
8
|
+
const props = getProps(container);
|
|
9
|
+
if (props.children) {
|
|
10
|
+
const {
|
|
11
|
+
children: [target, ...rest]
|
|
12
|
+
} = props;
|
|
13
|
+
if (rest.length > 0) {
|
|
14
|
+
console.warn(
|
|
15
|
+
`getChild expected a single child, found ${rest.length + 1}`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { getChildProp, getProp, getProps };
|
|
23
|
+
//# sourceMappingURL=propUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propUtils.js","sources":["../../src/utils/propUtils.ts"],"sourcesContent":["import { ReactElement } from \"react\";\nimport { LayoutModel } from \"../layout-reducer\";\n\nconst NO_PROPS = {};\nexport const getProp = (\n component: LayoutModel | undefined,\n propName: string\n) => {\n const props = getProps(component);\n return props[propName] ?? props[`data-${propName}`];\n};\n\nexport const getProps = (component?: LayoutModel) =>\n component?.props || component || NO_PROPS;\n\nexport const getChildProp = (container: LayoutModel) => {\n const props = getProps(container);\n if (props.children) {\n const {\n children: [target, ...rest],\n } = props;\n if (rest.length > 0) {\n console.warn(\n `getChild expected a single child, found ${rest.length + 1}`\n );\n }\n return target as ReactElement;\n }\n};\n"],"names":[],"mappings":"AAGA,MAAM,WAAW,EAAC,CAAA;AACL,MAAA,OAAA,GAAU,CACrB,SAAA,EACA,QACG,KAAA;AACH,EAAM,MAAA,KAAA,GAAQ,SAAS,SAAS,CAAA,CAAA;AAChC,EAAA,OAAO,MAAM,QAAQ,CAAA,IAAK,KAAM,CAAA,CAAA,KAAA,EAAQ,QAAQ,CAAE,CAAA,CAAA,CAAA;AACpD,EAAA;AAEO,MAAM,QAAW,GAAA,CAAC,SACvB,KAAA,SAAA,EAAW,SAAS,SAAa,IAAA,SAAA;AAEtB,MAAA,YAAA,GAAe,CAAC,SAA2B,KAAA;AACtD,EAAM,MAAA,KAAA,GAAQ,SAAS,SAAS,CAAA,CAAA;AAChC,EAAA,IAAI,MAAM,QAAU,EAAA;AAClB,IAAM,MAAA;AAAA,MACJ,QAAU,EAAA,CAAC,MAAQ,EAAA,GAAG,IAAI,CAAA;AAAA,KACxB,GAAA,KAAA,CAAA;AACJ,IAAI,IAAA,IAAA,CAAK,SAAS,CAAG,EAAA;AACnB,MAAQ,OAAA,CAAA,IAAA;AAAA,QACN,CAAA,wCAAA,EAA2C,IAAK,CAAA,MAAA,GAAS,CAAC,CAAA,CAAA;AAAA,OAC5D,CAAA;AAAA,KACF;AACA,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refUtils.js","sources":["../../src/utils/refUtils.ts"],"sourcesContent":["import { MutableRefObject } from \"react\";\n\nexport function setRef<T>(\n ref:\n | MutableRefObject<T | null>\n | ((instance: T | null) => void)\n | null\n | undefined,\n value: T | null\n): void {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}\n"],"names":[],"mappings":"AAEgB,SAAA,MAAA,CACd,KAKA,KACM,EAAA;AACN,EAAI,IAAA,OAAO,QAAQ,UAAY,EAAA;AAC7B,IAAA,GAAA,CAAI,KAAK,CAAA,CAAA;AAAA,aACA,GAAK,EAAA;AACd,IAAA,GAAA,CAAI,OAAU,GAAA,KAAA,CAAA;AAAA,GAChB;AACF;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const expandFlex = (flex) => {
|
|
2
|
+
if (typeof flex !== "number") {
|
|
3
|
+
throw Error(`"no support yet for flex value ${flex}`);
|
|
4
|
+
}
|
|
5
|
+
return {
|
|
6
|
+
flexBasis: 0,
|
|
7
|
+
flexGrow: 1,
|
|
8
|
+
flexShrink: 1
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { expandFlex };
|
|
13
|
+
//# sourceMappingURL=styleUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styleUtils.js","sources":["../../src/utils/styleUtils.ts"],"sourcesContent":["import { CSSProperties } from 'react';\nexport type CSSFlexProperties = Pick<CSSProperties, 'flexBasis' | 'flexGrow' | 'flexShrink'>;\n\nexport const expandFlex = (flex: number | CSSFlexProperties): CSSFlexProperties => {\n if (typeof flex !== 'number') {\n throw Error(`\"no support yet for flex value ${flex}`);\n }\n return {\n flexBasis: 0,\n flexGrow: 1,\n flexShrink: 1\n };\n};\n"],"names":[],"mappings":"AAGa,MAAA,UAAA,GAAa,CAAC,IAAwD,KAAA;AACjF,EAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,IAAM,MAAA,KAAA,CAAM,CAAkC,+BAAA,EAAA,IAAI,CAAE,CAAA,CAAA,CAAA;AAAA,GACtD;AACA,EAAO,OAAA;AAAA,IACL,SAAW,EAAA,CAAA;AAAA,IACX,QAAU,EAAA,CAAA;AAAA,IACV,UAAY,EAAA,CAAA;AAAA,GACd,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function typeOf(element) {
|
|
2
|
+
if (element) {
|
|
3
|
+
const type = element.type;
|
|
4
|
+
if (typeof type === "function" || typeof type === "object") {
|
|
5
|
+
const elementName = type.displayName || type.name || type.type?.name;
|
|
6
|
+
if (typeof elementName === "string") {
|
|
7
|
+
return elementName;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
if (typeof element.type === "string") {
|
|
11
|
+
return element.type;
|
|
12
|
+
}
|
|
13
|
+
if (element.constructor) {
|
|
14
|
+
return element.constructor.displayName;
|
|
15
|
+
}
|
|
16
|
+
throw Error(`typeOf unable to determine type of element`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const isTypeOf = (element, type) => typeOf(element) === type;
|
|
20
|
+
const isLayoutJSON = (layout) => layout !== void 0 && "type" in layout;
|
|
21
|
+
|
|
22
|
+
export { isLayoutJSON, isTypeOf, typeOf };
|
|
23
|
+
//# sourceMappingURL=typeOf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeOf.js","sources":["../../src/utils/typeOf.ts"],"sourcesContent":["import { ReactElement } from 'react';\nimport { LayoutJSON, LayoutModel, WithType } from '../layout-reducer';\n\nexport function typeOf(element?: LayoutModel | WithType): string | undefined {\n if (element) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const type = element.type as any;\n if (typeof type === 'function' || typeof type === 'object') {\n const elementName = type.displayName || type.name || type.type?.name;\n if (typeof elementName === 'string') {\n return elementName;\n }\n }\n if (typeof element.type === 'string') {\n return element.type;\n }\n if (element.constructor) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (element.constructor as any).displayName as string;\n }\n throw Error(`typeOf unable to determine type of element`);\n }\n}\n\nexport const isTypeOf = (element: ReactElement, type: string) => typeOf(element) === type;\n\nexport const isLayoutJSON = (layout: LayoutJSON): layout is LayoutJSON =>\n layout !== undefined && \"type\" in layout;\n"],"names":[],"mappings":"AAGO,SAAS,OAAO,OAAsD,EAAA;AAC3E,EAAA,IAAI,OAAS,EAAA;AAEX,IAAA,MAAM,OAAO,OAAQ,CAAA,IAAA,CAAA;AACrB,IAAA,IAAI,OAAO,IAAA,KAAS,UAAc,IAAA,OAAO,SAAS,QAAU,EAAA;AAC1D,MAAA,MAAM,cAAc,IAAK,CAAA,WAAA,IAAe,IAAK,CAAA,IAAA,IAAQ,KAAK,IAAM,EAAA,IAAA,CAAA;AAChE,MAAI,IAAA,OAAO,gBAAgB,QAAU,EAAA;AACnC,QAAO,OAAA,WAAA,CAAA;AAAA,OACT;AAAA,KACF;AACA,IAAI,IAAA,OAAO,OAAQ,CAAA,IAAA,KAAS,QAAU,EAAA;AACpC,MAAA,OAAO,OAAQ,CAAA,IAAA,CAAA;AAAA,KACjB;AACA,IAAA,IAAI,QAAQ,WAAa,EAAA;AAEvB,MAAA,OAAQ,QAAQ,WAAoB,CAAA,WAAA,CAAA;AAAA,KACtC;AACA,IAAA,MAAM,MAAM,CAA4C,0CAAA,CAAA,CAAA,CAAA;AAAA,GAC1D;AACF,CAAA;AAEO,MAAM,WAAW,CAAC,OAAA,EAAuB,IAAiB,KAAA,MAAA,CAAO,OAAO,CAAM,KAAA,KAAA;AAE9E,MAAM,YAAe,GAAA,CAAC,MAC3B,KAAA,MAAA,KAAW,UAAa,MAAU,IAAA;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.0.26",
|
|
3
|
+
"description": "VUU Layout Components",
|
|
4
|
+
"author": "heswell",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@vuu-ui/vuu-data-types": "0.0.26",
|
|
9
|
+
"@vuu-ui/vuu-filter-types": "0.0.26"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@salt-ds/core": "1.17.0",
|
|
13
|
+
"@salt-ds/styles": "0.2.1",
|
|
14
|
+
"@salt-ds/window": "0.1.1",
|
|
15
|
+
"@vuu-ui/vuu-popups": "0.0.26",
|
|
16
|
+
"@vuu-ui/vuu-table": "0.0.26",
|
|
17
|
+
"@vuu-ui/vuu-ui-controls": "0.0.26",
|
|
18
|
+
"@vuu-ui/vuu-utils": "0.0.26"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"clsx": "^2.0.0",
|
|
22
|
+
"react": ">=17.0.2",
|
|
23
|
+
"react-dom": ">=17.0.2"
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"files": [
|
|
27
|
+
"README.md",
|
|
28
|
+
"esm",
|
|
29
|
+
"cjs",
|
|
30
|
+
"/types"
|
|
31
|
+
],
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"require": "./cjs/index.js",
|
|
35
|
+
"import": "./esm/index.js",
|
|
36
|
+
"types": "./types/index.d.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"main": "cjs/index.js",
|
|
40
|
+
"module": "esm/index.js",
|
|
41
|
+
"name": "@vuu-ui/vuu-layout",
|
|
42
|
+
"type": "module"
|
|
43
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
import './Component.css';
|
|
3
|
+
export interface ComponentProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
resizeable?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const Component: React.FunctionComponent<ComponentProps>;
|
|
7
|
+
export default Component;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
export interface DraggableLayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
dropTarget?: boolean;
|
|
4
|
+
resizeable?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const DraggableLayout: import("react").ForwardRefExoticComponent<DraggableLayoutProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/types/debug.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactElement } from "react";
|
|
2
|
+
export interface DockLayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: ReactElement[];
|
|
4
|
+
}
|
|
5
|
+
declare const DockLayout: {
|
|
6
|
+
(props: DockLayoutProps): JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export default DockLayout;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
export interface DrawerProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
clickToOpen?: boolean;
|
|
4
|
+
defaultOpen?: boolean;
|
|
5
|
+
inline?: boolean;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
peekaboo?: boolean;
|
|
8
|
+
position?: "left" | "right" | "top" | "bottom";
|
|
9
|
+
sizeOpen?: number;
|
|
10
|
+
sizeClosed?: number;
|
|
11
|
+
toggleButton?: "start" | "end";
|
|
12
|
+
}
|
|
13
|
+
declare const Drawer: {
|
|
14
|
+
({ children, className: classNameProp, clickToOpen, defaultOpen, sizeOpen, sizeClosed, style: styleProp, open: openProp, position, inline, onClick, peekaboo, toggleButton, ...props }: DrawerProps): JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
export default Drawer;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { LayoutModel } from "../layout-reducer";
|
|
3
|
+
import { DragDropRect, DropPos, RelativePosition } from "./dragDropTypes";
|
|
4
|
+
export declare const positionValues: {
|
|
5
|
+
north: number;
|
|
6
|
+
east: number;
|
|
7
|
+
south: number;
|
|
8
|
+
west: number;
|
|
9
|
+
header: number;
|
|
10
|
+
centre: number;
|
|
11
|
+
absolute: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const RelativeDropPosition: {
|
|
14
|
+
AFTER: RelativePosition;
|
|
15
|
+
BEFORE: RelativePosition;
|
|
16
|
+
};
|
|
17
|
+
export declare const Position: Readonly<{
|
|
18
|
+
North: Readonly<{
|
|
19
|
+
offset: number;
|
|
20
|
+
valueOf: () => number;
|
|
21
|
+
toString: () => "header" | "absolute" | "north" | "east" | "south" | "west" | "centre";
|
|
22
|
+
North: boolean;
|
|
23
|
+
South: boolean;
|
|
24
|
+
East: boolean;
|
|
25
|
+
West: boolean;
|
|
26
|
+
Header: boolean;
|
|
27
|
+
Centre: boolean;
|
|
28
|
+
NorthOrSouth: boolean;
|
|
29
|
+
EastOrWest: boolean;
|
|
30
|
+
NorthOrWest: boolean;
|
|
31
|
+
SouthOrEast: boolean;
|
|
32
|
+
Absolute: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
East: Readonly<{
|
|
35
|
+
offset: number;
|
|
36
|
+
valueOf: () => number;
|
|
37
|
+
toString: () => "header" | "absolute" | "north" | "east" | "south" | "west" | "centre";
|
|
38
|
+
North: boolean;
|
|
39
|
+
South: boolean;
|
|
40
|
+
East: boolean;
|
|
41
|
+
West: boolean;
|
|
42
|
+
Header: boolean;
|
|
43
|
+
Centre: boolean;
|
|
44
|
+
NorthOrSouth: boolean;
|
|
45
|
+
EastOrWest: boolean;
|
|
46
|
+
NorthOrWest: boolean;
|
|
47
|
+
SouthOrEast: boolean;
|
|
48
|
+
Absolute: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
South: Readonly<{
|
|
51
|
+
offset: number;
|
|
52
|
+
valueOf: () => number;
|
|
53
|
+
toString: () => "header" | "absolute" | "north" | "east" | "south" | "west" | "centre";
|
|
54
|
+
North: boolean;
|
|
55
|
+
South: boolean;
|
|
56
|
+
East: boolean;
|
|
57
|
+
West: boolean;
|
|
58
|
+
Header: boolean;
|
|
59
|
+
Centre: boolean;
|
|
60
|
+
NorthOrSouth: boolean;
|
|
61
|
+
EastOrWest: boolean;
|
|
62
|
+
NorthOrWest: boolean;
|
|
63
|
+
SouthOrEast: boolean;
|
|
64
|
+
Absolute: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
West: Readonly<{
|
|
67
|
+
offset: number;
|
|
68
|
+
valueOf: () => number;
|
|
69
|
+
toString: () => "header" | "absolute" | "north" | "east" | "south" | "west" | "centre";
|
|
70
|
+
North: boolean;
|
|
71
|
+
South: boolean;
|
|
72
|
+
East: boolean;
|
|
73
|
+
West: boolean;
|
|
74
|
+
Header: boolean;
|
|
75
|
+
Centre: boolean;
|
|
76
|
+
NorthOrSouth: boolean;
|
|
77
|
+
EastOrWest: boolean;
|
|
78
|
+
NorthOrWest: boolean;
|
|
79
|
+
SouthOrEast: boolean;
|
|
80
|
+
Absolute: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
Header: Readonly<{
|
|
83
|
+
offset: number;
|
|
84
|
+
valueOf: () => number;
|
|
85
|
+
toString: () => "header" | "absolute" | "north" | "east" | "south" | "west" | "centre";
|
|
86
|
+
North: boolean;
|
|
87
|
+
South: boolean;
|
|
88
|
+
East: boolean;
|
|
89
|
+
West: boolean;
|
|
90
|
+
Header: boolean;
|
|
91
|
+
Centre: boolean;
|
|
92
|
+
NorthOrSouth: boolean;
|
|
93
|
+
EastOrWest: boolean;
|
|
94
|
+
NorthOrWest: boolean;
|
|
95
|
+
SouthOrEast: boolean;
|
|
96
|
+
Absolute: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
Centre: Readonly<{
|
|
99
|
+
offset: number;
|
|
100
|
+
valueOf: () => number;
|
|
101
|
+
toString: () => "header" | "absolute" | "north" | "east" | "south" | "west" | "centre";
|
|
102
|
+
North: boolean;
|
|
103
|
+
South: boolean;
|
|
104
|
+
East: boolean;
|
|
105
|
+
West: boolean;
|
|
106
|
+
Header: boolean;
|
|
107
|
+
Centre: boolean;
|
|
108
|
+
NorthOrSouth: boolean;
|
|
109
|
+
EastOrWest: boolean;
|
|
110
|
+
NorthOrWest: boolean;
|
|
111
|
+
SouthOrEast: boolean;
|
|
112
|
+
Absolute: boolean;
|
|
113
|
+
}>;
|
|
114
|
+
Absolute: Readonly<{
|
|
115
|
+
offset: number;
|
|
116
|
+
valueOf: () => number;
|
|
117
|
+
toString: () => "header" | "absolute" | "north" | "east" | "south" | "west" | "centre";
|
|
118
|
+
North: boolean;
|
|
119
|
+
South: boolean;
|
|
120
|
+
East: boolean;
|
|
121
|
+
West: boolean;
|
|
122
|
+
Header: boolean;
|
|
123
|
+
Centre: boolean;
|
|
124
|
+
NorthOrSouth: boolean;
|
|
125
|
+
EastOrWest: boolean;
|
|
126
|
+
NorthOrWest: boolean;
|
|
127
|
+
SouthOrEast: boolean;
|
|
128
|
+
Absolute: boolean;
|
|
129
|
+
}>;
|
|
130
|
+
}>;
|
|
131
|
+
export interface Measurements {
|
|
132
|
+
[key: string]: DragDropRect;
|
|
133
|
+
}
|
|
134
|
+
export declare class BoxModel {
|
|
135
|
+
static measure(model: ReactElement, dropTargetPaths?: string[]): Measurements;
|
|
136
|
+
static allBoxesContainingPoint(layout: LayoutModel, measurements: Measurements, x: number, y: number, validDropTargets?: string[]): LayoutModel[];
|
|
137
|
+
}
|
|
138
|
+
export declare function pointPositionWithinRect(x: number, y: number, rect: DragDropRect, borderZone?: number): {
|
|
139
|
+
pctX: number;
|
|
140
|
+
pctY: number;
|
|
141
|
+
closeToTheEdge: number;
|
|
142
|
+
};
|
|
143
|
+
export declare function getPosition(x: number, y: number, rect: DragDropRect, targetOrientation?: "row" | "column"): DropPos;
|