source dump of claude code
at main 38 lines 1.3 kB view raw
1import { Event } from './event.js' 2 3/** 4 * Mouse click event. Fired on left-button release without drag, only when 5 * mouse tracking is enabled (i.e. inside <AlternateScreen>). 6 * 7 * Bubbles from the deepest hit node up through parentNode. Call 8 * stopImmediatePropagation() to prevent ancestors' onClick from firing. 9 */ 10export class ClickEvent extends Event { 11 /** 0-indexed screen column of the click */ 12 readonly col: number 13 /** 0-indexed screen row of the click */ 14 readonly row: number 15 /** 16 * Click column relative to the current handler's Box (col - box.x). 17 * Recomputed by dispatchClick before each handler fires, so an onClick 18 * on a container sees coords relative to that container, not to any 19 * child the click landed on. 20 */ 21 localCol = 0 22 /** Click row relative to the current handler's Box (row - box.y). */ 23 localRow = 0 24 /** 25 * True if the clicked cell has no visible content (unwritten in the 26 * screen buffer — both packed words are 0). Handlers can check this to 27 * ignore clicks on blank space to the right of text, so accidental 28 * clicks on empty terminal space don't toggle state. 29 */ 30 readonly cellIsBlank: boolean 31 32 constructor(col: number, row: number, cellIsBlank: boolean) { 33 super() 34 this.col = col 35 this.row = row 36 this.cellIsBlank = cellIsBlank 37 } 38}