@tresjs/leches 0.11.0 → 0.12.0
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/style.css +2 -2
- package/dist/tresleches.js +303 -287
- package/dist/tresleches.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/leches
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.12.0
|
|
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
|
-
*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgba(0,0,0,0);--un-ring-shadow:0 0 rgba(0,0,0,0);--un-shadow-inset: ;--un-shadow:0 0 rgba(0,0,0,0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgba(0,0,0,0);--un-ring-shadow:0 0 rgba(0,0,0,0);--un-shadow-inset: ;--un-shadow:0 0 rgba(0,0,0,0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_SeW4Ep0.woff2) format("woff2");unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_QOW4Ep0.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_R-W4Ep0.woff2) format("woff2");unicode-range:U+0370-03FF}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_S-W4Ep0.woff2) format("woff2");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_SuW4Ep0.woff2) format("woff2");unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_ROW4.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}.i-ic-baseline-drag-indicator{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M11 18c0 1.1-.9 2-2 2s-2-.9-2-2s.9-2 2-2s2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2s-2 .9-2 2s.9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;display:inline-block;vertical-align:middle;width:1.2em;height:1.2em}.i-ic\:baseline-check{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;display:inline-block;vertical-align:middle;width:1.2em;height:1.2em}.i-ic\:baseline-keyboard-arrow-down{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6l-6-6l1.41-1.41z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;display:inline-block;vertical-align:middle;width:1.2em;height:1.2em}.i-ic\:baseline-keyboard-arrow-up{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;display:inline-block;vertical-align:middle;width:1.2em;height:1.2em}.absolute{position:absolute}.relative{position:relative}.bottom-0\.5{bottom:.125rem}.right-0\.5{right:.125rem}.z-24{z-index:24}.-mt-0\.5{margin-top:-.125rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mr-2{margin-right:.5rem}.box-border{box-sizing:border-box}.hidden{display:none}.h-0\.75{height:.1875rem}.h-30px{height:30px}.h-4{height:1rem}.min-h-32px{min-height:32px}.w-1\/2{width:50%}.w-1\/3{width:33.3333333333%}.w-1\/4{width:25%}.w-2\/3{width:66.6666666667%}.w-280px{width:280px}.w-3{width:.75rem}.w-30px{width:30px}.w-4{width:1rem}.w-full{width:100%}.flex{display:flex}.inline-flex{display:inline-flex}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.animate-fade-in{animation:fade-in 1s linear 1}.animate-fade-out{animation:fade-out 1s linear 1}.animate-duration-200{animation-duration:.2s}.animate-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.cursor-pointer{cursor:pointer}.cursor-grabbing{cursor:grabbing}.cursor-ew-resize{cursor:ew-resize}.select-none{-webkit-user-select:none;user-select:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-black{--un-border-opacity:1;border-color:rgba(0,0,0,var(--un-border-opacity))}.border-gray-300{--un-border-opacity:1;border-color:rgba(209,213,219,var(--un-border-opacity))}.focus\:border-gray-200:focus{--un-border-opacity:1;border-color:rgba(229,231,235,var(--un-border-opacity))}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.rounded-b{border-bottom-left-radius:.25rem;border-bottom-right-radius:.25rem}.border-none{border-style:none}.border-solid{border-style:solid}.bg-dark-200{--un-bg-opacity:1;background-color:rgba(50,50,50,var(--un-bg-opacity))}.bg-dark-500{--un-bg-opacity:1;background-color:rgba(31,31,31,var(--un-bg-opacity))}.bg-gray-100{--un-bg-opacity:1;background-color:rgba(243,244,246,var(--un-bg-opacity))}.bg-gray-200{--un-bg-opacity:1;background-color:rgba(229,231,235,var(--un-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--un-bg-opacity:1;background-color:rgba(255,255,255,var(--un-bg-opacity))}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-4{padding:1rem}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-right{text-align:right}.text-0\.65rem{font-size:.65rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.line-height-0{line-height:0}.font-sans{font-family:Roboto Mono,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-gray-200{--un-text-opacity:1;color:rgba(229,231,235,var(--un-text-opacity))}.text-gray-300{--un-text-opacity:1;color:rgba(209,213,219,var(--un-text-opacity))}.text-gray-400{--un-text-opacity:1;color:rgba(156,163,175,var(--un-text-opacity))}.text-gray-500{--un-text-opacity:1;color:rgba(107,114,128,var(--un-text-opacity))}.text-light{--un-text-opacity:1;color:rgba(246,246,246,var(--un-text-opacity))}.shadow-lg{--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgba(0,0,0,.1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgba(0,0,0,.1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-xl{--un-shadow:var(--un-shadow-inset) 0 20px 25px -5px var(--un-shadow-color, rgba(0,0,0,.1)),var(--un-shadow-inset) 0 8px 10px -6px var(--un-shadow-color, rgba(0,0,0,.1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.important-outline-gray-200{--un-outline-color-opacity:1 !important;outline-color:rgba(229,231,235,var(--un-outline-color-opacity))!important}.outline{outline-style:solid}.outline-none{outline:2px solid transparent;outline-offset:2px}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--un-ring-width:2px;--un-ring-offset-shadow:var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);--un-ring-shadow:var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.focus\:ring-blue-600:focus{--un-ring-opacity:1;--un-ring-color:rgba(37,99,235,var(--un-ring-opacity))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}input[type=range][data-v-9e6267fe]{outline:none;appearance:none;-webkit-appearance:none;-moz-appearance:none}input[type=range][data-v-9e6267fe]::-webkit-slider-thumb{height:1rem;width:.75rem;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-width:2px;border-radius:.125rem;--un-bg-opacity:1;background-color:rgba(50,50,50,var(--un-bg-opacity));--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgba(0,0,0,.1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgba(0,0,0,.1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}input[type=range][data-v-9e6267fe]::-moz-range-thumb{height:1rem;width:.75rem;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-width:2px;border-radius:.125rem;--un-bg-opacity:1;background-color:rgba(50,50,50,var(--un-bg-opacity));--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgba(0,0,0,.1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgba(0,0,0,.1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}input[type=color]{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.125rem;border-style:none;background-color:transparent;padding:0;outline:2px solid transparent;outline-offset:2px;cursor:pointer}input[type=color]::-webkit-color-swatch-wrapper{border-style:none;padding:0}input[type=color]::-webkit-color-swatch{margin-top:-.125rem;height:30px;width:30px;border-radius:.125rem;border-style:none;padding:0}
|
|
8
|
+
*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgba(0,0,0,0);--un-ring-shadow:0 0 rgba(0,0,0,0);--un-shadow-inset: ;--un-shadow:0 0 rgba(0,0,0,0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgba(0,0,0,0);--un-ring-shadow:0 0 rgba(0,0,0,0);--un-shadow-inset: ;--un-shadow:0 0 rgba(0,0,0,0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_SeW4Ep0.woff2) format("woff2");unicode-range:U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_QOW4Ep0.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_R-W4Ep0.woff2) format("woff2");unicode-range:U+0370-03FF}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_S-W4Ep0.woff2) format("woff2");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_SuW4Ep0.woff2) format("woff2");unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Roboto Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/robotomono/v23/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_ROW4.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}.i-ic-baseline-drag-indicator{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M11 18c0 1.1-.9 2-2 2s-2-.9-2-2s.9-2 2-2s2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2s-2 .9-2 2s.9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2s2-.9 2-2s-.9-2-2-2z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;display:inline-block;vertical-align:middle;width:1.2em;height:1.2em}.i-ic\:baseline-check{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M9 16.17L4.83 12l-1.42 1.41L9 19L21 7l-1.41-1.41z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;display:inline-block;vertical-align:middle;width:1.2em;height:1.2em}.i-ic\:baseline-keyboard-arrow-down{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6l-6-6l1.41-1.41z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;display:inline-block;vertical-align:middle;width:1.2em;height:1.2em}.i-ic\:baseline-keyboard-arrow-up{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;display:inline-block;vertical-align:middle;width:1.2em;height:1.2em}.absolute{position:absolute}.relative{position:relative}.bottom-0\.5{bottom:.125rem}.right-0\.5{right:.125rem}.z-24{z-index:24}.-mt-0\.5{margin-top:-.125rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mr-2{margin-right:.5rem}.box-border{box-sizing:border-box}.hidden{display:none}.h-0\.75{height:.1875rem}.h-30px{height:30px}.h-4{height:1rem}.min-h-32px{min-height:32px}.w-1\/2{width:50%}.w-1\/3{width:33.3333333333%}.w-1\/4{width:25%}.w-2\/3{width:66.6666666667%}.w-2\/5{width:40%}.w-280px{width:280px}.w-3{width:.75rem}.w-30px{width:30px}.w-4{width:1rem}.w-full{width:100%}.flex{display:flex}.inline-flex{display:inline-flex}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.animate-fade-in{animation:fade-in 1s linear 1}.animate-fade-out{animation:fade-out 1s linear 1}.animate-duration-200{animation-duration:.2s}.animate-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.cursor-pointer{cursor:pointer}.cursor-grabbing{cursor:grabbing}.cursor-ew-resize{cursor:ew-resize}.select-none{-webkit-user-select:none;user-select:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-black{--un-border-opacity:1;border-color:rgba(0,0,0,var(--un-border-opacity))}.border-gray-300{--un-border-opacity:1;border-color:rgba(209,213,219,var(--un-border-opacity))}.focus\:border-gray-200:focus{--un-border-opacity:1;border-color:rgba(229,231,235,var(--un-border-opacity))}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-sm{border-radius:.125rem}.rounded-b{border-bottom-left-radius:.25rem;border-bottom-right-radius:.25rem}.border-none{border-style:none}.border-solid{border-style:solid}.bg-dark-200{--un-bg-opacity:1;background-color:rgba(50,50,50,var(--un-bg-opacity))}.bg-dark-500{--un-bg-opacity:1;background-color:rgba(31,31,31,var(--un-bg-opacity))}.bg-gray-100{--un-bg-opacity:1;background-color:rgba(243,244,246,var(--un-bg-opacity))}.bg-gray-200{--un-bg-opacity:1;background-color:rgba(229,231,235,var(--un-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--un-bg-opacity:1;background-color:rgba(255,255,255,var(--un-bg-opacity))}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-4{padding:1rem}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-right{text-align:right}.text-0\.65rem{font-size:.65rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.line-height-0{line-height:0}.font-sans{font-family:Roboto Mono,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-gray-200{--un-text-opacity:1;color:rgba(229,231,235,var(--un-text-opacity))}.text-gray-300{--un-text-opacity:1;color:rgba(209,213,219,var(--un-text-opacity))}.text-gray-400{--un-text-opacity:1;color:rgba(156,163,175,var(--un-text-opacity))}.text-gray-500{--un-text-opacity:1;color:rgba(107,114,128,var(--un-text-opacity))}.text-light{--un-text-opacity:1;color:rgba(246,246,246,var(--un-text-opacity))}.shadow-lg{--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgba(0,0,0,.1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgba(0,0,0,.1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-xl{--un-shadow:var(--un-shadow-inset) 0 20px 25px -5px var(--un-shadow-color, rgba(0,0,0,.1)),var(--un-shadow-inset) 0 8px 10px -6px var(--un-shadow-color, rgba(0,0,0,.1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.important-outline-gray-200{--un-outline-color-opacity:1 !important;outline-color:rgba(229,231,235,var(--un-outline-color-opacity))!important}.outline{outline-style:solid}.outline-none{outline:2px solid transparent;outline-offset:2px}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--un-ring-width:2px;--un-ring-offset-shadow:var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);--un-ring-shadow:var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.focus\:ring-blue-600:focus{--un-ring-opacity:1;--un-ring-color:rgba(37,99,235,var(--un-ring-opacity))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}input[type=range][data-v-9e6267fe]{outline:none;appearance:none;-webkit-appearance:none;-moz-appearance:none}input[type=range][data-v-9e6267fe]::-webkit-slider-thumb{height:1rem;width:.75rem;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-width:2px;border-radius:.125rem;--un-bg-opacity:1;background-color:rgba(50,50,50,var(--un-bg-opacity));--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgba(0,0,0,.1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgba(0,0,0,.1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}input[type=range][data-v-9e6267fe]::-moz-range-thumb{height:1rem;width:.75rem;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-width:2px;border-radius:.125rem;--un-bg-opacity:1;background-color:rgba(50,50,50,var(--un-bg-opacity));--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgba(0,0,0,.1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgba(0,0,0,.1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}input[type=color]{box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.125rem;border-style:none;background-color:transparent;padding:0;outline:2px solid transparent;outline-offset:2px;cursor:pointer}input[type=color]::-webkit-color-swatch-wrapper{border-style:none;padding:0}input[type=color]::-webkit-color-swatch{margin-top:-.125rem;height:30px;width:30px;border-radius:.125rem;border-style:none;padding:0}
|
package/dist/tresleches.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/leches
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.12.0
|
|
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
|
-
import { unref as
|
|
9
|
-
import { useWindowSize as
|
|
10
|
-
function
|
|
11
|
-
return typeof n == "function" ? n() :
|
|
8
|
+
import { unref as F, isRef as W, toRefs as z, customRef as ie, ref as g, watch as V, computed as U, defineComponent as S, reactive as L, h as de, provide as fe, isReactive as pe, openBlock as v, createElementBlock as _, createElementVNode as d, toDisplayString as M, normalizeClass as A, withDirectives as te, vShow as oe, createTextVNode as ve, normalizeStyle as ge, Fragment as q, renderList as B, createCommentVNode as j, createBlock as k, createVNode as ye, Transition as he, withCtx as le } from "vue";
|
|
9
|
+
import { useWindowSize as ae, useEventListener as Y, useStorage as be, isClient as me, useMouse as J, useMousePressed as _e, useKeyModifier as Q, useFps as xe, useRafFn as we } from "@vueuse/core";
|
|
10
|
+
function E(n) {
|
|
11
|
+
return typeof n == "function" ? n() : F(n);
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
if (!
|
|
16
|
-
return
|
|
13
|
+
const re = typeof window < "u" && typeof document < "u";
|
|
14
|
+
function $e(n, l = {}) {
|
|
15
|
+
if (!W(n))
|
|
16
|
+
return z(n);
|
|
17
17
|
const t = Array.isArray(n.value) ? Array.from({ length: n.value.length }) : {};
|
|
18
18
|
for (const e in n.value)
|
|
19
|
-
t[e] =
|
|
19
|
+
t[e] = ie(() => ({
|
|
20
20
|
get() {
|
|
21
21
|
return n.value[e];
|
|
22
22
|
},
|
|
23
23
|
set(a) {
|
|
24
24
|
var r;
|
|
25
|
-
if ((r =
|
|
25
|
+
if ((r = E(l.replaceRef)) != null ? r : !0)
|
|
26
26
|
if (Array.isArray(n.value)) {
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const c = [...n.value];
|
|
28
|
+
c[e] = a, n.value = c;
|
|
29
29
|
} else {
|
|
30
|
-
const
|
|
31
|
-
Object.setPrototypeOf(
|
|
30
|
+
const c = { ...n.value, [e]: a };
|
|
31
|
+
Object.setPrototypeOf(c, Object.getPrototypeOf(n.value)), n.value = c;
|
|
32
32
|
}
|
|
33
33
|
else
|
|
34
34
|
n.value[e] = a;
|
|
@@ -36,64 +36,64 @@ function me(n, l = {}) {
|
|
|
36
36
|
}));
|
|
37
37
|
return t;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
function
|
|
39
|
+
const Ce = re ? window : void 0;
|
|
40
|
+
function ke(n, l = {}) {
|
|
41
41
|
const {
|
|
42
42
|
pointerTypes: t,
|
|
43
43
|
preventDefault: e,
|
|
44
44
|
stopPropagation: a,
|
|
45
45
|
exact: r,
|
|
46
|
-
onMove:
|
|
47
|
-
onEnd:
|
|
48
|
-
onStart:
|
|
49
|
-
initialValue:
|
|
50
|
-
axis:
|
|
51
|
-
draggingElement: o =
|
|
52
|
-
handle:
|
|
53
|
-
} = l, { width:
|
|
54
|
-
let
|
|
55
|
-
const
|
|
56
|
-
|
|
46
|
+
onMove: u,
|
|
47
|
+
onEnd: c,
|
|
48
|
+
onStart: f,
|
|
49
|
+
initialValue: h,
|
|
50
|
+
axis: i = "both",
|
|
51
|
+
draggingElement: o = Ce,
|
|
52
|
+
handle: p = n
|
|
53
|
+
} = l, { width: b } = ae();
|
|
54
|
+
let D = b.value;
|
|
55
|
+
const y = g(
|
|
56
|
+
E(h) ?? { x: 0, y: 0 }
|
|
57
57
|
);
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
58
|
+
V(b, () => {
|
|
59
|
+
const s = b.value - D;
|
|
60
|
+
y.value.x += s, D = b.value;
|
|
61
61
|
});
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
if (
|
|
62
|
+
const K = g(), I = (s) => t ? t.includes(s.pointerType) : !0, w = (s) => {
|
|
63
|
+
E(e) && s.preventDefault(), E(a) && s.stopPropagation();
|
|
64
|
+
}, $ = (s) => {
|
|
65
|
+
if (!I(s) || E(r) && s.target !== E(n))
|
|
66
66
|
return;
|
|
67
|
-
const
|
|
68
|
-
x:
|
|
69
|
-
y:
|
|
67
|
+
const x = E(n).getBoundingClientRect(), C = {
|
|
68
|
+
x: s.clientX - x.left,
|
|
69
|
+
y: s.clientY - x.top
|
|
70
70
|
};
|
|
71
|
-
(
|
|
72
|
-
},
|
|
73
|
-
if (
|
|
71
|
+
(f == null ? void 0 : f(C, s)) !== !1 && (K.value = C, w(s));
|
|
72
|
+
}, X = (s) => {
|
|
73
|
+
if (!I(s) || !K.value)
|
|
74
74
|
return;
|
|
75
|
-
let { x
|
|
76
|
-
(
|
|
77
|
-
x
|
|
78
|
-
y:
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
|
|
75
|
+
let { x, y: C } = y.value;
|
|
76
|
+
(i === "x" || i === "both") && (x = s.clientX - K.value.x), (i === "y" || i === "both") && (C = s.clientY - K.value.y), y.value = {
|
|
77
|
+
x,
|
|
78
|
+
y: C
|
|
79
|
+
}, u == null || u(y.value, s), w(s);
|
|
80
|
+
}, R = (s) => {
|
|
81
|
+
I(s) && K.value && (K.value = void 0, c == null || c(y.value, s), w(s));
|
|
82
82
|
};
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
|
|
83
|
+
if (re) {
|
|
84
|
+
const s = { capture: l.capture ?? !0 };
|
|
85
|
+
Y(p, "pointerdown", $, s), Y(o, "pointermove", X, s), Y(o, "pointerup", R, s);
|
|
86
86
|
}
|
|
87
87
|
return {
|
|
88
|
-
|
|
89
|
-
position:
|
|
90
|
-
isDragging:
|
|
91
|
-
style:
|
|
92
|
-
() => `left:${
|
|
88
|
+
...$e(y),
|
|
89
|
+
position: y,
|
|
90
|
+
isDragging: U(() => !!K.value),
|
|
91
|
+
style: U(
|
|
92
|
+
() => `left:${y.value.x}px;top:${y.value.y}px;`
|
|
93
93
|
)
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const Me = /* @__PURE__ */ S({
|
|
97
97
|
name: "UseDraggable",
|
|
98
98
|
props: [
|
|
99
99
|
"storageKey",
|
|
@@ -111,77 +111,77 @@ const we = /* @__PURE__ */ M({
|
|
|
111
111
|
"onEnd"
|
|
112
112
|
],
|
|
113
113
|
setup(n, { slots: l }) {
|
|
114
|
-
const t =
|
|
114
|
+
const t = g(), e = U(() => n.handle ?? t.value), a = n.storageKey && be(
|
|
115
115
|
n.storageKey,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
), r = a || n.initialValue || { x: 0, y: 0 },
|
|
116
|
+
E(n.initialValue) || { x: 0, y: 0 },
|
|
117
|
+
me ? n.storageType === "session" ? sessionStorage : localStorage : void 0
|
|
118
|
+
), r = a || n.initialValue || { x: 0, y: 0 }, c = L(ke(t, {
|
|
119
119
|
...n,
|
|
120
120
|
handle: e,
|
|
121
121
|
initialValue: r,
|
|
122
|
-
onEnd: (
|
|
123
|
-
var
|
|
124
|
-
(
|
|
122
|
+
onEnd: (f, h) => {
|
|
123
|
+
var i;
|
|
124
|
+
(i = n.onEnd) == null || i.call(n, f, h), a && (a.value.x = f.x, a.value.y = f.y);
|
|
125
125
|
}
|
|
126
126
|
}));
|
|
127
127
|
return () => {
|
|
128
128
|
if (l.default)
|
|
129
|
-
return
|
|
129
|
+
return de(n.as || "div", { ref: t, style: `touch-action:none;${c.style}` }, l.default(c));
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
}),
|
|
133
|
-
function
|
|
134
|
-
return
|
|
132
|
+
}), Se = Symbol("CONTROLS_CONTEXT_KEY"), se = "default", O = L({});
|
|
133
|
+
function Ke(n = se) {
|
|
134
|
+
return fe(Se, O), O[n];
|
|
135
135
|
}
|
|
136
|
-
const
|
|
136
|
+
const H = (n) => {
|
|
137
137
|
const l = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
138
138
|
return typeof n == "boolean" ? "boolean" : typeof n == "number" ? "number" : typeof n == "string" && l.test(n) ? "color" : typeof n == "string" ? "string" : n.isVector3 || n.isVector2 || n.isEuler || n instanceof Array ? "vector" : n.min !== void 0 || n.max !== void 0 || n.step !== void 0 ? "range" : n.options && Array.isArray(n.options) ? "select" : "unknown";
|
|
139
|
-
},
|
|
139
|
+
}, N = (n, l, t, e) => {
|
|
140
140
|
const a = {
|
|
141
|
-
key:
|
|
142
|
-
label:
|
|
143
|
-
name:
|
|
144
|
-
type:
|
|
145
|
-
value:
|
|
146
|
-
visible:
|
|
147
|
-
[n]:
|
|
141
|
+
key: g(n),
|
|
142
|
+
label: g(n),
|
|
143
|
+
name: g(n),
|
|
144
|
+
type: g(t),
|
|
145
|
+
value: g(l),
|
|
146
|
+
visible: g(!0),
|
|
147
|
+
[n]: g(l)
|
|
148
148
|
};
|
|
149
|
-
return e && (a.folder =
|
|
150
|
-
},
|
|
149
|
+
return e && (a.folder = g(e)), a;
|
|
150
|
+
}, Te = (n, l) => {
|
|
151
151
|
let t = 1, e = `${n}_${t}`;
|
|
152
152
|
for (; l[e]; )
|
|
153
153
|
t++, e = `${n}_${t}`;
|
|
154
154
|
return e;
|
|
155
|
-
},
|
|
156
|
-
const e = {}, a = typeof n == "string" ? n : null, r = a ? l : n,
|
|
157
|
-
if (
|
|
158
|
-
const o =
|
|
159
|
-
return
|
|
155
|
+
}, Fn = (n, l, t) => {
|
|
156
|
+
const e = {}, a = typeof n == "string" ? n : null, r = a ? l : n, u = a && a !== "fpsgraph" ? t : l, c = (u == null ? void 0 : u.uuid) || se;
|
|
157
|
+
if (O[c] || (O[c] = L({})), n === "fpsgraph") {
|
|
158
|
+
const o = N("fpsgraph", null, "fpsgraph", null);
|
|
159
|
+
return O[c].fpsgraph = o, e.fpsgraph = o, z(L(e));
|
|
160
160
|
}
|
|
161
|
-
const
|
|
161
|
+
const f = O[c], h = pe(r), i = h ? z(r) : {};
|
|
162
162
|
for (const o in r) {
|
|
163
|
-
let
|
|
164
|
-
if (
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
text:
|
|
168
|
-
value:
|
|
169
|
-
}))),
|
|
163
|
+
let p = r[o], b = o;
|
|
164
|
+
if (h && i[o] && (p = i[o]), a && (b = `${a}${o.charAt(0).toUpperCase() + o.slice(1)}`), !a && f[b] && (b = Te(o, f)), typeof p == "object" && !W(p) && !Array.isArray(p) && p.value !== void 0) {
|
|
165
|
+
const y = p, K = W(y.value) ? y.value : g(y.value), I = H(y), w = N(o, K, I, a);
|
|
166
|
+
I === "select" && (w.options = g(y.options.map(($) => typeof $ == "object" && $.text && $.value ? $ : {
|
|
167
|
+
text: $,
|
|
168
|
+
value: $
|
|
169
|
+
}))), I === "range" && (w.min = g(y.min || 0), w.max = g(y.max || 1), w.step = g(y.step || 0.1)), w.label.value = y.label || o, w.visible.value = y.visible !== void 0 ? y.visible : !0, f[b] = w, e[b] = w;
|
|
170
170
|
continue;
|
|
171
171
|
}
|
|
172
|
-
if (
|
|
173
|
-
const
|
|
174
|
-
|
|
172
|
+
if (W(p)) {
|
|
173
|
+
const y = N(o, p, H(p.value), a);
|
|
174
|
+
f[b] = y, e[b] = y;
|
|
175
175
|
continue;
|
|
176
|
-
} else if (typeof
|
|
177
|
-
const
|
|
178
|
-
|
|
176
|
+
} else if (typeof p == "object" && !Array.isArray(p)) {
|
|
177
|
+
const y = z(p);
|
|
178
|
+
y[o] && (p = y[o]);
|
|
179
179
|
}
|
|
180
|
-
const
|
|
181
|
-
|
|
180
|
+
const D = N(o, p, H(p), a);
|
|
181
|
+
f[b] = D, e[b] = D, D.uniqueKey = b;
|
|
182
182
|
}
|
|
183
|
-
return Object.keys(e).length > 1 ?
|
|
184
|
-
},
|
|
183
|
+
return Object.keys(e).length > 1 ? z(L(e)) : Object.values(e)[0];
|
|
184
|
+
}, Ae = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Ie = ["for"], De = ["id", "value", "min", "max", "step"], Fe = /* @__PURE__ */ S({
|
|
185
185
|
__name: "NumberControl",
|
|
186
186
|
props: {
|
|
187
187
|
label: {},
|
|
@@ -190,40 +190,40 @@ const j = (n) => {
|
|
|
190
190
|
emits: ["change"],
|
|
191
191
|
setup(n, { emit: l }) {
|
|
192
192
|
const t = n;
|
|
193
|
-
function e(
|
|
194
|
-
const { target: o } =
|
|
193
|
+
function e(i) {
|
|
194
|
+
const { target: o } = i;
|
|
195
195
|
l("change", o.valueAsNumber);
|
|
196
196
|
}
|
|
197
|
-
const a =
|
|
198
|
-
r.value =
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
return
|
|
203
|
-
if (
|
|
204
|
-
const o =
|
|
205
|
-
o > 0 ? l("change", t.control.value + 1 +
|
|
197
|
+
const a = J(), r = g(0), u = g(!1), c = (i) => {
|
|
198
|
+
r.value = i.clientX, u.value = !0;
|
|
199
|
+
}, f = () => {
|
|
200
|
+
u.value = !1;
|
|
201
|
+
}, h = (i) => Math.floor(Math.abs(i) / 10);
|
|
202
|
+
return V(a.x, (i) => {
|
|
203
|
+
if (u.value) {
|
|
204
|
+
const o = i - r.value, p = h(o);
|
|
205
|
+
o > 0 ? l("change", t.control.value + 1 + p) : o < 0 && l("change", t.control.value - 1 + p), t.control.min !== void 0 && t.control.value < t.control.min && l("change", t.control.min), t.control.max !== void 0 && t.control.value > t.control.max && l("change", t.control.max), r.value = i;
|
|
206
206
|
}
|
|
207
|
-
}), (
|
|
207
|
+
}), (i, o) => (v(), _("div", Ae, [
|
|
208
208
|
d("label", {
|
|
209
209
|
class: "text-gray-500 w-1/3",
|
|
210
|
-
for:
|
|
211
|
-
},
|
|
210
|
+
for: i.control.uniqueKey
|
|
211
|
+
}, M(i.label), 9, Ie),
|
|
212
212
|
d("input", {
|
|
213
|
-
id:
|
|
214
|
-
value:
|
|
215
|
-
class:
|
|
213
|
+
id: i.control.uniqueKey,
|
|
214
|
+
value: i.control.value,
|
|
215
|
+
class: A(["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": u.value }]),
|
|
216
216
|
type: "number",
|
|
217
|
-
min:
|
|
218
|
-
max:
|
|
219
|
-
step:
|
|
217
|
+
min: i.control.min,
|
|
218
|
+
max: i.control.max,
|
|
219
|
+
step: i.control.step,
|
|
220
220
|
onInput: e,
|
|
221
|
-
onMousedown:
|
|
222
|
-
onMouseup:
|
|
223
|
-
}, null, 42,
|
|
221
|
+
onMousedown: c,
|
|
222
|
+
onMouseup: f
|
|
223
|
+
}, null, 42, De)
|
|
224
224
|
]));
|
|
225
225
|
}
|
|
226
|
-
}),
|
|
226
|
+
}), Ee = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, Ve = ["for"], qe = ["id", "value", "aria-label"], Ue = /* @__PURE__ */ S({
|
|
227
227
|
__name: "TextControl",
|
|
228
228
|
props: {
|
|
229
229
|
label: {},
|
|
@@ -235,11 +235,11 @@ const j = (n) => {
|
|
|
235
235
|
const { target: a } = e;
|
|
236
236
|
l("change", a.value);
|
|
237
237
|
}
|
|
238
|
-
return (e, a) => (v(), _("div",
|
|
238
|
+
return (e, a) => (v(), _("div", Ee, [
|
|
239
239
|
d("label", {
|
|
240
240
|
for: e.control.uniqueKey,
|
|
241
241
|
class: "text-gray-500 w-1/3"
|
|
242
|
-
},
|
|
242
|
+
}, M(e.label), 9, Ve),
|
|
243
243
|
d("input", {
|
|
244
244
|
id: e.control.uniqueKey,
|
|
245
245
|
value: e.control.value,
|
|
@@ -249,10 +249,10 @@ const j = (n) => {
|
|
|
249
249
|
"aria-label": e.label,
|
|
250
250
|
placeholder: "Enter value here...",
|
|
251
251
|
onChange: t
|
|
252
|
-
}, null, 40,
|
|
252
|
+
}, null, 40, qe)
|
|
253
253
|
]));
|
|
254
254
|
}
|
|
255
|
-
}),
|
|
255
|
+
}), ze = { class: "flex px-4 justify-start gap-2 items-center mb-2 min-h-32px" }, Oe = { class: "text-gray-500 w-1/3" }, Xe = ["id", "checked"], Pe = ["for"], Le = ["aria-checked"], Be = { class: "i-ic:baseline-check text-light" }, Ne = /* @__PURE__ */ S({
|
|
256
256
|
__name: "BooleanControl",
|
|
257
257
|
props: {
|
|
258
258
|
label: {},
|
|
@@ -262,21 +262,21 @@ const j = (n) => {
|
|
|
262
262
|
setup(n, { emit: l }) {
|
|
263
263
|
const t = n;
|
|
264
264
|
function e(r) {
|
|
265
|
-
const { target:
|
|
266
|
-
l("change",
|
|
265
|
+
const { target: u } = r;
|
|
266
|
+
l("change", u.checked);
|
|
267
267
|
}
|
|
268
268
|
function a(r) {
|
|
269
269
|
(r.code === "Space" || r.code === "Enter") && (r.preventDefault(), l("change", !t.control.value));
|
|
270
270
|
}
|
|
271
|
-
return (r,
|
|
272
|
-
d("label",
|
|
271
|
+
return (r, u) => (v(), _("div", ze, [
|
|
272
|
+
d("label", Oe, M(r.label), 1),
|
|
273
273
|
d("input", {
|
|
274
274
|
id: r.control.uniqueKey,
|
|
275
275
|
checked: r.control.value,
|
|
276
276
|
class: "hidden",
|
|
277
277
|
type: "checkbox",
|
|
278
278
|
onInput: e
|
|
279
|
-
}, null, 40,
|
|
279
|
+
}, null, 40, Xe),
|
|
280
280
|
d("label", {
|
|
281
281
|
for: r.control.uniqueKey,
|
|
282
282
|
class: "inline-flex items-center cursor-pointer"
|
|
@@ -285,17 +285,17 @@ const j = (n) => {
|
|
|
285
285
|
tabindex: "0",
|
|
286
286
|
role: "checkbox",
|
|
287
287
|
"aria-checked": r.control.value.toString(),
|
|
288
|
-
class:
|
|
288
|
+
class: A([{ "bg-dark-500": r.control.value, "bg-gray-200": !r.control.value }, "w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"]),
|
|
289
289
|
onKeydown: a
|
|
290
290
|
}, [
|
|
291
|
-
|
|
292
|
-
[
|
|
291
|
+
te(d("i", Be, null, 512), [
|
|
292
|
+
[oe, r.control.value]
|
|
293
293
|
])
|
|
294
|
-
], 42,
|
|
295
|
-
], 8,
|
|
294
|
+
], 42, Le)
|
|
295
|
+
], 8, Pe)
|
|
296
296
|
]));
|
|
297
297
|
}
|
|
298
|
-
}),
|
|
298
|
+
}), We = { class: "px-4 relative flex justify-between gap-4 items-center mb-2" }, je = ["value", "min", "max", "step"], Re = ["value", "min", "max", "step"], Ye = /* @__PURE__ */ S({
|
|
299
299
|
__name: "SliderControl",
|
|
300
300
|
props: {
|
|
301
301
|
label: {},
|
|
@@ -305,60 +305,60 @@ const j = (n) => {
|
|
|
305
305
|
setup(n, { emit: l }) {
|
|
306
306
|
const t = n;
|
|
307
307
|
function e(o) {
|
|
308
|
-
const { target:
|
|
309
|
-
l("change",
|
|
308
|
+
const { target: p } = o;
|
|
309
|
+
l("change", p.valueAsNumber);
|
|
310
310
|
}
|
|
311
|
-
const a =
|
|
311
|
+
const a = U(() => ({
|
|
312
312
|
backgroundImage: `linear-gradient(to right, #333 0% ${100 * (t.control.value - (t.control.min || 0)) / ((t.control.max || 100) - (t.control.min || 0))}%, #e2e2e2 0%)`
|
|
313
|
-
})), r =
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
|
|
317
|
-
},
|
|
318
|
-
return
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
|
|
313
|
+
})), r = J(), u = g(0), c = g(!1), f = (o) => {
|
|
314
|
+
u.value = o.clientX, c.value = !0;
|
|
315
|
+
}, h = () => {
|
|
316
|
+
c.value = !1;
|
|
317
|
+
}, i = (o) => Math.floor(Math.abs(o) / 10);
|
|
318
|
+
return V(r.x, (o) => {
|
|
319
|
+
if (c.value) {
|
|
320
|
+
const p = o - u.value, b = i(p);
|
|
321
|
+
p > 0 ? l("change", t.control.value + 1 + b) : p < 0 && l("change", t.control.value - 1 + b), t.control.min !== void 0 && t.control.value < t.control.min && l("change", t.control.min), t.control.max !== void 0 && t.control.value > t.control.max && l("change", t.control.max), u.value = o;
|
|
322
322
|
}
|
|
323
|
-
}), (o,
|
|
323
|
+
}), (o, p) => (v(), _("div", We, [
|
|
324
324
|
d("label", {
|
|
325
|
-
class:
|
|
325
|
+
class: A(["text-gray-500 w-1/3", { "flex justify-between items-center": o.control.icon }])
|
|
326
326
|
}, [
|
|
327
|
-
|
|
327
|
+
ve(M(o.label) + " ", 1),
|
|
328
328
|
d("i", {
|
|
329
|
-
class:
|
|
329
|
+
class: A(`i-${o.control.icon}`)
|
|
330
330
|
}, null, 2)
|
|
331
331
|
], 2),
|
|
332
332
|
d("input", {
|
|
333
333
|
value: o.control.value,
|
|
334
334
|
class: "w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",
|
|
335
|
-
style:
|
|
335
|
+
style: ge(a.value),
|
|
336
336
|
type: "range",
|
|
337
337
|
min: o.control.min,
|
|
338
338
|
max: o.control.max,
|
|
339
339
|
step: o.control.step,
|
|
340
340
|
onInput: e
|
|
341
|
-
}, null, 44,
|
|
341
|
+
}, null, 44, je),
|
|
342
342
|
d("input", {
|
|
343
343
|
value: o.control.value,
|
|
344
|
-
class:
|
|
344
|
+
class: A(["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 }]),
|
|
345
345
|
type: "number",
|
|
346
346
|
min: o.control.min,
|
|
347
347
|
max: o.control.max,
|
|
348
348
|
step: o.control.step,
|
|
349
349
|
onInput: e,
|
|
350
|
-
onMousedown:
|
|
351
|
-
onMouseup:
|
|
352
|
-
}, null, 42,
|
|
350
|
+
onMousedown: f,
|
|
351
|
+
onMouseup: h
|
|
352
|
+
}, null, 42, Re)
|
|
353
353
|
]));
|
|
354
354
|
}
|
|
355
355
|
});
|
|
356
|
-
const
|
|
356
|
+
const He = (n, l) => {
|
|
357
357
|
const t = n.__vccOpts || n;
|
|
358
358
|
for (const [e, a] of l)
|
|
359
359
|
t[e] = a;
|
|
360
360
|
return t;
|
|
361
|
-
},
|
|
361
|
+
}, Ge = /* @__PURE__ */ He(Ye, [["__scopeId", "data-v-9e6267fe"]]), Je = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Qe = { class: "text-gray-500 w-1/3" }, Ze = ["id", "value", "aria-label"], en = ["id", "aria-label", "value"], nn = /* @__PURE__ */ S({
|
|
362
362
|
__name: "ColorControl",
|
|
363
363
|
props: {
|
|
364
364
|
label: {},
|
|
@@ -370,17 +370,17 @@ const je = (n, l) => {
|
|
|
370
370
|
const { target: a } = e;
|
|
371
371
|
l("change", a.value);
|
|
372
372
|
}
|
|
373
|
-
return (e, a) => (v(), _("div",
|
|
374
|
-
d("label",
|
|
373
|
+
return (e, a) => (v(), _("div", Je, [
|
|
374
|
+
d("label", Qe, M(e.label), 1),
|
|
375
375
|
d("input", {
|
|
376
376
|
id: e.control.uniqueKey,
|
|
377
377
|
tabindex: "0",
|
|
378
378
|
value: e.control.value,
|
|
379
379
|
"aria-label": e.label,
|
|
380
|
-
class:
|
|
380
|
+
class: A(["focus:outline-none focus:ring-2 focus:ring-blue-600", { "important-outline-gray-200": e.control.value === "#ffffff" }]),
|
|
381
381
|
type: "color",
|
|
382
382
|
onInput: t
|
|
383
|
-
}, null, 42,
|
|
383
|
+
}, null, 42, Ze),
|
|
384
384
|
d("input", {
|
|
385
385
|
id: e.control.uniqueKey,
|
|
386
386
|
tabindex: "0",
|
|
@@ -389,29 +389,29 @@ const je = (n, l) => {
|
|
|
389
389
|
class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 border-none font-sans",
|
|
390
390
|
type: "text",
|
|
391
391
|
onInput: t
|
|
392
|
-
}, null, 40,
|
|
392
|
+
}, null, 40, en)
|
|
393
393
|
]));
|
|
394
394
|
}
|
|
395
395
|
});
|
|
396
|
-
function
|
|
396
|
+
function tn(n) {
|
|
397
397
|
if (typeof n == "number")
|
|
398
398
|
return [n, n, n];
|
|
399
|
-
if (
|
|
399
|
+
if (ue(n)) {
|
|
400
400
|
const { x: l, y: t, z: e } = n;
|
|
401
401
|
return [l, t, e];
|
|
402
402
|
}
|
|
403
403
|
return n;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function on(n) {
|
|
406
406
|
return n && typeof n.x == "number" && typeof n.y == "number" && typeof n.z > "u";
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function ue(n) {
|
|
409
409
|
return n && typeof n.x == "number" && typeof n.y == "number" && typeof n.z == "number";
|
|
410
410
|
}
|
|
411
|
-
const
|
|
411
|
+
const ln = { class: "text-gray-500 w-1/3" }, an = { class: "relative w-2/3 flex justify-between gap-0.5" }, rn = {
|
|
412
412
|
key: 0,
|
|
413
413
|
class: "font-bold px-1 py-1 text-0.65rem text-gray-300"
|
|
414
|
-
},
|
|
414
|
+
}, sn = ["id", "step", "value", "onInput", "onMousedown", "onMouseup", "onFocus"], un = /* @__PURE__ */ S({
|
|
415
415
|
__name: "VectorControl",
|
|
416
416
|
props: {
|
|
417
417
|
label: {},
|
|
@@ -419,67 +419,83 @@ const en = { class: "text-gray-500 w-1/3" }, nn = { class: "w-2/3 flex justify-b
|
|
|
419
419
|
},
|
|
420
420
|
emits: ["change"],
|
|
421
421
|
setup(n, { emit: l }) {
|
|
422
|
-
const t = n, e =
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
422
|
+
const t = n, e = J(), { pressed: a } = _e(), r = g(0), u = g(!1), c = g(0), f = g(null), h = g(1), i = Q("Shift"), o = Q("Alt");
|
|
423
|
+
V(i, (s) => {
|
|
424
|
+
h.value = s ? 10 : 1;
|
|
425
|
+
}), V(o, (s) => {
|
|
426
|
+
h.value = s ? 0.1 : 1;
|
|
427
|
+
});
|
|
428
|
+
const p = (s) => {
|
|
429
|
+
f.value = s;
|
|
430
|
+
}, b = () => {
|
|
431
|
+
f.value = null;
|
|
432
|
+
}, D = (s, x) => {
|
|
433
|
+
c.value = x, r.value = s.clientX, u.value = !0;
|
|
434
|
+
}, y = (s, x) => {
|
|
435
|
+
c.value = x, u.value = !1;
|
|
436
|
+
}, K = () => {
|
|
437
|
+
u.value = !1;
|
|
438
|
+
};
|
|
439
|
+
V(a, (s) => {
|
|
440
|
+
s || (u.value = !1);
|
|
441
|
+
});
|
|
442
|
+
const I = (s) => Math.floor(Math.abs(s) / 10), w = U(() => tn(t.control.value)), $ = g(["x", "y", "z"]), X = U(() => on(t.control.value) || ue(t.control.value));
|
|
443
|
+
function R(s, x) {
|
|
444
|
+
const { value: C } = t.control, { target: m } = s;
|
|
445
|
+
c.value = x, C[X.value ? $.value[c.value] : c.value] = parseFloat(m.value), l("change", C);
|
|
432
446
|
}
|
|
433
|
-
return
|
|
434
|
-
if (
|
|
435
|
-
const
|
|
436
|
-
|
|
447
|
+
return V(e.x, (s) => {
|
|
448
|
+
if (u.value) {
|
|
449
|
+
const x = s - r.value, C = I(x), { value: m } = t.control, T = X.value ? $.value[c.value] : c.value;
|
|
450
|
+
x > 0 ? m[T] += h.value + C : x < 0 && (m[T] -= h.value + C), t.control.min !== void 0 && m < t.control.min && (m[T] = t.control.min), t.control.max !== void 0 && m > t.control.max && (m[T] = t.control.max), l("change", m), r.value = s;
|
|
437
451
|
}
|
|
438
|
-
}), (s,
|
|
452
|
+
}), (s, x) => (v(), _("div", {
|
|
439
453
|
class: "flex px-4 justify-between gap-1 items-center mb-2",
|
|
440
|
-
onMouseup:
|
|
454
|
+
onMouseup: x[0] || (x[0] = (C) => K())
|
|
441
455
|
}, [
|
|
442
|
-
d("label",
|
|
443
|
-
d("div",
|
|
444
|
-
(v(!0), _(
|
|
445
|
-
key: s.label +
|
|
446
|
-
class: "flex items-center w-1/3 bg-gray-100 rounded"
|
|
456
|
+
d("label", ln, M(s.label), 1),
|
|
457
|
+
d("div", an, [
|
|
458
|
+
(v(!0), _(q, null, B(w.value, (C, m) => (v(), _("div", {
|
|
459
|
+
key: s.label + m,
|
|
460
|
+
class: A(["flex items-center w-1/3 bg-gray-100 rounded", { "w-2/5": f.value === m }])
|
|
447
461
|
}, [
|
|
448
|
-
|
|
462
|
+
$.value[m] && X.value ? (v(), _("span", rn, M($.value[m]), 1)) : j("", !0),
|
|
449
463
|
d("input", {
|
|
450
|
-
id: `${s.control.uniqueKey}-${
|
|
464
|
+
id: `${s.control.uniqueKey}-${$.value[m]}`,
|
|
451
465
|
type: "number",
|
|
452
|
-
step:
|
|
453
|
-
class:
|
|
454
|
-
value:
|
|
455
|
-
onInput: (
|
|
456
|
-
onMousedown: (
|
|
457
|
-
onMouseup: (
|
|
458
|
-
|
|
459
|
-
|
|
466
|
+
step: h.value,
|
|
467
|
+
class: A(["w-full px-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans appearence-none", { "cursor-ew-resize": u.value }]),
|
|
468
|
+
value: w.value[m].toFixed(2),
|
|
469
|
+
onInput: (T) => R(T, m),
|
|
470
|
+
onMousedown: (T) => D(T, m),
|
|
471
|
+
onMouseup: (T) => y(T, m),
|
|
472
|
+
onFocus: (T) => p(m),
|
|
473
|
+
onBlur: b
|
|
474
|
+
}, null, 42, sn)
|
|
475
|
+
], 2))), 128))
|
|
460
476
|
])
|
|
461
477
|
], 32));
|
|
462
478
|
}
|
|
463
|
-
}),
|
|
479
|
+
}), cn = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, dn = { class: "text-gray-500 w-1/3" }, fn = { 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" }, pn = { class: "absolute bottom-0.5 right-0.5 font-sans text-xs" }, vn = ["points"], Z = 160, G = 40, P = 2, ee = 100, ne = 20, gn = /* @__PURE__ */ S({
|
|
464
480
|
__name: "FPSGraph",
|
|
465
481
|
props: {
|
|
466
482
|
label: {},
|
|
467
483
|
control: {}
|
|
468
484
|
},
|
|
469
485
|
setup(n) {
|
|
470
|
-
const l =
|
|
486
|
+
const l = xe({ every: ee }), t = g(""), e = g([]), a = g(Z / P);
|
|
471
487
|
let r = performance.now();
|
|
472
|
-
return
|
|
473
|
-
|
|
474
|
-
(
|
|
488
|
+
return we(({ timestamp: u }) => {
|
|
489
|
+
u - r >= ee && (r = u, e.value.push(l.value), e.value.length > a.value && e.value.shift(), t.value = e.value.map(
|
|
490
|
+
(c, f) => `${f * P},${G + ne - P / 2 - c * (G + ne - P) / 120}`
|
|
475
491
|
).join(" "));
|
|
476
|
-
}), (
|
|
477
|
-
d("label",
|
|
478
|
-
d("div",
|
|
479
|
-
d("div",
|
|
492
|
+
}), (u, c) => (v(), _("div", cn, [
|
|
493
|
+
d("label", dn, M(u.label), 1),
|
|
494
|
+
d("div", fn, [
|
|
495
|
+
d("div", pn, M(Math.round(F(l))) + " FPS ", 1),
|
|
480
496
|
(v(), _("svg", {
|
|
481
|
-
width:
|
|
482
|
-
height:
|
|
497
|
+
width: Z,
|
|
498
|
+
height: G,
|
|
483
499
|
xmlns: "http://www.w3.org/2000/svg",
|
|
484
500
|
class: "bg-gray-100"
|
|
485
501
|
}, [
|
|
@@ -487,15 +503,15 @@ const en = { class: "text-gray-500 w-1/3" }, nn = { class: "w-2/3 flex justify-b
|
|
|
487
503
|
points: t.value,
|
|
488
504
|
fill: "none",
|
|
489
505
|
stroke: "lightgray",
|
|
490
|
-
"stroke-width":
|
|
506
|
+
"stroke-width": P,
|
|
491
507
|
"stroke-linecap": "round",
|
|
492
508
|
"stroke-linejoin": "round"
|
|
493
|
-
}, null, 8,
|
|
509
|
+
}, null, 8, vn)
|
|
494
510
|
]))
|
|
495
511
|
])
|
|
496
512
|
]));
|
|
497
513
|
}
|
|
498
|
-
}),
|
|
514
|
+
}), yn = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, hn = ["for"], bn = ["id", "value"], mn = ["value"], _n = /* @__PURE__ */ S({
|
|
499
515
|
__name: "SelectControl",
|
|
500
516
|
props: {
|
|
501
517
|
label: {},
|
|
@@ -506,25 +522,25 @@ const en = { class: "text-gray-500 w-1/3" }, nn = { class: "w-2/3 flex justify-b
|
|
|
506
522
|
function t(e) {
|
|
507
523
|
l("change", e.target.value);
|
|
508
524
|
}
|
|
509
|
-
return (e, a) => (v(), _("div",
|
|
525
|
+
return (e, a) => (v(), _("div", yn, [
|
|
510
526
|
d("label", {
|
|
511
527
|
class: "text-gray-500 w-1/3",
|
|
512
528
|
for: e.control.uniqueKey
|
|
513
|
-
},
|
|
529
|
+
}, M(e.label), 9, hn),
|
|
514
530
|
d("select", {
|
|
515
531
|
id: e.control.uniqueKey,
|
|
516
532
|
value: e.control.value,
|
|
517
533
|
class: "p-2 w-2/3 rounded text-left text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
|
|
518
534
|
onChange: t
|
|
519
535
|
}, [
|
|
520
|
-
(v(!0), _(
|
|
536
|
+
(v(!0), _(q, null, B(e.control.options, (r) => (v(), _("option", {
|
|
521
537
|
key: r.value,
|
|
522
538
|
value: r.value
|
|
523
|
-
},
|
|
524
|
-
], 40,
|
|
539
|
+
}, M(r.text), 9, mn))), 128))
|
|
540
|
+
], 40, bn)
|
|
525
541
|
]));
|
|
526
542
|
}
|
|
527
|
-
}),
|
|
543
|
+
}), ce = /* @__PURE__ */ S({
|
|
528
544
|
__name: "ControlInput",
|
|
529
545
|
props: {
|
|
530
546
|
control: {}
|
|
@@ -534,53 +550,53 @@ const en = { class: "text-gray-500 w-1/3" }, nn = { class: "w-2/3 flex justify-b
|
|
|
534
550
|
function t(e) {
|
|
535
551
|
l("change", e);
|
|
536
552
|
}
|
|
537
|
-
return (e, a) => e.control.visible ? (v(), _(
|
|
538
|
-
e.control.type === "color" ? (v(),
|
|
553
|
+
return (e, a) => e.control.visible ? (v(), _(q, { key: 0 }, [
|
|
554
|
+
e.control.type === "color" ? (v(), k(nn, {
|
|
539
555
|
key: 0,
|
|
540
556
|
label: e.control.label,
|
|
541
557
|
control: e.control,
|
|
542
558
|
onChange: t
|
|
543
|
-
}, null, 8, ["label", "control"])) : e.control.type === "select" ? (v(),
|
|
559
|
+
}, null, 8, ["label", "control"])) : e.control.type === "select" ? (v(), k(_n, {
|
|
544
560
|
key: 1,
|
|
545
561
|
label: e.control.label,
|
|
546
562
|
control: e.control,
|
|
547
563
|
onChange: t
|
|
548
|
-
}, null, 8, ["label", "control"])) : e.control.type === "vector" ? (v(),
|
|
564
|
+
}, null, 8, ["label", "control"])) : e.control.type === "vector" ? (v(), k(un, {
|
|
549
565
|
key: 2,
|
|
550
566
|
label: e.control.label,
|
|
551
567
|
control: e.control,
|
|
552
568
|
onChange: t
|
|
553
|
-
}, null, 8, ["label", "control"])) : e.control.type === "boolean" ? (v(),
|
|
569
|
+
}, null, 8, ["label", "control"])) : e.control.type === "boolean" ? (v(), k(Ne, {
|
|
554
570
|
key: 3,
|
|
555
571
|
label: e.control.label,
|
|
556
572
|
control: e.control,
|
|
557
573
|
onChange: t
|
|
558
|
-
}, null, 8, ["label", "control"])) : e.control.type === "fpsgraph" ? (v(),
|
|
574
|
+
}, null, 8, ["label", "control"])) : e.control.type === "fpsgraph" ? (v(), k(gn, {
|
|
559
575
|
key: 4,
|
|
560
576
|
label: e.control.label,
|
|
561
577
|
control: e.control
|
|
562
|
-
}, null, 8, ["label", "control"])) : e.control.type === "number" ? (v(),
|
|
578
|
+
}, null, 8, ["label", "control"])) : e.control.type === "number" ? (v(), k(Fe, {
|
|
563
579
|
key: 5,
|
|
564
580
|
label: e.control.label,
|
|
565
581
|
control: e.control,
|
|
566
582
|
onChange: t
|
|
567
|
-
}, null, 8, ["label", "control"])) : e.control.type === "range" ? (v(),
|
|
583
|
+
}, null, 8, ["label", "control"])) : e.control.type === "range" ? (v(), k(Ge, {
|
|
568
584
|
key: 6,
|
|
569
585
|
label: e.control.label,
|
|
570
586
|
control: e.control,
|
|
571
587
|
onChange: t
|
|
572
|
-
}, null, 8, ["label", "control"])) : (v(),
|
|
588
|
+
}, null, 8, ["label", "control"])) : (v(), k(Ue, {
|
|
573
589
|
key: 7,
|
|
574
590
|
label: e.control.label,
|
|
575
591
|
control: e.control,
|
|
576
592
|
onChange: t
|
|
577
593
|
}, null, 8, ["label", "control"]))
|
|
578
|
-
], 64)) :
|
|
594
|
+
], 64)) : j("", !0);
|
|
579
595
|
}
|
|
580
|
-
}),
|
|
596
|
+
}), xn = { class: "mb-4" }, wn = ["aria-expanded", "data-folder"], $n = {
|
|
581
597
|
class: "bg-white rounded-b pt-4",
|
|
582
598
|
role: "menu"
|
|
583
|
-
},
|
|
599
|
+
}, Cn = /* @__PURE__ */ S({
|
|
584
600
|
__name: "Folder",
|
|
585
601
|
props: {
|
|
586
602
|
controls: {},
|
|
@@ -590,10 +606,10 @@ const en = { class: "text-gray-500 w-1/3" }, nn = { class: "w-2/3 flex justify-b
|
|
|
590
606
|
function l(a, r) {
|
|
591
607
|
r.value = a;
|
|
592
608
|
}
|
|
593
|
-
const t =
|
|
609
|
+
const t = g(!1), e = () => {
|
|
594
610
|
t.value = !t.value;
|
|
595
611
|
};
|
|
596
|
-
return (a, r) => (v(), _("div",
|
|
612
|
+
return (a, r) => (v(), _("div", xn, [
|
|
597
613
|
d("button", {
|
|
598
614
|
class: "flex items-center justify-between w-full py-2 px-4 bg-gray-100 border-none text-gray-400 font-bold text-xs font-sans cursor-pointer",
|
|
599
615
|
"aria-expanded": t.value,
|
|
@@ -603,85 +619,85 @@ const en = { class: "text-gray-500 w-1/3" }, nn = { class: "w-2/3 flex justify-b
|
|
|
603
619
|
tabindex: "0",
|
|
604
620
|
onClick: e
|
|
605
621
|
}, [
|
|
606
|
-
d("span", null,
|
|
622
|
+
d("span", null, M(a.label), 1),
|
|
607
623
|
d("i", {
|
|
608
|
-
class:
|
|
624
|
+
class: A(t.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
|
|
609
625
|
}, null, 2)
|
|
610
|
-
], 8,
|
|
611
|
-
|
|
626
|
+
], 8, wn),
|
|
627
|
+
ye(he, {
|
|
612
628
|
name: "slide",
|
|
613
629
|
"enter-active-class": " animate-fade-in animate-duration-200 animate-ease-in-out",
|
|
614
630
|
"leave-active-class": " animate-fade-out animate-duration-200 animate-ease-in-out"
|
|
615
631
|
}, {
|
|
616
|
-
default:
|
|
617
|
-
|
|
618
|
-
(v(!0), _(
|
|
619
|
-
key:
|
|
620
|
-
control:
|
|
632
|
+
default: le(() => [
|
|
633
|
+
te(d("div", $n, [
|
|
634
|
+
(v(!0), _(q, null, B(a.controls, (u) => (v(), k(ce, {
|
|
635
|
+
key: u.label,
|
|
636
|
+
control: u,
|
|
621
637
|
role: "menuitem",
|
|
622
|
-
onChange: (
|
|
638
|
+
onChange: (c) => l(c, u)
|
|
623
639
|
}, null, 8, ["control", "onChange"]))), 128))
|
|
624
640
|
], 512), [
|
|
625
|
-
[
|
|
641
|
+
[oe, t.value]
|
|
626
642
|
])
|
|
627
643
|
]),
|
|
628
644
|
_: 1
|
|
629
645
|
})
|
|
630
646
|
]));
|
|
631
647
|
}
|
|
632
|
-
}),
|
|
648
|
+
}), kn = {
|
|
633
649
|
tabindex: "0",
|
|
634
650
|
class: "bg-white shadow-xl rounded border-4 border-solid border-black"
|
|
635
|
-
},
|
|
651
|
+
}, Mn = /* @__PURE__ */ d("i", { class: "h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs" }, "🍰", -1), Sn = /* @__PURE__ */ d("div", null, [
|
|
636
652
|
/* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" }),
|
|
637
653
|
/* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" }),
|
|
638
654
|
/* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" })
|
|
639
|
-
], -1),
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
],
|
|
655
|
+
], -1), Kn = /* @__PURE__ */ d("div", null, null, -1), Tn = [
|
|
656
|
+
Mn,
|
|
657
|
+
Sn,
|
|
658
|
+
Kn
|
|
659
|
+
], An = 280, En = /* @__PURE__ */ S({
|
|
644
660
|
__name: "TresLeches",
|
|
645
661
|
props: {
|
|
646
662
|
uuid: {}
|
|
647
663
|
},
|
|
648
664
|
setup(n) {
|
|
649
|
-
const l = n, { uuid: t } =
|
|
650
|
-
function
|
|
651
|
-
r[
|
|
665
|
+
const l = n, { uuid: t } = z(l), { width: e } = ae(), a = g(null), r = Ke(t == null ? void 0 : t.value);
|
|
666
|
+
function u(f, h) {
|
|
667
|
+
r[F(f)].value = h, r[F(f)][F(f)] = h;
|
|
652
668
|
}
|
|
653
|
-
const
|
|
654
|
-
const
|
|
655
|
-
for (const
|
|
656
|
-
const
|
|
657
|
-
|
|
669
|
+
const c = U(() => {
|
|
670
|
+
const f = {};
|
|
671
|
+
for (const h in r) {
|
|
672
|
+
const i = r[h], o = i.folder || "default";
|
|
673
|
+
f[o] || (f[o] = []), f[o].push(i);
|
|
658
674
|
}
|
|
659
|
-
return
|
|
675
|
+
return f;
|
|
660
676
|
});
|
|
661
|
-
return (
|
|
662
|
-
id:
|
|
663
|
-
"initial-value": { x:
|
|
664
|
-
class:
|
|
677
|
+
return (f, h) => (v(), k(F(Me), {
|
|
678
|
+
id: F(t),
|
|
679
|
+
"initial-value": { x: F(e) - An - 40, y: 10 },
|
|
680
|
+
class: A(["absolute select-none z-24 w-280px font-sans text-xs", f.$attrs.class]),
|
|
665
681
|
handle: a.value
|
|
666
682
|
}, {
|
|
667
|
-
default:
|
|
668
|
-
d("div",
|
|
683
|
+
default: le(() => [
|
|
684
|
+
d("div", kn, [
|
|
669
685
|
d("header", {
|
|
670
686
|
ref_key: "handle",
|
|
671
687
|
ref: a,
|
|
672
688
|
class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
|
|
673
|
-
},
|
|
674
|
-
(v(!0), _(
|
|
675
|
-
o !== "default" ? (v(),
|
|
689
|
+
}, Tn, 512),
|
|
690
|
+
(v(!0), _(q, null, B(c.value, (i, o) => (v(), _(q, { key: o }, [
|
|
691
|
+
o !== "default" ? (v(), k(Cn, {
|
|
676
692
|
key: 0,
|
|
677
693
|
label: o,
|
|
678
|
-
controls:
|
|
679
|
-
}, null, 8, ["label", "controls"])) :
|
|
680
|
-
o === "default" ? (v(!0), _(
|
|
681
|
-
key:
|
|
682
|
-
control:
|
|
683
|
-
onChange: (
|
|
684
|
-
}, null, 8, ["control", "onChange"]))), 128)) :
|
|
694
|
+
controls: i
|
|
695
|
+
}, null, 8, ["label", "controls"])) : j("", !0),
|
|
696
|
+
o === "default" ? (v(!0), _(q, { key: 1 }, B(i, (p) => (v(), k(ce, {
|
|
697
|
+
key: p.label,
|
|
698
|
+
control: p,
|
|
699
|
+
onChange: (b) => u(p.key, b)
|
|
700
|
+
}, null, 8, ["control", "onChange"]))), 128)) : j("", !0)
|
|
685
701
|
], 64))), 128))
|
|
686
702
|
])
|
|
687
703
|
]),
|
|
@@ -690,7 +706,7 @@ const en = { class: "text-gray-500 w-1/3" }, nn = { class: "w-2/3 flex justify-b
|
|
|
690
706
|
}
|
|
691
707
|
});
|
|
692
708
|
export {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
709
|
+
En as TresLeches,
|
|
710
|
+
Fn as useControls,
|
|
711
|
+
Ke as useControlsProvider
|
|
696
712
|
};
|
package/dist/tresleches.umd.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/leches
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.12.0
|
|
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(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.tresleches={},w.Vue,w.VueUseCore))})(this,function(w,e,x){"use strict";const We="";function E(n){return typeof n=="function"?n():e.unref(n)}const T=typeof window<"u"&&typeof document<"u";function U(n,r={}){if(!e.isRef(n))return e.toRefs(n);const o=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const t in n.value)o[t]=e.customRef(()=>({get(){return n.value[t]},set(a){var s;if((s=E(r.replaceRef))!=null?s:!0)if(Array.isArray(n.value)){const f=[...n.value];f[t]=a,n.value=f}else{const f={...n.value,[t]:a};Object.setPrototypeOf(f,Object.getPrototypeOf(n.value)),n.value=f}else n.value[t]=a}}));return o}const O=T?window:void 0;function R(n,r={}){const{pointerTypes:o,preventDefault:t,stopPropagation:a,exact:s,onMove:c,onEnd:f,onStart:p,initialValue:_,axis:d="both",draggingElement:l=O,handle:u=n}=r,{width:y}=x.useWindowSize();let C=y.value;const i=e.ref(E(_)??{x:0,y:0});e.watch(y,()=>{const g=y.value-C;i.value.x+=g,C=y.value});const h=e.ref(),k=g=>o?o.includes(g.pointerType):!0,m=g=>{E(t)&&g.preventDefault(),E(a)&&g.stopPropagation()},b=g=>{if(!k(g)||E(s)&&g.target!==E(n))return;const $=E(n).getBoundingClientRect(),N={x:g.clientX-$.left,y:g.clientY-$.top};(p==null?void 0:p(N,g))!==!1&&(h.value=N,m(g))},Xe=g=>{if(!k(g)||!h.value)return;let{x:$,y:N}=i.value;(d==="x"||d==="both")&&($=g.clientX-h.value.x),(d==="y"||d==="both")&&(N=g.clientY-h.value.y),i.value={x:$,y:N},c==null||c(i.value,g),m(g)},je=g=>{k(g)&&h.value&&(h.value=void 0,f==null||f(i.value,g),m(g))};if(T){const g={capture:r.capture??!0};x.useEventListener(u,"pointerdown",b,g),x.useEventListener(l,"pointermove",Xe,g),x.useEventListener(l,"pointerup",je,g)}return{...U(i),position:i,isDragging:e.computed(()=>!!h.value),style:e.computed(()=>`left:${i.value.x}px;top:${i.value.y}px;`)}}const P=e.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd"],setup(n,{slots:r}){const o=e.ref(),t=e.computed(()=>n.handle??o.value),a=n.storageKey&&x.useStorage(n.storageKey,E(n.initialValue)||{x:0,y:0},x.isClient?n.storageType==="session"?sessionStorage:localStorage:void 0),s=a||n.initialValue||{x:0,y:0},c=(p,_)=>{var d;(d=n.onEnd)==null||d.call(n,p,_),a&&(a.value.x=p.x,a.value.y=p.y)},f=e.reactive(R(o,{...n,handle:t,initialValue:s,onEnd:c}));return()=>{if(r.default)return e.h(n.as||"div",{ref:o,style:`touch-action:none;${f.style}`},r.default(f))}}}),X=Symbol("CONTROLS_CONTEXT_KEY"),F="default",B=e.reactive({});function z(n=F){return e.provide(X,B),B[n]}const D=n=>{const r=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;return typeof n=="boolean"?"boolean":typeof n=="number"?"number":typeof n=="string"&&r.test(n)?"color":typeof n=="string"?"string":n.isVector3||n.isVector2||n.isEuler||n instanceof Array?"vector":n.min!==void 0||n.max!==void 0||n.step!==void 0?"range":n.options&&Array.isArray(n.options)?"select":"unknown"},S=(n,r,o,t)=>{const a={key:e.ref(n),label:e.ref(n),name:e.ref(n),type:e.ref(o),value:e.ref(r),visible:e.ref(!0),[n]:e.ref(r)};return t&&(a.folder=e.ref(t)),a},j=(n,r)=>{let o=1,t=`${n}_${o}`;for(;r[t];)o++,t=`${n}_${o}`;return t},W=(n,r,o)=>{const t={},a=typeof n=="string"?n:null,s=a?r:n,c=a&&a!=="fpsgraph"?o:r,f=(c==null?void 0:c.uuid)||F;if(B[f]||(B[f]=e.reactive({})),n==="fpsgraph"){const l=S("fpsgraph",null,"fpsgraph",null);return B[f].fpsgraph=l,t.fpsgraph=l,e.toRefs(e.reactive(t))}const p=B[f],_=e.isReactive(s),d=_?e.toRefs(s):{};for(const l in s){let u=s[l],y=l;if(_&&d[l]&&(u=d[l]),a&&(y=`${a}${l.charAt(0).toUpperCase()+l.slice(1)}`),!a&&p[y]&&(y=j(l,p)),typeof u=="object"&&!e.isRef(u)&&!Array.isArray(u)&&u.value!==void 0){const i=u,h=e.isRef(i.value)?i.value:e.ref(i.value),k=D(i),m=S(l,h,k,a);k==="select"&&(m.options=e.ref(i.options.map(b=>typeof b=="object"&&b.text&&b.value?b:{text:b,value:b}))),k==="range"&&(m.min=e.ref(i.min||0),m.max=e.ref(i.max||1),m.step=e.ref(i.step||.1)),m.label.value=i.label||l,m.visible.value=i.visible!==void 0?i.visible:!0,p[y]=m,t[y]=m;continue}if(e.isRef(u)){const i=S(l,u,D(u.value),a);p[y]=i,t[y]=i;continue}else if(typeof u=="object"&&!Array.isArray(u)){const i=e.toRefs(u);i[l]&&(u=i[l])}const C=S(l,u,D(u),a);p[y]=C,t[y]=C,C.uniqueKey=y}return Object.keys(t).length>1?e.toRefs(e.reactive(t)):Object.values(t)[0]},Y={class:"flex px-4 justify-between gap-4 items-center mb-2"},H=["for"],v=["id","value","min","max","step"],G=e.defineComponent({__name:"NumberControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){const o=n;function t(d){const{target:l}=d;r("change",l.valueAsNumber)}const a=x.useMouse(),s=e.ref(0),c=e.ref(!1),f=d=>{s.value=d.clientX,c.value=!0},p=()=>{c.value=!1},_=d=>Math.floor(Math.abs(d)/10);return e.watch(a.x,d=>{if(c.value){const l=d-s.value,u=_(l);l>0?r("change",o.control.value+1+u):l<0&&r("change",o.control.value-1+u),o.control.min!==void 0&&o.control.value<o.control.min&&r("change",o.control.min),o.control.max!==void 0&&o.control.value>o.control.max&&r("change",o.control.max),s.value=d}}),(d,l)=>(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("label",{class:"text-gray-500 w-1/3",for:d.control.uniqueKey},e.toDisplayString(d.label),9,H),e.createElementVNode("input",{id:d.control.uniqueKey,value:d.control.value,class:e.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":c.value}]),type:"number",min:d.control.min,max:d.control.max,step:d.control.step,onInput:t,onMousedown:f,onMouseup:p},null,42,v)]))}}),J={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},Q=["for"],Z=["id","value","aria-label"],ee=e.defineComponent({__name:"TextControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){function o(t){const{target:a}=t;r("change",a.value)}return(t,a)=>(e.openBlock(),e.createElementBlock("div",J,[e.createElementVNode("label",{for:t.control.uniqueKey,class:"text-gray-500 w-1/3"},e.toDisplayString(t.label),9,Q),e.createElementVNode("input",{id:t.control.uniqueKey,value:t.control.value,type:"text",tabindex:"0",class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 border-none font-sans","aria-label":t.label,placeholder:"Enter value here...",onChange:o},null,40,Z)]))}}),te={class:"flex px-4 justify-start gap-2 items-center mb-2 min-h-32px"},ne={class:"text-gray-500 w-1/3"},oe=["id","checked"],le=["for"],re=["aria-checked"],ae={class:"i-ic:baseline-check text-light"},se=e.defineComponent({__name:"BooleanControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){const o=n;function t(s){const{target:c}=s;r("change",c.checked)}function a(s){(s.code==="Space"||s.code==="Enter")&&(s.preventDefault(),r("change",!o.control.value))}return(s,c)=>(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("label",ne,e.toDisplayString(s.label),1),e.createElementVNode("input",{id:s.control.uniqueKey,checked:s.control.value,class:"hidden",type:"checkbox",onInput:t},null,40,oe),e.createElementVNode("label",{for:s.control.uniqueKey,class:"inline-flex items-center cursor-pointer"},[e.createElementVNode("span",{tabindex:"0",role:"checkbox","aria-checked":s.control.value.toString(),class:e.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"]),onKeydown:a},[e.withDirectives(e.createElementVNode("i",ae,null,512),[[e.vShow,s.control.value]])],42,re)],8,le)]))}}),ce={class:"px-4 relative flex justify-between gap-4 items-center mb-2"},ie=["value","min","max","step"],de=["value","min","max","step"],ue=e.defineComponent({__name:"SliderControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){const o=n;function t(l){const{target:u}=l;r("change",u.valueAsNumber)}const a=e.computed(()=>({backgroundImage:`linear-gradient(to right, #333 0% ${100*(o.control.value-(o.control.min||0))/((o.control.max||100)-(o.control.min||0))}%, #e2e2e2 0%)`})),s=x.useMouse(),c=e.ref(0),f=e.ref(!1),p=l=>{c.value=l.clientX,f.value=!0},_=()=>{f.value=!1},d=l=>Math.floor(Math.abs(l)/10);return e.watch(s.x,l=>{if(f.value){const u=l-c.value,y=d(u);u>0?r("change",o.control.value+1+y):u<0&&r("change",o.control.value-1+y),o.control.min!==void 0&&o.control.value<o.control.min&&r("change",o.control.min),o.control.max!==void 0&&o.control.value>o.control.max&&r("change",o.control.max),c.value=l}}),(l,u)=>(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("label",{class:e.normalizeClass(["text-gray-500 w-1/3",{"flex justify-between items-center":l.control.icon}])},[e.createTextVNode(e.toDisplayString(l.label)+" ",1),e.createElementVNode("i",{class:e.normalizeClass(`i-${l.control.icon}`)},null,2)],2),e.createElementVNode("input",{value:l.control.value,class:"w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",style:e.normalizeStyle(a.value),type:"range",min:l.control.min,max:l.control.max,step:l.control.step,onInput:t},null,44,ie),e.createElementVNode("input",{value:l.control.value,class:e.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":f.value}]),type:"number",min:l.control.min,max:l.control.max,step:l.control.step,onInput:t,onMousedown:p,onMouseup:_},null,42,de)]))}}),Ye="",fe=((n,r)=>{const o=n.__vccOpts||n;for(const[t,a]of r)o[t]=a;return o})(ue,[["__scopeId","data-v-9e6267fe"]]),pe={class:"flex px-4 justify-between gap-4 items-center mb-2"},me={class:"text-gray-500 w-1/3"},ge=["id","value","aria-label"],ye=["id","aria-label","value"],he=e.defineComponent({__name:"ColorControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){function o(t){const{target:a}=t;r("change",a.value)}return(t,a)=>(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("label",me,e.toDisplayString(t.label),1),e.createElementVNode("input",{id:t.control.uniqueKey,tabindex:"0",value:t.control.value,"aria-label":t.label,class:e.normalizeClass(["focus:outline-none focus:ring-2 focus:ring-blue-600",{"important-outline-gray-200":t.control.value==="#ffffff"}]),type:"color",onInput:o},null,42,ge),e.createElementVNode("input",{id:t.control.uniqueKey,tabindex:"0","aria-label":t.label,value:t.control.value,class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 border-none font-sans",type:"text",onInput:o},null,40,ye)]))}}),ve="";function be(n){if(typeof n=="number")return[n,n,n];if(A(n)){const{x:r,y:o,z:t}=n;return[r,o,t]}return n}function _e(n){return n&&typeof n.x=="number"&&typeof n.y=="number"&&typeof n.z>"u"}function A(n){return n&&typeof n.x=="number"&&typeof n.y=="number"&&typeof n.z=="number"}const ke={class:"text-gray-500 w-1/3"},xe={class:"w-2/3 flex justify-between gap-0.5"},we={key:0,class:"font-bold px-1 py-1 text-0.65rem text-gray-300"},Ee=["id","value","onInput","onMousedown","onMouseup"],Ce=e.defineComponent({__name:"VectorControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){const o=n,t=x.useMouse(),a=e.ref(0),s=e.ref(!1),c=e.ref(0),f=(i,h)=>{c.value=h,a.value=i.clientX,s.value=!0},p=(i,h)=>{c.value=h,s.value=!1},_=()=>{s.value=!1},d=i=>Math.floor(Math.abs(i)/10),l=e.computed(()=>be(o.control.value)),u=e.ref(["x","y","z"]),y=e.computed(()=>_e(o.control.value)||A(o.control.value));function C(i,h){const{value:k}=o.control,{target:m}=i;c.value=h,k[y.value?u.value[c.value]:c.value]=parseFloat(m.value),r("change",k)}return e.watch(t.x,i=>{if(s.value){const h=i-a.value,k=d(h),{value:m}=o.control,b=y.value?u.value[c.value]:c.value;h>0?m[b]+=.1+k:h<0&&(m[b]-=.1+k),o.control.min!==void 0&&m<o.control.min&&(m[b]=o.control.min),o.control.max!==void 0&&m>o.control.max&&(m[b]=o.control.max),r("change",m),a.value=i}}),(i,h)=>(e.openBlock(),e.createElementBlock("div",{class:"flex px-4 justify-between gap-1 items-center mb-2",onMouseup:h[0]||(h[0]=k=>_())},[e.createElementVNode("label",ke,e.toDisplayString(i.label),1),e.createElementVNode("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(k,m)=>(e.openBlock(),e.createElementBlock("div",{key:i.label+m,class:"flex items-center w-1/3 bg-gray-100 rounded"},[u.value[m]&&y.value?(e.openBlock(),e.createElementBlock("span",we,e.toDisplayString(u.value[m]),1)):e.createCommentVNode("",!0),e.createElementVNode("input",{id:`${i.control.uniqueKey}-${u.value[m]}`,type:"number",step:"0.1",class:e.normalizeClass(["w-full px-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans appearence-none",{"cursor-ew-resize":s.value}]),value:l.value[m].toFixed(2),onInput:b=>C(b,m),onMousedown:b=>f(b,m),onMouseup:b=>p(b,m)},null,42,Ee)]))),128))])],32))}}),Be={class:"flex px-4 justify-between gap-4 items-center mb-2"},Ve={class:"text-gray-500 w-1/3"},$e={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"},Ne={class:"absolute bottom-0.5 right-0.5 font-sans text-xs"},Se=["points"],I=160,M=40,V=2,K=100,q=20,De=e.defineComponent({__name:"FPSGraph",props:{label:{},control:{}},setup(n){const r=x.useFps({every:K}),o=e.ref(""),t=e.ref([]),a=e.ref(I/V);let s=performance.now();return x.useRafFn(({timestamp:c})=>{c-s>=K&&(s=c,t.value.push(r.value),t.value.length>a.value&&t.value.shift(),o.value=t.value.map((f,p)=>`${p*V},${M+q-V/2-f*(M+q-V)/120}`).join(" "))}),(c,f)=>(e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("label",Ve,e.toDisplayString(c.label),1),e.createElementVNode("div",$e,[e.createElementVNode("div",Ne,e.toDisplayString(Math.round(e.unref(r)))+" FPS ",1),(e.openBlock(),e.createElementBlock("svg",{width:I,height:M,xmlns:"http://www.w3.org/2000/svg",class:"bg-gray-100"},[e.createElementVNode("polyline",{points:o.value,fill:"none",stroke:"lightgray","stroke-width":V,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,Se)]))])]))}}),Me={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},Te=["for"],Fe=["id","value"],ze=["value"],Ae=e.defineComponent({__name:"SelectControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){function o(t){r("change",t.target.value)}return(t,a)=>(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("label",{class:"text-gray-500 w-1/3",for:t.control.uniqueKey},e.toDisplayString(t.label),9,Te),e.createElementVNode("select",{id:t.control.uniqueKey,value:t.control.value,class:"p-2 w-2/3 rounded text-left text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",onChange:o},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.control.options,s=>(e.openBlock(),e.createElementBlock("option",{key:s.value,value:s.value},e.toDisplayString(s.text),9,ze))),128))],40,Fe)]))}}),L=e.defineComponent({__name:"ControlInput",props:{control:{}},emits:["change"],setup(n,{emit:r}){function o(t){r("change",t)}return(t,a)=>t.control.visible?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.control.type==="color"?(e.openBlock(),e.createBlock(he,{key:0,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="select"?(e.openBlock(),e.createBlock(Ae,{key:1,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="vector"?(e.openBlock(),e.createBlock(Ce,{key:2,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="boolean"?(e.openBlock(),e.createBlock(se,{key:3,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="fpsgraph"?(e.openBlock(),e.createBlock(De,{key:4,label:t.control.label,control:t.control},null,8,["label","control"])):t.control.type==="number"?(e.openBlock(),e.createBlock(G,{key:5,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="range"?(e.openBlock(),e.createBlock(fe,{key:6,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):(e.openBlock(),e.createBlock(ee,{key:7,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"]))],64)):e.createCommentVNode("",!0)}}),Ie={class:"mb-4"},Ke=["aria-expanded","data-folder"],qe={class:"bg-white rounded-b pt-4",role:"menu"},Le=e.defineComponent({__name:"Folder",props:{controls:{},label:{}},setup(n){function r(a,s){s.value=a}const o=e.ref(!1),t=()=>{o.value=!o.value};return(a,s)=>(e.openBlock(),e.createElementBlock("div",Ie,[e.createElementVNode("button",{class:"flex items-center justify-between w-full py-2 px-4 bg-gray-100 border-none text-gray-400 font-bold text-xs font-sans cursor-pointer","aria-expanded":o.value,"aria-haspopup":"true",role:"button","data-folder":a.label,tabindex:"0",onClick:t},[e.createElementVNode("span",null,e.toDisplayString(a.label),1),e.createElementVNode("i",{class:e.normalizeClass(o.value?"i-ic:baseline-keyboard-arrow-up":"i-ic:baseline-keyboard-arrow-down")},null,2)],8,Ke),e.createVNode(e.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:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.controls,c=>(e.openBlock(),e.createBlock(L,{key:c.label,control:c,role:"menuitem",onChange:f=>r(f,c)},null,8,["control","onChange"]))),128))],512),[[e.vShow,o.value]])]),_:1})]))}}),Ue={tabindex:"0",class:"bg-white shadow-xl rounded border-4 border-solid border-black"},Oe=[e.createElementVNode("i",{class:"h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs"},"🍰",-1),e.createElementVNode("div",null,[e.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),e.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),e.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"})],-1),e.createElementVNode("div",null,null,-1)],Re=280,Pe=e.defineComponent({__name:"TresLeches",props:{uuid:{}},setup(n){const r=n,{uuid:o}=e.toRefs(r),{width:t}=x.useWindowSize(),a=e.ref(null),s=z(o==null?void 0:o.value);function c(p,_){s[e.unref(p)].value=_,s[e.unref(p)][e.unref(p)]=_}const f=e.computed(()=>{const p={};for(const _ in s){const d=s[_],l=d.folder||"default";p[l]||(p[l]=[]),p[l].push(d)}return p});return(p,_)=>(e.openBlock(),e.createBlock(e.unref(P),{id:e.unref(o),"initial-value":{x:e.unref(t)-Re-40,y:10},class:e.normalizeClass(["absolute select-none z-24 w-280px font-sans text-xs",p.$attrs.class]),handle:a.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[e.createElementVNode("header",{ref_key:"handle",ref:a,class:"relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"},Oe,512),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(d,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l},[l!=="default"?(e.openBlock(),e.createBlock(Le,{key:0,label:l,controls:d},null,8,["label","controls"])):e.createCommentVNode("",!0),l==="default"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(d,u=>(e.openBlock(),e.createBlock(L,{key:u.label,control:u,onChange:y=>c(u.key,y)},null,8,["control","onChange"]))),128)):e.createCommentVNode("",!0)],64))),128))])]),_:1},8,["id","initial-value","class","handle"]))}});w.TresLeches=Pe,w.useControls=W,w.useControlsProvider=z,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
|
|
8
|
+
(function(B,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],e):(B=typeof globalThis<"u"?globalThis:B||self,e(B.tresleches={},B.Vue,B.VueUseCore))})(this,function(B,e,_){"use strict";const Ye="";function $(n){return typeof n=="function"?n():e.unref(n)}const A=typeof window<"u"&&typeof document<"u";function X(n,r={}){if(!e.isRef(n))return e.toRefs(n);const o=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const t in n.value)o[t]=e.customRef(()=>({get(){return n.value[t]},set(a){var s;if((s=$(r.replaceRef))!=null?s:!0)if(Array.isArray(n.value)){const u=[...n.value];u[t]=a,n.value=u}else{const u={...n.value,[t]:a};Object.setPrototypeOf(u,Object.getPrototypeOf(n.value)),n.value=u}else n.value[t]=a}}));return o}const j=A?window:void 0;function W(n,r={}){const{pointerTypes:o,preventDefault:t,stopPropagation:a,exact:s,onMove:i,onEnd:u,onStart:f,initialValue:g,axis:d="both",draggingElement:l=j,handle:p=n}=r,{width:y}=_.useWindowSize();let N=y.value;const m=e.ref($(g)??{x:0,y:0});e.watch(y,()=>{const c=y.value-N;m.value.x+=c,N=y.value});const E=e.ref(),V=c=>o?o.includes(c.pointerType):!0,k=c=>{$(t)&&c.preventDefault(),$(a)&&c.stopPropagation()},w=c=>{if(!V(c)||$(s)&&c.target!==$(n))return;const b=$(n).getBoundingClientRect(),x={x:c.clientX-b.left,y:c.clientY-b.top};(f==null?void 0:f(x,c))!==!1&&(E.value=x,k(c))},D=c=>{if(!V(c)||!E.value)return;let{x:b,y:x}=m.value;(d==="x"||d==="both")&&(b=c.clientX-E.value.x),(d==="y"||d==="both")&&(x=c.clientY-E.value.y),m.value={x:b,y:x},i==null||i(m.value,c),k(c)},z=c=>{V(c)&&E.value&&(E.value=void 0,u==null||u(m.value,c),k(c))};if(A){const c={capture:r.capture??!0};_.useEventListener(p,"pointerdown",w,c),_.useEventListener(l,"pointermove",D,c),_.useEventListener(l,"pointerup",z,c)}return{...X(m),position:m,isDragging:e.computed(()=>!!E.value),style:e.computed(()=>`left:${m.value.x}px;top:${m.value.y}px;`)}}const v=e.defineComponent({name:"UseDraggable",props:["storageKey","storageType","initialValue","exact","preventDefault","stopPropagation","pointerTypes","as","handle","axis","onStart","onMove","onEnd"],setup(n,{slots:r}){const o=e.ref(),t=e.computed(()=>n.handle??o.value),a=n.storageKey&&_.useStorage(n.storageKey,$(n.initialValue)||{x:0,y:0},_.isClient?n.storageType==="session"?sessionStorage:localStorage:void 0),s=a||n.initialValue||{x:0,y:0},i=(f,g)=>{var d;(d=n.onEnd)==null||d.call(n,f,g),a&&(a.value.x=f.x,a.value.y=f.y)},u=e.reactive(W(o,{...n,handle:t,initialValue:s,onEnd:i}));return()=>{if(r.default)return e.h(n.as||"div",{ref:o,style:`touch-action:none;${u.style}`},r.default(u))}}}),Y=Symbol("CONTROLS_CONTEXT_KEY"),I="default",S=e.reactive({});function q(n=I){return e.provide(Y,S),S[n]}const T=n=>{const r=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;return typeof n=="boolean"?"boolean":typeof n=="number"?"number":typeof n=="string"&&r.test(n)?"color":typeof n=="string"?"string":n.isVector3||n.isVector2||n.isEuler||n instanceof Array?"vector":n.min!==void 0||n.max!==void 0||n.step!==void 0?"range":n.options&&Array.isArray(n.options)?"select":"unknown"},F=(n,r,o,t)=>{const a={key:e.ref(n),label:e.ref(n),name:e.ref(n),type:e.ref(o),value:e.ref(r),visible:e.ref(!0),[n]:e.ref(r)};return t&&(a.folder=e.ref(t)),a},H=(n,r)=>{let o=1,t=`${n}_${o}`;for(;r[t];)o++,t=`${n}_${o}`;return t},G=(n,r,o)=>{const t={},a=typeof n=="string"?n:null,s=a?r:n,i=a&&a!=="fpsgraph"?o:r,u=(i==null?void 0:i.uuid)||I;if(S[u]||(S[u]=e.reactive({})),n==="fpsgraph"){const l=F("fpsgraph",null,"fpsgraph",null);return S[u].fpsgraph=l,t.fpsgraph=l,e.toRefs(e.reactive(t))}const f=S[u],g=e.isReactive(s),d=g?e.toRefs(s):{};for(const l in s){let p=s[l],y=l;if(g&&d[l]&&(p=d[l]),a&&(y=`${a}${l.charAt(0).toUpperCase()+l.slice(1)}`),!a&&f[y]&&(y=H(l,f)),typeof p=="object"&&!e.isRef(p)&&!Array.isArray(p)&&p.value!==void 0){const m=p,E=e.isRef(m.value)?m.value:e.ref(m.value),V=T(m),k=F(l,E,V,a);V==="select"&&(k.options=e.ref(m.options.map(w=>typeof w=="object"&&w.text&&w.value?w:{text:w,value:w}))),V==="range"&&(k.min=e.ref(m.min||0),k.max=e.ref(m.max||1),k.step=e.ref(m.step||.1)),k.label.value=m.label||l,k.visible.value=m.visible!==void 0?m.visible:!0,f[y]=k,t[y]=k;continue}if(e.isRef(p)){const m=F(l,p,T(p.value),a);f[y]=m,t[y]=m;continue}else if(typeof p=="object"&&!Array.isArray(p)){const m=e.toRefs(p);m[l]&&(p=m[l])}const N=F(l,p,T(p),a);f[y]=N,t[y]=N,N.uniqueKey=y}return Object.keys(t).length>1?e.toRefs(e.reactive(t)):Object.values(t)[0]},J={class:"flex px-4 justify-between gap-4 items-center mb-2"},Q=["for"],Z=["id","value","min","max","step"],ee=e.defineComponent({__name:"NumberControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){const o=n;function t(d){const{target:l}=d;r("change",l.valueAsNumber)}const a=_.useMouse(),s=e.ref(0),i=e.ref(!1),u=d=>{s.value=d.clientX,i.value=!0},f=()=>{i.value=!1},g=d=>Math.floor(Math.abs(d)/10);return e.watch(a.x,d=>{if(i.value){const l=d-s.value,p=g(l);l>0?r("change",o.control.value+1+p):l<0&&r("change",o.control.value-1+p),o.control.min!==void 0&&o.control.value<o.control.min&&r("change",o.control.min),o.control.max!==void 0&&o.control.value>o.control.max&&r("change",o.control.max),s.value=d}}),(d,l)=>(e.openBlock(),e.createElementBlock("div",J,[e.createElementVNode("label",{class:"text-gray-500 w-1/3",for:d.control.uniqueKey},e.toDisplayString(d.label),9,Q),e.createElementVNode("input",{id:d.control.uniqueKey,value:d.control.value,class:e.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":i.value}]),type:"number",min:d.control.min,max:d.control.max,step:d.control.step,onInput:t,onMousedown:u,onMouseup:f},null,42,Z)]))}}),te={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},ne=["for"],oe=["id","value","aria-label"],le=e.defineComponent({__name:"TextControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){function o(t){const{target:a}=t;r("change",a.value)}return(t,a)=>(e.openBlock(),e.createElementBlock("div",te,[e.createElementVNode("label",{for:t.control.uniqueKey,class:"text-gray-500 w-1/3"},e.toDisplayString(t.label),9,ne),e.createElementVNode("input",{id:t.control.uniqueKey,value:t.control.value,type:"text",tabindex:"0",class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 border-none font-sans","aria-label":t.label,placeholder:"Enter value here...",onChange:o},null,40,oe)]))}}),re={class:"flex px-4 justify-start gap-2 items-center mb-2 min-h-32px"},ae={class:"text-gray-500 w-1/3"},se=["id","checked"],ce=["for"],ie=["aria-checked"],ue={class:"i-ic:baseline-check text-light"},de=e.defineComponent({__name:"BooleanControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){const o=n;function t(s){const{target:i}=s;r("change",i.checked)}function a(s){(s.code==="Space"||s.code==="Enter")&&(s.preventDefault(),r("change",!o.control.value))}return(s,i)=>(e.openBlock(),e.createElementBlock("div",re,[e.createElementVNode("label",ae,e.toDisplayString(s.label),1),e.createElementVNode("input",{id:s.control.uniqueKey,checked:s.control.value,class:"hidden",type:"checkbox",onInput:t},null,40,se),e.createElementVNode("label",{for:s.control.uniqueKey,class:"inline-flex items-center cursor-pointer"},[e.createElementVNode("span",{tabindex:"0",role:"checkbox","aria-checked":s.control.value.toString(),class:e.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"]),onKeydown:a},[e.withDirectives(e.createElementVNode("i",ue,null,512),[[e.vShow,s.control.value]])],42,ie)],8,ce)]))}}),fe={class:"px-4 relative flex justify-between gap-4 items-center mb-2"},pe=["value","min","max","step"],me=["value","min","max","step"],ge=e.defineComponent({__name:"SliderControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){const o=n;function t(l){const{target:p}=l;r("change",p.valueAsNumber)}const a=e.computed(()=>({backgroundImage:`linear-gradient(to right, #333 0% ${100*(o.control.value-(o.control.min||0))/((o.control.max||100)-(o.control.min||0))}%, #e2e2e2 0%)`})),s=_.useMouse(),i=e.ref(0),u=e.ref(!1),f=l=>{i.value=l.clientX,u.value=!0},g=()=>{u.value=!1},d=l=>Math.floor(Math.abs(l)/10);return e.watch(s.x,l=>{if(u.value){const p=l-i.value,y=d(p);p>0?r("change",o.control.value+1+y):p<0&&r("change",o.control.value-1+y),o.control.min!==void 0&&o.control.value<o.control.min&&r("change",o.control.min),o.control.max!==void 0&&o.control.value>o.control.max&&r("change",o.control.max),i.value=l}}),(l,p)=>(e.openBlock(),e.createElementBlock("div",fe,[e.createElementVNode("label",{class:e.normalizeClass(["text-gray-500 w-1/3",{"flex justify-between items-center":l.control.icon}])},[e.createTextVNode(e.toDisplayString(l.label)+" ",1),e.createElementVNode("i",{class:e.normalizeClass(`i-${l.control.icon}`)},null,2)],2),e.createElementVNode("input",{value:l.control.value,class:"w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",style:e.normalizeStyle(a.value),type:"range",min:l.control.min,max:l.control.max,step:l.control.step,onInput:t},null,44,pe),e.createElementVNode("input",{value:l.control.value,class:e.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":u.value}]),type:"number",min:l.control.min,max:l.control.max,step:l.control.step,onInput:t,onMousedown:f,onMouseup:g},null,42,me)]))}}),He="",ye=((n,r)=>{const o=n.__vccOpts||n;for(const[t,a]of r)o[t]=a;return o})(ge,[["__scopeId","data-v-9e6267fe"]]),he={class:"flex px-4 justify-between gap-4 items-center mb-2"},be={class:"text-gray-500 w-1/3"},_e=["id","value","aria-label"],ke=["id","aria-label","value"],we=e.defineComponent({__name:"ColorControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){function o(t){const{target:a}=t;r("change",a.value)}return(t,a)=>(e.openBlock(),e.createElementBlock("div",he,[e.createElementVNode("label",be,e.toDisplayString(t.label),1),e.createElementVNode("input",{id:t.control.uniqueKey,tabindex:"0",value:t.control.value,"aria-label":t.label,class:e.normalizeClass(["focus:outline-none focus:ring-2 focus:ring-blue-600",{"important-outline-gray-200":t.control.value==="#ffffff"}]),type:"color",onInput:o},null,42,_e),e.createElementVNode("input",{id:t.control.uniqueKey,tabindex:"0","aria-label":t.label,value:t.control.value,class:"p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 border-none font-sans",type:"text",onInput:o},null,40,ke)]))}}),Je="";function xe(n){if(typeof n=="number")return[n,n,n];if(L(n)){const{x:r,y:o,z:t}=n;return[r,o,t]}return n}function Ee(n){return n&&typeof n.x=="number"&&typeof n.y=="number"&&typeof n.z>"u"}function L(n){return n&&typeof n.x=="number"&&typeof n.y=="number"&&typeof n.z=="number"}const Ce={class:"text-gray-500 w-1/3"},Be={class:"relative w-2/3 flex justify-between gap-0.5"},Ve={key:0,class:"font-bold px-1 py-1 text-0.65rem text-gray-300"},$e=["id","step","value","onInput","onMousedown","onMouseup","onFocus"],Ne=e.defineComponent({__name:"VectorControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){const o=n,t=_.useMouse(),{pressed:a}=_.useMousePressed(),s=e.ref(0),i=e.ref(!1),u=e.ref(0),f=e.ref(null),g=e.ref(1),d=_.useKeyModifier("Shift"),l=_.useKeyModifier("Alt");e.watch(d,c=>{g.value=c?10:1}),e.watch(l,c=>{g.value=c?.1:1});const p=c=>{f.value=c},y=()=>{f.value=null},N=(c,b)=>{u.value=b,s.value=c.clientX,i.value=!0},m=(c,b)=>{u.value=b,i.value=!1},E=()=>{i.value=!1};e.watch(a,c=>{c||(i.value=!1)});const V=c=>Math.floor(Math.abs(c)/10),k=e.computed(()=>xe(o.control.value)),w=e.ref(["x","y","z"]),D=e.computed(()=>Ee(o.control.value)||L(o.control.value));function z(c,b){const{value:x}=o.control,{target:h}=c;u.value=b,x[D.value?w.value[u.value]:u.value]=parseFloat(h.value),r("change",x)}return e.watch(t.x,c=>{if(i.value){const b=c-s.value,x=V(b),{value:h}=o.control,C=D.value?w.value[u.value]:u.value;b>0?h[C]+=g.value+x:b<0&&(h[C]-=g.value+x),o.control.min!==void 0&&h<o.control.min&&(h[C]=o.control.min),o.control.max!==void 0&&h>o.control.max&&(h[C]=o.control.max),r("change",h),s.value=c}}),(c,b)=>(e.openBlock(),e.createElementBlock("div",{class:"flex px-4 justify-between gap-1 items-center mb-2",onMouseup:b[0]||(b[0]=x=>E())},[e.createElementVNode("label",Ce,e.toDisplayString(c.label),1),e.createElementVNode("div",Be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(x,h)=>(e.openBlock(),e.createElementBlock("div",{key:c.label+h,class:e.normalizeClass(["flex items-center w-1/3 bg-gray-100 rounded",{"w-2/5":f.value===h}])},[w.value[h]&&D.value?(e.openBlock(),e.createElementBlock("span",Ve,e.toDisplayString(w.value[h]),1)):e.createCommentVNode("",!0),e.createElementVNode("input",{id:`${c.control.uniqueKey}-${w.value[h]}`,type:"number",step:g.value,class:e.normalizeClass(["w-full px-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans appearence-none",{"cursor-ew-resize":i.value}]),value:k.value[h].toFixed(2),onInput:C=>z(C,h),onMousedown:C=>N(C,h),onMouseup:C=>m(C,h),onFocus:C=>p(h),onBlur:y},null,42,$e)],2))),128))])],32))}}),Se={class:"flex px-4 justify-between gap-4 items-center mb-2"},Me={class:"text-gray-500 w-1/3"},De={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"},Fe={class:"absolute bottom-0.5 right-0.5 font-sans text-xs"},Te=["points"],U=160,K=40,M=2,O=100,R=20,Ke=e.defineComponent({__name:"FPSGraph",props:{label:{},control:{}},setup(n){const r=_.useFps({every:O}),o=e.ref(""),t=e.ref([]),a=e.ref(U/M);let s=performance.now();return _.useRafFn(({timestamp:i})=>{i-s>=O&&(s=i,t.value.push(r.value),t.value.length>a.value&&t.value.shift(),o.value=t.value.map((u,f)=>`${f*M},${K+R-M/2-u*(K+R-M)/120}`).join(" "))}),(i,u)=>(e.openBlock(),e.createElementBlock("div",Se,[e.createElementVNode("label",Me,e.toDisplayString(i.label),1),e.createElementVNode("div",De,[e.createElementVNode("div",Fe,e.toDisplayString(Math.round(e.unref(r)))+" FPS ",1),(e.openBlock(),e.createElementBlock("svg",{width:U,height:K,xmlns:"http://www.w3.org/2000/svg",class:"bg-gray-100"},[e.createElementVNode("polyline",{points:o.value,fill:"none",stroke:"lightgray","stroke-width":M,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,Te)]))])]))}}),ze={class:"flex px-4 justify-between gap-4 items-center mb-2 min-h-32px"},Ae=["for"],Ie=["id","value"],qe=["value"],Le=e.defineComponent({__name:"SelectControl",props:{label:{},control:{}},emits:["change"],setup(n,{emit:r}){function o(t){r("change",t.target.value)}return(t,a)=>(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("label",{class:"text-gray-500 w-1/3",for:t.control.uniqueKey},e.toDisplayString(t.label),9,Ae),e.createElementVNode("select",{id:t.control.uniqueKey,value:t.control.value,class:"p-2 w-2/3 rounded text-left text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",onChange:o},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.control.options,s=>(e.openBlock(),e.createElementBlock("option",{key:s.value,value:s.value},e.toDisplayString(s.text),9,qe))),128))],40,Ie)]))}}),P=e.defineComponent({__name:"ControlInput",props:{control:{}},emits:["change"],setup(n,{emit:r}){function o(t){r("change",t)}return(t,a)=>t.control.visible?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.control.type==="color"?(e.openBlock(),e.createBlock(we,{key:0,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="select"?(e.openBlock(),e.createBlock(Le,{key:1,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="vector"?(e.openBlock(),e.createBlock(Ne,{key:2,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="boolean"?(e.openBlock(),e.createBlock(de,{key:3,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="fpsgraph"?(e.openBlock(),e.createBlock(Ke,{key:4,label:t.control.label,control:t.control},null,8,["label","control"])):t.control.type==="number"?(e.openBlock(),e.createBlock(ee,{key:5,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):t.control.type==="range"?(e.openBlock(),e.createBlock(ye,{key:6,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"])):(e.openBlock(),e.createBlock(le,{key:7,label:t.control.label,control:t.control,onChange:o},null,8,["label","control"]))],64)):e.createCommentVNode("",!0)}}),Ue={class:"mb-4"},Oe=["aria-expanded","data-folder"],Re={class:"bg-white rounded-b pt-4",role:"menu"},Pe=e.defineComponent({__name:"Folder",props:{controls:{},label:{}},setup(n){function r(a,s){s.value=a}const o=e.ref(!1),t=()=>{o.value=!o.value};return(a,s)=>(e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("button",{class:"flex items-center justify-between w-full py-2 px-4 bg-gray-100 border-none text-gray-400 font-bold text-xs font-sans cursor-pointer","aria-expanded":o.value,"aria-haspopup":"true",role:"button","data-folder":a.label,tabindex:"0",onClick:t},[e.createElementVNode("span",null,e.toDisplayString(a.label),1),e.createElementVNode("i",{class:e.normalizeClass(o.value?"i-ic:baseline-keyboard-arrow-up":"i-ic:baseline-keyboard-arrow-down")},null,2)],8,Oe),e.createVNode(e.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:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.controls,i=>(e.openBlock(),e.createBlock(P,{key:i.label,control:i,role:"menuitem",onChange:u=>r(u,i)},null,8,["control","onChange"]))),128))],512),[[e.vShow,o.value]])]),_:1})]))}}),Xe={tabindex:"0",class:"bg-white shadow-xl rounded border-4 border-solid border-black"},je=[e.createElementVNode("i",{class:"h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs"},"🍰",-1),e.createElementVNode("div",null,[e.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),e.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"}),e.createElementVNode("i",{class:"i-ic-baseline-drag-indicator"})],-1),e.createElementVNode("div",null,null,-1)],We=280,ve=e.defineComponent({__name:"TresLeches",props:{uuid:{}},setup(n){const r=n,{uuid:o}=e.toRefs(r),{width:t}=_.useWindowSize(),a=e.ref(null),s=q(o==null?void 0:o.value);function i(f,g){s[e.unref(f)].value=g,s[e.unref(f)][e.unref(f)]=g}const u=e.computed(()=>{const f={};for(const g in s){const d=s[g],l=d.folder||"default";f[l]||(f[l]=[]),f[l].push(d)}return f});return(f,g)=>(e.openBlock(),e.createBlock(e.unref(v),{id:e.unref(o),"initial-value":{x:e.unref(t)-We-40,y:10},class:e.normalizeClass(["absolute select-none z-24 w-280px font-sans text-xs",f.$attrs.class]),handle:a.value},{default:e.withCtx(()=>[e.createElementVNode("div",Xe,[e.createElementVNode("header",{ref_key:"handle",ref:a,class:"relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"},je,512),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(d,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l},[l!=="default"?(e.openBlock(),e.createBlock(Pe,{key:0,label:l,controls:d},null,8,["label","controls"])):e.createCommentVNode("",!0),l==="default"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(d,p=>(e.openBlock(),e.createBlock(P,{key:p.label,control:p,onChange:y=>i(p.key,y)},null,8,["control","onChange"]))),128)):e.createCommentVNode("",!0)],64))),128))])]),_:1},8,["id","initial-value","class","handle"]))}});B.TresLeches=ve,B.useControls=G,B.useControlsProvider=q,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tresjs/leches",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"packageManager": "pnpm@8.3.1",
|
|
6
6
|
"description": "Tasty GUI for Vue controls 🍰",
|
|
7
7
|
"author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
|