1+ /**
2+ * @param src the url for fetching the asciicast recording
3+ * @param element the container element to mount the player into
4+ * @param options player options
5+ * @returns the created AsciinemaPlayer instance
6+ */
17export function create (
28 src : RequestInfo | URL ,
39 element : HTMLElement ,
410 options ?: options ,
511) : AsciinemaPlayer ;
12+ /**
13+ * @param data the object for fetching data and parsing it to a asciicast recording
14+ * @param element the container element to mount the player into
15+ * @param options player options
16+ * @returns the created AsciinemaPlayer instance
17+ */
618export function create (
719 data : {
820 url : RequestInfo | URL ;
921 fetchOpts ?: RequestInit ;
10- parser ?: parser ;
22+ parser ?: "asciicast" | "ttyrec" | "typescript" | ( ( response : Response ) => recording ) ;
1123 } ,
1224 element : HTMLElement ,
1325 options ?: options ,
1426) : AsciinemaPlayer ;
27+ /**
28+ * @param data the object for providing asciicast recording, either directly or via a function
29+ * @param element the container element to mount the player into
30+ * @param options player options
31+ * @returns the created AsciinemaPlayer instance
32+ */
1533export function create (
1634 data : {
17- data : asciicastDataSource ;
35+ data : asciicastProvider ;
1836 } ,
1937 element : HTMLElement ,
2038 options ?: options ,
2139) : AsciinemaPlayer ;
2240
23- export type RecordingDataModel = {
41+ export type recording = {
2442 cols : number ;
2543 rows : number ;
2644 events : Array < [ number , "o" | "i" | "m" | "r" , string ] > ;
2745} ;
28- type parser = "asciicast" | "ttyrec" | "typescript" | ( ( response : Response ) => RecordingDataModel ) ;
2946
3047export type asciicastV1 = {
3148 version : 1 ;
@@ -78,8 +95,8 @@ export type asciicastV3 = [
7895 ...Array < [ number , "o" | "i" | "m" | "r" | "x" , string ] > ,
7996] ;
8097
81- type asciicastData = asciicastV1 | asciicastV2 | asciicastV3 | string ;
82- type asciicastDataSource = asciicastData | ( ( ) => Promise < asciicastData > ) | ( ( ) => asciicastData ) ;
98+ export type asciicast = asciicastV1 | asciicastV2 | asciicastV3 | string ;
99+ export type asciicastProvider = asciicast | ( ( ) => Promise < asciicast > ) | ( ( ) => asciicast ) ;
83100
84101/**
85102 * Look and feel of the asciinema player can be configured extensively by passing additional options
@@ -359,11 +376,11 @@ export interface options {
359376 * logger: console
360377 */
361378 logger ?: {
362- log ( ...args : any [ ] ) : void ;
363- debug ( ...args : any [ ] ) : void ;
364- info ( ...args : any [ ] ) : void ;
365- warn ( ...args : any [ ] ) : void ;
366- error ( ...args : any [ ] ) : void ;
379+ log ( ...args : unknown [ ] ) : void ;
380+ debug ( ...args : unknown [ ] ) : void ;
381+ info ( ...args : unknown [ ] ) : void ;
382+ warn ( ...args : unknown [ ] ) : void ;
383+ error ( ...args : unknown [ ] ) : void ;
367384 } ;
368385}
369386
@@ -500,15 +517,15 @@ interface AsciinemaPlayer {
500517}
501518
502519/** Seek location union matching the docs. */
503- type SeekLocation =
520+ export type SeekLocation =
504521 | number // seconds
505522 | `${number } %` // percentage string, e.g. "50%"
506523 | { marker : number } // go to marker by 0-based index
507524 | { marker : "prev" } // previous marker
508525 | { marker : "next" } ; // next marker
509526
510527/** Payload for the `input` event. */
511- type InputEventDetail = {
528+ export type InputEventDetail = {
512529 /**
513530 * Registered input value (ASCII or control char).
514531 *
@@ -521,7 +538,7 @@ type InputEventDetail = {
521538} ;
522539
523540/** Payload for the `marker` event. */
524- type MarkerEventDetail = {
541+ export type MarkerEventDetail = {
525542 /** 0-based marker index. */
526543 index : number ;
527544 /** Marker time in seconds. */
0 commit comments