@viji-dev/core 0.3.27 → 0.3.28
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/assets/{viji.worker-jTmB7qoQ.js → viji.worker-CdHkRwxI.js} +431 -4
- package/dist/assets/viji.worker-CdHkRwxI.js.map +1 -0
- package/dist/docs-api.js +2 -2
- package/dist/{essentia-wasm.web-DtvIO6D8.js → essentia-wasm.web-CJ3YX7ue.js} +2 -2
- package/dist/{essentia-wasm.web-DtvIO6D8.js.map → essentia-wasm.web-CJ3YX7ue.js.map} +1 -1
- package/dist/{index-9YDi9UBP.js → index-i7P2rHW8.js} +43 -9
- package/dist/index-i7P2rHW8.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/assets/viji.worker-jTmB7qoQ.js.map +0 -1
- package/dist/index-9YDi9UBP.js.map +0 -1
|
@@ -199,6 +199,18 @@ class IFrameManager {
|
|
|
199
199
|
getScale() {
|
|
200
200
|
return this.scale;
|
|
201
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Gets the actual ratio of canvas pixels to display (CSS) pixels.
|
|
204
|
+
* Works correctly for both scale-based and explicit resolution modes.
|
|
205
|
+
*/
|
|
206
|
+
getDisplayScale() {
|
|
207
|
+
if (this.isHeadless) return 1;
|
|
208
|
+
if (this.explicitResolution && this.hostContainer) {
|
|
209
|
+
const rect = this.hostContainer.getBoundingClientRect();
|
|
210
|
+
return rect.width > 0 ? this.explicitResolution.width / rect.width : 1;
|
|
211
|
+
}
|
|
212
|
+
return Math.max(0.1, Math.min(1, this.scale));
|
|
213
|
+
}
|
|
202
214
|
// ========================================
|
|
203
215
|
// Device Sensor Support
|
|
204
216
|
// ========================================
|
|
@@ -578,7 +590,7 @@ class IFrameManager {
|
|
|
578
590
|
}
|
|
579
591
|
function WorkerWrapper(options) {
|
|
580
592
|
return new Worker(
|
|
581
|
-
"" + new URL("assets/viji.worker-
|
|
593
|
+
"" + new URL("assets/viji.worker-CdHkRwxI.js", import.meta.url).href,
|
|
582
594
|
{
|
|
583
595
|
type: "module",
|
|
584
596
|
name: options?.name
|
|
@@ -586,9 +598,10 @@ function WorkerWrapper(options) {
|
|
|
586
598
|
);
|
|
587
599
|
}
|
|
588
600
|
class WorkerManager {
|
|
589
|
-
constructor(sceneCode, offscreenCanvas) {
|
|
601
|
+
constructor(sceneCode, offscreenCanvas, isHeadless = false) {
|
|
590
602
|
this.sceneCode = sceneCode;
|
|
591
603
|
this.offscreenCanvas = offscreenCanvas;
|
|
604
|
+
this.isHeadless = isHeadless;
|
|
592
605
|
}
|
|
593
606
|
worker = null;
|
|
594
607
|
messageId = 0;
|
|
@@ -755,7 +768,8 @@ class WorkerManager {
|
|
|
755
768
|
id,
|
|
756
769
|
timestamp: Date.now(),
|
|
757
770
|
data: {
|
|
758
|
-
canvas: this.offscreenCanvas
|
|
771
|
+
canvas: this.offscreenCanvas,
|
|
772
|
+
isHeadless: this.isHeadless
|
|
759
773
|
}
|
|
760
774
|
};
|
|
761
775
|
return new Promise((resolve, reject) => {
|
|
@@ -1732,7 +1746,7 @@ class EssentiaOnsetDetection {
|
|
|
1732
1746
|
this.initPromise = (async () => {
|
|
1733
1747
|
try {
|
|
1734
1748
|
const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
|
|
1735
|
-
const wasmModule = await import("./essentia-wasm.web-
|
|
1749
|
+
const wasmModule = await import("./essentia-wasm.web-CJ3YX7ue.js").then((n) => n.e);
|
|
1736
1750
|
const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
|
|
1737
1751
|
let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
|
|
1738
1752
|
if (!WASMModule) {
|
|
@@ -14788,6 +14802,19 @@ class VijiCore {
|
|
|
14788
14802
|
getDebugMode() {
|
|
14789
14803
|
return this.debugMode;
|
|
14790
14804
|
}
|
|
14805
|
+
/**
|
|
14806
|
+
* Update the session capability token at runtime.
|
|
14807
|
+
* Forwards the signed JWT to the worker for verification.
|
|
14808
|
+
*/
|
|
14809
|
+
updateSessionConfig(token) {
|
|
14810
|
+
this.workerManager?.postMessage("sc-update", { t: token });
|
|
14811
|
+
}
|
|
14812
|
+
/**
|
|
14813
|
+
* Set a cosmetic render hint for the branding overlay (logo variant / position).
|
|
14814
|
+
*/
|
|
14815
|
+
setRenderHint(hint) {
|
|
14816
|
+
this.workerManager?.postMessage("rh-update", { h: hint });
|
|
14817
|
+
}
|
|
14791
14818
|
/**
|
|
14792
14819
|
* Show the core's iframe (make it visible in the host container).
|
|
14793
14820
|
* No-op for headless cores.
|
|
@@ -14833,10 +14860,14 @@ class VijiCore {
|
|
|
14833
14860
|
}
|
|
14834
14861
|
this.workerManager = new WorkerManager(
|
|
14835
14862
|
this.config.sceneCode,
|
|
14836
|
-
offscreenCanvas
|
|
14863
|
+
offscreenCanvas,
|
|
14864
|
+
this.isHeadless
|
|
14837
14865
|
);
|
|
14838
14866
|
this.setupCommunication();
|
|
14839
14867
|
await this.workerManager.createWorker();
|
|
14868
|
+
if (this.config._sc) {
|
|
14869
|
+
this.workerManager.postMessage("sc-update", { t: this.config._sc });
|
|
14870
|
+
}
|
|
14840
14871
|
this.audioSystem = new AudioSystem((message) => {
|
|
14841
14872
|
if (this.workerManager) {
|
|
14842
14873
|
this.workerManager.postMessage(message.type, message.data);
|
|
@@ -14894,7 +14925,8 @@ class VijiCore {
|
|
|
14894
14925
|
const effectiveResolution = this.iframeManager.getEffectiveResolution();
|
|
14895
14926
|
this.workerManager.postMessage("resolution-update", {
|
|
14896
14927
|
effectiveWidth: effectiveResolution.width,
|
|
14897
|
-
effectiveHeight: effectiveResolution.height
|
|
14928
|
+
effectiveHeight: effectiveResolution.height,
|
|
14929
|
+
displayScale: this.iframeManager.getDisplayScale()
|
|
14898
14930
|
});
|
|
14899
14931
|
await this.detectScreenRefreshRate();
|
|
14900
14932
|
this.workerManager.postMessage("refresh-rate-update", {
|
|
@@ -15633,7 +15665,8 @@ class VijiCore {
|
|
|
15633
15665
|
const effectiveResolution = this.iframeManager.getEffectiveResolution();
|
|
15634
15666
|
this.workerManager.postMessage("resolution-update", {
|
|
15635
15667
|
effectiveWidth: effectiveResolution.width,
|
|
15636
|
-
effectiveHeight: effectiveResolution.height
|
|
15668
|
+
effectiveHeight: effectiveResolution.height,
|
|
15669
|
+
displayScale: this.iframeManager.getDisplayScale()
|
|
15637
15670
|
});
|
|
15638
15671
|
this.stats.resolution = effectiveResolution;
|
|
15639
15672
|
this.stats.scale = this.iframeManager.getScale();
|
|
@@ -16111,7 +16144,8 @@ class VijiCore {
|
|
|
16111
16144
|
}
|
|
16112
16145
|
this.workerManager.postMessage("resolution-update", {
|
|
16113
16146
|
effectiveWidth: effectiveResolution.width,
|
|
16114
|
-
effectiveHeight: effectiveResolution.height
|
|
16147
|
+
effectiveHeight: effectiveResolution.height,
|
|
16148
|
+
displayScale: this.iframeManager.getDisplayScale()
|
|
16115
16149
|
});
|
|
16116
16150
|
this.stats.resolution = effectiveResolution;
|
|
16117
16151
|
this.debugLog(`Resolution: ${effectiveResolution.width}x${effectiveResolution.height}`);
|
|
@@ -16397,4 +16431,4 @@ export {
|
|
|
16397
16431
|
VijiCoreError as b,
|
|
16398
16432
|
getDefaultExportFromCjs as g
|
|
16399
16433
|
};
|
|
16400
|
-
//# sourceMappingURL=index-
|
|
16434
|
+
//# sourceMappingURL=index-i7P2rHW8.js.map
|