@malloy-publisher/sdk 0.0.52 → 0.0.54

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.
@@ -8,11 +8,11 @@ import {
8
8
  Typography,
9
9
  } from "@mui/material";
10
10
  import { Configuration, PackagesApi } from "../../client";
11
+ import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
11
12
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
12
13
  import { Loading } from "../Loading";
13
14
  import { StyledCard, StyledCardContent } from "../styles";
14
15
  import { usePackage } from "./PackageProvider";
15
- import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
16
16
 
17
17
  const packagesApi = new PackagesApi(new Configuration());
18
18
 
@@ -32,7 +32,7 @@ export default function Config() {
32
32
  });
33
33
 
34
34
  return (
35
- <StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
35
+ <StyledCard variant="outlined" sx={{ width: "100%" }}>
36
36
  <StyledCardContent>
37
37
  <Typography variant="overline" fontWeight="bold">
38
38
  Package Config
@@ -40,14 +40,17 @@ export default function Config() {
40
40
  <Divider />
41
41
  <Box
42
42
  sx={{
43
- mt: "10px",
44
43
  maxHeight: "200px",
45
44
  overflowY: "auto",
46
45
  }}
47
46
  >
48
47
  <List dense={true} disablePadding={true}>
49
48
  <ListItem dense={true} disablePadding={true}>
50
- <ListItemText primary="Name" secondary={packageName} />
49
+ <ListItemText
50
+ primary="Name"
51
+ primaryTypographyProps={{ fontWeight: "500" }}
52
+ secondary={packageName}
53
+ />
51
54
  </ListItem>
52
55
  {!isSuccess && !isError && (
53
56
  <ListItem>
@@ -59,24 +62,27 @@ export default function Config() {
59
62
  <ListItem dense={true} disablePadding={true}>
60
63
  <ListItemText
61
64
  primary="Description"
65
+ primaryTypographyProps={{
66
+ fontWeight: "500",
67
+ }}
62
68
  secondary={data.data.description}
63
69
  />
64
70
  </ListItem>
65
71
  )) || (
66
- <ListItem
67
- disablePadding={true}
68
- dense={true}
69
- sx={{ mt: "20px" }}
70
- >
71
- <ErrorIcon
72
- sx={{
73
- color: "grey.600",
74
- mr: "10px",
75
- }}
76
- />
77
- <ListItemText primary={"No package manifest"} />
78
- </ListItem>
79
- ))}
72
+ <ListItem
73
+ disablePadding={true}
74
+ dense={true}
75
+ sx={{ mt: "20px" }}
76
+ >
77
+ <ErrorIcon
78
+ sx={{
79
+ color: "grey.600",
80
+ mr: "10px",
81
+ }}
82
+ />
83
+ <ListItemText primary={"No package manifest"} />
84
+ </ListItem>
85
+ ))}
80
86
  {isError && (
81
87
  <ApiErrorDisplay
82
88
  error={error}
@@ -9,10 +9,10 @@ import {
9
9
  } from "@mui/material";
10
10
  import { Configuration, ConnectionsApi } from "../../client";
11
11
  import { Connection as ApiConnection } from "../../client/api";
12
+ import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
13
+ import { ApiErrorDisplay } from "../ApiErrorDisplay";
12
14
  import { StyledCard, StyledCardContent } from "../styles";
13
15
  import { usePackage } from "./PackageProvider";
14
- import { ApiErrorDisplay } from "../ApiErrorDisplay";
15
- import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
16
16
 
17
17
  const connectionsApi = new ConnectionsApi(new Configuration());
18
18
 
@@ -39,7 +39,7 @@ export default function Connections() {
39
39
  });
40
40
 
41
41
  return (
42
- <StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
42
+ <StyledCard variant="outlined" sx={{ width: "100%" }}>
43
43
  <StyledCardContent>
44
44
  <Typography variant="overline" fontWeight="bold">
45
45
  Database Connections
@@ -47,13 +47,12 @@ export default function Connections() {
47
47
  <Divider />
48
48
  <Box
49
49
  sx={{
50
- mt: "10px",
51
50
  maxHeight: "200px",
52
51
  overflowY: "auto",
53
52
  }}
54
53
  >
55
54
  {!isSuccess && !isError && (
56
- <Typography variant="body2" sx={{ p: "20px", m: "auto" }}>
55
+ <Typography variant="body2" sx={{ m: "auto" }}>
57
56
  Fetching Connections...
58
57
  </Typography>
59
58
  )}
@@ -14,11 +14,11 @@ import {
14
14
  } from "@mui/material";
15
15
  import React from "react";
16
16
  import { Configuration, Database, DatabasesApi } from "../../client";
17
- import { StyledCard, StyledCardContent } from "../styles";
18
- import { usePackage } from "./PackageProvider";
17
+ import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
19
18
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
20
19
  import { Loading } from "../Loading";
21
- import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
20
+ import { StyledCard, StyledCardContent } from "../styles";
21
+ import { usePackage } from "./PackageProvider";
22
22
 
23
23
  const databasesApi = new DatabasesApi(new Configuration());
24
24
 
@@ -62,15 +62,14 @@ export default function Databases() {
62
62
  };
63
63
  return (
64
64
  <>
65
- <StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
65
+ <StyledCard variant="outlined" sx={{ width: "100%" }}>
66
66
  <StyledCardContent>
67
67
  <Typography variant="overline" fontWeight="bold">
68
- Databases
68
+ Embedded Databases
69
69
  </Typography>
70
70
  <Divider />
71
71
  <Box
72
72
  sx={{
73
- mt: "10px",
74
73
  maxHeight: "200px",
75
74
  overflowY: "auto",
76
75
  }}
@@ -111,7 +110,7 @@ export default function Databases() {
111
110
  </Table>
112
111
  )}
113
112
  {isSuccess && data.data.length === 0 && (
114
- <Typography variant="body2" sx={{ p: "10px", m: "auto" }}>
113
+ <Typography variant="body2" sx={{ m: "auto" }}>
115
114
  No databases found
116
115
  </Typography>
117
116
  )}
@@ -1,11 +1,11 @@
1
1
  import { Box, Divider, Typography } from "@mui/material";
2
2
  import { Configuration, ModelsApi } from "../../client";
3
+ import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
3
4
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
4
5
  import { Loading } from "../Loading";
5
6
  import { StyledCard, StyledCardContent } from "../styles";
6
7
  import { FileTreeView } from "./FileTreeView";
7
8
  import { usePackage } from "./PackageProvider";
8
- import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
9
9
 
10
10
  const modelsApi = new ModelsApi(new Configuration());
11
11
 
@@ -24,7 +24,7 @@ export default function Models({ navigate }: ModelsProps) {
24
24
  });
25
25
 
26
26
  return (
27
- <StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
27
+ <StyledCard variant="outlined" sx={{ width: "100%" }}>
28
28
  <StyledCardContent>
29
29
  <Typography variant="overline" fontWeight="bold">
30
30
  Semantic Models
@@ -32,7 +32,6 @@ export default function Models({ navigate }: ModelsProps) {
32
32
  <Divider />
33
33
  <Box
34
34
  sx={{
35
- mt: "10px",
36
35
  maxHeight: "200px",
37
36
  overflowY: "auto",
38
37
  }}
@@ -1,11 +1,11 @@
1
1
  import { Box, Divider, Typography } from "@mui/material";
2
2
  import { Configuration, NotebooksApi } from "../../client";
3
+ import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
3
4
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
4
5
  import { Loading } from "../Loading";
5
6
  import { StyledCard, StyledCardContent } from "../styles";
6
7
  import { FileTreeView } from "./FileTreeView";
7
8
  import { usePackage } from "./PackageProvider";
8
- import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
9
9
 
10
10
  const notebooksApi = new NotebooksApi(new Configuration());
11
11
 
@@ -30,7 +30,7 @@ export default function Notebooks({ navigate }: NotebooksProps) {
30
30
  });
31
31
 
32
32
  return (
33
- <StyledCard variant="outlined" sx={{ padding: "10px", width: "100%" }}>
33
+ <StyledCard variant="outlined" sx={{ width: "100%" }}>
34
34
  <StyledCardContent>
35
35
  <Typography variant="overline" fontWeight="bold">
36
36
  Notebooks
@@ -38,7 +38,6 @@ export default function Notebooks({ navigate }: NotebooksProps) {
38
38
  <Divider />
39
39
  <Box
40
40
  sx={{
41
- mt: "10px",
42
41
  maxHeight: "200px",
43
42
  overflowY: "auto",
44
43
  }}
@@ -21,12 +21,7 @@ export default function Package({ navigate }: PackageProps) {
21
21
  }
22
22
 
23
23
  return (
24
- <Grid
25
- container
26
- spacing={2}
27
- columns={12}
28
- sx={{ mb: (theme) => theme.spacing(2) }}
29
- >
24
+ <Grid container spacing={2} columns={12}>
30
25
  <Grid size={{ xs: 12, md: 4 }}>
31
26
  <Config />
32
27
  </Grid>
@@ -1,11 +1,11 @@
1
- import { Divider, Typography } from "@mui/material";
2
- import { Configuration, ProjectsApi } from "../../client";
1
+ import { Typography } from "@mui/material";
3
2
  import Markdown from "markdown-to-jsx";
4
- import { StyledCard, StyledCardContent, StyledCardMedia } from "../styles";
5
- import { useProject } from "./Project";
3
+ import { Configuration, ProjectsApi } from "../../client";
4
+ import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
6
5
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
7
6
  import { Loading } from "../Loading";
8
- import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
7
+ import { StyledCard } from "../styles";
8
+ import { useProject } from "./Project";
9
9
 
10
10
  const projectsApi = new ProjectsApi(new Configuration());
11
11
 
@@ -21,16 +21,13 @@ export default function About() {
21
21
  <>
22
22
  {!isSuccess && !isError && <Loading text="Fetching About..." />}
23
23
  {isSuccess && (
24
- <StyledCard variant="outlined">
25
- <StyledCardContent>
26
- <Typography variant="overline" fontWeight="bold">
27
- Readme
28
- </Typography>
29
- <Divider />
30
- </StyledCardContent>
31
- <StyledCardMedia>
24
+ <StyledCard variant="outlined" sx={{ p: 2 }}>
25
+ <Typography variant="overline" fontWeight="bold" sx={{ mb: 1 }}>
26
+ Readme
27
+ </Typography>
28
+ <StyledCard sx={{ p: 1 }}>
32
29
  <Markdown>{data.data.readme}</Markdown>
33
- </StyledCardMedia>
30
+ </StyledCard>
34
31
  </StyledCard>
35
32
  )}
36
33
  {isError && (
@@ -1,10 +1,10 @@
1
- import { Box, Divider, Grid, Typography } from "@mui/material";
1
+ import { Box, Grid, Typography } from "@mui/material";
2
2
  import { Configuration, PackagesApi } from "../../client";
3
- import { StyledCard, StyledCardContent, StyledCardMedia } from "../styles";
4
- import { useProject } from "./Project";
3
+ import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
5
4
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
6
5
  import { Loading } from "../Loading";
7
- import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
6
+ import { StyledCard, StyledCardContent } from "../styles";
7
+ import { useProject } from "./Project";
8
8
 
9
9
  const packagesApi = new PackagesApi(new Configuration());
10
10
 
@@ -24,61 +24,54 @@ export default function Packages({ navigate }: PackagesProps) {
24
24
  <>
25
25
  {!isSuccess && !isError && <Loading text="Fetching Packages..." />}
26
26
  {isSuccess && (
27
- <StyledCard variant="outlined">
28
- <StyledCardContent>
29
- <Typography variant="overline" fontWeight="bold">
30
- Packages
31
- </Typography>
32
- <Divider />
33
- </StyledCardContent>
34
- <StyledCardMedia>
35
- <Grid
36
- container
37
- spacing={2}
38
- columns={12}
39
- sx={{ mb: (theme) => theme.spacing(2) }}
40
- >
41
- {data.data
42
- .sort((a, b) => {
43
- return a.name.localeCompare(b.name);
44
- })
45
- .map((p) => (
46
- <Grid
47
- size={{ xs: 12, sm: 12, md: 12, lg: 4 }}
48
- key={p.name}
27
+ <StyledCard variant="outlined" sx={{ p: 2 }}>
28
+ <Typography variant="overline" fontWeight="bold" sx={{ mb: 1 }}>
29
+ Packages
30
+ </Typography>
31
+ <Grid container spacing={2} columns={12}>
32
+ {data.data
33
+ .sort((a, b) => {
34
+ return a.name.localeCompare(b.name);
35
+ })
36
+ .map((p) => (
37
+ <Grid
38
+ size={{ xs: 12, sm: 12, md: 12, lg: 4 }}
39
+ key={p.name}
40
+ >
41
+ <StyledCard
42
+ variant="outlined"
43
+ sx={{
44
+ cursor: "pointer",
45
+ transition: "all 0.2s ease-in-out",
46
+ "&:hover": {
47
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
48
+ transform: "translateY(-2px)",
49
+ },
50
+ }}
51
+ onClick={(event) => navigate(p.name + "/", event)}
49
52
  >
50
- <StyledCard
51
- variant="outlined"
52
- sx={{ padding: "10px", cursor: "pointer" }}
53
- onClick={(event) =>
54
- navigate(p.name + "/", event)
55
- }
56
- >
57
- <StyledCardContent>
58
- <Typography
59
- variant="overline"
60
- color="primary.main"
61
- >
62
- {p.name}
53
+ <StyledCardContent>
54
+ <Typography
55
+ variant="overline"
56
+ color="primary.main"
57
+ >
58
+ {p.name}
59
+ </Typography>
60
+ <Box
61
+ sx={{
62
+ maxHeight: "120px",
63
+ overflowY: "auto",
64
+ }}
65
+ >
66
+ <Typography variant="body2">
67
+ {p.description}
63
68
  </Typography>
64
- <Divider />
65
- <Box
66
- sx={{
67
- mt: "10px",
68
- maxHeight: "100px",
69
- overflowY: "auto",
70
- }}
71
- >
72
- <Typography variant="body2">
73
- {p.description}
74
- </Typography>
75
- </Box>
76
- </StyledCardContent>
77
- </StyledCard>
78
- </Grid>
79
- ))}
80
- </Grid>
81
- </StyledCardMedia>
69
+ </Box>
70
+ </StyledCardContent>
71
+ </StyledCard>
72
+ </Grid>
73
+ ))}
74
+ </Grid>
82
75
  </StyledCard>
83
76
  )}
84
77
  {isError && (
@@ -1,7 +1,7 @@
1
1
  import { Grid } from "@mui/material";
2
+ import { createContext, ReactNode, useContext } from "react";
2
3
  import About from "./About";
3
4
  import Packages from "./Packages";
4
- import { createContext, useContext, ReactNode } from "react";
5
5
 
6
6
  export interface ProjectContextProps {
7
7
  projectName: string;
@@ -11,27 +11,28 @@ const ProjectContext = createContext<ProjectContextProps | undefined>(
11
11
  undefined,
12
12
  );
13
13
 
14
- interface ProjectProviderProps extends ProjectContextProps {
14
+ export function useProject(): ProjectContextProps {
15
+ const context = useContext(ProjectContext);
16
+ if (!context) {
17
+ throw new Error("useProject must be used within a ProjectProvider");
18
+ }
19
+ return context;
20
+ }
21
+
22
+ interface ProjectProviderProps {
15
23
  children: ReactNode;
24
+ projectName: string;
16
25
  }
17
26
 
18
- export const ProjectProvider = ({
19
- projectName,
27
+ export function ProjectProvider({
20
28
  children,
21
- }: ProjectProviderProps) => {
29
+ projectName,
30
+ }: ProjectProviderProps) {
22
31
  return (
23
32
  <ProjectContext.Provider value={{ projectName }}>
24
33
  {children}
25
34
  </ProjectContext.Provider>
26
35
  );
27
- };
28
-
29
- export function useProject() {
30
- const context = useContext(ProjectContext);
31
- if (!context) {
32
- throw new Error("useProject must be used within a ProjectProvider");
33
- }
34
- return context;
35
36
  }
36
37
 
37
38
  interface ProjectProps {
@@ -40,12 +41,7 @@ interface ProjectProps {
40
41
 
41
42
  export default function Project({ navigate }: ProjectProps) {
42
43
  return (
43
- <Grid
44
- container
45
- spacing={2}
46
- columns={12}
47
- sx={{ mb: (theme) => theme.spacing(2) }}
48
- >
44
+ <Grid container spacing={2} columns={12}>
49
45
  <Grid size={{ xs: 12, md: 12 }}>
50
46
  <Packages navigate={navigate} />
51
47
  </Grid>
@@ -79,7 +79,7 @@ export default function ResultContainer({
79
79
  if (!result) {
80
80
  return null;
81
81
  }
82
- const loading = <Loading text="Loading..." centered={false} size={32} />;
82
+ const loading = <Loading text="Loading..." centered={true} size={32} />;
83
83
  const renderedHeight = isFillElement
84
84
  ? isExpanded
85
85
  ? maxHeight - 40
@@ -87,9 +87,9 @@ export default function ResultContainer({
87
87
  : undefined;
88
88
  const height = explicitHeight
89
89
  ? {
90
- minHeight: `${explicitHeight}px`,
91
- height: `100%`,
92
- }
90
+ minHeight: `${explicitHeight}px`,
91
+ height: `100%`,
92
+ }
93
93
  : { height: `100%` };
94
94
  return (
95
95
  <>
@@ -1,4 +1,4 @@
1
- import { styled, Card, CardContent, CardMedia } from "@mui/material";
1
+ import { Card, CardContent, CardMedia, styled } from "@mui/material";
2
2
 
3
3
  export const StyledCard = styled(Card)({
4
4
  display: "flex",
@@ -9,15 +9,12 @@ export const StyledCard = styled(Card)({
9
9
  export const StyledCardContent = styled(CardContent)({
10
10
  display: "flex",
11
11
  flexDirection: "column",
12
- padding: "0px 4px 4px 4px",
12
+ padding: "10px",
13
13
  flexGrow: 1,
14
- "&:last-child": {
15
- paddingBottom: 0,
16
- },
17
14
  });
18
15
 
19
16
  export const StyledCardMedia = styled(CardMedia)({
20
- padding: "0px 4px 0px 4px",
17
+ padding: "10px",
21
18
  });
22
19
 
23
20
  export const StyledExplorerPage = styled("div")({
@@ -30,7 +27,7 @@ export const StyledExplorerBanner = styled("div")({
30
27
  height: "30px",
31
28
  backgroundColor: "rgba(225, 240, 255, 1)",
32
29
  display: "flex",
33
- padding: "2px 10px",
30
+ padding: "4px",
34
31
  alignItems: "center",
35
32
  });
36
33