@vuu-ui/vuu-shell 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +0 -0
- package/cjs/ShellContextProvider.js +31 -0
- package/cjs/ShellContextProvider.js.map +1 -0
- package/cjs/app-header/AppHeader.css.js +6 -0
- package/cjs/app-header/AppHeader.css.js.map +1 -0
- package/cjs/app-header/AppHeader.js +66 -0
- package/cjs/app-header/AppHeader.js.map +1 -0
- package/cjs/connection-status/ConnectionStatusIndicator.css.js +6 -0
- package/cjs/connection-status/ConnectionStatusIndicator.css.js.map +1 -0
- package/cjs/connection-status/ConnectionStatusIndicator.js +51 -0
- package/cjs/connection-status/ConnectionStatusIndicator.js.map +1 -0
- package/cjs/feature/Feature.js +56 -0
- package/cjs/feature/Feature.js.map +1 -0
- package/cjs/feature/FeatureErrorBoundary.js +30 -0
- package/cjs/feature/FeatureErrorBoundary.js.map +1 -0
- package/cjs/feature/Loader.js +8 -0
- package/cjs/feature/Loader.js.map +1 -0
- package/cjs/feature-list/FeatureList.css.js +6 -0
- package/cjs/feature-list/FeatureList.css.js.map +1 -0
- package/cjs/feature-list/FeatureList.js +52 -0
- package/cjs/feature-list/FeatureList.js.map +1 -0
- package/cjs/index.js +51 -0
- package/cjs/index.js.map +1 -0
- package/cjs/layout-management/LayoutList.css.js +6 -0
- package/cjs/layout-management/LayoutList.css.js.map +1 -0
- package/cjs/layout-management/LayoutList.js +75 -0
- package/cjs/layout-management/LayoutList.js.map +1 -0
- package/cjs/layout-management/LayoutTile.css.js +6 -0
- package/cjs/layout-management/LayoutTile.css.js.map +1 -0
- package/cjs/layout-management/LayoutTile.js +36 -0
- package/cjs/layout-management/LayoutTile.js.map +1 -0
- package/cjs/layout-management/SaveLayoutPanel.css.js +6 -0
- package/cjs/layout-management/SaveLayoutPanel.css.js.map +1 -0
- package/cjs/layout-management/SaveLayoutPanel.js +149 -0
- package/cjs/layout-management/SaveLayoutPanel.js.map +1 -0
- package/cjs/layout-management/screenshot-utils.js +25 -0
- package/cjs/layout-management/screenshot-utils.js.map +1 -0
- package/cjs/layout-management/useLayoutContextMenuItems.js +72 -0
- package/cjs/layout-management/useLayoutContextMenuItems.js.map +1 -0
- package/cjs/layout-management/useLayoutManager.js +218 -0
- package/cjs/layout-management/useLayoutManager.js.map +1 -0
- package/cjs/left-nav/LeftNav.css.js +6 -0
- package/cjs/left-nav/LeftNav.css.js.map +1 -0
- package/cjs/left-nav/LeftNav.js +166 -0
- package/cjs/left-nav/LeftNav.js.map +1 -0
- package/cjs/login/LoginPanel.css.js +6 -0
- package/cjs/login/LoginPanel.css.js.map +1 -0
- package/cjs/login/LoginPanel.js +108 -0
- package/cjs/login/LoginPanel.js.map +1 -0
- package/cjs/login/VuuLogo.js +134 -0
- package/cjs/login/VuuLogo.js.map +1 -0
- package/cjs/login/login-utils.js +31 -0
- package/cjs/login/login-utils.js.map +1 -0
- package/cjs/persistence-management/LocalPersistenceManager.js +184 -0
- package/cjs/persistence-management/LocalPersistenceManager.js.map +1 -0
- package/cjs/persistence-management/RemotePersistenceManager.js +164 -0
- package/cjs/persistence-management/RemotePersistenceManager.js.map +1 -0
- package/cjs/persistence-management/defaultApplicationJson.js +42 -0
- package/cjs/persistence-management/defaultApplicationJson.js.map +1 -0
- package/cjs/session-editing-form/SessionEditingForm.css.js +6 -0
- package/cjs/session-editing-form/SessionEditingForm.css.js.map +1 -0
- package/cjs/session-editing-form/SessionEditingForm.js +280 -0
- package/cjs/session-editing-form/SessionEditingForm.js.map +1 -0
- package/cjs/shell-layouts/context-panel/ContextPanel.css.js +6 -0
- package/cjs/shell-layouts/context-panel/ContextPanel.css.js.map +1 -0
- package/cjs/shell-layouts/context-panel/ContextPanel.js +70 -0
- package/cjs/shell-layouts/context-panel/ContextPanel.js.map +1 -0
- package/cjs/shell-layouts/side-panel/SidePanel.css.js +6 -0
- package/cjs/shell-layouts/side-panel/SidePanel.css.js.map +1 -0
- package/cjs/shell-layouts/side-panel/SidePanel.js +36 -0
- package/cjs/shell-layouts/side-panel/SidePanel.js.map +1 -0
- package/cjs/shell-layouts/useFullHeightLeftPanel.js +41 -0
- package/cjs/shell-layouts/useFullHeightLeftPanel.js.map +1 -0
- package/cjs/shell-layouts/useInlayLeftPanel.js +78 -0
- package/cjs/shell-layouts/useInlayLeftPanel.js.map +1 -0
- package/cjs/shell-layouts/useShellLayout.js +15 -0
- package/cjs/shell-layouts/useShellLayout.js.map +1 -0
- package/cjs/shell.css.js +6 -0
- package/cjs/shell.css.js.map +1 -0
- package/cjs/shell.js +137 -0
- package/cjs/shell.js.map +1 -0
- package/cjs/shellTypes.js +8 -0
- package/cjs/shellTypes.js.map +1 -0
- package/cjs/theme-switch/ThemeSwitch.css.js +6 -0
- package/cjs/theme-switch/ThemeSwitch.css.js.map +1 -0
- package/cjs/theme-switch/ThemeSwitch.js +56 -0
- package/cjs/theme-switch/ThemeSwitch.js.map +1 -0
- package/esm/ShellContextProvider.js +28 -0
- package/esm/ShellContextProvider.js.map +1 -0
- package/esm/app-header/AppHeader.css.js +4 -0
- package/esm/app-header/AppHeader.css.js.map +1 -0
- package/esm/app-header/AppHeader.js +64 -0
- package/esm/app-header/AppHeader.js.map +1 -0
- package/esm/connection-status/ConnectionStatusIndicator.css.js +4 -0
- package/esm/connection-status/ConnectionStatusIndicator.css.js.map +1 -0
- package/esm/connection-status/ConnectionStatusIndicator.js +49 -0
- package/esm/connection-status/ConnectionStatusIndicator.js.map +1 -0
- package/esm/feature/Feature.js +54 -0
- package/esm/feature/Feature.js.map +1 -0
- package/esm/feature/FeatureErrorBoundary.js +28 -0
- package/esm/feature/FeatureErrorBoundary.js.map +1 -0
- package/esm/feature/Loader.js +6 -0
- package/esm/feature/Loader.js.map +1 -0
- package/esm/feature-list/FeatureList.css.js +4 -0
- package/esm/feature-list/FeatureList.css.js.map +1 -0
- package/esm/feature-list/FeatureList.js +50 -0
- package/esm/feature-list/FeatureList.js.map +1 -0
- package/esm/index.js +20 -0
- package/esm/index.js.map +1 -0
- package/esm/layout-management/LayoutList.css.js +4 -0
- package/esm/layout-management/LayoutList.css.js.map +1 -0
- package/esm/layout-management/LayoutList.js +73 -0
- package/esm/layout-management/LayoutList.js.map +1 -0
- package/esm/layout-management/LayoutTile.css.js +4 -0
- package/esm/layout-management/LayoutTile.css.js.map +1 -0
- package/esm/layout-management/LayoutTile.js +34 -0
- package/esm/layout-management/LayoutTile.js.map +1 -0
- package/esm/layout-management/SaveLayoutPanel.css.js +4 -0
- package/esm/layout-management/SaveLayoutPanel.css.js.map +1 -0
- package/esm/layout-management/SaveLayoutPanel.js +147 -0
- package/esm/layout-management/SaveLayoutPanel.js.map +1 -0
- package/esm/layout-management/screenshot-utils.js +23 -0
- package/esm/layout-management/screenshot-utils.js.map +1 -0
- package/esm/layout-management/useLayoutContextMenuItems.js +70 -0
- package/esm/layout-management/useLayoutContextMenuItems.js.map +1 -0
- package/esm/layout-management/useLayoutManager.js +214 -0
- package/esm/layout-management/useLayoutManager.js.map +1 -0
- package/esm/left-nav/LeftNav.css.js +4 -0
- package/esm/left-nav/LeftNav.css.js.map +1 -0
- package/esm/left-nav/LeftNav.js +164 -0
- package/esm/left-nav/LeftNav.js.map +1 -0
- package/esm/login/LoginPanel.css.js +4 -0
- package/esm/login/LoginPanel.css.js.map +1 -0
- package/esm/login/LoginPanel.js +106 -0
- package/esm/login/LoginPanel.js.map +1 -0
- package/esm/login/VuuLogo.js +132 -0
- package/esm/login/VuuLogo.js.map +1 -0
- package/esm/login/login-utils.js +26 -0
- package/esm/login/login-utils.js.map +1 -0
- package/esm/persistence-management/LocalPersistenceManager.js +182 -0
- package/esm/persistence-management/LocalPersistenceManager.js.map +1 -0
- package/esm/persistence-management/RemotePersistenceManager.js +162 -0
- package/esm/persistence-management/RemotePersistenceManager.js.map +1 -0
- package/esm/persistence-management/defaultApplicationJson.js +39 -0
- package/esm/persistence-management/defaultApplicationJson.js.map +1 -0
- package/esm/session-editing-form/SessionEditingForm.css.js +4 -0
- package/esm/session-editing-form/SessionEditingForm.css.js.map +1 -0
- package/esm/session-editing-form/SessionEditingForm.js +278 -0
- package/esm/session-editing-form/SessionEditingForm.js.map +1 -0
- package/esm/shell-layouts/context-panel/ContextPanel.css.js +4 -0
- package/esm/shell-layouts/context-panel/ContextPanel.css.js.map +1 -0
- package/esm/shell-layouts/context-panel/ContextPanel.js +68 -0
- package/esm/shell-layouts/context-panel/ContextPanel.js.map +1 -0
- package/esm/shell-layouts/side-panel/SidePanel.css.js +4 -0
- package/esm/shell-layouts/side-panel/SidePanel.css.js.map +1 -0
- package/esm/shell-layouts/side-panel/SidePanel.js +34 -0
- package/esm/shell-layouts/side-panel/SidePanel.js.map +1 -0
- package/esm/shell-layouts/useFullHeightLeftPanel.js +39 -0
- package/esm/shell-layouts/useFullHeightLeftPanel.js.map +1 -0
- package/esm/shell-layouts/useInlayLeftPanel.js +76 -0
- package/esm/shell-layouts/useInlayLeftPanel.js.map +1 -0
- package/esm/shell-layouts/useShellLayout.js +13 -0
- package/esm/shell-layouts/useShellLayout.js.map +1 -0
- package/esm/shell.css.js +4 -0
- package/esm/shell.css.js.map +1 -0
- package/esm/shell.js +135 -0
- package/esm/shell.js.map +1 -0
- package/esm/shellTypes.js +5 -0
- package/esm/shellTypes.js.map +1 -0
- package/esm/theme-switch/ThemeSwitch.css.js +4 -0
- package/esm/theme-switch/ThemeSwitch.css.js.map +1 -0
- package/esm/theme-switch/ThemeSwitch.js +54 -0
- package/esm/theme-switch/ThemeSwitch.js.map +1 -0
- package/package.json +48 -0
- package/types/ShellContextProvider.d.ts +16 -0
- package/types/app-header/AppHeader.d.ts +12 -0
- package/types/app-header/index.d.ts +1 -0
- package/types/connection-status/ConnectionStatusIndicator.d.ts +10 -0
- package/types/connection-status/index.d.ts +1 -0
- package/types/feature/Feature.d.ts +26 -0
- package/types/feature/FeatureErrorBoundary.d.ts +13 -0
- package/types/feature/Loader.d.ts +2 -0
- package/types/feature/index.d.ts +1 -0
- package/types/feature-list/FeatureList.d.ts +6 -0
- package/types/feature-list/index.d.ts +1 -0
- package/types/get-layout-history.d.ts +8 -0
- package/types/index.d.ts +13 -0
- package/types/layout-management/LayoutList.d.ts +2 -0
- package/types/layout-management/LayoutTile.d.ts +8 -0
- package/types/layout-management/SaveLayoutPanel.d.ts +10 -0
- package/types/layout-management/index.d.ts +5 -0
- package/types/layout-management/layoutTypes.d.ts +19 -0
- package/types/layout-management/screenshot-utils.d.ts +6 -0
- package/types/layout-management/useLayoutContextMenuItems.d.ts +6 -0
- package/types/layout-management/useLayoutManager.d.ts +26 -0
- package/types/left-nav/LeftNav.d.ts +17 -0
- package/types/left-nav/index.d.ts +1 -0
- package/types/login/LoginPanel.d.ts +7 -0
- package/types/login/VuuLogo.d.ts +2 -0
- package/types/login/index.d.ts +2 -0
- package/types/login/login-utils.d.ts +4 -0
- package/types/persistence-management/LocalPersistenceManager.d.ts +21 -0
- package/types/persistence-management/PersistenceManager.d.ts +55 -0
- package/types/persistence-management/RemotePersistenceManager.d.ts +22 -0
- package/types/persistence-management/defaultApplicationJson.d.ts +4 -0
- package/types/persistence-management/index.d.ts +4 -0
- package/types/session-editing-form/SessionEditingForm.d.ts +24 -0
- package/types/session-editing-form/index.d.ts +1 -0
- package/types/shell-layouts/context-panel/ContextPanel.d.ts +10 -0
- package/types/shell-layouts/context-panel/index.d.ts +1 -0
- package/types/shell-layouts/index.d.ts +3 -0
- package/types/shell-layouts/side-panel/SidePanel.d.ts +8 -0
- package/types/shell-layouts/side-panel/index.d.ts +1 -0
- package/types/shell-layouts/useFullHeightLeftPanel.d.ts +3 -0
- package/types/shell-layouts/useInlayLeftPanel.d.ts +3 -0
- package/types/shell-layouts/useShellLayout.d.ts +10 -0
- package/types/shell.d.ts +21 -0
- package/types/shellTypes.d.ts +29 -0
- package/types/theme-switch/ThemeSwitch.d.ts +8 -0
- package/types/theme-switch/index.d.ts +1 -0
- package/types/use-force-render.d.ts +1 -0
package/esm/shell.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { connectToServer } from '@vuu-ui/vuu-data-remote';
|
|
3
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
4
|
+
import { useWindow } from '@salt-ds/window';
|
|
5
|
+
import { StackLayout, LayoutProvider, DraggableLayout } from '@vuu-ui/vuu-layout';
|
|
6
|
+
import { useDialog, ContextMenuProvider } from '@vuu-ui/vuu-popups';
|
|
7
|
+
import { logger } from '@vuu-ui/vuu-utils';
|
|
8
|
+
import { SaltProvider } from '@salt-ds/core';
|
|
9
|
+
import cx from 'clsx';
|
|
10
|
+
import { useRef, useState, useCallback, useMemo } from 'react';
|
|
11
|
+
import { AppHeader } from './app-header/AppHeader.js';
|
|
12
|
+
import '@vuu-ui/vuu-ui-controls';
|
|
13
|
+
import 'html-to-image';
|
|
14
|
+
import { useLayoutManager } from './layout-management/useLayoutManager.js';
|
|
15
|
+
import { useLayoutContextMenuItems } from './layout-management/useLayoutContextMenuItems.js';
|
|
16
|
+
import { loadingApplicationJson } from './persistence-management/defaultApplicationJson.js';
|
|
17
|
+
import './persistence-management/LocalPersistenceManager.js';
|
|
18
|
+
import './persistence-management/RemotePersistenceManager.js';
|
|
19
|
+
import { useShellLayout } from './shell-layouts/useShellLayout.js';
|
|
20
|
+
import shellCss from './shell.css.js';
|
|
21
|
+
|
|
22
|
+
if (typeof StackLayout !== "function") {
|
|
23
|
+
console.warn(
|
|
24
|
+
"StackLayout module not loaded, will be unsbale to deserialize from layout JSON"
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const { error } = logger("Shell");
|
|
28
|
+
const defaultLeftSidePanel = {};
|
|
29
|
+
const Shell = ({
|
|
30
|
+
LayoutProps,
|
|
31
|
+
LeftSidePanelProps = defaultLeftSidePanel,
|
|
32
|
+
children,
|
|
33
|
+
className: classNameProp,
|
|
34
|
+
leftSidePanelLayout,
|
|
35
|
+
loginUrl,
|
|
36
|
+
saveLocation: _,
|
|
37
|
+
saveUrl,
|
|
38
|
+
serverUrl,
|
|
39
|
+
user,
|
|
40
|
+
...htmlAttributes
|
|
41
|
+
}) => {
|
|
42
|
+
const targetWindow = useWindow();
|
|
43
|
+
useComponentCssInjection({
|
|
44
|
+
testId: "vuu-shell",
|
|
45
|
+
css: shellCss,
|
|
46
|
+
window: targetWindow
|
|
47
|
+
});
|
|
48
|
+
const rootRef = useRef(null);
|
|
49
|
+
const { dialog, setDialogState } = useDialog();
|
|
50
|
+
const layoutId = useRef("latest");
|
|
51
|
+
const { applicationJson, saveApplicationLayout, loadLayoutById } = useLayoutManager();
|
|
52
|
+
const { buildMenuOptions, handleMenuAction } = useLayoutContextMenuItems(setDialogState);
|
|
53
|
+
const [connectionStatus, setConnectionStatus] = useState("connected");
|
|
54
|
+
const handleLayoutChange = useCallback(
|
|
55
|
+
(layout) => {
|
|
56
|
+
try {
|
|
57
|
+
saveApplicationLayout(layout);
|
|
58
|
+
} catch {
|
|
59
|
+
error?.("Failed to save layout");
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
[saveApplicationLayout]
|
|
63
|
+
);
|
|
64
|
+
const handleSwitchTheme = useCallback((mode) => {
|
|
65
|
+
if (rootRef.current) {
|
|
66
|
+
rootRef.current.dataset.mode = mode;
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
const handleNavigate = useCallback(
|
|
70
|
+
(id) => {
|
|
71
|
+
layoutId.current = id;
|
|
72
|
+
loadLayoutById(id);
|
|
73
|
+
},
|
|
74
|
+
[loadLayoutById]
|
|
75
|
+
);
|
|
76
|
+
useMemo(async () => {
|
|
77
|
+
if (serverUrl && user.token) {
|
|
78
|
+
const connectionStatus2 = await connectToServer({
|
|
79
|
+
authToken: user.token,
|
|
80
|
+
url: serverUrl,
|
|
81
|
+
username: user.username
|
|
82
|
+
});
|
|
83
|
+
setConnectionStatus(connectionStatus2);
|
|
84
|
+
}
|
|
85
|
+
}, [serverUrl, user.token, user.username]);
|
|
86
|
+
const className = cx("vuuShell");
|
|
87
|
+
const isLoading = applicationJson === loadingApplicationJson;
|
|
88
|
+
const shellLayout = useShellLayout({
|
|
89
|
+
LeftSidePanelProps,
|
|
90
|
+
leftSidePanelLayout,
|
|
91
|
+
appHeader: /* @__PURE__ */ jsx(
|
|
92
|
+
AppHeader,
|
|
93
|
+
{
|
|
94
|
+
layoutId: layoutId.current,
|
|
95
|
+
loginUrl,
|
|
96
|
+
user,
|
|
97
|
+
onNavigate: handleNavigate,
|
|
98
|
+
onSwitchTheme: handleSwitchTheme
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
});
|
|
102
|
+
if (connectionStatus === "rejected") {
|
|
103
|
+
console.log("game over, no connection to server");
|
|
104
|
+
}
|
|
105
|
+
return isLoading ? null : /* @__PURE__ */ jsx(SaltProvider, { theme: "vuu-theme", density: "high", children: /* @__PURE__ */ jsxs(
|
|
106
|
+
ContextMenuProvider,
|
|
107
|
+
{
|
|
108
|
+
menuActionHandler: handleMenuAction,
|
|
109
|
+
menuBuilder: buildMenuOptions,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
LayoutProvider,
|
|
113
|
+
{
|
|
114
|
+
...LayoutProps,
|
|
115
|
+
layout: applicationJson.layout,
|
|
116
|
+
onLayoutChange: handleLayoutChange,
|
|
117
|
+
children: /* @__PURE__ */ jsx(
|
|
118
|
+
DraggableLayout,
|
|
119
|
+
{
|
|
120
|
+
className,
|
|
121
|
+
ref: rootRef,
|
|
122
|
+
...htmlAttributes,
|
|
123
|
+
children: shellLayout
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
children || dialog
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
) });
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export { Shell };
|
|
135
|
+
//# sourceMappingURL=shell.js.map
|
package/esm/shell.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sources":["../src/shell.tsx"],"sourcesContent":["import { connectToServer } from \"@vuu-ui/vuu-data-remote\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport {\n DraggableLayout,\n LayoutProvider,\n LayoutProviderProps,\n StackLayout,\n} from \"@vuu-ui/vuu-layout\";\nimport type { LayoutChangeHandler } from \"@vuu-ui/vuu-layout\";\nimport { ContextMenuProvider, useDialog } from \"@vuu-ui/vuu-popups\";\nimport { logger, ThemeMode } from \"@vuu-ui/vuu-utils\";\nimport { SaltProvider } from \"@salt-ds/core\";\nimport cx from \"clsx\";\nimport {\n HTMLAttributes,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { AppHeader } from \"./app-header\";\nimport {\n useLayoutContextMenuItems,\n useLayoutManager,\n} from \"./layout-management\";\nimport { loadingApplicationJson } from \"./persistence-management\";\nimport { SidePanelProps, useShellLayout } from \"./shell-layouts\";\nimport { SaveLocation } from \"./shellTypes\";\n\nimport shellCss from \"./shell.css\";\n\nif (typeof StackLayout !== \"function\") {\n console.warn(\n \"StackLayout module not loaded, will be unsbale to deserialize from layout JSON\"\n );\n}\n\nexport type VuuUser = {\n username: string;\n token: string;\n};\n\nconst { error } = logger(\"Shell\");\n\nconst defaultLeftSidePanel: ShellProps[\"LeftSidePanelProps\"] = {};\n\nexport type LayoutTemplateName = \"full-height\" | \"inlay\";\n\nexport interface ShellProps extends HTMLAttributes<HTMLDivElement> {\n LayoutProps?: Pick<\n LayoutProviderProps,\n \"createNewChild\" | \"pathToDropTarget\"\n >;\n LeftSidePanelProps?: SidePanelProps;\n children?: ReactNode;\n leftSidePanelLayout?: \"full-height\" | \"inlay\";\n loginUrl?: string;\n // paletteConfig: any;\n saveLocation?: SaveLocation;\n saveUrl?: string;\n serverUrl?: string;\n user: VuuUser;\n}\n\nexport const Shell = ({\n LayoutProps,\n LeftSidePanelProps = defaultLeftSidePanel,\n children,\n className: classNameProp,\n leftSidePanelLayout,\n loginUrl,\n saveLocation: _,\n saveUrl,\n serverUrl,\n user,\n ...htmlAttributes\n}: ShellProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-shell\",\n css: shellCss,\n window: targetWindow,\n });\n\n const rootRef = useRef<HTMLDivElement>(null);\n const { dialog, setDialogState } = useDialog();\n const layoutId = useRef(\"latest\");\n const { applicationJson, saveApplicationLayout, loadLayoutById } =\n useLayoutManager();\n const { buildMenuOptions, handleMenuAction } =\n useLayoutContextMenuItems(setDialogState);\n const [connectionStatus, setConnectionStatus] = useState<\n \"connected\" | \"rejected\"\n >(\"connected\");\n\n const handleLayoutChange = useCallback<LayoutChangeHandler>(\n (layout) => {\n try {\n saveApplicationLayout(layout);\n } catch {\n error?.(\"Failed to save layout\");\n }\n },\n [saveApplicationLayout]\n );\n\n const handleSwitchTheme = useCallback((mode: ThemeMode) => {\n if (rootRef.current) {\n rootRef.current.dataset.mode = mode;\n }\n }, []);\n\n // TODO this is out of date\n const handleNavigate = useCallback(\n (id) => {\n layoutId.current = id;\n loadLayoutById(id);\n },\n [loadLayoutById]\n );\n\n useMemo(async () => {\n if (serverUrl && user.token) {\n const connectionStatus = await connectToServer({\n authToken: user.token,\n url: serverUrl,\n username: user.username,\n });\n setConnectionStatus(connectionStatus);\n }\n }, [serverUrl, user.token, user.username]);\n\n const className = cx(\"vuuShell\");\n\n const isLoading = applicationJson === loadingApplicationJson;\n\n const shellLayout = useShellLayout({\n LeftSidePanelProps,\n leftSidePanelLayout,\n appHeader: (\n <AppHeader\n layoutId={layoutId.current}\n loginUrl={loginUrl}\n user={user}\n onNavigate={handleNavigate}\n onSwitchTheme={handleSwitchTheme}\n />\n ),\n });\n\n if (connectionStatus === \"rejected\") {\n console.log(\"game over, no connection to server\");\n }\n\n return isLoading ? null : (\n <SaltProvider theme=\"vuu-theme\" density=\"high\">\n <ContextMenuProvider\n menuActionHandler={handleMenuAction}\n menuBuilder={buildMenuOptions}\n >\n <LayoutProvider\n {...LayoutProps}\n layout={applicationJson.layout}\n onLayoutChange={handleLayoutChange}\n >\n <DraggableLayout\n className={className}\n ref={rootRef}\n {...htmlAttributes}\n >\n {shellLayout}\n </DraggableLayout>\n </LayoutProvider>\n {children || dialog}\n </ContextMenuProvider>\n </SaltProvider>\n );\n};\n"],"names":["connectionStatus"],"mappings":"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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const isWildcardSchema = (schema) => schema === "*";
|
|
2
|
+
const isTableSchema = (schema) => typeof schema === "object" && typeof schema.module === "string" && typeof schema.table === "string";
|
|
3
|
+
|
|
4
|
+
export { isTableSchema, isWildcardSchema };
|
|
5
|
+
//# sourceMappingURL=shellTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellTypes.js","sources":["../src/shellTypes.ts"],"sourcesContent":["import type { VuuTable } from \"@vuu-ui/vuu-protocol-types\";\nimport type { ViewProps } from \"@vuu-ui/vuu-layout\";\n\ndeclare global {\n const vuuConfig: Promise<VuuConfig>;\n}\n\nexport type SaveLocation = \"local\" | \"remote\";\n\nexport interface FeatureConfig {\n name: string;\n title: string;\n url: string;\n css?: string;\n leftNavLocation: \"vuu-features\" | \"vuu-tables\";\n featureProps?: {\n schema?: \"*\" | VuuTable;\n schemas?: VuuTable[];\n ViewProps?: Partial<ViewProps>;\n };\n}\n\nexport type Features = {\n [key: string]: FeatureConfig;\n};\nexport interface VuuConfig {\n features: Features;\n authUrl?: string;\n websocketUrl: string;\n ssl: boolean;\n}\n\nexport const isWildcardSchema = (schema?: \"*\" | VuuTable): schema is \"*\" =>\n schema === \"*\";\nexport const isTableSchema = (schema?: \"*\" | VuuTable): schema is VuuTable =>\n typeof schema === \"object\" &&\n typeof schema.module === \"string\" &&\n typeof schema.table === \"string\";\n"],"names":[],"mappings":"AAgCa,MAAA,gBAAA,GAAmB,CAAC,MAAA,KAC/B,MAAW,KAAA,IAAA;AACN,MAAM,aAAgB,GAAA,CAAC,MAC5B,KAAA,OAAO,MAAW,KAAA,QAAA,IAClB,OAAO,MAAA,CAAO,MAAW,KAAA,QAAA,IACzB,OAAO,MAAA,CAAO,KAAU,KAAA;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var themeSwitchCss = "\n.vuuThemeSwitch {\n --saltButton-minWidth: 22px;\n --svg-light: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\"><path d=\"M24 31q2.9 0 4.95-2.05Q31 26.9 31 24q0-2.9-2.05-4.95Q26.9 17 24 17q-2.9 0-4.95 2.05Q17 21.1 17 24q0 2.9 2.05 4.95Q21.1 31 24 31Zm0 3q-4.15 0-7.075-2.925T14 24q0-4.15 2.925-7.075T24 14q4.15 0 7.075 2.925T34 24q0 4.15-2.925 7.075T24 34ZM3.5 25.5q-.65 0-1.075-.425Q2 24.65 2 24q0-.65.425-1.075Q2.85 22.5 3.5 22.5h5q.65 0 1.075.425Q10 23.35 10 24q0 .65-.425 1.075-.425.425-1.075.425Zm36 0q-.65 0-1.075-.425Q38 24.65 38 24q0-.65.425-1.075.425-.425 1.075-.425h5q.65 0 1.075.425Q46 23.35 46 24q0 .65-.425 1.075-.425.425-1.075.425ZM24 10q-.65 0-1.075-.425Q22.5 9.15 22.5 8.5v-5q0-.65.425-1.075Q23.35 2 24 2q.65 0 1.075.425.425.425.425 1.075v5q0 .65-.425 1.075Q24.65 10 24 10Zm0 36q-.65 0-1.075-.425-.425-.425-.425-1.075v-5q0-.65.425-1.075Q23.35 38 24 38q.65 0 1.075.425.425.425.425 1.075v5q0 .65-.425 1.075Q24.65 46 24 46ZM12 14.1l-2.85-2.8q-.45-.45-.425-1.075.025-.625.425-1.075.45-.45 1.075-.45t1.075.45L14.1 12q.4.45.4 1.05 0 .6-.4 1-.4.45-1.025.45-.625 0-1.075-.4Zm24.7 24.75L33.9 36q-.4-.45-.4-1.075t.45-1.025q.4-.45 1-.45t1.05.45l2.85 2.8q.45.45.425 1.075-.025.625-.425 1.075-.45.45-1.075.45t-1.075-.45ZM33.9 14.1q-.45-.45-.45-1.05 0-.6.45-1.05l2.8-2.85q.45-.45 1.075-.425.625.025 1.075.425.45.45.45 1.075t-.45 1.075L36 14.1q-.4.4-1.025.4-.625 0-1.075-.4ZM9.15 38.85q-.45-.45-.45-1.075t.45-1.075L12 33.9q.45-.45 1.05-.45.6 0 1.05.45.45.45.45 1.05 0 .6-.45 1.05l-2.8 2.85q-.45.45-1.075.425-.625-.025-1.075-.425ZM24 24Z\"/></svg>');\n --svg-dark: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 48 48\"><path d=\"M24 42q-7.5 0-12.75-5.25T6 24q0-7.5 5.25-12.75T24 6q.4 0 .85.025.45.025 1.15.075-1.8 1.6-2.8 3.95-1 2.35-1 4.95 0 4.5 3.15 7.65Q28.5 25.8 33 25.8q2.6 0 4.95-.925T41.9 22.3q.05.6.075.975Q42 23.65 42 24q0 7.5-5.25 12.75T24 42Zm0-3q5.45 0 9.5-3.375t5.05-7.925q-1.25.55-2.675.825Q34.45 28.8 33 28.8q-5.75 0-9.775-4.025T19.2 15q0-1.2.25-2.575.25-1.375.9-3.125-4.9 1.35-8.125 5.475Q9 18.9 9 24q0 6.25 4.375 10.625T24 39Zm-.2-14.85Z\"/></svg>');\n padding: 2px;\n}\n\n.salt-density-high .vuuThemeSwitch {\n --saltButton-minWidth: 16px;\n --saltButton-width: 18px;\n --vuuThemeSwitch-iconSize: 16px;\n}\n\n.vuuThemeSwitch [data-icon] {\n --vuu-icon-size: var(--vuuThemeSwitch-iconSize,18px);\n}\n\n.vuuThemeSwitch [data-icon='light'] {\n --vuu-icon-svg: var(--svg-light);\n}\n.vuuThemeSwitch [data-icon='dark'] {\n --vuu-icon-svg: var(--svg-dark);\n}\n\n.vuuThemeSwitch .saltToggleButton {\n height: 20px;\n width: 20px;\n}\n\n";
|
|
2
|
+
|
|
3
|
+
export { themeSwitchCss as default };
|
|
4
|
+
//# sourceMappingURL=ThemeSwitch.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeSwitch.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import cx from 'clsx';
|
|
3
|
+
import { useControlled, ToggleButtonGroup, ToggleButton } from '@salt-ds/core';
|
|
4
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
5
|
+
import { useWindow } from '@salt-ds/window';
|
|
6
|
+
import { useCallback } from 'react';
|
|
7
|
+
import themeSwitchCss from './ThemeSwitch.css.js';
|
|
8
|
+
|
|
9
|
+
const classBase = "vuuThemeSwitch";
|
|
10
|
+
const ThemeSwitch = ({
|
|
11
|
+
className: classNameProp,
|
|
12
|
+
defaultMode: defaultModeProp,
|
|
13
|
+
mode: modeProp,
|
|
14
|
+
onChange,
|
|
15
|
+
...htmlAttributes
|
|
16
|
+
}) => {
|
|
17
|
+
const targetWindow = useWindow();
|
|
18
|
+
useComponentCssInjection({
|
|
19
|
+
testId: "vuu-theme-switch",
|
|
20
|
+
css: themeSwitchCss,
|
|
21
|
+
window: targetWindow
|
|
22
|
+
});
|
|
23
|
+
const [mode, setMode] = useControlled({
|
|
24
|
+
controlled: modeProp,
|
|
25
|
+
default: defaultModeProp ?? "light",
|
|
26
|
+
name: "ThemeSwitch",
|
|
27
|
+
state: "mode"
|
|
28
|
+
});
|
|
29
|
+
const handleChangeSecondary = useCallback(
|
|
30
|
+
(evt) => {
|
|
31
|
+
const { value } = evt.target;
|
|
32
|
+
setMode(value);
|
|
33
|
+
onChange(value);
|
|
34
|
+
},
|
|
35
|
+
[onChange, setMode]
|
|
36
|
+
);
|
|
37
|
+
const className = cx(classBase, classNameProp);
|
|
38
|
+
return /* @__PURE__ */ jsxs(
|
|
39
|
+
ToggleButtonGroup,
|
|
40
|
+
{
|
|
41
|
+
className,
|
|
42
|
+
...htmlAttributes,
|
|
43
|
+
onChange: handleChangeSecondary,
|
|
44
|
+
value: mode,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(ToggleButton, { "aria-label": "alert", "data-icon": "light", value: "light" }),
|
|
47
|
+
/* @__PURE__ */ jsx(ToggleButton, { "aria-label": "home", "data-icon": "dark", value: "dark" })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { ThemeSwitch };
|
|
54
|
+
//# sourceMappingURL=ThemeSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeSwitch.js","sources":["../../src/theme-switch/ThemeSwitch.tsx"],"sourcesContent":["import cx from \"clsx\";\nimport { ToggleButton, ToggleButtonGroup, useControlled } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { HTMLAttributes, SyntheticEvent, useCallback } from \"react\";\nimport { ThemeMode } from \"@vuu-ui/vuu-utils\";\n\nimport themeSwitchCss from \"./ThemeSwitch.css\";\n\nconst classBase = \"vuuThemeSwitch\";\nexport interface ThemeSwitchProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n defaultMode?: ThemeMode;\n mode?: ThemeMode;\n onChange: (mode: ThemeMode) => void;\n}\n\nexport const ThemeSwitch = ({\n className: classNameProp,\n defaultMode: defaultModeProp,\n mode: modeProp,\n onChange,\n ...htmlAttributes\n}: ThemeSwitchProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-theme-switch\",\n css: themeSwitchCss,\n window: targetWindow,\n });\n\n const [mode, setMode] = useControlled<ThemeMode>({\n controlled: modeProp,\n default: defaultModeProp ?? \"light\",\n name: \"ThemeSwitch\",\n state: \"mode\",\n });\n\n const handleChangeSecondary = useCallback(\n (evt: SyntheticEvent<HTMLButtonElement>) => {\n const { value } = evt.target as HTMLButtonElement;\n setMode(value as ThemeMode);\n onChange(value as ThemeMode);\n },\n [onChange, setMode]\n );\n const className = cx(classBase, classNameProp);\n return (\n <ToggleButtonGroup\n className={className}\n {...htmlAttributes}\n onChange={handleChangeSecondary}\n value={mode}\n >\n <ToggleButton aria-label=\"alert\" data-icon=\"light\" value=\"light\" />\n <ToggleButton aria-label=\"home\" data-icon=\"dark\" value=\"dark\" />\n </ToggleButtonGroup>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AASA,MAAM,SAAY,GAAA,gBAAA,CAAA;AAQX,MAAM,cAAc,CAAC;AAAA,EAC1B,SAAW,EAAA,aAAA;AAAA,EACX,WAAa,EAAA,eAAA;AAAA,EACb,IAAM,EAAA,QAAA;AAAA,EACN,QAAA;AAAA,EACA,GAAG,cAAA;AACL,CAAwB,KAAA;AACtB,EAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,kBAAA;AAAA,IACR,GAAK,EAAA,cAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,aAAyB,CAAA;AAAA,IAC/C,UAAY,EAAA,QAAA;AAAA,IACZ,SAAS,eAAmB,IAAA,OAAA;AAAA,IAC5B,IAAM,EAAA,aAAA;AAAA,IACN,KAAO,EAAA,MAAA;AAAA,GACR,CAAA,CAAA;AAED,EAAA,MAAM,qBAAwB,GAAA,WAAA;AAAA,IAC5B,CAAC,GAA2C,KAAA;AAC1C,MAAM,MAAA,EAAE,KAAM,EAAA,GAAI,GAAI,CAAA,MAAA,CAAA;AACtB,MAAA,OAAA,CAAQ,KAAkB,CAAA,CAAA;AAC1B,MAAA,QAAA,CAAS,KAAkB,CAAA,CAAA;AAAA,KAC7B;AAAA,IACA,CAAC,UAAU,OAAO,CAAA;AAAA,GACpB,CAAA;AACA,EAAM,MAAA,SAAA,GAAY,EAAG,CAAA,SAAA,EAAW,aAAa,CAAA,CAAA;AAC7C,EACE,uBAAA,IAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACC,GAAG,cAAA;AAAA,MACJ,QAAU,EAAA,qBAAA;AAAA,MACV,KAAO,EAAA,IAAA;AAAA,MAEP,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,gBAAa,YAAW,EAAA,OAAA,EAAQ,WAAU,EAAA,OAAA,EAAQ,OAAM,OAAQ,EAAA,CAAA;AAAA,4BAChE,YAAa,EAAA,EAAA,YAAA,EAAW,QAAO,WAAU,EAAA,MAAA,EAAO,OAAM,MAAO,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GAChE,CAAA;AAEJ;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.0.26",
|
|
3
|
+
"description": "VUU UI Shell",
|
|
4
|
+
"author": "heswell",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"devDependencies": {
|
|
7
|
+
"@vuu-ui/vuu-data-types": "0.0.26",
|
|
8
|
+
"@vuu-ui/vuu-protocol-types": "0.0.26",
|
|
9
|
+
"@vuu-ui/vuu-table-types": "0.0.26"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@salt-ds/core": "1.17.0",
|
|
13
|
+
"@salt-ds/styles": "0.2.1",
|
|
14
|
+
"@salt-ds/window": "0.1.1",
|
|
15
|
+
"@vuu-ui/vuu-data-remote": "0.0.26",
|
|
16
|
+
"@vuu-ui/vuu-icons": "0.0.26",
|
|
17
|
+
"@vuu-ui/vuu-layout": "0.0.26",
|
|
18
|
+
"@vuu-ui/vuu-popups": "0.0.26",
|
|
19
|
+
"@vuu-ui/vuu-table": "0.0.26",
|
|
20
|
+
"@vuu-ui/vuu-ui-controls": "0.0.26",
|
|
21
|
+
"@vuu-ui/vuu-utils": "0.0.26",
|
|
22
|
+
"html-to-image": "^1.11.11"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"clsx": "^2.0.0",
|
|
26
|
+
"react": ">=17.0.2",
|
|
27
|
+
"react-dom": ">=17.0.2"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"files": [
|
|
31
|
+
"README.md",
|
|
32
|
+
"esm",
|
|
33
|
+
"cjs",
|
|
34
|
+
"/types"
|
|
35
|
+
],
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"require": "./cjs/index.js",
|
|
39
|
+
"import": "./esm/index.js",
|
|
40
|
+
"types": "./types/index.d.ts"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"main": "cjs/index.js",
|
|
44
|
+
"module": "esm/index.js",
|
|
45
|
+
"name": "@vuu-ui/vuu-shell",
|
|
46
|
+
"type": "module",
|
|
47
|
+
"types": "types/index.d.ts"
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DefaultColumnConfiguration, ListOption } from "@vuu-ui/vuu-table-types";
|
|
2
|
+
import type { RpcResponseHandler } from "@vuu-ui/vuu-data-types";
|
|
3
|
+
import { ReactElement, ReactNode } from "react";
|
|
4
|
+
import type { VuuTable } from "@vuu-ui/vuu-protocol-types";
|
|
5
|
+
export type LookupTableProvider = (table: VuuTable) => ListOption[];
|
|
6
|
+
export interface ShellContextProps {
|
|
7
|
+
getDefaultColumnConfig?: DefaultColumnConfiguration;
|
|
8
|
+
getLookupValues?: LookupTableProvider;
|
|
9
|
+
handleRpcResponse?: RpcResponseHandler;
|
|
10
|
+
}
|
|
11
|
+
export interface ShellProviderProps {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
value?: ShellContextProps;
|
|
14
|
+
}
|
|
15
|
+
export declare const ShellContextProvider: ({ children, value, }: ShellProviderProps) => ReactElement;
|
|
16
|
+
export declare const useShellContext: () => ShellContextProps;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ThemeMode } from "@vuu-ui/vuu-utils";
|
|
2
|
+
import { HTMLAttributes } from "react";
|
|
3
|
+
import { VuuUser } from "../shell";
|
|
4
|
+
export interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
layoutId: string;
|
|
6
|
+
loginUrl?: string;
|
|
7
|
+
onNavigate: (id: string) => void;
|
|
8
|
+
onSwitchTheme?: (mode: ThemeMode) => void;
|
|
9
|
+
themeMode?: ThemeMode;
|
|
10
|
+
user: VuuUser;
|
|
11
|
+
}
|
|
12
|
+
export declare const AppHeader: ({ className: classNameProp, layoutId, loginUrl, onNavigate, onSwitchTheme, themeMode: _, user, ...htmlAttributes }: AppHeaderProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AppHeader';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type connectionStatus = "connected" | "reconnected" | "connecting" | "disconnected";
|
|
3
|
+
interface ConnectionStatusProps {
|
|
4
|
+
connectionStatus: connectionStatus;
|
|
5
|
+
className?: string;
|
|
6
|
+
props?: unknown;
|
|
7
|
+
element?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const ConnectionStatusIndicator: ({ connectionStatus, className, element, ...props }: ConnectionStatusProps) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ConnectionStatusIndicator";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ViewProps } from "@vuu-ui/vuu-layout";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export interface FeatureProps<P extends object | undefined = any> {
|
|
4
|
+
/**
|
|
5
|
+
props that will be passed to the lazily loaded component.
|
|
6
|
+
*/
|
|
7
|
+
ComponentProps?: P;
|
|
8
|
+
ViewProps?: Partial<Pick<ViewProps, "closeable" | "header">>;
|
|
9
|
+
css?: string;
|
|
10
|
+
height?: number;
|
|
11
|
+
title?: string;
|
|
12
|
+
/**
|
|
13
|
+
The url of javascript bundle to lazily load. Bundle must provide a default export
|
|
14
|
+
and that export must be a React component.
|
|
15
|
+
*/
|
|
16
|
+
url: string;
|
|
17
|
+
width?: number;
|
|
18
|
+
}
|
|
19
|
+
declare function RawFeature<Params extends object | undefined>({ url, css, ComponentProps: params, ...props }: FeatureProps<Params>): JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
Feature is a wrapper around React Lazy Loading. It will load a component
|
|
22
|
+
from the given url. That url must resolve to a javascript bundle with a
|
|
23
|
+
single default export. That export must be a React component.
|
|
24
|
+
*/
|
|
25
|
+
export declare const Feature: React.MemoExoticComponent<typeof RawFeature>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ErrorInfo, ReactNode } from "react";
|
|
2
|
+
import { FeatureProps } from "./Feature";
|
|
3
|
+
export interface FeatureErrorBoundaryProps extends FeatureProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare class FeatureErrorBoundary extends React.Component<FeatureErrorBoundaryProps, any> {
|
|
7
|
+
constructor(props: FeatureErrorBoundaryProps);
|
|
8
|
+
static getDerivedStateFromError(error: Error): {
|
|
9
|
+
errorMessage: string;
|
|
10
|
+
};
|
|
11
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
12
|
+
render(): React.ReactNode;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Feature';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
import { FeatureProps } from "../feature/Feature";
|
|
3
|
+
export interface FeatureListProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
features: FeatureProps[];
|
|
5
|
+
}
|
|
6
|
+
export declare const FeatureList: ({ features, title, ...htmlAttributes }: FeatureListProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FeatureList";
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./app-header";
|
|
2
|
+
export * from "./connection-status";
|
|
3
|
+
export * from "./feature";
|
|
4
|
+
export * from "./layout-management";
|
|
5
|
+
export * from "./left-nav";
|
|
6
|
+
export * from "./login";
|
|
7
|
+
export * from "./session-editing-form";
|
|
8
|
+
export * from "./shell";
|
|
9
|
+
export * from "./shell-layouts";
|
|
10
|
+
export * from "./shellTypes";
|
|
11
|
+
export * from "./ShellContextProvider";
|
|
12
|
+
export * from "./feature-list";
|
|
13
|
+
export * from "./theme-switch";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LayoutMetadata } from "./layoutTypes";
|
|
3
|
+
type LayoutTileProps = {
|
|
4
|
+
metadata: LayoutMetadata;
|
|
5
|
+
handleLoadLayout: (layoutId?: string) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const LayoutTile: (props: LayoutTileProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LayoutMetadataDto } from "./layoutTypes";
|
|
3
|
+
type SaveLayoutPanelProps = {
|
|
4
|
+
componentId?: string;
|
|
5
|
+
defaultTitle?: string;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
onSave: (layoutMetadata: LayoutMetadataDto) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const SaveLayoutPanel: (props: SaveLayoutPanelProps) => JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LayoutJSON } from "@vuu-ui/vuu-layout";
|
|
2
|
+
export interface WithId {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface LayoutMetadata extends WithId {
|
|
6
|
+
name: string;
|
|
7
|
+
group: string;
|
|
8
|
+
screenshot: string;
|
|
9
|
+
user: string;
|
|
10
|
+
created: string;
|
|
11
|
+
}
|
|
12
|
+
export type LayoutMetadataDto = Omit<LayoutMetadata, "id" | "created">;
|
|
13
|
+
export interface Layout extends WithId {
|
|
14
|
+
json: LayoutJSON;
|
|
15
|
+
}
|
|
16
|
+
export type ApplicationLayout = {
|
|
17
|
+
username: string;
|
|
18
|
+
definition: LayoutJSON;
|
|
19
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MenuActionHandler, MenuBuilder } from "@vuu-ui/vuu-data-types";
|
|
2
|
+
import { SetDialog } from "@vuu-ui/vuu-popups";
|
|
3
|
+
export declare const useLayoutContextMenuItems: (setDialogState: SetDialog) => {
|
|
4
|
+
buildMenuOptions: MenuBuilder<string, unknown>;
|
|
5
|
+
handleMenuAction: MenuActionHandler;
|
|
6
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ApplicationJSON, ApplicationSettings, LayoutJSON, ApplicationSetting } from "@vuu-ui/vuu-layout";
|
|
3
|
+
import { LayoutMetadata, LayoutMetadataDto } from "./layoutTypes";
|
|
4
|
+
export declare const LayoutManagementContext: React.Context<{
|
|
5
|
+
layoutMetadata: LayoutMetadata[];
|
|
6
|
+
saveLayout: (n: LayoutMetadataDto) => void;
|
|
7
|
+
applicationJson: ApplicationJSON;
|
|
8
|
+
saveApplicationLayout: (layout: LayoutJSON) => void;
|
|
9
|
+
getApplicationSettings: (key?: keyof ApplicationSettings) => ApplicationSettings | ApplicationSetting | undefined;
|
|
10
|
+
saveApplicationSettings: (settings: ApplicationSettings | ApplicationSetting, key?: keyof ApplicationSettings) => void;
|
|
11
|
+
loadLayoutById: (id: string) => void;
|
|
12
|
+
}>;
|
|
13
|
+
type LayoutManagementProviderProps = {
|
|
14
|
+
children: JSX.Element | JSX.Element[];
|
|
15
|
+
};
|
|
16
|
+
export declare const LayoutManagementProvider: (props: LayoutManagementProviderProps) => JSX.Element;
|
|
17
|
+
export declare const useLayoutManager: () => {
|
|
18
|
+
layoutMetadata: LayoutMetadata[];
|
|
19
|
+
saveLayout: (n: LayoutMetadataDto) => void;
|
|
20
|
+
applicationJson: ApplicationJSON;
|
|
21
|
+
saveApplicationLayout: (layout: LayoutJSON) => void;
|
|
22
|
+
getApplicationSettings: (key?: keyof ApplicationSettings) => ApplicationSettings | ApplicationSetting | undefined;
|
|
23
|
+
saveApplicationSettings: (settings: ApplicationSettings | ApplicationSetting, key?: keyof ApplicationSettings) => void;
|
|
24
|
+
loadLayoutById: (id: string) => void;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
import { FeatureProps } from "../feature";
|
|
3
|
+
export type NavDisplayStatus = "menu-full" | "menu-icons" | "menu-full-content" | "menu-icons-content";
|
|
4
|
+
export type NavDisplayStatusHandler = (navDisplayStatus: NavDisplayStatus) => void;
|
|
5
|
+
export interface LeftNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
"data-path"?: string;
|
|
7
|
+
defaultActiveTabIndex?: number;
|
|
8
|
+
defaultExpanded?: boolean;
|
|
9
|
+
features: FeatureProps[];
|
|
10
|
+
onActiveChange?: (activeTabIndex: number) => void;
|
|
11
|
+
onTogglePrimaryMenu?: (expanded: boolean) => void;
|
|
12
|
+
sizeCollapsed?: number;
|
|
13
|
+
sizeContent?: number;
|
|
14
|
+
sizeExpanded?: number;
|
|
15
|
+
tableFeatures: FeatureProps[];
|
|
16
|
+
}
|
|
17
|
+
export declare const LeftNav: (props: LeftNavProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./LeftNav";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
export interface LoginPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmit"> {
|
|
3
|
+
appName?: string;
|
|
4
|
+
onSubmit: (username: string, password?: string) => void;
|
|
5
|
+
requirePassword?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const LoginPanel: ({ appName, className, requirePassword, onSubmit, ...htmlAttributes }: LoginPanelProps) => JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ApplicationJSON, LayoutJSON } from "@vuu-ui/vuu-layout";
|
|
2
|
+
import { PersistenceManager } from "./PersistenceManager";
|
|
3
|
+
import { Layout, LayoutMetadata, LayoutMetadataDto } from "../layout-management";
|
|
4
|
+
export declare class LocalPersistenceManager implements PersistenceManager {
|
|
5
|
+
#private;
|
|
6
|
+
username: string;
|
|
7
|
+
metadataSaveLocation: string;
|
|
8
|
+
layoutsSaveLocation: string;
|
|
9
|
+
constructor(urlKey?: string);
|
|
10
|
+
createLayout(metadata: LayoutMetadataDto, layout: LayoutJSON): Promise<LayoutMetadata>;
|
|
11
|
+
updateLayout(id: string, newMetadata: LayoutMetadataDto, newLayout: LayoutJSON): Promise<void>;
|
|
12
|
+
deleteLayout(id: string): Promise<void>;
|
|
13
|
+
loadLayout(id: string): Promise<LayoutJSON>;
|
|
14
|
+
loadMetadata(): Promise<LayoutMetadata[]>;
|
|
15
|
+
loadApplicationJSON(): Promise<ApplicationJSON>;
|
|
16
|
+
saveApplicationJSON(applicationJSON: ApplicationJSON): Promise<void>;
|
|
17
|
+
loadLayouts: () => Promise<Layout[]>;
|
|
18
|
+
saveLayoutsWithMetadata: (layouts: Layout[], metadata: LayoutMetadata[]) => void;
|
|
19
|
+
validateIds: (id: string) => Promise<void>;
|
|
20
|
+
validateId: (id: string, dataType: "metadata" | "layout") => Promise<void>;
|
|
21
|
+
}
|