sqlite-hub 0.11.1 → 0.16.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.
- package/README.md +52 -13
- package/database.sqlite +0 -0
- package/frontend/js/api.js +64 -12
- package/frontend/js/app.js +723 -37
- package/frontend/js/components/emptyState.js +42 -46
- package/frontend/js/components/modal.js +526 -2
- package/frontend/js/components/queryEditor.js +12 -3
- package/frontend/js/components/queryResults.js +79 -17
- package/frontend/js/components/rowEditorPanel.js +345 -12
- package/frontend/js/components/sidebar.js +106 -23
- package/frontend/js/components/tableDesignerEditor.js +69 -11
- package/frontend/js/store.js +437 -26
- package/frontend/js/utils/copyColumnExport.js +117 -0
- package/frontend/js/utils/exportFilenames.js +32 -0
- package/frontend/js/utils/filePathPreview.js +315 -0
- package/frontend/js/utils/format.js +1 -1
- package/frontend/js/utils/rowEditorJson.js +65 -0
- package/frontend/js/utils/sqlFormatter.js +691 -0
- package/frontend/js/utils/tableDesigner.js +178 -6
- package/frontend/js/utils/textCellStats.js +20 -0
- package/frontend/js/utils/timestampPreview.js +264 -0
- package/frontend/js/views/charts.js +3 -1
- package/frontend/js/views/data.js +39 -4
- package/frontend/js/views/editor.js +50 -1
- package/frontend/js/views/settings.js +1 -4
- package/frontend/js/views/structure.js +154 -212
- package/frontend/styles/base.css +6 -0
- package/frontend/styles/components.css +463 -2
- package/frontend/styles/structure-graph.css +0 -3
- package/frontend/styles/tailwind.generated.css +1 -1
- package/frontend/styles/tokens.css +95 -95
- package/package.json +2 -3
- package/server/routes/export.js +97 -12
- package/server/services/sqlite/dataBrowserService.js +2 -68
- package/server/services/sqlite/exportService.js +74 -15
- package/server/services/sqlite/introspection.js +209 -1
- package/server/services/sqlite/sqlExecutor.js +31 -0
- package/server/services/sqlite/tableDesigner/changeAnalysis.js +25 -1
- package/server/services/sqlite/tableDesigner/schemaMapping.js +105 -10
- package/server/services/sqlite/tableDesigner/validation.js +60 -2
- package/server/services/sqlite/tableDesignerService.js +1 -1
- package/server/services/sqlite/tableFilter.js +75 -0
- package/server/utils/csv.js +30 -4
- package/tests/check-constraint-options.test.js +90 -0
- package/tests/export-filenames.test.js +34 -0
- package/tests/file-path-preview.test.js +165 -0
- package/tests/row-editor-json.test.js +82 -0
- package/tests/row-editor-timestamp-preview.test.js +192 -0
- package/tests/sql-formatter.test.js +173 -0
- package/tests/sql-highlight.test.js +38 -0
- package/tests/table-designer-v2-unique-constraints.test.js +78 -0
- package/tests/text-cell-stats.test.js +38 -0
|
@@ -1,67 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
formatBytes,
|
|
4
|
-
formatDateTime,
|
|
5
|
-
truncateMiddle,
|
|
6
|
-
} from "../utils/format.js";
|
|
7
|
-
import { renderConnectionLogo } from "./connectionLogo.js";
|
|
1
|
+
import { escapeHtml, formatBytes, formatDateTime, truncateMiddle } from '../utils/format.js';
|
|
2
|
+
import { renderConnectionLogo } from './connectionLogo.js';
|
|
8
3
|
|
|
9
4
|
function renderRecentConnectionButton(connection) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
].join("");
|
|
5
|
+
return [
|
|
6
|
+
'<button class="control-button flex items-center gap-2 border border-outline-variant/15 bg-surface-container-low px-4 text-left text-on-surface transition-colors hover:border-primary-container/30 hover:bg-surface-container-high" data-action="select-connection" data-connection-id="',
|
|
7
|
+
escapeHtml(connection.id),
|
|
8
|
+
'" type="button">',
|
|
9
|
+
renderConnectionLogo(connection, {
|
|
10
|
+
containerClass: 'flex h-8 w-8 items-center justify-center overflow-hidden bg-surface-container-highest',
|
|
11
|
+
imageClassName: 'h-full w-full object-cover',
|
|
12
|
+
iconClassName: 'text-sm text-primary-container',
|
|
13
|
+
}),
|
|
14
|
+
'<span class="min-w-0"><span class="block truncate font-mono text-xs">',
|
|
15
|
+
escapeHtml(connection.label),
|
|
16
|
+
'</span><span class="block truncate text-[10px] text-on-surface-variant/45">',
|
|
17
|
+
escapeHtml(truncateMiddle(connection.path, 34)),
|
|
18
|
+
'</span></span></button>',
|
|
19
|
+
].join('');
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
function renderRecentConnections(recentConnections = []) {
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
if (!recentConnections.length) {
|
|
24
|
+
return `
|
|
31
25
|
<div class="text-[10px] font-mono uppercase tracking-[0.18em] text-on-surface-variant/40">
|
|
32
26
|
No recent SQLite databases recorded yet.
|
|
33
27
|
</div>
|
|
34
28
|
`;
|
|
35
|
-
|
|
29
|
+
}
|
|
36
30
|
|
|
37
|
-
|
|
31
|
+
return `
|
|
38
32
|
<div class="flex flex-wrap justify-center gap-4">
|
|
39
33
|
${recentConnections
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
.slice(0, 4)
|
|
35
|
+
.map(connection => renderRecentConnectionButton(connection))
|
|
36
|
+
.join('')}
|
|
43
37
|
</div>
|
|
44
38
|
`;
|
|
45
39
|
}
|
|
46
40
|
|
|
47
41
|
function renderActiveConnection(activeConnection) {
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
if (!activeConnection) {
|
|
43
|
+
return `
|
|
50
44
|
<p class="font-light text-lg uppercase tracking-wide text-on-surface-variant">
|
|
51
45
|
No database connected
|
|
52
46
|
</p>
|
|
53
47
|
`;
|
|
54
|
-
|
|
48
|
+
}
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
return `
|
|
57
51
|
<div class="mx-auto max-w-2xl border border-outline-variant/15 bg-surface-container-low px-6 py-5 text-left">
|
|
58
52
|
<div class="flex flex-wrap items-start justify-between gap-4">
|
|
59
53
|
<div class="flex items-start gap-4">
|
|
60
54
|
${renderConnectionLogo(activeConnection, {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
containerClass:
|
|
56
|
+
'flex h-14 w-14 items-center justify-center overflow-hidden border border-outline-variant/15 bg-surface-container-highest',
|
|
57
|
+
imageClassName: 'h-full w-full object-cover',
|
|
58
|
+
iconClassName: 'text-2xl text-primary-container',
|
|
65
59
|
})}
|
|
66
60
|
<div>
|
|
67
61
|
<p class="text-[10px] font-mono uppercase tracking-[0.24em] text-primary-container/70">
|
|
@@ -71,14 +65,14 @@ function renderActiveConnection(activeConnection) {
|
|
|
71
65
|
${escapeHtml(activeConnection.label)}
|
|
72
66
|
</h2>
|
|
73
67
|
<p class="mt-2 font-mono text-[10px] text-on-surface-variant/55">${escapeHtml(
|
|
74
|
-
|
|
68
|
+
truncateMiddle(activeConnection.path, 72),
|
|
75
69
|
)}</p>
|
|
76
70
|
</div>
|
|
77
71
|
</div>
|
|
78
72
|
<div class="text-right text-xs text-on-surface-variant/65">
|
|
79
73
|
<div>${escapeHtml(formatBytes(activeConnection.sizeBytes))}</div>
|
|
80
74
|
<div class="mt-1">${escapeHtml(formatDateTime(activeConnection.lastModifiedAt))}</div>
|
|
81
|
-
<div class="mt-1">${activeConnection.readOnly ?
|
|
75
|
+
<div class="mt-1">${activeConnection.readOnly ? 'READ_ONLY' : 'READ_WRITE'}</div>
|
|
82
76
|
</div>
|
|
83
77
|
</div>
|
|
84
78
|
</div>
|
|
@@ -86,9 +80,9 @@ function renderActiveConnection(activeConnection) {
|
|
|
86
80
|
}
|
|
87
81
|
|
|
88
82
|
export function renderEmptyState({ activeConnection, recentConnections = [] }) {
|
|
89
|
-
|
|
83
|
+
const hasActive = Boolean(activeConnection);
|
|
90
84
|
|
|
91
|
-
|
|
85
|
+
return `
|
|
92
86
|
<section class="landing-view machined-grid px-6">
|
|
93
87
|
<div class="landing-accent landing-accent--a"></div>
|
|
94
88
|
<div class="landing-accent landing-accent--b"></div>
|
|
@@ -96,12 +90,14 @@ export function renderEmptyState({ activeConnection, recentConnections = [] }) {
|
|
|
96
90
|
<div class="empty-state-shell z-10 text-center">
|
|
97
91
|
<div class="mb-2">
|
|
98
92
|
<span class="font-mono text-[10px] tracking-[0.3em] text-primary-container/40">
|
|
99
|
-
SYSTEM_READY // ${hasActive ?
|
|
93
|
+
SYSTEM_READY // ${hasActive ? 'ACTIVE_CONTEXT' : 'IDLE_STATE'}
|
|
100
94
|
</span>
|
|
101
95
|
</div>
|
|
102
96
|
<h1 class="mb-4 font-headline text-7xl font-black tracking-tighter text-primary-container opacity-90 md:text-9xl">
|
|
103
97
|
SQLite Hub
|
|
104
98
|
</h1>
|
|
99
|
+
<p class="font-mono text-primary-container/40">The only fucking SQLite Manager you'll ever need.</p>
|
|
100
|
+
<br/>
|
|
105
101
|
<div class="mx-auto mb-12 max-w-3xl space-y-4">
|
|
106
102
|
${renderActiveConnection(activeConnection)}
|
|
107
103
|
<div class="h-[2px] w-12 bg-primary-container mx-auto"></div>
|
|
@@ -128,8 +124,8 @@ export function renderEmptyState({ activeConnection, recentConnections = [] }) {
|
|
|
128
124
|
</button>
|
|
129
125
|
</div>
|
|
130
126
|
${
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
hasActive
|
|
128
|
+
? `
|
|
133
129
|
<div class="mx-auto mt-8 grid w-full max-w-3xl grid-cols-1 gap-4 px-6 md:grid-cols-3">
|
|
134
130
|
<button
|
|
135
131
|
class="standard-button"
|
|
@@ -157,7 +153,7 @@ export function renderEmptyState({ activeConnection, recentConnections = [] }) {
|
|
|
157
153
|
</button>
|
|
158
154
|
</div>
|
|
159
155
|
`
|
|
160
|
-
|
|
156
|
+
: ''
|
|
161
157
|
}
|
|
162
158
|
<div class="mt-16 flex flex-col items-center gap-4 opacity-70 transition-opacity hover:opacity-100">
|
|
163
159
|
<p class="font-mono text-[10px] tracking-widest text-on-surface-variant">RECENT_TARGETS</p>
|