import { type TurnDirection, type TurnPreset, type TurnView } from "./turn.camera.ts"; import { type TurnModel, type TurnSettings } from "./turn.model.ts"; import type { ScoreOptions, SurfaceOptions } from "./types.ts"; import type { VenueSettings } from "./venue.ts"; import { type Quality, type QualityTier } from "./quality.ts"; import type { OutsideLevel } from "./outside.paint.ts"; import { type ReplayCall } from "./replay.feed.ts"; import type { ReplaySettings, ReplayTimeline } from "./replay.types.ts"; import type { KyogijoReplay } from "./mount.ts"; import type { TurnInternals } from "./turn.replay.dom.ts"; import type { ReplayView } from "./replay.dom.ts"; /** * The replay's own code, which `turn.replay.dom.ts` puts in when it is loaded (the `/turn` entry and the element load it): a page that only turns a view (a district, a tournament layout) carries none of the replay * and its layers. */ declare let replayKit: { attach(view: TurnInternals, timeline: ReplayTimeline, settings: ReplaySettings): KyogijoReplay; flat(host: HTMLElement, timeline: ReplayTimeline, settings: ReplaySettings, options: SurfaceOptions | ScoreOptions): ReplayView; } | undefined; /** Put the replay's code in: called once by `turn.replay.dom.ts`. */ export declare function useTurnReplay(kit: NonNullable): void; /** What `mountKyogijoTurn` gives back. `O` is what `update` takes: the options of a drawing, or (for `mountMultiTurn`) of a tournament layout. */ export interface KyogijoTurn { /** `3d`, or `flat` where the browser cannot draw the 3D view (or there is nothing to turn): the flat drawing is shown and the rest of this does nothing. */ readonly mode: "3d" | "flat"; /** The view now: where it is going if it is gliding. */ view(): TurnView; /** Turn to a view (the parts of it given): it glides there unless `glide` is false or the reader prefers reduced motion. */ set(view: Partial, glide?: boolean): void; /** Go to one of the four viewpoints: `overhead`, `broadcast`, `end` or `corner`. */ preset(name: TurnPreset): void; /** Back to the opening view. */ reset(): void; /** * Draw again with new options (a score that moved, a look that changed), keeping the view and the auto-turn: the view goes on turning. `change` alters what the venue's walls and roof stand on (the settings `venue` was * mounted with, the parts given), so that a page can switch them on and off without mounting the view again. */ update(options: O, change?: { venue?: VenueSettings; }): void; /** Whether the auto-turn is running. */ readonly playing: boolean; /** Start the auto-turn, a slow turn of the whole view. It gives whether it is running (a surface that cannot turn gives `false`). Nothing turns by itself until this, the Play button or Space starts it, unless `autoPlay` asked. */ play(): boolean; /** Stop the auto-turn. */ pause(): void; /** Which way the auto-turn goes. */ direction(): TurnDirection; /** Change which way the auto-turn goes, at once and without stopping it (the Reverse button does). */ setDirection(direction: TurnDirection): void; /** Start the auto-turn if it is stopped and stop it if it is running; it gives whether it is running now. */ togglePlay(): boolean; /** For a view with a crowd outside (a district asked for one): show another level at once, without drawing the view again, so that the turn goes on. */ setOutside?(level: OutsideLevel): void; /** What the crowd outside's last paint cost, in milliseconds, how many people it drew and how (`dots` or `density`), or `undefined` where there is no crowd or it has not been drawn. */ outsideCost?(): { ms: number; people: number; mode: string; pixels: number; } | undefined; /** What the view was asked to draw: `auto`, or the tier it is held at. */ readonly quality: Quality; /** The tier the view is drawn at now: what `quality` says, and for `auto` the one the frames have led it to (`high` at first). */ readonly tier: QualityTier; /** Change what the view is asked to draw: a tier is taken at once, `auto` goes on from the tier it is at. The camera and the auto-turn are not touched. */ setQuality(quality: Quality): void; /** The flat drawing that is the floor, or `null` after `destroy`. */ svg(): SVGSVGElement | null; /** * Play tracking data on the view: the players stand up on the surface as discs that face the eye (home circles, away squares, numbers), the ball or the puck runs on the floor with its trail, and the passes, shots and * goals are drawn on the floor as in the flat replay. The replay's controls go under the view's; the view still turns, tips and zooms while it plays. Space on the view plays and pauses, comma and full stop step; the * arrow keys still turn the view. `destroy` on what it gives takes the replay away and leaves the view. A tournament layout has no replay. Where the browser cannot draw the 3D view, the flat replay plays instead. * `replay.fromUrl(url, options)` plays a feed from an address the reader gives, and `replay.follow(url, options)` follows one live, once the `/feeds` entry is loaded (see `docs/feeds.md`). */ replay: ReplayCall; /** Stop listening and empty the container. */ destroy(): void; } /** True where the page can draw a plane in 3D by one `matrix3d`: that is, nearly everywhere with a stylesheet. */ export declare function turnSupported(win?: { CSS?: { supports?: (property: string, value: string) => boolean; } | null; } | undefined): boolean; /** Where a camera that follows the play looks: a point of the floor, in the scene's pixels from its middle, and a zoom on top of the view's own. */ export interface Aim { focus: [number, number]; zoom: number; } /** * Mount a surface as a 3D view in a container, over the static drawing it would otherwise hold: the drawing is the floor, tilted and turned by the pointer, the * touch, the wheel and the keys, with what stands on the surface (a net and its posts, a basket, a goal, the posts of a football field) standing on it. * @example * ```ts no-run * import { mountKyogijoTurn } from "@johnmorrisdotca/kyogijo-stadiums/turn"; * const view = mountKyogijoTurn(document.querySelector("#court")!, { sport: "volleyball", home: { name: "Japan", score: 3 }, away: { name: "USA", score: 2 } }, { preset: "end" }); * view.preset("corner"); * view.set({ yaw: 60, pitch: 40 }); * ``` */ export declare function mountKyogijoTurn(host: HTMLElement, options: SurfaceOptions | ScoreOptions, settings?: TurnSettings): KyogijoTurn; /** * Mount any 3D model (`mountKyogijoTurn` is this with the model of one surface; `mountMultiTurn` with a tournament layout's): `build` makes the model from what `update` is given, and the rest, the controls, the pointer, the keys * and the auto-turn, is the same. */ export declare function mountTurn(host: HTMLElement, options: O, settings: TurnSettings, build: (options: O, settings: TurnSettings) => TurnModel, replayable?: boolean, lend?: (internals: TurnInternals) => void): KyogijoTurn; export {};