@adecore/database 0.53.2 → 0.54.0

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 (108) hide show
  1. package/dist/KeyIcon.js +1 -1
  2. package/dist/connections/ConnectionForm.js +3 -3
  3. package/dist/connections/ConnectionManager.js +6 -6
  4. package/dist/connections/connection-config.d.ts +1 -1
  5. package/dist/connections/use-docker-containers.js +1 -1
  6. package/dist/console/DestructiveDialog.js +2 -2
  7. package/dist/console/HistoryPanel.js +4 -4
  8. package/dist/console/QueryConsole.js +6 -6
  9. package/dist/console/SchemaPicker.js +1 -1
  10. package/dist/console/SqlEditor.js +2 -2
  11. package/dist/console/StatementResultView.js +3 -3
  12. package/dist/console/TransactionControls.js +1 -1
  13. package/dist/ddl/diff.js +1 -1
  14. package/dist/designer/ColumnsEditor.js +3 -3
  15. package/dist/designer/DesignerView.js +5 -5
  16. package/dist/designer/ForeignKeysEditor.js +2 -2
  17. package/dist/designer/IndexesEditor.js +2 -2
  18. package/dist/designer/NamePicker.js +2 -2
  19. package/dist/designer/OptionsEditor.js +2 -2
  20. package/dist/designer/SqlPreview.js +2 -2
  21. package/dist/designer/TableDesigner.js +2 -2
  22. package/dist/designer/plan.d.ts +1 -1
  23. package/dist/explorer/DatabaseExplorer.js +5 -5
  24. package/dist/explorer/RowMenu.js +2 -2
  25. package/dist/explorer/TableDialog.js +2 -2
  26. package/dist/explorer/folders.d.ts +1 -1
  27. package/dist/explorer/use-explorer-loads.js +1 -1
  28. package/dist/grid/CellEditor.js +2 -2
  29. package/dist/grid/CopyAsMenu.js +1 -1
  30. package/dist/grid/DataGrid.js +6 -6
  31. package/dist/grid/EnumPicker.js +2 -2
  32. package/dist/grid/GridHeaderCell.js +3 -3
  33. package/dist/grid/GridRowView.js +3 -3
  34. package/dist/grid/RecordView.js +5 -5
  35. package/dist/grid/ValueDock.js +2 -2
  36. package/dist/grid/column-layout.js +1 -1
  37. package/dist/structure/StructureView.js +4 -4
  38. package/dist/table/CommandField.js +2 -2
  39. package/dist/table/ImportDialog.js +3 -3
  40. package/dist/table/TableStatusBar.js +2 -2
  41. package/dist/table/TableToolbar.js +2 -2
  42. package/dist/table/TableView.js +4 -4
  43. package/dist/table/layout-store.js +1 -1
  44. package/dist/table/useLoaded.js +1 -1
  45. package/dist/table/useTableTransfer.d.ts +1 -1
  46. package/dist/table/useTableTransfer.js +1 -1
  47. package/dist/testing/fake.d.ts +1 -1
  48. package/dist/use-popup-press.js +1 -1
  49. package/dist/value/ValueEditor.js +6 -5
  50. package/dist/value/ValuePanel.js +1 -1
  51. package/dist/workbench/DatabaseWorkbench.js +4 -4
  52. package/dist/workbench/DesignerTab.js +1 -1
  53. package/package.json +8 -7
  54. package/src/DatabaseProvider.tsx +1 -1
  55. package/src/KeyIcon.tsx +1 -1
  56. package/src/connections/ConnectionForm.tsx +3 -3
  57. package/src/connections/ConnectionManager.tsx +8 -8
  58. package/src/connections/EngineIcon.tsx +1 -1
  59. package/src/connections/connection-config.ts +1 -1
  60. package/src/connections/use-docker-containers.ts +1 -1
  61. package/src/console/DestructiveDialog.tsx +4 -4
  62. package/src/console/HistoryPanel.tsx +5 -5
  63. package/src/console/QueryConsole.tsx +6 -6
  64. package/src/console/SchemaPicker.tsx +1 -1
  65. package/src/console/SqlEditor.tsx +2 -2
  66. package/src/console/StatementResultView.tsx +4 -4
  67. package/src/console/TransactionControls.tsx +2 -2
  68. package/src/ddl/diff.ts +1 -1
  69. package/src/designer/ColumnsEditor.tsx +4 -4
  70. package/src/designer/DesignerView.tsx +29 -10
  71. package/src/designer/ForeignKeysEditor.tsx +2 -2
  72. package/src/designer/IndexesEditor.tsx +2 -2
  73. package/src/designer/NamePicker.tsx +3 -3
  74. package/src/designer/OptionsEditor.tsx +3 -3
  75. package/src/designer/SqlPreview.tsx +4 -4
  76. package/src/designer/TableDesigner.tsx +2 -2
  77. package/src/designer/plan.ts +1 -1
  78. package/src/explorer/DatabaseExplorer.tsx +11 -7
  79. package/src/explorer/RowMenu.tsx +2 -2
  80. package/src/explorer/TableDialog.tsx +2 -2
  81. package/src/explorer/folders.ts +1 -1
  82. package/src/explorer/use-explorer-loads.ts +1 -1
  83. package/src/grid/CellEditor.tsx +2 -2
  84. package/src/grid/CopyAsMenu.tsx +1 -1
  85. package/src/grid/DataGrid.tsx +14 -12
  86. package/src/grid/EnumPicker.tsx +2 -2
  87. package/src/grid/GridHeaderCell.tsx +3 -3
  88. package/src/grid/GridRowView.tsx +3 -3
  89. package/src/grid/RecordView.tsx +20 -6
  90. package/src/grid/ValueDock.tsx +2 -2
  91. package/src/grid/column-layout.ts +1 -1
  92. package/src/structure/StructureView.tsx +9 -7
  93. package/src/table/CommandField.tsx +2 -2
  94. package/src/table/ImportDialog.tsx +7 -7
  95. package/src/table/TableStatusBar.tsx +3 -3
  96. package/src/table/TableToolbar.tsx +4 -4
  97. package/src/table/TableView.tsx +7 -7
  98. package/src/table/layout-store.ts +1 -2
  99. package/src/table/references.ts +1 -1
  100. package/src/table/useLoaded.ts +1 -1
  101. package/src/table/useTableTransfer.ts +2 -2
  102. package/src/testing/fake.ts +1 -1
  103. package/src/use-database-resources.ts +1 -1
  104. package/src/use-popup-press.ts +1 -1
  105. package/src/value/ValueEditor.tsx +15 -6
  106. package/src/value/ValuePanel.tsx +2 -2
  107. package/src/workbench/DatabaseWorkbench.tsx +5 -5
  108. package/src/workbench/DesignerTab.tsx +1 -1
@@ -1,14 +1,14 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import { ButtonGroup, ContextMenu, copyText, EDIT_SHORTCUTS, Icon, IconButton, Input, isApplePlatform, isModHeld, Kbd, ScrollArea, shortcut, Spinner } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { ArrowUpRight, Ban, ChevronDown, ChevronUp, Copy, Maximize2, Minimize2, RotateCcw, X } from 'lucide-react';
6
+ import { useEffect, useMemo, useRef, useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { ButtonGroup, ContextMenu, copyText, EDIT_SHORTCUTS, Icon, IconButton, Input, isApplePlatform, isModHeld, Kbd, shortcut, Spinner } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
8
  import { useNumberNotation } from '../client-context.js';
9
9
  import { CODE_TEXT } from '../code-text.js';
10
- import { ValueEditor } from '../value/ValueEditor.js';
11
10
  import { isNumericKind } from '../sql.js';
11
+ import { ValueEditor } from '../value/ValueEditor.js';
12
12
  import { columnNotation, cellView, copyTextOf, isPreview, numeralText } from './display.js';
13
13
  import { draftOf, parseDraft } from './edit-value.js';
14
14
  import { parseEnumType } from './enum-type.js';
@@ -125,7 +125,7 @@ export function RecordView({ columns, rows, index, onIndexChange, focusedColumn,
125
125
  }
126
126
  };
127
127
  const cellOf = (column) => (row === undefined ? null : { rowKey: row.key, column });
128
- return (_jsxs("div", { ref: ref, className: clsx('flex min-h-0 min-w-0 flex-1 flex-col bg-surface', className), children: [_jsxs("div", { className: "flex h-10 shrink-0 items-center gap-1 border-b border-border px-2", children: [_jsxs(ButtonGroup, { children: [_jsx(IconButton, { icon: ChevronUp, size: "sm", label: t('table.record.previous'), kbd: PREVIOUS_ROW, disabled: row === undefined || index <= 0, onClick: () => moveRow(index - 1) }), _jsx(IconButton, { icon: ChevronDown, size: "sm", label: t('table.record.next'), kbd: NEXT_ROW, disabled: row === undefined || index >= rows.length - 1, onClick: () => moveRow(index + 1) })] }), row !== undefined && (_jsxs("span", { className: "flex min-w-0 items-baseline gap-2 px-1", children: [_jsx("span", { className: "truncate text-sm font-medium text-text tabular-nums", children: row.number === null ? t('table.record.newRow') : t('table.record.row', { number: formatNumber(row.number) }) }), _jsx("span", { className: "truncate text-xs text-text-faint tabular-nums", children: t('table.record.position', { index: formatNumber(index + 1), count: formatNumber(rows.length) }) })] })), _jsx(IconButton, { icon: X, size: "sm", label: t('table.record.close'), className: "ml-auto", onClick: onClose })] }), row === undefined ? (_jsx("p", { className: "px-4 py-6 text-xs text-text-muted", children: empty })) : (_jsx("div", { role: "group", "aria-label": label, className: "min-h-0 flex-1 overflow-auto py-1", children: columns.map((column, position) => {
128
+ return (_jsxs("div", { ref: ref, className: clsx('flex min-h-0 min-w-0 flex-1 flex-col bg-surface', className), children: [_jsxs("div", { className: "flex h-10 shrink-0 items-center gap-1 border-b border-border px-2", children: [_jsxs(ButtonGroup, { children: [_jsx(IconButton, { icon: ChevronUp, size: "sm", label: t('table.record.previous'), kbd: PREVIOUS_ROW, disabled: row === undefined || index <= 0, onClick: () => moveRow(index - 1) }), _jsx(IconButton, { icon: ChevronDown, size: "sm", label: t('table.record.next'), kbd: NEXT_ROW, disabled: row === undefined || index >= rows.length - 1, onClick: () => moveRow(index + 1) })] }), row !== undefined && (_jsxs("span", { className: "flex min-w-0 items-baseline gap-2 px-1", children: [_jsx("span", { className: "truncate text-sm font-medium text-text tabular-nums", children: row.number === null ? t('table.record.newRow') : t('table.record.row', { number: formatNumber(row.number) }) }), _jsx("span", { className: "truncate text-xs text-text-faint tabular-nums", children: t('table.record.position', { index: formatNumber(index + 1), count: formatNumber(rows.length) }) })] })), _jsx(IconButton, { icon: X, size: "sm", label: t('table.record.close'), className: "ml-auto", onClick: onClose })] }), row === undefined ? (_jsx("p", { className: "px-4 py-6 text-xs text-text-muted", children: empty })) : (_jsx(ScrollArea, { role: "group", "aria-label": label, className: "flex-1", viewportClassName: "py-1", children: columns.map((column, position) => {
129
129
  const cell = row.cells[position] ?? null;
130
130
  const enumType = enumTypes[position] ?? null;
131
131
  const active = editing !== null && editing.column === position;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef, useState } from 'react';
3
- import clsx from 'clsx';
4
2
  import { ColumnResizeHandle, useColumnResize } from '@adecore/ui';
3
+ import clsx from 'clsx';
4
+ import { useRef, useState } from 'react';
5
5
  import { assignRef } from '../assign-ref.js';
6
6
  export const VALUE_PANEL_WIDTH = 320;
7
7
  export const VALUE_PANEL_MIN_WIDTH = 240;
@@ -1,5 +1,5 @@
1
- import { MAX_RESIZED_WIDTH, MIN_COLUMN_WIDTH } from './layout.js';
2
1
  import { sameList } from '../same-list.js';
2
+ import { MAX_RESIZED_WIDTH, MIN_COLUMN_WIDTH } from './layout.js';
3
3
  /* The state of a grid for columns it has, from a layout. Names it does not have are skipped; a layout that would hide every column hides none. */
4
4
  export const restoreLayout = (columns, layout) => {
5
5
  const resized = {};
@@ -1,9 +1,9 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
2
+ import { Banner, Button, EmptyState, Icon, Pill, ScrollArea, Separator, Spinner, Tabs, copyText, messageOf } from '@adecore/ui';
3
3
  import clsx from 'clsx';
4
4
  import { CircleAlert, Copy, KeyRound, Link2 } from 'lucide-react';
5
+ import { useEffect, useState } from 'react';
5
6
  import { useTranslation } from 'react-i18next';
6
- import { Banner, Button, EmptyState, Icon, Pill, Separator, Spinner, Tabs, copyText, messageOf } from '@adecore/ui';
7
7
  import { useDatabaseClient } from '../client-context.js';
8
8
  import { CODE_TEXT } from '../code-text.js';
9
9
  import { useSchemaChange } from '../use-schema-change.js';
@@ -41,7 +41,7 @@ export function StructureView({ connection, schema, table, toolbarStart, classNa
41
41
  export function StructureTabs({ structure, start }) {
42
42
  const { t } = useTranslation('database');
43
43
  const head = start === undefined || start === null || start === false ? undefined : (_jsxs("span", { className: "flex items-center gap-4", children: [start, _jsx(Separator, {})] }));
44
- return (_jsxs(Tabs.Root, { defaultValue: "columns", className: "flex min-h-0 grow flex-col", children: [_jsxs(Tabs.List, { className: "shrink-0 px-3", start: head, children: [_jsxs(Tabs.Tab, { value: "columns", children: [t('structure.columns'), _jsx(Tabs.Count, { value: structure.columns.length })] }), _jsxs(Tabs.Tab, { value: "indexes", children: [t('structure.indexes'), _jsx(Tabs.Count, { value: structure.indexes.length })] }), _jsxs(Tabs.Tab, { value: "foreignKeys", children: [t('structure.foreignKeys'), _jsx(Tabs.Count, { value: structure.foreignKeys.length })] }), _jsx(Tabs.Tab, { value: "ddl", children: t('structure.ddl') })] }), _jsx(Tabs.Panel, { value: "columns", className: "min-h-0 grow overflow-auto", children: _jsx(ColumnsTable, { structure: structure }) }), _jsx(Tabs.Panel, { value: "indexes", className: "min-h-0 grow overflow-auto", children: _jsx(IndexesTable, { indexes: structure.indexes }) }), _jsx(Tabs.Panel, { value: "foreignKeys", className: "min-h-0 grow overflow-auto", children: _jsx(ForeignKeysTable, { foreignKeys: structure.foreignKeys }) }), _jsx(Tabs.Panel, { value: "ddl", className: "min-h-0 grow overflow-auto", children: _jsx(Ddl, { ddl: structure.ddl }) })] }));
44
+ return (_jsxs(Tabs.Root, { defaultValue: "columns", className: "flex min-h-0 grow flex-col", children: [_jsxs(Tabs.List, { className: "shrink-0 px-3", start: head, children: [_jsxs(Tabs.Tab, { value: "columns", children: [t('structure.columns'), _jsx(Tabs.Count, { value: structure.columns.length })] }), _jsxs(Tabs.Tab, { value: "indexes", children: [t('structure.indexes'), _jsx(Tabs.Count, { value: structure.indexes.length })] }), _jsxs(Tabs.Tab, { value: "foreignKeys", children: [t('structure.foreignKeys'), _jsx(Tabs.Count, { value: structure.foreignKeys.length })] }), _jsx(Tabs.Tab, { value: "ddl", children: t('structure.ddl') })] }), _jsx(Tabs.Panel, { value: "columns", render: _jsx(ScrollArea, { axis: "both" }), className: "grow", children: _jsx(ColumnsTable, { structure: structure }) }), _jsx(Tabs.Panel, { value: "indexes", render: _jsx(ScrollArea, { axis: "both" }), className: "grow", children: _jsx(IndexesTable, { indexes: structure.indexes }) }), _jsx(Tabs.Panel, { value: "foreignKeys", render: _jsx(ScrollArea, { axis: "both" }), className: "grow", children: _jsx(ForeignKeysTable, { foreignKeys: structure.foreignKeys }) }), _jsx(Tabs.Panel, { value: "ddl", render: _jsx(ScrollArea, { axis: "both" }), className: "grow", children: _jsx(Ddl, { ddl: structure.ddl }) })] }));
45
45
  }
46
46
  function Grid({ heads, children }) {
47
47
  return (_jsxs("table", { className: "w-full border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: heads.map((head) => (_jsx("th", { scope: "col", className: TH, children: head }, head))) }) }), _jsx("tbody", { children: children })] }));
@@ -96,5 +96,5 @@ function Ddl({ ddl }) {
96
96
  if (ddl === null) {
97
97
  return _jsx(EmptyState, { children: t('structure.noDdl') });
98
98
  }
99
- return (_jsxs("div", { className: "relative", children: [_jsxs(Button, { variant: "secondary", size: "xs", className: "absolute top-2 right-3", onClick: () => copyText(ddl), children: [_jsx(Icon, { icon: Copy, size: 12 }), t('structure.copy')] }), _jsx("pre", { className: clsx(CODE_TEXT, 'overflow-auto p-3 pr-24 whitespace-pre text-text select-text'), children: ddl })] }));
99
+ return (_jsxs("div", { className: "relative", children: [_jsxs(Button, { variant: "secondary", size: "xs", className: "absolute top-2 right-3", onClick: () => copyText(ddl), children: [_jsx(Icon, { icon: Copy, size: 12 }), t('structure.copy')] }), _jsx(ScrollArea, { axis: "x", render: _jsx("pre", {}), viewportClassName: clsx(CODE_TEXT, 'p-3 pr-24 whitespace-pre text-text select-text'), children: ddl })] }));
100
100
  }
@@ -1,9 +1,9 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId, useImperativeHandle, useMemo, useRef, useState } from 'react';
2
+ import { Icon, IconButton, Kbd, KEY_SHORTCUTS, Keys, Menu, shortcut } from '@adecore/ui';
3
3
  import clsx from 'clsx';
4
4
  import { ArrowDown, ArrowDownWideNarrow, ArrowRightToLine, ArrowUp, Code, Filter, Search, X } from 'lucide-react';
5
+ import { useId, useImperativeHandle, useMemo, useRef, useState } from 'react';
5
6
  import { useTranslation } from 'react-i18next';
6
- import { Icon, IconButton, Kbd, KEY_SHORTCUTS, Keys, Menu, shortcut } from '@adecore/ui';
7
7
  import { addChip, filterStartText, removeChipAt, replaceChipAt, suggest, toggleSort } from './command-field.js';
8
8
  const FOCUS_SHORTCUT = shortcut('Mod+F');
9
9
  const SUGGESTION_ICON = {
@@ -1,8 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Dialog, FormError, ScrollArea, Select, Spinner, Switch } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
2
4
  import clsx from 'clsx';
3
5
  import { useTranslation } from 'react-i18next';
4
- import { Button, Dialog, FormError, Select, Spinner, Switch } from '@adecore/ui';
5
- import { formatNumber } from '@adecore/ui/format';
6
6
  import { hasMapping } from './import-mapping.js';
7
7
  /* How many of the sampled rows the preview shows. */
8
8
  const PREVIEW_ROWS = 8;
@@ -16,7 +16,7 @@ export function ImportForm({ path, tableColumns, sample, header, mapping, busy,
16
16
  return index < 0 ? SKIP : String(index);
17
17
  };
18
18
  const canImport = sample !== null && hasMapping(mapping) && !busy;
19
- return (_jsxs("div", { ref: ref, className: clsx('flex min-h-0 flex-col gap-4', className), children: [_jsx("p", { className: "truncate font-mono text-code text-text-muted", children: path }), _jsxs("div", { className: "flex items-center gap-3 text-sm text-text", children: [_jsx(Switch, { checked: header, label: t('table.import.header'), disabled: busy, onCheckedChange: onHeaderChange }), _jsx("span", { children: t('table.import.header') }), sample === null && _jsx(Spinner, { size: 12, label: t('table.import.sampling') })] }), sample !== null && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid min-h-0 grid-cols-2 items-center gap-x-3 gap-y-1.5 overflow-auto", children: [_jsx("span", { className: "text-xs text-text-faint", children: t('table.import.fileColumn') }), _jsx("span", { className: "text-xs text-text-faint", children: t('table.import.tableColumn') }), sample.columns.map((name, index) => (_jsx(MappingRow, { name: name, value: valueOf(mapping[index] ?? null), items: items, disabled: busy, label: t('table.import.mapTo', { column: name }), onChange: (value) => onMappingChange(index, value === SKIP ? null : (tableColumns[Number(value)]?.name ?? null)) }, index)))] }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs text-text-faint", children: t('table.import.preview', { count: formatNumber(Math.min(sample.rows.length, PREVIEW_ROWS)) }) }), _jsx("div", { className: "max-h-48 overflow-auto rounded-lg border border-border", children: _jsxs("table", { className: "w-full border-collapse text-left font-mono text-code", children: [_jsx("thead", { className: "sticky top-0 bg-surface-raised", children: _jsx("tr", { children: sample.columns.map((name, index) => (_jsx("th", { className: "max-w-48 truncate border-b border-border px-2 py-1 font-medium text-text-muted", children: name }, index))) }) }), _jsx("tbody", { children: sample.rows.slice(0, PREVIEW_ROWS).map((row, rowIndex) => (_jsx("tr", { className: "border-b border-border-soft last:border-b-0", children: sample.columns.map((_, index) => (_jsx("td", { className: "max-w-48 truncate px-2 py-1 whitespace-nowrap text-text", children: row[index] ?? '' }, index))) }, rowIndex))) })] }) })] })] })), error !== null && _jsx(FormError, { children: error }), _jsxs(Dialog.Footer, { className: "mt-0", children: [_jsx(Button, { disabled: busy, onClick: onCancel, children: t('table.import.cancel') }), _jsxs(Button, { variant: "primary", disabled: !canImport, onClick: onImport, children: [busy && _jsx(Spinner, { size: 12 }), t('table.import.confirm')] })] })] }));
19
+ return (_jsxs("div", { ref: ref, className: clsx('flex min-h-0 flex-col gap-4', className), children: [_jsx("p", { className: "truncate font-mono text-code text-text-muted", children: path }), _jsxs("div", { className: "flex items-center gap-3 text-sm text-text", children: [_jsx(Switch, { checked: header, label: t('table.import.header'), disabled: busy, onCheckedChange: onHeaderChange }), _jsx("span", { children: t('table.import.header') }), sample === null && _jsx(Spinner, { size: 12, label: t('table.import.sampling') })] }), sample !== null && (_jsxs(_Fragment, { children: [_jsxs(ScrollArea, { viewportClassName: "grid grid-cols-2 items-center gap-x-3 gap-y-1.5", children: [_jsx("span", { className: "text-xs text-text-faint", children: t('table.import.fileColumn') }), _jsx("span", { className: "text-xs text-text-faint", children: t('table.import.tableColumn') }), sample.columns.map((name, index) => (_jsx(MappingRow, { name: name, value: valueOf(mapping[index] ?? null), items: items, disabled: busy, label: t('table.import.mapTo', { column: name }), onChange: (value) => onMappingChange(index, value === SKIP ? null : (tableColumns[Number(value)]?.name ?? null)) }, index)))] }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs text-text-faint", children: t('table.import.preview', { count: formatNumber(Math.min(sample.rows.length, PREVIEW_ROWS)) }) }), _jsx(ScrollArea, { axis: "both", className: "max-h-48 rounded-lg border border-border", children: _jsxs("table", { className: "w-full border-collapse text-left font-mono text-code", children: [_jsx("thead", { className: "sticky top-0 bg-surface-raised", children: _jsx("tr", { children: sample.columns.map((name, index) => (_jsx("th", { className: "max-w-48 truncate border-b border-border px-2 py-1 font-medium text-text-muted", children: name }, index))) }) }), _jsx("tbody", { children: sample.rows.slice(0, PREVIEW_ROWS).map((row, rowIndex) => (_jsx("tr", { className: "border-b border-border-soft last:border-b-0", children: sample.columns.map((_, index) => (_jsx("td", { className: "max-w-48 truncate px-2 py-1 whitespace-nowrap text-text", children: row[index] ?? '' }, index))) }, rowIndex))) })] }) })] })] })), error !== null && _jsx(FormError, { children: error }), _jsxs(Dialog.Footer, { className: "mt-0", children: [_jsx(Button, { disabled: busy, onClick: onCancel, children: t('table.import.cancel') }), _jsxs(Button, { variant: "primary", disabled: !canImport, onClick: onImport, children: [busy && _jsx(Spinner, { size: 12 }), t('table.import.confirm')] })] })] }));
20
20
  }
21
21
  function MappingRow({ name, value, items, disabled, label, onChange }) {
22
22
  return (_jsxs(_Fragment, { children: [_jsx("span", { className: "truncate font-mono text-code text-text", children: name }), _jsx(Select, { size: "sm", className: "w-full", label: label, value: value, items: items, disabled: disabled, onValueChange: onChange })] }));
@@ -1,9 +1,9 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, ButtonGroup, IconButton, Spinner, Tooltip } from '@adecore/ui';
3
+ import { formatDecimal, formatNumber, formatRounded } from '@adecore/ui/format';
2
4
  import clsx from 'clsx';
3
5
  import { ChevronLeft, ChevronRight } from 'lucide-react';
4
6
  import { useTranslation } from 'react-i18next';
5
- import { Button, ButtonGroup, IconButton, Spinner, Tooltip } from '@adecore/ui';
6
- import { formatDecimal, formatNumber, formatRounded } from '@adecore/ui/format';
7
7
  import { useNumberNotation } from '../client-context.js';
8
8
  import { numeralText } from '../grid/display.js';
9
9
  /* Which rows are on the page and how many there are, the way to the other pages, and the figures of the selected cells. */
@@ -1,9 +1,9 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, ButtonGroup, Icon, IconButton, Menu, Separator } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
2
4
  import clsx from 'clsx';
3
5
  import { ChevronsLeft, ChevronsRight, CopyPlus, Download, Ellipsis, FileInput, PanelRight, Plus, RefreshCw, Rows3, TableProperties, Trash2, Undo2 } from 'lucide-react';
4
6
  import { useTranslation } from 'react-i18next';
5
- import { Button, ButtonGroup, Icon, IconButton, Menu, Separator } from '@adecore/ui';
6
- import { formatNumber } from '@adecore/ui/format';
7
7
  import { EXPORT_FORMATS } from '../export-formats.js';
8
8
  import { CommandField } from './CommandField.js';
9
9
  import { PAGE_SIZES } from './paging.js';
@@ -1,12 +1,12 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import { Banner, Button, ContextMenu, Icon, isApplePlatform, Kbd, KEY_SHORTCUTS, matchesShortcut, messageOf, PanelEmpty, PromptDialog, shortcut, Spinner } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { ArrowDownWideNarrow, ArrowUpRight, Check, CircleAlert, CopyPlus, Download, Filter, FilterX, RefreshCw, Trash2, Undo2 } from 'lucide-react';
6
+ import { useEffect, useMemo, useRef, useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { Banner, Button, ContextMenu, Icon, isApplePlatform, Kbd, KEY_SHORTCUTS, matchesShortcut, messageOf, PanelEmpty, PromptDialog, shortcut, Spinner } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
- import { DatabaseRequestError } from '../client/types.js';
9
8
  import { useDatabaseAction, useDatabaseClient, useDatabaseFiles, useDatabaseNotice, useDatabaseStorage } from '../client-context.js';
9
+ import { DatabaseRequestError } from '../client/types.js';
10
10
  import { aggregateBlock, blockSize } from '../grid/aggregates.js';
11
11
  import { DataGrid } from '../grid/DataGrid.js';
12
12
  import { RecordView } from '../grid/RecordView.js';
@@ -1,3 +1,4 @@
1
+ import { isRecord } from '@adecore/utils/record';
1
2
  import { PAGE_SIZES } from './paging.js';
2
3
  /*
3
4
  * Bump when the shape changes; a stored value of another version is ignored rather than migrated. `filters`
@@ -7,7 +8,6 @@ export const LAYOUT_VERSION = 1;
7
8
  export const EMPTY_LAYOUT = { widths: {}, hidden: [], pinned: [], pageSize: null, where: '', orderBy: '', filters: [] };
8
9
  export const layoutStorageKey = (connectionId, schema, table) => `database:table:${connectionId}:${schema}.${table}`;
9
10
  const isStringList = (value) => Array.isArray(value) && value.every((item) => typeof item === 'string');
10
- const isRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
11
11
  const isStoredFilter = (value) => isRecord(value) && typeof value.text === 'string' && typeof value.sql === 'string' && value.sql.trim() !== '';
12
12
  export const serializeLayout = (layout) => JSON.stringify({ version: LAYOUT_VERSION, ...layout });
13
13
  /* The layout a stored text holds, or `null` when it is missing, broken or from another version. A field that is off is dropped alone. */
@@ -1,5 +1,5 @@
1
- import { useEffect, useRef, useState } from 'react';
2
1
  import { messageOf } from '@adecore/ui';
2
+ import { useEffect, useRef, useState } from 'react';
3
3
  /*
4
4
  * Runs `load` when `key` changes or `reload` is called, and aborts the run that is still going.
5
5
  * `key` has to name everything `load` reads, since `load` itself is a new function on every render.
@@ -1,8 +1,8 @@
1
1
  import type { DatabaseFiles } from '../actions.ts';
2
2
  import { type DatabaseClient, type DatabaseSession } from '../client/types.ts';
3
3
  import type { FileFormat, TableStructure } from '../protocol/index.ts';
4
- import type { ImportSample } from './ImportDialog.tsx';
5
4
  import { type ImportFormat } from './import-mapping.ts';
5
+ import type { ImportSample } from './ImportDialog.tsx';
6
6
  export type TransferNotice = {
7
7
  readonly kind: 'exporting';
8
8
  readonly format: FileFormat;
@@ -1,5 +1,5 @@
1
- import { useEffect, useRef, useState } from 'react';
2
1
  import { messageOf } from '@adecore/ui';
2
+ import { useEffect, useRef, useState } from 'react';
3
3
  import { isCancelled } from '../client/types.js';
4
4
  import { formatOfPath, importableColumns, mapColumn, matchColumns } from './import-mapping.js';
5
5
  /* How long a finished export or import stays on the strip. */
@@ -1,5 +1,5 @@
1
- import type { CheckInfo, ColumnInfo, DockerContainer, ForeignKeyInfo, IndexInfo, ServerInfo, TableKind, TriggerInfo, Value } from '../protocol/index.ts';
2
1
  import type { DatabaseTransport } from '../client/types.ts';
2
+ import type { CheckInfo, ColumnInfo, DockerContainer, ForeignKeyInfo, IndexInfo, ServerInfo, TableKind, TriggerInfo, Value } from '../protocol/index.ts';
3
3
  export interface FakeTable {
4
4
  readonly kind?: TableKind;
5
5
  readonly columns: readonly ColumnInfo[];
@@ -1,5 +1,5 @@
1
- import { useEffect, useRef } from 'react';
2
1
  import { isInFloatingLayer } from '@adecore/ui';
2
+ import { useEffect, useRef } from 'react';
3
3
  /*
4
4
  * Catches the click that follows a press in a popup, menu or dialog. When a popup closes on that
5
5
  * press, the browser lands the click on whatever lies under the pointer, which is not something the
@@ -1,16 +1,17 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, useState } from 'react';
2
+ import { Button, ButtonGroup, copyText, FormError, IconButton, isApplePlatform, KEY_SHORTCUTS, matchesShortcut, Menu, ScrollArea, Segmented, TextArea, Tooltip } from '@adecore/ui';
3
+ import { formatBytes, formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { Copy, Ellipsis, WrapText } from 'lucide-react';
6
+ import { useMemo, useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { Button, ButtonGroup, copyText, FormError, IconButton, isApplePlatform, KEY_SHORTCUTS, matchesShortcut, Menu, Segmented, TextArea, Tooltip } from '@adecore/ui';
7
- import { formatBytes, formatNumber } from '@adecore/ui/format';
8
8
  import { CODE_TEXT } from '../code-text.js';
9
9
  import { editValueOf, sameDraft, sameSource, sourceOf } from './draft.js';
10
10
  import { hexDumpLines, parseHex } from './hex.js';
11
11
  import { renderView, sizeOf, viewsOf } from './views.js';
12
12
  const WRAPPING_VIEWS = new Set(['text', 'formatted', 'utf8']);
13
- const READING = `min-h-0 flex-1 overflow-auto rounded-lg border border-border bg-surface p-2 ${CODE_TEXT} text-text`;
13
+ const READING_FRAME = 'flex-1 rounded-lg border border-border bg-surface';
14
+ const READING = `p-2 ${CODE_TEXT} text-text`;
14
15
  /*
15
16
  * The whole of one value, to read and change what a cell is too small for: Text, Formatted for JSON, or
16
17
  * Hex, Text and UUID for binary, with the checks of JSON and hex before a change is taken.
@@ -83,7 +84,7 @@ export function ValueEditor({ column, value, editable, onCommit }) {
83
84
  if (content.kind === 'problem') {
84
85
  return _jsx(Faint, { children: problemText(content.problem) });
85
86
  }
86
- return (_jsxs(_Fragment, { children: [_jsx("pre", { className: clsx(READING, wrapped ? 'break-words whitespace-pre-wrap' : 'whitespace-pre'), children: content.text }), content.truncated && (_jsx("p", { className: "shrink-0 text-xs text-text-faint", children: t('value.dumpTruncated', { shown: formatNumber(content.truncated.shown), total: formatNumber(content.truncated.total) }) }))] }));
87
+ return (_jsxs(_Fragment, { children: [_jsx(ScrollArea, { axis: wrapped ? 'y' : 'both', render: _jsx("pre", {}), className: READING_FRAME, viewportClassName: clsx(READING, wrapped ? 'break-words whitespace-pre-wrap' : 'whitespace-pre'), children: content.text }), content.truncated && (_jsx("p", { className: "shrink-0 text-xs text-text-faint", children: t('value.dumpTruncated', { shown: formatNumber(content.truncated.shown), total: formatNumber(content.truncated.total) }) }))] }));
87
88
  };
88
89
  const body = () => {
89
90
  if (view === 'text') {
@@ -1,8 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { EmptyState, IconButton, PanelHeader } from '@adecore/ui';
2
3
  import clsx from 'clsx';
3
4
  import { MousePointerClick, X } from 'lucide-react';
4
5
  import { useTranslation } from 'react-i18next';
5
- import { EmptyState, IconButton, PanelHeader } from '@adecore/ui';
6
6
  import { ValueEditor } from './ValueEditor.js';
7
7
  /* The whole value of the focused cell beside the grid, to read and edit what a cell is too small for. */
8
8
  export function ValuePanel({ column, value, loading, editable, onCommit, onClose, className, ref }) {
@@ -1,14 +1,14 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import { Button, CloseButton, ColumnResizeHandle, Dialog, EmptyState, Icon, IconButton, PromptDialog, Segmented, Tabs, isApplePlatform, matchesShortcut, shortcut, useColumnResize } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { PencilRuler, Settings2, SquareTerminal, Table, TableProperties } from 'lucide-react';
6
+ import { useEffect, useMemo, useRef, useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { Button, CloseButton, ColumnResizeHandle, Dialog, EmptyState, Icon, IconButton, PromptDialog, Segmented, Tabs, isApplePlatform, matchesShortcut, shortcut, useColumnResize } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
- import { DatabaseProvider } from '../DatabaseProvider.js';
9
8
  import { useDatabaseAction, useDatabaseStorage } from '../client-context.js';
10
9
  import { ConnectionManager } from '../connections/ConnectionManager.js';
11
10
  import { QueryConsole } from '../console/QueryConsole.js';
11
+ import { DatabaseProvider } from '../DatabaseProvider.js';
12
12
  import { DatabaseExplorer } from '../explorer/DatabaseExplorer.js';
13
13
  import { useStableCallback } from '../use-stable-callback.js';
14
14
  import { DesignerTab } from './DesignerTab.js';
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { DatabaseProvider } from '../DatabaseProvider.js';
3
2
  import { useDatabaseAction, useDatabaseClient, useDatabaseFiles, useDatabaseStorage, useNumberNotation } from '../client-context.js';
3
+ import { DatabaseProvider } from '../DatabaseProvider.js';
4
4
  import { TableDesigner } from '../designer/TableDesigner.js';
5
5
  import { useStableCallback } from '../use-stable-callback.js';
6
6
  /* The designer answers a save with `edit-table`; in its own tab that is the same tab, not another one. Everything else goes on to the workbench. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/database",
3
- "version": "0.53.2",
3
+ "version": "0.54.0",
4
4
  "description": "Browse, query and edit SQLite and MySQL databases: React views for the page, a host for the backend and a native helper that talks to the server.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "author": "Bas Milius",
@@ -56,25 +56,26 @@
56
56
  "helper:test": "cargo test --locked --manifest-path helper/Cargo.toml"
57
57
  },
58
58
  "dependencies": {
59
+ "@adecore/utils": "0.54.0",
59
60
  "@base-ui/react": "^1.9.0",
60
61
  "clsx": "^2.1.1",
61
62
  "lucide-react": "^1.65.0"
62
63
  },
63
64
  "optionalDependencies": {
64
- "@adecore/database-darwin-arm64": "0.53.2",
65
- "@adecore/database-linux-arm64": "0.53.2",
66
- "@adecore/database-linux-x64": "0.53.2",
67
- "@adecore/database-win32-x64": "0.53.2"
65
+ "@adecore/database-darwin-arm64": "0.54.0",
66
+ "@adecore/database-linux-arm64": "0.54.0",
67
+ "@adecore/database-linux-x64": "0.54.0",
68
+ "@adecore/database-win32-x64": "0.54.0"
68
69
  },
69
70
  "peerDependencies": {
70
- "@adecore/ui": "^0.53.2",
71
+ "@adecore/ui": "^0.54.0",
71
72
  "i18next": "^26.4.2",
72
73
  "react": "^19.3.0",
73
74
  "react-dom": "^19.3.0",
74
75
  "react-i18next": "^17.0.15"
75
76
  },
76
77
  "devDependencies": {
77
- "@adecore/ui": "0.53.2",
78
+ "@adecore/ui": "0.54.0",
78
79
  "@happy-dom/global-registrator": "^21.0.4",
79
80
  "@types/bun": "^1.4.4",
80
81
  "@types/node": "^26.6.6",
@@ -1,7 +1,7 @@
1
1
  import { use, useMemo, type ReactNode } from 'react';
2
2
  import type { DatabaseAction, DatabaseFiles, DatabaseNotice, DatabaseStorage } from './actions.ts';
3
- import type { DatabaseClient } from './client/types.ts';
4
3
  import { DatabaseContext } from './client-context.ts';
4
+ import type { DatabaseClient } from './client/types.ts';
5
5
  import type { NumberNotation } from './grid/display.ts';
6
6
  import { useDatabaseResources } from './use-database-resources.ts';
7
7
 
package/src/KeyIcon.tsx CHANGED
@@ -1,6 +1,6 @@
1
+ import { Icon } from '@adecore/ui';
1
2
  import clsx from 'clsx';
2
3
  import { KeyRound } from 'lucide-react';
3
- import { Icon } from '@adecore/ui';
4
4
  import type { ColumnKeys } from './column-keys.ts';
5
5
 
6
6
  /*
@@ -1,8 +1,8 @@
1
- import { useState, type Ref } from 'react';
1
+ import { Button, Field, IconButton, Input, Segmented, Select, Switch, useAsyncAction, type SegmentedOption, type SelectItem } from '@adecore/ui';
2
2
  import clsx from 'clsx';
3
- import { useTranslation } from 'react-i18next';
4
3
  import { Container, Network, Plug, RefreshCw, Terminal, type LucideIcon } from 'lucide-react';
5
- import { Button, Field, IconButton, Input, Segmented, Select, Switch, useAsyncAction, type SegmentedOption, type SelectItem } from '@adecore/ui';
4
+ import { useState, type Ref } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
6
  import type { Connection } from '../client/types.ts';
7
7
  import type { DockerContainer, DockerTunnel, MysqlConnectionConfig, MysqlTlsMode, SqliteConnectionConfig, SshTunnel, Engine } from '../protocol/index.ts';
8
8
  import {
@@ -1,18 +1,18 @@
1
- import { useState, type ReactNode, type Ref } from 'react';
1
+ import { Banner, Button, CloseButton, EmptyState, Icon, Menu, messageOf, PromptDialog, ScrollArea, Spinner } from '@adecore/ui';
2
+ import { DetailHeader, MasterItem } from '@adecore/ui/settings';
2
3
  import clsx from 'clsx';
3
4
  import { CircleAlert, CircleCheck, Container, Database, Plus, Trash2, Unplug } from 'lucide-react';
5
+ import { useState, type ReactNode, type Ref } from 'react';
4
6
  import { useTranslation } from 'react-i18next';
5
- import { Banner, Button, CloseButton, EmptyState, Icon, Menu, messageOf, PromptDialog, Spinner } from '@adecore/ui';
6
- import { DetailHeader, MasterItem } from '@adecore/ui/settings';
7
7
  import { useDatabaseClient } from '../client-context.ts';
8
8
  import type { Connection } from '../client/types.ts';
9
9
  import type { ConnectionConfig, DockerContainer, Engine, ServerInfo } from '../protocol/index.ts';
10
10
  import { defaultConfig, isValidConfig, targetOf } from './connection-config.ts';
11
11
  import { ConnectionForm } from './ConnectionForm.tsx';
12
12
  import { connectionFromContainer, containerTitle, isMysqlContainer } from './docker.ts';
13
- import { useDockerContainers } from './use-docker-containers.ts';
14
13
  import { ENGINE_ICONS } from './engine-icons.ts';
15
14
  import { EngineIcon } from './EngineIcon.tsx';
15
+ import { useDockerContainers } from './use-docker-containers.ts';
16
16
 
17
17
  const ENGINES: readonly Engine[] = ['sqlite', 'mysql'];
18
18
 
@@ -90,7 +90,7 @@ export function ConnectionManager({ value, onValueChange, selected, onSelectedCh
90
90
 
91
91
  const list = (
92
92
  <div className="flex w-56 shrink-0 flex-col border-r border-border max-[640px]:max-h-60 max-[640px]:w-auto max-[640px]:border-r-0 max-[640px]:border-b">
93
- <nav aria-label={t('connections.list')} className="flex min-h-0 grow flex-col gap-0.5 overflow-y-auto p-2">
93
+ <ScrollArea render={<nav />} aria-label={t('connections.list')} className="grow" viewportClassName="flex flex-col gap-0.5 p-2">
94
94
  {value.length === 0 && <p className="px-2 py-1.5 text-xs text-text-faint">{t('connections.empty')}</p>}
95
95
  {value.map((connection) => (
96
96
  <MasterItem key={connection.id} selected={connection.id === current?.id} onSelect={() => select(connection.id)}>
@@ -101,7 +101,7 @@ export function ConnectionManager({ value, onValueChange, selected, onSelectedCh
101
101
  </span>
102
102
  </MasterItem>
103
103
  ))}
104
- </nav>
104
+ </ScrollArea>
105
105
  <div className="flex shrink-0 flex-col gap-1 border-t border-border p-2">
106
106
  <Menu.Root>
107
107
  <Menu.Trigger render={<Button variant="ghost" size="sm" className="justify-start" />}>
@@ -184,9 +184,9 @@ export function ConnectionManager({ value, onValueChange, selected, onSelectedCh
184
184
  return (
185
185
  <div ref={ref} className={clsx('flex min-h-0 min-w-0 grow max-[640px]:flex-col', className)}>
186
186
  {list}
187
- <div className="min-h-0 min-w-0 grow overflow-y-auto">
187
+ <ScrollArea className="grow">
188
188
  <div className="flex min-w-0 flex-col gap-6 px-5 py-4">{detail}</div>
189
- </div>
189
+ </ScrollArea>
190
190
  </div>
191
191
  );
192
192
  }
@@ -1,5 +1,5 @@
1
- import type { Ref } from 'react';
2
1
  import { Icon } from '@adecore/ui';
2
+ import type { Ref } from 'react';
3
3
  import type { Engine } from '../protocol/index.ts';
4
4
  import { ENGINE_ICONS } from './engine-icons.ts';
5
5
 
@@ -1,5 +1,5 @@
1
- import type { ConnectionConfig, Engine, MysqlConnectionConfig, SqliteConnectionConfig } from '../protocol/index.ts';
2
1
  import type { Connection } from '../client/types.ts';
2
+ import type { ConnectionConfig, Engine, MysqlConnectionConfig, SqliteConnectionConfig } from '../protocol/index.ts';
3
3
 
4
4
  export const DEFAULT_MYSQL_PORT = 3306;
5
5
  export const DEFAULT_HOST = '127.0.0.1';
@@ -1,5 +1,5 @@
1
- import { useEffect, useState } from 'react';
2
1
  import { messageOf } from '@adecore/ui';
2
+ import { useEffect, useState } from 'react';
3
3
  import { useDatabaseClient } from '../client-context.ts';
4
4
  import { DatabaseRequestError } from '../client/types.ts';
5
5
  import type { DockerContainer } from '../protocol/index.ts';
@@ -1,7 +1,7 @@
1
- import type { Ref } from 'react';
1
+ import { PromptDialog, ScrollArea } from '@adecore/ui';
2
2
  import { TriangleAlert } from 'lucide-react';
3
+ import type { Ref } from 'react';
3
4
  import { useTranslation } from 'react-i18next';
4
- import { PromptDialog } from '@adecore/ui';
5
5
  import type { DestructiveStatement } from './destructive.ts';
6
6
 
7
7
  export interface DestructiveDialogProps {
@@ -28,14 +28,14 @@ export function DestructiveDialog({ statements, onConfirm, onCancel, ref }: Dest
28
28
  onConfirm={onConfirm}
29
29
  onOpenChange={onCancel}
30
30
  >
31
- <ul className="mt-3 flex max-h-56 flex-col gap-2 overflow-auto">
31
+ <ScrollArea render={<ul />} className="mt-3 max-h-56" viewportClassName="flex flex-col gap-2">
32
32
  {statements.map((statement, index) => (
33
33
  <li key={`${index}:${statement.sql}`} className="flex min-w-0 flex-col gap-0.5 rounded-md bg-surface-sunken px-2.5 py-1.5">
34
34
  <span className="text-xs text-status-error">{t(`console.destructive.${statement.kind}`)}</span>
35
35
  <span className="truncate font-mono text-xs text-text">{statement.sql.replace(/\s+/g, ' ')}</span>
36
36
  </li>
37
37
  ))}
38
- </ul>
38
+ </ScrollArea>
39
39
  </PromptDialog>
40
40
  );
41
41
  }
@@ -1,9 +1,9 @@
1
- import { useState, type Ref } from 'react';
1
+ import { Icon, IconButton, Input, ScrollArea, isApplePlatform, isModHeld } from '@adecore/ui';
2
+ import { formatMoment, formatNumber } from '@adecore/ui/format';
2
3
  import clsx from 'clsx';
3
4
  import { Check, CircleAlert, Search, Trash2 } from 'lucide-react';
5
+ import { useState, type Ref } from 'react';
4
6
  import { useTranslation } from 'react-i18next';
5
- import { Icon, IconButton, Input, isApplePlatform, isModHeld } from '@adecore/ui';
6
- import { formatMoment, formatNumber } from '@adecore/ui/format';
7
7
  import { searchHistory, type HistoryEntry } from './history.ts';
8
8
 
9
9
  export interface HistoryPanelProps {
@@ -40,7 +40,7 @@ export function HistoryPanel({ entries, onPick, onClear, className, ref }: Histo
40
40
  {shown.length === 0 ? (
41
41
  <p className="p-3 text-xs text-text-muted">{entries.length === 0 ? t('console.history.empty') : t('console.history.noMatches')}</p>
42
42
  ) : (
43
- <ul className="absolute inset-0 overflow-auto">
43
+ <ScrollArea render={<ul />} className="absolute inset-0">
44
44
  {shown.map((entry) => (
45
45
  <li key={`${entry.at}:${entry.sql}`} className="border-b border-border-soft">
46
46
  <button
@@ -58,7 +58,7 @@ export function HistoryPanel({ entries, onPick, onClear, className, ref }: Histo
58
58
  </button>
59
59
  </li>
60
60
  ))}
61
- </ul>
61
+ </ScrollArea>
62
62
  )}
63
63
  </div>
64
64
  <p className="shrink-0 border-t border-border px-3 py-2 text-xs text-text-faint">{t('console.history.hint')}</p>
@@ -1,25 +1,25 @@
1
- import { useEffect, useId, useMemo, useRef, useState, type ReactNode, type Ref } from 'react';
1
+ import { Banner, Button, ColumnResizeHandle, Icon, IconButton, messageOf, PromptDialog, Spinner, Tabs, Tooltip, useColumnResize } from '@adecore/ui';
2
+ import { formatNumber } from '@adecore/ui/format';
2
3
  import clsx from 'clsx';
3
4
  import { Check, CircleAlert, History, Play, Square, X } from 'lucide-react';
5
+ import { useEffect, useId, useMemo, useRef, useState, type ReactNode, type Ref } from 'react';
4
6
  import { useTranslation } from 'react-i18next';
5
- import { Banner, Button, ColumnResizeHandle, Icon, IconButton, messageOf, PromptDialog, Spinner, Tabs, Tooltip, useColumnResize } from '@adecore/ui';
6
- import { formatNumber } from '@adecore/ui/format';
7
- import { isCancelled, type Connection } from '../client/types.ts';
8
7
  import type { DatabaseNotice } from '../actions.ts';
9
8
  import { useDatabaseAction, useDatabaseClient, useDatabaseFiles, useDatabaseNotice, useDatabaseStorage } from '../client-context.ts';
9
+ import { isCancelled, type Connection } from '../client/types.ts';
10
10
  import type { FileFormat, RowsResult, SchemaInfo, StatementResult } from '../protocol/index.ts';
11
11
  import { splitStatements, statementAt } from '../sql-split.ts';
12
12
  import { parseStoredSize } from '../stored-size.ts';
13
+ import { findDestructive, type DestructiveStatement } from './destructive.ts';
13
14
  import { DestructiveDialog } from './DestructiveDialog.tsx';
14
15
  import type { QueryConsoleEditorHandle, QueryConsoleEditorProps, QueryConsoleRunScope } from './editor-slot.ts';
15
- import { findDestructive, type DestructiveStatement } from './destructive.ts';
16
16
  import type { HistoryEntry } from './history.ts';
17
17
  import { HistoryPanel } from './HistoryPanel.tsx';
18
18
  import { statementLabel } from './labels.ts';
19
19
  import { isPageable, outcomeOf } from './outcome.ts';
20
+ import { useResultKeys } from './result-keys.ts';
20
21
  import { SchemaPicker } from './SchemaPicker.tsx';
21
22
  import { orderSchemas } from './schemas.ts';
22
- import { useResultKeys } from './result-keys.ts';
23
23
  import { RUN_ALL_SHORTCUT, RUN_SHORTCUT } from './shortcuts.ts';
24
24
  import { SqlEditor } from './SqlEditor.tsx';
25
25
  import { StatementResultView, type ResultPager } from './StatementResultView.tsx';
@@ -1,6 +1,6 @@
1
+ import { Select } from '@adecore/ui';
1
2
  import type { Ref } from 'react';
2
3
  import { useTranslation } from 'react-i18next';
3
- import { Select } from '@adecore/ui';
4
4
  import type { SchemaInfo } from '../protocol/index.ts';
5
5
 
6
6
  export interface SchemaPickerProps {
@@ -1,6 +1,6 @@
1
- import { useEffect, useImperativeHandle, useRef, type KeyboardEvent } from 'react';
2
- import clsx from 'clsx';
3
1
  import { isApplePlatform, TextArea } from '@adecore/ui';
2
+ import clsx from 'clsx';
3
+ import { useEffect, useImperativeHandle, useRef, type KeyboardEvent } from 'react';
4
4
  import { CODE_TEXT } from '../code-text.ts';
5
5
  import { applyEdit, indentEdit, newlineEdit, outdentEdit, type TextEdit } from './editing.ts';
6
6
  import type { QueryConsoleEditorProps } from './editor-slot.ts';
@@ -1,8 +1,8 @@
1
- import { useMemo, useState, type ReactNode } from 'react';
2
- import { ArrowUpRight, ChevronLeft, ChevronRight, CircleAlert, Download, PanelRight } from 'lucide-react';
3
- import { useTranslation } from 'react-i18next';
4
1
  import { Banner, ButtonGroup, ContextMenu, Icon, IconButton, Menu, Spinner } from '@adecore/ui';
5
2
  import { formatDecimal, formatNumber } from '@adecore/ui/format';
3
+ import { ArrowUpRight, ChevronLeft, ChevronRight, CircleAlert, Download, PanelRight } from 'lucide-react';
4
+ import { useMemo, useState, type ReactNode } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
6
  import type { DatabaseNotice } from '../actions.ts';
7
7
  import { EXPORT_FORMATS } from '../export-formats.ts';
8
8
  import { DataGrid } from '../grid/DataGrid.tsx';
@@ -12,8 +12,8 @@ import { ValueDock } from '../grid/ValueDock.tsx';
12
12
  import type { Engine, FileFormat, StatementResult } from '../protocol/index.ts';
13
13
  import type { SqlTarget } from '../sql.ts';
14
14
  import type { Reference } from '../table/references.ts';
15
- import type { ResultKeys } from './result-keys.ts';
16
15
  import { ValuePanel } from '../value/ValuePanel.tsx';
16
+ import type { ResultKeys } from './result-keys.ts';
17
17
 
18
18
  /* What "Copy as SQL INSERT" names the table of a result that comes from no table. */
19
19
  const RESULT_TABLE = 'result';