peerpigeon 0.1.1 → 1.0.2

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 (77) hide show
  1. package/README.md +141 -1365
  2. package/cli.js +1382 -0
  3. package/dist/peerpigeon-browser.js +12450 -0
  4. package/dist/peerpigeon-browser.js.map +7 -0
  5. package/docs/API_DOCUMENTATION.md +1976 -0
  6. package/docs/BOOTSTRAP_HUBS.md +319 -0
  7. package/docs/CLI_README.md +371 -0
  8. package/docs/CUSTOM_HUB_NAMESPACES.md +182 -0
  9. package/docs/CUSTOM_NAMESPACE_IMPLEMENTATION.md +187 -0
  10. package/docs/DOCUMENTATION_REORGANIZATION.md +172 -0
  11. package/docs/HUB_QUICK_REF.md +108 -0
  12. package/docs/HUB_SCRIPTS.md +341 -0
  13. package/docs/HUB_SYSTEM.md +599 -0
  14. package/docs/MIGRATION_COMPLETE.md +93 -0
  15. package/docs/NETWORK_NAMESPACES.md +212 -0
  16. package/docs/PIGEONRTC_MIGRATION.md +280 -0
  17. package/docs/README.md +108 -0
  18. package/docs/SELECTIVE_STREAMING_GUIDE.md +427 -0
  19. package/docs/TEST_CLEANUP_COMPLETE.md +80 -0
  20. package/examples/bootstrap-hub-example.js +292 -0
  21. package/examples/browser/README.md +278 -0
  22. package/examples/browser/app.js +2426 -49
  23. package/examples/browser/index.html +481 -630
  24. package/examples/browser/minimal/README.md +55 -0
  25. package/examples/browser/minimal/index.html +75 -0
  26. package/examples/browser/minimal/minimal.js +234 -0
  27. package/examples/browser/styles.css +687 -1425
  28. package/examples/browser/test-bundle.html +35 -0
  29. package/examples/browser-2/index.html +30 -0
  30. package/examples/browser-2/package.json +21 -0
  31. package/examples/browser-2/src/App-simple.vue +21 -0
  32. package/examples/browser-2/src/App.vue +420 -0
  33. package/examples/browser-2/src/components/CryptoView.vue +1661 -0
  34. package/examples/browser-2/src/components/DHTView.vue +1281 -0
  35. package/examples/browser-2/src/components/DebugView.vue +1773 -0
  36. package/examples/browser-2/src/components/MediaView.vue +1048 -0
  37. package/examples/browser-2/src/components/MessagingView.vue +775 -0
  38. package/examples/browser-2/src/components/NetworkView.vue +930 -0
  39. package/examples/browser-2/src/components/StorageView.vue +1376 -0
  40. package/examples/browser-2/src/main.js +5 -0
  41. package/examples/browser-2/src/stores/peerpigeon.js +895 -0
  42. package/examples/browser-2/vite.config.js +6 -0
  43. package/examples/hub-example.js +189 -0
  44. package/examples/multi-hub-test.js +186 -0
  45. package/examples/node/README.md +2 -2
  46. package/examples/programmatic-namespace-example.js +108 -0
  47. package/examples/selective-streaming-demo.html +698 -0
  48. package/examples/standard-events-demo.js +126 -0
  49. package/index.js +7 -1
  50. package/package.json +34 -16
  51. package/server/index.js +1058 -98
  52. package/server/start.js +52 -0
  53. package/src/ConnectionManager.js +239 -225
  54. package/src/CryptoManager.js +147 -18
  55. package/src/DebugLogger.js +0 -7
  56. package/src/DistributedStorageManager.js +224 -205
  57. package/src/EnvironmentDetector.js +88 -4
  58. package/src/EventEmitter.js +79 -1
  59. package/src/EvictionManager.js +10 -9
  60. package/src/GossipManager.js +163 -11
  61. package/src/MediaManager.js +12 -2
  62. package/src/PeerConnection.js +343 -311
  63. package/src/PeerPigeonMesh.js +576 -135
  64. package/src/PigeonRTC-browser.js +247 -0
  65. package/src/SignalingClient.js +14 -243
  66. package/src/SignalingHandler.js +31 -10
  67. package/src/StorageManager.js +0 -39
  68. package/src/WebDHT-Simple.js +389 -0
  69. package/src/WebDHT.js +363 -1165
  70. package/src/browser-entry.js +58 -0
  71. package/examples/browser/assets/images/favicon.png +0 -0
  72. package/examples/browser/assets/images/pigeon.png +0 -0
  73. package/examples/browser/crypto-test.html +0 -427
  74. package/examples/browser/ui-old.js +0 -1926
  75. package/examples/browser/ui.js +0 -3391
  76. package/websocket-server/README.md +0 -247
  77. package/websocket-server/server.js +0 -391
@@ -0,0 +1,930 @@
1
+ <template>
2
+ <div class="network-view">
3
+ <div class="section-header">
4
+ <h2>🌐 Network Overview</h2>
5
+ <p>Monitor mesh network topology, peer connections, and network health</p>
6
+ </div>
7
+
8
+ <!-- Network Namespace Section -->
9
+ <div class="namespace-section">
10
+ <h3>Network Namespace</h3>
11
+ <div class="namespace-info">
12
+ <div class="current-network">
13
+ <div class="network-badge">
14
+ <span class="network-name">{{ store.networkName }}</span>
15
+ <span v-if="store.isInFallbackMode" class="fallback-indicator">Fallback Mode</span>
16
+ </div>
17
+ <div v-if="store.isInFallbackMode" class="original-network">
18
+ Original: {{ store.originalNetworkName }}
19
+ </div>
20
+ </div>
21
+
22
+ <div class="namespace-controls">
23
+ <div class="network-switch">
24
+ <input
25
+ v-model="newNetworkName"
26
+ type="text"
27
+ placeholder="Enter network name (e.g., 'gaming', 'work')"
28
+ class="network-input"
29
+ :disabled="isConnected"
30
+ />
31
+ <button
32
+ @click="switchNetwork"
33
+ :disabled="!newNetworkName.trim() || isConnected"
34
+ class="btn btn-primary btn-sm"
35
+ >
36
+ Switch
37
+ </button>
38
+ </div>
39
+
40
+ <div class="quick-networks">
41
+ <button
42
+ v-for="network in quickNetworks"
43
+ :key="network"
44
+ @click="setQuickNetwork(network)"
45
+ :disabled="isConnected || store.networkName === network"
46
+ :class="['btn', 'btn-outline', 'btn-xs', { active: store.networkName === network }]"
47
+ >
48
+ {{ network }}
49
+ </button>
50
+ </div>
51
+
52
+ <div class="fallback-setting">
53
+ <label class="checkbox-label">
54
+ <input
55
+ type="checkbox"
56
+ v-model="store.allowGlobalFallback"
57
+ @change="updateFallbackSetting"
58
+ />
59
+ Allow global fallback
60
+ </label>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+
66
+ <!-- Network Status Cards -->
67
+ <div class="status-grid">
68
+ <div class="status-card">
69
+ <div class="status-card-icon">👥</div>
70
+ <div class="status-card-content">
71
+ <h3>Connected Peers</h3>
72
+ <div class="status-value">{{ networkStatus.connectedCount }}/{{ networkStatus.maxPeers }}</div>
73
+ <div class="status-meta">{{ canAcceptMorePeers ? 'Can accept more' : 'At capacity' }}</div>
74
+ </div>
75
+ </div>
76
+
77
+ <div class="status-card">
78
+ <div class="status-card-icon">🔍</div>
79
+ <div class="status-card-content">
80
+ <h3>Discovered Peers</h3>
81
+ <div class="status-value">{{ discoveredPeers.size }}</div>
82
+ <div class="status-meta">Available to connect</div>
83
+ </div>
84
+ </div>
85
+
86
+ <div class="status-card">
87
+ <div class="status-card-icon">⚙️</div>
88
+ <div class="status-card-content">
89
+ <h3>Auto Discovery</h3>
90
+ <div class="status-value">{{ networkStatus.autoDiscovery ? 'ON' : 'OFF' }}</div>
91
+ <div class="status-meta">Automatic peer discovery</div>
92
+ </div>
93
+ </div>
94
+
95
+ <div class="status-card">
96
+ <div class="status-card-icon">🔄</div>
97
+ <div class="status-card-content">
98
+ <h3>XOR Routing</h3>
99
+ <div class="status-value">{{ networkStatus.xorRouting ? 'ON' : 'OFF' }}</div>
100
+ <div class="status-meta">Distance-based routing</div>
101
+ </div>
102
+ </div>
103
+ </div>
104
+
105
+ <!-- Network Configuration -->
106
+ <div class="config-section">
107
+ <h3>Network Configuration</h3>
108
+ <div class="config-grid">
109
+ <div class="config-item">
110
+ <label>Max Peers</label>
111
+ <input
112
+ v-model.number="maxPeers"
113
+ type="number"
114
+ min="1"
115
+ max="50"
116
+ @change="updateMaxPeers"
117
+ class="config-input"
118
+ >
119
+ </div>
120
+ <div class="config-item">
121
+ <label>Min Peers</label>
122
+ <input
123
+ v-model.number="minPeers"
124
+ type="number"
125
+ min="0"
126
+ :max="maxPeers - 1"
127
+ @change="updateMinPeers"
128
+ class="config-input"
129
+ >
130
+ </div>
131
+ <div class="config-item">
132
+ <label>Auto Discovery</label>
133
+ <button
134
+ @click="toggleAutoDiscovery"
135
+ :class="['toggle-btn', { active: networkStatus.autoDiscovery }]"
136
+ >
137
+ {{ networkStatus.autoDiscovery ? 'ON' : 'OFF' }}
138
+ </button>
139
+ </div>
140
+ <div class="config-item">
141
+ <label>Eviction Strategy</label>
142
+ <button
143
+ @click="toggleEvictionStrategy"
144
+ :class="['toggle-btn', { active: networkStatus.evictionStrategy }]"
145
+ >
146
+ {{ networkStatus.evictionStrategy ? 'ON' : 'OFF' }}
147
+ </button>
148
+ </div>
149
+ </div>
150
+ </div>
151
+
152
+ <!-- Connected Peers List -->
153
+ <div class="peers-section">
154
+ <div class="section-title">
155
+ <h3>Connected Peers ({{ connectedPeersList.length }})</h3>
156
+ <button @click="refreshPeerList" class="btn btn-secondary">Refresh</button>
157
+ </div>
158
+
159
+ <div class="peers-list">
160
+ <div v-if="connectedPeersList.length === 0" class="empty-state">
161
+ <div class="empty-icon">😔</div>
162
+ <p>No peers connected yet</p>
163
+ <p class="empty-meta">Connect to the signaling server to discover peers</p>
164
+ </div>
165
+
166
+ <div
167
+ v-for="peer in connectedPeersList"
168
+ :key="peer.id"
169
+ class="peer-card"
170
+ >
171
+ <div class="peer-header">
172
+ <div class="peer-id">
173
+ <span class="peer-icon">👤</span>
174
+ {{ peer.id.substring(0, 16) }}...
175
+ </div>
176
+ <div class="peer-status" :class="peer.status">
177
+ {{ peer.status }}
178
+ </div>
179
+ </div>
180
+
181
+ <div class="peer-details">
182
+ <div class="peer-detail">
183
+ <strong>Connected:</strong> {{ formatTime(peer.connectionTime) }}
184
+ </div>
185
+ <div class="peer-detail" v-if="peer.disconnectionTime">
186
+ <strong>Disconnected:</strong> {{ formatTime(peer.disconnectionTime) }}
187
+ </div>
188
+ <div class="peer-detail" v-if="peer.disconnectionReason">
189
+ <strong>Reason:</strong> {{ peer.disconnectionReason }}
190
+ </div>
191
+ </div>
192
+
193
+ <div class="peer-actions">
194
+ <button
195
+ @click="sendPing(peer.id)"
196
+ class="btn btn-sm btn-primary"
197
+ :disabled="!peer.connected"
198
+ >
199
+ Ping
200
+ </button>
201
+ <button
202
+ @click="disconnectPeer(peer.id)"
203
+ class="btn btn-sm btn-danger"
204
+ :disabled="!peer.connected"
205
+ >
206
+ Disconnect
207
+ </button>
208
+ </div>
209
+ </div>
210
+ </div>
211
+ </div>
212
+
213
+ <!-- Discovered Peers -->
214
+ <div class="peers-section" v-if="discoveredPeers.size > 0">
215
+ <h3>Discovered Peers ({{ discoveredPeers.size }})</h3>
216
+
217
+ <div class="peers-list">
218
+ <div
219
+ v-for="peer in Array.from(discoveredPeers.values())"
220
+ :key="peer.id"
221
+ class="peer-card discovered"
222
+ >
223
+ <div class="peer-header">
224
+ <div class="peer-id">
225
+ <span class="peer-icon">🔍</span>
226
+ {{ peer.id.substring(0, 16) }}...
227
+ </div>
228
+ <div class="peer-status discovered">
229
+ discovered
230
+ </div>
231
+ </div>
232
+
233
+ <div class="peer-details">
234
+ <div class="peer-detail">
235
+ <strong>Discovered:</strong> {{ formatTime(peer.discoveryTime) }}
236
+ </div>
237
+ </div>
238
+
239
+ <div class="peer-actions">
240
+ <button
241
+ @click="connectToPeer(peer.id)"
242
+ class="btn btn-sm btn-primary"
243
+ :disabled="!canAcceptMorePeers"
244
+ >
245
+ Connect
246
+ </button>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </div>
251
+
252
+ <!-- Network Statistics -->
253
+ <div class="stats-section">
254
+ <h3>Network Statistics</h3>
255
+ <div class="stats-grid">
256
+ <div class="stat-item">
257
+ <strong>Your Peer ID:</strong>
258
+ <code>{{ peerId }}</code>
259
+ </div>
260
+ <div class="stat-item">
261
+ <strong>Network Health:</strong>
262
+ <span :class="getNetworkHealthClass()">{{ getNetworkHealth() }}</span>
263
+ </div>
264
+ <div class="stat-item">
265
+ <strong>Connection Time:</strong>
266
+ {{ connectionUptime }}
267
+ </div>
268
+ <div class="stat-item">
269
+ <strong>Environment:</strong>
270
+ {{ getEnvironmentInfo() }}
271
+ </div>
272
+ </div>
273
+ </div>
274
+ </div>
275
+ </template>
276
+
277
+ <script setup>
278
+ import { ref, computed, onMounted, onUnmounted } from 'vue';
279
+ import { usePeerPigeonStore } from '../stores/peerpigeon.js';
280
+
281
+ const store = usePeerPigeonStore();
282
+
283
+ // Local reactive state
284
+ const maxPeers = ref(3);
285
+ const minPeers = ref(2);
286
+ const connectionStartTime = ref(null);
287
+ const uptimeInterval = ref(null);
288
+ const connectionUptime = ref('00:00:00');
289
+
290
+ // Network namespace state
291
+ const newNetworkName = ref('');
292
+ const quickNetworks = ['global', 'gaming', 'work', 'family', 'test'];
293
+
294
+ // Computed properties
295
+ const networkStatus = computed(() => store.networkStatus);
296
+ const peers = computed(() => store.peers);
297
+ const discoveredPeers = computed(() => store.discoveredPeers);
298
+ const connectedPeersList = computed(() => store.connectedPeersList);
299
+ const canAcceptMorePeers = computed(() => store.canAcceptMorePeers);
300
+ const peerId = computed(() => store.peerId);
301
+ const isConnected = computed(() => store.isConnected);
302
+
303
+ // Network namespace methods
304
+ const switchNetwork = () => {
305
+ if (newNetworkName.value.trim()) {
306
+ store.setNetworkName(newNetworkName.value.trim());
307
+ store.addDebugLog(`Network set to: ${newNetworkName.value.trim()}`, 'success');
308
+ newNetworkName.value = '';
309
+ }
310
+ };
311
+
312
+ const setQuickNetwork = (network) => {
313
+ store.setNetworkName(network);
314
+ store.addDebugLog(`Quick switch to network: ${network}`, 'success');
315
+ };
316
+
317
+ const updateFallbackSetting = () => {
318
+ store.setAllowGlobalFallback(store.allowGlobalFallback);
319
+ };
320
+
321
+ // Methods
322
+ const updateMaxPeers = () => {
323
+ if (store.mesh) {
324
+ store.mesh.setMaxPeers(maxPeers.value);
325
+ store.addDebugLog(`Max peers updated to ${maxPeers.value}`);
326
+ }
327
+ };
328
+
329
+ const updateMinPeers = () => {
330
+ if (store.mesh) {
331
+ store.mesh.setMinPeers(minPeers.value);
332
+ store.addDebugLog(`Min peers updated to ${minPeers.value}`);
333
+ }
334
+ };
335
+
336
+ const toggleAutoDiscovery = () => {
337
+ if (store.mesh) {
338
+ const newValue = !networkStatus.value.autoDiscovery;
339
+ store.mesh.setAutoDiscovery(newValue);
340
+ store.addDebugLog(`Auto discovery ${newValue ? 'enabled' : 'disabled'}`);
341
+ }
342
+ };
343
+
344
+ const toggleEvictionStrategy = () => {
345
+ if (store.mesh) {
346
+ const newValue = !networkStatus.value.evictionStrategy;
347
+ store.mesh.setEvictionStrategy(newValue);
348
+ store.addDebugLog(`Eviction strategy ${newValue ? 'enabled' : 'disabled'}`);
349
+ }
350
+ };
351
+
352
+ const refreshPeerList = () => {
353
+ store.addDebugLog('Peer list refreshed');
354
+ // The peer list is automatically updated through events
355
+ };
356
+
357
+ const sendPing = (peerId) => {
358
+ store.sendDirectMessage(peerId, { type: 'ping', timestamp: Date.now() });
359
+ store.addDebugLog(`Ping sent to ${peerId.substring(0, 8)}...`);
360
+ };
361
+
362
+ const disconnectPeer = (peerId) => {
363
+ if (store.mesh) {
364
+ // Note: PeerPigeon doesn't have a direct disconnect peer method
365
+ // This would typically be handled by the ConnectionManager
366
+ store.addDebugLog(`Disconnect requested for ${peerId.substring(0, 8)}...`);
367
+ }
368
+ };
369
+
370
+ const connectToPeer = (peerId) => {
371
+ if (store.mesh) {
372
+ store.mesh.connectToPeer(peerId);
373
+ store.addDebugLog(`Connection attempt to ${peerId.substring(0, 8)}...`);
374
+ }
375
+ };
376
+
377
+ const formatTime = (date) => {
378
+ if (!date) return 'Unknown';
379
+ return date.toLocaleTimeString();
380
+ };
381
+
382
+ const getNetworkHealth = () => {
383
+ const connected = networkStatus.value.connectedCount;
384
+ const min = networkStatus.value.minPeers;
385
+ const max = networkStatus.value.maxPeers;
386
+
387
+ if (connected === 0) return 'Isolated';
388
+ if (connected < min) return 'Poor';
389
+ if (connected >= min && connected < max) return 'Good';
390
+ if (connected === max) return 'Excellent';
391
+ return 'Unknown';
392
+ };
393
+
394
+ const getNetworkHealthClass = () => {
395
+ const health = getNetworkHealth();
396
+ return {
397
+ 'health-isolated': health === 'Isolated',
398
+ 'health-poor': health === 'Poor',
399
+ 'health-good': health === 'Good',
400
+ 'health-excellent': health === 'Excellent'
401
+ };
402
+ };
403
+
404
+ const getEnvironmentInfo = () => {
405
+ if (store.mesh && store.mesh.getEnvironmentReport) {
406
+ const report = store.mesh.getEnvironmentReport();
407
+ return `${report.environment} (WebRTC: ${report.webrtcSupported ? 'Yes' : 'No'})`;
408
+ }
409
+ return 'Browser (WebRTC: Yes)';
410
+ };
411
+
412
+ const updateUptime = () => {
413
+ if (connectionStartTime.value && isConnected.value) {
414
+ const now = new Date();
415
+ const diff = now - connectionStartTime.value;
416
+ const hours = Math.floor(diff / 3600000);
417
+ const minutes = Math.floor((diff % 3600000) / 60000);
418
+ const seconds = Math.floor((diff % 60000) / 1000);
419
+
420
+ connectionUptime.value = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
421
+ } else {
422
+ connectionUptime.value = '00:00:00';
423
+ }
424
+ };
425
+
426
+ // Watch for connection changes
427
+ const unwatchConnection = computed(() => isConnected.value, (connected) => {
428
+ if (connected) {
429
+ connectionStartTime.value = new Date();
430
+ } else {
431
+ connectionStartTime.value = null;
432
+ }
433
+ });
434
+
435
+ onMounted(() => {
436
+ // Initialize local state from store
437
+ maxPeers.value = networkStatus.value.maxPeers;
438
+ minPeers.value = networkStatus.value.minPeers;
439
+
440
+ // Start uptime counter
441
+ uptimeInterval.value = setInterval(updateUptime, 1000);
442
+ });
443
+
444
+ onUnmounted(() => {
445
+ if (uptimeInterval.value) {
446
+ clearInterval(uptimeInterval.value);
447
+ }
448
+ });
449
+ </script>
450
+
451
+ <style scoped>
452
+ .network-view {
453
+ max-width: 1000px;
454
+ margin: 0 auto;
455
+ }
456
+
457
+ .section-header {
458
+ text-align: center;
459
+ margin-bottom: 30px;
460
+ }
461
+
462
+ .section-header h2 {
463
+ font-size: 28px;
464
+ color: #333;
465
+ margin-bottom: 8px;
466
+ }
467
+
468
+ .section-header p {
469
+ color: #666;
470
+ font-size: 16px;
471
+ }
472
+
473
+ .status-grid {
474
+ display: grid;
475
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
476
+ gap: 20px;
477
+ margin-bottom: 40px;
478
+ }
479
+
480
+ .status-card {
481
+ background: white;
482
+ border-radius: 12px;
483
+ padding: 24px;
484
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
485
+ display: flex;
486
+ align-items: center;
487
+ gap: 16px;
488
+ }
489
+
490
+ .status-card-icon {
491
+ font-size: 32px;
492
+ opacity: 0.8;
493
+ }
494
+
495
+ .status-card-content h3 {
496
+ font-size: 14px;
497
+ color: #666;
498
+ margin: 0 0 8px 0;
499
+ text-transform: uppercase;
500
+ letter-spacing: 0.5px;
501
+ }
502
+
503
+ .status-value {
504
+ font-size: 24px;
505
+ font-weight: 600;
506
+ color: #333;
507
+ margin-bottom: 4px;
508
+ }
509
+
510
+ .status-meta {
511
+ font-size: 12px;
512
+ color: #999;
513
+ }
514
+
515
+ .config-section {
516
+ background: white;
517
+ border-radius: 12px;
518
+ padding: 24px;
519
+ margin-bottom: 30px;
520
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
521
+ }
522
+
523
+ .config-section h3 {
524
+ margin: 0 0 20px 0;
525
+ color: #333;
526
+ }
527
+
528
+ .config-grid {
529
+ display: grid;
530
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
531
+ gap: 20px;
532
+ }
533
+
534
+ .config-item {
535
+ display: flex;
536
+ flex-direction: column;
537
+ gap: 8px;
538
+ }
539
+
540
+ .config-item label {
541
+ font-size: 14px;
542
+ font-weight: 500;
543
+ color: #666;
544
+ }
545
+
546
+ .config-input {
547
+ padding: 8px 12px;
548
+ border: 1px solid #ddd;
549
+ border-radius: 6px;
550
+ font-size: 14px;
551
+ }
552
+
553
+ .toggle-btn {
554
+ padding: 8px 16px;
555
+ border: 1px solid #ddd;
556
+ border-radius: 6px;
557
+ background: white;
558
+ color: #666;
559
+ font-size: 14px;
560
+ cursor: pointer;
561
+ transition: all 0.2s;
562
+ }
563
+
564
+ .toggle-btn.active {
565
+ background: #3b82f6;
566
+ color: white;
567
+ border-color: #3b82f6;
568
+ }
569
+
570
+ .peers-section {
571
+ background: white;
572
+ border-radius: 12px;
573
+ padding: 24px;
574
+ margin-bottom: 30px;
575
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
576
+ }
577
+
578
+ .section-title {
579
+ display: flex;
580
+ justify-content: space-between;
581
+ align-items: center;
582
+ margin-bottom: 20px;
583
+ }
584
+
585
+ .section-title h3 {
586
+ margin: 0;
587
+ color: #333;
588
+ }
589
+
590
+ .peers-list {
591
+ display: grid;
592
+ gap: 16px;
593
+ }
594
+
595
+ .empty-state {
596
+ text-align: center;
597
+ padding: 40px 20px;
598
+ color: #666;
599
+ }
600
+
601
+ .empty-icon {
602
+ font-size: 48px;
603
+ margin-bottom: 16px;
604
+ }
605
+
606
+ .empty-meta {
607
+ font-size: 14px;
608
+ color: #999;
609
+ }
610
+
611
+ .peer-card {
612
+ border: 1px solid #eee;
613
+ border-radius: 8px;
614
+ padding: 16px;
615
+ background: #fafafa;
616
+ }
617
+
618
+ .peer-card.discovered {
619
+ border-color: #3b82f6;
620
+ background: rgba(59, 130, 246, 0.05);
621
+ }
622
+
623
+ .peer-header {
624
+ display: flex;
625
+ justify-content: space-between;
626
+ align-items: center;
627
+ margin-bottom: 12px;
628
+ }
629
+
630
+ .peer-id {
631
+ display: flex;
632
+ align-items: center;
633
+ gap: 8px;
634
+ font-family: monospace;
635
+ font-size: 14px;
636
+ color: #333;
637
+ }
638
+
639
+ .peer-icon {
640
+ font-size: 16px;
641
+ }
642
+
643
+ .peer-status {
644
+ padding: 4px 8px;
645
+ border-radius: 4px;
646
+ font-size: 12px;
647
+ font-weight: 500;
648
+ text-transform: uppercase;
649
+ }
650
+
651
+ .peer-status.connected {
652
+ background: #22c55e;
653
+ color: white;
654
+ }
655
+
656
+ .peer-status.disconnected {
657
+ background: #ef4444;
658
+ color: white;
659
+ }
660
+
661
+ .peer-status.discovered {
662
+ background: #3b82f6;
663
+ color: white;
664
+ }
665
+
666
+ .peer-details {
667
+ display: grid;
668
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
669
+ gap: 8px;
670
+ margin-bottom: 12px;
671
+ }
672
+
673
+ .peer-detail {
674
+ font-size: 13px;
675
+ color: #666;
676
+ }
677
+
678
+ .peer-actions {
679
+ display: flex;
680
+ gap: 8px;
681
+ }
682
+
683
+ .btn {
684
+ padding: 6px 12px;
685
+ border: none;
686
+ border-radius: 4px;
687
+ font-size: 12px;
688
+ font-weight: 500;
689
+ cursor: pointer;
690
+ transition: all 0.2s;
691
+ }
692
+
693
+ .btn:disabled {
694
+ opacity: 0.5;
695
+ cursor: not-allowed;
696
+ }
697
+
698
+ .btn-sm {
699
+ padding: 4px 8px;
700
+ font-size: 11px;
701
+ }
702
+
703
+ .btn-primary {
704
+ background: #3b82f6;
705
+ color: white;
706
+ }
707
+
708
+ .btn-primary:hover:not(:disabled) {
709
+ background: #2563eb;
710
+ }
711
+
712
+ .btn-secondary {
713
+ background: #6b7280;
714
+ color: white;
715
+ }
716
+
717
+ .btn-secondary:hover:not(:disabled) {
718
+ background: #4b5563;
719
+ }
720
+
721
+ .btn-danger {
722
+ background: #ef4444;
723
+ color: white;
724
+ }
725
+
726
+ .btn-danger:hover:not(:disabled) {
727
+ background: #dc2626;
728
+ }
729
+
730
+ .stats-section {
731
+ background: white;
732
+ border-radius: 12px;
733
+ padding: 24px;
734
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
735
+ }
736
+
737
+ .stats-section h3 {
738
+ margin: 0 0 20px 0;
739
+ color: #333;
740
+ }
741
+
742
+ .stats-grid {
743
+ display: grid;
744
+ gap: 16px;
745
+ }
746
+
747
+ .stat-item {
748
+ display: flex;
749
+ justify-content: space-between;
750
+ align-items: center;
751
+ padding: 12px 0;
752
+ border-bottom: 1px solid #eee;
753
+ }
754
+
755
+ .stat-item:last-child {
756
+ border-bottom: none;
757
+ }
758
+
759
+ .stat-item code {
760
+ background: #f5f5f5;
761
+ padding: 4px 8px;
762
+ border-radius: 4px;
763
+ font-size: 12px;
764
+ word-break: break-all;
765
+ }
766
+
767
+ .health-isolated {
768
+ color: #ef4444;
769
+ font-weight: 600;
770
+ }
771
+
772
+ .health-poor {
773
+ color: #f59e0b;
774
+ font-weight: 600;
775
+ }
776
+
777
+ .health-good {
778
+ color: #3b82f6;
779
+ font-weight: 600;
780
+ }
781
+
782
+ .health-excellent {
783
+ color: #22c55e;
784
+ font-weight: 600;
785
+ }
786
+
787
+ /* Network Namespace Styles */
788
+ .namespace-section {
789
+ background: #f8fafc;
790
+ border: 1px solid #e2e8f0;
791
+ border-radius: 8px;
792
+ padding: 20px;
793
+ margin-bottom: 24px;
794
+ }
795
+
796
+ .namespace-section h3 {
797
+ margin: 0 0 16px 0;
798
+ color: #1e293b;
799
+ font-size: 18px;
800
+ font-weight: 600;
801
+ }
802
+
803
+ .namespace-info {
804
+ display: grid;
805
+ grid-template-columns: auto 1fr;
806
+ gap: 20px;
807
+ align-items: start;
808
+ }
809
+
810
+ .current-network {
811
+ min-width: 200px;
812
+ }
813
+
814
+ .network-badge {
815
+ display: flex;
816
+ align-items: center;
817
+ gap: 8px;
818
+ margin-bottom: 8px;
819
+ }
820
+
821
+ .network-name {
822
+ background: #3b82f6;
823
+ color: white;
824
+ padding: 6px 12px;
825
+ border-radius: 6px;
826
+ font-weight: 600;
827
+ font-size: 14px;
828
+ }
829
+
830
+ .fallback-indicator {
831
+ background: #f59e0b;
832
+ color: white;
833
+ padding: 4px 8px;
834
+ border-radius: 4px;
835
+ font-size: 12px;
836
+ font-weight: 600;
837
+ }
838
+
839
+ .original-network {
840
+ color: #64748b;
841
+ font-size: 13px;
842
+ }
843
+
844
+ .namespace-controls {
845
+ display: flex;
846
+ flex-direction: column;
847
+ gap: 16px;
848
+ }
849
+
850
+ .network-switch {
851
+ display: flex;
852
+ gap: 8px;
853
+ align-items: center;
854
+ }
855
+
856
+ .network-input {
857
+ flex: 1;
858
+ max-width: 300px;
859
+ padding: 8px 12px;
860
+ border: 1px solid #d1d5db;
861
+ border-radius: 6px;
862
+ font-size: 14px;
863
+ }
864
+
865
+ .network-input:disabled {
866
+ background-color: #f3f4f6;
867
+ opacity: 0.6;
868
+ }
869
+
870
+ .quick-networks {
871
+ display: flex;
872
+ gap: 6px;
873
+ flex-wrap: wrap;
874
+ }
875
+
876
+ .fallback-setting {
877
+ display: flex;
878
+ align-items: center;
879
+ }
880
+
881
+ .checkbox-label {
882
+ display: flex;
883
+ align-items: center;
884
+ gap: 8px;
885
+ cursor: pointer;
886
+ font-size: 14px;
887
+ color: #374151;
888
+ }
889
+
890
+ .checkbox-label input[type="checkbox"] {
891
+ margin: 0;
892
+ }
893
+
894
+ .btn-xs {
895
+ padding: 4px 8px;
896
+ font-size: 12px;
897
+ }
898
+
899
+ .btn-outline {
900
+ background: transparent;
901
+ border: 1px solid #d1d5db;
902
+ color: #374151;
903
+ }
904
+
905
+ .btn-outline:hover:not(:disabled) {
906
+ background: #f3f4f6;
907
+ }
908
+
909
+ .btn-outline.active {
910
+ background: #3b82f6;
911
+ border-color: #3b82f6;
912
+ color: white;
913
+ }
914
+
915
+ @media (max-width: 768px) {
916
+ .namespace-info {
917
+ grid-template-columns: 1fr;
918
+ gap: 16px;
919
+ }
920
+
921
+ .network-switch {
922
+ flex-direction: column;
923
+ align-items: stretch;
924
+ }
925
+
926
+ .network-input {
927
+ max-width: none;
928
+ }
929
+ }
930
+ </style>