import type { Outline } from "./outline.ts"; import type { Surface } from "./surfaces/surface.ts"; import type { PageantStyle, Side, Sport, SurfaceOptions, Team } from "./types.ts"; /** The border band of a carpet, as a share of its shorter side: the least, the most and the usual. */ export declare const PAGEANT_BORDER: { readonly min: 0.02; readonly max: 0.15; readonly usual: 0.06; }; /** The least and the most a carpet or a stage is scaled to, as a share of the room its half gives it. */ export declare const PAGEANT_SCALE: { readonly min: 0.4; readonly max: 1; }; /** The ratio of a carpet's width over its height: a flag of 3 to 2 unless the team or its SVG says otherwise, held between a square and 3 to 1. */ export declare const PAGEANT_RATIO: { readonly min: 1; readonly max: 3; readonly usual: 1.5; }; /** How far a filled carpet's ratio may differ from its flag's, as a factor either way: the art is stretched and cropped by its square root. */ export declare const PAGEANT_FILL_LIMIT = 1.75; /** What a pageant is, with every choice made. */ export interface Pageant { style: PageantStyle; border: "dark" | "team" | string; borderWidth: number; fabric: boolean; lines: "over" | "under" | "through"; ring: "gold" | "team" | string; emblem?: { href: string; shape: "round" | "plain"; fit: "contain" | "cover"; name?: string; }; /** Where the score goes: the plate in the middle, the compact strip under the drawing, or `auto`, which the drawing decides once it has laid the pictures out (`autoScore`). */ score: "auto" | "centre" | "strip"; scale: number; fit: "fill" | "ratio"; names: boolean | undefined; animate: "none" | "unfurl" | "fade"; } /** The sports whose score is a plate that a pageant can shrink: a curling sheet's and a net court's boards are drawn to the room they are given and are not. */ export declare const plateShrinks: (sport: Sport) => boolean; /** * What the options ask of a pageant, or `undefined` for none: `pageant` unset or `false`, a drawing with no score, one of the badge size, or a special game. A choice that is not one of * the values is the default's; a colour must pass `safeColour`, the emblem `safeLogo`, a number is held to its range. */ export declare function pageantOf(o: SurfaceOptions & { home?: unknown; away?: unknown; size?: unknown; }): Pageant | undefined; /** How wide a team's carpet is for its height: the team's `logoRatio`, else its SVG logo's own, else 3 to 2; held between a square and 3 to 1. */ export declare function ratioOf(team: Pick): number; /** A team as the pageant lays it out: a picture or none, its colours and the ratio of its carpet. */ export interface PageantTeam { side: Side; role: "home" | "away"; name: string; abbr: string; state: "win" | "lose" | "none"; href: string | undefined; /** `cover` fills a carpet or a stage with the picture, `contain` shows it whole on a plain ground. */ fit: "cover" | "contain"; ratio: number; color: string | undefined; ink: string | undefined; } /** One picture's place, in the surface's frame and in the eye's: the centre, and the size as the eye sees it (a stage's `r` is its radius). */ export interface Placed { team: PageantTeam; /** The place it fills: the first (left) or the second (right) of the surface. */ spot: "left" | "right"; cx: number; cy: number; w: number; h: number; r?: number; /** A carpet that fills its room: its art is fitted to it by stretching and cropping, not by its own ratio. */ filled?: boolean; } /** Where everything of a pageant goes. */ export interface PageantLayout { pictures: Placed[]; emblem?: { cx: number; cy: number; r: number; }; /** The size the plate is drawn at in the middle, as a share of its own. */ plateScale: number; } /** What the layout is given besides the surface. */ export interface LayoutInput { pageant: Pageant; surface: Surface; outline: Outline; left: PageantTeam; right: PageantTeam; /** True when the drawing lies tall: the halves are then the top and the bottom as the eye sees them, and each picture is turned back upright. */ turned: boolean; sport: Sport; /** True when the plate is drawn in the middle of the surface (a full-size score with its score in the centre). */ plate: boolean; } /** * Where each team's picture and the emblem go. A picture is sized to the room its half gives it (less a margin) at its own ratio, and is moved in until it lies inside the surface's outline * (a rink's rounded corners, a ballpark's fence, an oval's curve). The middle is kept clear of the emblem and of the plate: the pictures are narrower where they must be. * @returns `undefined` when the surface has no playing area to lay a picture on. */ export declare function pageantLayout(input: LayoutInput): PageantLayout | undefined; /** How much of their width the pictures must keep with the plate in the middle, against without it, before the plate in the middle gives way to the strip. */ export declare const PLATE_COST = 0.7; /** * Where the score goes when the options say `auto` and there is no emblem or board: the plate stays in the middle if the pictures lose little of their size to it, otherwise the score * goes to the strip under the drawing and the pictures take the room. */ export declare function autoScore(input: LayoutInput): "centre" | "strip";