@malloy-publisher/app 0.0.53 → 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.
package/dist/index.es.js CHANGED
@@ -8,13 +8,13 @@ import React__default, { createContext, useContext, lazy, Suspense, useEffect, u
8
8
  import { unstable_createGetCssVar, createSpacing as createSpacing$1, useTheme as useTheme$3, unstable_memoTheme, ThemeProvider as ThemeProvider$1, unstable_createCssVarsProvider, Box as Box$1, Stack as Stack$2, createStack, keyframes, shouldForwardProp as shouldForwardProp$1, alpha as alpha$1, createContainer, css } from "@mui/system";
9
9
  import emStyled from "@emotion/styled";
10
10
  import { ThemeContext } from "@emotion/react";
11
- import { styled as styled$2, Card, CardContent, CardMedia, Typography as Typography$1, Box, CircularProgress as CircularProgress$1, Stack as Stack$1, CardActions, Tooltip, IconButton as IconButton$1, Collapse as Collapse$1, Divider, Button, Tabs, Tab, List, ListItem, ListItemText, Table, TableBody, TableRow, TableCell, TableHead, Dialog, DialogTitle, DialogContent, TableContainer, Paper, Grid, DialogActions, FormControl, Chip, Menu, MenuItem, DialogContentText, AppBar, Toolbar, ListItemIcon, TextField, CssBaseline } from "@mui/material";
11
+ import { styled as styled$2, Card, CardContent, CardMedia, Typography as Typography$1, Box, CircularProgress as CircularProgress$1, Stack as Stack$1, CardActions, Tooltip, IconButton as IconButton$1, Collapse as Collapse$1, Divider, Button, Tabs, Tab, List, ListItem, ListItemText, Table, TableBody, TableRow, TableCell, TableHead, Dialog, DialogTitle, DialogContent, TableContainer, Paper, Grid, DialogActions, FormControl, Chip, Menu, MenuItem, DialogContentText, ListItemIcon, TextField, AppBar, Toolbar, CssBaseline } from "@mui/material";
12
12
  import globalAxios from "axios";
13
13
  import { QueryClient, useQuery, useMutation } from "@tanstack/react-query";
14
14
  import * as QueryBuilder from "@malloydata/malloy-query-builder";
15
15
  import { MalloyExplorerProvider, ResizableCollapsiblePanel, SourcePanel, QueryPanel, ResultPanel } from "@malloydata/malloy-explorer";
16
16
  import Markdown from "markdown-to-jsx";
17
- import { ExpandLess, ExpandMore, Speed, Security, ChevronRight, Add, Launch } from "@mui/icons-material";
17
+ import { ExpandLess, ExpandMore, Add, Launch, ChevronRight } from "@mui/icons-material";
18
18
  import { animated, useSpring } from "@react-spring/web";
19
19
  import * as ReactDOM from "react-dom";
20
20
  import ReactDOM__default from "react-dom";
@@ -32151,6 +32151,62 @@ function ExportMalloyButton({
32151
32151
  };
32152
32152
  return /* @__PURE__ */ jsx(Button, { color: "primary", onClick: handleExport, size: "small", children: copied ? "Copied!" : "Export" });
32153
32153
  }
32154
+ function MutableNotebookList({
32155
+ onNotebookClick
32156
+ }) {
32157
+ const { notebookStorage, userContext } = useNotebookStorage();
32158
+ const [notebooks, setNotebooks] = React__default.useState([]);
32159
+ React__default.useEffect(() => {
32160
+ if (notebookStorage && userContext) {
32161
+ setNotebooks(notebookStorage.listNotebooks(userContext));
32162
+ }
32163
+ }, [notebookStorage, userContext]);
32164
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
32165
+ /* @__PURE__ */ jsx(Divider, {}),
32166
+ /* @__PURE__ */ jsx(
32167
+ Box,
32168
+ {
32169
+ sx: {
32170
+ maxHeight: "300px",
32171
+ overflow: "auto",
32172
+ "&::-webkit-scrollbar": {
32173
+ width: "8px"
32174
+ },
32175
+ "&::-webkit-scrollbar-track": {
32176
+ background: "transparent"
32177
+ },
32178
+ "&::-webkit-scrollbar-thumb": {
32179
+ background: "rgba(0,0,0,0.2)",
32180
+ borderRadius: "4px"
32181
+ }
32182
+ },
32183
+ children: /* @__PURE__ */ jsxs(List, { dense: true, children: [
32184
+ notebooks.length === 0 && /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(
32185
+ ListItemText,
32186
+ {
32187
+ primary: "No notebooks found.",
32188
+ sx: { textAlign: "center" }
32189
+ }
32190
+ ) }),
32191
+ notebooks.map((notebook) => /* @__PURE__ */ jsx(
32192
+ ListItem,
32193
+ {
32194
+ onClick: (event) => onNotebookClick(notebook, event),
32195
+ sx: {
32196
+ cursor: "pointer",
32197
+ "&:hover": {
32198
+ backgroundColor: "action.hover"
32199
+ }
32200
+ },
32201
+ children: /* @__PURE__ */ jsx(ListItemText, { primary: notebook })
32202
+ },
32203
+ notebook
32204
+ ))
32205
+ ] })
32206
+ }
32207
+ )
32208
+ ] });
32209
+ }
32154
32210
  const projectsApi$1 = new ProjectsApi(new Configuration());
32155
32211
  function About() {
32156
32212
  const { projectName } = useProject();
@@ -32292,211 +32348,196 @@ function Home({ navigate }) {
32292
32348
  return /* @__PURE__ */ jsx(Loading, { text: "Loading projects..." });
32293
32349
  }
32294
32350
  }
32295
- new ConnectionsApi(new Configuration());
32296
- globalAxios.defaults.baseURL = "IfYouAreSeeingThis_baseURL_IsNotSet";
32297
- function HomePage() {
32351
+ function AnalyzePackageButton({
32352
+ projectName,
32353
+ packageName
32354
+ }) {
32355
+ const [workbookName, setWorkbookName] = React__default.useState("");
32356
+ const [anchorEl, setAnchorEl] = React__default.useState(null);
32357
+ const [newDialogOpen, setNewDialogOpen] = React__default.useState(false);
32358
+ const [openDialogOpen, setOpenDialogOpen] = React__default.useState(false);
32298
32359
  const navigate = useRouterClickHandler();
32299
- return /* @__PURE__ */ jsxs(Box, { sx: { minHeight: "100%" }, children: [
32360
+ const open = Boolean(anchorEl);
32361
+ const handleClick = (event) => {
32362
+ setAnchorEl(event.currentTarget);
32363
+ };
32364
+ const handleMenuClose = () => {
32365
+ setAnchorEl(null);
32366
+ };
32367
+ const handleOpenDialogClose = () => {
32368
+ setOpenDialogOpen(false);
32369
+ };
32370
+ const handleNewDialogClose = () => {
32371
+ setNewDialogOpen(false);
32372
+ };
32373
+ const handleNotebookClick = (notebook, event) => {
32374
+ setOpenDialogOpen(false);
32375
+ navigate(
32376
+ `/${projectName}/${packageName}/scratchNotebook/${encodeURIComponent(notebook)}`,
32377
+ event
32378
+ );
32379
+ };
32380
+ const createNotebookClick = (event) => {
32381
+ setNewDialogOpen(false);
32382
+ navigate(
32383
+ `/${projectName}/${packageName}/scratchNotebook/${encodeURIComponent(workbookName)}`,
32384
+ event
32385
+ );
32386
+ setWorkbookName("");
32387
+ };
32388
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
32300
32389
  /* @__PURE__ */ jsx(
32301
- Card,
32390
+ Button,
32302
32391
  {
32303
- variant: "outlined",
32392
+ "aria-controls": open ? "basic-menu" : void 0,
32393
+ "aria-haspopup": "true",
32394
+ "aria-expanded": open ? "true" : void 0,
32395
+ onClick: handleClick,
32396
+ variant: "contained",
32304
32397
  sx: {
32305
- background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
32306
- color: "white",
32307
- mb: 1,
32308
- p: 1
32398
+ height: "40px",
32399
+ px: 2,
32400
+ backgroundColor: "#fbbb04",
32401
+ "&:hover": {
32402
+ backgroundColor: "#eab308"
32403
+ }
32309
32404
  },
32310
- children: /* @__PURE__ */ jsxs(Stack$1, { spacing: 0.5, alignItems: "center", textAlign: "center", children: [
32311
- /* @__PURE__ */ jsx(
32312
- Typography$1,
32405
+ children: "Analyze Package"
32406
+ }
32407
+ ),
32408
+ /* @__PURE__ */ jsxs(
32409
+ Menu,
32410
+ {
32411
+ id: "basic-menu",
32412
+ anchorEl,
32413
+ open,
32414
+ onClose: handleMenuClose,
32415
+ MenuListProps: {
32416
+ "aria-labelledby": "basic-button",
32417
+ sx: { py: 0.5 }
32418
+ },
32419
+ children: [
32420
+ /* @__PURE__ */ jsxs(
32421
+ MenuItem,
32313
32422
  {
32314
- variant: "h5",
32315
- sx: {
32316
- fontWeight: 700,
32317
- letterSpacing: "-0.025em",
32318
- mb: 0.25
32423
+ onClick: () => {
32424
+ setNewDialogOpen(true);
32425
+ handleMenuClose();
32319
32426
  },
32320
- children: "Welcome to Malloy Publisher"
32427
+ sx: { py: 1, px: 2 },
32428
+ children: [
32429
+ /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Add, { fontSize: "small" }) }),
32430
+ /* @__PURE__ */ jsxs(ListItemText, { children: [
32431
+ /* @__PURE__ */ jsx(Typography$1, { variant: "body2", fontWeight: 500, children: "New Workbook" }),
32432
+ /* @__PURE__ */ jsx(Typography$1, { variant: "caption", color: "text.secondary", children: "Create a new analysis workbook" })
32433
+ ] })
32434
+ ]
32321
32435
  }
32322
32436
  ),
32323
- /* @__PURE__ */ jsx(
32324
- Typography$1,
32437
+ /* @__PURE__ */ jsxs(
32438
+ MenuItem,
32325
32439
  {
32326
- variant: "body1",
32327
- sx: {
32328
- opacity: 0.9,
32329
- maxWidth: "600px",
32330
- lineHeight: 1.4
32440
+ onClick: () => {
32441
+ setOpenDialogOpen(true);
32442
+ handleMenuClose();
32331
32443
  },
32332
- children: "Discover, analyze, and share your data with powerful Malloy models"
32444
+ sx: { py: 1, px: 2 },
32445
+ children: [
32446
+ /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Launch, { fontSize: "small" }) }),
32447
+ /* @__PURE__ */ jsxs(ListItemText, { children: [
32448
+ /* @__PURE__ */ jsx(Typography$1, { variant: "body2", fontWeight: 500, children: "Open Workbook" }),
32449
+ /* @__PURE__ */ jsx(Typography$1, { variant: "caption", color: "text.secondary", children: "Open an existing workbook" })
32450
+ ] })
32451
+ ]
32333
32452
  }
32334
32453
  )
32335
- ] })
32454
+ ]
32336
32455
  }
32337
32456
  ),
32338
32457
  /* @__PURE__ */ jsxs(
32339
- Stack$1,
32458
+ Dialog,
32340
32459
  {
32341
- direction: { xs: "column", md: "row" },
32342
- spacing: 1,
32343
- sx: { mb: 1 },
32460
+ open: newDialogOpen,
32461
+ onClose: handleNewDialogClose,
32462
+ maxWidth: "sm",
32463
+ fullWidth: true,
32344
32464
  children: [
32345
- /* @__PURE__ */ jsx(
32346
- Card,
32347
- {
32348
- variant: "outlined",
32349
- sx: {
32350
- flex: 1,
32351
- p: 1,
32352
- transition: "all 0.2s ease-in-out",
32353
- "&:hover": {
32354
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
32355
- transform: "translateY(-2px)"
32465
+ /* @__PURE__ */ jsxs(DialogTitle, { sx: { pb: 1, pt: 2, px: 2 }, children: [
32466
+ /* @__PURE__ */ jsx(Typography$1, { variant: "h6", fontWeight: 600, sx: { mb: 0.5 }, children: "Create New Workbook" }),
32467
+ /* @__PURE__ */ jsx(Typography$1, { variant: "body2", color: "text.secondary", children: "Start a new analysis workbook to explore your data" })
32468
+ ] }),
32469
+ /* @__PURE__ */ jsx(DialogContent, { sx: { px: 2, pb: 2 }, children: /* @__PURE__ */ jsxs(Stack$1, { spacing: 2, sx: { mt: 1 }, children: [
32470
+ /* @__PURE__ */ jsx(FormControl, { fullWidth: true, children: /* @__PURE__ */ jsx(
32471
+ TextField,
32472
+ {
32473
+ label: "Workbook Name",
32474
+ value: workbookName,
32475
+ onChange: (e) => setWorkbookName(e.target.value),
32476
+ placeholder: "Enter workbook name...",
32477
+ fullWidth: true,
32478
+ autoFocus: true,
32479
+ size: "small"
32480
+ }
32481
+ ) }),
32482
+ /* @__PURE__ */ jsxs(Stack$1, { direction: "row", spacing: 1, justifyContent: "flex-end", children: [
32483
+ /* @__PURE__ */ jsx(
32484
+ Button,
32485
+ {
32486
+ onClick: handleNewDialogClose,
32487
+ variant: "outlined",
32488
+ size: "small",
32489
+ children: "Cancel"
32356
32490
  }
32357
- },
32358
- children: /* @__PURE__ */ jsxs(Stack$1, { spacing: 0.5, children: [
32359
- /* @__PURE__ */ jsx(
32360
- Typography$1,
32361
- {
32362
- variant: "subtitle1",
32363
- fontWeight: 600,
32364
- sx: { mb: 0.25 },
32365
- children: "Data Discovery"
32366
- }
32367
- ),
32368
- /* @__PURE__ */ jsx(
32369
- Typography$1,
32370
- {
32371
- variant: "body2",
32372
- color: "text.secondary",
32373
- sx: { lineHeight: 1.4 },
32374
- children: "Explore your data with interactive Malloy models and queries"
32375
- }
32376
- )
32377
- ] })
32378
- }
32379
- ),
32380
- /* @__PURE__ */ jsx(
32381
- Card,
32382
- {
32383
- variant: "outlined",
32384
- sx: {
32385
- flex: 1,
32386
- p: 1,
32387
- transition: "all 0.2s ease-in-out",
32388
- "&:hover": {
32389
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
32390
- transform: "translateY(-2px)"
32491
+ ),
32492
+ /* @__PURE__ */ jsx(
32493
+ Button,
32494
+ {
32495
+ onClick: (event) => createNotebookClick(event),
32496
+ variant: "contained",
32497
+ disabled: !workbookName.trim(),
32498
+ size: "small",
32499
+ children: "Create Workbook"
32391
32500
  }
32392
- },
32393
- children: /* @__PURE__ */ jsxs(Stack$1, { spacing: 0.5, children: [
32394
- /* @__PURE__ */ jsx(
32395
- Typography$1,
32396
- {
32397
- variant: "subtitle1",
32398
- fontWeight: 600,
32399
- sx: { mb: 0.25 },
32400
- children: "Analysis Tools"
32401
- }
32402
- ),
32403
- /* @__PURE__ */ jsx(
32404
- Typography$1,
32405
- {
32406
- variant: "body2",
32407
- color: "text.secondary",
32408
- sx: { lineHeight: 1.4 },
32409
- children: "Create and share interactive workbooks for data analysis"
32410
- }
32411
- )
32412
- ] })
32413
- }
32414
- ),
32415
- /* @__PURE__ */ jsx(
32416
- Card,
32501
+ )
32502
+ ] })
32503
+ ] }) })
32504
+ ]
32505
+ }
32506
+ ),
32507
+ /* @__PURE__ */ jsxs(
32508
+ Dialog,
32509
+ {
32510
+ open: openDialogOpen,
32511
+ onClose: handleOpenDialogClose,
32512
+ maxWidth: "md",
32513
+ fullWidth: true,
32514
+ children: [
32515
+ /* @__PURE__ */ jsxs(DialogTitle, { sx: { pb: 1, pt: 2, px: 2 }, children: [
32516
+ /* @__PURE__ */ jsx(Typography$1, { variant: "h6", fontWeight: 600, sx: { mb: 0.5 }, children: "Open Workbook" }),
32517
+ /* @__PURE__ */ jsx(Typography$1, { variant: "body2", color: "text.secondary", children: "Select an existing workbook to continue your analysis" })
32518
+ ] }),
32519
+ /* @__PURE__ */ jsx(DialogContent, { sx: { px: 2, pb: 2 }, children: /* @__PURE__ */ jsx(
32520
+ NotebookStorageProvider,
32417
32521
  {
32418
- variant: "outlined",
32419
- sx: {
32420
- flex: 1,
32421
- p: 1,
32422
- transition: "all 0.2s ease-in-out",
32423
- "&:hover": {
32424
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
32425
- transform: "translateY(-2px)"
32426
- }
32522
+ notebookStorage: new BrowserNotebookStorage(),
32523
+ userContext: {
32524
+ project: projectName,
32525
+ package: packageName
32427
32526
  },
32428
- children: /* @__PURE__ */ jsxs(Stack$1, { spacing: 0.5, children: [
32429
- /* @__PURE__ */ jsx(
32430
- Typography$1,
32431
- {
32432
- variant: "subtitle1",
32433
- fontWeight: 600,
32434
- sx: { mb: 0.25 },
32435
- children: "Collaboration"
32436
- }
32437
- ),
32438
- /* @__PURE__ */ jsx(
32439
- Typography$1,
32440
- {
32441
- variant: "body2",
32442
- color: "text.secondary",
32443
- sx: { lineHeight: 1.4 },
32444
- children: "Share insights and collaborate with your team on data projects"
32445
- }
32446
- )
32447
- ] })
32527
+ children: /* @__PURE__ */ jsx(MutableNotebookList, { onNotebookClick: handleNotebookClick })
32448
32528
  }
32449
- )
32529
+ ) })
32450
32530
  ]
32451
32531
  }
32452
- ),
32453
- /* @__PURE__ */ jsxs(Stack$1, { direction: { xs: "column", md: "row" }, spacing: 1, children: [
32454
- /* @__PURE__ */ jsx(Card, { sx: { flex: 1, p: 1 }, children: /* @__PURE__ */ jsx(CardContent, { sx: { p: 0 }, children: /* @__PURE__ */ jsxs(Stack$1, { spacing: 0.5, children: [
32455
- /* @__PURE__ */ jsxs(
32456
- Box,
32457
- {
32458
- sx: { display: "flex", alignItems: "center", gap: 1 },
32459
- children: [
32460
- /* @__PURE__ */ jsx(Speed, { sx: { color: "warning.main", fontSize: 28 } }),
32461
- /* @__PURE__ */ jsx(Typography$1, { variant: "subtitle1", fontWeight: 600, children: "High Performance" })
32462
- ]
32463
- }
32464
- ),
32465
- /* @__PURE__ */ jsx(
32466
- Typography$1,
32467
- {
32468
- variant: "body2",
32469
- color: "text.secondary",
32470
- sx: { lineHeight: 1.4 },
32471
- children: "Optimized query execution and intelligent caching ensure fast performance even with large datasets and complex analytical queries."
32472
- }
32473
- )
32474
- ] }) }) }),
32475
- /* @__PURE__ */ jsx(Card, { sx: { flex: 1, p: 1 }, children: /* @__PURE__ */ jsx(CardContent, { sx: { p: 0 }, children: /* @__PURE__ */ jsxs(Stack$1, { spacing: 0.5, children: [
32476
- /* @__PURE__ */ jsxs(
32477
- Box,
32478
- {
32479
- sx: { display: "flex", alignItems: "center", gap: 1 },
32480
- children: [
32481
- /* @__PURE__ */ jsx(Security, { sx: { color: "info.main", fontSize: 28 } }),
32482
- /* @__PURE__ */ jsx(Typography$1, { variant: "subtitle1", fontWeight: 600, children: "Enterprise Ready" })
32483
- ]
32484
- }
32485
- ),
32486
- /* @__PURE__ */ jsx(
32487
- Typography$1,
32488
- {
32489
- variant: "body2",
32490
- color: "text.secondary",
32491
- sx: { lineHeight: 1.4 },
32492
- children: "Built with enterprise security and scalability in mind. Supports authentication, authorization, and comprehensive audit logging."
32493
- }
32494
- )
32495
- ] }) }) })
32496
- ] }),
32497
- /* @__PURE__ */ jsx(Box, { sx: { display: "none" }, children: /* @__PURE__ */ jsx(Home, { navigate }) })
32532
+ )
32498
32533
  ] });
32499
32534
  }
32535
+ new ConnectionsApi(new Configuration());
32536
+ globalAxios.defaults.baseURL = "IfYouAreSeeingThis_baseURL_IsNotSet";
32537
+ function HomePage() {
32538
+ const navigate = useRouterClickHandler();
32539
+ return /* @__PURE__ */ jsx(Home, { navigate });
32540
+ }
32500
32541
  const Container = createContainer({
32501
32542
  createStyledComponent: styled("div", {
32502
32543
  name: "MuiContainer",
@@ -33255,103 +33296,14 @@ function BreadcrumbNav() {
33255
33296
  }
33256
33297
  ) });
33257
33298
  }
33258
- function SimpleNotebookList({
33259
- onNotebookClick
33260
- }) {
33261
- const { notebookStorage, userContext } = useNotebookStorage();
33262
- const [notebooks, setNotebooks] = React__default.useState([]);
33263
- React__default.useEffect(() => {
33264
- if (notebookStorage && userContext) {
33265
- setNotebooks(notebookStorage.listNotebooks(userContext));
33266
- }
33267
- }, [notebookStorage, userContext]);
33268
- return /* @__PURE__ */ jsxs(Fragment, { children: [
33269
- /* @__PURE__ */ jsx(Divider, {}),
33270
- /* @__PURE__ */ jsx(
33271
- Box,
33272
- {
33273
- sx: {
33274
- maxHeight: "300px",
33275
- overflow: "auto",
33276
- "&::-webkit-scrollbar": {
33277
- width: "8px"
33278
- },
33279
- "&::-webkit-scrollbar-track": {
33280
- background: "transparent"
33281
- },
33282
- "&::-webkit-scrollbar-thumb": {
33283
- background: "rgba(0,0,0,0.2)",
33284
- borderRadius: "4px"
33285
- }
33286
- },
33287
- children: /* @__PURE__ */ jsxs(List, { dense: true, children: [
33288
- notebooks.length === 0 && /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(
33289
- ListItemText,
33290
- {
33291
- primary: "No notebooks found.",
33292
- sx: { textAlign: "center" }
33293
- }
33294
- ) }),
33295
- notebooks.map((notebook) => /* @__PURE__ */ jsx(
33296
- ListItem,
33297
- {
33298
- onClick: (event) => onNotebookClick(notebook, event),
33299
- sx: {
33300
- cursor: "pointer",
33301
- "&:hover": {
33302
- backgroundColor: "action.hover"
33303
- }
33304
- },
33305
- children: /* @__PURE__ */ jsx(ListItemText, { primary: notebook })
33306
- },
33307
- notebook
33308
- ))
33309
- ] })
33310
- }
33311
- )
33312
- ] });
33313
- }
33314
- function MainPage() {
33299
+ function MainPage({ showHeader = true }) {
33315
33300
  const { projectName, packageName } = useParams();
33316
- const navigate = useRouterClickHandler();
33317
- const [workbookName, setWorkbookName] = React__default.useState("");
33318
- const [anchorEl, setAnchorEl] = React__default.useState(null);
33319
- const [newDialogOpen, setNewDialogOpen] = React__default.useState(false);
33320
- const [openDialogOpen, setOpenDialogOpen] = React__default.useState(false);
33321
- const open = Boolean(anchorEl);
33322
- const handleClick = (event) => {
33323
- setAnchorEl(event.currentTarget);
33324
- };
33325
- const handleMenuClose = () => {
33326
- setAnchorEl(null);
33327
- };
33328
- const handleOpenDialogClose = () => {
33329
- setOpenDialogOpen(false);
33330
- };
33331
- const handleNewDialogClose = () => {
33332
- setNewDialogOpen(false);
33333
- };
33334
- const handleNotebookClick = (notebook, event) => {
33335
- setOpenDialogOpen(false);
33336
- navigate(
33337
- `/${projectName}/${packageName}/scratchNotebook/${encodeURIComponent(notebook)}`,
33338
- event
33339
- );
33340
- };
33341
- const createNotebookClick = (event) => {
33342
- setNewDialogOpen(false);
33343
- navigate(
33344
- `/${projectName}/${packageName}/scratchNotebook/${encodeURIComponent(workbookName)}`,
33345
- event
33346
- );
33347
- setWorkbookName("");
33348
- };
33349
33301
  return /* @__PURE__ */ jsxs(
33350
33302
  Box,
33351
33303
  {
33352
33304
  sx: { display: "flex", flexDirection: "column", minHeight: "100vh" },
33353
33305
  children: [
33354
- /* @__PURE__ */ jsx(
33306
+ showHeader && /* @__PURE__ */ jsx(
33355
33307
  AppBar,
33356
33308
  {
33357
33309
  position: "sticky",
@@ -33363,32 +33315,38 @@ function MainPage() {
33363
33315
  },
33364
33316
  children: /* @__PURE__ */ jsxs(Toolbar, { sx: { justifyContent: "space-between" }, children: [
33365
33317
  /* @__PURE__ */ jsxs(Stack$1, { direction: "row", spacing: 2, alignItems: "center", children: [
33366
- /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
33367
- /* @__PURE__ */ jsx(
33368
- Box,
33369
- {
33370
- component: "img",
33371
- src: "/logo.svg",
33372
- alt: "Malloy",
33373
- sx: {
33374
- width: 28,
33375
- height: 28
33376
- }
33377
- }
33378
- ),
33379
- /* @__PURE__ */ jsx(
33380
- Typography$1,
33381
- {
33382
- variant: "h5",
33383
- sx: {
33384
- color: "text.primary",
33385
- fontWeight: 700,
33386
- letterSpacing: "-0.025em"
33387
- },
33388
- children: "Malloy Publisher"
33389
- }
33390
- )
33391
- ] }),
33318
+ /* @__PURE__ */ jsxs(
33319
+ Box,
33320
+ {
33321
+ sx: { display: "flex", alignItems: "center", gap: 1 },
33322
+ children: [
33323
+ /* @__PURE__ */ jsx(
33324
+ Box,
33325
+ {
33326
+ component: "img",
33327
+ src: "/logo.svg",
33328
+ alt: "Malloy",
33329
+ sx: {
33330
+ width: 28,
33331
+ height: 28
33332
+ }
33333
+ }
33334
+ ),
33335
+ /* @__PURE__ */ jsx(
33336
+ Typography$1,
33337
+ {
33338
+ variant: "h5",
33339
+ sx: {
33340
+ color: "text.primary",
33341
+ fontWeight: 700,
33342
+ letterSpacing: "-0.025em"
33343
+ },
33344
+ children: "Malloy Publisher"
33345
+ }
33346
+ )
33347
+ ]
33348
+ }
33349
+ ),
33392
33350
  /* @__PURE__ */ jsx(BreadcrumbNav, {})
33393
33351
  ] }),
33394
33352
  /* @__PURE__ */ jsx(Stack$1, { direction: "row", spacing: 2, alignItems: "center", children: !projectName || !packageName ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -33409,90 +33367,13 @@ function MainPage() {
33409
33367
  }
33410
33368
  ),
33411
33369
  /* @__PURE__ */ jsx(Button, { href: "/api-doc.html", size: "small", children: "Publisher API" })
33412
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
33413
- /* @__PURE__ */ jsx(
33414
- Button,
33415
- {
33416
- "aria-controls": open ? "basic-menu" : void 0,
33417
- "aria-haspopup": "true",
33418
- "aria-expanded": open ? "true" : void 0,
33419
- onClick: handleClick,
33420
- variant: "contained",
33421
- sx: {
33422
- height: "40px",
33423
- px: 2,
33424
- backgroundColor: "#fbbb04",
33425
- "&:hover": {
33426
- backgroundColor: "#eab308"
33427
- }
33428
- },
33429
- children: "Analyze Package"
33430
- }
33431
- ),
33432
- /* @__PURE__ */ jsxs(
33433
- Menu,
33434
- {
33435
- id: "basic-menu",
33436
- anchorEl,
33437
- open,
33438
- onClose: handleMenuClose,
33439
- MenuListProps: {
33440
- "aria-labelledby": "basic-button",
33441
- sx: { py: 0.5 }
33442
- },
33443
- children: [
33444
- /* @__PURE__ */ jsxs(
33445
- MenuItem,
33446
- {
33447
- onClick: () => {
33448
- setNewDialogOpen(true);
33449
- handleMenuClose();
33450
- },
33451
- sx: { py: 1, px: 2 },
33452
- children: [
33453
- /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Add, { fontSize: "small" }) }),
33454
- /* @__PURE__ */ jsxs(ListItemText, { children: [
33455
- /* @__PURE__ */ jsx(Typography$1, { variant: "body2", fontWeight: 500, children: "New Workbook" }),
33456
- /* @__PURE__ */ jsx(
33457
- Typography$1,
33458
- {
33459
- variant: "caption",
33460
- color: "text.secondary",
33461
- children: "Create a new analysis workbook"
33462
- }
33463
- )
33464
- ] })
33465
- ]
33466
- }
33467
- ),
33468
- /* @__PURE__ */ jsxs(
33469
- MenuItem,
33470
- {
33471
- onClick: () => {
33472
- setOpenDialogOpen(true);
33473
- handleMenuClose();
33474
- },
33475
- sx: { py: 1, px: 2 },
33476
- children: [
33477
- /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Launch, { fontSize: "small" }) }),
33478
- /* @__PURE__ */ jsxs(ListItemText, { children: [
33479
- /* @__PURE__ */ jsx(Typography$1, { variant: "body2", fontWeight: 500, children: "Open Workbook" }),
33480
- /* @__PURE__ */ jsx(
33481
- Typography$1,
33482
- {
33483
- variant: "caption",
33484
- color: "text.secondary",
33485
- children: "Open an existing workbook"
33486
- }
33487
- )
33488
- ] })
33489
- ]
33490
- }
33491
- )
33492
- ]
33493
- }
33494
- )
33495
- ] }) })
33370
+ ] }) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
33371
+ AnalyzePackageButton,
33372
+ {
33373
+ projectName,
33374
+ packageName
33375
+ }
33376
+ ) }) })
33496
33377
  ] })
33497
33378
  }
33498
33379
  ),
@@ -33510,82 +33391,6 @@ function MainPage() {
33510
33391
  },
33511
33392
  children: /* @__PURE__ */ jsx(Box, { sx: { flex: 1 }, children: /* @__PURE__ */ jsx(Outlet, {}) })
33512
33393
  }
33513
- ),
33514
- /* @__PURE__ */ jsxs(
33515
- Dialog,
33516
- {
33517
- open: newDialogOpen,
33518
- onClose: handleNewDialogClose,
33519
- maxWidth: "sm",
33520
- fullWidth: true,
33521
- children: [
33522
- /* @__PURE__ */ jsxs(DialogTitle, { sx: { pb: 1, pt: 2, px: 2 }, children: [
33523
- /* @__PURE__ */ jsx(Typography$1, { variant: "h6", fontWeight: 600, sx: { mb: 0.5 }, children: "Create New Workbook" }),
33524
- /* @__PURE__ */ jsx(Typography$1, { variant: "body2", color: "text.secondary", children: "Start a new analysis workbook to explore your data" })
33525
- ] }),
33526
- /* @__PURE__ */ jsx(DialogContent, { sx: { px: 2, pb: 2 }, children: /* @__PURE__ */ jsxs(Stack$1, { spacing: 2, sx: { mt: 1 }, children: [
33527
- /* @__PURE__ */ jsx(FormControl, { fullWidth: true, children: /* @__PURE__ */ jsx(
33528
- TextField,
33529
- {
33530
- label: "Workbook Name",
33531
- value: workbookName,
33532
- onChange: (e) => setWorkbookName(e.target.value),
33533
- placeholder: "Enter workbook name...",
33534
- fullWidth: true,
33535
- autoFocus: true,
33536
- size: "small"
33537
- }
33538
- ) }),
33539
- /* @__PURE__ */ jsxs(Stack$1, { direction: "row", spacing: 1, justifyContent: "flex-end", children: [
33540
- /* @__PURE__ */ jsx(
33541
- Button,
33542
- {
33543
- onClick: handleNewDialogClose,
33544
- variant: "outlined",
33545
- size: "small",
33546
- children: "Cancel"
33547
- }
33548
- ),
33549
- /* @__PURE__ */ jsx(
33550
- Button,
33551
- {
33552
- onClick: (event) => createNotebookClick(event),
33553
- variant: "contained",
33554
- disabled: !workbookName.trim(),
33555
- size: "small",
33556
- children: "Create Workbook"
33557
- }
33558
- )
33559
- ] })
33560
- ] }) })
33561
- ]
33562
- }
33563
- ),
33564
- /* @__PURE__ */ jsxs(
33565
- Dialog,
33566
- {
33567
- open: openDialogOpen,
33568
- onClose: handleOpenDialogClose,
33569
- maxWidth: "md",
33570
- fullWidth: true,
33571
- children: [
33572
- /* @__PURE__ */ jsxs(DialogTitle, { sx: { pb: 1, pt: 2, px: 2 }, children: [
33573
- /* @__PURE__ */ jsx(Typography$1, { variant: "h6", fontWeight: 600, sx: { mb: 0.5 }, children: "Open Workbook" }),
33574
- /* @__PURE__ */ jsx(Typography$1, { variant: "body2", color: "text.secondary", children: "Select an existing workbook to continue your analysis" })
33575
- ] }),
33576
- /* @__PURE__ */ jsx(DialogContent, { sx: { px: 2, pb: 2 }, children: /* @__PURE__ */ jsx(
33577
- NotebookStorageProvider,
33578
- {
33579
- notebookStorage: new BrowserNotebookStorage(),
33580
- userContext: {
33581
- project: projectName || "",
33582
- package: packageName || ""
33583
- },
33584
- children: /* @__PURE__ */ jsx(SimpleNotebookList, { onNotebookClick: handleNotebookClick })
33585
- }
33586
- ) })
33587
- ]
33588
- }
33589
33394
  )
33590
33395
  ]
33591
33396
  }