{"version":3,"file":"useTimeline.mjs","names":[],"sources":["../../../src/hooks/core/useTimeline.ts"],"sourcesContent":["import { useTimelineEngine } from '#react/hooks/core/useTimelineEngine';\nimport { useTimelineState } from '#react/hooks/core/useTimelineState';\nimport type { TimelineEngine, TimelineStateSnapshot } from '@techsquidtv/canvas-timeline-core';\n/**\n * Engine and synchronized state returned by {@link useTimeline}.\n */\nexport interface UseTimelineResult {\n  /** Shared engine instance that owns timeline state and commands. */\n  engine: TimelineEngine;\n  /** React-rendered snapshot of the current timeline state. */\n  state: TimelineStateSnapshot;\n}\n\n/**\n * Reads the timeline engine and synchronized state from React context.\n *\n * Use this hook inside components wrapped by `TimelineProvider` when you need to\n * call imperative engine commands and read the latest React-rendered state in\n * the same component. Prefer narrower hooks such as `useTimelineState`,\n * `useTimelinePlayback`, or `useTimelineClips` when a component only needs one\n * slice of timeline behavior.\n *\n * @returns Timeline context containing the shared `TimelineEngine` instance and\n * the synchronized `TimelineStateSnapshot` snapshot.\n *\n * @throws Error when called outside of `TimelineProvider`.\n *\n * @example\n * ```tsx\n * const { engine, state } = useTimeline();\n *\n * return (\n *   <button onClick={() => engine.updatePlayhead(state.playheadTime)}>\n *     Refresh playhead\n *   </button>\n * );\n * ```\n */\nexport function useTimeline(): UseTimelineResult {\n  return { engine: useTimelineEngine(), state: useTimelineState() };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,cAAiC;CAC/C,OAAO;EAAE,QAAQ,kBAAkB;EAAG,OAAO,iBAAiB;CAAE;AAClE"}