@shmulikdav/solix 1.3.0 → 1.4.1

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.
@@ -1 +1 @@
1
- import{a8 as n,r,j as s}from"./index-BB6Hys2b.js";const P=[1,4,16,64];function S({open:l,onClose:u}){const e=n(t=>t.playback),m=n(t=>t.enterPlayback),v=n(t=>t.exitPlayback),o=n(t=>t.setPlaybackTime),f=n(t=>t.setPlaybackSpeed),p=n(t=>t.setPlaybackPlaying),x=n(t=>t.setPlaybackLoading),[i,g]=r.useState(30);r.useEffect(()=>{if(!l||e.active&&e.events.length>0)return;x(!0);const t=Date.now()-i*60*1e3;fetch(`/api/timeline?sinceMs=${t}&untilMs=${Date.now()}`).then(a=>a.json()).then(a=>{if(a.events.length===0){x(!1),m([],Date.now()-6e4,Date.now());return}m(a.events,a.earliest,a.latest)}).catch(a=>{console.warn("[timeline] fetch failed",a),x(!1)})},[l,i]);const c=r.useRef(0);if(r.useEffect(()=>{if(!e.active||!e.playing)return;let t=0;const a=h=>{const N=c.current?h-c.current:16;c.current=h;const b=e.currentMs+N*e.speed;b>=e.latestMs?(o(e.latestMs),p(!1)):(o(b),t=requestAnimationFrame(a))};return t=requestAnimationFrame(a),()=>{cancelAnimationFrame(t),c.current=0}},[e.active,e.playing,e.speed,e.latestMs]),!l)return null;const j=()=>{v(),u()},y=Math.max(1,e.latestMs-e.earliestMs),k=e.active?(e.currentMs-e.earliestMs)/y*100:0,M=e.events.filter(t=>t.ts<=e.currentMs);return s.jsx("div",{className:"absolute bottom-0 inset-x-0 z-30 bg-solix-panel/95 backdrop-blur border-t border-solix-border",children:s.jsxs("div",{className:"px-4 py-3 max-w-6xl mx-auto",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"▸ Playback"}),s.jsxs("span",{className:"text-[10px] text-slate-400",children:[e.events.length," events · last ",i," min"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:i,onChange:t=>g(parseInt(t.target.value,10)),className:"text-[10px] bg-black/40 border border-solix-border rounded px-1.5 py-0.5 text-slate-300",children:[s.jsx("option",{value:5,children:"5 min"}),s.jsx("option",{value:15,children:"15 min"}),s.jsx("option",{value:30,children:"30 min"}),s.jsx("option",{value:60,children:"1 hour"}),s.jsx("option",{value:180,children:"3 hours"})]}),s.jsx("button",{onClick:j,className:"text-slate-400 hover:text-slate-100 text-xs",children:"✕ Live"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>p(!e.playing),disabled:!e.active||e.events.length===0,className:"w-8 h-8 rounded-full bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40 flex items-center justify-center",children:e.playing?"⏸":"▶"}),s.jsxs("div",{className:"flex-1 relative",children:[s.jsx("input",{type:"range",min:e.earliestMs,max:e.latestMs,value:e.currentMs,onChange:t=>o(parseInt(t.target.value,10)),className:"w-full",disabled:!e.active}),s.jsx("div",{className:"absolute -top-1.5 h-0.5 bg-solix-accent/40 pointer-events-none",style:{left:0,width:`${k}%`}})]}),s.jsx("div",{className:"flex items-center gap-1",children:P.map(t=>s.jsxs("button",{onClick:()=>f(t),className:`text-[10px] px-1.5 py-0.5 rounded border ${e.speed===t?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:[t,"×"]},t))})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between text-[10px] text-slate-500 font-mono",children:[s.jsx("span",{children:d(e.earliestMs)}),s.jsxs("span",{className:"text-solix-accent",children:[d(e.currentMs)," · ",M.length," events"]}),s.jsx("span",{children:d(e.latestMs)})]}),e.loading&&s.jsx("div",{className:"text-center text-xs text-slate-500 italic mt-2",children:"Loading timeline…"}),!e.loading&&e.events.length===0&&e.active&&s.jsx("div",{className:"text-center text-xs text-slate-500 italic mt-2",children:"No events in this range. Try a longer window or run some agents first."})]})})}function d(l){return l?new Date(l).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}):"—"}export{S as TimelineDrawer};
1
+ import{a9 as n,r,j as s}from"./index-CMDHR3gR.js";const P=[1,4,16,64];function S({open:l,onClose:u}){const e=n(t=>t.playback),m=n(t=>t.enterPlayback),v=n(t=>t.exitPlayback),o=n(t=>t.setPlaybackTime),f=n(t=>t.setPlaybackSpeed),p=n(t=>t.setPlaybackPlaying),x=n(t=>t.setPlaybackLoading),[i,g]=r.useState(30);r.useEffect(()=>{if(!l||e.active&&e.events.length>0)return;x(!0);const t=Date.now()-i*60*1e3;fetch(`/api/timeline?sinceMs=${t}&untilMs=${Date.now()}`).then(a=>a.json()).then(a=>{if(a.events.length===0){x(!1),m([],Date.now()-6e4,Date.now());return}m(a.events,a.earliest,a.latest)}).catch(a=>{console.warn("[timeline] fetch failed",a),x(!1)})},[l,i]);const c=r.useRef(0);if(r.useEffect(()=>{if(!e.active||!e.playing)return;let t=0;const a=h=>{const N=c.current?h-c.current:16;c.current=h;const b=e.currentMs+N*e.speed;b>=e.latestMs?(o(e.latestMs),p(!1)):(o(b),t=requestAnimationFrame(a))};return t=requestAnimationFrame(a),()=>{cancelAnimationFrame(t),c.current=0}},[e.active,e.playing,e.speed,e.latestMs]),!l)return null;const j=()=>{v(),u()},y=Math.max(1,e.latestMs-e.earliestMs),k=e.active?(e.currentMs-e.earliestMs)/y*100:0,M=e.events.filter(t=>t.ts<=e.currentMs);return s.jsx("div",{className:"absolute bottom-0 inset-x-0 z-30 bg-solix-panel/95 backdrop-blur border-t border-solix-border",children:s.jsxs("div",{className:"px-4 py-3 max-w-6xl mx-auto",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs uppercase tracking-widest text-solix-accent",children:"▸ Playback"}),s.jsxs("span",{className:"text-[10px] text-slate-400",children:[e.events.length," events · last ",i," min"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:i,onChange:t=>g(parseInt(t.target.value,10)),className:"text-[10px] bg-black/40 border border-solix-border rounded px-1.5 py-0.5 text-slate-300",children:[s.jsx("option",{value:5,children:"5 min"}),s.jsx("option",{value:15,children:"15 min"}),s.jsx("option",{value:30,children:"30 min"}),s.jsx("option",{value:60,children:"1 hour"}),s.jsx("option",{value:180,children:"3 hours"})]}),s.jsx("button",{onClick:j,className:"text-slate-400 hover:text-slate-100 text-xs",children:"✕ Live"})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>p(!e.playing),disabled:!e.active||e.events.length===0,className:"w-8 h-8 rounded-full bg-solix-accent/20 border border-solix-accent text-solix-accent text-sm hover:bg-solix-accent/30 disabled:opacity-40 flex items-center justify-center",children:e.playing?"⏸":"▶"}),s.jsxs("div",{className:"flex-1 relative",children:[s.jsx("input",{type:"range",min:e.earliestMs,max:e.latestMs,value:e.currentMs,onChange:t=>o(parseInt(t.target.value,10)),className:"w-full",disabled:!e.active}),s.jsx("div",{className:"absolute -top-1.5 h-0.5 bg-solix-accent/40 pointer-events-none",style:{left:0,width:`${k}%`}})]}),s.jsx("div",{className:"flex items-center gap-1",children:P.map(t=>s.jsxs("button",{onClick:()=>f(t),className:`text-[10px] px-1.5 py-0.5 rounded border ${e.speed===t?"bg-solix-accent/20 border-solix-accent text-solix-accent":"border-solix-border text-slate-400 hover:text-slate-200"}`,children:[t,"×"]},t))})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between text-[10px] text-slate-500 font-mono",children:[s.jsx("span",{children:d(e.earliestMs)}),s.jsxs("span",{className:"text-solix-accent",children:[d(e.currentMs)," · ",M.length," events"]}),s.jsx("span",{children:d(e.latestMs)})]}),e.loading&&s.jsx("div",{className:"text-center text-xs text-slate-500 italic mt-2",children:"Loading timeline…"}),!e.loading&&e.events.length===0&&e.active&&s.jsx("div",{className:"text-center text-xs text-slate-500 italic mt-2",children:"No events in this range. Try a longer window or run some agents first."})]})})}function d(l){return l?new Date(l).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}):"—"}export{S as TimelineDrawer};