@tresjs/leches 0.13.0 → 0.14.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,99 +1,100 @@
1
1
  /**
2
2
  * name: @tresjs/leches
3
- * version: v0.13.0
3
+ * version: v0.14.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 K, isRef as R, toRefs as X, customRef as pe, ref as f, watch as U, computed as O, defineComponent as M, reactive as j, h as fe, provide as ve, isReactive as ge, openBlock as p, createElementBlock as x, createElementVNode as d, toDisplayString as k, normalizeClass as D, withDirectives as ae, vShow as re, createTextVNode as ye, normalizeStyle as be, Fragment as z, renderList as N, createCommentVNode as Y, createBlock as C, createVNode as he, Transition as me, withCtx as se } from "vue";
9
- import { useWindowSize as ie, useEventListener as H, useStorage as _e, isClient as xe, useMouse as ee, useMousePressed as we, useKeyModifier as te, useFps as $e, useRafFn as Ce } from "@vueuse/core";
8
+ import { unref as K, isRef as G, toRefs as B, customRef as gt, ref as d, watch as O, computed as z, defineComponent as k, reactive as N, h as mt, provide as yt, isReactive as ht, openBlock as p, createElementBlock as h, normalizeClass as M, Fragment as V, createTextVNode as st, toDisplayString as F, createVNode as X, createElementVNode as f, withDirectives as ct, vShow as it, normalizeStyle as _t, renderList as j, createCommentVNode as H, createBlock as C, Transition as wt, withCtx as ut } from "vue";
9
+ import { useWindowSize as pt, useEventListener as J, useStorage as xt, isClient as $t, useMouse as lt, useMousePressed as kt, useKeyModifier as nt, useFps as Ct, useRafFn as Mt } from "@vueuse/core";
10
10
  function E(e) {
11
11
  return typeof e == "function" ? e() : K(e);
12
12
  }
13
- const ce = typeof window < "u" && typeof document < "u";
14
- function ke(e, s = {}) {
15
- if (!R(e))
16
- return X(e);
17
- const n = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
18
- for (const o in e.value)
19
- n[o] = pe(() => ({
13
+ const dt = typeof window < "u" && typeof document < "u";
14
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
15
+ function St(e, o = {}) {
16
+ if (!G(e))
17
+ return B(e);
18
+ const l = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
19
+ for (const n in e.value)
20
+ l[n] = gt(() => ({
20
21
  get() {
21
- return e.value[o];
22
+ return e.value[n];
22
23
  },
23
24
  set(t) {
24
- var u;
25
- if ((u = E(s.replaceRef)) != null ? u : !0)
25
+ var i;
26
+ if ((i = E(o.replaceRef)) != null ? i : !0)
26
27
  if (Array.isArray(e.value)) {
27
- const i = [...e.value];
28
- i[o] = t, e.value = i;
28
+ const c = [...e.value];
29
+ c[n] = t, e.value = c;
29
30
  } else {
30
- const i = { ...e.value, [o]: t };
31
- Object.setPrototypeOf(i, Object.getPrototypeOf(e.value)), e.value = i;
31
+ const c = { ...e.value, [n]: t };
32
+ Object.setPrototypeOf(c, Object.getPrototypeOf(e.value)), e.value = c;
32
33
  }
33
34
  else
34
- e.value[o] = t;
35
+ e.value[n] = t;
35
36
  }
36
37
  }));
37
- return n;
38
+ return l;
38
39
  }
39
- const Me = ce ? window : void 0;
40
- function Se(e, s = {}) {
40
+ const Tt = dt ? window : void 0;
41
+ function At(e, o = {}) {
41
42
  const {
42
- pointerTypes: n,
43
- preventDefault: o,
43
+ pointerTypes: l,
44
+ preventDefault: n,
44
45
  stopPropagation: t,
45
- exact: u,
46
- onMove: a,
47
- onEnd: i,
48
- onStart: c,
49
- initialValue: m,
50
- axis: h = "both",
51
- draggingElement: r = Me,
52
- handle: l = e
53
- } = s, { width: b } = ie();
54
- let S = b.value;
55
- const v = f(
56
- E(m) ?? { x: 0, y: 0 }
46
+ exact: i,
47
+ onMove: r,
48
+ onEnd: c,
49
+ onStart: u,
50
+ initialValue: _,
51
+ axis: y = "both",
52
+ draggingElement: s = Tt,
53
+ handle: a = e
54
+ } = o, { width: m } = pt();
55
+ let S = m.value;
56
+ const v = d(
57
+ E(_) ?? { x: 0, y: 0 }
57
58
  );
58
- U(b, () => {
59
- const g = b.value - S;
60
- v.value.x += g, S = b.value;
59
+ O(m, () => {
60
+ const g = m.value - S;
61
+ v.value.x += g, S = m.value;
61
62
  });
62
- const T = f(), F = (g) => n ? n.includes(g.pointerType) : !0, $ = (g) => {
63
- E(o) && g.preventDefault(), E(t) && g.stopPropagation();
63
+ const T = d(), D = (g) => l ? l.includes(g.pointerType) : !0, $ = (g) => {
64
+ E(n) && g.preventDefault(), E(t) && g.stopPropagation();
64
65
  }, A = (g) => {
65
- if (!F(g) || E(u) && g.target !== E(e))
66
+ if (!D(g) || E(i) && g.target !== E(e))
66
67
  return;
67
- const y = E(e).getBoundingClientRect(), w = {
68
- x: g.clientX - y.left,
69
- y: g.clientY - y.top
68
+ const b = E(e).getBoundingClientRect(), x = {
69
+ x: g.clientX - b.left,
70
+ y: g.clientY - b.top
70
71
  };
71
- (c == null ? void 0 : c(w, g)) !== !1 && (T.value = w, $(g));
72
- }, V = (g) => {
73
- if (!F(g) || !T.value)
72
+ (u == null ? void 0 : u(x, g)) !== !1 && (T.value = x, $(g));
73
+ }, q = (g) => {
74
+ if (!D(g) || !T.value)
74
75
  return;
75
- let { x: y, y: w } = v.value;
76
- (h === "x" || h === "both") && (y = g.clientX - T.value.x), (h === "y" || h === "both") && (w = g.clientY - T.value.y), v.value = {
77
- x: y,
78
- y: w
79
- }, a == null || a(v.value, g), $(g);
80
- }, L = (g) => {
81
- F(g) && T.value && (T.value = void 0, i == null || i(v.value, g), $(g));
76
+ let { x: b, y: x } = v.value;
77
+ (y === "x" || y === "both") && (b = g.clientX - T.value.x), (y === "y" || y === "both") && (x = g.clientY - T.value.y), v.value = {
78
+ x: b,
79
+ y: x
80
+ }, r == null || r(v.value, g), $(g);
81
+ }, P = (g) => {
82
+ D(g) && T.value && (T.value = void 0, c == null || c(v.value, g), $(g));
82
83
  };
83
- if (ce) {
84
- const g = { capture: s.capture ?? !0 };
85
- H(l, "pointerdown", A, g), H(r, "pointermove", V, g), H(r, "pointerup", L, g);
84
+ if (dt) {
85
+ const g = { capture: o.capture ?? !0 };
86
+ J(a, "pointerdown", A, g), J(s, "pointermove", q, g), J(s, "pointerup", P, g);
86
87
  }
87
88
  return {
88
- ...ke(v),
89
+ ...St(v),
89
90
  position: v,
90
- isDragging: O(() => !!T.value),
91
- style: O(
91
+ isDragging: z(() => !!T.value),
92
+ style: z(
92
93
  () => `left:${v.value.x}px;top:${v.value.y}px;`
93
94
  )
94
95
  };
95
96
  }
96
- const Te = /* @__PURE__ */ M({
97
+ const It = /* @__PURE__ */ k({
97
98
  name: "UseDraggable",
98
99
  props: [
99
100
  "storageKey",
@@ -110,597 +111,651 @@ const Te = /* @__PURE__ */ M({
110
111
  "onMove",
111
112
  "onEnd"
112
113
  ],
113
- setup(e, { slots: s }) {
114
- const n = f(), o = O(() => e.handle ?? n.value), t = e.storageKey && _e(
114
+ setup(e, { slots: o }) {
115
+ const l = d(), n = z(() => e.handle ?? l.value), t = e.storageKey && xt(
115
116
  e.storageKey,
116
117
  E(e.initialValue) || { x: 0, y: 0 },
117
- xe ? e.storageType === "session" ? sessionStorage : localStorage : void 0
118
- ), u = t || e.initialValue || { x: 0, y: 0 }, i = j(Se(n, {
118
+ $t ? e.storageType === "session" ? sessionStorage : localStorage : void 0
119
+ ), i = t || e.initialValue || { x: 0, y: 0 }, c = N(At(l, {
119
120
  ...e,
120
- handle: o,
121
- initialValue: u,
122
- onEnd: (c, m) => {
123
- var h;
124
- (h = e.onEnd) == null || h.call(e, c, m), t && (t.value.x = c.x, t.value.y = c.y);
121
+ handle: n,
122
+ initialValue: i,
123
+ onEnd: (u, _) => {
124
+ var y;
125
+ (y = e.onEnd) == null || y.call(e, u, _), t && (t.value.x = u.x, t.value.y = u.y);
125
126
  }
126
127
  }));
127
128
  return () => {
128
- if (s.default)
129
- return fe(e.as || "div", { ref: n, style: `touch-action:none;${i.style}` }, s.default(i));
129
+ if (o.default)
130
+ return mt(e.as || "div", { ref: l, style: `touch-action:none;${c.style}` }, o.default(c));
130
131
  };
131
132
  }
132
- }), Ae = Symbol("CONTROLS_CONTEXT_KEY"), ue = "default", P = j({});
133
- function Ie(e = ue) {
134
- return ve(Ae, P), P[e];
133
+ }), Kt = Symbol("CONTROLS_CONTEXT_KEY"), ft = "default", L = N({});
134
+ function Dt(e = ft) {
135
+ return yt(Kt, L), L[e];
135
136
  }
136
- const G = (e) => {
137
- const s = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
138
- return typeof e == "boolean" ? "boolean" : typeof e == "number" ? "number" : typeof e == "string" && s.test(e) ? "color" : typeof e == "string" ? "string" : e.isVector3 || e.isVector2 || e.isEuler || e instanceof Array ? "vector" : e.min !== void 0 || e.max !== void 0 || e.step !== void 0 ? "range" : e.options && Array.isArray(e.options) ? "select" : "unknown";
139
- }, W = (e, s, n, o) => {
137
+ const Q = (e) => {
138
+ const o = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$|^0x([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
139
+ return typeof e == "boolean" ? "boolean" : typeof e == "number" ? "number" : typeof e == "string" && o.test(e) ? "color" : typeof e == "string" ? "string" : e.isVector3 || e.isVector2 || e.isEuler || e.value instanceof Array || e.value.isVector3 || e.value.isVector2 || e.value.isEuler || e.value.value instanceof Array ? "vector" : e.min !== void 0 || e.max !== void 0 || e.step !== void 0 ? "range" : e.options && Array.isArray(e.options) ? "select" : "unknown";
140
+ }, Y = (e, o, l, n) => {
140
141
  const t = {
141
- key: f(e),
142
- label: f(e),
143
- name: f(e),
144
- type: f(n),
145
- value: f(s),
146
- visible: f(!0),
147
- [e]: f(s)
142
+ key: d(e),
143
+ label: d(e),
144
+ name: d(e),
145
+ type: d(l),
146
+ value: d(o),
147
+ visible: d(!0),
148
+ icon: d(),
149
+ uniqueKey: d(e),
150
+ [e]: d(o)
148
151
  };
149
- return o && (t.folder = f(o)), t;
150
- }, Dt = (e, s, n) => {
151
- const o = {}, t = typeof e == "string" ? e : null, u = t ? s : e, a = t && t !== "fpsgraph" ? n : s, i = (a == null ? void 0 : a.uuid) || ue;
152
- if (P[i] || (P[i] = j({})), e === "fpsgraph") {
153
- const r = W("fpsgraph", null, "fpsgraph", null);
154
- return P[i].fpsgraph = r, o.fpsgraph = r, X(j(o));
152
+ return n && (t.folder = d(n)), t;
153
+ }, De = (e, o, l) => {
154
+ const n = {}, t = typeof e == "string" ? e : null, i = t ? o : e, r = t && t !== "fpsgraph" ? l : o, c = (r == null ? void 0 : r.uuid) || ft;
155
+ if (L[c] || (L[c] = N({})), e === "fpsgraph") {
156
+ const s = Y("fpsgraph", null, "fpsgraph", null);
157
+ return L[c].fpsgraph = s, n.fpsgraph = s, B(N(n));
155
158
  }
156
- const c = P[i], m = ge(u), h = m ? X(u) : {};
157
- for (const r in u) {
158
- let l = u[r], b = r;
159
- if (m && h[r] && (l = h[r]), t && (b = `${t}${r.charAt(0).toUpperCase() + r.slice(1)}`), typeof l == "object" && !R(l) && !Array.isArray(l) && l.value !== void 0) {
160
- const v = l, T = R(v.value) ? v.value : f(v.value), F = G(v), $ = W(r, T, F, t);
161
- F === "select" && ($.options = f(v.options.map((A) => typeof A == "object" && A.text && A.value ? A : {
159
+ const u = L[c], _ = ht(i), y = _ ? B(i) : {};
160
+ for (const s in i) {
161
+ let a = i[s], m = s;
162
+ if (_ && y[s] && (a = y[s]), t && (m = `${t}${s.charAt(0).toUpperCase() + s.slice(1)}`), typeof a == "object" && !G(a) && !Array.isArray(a) && a.value !== void 0) {
163
+ const v = a, T = G(v.value) ? v.value : d(v.value), D = v.type || Q(v), $ = Y(s, T, D, t);
164
+ D === "select" && ($.options = d(v.options.map((A) => typeof A == "object" && A.text && A.value ? A : {
162
165
  text: A,
163
166
  value: A
164
- }))), F === "range" && ($.min = f(v.min || 0), $.max = f(v.max || 1), $.step = f(v.step || 0.1)), $.label.value = v.label || r, $.visible.value = v.visible !== void 0 ? v.visible : !0, c[b] = $, o[b] = $;
167
+ }))), D === "range" && ($.min = d(v.min || 0), $.max = d(v.max || 1), $.step = d(v.step || 0.1)), $.label.value = v.label || s, $.icon.value = v.icon, $.visible.value = v.visible !== void 0 ? v.visible : !0, $.uniqueKey.value = m, u[m] = $, n[m] = $;
165
168
  continue;
166
169
  }
167
- if (R(l)) {
168
- const v = W(r, l, G(l.value), t);
169
- c[b] = v, o[b] = v;
170
+ if (G(a)) {
171
+ const v = Y(s, a, a.value.type || Q(a.value), t);
172
+ u[m] = v, n[m] = v;
170
173
  continue;
171
- } else if (typeof l == "object" && !Array.isArray(l)) {
172
- const v = X(l);
173
- v[r] && (l = v[r]);
174
+ } else if (typeof a == "object" && !Array.isArray(a)) {
175
+ const v = B(a);
176
+ v[s] && (a = v[s]);
174
177
  }
175
- const S = W(r, l, G(l), t);
176
- c[b] = S, o[b] = S, S.uniqueKey = b;
178
+ const S = Y(s, a, a.type || Q(a), t);
179
+ u[m] = S, n[m] = S, S.uniqueKey.value = m;
177
180
  }
178
- return Object.keys(o).length > 1 ? X(j(o)) : Object.values(o)[0];
179
- }, Ke = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, De = ["for"], Fe = ["id", "value", "min", "max", "step"], Ee = /* @__PURE__ */ M({
181
+ return Object.keys(n).length > 1 ? B(N(n)) : Object.values(n)[0];
182
+ }, Ft = ["for", "title"], R = /* @__PURE__ */ k({
183
+ __name: "ControlLabel",
184
+ props: {
185
+ label: {},
186
+ control: {}
187
+ },
188
+ setup(e) {
189
+ return (o, l) => (p(), h("label", {
190
+ for: o.control.uniqueKey,
191
+ title: o.label,
192
+ class: "tl-text-gray-500 tl-w-1/3 tl-truncate"
193
+ }, [
194
+ o.control.icon ? (p(), h("i", {
195
+ key: 0,
196
+ class: M(o.control.icon)
197
+ }, null, 2)) : (p(), h(V, { key: 1 }, [
198
+ st(F(o.label), 1)
199
+ ], 64))
200
+ ], 8, Ft));
201
+ }
202
+ }), Et = { class: "tl-flex tl-px-4 tl-justify-between tl-gap-4 tl-items-center tl-mb-2" }, Vt = ["id", "value", "min", "max", "step"], zt = /* @__PURE__ */ k({
180
203
  __name: "NumberControl",
181
204
  props: {
182
205
  label: {},
183
206
  control: {}
184
207
  },
185
208
  emits: ["change"],
186
- setup(e, { emit: s }) {
187
- const n = e, o = s;
188
- function t(r) {
189
- const { target: l } = r;
190
- o("change", l.valueAsNumber);
209
+ setup(e, { emit: o }) {
210
+ const l = e, n = o;
211
+ function t(s) {
212
+ const { target: a } = s;
213
+ n("change", a.valueAsNumber);
191
214
  }
192
- const u = ee(), a = f(0), i = f(!1), c = (r) => {
193
- a.value = r.clientX, i.value = !0;
194
- }, m = () => {
195
- i.value = !1;
196
- }, h = (r) => Math.floor(Math.abs(r) / 10);
197
- return U(u.x, (r) => {
198
- if (i.value) {
199
- const l = r - a.value, b = h(l);
200
- l > 0 ? o("change", n.control.value + 1 + b) : l < 0 && o("change", n.control.value - 1 + b), n.control.min !== void 0 && n.control.value < n.control.min && o("change", n.control.min), n.control.max !== void 0 && n.control.value > n.control.max && o("change", n.control.max), a.value = r;
215
+ const i = lt(), r = d(0), c = d(!1), u = (s) => {
216
+ r.value = s.clientX, c.value = !0;
217
+ }, _ = () => {
218
+ c.value = !1;
219
+ }, y = (s) => Math.floor(Math.abs(s) / 10);
220
+ return O(i.x, (s) => {
221
+ if (c.value) {
222
+ const a = s - r.value, m = y(a);
223
+ a > 0 ? n("change", l.control.value + 1 + m) : a < 0 && n("change", l.control.value - 1 + m), l.control.min !== void 0 && l.control.value < l.control.min && n("change", l.control.min), l.control.max !== void 0 && l.control.value > l.control.max && n("change", l.control.max), r.value = s;
201
224
  }
202
- }), (r, l) => (p(), x("div", Ke, [
203
- d("label", {
204
- class: "text-gray-500 w-1/3",
205
- for: r.control.uniqueKey
206
- }, k(r.label), 9, De),
207
- d("input", {
208
- id: r.control.uniqueKey,
209
- value: r.control.value,
210
- class: D(["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": i.value }]),
225
+ }), (s, a) => (p(), h("div", Et, [
226
+ X(R, {
227
+ label: s.label,
228
+ control: s.control
229
+ }, null, 8, ["label", "control"]),
230
+ f("input", {
231
+ id: s.control.uniqueKey,
232
+ value: s.control.value,
233
+ class: M(["tl-p-2 tl-w-1/3 tl-rounded tl-text-right tl-text-xs tl-text-gray-400 tl-bg-gray-100 tl-focus:border-gray-200 tl-outline-none tl-border-none tl-font-sans", { "tl-cursor-ew-resize": c.value }]),
211
234
  type: "number",
212
- min: r.control.min,
213
- max: r.control.max,
214
- step: r.control.step,
235
+ min: s.control.min,
236
+ max: s.control.max,
237
+ step: s.control.step,
215
238
  onInput: t,
216
- onMousedown: c,
217
- onMouseup: m
218
- }, null, 42, Fe)
239
+ onMousedown: u,
240
+ onMouseup: _
241
+ }, null, 42, Vt)
219
242
  ]));
220
243
  }
221
- }), Ve = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, qe = ["for"], Ue = ["id", "value", "aria-label"], ze = /* @__PURE__ */ M({
244
+ }), qt = { class: "tl-flex tl-px-4 tl-justify-between tl-gap-4 tl-items-center tl-mb-2 tl-min-h-32px" }, Ut = ["id", "value", "aria-label"], Ot = /* @__PURE__ */ k({
222
245
  __name: "TextControl",
223
246
  props: {
224
247
  label: {},
225
248
  control: {}
226
249
  },
227
250
  emits: ["change"],
228
- setup(e, { emit: s }) {
229
- const n = s;
230
- function o(t) {
231
- const { target: u } = t;
232
- n("change", u.value);
251
+ setup(e, { emit: o }) {
252
+ const l = o;
253
+ function n(t) {
254
+ const { target: i } = t;
255
+ l("change", i.value);
233
256
  }
234
- return (t, u) => (p(), x("div", Ve, [
235
- d("label", {
236
- for: t.control.uniqueKey,
237
- class: "text-gray-500 w-1/3"
238
- }, k(t.label), 9, qe),
239
- d("input", {
257
+ return (t, i) => (p(), h("div", qt, [
258
+ X(R, {
259
+ label: t.label,
260
+ control: t.control
261
+ }, null, 8, ["label", "control"]),
262
+ f("input", {
240
263
  id: t.control.uniqueKey,
241
264
  value: t.control.value,
242
265
  type: "text",
243
266
  tabindex: "0",
244
- class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 focus:border-gray-200 border-none font-sans",
267
+ class: "tl-p-2 tl-w-2/3 tl-rounded tl-text-right tl-text-xs tl-text-gray-400 tl-bg-gray-100 focus:tl-border-gray-200 tl-border-none tl-font-sans",
245
268
  "aria-label": t.label,
246
269
  placeholder: "Enter value here...",
247
- onChange: o
248
- }, null, 40, Ue)
270
+ onChange: n
271
+ }, null, 40, Ut)
249
272
  ]));
250
273
  }
251
- }), Oe = { class: "flex px-4 justify-start gap-2 items-center mb-2 min-h-32px" }, Xe = { class: "text-gray-500 w-1/3" }, Pe = ["id", "checked"], Le = ["for"], Be = ["aria-checked"], je = { class: "i-ic:baseline-check text-light" }, Ne = /* @__PURE__ */ M({
274
+ }), Xt = { class: "tl-flex tl-px-4 tl-justify-start tl-gap-2 tl-items-center tl-mb-2 tl-min-h-32px" }, Bt = { class: "tl-text-gray-500 tl-w-1/3" }, Lt = ["id", "checked"], Pt = ["for"], Wt = ["aria-checked"], Nt = { class: "i-ic:baseline-check tl-text-light" }, jt = /* @__PURE__ */ k({
252
275
  __name: "BooleanControl",
253
276
  props: {
254
277
  label: {},
255
278
  control: {}
256
279
  },
257
280
  emits: ["change"],
258
- setup(e, { emit: s }) {
259
- const n = e, o = s;
260
- function t(a) {
261
- const { target: i } = a;
262
- o("change", i.checked);
281
+ setup(e, { emit: o }) {
282
+ const l = e, n = o;
283
+ function t(r) {
284
+ const { target: c } = r;
285
+ n("change", c.checked);
263
286
  }
264
- function u(a) {
265
- (a.code === "Space" || a.code === "Enter") && (a.preventDefault(), o("change", !n.control.value));
287
+ function i(r) {
288
+ (r.code === "Space" || r.code === "Enter") && (r.preventDefault(), n("change", !l.control.value));
266
289
  }
267
- return (a, i) => (p(), x("div", Oe, [
268
- d("label", Xe, k(a.label), 1),
269
- d("input", {
270
- id: a.control.uniqueKey,
271
- checked: a.control.value,
272
- class: "hidden",
290
+ return (r, c) => (p(), h("div", Xt, [
291
+ f("label", Bt, F(r.label), 1),
292
+ f("input", {
293
+ id: r.control.uniqueKey,
294
+ checked: r.control.value,
295
+ class: "tl-hidden",
273
296
  type: "checkbox",
274
297
  onInput: t
275
- }, null, 40, Pe),
276
- d("label", {
277
- for: a.control.uniqueKey,
278
- class: "inline-flex items-center cursor-pointer"
298
+ }, null, 40, Lt),
299
+ f("label", {
300
+ for: r.control.uniqueKey,
301
+ class: "tl-inline-flex tl-items-center tl-cursor-pointer"
279
302
  }, [
280
- d("span", {
303
+ f("span", {
281
304
  tabindex: "0",
282
305
  role: "checkbox",
283
- "aria-checked": a.control.value.toString(),
284
- class: D([{ "bg-dark-500": a.control.value, "bg-gray-200": !a.control.value }, "w-4 h-4 flex justify-center items-center rounded border border-gray-300 mr-2 transition-colors duration-200"]),
285
- onKeydown: u
306
+ "aria-checked": r.control.value.toString(),
307
+ class: M([{ "tl-bg-dark-500": r.control.value, "tl-bg-gray-200": !r.control.value }, "tl-w-4 tl-h-4 tl-flex tl-justify-center tl-items-center tl-rounded tl-border tl-border-gray-300 tl-mr-2 tl-transition-colors tl-duration-200"]),
308
+ onKeydown: i
286
309
  }, [
287
- ae(d("i", je, null, 512), [
288
- [re, a.control.value]
310
+ ct(f("i", Nt, null, 512), [
311
+ [it, r.control.value]
289
312
  ])
290
- ], 42, Be)
291
- ], 8, Le)
313
+ ], 42, Wt)
314
+ ], 8, Pt)
292
315
  ]));
293
316
  }
294
- }), We = { class: "px-4 relative flex justify-between gap-4 items-center mb-2" }, Re = ["value", "min", "max", "step"], Ye = ["value", "min", "max", "step"], He = /* @__PURE__ */ M({
317
+ }), Rt = { class: "tl-px-4 tl-relative tl-flex tl-justify-between tl-gap-4 tl-items-center tl-mb-2" }, Yt = ["value", "min", "max", "step"], Gt = ["value", "min", "max", "step"], Ht = /* @__PURE__ */ k({
295
318
  __name: "SliderControl",
296
319
  props: {
297
320
  label: {},
298
321
  control: {}
299
322
  },
300
323
  emits: ["change"],
301
- setup(e, { emit: s }) {
302
- const n = e, o = s;
303
- function t(l) {
304
- const { target: b } = l;
305
- o("change", b.valueAsNumber);
324
+ setup(e, { emit: o }) {
325
+ const l = e, n = o;
326
+ function t(a) {
327
+ const { target: m } = a;
328
+ n("change", m.valueAsNumber);
306
329
  }
307
- const u = O(() => ({
308
- backgroundImage: `linear-gradient(to right, #333 0% ${100 * (n.control.value - (n.control.min || 0)) / ((n.control.max || 100) - (n.control.min || 0))}%, #e2e2e2 0%)`
309
- })), a = ee(), i = f(0), c = f(!1), m = (l) => {
310
- i.value = l.clientX, c.value = !0;
311
- }, h = () => {
312
- c.value = !1;
313
- }, r = (l) => Math.floor(Math.abs(l) / 10);
314
- return U(a.x, (l) => {
315
- if (c.value) {
316
- const b = l - i.value, S = r(b);
317
- b > 0 ? o("change", n.control.value + 1 + S) : b < 0 && o("change", n.control.value - 1 + S), n.control.min !== void 0 && n.control.value < n.control.min && o("change", n.control.min), n.control.max !== void 0 && n.control.value > n.control.max && o("change", n.control.max), i.value = l;
330
+ const i = z(() => ({
331
+ backgroundImage: `linear-gradient(to right, #333 0% ${100 * (l.control.value - (l.control.min || 0)) / ((l.control.max || 100) - (l.control.min || 0))}%, #e2e2e2 0%)`
332
+ })), r = lt(), c = d(0), u = d(!1), _ = (a) => {
333
+ c.value = a.clientX, u.value = !0;
334
+ }, y = () => {
335
+ u.value = !1;
336
+ }, s = (a) => Math.floor(Math.abs(a) / 10);
337
+ return O(r.x, (a) => {
338
+ if (u.value) {
339
+ const m = a - c.value, S = s(m);
340
+ m > 0 ? n("change", l.control.value + 1 + S) : m < 0 && n("change", l.control.value - 1 + S), l.control.min !== void 0 && l.control.value < l.control.min && n("change", l.control.min), l.control.max !== void 0 && l.control.value > l.control.max && n("change", l.control.max), c.value = a;
318
341
  }
319
- }), (l, b) => (p(), x("div", We, [
320
- d("label", {
321
- class: D(["text-gray-500 w-1/3", { "flex justify-between items-center": l.control.icon }])
322
- }, [
323
- ye(k(l.label) + " ", 1),
324
- d("i", {
325
- class: D(`i-${l.control.icon}`)
326
- }, null, 2)
327
- ], 2),
328
- d("input", {
329
- value: l.control.value,
330
- class: "w-1/2 h-0.75 bg-dark-200 rounded-full appearance-none",
331
- style: be(u.value),
342
+ }), (a, m) => (p(), h("div", Rt, [
343
+ X(R, {
344
+ label: a.label,
345
+ control: a.control
346
+ }, null, 8, ["label", "control"]),
347
+ f("input", {
348
+ value: a.control.value,
349
+ class: "tl-w-1/2 tl-h-0.75 tl-bg-dark-200 tl-rounded-full tl-appearance-none",
350
+ style: _t(i.value),
332
351
  type: "range",
333
- min: l.control.min,
334
- max: l.control.max,
335
- step: l.control.step,
352
+ min: a.control.min,
353
+ max: a.control.max,
354
+ step: a.control.step,
336
355
  onInput: t
337
- }, null, 44, Re),
338
- d("input", {
339
- value: l.control.value,
340
- class: D(["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": c.value }]),
356
+ }, null, 44, Yt),
357
+ f("input", {
358
+ value: a.control.value,
359
+ class: M(["tl-p-2 tl-w-1/4 tl-rounded tl-text-right tl-text-xs tl-text-gray-400 tl-bg-gray-100 tl-focus:border-gray-200 tl-outline-none tl-border-none tl-font-sans", { "tl-cursor-ew-resize": u.value }]),
341
360
  type: "number",
342
- min: l.control.min,
343
- max: l.control.max,
344
- step: l.control.step,
361
+ min: a.control.min,
362
+ max: a.control.max,
363
+ step: a.control.step,
345
364
  onInput: t,
346
- onMousedown: m,
347
- onMouseup: h
348
- }, null, 42, Ye)
365
+ onMousedown: _,
366
+ onMouseup: y
367
+ }, null, 42, Gt)
349
368
  ]));
350
369
  }
351
- });
352
- const Ge = (e, s) => {
353
- const n = e.__vccOpts || e;
354
- for (const [o, t] of s)
355
- n[o] = t;
356
- return n;
357
- }, Je = /* @__PURE__ */ Ge(He, [["__scopeId", "data-v-9e6267fe"]]), Qe = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, Ze = { class: "text-gray-500 w-1/3" }, et = ["id", "value", "aria-label"], tt = ["id", "aria-label", "value"], nt = /* @__PURE__ */ M({
370
+ }), vt = (e, o) => {
371
+ const l = e.__vccOpts || e;
372
+ for (const [n, t] of o)
373
+ l[n] = t;
374
+ return l;
375
+ }, Jt = /* @__PURE__ */ vt(Ht, [["__scopeId", "data-v-e775088a"]]), Qt = { class: "tl-flex tl-px-4 tl-justify-between tl-gap-4 tl-items-center tl-mb-2" }, Zt = { class: "tl-text-gray-500 tl-w-1/3" }, te = ["id", "value", "aria-label"], ee = ["id", "aria-label", "value"], le = /* @__PURE__ */ k({
358
376
  __name: "ColorControl",
359
377
  props: {
360
378
  label: {},
361
379
  control: {}
362
380
  },
363
381
  emits: ["change"],
364
- setup(e, { emit: s }) {
365
- const n = s;
366
- function o(t) {
367
- const { target: u } = t;
368
- n("change", u.value);
382
+ setup(e, { emit: o }) {
383
+ const l = o;
384
+ function n(t) {
385
+ const { target: i } = t;
386
+ l("change", i.value);
369
387
  }
370
- return (t, u) => (p(), x("div", Qe, [
371
- d("label", Ze, k(t.label), 1),
372
- d("input", {
388
+ return (t, i) => (p(), h("div", Qt, [
389
+ f("label", Zt, F(t.label), 1),
390
+ f("input", {
373
391
  id: t.control.uniqueKey,
374
392
  tabindex: "0",
375
393
  value: t.control.value,
376
394
  "aria-label": t.label,
377
- class: D(["focus:outline-none focus:ring-2 focus:ring-blue-600", { "important-outline-gray-200": t.control.value === "#ffffff" }]),
395
+ class: M(["focus:tl-outline-none focus:tl-ring-2 focus:tl-ring-blue-600", { "important-tl-outline-gray-200": t.control.value === "#ffffff" }]),
378
396
  type: "color",
379
- onInput: o
380
- }, null, 42, et),
381
- d("input", {
397
+ onInput: n
398
+ }, null, 42, te),
399
+ f("input", {
382
400
  id: t.control.uniqueKey,
383
401
  tabindex: "0",
384
402
  "aria-label": t.label,
385
403
  value: t.control.value,
386
- class: "p-2 w-2/3 rounded text-right text-xs text-gray-400 bg-gray-100 border-none font-sans",
404
+ class: "tl-p-2 tl-w-2/3 tl-rounded tl-text-right tl-text-xs tl-text-gray-400 tl-bg-gray-100 tl-border-none tl-font-sans",
387
405
  type: "text",
388
- onInput: o
389
- }, null, 40, tt)
406
+ onInput: n
407
+ }, null, 40, ee)
390
408
  ]));
391
409
  }
392
410
  });
393
- function ot(e) {
411
+ function ne(e) {
394
412
  if (typeof e == "number")
395
413
  return [e, e, e];
396
- if (Z(e)) {
397
- const { x: s, y: n, z: o } = e;
398
- return [s, n, o];
414
+ if (et(e)) {
415
+ const { x: o, y: l, z: n } = e;
416
+ return [o, l, n];
399
417
  }
400
- if (Q(e)) {
401
- const { x: s, y: n } = e;
402
- return [s, n];
418
+ if (tt(e)) {
419
+ const { x: o, y: l } = e;
420
+ return [o, l];
403
421
  }
404
422
  return e;
405
423
  }
406
- function Q(e) {
424
+ function tt(e) {
407
425
  return e && typeof e.x == "number" && typeof e.y == "number";
408
426
  }
409
- function Z(e) {
427
+ function et(e) {
410
428
  return e && typeof e.x == "number" && typeof e.y == "number" && typeof e.z == "number";
411
429
  }
412
- const lt = { class: "text-gray-500 w-1/3" }, at = { class: "relative w-2/3 flex justify-between gap-0.5" }, rt = {
430
+ const oe = { class: "tl-relative tl-w-2/3 tl-flex tl-justify-between tl-gap-0.5" }, ae = {
413
431
  key: 0,
414
- class: "font-bold px-1 py-1 text-0.65rem text-gray-300"
415
- }, st = ["id", "step", "value", "onInput", "onMousedown", "onMouseup", "onFocus"], it = /* @__PURE__ */ M({
432
+ class: "tl-font-bold tl-px-1 tl-py-1 tl-text-0.65rem tl-text-gray-300"
433
+ }, re = ["id", "step", "value", "onInput", "onMousedown", "onMouseup", "onFocus"], se = /* @__PURE__ */ k({
416
434
  __name: "VectorControl",
417
435
  props: {
418
436
  label: {},
419
437
  control: {}
420
438
  },
421
439
  emits: ["change"],
422
- setup(e, { emit: s }) {
423
- const n = e, o = s, t = ee(), { pressed: u } = we(), a = f(0), i = f(!1), c = f(0), m = f(null), h = f(1), r = te("Shift"), l = te("Alt");
424
- U(r, (y) => {
425
- h.value = y ? 10 : 1;
426
- }), U(l, (y) => {
427
- h.value = y ? 0.1 : 1;
440
+ setup(e, { emit: o }) {
441
+ const l = e, n = o, t = lt(), { pressed: i } = kt(), r = d(0), c = d(!1), u = d(0), _ = d(null), y = d(1), s = nt("Shift"), a = nt("Alt");
442
+ O(s, (b) => {
443
+ y.value = b ? 10 : 1;
444
+ }), O(a, (b) => {
445
+ y.value = b ? 0.1 : 1;
428
446
  });
429
- const b = (y) => {
430
- m.value = y;
447
+ const m = (b) => {
448
+ _.value = b;
431
449
  }, S = () => {
432
- m.value = null;
433
- }, v = (y, w) => {
434
- c.value = w, a.value = y.clientX, i.value = !0;
435
- }, T = (y, w) => {
436
- c.value = w, i.value = !1;
437
- }, F = () => {
438
- i.value = !1;
450
+ _.value = null;
451
+ }, v = (b, x) => {
452
+ u.value = x, r.value = b.clientX, c.value = !0;
453
+ }, T = (b, x) => {
454
+ u.value = x, c.value = !1;
455
+ }, D = () => {
456
+ c.value = !1;
439
457
  };
440
- U(u, (y) => {
441
- y || (i.value = !1);
458
+ O(i, (b) => {
459
+ b || (c.value = !1);
442
460
  });
443
- const $ = (y) => Math.floor(Math.abs(y) / 10), A = O(() => ot(n.control.value)), V = f(["x", "y", "z"]), L = O(() => Q(n.control.value) || Z(n.control.value));
444
- function g(y, w) {
445
- const { value: q } = n.control, { target: _ } = y;
446
- c.value = w, q[L.value ? V.value[c.value] : c.value] = parseFloat(_.value), o("change", q);
461
+ const $ = (b) => Math.floor(Math.abs(b) / 10), A = z(() => ne(l.control.value)), q = d(["x", "y", "z"]), P = z(() => tt(l.control.value) || et(l.control.value));
462
+ function g(b, x) {
463
+ const { value: U } = l.control, { target: w } = b;
464
+ u.value = x, U[P.value ? q.value[u.value] : u.value] = parseFloat(w.value), n("change", U);
447
465
  }
448
- return U(t.x, (y) => {
449
- if (i.value) {
450
- const w = y - a.value, q = $(w), { value: _ } = n.control, I = L.value ? V.value[c.value] : c.value;
451
- w > 0 ? _[I] += h.value + q : w < 0 && (_[I] -= h.value + q), n.control.min !== void 0 && _ < n.control.min && (_[I] = n.control.min), n.control.max !== void 0 && _ > n.control.max && (_[I] = n.control.max), o("change", _), a.value = y;
466
+ return O(t.x, (b) => {
467
+ if (c.value) {
468
+ const x = b - r.value, U = $(x), { value: w } = l.control, I = P.value ? q.value[u.value] : u.value;
469
+ x > 0 ? w[I] += y.value + U : x < 0 && (w[I] -= y.value + U), l.control.min !== void 0 && w < l.control.min && (w[I] = l.control.min), l.control.max !== void 0 && w > l.control.max && (w[I] = l.control.max), n("change", w), r.value = b;
452
470
  }
453
- }), (y, w) => (p(), x("div", {
454
- class: "flex px-4 justify-between gap-1 items-center mb-2",
455
- onMouseup: w[0] || (w[0] = (q) => F())
471
+ }), (b, x) => (p(), h("div", {
472
+ class: "tl-flex tl-px-4 tl-justify-between tl-gap-1 tl-items-center tl-mb-2",
473
+ onMouseup: x[0] || (x[0] = (U) => D())
456
474
  }, [
457
- d("label", lt, k(y.label), 1),
458
- d("div", at, [
459
- (p(!0), x(z, null, N(A.value, (q, _) => (p(), x("div", {
460
- key: y.label + _,
461
- class: D(["flex items-center bg-gray-100 rounded", { "w-2/5": m.value === _, "w-1/3": K(Z)(y.control.value), "w-1/2": K(Q)(y.control.value) }])
475
+ X(R, {
476
+ label: b.label,
477
+ control: b.control
478
+ }, null, 8, ["label", "control"]),
479
+ f("div", oe, [
480
+ (p(!0), h(V, null, j(A.value, (U, w) => (p(), h("div", {
481
+ key: b.label + w,
482
+ class: M(["tl-flex tl-items-center tl-bg-gray-100 tl-rounded", {
483
+ "tl-w-2/5": _.value === w,
484
+ "tl-w-1/3": K(et)(b.control.value),
485
+ "tl-w-1/2": K(tt)(b.control.value)
486
+ }])
462
487
  }, [
463
- V.value[_] && L.value ? (p(), x("span", rt, k(V.value[_]), 1)) : Y("", !0),
464
- d("input", {
465
- id: `${y.control.uniqueKey}-${V.value[_]}`,
488
+ q.value[w] && P.value ? (p(), h("span", ae, F(q.value[w]), 1)) : H("", !0),
489
+ f("input", {
490
+ id: `${b.control.uniqueKey}-${q.value[w]}`,
466
491
  type: "number",
467
- step: h.value,
468
- class: D(["w-full px-0 p-1 text-right text-0.65rem text-gray-400 bg-transparent focus:border-gray-200 outline-none border-none font-sans appearence-none", { "cursor-ew-resize": i.value }]),
469
- value: A.value[_].toFixed(2),
470
- onInput: (I) => g(I, _),
471
- onMousedown: (I) => v(I, _),
472
- onMouseup: (I) => T(I, _),
473
- onFocus: (I) => b(_),
492
+ step: y.value,
493
+ class: M(["tl-w-full tl-px-0 tl-p-1 tl-text-right tl-text-0.65rem tl-text-gray-400 tl-bg-transparent focus:tl-border-gray-200 tl-outline-none tl-border-none tl-font-sans tl-appearence-none", { "tl-cursor-ew-resize": c.value }]),
494
+ value: A.value[w].toFixed(2),
495
+ onInput: (I) => g(I, w),
496
+ onMousedown: (I) => v(I, w),
497
+ onMouseup: (I) => T(I, w),
498
+ onFocus: (I) => m(w),
474
499
  onBlur: S
475
- }, null, 42, st)
500
+ }, null, 42, re)
476
501
  ], 2))), 128))
477
502
  ])
478
503
  ], 32));
479
504
  }
480
- }), ct = { class: "flex px-4 justify-between gap-4 items-center mb-2" }, ut = { class: "text-gray-500 w-1/3" }, dt = { 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" }, pt = { class: "absolute bottom-0.5 right-0.5 font-sans text-xs" }, ft = ["points"], ne = 160, J = 40, B = 2, oe = 100, le = 20, vt = /* @__PURE__ */ M({
505
+ }), ce = { class: "tl-flex tl-px-4 tl-justify-between tl-gap-4 tl-items-center tl-mb-2" }, ie = { class: "tl-text-gray-500 tl-w-1/3" }, ue = { class: "tl-relative tl-w-2/3 tl-p-1 tl-rounded tl-text-right tl-text-xs tl-text-gray-400 tl-bg-gray-100 tl-focus:border-gray-200 tl-outline-none tl-border-none tl-font-sans" }, pe = { class: "tl-absolute tl-bottom-0.5 tl-right-0.5 tl-font-sans tl-text-xs" }, de = ["points"], ot = 160, Z = 40, W = 2, at = 100, rt = 20, fe = /* @__PURE__ */ k({
481
506
  __name: "FPSGraph",
482
507
  props: {
483
508
  label: {},
484
509
  control: {}
485
510
  },
486
511
  setup(e) {
487
- const s = $e({ every: oe }), n = f(""), o = f([]), t = f(ne / B);
488
- let u = performance.now();
489
- return Ce(({ timestamp: a }) => {
490
- a - u >= oe && (u = a, o.value.push(s.value), o.value.length > t.value && o.value.shift(), n.value = o.value.map(
491
- (i, c) => `${c * B},${J + le - B / 2 - i * (J + le - B) / 120}`
512
+ const o = Ct({ every: at }), l = d(""), n = d([]), t = d(ot / W);
513
+ let i = performance.now();
514
+ return Mt(({ timestamp: r }) => {
515
+ r - i >= at && (i = r, n.value.push(o.value), n.value.length > t.value && n.value.shift(), l.value = n.value.map(
516
+ (c, u) => `${u * W},${Z + rt - W / 2 - c * (Z + rt - W) / 120}`
492
517
  ).join(" "));
493
- }), (a, i) => (p(), x("div", ct, [
494
- d("label", ut, k(a.label), 1),
495
- d("div", dt, [
496
- d("div", pt, k(Math.round(K(s))) + " FPS ", 1),
497
- (p(), x("svg", {
498
- width: ne,
499
- height: J,
518
+ }), (r, c) => (p(), h("div", ce, [
519
+ f("label", ie, F(r.label), 1),
520
+ f("div", ue, [
521
+ f("div", pe, F(Math.round(K(o))) + " FPS ", 1),
522
+ (p(), h("svg", {
523
+ width: ot,
524
+ height: Z,
500
525
  xmlns: "http://www.w3.org/2000/svg",
501
- class: "bg-gray-100"
526
+ class: "tl-bg-gray-100"
502
527
  }, [
503
- d("polyline", {
504
- points: n.value,
528
+ f("polyline", {
529
+ points: l.value,
505
530
  fill: "none",
506
531
  stroke: "lightgray",
507
- "stroke-width": B,
532
+ "stroke-width": W,
508
533
  "stroke-linecap": "round",
509
534
  "stroke-linejoin": "round"
510
- }, null, 8, ft)
535
+ }, null, 8, de)
511
536
  ]))
512
537
  ])
513
538
  ]));
514
539
  }
515
- }), gt = { class: "flex px-4 justify-between gap-4 items-center mb-2 min-h-32px" }, yt = ["for"], bt = ["id", "value"], ht = ["value"], mt = /* @__PURE__ */ M({
540
+ }), ve = { class: "tl-flex tl-px-4 tl-justify-between tl-gap-4 tl-items-center tl-mb-2 tl-min-h-32px" }, be = ["id", "value"], ge = ["value"], me = /* @__PURE__ */ k({
516
541
  __name: "SelectControl",
517
542
  props: {
518
543
  label: {},
519
544
  control: {}
520
545
  },
521
546
  emits: ["change"],
522
- setup(e, { emit: s }) {
523
- const n = s;
524
- function o(t) {
525
- n("change", t.target.value);
547
+ setup(e, { emit: o }) {
548
+ const l = o;
549
+ function n(t) {
550
+ l("change", t.target.value);
526
551
  }
527
- return (t, u) => (p(), x("div", gt, [
528
- d("label", {
529
- class: "text-gray-500 w-1/3",
530
- for: t.control.uniqueKey
531
- }, k(t.label), 9, yt),
532
- d("select", {
552
+ return (t, i) => (p(), h("div", ve, [
553
+ X(R, {
554
+ label: t.label,
555
+ control: t.control
556
+ }, null, 8, ["label", "control"]),
557
+ f("select", {
533
558
  id: t.control.uniqueKey,
534
559
  value: t.control.value,
535
- 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",
536
- onChange: o
560
+ class: "tl-p-2 tl-w-2/3 tl-rounded tl-text-left tl-text-xs tl-text-gray-400 tl-bg-gray-100 focus:tl-border-gray-200 tl-outline-none tl-border-none tl-font-sans",
561
+ onChange: n
537
562
  }, [
538
- (p(!0), x(z, null, N(t.control.options, (a) => (p(), x("option", {
539
- key: a.value,
540
- value: a.value
541
- }, k(a.text), 9, ht))), 128))
542
- ], 40, bt)
563
+ (p(!0), h(V, null, j(t.control.options, (r) => (p(), h("option", {
564
+ key: r.value,
565
+ value: r.value
566
+ }, F(r.text), 9, ge))), 128))
567
+ ], 40, be)
543
568
  ]));
544
569
  }
545
- }), de = /* @__PURE__ */ M({
570
+ }), ye = /* @__PURE__ */ k({
571
+ __name: "ButtonControl",
572
+ props: {
573
+ label: {},
574
+ control: {}
575
+ },
576
+ setup(e) {
577
+ const o = e, l = z(() => {
578
+ const n = "leches-btn", t = `leches-btn-${o.control.value.variant || "primary"}`, i = `leches-btn-${o.control.value.size || "sm"}`;
579
+ return [n, t, i];
580
+ });
581
+ return (n, t) => (p(), h("button", {
582
+ class: M(l.value),
583
+ onClick: t[0] || (t[0] = //@ts-ignore
584
+ (...i) => n.control.value.onClick && n.control.value.onClick(...i))
585
+ }, [
586
+ f("i", {
587
+ class: M([n.control.value.icon, n.control.value.label ? "mr-1" : ""])
588
+ }, null, 2),
589
+ st(" " + F(n.control.value.label), 1)
590
+ ], 2));
591
+ }
592
+ }), he = /* @__PURE__ */ vt(ye, [["__scopeId", "data-v-6a95ac59"]]), bt = /* @__PURE__ */ k({
546
593
  __name: "ControlInput",
547
594
  props: {
548
595
  control: {}
549
596
  },
550
597
  emits: ["change"],
551
- setup(e, { emit: s }) {
552
- const n = s;
553
- function o(t) {
554
- n("change", t);
598
+ setup(e, { emit: o }) {
599
+ const l = o;
600
+ function n(t) {
601
+ l("change", t);
555
602
  }
556
- return (t, u) => t.control.visible ? (p(), x(z, { key: 0 }, [
557
- t.control.type === "color" ? (p(), C(nt, {
603
+ return (t, i) => t.control.visible ? (p(), h(V, { key: 0 }, [
604
+ t.control.type === "color" ? (p(), C(le, {
558
605
  key: 0,
559
606
  label: t.control.label,
560
607
  control: t.control,
561
- onChange: o
562
- }, null, 8, ["label", "control"])) : t.control.type === "select" ? (p(), C(mt, {
608
+ onChange: n
609
+ }, null, 8, ["label", "control"])) : t.control.type === "select" ? (p(), C(me, {
563
610
  key: 1,
564
611
  label: t.control.label,
565
612
  control: t.control,
566
- onChange: o
567
- }, null, 8, ["label", "control"])) : t.control.type === "vector" ? (p(), C(it, {
613
+ onChange: n
614
+ }, null, 8, ["label", "control"])) : t.control.type === "vector" ? (p(), C(se, {
568
615
  key: 2,
569
616
  label: t.control.label,
570
617
  control: t.control,
571
- onChange: o
572
- }, null, 8, ["label", "control"])) : t.control.type === "boolean" ? (p(), C(Ne, {
618
+ onChange: n
619
+ }, null, 8, ["label", "control"])) : t.control.type === "boolean" ? (p(), C(jt, {
573
620
  key: 3,
574
621
  label: t.control.label,
575
622
  control: t.control,
576
- onChange: o
577
- }, null, 8, ["label", "control"])) : t.control.type === "fpsgraph" ? (p(), C(vt, {
623
+ onChange: n
624
+ }, null, 8, ["label", "control"])) : t.control.type === "fpsgraph" ? (p(), C(fe, {
578
625
  key: 4,
579
626
  label: t.control.label,
580
627
  control: t.control
581
- }, null, 8, ["label", "control"])) : t.control.type === "number" ? (p(), C(Ee, {
628
+ }, null, 8, ["label", "control"])) : t.control.type === "number" ? (p(), C(zt, {
582
629
  key: 5,
583
630
  label: t.control.label,
584
631
  control: t.control,
585
- onChange: o
586
- }, null, 8, ["label", "control"])) : t.control.type === "range" ? (p(), C(Je, {
632
+ onChange: n
633
+ }, null, 8, ["label", "control"])) : t.control.type === "range" ? (p(), C(Jt, {
587
634
  key: 6,
588
635
  label: t.control.label,
589
636
  control: t.control,
590
- onChange: o
591
- }, null, 8, ["label", "control"])) : (p(), C(ze, {
637
+ onChange: n
638
+ }, null, 8, ["label", "control"])) : t.control.type === "button" ? (p(), h("div", {
592
639
  key: 7,
640
+ class: M(["tl-p-2", t.control.value.size === "tl-block" ? "tl-flex" : "tl-inline-flex"])
641
+ }, [
642
+ X(he, {
643
+ label: t.control.label,
644
+ control: t.control
645
+ }, null, 8, ["label", "control"])
646
+ ], 2)) : (p(), C(Ot, {
647
+ key: 8,
593
648
  label: t.control.label,
594
649
  control: t.control,
595
- onChange: o
650
+ onChange: n
596
651
  }, null, 8, ["label", "control"]))
597
- ], 64)) : Y("", !0);
652
+ ], 64)) : H("", !0);
598
653
  }
599
- }), _t = { class: "mb-4" }, xt = ["aria-expanded", "data-folder"], wt = {
600
- class: "bg-white rounded-b pt-4",
654
+ }), _e = { class: "tl-mb-4" }, we = ["aria-expanded", "data-folder"], xe = {
655
+ class: "tl-bg-white tl-rounded-b tl-pt-4",
601
656
  role: "menu"
602
- }, $t = /* @__PURE__ */ M({
657
+ }, $e = /* @__PURE__ */ k({
603
658
  __name: "Folder",
604
659
  props: {
605
660
  controls: {},
606
661
  label: {}
607
662
  },
608
663
  setup(e) {
609
- function s(t, u) {
610
- u.value = t;
664
+ function o(t, i) {
665
+ i.value = t;
611
666
  }
612
- const n = f(!1), o = () => {
613
- n.value = !n.value;
667
+ const l = d(!1), n = () => {
668
+ l.value = !l.value;
614
669
  };
615
- return (t, u) => (p(), x("div", _t, [
616
- d("button", {
617
- class: "flex items-center justify-between w-full py-2 px-4 bg-gray-100 border-none text-gray-400 font-bold text-xs font-sans cursor-pointer",
618
- "aria-expanded": n.value,
670
+ return (t, i) => (p(), h("div", _e, [
671
+ f("button", {
672
+ class: "tl-flex tl-items-center tl-justify-between tl-w-full tl-py-2 tl-px-4 tl-bg-gray-100 tl-border-none tl-text-gray-400 tl-font-bold tl-text-xs tl-font-sans tl-cursor-pointer",
673
+ "aria-expanded": l.value,
619
674
  "aria-haspopup": "true",
620
675
  role: "button",
621
676
  "data-folder": t.label,
622
677
  tabindex: "0",
623
- onClick: o
678
+ onClick: n
624
679
  }, [
625
- d("span", null, k(t.label), 1),
626
- d("i", {
627
- class: D(n.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
680
+ f("span", null, F(t.label), 1),
681
+ f("i", {
682
+ class: M(l.value ? "i-ic:baseline-keyboard-arrow-up" : "i-ic:baseline-keyboard-arrow-down")
628
683
  }, null, 2)
629
- ], 8, xt),
630
- he(me, {
684
+ ], 8, we),
685
+ X(wt, {
631
686
  name: "slide",
632
- "enter-active-class": " animate-fade-in animate-duration-200 animate-ease-in-out",
633
- "leave-active-class": " animate-fade-out animate-duration-200 animate-ease-in-out"
687
+ "enter-active-class": "tl-animate-fade-in tl-animate-duration-200 tl-animate-ease-in-out",
688
+ "leave-active-class": "tl-animate-fade-out tl-animate-duration-200 tl-animate-ease-in-out"
634
689
  }, {
635
- default: se(() => [
636
- ae(d("div", wt, [
637
- (p(!0), x(z, null, N(t.controls, (a) => (p(), C(de, {
638
- key: a.label,
639
- control: a,
690
+ default: ut(() => [
691
+ ct(f("div", xe, [
692
+ (p(!0), h(V, null, j(t.controls, (r) => (p(), C(bt, {
693
+ key: r.label,
694
+ control: r,
640
695
  role: "menuitem",
641
- onChange: (i) => s(i, a)
696
+ onChange: (c) => o(c, r)
642
697
  }, null, 8, ["control", "onChange"]))), 128))
643
698
  ], 512), [
644
- [re, n.value]
699
+ [it, l.value]
645
700
  ])
646
701
  ]),
647
702
  _: 1
648
703
  })
649
704
  ]));
650
705
  }
651
- }), Ct = {
706
+ }), ke = {
652
707
  tabindex: "0",
653
- class: "bg-white shadow-xl rounded border-4 border-solid border-black"
654
- }, kt = /* @__PURE__ */ d("i", { class: "h-4 w-4 p-1.5 flex items-center line-height-0 rounded-full bg-gray-100 text-xs" }, "🍰", -1), Mt = /* @__PURE__ */ d("div", null, [
655
- /* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" }),
656
- /* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" }),
657
- /* @__PURE__ */ d("i", { class: "i-ic-baseline-drag-indicator" })
658
- ], -1), St = /* @__PURE__ */ d("div", null, null, -1), Tt = [
659
- kt,
660
- Mt,
661
- St
662
- ], At = 280, Ft = /* @__PURE__ */ M({
708
+ class: "tl-bg-white tl-shadow-xl tl-rounded tl-border-4 tl-border-solid tl-border-black"
709
+ }, Ce = /* @__PURE__ */ f("i", { class: "tl-h-4 tl-w-4 tl-p-1.5 tl-flex tl-items-center tl-line-height-0 tl-rounded-full tl-bg-gray-100 tl-text-xs" }, "🍰", -1), Me = /* @__PURE__ */ f("div", null, [
710
+ /* @__PURE__ */ f("i", { class: "i-ic-baseline-drag-indicator" }),
711
+ /* @__PURE__ */ f("i", { class: "i-ic-baseline-drag-indicator" }),
712
+ /* @__PURE__ */ f("i", { class: "i-ic-baseline-drag-indicator" })
713
+ ], -1), Se = /* @__PURE__ */ f("div", null, null, -1), Te = [
714
+ Ce,
715
+ Me,
716
+ Se
717
+ ], Ae = 280, Fe = /* @__PURE__ */ k({
663
718
  __name: "TresLeches",
664
719
  props: {
665
720
  uuid: {}
666
721
  },
667
722
  setup(e) {
668
- const s = e, { uuid: n } = X(s), { width: o } = ie(), t = f(null), u = Ie(n == null ? void 0 : n.value);
669
- function a(c, m) {
670
- u[K(c)].value = m, u[K(c)][K(c)] = m;
723
+ const o = e, { uuid: l } = B(o), { width: n } = pt(), t = d(null), i = Dt(l == null ? void 0 : l.value);
724
+ function r(u, _) {
725
+ i[K(u)].value = _, i[K(u)][K(u)] = _;
671
726
  }
672
- const i = O(() => {
673
- const c = {};
674
- for (const m in u) {
675
- const h = u[m], r = h.folder || "default";
676
- c[r] || (c[r] = []), c[r].push(h);
727
+ const c = z(() => {
728
+ const u = {};
729
+ for (const _ in i) {
730
+ const y = i[_], s = y.folder || "default";
731
+ u[s] || (u[s] = []), u[s].push(y);
677
732
  }
678
- return c;
733
+ return u;
679
734
  });
680
- return (c, m) => (p(), C(K(Te), {
681
- id: K(n),
682
- "initial-value": { x: K(o) - At - 40, y: 10 },
683
- class: D(["absolute select-none z-24 w-280px font-sans text-xs", c.$attrs.class]),
735
+ return (u, _) => (p(), C(K(It), {
736
+ id: K(l),
737
+ "initial-value": { x: K(n) - Ae - 40, y: 10 },
738
+ class: M(["tl-absolute tl-select-none tl-z-24 tl-w-280px tl-font-sans tl-text-xs", u.$attrs.class]),
684
739
  handle: t.value
685
740
  }, {
686
- default: se(() => [
687
- d("div", Ct, [
688
- d("header", {
741
+ default: ut(() => [
742
+ f("div", ke, [
743
+ f("header", {
689
744
  ref_key: "handle",
690
745
  ref: t,
691
- class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
692
- }, Tt, 512),
693
- (p(!0), x(z, null, N(i.value, (h, r) => (p(), x(z, { key: r }, [
694
- r !== "default" ? (p(), C($t, {
746
+ class: "tl-relative tl-cursor-grabbing tl-p-4 tl-flex tl-justify-between tl-text-gray-200 tl-relative"
747
+ }, Te, 512),
748
+ (p(!0), h(V, null, j(c.value, (y, s) => (p(), h(V, { key: s }, [
749
+ s !== "default" ? (p(), C($e, {
695
750
  key: 0,
696
- label: r,
697
- controls: h
698
- }, null, 8, ["label", "controls"])) : Y("", !0),
699
- r === "default" ? (p(!0), x(z, { key: 1 }, N(h, (l) => (p(), C(de, {
700
- key: l.label,
701
- control: l,
702
- onChange: (b) => a(l.key, b)
703
- }, null, 8, ["control", "onChange"]))), 128)) : Y("", !0)
751
+ label: s,
752
+ controls: y
753
+ }, null, 8, ["label", "controls"])) : H("", !0),
754
+ s === "default" ? (p(!0), h(V, { key: 1 }, j(y, (a) => (p(), C(bt, {
755
+ key: a.label,
756
+ control: a,
757
+ onChange: (m) => r(a.key, m)
758
+ }, null, 8, ["control", "onChange"]))), 128)) : H("", !0)
704
759
  ], 64))), 128))
705
760
  ])
706
761
  ]),
@@ -709,7 +764,7 @@ const lt = { class: "text-gray-500 w-1/3" }, at = { class: "relative w-2/3 flex
709
764
  }
710
765
  });
711
766
  export {
712
- Ft as TresLeches,
713
- Dt as useControls,
714
- Ie as useControlsProvider
767
+ Fe as TresLeches,
768
+ De as useControls,
769
+ Dt as useControlsProvider
715
770
  };