@glyphcss/vue 0.0.4 → 0.0.5
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/index.cjs +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var J=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var fe=(o,i)=>{for(var s in i)J(o,s,{get:i[s],enumerable:!0})},Ge=(o,i,s,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of de(i))!me.call(o,a)&&a!==s&&J(o,a,{get:()=>i[a],enumerable:!(r=he(i,a))||r.enumerable});return o};var ge=o=>Ge(J({},"__esModule",{value:!0}),o);var ve={};fe(ve,{BASE_TILE:()=>e.BASE_TILE,CAMERA_BACKFACE_CULL_EPS:()=>e.CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE:()=>e.DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION:()=>e.DEFAULT_PROJECTION,GlyphAxesHelper:()=>Y,GlyphCamera:()=>T,GlyphCameraContextKey:()=>A,GlyphDirectionalLightHelper:()=>_,GlyphFirstPersonControls:()=>U,GlyphGround:()=>F,GlyphHotspot:()=>N,GlyphMapControls:()=>K,GlyphMesh:()=>L,GlyphOrbitControls:()=>X,GlyphOrthographicCamera:()=>T,GlyphPerspectiveCamera:()=>D,GlyphScene:()=>B,GlyphSceneContextKey:()=>y,LoopOnce:()=>e.LoopOnce,LoopPingPong:()=>e.LoopPingPong,LoopRepeat:()=>e.LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS:()=>e.VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT:()=>e.VOXEL_CAMERA_CULL_NORMAL_LIMIT,antiprismPolygons:()=>e.antiprismPolygons,arrowPolygons:()=>e.arrowPolygons,axesHelperPolygons:()=>e.axesHelperPolygons,bakeSolidTextureSampledPolygons:()=>e.bakeSolidTextureSampledPolygons,bakeSolidTextureSamples:()=>e.bakeSolidTextureSamples,bipyramidPolygons:()=>e.bipyramidPolygons,buildSceneContext:()=>e.buildSceneContext,cameraCullNormalGroups:()=>e.cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons:()=>e.cameraCullNormalGroupsFromPolygons,cameraCullNormalKey:()=>e.cameraCullNormalKey,cameraCullVisibleSignature:()=>e.cameraCullVisibleSignature,cameraFacingDepth:()=>e.cameraFacingDepth,clampChannel:()=>e.clampChannel,computeSceneBbox:()=>e.computeSceneBbox,computeShapeLighting:()=>e.computeShapeLighting,conePolygons:()=>e.conePolygons,coverPlanarPolygons:()=>e.coverPlanarPolygons,createGlyphAnimationMixer:()=>e.createGlyphAnimationMixer,createIsometricCamera:()=>e.createIsometricCamera,cubePolygons:()=>e.cubePolygons,cuboctahedronPolygons:()=>e.cuboctahedronPolygons,cullInteriorPolygons:()=>e.cullInteriorPolygons,cylinderPolygons:()=>e.cylinderPolygons,deltoidalHexecontahedronPolygons:()=>e.deltoidalHexecontahedronPolygons,deltoidalIcositetrahedronPolygons:()=>e.deltoidalIcositetrahedronPolygons,disdyakisDodecahedronPolygons:()=>e.disdyakisDodecahedronPolygons,disdyakisTriacontahedronPolygons:()=>e.disdyakisTriacontahedronPolygons,dodecahedronPolygons:()=>e.dodecahedronPolygons,findGlyphMeshHandle:()=>P.findGlyphMeshHandle,findMeshUnderPoint:()=>P.findMeshUnderPoint,formatColor:()=>e.formatColor,greatDodecahedronPolygons:()=>e.greatDodecahedronPolygons,greatIcosahedronPolygons:()=>e.greatIcosahedronPolygons,greatStellatedDodecahedronPolygons:()=>e.greatStellatedDodecahedronPolygons,icosahedronPolygons:()=>e.icosahedronPolygons,icosidodecahedronPolygons:()=>e.icosidodecahedronPolygons,injectGlyphBaseStyles:()=>W.injectGlyphBaseStyles,inverseRotateVec3:()=>e.inverseRotateVec3,isAxisAlignedSurfaceNormal:()=>e.isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups:()=>e.isVoxelCameraCullableNormalGroups,loadMesh:()=>e.loadMesh,mergePolygons:()=>e.mergePolygons,normalFacesCamera:()=>e.normalFacesCamera,normalizeInvertMultiplier:()=>e.normalizeInvertMultiplier,normalizePolygons:()=>e.normalizePolygons,octahedronPolygons:()=>e.octahedronPolygons,optimizeMeshPolygons:()=>e.optimizeMeshPolygons,parseColor:()=>e.parseColor,parseGltf:()=>e.parseGltf,parseHexColor:()=>e.parseHexColor,parseMtl:()=>e.parseMtl,parseObj:()=>e.parseObj,parsePureColor:()=>e.parsePureColor,parseRgbColor:()=>e.parseRgbColor,parseVox:()=>e.parseVox,pentagonalHexecontahedronPolygons:()=>e.pentagonalHexecontahedronPolygons,pentagonalIcositetrahedronPolygons:()=>e.pentagonalIcositetrahedronPolygons,pentakisDodecahedronPolygons:()=>e.pentakisDodecahedronPolygons,planePolygons:()=>e.planePolygons,pointInMeshElement:()=>P.pointInMeshElement,polygonCssSurfaceNormal:()=>e.polygonCssSurfaceNormal,polygonFaces:()=>e.polygonFaces,polygonFacesCamera:()=>e.polygonFacesCamera,prismPolygons:()=>e.prismPolygons,pyramidPolygons:()=>e.pyramidPolygons,resolveGeometry:()=>e.resolveGeometry,rhombicDodecahedronPolygons:()=>e.rhombicDodecahedronPolygons,rhombicTriacontahedronPolygons:()=>e.rhombicTriacontahedronPolygons,rhombicosidodecahedronPolygons:()=>e.rhombicosidodecahedronPolygons,rhombicuboctahedronPolygons:()=>e.rhombicuboctahedronPolygons,ringPolygons:()=>e.ringPolygons,ringQuadPolygons:()=>e.ringQuadPolygons,rotateVec3:()=>e.rotateVec3,shadeColor:()=>e.shadeColor,smallStellatedDodecahedronPolygons:()=>e.smallStellatedDodecahedronPolygons,snubCubePolygons:()=>e.snubCubePolygons,snubDodecahedronPolygons:()=>e.snubDodecahedronPolygons,spherePolygons:()=>e.spherePolygons,tetrahedronPolygons:()=>e.tetrahedronPolygons,tetrakisHexahedronPolygons:()=>e.tetrakisHexahedronPolygons,torusPolygons:()=>e.torusPolygons,trapezohedronPolygons:()=>e.trapezohedronPolygons,triakisIcosahedronPolygons:()=>e.triakisIcosahedronPolygons,triakisOctahedronPolygons:()=>e.triakisOctahedronPolygons,triakisTetrahedronPolygons:()=>e.triakisTetrahedronPolygons,truncatedCubePolygons:()=>e.truncatedCubePolygons,truncatedCuboctahedronPolygons:()=>e.truncatedCuboctahedronPolygons,truncatedDodecahedronPolygons:()=>e.truncatedDodecahedronPolygons,truncatedIcosahedronPolygons:()=>e.truncatedIcosahedronPolygons,truncatedIcosidodecahedronPolygons:()=>e.truncatedIcosidodecahedronPolygons,truncatedOctahedronPolygons:()=>e.truncatedOctahedronPolygons,truncatedTetrahedronPolygons:()=>e.truncatedTetrahedronPolygons,useGlyphAnimation:()=>q,useGlyphCamera:()=>I,useGlyphSceneContext:()=>j});module.exports=ge(ve);var e=require("@glyphcss/core");var f=require("vue"),k=require("glyphcss");var Q=require("vue"),A=Symbol("glyph-camera");function E(){let o=(0,Q.inject)(A);if(!o)throw new Error("glyphcss: GlyphScene must be placed inside a GlyphPerspectiveCamera or GlyphOrthographicCamera.");return o}var y=Symbol("glyph-scene");var B=(0,f.defineComponent)({name:"GlyphScene",inheritAttrs:!1,props:{mode:{type:String,default:void 0},glyphPalette:{type:String,default:void 0},useColors:{type:Boolean,default:void 0},cols:{type:Number,default:void 0},rows:{type:Number,default:void 0},cellAspect:{type:Number,default:void 0},directionalLight:{type:Object,default:void 0},ambientLight:{type:Object,default:void 0},autoSize:{type:Boolean,default:void 0},shadow:{type:Object,default:void 0},class:{type:String,default:void 0}},setup(o,{slots:i,attrs:s}){let{cameraRef:r,sceneRerenderRef:a}=E(),n=(0,f.shallowRef)(null),t=(0,f.shallowRef)(null);return(0,f.provide)(y,{sceneRef:t}),(0,f.onMounted)(()=>{let l=n.value;if(!l)return;(0,k.injectGlyphBaseStyles)(l.ownerDocument??void 0);let p={};o.mode!==void 0&&(p.mode=o.mode),o.glyphPalette!==void 0&&(p.glyphPalette=o.glyphPalette),o.useColors!==void 0&&(p.useColors=o.useColors),o.cols!==void 0&&(p.cols=o.cols),o.rows!==void 0&&(p.rows=o.rows),o.cellAspect!==void 0&&(p.cellAspect=o.cellAspect),o.directionalLight!==void 0&&(p.directionalLight=o.directionalLight),o.ambientLight!==void 0&&(p.ambientLight=o.ambientLight),o.autoSize!==void 0&&(p.autoSize=o.autoSize),o.shadow!==void 0&&(p.shadow=o.shadow),r.value!==null&&(p.camera=r.value),t.value=(0,k.createGlyphScene)(l,p),a.value=()=>t.value?.rerender()}),(0,f.onBeforeUnmount)(()=>{t.value?.destroy(),t.value=null,a.value=null}),(0,f.watch)(()=>({mode:o.mode,glyphPalette:o.glyphPalette,useColors:o.useColors,cols:o.cols,rows:o.rows,cellAspect:o.cellAspect,directionalLight:o.directionalLight,ambientLight:o.ambientLight,autoSize:o.autoSize,shadow:o.shadow}),l=>{let p=t.value;if(!p)return;let c={};l.mode!==void 0&&(c.mode=l.mode),l.glyphPalette!==void 0&&(c.glyphPalette=l.glyphPalette),l.useColors!==void 0&&(c.useColors=l.useColors),l.cols!==void 0&&(c.cols=l.cols),l.rows!==void 0&&(c.rows=l.rows),l.cellAspect!==void 0&&(c.cellAspect=l.cellAspect),l.directionalLight!==void 0&&(c.directionalLight=l.directionalLight),l.ambientLight!==void 0&&(c.ambientLight=l.ambientLight),l.autoSize!==void 0&&(c.autoSize=l.autoSize),c.shadow=l.shadow,Object.keys(c).length>0&&p.setOptions(c)},{deep:!1}),()=>{let l=`glyph-host${o.class?` ${o.class}`:""}`;return(0,f.h)("div",{ref:n,class:l,...Object.fromEntries(Object.entries(s).filter(([p])=>p!=="class"))},i.default?.())}}});var h=require("vue"),Z=require("@glyphcss/core");var L=(0,h.defineComponent)({name:"GlyphMesh",props:{id:{type:String,default:void 0},polygons:{type:Array,default:void 0},geometry:{type:String,default:void 0},size:{type:Number,default:1},color:{type:String,default:void 0},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1},class:{type:String,default:void 0},onPointerDown:{type:Function,default:void 0},onPointerUp:{type:Function,default:void 0},onPointerMove:{type:Function,default:void 0},onPointerEnter:{type:Function,default:void 0},onPointerLeave:{type:Function,default:void 0},onClick:{type:Function,default:void 0},onWheel:{type:Function,default:void 0}},setup(o,{slots:i}){let s=(0,h.inject)(y);if(!s)throw new Error("glyphcss: GlyphMesh must be used inside a GlyphScene.");let{sceneRef:r}=s,a=(0,h.shallowRef)(null),n=(0,h.computed)(()=>o.polygons!==void 0?o.polygons:o.geometry!==void 0?(0,Z.resolveGeometry)(o.geometry,{size:o.size,color:o.color}):[]);function t(){let u={};return o.id&&(u.id=o.id),o.position&&(u.position=o.position),o.scale!==void 0&&(u.scale=o.scale),o.rotation&&(u.rotation=o.rotation),u.castShadow=o.castShadow,u.receiveShadow=o.receiveShadow,u}function l(){let u=r.value;if(!u)return;let m=u.add(n.value,t());a.value=m}function p(){a.value?.dispose(),a.value=null}let c=(0,h.watchEffect)(()=>{!r.value||a.value||l()});return(0,h.onBeforeUnmount)(()=>{c(),p()}),(0,h.watch)(n,()=>{p(),l()}),(0,h.watch)(()=>({id:o.id,position:o.position,scale:o.scale,rotation:o.rotation,castShadow:o.castShadow,receiveShadow:o.receiveShadow}),()=>{let u=a.value;u&&(u.setTransform(t()),r.value?.rerender())},{deep:!1}),()=>{let u=`glyph-mesh${o.class?` ${o.class}`:""}`;return(0,h.h)("div",{"data-glyph-mesh-id":o.id,class:u},i.default?.())}}});var z=require("vue"),ee=require("@glyphcss/core");var F=(0,z.defineComponent)({name:"GlyphGround",props:{size:{type:Number,default:5},color:{type:String,default:"#444444"},position:{type:Array,default:()=>[0,-.5,0]},rotation:{type:Array,default:void 0},id:{type:String,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!0},class:{type:String,default:void 0}},setup(o,{slots:i}){let s=(0,z.computed)(()=>(0,ee.planePolygons)({axis:1,size:o.size,offset:0,color:o.color}));return()=>(0,z.h)(L,{id:o.id,polygons:s.value,position:o.position,rotation:o.rotation??void 0,castShadow:o.castShadow,receiveShadow:o.receiveShadow,class:o.class},i)}});var d=require("vue");var N=(0,d.defineComponent)({name:"GlyphHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(o,{emit:i,slots:s}){let r=(0,d.inject)(y);if(!r)throw new Error("glyphcss: GlyphHotspot must be used inside a GlyphScene.");let{sceneRef:a}=r,n=(0,d.shallowRef)(null),t=(0,d.shallowRef)(null);function l(){let u=a.value;if(!u)return;let m=u.addHotspot({id:o.id,at:o.at,size:o.size},()=>i("click"));n.value=m,t.value=m.el}function p(){n.value?.remove(),n.value=null,t.value=null}let c=(0,d.watchEffect)(()=>{!a.value||n.value||l()});return(0,d.onBeforeUnmount)(()=>{c(),p()}),(0,d.watch)(()=>({id:o.id,at:o.at,size:o.size}),()=>{p(),l()},{deep:!1}),()=>{let u=t.value,m=s.default?.();return u&&m?(0,d.h)(d.Teleport,{to:u},m):null}}});var oe=require("vue");function j(){let o=(0,oe.inject)(y);if(!o)throw new Error("glyphcss: must be used inside a GlyphScene.");return o}var P=require("glyphcss");var R=require("vue"),te=require("glyphcss");var T=(0,R.defineComponent)({name:"GlyphOrthographicCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},zoom:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(o,{slots:i}){let s={};o.rotX!==void 0&&(s.rotX=o.rotX),o.rotY!==void 0&&(s.rotY=o.rotY),o.zoom!==void 0&&(s.zoom=o.zoom),o.center!==void 0&&(s.center=o.center);let r=(0,R.shallowRef)((0,te.createGlyphOrthographicCamera)(s)),a=(0,R.shallowRef)(null);function n(){a.value?.()}return(0,R.provide)(A,{cameraRef:r,rerender:n,sceneRerenderRef:a}),(0,R.watch)(()=>({rotX:o.rotX,rotY:o.rotY,zoom:o.zoom}),t=>{let l=r.value;if(!l)return;let p=!1;t.rotX!==void 0&&l.rotX!==t.rotX&&(l.rotX=t.rotX,p=!0),t.rotY!==void 0&&l.rotY!==t.rotY&&(l.rotY=t.rotY,p=!0),t.zoom!==void 0&&l.zoom!==t.zoom&&(l.zoom=t.zoom,p=!0),p&&a.value?.()}),()=>(0,R.h)("div",{class:o.class,style:o.style},i.default?.()??[])}});var O=require("vue"),ne=require("glyphcss");var D=(0,O.defineComponent)({name:"GlyphPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},zoom:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(o,{slots:i}){let s={};o.rotX!==void 0&&(s.rotX=o.rotX),o.rotY!==void 0&&(s.rotY=o.rotY),o.distance!==void 0&&(s.distance=o.distance),o.zoom!==void 0&&(s.zoom=o.zoom),o.stretch!==void 0&&(s.stretch=o.stretch),o.center!==void 0&&(s.center=o.center);let r=(0,O.shallowRef)((0,ne.createGlyphPerspectiveCamera)(s)),a=(0,O.shallowRef)(null);function n(){a.value?.()}return(0,O.provide)(A,{cameraRef:r,rerender:n,sceneRerenderRef:a}),(0,O.watch)(()=>({rotX:o.rotX,rotY:o.rotY,distance:o.distance,zoom:o.zoom,stretch:o.stretch}),t=>{let l=r.value;if(!l)return;let p=!1;t.rotX!==void 0&&l.rotX!==t.rotX&&(l.rotX=t.rotX,p=!0),t.rotY!==void 0&&l.rotY!==t.rotY&&(l.rotY=t.rotY,p=!0),t.distance!==void 0&&l.distance!==t.distance&&(l.distance=t.distance,p=!0),t.zoom!==void 0&&l.zoom!==t.zoom&&(l.zoom=t.zoom,p=!0),t.stretch!==void 0&&l.stretch!==t.stretch&&(l.stretch=t.stretch,p=!0),p&&a.value?.()}),()=>(0,O.h)("div",{class:o.class,style:o.style},i.default?.()??[])}});var re=require("vue");function I(){let o=(0,re.inject)(A);if(!o)throw new Error("glyphcss: useGlyphCamera must be used inside a GlyphCamera component.");return o}var v=require("vue"),le=require("glyphcss");var X=(0,v.defineComponent)({name:"GlyphOrbitControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},clampPitch:{type:Boolean,default:!0},animate:{type:[Boolean,Object],default:!1}},setup(o){let i=(0,v.inject)(y);if(!i)throw new Error("glyphcss: GlyphOrbitControls must be used inside a GlyphScene.");let{sceneRef:s}=i,r=(0,v.shallowRef)(null),a=(0,v.watchEffect)(()=>{let n=s.value;if(!n||r.value)return;let t={drag:o.drag,wheel:o.wheel,invert:o.invert,clampPitch:o.clampPitch,animate:o.animate===!1?!1:o.animate};r.value=(0,le.createGlyphOrbitControls)(n,t)});return(0,v.onBeforeUnmount)(()=>{a(),r.value?.destroy(),r.value=null}),(0,v.watch)(()=>({drag:o.drag,wheel:o.wheel,invert:o.invert,clampPitch:o.clampPitch,animate:o.animate}),n=>{r.value?.update({drag:n.drag,wheel:n.wheel,invert:n.invert,clampPitch:n.clampPitch,animate:n.animate===!1?!1:n.animate})}),()=>null}});var b=require("vue"),ae=require("glyphcss");var K=(0,b.defineComponent)({name:"GlyphMapControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},animate:{type:[Boolean,Object],default:!1}},setup(o){let i=(0,b.inject)(y);if(!i)throw new Error("glyphcss: GlyphMapControls must be used inside a GlyphScene.");let{sceneRef:s}=i,r=(0,b.shallowRef)(null),a=(0,b.watchEffect)(()=>{let n=s.value;if(!n||r.value)return;let t={drag:o.drag,wheel:o.wheel,invert:o.invert,animate:o.animate===!1?!1:o.animate};r.value=(0,ae.createGlyphMapControls)(n,t)});return(0,b.onBeforeUnmount)(()=>{a(),r.value?.destroy(),r.value=null}),(0,b.watch)(()=>({drag:o.drag,wheel:o.wheel,invert:o.invert,animate:o.animate}),n=>{r.value?.update({drag:n.drag,wheel:n.wheel,invert:n.invert,animate:n.animate===!1?!1:n.animate})}),()=>null}});var S=require("vue"),ie=require("glyphcss");var U=(0,S.defineComponent)({name:"GlyphFirstPersonControls",props:{drag:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},moveSpeed:{type:Number,default:.05},lookSpeed:{type:Number,default:.004},invert:{type:[Boolean,Number],default:!1}},setup(o){let i=(0,S.inject)(y);if(!i)throw new Error("glyphcss: GlyphFirstPersonControls must be used inside a GlyphScene.");let{sceneRef:s}=i,r=(0,S.shallowRef)(null),a=(0,S.watchEffect)(()=>{let n=s.value;if(!n||r.value)return;let t={drag:o.drag,keyboard:o.keyboard,moveSpeed:o.moveSpeed,lookSpeed:o.lookSpeed,invert:o.invert};r.value=(0,ie.createGlyphFirstPersonControls)(n,t)});return(0,S.onBeforeUnmount)(()=>{a(),r.value?.destroy(),r.value=null}),(0,S.watch)(()=>({drag:o.drag,keyboard:o.keyboard,moveSpeed:o.moveSpeed,lookSpeed:o.lookSpeed,invert:o.invert}),n=>{r.value?.update(n)}),()=>null}});var g=require("vue");function Ce(o){let i=o,s=i*.05,r=[];function a(n,t,l){let p=[n[0]-s,n[1]-s,n[2]],c=[t[0]-s,t[1]-s,t[2]],u=[t[0]+s,t[1]+s,t[2]],m=[n[0]+s,n[1]+s,n[2]];r.push({vertices:[p,c,u],color:l}),r.push({vertices:[p,u,m],color:l})}return a([0,0,0],[i,0,0],"#ff0000"),a([0,0,0],[0,i,0],"#00ff00"),a([0,0,0],[0,0,i],"#0000ff"),r}var Y=(0,g.defineComponent)({name:"GlyphAxesHelper",props:{size:{type:Number,default:1}},setup(o){let i=(0,g.inject)(y);if(!i)throw new Error("glyphcss: GlyphAxesHelper must be used inside a GlyphScene.");let{sceneRef:s}=i,r=(0,g.shallowRef)(null),a=(0,g.computed)(()=>Ce(o.size??1));function n(){let t=s.value;t&&(r.value=t.add(a.value))}return(0,g.onMounted)(n),(0,g.onBeforeUnmount)(()=>{r.value?.dispose(),r.value=null}),(0,g.watch)(a,()=>{r.value?.dispose(),r.value=null,n()}),()=>null}});var C=require("vue");function Pe(o,i,s){let[r,a,n]=o,t=s,l=[r,a,n+t],p=[r,a,n-t],c=[r+t,a,n],u=[r-t,a,n],m=[r,a+t,n],V=[r,a-t,n];return[{vertices:[l,c,m],color:i},{vertices:[l,m,u],color:i},{vertices:[l,u,V],color:i},{vertices:[l,V,c],color:i},{vertices:[p,m,c],color:i},{vertices:[p,u,m],color:i},{vertices:[p,V,u],color:i},{vertices:[p,c,V],color:i}]}var _=(0,C.defineComponent)({name:"GlyphDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(o){let i=(0,C.inject)(y);if(!i)throw new Error("glyphcss: GlyphDirectionalLightHelper must be used inside a GlyphScene.");let{sceneRef:s}=i,r=(0,C.shallowRef)(null),a=(0,C.computed)(()=>Pe(o.position??[1,1,1],o.color??"#ffff00",o.size??.1));function n(){let t=s.value;t&&(r.value=t.add(a.value))}return(0,C.onMounted)(n),(0,C.onBeforeUnmount)(()=>{r.value?.dispose(),r.value=null}),(0,C.watch)(a,()=>{r.value?.dispose(),r.value=null,n()}),()=>null}});var W=require("glyphcss");var x=require("vue"),se=require("@glyphcss/core");function H(o){return o&&typeof o=="object"&&"value"in o?o.value:o}function q(o,i,s){let r=(0,x.ref)(null),a=null,n=null,t=null,l=(0,x.ref)(0);function p(){return s==null?r.value:H(s)??r.value}function c(){n!==null&&(cancelAnimationFrame(n),n=null),t=null}function u(){c(),a&&(a.stopAllAction(),a.uncacheRoot(),a=null,l.value++)}function m(){if(n!==null)return;function G(w){if(t===null){t=w,n=requestAnimationFrame(G);return}let M=(w-t)/1e3;t=w,a?.update(M),n=requestAnimationFrame(G)}n=requestAnimationFrame(G)}function V(){u();let G=H(o),w=H(i);if(!G||G.length===0||!w)return;let M=p();M&&(a=(0,se.createGlyphAnimationMixer)(M,w),l.value++,m())}let pe=(0,x.watch)(()=>{let G=H(o),w=H(i),M=s!=null?H(s):r.value;return{c:G,ctrl:w,r:M}},()=>V(),{immediate:!0,deep:!1});(0,x.onUnmounted)(()=>{pe(),u()});let $=(0,x.computed)(()=>H(o)??[]),ue=(0,x.computed)(()=>$.value.map(G=>G.name)),ce=(0,x.computed)(()=>(l.value,a)),ye=(0,x.computed)(()=>{l.value;let G=$.value,w={};for(let M of G)Object.defineProperty(w,M.name,{enumerable:!0,get(){if(!a)return null;try{return a.clipAction(M.name)}catch{return null}}});return w});return{ref:r,mixer:ce,clips:$,names:ue,actions:ye}}0&&(module.exports={BASE_TILE,CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION,GlyphAxesHelper,GlyphCamera,GlyphCameraContextKey,GlyphDirectionalLightHelper,GlyphFirstPersonControls,GlyphGround,GlyphHotspot,GlyphMapControls,GlyphMesh,GlyphOrbitControls,GlyphOrthographicCamera,GlyphPerspectiveCamera,GlyphScene,GlyphSceneContextKey,LoopOnce,LoopPingPong,LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT,antiprismPolygons,arrowPolygons,axesHelperPolygons,bakeSolidTextureSampledPolygons,bakeSolidTextureSamples,bipyramidPolygons,buildSceneContext,cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons,cameraCullNormalKey,cameraCullVisibleSignature,cameraFacingDepth,clampChannel,computeSceneBbox,computeShapeLighting,conePolygons,coverPlanarPolygons,createGlyphAnimationMixer,createIsometricCamera,cubePolygons,cuboctahedronPolygons,cullInteriorPolygons,cylinderPolygons,deltoidalHexecontahedronPolygons,deltoidalIcositetrahedronPolygons,disdyakisDodecahedronPolygons,disdyakisTriacontahedronPolygons,dodecahedronPolygons,findGlyphMeshHandle,findMeshUnderPoint,formatColor,greatDodecahedronPolygons,greatIcosahedronPolygons,greatStellatedDodecahedronPolygons,icosahedronPolygons,icosidodecahedronPolygons,injectGlyphBaseStyles,inverseRotateVec3,isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups,loadMesh,mergePolygons,normalFacesCamera,normalizeInvertMultiplier,normalizePolygons,octahedronPolygons,optimizeMeshPolygons,parseColor,parseGltf,parseHexColor,parseMtl,parseObj,parsePureColor,parseRgbColor,parseVox,pentagonalHexecontahedronPolygons,pentagonalIcositetrahedronPolygons,pentakisDodecahedronPolygons,planePolygons,pointInMeshElement,polygonCssSurfaceNormal,polygonFaces,polygonFacesCamera,prismPolygons,pyramidPolygons,resolveGeometry,rhombicDodecahedronPolygons,rhombicTriacontahedronPolygons,rhombicosidodecahedronPolygons,rhombicuboctahedronPolygons,ringPolygons,ringQuadPolygons,rotateVec3,shadeColor,smallStellatedDodecahedronPolygons,snubCubePolygons,snubDodecahedronPolygons,spherePolygons,tetrahedronPolygons,tetrakisHexahedronPolygons,torusPolygons,trapezohedronPolygons,triakisIcosahedronPolygons,triakisOctahedronPolygons,triakisTetrahedronPolygons,truncatedCubePolygons,truncatedCuboctahedronPolygons,truncatedDodecahedronPolygons,truncatedIcosahedronPolygons,truncatedIcosidodecahedronPolygons,truncatedOctahedronPolygons,truncatedTetrahedronPolygons,useGlyphAnimation,useGlyphCamera,useGlyphSceneContext});
|
|
1
|
+
"use strict";var J=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var fe=(o,s)=>{for(var i in s)J(o,i,{get:s[i],enumerable:!0})},Ge=(o,s,i,l)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of de(s))!me.call(o,a)&&a!==i&&J(o,a,{get:()=>s[a],enumerable:!(l=he(s,a))||l.enumerable});return o};var ge=o=>Ge(J({},"__esModule",{value:!0}),o);var ve={};fe(ve,{BASE_TILE:()=>e.BASE_TILE,CAMERA_BACKFACE_CULL_EPS:()=>e.CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE:()=>e.DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION:()=>e.DEFAULT_PROJECTION,GlyphAxesHelper:()=>Y,GlyphCamera:()=>T,GlyphCameraContextKey:()=>A,GlyphDirectionalLightHelper:()=>_,GlyphFirstPersonControls:()=>U,GlyphGround:()=>F,GlyphHotspot:()=>N,GlyphMapControls:()=>K,GlyphMesh:()=>L,GlyphOrbitControls:()=>X,GlyphOrthographicCamera:()=>T,GlyphPerspectiveCamera:()=>D,GlyphScene:()=>B,GlyphSceneContextKey:()=>y,LoopOnce:()=>e.LoopOnce,LoopPingPong:()=>e.LoopPingPong,LoopRepeat:()=>e.LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS:()=>e.VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT:()=>e.VOXEL_CAMERA_CULL_NORMAL_LIMIT,antiprismPolygons:()=>e.antiprismPolygons,arrowPolygons:()=>e.arrowPolygons,axesHelperPolygons:()=>e.axesHelperPolygons,bakeSolidTextureSampledPolygons:()=>e.bakeSolidTextureSampledPolygons,bakeSolidTextureSamples:()=>e.bakeSolidTextureSamples,bipyramidPolygons:()=>e.bipyramidPolygons,buildSceneContext:()=>e.buildSceneContext,cameraCullNormalGroups:()=>e.cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons:()=>e.cameraCullNormalGroupsFromPolygons,cameraCullNormalKey:()=>e.cameraCullNormalKey,cameraCullVisibleSignature:()=>e.cameraCullVisibleSignature,cameraFacingDepth:()=>e.cameraFacingDepth,clampChannel:()=>e.clampChannel,computeSceneBbox:()=>e.computeSceneBbox,computeShapeLighting:()=>e.computeShapeLighting,conePolygons:()=>e.conePolygons,coverPlanarPolygons:()=>e.coverPlanarPolygons,createGlyphAnimationMixer:()=>e.createGlyphAnimationMixer,createIsometricCamera:()=>e.createIsometricCamera,cubePolygons:()=>e.cubePolygons,cuboctahedronPolygons:()=>e.cuboctahedronPolygons,cullInteriorPolygons:()=>e.cullInteriorPolygons,cylinderPolygons:()=>e.cylinderPolygons,deltoidalHexecontahedronPolygons:()=>e.deltoidalHexecontahedronPolygons,deltoidalIcositetrahedronPolygons:()=>e.deltoidalIcositetrahedronPolygons,disdyakisDodecahedronPolygons:()=>e.disdyakisDodecahedronPolygons,disdyakisTriacontahedronPolygons:()=>e.disdyakisTriacontahedronPolygons,dodecahedronPolygons:()=>e.dodecahedronPolygons,findGlyphMeshHandle:()=>P.findGlyphMeshHandle,findMeshUnderPoint:()=>P.findMeshUnderPoint,formatColor:()=>e.formatColor,greatDodecahedronPolygons:()=>e.greatDodecahedronPolygons,greatIcosahedronPolygons:()=>e.greatIcosahedronPolygons,greatStellatedDodecahedronPolygons:()=>e.greatStellatedDodecahedronPolygons,icosahedronPolygons:()=>e.icosahedronPolygons,icosidodecahedronPolygons:()=>e.icosidodecahedronPolygons,injectGlyphBaseStyles:()=>W.injectGlyphBaseStyles,inverseRotateVec3:()=>e.inverseRotateVec3,isAxisAlignedSurfaceNormal:()=>e.isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups:()=>e.isVoxelCameraCullableNormalGroups,loadMesh:()=>e.loadMesh,mergePolygons:()=>e.mergePolygons,normalFacesCamera:()=>e.normalFacesCamera,normalizeInvertMultiplier:()=>e.normalizeInvertMultiplier,normalizePolygons:()=>e.normalizePolygons,octahedronPolygons:()=>e.octahedronPolygons,optimizeMeshPolygons:()=>e.optimizeMeshPolygons,parseColor:()=>e.parseColor,parseGltf:()=>e.parseGltf,parseHexColor:()=>e.parseHexColor,parseMtl:()=>e.parseMtl,parseObj:()=>e.parseObj,parsePureColor:()=>e.parsePureColor,parseRgbColor:()=>e.parseRgbColor,parseVox:()=>e.parseVox,pentagonalHexecontahedronPolygons:()=>e.pentagonalHexecontahedronPolygons,pentagonalIcositetrahedronPolygons:()=>e.pentagonalIcositetrahedronPolygons,pentakisDodecahedronPolygons:()=>e.pentakisDodecahedronPolygons,planePolygons:()=>e.planePolygons,pointInMeshElement:()=>P.pointInMeshElement,polygonCssSurfaceNormal:()=>e.polygonCssSurfaceNormal,polygonFaces:()=>e.polygonFaces,polygonFacesCamera:()=>e.polygonFacesCamera,prismPolygons:()=>e.prismPolygons,pyramidPolygons:()=>e.pyramidPolygons,resolveGeometry:()=>e.resolveGeometry,rhombicDodecahedronPolygons:()=>e.rhombicDodecahedronPolygons,rhombicTriacontahedronPolygons:()=>e.rhombicTriacontahedronPolygons,rhombicosidodecahedronPolygons:()=>e.rhombicosidodecahedronPolygons,rhombicuboctahedronPolygons:()=>e.rhombicuboctahedronPolygons,ringPolygons:()=>e.ringPolygons,ringQuadPolygons:()=>e.ringQuadPolygons,rotateVec3:()=>e.rotateVec3,shadeColor:()=>e.shadeColor,smallStellatedDodecahedronPolygons:()=>e.smallStellatedDodecahedronPolygons,snubCubePolygons:()=>e.snubCubePolygons,snubDodecahedronPolygons:()=>e.snubDodecahedronPolygons,spherePolygons:()=>e.spherePolygons,tetrahedronPolygons:()=>e.tetrahedronPolygons,tetrakisHexahedronPolygons:()=>e.tetrakisHexahedronPolygons,torusPolygons:()=>e.torusPolygons,trapezohedronPolygons:()=>e.trapezohedronPolygons,triakisIcosahedronPolygons:()=>e.triakisIcosahedronPolygons,triakisOctahedronPolygons:()=>e.triakisOctahedronPolygons,triakisTetrahedronPolygons:()=>e.triakisTetrahedronPolygons,truncatedCubePolygons:()=>e.truncatedCubePolygons,truncatedCuboctahedronPolygons:()=>e.truncatedCuboctahedronPolygons,truncatedDodecahedronPolygons:()=>e.truncatedDodecahedronPolygons,truncatedIcosahedronPolygons:()=>e.truncatedIcosahedronPolygons,truncatedIcosidodecahedronPolygons:()=>e.truncatedIcosidodecahedronPolygons,truncatedOctahedronPolygons:()=>e.truncatedOctahedronPolygons,truncatedTetrahedronPolygons:()=>e.truncatedTetrahedronPolygons,useGlyphAnimation:()=>q,useGlyphCamera:()=>I,useGlyphSceneContext:()=>j});module.exports=ge(ve);var e=require("@glyphcss/core");var f=require("vue"),k=require("glyphcss");var Q=require("vue"),A=Symbol("glyph-camera");function E(){let o=(0,Q.inject)(A);if(!o)throw new Error("glyphcss: GlyphScene must be placed inside a GlyphPerspectiveCamera or GlyphOrthographicCamera.");return o}var y=Symbol("glyph-scene");var B=(0,f.defineComponent)({name:"GlyphScene",inheritAttrs:!1,props:{mode:{type:String,default:void 0},glyphPalette:{type:String,default:void 0},useColors:{type:Boolean,default:void 0},cols:{type:Number,default:void 0},rows:{type:Number,default:void 0},cellAspect:{type:Number,default:void 0},directionalLight:{type:Object,default:void 0},ambientLight:{type:Object,default:void 0},autoSize:{type:Boolean,default:void 0},shadow:{type:Object,default:void 0},class:{type:String,default:void 0}},setup(o,{slots:s,attrs:i}){let{cameraRef:l,sceneRerenderRef:a}=E(),n=(0,f.shallowRef)(null),t=(0,f.shallowRef)(null);return(0,f.provide)(y,{sceneRef:t}),(0,f.onMounted)(()=>{let r=n.value;if(!r)return;(0,k.injectGlyphBaseStyles)(r.ownerDocument??void 0);let p={};o.mode!==void 0&&(p.mode=o.mode),o.glyphPalette!==void 0&&(p.glyphPalette=o.glyphPalette),o.useColors!==void 0&&(p.useColors=o.useColors),o.cols!==void 0&&(p.cols=o.cols),o.rows!==void 0&&(p.rows=o.rows),o.cellAspect!==void 0&&(p.cellAspect=o.cellAspect),o.directionalLight!==void 0&&(p.directionalLight=o.directionalLight),o.ambientLight!==void 0&&(p.ambientLight=o.ambientLight),o.autoSize!==void 0&&(p.autoSize=o.autoSize),o.shadow!==void 0&&(p.shadow=o.shadow),l.value!==null&&(p.camera=l.value),t.value=(0,k.createGlyphScene)(r,p),a.value=()=>t.value?.rerender()}),(0,f.onBeforeUnmount)(()=>{t.value?.destroy(),t.value=null,a.value=null}),(0,f.watch)(()=>({mode:o.mode,glyphPalette:o.glyphPalette,useColors:o.useColors,cols:o.cols,rows:o.rows,cellAspect:o.cellAspect,directionalLight:o.directionalLight,ambientLight:o.ambientLight,autoSize:o.autoSize,shadow:o.shadow}),r=>{let p=t.value;if(!p)return;let u={};r.mode!==void 0&&(u.mode=r.mode),r.glyphPalette!==void 0&&(u.glyphPalette=r.glyphPalette),r.useColors!==void 0&&(u.useColors=r.useColors),r.cols!==void 0&&(u.cols=r.cols),r.rows!==void 0&&(u.rows=r.rows),r.cellAspect!==void 0&&(u.cellAspect=r.cellAspect),r.directionalLight!==void 0&&(u.directionalLight=r.directionalLight),r.ambientLight!==void 0&&(u.ambientLight=r.ambientLight),r.autoSize!==void 0&&(u.autoSize=r.autoSize),u.shadow=r.shadow,Object.keys(u).length>0&&p.setOptions(u)},{deep:!1}),()=>{let r=`glyph-host${o.class?` ${o.class}`:""}`;return(0,f.h)("div",{ref:n,class:r,...Object.fromEntries(Object.entries(i).filter(([p])=>p!=="class"))},s.default?.())}}});var h=require("vue"),Z=require("@glyphcss/core");var L=(0,h.defineComponent)({name:"GlyphMesh",props:{id:{type:String,default:void 0},polygons:{type:Array,default:void 0},geometry:{type:String,default:void 0},size:{type:Number,default:1},color:{type:String,default:void 0},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1},class:{type:String,default:void 0},onPointerDown:{type:Function,default:void 0},onPointerUp:{type:Function,default:void 0},onPointerMove:{type:Function,default:void 0},onPointerEnter:{type:Function,default:void 0},onPointerLeave:{type:Function,default:void 0},onClick:{type:Function,default:void 0},onWheel:{type:Function,default:void 0}},setup(o,{slots:s}){let i=(0,h.inject)(y);if(!i)throw new Error("glyphcss: GlyphMesh must be used inside a GlyphScene.");let{sceneRef:l}=i,a=(0,h.shallowRef)(null),n=(0,h.computed)(()=>o.polygons!==void 0?o.polygons:o.geometry!==void 0?(0,Z.resolveGeometry)(o.geometry,{size:o.size,color:o.color}):[]);function t(){let c={};return o.id&&(c.id=o.id),o.position&&(c.position=o.position),o.scale!==void 0&&(c.scale=o.scale),o.rotation&&(c.rotation=o.rotation),c.castShadow=o.castShadow,c.receiveShadow=o.receiveShadow,c}function r(){let c=l.value;if(!c)return;let m=c.add(n.value,t());a.value=m}function p(){a.value?.dispose(),a.value=null}let u=(0,h.watchEffect)(()=>{!l.value||a.value||r()});return(0,h.onBeforeUnmount)(()=>{u(),p()}),(0,h.watch)(n,()=>{p(),r()}),(0,h.watch)(()=>({id:o.id,position:o.position,scale:o.scale,rotation:o.rotation,castShadow:o.castShadow,receiveShadow:o.receiveShadow}),()=>{let c=a.value;c&&(c.setTransform(t()),l.value?.rerender())},{deep:!1}),()=>{let c=`glyph-mesh${o.class?` ${o.class}`:""}`;return(0,h.h)("div",{"data-glyph-mesh-id":o.id,class:c},s.default?.())}}});var z=require("vue"),ee=require("@glyphcss/core");var F=(0,z.defineComponent)({name:"GlyphGround",props:{size:{type:Number,default:5},color:{type:String,default:"#444444"},position:{type:Array,default:()=>[0,-.5,0]},rotation:{type:Array,default:void 0},id:{type:String,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!0},class:{type:String,default:void 0}},setup(o,{slots:s}){let i=(0,z.computed)(()=>(0,ee.planePolygons)({axis:1,size:o.size,offset:0,color:o.color}));return()=>(0,z.h)(L,{id:o.id,polygons:i.value,position:o.position,rotation:o.rotation??void 0,castShadow:o.castShadow,receiveShadow:o.receiveShadow,class:o.class},s)}});var d=require("vue");var N=(0,d.defineComponent)({name:"GlyphHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(o,{emit:s,slots:i}){let l=(0,d.inject)(y);if(!l)throw new Error("glyphcss: GlyphHotspot must be used inside a GlyphScene.");let{sceneRef:a}=l,n=(0,d.shallowRef)(null),t=(0,d.shallowRef)(null);function r(){let c=a.value;if(!c)return;let m=c.addHotspot({id:o.id,at:o.at,size:o.size},()=>s("click"));n.value=m,t.value=m.el}function p(){n.value?.remove(),n.value=null,t.value=null}let u=(0,d.watchEffect)(()=>{!a.value||n.value||r()});return(0,d.onBeforeUnmount)(()=>{u(),p()}),(0,d.watch)(()=>({id:o.id,at:o.at,size:o.size}),()=>{p(),r()},{deep:!1}),()=>{let c=t.value,m=i.default?.();return c&&m?(0,d.h)(d.Teleport,{to:c},m):null}}});var oe=require("vue");function j(){let o=(0,oe.inject)(y);if(!o)throw new Error("glyphcss: must be used inside a GlyphScene.");return o}var P=require("glyphcss");var R=require("vue"),te=require("glyphcss");var T=(0,R.defineComponent)({name:"GlyphOrthographicCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},zoom:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(o,{slots:s}){let i={};o.rotX!==void 0&&(i.rotX=o.rotX),o.rotY!==void 0&&(i.rotY=o.rotY),o.zoom!==void 0&&(i.zoom=o.zoom),o.center!==void 0&&(i.center=o.center);let l=(0,R.shallowRef)((0,te.createGlyphOrthographicCamera)(i)),a=(0,R.shallowRef)(null);function n(){a.value?.()}return(0,R.provide)(A,{cameraRef:l,rerender:n,sceneRerenderRef:a}),(0,R.watch)(()=>({rotX:o.rotX,rotY:o.rotY,zoom:o.zoom}),t=>{let r=l.value;if(!r)return;let p=!1;t.rotX!==void 0&&r.rotX!==t.rotX&&(r.rotX=t.rotX,p=!0),t.rotY!==void 0&&r.rotY!==t.rotY&&(r.rotY=t.rotY,p=!0),t.zoom!==void 0&&r.zoom!==t.zoom&&(r.zoom=t.zoom,p=!0),p&&a.value?.()}),()=>(0,R.h)("div",{class:o.class,style:o.style},s.default?.()??[])}});var O=require("vue"),ne=require("glyphcss");var D=(0,O.defineComponent)({name:"GlyphPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},perspective:{type:Number,default:void 0},zoom:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(o,{slots:s}){let i={};o.rotX!==void 0&&(i.rotX=o.rotX),o.rotY!==void 0&&(i.rotY=o.rotY),o.distance!==void 0&&(i.distance=o.distance),o.perspective!==void 0&&(i.perspective=o.perspective),o.zoom!==void 0&&(i.zoom=o.zoom),o.stretch!==void 0&&(i.stretch=o.stretch),o.center!==void 0&&(i.center=o.center);let l=(0,O.shallowRef)((0,ne.createGlyphPerspectiveCamera)(i)),a=(0,O.shallowRef)(null);function n(){a.value?.()}return(0,O.provide)(A,{cameraRef:l,rerender:n,sceneRerenderRef:a}),(0,O.watch)(()=>({rotX:o.rotX,rotY:o.rotY,distance:o.distance,perspective:o.perspective,zoom:o.zoom,stretch:o.stretch}),t=>{let r=l.value;if(!r)return;let p=!1;t.rotX!==void 0&&r.rotX!==t.rotX&&(r.rotX=t.rotX,p=!0),t.rotY!==void 0&&r.rotY!==t.rotY&&(r.rotY=t.rotY,p=!0),t.distance!==void 0&&r.distance!==t.distance&&(r.distance=t.distance,p=!0),t.perspective!==void 0&&r.perspective!==t.perspective&&(r.perspective=t.perspective,p=!0),t.zoom!==void 0&&r.zoom!==t.zoom&&(r.zoom=t.zoom,p=!0),t.stretch!==void 0&&r.stretch!==t.stretch&&(r.stretch=t.stretch,p=!0),p&&a.value?.()}),()=>(0,O.h)("div",{class:o.class,style:o.style},s.default?.()??[])}});var re=require("vue");function I(){let o=(0,re.inject)(A);if(!o)throw new Error("glyphcss: useGlyphCamera must be used inside a GlyphCamera component.");return o}var v=require("vue"),le=require("glyphcss");var X=(0,v.defineComponent)({name:"GlyphOrbitControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},clampPitch:{type:Boolean,default:!0},animate:{type:[Boolean,Object],default:!1}},setup(o){let s=(0,v.inject)(y);if(!s)throw new Error("glyphcss: GlyphOrbitControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,v.shallowRef)(null),a=(0,v.watchEffect)(()=>{let n=i.value;if(!n||l.value)return;let t={drag:o.drag,wheel:o.wheel,invert:o.invert,clampPitch:o.clampPitch,animate:o.animate===!1?!1:o.animate};l.value=(0,le.createGlyphOrbitControls)(n,t)});return(0,v.onBeforeUnmount)(()=>{a(),l.value?.destroy(),l.value=null}),(0,v.watch)(()=>({drag:o.drag,wheel:o.wheel,invert:o.invert,clampPitch:o.clampPitch,animate:o.animate}),n=>{l.value?.update({drag:n.drag,wheel:n.wheel,invert:n.invert,clampPitch:n.clampPitch,animate:n.animate===!1?!1:n.animate})}),()=>null}});var b=require("vue"),ae=require("glyphcss");var K=(0,b.defineComponent)({name:"GlyphMapControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},animate:{type:[Boolean,Object],default:!1}},setup(o){let s=(0,b.inject)(y);if(!s)throw new Error("glyphcss: GlyphMapControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,b.shallowRef)(null),a=(0,b.watchEffect)(()=>{let n=i.value;if(!n||l.value)return;let t={drag:o.drag,wheel:o.wheel,invert:o.invert,animate:o.animate===!1?!1:o.animate};l.value=(0,ae.createGlyphMapControls)(n,t)});return(0,b.onBeforeUnmount)(()=>{a(),l.value?.destroy(),l.value=null}),(0,b.watch)(()=>({drag:o.drag,wheel:o.wheel,invert:o.invert,animate:o.animate}),n=>{l.value?.update({drag:n.drag,wheel:n.wheel,invert:n.invert,animate:n.animate===!1?!1:n.animate})}),()=>null}});var S=require("vue"),ie=require("glyphcss");var U=(0,S.defineComponent)({name:"GlyphFirstPersonControls",props:{drag:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},moveSpeed:{type:Number,default:.05},lookSpeed:{type:Number,default:.004},invert:{type:[Boolean,Number],default:!1}},setup(o){let s=(0,S.inject)(y);if(!s)throw new Error("glyphcss: GlyphFirstPersonControls must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,S.shallowRef)(null),a=(0,S.watchEffect)(()=>{let n=i.value;if(!n||l.value)return;let t={drag:o.drag,keyboard:o.keyboard,moveSpeed:o.moveSpeed,lookSpeed:o.lookSpeed,invert:o.invert};l.value=(0,ie.createGlyphFirstPersonControls)(n,t)});return(0,S.onBeforeUnmount)(()=>{a(),l.value?.destroy(),l.value=null}),(0,S.watch)(()=>({drag:o.drag,keyboard:o.keyboard,moveSpeed:o.moveSpeed,lookSpeed:o.lookSpeed,invert:o.invert}),n=>{l.value?.update(n)}),()=>null}});var g=require("vue");function Ce(o){let s=o,i=s*.05,l=[];function a(n,t,r){let p=[n[0]-i,n[1]-i,n[2]],u=[t[0]-i,t[1]-i,t[2]],c=[t[0]+i,t[1]+i,t[2]],m=[n[0]+i,n[1]+i,n[2]];l.push({vertices:[p,u,c],color:r}),l.push({vertices:[p,c,m],color:r})}return a([0,0,0],[s,0,0],"#ff0000"),a([0,0,0],[0,s,0],"#00ff00"),a([0,0,0],[0,0,s],"#0000ff"),l}var Y=(0,g.defineComponent)({name:"GlyphAxesHelper",props:{size:{type:Number,default:1}},setup(o){let s=(0,g.inject)(y);if(!s)throw new Error("glyphcss: GlyphAxesHelper must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,g.shallowRef)(null),a=(0,g.computed)(()=>Ce(o.size??1));function n(){let t=i.value;t&&(l.value=t.add(a.value))}return(0,g.onMounted)(n),(0,g.onBeforeUnmount)(()=>{l.value?.dispose(),l.value=null}),(0,g.watch)(a,()=>{l.value?.dispose(),l.value=null,n()}),()=>null}});var C=require("vue");function Pe(o,s,i){let[l,a,n]=o,t=i,r=[l,a,n+t],p=[l,a,n-t],u=[l+t,a,n],c=[l-t,a,n],m=[l,a+t,n],V=[l,a-t,n];return[{vertices:[r,u,m],color:s},{vertices:[r,m,c],color:s},{vertices:[r,c,V],color:s},{vertices:[r,V,u],color:s},{vertices:[p,m,u],color:s},{vertices:[p,c,m],color:s},{vertices:[p,V,c],color:s},{vertices:[p,u,V],color:s}]}var _=(0,C.defineComponent)({name:"GlyphDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(o){let s=(0,C.inject)(y);if(!s)throw new Error("glyphcss: GlyphDirectionalLightHelper must be used inside a GlyphScene.");let{sceneRef:i}=s,l=(0,C.shallowRef)(null),a=(0,C.computed)(()=>Pe(o.position??[1,1,1],o.color??"#ffff00",o.size??.1));function n(){let t=i.value;t&&(l.value=t.add(a.value))}return(0,C.onMounted)(n),(0,C.onBeforeUnmount)(()=>{l.value?.dispose(),l.value=null}),(0,C.watch)(a,()=>{l.value?.dispose(),l.value=null,n()}),()=>null}});var W=require("glyphcss");var x=require("vue"),se=require("@glyphcss/core");function H(o){return o&&typeof o=="object"&&"value"in o?o.value:o}function q(o,s,i){let l=(0,x.ref)(null),a=null,n=null,t=null,r=(0,x.ref)(0);function p(){return i==null?l.value:H(i)??l.value}function u(){n!==null&&(cancelAnimationFrame(n),n=null),t=null}function c(){u(),a&&(a.stopAllAction(),a.uncacheRoot(),a=null,r.value++)}function m(){if(n!==null)return;function G(w){if(t===null){t=w,n=requestAnimationFrame(G);return}let M=(w-t)/1e3;t=w,a?.update(M),n=requestAnimationFrame(G)}n=requestAnimationFrame(G)}function V(){c();let G=H(o),w=H(s);if(!G||G.length===0||!w)return;let M=p();M&&(a=(0,se.createGlyphAnimationMixer)(M,w),r.value++,m())}let pe=(0,x.watch)(()=>{let G=H(o),w=H(s),M=i!=null?H(i):l.value;return{c:G,ctrl:w,r:M}},()=>V(),{immediate:!0,deep:!1});(0,x.onUnmounted)(()=>{pe(),c()});let $=(0,x.computed)(()=>H(o)??[]),ce=(0,x.computed)(()=>$.value.map(G=>G.name)),ue=(0,x.computed)(()=>(r.value,a)),ye=(0,x.computed)(()=>{r.value;let G=$.value,w={};for(let M of G)Object.defineProperty(w,M.name,{enumerable:!0,get(){if(!a)return null;try{return a.clipAction(M.name)}catch{return null}}});return w});return{ref:l,mixer:ue,clips:$,names:ce,actions:ye}}0&&(module.exports={BASE_TILE,CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION,GlyphAxesHelper,GlyphCamera,GlyphCameraContextKey,GlyphDirectionalLightHelper,GlyphFirstPersonControls,GlyphGround,GlyphHotspot,GlyphMapControls,GlyphMesh,GlyphOrbitControls,GlyphOrthographicCamera,GlyphPerspectiveCamera,GlyphScene,GlyphSceneContextKey,LoopOnce,LoopPingPong,LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT,antiprismPolygons,arrowPolygons,axesHelperPolygons,bakeSolidTextureSampledPolygons,bakeSolidTextureSamples,bipyramidPolygons,buildSceneContext,cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons,cameraCullNormalKey,cameraCullVisibleSignature,cameraFacingDepth,clampChannel,computeSceneBbox,computeShapeLighting,conePolygons,coverPlanarPolygons,createGlyphAnimationMixer,createIsometricCamera,cubePolygons,cuboctahedronPolygons,cullInteriorPolygons,cylinderPolygons,deltoidalHexecontahedronPolygons,deltoidalIcositetrahedronPolygons,disdyakisDodecahedronPolygons,disdyakisTriacontahedronPolygons,dodecahedronPolygons,findGlyphMeshHandle,findMeshUnderPoint,formatColor,greatDodecahedronPolygons,greatIcosahedronPolygons,greatStellatedDodecahedronPolygons,icosahedronPolygons,icosidodecahedronPolygons,injectGlyphBaseStyles,inverseRotateVec3,isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups,loadMesh,mergePolygons,normalFacesCamera,normalizeInvertMultiplier,normalizePolygons,octahedronPolygons,optimizeMeshPolygons,parseColor,parseGltf,parseHexColor,parseMtl,parseObj,parsePureColor,parseRgbColor,parseVox,pentagonalHexecontahedronPolygons,pentagonalIcositetrahedronPolygons,pentakisDodecahedronPolygons,planePolygons,pointInMeshElement,polygonCssSurfaceNormal,polygonFaces,polygonFacesCamera,prismPolygons,pyramidPolygons,resolveGeometry,rhombicDodecahedronPolygons,rhombicTriacontahedronPolygons,rhombicosidodecahedronPolygons,rhombicuboctahedronPolygons,ringPolygons,ringQuadPolygons,rotateVec3,shadeColor,smallStellatedDodecahedronPolygons,snubCubePolygons,snubDodecahedronPolygons,spherePolygons,tetrahedronPolygons,tetrakisHexahedronPolygons,torusPolygons,trapezohedronPolygons,triakisIcosahedronPolygons,triakisOctahedronPolygons,triakisTetrahedronPolygons,truncatedCubePolygons,truncatedCuboctahedronPolygons,truncatedDodecahedronPolygons,truncatedIcosahedronPolygons,truncatedIcosidodecahedronPolygons,truncatedOctahedronPolygons,truncatedTetrahedronPolygons,useGlyphAnimation,useGlyphCamera,useGlyphSceneContext});
|
package/dist/index.d.cts
CHANGED
|
@@ -556,6 +556,9 @@ interface GlyphPerspectiveCameraProps {
|
|
|
556
556
|
rotX?: number;
|
|
557
557
|
rotY?: number;
|
|
558
558
|
distance?: number;
|
|
559
|
+
/** CSS-perspective distance in virtual pixels (matches voxcss). Larger =
|
|
560
|
+
* flatter. Default 32000. Set 0 to disable (legacy orbit projection). */
|
|
561
|
+
perspective?: number;
|
|
559
562
|
zoom?: number;
|
|
560
563
|
stretch?: number;
|
|
561
564
|
center?: [number, number];
|
|
@@ -575,6 +578,10 @@ declare const GlyphPerspectiveCamera: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
575
578
|
type: NumberConstructor;
|
|
576
579
|
default: undefined;
|
|
577
580
|
};
|
|
581
|
+
perspective: {
|
|
582
|
+
type: NumberConstructor;
|
|
583
|
+
default: undefined;
|
|
584
|
+
};
|
|
578
585
|
zoom: {
|
|
579
586
|
type: NumberConstructor;
|
|
580
587
|
default: undefined;
|
|
@@ -610,6 +617,10 @@ declare const GlyphPerspectiveCamera: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
610
617
|
type: NumberConstructor;
|
|
611
618
|
default: undefined;
|
|
612
619
|
};
|
|
620
|
+
perspective: {
|
|
621
|
+
type: NumberConstructor;
|
|
622
|
+
default: undefined;
|
|
623
|
+
};
|
|
613
624
|
zoom: {
|
|
614
625
|
type: NumberConstructor;
|
|
615
626
|
default: undefined;
|
|
@@ -638,6 +649,7 @@ declare const GlyphPerspectiveCamera: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
638
649
|
zoom: number;
|
|
639
650
|
center: [number, number];
|
|
640
651
|
distance: number;
|
|
652
|
+
perspective: number;
|
|
641
653
|
stretch: number;
|
|
642
654
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
643
655
|
|
package/dist/index.d.ts
CHANGED
|
@@ -556,6 +556,9 @@ interface GlyphPerspectiveCameraProps {
|
|
|
556
556
|
rotX?: number;
|
|
557
557
|
rotY?: number;
|
|
558
558
|
distance?: number;
|
|
559
|
+
/** CSS-perspective distance in virtual pixels (matches voxcss). Larger =
|
|
560
|
+
* flatter. Default 32000. Set 0 to disable (legacy orbit projection). */
|
|
561
|
+
perspective?: number;
|
|
559
562
|
zoom?: number;
|
|
560
563
|
stretch?: number;
|
|
561
564
|
center?: [number, number];
|
|
@@ -575,6 +578,10 @@ declare const GlyphPerspectiveCamera: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
575
578
|
type: NumberConstructor;
|
|
576
579
|
default: undefined;
|
|
577
580
|
};
|
|
581
|
+
perspective: {
|
|
582
|
+
type: NumberConstructor;
|
|
583
|
+
default: undefined;
|
|
584
|
+
};
|
|
578
585
|
zoom: {
|
|
579
586
|
type: NumberConstructor;
|
|
580
587
|
default: undefined;
|
|
@@ -610,6 +617,10 @@ declare const GlyphPerspectiveCamera: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
610
617
|
type: NumberConstructor;
|
|
611
618
|
default: undefined;
|
|
612
619
|
};
|
|
620
|
+
perspective: {
|
|
621
|
+
type: NumberConstructor;
|
|
622
|
+
default: undefined;
|
|
623
|
+
};
|
|
613
624
|
zoom: {
|
|
614
625
|
type: NumberConstructor;
|
|
615
626
|
default: undefined;
|
|
@@ -638,6 +649,7 @@ declare const GlyphPerspectiveCamera: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
638
649
|
zoom: number;
|
|
639
650
|
center: [number, number];
|
|
640
651
|
distance: number;
|
|
652
|
+
perspective: number;
|
|
641
653
|
stretch: number;
|
|
642
654
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
643
655
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CAMERA_BACKFACE_CULL_EPS as an,VOXEL_CAMERA_CULL_AXIS_EPS as sn,VOXEL_CAMERA_CULL_NORMAL_LIMIT as pn,normalizePolygons as un,mergePolygons as cn,coverPlanarPolygons as yn,optimizeMeshPolygons as hn,cullInteriorPolygons as dn,cameraCullNormalGroups as mn,cameraCullNormalGroupsFromPolygons as fn,cameraCullNormalKey as Gn,cameraCullVisibleSignature as gn,cameraFacingDepth as Cn,isAxisAlignedSurfaceNormal as Pn,isVoxelCameraCullableNormalGroups as vn,normalFacesCamera as bn,polygonCssSurfaceNormal as Sn,polygonFacesCamera as xn,parseObj as wn,parseMtl as An,parseGltf as Rn,bakeSolidTextureSamples as On,bakeSolidTextureSampledPolygons as Mn,loadMesh as Tn,createIsometricCamera as Hn,parseVox as Vn,polygonFaces as Ln,computeShapeLighting as zn,parseColor as En,parsePureColor as kn,parseHexColor as Bn,parseRgbColor as Fn,formatColor as Nn,clampChannel as jn,shadeColor as Dn,rotateVec3 as In,inverseRotateVec3 as Xn,resolveGeometry as Kn,tetrahedronPolygons as Un,cubePolygons as Yn,octahedronPolygons as _n,dodecahedronPolygons as Wn,icosahedronPolygons as qn,smallStellatedDodecahedronPolygons as $n,greatDodecahedronPolygons as Jn,greatStellatedDodecahedronPolygons as Qn,greatIcosahedronPolygons as Zn,cuboctahedronPolygons as er,icosidodecahedronPolygons as or,truncatedTetrahedronPolygons as tr,truncatedCubePolygons as nr,truncatedOctahedronPolygons as rr,truncatedDodecahedronPolygons as lr,truncatedIcosahedronPolygons as ar,truncatedCuboctahedronPolygons as ir,truncatedIcosidodecahedronPolygons as sr,rhombicuboctahedronPolygons as pr,rhombicosidodecahedronPolygons as ur,snubCubePolygons as cr,snubDodecahedronPolygons as yr,rhombicDodecahedronPolygons as hr,rhombicTriacontahedronPolygons as dr,triakisTetrahedronPolygons as mr,triakisOctahedronPolygons as fr,triakisIcosahedronPolygons as Gr,tetrakisHexahedronPolygons as gr,pentakisDodecahedronPolygons as Cr,disdyakisDodecahedronPolygons as Pr,disdyakisTriacontahedronPolygons as vr,deltoidalIcositetrahedronPolygons as br,deltoidalHexecontahedronPolygons as Sr,pentagonalIcositetrahedronPolygons as xr,pentagonalHexecontahedronPolygons as wr,prismPolygons as Ar,antiprismPolygons as Rr,bipyramidPolygons as Or,trapezohedronPolygons as Mr,spherePolygons as Tr,cylinderPolygons as Hr,conePolygons as Vr,torusPolygons as Lr,pyramidPolygons as zr,planePolygons as Er,ringPolygons as kr,ringQuadPolygons as Br,arrowPolygons as Fr,axesHelperPolygons as Nr,buildSceneContext as jr,computeSceneBbox as Dr,BASE_TILE as Ir,DEFAULT_CAMERA_STATE as Xr,DEFAULT_PROJECTION as Kr,normalizeInvertMultiplier as Ur,createGlyphAnimationMixer as Yr,LoopOnce as _r,LoopRepeat as Wr,LoopPingPong as qr}from"@glyphcss/core";import{defineComponent as J,h as Q,provide as Z,shallowRef as k,onMounted as ee,onBeforeUnmount as oe,watch as te}from"vue";import{createGlyphScene as ne,injectGlyphBaseStyles as re}from"glyphcss";import{inject as $}from"vue";var m=Symbol("glyph-camera");function v(){let e=$(m);if(!e)throw new Error("glyphcss: GlyphScene must be placed inside a GlyphPerspectiveCamera or GlyphOrthographicCamera.");return e}var c=Symbol("glyph-scene");var x=J({name:"GlyphScene",inheritAttrs:!1,props:{mode:{type:String,default:void 0},glyphPalette:{type:String,default:void 0},useColors:{type:Boolean,default:void 0},cols:{type:Number,default:void 0},rows:{type:Number,default:void 0},cellAspect:{type:Number,default:void 0},directionalLight:{type:Object,default:void 0},ambientLight:{type:Object,default:void 0},autoSize:{type:Boolean,default:void 0},shadow:{type:Object,default:void 0},class:{type:String,default:void 0}},setup(e,{slots:s,attrs:a}){let{cameraRef:r,sceneRerenderRef:l}=v(),t=k(null),o=k(null);return Z(c,{sceneRef:o}),ee(()=>{let n=t.value;if(!n)return;re(n.ownerDocument??void 0);let i={};e.mode!==void 0&&(i.mode=e.mode),e.glyphPalette!==void 0&&(i.glyphPalette=e.glyphPalette),e.useColors!==void 0&&(i.useColors=e.useColors),e.cols!==void 0&&(i.cols=e.cols),e.rows!==void 0&&(i.rows=e.rows),e.cellAspect!==void 0&&(i.cellAspect=e.cellAspect),e.directionalLight!==void 0&&(i.directionalLight=e.directionalLight),e.ambientLight!==void 0&&(i.ambientLight=e.ambientLight),e.autoSize!==void 0&&(i.autoSize=e.autoSize),e.shadow!==void 0&&(i.shadow=e.shadow),r.value!==null&&(i.camera=r.value),o.value=ne(n,i),l.value=()=>o.value?.rerender()}),oe(()=>{o.value?.destroy(),o.value=null,l.value=null}),te(()=>({mode:e.mode,glyphPalette:e.glyphPalette,useColors:e.useColors,cols:e.cols,rows:e.rows,cellAspect:e.cellAspect,directionalLight:e.directionalLight,ambientLight:e.ambientLight,autoSize:e.autoSize,shadow:e.shadow}),n=>{let i=o.value;if(!i)return;let u={};n.mode!==void 0&&(u.mode=n.mode),n.glyphPalette!==void 0&&(u.glyphPalette=n.glyphPalette),n.useColors!==void 0&&(u.useColors=n.useColors),n.cols!==void 0&&(u.cols=n.cols),n.rows!==void 0&&(u.rows=n.rows),n.cellAspect!==void 0&&(u.cellAspect=n.cellAspect),n.directionalLight!==void 0&&(u.directionalLight=n.directionalLight),n.ambientLight!==void 0&&(u.ambientLight=n.ambientLight),n.autoSize!==void 0&&(u.autoSize=n.autoSize),u.shadow=n.shadow,Object.keys(u).length>0&&i.setOptions(u)},{deep:!1}),()=>{let n=`glyph-host${e.class?` ${e.class}`:""}`;return Q("div",{ref:t,class:n,...Object.fromEntries(Object.entries(a).filter(([i])=>i!=="class"))},s.default?.())}}});import{defineComponent as le,h as ae,inject as ie,onBeforeUnmount as se,watch as B,shallowRef as pe,computed as ue,watchEffect as ce}from"vue";import{resolveGeometry as ye}from"@glyphcss/core";var P=le({name:"GlyphMesh",props:{id:{type:String,default:void 0},polygons:{type:Array,default:void 0},geometry:{type:String,default:void 0},size:{type:Number,default:1},color:{type:String,default:void 0},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1},class:{type:String,default:void 0},onPointerDown:{type:Function,default:void 0},onPointerUp:{type:Function,default:void 0},onPointerMove:{type:Function,default:void 0},onPointerEnter:{type:Function,default:void 0},onPointerLeave:{type:Function,default:void 0},onClick:{type:Function,default:void 0},onWheel:{type:Function,default:void 0}},setup(e,{slots:s}){let a=ie(c);if(!a)throw new Error("glyphcss: GlyphMesh must be used inside a GlyphScene.");let{sceneRef:r}=a,l=pe(null),t=ue(()=>e.polygons!==void 0?e.polygons:e.geometry!==void 0?ye(e.geometry,{size:e.size,color:e.color}):[]);function o(){let p={};return e.id&&(p.id=e.id),e.position&&(p.position=e.position),e.scale!==void 0&&(p.scale=e.scale),e.rotation&&(p.rotation=e.rotation),p.castShadow=e.castShadow,p.receiveShadow=e.receiveShadow,p}function n(){let p=r.value;if(!p)return;let y=p.add(t.value,o());l.value=y}function i(){l.value?.dispose(),l.value=null}let u=ce(()=>{!r.value||l.value||n()});return se(()=>{u(),i()}),B(t,()=>{i(),n()}),B(()=>({id:e.id,position:e.position,scale:e.scale,rotation:e.rotation,castShadow:e.castShadow,receiveShadow:e.receiveShadow}),()=>{let p=l.value;p&&(p.setTransform(o()),r.value?.rerender())},{deep:!1}),()=>{let p=`glyph-mesh${e.class?` ${e.class}`:""}`;return ae("div",{"data-glyph-mesh-id":e.id,class:p},s.default?.())}}});import{defineComponent as he,h as de,computed as me}from"vue";import{planePolygons as fe}from"@glyphcss/core";var w=he({name:"GlyphGround",props:{size:{type:Number,default:5},color:{type:String,default:"#444444"},position:{type:Array,default:()=>[0,-.5,0]},rotation:{type:Array,default:void 0},id:{type:String,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!0},class:{type:String,default:void 0}},setup(e,{slots:s}){let a=me(()=>fe({axis:1,size:e.size,offset:0,color:e.color}));return()=>de(P,{id:e.id,polygons:a.value,position:e.position,rotation:e.rotation??void 0,castShadow:e.castShadow,receiveShadow:e.receiveShadow,class:e.class},s)}});import{defineComponent as Ge,inject as ge,onBeforeUnmount as Ce,watch as Pe,shallowRef as F,watchEffect as ve,h as be,Teleport as Se}from"vue";var A=Ge({name:"GlyphHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(e,{emit:s,slots:a}){let r=ge(c);if(!r)throw new Error("glyphcss: GlyphHotspot must be used inside a GlyphScene.");let{sceneRef:l}=r,t=F(null),o=F(null);function n(){let p=l.value;if(!p)return;let y=p.addHotspot({id:e.id,at:e.at,size:e.size},()=>s("click"));t.value=y,o.value=y.el}function i(){t.value?.remove(),t.value=null,o.value=null}let u=ve(()=>{!l.value||t.value||n()});return Ce(()=>{u(),i()}),Pe(()=>({id:e.id,at:e.at,size:e.size}),()=>{i(),n()},{deep:!1}),()=>{let p=o.value,y=a.default?.();return p&&y?be(Se,{to:p},y):null}}});import{inject as xe}from"vue";function R(){let e=xe(c);if(!e)throw new Error("glyphcss: must be used inside a GlyphScene.");return e}import{findGlyphMeshHandle as N,pointInMeshElement as j,findMeshUnderPoint as D}from"glyphcss";import{defineComponent as we,h as Ae,provide as Re,shallowRef as I,watch as Oe}from"vue";import{createGlyphOrthographicCamera as Me}from"glyphcss";var G=we({name:"GlyphOrthographicCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},zoom:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(e,{slots:s}){let a={};e.rotX!==void 0&&(a.rotX=e.rotX),e.rotY!==void 0&&(a.rotY=e.rotY),e.zoom!==void 0&&(a.zoom=e.zoom),e.center!==void 0&&(a.center=e.center);let r=I(Me(a)),l=I(null);function t(){l.value?.()}return Re(m,{cameraRef:r,rerender:t,sceneRerenderRef:l}),Oe(()=>({rotX:e.rotX,rotY:e.rotY,zoom:e.zoom}),o=>{let n=r.value;if(!n)return;let i=!1;o.rotX!==void 0&&n.rotX!==o.rotX&&(n.rotX=o.rotX,i=!0),o.rotY!==void 0&&n.rotY!==o.rotY&&(n.rotY=o.rotY,i=!0),o.zoom!==void 0&&n.zoom!==o.zoom&&(n.zoom=o.zoom,i=!0),i&&l.value?.()}),()=>Ae("div",{class:e.class,style:e.style},s.default?.()??[])}});import{defineComponent as Te,h as He,provide as Ve,shallowRef as X,watch as Le}from"vue";import{createGlyphPerspectiveCamera as ze}from"glyphcss";var O=Te({name:"GlyphPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},zoom:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(e,{slots:s}){let a={};e.rotX!==void 0&&(a.rotX=e.rotX),e.rotY!==void 0&&(a.rotY=e.rotY),e.distance!==void 0&&(a.distance=e.distance),e.zoom!==void 0&&(a.zoom=e.zoom),e.stretch!==void 0&&(a.stretch=e.stretch),e.center!==void 0&&(a.center=e.center);let r=X(ze(a)),l=X(null);function t(){l.value?.()}return Ve(m,{cameraRef:r,rerender:t,sceneRerenderRef:l}),Le(()=>({rotX:e.rotX,rotY:e.rotY,distance:e.distance,zoom:e.zoom,stretch:e.stretch}),o=>{let n=r.value;if(!n)return;let i=!1;o.rotX!==void 0&&n.rotX!==o.rotX&&(n.rotX=o.rotX,i=!0),o.rotY!==void 0&&n.rotY!==o.rotY&&(n.rotY=o.rotY,i=!0),o.distance!==void 0&&n.distance!==o.distance&&(n.distance=o.distance,i=!0),o.zoom!==void 0&&n.zoom!==o.zoom&&(n.zoom=o.zoom,i=!0),o.stretch!==void 0&&n.stretch!==o.stretch&&(n.stretch=o.stretch,i=!0),i&&l.value?.()}),()=>He("div",{class:e.class,style:e.style},s.default?.()??[])}});import{inject as Ee}from"vue";function M(){let e=Ee(m);if(!e)throw new Error("glyphcss: useGlyphCamera must be used inside a GlyphCamera component.");return e}import{defineComponent as ke,inject as Be,onBeforeUnmount as Fe,watch as Ne,shallowRef as je,watchEffect as De}from"vue";import{createGlyphOrbitControls as Ie}from"glyphcss";var T=ke({name:"GlyphOrbitControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},clampPitch:{type:Boolean,default:!0},animate:{type:[Boolean,Object],default:!1}},setup(e){let s=Be(c);if(!s)throw new Error("glyphcss: GlyphOrbitControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=je(null),l=De(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,wheel:e.wheel,invert:e.invert,clampPitch:e.clampPitch,animate:e.animate===!1?!1:e.animate};r.value=Ie(t,o)});return Fe(()=>{l(),r.value?.destroy(),r.value=null}),Ne(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,clampPitch:e.clampPitch,animate:e.animate}),t=>{r.value?.update({drag:t.drag,wheel:t.wheel,invert:t.invert,clampPitch:t.clampPitch,animate:t.animate===!1?!1:t.animate})}),()=>null}});import{defineComponent as Xe,inject as Ke,onBeforeUnmount as Ue,watch as Ye,shallowRef as _e,watchEffect as We}from"vue";import{createGlyphMapControls as qe}from"glyphcss";var H=Xe({name:"GlyphMapControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},animate:{type:[Boolean,Object],default:!1}},setup(e){let s=Ke(c);if(!s)throw new Error("glyphcss: GlyphMapControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=_e(null),l=We(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate===!1?!1:e.animate};r.value=qe(t,o)});return Ue(()=>{l(),r.value?.destroy(),r.value=null}),Ye(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate}),t=>{r.value?.update({drag:t.drag,wheel:t.wheel,invert:t.invert,animate:t.animate===!1?!1:t.animate})}),()=>null}});import{defineComponent as $e,inject as Je,onBeforeUnmount as Qe,watch as Ze,shallowRef as eo,watchEffect as oo}from"vue";import{createGlyphFirstPersonControls as to}from"glyphcss";var V=$e({name:"GlyphFirstPersonControls",props:{drag:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},moveSpeed:{type:Number,default:.05},lookSpeed:{type:Number,default:.004},invert:{type:[Boolean,Number],default:!1}},setup(e){let s=Je(c);if(!s)throw new Error("glyphcss: GlyphFirstPersonControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=eo(null),l=oo(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,keyboard:e.keyboard,moveSpeed:e.moveSpeed,lookSpeed:e.lookSpeed,invert:e.invert};r.value=to(t,o)});return Qe(()=>{l(),r.value?.destroy(),r.value=null}),Ze(()=>({drag:e.drag,keyboard:e.keyboard,moveSpeed:e.moveSpeed,lookSpeed:e.lookSpeed,invert:e.invert}),t=>{r.value?.update(t)}),()=>null}});import{defineComponent as no,inject as ro,onMounted as lo,onBeforeUnmount as ao,watch as io,computed as so,shallowRef as po}from"vue";function uo(e){let s=e,a=s*.05,r=[];function l(t,o,n){let i=[t[0]-a,t[1]-a,t[2]],u=[o[0]-a,o[1]-a,o[2]],p=[o[0]+a,o[1]+a,o[2]],y=[t[0]+a,t[1]+a,t[2]];r.push({vertices:[i,u,p],color:n}),r.push({vertices:[i,p,y],color:n})}return l([0,0,0],[s,0,0],"#ff0000"),l([0,0,0],[0,s,0],"#00ff00"),l([0,0,0],[0,0,s],"#0000ff"),r}var L=no({name:"GlyphAxesHelper",props:{size:{type:Number,default:1}},setup(e){let s=ro(c);if(!s)throw new Error("glyphcss: GlyphAxesHelper must be used inside a GlyphScene.");let{sceneRef:a}=s,r=po(null),l=so(()=>uo(e.size??1));function t(){let o=a.value;o&&(r.value=o.add(l.value))}return lo(t),ao(()=>{r.value?.dispose(),r.value=null}),io(l,()=>{r.value?.dispose(),r.value=null,t()}),()=>null}});import{defineComponent as co,inject as yo,onMounted as ho,onBeforeUnmount as mo,watch as fo,computed as Go,shallowRef as go}from"vue";function Co(e,s,a){let[r,l,t]=e,o=a,n=[r,l,t+o],i=[r,l,t-o],u=[r+o,l,t],p=[r-o,l,t],y=[r,l+o,t],C=[r,l-o,t];return[{vertices:[n,u,y],color:s},{vertices:[n,y,p],color:s},{vertices:[n,p,C],color:s},{vertices:[n,C,u],color:s},{vertices:[i,y,u],color:s},{vertices:[i,p,y],color:s},{vertices:[i,C,p],color:s},{vertices:[i,u,C],color:s}]}var z=co({name:"GlyphDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(e){let s=yo(c);if(!s)throw new Error("glyphcss: GlyphDirectionalLightHelper must be used inside a GlyphScene.");let{sceneRef:a}=s,r=go(null),l=Go(()=>Co(e.position??[1,1,1],e.color??"#ffff00",e.size??.1));function t(){let o=a.value;o&&(r.value=o.add(l.value))}return ho(t),mo(()=>{r.value?.dispose(),r.value=null}),fo(l,()=>{r.value?.dispose(),r.value=null,t()}),()=>null}});import{injectGlyphBaseStyles as K}from"glyphcss";import{ref as U,watch as Po,onUnmounted as vo,computed as b}from"vue";import{createGlyphAnimationMixer as bo}from"@glyphcss/core";function g(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function E(e,s,a){let r=U(null),l=null,t=null,o=null,n=U(0);function i(){return a==null?r.value:g(a)??r.value}function u(){t!==null&&(cancelAnimationFrame(t),t=null),o=null}function p(){u(),l&&(l.stopAllAction(),l.uncacheRoot(),l=null,n.value++)}function y(){if(t!==null)return;function h(d){if(o===null){o=d,t=requestAnimationFrame(h);return}let f=(d-o)/1e3;o=d,l?.update(f),t=requestAnimationFrame(h)}t=requestAnimationFrame(h)}function C(){p();let h=g(e),d=g(s);if(!h||h.length===0||!d)return;let f=i();f&&(l=bo(f,d),n.value++,y())}let Y=Po(()=>{let h=g(e),d=g(s),f=a!=null?g(a):r.value;return{c:h,ctrl:d,r:f}},()=>C(),{immediate:!0,deep:!1});vo(()=>{Y(),p()});let S=b(()=>g(e)??[]),_=b(()=>S.value.map(h=>h.name)),W=b(()=>(n.value,l)),q=b(()=>{n.value;let h=S.value,d={};for(let f of h)Object.defineProperty(d,f.name,{enumerable:!0,get(){if(!l)return null;try{return l.clipAction(f.name)}catch{return null}}});return d});return{ref:r,mixer:W,clips:S,names:_,actions:q}}export{Ir as BASE_TILE,an as CAMERA_BACKFACE_CULL_EPS,Xr as DEFAULT_CAMERA_STATE,Kr as DEFAULT_PROJECTION,L as GlyphAxesHelper,G as GlyphCamera,m as GlyphCameraContextKey,z as GlyphDirectionalLightHelper,V as GlyphFirstPersonControls,w as GlyphGround,A as GlyphHotspot,H as GlyphMapControls,P as GlyphMesh,T as GlyphOrbitControls,G as GlyphOrthographicCamera,O as GlyphPerspectiveCamera,x as GlyphScene,c as GlyphSceneContextKey,_r as LoopOnce,qr as LoopPingPong,Wr as LoopRepeat,sn as VOXEL_CAMERA_CULL_AXIS_EPS,pn as VOXEL_CAMERA_CULL_NORMAL_LIMIT,Rr as antiprismPolygons,Fr as arrowPolygons,Nr as axesHelperPolygons,Mn as bakeSolidTextureSampledPolygons,On as bakeSolidTextureSamples,Or as bipyramidPolygons,jr as buildSceneContext,mn as cameraCullNormalGroups,fn as cameraCullNormalGroupsFromPolygons,Gn as cameraCullNormalKey,gn as cameraCullVisibleSignature,Cn as cameraFacingDepth,jn as clampChannel,Dr as computeSceneBbox,zn as computeShapeLighting,Vr as conePolygons,yn as coverPlanarPolygons,Yr as createGlyphAnimationMixer,Hn as createIsometricCamera,Yn as cubePolygons,er as cuboctahedronPolygons,dn as cullInteriorPolygons,Hr as cylinderPolygons,Sr as deltoidalHexecontahedronPolygons,br as deltoidalIcositetrahedronPolygons,Pr as disdyakisDodecahedronPolygons,vr as disdyakisTriacontahedronPolygons,Wn as dodecahedronPolygons,N as findGlyphMeshHandle,D as findMeshUnderPoint,Nn as formatColor,Jn as greatDodecahedronPolygons,Zn as greatIcosahedronPolygons,Qn as greatStellatedDodecahedronPolygons,qn as icosahedronPolygons,or as icosidodecahedronPolygons,K as injectGlyphBaseStyles,Xn as inverseRotateVec3,Pn as isAxisAlignedSurfaceNormal,vn as isVoxelCameraCullableNormalGroups,Tn as loadMesh,cn as mergePolygons,bn as normalFacesCamera,Ur as normalizeInvertMultiplier,un as normalizePolygons,_n as octahedronPolygons,hn as optimizeMeshPolygons,En as parseColor,Rn as parseGltf,Bn as parseHexColor,An as parseMtl,wn as parseObj,kn as parsePureColor,Fn as parseRgbColor,Vn as parseVox,wr as pentagonalHexecontahedronPolygons,xr as pentagonalIcositetrahedronPolygons,Cr as pentakisDodecahedronPolygons,Er as planePolygons,j as pointInMeshElement,Sn as polygonCssSurfaceNormal,Ln as polygonFaces,xn as polygonFacesCamera,Ar as prismPolygons,zr as pyramidPolygons,Kn as resolveGeometry,hr as rhombicDodecahedronPolygons,dr as rhombicTriacontahedronPolygons,ur as rhombicosidodecahedronPolygons,pr as rhombicuboctahedronPolygons,kr as ringPolygons,Br as ringQuadPolygons,In as rotateVec3,Dn as shadeColor,$n as smallStellatedDodecahedronPolygons,cr as snubCubePolygons,yr as snubDodecahedronPolygons,Tr as spherePolygons,Un as tetrahedronPolygons,gr as tetrakisHexahedronPolygons,Lr as torusPolygons,Mr as trapezohedronPolygons,Gr as triakisIcosahedronPolygons,fr as triakisOctahedronPolygons,mr as triakisTetrahedronPolygons,nr as truncatedCubePolygons,ir as truncatedCuboctahedronPolygons,lr as truncatedDodecahedronPolygons,ar as truncatedIcosahedronPolygons,sr as truncatedIcosidodecahedronPolygons,rr as truncatedOctahedronPolygons,tr as truncatedTetrahedronPolygons,E as useGlyphAnimation,M as useGlyphCamera,R as useGlyphSceneContext};
|
|
1
|
+
import{CAMERA_BACKFACE_CULL_EPS as an,VOXEL_CAMERA_CULL_AXIS_EPS as sn,VOXEL_CAMERA_CULL_NORMAL_LIMIT as pn,normalizePolygons as cn,mergePolygons as un,coverPlanarPolygons as yn,optimizeMeshPolygons as hn,cullInteriorPolygons as dn,cameraCullNormalGroups as mn,cameraCullNormalGroupsFromPolygons as fn,cameraCullNormalKey as Gn,cameraCullVisibleSignature as gn,cameraFacingDepth as Cn,isAxisAlignedSurfaceNormal as Pn,isVoxelCameraCullableNormalGroups as vn,normalFacesCamera as bn,polygonCssSurfaceNormal as Sn,polygonFacesCamera as xn,parseObj as wn,parseMtl as An,parseGltf as Rn,bakeSolidTextureSamples as On,bakeSolidTextureSampledPolygons as Mn,loadMesh as Tn,createIsometricCamera as Hn,parseVox as Vn,polygonFaces as Ln,computeShapeLighting as zn,parseColor as En,parsePureColor as kn,parseHexColor as Bn,parseRgbColor as Fn,formatColor as Nn,clampChannel as jn,shadeColor as Dn,rotateVec3 as In,inverseRotateVec3 as Xn,resolveGeometry as Kn,tetrahedronPolygons as Un,cubePolygons as Yn,octahedronPolygons as _n,dodecahedronPolygons as Wn,icosahedronPolygons as qn,smallStellatedDodecahedronPolygons as $n,greatDodecahedronPolygons as Jn,greatStellatedDodecahedronPolygons as Qn,greatIcosahedronPolygons as Zn,cuboctahedronPolygons as er,icosidodecahedronPolygons as or,truncatedTetrahedronPolygons as tr,truncatedCubePolygons as nr,truncatedOctahedronPolygons as rr,truncatedDodecahedronPolygons as lr,truncatedIcosahedronPolygons as ar,truncatedCuboctahedronPolygons as ir,truncatedIcosidodecahedronPolygons as sr,rhombicuboctahedronPolygons as pr,rhombicosidodecahedronPolygons as cr,snubCubePolygons as ur,snubDodecahedronPolygons as yr,rhombicDodecahedronPolygons as hr,rhombicTriacontahedronPolygons as dr,triakisTetrahedronPolygons as mr,triakisOctahedronPolygons as fr,triakisIcosahedronPolygons as Gr,tetrakisHexahedronPolygons as gr,pentakisDodecahedronPolygons as Cr,disdyakisDodecahedronPolygons as Pr,disdyakisTriacontahedronPolygons as vr,deltoidalIcositetrahedronPolygons as br,deltoidalHexecontahedronPolygons as Sr,pentagonalIcositetrahedronPolygons as xr,pentagonalHexecontahedronPolygons as wr,prismPolygons as Ar,antiprismPolygons as Rr,bipyramidPolygons as Or,trapezohedronPolygons as Mr,spherePolygons as Tr,cylinderPolygons as Hr,conePolygons as Vr,torusPolygons as Lr,pyramidPolygons as zr,planePolygons as Er,ringPolygons as kr,ringQuadPolygons as Br,arrowPolygons as Fr,axesHelperPolygons as Nr,buildSceneContext as jr,computeSceneBbox as Dr,BASE_TILE as Ir,DEFAULT_CAMERA_STATE as Xr,DEFAULT_PROJECTION as Kr,normalizeInvertMultiplier as Ur,createGlyphAnimationMixer as Yr,LoopOnce as _r,LoopRepeat as Wr,LoopPingPong as qr}from"@glyphcss/core";import{defineComponent as J,h as Q,provide as Z,shallowRef as k,onMounted as ee,onBeforeUnmount as oe,watch as te}from"vue";import{createGlyphScene as ne,injectGlyphBaseStyles as re}from"glyphcss";import{inject as $}from"vue";var m=Symbol("glyph-camera");function v(){let e=$(m);if(!e)throw new Error("glyphcss: GlyphScene must be placed inside a GlyphPerspectiveCamera or GlyphOrthographicCamera.");return e}var u=Symbol("glyph-scene");var x=J({name:"GlyphScene",inheritAttrs:!1,props:{mode:{type:String,default:void 0},glyphPalette:{type:String,default:void 0},useColors:{type:Boolean,default:void 0},cols:{type:Number,default:void 0},rows:{type:Number,default:void 0},cellAspect:{type:Number,default:void 0},directionalLight:{type:Object,default:void 0},ambientLight:{type:Object,default:void 0},autoSize:{type:Boolean,default:void 0},shadow:{type:Object,default:void 0},class:{type:String,default:void 0}},setup(e,{slots:s,attrs:a}){let{cameraRef:r,sceneRerenderRef:l}=v(),t=k(null),o=k(null);return Z(u,{sceneRef:o}),ee(()=>{let n=t.value;if(!n)return;re(n.ownerDocument??void 0);let i={};e.mode!==void 0&&(i.mode=e.mode),e.glyphPalette!==void 0&&(i.glyphPalette=e.glyphPalette),e.useColors!==void 0&&(i.useColors=e.useColors),e.cols!==void 0&&(i.cols=e.cols),e.rows!==void 0&&(i.rows=e.rows),e.cellAspect!==void 0&&(i.cellAspect=e.cellAspect),e.directionalLight!==void 0&&(i.directionalLight=e.directionalLight),e.ambientLight!==void 0&&(i.ambientLight=e.ambientLight),e.autoSize!==void 0&&(i.autoSize=e.autoSize),e.shadow!==void 0&&(i.shadow=e.shadow),r.value!==null&&(i.camera=r.value),o.value=ne(n,i),l.value=()=>o.value?.rerender()}),oe(()=>{o.value?.destroy(),o.value=null,l.value=null}),te(()=>({mode:e.mode,glyphPalette:e.glyphPalette,useColors:e.useColors,cols:e.cols,rows:e.rows,cellAspect:e.cellAspect,directionalLight:e.directionalLight,ambientLight:e.ambientLight,autoSize:e.autoSize,shadow:e.shadow}),n=>{let i=o.value;if(!i)return;let c={};n.mode!==void 0&&(c.mode=n.mode),n.glyphPalette!==void 0&&(c.glyphPalette=n.glyphPalette),n.useColors!==void 0&&(c.useColors=n.useColors),n.cols!==void 0&&(c.cols=n.cols),n.rows!==void 0&&(c.rows=n.rows),n.cellAspect!==void 0&&(c.cellAspect=n.cellAspect),n.directionalLight!==void 0&&(c.directionalLight=n.directionalLight),n.ambientLight!==void 0&&(c.ambientLight=n.ambientLight),n.autoSize!==void 0&&(c.autoSize=n.autoSize),c.shadow=n.shadow,Object.keys(c).length>0&&i.setOptions(c)},{deep:!1}),()=>{let n=`glyph-host${e.class?` ${e.class}`:""}`;return Q("div",{ref:t,class:n,...Object.fromEntries(Object.entries(a).filter(([i])=>i!=="class"))},s.default?.())}}});import{defineComponent as le,h as ae,inject as ie,onBeforeUnmount as se,watch as B,shallowRef as pe,computed as ce,watchEffect as ue}from"vue";import{resolveGeometry as ye}from"@glyphcss/core";var P=le({name:"GlyphMesh",props:{id:{type:String,default:void 0},polygons:{type:Array,default:void 0},geometry:{type:String,default:void 0},size:{type:Number,default:1},color:{type:String,default:void 0},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1},class:{type:String,default:void 0},onPointerDown:{type:Function,default:void 0},onPointerUp:{type:Function,default:void 0},onPointerMove:{type:Function,default:void 0},onPointerEnter:{type:Function,default:void 0},onPointerLeave:{type:Function,default:void 0},onClick:{type:Function,default:void 0},onWheel:{type:Function,default:void 0}},setup(e,{slots:s}){let a=ie(u);if(!a)throw new Error("glyphcss: GlyphMesh must be used inside a GlyphScene.");let{sceneRef:r}=a,l=pe(null),t=ce(()=>e.polygons!==void 0?e.polygons:e.geometry!==void 0?ye(e.geometry,{size:e.size,color:e.color}):[]);function o(){let p={};return e.id&&(p.id=e.id),e.position&&(p.position=e.position),e.scale!==void 0&&(p.scale=e.scale),e.rotation&&(p.rotation=e.rotation),p.castShadow=e.castShadow,p.receiveShadow=e.receiveShadow,p}function n(){let p=r.value;if(!p)return;let y=p.add(t.value,o());l.value=y}function i(){l.value?.dispose(),l.value=null}let c=ue(()=>{!r.value||l.value||n()});return se(()=>{c(),i()}),B(t,()=>{i(),n()}),B(()=>({id:e.id,position:e.position,scale:e.scale,rotation:e.rotation,castShadow:e.castShadow,receiveShadow:e.receiveShadow}),()=>{let p=l.value;p&&(p.setTransform(o()),r.value?.rerender())},{deep:!1}),()=>{let p=`glyph-mesh${e.class?` ${e.class}`:""}`;return ae("div",{"data-glyph-mesh-id":e.id,class:p},s.default?.())}}});import{defineComponent as he,h as de,computed as me}from"vue";import{planePolygons as fe}from"@glyphcss/core";var w=he({name:"GlyphGround",props:{size:{type:Number,default:5},color:{type:String,default:"#444444"},position:{type:Array,default:()=>[0,-.5,0]},rotation:{type:Array,default:void 0},id:{type:String,default:void 0},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!0},class:{type:String,default:void 0}},setup(e,{slots:s}){let a=me(()=>fe({axis:1,size:e.size,offset:0,color:e.color}));return()=>de(P,{id:e.id,polygons:a.value,position:e.position,rotation:e.rotation??void 0,castShadow:e.castShadow,receiveShadow:e.receiveShadow,class:e.class},s)}});import{defineComponent as Ge,inject as ge,onBeforeUnmount as Ce,watch as Pe,shallowRef as F,watchEffect as ve,h as be,Teleport as Se}from"vue";var A=Ge({name:"GlyphHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(e,{emit:s,slots:a}){let r=ge(u);if(!r)throw new Error("glyphcss: GlyphHotspot must be used inside a GlyphScene.");let{sceneRef:l}=r,t=F(null),o=F(null);function n(){let p=l.value;if(!p)return;let y=p.addHotspot({id:e.id,at:e.at,size:e.size},()=>s("click"));t.value=y,o.value=y.el}function i(){t.value?.remove(),t.value=null,o.value=null}let c=ve(()=>{!l.value||t.value||n()});return Ce(()=>{c(),i()}),Pe(()=>({id:e.id,at:e.at,size:e.size}),()=>{i(),n()},{deep:!1}),()=>{let p=o.value,y=a.default?.();return p&&y?be(Se,{to:p},y):null}}});import{inject as xe}from"vue";function R(){let e=xe(u);if(!e)throw new Error("glyphcss: must be used inside a GlyphScene.");return e}import{findGlyphMeshHandle as N,pointInMeshElement as j,findMeshUnderPoint as D}from"glyphcss";import{defineComponent as we,h as Ae,provide as Re,shallowRef as I,watch as Oe}from"vue";import{createGlyphOrthographicCamera as Me}from"glyphcss";var G=we({name:"GlyphOrthographicCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},zoom:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(e,{slots:s}){let a={};e.rotX!==void 0&&(a.rotX=e.rotX),e.rotY!==void 0&&(a.rotY=e.rotY),e.zoom!==void 0&&(a.zoom=e.zoom),e.center!==void 0&&(a.center=e.center);let r=I(Me(a)),l=I(null);function t(){l.value?.()}return Re(m,{cameraRef:r,rerender:t,sceneRerenderRef:l}),Oe(()=>({rotX:e.rotX,rotY:e.rotY,zoom:e.zoom}),o=>{let n=r.value;if(!n)return;let i=!1;o.rotX!==void 0&&n.rotX!==o.rotX&&(n.rotX=o.rotX,i=!0),o.rotY!==void 0&&n.rotY!==o.rotY&&(n.rotY=o.rotY,i=!0),o.zoom!==void 0&&n.zoom!==o.zoom&&(n.zoom=o.zoom,i=!0),i&&l.value?.()}),()=>Ae("div",{class:e.class,style:e.style},s.default?.()??[])}});import{defineComponent as Te,h as He,provide as Ve,shallowRef as X,watch as Le}from"vue";import{createGlyphPerspectiveCamera as ze}from"glyphcss";var O=Te({name:"GlyphPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},perspective:{type:Number,default:void 0},zoom:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0},class:{type:String,default:void 0},style:{type:[Object,String],default:void 0}},setup(e,{slots:s}){let a={};e.rotX!==void 0&&(a.rotX=e.rotX),e.rotY!==void 0&&(a.rotY=e.rotY),e.distance!==void 0&&(a.distance=e.distance),e.perspective!==void 0&&(a.perspective=e.perspective),e.zoom!==void 0&&(a.zoom=e.zoom),e.stretch!==void 0&&(a.stretch=e.stretch),e.center!==void 0&&(a.center=e.center);let r=X(ze(a)),l=X(null);function t(){l.value?.()}return Ve(m,{cameraRef:r,rerender:t,sceneRerenderRef:l}),Le(()=>({rotX:e.rotX,rotY:e.rotY,distance:e.distance,perspective:e.perspective,zoom:e.zoom,stretch:e.stretch}),o=>{let n=r.value;if(!n)return;let i=!1;o.rotX!==void 0&&n.rotX!==o.rotX&&(n.rotX=o.rotX,i=!0),o.rotY!==void 0&&n.rotY!==o.rotY&&(n.rotY=o.rotY,i=!0),o.distance!==void 0&&n.distance!==o.distance&&(n.distance=o.distance,i=!0),o.perspective!==void 0&&n.perspective!==o.perspective&&(n.perspective=o.perspective,i=!0),o.zoom!==void 0&&n.zoom!==o.zoom&&(n.zoom=o.zoom,i=!0),o.stretch!==void 0&&n.stretch!==o.stretch&&(n.stretch=o.stretch,i=!0),i&&l.value?.()}),()=>He("div",{class:e.class,style:e.style},s.default?.()??[])}});import{inject as Ee}from"vue";function M(){let e=Ee(m);if(!e)throw new Error("glyphcss: useGlyphCamera must be used inside a GlyphCamera component.");return e}import{defineComponent as ke,inject as Be,onBeforeUnmount as Fe,watch as Ne,shallowRef as je,watchEffect as De}from"vue";import{createGlyphOrbitControls as Ie}from"glyphcss";var T=ke({name:"GlyphOrbitControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},clampPitch:{type:Boolean,default:!0},animate:{type:[Boolean,Object],default:!1}},setup(e){let s=Be(u);if(!s)throw new Error("glyphcss: GlyphOrbitControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=je(null),l=De(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,wheel:e.wheel,invert:e.invert,clampPitch:e.clampPitch,animate:e.animate===!1?!1:e.animate};r.value=Ie(t,o)});return Fe(()=>{l(),r.value?.destroy(),r.value=null}),Ne(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,clampPitch:e.clampPitch,animate:e.animate}),t=>{r.value?.update({drag:t.drag,wheel:t.wheel,invert:t.invert,clampPitch:t.clampPitch,animate:t.animate===!1?!1:t.animate})}),()=>null}});import{defineComponent as Xe,inject as Ke,onBeforeUnmount as Ue,watch as Ye,shallowRef as _e,watchEffect as We}from"vue";import{createGlyphMapControls as qe}from"glyphcss";var H=Xe({name:"GlyphMapControls",props:{drag:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},invert:{type:[Boolean,Number],default:!1},animate:{type:[Boolean,Object],default:!1}},setup(e){let s=Ke(u);if(!s)throw new Error("glyphcss: GlyphMapControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=_e(null),l=We(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate===!1?!1:e.animate};r.value=qe(t,o)});return Ue(()=>{l(),r.value?.destroy(),r.value=null}),Ye(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate}),t=>{r.value?.update({drag:t.drag,wheel:t.wheel,invert:t.invert,animate:t.animate===!1?!1:t.animate})}),()=>null}});import{defineComponent as $e,inject as Je,onBeforeUnmount as Qe,watch as Ze,shallowRef as eo,watchEffect as oo}from"vue";import{createGlyphFirstPersonControls as to}from"glyphcss";var V=$e({name:"GlyphFirstPersonControls",props:{drag:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},moveSpeed:{type:Number,default:.05},lookSpeed:{type:Number,default:.004},invert:{type:[Boolean,Number],default:!1}},setup(e){let s=Je(u);if(!s)throw new Error("glyphcss: GlyphFirstPersonControls must be used inside a GlyphScene.");let{sceneRef:a}=s,r=eo(null),l=oo(()=>{let t=a.value;if(!t||r.value)return;let o={drag:e.drag,keyboard:e.keyboard,moveSpeed:e.moveSpeed,lookSpeed:e.lookSpeed,invert:e.invert};r.value=to(t,o)});return Qe(()=>{l(),r.value?.destroy(),r.value=null}),Ze(()=>({drag:e.drag,keyboard:e.keyboard,moveSpeed:e.moveSpeed,lookSpeed:e.lookSpeed,invert:e.invert}),t=>{r.value?.update(t)}),()=>null}});import{defineComponent as no,inject as ro,onMounted as lo,onBeforeUnmount as ao,watch as io,computed as so,shallowRef as po}from"vue";function co(e){let s=e,a=s*.05,r=[];function l(t,o,n){let i=[t[0]-a,t[1]-a,t[2]],c=[o[0]-a,o[1]-a,o[2]],p=[o[0]+a,o[1]+a,o[2]],y=[t[0]+a,t[1]+a,t[2]];r.push({vertices:[i,c,p],color:n}),r.push({vertices:[i,p,y],color:n})}return l([0,0,0],[s,0,0],"#ff0000"),l([0,0,0],[0,s,0],"#00ff00"),l([0,0,0],[0,0,s],"#0000ff"),r}var L=no({name:"GlyphAxesHelper",props:{size:{type:Number,default:1}},setup(e){let s=ro(u);if(!s)throw new Error("glyphcss: GlyphAxesHelper must be used inside a GlyphScene.");let{sceneRef:a}=s,r=po(null),l=so(()=>co(e.size??1));function t(){let o=a.value;o&&(r.value=o.add(l.value))}return lo(t),ao(()=>{r.value?.dispose(),r.value=null}),io(l,()=>{r.value?.dispose(),r.value=null,t()}),()=>null}});import{defineComponent as uo,inject as yo,onMounted as ho,onBeforeUnmount as mo,watch as fo,computed as Go,shallowRef as go}from"vue";function Co(e,s,a){let[r,l,t]=e,o=a,n=[r,l,t+o],i=[r,l,t-o],c=[r+o,l,t],p=[r-o,l,t],y=[r,l+o,t],C=[r,l-o,t];return[{vertices:[n,c,y],color:s},{vertices:[n,y,p],color:s},{vertices:[n,p,C],color:s},{vertices:[n,C,c],color:s},{vertices:[i,y,c],color:s},{vertices:[i,p,y],color:s},{vertices:[i,C,p],color:s},{vertices:[i,c,C],color:s}]}var z=uo({name:"GlyphDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(e){let s=yo(u);if(!s)throw new Error("glyphcss: GlyphDirectionalLightHelper must be used inside a GlyphScene.");let{sceneRef:a}=s,r=go(null),l=Go(()=>Co(e.position??[1,1,1],e.color??"#ffff00",e.size??.1));function t(){let o=a.value;o&&(r.value=o.add(l.value))}return ho(t),mo(()=>{r.value?.dispose(),r.value=null}),fo(l,()=>{r.value?.dispose(),r.value=null,t()}),()=>null}});import{injectGlyphBaseStyles as K}from"glyphcss";import{ref as U,watch as Po,onUnmounted as vo,computed as b}from"vue";import{createGlyphAnimationMixer as bo}from"@glyphcss/core";function g(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function E(e,s,a){let r=U(null),l=null,t=null,o=null,n=U(0);function i(){return a==null?r.value:g(a)??r.value}function c(){t!==null&&(cancelAnimationFrame(t),t=null),o=null}function p(){c(),l&&(l.stopAllAction(),l.uncacheRoot(),l=null,n.value++)}function y(){if(t!==null)return;function h(d){if(o===null){o=d,t=requestAnimationFrame(h);return}let f=(d-o)/1e3;o=d,l?.update(f),t=requestAnimationFrame(h)}t=requestAnimationFrame(h)}function C(){p();let h=g(e),d=g(s);if(!h||h.length===0||!d)return;let f=i();f&&(l=bo(f,d),n.value++,y())}let Y=Po(()=>{let h=g(e),d=g(s),f=a!=null?g(a):r.value;return{c:h,ctrl:d,r:f}},()=>C(),{immediate:!0,deep:!1});vo(()=>{Y(),p()});let S=b(()=>g(e)??[]),_=b(()=>S.value.map(h=>h.name)),W=b(()=>(n.value,l)),q=b(()=>{n.value;let h=S.value,d={};for(let f of h)Object.defineProperty(d,f.name,{enumerable:!0,get(){if(!l)return null;try{return l.clipAction(f.name)}catch{return null}}});return d});return{ref:r,mixer:W,clips:S,names:_,actions:q}}export{Ir as BASE_TILE,an as CAMERA_BACKFACE_CULL_EPS,Xr as DEFAULT_CAMERA_STATE,Kr as DEFAULT_PROJECTION,L as GlyphAxesHelper,G as GlyphCamera,m as GlyphCameraContextKey,z as GlyphDirectionalLightHelper,V as GlyphFirstPersonControls,w as GlyphGround,A as GlyphHotspot,H as GlyphMapControls,P as GlyphMesh,T as GlyphOrbitControls,G as GlyphOrthographicCamera,O as GlyphPerspectiveCamera,x as GlyphScene,u as GlyphSceneContextKey,_r as LoopOnce,qr as LoopPingPong,Wr as LoopRepeat,sn as VOXEL_CAMERA_CULL_AXIS_EPS,pn as VOXEL_CAMERA_CULL_NORMAL_LIMIT,Rr as antiprismPolygons,Fr as arrowPolygons,Nr as axesHelperPolygons,Mn as bakeSolidTextureSampledPolygons,On as bakeSolidTextureSamples,Or as bipyramidPolygons,jr as buildSceneContext,mn as cameraCullNormalGroups,fn as cameraCullNormalGroupsFromPolygons,Gn as cameraCullNormalKey,gn as cameraCullVisibleSignature,Cn as cameraFacingDepth,jn as clampChannel,Dr as computeSceneBbox,zn as computeShapeLighting,Vr as conePolygons,yn as coverPlanarPolygons,Yr as createGlyphAnimationMixer,Hn as createIsometricCamera,Yn as cubePolygons,er as cuboctahedronPolygons,dn as cullInteriorPolygons,Hr as cylinderPolygons,Sr as deltoidalHexecontahedronPolygons,br as deltoidalIcositetrahedronPolygons,Pr as disdyakisDodecahedronPolygons,vr as disdyakisTriacontahedronPolygons,Wn as dodecahedronPolygons,N as findGlyphMeshHandle,D as findMeshUnderPoint,Nn as formatColor,Jn as greatDodecahedronPolygons,Zn as greatIcosahedronPolygons,Qn as greatStellatedDodecahedronPolygons,qn as icosahedronPolygons,or as icosidodecahedronPolygons,K as injectGlyphBaseStyles,Xn as inverseRotateVec3,Pn as isAxisAlignedSurfaceNormal,vn as isVoxelCameraCullableNormalGroups,Tn as loadMesh,un as mergePolygons,bn as normalFacesCamera,Ur as normalizeInvertMultiplier,cn as normalizePolygons,_n as octahedronPolygons,hn as optimizeMeshPolygons,En as parseColor,Rn as parseGltf,Bn as parseHexColor,An as parseMtl,wn as parseObj,kn as parsePureColor,Fn as parseRgbColor,Vn as parseVox,wr as pentagonalHexecontahedronPolygons,xr as pentagonalIcositetrahedronPolygons,Cr as pentakisDodecahedronPolygons,Er as planePolygons,j as pointInMeshElement,Sn as polygonCssSurfaceNormal,Ln as polygonFaces,xn as polygonFacesCamera,Ar as prismPolygons,zr as pyramidPolygons,Kn as resolveGeometry,hr as rhombicDodecahedronPolygons,dr as rhombicTriacontahedronPolygons,cr as rhombicosidodecahedronPolygons,pr as rhombicuboctahedronPolygons,kr as ringPolygons,Br as ringQuadPolygons,In as rotateVec3,Dn as shadeColor,$n as smallStellatedDodecahedronPolygons,ur as snubCubePolygons,yr as snubDodecahedronPolygons,Tr as spherePolygons,Un as tetrahedronPolygons,gr as tetrakisHexahedronPolygons,Lr as torusPolygons,Mr as trapezohedronPolygons,Gr as triakisIcosahedronPolygons,fr as triakisOctahedronPolygons,mr as triakisTetrahedronPolygons,nr as truncatedCubePolygons,ir as truncatedCuboctahedronPolygons,lr as truncatedDodecahedronPolygons,ar as truncatedIcosahedronPolygons,sr as truncatedIcosidodecahedronPolygons,rr as truncatedOctahedronPolygons,tr as truncatedTetrahedronPolygons,E as useGlyphAnimation,M as useGlyphCamera,R as useGlyphSceneContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glyphcss/vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Native Vue 3 components for the glyphcss ASCII polygon mesh rendering engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"
|
|
45
|
-
"glyphcss": "^0.0.
|
|
44
|
+
"glyphcss": "^0.0.5",
|
|
45
|
+
"@glyphcss/core": "^0.0.5"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"vue": "^3.0.0"
|