@viji-dev/core 0.2.0-alpha.4 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global.d.ts +57 -7
- package/dist/assets/viji.worker-BKsgIT1d.js.map +1 -1
- package/dist/index.d.ts +57 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/artist-dts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const artistDts = "declare namespace VijiCore {\ndeclare interface AnalysisConfiguration {\r\n fftSize?: number;\r\n smoothing?: number;\r\n frequencyBands?: FrequencyBand[];\r\n beatDetection?: boolean;\r\n onsetDetection?: boolean;\r\n}\r\n\r\ndeclare interface AudioAPI {\r\n isConnected: boolean;\r\n volume: {\r\n rms: number;\r\n peak: number;\r\n };\r\n beat?: {\r\n isKick: boolean;\r\n confidence: number;\r\n };\r\n bands: Record<string, number>;\r\n getFrequencyData: () => Uint8Array;\r\n}\r\n\r\ndeclare interface CaptureFrameOptions {\r\n /** MIME type for output, e.g., 'image/png', 'image/jpeg', 'image/webp' */\r\n type?: string;\r\n /**\r\n * Target resolution.\r\n * - number: scale factor relative to current canvas size (e.g., 0.5 = 50%)\r\n * - { width, height }: exact output size; if aspect ratio differs from canvas,\r\n * the source is center-cropped to match the target aspect ratio before scaling\r\n */\r\n resolution?: number | {\r\n width: number;\r\n height: number;\r\n };\r\n}\r\n\r\ndeclare interface ColorParameter {\r\n value: string;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface CoreCapabilities {\r\n /** Audio input is active and connected */\r\n hasAudio: boolean;\r\n /** Video input is active and connected */\r\n hasVideo: boolean;\r\n /** User interactions (mouse, touch, keyboard) are enabled */\r\n hasInteraction: boolean;\r\n /** General parameters are always available */\r\n hasGeneral: boolean;\r\n}\r\n\r\ndeclare interface FaceData {\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n }[];\r\n expressions: Record<string, number>;\r\n}\r\n\r\ndeclare interface FrameRateInfo {\r\n mode: FrameRateMode;\r\n screenRefreshRate: number;\r\n effectiveRefreshRate: number;\r\n}\r\n\r\ndeclare type FrameRateMode = 'full' | 'half';\r\n\r\ndeclare interface FrequencyBand {\r\n name: string;\r\n min: number;\r\n max: number;\r\n}\r\n\r\ndeclare interface HandData {\r\n palm: {\r\n x: number;\r\n y: number;\r\n };\r\n fingers: {\r\n x: number;\r\n y: number;\r\n }[];\r\n gestures: Record<string, boolean>;\r\n}\r\n\r\ndeclare interface KeyboardAPI {\r\n isPressed(key: string): boolean;\r\n wasPressed(key: string): boolean;\r\n wasReleased(key: string): boolean;\r\n activeKeys: Set<string>;\r\n pressedThisFrame: Set<string>;\r\n releasedThisFrame: Set<string>;\r\n lastKeyPressed: string;\r\n lastKeyReleased: string;\r\n shift: boolean;\r\n ctrl: boolean;\r\n alt: boolean;\r\n meta: boolean;\r\n}\r\n\r\ndeclare interface MouseAPI {\r\n x: number;\r\n y: number;\r\n isInCanvas: boolean;\r\n isPressed: boolean;\r\n leftButton: boolean;\r\n rightButton: boolean;\r\n middleButton: boolean;\r\n velocity: {\r\n x: number;\r\n y: number;\r\n };\r\n deltaX: number;\r\n deltaY: number;\r\n wheelDelta: number;\r\n wheelX: number;\r\n wheelY: number;\r\n wasPressed: boolean;\r\n wasReleased: boolean;\r\n wasMoved: boolean;\r\n}\r\n\r\ndeclare interface NumberParameter {\r\n value: number;\r\n min: number;\r\n max: number;\r\n step: number;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface ParameterAPI {\r\n define(groups: ParameterGroup[]): void;\r\n [key: string]: any;\r\n}\r\n\r\ndeclare type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';\r\n\r\ndeclare interface ParameterConfig {\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n options?: string[] | number[];\r\n maxLength?: number;\r\n label?: string;\r\n description?: string;\r\n hidden?: boolean;\r\n precision?: number;\r\n}\r\n\r\ndeclare interface ParameterDefinition {\r\n type: 'slider' | 'color' | 'toggle' | 'select' | 'text' | 'number';\r\n defaultValue: any;\r\n label?: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n config?: ParameterConfig;\r\n validate?: (value: any) => boolean;\r\n}\r\n\r\ndeclare interface ParameterGroup {\r\n groupName: string;\r\n category?: ParameterCategory;\r\n description?: string;\r\n collapsed?: boolean;\r\n order?: number;\r\n parameters: Record<string, ParameterDefinition>;\r\n}\r\n\r\ndeclare type ParameterValue = string | number | boolean;\r\n\r\ndeclare interface PerformanceStats {\r\n frameTime: number;\r\n resolution: Resolution;\r\n scale: number;\r\n frameRate: FrameRateInfo;\r\n memoryUsage?: number;\r\n activeStreams?: number;\r\n parameterCount?: number;\r\n}\r\n\r\ndeclare type Resolution = {\r\n width: number;\r\n height: number;\r\n};\r\n\r\ndeclare interface SelectParameter {\r\n value: string | number;\r\n options: string[] | number[];\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface SliderParameter {\r\n value: number;\r\n min: number;\r\n max: number;\r\n step: number;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface TextParameter {\r\n value: string;\r\n maxLength?: number;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface ToggleParameter {\r\n value: boolean;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface TouchAPI {\r\n points: TouchPoint[];\r\n count: number;\r\n started: TouchPoint[];\r\n moved: TouchPoint[];\r\n ended: TouchPoint[];\r\n primary: TouchPoint | null;\r\n gestures: TouchGestureAPI;\r\n}\r\n\r\ndeclare interface TouchGestureAPI {\r\n isPinching: boolean;\r\n isRotating: boolean;\r\n isPanning: boolean;\r\n isTapping: boolean;\r\n pinchScale: number;\r\n pinchDelta: number;\r\n rotationAngle: number;\r\n rotationDelta: number;\r\n panDelta: {\r\n x: number;\r\n y: number;\r\n };\r\n tapCount: number;\r\n lastTapTime: number;\r\n tapPosition: {\r\n x: number;\r\n y: number;\r\n } | null;\r\n}\r\n\r\ndeclare interface TouchPoint {\r\n id: number;\r\n x: number;\r\n y: number;\r\n pressure: number;\r\n radius: number;\r\n radiusX: number;\r\n radiusY: number;\r\n rotationAngle: number;\r\n force: number;\r\n deltaX: number;\r\n deltaY: number;\r\n velocity: {\r\n x: number;\r\n y: number;\r\n };\r\n isNew: boolean;\r\n isActive: boolean;\r\n isEnding: boolean;\r\n}\r\n\r\ndeclare const VERSION = \"0.1.0-alpha.1\";\r\n\r\ndeclare interface VideoAPI {\r\n isConnected: boolean;\r\n currentFrame: OffscreenCanvas | null;\r\n frameWidth: number;\r\n frameHeight: number;\r\n frameRate: number;\r\n getFrameData: () => ImageData | null;\r\n faces: FaceData[];\r\n hands: HandData[];\r\n}\r\n\r\ndeclare interface VijiAPI {\r\n canvas: OffscreenCanvas;\r\n ctx?: OffscreenCanvasRenderingContext2D;\r\n gl?: WebGL2RenderingContext;\r\n width: number;\r\n height: number;\r\n pixelRatio: number;\r\n time: number;\r\n deltaTime: number;\r\n frameCount: number;\r\n fps: number;\r\n audio: AudioAPI;\r\n video: VideoAPI;\r\n mouse: MouseAPI;\r\n keyboard: KeyboardAPI;\r\n touches: TouchAPI[];\r\n slider: (defaultValue: number, config: SliderParameter) => SliderParameter;\r\n color: (defaultValue: string, config: ColorParameter) => ColorParameter;\r\n toggle: (defaultValue: boolean, config: ToggleParameter) => ToggleParameter;\r\n select: (defaultValue: string | number, config: SelectParameter) => SelectParameter;\r\n text: (defaultValue: string, config: TextParameter) => TextParameter;\r\n number: (defaultValue: number, config: NumberParameter) => NumberParameter;\r\n useContext(type: '2d' | 'webgl'): OffscreenCanvasRenderingContext2D | WebGL2RenderingContext;\r\n}\r\n\r\n/**\r\n * Main VijiCore class - Universal execution engine for creative scenes.\r\n *\r\n * Orchestrates secure IFrame + WebWorker execution with controlled communication.\r\n * Provides the foundation for scene execution across platform and SDK contexts.\r\n */\r\ndeclare class VijiCore {\r\n private iframeManager;\r\n private workerManager;\r\n private interactionManager;\r\n private audioSystem;\r\n private videoCoordinator;\r\n private isInitialized;\r\n private isDestroyed;\r\n private isInitializing;\r\n private instanceId;\r\n private screenRefreshRate;\r\n private debugMode;\r\n /**\r\n * Debug logging helper\r\n */\r\n private debugLog;\r\n private config;\r\n private currentAudioStream;\r\n private currentVideoStream;\r\n private currentInteractionEnabled;\r\n private parameterGroups;\r\n private parameterValues;\r\n private parametersInitialized;\r\n private parameterListeners;\r\n private parameterDefinedListeners;\r\n private parameterErrorListeners;\r\n private capabilitiesChangeListeners;\r\n private stats;\r\n constructor(config: VijiCoreConfig);\r\n /**\r\n * Capture current scene frame as an image Blob.\r\n * Resolution can be a scale (0-1+) or explicit width/height with center-crop.\r\n */\r\n captureFrame(options?: CaptureFrameOptions): Promise<Blob>;\r\n /**\r\n * Enable or disable debug logging\r\n */\r\n setDebugMode(enabled: boolean): void;\r\n /**\r\n * Get current debug mode status\r\n */\r\n getDebugMode(): boolean;\r\n /**\r\n * Initializes the core components in sequence\r\n */\r\n initialize(): Promise<void>;\r\n /**\r\n * Creates canvas with retry logic to handle timing issues\r\n */\r\n private createCanvasWithRetry;\r\n /**\r\n * Sets up the interaction system for Phase 7\r\n */\r\n private setupInteractionSystem;\r\n /**\r\n * Sets up communication between components\r\n */\r\n private setupCommunication;\r\n /**\r\n * Handle parameter definitions received from worker\r\n */\r\n private handleParametersDefined;\r\n /**\r\n * Handle parameter validation errors\r\n */\r\n private handleParameterError;\r\n /**\r\n * Set a single parameter value\r\n */\r\n setParameter(name: string, value: ParameterValue): Promise<void>;\r\n /**\r\n * Set multiple parameter values efficiently\r\n */\r\n setParameters(values: Record<string, ParameterValue>): Promise<void>;\r\n /**\r\n * Get current parameter value\r\n */\r\n getParameter(name: string): ParameterValue | undefined;\r\n /**\r\n * Get all current parameter values\r\n */\r\n getParameterValues(): Record<string, ParameterValue>;\r\n /**\r\n * Get parameter groups (for UI generation)\r\n */\r\n getParameterGroups(): ParameterGroup[];\r\n /**\r\n * Get current core capabilities (what's currently active)\r\n */\r\n getCapabilities(): CoreCapabilities;\r\n /**\r\n * Get parameter groups filtered by active capabilities\r\n */\r\n getVisibleParameterGroups(): ParameterGroup[];\r\n /**\r\n * Check if a specific parameter category is currently active\r\n */\r\n isCategoryActive(category: ParameterCategory): boolean;\r\n /**\r\n * Check if parameters have been initialized\r\n */\r\n get parametersReady(): boolean;\r\n /**\r\n * Send all current parameter values to worker (used for initial sync)\r\n */\r\n private syncAllParametersToWorker;\r\n /**\r\n * Add listener for when parameters are defined\r\n */\r\n onParametersDefined(listener: (groups: ParameterGroup[]) => void): void;\r\n /**\r\n * Remove parameter defined listener\r\n */\r\n offParametersDefined(listener: (groups: ParameterGroup[]) => void): void;\r\n /**\r\n * Add listener for parameter value changes\r\n */\r\n onParameterChange(parameterName: string, listener: (value: ParameterValue) => void): void;\r\n /**\r\n * Remove parameter change listener\r\n */\r\n offParameterChange(parameterName: string, listener: (value: ParameterValue) => void): void;\r\n /**\r\n * Add listener for parameter errors\r\n */\r\n onParameterError(listener: (error: {\r\n message: string;\r\n code: string;\r\n }) => void): void;\r\n /**\r\n * Add listener for when core capabilities change (audio/video/interaction state)\r\n */\r\n onCapabilitiesChange(listener: (capabilities: CoreCapabilities) => void): void;\r\n /**\r\n * Remove capabilities change listener\r\n */\r\n removeCapabilitiesListener(listener: (capabilities: CoreCapabilities) => void): void;\r\n /**\r\n * Notify capability change listeners\r\n */\r\n private notifyCapabilitiesChange;\r\n /**\r\n * Remove parameter error listener\r\n */\r\n offParameterError(listener: (error: {\r\n message: string;\r\n code: string;\r\n }) => void): void;\r\n /**\r\n * Notify parameter change listeners\r\n */\r\n private notifyParameterListeners;\r\n /**\r\n * Sets the frame rate to full speed (every animation frame)\r\n */\r\n setFullFrameRate(): Promise<void>;\r\n /**\r\n * Sets the frame rate to half speed (every second animation frame)\r\n */\r\n setHalfFrameRate(): Promise<void>;\r\n /**\r\n * Updates the canvas resolution by sending effective dimensions to the worker\r\n */\r\n updateResolution(): void;\r\n /**\r\n * Sets the audio stream for analysis\r\n */\r\n setAudioStream(audioStream: MediaStream | null): Promise<void>;\r\n /**\r\n * Sets the video stream for processing\r\n */\r\n setVideoStream(videoStream: MediaStream | null): Promise<void>;\r\n /**\r\n * Gets the current audio stream\r\n */\r\n getAudioStream(): MediaStream | null;\r\n /**\r\n * Gets the current video stream\r\n */\r\n getVideoStream(): MediaStream | null;\r\n /**\r\n * Enables or disables user interactions (mouse, keyboard, touch) at runtime\r\n */\r\n setInteractionEnabled(enabled: boolean): Promise<void>;\r\n /**\r\n * Gets the current interaction enabled state\r\n */\r\n getInteractionEnabled(): boolean;\r\n /**\r\n * Updates audio analysis configuration\r\n */\r\n setAudioAnalysisConfig(config: {\r\n fftSize?: number;\r\n smoothing?: number;\r\n }): Promise<void>;\r\n /**\r\n * Updates the canvas resolution by scale\r\n */\r\n setResolution(scale: number): void;\r\n /**\r\n * Detects the screen refresh rate\r\n */\r\n private detectScreenRefreshRate;\r\n /**\r\n * Updates frame rate statistics\r\n */\r\n private updateFrameRateStats;\r\n /**\r\n * Gets current performance statistics\r\n */\r\n getStats(): PerformanceStats;\r\n /**\r\n * Checks if the core is ready for use\r\n */\r\n get ready(): boolean;\r\n /**\r\n * Gets the current configuration\r\n */\r\n get configuration(): Readonly<VijiCoreConfig>;\r\n /**\r\n * Destroys the core instance and cleans up all resources\r\n */\r\n destroy(): Promise<void>;\r\n /**\r\n * Validates that the core is ready for operations\r\n */\r\n private validateReady;\r\n /**\r\n * Validates the provided configuration\r\n */\r\n private validateConfig;\r\n /**\r\n * Cleans up all resources\r\n */\r\n private cleanup;\r\n}\r\n\r\ndeclare interface VijiCoreConfig {\r\n /** Container element where the scene will be rendered */\r\n hostContainer: HTMLElement;\r\n /** Artist scene code to execute */\r\n sceneCode: string;\r\n /** Frame rate mode - 'full' for every animation frame, 'half' for every second frame */\r\n frameRateMode?: FrameRateMode;\r\n /** Enable automatic performance optimization */\r\n autoOptimize?: boolean;\r\n /** Audio input stream */\r\n audioStream?: MediaStream;\r\n /** Video input stream */\r\n videoStream?: MediaStream;\r\n /** Audio analysis configuration */\r\n analysisConfig?: AnalysisConfiguration;\r\n /** Initial parameter values */\r\n parameters?: ParameterGroup[];\r\n /** Disable input processing (for preview instances) */\r\n noInputs?: boolean;\r\n /** Enable user interaction events */\r\n allowUserInteraction?: boolean;\r\n}\r\n\r\ndeclare class VijiCoreError extends Error {\r\n code: string;\r\n context?: any | undefined;\r\n constructor(message: string, code: string, context?: any | undefined);\r\n}\r\n\r\n{ }\r\n\n}\n\ndeclare const viji: VijiCore.ArtistAPI;\n";
|
|
1
|
+
export const artistDts = "declare namespace VijiCore {\ndeclare interface AnalysisConfiguration {\r\n fftSize?: number;\r\n smoothing?: number;\r\n frequencyBands?: FrequencyBand[];\r\n beatDetection?: boolean;\r\n onsetDetection?: boolean;\r\n}\r\n\r\ndeclare interface AudioAPI {\r\n isConnected: boolean;\r\n volume: {\r\n rms: number;\r\n peak: number;\r\n };\r\n beat?: {\r\n isKick: boolean;\r\n confidence: number;\r\n };\r\n bands: Record<string, number>;\r\n getFrequencyData: () => Uint8Array;\r\n}\r\n\r\ndeclare interface CaptureFrameOptions {\r\n /** MIME type for output, e.g., 'image/png', 'image/jpeg', 'image/webp' */\r\n type?: string;\r\n /**\r\n * Target resolution.\r\n * - number: scale factor relative to current canvas size (e.g., 0.5 = 50%)\r\n * - { width, height }: exact output size; if aspect ratio differs from canvas,\r\n * the source is center-cropped to match the target aspect ratio before scaling\r\n */\r\n resolution?: number | {\r\n width: number;\r\n height: number;\r\n };\r\n}\r\n\r\ndeclare interface ColorConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n}\r\n\r\ndeclare interface ColorParameter {\r\n value: string;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface CoreCapabilities {\r\n /** Audio input is active and connected */\r\n hasAudio: boolean;\r\n /** Video input is active and connected */\r\n hasVideo: boolean;\r\n /** User interactions (mouse, touch, keyboard) are enabled */\r\n hasInteraction: boolean;\r\n /** General parameters are always available */\r\n hasGeneral: boolean;\r\n}\r\n\r\ndeclare interface FaceData {\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n }[];\r\n expressions: Record<string, number>;\r\n}\r\n\r\ndeclare interface FrameRateInfo {\r\n mode: FrameRateMode;\r\n screenRefreshRate: number;\r\n effectiveRefreshRate: number;\r\n}\r\n\r\ndeclare type FrameRateMode = 'full' | 'half';\r\n\r\ndeclare interface FrequencyBand {\r\n name: string;\r\n min: number;\r\n max: number;\r\n}\r\n\r\ndeclare interface HandData {\r\n palm: {\r\n x: number;\r\n y: number;\r\n };\r\n fingers: {\r\n x: number;\r\n y: number;\r\n }[];\r\n gestures: Record<string, boolean>;\r\n}\r\n\r\ndeclare interface KeyboardAPI {\r\n isPressed(key: string): boolean;\r\n wasPressed(key: string): boolean;\r\n wasReleased(key: string): boolean;\r\n activeKeys: Set<string>;\r\n pressedThisFrame: Set<string>;\r\n releasedThisFrame: Set<string>;\r\n lastKeyPressed: string;\r\n lastKeyReleased: string;\r\n shift: boolean;\r\n ctrl: boolean;\r\n alt: boolean;\r\n meta: boolean;\r\n}\r\n\r\ndeclare interface MouseAPI {\r\n x: number;\r\n y: number;\r\n isInCanvas: boolean;\r\n isPressed: boolean;\r\n leftButton: boolean;\r\n rightButton: boolean;\r\n middleButton: boolean;\r\n velocity: {\r\n x: number;\r\n y: number;\r\n };\r\n deltaX: number;\r\n deltaY: number;\r\n wheelDelta: number;\r\n wheelX: number;\r\n wheelY: number;\r\n wasPressed: boolean;\r\n wasReleased: boolean;\r\n wasMoved: boolean;\r\n}\r\n\r\ndeclare interface NumberConfig {\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n}\r\n\r\ndeclare interface NumberParameter {\r\n value: number;\r\n min: number;\r\n max: number;\r\n step: number;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface ParameterAPI {\r\n define(groups: ParameterGroup[]): void;\r\n [key: string]: any;\r\n}\r\n\r\ndeclare type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';\r\n\r\ndeclare interface ParameterConfig {\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n options?: string[] | number[];\r\n maxLength?: number;\r\n label?: string;\r\n description?: string;\r\n hidden?: boolean;\r\n precision?: number;\r\n}\r\n\r\ndeclare interface ParameterDefinition {\r\n type: 'slider' | 'color' | 'toggle' | 'select' | 'text' | 'number';\r\n defaultValue: any;\r\n label?: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n config?: ParameterConfig;\r\n validate?: (value: any) => boolean;\r\n}\r\n\r\ndeclare interface ParameterGroup {\r\n groupName: string;\r\n category?: ParameterCategory;\r\n description?: string;\r\n collapsed?: boolean;\r\n order?: number;\r\n parameters: Record<string, ParameterDefinition>;\r\n}\r\n\r\ndeclare type ParameterValue = string | number | boolean;\r\n\r\ndeclare interface PerformanceStats {\r\n frameTime: number;\r\n resolution: Resolution;\r\n scale: number;\r\n frameRate: FrameRateInfo;\r\n memoryUsage?: number;\r\n activeStreams?: number;\r\n parameterCount?: number;\r\n}\r\n\r\ndeclare type Resolution = {\r\n width: number;\r\n height: number;\r\n};\r\n\r\ndeclare interface SelectConfig {\r\n options: string[] | number[];\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n}\r\n\r\ndeclare interface SelectParameter {\r\n value: string | number;\r\n options: string[] | number[];\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface SliderConfig {\r\n min?: number;\r\n max?: number;\r\n step?: number;\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n}\r\n\r\ndeclare interface SliderParameter {\r\n value: number;\r\n min: number;\r\n max: number;\r\n step: number;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface TextConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n maxLength?: number;\r\n}\r\n\r\ndeclare interface TextParameter {\r\n value: string;\r\n maxLength?: number;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface ToggleConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n}\r\n\r\ndeclare interface ToggleParameter {\r\n value: boolean;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n}\r\n\r\ndeclare interface TouchAPI {\r\n points: TouchPoint[];\r\n count: number;\r\n started: TouchPoint[];\r\n moved: TouchPoint[];\r\n ended: TouchPoint[];\r\n primary: TouchPoint | null;\r\n gestures: TouchGestureAPI;\r\n}\r\n\r\ndeclare interface TouchGestureAPI {\r\n isPinching: boolean;\r\n isRotating: boolean;\r\n isPanning: boolean;\r\n isTapping: boolean;\r\n pinchScale: number;\r\n pinchDelta: number;\r\n rotationAngle: number;\r\n rotationDelta: number;\r\n panDelta: {\r\n x: number;\r\n y: number;\r\n };\r\n tapCount: number;\r\n lastTapTime: number;\r\n tapPosition: {\r\n x: number;\r\n y: number;\r\n } | null;\r\n}\r\n\r\ndeclare interface TouchPoint {\r\n id: number;\r\n x: number;\r\n y: number;\r\n pressure: number;\r\n radius: number;\r\n radiusX: number;\r\n radiusY: number;\r\n rotationAngle: number;\r\n force: number;\r\n deltaX: number;\r\n deltaY: number;\r\n velocity: {\r\n x: number;\r\n y: number;\r\n };\r\n isNew: boolean;\r\n isActive: boolean;\r\n isEnding: boolean;\r\n}\r\n\r\ndeclare const VERSION = \"0.1.0-alpha.1\";\r\n\r\ndeclare interface VideoAPI {\r\n isConnected: boolean;\r\n currentFrame: OffscreenCanvas | null;\r\n frameWidth: number;\r\n frameHeight: number;\r\n frameRate: number;\r\n getFrameData: () => ImageData | null;\r\n faces: FaceData[];\r\n hands: HandData[];\r\n}\r\n\r\ndeclare interface VijiAPI {\r\n canvas: OffscreenCanvas;\r\n ctx?: OffscreenCanvasRenderingContext2D;\r\n gl?: WebGL2RenderingContext;\r\n width: number;\r\n height: number;\r\n pixelRatio: number;\r\n time: number;\r\n deltaTime: number;\r\n frameCount: number;\r\n fps: number;\r\n audio: AudioAPI;\r\n video: VideoAPI;\r\n mouse: MouseAPI;\r\n keyboard: KeyboardAPI;\r\n touches: TouchAPI[];\r\n slider: (defaultValue: number, config: SliderConfig) => SliderParameter;\r\n color: (defaultValue: string, config: ColorConfig) => ColorParameter;\r\n toggle: (defaultValue: boolean, config: ToggleConfig) => ToggleParameter;\r\n select: (defaultValue: string | number, config: SelectConfig) => SelectParameter;\r\n text: (defaultValue: string, config: TextConfig) => TextParameter;\r\n number: (defaultValue: number, config: NumberConfig) => NumberParameter;\r\n useContext(type: '2d' | 'webgl'): OffscreenCanvasRenderingContext2D | WebGLRenderingContext | WebGL2RenderingContext | null;\r\n}\r\n\r\n/**\r\n * Main VijiCore class - Universal execution engine for creative scenes.\r\n *\r\n * Orchestrates secure IFrame + WebWorker execution with controlled communication.\r\n * Provides the foundation for scene execution across platform and SDK contexts.\r\n */\r\ndeclare class VijiCore {\r\n private iframeManager;\r\n private workerManager;\r\n private interactionManager;\r\n private audioSystem;\r\n private videoCoordinator;\r\n private isInitialized;\r\n private isDestroyed;\r\n private isInitializing;\r\n private instanceId;\r\n private screenRefreshRate;\r\n private debugMode;\r\n /**\r\n * Debug logging helper\r\n */\r\n private debugLog;\r\n private config;\r\n private currentAudioStream;\r\n private currentVideoStream;\r\n private currentInteractionEnabled;\r\n private parameterGroups;\r\n private parameterValues;\r\n private parametersInitialized;\r\n private parameterListeners;\r\n private parameterDefinedListeners;\r\n private parameterErrorListeners;\r\n private capabilitiesChangeListeners;\r\n private stats;\r\n constructor(config: VijiCoreConfig);\r\n /**\r\n * Capture current scene frame as an image Blob.\r\n * Resolution can be a scale (0-1+) or explicit width/height with center-crop.\r\n */\r\n captureFrame(options?: CaptureFrameOptions): Promise<Blob>;\r\n /**\r\n * Enable or disable debug logging\r\n */\r\n setDebugMode(enabled: boolean): void;\r\n /**\r\n * Get current debug mode status\r\n */\r\n getDebugMode(): boolean;\r\n /**\r\n * Initializes the core components in sequence\r\n */\r\n initialize(): Promise<void>;\r\n /**\r\n * Creates canvas with retry logic to handle timing issues\r\n */\r\n private createCanvasWithRetry;\r\n /**\r\n * Sets up the interaction system for Phase 7\r\n */\r\n private setupInteractionSystem;\r\n /**\r\n * Sets up communication between components\r\n */\r\n private setupCommunication;\r\n /**\r\n * Handle parameter definitions received from worker\r\n */\r\n private handleParametersDefined;\r\n /**\r\n * Handle parameter validation errors\r\n */\r\n private handleParameterError;\r\n /**\r\n * Set a single parameter value\r\n */\r\n setParameter(name: string, value: ParameterValue): Promise<void>;\r\n /**\r\n * Set multiple parameter values efficiently\r\n */\r\n setParameters(values: Record<string, ParameterValue>): Promise<void>;\r\n /**\r\n * Get current parameter value\r\n */\r\n getParameter(name: string): ParameterValue | undefined;\r\n /**\r\n * Get all current parameter values\r\n */\r\n getParameterValues(): Record<string, ParameterValue>;\r\n /**\r\n * Get parameter groups (for UI generation)\r\n */\r\n getParameterGroups(): ParameterGroup[];\r\n /**\r\n * Get current core capabilities (what's currently active)\r\n */\r\n getCapabilities(): CoreCapabilities;\r\n /**\r\n * Get parameter groups filtered by active capabilities\r\n */\r\n getVisibleParameterGroups(): ParameterGroup[];\r\n /**\r\n * Check if a specific parameter category is currently active\r\n */\r\n isCategoryActive(category: ParameterCategory): boolean;\r\n /**\r\n * Check if parameters have been initialized\r\n */\r\n get parametersReady(): boolean;\r\n /**\r\n * Send all current parameter values to worker (used for initial sync)\r\n */\r\n private syncAllParametersToWorker;\r\n /**\r\n * Add listener for when parameters are defined\r\n */\r\n onParametersDefined(listener: (groups: ParameterGroup[]) => void): void;\r\n /**\r\n * Remove parameter defined listener\r\n */\r\n offParametersDefined(listener: (groups: ParameterGroup[]) => void): void;\r\n /**\r\n * Add listener for parameter value changes\r\n */\r\n onParameterChange(parameterName: string, listener: (value: ParameterValue) => void): void;\r\n /**\r\n * Remove parameter change listener\r\n */\r\n offParameterChange(parameterName: string, listener: (value: ParameterValue) => void): void;\r\n /**\r\n * Add listener for parameter errors\r\n */\r\n onParameterError(listener: (error: {\r\n message: string;\r\n code: string;\r\n }) => void): void;\r\n /**\r\n * Add listener for when core capabilities change (audio/video/interaction state)\r\n */\r\n onCapabilitiesChange(listener: (capabilities: CoreCapabilities) => void): void;\r\n /**\r\n * Remove capabilities change listener\r\n */\r\n removeCapabilitiesListener(listener: (capabilities: CoreCapabilities) => void): void;\r\n /**\r\n * Notify capability change listeners\r\n */\r\n private notifyCapabilitiesChange;\r\n /**\r\n * Remove parameter error listener\r\n */\r\n offParameterError(listener: (error: {\r\n message: string;\r\n code: string;\r\n }) => void): void;\r\n /**\r\n * Notify parameter change listeners\r\n */\r\n private notifyParameterListeners;\r\n /**\r\n * Sets the frame rate to full speed (every animation frame)\r\n */\r\n setFullFrameRate(): Promise<void>;\r\n /**\r\n * Sets the frame rate to half speed (every second animation frame)\r\n */\r\n setHalfFrameRate(): Promise<void>;\r\n /**\r\n * Updates the canvas resolution by sending effective dimensions to the worker\r\n */\r\n updateResolution(): void;\r\n /**\r\n * Sets the audio stream for analysis\r\n */\r\n setAudioStream(audioStream: MediaStream | null): Promise<void>;\r\n /**\r\n * Sets the video stream for processing\r\n */\r\n setVideoStream(videoStream: MediaStream | null): Promise<void>;\r\n /**\r\n * Gets the current audio stream\r\n */\r\n getAudioStream(): MediaStream | null;\r\n /**\r\n * Gets the current video stream\r\n */\r\n getVideoStream(): MediaStream | null;\r\n /**\r\n * Enables or disables user interactions (mouse, keyboard, touch) at runtime\r\n */\r\n setInteractionEnabled(enabled: boolean): Promise<void>;\r\n /**\r\n * Gets the current interaction enabled state\r\n */\r\n getInteractionEnabled(): boolean;\r\n /**\r\n * Updates audio analysis configuration\r\n */\r\n setAudioAnalysisConfig(config: {\r\n fftSize?: number;\r\n smoothing?: number;\r\n }): Promise<void>;\r\n /**\r\n * Updates the canvas resolution by scale\r\n */\r\n setResolution(scale: number): void;\r\n /**\r\n * Detects the screen refresh rate\r\n */\r\n private detectScreenRefreshRate;\r\n /**\r\n * Updates frame rate statistics\r\n */\r\n private updateFrameRateStats;\r\n /**\r\n * Gets current performance statistics\r\n */\r\n getStats(): PerformanceStats;\r\n /**\r\n * Checks if the core is ready for use\r\n */\r\n get ready(): boolean;\r\n /**\r\n * Gets the current configuration\r\n */\r\n get configuration(): Readonly<VijiCoreConfig>;\r\n /**\r\n * Destroys the core instance and cleans up all resources\r\n */\r\n destroy(): Promise<void>;\r\n /**\r\n * Validates that the core is ready for operations\r\n */\r\n private validateReady;\r\n /**\r\n * Validates the provided configuration\r\n */\r\n private validateConfig;\r\n /**\r\n * Cleans up all resources\r\n */\r\n private cleanup;\r\n}\r\n\r\ndeclare interface VijiCoreConfig {\r\n /** Container element where the scene will be rendered */\r\n hostContainer: HTMLElement;\r\n /** Artist scene code to execute */\r\n sceneCode: string;\r\n /** Frame rate mode - 'full' for every animation frame, 'half' for every second frame */\r\n frameRateMode?: FrameRateMode;\r\n /** Enable automatic performance optimization */\r\n autoOptimize?: boolean;\r\n /** Audio input stream */\r\n audioStream?: MediaStream;\r\n /** Video input stream */\r\n videoStream?: MediaStream;\r\n /** Audio analysis configuration */\r\n analysisConfig?: AnalysisConfiguration;\r\n /** Initial parameter values */\r\n parameters?: ParameterGroup[];\r\n /** Disable input processing (for preview instances) */\r\n noInputs?: boolean;\r\n /** Enable user interaction events */\r\n allowUserInteraction?: boolean;\r\n}\r\n\r\ndeclare class VijiCoreError extends Error {\r\n code: string;\r\n context?: any | undefined;\r\n constructor(message: string, code: string, context?: any | undefined);\r\n}\r\n\r\n{ }\r\n\n}\n\ndeclare const viji: VijiCore.ArtistAPI;\n";
|
package/dist/artist-global.d.ts
CHANGED
|
@@ -36,6 +36,13 @@ declare interface CaptureFrameOptions {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
declare interface ColorConfig {
|
|
40
|
+
label: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
group?: string;
|
|
43
|
+
category?: ParameterCategory;
|
|
44
|
+
}
|
|
45
|
+
|
|
39
46
|
declare interface ColorParameter {
|
|
40
47
|
value: string;
|
|
41
48
|
label: string;
|
|
@@ -133,6 +140,16 @@ declare interface MouseAPI {
|
|
|
133
140
|
wasMoved: boolean;
|
|
134
141
|
}
|
|
135
142
|
|
|
143
|
+
declare interface NumberConfig {
|
|
144
|
+
min?: number;
|
|
145
|
+
max?: number;
|
|
146
|
+
step?: number;
|
|
147
|
+
label: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
group?: string;
|
|
150
|
+
category?: ParameterCategory;
|
|
151
|
+
}
|
|
152
|
+
|
|
136
153
|
declare interface NumberParameter {
|
|
137
154
|
value: number;
|
|
138
155
|
min: number;
|
|
@@ -200,6 +217,14 @@ declare type Resolution = {
|
|
|
200
217
|
height: number;
|
|
201
218
|
};
|
|
202
219
|
|
|
220
|
+
declare interface SelectConfig {
|
|
221
|
+
options: string[] | number[];
|
|
222
|
+
label: string;
|
|
223
|
+
description?: string;
|
|
224
|
+
group?: string;
|
|
225
|
+
category?: ParameterCategory;
|
|
226
|
+
}
|
|
227
|
+
|
|
203
228
|
declare interface SelectParameter {
|
|
204
229
|
value: string | number;
|
|
205
230
|
options: string[] | number[];
|
|
@@ -209,6 +234,16 @@ declare interface SelectParameter {
|
|
|
209
234
|
category: ParameterCategory;
|
|
210
235
|
}
|
|
211
236
|
|
|
237
|
+
declare interface SliderConfig {
|
|
238
|
+
min?: number;
|
|
239
|
+
max?: number;
|
|
240
|
+
step?: number;
|
|
241
|
+
label: string;
|
|
242
|
+
description?: string;
|
|
243
|
+
group?: string;
|
|
244
|
+
category?: ParameterCategory;
|
|
245
|
+
}
|
|
246
|
+
|
|
212
247
|
declare interface SliderParameter {
|
|
213
248
|
value: number;
|
|
214
249
|
min: number;
|
|
@@ -220,6 +255,14 @@ declare interface SliderParameter {
|
|
|
220
255
|
category: ParameterCategory;
|
|
221
256
|
}
|
|
222
257
|
|
|
258
|
+
declare interface TextConfig {
|
|
259
|
+
label: string;
|
|
260
|
+
description?: string;
|
|
261
|
+
group?: string;
|
|
262
|
+
category?: ParameterCategory;
|
|
263
|
+
maxLength?: number;
|
|
264
|
+
}
|
|
265
|
+
|
|
223
266
|
declare interface TextParameter {
|
|
224
267
|
value: string;
|
|
225
268
|
maxLength?: number;
|
|
@@ -229,6 +272,13 @@ declare interface TextParameter {
|
|
|
229
272
|
category: ParameterCategory;
|
|
230
273
|
}
|
|
231
274
|
|
|
275
|
+
declare interface ToggleConfig {
|
|
276
|
+
label: string;
|
|
277
|
+
description?: string;
|
|
278
|
+
group?: string;
|
|
279
|
+
category?: ParameterCategory;
|
|
280
|
+
}
|
|
281
|
+
|
|
232
282
|
declare interface ToggleParameter {
|
|
233
283
|
value: boolean;
|
|
234
284
|
label: string;
|
|
@@ -318,13 +368,13 @@ declare interface VijiAPI {
|
|
|
318
368
|
mouse: MouseAPI;
|
|
319
369
|
keyboard: KeyboardAPI;
|
|
320
370
|
touches: TouchAPI[];
|
|
321
|
-
slider: (defaultValue: number, config:
|
|
322
|
-
color: (defaultValue: string, config:
|
|
323
|
-
toggle: (defaultValue: boolean, config:
|
|
324
|
-
select: (defaultValue: string | number, config:
|
|
325
|
-
text: (defaultValue: string, config:
|
|
326
|
-
number: (defaultValue: number, config:
|
|
327
|
-
useContext(type: '2d' | 'webgl'): OffscreenCanvasRenderingContext2D | WebGL2RenderingContext;
|
|
371
|
+
slider: (defaultValue: number, config: SliderConfig) => SliderParameter;
|
|
372
|
+
color: (defaultValue: string, config: ColorConfig) => ColorParameter;
|
|
373
|
+
toggle: (defaultValue: boolean, config: ToggleConfig) => ToggleParameter;
|
|
374
|
+
select: (defaultValue: string | number, config: SelectConfig) => SelectParameter;
|
|
375
|
+
text: (defaultValue: string, config: TextConfig) => TextParameter;
|
|
376
|
+
number: (defaultValue: number, config: NumberConfig) => NumberParameter;
|
|
377
|
+
useContext(type: '2d' | 'webgl'): OffscreenCanvasRenderingContext2D | WebGLRenderingContext | WebGL2RenderingContext | null;
|
|
328
378
|
}
|
|
329
379
|
|
|
330
380
|
/**
|