@viji-dev/core 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -466,6 +466,7 @@ export declare class AudioSystem {
466
466
  isOnsetMuted(instrument: InstrumentType): boolean;
467
467
  onOnsetModeChange(listener: (ev: OnsetModeChangeEvent) => void): Unsubscribe;
468
468
  onOnsetSessionEnd(listener: (ev: OnsetSessionEndEvent) => void): Unsubscribe;
469
+ onOnsetMuteChange(listener: (ev: OnsetMuteChangeEvent) => void): Unsubscribe;
469
470
  exportOnsetSessionState(): SerializedOnsetState;
470
471
  importOnsetSessionState(state: SerializedOnsetState, clockOffset: number): void;
471
472
  exportAudioAnalysisState(): SerializedAudioAnalysisState;
@@ -1455,6 +1456,12 @@ export declare interface OnsetModeChangeEvent {
1455
1456
  newMode: OnsetMode;
1456
1457
  }
1457
1458
 
1459
+ export declare interface OnsetMuteChangeEvent {
1460
+ instrument: OnsetInstrument;
1461
+ prevMuted: boolean;
1462
+ muted: boolean;
1463
+ }
1464
+
1458
1465
  export declare interface OnsetSessionEndEvent {
1459
1466
  instrument: OnsetInstrument;
1460
1467
  /**
@@ -2237,7 +2244,7 @@ declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
2237
2244
  /** Returned by `on*` listener registration calls; invoke to unsubscribe. */
2238
2245
  export declare type Unsubscribe = () => void;
2239
2246
 
2240
- export declare const VERSION = "0.5.1";
2247
+ export declare const VERSION = "0.5.3";
2241
2248
 
2242
2249
  /**
2243
2250
  * Real-time video API: drawable frame, dimensions, and the source-side
@@ -2877,8 +2884,12 @@ export declare class VijiCore {
2877
2884
  /**
2878
2885
  * Replace the audio analysis + onset state from a serialized payload.
2879
2886
  * `clockOffset` is added to all sender-clocked fields (`0` for same-process,
2880
- * NTP-derived for cross-device). Mutation is synchronous; no `onModeChange`
2881
- * or `onSessionEnd` events are emitted (state replacement is not a transition).
2887
+ * NTP-derived for cross-device). Mutation is synchronous.
2888
+ *
2889
+ * Field-level events (`onModeChange`, `onMuteChange`) fire when imported
2890
+ * values differ from current — consumer-visible state stays consistent
2891
+ * with what polling would have observed. Session-boundary events
2892
+ * (`onSessionEnd`) do NOT fire on import.
2882
2893
  *
2883
2894
  * Validates `version`; on mismatch, fires `onStateImportError` and leaves
2884
2895
  * existing state intact.
@@ -3034,26 +3045,51 @@ export declare class VijiCore {
3034
3045
  isMuted: (instrument: "kick" | "snare" | "hat") => boolean;
3035
3046
  /**
3036
3047
  * Listen for instrument mode transitions (`'auto' | 'tapping' | 'pattern'`).
3037
- * Fires on every transition including the first tap (`'auto' → 'tapping'`)
3038
- * and pattern recognition (`'tapping' → 'pattern'`). Imported state does
3039
- * NOT fire mode-change events state replacement is not a transition.
3048
+ * Fires whenever the underlying mode field actually changes, regardless
3049
+ * of which code path triggered it — first tap (`'auto' → 'tapping'`),
3050
+ * pattern recognition (`'tapping' 'pattern'`), the 5s tap timeout
3051
+ * (`'tapping' → 'auto'`), explicit `clear()`, or `importSessionState`
3052
+ * landing a different mode value.
3053
+ *
3054
+ * Idempotent transitions (already in target mode) do not fire.
3040
3055
  *
3041
3056
  * @returns Unsubscribe function. Call to remove the listener.
3042
3057
  */
3043
3058
  onModeChange: (listener: (ev: OnsetModeChangeEvent) => void) => Unsubscribe;
3044
3059
  /**
3045
- * Listen for natural session-end events. Fires when:
3060
+ * Listen for natural session-end events. Fires only on natural session
3061
+ * boundaries:
3046
3062
  * - 500ms elapse since last tap with instrument in `'pattern'` mode
3047
3063
  * (outcome `'pattern'`), or
3048
3064
  * - 5s elapse in `'tapping'` mode without a recognized pattern
3049
3065
  * (outcome `'cleared'`; instrument transitions to `'auto'`).
3050
3066
  *
3051
- * Explicit `clear()` calls do NOT fire this event (caller-initiated;
3052
- * caller already knows). Imported state does NOT fire either.
3067
+ * Does NOT fire on:
3068
+ * - Explicit `clear()` calls (caller-initiated; not a natural boundary).
3069
+ * - `importSessionState` (state replacement; not a session boundary).
3070
+ *
3071
+ * Field-change events (`onModeChange`, `onMuteChange`) fire on imports
3072
+ * when fields differ; this event does not because session-end is a
3073
+ * different category — about session lifecycle, not field state.
3053
3074
  *
3054
3075
  * @returns Unsubscribe function. Call to remove the listener.
3055
3076
  */
3056
3077
  onSessionEnd: (listener: (ev: OnsetSessionEndEvent) => void) => Unsubscribe;
3078
+ /**
3079
+ * Listen for instrument mute-state transitions (`true ↔ false`). Fires
3080
+ * whenever the underlying mute field actually changes, regardless of
3081
+ * which code path triggered it:
3082
+ * - `setMuted(instrument, muted)` when `prev !== next`.
3083
+ * - `tap(instrument)` auto-unmute on first tap of a muted instrument.
3084
+ * - `clear(instrument)` when the instrument was muted at call time.
3085
+ * - `importSessionState` landing a different muted value.
3086
+ *
3087
+ * Idempotent calls (e.g. `setMuted(true)` on an already-muted instrument)
3088
+ * do not fire.
3089
+ *
3090
+ * @returns Unsubscribe function. Call to remove the listener.
3091
+ */
3092
+ onMuteChange: (listener: (ev: OnsetMuteChangeEvent) => void) => Unsubscribe;
3057
3093
  /**
3058
3094
  * Snapshot per-instrument onset state for cross-instance transfer.
3059
3095
  * Cross-device-safe (no audio analysis state included). Pair with
@@ -3065,7 +3101,12 @@ export declare class VijiCore {
3065
3101
  * Replace per-instrument onset state from a serialized payload.
3066
3102
  * `clockOffset` is added to all sender-clocked fields during import
3067
3103
  * (use `0` for same-process transfer; NTP-derived offset for cross-device).
3068
- * Mutation is synchronous; no events are emitted.
3104
+ * Mutation is synchronous.
3105
+ *
3106
+ * Field-level events fire when imported values differ from current:
3107
+ * `onModeChange` if the imported mode is different, `onMuteChange` if
3108
+ * the imported muted state is different. Session-boundary events
3109
+ * (`onSessionEnd`) do NOT fire — imports aren't session boundaries.
3069
3110
  *
3070
3111
  * Patterns are rebased forward by whole pattern cycles to eliminate
3071
3112
  * the catch-up burst that would otherwise occur on stale payloads
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, V, a, b } from "./index-Cqh1k_49.js";
1
+ import { A, V, a, b } from "./index-Bhq4eJe_.js";
2
2
  export {
3
3
  A as AudioSystem,
4
4
  V as VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viji-dev/core",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Universal execution engine for Viji Creative scenes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",