@viji-dev/core 0.8.0 → 0.8.1
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/docs-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as kn } from "./index-
|
|
1
|
+
import { g as kn } from "./index-xEjVcfB2.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-
|
|
3377
|
+
//# sourceMappingURL=essentia-wasm.web-CFfKEyIc.js.map
|
|
@@ -3,7 +3,7 @@ class S extends Error {
|
|
|
3
3
|
super(A), this.code = B, this.context = I, this.name = "VijiCoreError";
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
const GB = '"use strict";(()=>{function L(e){switch(e.type){case"init":{let t=e,r=[];t.data?.canvas&&r.push(t.data.canvas);let n=t.data?.cvWasmFiles;return n&&r.push(n.simdLoaderJs,n.simdBinary,n.nosimdLoaderJs,n.nosimdBinary),t.data?.controlPort&&r.push(t.data.controlPort),r}case"video-canvas-setup":{let t=e;return t.data?.offscreenCanvas?[t.data.offscreenCanvas]:[]}case"video-frame-update":{let t=e;return t.data?.imageBitmap?[t.data.imageBitmap]:[]}case"video-frame-direct":{let t=e;return t.data?.imageBitmap?[t.data.imageBitmap]:[]}case"parameter-update":return e.data?.transferList??[];case"parameter-batch-update":return e.data?.transferList??[];case"audio-analysis-update":{let t=e,r=[];return t.data?.frequencyData?.buffer&&r.push(t.data.frequencyData.buffer),t.data?.waveformData?.buffer&&r.push(t.data.waveformData.buffer),r}case"capture-frame-result":case"auto-capture-result":{let t=e.data;return t?.bitmap?[t.bitmap]:[]}default:return[]}}var d=null,
|
|
6
|
+
const GB = '"use strict";(()=>{function L(e){switch(e.type){case"init":{let t=e,r=[];t.data?.canvas&&r.push(t.data.canvas);let n=t.data?.cvWasmFiles;return n&&r.push(n.simdLoaderJs,n.simdBinary,n.nosimdLoaderJs,n.nosimdBinary),t.data?.controlPort&&r.push(t.data.controlPort),r}case"video-canvas-setup":{let t=e;return t.data?.offscreenCanvas?[t.data.offscreenCanvas]:[]}case"video-frame-update":{let t=e;return t.data?.imageBitmap?[t.data.imageBitmap]:[]}case"video-frame-direct":{let t=e;return t.data?.imageBitmap?[t.data.imageBitmap]:[]}case"parameter-update":return e.data?.transferList??[];case"parameter-batch-update":return e.data?.transferList??[];case"audio-analysis-update":{let t=e,r=[];return t.data?.frequencyData?.buffer&&r.push(t.data.frequencyData.buffer),t.data?.waveformData?.buffer&&r.push(t.data.waveformData.buffer),r}case"capture-frame-result":case"auto-capture-result":{let t=e.data;return t?.bitmap?[t.bitmap]:[]}default:return[]}}var d=null,g=null,s=null,v=null,a=null,I=!1,H=!1;function A(){return document.readyState==="loading"?new Promise(e=>{document.addEventListener("DOMContentLoaded",()=>e(),{once:!0})}):Promise.resolve()}async function j(){await A();let e={type:"iframe-ready",protocolVersion:1,environment:{crossOriginIsolated:window.crossOriginIsolated,isSecureContext:window.isSecureContext,origin:self.origin}};window.parent.postMessage(e,"*")}function S(){window.addEventListener("message",e=>{if(e.source===window.parent){if(d===null)d=e.origin,g=window.parent;else if(e.origin!==d)return;X(e.data).catch(t=>{m(t)})}})}function y(e,t=[]){if(d===null||g===null)return;let r=d==="null"?"*":d;g.postMessage(e,r,t)}function m(e){let t=e,r=t?.stack?{type:"iframe-error",message:t.message??String(e),stack:t.stack}:{type:"iframe-error",message:t?.message??String(e)};F(r)}function Y(e){let t={type:"iframe-error",message:e.message?`Worker error: ${e.message}`:"Worker error: (no detail \\u2014 likely cross-origin opacity)",...e.error&&e.error.stack?{stack:e.error.stack}:{},...e.filename?{filename:e.filename}:{},...e.lineno?{lineno:e.lineno}:{},...e.colno?{colno:e.colno}:{}};F(t)}function F(e){if(d&&g){let t=d==="null"?"*":d;g.postMessage(e,t)}else window.parent.postMessage(e,"*")}async function X(e){switch(e.type){case"viji-bootstrap":await K(e);return;case"viji-host-message":U(e.payload);return;case"viji-resize":_(e.width,e.height);return;case"viji-enable-sensors":W(e.enabled);return;case"viji-enable-interaction":T(e.enabled);return;case"viji-terminate":J();return}}async function K(e){if(s)return;a=document.createElement("canvas"),a.id="viji-canvas",a.width=e.init.canvasWidth,a.height=e.init.canvasHeight,a.style.width="100%",a.style.height="100%",a.style.display="block",a.tabIndex=0,a.style.outline="none",document.body.appendChild(a);let t=a.transferControlToOffscreen();v=URL.createObjectURL(new Blob([e.workerCode],{type:"application/javascript"})),s=new Worker(v,{type:"classic"}),s.onerror=i=>{Y(i)},s.onmessage=i=>{z(i.data)};let r=`init_${Date.now()}`,n={type:"init",id:r,timestamp:Date.now(),data:{canvas:t,isHeadless:e.init.isHeadless,sc:e.init.sc,rh:e.init.rh,cvWasmFiles:e.wasmFiles,controlPort:e.controlPort,reporterConfig:e.init.reporterConfig}},f=V(i=>i&&i.type==="init-response"&&i.id===r);s.postMessage(n,[t,e.wasmFiles.simdLoaderJs,e.wasmFiles.simdBinary,e.wasmFiles.nosimdLoaderJs,e.wasmFiles.nosimdBinary,e.controlPort]),await f,e.init.allowInteraction&&!e.init.isHeadless&&T(!0),e.init.allowSensors&&!e.init.isHeadless&&W(!0),a&&a.addEventListener("contextmenu",i=>i.preventDefault()),y({type:"viji-ready"})}function V(e){return new Promise((t,r)=>{if(!s){r(new Error("worker not spawned"));return}let n=s,f=i=>{e(i.data)&&(n.removeEventListener("message",f),t(i.data))};n.addEventListener("message",f)})}function U(e){if(!(!s||!e))try{let t=L(e);s.postMessage(e,t)}catch(t){m(t)}}function z(e){if(e)try{let t=L(e);y({type:"worker-message",payload:e},t)}catch(t){m(t)}}function _(e,t){s&&s.postMessage({type:"resolution-update",id:`resize_${Date.now()}`,timestamp:Date.now(),data:{effectiveWidth:e,effectiveHeight:t,displayScale:1}})}var w=!1;function T(e){e!==I&&a&&(e?(a.addEventListener("mousedown",u,{passive:!1}),a.addEventListener("mousemove",u,{passive:!1}),a.addEventListener("mouseup",u,{passive:!1}),a.addEventListener("mouseenter",x,{passive:!1}),a.addEventListener("mouseleave",B,{passive:!1}),a.addEventListener("wheel",C,{passive:!1}),a.addEventListener("touchstart",l,{passive:!1}),a.addEventListener("touchmove",l,{passive:!1}),a.addEventListener("touchend",l,{passive:!1}),a.addEventListener("touchcancel",l,{passive:!1}),document.addEventListener("keydown",M,{passive:!1}),document.addEventListener("keyup",M,{passive:!1}),a.addEventListener("mousedown",h),a.addEventListener("touchstart",h),I=!0):(a.removeEventListener("mousedown",u),a.removeEventListener("mousemove",u),a.removeEventListener("mouseup",u),a.removeEventListener("mouseenter",x),a.removeEventListener("mouseleave",B),a.removeEventListener("wheel",C),a.removeEventListener("touchstart",l),a.removeEventListener("touchmove",l),a.removeEventListener("touchend",l),a.removeEventListener("touchcancel",l),document.removeEventListener("keydown",M),document.removeEventListener("keyup",M),a.removeEventListener("mousedown",h),a.removeEventListener("touchstart",h),I=!1))}function h(){a&&a.focus()}function b(e,t){s&&s.postMessage({type:e,id:`${e}_${Date.now()}`,timestamp:Date.now(),data:t}),y({type:"interaction-event",kind:e,data:t})}function u(e){if(!a)return;e.preventDefault();let t=a.getBoundingClientRect(),r=(e.clientX-t.left)*(a.width/t.width),n=(e.clientY-t.top)*(a.height/t.height);b("mouse-update",{x:r,y:n,buttons:e.buttons,deltaX:e.movementX||0,deltaY:e.movementY||0,wheelDeltaX:0,wheelDeltaY:0,isInCanvas:w,timestamp:performance.now()})}function x(e){w=!0,u(e)}function B(e){w=!1,u(e)}function C(e){if(!a)return;e.preventDefault();let t=a.getBoundingClientRect(),r=(e.clientX-t.left)*(a.width/t.width),n=(e.clientY-t.top)*(a.height/t.height);b("mouse-update",{x:r,y:n,buttons:e.buttons,deltaX:0,deltaY:0,wheelDeltaX:e.deltaX,wheelDeltaY:e.deltaY,isInCanvas:w,timestamp:performance.now()})}var G=new Set(["Tab","F1","F2","F3","F4","F5","F11","F12"]);function M(e){G.has(e.key)||e.preventDefault(),b("keyboard-update",{type:e.type,key:e.key,code:e.code,keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,timestamp:performance.now()})}function l(e){if(!a)return;e.preventDefault();let t=a.getBoundingClientRect(),r=a.width/t.width,n=a.height/t.height,f=a.width,i=a.height,D=o=>{let c=(o.clientX-t.left)*r,p=(o.clientY-t.top)*n;return{identifier:o.identifier,clientX:c,clientY:p,radiusX:o.radiusX??0,radiusY:o.radiusY??0,rotationAngle:o.rotationAngle??0,force:o.force??0,isInCanvas:c>=0&&c<=f&&p>=0&&p<=i}},E=new Map;for(let o=0;o<e.changedTouches.length;o++){let c=e.changedTouches[o];E.set(c.identifier,D(c))}let k=Array.from(e.touches).map(o=>E.get(o.identifier)??D(o));if(e.type==="touchend"||e.type==="touchcancel"){let o=new Set(k.map(c=>c.identifier));for(let[c,p]of E)o.has(c)||k.push({...p,ended:!0})}b("touch-update",{type:e.type,touches:k,timestamp:performance.now()})}function W(e){e!==H&&(e?(window.addEventListener("devicemotion",R),window.addEventListener("deviceorientation",O),H=!0):(window.removeEventListener("devicemotion",R),window.removeEventListener("deviceorientation",O),H=!1))}function R(e){!e.acceleration&&!e.accelerationIncludingGravity&&!e.rotationRate||y({type:"sensor-event",kind:"motion",data:{acceleration:e.acceleration?{x:e.acceleration.x,y:e.acceleration.y,z:e.acceleration.z}:null,accelerationIncludingGravity:e.accelerationIncludingGravity?{x:e.accelerationIncludingGravity.x,y:e.accelerationIncludingGravity.y,z:e.accelerationIncludingGravity.z}:null,rotationRate:e.rotationRate?{alpha:e.rotationRate.alpha,beta:e.rotationRate.beta,gamma:e.rotationRate.gamma}:null,interval:e.interval||16}})}function O(e){e.alpha===null&&e.beta===null&&e.gamma===null||y({type:"sensor-event",kind:"orientation",data:{alpha:e.alpha,beta:e.beta,gamma:e.gamma,absolute:e.absolute||!1}})}function J(){T(!1),W(!1),s&&(s.terminate(),s=null),v&&(URL.revokeObjectURL(v),v=null)}S();j().catch(e=>m(e));window.addEventListener("error",e=>{m(e.error??new Error(e.message))});window.addEventListener("unhandledrejection",e=>{m(e.reason??new Error("Unhandled promise rejection"))});})();\n', iB = "accelerometer; gyroscope; magnetometer; camera; microphone", nA = "null";
|
|
7
7
|
function aB(h) {
|
|
8
8
|
switch (h.type) {
|
|
9
9
|
case "init": {
|
|
@@ -1520,7 +1520,7 @@ class lB {
|
|
|
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-
|
|
1523
|
+
const A = await import("./essentia.js-core.es-CC_3Ap1i.js"), B = await import("./essentia-wasm.web-CFfKEyIc.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");
|
|
@@ -8721,4 +8721,4 @@ export {
|
|
|
8721
8721
|
S as b,
|
|
8722
8722
|
PB as g
|
|
8723
8723
|
};
|
|
8724
|
-
//# sourceMappingURL=index-
|
|
8724
|
+
//# sourceMappingURL=index-xEjVcfB2.js.map
|
package/dist/index.js
CHANGED