@viji-dev/core 0.3.17 → 0.3.18

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.
@@ -7,9 +7,10 @@ class VijiCoreError extends Error {
7
7
  }
8
8
  }
9
9
  class IFrameManager {
10
- constructor(hostContainer, initialResolution) {
10
+ constructor(hostContainer, initialResolution, visible = true) {
11
11
  this.hostContainer = hostContainer;
12
12
  this.isHeadless = !hostContainer;
13
+ this.initiallyVisible = visible;
13
14
  if (typeof initialResolution === "object") {
14
15
  this.explicitResolution = initialResolution;
15
16
  } else if (typeof initialResolution === "number") {
@@ -49,6 +50,7 @@ class IFrameManager {
49
50
  activeTouchIds = /* @__PURE__ */ new Set();
50
51
  // Device sensor support
51
52
  deviceSensorCallback = null;
53
+ initiallyVisible;
52
54
  /**
53
55
  * Creates a secure IFrame with proper sandbox attributes
54
56
  */
@@ -71,7 +73,8 @@ class IFrameManager {
71
73
  document.body.appendChild(hiddenContainer);
72
74
  hiddenContainer.appendChild(iframe);
73
75
  } else {
74
- iframe.style.cssText = "width:100%;height:100%;border:none;display:block;";
76
+ const visibility = this.initiallyVisible ? "" : "visibility:hidden;";
77
+ iframe.style.cssText = `width:100%;height:100%;border:none;display:block;${visibility}`;
75
78
  this.hostContainer.appendChild(iframe);
76
79
  }
77
80
  const iframeContent = this.generateIFrameHTML();
@@ -286,6 +289,16 @@ class IFrameManager {
286
289
  get element() {
287
290
  return this.iframe;
288
291
  }
292
+ show() {
293
+ if (this.iframe && !this.isHeadless) {
294
+ this.iframe.style.visibility = "visible";
295
+ }
296
+ }
297
+ hide() {
298
+ if (this.iframe && !this.isHeadless) {
299
+ this.iframe.style.visibility = "hidden";
300
+ }
301
+ }
289
302
  /**
290
303
  * Generates the HTML content for the secure IFrame
291
304
  */
@@ -1900,7 +1913,7 @@ class EssentiaOnsetDetection {
1900
1913
  this.initPromise = (async () => {
1901
1914
  try {
1902
1915
  const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
1903
- const wasmModule = await import("./essentia-wasm.web-6nI8GVgc.js").then((n) => n.e);
1916
+ const wasmModule = await import("./essentia-wasm.web-yEo8eq6n.js").then((n) => n.e);
1904
1917
  const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
1905
1918
  let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
1906
1919
  if (!WASMModule) {
@@ -14636,7 +14649,6 @@ class VijiCore {
14636
14649
  * Enable auto-capture with optional format (internal, called by linkFrameSources)
14637
14650
  */
14638
14651
  enableAutoCapture(format) {
14639
- if (this.autoCaptureEnabled) return;
14640
14652
  this.autoCaptureEnabled = true;
14641
14653
  if (this.workerManager) {
14642
14654
  this.workerManager.postMessage("enable-auto-capture", {
@@ -14695,6 +14707,21 @@ class VijiCore {
14695
14707
  getDebugMode() {
14696
14708
  return this.debugMode;
14697
14709
  }
14710
+ /**
14711
+ * Show the core's iframe (make it visible in the host container).
14712
+ * No-op for headless cores.
14713
+ */
14714
+ show() {
14715
+ this.iframeManager?.show();
14716
+ }
14717
+ /**
14718
+ * Hide the core's iframe (keep rendering but invisible).
14719
+ * Useful for create-in-background, reveal-when-ready patterns.
14720
+ * No-op for headless cores.
14721
+ */
14722
+ hide() {
14723
+ this.iframeManager?.hide();
14724
+ }
14698
14725
  /**
14699
14726
  * Select audio analysis backend
14700
14727
  */
@@ -14725,7 +14752,8 @@ class VijiCore {
14725
14752
  }
14726
14753
  this.iframeManager = new IFrameManager(
14727
14754
  this.config.hostContainer || null,
14728
- this.config.resolution
14755
+ this.config.resolution,
14756
+ this.config.visible ?? true
14729
14757
  );
14730
14758
  await this.iframeManager.createSecureIFrame();
14731
14759
  const offscreenCanvas = await this.createCanvasWithRetry();
@@ -16292,4 +16320,4 @@ export {
16292
16320
  VijiCoreError as b,
16293
16321
  getDefaultExportFromCjs as g
16294
16322
  };
16295
- //# sourceMappingURL=index-DSNSJDmw.js.map
16323
+ //# sourceMappingURL=index-BSQyI1F-.js.map