import { Interpolation, Theme } from '@emotion/react'; import { Animation, AnimationContext, Animations, DisplayedAction } from '@gamepark/react-client'; import { GridBoundaries, ItemMove, MaterialGame, MaterialMove } from '@gamepark/rules-api'; import { ItemContext, MaterialContext } from '../../../locators'; import { GameContext } from '../../GameProvider'; import { MaterialSoundConfig } from '../sound'; import { AnimationBuilder, AnimationPredicate } from './AnimationBuilder'; import { ItemAnimations } from './ItemAnimations'; export type MaterialGameAnimationContext

= AnimationContext, MaterialMove, P> & Omit, MaterialMove, P, M, L, R, V>, 'game'>; export type MaterialAnimationContext

= MaterialContext & { action: DisplayedAction, P>; }; export declare class MaterialGameAnimations

extends Animations, MaterialMove, P> { /** @internal Animation configurations from the legacy .when() API */ readonly animationConfigs: AnimationConfig[]; /** @internal Animation builders from the new .configure() API */ readonly animationBuilders: AnimationBuilder[]; /** @internal Default animation configuration */ defaultAnimationConfig: AnimationConfig; /** @internal Default animation builder for new API */ private _defaultBuilder; /** * @deprecated Use configure() instead for the new trajectory API. * Create a new animation configuration with filter chain. */ when(): AnimationConfig; /** * Configure animations for moves matching a predicate. * @param predicate Function to determine if this configuration applies * @returns AnimationBuilder for fluent configuration * * @example * ```ts * animations.configure(and(isRule(RuleId.PlayCard), isMyMove())) * .duration(800) * .arc(15) * ``` */ configure(predicate: AnimationPredicate): AnimationBuilder; /** * Configure animations for moves during a specific rule. * @param ruleId The rule ID to match * @returns AnimationBuilder for fluent configuration * * @example * ```ts * animations.forRule(RuleId.PlayCard) * .duration(600) * .via(LocationType.TableCenter) * ``` */ forRule(ruleId: number): AnimationBuilder; /** * Configure animations for a specific item move type. * @param moveType The item move type to match (Create, Move, Delete, etc.) * @returns AnimationBuilder for fluent configuration * * @example * ```ts * animations.forMove(ItemMoveType.Move) * .duration(500) * .arc(12) * ``` */ forMove(moveType: ItemMove['type']): AnimationBuilder; /** * Configure animations for a specific material type. * @param materialType The material type to match * @returns AnimationBuilder for fluent configuration * * @example * ```ts * animations.forMaterial(MaterialType.Card) * .duration(400) * .flat() // No arc for cards * ``` */ forMaterial(materialType: M): AnimationBuilder; /** * Configure default animations (applies to all moves not matched by other configurations). * @returns AnimationBuilder for fluent configuration * * @example * ```ts * animations.defaults() * .duration(600) * .arc({ height: 8, peak: 0.4 }) * ``` */ defaults(): AnimationBuilder; getDuration(move: MaterialMove, context: MaterialGameAnimationContext): number; /** * Find matching animation builder from new API. * @internal */ getAnimationBuilder(move: MaterialMove, context: MaterialAnimationContext): AnimationBuilder | undefined; /** * Find matching animation config from legacy API. * @internal */ getAnimationConfig(move: MaterialMove, context: MaterialAnimationContext): AnimationConfig; /** * Sound the animation API configures for a move: a sound, `false` when the game explicitly silences the * move, or undefined when the animations say nothing and the material description should decide. * * Not expressed through {@link getAnimationBuilder}, on purpose. That method only hands back the default * builder when it carries a duration or a trajectory, because those are what change the way a move is * animated. A default builder carrying nothing but a sound — `animations.defaults().sound(false)`, the way * a game turns the library's default sounds off wholesale — would never be returned, and the switch would * silently do nothing. * * @internal */ getSoundConfig(move: MaterialMove, context: MaterialAnimationContext): string | MaterialSoundConfig | false | undefined; /** * Get item animation CSS, checking both new and legacy APIs. * @internal */ getItemAnimation(context: ItemContext, animation: Animation>, action: DisplayedAction, P>, boundaries: GridBoundaries): Interpolation; getSounds(): string[]; pauseNextConsequenceAnimation(move: MaterialMove, _context: AnimationContext, MaterialMove, P>): boolean; } /** * @deprecated Use AnimationBuilder with the new configure() API instead. * Legacy animation configuration class for backward compatibility. */ declare class AnimationConfig

extends ItemAnimations { filters: ((move: MaterialMove, context: MaterialAnimationContext) => boolean)[]; d?: number; s?: string | MaterialSoundConfig | false; rule(ruleId: R): this; move(predicate: (move: MaterialMove, context: MaterialAnimationContext) => boolean): this; mine(): this; duration(duration: number): this; sound(sound: string | MaterialSoundConfig | false): this; none(): this; /** * The single duration this configuration carries, given to everything it can be given to — the shuffles and * the creations of several items at once included, so that `.duration(n)` means what it says. Undefined, it * leaves every default alone. */ private get config(); getDuration(move: MaterialMove, context: MaterialGameAnimationContext): number; getItemAnimation(context: ItemContext, animation: Animation>, boundaries: GridBoundaries): Interpolation; } export {};