@viji-dev/core 0.4.1 → 0.4.2

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.
@@ -12,7 +12,7 @@
12
12
  * @property {string} label - Display name shown next to the control in the parameter UI. Required.
13
13
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
14
14
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
15
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
15
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
16
16
  */
17
17
 
18
18
  /**
@@ -21,7 +21,7 @@
21
21
  * @property {string} label - Display name shown next to the color swatch in the parameter UI. Required.
22
22
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
23
23
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
24
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
24
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
25
25
  */
26
26
 
27
27
  /**
@@ -30,7 +30,7 @@
30
30
  * @property {string} label - Display name shown next to the switch in the parameter UI. Required.
31
31
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
32
32
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
33
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
33
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
34
34
  */
35
35
 
36
36
  /**
@@ -40,7 +40,7 @@
40
40
  * @property {string} label - Display name shown next to the dropdown in the parameter UI. Required.
41
41
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
42
42
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
43
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
43
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
44
44
  */
45
45
 
46
46
  /**
@@ -49,7 +49,7 @@
49
49
  * @property {string} label - Display name shown next to the text field in the parameter UI. Required.
50
50
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
51
51
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
52
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
52
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
53
53
  * @property {number} [maxLength] - Maximum character count enforced by the host UI. Default: `1000`.
54
54
  */
55
55
 
@@ -62,7 +62,7 @@
62
62
  * @property {string} label - Display name shown next to the input in the parameter UI. Required.
63
63
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
64
64
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
65
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
65
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
66
66
  */
67
67
 
68
68
  /**
@@ -71,16 +71,16 @@
71
71
  * @property {string} label - Display name shown next to the upload field in the parameter UI. Required.
72
72
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
73
73
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
74
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
74
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
75
75
  */
76
76
 
77
77
  /**
78
- * Configuration object passed to `viji.button()`. The host renders a clickable momentary button the resulting `value` is `true` for one frame after press, then auto-resets to `false`.
78
+ * Configuration object passed to `viji.button()`. The host renders a clickable momentary button. The resulting `value` is `true` for one frame after press, then auto-resets to `false`.
79
79
  * @typedef {Object} ButtonConfig
80
80
  * @property {string} label - Display name shown on the button in the parameter UI. Required.
81
81
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
82
82
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
83
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
83
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
84
84
  */
85
85
 
86
86
  /**
@@ -90,7 +90,7 @@
90
90
  * @property {string} label - Display name shown next to the pad in the parameter UI. Required.
91
91
  * @property {string} [description] - Optional tooltip / help text shown next to the control.
92
92
  * @property {string} [group] - Group name for organizing related parameters under a shared heading. Default: `'general'`.
93
- * @property {ParameterCategory} [category] - Visibility category the control hides when its capability is unavailable. Default: `'general'`.
93
+ * @property {ParameterCategory} [category] - Visibility category. The control hides when its capability is unavailable. Default: `'general'`.
94
94
  */
95
95
 
96
96
  /**
@@ -103,7 +103,7 @@
103
103
  * @property {string} label - Display name shown next to the control in the parameter UI.
104
104
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
105
105
  * @property {string} group - Group name under which the control appears in the UI.
106
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
106
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
107
107
  */
108
108
 
109
109
  /**
@@ -121,7 +121,7 @@
121
121
  * @property {string} label - Display name shown next to the swatch in the parameter UI.
122
122
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
123
123
  * @property {string} group - Group name under which the control appears in the UI.
124
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
124
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
125
125
  */
126
126
 
127
127
  /**
@@ -131,7 +131,7 @@
131
131
  * @property {string} label - Display name shown next to the switch in the parameter UI.
132
132
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
133
133
  * @property {string} group - Group name under which the control appears in the UI.
134
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
134
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
135
135
  */
136
136
 
137
137
  /**
@@ -142,7 +142,7 @@
142
142
  * @property {string} label - Display name shown next to the dropdown in the parameter UI.
143
143
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
144
144
  * @property {string} group - Group name under which the control appears in the UI.
145
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
145
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
146
146
  */
147
147
 
148
148
  /**
@@ -153,7 +153,7 @@
153
153
  * @property {string} label - Display name shown next to the input in the parameter UI.
154
154
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
155
155
  * @property {string} group - Group name under which the control appears in the UI.
156
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
156
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
157
157
  */
158
158
 
159
159
  /**
@@ -166,27 +166,27 @@
166
166
  * @property {string} label - Display name shown next to the input in the parameter UI.
167
167
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
168
168
  * @property {string} group - Group name under which the control appears in the UI.
169
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
169
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
170
170
  */
171
171
 
172
172
  /**
173
173
  * Reactive object returned by `viji.image()`. `value` is `null` until the user uploads an image; in P5 scenes a `.p5` accessor is also added at runtime so the image works directly with `image()`, `texture()`, etc.
174
174
  * @typedef {Object} ImageParameter
175
175
  * @property {ImageBitmap |null} value - Uploaded image as an `ImageBitmap`, or `null` until the user provides one.
176
- * @property {string} label - P5-compatible image wrapper. Only available in the P5 renderer added at runtime by the P5 adapter. Display name shown next to the upload field in the parameter UI.
176
+ * @property {string} label - P5-compatible image wrapper. Only available in the P5 renderer; added at runtime by the P5 adapter. Display name shown next to the upload field in the parameter UI.
177
177
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
178
178
  * @property {string} group - Group name under which the control appears in the UI.
179
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
179
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
180
180
  */
181
181
 
182
182
  /**
183
- * Reactive object returned by `viji.button()`. `value` is a momentary flag `true` for exactly one frame after the user clicks, then auto-resets to `false`. Use it to trigger discrete events from `render()`.
183
+ * Reactive object returned by `viji.button()`. `value` is a momentary flag: `true` for exactly one frame after the user clicks, then auto-resets to `false`. Use it to trigger discrete events from `render()`.
184
184
  * @typedef {Object} ButtonParameter
185
185
  * @property {boolean} value - `true` for the single frame after the user clicks the button, `false` otherwise.
186
186
  * @property {string} label - Display name shown on the button in the parameter UI.
187
187
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
188
188
  * @property {string} group - Group name under which the control appears in the UI.
189
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
189
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
190
190
  */
191
191
 
192
192
  /**
@@ -197,7 +197,7 @@
197
197
  * @property {string} label - Display name shown next to the pad in the parameter UI.
198
198
  * @property {string} [description] - Tooltip / help text for the control (empty string when not configured).
199
199
  * @property {string} group - Group name under which the control appears in the UI.
200
- * @property {ParameterCategory} category - Visibility category controls when the parameter is shown.
200
+ * @property {ParameterCategory} category - Visibility category that controls when the parameter is shown.
201
201
  */
202
202
 
203
203
  /**
@@ -209,11 +209,11 @@
209
209
  * @property {number} volume.peak - Instantaneous peak amplitude in 0..1.
210
210
  * @property {number} volume.smoothed - Volume with a 200ms decay envelope; rises fast, falls smoothly. Use for flicker-free animations.
211
211
  * @property {Object} bands - Energy in five fixed frequency bands, plus a smoothed companion (~150ms decay) for each. All in 0..1.
212
- * @property {number} bands.low - Instant low-band energy (20120 Hz, bass/kick range). 0..1.
213
- * @property {number} bands.lowMid - Instant low-mid energy (120400 Hz). 0..1.
214
- * @property {number} bands.mid - Instant mid energy (4001600 Hz, vocals/instruments). 0..1.
215
- * @property {number} bands.highMid - Instant high-mid energy (16006000 Hz, cymbals/hi-hats). 0..1.
216
- * @property {number} bands.high - Instant high-band energy (600016000 Hz, air/brilliance). 0..1.
212
+ * @property {number} bands.low - Instant low-band energy (20-120 Hz, bass/kick range). 0..1.
213
+ * @property {number} bands.lowMid - Instant low-mid energy (120-400 Hz). 0..1.
214
+ * @property {number} bands.mid - Instant mid energy (400-1600 Hz, vocals/instruments). 0..1.
215
+ * @property {number} bands.highMid - Instant high-mid energy (1600-6000 Hz, cymbals/hi-hats). 0..1.
216
+ * @property {number} bands.high - Instant high-band energy (6000-16000 Hz, air/brilliance). 0..1.
217
217
  * @property {number} bands.lowSmoothed - Smoothed `low` (~150ms decay). 0..1.
218
218
  * @property {number} bands.lowMidSmoothed - Smoothed `lowMid` (~150ms decay). 0..1.
219
219
  * @property {number} bands.midSmoothed - Smoothed `mid` (~150ms decay). 0..1.
@@ -232,14 +232,14 @@
232
232
  * @property {number} beat.confidence - Confidence of the BPM tracker in 0..1.
233
233
  * @property {boolean} beat.isLocked - `true` when the BPM tracker has a stable lock on the current tempo.
234
234
  * @property {Object} spectral - High-level spectral features derived from the FFT.
235
- * @property {number} spectral.brightness - Normalized spectral centroid in 0..1 higher values mean brighter, more treble-heavy sound.
236
- * @property {number} spectral.flatness - Normalized spectral flatness in 0..1 higher values mean noisier (white-noise-like) sound; lower values mean tonal.
237
- * @property {() => Uint8Array} getFrequencyData - Returns the raw FFT magnitude spectrum as a `Uint8Array` (1024 bins, each 0..255). Bin `i` covers frequency `i × (sampleRate / fftSize)`. The returned array is a snapshot from the latest analysis tick repeated calls in the same frame return the same data. @example const fft = viji.audio.getFrequencyData(); for (let i = 0; i < fft.length; i++) drawBar(i, fft[i] / 255);
238
- * @property {() => Float32Array} getWaveform - Returns the raw time-domain waveform as a `Float32Array` (2048 PCM samples in -1..1). The returned array is a snapshot repeated calls in the same frame return the same data. @example const wave = viji.audio.getWaveform(); for (let i = 0; i < wave.length; i++) drawSample(i, wave[i]);
235
+ * @property {number} spectral.brightness - Normalized spectral centroid in 0..1. Higher values mean brighter, more treble-heavy sound.
236
+ * @property {number} spectral.flatness - Normalized spectral flatness in 0..1. Higher values mean noisier (white-noise-like) sound; lower values mean tonal.
237
+ * @property {() => Uint8Array} getFrequencyData - Returns the raw FFT magnitude spectrum as a `Uint8Array` (1024 bins, each 0..255). Bin `i` covers frequency `i × (sampleRate / fftSize)`. The returned array is a snapshot from the latest analysis tick; repeated calls in the same frame return the same data. @example const fft = viji.audio.getFrequencyData(); for (let i = 0; i < fft.length; i++) drawBar(i, fft[i] / 255);
238
+ * @property {() => Float32Array} getWaveform - Returns the raw time-domain waveform as a `Float32Array` (2048 PCM samples in -1..1). The returned array is a snapshot; repeated calls in the same frame return the same data. @example const wave = viji.audio.getWaveform(); for (let i = 0; i < wave.length; i++) drawSample(i, wave[i]);
239
239
  */
240
240
 
241
241
  /**
242
- * Lightweight audio analysis for additional or device audio streams. A strict subset of `AudioAPI` exposes volume, frequency bands, spectral features, and raw FFT/waveform access, but **no beat detection** (no `beat`, no BPM, no triggers, no events).
242
+ * Lightweight audio analysis for additional or device audio streams. A strict subset of `AudioAPI` that exposes volume, frequency bands, spectral features, and raw FFT/waveform access, but **no beat detection** (no `beat`, no BPM, no triggers, no events).
243
243
  * @typedef {Object} AudioStreamAPI
244
244
  * @property {boolean} isConnected - `true` when this audio stream is connected; otherwise all numeric fields read as `0`.
245
245
  * @property {Object} volume - Overall loudness across the stream.
@@ -247,11 +247,11 @@
247
247
  * @property {number} volume.peak - Instantaneous peak amplitude in 0..1.
248
248
  * @property {number} volume.smoothed - Volume with a 200ms decay envelope.
249
249
  * @property {Object} bands - Energy in five fixed frequency bands, plus a smoothed companion (~150ms decay) for each. All in 0..1.
250
- * @property {number} bands.low - Instant low-band energy (20120 Hz). 0..1.
251
- * @property {number} bands.lowMid - Instant low-mid energy (120400 Hz). 0..1.
252
- * @property {number} bands.mid - Instant mid energy (4001600 Hz). 0..1.
253
- * @property {number} bands.highMid - Instant high-mid energy (16006000 Hz). 0..1.
254
- * @property {number} bands.high - Instant high-band energy (600016000 Hz). 0..1.
250
+ * @property {number} bands.low - Instant low-band energy (20-120 Hz). 0..1.
251
+ * @property {number} bands.lowMid - Instant low-mid energy (120-400 Hz). 0..1.
252
+ * @property {number} bands.mid - Instant mid energy (400-1600 Hz). 0..1.
253
+ * @property {number} bands.highMid - Instant high-mid energy (1600-6000 Hz). 0..1.
254
+ * @property {number} bands.high - Instant high-band energy (6000-16000 Hz). 0..1.
255
255
  * @property {number} bands.lowSmoothed - Smoothed `low` (~150ms decay). 0..1.
256
256
  * @property {number} bands.lowMidSmoothed - Smoothed `lowMid` (~150ms decay). 0..1.
257
257
  * @property {number} bands.midSmoothed - Smoothed `mid` (~150ms decay). 0..1.
@@ -260,8 +260,8 @@
260
260
  * @property {Object} spectral - High-level spectral features derived from the FFT.
261
261
  * @property {number} spectral.brightness - Normalized spectral centroid in 0..1.
262
262
  * @property {number} spectral.flatness - Normalized spectral flatness in 0..1.
263
- * @property {() => Uint8Array} getFrequencyData - Returns the raw FFT magnitude spectrum for this stream as a `Uint8Array` (1024 bins, each 0..255). Snapshot semantics see `AudioAPI.getFrequencyData`.
264
- * @property {() => Float32Array} getWaveform - Returns the raw time-domain waveform for this stream as a `Float32Array` (2048 samples, each -1..1). Snapshot semantics see `AudioAPI.getWaveform`.
263
+ * @property {() => Uint8Array} getFrequencyData - Returns the raw FFT magnitude spectrum for this stream as a `Uint8Array` (1024 bins, each 0..255). Snapshot semantics; see `AudioAPI.getFrequencyData`.
264
+ * @property {() => Float32Array} getWaveform - Returns the raw time-domain waveform for this stream as a `Float32Array` (2048 samples, each -1..1). Snapshot semantics; see `AudioAPI.getWaveform`.
265
265
  */
266
266
 
267
267
  /**
@@ -272,7 +272,7 @@
272
272
  * @property {number} frameWidth - Source video frame width in pixels. `0` when disconnected.
273
273
  * @property {number} frameHeight - Source video frame height in pixels. `0` when disconnected.
274
274
  * @property {number} frameRate - Source video frame rate in Hz (frames per second). `0` when disconnected.
275
- * @property {() => ImageData |null} getFrameData - Returns the latest frame as raw RGBA `ImageData` for per-pixel CPU analysis, or `null` when disconnected. Slow compared to drawing `currentFrame` directly use only when you need to read individual pixel values.
275
+ * @property {() => ImageData |null} getFrameData - Returns the latest frame as raw RGBA `ImageData` for per-pixel CPU analysis, or `null` when disconnected. Slow compared to drawing `currentFrame` directly; use only when you need to read individual pixel values.
276
276
  * @property {FaceData[]} faces - Detected faces (empty array when face detection is off or no faces are visible).
277
277
  * @property {HandData[]} hands - Detected hands (up to 2; empty array when hand tracking is off or no hands are visible).
278
278
  * @property {PoseData |null} pose - Detected body pose, or `null` when pose detection is off or no pose is visible.
@@ -319,7 +319,7 @@
319
319
  */
320
320
 
321
321
  /**
322
- * Multi-touch input state. Lists all active touches, plus per-frame `started` / `moved` / `ended` arrays for frame-based gesture handling. For single-point interactions that should also work with a mouse, prefer `viji.pointer` it switches automatically between mouse and primary touch.
322
+ * Multi-touch input state. Lists all active touches, plus per-frame `started` / `moved` / `ended` arrays for frame-based gesture handling. For single-point interactions that should also work with a mouse, prefer `viji.pointer`. It switches automatically between mouse and primary touch.
323
323
  * @typedef {Object} TouchAPI
324
324
  * @property {TouchPoint[]} points - All currently active touch points. Order is stable but not ordered by id.
325
325
  * @property {number} count - Number of currently active touches (equivalent to `points.length`).
@@ -335,34 +335,34 @@
335
335
  * @property {OffscreenCanvas} canvas - The `OffscreenCanvas` driving the scene. The host owns its lifecycle and dimensions; prefer `useContext()` over touching this directly.
336
336
  * @property {OffscreenCanvasRenderingContext2D} [ctx] - 2D rendering context. `undefined` until `viji.useContext('2d')` is called; afterwards equals the cached context.
337
337
  * @property {WebGLRenderingContext | WebGL2RenderingContext} [gl] - WebGL rendering context. `undefined` until `viji.useContext('webgl')` or `'webgl2'` is called; afterwards equals the cached context.
338
- * @property {number} width - Current canvas width in pixels. Updates automatically when the host resizes the canvas read every frame.
339
- * @property {number} height - Current canvas height in pixels. Updates automatically when the host resizes the canvas read every frame.
338
+ * @property {number} width - Current canvas width in pixels. Updates automatically when the host resizes the canvas; read every frame.
339
+ * @property {number} height - Current canvas height in pixels. Updates automatically when the host resizes the canvas; read every frame.
340
340
  * @property {number} time - Seconds elapsed since the scene started (monotonically increasing float). Use for oscillations and absolute-time effects.
341
- * @property {number} deltaTime - Seconds since the previous frame. Use for accumulation: movement, physics, fades anything that should progress per second regardless of FPS.
341
+ * @property {number} deltaTime - Seconds since the previous frame. Use for accumulation: movement, physics, fades, anything that should progress per second regardless of FPS.
342
342
  * @property {number} frameCount - Integer frame counter starting at `0` and incrementing by `1` each frame.
343
343
  * @property {number} fps - Target frames-per-second for the host's current frame-rate mode (`60` for `'full'`, `30` for `'half'`).
344
344
  * @property {AudioAPI} audio - Real-time analysis of the main audio stream: volume, frequency bands, beat detection, spectral features. Fields are zeroed when no audio source is connected.
345
345
  * @property {VideoAPI} video - Main video stream API: pixel access, frame metadata, and computer-vision results (face, hands, pose, segmentation).
346
- * @property {VideoAPI[]} videoStreams - Additional video streams provided by the host. These do not run CV processing use them for raw pixel access only.
347
- * @property {AudioStreamAPI[]} audioStreams - Additional audio streams (lightweight analysis: volume, bands, spectral). No beat detection use the main `audio` for that.
346
+ * @property {VideoAPI[]} videoStreams - Additional video streams provided by the host. These do not run CV processing; use them for raw pixel access only.
347
+ * @property {AudioStreamAPI[]} audioStreams - Additional audio streams (lightweight analysis: volume, bands, spectral). No beat detection; use the main `audio` for that.
348
348
  * @property {MouseAPI} mouse - Mouse position, buttons, wheel, and per-frame movement state. Coordinates are in canvas pixels.
349
349
  * @property {KeyboardAPI} keyboard - Keyboard state: per-frame press/release queries, currently held keys, and modifier flags.
350
350
  * @property {TouchAPI} touches - Multi-touch state: count, primary touch shortcut, and the per-frame `started` / `moved` / `ended` arrays.
351
- * @property {PointerAPI} pointer - Unified pointer (mouse + primary touch) convenient single-point input that works on both desktop and mobile.
351
+ * @property {PointerAPI} pointer - Unified pointer (mouse + primary touch). Convenient single-point input that works on both desktop and mobile.
352
352
  * @property {DeviceSensorState} device - Internal device sensors (motion + orientation) reported by the device running the scene.
353
353
  * @property {DeviceState[]} devices - External connected devices reporting sensor / camera / audio. Each entry has its own `id`, `name`, and per-device API surface.
354
- * @property {(defaultValue: number, config: SliderConfig) => SliderParameter} slider - Declares a numeric slider parameter. The host UI renders a draggable slider. Must be called at the top level of the scene never inside `render()`. @example const radius = viji.slider(50, { min: 10, max: 200, step: 1, label: 'Radius' }); // ... function render(viji) { drawCircle(radius.value); }
355
- * @property {(defaultValue: ColorInput, config: ColorConfig) => ColorParameter} color - Declares a color parameter. Accepts hex strings, CSS color functions, or RGB / HSB objects; the value is always normalized to a canonical lowercase hex string and exposes derived `.rgb` / `.hsb` accessors. Must be called at the top level of the scene never inside `render()`. @example const tint = viji.color('#ff6600', { label: 'Tint' }); // tint.value -> '#ff6600', tint.rgb -> { r: 255, g: 102, b: 0 }, tint.hsb -> { h: 24, s: 100, b: 100 }
356
- * @property {(defaultValue: boolean, config: ToggleConfig) => ToggleParameter} toggle - Declares a boolean toggle parameter. The host UI renders an on/off switch. Must be called at the top level of the scene never inside `render()`. @example const showTrail = viji.toggle(true, { label: 'Show Trail' });
357
- * @property {(defaultValue: string | number, config: SelectConfig) => SelectParameter} select - Declares a dropdown selection parameter. The element type of `options` (`string` or `number`) determines the parameter's value type. Must be called at the top level of the scene never inside `render()`. @example const shape = viji.select('circle', { options: ['circle', 'square', 'triangle'], label: 'Shape' });
358
- * @property {(defaultValue: string, config: TextConfig) => TextParameter} text - Declares a text input parameter. The host UI renders a single-line text field. Must be called at the top level of the scene never inside `render()`. @example const caption = viji.text('Hello', { label: 'Caption', maxLength: 64 });
359
- * @property {(defaultValue: number, config: NumberConfig) => NumberParameter} number - Declares a precise numeric input parameter. Like `slider()` but the host UI shows a number field instead of a draggable handle. Must be called at the top level of the scene never inside `render()`. @example const count = viji.number(12, { min: 1, max: 64, step: 1, label: 'Count' });
360
- * @property {(defaultValue: null, config: ImageConfig) => ImageParameter} image - Declares an image upload parameter. The user-supplied image becomes available as `value` (an `ImageBitmap`); in P5 scenes a `.p5` accessor is also added at runtime. Must be called at the top level of the scene never inside `render()`. @example const tex = viji.image(null, { label: 'Texture' }); if (tex.value) ctx.drawImage(tex.value, 0, 0, viji.width, viji.height);
361
- * @property {(config: ButtonConfig) => ButtonParameter} button - Declares a momentary button parameter. `value` is `true` for one frame after the user clicks, then auto-resets perfect for triggering discrete events. Must be called at the top level of the scene never inside `render()`. @example const reset = viji.button({ label: 'Reset' }); function render(viji) { if (reset.value) state = initialState; }
362
- * @property {(defaultValue: CoordinateValue, config: CoordinateConfig) => CoordinateParameter} coordinate - Declares a 2D coordinate parameter. Both `value.x` and `value.y` are in `-1..1`. Must be called at the top level of the scene never inside `render()`. @example const origin = viji.coordinate({ x: 0, y: 0 }, { label: 'Origin' }); const cx = viji.width / 2 + origin.value.x * viji.width * 0.4;
363
- * @property {(type: '2d') => OffscreenCanvasRenderingContext2D} useContext - Selects the 2D canvas rendering context. Returns the same instance on subsequent calls and also stores it on `viji.ctx`. A canvas only supports one context type if a different context type was already requested, the call returns `null`. Choose ONE type and use it for the entire scene. @example const ctx = viji.useContext('2d'); ctx.fillRect(0, 0, viji.width, viji.height);
364
- * @property {(type: 'webgl') => WebGLRenderingContext} useContext - Selects a WebGL 1 rendering context. Returns the same instance on subsequent calls and also stores it on `viji.gl`. A canvas only supports one context type if a different context type was already requested, the call returns `null`. Choose ONE type and use it for the entire scene.
365
- * @property {(type: 'webgl2') => WebGL2RenderingContext} useContext - Selects a WebGL 2 rendering context. Returns the same instance on subsequent calls and also stores it on `viji.gl`. A canvas only supports one context type if a different context type was already requested, the call returns `null`. Choose ONE type and use it for the entire scene.
354
+ * @property {(defaultValue: number, config: SliderConfig) => SliderParameter} slider - Declares a numeric slider parameter. The host UI renders a draggable slider. Must be called at the top level of the scene, never inside `render()`. @example const radius = viji.slider(50, { min: 10, max: 200, step: 1, label: 'Radius' }); // ... function render(viji) { drawCircle(radius.value); }
355
+ * @property {(defaultValue: ColorInput, config: ColorConfig) => ColorParameter} color - Declares a color parameter. Accepts hex strings, CSS color functions, or RGB / HSB objects; the value is always normalized to a canonical lowercase hex string and exposes derived `.rgb` / `.hsb` accessors. Must be called at the top level of the scene, never inside `render()`. @example const tint = viji.color('#ff6600', { label: 'Tint' }); // tint.value -> '#ff6600', tint.rgb -> { r: 255, g: 102, b: 0 }, tint.hsb -> { h: 24, s: 100, b: 100 }
356
+ * @property {(defaultValue: boolean, config: ToggleConfig) => ToggleParameter} toggle - Declares a boolean toggle parameter. The host UI renders an on/off switch. Must be called at the top level of the scene, never inside `render()`. @example const showTrail = viji.toggle(true, { label: 'Show Trail' });
357
+ * @property {(defaultValue: string | number, config: SelectConfig) => SelectParameter} select - Declares a dropdown selection parameter. The element type of `options` (`string` or `number`) determines the parameter's value type. Must be called at the top level of the scene, never inside `render()`. @example const shape = viji.select('circle', { options: ['circle', 'square', 'triangle'], label: 'Shape' });
358
+ * @property {(defaultValue: string, config: TextConfig) => TextParameter} text - Declares a text input parameter. The host UI renders a single-line text field. Must be called at the top level of the scene, never inside `render()`. @example const caption = viji.text('Hello', { label: 'Caption', maxLength: 64 });
359
+ * @property {(defaultValue: number, config: NumberConfig) => NumberParameter} number - Declares a precise numeric input parameter. Like `slider()` but the host UI shows a number field instead of a draggable handle. Must be called at the top level of the scene, never inside `render()`. @example const count = viji.number(12, { min: 1, max: 64, step: 1, label: 'Count' });
360
+ * @property {(defaultValue: null, config: ImageConfig) => ImageParameter} image - Declares an image upload parameter. The user-supplied image becomes available as `value` (an `ImageBitmap`); in P5 scenes a `.p5` accessor is also added at runtime. Must be called at the top level of the scene, never inside `render()`. @example const tex = viji.image(null, { label: 'Texture' }); if (tex.value) ctx.drawImage(tex.value, 0, 0, viji.width, viji.height);
361
+ * @property {(config: ButtonConfig) => ButtonParameter} button - Declares a momentary button parameter. `value` is `true` for one frame after the user clicks, then auto-resets. Perfect for triggering discrete events. Must be called at the top level of the scene, never inside `render()`. @example const reset = viji.button({ label: 'Reset' }); function render(viji) { if (reset.value) state = initialState; }
362
+ * @property {(defaultValue: CoordinateValue, config: CoordinateConfig) => CoordinateParameter} coordinate - Declares a 2D coordinate parameter. Both `value.x` and `value.y` are in `-1..1`. Must be called at the top level of the scene, never inside `render()`. @example const origin = viji.coordinate({ x: 0, y: 0 }, { label: 'Origin' }); const cx = viji.width / 2 + origin.value.x * viji.width * 0.4;
363
+ * @property {(type: '2d') => OffscreenCanvasRenderingContext2D} useContext - Selects the 2D canvas rendering context. Returns the same instance on subsequent calls and also stores it on `viji.ctx`. A canvas only supports one context type. If a different context type was already requested, the call returns `null`. Choose ONE type and use it for the entire scene. @example const ctx = viji.useContext('2d'); ctx.fillRect(0, 0, viji.width, viji.height);
364
+ * @property {(type: 'webgl') => WebGLRenderingContext} useContext - Selects a WebGL 1 rendering context. Returns the same instance on subsequent calls and also stores it on `viji.gl`. A canvas only supports one context type. If a different context type was already requested, the call returns `null`. Choose ONE type and use it for the entire scene.
365
+ * @property {(type: 'webgl2') => WebGL2RenderingContext} useContext - Selects a WebGL 2 rendering context. Returns the same instance on subsequent calls and also stores it on `viji.gl`. A canvas only supports one context type. If a different context type was already requested, the call returns `null`. Choose ONE type and use it for the entire scene.
366
366
  */
367
367
 
368
368
  /**
@@ -469,7 +469,7 @@
469
469
  * @property {number} landmarks.x - Horizontal landmark coordinate, normalized 0..1.
470
470
  * @property {number} landmarks.y - Vertical landmark coordinate, normalized 0..1.
471
471
  * @property {number} landmarks.z - Depth (relative).
472
- * @property {Object} palm - Palm center equivalent to `landmarks[9]` (middle-finger MCP).
472
+ * @property {Object} palm - Palm center, equivalent to `landmarks[9]` (middle-finger MCP).
473
473
  * @property {number} palm.x - Palm horizontal coordinate, normalized 0..1.
474
474
  * @property {number} palm.y - Palm vertical coordinate, normalized 0..1.
475
475
  * @property {number} palm.z - Palm depth (relative).