@tresjs/leches 0.1.0 → 0.2.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/Folder.vue.d.ts +14 -0
- package/dist/composables/useControls.d.ts +3 -2
- package/dist/style.css +2 -2
- package/dist/tresleches.js +401 -351
- package/dist/tresleches.umd.cjs +3 -3
- package/package.json +1 -1
package/dist/tresleches.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/leches
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.2.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 z, getCurrentScope as
|
|
9
|
-
import { useStorage as
|
|
10
|
-
function
|
|
11
|
-
return
|
|
8
|
+
import { unref as z, getCurrentScope as ot, onScopeDispose as ht, toRef as at, readonly as lt, customRef as ct, ref as w, defineComponent as C, computed as S, reactive as B, h as ut, watch as E, inject as yt, isReactive as xt, toRefs as _t, isRef as O, openBlock as m, createElementBlock as b, createElementVNode as d, toDisplayString as $, normalizeClass as T, withDirectives as U, vShow as K, normalizeStyle as dt, Fragment as D, renderList as X, createCommentVNode as G, createVNode as mt, Transition as gt, withCtx as J, createBlock as v } from "vue";
|
|
9
|
+
import { useStorage as ft, isClient as pt, useDraggable as zt, useMouse as N, useWindowSize as Mt } from "@vueuse/core";
|
|
10
|
+
function tt(n) {
|
|
11
|
+
return ot() ? (ht(n), !0) : !1;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return typeof
|
|
13
|
+
function A(n) {
|
|
14
|
+
return typeof n == "function" ? n() : z(n);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
},
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
return
|
|
16
|
+
const et = typeof window < "u", st = () => {
|
|
17
|
+
}, H = /* @__PURE__ */ bt();
|
|
18
|
+
function bt() {
|
|
19
|
+
var n;
|
|
20
|
+
return et && ((n = window == null ? void 0 : window.navigator) == null ? void 0 : n.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 wt(...n) {
|
|
23
|
+
if (n.length !== 1)
|
|
24
|
+
return at(...n);
|
|
25
|
+
const t = n[0];
|
|
26
|
+
return typeof t == "function" ? lt(ct(() => ({ get: t, set: st }))) : w(t);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function vt(n) {
|
|
29
29
|
var t;
|
|
30
|
-
const e =
|
|
30
|
+
const e = A(n);
|
|
31
31
|
return (t = e == null ? void 0 : e.$el) != null ? t : e;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
35
|
-
let t, e, s,
|
|
36
|
-
if (typeof
|
|
37
|
-
return
|
|
33
|
+
const Ct = et ? window : void 0;
|
|
34
|
+
function St(...n) {
|
|
35
|
+
let t, e, s, i;
|
|
36
|
+
if (typeof n[0] == "string" || Array.isArray(n[0]) ? ([e, s, i] = n, t = Ct) : [t, e, s, i] = n, !t)
|
|
37
|
+
return st;
|
|
38
38
|
Array.isArray(e) || (e = [e]), Array.isArray(s) || (s = [s]);
|
|
39
|
-
const r = [],
|
|
39
|
+
const r = [], o = () => {
|
|
40
40
|
r.forEach((l) => l()), r.length = 0;
|
|
41
|
-
}, h = (l,
|
|
42
|
-
() => [
|
|
43
|
-
([l,
|
|
44
|
-
|
|
45
|
-
...e.flatMap((x) => s.map((c) => h(l, x, c,
|
|
41
|
+
}, h = (l, a, x, c) => (l.addEventListener(a, x, c), () => l.removeEventListener(a, x, c)), y = E(
|
|
42
|
+
() => [vt(t), A(i)],
|
|
43
|
+
([l, a]) => {
|
|
44
|
+
o(), l && r.push(
|
|
45
|
+
...e.flatMap((x) => s.map((c) => h(l, x, c, a)))
|
|
46
46
|
);
|
|
47
47
|
},
|
|
48
48
|
{ immediate: !0, flush: "post" }
|
|
49
49
|
), u = () => {
|
|
50
|
-
y(),
|
|
50
|
+
y(), o();
|
|
51
51
|
};
|
|
52
|
-
return
|
|
52
|
+
return tt(u), u;
|
|
53
53
|
}
|
|
54
|
-
var
|
|
54
|
+
var kt = Object.defineProperty, $t = Object.defineProperties, Et = Object.getOwnPropertyDescriptors, Q = Object.getOwnPropertySymbols, It = Object.prototype.hasOwnProperty, At = Object.prototype.propertyIsEnumerable, Z = (n, t, e) => t in n ? kt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, Tt = (n, t) => {
|
|
55
55
|
for (var e in t || (t = {}))
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
for (var e of
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
},
|
|
62
|
-
const
|
|
56
|
+
It.call(t, e) && Z(n, e, t[e]);
|
|
57
|
+
if (Q)
|
|
58
|
+
for (var e of Q(t))
|
|
59
|
+
At.call(t, e) && Z(n, e, t[e]);
|
|
60
|
+
return n;
|
|
61
|
+
}, qt = (n, t) => $t(n, Et(t));
|
|
62
|
+
const Dt = /* @__PURE__ */ C({
|
|
63
63
|
name: "UseDraggable",
|
|
64
64
|
props: [
|
|
65
65
|
"storageKey",
|
|
@@ -73,94 +73,94 @@ const It = /* @__PURE__ */ C({
|
|
|
73
73
|
"handle",
|
|
74
74
|
"axis"
|
|
75
75
|
],
|
|
76
|
-
setup(
|
|
77
|
-
const e = w(), s =
|
|
76
|
+
setup(n, { slots: t }) {
|
|
77
|
+
const e = w(), s = S(() => {
|
|
78
78
|
var y;
|
|
79
|
-
return (y =
|
|
80
|
-
}),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
), r =
|
|
85
|
-
|
|
86
|
-
}, h =
|
|
79
|
+
return (y = n.handle) != null ? y : e.value;
|
|
80
|
+
}), i = n.storageKey && ft(
|
|
81
|
+
n.storageKey,
|
|
82
|
+
A(n.initialValue) || { x: 0, y: 0 },
|
|
83
|
+
pt ? n.storageType === "session" ? sessionStorage : localStorage : void 0
|
|
84
|
+
), r = i || n.initialValue || { x: 0, y: 0 }, o = (y) => {
|
|
85
|
+
i && (i.value.x = y.x, i.value.y = y.y);
|
|
86
|
+
}, h = B(zt(e, qt(Tt({}, n), {
|
|
87
87
|
handle: s,
|
|
88
88
|
initialValue: r,
|
|
89
|
-
onEnd:
|
|
89
|
+
onEnd: o
|
|
90
90
|
})));
|
|
91
91
|
return () => {
|
|
92
92
|
if (t.default)
|
|
93
|
-
return
|
|
93
|
+
return ut(n.as || "div", { ref: e, style: `touch-action:none;${h.style}` }, t.default(h));
|
|
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 nt(n) {
|
|
98
|
+
const t = window.getComputedStyle(n);
|
|
99
|
+
if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && n.clientHeight < n.scrollHeight || t.overflowY === "auto" && n.clientWidth < n.scrollWidth)
|
|
100
100
|
return !0;
|
|
101
101
|
{
|
|
102
|
-
const e =
|
|
103
|
-
return !e || e.tagName === "BODY" ? !1 :
|
|
102
|
+
const e = n.parentNode;
|
|
103
|
+
return !e || e.tagName === "BODY" ? !1 : nt(e);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const t =
|
|
108
|
-
return
|
|
106
|
+
function jt(n) {
|
|
107
|
+
const t = n || window.event, e = t.target;
|
|
108
|
+
return nt(e) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Pt(n, t = !1) {
|
|
111
111
|
const e = w(t);
|
|
112
|
-
let s = null,
|
|
113
|
-
E(
|
|
112
|
+
let s = null, i;
|
|
113
|
+
E(wt(n), (h) => {
|
|
114
114
|
if (h) {
|
|
115
115
|
const y = h;
|
|
116
|
-
|
|
116
|
+
i = y.style.overflow, e.value && (y.style.overflow = "hidden");
|
|
117
117
|
}
|
|
118
118
|
}, {
|
|
119
119
|
immediate: !0
|
|
120
120
|
});
|
|
121
121
|
const r = () => {
|
|
122
|
-
const h =
|
|
123
|
-
!h || e.value || (
|
|
122
|
+
const h = A(n);
|
|
123
|
+
!h || e.value || (H && (s = St(
|
|
124
124
|
h,
|
|
125
125
|
"touchmove",
|
|
126
126
|
(y) => {
|
|
127
|
-
|
|
127
|
+
jt(y);
|
|
128
128
|
},
|
|
129
129
|
{ passive: !1 }
|
|
130
130
|
)), h.style.overflow = "hidden", e.value = !0);
|
|
131
|
-
},
|
|
132
|
-
const h =
|
|
133
|
-
!h || !e.value || (
|
|
131
|
+
}, o = () => {
|
|
132
|
+
const h = A(n);
|
|
133
|
+
!h || !e.value || (H && (s == null || s()), h.style.overflow = i, e.value = !1);
|
|
134
134
|
};
|
|
135
|
-
return
|
|
135
|
+
return tt(o), S({
|
|
136
136
|
get() {
|
|
137
137
|
return e.value;
|
|
138
138
|
},
|
|
139
139
|
set(h) {
|
|
140
|
-
h ? r() :
|
|
140
|
+
h ? r() : o();
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
let
|
|
144
|
+
function Lt() {
|
|
145
|
+
let n = !1;
|
|
146
146
|
const t = w(!1);
|
|
147
147
|
return (e, s) => {
|
|
148
|
-
if (t.value = s.value,
|
|
148
|
+
if (t.value = s.value, n)
|
|
149
149
|
return;
|
|
150
|
-
|
|
151
|
-
const
|
|
152
|
-
E(t, (r) =>
|
|
150
|
+
n = !0;
|
|
151
|
+
const i = Pt(e, s.value);
|
|
152
|
+
E(t, (r) => i.value = r);
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
const
|
|
155
|
+
Lt();
|
|
156
|
+
const Vt = Symbol("CONTROLS_CONTEXT_KEY"), V = B({
|
|
157
157
|
controls: []
|
|
158
158
|
});
|
|
159
|
-
function
|
|
160
|
-
return
|
|
159
|
+
function Xt() {
|
|
160
|
+
return V;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
return Object.entries(
|
|
162
|
+
function P(n) {
|
|
163
|
+
return Object.entries(n).map(([t, e]) => !O(e) && e.value ? {
|
|
164
164
|
...e,
|
|
165
165
|
label: e.label || t,
|
|
166
166
|
value: e.value,
|
|
@@ -169,33 +169,39 @@ function Q(i) {
|
|
|
169
169
|
} : {
|
|
170
170
|
label: e.label || t,
|
|
171
171
|
value: e,
|
|
172
|
-
type:
|
|
172
|
+
type: O(e) ? typeof e.value : typeof e,
|
|
173
173
|
visible: !0
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
if (typeof
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
function Ee(n, t) {
|
|
177
|
+
const e = yt(Vt, {});
|
|
178
|
+
let s = [];
|
|
179
|
+
if (typeof n == "string")
|
|
180
|
+
s.push({
|
|
181
|
+
label: n,
|
|
182
|
+
visible: !0,
|
|
183
|
+
type: "folder",
|
|
184
|
+
controls: P(t)
|
|
185
|
+
});
|
|
186
|
+
else if (xt(n)) {
|
|
187
|
+
const i = _t(n);
|
|
188
|
+
s = P(i);
|
|
189
|
+
} else
|
|
190
|
+
s = P(n);
|
|
191
|
+
return V.controls = [...V.controls, ...s], e;
|
|
186
192
|
}
|
|
187
193
|
/**
|
|
188
194
|
* @license
|
|
189
195
|
* Copyright 2010-2023 Three.js Authors
|
|
190
196
|
* SPDX-License-Identifier: MIT
|
|
191
197
|
*/
|
|
192
|
-
const
|
|
193
|
-
function
|
|
194
|
-
return Math.max(t, Math.min(e,
|
|
198
|
+
const it = "152";
|
|
199
|
+
function R(n, t, e) {
|
|
200
|
+
return Math.max(t, Math.min(e, n));
|
|
195
201
|
}
|
|
196
|
-
class
|
|
202
|
+
class j {
|
|
197
203
|
constructor(t = 0, e = 0) {
|
|
198
|
-
|
|
204
|
+
j.prototype.isVector2 = !0, this.x = t, this.y = e;
|
|
199
205
|
}
|
|
200
206
|
get width() {
|
|
201
207
|
return this.x;
|
|
@@ -284,8 +290,8 @@ class D {
|
|
|
284
290
|
return this.multiplyScalar(1 / t);
|
|
285
291
|
}
|
|
286
292
|
applyMatrix3(t) {
|
|
287
|
-
const e = this.x, s = this.y,
|
|
288
|
-
return this.x =
|
|
293
|
+
const e = this.x, s = this.y, i = t.elements;
|
|
294
|
+
return this.x = i[0] * e + i[3] * s + i[6], this.y = i[1] * e + i[4] * s + i[7], this;
|
|
289
295
|
}
|
|
290
296
|
min(t) {
|
|
291
297
|
return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this;
|
|
@@ -344,7 +350,7 @@ class D {
|
|
|
344
350
|
if (e === 0)
|
|
345
351
|
return Math.PI / 2;
|
|
346
352
|
const s = this.dot(t) / e;
|
|
347
|
-
return Math.acos(
|
|
353
|
+
return Math.acos(R(s, -1, 1));
|
|
348
354
|
}
|
|
349
355
|
distanceTo(t) {
|
|
350
356
|
return Math.sqrt(this.distanceToSquared(t));
|
|
@@ -378,8 +384,8 @@ class D {
|
|
|
378
384
|
return this.x = t.getX(e), this.y = t.getY(e), this;
|
|
379
385
|
}
|
|
380
386
|
rotateAround(t, e) {
|
|
381
|
-
const s = Math.cos(e),
|
|
382
|
-
return this.x = r * s -
|
|
387
|
+
const s = Math.cos(e), i = Math.sin(e), r = this.x - t.x, o = this.y - t.y;
|
|
388
|
+
return this.x = r * s - o * i + t.x, this.y = r * i + o * s + t.y, this;
|
|
383
389
|
}
|
|
384
390
|
random() {
|
|
385
391
|
return this.x = Math.random(), this.y = Math.random(), this;
|
|
@@ -388,39 +394,39 @@ class D {
|
|
|
388
394
|
yield this.x, yield this.y;
|
|
389
395
|
}
|
|
390
396
|
}
|
|
391
|
-
class
|
|
392
|
-
constructor(t = 0, e = 0, s = 0,
|
|
393
|
-
this.isQuaternion = !0, this._x = t, this._y = e, this._z = s, this._w =
|
|
397
|
+
class Nt {
|
|
398
|
+
constructor(t = 0, e = 0, s = 0, i = 1) {
|
|
399
|
+
this.isQuaternion = !0, this._x = t, this._y = e, this._z = s, this._w = i;
|
|
394
400
|
}
|
|
395
|
-
static slerpFlat(t, e, s,
|
|
396
|
-
let y = s[
|
|
397
|
-
const x = r[
|
|
401
|
+
static slerpFlat(t, e, s, i, r, o, h) {
|
|
402
|
+
let y = s[i + 0], u = s[i + 1], l = s[i + 2], a = s[i + 3];
|
|
403
|
+
const x = r[o + 0], c = r[o + 1], _ = r[o + 2], f = r[o + 3];
|
|
398
404
|
if (h === 0) {
|
|
399
|
-
t[e + 0] = y, t[e + 1] = u, t[e + 2] = l, t[e + 3] =
|
|
405
|
+
t[e + 0] = y, t[e + 1] = u, t[e + 2] = l, t[e + 3] = a;
|
|
400
406
|
return;
|
|
401
407
|
}
|
|
402
408
|
if (h === 1) {
|
|
403
409
|
t[e + 0] = x, t[e + 1] = c, t[e + 2] = _, t[e + 3] = f;
|
|
404
410
|
return;
|
|
405
411
|
}
|
|
406
|
-
if (
|
|
412
|
+
if (a !== f || y !== x || u !== c || l !== _) {
|
|
407
413
|
let p = 1 - h;
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
410
|
-
const
|
|
411
|
-
p = Math.sin(p *
|
|
414
|
+
const g = y * x + u * c + l * _ + a * f, M = g >= 0 ? 1 : -1, F = 1 - g * g;
|
|
415
|
+
if (F > Number.EPSILON) {
|
|
416
|
+
const k = Math.sqrt(F), Y = Math.atan2(k, g * M);
|
|
417
|
+
p = Math.sin(p * Y) / k, h = Math.sin(h * Y) / k;
|
|
412
418
|
}
|
|
413
|
-
const
|
|
414
|
-
if (y = y * p + x *
|
|
415
|
-
const
|
|
416
|
-
y *=
|
|
419
|
+
const q = h * M;
|
|
420
|
+
if (y = y * p + x * q, u = u * p + c * q, l = l * p + _ * q, a = a * p + f * q, p === 1 - h) {
|
|
421
|
+
const k = 1 / Math.sqrt(y * y + u * u + l * l + a * a);
|
|
422
|
+
y *= k, u *= k, l *= k, a *= k;
|
|
417
423
|
}
|
|
418
424
|
}
|
|
419
|
-
t[e] = y, t[e + 1] = u, t[e + 2] = l, t[e + 3] =
|
|
425
|
+
t[e] = y, t[e + 1] = u, t[e + 2] = l, t[e + 3] = a;
|
|
420
426
|
}
|
|
421
|
-
static multiplyQuaternionsFlat(t, e, s,
|
|
422
|
-
const h = s[
|
|
423
|
-
return t[e] = h * _ + l *
|
|
427
|
+
static multiplyQuaternionsFlat(t, e, s, i, r, o) {
|
|
428
|
+
const h = s[i], y = s[i + 1], u = s[i + 2], l = s[i + 3], a = r[o], x = r[o + 1], c = r[o + 2], _ = r[o + 3];
|
|
429
|
+
return t[e] = h * _ + l * a + y * c - u * x, t[e + 1] = y * _ + l * x + u * a - h * c, t[e + 2] = u * _ + l * c + h * x - y * a, t[e + 3] = l * _ - h * a - y * x - u * c, t;
|
|
424
430
|
}
|
|
425
431
|
get x() {
|
|
426
432
|
return this._x;
|
|
@@ -446,8 +452,8 @@ class Lt {
|
|
|
446
452
|
set w(t) {
|
|
447
453
|
this._w = t, this._onChangeCallback();
|
|
448
454
|
}
|
|
449
|
-
set(t, e, s,
|
|
450
|
-
return this._x = t, this._y = e, this._z = s, this._w =
|
|
455
|
+
set(t, e, s, i) {
|
|
456
|
+
return this._x = t, this._y = e, this._z = s, this._w = i, this._onChangeCallback(), this;
|
|
451
457
|
}
|
|
452
458
|
clone() {
|
|
453
459
|
return new this.constructor(this._x, this._y, this._z, this._w);
|
|
@@ -456,49 +462,49 @@ class Lt {
|
|
|
456
462
|
return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
|
|
457
463
|
}
|
|
458
464
|
setFromEuler(t, e) {
|
|
459
|
-
const s = t._x,
|
|
460
|
-
switch (
|
|
465
|
+
const s = t._x, i = t._y, r = t._z, o = t._order, h = Math.cos, y = Math.sin, u = h(s / 2), l = h(i / 2), a = h(r / 2), x = y(s / 2), c = y(i / 2), _ = y(r / 2);
|
|
466
|
+
switch (o) {
|
|
461
467
|
case "XYZ":
|
|
462
|
-
this._x = x * l *
|
|
468
|
+
this._x = x * l * a + u * c * _, this._y = u * c * a - x * l * _, this._z = u * l * _ + x * c * a, this._w = u * l * a - x * c * _;
|
|
463
469
|
break;
|
|
464
470
|
case "YXZ":
|
|
465
|
-
this._x = x * l *
|
|
471
|
+
this._x = x * l * a + u * c * _, this._y = u * c * a - x * l * _, this._z = u * l * _ - x * c * a, this._w = u * l * a + x * c * _;
|
|
466
472
|
break;
|
|
467
473
|
case "ZXY":
|
|
468
|
-
this._x = x * l *
|
|
474
|
+
this._x = x * l * a - u * c * _, this._y = u * c * a + x * l * _, this._z = u * l * _ + x * c * a, this._w = u * l * a - x * c * _;
|
|
469
475
|
break;
|
|
470
476
|
case "ZYX":
|
|
471
|
-
this._x = x * l *
|
|
477
|
+
this._x = x * l * a - u * c * _, this._y = u * c * a + x * l * _, this._z = u * l * _ - x * c * a, this._w = u * l * a + x * c * _;
|
|
472
478
|
break;
|
|
473
479
|
case "YZX":
|
|
474
|
-
this._x = x * l *
|
|
480
|
+
this._x = x * l * a + u * c * _, this._y = u * c * a + x * l * _, this._z = u * l * _ - x * c * a, this._w = u * l * a - x * c * _;
|
|
475
481
|
break;
|
|
476
482
|
case "XZY":
|
|
477
|
-
this._x = x * l *
|
|
483
|
+
this._x = x * l * a - u * c * _, this._y = u * c * a - x * l * _, this._z = u * l * _ + x * c * a, this._w = u * l * a + x * c * _;
|
|
478
484
|
break;
|
|
479
485
|
default:
|
|
480
|
-
console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " +
|
|
486
|
+
console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + o);
|
|
481
487
|
}
|
|
482
488
|
return e !== !1 && this._onChangeCallback(), this;
|
|
483
489
|
}
|
|
484
490
|
setFromAxisAngle(t, e) {
|
|
485
|
-
const s = e / 2,
|
|
486
|
-
return this._x = t.x *
|
|
491
|
+
const s = e / 2, i = Math.sin(s);
|
|
492
|
+
return this._x = t.x * i, this._y = t.y * i, this._z = t.z * i, this._w = Math.cos(s), this._onChangeCallback(), this;
|
|
487
493
|
}
|
|
488
494
|
setFromRotationMatrix(t) {
|
|
489
|
-
const e = t.elements, s = e[0],
|
|
495
|
+
const e = t.elements, s = e[0], i = e[4], r = e[8], o = e[1], h = e[5], y = e[9], u = e[2], l = e[6], a = e[10], x = s + h + a;
|
|
490
496
|
if (x > 0) {
|
|
491
497
|
const c = 0.5 / Math.sqrt(x + 1);
|
|
492
|
-
this._w = 0.25 / c, this._x = (l - y) * c, this._y = (r - u) * c, this._z = (
|
|
493
|
-
} else if (s > h && s >
|
|
494
|
-
const c = 2 * Math.sqrt(1 + s - h -
|
|
495
|
-
this._w = (l - y) / c, this._x = 0.25 * c, this._y = (
|
|
496
|
-
} else if (h >
|
|
497
|
-
const c = 2 * Math.sqrt(1 + h - s -
|
|
498
|
-
this._w = (r - u) / c, this._x = (
|
|
498
|
+
this._w = 0.25 / c, this._x = (l - y) * c, this._y = (r - u) * c, this._z = (o - i) * c;
|
|
499
|
+
} else if (s > h && s > a) {
|
|
500
|
+
const c = 2 * Math.sqrt(1 + s - h - a);
|
|
501
|
+
this._w = (l - y) / c, this._x = 0.25 * c, this._y = (i + o) / c, this._z = (r + u) / c;
|
|
502
|
+
} else if (h > a) {
|
|
503
|
+
const c = 2 * Math.sqrt(1 + h - s - a);
|
|
504
|
+
this._w = (r - u) / c, this._x = (i + o) / c, this._y = 0.25 * c, this._z = (y + l) / c;
|
|
499
505
|
} else {
|
|
500
|
-
const c = 2 * Math.sqrt(1 +
|
|
501
|
-
this._w = (
|
|
506
|
+
const c = 2 * Math.sqrt(1 + a - s - h);
|
|
507
|
+
this._w = (o - i) / c, this._x = (r + u) / c, this._y = (y + l) / c, this._z = 0.25 * c;
|
|
502
508
|
}
|
|
503
509
|
return this._onChangeCallback(), this;
|
|
504
510
|
}
|
|
@@ -507,14 +513,14 @@ class Lt {
|
|
|
507
513
|
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
514
|
}
|
|
509
515
|
angleTo(t) {
|
|
510
|
-
return 2 * Math.acos(Math.abs(
|
|
516
|
+
return 2 * Math.acos(Math.abs(R(this.dot(t), -1, 1)));
|
|
511
517
|
}
|
|
512
518
|
rotateTowards(t, e) {
|
|
513
519
|
const s = this.angleTo(t);
|
|
514
520
|
if (s === 0)
|
|
515
521
|
return this;
|
|
516
|
-
const
|
|
517
|
-
return this.slerp(t,
|
|
522
|
+
const i = Math.min(1, e / s);
|
|
523
|
+
return this.slerp(t, i), this;
|
|
518
524
|
}
|
|
519
525
|
identity() {
|
|
520
526
|
return this.set(0, 0, 0, 1);
|
|
@@ -545,36 +551,36 @@ class Lt {
|
|
|
545
551
|
return this.multiplyQuaternions(t, this);
|
|
546
552
|
}
|
|
547
553
|
multiplyQuaternions(t, e) {
|
|
548
|
-
const s = t._x,
|
|
549
|
-
return this._x = s * l +
|
|
554
|
+
const s = t._x, i = t._y, r = t._z, o = t._w, h = e._x, y = e._y, u = e._z, l = e._w;
|
|
555
|
+
return this._x = s * l + o * h + i * u - r * y, this._y = i * l + o * y + r * h - s * u, this._z = r * l + o * u + s * y - i * h, this._w = o * l - s * h - i * y - r * u, this._onChangeCallback(), this;
|
|
550
556
|
}
|
|
551
557
|
slerp(t, e) {
|
|
552
558
|
if (e === 0)
|
|
553
559
|
return this;
|
|
554
560
|
if (e === 1)
|
|
555
561
|
return this.copy(t);
|
|
556
|
-
const s = this._x,
|
|
557
|
-
let h =
|
|
562
|
+
const s = this._x, i = this._y, r = this._z, o = this._w;
|
|
563
|
+
let h = o * t._w + s * t._x + i * t._y + r * t._z;
|
|
558
564
|
if (h < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, h = -h) : this.copy(t), h >= 1)
|
|
559
|
-
return this._w =
|
|
565
|
+
return this._w = o, this._x = s, this._y = i, this._z = r, this;
|
|
560
566
|
const y = 1 - h * h;
|
|
561
567
|
if (y <= Number.EPSILON) {
|
|
562
568
|
const c = 1 - e;
|
|
563
|
-
return this._w = c *
|
|
569
|
+
return this._w = c * o + e * this._w, this._x = c * s + e * this._x, this._y = c * i + e * this._y, this._z = c * r + e * this._z, this.normalize(), this._onChangeCallback(), this;
|
|
564
570
|
}
|
|
565
|
-
const u = Math.sqrt(y), l = Math.atan2(u, h),
|
|
566
|
-
return this._w =
|
|
571
|
+
const u = Math.sqrt(y), l = Math.atan2(u, h), a = Math.sin((1 - e) * l) / u, x = Math.sin(e * l) / u;
|
|
572
|
+
return this._w = o * a + this._w * x, this._x = s * a + this._x * x, this._y = i * a + this._y * x, this._z = r * a + this._z * x, this._onChangeCallback(), this;
|
|
567
573
|
}
|
|
568
574
|
slerpQuaternions(t, e, s) {
|
|
569
575
|
return this.copy(t).slerp(e, s);
|
|
570
576
|
}
|
|
571
577
|
random() {
|
|
572
|
-
const t = Math.random(), e = Math.sqrt(1 - t), s = Math.sqrt(t),
|
|
578
|
+
const t = Math.random(), e = Math.sqrt(1 - t), s = Math.sqrt(t), i = 2 * Math.PI * Math.random(), r = 2 * Math.PI * Math.random();
|
|
573
579
|
return this.set(
|
|
574
|
-
e * Math.cos(
|
|
580
|
+
e * Math.cos(i),
|
|
575
581
|
s * Math.sin(r),
|
|
576
582
|
s * Math.cos(r),
|
|
577
|
-
e * Math.sin(
|
|
583
|
+
e * Math.sin(i)
|
|
578
584
|
);
|
|
579
585
|
}
|
|
580
586
|
equals(t) {
|
|
@@ -601,9 +607,9 @@ class Lt {
|
|
|
601
607
|
yield this._x, yield this._y, yield this._z, yield this._w;
|
|
602
608
|
}
|
|
603
609
|
}
|
|
604
|
-
class
|
|
610
|
+
class I {
|
|
605
611
|
constructor(t = 0, e = 0, s = 0) {
|
|
606
|
-
|
|
612
|
+
I.prototype.isVector3 = !0, this.x = t, this.y = e, this.z = s;
|
|
607
613
|
}
|
|
608
614
|
set(t, e, s) {
|
|
609
615
|
return s === void 0 && (s = this.z), this.x = t, this.y = e, this.z = s, this;
|
|
@@ -685,25 +691,25 @@ class A {
|
|
|
685
691
|
return this.x = t.x * e.x, this.y = t.y * e.y, this.z = t.z * e.z, this;
|
|
686
692
|
}
|
|
687
693
|
applyEuler(t) {
|
|
688
|
-
return this.applyQuaternion(
|
|
694
|
+
return this.applyQuaternion(W.setFromEuler(t));
|
|
689
695
|
}
|
|
690
696
|
applyAxisAngle(t, e) {
|
|
691
|
-
return this.applyQuaternion(
|
|
697
|
+
return this.applyQuaternion(W.setFromAxisAngle(t, e));
|
|
692
698
|
}
|
|
693
699
|
applyMatrix3(t) {
|
|
694
|
-
const e = this.x, s = this.y,
|
|
695
|
-
return this.x = r[0] * e + r[3] * s + r[6] *
|
|
700
|
+
const e = this.x, s = this.y, i = this.z, r = t.elements;
|
|
701
|
+
return this.x = r[0] * e + r[3] * s + r[6] * i, this.y = r[1] * e + r[4] * s + r[7] * i, this.z = r[2] * e + r[5] * s + r[8] * i, this;
|
|
696
702
|
}
|
|
697
703
|
applyNormalMatrix(t) {
|
|
698
704
|
return this.applyMatrix3(t).normalize();
|
|
699
705
|
}
|
|
700
706
|
applyMatrix4(t) {
|
|
701
|
-
const e = this.x, s = this.y,
|
|
702
|
-
return this.x = (r[0] * e + r[4] * s + r[8] *
|
|
707
|
+
const e = this.x, s = this.y, i = this.z, r = t.elements, o = 1 / (r[3] * e + r[7] * s + r[11] * i + r[15]);
|
|
708
|
+
return this.x = (r[0] * e + r[4] * s + r[8] * i + r[12]) * o, this.y = (r[1] * e + r[5] * s + r[9] * i + r[13]) * o, this.z = (r[2] * e + r[6] * s + r[10] * i + r[14]) * o, this;
|
|
703
709
|
}
|
|
704
710
|
applyQuaternion(t) {
|
|
705
|
-
const e = this.x, s = this.y,
|
|
706
|
-
return this.x = u * y + x * -r + l * -h -
|
|
711
|
+
const e = this.x, s = this.y, i = this.z, r = t.x, o = t.y, h = t.z, y = t.w, u = y * e + o * i - h * s, l = y * s + h * e - r * i, a = y * i + r * s - o * e, x = -r * e - o * s - h * i;
|
|
712
|
+
return this.x = u * y + x * -r + l * -h - a * -o, this.y = l * y + x * -o + a * -r - u * -h, this.z = a * y + x * -h + u * -o - l * -r, this;
|
|
707
713
|
}
|
|
708
714
|
project(t) {
|
|
709
715
|
return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);
|
|
@@ -712,8 +718,8 @@ class A {
|
|
|
712
718
|
return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld);
|
|
713
719
|
}
|
|
714
720
|
transformDirection(t) {
|
|
715
|
-
const e = this.x, s = this.y,
|
|
716
|
-
return this.x = r[0] * e + r[4] * s + r[8] *
|
|
721
|
+
const e = this.x, s = this.y, i = this.z, r = t.elements;
|
|
722
|
+
return this.x = r[0] * e + r[4] * s + r[8] * i, this.y = r[1] * e + r[5] * s + r[9] * i, this.z = r[2] * e + r[6] * s + r[10] * i, this.normalize();
|
|
717
723
|
}
|
|
718
724
|
divide(t) {
|
|
719
725
|
return this.x /= t.x, this.y /= t.y, this.z /= t.z, this;
|
|
@@ -781,8 +787,8 @@ class A {
|
|
|
781
787
|
return this.crossVectors(this, t);
|
|
782
788
|
}
|
|
783
789
|
crossVectors(t, e) {
|
|
784
|
-
const s = t.x,
|
|
785
|
-
return this.x =
|
|
790
|
+
const s = t.x, i = t.y, r = t.z, o = e.x, h = e.y, y = e.z;
|
|
791
|
+
return this.x = i * y - r * h, this.y = r * o - s * y, this.z = s * h - i * o, this;
|
|
786
792
|
}
|
|
787
793
|
projectOnVector(t) {
|
|
788
794
|
const e = t.lengthSq();
|
|
@@ -792,24 +798,24 @@ class A {
|
|
|
792
798
|
return this.copy(t).multiplyScalar(s);
|
|
793
799
|
}
|
|
794
800
|
projectOnPlane(t) {
|
|
795
|
-
return
|
|
801
|
+
return L.copy(this).projectOnVector(t), this.sub(L);
|
|
796
802
|
}
|
|
797
803
|
reflect(t) {
|
|
798
|
-
return this.sub(
|
|
804
|
+
return this.sub(L.copy(t).multiplyScalar(2 * this.dot(t)));
|
|
799
805
|
}
|
|
800
806
|
angleTo(t) {
|
|
801
807
|
const e = Math.sqrt(this.lengthSq() * t.lengthSq());
|
|
802
808
|
if (e === 0)
|
|
803
809
|
return Math.PI / 2;
|
|
804
810
|
const s = this.dot(t) / e;
|
|
805
|
-
return Math.acos(
|
|
811
|
+
return Math.acos(R(s, -1, 1));
|
|
806
812
|
}
|
|
807
813
|
distanceTo(t) {
|
|
808
814
|
return Math.sqrt(this.distanceToSquared(t));
|
|
809
815
|
}
|
|
810
816
|
distanceToSquared(t) {
|
|
811
|
-
const e = this.x - t.x, s = this.y - t.y,
|
|
812
|
-
return e * e + s * s +
|
|
817
|
+
const e = this.x - t.x, s = this.y - t.y, i = this.z - t.z;
|
|
818
|
+
return e * e + s * s + i * i;
|
|
813
819
|
}
|
|
814
820
|
manhattanDistanceTo(t) {
|
|
815
821
|
return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z);
|
|
@@ -818,8 +824,8 @@ class A {
|
|
|
818
824
|
return this.setFromSphericalCoords(t.radius, t.phi, t.theta);
|
|
819
825
|
}
|
|
820
826
|
setFromSphericalCoords(t, e, s) {
|
|
821
|
-
const
|
|
822
|
-
return this.x =
|
|
827
|
+
const i = Math.sin(e) * t;
|
|
828
|
+
return this.x = i * Math.sin(s), this.y = Math.cos(e) * t, this.z = i * Math.cos(s), this;
|
|
823
829
|
}
|
|
824
830
|
setFromCylindrical(t) {
|
|
825
831
|
return this.setFromCylindricalCoords(t.radius, t.theta, t.y);
|
|
@@ -832,8 +838,8 @@ class A {
|
|
|
832
838
|
return this.x = e[12], this.y = e[13], this.z = e[14], this;
|
|
833
839
|
}
|
|
834
840
|
setFromMatrixScale(t) {
|
|
835
|
-
const e = this.setFromMatrixColumn(t, 0).length(), s = this.setFromMatrixColumn(t, 1).length(),
|
|
836
|
-
return this.x = e, this.y = s, this.z =
|
|
841
|
+
const e = this.setFromMatrixColumn(t, 0).length(), s = this.setFromMatrixColumn(t, 1).length(), i = this.setFromMatrixColumn(t, 2).length();
|
|
842
|
+
return this.x = e, this.y = s, this.z = i, this;
|
|
837
843
|
}
|
|
838
844
|
setFromMatrixColumn(t, e) {
|
|
839
845
|
return this.fromArray(t.elements, e * 4);
|
|
@@ -870,323 +876,367 @@ class A {
|
|
|
870
876
|
yield this.x, yield this.y, yield this.z;
|
|
871
877
|
}
|
|
872
878
|
}
|
|
873
|
-
const
|
|
879
|
+
const L = /* @__PURE__ */ new I(), W = /* @__PURE__ */ new Nt();
|
|
874
880
|
typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
|
|
875
|
-
revision:
|
|
881
|
+
revision: it
|
|
876
882
|
} }));
|
|
877
|
-
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ =
|
|
878
|
-
const
|
|
883
|
+
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = it);
|
|
884
|
+
const Rt = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Ft = { class: "text-gray-500 w-1/3" }, Yt = ["value", "min", "max", "step"], Ot = /* @__PURE__ */ C({
|
|
879
885
|
__name: "NumberControl",
|
|
880
886
|
props: {
|
|
881
887
|
label: null,
|
|
882
888
|
control: null
|
|
883
889
|
},
|
|
884
890
|
emits: ["change"],
|
|
885
|
-
setup(
|
|
886
|
-
const e =
|
|
891
|
+
setup(n, { emit: t }) {
|
|
892
|
+
const e = n;
|
|
887
893
|
function s(l) {
|
|
888
|
-
const { target:
|
|
889
|
-
t("change",
|
|
894
|
+
const { target: a } = l;
|
|
895
|
+
t("change", a.valueAsNumber);
|
|
890
896
|
}
|
|
891
|
-
const
|
|
892
|
-
r.value = l.clientX,
|
|
897
|
+
const i = N(), r = w(0), o = w(!1), h = (l) => {
|
|
898
|
+
r.value = l.clientX, o.value = !0;
|
|
893
899
|
}, y = () => {
|
|
894
|
-
|
|
900
|
+
o.value = !1;
|
|
895
901
|
}, u = (l) => Math.floor(Math.abs(l) / 10);
|
|
896
|
-
return E(
|
|
897
|
-
if (
|
|
898
|
-
const
|
|
899
|
-
|
|
902
|
+
return E(i.x, (l) => {
|
|
903
|
+
if (o.value) {
|
|
904
|
+
const a = l - r.value, x = u(a);
|
|
905
|
+
a > 0 ? t("change", e.control.value + 1 + x) : a < 0 && t("change", e.control.value - 1 + x), e.control.min !== void 0 && e.control.value < e.control.min && t("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && t("change", e.control.max), r.value = l;
|
|
900
906
|
}
|
|
901
|
-
}), (l,
|
|
902
|
-
d("label",
|
|
907
|
+
}), (l, a) => (m(), b("div", Rt, [
|
|
908
|
+
d("label", Ft, $(n.label), 1),
|
|
903
909
|
d("input", {
|
|
904
|
-
value:
|
|
905
|
-
class:
|
|
910
|
+
value: n.control.value,
|
|
911
|
+
class: T(["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": o.value }]),
|
|
906
912
|
type: "number",
|
|
907
|
-
min:
|
|
908
|
-
max:
|
|
909
|
-
step:
|
|
913
|
+
min: n.control.min,
|
|
914
|
+
max: n.control.max,
|
|
915
|
+
step: n.control.step,
|
|
910
916
|
onInput: s,
|
|
911
917
|
onMousedown: h,
|
|
912
918
|
onMouseup: y
|
|
913
|
-
}, null, 42,
|
|
919
|
+
}, null, 42, Yt)
|
|
914
920
|
]));
|
|
915
921
|
}
|
|
916
|
-
}),
|
|
922
|
+
}), Ht = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, Qt = { class: "text-gray-500 w-1/3" }, Zt = ["value"], Wt = /* @__PURE__ */ C({
|
|
917
923
|
__name: "TextControl",
|
|
918
924
|
props: {
|
|
919
925
|
label: null,
|
|
920
926
|
control: null
|
|
921
927
|
},
|
|
922
928
|
emits: ["change"],
|
|
923
|
-
setup(
|
|
929
|
+
setup(n, { emit: t }) {
|
|
924
930
|
function e(s) {
|
|
925
931
|
t("change", s);
|
|
926
932
|
}
|
|
927
|
-
return (s,
|
|
928
|
-
d("label",
|
|
933
|
+
return (s, i) => (m(), b("div", Ht, [
|
|
934
|
+
d("label", Qt, $(n.label), 1),
|
|
929
935
|
d("input", {
|
|
930
|
-
value:
|
|
936
|
+
value: n.control.value,
|
|
931
937
|
type: "string",
|
|
932
938
|
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
939
|
onChange: e
|
|
934
|
-
}, null, 40,
|
|
940
|
+
}, null, 40, Zt)
|
|
935
941
|
]));
|
|
936
942
|
}
|
|
937
|
-
}),
|
|
943
|
+
}), Bt = { class: "flex px-4 justify-start gap-2 items-center mb-2 min-h-32px" }, Ut = { class: "text-gray-500 w-1/3" }, Kt = ["id", "checked"], Gt = ["for"], Jt = { class: "i-ic:baseline-check text-light" }, te = /* @__PURE__ */ C({
|
|
938
944
|
__name: "BooleanControl",
|
|
939
945
|
props: {
|
|
940
946
|
label: null,
|
|
941
947
|
control: null
|
|
942
948
|
},
|
|
943
949
|
emits: ["change"],
|
|
944
|
-
setup(
|
|
950
|
+
setup(n, { emit: t }) {
|
|
945
951
|
function e(s) {
|
|
946
|
-
const { target:
|
|
947
|
-
t("change",
|
|
952
|
+
const { target: i } = s;
|
|
953
|
+
t("change", i.checked);
|
|
948
954
|
}
|
|
949
|
-
return (s,
|
|
950
|
-
d("label",
|
|
955
|
+
return (s, i) => (m(), b("div", Bt, [
|
|
956
|
+
d("label", Ut, $(n.label), 1),
|
|
951
957
|
d("input", {
|
|
952
|
-
id:
|
|
953
|
-
checked:
|
|
958
|
+
id: n.control.label,
|
|
959
|
+
checked: n.control.value,
|
|
954
960
|
class: "hidden",
|
|
955
961
|
type: "checkbox",
|
|
956
962
|
onInput: e
|
|
957
|
-
}, null, 40,
|
|
963
|
+
}, null, 40, Kt),
|
|
958
964
|
d("label", {
|
|
959
|
-
for:
|
|
965
|
+
for: n.control.label,
|
|
960
966
|
class: "inline-flex items-center cursor-pointer"
|
|
961
967
|
}, [
|
|
962
968
|
d("span", {
|
|
963
|
-
class:
|
|
969
|
+
class: T([{ "bg-dark-500": n.control.value, "bg-gray-200": !n.control.value }, "w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"])
|
|
964
970
|
}, [
|
|
965
|
-
|
|
966
|
-
[
|
|
971
|
+
U(d("i", Jt, null, 512), [
|
|
972
|
+
[K, n.control.value]
|
|
967
973
|
])
|
|
968
974
|
], 2)
|
|
969
|
-
], 8,
|
|
975
|
+
], 8, Gt)
|
|
970
976
|
]));
|
|
971
977
|
}
|
|
972
|
-
}),
|
|
978
|
+
}), ee = { class: "px-4 relative flex justify-between gap-4 items-center mb-2" }, se = { class: "text-gray-500 w-1/3" }, ne = ["value", "min", "max", "step"], ie = ["value", "min", "max", "step"], re = /* @__PURE__ */ C({
|
|
973
979
|
__name: "SliderControl",
|
|
974
980
|
props: {
|
|
975
981
|
label: null,
|
|
976
982
|
control: null
|
|
977
983
|
},
|
|
978
984
|
emits: ["change"],
|
|
979
|
-
setup(
|
|
980
|
-
const e =
|
|
981
|
-
function s(
|
|
982
|
-
const { target: x } =
|
|
985
|
+
setup(n, { emit: t }) {
|
|
986
|
+
const e = n;
|
|
987
|
+
function s(a) {
|
|
988
|
+
const { target: x } = a;
|
|
983
989
|
t("change", x.valueAsNumber);
|
|
984
990
|
}
|
|
985
|
-
const
|
|
991
|
+
const i = S(() => ({
|
|
986
992
|
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
|
-
})), r =
|
|
988
|
-
|
|
993
|
+
})), r = N(), o = w(0), h = w(!1), y = (a) => {
|
|
994
|
+
o.value = a.clientX, h.value = !0;
|
|
989
995
|
}, u = () => {
|
|
990
996
|
h.value = !1;
|
|
991
|
-
}, l = (
|
|
992
|
-
return E(r.x, (
|
|
997
|
+
}, l = (a) => Math.floor(Math.abs(a) / 10);
|
|
998
|
+
return E(r.x, (a) => {
|
|
993
999
|
if (h.value) {
|
|
994
|
-
const x =
|
|
995
|
-
x > 0 ? t("change", e.control.value + 1 + c) : x < 0 && t("change", e.control.value - 1 + c), 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),
|
|
1000
|
+
const x = a - o.value, c = l(x);
|
|
1001
|
+
x > 0 ? t("change", e.control.value + 1 + c) : x < 0 && t("change", e.control.value - 1 + c), e.control.min !== void 0 && e.control.value < e.control.min && t("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && t("change", e.control.max), o.value = a;
|
|
996
1002
|
}
|
|
997
|
-
}), (
|
|
998
|
-
d("label",
|
|
1003
|
+
}), (a, x) => (m(), b("div", ee, [
|
|
1004
|
+
d("label", se, $(n.label), 1),
|
|
999
1005
|
d("input", {
|
|
1000
|
-
value:
|
|
1006
|
+
value: n.control.value,
|
|
1001
1007
|
class: "w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",
|
|
1002
|
-
style:
|
|
1008
|
+
style: dt(z(i)),
|
|
1003
1009
|
type: "range",
|
|
1004
|
-
min:
|
|
1005
|
-
max:
|
|
1006
|
-
step:
|
|
1010
|
+
min: n.control.min,
|
|
1011
|
+
max: n.control.max,
|
|
1012
|
+
step: n.control.step,
|
|
1007
1013
|
onInput: s
|
|
1008
|
-
}, null, 44,
|
|
1014
|
+
}, null, 44, ne),
|
|
1009
1015
|
d("input", {
|
|
1010
|
-
value:
|
|
1011
|
-
class:
|
|
1016
|
+
value: n.control.value,
|
|
1017
|
+
class: T(["p-2 w-1/4 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": h.value }]),
|
|
1012
1018
|
type: "number",
|
|
1013
|
-
min:
|
|
1014
|
-
max:
|
|
1015
|
-
step:
|
|
1019
|
+
min: n.control.min,
|
|
1020
|
+
max: n.control.max,
|
|
1021
|
+
step: n.control.step,
|
|
1016
1022
|
onInput: s,
|
|
1017
1023
|
onMousedown: y,
|
|
1018
1024
|
onMouseup: u
|
|
1019
|
-
}, null, 42,
|
|
1025
|
+
}, null, 42, ie)
|
|
1020
1026
|
]));
|
|
1021
1027
|
}
|
|
1022
1028
|
});
|
|
1023
|
-
const
|
|
1024
|
-
const e =
|
|
1025
|
-
for (const [s,
|
|
1026
|
-
e[s] =
|
|
1029
|
+
const oe = (n, t) => {
|
|
1030
|
+
const e = n.__vccOpts || n;
|
|
1031
|
+
for (const [s, i] of t)
|
|
1032
|
+
e[s] = i;
|
|
1027
1033
|
return e;
|
|
1028
|
-
},
|
|
1034
|
+
}, he = /* @__PURE__ */ oe(re, [["__scopeId", "data-v-da7e8146"]]), ae = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, le = { class: "text-gray-500 w-1/3" }, ce = ["value"], ue = ["value"], ye = /* @__PURE__ */ C({
|
|
1029
1035
|
__name: "ColorControl",
|
|
1030
1036
|
props: {
|
|
1031
1037
|
label: null,
|
|
1032
1038
|
control: null
|
|
1033
1039
|
},
|
|
1034
1040
|
emits: ["change"],
|
|
1035
|
-
setup(
|
|
1041
|
+
setup(n, { emit: t }) {
|
|
1036
1042
|
function e(s) {
|
|
1037
|
-
const { target:
|
|
1038
|
-
t("change",
|
|
1043
|
+
const { target: i } = s;
|
|
1044
|
+
t("change", i.value);
|
|
1039
1045
|
}
|
|
1040
|
-
return (s,
|
|
1041
|
-
d("label",
|
|
1046
|
+
return (s, i) => (m(), b("div", ae, [
|
|
1047
|
+
d("label", le, $(n.label), 1),
|
|
1042
1048
|
d("input", {
|
|
1043
|
-
value:
|
|
1049
|
+
value: n.control.value,
|
|
1044
1050
|
type: "color",
|
|
1045
1051
|
onInput: e
|
|
1046
|
-
}, null, 40,
|
|
1052
|
+
}, null, 40, ce),
|
|
1047
1053
|
d("input", {
|
|
1048
|
-
value:
|
|
1054
|
+
value: n.control.value,
|
|
1049
1055
|
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
1056
|
type: "text",
|
|
1051
1057
|
onInput: e
|
|
1052
|
-
}, null, 40,
|
|
1058
|
+
}, null, 40, ue)
|
|
1053
1059
|
]));
|
|
1054
1060
|
}
|
|
1055
1061
|
});
|
|
1056
|
-
function
|
|
1057
|
-
return typeof
|
|
1062
|
+
function xe(n) {
|
|
1063
|
+
return typeof n == "number" ? [n, n, n] : n instanceof I ? [n.x, n.y, n.z] : n;
|
|
1058
1064
|
}
|
|
1059
|
-
const
|
|
1065
|
+
const _e = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, de = { class: "text-gray-500 w-1/3" }, me = { class: "w-2/3 flex justify-between gap-1" }, ge = {
|
|
1060
1066
|
key: 0,
|
|
1061
1067
|
class: "font-bold px-0.5 py-1 text-0.65rem text-gray-300"
|
|
1062
|
-
},
|
|
1068
|
+
}, fe = ["value", "onInput", "onMousedown", "onMouseup"], pe = /* @__PURE__ */ C({
|
|
1063
1069
|
__name: "VectorControl",
|
|
1064
1070
|
props: {
|
|
1065
1071
|
label: null,
|
|
1066
1072
|
control: null
|
|
1067
1073
|
},
|
|
1068
1074
|
emits: ["change"],
|
|
1069
|
-
setup(
|
|
1070
|
-
const e =
|
|
1071
|
-
|
|
1075
|
+
setup(n, { emit: t }) {
|
|
1076
|
+
const e = n, s = N(), i = w(0), r = w(!1), o = w(0), h = (_, f) => {
|
|
1077
|
+
o.value = f, i.value = _.clientX, r.value = !0;
|
|
1072
1078
|
}, y = (_, f) => {
|
|
1073
|
-
|
|
1074
|
-
}, u = (_) => Math.floor(Math.abs(_) / 10), l =
|
|
1079
|
+
o.value = f, r.value = !1;
|
|
1080
|
+
}, u = (_) => Math.floor(Math.abs(_) / 10), l = S(() => xe(e.control.value)), a = S(() => Object.keys(e.control.value)), x = S(() => e.control.value instanceof j || e.control.value instanceof I);
|
|
1075
1081
|
function c(_, f) {
|
|
1076
|
-
const { value: p } = e.control, { target:
|
|
1077
|
-
|
|
1082
|
+
const { value: p } = e.control, { target: g } = _;
|
|
1083
|
+
o.value = f, p[x.value ? a.value[o.value] : o.value] = parseInt(g.value, 10), t("change", p);
|
|
1078
1084
|
}
|
|
1079
1085
|
return E(s.x, (_) => {
|
|
1080
1086
|
if (r.value) {
|
|
1081
|
-
const f = _ -
|
|
1082
|
-
f > 0 ?
|
|
1087
|
+
const f = _ - i.value, p = u(f), { value: g } = e.control, M = x.value ? a.value[o.value] : o.value;
|
|
1088
|
+
f > 0 ? g[M] += 1 + p : f < 0 && (g[M] -= 1 + p), e.control.min !== void 0 && g < e.control.min && (g[M] = e.control.min), e.control.max !== void 0 && g > e.control.max && (g[M] = e.control.max), t("change", g), i.value = _;
|
|
1083
1089
|
}
|
|
1084
|
-
}), (_, f) => (
|
|
1085
|
-
d("label",
|
|
1086
|
-
d("div",
|
|
1087
|
-
(
|
|
1088
|
-
key:
|
|
1090
|
+
}), (_, f) => (m(), b("div", _e, [
|
|
1091
|
+
d("label", de, $(n.label), 1),
|
|
1092
|
+
d("div", me, [
|
|
1093
|
+
(m(!0), b(D, null, X(z(l), (p, g) => (m(), b("div", {
|
|
1094
|
+
key: n.label + g,
|
|
1089
1095
|
class: "flex items-center w-1/3 bg-gray-100 rounded"
|
|
1090
1096
|
}, [
|
|
1091
|
-
z(
|
|
1097
|
+
z(a)[g] && z(x) ? (m(), b("span", ge, $(z(a)[g]), 1)) : G("", !0),
|
|
1092
1098
|
d("input", {
|
|
1093
1099
|
type: "text",
|
|
1094
|
-
class:
|
|
1095
|
-
value: z(l)[
|
|
1096
|
-
onInput: (M) => c(M,
|
|
1097
|
-
onMousedown: (M) => h(M,
|
|
1098
|
-
onMouseup: (M) => y(M,
|
|
1099
|
-
}, null, 42,
|
|
1100
|
+
class: T(["w-full pl-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": r.value }]),
|
|
1101
|
+
value: z(l)[g].toFixed(2),
|
|
1102
|
+
onInput: (M) => c(M, g),
|
|
1103
|
+
onMousedown: (M) => h(M, g),
|
|
1104
|
+
onMouseup: (M) => y(M, g)
|
|
1105
|
+
}, null, 42, fe)
|
|
1100
1106
|
]))), 128))
|
|
1101
1107
|
])
|
|
1102
1108
|
]));
|
|
1103
1109
|
}
|
|
1104
|
-
}),
|
|
1110
|
+
}), ze = { class: "bg-white rounded-b" }, Me = /* @__PURE__ */ C({
|
|
1111
|
+
__name: "Folder",
|
|
1112
|
+
props: {
|
|
1113
|
+
control: null
|
|
1114
|
+
},
|
|
1115
|
+
setup(n) {
|
|
1116
|
+
function t(i, r) {
|
|
1117
|
+
r.value = i;
|
|
1118
|
+
}
|
|
1119
|
+
const e = w(!1), s = () => {
|
|
1120
|
+
e.value = !e.value;
|
|
1121
|
+
};
|
|
1122
|
+
return (i, r) => (m(), b("div", null, [
|
|
1123
|
+
d("button", {
|
|
1124
|
+
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",
|
|
1125
|
+
onClick: s
|
|
1126
|
+
}, [
|
|
1127
|
+
d("span", null, $(n.control.label), 1),
|
|
1128
|
+
d("i", {
|
|
1129
|
+
class: T(e.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
|
|
1130
|
+
}, null, 2)
|
|
1131
|
+
]),
|
|
1132
|
+
mt(gt, {
|
|
1133
|
+
name: "animate__animated",
|
|
1134
|
+
"enter-active-class": "animate__fadeIn",
|
|
1135
|
+
"leave-active-class": "animate__fadeOut"
|
|
1136
|
+
}, {
|
|
1137
|
+
default: J(() => [
|
|
1138
|
+
U(d("div", ze, [
|
|
1139
|
+
(m(!0), b(D, null, X(n.control.controls, (o) => (m(), v(rt, {
|
|
1140
|
+
key: o.label,
|
|
1141
|
+
control: o,
|
|
1142
|
+
onChange: r[0] || (r[0] = (h) => t(h, n.control))
|
|
1143
|
+
}, null, 8, ["control"]))), 128))
|
|
1144
|
+
], 512), [
|
|
1145
|
+
[K, e.value]
|
|
1146
|
+
])
|
|
1147
|
+
]),
|
|
1148
|
+
_: 1
|
|
1149
|
+
})
|
|
1150
|
+
]));
|
|
1151
|
+
}
|
|
1152
|
+
}), rt = /* @__PURE__ */ C({
|
|
1105
1153
|
__name: "ControlInput",
|
|
1106
1154
|
props: {
|
|
1107
1155
|
control: null
|
|
1108
1156
|
},
|
|
1109
1157
|
emits: ["change"],
|
|
1110
|
-
setup(
|
|
1111
|
-
const e =
|
|
1158
|
+
setup(n, { emit: t }) {
|
|
1159
|
+
const e = n, s = S(
|
|
1112
1160
|
() => e.control.type === "number" && (e.control.step || e.control.max || e.control.min)
|
|
1113
|
-
),
|
|
1161
|
+
), i = S(() => {
|
|
1114
1162
|
const h = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
1115
1163
|
return e.control.type === "color" || h.test(e.control.value);
|
|
1116
|
-
}), r =
|
|
1117
|
-
() => e.control.value instanceof Array || e.control.value instanceof
|
|
1164
|
+
}), r = S(
|
|
1165
|
+
() => e.control.value instanceof Array || e.control.value instanceof j || e.control.value instanceof I
|
|
1118
1166
|
);
|
|
1119
|
-
function
|
|
1167
|
+
function o(h) {
|
|
1120
1168
|
t("change", h);
|
|
1121
1169
|
}
|
|
1122
|
-
return (h, y) =>
|
|
1123
|
-
z(
|
|
1170
|
+
return (h, y) => n.control.visible ? (m(), b(D, { key: 0 }, [
|
|
1171
|
+
z(i) ? (m(), v(ye, {
|
|
1124
1172
|
key: 0,
|
|
1125
|
-
label:
|
|
1126
|
-
control:
|
|
1127
|
-
onChange:
|
|
1128
|
-
}, null, 8, ["label", "control"])) : z(r) ? (
|
|
1173
|
+
label: n.control.label,
|
|
1174
|
+
control: n.control,
|
|
1175
|
+
onChange: o
|
|
1176
|
+
}, null, 8, ["label", "control"])) : z(r) ? (m(), v(pe, {
|
|
1129
1177
|
key: 1,
|
|
1130
|
-
label:
|
|
1131
|
-
control:
|
|
1132
|
-
onChange:
|
|
1133
|
-
}, null, 8, ["label", "control"])) :
|
|
1178
|
+
label: n.control.label,
|
|
1179
|
+
control: n.control,
|
|
1180
|
+
onChange: o
|
|
1181
|
+
}, null, 8, ["label", "control"])) : n.control.type === "boolean" ? (m(), v(te, {
|
|
1134
1182
|
key: 2,
|
|
1135
|
-
label:
|
|
1136
|
-
control:
|
|
1137
|
-
onChange:
|
|
1138
|
-
}, null, 8, ["label", "control"])) :
|
|
1139
|
-
key: 4,
|
|
1140
|
-
label: i.control.label,
|
|
1141
|
-
control: i.control,
|
|
1142
|
-
onChange: a
|
|
1143
|
-
}, null, 8, ["label", "control"])) : (g(), k(Ot, {
|
|
1144
|
-
key: 5,
|
|
1145
|
-
label: i.control.label,
|
|
1146
|
-
control: i.control,
|
|
1147
|
-
onChange: a
|
|
1148
|
-
}, null, 8, ["label", "control"])) : (g(), k(Rt, {
|
|
1183
|
+
label: n.control.label,
|
|
1184
|
+
control: n.control,
|
|
1185
|
+
onChange: o
|
|
1186
|
+
}, null, 8, ["label", "control"])) : n.control.type === "folder" ? (m(), v(Me, {
|
|
1149
1187
|
key: 3,
|
|
1150
|
-
label:
|
|
1151
|
-
control:
|
|
1152
|
-
|
|
1188
|
+
label: n.control.label,
|
|
1189
|
+
control: n.control
|
|
1190
|
+
}, null, 8, ["label", "control"])) : z(s) ? z(s) ? (m(), v(he, {
|
|
1191
|
+
key: 5,
|
|
1192
|
+
label: n.control.label,
|
|
1193
|
+
control: n.control,
|
|
1194
|
+
onChange: o
|
|
1195
|
+
}, null, 8, ["label", "control"])) : (m(), v(Wt, {
|
|
1196
|
+
key: 6,
|
|
1197
|
+
label: n.control.label,
|
|
1198
|
+
control: n.control,
|
|
1199
|
+
onChange: o
|
|
1200
|
+
}, null, 8, ["label", "control"])) : (m(), v(Ot, {
|
|
1201
|
+
key: 4,
|
|
1202
|
+
label: n.control.label,
|
|
1203
|
+
control: n.control,
|
|
1204
|
+
onChange: o
|
|
1153
1205
|
}, null, 8, ["label", "control"]))
|
|
1154
|
-
], 64)) :
|
|
1206
|
+
], 64)) : G("", !0);
|
|
1155
1207
|
}
|
|
1156
|
-
}),
|
|
1208
|
+
}), be = { class: "bg-white shadow-xl rounded border-4 border-solid border-black" }, we = /* @__PURE__ */ d("i", { class: "h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs" }, "🍰", -1), ve = /* @__PURE__ */ d("div", null, [
|
|
1157
1209
|
/* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" }),
|
|
1158
1210
|
/* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" }),
|
|
1159
1211
|
/* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" })
|
|
1160
|
-
], -1),
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
],
|
|
1212
|
+
], -1), Ce = /* @__PURE__ */ d("div", null, null, -1), Se = [
|
|
1213
|
+
we,
|
|
1214
|
+
ve,
|
|
1215
|
+
Ce
|
|
1216
|
+
], Ie = /* @__PURE__ */ C({
|
|
1165
1217
|
__name: "TresLeches",
|
|
1166
|
-
setup(
|
|
1167
|
-
const { width: t } =
|
|
1168
|
-
function r(
|
|
1169
|
-
h.value =
|
|
1218
|
+
setup(n) {
|
|
1219
|
+
const { width: t } = Mt(), e = 280, s = w(null), i = Xt();
|
|
1220
|
+
function r(o, h) {
|
|
1221
|
+
h.value = o;
|
|
1170
1222
|
}
|
|
1171
|
-
return (
|
|
1223
|
+
return (o, h) => (m(), v(z(Dt), {
|
|
1172
1224
|
"initial-value": { x: z(t) - e - 20, y: 10 },
|
|
1173
1225
|
class: "fixed select-none z-24 w-280px font-sans text-xs",
|
|
1174
1226
|
handle: s.value
|
|
1175
1227
|
}, {
|
|
1176
|
-
default:
|
|
1177
|
-
d("div",
|
|
1228
|
+
default: J(() => [
|
|
1229
|
+
d("div", be, [
|
|
1178
1230
|
d("header", {
|
|
1179
1231
|
ref_key: "handle",
|
|
1180
1232
|
ref: s,
|
|
1181
1233
|
class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
|
|
1182
|
-
},
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
}, null, 8, ["control", "onChange"]))), 128))
|
|
1189
|
-
])
|
|
1234
|
+
}, Se, 512),
|
|
1235
|
+
(m(!0), b(D, null, X(z(i).controls, (y) => (m(), v(rt, {
|
|
1236
|
+
key: y.label,
|
|
1237
|
+
control: y,
|
|
1238
|
+
onChange: (u) => r(u, y)
|
|
1239
|
+
}, null, 8, ["control", "onChange"]))), 128))
|
|
1190
1240
|
])
|
|
1191
1241
|
]),
|
|
1192
1242
|
_: 1
|
|
@@ -1194,6 +1244,6 @@ const ue = { class: "flex justify-between gap-2 items-center mb-2" }, ye = { cla
|
|
|
1194
1244
|
}
|
|
1195
1245
|
});
|
|
1196
1246
|
export {
|
|
1197
|
-
|
|
1198
|
-
|
|
1247
|
+
Ie as TresLeches,
|
|
1248
|
+
Ee as useControls
|
|
1199
1249
|
};
|