@viji-dev/core 0.7.0 → 0.7.4

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.
@@ -1,4 +1,4 @@
1
- import { g as kn } from "./index-BCIUaaLW.js";
1
+ import { g as kn } from "./index-DmQ5U_50.js";
2
2
  function jn(Oe, ot) {
3
3
  for (var ve = 0; ve < ot.length; ve++) {
4
4
  const Z = ot[ve];
@@ -3374,4 +3374,4 @@ const xn = /* @__PURE__ */ kn(yi), Ln = /* @__PURE__ */ jn({
3374
3374
  export {
3375
3375
  Ln as e
3376
3376
  };
3377
- //# sourceMappingURL=essentia-wasm.web-iwIx5LHu.js.map
3377
+ //# sourceMappingURL=essentia-wasm.web-BgpNs-yB.js.map
@@ -536,7 +536,7 @@ class DB {
536
536
  }
537
537
  }
538
538
  }
539
- const oB = "" + new URL("assets/viji.worker-sMAb5DcQ.js", import.meta.url).href, hB = new URL("assets/wasm/vision_wasm_internal.js", import.meta.url).href, RB = new URL("assets/wasm/vision_wasm_internal.wasm", import.meta.url).href, wB = new URL("assets/wasm/vision_wasm_nosimd_internal.js", import.meta.url).href, sB = new URL("assets/wasm/vision_wasm_nosimd_internal.wasm", import.meta.url).href;
539
+ const oB = "" + new URL("assets/viji.worker-Dq2EQ0Wd.js", import.meta.url).href, hB = new URL("assets/wasm/vision_wasm_internal.js", import.meta.url).href, RB = new URL("assets/wasm/vision_wasm_internal.wasm", import.meta.url).href, wB = new URL("assets/wasm/vision_wasm_nosimd_internal.js", import.meta.url).href, sB = new URL("assets/wasm/vision_wasm_nosimd_internal.wasm", import.meta.url).href;
540
540
  class FB {
541
541
  constructor(A, B, I) {
542
542
  this.iframeManager = A, this.sceneCode = B, this.init = I;
@@ -1520,7 +1520,7 @@ class YB {
1520
1520
  if (!this.isInitialized)
1521
1521
  return this.initPromise ? this.initPromise : (this.initPromise = (async () => {
1522
1522
  try {
1523
- const A = await import("./essentia.js-core.es-CC_3Ap1i.js"), B = await import("./essentia-wasm.web-iwIx5LHu.js").then((g) => g.e), I = A.Essentia || A.default?.Essentia || A.default;
1523
+ const A = await import("./essentia.js-core.es-CC_3Ap1i.js"), B = await import("./essentia-wasm.web-BgpNs-yB.js").then((g) => g.e), I = A.Essentia || A.default?.Essentia || A.default;
1524
1524
  let Q = B.default || B.EssentiaWASM || B.default?.EssentiaWASM;
1525
1525
  if (!Q)
1526
1526
  throw new Error("WASM module not found - check essentia-wasm.web.js export");
@@ -8398,7 +8398,7 @@ function DI(R) {
8398
8398
  expectedVersion: 1
8399
8399
  } : typeof A.senderTime != "number" ? { code: "invalid-field", details: "senderTime must be a number", field: "senderTime" } : null;
8400
8400
  }
8401
- const oI = "0.7.0";
8401
+ const oI = "0.7.4";
8402
8402
  export {
8403
8403
  yA as A,
8404
8404
  oI as V,
@@ -8406,4 +8406,4 @@ export {
8406
8406
  S as b,
8407
8407
  vB as g
8408
8408
  };
8409
- //# sourceMappingURL=index-BCIUaaLW.js.map
8409
+ //# sourceMappingURL=index-DmQ5U_50.js.map
package/dist/index.d.ts CHANGED
@@ -1111,15 +1111,25 @@ declare interface FaceBlendshapes {
1111
1111
  }
1112
1112
 
1113
1113
  /**
1114
- * One detected face produced by the video CV pipeline. Always carries `id`,
1115
- * `bounds`, `center`, and `confidence`; the rest is populated only when the
1116
- * matching CV feature is enabled (face mesh for `landmarks` and `headPose`,
1117
- * emotion detection for `expressions` and `blendshapes`).
1114
+ * One detected face produced by the video CV pipeline. Each field is
1115
+ * populated only by its source model; fields whose source model is not
1116
+ * enabled read as `null` so the absence is loud rather than silent. Enable
1117
+ * the relevant `enable*` verb on `viji.video.cv` to populate each group:
1118
+ *
1119
+ * - `bounds`, `center`, `confidence`: populated by `enableFaceDetection(true)`.
1120
+ * - `landmarks`: populated by `enableFaceMesh(true)` (empty array otherwise).
1121
+ * - `headPose`: populated by `enableFaceMesh(true)`.
1122
+ * - `blendshapes`, `expressions`: populated by `enableEmotionDetection(true)`.
1123
+ *
1124
+ * If a field is `null`, call the corresponding `enable*` verb on
1125
+ * `viji.video.cv` to populate it. Each active CV feature consumes its own
1126
+ * WebGL context for MediaPipe; enabling many at once on lower-end hardware
1127
+ * can hit context limits.
1118
1128
  */
1119
1129
  export declare interface FaceData {
1120
1130
  /** Index-based face identifier (`0`, `1`, …). Stable within a single frame, may change between frames. */
1121
1131
  id: number;
1122
- /** Bounding box, all components normalized to 0..1 of the source frame. */
1132
+ /** Bounding box, all components normalized to 0..1 of the source frame. `null` unless face detection is enabled. */
1123
1133
  bounds: {
1124
1134
  /** Left edge of the face bounding box, normalized 0..1. */
1125
1135
  x: number;
@@ -1129,16 +1139,16 @@ export declare interface FaceData {
1129
1139
  width: number;
1130
1140
  /** Height of the face bounding box, normalized 0..1. */
1131
1141
  height: number;
1132
- };
1133
- /** Center of the bounding box, normalized 0..1. */
1142
+ } | null;
1143
+ /** Center of the bounding box, normalized 0..1. `null` unless face detection is enabled. */
1134
1144
  center: {
1135
1145
  /** Horizontal center of the face, normalized 0..1. */
1136
1146
  x: number;
1137
1147
  /** Vertical center of the face, normalized 0..1. */
1138
1148
  y: number;
1139
- };
1140
- /** Detection confidence in 0..1. */
1141
- confidence: number;
1149
+ } | null;
1150
+ /** Detection confidence in 0..1. `null` unless face detection is enabled. */
1151
+ confidence: number | null;
1142
1152
  /** 468 normalized face mesh landmarks when face mesh is enabled; empty array otherwise. */
1143
1153
  landmarks: {
1144
1154
  /** Horizontal landmark coordinate, normalized 0..1. */
@@ -1148,7 +1158,16 @@ export declare interface FaceData {
1148
1158
  /** Optional depth (relative). */
1149
1159
  z?: number;
1150
1160
  }[];
1151
- /** Seven expression confidence scores in 0..1. All zero unless emotion detection is enabled. */
1161
+ /** Estimated head rotation in degrees. `null` unless face mesh is enabled. */
1162
+ headPose: {
1163
+ /** Up/down rotation in degrees (-90..90). Positive = head looking up, negative = looking down. */
1164
+ pitch: number;
1165
+ /** Left/right rotation in degrees (-90..90). Positive = head turned to the subject's right, negative = to the left. */
1166
+ yaw: number;
1167
+ /** Tilt rotation in degrees (-180..180). Positive = head tilted to the subject's right (right ear toward right shoulder). */
1168
+ roll: number;
1169
+ } | null;
1170
+ /** Seven expression confidence scores in 0..1. `null` unless emotion detection is enabled. */
1152
1171
  expressions: {
1153
1172
  /** Confidence (0..1) of a neutral expression. */
1154
1173
  neutral: number;
@@ -1164,18 +1183,9 @@ export declare interface FaceData {
1164
1183
  disgusted: number;
1165
1184
  /** Confidence (0..1) of a fearful expression. */
1166
1185
  fearful: number;
1167
- };
1168
- /** Estimated head rotation. All zero unless face mesh is enabled. */
1169
- headPose: {
1170
- /** Up/down rotation in degrees (-90..90). Positive = head looking up, negative = looking down. */
1171
- pitch: number;
1172
- /** Left/right rotation in degrees (-90..90). Positive = head turned to the subject's right, negative = to the left. */
1173
- yaw: number;
1174
- /** Tilt rotation in degrees (-180..180). Positive = head tilted to the subject's right (right ear toward right shoulder). */
1175
- roll: number;
1176
- };
1177
- /** 52 ARKit-compatible facial muscle coefficients. All zero unless emotion detection is enabled. */
1178
- blendshapes: FaceBlendshapes;
1186
+ } | null;
1187
+ /** 52 ARKit-compatible facial muscle coefficients. `null` unless emotion detection is enabled. */
1188
+ blendshapes: FaceBlendshapes | null;
1179
1189
  }
1180
1190
 
1181
1191
  declare interface FrameRateInfo {
@@ -2368,7 +2378,7 @@ declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
2368
2378
  /** Returned by `on*` listener registration calls; invoke to unsubscribe. */
2369
2379
  export declare type Unsubscribe = () => void;
2370
2380
 
2371
- export declare const VERSION = "0.7.0";
2381
+ export declare const VERSION = "0.7.4";
2372
2382
 
2373
2383
  /**
2374
2384
  * Real-time video API: drawable frame, dimensions, and the source-side
@@ -2477,35 +2487,73 @@ export declare interface VideoCVAPI {
2477
2487
  /** Body segmentation mask, or `null` when segmentation is off. */
2478
2488
  segmentation: SegmentationData | null;
2479
2489
  /**
2480
- * Toggle face detection (bounding box, center, confidence, id).
2490
+ * Toggle face detection. Populates `face.bounds`, `face.center`,
2491
+ * `face.confidence` on each detected face. Independent of face mesh and
2492
+ * emotion detection.
2493
+ *
2494
+ * Safe to call from module scope as well as from inside `render()`. The
2495
+ * verb is idempotent and reference-counted; per-frame calls inside
2496
+ * `render()` (the canonical toggle-gated pattern) are cheap.
2497
+ *
2481
2498
  * @returns Resolves once the underlying pipeline has finished switching.
2482
2499
  */
2483
2500
  enableFaceDetection(enabled: boolean): Promise<void>;
2484
2501
  /**
2485
- * Toggle 468-point face mesh + head pose (`pitch`, `yaw`, `roll`). Implies
2486
- * face detection.
2502
+ * Toggle 468-point face mesh and computed head pose (`pitch`, `yaw`,
2503
+ * `roll`). Populates `face.landmarks` and `face.headPose` on the face
2504
+ * entry. Does NOT populate `face.bounds` / `face.center` / `face.confidence`
2505
+ * — those are produced only by face detection. Enable both if you need
2506
+ * both, or compute bounds from `face.landmarks` min/max yourself.
2507
+ *
2508
+ * Safe to call from module scope as well as from inside `render()`. The
2509
+ * verb is idempotent and reference-counted.
2510
+ *
2487
2511
  * @returns Resolves once the pipeline has finished switching.
2488
2512
  */
2489
2513
  enableFaceMesh(enabled: boolean): Promise<void>;
2490
2514
  /**
2491
2515
  * Toggle 7 expressions + 52 ARKit blendshape coefficients on each face.
2492
- * Implies face mesh.
2516
+ * Populates `face.blendshapes` and `face.expressions`. Internally requires
2517
+ * the face landmarker model (loads it alongside `enableFaceMesh` if both
2518
+ * are enabled; loads it on its own otherwise so `face.landmarks` and
2519
+ * `face.headPose` are also populated). Does NOT populate
2520
+ * `face.bounds` / `face.center` / `face.confidence` — enable face
2521
+ * detection for those.
2522
+ *
2523
+ * Safe to call from module scope as well as from inside `render()`. The
2524
+ * verb is idempotent and reference-counted.
2525
+ *
2493
2526
  * @returns Resolves once the pipeline has finished switching.
2494
2527
  */
2495
2528
  enableEmotionDetection(enabled: boolean): Promise<void>;
2496
2529
  /**
2497
- * Toggle 21-point hand landmarks + ML-classified gesture confidences for up
2498
- * to two hands.
2530
+ * Toggle 21-point hand landmarks and ML-classified gesture confidences
2531
+ * for up to two hands. Populates `viji.video.cv.hands[]` with `landmarks`,
2532
+ * `palm`, `bounds` (computed from landmarks), and `gestures`.
2533
+ *
2534
+ * Safe to call from module scope as well as from inside `render()`. The
2535
+ * verb is idempotent and reference-counted.
2536
+ *
2499
2537
  * @returns Resolves once the pipeline has finished switching.
2500
2538
  */
2501
2539
  enableHandTracking(enabled: boolean): Promise<void>;
2502
2540
  /**
2503
2541
  * Toggle 33-point BlazePose body landmarks (face / torso / arms / legs).
2542
+ * Populates `viji.video.cv.pose`.
2543
+ *
2544
+ * Safe to call from module scope as well as from inside `render()`. The
2545
+ * verb is idempotent and reference-counted.
2546
+ *
2504
2547
  * @returns Resolves once the pipeline has finished switching.
2505
2548
  */
2506
2549
  enablePoseDetection(enabled: boolean): Promise<void>;
2507
2550
  /**
2508
- * Toggle per-pixel person/background segmentation mask.
2551
+ * Toggle per-pixel person/background segmentation mask. Populates
2552
+ * `viji.video.cv.segmentation`.
2553
+ *
2554
+ * Safe to call from module scope as well as from inside `render()`. The
2555
+ * verb is idempotent and reference-counted.
2556
+ *
2509
2557
  * @returns Resolves once the pipeline has finished switching.
2510
2558
  */
2511
2559
  enableBodySegmentation(enabled: boolean): Promise<void>;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as a, V as i, a as s, b as e } from "./index-BCIUaaLW.js";
1
+ import { A as a, V as i, a as s, b as e } from "./index-DmQ5U_50.js";
2
2
  export {
3
3
  a as AudioSystem,
4
4
  i as VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viji-dev/core",
3
- "version": "0.7.0",
3
+ "version": "0.7.4",
4
4
  "description": "Universal execution engine for Viji Creative scenes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",