neuxdb 0.3.0

A super simple, embedded, encrypted database like SQLite, using pipe-separated files and age encryption.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Export Tabel — {{table_name}}</title>
    <style>
        :root {
            --bg: #f0f4f8;
            --card-bg: #ffffff;
            --text: #1a202c;
            --text-secondary: #4a5568;
            --border: #e2e8f0;
            --th-bg: #edf2f7;
            --th-text: #2d3748;
            --accent: #4f6ef7;
            --accent-light: #eef1ff;
            --zebra: #f7fafc;
            --hover: #ebf4ff;
            --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
            --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.05);
            --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
            --radius-sm: 8px;
            --radius: 14px;
            --radius-lg: 18px;
            --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            padding: 1.5rem;
            background: var(--bg);
            background-image:
                radial-gradient(ellipse at 20% 20%, rgba(79, 110, 247, 0.03) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 80%, rgba(99, 179, 237, 0.04) 0%, transparent 60%);
            min-height: 100vh;
            color: var(--text);
            line-height: 1.6;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Container utama */
        .container {
            max-width: 1300px;
            margin: 0 auto;
            background: var(--card-bg);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            padding: 2rem 2rem 1.5rem;
            border: 1px solid var(--border);
            animation: fadeSlideIn 0.45s ease-out;
        }

        @keyframes fadeSlideIn {
            from {
                opacity: 0;
                transform: translateY(16px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Header area */
        .header {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            margin-bottom: 1.75rem;
            padding-bottom: 1.25rem;
            border-bottom: 2px solid var(--border);
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 1rem;
            flex-wrap: wrap;
        }

        .icon-wrapper {
            width: 44px;
            height: 44px;
            border-radius: var(--radius-sm);
            background: var(--accent-light);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .icon-wrapper svg {
            width: 22px;
            height: 22px;
            color: var(--accent);
        }

        .title-group h1 {
            font-size: 1.6rem;
            font-weight: 700;
            letter-spacing: -0.02em;
            color: var(--text);
            line-height: 1.2;
            margin: 0;
        }

        .title-group .subtitle {
            font-size: 0.875rem;
            color: var(--text-secondary);
            margin-top: 2px;
        }

        /* Badge / meta info */
        .meta-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 0.6rem;
            align-items: center;
        }

        .badge {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.8rem;
            font-weight: 500;
            padding: 0.4rem 0.85rem;
            border-radius: 999px;
            background: #f7fafc;
            color: #4a5568;
            border: 1px solid #e2e8f0;
            white-space: nowrap;
            letter-spacing: 0.01em;
        }

        .badge .dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: #48bb78;
            flex-shrink: 0;
        }

        .badge.accent {
            background: var(--accent-light);
            color: var(--accent);
            border-color: #d6dcff;
            font-weight: 600;
        }

        /* Table wrapper untuk scroll horizontal */
        .table-wrapper {
            overflow-x: auto;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            box-shadow: var(--shadow-sm);
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }

        .table-wrapper::-webkit-scrollbar {
            height: 7px;
        }

        .table-wrapper::-webkit-scrollbar-track {
            background: #f1f5f9;
            border-radius: 0 0 var(--radius) var(--radius);
        }

        .table-wrapper::-webkit-scrollbar-thumb {
            background: #cbd5e0;
            border-radius: 10px;
        }

        .table-wrapper::-webkit-scrollbar-thumb:hover {
            background: #a0aec0;
        }

        /* Tabel */
        table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.925rem;
            min-width: 600px;
            white-space: nowrap;
        }

        thead th {
            background: var(--th-bg);
            color: var(--th-text);
            font-weight: 700;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            padding: 0.85rem 1rem;
            border-bottom: 2px solid #dde4ed;
            position: sticky;
            top: 0;
            z-index: 2;
            text-align: left;
            white-space: nowrap;
            user-select: none;
        }

        thead th:first-child {
            border-radius: var(--radius-sm) 0 0 0;
        }

        thead th:last-child {
            border-radius: 0 var(--radius-sm) 0 0;
        }

        tbody td {
            padding: 0.7rem 1rem;
            border-bottom: 1px solid #edf2f7;
            color: var(--text);
            transition: background var(--transition);
            vertical-align: middle;
        }

        tbody tr {
            transition: background var(--transition), box-shadow var(--transition);
        }

        /* Zebra striping */
        tbody tr:nth-child(even) {
            background-color: var(--zebra);
        }

        /* Hover effect */
        tbody tr:hover {
            background-color: var(--hover) !important;
            box-shadow: inset 3px 0 0 var(--accent);
        }

        /* Row number column */
        .row-num {
            text-align: center;
            font-weight: 500;
            color: #a0aec0;
            font-size: 0.8rem;
            width: 50px;
            min-width: 50px;
            user-select: none;
        }

        tbody tr:hover .row-num {
            color: var(--accent);
            font-weight: 600;
        }

        /* Last row border removal */
        tbody tr:last-child td {
            border-bottom: none;
        }

        /* Data kosong */
        .empty-state {
            text-align: center;
            padding: 3rem 1rem;
            color: #a0aec0;
        }
        .empty-state svg {
            width: 48px;
            height: 48px;
            margin-bottom: 0.75rem;
            opacity: 0.5;
        }
        .empty-state p {
            font-size: 0.95rem;
            margin: 0;
        }

        /* Footer */
        .footer {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: center;
            margin-top: 1.25rem;
            padding-top: 0.75rem;
            font-size: 0.8rem;
            color: #a0aec0;
            gap: 0.75rem;
        }

        .footer .row-count {
            font-weight: 600;
            color: var(--text-secondary);
            background: #f7fafc;
            padding: 0.3rem 0.75rem;
            border-radius: 999px;
            border: 1px solid #edf2f7;
        }

        /* Print styles */
        @media print {
            body {
                background: #fff;
                padding: 0;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            .container {
                box-shadow: none;
                border: none;
                border-radius: 0;
                padding: 0.5cm;
                max-width: 100%;
                animation: none;
            }
            .table-wrapper {
                box-shadow: none;
                border: 1px solid #ccc;
                border-radius: 0;
                overflow-x: visible;
            }
            .table-wrapper::-webkit-scrollbar {
                display: none;
            }
            thead th {
                background: #e2e8f0 !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            tbody tr:nth-child(even) {
                background-color: #f7fafc !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
            .footer {
                color: #666;
            }
            .badge {
                border: 1px solid #ccc;
            }
            @page {
                margin: 0.5cm;
                size: A4 landscape;
            }
        }

        /* Responsive */
        @media (max-width: 768px) {
            body {
                padding: 0.5rem;
            }
            .container {
                padding: 1rem 0.75rem 1rem;
                border-radius: var(--radius);
            }
            .header {
                flex-direction: column;
                align-items: flex-start;
            }
            .title-group h1 {
                font-size: 1.3rem;
            }
            table {
                font-size: 0.8rem;
            }
            thead th,
            tbody td {
                padding: 0.5rem 0.6rem;
            }
            .meta-badges {
                gap: 0.4rem;
            }
            .badge {
                font-size: 0.7rem;
                padding: 0.3rem 0.6rem;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 0.75rem 0.5rem;
                border-radius: 10px;
            }
            .title-group h1 {
                font-size: 1.1rem;
            }
            .icon-wrapper {
                width: 34px;
                height: 34px;
            }
            .icon-wrapper svg {
                width: 17px;
                height: 17px;
            }
            table {
                font-size: 0.72rem;
                min-width: 400px;
            }
            thead th,
            tbody td {
                padding: 0.4rem 0.5rem;
            }
            .row-num {
                width: 32px;
                min-width: 32px;
                font-size: 0.7rem;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- Header -->
        <div class="header">
            <div class="header-left">
                <div class="icon-wrapper" aria-hidden="true">
                    <!-- Ikon tabel -->
                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                        <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
                        <line x1="3" y1="9" x2="21" y2="9"></line>
                        <line x1="3" y1="15" x2="21" y2="15"></line>
                        <line x1="9" y1="3" x2="9" y2="21"></line>
                        <line x1="15" y1="3" x2="15" y2="21"></line>
                    </svg>
                </div>
                <div class="title-group">
                    <h1>{{table_name}}</h1>
                    <p class="subtitle">Laporan data • Diekspor pada <span id="exportDate"></span></p>
                </div>
            </div>
            <div class="meta-badges">
                <span class="badge accent" id="rowCountBadge">📊 <span id="rowCountLabel">0</span> baris</span>
                <span class="badge"><span class="dot"></span> Data terkini</span>
            </div>
        </div>

        <!-- Tabel -->
        <div class="table-wrapper">
            {{table_content}}
        </div>

        <!-- Footer -->
        <div class="footer">
            <span>© <span id="currentYear"></span> • Dibuat dengan HTML Export Engine</span>
            <span class="row-count" id="footerRowCount">Total: 0 baris</span>
        </div>
    </div>

    <script>
        (function () {
            // Tanggal ekspor
            const now = new Date();
            const dateOptions = {
                day: 'numeric',
                month: 'long',
                year: 'numeric',
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit',
                timeZoneName: 'short'
            };
            const dateEl = document.getElementById('exportDate');
            if (dateEl) {
                dateEl.textContent = now.toLocaleDateString('id-ID', dateOptions);
            }

            // Tahun sekarang
            const yearEl = document.getElementById('currentYear');
            if (yearEl) {
                yearEl.textContent = now.getFullYear();
            }

            // Hitung jumlah baris data (tbody tr, kecuali empty state)
            function countDataRows() {
                const table = document.querySelector('.table-wrapper table');
                if (!table) return 0;
                const tbody = table.querySelector('tbody');
                if (!tbody) return 0;
                const rows = tbody.querySelectorAll('tr');
                // Cek apakah ada empty state
                let count = 0;
                rows.forEach(row => {
                    const cells = row.querySelectorAll('td');
                    if (cells.length === 1 && cells[0].classList.contains('empty-state')) {
                        // Ini empty state, jangan dihitung
                        return;
                    }
                    count++;
                });
                return count;
            }

            function updateRowCounts() {
                const count = countDataRows();
                const labelEl = document.getElementById('rowCountLabel');
                const badgeEl = document.getElementById('rowCountBadge');
                const footerEl = document.getElementById('footerRowCount');

                if (labelEl) labelEl.textContent = count;
                if (footerEl) footerEl.textContent = 'Total: ' + count + ' baris';
                if (badgeEl && count === 0) {
                    badgeEl.textContent = '📭 0 baris';
                } else if (badgeEl && count > 0) {
                    badgeEl.textContent = '📊 ' + count + ' baris';
                }
            }

            // Jalankan setelah DOM siap
            if (document.readyState === 'loading') {
                document.addEventListener('DOMContentLoaded', updateRowCounts);
            } else {
                updateRowCounts();
            }

            // Tambahkan nomor baris otomatis ke setiap baris jika belum ada .row-num
            function addRowNumbers() {
                const table = document.querySelector('.table-wrapper table');
                if (!table) return;
                const tbody = table.querySelector('tbody');
                if (!tbody) return;
                const rows = tbody.querySelectorAll('tr');
                rows.forEach((row, index) => {
                    const cells = row.querySelectorAll('td');
                    // Skip empty state row
                    if (cells.length === 1 && cells[0].classList.contains('empty-state')) return;
                    // Cek apakah sudah ada row-num
                    const firstCell = row.querySelector('td:first-child');
                    if (firstCell && firstCell.classList.contains('row-num')) return;
                    // Tambahkan row number cell di depan
                    const numCell = document.createElement('td');
                    numCell.classList.add('row-num');
                    numCell.textContent = index + 1;
                    row.insertBefore(numCell, row.firstChild);
                });
                // Tambahkan juga header untuk row number jika ada thead dan belum ada
                const thead = table.querySelector('thead');
                if (thead) {
                    const headerRow = thead.querySelector('tr');
                    if (headerRow && !headerRow.querySelector('th.row-num')) {
                        const numHeader = document.createElement('th');
                        numHeader.classList.add('row-num');
                        numHeader.textContent = '#';
                        numHeader.style.textAlign = 'center';
                        headerRow.insertBefore(numHeader, headerRow.firstChild);
                    }
                }
            }

            if (document.readyState === 'loading') {
                document.addEventListener('DOMContentLoaded', () => {
                    addRowNumbers();
                    updateRowCounts();
                });
            } else {
                addRowNumbers();
                updateRowCounts();
            }
        })();
    </script>
</body>
</html>