motiontext-renderer
Version:
Web-based animated caption/subtitle renderer with plugin system
99 lines (98 loc) • 2.64 kB
TypeScript
import { ChannelValues } from './DomSeparation';
export type ComposeMode = 'replace' | 'add' | 'multiply';
export interface ChannelSpec {
name: string;
value: any;
mode: ComposeMode;
priority?: number;
}
export interface ChannelState {
baseValue: any;
compositions: ChannelSpec[];
finalValue: any;
}
export declare class ChannelComposer {
private channels;
constructor();
/**
* 채널 초기화
*/
private initializeChannel;
/**
* 렌더러에서 기본 채널 값 설정
*/
setBaseValue(channel: string, value: any): void;
/**
* 플러그인에서 채널 값 합성
*/
compose(channel: string, value: any, mode?: ComposeMode, priority?: number): void;
/**
* 특정 우선순위의 합성 제거
*/
removeComposition(channel: string, priority: number): void;
/**
* 채널 값 재계산
*/
private recompute;
/**
* 개별 합성 규칙 적용
*/
private applyComposition;
/**
* 모든 채널의 최종 값을 ChannelValues로 반환
*/
getComposedChannels(): ChannelValues;
/**
* 특정 채널의 최종 값 반환
*/
getFinalValue(channel: string): any;
/**
* 채널 상태 초기화
*/
reset(): void;
/**
* 디버깅용: 채널 상태 출력
*/
debugChannelState(channel: string): any;
/**
* 사용 가능한 채널 목록 반환
*/
getAvailableChannels(): string[];
}
/**
* 채널 합성기와 DOM 분리 시스템 통합
* ChannelComposer의 결과를 baseWrapper에 CSS 변수로 적용
*/
export declare function syncChannelsToDOM(composer: ChannelComposer, baseWrapper: HTMLElement): void;
/**
* 플러그인용 채널 인터페이스
* 플러그인이 안전하게 채널을 조작할 수 있는 API
*/
export declare class PluginChannelInterface {
private composer;
private pluginId;
private priorityOffset;
constructor(composer: ChannelComposer, pluginId: string, priorityOffset?: number);
/**
* 채널 값 설정
*/
set(channel: string, value: any, mode?: ComposeMode): void;
/**
* 채널 값 가져오기
*/
get(channel: string): any;
/**
* 사용 가능한 채널 목록
*/
get available(): string[];
/**
* 플러그인 정리 (모든 합성 제거)
*/
cleanup(): void;
/**
* 플러그인 ID를 기반으로 우선순위 계산
* 문자열 해시를 사용하여 일관된 우선순위 부여
*/
private getPriorityForPlugin;
}
//# sourceMappingURL=ChannelComposer.d.ts.map