@tresjs/leches 0.2.0 → 0.3.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.
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * name: @tresjs/leches
3
- * version: v0.2.0
3
+ * version: v0.3.1
4
4
  * (c) 2023
5
5
  * description: Tasty GUI for Vue controls 🍰
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- (function(z,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],n):(z=typeof globalThis<"u"?globalThis:z||self,n(z.tresleches={},z.Vue,z.VueUseCore))})(this,function(z,n,b){"use strict";const Qt="",Zt="";function $(i){return n.getCurrentScope()?(n.onScopeDispose(i),!0):!1}function C(i){return typeof i=="function"?i():n.unref(i)}const T=typeof window<"u",I=()=>{},A=Y();function Y(){var i;return T&&((i=window==null?void 0:window.navigator)==null?void 0:i.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function O(...i){if(i.length!==1)return n.toRef(...i);const t=i[0];return typeof t=="function"?n.readonly(n.customRef(()=>({get:t,set:I}))):n.ref(t)}function H(i){var t;const e=C(i);return(t=e==null?void 0:e.$el)!=null?t:e}const Q=T?window:void 0;function Z(...i){let t,e,s,o;if(typeof i[0]=="string"||Array.isArray(i[0])?([e,s,o]=i,t=Q):[t,e,s,o]=i,!t)return I;Array.isArray(e)||(e=[e]),Array.isArray(s)||(s=[s]);const r=[],l=()=>{r.forEach(c=>c()),r.length=0},h=(c,a,d,u)=>(c.addEventListener(a,d,u),()=>c.removeEventListener(a,d,u)),x=n.watch(()=>[H(t),C(o)],([c,a])=>{l(),c&&r.push(...e.flatMap(d=>s.map(u=>h(c,d,u,a))))},{immediate:!0,flush:"post"}),y=()=>{x(),l()};return $(y),y}var W=Object.defineProperty,U=Object.defineProperties,K=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,q=(i,t,e)=>t in i?W(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,v=(i,t)=>{for(var e in t||(t={}))G.call(t,e)&&q(i,e,t[e]);if(D)for(var e of D(t))J.call(t,e)&&q(i,e,t[e]);return i},tt=(i,t)=>U(i,K(t));const et=n.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis"],setup(i,{slots:t}){const e=n.ref(),s=n.computed(()=>{var x;return(x=i.handle)!=null?x:e.value}),o=i.storageKey&&b.useStorage(i.storageKey,C(i.initialValue)||{x:0,y:0},b.isClient?i.storageType==="session"?sessionStorage:localStorage:void 0),r=o||i.initialValue||{x:0,y:0},l=x=>{o&&(o.value.x=x.x,o.value.y=x.y)},h=n.reactive(b.useDraggable(e,tt(v({},i),{handle:s,initialValue:r,onEnd:l})));return()=>{if(t.default)return n.h(i.as||"div",{ref:e,style:`touch-action:none;${h.style}`},t.default(h))}}});function j(i){const t=window.getComputedStyle(i);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&i.clientHeight<i.scrollHeight||t.overflowY==="auto"&&i.clientWidth<i.scrollWidth)return!0;{const e=i.parentNode;return!e||e.tagName==="BODY"?!1:j(e)}}function nt(i){const t=i||window.event,e=t.target;return j(e)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}function st(i,t=!1){const e=n.ref(t);let s=null,o;n.watch(O(i),h=>{if(h){const x=h;o=x.style.overflow,e.value&&(x.style.overflow="hidden")}},{immediate:!0});const r=()=>{const h=C(i);!h||e.value||(A&&(s=Z(h,"touchmove",x=>{nt(x)},{passive:!1})),h.style.overflow="hidden",e.value=!0)},l=()=>{const h=C(i);!h||!e.value||(A&&(s==null||s()),h.style.overflow=o,e.value=!1)};return $(l),n.computed({get(){return e.value},set(h){h?r():l()}})}function it(){let i=!1;const t=n.ref(!1);return(e,s)=>{if(t.value=s.value,i)return;i=!0;const o=st(e,s.value);n.watch(t,r=>o.value=r)}}it();const ot=Symbol("CONTROLS_CONTEXT_KEY"),E=n.reactive({controls:[]});function rt(){return E}function V(i){return Object.entries(i).map(([t,e])=>!n.isRef(e)&&e.value?{...e,label:e.label||t,value:e.value,type:typeof e.value.value,visible:!0}:{label:e.label||t,value:e,type:n.isRef(e)?typeof e.value:typeof e,visible:!0})}function lt(i,t){const e=n.inject(ot,{});let s=[];if(typeof i=="string")s.push({label:i,visible:!0,type:"folder",controls:V(t)});else if(n.isReactive(i)){const o=n.toRefs(i);s=V(o)}else s=V(i);return E.controls=[...E.controls,...s],e}/**
8
+ (function(b,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],n):(b=typeof globalThis<"u"?globalThis:b||self,n(b.tresleches={},b.Vue,b.VueUseCore))})(this,function(b,n,z){"use strict";const ie="",oe="";function A(r){return n.getCurrentScope()?(n.onScopeDispose(r),!0):!1}function k(r){return typeof r=="function"?r():n.unref(r)}const T=typeof window<"u",D=()=>{},j=U();function U(){var r;return T&&((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function K(...r){if(r.length!==1)return n.toRef(...r);const t=r[0];return typeof t=="function"?n.readonly(n.customRef(()=>({get:t,set:D}))):n.ref(t)}function G(r){var t;const e=k(r);return(t=e==null?void 0:e.$el)!=null?t:e}const J=T?window:void 0;function O(...r){let t,e,s,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([e,s,i]=r,t=J):[t,e,s,i]=r,!t)return D;Array.isArray(e)||(e=[e]),Array.isArray(s)||(s=[s]);const o=[],h=()=>{o.forEach(l=>l()),o.length=0},c=(l,a,_,u)=>(l.addEventListener(a,_,u),()=>l.removeEventListener(a,_,u)),d=n.watch(()=>[G(t),k(i)],([l,a])=>{h(),l&&o.push(...e.flatMap(_=>s.map(u=>c(l,_,u,a))))},{immediate:!0,flush:"post"}),y=()=>{d(),h()};return A(y),y}var v=Object.defineProperty,tt=Object.defineProperties,et=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,P=(r,t,e)=>t in r?v(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,it=(r,t)=>{for(var e in t||(t={}))st.call(t,e)&&P(r,e,t[e]);if(q)for(var e of q(t))nt.call(t,e)&&P(r,e,t[e]);return r},ot=(r,t)=>tt(r,et(t));const rt=n.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd"],setup(r,{slots:t}){const e=n.ref(),s=n.computed(()=>{var d;return(d=r.handle)!=null?d:e.value}),i=r.storageKey&&z.useStorage(r.storageKey,k(r.initialValue)||{x:0,y:0},z.isClient?r.storageType==="session"?sessionStorage:localStorage:void 0),o=i||r.initialValue||{x:0,y:0},h=(d,y)=>{var l;(l=r.onEnd)==null||l.call(r,d,y),i&&(i.value.x=d.x,i.value.y=d.y)},c=n.reactive(z.useDraggable(e,ot(it({},r),{handle:s,initialValue:o,onEnd:h})));return()=>{if(t.default)return n.h(r.as||"div",{ref:e,style:`touch-action:none;${c.style}`},t.default(c))}}});function L(r){const t=window.getComputedStyle(r);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&r.clientWidth<r.scrollWidth||t.overflowY==="auto"&&r.clientHeight<r.scrollHeight)return!0;{const e=r.parentNode;return!e||e.tagName==="BODY"?!1:L(e)}}function at(r){const t=r||window.event,e=t.target;return L(e)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}function lt(r,t=!1){const e=n.ref(t);let s=null,i;n.watch(K(r),c=>{if(c){const d=c;i=d.style.overflow,e.value&&(d.style.overflow="hidden")}},{immediate:!0});const o=()=>{const c=k(r);!c||e.value||(j&&(s=O(c,"touchmove",d=>{at(d)},{passive:!1})),c.style.overflow="hidden",e.value=!0)},h=()=>{const c=k(r);!c||!e.value||(j&&(s==null||s()),c.style.overflow=i,e.value=!1)};return A(h),n.computed({get(){return e.value},set(c){c?o():h()}})}function ht(){let r=!1;const t=n.ref(!1);return(e,s)=>{if(t.value=s.value,r)return;r=!0;const i=lt(e,s.value);n.watch(t,o=>i.value=o)}}ht();/**
9
9
  * @license
10
10
  * Copyright 2010-2023 Three.js Authors
11
11
  * SPDX-License-Identifier: MIT
12
- */const P="152";function B(i,t,e){return Math.max(t,Math.min(e,i))}class k{constructor(t=0,e=0){k.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,s=this.y,o=t.elements;return this.x=o[0]*e+o[3]*s+o[6],this.y=o[1]*e+o[4]*s+o[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(B(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const s=Math.cos(e),o=Math.sin(e),r=this.x-t.x,l=this.y-t.y;return this.x=r*s-l*o+t.x,this.y=r*o+l*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ht{constructor(t=0,e=0,s=0,o=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=s,this._w=o}static slerpFlat(t,e,s,o,r,l,h){let x=s[o+0],y=s[o+1],c=s[o+2],a=s[o+3];const d=r[l+0],u=r[l+1],_=r[l+2],f=r[l+3];if(h===0){t[e+0]=x,t[e+1]=y,t[e+2]=c,t[e+3]=a;return}if(h===1){t[e+0]=d,t[e+1]=u,t[e+2]=_,t[e+3]=f;return}if(a!==f||x!==d||y!==u||c!==_){let p=1-h;const m=x*d+y*u+c*_+a*f,g=m>=0?1:-1,X=1-m*m;if(X>Number.EPSILON){const M=Math.sqrt(X),R=Math.atan2(M,m*g);p=Math.sin(p*R)/M,h=Math.sin(h*R)/M}const S=h*g;if(x=x*p+d*S,y=y*p+u*S,c=c*p+_*S,a=a*p+f*S,p===1-h){const M=1/Math.sqrt(x*x+y*y+c*c+a*a);x*=M,y*=M,c*=M,a*=M}}t[e]=x,t[e+1]=y,t[e+2]=c,t[e+3]=a}static multiplyQuaternionsFlat(t,e,s,o,r,l){const h=s[o],x=s[o+1],y=s[o+2],c=s[o+3],a=r[l],d=r[l+1],u=r[l+2],_=r[l+3];return t[e]=h*_+c*a+x*u-y*d,t[e+1]=x*_+c*d+y*a-h*u,t[e+2]=y*_+c*u+h*d-x*a,t[e+3]=c*_-h*a-x*d-y*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,o){return this._x=t,this._y=e,this._z=s,this._w=o,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const s=t._x,o=t._y,r=t._z,l=t._order,h=Math.cos,x=Math.sin,y=h(s/2),c=h(o/2),a=h(r/2),d=x(s/2),u=x(o/2),_=x(r/2);switch(l){case"XYZ":this._x=d*c*a+y*u*_,this._y=y*u*a-d*c*_,this._z=y*c*_+d*u*a,this._w=y*c*a-d*u*_;break;case"YXZ":this._x=d*c*a+y*u*_,this._y=y*u*a-d*c*_,this._z=y*c*_-d*u*a,this._w=y*c*a+d*u*_;break;case"ZXY":this._x=d*c*a-y*u*_,this._y=y*u*a+d*c*_,this._z=y*c*_+d*u*a,this._w=y*c*a-d*u*_;break;case"ZYX":this._x=d*c*a-y*u*_,this._y=y*u*a+d*c*_,this._z=y*c*_-d*u*a,this._w=y*c*a+d*u*_;break;case"YZX":this._x=d*c*a+y*u*_,this._y=y*u*a+d*c*_,this._z=y*c*_-d*u*a,this._w=y*c*a-d*u*_;break;case"XZY":this._x=d*c*a-y*u*_,this._y=y*u*a-d*c*_,this._z=y*c*_+d*u*a,this._w=y*c*a+d*u*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+l)}return e!==!1&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,o=Math.sin(s);return this._x=t.x*o,this._y=t.y*o,this._z=t.z*o,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],o=e[4],r=e[8],l=e[1],h=e[5],x=e[9],y=e[2],c=e[6],a=e[10],d=s+h+a;if(d>0){const u=.5/Math.sqrt(d+1);this._w=.25/u,this._x=(c-x)*u,this._y=(r-y)*u,this._z=(l-o)*u}else if(s>h&&s>a){const u=2*Math.sqrt(1+s-h-a);this._w=(c-x)/u,this._x=.25*u,this._y=(o+l)/u,this._z=(r+y)/u}else if(h>a){const u=2*Math.sqrt(1+h-s-a);this._w=(r-y)/u,this._x=(o+l)/u,this._y=.25*u,this._z=(x+c)/u}else{const u=2*Math.sqrt(1+a-s-h);this._w=(l-o)/u,this._x=(r+y)/u,this._y=(x+c)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(B(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const o=Math.min(1,e/s);return this.slerp(t,o),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,o=t._y,r=t._z,l=t._w,h=e._x,x=e._y,y=e._z,c=e._w;return this._x=s*c+l*h+o*y-r*x,this._y=o*c+l*x+r*h-s*y,this._z=r*c+l*y+s*x-o*h,this._w=l*c-s*h-o*x-r*y,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,o=this._y,r=this._z,l=this._w;let h=l*t._w+s*t._x+o*t._y+r*t._z;if(h<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,h=-h):this.copy(t),h>=1)return this._w=l,this._x=s,this._y=o,this._z=r,this;const x=1-h*h;if(x<=Number.EPSILON){const u=1-e;return this._w=u*l+e*this._w,this._x=u*s+e*this._x,this._y=u*o+e*this._y,this._z=u*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const y=Math.sqrt(x),c=Math.atan2(y,h),a=Math.sin((1-e)*c)/y,d=Math.sin(e*c)/y;return this._w=l*a+this._w*d,this._x=s*a+this._x*d,this._y=o*a+this._y*d,this._z=r*a+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=Math.random(),e=Math.sqrt(1-t),s=Math.sqrt(t),o=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(o),s*Math.sin(r),s*Math.cos(r),e*Math.sin(o))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class w{constructor(t=0,e=0,s=0){w.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(L.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(L.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,o=this.z,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6]*o,this.y=r[1]*e+r[4]*s+r[7]*o,this.z=r[2]*e+r[5]*s+r[8]*o,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,o=this.z,r=t.elements,l=1/(r[3]*e+r[7]*s+r[11]*o+r[15]);return this.x=(r[0]*e+r[4]*s+r[8]*o+r[12])*l,this.y=(r[1]*e+r[5]*s+r[9]*o+r[13])*l,this.z=(r[2]*e+r[6]*s+r[10]*o+r[14])*l,this}applyQuaternion(t){const e=this.x,s=this.y,o=this.z,r=t.x,l=t.y,h=t.z,x=t.w,y=x*e+l*o-h*s,c=x*s+h*e-r*o,a=x*o+r*s-l*e,d=-r*e-l*s-h*o;return this.x=y*x+d*-r+c*-h-a*-l,this.y=c*x+d*-l+a*-r-y*-h,this.z=a*x+d*-h+y*-l-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,s=this.y,o=this.z,r=t.elements;return this.x=r[0]*e+r[4]*s+r[8]*o,this.y=r[1]*e+r[5]*s+r[9]*o,this.z=r[2]*e+r[6]*s+r[10]*o,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,o=t.y,r=t.z,l=e.x,h=e.y,x=e.z;return this.x=o*x-r*h,this.y=r*l-s*x,this.z=s*h-o*l,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return N.copy(this).projectOnVector(t),this.sub(N)}reflect(t){return this.sub(N.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(B(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,o=this.z-t.z;return e*e+s*s+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,s){const o=Math.sin(e)*t;return this.x=o*Math.sin(s),this.y=Math.cos(e)*t,this.z=o*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),o=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=o,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,s=Math.sqrt(1-t**2);return this.x=s*Math.cos(e),this.y=s*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const N=new w,L=new ht;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:P}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=P);const at={class:"flex px-4 justify-between gap-4 items-center mb-2"},ct={class:"text-gray-500 w-1/3"},ut=["value","min","max","step"],yt=n.defineComponent({__name:"NumberControl",props:{label:null,control:null},emits:["change"],setup(i,{emit:t}){const e=i;function s(c){const{target:a}=c;t("change",a.valueAsNumber)}const o=b.useMouse(),r=n.ref(0),l=n.ref(!1),h=c=>{r.value=c.clientX,l.value=!0},x=()=>{l.value=!1},y=c=>Math.floor(Math.abs(c)/10);return n.watch(o.x,c=>{if(l.value){const a=c-r.value,d=y(a);a>0?t("change",e.control.value+1+d):a<0&&t("change",e.control.value-1+d),e.control.min!==void 0&&e.control.value<e.control.min&&t("change",e.control.min),e.control.max!==void 0&&e.control.value>e.control.max&&t("change",e.control.max),r.value=c}}),(c,a)=>(n.openBlock(),n.createElementBlock("div",at,[n.createElementVNode("label",ct,n.toDisplayString(i.label),1),n.createElementVNode("input",{value:i.control.value,class:n.normalizeClass(["p-2 w-1/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":l.value}]),type:"number",min:i.control.min,max:i.control.max,step:i.control.step,onInput:s,onMousedown:h,onMouseup:x},null,42,ut)]))}}),xt={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},dt={class:"text-gray-500 w-1/3"},_t=["value"],mt=n.defineComponent({__name:"TextControl",props:{label:null,control:null},emits:["change"],setup(i,{emit:t}){function e(s){t("change",s)}return(s,o)=>(n.openBlock(),n.createElementBlock("div",xt,[n.createElementVNode("label",dt,n.toDisplayString(i.label),1),n.createElementVNode("input",{value:i.control.value,type:"string",class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",onChange:e},null,40,_t)]))}}),ft={class:"flex px-4 justify-start gap-2 items-center mb-2 min-h-32px"},pt={class:"text-gray-500 w-1/3"},gt=["id","checked"],zt=["for"],Mt={class:"i-ic:baseline-check text-light"},bt=n.defineComponent({__name:"BooleanControl",props:{label:null,control:null},emits:["change"],setup(i,{emit:t}){function e(s){const{target:o}=s;t("change",o.checked)}return(s,o)=>(n.openBlock(),n.createElementBlock("div",ft,[n.createElementVNode("label",pt,n.toDisplayString(i.label),1),n.createElementVNode("input",{id:i.control.label,checked:i.control.value,class:"hidden",type:"checkbox",onInput:e},null,40,gt),n.createElementVNode("label",{for:i.control.label,class:"inline-flex items-center cursor-pointer"},[n.createElementVNode("span",{class:n.normalizeClass([{"bg-dark-500":i.control.value,"bg-gray-200":!i.control.value},"w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"])},[n.withDirectives(n.createElementVNode("i",Mt,null,512),[[n.vShow,i.control.value]])],2)],8,zt)]))}}),wt={class:"px-4 relative flex justify-between gap-4 items-center mb-2"},Ct={class:"text-gray-500 w-1/3"},kt=["value","min","max","step"],St=["value","min","max","step"],Et=n.defineComponent({__name:"SliderControl",props:{label:null,control:null},emits:["change"],setup(i,{emit:t}){const e=i;function s(a){const{target:d}=a;t("change",d.valueAsNumber)}const o=n.computed(()=>({backgroundImage:`linear-gradient(to right, #333 0% ${100*(e.control.value-(e.control.min||0))/((e.control.max||100)-(e.control.min||0))}%, #e2e2e2 0%)`})),r=b.useMouse(),l=n.ref(0),h=n.ref(!1),x=a=>{l.value=a.clientX,h.value=!0},y=()=>{h.value=!1},c=a=>Math.floor(Math.abs(a)/10);return n.watch(r.x,a=>{if(h.value){const d=a-l.value,u=c(d);d>0?t("change",e.control.value+1+u):d<0&&t("change",e.control.value-1+u),e.control.min!==void 0&&e.control.value<e.control.min&&t("change",e.control.min),e.control.max!==void 0&&e.control.value>e.control.max&&t("change",e.control.max),l.value=a}}),(a,d)=>(n.openBlock(),n.createElementBlock("div",wt,[n.createElementVNode("label",Ct,n.toDisplayString(i.label),1),n.createElementVNode("input",{value:i.control.value,class:"w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",style:n.normalizeStyle(n.unref(o)),type:"range",min:i.control.min,max:i.control.max,step:i.control.step,onInput:s},null,44,kt),n.createElementVNode("input",{value:i.control.value,class:n.normalizeClass(["p-2 w-1/4 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":h.value}]),type:"number",min:i.control.min,max:i.control.max,step:i.control.step,onInput:s,onMousedown:x,onMouseup:y},null,42,St)]))}}),Wt="",Vt=((i,t)=>{const e=i.__vccOpts||i;for(const[s,o]of t)e[s]=o;return e})(Et,[["__scopeId","data-v-da7e8146"]]),Bt={class:"flex px-4 justify-between gap-4 items-center mb-2"},Nt={class:"text-gray-500 w-1/3"},$t=["value"],Tt=["value"],It=n.defineComponent({__name:"ColorControl",props:{label:null,control:null},emits:["change"],setup(i,{emit:t}){function e(s){const{target:o}=s;t("change",o.value)}return(s,o)=>(n.openBlock(),n.createElementBlock("div",Bt,[n.createElementVNode("label",Nt,n.toDisplayString(i.label),1),n.createElementVNode("input",{value:i.control.value,type:"color",onInput:e},null,40,$t),n.createElementVNode("input",{value:i.control.value,class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",type:"text",onInput:e},null,40,Tt)]))}}),Kt="";function At(i){return typeof i=="number"?[i,i,i]:i instanceof w?[i.x,i.y,i.z]:i}const Dt={class:"flex px-4 justify-between gap-2 items-center mb-2"},qt={class:"text-gray-500 w-1/3"},jt={class:"w-2/3 flex justify-between gap-1"},Pt={key:0,class:"font-bold px-0.5 py-1 text-0.65rem text-gray-300"},Lt=["value","onInput","onMousedown","onMouseup"],Ft=n.defineComponent({__name:"VectorControl",props:{label:null,control:null},emits:["change"],setup(i,{emit:t}){const e=i,s=b.useMouse(),o=n.ref(0),r=n.ref(!1),l=n.ref(0),h=(_,f)=>{l.value=f,o.value=_.clientX,r.value=!0},x=(_,f)=>{l.value=f,r.value=!1},y=_=>Math.floor(Math.abs(_)/10),c=n.computed(()=>At(e.control.value)),a=n.computed(()=>Object.keys(e.control.value)),d=n.computed(()=>e.control.value instanceof k||e.control.value instanceof w);function u(_,f){const{value:p}=e.control,{target:m}=_;l.value=f,p[d.value?a.value[l.value]:l.value]=parseInt(m.value,10),t("change",p)}return n.watch(s.x,_=>{if(r.value){const f=_-o.value,p=y(f),{value:m}=e.control,g=d.value?a.value[l.value]:l.value;f>0?m[g]+=1+p:f<0&&(m[g]-=1+p),e.control.min!==void 0&&m<e.control.min&&(m[g]=e.control.min),e.control.max!==void 0&&m>e.control.max&&(m[g]=e.control.max),t("change",m),o.value=_}}),(_,f)=>(n.openBlock(),n.createElementBlock("div",Dt,[n.createElementVNode("label",qt,n.toDisplayString(i.label),1),n.createElementVNode("div",jt,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(c),(p,m)=>(n.openBlock(),n.createElementBlock("div",{key:i.label+m,class:"flex items-center w-1/3 bg-gray-100 rounded"},[n.unref(a)[m]&&n.unref(d)?(n.openBlock(),n.createElementBlock("span",Pt,n.toDisplayString(n.unref(a)[m]),1)):n.createCommentVNode("",!0),n.createElementVNode("input",{type:"text",class:n.normalizeClass(["w-full pl-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":r.value}]),value:n.unref(c)[m].toFixed(2),onInput:g=>u(g,m),onMousedown:g=>h(g,m),onMouseup:g=>x(g,m)},null,42,Lt)]))),128))])]))}}),Xt={class:"bg-white rounded-b"},Rt=n.defineComponent({__name:"Folder",props:{control:null},setup(i){function t(o,r){r.value=o}const e=n.ref(!1),s=()=>{e.value=!e.value};return(o,r)=>(n.openBlock(),n.createElementBlock("div",null,[n.createElementVNode("button",{class:"flex items-center justify-between w-full p-4 bg-gray-100 border-none text-gray-400 font-bold text-xs focus:outline-none font-sans cursor-pointer",onClick:s},[n.createElementVNode("span",null,n.toDisplayString(i.control.label),1),n.createElementVNode("i",{class:n.normalizeClass(e.value?"i-ic:baseline-keyboard-arrow-up":"i-ic:baseline-keyboard-arrow-down")},null,2)]),n.createVNode(n.Transition,{name:"animate__animated","enter-active-class":"animate__fadeIn","leave-active-class":"animate__fadeOut"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",Xt,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.control.controls,l=>(n.openBlock(),n.createBlock(F,{key:l.label,control:l,onChange:r[0]||(r[0]=h=>t(h,i.control))},null,8,["control"]))),128))],512),[[n.vShow,e.value]])]),_:1})]))}}),F=n.defineComponent({__name:"ControlInput",props:{control:null},emits:["change"],setup(i,{emit:t}){const e=i,s=n.computed(()=>e.control.type==="number"&&(e.control.step||e.control.max||e.control.min)),o=n.computed(()=>{const h=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;return e.control.type==="color"||h.test(e.control.value)}),r=n.computed(()=>e.control.value instanceof Array||e.control.value instanceof k||e.control.value instanceof w);function l(h){t("change",h)}return(h,x)=>i.control.visible?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.unref(o)?(n.openBlock(),n.createBlock(It,{key:0,label:i.control.label,control:i.control,onChange:l},null,8,["label","control"])):n.unref(r)?(n.openBlock(),n.createBlock(Ft,{key:1,label:i.control.label,control:i.control,onChange:l},null,8,["label","control"])):i.control.type==="boolean"?(n.openBlock(),n.createBlock(bt,{key:2,label:i.control.label,control:i.control,onChange:l},null,8,["label","control"])):i.control.type==="folder"?(n.openBlock(),n.createBlock(Rt,{key:3,label:i.control.label,control:i.control},null,8,["label","control"])):n.unref(s)?n.unref(s)?(n.openBlock(),n.createBlock(Vt,{key:5,label:i.control.label,control:i.control,onChange:l},null,8,["label","control"])):(n.openBlock(),n.createBlock(mt,{key:6,label:i.control.label,control:i.control,onChange:l},null,8,["label","control"])):(n.openBlock(),n.createBlock(yt,{key:4,label:i.control.label,control:i.control,onChange:l},null,8,["label","control"]))],64)):n.createCommentVNode("",!0)}}),Yt={class:"bg-white shadow-xl rounded border-4 border-solid border-black"},Ot=[n.createElementVNode("i",{class:"h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs"},"🍰",-1),n.createElementVNode("div",null,[n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"})],-1),n.createElementVNode("div",null,null,-1)],Ht=n.defineComponent({__name:"TresLeches",setup(i){const{width:t}=b.useWindowSize(),e=280,s=n.ref(null),o=rt();function r(l,h){h.value=l}return(l,h)=>(n.openBlock(),n.createBlock(n.unref(et),{"initial-value":{x:n.unref(t)-e-20,y:10},class:"fixed select-none z-24 w-280px font-sans text-xs",handle:s.value},{default:n.withCtx(()=>[n.createElementVNode("div",Yt,[n.createElementVNode("header",{ref_key:"handle",ref:s,class:"relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"},Ot,512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(o).controls,x=>(n.openBlock(),n.createBlock(F,{key:x.label,control:x,onChange:y=>r(y,x)},null,8,["control","onChange"]))),128))])]),_:1},8,["initial-value","handle"]))}});z.TresLeches=Ht,z.useControls=lt,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
12
+ */const F="153";function V(r,t,e){return Math.max(t,Math.min(e,r))}class B{constructor(t=0,e=0){B.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(V(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const s=Math.cos(e),i=Math.sin(e),o=this.x-t.x,h=this.y-t.y;return this.x=o*s-h*i+t.x,this.y=o*i+h*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ct{constructor(t=0,e=0,s=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=s,this._w=i}static slerpFlat(t,e,s,i,o,h,c){let d=s[i+0],y=s[i+1],l=s[i+2],a=s[i+3];const _=o[h+0],u=o[h+1],p=o[h+2],m=o[h+3];if(c===0){t[e+0]=d,t[e+1]=y,t[e+2]=l,t[e+3]=a;return}if(c===1){t[e+0]=_,t[e+1]=u,t[e+2]=p,t[e+3]=m;return}if(a!==m||d!==_||y!==u||l!==p){let f=1-c;const x=d*_+y*u+l*p+a*m,g=x>=0?1:-1,W=1-x*x;if(W>Number.EPSILON){const w=Math.sqrt(W),Z=Math.atan2(w,x*g);f=Math.sin(f*Z)/w,c=Math.sin(c*Z)/w}const E=c*g;if(d=d*f+_*E,y=y*f+u*E,l=l*f+p*E,a=a*f+m*E,f===1-c){const w=1/Math.sqrt(d*d+y*y+l*l+a*a);d*=w,y*=w,l*=w,a*=w}}t[e]=d,t[e+1]=y,t[e+2]=l,t[e+3]=a}static multiplyQuaternionsFlat(t,e,s,i,o,h){const c=s[i],d=s[i+1],y=s[i+2],l=s[i+3],a=o[h],_=o[h+1],u=o[h+2],p=o[h+3];return t[e]=c*p+l*a+d*u-y*_,t[e+1]=d*p+l*_+y*a-c*u,t[e+2]=y*p+l*u+c*_-d*a,t[e+3]=l*p-c*a-d*_-y*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,i){return this._x=t,this._y=e,this._z=s,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const s=t._x,i=t._y,o=t._z,h=t._order,c=Math.cos,d=Math.sin,y=c(s/2),l=c(i/2),a=c(o/2),_=d(s/2),u=d(i/2),p=d(o/2);switch(h){case"XYZ":this._x=_*l*a+y*u*p,this._y=y*u*a-_*l*p,this._z=y*l*p+_*u*a,this._w=y*l*a-_*u*p;break;case"YXZ":this._x=_*l*a+y*u*p,this._y=y*u*a-_*l*p,this._z=y*l*p-_*u*a,this._w=y*l*a+_*u*p;break;case"ZXY":this._x=_*l*a-y*u*p,this._y=y*u*a+_*l*p,this._z=y*l*p+_*u*a,this._w=y*l*a-_*u*p;break;case"ZYX":this._x=_*l*a-y*u*p,this._y=y*u*a+_*l*p,this._z=y*l*p-_*u*a,this._w=y*l*a+_*u*p;break;case"YZX":this._x=_*l*a+y*u*p,this._y=y*u*a+_*l*p,this._z=y*l*p-_*u*a,this._w=y*l*a-_*u*p;break;case"XZY":this._x=_*l*a-y*u*p,this._y=y*u*a-_*l*p,this._z=y*l*p+_*u*a,this._w=y*l*a+_*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return e!==!1&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,i=Math.sin(s);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],i=e[4],o=e[8],h=e[1],c=e[5],d=e[9],y=e[2],l=e[6],a=e[10],_=s+c+a;if(_>0){const u=.5/Math.sqrt(_+1);this._w=.25/u,this._x=(l-d)*u,this._y=(o-y)*u,this._z=(h-i)*u}else if(s>c&&s>a){const u=2*Math.sqrt(1+s-c-a);this._w=(l-d)/u,this._x=.25*u,this._y=(i+h)/u,this._z=(o+y)/u}else if(c>a){const u=2*Math.sqrt(1+c-s-a);this._w=(o-y)/u,this._x=(i+h)/u,this._y=.25*u,this._z=(d+l)/u}else{const u=2*Math.sqrt(1+a-s-c);this._w=(h-i)/u,this._x=(o+y)/u,this._y=(d+l)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(V(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(s===0)return this;const i=Math.min(1,e/s);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,i=t._y,o=t._z,h=t._w,c=e._x,d=e._y,y=e._z,l=e._w;return this._x=s*l+h*c+i*y-o*d,this._y=i*l+h*d+o*c-s*y,this._z=o*l+h*y+s*d-i*c,this._w=h*l-s*c-i*d-o*y,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const s=this._x,i=this._y,o=this._z,h=this._w;let c=h*t._w+s*t._x+i*t._y+o*t._z;if(c<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,c=-c):this.copy(t),c>=1)return this._w=h,this._x=s,this._y=i,this._z=o,this;const d=1-c*c;if(d<=Number.EPSILON){const u=1-e;return this._w=u*h+e*this._w,this._x=u*s+e*this._x,this._y=u*i+e*this._y,this._z=u*o+e*this._z,this.normalize(),this._onChangeCallback(),this}const y=Math.sqrt(d),l=Math.atan2(y,c),a=Math.sin((1-e)*l)/y,_=Math.sin(e*l)/y;return this._w=h*a+this._w*_,this._x=s*a+this._x*_,this._y=i*a+this._y*_,this._z=o*a+this._z*_,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=Math.random(),e=Math.sqrt(1-t),s=Math.sqrt(t),i=2*Math.PI*Math.random(),o=2*Math.PI*Math.random();return this.set(e*Math.cos(i),s*Math.sin(o),s*Math.cos(o),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class M{constructor(t=0,e=0,s=0){M.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return s===void 0&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(R.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(R.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,i=this.z,o=t.elements;return this.x=o[0]*e+o[3]*s+o[6]*i,this.y=o[1]*e+o[4]*s+o[7]*i,this.z=o[2]*e+o[5]*s+o[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,o=t.elements,h=1/(o[3]*e+o[7]*s+o[11]*i+o[15]);return this.x=(o[0]*e+o[4]*s+o[8]*i+o[12])*h,this.y=(o[1]*e+o[5]*s+o[9]*i+o[13])*h,this.z=(o[2]*e+o[6]*s+o[10]*i+o[14])*h,this}applyQuaternion(t){const e=this.x,s=this.y,i=this.z,o=t.x,h=t.y,c=t.z,d=t.w,y=d*e+h*i-c*s,l=d*s+c*e-o*i,a=d*i+o*s-h*e,_=-o*e-h*s-c*i;return this.x=y*d+_*-o+l*-c-a*-h,this.y=l*d+_*-h+a*-o-y*-c,this.z=a*d+_*-c+y*-h-l*-o,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,s=this.y,i=this.z,o=t.elements;return this.x=o[0]*e+o[4]*s+o[8]*i,this.y=o[1]*e+o[5]*s+o[9]*i,this.z=o[2]*e+o[6]*s+o[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(t,Math.min(e,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,i=t.y,o=t.z,h=e.x,c=e.y,d=e.z;return this.x=i*d-o*c,this.y=o*h-s*d,this.z=s*c-i*h,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return $.copy(this).projectOnVector(t),this.sub($)}reflect(t){return this.sub($.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(V(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,s){const i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=(Math.random()-.5)*2,e=Math.random()*Math.PI*2,s=Math.sqrt(1-t**2);return this.x=s*Math.cos(e),this.y=s*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const $=new M,R=new ct;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:F}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=F);const C=n.reactive({controls:[]});function ut(){return C}function N(r){return Object.entries(r).map(([t,e])=>{let s="string",i;const o=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;return!n.isRef(e)&&e.value||n.isRef(e)?(s=typeof e.value,i=e.value):(s=typeof e,i=e),s==="number"&&(e.step||e.max||e.min)&&(s="range"),s==="string"&&o.test(i)&&(s="color"),(i instanceof M||i instanceof M||i instanceof Array)&&(s="vector"),!n.isRef(e)&&e.value?{...e,label:e.label||t,value:e.value,type:s,visible:!0}:{label:e.label||t,value:e,type:s,visible:!0}})}function yt(){C.controls=[]}function dt(r,t,e){let s=[];if(typeof r=="string")r==="fpsgraph"?s.push({label:"fpsgraph",visible:!0,type:"fpsgraph"}):s.push({label:r,visible:!0,type:"folder",controls:N(t)});else if(typeof r=="object"&&typeof t=="string")s.push({...e,label:t,visible:!0,value:r[t],type:typeof r[t],ref:r});else if(n.isReactive(r)){const i=n.toRefs(r);s=N(i)}else s=N(r);return C.controls=[...C.controls,...s],n.onUnmounted(yt),{state:C,controls:s}}const _t={class:"flex px-4 justify-between gap-4 items-center mb-2"},pt={class:"text-gray-500 w-1/3"},xt=["value","min","max","step"],mt=n.defineComponent({__name:"NumberControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r;function s(l){const{target:a}=l;t("change",a.valueAsNumber)}const i=z.useMouse(),o=n.ref(0),h=n.ref(!1),c=l=>{o.value=l.clientX,h.value=!0},d=()=>{h.value=!1},y=l=>Math.floor(Math.abs(l)/10);return n.watch(i.x,l=>{if(h.value){const a=l-o.value,_=y(a);a>0?t("change",e.control.value+1+_):a<0&&t("change",e.control.value-1+_),e.control.min!==void 0&&e.control.value<e.control.min&&t("change",e.control.min),e.control.max!==void 0&&e.control.value>e.control.max&&t("change",e.control.max),o.value=l}}),(l,a)=>(n.openBlock(),n.createElementBlock("div",_t,[n.createElementVNode("label",pt,n.toDisplayString(l.label),1),n.createElementVNode("input",{value:l.control.value,class:n.normalizeClass(["p-2 w-1/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":h.value}]),type:"number",min:l.control.min,max:l.control.max,step:l.control.step,onInput:s,onMousedown:c,onMouseup:d},null,42,xt)]))}}),ft={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},gt={class:"text-gray-500 w-1/3"},bt=["value"],zt=n.defineComponent({__name:"TextControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){t("change",s)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",ft,[n.createElementVNode("label",gt,n.toDisplayString(s.label),1),n.createElementVNode("input",{value:s.control.value,type:"string",class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",onChange:e},null,40,bt)]))}}),wt={class:"flex px-4 justify-start gap-2 items-center mb-2 min-h-32px"},Mt={class:"text-gray-500 w-1/3"},kt=["id","checked"],Ct=["for"],St={class:"i-ic:baseline-check text-light"},Et=n.defineComponent({__name:"BooleanControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){const{target:i}=s;t("change",i.checked)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",wt,[n.createElementVNode("label",Mt,n.toDisplayString(s.label),1),n.createElementVNode("input",{id:s.control.label,checked:s.control.value,class:"hidden",type:"checkbox",onInput:e},null,40,kt),n.createElementVNode("label",{for:s.control.label,class:"inline-flex items-center cursor-pointer"},[n.createElementVNode("span",{class:n.normalizeClass([{"bg-dark-500":s.control.value,"bg-gray-200":!s.control.value},"w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"])},[n.withDirectives(n.createElementVNode("i",St,null,512),[[n.vShow,s.control.value]])],2)],8,Ct)]))}}),Vt={class:"px-4 relative flex justify-between gap-4 items-center mb-2"},Bt=["value","min","max","step"],$t=["value","min","max","step"],Nt=n.defineComponent({__name:"SliderControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r;function s(a){const{target:_}=a;t("change",_.valueAsNumber)}const i=n.computed(()=>({backgroundImage:`linear-gradient(to right, #333 0% ${100*(e.control.value-(e.control.min||0))/((e.control.max||100)-(e.control.min||0))}%, #e2e2e2 0%)`})),o=z.useMouse(),h=n.ref(0),c=n.ref(!1),d=a=>{h.value=a.clientX,c.value=!0},y=()=>{c.value=!1},l=a=>Math.floor(Math.abs(a)/10);return n.watch(o.x,a=>{if(c.value){const _=a-h.value,u=l(_);_>0?t("change",e.control.value+1+u):_<0&&t("change",e.control.value-1+u),e.control.min!==void 0&&e.control.value<e.control.min&&t("change",e.control.min),e.control.max!==void 0&&e.control.value>e.control.max&&t("change",e.control.max),h.value=a}}),(a,_)=>(n.openBlock(),n.createElementBlock("div",Vt,[n.createElementVNode("label",{class:n.normalizeClass(["text-gray-500 w-1/3",{"flex justify-between items-center":a.control.icon}])},[n.createTextVNode(n.toDisplayString(a.label)+" ",1),n.createElementVNode("i",{class:n.normalizeClass(`i-${a.control.icon}`)},null,2)],2),n.createElementVNode("input",{value:a.control.value,class:"w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",style:n.normalizeStyle(i.value),type:"range",min:a.control.min,max:a.control.max,step:a.control.step,onInput:s},null,44,Bt),n.createElementVNode("input",{value:a.control.value,class:n.normalizeClass(["p-2 w-1/4 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":c.value}]),type:"number",min:a.control.min,max:a.control.max,step:a.control.step,onInput:s,onMousedown:d,onMouseup:y},null,42,$t)]))}}),re="",It=((r,t)=>{const e=r.__vccOpts||r;for(const[s,i]of t)e[s]=i;return e})(Nt,[["__scopeId","data-v-743fd350"]]),At={class:"flex px-4 justify-between gap-4 items-center mb-2"},Tt={class:"text-gray-500 w-1/3"},Dt=["value"],jt=["value"],qt=n.defineComponent({__name:"ColorControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){function e(s){const{target:i}=s;t("change",i.value)}return(s,i)=>(n.openBlock(),n.createElementBlock("div",At,[n.createElementVNode("label",Tt,n.toDisplayString(s.label),1),n.createElementVNode("input",{value:s.control.value,type:"color",onInput:e},null,40,Dt),n.createElementVNode("input",{value:s.control.value,class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",type:"text",onInput:e},null,40,jt)]))}}),le="";function Pt(r){return typeof r=="number"?[r,r,r]:r instanceof M?[r.x,r.y,r.z]:r}const Lt={class:"flex px-4 justify-between gap-2 items-center mb-2"},Ft={class:"text-gray-500 w-1/3"},Rt={class:"w-2/3 flex justify-between gap-1"},Xt={key:0,class:"font-bold px-0.5 py-1 text-0.65rem text-gray-300"},Yt=["value","onInput","onMousedown","onMouseup"],Ht=n.defineComponent({__name:"VectorControl",props:{label:{},control:{}},emits:["change"],setup(r,{emit:t}){const e=r,s=z.useMouse(),i=n.ref(0),o=n.ref(!1),h=n.ref(0),c=(p,m)=>{h.value=m,i.value=p.clientX,o.value=!0},d=(p,m)=>{h.value=m,o.value=!1},y=p=>Math.floor(Math.abs(p)/10),l=n.computed(()=>Pt(e.control.value)),a=n.computed(()=>Object.keys(e.control.value)),_=n.computed(()=>e.control.value instanceof B||e.control.value instanceof M);function u(p,m){const{value:f}=e.control,{target:x}=p;h.value=m,f[_.value?a.value[h.value]:h.value]=parseInt(x.value,10),t("change",f)}return n.watch(s.x,p=>{if(o.value){const m=p-i.value,f=y(m),{value:x}=e.control,g=_.value?a.value[h.value]:h.value;m>0?x[g]+=1+f:m<0&&(x[g]-=1+f),e.control.min!==void 0&&x<e.control.min&&(x[g]=e.control.min),e.control.max!==void 0&&x>e.control.max&&(x[g]=e.control.max),t("change",x),i.value=p}}),(p,m)=>(n.openBlock(),n.createElementBlock("div",Lt,[n.createElementVNode("label",Ft,n.toDisplayString(p.label),1),n.createElementVNode("div",Rt,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(l.value,(f,x)=>(n.openBlock(),n.createElementBlock("div",{key:p.label+x,class:"flex items-center w-1/3 bg-gray-100 rounded"},[a.value[x]&&_.value?(n.openBlock(),n.createElementBlock("span",Xt,n.toDisplayString(a.value[x]),1)):n.createCommentVNode("",!0),n.createElementVNode("input",{type:"text",class:n.normalizeClass(["w-full pl-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans",{"cursor-ew-resize":o.value}]),value:l.value[x].toFixed(2),onInput:g=>u(g,x),onMousedown:g=>c(g,x),onMouseup:g=>d(g,x)},null,42,Yt)]))),128))])]))}}),Qt={class:"mb-4"},Wt={class:"bg-white rounded-b pt-4"},Zt=n.defineComponent({__name:"Folder",props:{control:{}},setup(r){function t(i,o){o.value=i}const e=n.ref(!1),s=()=>{e.value=!e.value};return(i,o)=>(n.openBlock(),n.createElementBlock("div",Qt,[n.createElementVNode("button",{class:"flex items-center justify-between w-full p-4 bg-gray-100 border-none text-gray-400 font-bold text-xs focus:outline-none font-sans cursor-pointer",onClick:s},[n.createElementVNode("span",null,n.toDisplayString(i.control.label),1),n.createElementVNode("i",{class:n.normalizeClass(e.value?"i-ic:baseline-keyboard-arrow-up":"i-ic:baseline-keyboard-arrow-down")},null,2)]),n.createVNode(n.Transition,{name:"slide","enter-active-class":" animate-fade-in animate-duration-200 animate-ease-in-out","leave-active-class":" animate-fade-out animate-duration-200 animate-ease-in-out"},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",Wt,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.control.controls,h=>(n.openBlock(),n.createBlock(Q,{key:h.label,control:h,onChange:c=>t(c,h)},null,8,["control","onChange"]))),128))],512),[[n.vShow,e.value]])]),_:1})]))}}),Ut={class:"flex px-4 justify-between gap-4 items-center mb-2"},Kt={class:"text-gray-500 w-1/3"},Gt={class:"relative w-2/3 p-1 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans"},Jt={class:"absolute bottom-0.5 right-0.5 font-sans text-xs"},Ot=["points"],X=160,I=40,S=2,Y=100,H=20,vt=n.defineComponent({__name:"FPSGraph",props:{label:{},control:{}},setup(r){const t=z.useFps({every:Y}),e=n.ref(""),s=n.ref([]),i=n.ref(X/S);let o=performance.now();return z.useRafFn(({timestamp:h})=>{h-o>=Y&&(o=h,s.value.push(t.value),s.value.length>i.value&&s.value.shift(),e.value=s.value.map((c,d)=>`${d*S},${I+H-S/2-c*(I+H-S)/120}`).join(" "))}),(h,c)=>(n.openBlock(),n.createElementBlock("div",Ut,[n.createElementVNode("label",Kt,n.toDisplayString(h.label),1),n.createElementVNode("div",Gt,[n.createElementVNode("div",Jt,n.toDisplayString(Math.round(n.unref(t)))+" FPS",1),(n.openBlock(),n.createElementBlock("svg",{width:X,height:I,xmlns:"http://www.w3.org/2000/svg",class:"bg-gray-100"},[n.createElementVNode("polyline",{points:e.value,fill:"none",stroke:"lightgray","stroke-width":S,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ot)]))])]))}}),Q=n.defineComponent({__name:"ControlInput",props:{control:{}},emits:["change"],setup(r,{emit:t}){function e(s){t("change",s)}return(s,i)=>s.control.visible?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[s.control.type==="color"?(n.openBlock(),n.createBlock(qt,{key:0,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="vector"?(n.openBlock(),n.createBlock(Ht,{key:1,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="boolean"?(n.openBlock(),n.createBlock(Et,{key:2,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="fpsgraph"?(n.openBlock(),n.createBlock(vt,{key:3,label:s.control.label,control:s.control},null,8,["label","control"])):s.control.type==="folder"?(n.openBlock(),n.createBlock(Zt,{key:4,label:s.control.label,control:s.control},null,8,["label","control"])):s.control.type==="number"?(n.openBlock(),n.createBlock(mt,{key:5,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):s.control.type==="range"?(n.openBlock(),n.createBlock(It,{key:6,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"])):(n.openBlock(),n.createBlock(zt,{key:7,label:s.control.label,control:s.control,onChange:e},null,8,["label","control"]))],64)):n.createCommentVNode("",!0)}}),te={class:"bg-white shadow-xl rounded border-4 border-solid border-black"},ee=[n.createElementVNode("i",{class:"h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs"},"🍰",-1),n.createElementVNode("div",null,[n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),n.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"})],-1),n.createElementVNode("div",null,null,-1)],se=280,ne=n.defineComponent({__name:"TresLeches",setup(r){const{width:t}=z.useWindowSize(),e=n.ref(null),s=ut();function i(o,h){h.ref&&(h.ref[h.label]=o),h.value=o}return(o,h)=>(n.openBlock(),n.createBlock(n.unref(rt),{"initial-value":{x:n.unref(t)-se-20,y:10},class:"fixed select-none z-24 w-280px font-sans text-xs",handle:e.value},{default:n.withCtx(()=>[n.createElementVNode("div",te,[n.createElementVNode("header",{ref_key:"handle",ref:e,class:"relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"},ee,512),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(s).controls,c=>(n.openBlock(),n.createBlock(Q,{key:c.label,control:c,onChange:d=>i(d,c)},null,8,["control","onChange"]))),128))])]),_:1},8,["initial-value","handle"]))}});b.TresLeches=ne,b.useControls=dt,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,24 +1,27 @@
1
1
  {
2
2
  "name": "@tresjs/leches",
3
3
  "description": "Tasty GUI for Vue controls 🍰",
4
- "version": "0.2.0",
4
+ "version": "0.3.1",
5
5
  "type": "module",
6
+ "packageManager": "pnpm@8.3.1",
6
7
  "author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
7
- "files": [
8
- "dist"
9
- ],
10
8
  "license": "MIT",
11
- "main": "./dist/tresleches.umd.cjs",
9
+ "sideEffects": false,
10
+ "main": "./dist/tresleches.js",
12
11
  "module": "./dist/tresleches.js",
13
12
  "types": "./dist/index.d.ts",
14
13
  "exports": {
15
14
  ".": {
16
- "import": "./dist/tresleches.js",
17
- "require": "./dist/tresleches.umd.cjs"
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/tresleches.js"
18
17
  },
19
18
  "./styles": "./dist/style.css",
20
- "./*": "./dist/tresleches.js"
19
+ "./*": "./*"
21
20
  },
21
+ "files": [
22
+ "dist",
23
+ "*.d.ts"
24
+ ],
22
25
  "publishConfig": {
23
26
  "access": "public"
24
27
  },
@@ -44,37 +47,38 @@
44
47
  "story:preview": "histoire preview"
45
48
  },
46
49
  "dependencies": {
47
- "@types/three": "^0.151.0",
48
- "@vueuse/components": "^10.1.0",
49
- "@vueuse/shared": "^10.1.0",
50
+ "@types/three": "^0.152.1",
51
+ "@vueuse/components": "^10.2.0",
52
+ "three": "^0.153.0",
53
+ "vue": "^3.3.4"
54
+ },
55
+ "devDependencies": {
56
+ "@vueuse/shared": "^10.2.0",
50
57
  "kolorist": "^1.8.0",
51
- "pathe": "^1.1.0",
58
+ "pathe": "^1.1.1",
52
59
  "rollup-plugin-analyzer": "^4.0.0",
53
- "rollup-plugin-visualizer": "^5.9.0",
54
- "three": "^0.152.2",
60
+ "rollup-plugin-visualizer": "^5.9.2",
55
61
  "vite-plugin-banner": "^0.7.0",
56
62
  "vite-plugin-dts": "^2.3.0",
57
- "vue": "^3.2.47"
58
- },
59
- "devDependencies": {
60
63
  "@alvarosabu/prettier-config": "^1.3.0",
61
64
  "@histoire/plugin-vue": "^0.16.1",
62
65
  "@iconify-json/ic": "^1.1.13",
63
66
  "@release-it/conventional-changelog": "^5.1.1",
64
- "@typescript-eslint/eslint-plugin": "^5.59.1",
65
- "@vitejs/plugin-vue": "^4.2.1",
66
- "@vitest/ui": "^0.30.1",
67
- "@vueuse/core": "^10.1.0",
68
- "eslint": "^8.39.0",
67
+ "@typescript-eslint/eslint-plugin": "^5.60.0",
68
+ "@vitejs/plugin-vue": "^4.2.3",
69
+ "@vitest/ui": "^0.32.2",
70
+ "@vueuse/core": "^10.2.0",
71
+ "eslint": "^8.43.0",
69
72
  "eslint-config-prettier": "^8.8.0",
70
- "eslint-plugin-vue": "^9.11.0",
71
- "histoire": "^0.16.1",
73
+ "eslint-plugin-vitest-globals": "^1.3.1",
74
+ "eslint-plugin-vue": "^9.15.0",
75
+ "histoire": "^0.16.2",
72
76
  "prettier": "^2.8.8",
73
- "release-it": "^15.10.1",
74
- "typescript": "^5.0.4",
75
- "unocss": "^0.51.8",
76
- "vite": "^4.3.3",
77
- "vitest": "^0.30.1",
78
- "vue-tsc": "^1.6.0"
77
+ "release-it": "^15.11.0",
78
+ "typescript": "^5.1.3",
79
+ "unocss": "^0.53.1",
80
+ "vite": "^4.3.9",
81
+ "vitest": "^0.32.2",
82
+ "vue-tsc": "^1.8.1"
79
83
  }
80
84
  }