@humbdb/ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -0
- package/dist/index.d.ts +142 -0
- package/dist/index.js +1221 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Humb contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ConsoleEvent, FileNode, TableMetadata, ConnectionStatus, SchemaMetadata, DatabaseEngine, RowPage, ColumnMetadata } from '@humbdb/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ConsoleLogProps {
|
|
5
|
+
events: ConsoleEvent[];
|
|
6
|
+
onClear: () => void;
|
|
7
|
+
}
|
|
8
|
+
/** A read-only stream of recent connection/query events (DF-07), with a client-side Clear action. */
|
|
9
|
+
declare function ConsoleLog({ events, onClear }: ConsoleLogProps): ReactNode;
|
|
10
|
+
|
|
11
|
+
interface FilesBrowserProps {
|
|
12
|
+
tree: FileNode[];
|
|
13
|
+
selectedPath?: string;
|
|
14
|
+
onSelectFile: (path: string) => void;
|
|
15
|
+
content?: string;
|
|
16
|
+
isContentLoading?: boolean;
|
|
17
|
+
contentError?: string;
|
|
18
|
+
}
|
|
19
|
+
/** A read-only browser for `.sql` files (DF-06): a folder/file tree plus a line-numbered preview. */
|
|
20
|
+
declare function FilesBrowser({ tree, selectedPath, onSelectFile, content, isContentLoading, contentError }: FilesBrowserProps): ReactNode;
|
|
21
|
+
|
|
22
|
+
interface SchemaGridProps {
|
|
23
|
+
tables: TableMetadata[];
|
|
24
|
+
}
|
|
25
|
+
/** Full-database overview: every table as a card, reusing TableDetail's column-row pattern. */
|
|
26
|
+
declare function SchemaGrid({ tables }: SchemaGridProps): ReactNode;
|
|
27
|
+
|
|
28
|
+
interface SelectedTable {
|
|
29
|
+
schema: string;
|
|
30
|
+
table: string;
|
|
31
|
+
}
|
|
32
|
+
interface SchemaTreeProps {
|
|
33
|
+
target: string | null;
|
|
34
|
+
status: ConnectionStatus;
|
|
35
|
+
schemas: SchemaMetadata[];
|
|
36
|
+
selected?: SelectedTable;
|
|
37
|
+
onSelect: (schema: string, table: string) => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A searchable, collapsible navigation tree: connection -> schema -> table, mirroring
|
|
41
|
+
* docs/references/design-system.md's TreeNode pattern. Purely presentational: selection is owned
|
|
42
|
+
* by the caller. Matching a search term force-opens its ancestor path and highlights the match.
|
|
43
|
+
*/
|
|
44
|
+
declare function SchemaTree({ target, status, schemas, selected, onSelect }: SchemaTreeProps): ReactNode;
|
|
45
|
+
|
|
46
|
+
interface SidebarProps {
|
|
47
|
+
target: string | null;
|
|
48
|
+
status: ConnectionStatus;
|
|
49
|
+
schemas: SchemaMetadata[];
|
|
50
|
+
selected?: SelectedTable;
|
|
51
|
+
onSelect: (schema: string, table: string) => void;
|
|
52
|
+
isLoading?: boolean;
|
|
53
|
+
isError?: boolean;
|
|
54
|
+
onRetry?: () => void;
|
|
55
|
+
open: boolean;
|
|
56
|
+
onOpenChange: (open: boolean) => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The app shell's left rail: a searchable schema tree. Desktop collapses to an icon rail; below
|
|
60
|
+
* the `md` breakpoint it becomes an off-canvas overlay drawer (opened via TitleBar's hamburger),
|
|
61
|
+
* both driven by the same `open` state so there is one source of truth for visibility.
|
|
62
|
+
*/
|
|
63
|
+
declare function Sidebar({ target, status, schemas, selected, onSelect, isLoading, isError, onRetry, open, onOpenChange }: SidebarProps): ReactNode;
|
|
64
|
+
|
|
65
|
+
interface SpinnerProps {
|
|
66
|
+
className?: string;
|
|
67
|
+
}
|
|
68
|
+
/** A small spinning loading indicator. Size/color via className (defaults to muted, 12px). */
|
|
69
|
+
declare function Spinner({ className }: SpinnerProps): ReactNode;
|
|
70
|
+
|
|
71
|
+
interface StatusBarProps {
|
|
72
|
+
status: ConnectionStatus;
|
|
73
|
+
engine?: DatabaseEngine;
|
|
74
|
+
engineVersion?: string | null;
|
|
75
|
+
schema?: string;
|
|
76
|
+
lastQueryMs?: number;
|
|
77
|
+
}
|
|
78
|
+
/** Bottom chrome bar: connection status, engine + version, current schema, encoding. */
|
|
79
|
+
declare function StatusBar({ status, engine, engineVersion, schema, lastQueryMs }: StatusBarProps): ReactNode;
|
|
80
|
+
|
|
81
|
+
type ShellTab = "sql-editor" | "tables" | "schema" | "files" | "console";
|
|
82
|
+
interface TabBarProps {
|
|
83
|
+
active: ShellTab;
|
|
84
|
+
onChange: (tab: ShellTab) => void;
|
|
85
|
+
}
|
|
86
|
+
/** The IDE-style tab strip switching between the shell's five content panes. */
|
|
87
|
+
declare function TabBar({ active, onChange }: TabBarProps): ReactNode;
|
|
88
|
+
|
|
89
|
+
interface TableDetailProps {
|
|
90
|
+
table: TableMetadata;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Columns, primary key, indexes, and approximate row count for a single table. Also reused as
|
|
94
|
+
* each card in `SchemaGrid`, the Schema tab's full-database overview.
|
|
95
|
+
*/
|
|
96
|
+
declare function TableDetail({ table }: TableDetailProps): ReactNode;
|
|
97
|
+
|
|
98
|
+
interface TitleBarProps {
|
|
99
|
+
status: ConnectionStatus;
|
|
100
|
+
target: string | null;
|
|
101
|
+
theme: "light" | "dark";
|
|
102
|
+
onToggleTheme: () => void;
|
|
103
|
+
onRefresh: () => void;
|
|
104
|
+
isRefreshing?: boolean;
|
|
105
|
+
onToggleSidebar: () => void;
|
|
106
|
+
}
|
|
107
|
+
/** Top chrome bar: wordmark, connection breadcrumb, status dot, and window-level actions. */
|
|
108
|
+
declare function TitleBar({ status, target, theme, onToggleTheme, onRefresh, isRefreshing, onToggleSidebar }: TitleBarProps): ReactNode;
|
|
109
|
+
|
|
110
|
+
interface TypeIconProps {
|
|
111
|
+
dataType: string;
|
|
112
|
+
}
|
|
113
|
+
/** A small colored icon for a column's data type, matching docs/references/design-system.md's mapping. */
|
|
114
|
+
declare function TypeIcon({ dataType }: TypeIconProps): ReactNode;
|
|
115
|
+
|
|
116
|
+
interface RowsTableProps {
|
|
117
|
+
rowPage: RowPage;
|
|
118
|
+
columns?: ColumnMetadata[];
|
|
119
|
+
tableName?: string;
|
|
120
|
+
approxRowCount?: number;
|
|
121
|
+
page: number;
|
|
122
|
+
canGoPrevious: boolean;
|
|
123
|
+
canGoNext: boolean;
|
|
124
|
+
onPrevious: () => void;
|
|
125
|
+
onNext: () => void;
|
|
126
|
+
onRefresh?: () => void;
|
|
127
|
+
}
|
|
128
|
+
/** A page of table rows: client-side search/sort over the fetched page, plus pagination. */
|
|
129
|
+
declare function RowsTable({ rowPage, columns, tableName, approxRowCount, page, canGoPrevious, canGoNext, onPrevious, onNext, onRefresh }: RowsTableProps): ReactNode;
|
|
130
|
+
|
|
131
|
+
interface QueryRunnerProps {
|
|
132
|
+
sql: string;
|
|
133
|
+
onSqlChange: (sql: string) => void;
|
|
134
|
+
onRun: () => void;
|
|
135
|
+
isRunning: boolean;
|
|
136
|
+
result?: RowPage;
|
|
137
|
+
error?: string;
|
|
138
|
+
}
|
|
139
|
+
/** A read-only SQL query box: SELECT-style statements only, enforced server-side. */
|
|
140
|
+
declare function QueryRunner({ sql, onSqlChange, onRun, isRunning, result, error }: QueryRunnerProps): ReactNode;
|
|
141
|
+
|
|
142
|
+
export { ConsoleLog, type ConsoleLogProps, FilesBrowser, type FilesBrowserProps, QueryRunner, type QueryRunnerProps, RowsTable, type RowsTableProps, SchemaGrid, type SchemaGridProps, SchemaTree, type SchemaTreeProps, type SelectedTable, type ShellTab, Sidebar, type SidebarProps, Spinner, type SpinnerProps, StatusBar, type StatusBarProps, TabBar, type TabBarProps, TableDetail, type TableDetailProps, TitleBar, type TitleBarProps, TypeIcon, type TypeIconProps };
|