@genart-api/adapter-editart
Version:
GenArtAPI platform adapter for editart.xyz
51 lines (50 loc) • 1.61 kB
TypeScript
import type { Param, ParamSpecs, PlatformAdapter, PRNG, RunMode, ScreenConfig } from "@genart-api/core";
declare global {
var randomSeedEditArt: string;
function triggerPreview(): void;
}
/**
* Adapter configuration options. To be used with
* {@link EditArtAdapter.configure}.
*/
export interface EditArtAdapterOpts {
/**
* List of param IDs to adapt. If given, only these (max. 5) given
* parameters will be considered for adaptation (instead of auto-selecting
* them), in the order given.
*/
params: string[];
}
export declare class EditArtAdapter implements PlatformAdapter {
protected _paramIndex: Record<string, number>;
protected _searchParams: URLSearchParams;
protected _selectedParamIDs?: string[];
protected _cache: Record<string, string>;
protected _prng: PRNG;
protected _seed: string;
protected _screen: ScreenConfig;
constructor();
get id(): string;
get mode(): RunMode;
get screen(): {
width: number;
height: number;
dpr: number;
};
get prng(): PRNG;
get seed(): string;
configure(opts: Partial<EditArtAdapterOpts>): void;
updateParam(id: string, param: Param<any>): Promise<{
value: string;
} | {
value: number;
} | {
value: boolean;
} | undefined>;
initParams(params: ParamSpecs): Promise<void>;
capture(_?: HTMLCanvasElement | SVGElement): void;
protected reload(): void;
protected initPRNG(): void;
protected serializeParam(spec: Param<any>): string;
protected warn(msg: string, ...args: any[]): void;
}