diff --git a/docs/child.html b/docs/child.html index 9aef5eb..1a51cd6 100644 --- a/docs/child.html +++ b/docs/child.html @@ -1,56 +1,56 @@ - + iframe-flight child - + -
- - CONNECTING - +
+ + CONNECTING +
- + listening
-
+
⬜ CHILD_READY - + ⬜ PARENT_ACK - + ⬜ Ready
-
+
-
- ↑ Reverse channel: +
+ ↑ Reverse channel:
+ class="px-3 py-2 border-t border-zinc-200 font-mono text-[11px] text-zinc-400 max-h-14 overflow-auto shrink-0 whitespace-pre-wrap break-all bg-zinc-50"> No data received yet.
@@ -67,13 +67,13 @@ const q = id => document.getElementById(id); function log(msg, type) { - const panel = q('log'); - const row = document.createElement('div'); + const colors = { ok:'text-green-700', err:'text-red-600', info:'text-blue-700', recv:'text-purple-700', warn:'text-amber-700' }; + const row = document.createElement('div'); row.className = 'flex gap-2'; - const colors = { ok:'text-green-400', err:'text-red-400', info:'text-blue-400', recv:'text-purple-400', warn:'text-amber-400' }; row.innerHTML = - `${new Date().toISOString().slice(11,23)}` + - `${msg.replace(/&/g,'&').replace(//g,'>')}`; + `${new Date().toISOString().slice(11,23)}` + + `${String(msg).replace(/&/g,'&').replace(//g,'>')}`; + const panel = q('log'); panel.appendChild(row); panel.scrollTop = panel.scrollHeight; } @@ -82,41 +82,38 @@ try { window.parent.postMessage({ __iframeFlight:'log', msg, type, state, sourceId, meta }, '*'); } catch(_){} } -// Init q('source-id-chip').textContent = sourceId; const badge = q('mode-badge'); if (isFirst) { badge.textContent = 'FIRST_MESSAGE'; - badge.className += ' bg-amber-950/60 text-amber-400 border border-amber-900/50'; + badge.className += ' bg-amber-50 text-amber-700 border border-amber-200'; } else { badge.textContent = 'CONTINUOUS' + (delay ? ` ${delay}ms` : ''); - badge.className += ' bg-green-950/60 text-green-400 border border-green-900/50'; + badge.className += ' bg-green-50 text-green-700 border border-green-200'; } function setDot(s) { const cfg = { - READY: { bg:'bg-green-500', glow:'0 0 5px #22c55e', anim:false }, - RECEIVING: { bg:'bg-purple-500', glow:'0 0 5px #a855f7', anim:false }, - ERROR: { bg:'bg-red-500', glow:'none', anim:false }, - CLOSED: { bg:'bg-zinc-600', glow:'none', anim:false }, - }[s] || { bg:'bg-yellow-400', glow:'none', anim:true }; + READY: { bg:'#22c55e', anim:false }, + RECEIVING: { bg:'#a855f7', anim:false }, + ERROR: { bg:'#ef4444', anim:false }, + CLOSED: { bg:'#d4d4d8', anim:false }, + }[s] || { bg:'#fbbf24', anim:true }; const el = q('dot'); - el.className = `w-2 h-2 rounded-full shrink-0 ${cfg.bg}${cfg.anim ? ' blink' : ''}`; - el.style.boxShadow = cfg.glow; + el.style.background = cfg.bg; + el.className = `w-2 h-2 rounded-full shrink-0${cfg.anim ? ' animate-pulse' : ''}`; q('state-txt').textContent = s; } function setListenActive(active) { - const d = q('listen-dot'); - d.style.background = active ? '#22c55e' : '#52525b'; - d.style.boxShadow = active ? '0 0 4px #22c55e' : 'none'; - q('listen-label').textContent = active ? 'listening' : 'paused'; + q('listen-dot').style.background = active ? '#22c55e' : '#d4d4d8'; + q('listen-label').textContent = active ? 'listening' : 'paused'; } function hsStep(id) { const el = q(id); el.textContent = el.textContent.replace('⬜','✅'); - el.className = 'text-green-500'; + el.className = 'text-green-700'; } const receiver = new ArrowChildReceiver({ listenMode, listenDelay: delay, allowedOrigins: ['*'], sourceId }); @@ -148,24 +145,22 @@ processingTime: result.processingTime, isZeroCopy: result.isZeroCopy, schema: result.schema || null, receivedAt: Date.now(), receiver: sourceId, }); - const preview = q('preview'); - preview.className = preview.className.replace('text-zinc-600','text-purple-400'); + preview.className = preview.className.replace('text-zinc-400','text-purple-700'); if (result.data !== undefined) { preview.textContent = JSON.stringify(result.data, null, 2).slice(0, 300); } else if (result.table) { const t = result.table; - const lines = [`Arrow: ${result.rows} × ${result.cols} zeroCopy=${result.isZeroCopy}`]; + const lines = [`Arrow: ${result.rows}×${result.cols} zeroCopy=${result.isZeroCopy}`]; for (let r = 0; r < Math.min(result.rows, 3); r++) { const obj = {}; for (let c = 0; c < t.schema.fields.length; c++) obj[t.schema.fields[c].name] = t.getChildAt(c).get(r); lines.push(' ' + JSON.stringify(obj)); } - if (result.rows > 3) lines.push(` … (${result.rows - 3} more)`); + if (result.rows > 3) lines.push(` … (${result.rows-3} more)`); preview.textContent = lines.join('\n'); } - if (isFirst) { setListenActive(false); log('⏸ Paused after FIRST_MESSAGE', 'warn'); @@ -178,11 +173,11 @@ }); q('btn-reply').addEventListener('click', () => { - const msgId = 'reply-' + Date.now(); + const msgId = 'reply-' + Date.now(); const payload = { __iframeFlight:'child-reply', sourceId, messageId:msgId, timestamp:Date.now(), data:{ text:`Hello from ${sourceId}`, ts:Date.now() } }; window.parent.postMessage(payload, '*'); log('↑ Sent reply to parent', 'ok'); - relay('↑ Reply sent to parent', 'ok', receiver.getState(), { messageId:msgId, timestamp:payload.timestamp, source:sourceId, target:'parent' }); + relay('↑ Reply sent', 'ok', receiver.getState(), { messageId:msgId, timestamp:payload.timestamp, source:sourceId, target:'parent' }); }); window.addEventListener('message', (e) => { @@ -198,7 +193,7 @@ log(`📨 Relayed from ${from}: ${JSON.stringify(e.data.payload).slice(0,80)}`, 'recv'); relay(`📨 Relayed from ${from}`, 'recv', receiver.getState(), { relayedFrom:from, payload:e.data.payload }); const preview = q('preview'); - preview.className = preview.className.replace('text-zinc-600','text-purple-400'); + preview.className = preview.className.replace('text-zinc-400','text-purple-700'); preview.textContent = `RELAY from ${from}:\n${JSON.stringify(e.data.payload, null, 2).slice(0, 250)}`; } }); diff --git a/docs/index.html b/docs/index.html index 835b585..5013ca0 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,584 +1,462 @@ - + iframe-flight — live demo - -
+ +
-

✈ iframe-flight

- v0.1.0 +

✈ iframe-flight

+ v0.1.0

Zero-copy iframe data transport — Apache Arrow bundled, no setup required

- -
- Live demo
-
+ + -
- - -
- - -
- - Parent - window - CONNECTING -
- - -
- ⬜ CHILD_READY - - ⬜ PARENT_ACK - - ⬜ Ready -
- - -
-
-
0
-
Sent
+
+ + +
+ + +
+
+ + Parent + window + CONNECTING
-
-
0
-
ACKed
-
-
-
-
RTT ms
-
-
- -
- Target: -
- - - +
+ ⬜ CHILD_READY + + ⬜ PARENT_ACK + + ⬜ Ready
- -
- - -
- - - - - -
- - -
Checking SharedArrayBuffer…
- - -
-
- - -
-
- - Child iframe - child-alpha - CONNECTING -
-
- Mode: -
- - +
+
+
0
+
Sent
+
+
+
0
+
ACKed
+
+
+
+
RTT ms
+
- -
- -
-
- -
-
- - -
-
- - Child iframe - child-beta - CONNECTING -
- -
- Mode: -
- - + +
+ Target: +
+ + + +
+
- -
-
+ +
+ + + + + +
-
- +
Checking SharedArrayBuffer…
+
-
- -
- -
-
- - Message inspector -
-
-

No messages yet. Send data or click Reply in a child iframe.

-