@tresjs/leches 0.7.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.7.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 D, getCurrentScope as ne, onScopeDispose as oe, toRef as le, readonly as ae, customRef as se, ref as g, defineComponent as w, computed as I, reactive as H, h as re, watch as T, provide as ue, isReactive as ie, toRefs as ce, onUnmounted as fe, isRef as L, openBlock as f, createElementBlock as d, createElementVNode as u, toDisplayString as m, normalizeClass as M, withDirectives as G, vShow as q, createTextVNode as pe, normalizeStyle as ve, Fragment as E, renderList as A, createCommentVNode as J, createVNode as de, Transition as be, withCtx as Q, createBlock as _ } from "vue";
9
- import { useStorage as ge, isClient as ye, useDraggable as he, useMouse as R, useFps as _e, useRafFn as me, useWindowSize as we } from "@vueuse/core";
10
- function Z(t) {
11
- return ne() ? (oe(t), !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 P(t) {
14
- return typeof t == "function" ? t() : D(t);
15
- }
16
- const O = typeof window < "u", F = () => {
17
- }, X = /* @__PURE__ */ xe();
18
- function xe() {
19
- var t;
20
- return O && ((t = window == null ? void 0 : window.navigator) == null ? void 0 : t.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
21
- }
22
- function $e(...t) {
23
- if (t.length !== 1)
24
- return le(...t);
25
- const o = t[0];
26
- return typeof o == "function" ? ae(se(() => ({ get: o, set: F }))) : g(o);
27
- }
28
- function ke(t) {
29
- var o;
30
- const e = P(t);
31
- return (o = e == null ? void 0 : e.$el) != null ? o : 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 Ce = O ? window : void 0;
34
- function Me(...t) {
35
- let o, e, n, l;
36
- if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([e, n, l] = t, o = Ce) : [o, e, n, l] = t, !o)
37
- return F;
38
- Array.isArray(e) || (e = [e]), Array.isArray(n) || (n = [n]);
39
- const a = [], s = () => {
40
- a.forEach((c) => c()), a.length = 0;
41
- }, i = (c, r, v, C) => (c.addEventListener(r, v, C), () => c.removeEventListener(r, v, C)), p = T(
42
- () => [ke(o), P(l)],
43
- ([c, r]) => {
44
- s(), c && a.push(
45
- ...e.flatMap((v) => n.map((C) => i(c, v, C, r)))
46
- );
47
- },
48
- { immediate: !0, flush: "post" }
49
- ), x = () => {
50
- p(), s();
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 Z(x), x;
53
94
  }
54
- var Se = Object.defineProperty, Ie = Object.defineProperties, Te = Object.getOwnPropertyDescriptors, U = Object.getOwnPropertySymbols, je = Object.prototype.hasOwnProperty, De = Object.prototype.propertyIsEnumerable, W = (t, o, e) => o in t ? Se(t, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[o] = e, Pe = (t, o) => {
55
- for (var e in o || (o = {}))
56
- je.call(o, e) && W(t, e, o[e]);
57
- if (U)
58
- for (var e of U(o))
59
- De.call(o, e) && W(t, e, o[e]);
60
- return t;
61
- }, Ee = (t, o) => Ie(t, Te(o));
62
- const Ae = /* @__PURE__ */ w({
95
+ const xe = /* @__PURE__ */ M({
63
96
  name: "UseDraggable",
64
97
  props: [
65
98
  "storageKey",
@@ -76,601 +109,529 @@ const Ae = /* @__PURE__ */ w({
76
109
  "onMove",
77
110
  "onEnd"
78
111
  ],
79
- setup(t, { slots: o }) {
80
- const e = g(), n = I(() => {
81
- var p;
82
- return (p = t.handle) != null ? p : e.value;
83
- }), l = t.storageKey && ge(
84
- t.storageKey,
85
- P(t.initialValue) || { x: 0, y: 0 },
86
- ye ? t.storageType === "session" ? sessionStorage : localStorage : void 0
87
- ), a = l || t.initialValue || { x: 0, y: 0 }, s = (p, x) => {
88
- var c;
89
- (c = t.onEnd) == null || c.call(t, p, x), l && (l.value.x = p.x, l.value.y = p.y);
90
- }, i = H(he(e, Ee(Pe({}, t), {
91
- handle: n,
92
- initialValue: a,
93
- onEnd: s
94
- })));
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);
124
+ }
125
+ }));
95
126
  return () => {
96
127
  if (o.default)
97
- return re(t.as || "div", { ref: e, style: `touch-action:none;${i.style}` }, o.default(i));
98
- };
99
- }
100
- });
101
- function N(t) {
102
- const o = window.getComputedStyle(t);
103
- if (o.overflowX === "scroll" || o.overflowY === "scroll" || o.overflowX === "auto" && t.clientWidth < t.scrollWidth || o.overflowY === "auto" && t.clientHeight < t.scrollHeight)
104
- return !0;
105
- {
106
- const e = t.parentNode;
107
- return !e || e.tagName === "BODY" ? !1 : N(e);
108
- }
109
- }
110
- function Le(t) {
111
- const o = t || window.event, e = o.target;
112
- return N(e) ? !1 : o.touches.length > 1 ? !0 : (o.preventDefault && o.preventDefault(), !1);
113
- }
114
- function Ve(t, o = !1) {
115
- const e = g(o);
116
- let n = null, l;
117
- T($e(t), (i) => {
118
- if (i) {
119
- const p = i;
120
- l = p.style.overflow, e.value && (p.style.overflow = "hidden");
121
- }
122
- }, {
123
- immediate: !0
124
- });
125
- const a = () => {
126
- const i = P(t);
127
- !i || e.value || (X && (n = Me(
128
- i,
129
- "touchmove",
130
- (p) => {
131
- Le(p);
132
- },
133
- { passive: !1 }
134
- )), i.style.overflow = "hidden", e.value = !0);
135
- }, s = () => {
136
- const i = P(t);
137
- !i || !e.value || (X && (n == null || n()), i.style.overflow = l, e.value = !1);
138
- };
139
- return Z(s), I({
140
- get() {
141
- return e.value;
142
- },
143
- set(i) {
144
- i ? a() : s();
145
- }
146
- });
147
- }
148
- function ze() {
149
- let t = !1;
150
- const o = g(!1);
151
- return (e, n) => {
152
- if (o.value = n.value, t)
153
- return;
154
- t = !0;
155
- const l = Ve(e, n.value);
156
- T(o, (a) => l.value = a);
157
- };
158
- }
159
- ze();
160
- const Re = Symbol("CONTROLS_CONTEXT_KEY"), y = H({});
161
- function Xe() {
162
- return ue(Re, y), y;
163
- }
164
- function V(t) {
165
- return Object.entries(t).map(([o, e]) => {
166
- let n = "string", l;
167
- const a = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
168
- return !L(e) && e.value || L(e) ? (n = typeof e.value, l = e.value) : (n = typeof e, l = e), n === "number" && (e.step || e.max || e.min) && (n = "range"), n === "string" && a.test(l) && (n = "color"), (l.isVector3 || l instanceof Array) && (n = "vector"), !L(e) && e.value ? {
169
- ...e,
170
- label: e.label || o,
171
- value: e.value,
172
- type: n,
173
- visible: !0
174
- } : {
175
- label: e.label || o,
176
- value: e,
177
- type: n,
178
- visible: !0
128
+ return ce(n.as || "div", { ref: t, style: `touch-action:none;${p.style}` }, o.default(p));
179
129
  };
180
- });
181
- }
182
- function Ue() {
183
- for (const t in y)
184
- delete y[t];
185
- }
186
- function Bt(t, o, e) {
187
- const n = g();
188
- if (typeof t == "string")
189
- t === "fpsgraph" ? (y[t] = {
190
- label: "fpsgraph",
191
- visible: !0,
192
- type: "fpsgraph"
193
- }, n.value = y[t]) : (y[t] = {
194
- label: t,
195
- visible: !0,
196
- type: "folder",
197
- controls: o ? V(o) : []
198
- }, n.value = y[t]);
199
- else if (typeof t == "object" && t.options)
200
- y[t.label || "Dropdown"] = {
201
- ...e,
202
- label: t.label || "Dropdown",
203
- visible: !0,
204
- value: t.value,
205
- type: "select",
206
- ref: t,
207
- options: t.options
208
- }, n.value = y[t.label || "Dropdown"];
209
- else if (typeof t == "object" && typeof o == "string")
210
- y[o] = {
211
- ...e,
212
- label: o,
213
- visible: !0,
214
- value: t[o],
215
- type: typeof t[o],
216
- ref: t
217
- }, n.value = y[o];
218
- else if (ie(t)) {
219
- const l = ce(t), a = V(l);
220
- for (const s of a)
221
- y[s.label] = s;
222
- n.value = a;
223
- } else {
224
- const l = V(t);
225
- for (const a of l)
226
- y[a.label] = a;
227
- n.value = l;
228
130
  }
229
- return fe(Ue), n;
230
- }
231
- const We = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Be = { class: "text-gray-500 w-1/3" }, Ke = ["value", "min", "max", "step"], Ye = /* @__PURE__ */ w({
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({
232
132
  __name: "NumberControl",
233
133
  props: {
234
134
  label: {},
235
135
  control: {}
236
136
  },
237
137
  emits: ["change"],
238
- setup(t, { emit: o }) {
239
- const e = t;
240
- function n(c) {
241
- const { target: r } = c;
242
- o("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);
243
143
  }
244
- const l = R(), a = g(0), s = g(!1), i = (c) => {
245
- a.value = c.clientX, s.value = !0;
246
- }, p = () => {
247
- s.value = !1;
248
- }, x = (c) => Math.floor(Math.abs(c) / 10);
249
- return T(l.x, (c) => {
250
- if (s.value) {
251
- const r = c - a.value, v = x(r);
252
- r > 0 ? o("change", e.control.value + 1 + v) : r < 0 && o("change", e.control.value - 1 + v), e.control.min !== void 0 && e.control.value < e.control.min && o("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && o("change", e.control.max), a.value = c;
144
+ const l = j(), u = v(0), a = v(!1), p = (r) => {
145
+ u.value = r.clientX, a.value = !0;
146
+ }, f = () => {
147
+ a.value = !1;
148
+ }, g = (r) => Math.floor(Math.abs(r) / 10);
149
+ return P(l.x, (r) => {
150
+ if (a.value) {
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;
253
153
  }
254
- }), (c, r) => (f(), d("div", We, [
255
- u("label", Be, m(c.label), 1),
256
- u("input", {
257
- value: c.control.value,
258
- class: M(["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": s.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 }]),
259
159
  type: "number",
260
- min: c.control.min,
261
- max: c.control.max,
262
- step: c.control.step,
263
- onInput: n,
264
- onMousedown: i,
265
- onMouseup: p
266
- }, null, 42, Ke)
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)
267
167
  ]));
268
168
  }
269
- }), He = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, Ge = { class: "text-gray-500 w-1/3" }, qe = ["value"], Je = /* @__PURE__ */ w({
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({
270
170
  __name: "TextControl",
271
171
  props: {
272
172
  label: {},
273
173
  control: {}
274
174
  },
275
175
  emits: ["change"],
276
- setup(t, { emit: o }) {
277
- function e(n) {
278
- o("change", n);
176
+ setup(n, { emit: o }) {
177
+ function t(e) {
178
+ const { target: l } = e;
179
+ o("change", l.value);
279
180
  }
280
- return (n, l) => (f(), d("div", He, [
281
- u("label", Ge, m(n.label), 1),
282
- u("input", {
283
- value: n.control.value,
284
- 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",
285
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",
286
- onChange: e
287
- }, null, 40, qe)
187
+ onChange: t
188
+ }, null, 40, Ie)
288
189
  ]));
289
190
  }
290
- }), Qe = { class: "flex px-4 justify-start gap-2 items-center mb-2 min-h-32px" }, Ze = { class: "text-gray-500 w-1/3" }, Oe = ["id", "checked"], Fe = ["for"], Ne = { class: "i-ic:baseline-check text-light" }, et = /* @__PURE__ */ w({
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({
291
192
  __name: "BooleanControl",
292
193
  props: {
293
194
  label: {},
294
195
  control: {}
295
196
  },
296
197
  emits: ["change"],
297
- setup(t, { emit: o }) {
298
- function e(n) {
299
- const { target: l } = n;
198
+ setup(n, { emit: o }) {
199
+ function t(e) {
200
+ const { target: l } = e;
300
201
  o("change", l.checked);
301
202
  }
302
- return (n, l) => (f(), d("div", Qe, [
303
- u("label", Ze, m(n.label), 1),
304
- u("input", {
305
- id: n.control.label,
306
- checked: n.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,
307
208
  class: "hidden",
308
209
  type: "checkbox",
309
- onInput: e
310
- }, null, 40, Oe),
311
- u("label", {
312
- for: n.control.label,
210
+ onInput: t
211
+ }, null, 40, Ee),
212
+ c("label", {
213
+ for: e.control.label,
313
214
  class: "inline-flex items-center cursor-pointer"
314
215
  }, [
315
- u("span", {
316
- class: M([{ "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"])
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"])
317
218
  }, [
318
- G(u("i", Ne, null, 512), [
319
- [q, n.control.value]
219
+ q(c("i", Ve, null, 512), [
220
+ [J, e.control.value]
320
221
  ])
321
222
  ], 2)
322
223
  ], 8, Fe)
323
224
  ]));
324
225
  }
325
- }), tt = { class: "px-4 relative flex justify-between gap-4 items-center mb-2" }, nt = ["value", "min", "max", "step"], ot = ["value", "min", "max", "step"], lt = /* @__PURE__ */ w({
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({
326
227
  __name: "SliderControl",
327
228
  props: {
328
229
  label: {},
329
230
  control: {}
330
231
  },
331
232
  emits: ["change"],
332
- setup(t, { emit: o }) {
333
- const e = t;
334
- function n(r) {
335
- const { target: v } = r;
336
- o("change", v.valueAsNumber);
233
+ setup(n, { emit: o }) {
234
+ const t = n;
235
+ function e(s) {
236
+ const { target: i } = s;
237
+ o("change", i.valueAsNumber);
337
238
  }
338
- const l = I(() => ({
339
- 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%)`
340
- })), a = R(), s = g(0), i = g(!1), p = (r) => {
341
- s.value = r.clientX, i.value = !0;
342
- }, x = () => {
343
- i.value = !1;
344
- }, c = (r) => Math.floor(Math.abs(r) / 10);
345
- return T(a.x, (r) => {
346
- if (i.value) {
347
- const v = r - s.value, C = c(v);
348
- v > 0 ? o("change", e.control.value + 1 + C) : v < 0 && o("change", e.control.value - 1 + C), e.control.min !== void 0 && e.control.value < e.control.min && o("change", e.control.min), e.control.max !== void 0 && e.control.value > e.control.max && o("change", e.control.max), s.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;
349
250
  }
350
- }), (r, v) => (f(), d("div", tt, [
351
- u("label", {
352
- class: M(["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 }])
353
254
  }, [
354
- pe(m(r.label) + " ", 1),
355
- u("i", {
356
- class: M(`i-${r.control.icon}`)
255
+ ue(k(s.label) + " ", 1),
256
+ c("i", {
257
+ class: I(`i-${s.control.icon}`)
357
258
  }, null, 2)
358
259
  ], 2),
359
- u("input", {
360
- value: r.control.value,
260
+ c("input", {
261
+ value: s.control.value,
361
262
  class: "w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",
362
- style: ve(l.value),
263
+ style: ie(l.value),
363
264
  type: "range",
364
- min: r.control.min,
365
- max: r.control.max,
366
- step: r.control.step,
367
- onInput: n
368
- }, null, 44, nt),
369
- u("input", {
370
- value: r.control.value,
371
- class: M(["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": i.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 }]),
372
273
  type: "number",
373
- min: r.control.min,
374
- max: r.control.max,
375
- step: r.control.step,
376
- onInput: n,
377
- onMousedown: p,
378
- onMouseup: x
379
- }, null, 42, ot)
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)
380
281
  ]));
381
282
  }
382
283
  });
383
- const at = (t, o) => {
384
- const e = t.__vccOpts || t;
385
- for (const [n, l] of o)
386
- e[n] = l;
387
- return e;
388
- }, st = /* @__PURE__ */ at(lt, [["__scopeId", "data-v-743fd350"]]), rt = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, ut = { class: "text-gray-500 w-1/3" }, it = ["value"], ct = ["value"], ft = /* @__PURE__ */ w({
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({
389
290
  __name: "ColorControl",
390
291
  props: {
391
292
  label: {},
392
293
  control: {}
393
294
  },
394
295
  emits: ["change"],
395
- setup(t, { emit: o }) {
396
- function e(n) {
397
- const { target: l } = n;
296
+ setup(n, { emit: o }) {
297
+ function t(e) {
298
+ const { target: l } = e;
398
299
  o("change", l.value);
399
300
  }
400
- return (n, l) => (f(), d("div", rt, [
401
- u("label", ut, m(n.label), 1),
402
- u("input", {
403
- value: n.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,
404
305
  type: "color",
405
- onInput: e
406
- }, null, 40, it),
407
- u("input", {
408
- value: n.control.value,
306
+ onInput: t
307
+ }, null, 40, Ke),
308
+ c("input", {
309
+ value: e.control.value,
409
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",
410
311
  type: "text",
411
- onInput: e
412
- }, null, 40, ct)
312
+ onInput: t
313
+ }, null, 40, Ye)
413
314
  ]));
414
315
  }
415
316
  });
416
- function pt(t) {
417
- if (typeof t == "number")
418
- return [t, t, t];
419
- if (ee(t)) {
420
- const { x: o, y: e, z: n } = t;
421
- return [o, e, n];
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];
422
323
  }
423
- return t;
324
+ return n;
424
325
  }
425
- function vt(t) {
426
- return t && typeof t.x == "number" && typeof t.y == "number" && typeof t.z > "u";
326
+ function Re(n) {
327
+ return n && typeof n.x == "number" && typeof n.y == "number" && typeof n.z > "u";
427
328
  }
428
- function ee(t) {
429
- return t && typeof t.x == "number" && typeof t.y == "number" && typeof t.z == "number";
329
+ function ne(n) {
330
+ return n && typeof n.x == "number" && typeof n.y == "number" && typeof n.z == "number";
430
331
  }
431
- const dt = { class: "flex px-4 justify-between gap-2 items-center mb-2" }, bt = { class: "text-gray-500 w-1/3" }, gt = { class: "w-2/3 flex justify-between gap-1" }, yt = {
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 = {
432
333
  key: 0,
433
- class: "font-bold px-0.5 py-1 text-0.65rem text-gray-300"
434
- }, ht = ["value", "onInput", "onMousedown", "onMouseup"], _t = /* @__PURE__ */ w({
334
+ class: "font-bold px-1 py-1 text-0.65rem text-gray-300"
335
+ }, Ze = ["value", "onInput", "onMousedown", "onMouseup"], en = /* @__PURE__ */ M({
435
336
  __name: "VectorControl",
436
337
  props: {
437
338
  label: {},
438
339
  control: {}
439
340
  },
440
341
  emits: ["change"],
441
- setup(t, { emit: o }) {
442
- const e = t, n = R(), l = g(0), a = g(!1), s = g(0), i = (h, $) => {
443
- s.value = $, l.value = h.clientX, a.value = !0;
444
- }, p = (h, $) => {
445
- s.value = $, a.value = !1;
446
- }, x = (h) => Math.floor(Math.abs(h) / 10), c = I(() => pt(e.control.value)), r = I(() => Object.keys(e.control.value)), v = I(() => vt(e.control.value) || ee(e.control.value));
447
- function C(h, $) {
448
- const { value: S } = e.control, { target: b } = h;
449
- s.value = $, S[v.value ? r.value[s.value] : s.value] = parseInt(b.value, 10), o("change", S);
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);
450
351
  }
451
- return T(n.x, (h) => {
452
- if (a.value) {
453
- const $ = h - l.value, S = x($), { value: b } = e.control, k = v.value ? r.value[s.value] : s.value;
454
- $ > 0 ? b[k] += 1 + S : $ < 0 && (b[k] -= 1 + S), e.control.min !== void 0 && b < e.control.min && (b[k] = e.control.min), e.control.max !== void 0 && b > e.control.max && (b[k] = e.control.max), o("change", b), l.value = h;
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 = _;
455
356
  }
456
- }), (h, $) => (f(), d("div", dt, [
457
- u("label", bt, m(h.label), 1),
458
- u("div", gt, [
459
- (f(!0), d(E, null, A(c.value, (S, b) => (f(), d("div", {
460
- key: h.label + b,
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,
461
362
  class: "flex items-center w-1/3 bg-gray-100 rounded"
462
363
  }, [
463
- r.value[b] && v.value ? (f(), d("span", yt, m(r.value[b]), 1)) : J("", !0),
464
- u("input", {
364
+ s.value[b] && i.value ? (d(), m("span", Qe, k(s.value[b]), 1)) : L("", !0),
365
+ c("input", {
465
366
  type: "text",
466
- class: M(["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": a.value }]),
467
- value: c.value[b].toFixed(2),
468
- onInput: (k) => C(k, b),
469
- onMousedown: (k) => i(k, b),
470
- onMouseup: (k) => p(k, b)
471
- }, null, 42, ht)
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)
472
373
  ]))), 128))
473
374
  ])
474
375
  ]));
475
376
  }
476
- }), mt = { class: "mb-4" }, wt = { class: "bg-white rounded-b pt-4" }, xt = /* @__PURE__ */ w({
477
- __name: "Folder",
478
- props: {
479
- control: {}
480
- },
481
- setup(t) {
482
- function o(l, a) {
483
- a.value = l;
484
- }
485
- const e = g(!1), n = () => {
486
- e.value = !e.value;
487
- };
488
- return (l, a) => (f(), d("div", mt, [
489
- u("button", {
490
- 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",
491
- onClick: n
492
- }, [
493
- u("span", null, m(l.control.label), 1),
494
- u("i", {
495
- class: M(e.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
496
- }, null, 2)
497
- ]),
498
- de(be, {
499
- name: "slide",
500
- "enter-active-class": " animate-fade-in animate-duration-200 animate-ease-in-out",
501
- "leave-active-class": " animate-fade-out animate-duration-200 animate-ease-in-out"
502
- }, {
503
- default: Q(() => [
504
- G(u("div", wt, [
505
- (f(!0), d(E, null, A(l.control.controls, (s) => (f(), _(te, {
506
- key: s.label,
507
- control: s,
508
- onChange: (i) => o(i, s)
509
- }, null, 8, ["control", "onChange"]))), 128))
510
- ], 512), [
511
- [q, e.value]
512
- ])
513
- ]),
514
- _: 1
515
- })
516
- ]));
517
- }
518
- }), $t = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, kt = { class: "text-gray-500 w-1/3" }, Ct = { 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" }, Mt = { class: "absolute bottom-0.5 right-0.5 font-sans text-xs" }, St = ["points"], B = 160, z = 40, j = 2, K = 100, Y = 20, It = /* @__PURE__ */ w({
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({
519
378
  __name: "FPSGraph",
520
379
  props: {
521
380
  label: {},
522
381
  control: {}
523
382
  },
524
- setup(t) {
525
- const o = _e({ every: K }), e = g(""), n = g([]), l = g(B / j);
526
- let a = performance.now();
527
- return me(({ timestamp: s }) => {
528
- s - a >= K && (a = s, n.value.push(o.value), n.value.length > l.value && n.value.shift(), e.value = n.value.map(
529
- (i, p) => `${p * j},${z + Y - j / 2 - i * (z + Y - j) / 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}`
530
389
  ).join(" "));
531
- }), (s, i) => (f(), d("div", $t, [
532
- u("label", kt, m(s.label), 1),
533
- u("div", Ct, [
534
- u("div", Mt, m(Math.round(D(o))) + " FPS", 1),
535
- (f(), d("svg", {
536
- width: B,
537
- height: z,
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,
538
397
  xmlns: "http://www.w3.org/2000/svg",
539
398
  class: "bg-gray-100"
540
399
  }, [
541
- u("polyline", {
542
- points: e.value,
400
+ c("polyline", {
401
+ points: t.value,
543
402
  fill: "none",
544
403
  stroke: "lightgray",
545
- "stroke-width": j,
404
+ "stroke-width": z,
546
405
  "stroke-linecap": "round",
547
406
  "stroke-linejoin": "round"
548
- }, null, 8, St)
407
+ }, null, 8, rn)
549
408
  ]))
550
409
  ])
551
410
  ]));
552
411
  }
553
- }), Tt = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, jt = { class: "text-gray-500 w-1/3" }, Dt = ["value"], Pt = ["value"], Et = /* @__PURE__ */ w({
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({
554
413
  __name: "SelectControl",
555
414
  props: {
556
415
  label: {},
557
416
  control: {}
558
417
  },
559
418
  emits: ["change"],
560
- setup(t, { emit: o }) {
561
- function e(n) {
562
- o("change", n.target.value);
419
+ setup(n, { emit: o }) {
420
+ function t(e) {
421
+ o("change", e.target.value);
563
422
  }
564
- return (n, l) => (f(), d("div", Tt, [
565
- u("label", jt, m(n.label), 1),
566
- u("select", {
567
- value: n.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,
568
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",
569
- onChange: e
428
+ onChange: t
570
429
  }, [
571
- (f(!0), d(E, null, A(n.control.options, (a) => (f(), d("option", {
572
- key: a.value,
573
- value: a.value
574
- }, m(a.text), 9, Pt))), 128))
575
- ], 40, Dt)
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)
576
435
  ]));
577
436
  }
578
- }), te = /* @__PURE__ */ w({
437
+ }), te = /* @__PURE__ */ M({
579
438
  __name: "ControlInput",
580
439
  props: {
581
440
  control: {}
582
441
  },
583
442
  emits: ["change"],
584
- setup(t, { emit: o }) {
585
- function e(n) {
586
- o("change", n);
443
+ setup(n, { emit: o }) {
444
+ function t(e) {
445
+ o("change", e);
587
446
  }
588
- return (n, l) => n.control.visible ? (f(), d(E, { key: 0 }, [
589
- n.control.type === "color" ? (f(), _(ft, {
447
+ return (e, l) => e.control.visible ? (d(), m(S, { key: 0 }, [
448
+ e.control.type === "color" ? (d(), C(je, {
590
449
  key: 0,
591
- label: n.control.label,
592
- control: n.control,
593
- onChange: e
594
- }, null, 8, ["label", "control"])) : n.control.type === "vector" ? (f(), _(_t, {
450
+ label: e.control.label,
451
+ control: e.control,
452
+ onChange: t
453
+ }, null, 8, ["label", "control"])) : e.control.type === "select" ? (d(), C(dn, {
595
454
  key: 1,
596
- label: n.control.label,
597
- control: n.control,
598
- onChange: e
599
- }, null, 8, ["label", "control"])) : n.control.type === "boolean" ? (f(), _(et, {
455
+ label: e.control.label,
456
+ control: e.control,
457
+ onChange: t
458
+ }, null, 8, ["label", "control"])) : e.control.type === "vector" ? (d(), C(en, {
600
459
  key: 2,
601
- label: n.control.label,
602
- control: n.control,
603
- onChange: e
604
- }, null, 8, ["label", "control"])) : n.control.type === "fpsgraph" ? (f(), _(It, {
460
+ label: e.control.label,
461
+ control: e.control,
462
+ onChange: t
463
+ }, null, 8, ["label", "control"])) : e.control.type === "boolean" ? (d(), C(ze, {
605
464
  key: 3,
606
- label: n.control.label,
607
- control: n.control
608
- }, null, 8, ["label", "control"])) : n.control.type === "folder" ? (f(), _(xt, {
465
+ label: e.control.label,
466
+ control: e.control,
467
+ onChange: t
468
+ }, null, 8, ["label", "control"])) : e.control.type === "fpsgraph" ? (d(), C(sn, {
609
469
  key: 4,
610
- label: n.control.label,
611
- control: n.control
612
- }, null, 8, ["label", "control"])) : n.control.type === "number" ? (f(), _(Ye, {
470
+ label: e.control.label,
471
+ control: e.control
472
+ }, null, 8, ["label", "control"])) : e.control.type === "number" ? (d(), C(ke, {
613
473
  key: 5,
614
- label: n.control.label,
615
- control: n.control,
616
- onChange: e
617
- }, null, 8, ["label", "control"])) : n.control.type === "range" ? (f(), _(st, {
474
+ label: e.control.label,
475
+ control: e.control,
476
+ onChange: t
477
+ }, null, 8, ["label", "control"])) : e.control.type === "range" ? (d(), C(Ne, {
618
478
  key: 6,
619
- label: n.control.label,
620
- control: n.control,
621
- onChange: e
622
- }, null, 8, ["label", "control"])) : n.control.type === "select" ? (f(), _(Et, {
479
+ label: e.control.label,
480
+ control: e.control,
481
+ onChange: t
482
+ }, null, 8, ["label", "control"])) : (d(), C(Se, {
623
483
  key: 7,
624
- label: n.control.label,
625
- control: n.control,
626
- onChange: e
627
- }, null, 8, ["label", "control"])) : (f(), _(Je, {
628
- key: 8,
629
- label: n.control.label,
630
- control: n.control,
631
- onChange: e
484
+ label: e.control.label,
485
+ control: e.control,
486
+ onChange: t
632
487
  }, null, 8, ["label", "control"]))
633
- ], 64)) : J("", !0);
488
+ ], 64)) : L("", !0);
634
489
  }
635
- }), At = { class: "bg-white shadow-xl rounded border-4 border-solid border-black" }, Lt = /* @__PURE__ */ u("i", { class: "h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs" }, "🍰", -1), Vt = /* @__PURE__ */ u("div", null, [
636
- /* @__PURE__ */ u("i", { class: "i-ic-baseline-drag-indicator" }),
637
- /* @__PURE__ */ u("i", { class: "i-ic-baseline-drag-indicator" }),
638
- /* @__PURE__ */ u("i", { class: "i-ic-baseline-drag-indicator" })
639
- ], -1), zt = /* @__PURE__ */ u("div", null, null, -1), Rt = [
640
- Lt,
641
- Vt,
642
- zt
643
- ], Xt = 280, Kt = /* @__PURE__ */ w({
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
+ ]));
532
+ }
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({
644
585
  __name: "TresLeches",
645
- setup(t) {
646
- const { width: o } = we(), e = g(null), n = Xe();
647
- function l(a, s) {
648
- s.ref && (s.ref[s.label] = a), s.value = a;
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;
649
593
  }
650
- return (a, s) => (f(), _(D(Ae), {
651
- "initial-value": { x: D(o) - Xt - 20, y: 10 },
652
- class: M(["absolute select-none z-24 w-280px font-sans text-xs", a.$attrs.class]),
653
- 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
654
607
  }, {
655
608
  default: Q(() => [
656
- u("div", At, [
657
- u("header", {
609
+ c("div", bn, [
610
+ c("header", {
658
611
  ref_key: "handle",
659
- ref: e,
612
+ ref: l,
660
613
  class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
661
- }, Rt, 512),
662
- (f(!0), d(E, null, A(D(n), (i) => (f(), _(te, {
663
- key: i.label,
664
- control: i,
665
- onChange: (p) => l(p, i)
666
- }, 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))
667
627
  ])
668
628
  ]),
669
629
  _: 1
670
- }, 8, ["initial-value", "class", "handle"]));
630
+ }, 8, ["id", "initial-value", "class", "handle"]));
671
631
  }
672
632
  });
673
633
  export {
674
- Kt as TresLeches,
675
- Bt as useControls
634
+ Tn as TresLeches,
635
+ Mn as useControls,
636
+ yn as useControlsProvider
676
637
  };