@tresjs/leches 0.6.0 → 0.8.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.
@@ -1,65 +1,98 @@
1
1
  /**
2
2
  * name: @tresjs/leches
3
- * version: v0.6.0
3
+ * version: v0.8.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 j, getCurrentScope as ct, onScopeDispose as yt, toRef as _t, readonly as xt, customRef as pt, ref as m, defineComponent as S, computed as T, reactive as tt, h as dt, watch as I, provide as ft, isReactive as gt, toRefs as mt, onUnmounted as bt, isRef as V, openBlock as d, createElementBlock as g, createElementVNode as p, toDisplayString as C, normalizeClass as $, withDirectives as et, vShow as st, createTextVNode as zt, normalizeStyle as wt, Fragment as P, renderList as L, createCommentVNode as nt, createVNode as Mt, Transition as vt, withCtx as it, createBlock as v } from "vue";
9
- import { useStorage as Ct, isClient as St, useDraggable as kt, useMouse as H, useFps as $t, useRafFn as Et, useWindowSize as Tt } from "@vueuse/core";
10
- function ot(o) {
11
- return ct() ? (yt(o), !0) : !1;
8
+ import { unref as D, isRef as O, toRefs as K, customRef as ae, watch as P, ref as v, computed as A, defineComponent as M, reactive as Y, h as ce, openBlock as d, createElementBlock as m, createElementVNode as c, toDisplayString as k, normalizeClass as I, withDirectives as q, vShow as J, createTextVNode as ue, normalizeStyle as ie, Fragment as S, renderList as U, createCommentVNode as L, createBlock as C, createVNode as pe, Transition as de, withCtx as Q, provide as fe } from "vue";
9
+ import { useWindowSize as Z, useEventListener as N, useStorage as ve, isClient as ge, useMouse as j, useFps as he, useRafFn as ye } from "@vueuse/core";
10
+ function T(n) {
11
+ return typeof n == "function" ? n() : D(n);
12
12
  }
13
- function q(o) {
14
- return typeof o == "function" ? o() : j(o);
15
- }
16
- const rt = typeof window < "u", at = () => {
17
- }, U = /* @__PURE__ */ It();
18
- function It() {
19
- var o;
20
- return rt && ((o = window == null ? void 0 : window.navigator) == null ? void 0 : o.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
21
- }
22
- function At(...o) {
23
- if (o.length !== 1)
24
- return _t(...o);
25
- const t = o[0];
26
- return typeof t == "function" ? xt(pt(() => ({ get: t, set: at }))) : m(t);
27
- }
28
- function jt(o) {
29
- var t;
30
- const e = q(o);
31
- return (t = e == null ? void 0 : e.$el) != null ? t : e;
13
+ const ee = typeof window < "u" && typeof document < "u";
14
+ function be(n, o = {}) {
15
+ if (!O(n))
16
+ return K(n);
17
+ const t = Array.isArray(n.value) ? Array.from({ length: n.value.length }) : {};
18
+ for (const e in n.value)
19
+ t[e] = ae(() => ({
20
+ get() {
21
+ return n.value[e];
22
+ },
23
+ set(l) {
24
+ var u;
25
+ if ((u = T(o.replaceRef)) != null ? u : !0)
26
+ if (Array.isArray(n.value)) {
27
+ const p = [...n.value];
28
+ p[e] = l, n.value = p;
29
+ } else {
30
+ const p = { ...n.value, [e]: l };
31
+ Object.setPrototypeOf(p, Object.getPrototypeOf(n.value)), n.value = p;
32
+ }
33
+ else
34
+ n.value[e] = l;
35
+ }
36
+ }));
37
+ return t;
32
38
  }
33
- const qt = rt ? window : void 0;
34
- function Pt(...o) {
35
- let t, e, s, n;
36
- if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([e, s, n] = o, t = qt) : [t, e, s, n] = o, !t)
37
- return at;
38
- Array.isArray(e) || (e = [e]), Array.isArray(s) || (s = [s]);
39
- const i = [], a = () => {
40
- i.forEach((h) => h()), i.length = 0;
41
- }, l = (h, r, _, u) => (h.addEventListener(r, _, u), () => h.removeEventListener(r, _, u)), y = I(
42
- () => [jt(t), q(n)],
43
- ([h, r]) => {
44
- a(), h && i.push(
45
- ...e.flatMap((_) => s.map((u) => l(h, _, u, r)))
46
- );
47
- },
48
- { immediate: !0, flush: "post" }
49
- ), c = () => {
50
- y(), a();
39
+ const me = ee ? window : void 0;
40
+ function _e(n, o = {}) {
41
+ const {
42
+ pointerTypes: t,
43
+ preventDefault: e,
44
+ stopPropagation: l,
45
+ exact: u,
46
+ onMove: a,
47
+ onEnd: p,
48
+ onStart: f,
49
+ initialValue: g,
50
+ axis: r = "both",
51
+ draggingElement: s = me,
52
+ handle: i = n
53
+ } = o, { width: $ } = Z();
54
+ let _ = $.value;
55
+ P($, () => {
56
+ const y = $.value - _;
57
+ h.value.x += y, _ = $.value;
58
+ });
59
+ const h = v(
60
+ T(g) ?? { x: 0, y: 0 }
61
+ ), x = v(), b = (y) => t ? t.includes(y.pointerType) : !0, w = (y) => {
62
+ T(e) && y.preventDefault(), T(l) && y.stopPropagation();
63
+ }, le = (y) => {
64
+ if (!b(y) || T(u) && y.target !== T(n))
65
+ return;
66
+ const F = T(n).getBoundingClientRect(), V = {
67
+ x: y.clientX - F.left,
68
+ y: y.clientY - F.top
69
+ };
70
+ (f == null ? void 0 : f(V, y)) !== !1 && (x.value = V, w(y));
71
+ }, re = (y) => {
72
+ if (!b(y) || !x.value)
73
+ return;
74
+ let { x: F, y: V } = h.value;
75
+ (r === "x" || r === "both") && (F = y.clientX - x.value.x), (r === "y" || r === "both") && (V = y.clientY - x.value.y), h.value = {
76
+ x: F,
77
+ y: V
78
+ }, a == null || a(h.value, y), w(y);
79
+ }, se = (y) => {
80
+ b(y) && x.value && (x.value = void 0, p == null || p(h.value, y), w(y));
81
+ };
82
+ if (ee) {
83
+ const y = { capture: o.capture ?? !0 };
84
+ N(i, "pointerdown", le, y), N(s, "pointermove", re, y), N(s, "pointerup", se, y);
85
+ }
86
+ return {
87
+ ...be(h),
88
+ position: h,
89
+ isDragging: A(() => !!x.value),
90
+ style: A(
91
+ () => `left:${h.value.x}px;top:${h.value.y}px;`
92
+ )
51
93
  };
52
- return ot(c), c;
53
94
  }
54
- var Dt = Object.defineProperty, Lt = Object.defineProperties, Vt = Object.getOwnPropertyDescriptors, F = Object.getOwnPropertySymbols, Xt = Object.prototype.hasOwnProperty, Rt = Object.prototype.propertyIsEnumerable, K = (o, t, e) => t in o ? Dt(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, Yt = (o, t) => {
55
- for (var e in t || (t = {}))
56
- Xt.call(t, e) && K(o, e, t[e]);
57
- if (F)
58
- for (var e of F(t))
59
- Rt.call(t, e) && K(o, e, t[e]);
60
- return o;
61
- }, Ht = (o, t) => Lt(o, Vt(t));
62
- const Qt = /* @__PURE__ */ S({
95
+ const xe = /* @__PURE__ */ M({
63
96
  name: "UseDraggable",
64
97
  props: [
65
98
  "storageKey",
@@ -76,1280 +109,529 @@ const Qt = /* @__PURE__ */ S({
76
109
  "onMove",
77
110
  "onEnd"
78
111
  ],
79
- setup(o, { slots: t }) {
80
- const e = m(), s = T(() => {
81
- var y;
82
- return (y = o.handle) != null ? y : e.value;
83
- }), n = o.storageKey && Ct(
84
- o.storageKey,
85
- q(o.initialValue) || { x: 0, y: 0 },
86
- St ? o.storageType === "session" ? sessionStorage : localStorage : void 0
87
- ), i = n || o.initialValue || { x: 0, y: 0 }, a = (y, c) => {
88
- var h;
89
- (h = o.onEnd) == null || h.call(o, y, c), n && (n.value.x = y.x, n.value.y = y.y);
90
- }, l = tt(kt(e, Ht(Yt({}, o), {
91
- handle: s,
92
- initialValue: i,
93
- onEnd: a
94
- })));
95
- return () => {
96
- if (t.default)
97
- return dt(o.as || "div", { ref: e, style: `touch-action:none;${l.style}` }, t.default(l));
98
- };
99
- }
100
- });
101
- function ht(o) {
102
- const t = window.getComputedStyle(o);
103
- if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && o.clientWidth < o.scrollWidth || t.overflowY === "auto" && o.clientHeight < o.scrollHeight)
104
- return !0;
105
- {
106
- const e = o.parentNode;
107
- return !e || e.tagName === "BODY" ? !1 : ht(e);
108
- }
109
- }
110
- function Wt(o) {
111
- const t = o || window.event, e = t.target;
112
- return ht(e) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
113
- }
114
- function Zt(o, t = !1) {
115
- const e = m(t);
116
- let s = null, n;
117
- I(At(o), (l) => {
118
- if (l) {
119
- const y = l;
120
- n = y.style.overflow, e.value && (y.style.overflow = "hidden");
121
- }
122
- }, {
123
- immediate: !0
124
- });
125
- const i = () => {
126
- const l = q(o);
127
- !l || e.value || (U && (s = Pt(
128
- l,
129
- "touchmove",
130
- (y) => {
131
- Wt(y);
132
- },
133
- { passive: !1 }
134
- )), l.style.overflow = "hidden", e.value = !0);
135
- }, a = () => {
136
- const l = q(o);
137
- !l || !e.value || (U && (s == null || s()), l.style.overflow = n, e.value = !1);
138
- };
139
- return ot(a), T({
140
- get() {
141
- return e.value;
142
- },
143
- set(l) {
144
- l ? i() : a();
145
- }
146
- });
147
- }
148
- function Bt() {
149
- let o = !1;
150
- const t = m(!1);
151
- return (e, s) => {
152
- if (t.value = s.value, o)
153
- return;
154
- o = !0;
155
- const n = Zt(e, s.value);
156
- I(t, (i) => n.value = i);
157
- };
158
- }
159
- Bt();
160
- /**
161
- * @license
162
- * Copyright 2010-2023 Three.js Authors
163
- * SPDX-License-Identifier: MIT
164
- */
165
- const lt = "155";
166
- function Q(o, t, e) {
167
- return Math.max(t, Math.min(e, o));
168
- }
169
- class W {
170
- constructor(t = 0, e = 0) {
171
- W.prototype.isVector2 = !0, this.x = t, this.y = e;
172
- }
173
- get width() {
174
- return this.x;
175
- }
176
- set width(t) {
177
- this.x = t;
178
- }
179
- get height() {
180
- return this.y;
181
- }
182
- set height(t) {
183
- this.y = t;
184
- }
185
- set(t, e) {
186
- return this.x = t, this.y = e, this;
187
- }
188
- setScalar(t) {
189
- return this.x = t, this.y = t, this;
190
- }
191
- setX(t) {
192
- return this.x = t, this;
193
- }
194
- setY(t) {
195
- return this.y = t, this;
196
- }
197
- setComponent(t, e) {
198
- switch (t) {
199
- case 0:
200
- this.x = e;
201
- break;
202
- case 1:
203
- this.y = e;
204
- break;
205
- default:
206
- throw new Error("index is out of range: " + t);
207
- }
208
- return this;
209
- }
210
- getComponent(t) {
211
- switch (t) {
212
- case 0:
213
- return this.x;
214
- case 1:
215
- return this.y;
216
- default:
217
- throw new Error("index is out of range: " + t);
218
- }
219
- }
220
- clone() {
221
- return new this.constructor(this.x, this.y);
222
- }
223
- copy(t) {
224
- return this.x = t.x, this.y = t.y, this;
225
- }
226
- add(t) {
227
- return this.x += t.x, this.y += t.y, this;
228
- }
229
- addScalar(t) {
230
- return this.x += t, this.y += t, this;
231
- }
232
- addVectors(t, e) {
233
- return this.x = t.x + e.x, this.y = t.y + e.y, this;
234
- }
235
- addScaledVector(t, e) {
236
- return this.x += t.x * e, this.y += t.y * e, this;
237
- }
238
- sub(t) {
239
- return this.x -= t.x, this.y -= t.y, this;
240
- }
241
- subScalar(t) {
242
- return this.x -= t, this.y -= t, this;
243
- }
244
- subVectors(t, e) {
245
- return this.x = t.x - e.x, this.y = t.y - e.y, this;
246
- }
247
- multiply(t) {
248
- return this.x *= t.x, this.y *= t.y, this;
249
- }
250
- multiplyScalar(t) {
251
- return this.x *= t, this.y *= t, this;
252
- }
253
- divide(t) {
254
- return this.x /= t.x, this.y /= t.y, this;
255
- }
256
- divideScalar(t) {
257
- return this.multiplyScalar(1 / t);
258
- }
259
- applyMatrix3(t) {
260
- const e = this.x, s = this.y, n = t.elements;
261
- return this.x = n[0] * e + n[3] * s + n[6], this.y = n[1] * e + n[4] * s + n[7], this;
262
- }
263
- min(t) {
264
- return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this;
265
- }
266
- max(t) {
267
- return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this;
268
- }
269
- clamp(t, e) {
270
- return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this;
271
- }
272
- clampScalar(t, e) {
273
- return this.x = Math.max(t, Math.min(e, this.x)), this.y = Math.max(t, Math.min(e, this.y)), this;
274
- }
275
- clampLength(t, e) {
276
- const s = this.length();
277
- return this.divideScalar(s || 1).multiplyScalar(Math.max(t, Math.min(e, s)));
278
- }
279
- floor() {
280
- return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this;
281
- }
282
- ceil() {
283
- return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this;
284
- }
285
- round() {
286
- return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
287
- }
288
- roundToZero() {
289
- return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this;
290
- }
291
- negate() {
292
- return this.x = -this.x, this.y = -this.y, this;
293
- }
294
- dot(t) {
295
- return this.x * t.x + this.y * t.y;
296
- }
297
- cross(t) {
298
- return this.x * t.y - this.y * t.x;
299
- }
300
- lengthSq() {
301
- return this.x * this.x + this.y * this.y;
302
- }
303
- length() {
304
- return Math.sqrt(this.x * this.x + this.y * this.y);
305
- }
306
- manhattanLength() {
307
- return Math.abs(this.x) + Math.abs(this.y);
308
- }
309
- normalize() {
310
- return this.divideScalar(this.length() || 1);
311
- }
312
- angle() {
313
- return Math.atan2(-this.y, -this.x) + Math.PI;
314
- }
315
- angleTo(t) {
316
- const e = Math.sqrt(this.lengthSq() * t.lengthSq());
317
- if (e === 0)
318
- return Math.PI / 2;
319
- const s = this.dot(t) / e;
320
- return Math.acos(Q(s, -1, 1));
321
- }
322
- distanceTo(t) {
323
- return Math.sqrt(this.distanceToSquared(t));
324
- }
325
- distanceToSquared(t) {
326
- const e = this.x - t.x, s = this.y - t.y;
327
- return e * e + s * s;
328
- }
329
- manhattanDistanceTo(t) {
330
- return Math.abs(this.x - t.x) + Math.abs(this.y - t.y);
331
- }
332
- setLength(t) {
333
- return this.normalize().multiplyScalar(t);
334
- }
335
- lerp(t, e) {
336
- return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this;
337
- }
338
- lerpVectors(t, e, s) {
339
- return this.x = t.x + (e.x - t.x) * s, this.y = t.y + (e.y - t.y) * s, this;
340
- }
341
- equals(t) {
342
- return t.x === this.x && t.y === this.y;
343
- }
344
- fromArray(t, e = 0) {
345
- return this.x = t[e], this.y = t[e + 1], this;
346
- }
347
- toArray(t = [], e = 0) {
348
- return t[e] = this.x, t[e + 1] = this.y, t;
349
- }
350
- fromBufferAttribute(t, e) {
351
- return this.x = t.getX(e), this.y = t.getY(e), this;
352
- }
353
- rotateAround(t, e) {
354
- const s = Math.cos(e), n = Math.sin(e), i = this.x - t.x, a = this.y - t.y;
355
- return this.x = i * s - a * n + t.x, this.y = i * n + a * s + t.y, this;
356
- }
357
- random() {
358
- return this.x = Math.random(), this.y = Math.random(), this;
359
- }
360
- *[Symbol.iterator]() {
361
- yield this.x, yield this.y;
362
- }
363
- }
364
- class Ut {
365
- constructor(t = 0, e = 0, s = 0, n = 1) {
366
- this.isQuaternion = !0, this._x = t, this._y = e, this._z = s, this._w = n;
367
- }
368
- static slerpFlat(t, e, s, n, i, a, l) {
369
- let y = s[n + 0], c = s[n + 1], h = s[n + 2], r = s[n + 3];
370
- const _ = i[a + 0], u = i[a + 1], x = i[a + 2], b = i[a + 3];
371
- if (l === 0) {
372
- t[e + 0] = y, t[e + 1] = c, t[e + 2] = h, t[e + 3] = r;
373
- return;
374
- }
375
- if (l === 1) {
376
- t[e + 0] = _, t[e + 1] = u, t[e + 2] = x, t[e + 3] = b;
377
- return;
378
- }
379
- if (r !== b || y !== _ || c !== u || h !== x) {
380
- let z = 1 - l;
381
- const f = y * _ + c * u + h * x + r * b, M = f >= 0 ? 1 : -1, Z = 1 - f * f;
382
- if (Z > Number.EPSILON) {
383
- const k = Math.sqrt(Z), B = Math.atan2(k, f * M);
384
- z = Math.sin(z * B) / k, l = Math.sin(l * B) / k;
385
- }
386
- const D = l * M;
387
- if (y = y * z + _ * D, c = c * z + u * D, h = h * z + x * D, r = r * z + b * D, z === 1 - l) {
388
- const k = 1 / Math.sqrt(y * y + c * c + h * h + r * r);
389
- y *= k, c *= k, h *= k, r *= k;
112
+ setup(n, { slots: o }) {
113
+ const t = v(), e = A(() => n.handle ?? t.value), l = n.storageKey && ve(
114
+ n.storageKey,
115
+ T(n.initialValue) || { x: 0, y: 0 },
116
+ ge ? n.storageType === "session" ? sessionStorage : localStorage : void 0
117
+ ), u = l || n.initialValue || { x: 0, y: 0 }, p = Y(_e(t, {
118
+ ...n,
119
+ handle: e,
120
+ initialValue: u,
121
+ onEnd: (f, g) => {
122
+ var r;
123
+ (r = n.onEnd) == null || r.call(n, f, g), l && (l.value.x = f.x, l.value.y = f.y);
390
124
  }
391
- }
392
- t[e] = y, t[e + 1] = c, t[e + 2] = h, t[e + 3] = r;
393
- }
394
- static multiplyQuaternionsFlat(t, e, s, n, i, a) {
395
- const l = s[n], y = s[n + 1], c = s[n + 2], h = s[n + 3], r = i[a], _ = i[a + 1], u = i[a + 2], x = i[a + 3];
396
- return t[e] = l * x + h * r + y * u - c * _, t[e + 1] = y * x + h * _ + c * r - l * u, t[e + 2] = c * x + h * u + l * _ - y * r, t[e + 3] = h * x - l * r - y * _ - c * u, t;
397
- }
398
- get x() {
399
- return this._x;
400
- }
401
- set x(t) {
402
- this._x = t, this._onChangeCallback();
403
- }
404
- get y() {
405
- return this._y;
406
- }
407
- set y(t) {
408
- this._y = t, this._onChangeCallback();
409
- }
410
- get z() {
411
- return this._z;
412
- }
413
- set z(t) {
414
- this._z = t, this._onChangeCallback();
415
- }
416
- get w() {
417
- return this._w;
418
- }
419
- set w(t) {
420
- this._w = t, this._onChangeCallback();
421
- }
422
- set(t, e, s, n) {
423
- return this._x = t, this._y = e, this._z = s, this._w = n, this._onChangeCallback(), this;
424
- }
425
- clone() {
426
- return new this.constructor(this._x, this._y, this._z, this._w);
427
- }
428
- copy(t) {
429
- return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this._onChangeCallback(), this;
430
- }
431
- setFromEuler(t, e) {
432
- const s = t._x, n = t._y, i = t._z, a = t._order, l = Math.cos, y = Math.sin, c = l(s / 2), h = l(n / 2), r = l(i / 2), _ = y(s / 2), u = y(n / 2), x = y(i / 2);
433
- switch (a) {
434
- case "XYZ":
435
- this._x = _ * h * r + c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r - _ * u * x;
436
- break;
437
- case "YXZ":
438
- this._x = _ * h * r + c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r + _ * u * x;
439
- break;
440
- case "ZXY":
441
- this._x = _ * h * r - c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r - _ * u * x;
442
- break;
443
- case "ZYX":
444
- this._x = _ * h * r - c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r + _ * u * x;
445
- break;
446
- case "YZX":
447
- this._x = _ * h * r + c * u * x, this._y = c * u * r + _ * h * x, this._z = c * h * x - _ * u * r, this._w = c * h * r - _ * u * x;
448
- break;
449
- case "XZY":
450
- this._x = _ * h * r - c * u * x, this._y = c * u * r - _ * h * x, this._z = c * h * x + _ * u * r, this._w = c * h * r + _ * u * x;
451
- break;
452
- default:
453
- console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a);
454
- }
455
- return e !== !1 && this._onChangeCallback(), this;
456
- }
457
- setFromAxisAngle(t, e) {
458
- const s = e / 2, n = Math.sin(s);
459
- return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(s), this._onChangeCallback(), this;
460
- }
461
- setFromRotationMatrix(t) {
462
- const e = t.elements, s = e[0], n = e[4], i = e[8], a = e[1], l = e[5], y = e[9], c = e[2], h = e[6], r = e[10], _ = s + l + r;
463
- if (_ > 0) {
464
- const u = 0.5 / Math.sqrt(_ + 1);
465
- this._w = 0.25 / u, this._x = (h - y) * u, this._y = (i - c) * u, this._z = (a - n) * u;
466
- } else if (s > l && s > r) {
467
- const u = 2 * Math.sqrt(1 + s - l - r);
468
- this._w = (h - y) / u, this._x = 0.25 * u, this._y = (n + a) / u, this._z = (i + c) / u;
469
- } else if (l > r) {
470
- const u = 2 * Math.sqrt(1 + l - s - r);
471
- this._w = (i - c) / u, this._x = (n + a) / u, this._y = 0.25 * u, this._z = (y + h) / u;
472
- } else {
473
- const u = 2 * Math.sqrt(1 + r - s - l);
474
- this._w = (a - n) / u, this._x = (i + c) / u, this._y = (y + h) / u, this._z = 0.25 * u;
475
- }
476
- return this._onChangeCallback(), this;
477
- }
478
- setFromUnitVectors(t, e) {
479
- let s = t.dot(e) + 1;
480
- return s < Number.EPSILON ? (s = 0, Math.abs(t.x) > Math.abs(t.z) ? (this._x = -t.y, this._y = t.x, this._z = 0, this._w = s) : (this._x = 0, this._y = -t.z, this._z = t.y, this._w = s)) : (this._x = t.y * e.z - t.z * e.y, this._y = t.z * e.x - t.x * e.z, this._z = t.x * e.y - t.y * e.x, this._w = s), this.normalize();
481
- }
482
- angleTo(t) {
483
- return 2 * Math.acos(Math.abs(Q(this.dot(t), -1, 1)));
484
- }
485
- rotateTowards(t, e) {
486
- const s = this.angleTo(t);
487
- if (s === 0)
488
- return this;
489
- const n = Math.min(1, e / s);
490
- return this.slerp(t, n), this;
491
- }
492
- identity() {
493
- return this.set(0, 0, 0, 1);
494
- }
495
- invert() {
496
- return this.conjugate();
497
- }
498
- conjugate() {
499
- return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this;
500
- }
501
- dot(t) {
502
- return this._x * t._x + this._y * t._y + this._z * t._z + this._w * t._w;
503
- }
504
- lengthSq() {
505
- return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
506
- }
507
- length() {
508
- return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
509
- }
510
- normalize() {
511
- let t = this.length();
512
- return t === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (t = 1 / t, this._x = this._x * t, this._y = this._y * t, this._z = this._z * t, this._w = this._w * t), this._onChangeCallback(), this;
513
- }
514
- multiply(t) {
515
- return this.multiplyQuaternions(this, t);
516
- }
517
- premultiply(t) {
518
- return this.multiplyQuaternions(t, this);
519
- }
520
- multiplyQuaternions(t, e) {
521
- const s = t._x, n = t._y, i = t._z, a = t._w, l = e._x, y = e._y, c = e._z, h = e._w;
522
- return this._x = s * h + a * l + n * c - i * y, this._y = n * h + a * y + i * l - s * c, this._z = i * h + a * c + s * y - n * l, this._w = a * h - s * l - n * y - i * c, this._onChangeCallback(), this;
523
- }
524
- slerp(t, e) {
525
- if (e === 0)
526
- return this;
527
- if (e === 1)
528
- return this.copy(t);
529
- const s = this._x, n = this._y, i = this._z, a = this._w;
530
- let l = a * t._w + s * t._x + n * t._y + i * t._z;
531
- if (l < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, l = -l) : this.copy(t), l >= 1)
532
- return this._w = a, this._x = s, this._y = n, this._z = i, this;
533
- const y = 1 - l * l;
534
- if (y <= Number.EPSILON) {
535
- const u = 1 - e;
536
- return this._w = u * a + e * this._w, this._x = u * s + e * this._x, this._y = u * n + e * this._y, this._z = u * i + e * this._z, this.normalize(), this._onChangeCallback(), this;
537
- }
538
- const c = Math.sqrt(y), h = Math.atan2(c, l), r = Math.sin((1 - e) * h) / c, _ = Math.sin(e * h) / c;
539
- return this._w = a * r + this._w * _, this._x = s * r + this._x * _, this._y = n * r + this._y * _, this._z = i * r + this._z * _, this._onChangeCallback(), this;
540
- }
541
- slerpQuaternions(t, e, s) {
542
- return this.copy(t).slerp(e, s);
543
- }
544
- random() {
545
- 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();
546
- return this.set(
547
- e * Math.cos(n),
548
- s * Math.sin(i),
549
- s * Math.cos(i),
550
- e * Math.sin(n)
551
- );
552
- }
553
- equals(t) {
554
- return t._x === this._x && t._y === this._y && t._z === this._z && t._w === this._w;
555
- }
556
- fromArray(t, e = 0) {
557
- return this._x = t[e], this._y = t[e + 1], this._z = t[e + 2], this._w = t[e + 3], this._onChangeCallback(), this;
558
- }
559
- toArray(t = [], e = 0) {
560
- return t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._w, t;
561
- }
562
- fromBufferAttribute(t, e) {
563
- return this._x = t.getX(e), this._y = t.getY(e), this._z = t.getZ(e), this._w = t.getW(e), this;
564
- }
565
- toJSON() {
566
- return this.toArray();
567
- }
568
- _onChange(t) {
569
- return this._onChangeCallback = t, this;
570
- }
571
- _onChangeCallback() {
572
- }
573
- *[Symbol.iterator]() {
574
- yield this._x, yield this._y, yield this._z, yield this._w;
575
- }
576
- }
577
- class E {
578
- constructor(t = 0, e = 0, s = 0) {
579
- E.prototype.isVector3 = !0, this.x = t, this.y = e, this.z = s;
580
- }
581
- set(t, e, s) {
582
- return s === void 0 && (s = this.z), this.x = t, this.y = e, this.z = s, this;
583
- }
584
- setScalar(t) {
585
- return this.x = t, this.y = t, this.z = t, this;
586
- }
587
- setX(t) {
588
- return this.x = t, this;
589
- }
590
- setY(t) {
591
- return this.y = t, this;
592
- }
593
- setZ(t) {
594
- return this.z = t, this;
595
- }
596
- setComponent(t, e) {
597
- switch (t) {
598
- case 0:
599
- this.x = e;
600
- break;
601
- case 1:
602
- this.y = e;
603
- break;
604
- case 2:
605
- this.z = e;
606
- break;
607
- default:
608
- throw new Error("index is out of range: " + t);
609
- }
610
- return this;
611
- }
612
- getComponent(t) {
613
- switch (t) {
614
- case 0:
615
- return this.x;
616
- case 1:
617
- return this.y;
618
- case 2:
619
- return this.z;
620
- default:
621
- throw new Error("index is out of range: " + t);
622
- }
623
- }
624
- clone() {
625
- return new this.constructor(this.x, this.y, this.z);
626
- }
627
- copy(t) {
628
- return this.x = t.x, this.y = t.y, this.z = t.z, this;
629
- }
630
- add(t) {
631
- return this.x += t.x, this.y += t.y, this.z += t.z, this;
632
- }
633
- addScalar(t) {
634
- return this.x += t, this.y += t, this.z += t, this;
635
- }
636
- addVectors(t, e) {
637
- return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this;
638
- }
639
- addScaledVector(t, e) {
640
- return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this;
641
- }
642
- sub(t) {
643
- return this.x -= t.x, this.y -= t.y, this.z -= t.z, this;
644
- }
645
- subScalar(t) {
646
- return this.x -= t, this.y -= t, this.z -= t, this;
647
- }
648
- subVectors(t, e) {
649
- return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this;
650
- }
651
- multiply(t) {
652
- return this.x *= t.x, this.y *= t.y, this.z *= t.z, this;
653
- }
654
- multiplyScalar(t) {
655
- return this.x *= t, this.y *= t, this.z *= t, this;
656
- }
657
- multiplyVectors(t, e) {
658
- return this.x = t.x * e.x, this.y = t.y * e.y, this.z = t.z * e.z, this;
659
- }
660
- applyEuler(t) {
661
- return this.applyQuaternion(N.setFromEuler(t));
662
- }
663
- applyAxisAngle(t, e) {
664
- return this.applyQuaternion(N.setFromAxisAngle(t, e));
665
- }
666
- applyMatrix3(t) {
667
- const e = this.x, s = this.y, n = this.z, i = t.elements;
668
- 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;
669
- }
670
- applyNormalMatrix(t) {
671
- return this.applyMatrix3(t).normalize();
672
- }
673
- applyMatrix4(t) {
674
- const e = this.x, s = this.y, n = this.z, i = t.elements, a = 1 / (i[3] * e + i[7] * s + i[11] * n + i[15]);
675
- return this.x = (i[0] * e + i[4] * s + i[8] * n + i[12]) * a, this.y = (i[1] * e + i[5] * s + i[9] * n + i[13]) * a, this.z = (i[2] * e + i[6] * s + i[10] * n + i[14]) * a, this;
676
- }
677
- applyQuaternion(t) {
678
- const e = this.x, s = this.y, n = this.z, i = t.x, a = t.y, l = t.z, y = t.w, c = y * e + a * n - l * s, h = y * s + l * e - i * n, r = y * n + i * s - a * e, _ = -i * e - a * s - l * n;
679
- return this.x = c * y + _ * -i + h * -l - r * -a, this.y = h * y + _ * -a + r * -i - c * -l, this.z = r * y + _ * -l + c * -a - h * -i, this;
680
- }
681
- project(t) {
682
- return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix);
683
- }
684
- unproject(t) {
685
- return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld);
686
- }
687
- transformDirection(t) {
688
- const e = this.x, s = this.y, n = this.z, i = t.elements;
689
- 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();
690
- }
691
- divide(t) {
692
- return this.x /= t.x, this.y /= t.y, this.z /= t.z, this;
693
- }
694
- divideScalar(t) {
695
- return this.multiplyScalar(1 / t);
696
- }
697
- min(t) {
698
- return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this;
699
- }
700
- max(t) {
701
- return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this;
702
- }
703
- clamp(t, e) {
704
- return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this.z = Math.max(t.z, Math.min(e.z, this.z)), this;
705
- }
706
- clampScalar(t, e) {
707
- return this.x = Math.max(t, Math.min(e, this.x)), this.y = Math.max(t, Math.min(e, this.y)), this.z = Math.max(t, Math.min(e, this.z)), this;
708
- }
709
- clampLength(t, e) {
710
- const s = this.length();
711
- return this.divideScalar(s || 1).multiplyScalar(Math.max(t, Math.min(e, s)));
712
- }
713
- floor() {
714
- return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this;
715
- }
716
- ceil() {
717
- return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this;
718
- }
719
- round() {
720
- return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this;
721
- }
722
- roundToZero() {
723
- return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this;
724
- }
725
- negate() {
726
- return this.x = -this.x, this.y = -this.y, this.z = -this.z, this;
727
- }
728
- dot(t) {
729
- return this.x * t.x + this.y * t.y + this.z * t.z;
730
- }
731
- // TODO lengthSquared?
732
- lengthSq() {
733
- return this.x * this.x + this.y * this.y + this.z * this.z;
734
- }
735
- length() {
736
- return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
737
- }
738
- manhattanLength() {
739
- return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);
740
- }
741
- normalize() {
742
- return this.divideScalar(this.length() || 1);
743
- }
744
- setLength(t) {
745
- return this.normalize().multiplyScalar(t);
746
- }
747
- lerp(t, e) {
748
- return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, this;
749
- }
750
- lerpVectors(t, e, s) {
751
- return this.x = t.x + (e.x - t.x) * s, this.y = t.y + (e.y - t.y) * s, this.z = t.z + (e.z - t.z) * s, this;
752
- }
753
- cross(t) {
754
- return this.crossVectors(this, t);
755
- }
756
- crossVectors(t, e) {
757
- const s = t.x, n = t.y, i = t.z, a = e.x, l = e.y, y = e.z;
758
- return this.x = n * y - i * l, this.y = i * a - s * y, this.z = s * l - n * a, this;
759
- }
760
- projectOnVector(t) {
761
- const e = t.lengthSq();
762
- if (e === 0)
763
- return this.set(0, 0, 0);
764
- const s = t.dot(this) / e;
765
- return this.copy(t).multiplyScalar(s);
766
- }
767
- projectOnPlane(t) {
768
- return X.copy(this).projectOnVector(t), this.sub(X);
769
- }
770
- reflect(t) {
771
- return this.sub(X.copy(t).multiplyScalar(2 * this.dot(t)));
772
- }
773
- angleTo(t) {
774
- const e = Math.sqrt(this.lengthSq() * t.lengthSq());
775
- if (e === 0)
776
- return Math.PI / 2;
777
- const s = this.dot(t) / e;
778
- return Math.acos(Q(s, -1, 1));
779
- }
780
- distanceTo(t) {
781
- return Math.sqrt(this.distanceToSquared(t));
782
- }
783
- distanceToSquared(t) {
784
- const e = this.x - t.x, s = this.y - t.y, n = this.z - t.z;
785
- return e * e + s * s + n * n;
786
- }
787
- manhattanDistanceTo(t) {
788
- return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z);
789
- }
790
- setFromSpherical(t) {
791
- return this.setFromSphericalCoords(t.radius, t.phi, t.theta);
792
- }
793
- setFromSphericalCoords(t, e, s) {
794
- const n = Math.sin(e) * t;
795
- return this.x = n * Math.sin(s), this.y = Math.cos(e) * t, this.z = n * Math.cos(s), this;
796
- }
797
- setFromCylindrical(t) {
798
- return this.setFromCylindricalCoords(t.radius, t.theta, t.y);
799
- }
800
- setFromCylindricalCoords(t, e, s) {
801
- return this.x = t * Math.sin(e), this.y = s, this.z = t * Math.cos(e), this;
802
- }
803
- setFromMatrixPosition(t) {
804
- const e = t.elements;
805
- return this.x = e[12], this.y = e[13], this.z = e[14], this;
806
- }
807
- setFromMatrixScale(t) {
808
- const e = this.setFromMatrixColumn(t, 0).length(), s = this.setFromMatrixColumn(t, 1).length(), n = this.setFromMatrixColumn(t, 2).length();
809
- return this.x = e, this.y = s, this.z = n, this;
810
- }
811
- setFromMatrixColumn(t, e) {
812
- return this.fromArray(t.elements, e * 4);
813
- }
814
- setFromMatrix3Column(t, e) {
815
- return this.fromArray(t.elements, e * 3);
816
- }
817
- setFromEuler(t) {
818
- return this.x = t._x, this.y = t._y, this.z = t._z, this;
819
- }
820
- setFromColor(t) {
821
- return this.x = t.r, this.y = t.g, this.z = t.b, this;
822
- }
823
- equals(t) {
824
- return t.x === this.x && t.y === this.y && t.z === this.z;
825
- }
826
- fromArray(t, e = 0) {
827
- return this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this;
828
- }
829
- toArray(t = [], e = 0) {
830
- return t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t;
831
- }
832
- fromBufferAttribute(t, e) {
833
- return this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this;
834
- }
835
- random() {
836
- return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this;
837
- }
838
- randomDirection() {
839
- const t = (Math.random() - 0.5) * 2, e = Math.random() * Math.PI * 2, s = Math.sqrt(1 - t ** 2);
840
- return this.x = s * Math.cos(e), this.y = s * Math.sin(e), this.z = t, this;
841
- }
842
- *[Symbol.iterator]() {
843
- yield this.x, yield this.y, yield this.z;
844
- }
845
- }
846
- const X = /* @__PURE__ */ new E(), N = /* @__PURE__ */ new Ut();
847
- typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
848
- revision: lt
849
- } }));
850
- typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = lt);
851
- const Ft = Symbol("CONTROLS_CONTEXT_KEY"), w = tt({});
852
- function Kt() {
853
- return ft(Ft, w), w;
854
- }
855
- function R(o) {
856
- return Object.entries(o).map(([t, e]) => {
857
- let s = "string", n;
858
- const i = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
859
- 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 E || n instanceof E || n instanceof Array) && (s = "vector"), !V(e) && e.value ? {
860
- ...e,
861
- label: e.label || t,
862
- value: e.value,
863
- type: s,
864
- visible: !0
865
- } : {
866
- label: e.label || t,
867
- value: e,
868
- type: s,
869
- visible: !0
125
+ }));
126
+ return () => {
127
+ if (o.default)
128
+ return ce(n.as || "div", { ref: t, style: `touch-action:none;${p.style}` }, o.default(p));
870
129
  };
871
- });
872
- }
873
- function Nt() {
874
- for (const o in w)
875
- delete w[o];
876
- }
877
- function Ge(o, t, e) {
878
- const s = m();
879
- if (typeof o == "string")
880
- o === "fpsgraph" ? (w[o] = {
881
- label: "fpsgraph",
882
- visible: !0,
883
- type: "fpsgraph"
884
- }, s.value = w[o]) : (w[o] = {
885
- label: o,
886
- visible: !0,
887
- type: "folder",
888
- controls: t ? R(t) : []
889
- }, s.value = w[o]);
890
- else if (typeof o == "object" && o.options)
891
- w[o.label || "Dropdown"] = {
892
- ...e,
893
- label: o.label || "Dropdown",
894
- visible: !0,
895
- value: o.value,
896
- type: "select",
897
- ref: o,
898
- options: o.options
899
- }, s.value = w[o.label || "Dropdown"];
900
- else if (typeof o == "object" && typeof t == "string")
901
- w[t] = {
902
- ...e,
903
- label: t,
904
- visible: !0,
905
- value: o[t],
906
- type: typeof o[t],
907
- ref: o
908
- }, s.value = w[t];
909
- else if (gt(o)) {
910
- const n = mt(o), i = R(n);
911
- for (const a of i)
912
- w[a.label] = a;
913
- s.value = i;
914
- } else {
915
- const n = R(o);
916
- for (const i of n)
917
- w[i.label] = i;
918
- s.value = n;
919
130
  }
920
- return bt(Nt), s;
921
- }
922
- const Gt = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Jt = { class: "text-gray-500 w-1/3" }, Ot = ["value", "min", "max", "step"], te = /* @__PURE__ */ S({
131
+ }), we = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, $e = { class: "text-gray-500 w-1/3" }, Ce = ["value", "min", "max", "step"], ke = /* @__PURE__ */ M({
923
132
  __name: "NumberControl",
924
133
  props: {
925
134
  label: {},
926
135
  control: {}
927
136
  },
928
137
  emits: ["change"],
929
- setup(o, { emit: t }) {
930
- const e = o;
931
- function s(h) {
932
- const { target: r } = h;
933
- t("change", r.valueAsNumber);
138
+ setup(n, { emit: o }) {
139
+ const t = n;
140
+ function e(r) {
141
+ const { target: s } = r;
142
+ o("change", s.valueAsNumber);
934
143
  }
935
- const n = H(), i = m(0), a = m(!1), l = (h) => {
936
- i.value = h.clientX, a.value = !0;
937
- }, y = () => {
144
+ const l = j(), u = v(0), a = v(!1), p = (r) => {
145
+ u.value = r.clientX, a.value = !0;
146
+ }, f = () => {
938
147
  a.value = !1;
939
- }, c = (h) => Math.floor(Math.abs(h) / 10);
940
- return I(n.x, (h) => {
148
+ }, g = (r) => Math.floor(Math.abs(r) / 10);
149
+ return P(l.x, (r) => {
941
150
  if (a.value) {
942
- const r = h - i.value, _ = c(r);
943
- r > 0 ? t("change", e.control.value + 1 + _) : r < 0 && t("change", e.control.value - 1 + _), e.control.min !== void 0 && e.control.value < e.control.min && t("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && t("change", e.control.max), i.value = h;
151
+ const s = r - u.value, i = g(s);
152
+ s > 0 ? o("change", t.control.value + 1 + i) : s < 0 && o("change", t.control.value - 1 + i), t.control.min !== void 0 && t.control.value < t.control.min && o("change", t.control.min), t.control.max !== void 0 && t.control.value > t.control.max && o("change", t.control.max), u.value = r;
944
153
  }
945
- }), (h, r) => (d(), g("div", Gt, [
946
- p("label", Jt, C(h.label), 1),
947
- p("input", {
948
- value: h.control.value,
949
- class: $(["p-2 w-1/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": a.value }]),
154
+ }), (r, s) => (d(), m("div", we, [
155
+ c("label", $e, k(r.label), 1),
156
+ c("input", {
157
+ value: r.control.value,
158
+ class: I(["p-2 w-1/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans", { "cursor-ew-resize": a.value }]),
950
159
  type: "number",
951
- min: h.control.min,
952
- max: h.control.max,
953
- step: h.control.step,
954
- onInput: s,
955
- onMousedown: l,
956
- onMouseup: y
957
- }, null, 42, Ot)
160
+ min: r.control.min,
161
+ max: r.control.max,
162
+ step: r.control.step,
163
+ onInput: e,
164
+ onMousedown: p,
165
+ onMouseup: f
166
+ }, null, 42, Ce)
958
167
  ]));
959
168
  }
960
- }), ee = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, se = { class: "text-gray-500 w-1/3" }, ne = ["value"], ie = /* @__PURE__ */ S({
169
+ }), Me = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, Te = { class: "text-gray-500 w-1/3" }, Ie = ["value"], Se = /* @__PURE__ */ M({
961
170
  __name: "TextControl",
962
171
  props: {
963
172
  label: {},
964
173
  control: {}
965
174
  },
966
175
  emits: ["change"],
967
- setup(o, { emit: t }) {
968
- function e(s) {
969
- t("change", s);
176
+ setup(n, { emit: o }) {
177
+ function t(e) {
178
+ const { target: l } = e;
179
+ o("change", l.value);
970
180
  }
971
- return (s, n) => (d(), g("div", ee, [
972
- p("label", se, C(s.label), 1),
973
- p("input", {
974
- value: s.control.value,
975
- type: "string",
181
+ return (e, l) => (d(), m("div", Me, [
182
+ c("label", Te, k(e.label), 1),
183
+ c("input", {
184
+ value: e.control.value,
185
+ type: "text",
976
186
  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",
977
- onChange: e
978
- }, null, 40, ne)
187
+ onChange: t
188
+ }, null, 40, Ie)
979
189
  ]));
980
190
  }
981
- }), oe = { class: "flex px-4 justify-start gap-2 items-center mb-2 min-h-32px" }, re = { class: "text-gray-500 w-1/3" }, ae = ["id", "checked"], he = ["for"], le = { class: "i-ic:baseline-check text-light" }, ue = /* @__PURE__ */ S({
191
+ }), Ae = { class: "flex px-4 justify-start gap-2 items-center mb-2 min-h-32px" }, De = { class: "text-gray-500 w-1/3" }, Ee = ["id", "checked"], Fe = ["for"], Ve = { class: "i-ic:baseline-check text-light" }, ze = /* @__PURE__ */ M({
982
192
  __name: "BooleanControl",
983
193
  props: {
984
194
  label: {},
985
195
  control: {}
986
196
  },
987
197
  emits: ["change"],
988
- setup(o, { emit: t }) {
989
- function e(s) {
990
- const { target: n } = s;
991
- t("change", n.checked);
198
+ setup(n, { emit: o }) {
199
+ function t(e) {
200
+ const { target: l } = e;
201
+ o("change", l.checked);
992
202
  }
993
- return (s, n) => (d(), g("div", oe, [
994
- p("label", re, C(s.label), 1),
995
- p("input", {
996
- id: s.control.label,
997
- checked: s.control.value,
203
+ return (e, l) => (d(), m("div", Ae, [
204
+ c("label", De, k(e.label), 1),
205
+ c("input", {
206
+ id: e.control.label,
207
+ checked: e.control.value,
998
208
  class: "hidden",
999
209
  type: "checkbox",
1000
- onInput: e
1001
- }, null, 40, ae),
1002
- p("label", {
1003
- for: s.control.label,
210
+ onInput: t
211
+ }, null, 40, Ee),
212
+ c("label", {
213
+ for: e.control.label,
1004
214
  class: "inline-flex items-center cursor-pointer"
1005
215
  }, [
1006
- p("span", {
1007
- class: $([{ "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"])
216
+ c("span", {
217
+ class: I([{ "bg-dark-500": e.control.value, "bg-gray-200": !e.control.value }, "w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"])
1008
218
  }, [
1009
- et(p("i", le, null, 512), [
1010
- [st, s.control.value]
219
+ q(c("i", Ve, null, 512), [
220
+ [J, e.control.value]
1011
221
  ])
1012
222
  ], 2)
1013
- ], 8, he)
223
+ ], 8, Fe)
1014
224
  ]));
1015
225
  }
1016
- }), ce = { class: "px-4 relative flex justify-between gap-4 items-center mb-2" }, ye = ["value", "min", "max", "step"], _e = ["value", "min", "max", "step"], xe = /* @__PURE__ */ S({
226
+ }), Ue = { class: "px-4 relative flex justify-between gap-4 items-center mb-2" }, Xe = ["value", "min", "max", "step"], Oe = ["value", "min", "max", "step"], Le = /* @__PURE__ */ M({
1017
227
  __name: "SliderControl",
1018
228
  props: {
1019
229
  label: {},
1020
230
  control: {}
1021
231
  },
1022
232
  emits: ["change"],
1023
- setup(o, { emit: t }) {
1024
- const e = o;
1025
- function s(r) {
1026
- const { target: _ } = r;
1027
- t("change", _.valueAsNumber);
233
+ setup(n, { emit: o }) {
234
+ const t = n;
235
+ function e(s) {
236
+ const { target: i } = s;
237
+ o("change", i.valueAsNumber);
1028
238
  }
1029
- const n = T(() => ({
1030
- 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%)`
1031
- })), i = H(), a = m(0), l = m(!1), y = (r) => {
1032
- a.value = r.clientX, l.value = !0;
1033
- }, c = () => {
1034
- l.value = !1;
1035
- }, h = (r) => Math.floor(Math.abs(r) / 10);
1036
- return I(i.x, (r) => {
1037
- if (l.value) {
1038
- const _ = r - a.value, u = h(_);
1039
- _ > 0 ? t("change", e.control.value + 1 + u) : _ < 0 && t("change", e.control.value - 1 + u), e.control.min !== void 0 && e.control.value < e.control.min && t("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && t("change", e.control.max), a.value = r;
239
+ const l = A(() => ({
240
+ backgroundImage: `linear-gradient(to right, #333 0% ${100 * (t.control.value - (t.control.min || 0)) / ((t.control.max || 100) - (t.control.min || 0))}%, #e2e2e2 0%)`
241
+ })), u = j(), a = v(0), p = v(!1), f = (s) => {
242
+ a.value = s.clientX, p.value = !0;
243
+ }, g = () => {
244
+ p.value = !1;
245
+ }, r = (s) => Math.floor(Math.abs(s) / 10);
246
+ return P(u.x, (s) => {
247
+ if (p.value) {
248
+ const i = s - a.value, $ = r(i);
249
+ i > 0 ? o("change", t.control.value + 1 + $) : i < 0 && o("change", t.control.value - 1 + $), t.control.min !== void 0 && t.control.value < t.control.min && o("change", t.control.min), t.control.max !== void 0 && t.control.value > t.control.max && o("change", t.control.max), a.value = s;
1040
250
  }
1041
- }), (r, _) => (d(), g("div", ce, [
1042
- p("label", {
1043
- class: $(["text-gray-500 w-1/3", { "flex justify-between items-center": r.control.icon }])
251
+ }), (s, i) => (d(), m("div", Ue, [
252
+ c("label", {
253
+ class: I(["text-gray-500 w-1/3", { "flex justify-between items-center": s.control.icon }])
1044
254
  }, [
1045
- zt(C(r.label) + " ", 1),
1046
- p("i", {
1047
- class: $(`i-${r.control.icon}`)
255
+ ue(k(s.label) + " ", 1),
256
+ c("i", {
257
+ class: I(`i-${s.control.icon}`)
1048
258
  }, null, 2)
1049
259
  ], 2),
1050
- p("input", {
1051
- value: r.control.value,
260
+ c("input", {
261
+ value: s.control.value,
1052
262
  class: "w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",
1053
- style: wt(n.value),
263
+ style: ie(l.value),
1054
264
  type: "range",
1055
- min: r.control.min,
1056
- max: r.control.max,
1057
- step: r.control.step,
1058
- onInput: s
1059
- }, null, 44, ye),
1060
- p("input", {
1061
- value: r.control.value,
1062
- class: $(["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 }]),
265
+ min: s.control.min,
266
+ max: s.control.max,
267
+ step: s.control.step,
268
+ onInput: e
269
+ }, null, 44, Xe),
270
+ c("input", {
271
+ value: s.control.value,
272
+ class: I(["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": p.value }]),
1063
273
  type: "number",
1064
- min: r.control.min,
1065
- max: r.control.max,
1066
- step: r.control.step,
1067
- onInput: s,
1068
- onMousedown: y,
1069
- onMouseup: c
1070
- }, null, 42, _e)
274
+ min: s.control.min,
275
+ max: s.control.max,
276
+ step: s.control.step,
277
+ onInput: e,
278
+ onMousedown: f,
279
+ onMouseup: g
280
+ }, null, 42, Oe)
1071
281
  ]));
1072
282
  }
1073
283
  });
1074
- const pe = (o, t) => {
1075
- const e = o.__vccOpts || o;
1076
- for (const [s, n] of t)
1077
- e[s] = n;
1078
- return e;
1079
- }, de = /* @__PURE__ */ pe(xe, [["__scopeId", "data-v-743fd350"]]), fe = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, ge = { class: "text-gray-500 w-1/3" }, me = ["value"], be = ["value"], ze = /* @__PURE__ */ S({
284
+ const Pe = (n, o) => {
285
+ const t = n.__vccOpts || n;
286
+ for (const [e, l] of o)
287
+ t[e] = l;
288
+ return t;
289
+ }, Ne = /* @__PURE__ */ Pe(Le, [["__scopeId", "data-v-743fd350"]]), We = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Be = { class: "text-gray-500 w-1/3" }, Ke = ["value"], Ye = ["value"], je = /* @__PURE__ */ M({
1080
290
  __name: "ColorControl",
1081
291
  props: {
1082
292
  label: {},
1083
293
  control: {}
1084
294
  },
1085
295
  emits: ["change"],
1086
- setup(o, { emit: t }) {
1087
- function e(s) {
1088
- const { target: n } = s;
1089
- t("change", n.value);
296
+ setup(n, { emit: o }) {
297
+ function t(e) {
298
+ const { target: l } = e;
299
+ o("change", l.value);
1090
300
  }
1091
- return (s, n) => (d(), g("div", fe, [
1092
- p("label", ge, C(s.label), 1),
1093
- p("input", {
1094
- value: s.control.value,
301
+ return (e, l) => (d(), m("div", We, [
302
+ c("label", Be, k(e.label), 1),
303
+ c("input", {
304
+ value: e.control.value,
1095
305
  type: "color",
1096
- onInput: e
1097
- }, null, 40, me),
1098
- p("input", {
1099
- value: s.control.value,
306
+ onInput: t
307
+ }, null, 40, Ke),
308
+ c("input", {
309
+ value: e.control.value,
1100
310
  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",
1101
311
  type: "text",
1102
- onInput: e
1103
- }, null, 40, be)
312
+ onInput: t
313
+ }, null, 40, Ye)
1104
314
  ]));
1105
315
  }
1106
316
  });
1107
- function we(o) {
1108
- return typeof o == "number" ? [o, o, o] : o instanceof E ? [o.x, o.y, o.z] : o;
317
+ function He(n) {
318
+ if (typeof n == "number")
319
+ return [n, n, n];
320
+ if (ne(n)) {
321
+ const { x: o, y: t, z: e } = n;
322
+ return [o, t, e];
323
+ }
324
+ return n;
1109
325
  }
1110
- const Me = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, ve = { class: "text-gray-500 w-1/3" }, Ce = { class: "w-2/3 flex justify-between gap-1" }, Se = {
326
+ function Re(n) {
327
+ return n && typeof n.x == "number" && typeof n.y == "number" && typeof n.z > "u";
328
+ }
329
+ function ne(n) {
330
+ return n && typeof n.x == "number" && typeof n.y == "number" && typeof n.z == "number";
331
+ }
332
+ const Ge = { class: "flex px-4 justify-between gap-1 items-center mb-2" }, qe = { class: "text-gray-500 w-1/3" }, Je = { class: "w-2/3 flex justify-between gap-0.5" }, Qe = {
1111
333
  key: 0,
1112
- class: "font-bold px-0.5 py-1 text-0.65rem text-gray-300"
1113
- }, ke = ["value", "onInput", "onMousedown", "onMouseup"], $e = /* @__PURE__ */ S({
334
+ class: "font-bold px-1 py-1 text-0.65rem text-gray-300"
335
+ }, Ze = ["value", "onInput", "onMousedown", "onMouseup"], en = /* @__PURE__ */ M({
1114
336
  __name: "VectorControl",
1115
337
  props: {
1116
338
  label: {},
1117
339
  control: {}
1118
340
  },
1119
341
  emits: ["change"],
1120
- setup(o, { emit: t }) {
1121
- const e = o, s = H(), n = m(0), i = m(!1), a = m(0), l = (x, b) => {
1122
- a.value = b, n.value = x.clientX, i.value = !0;
1123
- }, y = (x, b) => {
1124
- a.value = b, i.value = !1;
1125
- }, c = (x) => Math.floor(Math.abs(x) / 10), h = T(() => we(e.control.value)), r = T(() => Object.keys(e.control.value)), _ = T(() => e.control.value instanceof W || e.control.value instanceof E);
1126
- function u(x, b) {
1127
- const { value: z } = e.control, { target: f } = x;
1128
- a.value = b, z[_.value ? r.value[a.value] : a.value] = parseInt(f.value, 10), t("change", z);
342
+ setup(n, { emit: o }) {
343
+ const t = n, e = j(), l = v(0), u = v(!1), a = v(0), p = (_, h) => {
344
+ a.value = h, l.value = _.clientX, u.value = !0;
345
+ }, f = (_, h) => {
346
+ a.value = h, u.value = !1;
347
+ }, g = (_) => Math.floor(Math.abs(_) / 10), r = A(() => He(t.control.value)), s = v(["x", "y", "z"]), i = A(() => Re(t.control.value) || ne(t.control.value));
348
+ function $(_, h) {
349
+ const { value: x } = t.control, { target: b } = _;
350
+ a.value = h, x[i.value ? s.value[a.value] : a.value] = parseInt(b.value, 10), o("change", x);
1129
351
  }
1130
- return I(s.x, (x) => {
1131
- if (i.value) {
1132
- const b = x - n.value, z = c(b), { value: f } = e.control, M = _.value ? r.value[a.value] : a.value;
1133
- b > 0 ? f[M] += 1 + z : b < 0 && (f[M] -= 1 + z), e.control.min !== void 0 && f < e.control.min && (f[M] = e.control.min), e.control.max !== void 0 && f > e.control.max && (f[M] = e.control.max), t("change", f), n.value = x;
352
+ return P(e.x, (_) => {
353
+ if (u.value) {
354
+ const h = _ - l.value, x = g(h), { value: b } = t.control, w = i.value ? s.value[a.value] : a.value;
355
+ h > 0 ? b[w] += 0.1 + x : h < 0 && (b[w] -= 0.1 + x), t.control.min !== void 0 && b < t.control.min && (b[w] = t.control.min), t.control.max !== void 0 && b > t.control.max && (b[w] = t.control.max), o("change", b), l.value = _;
1134
356
  }
1135
- }), (x, b) => (d(), g("div", Me, [
1136
- p("label", ve, C(x.label), 1),
1137
- p("div", Ce, [
1138
- (d(!0), g(P, null, L(h.value, (z, f) => (d(), g("div", {
1139
- key: x.label + f,
357
+ }), (_, h) => (d(), m("div", Ge, [
358
+ c("label", qe, k(_.label), 1),
359
+ c("div", Je, [
360
+ (d(!0), m(S, null, U(r.value, (x, b) => (d(), m("div", {
361
+ key: _.label + b,
1140
362
  class: "flex items-center w-1/3 bg-gray-100 rounded"
1141
363
  }, [
1142
- r.value[f] && _.value ? (d(), g("span", Se, C(r.value[f]), 1)) : nt("", !0),
1143
- p("input", {
364
+ s.value[b] && i.value ? (d(), m("span", Qe, k(s.value[b]), 1)) : L("", !0),
365
+ c("input", {
1144
366
  type: "text",
1145
- class: $(["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 }]),
1146
- value: h.value[f].toFixed(2),
1147
- onInput: (M) => u(M, f),
1148
- onMousedown: (M) => l(M, f),
1149
- onMouseup: (M) => y(M, f)
1150
- }, null, 42, ke)
367
+ class: I(["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": u.value }]),
368
+ value: r.value[b].toFixed(2),
369
+ onInput: (w) => $(w, b),
370
+ onMousedown: (w) => p(w, b),
371
+ onMouseup: (w) => f(w, b)
372
+ }, null, 42, Ze)
1151
373
  ]))), 128))
1152
374
  ])
1153
375
  ]));
1154
376
  }
1155
- }), Ee = { class: "mb-4" }, Te = { class: "bg-white rounded-b pt-4" }, Ie = /* @__PURE__ */ S({
1156
- __name: "Folder",
1157
- props: {
1158
- control: {}
1159
- },
1160
- setup(o) {
1161
- function t(n, i) {
1162
- i.value = n;
1163
- }
1164
- const e = m(!1), s = () => {
1165
- e.value = !e.value;
1166
- };
1167
- return (n, i) => (d(), g("div", Ee, [
1168
- p("button", {
1169
- 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",
1170
- onClick: s
1171
- }, [
1172
- p("span", null, C(n.control.label), 1),
1173
- p("i", {
1174
- class: $(e.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
1175
- }, null, 2)
1176
- ]),
1177
- Mt(vt, {
1178
- name: "slide",
1179
- "enter-active-class": " animate-fade-in animate-duration-200 animate-ease-in-out",
1180
- "leave-active-class": " animate-fade-out animate-duration-200 animate-ease-in-out"
1181
- }, {
1182
- default: it(() => [
1183
- et(p("div", Te, [
1184
- (d(!0), g(P, null, L(n.control.controls, (a) => (d(), v(ut, {
1185
- key: a.label,
1186
- control: a,
1187
- onChange: (l) => t(l, a)
1188
- }, null, 8, ["control", "onChange"]))), 128))
1189
- ], 512), [
1190
- [st, e.value]
1191
- ])
1192
- ]),
1193
- _: 1
1194
- })
1195
- ]));
1196
- }
1197
- }), Ae = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, je = { class: "text-gray-500 w-1/3" }, qe = { class: "relative w-2/3 p-1 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans" }, Pe = { class: "absolute bottom-0.5 right-0.5 font-sans text-xs" }, De = ["points"], G = 160, Y = 40, A = 2, J = 100, O = 20, Le = /* @__PURE__ */ S({
377
+ }), nn = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, tn = { class: "text-gray-500 w-1/3" }, on = { 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" }, ln = { class: "absolute bottom-0.5 right-0.5 font-sans text-xs" }, rn = ["points"], H = 160, W = 40, z = 2, R = 100, G = 20, sn = /* @__PURE__ */ M({
1198
378
  __name: "FPSGraph",
1199
379
  props: {
1200
380
  label: {},
1201
381
  control: {}
1202
382
  },
1203
- setup(o) {
1204
- const t = $t({ every: J }), e = m(""), s = m([]), n = m(G / A);
1205
- let i = performance.now();
1206
- return Et(({ timestamp: a }) => {
1207
- a - i >= J && (i = a, s.value.push(t.value), s.value.length > n.value && s.value.shift(), e.value = s.value.map(
1208
- (l, y) => `${y * A},${Y + O - A / 2 - l * (Y + O - A) / 120}`
383
+ setup(n) {
384
+ const o = he({ every: R }), t = v(""), e = v([]), l = v(H / z);
385
+ let u = performance.now();
386
+ return ye(({ timestamp: a }) => {
387
+ a - u >= R && (u = a, e.value.push(o.value), e.value.length > l.value && e.value.shift(), t.value = e.value.map(
388
+ (p, f) => `${f * z},${W + G - z / 2 - p * (W + G - z) / 120}`
1209
389
  ).join(" "));
1210
- }), (a, l) => (d(), g("div", Ae, [
1211
- p("label", je, C(a.label), 1),
1212
- p("div", qe, [
1213
- p("div", Pe, C(Math.round(j(t))) + " FPS", 1),
1214
- (d(), g("svg", {
1215
- width: G,
1216
- height: Y,
390
+ }), (a, p) => (d(), m("div", nn, [
391
+ c("label", tn, k(a.label), 1),
392
+ c("div", on, [
393
+ c("div", ln, k(Math.round(D(o))) + " FPS", 1),
394
+ (d(), m("svg", {
395
+ width: H,
396
+ height: W,
1217
397
  xmlns: "http://www.w3.org/2000/svg",
1218
398
  class: "bg-gray-100"
1219
399
  }, [
1220
- p("polyline", {
1221
- points: e.value,
400
+ c("polyline", {
401
+ points: t.value,
1222
402
  fill: "none",
1223
403
  stroke: "lightgray",
1224
- "stroke-width": A,
404
+ "stroke-width": z,
1225
405
  "stroke-linecap": "round",
1226
406
  "stroke-linejoin": "round"
1227
- }, null, 8, De)
407
+ }, null, 8, rn)
1228
408
  ]))
1229
409
  ])
1230
410
  ]));
1231
411
  }
1232
- }), Ve = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, Xe = { class: "text-gray-500 w-1/3" }, Re = ["value"], Ye = ["value"], He = /* @__PURE__ */ S({
412
+ }), an = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, cn = { class: "text-gray-500 w-1/3" }, un = ["value"], pn = ["value"], dn = /* @__PURE__ */ M({
1233
413
  __name: "SelectControl",
1234
414
  props: {
1235
415
  label: {},
1236
416
  control: {}
1237
417
  },
1238
418
  emits: ["change"],
1239
- setup(o, { emit: t }) {
1240
- function e(s) {
1241
- t("change", s.target.value);
419
+ setup(n, { emit: o }) {
420
+ function t(e) {
421
+ o("change", e.target.value);
1242
422
  }
1243
- return (s, n) => (d(), g("div", Ve, [
1244
- p("label", Xe, C(s.label), 1),
1245
- p("select", {
1246
- value: s.control.value,
423
+ return (e, l) => (d(), m("div", an, [
424
+ c("label", cn, k(e.label), 1),
425
+ c("select", {
426
+ value: e.control.value,
1247
427
  class: "p-2 w-2/3 rounded text-left text-xs text-gray-400 bg-gray-100 focus:border-gray-200 outline-none border-none font-sans",
1248
- onChange: e
428
+ onChange: t
1249
429
  }, [
1250
- (d(!0), g(P, null, L(s.control.options, (i) => (d(), g("option", {
1251
- key: i.value,
1252
- value: i.value
1253
- }, C(i.text), 9, Ye))), 128))
1254
- ], 40, Re)
430
+ (d(!0), m(S, null, U(e.control.options, (u) => (d(), m("option", {
431
+ key: u.value,
432
+ value: u.value
433
+ }, k(u.text), 9, pn))), 128))
434
+ ], 40, un)
1255
435
  ]));
1256
436
  }
1257
- }), ut = /* @__PURE__ */ S({
437
+ }), te = /* @__PURE__ */ M({
1258
438
  __name: "ControlInput",
1259
439
  props: {
1260
440
  control: {}
1261
441
  },
1262
442
  emits: ["change"],
1263
- setup(o, { emit: t }) {
1264
- function e(s) {
1265
- t("change", s);
443
+ setup(n, { emit: o }) {
444
+ function t(e) {
445
+ o("change", e);
1266
446
  }
1267
- return (s, n) => s.control.visible ? (d(), g(P, { key: 0 }, [
1268
- s.control.type === "color" ? (d(), v(ze, {
447
+ return (e, l) => e.control.visible ? (d(), m(S, { key: 0 }, [
448
+ e.control.type === "color" ? (d(), C(je, {
1269
449
  key: 0,
1270
- label: s.control.label,
1271
- control: s.control,
1272
- onChange: e
1273
- }, null, 8, ["label", "control"])) : s.control.type === "vector" ? (d(), v($e, {
450
+ label: e.control.label,
451
+ control: e.control,
452
+ onChange: t
453
+ }, null, 8, ["label", "control"])) : e.control.type === "select" ? (d(), C(dn, {
1274
454
  key: 1,
1275
- label: s.control.label,
1276
- control: s.control,
1277
- onChange: e
1278
- }, null, 8, ["label", "control"])) : s.control.type === "boolean" ? (d(), v(ue, {
455
+ label: e.control.label,
456
+ control: e.control,
457
+ onChange: t
458
+ }, null, 8, ["label", "control"])) : e.control.type === "vector" ? (d(), C(en, {
1279
459
  key: 2,
1280
- label: s.control.label,
1281
- control: s.control,
1282
- onChange: e
1283
- }, null, 8, ["label", "control"])) : s.control.type === "fpsgraph" ? (d(), v(Le, {
460
+ label: e.control.label,
461
+ control: e.control,
462
+ onChange: t
463
+ }, null, 8, ["label", "control"])) : e.control.type === "boolean" ? (d(), C(ze, {
1284
464
  key: 3,
1285
- label: s.control.label,
1286
- control: s.control
1287
- }, null, 8, ["label", "control"])) : s.control.type === "folder" ? (d(), v(Ie, {
465
+ label: e.control.label,
466
+ control: e.control,
467
+ onChange: t
468
+ }, null, 8, ["label", "control"])) : e.control.type === "fpsgraph" ? (d(), C(sn, {
1288
469
  key: 4,
1289
- label: s.control.label,
1290
- control: s.control
1291
- }, null, 8, ["label", "control"])) : s.control.type === "number" ? (d(), v(te, {
470
+ label: e.control.label,
471
+ control: e.control
472
+ }, null, 8, ["label", "control"])) : e.control.type === "number" ? (d(), C(ke, {
1292
473
  key: 5,
1293
- label: s.control.label,
1294
- control: s.control,
1295
- onChange: e
1296
- }, null, 8, ["label", "control"])) : s.control.type === "range" ? (d(), v(de, {
474
+ label: e.control.label,
475
+ control: e.control,
476
+ onChange: t
477
+ }, null, 8, ["label", "control"])) : e.control.type === "range" ? (d(), C(Ne, {
1297
478
  key: 6,
1298
- label: s.control.label,
1299
- control: s.control,
1300
- onChange: e
1301
- }, null, 8, ["label", "control"])) : s.control.type === "select" ? (d(), v(He, {
479
+ label: e.control.label,
480
+ control: e.control,
481
+ onChange: t
482
+ }, null, 8, ["label", "control"])) : (d(), C(Se, {
1302
483
  key: 7,
1303
- label: s.control.label,
1304
- control: s.control,
1305
- onChange: e
1306
- }, null, 8, ["label", "control"])) : (d(), v(ie, {
1307
- key: 8,
1308
- label: s.control.label,
1309
- control: s.control,
1310
- onChange: e
484
+ label: e.control.label,
485
+ control: e.control,
486
+ onChange: t
1311
487
  }, null, 8, ["label", "control"]))
1312
- ], 64)) : nt("", !0);
488
+ ], 64)) : L("", !0);
489
+ }
490
+ }), fn = { class: "mb-4" }, vn = { class: "bg-white rounded-b pt-4" }, gn = /* @__PURE__ */ M({
491
+ __name: "Folder",
492
+ props: {
493
+ controls: {},
494
+ label: {}
495
+ },
496
+ setup(n) {
497
+ function o(l, u) {
498
+ u.value = l;
499
+ }
500
+ const t = v(!1), e = () => {
501
+ t.value = !t.value;
502
+ };
503
+ return (l, u) => (d(), m("div", fn, [
504
+ c("button", {
505
+ class: "flex items-center justify-between w-full py-2 px-4 bg-gray-100 border-none text-gray-400 font-bold text-xs focus:outline-none font-sans cursor-pointer",
506
+ onClick: e
507
+ }, [
508
+ c("span", null, k(l.label), 1),
509
+ c("i", {
510
+ class: I(t.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
511
+ }, null, 2)
512
+ ]),
513
+ pe(de, {
514
+ name: "slide",
515
+ "enter-active-class": " animate-fade-in animate-duration-200 animate-ease-in-out",
516
+ "leave-active-class": " animate-fade-out animate-duration-200 animate-ease-in-out"
517
+ }, {
518
+ default: Q(() => [
519
+ q(c("div", vn, [
520
+ (d(!0), m(S, null, U(l.controls, (a) => (d(), C(te, {
521
+ key: a.label,
522
+ control: a,
523
+ onChange: (p) => o(p, a)
524
+ }, null, 8, ["control", "onChange"]))), 128))
525
+ ], 512), [
526
+ [J, t.value]
527
+ ])
528
+ ]),
529
+ _: 1
530
+ })
531
+ ]));
1313
532
  }
1314
- }), Qe = { class: "bg-white shadow-xl rounded border-4 border-solid border-black" }, We = /* @__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), Ze = /* @__PURE__ */ p("div", null, [
1315
- /* @__PURE__ */ p("i", { class: "i-ic-baseline-drag-indicator" }),
1316
- /* @__PURE__ */ p("i", { class: "i-ic-baseline-drag-indicator" }),
1317
- /* @__PURE__ */ p("i", { class: "i-ic-baseline-drag-indicator" })
1318
- ], -1), Be = /* @__PURE__ */ p("div", null, null, -1), Ue = [
1319
- We,
1320
- Ze,
1321
- Be
1322
- ], Fe = 280, Je = /* @__PURE__ */ S({
533
+ }), hn = Symbol("CONTROLS_CONTEXT_KEY"), oe = "default";
534
+ function yn(n = oe) {
535
+ return fe(hn, E), E[n];
536
+ }
537
+ const E = Y({}), B = (n) => {
538
+ const o = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
539
+ return typeof n == "boolean" ? "boolean" : typeof n == "number" ? "number" : typeof n == "string" && o.test(n) ? "color" : typeof n == "string" ? "string" : n.isVector3 || n.isVector2 || n.isEuler || n instanceof Array ? "vector" : n.min !== void 0 || n.max !== void 0 || n.step !== void 0 ? "range" : n.options && Array.isArray(n.options) && n.options.every((t) => "text" in t && "value" in t) ? "select" : "unknown";
540
+ }, X = (n, o, t, e) => {
541
+ const l = {
542
+ label: v(n),
543
+ name: v(n),
544
+ type: v(t),
545
+ value: v(o),
546
+ visible: v(!0),
547
+ [n]: v(o)
548
+ };
549
+ return e && (l.folder = v(e)), l;
550
+ }, Mn = (n, o, t) => {
551
+ const e = [], l = typeof n == "string" ? n : null, u = l ? o : n, a = l && l !== "fpsgraph" ? t : o, p = (a == null ? void 0 : a.uuid) || oe;
552
+ if (E[p] || (E[p] = Y({})), n === "fpsgraph") {
553
+ const g = X("fpsgraph", null, "fpsgraph", null);
554
+ return E[p].fpsgraph = g, e.push(g), e.length === 1 ? e[0] : e;
555
+ }
556
+ const f = E[p];
557
+ for (const g in u) {
558
+ let r = u[g];
559
+ if (typeof r == "object" && !O(r) && !Array.isArray(r) && r.value !== void 0) {
560
+ const i = r, $ = O(i.value) ? i.value : v(i.value), _ = B(i), h = X(g, $, _, l);
561
+ _ === "select" && (h.options = v(i.options)), _ === "range" && (h.min = v(i.min), h.max = v(i.max), h.step = v(i.step)), f[g] = h, e.push(h);
562
+ continue;
563
+ }
564
+ if (O(r)) {
565
+ const i = X(g, r, B(r.value), l);
566
+ f[g] = i, e.push(i);
567
+ continue;
568
+ } else if (typeof r == "object" && !Array.isArray(r)) {
569
+ const i = K(r);
570
+ i[g] && (r = i[g]);
571
+ }
572
+ const s = X(g, r, B(r), l);
573
+ f[g] = s, e.push(s);
574
+ }
575
+ return e.length === 1 ? e[0] : e;
576
+ }, bn = { class: "bg-white shadow-xl rounded border-4 border-solid border-black" }, mn = /* @__PURE__ */ c("i", { class: "h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs" }, "🍰", -1), _n = /* @__PURE__ */ c("div", null, [
577
+ /* @__PURE__ */ c("i", { class: "i-ic-baseline-drag-indicator" }),
578
+ /* @__PURE__ */ c("i", { class: "i-ic-baseline-drag-indicator" }),
579
+ /* @__PURE__ */ c("i", { class: "i-ic-baseline-drag-indicator" })
580
+ ], -1), xn = /* @__PURE__ */ c("div", null, null, -1), wn = [
581
+ mn,
582
+ _n,
583
+ xn
584
+ ], $n = 280, Tn = /* @__PURE__ */ M({
1323
585
  __name: "TresLeches",
1324
- setup(o) {
1325
- const { width: t } = Tt(), e = m(null), s = Kt();
1326
- function n(i, a) {
1327
- a.ref && (a.ref[a.label] = i), a.value = i;
586
+ props: {
587
+ uuid: {}
588
+ },
589
+ setup(n) {
590
+ const o = n, { uuid: t } = K(o), { width: e } = Z(), l = v(null), u = yn(t == null ? void 0 : t.value);
591
+ function a(f, g) {
592
+ u[D(f)].value = g;
1328
593
  }
1329
- return (i, a) => (d(), v(j(Qt), {
1330
- "initial-value": { x: j(t) - Fe - 20, y: 10 },
1331
- class: $(["absolute select-none z-24 w-280px font-sans text-xs", i.$attrs.class]),
1332
- handle: e.value
594
+ const p = A(() => {
595
+ const f = {};
596
+ for (const g in u) {
597
+ const r = u[g], s = r.folder || "default";
598
+ f[s] || (f[s] = []), f[s].push(r);
599
+ }
600
+ return f;
601
+ });
602
+ return (f, g) => (d(), C(D(xe), {
603
+ id: D(t),
604
+ "initial-value": { x: D(e) - $n - 40, y: 10 },
605
+ class: I(["absolute select-none z-24 w-280px font-sans text-xs", f.$attrs.class]),
606
+ handle: l.value
1333
607
  }, {
1334
- default: it(() => [
1335
- p("div", Qe, [
1336
- p("header", {
608
+ default: Q(() => [
609
+ c("div", bn, [
610
+ c("header", {
1337
611
  ref_key: "handle",
1338
- ref: e,
612
+ ref: l,
1339
613
  class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
1340
- }, Ue, 512),
1341
- (d(!0), g(P, null, L(j(s), (l) => (d(), v(ut, {
1342
- key: l.label,
1343
- control: l,
1344
- onChange: (y) => n(y, l)
1345
- }, null, 8, ["control", "onChange"]))), 128))
614
+ }, wn, 512),
615
+ (d(!0), m(S, null, U(p.value, (r, s) => (d(), m(S, { key: s }, [
616
+ s !== "default" ? (d(), C(gn, {
617
+ key: 0,
618
+ label: s,
619
+ controls: r
620
+ }, null, 8, ["label", "controls"])) : L("", !0),
621
+ s === "default" ? (d(!0), m(S, { key: 1 }, U(r, (i) => (d(), C(te, {
622
+ key: i.label,
623
+ control: i,
624
+ onChange: ($) => a(i.label, $)
625
+ }, null, 8, ["control", "onChange"]))), 128)) : L("", !0)
626
+ ], 64))), 128))
1346
627
  ])
1347
628
  ]),
1348
629
  _: 1
1349
- }, 8, ["initial-value", "class", "handle"]));
630
+ }, 8, ["id", "initial-value", "class", "handle"]));
1350
631
  }
1351
632
  });
1352
633
  export {
1353
- Je as TresLeches,
1354
- Ge as useControls
634
+ Tn as TresLeches,
635
+ Mn as useControls,
636
+ yn as useControlsProvider
1355
637
  };