@sqlrooms/sql-editor 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 (105) hide show
  1. package/README.md +13 -3
  2. package/dist/SqlCodeMirrorEditor.d.ts +29 -0
  3. package/dist/SqlCodeMirrorEditor.d.ts.map +1 -0
  4. package/dist/SqlCodeMirrorEditor.js +54 -0
  5. package/dist/SqlCodeMirrorEditor.js.map +1 -0
  6. package/dist/SqlEditor.js +1 -1
  7. package/dist/SqlEditor.js.map +1 -1
  8. package/dist/SqlMonacoEditor.d.ts +10 -4
  9. package/dist/SqlMonacoEditor.d.ts.map +1 -1
  10. package/dist/SqlMonacoEditor.js +51 -11
  11. package/dist/SqlMonacoEditor.js.map +1 -1
  12. package/dist/codemirror/extensions/completion.d.ts +12 -0
  13. package/dist/codemirror/extensions/completion.d.ts.map +1 -0
  14. package/dist/codemirror/extensions/completion.js +60 -0
  15. package/dist/codemirror/extensions/completion.js.map +1 -0
  16. package/dist/codemirror/extensions/create-sql-extension.d.ts +17 -0
  17. package/dist/codemirror/extensions/create-sql-extension.d.ts.map +1 -0
  18. package/dist/codemirror/extensions/create-sql-extension.js +20 -0
  19. package/dist/codemirror/extensions/create-sql-extension.js.map +1 -0
  20. package/dist/codemirror/extensions/duck-db/duck-db.d.ts +9 -0
  21. package/dist/codemirror/extensions/duck-db/duck-db.d.ts.map +1 -0
  22. package/dist/codemirror/extensions/duck-db/duck-db.js +27 -0
  23. package/dist/codemirror/extensions/duck-db/duck-db.js.map +1 -0
  24. package/dist/codemirror/extensions/duck-db/duckdb-keywords.d.ts +2 -0
  25. package/dist/codemirror/extensions/duck-db/duckdb-keywords.d.ts.map +1 -0
  26. package/dist/codemirror/extensions/duck-db/duckdb-keywords.js +487 -0
  27. package/dist/codemirror/extensions/duck-db/duckdb-keywords.js.map +1 -0
  28. package/dist/codemirror/extensions/duck-db/duckdb-sql-extension.d.ts +5 -0
  29. package/dist/codemirror/extensions/duck-db/duckdb-sql-extension.d.ts.map +1 -0
  30. package/dist/codemirror/extensions/duck-db/duckdb-sql-extension.js +36 -0
  31. package/dist/codemirror/extensions/duck-db/duckdb-sql-extension.js.map +1 -0
  32. package/dist/codemirror/extensions/duck-db/duckdb-sql.d.ts +5 -0
  33. package/dist/codemirror/extensions/duck-db/duckdb-sql.d.ts.map +1 -0
  34. package/dist/codemirror/extensions/duck-db/duckdb-sql.js +11 -0
  35. package/dist/codemirror/extensions/duck-db/duckdb-sql.js.map +1 -0
  36. package/dist/codemirror/extensions/duck-db/index.d.ts +2 -0
  37. package/dist/codemirror/extensions/duck-db/index.d.ts.map +1 -0
  38. package/dist/codemirror/extensions/duck-db/index.js +2 -0
  39. package/dist/codemirror/extensions/duck-db/index.js.map +1 -0
  40. package/dist/codemirror/extensions/hover.d.ts +11 -0
  41. package/dist/codemirror/extensions/hover.d.ts.map +1 -0
  42. package/dist/codemirror/extensions/hover.js +55 -0
  43. package/dist/codemirror/extensions/hover.js.map +1 -0
  44. package/dist/codemirror/extensions/sql-keymap.d.ts +4 -0
  45. package/dist/codemirror/extensions/sql-keymap.d.ts.map +1 -0
  46. package/dist/codemirror/extensions/sql-keymap.js +25 -0
  47. package/dist/codemirror/extensions/sql-keymap.js.map +1 -0
  48. package/dist/codemirror/themes/sql-theme.d.ts +7 -0
  49. package/dist/codemirror/themes/sql-theme.d.ts.map +1 -0
  50. package/dist/codemirror/themes/sql-theme.js +55 -0
  51. package/dist/codemirror/themes/sql-theme.js.map +1 -0
  52. package/dist/codemirror/themes/sql-tooltip-theme.d.ts +7 -0
  53. package/dist/codemirror/themes/sql-tooltip-theme.d.ts.map +1 -0
  54. package/dist/codemirror/themes/sql-tooltip-theme.js +21 -0
  55. package/dist/codemirror/themes/sql-tooltip-theme.js.map +1 -0
  56. package/dist/codemirror/utils/schema-converter.d.ts +5 -0
  57. package/dist/codemirror/utils/schema-converter.d.ts.map +1 -0
  58. package/dist/codemirror/utils/schema-converter.js +9 -0
  59. package/dist/codemirror/utils/schema-converter.js.map +1 -0
  60. package/dist/components/CreateTableModal.d.ts.map +1 -1
  61. package/dist/components/CreateTableModal.js +5 -11
  62. package/dist/components/CreateTableModal.js.map +1 -1
  63. package/dist/components/FunctionDocumentation.d.ts +7 -0
  64. package/dist/components/FunctionDocumentation.d.ts.map +1 -0
  65. package/dist/components/FunctionDocumentation.js +44 -0
  66. package/dist/components/FunctionDocumentation.js.map +1 -0
  67. package/dist/components/QueryEditorPanelActions.d.ts.map +1 -1
  68. package/dist/components/QueryEditorPanelActions.js +3 -37
  69. package/dist/components/QueryEditorPanelActions.js.map +1 -1
  70. package/dist/components/QueryEditorPanelEditor.d.ts.map +1 -1
  71. package/dist/components/QueryEditorPanelEditor.js +11 -34
  72. package/dist/components/QueryEditorPanelEditor.js.map +1 -1
  73. package/dist/components/SchemaExplorer.d.ts +25 -0
  74. package/dist/components/SchemaExplorer.d.ts.map +1 -0
  75. package/dist/components/SchemaExplorer.js +20 -0
  76. package/dist/components/SchemaExplorer.js.map +1 -0
  77. package/dist/components/SqlColumnTooltip.d.ts +12 -0
  78. package/dist/components/SqlColumnTooltip.d.ts.map +1 -0
  79. package/dist/components/SqlColumnTooltip.js +15 -0
  80. package/dist/components/SqlColumnTooltip.js.map +1 -0
  81. package/dist/components/SqlColumnsTable.d.ts +10 -0
  82. package/dist/components/SqlColumnsTable.d.ts.map +1 -0
  83. package/dist/components/SqlColumnsTable.js +10 -0
  84. package/dist/components/SqlColumnsTable.js.map +1 -0
  85. package/dist/components/SqlTableTooltip.d.ts +9 -0
  86. package/dist/components/SqlTableTooltip.d.ts.map +1 -0
  87. package/dist/components/SqlTableTooltip.js +13 -0
  88. package/dist/components/SqlTableTooltip.js.map +1 -0
  89. package/dist/components/TableStructurePanel.d.ts +6 -3
  90. package/dist/components/TableStructurePanel.d.ts.map +1 -1
  91. package/dist/components/TableStructurePanel.js +8 -7
  92. package/dist/components/TableStructurePanel.js.map +1 -1
  93. package/dist/index.d.ts +21 -1
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +10 -0
  96. package/dist/index.js.map +1 -1
  97. package/dist/utils/qualified-name-parser.d.ts +41 -0
  98. package/dist/utils/qualified-name-parser.d.ts.map +1 -0
  99. package/dist/utils/qualified-name-parser.js +126 -0
  100. package/dist/utils/qualified-name-parser.js.map +1 -0
  101. package/package.json +23 -11
  102. package/dist/constants/functionSuggestions.d.ts +0 -6
  103. package/dist/constants/functionSuggestions.d.ts.map +0 -1
  104. package/dist/constants/functionSuggestions.js +0 -107
  105. package/dist/constants/functionSuggestions.js.map +0 -1
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, cn, Tooltip, TooltipContent, TooltipTrigger, } from '@sqlrooms/ui';
2
+ import { RunButton, Tooltip, TooltipContent, TooltipTrigger } from '@sqlrooms/ui';
3
3
  import { isMacOS } from '@sqlrooms/utils';
4
- import { Loader2, OctagonXIcon } from 'lucide-react';
5
4
  import { useStoreWithSqlEditor } from '../SqlEditorSlice';
6
5
  export const QueryEditorPanelActions = ({ className, }) => {
7
6
  const runCurrentQuery = useStoreWithSqlEditor((s) => s.sqlEditor.parseAndRunCurrentQuery);
@@ -14,41 +13,8 @@ export const QueryEditorPanelActions = ({ className, }) => {
14
13
  const isLoading = selectedQueryResult?.status === 'loading';
15
14
  const isAborted = selectedQueryResult?.status === 'loading' &&
16
15
  selectedQueryResult.isBeingAborted;
17
- const handleClick = () => {
18
- if (isLoading) {
19
- abortCurrentQuery();
20
- }
21
- else {
22
- runCurrentQuery();
23
- }
24
- };
25
- const getButtonContent = () => {
26
- if (isLoading) {
27
- if (isAborted) {
28
- return {
29
- icon: _jsx(Loader2, { className: "h-3 w-3 animate-spin" }),
30
- text: 'Cancelling...',
31
- disabled: true,
32
- };
33
- }
34
- else {
35
- return {
36
- icon: _jsx(Loader2, { className: "h-3 w-3 animate-spin" }),
37
- text: 'Cancel',
38
- disabled: false,
39
- rightIcon: _jsx(OctagonXIcon, { className: "h-3 w-3" }),
40
- };
41
- }
42
- }
43
- else {
44
- return {
45
- text: 'Run',
46
- disabled: false,
47
- };
48
- }
49
- };
50
- const buttonContent = getButtonContent();
51
- return (_jsxs(Tooltip, { delayDuration: 100, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(Button, { className: cn('flex h-6 items-center justify-center gap-2 px-4', className), variant: "default", size: "xs", onClick: handleClick, disabled: buttonContent.disabled, children: [buttonContent?.icon, _jsx("span", { children: buttonContent.text }), buttonContent.rightIcon] }) }), _jsx(TooltipContent, { align: "end", children: isLoading
16
+ const state = isAborted ? 'cancelling' : isLoading ? 'running' : 'idle';
17
+ return (_jsxs(Tooltip, { delayDuration: 100, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("div", { children: _jsx(RunButton, { state: state, onRun: runCurrentQuery, onCancel: abortCurrentQuery, variant: "default", cancelVariant: "default", className: className }) }) }), _jsx(TooltipContent, { align: "end", children: isLoading
52
18
  ? 'Cancel the running query'
53
19
  : `Run query (${isMac ? 'Cmd' : 'Ctrl'}+Enter)` })] }));
54
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"QueryEditorPanelActions.js","sourceRoot":"","sources":["../../src/components/QueryEditorPanelActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,EAAE,EACF,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,MAAM,uBAAuB,GAAmC,CAAC,EACtE,SAAS,GACV,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,qBAAqB,CAC3C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,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OAAO;gBACL,IAAI,EAAE,KAAK;gBACX,QAAQ,EAAE,KAAK;aAChB,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IAEzC,OAAO,CACL,MAAC,OAAO,IAAC,aAAa,EAAE,GAAG,aACzB,KAAC,cAAc,IAAC,OAAO,kBACrB,MAAC,MAAM,IACL,SAAS,EAAE,EAAE,CACX,iDAAiD,EACjD,SAAS,CACV,EACD,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,aAAa,CAAC,QAAQ,aAE/B,aAAa,EAAE,IAAI,EACpB,yBAAO,aAAa,CAAC,IAAI,GAAQ,EAChC,aAAa,CAAC,SAAS,IACjB,GACM,EACjB,KAAC,cAAc,IAAC,KAAK,EAAC,KAAK,YACxB,SAAS;oBACR,CAAC,CAAC,0BAA0B;oBAC5B,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,SAAS,GAClC,IACT,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n Button,\n cn,\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from '@sqlrooms/ui';\nimport {isMacOS} from '@sqlrooms/utils';\nimport {Loader2, OctagonXIcon} from 'lucide-react';\nimport React from 'react';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\n\nexport const QueryEditorPanelActions: React.FC<{className?: string}> = ({\n className,\n}) => {\n const runCurrentQuery = useStoreWithSqlEditor(\n (s) => s.sqlEditor.parseAndRunCurrentQuery,\n );\n const abortCurrentQuery = useStoreWithSqlEditor(\n (s) => s.sqlEditor.abortCurrentQuery,\n );\n const selectedQueryResult = useStoreWithSqlEditor((s) => {\n const selectedId = s.sqlEditor.config.selectedQueryId;\n return s.sqlEditor.queryResultsById[selectedId];\n });\n const isMac = isMacOS();\n\n const isLoading = selectedQueryResult?.status === 'loading';\n const isAborted =\n selectedQueryResult?.status === 'loading' &&\n selectedQueryResult.isBeingAborted;\n\n const handleClick = () => {\n if (isLoading) {\n abortCurrentQuery();\n } else {\n runCurrentQuery();\n }\n };\n\n const getButtonContent = (): {\n icon?: React.ReactNode;\n text: string;\n disabled: boolean;\n rightIcon?: React.ReactNode;\n } => {\n if (isLoading) {\n if (isAborted) {\n return {\n icon: <Loader2 className=\"h-3 w-3 animate-spin\" />,\n text: 'Cancelling...',\n disabled: true,\n };\n } else {\n return {\n icon: <Loader2 className=\"h-3 w-3 animate-spin\" />,\n text: 'Cancel',\n disabled: false,\n rightIcon: <OctagonXIcon className=\"h-3 w-3\" />,\n };\n }\n } else {\n return {\n text: 'Run',\n disabled: false,\n };\n }\n };\n\n const buttonContent = getButtonContent();\n\n return (\n <Tooltip delayDuration={100}>\n <TooltipTrigger asChild>\n <Button\n className={cn(\n 'flex h-6 items-center justify-center gap-2 px-4',\n className,\n )}\n variant=\"default\"\n size=\"xs\"\n onClick={handleClick}\n disabled={buttonContent.disabled}\n >\n {buttonContent?.icon}\n <span>{buttonContent.text}</span>\n {buttonContent.rightIcon}\n </Button>\n </TooltipTrigger>\n <TooltipContent align=\"end\">\n {isLoading\n ? 'Cancel the running query'\n : `Run query (${isMac ? 'Cmd' : 'Ctrl'}+Enter)`}\n </TooltipContent>\n </Tooltip>\n );\n};\n"]}
1
+ {"version":3,"file":"QueryEditorPanelActions.js","sourceRoot":"","sources":["../../src/components/QueryEditorPanelActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AAChF,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,MAAM,uBAAuB,GAAmC,CAAC,EACtE,SAAS,GACV,EAAE,EAAE;IACH,MAAM,eAAe,GAAG,qBAA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C","sourcesContent":["import {RunButton, Tooltip, TooltipContent, TooltipTrigger} from '@sqlrooms/ui';\nimport {isMacOS} from '@sqlrooms/utils';\nimport React from 'react';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\n\nexport const QueryEditorPanelActions: React.FC<{className?: string}> = ({\n className,\n}) => {\n const runCurrentQuery = useStoreWithSqlEditor(\n (s) => s.sqlEditor.parseAndRunCurrentQuery,\n );\n const abortCurrentQuery = useStoreWithSqlEditor(\n (s) => s.sqlEditor.abortCurrentQuery,\n );\n const selectedQueryResult = useStoreWithSqlEditor((s) => {\n const selectedId = s.sqlEditor.config.selectedQueryId;\n return s.sqlEditor.queryResultsById[selectedId];\n });\n const isMac = isMacOS();\n\n const isLoading = selectedQueryResult?.status === 'loading';\n const isAborted =\n selectedQueryResult?.status === 'loading' &&\n selectedQueryResult.isBeingAborted;\n\n const state = isAborted ? 'cancelling' : isLoading ? 'running' : 'idle';\n\n return (\n <Tooltip delayDuration={100}>\n <TooltipTrigger asChild>\n <div>\n <RunButton\n state={state}\n onRun={runCurrentQuery}\n onCancel={abortCurrentQuery}\n variant=\"default\"\n cancelVariant=\"default\"\n className={className}\n />\n </div>\n </TooltipTrigger>\n <TooltipContent align=\"end\">\n {isLoading\n ? 'Cancel the running query'\n : `Run query (${isMac ? 'Cmd' : 'Ctrl'}+Enter)`}\n </TooltipContent>\n </Tooltip>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryEditorPanelEditor.d.ts","sourceRoot":"","sources":["../../src/components/QueryEditorPanelEditor.tsx"],"names":[],"mappings":"AAkBA,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CA6DA,CAAC"}
1
+ {"version":3,"file":"QueryEditorPanelEditor.d.ts","sourceRoot":"","sources":["../../src/components/QueryEditorPanelEditor.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAyCA,CAAC"}
@@ -1,15 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from '@sqlrooms/ui';
3
- import { useCallback, useRef } from 'react';
3
+ import { useCallback } from 'react';
4
4
  import { useStoreWithSqlEditor } from '../SqlEditorSlice';
5
- import { SqlMonacoEditor } from '../SqlMonacoEditor';
6
- const MONACO_OPTIONS = {
7
- scrollBeyondLastLine: false,
8
- automaticLayout: true,
9
- minimap: { enabled: false },
10
- wordWrap: 'on',
11
- quickSuggestions: true,
12
- suggestOnTriggerCharacters: true,
5
+ import { SqlCodeMirrorEditor } from '../SqlCodeMirrorEditor';
6
+ const CODEMIRROR_OPTIONS = {
7
+ lineWrapping: true,
8
+ autocompletion: true,
9
+ highlightActiveLine: true,
13
10
  };
14
11
  export const QueryEditorPanelEditor = ({ className, queryId }) => {
15
12
  const tableSchemas = useStoreWithSqlEditor((s) => s.db.tables);
@@ -17,36 +14,16 @@ export const QueryEditorPanelEditor = ({ className, queryId }) => {
17
14
  const connector = useStoreWithSqlEditor((s) => s.db.connector);
18
15
  const queryText = useStoreWithSqlEditor((s) => s.sqlEditor.config.queries.find((q) => q.id === queryId)?.query);
19
16
  const updateQueryText = useStoreWithSqlEditor((s) => s.sqlEditor.updateQueryText);
20
- // Editor instance ref for keyboard shortcuts
21
- const editorRef = useRef({});
22
17
  // Handle query text update
23
18
  const handleUpdateQuery = useCallback((value) => {
24
19
  if (!value)
25
20
  return;
26
21
  updateQueryText(queryId, value);
27
22
  }, [queryId, updateQueryText]);
28
- // Handle editor mount
29
- const handleEditorMount = useCallback((editor, monaco) => {
30
- editorRef.current[queryId] = editor;
31
- // Use onKeyDown instead of addCommand to scope the shortcut
32
- // to THIS specific editor instance. Monaco's addCommand registers
33
- // globally, so the last editor mounted wins when multiple editors
34
- // are on the page.
35
- editor.onKeyDown((e) => {
36
- if ((e.ctrlKey || e.metaKey) && e.keyCode === monaco.KeyCode.Enter) {
37
- e.preventDefault();
38
- e.stopPropagation();
39
- const model = editor.getModel();
40
- const selection = editor.getSelection();
41
- if (model && selection && !selection.isEmpty()) {
42
- runQuery(model.getValueInRange(selection));
43
- }
44
- else {
45
- runQuery(editor.getValue());
46
- }
47
- }
48
- });
49
- }, [queryId, runQuery]);
50
- return (_jsx(SqlMonacoEditor, { connector: connector, value: queryText ?? '', onChange: handleUpdateQuery, className: cn('h-full w-full grow', className), options: MONACO_OPTIONS, onMount: handleEditorMount, tableSchemas: tableSchemas }));
23
+ // Handle query execution via keyboard shortcut
24
+ const handleRunQuery = useCallback((query) => {
25
+ runQuery(query);
26
+ }, [runQuery]);
27
+ return (_jsx(SqlCodeMirrorEditor, { connector: connector, value: queryText ?? '', onChange: handleUpdateQuery, className: cn('h-full w-full grow', className), options: CODEMIRROR_OPTIONS, onRunQuery: handleRunQuery, tableSchemas: tableSchemas }, queryId));
51
28
  };
52
29
  //# sourceMappingURL=QueryEditorPanelEditor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryEditorPanelEditor.js","sourceRoot":"","sources":["../../src/components/QueryEditorPanelEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAEhC,OAAO,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAKnD,MAAM,cAAc,GAAuD;IACzE,oBAAoB,EAAE,KAAK;IAC3B,eAAe,EAAE,IAAI;IACrB,OAAO,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC;IACzB,QAAQ,EAAE,IAAI;IACd,gBAAgB,EAAE,IAAI;IACtB,0BAA0B,EAAE,IAAI;CACjC,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EAAkE;QAClE,kEAAkE;QAClE,mBAAmB;QACnB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;YACrB,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACnE,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAChC,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;gBACxC,IAAI,KAAK,IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;oBAC/C,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC7C,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EACD,CAAC,OAAO,EAAE,QAAQ,CAAC,CACpB,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,IACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC9C,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,iBAAiB,EAC1B,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {cn} from '@sqlrooms/ui';\nimport type * as Monaco from 'monaco-editor';\nimport {useCallback, useRef} from 'react';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\nimport {SqlMonacoEditor} from '../SqlMonacoEditor';\n\ntype EditorInstance = Monaco.editor.IStandaloneCodeEditor;\ntype MonacoInstance = typeof Monaco;\n\nconst MONACO_OPTIONS: Monaco.editor.IStandaloneEditorConstructionOptions = {\n scrollBeyondLastLine: false,\n automaticLayout: true,\n minimap: {enabled: false},\n wordWrap: 'on',\n quickSuggestions: true,\n suggestOnTriggerCharacters: true,\n};\n\nexport const QueryEditorPanelEditor: React.FC<{\n className?: string;\n queryId: string;\n}> = ({className, queryId}) => {\n const tableSchemas = useStoreWithSqlEditor((s) => s.db.tables);\n const runQuery = useStoreWithSqlEditor((s) => s.sqlEditor.parseAndRunQuery);\n const connector = useStoreWithSqlEditor((s) => s.db.connector);\n\n const queryText = useStoreWithSqlEditor(\n (s) => s.sqlEditor.config.queries.find((q) => q.id === queryId)?.query,\n );\n const updateQueryText = useStoreWithSqlEditor(\n (s) => s.sqlEditor.updateQueryText,\n );\n // Editor instance ref for keyboard shortcuts\n const editorRef = useRef<{\n [key: string]: EditorInstance;\n }>({});\n\n // Handle query text update\n const handleUpdateQuery = useCallback(\n (value: string | undefined) => {\n if (!value) return;\n updateQueryText(queryId, value);\n },\n [queryId, updateQueryText],\n );\n\n // Handle editor mount\n const handleEditorMount = useCallback(\n (editor: EditorInstance, monaco: MonacoInstance) => {\n editorRef.current[queryId] = editor;\n // Use onKeyDown instead of addCommand to scope the shortcut\n // to THIS specific editor instance. Monaco's addCommand registers\n // globally, so the last editor mounted wins when multiple editors\n // are on the page.\n editor.onKeyDown((e) => {\n if ((e.ctrlKey || e.metaKey) && e.keyCode === monaco.KeyCode.Enter) {\n e.preventDefault();\n e.stopPropagation();\n const model = editor.getModel();\n const selection = editor.getSelection();\n if (model && selection && !selection.isEmpty()) {\n runQuery(model.getValueInRange(selection));\n } else {\n runQuery(editor.getValue());\n }\n }\n });\n },\n [queryId, runQuery],\n );\n\n return (\n <SqlMonacoEditor\n connector={connector}\n value={queryText ?? ''}\n onChange={handleUpdateQuery}\n className={cn('h-full w-full grow', className)}\n options={MONACO_OPTIONS}\n onMount={handleEditorMount}\n tableSchemas={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AAG,WAAW,CACnC,CAAC,KAAyB,EAAE,EAAE;QAC5B,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC,EACD,CAAC,OAAO,EAAE,eAAe,CAAC,CAC3B,CAAC;IAEF,+CAA+C;IAC/C,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,KAAa,EAAE,EAAE;QAChB,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,KAAC,mBAAmB,IAElB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAC9C,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,cAAc,EAC1B,YAAY,EAAE,YAAY,IAPrB,OAAO,CAQZ,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {cn} from '@sqlrooms/ui';\nimport {useCallback} from 'react';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\nimport {SqlCodeMirrorEditor} from '../SqlCodeMirrorEditor';\n\nconst CODEMIRROR_OPTIONS = {\n lineWrapping: true,\n autocompletion: true,\n highlightActiveLine: true,\n};\n\nexport const QueryEditorPanelEditor: React.FC<{\n className?: string;\n queryId: string;\n}> = ({className, queryId}) => {\n const tableSchemas = useStoreWithSqlEditor((s) => s.db.tables);\n const runQuery = useStoreWithSqlEditor((s) => s.sqlEditor.parseAndRunQuery);\n const connector = useStoreWithSqlEditor((s) => s.db.connector);\n\n const queryText = useStoreWithSqlEditor(\n (s) => s.sqlEditor.config.queries.find((q) => q.id === queryId)?.query,\n );\n const updateQueryText = useStoreWithSqlEditor(\n (s) => s.sqlEditor.updateQueryText,\n );\n\n // Handle query text update\n const handleUpdateQuery = useCallback(\n (value: string | undefined) => {\n if (!value) return;\n updateQueryText(queryId, value);\n },\n [queryId, updateQueryText],\n );\n\n // Handle query execution via keyboard shortcut\n const handleRunQuery = useCallback(\n (query: string) => {\n runQuery(query);\n },\n [runQuery],\n );\n\n return (\n <SqlCodeMirrorEditor\n key={queryId}\n connector={connector}\n value={queryText ?? ''}\n onChange={handleUpdateQuery}\n className={cn('h-full w-full grow', className)}\n options={CODEMIRROR_OPTIONS}\n onRunQuery={handleRunQuery}\n tableSchemas={tableSchemas}\n />\n );\n};\n"]}
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ export interface SchemaExplorerRootProps {
3
+ className?: string;
4
+ children?: React.ReactNode;
5
+ }
6
+ declare function SchemaExplorerRoot({ className, children }: SchemaExplorerRootProps): import("react/jsx-runtime").JSX.Element;
7
+ export interface SchemaExplorerHeaderProps {
8
+ title?: string;
9
+ children?: React.ReactNode;
10
+ }
11
+ declare function SchemaExplorerHeader({ title, children, }: SchemaExplorerHeaderProps): import("react/jsx-runtime").JSX.Element;
12
+ export interface SchemaExplorerTreeProps {
13
+ className?: string;
14
+ }
15
+ declare function SchemaExplorerTree({ className }: SchemaExplorerTreeProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare const SchemaExplorer: typeof SchemaExplorerRoot & {
17
+ Header: typeof SchemaExplorerHeader;
18
+ Tree: typeof SchemaExplorerTree;
19
+ RefreshButton: React.FC<{
20
+ className?: string;
21
+ label?: string;
22
+ }>;
23
+ };
24
+ export {};
25
+ //# sourceMappingURL=SchemaExplorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaExplorer.d.ts","sourceRoot":"","sources":["../../src/components/SchemaExplorer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,iBAAS,kBAAkB,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAC,EAAE,uBAAuB,2CAazE;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,iBAAS,oBAAoB,CAAC,EAC5B,KAAyB,EACzB,QAAQ,GACT,EAAE,yBAAyB,2CAS3B;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iBAAS,kBAAkB,CAAC,EAAC,SAAS,EAAC,EAAE,uBAAuB,2CAG/D;AAED,eAAO,MAAM,cAAc;;;;;;;CAIzB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TableSchemaTree } from '@sqlrooms/schema-tree';
3
+ import { cn, ScrollArea, ScrollBar } from '@sqlrooms/ui';
4
+ import { useStoreWithSqlEditor } from '../SqlEditorSlice';
5
+ function SchemaExplorerRoot({ className, children }) {
6
+ return (_jsxs(ScrollArea, { className: cn('relative flex h-full flex-col gap-2 overflow-auto p-2', className), children: [children, _jsx(ScrollBar, { orientation: "vertical" }), _jsx(ScrollBar, { orientation: "horizontal" })] }));
7
+ }
8
+ function SchemaExplorerHeader({ title = 'Schema Explorer', children, }) {
9
+ return (_jsxs("div", { className: "flex items-center justify-between p-1 pb-2", children: [_jsx("h2", { className: "text-muted-foreground text-xs font-medium uppercase", children: title }), _jsx("div", { className: "flex items-center gap-2", children: children })] }));
10
+ }
11
+ function SchemaExplorerTree({ className }) {
12
+ const schemaTrees = useStoreWithSqlEditor((s) => s.db.schemaTrees);
13
+ return _jsx(TableSchemaTree, { schemaTrees: schemaTrees, className: className });
14
+ }
15
+ export const SchemaExplorer = Object.assign(SchemaExplorerRoot, {
16
+ Header: SchemaExplorerHeader,
17
+ Tree: SchemaExplorerTree,
18
+ RefreshButton: TableSchemaTree.RefreshButton,
19
+ });
20
+ //# sourceMappingURL=SchemaExplorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaExplorer.js","sourceRoot":"","sources":["../../src/components/SchemaExplorer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAOxD,SAAS,kBAAkB,CAAC,EAAC,SAAS,EAAE,QAAQ,EAA0B;IACxE,OAAO,CACL,MAAC,UAAU,IACT,SAAS,EAAE,EAAE,CACX,uDAAuD,EACvD,SAAS,CACV,aAEA,QAAQ,EACT,KAAC,SAAS,IAAC,WAAW,EAAC,UAAU,GAAG,EACpC,KAAC,SAAS,IAAC,WAAW,EAAC,YAAY,GAAG,IAC3B,CACd,CAAC;AACJ,CAAC;AAOD,SAAS,oBAAoB,CAAC,EAC5B,KAAK,GAAG,iBAAiB,EACzB,QAAQ,GACkB;IAC1B,OAAO,CACL,eAAK,SAAS,EAAC,4CAA4C,aACzD,aAAI,SAAS,EAAC,qDAAqD,YAChE,KAAK,GACH,EACL,cAAK,SAAS,EAAC,yBAAyB,YAAE,QAAQ,GAAO,IACrD,CACP,CAAC;AACJ,CAAC;AAMD,SAAS,kBAAkB,CAAC,EAAC,SAAS,EAA0B;IAC9D,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;IACnE,OAAO,KAAC,eAAe,IAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,GAAI,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;IAC9D,MAAM,EAAE,oBAAoB;IAC5B,IAAI,EAAE,kBAAkB;IACxB,aAAa,EAAE,eAAe,CAAC,aAAa;CAC7C,CAAC,CAAC","sourcesContent":["import {TableSchemaTree} from '@sqlrooms/schema-tree';\nimport {cn, ScrollArea, ScrollBar} from '@sqlrooms/ui';\nimport React from 'react';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\n\nexport interface SchemaExplorerRootProps {\n className?: string;\n children?: React.ReactNode;\n}\n\nfunction SchemaExplorerRoot({className, children}: SchemaExplorerRootProps) {\n return (\n <ScrollArea\n className={cn(\n 'relative flex h-full flex-col gap-2 overflow-auto p-2',\n className,\n )}\n >\n {children}\n <ScrollBar orientation=\"vertical\" />\n <ScrollBar orientation=\"horizontal\" />\n </ScrollArea>\n );\n}\n\nexport interface SchemaExplorerHeaderProps {\n title?: string;\n children?: React.ReactNode;\n}\n\nfunction SchemaExplorerHeader({\n title = 'Schema Explorer',\n children,\n}: SchemaExplorerHeaderProps) {\n return (\n <div className=\"flex items-center justify-between p-1 pb-2\">\n <h2 className=\"text-muted-foreground text-xs font-medium uppercase\">\n {title}\n </h2>\n <div className=\"flex items-center gap-2\">{children}</div>\n </div>\n );\n}\n\nexport interface SchemaExplorerTreeProps {\n className?: string;\n}\n\nfunction SchemaExplorerTree({className}: SchemaExplorerTreeProps) {\n const schemaTrees = useStoreWithSqlEditor((s) => s.db.schemaTrees);\n return <TableSchemaTree schemaTrees={schemaTrees} className={className} />;\n}\n\nexport const SchemaExplorer = Object.assign(SchemaExplorerRoot, {\n Header: SchemaExplorerHeader,\n Tree: SchemaExplorerTree,\n RefreshButton: TableSchemaTree.RefreshButton,\n});\n"]}
@@ -0,0 +1,12 @@
1
+ import type React from 'react';
2
+ import type { DataTable } from '@sqlrooms/duckdb';
3
+ import type { NamespaceTooltipData } from '@marimo-team/codemirror-sql';
4
+ export interface SqlColumnTooltipProps {
5
+ data: NamespaceTooltipData;
6
+ tables: DataTable[];
7
+ }
8
+ /**
9
+ * React component for column tooltip
10
+ */
11
+ export declare const SqlColumnTooltip: React.FC<SqlColumnTooltipProps>;
12
+ //# sourceMappingURL=SqlColumnTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlColumnTooltip.d.ts","sourceRoot":"","sources":["../../src/components/SqlColumnTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AAQtE,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqC5D,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getDuckDbTypeCategory } from '@sqlrooms/duckdb';
3
+ import { ColumnTypeBadge } from '@sqlrooms/data-table';
4
+ import { Badge } from '@sqlrooms/ui';
5
+ import { parseQualifiedColumnName, findTableAndColumn, } from '../utils/qualified-name-parser';
6
+ /**
7
+ * React component for column tooltip
8
+ */
9
+ export const SqlColumnTooltip = ({ data, tables, }) => {
10
+ const qualifiedName = parseQualifiedColumnName(data.word);
11
+ const { table, column } = findTableAndColumn(qualifiedName, tables) ?? {};
12
+ const tableTypeLabel = table?.isView ? 'view' : 'table';
13
+ return (_jsxs("div", { className: "flex flex-col gap-1.5 text-xs", children: [_jsxs("div", { className: "flex flex-row gap-1 text-sm", children: [_jsx("strong", { className: "text-foreground!", children: qualifiedName.columnName }), _jsx(Badge, { variant: "secondary", className: "text-[9px] uppercase", children: "column" })] }), column && (_jsxs("div", { className: "flex flex-row gap-1", children: [_jsx("strong", { className: "text-foreground!", children: "Type:" }), _jsx(ColumnTypeBadge, { columnType: column.type, typeCategory: getDuckDbTypeCategory(column.type) })] })), table && (_jsxs("div", { className: "flex flex-row gap-1", children: [_jsx("strong", { className: "text-foreground!", children: "From:" }), ' ', table.table.table, _jsx(Badge, { variant: "secondary", className: "text-[9px] uppercase", children: tableTypeLabel })] }))] }));
14
+ };
15
+ //# sourceMappingURL=SqlColumnTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlColumnTooltip.js","sourceRoot":"","sources":["../../src/components/SqlColumnTooltip.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AAOxC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAChE,IAAI,EACJ,MAAM,GACP,EAAE,EAAE;IACH,MAAM,aAAa,GAAG,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,EAAC,KAAK,EAAE,MAAM,EAAC,GAAG,kBAAkB,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAExE,MAAM,cAAc,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAExD,OAAO,CACL,eAAK,SAAS,EAAC,+BAA+B,aAC5C,eAAK,SAAS,EAAC,6BAA6B,aAC1C,iBAAQ,SAAS,EAAC,kBAAkB,YAAE,aAAa,CAAC,UAAU,GAAU,EACxE,KAAC,KAAK,IAAC,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,sBAAsB,uBAEnD,IACJ,EACL,MAAM,IAAI,CACT,eAAK,SAAS,EAAC,qBAAqB,aAClC,iBAAQ,SAAS,EAAC,kBAAkB,sBAAe,EACnD,KAAC,eAAe,IACd,UAAU,EAAE,MAAM,CAAC,IAAI,EACvB,YAAY,EAAE,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,GAChD,IACE,CACP,EACA,KAAK,IAAI,CACR,eAAK,SAAS,EAAC,qBAAqB,aAClC,iBAAQ,SAAS,EAAC,kBAAkB,sBAAe,EAAC,GAAG,EACtD,KAAK,CAAC,KAAK,CAAC,KAAK,EAClB,KAAC,KAAK,IAAC,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,sBAAsB,YACxD,cAAc,GACT,IACJ,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type React from 'react';\nimport type {DataTable} from '@sqlrooms/duckdb';\nimport {getDuckDbTypeCategory} from '@sqlrooms/duckdb';\nimport type {NamespaceTooltipData} from '@marimo-team/codemirror-sql';\nimport {ColumnTypeBadge} from '@sqlrooms/data-table';\nimport {Badge} from '@sqlrooms/ui';\nimport {\n parseQualifiedColumnName,\n findTableAndColumn,\n} from '../utils/qualified-name-parser';\n\nexport interface SqlColumnTooltipProps {\n data: NamespaceTooltipData;\n tables: DataTable[];\n}\n\n/**\n * React component for column tooltip\n */\nexport const SqlColumnTooltip: React.FC<SqlColumnTooltipProps> = ({\n data,\n tables,\n}) => {\n const qualifiedName = parseQualifiedColumnName(data.word);\n const {table, column} = findTableAndColumn(qualifiedName, tables) ?? {};\n\n const tableTypeLabel = table?.isView ? 'view' : 'table';\n\n return (\n <div className=\"flex flex-col gap-1.5 text-xs\">\n <div className=\"flex flex-row gap-1 text-sm\">\n <strong className=\"text-foreground!\">{qualifiedName.columnName}</strong>\n <Badge variant=\"secondary\" className=\"text-[9px] uppercase\">\n column\n </Badge>\n </div>\n {column && (\n <div className=\"flex flex-row gap-1\">\n <strong className=\"text-foreground!\">Type:</strong>\n <ColumnTypeBadge\n columnType={column.type}\n typeCategory={getDuckDbTypeCategory(column.type)}\n />\n </div>\n )}\n {table && (\n <div className=\"flex flex-row gap-1\">\n <strong className=\"text-foreground!\">From:</strong>{' '}\n {table.table.table}\n <Badge variant=\"secondary\" className=\"text-[9px] uppercase\">\n {tableTypeLabel}\n </Badge>\n </div>\n )}\n </div>\n );\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import type React from 'react';
2
+ import type { TableColumn } from '@sqlrooms/duckdb';
3
+ export interface SqlColumnsTableProps {
4
+ columns: TableColumn[];
5
+ }
6
+ /**
7
+ * Component for displaying a table of columns with their types
8
+ */
9
+ export declare const SqlColumnsTable: React.FC<SqlColumnsTableProps>;
10
+ //# sourceMappingURL=SqlColumnsTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlColumnsTable.d.ts","sourceRoot":"","sources":["../../src/components/SqlColumnsTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAIlD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqC1D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { getDuckDbTypeCategory } from '@sqlrooms/duckdb';
3
+ import { ColumnTypeBadge } from '@sqlrooms/data-table';
4
+ /**
5
+ * Component for displaying a table of columns with their types
6
+ */
7
+ export const SqlColumnsTable = ({ columns }) => {
8
+ return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("div", { className: "font-semibold", children: ["Columns (", columns.length, ")"] }), _jsx("div", { className: "max-h-[200px] overflow-y-auto", children: _jsxs("table", { className: "w-full border-collapse", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "border-border bg-muted border-b px-2 py-1 text-left font-semibold", children: "Name" }), _jsx("th", { className: "border-border bg-muted border-b px-2 py-1 text-left font-semibold", children: "Type" })] }) }), _jsx("tbody", { children: columns.map((col) => (_jsxs("tr", { children: [_jsx("td", { className: "border-border border-b px-2 py-1", children: _jsx("code", { className: "bg-muted! text-foreground! rounded-sm px-1 py-0.5 font-mono", children: col.name }) }), _jsx("td", { className: "border-border border-b px-2 py-1", children: _jsx(ColumnTypeBadge, { columnType: col.type, typeCategory: getDuckDbTypeCategory(col.type) }) })] }, col.name))) })] }) })] }));
9
+ };
10
+ //# sourceMappingURL=SqlColumnsTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlColumnsTable.js","sourceRoot":"","sources":["../../src/components/SqlColumnsTable.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAMrD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAmC,CAAC,EAAC,OAAO,EAAC,EAAE,EAAE;IAC3E,OAAO,CACL,eAAK,SAAS,EAAC,uBAAuB,aACpC,eAAK,SAAS,EAAC,eAAe,0BAAW,OAAO,CAAC,MAAM,SAAQ,EAC/D,cAAK,SAAS,EAAC,+BAA+B,YAC5C,iBAAO,SAAS,EAAC,wBAAwB,aACvC,0BACE,yBACE,aAAI,SAAS,EAAC,mEAAmE,qBAE5E,EACL,aAAI,SAAS,EAAC,mEAAmE,qBAE5E,IACF,GACC,EACR,0BACG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACpB,yBACE,aAAI,SAAS,EAAC,kCAAkC,YAC9C,eAAM,SAAS,EAAC,6DAA6D,YAC1E,GAAG,CAAC,IAAI,GACJ,GACJ,EACL,aAAI,SAAS,EAAC,kCAAkC,YAC9C,KAAC,eAAe,IACd,UAAU,EAAE,GAAG,CAAC,IAAI,EACpB,YAAY,EAAE,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,GAC7C,GACC,KAXE,GAAG,CAAC,IAAI,CAYZ,CACN,CAAC,GACI,IACF,GACJ,IACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type React from 'react';\nimport type {TableColumn} from '@sqlrooms/duckdb';\nimport {getDuckDbTypeCategory} from '@sqlrooms/duckdb';\nimport {ColumnTypeBadge} from '@sqlrooms/data-table';\n\nexport interface SqlColumnsTableProps {\n columns: TableColumn[];\n}\n\n/**\n * Component for displaying a table of columns with their types\n */\nexport const SqlColumnsTable: React.FC<SqlColumnsTableProps> = ({columns}) => {\n return (\n <div className=\"flex flex-col gap-1.5\">\n <div className=\"font-semibold\">Columns ({columns.length})</div>\n <div className=\"max-h-[200px] overflow-y-auto\">\n <table className=\"w-full border-collapse\">\n <thead>\n <tr>\n <th className=\"border-border bg-muted border-b px-2 py-1 text-left font-semibold\">\n Name\n </th>\n <th className=\"border-border bg-muted border-b px-2 py-1 text-left font-semibold\">\n Type\n </th>\n </tr>\n </thead>\n <tbody>\n {columns.map((col) => (\n <tr key={col.name}>\n <td className=\"border-border border-b px-2 py-1\">\n <code className=\"bg-muted! text-foreground! rounded-sm px-1 py-0.5 font-mono\">\n {col.name}\n </code>\n </td>\n <td className=\"border-border border-b px-2 py-1\">\n <ColumnTypeBadge\n columnType={col.type}\n typeCategory={getDuckDbTypeCategory(col.type)}\n />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </div>\n );\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import type React from 'react';
2
+ import type { DataTable } from '@sqlrooms/duckdb';
3
+ import type { NamespaceTooltipData } from '@marimo-team/codemirror-sql';
4
+ export interface SqlTableTooltipProps {
5
+ data: NamespaceTooltipData;
6
+ tables: DataTable[];
7
+ }
8
+ export declare const SqlTableTooltip: React.FC<SqlTableTooltipProps>;
9
+ //# sourceMappingURL=SqlTableTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlTableTooltip.d.ts","sourceRoot":"","sources":["../../src/components/SqlTableTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AAQtE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA2B1D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Badge } from '@sqlrooms/ui';
3
+ import { SqlColumnsTable } from './SqlColumnsTable';
4
+ import { parseQualifiedTableName, findTable, } from '../utils/qualified-name-parser';
5
+ export const SqlTableTooltip = ({ data: { word: tableName }, tables, }) => {
6
+ const qualifiedName = parseQualifiedTableName(tableName);
7
+ const table = findTable(qualifiedName, tables);
8
+ const typeLabel = table?.isView ? 'view' : 'table';
9
+ const rowCount = table?.rowCount;
10
+ const columns = table?.columns;
11
+ return (_jsxs("div", { className: "flex flex-col gap-1.5 text-xs", children: [_jsxs("div", { className: "flex flex-row gap-1 text-sm", children: [_jsx("strong", { className: "text-foreground!", children: tableName }), _jsx(Badge, { variant: "secondary", className: "text-[9px] uppercase", children: typeLabel })] }), columns && _jsx(SqlColumnsTable, { columns: columns }), rowCount !== undefined && (_jsxs("div", { className: "text-muted-foreground", children: [rowCount.toLocaleString(), " rows"] }))] }));
12
+ };
13
+ //# sourceMappingURL=SqlTableTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlTableTooltip.js","sourceRoot":"","sources":["../../src/components/SqlTableTooltip.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,uBAAuB,EACvB,SAAS,GACV,MAAM,gCAAgC,CAAC;AAOxC,MAAM,CAAC,MAAM,eAAe,GAAmC,CAAC,EAC9D,IAAI,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC,EACvB,MAAM,GACP,EAAE,EAAE;IACH,MAAM,aAAa,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,KAAK,GAAG,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAE/C,MAAM,SAAS,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACnD,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAQ,CAAC;IACjC,MAAM,OAAO,GAAG,KAAK,EAAE,OAAO,CAAC;IAE/B,OAAO,CACL,eAAK,SAAS,EAAC,+BAA+B,aAC5C,eAAK,SAAS,EAAC,6BAA6B,aAC1C,iBAAQ,SAAS,EAAC,kBAAkB,YAAE,SAAS,GAAU,EACzD,KAAC,KAAK,IAAC,OAAO,EAAC,WAAW,EAAC,SAAS,EAAC,sBAAsB,YACxD,SAAS,GACJ,IACJ,EACL,OAAO,IAAI,KAAC,eAAe,IAAC,OAAO,EAAE,OAAO,GAAI,EAChD,QAAQ,KAAK,SAAS,IAAI,CACzB,eAAK,SAAS,EAAC,uBAAuB,aACnC,QAAQ,CAAC,cAAc,EAAE,aACtB,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type React from 'react';\nimport type {DataTable} from '@sqlrooms/duckdb';\nimport type {NamespaceTooltipData} from '@marimo-team/codemirror-sql';\nimport {Badge} from '@sqlrooms/ui';\nimport {SqlColumnsTable} from './SqlColumnsTable';\nimport {\n parseQualifiedTableName,\n findTable,\n} from '../utils/qualified-name-parser';\n\nexport interface SqlTableTooltipProps {\n data: NamespaceTooltipData;\n tables: DataTable[];\n}\n\nexport const SqlTableTooltip: React.FC<SqlTableTooltipProps> = ({\n data: {word: tableName},\n tables,\n}) => {\n const qualifiedName = parseQualifiedTableName(tableName);\n const table = findTable(qualifiedName, tables);\n\n const typeLabel = table?.isView ? 'view' : 'table';\n const rowCount = table?.rowCount;\n const columns = table?.columns;\n\n return (\n <div className=\"flex flex-col gap-1.5 text-xs\">\n <div className=\"flex flex-row gap-1 text-sm\">\n <strong className=\"text-foreground!\">{tableName}</strong>\n <Badge variant=\"secondary\" className=\"text-[9px] uppercase\">\n {typeLabel}\n </Badge>\n </div>\n {columns && <SqlColumnsTable columns={columns} />}\n {rowCount !== undefined && (\n <div className=\"text-muted-foreground\">\n {rowCount.toLocaleString()} rows\n </div>\n )}\n </div>\n );\n};\n"]}
@@ -1,13 +1,16 @@
1
1
  import React from 'react';
2
+ /**
3
+ * @deprecated Use `SchemaExplorer` instead.
4
+ */
2
5
  export interface TableStructurePanelProps {
3
- /** Custom class name for styling */
4
6
  className?: string;
5
7
  /** The database schema to use. Defaults to '*'.
6
8
  * If '*' is provided, all tables will be shown.
7
9
  * If a function is provided, it will be used to filter the tables. */
8
10
  schema?: string | ((name: string) => boolean);
9
- /** Callback when a table is selected */
10
- onTableSelect?: (table: string | undefined) => void;
11
11
  }
12
+ /**
13
+ * @deprecated Use `SchemaExplorer` instead.
14
+ */
12
15
  export declare const TableStructurePanel: React.FC<TableStructurePanelProps>;
13
16
  //# sourceMappingURL=TableStructurePanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableStructurePanel.d.ts","sourceRoot":"","sources":["../../src/components/TableStructurePanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAgB,MAAM,OAAO,CAAC;AAGrC,MAAM,WAAW,wBAAwB;IACvC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;0EAEsE;IACtE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAC9C,wCAAwC;IACxC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACrD;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAqClE,CAAC"}
1
+ {"version":3,"file":"TableStructurePanel.d.ts","sourceRoot":"","sources":["../../src/components/TableStructurePanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAgB,MAAM,OAAO,CAAC;AAGrC;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;0EAEsE;IACtE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;CAC/C;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAkClE,CAAC"}
@@ -1,21 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { TableSchemaTree } from '@sqlrooms/schema-tree';
3
- import { cn, ScrollArea, ScrollBar, SpinnerPane } from '@sqlrooms/ui';
3
+ import { cn, ScrollArea, ScrollBar } from '@sqlrooms/ui';
4
4
  import { useMemo } from 'react';
5
5
  import { useStoreWithSqlEditor } from '../SqlEditorSlice';
6
+ /**
7
+ * @deprecated Use `SchemaExplorer` instead.
8
+ */
6
9
  export const TableStructurePanel = ({ className, schema = '*', }) => {
7
- // Get state from store
8
10
  const schemaTrees = useStoreWithSqlEditor((s) => s.db.schemaTrees);
9
11
  const filteredSchemaTrees = useMemo(() => {
10
12
  if (schema === '*') {
11
- return schemaTrees;
13
+ return schemaTrees ?? [];
12
14
  }
13
15
  if (typeof schema === 'function') {
14
- return schemaTrees?.filter((tree) => schema(tree.object.name));
16
+ return schemaTrees?.filter((tree) => schema(tree.object.name)) ?? [];
15
17
  }
16
- return schemaTrees?.filter((tree) => tree.object.name === schema);
18
+ return schemaTrees?.filter((tree) => tree.object.name === schema) ?? [];
17
19
  }, [schema, schemaTrees]);
18
- const isRefreshing = useStoreWithSqlEditor((s) => s.db.isRefreshingTableSchemas);
19
- return (_jsxs(ScrollArea, { className: cn('relative flex h-full flex-col gap-2 overflow-auto p-2', className), children: [filteredSchemaTrees && (_jsx(TableSchemaTree, { schemaTrees: filteredSchemaTrees })), isRefreshing && (_jsx(SpinnerPane, { className: "bg-background/80 absolute inset-0 h-full" })), _jsx(ScrollBar, { orientation: "vertical" }), _jsx(ScrollBar, { orientation: "horizontal" })] }));
20
+ return (_jsxs(ScrollArea, { className: cn('relative flex h-full flex-col gap-2 overflow-auto p-2', className), children: [_jsxs("div", { className: "flex items-center justify-between pb-2", children: [_jsx("h2", { className: "text-muted-foreground text-xs font-medium uppercase", children: "Schema Explorer" }), _jsx(TableSchemaTree.RefreshButton, {})] }), _jsx(TableSchemaTree, { schemaTrees: filteredSchemaTrees, className: "h-full" }), _jsx(ScrollBar, { orientation: "vertical" }), _jsx(ScrollBar, { orientation: "horizontal" })] }));
20
21
  };
21
22
  //# sourceMappingURL=TableStructurePanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableStructurePanel.js","sourceRoot":"","sources":["../../src/components/TableStructurePanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AACpE,OAAc,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAaxD,MAAM,CAAC,MAAM,mBAAmB,GAAuC,CAAC,EACtE,SAAS,EACT,MAAM,GAAG,GAAG,GACb,EAAE,EAAE;IACH,uBAAuB;IACvB,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;IACnE,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE;QACvC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,OAAO,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IACpE,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAE1B,MAAM,YAAY,GAAG,qBAAqB,CACxC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,wBAAwB,CACrC,CAAC;IAEF,OAAO,CACL,MAAC,UAAU,IACT,SAAS,EAAE,EAAE,CACX,uDAAuD,EACvD,SAAS,CACV,aAEA,mBAAmB,IAAI,CACtB,KAAC,eAAe,IAAC,WAAW,EAAE,mBAAmB,GAAI,CACtD,EACA,YAAY,IAAI,CACf,KAAC,WAAW,IAAC,SAAS,EAAC,0CAA0C,GAAG,CACrE,EACD,KAAC,SAAS,IAAC,WAAW,EAAC,UAAU,GAAG,EACpC,KAAC,SAAS,IAAC,WAAW,EAAC,YAAY,GAAG,IAC3B,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {TableSchemaTree} from '@sqlrooms/schema-tree';\nimport {cn, ScrollArea, ScrollBar, SpinnerPane} from '@sqlrooms/ui';\nimport React, {useMemo} from 'react';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\n\nexport interface TableStructurePanelProps {\n /** Custom class name for styling */\n className?: string;\n /** The database schema to use. Defaults to '*'.\n * If '*' is provided, all tables will be shown.\n * If a function is provided, it will be used to filter the tables. */\n schema?: string | ((name: string) => boolean);\n /** Callback when a table is selected */\n onTableSelect?: (table: string | undefined) => void;\n}\n\nexport const TableStructurePanel: React.FC<TableStructurePanelProps> = ({\n className,\n schema = '*',\n}) => {\n // Get state from store\n const schemaTrees = useStoreWithSqlEditor((s) => s.db.schemaTrees);\n const filteredSchemaTrees = useMemo(() => {\n if (schema === '*') {\n return schemaTrees;\n }\n if (typeof schema === 'function') {\n return schemaTrees?.filter((tree) => schema(tree.object.name));\n }\n return schemaTrees?.filter((tree) => tree.object.name === schema);\n }, [schema, schemaTrees]);\n\n const isRefreshing = useStoreWithSqlEditor(\n (s) => s.db.isRefreshingTableSchemas,\n );\n\n return (\n <ScrollArea\n className={cn(\n 'relative flex h-full flex-col gap-2 overflow-auto p-2',\n className,\n )}\n >\n {filteredSchemaTrees && (\n <TableSchemaTree schemaTrees={filteredSchemaTrees} />\n )}\n {isRefreshing && (\n <SpinnerPane className=\"bg-background/80 absolute inset-0 h-full\" />\n )}\n <ScrollBar orientation=\"vertical\" />\n <ScrollBar orientation=\"horizontal\" />\n </ScrollArea>\n );\n};\n"]}
1
+ {"version":3,"file":"TableStructurePanel.js","sourceRoot":"","sources":["../../src/components/TableStructurePanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACvD,OAAc,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAaxD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAuC,CAAC,EACtE,SAAS,EACT,MAAM,GAAG,GAAG,GACb,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;IACnE,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE;QACvC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,OAAO,WAAW,IAAI,EAAE,CAAC;QAC3B,CAAC;QACD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,OAAO,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACvE,CAAC;QACD,OAAO,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;IAC1E,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAE1B,OAAO,CACL,MAAC,UAAU,IACT,SAAS,EAAE,EAAE,CACX,uDAAuD,EACvD,SAAS,CACV,aAED,eAAK,SAAS,EAAC,wCAAwC,aACrD,aAAI,SAAS,EAAC,qDAAqD,gCAE9D,EACL,KAAC,eAAe,CAAC,aAAa,KAAG,IAC7B,EAEN,KAAC,eAAe,IAAC,WAAW,EAAE,mBAAmB,EAAE,SAAS,EAAC,QAAQ,GAAG,EACxE,KAAC,SAAS,IAAC,WAAW,EAAC,UAAU,GAAG,EACpC,KAAC,SAAS,IAAC,WAAW,EAAC,YAAY,GAAG,IAC3B,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {TableSchemaTree} from '@sqlrooms/schema-tree';\nimport {cn, ScrollArea, ScrollBar} from '@sqlrooms/ui';\nimport React, {useMemo} from 'react';\nimport {useStoreWithSqlEditor} from '../SqlEditorSlice';\n\n/**\n * @deprecated Use `SchemaExplorer` instead.\n */\nexport interface TableStructurePanelProps {\n className?: string;\n /** The database schema to use. Defaults to '*'.\n * If '*' is provided, all tables will be shown.\n * If a function is provided, it will be used to filter the tables. */\n schema?: string | ((name: string) => boolean);\n}\n\n/**\n * @deprecated Use `SchemaExplorer` instead.\n */\nexport const TableStructurePanel: React.FC<TableStructurePanelProps> = ({\n className,\n schema = '*',\n}) => {\n const schemaTrees = useStoreWithSqlEditor((s) => s.db.schemaTrees);\n const filteredSchemaTrees = useMemo(() => {\n if (schema === '*') {\n return schemaTrees ?? [];\n }\n if (typeof schema === 'function') {\n return schemaTrees?.filter((tree) => schema(tree.object.name)) ?? [];\n }\n return schemaTrees?.filter((tree) => tree.object.name === schema) ?? [];\n }, [schema, schemaTrees]);\n\n return (\n <ScrollArea\n className={cn(\n 'relative flex h-full flex-col gap-2 overflow-auto p-2',\n className,\n )}\n >\n <div className=\"flex items-center justify-between pb-2\">\n <h2 className=\"text-muted-foreground text-xs font-medium uppercase\">\n Schema Explorer\n </h2>\n <TableSchemaTree.RefreshButton />\n </div>\n\n <TableSchemaTree schemaTrees={filteredSchemaTrees} className=\"h-full\" />\n <ScrollBar orientation=\"vertical\" />\n <ScrollBar orientation=\"horizontal\" />\n </ScrollArea>\n );\n};\n"]}
package/dist/index.d.ts CHANGED
@@ -10,9 +10,29 @@ export { default as SqlEditorModal } from './SqlEditorModal';
10
10
  export { createSqlEditorSlice } from './SqlEditorSlice';
11
11
  export type { QueryResult, SqlEditorSliceState } from './SqlEditorSlice';
12
12
  export { SqlQueryDataSourcesPanel } from './components/SqlQueryDataSourcesPanel';
13
+ /**
14
+ * @deprecated Use SqlCodeMirrorEditor instead.
15
+ * SqlMonacoEditor will be removed in the next major version.
16
+ */
13
17
  export { SqlMonacoEditor } from './SqlMonacoEditor';
14
- export type { SqlMonacoEditorProps } from './SqlMonacoEditor';
18
+ /**
19
+ * @deprecated Use SqlCodeMirrorEditor instead.
20
+ * SqlMonacoEditor will be removed in the next major version.
21
+ */
22
+ export type { SqlMonacoEditorProps, SqlMonacoRunQueryOptions, } from './SqlMonacoEditor';
23
+ export { SqlCodeMirrorEditor } from './SqlCodeMirrorEditor';
24
+ export type { SqlCodeMirrorEditorProps } from './SqlCodeMirrorEditor';
25
+ export { SqlDialects } from './codemirror/extensions/create-sql-extension';
26
+ export type { SqlDialect } from './codemirror/extensions/create-sql-extension';
27
+ export { SchemaExplorer } from './components/SchemaExplorer';
28
+ export type { SchemaExplorerRootProps, SchemaExplorerHeaderProps, SchemaExplorerTreeProps, } from './components/SchemaExplorer';
29
+ /**
30
+ * @deprecated Use `SchemaExplorer` instead.
31
+ */
15
32
  export { TableStructurePanel } from './components/TableStructurePanel';
33
+ /**
34
+ * @deprecated Use `SchemaExplorer` instead.
35
+ */
16
36
  export type { TableStructurePanelProps } from './components/TableStructurePanel';
17
37
  export { QueryResultPanel } from './components/QueryResultPanel';
18
38
  export type { QueryResultPanelProps, QueryResultPanelAskAiProps, } from './components/QueryResultPanel';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EACV,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AACjD,YAAY,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AACtD,YAAY,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,YAAY,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AACrE,YAAY,EAAC,wBAAwB,EAAC,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,C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uCAAuC,CAAC;AAC/E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAC3E,YAAY,EAAC,2BAA2B,EAAC,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,YAAY,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AAIvE,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -7,7 +7,17 @@ export { default as SqlEditor } from './SqlEditor';
7
7
  export { default as SqlEditorModal } from './SqlEditorModal';
8
8
  export { createSqlEditorSlice } from './SqlEditorSlice';
9
9
  export { SqlQueryDataSourcesPanel } from './components/SqlQueryDataSourcesPanel';
10
+ /**
11
+ * @deprecated Use SqlCodeMirrorEditor instead.
12
+ * SqlMonacoEditor will be removed in the next major version.
13
+ */
10
14
  export { SqlMonacoEditor } from './SqlMonacoEditor';
15
+ export { SqlCodeMirrorEditor } from './SqlCodeMirrorEditor';
16
+ export { SqlDialects } from './codemirror/extensions/create-sql-extension';
17
+ export { SchemaExplorer } from './components/SchemaExplorer';
18
+ /**
19
+ * @deprecated Use `SchemaExplorer` instead.
20
+ */
11
21
  export { TableStructurePanel } from './components/TableStructurePanel';
12
22
  export { QueryResultPanel } from './components/QueryResultPanel';
13
23
  export { SqlEditorHeader } from './components/SqlEditorHeader';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAK1E,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAK/D,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAC,uBAAuB,EAAC,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAG7D,6CAA6C;AAC7C,2EAA2E;AAC3E,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\nexport {default as CreateTableModal} from './components/CreateTableModal';\nexport type {\n CreateTableModalProps,\n CreateTableFormInitialValues,\n} from './components/CreateTableModal';\nexport {default as SqlEditor} from './SqlEditor';\nexport type {SqlEditorProps} from './SqlEditor';\nexport {default as SqlEditorModal} from './SqlEditorModal';\nexport {createSqlEditorSlice} from './SqlEditorSlice';\nexport type {QueryResult, SqlEditorSliceState} from './SqlEditorSlice';\nexport {SqlQueryDataSourcesPanel} from './components/SqlQueryDataSourcesPanel';\nexport {SqlMonacoEditor} from './SqlMonacoEditor';\nexport type {SqlMonacoEditorProps} from './SqlMonacoEditor';\nexport {TableStructurePanel} from './components/TableStructurePanel';\nexport type {TableStructurePanelProps} from './components/TableStructurePanel';\nexport {QueryResultPanel} from './components/QueryResultPanel';\nexport type {\n QueryResultPanelProps,\n QueryResultPanelAskAiProps,\n} from './components/QueryResultPanel';\nexport {SqlEditorHeader} from './components/SqlEditorHeader';\nexport type {SqlEditorHeaderProps} from './components/SqlEditorHeader';\nexport {\n SqlReferenceButton,\n SqlReferenceButtonContent,\n} from './components/SqlReferenceButton';\nexport {QueryEditorPanel} from './components/QueryEditorPanel';\nexport type {QueryEditorPanelProps} from './components/QueryEditorPanel';\nexport {QueryEditorPanelActions} from './components/QueryEditorPanelActions';\nexport {QueryEditorPanelTabsList} from './components/QueryEditorPanelTabsList';\nexport {QueryEditorPanelEditor} from './components/QueryEditorPanelEditor';\nexport {QueryResultLimitSelect} from './components/QueryResultLimitSelect';\nexport type {QueryResultLimitSelectProps} from './components/QueryResultLimitSelect';\nexport {SqlQueryPreview} from './components/SqlQueryPreview';\nexport type {SqlQueryPreviewProps} from './components/SqlQueryPreview';\n\n// Re-export from @sqlrooms/sql-editor-config\n// Values also export their corresponding types automatically (Zod pattern)\nexport {\n SqlEditorSliceConfig,\n createDefaultSqlEditorConfig,\n} from '@sqlrooms/sql-editor-config';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAK1E,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E;;;GAGG;AACH,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AASlD,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,WAAW,EAAC,MAAM,8CAA8C,CAAC;AAEzE,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAM3D;;GAEG;AACH,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAKrE,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAK/D,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAC,uBAAuB,EAAC,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAG7D,6CAA6C;AAC7C,2EAA2E;AAC3E,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\nexport {default as CreateTableModal} from './components/CreateTableModal';\nexport type {\n CreateTableModalProps,\n CreateTableFormInitialValues,\n} from './components/CreateTableModal';\nexport {default as SqlEditor} from './SqlEditor';\nexport type {SqlEditorProps} from './SqlEditor';\nexport {default as SqlEditorModal} from './SqlEditorModal';\nexport {createSqlEditorSlice} from './SqlEditorSlice';\nexport type {QueryResult, SqlEditorSliceState} from './SqlEditorSlice';\nexport {SqlQueryDataSourcesPanel} from './components/SqlQueryDataSourcesPanel';\n/**\n * @deprecated Use SqlCodeMirrorEditor instead.\n * SqlMonacoEditor will be removed in the next major version.\n */\nexport {SqlMonacoEditor} from './SqlMonacoEditor';\n/**\n * @deprecated Use SqlCodeMirrorEditor instead.\n * SqlMonacoEditor will be removed in the next major version.\n */\nexport type {\n SqlMonacoEditorProps,\n SqlMonacoRunQueryOptions,\n} from './SqlMonacoEditor';\nexport {SqlCodeMirrorEditor} from './SqlCodeMirrorEditor';\nexport type {SqlCodeMirrorEditorProps} from './SqlCodeMirrorEditor';\nexport {SqlDialects} from './codemirror/extensions/create-sql-extension';\nexport type {SqlDialect} from './codemirror/extensions/create-sql-extension';\nexport {SchemaExplorer} from './components/SchemaExplorer';\nexport type {\n SchemaExplorerRootProps,\n SchemaExplorerHeaderProps,\n SchemaExplorerTreeProps,\n} from './components/SchemaExplorer';\n/**\n * @deprecated Use `SchemaExplorer` instead.\n */\nexport {TableStructurePanel} from './components/TableStructurePanel';\n/**\n * @deprecated Use `SchemaExplorer` instead.\n */\nexport type {TableStructurePanelProps} from './components/TableStructurePanel';\nexport {QueryResultPanel} from './components/QueryResultPanel';\nexport type {\n QueryResultPanelProps,\n QueryResultPanelAskAiProps,\n} from './components/QueryResultPanel';\nexport {SqlEditorHeader} from './components/SqlEditorHeader';\nexport type {SqlEditorHeaderProps} from './components/SqlEditorHeader';\nexport {\n SqlReferenceButton,\n SqlReferenceButtonContent,\n} from './components/SqlReferenceButton';\nexport {QueryEditorPanel} from './components/QueryEditorPanel';\nexport type {QueryEditorPanelProps} from './components/QueryEditorPanel';\nexport {QueryEditorPanelActions} from './components/QueryEditorPanelActions';\nexport {QueryEditorPanelTabsList} from './components/QueryEditorPanelTabsList';\nexport {QueryEditorPanelEditor} from './components/QueryEditorPanelEditor';\nexport {QueryResultLimitSelect} from './components/QueryResultLimitSelect';\nexport type {QueryResultLimitSelectProps} from './components/QueryResultLimitSelect';\nexport {SqlQueryPreview} from './components/SqlQueryPreview';\nexport type {SqlQueryPreviewProps} from './components/SqlQueryPreview';\n\n// Re-export from @sqlrooms/sql-editor-config\n// Values also export their corresponding types automatically (Zod pattern)\nexport {\n SqlEditorSliceConfig,\n createDefaultSqlEditorConfig,\n} from '@sqlrooms/sql-editor-config';\n"]}
@@ -0,0 +1,41 @@
1
+ import type { DataTable, TableColumn } from '@sqlrooms/duckdb';
2
+ export interface ParsedQualifiedColumnName {
3
+ columnName: string;
4
+ tableName?: string;
5
+ schemaName?: string;
6
+ databaseName?: string;
7
+ }
8
+ /**
9
+ * Parses a qualified column name into its components
10
+ * Supports:
11
+ * - columnName
12
+ * - tableName.columnName
13
+ * - schemaName.tableName.columnName
14
+ * - databaseName.schemaName.tableName.columnName
15
+ */
16
+ export declare function parseQualifiedColumnName(word: string): ParsedQualifiedColumnName;
17
+ export interface ParsedQualifiedTableName {
18
+ tableName: string;
19
+ schemaName?: string;
20
+ databaseName?: string;
21
+ }
22
+ /**
23
+ * Parses a qualified table name into its components
24
+ * Supports:
25
+ * - tableName
26
+ * - schemaName.tableName
27
+ * - databaseName.schemaName.tableName
28
+ */
29
+ export declare function parseQualifiedTableName(word: string): ParsedQualifiedTableName;
30
+ /**
31
+ * Finds a table and column by qualified name (case-insensitive)
32
+ */
33
+ export declare function findTableAndColumn(qualifiedName: ParsedQualifiedColumnName, tables: DataTable[]): {
34
+ table: DataTable;
35
+ column: TableColumn;
36
+ } | undefined;
37
+ /**
38
+ * Finds a table by qualified name (case-insensitive)
39
+ */
40
+ export declare function findTable(qualifiedName: ParsedQualifiedTableName, tables: DataTable[]): DataTable | undefined;
41
+ //# sourceMappingURL=qualified-name-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qualified-name-parser.d.ts","sourceRoot":"","sources":["../../src/utils/qualified-name-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7D,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,GACX,yBAAyB,CAwB3B;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,GACX,wBAAwB,CAiB1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,yBAAyB,EACxC,MAAM,EAAE,SAAS,EAAE,GAClB;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAC,GAAG,SAAS,CA2CrD;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,aAAa,EAAE,wBAAwB,EACvC,MAAM,EAAE,SAAS,EAAE,GAClB,SAAS,GAAG,SAAS,CAmCvB"}