@vuu-ui/vuu-shell 3.3.11 → 4.0.0-alpha.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 +18 -16
- package/src/app-header/AppHeader.js +36 -26
- package/src/application-provider/ApplicationContext.js +2 -5
- package/src/application-provider/ApplicationProvider.js +8 -59
- package/src/feature/Feature.js +3 -34
- package/src/feature/index.js +1 -0
- package/src/feature-list/FeatureList.css.js +27 -5
- package/src/feature-list/FeatureList.js +117 -96
- package/src/index.js +3 -3
- package/src/left-nav/LeftNav.css.js +2 -4
- package/src/left-nav/LeftNav.js +139 -100
- package/src/module-registry/getRegisteredModules.js +12 -0
- package/src/persistence-manager/LocalWorkspacePersistenceService.js +129 -0
- package/src/persistence-manager/PersistenceProvider.js +10 -3
- package/src/persistence-manager/RemoteWorkspacePersistenceService.js +112 -0
- package/src/persistence-manager/WorkspacePersistenceService.js +9 -0
- package/src/persistence-manager/index.js +3 -0
- package/src/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.js +24 -0
- package/src/shell-layout-templates/context-panel/ContextPanel.css.js +8 -8
- package/src/shell-layout-templates/context-panel/ContextPanel.js +17 -35
- package/src/shell-layout-templates/context-panel/index.js +1 -0
- package/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +54 -40
- package/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +54 -64
- package/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +49 -28
- package/src/shell-layout-templates/side-panel/SidePanel.css.js +3 -1
- package/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +43 -35
- package/src/shell.css.js +85 -2
- package/src/shell.js +148 -70
- package/src/workspace-management/LayoutList.js +59 -99
- package/src/workspace-management/SaveLayoutPanel.js +3 -3
- package/src/workspace-management/WorkspaceController.js +73 -0
- package/src/workspace-management/WorkspaceHost.js +194 -0
- package/src/workspace-management/WorkspacePersistentState.js +67 -0
- package/src/workspace-management/WorkspaceProvider.js +699 -178
- package/src/workspace-management/WorkspaceRepository.js +127 -0
- package/src/workspace-management/WorkspaceStartPanel.css.js +44 -0
- package/src/workspace-management/WorkspaceStartPanel.js +34 -0
- package/src/workspace-management/index.js +8 -0
- package/src/workspace-management/shell-workspace-components.js +59 -0
- package/src/workspace-management/useWorkspaceContextMenuItems.js +12 -6
- package/src/workspace-management/workspace-component-registry.js +30 -0
- package/src/workspace-management/workspace-schemas.js +257 -0
- package/types/app-header/AppHeader.d.ts +2 -2
- package/types/application-provider/ApplicationContext.d.ts +1 -6
- package/types/application-provider/ApplicationProvider.d.ts +5 -14
- package/types/feature/Feature.d.ts +2 -10
- package/types/feature/Loader.d.ts +1 -1
- package/types/feature/index.d.ts +2 -1
- package/types/feature-list/FeatureList.d.ts +4 -4
- package/types/index.d.ts +3 -3
- package/types/left-nav/LeftNav.d.ts +2 -1
- package/types/login/LoginPanel.d.ts +1 -1
- package/types/login/VuuLogo.d.ts +1 -1
- package/types/persistence-manager/PersistenceProvider.d.ts +7 -3
- package/types/persistence-manager/index.d.ts +3 -0
- package/types/shell-layout-templates/context-panel/ContextPanel.d.ts +9 -11
- package/types/shell-layout-templates/context-panel/index.d.ts +1 -0
- 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 +4 -2
- package/types/shell.d.ts +19 -15
- 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 +61 -50
- package/types/workspace-management/defaultWorkspaceJSON.d.ts +7 -6
- package/types/workspace-management/index.d.ts +8 -0
- package/types/workspace-management/useWorkspaceContextMenuItems.d.ts +1 -1
- package/src/feature/FeatureErrorBoundary.js +0 -33
- package/src/user-settings/SettingsForm.css.js +0 -10
- package/src/user-settings/SettingsForm.js +0 -141
- package/src/user-settings/UserSettingsPanel.css.js +0 -9
- package/src/user-settings/UserSettingsPanel.js +0 -29
- package/src/user-settings/index.js +0 -2
package/package.json
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "4.0.0-alpha.1",
|
|
3
3
|
"description": "VUU UI Shell",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"author": "heswell",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"scripts": {
|
|
8
|
-
"build:dev": "node ../../scripts/run-build.mjs",
|
|
9
9
|
"build": "node ../../scripts/run-build-rslib.ts",
|
|
10
10
|
"type-defs": "node ../../scripts/build-type-defs.mjs"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@vuu-ui/vuu-data-types": "
|
|
14
|
-
"@vuu-ui/vuu-protocol-types": "
|
|
15
|
-
"@vuu-ui/vuu-table-types": "
|
|
13
|
+
"@vuu-ui/vuu-data-types": "4.0.0-alpha.1",
|
|
14
|
+
"@vuu-ui/vuu-protocol-types": "4.0.0-alpha.1",
|
|
15
|
+
"@vuu-ui/vuu-table-types": "4.0.0-alpha.1"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@
|
|
18
|
+
"@heswell/grid-layout": "4.0.0-alpha.1",
|
|
19
|
+
"@salt-ds/core": "1.67.0",
|
|
19
20
|
"@salt-ds/styles": "0.2.1",
|
|
20
21
|
"@salt-ds/window": "0.1.1",
|
|
21
|
-
"@vuu-ui/vuu-context-menu": "
|
|
22
|
-
"@vuu-ui/vuu-data-react": "
|
|
23
|
-
"@vuu-ui/vuu-data-remote": "
|
|
24
|
-
"@vuu-ui/vuu-icons": "
|
|
25
|
-
"@vuu-ui/vuu-layout": "
|
|
26
|
-
"@vuu-ui/vuu-notifications": "
|
|
27
|
-
"@vuu-ui/vuu-table": "
|
|
28
|
-
"@vuu-ui/vuu-ui-controls": "
|
|
29
|
-
"@vuu-ui/vuu-utils": "
|
|
22
|
+
"@vuu-ui/vuu-context-menu": "4.0.0-alpha.1",
|
|
23
|
+
"@vuu-ui/vuu-data-react": "4.0.0-alpha.1",
|
|
24
|
+
"@vuu-ui/vuu-data-remote": "4.0.0-alpha.1",
|
|
25
|
+
"@vuu-ui/vuu-icons": "4.0.0-alpha.1",
|
|
26
|
+
"@vuu-ui/vuu-layout": "4.0.0-alpha.1",
|
|
27
|
+
"@vuu-ui/vuu-notifications": "4.0.0-alpha.1",
|
|
28
|
+
"@vuu-ui/vuu-table": "4.0.0-alpha.1",
|
|
29
|
+
"@vuu-ui/vuu-ui-controls": "4.0.0-alpha.1",
|
|
30
|
+
"@vuu-ui/vuu-utils": "4.0.0-alpha.1",
|
|
31
|
+
"@module-federation/enhanced": "2.8.0",
|
|
32
|
+
"@vuu-ui/core": "4.0.0-alpha.1",
|
|
30
33
|
"html-to-image": "^1.11.11"
|
|
31
34
|
},
|
|
32
35
|
"peerDependencies": {
|
|
@@ -48,6 +51,5 @@
|
|
|
48
51
|
},
|
|
49
52
|
"module": "./src/index.js",
|
|
50
53
|
"name": "@vuu-ui/vuu-shell",
|
|
51
|
-
"type": "module",
|
|
52
54
|
"types": "types/index.d.ts"
|
|
53
55
|
}
|
|
@@ -2,13 +2,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button } from "@salt-ds/core";
|
|
3
3
|
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
4
4
|
import { useWindow } from "@salt-ds/window";
|
|
5
|
-
import {
|
|
6
|
-
import { Toolbar } from "@vuu-ui/vuu-ui-controls";
|
|
7
|
-
import clsx from "clsx";
|
|
8
|
-
import { useCallback, useRef } from "react";
|
|
9
|
-
import { usePersistenceManager } from "../persistence-manager/index.js";
|
|
5
|
+
import { useLogout } from "@vuu-ui/core";
|
|
10
6
|
import { NotificationType, useNotifications } from "@vuu-ui/vuu-notifications";
|
|
11
|
-
import {
|
|
7
|
+
import { Toolbar, useContextPanel, useHideContextPanel } from "@vuu-ui/vuu-ui-controls";
|
|
8
|
+
import clsx from "clsx";
|
|
9
|
+
import { useCallback } from "react";
|
|
10
|
+
import { useWorkspace } from "../workspace-management/index.js";
|
|
12
11
|
import AppHeader from "./AppHeader.css";
|
|
13
12
|
const classBase = "vuuAppHeader";
|
|
14
13
|
const AppHeader_AppHeader = ({ className: classNameProp, themeMode: _, ...htmlAttributes })=>{
|
|
@@ -18,33 +17,45 @@ const AppHeader_AppHeader = ({ className: classNameProp, themeMode: _, ...htmlAt
|
|
|
18
17
|
css: AppHeader,
|
|
19
18
|
window: targetWindow
|
|
20
19
|
});
|
|
21
|
-
const persistenceManager = usePersistenceManager();
|
|
22
|
-
const settingsButtonRef = useRef(null);
|
|
23
20
|
const className = clsx(classBase, classNameProp);
|
|
24
21
|
const logout = useLogout();
|
|
25
|
-
const {
|
|
22
|
+
const { resetApplication, setApplicationSetting } = useWorkspace();
|
|
26
23
|
const { showNotification } = useNotifications();
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
const showContextPanel = useContextPanel();
|
|
25
|
+
const hideContextPanel = useHideContextPanel();
|
|
26
|
+
const handleReset = useCallback(async ()=>{
|
|
27
|
+
try {
|
|
28
|
+
await resetApplication();
|
|
29
|
+
hideContextPanel?.();
|
|
30
|
+
showNotification({
|
|
31
|
+
animationType: "slide-out",
|
|
32
|
+
renderPostRefresh: true,
|
|
33
|
+
type: NotificationType.Toast,
|
|
34
|
+
header: "Success",
|
|
35
|
+
content: "Settings and workspaces cleared",
|
|
36
|
+
status: "success"
|
|
37
|
+
});
|
|
38
|
+
} catch (cause) {
|
|
39
|
+
showNotification({
|
|
40
|
+
type: NotificationType.Toast,
|
|
41
|
+
header: "Reset failed",
|
|
42
|
+
content: cause instanceof Error ? cause.message : "Unable to reset",
|
|
43
|
+
status: "error"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
38
46
|
}, [
|
|
39
|
-
|
|
47
|
+
hideContextPanel,
|
|
48
|
+
resetApplication,
|
|
40
49
|
showNotification
|
|
41
50
|
]);
|
|
42
51
|
const handleShowSettings = useCallback(()=>{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
setApplicationSetting("applicationSettings.panelOpen", true).catch(()=>void 0);
|
|
53
|
+
showContextPanel(/*#__PURE__*/ jsx("div", {
|
|
54
|
+
children: "Application settings"
|
|
55
|
+
}), "Settings");
|
|
46
56
|
}, [
|
|
47
|
-
|
|
57
|
+
setApplicationSetting,
|
|
58
|
+
showContextPanel
|
|
48
59
|
]);
|
|
49
60
|
return /*#__PURE__*/ jsxs(Toolbar, {
|
|
50
61
|
alignItems: "end",
|
|
@@ -75,7 +86,6 @@ const AppHeader_AppHeader = ({ className: classNameProp, themeMode: _, ...htmlAt
|
|
|
75
86
|
appearance: "transparent",
|
|
76
87
|
className: `${classBase}-menuItem`,
|
|
77
88
|
onClick: handleShowSettings,
|
|
78
|
-
ref: settingsButtonRef,
|
|
79
89
|
sentiment: "neutral",
|
|
80
90
|
children: [
|
|
81
91
|
"Settings ",
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
|
-
|
|
3
|
-
username: "unknown"
|
|
4
|
-
};
|
|
2
|
+
console.log("%ccreate application context", "color:red;font-weight:bold;");
|
|
5
3
|
const ApplicationContext = /*#__PURE__*/ createContext({
|
|
6
|
-
onUserSettingChanged: (propertyName)=>console.warn(`Cannot change setting '${propertyName}'.\nDid you forget to declare an ApplicationProvider ?`)
|
|
7
|
-
user: Guest
|
|
4
|
+
onUserSettingChanged: (propertyName)=>console.warn(`Cannot change setting '${propertyName}'.\nDid you forget to declare an ApplicationProvider ?`)
|
|
8
5
|
});
|
|
9
6
|
export { ApplicationContext };
|
|
@@ -1,77 +1,26 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { SaltProviderNext, useDensity, useTheme } from "@salt-ds/core";
|
|
3
|
-
import {
|
|
3
|
+
import { useContext } from "react";
|
|
4
4
|
import { ApplicationContext } from "./ApplicationContext.js";
|
|
5
|
-
import { usePersistenceManager } from "../persistence-manager/index.js";
|
|
6
5
|
const accentPurple = "purple";
|
|
7
|
-
const getThemeMode = (mode = "light"
|
|
8
|
-
|
|
9
|
-
if ("light" === themeMode || "dark" === themeMode) return themeMode;
|
|
10
|
-
return mode;
|
|
11
|
-
};
|
|
12
|
-
const ApplicationProvider = ({ children, density: densityProp, logout, mode, theme, userSettingsSchema: userSettingsSchema, user })=>{
|
|
6
|
+
const getThemeMode = (mode = "light")=>mode;
|
|
7
|
+
const ApplicationProvider = ({ children, density: densityProp, logout, mode, theme })=>{
|
|
13
8
|
const { mode: inheritedMode, theme: inheritedTheme } = useTheme();
|
|
14
9
|
const density = useDensity(densityProp);
|
|
15
|
-
const persistenceManager = usePersistenceManager();
|
|
16
10
|
const context = useContext(ApplicationContext);
|
|
17
|
-
|
|
18
|
-
useMemo(async ()=>{
|
|
19
|
-
if (persistenceManager) {
|
|
20
|
-
const userSettings = await persistenceManager.getUserSettings();
|
|
21
|
-
setSettings(userSettings);
|
|
22
|
-
} else setSettings({});
|
|
23
|
-
}, [
|
|
24
|
-
persistenceManager
|
|
25
|
-
]);
|
|
26
|
-
const onUserSettingChanged = useCallback((propertyName, value)=>{
|
|
27
|
-
setSettings((currentSettings)=>{
|
|
28
|
-
const newSettings = {
|
|
29
|
-
...currentSettings,
|
|
30
|
-
[propertyName]: value
|
|
31
|
-
};
|
|
32
|
-
persistenceManager?.saveUserSettings(newSettings);
|
|
33
|
-
return newSettings;
|
|
34
|
-
});
|
|
35
|
-
}, [
|
|
36
|
-
persistenceManager
|
|
37
|
-
]);
|
|
38
|
-
return userSettings ? /*#__PURE__*/ jsx(ApplicationContext.Provider, {
|
|
11
|
+
return /*#__PURE__*/ jsx(ApplicationContext.Provider, {
|
|
39
12
|
value: {
|
|
40
13
|
...context,
|
|
41
|
-
logout
|
|
42
|
-
onUserSettingChanged,
|
|
43
|
-
userSettings,
|
|
44
|
-
userSettingsSchema,
|
|
45
|
-
user: user ?? context.user
|
|
14
|
+
logout
|
|
46
15
|
},
|
|
47
16
|
children: /*#__PURE__*/ jsx(SaltProviderNext, {
|
|
48
17
|
accent: accentPurple,
|
|
49
18
|
corner: "rounded",
|
|
50
19
|
theme: theme ?? inheritedTheme ?? "vuu-theme",
|
|
51
20
|
density: density,
|
|
52
|
-
mode: getThemeMode(mode ?? inheritedMode
|
|
21
|
+
mode: getThemeMode(mode ?? inheritedMode),
|
|
53
22
|
children: children
|
|
54
23
|
})
|
|
55
|
-
})
|
|
56
|
-
};
|
|
57
|
-
const useApplicationUser = ()=>{
|
|
58
|
-
const { user } = useContext(ApplicationContext);
|
|
59
|
-
return user;
|
|
60
|
-
};
|
|
61
|
-
const useApplicationSettings = ()=>{
|
|
62
|
-
const { onUserSettingChanged, userSettings, userSettingsSchema } = useContext(ApplicationContext);
|
|
63
|
-
return {
|
|
64
|
-
onUserSettingChanged,
|
|
65
|
-
userSettings,
|
|
66
|
-
userSettingsSchema
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
const useUserSetting = ()=>{
|
|
70
|
-
const { userSettings } = useContext(ApplicationContext);
|
|
71
|
-
return userSettings;
|
|
72
|
-
};
|
|
73
|
-
const useLogout = ()=>{
|
|
74
|
-
const { logout } = useContext(ApplicationContext);
|
|
75
|
-
return logout;
|
|
24
|
+
});
|
|
76
25
|
};
|
|
77
|
-
export { ApplicationProvider
|
|
26
|
+
export { ApplicationProvider };
|
package/src/feature/Feature.js
CHANGED
|
@@ -1,37 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { FeatureErrorBoundary } from "./FeatureErrorBoundary.js";
|
|
5
|
-
const componentsMap = new Map();
|
|
6
|
-
const useCachedFeature = (url)=>{
|
|
7
|
-
useEffect(()=>()=>{
|
|
8
|
-
componentsMap.delete(url);
|
|
9
|
-
}, [
|
|
10
|
-
url
|
|
11
|
-
]);
|
|
12
|
-
if (!componentsMap.has(url)) componentsMap.set(url, /*#__PURE__*/ react.lazy(()=>import(/* @vite-ignore */ url)));
|
|
13
|
-
const lazyFeature = componentsMap.get(url);
|
|
14
|
-
if (lazyFeature) return lazyFeature;
|
|
15
|
-
throw Error(`Unable to load Lazy Feature at url ${url}`);
|
|
16
|
-
};
|
|
17
|
-
function RawFeature({ url, css, ComponentProps: params, ...props }) {
|
|
18
|
-
if (css) // import(/* @vite-ignore */ css, { assert: { type: "css" } }).then(
|
|
19
|
-
importCSS(css).then((styleSheet)=>{
|
|
20
|
-
document.adoptedStyleSheets = [
|
|
21
|
-
...document.adoptedStyleSheets,
|
|
22
|
-
styleSheet
|
|
23
|
-
];
|
|
24
|
-
});
|
|
25
|
-
const LazyFeature = useCachedFeature(url);
|
|
26
|
-
return /*#__PURE__*/ jsx(FeatureErrorBoundary, {
|
|
27
|
-
url: url,
|
|
28
|
-
children: /*#__PURE__*/ jsx(LazyFeature, {
|
|
29
|
-
...props,
|
|
30
|
-
...params
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const Feature = /*#__PURE__*/ react.memo(RawFeature);
|
|
1
|
+
import { RemoteModule } from "@vuu-ui/core/portal";
|
|
2
|
+
import { registerComponent } from "@vuu-ui/vuu-utils";
|
|
3
|
+
const Feature = RemoteModule;
|
|
35
4
|
Feature.displayName = "Feature";
|
|
36
5
|
registerComponent("Feature", Feature, "view");
|
|
37
6
|
export { Feature };
|
package/src/feature/index.js
CHANGED
|
@@ -29,6 +29,30 @@ const css = `
|
|
|
29
29
|
margin-top: 24px;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.vuuFeatureList-items {
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
flex: none;
|
|
35
|
+
display: flex;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.vuuFeatureList-item {
|
|
39
|
+
--vuu-icon-color: var(--salt-content-secondary-foreground);
|
|
40
|
+
cursor: grab;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: var(--salt-spacing-100);
|
|
43
|
+
flex: 0 0 24px;
|
|
44
|
+
min-height: 24px;
|
|
45
|
+
padding: 5px 4px 5px 12px;
|
|
46
|
+
font-size: 11px;
|
|
47
|
+
font-weight: 400;
|
|
48
|
+
line-height: 14px;
|
|
49
|
+
display: flex;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.vuuFeatureList-item:hover {
|
|
53
|
+
background: var(--salt-selectable-background-hover);
|
|
54
|
+
}
|
|
55
|
+
|
|
32
56
|
.vuuFeatureList-group {
|
|
33
57
|
--vuuMeasuredContainer-flex: 0 0 auto;
|
|
34
58
|
flex-direction: column;
|
|
@@ -38,11 +62,6 @@ const css = `
|
|
|
38
62
|
flex: 0 0 32px;
|
|
39
63
|
padding: 8px 0;
|
|
40
64
|
}
|
|
41
|
-
|
|
42
|
-
& .vuuPalette {
|
|
43
|
-
flex: auto;
|
|
44
|
-
height: auto;
|
|
45
|
-
}
|
|
46
65
|
}
|
|
47
66
|
|
|
48
67
|
.vuuFeatureList-group:first-child {
|
|
@@ -54,7 +73,10 @@ const css = `
|
|
|
54
73
|
}
|
|
55
74
|
|
|
56
75
|
.vuuFeatureList-itemName {
|
|
76
|
+
text-overflow: ellipsis;
|
|
77
|
+
white-space: nowrap;
|
|
57
78
|
font-weight: 700;
|
|
79
|
+
overflow: hidden;
|
|
58
80
|
}
|
|
59
81
|
|
|
60
82
|
|
|
@@ -1,14 +1,98 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Icon } from "@vuu-ui/vuu-ui-controls";
|
|
4
|
-
import { featureFromJson, isStaticFeatures } from "@vuu-ui/vuu-utils";
|
|
2
|
+
import { DragDropProviderNext, GridLayoutProvider, toJsonValue, useDraggable, useOptionalDragContext } from "@heswell/grid-layout";
|
|
5
3
|
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
6
4
|
import { useWindow } from "@salt-ds/window";
|
|
5
|
+
import { Icon } from "@vuu-ui/vuu-ui-controls";
|
|
6
|
+
import { isStaticFeatures, queryClosest } from "@vuu-ui/vuu-utils";
|
|
7
7
|
import clsx from "clsx";
|
|
8
|
-
import { useMemo } from "react";
|
|
9
|
-
import { Feature } from "../feature/Feature.js";
|
|
8
|
+
import { useCallback, useId, useMemo } from "react";
|
|
10
9
|
import FeatureList from "./FeatureList.css";
|
|
11
10
|
const classBase = "vuuFeatureList";
|
|
11
|
+
const NOOP = ()=>void 0;
|
|
12
|
+
const FeatureListDragRuntime = ({ children })=>{
|
|
13
|
+
const dragContext = useOptionalDragContext();
|
|
14
|
+
const runtimeId = useId();
|
|
15
|
+
if (dragContext) return children;
|
|
16
|
+
return /*#__PURE__*/ jsx(GridLayoutProvider, {
|
|
17
|
+
children: /*#__PURE__*/ jsx(DragDropProviderNext, {
|
|
18
|
+
dragSources: {},
|
|
19
|
+
onCancelTabDrag: NOOP,
|
|
20
|
+
onDetachTab: NOOP,
|
|
21
|
+
onDrop: NOOP,
|
|
22
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
23
|
+
className: "vuuGridLayout",
|
|
24
|
+
id: `vuu-feature-list-${runtimeId}`,
|
|
25
|
+
style: {
|
|
26
|
+
display: "contents"
|
|
27
|
+
},
|
|
28
|
+
children: children
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const templateForDynamicFeature = (feature)=>{
|
|
34
|
+
const settings = toJsonValue(feature);
|
|
35
|
+
if (!settings.ok) throw new Error(`Feature "${feature.title ?? feature.mfComponent}" has non-persistable settings at ${settings.error.path}`);
|
|
36
|
+
return {
|
|
37
|
+
component: {
|
|
38
|
+
settings: settings.value,
|
|
39
|
+
type: "vuu-dynamic-feature",
|
|
40
|
+
version: 1
|
|
41
|
+
},
|
|
42
|
+
label: feature.title ?? feature.mfComponent
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const templateForStaticFeature = ({ label, type })=>({
|
|
46
|
+
component: {
|
|
47
|
+
settings: {
|
|
48
|
+
type
|
|
49
|
+
},
|
|
50
|
+
type: "vuu-static-feature",
|
|
51
|
+
version: 1
|
|
52
|
+
},
|
|
53
|
+
label
|
|
54
|
+
});
|
|
55
|
+
const FeatureTemplate = ({ template })=>{
|
|
56
|
+
const getDragSource = useCallback((event)=>{
|
|
57
|
+
const element = event.currentTarget;
|
|
58
|
+
return {
|
|
59
|
+
...template,
|
|
60
|
+
element,
|
|
61
|
+
layoutId: queryClosest(element, ".vuuGridLayout")?.id ?? "vuu-feature-list",
|
|
62
|
+
type: "template"
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
template
|
|
66
|
+
]);
|
|
67
|
+
const draggable = useDraggable({
|
|
68
|
+
getDragSource
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
71
|
+
...draggable,
|
|
72
|
+
className: `${classBase}-item`,
|
|
73
|
+
"data-template-component-type": template.component.type,
|
|
74
|
+
"data-template-version": template.component.version,
|
|
75
|
+
draggable: true,
|
|
76
|
+
role: "listitem",
|
|
77
|
+
children: [
|
|
78
|
+
/*#__PURE__*/ jsx(Icon, {
|
|
79
|
+
name: "draggable",
|
|
80
|
+
size: 18
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ jsx("span", {
|
|
83
|
+
className: `${classBase}-itemName`,
|
|
84
|
+
children: template.label
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const TemplateList = ({ templates })=>/*#__PURE__*/ jsx("div", {
|
|
90
|
+
className: `${classBase}-items`,
|
|
91
|
+
role: "list",
|
|
92
|
+
children: templates.map((template, index)=>/*#__PURE__*/ jsx(FeatureTemplate, {
|
|
93
|
+
template: template
|
|
94
|
+
}, `${template.component.type}-${template.label}-${index}`))
|
|
95
|
+
});
|
|
12
96
|
const FeatureList_FeatureList = ({ features, title = "VUU TABLES", ...htmlAttributes })=>{
|
|
13
97
|
const targetWindow = useWindow();
|
|
14
98
|
useComponentCssInjection({
|
|
@@ -17,112 +101,49 @@ const FeatureList_FeatureList = ({ features, title = "VUU TABLES", ...htmlAttrib
|
|
|
17
101
|
window: targetWindow
|
|
18
102
|
});
|
|
19
103
|
const content = useMemo(()=>{
|
|
20
|
-
if (isStaticFeatures(features)) return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
resizeable: true
|
|
26
|
-
},
|
|
27
|
-
component: featureFromJson({
|
|
28
|
-
type
|
|
29
|
-
}),
|
|
30
|
-
value: label,
|
|
31
|
-
children: [
|
|
32
|
-
/*#__PURE__*/ jsx(Icon, {
|
|
33
|
-
name: "draggable",
|
|
34
|
-
size: 18
|
|
35
|
-
}),
|
|
36
|
-
/*#__PURE__*/ jsx("span", {
|
|
37
|
-
className: `${classBase}-itemName`,
|
|
38
|
-
children: label
|
|
39
|
-
})
|
|
40
|
-
]
|
|
41
|
-
}, idx));
|
|
104
|
+
if (isStaticFeatures(features)) return [
|
|
105
|
+
/*#__PURE__*/ jsx(TemplateList, {
|
|
106
|
+
templates: features.map(templateForStaticFeature)
|
|
107
|
+
}, "static")
|
|
108
|
+
];
|
|
42
109
|
if (Array.isArray(features)) return [
|
|
43
110
|
/*#__PURE__*/ jsx("div", {
|
|
44
111
|
className: `${classBase}-standalone`,
|
|
45
|
-
children: /*#__PURE__*/ jsx(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
closeable: true,
|
|
50
|
-
header: true,
|
|
51
|
-
resize: "defer",
|
|
52
|
-
resizeable: true,
|
|
53
|
-
title: featureProps.title,
|
|
54
|
-
...ViewProps
|
|
55
|
-
},
|
|
56
|
-
component: /*#__PURE__*/ jsx(Feature, {
|
|
57
|
-
...featureProps
|
|
58
|
-
}),
|
|
59
|
-
value: featureProps.title,
|
|
60
|
-
children: [
|
|
61
|
-
/*#__PURE__*/ jsx(Icon, {
|
|
62
|
-
name: "draggable",
|
|
63
|
-
size: 18
|
|
64
|
-
}),
|
|
65
|
-
/*#__PURE__*/ jsx("span", {
|
|
66
|
-
className: `${classBase}-itemName`,
|
|
67
|
-
children: featureProps.title
|
|
68
|
-
})
|
|
69
|
-
]
|
|
70
|
-
}, i))
|
|
71
|
-
}, "0")
|
|
72
|
-
}, 0)
|
|
112
|
+
children: /*#__PURE__*/ jsx(TemplateList, {
|
|
113
|
+
templates: features.map(templateForDynamicFeature)
|
|
114
|
+
})
|
|
115
|
+
}, "dynamic")
|
|
73
116
|
];
|
|
74
|
-
return Object.entries(features).map(([heading, featureList]
|
|
117
|
+
return Object.entries(features).map(([heading, featureList])=>/*#__PURE__*/ jsxs("div", {
|
|
75
118
|
className: `${classBase}-group`,
|
|
76
119
|
children: [
|
|
77
120
|
/*#__PURE__*/ jsx("div", {
|
|
78
121
|
className: `${classBase}-groupHeader`,
|
|
79
122
|
children: heading
|
|
80
123
|
}),
|
|
81
|
-
/*#__PURE__*/ jsx(
|
|
82
|
-
|
|
83
|
-
children: featureList.map(({ ViewProps, ...featureProps }, i)=>/*#__PURE__*/ jsxs(PaletteItem, {
|
|
84
|
-
ViewProps: {
|
|
85
|
-
closeable: true,
|
|
86
|
-
header: true,
|
|
87
|
-
resize: "defer",
|
|
88
|
-
resizeable: true,
|
|
89
|
-
title: featureProps.title,
|
|
90
|
-
...ViewProps
|
|
91
|
-
},
|
|
92
|
-
component: /*#__PURE__*/ jsx(Feature, {
|
|
93
|
-
...featureProps
|
|
94
|
-
}),
|
|
95
|
-
value: featureProps.title,
|
|
96
|
-
children: [
|
|
97
|
-
/*#__PURE__*/ jsx(Icon, {
|
|
98
|
-
name: "draggable",
|
|
99
|
-
size: 18
|
|
100
|
-
}),
|
|
101
|
-
/*#__PURE__*/ jsx("span", {
|
|
102
|
-
className: `${classBase}-itemName`,
|
|
103
|
-
children: featureProps.title
|
|
104
|
-
})
|
|
105
|
-
]
|
|
106
|
-
}, i))
|
|
124
|
+
/*#__PURE__*/ jsx(TemplateList, {
|
|
125
|
+
templates: featureList.map(templateForDynamicFeature)
|
|
107
126
|
})
|
|
108
127
|
]
|
|
109
|
-
},
|
|
128
|
+
}, heading));
|
|
110
129
|
}, [
|
|
111
130
|
features
|
|
112
131
|
]);
|
|
113
|
-
return /*#__PURE__*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
return /*#__PURE__*/ jsx(FeatureListDragRuntime, {
|
|
133
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
134
|
+
...htmlAttributes,
|
|
135
|
+
className: clsx(classBase, "vuuScrollable"),
|
|
136
|
+
children: [
|
|
137
|
+
/*#__PURE__*/ jsx("div", {
|
|
138
|
+
className: `${classBase}-header`,
|
|
139
|
+
children: title
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ jsx("div", {
|
|
142
|
+
className: `${classBase}-content`,
|
|
143
|
+
children: content
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
})
|
|
126
147
|
});
|
|
127
148
|
};
|
|
128
149
|
export { FeatureList_FeatureList as FeatureList };
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from "./application-provider/index.js";
|
|
2
1
|
export * from "./app-header/index.js";
|
|
2
|
+
export * from "./application-provider/index.js";
|
|
3
3
|
export * from "./feature/index.js";
|
|
4
4
|
export * from "./feature-and-layout-provider/index.js";
|
|
5
|
+
export * from "./feature-list/index.js";
|
|
5
6
|
export * from "./left-nav/index.js";
|
|
6
7
|
export * from "./persistence-manager/index.js";
|
|
7
8
|
export * from "./shell.js";
|
|
8
9
|
export * from "./shell-layout-templates/index.js";
|
|
9
10
|
export * from "./ShellContextProvider.js";
|
|
10
|
-
export * from "./feature-list/index.js";
|
|
11
11
|
export * from "./theme-switch/index.js";
|
|
12
|
-
export * from "./user-settings/index.js";
|
|
13
12
|
export * from "./workspace-management/index.js";
|
|
14
13
|
export { LoginPanel } from "./login/LoginPanel.js";
|
|
14
|
+
export { getRegisteredModules } from "./module-registry/getRegisteredModules.js";
|
|
@@ -17,13 +17,11 @@ const css = `
|
|
|
17
17
|
--vuu-light-text-primary: #15171b;
|
|
18
18
|
--menu-level-2-width: 0px;
|
|
19
19
|
z-index: 0;
|
|
20
|
-
height:
|
|
21
|
-
margin-bottom: 4px;
|
|
20
|
+
height: 100%;
|
|
22
21
|
transition: width .2s ease-out;
|
|
23
22
|
display: flex;
|
|
24
23
|
position: relative;
|
|
25
24
|
overflow: hidden;
|
|
26
|
-
box-shadow: 3px 4px 4px #00000026;
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
.vuuLeftNav-menu-full {
|
|
@@ -64,7 +62,7 @@ const css = `
|
|
|
64
62
|
.vuuLeftNav-menu-secondary {
|
|
65
63
|
flex: none;
|
|
66
64
|
flex-basis: var(--nav-menu-content-width, 240px);
|
|
67
|
-
z-index:
|
|
65
|
+
z-index: 0;
|
|
68
66
|
display: none;
|
|
69
67
|
top: 0;
|
|
70
68
|
right: 0;
|