Skip to content

gitflarePublicPartly agent-ready50

cf-durable-whiteboard

Realtime collaborative whiteboard on Cloudflare Durable Objects: presence cursors, WebSocket hibernation, SQLite storage, undo, PNG export.

Keep board zoom and pan stable across reloads6eb4fbd
JavaScript11 lines1.2 KB
const p = (d) => `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;export const ICONS = {  select: p('<path d="M5 3l14 8-6 2-2 6z"/>'), pen: p('<path d="M4 20l1-5L16 4l4 4L9 19z"/>'),  rect: p('<rect x="4" y="6" width="16" height="12" rx="1"/>'), ellipse: p('<ellipse cx="12" cy="12" rx="8" ry="6"/>'),  arrow: p('<path d="M5 19L19 5M9 5h10v10"/>'), note: p('<path d="M4 4h16v10l-6 6H4z"/><path d="M14 20v-6h6"/>'),  eraser: p('<path d="M8 20h12M5 15l9-9 5 5-6 6H8z"/>'), pan: p('<path d="M12 3v18M3 12h18M9 6l3-3 3 3M9 18l3 3 3-3M6 9l-3 3 3 3M18 9l3 3-3 3"/>'),  undo: p('<path d="M9 14L4 9l5-5"/><path d="M4 9h10a6 6 0 010 12h-3"/>'), redo: p('<path d="M15 14l5-5-5-5"/><path d="M20 9H10a6 6 0 000 12h3"/>'),  clear: p('<path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/>'), export: p('<path d="M12 3v12M7 10l5 5 5-5M4 20h16"/>'),};export const TOOLS = [["select", "Select / move (V)"], ["pen", "Pen (P)"], ["rect", "Rectangle (R)"], ["ellipse", "Ellipse (O)"], ["arrow", "Arrow (A)"], ["note", "Sticky note (N)"], ["eraser", "Eraser (E)"], ["pan", "Pan (H, or hold Space)"]];