motiontext-renderer
Version:
Web-based animated caption/subtitle renderer with plugin system
169 lines (168 loc) • 4.38 kB
TypeScript
import { Scenario } from '../types/scenario-v2';
import { PluginChannelInterface } from './ChannelComposer';
export interface ScenarioInfo {
/**
* 시나리오 버전 (읽기 전용)
*/
readonly version: string;
}
export interface AssetManager {
/**
* 에셋 URL 생성 (베이스 URL 기준)
*/
getUrl(path: string): string;
/**
* 폰트 로드 및 등록 (권한 필요)
*/
loadFont?(fontSpec: {
family: string;
src: string;
weight?: string;
style?: string;
}): Promise<void>;
/**
* 이미지 프리로드 (권한 필요)
*/
preloadImage?(url: string): Promise<HTMLImageElement>;
/**
* 오디오 프리로드 (권한 필요)
*/
preloadAudio?(url: string): Promise<HTMLAudioElement>;
}
export interface AudioSystem {
/**
* 오디오 재생
*/
play(url: string, options?: {
volume?: number;
loop?: boolean;
startTime?: number;
}): Promise<void>;
/**
* 오디오 일시정지
*/
pause(url: string): void;
/**
* 볼륨 설정
*/
setVolume(url: string, volume: number): void;
/**
* 오디오 정지 및 해제
*/
stop(url: string): void;
}
export interface PortalSystem {
/**
* 플러그인 영역 외부로 탈출 (breakout)
* 전체 화면 오버레이 등에 사용
*/
breakout(options: {
zIndex?: number;
className?: string;
appendTo?: 'body' | 'stage';
}): HTMLElement;
/**
* 탈출 상태 해제
*/
return(): void;
/**
* 현재 탈출 상태인지 확인
*/
readonly isBreakout: boolean;
}
export interface RendererInfo {
readonly version: string;
readonly currentTime: number;
readonly duration: number;
readonly timeScale: number;
readonly fps?: number;
}
export interface PluginUtils {
/**
* 값 보간 (선형 보간 기본)
*/
interpolate(from: any, to: any, progress: number, easing?: string): any;
/**
* 이징 함수들
*/
readonly easing: Record<string, (t: number) => number>;
/**
* 색상 유틸리티
*/
readonly color: {
parse(color: string): {
r: number;
g: number;
b: number;
a: number;
} | null;
format(rgba: {
r: number;
g: number;
b: number;
a: number;
}): string;
interpolate(from: string, to: string, progress: number): string;
};
}
/**
* Plugin Context v3.0 완전 인터페이스
*/
export interface PluginContextV3 {
readonly container: HTMLElement;
readonly scenario: ScenarioInfo;
readonly assets: AssetManager;
readonly channels?: PluginChannelInterface;
readonly portal?: PortalSystem;
readonly audio?: AudioSystem;
readonly renderer: RendererInfo;
readonly utils: PluginUtils;
onSeek?: (callback: (progress: number) => void) => void;
readonly gsap?: any;
readonly lottie?: any;
[peerDep: string]: any;
}
/**
* 기본 시나리오 정보 구현
*/
export declare class DefaultScenarioInfo implements ScenarioInfo {
private scenario;
constructor(scenario: Scenario);
get version(): string;
}
/**
* 기본 에셋 매니저 구현
*/
export declare class DefaultAssetManager implements AssetManager {
private baseUrl;
constructor(baseUrl: string);
getUrl(path: string): string;
loadFont(fontSpec: {
family: string;
src: string;
weight?: string;
style?: string;
}): Promise<void>;
preloadImage(url: string): Promise<HTMLImageElement>;
preloadAudio(url: string): Promise<HTMLAudioElement>;
}
/**
* 기본 유틸리티 구현
*/
export declare const defaultUtils: PluginUtils;
/**
* Plugin Context v3.0 팩토리
* 권한 시스템을 고려하여 선택적으로 기능을 포함
*/
export declare function createPluginContextV3(config: {
container: HTMLElement;
scenario: Scenario;
baseUrl: string;
channels?: PluginChannelInterface;
portal?: PortalSystem;
audio?: AudioSystem;
renderer: RendererInfo;
peerDeps?: Record<string, any>;
onSeek?: (callback: (progress: number) => void) => void;
}): PluginContextV3;
//# sourceMappingURL=PluginContextV3.d.ts.map