local-lite 0.0.3 → 0.0.4

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 (55) 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 +86 -3
  28. package/dist/core/client.js +423 -41
  29. package/dist/core/index.d.ts +14 -0
  30. package/dist/core/index.js +29 -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.d.ts +8 -0
  34. package/dist/core/query.js +37 -0
  35. package/dist/core/schema-manager.d.ts +9 -0
  36. package/dist/core/schema-manager.js +68 -0
  37. package/dist/core/sync-worker.d.ts +38 -1
  38. package/dist/core/sync-worker.js +351 -104
  39. package/dist/core/table-manager.js +26 -29
  40. package/dist/core/types.d.ts +8 -0
  41. package/dist/react/BenchmarkModal.d.ts +32 -0
  42. package/dist/react/BenchmarkModal.js +777 -0
  43. package/dist/react/SyncInspector.d.ts +31 -0
  44. package/dist/react/SyncInspector.js +655 -0
  45. package/dist/react/index.d.ts +51 -19
  46. package/dist/react/index.js +265 -105
  47. package/dist/react/runner.d.ts +7 -0
  48. package/dist/react/runner.js +42 -0
  49. package/dist/react/status.d.ts +24 -0
  50. package/dist/react/status.js +123 -0
  51. package/dist/react/theme.d.ts +18 -0
  52. package/dist/react/theme.js +46 -0
  53. package/dist/utils/logger.d.ts +4 -0
  54. package/dist/utils/logger.js +20 -0
  55. package/package.json +138 -133
@@ -0,0 +1,655 @@
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 Connection & Telemetry Rows
96
+ const telemetryItems = (0, react_1.useMemo)(() => [
97
+ {
98
+ id: 'status',
99
+ label: 'Connection Status',
100
+ value: status.isOnline ? 'Online (Connected)' : 'Offline',
101
+ color: statusColor,
102
+ hasDot: true,
103
+ },
104
+ {
105
+ id: 'sync-state',
106
+ label: 'Sync State',
107
+ value: status.isSyncing ? 'Syncing...' : 'Idle',
108
+ color: status.isSyncing ? '#F59E0B' : currentTheme.textMuted,
109
+ },
110
+ {
111
+ id: 'last-synced',
112
+ label: 'Last Synchronized',
113
+ value: status.lastSyncedAt ? new Date(status.lastSyncedAt).toLocaleTimeString() : 'Never',
114
+ },
115
+ {
116
+ id: 'push-duration',
117
+ label: 'Last Push Duration',
118
+ value: `${metrics?.lastPushDurationMs || 0} ms`,
119
+ },
120
+ {
121
+ id: 'pull-duration',
122
+ label: 'Last Pull Duration',
123
+ value: `${metrics?.lastPullDurationMs || 0} ms`,
124
+ },
125
+ ], [status.isOnline, status.isSyncing, status.lastSyncedAt, statusColor, metrics?.lastPushDurationMs, metrics?.lastPullDurationMs, currentTheme.textMuted]);
126
+ // Shared Action Buttons
127
+ const actionButtons = (0, react_1.useMemo)(() => [
128
+ { id: 'push', label: '🚀 Push Changes', onPress: handlePush, bg: '#3B82F6', color: '#FFFFFF' },
129
+ { id: 'pull', label: '📥 Pull Changes', onPress: handlePull, bg: '#2563EB', color: '#FFFFFF' },
130
+ { id: 'retry', label: '🔄 Retry Failed', onPress: handleRetryFailed, bg: currentTheme.actionBg, color: currentTheme.actionText },
131
+ { id: 'reset', label: '⏪ Reset Cursor', onPress: handleResetCursor, bg: currentTheme.actionBg, color: currentTheme.actionText },
132
+ ], [handlePush, handlePull, handleRetryFailed, handleResetCursor, currentTheme.actionBg, currentTheme.actionText]);
133
+ const triggerLabel = variant === 'compact'
134
+ ? status.pendingCount > 0
135
+ ? `${status.pendingCount} queued`
136
+ : statusLabel
137
+ : 'local-lite';
138
+ if (!client)
139
+ return null;
140
+ // React Native Renderer
141
+ if (RN && RN.View) {
142
+ const { View, Text, TouchableOpacity, ScrollView, Modal, Platform, StatusBar } = RN;
143
+ const SafeComp = RNSafeArea?.SafeAreaView || RN.SafeAreaView || View;
144
+ const isAndroid = Platform?.OS === 'android';
145
+ const statusBarHeight = isAndroid ? StatusBar?.currentHeight || 24 : 0;
146
+ const pillPosStyle = isInline
147
+ ? { position: 'relative' }
148
+ : {
149
+ position: 'absolute',
150
+ zIndex: 99999,
151
+ left: isCenter ? 16 : isLeft ? 16 : undefined,
152
+ right: isCenter ? 16 : !isLeft ? 16 : undefined,
153
+ ...(isTop ? { top: isAndroid ? statusBarHeight + 12 : 48 } : { bottom: 24 }),
154
+ };
155
+ 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({
156
+ isOpen,
157
+ open: () => setIsOpen(true),
158
+ status,
159
+ metrics,
160
+ statusColor,
161
+ statusLabel,
162
+ })) : !alwaysVisible && status.pendingCount === 0 && status.isOnline && !status.isSyncing ? null : ((0, jsx_runtime_1.jsxs)(TouchableOpacity, { onPress: () => setIsOpen(true), style: [
163
+ isInline ? rnStyles.inlinePill : rnStyles.pill,
164
+ {
165
+ borderColor: statusColor,
166
+ backgroundColor: currentTheme.surface,
167
+ alignSelf: isInline ? 'auto' : isCenter ? 'center' : isLeft ? 'flex-start' : 'flex-end',
168
+ },
169
+ ], 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: [
170
+ rnStyles.topBar,
171
+ {
172
+ backgroundColor: currentTheme.surface,
173
+ borderBottomColor: currentTheme.border,
174
+ },
175
+ !RNSafeArea?.SafeAreaView && isAndroid && { paddingTop: statusBarHeight + 10 },
176
+ ], 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: [
177
+ rnStyles.statCard,
178
+ {
179
+ backgroundColor: currentTheme.card,
180
+ borderColor: currentTheme.border,
181
+ },
182
+ ], 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: [
183
+ rnStyles.infoCard,
184
+ {
185
+ backgroundColor: currentTheme.card,
186
+ borderColor: currentTheme.border,
187
+ },
188
+ ], children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.infoCardTitle, { color: currentTheme.textMuted }], children: "CONNECTION & TELEMETRY" }), telemetryItems.map((item, idx) => ((0, jsx_runtime_1.jsxs)(View, { style: [
189
+ rnStyles.infoRow,
190
+ { borderBottomColor: currentTheme.border },
191
+ idx === telemetryItems.length - 1 && { borderBottomWidth: 0 },
192
+ ], children: [(0, jsx_runtime_1.jsx)(Text, { style: [rnStyles.infoKey, { color: currentTheme.textMuted }], children: item.label }), (0, jsx_runtime_1.jsxs)(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 6 }, children: [item.hasDot && (0, jsx_runtime_1.jsx)(View, { style: [rnStyles.dotSmall, { backgroundColor: item.color }] }), (0, jsx_runtime_1.jsx)(Text, { style: [
193
+ rnStyles.infoVal,
194
+ item.color ? { color: item.color, fontWeight: '700' } : { color: currentTheme.text },
195
+ ], children: item.value })] })] }, item.id)))] }), (0, jsx_runtime_1.jsxs)(View, { style: [
196
+ rnStyles.infoCard,
197
+ {
198
+ backgroundColor: currentTheme.card,
199
+ borderColor: currentTheme.border,
200
+ },
201
+ ], 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: [
202
+ rnStyles.infoCard,
203
+ {
204
+ backgroundColor: currentTheme.card,
205
+ borderColor: currentTheme.border,
206
+ },
207
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: {
208
+ flexDirection: 'row',
209
+ justifyContent: 'space-between',
210
+ alignItems: 'center',
211
+ marginBottom: 10,
212
+ }, 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: [
213
+ rnStyles.infoRow,
214
+ { borderBottomColor: currentTheme.border },
215
+ idx === Math.min(status.pendingRecords.length, 8) - 1 && { borderBottomWidth: 0 },
216
+ ], 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: [
217
+ rnStyles.dotSmall,
218
+ { backgroundColor: rec.status === 'FAILED' ? '#EF4444' : '#F59E0B' },
219
+ ] }), (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: {
220
+ backgroundColor: currentTheme.actionBg,
221
+ paddingHorizontal: 5,
222
+ paddingVertical: 1,
223
+ borderRadius: 4,
224
+ }, 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: [
225
+ rnStyles.infoCard,
226
+ {
227
+ borderColor: '#8B5CF640',
228
+ backgroundColor: currentTheme.isDark ? '#1E1B4B25' : '#F5F3FF',
229
+ },
230
+ ], children: [(0, jsx_runtime_1.jsxs)(View, { style: {
231
+ flexDirection: 'row',
232
+ alignItems: 'center',
233
+ justifyContent: 'space-between',
234
+ marginBottom: 8,
235
+ }, children: [(0, jsx_runtime_1.jsx)(Text, { style: [
236
+ rnStyles.infoCardTitle,
237
+ { color: currentTheme.isDark ? '#C4B5FD' : '#6D28D9', marginBottom: 0 },
238
+ ], children: "PERFORMANCE BENCHMARK" }), (0, jsx_runtime_1.jsx)(Text, { style: {
239
+ fontSize: 10,
240
+ color: currentTheme.isDark ? '#A78BFA' : '#7C3AED',
241
+ fontWeight: '700',
242
+ }, 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: [
243
+ rnStyles.bottomBar,
244
+ {
245
+ backgroundColor: currentTheme.surface,
246
+ borderTopColor: currentTheme.border,
247
+ },
248
+ !RNSafeArea?.SafeAreaView && isAndroid && { paddingBottom: 32 },
249
+ ], 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 }))] }));
250
+ }
251
+ // Web / DOM Renderer Fallback
252
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isOpen ? ((0, jsx_runtime_1.jsxs)("div", { style: {
253
+ position: 'fixed',
254
+ inset: 0,
255
+ backgroundColor: currentTheme.bg,
256
+ zIndex: 99999,
257
+ display: 'flex',
258
+ flexDirection: 'column',
259
+ fontFamily: 'system-ui, -apple-system, sans-serif',
260
+ color: currentTheme.text,
261
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
262
+ display: 'flex',
263
+ alignItems: 'center',
264
+ justifyContent: 'space-between',
265
+ padding: '16px 24px',
266
+ backgroundColor: currentTheme.surface,
267
+ borderBottom: `1px solid ${currentTheme.border}`,
268
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [(0, jsx_runtime_1.jsx)("span", { style: {
269
+ width: 12,
270
+ height: 12,
271
+ borderRadius: 6,
272
+ backgroundColor: statusColor,
273
+ } }), (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: {
274
+ border: `1px solid ${statusColor}`,
275
+ color: statusColor,
276
+ padding: '3px 10px',
277
+ borderRadius: 12,
278
+ fontSize: 11,
279
+ fontWeight: 700,
280
+ backgroundColor: `${statusColor}20`,
281
+ }, children: statusLabel }), (0, jsx_runtime_1.jsx)("button", { onClick: () => setIsOpen(false), style: {
282
+ width: 32,
283
+ height: 32,
284
+ borderRadius: 16,
285
+ backgroundColor: currentTheme.actionBg,
286
+ border: 'none',
287
+ color: currentTheme.actionText,
288
+ fontSize: 14,
289
+ cursor: 'pointer',
290
+ display: 'flex',
291
+ alignItems: 'center',
292
+ justifyContent: 'center',
293
+ }, children: "\u2715" })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
294
+ flex: 1,
295
+ overflowY: 'auto',
296
+ padding: 24,
297
+ maxWidth: 720,
298
+ width: '100%',
299
+ margin: '0 auto',
300
+ boxSizing: 'border-box',
301
+ display: 'flex',
302
+ flexDirection: 'column',
303
+ gap: 16,
304
+ }, children: [actionMessage && ((0, jsx_runtime_1.jsx)("div", { style: {
305
+ backgroundColor: '#1E3A8A',
306
+ border: '1px solid #3B82F6',
307
+ color: '#93C5FD',
308
+ padding: 10,
309
+ borderRadius: 8,
310
+ fontSize: 13,
311
+ fontWeight: 600,
312
+ textAlign: 'center',
313
+ }, children: actionMessage })), (0, jsx_runtime_1.jsx)("div", { style: {
314
+ display: 'grid',
315
+ gridTemplateColumns: 'repeat(auto-fit, minmax(140px, 1fr))',
316
+ gap: 12,
317
+ }, children: statCards.map((card) => ((0, jsx_runtime_1.jsxs)("div", { style: {
318
+ backgroundColor: currentTheme.card,
319
+ border: `1px solid ${currentTheme.border}`,
320
+ borderRadius: 12,
321
+ padding: 16,
322
+ }, 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: {
323
+ backgroundColor: currentTheme.card,
324
+ border: `1px solid ${currentTheme.border}`,
325
+ borderRadius: 12,
326
+ padding: 16,
327
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
328
+ fontSize: 11,
329
+ fontWeight: 700,
330
+ color: currentTheme.textMuted,
331
+ letterSpacing: '0.8px',
332
+ marginBottom: 12,
333
+ }, children: "CONNECTION & TELEMETRY" }), telemetryItems.map((item, idx) => ((0, jsx_runtime_1.jsxs)("div", { style: {
334
+ display: 'flex',
335
+ justifyContent: 'space-between',
336
+ alignItems: 'center',
337
+ padding: '8px 0',
338
+ borderBottom: idx === telemetryItems.length - 1 ? 'none' : `1px solid ${currentTheme.border}`,
339
+ }, children: [(0, jsx_runtime_1.jsx)("span", { style: { color: currentTheme.textMuted, fontSize: 13 }, children: item.label }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: 6 }, children: [item.hasDot && ((0, jsx_runtime_1.jsx)("span", { style: {
340
+ width: 8,
341
+ height: 8,
342
+ borderRadius: 4,
343
+ backgroundColor: item.color,
344
+ } })), (0, jsx_runtime_1.jsx)("span", { style: {
345
+ color: item.color || currentTheme.text,
346
+ fontSize: 13,
347
+ fontWeight: item.color ? 700 : 600,
348
+ }, children: item.value })] })] }, item.id)))] }), (0, jsx_runtime_1.jsxs)("div", { style: {
349
+ backgroundColor: currentTheme.card,
350
+ border: `1px solid ${currentTheme.border}`,
351
+ borderRadius: 12,
352
+ padding: 16,
353
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
354
+ fontSize: 11,
355
+ fontWeight: 700,
356
+ color: currentTheme.textMuted,
357
+ letterSpacing: '0.8px',
358
+ marginBottom: 12,
359
+ }, 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: {
360
+ padding: '10px 14px',
361
+ backgroundColor: btn.bg,
362
+ color: btn.color,
363
+ border: 'none',
364
+ borderRadius: 8,
365
+ fontWeight: 600,
366
+ cursor: 'pointer',
367
+ }, children: btn.label }, btn.id))) })] }), enableBenchmark && ((0, jsx_runtime_1.jsxs)("div", { style: {
368
+ backgroundColor: currentTheme.isDark ? '#1E1B4B25' : '#F5F3FF',
369
+ border: '1px solid #8B5CF640',
370
+ borderRadius: 12,
371
+ padding: 16,
372
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
373
+ display: 'flex',
374
+ justifyContent: 'space-between',
375
+ alignItems: 'center',
376
+ marginBottom: 8,
377
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
378
+ fontSize: 11,
379
+ fontWeight: 700,
380
+ color: currentTheme.isDark ? '#C4B5FD' : '#6D28D9',
381
+ }, children: "PERFORMANCE BENCHMARK" }), (0, jsx_runtime_1.jsx)("div", { style: {
382
+ fontSize: 10,
383
+ color: currentTheme.isDark ? '#A78BFA' : '#7C3AED',
384
+ fontWeight: 700,
385
+ }, 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: {
386
+ width: '100%',
387
+ padding: '10px 16px',
388
+ backgroundColor: '#8B5CF6',
389
+ color: '#FFF',
390
+ border: 'none',
391
+ borderRadius: 8,
392
+ fontWeight: 700,
393
+ fontSize: 13,
394
+ cursor: 'pointer',
395
+ }, children: "\u26A1 Open SQLite Benchmark Suite" })] }))] }), (0, jsx_runtime_1.jsx)("div", { style: {
396
+ padding: '14px 20px',
397
+ backgroundColor: currentTheme.surface,
398
+ borderTop: `1px solid ${currentTheme.border}`,
399
+ }, children: (0, jsx_runtime_1.jsx)("button", { onClick: () => setIsOpen(false), style: {
400
+ width: '100%',
401
+ padding: '12px',
402
+ backgroundColor: currentTheme.actionBg,
403
+ color: currentTheme.actionText,
404
+ border: 'none',
405
+ borderRadius: 8,
406
+ fontWeight: 700,
407
+ cursor: 'pointer',
408
+ }, children: "Close DevTools" }) })] })) : ((0, jsx_runtime_1.jsx)("div", { style: isInline
409
+ ? { position: 'relative', display: 'inline-flex', ...style }
410
+ : {
411
+ position: 'fixed',
412
+ zIndex: 99999,
413
+ left: isCenter ? '50%' : isLeft ? 16 : undefined,
414
+ right: !isCenter && !isLeft ? 16 : undefined,
415
+ transform: isCenter ? 'translateX(-50%)' : undefined,
416
+ ...(isTop ? { top: 20 } : { bottom: 20 }),
417
+ pointerEvents: 'auto',
418
+ ...style,
419
+ }, children: renderTrigger ? (renderTrigger({
420
+ isOpen,
421
+ open: () => setIsOpen(true),
422
+ status,
423
+ metrics,
424
+ statusColor,
425
+ statusLabel,
426
+ })) : !alwaysVisible && status.pendingCount === 0 && status.isOnline && !status.isSyncing ? null : ((0, jsx_runtime_1.jsxs)("button", { onClick: () => setIsOpen(true), style: {
427
+ display: 'inline-flex',
428
+ alignItems: 'center',
429
+ gap: 8,
430
+ background: currentTheme.surface,
431
+ color: currentTheme.text,
432
+ border: `1.5px solid ${statusColor}`,
433
+ padding: isInline ? '5px 10px' : '8px 14px',
434
+ borderRadius: 20,
435
+ cursor: 'pointer',
436
+ boxShadow: isInline ? undefined : '0 4px 12px rgba(0,0,0,0.15)',
437
+ }, children: [(0, jsx_runtime_1.jsx)("span", { style: {
438
+ width: 8,
439
+ height: 8,
440
+ borderRadius: 4,
441
+ backgroundColor: statusColor,
442
+ } }), 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: {
443
+ background: '#EF4444',
444
+ color: '#fff',
445
+ fontSize: 11,
446
+ padding: '1px 6px',
447
+ borderRadius: 10,
448
+ fontWeight: 700,
449
+ }, children: status.pendingCount }))] })) })), enableBenchmark && !onOpenBenchmark && ((0, jsx_runtime_1.jsx)(BenchmarkModal_js_1.BenchmarkModal, { client: client, visible: isBenchmarkModalOpen, onDismiss: () => setIsBenchmarkModalOpen(false), theme: theme }))] }));
450
+ }
451
+ const rnStyles = RN && RN.StyleSheet
452
+ ? RN.StyleSheet.create({
453
+ fullScreenSafe: {
454
+ flex: 1,
455
+ height: '100%',
456
+ },
457
+ topBar: {
458
+ flexDirection: 'row',
459
+ alignItems: 'center',
460
+ justifyContent: 'space-between',
461
+ paddingHorizontal: 18,
462
+ paddingVertical: 14,
463
+ borderBottomWidth: 1,
464
+ },
465
+ topBarTitle: {
466
+ fontSize: 17,
467
+ fontWeight: '700',
468
+ },
469
+ topBarSub: {
470
+ fontSize: 11,
471
+ marginTop: 2,
472
+ },
473
+ statusBadge: {
474
+ paddingHorizontal: 8,
475
+ paddingVertical: 3,
476
+ borderRadius: 12,
477
+ borderWidth: 1,
478
+ marginRight: 10,
479
+ },
480
+ statusBadgeText: {
481
+ fontSize: 11,
482
+ fontWeight: '700',
483
+ },
484
+ closeCircle: {
485
+ width: 32,
486
+ height: 32,
487
+ borderRadius: 16,
488
+ alignItems: 'center',
489
+ justifyContent: 'center',
490
+ },
491
+ closeCircleText: {
492
+ fontSize: 14,
493
+ fontWeight: '700',
494
+ },
495
+ scrollBody: {
496
+ flex: 1,
497
+ },
498
+ scrollContent: {
499
+ padding: 16,
500
+ paddingBottom: 24,
501
+ },
502
+ actionMsgBox: {
503
+ backgroundColor: '#1E3A8A',
504
+ borderWidth: 1,
505
+ borderColor: '#3B82F6',
506
+ padding: 10,
507
+ borderRadius: 8,
508
+ marginBottom: 14,
509
+ },
510
+ actionMsgText: {
511
+ color: '#93C5FD',
512
+ fontSize: 13,
513
+ fontWeight: '600',
514
+ textAlign: 'center',
515
+ },
516
+ statGrid: {
517
+ flexDirection: 'row',
518
+ width: '100%',
519
+ gap: 10,
520
+ marginBottom: 14,
521
+ },
522
+ statCard: {
523
+ flex: 1,
524
+ minWidth: '45%',
525
+ borderWidth: 1,
526
+ borderRadius: 12,
527
+ padding: 14,
528
+ },
529
+ statNum: {
530
+ fontSize: 24,
531
+ fontWeight: '800',
532
+ },
533
+ statLabel: {
534
+ fontSize: 12,
535
+ fontWeight: '600',
536
+ marginTop: 4,
537
+ },
538
+ statSub: {
539
+ fontSize: 11,
540
+ marginTop: 2,
541
+ },
542
+ infoCard: {
543
+ borderWidth: 1,
544
+ borderRadius: 12,
545
+ padding: 16,
546
+ marginBottom: 14,
547
+ },
548
+ infoCardTitle: {
549
+ fontSize: 11,
550
+ fontWeight: '700',
551
+ letterSpacing: 0.8,
552
+ marginBottom: 10,
553
+ },
554
+ infoRow: {
555
+ flexDirection: 'row',
556
+ alignItems: 'center',
557
+ justifyContent: 'space-between',
558
+ paddingVertical: 9,
559
+ borderBottomWidth: 1,
560
+ },
561
+ infoKey: {
562
+ fontSize: 13,
563
+ },
564
+ infoVal: {
565
+ fontSize: 13,
566
+ fontWeight: '600',
567
+ },
568
+ btnRow: {
569
+ flexDirection: 'row',
570
+ width: '100%',
571
+ gap: 8,
572
+ },
573
+ actionBtn: {
574
+ flex: 1,
575
+ paddingVertical: 10,
576
+ paddingHorizontal: 12,
577
+ borderRadius: 8,
578
+ alignItems: 'center',
579
+ justifyContent: 'center',
580
+ },
581
+ actionBtnText: {
582
+ fontSize: 13,
583
+ fontWeight: '600',
584
+ },
585
+ dotSmall: {
586
+ width: 8,
587
+ height: 8,
588
+ borderRadius: 4,
589
+ },
590
+ bottomBar: {
591
+ paddingHorizontal: 18,
592
+ paddingVertical: 12,
593
+ borderTopWidth: 1,
594
+ },
595
+ doneBtn: {
596
+ paddingVertical: 12,
597
+ borderRadius: 8,
598
+ alignItems: 'center',
599
+ justifyContent: 'center',
600
+ },
601
+ doneBtnText: {
602
+ fontSize: 14,
603
+ fontWeight: '700',
604
+ },
605
+ pill: {
606
+ flexDirection: 'row',
607
+ alignItems: 'center',
608
+ paddingVertical: 8,
609
+ paddingHorizontal: 14,
610
+ borderRadius: 20,
611
+ borderWidth: 1.5,
612
+ elevation: 6,
613
+ shadowColor: '#000',
614
+ shadowOffset: { width: 0, height: 3 },
615
+ shadowOpacity: 0.15,
616
+ shadowRadius: 4,
617
+ },
618
+ inlinePill: {
619
+ flexDirection: 'row',
620
+ alignItems: 'center',
621
+ paddingVertical: 5,
622
+ paddingHorizontal: 10,
623
+ borderRadius: 16,
624
+ borderWidth: 1.5,
625
+ },
626
+ pillText: {
627
+ fontWeight: '600',
628
+ fontSize: 13,
629
+ marginLeft: 8,
630
+ },
631
+ inlinePillText: {
632
+ fontWeight: '600',
633
+ fontSize: 12,
634
+ marginLeft: 6,
635
+ },
636
+ dot: {
637
+ width: 10,
638
+ height: 10,
639
+ borderRadius: 5,
640
+ },
641
+ badge: {
642
+ backgroundColor: '#EF4444',
643
+ paddingHorizontal: 6,
644
+ paddingVertical: 1,
645
+ borderRadius: 10,
646
+ marginLeft: 8,
647
+ },
648
+ badgeText: {
649
+ color: '#FFF',
650
+ fontSize: 11,
651
+ fontWeight: '700',
652
+ },
653
+ })
654
+ : {};
655
+ exports.SyncIndicator = SyncInspector;