60 lines
1.3 KiB
TypeScript
60 lines
1.3 KiB
TypeScript
export interface GlitchComponentConfig {
|
|
id: string
|
|
name: string
|
|
version: string
|
|
params: Record<string, unknown>
|
|
}
|
|
|
|
export interface GlitchHostBridge {
|
|
playSound?: (id: string, payload?: Record<string, unknown>) => void
|
|
stopSound?: (id: string, payload?: Record<string, unknown>) => void
|
|
emit?: (type: string, payload?: unknown) => void
|
|
}
|
|
|
|
export interface GlitchTheme {
|
|
primary: string
|
|
accent: string
|
|
bg: string
|
|
bgSecondary: string
|
|
text: string
|
|
textMuted: string
|
|
border: string
|
|
}
|
|
|
|
export interface GlitchComponentResult {
|
|
success: boolean
|
|
score?: number
|
|
data?: unknown
|
|
error?: string
|
|
}
|
|
|
|
export interface GlitchComponentProps {
|
|
config: GlitchComponentConfig
|
|
onComplete: (result: GlitchComponentResult) => void
|
|
onProgress?: (percent: number) => void
|
|
theme?: GlitchTheme
|
|
className?: string
|
|
host?: GlitchHostBridge
|
|
}
|
|
|
|
export interface ParamSchema {
|
|
[key: string]: {
|
|
type: 'number' | 'string' | 'boolean' | 'color' | 'select' | 'range'
|
|
label?: string
|
|
description?: string
|
|
default: unknown
|
|
options?: { value: string | number; label: string }[]
|
|
min?: number
|
|
max?: number
|
|
step?: number
|
|
}
|
|
}
|
|
|
|
export interface GlitchComponentMetadata {
|
|
name: string
|
|
displayName: string
|
|
version: string
|
|
paramSchema: ParamSchema
|
|
defaultParams: Record<string, unknown>
|
|
}
|