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