@vuu-ui/vuu-shell 0.5.4 → 0.5.5

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/vuu-shell/src/feature/Feature.tsx", "../../../packages/vuu-shell/src/feature/ErrorBoundary.jsx", "../../../packages/vuu-shell/src/feature/Loader.tsx", "../../../packages/vuu-shell/src/feature/css-module-loader.ts", "../../../packages/vuu-shell/src/login/LoginPanel.tsx", "../../../packages/vuu-shell/src/login/login-utils.ts", "../../../packages/vuu-shell/src/index.ts", "../../../packages/vuu-shell/src/shell.tsx", "../../../packages/vuu-shell/src/use-layout-config.js", "../../../packages/vuu-shell/src/ShellContextProvider.tsx", "../../../packages/vuu-shell/src/user-profile/UserProfile.tsx", "../../../packages/vuu-shell/src/user-profile/UserPanel.tsx", "../../../packages/vuu-shell/src/get-layout-history.js", "../../../packages/vuu-shell/src/app-header/AppHeader.tsx"],
4
+ "sourcesContent": ["import React, { Suspense } from \"react\";\nimport { registerComponent } from \"@vuu-ui/vuu-layout\";\nimport { ErrorBoundary } from \"./ErrorBoundary\";\nimport { Loader } from \"./Loader\";\nimport { importCSS } from \"./css-module-loader\";\n\nexport interface FeatureProps<Params extends object | undefined = undefined> {\n height?: number;\n url: string;\n css?: string;\n width?: number;\n params: Params;\n}\n\n// const RawFeature = <Params extends object | undefined>({\nfunction RawFeature<Params extends object | undefined>({\n url,\n css,\n params,\n ...props\n}: FeatureProps<Params>) {\n if (css) {\n // import(/* @vite-ignore */ css, { assert: { type: \"css\" } }).then(\n // (cssModule) => {\n // document.adoptedStyleSheets = [\n // ...document.adoptedStyleSheets,\n // cssModule.default,\n // ];\n // }\n // );\n // Polyfill until vite build supports import assertions\n // Note: already fully supported in esbuild, so vite dev\n importCSS(css).then((styleSheet) => {\n document.adoptedStyleSheets = [\n ...document.adoptedStyleSheets,\n styleSheet,\n ];\n });\n }\n const LazyFeature = React.lazy(() => import(/* @vite-ignore */ url));\n return (\n <ErrorBoundary>\n <Suspense fallback={<Loader />}>\n <LazyFeature {...props} {...params} />\n </Suspense>\n </ErrorBoundary>\n );\n}\n\nexport const Feature = React.memo(RawFeature);\nFeature.displayName = \"Feature\";\nregisterComponent(\"Feature\", Feature, \"view\");\n", "import React from 'react';\n// TODO\nexport class ErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = { errorMessage: null };\n }\n\n static getDerivedStateFromError(error) {\n // Update state so the next render will show the fallback UI.\n return { errorMessage: error.message };\n }\n\n componentDidCatch(error, errorInfo) {\n // You can also log the error to an error reporting service\n console.log(error, errorInfo);\n }\n\n render() {\n if (this.state.errorMessage) {\n return (\n <>\n <h1>Something went wrong.</h1>\n <p>{this.state.errorMessage}</p>\n </>\n );\n }\n\n return this.props.children;\n }\n}\n", "// TODO\nexport const Loader = () => <div className=\"hwLoader\">loading</div>;\n", "export const importCSS = async (path: string) => {\n const container = new CSSStyleSheet();\n return fetch(path)\n .then((x) => x.text())\n .then((x) => container.replace(x));\n};\n", "import { ChangeEvent, HTMLAttributes, useState } from \"react\";\nimport { Button } from \"@salt-ds/core\";\nimport { FormField, Input } from \"@heswell/salt-lab\";\n\nimport \"./LoginPanel.css\";\n\nconst classBase = \"vuuLoginPanel\";\n\nexport interface LoginPanelProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onSubmit\"> {\n onSubmit: (username: string, password: string) => void;\n}\n\nexport const LoginPanel = ({ onSubmit }: LoginPanelProps) => {\n const [username, setUserName] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n\n const login = () => {\n onSubmit(username, password);\n };\n\n const handleUsername = (\n _event: ChangeEvent<HTMLInputElement>,\n value: string\n ) => {\n setUserName(value);\n };\n\n const handlePassword = (\n _event: ChangeEvent<HTMLInputElement>,\n value: string\n ) => {\n setPassword(value);\n };\n\n const dataIsValid = username.trim() !== \"\" && password.trim() !== \"\";\n\n return (\n <div className={classBase}>\n <FormField label=\"Username\" style={{ width: 200 }}>\n <Input value={username} id=\"text-username\" onChange={handleUsername} />\n </FormField>\n\n <FormField label=\"Password\" style={{ width: 200 }}>\n <Input\n type=\"password\"\n value={password}\n id=\"text-password\"\n onChange={handlePassword}\n />\n </FormField>\n\n <Button\n className={`${classBase}-login`}\n disabled={!dataIsValid}\n onClick={login}\n variant=\"cta\"\n >\n Login\n </Button>\n </div>\n );\n};\n", "const getCookieValue = (name: string) =>\n document.cookie\n .split(\"; \")\n .find((row) => row.startsWith(`${name}=`))\n ?.split(\"=\")[1];\n\nexport const getAuthDetailsFromCookies = () => {\n const username = getCookieValue(\"vuu-username\");\n const token = getCookieValue(\"vuu-auth-token\");\n return [username, token];\n};\n\nexport const redirectToLogin = (loginUrl = \"/login.html\") => {\n window.location.href = loginUrl;\n};\n\nexport const logout = (loginUrl?: string) => {\n document.cookie = \"vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n document.cookie = \"vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT\";\n redirectToLogin(loginUrl);\n};\n", "export * from \"./feature\";\nexport * from \"./login\";\nexport * from \"@vuu-ui/vuu-layout/src/menu\";\nexport * from \"./shell\";\nexport * from \"./shellTypes\";\nexport * from \"./ShellContextProvider\";\n", "import { connectToServer } from \"@vuu-ui/vuu-data\";\nimport {\n HTMLAttributes,\n MouseEvent,\n ReactElement,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport useLayoutConfig from \"./use-layout-config\";\nimport { ShellContextProvider } from \"./ShellContextProvider\";\nimport cx from \"classnames\";\n\nimport {\n Chest,\n DraggableLayout,\n Drawer,\n FlexboxLayout as Flexbox,\n LayoutProvider,\n View,\n} from \"@vuu-ui/vuu-layout\";\n\nimport { AppHeader } from \"./app-header\";\n// import { AppPalette } from \"./app-palette\";\n\nimport { LayoutJSON } from \"@vuu-ui/vuu-layout/src/layout-reducer\";\nimport \"./shell.css\";\n\nexport type VuuUser = {\n username: string;\n token: string;\n};\n\nconst warningLayout = {\n type: \"View\",\n props: {\n style: { height: \"calc(100% - 6px)\" },\n },\n children: [\n {\n props: {\n className: \"vuuShell-warningPlaceholder\",\n },\n type: \"Placeholder\",\n },\n ],\n};\n\nexport interface ShellProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n defaultLayout?: LayoutJSON;\n leftSidePanel?: ReactElement;\n loginUrl?: string;\n // paletteConfig: any;\n serverUrl?: string;\n user: VuuUser;\n}\n\nexport const Shell = ({\n children,\n className,\n defaultLayout = warningLayout,\n leftSidePanel,\n loginUrl,\n serverUrl,\n user,\n ...htmlAttributes\n}: ShellProps) => {\n const paletteView = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(false);\n const layoutId = useRef(\"latest\");\n\n const [layout, setLayoutConfig, loadLayoutById] = useLayoutConfig(\n user,\n defaultLayout\n );\n\n const handleLayoutChange = useCallback(\n (layout) => {\n setLayoutConfig(layout);\n },\n [setLayoutConfig]\n );\n\n const handleDrawerClick = (e: MouseEvent<HTMLElement>) => {\n const target = e.target as HTMLElement;\n if (!paletteView.current?.contains(target)) {\n setOpen(!open);\n }\n };\n\n const handleNavigate = useCallback(\n (id) => {\n layoutId.current = id;\n loadLayoutById(id);\n },\n [loadLayoutById]\n );\n\n useEffect(() => {\n if (serverUrl && user.token) {\n connectToServer(serverUrl, user.token);\n }\n }, [serverUrl, user.token]);\n\n const getDrawers = () => {\n const drawers: ReactElement[] = [];\n if (leftSidePanel) {\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\n return drawers;\n };\n\n return (\n // ShellContext TBD\n <ShellContextProvider value={undefined}>\n <LayoutProvider layout={layout} onLayoutChange={handleLayoutChange}>\n <DraggableLayout\n className={cx(\"vuuShell\", className)}\n {...htmlAttributes}\n >\n <Flexbox\n className=\"App\"\n style={{ flexDirection: \"column\", height: \"100%\", width: \"100%\" }}\n >\n <AppHeader\n layoutId={layoutId.current}\n loginUrl={loginUrl}\n user={user}\n onNavigate={handleNavigate}\n />\n <Chest style={{ flex: 1 }}>\n {getDrawers().concat(\n <DraggableLayout\n dropTarget\n key=\"main-content\"\n style={{ width: \"100%\", height: \"100%\" }}\n />\n )}\n </Chest>\n </Flexbox>\n </DraggableLayout>\n </LayoutProvider>\n {children}\n </ShellContextProvider>\n );\n};\n", "import { useCallback, useEffect, useState } from \"react\";\n\nconst useLayoutConfig = (user, defaultLayout) => {\n const [layout, _setLayout] = useState(defaultLayout);\n\n const setLayout = (layout) => {\n _setLayout(layout);\n };\n\n const load = useCallback(\n async (id = \"latest\") => {\n fetch(`api/vui/${user.username}/${id}`, {})\n .then((response) => {\n return response.ok ? response.json() : defaultLayout;\n })\n .then(setLayout)\n .catch(() => {\n // TODO we should set a layout with a warning here\n setLayout(defaultLayout);\n });\n },\n [defaultLayout, user.username]\n );\n\n useEffect(() => {\n load();\n }, [load]);\n\n const saveData = useCallback(\n (data) => {\n fetch(`api/vui/${user.username}`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(data),\n }).then((response) => {\n return response.ok ? response.json() : defaultLayout;\n });\n // .then((data) => console.log(data));\n },\n [defaultLayout, user]\n );\n\n const loadLayoutById = useCallback(\n (id) => {\n load(id);\n },\n [load]\n );\n\n return [layout, saveData, loadLayoutById];\n};\n\nexport default useLayoutConfig;\n", "import { createContext, ReactElement, ReactNode, useContext } from \"react\";\n\nexport interface ShellContextProps {\n handleRpcResponse?: (response: unknown) => void;\n}\n\nconst defaultConfig = {};\n\nconst ShellContext = createContext<ShellContextProps>(defaultConfig);\n\nexport interface ShellProviderProps {\n children: ReactNode;\n value: any;\n}\n\nconst Provider = ({\n children,\n context,\n inheritedContext,\n}: {\n children: ReactNode;\n context?: ShellContextProps;\n inheritedContext?: ShellContextProps;\n}) => {\n // TODO functions provided at multiple levels must be merged\n const mergedContext = {\n ...inheritedContext,\n ...context,\n };\n return (\n <ShellContext.Provider value={mergedContext}>\n {children}\n </ShellContext.Provider>\n );\n};\n\nexport const ShellContextProvider = ({\n children,\n value,\n}: ShellProviderProps): ReactElement => {\n return (\n <ShellContext.Consumer>\n {(context) => (\n <Provider context={value} inheritedContext={context}>\n {children}\n </Provider>\n )}\n </ShellContext.Consumer>\n );\n};\n\nexport const useShellContext = () => {\n return useContext(ShellContext);\n};\n", "import React, { useCallback, useRef, useState } from \"react\";\nimport { Button } from \"@salt-ds/core\";\nimport { DropdownBase } from \"@heswell/salt-lab\";\nimport { UserSolidIcon } from \"@salt-ds/icons\";\nimport { UserPanel } from \"./UserPanel\";\n\nimport \"./UserProfile.css\";\n\nexport const UserProfile = ({ layoutId, loginUrl, onNavigate, user }) => {\n const [open, setOpen] = useState(false);\n const openRef = useRef(false);\n const buttonRef = useRef(null);\n\n const toggle = useCallback(() => {\n setOpen((isOpen) => {\n return (openRef.current = !isOpen);\n });\n requestAnimationFrame(() => {\n if (!openRef.current) {\n requestAnimationFrame(() => {\n buttonRef.current.focus();\n });\n }\n });\n }, []);\n\n const handleNavigate = (id) => {\n setOpen(false);\n onNavigate(id);\n };\n\n return (\n <div className=\"vuuUserProfile\">\n <DropdownBase placement=\"bottom-end\" onCancel={toggle}>\n <Button ref={buttonRef} variant=\"secondary\">\n <UserSolidIcon />\n </Button>\n <UserPanel\n layoutId={layoutId}\n loginUrl={loginUrl}\n onNavigate={handleNavigate}\n user={user}\n />\n </DropdownBase>\n </div>\n );\n};\n", "import React, { forwardRef, useCallback, useEffect, useState } from \"react\";\nimport { formatDate } from \"@vuu-ui/vuu-utils\";\nimport { logout } from \"../login\";\nimport { getLayoutHistory } from \"../get-layout-history\";\nimport { ExportIcon } from \"@salt-ds/icons\";\nimport { Button } from \"@salt-ds/core\";\nimport { List, ListItem } from \"@heswell/salt-lab\";\n\nimport \"./UserPanel.css\";\n\nconst byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {\n return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;\n};\n\nconst HistoryListItem = (props) => {\n return <ListItem {...props} />;\n};\n\nexport const UserPanel = forwardRef(function UserPanel(\n { loginUrl, onNavigate, user, layoutId = \"latest\" },\n forwardedRef\n) {\n const [history, setHistory] = useState([]);\n\n useEffect(() => {\n async function getHistory() {\n const history = await getLayoutHistory(user);\n console.log({ history });\n const sortedHistory = history\n .filter((item) => item.id !== \"latest\")\n .sort(byLastUpdate)\n .map(({ id, lastUpdate }) => ({\n lastUpdate,\n id,\n label: `Saved at ${formatDate(new Date(lastUpdate), \"kk:mm:ss\")}`,\n }));\n console.log({ sortedHistory });\n setHistory(sortedHistory);\n }\n\n getHistory();\n }, [user]);\n\n const handleHisorySelected = useCallback(\n (evt, selected) => {\n if (selected) {\n onNavigate(selected.id);\n }\n },\n [onNavigate]\n );\n\n const handleLogout = useCallback(() => {\n logout(loginUrl);\n }, [loginUrl]);\n\n const selected =\n history.length === 0\n ? []\n : layoutId === \"latest\"\n ? history[0]\n : history.find((i) => i.id === layoutId);\n console.log({ selected });\n\n return (\n <div className=\"vuuUserPanel\" ref={forwardedRef}>\n <List\n ListItem={HistoryListItem}\n className=\"vuuUserPanel-history\"\n onSelect={handleHisorySelected}\n selected={selected}\n source={history}\n />\n <div className=\"vuuUserPanel-buttonBar\">\n <Button aria-label=\"logout\" onClick={handleLogout}>\n <ExportIcon /> Logout\n </Button>\n </div>\n </div>\n );\n});\n", "export const getLayoutHistory = async (user) => {\n const history = await fetch(`api/vui/${user.username}`, {})\n .then((response) => {\n return response.ok ? response.json() : null;\n })\n .catch(() => {\n // TODO we should set a layout with a warning here\n console.log(`error getting history`);\n });\n\n return history;\n};\n", "import { HTMLAttributes } from \"react\";\nimport { VuuUser } from \"../shell\";\nimport { UserProfile } from \"../user-profile\";\nimport \"./AppHeader.css\";\n\nexport interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {\n layoutId: string;\n loginUrl?: string;\n onNavigate: (id: string) => void;\n user: VuuUser;\n}\n\nexport const AppHeader = ({\n layoutId,\n loginUrl,\n onNavigate,\n user,\n ...htmlAttributes\n}: AppHeaderProps) => {\n return (\n <header className=\"hwAppHeader\" {...htmlAttributes}>\n {/* <ToggleButton onChange={toggleColorScheme}>\n theme\n </ToggleButton> */}\n <UserProfile\n layoutId={layoutId}\n loginUrl={loginUrl}\n onNavigate={onNavigate}\n user={user}\n />\n </header>\n );\n};\n"],
5
+ "mappings": "AAAA,OAAOA,GAAS,YAAAC,OAAgB,QAChC,OAAS,qBAAAC,OAAyB,qBCDlC,OAAOC,OAAW,QAqBV,mBAAAC,GACE,OAAAC,EADF,QAAAC,OAAA,oBAnBD,IAAMC,EAAN,cAA4BJ,GAAM,SAAU,CACjD,YAAYK,EAAO,CACjB,MAAMA,CAAK,EACX,KAAK,MAAQ,CAAE,aAAc,IAAK,CACpC,CAEA,OAAO,yBAAyBC,EAAO,CAErC,MAAO,CAAE,aAAcA,EAAM,OAAQ,CACvC,CAEA,kBAAkBA,EAAOC,EAAW,CAElC,QAAQ,IAAID,EAAOC,CAAS,CAC9B,CAEA,QAAS,CACP,OAAI,KAAK,MAAM,aAEXJ,GAAAF,GAAA,CACE,UAAAC,EAAC,MAAG,iCAAqB,EACzBA,EAAC,KAAG,cAAK,MAAM,aAAa,GAC9B,EAIG,KAAK,MAAM,QACpB,CACF,EC7B4B,cAAAM,OAAA,oBAArB,IAAMC,EAAS,IAAMD,GAAC,OAAI,UAAU,WAAW,mBAAO,ECDtD,IAAME,EAAY,MAAOC,GAAiB,CAC/C,IAAMC,EAAY,IAAI,cACtB,OAAO,MAAMD,CAAI,EACd,KAAME,GAAMA,EAAE,KAAK,CAAC,EACpB,KAAMA,GAAMD,EAAU,QAAQC,CAAC,CAAC,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VrB,GAAaC,EAAK,OACpBqB,GAAgBtB,EAAWC,EAAK,KAAK,CAEzC,EAAG,CAACD,EAAWC,EAAK,KAAK,CAAC,EAE1B,IAAMsB,GAAa,IAAM,CACvB,IAAMC,EAA0B,CAAC,EACjC,OAAI1B,GACF0B,EAAQ,KACNjC,EAACkC,GAAA,CAEC,QAASV,EACT,KAAMV,EACN,SAAS,OACT,OAAM,GACN,SAAQ,GACR,SAAU,IACV,aAAa,MAEb,SAAAd,EAACmC,GAAA,CACC,UAAU,mBACV,GAAG,iBAEH,IAAKvB,EACL,MAAO,CAAE,OAAQ,MAAO,EAEvB,SAAAL,GAJG,aAKN,GAjBI,YAkBN,CACF,EAGK0B,CACT,EAEA,OAEEhC,EAACmC,EAAA,CAAqB,MAAO,OAC3B,UAAApC,EAACqC,GAAA,CAAe,OAAQnB,EAAQ,eAAgBI,EAC9C,SAAAtB,EAACsC,EAAA,CACC,UAAWC,GAAG,WAAYlC,CAAS,EAClC,GAAGM,EAEJ,SAAAV,EAACuC,GAAA,CACC,UAAU,MACV,MAAO,CAAE,cAAe,SAAU,OAAQ,OAAQ,MAAO,MAAO,EAEhE,UAAAxC,EAACyC,EAAA,CACC,SAAUxB,EAAS,QACnB,SAAUT,EACV,KAAME,EACN,WAAYkB,EACd,EACA5B,EAAC0C,GAAA,CAAM,MAAO,CAAE,KAAM,CAAE,EACrB,SAAAV,GAAW,EAAE,OACZhC,EAACsC,EAAA,CACC,WAAU,GAEV,MAAO,CAAE,MAAO,OAAQ,OAAQ,MAAO,GADnC,cAEN,CACF,EACF,GACF,EACF,EACF,EACClC,GACH,CAEJ",
6
+ "names": ["React", "Suspense", "registerComponent", "React", "Fragment", "jsx", "jsxs", "ErrorBoundary", "props", "error", "errorInfo", "jsx", "Loader", "importCSS", "path", "container", "x", "jsx", "RawFeature", "url", "css", "params", "props", "importCSS", "styleSheet", "LazyFeature", "React", "ErrorBoundary", "Suspense", "Loader", "Feature", "registerComponent", "useState", "Button", "FormField", "Input", "jsx", "jsxs", "classBase", "LoginPanel", "onSubmit", "username", "setUserName", "useState", "password", "setPassword", "login", "handleUsername", "_event", "value", "handlePassword", "dataIsValid", "FormField", "Input", "Button", "getCookieValue", "name", "_a", "row", "getAuthDetailsFromCookies", "username", "token", "redirectToLogin", "loginUrl", "logout", "connectToServer", "useCallback", "useEffect", "useRef", "useState", "useCallback", "useEffect", "useState", "useLayoutConfig", "user", "defaultLayout", "layout", "_setLayout", "setLayout", "load", "id", "response", "saveData", "data", "loadLayoutById", "use_layout_config_default", "createContext", "useContext", "jsx", "defaultConfig", "ShellContext", "Provider", "children", "context", "inheritedContext", "mergedContext", "ShellContextProvider", "value", "useShellContext", "cx", "Chest", "DraggableLayout", "Drawer", "Flexbox", "LayoutProvider", "View", "useCallback", "useRef", "useState", "Button", "DropdownBase", "UserSolidIcon", "forwardRef", "useCallback", "useEffect", "useState", "formatDate", "getLayoutHistory", "user", "response", "ExportIcon", "Button", "List", "ListItem", "jsx", "jsxs", "byLastUpdate", "l1", "l2", "HistoryListItem", "props", "ListItem", "UserPanel", "forwardRef", "loginUrl", "onNavigate", "user", "layoutId", "forwardedRef", "history", "setHistory", "useState", "useEffect", "getHistory", "getLayoutHistory", "sortedHistory", "item", "id", "lastUpdate", "formatDate", "handleHisorySelected", "useCallback", "evt", "selected", "handleLogout", "logout", "i", "List", "Button", "ExportIcon", "jsx", "jsxs", "UserProfile", "layoutId", "loginUrl", "onNavigate", "user", "open", "setOpen", "useState", "openRef", "useRef", "buttonRef", "toggle", "useCallback", "isOpen", "DropdownBase", "Button", "UserSolidIcon", "UserPanel", "id", "jsx", "AppHeader", "layoutId", "loginUrl", "onNavigate", "user", "htmlAttributes", "UserProfile", "jsx", "jsxs", "warningLayout", "Shell", "children", "className", "defaultLayout", "leftSidePanel", "loginUrl", "serverUrl", "user", "htmlAttributes", "paletteView", "useRef", "open", "setOpen", "useState", "layoutId", "layout", "setLayoutConfig", "loadLayoutById", "use_layout_config_default", "handleLayoutChange", "useCallback", "handleDrawerClick", "e", "_a", "target", "handleNavigate", "id", "useEffect", "connectToServer", "getDrawers", "drawers", "Drawer", "View", "ShellContextProvider", "LayoutProvider", "DraggableLayout", "cx", "Flexbox", "AppHeader", "Chest"]
7
+ }
package/index.css CHANGED
@@ -1,78 +1,2 @@
1
- /* src/login/LoginPanel.css */
2
- .vuuLoginPanel {
3
- --hwTextInput-border: solid 1px #ccc;
4
- --hwTextInput-height: 28px;
5
- --hwTextInput-padding: 0 12px;
6
- --hwTextInput-width: 100%;
7
- --login-row-height: 60px;
8
- align-content: center;
9
- align-items: center;
10
- border: solid 1px lightgray;
11
- display: flex;
12
- flex-direction: column;
13
- gap: 24px;
14
- justify-content: center;
15
- justify-items: center;
16
- margin: 0 auto;
17
- padding: 48px 48px 24px 48px;
18
- width: fit-content;
19
- }
20
- .vuuLoginPanel-login {
21
- grid-column: 2/3;
22
- align-self: end;
23
- justify-self: end;
24
- }
25
-
26
- /* src/user-profile/UserPanel.css */
27
- .vuuUserPanel {
28
- background-color: white;
29
- display: flex;
30
- flex-direction: column;
31
- max-height: 400px;
32
- padding: 12px;
33
- }
34
- vuuUserPanel-history {
35
- flex: 1 1 auto;
36
- }
37
- .vuuUserPanel-buttonBar {
38
- --saltButton-width: 100%;
39
- align-items: flex-end;
40
- border-top: 1px solid var(--surface3);
41
- display: flex;
42
- flex: 0 0 32px;
43
- justify-content: flex-start;
44
- }
45
- .btn-logout {
46
- --hwButton-icon-left: 12px;
47
- --hwButton-padding: 0 6px 0 24px;
48
- padding-left: 24px;
49
- }
50
-
51
- /* src/user-profile/UserProfile.css */
52
- .vuuUserProfile {
53
- --svg-icon: var(--svg-user);
54
- }
55
-
56
- /* src/app-header/AppHeader.css */
57
- .hwAppHeader {
58
- justify-content: flex-end;
59
- display: flex;
60
- height: 40px;
61
- border-bottom: solid 1px #ccc;
62
- }
63
-
64
- /* src/shell.css */
65
- .vuuShell {
66
- background-color: var(--salt-container-primary-background, ivory);
67
- height: var(--vuuShell-height, 100vh);
68
- width: var(--vuuShell-width, 100vw);
69
- }
70
- .vuuShell-palette {
71
- --vuuView-border: none;
72
- --vuuView-margin: 0;
73
- }
74
- .vuuShell-warningPlaceholder {
75
- background-color: var(--salt-container-background-high);
76
- height: 100%;
77
- }
1
+ .vuuLoginPanel{--hwTextInput-border: solid 1px #ccc;--hwTextInput-height: 28px;--hwTextInput-padding: 0 12px;--hwTextInput-width: 100%;--login-row-height: 60px;align-content:center;align-items:center;border:solid 1px lightgray;display:flex;flex-direction:column;gap:24px;justify-content:center;justify-items:center;margin:0 auto;padding:48px 48px 24px;width:fit-content}.vuuLoginPanel-login{grid-column:2/3;align-self:end;justify-self:end}.vuuUserPanel{background-color:#fff;display:flex;flex-direction:column;max-height:400px;padding:12px}vuuUserPanel-history{flex:1 1 auto}.vuuUserPanel-buttonBar{--saltButton-width: 100%;align-items:flex-end;border-top:1px solid var(--surface3);display:flex;flex:0 0 32px;justify-content:flex-start}.btn-logout{--hwButton-icon-left: 12px;--hwButton-padding: 0 6px 0 24px;padding-left:24px}.vuuUserProfile{--svg-icon: var(--svg-user)}.hwAppHeader{justify-content:flex-end;display:flex;height:40px;border-bottom:solid 1px #ccc}.vuuShell{background-color:var(--salt-container-primary-background, ivory);height:var(--vuuShell-height, 100vh);width:var(--vuuShell-width, 100vw)}.vuuShell-palette{--vuuView-border: none;--vuuView-margin: 0}.vuuShell-warningPlaceholder{background-color:var(--salt-container-background-high);height:100%}
78
2
  /*# sourceMappingURL=index.css.map */
package/index.css.map CHANGED
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/vuu-shell/src/login/LoginPanel.css", "../../../packages/vuu-shell/src/user-profile/UserPanel.css", "../../../packages/vuu-shell/src/user-profile/UserProfile.css", "../../../packages/vuu-shell/src/app-header/AppHeader.css", "../../../packages/vuu-shell/src/shell.css"],
4
4
  "sourcesContent": [".vuuLoginPanel {\n --hwTextInput-border: solid 1px #ccc;\n --hwTextInput-height: 28px;\n --hwTextInput-padding: 0 12px;\n --hwTextInput-width: 100%;\n --login-row-height: 60px;\n align-content: center;\n align-items: center;\n border: solid 1px lightgray;\n display: flex;\n flex-direction: column;\n gap: 24px;\n justify-content: center;\n justify-items: center;\n margin: 0 auto;\n padding: 48px 48px 24px 48px;\n width: fit-content;\n}\n\n.vuuLoginPanel-login {\n grid-column: 2/3;\n align-self: end;\n justify-self: end;\n}\n", ".vuuUserPanel {\n background-color: white;\n display: flex;\n flex-direction: column;\n max-height: 400px;\n padding: 12px;\n}\n\nvuuUserPanel-history {\n flex: 1 1 auto;\n}\n\n.vuuUserPanel-buttonBar {\n --saltButton-width: 100%;\n align-items: flex-end;\n border-top: 1px solid var(--surface3);\n display: flex;\n flex: 0 0 32px;\n justify-content: flex-start;\n}\n\n.btn-logout {\n --hwButton-icon-left: 12px;\n --hwButton-padding: 0 6px 0 24px;\n padding-left: 24px;\n}\n", ".vuuUserProfile {\n --svg-icon: var(--svg-user);\n}\n", ".hwAppHeader {\n justify-content: flex-end;\n display: flex;\n height: 40px;\n border-bottom: solid 1px #ccc;\n}\n", ".vuuShell {\n background-color: var(--salt-container-primary-background, ivory);\n height: var(--vuuShell-height, 100vh);\n width: var(--vuuShell-width, 100vw);\n}\n\n.vuuShell-palette {\n --vuuView-border: none;\n --vuuView-margin: 0;\n}\n\n.vuuShell-warningPlaceholder {\n background-color: var(--salt-container-background-high);\n height: 100%;\n}\n"],
5
- "mappings": ";AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AACA;AACA;AAAA;;;ACtBF;AACE;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AAAA;AAGF;AACE;AACA;AACA;AACA;AACA;AACA;AAAA;AAGF;AACE;AACA;AACA;AAAA;;;ACxBF;AACE;AAAA;;;ACDF;AACE;AACA;AACA;AACA;AAAA;;;ACJF;AACE;AACA;AACA;AAAA;AAGF;AACE;AACA;AAAA;AAGF;AACE;AACA;AAAA;",
5
+ "mappings": "AAAA,eACE,qCACA,2BACA,8BACA,0BACA,yBACA,qBACA,mBACA,2BACA,aACA,sBACA,SACA,uBACA,qBAbF,qCAgBE,kBAGF,qBACE,gBACA,eACA,iBCtBF,cACE,sBACA,aACA,sBACA,iBAJF,aAQA,qBACE,cAGF,wBACE,yBACA,qBACA,qCACA,aACA,cACA,2BAGF,YACE,2BACA,iCACA,kBCxBF,gBACE,4BCDF,aACE,yBACA,aACA,YACA,6BCJF,UACE,iEACA,qCACA,mCAGF,kBACE,uBACA,oBAGF,6BACE,uDACA",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,29 +1,26 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-shell",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "VUU UI Shell",
5
5
  "author": "heswell",
6
6
  "license": "Apache-2.0",
7
- "scripts": {
8
- "build": "node ../../scripts/run-build.mjs"
9
- },
10
7
  "peerDependencies": {
11
8
  "@salt-ds/core": "1.0.0",
12
9
  "@salt-ds/icons": "1.0.0",
13
10
  "@heswell/salt-lab": "1.0.0-alpha.0",
14
- "@vuu-ui/vuu-data": "0.5.4",
15
- "@vuu-ui/vuu-layout": "0.5.4",
16
- "@vuu-ui/vuu-utils": "0.5.4",
11
+ "@vuu-ui/vuu-data": "0.5.5",
12
+ "@vuu-ui/vuu-layout": "0.5.5",
13
+ "@vuu-ui/ui-controls": "0.5.5",
14
+ "@vuu-ui/vuu-utils": "0.5.5",
17
15
  "classnames": "^2.2.6",
18
16
  "react": "^17.0.2",
19
17
  "react-dom": "^17.0.2"
20
18
  },
21
19
  "files": [
22
- "index.js",
20
+ "cjs",
21
+ "esm",
23
22
  "index.css",
24
- "index.js.map",
25
- "index.css.map",
26
- "/src"
23
+ "index.css.map"
27
24
  ],
28
25
  "module": "esm/index.js",
29
26
  "main": "cjs/index.js"
@@ -1,54 +0,0 @@
1
- import { createContext, ReactElement, ReactNode, useContext } from "react";
2
-
3
- export interface ShellContextProps {
4
- handleRpcResponse?: (response: unknown) => void;
5
- }
6
-
7
- const defaultConfig = {};
8
-
9
- const ShellContext = createContext<ShellContextProps>(defaultConfig);
10
-
11
- export interface ShellProviderProps {
12
- children: ReactNode;
13
- value: any;
14
- }
15
-
16
- const Provider = ({
17
- children,
18
- context,
19
- inheritedContext,
20
- }: {
21
- children: ReactNode;
22
- context?: ShellContextProps;
23
- inheritedContext?: ShellContextProps;
24
- }) => {
25
- // TODO functions provided at multiple levels must be merged
26
- const mergedContext = {
27
- ...inheritedContext,
28
- ...context,
29
- };
30
- return (
31
- <ShellContext.Provider value={mergedContext}>
32
- {children}
33
- </ShellContext.Provider>
34
- );
35
- };
36
-
37
- export const ShellContextProvider = ({
38
- children,
39
- value,
40
- }: ShellProviderProps): ReactElement => {
41
- return (
42
- <ShellContext.Consumer>
43
- {(context) => (
44
- <Provider context={value} inheritedContext={context}>
45
- {children}
46
- </Provider>
47
- )}
48
- </ShellContext.Consumer>
49
- );
50
- };
51
-
52
- export const useShellContext = () => {
53
- return useContext(ShellContext);
54
- };
@@ -1,6 +0,0 @@
1
- .hwAppHeader {
2
- justify-content: flex-end;
3
- display: flex;
4
- height: 40px;
5
- border-bottom: solid 1px #ccc;
6
- }
@@ -1,33 +0,0 @@
1
- import { HTMLAttributes } from "react";
2
- import { VuuUser } from "../shell";
3
- import { UserProfile } from "../user-profile";
4
- import "./AppHeader.css";
5
-
6
- export interface AppHeaderProps extends HTMLAttributes<HTMLDivElement> {
7
- layoutId: string;
8
- loginUrl?: string;
9
- onNavigate: (id: string) => void;
10
- user: VuuUser;
11
- }
12
-
13
- export const AppHeader = ({
14
- layoutId,
15
- loginUrl,
16
- onNavigate,
17
- user,
18
- ...htmlAttributes
19
- }: AppHeaderProps) => {
20
- return (
21
- <header className="hwAppHeader" {...htmlAttributes}>
22
- {/* <ToggleButton onChange={toggleColorScheme}>
23
- theme
24
- </ToggleButton> */}
25
- <UserProfile
26
- layoutId={layoutId}
27
- loginUrl={loginUrl}
28
- onNavigate={onNavigate}
29
- user={user}
30
- />
31
- </header>
32
- );
33
- };
@@ -1 +0,0 @@
1
- export * from './AppHeader';
@@ -1,56 +0,0 @@
1
- import React from "react";
2
- import cx from "classnames";
3
- import {
4
- ComponentRegistry,
5
- isRegistered,
6
- Palette,
7
- PaletteItem,
8
- } from "@vuu-ui/vuu-layout";
9
-
10
- const getPaletteItems = (config) => {
11
- const paletteItems = [];
12
-
13
- config.forEach((configItem) => {
14
- const { label, items = [] } = configItem;
15
- paletteItems.push(
16
- <div key={label} data-header>
17
- {label}
18
- </div>
19
- );
20
- items.forEach((paletteItem, i) => {
21
- const { component, type, props, ...args } = paletteItem;
22
- if (component) {
23
- paletteItems.push(
24
- <PaletteItem {...args} key={i}>
25
- {component}
26
- </PaletteItem>
27
- );
28
- } else if (type && isRegistered(type)) {
29
- const Component = ComponentRegistry[type];
30
- paletteItems.push(
31
- <PaletteItem {...args} key={i}>
32
- {React.createElement(Component, {
33
- ...props,
34
- key: i,
35
- })}
36
- </PaletteItem>
37
- );
38
- }
39
- });
40
- });
41
-
42
- return paletteItems;
43
- };
44
-
45
- export const AppPalette = ({ className, config, ...props }) => {
46
- return (
47
- <Palette
48
- className={cx("TableList", className)}
49
- orientation="vertical"
50
- collapsibleHeaders
51
- {...props}
52
- >
53
- {getPaletteItems(config)}
54
- </Palette>
55
- );
56
- };
@@ -1 +0,0 @@
1
- export * from './AppPalette';
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- // TODO
3
- export class ErrorBoundary extends React.Component {
4
- constructor(props) {
5
- super(props);
6
- this.state = { errorMessage: null };
7
- }
8
-
9
- static getDerivedStateFromError(error) {
10
- // Update state so the next render will show the fallback UI.
11
- return { errorMessage: error.message };
12
- }
13
-
14
- componentDidCatch(error, errorInfo) {
15
- // You can also log the error to an error reporting service
16
- console.log(error, errorInfo);
17
- }
18
-
19
- render() {
20
- if (this.state.errorMessage) {
21
- return (
22
- <>
23
- <h1>Something went wrong.</h1>
24
- <p>{this.state.errorMessage}</p>
25
- </>
26
- );
27
- }
28
-
29
- return this.props.children;
30
- }
31
- }
@@ -1,52 +0,0 @@
1
- import React, { Suspense } from "react";
2
- import { registerComponent } from "@vuu-ui/vuu-layout";
3
- import { ErrorBoundary } from "./ErrorBoundary";
4
- import { Loader } from "./Loader";
5
- import { importCSS } from "./css-module-loader";
6
-
7
- export interface FeatureProps<Params extends object | undefined = undefined> {
8
- height?: number;
9
- url: string;
10
- css?: string;
11
- width?: number;
12
- params: Params;
13
- }
14
-
15
- // const RawFeature = <Params extends object | undefined>({
16
- function RawFeature<Params extends object | undefined>({
17
- url,
18
- css,
19
- params,
20
- ...props
21
- }: FeatureProps<Params>) {
22
- if (css) {
23
- // import(/* @vite-ignore */ css, { assert: { type: "css" } }).then(
24
- // (cssModule) => {
25
- // document.adoptedStyleSheets = [
26
- // ...document.adoptedStyleSheets,
27
- // cssModule.default,
28
- // ];
29
- // }
30
- // );
31
- // Polyfill until vite build supports import assertions
32
- // Note: already fully supported in esbuild, so vite dev
33
- importCSS(css).then((styleSheet) => {
34
- document.adoptedStyleSheets = [
35
- ...document.adoptedStyleSheets,
36
- styleSheet,
37
- ];
38
- });
39
- }
40
- const LazyFeature = React.lazy(() => import(/* @vite-ignore */ url));
41
- return (
42
- <ErrorBoundary>
43
- <Suspense fallback={<Loader />}>
44
- <LazyFeature {...props} {...params} />
45
- </Suspense>
46
- </ErrorBoundary>
47
- );
48
- }
49
-
50
- export const Feature = React.memo(RawFeature);
51
- Feature.displayName = "Feature";
52
- registerComponent("Feature", Feature, "view");
@@ -1,2 +0,0 @@
1
- // TODO
2
- export const Loader = () => <div className="hwLoader">loading</div>;
@@ -1,6 +0,0 @@
1
- export const importCSS = async (path: string) => {
2
- const container = new CSSStyleSheet();
3
- return fetch(path)
4
- .then((x) => x.text())
5
- .then((x) => container.replace(x));
6
- };
@@ -1 +0,0 @@
1
- export * from './Feature';
@@ -1,12 +0,0 @@
1
- export const getLayoutHistory = async (user) => {
2
- const history = await fetch(`api/vui/${user.username}`, {})
3
- .then((response) => {
4
- return response.ok ? response.json() : null;
5
- })
6
- .catch(() => {
7
- // TODO we should set a layout with a warning here
8
- console.log(`error getting history`);
9
- });
10
-
11
- return history;
12
- };
package/src/index.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from "./feature";
2
- export * from "./login";
3
- export * from "@vuu-ui/vuu-layout/src/menu";
4
- export * from "./shell";
5
- export * from "./shellTypes";
6
- export * from "./ShellContextProvider";
@@ -1,24 +0,0 @@
1
- .vuuLoginPanel {
2
- --hwTextInput-border: solid 1px #ccc;
3
- --hwTextInput-height: 28px;
4
- --hwTextInput-padding: 0 12px;
5
- --hwTextInput-width: 100%;
6
- --login-row-height: 60px;
7
- align-content: center;
8
- align-items: center;
9
- border: solid 1px lightgray;
10
- display: flex;
11
- flex-direction: column;
12
- gap: 24px;
13
- justify-content: center;
14
- justify-items: center;
15
- margin: 0 auto;
16
- padding: 48px 48px 24px 48px;
17
- width: fit-content;
18
- }
19
-
20
- .vuuLoginPanel-login {
21
- grid-column: 2/3;
22
- align-self: end;
23
- justify-self: end;
24
- }
@@ -1,63 +0,0 @@
1
- import { ChangeEvent, HTMLAttributes, useState } from "react";
2
- import { Button } from "@salt-ds/core";
3
- import { FormField, Input } from "@heswell/salt-lab";
4
-
5
- import "./LoginPanel.css";
6
-
7
- const classBase = "vuuLoginPanel";
8
-
9
- export interface LoginPanelProps
10
- extends Omit<HTMLAttributes<HTMLDivElement>, "onSubmit"> {
11
- onSubmit: (username: string, password: string) => void;
12
- }
13
-
14
- export const LoginPanel = ({ onSubmit }: LoginPanelProps) => {
15
- const [username, setUserName] = useState("");
16
- const [password, setPassword] = useState("");
17
-
18
- const login = () => {
19
- onSubmit(username, password);
20
- };
21
-
22
- const handleUsername = (
23
- _event: ChangeEvent<HTMLInputElement>,
24
- value: string
25
- ) => {
26
- setUserName(value);
27
- };
28
-
29
- const handlePassword = (
30
- _event: ChangeEvent<HTMLInputElement>,
31
- value: string
32
- ) => {
33
- setPassword(value);
34
- };
35
-
36
- const dataIsValid = username.trim() !== "" && password.trim() !== "";
37
-
38
- return (
39
- <div className={classBase}>
40
- <FormField label="Username" style={{ width: 200 }}>
41
- <Input value={username} id="text-username" onChange={handleUsername} />
42
- </FormField>
43
-
44
- <FormField label="Password" style={{ width: 200 }}>
45
- <Input
46
- type="password"
47
- value={password}
48
- id="text-password"
49
- onChange={handlePassword}
50
- />
51
- </FormField>
52
-
53
- <Button
54
- className={`${classBase}-login`}
55
- disabled={!dataIsValid}
56
- onClick={login}
57
- variant="cta"
58
- >
59
- Login
60
- </Button>
61
- </div>
62
- );
63
- };
@@ -1,2 +0,0 @@
1
- export * from './LoginPanel';
2
- export * from './login-utils';
@@ -1,21 +0,0 @@
1
- const getCookieValue = (name: string) =>
2
- document.cookie
3
- .split("; ")
4
- .find((row) => row.startsWith(`${name}=`))
5
- ?.split("=")[1];
6
-
7
- export const getAuthDetailsFromCookies = () => {
8
- const username = getCookieValue("vuu-username");
9
- const token = getCookieValue("vuu-auth-token");
10
- return [username, token];
11
- };
12
-
13
- export const redirectToLogin = (loginUrl = "/login.html") => {
14
- window.location.href = loginUrl;
15
- };
16
-
17
- export const logout = (loginUrl?: string) => {
18
- document.cookie = "vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
19
- document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
20
- redirectToLogin(loginUrl);
21
- };
package/src/shell.css DELETED
@@ -1,15 +0,0 @@
1
- .vuuShell {
2
- background-color: var(--salt-container-primary-background, ivory);
3
- height: var(--vuuShell-height, 100vh);
4
- width: var(--vuuShell-width, 100vw);
5
- }
6
-
7
- .vuuShell-palette {
8
- --vuuView-border: none;
9
- --vuuView-margin: 0;
10
- }
11
-
12
- .vuuShell-warningPlaceholder {
13
- background-color: var(--salt-container-background-high);
14
- height: 100%;
15
- }