@vuu-ui/vuu-shell 4.0.0-alpha.3 → 4.0.0-alpha.31

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 (43) hide show
  1. package/package.json +20 -19
  2. package/src/app-header/AppHeader.css.js +1 -1
  3. package/src/persistence-manager/PersistenceProvider.js +5 -7
  4. package/src/persistence-manager/index.js +1 -3
  5. package/src/shell.css.js +1 -1
  6. package/src/shell.js +2 -2
  7. package/src/workspace-management/LayoutList.js +1 -1
  8. package/src/workspace-management/index.js +1 -8
  9. package/src/workspace-management/useWorkspaceContextMenuItems.js +1 -2
  10. package/types/app-header/AppHeader.d.ts +1 -1
  11. package/types/feature/Feature.d.ts +1 -1
  12. package/types/feature/Loader.d.ts +1 -1
  13. package/types/feature-list/FeatureList.d.ts +1 -1
  14. package/types/left-nav/LeftNav.d.ts +1 -1
  15. package/types/login/LoginPanel.d.ts +1 -1
  16. package/types/login/VuuLogo.d.ts +1 -1
  17. package/types/persistence-manager/PersistenceProvider.d.ts +2 -3
  18. package/types/persistence-manager/index.d.ts +1 -3
  19. package/types/shell-layout-templates/context-panel/ApplicationSettingsContextPanel.d.ts +1 -1
  20. package/types/shell-layout-templates/context-panel/ContextPanel.d.ts +1 -1
  21. package/types/shell-layout-templates/side-panel/SidePanel.d.ts +1 -1
  22. package/types/shell.d.ts +2 -2
  23. package/types/theme-switch/ThemeSwitch.d.ts +1 -1
  24. package/types/workspace-management/LayoutList.d.ts +1 -1
  25. package/types/workspace-management/LayoutTile.d.ts +1 -1
  26. package/types/workspace-management/SaveLayoutPanel.d.ts +1 -1
  27. package/types/workspace-management/WorkspaceHost.d.ts +1 -1
  28. package/types/workspace-management/WorkspaceProvider.d.ts +50 -61
  29. package/types/workspace-management/WorkspaceStartPanel.d.ts +1 -1
  30. package/types/workspace-management/index.d.ts +5 -8
  31. package/types/workspace-management/shell-workspace-components.d.ts +1 -1
  32. package/src/persistence-manager/LocalWorkspacePersistenceService.js +0 -129
  33. package/src/persistence-manager/RemoteWorkspacePersistenceService.js +0 -112
  34. package/src/persistence-manager/WorkspacePersistenceService.js +0 -9
  35. package/src/workspace-management/WorkspaceController.js +0 -73
  36. package/src/workspace-management/WorkspaceHost.js +0 -194
  37. package/src/workspace-management/WorkspacePersistentState.js +0 -67
  38. package/src/workspace-management/WorkspaceProvider.js +0 -730
  39. package/src/workspace-management/WorkspaceRepository.js +0 -127
  40. package/src/workspace-management/WorkspaceStartPanel.css.js +0 -44
  41. package/src/workspace-management/WorkspaceStartPanel.js +0 -34
  42. package/src/workspace-management/workspace-component-registry.js +0 -30
  43. package/src/workspace-management/workspace-schemas.js +0 -257
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.0-alpha.3",
2
+ "version": "4.0.0-alpha.31",
3
3
  "description": "VUU UI Shell",
4
4
  "main": "./src/index.js",
5
5
  "author": "heswell",
@@ -10,26 +10,26 @@
10
10
  "type-defs": "node ../../scripts/build-type-defs.mjs"
11
11
  },
12
12
  "devDependencies": {
13
- "@vuu-ui/vuu-data-types": "4.0.0-alpha.3",
14
- "@vuu-ui/vuu-protocol-types": "4.0.0-alpha.3",
15
- "@vuu-ui/vuu-table-types": "4.0.0-alpha.3"
13
+ "@vuu-ui/vuu-data-types": "4.0.0-alpha.31",
14
+ "@vuu-ui/vuu-protocol-types": "4.0.0-alpha.31",
15
+ "@vuu-ui/vuu-table-types": "4.0.0-alpha.31"
16
16
  },
17
17
  "dependencies": {
18
- "@vuu-ui/grid-layout": "4.0.0-alpha.3",
19
- "@salt-ds/core": "1.67.0",
20
- "@salt-ds/styles": "0.2.1",
21
- "@salt-ds/window": "0.1.1",
22
- "@vuu-ui/vuu-context-menu": "4.0.0-alpha.3",
23
- "@vuu-ui/vuu-data-react": "4.0.0-alpha.3",
24
- "@vuu-ui/vuu-data-remote": "4.0.0-alpha.3",
25
- "@vuu-ui/vuu-icons": "4.0.0-alpha.3",
26
- "@vuu-ui/vuu-layout": "4.0.0-alpha.3",
27
- "@vuu-ui/vuu-notifications": "4.0.0-alpha.3",
28
- "@vuu-ui/vuu-table": "4.0.0-alpha.3",
29
- "@vuu-ui/vuu-ui-controls": "4.0.0-alpha.3",
30
- "@vuu-ui/vuu-utils": "4.0.0-alpha.3",
18
+ "@vuu-ui/grid-layout": "4.0.0-alpha.31",
19
+ "@salt-ds/core": "1.72.0",
20
+ "@salt-ds/styles": "0.4.1",
21
+ "@salt-ds/window": "0.1.2",
22
+ "@vuu-ui/vuu-context-menu": "4.0.0-alpha.31",
23
+ "@vuu-ui/vuu-data-react": "4.0.0-alpha.31",
24
+ "@vuu-ui/vuu-data-remote": "4.0.0-alpha.31",
25
+ "@vuu-ui/vuu-icons": "4.0.0-alpha.31",
26
+ "@vuu-ui/vuu-layout": "4.0.0-alpha.31",
27
+ "@vuu-ui/vuu-notifications": "4.0.0-alpha.31",
28
+ "@vuu-ui/vuu-table": "4.0.0-alpha.31",
29
+ "@vuu-ui/vuu-ui-controls": "4.0.0-alpha.31",
30
+ "@vuu-ui/vuu-utils": "4.0.0-alpha.31",
31
31
  "@module-federation/enhanced": "2.8.0",
32
- "@vuu-ui/core": "4.0.0-alpha.3",
32
+ "@vuu-ui/core": "4.0.0-alpha.31",
33
33
  "html-to-image": "^1.11.11"
34
34
  },
35
35
  "peerDependencies": {
@@ -45,8 +45,9 @@
45
45
  ],
46
46
  "exports": {
47
47
  ".": {
48
+ "types": "./types/index.d.ts",
48
49
  "import": "./src/index.js",
49
- "types": "./types/index.d.ts"
50
+ "default": "./src/index.js"
50
51
  }
51
52
  },
52
53
  "module": "./src/index.js",
@@ -6,7 +6,7 @@ const css = `
6
6
  --vuuToolbarItem-height: 26px;
7
7
  --vuuOverflowContainer-gap: 8px;
8
8
  --vuuOverflowContainer-height: var(--vuuAppHeader-height, 42px);
9
- --vuu-icon-color: var(--vuu-color-gray-45);
9
+ --vuu-icon-color: var(--salt-color-gray-500);
10
10
  --vuu-icon-size: 16px;
11
11
  --vuuToolbar-borderWidth: 1px;
12
12
  --vuuToolbar-borderStyle: solid;
@@ -1,4 +1,5 @@
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
5
  const PersistenceProvider = ({ children, persistenceManager, workspacePersistenceService })=>/*#__PURE__*/ jsx(PersistenceContext.Provider, {
@@ -6,16 +7,13 @@ const PersistenceProvider = ({ children, persistenceManager, workspacePersistenc
6
7
  persistenceManager,
7
8
  workspacePersistenceService
8
9
  },
9
- children: children
10
+ children: /*#__PURE__*/ jsx(WorkspacePersistenceProvider, {
11
+ service: workspacePersistenceService,
12
+ children: children
13
+ })
10
14
  });
11
15
  const usePersistenceManager = ()=>{
12
16
  const { persistenceManager } = useContext(PersistenceContext);
13
17
  return persistenceManager;
14
18
  };
15
- const useWorkspacePersistenceService = ()=>{
16
- const { workspacePersistenceService } = useContext(PersistenceContext);
17
- if (!workspacePersistenceService) throw new Error("useWorkspacePersistenceService requires a configured PersistenceProvider");
18
- return workspacePersistenceService;
19
- };
20
- const useOptionalWorkspacePersistenceService = ()=>useContext(PersistenceContext).workspacePersistenceService;
21
19
  export { PersistenceContext, PersistenceProvider, useOptionalWorkspacePersistenceService, usePersistenceManager, useWorkspacePersistenceService };
@@ -3,6 +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 * from "./WorkspacePersistenceService.js";
7
- export * from "./LocalWorkspacePersistenceService.js";
8
- export * from "./RemoteWorkspacePersistenceService.js";
6
+ export { LocalWorkspacePersistenceService, RemoteWorkspacePersistenceService, WorkspacePersistenceError } from "@vuu-ui/core";
package/src/shell.css.js CHANGED
@@ -20,7 +20,7 @@ const css = `
20
20
  }
21
21
 
22
22
  .vuuShell-warningPlaceholder {
23
- background-color: var(--salt-container-background-high);
23
+ background-color: var(--salt-container-tertiary-background);
24
24
  height: 100%;
25
25
  }
26
26
 
package/src/shell.js CHANGED
@@ -2,11 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { GridLayout, GridLayoutItem, GridLayoutProvider } from "@vuu-ui/grid-layout";
3
3
  import { useComponentCssInjection } from "@salt-ds/styles";
4
4
  import { useWindow } from "@salt-ds/window";
5
- import { useAuthenticatedUser } from "@vuu-ui/core";
5
+ import { ModalProvider, useAuthenticatedUser } from "@vuu-ui/core";
6
6
  import { ContextMenuProvider } from "@vuu-ui/vuu-context-menu";
7
7
  import { useLostConnection } from "@vuu-ui/vuu-data-react";
8
8
  import { NotificationsProvider } from "@vuu-ui/vuu-notifications";
9
- import { ContextPanelProvider, ModalProvider } from "@vuu-ui/vuu-ui-controls";
9
+ import { ContextPanelProvider } from "@vuu-ui/vuu-ui-controls";
10
10
  import { VuuShellLocation } from "@vuu-ui/vuu-utils";
11
11
  import clsx from "clsx";
12
12
  import { createContext, isValidElement, useCallback, useContext, useMemo, useRef, useState } from "react";
@@ -4,7 +4,7 @@ import { useComponentCssInjection } from "@salt-ds/styles";
4
4
  import { useWindow } from "@salt-ds/window";
5
5
  import { IconButton } from "@vuu-ui/vuu-ui-controls";
6
6
  import clsx from "clsx";
7
- import { useWorkspace } from "./WorkspaceProvider.js";
7
+ import { useWorkspace } from "@vuu-ui/core";
8
8
  import LayoutList from "./LayoutList.css";
9
9
  const classBase = "vuuLayoutList";
10
10
  const NO_SELECTION = [];
@@ -1,13 +1,6 @@
1
1
  export * from "./SaveLayoutPanel.js";
2
2
  export * from "./LayoutList.js";
3
- export * from "./WorkspaceProvider.js";
4
3
  export * from "./defaultWorkspaceJSON.js";
5
4
  export * from "./useWorkspaceContextMenuItems.js";
6
- export * from "./workspace-schemas.js";
7
- export * from "./WorkspaceRepository.js";
8
- export * from "./WorkspacePersistentState.js";
9
- export * from "./WorkspaceController.js";
10
- export * from "./workspace-component-registry.js";
11
- export * from "./WorkspaceHost.js";
12
- export * from "./WorkspaceStartPanel.js";
13
5
  export * from "./shell-workspace-components.js";
6
+ export { APPLICATION_SESSION_VERSION, NAMED_WORKSPACE_DEFINITION_VERSION, StaleWorkspaceScopeError, WORKSPACE_SNAPSHOT_RECORD_VERSION, WORKSPACE_SNAPSHOT_VERSION, WorkspaceController, WorkspaceHost, WorkspacePersistentStateProvider, WorkspacePersistentStateStore, WorkspaceProvider, WorkspaceRepository, WorkspaceRepositoryDisposedError, WorkspaceStartPanel, WorkspaceValidationError, cloneWorkspaceValue, createWorkspaceComponentRegistries, emptyWorkspaceSnapshot, jsonValueWorkspaceComponentCodec, useComponentPersistentState, useWorkspace, useWorkspacePersistentStateStore, validateApplicationSessionV1, validateNamedWorkspaceDefinitionV1, validateNamedWorkspaceMetadataV1, validateWorkspaceSnapshotRecordV1, validateWorkspaceSnapshotV1, workspaceMetadata } from "@vuu-ui/core";
@@ -1,8 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useModal } from "@vuu-ui/vuu-ui-controls";
2
+ import { useModal, useWorkspace } from "@vuu-ui/core";
3
3
  import { useCallback, useMemo } from "react";
4
4
  import { SaveLayoutPanel } from "./SaveLayoutPanel.js";
5
- import { useWorkspace } from "./WorkspaceProvider.js";
6
5
  const useWorkspaceContextMenuItems = ()=>{
7
6
  const { activeWorkspace, closeWorkspace, saveActiveWorkspaceAs } = useWorkspace();
8
7
  const { showDialog, closeDialog } = useModal();
@@ -3,4 +3,4 @@ import { type HTMLAttributes } from "react";
3
3
  export interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {
4
4
  themeMode?: ThemeMode;
5
5
  }
6
- export declare const AppHeader: ({ className: classNameProp, themeMode: _, ...htmlAttributes }: AppHeaderProps) => import("react").JSX.Element;
6
+ export declare const AppHeader: ({ className: classNameProp, themeMode: _, ...htmlAttributes }: AppHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  /** @deprecated Use RemoteModule from @vuu-ui/core/portal. */
2
- export declare const Feature: import("react").MemoExoticComponent<(props: import("@vuu-ui/core/portal").RemoteModuleProps<object>) => import("react").JSX.Element>;
2
+ export declare const Feature: import("react").MemoExoticComponent<(props: import("@vuu-ui/core/portal").RemoteModuleProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1 +1 @@
1
- export declare const Loader: () => import("react").JSX.Element;
1
+ export declare const Loader: () => import("react/jsx-runtime").JSX.Element;
@@ -4,4 +4,4 @@ export type GroupedFeatureProps<P extends object | undefined = object> = Record<
4
4
  export interface FeatureListProps extends HTMLAttributes<HTMLDivElement> {
5
5
  readonly features: DynamicFeatureProps[] | GroupedFeatureProps | StaticFeatureDescriptor[];
6
6
  }
7
- export declare const FeatureList: ({ features, title, ...htmlAttributes }: FeatureListProps) => import("react").JSX.Element;
7
+ export declare const FeatureList: ({ features, title, ...htmlAttributes }: FeatureListProps) => import("react/jsx-runtime").JSX.Element;
@@ -12,4 +12,4 @@ export interface LeftNavProps extends HTMLAttributes<HTMLDivElement> {
12
12
  sizeContent?: number;
13
13
  sizeExpanded?: number;
14
14
  }
15
- export declare const LeftNav: (props: LeftNavProps) => import("react").JSX.Element;
15
+ export declare const LeftNav: (props: LeftNavProps) => import("react/jsx-runtime").JSX.Element;
@@ -3,4 +3,4 @@ export interface LoginPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "o
3
3
  appName?: string;
4
4
  onSubmit: (username: string, password: string) => void;
5
5
  }
6
- export declare const LoginPanel: ({ appName, className, onSubmit, ...htmlAttributes }: LoginPanelProps) => import("react").JSX.Element;
6
+ export declare const LoginPanel: ({ appName, className, onSubmit, ...htmlAttributes }: LoginPanelProps) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare const VuuLogo: () => import("react").JSX.Element;
1
+ export declare const VuuLogo: () => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
+ import { type WorkspacePersistenceService } from "@vuu-ui/core";
1
2
  import { type ReactElement, type ReactNode } from "react";
2
3
  import type { IPersistenceManager } from "./PersistenceManager";
3
- import type { WorkspacePersistenceService } from "./WorkspacePersistenceService";
4
+ export { useOptionalWorkspacePersistenceService, useWorkspacePersistenceService, } from "@vuu-ui/core";
4
5
  export interface PersistenceContextProps {
5
6
  persistenceManager?: IPersistenceManager;
6
7
  workspacePersistenceService?: WorkspacePersistenceService;
@@ -11,5 +12,3 @@ export interface PersistenceProviderProps extends PersistenceContextProps {
11
12
  }
12
13
  export declare const PersistenceProvider: ({ children, persistenceManager, workspacePersistenceService, }: PersistenceProviderProps) => ReactElement;
13
14
  export declare const usePersistenceManager: () => IPersistenceManager | undefined;
14
- export declare const useWorkspacePersistenceService: () => WorkspacePersistenceService;
15
- export declare const useOptionalWorkspacePersistenceService: () => WorkspacePersistenceService | undefined;
@@ -3,6 +3,4 @@ export * from "./PersistenceProvider";
3
3
  export * from "./LocalPersistenceManager";
4
4
  export * from "./RemotePersistenceManager";
5
5
  export * from "./StaticPersistenceManager";
6
- export * from "./WorkspacePersistenceService";
7
- export * from "./LocalWorkspacePersistenceService";
8
- export * from "./RemoteWorkspacePersistenceService";
6
+ export { LocalWorkspacePersistenceService, type PersistenceScope, type RemoteWorkspacePersistenceOptions, RemoteWorkspacePersistenceService, type UserPersistenceScope, WorkspacePersistenceError, type WorkspacePersistenceService, type WorkspaceRequestInitProvider, } from "@vuu-ui/core";
@@ -1 +1 @@
1
- export declare const ApplicationSettingsContextPanel: () => import("react").JSX.Element;
1
+ export declare const ApplicationSettingsContextPanel: () => import("react/jsx-runtime").JSX.Element;
@@ -8,4 +8,4 @@ export interface ContextPanelProps {
8
8
  readonly overlay?: boolean;
9
9
  readonly title?: ReactNode;
10
10
  }
11
- export declare const ContextPanel: ({ className, content, expanded, id, onClose, overlay, title, }: ContextPanelProps) => import("react").JSX.Element;
11
+ export declare const ContextPanel: ({ className, content, expanded, id, onClose, overlay, title, }: ContextPanelProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,4 +5,4 @@ export interface SidePanelProps extends HTMLAttributes<HTMLDivElement> {
5
5
  sizeOpen?: number;
6
6
  sizeClosed?: number;
7
7
  }
8
- export declare const SidePanel: ({ children, open, sizeClosed, sizeOpen, style: styleProp, ...htmlAttributes }: SidePanelProps) => import("react").JSX.Element;
8
+ export declare const SidePanel: ({ children, open, sizeClosed, sizeOpen, style: styleProp, ...htmlAttributes }: SidePanelProps) => import("react/jsx-runtime").JSX.Element;
package/types/shell.d.ts CHANGED
@@ -17,5 +17,5 @@ export interface StaticShellLayoutProps extends Omit<HTMLAttributes<HTMLDivEleme
17
17
  readonly leftNavWidth?: number;
18
18
  readonly workspaceHost?: ReactNode;
19
19
  }
20
- export declare const StaticShellLayout: ({ appHeader, className, leftNavWidth: initialLeftNavWidth, style, workspaceHost, ...htmlAttributes }: StaticShellLayoutProps) => import("react").JSX.Element;
21
- export declare const Shell: ({ appHeader, children, leftNavWidth, logout, saveUrl: _saveUrl, serverUrl: _serverUrl, shellLayoutProps, workspaceProps, ...htmlAttributes }: ShellProps) => import("react").JSX.Element;
20
+ export declare const StaticShellLayout: ({ appHeader, className, leftNavWidth: initialLeftNavWidth, style, workspaceHost, ...htmlAttributes }: StaticShellLayoutProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const Shell: ({ appHeader, children, leftNavWidth, logout, saveUrl: _saveUrl, serverUrl: _serverUrl, shellLayoutProps, workspaceProps, ...htmlAttributes }: ShellProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,4 +5,4 @@ export interface ThemeSwitchProps extends Omit<HTMLAttributes<HTMLDivElement>, "
5
5
  mode?: ThemeMode;
6
6
  onChange: (mode: ThemeMode) => void;
7
7
  }
8
- export declare const ThemeSwitch: ({ className: classNameProp, defaultMode: defaultModeProp, mode: modeProp, onChange, ...htmlAttributes }: ThemeSwitchProps) => import("react").JSX.Element;
8
+ export declare const ThemeSwitch: ({ className: classNameProp, defaultMode: defaultModeProp, mode: modeProp, onChange, ...htmlAttributes }: ThemeSwitchProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import type { HTMLAttributes } from "react";
2
- export declare const LayoutList: ({ className, title, ...htmlAttributes }: HTMLAttributes<HTMLDivElement>) => import("react").JSX.Element;
2
+ export declare const LayoutList: ({ className, title, ...htmlAttributes }: HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
@@ -4,4 +4,4 @@ export interface LayoutTileProps extends HTMLAttributes<HTMLDivElement> {
4
4
  metadata: LayoutMetadata | SystemLayoutMetadata;
5
5
  onLoadLayout: (layoutId?: string, layoutJSON?: LayoutJSON) => void;
6
6
  }
7
- export declare const LayoutTile: ({ metadata, onLoadLayout, ...htmlAttributes }: LayoutTileProps) => import("react").JSX.Element;
7
+ export declare const LayoutTile: ({ metadata, onLoadLayout, ...htmlAttributes }: LayoutTileProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,5 +5,5 @@ type SaveLayoutPanelProps = {
5
5
  onCancel: () => void;
6
6
  onSave: (layoutMetadata: LayoutMetadataDto) => void;
7
7
  };
8
- export declare const SaveLayoutPanel: (props: SaveLayoutPanelProps) => import("react").JSX.Element;
8
+ export declare const SaveLayoutPanel: (props: SaveLayoutPanelProps) => import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -1 +1 @@
1
- export declare const WorkspaceHost: () => import("react").JSX.Element;
1
+ export declare const WorkspaceHost: () => import("react/jsx-runtime").JSX.Element;
@@ -1,63 +1,52 @@
1
- import { type GridComponentRendererRegistry, type GridComponentSettingsRegistry, type JsonValue } from "@vuu-ui/grid-layout";
2
- import type { LayoutJSON } from "@vuu-ui/vuu-utils";
3
- import { type ReactElement, type ReactNode } from "react";
4
- import { type WorkspacePersistenceService } from "../persistence-manager";
5
- import { WorkspaceController } from "./WorkspaceController";
6
- import { type NamedWorkspaceDefinitionV1, type NamedWorkspaceMetadataV1, type WorkspaceSnapshotV1 } from "./workspace-schemas";
7
- export declare const emptyWorkspaceSnapshot: WorkspaceSnapshotV1;
8
- export type WorkspaceStatus = "empty" | "error" | "loading" | "ready";
9
- export interface WorkspaceProps {
10
- /** @deprecated Migrate this layout to defaultWorkspace. */
11
- readonly activeLayoutIndex?: number;
12
- readonly componentRenderers?: GridComponentRendererRegistry;
13
- readonly defaultWorkspace?: WorkspaceSnapshotV1;
14
- /** @deprecated Migrate this layout to defaultWorkspace. */
15
- readonly layoutJSON?: LayoutJSON | readonly LayoutJSON[];
16
- /** @deprecated Workspace snapshots contain their own placeholders. */
17
- readonly layoutPlaceholderJSON?: LayoutJSON;
18
- readonly settingsCodecs?: GridComponentSettingsRegistry;
19
- /** @deprecated Tabs are managed by WorkspaceHost. */
20
- readonly showTabs?: boolean | "left" | "right";
21
- readonly systemWorkspaces?: readonly NamedWorkspaceDefinitionV1[];
22
- /** @deprecated Tabs are managed by WorkspaceHost. */
23
- readonly TabstripProps?: Readonly<Record<string, unknown>>;
24
- /** @deprecated Migrate this layout to defaultWorkspace. */
25
- readonly workspaceJSON?: LayoutJSON | readonly LayoutJSON[];
26
- }
1
+ import { LayoutMetadata, LayoutMetadataDto, type ApplicationSetting, type ApplicationSettings, type LayoutJSON } from "@vuu-ui/vuu-utils";
2
+ import { ReactElement } from "react";
3
+ import { type WorkspaceStackProps } from "./defaultWorkspaceJSON";
4
+ export type WorkspaceProps = WorkspaceStackProps & {
5
+ layoutPlaceholderJSON?: LayoutJSON;
6
+ /**
7
+ * layoutJSON defines the default layout to render on first load and until such time as
8
+ * layout state has been persisted. After that, the persisted state will be rendered.
9
+ */
10
+ layoutJSON?: LayoutJSON | LayoutJSON[];
11
+ activeLayoutIndex?: number;
12
+ /**
13
+ * The Vuu workspace is the container into which layouts are loaded. By default, it will be
14
+ * a Tabbed Panel (Stack + Tabstrip), showing a tab per Layout.
15
+ */
16
+ workspaceJSON?: LayoutJSON | LayoutJSON[];
17
+ };
27
18
  export interface WorkspaceProviderProps extends WorkspaceProps {
28
- readonly children: ReactNode;
29
- readonly persistenceService?: WorkspacePersistenceService;
30
- readonly userId?: string;
31
- }
32
- export interface WorkspaceContextValue {
33
- readonly activeWorkspace?: WorkspaceController;
34
- readonly activeWorkspaceInstanceId: string | null;
35
- readonly closeWorkspace: (instanceId: string) => Promise<void>;
36
- readonly componentRenderers?: GridComponentRendererRegistry;
37
- readonly controllers: readonly WorkspaceController[];
38
- readonly createWorkspaceFromSnapshot: (snapshot: WorkspaceSnapshotV1, title?: string) => Promise<string>;
39
- readonly deleteNamedWorkspace: (definitionId: string) => Promise<void>;
40
- readonly error?: Error;
41
- readonly getApplicationSetting: (key: string) => JsonValue | undefined;
42
- readonly getApplicationSettings: (key?: string) => JsonValue | Readonly<Record<string, JsonValue>> | undefined;
43
- readonly namedWorkspaces: readonly NamedWorkspaceMetadataV1[];
44
- readonly openNamedWorkspace: (definitionId: string) => Promise<void>;
45
- readonly openSystemWorkspace: (definition: NamedWorkspaceDefinitionV1) => Promise<void>;
46
- readonly renameWorkspace: (instanceId: string, title: string) => Promise<void>;
47
- readonly saveActiveWorkspaceAs: (name: string, description?: string) => Promise<void>;
48
- readonly saveApplicationSettings: (settings: JsonValue, key?: string) => Promise<void>;
49
- readonly selectWorkspace: (instanceId: string) => Promise<void>;
50
- readonly setApplicationSetting: (key: string, value: JsonValue) => Promise<void>;
51
- readonly settings: Readonly<Record<string, JsonValue>>;
52
- readonly settingsCodecs?: GridComponentSettingsRegistry;
53
- /** Identifies the authenticated persistence scope. Changes synchronously on a scope transition. */
54
- readonly scopeIdentity: string;
55
- readonly status: WorkspaceStatus;
56
- readonly systemWorkspaces: readonly NamedWorkspaceDefinitionV1[];
57
- readonly resetApplication: () => Promise<void>;
58
- }
59
- export declare class StaleWorkspaceScopeError extends Error {
60
- constructor();
19
+ children: ReactElement | ReactElement[];
20
+ /**
21
+ * layoutPlaceholderJSON defines the layout to render when a new workspace layout is created.
22
+ */
23
+ layoutPlaceholderJSON?: LayoutJSON;
61
24
  }
62
- export declare const WorkspaceProvider: ({ activeLayoutIndex, children, componentRenderers, defaultWorkspace, layoutJSON, layoutPlaceholderJSON, persistenceService: serviceProp, settingsCodecs, showTabs, systemWorkspaces, TabstripProps, userId, workspaceJSON, }: WorkspaceProviderProps) => ReactElement;
63
- export declare const useWorkspace: () => WorkspaceContextValue;
25
+ /**
26
+ * LayoutManagementProvider supplies an API for loading and saving layout documents.
27
+ * Initial layout is automatically loaded on startup. Because this hook is responsible
28
+ * only for loading and saving layouts, it only triggers a render when content is loaded.
29
+ *
30
+ * Initial layout displays a loading state
31
+ * User may supply a default layout. This will not be displayed until call has been made to
32
+ * persistenceManager to retrieve stored layout state. If no stored state is returned, the
33
+ * default layout provided by user will be set as current state (and hence rendered). If no
34
+ * default layout has been provided by user, the sysem default will be used (simple PlaceHolder)
35
+ * If saved layout state has been returned, that will be set as current state (and rendered)
36
+ *
37
+ */
38
+ export declare const WorkspaceProvider: ({ TabstripProps, children, layoutJSON, activeLayoutIndex, layoutPlaceholderJSON, showTabs, workspaceJSON: customWorkspaceJSON, }: WorkspaceProviderProps) => import("react/jsx-runtime").JSX.Element;
39
+ export declare const useWorkspace: () => {
40
+ workspaceJSON: LayoutJSON<{
41
+ [key: string]: any;
42
+ }> | LayoutJSON<{
43
+ [key: string]: any;
44
+ }>[];
45
+ layoutMetadata: LayoutMetadata[];
46
+ layoutPlaceholderJSON?: LayoutJSON;
47
+ getApplicationSettings: (key?: keyof ApplicationSettings) => ApplicationSettings | ApplicationSetting | undefined;
48
+ loadLayoutById: (id: string) => void;
49
+ saveApplicationSettings: (settings: ApplicationSettings | ApplicationSetting, key?: keyof ApplicationSettings) => void;
50
+ saveLayout: (n: LayoutMetadataDto) => void;
51
+ saveApplicationLayout: (layout: LayoutJSON) => void;
52
+ };
@@ -1 +1 @@
1
- export declare const WorkspaceStartPanel: () => import("react").JSX.Element;
1
+ export declare const WorkspaceStartPanel: () => import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,10 @@
1
1
  export * from "./SaveLayoutPanel";
2
2
  export * from "./LayoutList";
3
- export * from "./WorkspaceProvider";
4
3
  export * from "./defaultWorkspaceJSON";
5
4
  export * from "./useWorkspaceContextMenuItems";
6
- export * from "./workspace-schemas";
7
- export * from "./WorkspaceRepository";
8
- export * from "./WorkspacePersistentState";
9
- export * from "./WorkspaceController";
10
- export * from "./workspace-component-registry";
11
- export * from "./WorkspaceHost";
12
- export * from "./WorkspaceStartPanel";
13
5
  export * from "./shell-workspace-components";
6
+ /**
7
+ * The workspace model now lives in @vuu-ui/core. These re-exports keep
8
+ * existing @vuu-ui/vuu-shell imports working.
9
+ */
10
+ export { APPLICATION_SESSION_VERSION, type ApplicationSessionV1, type ComponentPersistentStateV1, type ComponentStateUpdate, cloneWorkspaceValue, createWorkspaceComponentRegistries, emptyWorkspaceSnapshot, jsonValueWorkspaceComponentCodec, NAMED_WORKSPACE_DEFINITION_VERSION, type NamedWorkspaceDefinitionV1, type NamedWorkspaceMetadataV1, type OpenWorkspaceInstanceV1, StaleWorkspaceScopeError, useComponentPersistentState, useWorkspace, useWorkspacePersistentStateStore, validateApplicationSessionV1, validateNamedWorkspaceDefinitionV1, validateNamedWorkspaceMetadataV1, validateWorkspaceSnapshotRecordV1, validateWorkspaceSnapshotV1, WORKSPACE_SNAPSHOT_RECORD_VERSION, WORKSPACE_SNAPSHOT_VERSION, type WorkspaceComponentRegistration, type WorkspaceComponentRegistries, type WorkspaceContextValue, WorkspaceController, type WorkspaceControllerOptions, WorkspaceHost, type WorkspaceKind, workspaceMetadata, WorkspacePersistentStateProvider, type WorkspacePersistentStateProviderProps, WorkspacePersistentStateStore, type WorkspaceProps, WorkspaceProvider, type WorkspaceProviderProps, WorkspaceRepository, WorkspaceRepositoryDisposedError, type WorkspaceSchemaName, type WorkspaceSnapshotRecordV1, type WorkspaceSnapshotV1, WorkspaceStartPanel, type WorkspaceStatus, type WorkspaceSummary, WorkspaceValidationError, type WorkspaceValidationIssue, } from "@vuu-ui/core";
@@ -1,2 +1,2 @@
1
- import type { WorkspaceComponentRegistration } from "./workspace-component-registry";
1
+ import type { WorkspaceComponentRegistration } from "@vuu-ui/core";
2
2
  export declare const shellWorkspaceComponentRegistrations: readonly WorkspaceComponentRegistration<unknown>[];
@@ -1,129 +0,0 @@
1
- import { WorkspaceValidationError, cloneWorkspaceValue, validateApplicationSessionV1, validateNamedWorkspaceDefinitionV1, validateNamedWorkspaceMetadataV1, validateWorkspaceSnapshotRecordV1, workspaceMetadata } from "../workspace-management/workspace-schemas.js";
2
- import { WorkspacePersistenceError } from "./WorkspacePersistenceService.js";
3
- const validateScope = (scope)=>{
4
- for (const [name, value] of Object.entries(scope))if (!value) throw new WorkspacePersistenceError(`Persistence scope ${name} must not be empty`, "construct");
5
- };
6
- const requireId = (id, operation)=>{
7
- if (!id) throw new WorkspacePersistenceError("Entity id must not be empty", operation);
8
- return id;
9
- };
10
- class LocalWorkspacePersistenceService {
11
- scope;
12
- #storage;
13
- #prefix;
14
- constructor(scope, storage = localStorage){
15
- validateScope(scope);
16
- this.scope = Object.freeze({
17
- ...scope
18
- });
19
- this.#storage = storage;
20
- this.#prefix = [
21
- "vuu-workspace",
22
- scope.applicationNamespace,
23
- scope.applicationId,
24
- scope.userId
25
- ].map(encodeURIComponent).join(":");
26
- }
27
- async loadApplicationSession() {
28
- return this.#read("application-session", void 0, validateApplicationSessionV1);
29
- }
30
- async saveApplicationSession(session) {
31
- this.#write("application-session", void 0, validateApplicationSessionV1(session));
32
- }
33
- async deleteApplicationSession() {
34
- this.#remove("application-session");
35
- }
36
- async listWorkspaceSnapshots() {
37
- return this.#ids("snapshot").map((id)=>{
38
- const snapshot = this.#read("snapshot", id, validateWorkspaceSnapshotRecordV1);
39
- if (!snapshot) throw new WorkspacePersistenceError(`Snapshot index references missing workspace "${id}"`, "listWorkspaceSnapshots");
40
- return snapshot;
41
- });
42
- }
43
- async loadWorkspaceSnapshot(workspaceInstanceId) {
44
- return this.#read("snapshot", requireId(workspaceInstanceId, "loadWorkspaceSnapshot"), validateWorkspaceSnapshotRecordV1);
45
- }
46
- async saveWorkspaceSnapshot(snapshot) {
47
- const validated = validateWorkspaceSnapshotRecordV1(snapshot);
48
- this.#write("snapshot", validated.workspaceInstanceId, validated);
49
- this.#addId("snapshot", validated.workspaceInstanceId);
50
- }
51
- async deleteWorkspaceSnapshot(workspaceInstanceId) {
52
- const id = requireId(workspaceInstanceId, "deleteWorkspaceSnapshot");
53
- this.#remove("snapshot", id);
54
- this.#deleteId("snapshot", id);
55
- }
56
- async listNamedWorkspaceMetadata() {
57
- return this.#ids("definition").map((id)=>{
58
- const metadata = this.#read("definition-metadata", id, validateNamedWorkspaceMetadataV1);
59
- if (!metadata) throw new WorkspacePersistenceError(`Definition index references missing metadata "${id}"`, "listNamedWorkspaceMetadata");
60
- return metadata;
61
- });
62
- }
63
- async loadNamedWorkspaceDefinition(id) {
64
- return this.#read("definition", requireId(id, "loadNamedWorkspaceDefinition"), validateNamedWorkspaceDefinitionV1);
65
- }
66
- async saveNamedWorkspaceDefinition(definition) {
67
- const validated = validateNamedWorkspaceDefinitionV1(definition);
68
- this.#write("definition", validated.id, validated);
69
- this.#write("definition-metadata", validated.id, workspaceMetadata(validated));
70
- this.#addId("definition", validated.id);
71
- }
72
- async deleteNamedWorkspaceDefinition(id) {
73
- const validatedId = requireId(id, "deleteNamedWorkspaceDefinition");
74
- this.#remove("definition", validatedId);
75
- this.#remove("definition-metadata", validatedId);
76
- this.#deleteId("definition", validatedId);
77
- }
78
- #key(entity, id) {
79
- return `${this.#prefix}:${encodeURIComponent(entity)}${void 0 === id ? "" : `:${encodeURIComponent(id)}`}`;
80
- }
81
- #read(entity, id, validator) {
82
- const stored = this.#storage.getItem(this.#key(entity, id));
83
- if (null === stored) return;
84
- let parsed;
85
- try {
86
- parsed = JSON.parse(stored);
87
- } catch (error) {
88
- if (!(error instanceof SyntaxError)) throw error;
89
- throw new WorkspacePersistenceError(`Stored ${entity} is not valid JSON: ${error.message}`, `load:${entity}`);
90
- }
91
- try {
92
- return cloneWorkspaceValue(validator(parsed));
93
- } catch (error) {
94
- if (!(error instanceof WorkspaceValidationError)) throw error;
95
- throw new WorkspacePersistenceError(`Stored ${entity} is invalid: ${error.message}`, `load:${entity}`);
96
- }
97
- }
98
- #write(entity, id, value) {
99
- this.#storage.setItem(this.#key(entity, id), JSON.stringify(cloneWorkspaceValue(value)));
100
- }
101
- #remove(entity, id) {
102
- this.#storage.removeItem(this.#key(entity, id));
103
- }
104
- #ids(entity) {
105
- const stored = this.#storage.getItem(this.#key(`${entity}-index`));
106
- if (null === stored) return [];
107
- let parsed;
108
- try {
109
- parsed = JSON.parse(stored);
110
- } catch (error) {
111
- if (!(error instanceof SyntaxError)) throw error;
112
- throw new WorkspacePersistenceError(`Stored ${entity} index is not valid JSON: ${error.message}`, `list:${entity}`);
113
- }
114
- if (!Array.isArray(parsed) || parsed.some((id)=>"string" != typeof id || !id) || new Set(parsed).size !== parsed.length) throw new WorkspacePersistenceError(`Stored ${entity} index is invalid`, `list:${entity}`);
115
- return parsed;
116
- }
117
- #addId(entity, id) {
118
- const ids = this.#ids(entity);
119
- if (!ids.includes(id)) this.#storage.setItem(this.#key(`${entity}-index`), JSON.stringify([
120
- ...ids,
121
- id
122
- ]));
123
- }
124
- #deleteId(entity, id) {
125
- const ids = this.#ids(entity).filter((existing)=>existing !== id);
126
- this.#storage.setItem(this.#key(`${entity}-index`), JSON.stringify(ids));
127
- }
128
- }
129
- export { LocalWorkspacePersistenceService };