local-lite 0.0.3 → 0.0.5

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 (63) hide show
  1. package/README.md +421 -362
  2. package/dist/adapters/local/better-sqlite3.d.ts +2 -0
  3. package/dist/adapters/local/better-sqlite3.js +46 -25
  4. package/dist/adapters/local/expo-sqlite.d.ts +5 -1
  5. package/dist/adapters/local/expo-sqlite.js +40 -7
  6. package/dist/adapters/local/index.d.ts +1 -0
  7. package/dist/adapters/local/node-sqlite.d.ts +2 -0
  8. package/dist/adapters/local/node-sqlite.js +45 -22
  9. package/dist/adapters/local/op-sqlite.d.ts +1 -0
  10. package/dist/adapters/local/op-sqlite.js +6 -0
  11. package/dist/adapters/local/sql-js.d.ts +1 -0
  12. package/dist/adapters/local/sql-js.js +5 -0
  13. package/dist/adapters/network/index.js +33 -0
  14. package/dist/adapters/remote/convex.d.ts +2 -2
  15. package/dist/adapters/remote/convex.js +8 -12
  16. package/dist/adapters/remote/demo.d.ts +1 -1
  17. package/dist/adapters/remote/demo.js +3 -0
  18. package/dist/adapters/remote/firestore.d.ts +3 -2
  19. package/dist/adapters/remote/firestore.js +69 -46
  20. package/dist/adapters/remote/index.d.ts +6 -4
  21. package/dist/adapters/remote/supabase.d.ts +34 -6
  22. package/dist/adapters/remote/supabase.js +340 -79
  23. package/dist/config/index.js +7 -10
  24. package/dist/config/resolve-local.js +12 -1
  25. package/dist/config/resolve-remote.js +33 -28
  26. package/dist/config/types.d.ts +30 -5
  27. package/dist/core/client.d.ts +133 -5
  28. package/dist/core/client.js +431 -46
  29. package/dist/core/index.d.ts +15 -0
  30. package/dist/core/index.js +30 -0
  31. package/dist/core/outbox-store.d.ts +8 -4
  32. package/dist/core/outbox-store.js +84 -65
  33. package/dist/core/query-builder.d.ts +119 -0
  34. package/dist/core/query-builder.js +372 -0
  35. package/dist/core/query.d.ts +8 -0
  36. package/dist/core/query.js +37 -0
  37. package/dist/core/schema-manager.d.ts +9 -0
  38. package/dist/core/schema-manager.js +103 -0
  39. package/dist/core/sync-worker.d.ts +38 -1
  40. package/dist/core/sync-worker.js +351 -104
  41. package/dist/core/table-manager.js +26 -29
  42. package/dist/core/types.d.ts +8 -0
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.js +2 -0
  45. package/dist/react/BenchmarkModal.d.ts +32 -0
  46. package/dist/react/BenchmarkModal.js +777 -0
  47. package/dist/react/SyncInspector.d.ts +31 -0
  48. package/dist/react/SyncInspector.js +585 -0
  49. package/dist/react/index.d.ts +89 -18
  50. package/dist/react/index.js +450 -105
  51. package/dist/react/runner.d.ts +7 -0
  52. package/dist/react/runner.js +42 -0
  53. package/dist/react/status.d.ts +24 -0
  54. package/dist/react/status.js +123 -0
  55. package/dist/react/theme.d.ts +18 -0
  56. package/dist/react/theme.js +46 -0
  57. package/dist/schema/generator.d.ts +49 -0
  58. package/dist/schema/generator.js +209 -0
  59. package/dist/schema/index.d.ts +1 -0
  60. package/dist/schema/index.js +17 -0
  61. package/dist/utils/logger.d.ts +4 -0
  62. package/dist/utils/logger.js +20 -0
  63. package/package.json +143 -133
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { LocalFirstClient } from '../core/client.js';
3
+ import { type SyncThemeColors } from './theme.js';
4
+ export interface SyncInspectorProps {
5
+ client: LocalFirstClient | null | undefined;
6
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'top' | 'bottom' | 'inline';
7
+ variant?: 'pill' | 'compact' | 'icon' | 'minimal';
8
+ initialOpen?: boolean;
9
+ fullWidth?: boolean;
10
+ enableBenchmark?: boolean;
11
+ onOpenBenchmark?: () => void;
12
+ style?: any;
13
+ theme?: 'auto' | 'dark' | 'light' | Partial<SyncThemeColors>;
14
+ alwaysVisible?: boolean;
15
+ renderTrigger?: (props: {
16
+ isOpen: boolean;
17
+ open: () => void;
18
+ status: any;
19
+ metrics: any;
20
+ statusColor: string;
21
+ statusLabel: string;
22
+ }) => React.ReactNode;
23
+ }
24
+ /**
25
+ * Universal Developer Inspector Component for local-lite.
26
+ * Respects device safe areas and active theme (dark/light/custom).
27
+ * Displays real-time outbox telemetry, connection status, metrics, and triggers manual push, pull, reset, and benchmarks.
28
+ */
29
+ export declare function SyncInspector({ client, position, variant, initialOpen, enableBenchmark, onOpenBenchmark, style, theme, alwaysVisible, renderTrigger, }: SyncInspectorProps): React.JSX.Element | null;
30
+ export declare const SyncIndicator: typeof SyncInspector;
31
+ export type SyncIndicatorProps = SyncInspectorProps;
@@ -0,0 +1,585 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SyncIndicator = void 0;
4
+ exports.SyncInspector = SyncInspector;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const status_js_1 = require("./status.js");
8
+ const BenchmarkModal_js_1 = require("./BenchmarkModal.js");
9
+ const theme_js_1 = require("./theme.js");
10
+ let RN;
11
+ try {
12
+ RN = require('react-native');
13
+ }
14
+ catch {
15
+ // Web / DOM environment
16
+ }
17
+ let RNSafeArea;
18
+ try {
19
+ RNSafeArea = require('react-native-safe-area-context');
20
+ }
21
+ catch {
22
+ // Web / DOM environment or not installed
23
+ }
24
+ const BENCHMARK_DESCRIPTION = 'Runs automated stress tests directly validating local-lite client APIs: atomic batch ingestion, indexing, ACID rollback isolation, outbox queues, and non-blocking WAL concurrency.';
25
+ /**
26
+ * Universal Developer Inspector Component for local-lite.
27
+ * Respects device safe areas and active theme (dark/light/custom).
28
+ * Displays real-time outbox telemetry, connection status, metrics, and triggers manual push, pull, reset, and benchmarks.
29
+ */
30
+ function SyncInspector({ client, position = 'bottom-right', variant = 'pill', initialOpen = false, enableBenchmark = true, onOpenBenchmark, style, theme = 'auto', alwaysVisible = true, renderTrigger, }) {
31
+ const [isOpen, setIsOpen] = (0, react_1.useState)(initialOpen);
32
+ const [isBenchmarkModalOpen, setIsBenchmarkModalOpen] = (0, react_1.useState)(false);
33
+ const status = (0, status_js_1.useSyncStatus)(client);
34
+ const [metrics, setMetrics] = (0, react_1.useState)(null);
35
+ const [actionMessage, setActionMessage] = (0, react_1.useState)(null);
36
+ const systemColorScheme = RN?.useColorScheme ? RN.useColorScheme() : null;
37
+ const currentTheme = (0, react_1.useMemo)(() => (0, theme_js_1.resolveSyncTheme)(theme, systemColorScheme), [theme, systemColorScheme]);
38
+ (0, react_1.useEffect)(() => {
39
+ if (!client || !isOpen)
40
+ return;
41
+ client.getMetrics().then(setMetrics).catch(() => { });
42
+ }, [client, isOpen, status.isSyncing, status.pendingCount]);
43
+ const runAction = (0, react_1.useCallback)(async (startMsg, doneMsg, action) => {
44
+ if (!client)
45
+ return;
46
+ setActionMessage(startMsg);
47
+ try {
48
+ const res = await action();
49
+ setActionMessage(doneMsg(res));
50
+ }
51
+ catch (err) {
52
+ setActionMessage(`Failed: ${err.message || err}`);
53
+ }
54
+ setTimeout(() => setActionMessage(null), 3000);
55
+ }, [client]);
56
+ const handlePush = () => runAction('Pushing mutations...', () => 'Push complete', () => client.syncWorker.pushLocalChanges());
57
+ const handlePull = () => runAction('Pulling remote changes...', () => 'Pull complete', () => client.syncWorker.pullRemoteChanges());
58
+ const handleResetCursor = () => runAction('Resetting cursor & refetching...', () => 'Cursor reset & refetched', async () => {
59
+ await client.resetSyncCursor();
60
+ await client.syncWorker.pullRemoteChanges();
61
+ });
62
+ const handleRetryFailed = () => runAction('Re-queueing failed mutations...', (count) => `Re-queued ${count || 0} mutations`, () => client.retryFailedMutations());
63
+ const handleBenchmarkPress = () => {
64
+ if (onOpenBenchmark) {
65
+ onOpenBenchmark();
66
+ setIsOpen(false);
67
+ }
68
+ else {
69
+ setIsBenchmarkModalOpen(true);
70
+ }
71
+ };
72
+ const statusColor = !status.isOnline ? '#EF4444' : status.isSyncing ? '#F59E0B' : '#10B981';
73
+ const statusLabel = !status.isOnline ? 'Offline' : status.isSyncing ? 'Syncing' : 'Online';
74
+ const isInline = position === 'inline';
75
+ const isTop = position.startsWith('top') || position === 'top';
76
+ const isLeft = position.includes('left');
77
+ const isCenter = position === 'top' || position === 'bottom';
78
+ // Shared Stat Cards Data (Pending & Failed)
79
+ const statCards = (0, react_1.useMemo)(() => [
80
+ {
81
+ id: 'pending',
82
+ num: status.pendingCount,
83
+ label: 'Pending Outbox',
84
+ sub: 'Awaiting sync push',
85
+ numColor: currentTheme.text,
86
+ },
87
+ {
88
+ id: 'failed',
89
+ num: metrics?.outboxFailedCount || 0,
90
+ label: 'Failed Mutations',
91
+ sub: metrics?.outboxFailedCount ? 'Needs retry' : 'All clear',
92
+ numColor: metrics?.outboxFailedCount ? '#EF4444' : '#10B981',
93
+ },
94
+ ], [status.pendingCount, metrics?.outboxFailedCount, currentTheme.text]);
95
+ // Shared Action Buttons
96
+ const actionButtons = (0, react_1.useMemo)(() => [
97
+ { id: 'push', label: '🚀 Push Changes', onPress: handlePush, bg: '#3B82F6', color: '#FFFFFF' },
98
+ { id: 'pull', label: '📥 Pull Changes', onPress: handlePull, bg: '#2563EB', color: '#FFFFFF' },
99
+ { id: 'retry', label: '🔄 Retry Failed', onPress: handleRetryFailed, bg: currentTheme.actionBg, color: currentTheme.actionText },
100
+ { id: 'reset', label: '⏪ Reset Cursor', onPress: handleResetCursor, bg: currentTheme.actionBg, color: currentTheme.actionText },
101
+ ], [handlePush, handlePull, handleRetryFailed, handleResetCursor, currentTheme.actionBg, currentTheme.actionText]);
102
+ const triggerLabel = variant === 'compact'
103
+ ? status.pendingCount > 0
104
+ ? `${status.pendingCount} queued`
105
+ : statusLabel
106
+ : 'local-lite';
107
+ if (!client)
108
+ return null;
109
+ // React Native Renderer
110
+ if (RN && RN.View) {
111
+ const { View, Text, TouchableOpacity, ScrollView, Modal, Platform, StatusBar } = RN;
112
+ const SafeComp = RNSafeArea?.SafeAreaView || RN.SafeAreaView || View;
113
+ const isAndroid = Platform?.OS === 'android';
114
+ const statusBarHeight = isAndroid ? StatusBar?.currentHeight || 24 : 0;
115
+ const pillPosStyle = isInline
116
+ ? { position: 'relative' }
117
+ : {
118
+ position: 'absolute',
119
+ zIndex: 99999,
120
+ left: isCenter ? 16 : isLeft ? 16 : undefined,
121
+ right: isCenter ? 16 : !isLeft ? 16 : undefined,
122
+ ...(isTop ? { top: isAndroid ? statusBarHeight + 12 : 48 } : { bottom: 24 }),
123
+ };
124
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isOpen && ((0, jsx_runtime_1.jsx)(View, { style: [pillPosStyle, style], pointerEvents: "box-none", children: renderTrigger ? (renderTrigger({
125
+ isOpen,
126
+ open: () => setIsOpen(true),
127
+ status,
128
+ metrics,
129
+ statusColor,
130
+ statusLabel,
131
+ })) : !alwaysVisible && status.pendingCount === 0 && status.isOnline && !status.isSyncing ? null : ((0, jsx_runtime_1.jsxs)(TouchableOpacity, { onPress: () => setIsOpen(true), style: [
132
+ isInline ? rnStyles.inlinePill : rnStyles.pill,
133
+ {
134
+ borderColor: statusColor,
135
+ backgroundColor: currentTheme.surface,
136
+ alignSelf: isInline ? 'auto' : isCenter ? 'center' : isLeft ? 'flex-start' : 'flex-end',
137
+ },
138
+ ], activeOpacity: 0.8, children: [(0, jsx_runtime_1.jsx)(View, { style: [rnStyles.dot, { backgroundColor: statusColor }] }), variant !== 'icon' && variant !== 'minimal' && ((0, jsx_runtime_1.jsx)(Text, { style: [isInline ? rnStyles.inlinePillText : rnStyles.pillText, { color: currentTheme.text }], children: triggerLabel })), status.pendingCount > 0 && variant !== 'compact' && ((0, jsx_runtime_1.jsx)(View, { style: rnStyles.badge, children: (0, jsx_runtime_1.jsx)(Text, { style: rnStyles.badgeText, children: status.pendingCount }) }))] })) })), (0, jsx_runtime_1.jsx)(Modal, { visible: isOpen, animationType: "slide", presentationStyle: "fullScreen", statusBarTranslucent: true, onRequestClose: () => setIsOpen(false), children: (0, jsx_runtime_1.jsxs)(SafeComp, { style: [rnStyles.fullScreenSafe, { backgroundColor: currentTheme.bg }], edges: ['top', 'bottom', 'left', 'right'], children: [(0, jsx_runtime_1.jsxs)(View, { style: [
139
+ rnStyles.topBar,
140
+ {
141
+ backgroundColor: currentTheme.surface,
142
+ borderBottomColor: currentTheme.border,
143
+ },
144
+ !RNSafeArea?.SafeAreaView && isAndroid && { paddingTop: statusBarHeight + 10 },
145
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.topBarTitle, { color: currentTheme.text }], children: "\u26A1 Local Lite DevTools" }), (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.topBarSub, { color: currentTheme.textMuted }], children: "Engine Inspector & Sync Telemetry" })] }), (0, jsx_runtime_1.jsx)(View, { style: [rnStyles.statusBadge, { borderColor: statusColor, backgroundColor: `${statusColor}20` }], children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statusBadgeText, { color: statusColor }], children: statusLabel }) }), (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: () => setIsOpen(false), style: [rnStyles.closeCircle, { backgroundColor: currentTheme.actionBg }], activeOpacity: 0.7, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.closeCircleText, { color: currentTheme.actionText }], children: "\u2715" }) })] }), (0, jsx_runtime_1.jsxs)(ScrollView, { style: [rnStyles.scrollBody, { backgroundColor: currentTheme.bg }], contentContainerStyle: rnStyles.scrollContent, showsVerticalScrollIndicator: true, children: [actionMessage && ((0, jsx_runtime_1.jsx)(View, { style: rnStyles.actionMsgBox, children: (0, jsx_runtime_1.jsx)(Text, { style: rnStyles.actionMsgText, children: actionMessage }) })), (0, jsx_runtime_1.jsx)(View, { style: rnStyles.statGrid, children: statCards.map((card) => ((0, jsx_runtime_1.jsxs)(View, { style: [
146
+ rnStyles.statCard,
147
+ {
148
+ backgroundColor: currentTheme.card,
149
+ borderColor: currentTheme.border,
150
+ },
151
+ ], children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statNum, { color: card.numColor }], children: String(card.num ?? 0) }), (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statLabel, { color: currentTheme.textSecondary }], children: card.label }), (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.statSub, { color: currentTheme.textMuted }], children: card.sub })] }, card.id))) }), (0, jsx_runtime_1.jsxs)(View, { style: [
152
+ rnStyles.infoCard,
153
+ {
154
+ backgroundColor: currentTheme.card,
155
+ borderColor: currentTheme.border,
156
+ },
157
+ ], children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.infoCardTitle, { color: currentTheme.textMuted }], children: "ENGINE ACTIONS" }), (0, jsx_runtime_1.jsx)(View, { style: rnStyles.btnRow, children: actionButtons.slice(0, 2).map((btn) => ((0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: btn.onPress, style: [rnStyles.actionBtn, { backgroundColor: btn.bg }], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.actionBtnText, { color: btn.color }], children: btn.label }) }, btn.id))) }), (0, jsx_runtime_1.jsx)(View, { style: [rnStyles.btnRow, { marginTop: 8 }], children: actionButtons.slice(2, 4).map((btn) => ((0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: btn.onPress, style: [rnStyles.actionBtn, { backgroundColor: btn.bg }], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.actionBtnText, { color: btn.color }], children: btn.label }) }, btn.id))) })] }), (metrics?.lastPushError || metrics?.lastPullError) && ((0, jsx_runtime_1.jsxs)(View, { style: [rnStyles.infoCard, { borderColor: '#EF444480', backgroundColor: '#7F1D1D20' }], children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.infoCardTitle, { color: '#F87171' }], children: "SYNC ENGINE ERRORS" }), metrics?.lastPushError && ((0, jsx_runtime_1.jsxs)(View, { style: { marginBottom: 6 }, children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: '#FCA5A5', fontWeight: '700' }, children: "Last Push Error:" }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: '#FECACA' }, children: String(metrics.lastPushError) })] })), metrics?.lastPullError && ((0, jsx_runtime_1.jsxs)(View, { children: [(0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 11, color: '#FCA5A5', fontWeight: '700' }, children: "Last Pull Error:" }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: '#FECACA' }, children: String(metrics.lastPullError) })] }))] })), status.pendingRecords && status.pendingRecords.length > 0 && ((0, jsx_runtime_1.jsxs)(View, { style: [
158
+ rnStyles.infoCard,
159
+ {
160
+ backgroundColor: currentTheme.card,
161
+ borderColor: currentTheme.border,
162
+ },
163
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: {
164
+ flexDirection: 'row',
165
+ justifyContent: 'space-between',
166
+ alignItems: 'center',
167
+ marginBottom: 10,
168
+ }, children: [(0, jsx_runtime_1.jsxs)(Text, { style: [rnStyles.infoCardTitle, { color: currentTheme.textMuted }], children: ["QUEUED OUTBOX MUTATIONS (", status.pendingRecords.length, ")"] }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 10, color: currentTheme.textMuted }, children: "Latest queued" })] }), status.pendingRecords.slice(0, 8).map((rec, idx) => ((0, jsx_runtime_1.jsxs)(View, { style: [
169
+ rnStyles.infoRow,
170
+ { borderBottomColor: currentTheme.border },
171
+ idx === Math.min(status.pendingRecords.length, 8) - 1 && { borderBottomWidth: 0 },
172
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 6 }, children: [(0, jsx_runtime_1.jsx)(View, { style: [
173
+ rnStyles.dotSmall,
174
+ { backgroundColor: rec.status === 'FAILED' ? '#EF4444' : '#F59E0B' },
175
+ ] }), (0, jsx_runtime_1.jsx)(Text, { style: { color: currentTheme.text, fontSize: 13, fontWeight: '600' }, children: rec.tableName || 'record' }), (0, jsx_runtime_1.jsx)(View, { style: {
176
+ backgroundColor: currentTheme.actionBg,
177
+ paddingHorizontal: 5,
178
+ paddingVertical: 1,
179
+ borderRadius: 4,
180
+ }, children: (0, jsx_runtime_1.jsx)(Text, { style: { color: currentTheme.actionText, fontSize: 10, fontWeight: '700' }, children: rec.operation || 'MUTATE' }) })] }), rec.rowId && ((0, jsx_runtime_1.jsxs)(Text, { style: { color: currentTheme.textMuted, fontSize: 11, marginTop: 2 }, numberOfLines: 1, children: ["ID: ", rec.rowId] })), rec.errorMessage && ((0, jsx_runtime_1.jsx)(Text, { style: { color: '#EF4444', fontSize: 11, marginTop: 2 }, children: rec.errorMessage }))] }), (0, jsx_runtime_1.jsx)(Text, { style: { color: currentTheme.textMuted, fontSize: 11 }, children: rec.status || 'PENDING' })] }, rec.id || idx))), status.pendingRecords.length > 8 && ((0, jsx_runtime_1.jsxs)(Text, { style: { color: currentTheme.textMuted, fontSize: 11, textAlign: 'center', marginTop: 8 }, children: ["+ ", status.pendingRecords.length - 8, " more mutations in outbox"] }))] })), enableBenchmark && ((0, jsx_runtime_1.jsxs)(View, { style: [
181
+ rnStyles.infoCard,
182
+ {
183
+ borderColor: '#8B5CF640',
184
+ backgroundColor: currentTheme.isDark ? '#1E1B4B25' : '#F5F3FF',
185
+ },
186
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: {
187
+ flexDirection: 'row',
188
+ alignItems: 'center',
189
+ justifyContent: 'space-between',
190
+ marginBottom: 8,
191
+ }, children: [(0, jsx_runtime_1.jsx)(Text, { style: [
192
+ rnStyles.infoCardTitle,
193
+ { color: currentTheme.isDark ? '#C4B5FD' : '#6D28D9', marginBottom: 0 },
194
+ ], children: "PERFORMANCE BENCHMARK" }), (0, jsx_runtime_1.jsx)(Text, { style: {
195
+ fontSize: 10,
196
+ color: currentTheme.isDark ? '#A78BFA' : '#7C3AED',
197
+ fontWeight: '700',
198
+ }, children: "ACID & WAL" })] }), (0, jsx_runtime_1.jsx)(Text, { style: { fontSize: 12, color: currentTheme.textMuted, marginBottom: 12, lineHeight: 18 }, children: BENCHMARK_DESCRIPTION }), (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: handleBenchmarkPress, style: [rnStyles.actionBtn, { backgroundColor: '#8B5CF6' }], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.actionBtnText, { color: '#FFFFFF', fontWeight: '700' }], children: "\u26A1 Open SQLite Benchmark Suite" }) })] }))] }), (0, jsx_runtime_1.jsx)(View, { style: [
199
+ rnStyles.bottomBar,
200
+ {
201
+ backgroundColor: currentTheme.surface,
202
+ borderTopColor: currentTheme.border,
203
+ },
204
+ !RNSafeArea?.SafeAreaView && isAndroid && { paddingBottom: 32 },
205
+ ], children: (0, jsx_runtime_1.jsx)(TouchableOpacity, { onPress: () => setIsOpen(false), style: [rnStyles.doneBtn, { backgroundColor: currentTheme.actionBg }], activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.doneBtnText, { color: currentTheme.actionText }], children: "Close DevTools" }) }) })] }) }), enableBenchmark && !onOpenBenchmark && ((0, jsx_runtime_1.jsx)(BenchmarkModal_js_1.BenchmarkModal, { client: client, visible: isBenchmarkModalOpen, onDismiss: () => setIsBenchmarkModalOpen(false), theme: theme }))] }));
206
+ }
207
+ // Web / DOM Renderer Fallback
208
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isOpen ? ((0, jsx_runtime_1.jsxs)("div", { style: {
209
+ position: 'fixed',
210
+ inset: 0,
211
+ backgroundColor: currentTheme.bg,
212
+ zIndex: 99999,
213
+ display: 'flex',
214
+ flexDirection: 'column',
215
+ fontFamily: 'system-ui, -apple-system, sans-serif',
216
+ color: currentTheme.text,
217
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
218
+ display: 'flex',
219
+ alignItems: 'center',
220
+ justifyContent: 'space-between',
221
+ padding: '16px 24px',
222
+ backgroundColor: currentTheme.surface,
223
+ borderBottom: `1px solid ${currentTheme.border}`,
224
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [(0, jsx_runtime_1.jsx)("span", { style: {
225
+ width: 12,
226
+ height: 12,
227
+ borderRadius: 6,
228
+ backgroundColor: statusColor,
229
+ } }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: 17, fontWeight: 700, color: currentTheme.text }, children: "\u26A1 Local Lite DevTools" }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 11, color: currentTheme.textMuted, marginTop: 2 }, children: "Engine Inspector & Sync Telemetry" })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
230
+ border: `1px solid ${statusColor}`,
231
+ color: statusColor,
232
+ padding: '3px 10px',
233
+ borderRadius: 12,
234
+ fontSize: 11,
235
+ fontWeight: 700,
236
+ backgroundColor: `${statusColor}20`,
237
+ }, children: statusLabel }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setIsOpen(false), style: {
238
+ width: 32,
239
+ height: 32,
240
+ borderRadius: 16,
241
+ backgroundColor: currentTheme.actionBg,
242
+ border: 'none',
243
+ color: currentTheme.actionText,
244
+ fontSize: 14,
245
+ cursor: 'pointer',
246
+ display: 'flex',
247
+ alignItems: 'center',
248
+ justifyContent: 'center',
249
+ }, children: "\u2715" })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
250
+ flex: 1,
251
+ overflowY: 'auto',
252
+ padding: 24,
253
+ maxWidth: 720,
254
+ width: '100%',
255
+ margin: '0 auto',
256
+ boxSizing: 'border-box',
257
+ display: 'flex',
258
+ flexDirection: 'column',
259
+ gap: 16,
260
+ }, children: [actionMessage && ((0, jsx_runtime_1.jsx)("div", { style: {
261
+ backgroundColor: '#1E3A8A',
262
+ border: '1px solid #3B82F6',
263
+ color: '#93C5FD',
264
+ padding: 10,
265
+ borderRadius: 8,
266
+ fontSize: 13,
267
+ fontWeight: 600,
268
+ textAlign: 'center',
269
+ }, children: actionMessage })), (0, jsx_runtime_1.jsx)("div", { style: {
270
+ display: 'grid',
271
+ gridTemplateColumns: 'repeat(auto-fit, minmax(140px, 1fr))',
272
+ gap: 12,
273
+ }, children: statCards.map((card) => ((0, jsx_runtime_1.jsxs)("div", { style: {
274
+ backgroundColor: currentTheme.card,
275
+ border: `1px solid ${currentTheme.border}`,
276
+ borderRadius: 12,
277
+ padding: 16,
278
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: 24, fontWeight: 800, color: card.numColor }, children: card.num }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 12, color: currentTheme.textSecondary, marginTop: 4, fontWeight: 600 }, children: card.label }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 11, color: currentTheme.textMuted, marginTop: 2 }, children: card.sub })] }, card.id))) }), (0, jsx_runtime_1.jsxs)("div", { style: {
279
+ backgroundColor: currentTheme.card,
280
+ border: `1px solid ${currentTheme.border}`,
281
+ borderRadius: 12,
282
+ padding: 16,
283
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
284
+ fontSize: 11,
285
+ fontWeight: 700,
286
+ color: currentTheme.textMuted,
287
+ letterSpacing: '0.8px',
288
+ marginBottom: 12,
289
+ }, children: "ENGINE ACTIONS" }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 10 }, children: actionButtons.map((btn) => ((0, jsx_runtime_1.jsx)("button", { onClick: btn.onPress, style: {
290
+ padding: '10px 14px',
291
+ backgroundColor: btn.bg,
292
+ color: btn.color,
293
+ border: 'none',
294
+ borderRadius: 8,
295
+ fontWeight: 600,
296
+ cursor: 'pointer',
297
+ }, children: btn.label }, btn.id))) })] }), enableBenchmark && ((0, jsx_runtime_1.jsxs)("div", { style: {
298
+ backgroundColor: currentTheme.isDark ? '#1E1B4B25' : '#F5F3FF',
299
+ border: '1px solid #8B5CF640',
300
+ borderRadius: 12,
301
+ padding: 16,
302
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
303
+ display: 'flex',
304
+ justifyContent: 'space-between',
305
+ alignItems: 'center',
306
+ marginBottom: 8,
307
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
308
+ fontSize: 11,
309
+ fontWeight: 700,
310
+ color: currentTheme.isDark ? '#C4B5FD' : '#6D28D9',
311
+ }, children: "PERFORMANCE BENCHMARK" }), (0, jsx_runtime_1.jsx)("div", { style: {
312
+ fontSize: 10,
313
+ color: currentTheme.isDark ? '#A78BFA' : '#7C3AED',
314
+ fontWeight: 700,
315
+ }, children: "ACID & WAL" })] }), (0, jsx_runtime_1.jsx)("p", { style: { fontSize: 12, color: currentTheme.textMuted, margin: '0 0 12px 0', lineHeight: '18px' }, children: BENCHMARK_DESCRIPTION }), (0, jsx_runtime_1.jsx)("button", { onClick: handleBenchmarkPress, style: {
316
+ width: '100%',
317
+ padding: '10px 16px',
318
+ backgroundColor: '#8B5CF6',
319
+ color: '#FFF',
320
+ border: 'none',
321
+ borderRadius: 8,
322
+ fontWeight: 700,
323
+ fontSize: 13,
324
+ cursor: 'pointer',
325
+ }, children: "\u26A1 Open SQLite Benchmark Suite" })] }))] }), (0, jsx_runtime_1.jsx)("div", { style: {
326
+ padding: '14px 20px',
327
+ backgroundColor: currentTheme.surface,
328
+ borderTop: `1px solid ${currentTheme.border}`,
329
+ }, children: (0, jsx_runtime_1.jsx)("button", { onClick: () => setIsOpen(false), style: {
330
+ width: '100%',
331
+ padding: '12px',
332
+ backgroundColor: currentTheme.actionBg,
333
+ color: currentTheme.actionText,
334
+ border: 'none',
335
+ borderRadius: 8,
336
+ fontWeight: 700,
337
+ cursor: 'pointer',
338
+ }, children: "Close DevTools" }) })] })) : ((0, jsx_runtime_1.jsx)("div", { style: isInline
339
+ ? { position: 'relative', display: 'inline-flex', ...style }
340
+ : {
341
+ position: 'fixed',
342
+ zIndex: 99999,
343
+ left: isCenter ? '50%' : isLeft ? 16 : undefined,
344
+ right: !isCenter && !isLeft ? 16 : undefined,
345
+ transform: isCenter ? 'translateX(-50%)' : undefined,
346
+ ...(isTop ? { top: 20 } : { bottom: 20 }),
347
+ pointerEvents: 'auto',
348
+ ...style,
349
+ }, children: renderTrigger ? (renderTrigger({
350
+ isOpen,
351
+ open: () => setIsOpen(true),
352
+ status,
353
+ metrics,
354
+ statusColor,
355
+ statusLabel,
356
+ })) : !alwaysVisible && status.pendingCount === 0 && status.isOnline && !status.isSyncing ? null : ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setIsOpen(true), style: {
357
+ display: 'inline-flex',
358
+ alignItems: 'center',
359
+ gap: 8,
360
+ background: currentTheme.surface,
361
+ color: currentTheme.text,
362
+ border: `1.5px solid ${statusColor}`,
363
+ padding: isInline ? '5px 10px' : '8px 14px',
364
+ borderRadius: 20,
365
+ cursor: 'pointer',
366
+ boxShadow: isInline ? undefined : '0 4px 12px rgba(0,0,0,0.15)',
367
+ }, children: [(0, jsx_runtime_1.jsx)("span", { style: {
368
+ width: 8,
369
+ height: 8,
370
+ borderRadius: 4,
371
+ backgroundColor: statusColor,
372
+ } }), variant !== 'icon' && variant !== 'minimal' && ((0, jsx_runtime_1.jsx)("span", { style: { fontWeight: 600, fontSize: isInline ? 12 : 13 }, children: triggerLabel })), status.pendingCount > 0 && variant !== 'compact' && ((0, jsx_runtime_1.jsx)("span", { style: {
373
+ background: '#EF4444',
374
+ color: '#fff',
375
+ fontSize: 11,
376
+ padding: '1px 6px',
377
+ borderRadius: 10,
378
+ fontWeight: 700,
379
+ }, children: status.pendingCount }))] })) })), enableBenchmark && !onOpenBenchmark && ((0, jsx_runtime_1.jsx)(BenchmarkModal_js_1.BenchmarkModal, { client: client, visible: isBenchmarkModalOpen, onDismiss: () => setIsBenchmarkModalOpen(false), theme: theme }))] }));
380
+ }
381
+ const rnStyles = RN && RN.StyleSheet
382
+ ? RN.StyleSheet.create({
383
+ fullScreenSafe: {
384
+ flex: 1,
385
+ height: '100%',
386
+ },
387
+ topBar: {
388
+ flexDirection: 'row',
389
+ alignItems: 'center',
390
+ justifyContent: 'space-between',
391
+ paddingHorizontal: 18,
392
+ paddingVertical: 14,
393
+ borderBottomWidth: 1,
394
+ },
395
+ topBarTitle: {
396
+ fontSize: 17,
397
+ fontWeight: '700',
398
+ },
399
+ topBarSub: {
400
+ fontSize: 11,
401
+ marginTop: 2,
402
+ },
403
+ statusBadge: {
404
+ paddingHorizontal: 8,
405
+ paddingVertical: 3,
406
+ borderRadius: 12,
407
+ borderWidth: 1,
408
+ marginRight: 10,
409
+ },
410
+ statusBadgeText: {
411
+ fontSize: 11,
412
+ fontWeight: '700',
413
+ },
414
+ closeCircle: {
415
+ width: 32,
416
+ height: 32,
417
+ borderRadius: 16,
418
+ alignItems: 'center',
419
+ justifyContent: 'center',
420
+ },
421
+ closeCircleText: {
422
+ fontSize: 14,
423
+ fontWeight: '700',
424
+ },
425
+ scrollBody: {
426
+ flex: 1,
427
+ },
428
+ scrollContent: {
429
+ padding: 16,
430
+ paddingBottom: 24,
431
+ },
432
+ actionMsgBox: {
433
+ backgroundColor: '#1E3A8A',
434
+ borderWidth: 1,
435
+ borderColor: '#3B82F6',
436
+ padding: 10,
437
+ borderRadius: 8,
438
+ marginBottom: 14,
439
+ },
440
+ actionMsgText: {
441
+ color: '#93C5FD',
442
+ fontSize: 13,
443
+ fontWeight: '600',
444
+ textAlign: 'center',
445
+ },
446
+ statGrid: {
447
+ flexDirection: 'row',
448
+ width: '100%',
449
+ gap: 10,
450
+ marginBottom: 14,
451
+ },
452
+ statCard: {
453
+ flex: 1,
454
+ minWidth: '45%',
455
+ borderWidth: 1,
456
+ borderRadius: 12,
457
+ padding: 14,
458
+ },
459
+ statNum: {
460
+ fontSize: 24,
461
+ fontWeight: '800',
462
+ },
463
+ statLabel: {
464
+ fontSize: 12,
465
+ fontWeight: '600',
466
+ marginTop: 4,
467
+ },
468
+ statSub: {
469
+ fontSize: 11,
470
+ marginTop: 2,
471
+ },
472
+ infoCard: {
473
+ borderWidth: 1,
474
+ borderRadius: 12,
475
+ padding: 16,
476
+ marginBottom: 14,
477
+ },
478
+ infoCardTitle: {
479
+ fontSize: 11,
480
+ fontWeight: '700',
481
+ letterSpacing: 0.8,
482
+ marginBottom: 10,
483
+ },
484
+ infoRow: {
485
+ flexDirection: 'row',
486
+ alignItems: 'center',
487
+ justifyContent: 'space-between',
488
+ paddingVertical: 9,
489
+ borderBottomWidth: 1,
490
+ },
491
+ infoKey: {
492
+ fontSize: 13,
493
+ },
494
+ infoVal: {
495
+ fontSize: 13,
496
+ fontWeight: '600',
497
+ },
498
+ btnRow: {
499
+ flexDirection: 'row',
500
+ width: '100%',
501
+ gap: 8,
502
+ },
503
+ actionBtn: {
504
+ flex: 1,
505
+ paddingVertical: 10,
506
+ paddingHorizontal: 12,
507
+ borderRadius: 8,
508
+ alignItems: 'center',
509
+ justifyContent: 'center',
510
+ },
511
+ actionBtnText: {
512
+ fontSize: 13,
513
+ fontWeight: '600',
514
+ },
515
+ dotSmall: {
516
+ width: 8,
517
+ height: 8,
518
+ borderRadius: 4,
519
+ },
520
+ bottomBar: {
521
+ paddingHorizontal: 18,
522
+ paddingVertical: 12,
523
+ borderTopWidth: 1,
524
+ },
525
+ doneBtn: {
526
+ paddingVertical: 12,
527
+ borderRadius: 8,
528
+ alignItems: 'center',
529
+ justifyContent: 'center',
530
+ },
531
+ doneBtnText: {
532
+ fontSize: 14,
533
+ fontWeight: '700',
534
+ },
535
+ pill: {
536
+ flexDirection: 'row',
537
+ alignItems: 'center',
538
+ paddingVertical: 8,
539
+ paddingHorizontal: 14,
540
+ borderRadius: 20,
541
+ borderWidth: 1.5,
542
+ elevation: 6,
543
+ shadowColor: '#000',
544
+ shadowOffset: { width: 0, height: 3 },
545
+ shadowOpacity: 0.15,
546
+ shadowRadius: 4,
547
+ },
548
+ inlinePill: {
549
+ flexDirection: 'row',
550
+ alignItems: 'center',
551
+ paddingVertical: 5,
552
+ paddingHorizontal: 10,
553
+ borderRadius: 16,
554
+ borderWidth: 1.5,
555
+ },
556
+ pillText: {
557
+ fontWeight: '600',
558
+ fontSize: 13,
559
+ marginLeft: 8,
560
+ },
561
+ inlinePillText: {
562
+ fontWeight: '600',
563
+ fontSize: 12,
564
+ marginLeft: 6,
565
+ },
566
+ dot: {
567
+ width: 10,
568
+ height: 10,
569
+ borderRadius: 5,
570
+ },
571
+ badge: {
572
+ backgroundColor: '#EF4444',
573
+ paddingHorizontal: 6,
574
+ paddingVertical: 1,
575
+ borderRadius: 10,
576
+ marginLeft: 8,
577
+ },
578
+ badgeText: {
579
+ color: '#FFF',
580
+ fontSize: 11,
581
+ fontWeight: '700',
582
+ },
583
+ })
584
+ : {};
585
+ exports.SyncIndicator = SyncInspector;