@malloy-publisher/sdk 0.0.51 → 0.0.53
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.
- package/dist/components/Model/SourcesExplorer.d.ts +3 -2
- package/dist/components/MutableNotebook/EditableMalloyCell.d.ts +3 -2
- package/dist/components/Project/Project.d.ts +4 -3
- package/dist/index.cjs.js +17 -17
- package/dist/index.es.js +1460 -1480
- package/package.json +1 -1
- package/src/components/Model/ModelCell.tsx +12 -13
- package/src/components/Model/SourcesExplorer.tsx +26 -17
- package/src/components/MutableNotebook/EditableMalloyCell.tsx +8 -3
- package/src/components/MutableNotebook/MutableCell.tsx +19 -5
- package/src/components/MutableNotebook/MutableNotebook.tsx +43 -43
- package/src/components/Notebook/Notebook.tsx +7 -12
- package/src/components/Notebook/NotebookCell.tsx +4 -5
- package/src/components/Package/Config.tsx +24 -18
- package/src/components/Package/Connections.tsx +4 -5
- package/src/components/Package/Databases.tsx +6 -7
- package/src/components/Package/Models.tsx +2 -3
- package/src/components/Package/Notebooks.tsx +2 -3
- package/src/components/Package/Package.tsx +1 -6
- package/src/components/Project/About.tsx +11 -14
- package/src/components/Project/Packages.tsx +50 -57
- package/src/components/Project/Project.tsx +15 -19
- package/src/components/RenderedResult/ResultContainer.tsx +4 -4
- package/src/components/styles.ts +4 -7
|
@@ -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 {
|
|
2
|
-
import { Configuration, ProjectsApi } from "../../client";
|
|
1
|
+
import { Typography } from "@mui/material";
|
|
3
2
|
import Markdown from "markdown-to-jsx";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 {
|
|
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
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
</
|
|
30
|
+
</StyledCard>
|
|
34
31
|
</StyledCard>
|
|
35
32
|
)}
|
|
36
33
|
{isError && (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Box,
|
|
1
|
+
import { Box, Grid, Typography } from "@mui/material";
|
|
2
2
|
import { Configuration, PackagesApi } from "../../client";
|
|
3
|
-
import {
|
|
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 {
|
|
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
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
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
|
|
19
|
-
projectName,
|
|
27
|
+
export function ProjectProvider({
|
|
20
28
|
children,
|
|
21
|
-
|
|
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={
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
minHeight: `${explicitHeight}px`,
|
|
91
|
+
height: `100%`,
|
|
92
|
+
}
|
|
93
93
|
: { height: `100%` };
|
|
94
94
|
return (
|
|
95
95
|
<>
|
package/src/components/styles.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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: "
|
|
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: "
|
|
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: "
|
|
30
|
+
padding: "4px",
|
|
34
31
|
alignItems: "center",
|
|
35
32
|
});
|
|
36
33
|
|