@vuu-ui/vuu-shell 4.0.0-alpha.9 → 4.0.0-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 +19 -20
- package/src/app-header/AppHeader.css.js +1 -1
- package/src/app-header/AppHeader.js +26 -36
- package/src/application-provider/ApplicationContext.js +5 -2
- package/src/application-provider/ApplicationProvider.js +59 -8
- package/src/feature/Feature.js +34 -3
- package/src/feature/FeatureErrorBoundary.js +33 -0
- package/src/feature/index.js +0 -1
- package/src/feature-list/FeatureList.css.js +5 -27
- package/src/feature-list/FeatureList.js +96 -117
- package/src/index.js +3 -3
- package/src/left-nav/LeftNav.css.js +4 -2
- package/src/left-nav/LeftNav.js +100 -139
- package/src/persistence-manager/PersistenceProvider.js +3 -10
- package/src/persistence-manager/index.js +0 -3
- package/src/shell-layout-templates/context-panel/ContextPanel.css.js +8 -8
- package/src/shell-layout-templates/context-panel/ContextPanel.js +35 -17
- package/src/shell-layout-templates/context-panel/index.js +0 -1
- package/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +40 -54
- package/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +64 -54
- package/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +28 -49
- package/src/shell-layout-templates/side-panel/SidePanel.css.js +1 -3
- package/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +35 -43
- package/src/shell.css.js +3 -86
- package/src/shell.js +70 -148
- package/src/user-settings/SettingsForm.css.js +10 -0
- package/src/user-settings/SettingsForm.js +141 -0
- package/src/user-settings/UserSettingsPanel.css.js +9 -0
- package/src/user-settings/UserSettingsPanel.js +29 -0
- package/src/user-settings/index.js +2 -0
- package/src/workspace-management/LayoutList.js +99 -59
- package/src/workspace-management/SaveLayoutPanel.js +3 -3
- package/src/workspace-management/WorkspaceProvider.js +178 -699
- package/src/workspace-management/index.js +0 -8
- package/src/workspace-management/useWorkspaceContextMenuItems.js +6 -12
- package/types/app-header/AppHeader.d.ts +2 -2
- package/types/application-provider/ApplicationContext.d.ts +6 -1
- package/types/application-provider/ApplicationProvider.d.ts +14 -5
- package/types/feature/Feature.d.ts +10 -2
- package/types/feature/FeatureErrorBoundary.d.ts +1 -1
- package/types/feature/Loader.d.ts +1 -1
- package/types/feature/index.d.ts +1 -2
- package/types/feature-list/FeatureList.d.ts +4 -4
- package/types/index.d.ts +3 -3
- package/types/left-nav/LeftNav.d.ts +1 -2
- package/types/login/LoginPanel.d.ts +1 -1
- package/types/login/VuuLogo.d.ts +1 -1
- package/types/persistence-manager/PersistenceProvider.d.ts +3 -7
- package/types/persistence-manager/index.d.ts +0 -3
- package/types/shell-layout-templates/context-panel/ContextPanel.d.ts +11 -9
- package/types/shell-layout-templates/context-panel/index.d.ts +0 -1
- package/types/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +1 -1
- package/types/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +1 -1
- package/types/shell-layout-templates/left-main-tabs/useLeftMainTabs.d.ts +1 -1
- package/types/shell-layout-templates/side-panel/SidePanel.d.ts +1 -1
- package/types/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +1 -1
- package/types/shell-layout-templates/useShellLayout.d.ts +2 -4
- package/types/shell.d.ts +15 -19
- package/types/theme-switch/ThemeSwitch.d.ts +1 -1
- package/types/workspace-management/LayoutList.d.ts +2 -2
- package/types/workspace-management/LayoutTile.d.ts +1 -1
- package/types/workspace-management/SaveLayoutPanel.d.ts +2 -2
- package/types/workspace-management/WorkspaceProvider.d.ts +50 -61
- package/types/workspace-management/defaultWorkspaceJSON.d.ts +6 -7
- package/types/workspace-management/index.d.ts +0 -8
- package/types/workspace-management/useWorkspaceContextMenuItems.d.ts +1 -1
- package/src/module-registry/getRegisteredModules.js +0 -12
- package/src/persistence-manager/LocalWorkspacePersistenceService.js +0 -129
- package/src/persistence-manager/RemoteWorkspacePersistenceService.js +0 -112
- package/src/persistence-manager/WorkspacePersistenceService.js +0 -9
- package/src/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.js +0 -24
- package/src/workspace-management/WorkspaceController.js +0 -73
- package/src/workspace-management/WorkspaceHost.js +0 -194
- package/src/workspace-management/WorkspacePersistentState.js +0 -67
- package/src/workspace-management/WorkspaceRepository.js +0 -127
- package/src/workspace-management/WorkspaceStartPanel.css.js +0 -44
- package/src/workspace-management/WorkspaceStartPanel.js +0 -34
- package/src/workspace-management/shell-workspace-components.js +0 -59
- package/src/workspace-management/workspace-component-registry.js +0 -30
- package/src/workspace-management/workspace-schemas.js +0 -257
- package/types/module-registry/getRegisteredModules.d.ts +0 -5
- package/types/persistence-manager/LocalWorkspacePersistenceService.d.ts +0 -18
- package/types/persistence-manager/RemoteWorkspacePersistenceService.d.ts +0 -25
- package/types/persistence-manager/WorkspacePersistenceService.d.ts +0 -27
- package/types/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.d.ts +0 -1
- package/types/src/ShellContextProvider.d.ts +0 -7
- package/types/src/app-header/AppHeader.d.ts +0 -6
- package/types/src/app-header/index.d.ts +0 -1
- package/types/src/application-provider/ApplicationContext.d.ts +0 -11
- package/types/src/application-provider/ApplicationProvider.d.ts +0 -17
- package/types/src/application-provider/index.d.ts +0 -1
- package/types/src/feature/Feature.d.ts +0 -10
- package/types/src/feature/FeatureErrorBoundary.d.ts +0 -13
- package/types/src/feature/Loader.d.ts +0 -1
- package/types/src/feature/index.d.ts +0 -1
- package/types/src/feature-and-layout-provider/FeatureAndLayoutProvider.d.ts +0 -19
- package/types/src/feature-and-layout-provider/index.d.ts +0 -1
- package/types/src/feature-list/FeatureList.d.ts +0 -7
- package/types/src/feature-list/index.d.ts +0 -1
- package/types/src/get-layout-history.d.ts +0 -8
- package/types/src/index.d.ts +0 -14
- package/types/src/left-nav/LeftNav.d.ts +0 -14
- package/types/src/left-nav/index.d.ts +0 -1
- package/types/src/login/LoginPanel.d.ts +0 -6
- package/types/src/login/VuuLogo.d.ts +0 -1
- package/types/src/persistence-manager/LocalPersistenceManager.d.ts +0 -20
- package/types/src/persistence-manager/PersistenceManager.d.ts +0 -71
- package/types/src/persistence-manager/PersistenceProvider.d.ts +0 -11
- package/types/src/persistence-manager/RemotePersistenceManager.d.ts +0 -25
- package/types/src/persistence-manager/StaticPersistenceManager.d.ts +0 -25
- package/types/src/persistence-manager/index.d.ts +0 -5
- package/types/src/shell-layout-templates/context-panel/ContextPanel.d.ts +0 -13
- package/types/src/shell-layout-templates/context-panel/index.d.ts +0 -1
- package/types/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +0 -2
- package/types/src/shell-layout-templates/index.d.ts +0 -3
- package/types/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +0 -2
- package/types/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.d.ts +0 -2
- package/types/src/shell-layout-templates/side-panel/SidePanel.d.ts +0 -8
- package/types/src/shell-layout-templates/side-panel/index.d.ts +0 -1
- package/types/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +0 -2
- package/types/src/shell-layout-templates/useShellLayout.d.ts +0 -51
- package/types/src/shell.d.ts +0 -17
- package/types/src/theme-switch/ThemeSwitch.d.ts +0 -8
- package/types/src/theme-switch/index.d.ts +0 -1
- package/types/src/user-settings/SettingsForm.d.ts +0 -46
- package/types/src/user-settings/UserSettingsPanel.d.ts +0 -3
- package/types/src/user-settings/index.d.ts +0 -2
- package/types/src/workspace-management/LayoutList.d.ts +0 -2
- package/types/src/workspace-management/LayoutTile.d.ts +0 -7
- package/types/src/workspace-management/SaveLayoutPanel.d.ts +0 -9
- package/types/src/workspace-management/WorkspaceProvider.d.ts +0 -52
- package/types/src/workspace-management/defaultWorkspaceJSON.d.ts +0 -10
- package/types/src/workspace-management/index.d.ts +0 -5
- package/types/src/workspace-management/screenshot-utils.d.ts +0 -6
- package/types/src/workspace-management/useWorkspaceContextMenuItems.d.ts +0 -5
- package/types/workspace-management/WorkspaceController.d.ts +0 -32
- package/types/workspace-management/WorkspaceHost.d.ts +0 -1
- package/types/workspace-management/WorkspacePersistentState.d.ts +0 -19
- package/types/workspace-management/WorkspaceRepository.d.ts +0 -13
- package/types/workspace-management/WorkspaceStartPanel.d.ts +0 -1
- package/types/workspace-management/shell-workspace-components.d.ts +0 -2
- package/types/workspace-management/workspace-component-registry.d.ts +0 -12
- package/types/workspace-management/workspace-schemas.d.ts +0 -69
|
@@ -1,58 +1,68 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
const useInlayLeftPanel = ({ SidePanelProps, appHeader, htmlAttributes
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
2
|
+
import { DockLayout, Drawer, Flexbox, LayoutContainer, View } from "@vuu-ui/vuu-layout";
|
|
3
|
+
import { VuuShellLocation } from "@vuu-ui/vuu-utils";
|
|
4
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
5
|
+
const useInlayLeftPanel = ({ SidePanelProps: LeftSidePanelProps, appHeader, htmlAttributes })=>{
|
|
6
|
+
const paletteView = useRef(null);
|
|
7
|
+
const [open, setOpen] = useState(true);
|
|
8
|
+
const handleDrawerClick = useCallback((e)=>{
|
|
9
|
+
const target = e.target;
|
|
10
|
+
if (!paletteView.current?.contains(target)) setOpen(!open);
|
|
11
|
+
}, [
|
|
12
|
+
open
|
|
13
|
+
]);
|
|
14
|
+
return useMemo(()=>{
|
|
15
|
+
const getDrawers = (leftSidePanel)=>{
|
|
16
|
+
const drawers = [];
|
|
17
|
+
drawers.push(/*#__PURE__*/ jsx(Drawer, {
|
|
18
|
+
onClick: handleDrawerClick,
|
|
19
|
+
open: open,
|
|
20
|
+
position: "left",
|
|
21
|
+
inline: true,
|
|
22
|
+
peekaboo: true,
|
|
23
|
+
sizeOpen: 200,
|
|
24
|
+
toggleButton: "end",
|
|
25
|
+
children: /*#__PURE__*/ jsx(View, {
|
|
26
|
+
className: "vuuShell-palette",
|
|
27
|
+
id: "vw-app-palette",
|
|
28
|
+
ref: paletteView,
|
|
29
|
+
style: {
|
|
30
|
+
height: "100%"
|
|
31
|
+
},
|
|
32
|
+
children: leftSidePanel
|
|
33
|
+
}, "app-palette")
|
|
34
|
+
}, "left-panel"));
|
|
35
|
+
return drawers;
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/ jsxs(Flexbox, {
|
|
38
|
+
...htmlAttributes,
|
|
39
|
+
style: {
|
|
40
|
+
...htmlAttributes?.style,
|
|
41
|
+
flexDirection: "column"
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
appHeader,
|
|
45
|
+
/*#__PURE__*/ jsx(DockLayout, {
|
|
46
|
+
style: {
|
|
47
|
+
flex: 1
|
|
48
|
+
},
|
|
49
|
+
children: getDrawers(LeftSidePanelProps?.children).concat(/*#__PURE__*/ jsx(LayoutContainer, {
|
|
50
|
+
dropTarget: true,
|
|
51
|
+
id: VuuShellLocation.WorkspaceContainer,
|
|
52
|
+
style: {
|
|
53
|
+
width: "100%",
|
|
54
|
+
height: "100%"
|
|
55
|
+
}
|
|
56
|
+
}, "main-content"))
|
|
38
57
|
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
49
|
-
id: "vuu-shell-context",
|
|
50
|
-
style: {
|
|
51
|
-
gridArea: "1/3/3/4"
|
|
52
|
-
},
|
|
53
|
-
children: /*#__PURE__*/ jsx(ApplicationSettingsContextPanel, {})
|
|
54
|
-
})
|
|
55
|
-
]
|
|
56
|
-
});
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}, [
|
|
61
|
+
LeftSidePanelProps,
|
|
62
|
+
appHeader,
|
|
63
|
+
handleDrawerClick,
|
|
64
|
+
htmlAttributes,
|
|
65
|
+
open
|
|
66
|
+
]);
|
|
57
67
|
};
|
|
58
68
|
export { useInlayLeftPanel };
|
|
@@ -1,53 +1,32 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
import { Flexbox, StackLayout } from "@vuu-ui/vuu-layout";
|
|
3
|
+
import { VuuShellLocation } from "@vuu-ui/vuu-utils";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
const useLeftMainTabs = ({ appHeader, htmlAttributes, ToolbarProps })=>{
|
|
6
|
+
if (void 0 === ToolbarProps) throw Error("LeftMainTabs layout requires ToolbarProps");
|
|
7
|
+
return useMemo(()=>/*#__PURE__*/ jsxs(Flexbox, {
|
|
8
|
+
...htmlAttributes,
|
|
9
|
+
style: {
|
|
10
|
+
...htmlAttributes?.style,
|
|
11
|
+
flexDirection: "column"
|
|
12
|
+
},
|
|
13
|
+
children: [
|
|
14
|
+
appHeader,
|
|
15
|
+
/*#__PURE__*/ jsx(StackLayout, {
|
|
16
|
+
TabstripProps: {
|
|
17
|
+
className: `${VuuShellLocation.MultiWorkspaceContainer}-tabs`
|
|
18
|
+
},
|
|
19
|
+
active: 0,
|
|
20
|
+
showTabs: "left",
|
|
21
|
+
style: {
|
|
22
|
+
flex: 1
|
|
23
|
+
},
|
|
24
|
+
id: VuuShellLocation.MultiWorkspaceContainer
|
|
25
|
+
})
|
|
18
26
|
]
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
id: "vuu-shell-header",
|
|
24
|
-
style: {
|
|
25
|
-
gridArea: "1/1/2/3"
|
|
26
|
-
},
|
|
27
|
-
children: appHeader
|
|
28
|
-
}),
|
|
29
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
30
|
-
id: "vuu-shell-toolbar",
|
|
31
|
-
style: {
|
|
32
|
-
gridArea: "2/1/3/2"
|
|
33
|
-
},
|
|
34
|
-
children: ToolbarProps?.children
|
|
35
|
-
}),
|
|
36
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
37
|
-
id: "vuu-shell-workspace-host",
|
|
38
|
-
style: {
|
|
39
|
-
gridArea: "2/2/3/3"
|
|
40
|
-
},
|
|
41
|
-
children: workspaceHost
|
|
42
|
-
}),
|
|
43
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
44
|
-
id: "vuu-shell-context",
|
|
45
|
-
style: {
|
|
46
|
-
gridArea: "1/3/3/4"
|
|
47
|
-
},
|
|
48
|
-
children: /*#__PURE__*/ jsx(ApplicationSettingsContextPanel, {})
|
|
49
|
-
})
|
|
50
|
-
]
|
|
51
|
-
});
|
|
27
|
+
}), [
|
|
28
|
+
appHeader,
|
|
29
|
+
htmlAttributes
|
|
30
|
+
]);
|
|
52
31
|
};
|
|
53
32
|
export { useLeftMainTabs };
|
|
@@ -1,46 +1,38 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { Flexbox, LayoutContainer } from "@vuu-ui/vuu-layout";
|
|
3
|
+
import { VuuShellLocation } from "@vuu-ui/vuu-utils";
|
|
4
|
+
import { ContextPanel } from "../context-panel/index.js";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
const useSimpleContentPane = ({ appHeader, htmlAttributes })=>useMemo(()=>/*#__PURE__*/ jsxs(Flexbox, {
|
|
7
|
+
...htmlAttributes,
|
|
8
|
+
style: {
|
|
9
|
+
...htmlAttributes?.style,
|
|
10
|
+
flexDirection: "row"
|
|
11
|
+
},
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsxs(Flexbox, {
|
|
14
|
+
className: "vuuShell-content",
|
|
15
|
+
style: {
|
|
16
|
+
flex: 1,
|
|
17
|
+
flexDirection: "column"
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
appHeader,
|
|
21
|
+
/*#__PURE__*/ jsx(LayoutContainer, {
|
|
22
|
+
id: VuuShellLocation.WorkspaceContainer,
|
|
23
|
+
style: {
|
|
24
|
+
flex: 1
|
|
25
|
+
}
|
|
26
|
+
}, "main-content")
|
|
27
|
+
]
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ jsx(ContextPanel, {
|
|
30
|
+
id: VuuShellLocation.ContextPanel,
|
|
31
|
+
overlay: true
|
|
32
|
+
})
|
|
17
33
|
]
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
id: "vuu-shell-header",
|
|
23
|
-
style: {
|
|
24
|
-
gridArea: "1/1/2/2"
|
|
25
|
-
},
|
|
26
|
-
children: appHeader
|
|
27
|
-
}),
|
|
28
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
29
|
-
className: "vuuShell-content",
|
|
30
|
-
id: "vuu-shell-workspace-host",
|
|
31
|
-
style: {
|
|
32
|
-
gridArea: "2/1/3/2"
|
|
33
|
-
},
|
|
34
|
-
children: workspaceHost
|
|
35
|
-
}),
|
|
36
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
37
|
-
id: "vuu-shell-context",
|
|
38
|
-
style: {
|
|
39
|
-
gridArea: "1/2/3/3"
|
|
40
|
-
},
|
|
41
|
-
children: /*#__PURE__*/ jsx(ApplicationSettingsContextPanel, {})
|
|
42
|
-
})
|
|
43
|
-
]
|
|
44
|
-
});
|
|
45
|
-
};
|
|
34
|
+
}), [
|
|
35
|
+
appHeader,
|
|
36
|
+
htmlAttributes
|
|
37
|
+
]);
|
|
46
38
|
export { useSimpleContentPane };
|
package/src/shell.css.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
const css = `
|
|
2
|
-
.vuuShell
|
|
2
|
+
.vuuShell {
|
|
3
3
|
background-color: var(--vuuShell-background, var(--salt-container-primary-background));
|
|
4
4
|
height: var(--vuuShell-height, 100vh);
|
|
5
5
|
width: var(--vuuShell-width, 100vw);
|
|
6
|
-
padding: 0;
|
|
7
6
|
|
|
8
7
|
& .left-main-tabs {
|
|
9
8
|
--vuuOverflowContainer-width: 48px;
|
|
@@ -20,7 +19,7 @@ const css = `
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
.vuuShell-warningPlaceholder {
|
|
23
|
-
background-color: var(--salt-container-background
|
|
22
|
+
background-color: var(--salt-container-tertiary-background);
|
|
24
23
|
height: 100%;
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -52,89 +51,7 @@ const css = `
|
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
.vuuShell-content {
|
|
55
|
-
padding: var(--vuuShell-content-padding, 8px
|
|
56
|
-
margin: 0 8px 8px 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.vuuShell-staticGrid, .vuuWorkspaceHost, .vuuWorkspaceHost-content, .vuuWorkspaceHost-workspace {
|
|
60
|
-
width: 100%;
|
|
61
|
-
min-width: 0;
|
|
62
|
-
height: 100%;
|
|
63
|
-
min-height: 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.vuuShell-staticGrid {
|
|
67
|
-
--vuu-grid-gap: 0px;
|
|
68
|
-
overflow: hidden;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.vuuShell-staticGrid > .vuuGridLayoutItem {
|
|
72
|
-
border: 0;
|
|
73
|
-
min-width: 0;
|
|
74
|
-
min-height: 0;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.vuuShell-staticGrid > #vuu-shell-workspace-host {
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.vuuLeftNav > .vuuGridLayout {
|
|
82
|
-
--vuu-grid-gap: 0px;
|
|
83
|
-
width: max-content;
|
|
84
|
-
height: 100%;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.vuuLeftNav > .vuuGridLayout > .vuuGridLayoutItem {
|
|
88
|
-
border: 0;
|
|
89
|
-
min-width: 0;
|
|
90
|
-
min-height: 0;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.vuuWorkspaceHost {
|
|
94
|
-
flex-direction: column;
|
|
95
|
-
display: flex;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.vuuWorkspaceHost-content {
|
|
99
|
-
flex: auto;
|
|
100
|
-
min-height: 0;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.vuuWorkspaceHost-workspace[hidden] {
|
|
104
|
-
display: none;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.vuuWorkspaceHost-workspace {
|
|
108
|
-
position: relative;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.vuuWorkspaceHost-workspace > .vuuGridLayout {
|
|
112
|
-
width: 100%;
|
|
113
|
-
min-width: 0;
|
|
114
|
-
height: 100%;
|
|
115
|
-
min-height: 0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.vuuWorkspaceHost-state {
|
|
119
|
-
justify-content: center;
|
|
120
|
-
align-items: center;
|
|
121
|
-
height: 100%;
|
|
122
|
-
display: flex;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.vuuWorkspaceHost-empty {
|
|
126
|
-
width: 100%;
|
|
127
|
-
min-width: 0;
|
|
128
|
-
height: 100%;
|
|
129
|
-
min-height: 0;
|
|
130
|
-
position: relative;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.vuuWorkspaceHost-emptyGrid {
|
|
134
|
-
width: 100%;
|
|
135
|
-
min-width: 0;
|
|
136
|
-
height: 100%;
|
|
137
|
-
min-height: 0;
|
|
54
|
+
padding: var(--vuuShell-content-padding, 8px);
|
|
138
55
|
}
|
|
139
56
|
|
|
140
57
|
|
package/src/shell.js
CHANGED
|
@@ -1,186 +1,108 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { GridLayout, GridLayoutItem, GridLayoutProvider } from "@vuu-ui/grid-layout";
|
|
3
2
|
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
4
3
|
import { useWindow } from "@salt-ds/window";
|
|
5
|
-
import { useAuthenticatedUser } from "@vuu-ui/core";
|
|
6
4
|
import { ContextMenuProvider } from "@vuu-ui/vuu-context-menu";
|
|
7
|
-
import {
|
|
5
|
+
import { LayoutProvider, StackLayout } from "@vuu-ui/vuu-layout";
|
|
8
6
|
import { NotificationsProvider } from "@vuu-ui/vuu-notifications";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import { createContext, isValidElement, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { ModalProvider } from "@vuu-ui/vuu-ui-controls";
|
|
8
|
+
import { logger, registerComponent } from "@vuu-ui/vuu-utils";
|
|
9
|
+
import { useCallback, useMemo } from "react";
|
|
13
10
|
import { AppHeader } from "./app-header/index.js";
|
|
14
11
|
import { ApplicationProvider } from "./application-provider/index.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
12
|
+
import { LocalPersistenceManager, PersistenceProvider, usePersistenceManager } from "./persistence-manager/index.js";
|
|
13
|
+
import { useShellLayout } from "./shell-layout-templates/index.js";
|
|
14
|
+
import { UserSettingsPanel } from "./user-settings/index.js";
|
|
15
|
+
import { WorkspaceProvider, useWorkspace, useWorkspaceContextMenuItems } from "./workspace-management/index.js";
|
|
16
|
+
import { loadingJSON } from "./workspace-management/defaultWorkspaceJSON.js";
|
|
17
|
+
import { useLostConnection } from "@vuu-ui/vuu-data-react";
|
|
18
18
|
import shell from "./shell.css";
|
|
19
|
+
registerComponent("ApplicationSettings", UserSettingsPanel, "view");
|
|
20
|
+
if ("production" === process.env.NODE_ENV) {
|
|
21
|
+
if ("function" != typeof StackLayout) console.warn("StackLayout module not loaded, will be unable to deserialize from layout JSON");
|
|
22
|
+
}
|
|
23
|
+
const { error: error } = logger("Shell");
|
|
19
24
|
const defaultAppHeader = /*#__PURE__*/ jsx(AppHeader, {});
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const contextPanel = useContext(ShellContextPanelStateContext);
|
|
24
|
-
return /*#__PURE__*/ jsx(ContextPanel, {
|
|
25
|
-
content: contextPanel?.content,
|
|
26
|
-
expanded: void 0 !== contextPanel,
|
|
27
|
-
id: VuuShellLocation.ContextPanel,
|
|
28
|
-
overlay: true,
|
|
29
|
-
title: contextPanel?.title
|
|
30
|
-
});
|
|
25
|
+
const getAppHeader = (shellLayoutProps)=>shellLayoutProps?.appHeader ?? defaultAppHeader;
|
|
26
|
+
const defaultHTMLAttributes = {
|
|
27
|
+
className: "vuuShell"
|
|
31
28
|
};
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
setLeftNavWidth(width);
|
|
39
|
-
}, []);
|
|
40
|
-
const showContextPanel = useCallback((content, title)=>{
|
|
41
|
-
if (!/*#__PURE__*/ isValidElement(content)) throw new Error(`Context panel component "${content}" must be provided as a React element`);
|
|
42
|
-
contextPanelTrigger.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
43
|
-
setContextPanel({
|
|
44
|
-
content,
|
|
45
|
-
title
|
|
46
|
-
});
|
|
47
|
-
}, []);
|
|
48
|
-
const hideContextPanel = useCallback(()=>{
|
|
49
|
-
setContextPanel(void 0);
|
|
50
|
-
setApplicationSetting("applicationSettings.panelOpen", false).catch(()=>void 0);
|
|
51
|
-
requestAnimationFrame(()=>contextPanelTrigger.current?.focus());
|
|
52
|
-
}, [
|
|
53
|
-
setApplicationSetting
|
|
54
|
-
]);
|
|
55
|
-
return /*#__PURE__*/ jsx(ContextPanelProvider, {
|
|
56
|
-
hideContextPanel: hideContextPanel,
|
|
57
|
-
showContextPanel: showContextPanel,
|
|
58
|
-
children: /*#__PURE__*/ jsx(ShellContextPanelStateContext.Provider, {
|
|
59
|
-
value: contextPanel,
|
|
60
|
-
children: /*#__PURE__*/ jsxs(GridLayout, {
|
|
61
|
-
...htmlAttributes,
|
|
62
|
-
className: clsx("vuuShell", "vuuShell-staticGrid", className),
|
|
63
|
-
colsAndRows: {
|
|
64
|
-
cols: [
|
|
65
|
-
`${initialLeftNavWidth}px`,
|
|
66
|
-
"1fr",
|
|
67
|
-
"0px"
|
|
68
|
-
],
|
|
69
|
-
rows: [
|
|
70
|
-
"48px",
|
|
71
|
-
"1fr"
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
"full-page": true,
|
|
75
|
-
id: "vuu-shell-grid",
|
|
76
|
-
style: {
|
|
77
|
-
...style,
|
|
78
|
-
gridTemplateColumns: `${leftNavWidth}px minmax(0, 1fr) 0px`
|
|
79
|
-
},
|
|
80
|
-
children: [
|
|
81
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
82
|
-
id: "vuu-shell-left-nav",
|
|
83
|
-
style: {
|
|
84
|
-
gridArea: "1/1/3/2"
|
|
85
|
-
},
|
|
86
|
-
children: /*#__PURE__*/ jsx(SidePanel, {
|
|
87
|
-
id: "vuu-side-panel",
|
|
88
|
-
sizeOpen: initialLeftNavWidth,
|
|
89
|
-
children: /*#__PURE__*/ jsx(LeftNav, {
|
|
90
|
-
onWidthChange: handleLeftNavWidthChange,
|
|
91
|
-
sizeExpanded: initialLeftNavWidth
|
|
92
|
-
})
|
|
93
|
-
})
|
|
94
|
-
}),
|
|
95
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
96
|
-
id: "vuu-shell-header",
|
|
97
|
-
style: {
|
|
98
|
-
gridArea: "1/2/2/3"
|
|
99
|
-
},
|
|
100
|
-
children: appHeader
|
|
101
|
-
}),
|
|
102
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
103
|
-
className: "vuuShell-content",
|
|
104
|
-
id: "vuu-shell-workspace-host",
|
|
105
|
-
style: {
|
|
106
|
-
gridArea: "2/2/3/3"
|
|
107
|
-
},
|
|
108
|
-
children: workspaceHost
|
|
109
|
-
}),
|
|
110
|
-
/*#__PURE__*/ jsx(GridLayoutItem, {
|
|
111
|
-
id: "vuu-shell-context-panel-host",
|
|
112
|
-
style: {
|
|
113
|
-
gridArea: "1/3/3/4",
|
|
114
|
-
overflow: "visible",
|
|
115
|
-
position: "relative"
|
|
116
|
-
},
|
|
117
|
-
children: /*#__PURE__*/ jsx(StaticContextPanel, {})
|
|
118
|
-
})
|
|
119
|
-
]
|
|
120
|
-
})
|
|
121
|
-
})
|
|
122
|
-
});
|
|
29
|
+
const getHTMLAttributes = (props)=>{
|
|
30
|
+
if (props?.htmlAttributes) return {
|
|
31
|
+
...defaultHTMLAttributes,
|
|
32
|
+
...props.htmlAttributes
|
|
33
|
+
};
|
|
34
|
+
return defaultHTMLAttributes;
|
|
123
35
|
};
|
|
124
|
-
const VuuApplication = ({
|
|
36
|
+
const VuuApplication = ({ shellLayoutProps: ShellLayoutProps, children })=>{
|
|
125
37
|
const targetWindow = useWindow();
|
|
126
38
|
useComponentCssInjection({
|
|
127
39
|
testId: "vuu-shell",
|
|
128
40
|
css: shell,
|
|
129
41
|
window: targetWindow
|
|
130
42
|
});
|
|
43
|
+
const { workspaceJSON, saveApplicationLayout } = useWorkspace();
|
|
131
44
|
const { buildMenuOptions, handleMenuAction } = useWorkspaceContextMenuItems();
|
|
45
|
+
const handleLayoutChange = useCallback((layout)=>{
|
|
46
|
+
try {
|
|
47
|
+
saveApplicationLayout(layout);
|
|
48
|
+
} catch {
|
|
49
|
+
error?.("Failed to save layout");
|
|
50
|
+
}
|
|
51
|
+
}, [
|
|
52
|
+
saveApplicationLayout
|
|
53
|
+
]);
|
|
54
|
+
const isLayoutLoading = workspaceJSON === loadingJSON;
|
|
55
|
+
const initialLayout = useShellLayout({
|
|
56
|
+
...ShellLayoutProps,
|
|
57
|
+
appHeader: getAppHeader(ShellLayoutProps),
|
|
58
|
+
htmlAttributes: getHTMLAttributes(ShellLayoutProps)
|
|
59
|
+
});
|
|
132
60
|
useLostConnection();
|
|
133
|
-
return /*#__PURE__*/ jsxs(ContextMenuProvider, {
|
|
61
|
+
return isLayoutLoading ? null : /*#__PURE__*/ jsxs(ContextMenuProvider, {
|
|
134
62
|
menuActionHandler: handleMenuAction,
|
|
135
63
|
menuBuilder: buildMenuOptions,
|
|
136
64
|
children: [
|
|
137
|
-
/*#__PURE__*/ jsx(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
leftNavWidth: leftNavWidth
|
|
142
|
-
})
|
|
65
|
+
/*#__PURE__*/ jsx(LayoutProvider, {
|
|
66
|
+
workspaceJSON: workspaceJSON,
|
|
67
|
+
onLayoutChange: handleLayoutChange,
|
|
68
|
+
children: initialLayout
|
|
143
69
|
}),
|
|
144
70
|
children
|
|
145
71
|
]
|
|
146
72
|
});
|
|
147
73
|
};
|
|
148
|
-
const Shell = ({
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
74
|
+
const Shell = ({ logout, user, userSettingsSchema, workspaceProps, ...props })=>{
|
|
75
|
+
const persistenceManager = usePersistenceManager();
|
|
76
|
+
const localPersistenceManager = useMemo(()=>{
|
|
77
|
+
if (persistenceManager) return;
|
|
78
|
+
console.log(`No Persistence Manager, configuration data will be persisted to Local Storage, key: 'vuu/${user.username}'`);
|
|
79
|
+
return new LocalPersistenceManager(`vuu/${user.username}`);
|
|
80
|
+
}, [
|
|
81
|
+
persistenceManager,
|
|
82
|
+
user.username
|
|
156
83
|
]);
|
|
157
|
-
const
|
|
158
|
-
...htmlAttributes,
|
|
159
|
-
...shellLayoutProps?.htmlAttributes,
|
|
160
|
-
className: clsx(htmlAttributes.className, shellLayoutProps?.htmlAttributes?.className),
|
|
161
|
-
style: {
|
|
162
|
-
...htmlAttributes.style,
|
|
163
|
-
...shellLayoutProps?.htmlAttributes?.style
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
return /*#__PURE__*/ jsx(ApplicationProvider, {
|
|
84
|
+
const shellProviders = /*#__PURE__*/ jsx(ApplicationProvider, {
|
|
167
85
|
density: "high",
|
|
168
86
|
logout: logout,
|
|
169
87
|
theme: "vuu-theme",
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
88
|
+
user: user,
|
|
89
|
+
userSettingsSchema: userSettingsSchema,
|
|
90
|
+
children: /*#__PURE__*/ jsx(WorkspaceProvider, {
|
|
91
|
+
...workspaceProps,
|
|
92
|
+
children: /*#__PURE__*/ jsx(ModalProvider, {
|
|
93
|
+
children: /*#__PURE__*/ jsx(NotificationsProvider, {
|
|
175
94
|
children: /*#__PURE__*/ jsx(VuuApplication, {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
leftNavWidth: leftNavWidth ?? shellLayoutProps?.SidePanelProps?.sizeOpen,
|
|
179
|
-
children: children
|
|
95
|
+
...props,
|
|
96
|
+
user: user
|
|
180
97
|
})
|
|
181
98
|
})
|
|
182
99
|
})
|
|
183
100
|
})
|
|
184
101
|
});
|
|
102
|
+
if (persistenceManager) return shellProviders;
|
|
103
|
+
return /*#__PURE__*/ jsx(PersistenceProvider, {
|
|
104
|
+
persistenceManager: localPersistenceManager,
|
|
105
|
+
children: shellProviders
|
|
106
|
+
});
|
|
185
107
|
};
|
|
186
|
-
export { Shell
|
|
108
|
+
export { Shell };
|