@adecore/database 0.53.3 → 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
package/dist/KeyIcon.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Icon } from '@adecore/ui';
2
3
  import clsx from 'clsx';
3
4
  import { KeyRound } from 'lucide-react';
4
- import { Icon } from '@adecore/ui';
5
5
  /*
6
6
  * The key of a column, yellow on a primary key and blue on a foreign key, the same in the tree and the
7
7
  * grid. A column that is both shows the primary key, since that is what names its row; the tooltip says both.
@@ -1,9 +1,9 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { Button, Field, IconButton, Input, Segmented, Select, Switch, useAsyncAction } from '@adecore/ui';
3
3
  import clsx from 'clsx';
4
- import { useTranslation } from 'react-i18next';
5
4
  import { Container, Network, Plug, RefreshCw, Terminal } from 'lucide-react';
6
- import { Button, Field, IconButton, Input, Segmented, Select, Switch, useAsyncAction } from '@adecore/ui';
5
+ import { useState } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
7
  import { CONNECT_MODES, DEFAULT_HOST, DEFAULT_MYSQL_PORT, configProblems, modeOf, withEngine, withMode } from './connection-config.js';
8
8
  import { composeNameOf, containerPortOf, isMysqlContainer, publishedPortOf, withContainer } from './docker.js';
9
9
  import { ENGINE_ICONS } from './engine-icons.js';
@@ -1,17 +1,17 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { Banner, Button, CloseButton, EmptyState, Icon, Menu, messageOf, PromptDialog, ScrollArea, Spinner } from '@adecore/ui';
3
+ import { DetailHeader, MasterItem } from '@adecore/ui/settings';
3
4
  import clsx from 'clsx';
4
5
  import { CircleAlert, CircleCheck, Container, Database, Plus, Trash2, Unplug } from 'lucide-react';
6
+ import { useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { Banner, Button, CloseButton, EmptyState, Icon, Menu, messageOf, PromptDialog, Spinner } from '@adecore/ui';
7
- import { DetailHeader, MasterItem } from '@adecore/ui/settings';
8
8
  import { useDatabaseClient } from '../client-context.js';
9
9
  import { defaultConfig, isValidConfig, targetOf } from './connection-config.js';
10
10
  import { ConnectionForm } from './ConnectionForm.js';
11
11
  import { connectionFromContainer, containerTitle, isMysqlContainer } from './docker.js';
12
- import { useDockerContainers } from './use-docker-containers.js';
13
12
  import { ENGINE_ICONS } from './engine-icons.js';
14
13
  import { EngineIcon } from './EngineIcon.js';
14
+ import { useDockerContainers } from './use-docker-containers.js';
15
15
  const ENGINES = ['sqlite', 'mysql'];
16
16
  /*
17
17
  * The saved connections beside the form of the one picked, for a dialog, a settings pane or a view of its own. The list
@@ -57,14 +57,14 @@ export function ConnectionManager({ value, onValueChange, selected, onSelectedCh
57
57
  onValueChange(rest);
58
58
  select(rest[Math.min(index, rest.length - 1)]?.id ?? null);
59
59
  };
60
- const list = (_jsxs("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", children: [_jsxs("nav", { "aria-label": t('connections.list'), className: "flex min-h-0 grow flex-col gap-0.5 overflow-y-auto p-2", children: [value.length === 0 && _jsx("p", { className: "px-2 py-1.5 text-xs text-text-faint", children: t('connections.empty') }), value.map((connection) => (_jsxs(MasterItem, { selected: connection.id === current?.id, onSelect: () => select(connection.id), children: [_jsx(EngineIcon, { engine: connection.config.engine, size: 16, className: "shrink-0 text-text-muted" }), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate", children: connection.name || t('connections.untitled') }), _jsx("span", { className: "truncate text-xs text-text-faint", children: targetOf(connection) })] })] }, connection.id)))] }), _jsx("div", { className: "flex shrink-0 flex-col gap-1 border-t border-border p-2", children: _jsxs(Menu.Root, { children: [_jsxs(Menu.Trigger, { render: _jsx(Button, { variant: "ghost", size: "sm", className: "justify-start" }), children: [_jsx(Icon, { icon: Plus, size: 14 }), t('connections.new')] }), _jsxs(Menu.Popup, { children: [ENGINES.map((engine) => (_jsxs(Menu.Item, { onClick: () => add(engine), children: [_jsx(Icon, { icon: ENGINE_ICONS[engine], size: 14 }), t(`engine.${engine}`)] }, engine))), _jsx(Menu.Separator, {}), _jsxs(Menu.SubmenuRoot, { children: [_jsxs(Menu.SubmenuTrigger, { children: [_jsx(Icon, { icon: Container, size: 14 }), t('connections.fromDocker.label')] }), _jsx(Menu.Popup, { children: _jsx(DockerMenuItems, { onPick: addFromContainer }) })] })] })] }) })] }));
60
+ const list = (_jsxs("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", children: [_jsxs(ScrollArea, { render: _jsx("nav", {}), "aria-label": t('connections.list'), className: "grow", viewportClassName: "flex flex-col gap-0.5 p-2", children: [value.length === 0 && _jsx("p", { className: "px-2 py-1.5 text-xs text-text-faint", children: t('connections.empty') }), value.map((connection) => (_jsxs(MasterItem, { selected: connection.id === current?.id, onSelect: () => select(connection.id), children: [_jsx(EngineIcon, { engine: connection.config.engine, size: 16, className: "shrink-0 text-text-muted" }), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate", children: connection.name || t('connections.untitled') }), _jsx("span", { className: "truncate text-xs text-text-faint", children: targetOf(connection) })] })] }, connection.id)))] }), _jsx("div", { className: "flex shrink-0 flex-col gap-1 border-t border-border p-2", children: _jsxs(Menu.Root, { children: [_jsxs(Menu.Trigger, { render: _jsx(Button, { variant: "ghost", size: "sm", className: "justify-start" }), children: [_jsx(Icon, { icon: Plus, size: 14 }), t('connections.new')] }), _jsxs(Menu.Popup, { children: [ENGINES.map((engine) => (_jsxs(Menu.Item, { onClick: () => add(engine), children: [_jsx(Icon, { icon: ENGINE_ICONS[engine], size: 14 }), t(`engine.${engine}`)] }, engine))), _jsx(Menu.Separator, {}), _jsxs(Menu.SubmenuRoot, { children: [_jsxs(Menu.SubmenuTrigger, { children: [_jsx(Icon, { icon: Container, size: 14 }), t('connections.fromDocker.label')] }), _jsx(Menu.Popup, { children: _jsx(DockerMenuItems, { onPick: addFromContainer }) })] })] })] }) })] }));
61
61
  const detail = current === null ? (_jsx(EmptyState, { icon: Database, children: t('connections.empty') })) : (_jsxs(_Fragment, { children: [shown !== null && (_jsx(Banner, { icon: 'info' in shown ? CircleCheck : CircleAlert, tone: 'info' in shown ? 'neutral' : 'error', className: "sticky top-0 z-10", message: 'info' in shown
62
62
  ? t('connections.test.success', { server: `${t(`engine.flavor.${shown.info.flavor}`)} ${shown.info.version}` })
63
63
  : shown.error, children: _jsx(CloseButton, { size: "sm", label: t('connections.test.dismiss'), onClick: () => setOutcome(null) }) })), _jsx(DetailHeader, { mark: _jsx(EngineIcon, { engine: current.config.engine, size: 20, className: "mt-0.5 shrink-0 text-text-muted" }), title: current.name || t('connections.untitled'), subtitle: targetOf(current), actions: _jsxs(Button, { variant: "danger-outline", onClick: () => setDeleting(true), children: [_jsx(Icon, { icon: Trash2, size: 14 }), t('connections.delete.action')] }) }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsx(ConnectionForm, { value: current, onValueChange: change, onBrowse: onBrowse }), renderFields?.(current)] }), _jsx(ConnectionTest, { connection: current, onOutcome: setOutcome }, current.id), _jsx(PromptDialog, { open: deleting, danger: true, onOpenChange: setDeleting, title: t('connections.delete.title'), description: t('connections.delete.description', { name: current.name || t('connections.untitled') }), confirmLabel: t('connections.delete.confirm'), onConfirm: async () => {
64
64
  await remove(current);
65
65
  setDeleting(false);
66
66
  } })] }));
67
- return (_jsxs("div", { ref: ref, className: clsx('flex min-h-0 min-w-0 grow max-[640px]:flex-col', className), children: [list, _jsx("div", { className: "min-h-0 min-w-0 grow overflow-y-auto", children: _jsx("div", { className: "flex min-w-0 flex-col gap-6 px-5 py-4", children: detail }) })] }));
67
+ return (_jsxs("div", { ref: ref, className: clsx('flex min-h-0 min-w-0 grow max-[640px]:flex-col', className), children: [list, _jsx(ScrollArea, { className: "grow", children: _jsx("div", { className: "flex min-w-0 flex-col gap-6 px-5 py-4", children: detail }) })] }));
68
68
  }
69
69
  /* The containers Docker is running as menu items. The submenu mounts this when it opens, so Docker is asked only then. */
70
70
  function DockerMenuItems({ onPick }) {
@@ -1,5 +1,5 @@
1
- import type { ConnectionConfig, Engine, MysqlConnectionConfig } from '../protocol/index.ts';
2
1
  import type { Connection } from '../client/types.ts';
2
+ import type { ConnectionConfig, Engine, MysqlConnectionConfig } from '../protocol/index.ts';
3
3
  export declare const DEFAULT_MYSQL_PORT = 3306;
4
4
  export declare const DEFAULT_HOST = "127.0.0.1";
5
5
  export type ConnectMode = 'tcp' | 'socket' | 'ssh' | 'docker';
@@ -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.js';
4
4
  import { DatabaseRequestError } from '../client/types.js';
5
5
  /* The running containers that look like a database, asked for when the component mounts and again on `reload`. */
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PromptDialog, ScrollArea } from '@adecore/ui';
2
3
  import { TriangleAlert } from 'lucide-react';
3
4
  import { useTranslation } from 'react-i18next';
4
- import { PromptDialog } from '@adecore/ui';
5
5
  /* Lists the statements that cannot be taken back and asks before they run. */
6
6
  export function DestructiveDialog({ statements, onConfirm, onCancel, ref }) {
7
7
  const { t } = useTranslation('database');
8
- return (_jsx(PromptDialog, { ref: ref, open: statements.length > 0, danger: true, title: t('console.destructive.title'), titleIcon: TriangleAlert, description: t('console.destructive.description', { count: statements.length }), confirmLabel: t('console.destructive.confirm'), onConfirm: onConfirm, onOpenChange: onCancel, children: _jsx("ul", { className: "mt-3 flex max-h-56 flex-col gap-2 overflow-auto", children: statements.map((statement, index) => (_jsxs("li", { className: "flex min-w-0 flex-col gap-0.5 rounded-md bg-surface-sunken px-2.5 py-1.5", children: [_jsx("span", { className: "text-xs text-status-error", children: t(`console.destructive.${statement.kind}`) }), _jsx("span", { className: "truncate font-mono text-xs text-text", children: statement.sql.replace(/\s+/g, ' ') })] }, `${index}:${statement.sql}`))) }) }));
8
+ return (_jsx(PromptDialog, { ref: ref, open: statements.length > 0, danger: true, title: t('console.destructive.title'), titleIcon: TriangleAlert, description: t('console.destructive.description', { count: statements.length }), confirmLabel: t('console.destructive.confirm'), onConfirm: onConfirm, onOpenChange: onCancel, children: _jsx(ScrollArea, { render: _jsx("ul", {}), className: "mt-3 max-h-56", viewportClassName: "flex flex-col gap-2", children: statements.map((statement, index) => (_jsxs("li", { className: "flex min-w-0 flex-col gap-0.5 rounded-md bg-surface-sunken px-2.5 py-1.5", children: [_jsx("span", { className: "text-xs text-status-error", children: t(`console.destructive.${statement.kind}`) }), _jsx("span", { className: "truncate font-mono text-xs text-text", children: statement.sql.replace(/\s+/g, ' ') })] }, `${index}:${statement.sql}`))) }) }));
9
9
  }
@@ -1,15 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
2
+ import { Icon, IconButton, Input, ScrollArea, isApplePlatform, isModHeld } from '@adecore/ui';
3
+ import { formatMoment, formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { Check, CircleAlert, Search, Trash2 } from 'lucide-react';
6
+ import { useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { Icon, IconButton, Input, isApplePlatform, isModHeld } from '@adecore/ui';
7
- import { formatMoment, formatNumber } from '@adecore/ui/format';
8
8
  import { searchHistory } from './history.js';
9
9
  /* The runs of this connection, newest first, with a search over their SQL. */
10
10
  export function HistoryPanel({ entries, onPick, onClear, className, ref }) {
11
11
  const { t } = useTranslation('database');
12
12
  const [query, setQuery] = useState('');
13
13
  const shown = searchHistory(entries, query);
14
- return (_jsxs("aside", { ref: ref, "aria-label": t('console.history.title'), className: clsx('flex w-72 shrink-0 flex-col border-l border-border', className), children: [_jsxs("div", { className: "flex shrink-0 items-center gap-2 p-2", children: [_jsx(Input, { size: "sm", type: "search", icon: Search, className: "min-w-0 flex-1", "aria-label": t('console.history.search'), placeholder: t('console.history.search'), value: query, onChange: (event) => setQuery(event.target.value) }), _jsx(IconButton, { icon: Trash2, size: "sm", label: t('console.history.clear'), disabled: entries.length === 0, onClick: onClear })] }), _jsx("div", { className: "relative min-h-24 flex-1 border-t border-border", children: shown.length === 0 ? (_jsx("p", { className: "p-3 text-xs text-text-muted", children: entries.length === 0 ? t('console.history.empty') : t('console.history.noMatches') })) : (_jsx("ul", { className: "absolute inset-0 overflow-auto", children: shown.map((entry) => (_jsx("li", { className: "border-b border-border-soft", children: _jsxs("button", { type: "button", className: "flex w-full min-w-0 flex-col gap-0.5 px-3 py-2 text-left hover:bg-surface-hover", onClick: (event) => onPick(entry, isModHeld(event, isApplePlatform())), onDoubleClick: () => onPick(entry, true), children: [_jsx("span", { className: "truncate font-mono text-xs text-text", children: entry.sql.replace(/\s+/g, ' ') }), _jsxs("span", { className: "flex items-center gap-1.5 text-xs text-text-muted tabular-nums", children: [_jsx(Icon, { icon: entry.ok ? Check : CircleAlert, size: 12, className: entry.ok ? 'text-positive' : 'text-status-error' }), formatMoment(entry.at), entry.rows !== null && t('console.history.rows', { count: entry.rows, formatted: formatNumber(entry.rows) })] })] }) }, `${entry.at}:${entry.sql}`))) })) }), _jsx("p", { className: "shrink-0 border-t border-border px-3 py-2 text-xs text-text-faint", children: t('console.history.hint') })] }));
14
+ return (_jsxs("aside", { ref: ref, "aria-label": t('console.history.title'), className: clsx('flex w-72 shrink-0 flex-col border-l border-border', className), children: [_jsxs("div", { className: "flex shrink-0 items-center gap-2 p-2", children: [_jsx(Input, { size: "sm", type: "search", icon: Search, className: "min-w-0 flex-1", "aria-label": t('console.history.search'), placeholder: t('console.history.search'), value: query, onChange: (event) => setQuery(event.target.value) }), _jsx(IconButton, { icon: Trash2, size: "sm", label: t('console.history.clear'), disabled: entries.length === 0, onClick: onClear })] }), _jsx("div", { className: "relative min-h-24 flex-1 border-t border-border", children: shown.length === 0 ? (_jsx("p", { className: "p-3 text-xs text-text-muted", children: entries.length === 0 ? t('console.history.empty') : t('console.history.noMatches') })) : (_jsx(ScrollArea, { render: _jsx("ul", {}), className: "absolute inset-0", children: shown.map((entry) => (_jsx("li", { className: "border-b border-border-soft", children: _jsxs("button", { type: "button", className: "flex w-full min-w-0 flex-col gap-0.5 px-3 py-2 text-left hover:bg-surface-hover", onClick: (event) => onPick(entry, isModHeld(event, isApplePlatform())), onDoubleClick: () => onPick(entry, true), children: [_jsx("span", { className: "truncate font-mono text-xs text-text", children: entry.sql.replace(/\s+/g, ' ') }), _jsxs("span", { className: "flex items-center gap-1.5 text-xs text-text-muted tabular-nums", children: [_jsx(Icon, { icon: entry.ok ? Check : CircleAlert, size: 12, className: entry.ok ? 'text-positive' : 'text-status-error' }), formatMoment(entry.at), entry.rows !== null && t('console.history.rows', { count: entry.rows, formatted: formatNumber(entry.rows) })] })] }) }, `${entry.at}:${entry.sql}`))) })) }), _jsx("p", { className: "shrink-0 border-t border-border px-3 py-2 text-xs text-text-faint", children: t('console.history.hint') })] }));
15
15
  }
@@ -1,22 +1,22 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useId, useMemo, useRef, useState } from 'react';
2
+ import { Banner, Button, ColumnResizeHandle, Icon, IconButton, messageOf, PromptDialog, Spinner, Tabs, Tooltip, useColumnResize } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { Check, CircleAlert, History, Play, Square, X } from 'lucide-react';
6
+ import { useEffect, useId, useMemo, useRef, useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { Banner, Button, ColumnResizeHandle, Icon, IconButton, messageOf, PromptDialog, Spinner, Tabs, Tooltip, useColumnResize } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
- import { isCancelled } from '../client/types.js';
9
8
  import { useDatabaseAction, useDatabaseClient, useDatabaseFiles, useDatabaseNotice, useDatabaseStorage } from '../client-context.js';
9
+ import { isCancelled } from '../client/types.js';
10
10
  import { splitStatements, statementAt } from '../sql-split.js';
11
11
  import { parseStoredSize } from '../stored-size.js';
12
- import { DestructiveDialog } from './DestructiveDialog.js';
13
12
  import { findDestructive } from './destructive.js';
13
+ import { DestructiveDialog } from './DestructiveDialog.js';
14
14
  import { HistoryPanel } from './HistoryPanel.js';
15
15
  import { statementLabel } from './labels.js';
16
16
  import { isPageable, outcomeOf } from './outcome.js';
17
+ import { useResultKeys } from './result-keys.js';
17
18
  import { SchemaPicker } from './SchemaPicker.js';
18
19
  import { orderSchemas } from './schemas.js';
19
- import { useResultKeys } from './result-keys.js';
20
20
  import { RUN_ALL_SHORTCUT, RUN_SHORTCUT } from './shortcuts.js';
21
21
  import { SqlEditor } from './SqlEditor.js';
22
22
  import { StatementResultView } from './StatementResultView.js';
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useTranslation } from 'react-i18next';
3
2
  import { Select } from '@adecore/ui';
3
+ import { useTranslation } from 'react-i18next';
4
4
  export function SchemaPicker({ schemas, value, onValueChange, disabled, className, ref }) {
5
5
  const { t } = useTranslation('database');
6
6
  return (_jsx(Select, { ref: ref, size: "sm", label: t('console.schema'), placeholder: t('console.schemaPlaceholder'), value: value, disabled: disabled, className: className, items: schemas.map((schema) => ({ value: schema.name, label: schema.name })), onValueChange: onValueChange }));
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useImperativeHandle, useRef } from 'react';
3
- import clsx from 'clsx';
4
2
  import { isApplePlatform, TextArea } from '@adecore/ui';
3
+ import clsx from 'clsx';
4
+ import { useEffect, useImperativeHandle, useRef } from 'react';
5
5
  import { CODE_TEXT } from '../code-text.js';
6
6
  import { applyEdit, indentEdit, newlineEdit, outdentEdit } from './editing.js';
7
7
  import { runScopeOf } from './shortcuts.js';
@@ -1,9 +1,9 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, useState } from 'react';
3
- import { ArrowUpRight, ChevronLeft, ChevronRight, CircleAlert, Download, PanelRight } from 'lucide-react';
4
- import { useTranslation } from 'react-i18next';
5
2
  import { Banner, ButtonGroup, ContextMenu, Icon, IconButton, Menu, Spinner } from '@adecore/ui';
6
3
  import { formatDecimal, formatNumber } from '@adecore/ui/format';
4
+ import { ArrowUpRight, ChevronLeft, ChevronRight, CircleAlert, Download, PanelRight } from 'lucide-react';
5
+ import { useMemo, useState } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
7
  import { EXPORT_FORMATS } from '../export-formats.js';
8
8
  import { DataGrid } from '../grid/DataGrid.js';
9
9
  import { previewValueOf } from '../grid/focused-value.js';
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Pill, Switch, Tooltip } from '@adecore/ui';
2
3
  import clsx from 'clsx';
3
4
  import { useTranslation } from 'react-i18next';
4
- import { Button, Pill, Switch, Tooltip } from '@adecore/ui';
5
5
  /* Auto-commit on or off, and while a transaction is open, the way to end it. */
6
6
  export function TransactionControls({ mode, onModeChange, open, busy, onCommit, onRollback, className, ref }) {
7
7
  const { t } = useTranslation('database');
package/dist/ddl/diff.js CHANGED
@@ -1,5 +1,5 @@
1
- import { sameDefinition } from './column.js';
2
1
  import { sameList } from '../same-list.js';
2
+ import { sameDefinition } from './column.js';
3
3
  /* The positions of a longest run that already is in order: those columns can stay where they are. */
4
4
  const longestRun = (positions) => {
5
5
  const length = [];
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from 'react';
2
+ import { Button, ButtonGroup, Checkbox, EmptyState, Icon, IconButton, Input, Pill } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { ArrowDown, ArrowUp, KeyRound, Plus, Trash2 } from 'lucide-react';
6
+ import { useId } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { Button, ButtonGroup, Checkbox, EmptyState, Icon, IconButton, Input, Pill } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
8
  import { typeSuggestionsOf } from '../ddl/index.js';
9
9
  import { addColumn, moveColumn, patchColumn, removeColumn, togglePrimaryKey } from './edit.js';
10
10
  const TH = 'sticky top-0 z-10 h-7 bg-surface px-2 text-left text-xs font-medium whitespace-nowrap text-text-faint';
@@ -1,15 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Banner, Button, DisabledReason, Field, Icon, Input, PromptDialog, ScrollArea, Separator, Tabs, isApplePlatform, matchesShortcut, shortcut } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
2
4
  import clsx from 'clsx';
3
5
  import { CircleAlert, Lock, Undo2 } from 'lucide-react';
4
6
  import { useTranslation } from 'react-i18next';
5
- import { Banner, Button, DisabledReason, Field, Icon, Input, PromptDialog, Separator, Tabs, isApplePlatform, matchesShortcut, shortcut } from '@adecore/ui';
6
- import { formatNumber } from '@adecore/ui/format';
7
7
  import { CODE_TEXT } from '../code-text.js';
8
8
  import { ColumnsEditor } from './ColumnsEditor.js';
9
+ import { renameTable } from './edit.js';
9
10
  import { ForeignKeysEditor } from './ForeignKeysEditor.js';
10
11
  import { IndexesEditor } from './IndexesEditor.js';
11
12
  import { OptionsEditor } from './OptionsEditor.js';
12
- import { renameTable } from './edit.js';
13
13
  import { scriptOf } from './plan.js';
14
14
  import { SqlPreview } from './SqlPreview.js';
15
15
  const APPLY_SHORTCUT = /* @__PURE__ */ shortcut('Mod+S');
@@ -26,9 +26,9 @@ export function DesignerView({ dialect, schema, draft, isNew, changed, tables, p
26
26
  }
27
27
  }
28
28
  }
29
- return (_jsxs("div", { ref: ref, className: clsx('flex min-h-0 min-w-0 flex-col', className), onKeyDown: handleKeyDown, children: [_jsxs("div", { className: "flex shrink-0 items-end gap-3 border-b border-border-soft px-3 py-2", children: [toolbarStart !== undefined && toolbarStart !== null && toolbarStart !== false && (_jsxs("span", { className: "flex h-8 shrink-0 items-center gap-3", children: [toolbarStart, _jsx(Separator, {})] })), _jsx(Field, { label: t('designer.tableName'), className: "w-80", children: _jsx(Input, { mono: true, spellCheck: false, placeholder: t('designer.tableNamePlaceholder'), value: draft.name, disabled: disabled, onChange: (event) => onChange(renameTable(draft, event.target.value)) }) }), _jsxs("div", { className: "ml-auto flex items-center gap-2", children: [_jsxs(Button, { variant: "secondary", disabled: !changed, onClick: onRevert, children: [_jsx(Icon, { icon: Undo2, size: 12 }), t('designer.revert')] }), _jsx(DisabledReason, { reason: applyReason, children: _jsx("span", { className: "inline-flex", children: _jsx(Button, { variant: "primary", disabled: applyReason !== null, onClick: onRequestApply, children: isNew ? t('designer.create') : t('designer.apply') }) }) })] })] }), readOnlyReason !== null && (_jsx("div", { className: "shrink-0 px-3 pt-3", children: _jsx(Banner, { icon: Lock, tone: "neutral", className: "w-full", message: readOnlyReason }) })), failure !== null && (_jsx("div", { className: "shrink-0 px-3 pt-3", children: _jsx(Banner, { icon: CircleAlert, tone: "error", className: "w-full", message: failure, children: _jsx(Button, { variant: "secondary", size: "sm", onClick: onDismissFailure, children: t('designer.dismiss') }) }) })), _jsxs(Tabs.Root, { defaultValue: "columns", className: "flex min-h-0 grow flex-col", children: [_jsxs(Tabs.List, { className: "shrink-0 px-3", children: [_jsxs(Tabs.Tab, { value: "columns", children: [t('designer.tabs.columns'), _jsx(Tabs.Count, { value: draft.columns.length })] }), _jsxs(Tabs.Tab, { value: "indexes", children: [t('designer.tabs.indexes'), _jsx(Tabs.Count, { value: draft.indexes.length })] }), _jsxs(Tabs.Tab, { value: "foreignKeys", children: [t('designer.tabs.foreignKeys'), _jsx(Tabs.Count, { value: draft.foreignKeys.length })] }), _jsx(Tabs.Tab, { value: "options", children: t('designer.tabs.options') })] }), _jsx(Tabs.Panel, { value: "columns", className: "min-h-0 grow overflow-auto", children: _jsx(ColumnsEditor, { draft: draft, dialect: dialect, disabled: disabled, onChange: onChange }) }), _jsx(Tabs.Panel, { value: "indexes", className: "min-h-0 grow overflow-auto", children: _jsx(IndexesEditor, { draft: draft, dialect: dialect, disabled: disabled, onChange: onChange }) }), _jsx(Tabs.Panel, { value: "foreignKeys", className: "min-h-0 grow overflow-auto", children: _jsx(ForeignKeysEditor, { draft: draft, dialect: dialect, disabled: disabled, schema: schema, tables: tables, referenceColumns: referenceColumns, onChange: onChange }) }), _jsx(Tabs.Panel, { value: "options", className: "min-h-0 grow overflow-auto", children: _jsx(OptionsEditor, { draft: draft, dialect: dialect, disabled: disabled, onChange: onChange }) })] }), _jsx(SqlPreview, { plan: plan, className: "shrink-0" }), _jsxs(PromptDialog, { open: confirming, danger: plan.destructive, title: t('designer.confirm.title', { count: plan.statements.length, formatted: formatNumber(plan.statements.length) }), description: isNew ? t('designer.confirm.create', { table: draft.name }) : t('designer.confirm.alter', { table: draft.originalName }), confirmLabel: isNew ? t('designer.create') : t('designer.apply'), confirmBusyLabel: t('designer.applying'), onConfirm: onConfirm, onOpenChange: (open) => {
29
+ return (_jsxs("div", { ref: ref, className: clsx('flex min-h-0 min-w-0 flex-col', className), onKeyDown: handleKeyDown, children: [_jsxs("div", { className: "flex shrink-0 items-end gap-3 border-b border-border-soft px-3 py-2", children: [toolbarStart !== undefined && toolbarStart !== null && toolbarStart !== false && (_jsxs("span", { className: "flex h-8 shrink-0 items-center gap-3", children: [toolbarStart, _jsx(Separator, {})] })), _jsx(Field, { label: t('designer.tableName'), className: "w-80", children: _jsx(Input, { mono: true, spellCheck: false, placeholder: t('designer.tableNamePlaceholder'), value: draft.name, disabled: disabled, onChange: (event) => onChange(renameTable(draft, event.target.value)) }) }), _jsxs("div", { className: "ml-auto flex items-center gap-2", children: [_jsxs(Button, { variant: "secondary", disabled: !changed, onClick: onRevert, children: [_jsx(Icon, { icon: Undo2, size: 12 }), t('designer.revert')] }), _jsx(DisabledReason, { reason: applyReason, children: _jsx("span", { className: "inline-flex", children: _jsx(Button, { variant: "primary", disabled: applyReason !== null, onClick: onRequestApply, children: isNew ? t('designer.create') : t('designer.apply') }) }) })] })] }), readOnlyReason !== null && (_jsx("div", { className: "shrink-0 px-3 pt-3", children: _jsx(Banner, { icon: Lock, tone: "neutral", className: "w-full", message: readOnlyReason }) })), failure !== null && (_jsx("div", { className: "shrink-0 px-3 pt-3", children: _jsx(Banner, { icon: CircleAlert, tone: "error", className: "w-full", message: failure, children: _jsx(Button, { variant: "secondary", size: "sm", onClick: onDismissFailure, children: t('designer.dismiss') }) }) })), _jsxs(Tabs.Root, { defaultValue: "columns", className: "flex min-h-0 grow flex-col", children: [_jsxs(Tabs.List, { className: "shrink-0 px-3", children: [_jsxs(Tabs.Tab, { value: "columns", children: [t('designer.tabs.columns'), _jsx(Tabs.Count, { value: draft.columns.length })] }), _jsxs(Tabs.Tab, { value: "indexes", children: [t('designer.tabs.indexes'), _jsx(Tabs.Count, { value: draft.indexes.length })] }), _jsxs(Tabs.Tab, { value: "foreignKeys", children: [t('designer.tabs.foreignKeys'), _jsx(Tabs.Count, { value: draft.foreignKeys.length })] }), _jsx(Tabs.Tab, { value: "options", children: t('designer.tabs.options') })] }), _jsx(Tabs.Panel, { value: "columns", render: _jsx(ScrollArea, { axis: "both" }), className: "grow", children: _jsx(ColumnsEditor, { draft: draft, dialect: dialect, disabled: disabled, onChange: onChange }) }), _jsx(Tabs.Panel, { value: "indexes", render: _jsx(ScrollArea, { axis: "both" }), className: "grow", children: _jsx(IndexesEditor, { draft: draft, dialect: dialect, disabled: disabled, onChange: onChange }) }), _jsx(Tabs.Panel, { value: "foreignKeys", render: _jsx(ScrollArea, { axis: "both" }), className: "grow", children: _jsx(ForeignKeysEditor, { draft: draft, dialect: dialect, disabled: disabled, schema: schema, tables: tables, referenceColumns: referenceColumns, onChange: onChange }) }), _jsx(Tabs.Panel, { value: "options", render: _jsx(ScrollArea, { axis: "both" }), className: "grow", children: _jsx(OptionsEditor, { draft: draft, dialect: dialect, disabled: disabled, onChange: onChange }) })] }), _jsx(SqlPreview, { plan: plan, className: "shrink-0" }), _jsxs(PromptDialog, { open: confirming, danger: plan.destructive, title: t('designer.confirm.title', { count: plan.statements.length, formatted: formatNumber(plan.statements.length) }), description: isNew ? t('designer.confirm.create', { table: draft.name }) : t('designer.confirm.alter', { table: draft.originalName }), confirmLabel: isNew ? t('designer.create') : t('designer.apply'), confirmBusyLabel: t('designer.applying'), onConfirm: onConfirm, onOpenChange: (open) => {
30
30
  if (!open) {
31
31
  onCancelConfirm();
32
32
  }
33
- }, children: [plan.destructive && _jsx("p", { className: "mt-3 text-xs text-status-error", children: t('designer.confirm.destructive') }), _jsx("pre", { className: clsx(CODE_TEXT, 'mt-3 max-h-64 overflow-auto rounded-md bg-surface-sunken p-2 whitespace-pre text-text select-text'), children: scriptOf(plan.statements) })] })] }));
33
+ }, children: [plan.destructive && _jsx("p", { className: "mt-3 text-xs text-status-error", children: t('designer.confirm.destructive') }), _jsx(ScrollArea, { axis: "both", render: _jsx("pre", {}), className: "mt-3 max-h-64 rounded-md bg-surface-sunken", viewportClassName: clsx(CODE_TEXT, 'p-2 whitespace-pre text-text select-text'), children: scriptOf(plan.statements) })] })] }));
34
34
  }
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, EmptyState, Field, Icon, IconButton, Input, Select, Spinner } from '@adecore/ui';
2
3
  import clsx from 'clsx';
3
4
  import { Plus, Trash2 } from 'lucide-react';
4
5
  import { useTranslation } from 'react-i18next';
5
- import { Button, EmptyState, Field, Icon, IconButton, Input, Select, Spinner } from '@adecore/ui';
6
6
  import { FOREIGN_KEY_ACTIONS } from '../ddl/index.js';
7
- import { NamePicker } from './NamePicker.js';
8
7
  import { addForeignKey, patchForeignKey, removeForeignKey, setReferencedTable, toggleForeignKeyColumn } from './edit.js';
8
+ import { NamePicker } from './NamePicker.js';
9
9
  /* The engine's own behavior, which a key has without a clause. */
10
10
  const DEFAULT_ACTION = 'default';
11
11
  /* The foreign keys of the table. Each points at a table of the same schema, picked from the list, and at columns of that table. */
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Checkbox, EmptyState, Icon, IconButton, Input } from '@adecore/ui';
2
3
  import clsx from 'clsx';
3
4
  import { Plus, Trash2 } from 'lucide-react';
4
5
  import { useTranslation } from 'react-i18next';
5
- import { Button, Checkbox, EmptyState, Icon, IconButton, Input } from '@adecore/ui';
6
- import { NamePicker } from './NamePicker.js';
7
6
  import { addIndex, patchIndex, removeIndex, toggleIndexColumn } from './edit.js';
7
+ import { NamePicker } from './NamePicker.js';
8
8
  /* The indexes of the table other than its primary key, each over columns picked from the draft. */
9
9
  export function IndexesEditor({ draft, disabled, onChange, className, ref }) {
10
10
  const { t } = useTranslation('database');
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import clsx from 'clsx';
3
- import { useTranslation } from 'react-i18next';
4
2
  import { Button } from '@adecore/ui';
5
3
  import { formatNumber } from '@adecore/ui/format';
4
+ import clsx from 'clsx';
5
+ import { useTranslation } from 'react-i18next';
6
6
  /* Picks some of a few names, such as the columns of an index, and numbers the picks once there is more than one. */
7
7
  export function NamePicker({ options, value, onToggle, label, disabled = false, className, ref }) {
8
8
  const { t } = useTranslation('database');
@@ -1,8 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from 'react';
2
+ import { Field, Input, Switch, TextArea } from '@adecore/ui';
3
3
  import clsx from 'clsx';
4
+ import { useId } from 'react';
4
5
  import { useTranslation } from 'react-i18next';
5
- import { Field, Input, Switch, TextArea } from '@adecore/ui';
6
6
  import { MYSQL_CHARSETS, MYSQL_ENGINES, collationSuggestionsOf } from '../ddl/index.js';
7
7
  import { patchOptions } from './edit.js';
8
8
  /* The options of a table, which differ per engine: a storage engine and character set on MySQL, rowid and strict typing on SQLite. */
@@ -1,8 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Icon, ScrollArea, copyText } from '@adecore/ui';
2
3
  import clsx from 'clsx';
3
4
  import { Copy } from 'lucide-react';
4
5
  import { useTranslation } from 'react-i18next';
5
- import { Button, Icon, copyText } from '@adecore/ui';
6
6
  import { CODE_TEXT } from '../code-text.js';
7
7
  import { scriptOf } from './plan.js';
8
8
  /* The sentence a problem of the draft is read as. */
@@ -14,5 +14,5 @@ function ProblemText({ problem }) {
14
14
  export function SqlPreview({ plan, className, ref }) {
15
15
  const { t } = useTranslation('database');
16
16
  const script = scriptOf(plan.statements);
17
- return (_jsxs("section", { ref: ref, "aria-label": t('designer.sql'), className: clsx('relative flex min-h-0 flex-col border-t border-border-soft bg-surface-sunken', className), children: [_jsxs("div", { className: "flex h-8 shrink-0 items-center justify-between pr-2 pl-3", children: [_jsx("span", { className: "text-xs font-medium text-text-faint", children: t('designer.sql') }), _jsxs(Button, { variant: "ghost", size: "xs", disabled: script === '', onClick: () => copyText(script), children: [_jsx(Icon, { icon: Copy, size: 12 }), t('designer.copy')] })] }), _jsx("div", { className: "max-h-48 min-h-12 overflow-auto px-3 pb-3 select-text", children: plan.problems.length > 0 ? (_jsx("ul", { className: "flex flex-col gap-1 text-xs text-status-error", children: plan.problems.map((problem, i) => (_jsx("li", { children: _jsx(ProblemText, { problem: problem }) }, `${problem.code}:${problem.subject}:${i}`))) })) : script === '' ? (_jsx("p", { className: "text-xs text-text-faint", children: t('designer.noChanges') })) : (_jsx("pre", { className: clsx(CODE_TEXT, 'whitespace-pre text-text'), children: script })) })] }));
17
+ return (_jsxs("section", { ref: ref, "aria-label": t('designer.sql'), className: clsx('relative flex min-h-0 flex-col border-t border-border-soft bg-surface-sunken', className), children: [_jsxs("div", { className: "flex h-8 shrink-0 items-center justify-between pr-2 pl-3", children: [_jsx("span", { className: "text-xs font-medium text-text-faint", children: t('designer.sql') }), _jsxs(Button, { variant: "ghost", size: "xs", disabled: script === '', onClick: () => copyText(script), children: [_jsx(Icon, { icon: Copy, size: 12 }), t('designer.copy')] })] }), _jsx(ScrollArea, { axis: "both", className: "max-h-48 min-h-12", viewportClassName: "px-3 pb-3 select-text", children: plan.problems.length > 0 ? (_jsx("ul", { className: "flex flex-col gap-1 text-xs text-status-error", children: plan.problems.map((problem, i) => (_jsx("li", { children: _jsx(ProblemText, { problem: problem }) }, `${problem.code}:${problem.subject}:${i}`))) })) : script === '' ? (_jsx("p", { className: "text-xs text-text-faint", children: t('designer.noChanges') })) : (_jsx("pre", { className: clsx(CODE_TEXT, 'whitespace-pre text-text'), children: script })) })] }));
18
18
  }
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, useRef, useState } from 'react';
2
+ import { Banner, Button, Spinner, messageOf } from '@adecore/ui';
3
3
  import clsx from 'clsx';
4
4
  import { CircleAlert, RefreshCw } from 'lucide-react';
5
+ import { useMemo, useRef, useState } from 'react';
5
6
  import { useTranslation } from 'react-i18next';
6
- import { Banner, Button, Spinner, messageOf } from '@adecore/ui';
7
7
  import { useDatabaseAction, useDatabaseClient } from '../client-context.js';
8
8
  import { dialectOf, draftOf, emptyDraft } from '../ddl/index.js';
9
9
  import { useLoaded } from '../table/useLoaded.js';
@@ -1,5 +1,5 @@
1
- import type { TableStructure } from '../protocol/index.ts';
2
1
  import { type Dialect, type DraftProblem, type TableDraft } from '../ddl/index.ts';
2
+ import type { TableStructure } from '../protocol/index.ts';
3
3
  export interface Plan {
4
4
  readonly problems: readonly DraftProblem[];
5
5
  readonly statements: readonly string[];
@@ -1,13 +1,13 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from 'react';
2
+ import { Button, ContextMenu, EmptyState, Icon, Input, ScrollArea, Spinner, Tooltip, Tree } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { CircleAlert, Columns2, Database, Eye, Folder, KeyRound, ListOrdered, Lock, Search, ShieldCheck, Table, Zap } from 'lucide-react';
6
+ import { useEffect, useRef, useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { Button, ContextMenu, EmptyState, Icon, Input, Spinner, Tooltip, Tree } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
8
  import { useDatabaseAction, useDatabaseClient } from '../client-context.js';
9
- import { EngineIcon } from '../connections/EngineIcon.js';
10
9
  import { keyLabelOf } from '../column-keys.js';
10
+ import { EngineIcon } from '../connections/EngineIcon.js';
11
11
  import { KeyIcon } from '../KeyIcon.js';
12
12
  import { usePopupPress } from '../use-popup-press.js';
13
13
  import { RowMenu } from './RowMenu.js';
@@ -229,7 +229,7 @@ export function DatabaseExplorer({ connections, value, defaultValue = null, onVa
229
229
  if (e.key === 'Escape') {
230
230
  setFilter('');
231
231
  }
232
- } }) }), connections.length === 0 ? (_jsx(EmptyState, { icon: Database, children: t('explorer.noConnections') })) : rows.length === 0 ? (_jsx(EmptyState, { icon: Search, children: t('explorer.noMatches', { query: filter.trim() }) })) : (_jsx(Tree.Root, { "aria-label": t('explorer.label'), overflow: "scroll", className: "min-h-0 grow overflow-y-auto pt-2", onKeyDown: onKeyDown, children: rows.map(renderRow) })), request !== null && _jsx(TableDialog, { request: request, onClose: () => setRequest(null), onDone: finish })] }));
232
+ } }) }), connections.length === 0 ? (_jsx(EmptyState, { icon: Database, children: t('explorer.noConnections') })) : rows.length === 0 ? (_jsx(EmptyState, { icon: Search, children: t('explorer.noMatches', { query: filter.trim() }) })) : (_jsx(ScrollArea, { render: _jsx(Tree.Root, { "aria-label": t('explorer.label'), overflow: "scroll", onKeyDown: onKeyDown }), className: "grow", viewportClassName: "pt-2", children: rows.map(renderRow) })), request !== null && _jsx(TableDialog, { request: request, onClose: () => setRequest(null), onDone: finish })] }));
233
233
  }
234
234
  function RowContent({ row, onToggle }) {
235
235
  const { t } = useTranslation('database');
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Fragment } from 'react';
2
+ import { ContextMenu, copyText, Icon } from '@adecore/ui';
3
3
  import { Copy, Eraser, PencilRuler, Pencil, Plus, RefreshCw, Settings2, SquareTerminal, Table, TableProperties, Trash2, Unplug } from 'lucide-react';
4
+ import { Fragment } from 'react';
4
5
  import { useTranslation } from 'react-i18next';
5
- import { ContextMenu, copyText, Icon } from '@adecore/ui';
6
6
  import { useDatabaseAction, useDatabaseClient } from '../client-context.js';
7
7
  import { selectAllSql } from './tree.js';
8
8
  /* The items of a row's context menu. An item whose action has nowhere to go, or that writes to a read only connection, is left out. */
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useTranslation } from 'react-i18next';
3
2
  import { PromptDialog } from '@adecore/ui';
4
- import { dialectOf } from '../ddl/index.js';
3
+ import { useTranslation } from 'react-i18next';
5
4
  import { useDatabaseClient } from '../client-context.js';
5
+ import { dialectOf } from '../ddl/index.js';
6
6
  import { statementOf } from './table-statements.js';
7
7
  /* The question behind Rename, Truncate and Drop: it runs the statement, keeps a failure in the dialog and sees to it that the listeners hear the shape changed. */
8
8
  export function TableDialog({ request, onClose, onDone }) {
@@ -1,5 +1,5 @@
1
- import type { ReactNode } from 'react';
2
1
  import type { LucideIcon } from 'lucide-react';
2
+ import type { ReactNode } from 'react';
3
3
  export interface ExplorerItem {
4
4
  readonly id: string;
5
5
  readonly label: string;
@@ -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 { useDatabaseClient } from '../client-context.js';
4
4
  import { IDLE, loadKey } from './tree.js';
5
5
  const EMPTY = { entries: new Map(), versions: new Map() };
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useRef } from 'react';
3
- import clsx from 'clsx';
4
2
  import { Input } from '@adecore/ui';
3
+ import clsx from 'clsx';
4
+ import { useEffect, useRef } from 'react';
5
5
  import { CODE_TEXT } from '../code-text.js';
6
6
  /* The input a cell turns into while it is edited. It takes the focus and selects its text when it appears. */
7
7
  export function CellEditor({ value, label, onValueChange, onCommit, onCancel }) {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ContextMenu, Icon } from '@adecore/ui';
2
3
  import { Braces, Copy, Database, FileSpreadsheet, Table2 } from 'lucide-react';
3
4
  import { useTranslation } from 'react-i18next';
4
- import { ContextMenu, Icon } from '@adecore/ui';
5
5
  const ICONS = { tsv: Table2, csv: FileSpreadsheet, json: Braces, sql: Database };
6
6
  export function CopyAsMenu({ disabled, formats, onCopy }) {
7
7
  const { t } = useTranslation('database');
@@ -1,15 +1,16 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
2
+ import { ContextMenu, copyText, EDIT_SHORTCUTS, Icon, isApplePlatform, isModHeld, Kbd, ScrollArea, useContentSize } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { Ban, Copy, RotateCcw } from 'lucide-react';
6
+ import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { ContextMenu, copyText, EDIT_SHORTCUTS, Icon, isApplePlatform, isModHeld, Kbd, useContentSize } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
8
  import { assignRef } from '../assign-ref.js';
9
9
  import { useNumberNotation } from '../client-context.js';
10
- import { usePopupPress } from '../use-popup-press.js';
11
10
  import { useDatabaseResources } from '../use-database-resources.js';
11
+ import { usePopupPress } from '../use-popup-press.js';
12
12
  import { useStableCallback } from '../use-stable-callback.js';
13
+ import { cellIdOf } from './cell-id.js';
13
14
  import { fullRect, rectBetween, rectContains } from './cell-range.js';
14
15
  import { captureLayout, restoreLayout, sameLayout } from './column-layout.js';
15
16
  import { NO_COLUMN_SELECTION, selectColumn, shownSelection } from './column-selection.js';
@@ -20,7 +21,6 @@ import { columnNotation, cellView, copyTextOf, isPreview } from './display.js';
20
21
  import { draftOf, parseDraft } from './edit-value.js';
21
22
  import { parseEnumType } from './enum-type.js';
22
23
  import { GridHeaderCell } from './GridHeaderCell.js';
23
- import { cellIdOf } from './cell-id.js';
24
24
  import { GridRowView, PINNED_GROUP } from './GridRowView.js';
25
25
  import { clampColumnWidth, columnOffsets, estimateColumnWidth, fitColumnWidth, FALLBACK_VIEWPORT_HEIGHT, growWidths, gutterWidth, drawnRange, HEADER_HEIGHT, ROW_HEIGHT, scrollBlock, scrollToReveal } from './layout.js';
26
26
  import { moveFocus } from './navigation.js';
@@ -524,5 +524,5 @@ export function DataGrid({ columns, rows, label, editable = false, selectedKeys,
524
524
  rowKeys: selection.has(menuRow.key) ? rows.filter((row) => selection.has(row.key)).map((row) => row.key) : [menuRow.key],
525
525
  cell: menuTarget.column === null ? null : { rowKey: menuRow.key, column: menuTarget.column }
526
526
  };
527
- return (_jsx("div", { ref: attach, role: "grid", "aria-label": label, "aria-rowcount": rows.length + 1, "aria-colcount": order.length + 1, "aria-activedescendant": pickedColumns.length > 0 ? headerId(pickedColumns[0]) : focusCell === null ? undefined : cellId(focusCell.row, focusCell.column), tabIndex: 0, className: clsx('group/grid relative min-h-0 flex-1 overflow-auto bg-surface text-text outline-none', className), onKeyDown: handleKeyDown, onScroll: (event) => setScrolledBlock(scrollBlock(event.currentTarget.scrollTop - HEADER_HEIGHT)), children: _jsxs("div", { className: "relative min-w-full", style: { width: totalWidth }, children: [_jsxs("div", { role: "row", "aria-rowindex": 1, className: "sticky top-0 z-20 flex w-full border-b border-border bg-surface", style: { height: HEADER_HEIGHT }, children: [_jsxs("div", { className: PINNED_GROUP, children: [_jsx("div", { className: "shrink-0 border-r border-border bg-surface bg-clip-border", style: { width: gutter } }), headerCells.slice(0, pinnedShown)] }), headerCells.slice(pinnedShown)] }), _jsxs(ContextMenu.Root, { children: [_jsx(ContextMenu.Trigger, { role: "rowgroup", className: "relative", style: { height: rows.length * ROW_HEIGHT }, children: Array.from({ length: range.end - range.start }, (_, offset) => renderRow(range.start + offset)) }), _jsxs(ContextMenu.Popup, { children: [_jsxs(ContextMenu.Item, { disabled: menuCell === null, onClick: copyCell, children: [_jsx(Icon, { icon: Copy, size: 14 }), t('grid.copyValue'), _jsx(Kbd, { shortcut: EDIT_SHORTCUTS.copy })] }), _jsx(CopyAsMenu, { disabled: block === null, formats: sqlTarget === undefined ? COPY_FORMATS.filter((format) => format !== 'sql') : COPY_FORMATS, onCopy: (format) => void copyAs(format) }), menuContext !== null && menuCell !== null && queryMenu !== undefined && (_jsxs(_Fragment, { children: [_jsx(ContextMenu.Separator, {}), queryMenu(menuContext)] })), _jsx(ContextMenu.Separator, {}), editable && menuCell !== null && (_jsxs(_Fragment, { children: [_jsxs(ContextMenu.Item, { disabled: !settable || !nullable, onClick: () => commitValue(null), children: [_jsx(Icon, { icon: Ban, size: 14 }), t('grid.setNull')] }), hasDefault && (_jsxs(ContextMenu.Item, { disabled: !settable, onClick: () => commitValue({ kind: 'default' }), children: [_jsx(Icon, { icon: RotateCcw, size: 14 }), t('grid.setDefault')] }))] })), _jsx(ContextMenu.Separator, {}), menuContext !== null && menu?.(menuContext)] })] }), rows.length === 0 && empty !== undefined && _jsx("div", { className: "sticky left-0 w-fit px-4 py-6 text-xs text-text-muted", children: empty })] }) }));
527
+ return (_jsx(ScrollArea, { axis: "both", viewportRef: attach, role: "grid", "aria-label": label, "aria-rowcount": rows.length + 1, "aria-colcount": order.length + 1, "aria-activedescendant": pickedColumns.length > 0 ? headerId(pickedColumns[0]) : focusCell === null ? undefined : cellId(focusCell.row, focusCell.column), tabIndex: 0, className: clsx('flex-1 bg-surface text-text', className), viewportClassName: "group/grid relative outline-none", onKeyDown: handleKeyDown, onScroll: (event) => setScrolledBlock(scrollBlock(event.currentTarget.scrollTop - HEADER_HEIGHT)), children: _jsxs("div", { className: "relative min-w-full", style: { width: totalWidth }, children: [_jsxs("div", { role: "row", "aria-rowindex": 1, className: "sticky top-0 z-20 flex w-full border-b border-border bg-surface", style: { height: HEADER_HEIGHT }, children: [_jsxs("div", { className: PINNED_GROUP, children: [_jsx("div", { className: "shrink-0 border-r border-border bg-surface bg-clip-border", style: { width: gutter } }), headerCells.slice(0, pinnedShown)] }), headerCells.slice(pinnedShown)] }), _jsxs(ContextMenu.Root, { children: [_jsx(ContextMenu.Trigger, { role: "rowgroup", className: "relative", style: { height: rows.length * ROW_HEIGHT }, children: Array.from({ length: range.end - range.start }, (_, offset) => renderRow(range.start + offset)) }), _jsxs(ContextMenu.Popup, { children: [_jsxs(ContextMenu.Item, { disabled: menuCell === null, onClick: copyCell, children: [_jsx(Icon, { icon: Copy, size: 14 }), t('grid.copyValue'), _jsx(Kbd, { shortcut: EDIT_SHORTCUTS.copy })] }), _jsx(CopyAsMenu, { disabled: block === null, formats: sqlTarget === undefined ? COPY_FORMATS.filter((format) => format !== 'sql') : COPY_FORMATS, onCopy: (format) => void copyAs(format) }), menuContext !== null && menuCell !== null && queryMenu !== undefined && (_jsxs(_Fragment, { children: [_jsx(ContextMenu.Separator, {}), queryMenu(menuContext)] })), _jsx(ContextMenu.Separator, {}), editable && menuCell !== null && (_jsxs(_Fragment, { children: [_jsxs(ContextMenu.Item, { disabled: !settable || !nullable, onClick: () => commitValue(null), children: [_jsx(Icon, { icon: Ban, size: 14 }), t('grid.setNull')] }), hasDefault && (_jsxs(ContextMenu.Item, { disabled: !settable, onClick: () => commitValue({ kind: 'default' }), children: [_jsx(Icon, { icon: RotateCcw, size: 14 }), t('grid.setDefault')] }))] })), _jsx(ContextMenu.Separator, {}), menuContext !== null && menu?.(menuContext)] })] }), rows.length === 0 && empty !== undefined && _jsx("div", { className: "sticky left-0 w-fit px-4 py-6 text-xs text-text-muted", children: empty })] }) }));
528
528
  }
@@ -1,9 +1,9 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef, useState } from 'react';
2
+ import { Icon, Menu } from '@adecore/ui';
3
3
  import clsx from 'clsx';
4
4
  import { Ban, ChevronDown } from 'lucide-react';
5
+ import { useRef, useState } from 'react';
5
6
  import { useTranslation } from 'react-i18next';
6
- import { Icon, Menu } from '@adecore/ui';
7
7
  import { CODE_TEXT } from '../code-text.js';
8
8
  import { joinMembers, membersOf } from './enum-type.js';
9
9
  const LOOK = {
@@ -1,10 +1,10 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useRef } from 'react';
2
+ import { ColumnResizeHandle, ContextMenu, copyText, Icon, IconButton, isApplePlatform, isModHeld, Menu, Tooltip, useColumnResize } from '@adecore/ui';
3
+ import { formatNumber } from '@adecore/ui/format';
3
4
  import clsx from 'clsx';
4
5
  import { ArrowDown, ArrowUp, ArrowUpDown, ChevronDown, Copy, Eye, EyeOff, Pin, PinOff } from 'lucide-react';
6
+ import { useRef } from 'react';
5
7
  import { useTranslation } from 'react-i18next';
6
- import { ColumnResizeHandle, ContextMenu, copyText, Icon, IconButton, isApplePlatform, isModHeld, Menu, Tooltip, useColumnResize } from '@adecore/ui';
7
- import { formatNumber } from '@adecore/ui/format';
8
8
  import { CODE_TEXT } from '../code-text.js';
9
9
  import { keyLabelOf } from '../column-keys.js';
10
10
  import { KeyIcon } from '../KeyIcon.js';
@@ -1,11 +1,11 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo } from 'react';
3
- import clsx from 'clsx';
4
2
  import { Spinner } from '@adecore/ui';
5
3
  import { formatNumber } from '@adecore/ui/format';
4
+ import clsx from 'clsx';
5
+ import { memo } from 'react';
6
6
  import { CODE_TEXT } from '../code-text.js';
7
- import { CellEditor } from './CellEditor.js';
8
7
  import { cellIdOf } from './cell-id.js';
8
+ import { CellEditor } from './CellEditor.js';
9
9
  import { columnNotation, cellView } from './display.js';
10
10
  import { EnumPicker } from './EnumPicker.js';
11
11
  import { ROW_HEIGHT } from './layout.js';