@vuu-ui/vuu-layout 2.1.18 → 2.1.19-beta.1
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/package.json +14 -16
- package/types/dock-layout/DockLayout.d.ts +4 -4
- package/types/dock-layout/Drawer.d.ts +4 -4
- package/types/drag-drop/BoxModel.d.ts +7 -7
- package/types/flexbox/FlexboxLayout.d.ts +4 -4
- package/types/flexbox/Splitter.d.ts +1 -1
- package/types/layout-reducer/layoutUtils.d.ts +1 -1
- package/types/layout-reducer/remove-layout-element.d.ts +1 -1
- package/types/layout-reducer/replace-layout-element.d.ts +2 -2
- package/types/layout-reducer/resize-flex-children.d.ts +2 -2
- package/types/layout-view/useView.d.ts +1 -1
- package/types/placeholder/Placeholder.d.ts +4 -4
- package/types/responsive/overflowUtils.d.ts +2 -2
- package/types/stack/StackLayout.d.ts +4 -4
- package/types/tools/devtools-box/layout-configurator.d.ts +26 -26
- package/types/tools/devtools-tree/layout-tree-viewer.d.ts +2 -2
- package/types/utils/pathUtils.d.ts +1 -1
- package/cjs/Component.js +0 -14
- package/cjs/Component.js.map +0 -1
- package/cjs/LayoutContainer.css.js +0 -6
- package/cjs/LayoutContainer.css.js.map +0 -1
- package/cjs/LayoutContainer.js +0 -33
- package/cjs/LayoutContainer.js.map +0 -1
- package/cjs/dock-layout/DockLayout.css.js +0 -6
- package/cjs/dock-layout/DockLayout.css.js.map +0 -1
- package/cjs/dock-layout/DockLayout.js +0 -41
- package/cjs/dock-layout/DockLayout.js.map +0 -1
- package/cjs/dock-layout/Drawer.css.js +0 -6
- package/cjs/dock-layout/Drawer.css.js.map +0 -1
- package/cjs/dock-layout/Drawer.js +0 -95
- package/cjs/dock-layout/Drawer.js.map +0 -1
- package/cjs/drag-drop/BoxModel.js +0 -416
- package/cjs/drag-drop/BoxModel.js.map +0 -1
- package/cjs/drag-drop/DragState.js +0 -161
- package/cjs/drag-drop/DragState.js.map +0 -1
- package/cjs/drag-drop/Draggable.js +0 -192
- package/cjs/drag-drop/Draggable.js.map +0 -1
- package/cjs/drag-drop/DropTarget.js +0 -257
- package/cjs/drag-drop/DropTarget.js.map +0 -1
- package/cjs/drag-drop/DropTargetRenderer.js +0 -218
- package/cjs/drag-drop/DropTargetRenderer.js.map +0 -1
- package/cjs/flexbox/Flexbox.css.js +0 -6
- package/cjs/flexbox/Flexbox.css.js.map +0 -1
- package/cjs/flexbox/Flexbox.js +0 -69
- package/cjs/flexbox/Flexbox.js.map +0 -1
- package/cjs/flexbox/FlexboxLayout.js +0 -30
- package/cjs/flexbox/FlexboxLayout.js.map +0 -1
- package/cjs/flexbox/Splitter.css.js +0 -6
- package/cjs/flexbox/Splitter.css.js.map +0 -1
- package/cjs/flexbox/Splitter.js +0 -122
- package/cjs/flexbox/Splitter.js.map +0 -1
- package/cjs/flexbox/flexbox-utils.js +0 -95
- package/cjs/flexbox/flexbox-utils.js.map +0 -1
- package/cjs/flexbox/useSplitterResizing.js +0 -197
- package/cjs/flexbox/useSplitterResizing.js.map +0 -1
- package/cjs/index.js +0 -122
- package/cjs/index.js.map +0 -1
- package/cjs/layout-action.js +0 -24
- package/cjs/layout-action.js.map +0 -1
- package/cjs/layout-header/Header.css.js +0 -6
- package/cjs/layout-header/Header.css.js.map +0 -1
- package/cjs/layout-header/Header.js +0 -152
- package/cjs/layout-header/Header.js.map +0 -1
- package/cjs/layout-header/useHeader.js +0 -85
- package/cjs/layout-header/useHeader.js.map +0 -1
- package/cjs/layout-provider/LayoutProvider.js +0 -304
- package/cjs/layout-provider/LayoutProvider.js.map +0 -1
- package/cjs/layout-provider/LayoutProviderContext.js +0 -23
- package/cjs/layout-provider/LayoutProviderContext.js.map +0 -1
- package/cjs/layout-provider/useLayoutDragDrop.js +0 -177
- package/cjs/layout-provider/useLayoutDragDrop.js.map +0 -1
- package/cjs/layout-reducer/flexUtils.js +0 -227
- package/cjs/layout-reducer/flexUtils.js.map +0 -1
- package/cjs/layout-reducer/insert-layout-element.js +0 -286
- package/cjs/layout-reducer/insert-layout-element.js.map +0 -1
- package/cjs/layout-reducer/layout-reducer.js +0 -202
- package/cjs/layout-reducer/layout-reducer.js.map +0 -1
- package/cjs/layout-reducer/layoutTypes.js +0 -40
- package/cjs/layout-reducer/layoutTypes.js.map +0 -1
- package/cjs/layout-reducer/layoutUtils.js +0 -237
- package/cjs/layout-reducer/layoutUtils.js.map +0 -1
- package/cjs/layout-reducer/move-layout-element.js +0 -31
- package/cjs/layout-reducer/move-layout-element.js.map +0 -1
- package/cjs/layout-reducer/remove-layout-element.js +0 -237
- package/cjs/layout-reducer/remove-layout-element.js.map +0 -1
- package/cjs/layout-reducer/replace-layout-element.js +0 -96
- package/cjs/layout-reducer/replace-layout-element.js.map +0 -1
- package/cjs/layout-reducer/resize-flex-children.js +0 -62
- package/cjs/layout-reducer/resize-flex-children.js.map +0 -1
- package/cjs/layout-reducer/wrap-layout-element.js +0 -211
- package/cjs/layout-reducer/wrap-layout-element.js.map +0 -1
- package/cjs/layout-view/View.css.js +0 -6
- package/cjs/layout-view/View.css.js.map +0 -1
- package/cjs/layout-view/View.js +0 -160
- package/cjs/layout-view/View.js.map +0 -1
- package/cjs/layout-view/useView.js +0 -75
- package/cjs/layout-view/useView.js.map +0 -1
- package/cjs/layout-view/useViewBroadcastChannel.js +0 -35
- package/cjs/layout-view/useViewBroadcastChannel.js.map +0 -1
- package/cjs/layout-view/useViewResize.js +0 -42
- package/cjs/layout-view/useViewResize.js.map +0 -1
- package/cjs/layout-view-actions/ViewContext.js +0 -16
- package/cjs/layout-view-actions/ViewContext.js.map +0 -1
- package/cjs/layout-view-actions/useViewActionDispatcher.js +0 -112
- package/cjs/layout-view-actions/useViewActionDispatcher.js.map +0 -1
- package/cjs/layout-view-actions/useViewContributions.js +0 -33
- package/cjs/layout-view-actions/useViewContributions.js.map +0 -1
- package/cjs/palette/Palette.css.js +0 -6
- package/cjs/palette/Palette.css.js.map +0 -1
- package/cjs/palette/Palette.js +0 -115
- package/cjs/palette/Palette.js.map +0 -1
- package/cjs/placeholder/LayoutStartPanel.css.js +0 -6
- package/cjs/placeholder/LayoutStartPanel.css.js.map +0 -1
- package/cjs/placeholder/LayoutStartPanel.js +0 -56
- package/cjs/placeholder/LayoutStartPanel.js.map +0 -1
- package/cjs/placeholder/Placeholder.css.js +0 -6
- package/cjs/placeholder/Placeholder.css.js.map +0 -1
- package/cjs/placeholder/Placeholder.js +0 -34
- package/cjs/placeholder/Placeholder.js.map +0 -1
- package/cjs/responsive/useResizeObserver.js +0 -118
- package/cjs/responsive/useResizeObserver.js.map +0 -1
- package/cjs/responsive/utils.js +0 -34
- package/cjs/responsive/utils.js.map +0 -1
- package/cjs/stack/Stack.css.js +0 -6
- package/cjs/stack/Stack.css.js.map +0 -1
- package/cjs/stack/Stack.js +0 -150
- package/cjs/stack/Stack.js.map +0 -1
- package/cjs/stack/StackLayout.js +0 -116
- package/cjs/stack/StackLayout.js.map +0 -1
- package/cjs/use-persistent-state.js +0 -63
- package/cjs/use-persistent-state.js.map +0 -1
- package/cjs/utils/pathUtils.js +0 -293
- package/cjs/utils/pathUtils.js.map +0 -1
- package/cjs/utils/propUtils.js +0 -27
- package/cjs/utils/propUtils.js.map +0 -1
- package/cjs/utils/refUtils.js +0 -12
- package/cjs/utils/refUtils.js.map +0 -1
- package/cjs/utils/styleUtils.js +0 -15
- package/cjs/utils/styleUtils.js.map +0 -1
- package/cjs/utils/typeOf.js +0 -27
- package/cjs/utils/typeOf.js.map +0 -1
- package/esm/Component.js +0 -12
- package/esm/Component.js.map +0 -1
- package/esm/LayoutContainer.css.js +0 -4
- package/esm/LayoutContainer.css.js.map +0 -1
- package/esm/LayoutContainer.js +0 -31
- package/esm/LayoutContainer.js.map +0 -1
- package/esm/dock-layout/DockLayout.css.js +0 -4
- package/esm/dock-layout/DockLayout.css.js.map +0 -1
- package/esm/dock-layout/DockLayout.js +0 -39
- package/esm/dock-layout/DockLayout.js.map +0 -1
- package/esm/dock-layout/Drawer.css.js +0 -4
- package/esm/dock-layout/Drawer.css.js.map +0 -1
- package/esm/dock-layout/Drawer.js +0 -93
- package/esm/dock-layout/Drawer.js.map +0 -1
- package/esm/drag-drop/BoxModel.js +0 -409
- package/esm/drag-drop/BoxModel.js.map +0 -1
- package/esm/drag-drop/DragState.js +0 -159
- package/esm/drag-drop/DragState.js.map +0 -1
- package/esm/drag-drop/Draggable.js +0 -190
- package/esm/drag-drop/Draggable.js.map +0 -1
- package/esm/drag-drop/DropTarget.js +0 -253
- package/esm/drag-drop/DropTarget.js.map +0 -1
- package/esm/drag-drop/DropTargetRenderer.js +0 -216
- package/esm/drag-drop/DropTargetRenderer.js.map +0 -1
- package/esm/flexbox/Flexbox.css.js +0 -4
- package/esm/flexbox/Flexbox.css.js.map +0 -1
- package/esm/flexbox/Flexbox.js +0 -67
- package/esm/flexbox/Flexbox.js.map +0 -1
- package/esm/flexbox/FlexboxLayout.js +0 -28
- package/esm/flexbox/FlexboxLayout.js.map +0 -1
- package/esm/flexbox/Splitter.css.js +0 -4
- package/esm/flexbox/Splitter.css.js.map +0 -1
- package/esm/flexbox/Splitter.js +0 -120
- package/esm/flexbox/Splitter.js.map +0 -1
- package/esm/flexbox/flexbox-utils.js +0 -89
- package/esm/flexbox/flexbox-utils.js.map +0 -1
- package/esm/flexbox/useSplitterResizing.js +0 -195
- package/esm/flexbox/useSplitterResizing.js.map +0 -1
- package/esm/index.js +0 -33
- package/esm/index.js.map +0 -1
- package/esm/layout-action.js +0 -22
- package/esm/layout-action.js.map +0 -1
- package/esm/layout-header/Header.css.js +0 -4
- package/esm/layout-header/Header.css.js.map +0 -1
- package/esm/layout-header/Header.js +0 -150
- package/esm/layout-header/Header.js.map +0 -1
- package/esm/layout-header/useHeader.js +0 -83
- package/esm/layout-header/useHeader.js.map +0 -1
- package/esm/layout-provider/LayoutProvider.js +0 -297
- package/esm/layout-provider/LayoutProvider.js.map +0 -1
- package/esm/layout-provider/LayoutProviderContext.js +0 -20
- package/esm/layout-provider/LayoutProviderContext.js.map +0 -1
- package/esm/layout-provider/useLayoutDragDrop.js +0 -175
- package/esm/layout-provider/useLayoutDragDrop.js.map +0 -1
- package/esm/layout-reducer/flexUtils.js +0 -218
- package/esm/layout-reducer/flexUtils.js.map +0 -1
- package/esm/layout-reducer/insert-layout-element.js +0 -282
- package/esm/layout-reducer/insert-layout-element.js.map +0 -1
- package/esm/layout-reducer/layout-reducer.js +0 -200
- package/esm/layout-reducer/layout-reducer.js.map +0 -1
- package/esm/layout-reducer/layoutTypes.js +0 -36
- package/esm/layout-reducer/layoutTypes.js.map +0 -1
- package/esm/layout-reducer/layoutUtils.js +0 -226
- package/esm/layout-reducer/layoutUtils.js.map +0 -1
- package/esm/layout-reducer/move-layout-element.js +0 -29
- package/esm/layout-reducer/move-layout-element.js.map +0 -1
- package/esm/layout-reducer/remove-layout-element.js +0 -235
- package/esm/layout-reducer/remove-layout-element.js.map +0 -1
- package/esm/layout-reducer/replace-layout-element.js +0 -92
- package/esm/layout-reducer/replace-layout-element.js.map +0 -1
- package/esm/layout-reducer/resize-flex-children.js +0 -59
- package/esm/layout-reducer/resize-flex-children.js.map +0 -1
- package/esm/layout-reducer/wrap-layout-element.js +0 -209
- package/esm/layout-reducer/wrap-layout-element.js.map +0 -1
- package/esm/layout-view/View.css.js +0 -4
- package/esm/layout-view/View.css.js.map +0 -1
- package/esm/layout-view/View.js +0 -158
- package/esm/layout-view/View.js.map +0 -1
- package/esm/layout-view/useView.js +0 -73
- package/esm/layout-view/useView.js.map +0 -1
- package/esm/layout-view/useViewBroadcastChannel.js +0 -33
- package/esm/layout-view/useViewBroadcastChannel.js.map +0 -1
- package/esm/layout-view/useViewResize.js +0 -40
- package/esm/layout-view/useViewResize.js.map +0 -1
- package/esm/layout-view-actions/ViewContext.js +0 -12
- package/esm/layout-view-actions/ViewContext.js.map +0 -1
- package/esm/layout-view-actions/useViewActionDispatcher.js +0 -110
- package/esm/layout-view-actions/useViewActionDispatcher.js.map +0 -1
- package/esm/layout-view-actions/useViewContributions.js +0 -31
- package/esm/layout-view-actions/useViewContributions.js.map +0 -1
- package/esm/palette/Palette.css.js +0 -4
- package/esm/palette/Palette.css.js.map +0 -1
- package/esm/palette/Palette.js +0 -112
- package/esm/palette/Palette.js.map +0 -1
- package/esm/placeholder/LayoutStartPanel.css.js +0 -4
- package/esm/placeholder/LayoutStartPanel.css.js.map +0 -1
- package/esm/placeholder/LayoutStartPanel.js +0 -54
- package/esm/placeholder/LayoutStartPanel.js.map +0 -1
- package/esm/placeholder/Placeholder.css.js +0 -4
- package/esm/placeholder/Placeholder.css.js.map +0 -1
- package/esm/placeholder/Placeholder.js +0 -32
- package/esm/placeholder/Placeholder.js.map +0 -1
- package/esm/responsive/useResizeObserver.js +0 -112
- package/esm/responsive/useResizeObserver.js.map +0 -1
- package/esm/responsive/utils.js +0 -31
- package/esm/responsive/utils.js.map +0 -1
- package/esm/stack/Stack.css.js +0 -4
- package/esm/stack/Stack.css.js.map +0 -1
- package/esm/stack/Stack.js +0 -148
- package/esm/stack/Stack.js.map +0 -1
- package/esm/stack/StackLayout.js +0 -114
- package/esm/stack/StackLayout.js.map +0 -1
- package/esm/use-persistent-state.js +0 -58
- package/esm/use-persistent-state.js.map +0 -1
- package/esm/utils/pathUtils.js +0 -280
- package/esm/utils/pathUtils.js.map +0 -1
- package/esm/utils/propUtils.js +0 -23
- package/esm/utils/propUtils.js.map +0 -1
- package/esm/utils/refUtils.js +0 -10
- package/esm/utils/refUtils.js.map +0 -1
- package/esm/utils/styleUtils.js +0 -13
- package/esm/utils/styleUtils.js.map +0 -1
- package/esm/utils/typeOf.js +0 -23
- package/esm/utils/typeOf.js.map +0 -1
package/esm/Component.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import { registerComponent } from '@vuu-ui/vuu-utils';
|
|
4
|
-
|
|
5
|
-
const Component = forwardRef(function Component2({ resizeable, ...props }, ref) {
|
|
6
|
-
return /* @__PURE__ */ jsx("div", { ...props, className: "Component", ref });
|
|
7
|
-
});
|
|
8
|
-
Component.displayName = "Component";
|
|
9
|
-
registerComponent("Component", Component, "component");
|
|
10
|
-
|
|
11
|
-
export { Component as default };
|
|
12
|
-
//# sourceMappingURL=Component.js.map
|
package/esm/Component.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../packages/vuu-layout/src/Component.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes } from \"react\";\nimport { registerComponent } from \"@vuu-ui/vuu-utils\";\n\nexport interface ComponentProps extends HTMLAttributes<HTMLDivElement> {\n resizeable?: boolean;\n}\n\nconst Component = forwardRef(function Component(\n { resizeable, ...props }: ComponentProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n) {\n return <div {...props} className=\"Component\" ref={ref} />;\n}) as React.FunctionComponent<ComponentProps>;\nComponent.displayName = \"Component\";\n\nexport default Component;\n\nregisterComponent(\"Component\", Component, \"component\");\n"],"names":["Component"],"mappings":";;;;AAOM,MAAA,SAAA,GAAY,WAAW,SAASA,UAAAA,CACpC,EAAE,UAAY,EAAA,GAAG,KAAM,EAAA,EACvB,GACA,EAAA;AACA,EAAA,2BAAQ,KAAK,EAAA,EAAA,GAAG,KAAO,EAAA,SAAA,EAAU,aAAY,GAAU,EAAA,CAAA;AACzD,CAAC;AACD,SAAA,CAAU,WAAc,GAAA,WAAA;AAIxB,iBAAkB,CAAA,WAAA,EAAa,WAAW,WAAW,CAAA;;;;"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var layoutContainerCss = ".vuuLayoutContainer {\n display: inline-block;\n outline: none;\n}\n\n[data-dragging=\"true\"] {\n position: absolute !important;\n z-index: 100;\n}\n\n.vuuSimpleDraggableWrapper {\n background-color: white;\n box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.2);\n}\n.vuuSimpleDraggableWrapper > * {\n height: 100%;\n width: 100%;\n}\n";
|
|
2
|
-
|
|
3
|
-
export { layoutContainerCss as default };
|
|
4
|
-
//# sourceMappingURL=LayoutContainer.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutContainer.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/esm/LayoutContainer.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { registerComponent } from '@vuu-ui/vuu-utils';
|
|
3
|
-
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
4
|
-
import { useWindow } from '@salt-ds/window';
|
|
5
|
-
import cx from 'clsx';
|
|
6
|
-
import { forwardRef } from 'react';
|
|
7
|
-
import layoutContainerCss from './LayoutContainer.css.js';
|
|
8
|
-
|
|
9
|
-
const LayoutContainer = forwardRef(function LayoutContainer2({
|
|
10
|
-
children,
|
|
11
|
-
className: classNameProp,
|
|
12
|
-
dropTarget,
|
|
13
|
-
resizeable: _,
|
|
14
|
-
// ignore, its just a marker used by the layout system
|
|
15
|
-
...htmlAttributes
|
|
16
|
-
}, forwardedRef) {
|
|
17
|
-
const targetWindow = useWindow();
|
|
18
|
-
useComponentCssInjection({
|
|
19
|
-
testId: "vuu-layout-container",
|
|
20
|
-
css: layoutContainerCss,
|
|
21
|
-
window: targetWindow
|
|
22
|
-
});
|
|
23
|
-
const className = cx("vuuLayoutContainer", classNameProp);
|
|
24
|
-
return /* @__PURE__ */ jsx("div", { className, ref: forwardedRef, ...htmlAttributes, children });
|
|
25
|
-
});
|
|
26
|
-
const componentName = "LayoutContainer";
|
|
27
|
-
LayoutContainer.displayName = componentName;
|
|
28
|
-
registerComponent(componentName, LayoutContainer, "container");
|
|
29
|
-
|
|
30
|
-
export { LayoutContainer };
|
|
31
|
-
//# sourceMappingURL=LayoutContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutContainer.js","sources":["../../../packages/vuu-layout/src/LayoutContainer.tsx"],"sourcesContent":["import { registerComponent } from \"@vuu-ui/vuu-utils\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport cx from \"clsx\";\nimport { ForwardedRef, forwardRef, HTMLAttributes } from \"react\";\n\nimport layoutContainerCss from \"./LayoutContainer.css\";\n\nexport interface LayoutContainerProps extends HTMLAttributes<HTMLDivElement> {\n dropTarget?: boolean;\n resizeable?: boolean;\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const LayoutContainer = forwardRef(function LayoutContainer(\n {\n children,\n className: classNameProp,\n dropTarget,\n resizeable: _, // ignore, its just a marker used by the layout system\n ...htmlAttributes\n }: LayoutContainerProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-layout-container\",\n css: layoutContainerCss,\n window: targetWindow,\n });\n\n const className = cx(\"vuuLayoutContainer\", classNameProp);\n return (\n <div className={className} ref={forwardedRef} {...htmlAttributes}>\n {children}\n </div>\n );\n});\n\nconst componentName = \"LayoutContainer\";\n\nLayoutContainer.displayName = componentName;\n\nregisterComponent(componentName, LayoutContainer, \"container\");\n"],"names":["LayoutContainer"],"mappings":";;;;;;;;AAaa,MAAA,eAAA,GAAkB,UAAW,CAAA,SAASA,gBACjD,CAAA;AAAA,EACE,QAAA;AAAA,EACA,SAAW,EAAA,aAAA;AAAA,EACX,UAAA;AAAA,EACA,UAAY,EAAA,CAAA;AAAA;AAAA,EACZ,GAAG;AACL,CAAA,EACA,YACA,EAAA;AACA,EAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,sBAAA;AAAA,IACR,GAAK,EAAA,kBAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAM,MAAA,SAAA,GAAY,EAAG,CAAA,oBAAA,EAAsB,aAAa,CAAA;AACxD,EAAA,2BACG,KAAI,EAAA,EAAA,SAAA,EAAsB,KAAK,YAAe,EAAA,GAAG,gBAC/C,QACH,EAAA,CAAA;AAEJ,CAAC;AAED,MAAM,aAAgB,GAAA,iBAAA;AAEtB,eAAA,CAAgB,WAAc,GAAA,aAAA;AAE9B,iBAAkB,CAAA,aAAA,EAAe,iBAAiB,WAAW,CAAA;;;;"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var dockLayoutCss = ".vuuDockLayout {\n --chest-bg: var(--hw-chest-bg, inherit);\n --drawer-bg: var(--hw-drawer-bg, inherit);\n --drawer-size: var(--hw-drawer-size, 200px);\n --drawer-peek-size: var(--hw-drawer-peek-size, 32px);\n --drawer-transition-duration: var(--hw-drawer-transition-duration, 0.4s);\n background-color: var(--chest-bg);\n display: flex;\n}\n\n.vuuDockLayout-horizontal {\n flex-direction: row;\n}\n\n.vuuDockLayout-vertical {\n flex-direction: column;\n}\n\n.vuuDockLayout-content {\n background-color: var(--chest-bg);\n flex-grow: 1;\n flex-shrink: 1;\n overflow: hidden;\n /* position: relative; */\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.vuuDockLayout-horizontal .vuuDockLayout-content {\n flex-basis: 100%;\n}\n\n.vuuDockLayout-vertical .vuuDockLayout-content {\n flex-basis: 100%;\n}\n";
|
|
2
|
-
|
|
3
|
-
export { dockLayoutCss as default };
|
|
4
|
-
//# sourceMappingURL=DockLayout.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DockLayout.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { registerComponent, asReactElements, partition } from '@vuu-ui/vuu-utils';
|
|
3
|
-
import cx from 'clsx';
|
|
4
|
-
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
5
|
-
import { useWindow } from '@salt-ds/window';
|
|
6
|
-
import { useMemo } from 'react';
|
|
7
|
-
import Drawer from './Drawer.js';
|
|
8
|
-
import dockLayoutCss from './DockLayout.css.js';
|
|
9
|
-
|
|
10
|
-
const isDrawer = (component) => component.type === Drawer;
|
|
11
|
-
const isVertical = (element) => (
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
element.props.position && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
element.props.position.match(/top|bottom/)
|
|
15
|
-
);
|
|
16
|
-
const classBase = "vuuDockLayout";
|
|
17
|
-
const DockLayout = (props) => {
|
|
18
|
-
const targetWindow = useWindow();
|
|
19
|
-
useComponentCssInjection({
|
|
20
|
-
testId: "vuu-dock-layput",
|
|
21
|
-
css: dockLayoutCss,
|
|
22
|
-
window: targetWindow
|
|
23
|
-
});
|
|
24
|
-
const { children, className: classNameProp, id, style } = props;
|
|
25
|
-
const childElements = useMemo(() => asReactElements(children), [children]);
|
|
26
|
-
const [drawers, content] = partition(childElements, isDrawer);
|
|
27
|
-
const [verticalDrawers, horizontalDrawers] = partition(drawers, isVertical);
|
|
28
|
-
const orientation = verticalDrawers.length === 0 ? "horizontal" : horizontalDrawers.length === 0 ? "vertical" : "both";
|
|
29
|
-
const className = cx(classBase, classNameProp, `${classBase}-${orientation}`);
|
|
30
|
-
return /* @__PURE__ */ jsxs("div", { className, id, style, children: [
|
|
31
|
-
drawers,
|
|
32
|
-
/* @__PURE__ */ jsx("div", { className: `${classBase}-content`, children: content })
|
|
33
|
-
] });
|
|
34
|
-
};
|
|
35
|
-
DockLayout.displayName = "DockLayout";
|
|
36
|
-
registerComponent("DockLayout", DockLayout, "container");
|
|
37
|
-
|
|
38
|
-
export { DockLayout as default };
|
|
39
|
-
//# sourceMappingURL=DockLayout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DockLayout.js","sources":["../../../../packages/vuu-layout/src/dock-layout/DockLayout.tsx"],"sourcesContent":["import {\n asReactElements,\n partition,\n registerComponent,\n} from \"@vuu-ui/vuu-utils\";\nimport cx from \"clsx\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { HTMLAttributes, ReactElement, useMemo } from \"react\";\nimport Drawer from \"./Drawer\";\n\nimport dockLayoutCss from \"./DockLayout.css\";\n\nconst isDrawer = (component: ReactElement) => component.type === Drawer;\nconst isVertical = (element: ReactElement) =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (element.props as any).position &&\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (element.props as any).position.match(/top|bottom/);\n\nexport type DockLayoutProps = HTMLAttributes<HTMLDivElement>;\n\nconst classBase = \"vuuDockLayout\";\n\nconst DockLayout = (props: DockLayoutProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-dock-layput\",\n css: dockLayoutCss,\n window: targetWindow,\n });\n\n const { children, className: classNameProp, id, style } = props;\n const childElements = useMemo(() => asReactElements(children), [children]);\n\n const [drawers, content] = partition(childElements, isDrawer);\n const [verticalDrawers, horizontalDrawers] = partition(drawers, isVertical);\n const orientation =\n verticalDrawers.length === 0\n ? \"horizontal\"\n : horizontalDrawers.length === 0\n ? \"vertical\"\n : \"both\";\n\n const className = cx(classBase, classNameProp, `${classBase}-${orientation}`);\n\n return (\n <div className={className} id={id} style={style}>\n {drawers}\n <div className={`${classBase}-content`}>{content}</div>\n </div>\n );\n};\nDockLayout.displayName = \"DockLayout\";\n\nexport default DockLayout;\n\nregisterComponent(\"DockLayout\", DockLayout, \"container\");\n"],"names":[],"mappings":";;;;;;;;;AAaA,MAAM,QAAW,GAAA,CAAC,SAA4B,KAAA,SAAA,CAAU,IAAS,KAAA,MAAA;AACjE,MAAM,aAAa,CAAC,OAAA;AAAA;AAAA,EAEjB,QAAQ,KAAc,CAAA,QAAA;AAAA,EAEtB,OAAQ,CAAA,KAAA,CAAc,QAAS,CAAA,KAAA,CAAM,YAAY;AAAA,CAAA;AAIpD,MAAM,SAAY,GAAA,eAAA;AAEZ,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AAC7C,EAAA,MAAM,eAAe,SAAU,EAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,iBAAA;AAAA,IACR,GAAK,EAAA,aAAA;AAAA,IACL,MAAQ,EAAA;AAAA,GACT,CAAA;AAED,EAAA,MAAM,EAAE,QAAU,EAAA,SAAA,EAAW,aAAe,EAAA,EAAA,EAAI,OAAU,GAAA,KAAA;AAC1D,EAAM,MAAA,aAAA,GAAgB,QAAQ,MAAM,eAAA,CAAgB,QAAQ,CAAG,EAAA,CAAC,QAAQ,CAAC,CAAA;AAEzE,EAAA,MAAM,CAAC,OAAS,EAAA,OAAO,CAAI,GAAA,SAAA,CAAU,eAAe,QAAQ,CAAA;AAC5D,EAAA,MAAM,CAAC,eAAiB,EAAA,iBAAiB,CAAI,GAAA,SAAA,CAAU,SAAS,UAAU,CAAA;AAC1E,EAAM,MAAA,WAAA,GACJ,gBAAgB,MAAW,KAAA,CAAA,GACvB,eACA,iBAAkB,CAAA,MAAA,KAAW,IAC3B,UACA,GAAA,MAAA;AAER,EAAM,MAAA,SAAA,GAAY,GAAG,SAAW,EAAA,aAAA,EAAe,GAAG,SAAS,CAAA,CAAA,EAAI,WAAW,CAAE,CAAA,CAAA;AAE5E,EAAA,uBACG,IAAA,CAAA,KAAA,EAAA,EAAI,SAAsB,EAAA,EAAA,EAAQ,KAChC,EAAA,QAAA,EAAA;AAAA,IAAA,OAAA;AAAA,wBACA,KAAI,EAAA,EAAA,SAAA,EAAW,CAAG,EAAA,SAAS,YAAa,QAAQ,EAAA,OAAA,EAAA;AAAA,GACnD,EAAA,CAAA;AAEJ;AACA,UAAA,CAAW,WAAc,GAAA,YAAA;AAIzB,iBAAkB,CAAA,YAAA,EAAc,YAAY,WAAW,CAAA;;;;"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var drawerCss = ".vuuDrawer {\n --drawer-leading-edge-border: solid 1px var(--salt-container-primary-borderColor, none);\n --vuu-close-icon-svg: var(--svg-chevron-double-right);\n\n transition: flex-basis;\n transition-duration: var(--drawer-transition-duration);\n position: relative;\n z-index: 1;\n flex-basis: 0;\n flex-grow: 1;\n flex-shrink: 1;\n min-width: 0;\n min-height: 0;\n display: flex;\n}\n\n.vuuDrawer-peekaboo {\n flex-basis: var(--drawer-peek-size);\n flex-grow: 0;\n flex-shrink: 0;\n}\n\n.vuuDrawer-inline.vuuDrawer-open {\n flex-basis: var(--drawer-size);\n flex-grow: 0;\n flex-shrink: 0;\n}\n\n.vuuDrawer-liner {\n background-color: var(--drawer-bg);\n overflow: hidden;\n position: relative;\n}\n\n.vuuDrawer-content {\n height: 100%;\n overflow: hidden;\n position: absolute;\n top: 0;\n right: var(--drawer-peek-size);\n transition: right;\n transition-duration: var(--drawer-transition-duration);\n width: 100%;\n flex: 1 1 100%;\n}\n\n.vuuDrawer-open .vuuDrawer-content {\n right: 0;\n}\n\n/* .vuuDrawer:not(.vuuDrawer-open) .vuuDrawer-liner > * {\n display: none;\n} */\n\n.vuuDrawer-left {\n border-right: var(--drawer-leading-edge-border);\n}\n.vuuDrawer-right {\n border-left: var(--drawer-leading-edge-border);\n}\n.vuuDrawer-top {\n border-bottom: var(--drawer-leading-edge-border);\n}\n.vuuDrawer-bottom {\n border-top: var(--drawer-leading-edge-border);\n}\n\n.vuuDrawer-left .vuuDrawer-liner,\n.vuuDrawer-right .vuuDrawer-liner {\n height: 100%;\n transition: width;\n}\n\n.vuuDrawer-top .vuuDrawer-liner,\n.vuuDrawer-bottom .vuuDrawer-liner {\n width: 100%;\n transition: height;\n}\n\n.vuuDrawer-inline .vuuDrawer-liner {\n width: 100%;\n height: 100%;\n}\n\n.vuuDrawer-over .vuuDrawer-liner {\n position: absolute;\n transition-duration: 0.4s;\n}\n\n.vuuDrawer-over.vuuDrawer-left .vuuDrawer-liner {\n top: 0;\n left: 0;\n width: 0;\n}\n\n.vuuDrawer-over.vuuDrawer-right .vuuDrawer-liner {\n top: 0;\n right: 0;\n width: 0;\n}\n\n.vuuDrawer-over.vuuDrawer-top .vuuDrawer-liner {\n height: 0;\n top: 0;\n left: 0;\n}\n\n.vuuDrawer-over.vuuDrawer-bottom .vuuDrawer-liner {\n bottom: 0;\n height: 0;\n left: 0;\n}\n\n.vuuDrawer-left.vuuDrawer-over.vuuDrawer-peekaboo .vuuDrawer-liner,\n.vuuDrawer-right.vuuDrawer-over.vuuDrawer-peekaboo .vuuDrawer-liner {\n width: var(--drawer-peek-size);\n}\n\n.vuuDrawer-top.vuuDrawer-over.vuuDrawer-peekaboo .vuuDrawer-liner,\n.vuuDrawer-bottom.vuuDrawer-over.vuuDrawer-peekaboo .vuuDrawer-liner {\n height: var(--drawer-peek-size);\n}\n\n.vuuDrawer-left.vuuDrawer-over.vuuDrawer-open .vuuDrawer-liner,\n.vuuDrawer-right.vuuDrawer-over.vuuDrawer-open .vuuDrawer-liner {\n width: var(--drawer-size);\n}\n\n.vuuDrawer-top.vuuDrawer-over.vuuDrawer-open .vuuDrawer-liner,\n.vuuDrawer-bottom.vuuDrawer-over.vuuDrawer-open .vuuDrawer-liner {\n height: var(--drawer-size);\n}\n\n.vuuDrawer-top,\n.vuuDrawer-left {\n order: 0;\n}\n\n.vuuDrawer-bottom,\n.vuuDrawer-right {\n order: 99;\n}\n\n.vuuDrawer-left,\n.vuuDrawer-right {\n flex-direction: column;\n}\n\n.vuuToggleButton-container {\n --saltButton-height: 28px;\n --saltButton-width: 28px;\n --vuu-icon-size: 12px;\n flex: 0 0 28px;\n}\n\n.vuuDrawer-open {\n --vuu-close-icon-svg: var(--svg-chevron-double-left);\n\n}\n";
|
|
2
|
-
|
|
3
|
-
export { drawerCss as default };
|
|
4
|
-
//# sourceMappingURL=Drawer.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useControlled, Button } from '@salt-ds/core';
|
|
3
|
-
import cx from 'clsx';
|
|
4
|
-
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
5
|
-
import { useWindow } from '@salt-ds/window';
|
|
6
|
-
import { useCallback } from 'react';
|
|
7
|
-
import drawerCss from './Drawer.css.js';
|
|
8
|
-
|
|
9
|
-
const classBase = "vuuDrawer";
|
|
10
|
-
const sizeAttribute = (value) => {
|
|
11
|
-
return typeof value === "string" ? value : value + "px";
|
|
12
|
-
};
|
|
13
|
-
const getStyle = (styleProp, sizeOpen, sizeClosed) => {
|
|
14
|
-
const hasSizeOpen = sizeOpen !== void 0;
|
|
15
|
-
const hasSizeClosed = sizeClosed !== void 0;
|
|
16
|
-
if (!styleProp && !hasSizeClosed && !hasSizeOpen) {
|
|
17
|
-
return void 0;
|
|
18
|
-
}
|
|
19
|
-
if (!hasSizeClosed && !hasSizeOpen) {
|
|
20
|
-
return styleProp;
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
...styleProp,
|
|
24
|
-
"--drawer-size": hasSizeOpen ? sizeAttribute(sizeOpen) : void 0,
|
|
25
|
-
"--drawer-peek-size": hasSizeClosed ? sizeAttribute(sizeClosed) : void 0
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const Drawer = ({
|
|
29
|
-
children,
|
|
30
|
-
className: classNameProp,
|
|
31
|
-
clickToOpen,
|
|
32
|
-
defaultOpen,
|
|
33
|
-
sizeOpen,
|
|
34
|
-
sizeClosed,
|
|
35
|
-
style: styleProp,
|
|
36
|
-
open: openProp,
|
|
37
|
-
position = "left",
|
|
38
|
-
inline,
|
|
39
|
-
onClick,
|
|
40
|
-
peekaboo = false,
|
|
41
|
-
toggleButton,
|
|
42
|
-
...props
|
|
43
|
-
}) => {
|
|
44
|
-
const targetWindow = useWindow();
|
|
45
|
-
useComponentCssInjection({
|
|
46
|
-
testId: "vuu-drawer",
|
|
47
|
-
css: drawerCss,
|
|
48
|
-
window: targetWindow
|
|
49
|
-
});
|
|
50
|
-
const [open, setOpen] = useControlled({
|
|
51
|
-
controlled: openProp,
|
|
52
|
-
default: defaultOpen ?? false,
|
|
53
|
-
name: "Drawer",
|
|
54
|
-
state: "open"
|
|
55
|
-
});
|
|
56
|
-
const className = cx(classBase, classNameProp, `${classBase}-${position}`, {
|
|
57
|
-
[`${classBase}-open`]: open,
|
|
58
|
-
[`${classBase}-inline`]: inline,
|
|
59
|
-
[`${classBase}-over`]: !inline,
|
|
60
|
-
[`${classBase}-peekaboo`]: peekaboo
|
|
61
|
-
});
|
|
62
|
-
const toggleDrawer = useCallback(() => {
|
|
63
|
-
setOpen(!open);
|
|
64
|
-
}, [open, setOpen]);
|
|
65
|
-
const style = getStyle(styleProp, sizeOpen, sizeClosed);
|
|
66
|
-
const handleClick = clickToOpen ? toggleDrawer : onClick;
|
|
67
|
-
const renderToggleButton = () => /* @__PURE__ */ jsx("div", { className: cx("vuuToggleButton-container"), children: open ? /* @__PURE__ */ jsx(
|
|
68
|
-
Button,
|
|
69
|
-
{
|
|
70
|
-
"aria-label": "close",
|
|
71
|
-
onClick: toggleDrawer,
|
|
72
|
-
"data-icon": "close",
|
|
73
|
-
variant: "secondary"
|
|
74
|
-
}
|
|
75
|
-
) : /* @__PURE__ */ jsx(
|
|
76
|
-
Button,
|
|
77
|
-
{
|
|
78
|
-
"aria-label": "open",
|
|
79
|
-
onClick: toggleDrawer,
|
|
80
|
-
"data-icon": "close",
|
|
81
|
-
variant: "secondary"
|
|
82
|
-
}
|
|
83
|
-
) });
|
|
84
|
-
return /* @__PURE__ */ jsxs("div", { ...props, className, onClick: handleClick, style, children: [
|
|
85
|
-
toggleButton == "start" ? renderToggleButton() : null,
|
|
86
|
-
/* @__PURE__ */ jsx("div", { className: `${classBase}-liner`, children: /* @__PURE__ */ jsx("div", { className: `${classBase}-content`, children }) }),
|
|
87
|
-
toggleButton == "end" ? renderToggleButton() : null
|
|
88
|
-
] });
|
|
89
|
-
};
|
|
90
|
-
Drawer.displayName = "Drawer";
|
|
91
|
-
|
|
92
|
-
export { Drawer as default };
|
|
93
|
-
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sources":["../../../../packages/vuu-layout/src/dock-layout/Drawer.tsx"],"sourcesContent":["import { Button, useControlled } from \"@salt-ds/core\";\nimport cx from \"clsx\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { CSSProperties, HTMLAttributes, useCallback } from \"react\";\n\nimport drawerCss from \"./Drawer.css\";\n\nconst classBase = \"vuuDrawer\";\n\nconst sizeAttribute = (value: string | number) => {\n return typeof value === \"string\" ? value : value + \"px\";\n};\n\nconst getStyle = (\n styleProp?: CSSProperties,\n sizeOpen?: number,\n sizeClosed?: number,\n) => {\n const hasSizeOpen = sizeOpen !== undefined;\n const hasSizeClosed = sizeClosed !== undefined;\n\n if (!styleProp && !hasSizeClosed && !hasSizeOpen) {\n return undefined;\n }\n\n if (!hasSizeClosed && !hasSizeOpen) {\n return styleProp;\n }\n\n return {\n ...styleProp,\n \"--drawer-size\": hasSizeOpen ? sizeAttribute(sizeOpen) : undefined,\n \"--drawer-peek-size\": hasSizeClosed ? sizeAttribute(sizeClosed) : undefined,\n };\n};\n\nexport interface DrawerProps extends HTMLAttributes<HTMLDivElement> {\n clickToOpen?: boolean;\n defaultOpen?: boolean;\n inline?: boolean;\n open?: boolean;\n peekaboo?: boolean;\n position?: \"left\" | \"right\" | \"top\" | \"bottom\";\n sizeOpen?: number;\n sizeClosed?: number;\n toggleButton?: \"start\" | \"end\";\n}\nconst Drawer = ({\n children,\n className: classNameProp,\n clickToOpen,\n defaultOpen,\n sizeOpen,\n sizeClosed,\n style: styleProp,\n open: openProp,\n position = \"left\",\n inline,\n onClick,\n peekaboo = false,\n toggleButton,\n ...props\n}: DrawerProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-drawer\",\n css: drawerCss,\n window: targetWindow,\n });\n\n const [open, setOpen] = useControlled({\n controlled: openProp,\n default: defaultOpen ?? false,\n name: \"Drawer\",\n state: \"open\",\n });\n\n const className = cx(classBase, classNameProp, `${classBase}-${position}`, {\n [`${classBase}-open`]: open,\n [`${classBase}-inline`]: inline,\n [`${classBase}-over`]: !inline,\n [`${classBase}-peekaboo`]: peekaboo,\n });\n\n const toggleDrawer = useCallback(() => {\n setOpen(!open);\n }, [open, setOpen]);\n\n const style = getStyle(styleProp, sizeOpen, sizeClosed);\n\n const handleClick = clickToOpen ? toggleDrawer : onClick;\n\n const renderToggleButton = () => (\n <div className={cx(\"vuuToggleButton-container\")}>\n {open ? (\n <Button\n aria-label=\"close\"\n onClick={toggleDrawer}\n data-icon=\"close\"\n variant=\"secondary\"\n />\n ) : (\n <Button\n aria-label=\"open\"\n onClick={toggleDrawer}\n data-icon=\"close\"\n variant=\"secondary\"\n />\n )}\n </div>\n );\n\n return (\n <div {...props} className={className} onClick={handleClick} style={style}>\n {toggleButton == \"start\" ? renderToggleButton() : null}\n <div className={`${classBase}-liner`}>\n <div className={`${classBase}-content`}>{children}</div>\n </div>\n {toggleButton == \"end\" ? renderToggleButton() : null}\n </div>\n );\n};\nDrawer.displayName = \"Drawer\";\n\nexport default Drawer;\n"],"names":[],"mappings":"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"}
|
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import { boxContainsPoint, isContainer } from '@vuu-ui/vuu-utils';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { getProps } from '../utils/propUtils.js';
|
|
4
|
-
import { typeOf } from '../utils/typeOf.js';
|
|
5
|
-
|
|
6
|
-
const positionValues = {
|
|
7
|
-
north: 1,
|
|
8
|
-
east: 2,
|
|
9
|
-
south: 4,
|
|
10
|
-
west: 8,
|
|
11
|
-
header: 16,
|
|
12
|
-
centre: 32,
|
|
13
|
-
absolute: 64
|
|
14
|
-
};
|
|
15
|
-
const RelativeDropPosition = {
|
|
16
|
-
AFTER: "after",
|
|
17
|
-
BEFORE: "before"
|
|
18
|
-
};
|
|
19
|
-
const Position = Object.freeze({
|
|
20
|
-
North: _position("north"),
|
|
21
|
-
East: _position("east"),
|
|
22
|
-
South: _position("south"),
|
|
23
|
-
West: _position("west"),
|
|
24
|
-
Header: _position("header"),
|
|
25
|
-
Centre: _position("centre"),
|
|
26
|
-
Absolute: _position("absolute")
|
|
27
|
-
});
|
|
28
|
-
function _position(str) {
|
|
29
|
-
return Object.freeze({
|
|
30
|
-
offset: str === "north" || str === "west" ? 0 : str === "south" || str === "east" ? 1 : NaN,
|
|
31
|
-
valueOf: function() {
|
|
32
|
-
return positionValues[str];
|
|
33
|
-
},
|
|
34
|
-
toString: function() {
|
|
35
|
-
return str;
|
|
36
|
-
},
|
|
37
|
-
North: str === "north",
|
|
38
|
-
South: str === "south",
|
|
39
|
-
East: str === "east",
|
|
40
|
-
West: str === "west",
|
|
41
|
-
Header: str === "header",
|
|
42
|
-
Centre: str === "centre",
|
|
43
|
-
NorthOrSouth: str === "north" || str === "south",
|
|
44
|
-
EastOrWest: str === "east" || str === "west",
|
|
45
|
-
NorthOrWest: str === "north" || str === "west",
|
|
46
|
-
SouthOrEast: str === "east" || str === "south",
|
|
47
|
-
Absolute: str === "absolute"
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
const NORTH = Position.North, SOUTH = Position.South, EAST = Position.East, WEST = Position.West, HEADER = Position.Header, CENTRE = Position.Centre;
|
|
51
|
-
class BoxModel {
|
|
52
|
-
//TODO we should accept initial let,top offsets here
|
|
53
|
-
// if dropTargets are supplied, we will only allow drop operations directly on these targets
|
|
54
|
-
// TODO we will need to make this more flexible e.g allowing drop anywhere within these target
|
|
55
|
-
static measure(model, dropTargetPaths = []) {
|
|
56
|
-
const measurements = {};
|
|
57
|
-
measureRootComponent(model, measurements, dropTargetPaths);
|
|
58
|
-
return measurements;
|
|
59
|
-
}
|
|
60
|
-
static allBoxesContainingPoint(layout, measurements, x, y, validDropTargets) {
|
|
61
|
-
return allBoxesContainingPoint(
|
|
62
|
-
layout,
|
|
63
|
-
measurements,
|
|
64
|
-
x,
|
|
65
|
-
y,
|
|
66
|
-
validDropTargets
|
|
67
|
-
).reverse();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function pointPositionWithinRect(x, y, rect, borderZone = 30) {
|
|
71
|
-
const width = rect.right - rect.left;
|
|
72
|
-
const height = rect.bottom - rect.top;
|
|
73
|
-
const posX = x - rect.left;
|
|
74
|
-
const posY = y - rect.top;
|
|
75
|
-
let closeToTheEdge = 0;
|
|
76
|
-
if (posX < borderZone) closeToTheEdge += 8;
|
|
77
|
-
if (posX > width - borderZone) closeToTheEdge += 2;
|
|
78
|
-
if (posY < borderZone) closeToTheEdge += 1;
|
|
79
|
-
if (posY > height - borderZone) closeToTheEdge += 4;
|
|
80
|
-
return { pctX: posX / width, pctY: posY / height, closeToTheEdge };
|
|
81
|
-
}
|
|
82
|
-
function getPosition(x, y, rect, targetOrientation) {
|
|
83
|
-
const { BEFORE, AFTER } = RelativeDropPosition;
|
|
84
|
-
const { pctX, pctY, closeToTheEdge } = pointPositionWithinRect(x, y, rect);
|
|
85
|
-
let position;
|
|
86
|
-
let tab;
|
|
87
|
-
if (targetOrientation === "row") {
|
|
88
|
-
position = pctX < 0.5 ? WEST : EAST;
|
|
89
|
-
} else if (rect.header && boxContainsPoint(rect.header, x, y)) {
|
|
90
|
-
position = HEADER;
|
|
91
|
-
if (rect.Stack) {
|
|
92
|
-
const tabCount = rect.Stack.length;
|
|
93
|
-
if (tabCount === 0) {
|
|
94
|
-
tab = {
|
|
95
|
-
index: -1,
|
|
96
|
-
left: rect.left,
|
|
97
|
-
positionRelativeToTab: AFTER,
|
|
98
|
-
width: 0
|
|
99
|
-
};
|
|
100
|
-
} else {
|
|
101
|
-
const targetTab = rect.Stack.find(
|
|
102
|
-
({ left, right }) => x >= left && x <= right
|
|
103
|
-
);
|
|
104
|
-
if (targetTab) {
|
|
105
|
-
const tabWidth = targetTab.right - targetTab.left;
|
|
106
|
-
tab = {
|
|
107
|
-
index: rect.Stack.indexOf(targetTab),
|
|
108
|
-
left: targetTab.left,
|
|
109
|
-
positionRelativeToTab: (x - targetTab.left) / tabWidth < 0.5 ? BEFORE : AFTER,
|
|
110
|
-
width: tabWidth
|
|
111
|
-
};
|
|
112
|
-
} else {
|
|
113
|
-
const lastTab = rect.Stack[tabCount - 1];
|
|
114
|
-
tab = {
|
|
115
|
-
left: lastTab.right,
|
|
116
|
-
width: 0,
|
|
117
|
-
index: tabCount,
|
|
118
|
-
positionRelativeToTab: AFTER
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
} else if (rect.header.titleWidth) {
|
|
123
|
-
const tabWidth = rect.header.titleWidth;
|
|
124
|
-
tab = {
|
|
125
|
-
index: -1,
|
|
126
|
-
left: rect.left,
|
|
127
|
-
positionRelativeToTab: (x - rect.left) / tabWidth < 0.5 ? BEFORE : AFTER,
|
|
128
|
-
width: tabWidth
|
|
129
|
-
};
|
|
130
|
-
} else {
|
|
131
|
-
tab = {
|
|
132
|
-
left: rect.left,
|
|
133
|
-
width: 0,
|
|
134
|
-
positionRelativeToTab: BEFORE,
|
|
135
|
-
index: -1
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
} else {
|
|
139
|
-
position = getPositionWithinBox(x, y, rect, pctX, pctY);
|
|
140
|
-
}
|
|
141
|
-
return { position, x, y, closeToTheEdge, tab };
|
|
142
|
-
}
|
|
143
|
-
function getPositionWithinBox(x, y, rect, pctX, pctY) {
|
|
144
|
-
const centerBox = getCenteredBox(rect, 0.2);
|
|
145
|
-
if (boxContainsPoint(centerBox, x, y)) {
|
|
146
|
-
return CENTRE;
|
|
147
|
-
} else {
|
|
148
|
-
const quadrant = `${pctY < 0.5 ? "north" : "south"}${pctX < 0.5 ? "west" : "east"}`;
|
|
149
|
-
switch (quadrant) {
|
|
150
|
-
case "northwest":
|
|
151
|
-
return pctX > pctY ? NORTH : WEST;
|
|
152
|
-
case "northeast":
|
|
153
|
-
return 1 - pctX > pctY ? NORTH : EAST;
|
|
154
|
-
case "southeast":
|
|
155
|
-
return pctX > pctY ? EAST : SOUTH;
|
|
156
|
-
case "southwest":
|
|
157
|
-
return 1 - pctX > pctY ? WEST : SOUTH;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function getCenteredBox({ right, left, top, bottom }, pctSize) {
|
|
162
|
-
const pctOffset = (1 - pctSize) / 2;
|
|
163
|
-
const w = (right - left) * pctOffset;
|
|
164
|
-
const h = (bottom - top) * pctOffset;
|
|
165
|
-
return { left: left + w, top: top + h, right: right - w, bottom: bottom - h };
|
|
166
|
-
}
|
|
167
|
-
function measureRootComponent(rootComponent, measurements, dropTargets) {
|
|
168
|
-
const {
|
|
169
|
-
id,
|
|
170
|
-
"data-path": dataPath,
|
|
171
|
-
path = dataPath
|
|
172
|
-
} = getProps(rootComponent);
|
|
173
|
-
const type = typeOf(rootComponent);
|
|
174
|
-
if (id && path) {
|
|
175
|
-
const [rect, el] = measureComponentDomElement(rootComponent);
|
|
176
|
-
measureComponent(rootComponent, rect, el, measurements);
|
|
177
|
-
if (isContainer(type)) {
|
|
178
|
-
collectChildMeasurements(rootComponent, measurements, dropTargets);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function measureComponent(component, rect, el, measurements) {
|
|
183
|
-
const {
|
|
184
|
-
"data-path": dataPath,
|
|
185
|
-
path = dataPath,
|
|
186
|
-
header
|
|
187
|
-
} = getProps(component);
|
|
188
|
-
measurements[path] = rect;
|
|
189
|
-
const type = typeOf(component);
|
|
190
|
-
if (header || type === "Stack") {
|
|
191
|
-
const query = type === "Stack" ? ".vuuTabstrip" : ".vuuHeader";
|
|
192
|
-
const headerEl = el.querySelector(query);
|
|
193
|
-
if (headerEl) {
|
|
194
|
-
const { top, left, right, bottom } = headerEl.getBoundingClientRect();
|
|
195
|
-
measurements[path].header = {
|
|
196
|
-
top: Math.round(top),
|
|
197
|
-
left: Math.round(left),
|
|
198
|
-
right: Math.round(right),
|
|
199
|
-
bottom: Math.round(bottom)
|
|
200
|
-
};
|
|
201
|
-
if (type === "Stack") {
|
|
202
|
-
measurements[path].Stack = Array.from(
|
|
203
|
-
headerEl.querySelectorAll(".vuuTab")
|
|
204
|
-
).map((tab) => tab.getBoundingClientRect()).map(({ left: left2, right: right2 }) => ({ left: left2, right: right2 }));
|
|
205
|
-
} else {
|
|
206
|
-
const titleEl = headerEl.querySelector('[class^="vuuHeader-title"]');
|
|
207
|
-
const { header: header2 } = measurements[path];
|
|
208
|
-
if (titleEl && header2) {
|
|
209
|
-
header2.titleWidth = titleEl.clientWidth;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return measurements[path];
|
|
215
|
-
}
|
|
216
|
-
function collectChildMeasurements(component, measurements, dropTargets, preX = 0, posX = 0, preY = 0, posY = 0) {
|
|
217
|
-
const {
|
|
218
|
-
children,
|
|
219
|
-
"data-path": dataPath,
|
|
220
|
-
path = dataPath,
|
|
221
|
-
style,
|
|
222
|
-
active = 0
|
|
223
|
-
} = getProps(component);
|
|
224
|
-
const type = typeOf(component);
|
|
225
|
-
const isFlexbox = type === "Flexbox";
|
|
226
|
-
const isStack = type === "Stack";
|
|
227
|
-
const isTower = isFlexbox && style.flexDirection === "column";
|
|
228
|
-
const isTerrace = isFlexbox && style.flexDirection === "row";
|
|
229
|
-
const childrenToMeasure = isStack ? children.filter((_child, idx) => idx === active) : children.filter(omitDragging);
|
|
230
|
-
const childMeasurements = childrenToMeasure.map(
|
|
231
|
-
(child) => {
|
|
232
|
-
const [rect, el] = measureComponentDomElement(child);
|
|
233
|
-
return [
|
|
234
|
-
{
|
|
235
|
-
...rect,
|
|
236
|
-
top: rect.top - preY,
|
|
237
|
-
right: rect.right + posX,
|
|
238
|
-
bottom: rect.bottom + posY,
|
|
239
|
-
left: rect.left - preX
|
|
240
|
-
},
|
|
241
|
-
el,
|
|
242
|
-
child
|
|
243
|
-
];
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
const expandedMeasurements = childMeasurements.map(
|
|
247
|
-
([rect, el, child], i, all) => {
|
|
248
|
-
let localPreX;
|
|
249
|
-
let localPosX;
|
|
250
|
-
let localPreY;
|
|
251
|
-
let localPosY;
|
|
252
|
-
let gapPre;
|
|
253
|
-
let gapPos;
|
|
254
|
-
const n = all.length - 1;
|
|
255
|
-
if (isTerrace) {
|
|
256
|
-
gapPre = i === 0 ? 0 : rect.left - all[i - 1][0].right;
|
|
257
|
-
gapPos = i === n ? 0 : all[i + 1][0].left - rect.right;
|
|
258
|
-
localPreX = i === 0 ? 0 : gapPre === 0 ? 0 : gapPre;
|
|
259
|
-
localPosX = i === n ? 0 : gapPos === 0 ? 0 : gapPos - gapPos / 2;
|
|
260
|
-
rect.left -= localPreX;
|
|
261
|
-
rect.right += localPosX;
|
|
262
|
-
localPreY = preY;
|
|
263
|
-
localPosY = posY;
|
|
264
|
-
} else if (isTower) {
|
|
265
|
-
gapPre = i === 0 ? 0 : rect.top - all[i - 1][0].bottom;
|
|
266
|
-
gapPos = i === n ? 0 : all[i + 1][0].top - rect.bottom;
|
|
267
|
-
localPreY = i === 0 ? 0 : gapPre === 0 ? 0 : gapPre;
|
|
268
|
-
localPosY = i === n ? 0 : gapPos === 0 ? 0 : gapPos - gapPos / 2;
|
|
269
|
-
rect.top -= localPreY;
|
|
270
|
-
rect.bottom += localPosY;
|
|
271
|
-
localPreX = preX;
|
|
272
|
-
localPosX = posX;
|
|
273
|
-
}
|
|
274
|
-
const componentMeasurements = measureComponent(
|
|
275
|
-
child,
|
|
276
|
-
rect,
|
|
277
|
-
el,
|
|
278
|
-
measurements
|
|
279
|
-
);
|
|
280
|
-
const childType = typeOf(child);
|
|
281
|
-
if (isContainer(childType)) {
|
|
282
|
-
collectChildMeasurements(
|
|
283
|
-
child,
|
|
284
|
-
measurements,
|
|
285
|
-
dropTargets,
|
|
286
|
-
localPreX,
|
|
287
|
-
localPosX,
|
|
288
|
-
localPreY,
|
|
289
|
-
localPosY
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
return componentMeasurements;
|
|
293
|
-
}
|
|
294
|
-
);
|
|
295
|
-
if (childMeasurements.length) {
|
|
296
|
-
measurements[path].children = expandedMeasurements;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
function omitDragging(component) {
|
|
300
|
-
const { id } = getProps(component);
|
|
301
|
-
const el = document.getElementById(id);
|
|
302
|
-
if (el) {
|
|
303
|
-
return el.dataset.dragging !== "true";
|
|
304
|
-
} else {
|
|
305
|
-
console.warn(`BoxModel: no element found with id #${id}`);
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
function measureComponentDomElement(component) {
|
|
310
|
-
const { id } = getProps(component);
|
|
311
|
-
if (id === void 0) {
|
|
312
|
-
throw Error("`BoxModel.measureComponentElement, component has no id");
|
|
313
|
-
}
|
|
314
|
-
const el = document.getElementById(id);
|
|
315
|
-
if (!el) {
|
|
316
|
-
throw Error(
|
|
317
|
-
"BoxModel.measureComponentElement, no DOM element found for component"
|
|
318
|
-
);
|
|
319
|
-
}
|
|
320
|
-
const { top, left, right, bottom, height, width } = el.getBoundingClientRect();
|
|
321
|
-
let scrolling = void 0;
|
|
322
|
-
const type = typeOf(component);
|
|
323
|
-
if (isContainer(type)) {
|
|
324
|
-
const scrollHeight = el.scrollHeight;
|
|
325
|
-
if (scrollHeight > height) {
|
|
326
|
-
scrolling = { id, scrollHeight, scrollTop: el.scrollTop };
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
return [
|
|
330
|
-
{
|
|
331
|
-
top: Math.round(top),
|
|
332
|
-
left: Math.round(left),
|
|
333
|
-
right: Math.round(right),
|
|
334
|
-
bottom: Math.round(bottom),
|
|
335
|
-
height: Math.round(height),
|
|
336
|
-
width: Math.round(width),
|
|
337
|
-
scrolling
|
|
338
|
-
},
|
|
339
|
-
el,
|
|
340
|
-
component
|
|
341
|
-
];
|
|
342
|
-
}
|
|
343
|
-
function allBoxesContainingPoint(component, measurements, x, y, dropTargets, boxes = []) {
|
|
344
|
-
const {
|
|
345
|
-
children,
|
|
346
|
-
"data-path": dataPath,
|
|
347
|
-
path = dataPath
|
|
348
|
-
} = getProps(component);
|
|
349
|
-
const type = typeOf(component);
|
|
350
|
-
const rect = measurements[path];
|
|
351
|
-
if (!boxContainsPoint(rect, x, y)) return boxes;
|
|
352
|
-
if (dropTargets && dropTargets.length) {
|
|
353
|
-
if (dropTargets.includes(path)) {
|
|
354
|
-
boxes.push(component);
|
|
355
|
-
} else if (dropTargets.some((dropTargetPath) => dropTargetPath.startsWith(path))) ; else {
|
|
356
|
-
return boxes;
|
|
357
|
-
}
|
|
358
|
-
} else {
|
|
359
|
-
boxes.push(component);
|
|
360
|
-
}
|
|
361
|
-
if (!isContainer(type)) {
|
|
362
|
-
return boxes;
|
|
363
|
-
}
|
|
364
|
-
if (rect.header && boxContainsPoint(rect.header, x, y)) {
|
|
365
|
-
return boxes;
|
|
366
|
-
}
|
|
367
|
-
if (rect.scrolling) {
|
|
368
|
-
scrollIntoViewIfNeccesary(rect, x, y);
|
|
369
|
-
}
|
|
370
|
-
for (let i = 0; i < children.length; i++) {
|
|
371
|
-
if (type === "Stack" && component.props.active !== i) {
|
|
372
|
-
continue;
|
|
373
|
-
}
|
|
374
|
-
const nestedBoxes = allBoxesContainingPoint(
|
|
375
|
-
children[i],
|
|
376
|
-
measurements,
|
|
377
|
-
x,
|
|
378
|
-
y,
|
|
379
|
-
dropTargets
|
|
380
|
-
);
|
|
381
|
-
if (nestedBoxes.length) {
|
|
382
|
-
return boxes.concat(nestedBoxes);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
return boxes;
|
|
386
|
-
}
|
|
387
|
-
function scrollIntoViewIfNeccesary({ top, bottom, scrolling }, x, y) {
|
|
388
|
-
if (scrolling) {
|
|
389
|
-
const { id, scrollTop, scrollHeight } = scrolling;
|
|
390
|
-
const height = bottom - top;
|
|
391
|
-
if (scrollTop === 0 && bottom - y < 50) {
|
|
392
|
-
const scrollMax = scrollHeight - height;
|
|
393
|
-
const el = document.getElementById(id);
|
|
394
|
-
el.scrollTo({ left: 0, top: scrollMax, behavior: "smooth" });
|
|
395
|
-
scrolling.scrollTop = scrollMax;
|
|
396
|
-
} else if (scrollTop > 0 && y - top < 50) {
|
|
397
|
-
const el = document.getElementById(id);
|
|
398
|
-
el.scrollTo({ left: 0, top: 0, behavior: "smooth" });
|
|
399
|
-
scrolling.scrollTop = 0;
|
|
400
|
-
} else {
|
|
401
|
-
return false;
|
|
402
|
-
}
|
|
403
|
-
} else {
|
|
404
|
-
return false;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
export { BoxModel, Position, RelativeDropPosition, getPosition, pointPositionWithinRect, positionValues };
|
|
409
|
-
//# sourceMappingURL=BoxModel.js.map
|