Skip to content

armgit / fx0

Public Imported from GitHub
0

A lightweight design agent built with libfx. Describe a page and an agent writes it as one HTML file.

TypeScript
449 B
Raw Blame
import type { MouseEvent, PointerEvent } from 'react'

// Fires on pointer-down; keyboard clicks report detail 0 and still go through onClick.
export function fastClick(action: () => void) {
  return {
    onPointerDown: (event: PointerEvent) => {
      if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey) return
      action()
    },
    onClick: (event: MouseEvent) => {
      if (event.detail === 0) action()
    },
  }
}