@viji-dev/core 0.3.22 → 0.3.24
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/README.md +1427 -1439
- package/dist/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global.d.ts +87 -83
- package/dist/artist-js-ambient.d.ts +37 -37
- package/dist/artist-jsdoc.d.ts +32 -32
- package/dist/assets/cv-tasks.worker.js +878 -0
- package/dist/assets/{viji.worker-DTQvTudb.js → viji.worker-Zg128woJ.js} +26252 -26052
- package/dist/assets/viji.worker-Zg128woJ.js.map +1 -0
- package/dist/assets/vision_bundle.js +2 -0
- package/dist/assets/wasm/essentia-wasm.web.wasm +0 -0
- package/dist/assets/wasm/vision_wasm_internal.js +20 -0
- package/dist/assets/wasm/vision_wasm_internal.wasm +0 -0
- package/dist/assets/wasm/vision_wasm_nosimd_internal.js +20 -0
- package/dist/assets/wasm/vision_wasm_nosimd_internal.wasm +0 -0
- package/dist/docs-api.d.ts +52 -52
- package/dist/docs-api.js +2188 -1195
- package/dist/{essentia-wasm.web-0nilrUD3.js → essentia-wasm.web-Dq7KVAx1.js} +5696 -5696
- package/dist/{essentia-wasm.web-0nilrUD3.js.map → essentia-wasm.web-Dq7KVAx1.js.map} +1 -1
- package/dist/essentia.js-core.es-DnrJE0uR.js +3174 -3174
- package/dist/{index-Bu1euCdl.js → index-C6fMmKQj.js} +16161 -16280
- package/dist/index-C6fMmKQj.js.map +1 -0
- package/dist/index.d.ts +38 -32
- package/dist/index.js +8 -8
- package/dist/shader-uniforms.js +1217 -1172
- package/package.json +1 -1
- package/dist/assets/viji.worker-DTQvTudb.js.map +0 -1
- package/dist/index-Bu1euCdl.js.map +0 -1
package/dist/artist-dts-p5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const artistDtsP5 = "// Viji Artist API - Global Type Definitions\n// All types are placed inside declare global {} because this file uses export {}\n// for top-level await support, which makes it a module (where top-level declarations\n// would otherwise be module-scoped, not global).\n\ndeclare global {\n interface AudioAPI {\r\n isConnected: boolean;\r\n volume: {\r\n current: number;\r\n peak: number;\r\n smoothed: number;\r\n };\r\n bands: {\r\n low: number;\r\n lowMid: number;\r\n mid: number;\r\n highMid: number;\r\n high: number;\r\n lowSmoothed: number;\r\n lowMidSmoothed: number;\r\n midSmoothed: number;\r\n highMidSmoothed: number;\r\n highSmoothed: number;\r\n };\r\n beat: {\r\n kick: number;\r\n snare: number;\r\n hat: number;\r\n any: number;\r\n kickSmoothed: number;\r\n snareSmoothed: number;\r\n hatSmoothed: number;\r\n anySmoothed: number;\r\n triggers: {\r\n any: boolean;\r\n kick: boolean;\r\n snare: boolean;\r\n hat: boolean;\r\n };\r\n events: Array<{\r\n type: 'kick' | 'snare' | 'hat';\r\n time: number;\r\n strength: number;\r\n }>;\r\n bpm: number;\r\n confidence: number;\r\n isLocked: boolean;\r\n };\r\n spectral: {\r\n brightness: number;\r\n flatness: number;\r\n };\r\n getFrequencyData: () => Uint8Array;\r\n getWaveform: () => Float32Array;\r\n }\r\n\n interface CaptureFrameOptions {\r\n /** Output format: 'blob' for encoded image, 'bitmap' for GPU-friendly ImageBitmap */\r\n format?: 'blob' | 'bitmap';\r\n /** MIME type for blob output (ignored for bitmap), 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 interface ColorConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n 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 type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDetection' | 'bodySegmentation' | 'emotionDetection';\r\n\n type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';\r\n\n interface DeviceMotionData {\r\n /** Acceleration without gravity (m/s²) */\r\n acceleration: {\r\n x: number | null;\r\n y: number | null;\r\n z: number | null;\r\n } | null;\r\n /** Acceleration including gravity (m/s²) */\r\n accelerationIncludingGravity: {\r\n x: number | null;\r\n y: number | null;\r\n z: number | null;\r\n } | null;\r\n /** Rotation rate (degrees/second) */\r\n rotationRate: {\r\n alpha: number | null;\r\n beta: number | null;\r\n gamma: number | null;\r\n } | null;\r\n /** Interval between updates (milliseconds) */\r\n interval: number;\r\n }\r\n\n interface DeviceOrientationData {\r\n /** Rotation around Z-axis (0-360 degrees, compass heading) */\r\n alpha: number | null;\r\n /** Rotation around X-axis (-180 to 180 degrees, front-to-back tilt) */\r\n beta: number | null;\r\n /** Rotation around Y-axis (-90 to 90 degrees, left-to-right tilt) */\r\n gamma: number | null;\r\n /** True if using magnetometer (compass) for absolute orientation */\r\n absolute: boolean;\r\n }\r\n\n interface DeviceSensorState {\r\n motion: DeviceMotionData | null;\r\n orientation: DeviceOrientationData | null;\r\n }\r\n\n interface DeviceState extends DeviceSensorState {\r\n /** Unique device identifier */\r\n id: string;\r\n /** User-friendly device name */\r\n name: string;\r\n /** Device camera video (null if not available) */\r\n video: VideoAPI | null;\r\n }\r\n\n interface FaceBlendshapes {\r\n browDownLeft: number;\r\n browDownRight: number;\r\n browInnerUp: number;\r\n browOuterUpLeft: number;\r\n browOuterUpRight: number;\r\n cheekPuff: number;\r\n cheekSquintLeft: number;\r\n cheekSquintRight: number;\r\n eyeBlinkLeft: number;\r\n eyeBlinkRight: number;\r\n eyeLookDownLeft: number;\r\n eyeLookDownRight: number;\r\n eyeLookInLeft: number;\r\n eyeLookInRight: number;\r\n eyeLookOutLeft: number;\r\n eyeLookOutRight: number;\r\n eyeLookUpLeft: number;\r\n eyeLookUpRight: number;\r\n eyeSquintLeft: number;\r\n eyeSquintRight: number;\r\n eyeWideLeft: number;\r\n eyeWideRight: number;\r\n jawForward: number;\r\n jawLeft: number;\r\n jawOpen: number;\r\n jawRight: number;\r\n mouthClose: number;\r\n mouthDimpleLeft: number;\r\n mouthDimpleRight: number;\r\n mouthFrownLeft: number;\r\n mouthFrownRight: number;\r\n mouthFunnel: number;\r\n mouthLeft: number;\r\n mouthLowerDownLeft: number;\r\n mouthLowerDownRight: number;\r\n mouthPressLeft: number;\r\n mouthPressRight: number;\r\n mouthPucker: number;\r\n mouthRight: number;\r\n mouthRollLower: number;\r\n mouthRollUpper: number;\r\n mouthShrugLower: number;\r\n mouthShrugUpper: number;\r\n mouthSmileLeft: number;\r\n mouthSmileRight: number;\r\n mouthStretchLeft: number;\r\n mouthStretchRight: number;\r\n mouthUpperUpLeft: number;\r\n mouthUpperUpRight: number;\r\n noseSneerLeft: number;\r\n noseSneerRight: number;\r\n tongueOut: number;\r\n }\r\n\n interface FaceData {\r\n id: number;\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n center: {\r\n x: number;\r\n y: number;\r\n };\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z?: number;\r\n }[];\r\n expressions: {\r\n neutral: number;\r\n happy: number;\r\n sad: number;\r\n angry: number;\r\n surprised: number;\r\n disgusted: number;\r\n fearful: number;\r\n };\r\n headPose: {\r\n pitch: number;\r\n yaw: number;\r\n roll: number;\r\n };\r\n blendshapes: FaceBlendshapes;\r\n }\r\n\n type FrameRateMode = 'full' | 'half';\r\n\n interface FrequencyBand {\r\n name: string;\r\n min: number;\r\n max: number;\r\n }\r\n\n interface HandData {\r\n id: number;\r\n handedness: 'left' | 'right';\r\n confidence: number;\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n }[];\r\n palm: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n fingers: {\r\n thumb: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n index: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n middle: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n ring: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n pinky: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n };\r\n gestures: {\r\n fist: number;\r\n openPalm: number;\r\n peace: number;\r\n thumbsUp: number;\r\n pointing: number;\r\n };\r\n }\r\n\n interface ImageConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n interface ImageParameter {\r\n value: ImageBitmap | OffscreenCanvas | null;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n }\r\n\n 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 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 /**\n * P5-compatible image object (lazy-loaded, auto-converted from .value)\n * Only available in P5 renderer mode. Use with p5.image() function.\n * Example: p5.image(myImage.p5, x, y)\n */\n p5?: {\n canvas: OffscreenCanvas; // P5.js looks for img.canvas || img.elt\n elt: OffscreenCanvas; // Fallback for compatibility\n width: number; // Logical width\n height: number; // Logical height\n };\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 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 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 type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';\r\n\n interface PoseData {\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n visibility: number;\r\n }[];\r\n face: {\r\n x: number;\r\n y: number;\r\n }[];\r\n torso: {\r\n x: number;\r\n y: number;\r\n }[];\r\n leftArm: {\r\n x: number;\r\n y: number;\r\n }[];\r\n rightArm: {\r\n x: number;\r\n y: number;\r\n }[];\r\n leftLeg: {\r\n x: number;\r\n y: number;\r\n }[];\r\n rightLeg: {\r\n x: number;\r\n y: number;\r\n }[];\r\n }\r\n\n type Resolution = {\r\n width: number;\r\n height: number;\r\n };\r\n\n interface SegmentationData {\r\n mask: Uint8Array;\r\n width: number;\r\n height: number;\r\n }\r\n\n 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 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 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 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 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 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 interface ToggleConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n 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 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 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 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 const VERSION = \"0.2.20\";\r\n\n interface VideoAPI {\r\n isConnected: boolean;\r\n currentFrame: OffscreenCanvas | ImageBitmap | 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 pose: PoseData | null;\r\n segmentation: SegmentationData | null;\r\n cv: {\r\n enableFaceDetection(enabled: boolean): Promise<void>;\r\n enableFaceMesh(enabled: boolean): Promise<void>;\r\n enableEmotionDetection(enabled: boolean): Promise<void>;\r\n enableHandTracking(enabled: boolean): Promise<void>;\r\n enablePoseDetection(enabled: boolean): Promise<void>;\r\n enableBodySegmentation(enabled: boolean): Promise<void>;\r\n getActiveFeatures(): CVFeature[];\r\n isProcessing(): boolean;\r\n };\r\n }\r\n\n 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 streams: VideoAPI[];\r\n mouse: MouseAPI;\r\n keyboard: KeyboardAPI;\r\n touches: TouchAPI;\r\n device: DeviceSensorState;\r\n devices: DeviceState[];\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 image: (defaultValue: null, config: ImageConfig) => ImageParameter;\r\n useContext(type: '2d'): OffscreenCanvasRenderingContext2D;\n useContext(type: 'webgl'): WebGLRenderingContext;\n useContext(type: 'webgl2'): WebGL2RenderingContext;\r\n }\r\n\n // Runtime global - the main viji object\n const viji: VijiAPI;\n \n // Function type aliases (artists define their own render/setup functions)\n type Render = (viji: VijiAPI) => void;\n type Setup = (viji: VijiAPI) => void;\n}\n\n// Module marker (enables top-level await in artist code)\nexport {};\n\n\n// ============================================================\n// VIJI + P5.JS HYBRID MODE\n// ============================================================\n// In Viji's P5 renderer, you don't use standard P5 patterns.\n// Instead, you define these Viji-specific functions:\n\n// P5-specific globals (augments the base declare global block)\ndeclare global {\n // P5 instance type for annotations\n type p5 = p5;\n \n // Type aliases for P5 function signatures (artists define their own functions)\n /**\n * P5 render function signature - called every frame\n * @param viji - Viji API (canvas, audio, video, parameters, etc.)\n * @param p5 - P5.js instance with all P5 methods\n */\n type P5Render = (viji: VijiAPI, p5: p5) => void;\n \n /**\n * P5 setup function signature - called once at initialization\n * @param viji - Viji API (canvas, audio, video, parameters, etc.)\n * @param p5 - P5.js instance with all P5 methods\n */\n type P5Setup = (viji: VijiAPI, p5: p5) => void;\n}\n\n// ============================================================\n// IMPORTANT NOTES\n// ============================================================\n// - Don't use: new p5(), preload(), draw(), or P5's setup()\n// - Viji manages the P5 instance lifecycle\n// - Access P5 methods through the 'p5' parameter: p5.rect(), p5.fill(), etc.\n// - Access Viji features through the 'viji' parameter: viji.audio, viji.mouse, etc.\n// - Define parameters at the top level (before setup/render functions)\n\n// ============================================================\n// P5.JS TYPES (namespace and instance methods)\n// ============================================================\n// This file was auto-generated. Please do not edit it.\n/// <reference path=\"./src/accessibility/describe.d.ts\" />\n/// <reference path=\"./src/accessibility/outputs.d.ts\" />\n/// <reference path=\"./src/color/creating_reading.d.ts\" />\n/// <reference path=\"./src/color/setting.d.ts\" />\n/// <reference path=\"./src/core/shape/2d_primitives.d.ts\" />\n/// <reference path=\"./src/core/shape/attributes.d.ts\" />\n/// <reference path=\"./src/core/shape/curves.d.ts\" />\n/// <reference path=\"./src/core/shape/vertex.d.ts\" />\n/// <reference path=\"./src/core/constants.d.ts\" />\n/// <reference path=\"./src/core/environment.d.ts\" />\n/// <reference path=\"./src/core/rendering.d.ts\" />\n/// <reference path=\"./src/core/structure.d.ts\" />\n/// <reference path=\"./src/core/transform.d.ts\" />\n/// <reference path=\"./src/data/local_storage.d.ts\" />\n/// <reference path=\"./src/data/p5.TypedDict.d.ts\" />\n/// <reference path=\"./src/dom/dom.d.ts\" />\n/// <reference path=\"./src/events/acceleration.d.ts\" />\n/// <reference path=\"./src/events/keyboard.d.ts\" />\n/// <reference path=\"./src/events/mouse.d.ts\" />\n/// <reference path=\"./src/events/touch.d.ts\" />\n/// <reference path=\"./src/image/image.d.ts\" />\n/// <reference path=\"./src/image/loading_displaying.d.ts\" />\n/// <reference path=\"./src/image/pixels.d.ts\" />\n/// <reference path=\"./src/io/files.d.ts\" />\n/// <reference path=\"./src/math/calculation.d.ts\" />\n/// <reference path=\"./src/math/math.d.ts\" />\n/// <reference path=\"./src/math/noise.d.ts\" />\n/// <reference path=\"./src/math/random.d.ts\" />\n/// <reference path=\"./src/math/trigonometry.d.ts\" />\n/// <reference path=\"./src/typography/attributes.d.ts\" />\n/// <reference path=\"./src/typography/loading_displaying.d.ts\" />\n/// <reference path=\"./src/utilities/array_functions.d.ts\" />\n/// <reference path=\"./src/utilities/conversion.d.ts\" />\n/// <reference path=\"./src/utilities/string_functions.d.ts\" />\n/// <reference path=\"./src/utilities/time_date.d.ts\" />\n/// <reference path=\"./src/webgl/3d_primitives.d.ts\" />\n/// <reference path=\"./src/webgl/interaction.d.ts\" />\n/// <reference path=\"./src/webgl/light.d.ts\" />\n/// <reference path=\"./src/webgl/loading.d.ts\" />\n/// <reference path=\"./src/webgl/material.d.ts\" />\n/// <reference path=\"./src/webgl/p5.Camera.d.ts\" />\n/// <reference path=\"./src/webgl/p5.RendererGL.Immediate.d.ts\" />\n/// <reference path=\"./src/webgl/p5.RendererGL.d.ts\" />\n/// <reference path=\"./src/color/p5.Color.d.ts\" />\n/// <reference path=\"./src/core/p5.Element.d.ts\" />\n/// <reference path=\"./src/core/p5.Graphics.d.ts\" />\n/// <reference path=\"./src/image/p5.Image.d.ts\" />\n/// <reference path=\"./src/io/p5.Table.d.ts\" />\n/// <reference path=\"./src/io/p5.TableRow.d.ts\" />\n/// <reference path=\"./src/io/p5.XML.d.ts\" />\n/// <reference path=\"./src/math/p5.Vector.d.ts\" />\n/// <reference path=\"./src/typography/p5.Font.d.ts\" />\n/// <reference path=\"./src/webgl/p5.Framebuffer.d.ts\" />\n/// <reference path=\"./src/webgl/p5.Geometry.d.ts\" />\n/// <reference path=\"./src/webgl/p5.Shader.d.ts\" />\n/// <reference path=\"./src/core/p5.Renderer.d.ts\" />\n/// <reference path=\"./literals.d.ts\" />\n/// <reference path=\"./constants.d.ts\" />\n= p5;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface p5 extends p5.p5InstanceExtensions {}\n\ndeclare namespace p5 {\n type UNKNOWN_P5_CONSTANT = any;\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n interface p5InstanceExtensions {}\n}\n\n";
|
|
1
|
+
export const artistDtsP5 = "// Viji Artist API - Global Type Definitions\n// All types are placed inside declare global {} because this file uses export {}\n// for top-level await support, which makes it a module (where top-level declarations\n// would otherwise be module-scoped, not global).\n\ndeclare global {\n interface AudioAPI {\r\n isConnected: boolean;\r\n volume: {\r\n current: number;\r\n peak: number;\r\n smoothed: number;\r\n };\r\n bands: {\r\n low: number;\r\n lowMid: number;\r\n mid: number;\r\n highMid: number;\r\n high: number;\r\n lowSmoothed: number;\r\n lowMidSmoothed: number;\r\n midSmoothed: number;\r\n highMidSmoothed: number;\r\n highSmoothed: number;\r\n };\r\n beat: {\r\n kick: number;\r\n snare: number;\r\n hat: number;\r\n any: number;\r\n kickSmoothed: number;\r\n snareSmoothed: number;\r\n hatSmoothed: number;\r\n anySmoothed: number;\r\n triggers: {\r\n any: boolean;\r\n kick: boolean;\r\n snare: boolean;\r\n hat: boolean;\r\n };\r\n events: Array<{\r\n type: 'kick' | 'snare' | 'hat';\r\n time: number;\r\n strength: number;\r\n }>;\r\n bpm: number;\r\n confidence: number;\r\n isLocked: boolean;\r\n };\r\n spectral: {\r\n brightness: number;\r\n flatness: number;\r\n };\r\n getFrequencyData: () => Uint8Array;\r\n getWaveform: () => Float32Array;\r\n }\r\n\n interface ButtonConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n interface ButtonParameter {\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 interface CaptureFrameOptions {\r\n /** Output format: 'blob' for encoded image, 'bitmap' for GPU-friendly ImageBitmap */\r\n format?: 'blob' | 'bitmap';\r\n /** MIME type for blob output (ignored for bitmap), 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 interface ColorConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n 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 type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDetection' | 'bodySegmentation' | 'emotionDetection';\r\n\n type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';\r\n\n interface DeviceMotionData {\r\n /** Acceleration without gravity (m/s²) */\r\n acceleration: {\r\n x: number | null;\r\n y: number | null;\r\n z: number | null;\r\n } | null;\r\n /** Acceleration including gravity (m/s²) */\r\n accelerationIncludingGravity: {\r\n x: number | null;\r\n y: number | null;\r\n z: number | null;\r\n } | null;\r\n /** Rotation rate (degrees/second) */\r\n rotationRate: {\r\n alpha: number | null;\r\n beta: number | null;\r\n gamma: number | null;\r\n } | null;\r\n /** Interval between updates (milliseconds) */\r\n interval: number;\r\n }\r\n\n interface DeviceOrientationData {\r\n /** Rotation around Z-axis (0-360 degrees, compass heading) */\r\n alpha: number | null;\r\n /** Rotation around X-axis (-180 to 180 degrees, front-to-back tilt) */\r\n beta: number | null;\r\n /** Rotation around Y-axis (-90 to 90 degrees, left-to-right tilt) */\r\n gamma: number | null;\r\n /** True if using magnetometer (compass) for absolute orientation */\r\n absolute: boolean;\r\n }\r\n\n interface DeviceSensorState {\r\n motion: DeviceMotionData | null;\r\n orientation: DeviceOrientationData | null;\r\n }\r\n\n interface DeviceState extends DeviceSensorState {\r\n /** Unique device identifier */\r\n id: string;\r\n /** User-friendly device name */\r\n name: string;\r\n /** Device camera video (null if not available) */\r\n video: VideoAPI | null;\r\n }\r\n\n interface FaceBlendshapes {\r\n browDownLeft: number;\r\n browDownRight: number;\r\n browInnerUp: number;\r\n browOuterUpLeft: number;\r\n browOuterUpRight: number;\r\n cheekPuff: number;\r\n cheekSquintLeft: number;\r\n cheekSquintRight: number;\r\n eyeBlinkLeft: number;\r\n eyeBlinkRight: number;\r\n eyeLookDownLeft: number;\r\n eyeLookDownRight: number;\r\n eyeLookInLeft: number;\r\n eyeLookInRight: number;\r\n eyeLookOutLeft: number;\r\n eyeLookOutRight: number;\r\n eyeLookUpLeft: number;\r\n eyeLookUpRight: number;\r\n eyeSquintLeft: number;\r\n eyeSquintRight: number;\r\n eyeWideLeft: number;\r\n eyeWideRight: number;\r\n jawForward: number;\r\n jawLeft: number;\r\n jawOpen: number;\r\n jawRight: number;\r\n mouthClose: number;\r\n mouthDimpleLeft: number;\r\n mouthDimpleRight: number;\r\n mouthFrownLeft: number;\r\n mouthFrownRight: number;\r\n mouthFunnel: number;\r\n mouthLeft: number;\r\n mouthLowerDownLeft: number;\r\n mouthLowerDownRight: number;\r\n mouthPressLeft: number;\r\n mouthPressRight: number;\r\n mouthPucker: number;\r\n mouthRight: number;\r\n mouthRollLower: number;\r\n mouthRollUpper: number;\r\n mouthShrugLower: number;\r\n mouthShrugUpper: number;\r\n mouthSmileLeft: number;\r\n mouthSmileRight: number;\r\n mouthStretchLeft: number;\r\n mouthStretchRight: number;\r\n mouthUpperUpLeft: number;\r\n mouthUpperUpRight: number;\r\n noseSneerLeft: number;\r\n noseSneerRight: number;\r\n tongueOut: number;\r\n }\r\n\n interface FaceData {\r\n id: number;\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n center: {\r\n x: number;\r\n y: number;\r\n };\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z?: number;\r\n }[];\r\n expressions: {\r\n neutral: number;\r\n happy: number;\r\n sad: number;\r\n angry: number;\r\n surprised: number;\r\n disgusted: number;\r\n fearful: number;\r\n };\r\n headPose: {\r\n pitch: number;\r\n yaw: number;\r\n roll: number;\r\n };\r\n blendshapes: FaceBlendshapes;\r\n }\r\n\n type FrameRateMode = 'full' | 'half';\r\n\n interface FrequencyBand {\r\n name: string;\r\n min: number;\r\n max: number;\r\n }\r\n\n interface HandData {\r\n id: number;\r\n handedness: 'left' | 'right';\r\n confidence: number;\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n }[];\r\n palm: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n fingers: {\r\n thumb: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n index: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n middle: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n ring: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n pinky: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n };\r\n gestures: {\r\n fist: number;\r\n openPalm: number;\r\n peace: number;\r\n thumbsUp: number;\r\n pointing: number;\r\n };\r\n }\r\n\n interface ImageConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n interface ImageParameter {\r\n value: ImageBitmap | null;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n }\r\n\n 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 textureData: Uint8Array;\r\n }\r\n\n 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 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 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 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 type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';\r\n\n interface PointerAPI {\r\n x: number;\r\n y: number;\r\n deltaX: number;\r\n deltaY: number;\r\n isDown: boolean;\r\n wasPressed: boolean;\r\n wasReleased: boolean;\r\n isInCanvas: boolean;\r\n type: 'mouse' | 'touch' | 'none';\r\n }\r\n\n interface PoseData {\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n visibility: number;\r\n /**\n * P5-compatible image object (lazy-loaded, auto-converted from .value)\n * Only available in P5 renderer mode. Use with p5.image() function.\n * Example: p5.image(myImage.p5, x, y)\n */\n p5?: {\n canvas: OffscreenCanvas; // P5.js looks for img.canvas || img.elt\n elt: OffscreenCanvas; // Fallback for compatibility\n width: number; // Logical width\n height: number; // Logical height\n };\n }[];\r\n face: {\r\n x: number;\r\n y: number;\r\n }[];\r\n torso: {\r\n x: number;\r\n y: number;\r\n }[];\r\n leftArm: {\r\n x: number;\r\n y: number;\r\n }[];\r\n rightArm: {\r\n x: number;\r\n y: number;\r\n }[];\r\n leftLeg: {\r\n x: number;\r\n y: number;\r\n }[];\r\n rightLeg: {\r\n x: number;\r\n y: number;\r\n }[];\r\n }\r\n\n type Resolution = {\r\n width: number;\r\n height: number;\r\n };\r\n\n interface SegmentationData {\r\n mask: Uint8Array;\r\n width: number;\r\n height: number;\r\n }\r\n\n 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 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 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 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 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 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 interface ToggleConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n 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 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 }\r\n\n 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 isInCanvas: boolean;\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 const VERSION = \"0.2.20\";\r\n\n interface VideoAPI {\r\n isConnected: boolean;\r\n currentFrame: OffscreenCanvas | ImageBitmap | 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 pose: PoseData | null;\r\n segmentation: SegmentationData | null;\r\n cv: {\r\n enableFaceDetection(enabled: boolean): Promise<void>;\r\n enableFaceMesh(enabled: boolean): Promise<void>;\r\n enableEmotionDetection(enabled: boolean): Promise<void>;\r\n enableHandTracking(enabled: boolean): Promise<void>;\r\n enablePoseDetection(enabled: boolean): Promise<void>;\r\n enableBodySegmentation(enabled: boolean): Promise<void>;\r\n getActiveFeatures(): CVFeature[];\r\n isProcessing(): boolean;\r\n };\r\n }\r\n\n interface VijiAPI {\r\n canvas: OffscreenCanvas;\r\n ctx?: OffscreenCanvasRenderingContext2D;\r\n gl?: WebGLRenderingContext | WebGL2RenderingContext;\r\n width: number;\r\n height: 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 streams: VideoAPI[];\r\n mouse: MouseAPI;\r\n keyboard: KeyboardAPI;\r\n touches: TouchAPI;\r\n pointer: PointerAPI;\r\n device: DeviceSensorState;\r\n devices: DeviceState[];\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 image: (defaultValue: null, config: ImageConfig) => ImageParameter;\r\n button: (config: ButtonConfig) => ButtonParameter;\r\n useContext(type: '2d'): OffscreenCanvasRenderingContext2D;\r\n useContext(type: 'webgl'): WebGLRenderingContext;\r\n useContext(type: 'webgl2'): WebGL2RenderingContext;\r\n }\r\n\n // Runtime global - the main viji object\n const viji: VijiAPI;\n \n // Function type aliases (artists define their own render/setup functions)\n type Render = (viji: VijiAPI) => void;\n type Setup = (viji: VijiAPI) => void;\n}\n\n// Module marker (enables top-level await in artist code)\nexport {};\n\n\n// ============================================================\n// VIJI + P5.JS HYBRID MODE\n// ============================================================\n// In Viji's P5 renderer, you don't use standard P5 patterns.\n// Instead, you define these Viji-specific functions:\n\n// P5-specific globals (augments the base declare global block)\ndeclare global {\n // P5 instance type for annotations\n type p5 = p5;\n \n // Type aliases for P5 function signatures (artists define their own functions)\n /**\n * P5 render function signature - called every frame\n * @param viji - Viji API (canvas, audio, video, parameters, etc.)\n * @param p5 - P5.js instance with all P5 methods\n */\n type P5Render = (viji: VijiAPI, p5: p5) => void;\n \n /**\n * P5 setup function signature - called once at initialization\n * @param viji - Viji API (canvas, audio, video, parameters, etc.)\n * @param p5 - P5.js instance with all P5 methods\n */\n type P5Setup = (viji: VijiAPI, p5: p5) => void;\n}\n\n// ============================================================\n// IMPORTANT NOTES\n// ============================================================\n// - Don't use: new p5(), preload(), draw(), or P5's setup()\n// - Viji manages the P5 instance lifecycle\n// - Access P5 methods through the 'p5' parameter: p5.rect(), p5.fill(), etc.\n// - Access Viji features through the 'viji' parameter: viji.audio, viji.mouse, etc.\n// - Define parameters at the top level (before setup/render functions)\n\n// ============================================================\n// P5.JS TYPES (namespace and instance methods)\n// ============================================================\n// This file was auto-generated. Please do not edit it.\n/// <reference path=\"./src/accessibility/describe.d.ts\" />\n/// <reference path=\"./src/accessibility/outputs.d.ts\" />\n/// <reference path=\"./src/color/creating_reading.d.ts\" />\n/// <reference path=\"./src/color/setting.d.ts\" />\n/// <reference path=\"./src/core/shape/2d_primitives.d.ts\" />\n/// <reference path=\"./src/core/shape/attributes.d.ts\" />\n/// <reference path=\"./src/core/shape/curves.d.ts\" />\n/// <reference path=\"./src/core/shape/vertex.d.ts\" />\n/// <reference path=\"./src/core/constants.d.ts\" />\n/// <reference path=\"./src/core/environment.d.ts\" />\n/// <reference path=\"./src/core/rendering.d.ts\" />\n/// <reference path=\"./src/core/structure.d.ts\" />\n/// <reference path=\"./src/core/transform.d.ts\" />\n/// <reference path=\"./src/data/local_storage.d.ts\" />\n/// <reference path=\"./src/data/p5.TypedDict.d.ts\" />\n/// <reference path=\"./src/dom/dom.d.ts\" />\n/// <reference path=\"./src/events/acceleration.d.ts\" />\n/// <reference path=\"./src/events/keyboard.d.ts\" />\n/// <reference path=\"./src/events/mouse.d.ts\" />\n/// <reference path=\"./src/events/touch.d.ts\" />\n/// <reference path=\"./src/image/image.d.ts\" />\n/// <reference path=\"./src/image/loading_displaying.d.ts\" />\n/// <reference path=\"./src/image/pixels.d.ts\" />\n/// <reference path=\"./src/io/files.d.ts\" />\n/// <reference path=\"./src/math/calculation.d.ts\" />\n/// <reference path=\"./src/math/math.d.ts\" />\n/// <reference path=\"./src/math/noise.d.ts\" />\n/// <reference path=\"./src/math/random.d.ts\" />\n/// <reference path=\"./src/math/trigonometry.d.ts\" />\n/// <reference path=\"./src/typography/attributes.d.ts\" />\n/// <reference path=\"./src/typography/loading_displaying.d.ts\" />\n/// <reference path=\"./src/utilities/array_functions.d.ts\" />\n/// <reference path=\"./src/utilities/conversion.d.ts\" />\n/// <reference path=\"./src/utilities/string_functions.d.ts\" />\n/// <reference path=\"./src/utilities/time_date.d.ts\" />\n/// <reference path=\"./src/webgl/3d_primitives.d.ts\" />\n/// <reference path=\"./src/webgl/interaction.d.ts\" />\n/// <reference path=\"./src/webgl/light.d.ts\" />\n/// <reference path=\"./src/webgl/loading.d.ts\" />\n/// <reference path=\"./src/webgl/material.d.ts\" />\n/// <reference path=\"./src/webgl/p5.Camera.d.ts\" />\n/// <reference path=\"./src/webgl/p5.RendererGL.Immediate.d.ts\" />\n/// <reference path=\"./src/webgl/p5.RendererGL.d.ts\" />\n/// <reference path=\"./src/color/p5.Color.d.ts\" />\n/// <reference path=\"./src/core/p5.Element.d.ts\" />\n/// <reference path=\"./src/core/p5.Graphics.d.ts\" />\n/// <reference path=\"./src/image/p5.Image.d.ts\" />\n/// <reference path=\"./src/io/p5.Table.d.ts\" />\n/// <reference path=\"./src/io/p5.TableRow.d.ts\" />\n/// <reference path=\"./src/io/p5.XML.d.ts\" />\n/// <reference path=\"./src/math/p5.Vector.d.ts\" />\n/// <reference path=\"./src/typography/p5.Font.d.ts\" />\n/// <reference path=\"./src/webgl/p5.Framebuffer.d.ts\" />\n/// <reference path=\"./src/webgl/p5.Geometry.d.ts\" />\n/// <reference path=\"./src/webgl/p5.Shader.d.ts\" />\n/// <reference path=\"./src/core/p5.Renderer.d.ts\" />\n/// <reference path=\"./literals.d.ts\" />\n/// <reference path=\"./constants.d.ts\" />\n= p5;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface p5 extends p5.p5InstanceExtensions {}\n\ndeclare namespace p5 {\n type UNKNOWN_P5_CONSTANT = any;\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n interface p5InstanceExtensions {}\n}\n\n";
|
package/dist/artist-dts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const artistDts = "// Viji Artist API - Global Type Definitions\n// All types are placed inside declare global {} because this file uses export {}\n// for top-level await support, which makes it a module (where top-level declarations\n// would otherwise be module-scoped, not global).\n\ndeclare global {\n interface AudioAPI {\r\n isConnected: boolean;\r\n volume: {\r\n current: number;\r\n peak: number;\r\n smoothed: number;\r\n };\r\n bands: {\r\n low: number;\r\n lowMid: number;\r\n mid: number;\r\n highMid: number;\r\n high: number;\r\n lowSmoothed: number;\r\n lowMidSmoothed: number;\r\n midSmoothed: number;\r\n highMidSmoothed: number;\r\n highSmoothed: number;\r\n };\r\n beat: {\r\n kick: number;\r\n snare: number;\r\n hat: number;\r\n any: number;\r\n kickSmoothed: number;\r\n snareSmoothed: number;\r\n hatSmoothed: number;\r\n anySmoothed: number;\r\n triggers: {\r\n any: boolean;\r\n kick: boolean;\r\n snare: boolean;\r\n hat: boolean;\r\n };\r\n events: Array<{\r\n type: 'kick' | 'snare' | 'hat';\r\n time: number;\r\n strength: number;\r\n }>;\r\n bpm: number;\r\n confidence: number;\r\n isLocked: boolean;\r\n };\r\n spectral: {\r\n brightness: number;\r\n flatness: number;\r\n };\r\n getFrequencyData: () => Uint8Array;\r\n getWaveform: () => Float32Array;\r\n }\r\n\n interface CaptureFrameOptions {\r\n /** Output format: 'blob' for encoded image, 'bitmap' for GPU-friendly ImageBitmap */\r\n format?: 'blob' | 'bitmap';\r\n /** MIME type for blob output (ignored for bitmap), 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 interface ColorConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n 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 type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDetection' | 'bodySegmentation' | 'emotionDetection';\r\n\n type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';\r\n\n interface DeviceMotionData {\r\n /** Acceleration without gravity (m/s²) */\r\n acceleration: {\r\n x: number | null;\r\n y: number | null;\r\n z: number | null;\r\n } | null;\r\n /** Acceleration including gravity (m/s²) */\r\n accelerationIncludingGravity: {\r\n x: number | null;\r\n y: number | null;\r\n z: number | null;\r\n } | null;\r\n /** Rotation rate (degrees/second) */\r\n rotationRate: {\r\n alpha: number | null;\r\n beta: number | null;\r\n gamma: number | null;\r\n } | null;\r\n /** Interval between updates (milliseconds) */\r\n interval: number;\r\n }\r\n\n interface DeviceOrientationData {\r\n /** Rotation around Z-axis (0-360 degrees, compass heading) */\r\n alpha: number | null;\r\n /** Rotation around X-axis (-180 to 180 degrees, front-to-back tilt) */\r\n beta: number | null;\r\n /** Rotation around Y-axis (-90 to 90 degrees, left-to-right tilt) */\r\n gamma: number | null;\r\n /** True if using magnetometer (compass) for absolute orientation */\r\n absolute: boolean;\r\n }\r\n\n interface DeviceSensorState {\r\n motion: DeviceMotionData | null;\r\n orientation: DeviceOrientationData | null;\r\n }\r\n\n interface DeviceState extends DeviceSensorState {\r\n /** Unique device identifier */\r\n id: string;\r\n /** User-friendly device name */\r\n name: string;\r\n /** Device camera video (null if not available) */\r\n video: VideoAPI | null;\r\n }\r\n\n interface FaceBlendshapes {\r\n browDownLeft: number;\r\n browDownRight: number;\r\n browInnerUp: number;\r\n browOuterUpLeft: number;\r\n browOuterUpRight: number;\r\n cheekPuff: number;\r\n cheekSquintLeft: number;\r\n cheekSquintRight: number;\r\n eyeBlinkLeft: number;\r\n eyeBlinkRight: number;\r\n eyeLookDownLeft: number;\r\n eyeLookDownRight: number;\r\n eyeLookInLeft: number;\r\n eyeLookInRight: number;\r\n eyeLookOutLeft: number;\r\n eyeLookOutRight: number;\r\n eyeLookUpLeft: number;\r\n eyeLookUpRight: number;\r\n eyeSquintLeft: number;\r\n eyeSquintRight: number;\r\n eyeWideLeft: number;\r\n eyeWideRight: number;\r\n jawForward: number;\r\n jawLeft: number;\r\n jawOpen: number;\r\n jawRight: number;\r\n mouthClose: number;\r\n mouthDimpleLeft: number;\r\n mouthDimpleRight: number;\r\n mouthFrownLeft: number;\r\n mouthFrownRight: number;\r\n mouthFunnel: number;\r\n mouthLeft: number;\r\n mouthLowerDownLeft: number;\r\n mouthLowerDownRight: number;\r\n mouthPressLeft: number;\r\n mouthPressRight: number;\r\n mouthPucker: number;\r\n mouthRight: number;\r\n mouthRollLower: number;\r\n mouthRollUpper: number;\r\n mouthShrugLower: number;\r\n mouthShrugUpper: number;\r\n mouthSmileLeft: number;\r\n mouthSmileRight: number;\r\n mouthStretchLeft: number;\r\n mouthStretchRight: number;\r\n mouthUpperUpLeft: number;\r\n mouthUpperUpRight: number;\r\n noseSneerLeft: number;\r\n noseSneerRight: number;\r\n tongueOut: number;\r\n }\r\n\n interface FaceData {\r\n id: number;\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n center: {\r\n x: number;\r\n y: number;\r\n };\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z?: number;\r\n }[];\r\n expressions: {\r\n neutral: number;\r\n happy: number;\r\n sad: number;\r\n angry: number;\r\n surprised: number;\r\n disgusted: number;\r\n fearful: number;\r\n };\r\n headPose: {\r\n pitch: number;\r\n yaw: number;\r\n roll: number;\r\n };\r\n blendshapes: FaceBlendshapes;\r\n }\r\n\n type FrameRateMode = 'full' | 'half';\r\n\n interface FrequencyBand {\r\n name: string;\r\n min: number;\r\n max: number;\r\n }\r\n\n interface HandData {\r\n id: number;\r\n handedness: 'left' | 'right';\r\n confidence: number;\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n }[];\r\n palm: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n fingers: {\r\n thumb: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n index: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n middle: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n ring: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n pinky: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n };\r\n gestures: {\r\n fist: number;\r\n openPalm: number;\r\n peace: number;\r\n thumbsUp: number;\r\n pointing: number;\r\n };\r\n }\r\n\n interface ImageConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n interface ImageParameter {\r\n value: ImageBitmap | OffscreenCanvas | null;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n }\r\n\n 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 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 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 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 type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';\r\n\n interface PoseData {\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n visibility: number;\r\n }[];\r\n face: {\r\n x: number;\r\n y: number;\r\n }[];\r\n torso: {\r\n x: number;\r\n y: number;\r\n }[];\r\n leftArm: {\r\n x: number;\r\n y: number;\r\n }[];\r\n rightArm: {\r\n x: number;\r\n y: number;\r\n }[];\r\n leftLeg: {\r\n x: number;\r\n y: number;\r\n }[];\r\n rightLeg: {\r\n x: number;\r\n y: number;\r\n }[];\r\n }\r\n\n type Resolution = {\r\n width: number;\r\n height: number;\r\n };\r\n\n interface SegmentationData {\r\n mask: Uint8Array;\r\n width: number;\r\n height: number;\r\n }\r\n\n 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 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 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 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 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 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 interface ToggleConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n 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 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 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 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 const VERSION = \"0.2.20\";\r\n\n interface VideoAPI {\r\n isConnected: boolean;\r\n currentFrame: OffscreenCanvas | ImageBitmap | 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 pose: PoseData | null;\r\n segmentation: SegmentationData | null;\r\n cv: {\r\n enableFaceDetection(enabled: boolean): Promise<void>;\r\n enableFaceMesh(enabled: boolean): Promise<void>;\r\n enableEmotionDetection(enabled: boolean): Promise<void>;\r\n enableHandTracking(enabled: boolean): Promise<void>;\r\n enablePoseDetection(enabled: boolean): Promise<void>;\r\n enableBodySegmentation(enabled: boolean): Promise<void>;\r\n getActiveFeatures(): CVFeature[];\r\n isProcessing(): boolean;\r\n };\r\n }\r\n\n 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 streams: VideoAPI[];\r\n mouse: MouseAPI;\r\n keyboard: KeyboardAPI;\r\n touches: TouchAPI;\r\n device: DeviceSensorState;\r\n devices: DeviceState[];\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 image: (defaultValue: null, config: ImageConfig) => ImageParameter;\r\n useContext(type: '2d'): OffscreenCanvasRenderingContext2D;\n useContext(type: 'webgl'): WebGLRenderingContext;\n useContext(type: 'webgl2'): WebGL2RenderingContext;\r\n }\r\n\n // Runtime global - the main viji object\n const viji: VijiAPI;\n \n // Function type aliases (artists define their own render/setup functions)\n type Render = (viji: VijiAPI) => void;\n type Setup = (viji: VijiAPI) => void;\n}\n\n// Module marker (enables top-level await in artist code)\nexport {};\n";
|
|
1
|
+
export const artistDts = "// Viji Artist API - Global Type Definitions\n// All types are placed inside declare global {} because this file uses export {}\n// for top-level await support, which makes it a module (where top-level declarations\n// would otherwise be module-scoped, not global).\n\ndeclare global {\n interface AudioAPI {\r\n isConnected: boolean;\r\n volume: {\r\n current: number;\r\n peak: number;\r\n smoothed: number;\r\n };\r\n bands: {\r\n low: number;\r\n lowMid: number;\r\n mid: number;\r\n highMid: number;\r\n high: number;\r\n lowSmoothed: number;\r\n lowMidSmoothed: number;\r\n midSmoothed: number;\r\n highMidSmoothed: number;\r\n highSmoothed: number;\r\n };\r\n beat: {\r\n kick: number;\r\n snare: number;\r\n hat: number;\r\n any: number;\r\n kickSmoothed: number;\r\n snareSmoothed: number;\r\n hatSmoothed: number;\r\n anySmoothed: number;\r\n triggers: {\r\n any: boolean;\r\n kick: boolean;\r\n snare: boolean;\r\n hat: boolean;\r\n };\r\n events: Array<{\r\n type: 'kick' | 'snare' | 'hat';\r\n time: number;\r\n strength: number;\r\n }>;\r\n bpm: number;\r\n confidence: number;\r\n isLocked: boolean;\r\n };\r\n spectral: {\r\n brightness: number;\r\n flatness: number;\r\n };\r\n getFrequencyData: () => Uint8Array;\r\n getWaveform: () => Float32Array;\r\n }\r\n\n interface ButtonConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n interface ButtonParameter {\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 interface CaptureFrameOptions {\r\n /** Output format: 'blob' for encoded image, 'bitmap' for GPU-friendly ImageBitmap */\r\n format?: 'blob' | 'bitmap';\r\n /** MIME type for blob output (ignored for bitmap), 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 interface ColorConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n 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 type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDetection' | 'bodySegmentation' | 'emotionDetection';\r\n\n type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';\r\n\n interface DeviceMotionData {\r\n /** Acceleration without gravity (m/s²) */\r\n acceleration: {\r\n x: number | null;\r\n y: number | null;\r\n z: number | null;\r\n } | null;\r\n /** Acceleration including gravity (m/s²) */\r\n accelerationIncludingGravity: {\r\n x: number | null;\r\n y: number | null;\r\n z: number | null;\r\n } | null;\r\n /** Rotation rate (degrees/second) */\r\n rotationRate: {\r\n alpha: number | null;\r\n beta: number | null;\r\n gamma: number | null;\r\n } | null;\r\n /** Interval between updates (milliseconds) */\r\n interval: number;\r\n }\r\n\n interface DeviceOrientationData {\r\n /** Rotation around Z-axis (0-360 degrees, compass heading) */\r\n alpha: number | null;\r\n /** Rotation around X-axis (-180 to 180 degrees, front-to-back tilt) */\r\n beta: number | null;\r\n /** Rotation around Y-axis (-90 to 90 degrees, left-to-right tilt) */\r\n gamma: number | null;\r\n /** True if using magnetometer (compass) for absolute orientation */\r\n absolute: boolean;\r\n }\r\n\n interface DeviceSensorState {\r\n motion: DeviceMotionData | null;\r\n orientation: DeviceOrientationData | null;\r\n }\r\n\n interface DeviceState extends DeviceSensorState {\r\n /** Unique device identifier */\r\n id: string;\r\n /** User-friendly device name */\r\n name: string;\r\n /** Device camera video (null if not available) */\r\n video: VideoAPI | null;\r\n }\r\n\n interface FaceBlendshapes {\r\n browDownLeft: number;\r\n browDownRight: number;\r\n browInnerUp: number;\r\n browOuterUpLeft: number;\r\n browOuterUpRight: number;\r\n cheekPuff: number;\r\n cheekSquintLeft: number;\r\n cheekSquintRight: number;\r\n eyeBlinkLeft: number;\r\n eyeBlinkRight: number;\r\n eyeLookDownLeft: number;\r\n eyeLookDownRight: number;\r\n eyeLookInLeft: number;\r\n eyeLookInRight: number;\r\n eyeLookOutLeft: number;\r\n eyeLookOutRight: number;\r\n eyeLookUpLeft: number;\r\n eyeLookUpRight: number;\r\n eyeSquintLeft: number;\r\n eyeSquintRight: number;\r\n eyeWideLeft: number;\r\n eyeWideRight: number;\r\n jawForward: number;\r\n jawLeft: number;\r\n jawOpen: number;\r\n jawRight: number;\r\n mouthClose: number;\r\n mouthDimpleLeft: number;\r\n mouthDimpleRight: number;\r\n mouthFrownLeft: number;\r\n mouthFrownRight: number;\r\n mouthFunnel: number;\r\n mouthLeft: number;\r\n mouthLowerDownLeft: number;\r\n mouthLowerDownRight: number;\r\n mouthPressLeft: number;\r\n mouthPressRight: number;\r\n mouthPucker: number;\r\n mouthRight: number;\r\n mouthRollLower: number;\r\n mouthRollUpper: number;\r\n mouthShrugLower: number;\r\n mouthShrugUpper: number;\r\n mouthSmileLeft: number;\r\n mouthSmileRight: number;\r\n mouthStretchLeft: number;\r\n mouthStretchRight: number;\r\n mouthUpperUpLeft: number;\r\n mouthUpperUpRight: number;\r\n noseSneerLeft: number;\r\n noseSneerRight: number;\r\n tongueOut: number;\r\n }\r\n\n interface FaceData {\r\n id: number;\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n center: {\r\n x: number;\r\n y: number;\r\n };\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z?: number;\r\n }[];\r\n expressions: {\r\n neutral: number;\r\n happy: number;\r\n sad: number;\r\n angry: number;\r\n surprised: number;\r\n disgusted: number;\r\n fearful: number;\r\n };\r\n headPose: {\r\n pitch: number;\r\n yaw: number;\r\n roll: number;\r\n };\r\n blendshapes: FaceBlendshapes;\r\n }\r\n\n type FrameRateMode = 'full' | 'half';\r\n\n interface FrequencyBand {\r\n name: string;\r\n min: number;\r\n max: number;\r\n }\r\n\n interface HandData {\r\n id: number;\r\n handedness: 'left' | 'right';\r\n confidence: number;\r\n bounds: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n height: number;\r\n };\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n }[];\r\n palm: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n fingers: {\r\n thumb: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n index: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n middle: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n ring: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n pinky: {\r\n tip: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n };\r\n extended: boolean;\r\n };\r\n };\r\n gestures: {\r\n fist: number;\r\n openPalm: number;\r\n peace: number;\r\n thumbsUp: number;\r\n pointing: number;\r\n };\r\n }\r\n\n interface ImageConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n interface ImageParameter {\r\n value: ImageBitmap | null;\r\n label: string;\r\n description?: string;\r\n group: string;\r\n category: ParameterCategory;\r\n }\r\n\n 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 textureData: Uint8Array;\r\n }\r\n\n 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 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 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 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 type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';\r\n\n interface PointerAPI {\r\n x: number;\r\n y: number;\r\n deltaX: number;\r\n deltaY: number;\r\n isDown: boolean;\r\n wasPressed: boolean;\r\n wasReleased: boolean;\r\n isInCanvas: boolean;\r\n type: 'mouse' | 'touch' | 'none';\r\n }\r\n\n interface PoseData {\r\n confidence: number;\r\n landmarks: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n visibility: number;\r\n }[];\r\n face: {\r\n x: number;\r\n y: number;\r\n }[];\r\n torso: {\r\n x: number;\r\n y: number;\r\n }[];\r\n leftArm: {\r\n x: number;\r\n y: number;\r\n }[];\r\n rightArm: {\r\n x: number;\r\n y: number;\r\n }[];\r\n leftLeg: {\r\n x: number;\r\n y: number;\r\n }[];\r\n rightLeg: {\r\n x: number;\r\n y: number;\r\n }[];\r\n }\r\n\n type Resolution = {\r\n width: number;\r\n height: number;\r\n };\r\n\n interface SegmentationData {\r\n mask: Uint8Array;\r\n width: number;\r\n height: number;\r\n }\r\n\n 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 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 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 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 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 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 interface ToggleConfig {\r\n label: string;\r\n description?: string;\r\n group?: string;\r\n category?: ParameterCategory;\r\n }\r\n\n 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 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 }\r\n\n 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 isInCanvas: boolean;\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 const VERSION = \"0.2.20\";\r\n\n interface VideoAPI {\r\n isConnected: boolean;\r\n currentFrame: OffscreenCanvas | ImageBitmap | 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 pose: PoseData | null;\r\n segmentation: SegmentationData | null;\r\n cv: {\r\n enableFaceDetection(enabled: boolean): Promise<void>;\r\n enableFaceMesh(enabled: boolean): Promise<void>;\r\n enableEmotionDetection(enabled: boolean): Promise<void>;\r\n enableHandTracking(enabled: boolean): Promise<void>;\r\n enablePoseDetection(enabled: boolean): Promise<void>;\r\n enableBodySegmentation(enabled: boolean): Promise<void>;\r\n getActiveFeatures(): CVFeature[];\r\n isProcessing(): boolean;\r\n };\r\n }\r\n\n interface VijiAPI {\r\n canvas: OffscreenCanvas;\r\n ctx?: OffscreenCanvasRenderingContext2D;\r\n gl?: WebGLRenderingContext | WebGL2RenderingContext;\r\n width: number;\r\n height: 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 streams: VideoAPI[];\r\n mouse: MouseAPI;\r\n keyboard: KeyboardAPI;\r\n touches: TouchAPI;\r\n pointer: PointerAPI;\r\n device: DeviceSensorState;\r\n devices: DeviceState[];\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 image: (defaultValue: null, config: ImageConfig) => ImageParameter;\r\n button: (config: ButtonConfig) => ButtonParameter;\r\n useContext(type: '2d'): OffscreenCanvasRenderingContext2D;\r\n useContext(type: 'webgl'): WebGLRenderingContext;\r\n useContext(type: 'webgl2'): WebGL2RenderingContext;\r\n }\r\n\n // Runtime global - the main viji object\n const viji: VijiAPI;\n \n // Function type aliases (artists define their own render/setup functions)\n type Render = (viji: VijiAPI) => void;\n type Setup = (viji: VijiAPI) => void;\n}\n\n// Module marker (enables top-level await in artist code)\nexport {};\n";
|
package/dist/artist-global.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Viji Artist API - Global Type Definitions
|
|
2
|
-
// All types are placed inside declare global {} because this file uses export {}
|
|
3
|
-
// for top-level await support, which makes it a module (where top-level declarations
|
|
4
|
-
// would otherwise be module-scoped, not global).
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
1
|
+
// Viji Artist API - Global Type Definitions
|
|
2
|
+
// All types are placed inside declare global {} because this file uses export {}
|
|
3
|
+
// for top-level await support, which makes it a module (where top-level declarations
|
|
4
|
+
// would otherwise be module-scoped, not global).
|
|
5
|
+
|
|
6
|
+
declare global {
|
|
7
7
|
interface AudioAPI {
|
|
8
8
|
isConnected: boolean;
|
|
9
9
|
volume: {
|
|
@@ -54,7 +54,22 @@ declare global {
|
|
|
54
54
|
getFrequencyData: () => Uint8Array;
|
|
55
55
|
getWaveform: () => Float32Array;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
|
|
58
|
+
interface ButtonConfig {
|
|
59
|
+
label: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
group?: string;
|
|
62
|
+
category?: ParameterCategory;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface ButtonParameter {
|
|
66
|
+
value: boolean;
|
|
67
|
+
label: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
group: string;
|
|
70
|
+
category: ParameterCategory;
|
|
71
|
+
}
|
|
72
|
+
|
|
58
73
|
interface CaptureFrameOptions {
|
|
59
74
|
/** Output format: 'blob' for encoded image, 'bitmap' for GPU-friendly ImageBitmap */
|
|
60
75
|
format?: 'blob' | 'bitmap';
|
|
@@ -71,14 +86,14 @@ declare global {
|
|
|
71
86
|
height: number;
|
|
72
87
|
};
|
|
73
88
|
}
|
|
74
|
-
|
|
89
|
+
|
|
75
90
|
interface ColorConfig {
|
|
76
91
|
label: string;
|
|
77
92
|
description?: string;
|
|
78
93
|
group?: string;
|
|
79
94
|
category?: ParameterCategory;
|
|
80
95
|
}
|
|
81
|
-
|
|
96
|
+
|
|
82
97
|
interface ColorParameter {
|
|
83
98
|
value: string;
|
|
84
99
|
label: string;
|
|
@@ -86,11 +101,11 @@ declare global {
|
|
|
86
101
|
group: string;
|
|
87
102
|
category: ParameterCategory;
|
|
88
103
|
}
|
|
89
|
-
|
|
104
|
+
|
|
90
105
|
type CVFeature = 'faceDetection' | 'faceMesh' | 'handTracking' | 'poseDetection' | 'bodySegmentation' | 'emotionDetection';
|
|
91
|
-
|
|
106
|
+
|
|
92
107
|
type CVFrameRateMode = 'full' | 'half' | 'quarter' | 'eighth';
|
|
93
|
-
|
|
108
|
+
|
|
94
109
|
interface DeviceMotionData {
|
|
95
110
|
/** Acceleration without gravity (m/s²) */
|
|
96
111
|
acceleration: {
|
|
@@ -113,7 +128,7 @@ declare global {
|
|
|
113
128
|
/** Interval between updates (milliseconds) */
|
|
114
129
|
interval: number;
|
|
115
130
|
}
|
|
116
|
-
|
|
131
|
+
|
|
117
132
|
interface DeviceOrientationData {
|
|
118
133
|
/** Rotation around Z-axis (0-360 degrees, compass heading) */
|
|
119
134
|
alpha: number | null;
|
|
@@ -124,12 +139,12 @@ declare global {
|
|
|
124
139
|
/** True if using magnetometer (compass) for absolute orientation */
|
|
125
140
|
absolute: boolean;
|
|
126
141
|
}
|
|
127
|
-
|
|
142
|
+
|
|
128
143
|
interface DeviceSensorState {
|
|
129
144
|
motion: DeviceMotionData | null;
|
|
130
145
|
orientation: DeviceOrientationData | null;
|
|
131
146
|
}
|
|
132
|
-
|
|
147
|
+
|
|
133
148
|
interface DeviceState extends DeviceSensorState {
|
|
134
149
|
/** Unique device identifier */
|
|
135
150
|
id: string;
|
|
@@ -138,7 +153,7 @@ declare global {
|
|
|
138
153
|
/** Device camera video (null if not available) */
|
|
139
154
|
video: VideoAPI | null;
|
|
140
155
|
}
|
|
141
|
-
|
|
156
|
+
|
|
142
157
|
interface FaceBlendshapes {
|
|
143
158
|
browDownLeft: number;
|
|
144
159
|
browDownRight: number;
|
|
@@ -193,7 +208,7 @@ declare global {
|
|
|
193
208
|
noseSneerRight: number;
|
|
194
209
|
tongueOut: number;
|
|
195
210
|
}
|
|
196
|
-
|
|
211
|
+
|
|
197
212
|
interface FaceData {
|
|
198
213
|
id: number;
|
|
199
214
|
bounds: {
|
|
@@ -228,15 +243,15 @@ declare global {
|
|
|
228
243
|
};
|
|
229
244
|
blendshapes: FaceBlendshapes;
|
|
230
245
|
}
|
|
231
|
-
|
|
246
|
+
|
|
232
247
|
type FrameRateMode = 'full' | 'half';
|
|
233
|
-
|
|
248
|
+
|
|
234
249
|
interface FrequencyBand {
|
|
235
250
|
name: string;
|
|
236
251
|
min: number;
|
|
237
252
|
max: number;
|
|
238
253
|
}
|
|
239
|
-
|
|
254
|
+
|
|
240
255
|
interface HandData {
|
|
241
256
|
id: number;
|
|
242
257
|
handedness: 'left' | 'right';
|
|
@@ -307,22 +322,22 @@ declare global {
|
|
|
307
322
|
pointing: number;
|
|
308
323
|
};
|
|
309
324
|
}
|
|
310
|
-
|
|
325
|
+
|
|
311
326
|
interface ImageConfig {
|
|
312
327
|
label: string;
|
|
313
328
|
description?: string;
|
|
314
329
|
group?: string;
|
|
315
330
|
category?: ParameterCategory;
|
|
316
331
|
}
|
|
317
|
-
|
|
332
|
+
|
|
318
333
|
interface ImageParameter {
|
|
319
|
-
value: ImageBitmap |
|
|
334
|
+
value: ImageBitmap | null;
|
|
320
335
|
label: string;
|
|
321
336
|
description?: string;
|
|
322
337
|
group: string;
|
|
323
338
|
category: ParameterCategory;
|
|
324
339
|
}
|
|
325
|
-
|
|
340
|
+
|
|
326
341
|
interface KeyboardAPI {
|
|
327
342
|
isPressed(key: string): boolean;
|
|
328
343
|
wasPressed(key: string): boolean;
|
|
@@ -336,8 +351,9 @@ declare global {
|
|
|
336
351
|
ctrl: boolean;
|
|
337
352
|
alt: boolean;
|
|
338
353
|
meta: boolean;
|
|
354
|
+
textureData: Uint8Array;
|
|
339
355
|
}
|
|
340
|
-
|
|
356
|
+
|
|
341
357
|
interface MouseAPI {
|
|
342
358
|
x: number;
|
|
343
359
|
y: number;
|
|
@@ -346,10 +362,6 @@ declare global {
|
|
|
346
362
|
leftButton: boolean;
|
|
347
363
|
rightButton: boolean;
|
|
348
364
|
middleButton: boolean;
|
|
349
|
-
velocity: {
|
|
350
|
-
x: number;
|
|
351
|
-
y: number;
|
|
352
|
-
};
|
|
353
365
|
deltaX: number;
|
|
354
366
|
deltaY: number;
|
|
355
367
|
wheelDelta: number;
|
|
@@ -359,7 +371,7 @@ declare global {
|
|
|
359
371
|
wasReleased: boolean;
|
|
360
372
|
wasMoved: boolean;
|
|
361
373
|
}
|
|
362
|
-
|
|
374
|
+
|
|
363
375
|
interface NumberConfig {
|
|
364
376
|
min?: number;
|
|
365
377
|
max?: number;
|
|
@@ -369,7 +381,7 @@ declare global {
|
|
|
369
381
|
group?: string;
|
|
370
382
|
category?: ParameterCategory;
|
|
371
383
|
}
|
|
372
|
-
|
|
384
|
+
|
|
373
385
|
interface NumberParameter {
|
|
374
386
|
value: number;
|
|
375
387
|
min: number;
|
|
@@ -380,9 +392,21 @@ declare global {
|
|
|
380
392
|
group: string;
|
|
381
393
|
category: ParameterCategory;
|
|
382
394
|
}
|
|
383
|
-
|
|
395
|
+
|
|
384
396
|
type ParameterCategory = 'audio' | 'video' | 'interaction' | 'general';
|
|
385
|
-
|
|
397
|
+
|
|
398
|
+
interface PointerAPI {
|
|
399
|
+
x: number;
|
|
400
|
+
y: number;
|
|
401
|
+
deltaX: number;
|
|
402
|
+
deltaY: number;
|
|
403
|
+
isDown: boolean;
|
|
404
|
+
wasPressed: boolean;
|
|
405
|
+
wasReleased: boolean;
|
|
406
|
+
isInCanvas: boolean;
|
|
407
|
+
type: 'mouse' | 'touch' | 'none';
|
|
408
|
+
}
|
|
409
|
+
|
|
386
410
|
interface PoseData {
|
|
387
411
|
confidence: number;
|
|
388
412
|
landmarks: {
|
|
@@ -416,18 +440,18 @@ declare global {
|
|
|
416
440
|
y: number;
|
|
417
441
|
}[];
|
|
418
442
|
}
|
|
419
|
-
|
|
443
|
+
|
|
420
444
|
type Resolution = {
|
|
421
445
|
width: number;
|
|
422
446
|
height: number;
|
|
423
447
|
};
|
|
424
|
-
|
|
448
|
+
|
|
425
449
|
interface SegmentationData {
|
|
426
450
|
mask: Uint8Array;
|
|
427
451
|
width: number;
|
|
428
452
|
height: number;
|
|
429
453
|
}
|
|
430
|
-
|
|
454
|
+
|
|
431
455
|
interface SelectConfig {
|
|
432
456
|
options: string[] | number[];
|
|
433
457
|
label: string;
|
|
@@ -435,7 +459,7 @@ declare global {
|
|
|
435
459
|
group?: string;
|
|
436
460
|
category?: ParameterCategory;
|
|
437
461
|
}
|
|
438
|
-
|
|
462
|
+
|
|
439
463
|
interface SelectParameter {
|
|
440
464
|
value: string | number;
|
|
441
465
|
options: string[] | number[];
|
|
@@ -444,7 +468,7 @@ declare global {
|
|
|
444
468
|
group: string;
|
|
445
469
|
category: ParameterCategory;
|
|
446
470
|
}
|
|
447
|
-
|
|
471
|
+
|
|
448
472
|
interface SliderConfig {
|
|
449
473
|
min?: number;
|
|
450
474
|
max?: number;
|
|
@@ -454,7 +478,7 @@ declare global {
|
|
|
454
478
|
group?: string;
|
|
455
479
|
category?: ParameterCategory;
|
|
456
480
|
}
|
|
457
|
-
|
|
481
|
+
|
|
458
482
|
interface SliderParameter {
|
|
459
483
|
value: number;
|
|
460
484
|
min: number;
|
|
@@ -465,7 +489,7 @@ declare global {
|
|
|
465
489
|
group: string;
|
|
466
490
|
category: ParameterCategory;
|
|
467
491
|
}
|
|
468
|
-
|
|
492
|
+
|
|
469
493
|
interface TextConfig {
|
|
470
494
|
label: string;
|
|
471
495
|
description?: string;
|
|
@@ -473,7 +497,7 @@ declare global {
|
|
|
473
497
|
category?: ParameterCategory;
|
|
474
498
|
maxLength?: number;
|
|
475
499
|
}
|
|
476
|
-
|
|
500
|
+
|
|
477
501
|
interface TextParameter {
|
|
478
502
|
value: string;
|
|
479
503
|
maxLength?: number;
|
|
@@ -482,14 +506,14 @@ declare global {
|
|
|
482
506
|
group: string;
|
|
483
507
|
category: ParameterCategory;
|
|
484
508
|
}
|
|
485
|
-
|
|
509
|
+
|
|
486
510
|
interface ToggleConfig {
|
|
487
511
|
label: string;
|
|
488
512
|
description?: string;
|
|
489
513
|
group?: string;
|
|
490
514
|
category?: ParameterCategory;
|
|
491
515
|
}
|
|
492
|
-
|
|
516
|
+
|
|
493
517
|
interface ToggleParameter {
|
|
494
518
|
value: boolean;
|
|
495
519
|
label: string;
|
|
@@ -497,7 +521,7 @@ declare global {
|
|
|
497
521
|
group: string;
|
|
498
522
|
category: ParameterCategory;
|
|
499
523
|
}
|
|
500
|
-
|
|
524
|
+
|
|
501
525
|
interface TouchAPI {
|
|
502
526
|
points: TouchPoint[];
|
|
503
527
|
count: number;
|
|
@@ -505,30 +529,8 @@ declare global {
|
|
|
505
529
|
moved: TouchPoint[];
|
|
506
530
|
ended: TouchPoint[];
|
|
507
531
|
primary: TouchPoint | null;
|
|
508
|
-
gestures: TouchGestureAPI;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
interface TouchGestureAPI {
|
|
512
|
-
isPinching: boolean;
|
|
513
|
-
isRotating: boolean;
|
|
514
|
-
isPanning: boolean;
|
|
515
|
-
isTapping: boolean;
|
|
516
|
-
pinchScale: number;
|
|
517
|
-
pinchDelta: number;
|
|
518
|
-
rotationAngle: number;
|
|
519
|
-
rotationDelta: number;
|
|
520
|
-
panDelta: {
|
|
521
|
-
x: number;
|
|
522
|
-
y: number;
|
|
523
|
-
};
|
|
524
|
-
tapCount: number;
|
|
525
|
-
lastTapTime: number;
|
|
526
|
-
tapPosition: {
|
|
527
|
-
x: number;
|
|
528
|
-
y: number;
|
|
529
|
-
} | null;
|
|
530
532
|
}
|
|
531
|
-
|
|
533
|
+
|
|
532
534
|
interface TouchPoint {
|
|
533
535
|
id: number;
|
|
534
536
|
x: number;
|
|
@@ -539,6 +541,7 @@ declare global {
|
|
|
539
541
|
radiusY: number;
|
|
540
542
|
rotationAngle: number;
|
|
541
543
|
force: number;
|
|
544
|
+
isInCanvas: boolean;
|
|
542
545
|
deltaX: number;
|
|
543
546
|
deltaY: number;
|
|
544
547
|
velocity: {
|
|
@@ -549,9 +552,9 @@ declare global {
|
|
|
549
552
|
isActive: boolean;
|
|
550
553
|
isEnding: boolean;
|
|
551
554
|
}
|
|
552
|
-
|
|
555
|
+
|
|
553
556
|
const VERSION = "0.2.20";
|
|
554
|
-
|
|
557
|
+
|
|
555
558
|
interface VideoAPI {
|
|
556
559
|
isConnected: boolean;
|
|
557
560
|
currentFrame: OffscreenCanvas | ImageBitmap | null;
|
|
@@ -574,14 +577,13 @@ declare global {
|
|
|
574
577
|
isProcessing(): boolean;
|
|
575
578
|
};
|
|
576
579
|
}
|
|
577
|
-
|
|
580
|
+
|
|
578
581
|
interface VijiAPI {
|
|
579
582
|
canvas: OffscreenCanvas;
|
|
580
583
|
ctx?: OffscreenCanvasRenderingContext2D;
|
|
581
|
-
gl?: WebGL2RenderingContext;
|
|
584
|
+
gl?: WebGLRenderingContext | WebGL2RenderingContext;
|
|
582
585
|
width: number;
|
|
583
586
|
height: number;
|
|
584
|
-
pixelRatio: number;
|
|
585
587
|
time: number;
|
|
586
588
|
deltaTime: number;
|
|
587
589
|
frameCount: number;
|
|
@@ -592,6 +594,7 @@ declare global {
|
|
|
592
594
|
mouse: MouseAPI;
|
|
593
595
|
keyboard: KeyboardAPI;
|
|
594
596
|
touches: TouchAPI;
|
|
597
|
+
pointer: PointerAPI;
|
|
595
598
|
device: DeviceSensorState;
|
|
596
599
|
devices: DeviceState[];
|
|
597
600
|
slider: (defaultValue: number, config: SliderConfig) => SliderParameter;
|
|
@@ -601,18 +604,19 @@ declare global {
|
|
|
601
604
|
text: (defaultValue: string, config: TextConfig) => TextParameter;
|
|
602
605
|
number: (defaultValue: number, config: NumberConfig) => NumberParameter;
|
|
603
606
|
image: (defaultValue: null, config: ImageConfig) => ImageParameter;
|
|
607
|
+
button: (config: ButtonConfig) => ButtonParameter;
|
|
604
608
|
useContext(type: '2d'): OffscreenCanvasRenderingContext2D;
|
|
605
609
|
useContext(type: 'webgl'): WebGLRenderingContext;
|
|
606
610
|
useContext(type: 'webgl2'): WebGL2RenderingContext;
|
|
607
611
|
}
|
|
608
|
-
|
|
609
|
-
// Runtime global - the main viji object
|
|
610
|
-
const viji: VijiAPI;
|
|
611
|
-
|
|
612
|
-
// Function type aliases (artists define their own render/setup functions)
|
|
613
|
-
type Render = (viji: VijiAPI) => void;
|
|
614
|
-
type Setup = (viji: VijiAPI) => void;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
// Module marker (enables top-level await in artist code)
|
|
618
|
-
export {};
|
|
612
|
+
|
|
613
|
+
// Runtime global - the main viji object
|
|
614
|
+
const viji: VijiAPI;
|
|
615
|
+
|
|
616
|
+
// Function type aliases (artists define their own render/setup functions)
|
|
617
|
+
type Render = (viji: VijiAPI) => void;
|
|
618
|
+
type Setup = (viji: VijiAPI) => void;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// Module marker (enables top-level await in artist code)
|
|
622
|
+
export {};
|