@sqlrooms/notebook 0.29.0-rc.1 → 0.29.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +10 -10
  2. package/dist/Notebook.d.ts +3 -1
  3. package/dist/Notebook.d.ts.map +1 -1
  4. package/dist/Notebook.js +12 -15
  5. package/dist/Notebook.js.map +1 -1
  6. package/dist/NotebookSlice.d.ts.map +1 -1
  7. package/dist/NotebookSlice.js +48 -68
  8. package/dist/NotebookSlice.js.map +1 -1
  9. package/dist/NotebookStateTypes.d.ts +6 -11
  10. package/dist/NotebookStateTypes.d.ts.map +1 -1
  11. package/dist/NotebookStateTypes.js.map +1 -1
  12. package/dist/NotebookUtils.d.ts +5 -5
  13. package/dist/NotebookUtils.d.ts.map +1 -1
  14. package/dist/NotebookUtils.js +11 -10
  15. package/dist/NotebookUtils.js.map +1 -1
  16. package/dist/cellOperations/AddNewCellDropdown.d.ts +2 -1
  17. package/dist/cellOperations/AddNewCellDropdown.d.ts.map +1 -1
  18. package/dist/cellOperations/AddNewCellDropdown.js +7 -8
  19. package/dist/cellOperations/AddNewCellDropdown.js.map +1 -1
  20. package/dist/cellOperations/AddNewCellTabs.d.ts +1 -0
  21. package/dist/cellOperations/AddNewCellTabs.d.ts.map +1 -1
  22. package/dist/cellOperations/AddNewCellTabs.js +2 -3
  23. package/dist/cellOperations/AddNewCellTabs.js.map +1 -1
  24. package/dist/cellOperations/MoveCellButtons.d.ts +1 -0
  25. package/dist/cellOperations/MoveCellButtons.d.ts.map +1 -1
  26. package/dist/cellOperations/MoveCellButtons.js +3 -4
  27. package/dist/cellOperations/MoveCellButtons.js.map +1 -1
  28. package/dist/cellSchemas.d.ts +49 -12
  29. package/dist/cellSchemas.d.ts.map +1 -1
  30. package/dist/cellSchemas.js +17 -10
  31. package/dist/cellSchemas.js.map +1 -1
  32. package/dist/cells/CellContainer.d.ts +4 -2
  33. package/dist/cells/CellContainer.d.ts.map +1 -1
  34. package/dist/cells/CellContainer.js +19 -8
  35. package/dist/cells/CellContainer.js.map +1 -1
  36. package/dist/cells/CellView.d.ts.map +1 -1
  37. package/dist/cells/CellView.js +1 -1
  38. package/dist/cells/CellView.js.map +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +1 -1
  42. package/dist/index.js.map +1 -1
  43. package/package.json +9 -9
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  type Props = {
3
+ artifactId: string;
3
4
  onAdd: (type: string) => void;
4
5
  enableShortcut?: boolean;
5
6
  triggerComponent?: React.ReactNode;
@@ -7,7 +8,7 @@ type Props = {
7
8
  export declare const AddNewCellDropdown: FC<Props>;
8
9
  type ContentProps = {
9
10
  onAddCell: (type: string) => void;
10
- currentTabId?: string | null;
11
+ artifactId?: string | null;
11
12
  align?: 'center' | 'start' | 'end';
12
13
  setOpen?: (open: boolean) => void;
13
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AddNewCellDropdown.d.ts","sourceRoot":"","sources":["../../src/cellOperations/AddNewCellDropdown.tsx"],"names":[],"mappings":"AASA,OAAO,EAAC,EAAE,EAAsB,MAAM,OAAO,CAAC;AAM9C,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,KAAK,CAoCxC,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,YAAY,CAwCtD,CAAC"}
1
+ {"version":3,"file":"AddNewCellDropdown.d.ts","sourceRoot":"","sources":["../../src/cellOperations/AddNewCellDropdown.tsx"],"names":[],"mappings":"AASA,OAAO,EAAC,EAAE,EAAsB,MAAM,OAAO,CAAC;AAM9C,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,KAAK,CAkCxC,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,YAAY,CAwCtD,CAAC"}
@@ -4,11 +4,10 @@ import { useEffect, useState } from 'react';
4
4
  import { useStoreWithNotebook } from '../useStoreWithNotebook';
5
5
  import { TriggerButton } from './AddNewCellTrigger';
6
6
  import { getCellTypeLabel } from '../NotebookUtils';
7
- export const AddNewCellDropdown = ({ onAdd, enableShortcut = false, triggerComponent = _jsx(TriggerButton, {}), }) => {
8
- const currentTabId = useStoreWithNotebook((s) => s.cells.config.currentSheetId);
7
+ export const AddNewCellDropdown = ({ artifactId, onAdd, enableShortcut = false, triggerComponent = _jsx(TriggerButton, {}), }) => {
9
8
  const [open, setOpen] = useState(false);
10
9
  useEffect(() => {
11
- if (!currentTabId || !enableShortcut) {
10
+ if (!artifactId || !enableShortcut) {
12
11
  return;
13
12
  }
14
13
  const onKeyDown = (e) => {
@@ -21,16 +20,16 @@ export const AddNewCellDropdown = ({ onAdd, enableShortcut = false, triggerCompo
21
20
  return () => document.removeEventListener('keydown', onKeyDown);
22
21
  // eslint-disable-next-line react-hooks/exhaustive-deps
23
22
  }, []);
24
- return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: triggerComponent }), _jsx(AddNewCellDropdownContent, { onAddCell: onAdd, currentTabId: currentTabId, setOpen: setOpen })] }));
23
+ return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: triggerComponent }), _jsx(AddNewCellDropdownContent, { onAddCell: onAdd, artifactId: artifactId, setOpen: setOpen })] }));
25
24
  };
26
- export const AddNewCellDropdownContent = ({ onAddCell, currentTabId, align = 'center', setOpen, }) => {
25
+ export const AddNewCellDropdownContent = ({ onAddCell, artifactId, align = 'center', setOpen, }) => {
27
26
  const cellRegistry = useStoreWithNotebook((s) => s.cells.cellRegistry);
28
27
  const availableTypes = Object.keys(cellRegistry);
29
- return (_jsx(PopoverContent, { align: align, className: "w-[100px] p-0", onCloseAutoFocus: (e) => e.preventDefault(), children: _jsx(Command, { tabIndex: 0, loop: true, className: "focus-visible:outline-none", children: _jsx(CommandList, { className: "focus-visible:outline-none", children: _jsx(CommandGroup, { className: "**:[[cmdk-group-heading]]:text-foreground p-1 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:font-semibold", children: availableTypes.map((type) => {
30
- return (_jsx(CommandItem, { disabled: !currentTabId, onSelect: () => {
28
+ return (_jsx(PopoverContent, { align: align, className: "w-auto p-0", onCloseAutoFocus: (e) => e.preventDefault(), children: _jsx(Command, { tabIndex: 0, loop: true, className: "focus-visible:outline-none", children: _jsx(CommandList, { className: "focus-visible:outline-none", children: _jsx(CommandGroup, { className: "**:[[cmdk-group-heading]]:text-foreground p-1 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:font-semibold", children: availableTypes.map((type) => {
29
+ return (_jsx(CommandItem, { disabled: !artifactId, onSelect: () => {
31
30
  onAddCell(type);
32
31
  setOpen?.(false);
33
- }, className: "cursor-pointer", children: _jsx("span", { className: "text-xs capitalize", children: getCellTypeLabel(type, cellRegistry) }) }, type));
32
+ }, className: "cursor-pointer", children: _jsx("span", { className: "text-xs whitespace-nowrap capitalize", children: getCellTypeLabel(type, cellRegistry) }) }, type));
34
33
  }) }) }) }) }));
35
34
  };
36
35
  //# sourceMappingURL=AddNewCellDropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddNewCellDropdown.js","sourceRoot":"","sources":["../../src/cellOperations/AddNewCellDropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,OAAO,EACP,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,OAAO,EACP,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAK,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAQlD,MAAM,CAAC,MAAM,kBAAkB,GAAc,CAAC,EAC5C,KAAK,EACL,cAAc,GAAG,KAAK,EACtB,gBAAgB,GAAG,KAAC,aAAa,KAAG,GACrC,EAAE,EAAE;IACH,MAAM,YAAY,GAAG,oBAAoB,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CACrC,CAAC;IACF,MAAM,CAAC,IAAI,EA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D,OAAO,CACL,KAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,SAAS,EAAC,eAAe,EACzB,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,YAE3C,KAAC,OAAO,IAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,QAAC,SAAS,EAAC,4BAA4B,YAC/D,KAAC,WAAW,IAAC,SAAS,EAAC,4BAA4B,YACjD,KAAC,YAAY,IAAC,SAAS,EAAC,0JAA0J,YAC/K,cAAc,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;wBACnC,OAAO,CACL,KAAC,WAAW,IAEV,QAAQ,EAAE,CAAC,YAAY,EACvB,QAAQ,EAAE,GAAG,EAAE;gCACb,SAAS,CAAC,IAAI,CAAC,CAAC;gCAChB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;4BACnB,CAAC,EACD,SAAS,EAAC,gBAAgB,YAE1B,eAAM,SAAS,EAAC,oBAAoB,YACjC,gBAAgB,CAAC,IAAI,EAAE,YAAY,CAAC,GAChC,IAVF,IAAI,CAWG,CACf,CAAC;oBACJ,CAAC,CAAC,GACW,GACH,GACN,GACK,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n Command,\n CommandList,\n CommandItem,\n CommandGroup,\n PopoverContent,\n Popover,\n PopoverTrigger,\n} from '@sqlrooms/ui';\nimport {FC, useEffect, useState} from 'react';\n\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\nimport {TriggerButton} from './AddNewCellTrigger';\nimport {getCellTypeLabel} from '../NotebookUtils';\n\ntype Props = {\n onAdd: (type: string) => void;\n enableShortcut?: boolean;\n triggerComponent?: React.ReactNode;\n};\n\nexport const AddNewCellDropdown: FC<Props> = ({\n onAdd,\n enableShortcut = false,\n triggerComponent = <TriggerButton />,\n}) => {\n const currentTabId = useStoreWithNotebook(\n (s) => s.cells.config.currentSheetId,\n );\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n if (!currentTabId || !enableShortcut) {\n return;\n }\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'j' && (e.metaKey || e.ctrlKey)) {\n e.preventDefault();\n setOpen((prev) => !prev);\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>{triggerComponent}</PopoverTrigger>\n\n <AddNewCellDropdownContent\n onAddCell={onAdd}\n currentTabId={currentTabId}\n setOpen={setOpen}\n />\n </Popover>\n );\n};\n\ntype ContentProps = {\n onAddCell: (type: string) => void;\n currentTabId?: string | null;\n align?: 'center' | 'start' | 'end';\n setOpen?: (open: boolean) => void;\n};\n\nexport const AddNewCellDropdownContent: FC<ContentProps> = ({\n onAddCell,\n currentTabId,\n align = 'center',\n setOpen,\n}) => {\n const cellRegistry = useStoreWithNotebook((s) => s.cells.cellRegistry);\n const availableTypes = Object.keys(cellRegistry);\n\n return (\n <PopoverContent\n align={align}\n className=\"w-[100px] p-0\"\n onCloseAutoFocus={(e) => e.preventDefault()}\n >\n <Command tabIndex={0} loop className=\"focus-visible:outline-none\">\n <CommandList className=\"focus-visible:outline-none\">\n <CommandGroup className=\"**:[[cmdk-group-heading]]:text-foreground p-1 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:font-semibold\">\n {availableTypes.map((type: string) => {\n return (\n <CommandItem\n key={type}\n disabled={!currentTabId}\n onSelect={() => {\n onAddCell(type);\n setOpen?.(false);\n }}\n className=\"cursor-pointer\"\n >\n <span className=\"text-xs capitalize\">\n {getCellTypeLabel(type, cellRegistry)}\n </span>\n </CommandItem>\n );\n })}\n </CommandGroup>\n </CommandList>\n </Command>\n </PopoverContent>\n );\n};\n"]}
1
+ {"version":3,"file":"AddNewCellDropdown.js","sourceRoot":"","sources":["../../src/cellOperations/AddNewC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J,CAAC,CAAC,GACW,GACH,GACN,GACK,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n Command,\n CommandList,\n CommandItem,\n CommandGroup,\n PopoverContent,\n Popover,\n PopoverTrigger,\n} from '@sqlrooms/ui';\nimport {FC, useEffect, useState} from 'react';\n\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\nimport {TriggerButton} from './AddNewCellTrigger';\nimport {getCellTypeLabel} from '../NotebookUtils';\n\ntype Props = {\n artifactId: string;\n onAdd: (type: string) => void;\n enableShortcut?: boolean;\n triggerComponent?: React.ReactNode;\n};\n\nexport const AddNewCellDropdown: FC<Props> = ({\n artifactId,\n onAdd,\n enableShortcut = false,\n triggerComponent = <TriggerButton />,\n}) => {\n const [open, setOpen] = useState(false);\n\n useEffect(() => {\n if (!artifactId || !enableShortcut) {\n return;\n }\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'j' && (e.metaKey || e.ctrlKey)) {\n e.preventDefault();\n setOpen((prev) => !prev);\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>{triggerComponent}</PopoverTrigger>\n\n <AddNewCellDropdownContent\n onAddCell={onAdd}\n artifactId={artifactId}\n setOpen={setOpen}\n />\n </Popover>\n );\n};\n\ntype ContentProps = {\n onAddCell: (type: string) => void;\n artifactId?: string | null;\n align?: 'center' | 'start' | 'end';\n setOpen?: (open: boolean) => void;\n};\n\nexport const AddNewCellDropdownContent: FC<ContentProps> = ({\n onAddCell,\n artifactId,\n align = 'center',\n setOpen,\n}) => {\n const cellRegistry = useStoreWithNotebook((s) => s.cells.cellRegistry);\n const availableTypes = Object.keys(cellRegistry);\n\n return (\n <PopoverContent\n align={align}\n className=\"w-auto p-0\"\n onCloseAutoFocus={(e) => e.preventDefault()}\n >\n <Command tabIndex={0} loop className=\"focus-visible:outline-none\">\n <CommandList className=\"focus-visible:outline-none\">\n <CommandGroup className=\"**:[[cmdk-group-heading]]:text-foreground p-1 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-sm **:[[cmdk-group-heading]]:font-semibold\">\n {availableTypes.map((type: string) => {\n return (\n <CommandItem\n key={type}\n disabled={!artifactId}\n onSelect={() => {\n onAddCell(type);\n setOpen?.(false);\n }}\n className=\"cursor-pointer\"\n >\n <span className=\"text-xs whitespace-nowrap capitalize\">\n {getCellTypeLabel(type, cellRegistry)}\n </span>\n </CommandItem>\n );\n })}\n </CommandGroup>\n </CommandList>\n </Command>\n </PopoverContent>\n );\n};\n"]}
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  type Props = {
3
+ artifactId: string;
3
4
  onAdd: (type: string) => void;
4
5
  };
5
6
  export declare const AddNewCellTabs: FC<Props>;
@@ -1 +1 @@
1
- {"version":3,"file":"AddNewCellTabs.d.ts","sourceRoot":"","sources":["../../src/cellOperations/AddNewCellTabs.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAMzB,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,KAAK,CA8BpC,CAAC"}
1
+ {"version":3,"file":"AddNewCellTabs.d.ts","sourceRoot":"","sources":["../../src/cellOperations/AddNewCellTabs.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAMzB,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,KAAK,CA2BpC,CAAC"}
@@ -3,12 +3,11 @@ import { Separator, Button } from '@sqlrooms/ui';
3
3
  import { useStoreWithNotebook } from '../useStoreWithNotebook';
4
4
  import { getCellTypeLabel } from '../NotebookUtils';
5
5
  import { PlusIcon } from 'lucide-react';
6
- export const AddNewCellTabs = ({ onAdd }) => {
7
- const currentTabId = useStoreWithNotebook((s) => s.cells.config.currentSheetId);
6
+ export const AddNewCellTabs = ({ artifactId, onAdd }) => {
8
7
  const cellRegistry = useStoreWithNotebook((s) => s.cells.cellRegistry);
9
8
  const cellTypes = Object.keys(cellRegistry);
10
9
  return (_jsxs("div", { className: "grid w-full grid-cols-[1fr_auto_1fr] items-center gap-2 opacity-0 transition-opacity hover:opacity-100", children: [_jsx(Separator, { className: "w-full bg-gray-500" }), _jsx("div", { className: "flex gap-1", children: cellTypes.map((type) => {
11
- return (_jsxs(Button, { disabled: !currentTabId, onClick: () => onAdd(type), className: "h-6 gap-1 py-0 capitalize text-gray-500", variant: "ghost", size: "xs", children: [_jsx(PlusIcon, { size: 12, strokeWidth: 1.5 }), getCellTypeLabel(type, cellRegistry)] }, type));
10
+ return (_jsxs(Button, { disabled: !artifactId, onClick: () => onAdd(type), className: "h-6 gap-1 py-0 text-gray-500 capitalize", variant: "ghost", size: "xs", children: [_jsx(PlusIcon, { size: 12, strokeWidth: 1.5 }), getCellTypeLabel(type, cellRegistry)] }, type));
12
11
  }) }), _jsx(Separator, { className: "w-full bg-gray-500" })] }));
13
12
  };
14
13
  //# sourceMappingURL=AddNewCellTabs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddNewCellTabs.js","sourceRoot":"","sources":["../../src/cellOperations/AddNewCellTabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAMtC,MAAM,CAAC,MAAM,cAAc,GAAc,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IACnD,MAAM,YAAY,GAAG,oBAAoB,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CACrC,CAAC;IACF,MAAM,YAAY,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAE5C,OAAO,CACL,eAAK,SAAS,EAAC,wGAAwG,aACrH,KAAC,SAAS,IAAC,SAAS,EAAC,oBAAoB,GAAG,EAC5C,cAAK,SAAS,EAAC,YAAY,YACxB,SAAS,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;oBAC9B,OAAO,CACL,MAAC,MAAM,IAEL,QAAQ,EAAE,CAAC,YAAY,EACvB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAC1B,SAAS,EAAC,yCAAyC,EACnD,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,aAET,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,GAAI,EACvC,gBAAgB,CAAC,IAAI,EAAE,YAAY,CAAC,KARhC,IAAI,CASF,CACV,CAAC;gBACJ,CAAC,CAAC,GACE,EACN,KAAC,SAAS,IAAC,SAAS,EAAC,oBAAoB,GAAG,IACxC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {Separator, Button} from '@sqlrooms/ui';\nimport {FC} from 'react';\n\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\nimport {getCellTypeLabel} from '../NotebookUtils';\nimport {PlusIcon} from 'lucide-react';\n\ntype Props = {\n onAdd: (type: string) => void;\n};\n\nexport const AddNewCellTabs: FC<Props> = ({onAdd}) => {\n const currentTabId = useStoreWithNotebook(\n (s) => s.cells.config.currentSheetId,\n );\n const cellRegistry = useStoreWithNotebook((s) => s.cells.cellRegistry);\n const cellTypes = Object.keys(cellRegistry);\n\n return (\n <div className=\"grid w-full grid-cols-[1fr_auto_1fr] items-center gap-2 opacity-0 transition-opacity hover:opacity-100\">\n <Separator className=\"w-full bg-gray-500\" />\n <div className=\"flex gap-1\">\n {cellTypes.map((type: string) => {\n return (\n <Button\n key={type}\n disabled={!currentTabId}\n onClick={() => onAdd(type)}\n className=\"h-6 gap-1 py-0 capitalize text-gray-500\"\n variant=\"ghost\"\n size=\"xs\"\n >\n <PlusIcon size={12} strokeWidth={1.5} />\n {getCellTypeLabel(type, cellRegistry)}\n </Button>\n );\n })}\n </div>\n <Separator className=\"w-full bg-gray-500\" />\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"AddNewCellTabs.js","sourceRoot":"","sources":["../../src/cellOperations/AddNewCellTabs.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAOtC,MAAM,CAAC,MAAM,cAAc,GAAc,CAAC,EAAC,UAAU,EAAE,KAAK,EAAC,EAAE,EAAE;IAC/D,MAAM,YAAY,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAE5C,OAAO,CACL,eAAK,SAAS,EAAC,wGAAwG,aACrH,KAAC,SAAS,IAAC,SAAS,EAAC,oBAAoB,GAAG,EAC5C,cAAK,SAAS,EAAC,YAAY,YACxB,SAAS,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;oBAC9B,OAAO,CACL,MAAC,MAAM,IAEL,QAAQ,EAAE,CAAC,UAAU,EACrB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAC1B,SAAS,EAAC,yCAAyC,EACnD,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,aAET,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,GAAI,EACvC,gBAAgB,CAAC,IAAI,EAAE,YAAY,CAAC,KARhC,IAAI,CASF,CACV,CAAC;gBACJ,CAAC,CAAC,GACE,EACN,KAAC,SAAS,IAAC,SAAS,EAAC,oBAAoB,GAAG,IACxC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {Separator, Button} from '@sqlrooms/ui';\nimport {FC} from 'react';\n\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\nimport {getCellTypeLabel} from '../NotebookUtils';\nimport {PlusIcon} from 'lucide-react';\n\ntype Props = {\n artifactId: string;\n onAdd: (type: string) => void;\n};\n\nexport const AddNewCellTabs: FC<Props> = ({artifactId, onAdd}) => {\n const cellRegistry = useStoreWithNotebook((s) => s.cells.cellRegistry);\n const cellTypes = Object.keys(cellRegistry);\n\n return (\n <div className=\"grid w-full grid-cols-[1fr_auto_1fr] items-center gap-2 opacity-0 transition-opacity hover:opacity-100\">\n <Separator className=\"w-full bg-gray-500\" />\n <div className=\"flex gap-1\">\n {cellTypes.map((type: string) => {\n return (\n <Button\n key={type}\n disabled={!artifactId}\n onClick={() => onAdd(type)}\n className=\"h-6 gap-1 py-0 text-gray-500 capitalize\"\n variant=\"ghost\"\n size=\"xs\"\n >\n <PlusIcon size={12} strokeWidth={1.5} />\n {getCellTypeLabel(type, cellRegistry)}\n </Button>\n );\n })}\n </div>\n <Separator className=\"w-full bg-gray-500\" />\n </div>\n );\n};\n"]}
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  type Props = {
3
+ artifactId: string;
3
4
  id: string;
4
5
  };
5
6
  export declare const MoveCellButtons: FC<Props>;
@@ -1 +1 @@
1
- {"version":3,"file":"MoveCellButtons.d.ts","sourceRoot":"","sources":["../../src/cellOperations/MoveCellButtons.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAMhC,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,KAAK,CA2BrC,CAAC"}
1
+ {"version":3,"file":"MoveCellButtons.d.ts","sourceRoot":"","sources":["../../src/cellOperations/MoveCellButtons.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAMhC,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,KAAK,CAwBrC,CAAC"}
@@ -2,11 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button } from '@sqlrooms/ui';
3
3
  import { ArrowDownIcon, ArrowUpIcon } from 'lucide-react';
4
4
  import { useStoreWithNotebook } from '../useStoreWithNotebook';
5
- export const MoveCellButtons = ({ id }) => {
5
+ export const MoveCellButtons = ({ artifactId, id }) => {
6
6
  const moveCell = useStoreWithNotebook((s) => s.notebook.moveCell);
7
- const currentTabId = useStoreWithNotebook((s) => s.cells.config.currentSheetId);
8
- if (!currentTabId)
7
+ if (!artifactId)
9
8
  return null;
10
- return (_jsxs("div", { className: "flex gap-1", children: [_jsx(Button, { variant: "ghost", className: "h-6 w-6", size: "xs", onClick: () => moveCell(currentTabId, id, 'up'), children: _jsx(ArrowUpIcon, { className: "text-gray-500" }) }), _jsx(Button, { variant: "ghost", className: "h-6 w-6", size: "xs", onClick: () => moveCell(currentTabId, id, 'down'), children: _jsx(ArrowDownIcon, { className: "text-gray-500" }) })] }));
9
+ return (_jsxs("div", { className: "flex gap-1", children: [_jsx(Button, { variant: "ghost", className: "h-6 w-6", size: "xs", onClick: () => moveCell(artifactId, id, 'up'), children: _jsx(ArrowUpIcon, { className: "text-gray-500" }) }), _jsx(Button, { variant: "ghost", className: "h-6 w-6", size: "xs", onClick: () => moveCell(artifactId, id, 'down'), children: _jsx(ArrowDownIcon, { className: "text-gray-500" }) })] }));
11
10
  };
12
11
  //# sourceMappingURL=MoveCellButtons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MoveCellButtons.js","sourceRoot":"","sources":["../../src/cellOperations/MoveCellButtons.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAM7D,MAAM,CAAC,MAAM,eAAe,GAAc,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE;IACjD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,oBAAoB,CACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CACrC,CAAC;IACF,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAE/B,OAAO,CACL,eAAK,SAAS,EAAC,YAAY,aACzB,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,EAAE,IAAI,CAAC,YAE/C,KAAC,WAAW,IAAC,SAAS,EAAC,eAAe,GAAG,GAClC,EACT,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,EAAE,MAAM,CAAC,YAEjD,KAAC,aAAa,IAAC,SAAS,EAAC,eAAe,GAAG,GACpC,IACL,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React, {FC} from 'react';\nimport {Button} from '@sqlrooms/ui';\nimport {ArrowDownIcon, ArrowUpIcon} from 'lucide-react';\n\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\n\ntype Props = {\n id: string;\n};\n\nexport const MoveCellButtons: FC<Props> = ({id}) => {\n const moveCell = useStoreWithNotebook((s) => s.notebook.moveCell);\n const currentTabId = useStoreWithNotebook(\n (s) => s.cells.config.currentSheetId,\n );\n if (!currentTabId) return null;\n\n return (\n <div className=\"flex gap-1\">\n <Button\n variant=\"ghost\"\n className=\"h-6 w-6\"\n size=\"xs\"\n onClick={() => moveCell(currentTabId, id, 'up')}\n >\n <ArrowUpIcon className=\"text-gray-500\" />\n </Button>\n <Button\n variant=\"ghost\"\n className=\"h-6 w-6\"\n size=\"xs\"\n onClick={() => moveCell(currentTabId, id, 'down')}\n >\n <ArrowDownIcon className=\"text-gray-500\" />\n </Button>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"MoveCellButtons.js","sourceRoot":"","sources":["../../src/cellOperations/MoveCellButtons.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,aAAa,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAO7D,MAAM,CAAC,MAAM,eAAe,GAAc,CAAC,EAAC,UAAU,EAAE,EAAE,EAAC,EAAE,EAAE;IAC7D,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClE,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAE7B,OAAO,CACL,eAAK,SAAS,EAAC,YAAY,aACzB,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,EAAE,IAAI,CAAC,YAE7C,KAAC,WAAW,IAAC,SAAS,EAAC,eAAe,GAAG,GAClC,EACT,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,YAE/C,KAAC,aAAa,IAAC,SAAS,EAAC,eAAe,GAAG,GACpC,IACL,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React, {FC} from 'react';\nimport {Button} from '@sqlrooms/ui';\nimport {ArrowDownIcon, ArrowUpIcon} from 'lucide-react';\n\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\n\ntype Props = {\n artifactId: string;\n id: string;\n};\n\nexport const MoveCellButtons: FC<Props> = ({artifactId, id}) => {\n const moveCell = useStoreWithNotebook((s) => s.notebook.moveCell);\n if (!artifactId) return null;\n\n return (\n <div className=\"flex gap-1\">\n <Button\n variant=\"ghost\"\n className=\"h-6 w-6\"\n size=\"xs\"\n onClick={() => moveCell(artifactId, id, 'up')}\n >\n <ArrowUpIcon className=\"text-gray-500\" />\n </Button>\n <Button\n variant=\"ghost\"\n className=\"h-6 w-6\"\n size=\"xs\"\n onClick={() => moveCell(artifactId, id, 'down')}\n >\n <ArrowDownIcon className=\"text-gray-500\" />\n </Button>\n </div>\n );\n};\n"]}
@@ -26,8 +26,38 @@ export declare const InputCell: z.ZodObject<{
26
26
  }, z.core.$strip>;
27
27
  }, z.core.$strip>;
28
28
  export type InputCell = z.infer<typeof InputCell>;
29
- export type NotebookCellType = InputCell['type'];
30
- export declare const NotebookCell: z.ZodObject<{
29
+ export declare const NotebookCell: z.ZodDiscriminatedUnion<[z.ZodObject<{
30
+ id: z.ZodString;
31
+ type: z.ZodLiteral<"sql">;
32
+ data: z.ZodObject<{
33
+ title: z.ZodDefault<z.ZodString>;
34
+ sql: z.ZodDefault<z.ZodString>;
35
+ resultName: z.ZodOptional<z.ZodString>;
36
+ connectorId: z.ZodOptional<z.ZodString>;
37
+ }, z.core.$strip>;
38
+ }, z.core.$strip>, z.ZodObject<{
39
+ id: z.ZodString;
40
+ type: z.ZodLiteral<"text">;
41
+ data: z.ZodObject<{
42
+ title: z.ZodDefault<z.ZodString>;
43
+ text: z.ZodDefault<z.ZodString>;
44
+ }, z.core.$strip>;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ id: z.ZodString;
47
+ type: z.ZodLiteral<"vega">;
48
+ data: z.ZodObject<{
49
+ title: z.ZodDefault<z.ZodString>;
50
+ sqlId: z.ZodOptional<z.ZodString>;
51
+ tableRef: z.ZodOptional<z.ZodString>;
52
+ sql: z.ZodOptional<z.ZodString>;
53
+ vegaSpec: z.ZodOptional<z.ZodAny>;
54
+ crossFilter: z.ZodDefault<z.ZodObject<{
55
+ enabled: z.ZodDefault<z.ZodBoolean>;
56
+ brushField: z.ZodOptional<z.ZodString>;
57
+ brushFieldType: z.ZodOptional<z.ZodType<import("@sqlrooms/cells").BrushFieldType>>;
58
+ }, z.core.$strip>>;
59
+ }, z.core.$strip>;
60
+ }, z.core.$strip>, z.ZodObject<{
31
61
  id: z.ZodString;
32
62
  type: z.ZodLiteral<"input">;
33
63
  data: z.ZodObject<{
@@ -50,23 +80,30 @@ export declare const NotebookCell: z.ZodObject<{
50
80
  value: z.ZodDefault<z.ZodString>;
51
81
  }, z.core.$strip>], "kind">;
52
82
  }, z.core.$strip>;
53
- }, z.core.$strip>;
83
+ }, z.core.$strip>, z.ZodObject<{
84
+ id: z.ZodString;
85
+ type: z.ZodLiteral<"pivot">;
86
+ data: z.ZodObject<{
87
+ pivotId: z.ZodString;
88
+ }, z.core.$strip>;
89
+ }, z.core.$strip>], "type">;
54
90
  export type NotebookCell = z.infer<typeof NotebookCell>;
55
- /** Notebook View Meta */
56
- export declare const NotebookSheetMeta: z.ZodObject<{
91
+ export type NotebookCellType = NotebookCell['type'];
92
+ /** Notebook view metadata for a single artifact. */
93
+ export declare const NotebookArtifactMeta: z.ZodObject<{
57
94
  cellOrder: z.ZodDefault<z.ZodArray<z.ZodString>>;
58
95
  }, z.core.$strip>;
59
- export type NotebookSheetMeta = z.infer<typeof NotebookSheetMeta>;
60
- export declare const NotebookSheet: z.ZodObject<{
96
+ export type NotebookArtifactMeta = z.infer<typeof NotebookArtifactMeta>;
97
+ export declare const NotebookArtifact: z.ZodObject<{
61
98
  id: z.ZodString;
62
99
  meta: z.ZodObject<{
63
100
  cellOrder: z.ZodDefault<z.ZodArray<z.ZodString>>;
64
101
  }, z.core.$strip>;
65
102
  }, z.core.$strip>;
66
- export type NotebookSheet = z.infer<typeof NotebookSheet>;
67
- /** Notebook Slice Config (View only) */
103
+ export type NotebookArtifact = z.infer<typeof NotebookArtifact>;
104
+ /** Notebook Slice Config (view-only artifact runtime metadata). */
68
105
  export declare const NotebookSliceConfig: z.ZodObject<{
69
- sheets: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
106
+ artifacts: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
70
107
  id: z.ZodString;
71
108
  meta: z.ZodObject<{
72
109
  cellOrder: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -75,11 +112,11 @@ export declare const NotebookSliceConfig: z.ZodObject<{
75
112
  currentCellId: z.ZodOptional<z.ZodString>;
76
113
  }, z.core.$strip>;
77
114
  export type NotebookSliceConfig = z.infer<typeof NotebookSliceConfig>;
78
- export declare const NotebookTab: z.ZodObject<{
115
+ export declare const NotebookArtifactView: z.ZodObject<{
79
116
  id: z.ZodString;
80
117
  cellOrder: z.ZodDefault<z.ZodArray<z.ZodString>>;
81
118
  name: z.ZodString;
82
119
  }, z.core.$strip>;
83
- export type NotebookTab = z.infer<typeof NotebookTab>;
120
+ export type NotebookArtifactView = z.infer<typeof NotebookArtifactView>;
84
121
  export type InputUnion = z.infer<typeof import('@sqlrooms/cells').InputUnion>;
85
122
  //# sourceMappingURL=cellSchemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cellSchemas.d.ts","sourceRoot":"","sources":["../src/cellSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAgB,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAC,UAAU,EAAC,CAAC;AAEpB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;iBAIpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAEjD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;iBAAY,CAAC;AACtC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,yBAAyB;AACzB,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,aAAa;;;;;iBAGxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,wCAAwC;AACxC,eAAO,MAAM,mBAAmB;;;;;;;;iBAG9B,CAAC;AACH,MAAM,MAAM,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M,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,oBAAoB;;;;iBAI/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,iBAAiB,EAAE,UAAU,CAAC,CAAC"}
@@ -1,28 +1,35 @@
1
1
  import { z } from 'zod';
2
- import { InputCellData, InputTypes } from '@sqlrooms/cells';
2
+ import { InputCellData, InputCellSchema, InputTypes, SqlCellSchema, TextCellSchema, VegaCellSchema, } from '@sqlrooms/cells';
3
+ import { PivotCellSchema } from '@sqlrooms/pivot';
3
4
  export { InputTypes };
4
5
  export const InputCell = z.object({
5
6
  id: z.string(),
6
7
  type: z.literal('input'),
7
8
  data: InputCellData,
8
9
  });
9
- export const NotebookCell = InputCell;
10
- /** Notebook View Meta */
11
- export const NotebookSheetMeta = z.object({
10
+ export const NotebookCell = z.discriminatedUnion('type', [
11
+ SqlCellSchema,
12
+ TextCellSchema,
13
+ VegaCellSchema,
14
+ InputCellSchema,
15
+ PivotCellSchema,
16
+ ]);
17
+ /** Notebook view metadata for a single artifact. */
18
+ export const NotebookArtifactMeta = z.object({
12
19
  cellOrder: z.array(z.string()).default([]),
13
20
  });
14
- export const NotebookSheet = z.object({
21
+ export const NotebookArtifact = z.object({
15
22
  id: z.string(),
16
- meta: NotebookSheetMeta,
23
+ meta: NotebookArtifactMeta,
17
24
  });
18
- /** Notebook Slice Config (View only) */
25
+ /** Notebook Slice Config (view-only artifact runtime metadata). */
19
26
  export const NotebookSliceConfig = z.object({
20
- sheets: z.record(z.string(), NotebookSheet).default({}),
27
+ artifacts: z.record(z.string(), NotebookArtifact).default({}),
21
28
  currentCellId: z.string().optional(),
22
29
  });
23
- export const NotebookTab = z.object({
30
+ export const NotebookArtifactView = z.object({
24
31
  id: z.string(),
25
32
  cellOrder: z.array(z.string()).default([]),
26
- name: z.string(), // Title from CellsSlice
33
+ name: z.string(),
27
34
  });
28
35
  //# sourceMappingURL=cellSchemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cellSchemas.js","sourceRoot":"","sources":["../src/cellSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAC,UAAU,EAAC,CAAC;AAEpB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,IAAI,EAAE,aAAa;CACpB,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AAGtC,yBAAyB;AACzB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC3C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,iBAAiB;CACxB,CAAC,CAAC;AAGH,wCAAwC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,aAAa,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACvD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,wBAAwB;CAC3C,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {InputCellData, InputTypes} from '@sqlrooms/cells';\n\nexport {InputTypes};\n\nexport const InputCell = z.object({\n id: z.string(),\n type: z.literal('input'),\n data: InputCellData,\n});\nexport type InputCell = z.infer<typeof InputCell>;\n\nexport type NotebookCellType = InputCell['type'];\n\nexport const NotebookCell = InputCell;\nexport type NotebookCell = z.infer<typeof NotebookCell>;\n\n/** Notebook View Meta */\nexport const NotebookSheetMeta = z.object({\n cellOrder: z.array(z.string()).default([]),\n});\nexport type NotebookSheetMeta = z.infer<typeof NotebookSheetMeta>;\n\nexport const NotebookSheet = z.object({\n id: z.string(),\n meta: NotebookSheetMeta,\n});\nexport type NotebookSheet = z.infer<typeof NotebookSheet>;\n\n/** Notebook Slice Config (View only) */\nexport const NotebookSliceConfig = z.object({\n sheets: z.record(z.string(), NotebookSheet).default({}),\n currentCellId: z.string().optional(),\n});\nexport type NotebookSliceConfig = z.infer<typeof NotebookSliceConfig>;\n\nexport const NotebookTab = z.object({\n id: z.string(),\n cellOrder: z.array(z.string()).default([]),\n name: z.string(), // Title from CellsSlice\n});\nexport type NotebookTab = z.infer<typeof NotebookTab>;\n\nexport type InputUnion = z.infer<typeof import('@sqlrooms/cells').InputUnion>;\n"]}
1
+ {"version":3,"file":"cellSchemas.js","sourceRoot":"","sources":["../src/cellSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,EACd,cAA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,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {\n InputCellData,\n InputCellSchema,\n InputTypes,\n SqlCellSchema,\n TextCellSchema,\n VegaCellSchema,\n} from '@sqlrooms/cells';\nimport {PivotCellSchema} from '@sqlrooms/pivot';\n\nexport {InputTypes};\n\nexport const InputCell = z.object({\n id: z.string(),\n type: z.literal('input'),\n data: InputCellData,\n});\nexport type InputCell = z.infer<typeof InputCell>;\n\nexport const NotebookCell = z.discriminatedUnion('type', [\n SqlCellSchema,\n TextCellSchema,\n VegaCellSchema,\n InputCellSchema,\n PivotCellSchema,\n]);\nexport type NotebookCell = z.infer<typeof NotebookCell>;\nexport type NotebookCellType = NotebookCell['type'];\n\n/** Notebook view metadata for a single artifact. */\nexport const NotebookArtifactMeta = z.object({\n cellOrder: z.array(z.string()).default([]),\n});\nexport type NotebookArtifactMeta = z.infer<typeof NotebookArtifactMeta>;\n\nexport const NotebookArtifact = z.object({\n id: z.string(),\n meta: NotebookArtifactMeta,\n});\nexport type NotebookArtifact = z.infer<typeof NotebookArtifact>;\n\n/** Notebook Slice Config (view-only artifact runtime metadata). */\nexport const NotebookSliceConfig = z.object({\n artifacts: z.record(z.string(), NotebookArtifact).default({}),\n currentCellId: z.string().optional(),\n});\nexport type NotebookSliceConfig = z.infer<typeof NotebookSliceConfig>;\n\nexport const NotebookArtifactView = z.object({\n id: z.string(),\n cellOrder: z.array(z.string()).default([]),\n name: z.string(),\n});\nexport type NotebookArtifactView = z.infer<typeof NotebookArtifactView>;\n\nexport type InputUnion = z.infer<typeof import('@sqlrooms/cells').InputUnion>;\n"]}
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
- export declare const CellContainer: React.FC<{
2
+ export type CellContainerProps = {
3
3
  id: string;
4
4
  header?: React.ReactNode;
5
5
  footer?: React.ReactNode;
6
6
  children?: React.ReactNode;
7
7
  className?: string;
8
- }>;
8
+ showHeader?: boolean;
9
+ };
10
+ export declare const CellContainer: React.FC<CellContainerProps>;
9
11
  //# sourceMappingURL=CellContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CellContainer.d.ts","sourceRoot":"","sources":["../../src/cells/CellContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAmDA,CAAC"}
1
+ {"version":3,"file":"CellContainer.d.ts","sourceRoot":"","sources":["../../src/cells/CellContainer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAmFtD,CAAC"}
@@ -1,22 +1,33 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn, EditableText } from '@sqlrooms/ui';
3
- import { useStoreWithNotebook } from '../useStoreWithNotebook';
4
3
  import { DeleteCellDialog } from '../cellOperations/DeleteCellDialog';
5
4
  import { MoveCellButtons } from '../cellOperations/MoveCellButtons';
6
- import { findCellInNotebook } from '../NotebookUtils';
7
- export const CellContainer = ({ id, header, footer, children, className }) => {
8
- const cell = useStoreWithNotebook((s) => findCellInNotebook(s, id)?.cell);
5
+ import { useStoreWithNotebook } from '../useStoreWithNotebook';
6
+ export const CellContainer = ({ id, header, footer, children, className, showHeader = true, }) => {
7
+ const cell = useStoreWithNotebook((s) => s.cells.config.data[id]);
8
+ const artifactId = useStoreWithNotebook((s) => {
9
+ for (const [candidateArtifactId, artifact] of Object.entries(s.notebook.config.artifacts)) {
10
+ if (artifact.meta.cellOrder.includes(id)) {
11
+ return candidateArtifactId;
12
+ }
13
+ }
14
+ return undefined;
15
+ });
9
16
  const onRename = useStoreWithNotebook((s) => s.notebook.renameCell);
10
17
  const setCurrentCell = useStoreWithNotebook((s) => s.notebook.setCurrentCell);
11
18
  const currentCellId = useStoreWithNotebook((s) => s.notebook.config.currentCellId);
12
19
  const isCurrent = currentCellId === id;
13
20
  if (!cell)
14
21
  return null;
15
- return (_jsxs("div", { id: `cell-${id}`, "data-cell-container-id": id, className: cn('bg-card group rounded border', {
16
- 'border-primary': isCurrent,
17
- }, className), onClick: () => setCurrentCell(id), children: [_jsxs("div", { className: "flex min-h-[36px] items-center justify-between gap-2 border-b px-2", children: [_jsx("div", { className: "flex h-6 flex-1 items-center gap-2", children: _jsx(EditableText, { editTrigger: "doubleClick", value: cell.data.title, onChange: (v) => onRename(id, v), className: "h-full text-sm font-medium shadow-none outline-none ring-0" }) }), _jsxs("div", { className: "flex items-center justify-end gap-2 text-xs", children: [_jsxs("div", { className: cn('flex items-center gap-2', {
22
+ return (_jsxs("div", { id: `cell-${id}`, "data-cell-container-id": id, className: cn('group relative rounded', !showHeader
23
+ ? isCurrent
24
+ ? 'border-primary border'
25
+ : ''
26
+ : cn('bg-card border', isCurrent && 'border-primary'), className), onClick: () => setCurrentCell(id), children: [!showHeader ? (_jsxs("div", { className: cn('absolute top-1 right-1 z-10 items-center gap-1', isCurrent
27
+ ? 'flex'
28
+ : 'hidden group-focus-within:flex group-hover:flex'), onMouseDown: (e) => e.preventDefault(), children: [_jsx(DeleteCellDialog, { cell: cell }), _jsx(MoveCellButtons, { artifactId: artifactId ?? '', id: id })] })) : (_jsxs("div", { className: "flex min-h-[36px] items-center justify-between gap-2 border-b px-2", children: [_jsx("div", { className: "flex h-6 flex-1 items-center gap-2", children: _jsx(EditableText, { editTrigger: "doubleClick", value: cell.data.title, onChange: (v) => onRename(id, v), className: "h-full text-sm font-medium shadow-none ring-0 outline-none" }) }), _jsxs("div", { className: "flex items-center justify-end gap-2 text-xs", children: [_jsxs("div", { className: cn('flex items-center gap-2', {
18
29
  'group-hover:flex': !isCurrent,
19
30
  hidden: !isCurrent,
20
- }), children: [_jsx(DeleteCellDialog, { cell: cell }), _jsx(MoveCellButtons, { id: id })] }), _jsx("div", { children: header })] })] }), _jsx("div", { className: "flex-1 overflow-auto", children: children }), footer && _jsx("div", { className: "border-t", children: footer })] }));
31
+ }), children: [_jsx(DeleteCellDialog, { cell: cell }), _jsx(MoveCellButtons, { artifactId: artifactId ?? '', id: id })] }), _jsx("div", { children: header })] })] })), _jsx("div", { className: "flex-1 overflow-auto", children: children }), footer && _jsx("div", { className: "border-t", children: footer })] }));
21
32
  };
22
33
  //# sourceMappingURL=CellContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CellContainer.js","sourceRoot":"","sources":["../../src/cells/CellContainer.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,EAAE,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEpD,MAAM,CAAC,MAAM,aAAa,GA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AAC,yBAAyB,EAAE;oCACvC,kBAAkB,EAAE,CAAC,SAAS;oCAC9B,MAAM,EAAE,CAAC,SAAS;iCACnB,CAAC,aAEF,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAW,GAAI,EACvC,KAAC,eAAe,IAAC,EAAE,EAAE,EAAE,GAAI,IACvB,EACN,wBAAM,MAAM,GAAO,IACf,IACF,EACN,cAAK,SAAS,EAAC,sBAAsB,YAAE,QAAQ,GAAO,EACrD,MAAM,IAAI,cAAK,SAAS,EAAC,UAAU,YAAE,MAAM,GAAO,IAC/C,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {cn, EditableText} from '@sqlrooms/ui';\n\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\nimport {DeleteCellDialog} from '../cellOperations/DeleteCellDialog';\nimport {MoveCellButtons} from '../cellOperations/MoveCellButtons';\nimport {findCellInNotebook} from '../NotebookUtils';\n\nexport const CellContainer: React.FC<{\n id: string;\n header?: React.ReactNode;\n footer?: React.ReactNode;\n children?: React.ReactNode;\n className?: string;\n}> = ({id, header, footer, children, className}) => {\n const cell = useStoreWithNotebook(\n (s) => findCellInNotebook(s as any, id)?.cell,\n );\n const onRename = useStoreWithNotebook((s) => s.notebook.renameCell);\n const setCurrentCell = useStoreWithNotebook((s) => s.notebook.setCurrentCell);\n const currentCellId = useStoreWithNotebook(\n (s) => s.notebook.config.currentCellId,\n );\n const isCurrent = currentCellId === id;\n\n if (!cell) return null;\n return (\n <div\n id={`cell-${id}`}\n data-cell-container-id={id}\n className={cn(\n 'bg-card group rounded border',\n {\n 'border-primary': isCurrent,\n },\n className,\n )}\n onClick={() => setCurrentCell(id)}\n >\n <div className=\"flex min-h-[36px] items-center justify-between gap-2 border-b px-2\">\n <div className=\"flex h-6 flex-1 items-center gap-2\">\n <EditableText\n editTrigger=\"doubleClick\"\n value={(cell.data as any).title}\n onChange={(v) => onRename(id, v)}\n className=\"h-full text-sm font-medium shadow-none outline-none ring-0\"\n />\n </div>\n <div className=\"flex items-center justify-end gap-2 text-xs\">\n <div\n className={cn('flex items-center gap-2', {\n 'group-hover:flex': !isCurrent,\n hidden: !isCurrent,\n })}\n >\n <DeleteCellDialog cell={cell as any} />\n <MoveCellButtons id={id} />\n </div>\n <div>{header}</div>\n </div>\n </div>\n <div className=\"flex-1 overflow-auto\">{children}</div>\n {footer && <div className=\"border-t\">{footer}</div>}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"CellContainer.js","sourceRoot":"","sources":["../../src/cells/CellContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,EAAE,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAW7D,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,EAAE,EACF,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,EACT,UAAU,GAAG,IAAI,GAClB,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE;QAC5C,KAAK,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAC1D,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAC5B,EAAE,CAAC;YACF,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;gBACzC,OAAO,mBAAmB,CAAC;YAC7B,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,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SAAS,EAAC,oCAAoC,YACjD,KAAC,YAAY,IACX,WAAW,EAAC,aAAa,EACzB,KAAK,EAAG,IAAI,CAAC,IAAY,CAAC,KAAK,EAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,EAChC,SAAS,EAAC,4DAA4D,GACtE,GACE,EACN,eAAK,SAAS,EAAC,6CAA6C,aAC1D,eACE,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE;oCACvC,kBAAkB,EAAE,CAAC,SAAS;oCAC9B,MAAM,EAAE,CAAC,SAAS;iCACnB,CAAC,aAEF,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAW,GAAI,EACvC,KAAC,eAAe,IAAC,UAAU,EAAE,UAAU,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,GAAI,IACrD,EACN,wBAAM,MAAM,GAAO,IACf,IACF,CACP,EACD,cAAK,SAAS,EAAC,sBAAsB,YAAE,QAAQ,GAAO,EACrD,MAAM,IAAI,cAAK,SAAS,EAAC,UAAU,YAAE,MAAM,GAAO,IAC/C,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {cn, EditableText} from '@sqlrooms/ui';\nimport React from 'react';\n\nimport {DeleteCellDialog} from '../cellOperations/DeleteCellDialog';\nimport {MoveCellButtons} from '../cellOperations/MoveCellButtons';\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\n\nexport type CellContainerProps = {\n id: string;\n header?: React.ReactNode;\n footer?: React.ReactNode;\n children?: React.ReactNode;\n className?: string;\n showHeader?: boolean;\n};\n\nexport const CellContainer: React.FC<CellContainerProps> = ({\n id,\n header,\n footer,\n children,\n className,\n showHeader = true,\n}) => {\n const cell = useStoreWithNotebook((s) => s.cells.config.data[id]);\n const artifactId = useStoreWithNotebook((s) => {\n for (const [candidateArtifactId, artifact] of Object.entries(\n s.notebook.config.artifacts,\n )) {\n if (artifact.meta.cellOrder.includes(id)) {\n return candidateArtifactId;\n }\n }\n return undefined;\n });\n const onRename = useStoreWithNotebook((s) => s.notebook.renameCell);\n const setCurrentCell = useStoreWithNotebook((s) => s.notebook.setCurrentCell);\n const currentCellId = useStoreWithNotebook(\n (s) => s.notebook.config.currentCellId,\n );\n const isCurrent = currentCellId === id;\n\n if (!cell) return null;\n return (\n <div\n id={`cell-${id}`}\n data-cell-container-id={id}\n className={cn(\n 'group relative rounded',\n !showHeader\n ? isCurrent\n ? 'border-primary border'\n : ''\n : cn('bg-card border', isCurrent && 'border-primary'),\n className,\n )}\n onClick={() => setCurrentCell(id)}\n >\n {!showHeader ? (\n <div\n className={cn(\n 'absolute top-1 right-1 z-10 items-center gap-1',\n isCurrent\n ? 'flex'\n : 'hidden group-focus-within:flex group-hover:flex',\n )}\n onMouseDown={(e) => e.preventDefault()}\n >\n <DeleteCellDialog cell={cell as any} />\n <MoveCellButtons artifactId={artifactId ?? ''} id={id} />\n </div>\n ) : (\n <div className=\"flex min-h-[36px] items-center justify-between gap-2 border-b px-2\">\n <div className=\"flex h-6 flex-1 items-center gap-2\">\n <EditableText\n editTrigger=\"doubleClick\"\n value={(cell.data as any).title}\n onChange={(v) => onRename(id, v)}\n className=\"h-full text-sm font-medium shadow-none ring-0 outline-none\"\n />\n </div>\n <div className=\"flex items-center justify-end gap-2 text-xs\">\n <div\n className={cn('flex items-center gap-2', {\n 'group-hover:flex': !isCurrent,\n hidden: !isCurrent,\n })}\n >\n <DeleteCellDialog cell={cell as any} />\n <MoveCellButtons artifactId={artifactId ?? ''} id={id} />\n </div>\n <div>{header}</div>\n </div>\n </div>\n )}\n <div className=\"flex-1 overflow-auto\">{children}</div>\n {footer && <div className=\"border-t\">{footer}</div>}\n </div>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CellView.d.ts","sourceRoot":"","sources":["../../src/cells/CellView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,CAkB3C,CAAC"}
1
+ {"version":3,"file":"CellView.d.ts","sourceRoot":"","sources":["../../src/cells/CellView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,CAuB3C,CAAC"}
@@ -10,7 +10,7 @@ export const CellView = ({ id }) => {
10
10
  return registryItem.renderCell({
11
11
  id,
12
12
  cell,
13
- renderContainer: ({ header, content, footer }) => (_jsx(CellContainer, { id: id, header: header, footer: footer, children: content })),
13
+ renderContainer: ({ header, content, footer, showHeader }) => (_jsx(CellContainer, { id: id, header: header, footer: footer, showHeader: showHeader, children: content })),
14
14
  });
15
15
  };
16
16
  //# sourceMappingURL=CellView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CellView.js","sourceRoot":"","sources":["../../src/cells/CellView.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,MAAM,QAAQ,GAA2B,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE;IACvD,MAAM,IAAI,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,IAAI,EAAE,IAAI,CAAC;IAC5B,MAAM,YAAY,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9C,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CACtD,CAAC;IAEF,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAExC,OAAO,YAAY,CAAC,UAAU,CAAC;QAC7B,EAAE;QACF,IAAI;QACJ,eAAe,EAAE,CAAC,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAC,EAAE,EAAE,CAAC,CAC9C,KAAC,aAAa,IAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAClD,OAAO,GACM,CACjB;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\nimport {CellContainer} from './CellContainer';\n\nexport const CellView: React.FC<{id: string}> = ({id}) => {\n const cell = useStoreWithNotebook((s) => s.cells.config.data[id]);\n const cellType = cell?.type;\n const registryItem = useStoreWithNotebook((s) =>\n cellType ? s.cells.cellRegistry[cellType] : undefined,\n );\n\n if (!cell || !registryItem) return null;\n\n return registryItem.renderCell({\n id,\n cell,\n renderContainer: ({header, content, footer}) => (\n <CellContainer id={id} header={header} footer={footer}>\n {content}\n </CellContainer>\n ),\n });\n};\n"]}
1
+ {"version":3,"file":"CellView.js","sourceRoot":"","sources":["../../src/cells/CellView.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,MAAM,QAAQ,GAA2B,CAAC,EAAC,EAAE,EAAC,EAAE,EAAE;IACvD,MAAM,IAAI,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,IAAI,EAAE,IAAI,CAAC;IAC5B,MAAM,YAAY,GAAG,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9C,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CACtD,CAAC;IAEF,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAExC,OAAO,YAAY,CAAC,UAAU,CAAC;QAC7B,EAAE;QACF,IAAI;QACJ,eAAe,EAAE,CAAC,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,CAC1D,KAAC,aAAa,IACZ,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,YAErB,OAAO,GACM,CACjB;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport {useStoreWithNotebook} from '../useStoreWithNotebook';\nimport {CellContainer} from './CellContainer';\n\nexport const CellView: React.FC<{id: string}> = ({id}) => {\n const cell = useStoreWithNotebook((s) => s.cells.config.data[id]);\n const cellType = cell?.type;\n const registryItem = useStoreWithNotebook((s) =>\n cellType ? s.cells.cellRegistry[cellType] : undefined,\n );\n\n if (!cell || !registryItem) return null;\n\n return registryItem.renderCell({\n id,\n cell,\n renderContainer: ({header, content, footer, showHeader}) => (\n <CellContainer\n id={id}\n header={header}\n footer={footer}\n showHeader={showHeader}\n >\n {content}\n </CellContainer>\n ),\n });\n};\n"]}
package/dist/index.d.ts CHANGED
@@ -6,5 +6,5 @@ export { createDefaultNotebookConfig, createNotebookSlice, } from './NotebookSli
6
6
  export { Notebook } from './Notebook';
7
7
  export { useStoreWithNotebook } from './useStoreWithNotebook';
8
8
  export type { NotebookSliceState } from './NotebookStateTypes';
9
- export { InputTypes, NotebookSliceConfig, NotebookTab, InputCell, NotebookCell, NotebookSheet, NotebookSheetMeta, } from './cellSchemas';
9
+ export { InputTypes, NotebookSliceConfig, NotebookArtifactView, InputCell, NotebookCell, NotebookArtifact, NotebookArtifactMeta, } from './cellSchemas';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE5D,YAAY,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE5D,YAAY,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -5,5 +5,5 @@
5
5
  export { createDefaultNotebookConfig, createNotebookSlice, } from './NotebookSlice';
6
6
  export { Notebook } from './Notebook';
7
7
  export { useStoreWithNotebook } from './useStoreWithNotebook';
8
- export { InputTypes, NotebookSliceConfig, NotebookTab, InputCell, NotebookCell, NotebookSheet, NotebookSheetMeta, } from './cellSchemas';
8
+ export { InputTypes, NotebookSliceConfig, NotebookArtifactView, InputCell, NotebookCell, NotebookArtifact, NotebookArtifactMeta, } from './cellSchemas';
9
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAI5D,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,iBAAiB,GAClB,MAAM,eAAe,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {\n createDefaultNotebookConfig,\n createNotebookSlice,\n} from './NotebookSlice';\n\nexport {Notebook} from './Notebook';\nexport {useStoreWithNotebook} from './useStoreWithNotebook';\n\nexport type {NotebookSliceState} from './NotebookStateTypes';\n\nexport {\n InputTypes,\n NotebookSliceConfig,\n NotebookTab,\n InputCell,\n NotebookCell,\n NotebookSheet,\n NotebookSheetMeta,\n} from './cellSchemas';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAI5D,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,eAAe,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\nexport {\n createDefaultNotebookConfig,\n createNotebookSlice,\n} from './NotebookSlice';\n\nexport {Notebook} from './Notebook';\nexport {useStoreWithNotebook} from './useStoreWithNotebook';\n\nexport type {NotebookSliceState} from './NotebookStateTypes';\n\nexport {\n InputTypes,\n NotebookSliceConfig,\n NotebookArtifactView,\n InputCell,\n NotebookCell,\n NotebookArtifact,\n NotebookArtifactMeta,\n} from './cellSchemas';\n"]}
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@sqlrooms/notebook",
3
- "version": "0.29.0-rc.1",
4
- "private": false,
3
+ "version": "0.29.0-rc.3",
5
4
  "type": "module",
6
5
  "author": "SQLRooms Contributors",
7
6
  "license": "MIT",
@@ -13,7 +12,7 @@
13
12
  ],
14
13
  "repository": {
15
14
  "type": "git",
16
- "url": "https://github.com/sqlrooms/sqlrooms.git"
15
+ "url": "git+https://github.com/sqlrooms/sqlrooms.git"
17
16
  },
18
17
  "exports": {
19
18
  ".": {
@@ -35,14 +34,15 @@
35
34
  },
36
35
  "dependencies": {
37
36
  "@paralleldrive/cuid2": "^2.2.2",
38
- "@sqlrooms/cells": "0.29.0-rc.1",
39
- "@sqlrooms/db": "0.29.0-rc.1",
40
- "@sqlrooms/room-store": "0.29.0-rc.1",
41
- "@sqlrooms/ui": "0.29.0-rc.1",
42
- "@sqlrooms/utils": "0.29.0-rc.1",
37
+ "@sqlrooms/cells": "0.29.0-rc.3",
38
+ "@sqlrooms/db": "0.29.0-rc.3",
39
+ "@sqlrooms/pivot": "0.29.0-rc.3",
40
+ "@sqlrooms/room-store": "0.29.0-rc.3",
41
+ "@sqlrooms/ui": "0.29.0-rc.3",
42
+ "@sqlrooms/utils": "0.29.0-rc.3",
43
43
  "immer": "^11.0.1",
44
44
  "lucide-react": "^0.555.0",
45
45
  "zod": "^4.1.13"
46
46
  },
47
- "gitHead": "69f127fd34bd7f2ce3d75d6098dbf8c1f5ab50f3"
47
+ "gitHead": "4ffaf6c31d41c27f96bd3e4f5e83d431968721c3"
48
48
  }