@tresjs/leches 0.3.0 → 0.4.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/components/SelectControl.vue.d.ts +24 -0
- package/dist/composables/useControls.d.ts +8 -0
- package/dist/style.css +2 -2
- package/dist/tresleches.js +362 -318
- package/dist/tresleches.umd.cjs +3 -3
- package/package.json +28 -23
package/dist/tresleches.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/leches
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.4.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 { useStorage as
|
|
10
|
-
function
|
|
11
|
-
return ct() ? (yt(
|
|
8
|
+
import { unref as j, getCurrentScope as ct, onScopeDispose as yt, toRef as _t, readonly as xt, customRef as pt, ref as m, defineComponent as C, computed as E, reactive as tt, h as dt, watch as I, provide as ft, isReactive as gt, toRefs as mt, onUnmounted as bt, isRef as V, openBlock as d, createElementBlock as g, createElementVNode as p, toDisplayString as v, normalizeClass as k, withDirectives as et, vShow as st, createTextVNode as zt, normalizeStyle as Mt, Fragment as P, renderList as L, createCommentVNode as nt, createVNode as wt, Transition as vt, withCtx as it, createBlock as w } from "vue";
|
|
9
|
+
import { useStorage as Ct, isClient as St, useDraggable as kt, useMouse as F, useFps as $t, useRafFn as Et, useWindowSize as Tt } from "@vueuse/core";
|
|
10
|
+
function ot(o) {
|
|
11
|
+
return ct() ? (yt(o), !0) : !1;
|
|
12
12
|
}
|
|
13
|
-
function q(
|
|
14
|
-
return typeof
|
|
13
|
+
function q(o) {
|
|
14
|
+
return typeof o == "function" ? o() : j(o);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
},
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
return
|
|
16
|
+
const rt = typeof window < "u", ht = () => {
|
|
17
|
+
}, N = /* @__PURE__ */ It();
|
|
18
|
+
function It() {
|
|
19
|
+
var o;
|
|
20
|
+
return rt && ((o = window == null ? void 0 : window.navigator) == null ? void 0 : o.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
if (
|
|
24
|
-
return _t(...
|
|
25
|
-
const t =
|
|
26
|
-
return typeof t == "function" ? xt(pt(() => ({ get: t, set: ht }))) :
|
|
22
|
+
function At(...o) {
|
|
23
|
+
if (o.length !== 1)
|
|
24
|
+
return _t(...o);
|
|
25
|
+
const t = o[0];
|
|
26
|
+
return typeof t == "function" ? xt(pt(() => ({ get: t, set: ht }))) : m(t);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function jt(o) {
|
|
29
29
|
var t;
|
|
30
|
-
const e = q(
|
|
30
|
+
const e = q(o);
|
|
31
31
|
return (t = e == null ? void 0 : e.$el) != null ? t : e;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
33
|
+
const qt = rt ? window : void 0;
|
|
34
|
+
function Pt(...o) {
|
|
35
35
|
let t, e, s, n;
|
|
36
|
-
if (typeof
|
|
36
|
+
if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([e, s, n] = o, t = qt) : [t, e, s, n] = o, !t)
|
|
37
37
|
return ht;
|
|
38
38
|
Array.isArray(e) || (e = [e]), Array.isArray(s) || (s = [s]);
|
|
39
|
-
const i = [],
|
|
40
|
-
i.forEach((
|
|
41
|
-
}, l = (
|
|
42
|
-
() => [
|
|
43
|
-
([
|
|
44
|
-
|
|
45
|
-
...e.flatMap((
|
|
39
|
+
const i = [], a = () => {
|
|
40
|
+
i.forEach((h) => h()), i.length = 0;
|
|
41
|
+
}, l = (h, r, _, u) => (h.addEventListener(r, _, u), () => h.removeEventListener(r, _, u)), y = I(
|
|
42
|
+
() => [jt(t), q(n)],
|
|
43
|
+
([h, r]) => {
|
|
44
|
+
a(), h && i.push(
|
|
45
|
+
...e.flatMap((_) => s.map((u) => l(h, _, u, r)))
|
|
46
46
|
);
|
|
47
47
|
},
|
|
48
48
|
{ immediate: !0, flush: "post" }
|
|
49
49
|
), c = () => {
|
|
50
|
-
|
|
50
|
+
y(), a();
|
|
51
51
|
};
|
|
52
|
-
return
|
|
52
|
+
return ot(c), c;
|
|
53
53
|
}
|
|
54
|
-
var
|
|
54
|
+
var Dt = Object.defineProperty, Lt = Object.defineProperties, Vt = Object.getOwnPropertyDescriptors, B = Object.getOwnPropertySymbols, Xt = Object.prototype.hasOwnProperty, Rt = Object.prototype.propertyIsEnumerable, U = (o, t, e) => t in o ? Dt(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, Yt = (o, t) => {
|
|
55
55
|
for (var e in t || (t = {}))
|
|
56
|
-
|
|
56
|
+
Xt.call(t, e) && U(o, e, t[e]);
|
|
57
57
|
if (B)
|
|
58
58
|
for (var e of B(t))
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
},
|
|
62
|
-
const
|
|
59
|
+
Rt.call(t, e) && U(o, e, t[e]);
|
|
60
|
+
return o;
|
|
61
|
+
}, Ft = (o, t) => Lt(o, Vt(t));
|
|
62
|
+
const Ht = /* @__PURE__ */ C({
|
|
63
63
|
name: "UseDraggable",
|
|
64
64
|
props: [
|
|
65
65
|
"storageKey",
|
|
@@ -71,100 +71,104 @@ const Yt = /* @__PURE__ */ v({
|
|
|
71
71
|
"pointerTypes",
|
|
72
72
|
"as",
|
|
73
73
|
"handle",
|
|
74
|
-
"axis"
|
|
74
|
+
"axis",
|
|
75
|
+
"onStart",
|
|
76
|
+
"onMove",
|
|
77
|
+
"onEnd"
|
|
75
78
|
],
|
|
76
|
-
setup(
|
|
77
|
-
const e =
|
|
78
|
-
var
|
|
79
|
-
return (
|
|
80
|
-
}), n =
|
|
81
|
-
|
|
82
|
-
q(
|
|
83
|
-
|
|
84
|
-
), i = n ||
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
setup(o, { slots: t }) {
|
|
80
|
+
const e = m(), s = E(() => {
|
|
81
|
+
var y;
|
|
82
|
+
return (y = o.handle) != null ? y : e.value;
|
|
83
|
+
}), n = o.storageKey && Ct(
|
|
84
|
+
o.storageKey,
|
|
85
|
+
q(o.initialValue) || { x: 0, y: 0 },
|
|
86
|
+
St ? o.storageType === "session" ? sessionStorage : localStorage : void 0
|
|
87
|
+
), i = n || o.initialValue || { x: 0, y: 0 }, a = (y, c) => {
|
|
88
|
+
var h;
|
|
89
|
+
(h = o.onEnd) == null || h.call(o, y, c), n && (n.value.x = y.x, n.value.y = y.y);
|
|
90
|
+
}, l = tt(kt(e, Ft(Yt({}, o), {
|
|
87
91
|
handle: s,
|
|
88
92
|
initialValue: i,
|
|
89
|
-
onEnd:
|
|
93
|
+
onEnd: a
|
|
90
94
|
})));
|
|
91
95
|
return () => {
|
|
92
96
|
if (t.default)
|
|
93
|
-
return dt(
|
|
97
|
+
return dt(o.as || "div", { ref: e, style: `touch-action:none;${l.style}` }, t.default(l));
|
|
94
98
|
};
|
|
95
99
|
}
|
|
96
100
|
});
|
|
97
|
-
function at(
|
|
98
|
-
const t = window.getComputedStyle(
|
|
99
|
-
if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" &&
|
|
101
|
+
function at(o) {
|
|
102
|
+
const t = window.getComputedStyle(o);
|
|
103
|
+
if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && o.clientWidth < o.scrollWidth || t.overflowY === "auto" && o.clientHeight < o.scrollHeight)
|
|
100
104
|
return !0;
|
|
101
105
|
{
|
|
102
|
-
const e =
|
|
106
|
+
const e = o.parentNode;
|
|
103
107
|
return !e || e.tagName === "BODY" ? !1 : at(e);
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
|
-
function
|
|
107
|
-
const t =
|
|
110
|
+
function Qt(o) {
|
|
111
|
+
const t = o || window.event, e = t.target;
|
|
108
112
|
return at(e) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
|
|
109
113
|
}
|
|
110
|
-
function
|
|
111
|
-
const e =
|
|
114
|
+
function Wt(o, t = !1) {
|
|
115
|
+
const e = m(t);
|
|
112
116
|
let s = null, n;
|
|
113
|
-
|
|
117
|
+
I(At(o), (l) => {
|
|
114
118
|
if (l) {
|
|
115
|
-
const
|
|
116
|
-
n =
|
|
119
|
+
const y = l;
|
|
120
|
+
n = y.style.overflow, e.value && (y.style.overflow = "hidden");
|
|
117
121
|
}
|
|
118
122
|
}, {
|
|
119
123
|
immediate: !0
|
|
120
124
|
});
|
|
121
125
|
const i = () => {
|
|
122
|
-
const l = q(
|
|
123
|
-
!l || e.value || (
|
|
126
|
+
const l = q(o);
|
|
127
|
+
!l || e.value || (N && (s = Pt(
|
|
124
128
|
l,
|
|
125
129
|
"touchmove",
|
|
126
|
-
(
|
|
127
|
-
|
|
130
|
+
(y) => {
|
|
131
|
+
Qt(y);
|
|
128
132
|
},
|
|
129
133
|
{ passive: !1 }
|
|
130
134
|
)), l.style.overflow = "hidden", e.value = !0);
|
|
131
|
-
},
|
|
132
|
-
const l = q(
|
|
133
|
-
!l || !e.value || (
|
|
135
|
+
}, a = () => {
|
|
136
|
+
const l = q(o);
|
|
137
|
+
!l || !e.value || (N && (s == null || s()), l.style.overflow = n, e.value = !1);
|
|
134
138
|
};
|
|
135
|
-
return
|
|
139
|
+
return ot(a), E({
|
|
136
140
|
get() {
|
|
137
141
|
return e.value;
|
|
138
142
|
},
|
|
139
143
|
set(l) {
|
|
140
|
-
l ? i() :
|
|
144
|
+
l ? i() : a();
|
|
141
145
|
}
|
|
142
146
|
});
|
|
143
147
|
}
|
|
144
|
-
function
|
|
145
|
-
let
|
|
146
|
-
const t =
|
|
148
|
+
function Zt() {
|
|
149
|
+
let o = !1;
|
|
150
|
+
const t = m(!1);
|
|
147
151
|
return (e, s) => {
|
|
148
|
-
if (t.value = s.value,
|
|
152
|
+
if (t.value = s.value, o)
|
|
149
153
|
return;
|
|
150
|
-
|
|
151
|
-
const n =
|
|
152
|
-
|
|
154
|
+
o = !0;
|
|
155
|
+
const n = Wt(e, s.value);
|
|
156
|
+
I(t, (i) => n.value = i);
|
|
153
157
|
};
|
|
154
158
|
}
|
|
155
|
-
|
|
159
|
+
Zt();
|
|
156
160
|
/**
|
|
157
161
|
* @license
|
|
158
162
|
* Copyright 2010-2023 Three.js Authors
|
|
159
163
|
* SPDX-License-Identifier: MIT
|
|
160
164
|
*/
|
|
161
|
-
const lt = "
|
|
162
|
-
function
|
|
163
|
-
return Math.max(t, Math.min(e,
|
|
165
|
+
const lt = "153";
|
|
166
|
+
function H(o, t, e) {
|
|
167
|
+
return Math.max(t, Math.min(e, o));
|
|
164
168
|
}
|
|
165
|
-
class
|
|
169
|
+
class Q {
|
|
166
170
|
constructor(t = 0, e = 0) {
|
|
167
|
-
|
|
171
|
+
Q.prototype.isVector2 = !0, this.x = t, this.y = e;
|
|
168
172
|
}
|
|
169
173
|
get width() {
|
|
170
174
|
return this.x;
|
|
@@ -313,7 +317,7 @@ class H {
|
|
|
313
317
|
if (e === 0)
|
|
314
318
|
return Math.PI / 2;
|
|
315
319
|
const s = this.dot(t) / e;
|
|
316
|
-
return Math.acos(
|
|
320
|
+
return Math.acos(H(s, -1, 1));
|
|
317
321
|
}
|
|
318
322
|
distanceTo(t) {
|
|
319
323
|
return Math.sqrt(this.distanceToSquared(t));
|
|
@@ -347,8 +351,8 @@ class H {
|
|
|
347
351
|
return this.x = t.getX(e), this.y = t.getY(e), this;
|
|
348
352
|
}
|
|
349
353
|
rotateAround(t, e) {
|
|
350
|
-
const s = Math.cos(e), n = Math.sin(e), i = this.x - t.x,
|
|
351
|
-
return this.x = i * s -
|
|
354
|
+
const s = Math.cos(e), n = Math.sin(e), i = this.x - t.x, a = this.y - t.y;
|
|
355
|
+
return this.x = i * s - a * n + t.x, this.y = i * n + a * s + t.y, this;
|
|
352
356
|
}
|
|
353
357
|
random() {
|
|
354
358
|
return this.x = Math.random(), this.y = Math.random(), this;
|
|
@@ -357,39 +361,39 @@ class H {
|
|
|
357
361
|
yield this.x, yield this.y;
|
|
358
362
|
}
|
|
359
363
|
}
|
|
360
|
-
class
|
|
364
|
+
class Nt {
|
|
361
365
|
constructor(t = 0, e = 0, s = 0, n = 1) {
|
|
362
366
|
this.isQuaternion = !0, this._x = t, this._y = e, this._z = s, this._w = n;
|
|
363
367
|
}
|
|
364
|
-
static slerpFlat(t, e, s, n, i,
|
|
365
|
-
let
|
|
366
|
-
const
|
|
368
|
+
static slerpFlat(t, e, s, n, i, a, l) {
|
|
369
|
+
let y = s[n + 0], c = s[n + 1], h = s[n + 2], r = s[n + 3];
|
|
370
|
+
const _ = i[a + 0], u = i[a + 1], x = i[a + 2], b = i[a + 3];
|
|
367
371
|
if (l === 0) {
|
|
368
|
-
t[e + 0] =
|
|
372
|
+
t[e + 0] = y, t[e + 1] = c, t[e + 2] = h, t[e + 3] = r;
|
|
369
373
|
return;
|
|
370
374
|
}
|
|
371
375
|
if (l === 1) {
|
|
372
|
-
t[e + 0] =
|
|
376
|
+
t[e + 0] = _, t[e + 1] = u, t[e + 2] = x, t[e + 3] = b;
|
|
373
377
|
return;
|
|
374
378
|
}
|
|
375
|
-
if (
|
|
379
|
+
if (r !== b || y !== _ || c !== u || h !== x) {
|
|
376
380
|
let z = 1 - l;
|
|
377
|
-
const f =
|
|
378
|
-
if (
|
|
379
|
-
const S = Math.sqrt(
|
|
380
|
-
z = Math.sin(z *
|
|
381
|
+
const f = y * _ + c * u + h * x + r * b, M = f >= 0 ? 1 : -1, W = 1 - f * f;
|
|
382
|
+
if (W > Number.EPSILON) {
|
|
383
|
+
const S = Math.sqrt(W), Z = Math.atan2(S, f * M);
|
|
384
|
+
z = Math.sin(z * Z) / S, l = Math.sin(l * Z) / S;
|
|
381
385
|
}
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
const S = 1 / Math.sqrt(
|
|
385
|
-
|
|
386
|
+
const D = l * M;
|
|
387
|
+
if (y = y * z + _ * D, c = c * z + u * D, h = h * z + x * D, r = r * z + b * D, z === 1 - l) {
|
|
388
|
+
const S = 1 / Math.sqrt(y * y + c * c + h * h + r * r);
|
|
389
|
+
y *= S, c *= S, h *= S, r *= S;
|
|
386
390
|
}
|
|
387
391
|
}
|
|
388
|
-
t[e] =
|
|
392
|
+
t[e] = y, t[e + 1] = c, t[e + 2] = h, t[e + 3] = r;
|
|
389
393
|
}
|
|
390
|
-
static multiplyQuaternionsFlat(t, e, s, n, i,
|
|
391
|
-
const l = s[n],
|
|
392
|
-
return t[e] = l * x +
|
|
394
|
+
static multiplyQuaternionsFlat(t, e, s, n, i, a) {
|
|
395
|
+
const l = s[n], y = s[n + 1], c = s[n + 2], h = s[n + 3], r = i[a], _ = i[a + 1], u = i[a + 2], x = i[a + 3];
|
|
396
|
+
return t[e] = l * x + h * r + y * u - c * _, t[e + 1] = y * x + h * _ + c * r - l * u, t[e + 2] = c * x + h * u + l * _ - y * r, t[e + 3] = h * x - l * r - y * _ - c * u, t;
|
|
393
397
|
}
|
|
394
398
|
get x() {
|
|
395
399
|
return this._x;
|
|
@@ -425,28 +429,28 @@ class Wt {
|
|
|
425
429
|
return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
|
|
426
430
|
}
|
|
427
431
|
setFromEuler(t, e) {
|
|
428
|
-
const s = t._x, n = t._y, i = t._z,
|
|
429
|
-
switch (
|
|
432
|
+
const s = t._x, n = t._y, i = t._z, a = t._order, l = Math.cos, y = Math.sin, c = l(s / 2), h = l(n / 2), r = l(i / 2), _ = y(s / 2), u = y(n / 2), x = y(i / 2);
|
|
433
|
+
switch (a) {
|
|
430
434
|
case "XYZ":
|
|
431
|
-
this._x =
|
|
435
|
+
this._x = _ * h * r + c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r - _ * u * x;
|
|
432
436
|
break;
|
|
433
437
|
case "YXZ":
|
|
434
|
-
this._x =
|
|
438
|
+
this._x = _ * h * r + c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r + _ * u * x;
|
|
435
439
|
break;
|
|
436
440
|
case "ZXY":
|
|
437
|
-
this._x =
|
|
441
|
+
this._x = _ * h * r - c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r - _ * u * x;
|
|
438
442
|
break;
|
|
439
443
|
case "ZYX":
|
|
440
|
-
this._x =
|
|
444
|
+
this._x = _ * h * r - c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r + _ * u * x;
|
|
441
445
|
break;
|
|
442
446
|
case "YZX":
|
|
443
|
-
this._x =
|
|
447
|
+
this._x = _ * h * r + c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r - _ * u * x;
|
|
444
448
|
break;
|
|
445
449
|
case "XZY":
|
|
446
|
-
this._x =
|
|
450
|
+
this._x = _ * h * r - c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r + _ * u * x;
|
|
447
451
|
break;
|
|
448
452
|
default:
|
|
449
|
-
console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " +
|
|
453
|
+
console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a);
|
|
450
454
|
}
|
|
451
455
|
return e !== !1 && this._onChangeCallback(), this;
|
|
452
456
|
}
|
|
@@ -455,19 +459,19 @@ class Wt {
|
|
|
455
459
|
return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(s), this._onChangeCallback(), this;
|
|
456
460
|
}
|
|
457
461
|
setFromRotationMatrix(t) {
|
|
458
|
-
const e = t.elements, s = e[0], n = e[4], i = e[8],
|
|
459
|
-
if (
|
|
460
|
-
const u = 0.5 / Math.sqrt(
|
|
461
|
-
this._w = 0.25 / u, this._x = (
|
|
462
|
-
} else if (s > l && s >
|
|
463
|
-
const u = 2 * Math.sqrt(1 + s - l -
|
|
464
|
-
this._w = (
|
|
465
|
-
} else if (l >
|
|
466
|
-
const u = 2 * Math.sqrt(1 + l - s -
|
|
467
|
-
this._w = (i - c) / u, this._x = (n +
|
|
462
|
+
const e = t.elements, s = e[0], n = e[4], i = e[8], a = e[1], l = e[5], y = e[9], c = e[2], h = e[6], r = e[10], _ = s + l + r;
|
|
463
|
+
if (_ > 0) {
|
|
464
|
+
const u = 0.5 / Math.sqrt(_ + 1);
|
|
465
|
+
this._w = 0.25 / u, this._x = (h - y) * u, this._y = (i - c) * u, this._z = (a - n) * u;
|
|
466
|
+
} else if (s > l && s > r) {
|
|
467
|
+
const u = 2 * Math.sqrt(1 + s - l - r);
|
|
468
|
+
this._w = (h - y) / u, this._x = 0.25 * u, this._y = (n + a) / u, this._z = (i + c) / u;
|
|
469
|
+
} else if (l > r) {
|
|
470
|
+
const u = 2 * Math.sqrt(1 + l - s - r);
|
|
471
|
+
this._w = (i - c) / u, this._x = (n + a) / u, this._y = 0.25 * u, this._z = (y + h) / u;
|
|
468
472
|
} else {
|
|
469
|
-
const u = 2 * Math.sqrt(1 +
|
|
470
|
-
this._w = (
|
|
473
|
+
const u = 2 * Math.sqrt(1 + r - s - l);
|
|
474
|
+
this._w = (a - n) / u, this._x = (i + c) / u, this._y = (y + h) / u, this._z = 0.25 * u;
|
|
471
475
|
}
|
|
472
476
|
return this._onChangeCallback(), this;
|
|
473
477
|
}
|
|
@@ -476,7 +480,7 @@ class Wt {
|
|
|
476
480
|
return s < Number.EPSILON ? (s = 0, Math.abs(t.x) > Math.abs(t.z) ? (this._x = -t.y, this._y = t.x, this._z = 0, this._w = s) : (this._x = 0, this._y = -t.z, this._z = t.y, this._w = s)) : (this._x = t.y * e.z - t.z * e.y, this._y = t.z * e.x - t.x * e.z, this._z = t.x * e.y - t.y * e.x, this._w = s), this.normalize();
|
|
477
481
|
}
|
|
478
482
|
angleTo(t) {
|
|
479
|
-
return 2 * Math.acos(Math.abs(
|
|
483
|
+
return 2 * Math.acos(Math.abs(H(this.dot(t), -1, 1)));
|
|
480
484
|
}
|
|
481
485
|
rotateTowards(t, e) {
|
|
482
486
|
const s = this.angleTo(t);
|
|
@@ -514,25 +518,25 @@ class Wt {
|
|
|
514
518
|
return this.multiplyQuaternions(t, this);
|
|
515
519
|
}
|
|
516
520
|
multiplyQuaternions(t, e) {
|
|
517
|
-
const s = t._x, n = t._y, i = t._z,
|
|
518
|
-
return this._x = s *
|
|
521
|
+
const s = t._x, n = t._y, i = t._z, a = t._w, l = e._x, y = e._y, c = e._z, h = e._w;
|
|
522
|
+
return this._x = s * h + a * l + n * c - i * y, this._y = n * h + a * y + i * l - s * c, this._z = i * h + a * c + s * y - n * l, this._w = a * h - s * l - n * y - i * c, this._onChangeCallback(), this;
|
|
519
523
|
}
|
|
520
524
|
slerp(t, e) {
|
|
521
525
|
if (e === 0)
|
|
522
526
|
return this;
|
|
523
527
|
if (e === 1)
|
|
524
528
|
return this.copy(t);
|
|
525
|
-
const s = this._x, n = this._y, i = this._z,
|
|
526
|
-
let l =
|
|
529
|
+
const s = this._x, n = this._y, i = this._z, a = this._w;
|
|
530
|
+
let l = a * t._w + s * t._x + n * t._y + i * t._z;
|
|
527
531
|
if (l < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, l = -l) : this.copy(t), l >= 1)
|
|
528
|
-
return this._w =
|
|
529
|
-
const
|
|
530
|
-
if (
|
|
532
|
+
return this._w = a, this._x = s, this._y = n, this._z = i, this;
|
|
533
|
+
const y = 1 - l * l;
|
|
534
|
+
if (y <= Number.EPSILON) {
|
|
531
535
|
const u = 1 - e;
|
|
532
|
-
return this._w = u *
|
|
536
|
+
return this._w = u * a + e * this._w, this._x = u * s + e * this._x, this._y = u * n + e * this._y, this._z = u * i + e * this._z, this.normalize(), this._onChangeCallback(), this;
|
|
533
537
|
}
|
|
534
|
-
const c = Math.sqrt(
|
|
535
|
-
return this._w =
|
|
538
|
+
const c = Math.sqrt(y), h = Math.atan2(c, l), r = Math.sin((1 - e) * h) / c, _ = Math.sin(e * h) / c;
|
|
539
|
+
return this._w = a * r + this._w * _, this._x = s * r + this._x * _, this._y = n * r + this._y * _, this._z = i * r + this._z * _, this._onChangeCallback(), this;
|
|
536
540
|
}
|
|
537
541
|
slerpQuaternions(t, e, s) {
|
|
538
542
|
return this.copy(t).slerp(e, s);
|
|
@@ -667,12 +671,12 @@ class $ {
|
|
|
667
671
|
return this.applyMatrix3(t).normalize();
|
|
668
672
|
}
|
|
669
673
|
applyMatrix4(t) {
|
|
670
|
-
const e = this.x, s = this.y, n = this.z, i = t.elements,
|
|
671
|
-
return this.x = (i[0] * e + i[4] * s + i[8] * n + i[12]) *
|
|
674
|
+
const e = this.x, s = this.y, n = this.z, i = t.elements, a = 1 / (i[3] * e + i[7] * s + i[11] * n + i[15]);
|
|
675
|
+
return this.x = (i[0] * e + i[4] * s + i[8] * n + i[12]) * a, this.y = (i[1] * e + i[5] * s + i[9] * n + i[13]) * a, this.z = (i[2] * e + i[6] * s + i[10] * n + i[14]) * a, this;
|
|
672
676
|
}
|
|
673
677
|
applyQuaternion(t) {
|
|
674
|
-
const e = this.x, s = this.y, n = this.z, i = t.x,
|
|
675
|
-
return this.x = c *
|
|
678
|
+
const e = this.x, s = this.y, n = this.z, i = t.x, a = t.y, l = t.z, y = t.w, c = y * e + a * n - l * s, h = y * s + l * e - i * n, r = y * n + i * s - a * e, _ = -i * e - a * s - l * n;
|
|
679
|
+
return this.x = c * y + _ * -i + h * -l - r * -a, this.y = h * y + _ * -a + r * -i - c * -l, this.z = r * y + _ * -l + c * -a - h * -i, this;
|
|
676
680
|
}
|
|
677
681
|
project(t) {
|
|
678
682
|
return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);
|
|
@@ -750,8 +754,8 @@ class $ {
|
|
|
750
754
|
return this.crossVectors(this, t);
|
|
751
755
|
}
|
|
752
756
|
crossVectors(t, e) {
|
|
753
|
-
const s = t.x, n = t.y, i = t.z,
|
|
754
|
-
return this.x = n *
|
|
757
|
+
const s = t.x, n = t.y, i = t.z, a = e.x, l = e.y, y = e.z;
|
|
758
|
+
return this.x = n * y - i * l, this.y = i * a - s * y, this.z = s * l - n * a, this;
|
|
755
759
|
}
|
|
756
760
|
projectOnVector(t) {
|
|
757
761
|
const e = t.lengthSq();
|
|
@@ -761,17 +765,17 @@ class $ {
|
|
|
761
765
|
return this.copy(t).multiplyScalar(s);
|
|
762
766
|
}
|
|
763
767
|
projectOnPlane(t) {
|
|
764
|
-
return
|
|
768
|
+
return X.copy(this).projectOnVector(t), this.sub(X);
|
|
765
769
|
}
|
|
766
770
|
reflect(t) {
|
|
767
|
-
return this.sub(
|
|
771
|
+
return this.sub(X.copy(t).multiplyScalar(2 * this.dot(t)));
|
|
768
772
|
}
|
|
769
773
|
angleTo(t) {
|
|
770
774
|
const e = Math.sqrt(this.lengthSq() * t.lengthSq());
|
|
771
775
|
if (e === 0)
|
|
772
776
|
return Math.PI / 2;
|
|
773
777
|
const s = this.dot(t) / e;
|
|
774
|
-
return Math.acos(
|
|
778
|
+
return Math.acos(H(s, -1, 1));
|
|
775
779
|
}
|
|
776
780
|
distanceTo(t) {
|
|
777
781
|
return Math.sqrt(this.distanceToSquared(t));
|
|
@@ -839,19 +843,19 @@ class $ {
|
|
|
839
843
|
yield this.x, yield this.y, yield this.z;
|
|
840
844
|
}
|
|
841
845
|
}
|
|
842
|
-
const
|
|
846
|
+
const X = /* @__PURE__ */ new $(), K = /* @__PURE__ */ new Nt();
|
|
843
847
|
typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
|
|
844
848
|
revision: lt
|
|
845
849
|
} }));
|
|
846
850
|
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = lt);
|
|
847
|
-
const
|
|
851
|
+
const Bt = Symbol("CONTROLS_CONTEXT_KEY"), T = tt({
|
|
848
852
|
controls: []
|
|
849
853
|
});
|
|
850
|
-
function
|
|
851
|
-
return
|
|
854
|
+
function Ut() {
|
|
855
|
+
return ft(Bt, T), T;
|
|
852
856
|
}
|
|
853
|
-
function
|
|
854
|
-
return Object.entries(
|
|
857
|
+
function R(o) {
|
|
858
|
+
return Object.entries(o).map(([t, e]) => {
|
|
855
859
|
let s = "string", n;
|
|
856
860
|
const i = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
857
861
|
return !V(e) && e.value || V(e) ? (s = typeof e.value, n = e.value) : (s = typeof e, n = e), s === "number" && (e.step || e.max || e.min) && (s = "range"), s === "string" && i.test(n) && (s = "color"), (n instanceof $ || n instanceof $ || n instanceof Array) && (s = "vector"), !V(e) && e.value ? {
|
|
@@ -868,118 +872,128 @@ function X(r) {
|
|
|
868
872
|
};
|
|
869
873
|
});
|
|
870
874
|
}
|
|
871
|
-
function
|
|
872
|
-
|
|
875
|
+
function Kt() {
|
|
876
|
+
T.controls = [];
|
|
873
877
|
}
|
|
874
|
-
function
|
|
878
|
+
function Ge(o, t, e) {
|
|
875
879
|
let s = [];
|
|
876
|
-
if (typeof
|
|
877
|
-
|
|
880
|
+
if (typeof o == "string")
|
|
881
|
+
o === "fpsgraph" ? s.push({
|
|
878
882
|
label: "fpsgraph",
|
|
879
883
|
visible: !0,
|
|
880
884
|
type: "fpsgraph"
|
|
881
885
|
}) : s.push({
|
|
882
|
-
label:
|
|
886
|
+
label: o,
|
|
883
887
|
visible: !0,
|
|
884
888
|
type: "folder",
|
|
885
|
-
controls:
|
|
889
|
+
controls: R(t)
|
|
890
|
+
});
|
|
891
|
+
else if (typeof o == "object" && o.options)
|
|
892
|
+
s.push({
|
|
893
|
+
...e,
|
|
894
|
+
label: o.label || "Dropdown",
|
|
895
|
+
visible: !0,
|
|
896
|
+
value: o.value,
|
|
897
|
+
type: "select",
|
|
898
|
+
ref: o,
|
|
899
|
+
options: o.options
|
|
886
900
|
});
|
|
887
|
-
else if (typeof
|
|
901
|
+
else if (typeof o == "object" && typeof t == "string")
|
|
888
902
|
s.push({
|
|
889
903
|
...e,
|
|
890
904
|
label: t,
|
|
891
905
|
visible: !0,
|
|
892
|
-
value:
|
|
893
|
-
type: typeof
|
|
894
|
-
ref:
|
|
906
|
+
value: o[t],
|
|
907
|
+
type: typeof o[t],
|
|
908
|
+
ref: o
|
|
895
909
|
});
|
|
896
|
-
else if (
|
|
897
|
-
const n =
|
|
898
|
-
s =
|
|
910
|
+
else if (gt(o)) {
|
|
911
|
+
const n = mt(o);
|
|
912
|
+
s = R(n);
|
|
899
913
|
} else
|
|
900
|
-
s =
|
|
901
|
-
return
|
|
914
|
+
s = R(o);
|
|
915
|
+
return T.controls = [...T.controls, ...s], bt(Kt), { state: T, controls: s };
|
|
902
916
|
}
|
|
903
|
-
const
|
|
917
|
+
const Gt = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Jt = { class: "text-gray-500 w-1/3" }, Ot = ["value", "min", "max", "step"], te = /* @__PURE__ */ C({
|
|
904
918
|
__name: "NumberControl",
|
|
905
919
|
props: {
|
|
906
920
|
label: {},
|
|
907
921
|
control: {}
|
|
908
922
|
},
|
|
909
923
|
emits: ["change"],
|
|
910
|
-
setup(
|
|
911
|
-
const e =
|
|
912
|
-
function s(
|
|
913
|
-
const { target:
|
|
914
|
-
t("change",
|
|
924
|
+
setup(o, { emit: t }) {
|
|
925
|
+
const e = o;
|
|
926
|
+
function s(h) {
|
|
927
|
+
const { target: r } = h;
|
|
928
|
+
t("change", r.valueAsNumber);
|
|
915
929
|
}
|
|
916
|
-
const n =
|
|
917
|
-
i.value =
|
|
918
|
-
},
|
|
919
|
-
|
|
920
|
-
}, c = (
|
|
921
|
-
return
|
|
922
|
-
if (
|
|
923
|
-
const
|
|
924
|
-
|
|
930
|
+
const n = F(), i = m(0), a = m(!1), l = (h) => {
|
|
931
|
+
i.value = h.clientX, a.value = !0;
|
|
932
|
+
}, y = () => {
|
|
933
|
+
a.value = !1;
|
|
934
|
+
}, c = (h) => Math.floor(Math.abs(h) / 10);
|
|
935
|
+
return I(n.x, (h) => {
|
|
936
|
+
if (a.value) {
|
|
937
|
+
const r = h - i.value, _ = c(r);
|
|
938
|
+
r > 0 ? t("change", e.control.value + 1 + _) : r < 0 && t("change", e.control.value - 1 + _), e.control.min !== void 0 && e.control.value < e.control.min && t("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && t("change", e.control.max), i.value = h;
|
|
925
939
|
}
|
|
926
|
-
}), (
|
|
927
|
-
p("label",
|
|
940
|
+
}), (h, r) => (d(), g("div", Gt, [
|
|
941
|
+
p("label", Jt, v(h.label), 1),
|
|
928
942
|
p("input", {
|
|
929
|
-
value:
|
|
930
|
-
class: k(["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":
|
|
943
|
+
value: h.control.value,
|
|
944
|
+
class: k(["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": a.value }]),
|
|
931
945
|
type: "number",
|
|
932
|
-
min:
|
|
933
|
-
max:
|
|
934
|
-
step:
|
|
946
|
+
min: h.control.min,
|
|
947
|
+
max: h.control.max,
|
|
948
|
+
step: h.control.step,
|
|
935
949
|
onInput: s,
|
|
936
950
|
onMousedown: l,
|
|
937
|
-
onMouseup:
|
|
938
|
-
}, null, 42,
|
|
951
|
+
onMouseup: y
|
|
952
|
+
}, null, 42, Ot)
|
|
939
953
|
]));
|
|
940
954
|
}
|
|
941
|
-
}),
|
|
955
|
+
}), ee = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, se = { class: "text-gray-500 w-1/3" }, ne = ["value"], ie = /* @__PURE__ */ C({
|
|
942
956
|
__name: "TextControl",
|
|
943
957
|
props: {
|
|
944
958
|
label: {},
|
|
945
959
|
control: {}
|
|
946
960
|
},
|
|
947
961
|
emits: ["change"],
|
|
948
|
-
setup(
|
|
962
|
+
setup(o, { emit: t }) {
|
|
949
963
|
function e(s) {
|
|
950
964
|
t("change", s);
|
|
951
965
|
}
|
|
952
|
-
return (s, n) => (d(),
|
|
953
|
-
p("label",
|
|
966
|
+
return (s, n) => (d(), g("div", ee, [
|
|
967
|
+
p("label", se, v(s.label), 1),
|
|
954
968
|
p("input", {
|
|
955
969
|
value: s.control.value,
|
|
956
970
|
type: "string",
|
|
957
971
|
class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
|
|
958
972
|
onChange: e
|
|
959
|
-
}, null, 40,
|
|
973
|
+
}, null, 40, ne)
|
|
960
974
|
]));
|
|
961
975
|
}
|
|
962
|
-
}),
|
|
976
|
+
}), oe = { class: "flex px-4 justify-start gap-2 items-center mb-2 min-h-32px" }, re = { class: "text-gray-500 w-1/3" }, he = ["id", "checked"], ae = ["for"], le = { class: "i-ic:baseline-check text-light" }, ue = /* @__PURE__ */ C({
|
|
963
977
|
__name: "BooleanControl",
|
|
964
978
|
props: {
|
|
965
979
|
label: {},
|
|
966
980
|
control: {}
|
|
967
981
|
},
|
|
968
982
|
emits: ["change"],
|
|
969
|
-
setup(
|
|
983
|
+
setup(o, { emit: t }) {
|
|
970
984
|
function e(s) {
|
|
971
985
|
const { target: n } = s;
|
|
972
986
|
t("change", n.checked);
|
|
973
987
|
}
|
|
974
|
-
return (s, n) => (d(),
|
|
975
|
-
p("label",
|
|
988
|
+
return (s, n) => (d(), g("div", oe, [
|
|
989
|
+
p("label", re, v(s.label), 1),
|
|
976
990
|
p("input", {
|
|
977
991
|
id: s.control.label,
|
|
978
992
|
checked: s.control.value,
|
|
979
993
|
class: "hidden",
|
|
980
994
|
type: "checkbox",
|
|
981
995
|
onInput: e
|
|
982
|
-
}, null, 40,
|
|
996
|
+
}, null, 40, he),
|
|
983
997
|
p("label", {
|
|
984
998
|
for: s.control.label,
|
|
985
999
|
class: "inline-flex items-center cursor-pointer"
|
|
@@ -987,185 +1001,185 @@ const Ut = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Kt =
|
|
|
987
1001
|
p("span", {
|
|
988
1002
|
class: k([{ "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"])
|
|
989
1003
|
}, [
|
|
990
|
-
et(p("i",
|
|
1004
|
+
et(p("i", le, null, 512), [
|
|
991
1005
|
[st, s.control.value]
|
|
992
1006
|
])
|
|
993
1007
|
], 2)
|
|
994
|
-
], 8,
|
|
1008
|
+
], 8, ae)
|
|
995
1009
|
]));
|
|
996
1010
|
}
|
|
997
|
-
}),
|
|
1011
|
+
}), ce = { class: "px-4 relative flex justify-between gap-4 items-center mb-2" }, ye = ["value", "min", "max", "step"], _e = ["value", "min", "max", "step"], xe = /* @__PURE__ */ C({
|
|
998
1012
|
__name: "SliderControl",
|
|
999
1013
|
props: {
|
|
1000
1014
|
label: {},
|
|
1001
1015
|
control: {}
|
|
1002
1016
|
},
|
|
1003
1017
|
emits: ["change"],
|
|
1004
|
-
setup(
|
|
1005
|
-
const e =
|
|
1006
|
-
function s(
|
|
1007
|
-
const { target:
|
|
1008
|
-
t("change",
|
|
1018
|
+
setup(o, { emit: t }) {
|
|
1019
|
+
const e = o;
|
|
1020
|
+
function s(r) {
|
|
1021
|
+
const { target: _ } = r;
|
|
1022
|
+
t("change", _.valueAsNumber);
|
|
1009
1023
|
}
|
|
1010
|
-
const n =
|
|
1024
|
+
const n = E(() => ({
|
|
1011
1025
|
backgroundImage: `linear-gradient(to right, #333 0% ${100 * (e.control.value - (e.control.min || 0)) / ((e.control.max || 100) - (e.control.min || 0))}%, #e2e2e2 0%)`
|
|
1012
|
-
})), i =
|
|
1013
|
-
|
|
1026
|
+
})), i = F(), a = m(0), l = m(!1), y = (r) => {
|
|
1027
|
+
a.value = r.clientX, l.value = !0;
|
|
1014
1028
|
}, c = () => {
|
|
1015
1029
|
l.value = !1;
|
|
1016
|
-
},
|
|
1017
|
-
return
|
|
1030
|
+
}, h = (r) => Math.floor(Math.abs(r) / 10);
|
|
1031
|
+
return I(i.x, (r) => {
|
|
1018
1032
|
if (l.value) {
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1033
|
+
const _ = r - a.value, u = h(_);
|
|
1034
|
+
_ > 0 ? t("change", e.control.value + 1 + u) : _ < 0 && t("change", e.control.value - 1 + u), e.control.min !== void 0 && e.control.value < e.control.min && t("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && t("change", e.control.max), a.value = r;
|
|
1021
1035
|
}
|
|
1022
|
-
}), (
|
|
1036
|
+
}), (r, _) => (d(), g("div", ce, [
|
|
1023
1037
|
p("label", {
|
|
1024
|
-
class: k(["text-gray-500 w-1/3", { "flex justify-between items-center":
|
|
1038
|
+
class: k(["text-gray-500 w-1/3", { "flex justify-between items-center": r.control.icon }])
|
|
1025
1039
|
}, [
|
|
1026
|
-
|
|
1040
|
+
zt(v(r.label) + " ", 1),
|
|
1027
1041
|
p("i", {
|
|
1028
|
-
class: k(`i-${
|
|
1042
|
+
class: k(`i-${r.control.icon}`)
|
|
1029
1043
|
}, null, 2)
|
|
1030
1044
|
], 2),
|
|
1031
1045
|
p("input", {
|
|
1032
|
-
value:
|
|
1046
|
+
value: r.control.value,
|
|
1033
1047
|
class: "w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",
|
|
1034
|
-
style:
|
|
1048
|
+
style: Mt(n.value),
|
|
1035
1049
|
type: "range",
|
|
1036
|
-
min:
|
|
1037
|
-
max:
|
|
1038
|
-
step:
|
|
1050
|
+
min: r.control.min,
|
|
1051
|
+
max: r.control.max,
|
|
1052
|
+
step: r.control.step,
|
|
1039
1053
|
onInput: s
|
|
1040
|
-
}, null, 44,
|
|
1054
|
+
}, null, 44, ye),
|
|
1041
1055
|
p("input", {
|
|
1042
|
-
value:
|
|
1056
|
+
value: r.control.value,
|
|
1043
1057
|
class: k(["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": l.value }]),
|
|
1044
1058
|
type: "number",
|
|
1045
|
-
min:
|
|
1046
|
-
max:
|
|
1047
|
-
step:
|
|
1059
|
+
min: r.control.min,
|
|
1060
|
+
max: r.control.max,
|
|
1061
|
+
step: r.control.step,
|
|
1048
1062
|
onInput: s,
|
|
1049
|
-
onMousedown:
|
|
1063
|
+
onMousedown: y,
|
|
1050
1064
|
onMouseup: c
|
|
1051
|
-
}, null, 42,
|
|
1065
|
+
}, null, 42, _e)
|
|
1052
1066
|
]));
|
|
1053
1067
|
}
|
|
1054
1068
|
});
|
|
1055
|
-
const
|
|
1056
|
-
const e =
|
|
1069
|
+
const pe = (o, t) => {
|
|
1070
|
+
const e = o.__vccOpts || o;
|
|
1057
1071
|
for (const [s, n] of t)
|
|
1058
1072
|
e[s] = n;
|
|
1059
1073
|
return e;
|
|
1060
|
-
},
|
|
1074
|
+
}, de = /* @__PURE__ */ pe(xe, [["__scopeId", "data-v-743fd350"]]), fe = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, ge = { class: "text-gray-500 w-1/3" }, me = ["value"], be = ["value"], ze = /* @__PURE__ */ C({
|
|
1061
1075
|
__name: "ColorControl",
|
|
1062
1076
|
props: {
|
|
1063
1077
|
label: {},
|
|
1064
1078
|
control: {}
|
|
1065
1079
|
},
|
|
1066
1080
|
emits: ["change"],
|
|
1067
|
-
setup(
|
|
1081
|
+
setup(o, { emit: t }) {
|
|
1068
1082
|
function e(s) {
|
|
1069
1083
|
const { target: n } = s;
|
|
1070
1084
|
t("change", n.value);
|
|
1071
1085
|
}
|
|
1072
|
-
return (s, n) => (d(),
|
|
1073
|
-
p("label",
|
|
1086
|
+
return (s, n) => (d(), g("div", fe, [
|
|
1087
|
+
p("label", ge, v(s.label), 1),
|
|
1074
1088
|
p("input", {
|
|
1075
1089
|
value: s.control.value,
|
|
1076
1090
|
type: "color",
|
|
1077
1091
|
onInput: e
|
|
1078
|
-
}, null, 40,
|
|
1092
|
+
}, null, 40, me),
|
|
1079
1093
|
p("input", {
|
|
1080
1094
|
value: s.control.value,
|
|
1081
1095
|
class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
|
|
1082
1096
|
type: "text",
|
|
1083
1097
|
onInput: e
|
|
1084
|
-
}, null, 40,
|
|
1098
|
+
}, null, 40, be)
|
|
1085
1099
|
]));
|
|
1086
1100
|
}
|
|
1087
1101
|
});
|
|
1088
|
-
function
|
|
1089
|
-
return typeof
|
|
1102
|
+
function Me(o) {
|
|
1103
|
+
return typeof o == "number" ? [o, o, o] : o instanceof $ ? [o.x, o.y, o.z] : o;
|
|
1090
1104
|
}
|
|
1091
|
-
const
|
|
1105
|
+
const we = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, ve = { class: "text-gray-500 w-1/3" }, Ce = { class: "w-2/3 flex justify-between gap-1" }, Se = {
|
|
1092
1106
|
key: 0,
|
|
1093
1107
|
class: "font-bold px-0.5 py-1 text-0.65rem text-gray-300"
|
|
1094
|
-
},
|
|
1108
|
+
}, ke = ["value", "onInput", "onMousedown", "onMouseup"], $e = /* @__PURE__ */ C({
|
|
1095
1109
|
__name: "VectorControl",
|
|
1096
1110
|
props: {
|
|
1097
1111
|
label: {},
|
|
1098
1112
|
control: {}
|
|
1099
1113
|
},
|
|
1100
1114
|
emits: ["change"],
|
|
1101
|
-
setup(
|
|
1102
|
-
const e =
|
|
1103
|
-
|
|
1104
|
-
},
|
|
1105
|
-
|
|
1106
|
-
}, c = (x) => Math.floor(Math.abs(x) / 10),
|
|
1107
|
-
function u(x,
|
|
1115
|
+
setup(o, { emit: t }) {
|
|
1116
|
+
const e = o, s = F(), n = m(0), i = m(!1), a = m(0), l = (x, b) => {
|
|
1117
|
+
a.value = b, n.value = x.clientX, i.value = !0;
|
|
1118
|
+
}, y = (x, b) => {
|
|
1119
|
+
a.value = b, i.value = !1;
|
|
1120
|
+
}, c = (x) => Math.floor(Math.abs(x) / 10), h = E(() => Me(e.control.value)), r = E(() => Object.keys(e.control.value)), _ = E(() => e.control.value instanceof Q || e.control.value instanceof $);
|
|
1121
|
+
function u(x, b) {
|
|
1108
1122
|
const { value: z } = e.control, { target: f } = x;
|
|
1109
|
-
|
|
1123
|
+
a.value = b, z[_.value ? r.value[a.value] : a.value] = parseInt(f.value, 10), t("change", z);
|
|
1110
1124
|
}
|
|
1111
|
-
return
|
|
1125
|
+
return I(s.x, (x) => {
|
|
1112
1126
|
if (i.value) {
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1127
|
+
const b = x - n.value, z = c(b), { value: f } = e.control, M = _.value ? r.value[a.value] : a.value;
|
|
1128
|
+
b > 0 ? f[M] += 1 + z : b < 0 && (f[M] -= 1 + z), e.control.min !== void 0 && f < e.control.min && (f[M] = e.control.min), e.control.max !== void 0 && f > e.control.max && (f[M] = e.control.max), t("change", f), n.value = x;
|
|
1115
1129
|
}
|
|
1116
|
-
}), (x,
|
|
1117
|
-
p("label",
|
|
1118
|
-
p("div",
|
|
1119
|
-
(d(!0),
|
|
1130
|
+
}), (x, b) => (d(), g("div", we, [
|
|
1131
|
+
p("label", ve, v(x.label), 1),
|
|
1132
|
+
p("div", Ce, [
|
|
1133
|
+
(d(!0), g(P, null, L(h.value, (z, f) => (d(), g("div", {
|
|
1120
1134
|
key: x.label + f,
|
|
1121
1135
|
class: "flex items-center w-1/3 bg-gray-100 rounded"
|
|
1122
1136
|
}, [
|
|
1123
|
-
|
|
1137
|
+
r.value[f] && _.value ? (d(), g("span", Se, v(r.value[f]), 1)) : nt("", !0),
|
|
1124
1138
|
p("input", {
|
|
1125
1139
|
type: "text",
|
|
1126
1140
|
class: k(["w-full pl-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": i.value }]),
|
|
1127
|
-
value:
|
|
1141
|
+
value: h.value[f].toFixed(2),
|
|
1128
1142
|
onInput: (M) => u(M, f),
|
|
1129
1143
|
onMousedown: (M) => l(M, f),
|
|
1130
|
-
onMouseup: (M) =>
|
|
1131
|
-
}, null, 42,
|
|
1144
|
+
onMouseup: (M) => y(M, f)
|
|
1145
|
+
}, null, 42, ke)
|
|
1132
1146
|
]))), 128))
|
|
1133
1147
|
])
|
|
1134
1148
|
]));
|
|
1135
1149
|
}
|
|
1136
|
-
}),
|
|
1150
|
+
}), Ee = { class: "mb-4" }, Te = { class: "bg-white rounded-b pt-4" }, Ie = /* @__PURE__ */ C({
|
|
1137
1151
|
__name: "Folder",
|
|
1138
1152
|
props: {
|
|
1139
1153
|
control: {}
|
|
1140
1154
|
},
|
|
1141
|
-
setup(
|
|
1155
|
+
setup(o) {
|
|
1142
1156
|
function t(n, i) {
|
|
1143
1157
|
i.value = n;
|
|
1144
1158
|
}
|
|
1145
|
-
const e =
|
|
1159
|
+
const e = m(!1), s = () => {
|
|
1146
1160
|
e.value = !e.value;
|
|
1147
1161
|
};
|
|
1148
|
-
return (n, i) => (d(),
|
|
1162
|
+
return (n, i) => (d(), g("div", Ee, [
|
|
1149
1163
|
p("button", {
|
|
1150
1164
|
class: "flex items-center justify-between w-full p-4 bg-gray-100 border-none text-gray-400 font-bold text-xs focus:outline-none font-sans cursor-pointer",
|
|
1151
1165
|
onClick: s
|
|
1152
1166
|
}, [
|
|
1153
|
-
p("span", null,
|
|
1167
|
+
p("span", null, v(n.control.label), 1),
|
|
1154
1168
|
p("i", {
|
|
1155
1169
|
class: k(e.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
|
|
1156
1170
|
}, null, 2)
|
|
1157
1171
|
]),
|
|
1158
|
-
|
|
1172
|
+
wt(vt, {
|
|
1159
1173
|
name: "slide",
|
|
1160
1174
|
"enter-active-class": " animate-fade-in animate-duration-200 animate-ease-in-out",
|
|
1161
1175
|
"leave-active-class": " animate-fade-out animate-duration-200 animate-ease-in-out"
|
|
1162
1176
|
}, {
|
|
1163
1177
|
default: it(() => [
|
|
1164
|
-
et(p("div",
|
|
1165
|
-
(d(!0),
|
|
1166
|
-
key:
|
|
1167
|
-
control:
|
|
1168
|
-
onChange: (l) => t(l,
|
|
1178
|
+
et(p("div", Te, [
|
|
1179
|
+
(d(!0), g(P, null, L(n.control.controls, (a) => (d(), w(ut, {
|
|
1180
|
+
key: a.label,
|
|
1181
|
+
control: a,
|
|
1182
|
+
onChange: (l) => t(l, a)
|
|
1169
1183
|
}, null, 8, ["control", "onChange"]))), 128))
|
|
1170
1184
|
], 512), [
|
|
1171
1185
|
[st, e.value]
|
|
@@ -1175,26 +1189,26 @@ const ze = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, Me =
|
|
|
1175
1189
|
})
|
|
1176
1190
|
]));
|
|
1177
1191
|
}
|
|
1178
|
-
}), Ae = { class: "flex px-4 justify-between gap-4 items-center mb-2" },
|
|
1192
|
+
}), Ae = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, je = { class: "text-gray-500 w-1/3" }, qe = { 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" }, Pe = { class: "absolute bottom-0.5 right-0.5 font-sans text-xs" }, De = ["points"], G = 160, Y = 40, A = 2, J = 100, O = 20, Le = /* @__PURE__ */ C({
|
|
1179
1193
|
__name: "FPSGraph",
|
|
1180
1194
|
props: {
|
|
1181
1195
|
label: {},
|
|
1182
1196
|
control: {}
|
|
1183
1197
|
},
|
|
1184
|
-
setup(
|
|
1185
|
-
const t =
|
|
1198
|
+
setup(o) {
|
|
1199
|
+
const t = $t({ every: J }), e = m(""), s = m([]), n = m(G / A);
|
|
1186
1200
|
let i = performance.now();
|
|
1187
|
-
return
|
|
1188
|
-
|
|
1189
|
-
(l,
|
|
1201
|
+
return Et(({ timestamp: a }) => {
|
|
1202
|
+
a - i >= J && (i = a, s.value.push(t.value), s.value.length > n.value && s.value.shift(), e.value = s.value.map(
|
|
1203
|
+
(l, y) => `${y * A},${Y + O - A / 2 - l * (Y + O - A) / 120}`
|
|
1190
1204
|
).join(" "));
|
|
1191
|
-
}), (
|
|
1192
|
-
p("label",
|
|
1193
|
-
p("div",
|
|
1194
|
-
p("div",
|
|
1195
|
-
(d(),
|
|
1205
|
+
}), (a, l) => (d(), g("div", Ae, [
|
|
1206
|
+
p("label", je, v(a.label), 1),
|
|
1207
|
+
p("div", qe, [
|
|
1208
|
+
p("div", Pe, v(Math.round(j(t))) + " FPS", 1),
|
|
1209
|
+
(d(), g("svg", {
|
|
1196
1210
|
width: G,
|
|
1197
|
-
height:
|
|
1211
|
+
height: Y,
|
|
1198
1212
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1199
1213
|
class: "bg-gray-100"
|
|
1200
1214
|
}, [
|
|
@@ -1202,41 +1216,66 @@ const ze = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, Me =
|
|
|
1202
1216
|
points: e.value,
|
|
1203
1217
|
fill: "none",
|
|
1204
1218
|
stroke: "lightgray",
|
|
1205
|
-
"stroke-width":
|
|
1219
|
+
"stroke-width": A,
|
|
1206
1220
|
"stroke-linecap": "round",
|
|
1207
1221
|
"stroke-linejoin": "round"
|
|
1208
|
-
}, null, 8,
|
|
1222
|
+
}, null, 8, De)
|
|
1209
1223
|
]))
|
|
1210
1224
|
])
|
|
1211
1225
|
]));
|
|
1212
1226
|
}
|
|
1213
|
-
}),
|
|
1227
|
+
}), Ve = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, Xe = { class: "text-gray-500 w-1/3" }, Re = ["value"], Ye = ["value"], Fe = /* @__PURE__ */ C({
|
|
1228
|
+
__name: "SelectControl",
|
|
1229
|
+
props: {
|
|
1230
|
+
label: {},
|
|
1231
|
+
control: {}
|
|
1232
|
+
},
|
|
1233
|
+
emits: ["change"],
|
|
1234
|
+
setup(o, { emit: t }) {
|
|
1235
|
+
function e(s) {
|
|
1236
|
+
t("change", s.target.value);
|
|
1237
|
+
}
|
|
1238
|
+
return (s, n) => (d(), g("div", Ve, [
|
|
1239
|
+
p("label", Xe, v(s.label), 1),
|
|
1240
|
+
p("select", {
|
|
1241
|
+
value: s.control.value,
|
|
1242
|
+
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",
|
|
1243
|
+
onChange: e
|
|
1244
|
+
}, [
|
|
1245
|
+
(d(!0), g(P, null, L(s.control.options, (i) => (d(), g("option", {
|
|
1246
|
+
key: i.value,
|
|
1247
|
+
value: i.value
|
|
1248
|
+
}, v(i.text), 9, Ye))), 128))
|
|
1249
|
+
], 40, Re)
|
|
1250
|
+
]));
|
|
1251
|
+
}
|
|
1252
|
+
}), ut = /* @__PURE__ */ C({
|
|
1214
1253
|
__name: "ControlInput",
|
|
1215
1254
|
props: {
|
|
1216
1255
|
control: {}
|
|
1217
1256
|
},
|
|
1218
1257
|
emits: ["change"],
|
|
1219
|
-
setup(
|
|
1258
|
+
setup(o, { emit: t }) {
|
|
1220
1259
|
function e(s) {
|
|
1221
1260
|
t("change", s);
|
|
1222
1261
|
}
|
|
1223
|
-
return (s, n) => s.control.visible ? (d(),
|
|
1224
|
-
s.control.type === "color" ? (d(), w(
|
|
1262
|
+
return (s, n) => s.control.visible ? (d(), g(P, { key: 0 }, [
|
|
1263
|
+
s.control.type === "color" ? (d(), w(ze, {
|
|
1225
1264
|
key: 0,
|
|
1226
1265
|
label: s.control.label,
|
|
1227
1266
|
control: s.control,
|
|
1228
1267
|
onChange: e
|
|
1229
|
-
}, null, 8, ["label", "control"])) : s.control.type === "vector" ? (d(), w(
|
|
1268
|
+
}, null, 8, ["label", "control"])) : s.control.type === "vector" ? (d(), w($e, {
|
|
1230
1269
|
key: 1,
|
|
1231
1270
|
label: s.control.label,
|
|
1232
1271
|
control: s.control,
|
|
1233
1272
|
onChange: e
|
|
1234
|
-
}, null, 8, ["label", "control"])) : s.control.type === "boolean" ? (d(), w(
|
|
1273
|
+
}, null, 8, ["label", "control"])) : s.control.type === "boolean" ? (d(), w(ue, {
|
|
1235
1274
|
key: 2,
|
|
1236
1275
|
label: s.control.label,
|
|
1237
1276
|
control: s.control,
|
|
1238
1277
|
onChange: e
|
|
1239
|
-
}, null, 8, ["label", "control"])) : s.control.type === "fpsgraph" ? (d(), w(
|
|
1278
|
+
}, null, 8, ["label", "control"])) : s.control.type === "fpsgraph" ? (d(), w(Le, {
|
|
1240
1279
|
key: 3,
|
|
1241
1280
|
label: s.control.label,
|
|
1242
1281
|
control: s.control
|
|
@@ -1244,55 +1283,60 @@ const ze = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, Me =
|
|
|
1244
1283
|
key: 4,
|
|
1245
1284
|
label: s.control.label,
|
|
1246
1285
|
control: s.control
|
|
1247
|
-
}, null, 8, ["label", "control"])) : s.control.type === "number" ? (d(), w(
|
|
1286
|
+
}, null, 8, ["label", "control"])) : s.control.type === "number" ? (d(), w(te, {
|
|
1248
1287
|
key: 5,
|
|
1249
1288
|
label: s.control.label,
|
|
1250
1289
|
control: s.control,
|
|
1251
1290
|
onChange: e
|
|
1252
|
-
}, null, 8, ["label", "control"])) : s.control.type === "range" ? (d(), w(
|
|
1291
|
+
}, null, 8, ["label", "control"])) : s.control.type === "range" ? (d(), w(de, {
|
|
1253
1292
|
key: 6,
|
|
1254
1293
|
label: s.control.label,
|
|
1255
1294
|
control: s.control,
|
|
1256
1295
|
onChange: e
|
|
1257
|
-
}, null, 8, ["label", "control"])) : (d(), w(
|
|
1296
|
+
}, null, 8, ["label", "control"])) : s.control.type === "select" ? (d(), w(Fe, {
|
|
1258
1297
|
key: 7,
|
|
1259
1298
|
label: s.control.label,
|
|
1260
1299
|
control: s.control,
|
|
1261
1300
|
onChange: e
|
|
1301
|
+
}, null, 8, ["label", "control"])) : (d(), w(ie, {
|
|
1302
|
+
key: 8,
|
|
1303
|
+
label: s.control.label,
|
|
1304
|
+
control: s.control,
|
|
1305
|
+
onChange: e
|
|
1262
1306
|
}, null, 8, ["label", "control"]))
|
|
1263
1307
|
], 64)) : nt("", !0);
|
|
1264
1308
|
}
|
|
1265
|
-
}),
|
|
1309
|
+
}), He = { class: "bg-white shadow-xl rounded border-4 border-solid border-black" }, Qe = /* @__PURE__ */ p("i", { class: "h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs" }, "🍰", -1), We = /* @__PURE__ */ p("div", null, [
|
|
1266
1310
|
/* @__PURE__ */ p("i", { class: "i-ic-baseline-drag-indicator" }),
|
|
1267
1311
|
/* @__PURE__ */ p("i", { class: "i-ic-baseline-drag-indicator" }),
|
|
1268
1312
|
/* @__PURE__ */ p("i", { class: "i-ic-baseline-drag-indicator" })
|
|
1269
|
-
], -1),
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
],
|
|
1313
|
+
], -1), Ze = /* @__PURE__ */ p("div", null, null, -1), Ne = [
|
|
1314
|
+
Qe,
|
|
1315
|
+
We,
|
|
1316
|
+
Ze
|
|
1317
|
+
], Be = 280, Je = /* @__PURE__ */ C({
|
|
1274
1318
|
__name: "TresLeches",
|
|
1275
|
-
setup(
|
|
1276
|
-
const { width: t } =
|
|
1277
|
-
function n(i,
|
|
1278
|
-
|
|
1319
|
+
setup(o) {
|
|
1320
|
+
const { width: t } = Tt(), e = m(null), s = Ut();
|
|
1321
|
+
function n(i, a) {
|
|
1322
|
+
a.ref && (a.ref[a.label] = i), a.value = i;
|
|
1279
1323
|
}
|
|
1280
|
-
return (i,
|
|
1281
|
-
"initial-value": { x:
|
|
1324
|
+
return (i, a) => (d(), w(j(Ht), {
|
|
1325
|
+
"initial-value": { x: j(t) - Be - 20, y: 10 },
|
|
1282
1326
|
class: "fixed select-none z-24 w-280px font-sans text-xs",
|
|
1283
1327
|
handle: e.value
|
|
1284
1328
|
}, {
|
|
1285
1329
|
default: it(() => [
|
|
1286
|
-
p("div",
|
|
1330
|
+
p("div", He, [
|
|
1287
1331
|
p("header", {
|
|
1288
1332
|
ref_key: "handle",
|
|
1289
1333
|
ref: e,
|
|
1290
1334
|
class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
|
|
1291
|
-
},
|
|
1292
|
-
(d(!0),
|
|
1335
|
+
}, Ne, 512),
|
|
1336
|
+
(d(!0), g(P, null, L(j(s).controls, (l) => (d(), w(ut, {
|
|
1293
1337
|
key: l.label,
|
|
1294
1338
|
control: l,
|
|
1295
|
-
onChange: (
|
|
1339
|
+
onChange: (y) => n(y, l)
|
|
1296
1340
|
}, null, 8, ["control", "onChange"]))), 128))
|
|
1297
1341
|
])
|
|
1298
1342
|
]),
|
|
@@ -1301,6 +1345,6 @@ const ze = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, Me =
|
|
|
1301
1345
|
}
|
|
1302
1346
|
});
|
|
1303
1347
|
export {
|
|
1304
|
-
|
|
1305
|
-
|
|
1348
|
+
Je as TresLeches,
|
|
1349
|
+
Ge as useControls
|
|
1306
1350
|
};
|