@viji-dev/core 0.2.4 → 0.2.5
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/LICENSE +12 -0
- package/README.md +5 -3
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global.d.ts +313 -659
- package/dist/artist-jsdoc.d.ts +235 -0
- package/package.json +6 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2025 Artem Verkhovskiy and Dmitry Manoilenko.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Permission is granted to install and use this software only for the purpose
|
|
5
|
+
of developing and running creative scenes within the VIJI platform environment.
|
|
6
|
+
|
|
7
|
+
Commercial use, redistribution, or integration of this software into external
|
|
8
|
+
applications, platforms, or services is strictly prohibited without prior written
|
|
9
|
+
permission from the copyright holders.
|
|
10
|
+
|
|
11
|
+
This license does not grant any rights to copy, modify, sublicense, or
|
|
12
|
+
commercialize the VIJI Core, nor to use the VIJI name or brand without permission.
|
package/README.md
CHANGED
|
@@ -1184,11 +1184,13 @@ Use the core directly in custom applications for creative scene rendering with f
|
|
|
1184
1184
|
|
|
1185
1185
|
## 📄 License
|
|
1186
1186
|
|
|
1187
|
-
|
|
1187
|
+
Copyright (c) 2025 Artem Verkhovskiy and Dmitry Manoilenko.
|
|
1188
|
+
All rights reserved - see the LICENSE file for details.
|
|
1188
1189
|
|
|
1189
|
-
##
|
|
1190
|
+
## Contributor License Agreement
|
|
1190
1191
|
|
|
1191
|
-
|
|
1192
|
+
By contributing, you agree to the [CLA](./CLA.md).
|
|
1193
|
+
Please also confirm your agreement by filling out this short [form](https://forms.gle/A49WTz8nj5b99Yev7).
|
|
1192
1194
|
|
|
1193
1195
|
---
|
|
1194
1196
|
|
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 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.2.4\";\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 * Get all parameter groups without capability filtering.\r\n * Returns a deep-cloned structure to prevent external mutation.\r\n */\r\n getAllParameterGroups(): 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\n// Global artist runtime symbols for editor IntelliSense\ndeclare const viji: VijiCore.ArtistAPI;\ndeclare function render(viji: VijiCore.ArtistAPI): void;\n";
|
|
1
|
+
export const artistDts = "declare namespace VijiCore {\n declare 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\n declare 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\n declare 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\n declare interface ColorConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n declare 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\n declare 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\n declare type FrameRateMode = 'full' | 'half';\r\n\n declare interface FrequencyBand {\r\n name: string;\r\n min: number;\r\n max: number;\r\n }\r\n\n declare 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\n declare 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\n declare 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\n declare 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\n declare 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\n declare type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';\r\n\n declare type Resolution = {\r\n width: number;\r\n height: number;\r\n };\r\n\n declare 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\n declare 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\n declare 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\n declare 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\n declare 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\n declare 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\n declare interface ToggleConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n declare 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\n declare 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\n declare 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\n declare 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\n declare const VERSION = \"0.2.4\";\r\n\n declare 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\n declare 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'): OffscreenCanvasRenderingContext2D;\n useContext(type: 'webgl'): WebGLRenderingContext | WebGL2RenderingContext;\r\n }\r\n}\n\ndeclare const viji: VijiCore.VijiAPI;\ndeclare function render(viji: VijiCore.VijiAPI): void;\n";
|
package/dist/artist-global.d.ts
CHANGED
|
@@ -1,663 +1,317 @@
|
|
|
1
1
|
declare namespace VijiCore {
|
|
2
|
-
declare interface AnalysisConfiguration {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare interface AudioAPI {
|
|
11
|
-
isConnected: boolean;
|
|
12
|
-
volume: {
|
|
13
|
-
rms: number;
|
|
14
|
-
peak: number;
|
|
15
|
-
};
|
|
16
|
-
beat?: {
|
|
17
|
-
isKick: boolean;
|
|
18
|
-
confidence: number;
|
|
19
|
-
};
|
|
20
|
-
bands: Record<string, number>;
|
|
21
|
-
getFrequencyData: () => Uint8Array;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare interface CaptureFrameOptions {
|
|
25
|
-
/** MIME type for output, e.g., 'image/png', 'image/jpeg', 'image/webp' */
|
|
26
|
-
type?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Target resolution.
|
|
29
|
-
* - number: scale factor relative to current canvas size (e.g., 0.5 = 50%)
|
|
30
|
-
* - { width, height }: exact output size; if aspect ratio differs from canvas,
|
|
31
|
-
* the source is center-cropped to match the target aspect ratio before scaling
|
|
32
|
-
*/
|
|
33
|
-
resolution?: number | {
|
|
34
|
-
width: number;
|
|
35
|
-
height: number;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
declare interface ColorConfig {
|
|
40
|
-
label: string;
|
|
41
|
-
description?: string;
|
|
42
|
-
group?: string;
|
|
43
|
-
category?: ParameterCategory;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
declare interface ColorParameter {
|
|
47
|
-
value: string;
|
|
48
|
-
label: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
group: string;
|
|
51
|
-
category: ParameterCategory;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
declare interface CoreCapabilities {
|
|
55
|
-
/** Audio input is active and connected */
|
|
56
|
-
hasAudio: boolean;
|
|
57
|
-
/** Video input is active and connected */
|
|
58
|
-
hasVideo: boolean;
|
|
59
|
-
/** User interactions (mouse, touch, keyboard) are enabled */
|
|
60
|
-
hasInteraction: boolean;
|
|
61
|
-
/** General parameters are always available */
|
|
62
|
-
hasGeneral: boolean;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare interface FaceData {
|
|
66
|
-
bounds: {
|
|
67
|
-
x: number;
|
|
68
|
-
y: number;
|
|
69
|
-
width: number;
|
|
70
|
-
height: number;
|
|
71
|
-
};
|
|
72
|
-
confidence: number;
|
|
73
|
-
landmarks: {
|
|
74
|
-
x: number;
|
|
75
|
-
y: number;
|
|
76
|
-
}[];
|
|
77
|
-
expressions: Record<string, number>;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
declare interface FrameRateInfo {
|
|
81
|
-
mode: FrameRateMode;
|
|
82
|
-
screenRefreshRate: number;
|
|
83
|
-
effectiveRefreshRate: number;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
declare type FrameRateMode = 'full' | 'half';
|
|
87
|
-
|
|
88
|
-
declare interface FrequencyBand {
|
|
89
|
-
name: string;
|
|
90
|
-
min: number;
|
|
91
|
-
max: number;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
declare interface HandData {
|
|
95
|
-
palm: {
|
|
96
|
-
x: number;
|
|
97
|
-
y: number;
|
|
98
|
-
};
|
|
99
|
-
fingers: {
|
|
100
|
-
x: number;
|
|
101
|
-
y: number;
|
|
102
|
-
}[];
|
|
103
|
-
gestures: Record<string, boolean>;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
declare interface KeyboardAPI {
|
|
107
|
-
isPressed(key: string): boolean;
|
|
108
|
-
wasPressed(key: string): boolean;
|
|
109
|
-
wasReleased(key: string): boolean;
|
|
110
|
-
activeKeys: Set<string>;
|
|
111
|
-
pressedThisFrame: Set<string>;
|
|
112
|
-
releasedThisFrame: Set<string>;
|
|
113
|
-
lastKeyPressed: string;
|
|
114
|
-
lastKeyReleased: string;
|
|
115
|
-
shift: boolean;
|
|
116
|
-
ctrl: boolean;
|
|
117
|
-
alt: boolean;
|
|
118
|
-
meta: boolean;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
declare interface MouseAPI {
|
|
122
|
-
x: number;
|
|
123
|
-
y: number;
|
|
124
|
-
isInCanvas: boolean;
|
|
125
|
-
isPressed: boolean;
|
|
126
|
-
leftButton: boolean;
|
|
127
|
-
rightButton: boolean;
|
|
128
|
-
middleButton: boolean;
|
|
129
|
-
velocity: {
|
|
130
|
-
x: number;
|
|
131
|
-
y: number;
|
|
132
|
-
};
|
|
133
|
-
deltaX: number;
|
|
134
|
-
deltaY: number;
|
|
135
|
-
wheelDelta: number;
|
|
136
|
-
wheelX: number;
|
|
137
|
-
wheelY: number;
|
|
138
|
-
wasPressed: boolean;
|
|
139
|
-
wasReleased: boolean;
|
|
140
|
-
wasMoved: boolean;
|
|
141
|
-
}
|
|
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
|
-
|
|
153
|
-
declare interface NumberParameter {
|
|
154
|
-
value: number;
|
|
155
|
-
min: number;
|
|
156
|
-
max: number;
|
|
157
|
-
step: number;
|
|
158
|
-
label: string;
|
|
159
|
-
description?: string;
|
|
160
|
-
group: string;
|
|
161
|
-
category: ParameterCategory;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
declare interface ParameterAPI {
|
|
165
|
-
define(groups: ParameterGroup[]): void;
|
|
166
|
-
[key: string]: any;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
declare type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';
|
|
170
|
-
|
|
171
|
-
declare interface ParameterConfig {
|
|
172
|
-
min?: number;
|
|
173
|
-
max?: number;
|
|
174
|
-
step?: number;
|
|
175
|
-
options?: string[] | number[];
|
|
176
|
-
maxLength?: number;
|
|
177
|
-
label?: string;
|
|
178
|
-
description?: string;
|
|
179
|
-
hidden?: boolean;
|
|
180
|
-
precision?: number;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
declare interface ParameterDefinition {
|
|
184
|
-
type: 'slider' | 'color' | 'toggle' | 'select' | 'text' | 'number';
|
|
185
|
-
defaultValue: any;
|
|
186
|
-
label?: string;
|
|
187
|
-
description?: string;
|
|
188
|
-
group?: string;
|
|
189
|
-
category?: ParameterCategory;
|
|
190
|
-
config?: ParameterConfig;
|
|
191
|
-
validate?: (value: any) => boolean;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
declare interface ParameterGroup {
|
|
195
|
-
groupName: string;
|
|
196
|
-
category?: ParameterCategory;
|
|
197
|
-
description?: string;
|
|
198
|
-
collapsed?: boolean;
|
|
199
|
-
order?: number;
|
|
200
|
-
parameters: Record<string, ParameterDefinition>;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
declare type ParameterValue = string | number | boolean;
|
|
204
|
-
|
|
205
|
-
declare interface PerformanceStats {
|
|
206
|
-
frameTime: number;
|
|
207
|
-
resolution: Resolution;
|
|
208
|
-
scale: number;
|
|
209
|
-
frameRate: FrameRateInfo;
|
|
210
|
-
memoryUsage?: number;
|
|
211
|
-
activeStreams?: number;
|
|
212
|
-
parameterCount?: number;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
declare type Resolution = {
|
|
216
|
-
width: number;
|
|
217
|
-
height: number;
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
declare interface SelectConfig {
|
|
221
|
-
options: string[] | number[];
|
|
222
|
-
label: string;
|
|
223
|
-
description?: string;
|
|
224
|
-
group?: string;
|
|
225
|
-
category?: ParameterCategory;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
declare interface SelectParameter {
|
|
229
|
-
value: string | number;
|
|
230
|
-
options: string[] | number[];
|
|
231
|
-
label: string;
|
|
232
|
-
description?: string;
|
|
233
|
-
group: string;
|
|
234
|
-
category: ParameterCategory;
|
|
235
|
-
}
|
|
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
|
-
|
|
247
|
-
declare interface SliderParameter {
|
|
248
|
-
value: number;
|
|
249
|
-
min: number;
|
|
250
|
-
max: number;
|
|
251
|
-
step: number;
|
|
252
|
-
label: string;
|
|
253
|
-
description?: string;
|
|
254
|
-
group: string;
|
|
255
|
-
category: ParameterCategory;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
declare interface TextConfig {
|
|
259
|
-
label: string;
|
|
260
|
-
description?: string;
|
|
261
|
-
group?: string;
|
|
262
|
-
category?: ParameterCategory;
|
|
263
|
-
maxLength?: number;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
declare interface TextParameter {
|
|
267
|
-
value: string;
|
|
268
|
-
maxLength?: number;
|
|
269
|
-
label: string;
|
|
270
|
-
description?: string;
|
|
271
|
-
group: string;
|
|
272
|
-
category: ParameterCategory;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
declare interface ToggleConfig {
|
|
276
|
-
label: string;
|
|
277
|
-
description?: string;
|
|
278
|
-
group?: string;
|
|
279
|
-
category?: ParameterCategory;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
declare interface ToggleParameter {
|
|
283
|
-
value: boolean;
|
|
284
|
-
label: string;
|
|
285
|
-
description?: string;
|
|
286
|
-
group: string;
|
|
287
|
-
category: ParameterCategory;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
declare interface TouchAPI {
|
|
291
|
-
points: TouchPoint[];
|
|
292
|
-
count: number;
|
|
293
|
-
started: TouchPoint[];
|
|
294
|
-
moved: TouchPoint[];
|
|
295
|
-
ended: TouchPoint[];
|
|
296
|
-
primary: TouchPoint | null;
|
|
297
|
-
gestures: TouchGestureAPI;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
declare interface TouchGestureAPI {
|
|
301
|
-
isPinching: boolean;
|
|
302
|
-
isRotating: boolean;
|
|
303
|
-
isPanning: boolean;
|
|
304
|
-
isTapping: boolean;
|
|
305
|
-
pinchScale: number;
|
|
306
|
-
pinchDelta: number;
|
|
307
|
-
rotationAngle: number;
|
|
308
|
-
rotationDelta: number;
|
|
309
|
-
panDelta: {
|
|
310
|
-
x: number;
|
|
311
|
-
y: number;
|
|
312
|
-
};
|
|
313
|
-
tapCount: number;
|
|
314
|
-
lastTapTime: number;
|
|
315
|
-
tapPosition: {
|
|
316
|
-
x: number;
|
|
317
|
-
y: number;
|
|
318
|
-
} | null;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
declare interface TouchPoint {
|
|
322
|
-
id: number;
|
|
323
|
-
x: number;
|
|
324
|
-
y: number;
|
|
325
|
-
pressure: number;
|
|
326
|
-
radius: number;
|
|
327
|
-
radiusX: number;
|
|
328
|
-
radiusY: number;
|
|
329
|
-
rotationAngle: number;
|
|
330
|
-
force: number;
|
|
331
|
-
deltaX: number;
|
|
332
|
-
deltaY: number;
|
|
333
|
-
velocity: {
|
|
334
|
-
x: number;
|
|
335
|
-
y: number;
|
|
336
|
-
};
|
|
337
|
-
isNew: boolean;
|
|
338
|
-
isActive: boolean;
|
|
339
|
-
isEnding: boolean;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
declare const VERSION = "0.2.4";
|
|
343
|
-
|
|
344
|
-
declare interface VideoAPI {
|
|
345
|
-
isConnected: boolean;
|
|
346
|
-
currentFrame: OffscreenCanvas | null;
|
|
347
|
-
frameWidth: number;
|
|
348
|
-
frameHeight: number;
|
|
349
|
-
frameRate: number;
|
|
350
|
-
getFrameData: () => ImageData | null;
|
|
351
|
-
faces: FaceData[];
|
|
352
|
-
hands: HandData[];
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
declare interface VijiAPI {
|
|
356
|
-
canvas: OffscreenCanvas;
|
|
357
|
-
ctx?: OffscreenCanvasRenderingContext2D;
|
|
358
|
-
gl?: WebGL2RenderingContext;
|
|
359
|
-
width: number;
|
|
360
|
-
height: number;
|
|
361
|
-
pixelRatio: number;
|
|
362
|
-
time: number;
|
|
363
|
-
deltaTime: number;
|
|
364
|
-
frameCount: number;
|
|
365
|
-
fps: number;
|
|
366
|
-
audio: AudioAPI;
|
|
367
|
-
video: VideoAPI;
|
|
368
|
-
mouse: MouseAPI;
|
|
369
|
-
keyboard: KeyboardAPI;
|
|
370
|
-
touches: TouchAPI[];
|
|
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;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Main VijiCore class - Universal execution engine for creative scenes.
|
|
382
|
-
*
|
|
383
|
-
* Orchestrates secure IFrame + WebWorker execution with controlled communication.
|
|
384
|
-
* Provides the foundation for scene execution across platform and SDK contexts.
|
|
385
|
-
*/
|
|
386
|
-
declare class VijiCore {
|
|
387
|
-
private iframeManager;
|
|
388
|
-
private workerManager;
|
|
389
|
-
private interactionManager;
|
|
390
|
-
private audioSystem;
|
|
391
|
-
private videoCoordinator;
|
|
392
|
-
private isInitialized;
|
|
393
|
-
private isDestroyed;
|
|
394
|
-
private isInitializing;
|
|
395
|
-
private instanceId;
|
|
396
|
-
private screenRefreshRate;
|
|
397
|
-
private debugMode;
|
|
398
|
-
/**
|
|
399
|
-
* Debug logging helper
|
|
400
|
-
*/
|
|
401
|
-
private debugLog;
|
|
402
|
-
private config;
|
|
403
|
-
private currentAudioStream;
|
|
404
|
-
private currentVideoStream;
|
|
405
|
-
private currentInteractionEnabled;
|
|
406
|
-
private parameterGroups;
|
|
407
|
-
private parameterValues;
|
|
408
|
-
private parametersInitialized;
|
|
409
|
-
private parameterListeners;
|
|
410
|
-
private parameterDefinedListeners;
|
|
411
|
-
private parameterErrorListeners;
|
|
412
|
-
private capabilitiesChangeListeners;
|
|
413
|
-
private stats;
|
|
414
|
-
constructor(config: VijiCoreConfig);
|
|
415
|
-
/**
|
|
416
|
-
* Capture current scene frame as an image Blob.
|
|
417
|
-
* Resolution can be a scale (0-1+) or explicit width/height with center-crop.
|
|
418
|
-
*/
|
|
419
|
-
captureFrame(options?: CaptureFrameOptions): Promise<Blob>;
|
|
420
|
-
/**
|
|
421
|
-
* Enable or disable debug logging
|
|
422
|
-
*/
|
|
423
|
-
setDebugMode(enabled: boolean): void;
|
|
424
|
-
/**
|
|
425
|
-
* Get current debug mode status
|
|
426
|
-
*/
|
|
427
|
-
getDebugMode(): boolean;
|
|
428
|
-
/**
|
|
429
|
-
* Initializes the core components in sequence
|
|
430
|
-
*/
|
|
431
|
-
initialize(): Promise<void>;
|
|
432
|
-
/**
|
|
433
|
-
* Creates canvas with retry logic to handle timing issues
|
|
434
|
-
*/
|
|
435
|
-
private createCanvasWithRetry;
|
|
436
|
-
/**
|
|
437
|
-
* Sets up the interaction system for Phase 7
|
|
438
|
-
*/
|
|
439
|
-
private setupInteractionSystem;
|
|
440
|
-
/**
|
|
441
|
-
* Sets up communication between components
|
|
442
|
-
*/
|
|
443
|
-
private setupCommunication;
|
|
444
|
-
/**
|
|
445
|
-
* Handle parameter definitions received from worker
|
|
446
|
-
*/
|
|
447
|
-
private handleParametersDefined;
|
|
448
|
-
/**
|
|
449
|
-
* Handle parameter validation errors
|
|
450
|
-
*/
|
|
451
|
-
private handleParameterError;
|
|
452
|
-
/**
|
|
453
|
-
* Set a single parameter value
|
|
454
|
-
*/
|
|
455
|
-
setParameter(name: string, value: ParameterValue): Promise<void>;
|
|
456
|
-
/**
|
|
457
|
-
* Set multiple parameter values efficiently
|
|
458
|
-
*/
|
|
459
|
-
setParameters(values: Record<string, ParameterValue>): Promise<void>;
|
|
460
|
-
/**
|
|
461
|
-
* Get current parameter value
|
|
462
|
-
*/
|
|
463
|
-
getParameter(name: string): ParameterValue | undefined;
|
|
464
|
-
/**
|
|
465
|
-
* Get all current parameter values
|
|
466
|
-
*/
|
|
467
|
-
getParameterValues(): Record<string, ParameterValue>;
|
|
468
|
-
/**
|
|
469
|
-
* Get parameter groups (for UI generation)
|
|
470
|
-
*/
|
|
471
|
-
getParameterGroups(): ParameterGroup[];
|
|
472
|
-
/**
|
|
473
|
-
* Get current core capabilities (what's currently active)
|
|
474
|
-
*/
|
|
475
|
-
getCapabilities(): CoreCapabilities;
|
|
476
|
-
/**
|
|
477
|
-
* Get parameter groups filtered by active capabilities
|
|
478
|
-
*/
|
|
479
|
-
getVisibleParameterGroups(): ParameterGroup[];
|
|
480
|
-
/**
|
|
481
|
-
* Get all parameter groups without capability filtering.
|
|
482
|
-
* Returns a deep-cloned structure to prevent external mutation.
|
|
483
|
-
*/
|
|
484
|
-
getAllParameterGroups(): ParameterGroup[];
|
|
485
|
-
/**
|
|
486
|
-
* Check if a specific parameter category is currently active
|
|
487
|
-
*/
|
|
488
|
-
isCategoryActive(category: ParameterCategory): boolean;
|
|
489
|
-
/**
|
|
490
|
-
* Check if parameters have been initialized
|
|
491
|
-
*/
|
|
492
|
-
get parametersReady(): boolean;
|
|
493
|
-
/**
|
|
494
|
-
* Send all current parameter values to worker (used for initial sync)
|
|
495
|
-
*/
|
|
496
|
-
private syncAllParametersToWorker;
|
|
497
|
-
/**
|
|
498
|
-
* Add listener for when parameters are defined
|
|
499
|
-
*/
|
|
500
|
-
onParametersDefined(listener: (groups: ParameterGroup[]) => void): void;
|
|
501
|
-
/**
|
|
502
|
-
* Remove parameter defined listener
|
|
503
|
-
*/
|
|
504
|
-
offParametersDefined(listener: (groups: ParameterGroup[]) => void): void;
|
|
505
|
-
/**
|
|
506
|
-
* Add listener for parameter value changes
|
|
507
|
-
*/
|
|
508
|
-
onParameterChange(parameterName: string, listener: (value: ParameterValue) => void): void;
|
|
509
|
-
/**
|
|
510
|
-
* Remove parameter change listener
|
|
511
|
-
*/
|
|
512
|
-
offParameterChange(parameterName: string, listener: (value: ParameterValue) => void): void;
|
|
513
|
-
/**
|
|
514
|
-
* Add listener for parameter errors
|
|
515
|
-
*/
|
|
516
|
-
onParameterError(listener: (error: {
|
|
517
|
-
message: string;
|
|
518
|
-
code: string;
|
|
519
|
-
}) => void): void;
|
|
520
|
-
/**
|
|
521
|
-
* Add listener for when core capabilities change (audio/video/interaction state)
|
|
522
|
-
*/
|
|
523
|
-
onCapabilitiesChange(listener: (capabilities: CoreCapabilities) => void): void;
|
|
524
|
-
/**
|
|
525
|
-
* Remove capabilities change listener
|
|
526
|
-
*/
|
|
527
|
-
removeCapabilitiesListener(listener: (capabilities: CoreCapabilities) => void): void;
|
|
528
|
-
/**
|
|
529
|
-
* Notify capability change listeners
|
|
530
|
-
*/
|
|
531
|
-
private notifyCapabilitiesChange;
|
|
532
|
-
/**
|
|
533
|
-
* Remove parameter error listener
|
|
534
|
-
*/
|
|
535
|
-
offParameterError(listener: (error: {
|
|
536
|
-
message: string;
|
|
537
|
-
code: string;
|
|
538
|
-
}) => void): void;
|
|
539
|
-
/**
|
|
540
|
-
* Notify parameter change listeners
|
|
541
|
-
*/
|
|
542
|
-
private notifyParameterListeners;
|
|
543
|
-
/**
|
|
544
|
-
* Sets the frame rate to full speed (every animation frame)
|
|
545
|
-
*/
|
|
546
|
-
setFullFrameRate(): Promise<void>;
|
|
547
|
-
/**
|
|
548
|
-
* Sets the frame rate to half speed (every second animation frame)
|
|
549
|
-
*/
|
|
550
|
-
setHalfFrameRate(): Promise<void>;
|
|
551
|
-
/**
|
|
552
|
-
* Updates the canvas resolution by sending effective dimensions to the worker
|
|
553
|
-
*/
|
|
554
|
-
updateResolution(): void;
|
|
555
|
-
/**
|
|
556
|
-
* Sets the audio stream for analysis
|
|
557
|
-
*/
|
|
558
|
-
setAudioStream(audioStream: MediaStream | null): Promise<void>;
|
|
559
|
-
/**
|
|
560
|
-
* Sets the video stream for processing
|
|
561
|
-
*/
|
|
562
|
-
setVideoStream(videoStream: MediaStream | null): Promise<void>;
|
|
563
|
-
/**
|
|
564
|
-
* Gets the current audio stream
|
|
565
|
-
*/
|
|
566
|
-
getAudioStream(): MediaStream | null;
|
|
567
|
-
/**
|
|
568
|
-
* Gets the current video stream
|
|
569
|
-
*/
|
|
570
|
-
getVideoStream(): MediaStream | null;
|
|
571
|
-
/**
|
|
572
|
-
* Enables or disables user interactions (mouse, keyboard, touch) at runtime
|
|
573
|
-
*/
|
|
574
|
-
setInteractionEnabled(enabled: boolean): Promise<void>;
|
|
575
|
-
/**
|
|
576
|
-
* Gets the current interaction enabled state
|
|
577
|
-
*/
|
|
578
|
-
getInteractionEnabled(): boolean;
|
|
579
|
-
/**
|
|
580
|
-
* Updates audio analysis configuration
|
|
581
|
-
*/
|
|
582
|
-
setAudioAnalysisConfig(config: {
|
|
583
|
-
fftSize?: number;
|
|
584
|
-
smoothing?: number;
|
|
585
|
-
}): Promise<void>;
|
|
586
|
-
/**
|
|
587
|
-
* Updates the canvas resolution by scale
|
|
588
|
-
*/
|
|
589
|
-
setResolution(scale: number): void;
|
|
590
|
-
/**
|
|
591
|
-
* Detects the screen refresh rate
|
|
592
|
-
*/
|
|
593
|
-
private detectScreenRefreshRate;
|
|
594
|
-
/**
|
|
595
|
-
* Updates frame rate statistics
|
|
596
|
-
*/
|
|
597
|
-
private updateFrameRateStats;
|
|
598
|
-
/**
|
|
599
|
-
* Gets current performance statistics
|
|
600
|
-
*/
|
|
601
|
-
getStats(): PerformanceStats;
|
|
602
|
-
/**
|
|
603
|
-
* Checks if the core is ready for use
|
|
604
|
-
*/
|
|
605
|
-
get ready(): boolean;
|
|
606
|
-
/**
|
|
607
|
-
* Gets the current configuration
|
|
608
|
-
*/
|
|
609
|
-
get configuration(): Readonly<VijiCoreConfig>;
|
|
610
|
-
/**
|
|
611
|
-
* Destroys the core instance and cleans up all resources
|
|
612
|
-
*/
|
|
613
|
-
destroy(): Promise<void>;
|
|
614
|
-
/**
|
|
615
|
-
* Validates that the core is ready for operations
|
|
616
|
-
*/
|
|
617
|
-
private validateReady;
|
|
618
|
-
/**
|
|
619
|
-
* Validates the provided configuration
|
|
620
|
-
*/
|
|
621
|
-
private validateConfig;
|
|
622
|
-
/**
|
|
623
|
-
* Cleans up all resources
|
|
624
|
-
*/
|
|
625
|
-
private cleanup;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
declare interface VijiCoreConfig {
|
|
629
|
-
/** Container element where the scene will be rendered */
|
|
630
|
-
hostContainer: HTMLElement;
|
|
631
|
-
/** Artist scene code to execute */
|
|
632
|
-
sceneCode: string;
|
|
633
|
-
/** Frame rate mode - 'full' for every animation frame, 'half' for every second frame */
|
|
634
|
-
frameRateMode?: FrameRateMode;
|
|
635
|
-
/** Enable automatic performance optimization */
|
|
636
|
-
autoOptimize?: boolean;
|
|
637
|
-
/** Audio input stream */
|
|
638
|
-
audioStream?: MediaStream;
|
|
639
|
-
/** Video input stream */
|
|
640
|
-
videoStream?: MediaStream;
|
|
641
|
-
/** Audio analysis configuration */
|
|
642
|
-
analysisConfig?: AnalysisConfiguration;
|
|
643
|
-
/** Initial parameter values */
|
|
644
|
-
parameters?: ParameterGroup[];
|
|
645
|
-
/** Disable input processing (for preview instances) */
|
|
646
|
-
noInputs?: boolean;
|
|
647
|
-
/** Enable user interaction events */
|
|
648
|
-
allowUserInteraction?: boolean;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
declare class VijiCoreError extends Error {
|
|
652
|
-
code: string;
|
|
653
|
-
context?: any | undefined;
|
|
654
|
-
constructor(message: string, code: string, context?: any | undefined);
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
{ }
|
|
2
|
+
declare interface AnalysisConfiguration {
|
|
3
|
+
fftSize?: number;
|
|
4
|
+
smoothing?: number;
|
|
5
|
+
frequencyBands?: FrequencyBand[];
|
|
6
|
+
beatDetection?: boolean;
|
|
7
|
+
onsetDetection?: boolean;
|
|
8
|
+
}
|
|
658
9
|
|
|
10
|
+
declare interface AudioAPI {
|
|
11
|
+
isConnected: boolean;
|
|
12
|
+
volume: {
|
|
13
|
+
rms: number;
|
|
14
|
+
peak: number;
|
|
15
|
+
};
|
|
16
|
+
beat?: {
|
|
17
|
+
isKick: boolean;
|
|
18
|
+
confidence: number;
|
|
19
|
+
};
|
|
20
|
+
bands: Record<string, number>;
|
|
21
|
+
getFrequencyData: () => Uint8Array;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare interface CaptureFrameOptions {
|
|
25
|
+
/** MIME type for output, e.g., 'image/png', 'image/jpeg', 'image/webp' */
|
|
26
|
+
type?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Target resolution.
|
|
29
|
+
* - number: scale factor relative to current canvas size (e.g., 0.5 = 50%)
|
|
30
|
+
* - { width, height }: exact output size; if aspect ratio differs from canvas,
|
|
31
|
+
* the source is center-cropped to match the target aspect ratio before scaling
|
|
32
|
+
*/
|
|
33
|
+
resolution?: number | {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare interface ColorConfig {
|
|
40
|
+
label: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
group?: string;
|
|
43
|
+
category?: ParameterCategory;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare interface ColorParameter {
|
|
47
|
+
value: string;
|
|
48
|
+
label: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
group: string;
|
|
51
|
+
category: ParameterCategory;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare interface FaceData {
|
|
55
|
+
bounds: {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
};
|
|
61
|
+
confidence: number;
|
|
62
|
+
landmarks: {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
}[];
|
|
66
|
+
expressions: Record<string, number>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare type FrameRateMode = 'full' | 'half';
|
|
70
|
+
|
|
71
|
+
declare interface FrequencyBand {
|
|
72
|
+
name: string;
|
|
73
|
+
min: number;
|
|
74
|
+
max: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare interface HandData {
|
|
78
|
+
palm: {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
};
|
|
82
|
+
fingers: {
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
}[];
|
|
86
|
+
gestures: Record<string, boolean>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare interface KeyboardAPI {
|
|
90
|
+
isPressed(key: string): boolean;
|
|
91
|
+
wasPressed(key: string): boolean;
|
|
92
|
+
wasReleased(key: string): boolean;
|
|
93
|
+
activeKeys: Set<string>;
|
|
94
|
+
pressedThisFrame: Set<string>;
|
|
95
|
+
releasedThisFrame: Set<string>;
|
|
96
|
+
lastKeyPressed: string;
|
|
97
|
+
lastKeyReleased: string;
|
|
98
|
+
shift: boolean;
|
|
99
|
+
ctrl: boolean;
|
|
100
|
+
alt: boolean;
|
|
101
|
+
meta: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare interface MouseAPI {
|
|
105
|
+
x: number;
|
|
106
|
+
y: number;
|
|
107
|
+
isInCanvas: boolean;
|
|
108
|
+
isPressed: boolean;
|
|
109
|
+
leftButton: boolean;
|
|
110
|
+
rightButton: boolean;
|
|
111
|
+
middleButton: boolean;
|
|
112
|
+
velocity: {
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
};
|
|
116
|
+
deltaX: number;
|
|
117
|
+
deltaY: number;
|
|
118
|
+
wheelDelta: number;
|
|
119
|
+
wheelX: number;
|
|
120
|
+
wheelY: number;
|
|
121
|
+
wasPressed: boolean;
|
|
122
|
+
wasReleased: boolean;
|
|
123
|
+
wasMoved: boolean;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare interface NumberConfig {
|
|
127
|
+
min?: number;
|
|
128
|
+
max?: number;
|
|
129
|
+
step?: number;
|
|
130
|
+
label: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
group?: string;
|
|
133
|
+
category?: ParameterCategory;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare interface NumberParameter {
|
|
137
|
+
value: number;
|
|
138
|
+
min: number;
|
|
139
|
+
max: number;
|
|
140
|
+
step: number;
|
|
141
|
+
label: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
group: string;
|
|
144
|
+
category: ParameterCategory;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
declare type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';
|
|
148
|
+
|
|
149
|
+
declare type Resolution = {
|
|
150
|
+
width: number;
|
|
151
|
+
height: number;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
declare interface SelectConfig {
|
|
155
|
+
options: string[] | number[];
|
|
156
|
+
label: string;
|
|
157
|
+
description?: string;
|
|
158
|
+
group?: string;
|
|
159
|
+
category?: ParameterCategory;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
declare interface SelectParameter {
|
|
163
|
+
value: string | number;
|
|
164
|
+
options: string[] | number[];
|
|
165
|
+
label: string;
|
|
166
|
+
description?: string;
|
|
167
|
+
group: string;
|
|
168
|
+
category: ParameterCategory;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare interface SliderConfig {
|
|
172
|
+
min?: number;
|
|
173
|
+
max?: number;
|
|
174
|
+
step?: number;
|
|
175
|
+
label: string;
|
|
176
|
+
description?: string;
|
|
177
|
+
group?: string;
|
|
178
|
+
category?: ParameterCategory;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare interface SliderParameter {
|
|
182
|
+
value: number;
|
|
183
|
+
min: number;
|
|
184
|
+
max: number;
|
|
185
|
+
step: number;
|
|
186
|
+
label: string;
|
|
187
|
+
description?: string;
|
|
188
|
+
group: string;
|
|
189
|
+
category: ParameterCategory;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare interface TextConfig {
|
|
193
|
+
label: string;
|
|
194
|
+
description?: string;
|
|
195
|
+
group?: string;
|
|
196
|
+
category?: ParameterCategory;
|
|
197
|
+
maxLength?: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare interface TextParameter {
|
|
201
|
+
value: string;
|
|
202
|
+
maxLength?: number;
|
|
203
|
+
label: string;
|
|
204
|
+
description?: string;
|
|
205
|
+
group: string;
|
|
206
|
+
category: ParameterCategory;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
declare interface ToggleConfig {
|
|
210
|
+
label: string;
|
|
211
|
+
description?: string;
|
|
212
|
+
group?: string;
|
|
213
|
+
category?: ParameterCategory;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
declare interface ToggleParameter {
|
|
217
|
+
value: boolean;
|
|
218
|
+
label: string;
|
|
219
|
+
description?: string;
|
|
220
|
+
group: string;
|
|
221
|
+
category: ParameterCategory;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare interface TouchAPI {
|
|
225
|
+
points: TouchPoint[];
|
|
226
|
+
count: number;
|
|
227
|
+
started: TouchPoint[];
|
|
228
|
+
moved: TouchPoint[];
|
|
229
|
+
ended: TouchPoint[];
|
|
230
|
+
primary: TouchPoint | null;
|
|
231
|
+
gestures: TouchGestureAPI;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare interface TouchGestureAPI {
|
|
235
|
+
isPinching: boolean;
|
|
236
|
+
isRotating: boolean;
|
|
237
|
+
isPanning: boolean;
|
|
238
|
+
isTapping: boolean;
|
|
239
|
+
pinchScale: number;
|
|
240
|
+
pinchDelta: number;
|
|
241
|
+
rotationAngle: number;
|
|
242
|
+
rotationDelta: number;
|
|
243
|
+
panDelta: {
|
|
244
|
+
x: number;
|
|
245
|
+
y: number;
|
|
246
|
+
};
|
|
247
|
+
tapCount: number;
|
|
248
|
+
lastTapTime: number;
|
|
249
|
+
tapPosition: {
|
|
250
|
+
x: number;
|
|
251
|
+
y: number;
|
|
252
|
+
} | null;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
declare interface TouchPoint {
|
|
256
|
+
id: number;
|
|
257
|
+
x: number;
|
|
258
|
+
y: number;
|
|
259
|
+
pressure: number;
|
|
260
|
+
radius: number;
|
|
261
|
+
radiusX: number;
|
|
262
|
+
radiusY: number;
|
|
263
|
+
rotationAngle: number;
|
|
264
|
+
force: number;
|
|
265
|
+
deltaX: number;
|
|
266
|
+
deltaY: number;
|
|
267
|
+
velocity: {
|
|
268
|
+
x: number;
|
|
269
|
+
y: number;
|
|
270
|
+
};
|
|
271
|
+
isNew: boolean;
|
|
272
|
+
isActive: boolean;
|
|
273
|
+
isEnding: boolean;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
declare const VERSION = "0.2.4";
|
|
277
|
+
|
|
278
|
+
declare interface VideoAPI {
|
|
279
|
+
isConnected: boolean;
|
|
280
|
+
currentFrame: OffscreenCanvas | null;
|
|
281
|
+
frameWidth: number;
|
|
282
|
+
frameHeight: number;
|
|
283
|
+
frameRate: number;
|
|
284
|
+
getFrameData: () => ImageData | null;
|
|
285
|
+
faces: FaceData[];
|
|
286
|
+
hands: HandData[];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
declare interface VijiAPI {
|
|
290
|
+
canvas: OffscreenCanvas;
|
|
291
|
+
ctx?: OffscreenCanvasRenderingContext2D;
|
|
292
|
+
gl?: WebGL2RenderingContext;
|
|
293
|
+
width: number;
|
|
294
|
+
height: number;
|
|
295
|
+
pixelRatio: number;
|
|
296
|
+
time: number;
|
|
297
|
+
deltaTime: number;
|
|
298
|
+
frameCount: number;
|
|
299
|
+
fps: number;
|
|
300
|
+
audio: AudioAPI;
|
|
301
|
+
video: VideoAPI;
|
|
302
|
+
mouse: MouseAPI;
|
|
303
|
+
keyboard: KeyboardAPI;
|
|
304
|
+
touches: TouchAPI[];
|
|
305
|
+
slider: (defaultValue: number, config: SliderConfig) => SliderParameter;
|
|
306
|
+
color: (defaultValue: string, config: ColorConfig) => ColorParameter;
|
|
307
|
+
toggle: (defaultValue: boolean, config: ToggleConfig) => ToggleParameter;
|
|
308
|
+
select: (defaultValue: string | number, config: SelectConfig) => SelectParameter;
|
|
309
|
+
text: (defaultValue: string, config: TextConfig) => TextParameter;
|
|
310
|
+
number: (defaultValue: number, config: NumberConfig) => NumberParameter;
|
|
311
|
+
useContext(type: '2d'): OffscreenCanvasRenderingContext2D;
|
|
312
|
+
useContext(type: 'webgl'): WebGLRenderingContext | WebGL2RenderingContext;
|
|
313
|
+
}
|
|
659
314
|
}
|
|
660
315
|
|
|
661
|
-
|
|
662
|
-
declare
|
|
663
|
-
declare function render(viji: VijiCore.ArtistAPI): void;
|
|
316
|
+
declare const viji: VijiCore.VijiAPI;
|
|
317
|
+
declare function render(viji: VijiCore.VijiAPI): void;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Viji Artist API - JavaScript IntelliSense Support
|
|
3
|
+
* Auto-generated from TypeScript definitions - DO NOT EDIT MANUALLY
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for slider parameters
|
|
8
|
+
* @typedef {Object} SliderConfig
|
|
9
|
+
* @property {number} [min] - min property
|
|
10
|
+
* @property {number} [max] - max property
|
|
11
|
+
* @property {number} [step] - step property
|
|
12
|
+
* @property {string} label - label property
|
|
13
|
+
* @property {string} [description] - description property
|
|
14
|
+
* @property {string} [group] - group property
|
|
15
|
+
* @property {ParameterCategory} [category] - category property
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for color parameters
|
|
20
|
+
* @typedef {Object} ColorConfig
|
|
21
|
+
* @property {string} label - label property
|
|
22
|
+
* @property {string} [description] - description property
|
|
23
|
+
* @property {string} [group] - group property
|
|
24
|
+
* @property {ParameterCategory} [category] - category property
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Configuration for toggle parameters
|
|
29
|
+
* @typedef {Object} ToggleConfig
|
|
30
|
+
* @property {string} label - label property
|
|
31
|
+
* @property {string} [description] - description property
|
|
32
|
+
* @property {string} [group] - group property
|
|
33
|
+
* @property {ParameterCategory} [category] - category property
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Configuration for select parameters
|
|
38
|
+
* @typedef {Object} SelectConfig
|
|
39
|
+
* @property {string[] | number[]} options - options property
|
|
40
|
+
* @property {string} label - label property
|
|
41
|
+
* @property {string} [description] - description property
|
|
42
|
+
* @property {string} [group] - group property
|
|
43
|
+
* @property {ParameterCategory} [category] - category property
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for text parameters
|
|
48
|
+
* @typedef {Object} TextConfig
|
|
49
|
+
* @property {string} label - label property
|
|
50
|
+
* @property {string} [description] - description property
|
|
51
|
+
* @property {string} [group] - group property
|
|
52
|
+
* @property {ParameterCategory} [category] - category property
|
|
53
|
+
* @property {number} [maxLength] - maxLength property
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Configuration for number parameters
|
|
58
|
+
* @typedef {Object} NumberConfig
|
|
59
|
+
* @property {number} [min] - min property
|
|
60
|
+
* @property {number} [max] - max property
|
|
61
|
+
* @property {number} [step] - step property
|
|
62
|
+
* @property {string} label - label property
|
|
63
|
+
* @property {string} [description] - description property
|
|
64
|
+
* @property {string} [group] - group property
|
|
65
|
+
* @property {ParameterCategory} [category] - category property
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Parameter object for slider parameters
|
|
70
|
+
* @typedef {Object} SliderParameter
|
|
71
|
+
* @property {number} value - value property
|
|
72
|
+
* @property {number} min - min property
|
|
73
|
+
* @property {number} max - max property
|
|
74
|
+
* @property {number} step - step property
|
|
75
|
+
* @property {string} label - label property
|
|
76
|
+
* @property {string} [description] - description property
|
|
77
|
+
* @property {string} group - group property
|
|
78
|
+
* @property {ParameterCategory} category - category property
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Parameter object for color parameters
|
|
83
|
+
* @typedef {Object} ColorParameter
|
|
84
|
+
* @property {string} value - value property
|
|
85
|
+
* @property {string} label - label property
|
|
86
|
+
* @property {string} [description] - description property
|
|
87
|
+
* @property {string} group - group property
|
|
88
|
+
* @property {ParameterCategory} category - category property
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Parameter object for toggle parameters
|
|
93
|
+
* @typedef {Object} ToggleParameter
|
|
94
|
+
* @property {boolean} value - value property
|
|
95
|
+
* @property {string} label - label property
|
|
96
|
+
* @property {string} [description] - description property
|
|
97
|
+
* @property {string} group - group property
|
|
98
|
+
* @property {ParameterCategory} category - category property
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Parameter object for select parameters
|
|
103
|
+
* @typedef {Object} SelectParameter
|
|
104
|
+
* @property {string | number} value - value property
|
|
105
|
+
* @property {string[] | number[]} options - options property
|
|
106
|
+
* @property {string} label - label property
|
|
107
|
+
* @property {string} [description] - description property
|
|
108
|
+
* @property {string} group - group property
|
|
109
|
+
* @property {ParameterCategory} category - category property
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Parameter object for text parameters
|
|
114
|
+
* @typedef {Object} TextParameter
|
|
115
|
+
* @property {string} value - value property
|
|
116
|
+
* @property {number} [maxLength] - maxLength property
|
|
117
|
+
* @property {string} label - label property
|
|
118
|
+
* @property {string} [description] - description property
|
|
119
|
+
* @property {string} group - group property
|
|
120
|
+
* @property {ParameterCategory} category - category property
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Parameter object for number parameters
|
|
125
|
+
* @typedef {Object} NumberParameter
|
|
126
|
+
* @property {number} value - value property
|
|
127
|
+
* @property {number} min - min property
|
|
128
|
+
* @property {number} max - max property
|
|
129
|
+
* @property {number} step - step property
|
|
130
|
+
* @property {string} label - label property
|
|
131
|
+
* @property {string} [description] - description property
|
|
132
|
+
* @property {string} group - group property
|
|
133
|
+
* @property {ParameterCategory} category - category property
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Audio analysis API - provides real-time audio data and frequency analysis
|
|
138
|
+
* @typedef {Object} AudioAPI
|
|
139
|
+
* @property {boolean} isConnected - isConnected property
|
|
140
|
+
* @property {{} volume - volume property
|
|
141
|
+
* @property {number} rms - rms property
|
|
142
|
+
* @property {number} peak - peak property
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Video frame API - provides access to video stream and computer vision data
|
|
147
|
+
* @typedef {Object} VideoAPI
|
|
148
|
+
* @property {boolean} isConnected - isConnected property
|
|
149
|
+
* @property {OffscreenCanvas |null} currentFrame - currentFrame property
|
|
150
|
+
* @property {number} frameWidth - frameWidth property
|
|
151
|
+
* @property {number} frameHeight - frameHeight property
|
|
152
|
+
* @property {number} frameRate - frameRate property
|
|
153
|
+
* @property {() => ImageData |null} getFrameData - getFrameData property
|
|
154
|
+
* @property {FaceData[]} faces - faces property
|
|
155
|
+
* @property {HandData[]} hands - hands property
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Mouse interaction API
|
|
160
|
+
* @typedef {Object} MouseAPI
|
|
161
|
+
* @property {number} x - x property
|
|
162
|
+
* @property {number} y - y property
|
|
163
|
+
* @property {boolean} isInCanvas - isInCanvas property
|
|
164
|
+
* @property {boolean} isPressed - isPressed property
|
|
165
|
+
* @property {boolean} leftButton - leftButton property
|
|
166
|
+
* @property {boolean} rightButton - rightButton property
|
|
167
|
+
* @property {boolean} middleButton - middleButton property
|
|
168
|
+
* @property {{} velocity - velocity property
|
|
169
|
+
* @property {number} x - x property
|
|
170
|
+
* @property {number} y - y property
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Keyboard interaction API
|
|
175
|
+
* @typedef {Object} KeyboardAPI
|
|
176
|
+
* @property {Set<string>} activeKeys - activeKeys property
|
|
177
|
+
* @property {Set<string>} pressedThisFrame - pressedThisFrame property
|
|
178
|
+
* @property {Set<string>} releasedThisFrame - releasedThisFrame property
|
|
179
|
+
* @property {string} lastKeyPressed - lastKeyPressed property
|
|
180
|
+
* @property {string} lastKeyReleased - lastKeyReleased property
|
|
181
|
+
* @property {boolean} shift - shift property
|
|
182
|
+
* @property {boolean} ctrl - ctrl property
|
|
183
|
+
* @property {boolean} alt - alt property
|
|
184
|
+
* @property {boolean} meta - meta property
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Touch interaction API
|
|
189
|
+
* @typedef {Object} TouchAPI
|
|
190
|
+
* @property {TouchPoint[]} points - points property
|
|
191
|
+
* @property {number} count - count property
|
|
192
|
+
* @property {TouchPoint[]} started - started property
|
|
193
|
+
* @property {TouchPoint[]} moved - moved property
|
|
194
|
+
* @property {TouchPoint[]} ended - ended property
|
|
195
|
+
* @property {TouchPoint |null} primary - primary property
|
|
196
|
+
* @property {TouchGestureAPI} gestures - gestures property
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Main Viji Artist API - provides access to canvas, timing, audio, video, and interactions
|
|
201
|
+
* @typedef {Object} VijiAPI
|
|
202
|
+
* @property {OffscreenCanvas} canvas - canvas property
|
|
203
|
+
* @property {OffscreenCanvasRenderingContext2D} [ctx] - ctx property
|
|
204
|
+
* @property {WebGL2RenderingContext} [gl] - gl property
|
|
205
|
+
* @property {number} width - width property
|
|
206
|
+
* @property {number} height - height property
|
|
207
|
+
* @property {number} pixelRatio - pixelRatio property
|
|
208
|
+
* @property {number} time - time property
|
|
209
|
+
* @property {number} deltaTime - deltaTime property
|
|
210
|
+
* @property {number} frameCount - frameCount property
|
|
211
|
+
* @property {number} fps - fps property
|
|
212
|
+
* @property {AudioAPI} audio - audio property
|
|
213
|
+
* @property {VideoAPI} video - video property
|
|
214
|
+
* @property {MouseAPI} mouse - mouse property
|
|
215
|
+
* @property {KeyboardAPI} keyboard - keyboard property
|
|
216
|
+
* @property {TouchAPI[]} touches - touches property
|
|
217
|
+
* @property {(defaultValue: number, config: SliderConfig) => SliderParameter} slider - slider property
|
|
218
|
+
* @property {(defaultValue: string, config: ColorConfig) => ColorParameter} color - color property
|
|
219
|
+
* @property {(defaultValue: boolean, config: ToggleConfig) => ToggleParameter} toggle - toggle property
|
|
220
|
+
* @property {(defaultValue: string | number, config: SelectConfig) => SelectParameter} select - select property
|
|
221
|
+
* @property {(defaultValue: string, config: TextConfig) => TextParameter} text - text property
|
|
222
|
+
* @property {(defaultValue: number, config: NumberConfig) => NumberParameter} number - number property
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Global viji object available in artist code
|
|
227
|
+
* @type {VijiAPI}
|
|
228
|
+
*/
|
|
229
|
+
declare const viji;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Artist render function - called every frame
|
|
233
|
+
* @param {VijiAPI} viji - The viji API object with all capabilities
|
|
234
|
+
*/
|
|
235
|
+
declare function render(viji) { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viji-dev/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Universal execution engine for Viji Creative scenes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"./artist-dts": {
|
|
18
18
|
"import": "./dist/artist-dts.js",
|
|
19
19
|
"types": "./dist/artist-dts.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./artist-jsdoc": {
|
|
22
|
+
"types": "./dist/artist-jsdoc.d.ts"
|
|
20
23
|
}
|
|
21
24
|
},
|
|
22
25
|
"files": [
|
|
@@ -25,7 +28,7 @@
|
|
|
25
28
|
],
|
|
26
29
|
"scripts": {
|
|
27
30
|
"build": "vite build",
|
|
28
|
-
"postbuild": "node scripts/
|
|
31
|
+
"postbuild": "node scripts/build-artist-types.mjs",
|
|
29
32
|
"dev": "vite build --watch",
|
|
30
33
|
"test": "vitest",
|
|
31
34
|
"test:coverage": "vitest --coverage",
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
"webworker"
|
|
43
46
|
],
|
|
44
47
|
"author": "Viji Team",
|
|
45
|
-
"license": "
|
|
48
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
46
49
|
"devDependencies": {
|
|
47
50
|
"@types/node": "^20.0.0",
|
|
48
51
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|