@viji-dev/core 0.8.1 → 0.8.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
@@ -1256,9 +1256,11 @@ export declare interface FramePerfSample {
1256
1256
  /** CPU time spent dispatching the render for this frame (ms). */
1257
1257
  cpuMs: number;
1258
1258
  /**
1259
- * GPU time for this frame in ms, or `null` when unavailable. Always `null`
1260
- * in steady state; populated only by `runFencedBenchmark()` (and `null`
1261
- * there for 2D-canvas scenes).
1259
+ * Fence-accurate downstream frame time in ms, or `null` when unavailable.
1260
+ * Always `null` in steady state. Populated only by `runFencedBenchmark()`:
1261
+ * WebGL scenes via `gl.finish()` (GPU drain), 2D-canvas scenes via
1262
+ * `getImageData()` (raster flush). `null` only when there is no drawable
1263
+ * context or readback fails.
1262
1264
  */
1263
1265
  gpuMs: number | null;
1264
1266
  /** Interval since the previous rendered frame (ms). Session-relative under benchmark. */
@@ -1269,6 +1271,16 @@ export declare interface FramePerfSample {
1269
1271
 
1270
1272
  declare interface FrameRateInfo {
1271
1273
  mode: FrameRateMode;
1274
+ /**
1275
+ * Best-effort display refresh rate in Hz, detected once at init by averaging
1276
+ * 60 `requestAnimationFrame` intervals.
1277
+ *
1278
+ * **Not reliable under load** — if the page is already GPU-stressed during
1279
+ * initialization, throttled rAFs inflate the interval and deflate the value
1280
+ * (e.g. 10 Hz on a 60 Hz monitor), and it is never re-measured. rAF cadence
1281
+ * cannot recover the true refresh post-load. **Do not derive performance
1282
+ * thresholds from this** — prefer an absolute FPS target.
1283
+ */
1272
1284
  screenRefreshRate: number;
1273
1285
  effectiveRefreshRate: number;
1274
1286
  }
@@ -2642,7 +2654,7 @@ declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
2642
2654
  /** Returned by `on*` listener registration calls; invoke to unsubscribe. */
2643
2655
  export declare type Unsubscribe = () => void;
2644
2656
 
2645
- export declare const VERSION = "0.8.0";
2657
+ export declare const VERSION = "0.8.2";
2646
2658
 
2647
2659
  /**
2648
2660
  * Real-time video API: drawable frame, dimensions, and the source-side
@@ -3801,14 +3813,18 @@ export declare class VijiCore {
3801
3813
  getStats(): PerformanceStats;
3802
3814
  /**
3803
3815
  * Runs an on-demand fenced benchmark: the worker renders `frameCount` frames,
3804
- * fencing each with `gl.finish()` to capture fence-accurate CPU + GPU time
3805
- * per frame, and resolves with the collected samples. The scene advances
3806
- * normally; steady-state perf reporting is suppressed for the run.
3816
+ * fencing each to capture fence-accurate CPU + GPU time per frame, and
3817
+ * resolves with the collected samples. The scene advances normally;
3818
+ * steady-state perf reporting is suppressed for the run.
3819
+ *
3820
+ * The per-frame fence is WebGL `gl.finish()` for shader/WebGL scenes and
3821
+ * `getImageData()` (raster flush) for 2D-canvas scenes, so `gpuMs` is
3822
+ * populated for both (`null` only with no drawable context).
3807
3823
  *
3808
3824
  * Use only on a scene NOT serving as a live compositor source/mixer —
3809
- * per-frame `gl.finish()` would stutter the mixer output (enforced below).
3825
+ * the per-frame fence would stutter the mixer output (enforced below).
3810
3826
  * In-session `frameIntervalMs` includes the fence stall (session-relative);
3811
- * use `cpuMs` + `gpuMs` for cost. `gpuMs` is `null` for 2D-canvas scenes.
3827
+ * use `cpuMs` + `gpuMs` for cost.
3812
3828
  * `frameCount: 1` is the generic single-frame measurement.
3813
3829
  *
3814
3830
  * @param frameCount - Number of frames to benchmark (>= 1)
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-xEjVcfB2.js";
1
+ import { A as a, V as i, a as s, b as e } from "./index-BzW31blh.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.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Universal execution engine for Viji Creative scenes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -48,11 +48,11 @@
48
48
  "README.md"
49
49
  ],
50
50
  "scripts": {
51
- "prebuild": "node scripts/prebuild-clean.mjs",
51
+ "prebuild": "node scripts/prebuild-clean.mjs && node scripts/sync-version.mjs",
52
52
  "build": "vite build && node scripts/copy-tasks-assets.mjs && node scripts/build-artist-types.mjs && node scripts/build-docs-api.mjs",
53
53
  "build:docs": "node scripts/build-docs-api.mjs",
54
54
  "lint:ai-prompts-drift": "node scripts/lint-ai-prompts-drift.mjs",
55
- "dev": "vite build --watch",
55
+ "dev": "node scripts/sync-version.mjs && vite build --watch",
56
56
  "integration": "vite --config integration-example/vite.config.ts",
57
57
  "test": "vitest",
58
58
  "test:coverage": "vitest --coverage",