import { Interpolation, Keyframes, Theme } from '@emotion/react'; import { Location, MaterialHelpDisplay, MaterialItem, MaterialMove } from '@gamepark/rules-api'; import { TFunction } from 'i18next'; import { ComponentType, HTMLAttributes, ReactNode } from 'react'; import { ItemContext, MaterialContext } from '../../locators'; import { ComponentDescription } from './ComponentDescription'; import { ItemButtonProps } from './ItemMenuButton'; export type MaterialHelpProps
= {
closeDialog: () => void;
} & Omit = {
item: Partial extends ComponentDescription ;
/**
* See {@link getStaticItems}
*/
staticItems: MaterialItem [];
/**
* Return any items to display that are not part of the game state because they never move (board or unlimited stockpiles for instance).
* Default value: {@link staticItem} if defined, otherwise {@link staticItems}. Override if the static items depends on the context.
*
* @param {MaterialContext} _context Context of the game
* @returns {MaterialItem[]} the extra items to display
*/
getStaticItems(_context: MaterialContext ): MaterialItem [];
/**
* See {@link getStockLocation}
*/
stockLocation?: Location ;
/**
* If items are created of deleted, by default the animation will fade in or fade out the item quickly.
* If you want to animate from/to a location (a stockpile for instance), implement this function or simply {@link stockLocation}.
* @param _item Item that is getting created or deleted.
* @param _context Context of the game
* @returns The location to animate from/to
*/
getStockLocation(_item: MaterialItem , _context: MaterialContext ): Location | undefined;
/**
* See {@link getLocations}
*/
location?: Location ;
/**
* See {@link getLocations}
*/
locations: Location [];
/**
* The internal locations of the item, for instance the spots to put material on a board.
* Will return {@link location} by default if defined, {@link locations} otherwise.
*
* @param _item The item that contains the locations
* @param _context Context of the game
*/
getLocations(_item: MaterialItem , _context: ItemContext ): Location [];
/**
* This function determines if an item can currently be dragged by the user to perform a given move.
*
* @param _move The move to consider
* @param _context Context of the item
*/
canDrag(_move: MaterialMove , _context: ItemContext ): boolean;
/**
* This function determines if a move can be played by clicking for 1 second on an item
*
* @param move The move to consider
* @param context Context of the item
*/
canLongClick(move: MaterialMove , context: ItemContext ): boolean;
/**
* This function determines if a move can be played by clicking on an item
*
* @param move The move to consider
* @param context Context of the item
*/
canShortClick(move: MaterialMove , context: ItemContext ): boolean;
/**
* This function returns the move that should be played when clicking on an item, if any
*
* @param _context Context of the item
*/
getShortClickMove(_context: ItemContext ): MaterialMove | undefined;
/**
* This function returns the local move that should be played when clicking on an item, if any
*
* @param _context Context of the item
*/
getShortClickLocalMove(_context: ItemContext ): MaterialMove | undefined;
/**
* Thickness of the item
*/
thickness: number;
/**
* Returns the thickness of the item. Default to {@link thickness}
* @param _item the item
* @param _context Context of the item
* @returns {number} The thickness
*/
getThickness(_item: MaterialItem , _context: ItemContext ): number;
/**
* Any extra css to add on the item
* @param _item The item
* @param _context Context of the item
* @returns The css, using Emotion framework
*/
getItemExtraCss(_item: MaterialItem , _context: ItemContext ): Interpolation , _context: ItemContext ): boolean | undefined;
/**
* The move to execute in order to display the help dialog about this item.
* By default, open the help about this specific item, but it can be the help about the location of the item sometimes.
* @param item The item
* @param context Context of the item
* @return The move to play to open the help dialog
*/
displayHelp(item: MaterialItem , context: ItemContext ): MaterialMove | undefined;
/**
* Whether the item shows its back face on the game table. Only material with 2 faces ever does
* (see {@link FlatMaterialDescription}), hence false here.
* @param _item The item
* @param _context Context of the item
* @returns true if the face the player sees is the back of the item
*/
isFlippedOnTable(_item: Partial ): boolean;
/**
* Whether the item shows its back face in the help dialog. See {@link isFlippedOnTable}.
* @param _item The item
* @param _context Context of the item
* @returns true if the face the player sees is the back of the item
*/
isFlippedInDialog(_item: Partial ): boolean;
/**
* Builds the CSS transform that will be applied to the item.
* @param item Item to position
* @param context Context of the item
* @returns {string[]} a list of CSS transformations
*/
getItemTransform(item: MaterialItem , context: ItemContext ): string[];
/**
* Builds the CSS transform that will be applied to the item when hovered.
* @param _item Item to position
* @param _context Context of the item
* @returns {string[]} a list of CSS transformations
*/
getHoverTransform(_item: MaterialItem , _context: ItemContext ): string[];
/**
* Provide the locations that are required to drop an item given the legal moves that currently allow to drag the item.
* @param context Context of the item. Use {@link getItemFromContext} to get the item from it.
* @param dragMoves Legal moves filtered to only keep those that allows the item to be dragged
* @return All the locations where the item can be dropped
*/
getDropLocations(context: ItemContext , dragMoves: MaterialMove []): Location [];
getMoveDropLocations(context: ItemContext , move: MaterialMove ): Location [];
getTooltip(item: MaterialItem , t: TFunction, _context: ItemContext ): string | null | undefined;
menuAlwaysVisible: boolean;
isMenuAlwaysVisible(_item: MaterialItem , _context: ItemContext ): boolean;
getItemMenu(_item: MaterialItem , _context: ItemContext , _legalMoves: MaterialMove []): ReactNode;
getHelpButton(item: MaterialItem , context: ItemContext , props?: Partial ): Interpolation = Record