pptx-vanilla-viewer 2.1.3 → 2.1.4

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.
@@ -1 +1 @@
1
- import'./chunk-WOT6VMZA.js';import {WebGLRenderer,Scene,Color,PerspectiveCamera,AmbientLight,DirectionalLight,Group,MeshStandardMaterial,Mesh,EdgesGeometry,LineBasicMaterial,LineSegments,PlaneGeometry,MeshBasicMaterial,Euler,Vector3,BufferGeometry,Line,Shape,ExtrudeGeometry,CanvasTexture,SRGBColorSpace,LinearFilter,RepeatWrapping}from'three';import {OrbitControls}from'three/examples/jsm/controls/OrbitControls.js';var M=4,P=.86;function Q(o,i,e){let t=i.split(/\s+/u).filter(Boolean);if(t.length===0)return [];let a=[],s=t[0];for(let r=1;r<t.length;r++){let c=`${s} ${t[r]}`;o.measureText(c).width<=e?s=c:(a.push(s),s=t[r]);}return a.push(s),a}function _(o,i,e,t,a){if(typeof document>"u"||!o.trim()||t<=0||a<=0)return null;let s=t*P,r=a*P,c=document.createElement("canvas");c.width=Math.max(8,Math.round(s*M)),c.height=Math.max(8,Math.round(r*M));let n=c.getContext("2d");if(!n)return null;let d="system-ui, -apple-system, Segoe UI, Roboto, sans-serif",p=c.width*.94,u=Math.max(6,e)*M,f=[];for(let l=0;l<12;l++){n.font=`600 ${u}px ${d}`,f=Q(n,o,p);let g=u*1.2;if(f.length*g<=c.height*.96||u<=6*M)break;u*=.88;}n.clearRect(0,0,c.width,c.height),n.fillStyle=i,n.textAlign="center",n.textBaseline="middle",n.font=`600 ${u}px ${d}`;let x=u*1.2,w=f.length*x,y=c.height/2-w/2+x/2;for(let l=0;l<f.length;l++)n.fillText(f[l],c.width/2,y+l*x);let h=new CanvasTexture(c);return h.colorSpace=SRGBColorSpace,h.minFilter=LinearFilter,h.magFilter=LinearFilter,h.flipY=false,h.premultiplyAlpha=false,h.wrapT=RepeatWrapping,h.repeat.set(1,-1),h.offset.set(0,1),h.needsUpdate=true,{texture:h,worldWidth:s,worldHeight:r}}function ee(o){let i=new Shape;o.outline.forEach((t,a)=>{a===0?i.moveTo(t.x,t.y):i.lineTo(t.x,t.y);}),i.closePath();let e=o.bevel>0;return new ExtrudeGeometry(i,{depth:o.depth,bevelEnabled:e,bevelThickness:o.bevel,bevelSize:o.bevel,bevelSegments:2,curveSegments:o.rounded?24:1,steps:1})}function te(o,i,e){let t=ee(e),a=new MeshStandardMaterial({color:new Color(e.fill),metalness:.12,roughness:.52,transparent:e.opacity<1,opacity:e.opacity}),s=new Mesh(t,a);if(s.position.set(e.position.x,e.position.y,e.position.z),s.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z),o.add(s),i.push(t,a),e.strokeWidth>0){let r=new EdgesGeometry(t,30),c=new LineBasicMaterial({color:new Color(e.stroke)}),n=new LineSegments(r,c);n.position.copy(s.position),n.rotation.copy(s.rotation),o.add(n),i.push(r,c);}return t}function ne(o,i,e){if(!e.text)return;let t=_(e.text,e.textColor,e.fontSize,e.halfWidth*2,e.halfHeight*2);if(!t)return;let a=new PlaneGeometry(t.worldWidth,t.worldHeight),s=new MeshBasicMaterial({map:t.texture,transparent:true,depthWrite:false}),r=new Mesh(a,s),c=new Euler(e.rotation.x,e.rotation.y,e.rotation.z),n=new Vector3(0,0,e.depth+e.bevel+.4).applyEuler(c);r.position.set(e.position.x+n.x,e.position.y+n.y,e.position.z+n.z),r.rotation.copy(c),o.add(r),i.push(a,s,t.texture);}function oe(o,i,e){for(let t of e.connectors){if(t.points.length<2)continue;let a=new BufferGeometry().setFromPoints(t.points.map(r=>new Vector3(r.x,r.y,r.z))),s=new LineBasicMaterial({color:new Color(t.color),transparent:true,opacity:.7});o.add(new Line(a,s)),i.push(a,s);}}function ie(o){let i=new Group,e=[];for(let t of o.meshes)te(i,e,t),ne(i,e,t);return oe(i,e,o),{group:i,dispose(){for(let t of e)t.dispose();}}}var T=42;function ae(o){let i=1/0,e=1/0,t=1/0,a=-1/0,s=-1/0,r=-1/0,c=(n,d,p,u)=>{i=Math.min(i,n-u),e=Math.min(e,d-u),t=Math.min(t,p-u),a=Math.max(a,n+u),s=Math.max(s,d+u),r=Math.max(r,p+u);};for(let n of o.meshes){let d=Math.max(n.halfWidth,n.halfHeight)+n.depth+n.bevel;c(n.position.x,n.position.y,n.position.z,d);}for(let n of o.connectors)for(let d of n.points)c(d.x,d.y,d.z,1);return Number.isFinite(i)?{cx:(i+a)/2,cy:(e+s)/2,cz:(t+r)/2,radius:.5*Math.hypot(a-i,s-e,r-t)||1}:{cx:0,cy:0,cz:0,radius:Math.max(o.bounds.width,o.bounds.height)/2||1}}function se(o,i){let e=T*Math.PI/180,t=2*Math.atan(Math.tan(e/2)*i),a=Math.min(e,t);return o/Math.sin(a/2)*1.1}function le(o,i,e,t,a={}){let s=new WebGLRenderer({canvas:o,antialias:true,alpha:!a.background});s.setPixelRatio(Math.min(typeof window>"u"?1:window.devicePixelRatio||1,a.maxPixelRatio??2)),s.setSize(e,t,false);let r=new Scene;a.background&&(r.background=new Color(a.background));let{cx:c,cy:n,cz:d,radius:p}=ae(i),u=e/Math.max(1,t),f=se(p,u),x=new PerspectiveCamera(T,u,.1,f*8+p*4);x.position.set(c+p*.25,n+p*.3,d+f),x.lookAt(c,n,d),r.add(new AmbientLight(16777215,.62));let w=new DirectionalLight(16777215,.95);w.position.set(c+p,n+p*1.4,d+f),r.add(w);let y=new DirectionalLight(16777215,.3);y.position.set(c-p,n-p*.6,d+f*.6),r.add(y);let h=ie(i);r.add(h.group);let l=null,g=m=>{m&&!l?(l=new OrbitControls(x,o),l.enablePan=false,l.target.set(c,n,d),l.minDistance=f*.4,l.maxDistance=f*3,l.update()):!m&&l&&(l.dispose(),l=null),l&&(l.autoRotate=!!a.autoRotate,l.autoRotateSpeed=1.2);};g(!!a.interactive);let v=0,S=false,k=()=>{S||(v=requestAnimationFrame(k),l?.update(),s.render(r,x));};return v=requestAnimationFrame(k),{resize(m,z){x.aspect=m/Math.max(1,z),x.updateProjectionMatrix(),s.setSize(m,z,false);},setInteractive(m){g(m);},dispose(){S=true,cancelAnimationFrame(v),l?.dispose(),h.dispose(),s.dispose();}}}export{le as mountSmartArt3D};
1
+ import'./chunk-62D2TNHX.js';import {WebGLRenderer,Scene,Color,PerspectiveCamera,AmbientLight,DirectionalLight,Group,MeshStandardMaterial,Mesh,EdgesGeometry,LineBasicMaterial,LineSegments,PlaneGeometry,MeshBasicMaterial,Euler,Vector3,BufferGeometry,Line,Shape,ExtrudeGeometry,CanvasTexture,SRGBColorSpace,LinearFilter,RepeatWrapping}from'three';import {OrbitControls}from'three/examples/jsm/controls/OrbitControls.js';var M=4,P=.86;function Q(o,i,e){let t=i.split(/\s+/u).filter(Boolean);if(t.length===0)return [];let a=[],s=t[0];for(let r=1;r<t.length;r++){let c=`${s} ${t[r]}`;o.measureText(c).width<=e?s=c:(a.push(s),s=t[r]);}return a.push(s),a}function _(o,i,e,t,a){if(typeof document>"u"||!o.trim()||t<=0||a<=0)return null;let s=t*P,r=a*P,c=document.createElement("canvas");c.width=Math.max(8,Math.round(s*M)),c.height=Math.max(8,Math.round(r*M));let n=c.getContext("2d");if(!n)return null;let d="system-ui, -apple-system, Segoe UI, Roboto, sans-serif",p=c.width*.94,u=Math.max(6,e)*M,f=[];for(let l=0;l<12;l++){n.font=`600 ${u}px ${d}`,f=Q(n,o,p);let g=u*1.2;if(f.length*g<=c.height*.96||u<=6*M)break;u*=.88;}n.clearRect(0,0,c.width,c.height),n.fillStyle=i,n.textAlign="center",n.textBaseline="middle",n.font=`600 ${u}px ${d}`;let x=u*1.2,w=f.length*x,y=c.height/2-w/2+x/2;for(let l=0;l<f.length;l++)n.fillText(f[l],c.width/2,y+l*x);let h=new CanvasTexture(c);return h.colorSpace=SRGBColorSpace,h.minFilter=LinearFilter,h.magFilter=LinearFilter,h.flipY=false,h.premultiplyAlpha=false,h.wrapT=RepeatWrapping,h.repeat.set(1,-1),h.offset.set(0,1),h.needsUpdate=true,{texture:h,worldWidth:s,worldHeight:r}}function ee(o){let i=new Shape;o.outline.forEach((t,a)=>{a===0?i.moveTo(t.x,t.y):i.lineTo(t.x,t.y);}),i.closePath();let e=o.bevel>0;return new ExtrudeGeometry(i,{depth:o.depth,bevelEnabled:e,bevelThickness:o.bevel,bevelSize:o.bevel,bevelSegments:2,curveSegments:o.rounded?24:1,steps:1})}function te(o,i,e){let t=ee(e),a=new MeshStandardMaterial({color:new Color(e.fill),metalness:.12,roughness:.52,transparent:e.opacity<1,opacity:e.opacity}),s=new Mesh(t,a);if(s.position.set(e.position.x,e.position.y,e.position.z),s.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z),o.add(s),i.push(t,a),e.strokeWidth>0){let r=new EdgesGeometry(t,30),c=new LineBasicMaterial({color:new Color(e.stroke)}),n=new LineSegments(r,c);n.position.copy(s.position),n.rotation.copy(s.rotation),o.add(n),i.push(r,c);}return t}function ne(o,i,e){if(!e.text)return;let t=_(e.text,e.textColor,e.fontSize,e.halfWidth*2,e.halfHeight*2);if(!t)return;let a=new PlaneGeometry(t.worldWidth,t.worldHeight),s=new MeshBasicMaterial({map:t.texture,transparent:true,depthWrite:false}),r=new Mesh(a,s),c=new Euler(e.rotation.x,e.rotation.y,e.rotation.z),n=new Vector3(0,0,e.depth+e.bevel+.4).applyEuler(c);r.position.set(e.position.x+n.x,e.position.y+n.y,e.position.z+n.z),r.rotation.copy(c),o.add(r),i.push(a,s,t.texture);}function oe(o,i,e){for(let t of e.connectors){if(t.points.length<2)continue;let a=new BufferGeometry().setFromPoints(t.points.map(r=>new Vector3(r.x,r.y,r.z))),s=new LineBasicMaterial({color:new Color(t.color),transparent:true,opacity:.7});o.add(new Line(a,s)),i.push(a,s);}}function ie(o){let i=new Group,e=[];for(let t of o.meshes)te(i,e,t),ne(i,e,t);return oe(i,e,o),{group:i,dispose(){for(let t of e)t.dispose();}}}var T=42;function ae(o){let i=1/0,e=1/0,t=1/0,a=-1/0,s=-1/0,r=-1/0,c=(n,d,p,u)=>{i=Math.min(i,n-u),e=Math.min(e,d-u),t=Math.min(t,p-u),a=Math.max(a,n+u),s=Math.max(s,d+u),r=Math.max(r,p+u);};for(let n of o.meshes){let d=Math.max(n.halfWidth,n.halfHeight)+n.depth+n.bevel;c(n.position.x,n.position.y,n.position.z,d);}for(let n of o.connectors)for(let d of n.points)c(d.x,d.y,d.z,1);return Number.isFinite(i)?{cx:(i+a)/2,cy:(e+s)/2,cz:(t+r)/2,radius:.5*Math.hypot(a-i,s-e,r-t)||1}:{cx:0,cy:0,cz:0,radius:Math.max(o.bounds.width,o.bounds.height)/2||1}}function se(o,i){let e=T*Math.PI/180,t=2*Math.atan(Math.tan(e/2)*i),a=Math.min(e,t);return o/Math.sin(a/2)*1.1}function le(o,i,e,t,a={}){let s=new WebGLRenderer({canvas:o,antialias:true,alpha:!a.background});s.setPixelRatio(Math.min(typeof window>"u"?1:window.devicePixelRatio||1,a.maxPixelRatio??2)),s.setSize(e,t,false);let r=new Scene;a.background&&(r.background=new Color(a.background));let{cx:c,cy:n,cz:d,radius:p}=ae(i),u=e/Math.max(1,t),f=se(p,u),x=new PerspectiveCamera(T,u,.1,f*8+p*4);x.position.set(c+p*.25,n+p*.3,d+f),x.lookAt(c,n,d),r.add(new AmbientLight(16777215,.62));let w=new DirectionalLight(16777215,.95);w.position.set(c+p,n+p*1.4,d+f),r.add(w);let y=new DirectionalLight(16777215,.3);y.position.set(c-p,n-p*.6,d+f*.6),r.add(y);let h=ie(i);r.add(h.group);let l=null,g=m=>{m&&!l?(l=new OrbitControls(x,o),l.enablePan=false,l.target.set(c,n,d),l.minDistance=f*.4,l.maxDistance=f*3,l.update()):!m&&l&&(l.dispose(),l=null),l&&(l.autoRotate=!!a.autoRotate,l.autoRotateSpeed=1.2);};g(!!a.interactive);let v=0,S=false,k=()=>{S||(v=requestAnimationFrame(k),l?.update(),s.render(r,x));};return v=requestAnimationFrame(k),{resize(m,z){x.aspect=m/Math.max(1,z),x.updateProjectionMatrix(),s.setSize(m,z,false);},setInteractive(m){g(m);},dispose(){S=true,cancelAnimationFrame(v),l?.dispose(),h.dispose(),s.dispose();}}}export{le as mountSmartArt3D};
@@ -1 +1 @@
1
- 'use strict';require('./chunk-4VDLQK6F.cjs');var three=require('three'),OrbitControls_js=require('three/examples/jsm/controls/OrbitControls.js');var M=4,P=.86;function Q(o,i,e){let t=i.split(/\s+/u).filter(Boolean);if(t.length===0)return [];let a=[],s=t[0];for(let r=1;r<t.length;r++){let c=`${s} ${t[r]}`;o.measureText(c).width<=e?s=c:(a.push(s),s=t[r]);}return a.push(s),a}function _(o,i,e,t,a){if(typeof document>"u"||!o.trim()||t<=0||a<=0)return null;let s=t*P,r=a*P,c=document.createElement("canvas");c.width=Math.max(8,Math.round(s*M)),c.height=Math.max(8,Math.round(r*M));let n=c.getContext("2d");if(!n)return null;let d="system-ui, -apple-system, Segoe UI, Roboto, sans-serif",p=c.width*.94,u=Math.max(6,e)*M,f=[];for(let l=0;l<12;l++){n.font=`600 ${u}px ${d}`,f=Q(n,o,p);let g=u*1.2;if(f.length*g<=c.height*.96||u<=6*M)break;u*=.88;}n.clearRect(0,0,c.width,c.height),n.fillStyle=i,n.textAlign="center",n.textBaseline="middle",n.font=`600 ${u}px ${d}`;let x=u*1.2,w=f.length*x,y=c.height/2-w/2+x/2;for(let l=0;l<f.length;l++)n.fillText(f[l],c.width/2,y+l*x);let h=new three.CanvasTexture(c);return h.colorSpace=three.SRGBColorSpace,h.minFilter=three.LinearFilter,h.magFilter=three.LinearFilter,h.flipY=false,h.premultiplyAlpha=false,h.wrapT=three.RepeatWrapping,h.repeat.set(1,-1),h.offset.set(0,1),h.needsUpdate=true,{texture:h,worldWidth:s,worldHeight:r}}function ee(o){let i=new three.Shape;o.outline.forEach((t,a)=>{a===0?i.moveTo(t.x,t.y):i.lineTo(t.x,t.y);}),i.closePath();let e=o.bevel>0;return new three.ExtrudeGeometry(i,{depth:o.depth,bevelEnabled:e,bevelThickness:o.bevel,bevelSize:o.bevel,bevelSegments:2,curveSegments:o.rounded?24:1,steps:1})}function te(o,i,e){let t=ee(e),a=new three.MeshStandardMaterial({color:new three.Color(e.fill),metalness:.12,roughness:.52,transparent:e.opacity<1,opacity:e.opacity}),s=new three.Mesh(t,a);if(s.position.set(e.position.x,e.position.y,e.position.z),s.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z),o.add(s),i.push(t,a),e.strokeWidth>0){let r=new three.EdgesGeometry(t,30),c=new three.LineBasicMaterial({color:new three.Color(e.stroke)}),n=new three.LineSegments(r,c);n.position.copy(s.position),n.rotation.copy(s.rotation),o.add(n),i.push(r,c);}return t}function ne(o,i,e){if(!e.text)return;let t=_(e.text,e.textColor,e.fontSize,e.halfWidth*2,e.halfHeight*2);if(!t)return;let a=new three.PlaneGeometry(t.worldWidth,t.worldHeight),s=new three.MeshBasicMaterial({map:t.texture,transparent:true,depthWrite:false}),r=new three.Mesh(a,s),c=new three.Euler(e.rotation.x,e.rotation.y,e.rotation.z),n=new three.Vector3(0,0,e.depth+e.bevel+.4).applyEuler(c);r.position.set(e.position.x+n.x,e.position.y+n.y,e.position.z+n.z),r.rotation.copy(c),o.add(r),i.push(a,s,t.texture);}function oe(o,i,e){for(let t of e.connectors){if(t.points.length<2)continue;let a=new three.BufferGeometry().setFromPoints(t.points.map(r=>new three.Vector3(r.x,r.y,r.z))),s=new three.LineBasicMaterial({color:new three.Color(t.color),transparent:true,opacity:.7});o.add(new three.Line(a,s)),i.push(a,s);}}function ie(o){let i=new three.Group,e=[];for(let t of o.meshes)te(i,e,t),ne(i,e,t);return oe(i,e,o),{group:i,dispose(){for(let t of e)t.dispose();}}}var T=42;function ae(o){let i=1/0,e=1/0,t=1/0,a=-1/0,s=-1/0,r=-1/0,c=(n,d,p,u)=>{i=Math.min(i,n-u),e=Math.min(e,d-u),t=Math.min(t,p-u),a=Math.max(a,n+u),s=Math.max(s,d+u),r=Math.max(r,p+u);};for(let n of o.meshes){let d=Math.max(n.halfWidth,n.halfHeight)+n.depth+n.bevel;c(n.position.x,n.position.y,n.position.z,d);}for(let n of o.connectors)for(let d of n.points)c(d.x,d.y,d.z,1);return Number.isFinite(i)?{cx:(i+a)/2,cy:(e+s)/2,cz:(t+r)/2,radius:.5*Math.hypot(a-i,s-e,r-t)||1}:{cx:0,cy:0,cz:0,radius:Math.max(o.bounds.width,o.bounds.height)/2||1}}function se(o,i){let e=T*Math.PI/180,t=2*Math.atan(Math.tan(e/2)*i),a=Math.min(e,t);return o/Math.sin(a/2)*1.1}function le(o,i,e,t,a={}){let s=new three.WebGLRenderer({canvas:o,antialias:true,alpha:!a.background});s.setPixelRatio(Math.min(typeof window>"u"?1:window.devicePixelRatio||1,a.maxPixelRatio??2)),s.setSize(e,t,false);let r=new three.Scene;a.background&&(r.background=new three.Color(a.background));let{cx:c,cy:n,cz:d,radius:p}=ae(i),u=e/Math.max(1,t),f=se(p,u),x=new three.PerspectiveCamera(T,u,.1,f*8+p*4);x.position.set(c+p*.25,n+p*.3,d+f),x.lookAt(c,n,d),r.add(new three.AmbientLight(16777215,.62));let w=new three.DirectionalLight(16777215,.95);w.position.set(c+p,n+p*1.4,d+f),r.add(w);let y=new three.DirectionalLight(16777215,.3);y.position.set(c-p,n-p*.6,d+f*.6),r.add(y);let h=ie(i);r.add(h.group);let l=null,g=m=>{m&&!l?(l=new OrbitControls_js.OrbitControls(x,o),l.enablePan=false,l.target.set(c,n,d),l.minDistance=f*.4,l.maxDistance=f*3,l.update()):!m&&l&&(l.dispose(),l=null),l&&(l.autoRotate=!!a.autoRotate,l.autoRotateSpeed=1.2);};g(!!a.interactive);let v=0,S=false,k=()=>{S||(v=requestAnimationFrame(k),l?.update(),s.render(r,x));};return v=requestAnimationFrame(k),{resize(m,z){x.aspect=m/Math.max(1,z),x.updateProjectionMatrix(),s.setSize(m,z,false);},setInteractive(m){g(m);},dispose(){S=true,cancelAnimationFrame(v),l?.dispose(),h.dispose(),s.dispose();}}}exports.mountSmartArt3D=le;
1
+ 'use strict';require('./chunk-B5PFHICE.cjs');var three=require('three'),OrbitControls_js=require('three/examples/jsm/controls/OrbitControls.js');var M=4,P=.86;function Q(o,i,e){let t=i.split(/\s+/u).filter(Boolean);if(t.length===0)return [];let a=[],s=t[0];for(let r=1;r<t.length;r++){let c=`${s} ${t[r]}`;o.measureText(c).width<=e?s=c:(a.push(s),s=t[r]);}return a.push(s),a}function _(o,i,e,t,a){if(typeof document>"u"||!o.trim()||t<=0||a<=0)return null;let s=t*P,r=a*P,c=document.createElement("canvas");c.width=Math.max(8,Math.round(s*M)),c.height=Math.max(8,Math.round(r*M));let n=c.getContext("2d");if(!n)return null;let d="system-ui, -apple-system, Segoe UI, Roboto, sans-serif",p=c.width*.94,u=Math.max(6,e)*M,f=[];for(let l=0;l<12;l++){n.font=`600 ${u}px ${d}`,f=Q(n,o,p);let g=u*1.2;if(f.length*g<=c.height*.96||u<=6*M)break;u*=.88;}n.clearRect(0,0,c.width,c.height),n.fillStyle=i,n.textAlign="center",n.textBaseline="middle",n.font=`600 ${u}px ${d}`;let x=u*1.2,w=f.length*x,y=c.height/2-w/2+x/2;for(let l=0;l<f.length;l++)n.fillText(f[l],c.width/2,y+l*x);let h=new three.CanvasTexture(c);return h.colorSpace=three.SRGBColorSpace,h.minFilter=three.LinearFilter,h.magFilter=three.LinearFilter,h.flipY=false,h.premultiplyAlpha=false,h.wrapT=three.RepeatWrapping,h.repeat.set(1,-1),h.offset.set(0,1),h.needsUpdate=true,{texture:h,worldWidth:s,worldHeight:r}}function ee(o){let i=new three.Shape;o.outline.forEach((t,a)=>{a===0?i.moveTo(t.x,t.y):i.lineTo(t.x,t.y);}),i.closePath();let e=o.bevel>0;return new three.ExtrudeGeometry(i,{depth:o.depth,bevelEnabled:e,bevelThickness:o.bevel,bevelSize:o.bevel,bevelSegments:2,curveSegments:o.rounded?24:1,steps:1})}function te(o,i,e){let t=ee(e),a=new three.MeshStandardMaterial({color:new three.Color(e.fill),metalness:.12,roughness:.52,transparent:e.opacity<1,opacity:e.opacity}),s=new three.Mesh(t,a);if(s.position.set(e.position.x,e.position.y,e.position.z),s.rotation.set(e.rotation.x,e.rotation.y,e.rotation.z),o.add(s),i.push(t,a),e.strokeWidth>0){let r=new three.EdgesGeometry(t,30),c=new three.LineBasicMaterial({color:new three.Color(e.stroke)}),n=new three.LineSegments(r,c);n.position.copy(s.position),n.rotation.copy(s.rotation),o.add(n),i.push(r,c);}return t}function ne(o,i,e){if(!e.text)return;let t=_(e.text,e.textColor,e.fontSize,e.halfWidth*2,e.halfHeight*2);if(!t)return;let a=new three.PlaneGeometry(t.worldWidth,t.worldHeight),s=new three.MeshBasicMaterial({map:t.texture,transparent:true,depthWrite:false}),r=new three.Mesh(a,s),c=new three.Euler(e.rotation.x,e.rotation.y,e.rotation.z),n=new three.Vector3(0,0,e.depth+e.bevel+.4).applyEuler(c);r.position.set(e.position.x+n.x,e.position.y+n.y,e.position.z+n.z),r.rotation.copy(c),o.add(r),i.push(a,s,t.texture);}function oe(o,i,e){for(let t of e.connectors){if(t.points.length<2)continue;let a=new three.BufferGeometry().setFromPoints(t.points.map(r=>new three.Vector3(r.x,r.y,r.z))),s=new three.LineBasicMaterial({color:new three.Color(t.color),transparent:true,opacity:.7});o.add(new three.Line(a,s)),i.push(a,s);}}function ie(o){let i=new three.Group,e=[];for(let t of o.meshes)te(i,e,t),ne(i,e,t);return oe(i,e,o),{group:i,dispose(){for(let t of e)t.dispose();}}}var T=42;function ae(o){let i=1/0,e=1/0,t=1/0,a=-1/0,s=-1/0,r=-1/0,c=(n,d,p,u)=>{i=Math.min(i,n-u),e=Math.min(e,d-u),t=Math.min(t,p-u),a=Math.max(a,n+u),s=Math.max(s,d+u),r=Math.max(r,p+u);};for(let n of o.meshes){let d=Math.max(n.halfWidth,n.halfHeight)+n.depth+n.bevel;c(n.position.x,n.position.y,n.position.z,d);}for(let n of o.connectors)for(let d of n.points)c(d.x,d.y,d.z,1);return Number.isFinite(i)?{cx:(i+a)/2,cy:(e+s)/2,cz:(t+r)/2,radius:.5*Math.hypot(a-i,s-e,r-t)||1}:{cx:0,cy:0,cz:0,radius:Math.max(o.bounds.width,o.bounds.height)/2||1}}function se(o,i){let e=T*Math.PI/180,t=2*Math.atan(Math.tan(e/2)*i),a=Math.min(e,t);return o/Math.sin(a/2)*1.1}function le(o,i,e,t,a={}){let s=new three.WebGLRenderer({canvas:o,antialias:true,alpha:!a.background});s.setPixelRatio(Math.min(typeof window>"u"?1:window.devicePixelRatio||1,a.maxPixelRatio??2)),s.setSize(e,t,false);let r=new three.Scene;a.background&&(r.background=new three.Color(a.background));let{cx:c,cy:n,cz:d,radius:p}=ae(i),u=e/Math.max(1,t),f=se(p,u),x=new three.PerspectiveCamera(T,u,.1,f*8+p*4);x.position.set(c+p*.25,n+p*.3,d+f),x.lookAt(c,n,d),r.add(new three.AmbientLight(16777215,.62));let w=new three.DirectionalLight(16777215,.95);w.position.set(c+p,n+p*1.4,d+f),r.add(w);let y=new three.DirectionalLight(16777215,.3);y.position.set(c-p,n-p*.6,d+f*.6),r.add(y);let h=ie(i);r.add(h.group);let l=null,g=m=>{m&&!l?(l=new OrbitControls_js.OrbitControls(x,o),l.enablePan=false,l.target.set(c,n,d),l.minDistance=f*.4,l.maxDistance=f*3,l.update()):!m&&l&&(l.dispose(),l=null),l&&(l.autoRotate=!!a.autoRotate,l.autoRotateSpeed=1.2);};g(!!a.interactive);let v=0,S=false,k=()=>{S||(v=requestAnimationFrame(k),l?.update(),s.render(r,x));};return v=requestAnimationFrame(k),{resize(m,z){x.aspect=m/Math.max(1,z),x.updateProjectionMatrix(),s.setSize(m,z,false);},setInteractive(m){g(m);},dispose(){S=true,cancelAnimationFrame(v),l?.dispose(),h.dispose(),s.dispose();}}}exports.mountSmartArt3D=le;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-vanilla-viewer",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Zero-framework PowerPoint viewer and editor: render, edit, present, and export PPTX slides with plain DOM, no React/Vue/Angular required.",
5
5
  "keywords": [
6
6
  "javascript",
@@ -1 +0,0 @@
1
- 'use strict';var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:true});};exports.a=e;
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var e=(c,a)=>{for(var b in a)d(c,b,{get:a[b],enumerable:true});};export{e as a};