import { RationalTime } from "@techsquidtv/canvas-timeline-utils"; import { TimelineCommandResult, TimelineKeyframe, TimelineKeyframeClipboard, TimelineKeyframeEditCommand, TimelineKeyframeMutationOptions, TimelineKeyframePropertyId, TimelineKeyframeReference, TimelineSetClipKeyframeOptions, TimelineUpdateClipKeyframeOptions } from "@techsquidtv/canvas-timeline-core"; //#region src/hooks/keyframes/useTimelineKeyframes.d.ts /** * Options accepted by `useTimelineKeyframes`. * * @remarks * * Use these options to scope keyframe reads to one clip, one property, selected * clips. Use useTimelineKeyframeGeometry for live viewport-space reads. * * @see {@link useTimelineKeyframeDrag} * @see {@link https://canvastimeline.com/docs/keyframes | Keyframes} */ interface UseTimelineKeyframesOptions { /** Optional property filter. */ property?: TimelineKeyframePropertyId; /** Restrict state to selected clips. */ selectedClipOnly?: boolean; /** Optional clip id used to scope keyframe lists and commands. */ clipId?: string; } /** * Result returned by `useTimelineKeyframes`. * * @remarks * * The result combines settled keyframe lists, selection, and mutation commands. * Use it for keyframe inspectors, * property editors, and toolbar actions. For pointer-driven dragging, combine * it with {@link useTimelineKeyframeDrag}; for Bezier easing handles, combine * it with {@link useTimelineKeyframeTangentDrag}. * * * @see {@link useTimelineKeyframeTangentDrag} * @see {@link https://canvastimeline.com/docs/keyframes | Keyframes} */ interface UseTimelineKeyframesResult { /** Settled keyframes matching the clip, property, and selection filters. */ keyframes: TimelineKeyframe[]; /** Evaluates a keyframed property at a timeline time. */ getPropertyValueAtTime: (clipId: string, property: TimelineKeyframePropertyId, time?: RationalTime) => number | undefined; /** Adds or updates one keyframe by clip, property, and exact timeline time. */ setKeyframe: (input: TimelineSetClipKeyframeOptions, options?: TimelineKeyframeMutationOptions) => TimelineCommandResult; /** Updates one existing keyframe. */ updateKeyframe: (input: TimelineUpdateClipKeyframeOptions, options?: TimelineKeyframeMutationOptions) => TimelineCommandResult; /** Removes one keyframe from a clip. */ removeKeyframe: (clipId: string, keyframeId: string, options?: TimelineKeyframeMutationOptions) => TimelineCommandResult; /** Selects keys without subscribing to live geometry. */ selectKeyframes: (references: readonly TimelineKeyframeReference[], mode?: 'replace' | 'add' | 'toggle') => TimelineCommandResult; /** Selected keys across all clips. */ selectedKeyframes: TimelineKeyframeReference[]; /** Copies the current selection independently of clip copy/paste. */ copyKeyframes: () => TimelineKeyframeClipboard; /** Creates a paste command with preserved relative timing. */ createPasteCommand: (clipboard: TimelineKeyframeClipboard, time: RationalTime, clipId?: string) => TimelineKeyframeEditCommand; /** Clears keyframe selection. */ clearKeyframeSelection: () => TimelineCommandResult; } /** * Reads settled keyframe state and exposes canonical keyframe commands. * * @remarks * * `useTimelineKeyframes` is the main keyframe-domain hook. It reads settled keyframe state. Use useTimelineKeyframeGeometry for live overlays. Mutation commands return * {@link TimelineCommandResult} values and respect locked tracks. * * @param options - Optional clip, property, and selected-clip filters. * @returns Settled keyframe lists, selection, property evaluation, and mutation commands. * * @example * ```tsx * import { fromSeconds } from '@techsquidtv/canvas-timeline-utils'; * import { useTimelineKeyframes } from '@techsquidtv/canvas-timeline-react'; * * export function OpacityKeyframeButton({ clipId }: { clipId: string }) { * const keyframes = useTimelineKeyframes({ clipId, property: 'opacity' }); * * return ( * * ); * } * ``` * * @see {@link useTimelineKeyframeDrag} * @see {@link useTimelineKeyframeTangentDrag} * @see {@link https://canvastimeline.com/demos/keyframe-opacity | Keyframe opacity demo} */ declare function useTimelineKeyframes(options?: UseTimelineKeyframesOptions): UseTimelineKeyframesResult; //#endregion export { UseTimelineKeyframesOptions, UseTimelineKeyframesResult, useTimelineKeyframes }; //# sourceMappingURL=useTimelineKeyframes.d.mts.map