@viji-dev/core 0.5.2 → 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
@@ -2244,7 +2244,7 @@ declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
2244
2244
  /** Returned by `on*` listener registration calls; invoke to unsubscribe. */
2245
2245
  export declare type Unsubscribe = () => void;
2246
2246
 
2247
- export declare const VERSION = "0.5.2";
2247
+ export declare const VERSION = "0.5.3";
2248
2248
 
2249
2249
  /**
2250
2250
  * Real-time video API: drawable frame, dimensions, and the source-side
@@ -2884,8 +2884,12 @@ export declare class VijiCore {
2884
2884
  /**
2885
2885
  * Replace the audio analysis + onset state from a serialized payload.
2886
2886
  * `clockOffset` is added to all sender-clocked fields (`0` for same-process,
2887
- * NTP-derived for cross-device). Mutation is synchronous; no `onModeChange`
2888
- * 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.
2889
2893
  *
2890
2894
  * Validates `version`; on mismatch, fires `onStateImportError` and leaves
2891
2895
  * existing state intact.
@@ -3041,36 +3045,47 @@ export declare class VijiCore {
3041
3045
  isMuted: (instrument: "kick" | "snare" | "hat") => boolean;
3042
3046
  /**
3043
3047
  * Listen for instrument mode transitions (`'auto' | 'tapping' | 'pattern'`).
3044
- * Fires on every transition including the first tap (`'auto' → 'tapping'`)
3045
- * and pattern recognition (`'tapping' → 'pattern'`). Imported state does
3046
- * 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.
3047
3055
  *
3048
3056
  * @returns Unsubscribe function. Call to remove the listener.
3049
3057
  */
3050
3058
  onModeChange: (listener: (ev: OnsetModeChangeEvent) => void) => Unsubscribe;
3051
3059
  /**
3052
- * Listen for natural session-end events. Fires when:
3060
+ * Listen for natural session-end events. Fires only on natural session
3061
+ * boundaries:
3053
3062
  * - 500ms elapse since last tap with instrument in `'pattern'` mode
3054
3063
  * (outcome `'pattern'`), or
3055
3064
  * - 5s elapse in `'tapping'` mode without a recognized pattern
3056
3065
  * (outcome `'cleared'`; instrument transitions to `'auto'`).
3057
3066
  *
3058
- * Explicit `clear()` calls do NOT fire this event (caller-initiated;
3059
- * 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.
3060
3074
  *
3061
3075
  * @returns Unsubscribe function. Call to remove the listener.
3062
3076
  */
3063
3077
  onSessionEnd: (listener: (ev: OnsetSessionEndEvent) => void) => Unsubscribe;
3064
3078
  /**
3065
3079
  * Listen for instrument mute-state transitions (`true ↔ false`). Fires
3066
- * whenever the underlying mute state actually changes, regardless of
3067
- * which method triggered it:
3068
- * - `setMuted(instrument, muted)` when `prev !== next`
3069
- * - `tap(instrument)` auto-unmute on first tap of a muted instrument
3070
- * - `clear(instrument)` when the instrument was muted
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.
3071
3086
  *
3072
3087
  * Idempotent calls (e.g. `setMuted(true)` on an already-muted instrument)
3073
- * do not fire. Imported state does NOT fire either.
3088
+ * do not fire.
3074
3089
  *
3075
3090
  * @returns Unsubscribe function. Call to remove the listener.
3076
3091
  */
@@ -3086,7 +3101,12 @@ export declare class VijiCore {
3086
3101
  * Replace per-instrument onset state from a serialized payload.
3087
3102
  * `clockOffset` is added to all sender-clocked fields during import
3088
3103
  * (use `0` for same-process transfer; NTP-derived offset for cross-device).
3089
- * 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.
3090
3110
  *
3091
3111
  * Patterns are rebased forward by whole pattern cycles to eliminate
3092
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-B8LJ9m47.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.2",
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",