@vuu-ui/vuu-shell 0.8.77 → 0.8.78

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.
@@ -21,8 +21,8 @@ const useInlayLeftPanel = ({
21
21
  },
22
22
  [open]
23
23
  );
24
- const getDrawers = React.useCallback(
25
- (leftSidePanel) => {
24
+ return React.useMemo(() => {
25
+ const getDrawers = (leftSidePanel) => {
26
26
  const drawers = [];
27
27
  drawers.push(
28
28
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -51,33 +51,32 @@ const useInlayLeftPanel = ({
51
51
  )
52
52
  );
53
53
  return drawers;
54
- },
55
- [handleDrawerClick, open]
56
- );
57
- return /* @__PURE__ */ jsxRuntime.jsxs(
58
- vuuLayout.Flexbox,
59
- {
60
- ...htmlAttributes,
61
- style: {
62
- ...htmlAttributes?.style,
63
- flexDirection: "column"
64
- },
65
- children: [
66
- appHeader,
67
- /* @__PURE__ */ jsxRuntime.jsx(vuuLayout.DockLayout, { style: { flex: 1 }, children: getDrawers(LeftSidePanelProps?.children).concat(
68
- /* @__PURE__ */ jsxRuntime.jsx(
69
- vuuLayout.LayoutContainer,
70
- {
71
- dropTarget: true,
72
- id: vuuUtils.VuuShellLocation.WorkspaceContainer,
73
- style: { width: "100%", height: "100%" }
74
- },
75
- "main-content"
76
- )
77
- ) })
78
- ]
79
- }
80
- );
54
+ };
55
+ return /* @__PURE__ */ jsxRuntime.jsxs(
56
+ vuuLayout.Flexbox,
57
+ {
58
+ ...htmlAttributes,
59
+ style: {
60
+ ...htmlAttributes?.style,
61
+ flexDirection: "column"
62
+ },
63
+ children: [
64
+ appHeader,
65
+ /* @__PURE__ */ jsxRuntime.jsx(vuuLayout.DockLayout, { style: { flex: 1 }, children: getDrawers(LeftSidePanelProps?.children).concat(
66
+ /* @__PURE__ */ jsxRuntime.jsx(
67
+ vuuLayout.LayoutContainer,
68
+ {
69
+ dropTarget: true,
70
+ id: vuuUtils.VuuShellLocation.WorkspaceContainer,
71
+ style: { width: "100%", height: "100%" }
72
+ },
73
+ "main-content"
74
+ )
75
+ ) })
76
+ ]
77
+ }
78
+ );
79
+ }, [LeftSidePanelProps, appHeader, handleDrawerClick, htmlAttributes, open]);
81
80
  };
82
81
 
83
82
  exports.useInlayLeftPanel = useInlayLeftPanel;
@@ -1 +1 @@
1
- {"version":3,"file":"useInlayLeftPanel.js","sources":["../../../src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.tsx"],"sourcesContent":["import {\n DockLayout,\n LayoutContainer,\n Drawer,\n Flexbox,\n View,\n} from \"@vuu-ui/vuu-layout\";\n\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport { MouseEvent, ReactElement, useCallback, useRef, useState } from \"react\";\nimport { ShellLayoutTemplateHook } from \"../useShellLayout\";\n\nexport const useInlayLeftPanel: ShellLayoutTemplateHook = ({\n LeftSidePanelProps,\n appHeader,\n htmlAttributes,\n}) => {\n const paletteView = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(true);\n\n const handleDrawerClick = useCallback(\n (e: MouseEvent<HTMLElement>) => {\n const target = e.target as HTMLElement;\n if (!paletteView.current?.contains(target)) {\n setOpen(!open);\n }\n },\n [open]\n );\n\n const getDrawers = useCallback(\n (leftSidePanel) => {\n const drawers: ReactElement[] = [];\n drawers.push(\n <Drawer\n key=\"left-panel\"\n onClick={handleDrawerClick}\n open={open}\n position=\"left\"\n inline\n peekaboo\n sizeOpen={200}\n toggleButton=\"end\"\n >\n <View\n className=\"vuuShell-palette\"\n id=\"vw-app-palette\"\n key=\"app-palette\"\n ref={paletteView}\n style={{ height: \"100%\" }}\n >\n {leftSidePanel}\n </View>\n </Drawer>\n );\n\n return drawers;\n },\n [handleDrawerClick, open]\n );\n\n return (\n <Flexbox\n {...htmlAttributes}\n style={{\n ...htmlAttributes?.style,\n flexDirection: \"column\",\n }}\n >\n {appHeader}\n <DockLayout style={{ flex: 1 }}>\n {getDrawers(LeftSidePanelProps?.children).concat(\n <LayoutContainer\n dropTarget\n id={VuuShellLocation.WorkspaceContainer}\n key=\"main-content\"\n style={{ width: \"100%\", height: \"100%\" }}\n />\n )}\n </DockLayout>\n </Flexbox>\n );\n};\n"],"names":["useRef","useState","useCallback","jsx","Drawer","View","jsxs","Flexbox","DockLayout","LayoutContainer","VuuShellLocation"],"mappings":";;;;;;;AAYO,MAAM,oBAA6C,CAAC;AAAA,EACzD,kBAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AACF,CAAM,KAAA;AACJ,EAAM,MAAA,WAAA,GAAcA,aAAuB,IAAI,CAAA,CAAA;AAC/C,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAIC,eAAS,IAAI,CAAA,CAAA;AAErC,EAAA,MAAM,iBAAoB,GAAAC,iBAAA;AAAA,IACxB,CAAC,CAA+B,KAAA;AAC9B,MAAA,MAAM,SAAS,CAAE,CAAA,MAAA,CAAA;AACjB,MAAA,IAAI,CAAC,WAAA,CAAY,OAAS,EAAA,QAAA,CAAS,MAAM,CAAG,EAAA;AAC1C,QAAA,OAAA,CAAQ,CAAC,IAAI,CAAA,CAAA;AAAA,OACf;AAAA,KACF;AAAA,IACA,CAAC,IAAI,CAAA;AAAA,GACP,CAAA;AAEA,EAAA,MAAM,UAAa,GAAAA,iBAAA;AAAA,IACjB,CAAC,aAAkB,KAAA;AACjB,MAAA,MAAM,UAA0B,EAAC,CAAA;AACjC,MAAQ,OAAA,CAAA,IAAA;AAAA,wBACNC,cAAA;AAAA,UAACC,gBAAA;AAAA,UAAA;AAAA,YAEC,OAAS,EAAA,iBAAA;AAAA,YACT,IAAA;AAAA,YACA,QAAS,EAAA,MAAA;AAAA,YACT,MAAM,EAAA,IAAA;AAAA,YACN,QAAQ,EAAA,IAAA;AAAA,YACR,QAAU,EAAA,GAAA;AAAA,YACV,YAAa,EAAA,KAAA;AAAA,YAEb,QAAA,kBAAAD,cAAA;AAAA,cAACE,cAAA;AAAA,cAAA;AAAA,gBACC,SAAU,EAAA,kBAAA;AAAA,gBACV,EAAG,EAAA,gBAAA;AAAA,gBAEH,GAAK,EAAA,WAAA;AAAA,gBACL,KAAA,EAAO,EAAE,MAAA,EAAQ,MAAO,EAAA;AAAA,gBAEvB,QAAA,EAAA,aAAA;AAAA,eAAA;AAAA,cAJG,aAAA;AAAA,aAKN;AAAA,WAAA;AAAA,UAjBI,YAAA;AAAA,SAkBN;AAAA,OACF,CAAA;AAEA,MAAO,OAAA,OAAA,CAAA;AAAA,KACT;AAAA,IACA,CAAC,mBAAmB,IAAI,CAAA;AAAA,GAC1B,CAAA;AAEA,EACE,uBAAAC,eAAA;AAAA,IAACC,iBAAA;AAAA,IAAA;AAAA,MACE,GAAG,cAAA;AAAA,MACJ,KAAO,EAAA;AAAA,QACL,GAAG,cAAgB,EAAA,KAAA;AAAA,QACnB,aAAe,EAAA,QAAA;AAAA,OACjB;AAAA,MAEC,QAAA,EAAA;AAAA,QAAA,SAAA;AAAA,wBACDJ,cAAA,CAACK,oBAAW,EAAA,EAAA,KAAA,EAAO,EAAE,IAAA,EAAM,GACxB,EAAA,QAAA,EAAA,UAAA,CAAW,kBAAoB,EAAA,QAAQ,CAAE,CAAA,MAAA;AAAA,0BACxCL,cAAA;AAAA,YAACM,yBAAA;AAAA,YAAA;AAAA,cACC,UAAU,EAAA,IAAA;AAAA,cACV,IAAIC,yBAAiB,CAAA,kBAAA;AAAA,cAErB,KAAO,EAAA,EAAE,KAAO,EAAA,MAAA,EAAQ,QAAQ,MAAO,EAAA;AAAA,aAAA;AAAA,YADnC,cAAA;AAAA,WAEN;AAAA,SAEJ,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"useInlayLeftPanel.js","sources":["../../../src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.tsx"],"sourcesContent":["import {\n DockLayout,\n LayoutContainer,\n Drawer,\n Flexbox,\n View,\n} from \"@vuu-ui/vuu-layout\";\n\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport {\n MouseEvent,\n ReactElement,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { ShellLayoutTemplateHook } from \"../useShellLayout\";\n\nexport const useInlayLeftPanel: ShellLayoutTemplateHook = ({\n LeftSidePanelProps,\n appHeader,\n htmlAttributes,\n}) => {\n const paletteView = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(true);\n const handleDrawerClick = useCallback(\n (e: MouseEvent<HTMLElement>) => {\n const target = e.target as HTMLElement;\n if (!paletteView.current?.contains(target)) {\n setOpen(!open);\n }\n },\n [open]\n );\n\n return useMemo(() => {\n const getDrawers = (leftSidePanel: ReactNode) => {\n const drawers: ReactElement[] = [];\n drawers.push(\n <Drawer\n key=\"left-panel\"\n onClick={handleDrawerClick}\n open={open}\n position=\"left\"\n inline\n peekaboo\n sizeOpen={200}\n toggleButton=\"end\"\n >\n <View\n className=\"vuuShell-palette\"\n id=\"vw-app-palette\"\n key=\"app-palette\"\n ref={paletteView}\n style={{ height: \"100%\" }}\n >\n {leftSidePanel}\n </View>\n </Drawer>\n );\n\n return drawers;\n };\n\n return (\n <Flexbox\n {...htmlAttributes}\n style={{\n ...htmlAttributes?.style,\n flexDirection: \"column\",\n }}\n >\n {appHeader}\n <DockLayout style={{ flex: 1 }}>\n {getDrawers(LeftSidePanelProps?.children).concat(\n <LayoutContainer\n dropTarget\n id={VuuShellLocation.WorkspaceContainer}\n key=\"main-content\"\n style={{ width: \"100%\", height: \"100%\" }}\n />\n )}\n </DockLayout>\n </Flexbox>\n );\n }, [LeftSidePanelProps, appHeader, handleDrawerClick, htmlAttributes, open]);\n};\n"],"names":["useRef","useState","useCallback","useMemo","jsx","Drawer","View","jsxs","Flexbox","DockLayout","LayoutContainer","VuuShellLocation"],"mappings":";;;;;;;AAoBO,MAAM,oBAA6C,CAAC;AAAA,EACzD,kBAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA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A,OAAA,CAAA;AAAA,KACT,CAAA;AAEA,IACE,uBAAAC,eAAA;AAAA,MAACC,iBAAA;AAAA,MAAA;AAAA,QACE,GAAG,cAAA;AAAA,QACJ,KAAO,EAAA;AAAA,UACL,GAAG,cAAgB,EAAA,KAAA;AAAA,UACnB,aAAe,EAAA,QAAA;AAAA,SACjB;AAAA,QAEC,QAAA,EAAA;AAAA,UAAA,SAAA;AAAA,0BACDJ,cAAA,CAACK,oBAAW,EAAA,EAAA,KAAA,EAAO,EAAE,IAAA,EAAM,GACxB,EAAA,QAAA,EAAA,UAAA,CAAW,kBAAoB,EAAA,QAAQ,CAAE,CAAA,MAAA;AAAA,4BACxCL,cAAA;AAAA,cAACM,yBAAA;AAAA,cAAA;AAAA,gBACC,UAAU,EAAA,IAAA;AAAA,gBACV,IAAIC,yBAAiB,CAAA,kBAAA;AAAA,gBAErB,KAAO,EAAA,EAAE,KAAO,EAAA,MAAA,EAAQ,QAAQ,MAAO,EAAA;AAAA,eAAA;AAAA,cADnC,cAAA;AAAA,aAEN;AAAA,WAEJ,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,KAED,CAAC,kBAAA,EAAoB,WAAW,iBAAmB,EAAA,cAAA,EAAgB,IAAI,CAAC,CAAA,CAAA;AAC7E;;;;"}
@@ -4,12 +4,13 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var vuuLayout = require('@vuu-ui/vuu-layout');
5
5
  var vuuUtils = require('@vuu-ui/vuu-utils');
6
6
  var ContextPanel = require('../context-panel/ContextPanel.js');
7
+ var React = require('react');
7
8
 
8
9
  const useSimpleContentPane = ({
9
10
  appHeader,
10
11
  htmlAttributes
11
- }) => {
12
- return /* @__PURE__ */ jsxRuntime.jsxs(
12
+ }) => React.useMemo(
13
+ () => /* @__PURE__ */ jsxRuntime.jsxs(
13
14
  vuuLayout.Flexbox,
14
15
  {
15
16
  ...htmlAttributes,
@@ -39,8 +40,9 @@ const useSimpleContentPane = ({
39
40
  /* @__PURE__ */ jsxRuntime.jsx(ContextPanel.ContextPanel, { id: vuuUtils.VuuShellLocation.ContextPanel, overlay: true })
40
41
  ]
41
42
  }
42
- );
43
- };
43
+ ),
44
+ [appHeader, htmlAttributes]
45
+ );
44
46
 
45
47
  exports.useSimpleContentPane = useSimpleContentPane;
46
48
  //# sourceMappingURL=useSimpleContentPane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSimpleContentPane.js","sources":["../../../src/shell-layout-templates/simple-content-pane/useSimpleContentPane.tsx"],"sourcesContent":["import { LayoutContainer, Flexbox } from \"@vuu-ui/vuu-layout\";\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport { ContextPanel } from \"../context-panel\";\nimport { ShellLayoutTemplateHook } from \"../useShellLayout\";\n\nexport const useSimpleContentPane: ShellLayoutTemplateHook = ({\n appHeader,\n htmlAttributes,\n}) => {\n return (\n <Flexbox\n {...htmlAttributes}\n style={{\n ...htmlAttributes?.style,\n flexDirection: \"row\",\n }}\n >\n <Flexbox\n className=\"vuuShell-content\"\n style={{ flex: 1, flexDirection: \"column\" }}\n >\n {appHeader}\n <LayoutContainer\n id={VuuShellLocation.WorkspaceContainer}\n key=\"main-content\"\n style={{ flex: 1 }}\n />\n </Flexbox>\n <ContextPanel id={VuuShellLocation.ContextPanel} overlay></ContextPanel>\n </Flexbox>\n );\n};\n"],"names":["jsxs","Flexbox","jsx","LayoutContainer","VuuShellLocation","ContextPanel"],"mappings":";;;;;;;AAKO,MAAM,uBAAgD,CAAC;AAAA,EAC5D,SAAA;AAAA,EACA,cAAA;AACF,CAAM,KAAA;AACJ,EACE,uBAAAA,eAAA;AAAA,IAACC,iBAAA;AAAA,IAAA;AAAA,MACE,GAAG,cAAA;AAAA,MACJ,KAAO,EAAA;AAAA,QACL,GAAG,cAAgB,EAAA,KAAA;AAAA,QACnB,aAAe,EAAA,KAAA;AAAA,OACjB;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAAD,eAAA;AAAA,UAACC,iBAAA;AAAA,UAAA;AAAA,YACC,SAAU,EAAA,kBAAA;AAAA,YACV,KAAO,EAAA,EAAE,IAAM,EAAA,CAAA,EAAG,eAAe,QAAS,EAAA;AAAA,YAEzC,QAAA,EAAA;AAAA,cAAA,SAAA;AAAA,8BACDC,cAAA;AAAA,gBAACC,yBAAA;AAAA,gBAAA;AAAA,kBACC,IAAIC,yBAAiB,CAAA,kBAAA;AAAA,kBAErB,KAAA,EAAO,EAAE,IAAA,EAAM,CAAE,EAAA;AAAA,iBAAA;AAAA,gBADb,cAAA;AAAA,eAEN;AAAA,aAAA;AAAA,WAAA;AAAA,SACF;AAAA,uCACCC,yBAAa,EAAA,EAAA,EAAA,EAAID,yBAAiB,CAAA,YAAA,EAAc,SAAO,IAAC,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GAC3D,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"useSimpleContentPane.js","sources":["../../../src/shell-layout-templates/simple-content-pane/useSimpleContentPane.tsx"],"sourcesContent":["import { LayoutContainer, Flexbox } from \"@vuu-ui/vuu-layout\";\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport { ContextPanel } from \"../context-panel\";\nimport { ShellLayoutTemplateHook } from \"../useShellLayout\";\nimport { useMemo } from \"react\";\n\nexport const useSimpleContentPane: ShellLayoutTemplateHook = ({\n appHeader,\n htmlAttributes,\n}) =>\n useMemo(\n () => (\n <Flexbox\n {...htmlAttributes}\n style={{\n ...htmlAttributes?.style,\n flexDirection: \"row\",\n }}\n >\n <Flexbox\n className=\"vuuShell-content\"\n style={{ flex: 1, flexDirection: \"column\" }}\n >\n {appHeader}\n <LayoutContainer\n id={VuuShellLocation.WorkspaceContainer}\n key=\"main-content\"\n style={{ flex: 1 }}\n />\n </Flexbox>\n <ContextPanel id={VuuShellLocation.ContextPanel} overlay></ContextPanel>\n </Flexbox>\n ),\n [appHeader, htmlAttributes]\n );\n"],"names":["useMemo","jsxs","Flexbox","jsx","LayoutContainer","VuuShellLocation","ContextPanel"],"mappings":";;;;;;;;AAMO,MAAM,uBAAgD,CAAC;AAAA,EAC5D,SAAA;AAAA,EACA,cAAA;AACF,CACE,KAAAA,aAAA;AAAA,EACE,sBACEC,eAAA;AAAA,IAACC,iBAAA;AAAA,IAAA;AAAA,MACE,GAAG,cAAA;AAAA,MACJ,KAAO,EAAA;AAAA,QACL,GAAG,cAAgB,EAAA,KAAA;AAAA,QACnB,aAAe,EAAA,KAAA;AAAA,OACjB;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAAD,eAAA;AAAA,UAACC,iBAAA;AAAA,UAAA;AAAA,YACC,SAAU,EAAA,kBAAA;AAAA,YACV,KAAO,EAAA,EAAE,IAAM,EAAA,CAAA,EAAG,eAAe,QAAS,EAAA;AAAA,YAEzC,QAAA,EAAA;AAAA,cAAA,SAAA;AAAA,8BACDC,cAAA;AAAA,gBAACC,yBAAA;AAAA,gBAAA;AAAA,kBACC,IAAIC,yBAAiB,CAAA,kBAAA;AAAA,kBAErB,KAAA,EAAO,EAAE,IAAA,EAAM,CAAE,EAAA;AAAA,iBAAA;AAAA,gBADb,cAAA;AAAA,eAEN;AAAA,aAAA;AAAA,WAAA;AAAA,SACF;AAAA,uCACCC,yBAAa,EAAA,EAAA,EAAA,EAAID,yBAAiB,CAAA,YAAA,EAAc,SAAO,IAAC,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GAC3D;AAAA,EAEF,CAAC,WAAW,cAAc,CAAA;AAC5B;;;;"}
package/cjs/shell.js CHANGED
@@ -28,7 +28,7 @@ vuuUtils.registerComponent("ApplicationSettings", UserSettingsPanel.UserSettings
28
28
  if (process.env.NODE_ENV === "production") {
29
29
  if (typeof vuuLayout.StackLayout !== "function") {
30
30
  console.warn(
31
- "StackLayout module not loaded, will be unsbale to deserialize from layout JSON"
31
+ "StackLayout module not loaded, will be unable to deserialize from layout JSON"
32
32
  );
33
33
  }
34
34
  }
@@ -61,9 +61,9 @@ const VuuApplication = ({
61
61
  css: shell,
62
62
  window: targetWindow
63
63
  });
64
+ const notify = vuuPopups.useNotifications();
64
65
  const { workspaceJSON, saveApplicationLayout } = WorkspaceProvider.useWorkspace();
65
66
  const { buildMenuOptions, handleMenuAction } = useWorkspaceContextMenuItems.useWorkspaceContextMenuItems();
66
- const [connectionStatus, setConnectionStatus] = React.useState("initialising");
67
67
  const handleLayoutChange = React.useCallback(
68
68
  (layout) => {
69
69
  try {
@@ -76,23 +76,26 @@ const VuuApplication = ({
76
76
  );
77
77
  React.useMemo(async () => {
78
78
  if (serverUrl && user.token) {
79
- const connectionStatus2 = await vuuDataRemote.connectToServer({
79
+ const connectionStatus = await vuuDataRemote.connectToServer({
80
80
  authToken: user.token,
81
81
  url: serverUrl,
82
82
  username: user.username
83
83
  });
84
- setConnectionStatus(connectionStatus2);
84
+ if (connectionStatus === "rejected") {
85
+ notify({
86
+ type: "error",
87
+ body: "Unable to connect to VUU Server",
88
+ header: "Error"
89
+ });
90
+ }
85
91
  } else {
86
92
  console.warn(
87
93
  `Shell: serverUrl: '${serverUrl}', token: '${Array(user.token.length).fill("#").join("")}'
88
94
  `
89
95
  );
90
96
  }
91
- }, [serverUrl, user.token, user.username]);
97
+ }, [notify, serverUrl, user.token, user.username]);
92
98
  const isLayoutLoading = workspaceJSON === defaultWorkspaceJSON.loadingJSON;
93
- if (connectionStatus === "rejected") {
94
- console.log("game over, no connection to server");
95
- }
96
99
  const initialLayout = useShellLayout.useShellLayout({
97
100
  ...ShellLayoutProps2,
98
101
  appHeader: getAppHeader(ShellLayoutProps2),
package/cjs/shell.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"shell.js","sources":["../src/shell.tsx"],"sourcesContent":["import { connectToServer } from \"@vuu-ui/vuu-data-remote\";\nimport type { LayoutChangeHandler } from \"@vuu-ui/vuu-layout\";\nimport { LayoutProvider, StackLayout } from \"@vuu-ui/vuu-layout\";\nimport {\n ContextMenuProvider,\n DialogProvider,\n NotificationsProvider,\n} from \"@vuu-ui/vuu-popups\";\nimport { VuuUser, logger, registerComponent } from \"@vuu-ui/vuu-utils\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport {\n HTMLAttributes,\n ReactNode,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { AppHeader } from \"./app-header\";\nimport { ApplicationProvider } from \"./application-provider\";\nimport {\n IPersistenceManager,\n LocalPersistenceManager,\n PersistenceProvider,\n usePersistenceManager,\n} from \"./persistence-manager\";\nimport { ShellLayoutProps, useShellLayout } from \"./shell-layout-templates\";\nimport { UserSettingsPanel } from \"./user-settings\";\nimport {\n WorkspaceProps,\n WorkspaceProvider,\n useWorkspace,\n useWorkspaceContextMenuItems,\n} from \"./workspace-management\";\n\nimport shellCss from \"./shell.css\";\nimport { loadingJSON } from \"./workspace-management/defaultWorkspaceJSON\";\n\nregisterComponent(\"ApplicationSettings\", UserSettingsPanel, \"view\");\n\nif (process.env.NODE_ENV === \"production\") {\n // StackLayout is loaded just to force component registration, we know it will be\n // required when default layout is instantiated. This is only required in prod\n // to avoif tree shaking the Stack away. Causes a runtime issue in dev.\n if (typeof StackLayout !== \"function\") {\n console.warn(\n \"StackLayout module not loaded, will be unsbale to deserialize from layout JSON\"\n );\n }\n}\n\nconst { error } = logger(\"Shell\");\n\nexport type LayoutTemplateName = \"full-height\" | \"inlay\";\n\nexport interface ShellProps extends HTMLAttributes<HTMLDivElement> {\n shellLayoutProps?: ShellLayoutProps;\n workspaceProps?: WorkspaceProps;\n children?: ReactNode;\n loginUrl?: string;\n saveUrl?: string;\n serverUrl?: string;\n user: VuuUser;\n}\n\nconst defaultAppHeader = <AppHeader />;\n\nconst getAppHeader = (shellLayoutProps?: ShellLayoutProps) =>\n shellLayoutProps?.appHeader ?? defaultAppHeader;\n\nconst defaultHTMLAttributes: HTMLAttributes<HTMLDivElement> = {\n className: \"vuuShell\",\n};\n\nconst getHTMLAttributes = (props?: ShellLayoutProps) => {\n if (props?.htmlAttributes) {\n return {\n ...defaultHTMLAttributes,\n ...props.htmlAttributes,\n };\n } else {\n return defaultHTMLAttributes;\n }\n};\n\nconst VuuApplication = ({\n shellLayoutProps: ShellLayoutProps,\n children,\n // loginUrl, // need to make this available to app header\n serverUrl,\n user,\n}: Omit<ShellProps, \"ContentLayoutProps\" | \"loginUrl\" | \"workspaceProps\">) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-shell\",\n css: shellCss,\n window: targetWindow,\n });\n\n const { workspaceJSON, saveApplicationLayout } = useWorkspace();\n\n const { buildMenuOptions, handleMenuAction } = useWorkspaceContextMenuItems();\n const [connectionStatus, setConnectionStatus] = useState<\n \"initialising\" | \"connected\" | \"rejected\"\n >(\"initialising\");\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 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 } else {\n console.warn(\n `Shell: serverUrl: '${serverUrl}', token: '${Array(user.token.length)\n .fill(\"#\")\n .join(\"\")}' \n `\n );\n }\n }, [serverUrl, user.token, user.username]);\n\n const isLayoutLoading = workspaceJSON === loadingJSON;\n\n if (connectionStatus === \"rejected\") {\n console.log(\"game over, no connection to server\");\n }\n\n const initialLayout = useShellLayout({\n ...ShellLayoutProps,\n appHeader: getAppHeader(ShellLayoutProps),\n htmlAttributes: getHTMLAttributes(ShellLayoutProps),\n });\n\n return isLayoutLoading ? null : (\n <ContextMenuProvider\n menuActionHandler={handleMenuAction}\n menuBuilder={buildMenuOptions}\n >\n <LayoutProvider\n workspaceJSON={workspaceJSON}\n onLayoutChange={handleLayoutChange}\n >\n {initialLayout}\n </LayoutProvider>\n {children}\n </ContextMenuProvider>\n );\n};\n\nexport const Shell = ({\n loginUrl,\n user,\n workspaceProps,\n ...props\n}: ShellProps) => {\n // If user has provided an implementation of IPersistenceManager\n // by wrapping higher level PersistenceProvider, use it, otw\n // default to LocalPersistenceManager\n const persistenceManager = usePersistenceManager();\n const localPersistenceManager = useMemo<\n IPersistenceManager | undefined\n >(() => {\n if (persistenceManager) {\n return undefined;\n }\n console.log(\n `No Persistence Manager, configuration data will be persisted to Local Storage, key: 'vuu/${user.username}'`\n );\n return new LocalPersistenceManager(`vuu/${user.username}`);\n }, [persistenceManager, user.username]);\n\n // ApplicationProvider must go outside Dialog and Notification providers\n // ApplicationProvider injects the SaltProvider and this must be the root\n // SaltProvider.\n\n const shellProviders = (\n <ApplicationProvider\n density=\"high\"\n loginUrl={loginUrl}\n theme=\"vuu-theme\"\n user={user}\n >\n <WorkspaceProvider {...workspaceProps}>\n <DialogProvider>\n <NotificationsProvider>\n <VuuApplication {...props} user={user} />\n </NotificationsProvider>\n </DialogProvider>\n </WorkspaceProvider>\n </ApplicationProvider>\n );\n\n if (persistenceManager) {\n return shellProviders;\n } else {\n return (\n <PersistenceProvider persistenceManager={localPersistenceManager}>\n {shellProviders}\n </PersistenceProvider>\n );\n }\n};\n"],"names":["registerComponent","UserSettingsPanel","StackLayout","logger","AppHeader","ShellLayoutProps","useWindow","useComponentCssInjection","shellCss","useWorkspace","useWorkspaceContextMenuItems","useState","useCallback","useMemo","connectionStatus","connectToServer","loadingJSON","useShellLayout","jsxs","ContextMenuProvider","jsx","LayoutProvider","usePersistenceManager","LocalPersistenceManager","ApplicationProvider","WorkspaceProvider","DialogProvider","NotificationsProvider","PersistenceProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsCAA,0BAAkB,CAAA,qBAAA,EAAuBC,qCAAmB,MAAM,CAAA,CAAA;AAElE,IAAI,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AAIzC,EAAI,IAAA,OAAOC,0BAAgB,UAAY,EAAA;AACrC,IAAQ,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ACC,EAAA,EAAA,QAAA,kBAAAN,cAAA,CAACO,+BACC,EAAA,EAAA,QAAA,kBAAAP,cAAA,CAAC,kBAAgB,GAAG,KAAA,EAAO,IAAY,EAAA,CAAA,EACzC,GACF,CACF,EAAA,CAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAGF,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAO,OAAA,cAAA,CAAA;AAAA,GACF,MAAA;AACL,IAAA,uBACGA,cAAA,CAAAQ,uCAAA,EAAA,EAAoB,kBAAoB,EAAA,uBAAA,EACtC,QACH,EAAA,cAAA,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
1
+ {"version":3,"file":"shell.js","sources":["../src/shell.tsx"],"sourcesContent":["import { connectToServer } from \"@vuu-ui/vuu-data-remote\";\nimport type { LayoutChangeHandler } from \"@vuu-ui/vuu-layout\";\nimport { LayoutProvider, StackLayout } from \"@vuu-ui/vuu-layout\";\nimport {\n ContextMenuProvider,\n DialogProvider,\n NotificationsProvider,\n useNotifications,\n} from \"@vuu-ui/vuu-popups\";\nimport { VuuUser, logger, registerComponent } from \"@vuu-ui/vuu-utils\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { HTMLAttributes, ReactNode, useCallback, useMemo } from \"react\";\nimport { AppHeader } from \"./app-header\";\nimport { ApplicationProvider } from \"./application-provider\";\nimport {\n IPersistenceManager,\n LocalPersistenceManager,\n PersistenceProvider,\n usePersistenceManager,\n} from \"./persistence-manager\";\nimport { ShellLayoutProps, useShellLayout } from \"./shell-layout-templates\";\nimport { UserSettingsPanel } from \"./user-settings\";\nimport {\n WorkspaceProps,\n WorkspaceProvider,\n useWorkspace,\n useWorkspaceContextMenuItems,\n} from \"./workspace-management\";\n\nimport shellCss from \"./shell.css\";\nimport { loadingJSON } from \"./workspace-management/defaultWorkspaceJSON\";\n\nregisterComponent(\"ApplicationSettings\", UserSettingsPanel, \"view\");\n\nif (process.env.NODE_ENV === \"production\") {\n // StackLayout is loaded just to force component registration, we know it will be\n // required when default layout is instantiated. This is only required in prod\n // to avoif tree shaking the Stack away. Causes a runtime issue in dev.\n if (typeof StackLayout !== \"function\") {\n console.warn(\n \"StackLayout module not loaded, will be unable to deserialize from layout JSON\"\n );\n }\n}\n\nconst { error } = logger(\"Shell\");\n\nexport type LayoutTemplateName = \"full-height\" | \"inlay\";\n\nexport interface ShellProps extends HTMLAttributes<HTMLDivElement> {\n shellLayoutProps?: ShellLayoutProps;\n workspaceProps?: WorkspaceProps;\n children?: ReactNode;\n loginUrl?: string;\n saveUrl?: string;\n serverUrl?: string;\n user: VuuUser;\n}\n\nconst defaultAppHeader = <AppHeader />;\n\nconst getAppHeader = (shellLayoutProps?: ShellLayoutProps) =>\n shellLayoutProps?.appHeader ?? defaultAppHeader;\n\nconst defaultHTMLAttributes: HTMLAttributes<HTMLDivElement> = {\n className: \"vuuShell\",\n};\n\nconst getHTMLAttributes = (props?: ShellLayoutProps) => {\n if (props?.htmlAttributes) {\n return {\n ...defaultHTMLAttributes,\n ...props.htmlAttributes,\n };\n } else {\n return defaultHTMLAttributes;\n }\n};\n\nconst VuuApplication = ({\n shellLayoutProps: ShellLayoutProps,\n children,\n // loginUrl, // need to make this available to app header\n serverUrl,\n user,\n}: Omit<ShellProps, \"ContentLayoutProps\" | \"loginUrl\" | \"workspaceProps\">) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-shell\",\n css: shellCss,\n window: targetWindow,\n });\n\n const notify = useNotifications();\n const { workspaceJSON, saveApplicationLayout } = useWorkspace();\n\n const { buildMenuOptions, handleMenuAction } = useWorkspaceContextMenuItems();\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 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 if (connectionStatus === \"rejected\") {\n notify({\n type: \"error\",\n body: \"Unable to connect to VUU Server\",\n header: \"Error\",\n });\n }\n } else {\n console.warn(\n `Shell: serverUrl: '${serverUrl}', token: '${Array(user.token.length)\n .fill(\"#\")\n .join(\"\")}' \n `\n );\n }\n }, [notify, serverUrl, user.token, user.username]);\n\n const isLayoutLoading = workspaceJSON === loadingJSON;\n\n const initialLayout = useShellLayout({\n ...ShellLayoutProps,\n appHeader: getAppHeader(ShellLayoutProps),\n htmlAttributes: getHTMLAttributes(ShellLayoutProps),\n });\n\n return isLayoutLoading ? null : (\n <ContextMenuProvider\n menuActionHandler={handleMenuAction}\n menuBuilder={buildMenuOptions}\n >\n <LayoutProvider\n workspaceJSON={workspaceJSON}\n onLayoutChange={handleLayoutChange}\n >\n {initialLayout}\n </LayoutProvider>\n {children}\n </ContextMenuProvider>\n );\n};\n\nexport const Shell = ({\n loginUrl,\n user,\n workspaceProps,\n ...props\n}: ShellProps) => {\n // If user has provided an implementation of IPersistenceManager\n // by wrapping higher level PersistenceProvider, use it, otw\n // default to LocalPersistenceManager\n const persistenceManager = usePersistenceManager();\n const localPersistenceManager = useMemo<\n IPersistenceManager | undefined\n >(() => {\n if (persistenceManager) {\n return undefined;\n }\n console.log(\n `No Persistence Manager, configuration data will be persisted to Local Storage, key: 'vuu/${user.username}'`\n );\n return new LocalPersistenceManager(`vuu/${user.username}`);\n }, [persistenceManager, user.username]);\n\n // ApplicationProvider must go outside Dialog and Notification providers\n // ApplicationProvider injects the SaltProvider and this must be the root\n // SaltProvider.\n\n const shellProviders = (\n <ApplicationProvider\n density=\"high\"\n loginUrl={loginUrl}\n theme=\"vuu-theme\"\n user={user}\n >\n <WorkspaceProvider {...workspaceProps}>\n <DialogProvider>\n <NotificationsProvider>\n <VuuApplication {...props} user={user} />\n </NotificationsProvider>\n </DialogProvider>\n </WorkspaceProvider>\n </ApplicationProvider>\n );\n\n if (persistenceManager) {\n return shellProviders;\n } else {\n return (\n <PersistenceProvider persistenceManager={localPersistenceManager}>\n {shellProviders}\n </PersistenceProvider>\n );\n }\n};\n"],"names":["registerComponent","UserSettingsPanel","StackLayout","logger","AppHeader","ShellLayoutProps","useWindow","useComponentCssInjection","shellCss","useNotifications","useWorkspace","useWorkspaceContextMenuItems","useCallback","useMemo","connectToServer","loadingJSON","useShellLayout","jsxs","ContextMenuProvider","jsx","LayoutProvider","usePersistenceManager","LocalPersistenceManager","ApplicationProvider","WorkspaceProvider","DialogProvider","NotificationsProvider","PersistenceProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiCAA,0BAAkB,CAAA,qBAAA,EAAuBC,qCAAmB,MAAM,CAAA,CAAA;AAElE,IAAI,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AAIzC,EAAI,IAAA,OAAOC,0BAAgB,UAAY,EAAA;AACrC,IAAQ,OAAA,CAAA,IAAA;AAAA,MACN,+EAAA;AAAA,KACF,CAAA;AAAA,GACF;AACF,CAAA;AAEA,MAAM,EAAE,KAAA,EAAU,GAAAC,eAAA,CAAO,OAAO,CAAA,CAAA;AAchC,MAAM,gBAAA,kCAAoBC,mBAAU,EAAA,EAAA,CAAA,CAAA;AAEpC,MAAM,YAAe,GAAA,CAAC,gBACpB,KAAA,gBAAA,EAAkB,SAAa,IAAA,gBAAA,CAAA;AAEjC,MAAM,qBAAwD,GAAA;AAAA,EAC5D,SAAW,EAAA,UAAA;AACb,CAAA,CAAA;AAEA,MAAM,iBAAA,GAAoB,CAAC,KAA6B,KAAA;AACtD,EAAA,IAAI,OAAO,cAAgB,EAAA;AACzB,IAAO,OAAA;AAAA,MACL,GAAG,qBAAA;AAAA,MACH,GAAG,KAAM,CAAA,cAAA;AAAA,KACX,CAAA;AAAA,GACK,MAAA;AACL,IAAO,OAAA,qBAAA,CAAA;AAAA,GACT;AACF,CAAA,CAAA;AAEA,MAAM,iBAAiB,CAAC;AAAA,EACtB,gBAAkBC,EAAAA,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AAA,CAAA,CAAA;AAAA,KACT;AACA,IAAQ,OAAA,CAAA,GAAA;AAAA,MACN,CAAA,yFAAA,EAA4F,KAAK,QAAQ,CAAA,CAAA,CAAA;AAAA,KAC3G,CAAA;AACA,IAAA,OAAO,IAAIS,+CAAA,CAAwB,CAAO,IAAA,EAAA,IAAA,CAAK,QAAQ,CAAE,CAAA,CAAA,CAAA;AAAA,GACxD,EAAA,CAAC,kBAAoB,EAAA,IAAA,CAAK,QAAQ,CAAC,CAAA,CAAA;AAMtC,EAAA,MAAM,cACJ,mBAAAH,cAAA;AAAA,IAACI,uCAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,MAAA;AAAA,MACR,QAAA;AAAA,MACA,KAAM,EAAA,WAAA;AAAA,MACN,IAAA;AAAA,MAEA,QAAC,kBAAAJ,cAAA,CAAAK,mCAAA,EAAA,EAAmB,GAAG,cAAA,EACrB,yCAACC,wBACC,EAAA,EAAA,QAAA,kBAAAN,cAAA,CAACO,+BACC,EAAA,EAAA,QAAA,kBAAAP,cAAA,CAAC,kBAAgB,GAAG,KAAA,EAAO,IAAY,EAAA,CAAA,EACzC,GACF,CACF,EAAA,CAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAGF,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAO,OAAA,cAAA,CAAA;AAAA,GACF,MAAA;AACL,IAAA,uBACGA,cAAA,CAAAQ,uCAAA,EAAA,EAAoB,kBAAoB,EAAA,uBAAA,EACtC,QACH,EAAA,cAAA,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -1,7 +1,7 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Drawer, View, Flexbox, DockLayout, LayoutContainer } from '@vuu-ui/vuu-layout';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { Flexbox, DockLayout, LayoutContainer, Drawer, View } from '@vuu-ui/vuu-layout';
3
3
  import { VuuShellLocation } from '@vuu-ui/vuu-utils';
4
- import { useRef, useState, useCallback } from 'react';
4
+ import { useRef, useState, useCallback, useMemo } from 'react';
5
5
 
6
6
  const useInlayLeftPanel = ({
7
7
  LeftSidePanelProps,
@@ -19,8 +19,8 @@ const useInlayLeftPanel = ({
19
19
  },
20
20
  [open]
21
21
  );
22
- const getDrawers = useCallback(
23
- (leftSidePanel) => {
22
+ return useMemo(() => {
23
+ const getDrawers = (leftSidePanel) => {
24
24
  const drawers = [];
25
25
  drawers.push(
26
26
  /* @__PURE__ */ jsx(
@@ -49,33 +49,32 @@ const useInlayLeftPanel = ({
49
49
  )
50
50
  );
51
51
  return drawers;
52
- },
53
- [handleDrawerClick, open]
54
- );
55
- return /* @__PURE__ */ jsxs(
56
- Flexbox,
57
- {
58
- ...htmlAttributes,
59
- style: {
60
- ...htmlAttributes?.style,
61
- flexDirection: "column"
62
- },
63
- children: [
64
- appHeader,
65
- /* @__PURE__ */ jsx(DockLayout, { style: { flex: 1 }, children: getDrawers(LeftSidePanelProps?.children).concat(
66
- /* @__PURE__ */ jsx(
67
- LayoutContainer,
68
- {
69
- dropTarget: true,
70
- id: VuuShellLocation.WorkspaceContainer,
71
- style: { width: "100%", height: "100%" }
72
- },
73
- "main-content"
74
- )
75
- ) })
76
- ]
77
- }
78
- );
52
+ };
53
+ return /* @__PURE__ */ jsxs(
54
+ Flexbox,
55
+ {
56
+ ...htmlAttributes,
57
+ style: {
58
+ ...htmlAttributes?.style,
59
+ flexDirection: "column"
60
+ },
61
+ children: [
62
+ appHeader,
63
+ /* @__PURE__ */ jsx(DockLayout, { style: { flex: 1 }, children: getDrawers(LeftSidePanelProps?.children).concat(
64
+ /* @__PURE__ */ jsx(
65
+ LayoutContainer,
66
+ {
67
+ dropTarget: true,
68
+ id: VuuShellLocation.WorkspaceContainer,
69
+ style: { width: "100%", height: "100%" }
70
+ },
71
+ "main-content"
72
+ )
73
+ ) })
74
+ ]
75
+ }
76
+ );
77
+ }, [LeftSidePanelProps, appHeader, handleDrawerClick, htmlAttributes, open]);
79
78
  };
80
79
 
81
80
  export { useInlayLeftPanel };
@@ -1 +1 @@
1
- {"version":3,"file":"useInlayLeftPanel.js","sources":["../../../src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.tsx"],"sourcesContent":["import {\n DockLayout,\n LayoutContainer,\n Drawer,\n Flexbox,\n View,\n} from \"@vuu-ui/vuu-layout\";\n\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport { MouseEvent, ReactElement, useCallback, useRef, useState } from \"react\";\nimport { ShellLayoutTemplateHook } from \"../useShellLayout\";\n\nexport const useInlayLeftPanel: ShellLayoutTemplateHook = ({\n LeftSidePanelProps,\n appHeader,\n htmlAttributes,\n}) => {\n const paletteView = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(true);\n\n const handleDrawerClick = useCallback(\n (e: MouseEvent<HTMLElement>) => {\n const target = e.target as HTMLElement;\n if (!paletteView.current?.contains(target)) {\n setOpen(!open);\n }\n },\n [open]\n );\n\n const getDrawers = useCallback(\n (leftSidePanel) => {\n const drawers: ReactElement[] = [];\n drawers.push(\n <Drawer\n key=\"left-panel\"\n onClick={handleDrawerClick}\n open={open}\n position=\"left\"\n inline\n peekaboo\n sizeOpen={200}\n toggleButton=\"end\"\n >\n <View\n className=\"vuuShell-palette\"\n id=\"vw-app-palette\"\n key=\"app-palette\"\n ref={paletteView}\n style={{ height: \"100%\" }}\n >\n {leftSidePanel}\n </View>\n </Drawer>\n );\n\n return drawers;\n },\n [handleDrawerClick, open]\n );\n\n return (\n <Flexbox\n {...htmlAttributes}\n style={{\n ...htmlAttributes?.style,\n flexDirection: \"column\",\n }}\n >\n {appHeader}\n <DockLayout style={{ flex: 1 }}>\n {getDrawers(LeftSidePanelProps?.children).concat(\n <LayoutContainer\n dropTarget\n id={VuuShellLocation.WorkspaceContainer}\n key=\"main-content\"\n style={{ width: \"100%\", height: \"100%\" }}\n />\n )}\n </DockLayout>\n </Flexbox>\n );\n};\n"],"names":[],"mappings":";;;;;AAYO,MAA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AAA,SAkBN;AAAA,OACF,CAAA;AAEA,MAAO,OAAA,OAAA,CAAA;AAAA,KACT;AAAA,IACA,CAAC,mBAAmB,IAAI,CAAA;AAAA,GAC1B,CAAA;AAEA,EACE,uBAAA,IAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACE,GAAG,cAAA;AAAA,MACJ,KAAO,EAAA;AAAA,QACL,GAAG,cAAgB,EAAA,KAAA;AAAA,QACnB,aAAe,EAAA,QAAA;AAAA,OACjB;AAAA,MAEC,QAAA,EAAA;AAAA,QAAA,SAAA;AAAA,wBACD,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAO,EAAE,IAAA,EAAM,GACxB,EAAA,QAAA,EAAA,UAAA,CAAW,kBAAoB,EAAA,QAAQ,CAAE,CAAA,MAAA;AAAA,0BACxC,GAAA;AAAA,YAAC,eAAA;AAAA,YAAA;AAAA,cACC,UAAU,EAAA,IAAA;AAAA,cACV,IAAI,gBAAiB,CAAA,kBAAA;AAAA,cAErB,KAAO,EAAA,EAAE,KAAO,EAAA,MAAA,EAAQ,QAAQ,MAAO,EAAA;AAAA,aAAA;AAAA,YADnC,cAAA;AAAA,WAEN;AAAA,SAEJ,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"useInlayLeftPanel.js","sources":["../../../src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.tsx"],"sourcesContent":["import {\n DockLayout,\n LayoutContainer,\n Drawer,\n Flexbox,\n View,\n} from \"@vuu-ui/vuu-layout\";\n\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport {\n MouseEvent,\n ReactElement,\n ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { ShellLayoutTemplateHook } from \"../useShellLayout\";\n\nexport const useInlayLeftPanel: ShellLayoutTemplateHook = ({\n LeftSidePanelProps,\n appHeader,\n htmlAttributes,\n}) => {\n const paletteView = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(true);\n const handleDrawerClick = useCallback(\n (e: MouseEvent<HTMLElement>) => {\n const target = e.target as HTMLElement;\n if (!paletteView.current?.contains(target)) {\n setOpen(!open);\n }\n },\n [open]\n );\n\n return useMemo(() => {\n const getDrawers = (leftSidePanel: ReactNode) => {\n const drawers: ReactElement[] = [];\n drawers.push(\n <Drawer\n key=\"left-panel\"\n onClick={handleDrawerClick}\n open={open}\n position=\"left\"\n inline\n peekaboo\n sizeOpen={200}\n toggleButton=\"end\"\n >\n <View\n className=\"vuuShell-palette\"\n id=\"vw-app-palette\"\n key=\"app-palette\"\n ref={paletteView}\n style={{ height: \"100%\" }}\n >\n {leftSidePanel}\n </View>\n </Drawer>\n );\n\n return drawers;\n };\n\n return (\n <Flexbox\n {...htmlAttributes}\n style={{\n ...htmlAttributes?.style,\n flexDirection: \"column\",\n }}\n >\n {appHeader}\n <DockLayout style={{ flex: 1 }}>\n {getDrawers(LeftSidePanelProps?.children).concat(\n <LayoutContainer\n dropTarget\n id={VuuShellLocation.WorkspaceContainer}\n key=\"main-content\"\n style={{ width: \"100%\", height: \"100%\" }}\n />\n )}\n </DockLayout>\n </Flexbox>\n );\n }, [LeftSidePanelProps, appHeader, handleDrawerClick, htmlAttributes, open]);\n};\n"],"names":[],"mappings":";;;;;AAoBO,MAAM,oBAA6C,CAAC;AAAA,EACzD,kBAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AACF,CAAM,KAAA;AACJ,EAAM,MAAA,WAAA,GAAc,OAAuB,IAAI,CAAA,CAAA;AAC/C,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,IAAI,CAAA,CAAA;AACrC,EAAA,MAAM,iBAAoB,GAAA,WAAA;AAAA,IACxB,CAAC,CAA+B,KAAA;AAC9B,MAAA,MAAM,SAAS,CAAE,CAAA,MAAA,CAAA;AACjB,MAAA,IAAI,CAAC,WAAA,CAAY,OAAS,EAAA,QAAA,CAAS,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,EAAA,UAAA,CAAW,kBAAoB,EAAA,QAAQ,CAAE,CAAA,MAAA;AAAA,4BACxC,GAAA;AAAA,cAAC,eAAA;AAAA,cAAA;AAAA,gBACC,UAAU,EAAA,IAAA;AAAA,gBACV,IAAI,gBAAiB,CAAA,kBAAA;AAAA,gBAErB,KAAO,EAAA,EAAE,KAAO,EAAA,MAAA,EAAQ,QAAQ,MAAO,EAAA;AAAA,eAAA;AAAA,cADnC,cAAA;AAAA,aAEN;AAAA,WAEJ,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,KAED,CAAC,kBAAA,EAAoB,WAAW,iBAAmB,EAAA,cAAA,EAAgB,IAAI,CAAC,CAAA,CAAA;AAC7E;;;;"}
@@ -2,12 +2,13 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { Flexbox, LayoutContainer } from '@vuu-ui/vuu-layout';
3
3
  import { VuuShellLocation } from '@vuu-ui/vuu-utils';
4
4
  import { ContextPanel } from '../context-panel/ContextPanel.js';
5
+ import { useMemo } from 'react';
5
6
 
6
7
  const useSimpleContentPane = ({
7
8
  appHeader,
8
9
  htmlAttributes
9
- }) => {
10
- return /* @__PURE__ */ jsxs(
10
+ }) => useMemo(
11
+ () => /* @__PURE__ */ jsxs(
11
12
  Flexbox,
12
13
  {
13
14
  ...htmlAttributes,
@@ -37,8 +38,9 @@ const useSimpleContentPane = ({
37
38
  /* @__PURE__ */ jsx(ContextPanel, { id: VuuShellLocation.ContextPanel, overlay: true })
38
39
  ]
39
40
  }
40
- );
41
- };
41
+ ),
42
+ [appHeader, htmlAttributes]
43
+ );
42
44
 
43
45
  export { useSimpleContentPane };
44
46
  //# sourceMappingURL=useSimpleContentPane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSimpleContentPane.js","sources":["../../../src/shell-layout-templates/simple-content-pane/useSimpleContentPane.tsx"],"sourcesContent":["import { LayoutContainer, Flexbox } from \"@vuu-ui/vuu-layout\";\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport { ContextPanel } from \"../context-panel\";\nimport { ShellLayoutTemplateHook } from \"../useShellLayout\";\n\nexport const useSimpleContentPane: ShellLayoutTemplateHook = ({\n appHeader,\n htmlAttributes,\n}) => {\n return (\n <Flexbox\n {...htmlAttributes}\n style={{\n ...htmlAttributes?.style,\n flexDirection: \"row\",\n }}\n >\n <Flexbox\n className=\"vuuShell-content\"\n style={{ flex: 1, flexDirection: \"column\" }}\n >\n {appHeader}\n <LayoutContainer\n id={VuuShellLocation.WorkspaceContainer}\n key=\"main-content\"\n style={{ flex: 1 }}\n />\n </Flexbox>\n <ContextPanel id={VuuShellLocation.ContextPanel} overlay></ContextPanel>\n </Flexbox>\n );\n};\n"],"names":[],"mappings":";;;;;AAKO,MAAM,uBAAgD,CAAC;AAAA,EAC5D,SAAA;AAAA,EACA,cAAA;AACF,CAAM,KAAA;AACJ,EACE,uBAAA,IAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACE,GAAG,cAAA;AAAA,MACJ,KAAO,EAAA;AAAA,QACL,GAAG,cAAgB,EAAA,KAAA;AAAA,QACnB,aAAe,EAAA,KAAA;AAAA,OACjB;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,IAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACC,SAAU,EAAA,kBAAA;AAAA,YACV,KAAO,EAAA,EAAE,IAAM,EAAA,CAAA,EAAG,eAAe,QAAS,EAAA;AAAA,YAEzC,QAAA,EAAA;AAAA,cAAA,SAAA;AAAA,8BACD,GAAA;AAAA,gBAAC,eAAA;AAAA,gBAAA;AAAA,kBACC,IAAI,gBAAiB,CAAA,kBAAA;AAAA,kBAErB,KAAA,EAAO,EAAE,IAAA,EAAM,CAAE,EAAA;AAAA,iBAAA;AAAA,gBADb,cAAA;AAAA,eAEN;AAAA,aAAA;AAAA,WAAA;AAAA,SACF;AAAA,4BACC,YAAa,EAAA,EAAA,EAAA,EAAI,gBAAiB,CAAA,YAAA,EAAc,SAAO,IAAC,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GAC3D,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"useSimpleContentPane.js","sources":["../../../src/shell-layout-templates/simple-content-pane/useSimpleContentPane.tsx"],"sourcesContent":["import { LayoutContainer, Flexbox } from \"@vuu-ui/vuu-layout\";\nimport { VuuShellLocation } from \"@vuu-ui/vuu-utils\";\nimport { ContextPanel } from \"../context-panel\";\nimport { ShellLayoutTemplateHook } from \"../useShellLayout\";\nimport { useMemo } from \"react\";\n\nexport const useSimpleContentPane: ShellLayoutTemplateHook = ({\n appHeader,\n htmlAttributes,\n}) =>\n useMemo(\n () => (\n <Flexbox\n {...htmlAttributes}\n style={{\n ...htmlAttributes?.style,\n flexDirection: \"row\",\n }}\n >\n <Flexbox\n className=\"vuuShell-content\"\n style={{ flex: 1, flexDirection: \"column\" }}\n >\n {appHeader}\n <LayoutContainer\n id={VuuShellLocation.WorkspaceContainer}\n key=\"main-content\"\n style={{ flex: 1 }}\n />\n </Flexbox>\n <ContextPanel id={VuuShellLocation.ContextPanel} overlay></ContextPanel>\n </Flexbox>\n ),\n [appHeader, htmlAttributes]\n );\n"],"names":[],"mappings":";;;;;;AAMO,MAAM,uBAAgD,CAAC;AAAA,EAC5D,SAAA;AAAA,EACA,cAAA;AACF,CACE,KAAA,OAAA;AAAA,EACE,sBACE,IAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACE,GAAG,cAAA;AAAA,MACJ,KAAO,EAAA;AAAA,QACL,GAAG,cAAgB,EAAA,KAAA;AAAA,QACnB,aAAe,EAAA,KAAA;AAAA,OACjB;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,IAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACC,SAAU,EAAA,kBAAA;AAAA,YACV,KAAO,EAAA,EAAE,IAAM,EAAA,CAAA,EAAG,eAAe,QAAS,EAAA;AAAA,YAEzC,QAAA,EAAA;AAAA,cAAA,SAAA;AAAA,8BACD,GAAA;AAAA,gBAAC,eAAA;AAAA,gBAAA;AAAA,kBACC,IAAI,gBAAiB,CAAA,kBAAA;AAAA,kBAErB,KAAA,EAAO,EAAE,IAAA,EAAM,CAAE,EAAA;AAAA,iBAAA;AAAA,gBADb,cAAA;AAAA,eAEN;AAAA,aAAA;AAAA,WAAA;AAAA,SACF;AAAA,4BACC,YAAa,EAAA,EAAA,EAAA,EAAI,gBAAiB,CAAA,YAAA,EAAc,SAAO,IAAC,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GAC3D;AAAA,EAEF,CAAC,WAAW,cAAc,CAAA;AAC5B;;;;"}
package/esm/shell.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { connectToServer } from '@vuu-ui/vuu-data-remote';
3
3
  import { StackLayout, LayoutProvider } from '@vuu-ui/vuu-layout';
4
- import { DialogProvider, NotificationsProvider, ContextMenuProvider } from '@vuu-ui/vuu-popups';
4
+ import { DialogProvider, NotificationsProvider, useNotifications, ContextMenuProvider } from '@vuu-ui/vuu-popups';
5
5
  import { registerComponent, logger } from '@vuu-ui/vuu-utils';
6
6
  import { useComponentCssInjection } from '@salt-ds/styles';
7
7
  import { useWindow } from '@salt-ds/window';
8
- import { useMemo, useState, useCallback } from 'react';
8
+ import { useMemo, useCallback } from 'react';
9
9
  import { AppHeader } from './app-header/AppHeader.js';
10
10
  import { ApplicationProvider } from './application-provider/ApplicationProvider.js';
11
11
  import { usePersistenceManager, PersistenceProvider } from './persistence-manager/PersistenceProvider.js';
@@ -26,7 +26,7 @@ registerComponent("ApplicationSettings", UserSettingsPanel, "view");
26
26
  if (process.env.NODE_ENV === "production") {
27
27
  if (typeof StackLayout !== "function") {
28
28
  console.warn(
29
- "StackLayout module not loaded, will be unsbale to deserialize from layout JSON"
29
+ "StackLayout module not loaded, will be unable to deserialize from layout JSON"
30
30
  );
31
31
  }
32
32
  }
@@ -59,9 +59,9 @@ const VuuApplication = ({
59
59
  css: shellCss,
60
60
  window: targetWindow
61
61
  });
62
+ const notify = useNotifications();
62
63
  const { workspaceJSON, saveApplicationLayout } = useWorkspace();
63
64
  const { buildMenuOptions, handleMenuAction } = useWorkspaceContextMenuItems();
64
- const [connectionStatus, setConnectionStatus] = useState("initialising");
65
65
  const handleLayoutChange = useCallback(
66
66
  (layout) => {
67
67
  try {
@@ -74,23 +74,26 @@ const VuuApplication = ({
74
74
  );
75
75
  useMemo(async () => {
76
76
  if (serverUrl && user.token) {
77
- const connectionStatus2 = await connectToServer({
77
+ const connectionStatus = await connectToServer({
78
78
  authToken: user.token,
79
79
  url: serverUrl,
80
80
  username: user.username
81
81
  });
82
- setConnectionStatus(connectionStatus2);
82
+ if (connectionStatus === "rejected") {
83
+ notify({
84
+ type: "error",
85
+ body: "Unable to connect to VUU Server",
86
+ header: "Error"
87
+ });
88
+ }
83
89
  } else {
84
90
  console.warn(
85
91
  `Shell: serverUrl: '${serverUrl}', token: '${Array(user.token.length).fill("#").join("")}'
86
92
  `
87
93
  );
88
94
  }
89
- }, [serverUrl, user.token, user.username]);
95
+ }, [notify, serverUrl, user.token, user.username]);
90
96
  const isLayoutLoading = workspaceJSON === loadingJSON;
91
- if (connectionStatus === "rejected") {
92
- console.log("game over, no connection to server");
93
- }
94
97
  const initialLayout = useShellLayout({
95
98
  ...ShellLayoutProps2,
96
99
  appHeader: getAppHeader(ShellLayoutProps2),
package/esm/shell.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"shell.js","sources":["../src/shell.tsx"],"sourcesContent":["import { connectToServer } from \"@vuu-ui/vuu-data-remote\";\nimport type { LayoutChangeHandler } from \"@vuu-ui/vuu-layout\";\nimport { LayoutProvider, StackLayout } from \"@vuu-ui/vuu-layout\";\nimport {\n ContextMenuProvider,\n DialogProvider,\n NotificationsProvider,\n} from \"@vuu-ui/vuu-popups\";\nimport { VuuUser, logger, registerComponent } from \"@vuu-ui/vuu-utils\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport {\n HTMLAttributes,\n ReactNode,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { AppHeader } from \"./app-header\";\nimport { ApplicationProvider } from \"./application-provider\";\nimport {\n IPersistenceManager,\n LocalPersistenceManager,\n PersistenceProvider,\n usePersistenceManager,\n} from \"./persistence-manager\";\nimport { ShellLayoutProps, useShellLayout } from \"./shell-layout-templates\";\nimport { UserSettingsPanel } from \"./user-settings\";\nimport {\n WorkspaceProps,\n WorkspaceProvider,\n useWorkspace,\n useWorkspaceContextMenuItems,\n} from \"./workspace-management\";\n\nimport shellCss from \"./shell.css\";\nimport { loadingJSON } from \"./workspace-management/defaultWorkspaceJSON\";\n\nregisterComponent(\"ApplicationSettings\", UserSettingsPanel, \"view\");\n\nif (process.env.NODE_ENV === \"production\") {\n // StackLayout is loaded just to force component registration, we know it will be\n // required when default layout is instantiated. This is only required in prod\n // to avoif tree shaking the Stack away. Causes a runtime issue in dev.\n if (typeof StackLayout !== \"function\") {\n console.warn(\n \"StackLayout module not loaded, will be unsbale to deserialize from layout JSON\"\n );\n }\n}\n\nconst { error } = logger(\"Shell\");\n\nexport type LayoutTemplateName = \"full-height\" | \"inlay\";\n\nexport interface ShellProps extends HTMLAttributes<HTMLDivElement> {\n shellLayoutProps?: ShellLayoutProps;\n workspaceProps?: WorkspaceProps;\n children?: ReactNode;\n loginUrl?: string;\n saveUrl?: string;\n serverUrl?: string;\n user: VuuUser;\n}\n\nconst defaultAppHeader = <AppHeader />;\n\nconst getAppHeader = (shellLayoutProps?: ShellLayoutProps) =>\n shellLayoutProps?.appHeader ?? defaultAppHeader;\n\nconst defaultHTMLAttributes: HTMLAttributes<HTMLDivElement> = {\n className: \"vuuShell\",\n};\n\nconst getHTMLAttributes = (props?: ShellLayoutProps) => {\n if (props?.htmlAttributes) {\n return {\n ...defaultHTMLAttributes,\n ...props.htmlAttributes,\n };\n } else {\n return defaultHTMLAttributes;\n }\n};\n\nconst VuuApplication = ({\n shellLayoutProps: ShellLayoutProps,\n children,\n // loginUrl, // need to make this available to app header\n serverUrl,\n user,\n}: Omit<ShellProps, \"ContentLayoutProps\" | \"loginUrl\" | \"workspaceProps\">) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-shell\",\n css: shellCss,\n window: targetWindow,\n });\n\n const { workspaceJSON, saveApplicationLayout } = useWorkspace();\n\n const { buildMenuOptions, handleMenuAction } = useWorkspaceContextMenuItems();\n const [connectionStatus, setConnectionStatus] = useState<\n \"initialising\" | \"connected\" | \"rejected\"\n >(\"initialising\");\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 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 } else {\n console.warn(\n `Shell: serverUrl: '${serverUrl}', token: '${Array(user.token.length)\n .fill(\"#\")\n .join(\"\")}' \n `\n );\n }\n }, [serverUrl, user.token, user.username]);\n\n const isLayoutLoading = workspaceJSON === loadingJSON;\n\n if (connectionStatus === \"rejected\") {\n console.log(\"game over, no connection to server\");\n }\n\n const initialLayout = useShellLayout({\n ...ShellLayoutProps,\n appHeader: getAppHeader(ShellLayoutProps),\n htmlAttributes: getHTMLAttributes(ShellLayoutProps),\n });\n\n return isLayoutLoading ? null : (\n <ContextMenuProvider\n menuActionHandler={handleMenuAction}\n menuBuilder={buildMenuOptions}\n >\n <LayoutProvider\n workspaceJSON={workspaceJSON}\n onLayoutChange={handleLayoutChange}\n >\n {initialLayout}\n </LayoutProvider>\n {children}\n </ContextMenuProvider>\n );\n};\n\nexport const Shell = ({\n loginUrl,\n user,\n workspaceProps,\n ...props\n}: ShellProps) => {\n // If user has provided an implementation of IPersistenceManager\n // by wrapping higher level PersistenceProvider, use it, otw\n // default to LocalPersistenceManager\n const persistenceManager = usePersistenceManager();\n const localPersistenceManager = useMemo<\n IPersistenceManager | undefined\n >(() => {\n if (persistenceManager) {\n return undefined;\n }\n console.log(\n `No Persistence Manager, configuration data will be persisted to Local Storage, key: 'vuu/${user.username}'`\n );\n return new LocalPersistenceManager(`vuu/${user.username}`);\n }, [persistenceManager, user.username]);\n\n // ApplicationProvider must go outside Dialog and Notification providers\n // ApplicationProvider injects the SaltProvider and this must be the root\n // SaltProvider.\n\n const shellProviders = (\n <ApplicationProvider\n density=\"high\"\n loginUrl={loginUrl}\n theme=\"vuu-theme\"\n user={user}\n >\n <WorkspaceProvider {...workspaceProps}>\n <DialogProvider>\n <NotificationsProvider>\n <VuuApplication {...props} user={user} />\n </NotificationsProvider>\n </DialogProvider>\n </WorkspaceProvider>\n </ApplicationProvider>\n );\n\n if (persistenceManager) {\n return shellProviders;\n } else {\n return (\n <PersistenceProvider persistenceManager={localPersistenceManager}>\n {shellProviders}\n </PersistenceProvider>\n );\n }\n};\n"],"names":["ShellLayoutProps","connectionStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsCA,iBAAkB,CAAA,qBAAA,EAAuB,mBAAmB,MAAM,CAAA,CAAA;AAElE,IAAI,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AAIzC,EAAI,IAAA,OAAO,gBAAgB,UAAY,EAAA;AACrC,IAAQ,OAAA,CAAA,IAAA;AAAA,MACN,gFAAA;AAAA,KACF,CAAA;AAAA,GACF;AACF,CAAA;AAEA,MAAM,EAAE,KAAA,EAAU,GAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAchC,MAAM,gBAAA,uBAAoB,SAAU,EAAA,EAAA,CAAA,CAAA;AAEpC,MAAM,YAAe,GAAA,CAAC,gBACpB,KAAA,gBAAA,EAAkB,SAAa,IAAA,gBAAA,CAAA;AAEjC,MAAM,qBAAwD,GAAA;AAAA,E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A,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
1
+ {"version":3,"file":"shell.js","sources":["../src/shell.tsx"],"sourcesContent":["import { connectToServer } from \"@vuu-ui/vuu-data-remote\";\nimport type { LayoutChangeHandler } from \"@vuu-ui/vuu-layout\";\nimport { LayoutProvider, StackLayout } from \"@vuu-ui/vuu-layout\";\nimport {\n ContextMenuProvider,\n DialogProvider,\n NotificationsProvider,\n useNotifications,\n} from \"@vuu-ui/vuu-popups\";\nimport { VuuUser, logger, registerComponent } from \"@vuu-ui/vuu-utils\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { HTMLAttributes, ReactNode, useCallback, useMemo } from \"react\";\nimport { AppHeader } from \"./app-header\";\nimport { ApplicationProvider } from \"./application-provider\";\nimport {\n IPersistenceManager,\n LocalPersistenceManager,\n PersistenceProvider,\n usePersistenceManager,\n} from \"./persistence-manager\";\nimport { ShellLayoutProps, useShellLayout } from \"./shell-layout-templates\";\nimport { UserSettingsPanel } from \"./user-settings\";\nimport {\n WorkspaceProps,\n WorkspaceProvider,\n useWorkspace,\n useWorkspaceContextMenuItems,\n} from \"./workspace-management\";\n\nimport shellCss from \"./shell.css\";\nimport { loadingJSON } from \"./workspace-management/defaultWorkspaceJSON\";\n\nregisterComponent(\"ApplicationSettings\", UserSettingsPanel, \"view\");\n\nif (process.env.NODE_ENV === \"production\") {\n // StackLayout is loaded just to force component registration, we know it will be\n // required when default layout is instantiated. This is only required in prod\n // to avoif tree shaking the Stack away. Causes a runtime issue in dev.\n if (typeof StackLayout !== \"function\") {\n console.warn(\n \"StackLayout module not loaded, will be unable to deserialize from layout JSON\"\n );\n }\n}\n\nconst { error } = logger(\"Shell\");\n\nexport type LayoutTemplateName = \"full-height\" | \"inlay\";\n\nexport interface ShellProps extends HTMLAttributes<HTMLDivElement> {\n shellLayoutProps?: ShellLayoutProps;\n workspaceProps?: WorkspaceProps;\n children?: ReactNode;\n loginUrl?: string;\n saveUrl?: string;\n serverUrl?: string;\n user: VuuUser;\n}\n\nconst defaultAppHeader = <AppHeader />;\n\nconst getAppHeader = (shellLayoutProps?: ShellLayoutProps) =>\n shellLayoutProps?.appHeader ?? defaultAppHeader;\n\nconst defaultHTMLAttributes: HTMLAttributes<HTMLDivElement> = {\n className: \"vuuShell\",\n};\n\nconst getHTMLAttributes = (props?: ShellLayoutProps) => {\n if (props?.htmlAttributes) {\n return {\n ...defaultHTMLAttributes,\n ...props.htmlAttributes,\n };\n } else {\n return defaultHTMLAttributes;\n }\n};\n\nconst VuuApplication = ({\n shellLayoutProps: ShellLayoutProps,\n children,\n // loginUrl, // need to make this available to app header\n serverUrl,\n user,\n}: Omit<ShellProps, \"ContentLayoutProps\" | \"loginUrl\" | \"workspaceProps\">) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-shell\",\n css: shellCss,\n window: targetWindow,\n });\n\n const notify = useNotifications();\n const { workspaceJSON, saveApplicationLayout } = useWorkspace();\n\n const { buildMenuOptions, handleMenuAction } = useWorkspaceContextMenuItems();\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 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 if (connectionStatus === \"rejected\") {\n notify({\n type: \"error\",\n body: \"Unable to connect to VUU Server\",\n header: \"Error\",\n });\n }\n } else {\n console.warn(\n `Shell: serverUrl: '${serverUrl}', token: '${Array(user.token.length)\n .fill(\"#\")\n .join(\"\")}' \n `\n );\n }\n }, [notify, serverUrl, user.token, user.username]);\n\n const isLayoutLoading = workspaceJSON === loadingJSON;\n\n const initialLayout = useShellLayout({\n ...ShellLayoutProps,\n appHeader: getAppHeader(ShellLayoutProps),\n htmlAttributes: getHTMLAttributes(ShellLayoutProps),\n });\n\n return isLayoutLoading ? null : (\n <ContextMenuProvider\n menuActionHandler={handleMenuAction}\n menuBuilder={buildMenuOptions}\n >\n <LayoutProvider\n workspaceJSON={workspaceJSON}\n onLayoutChange={handleLayoutChange}\n >\n {initialLayout}\n </LayoutProvider>\n {children}\n </ContextMenuProvider>\n );\n};\n\nexport const Shell = ({\n loginUrl,\n user,\n workspaceProps,\n ...props\n}: ShellProps) => {\n // If user has provided an implementation of IPersistenceManager\n // by wrapping higher level PersistenceProvider, use it, otw\n // default to LocalPersistenceManager\n const persistenceManager = usePersistenceManager();\n const localPersistenceManager = useMemo<\n IPersistenceManager | undefined\n >(() => {\n if (persistenceManager) {\n return undefined;\n }\n console.log(\n `No Persistence Manager, configuration data will be persisted to Local Storage, key: 'vuu/${user.username}'`\n );\n return new LocalPersistenceManager(`vuu/${user.username}`);\n }, [persistenceManager, user.username]);\n\n // ApplicationProvider must go outside Dialog and Notification providers\n // ApplicationProvider injects the SaltProvider and this must be the root\n // SaltProvider.\n\n const shellProviders = (\n <ApplicationProvider\n density=\"high\"\n loginUrl={loginUrl}\n theme=\"vuu-theme\"\n user={user}\n >\n <WorkspaceProvider {...workspaceProps}>\n <DialogProvider>\n <NotificationsProvider>\n <VuuApplication {...props} user={user} />\n </NotificationsProvider>\n </DialogProvider>\n </WorkspaceProvider>\n </ApplicationProvider>\n );\n\n if (persistenceManager) {\n return shellProviders;\n } else {\n return (\n <PersistenceProvider persistenceManager={localPersistenceManager}>\n {shellProviders}\n </PersistenceProvider>\n );\n }\n};\n"],"names":["ShellLayoutProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiCA,iBAAkB,CAAA,qBAAA,EAAuB,mBAAmB,MAAM,CAAA,CAAA;AAElE,IAAI,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AAIzC,EAAI,IAAA,OAAO,gBAAgB,UAAY,EAAA;AACrC,IAAQ,OAAA,CAAA,IAAA;AAAA,MACN,+EAAA;AAAA,KACF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,CAAC,kBAAgB,GAAG,KAAA,EAAO,IAAY,EAAA,CAAA,EACzC,GACF,CACF,EAAA,CAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAGF,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAO,OAAA,cAAA,CAAA;AAAA,GACF,MAAA;AACL,IAAA,uBACG,GAAA,CAAA,mBAAA,EAAA,EAAoB,kBAAoB,EAAA,uBAAA,EACtC,QACH,EAAA,cAAA,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
- "version": "0.8.77",
2
+ "version": "0.8.78",
3
3
  "description": "VUU UI Shell",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
6
6
  "devDependencies": {
7
- "@vuu-ui/vuu-data-types": "0.8.77",
8
- "@vuu-ui/vuu-protocol-types": "0.8.77",
9
- "@vuu-ui/vuu-table-types": "0.8.77"
7
+ "@vuu-ui/vuu-data-types": "0.8.78",
8
+ "@vuu-ui/vuu-protocol-types": "0.8.78",
9
+ "@vuu-ui/vuu-table-types": "0.8.78"
10
10
  },
11
11
  "dependencies": {
12
12
  "@salt-ds/core": "1.27.1",
13
13
  "@salt-ds/styles": "0.2.1",
14
14
  "@salt-ds/window": "0.1.1",
15
- "@vuu-ui/vuu-data-react": "0.8.77",
16
- "@vuu-ui/vuu-data-remote": "0.8.77",
17
- "@vuu-ui/vuu-icons": "0.8.77",
18
- "@vuu-ui/vuu-layout": "0.8.77",
19
- "@vuu-ui/vuu-popups": "0.8.77",
20
- "@vuu-ui/vuu-table": "0.8.77",
21
- "@vuu-ui/vuu-ui-controls": "0.8.77",
22
- "@vuu-ui/vuu-utils": "0.8.77",
15
+ "@vuu-ui/vuu-data-react": "0.8.78",
16
+ "@vuu-ui/vuu-data-remote": "0.8.78",
17
+ "@vuu-ui/vuu-icons": "0.8.78",
18
+ "@vuu-ui/vuu-layout": "0.8.78",
19
+ "@vuu-ui/vuu-popups": "0.8.78",
20
+ "@vuu-ui/vuu-table": "0.8.78",
21
+ "@vuu-ui/vuu-ui-controls": "0.8.78",
22
+ "@vuu-ui/vuu-utils": "0.8.78",
23
23
  "html-to-image": "^1.11.11"
24
24
  },
25
25
  "peerDependencies": {