{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "feedback-haptics",
  "title": "Feedback haptics",
  "description": "Vibration patterns for tap, tick, success, warning and error.",
  "files": [
    {
      "path": "lib/feedback-haptics.ts",
      "content": "export type FeedbackHaptic = \"tap\" | \"tick\" | \"success\" | \"warning\" | \"error\";\n\n/**\n * Vibration patterns in ms, alternating vibrate / pause. Starting points,\n * not research values — phone motors differ a lot, so tune on devices.\n */\nexport const HAPTIC_PATTERNS: Record<FeedbackHaptic, number[]> = {\n  tick: [8],\n  tap: [15],\n  success: [15, 80, 25],\n  warning: [30, 120, 30],\n  error: [40, 60, 40, 60, 40],\n};\n\nexport function canVibrate() {\n  return typeof navigator !== \"undefined\" && \"vibrate\" in navigator;\n}\n\n/**\n * Must be called from a user gesture (Chrome ignores it otherwise).\n * Returns whether the browser accepted the request — Firefox for Android\n * returns `true` without vibrating, so `true` is not proof of a buzz.\n */\nexport function playFeedbackHaptic(haptic: FeedbackHaptic) {\n  if (!canVibrate()) return false;\n  return navigator.vibrate(HAPTIC_PATTERNS[haptic]);\n}\n",
      "type": "registry:lib"
    }
  ],
  "type": "registry:lib"
}