@vuu-ui/vuu-shell 4.1.0 → 5.0.0-alpha.2

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.
Files changed (126) hide show
  1. package/package.json +20 -18
  2. package/src/app-header/AppHeader.js +36 -26
  3. package/src/application-provider/ApplicationContext.js +2 -5
  4. package/src/application-provider/ApplicationProvider.js +8 -59
  5. package/src/feature/Feature.js +3 -34
  6. package/src/feature/index.js +1 -0
  7. package/src/feature-list/FeatureList.css.js +27 -5
  8. package/src/feature-list/FeatureList.js +117 -96
  9. package/src/index.js +3 -3
  10. package/src/left-nav/LeftNav.css.js +2 -4
  11. package/src/left-nav/LeftNav.js +139 -100
  12. package/src/module-registry/getRegisteredModules.js +12 -0
  13. package/src/persistence-manager/PersistenceProvider.js +9 -4
  14. package/src/persistence-manager/index.js +1 -0
  15. package/src/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.js +24 -0
  16. package/src/shell-layout-templates/context-panel/ContextPanel.css.js +8 -8
  17. package/src/shell-layout-templates/context-panel/ContextPanel.js +17 -35
  18. package/src/shell-layout-templates/context-panel/index.js +1 -0
  19. package/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.js +54 -40
  20. package/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.js +54 -64
  21. package/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.js +49 -28
  22. package/src/shell-layout-templates/side-panel/SidePanel.css.js +3 -1
  23. package/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.js +43 -35
  24. package/src/shell.css.js +85 -2
  25. package/src/shell.js +148 -70
  26. package/src/workspace-management/LayoutList.js +60 -100
  27. package/src/workspace-management/SaveLayoutPanel.js +3 -3
  28. package/src/workspace-management/index.js +2 -1
  29. package/src/workspace-management/shell-workspace-components.js +59 -0
  30. package/src/workspace-management/useWorkspaceContextMenuItems.js +13 -8
  31. package/types/app-header/AppHeader.d.ts +1 -1
  32. package/types/application-provider/ApplicationContext.d.ts +1 -6
  33. package/types/application-provider/ApplicationProvider.d.ts +5 -14
  34. package/types/feature/Feature.d.ts +2 -10
  35. package/types/feature/index.d.ts +2 -1
  36. package/types/feature-list/FeatureList.d.ts +3 -3
  37. package/types/index.d.ts +3 -3
  38. package/types/left-nav/LeftNav.d.ts +1 -0
  39. package/types/persistence-manager/PersistenceProvider.d.ts +6 -3
  40. package/types/persistence-manager/index.d.ts +1 -0
  41. package/types/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.d.ts +1 -1
  42. package/types/shell-layout-templates/context-panel/ContextPanel.d.ts +9 -11
  43. package/types/shell-layout-templates/context-panel/index.d.ts +1 -0
  44. package/types/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +1 -1
  45. package/types/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +1 -1
  46. package/types/shell-layout-templates/left-main-tabs/useLeftMainTabs.d.ts +1 -1
  47. package/types/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +1 -1
  48. package/types/shell-layout-templates/useShellLayout.d.ts +4 -2
  49. package/types/shell.d.ts +19 -15
  50. package/types/workspace-management/LayoutList.d.ts +1 -1
  51. package/types/workspace-management/SaveLayoutPanel.d.ts +1 -1
  52. package/types/workspace-management/defaultWorkspaceJSON.d.ts +7 -6
  53. package/types/workspace-management/index.d.ts +6 -1
  54. package/types/workspace-management/useWorkspaceContextMenuItems.d.ts +1 -1
  55. package/src/feature/FeatureErrorBoundary.js +0 -33
  56. package/src/user-settings/SettingsForm.css.js +0 -10
  57. package/src/user-settings/SettingsForm.js +0 -141
  58. package/src/user-settings/UserSettingsPanel.css.js +0 -9
  59. package/src/user-settings/UserSettingsPanel.js +0 -29
  60. package/src/user-settings/index.js +0 -2
  61. package/src/workspace-management/WorkspaceProvider.js +0 -209
  62. package/types/feature/FeatureErrorBoundary.d.ts +0 -13
  63. package/types/persistence-manager/LocalWorkspacePersistenceService.d.ts +0 -18
  64. package/types/persistence-manager/RemoteWorkspacePersistenceService.d.ts +0 -25
  65. package/types/persistence-manager/WorkspacePersistenceService.d.ts +0 -27
  66. package/types/src/ShellContextProvider.d.ts +0 -7
  67. package/types/src/app-header/AppHeader.d.ts +0 -6
  68. package/types/src/app-header/index.d.ts +0 -1
  69. package/types/src/application-provider/ApplicationContext.d.ts +0 -11
  70. package/types/src/application-provider/ApplicationProvider.d.ts +0 -17
  71. package/types/src/application-provider/index.d.ts +0 -1
  72. package/types/src/feature/Feature.d.ts +0 -10
  73. package/types/src/feature/FeatureErrorBoundary.d.ts +0 -13
  74. package/types/src/feature/Loader.d.ts +0 -1
  75. package/types/src/feature/index.d.ts +0 -1
  76. package/types/src/feature-and-layout-provider/FeatureAndLayoutProvider.d.ts +0 -19
  77. package/types/src/feature-and-layout-provider/index.d.ts +0 -1
  78. package/types/src/feature-list/FeatureList.d.ts +0 -7
  79. package/types/src/feature-list/index.d.ts +0 -1
  80. package/types/src/get-layout-history.d.ts +0 -8
  81. package/types/src/index.d.ts +0 -14
  82. package/types/src/left-nav/LeftNav.d.ts +0 -14
  83. package/types/src/left-nav/index.d.ts +0 -1
  84. package/types/src/login/LoginPanel.d.ts +0 -6
  85. package/types/src/login/VuuLogo.d.ts +0 -1
  86. package/types/src/persistence-manager/LocalPersistenceManager.d.ts +0 -20
  87. package/types/src/persistence-manager/PersistenceManager.d.ts +0 -71
  88. package/types/src/persistence-manager/PersistenceProvider.d.ts +0 -11
  89. package/types/src/persistence-manager/RemotePersistenceManager.d.ts +0 -25
  90. package/types/src/persistence-manager/StaticPersistenceManager.d.ts +0 -25
  91. package/types/src/persistence-manager/index.d.ts +0 -5
  92. package/types/src/shell-layout-templates/context-panel/ContextPanel.d.ts +0 -13
  93. package/types/src/shell-layout-templates/context-panel/index.d.ts +0 -1
  94. package/types/src/shell-layout-templates/full-height-left-panel/useFullHeightLeftPanel.d.ts +0 -2
  95. package/types/src/shell-layout-templates/index.d.ts +0 -3
  96. package/types/src/shell-layout-templates/inlay-left-panel/useInlayLeftPanel.d.ts +0 -2
  97. package/types/src/shell-layout-templates/left-main-tabs/useLeftMainTabs.d.ts +0 -2
  98. package/types/src/shell-layout-templates/side-panel/SidePanel.d.ts +0 -8
  99. package/types/src/shell-layout-templates/side-panel/index.d.ts +0 -1
  100. package/types/src/shell-layout-templates/simple-content-pane/useSimpleContentPane.d.ts +0 -2
  101. package/types/src/shell-layout-templates/useShellLayout.d.ts +0 -51
  102. package/types/src/shell.d.ts +0 -17
  103. package/types/src/theme-switch/ThemeSwitch.d.ts +0 -8
  104. package/types/src/theme-switch/index.d.ts +0 -1
  105. package/types/src/user-settings/SettingsForm.d.ts +0 -46
  106. package/types/src/user-settings/UserSettingsPanel.d.ts +0 -3
  107. package/types/src/user-settings/index.d.ts +0 -2
  108. package/types/src/workspace-management/LayoutList.d.ts +0 -2
  109. package/types/src/workspace-management/LayoutTile.d.ts +0 -7
  110. package/types/src/workspace-management/SaveLayoutPanel.d.ts +0 -9
  111. package/types/src/workspace-management/WorkspaceProvider.d.ts +0 -52
  112. package/types/src/workspace-management/defaultWorkspaceJSON.d.ts +0 -10
  113. package/types/src/workspace-management/index.d.ts +0 -5
  114. package/types/src/workspace-management/screenshot-utils.d.ts +0 -6
  115. package/types/src/workspace-management/useWorkspaceContextMenuItems.d.ts +0 -5
  116. package/types/user-settings/SettingsForm.d.ts +0 -46
  117. package/types/user-settings/UserSettingsPanel.d.ts +0 -3
  118. package/types/user-settings/index.d.ts +0 -2
  119. package/types/workspace-management/WorkspaceController.d.ts +0 -32
  120. package/types/workspace-management/WorkspaceHost.d.ts +0 -1
  121. package/types/workspace-management/WorkspacePersistentState.d.ts +0 -19
  122. package/types/workspace-management/WorkspaceProvider.d.ts +0 -52
  123. package/types/workspace-management/WorkspaceRepository.d.ts +0 -13
  124. package/types/workspace-management/WorkspaceStartPanel.d.ts +0 -1
  125. package/types/workspace-management/workspace-component-registry.d.ts +0 -12
  126. package/types/workspace-management/workspace-schemas.d.ts +0 -69
@@ -1,17 +1,16 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { VuuLogo } from "@vuu-ui/vuu-icons";
3
- import { Stack, useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
4
- import { Tab, Tabstrip } from "@vuu-ui/vuu-ui-controls";
3
+ import { GridLayout, GridLayoutItem } from "@vuu-ui/grid-layout";
4
+ import { IconButton, Tab, Tabstrip } from "@vuu-ui/vuu-ui-controls";
5
5
  import { hasFilterTableFeatureProps } from "@vuu-ui/vuu-utils";
6
6
  import { useComponentCssInjection } from "@salt-ds/styles";
7
7
  import { useWindow } from "@salt-ds/window";
8
8
  import clsx from "clsx";
9
- import { useCallback, useMemo, useState } from "react";
9
+ import { useCallback, useEffect, useMemo, useState } from "react";
10
10
  import { FeatureList } from "../feature-list/index.js";
11
- import { LayoutList } from "../workspace-management/index.js";
11
+ import { LayoutList, useWorkspace } from "../workspace-management/index.js";
12
12
  import LeftNav from "./LeftNav.css";
13
13
  import { useFeatures } from "../feature-and-layout-provider/index.js";
14
- import { Button } from "@salt-ds/core";
15
14
  const classBase = "vuuLeftNav";
16
15
  const getDisplayStatus = (activeTabIndex, expanded)=>{
17
16
  if (0 === activeTabIndex) return expanded ? "menu-full" : "menu-icons";
@@ -32,8 +31,7 @@ const byModule = (f1, f2)=>{
32
31
  throw Error("Invalid tableFeature");
33
32
  };
34
33
  const LeftNav_LeftNav = (props)=>{
35
- const dispatch = useLayoutProviderDispatch();
36
- const { "data-path": path, defaultExpanded = true, defaultActiveTabIndex = 0, onActiveChange, onTogglePrimaryMenu, sizeCollapsed = 80, sizeContent = 300, sizeExpanded = 240, style: styleProp, ...htmlAttributes } = props;
34
+ const { "data-path": path, defaultExpanded = true, defaultActiveTabIndex = 0, onActiveChange, onTogglePrimaryMenu, onWidthChange, sizeCollapsed = 80, sizeContent = 300, sizeExpanded = 240, style: styleProp, ...htmlAttributes } = props;
37
35
  const targetWindow = useWindow();
38
36
  useComponentCssInjection({
39
37
  testId: "vuu-left-nav",
@@ -41,20 +39,45 @@ const LeftNav_LeftNav = (props)=>{
41
39
  window: targetWindow
42
40
  });
43
41
  const { dynamicFeatures = [], tableFeatures = [] } = useFeatures();
42
+ const { getApplicationSetting, scopeIdentity, setApplicationSetting, status } = useWorkspace();
43
+ const storedActiveTabIndex = getApplicationSetting("leftNav.activeTabIndex");
44
+ const storedExpanded = getApplicationSetting("leftNav.expanded");
44
45
  const [navState, setNavState] = useState({
45
- activeTabIndex: defaultActiveTabIndex,
46
- expanded: defaultExpanded
46
+ activeTabIndex: "number" == typeof storedActiveTabIndex ? storedActiveTabIndex : defaultActiveTabIndex,
47
+ expanded: "boolean" == typeof storedExpanded ? storedExpanded : defaultExpanded,
48
+ scopeIdentity: "loading" === status ? "" : scopeIdentity
47
49
  });
50
+ const visibleNavState = "loading" !== status && navState.scopeIdentity === scopeIdentity ? navState : {
51
+ activeTabIndex: defaultActiveTabIndex,
52
+ expanded: defaultExpanded,
53
+ scopeIdentity: ""
54
+ };
55
+ useEffect(()=>{
56
+ "loading" === status ? setNavState({
57
+ activeTabIndex: defaultActiveTabIndex,
58
+ expanded: defaultExpanded,
59
+ scopeIdentity: ""
60
+ }) : setNavState({
61
+ activeTabIndex: "number" == typeof storedActiveTabIndex ? storedActiveTabIndex : defaultActiveTabIndex,
62
+ expanded: "boolean" == typeof storedExpanded ? storedExpanded : defaultExpanded,
63
+ scopeIdentity
64
+ });
65
+ }, [
66
+ defaultActiveTabIndex,
67
+ defaultExpanded,
68
+ scopeIdentity,
69
+ status,
70
+ storedActiveTabIndex,
71
+ storedExpanded
72
+ ]);
48
73
  const tableFeaturesByGroup = useMemo(()=>tableFeatures?.sort(byModule).reduce((acc, filterTableFeature)=>{
49
74
  if (!hasFilterTableFeatureProps(filterTableFeature)) return acc;
50
75
  {
51
76
  const { table } = filterTableFeature.ComponentProps.tableSchema;
52
77
  const key = `${table.module} Tables`;
53
78
  if (!acc[key]) acc[key] = [];
54
- return {
55
- ...acc,
56
- [key]: acc[key].concat(filterTableFeature)
57
- };
79
+ acc[key].push(filterTableFeature);
80
+ return acc;
58
81
  }
59
82
  }, {}), [
60
83
  tableFeatures
@@ -67,48 +90,50 @@ const LeftNav_LeftNav = (props)=>{
67
90
  sizeContent,
68
91
  sizeExpanded
69
92
  ]);
93
+ useEffect(()=>{
94
+ onWidthChange?.(getFullWidth(visibleNavState.activeTabIndex, visibleNavState.expanded));
95
+ }, [
96
+ getFullWidth,
97
+ onWidthChange,
98
+ visibleNavState
99
+ ]);
70
100
  const handleTabSelection = useCallback((activeTabIndex)=>{
71
- const { activeTabIndex: currentIndex, expanded } = navState;
101
+ const { activeTabIndex: currentIndex, expanded } = visibleNavState;
72
102
  const newState = {
73
103
  activeTabIndex,
74
- expanded
104
+ expanded,
105
+ scopeIdentity
75
106
  };
76
107
  setNavState(newState);
77
- if (0 === activeTabIndex || 0 === currentIndex) {
78
- const width = getFullWidth(activeTabIndex, expanded);
79
- dispatch({
80
- type: "layout-resize",
81
- path: "#vuu-side-panel",
82
- size: width
83
- });
84
- }
108
+ getFullWidth(activeTabIndex, expanded);
109
+ setApplicationSetting("leftNav.activeTabIndex", activeTabIndex);
85
110
  onActiveChange?.(activeTabIndex);
86
111
  }, [
87
- dispatch,
88
112
  getFullWidth,
89
- navState,
90
- onActiveChange
113
+ onActiveChange,
114
+ scopeIdentity,
115
+ setApplicationSetting,
116
+ visibleNavState
91
117
  ]);
92
- const displayStatus = getDisplayStatus(navState.activeTabIndex, navState.expanded);
118
+ const displayStatus = getDisplayStatus(visibleNavState.activeTabIndex, visibleNavState.expanded);
93
119
  const toggleExpanded = useCallback(()=>{
94
- const { activeTabIndex, expanded } = navState;
120
+ const { activeTabIndex, expanded } = visibleNavState;
95
121
  const primaryMenuExpanded = !expanded;
96
122
  const newState = {
97
123
  activeTabIndex,
98
- expanded: primaryMenuExpanded
124
+ expanded: primaryMenuExpanded,
125
+ scopeIdentity
99
126
  };
100
127
  setNavState(newState);
101
- dispatch({
102
- type: "layout-resize",
103
- path: "#vuu-side-panel",
104
- size: getFullWidth(activeTabIndex, primaryMenuExpanded)
105
- });
128
+ getFullWidth(activeTabIndex, primaryMenuExpanded);
129
+ setApplicationSetting("leftNav.expanded", primaryMenuExpanded);
106
130
  onTogglePrimaryMenu?.(primaryMenuExpanded);
107
131
  }, [
108
- dispatch,
109
132
  getFullWidth,
110
- navState,
111
- onTogglePrimaryMenu
133
+ onTogglePrimaryMenu,
134
+ scopeIdentity,
135
+ setApplicationSetting,
136
+ visibleNavState
112
137
  ]);
113
138
  const style = {
114
139
  ...styleProp,
@@ -116,79 +141,93 @@ const LeftNav_LeftNav = (props)=>{
116
141
  "--nav-menu-expanded-width": `${sizeExpanded}px`,
117
142
  "--nav-menu-content-width": `${sizeContent}px`
118
143
  };
119
- return /*#__PURE__*/ jsxs("div", {
144
+ return /*#__PURE__*/ jsx("div", {
120
145
  ...htmlAttributes,
121
146
  className: clsx(classBase, `${classBase}-${displayStatus}`),
122
147
  style: style,
123
- children: [
124
- /*#__PURE__*/ jsxs("div", {
125
- className: clsx(`${classBase}-menu-primary`),
126
- "data-mode": "dark",
127
- children: [
128
- /*#__PURE__*/ jsx("div", {
129
- className: "vuuLeftNav-logo",
130
- children: /*#__PURE__*/ jsx(VuuLogo, {})
131
- }),
132
- /*#__PURE__*/ jsx("div", {
133
- className: `${classBase}-main`,
134
- children: /*#__PURE__*/ jsxs(Tabstrip, {
135
- activeTabIndex: navState.activeTabIndex,
136
- animateSelectionThumb: false,
137
- className: `${classBase}-Tabstrip`,
138
- onActiveChange: handleTabSelection,
139
- orientation: "vertical",
140
- children: [
141
- /*#__PURE__*/ jsx(Tab, {
142
- "data-icon": "demo",
143
- label: "DEMO"
144
- }),
145
- /*#__PURE__*/ jsx(Tab, {
146
- "data-icon": "features",
147
- label: "VUU FEATURES"
148
- }),
149
- /*#__PURE__*/ jsx(Tab, {
150
- "data-icon": "tables",
151
- label: "VUU TABLES"
148
+ children: /*#__PURE__*/ jsxs(GridLayout, {
149
+ colsAndRows: {
150
+ cols: [
151
+ `${visibleNavState.expanded ? sizeExpanded : sizeCollapsed}px`,
152
+ `${0 === visibleNavState.activeTabIndex ? 0 : sizeContent}px`
153
+ ],
154
+ rows: [
155
+ "1fr"
156
+ ]
157
+ },
158
+ id: "vuu-left-nav-grid",
159
+ children: [
160
+ /*#__PURE__*/ jsxs(GridLayoutItem, {
161
+ className: clsx(`${classBase}-menu-primary`),
162
+ "data-mode": "dark",
163
+ id: "vuu-left-nav-primary",
164
+ style: {
165
+ gridArea: "1/1/2/2"
166
+ },
167
+ children: [
168
+ /*#__PURE__*/ jsx("div", {
169
+ className: "vuuLeftNav-logo",
170
+ children: /*#__PURE__*/ jsx(VuuLogo, {})
171
+ }),
172
+ /*#__PURE__*/ jsx("div", {
173
+ className: `${classBase}-main`,
174
+ children: /*#__PURE__*/ jsxs(Tabstrip, {
175
+ activeTabIndex: visibleNavState.activeTabIndex,
176
+ animateSelectionThumb: false,
177
+ className: `${classBase}-Tabstrip`,
178
+ onActiveChange: handleTabSelection,
179
+ orientation: "vertical",
180
+ children: [
181
+ /*#__PURE__*/ jsx(Tab, {
182
+ "data-icon": "demo",
183
+ label: "DEMO"
184
+ }),
185
+ /*#__PURE__*/ jsx(Tab, {
186
+ "data-icon": "features",
187
+ label: "VUU FEATURES"
188
+ }),
189
+ /*#__PURE__*/ jsx(Tab, {
190
+ "data-icon": "tables",
191
+ label: "VUU TABLES"
192
+ }),
193
+ /*#__PURE__*/ jsx(Tab, {
194
+ "data-icon": "layouts",
195
+ label: "MY LAYOUTS"
196
+ })
197
+ ]
198
+ })
199
+ }),
200
+ /*#__PURE__*/ jsx("div", {
201
+ className: "vuuLeftNav-buttonBar",
202
+ children: /*#__PURE__*/ jsx(IconButton, {
203
+ className: clsx("vuuLeftNav-toggleButton", {
204
+ "vuuLeftNav-toggleButton-open": displayStatus.startsWith("menu-full"),
205
+ "vuuLeftNav-toggleButton-closed": displayStatus.startsWith("menu-icons")
152
206
  }),
153
- /*#__PURE__*/ jsx(Tab, {
154
- "data-icon": "layouts",
155
- label: "MY LAYOUTS"
156
- })
157
- ]
158
- })
159
- }),
160
- /*#__PURE__*/ jsx("div", {
161
- className: "vuuLeftNav-buttonBar",
162
- children: /*#__PURE__*/ jsx(Button, {
163
- className: clsx("vuuLeftNav-toggleButton", {
164
- "vuuLeftNav-toggleButton-open": displayStatus.startsWith("menu-full"),
165
- "vuuLeftNav-toggleButton-closed": displayStatus.startsWith("menu-icons")
166
- }),
167
- "data-icon": displayStatus.startsWith("menu-full") ? "chevron-left" : "chevron-right",
168
- onClick: toggleExpanded
207
+ icon: displayStatus.startsWith("menu-full") ? "chevron-left" : "chevron-right",
208
+ onClick: toggleExpanded
209
+ })
169
210
  })
170
- })
171
- ]
172
- }),
173
- /*#__PURE__*/ jsxs(Stack, {
174
- active: navState.activeTabIndex - 1,
175
- className: `${classBase}-menu-secondary`,
176
- showTabs: false,
177
- children: [
178
- /*#__PURE__*/ jsx(FeatureList, {
211
+ ]
212
+ }),
213
+ /*#__PURE__*/ jsx(GridLayoutItem, {
214
+ className: `${classBase}-menu-secondary`,
215
+ id: "vuu-left-nav-secondary",
216
+ style: {
217
+ gridArea: "1/2/2/3"
218
+ },
219
+ children: 1 === visibleNavState.activeTabIndex ? /*#__PURE__*/ jsx(FeatureList, {
179
220
  features: dynamicFeatures,
180
221
  title: "VUU FEATURES"
181
- }),
182
- /*#__PURE__*/ jsx(FeatureList, {
222
+ }) : 2 === visibleNavState.activeTabIndex ? /*#__PURE__*/ jsx(FeatureList, {
183
223
  features: tableFeaturesByGroup,
184
224
  title: "VUU TABLES"
185
- }),
186
- /*#__PURE__*/ jsx(LayoutList, {
225
+ }) : 3 === visibleNavState.activeTabIndex ? /*#__PURE__*/ jsx(LayoutList, {
187
226
  title: "MY LAYOUTS"
188
- })
189
- ]
190
- })
191
- ]
227
+ }) : null
228
+ })
229
+ ]
230
+ }, `${visibleNavState.expanded}-${visibleNavState.activeTabIndex}`)
192
231
  });
193
232
  };
194
233
  export { LeftNav_LeftNav as LeftNav };
@@ -0,0 +1,12 @@
1
+ const getRegisteredModules = async (registryUrl, bearerToken)=>{
2
+ console.log(`getRegisteredModules ${registryUrl}`);
3
+ const response = await fetch(registryUrl, {
4
+ cache: "no-store",
5
+ headers: {
6
+ Authorization: `Bearer ${bearerToken}`
7
+ }
8
+ });
9
+ if (!response.ok) throw Error("bad return from module registry");
10
+ return await response.json();
11
+ };
12
+ export { getRegisteredModules };
@@ -1,14 +1,19 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { WorkspacePersistenceProvider, useOptionalWorkspacePersistenceService, useWorkspacePersistenceService } from "@vuu-ui/core";
2
3
  import { createContext, useContext } from "react";
3
4
  const PersistenceContext = /*#__PURE__*/ createContext({});
4
- const PersistenceProvider = ({ children, persistenceManager })=>/*#__PURE__*/ jsx(PersistenceContext.Provider, {
5
+ const PersistenceProvider = ({ children, persistenceManager, workspacePersistenceService })=>/*#__PURE__*/ jsx(PersistenceContext.Provider, {
5
6
  value: {
6
- persistenceManager
7
+ persistenceManager,
8
+ workspacePersistenceService
7
9
  },
8
- children: children
10
+ children: /*#__PURE__*/ jsx(WorkspacePersistenceProvider, {
11
+ service: workspacePersistenceService,
12
+ children: children
13
+ })
9
14
  });
10
15
  const usePersistenceManager = ()=>{
11
16
  const { persistenceManager } = useContext(PersistenceContext);
12
17
  return persistenceManager;
13
18
  };
14
- export { PersistenceContext, PersistenceProvider, usePersistenceManager };
19
+ export { PersistenceContext, PersistenceProvider, useOptionalWorkspacePersistenceService, usePersistenceManager, useWorkspacePersistenceService };
@@ -3,3 +3,4 @@ export * from "./PersistenceProvider.js";
3
3
  export * from "./LocalPersistenceManager.js";
4
4
  export * from "./RemotePersistenceManager.js";
5
5
  export * from "./StaticPersistenceManager.js";
6
+ export { LocalWorkspacePersistenceService, RemoteWorkspacePersistenceService, WorkspacePersistenceError } from "@vuu-ui/core";
@@ -0,0 +1,24 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { useWorkspace } from "../../workspace-management/index.js";
4
+ import { ContextPanel } from "./ContextPanel.js";
5
+ const ApplicationSettingsContextPanel = ()=>{
6
+ const { getApplicationSetting, setApplicationSetting } = useWorkspace();
7
+ const expanded = true === getApplicationSetting("applicationSettings.panelOpen");
8
+ const handleClose = useCallback(()=>{
9
+ setApplicationSetting("applicationSettings.panelOpen", false);
10
+ }, [
11
+ setApplicationSetting
12
+ ]);
13
+ return /*#__PURE__*/ jsx(ContextPanel, {
14
+ content: /*#__PURE__*/ jsx("div", {
15
+ children: "Application settings"
16
+ }),
17
+ expanded: expanded,
18
+ id: "vuu-context-panel",
19
+ onClose: handleClose,
20
+ overlay: true,
21
+ title: "Settings"
22
+ });
23
+ };
24
+ export { ApplicationSettingsContextPanel };
@@ -2,29 +2,30 @@ const css = `
2
2
  .vuuContextPanel {
3
3
  --header-height: var(--vuuContextPanel-header-height, 48px);
4
4
  background: var(--vuuContextPanel-background, var(--salt-container-primary-background));
5
+ width: var(--vuu-side-panel-width, 0px);
5
6
  z-index: 1;
6
7
  transition: width .3s ease-in-out;
7
8
  position: relative;
8
- width: var(--vuu-side-panel-width, 0px) !important;
9
9
  }
10
10
 
11
11
  .vuuContextPanel-expanded {
12
+ --vuu-side-panel-width: var(--vuuContextPanel-width, 300px);
12
13
  --vuu-side-panel-shadow: -4px 4px 4px #0000001a;
13
14
  --vuu-side-panel-padding: var(--vuuContextPanel-padding, 24px);
14
- --vuu-side-panel-width: var(--vuuContextPanel-width, 300px) !important;
15
15
 
16
- & .vuuView.vuuContextPanel-inner {
16
+ & .vuuContextPanel-inner {
17
17
  padding: 24px 8px 24px 18px;
18
18
  }
19
19
  }
20
20
 
21
21
  .vuuContextPanel-overlay {
22
- width: 0 !important;
22
+ width: 0;
23
23
  }
24
24
 
25
- .vuuView.vuuContextPanel-inner {
25
+ .vuuContextPanel-inner {
26
26
  background-color: inherit;
27
27
  box-shadow: var(--vuu-side-panel-shadow, none);
28
+ min-width: 0;
28
29
  height: 100%;
29
30
  width: var(--vuu-side-panel-width, 0px);
30
31
  flex-direction: column;
@@ -32,19 +33,18 @@ const css = `
32
33
  transition-duration: .3s;
33
34
  transition-timing-function: ease-in-out;
34
35
  display: flex;
36
+ position: absolute;
35
37
  top: 0;
36
38
  right: 0;
37
39
  overflow: auto;
38
- min-width: 0 !important;
39
- position: absolute !important;
40
40
  }
41
41
 
42
42
  .vuuContextPanel-header {
43
43
  flex-wrap: nowrap;
44
+ flex: 0 0 var(--header-height);
44
45
  justify-content: space-between;
45
46
  align-items: center;
46
47
  display: flex;
47
- flex: 0 0 var(--header-height) !important;
48
48
  }
49
49
 
50
50
  .vuuContextPanel-title {
@@ -1,14 +1,12 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { View, layoutFromJson, useLayoutProviderDispatch } from "@vuu-ui/vuu-layout";
3
- import { IconButton, useHideContextPanel } from "@vuu-ui/vuu-ui-controls";
4
- import { VuuShellLocation } from "@vuu-ui/vuu-utils";
5
2
  import { useComponentCssInjection } from "@salt-ds/styles";
6
3
  import { useWindow } from "@salt-ds/window";
4
+ import { IconButton, useHideContextPanel } from "@vuu-ui/vuu-ui-controls";
7
5
  import clsx from "clsx";
8
- import react, { useCallback, useLayoutEffect, useMemo, useRef } from "react";
6
+ import { useCallback, useLayoutEffect, useRef } from "react";
9
7
  import ContextPanel from "./ContextPanel.css";
10
8
  const classBase = "vuuContextPanel";
11
- const ContextPanel_ContextPanel = ({ className: classNameProp, expanded = false, content: contentProp, id, onClose, overlay = false, title })=>{
9
+ const ContextPanel_ContextPanel = ({ className, content, expanded = false, id, onClose, overlay = false, title })=>{
12
10
  const targetWindow = useWindow();
13
11
  useComponentCssInjection({
14
12
  testId: "vuu-context-panel",
@@ -17,49 +15,33 @@ const ContextPanel_ContextPanel = ({ className: classNameProp, expanded = false,
17
15
  });
18
16
  const hideContextPanel = useHideContextPanel();
19
17
  const closeButtonRef = useRef(null);
20
- const dispatchLayoutAction = useLayoutProviderDispatch();
21
18
  const handleClose = useCallback(()=>{
22
- if (hideContextPanel) hideContextPanel();
23
- else dispatchLayoutAction({
24
- path: `#${VuuShellLocation.ContextPanel}`,
25
- propName: "expanded",
26
- propValue: false,
27
- type: "set-prop"
28
- });
19
+ hideContextPanel?.();
20
+ onClose?.();
29
21
  }, [
30
- dispatchLayoutAction,
31
- hideContextPanel
22
+ hideContextPanel,
23
+ onClose
32
24
  ]);
33
- const handleKeyDown = useCallback((e)=>{
34
- if ("Escape" === e.key) handleClose();
25
+ const handleKeyDown = useCallback((event)=>{
26
+ if ("Escape" === event.key) handleClose();
35
27
  }, [
36
28
  handleClose
37
29
  ]);
38
- const className = clsx(classBase, classNameProp, {
39
- [`${classBase}-expanded`]: expanded,
40
- [`${classBase}-inline`]: true !== overlay,
41
- [`${classBase}-overlay`]: overlay
42
- });
43
- const content = useMemo(()=>contentProp && expanded ? /*#__PURE__*/ react.isValidElement(contentProp) ? contentProp : layoutFromJson(contentProp, "context-0") : null, [
44
- contentProp,
45
- expanded
46
- ]);
47
30
  useLayoutEffect(()=>{
48
31
  if (expanded) closeButtonRef.current?.focus();
49
- else onClose?.();
50
32
  }, [
51
- expanded,
52
- onClose
33
+ expanded
53
34
  ]);
54
35
  return /*#__PURE__*/ jsx("div", {
55
36
  className: clsx(classBase, className, "vuuScrollable", {
56
- [`${classBase}-expanded`]: expanded
37
+ [`${classBase}-expanded`]: expanded,
38
+ [`${classBase}-inline`]: !overlay,
39
+ [`${classBase}-overlay`]: overlay
57
40
  }),
58
41
  id: id,
59
- children: /*#__PURE__*/ jsxs(View, {
42
+ onKeyDown: handleKeyDown,
43
+ children: /*#__PURE__*/ jsxs("div", {
60
44
  className: `${classBase}-inner`,
61
- header: false,
62
- id: id,
63
45
  children: [
64
46
  /*#__PURE__*/ jsxs("div", {
65
47
  className: `${classBase}-header`,
@@ -70,11 +52,11 @@ const ContextPanel_ContextPanel = ({ className: classNameProp, expanded = false,
70
52
  }),
71
53
  /*#__PURE__*/ jsx(IconButton, {
72
54
  appearance: "transparent",
55
+ "aria-label": "Close context panel",
73
56
  className: `${classBase}-close`,
74
57
  "data-embedded": true,
75
58
  icon: "close",
76
59
  onClick: handleClose,
77
- onKeyDown: handleKeyDown,
78
60
  ref: closeButtonRef,
79
61
  sentiment: "neutral",
80
62
  size: 16
@@ -83,7 +65,7 @@ const ContextPanel_ContextPanel = ({ className: classNameProp, expanded = false,
83
65
  }),
84
66
  /*#__PURE__*/ jsx("div", {
85
67
  className: `${classBase}-content`,
86
- children: content
68
+ children: expanded ? content : null
87
69
  })
88
70
  ]
89
71
  })
@@ -1 +1,2 @@
1
1
  export * from "./ContextPanel.js";
2
+ export * from "./ApplicationSettingsContextPanel.js";
@@ -1,44 +1,58 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Flexbox, LayoutContainer } from "@vuu-ui/vuu-layout";
3
- import { VuuShellLocation } from "@vuu-ui/vuu-utils";
4
- import { ContextPanel } from "../context-panel/index.js";
2
+ import { GridLayout, GridLayoutItem } from "@vuu-ui/grid-layout";
3
+ import { ApplicationSettingsContextPanel } from "../context-panel/index.js";
5
4
  import { SidePanel } from "../side-panel/index.js";
6
- import { useMemo } from "react";
7
- const useFullHeightLeftPanel = ({ appHeader, SidePanelProps: LeftSidePanelProps, htmlAttributes })=>useMemo(()=>/*#__PURE__*/ jsxs(Flexbox, {
8
- ...htmlAttributes,
9
- style: {
10
- ...htmlAttributes?.style,
11
- flexDirection: "row"
12
- },
13
- children: [
14
- /*#__PURE__*/ jsx(SidePanel, {
15
- ...LeftSidePanelProps,
16
- id: VuuShellLocation.SidePanel
17
- }),
18
- /*#__PURE__*/ jsxs(Flexbox, {
19
- className: "vuuShell-content",
20
- style: {
21
- flex: 1,
22
- flexDirection: "column"
23
- },
24
- children: [
25
- appHeader,
26
- /*#__PURE__*/ jsx(LayoutContainer, {
27
- id: VuuShellLocation.WorkspaceContainer,
28
- style: {
29
- flex: 1
30
- }
31
- }, "main-content")
32
- ]
33
- }),
34
- /*#__PURE__*/ jsx(ContextPanel, {
35
- id: VuuShellLocation.ContextPanel,
36
- overlay: true
37
- })
5
+ const useFullHeightLeftPanel = ({ appHeader, SidePanelProps, htmlAttributes, workspaceHost })=>{
6
+ const { onChange: _onChange, ...gridAttributes } = htmlAttributes ?? {};
7
+ return /*#__PURE__*/ jsxs(GridLayout, {
8
+ ...gridAttributes,
9
+ className: `${htmlAttributes?.className ?? ""} vuuShell-staticGrid`,
10
+ colsAndRows: {
11
+ cols: [
12
+ `${SidePanelProps?.sizeOpen ?? 200}px`,
13
+ "1fr",
14
+ "0px"
15
+ ],
16
+ rows: [
17
+ "40px",
18
+ "1fr"
38
19
  ]
39
- }), [
40
- LeftSidePanelProps,
41
- appHeader,
42
- htmlAttributes
43
- ]);
20
+ },
21
+ id: "vuu-shell-grid",
22
+ children: [
23
+ /*#__PURE__*/ jsx(GridLayoutItem, {
24
+ id: "vuu-shell-left-nav",
25
+ style: {
26
+ gridArea: "1/1/3/2"
27
+ },
28
+ children: /*#__PURE__*/ jsx(SidePanel, {
29
+ ...SidePanelProps,
30
+ id: "vuu-side-panel"
31
+ })
32
+ }),
33
+ /*#__PURE__*/ jsx(GridLayoutItem, {
34
+ id: "vuu-shell-header",
35
+ style: {
36
+ gridArea: "1/2/2/3"
37
+ },
38
+ children: appHeader
39
+ }),
40
+ /*#__PURE__*/ jsx(GridLayoutItem, {
41
+ className: "vuuShell-content",
42
+ id: "vuu-shell-workspace-host",
43
+ style: {
44
+ gridArea: "2/2/3/3"
45
+ },
46
+ children: workspaceHost
47
+ }),
48
+ /*#__PURE__*/ jsx(GridLayoutItem, {
49
+ id: "vuu-shell-context",
50
+ style: {
51
+ gridArea: "1/3/3/4"
52
+ },
53
+ children: /*#__PURE__*/ jsx(ApplicationSettingsContextPanel, {})
54
+ })
55
+ ]
56
+ });
57
+ };
44
58
  export { useFullHeightLeftPanel };