@glyphcss/vue 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Layoutit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ > **Status: pre-1.0. APIs may still change before a stable 1.0 release.**
2
+
3
+ # @glyphcss/vue
4
+
5
+ Native Vue 3 components for glyphcss — an ASCII polygon mesh renderer that projects 3D scenes into a single `<pre>` element. Loads OBJ, glTF, GLB, and MagicaVoxel `.vox` files; renders the result as monospace text in the browser.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @glyphcss/vue
11
+ ```
12
+
13
+ Requires Vue 3 as a peer dependency.
14
+
15
+ ## Quickstart
16
+
17
+ ```vue
18
+ <template>
19
+ <GlyphcssScene :cols="80" :rows="40">
20
+ <GlyphcssCamera :rot-x="65" :rot-y="45">
21
+ <GlyphcssOrbitControls />
22
+ <GlyphcssMesh src="/cottage.glb" />
23
+ </GlyphcssCamera>
24
+ </GlyphcssScene>
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import {
29
+ GlyphcssScene,
30
+ GlyphcssCamera,
31
+ GlyphcssMesh,
32
+ GlyphcssOrbitControls,
33
+ } from "@glyphcss/vue";
34
+ </script>
35
+ ```
36
+
37
+ ## Component reference
38
+
39
+ ### `<GlyphcssScene>`
40
+
41
+ Root of every Vue glyphcss render tree. Owns the `<pre>` output element and rasterizes all meshes on camera or state change.
42
+
43
+ | Prop | Type | Default | Description |
44
+ |---|---|---|---|
45
+ | `cols` | `number` | `80` | Grid width in character cells |
46
+ | `rows` | `number` | `40` | Grid height in character cells |
47
+ | `mode` | `"wireframe" \| "solid" \| "voxel"` | `"solid"` | Render mode |
48
+
49
+ ### `<GlyphcssCamera>` / `<GlyphcssPerspectiveCamera>`
50
+
51
+ Perspective camera. `GlyphcssCamera` is the ergonomic alias.
52
+
53
+ | Prop | Type | Default | Description |
54
+ |---|---|---|---|
55
+ | `fov` | `number` | `60` | Vertical field of view in degrees |
56
+ | `rot-x` | `number` | `35` | Tilt in degrees |
57
+ | `rot-y` | `number` | `45` | Azimuth in degrees |
58
+ | `zoom` | `number` | `1` | Zoom multiplier |
59
+
60
+ ### `<GlyphcssMesh>`
61
+
62
+ Loads and displays a 3D mesh. Supports `.obj`, `.glb`, `.gltf`, `.vox`.
63
+
64
+ | Prop | Type | Description |
65
+ |---|---|---|
66
+ | `src` | `string` | URL of the mesh file |
67
+ | `color` | `string` | Override mesh color |
68
+
69
+ ### `<GlyphcssOrbitControls>` / `<GlyphcssMapControls>`
70
+
71
+ Mouse/touch/keyboard camera controls.
72
+
73
+ ### Composables
74
+
75
+ - `useGlyphcssCamera()` — access the camera context
76
+ - `useGlyphcssSceneContext()` — access scene state
77
+ - `useGlyphcssAnimation(clips, controller)` — three.js-style animation mixer
78
+
79
+ ## License
80
+
81
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var U=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ce=Object.prototype.hasOwnProperty;var ie=(e,a)=>{for(var c in a)U(e,c,{get:a[c],enumerable:!0})},pe=(e,a,c,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of ae(a))!ce.call(e,o)&&o!==c&&U(e,o,{get:()=>a[o],enumerable:!(r=le(a,o))||r.enumerable});return e};var ue=e=>pe(U({},"__esModule",{value:!0}),e);var he={};ie(he,{BASE_TILE:()=>t.BASE_TILE,CAMERA_BACKFACE_CULL_EPS:()=>t.CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE:()=>t.DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION:()=>t.DEFAULT_PROJECTION,GlyphcssAxesHelper:()=>X,GlyphcssCamera:()=>M,GlyphcssCameraContextKey:()=>w,GlyphcssDirectionalLightHelper:()=>Y,GlyphcssFirstPersonControls:()=>K,GlyphcssHotspot:()=>j,GlyphcssMapControls:()=>z,GlyphcssMesh:()=>k,GlyphcssOrbitControls:()=>N,GlyphcssOrthographicCamera:()=>E,GlyphcssPerspectiveCamera:()=>M,GlyphcssScene:()=>V,GlyphcssSceneContextKey:()=>p,LoopOnce:()=>t.LoopOnce,LoopPingPong:()=>t.LoopPingPong,LoopRepeat:()=>t.LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS:()=>t.VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT:()=>t.VOXEL_CAMERA_CULL_NORMAL_LIMIT,arrowPolygons:()=>t.arrowPolygons,axesHelperPolygons:()=>t.axesHelperPolygons,bakeSolidTextureSampledPolygons:()=>t.bakeSolidTextureSampledPolygons,bakeSolidTextureSamples:()=>t.bakeSolidTextureSamples,buildSceneContext:()=>t.buildSceneContext,cameraCullNormalGroups:()=>t.cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons:()=>t.cameraCullNormalGroupsFromPolygons,cameraCullNormalKey:()=>t.cameraCullNormalKey,cameraCullVisibleSignature:()=>t.cameraCullVisibleSignature,cameraFacingDepth:()=>t.cameraFacingDepth,clampChannel:()=>t.clampChannel,computeSceneBbox:()=>t.computeSceneBbox,computeShapeLighting:()=>t.computeShapeLighting,coverPlanarPolygons:()=>t.coverPlanarPolygons,createGlyphcssAnimationMixer:()=>t.createGlyphcssAnimationMixer,createIsometricCamera:()=>t.createIsometricCamera,cullInteriorPolygons:()=>t.cullInteriorPolygons,formatColor:()=>t.formatColor,injectGlyphcssBaseStyles:()=>_.injectGlyphcssBaseStyles,inverseRotateVec3:()=>t.inverseRotateVec3,isAxisAlignedSurfaceNormal:()=>t.isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups:()=>t.isVoxelCameraCullableNormalGroups,loadMesh:()=>t.loadMesh,mergePolygons:()=>t.mergePolygons,normalFacesCamera:()=>t.normalFacesCamera,normalizeInvertMultiplier:()=>t.normalizeInvertMultiplier,normalizePolygons:()=>t.normalizePolygons,octahedronPolygons:()=>t.octahedronPolygons,optimizeMeshPolygons:()=>t.optimizeMeshPolygons,parseColor:()=>t.parseColor,parseGltf:()=>t.parseGltf,parseHexColor:()=>t.parseHexColor,parseMtl:()=>t.parseMtl,parseObj:()=>t.parseObj,parsePureColor:()=>t.parsePureColor,parseRgbColor:()=>t.parseRgbColor,parseVox:()=>t.parseVox,polygonCssSurfaceNormal:()=>t.polygonCssSurfaceNormal,polygonFaces:()=>t.polygonFaces,polygonFacesCamera:()=>t.polygonFacesCamera,ringPolygons:()=>t.ringPolygons,rotateVec3:()=>t.rotateVec3,shadeColor:()=>t.shadeColor,useGlyphcssAnimation:()=>D,useGlyphcssCamera:()=>F,useGlyphcssSceneContext:()=>B});module.exports=ue(he);var t=require("@glyphcss/core");var u=require("vue"),H=require("glyphcss");var p=Symbol("glyphcss-scene");var V=(0,u.defineComponent)({name:"GlyphcssScene",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},class:{type:String,default:void 0}},setup(e,{slots:a,attrs:c}){let r=(0,u.shallowRef)(null),o=(0,u.shallowRef)(null);return(0,u.provide)(p,{sceneRef:o}),(0,u.onMounted)(()=>{let n=r.value;if(!n)return;(0,H.injectGlyphcssBaseStyles)(n.ownerDocument??void 0);let s={};e.mode!==void 0&&(s.mode=e.mode),e.glyphPalette!==void 0&&(s.glyphPalette=e.glyphPalette),e.useColors!==void 0&&(s.useColors=e.useColors),e.cols!==void 0&&(s.cols=e.cols),e.rows!==void 0&&(s.rows=e.rows),e.cellAspect!==void 0&&(s.cellAspect=e.cellAspect),e.directionalLight!==void 0&&(s.directionalLight=e.directionalLight),e.ambientLight!==void 0&&(s.ambientLight=e.ambientLight),o.value=(0,H.createGlyphcssScene)(n,s)}),(0,u.onBeforeUnmount)(()=>{o.value?.destroy(),o.value=null}),(0,u.watch)(()=>({mode:e.mode,glyphPalette:e.glyphPalette,useColors:e.useColors,cols:e.cols,rows:e.rows,cellAspect:e.cellAspect,directionalLight:e.directionalLight,ambientLight:e.ambientLight}),n=>{let s=o.value;if(!s)return;let l={};n.mode!==void 0&&(l.mode=n.mode),n.glyphPalette!==void 0&&(l.glyphPalette=n.glyphPalette),n.useColors!==void 0&&(l.useColors=n.useColors),n.cols!==void 0&&(l.cols=n.cols),n.rows!==void 0&&(l.rows=n.rows),n.cellAspect!==void 0&&(l.cellAspect=n.cellAspect),n.directionalLight!==void 0&&(l.directionalLight=n.directionalLight),n.ambientLight!==void 0&&(l.ambientLight=n.ambientLight),Object.keys(l).length>0&&s.setOptions(l)},{deep:!1}),()=>{let n=`glyphcss-host${e.class?` ${e.class}`:""}`;return(0,u.h)("div",{ref:r,class:n,...Object.fromEntries(Object.entries(c).filter(([s])=>s!=="class"))},a.default?.())}}});var m=require("vue");var k=(0,m.defineComponent)({name:"GlyphcssMesh",props:{id:{type:String,default:void 0},triangles:{type:Array,default:()=>[]},position:{type:Array,default:void 0},scale:{type:[Number,Array],default:void 0},rotation:{type:Array,default:void 0},class:{type:String,default:void 0}},setup(e,{slots:a}){let c=(0,m.inject)(p);if(!c)throw new Error("glyphcss: GlyphcssMesh must be used inside a GlyphcssScene.");let{sceneRef:r}=c,o=(0,m.shallowRef)(null);function n(){let i={};return e.position&&(i.position=e.position),e.scale!==void 0&&(i.scale=e.scale),e.rotation&&(i.rotation=e.rotation),i}function s(){let i=r.value;if(!i)return;let A=i.add(e.triangles??[],n());o.value=A}function l(){o.value?.dispose(),o.value=null}return(0,m.onMounted)(s),(0,m.onBeforeUnmount)(l),(0,m.watch)(()=>e.triangles,()=>{l(),s()}),(0,m.watch)(()=>({position:e.position,scale:e.scale,rotation:e.rotation}),()=>{let i=o.value;i&&(i.setTransform(n()),r.value?.rerender())},{deep:!1}),()=>{let i=`glyphcss-mesh${e.class?` ${e.class}`:""}`;return(0,m.h)("div",{"data-glyphcss-mesh-id":e.id,class:i},a.default?.())}}});var d=require("vue");var j=(0,d.defineComponent)({name:"GlyphcssHotspot",props:{id:{type:String,required:!0},at:{type:Array,required:!0},size:{type:Array,default:void 0}},emits:["click"],setup(e,{emit:a}){let c=(0,d.inject)(p);if(!c)throw new Error("glyphcss: GlyphcssHotspot must be used inside a GlyphcssScene.");let{sceneRef:r}=c,o=(0,d.shallowRef)(null);function n(){let l=r.value;if(!l)return;let i=l.addHotspot({id:e.id,at:e.at,size:e.size},()=>a("click"));o.value=i}function s(){o.value?.remove(),o.value=null}return(0,d.onMounted)(n),(0,d.onBeforeUnmount)(s),(0,d.watch)(()=>({id:e.id,at:e.at,size:e.size}),()=>{s(),n()},{deep:!1}),()=>null}});var q=require("vue");function B(){let e=(0,q.inject)(p);if(!e)throw new Error("glyphcss: must be used inside a GlyphcssScene.");return e}var G=require("vue"),$=require("glyphcss");var w=Symbol("glyphcss-camera");var M=(0,G.defineComponent)({name:"GlyphcssPerspectiveCamera",props:{rotX:{type:Number,default:void 0},rotY:{type:Number,default:void 0},distance:{type:Number,default:void 0},scale:{type:Number,default:void 0},stretch:{type:Number,default:void 0},center:{type:Array,default:void 0}},setup(e,{slots:a}){let c=(0,G.inject)(p);if(!c)throw new Error("glyphcss: GlyphcssPerspectiveCamera must be used inside a GlyphcssScene.");let{sceneRef:r}=c,o=(0,G.shallowRef)(null);function n(){r.value?.rerender()}return(0,G.provide)(w,{cameraRef:o,rerender:n}),(0,G.onMounted)(()=>{let s={};e.rotX!==void 0&&(s.rotX=e.rotX),e.rotY!==void 0&&(s.rotY=e.rotY),e.distance!==void 0&&(s.distance=e.distance),e.scale!==void 0&&(s.scale=e.scale),e.stretch!==void 0&&(s.stretch=e.stretch),e.center!==void 0&&(s.center=e.center);let l=(0,$.createGlyphcssPerspectiveCamera)(s);o.value=l;let i=r.value;i&&(i.setOptions({camera:l}),i.rerender())}),(0,G.watch)(()=>({rotX:e.rotX,rotY:e.rotY,distance:e.distance,scale:e.scale,stretch:e.stretch}),s=>{let l=o.value;if(!l)return;let i=!1;s.rotX!==void 0&&l.rotX!==s.rotX&&(l.rotX=s.rotX,i=!0),s.rotY!==void 0&&l.rotY!==s.rotY&&(l.rotY=s.rotY,i=!0),s.distance!==void 0&&l.distance!==s.distance&&(l.distance=s.distance,i=!0),s.scale!==void 0&&l.scale!==s.scale&&(l.scale=s.scale,i=!0),s.stretch!==void 0&&l.stretch!==s.stretch&&(l.stretch=s.stretch,i=!0),i&&r.value?.rerender()}),()=>a.default?.()??null}});var C=require("vue"),J=require("glyphcss");var E=(0,C.defineComponent)({name:"GlyphcssOrthographicCamera",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}},setup(e,{slots:a}){let c=(0,C.inject)(p);if(!c)throw new Error("glyphcss: GlyphcssOrthographicCamera must be used inside a GlyphcssScene.");let{sceneRef:r}=c,o=(0,C.shallowRef)(null);function n(){r.value?.rerender()}return(0,C.provide)(w,{cameraRef:o,rerender:n}),(0,C.onMounted)(()=>{let s={};e.rotX!==void 0&&(s.rotX=e.rotX),e.rotY!==void 0&&(s.rotY=e.rotY),e.zoom!==void 0&&(s.zoom=e.zoom),e.center!==void 0&&(s.center=e.center);let l=(0,J.createGlyphcssOrthographicCamera)(s);o.value=l;let i=r.value;i&&(i.setOptions({camera:l}),i.rerender())}),(0,C.watch)(()=>({rotX:e.rotX,rotY:e.rotY,zoom:e.zoom}),s=>{let l=o.value;if(!l)return;let i=!1;s.rotX!==void 0&&l.rotX!==s.rotX&&(l.rotX=s.rotX,i=!0),s.rotY!==void 0&&l.rotY!==s.rotY&&(l.rotY=s.rotY,i=!0),s.zoom!==void 0&&l.scale!==s.zoom&&(l.scale=s.zoom,i=!0),i&&r.value?.rerender()}),()=>a.default?.()??null}});var W=require("vue");function F(){let e=(0,W.inject)(w);if(!e)throw new Error("glyphcss: useGlyphcssCamera must be used inside a GlyphcssCamera component.");return e}var g=require("vue"),Q=require("glyphcss");var N=(0,g.defineComponent)({name:"GlyphcssOrbitControls",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 a=(0,g.inject)(p);if(!a)throw new Error("glyphcss: GlyphcssOrbitControls must be used inside a GlyphcssScene.");let{sceneRef:c}=a,r=(0,g.shallowRef)(null);return(0,g.onMounted)(()=>{let o=c.value;if(!o)return;let n={drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate===!1?!1:e.animate};r.value=(0,Q.createGlyphcssOrbitControls)(o,n)}),(0,g.onBeforeUnmount)(()=>{r.value?.destroy(),r.value=null}),(0,g.watch)(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate}),o=>{r.value?.update({drag:o.drag,wheel:o.wheel,invert:o.invert,animate:o.animate===!1?!1:o.animate})}),()=>null}});var v=require("vue"),Z=require("glyphcss");var z=(0,v.defineComponent)({name:"GlyphcssMapControls",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 a=(0,v.inject)(p);if(!a)throw new Error("glyphcss: GlyphcssMapControls must be used inside a GlyphcssScene.");let{sceneRef:c}=a,r=(0,v.shallowRef)(null);return(0,v.onMounted)(()=>{let o=c.value;if(!o)return;let n={drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate===!1?!1:e.animate};r.value=(0,Z.createGlyphcssMapControls)(o,n)}),(0,v.onBeforeUnmount)(()=>{r.value?.destroy(),r.value=null}),(0,v.watch)(()=>({drag:e.drag,wheel:e.wheel,invert:e.invert,animate:e.animate}),o=>{r.value?.update({drag:o.drag,wheel:o.wheel,invert:o.invert,animate:o.animate===!1?!1:o.animate})}),()=>null}});var b=require("vue"),ee=require("glyphcss");var K=(0,b.defineComponent)({name:"GlyphcssFirstPersonControls",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 a=(0,b.inject)(p);if(!a)throw new Error("glyphcss: GlyphcssFirstPersonControls must be used inside a GlyphcssScene.");let{sceneRef:c}=a,r=(0,b.shallowRef)(null);return(0,b.onMounted)(()=>{let o=c.value;if(!o)return;let n={drag:e.drag,keyboard:e.keyboard,moveSpeed:e.moveSpeed,lookSpeed:e.lookSpeed,invert:e.invert};r.value=(0,ee.createGlyphcssFirstPersonControls)(o,n)}),(0,b.onBeforeUnmount)(()=>{r.value?.destroy(),r.value=null}),(0,b.watch)(()=>({drag:e.drag,keyboard:e.keyboard,moveSpeed:e.moveSpeed,lookSpeed:e.lookSpeed,invert:e.invert}),o=>{r.value?.update(o)}),()=>null}});var h=require("vue");function me(e){let a=e,c=a*.05,r=[];function o(n,s,l){let i=[n[0]-c,n[1]-c,n[2]],A=[s[0]-c,s[1]-c,s[2]],S=[s[0]+c,s[1]+c,s[2]],O=[n[0]+c,n[1]+c,n[2]];r.push({vertices:[i,A,S],color:l}),r.push({vertices:[i,S,O],color:l})}return o([0,0,0],[a,0,0],"#ff0000"),o([0,0,0],[0,a,0],"#00ff00"),o([0,0,0],[0,0,a],"#0000ff"),r}var X=(0,h.defineComponent)({name:"GlyphcssAxesHelper",props:{size:{type:Number,default:1}},setup(e){let a=(0,h.inject)(p);if(!a)throw new Error("glyphcss: GlyphcssAxesHelper must be used inside a GlyphcssScene.");let{sceneRef:c}=a,r=(0,h.shallowRef)(null),o=(0,h.computed)(()=>me(e.size??1));function n(){let s=c.value;s&&(r.value=s.add(o.value))}return(0,h.onMounted)(n),(0,h.onBeforeUnmount)(()=>{r.value?.dispose(),r.value=null}),(0,h.watch)(o,()=>{r.value?.dispose(),r.value=null,n()}),()=>null}});var f=require("vue");function ye(e,a,c){let[r,o,n]=e,s=c,l=[r,o,n+s],i=[r,o,n-s],A=[r+s,o,n],S=[r-s,o,n],O=[r,o+s,n],T=[r,o-s,n];return[{vertices:[l,A,O],color:a},{vertices:[l,O,S],color:a},{vertices:[l,S,T],color:a},{vertices:[l,T,A],color:a},{vertices:[i,O,A],color:a},{vertices:[i,S,O],color:a},{vertices:[i,T,S],color:a},{vertices:[i,A,T],color:a}]}var Y=(0,f.defineComponent)({name:"GlyphcssDirectionalLightHelper",props:{position:{type:Array,default:()=>[1,1,1]},color:{type:String,default:"#ffff00"},size:{type:Number,default:.1}},setup(e){let a=(0,f.inject)(p);if(!a)throw new Error("glyphcss: GlyphcssDirectionalLightHelper must be used inside a GlyphcssScene.");let{sceneRef:c}=a,r=(0,f.shallowRef)(null),o=(0,f.computed)(()=>ye(e.position??[1,1,1],e.color??"#ffff00",e.size??.1));function n(){let s=c.value;s&&(r.value=s.add(o.value))}return(0,f.onMounted)(n),(0,f.onBeforeUnmount)(()=>{r.value?.dispose(),r.value=null}),(0,f.watch)(o,()=>{r.value?.dispose(),r.value=null,n()}),()=>null}});var _=require("glyphcss");var x=require("vue"),te=require("@glyphcss/core");function L(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function D(e,a,c){let r=(0,x.ref)(null),o=null,n=null,s=null,l=(0,x.ref)(0);function i(){return c==null?r.value:L(c)??r.value}function A(){n!==null&&(cancelAnimationFrame(n),n=null),s=null}function S(){A(),o&&(o.stopAllAction(),o.uncacheRoot(),o=null,l.value++)}function O(){if(n!==null)return;function y(P){if(s===null){s=P,n=requestAnimationFrame(y);return}let R=(P-s)/1e3;s=P,o?.update(R),n=requestAnimationFrame(y)}n=requestAnimationFrame(y)}function T(){S();let y=L(e),P=L(a);if(!y||y.length===0||!P)return;let R=i();R&&(o=(0,te.createGlyphcssAnimationMixer)(R,P),l.value++,O())}let se=(0,x.watch)(()=>{let y=L(e),P=L(a),R=c!=null?L(c):r.value;return{c:y,ctrl:P,r:R}},()=>T(),{immediate:!0,deep:!1});(0,x.onUnmounted)(()=>{se(),S()});let I=(0,x.computed)(()=>L(e)??[]),oe=(0,x.computed)(()=>I.value.map(y=>y.name)),ne=(0,x.computed)(()=>(l.value,o)),re=(0,x.computed)(()=>{l.value;let y=I.value,P={};for(let R of y)Object.defineProperty(P,R.name,{enumerable:!0,get(){if(!o)return null;try{return o.clipAction(R.name)}catch{return null}}});return P});return{ref:r,mixer:ne,clips:I,names:oe,actions:re}}0&&(module.exports={BASE_TILE,CAMERA_BACKFACE_CULL_EPS,DEFAULT_CAMERA_STATE,DEFAULT_PROJECTION,GlyphcssAxesHelper,GlyphcssCamera,GlyphcssCameraContextKey,GlyphcssDirectionalLightHelper,GlyphcssFirstPersonControls,GlyphcssHotspot,GlyphcssMapControls,GlyphcssMesh,GlyphcssOrbitControls,GlyphcssOrthographicCamera,GlyphcssPerspectiveCamera,GlyphcssScene,GlyphcssSceneContextKey,LoopOnce,LoopPingPong,LoopRepeat,VOXEL_CAMERA_CULL_AXIS_EPS,VOXEL_CAMERA_CULL_NORMAL_LIMIT,arrowPolygons,axesHelperPolygons,bakeSolidTextureSampledPolygons,bakeSolidTextureSamples,buildSceneContext,cameraCullNormalGroups,cameraCullNormalGroupsFromPolygons,cameraCullNormalKey,cameraCullVisibleSignature,cameraFacingDepth,clampChannel,computeSceneBbox,computeShapeLighting,coverPlanarPolygons,createGlyphcssAnimationMixer,createIsometricCamera,cullInteriorPolygons,formatColor,injectGlyphcssBaseStyles,inverseRotateVec3,isAxisAlignedSurfaceNormal,isVoxelCameraCullableNormalGroups,loadMesh,mergePolygons,normalFacesCamera,normalizeInvertMultiplier,normalizePolygons,octahedronPolygons,optimizeMeshPolygons,parseColor,parseGltf,parseHexColor,parseMtl,parseObj,parsePureColor,parseRgbColor,parseVox,polygonCssSurfaceNormal,polygonFaces,polygonFacesCamera,ringPolygons,rotateVec3,shadeColor,useGlyphcssAnimation,useGlyphcssCamera,useGlyphcssSceneContext});