Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kitware/trame-vtklocal

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kitware/trame-vtklocal - npm Package Compare versions

Comparing version 0.0.1 to 0.6.1

dist/style.css

2

dist/trame-vtklocal.umd.js

@@ -1,1 +0,1 @@

(function(o,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(o=typeof globalThis<"u"?globalThis:o||self,h(o.trame_vtklocal={}))})(this,function(o){"use strict";const h=[];function u(c){return new Promise(function(e,s){if(h.indexOf(c)===-1){h.push(c);var r=document.createElement("script");r.type="module",r.src=c,r.onload=e,r.onerror=s,document.body.appendChild(r)}else e(!1)})}class d{constructor(){this.updateInProgress=0,this.loaded=!1,this.currentMTime=1,this.stateMTimes={},this.hashesMTime={},this.pendingArrays={},this.networkFetchState=null,this.networkFetchHash=null,this.networkFetchStatus=null,this.cameraIds=new Set,this.stateCache={}}async load(e,s){if(this.loaded)return;const r=`${e}/vtkWasmSceneManager.mjs`;await u(r);const t=`${e}/vtkWasmSceneManager.wasm`,i={canvas:s,locateFile(){return t},print(){console.info(Array.prototype.slice.call(arguments).join(" "))},printErr(){console.error(Array.prototype.slice.call(arguments).join(" "))}},a=await window.createVTKWasmSceneManager(i);a.initialize(),this.loaded=!0,this.sceneManager=a}bindNetwork(e,s,r){this.networkFetchState=e,this.networkFetchHash=s,this.networkFetchStatus=r}freeMemory(e=0){const s=this.sceneManager.getTotalBlobMemoryUsage(),r=Number(e);if(s>r){const t={};let i=this.currentMTime;for(Object.entries(this.hashesMTime).forEach(([a,n])=>{n<i&&(i=n);const l=n.toString();t[l]?t[l].push(a):t[l]=[a]});this.sceneManager.getTotalBlobMemoryUsage()>r;){const a=t[i];if(a)for(let n=0;n<a.length;n++)this.sceneManager.unRegisterBlob(a[n]),delete this.hashesMTime[a[n]];i++}}}async fetchState(e){const s=await this.networkFetchState(e);return this.pushState(s),s}pushState(e){if(e.length>0){const s=JSON.parse(e),{Id:r,MTime:t}=s;this.stateMTimes[r]=t,this.sceneManager.registerState(e)}}async fetchHash(e){if(this.pendingArrays[e]){await this.pendingArrays[e],this.hashesMTime[e]=this.currentMTime,delete this.pendingArrays[e];return}const s=await this.networkFetchHash(e);return this.sceneManager.registerBlob(e,s),this.hashesMTime[e]=this.currentMTime,s}pushHash(e,s){return this.pendingArrays[e]=new Promise(r=>{s.arrayBuffer?s.arrayBuffer().then(t=>{this.sceneManager.registerBlob(e,new Uint8Array(t)),this.hashesMTime[e]=this.currentMTime,r()}):(this.sceneManager.registerBlob(e,s),this.hashesMTime[e]=this.currentMTime,r())}),this.pendingArrays[e]}async update(e){if(this.updateInProgress++,this.updateInProgress===1)try{const s=await this.networkFetchStatus(e),r=[];s.ids.forEach(([t,i])=>{(!this.stateMTimes[t]||this.stateMTimes[t]<i)&&r.push(this.fetchState(t))}),s.hashes.forEach(t=>{this.hashesMTime[t]||r.push(this.fetchHash(t)),this.hashesMTime[t]=this.currentMTime}),s.cameras.forEach(t=>Number(this.cameraIds.add(t))),s.ignore_ids.forEach(t=>this.sceneManager.unRegisterState(t)),await Promise.all(r),await Promise.all(Object.values(this.pendingArrays)),this.currentMTime++;try{this.sceneManager.updateObjectsFromStates()}catch(t){console.error("WASM update failed"),console.log(t)}}catch(s){console.error("Error in update",s)}finally{this.updateInProgress--,this.updateInProgress&&(this.updateInProgress=0,await this.update())}}getState(e,s=!1){const r=Number(e);return s&&this.stateCache[r]?this.stateCache[r]:(this.sceneManager.updateStateFromObject(r),this.sceneManager.getState(r))}clearStateCache(){this.stateCache={}}getStateValue(e,s=!1){const r=Array.isArray(e)?e:[e];let t=null;for(let i=0;i<r.length;i++){const a=r[i];i===0?t=this.getState(a,s):(t=t[a],t.Id&&(t=this.getState(t.Id,s)))}return t}}o.VtkWASMHandler=d,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
(function(o,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(o=typeof globalThis<"u"?globalThis:o||self,h(o.trame_vtklocal={}))})(this,function(o){"use strict";const h="",l=[];function u(c){return new Promise(function(t,n){if(l.indexOf(c)===-1){l.push(c);var e=document.createElement("script");e.type="module",e.src=c,e.onload=t,e.onerror=n,document.body.appendChild(e)}else t(!1)})}class f{constructor(){this.updateInProgress=0,this.loaded=!1,this.currentMTime=1,this.stateMTimes={},this.hashesMTime={},this.pendingArrays={},this.networkFetchState=null,this.networkFetchHash=null,this.networkFetchStatus=null,this.cameraIds=new Set,this.stateCache={},this.renderWindowIds=new Set,this.renderWindowIdToInteractorId=new Map,this.offlineCanvasContainer=document.createElement("div"),this.offlineCanvasContainer.setAttribute("class","unused-canvas"),document.body.appendChild(this.offlineCanvasContainer)}async load(t){if(this.loaded)return;const n=`${t}/vtkWasmSceneManager.mjs`;await u(n);const e=await window.createVTKWasmSceneManager();e.initialize(),this.loaded=!0,this.sceneManager=e}bindNetwork(t,n,e){this.networkFetchState=t,this.networkFetchHash=n,this.networkFetchStatus=e}freeMemory(t=0){const n=this.sceneManager.getTotalBlobMemoryUsage(),e=Number(t);if(n>e){const s={};let r=this.currentMTime;for(Object.entries(this.hashesMTime).forEach(([i,a])=>{a<r&&(r=a);const d=a.toString();s[d]?s[d].push(i):s[d]=[i]});this.sceneManager.getTotalBlobMemoryUsage()>e;){const i=s[r];if(i)for(let a=0;a<i.length;a++)this.sceneManager.unRegisterBlob(i[a]),delete this.hashesMTime[i[a]];r++}}}async fetchState(t){const n=await this.networkFetchState(t);return this.pushState(n),n}pushState(t){var n;if(t.length>0){const e=JSON.parse(t),{Id:s,MTime:r}=e;this.stateMTimes[s]=r;let i=!0;this.renderWindowIds.has(s)&&((n=e==null?void 0:e.Interactor)!=null&&n.Id)&&(this.renderWindowIdToInteractorId.set(e.Interactor.Id,s),e.CanvasSelector=this.getCanvasSelector(s),this.sceneManager.registerState(JSON.stringify(e)),i=!1),this.renderWindowIdToInteractorId.has(s)&&(e.CanvasSelector=this.getCanvasSelector(this.renderWindowIdToInteractorId.get(s)),this.sceneManager.registerState(JSON.stringify(e)),i=!1),i&&this.sceneManager.registerState(t)}}async fetchHash(t){if(this.pendingArrays[t]){await this.pendingArrays[t],this.hashesMTime[t]=this.currentMTime,delete this.pendingArrays[t];return}const n=await this.networkFetchHash(t);return this.sceneManager.registerBlob(t,n),this.hashesMTime[t]=this.currentMTime,n}pushHash(t,n){return this.pendingArrays[t]=new Promise(e=>{n.arrayBuffer?n.arrayBuffer().then(s=>{this.sceneManager.registerBlob(t,new Uint8Array(s)),this.hashesMTime[t]=this.currentMTime,e()}):(this.sceneManager.registerBlob(t,n),this.hashesMTime[t]=this.currentMTime,e())}),this.pendingArrays[t]}async update(t){if(this.renderWindowIds.add(t),this.updateInProgress++,this.updateInProgress===1)try{const n=await this.networkFetchStatus(t),e=[];n.ids.forEach(([s,r])=>{(!this.stateMTimes[s]||this.stateMTimes[s]<r)&&e.push(this.fetchState(s))}),n.hashes.forEach(s=>{this.hashesMTime[s]||e.push(this.fetchHash(s)),this.hashesMTime[s]=this.currentMTime}),n.cameras.forEach(s=>Number(this.cameraIds.add(s))),n.ignore_ids.forEach(s=>this.sceneManager.unRegisterState(s)),await Promise.all(e),await Promise.all(Object.values(this.pendingArrays)),this.currentMTime++;try{this.sceneManager.updateObjectsFromStates()}catch(s){console.error("WASM update failed"),console.log(s)}}catch(n){console.error("Error in update",n)}finally{this.updateInProgress--,this.updateInProgress&&(this.updateInProgress=0,await this.update())}}getState(t,n=!1){const e=Number(t);return n&&this.stateCache[e]?this.stateCache[e]:(this.sceneManager.updateStateFromObject(e),this.sceneManager.getState(e))}clearStateCache(){this.stateCache={}}getStateValue(t,n=!1){const e=Array.isArray(t)?t:[t];let s=null;for(let r=0;r<e.length;r++){const i=e[r];r===0?s=this.getState(i,n):(s=s[i],s.Id&&(s=this.getState(s.Id,n)))}return s}getCanvasSelector(t){return`.vtk-wasm-${t}`}bindCanvasToDOM(t,n){const e=this.getCanvasSelector(t);let s=this.offlineCanvasContainer.querySelector(e);return s||(s=document.createElement("canvas"),s.setAttribute("class",e.substring(1)),s.setAttribute("tabindex","0")),n.appendChild(s),e}unbindCanvasToDOM(t){const n=this.getCanvasSelector(t),e=document.querySelector(n);e&&this.offlineCanvasContainer.appendChild(e)}}o.VtkWASMHandler=f,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
{
"name": "@kitware/trame-vtklocal",
"version": "0.0.1",
"version": "0.6.1",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "main": "./dist/trame-vtklocal.umd.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc