UNPKG

js-streaming

Version:

Unified streaming client for WebSocket, SSE, HTTP streaming, long-polling, HLS, and WebRTC.

729 lines (632 loc) 13.1 kB
:root { --primary: #6366f1; --primary-dark: #4f46e5; --secondary: #ec4899; --accent: #06b6d4; --success: #10b981; --warning: #f59e0b; --error: #ef4444; --bg-primary: #0a0a0a; --bg-secondary: #1a1a1a; --bg-tertiary: #2a2a2a; --text-primary: #ffffff; --text-secondary: #a3a3a3; --text-muted: #666666; --border: rgba(255, 255, 255, 0.1); --glass: rgba(255, 255, 255, 0.05); --glass-border: rgba(255, 255, 255, 0.1); } * { margin: 0; padding: 0; box-sizing: border-box; } html { scroll-behavior: smooth; } body { font-family: "Inter", sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; overflow-x: hidden; } /* Gradient Background */ .bg-gradient { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient( circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50% ), radial-gradient( circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 50% ), radial-gradient( circle at 40% 40%, rgba(120, 219, 255, 0.1) 0%, transparent 50% ); z-index: -2; } /* Animated particles */ .particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; } .particle { position: absolute; background: var(--primary); border-radius: 50%; pointer-events: none; animation: float 6s ease-in-out infinite; } @keyframes float { 0%, 100% { transform: translateY(0px) rotate(0deg); } 50% { transform: translateY(-20px) rotate(180deg); } } /* Navigation */ .navbar { position: fixed; top: 0; width: 100%; padding: 1rem 2rem; background: rgba(10, 10, 10, 0.8); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); z-index: 1000; transition: all 0.3s ease; } .navbar.scrolled { background: rgba(10, 10, 10, 0.95); padding: 0.75rem 2rem; } .nav-container { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; } .logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 0.5rem; } .logo::before { content: "⚡"; font-size: 1.8rem; } .nav-links { display: flex; gap: 2rem; list-style: none; } .nav-links a { color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: color 0.3s ease; position: relative; } .nav-links a:hover { color: var(--text-primary); } .nav-links a::after { content: ""; position: absolute; bottom: -5px; left: 0; width: 0; height: 2px; background: var(--primary); transition: width 0.3s ease; } .nav-links a:hover::after { width: 100%; } /* Container */ .container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; } /* Hero Section */ .hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 6rem 0 4rem; } .hero-content { max-width: 800px; } .hero-badge { display: inline-block; background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(10px); padding: 0.75rem 1.5rem; border-radius: 50px; font-size: 0.875rem; margin-bottom: 2rem; color: var(--text-secondary); } .hero h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 800; margin-bottom: 1.5rem; background: linear-gradient( 135deg, var(--text-primary) 0%, var(--primary) 100% ); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; } .hero p { font-size: clamp(1.125rem, 2vw, 1.25rem); color: var(--text-secondary); margin-bottom: 2.5rem; line-height: 1.7; } .hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; } .btn { padding: 0.875rem 1.75rem; border-radius: 50px; font-weight: 600; text-decoration: none; transition: all 0.3s ease; border: none; cursor: pointer; font-size: 1rem; } .btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3); } .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 15px 35px rgba(99, 102, 241, 0.4); } .btn-secondary { background: var(--glass); color: var(--text-primary); border: 1px solid var(--glass-border); backdrop-filter: blur(10px); } .btn-secondary:hover { background: var(--bg-tertiary); transform: translateY(-2px); } /* Stats */ .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-top: 4rem; } .stat-card { text-align: center; padding: 1.5rem; background: var(--glass); border: 1px solid var(--glass-border); border-radius: 1rem; backdrop-filter: blur(10px); } .stat-number { font-size: 2.5rem; font-weight: 800; color: var(--primary); display: block; } .stat-label { color: var(--text-secondary); font-size: 0.875rem; margin-top: 0.5rem; } /* Protocols Section */ .protocols { padding: 6rem 0; background: linear-gradient( 135deg, var(--bg-secondary) 0%, var(--bg-primary) 100% ); } .section-header { text-align: center; margin-bottom: 4rem; } .section-title { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; margin-bottom: 1rem; } .section-subtitle { font-size: 1.125rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; } .protocols-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; } .protocol-card { background: var(--glass); border: 1px solid var(--glass-border); border-radius: 1.5rem; padding: 2rem; backdrop-filter: blur(10px); transition: all 0.3s ease; cursor: pointer; position: relative; overflow: hidden; } .protocol-card::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: linear-gradient(90deg, var(--primary), var(--secondary)); } .protocol-card:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3); border-color: rgba(255, 255, 255, 0.2); } .protocol-icon { width: 60px; height: 60px; border-radius: 1rem; display: flex; align-items: center; justify-content: center; font-size: 2rem; margin-bottom: 1.5rem; background: var(--bg-tertiary); } .protocol-card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-primary); } .protocol-card p { color: var(--text-secondary); margin-bottom: 1.5rem; } .protocol-features { list-style: none; } .protocol-features li { color: var(--text-secondary); padding: 0.25rem 0; display: flex; align-items: center; gap: 0.5rem; } .protocol-features li::before { content: "✓"; color: var(--success); font-weight: bold; } /* Demo Section */ .demo { padding: 6rem 0; background: var(--bg-primary); } .demo-container { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 2rem; padding: 3rem; box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2); } .demo-tabs { display: flex; gap: 0.5rem; margin-bottom: 2rem; background: var(--bg-tertiary); border-radius: 1rem; padding: 0.5rem; overflow-x: auto; } .demo-tab { padding: 0.75rem 1.5rem; border-radius: 0.75rem; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; transition: all 0.3s ease; white-space: nowrap; } .demo-tab.active { background: var(--primary); color: white; } .demo-content { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; } .demo-panel { background: var(--bg-tertiary); border-radius: 1rem; padding: 1.5rem; border: 1px solid var(--border); } .demo-panel h4 { margin-bottom: 1.5rem; font-size: 1.125rem; font-weight: 600; } .form-group { margin-bottom: 1rem; } .form-label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); } .form-control { width: 100%; padding: 0.75rem; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 0.5rem; color: var(--text-primary); font-size: 0.875rem; } .form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); } .status-indicator { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; padding: 0.75rem; background: var(--bg-primary); border-radius: 0.5rem; border: 1px solid var(--border); } .status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--text-muted); } .status-dot.connected { background: var(--success); animation: pulse 2s infinite; } .status-dot.connecting { background: var(--warning); animation: pulse 1s infinite; } .status-dot.error { background: var(--error); } @keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } } .logs { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 0.5rem; padding: 1rem; height: 300px; overflow-y: auto; font-family: "Courier New", monospace; font-size: 0.8rem; line-height: 1.4; } .log-entry { margin-bottom: 0.5rem; padding: 0.25rem; } .log-entry.info { color: var(--accent); } .log-entry.success { color: var(--success); } .log-entry.error { color: var(--error); } .log-entry.warning { color: var(--warning); } .log-time { color: var(--text-muted); margin-right: 0.5rem; } /* Examples Section */ .examples { padding: 6rem 0; background: var(--bg-secondary); } .examples-nav { display: flex; gap: 0.5rem; margin-bottom: 2rem; justify-content: center; flex-wrap: wrap; } .example-tab { padding: 0.75rem 1.5rem; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 0.75rem; color: var(--text-secondary); text-decoration: none; transition: all 0.3s ease; cursor: pointer; } .example-tab.active, .example-tab:hover { background: var(--primary); color: white; border-color: var(--primary); } .example-container { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 1rem; overflow: hidden; } .example-header { padding: 1rem 1.5rem; background: var(--bg-primary); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; } .example-title { font-weight: 600; } .copy-btn { padding: 0.5rem 1rem; background: var(--accent); color: white; border: none; border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; transition: all 0.3s ease; } .copy-btn:hover { background: var(--primary); } .example-code { padding: 1.5rem; background: var(--bg-primary); overflow-x: auto; } .example-code pre { margin: 0; font-size: 0.875rem; line-height: 1.5; } /* Footer */ .footer { padding: 4rem 0 2rem; background: var(--bg-primary); border-top: 1px solid var(--border); } .footer-content { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; } .footer-section h4 { margin-bottom: 1rem; color: var(--text-primary); font-weight: 600; } .footer-links { list-style: none; } .footer-links li { margin-bottom: 0.5rem; } .footer-links a { color: var(--text-secondary); text-decoration: none; transition: color 0.3s ease; } .footer-links a:hover { color: var(--text-primary); } .footer-bottom { text-align: center; padding-top: 2rem; border-top: 1px solid var(--border); color: var(--text-muted); } /* Video Container */ .video-container { width: 100%; background: black; border-radius: 0.5rem; overflow: hidden; margin: 1rem 0; display: none; } .video-container.show { display: block; } .video-container video { width: 100%; height: auto; } /* Responsive */ @media (max-width: 768px) { .nav-links { display: none; } .hero-buttons { flex-direction: column; align-items: center; } .demo-content { grid-template-columns: 1fr; } .footer-content { grid-template-columns: 1fr; text-align: center; } .examples-nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; } }