@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.
- package/dist/components/Folder.vue.d.ts +12 -4
- package/dist/components/TresLeches.vue.d.ts +9 -1
- package/dist/composables/useControls.d.ts +12 -4
- package/dist/composables/useDraggable/component.d.ts +15 -0
- package/dist/composables/useDraggable/index.d.ts +101 -0
- package/dist/index.d.ts +2 -2
- package/dist/style.css +2 -2
- package/dist/tresleches.js +460 -499
- package/dist/tresleches.umd.cjs +2 -2
- package/dist/utils/is.d.ts +6 -0
- package/package.json +29 -19
package/dist/tresleches.js
CHANGED
|
@@ -1,65 +1,98 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/leches
|
|
3
|
-
* version: v0.
|
|
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,
|
|
9
|
-
import {
|
|
10
|
-
function
|
|
11
|
-
return
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
a
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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(
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
|
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
|
-
|
|
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(
|
|
239
|
-
const
|
|
240
|
-
function
|
|
241
|
-
const { target:
|
|
242
|
-
o("change",
|
|
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 =
|
|
245
|
-
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
return
|
|
250
|
-
if (
|
|
251
|
-
const
|
|
252
|
-
|
|
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
|
-
}), (
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
value:
|
|
258
|
-
class:
|
|
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:
|
|
261
|
-
max:
|
|
262
|
-
step:
|
|
263
|
-
onInput:
|
|
264
|
-
onMousedown:
|
|
265
|
-
onMouseup:
|
|
266
|
-
}, null, 42,
|
|
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
|
-
}),
|
|
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(
|
|
277
|
-
function e
|
|
278
|
-
|
|
176
|
+
setup(n, { emit: o }) {
|
|
177
|
+
function t(e) {
|
|
178
|
+
const { target: l } = e;
|
|
179
|
+
o("change", l.value);
|
|
279
180
|
}
|
|
280
|
-
return (
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
value:
|
|
284
|
-
type: "
|
|
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:
|
|
287
|
-
}, null, 40,
|
|
187
|
+
onChange: t
|
|
188
|
+
}, null, 40, Ie)
|
|
288
189
|
]));
|
|
289
190
|
}
|
|
290
|
-
}),
|
|
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(
|
|
298
|
-
function e
|
|
299
|
-
const { target: l } =
|
|
198
|
+
setup(n, { emit: o }) {
|
|
199
|
+
function t(e) {
|
|
200
|
+
const { target: l } = e;
|
|
300
201
|
o("change", l.checked);
|
|
301
202
|
}
|
|
302
|
-
return (
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
id:
|
|
306
|
-
checked:
|
|
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:
|
|
310
|
-
}, null, 40,
|
|
311
|
-
|
|
312
|
-
for:
|
|
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
|
-
|
|
316
|
-
class:
|
|
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
|
-
|
|
319
|
-
[
|
|
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
|
-
}),
|
|
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(
|
|
333
|
-
const
|
|
334
|
-
function
|
|
335
|
-
const { target:
|
|
336
|
-
o("change",
|
|
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 =
|
|
339
|
-
backgroundImage: `linear-gradient(to right, #333 0% ${100 * (
|
|
340
|
-
})),
|
|
341
|
-
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
},
|
|
345
|
-
return
|
|
346
|
-
if (
|
|
347
|
-
const
|
|
348
|
-
|
|
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
|
-
}), (
|
|
351
|
-
|
|
352
|
-
class:
|
|
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
|
-
|
|
355
|
-
|
|
356
|
-
class:
|
|
255
|
+
ue(k(s.label) + " ", 1),
|
|
256
|
+
c("i", {
|
|
257
|
+
class: I(`i-${s.control.icon}`)
|
|
357
258
|
}, null, 2)
|
|
358
259
|
], 2),
|
|
359
|
-
|
|
360
|
-
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:
|
|
263
|
+
style: ie(l.value),
|
|
363
264
|
type: "range",
|
|
364
|
-
min:
|
|
365
|
-
max:
|
|
366
|
-
step:
|
|
367
|
-
onInput:
|
|
368
|
-
}, null, 44,
|
|
369
|
-
|
|
370
|
-
value:
|
|
371
|
-
class:
|
|
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:
|
|
374
|
-
max:
|
|
375
|
-
step:
|
|
376
|
-
onInput:
|
|
377
|
-
onMousedown:
|
|
378
|
-
onMouseup:
|
|
379
|
-
}, null, 42,
|
|
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
|
|
384
|
-
const
|
|
385
|
-
for (const [
|
|
386
|
-
e
|
|
387
|
-
return
|
|
388
|
-
},
|
|
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(
|
|
396
|
-
function e
|
|
397
|
-
const { target: l } =
|
|
296
|
+
setup(n, { emit: o }) {
|
|
297
|
+
function t(e) {
|
|
298
|
+
const { target: l } = e;
|
|
398
299
|
o("change", l.value);
|
|
399
300
|
}
|
|
400
|
-
return (
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
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:
|
|
406
|
-
}, null, 40,
|
|
407
|
-
|
|
408
|
-
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:
|
|
412
|
-
}, null, 40,
|
|
312
|
+
onInput: t
|
|
313
|
+
}, null, 40, Ye)
|
|
413
314
|
]));
|
|
414
315
|
}
|
|
415
316
|
});
|
|
416
|
-
function
|
|
417
|
-
if (typeof
|
|
418
|
-
return [
|
|
419
|
-
if (
|
|
420
|
-
const { x: o, y:
|
|
421
|
-
return [o,
|
|
317
|
+
function He(n) {
|
|
318
|
+
if (typeof n == "number")
|
|
319
|
+
return [n, n, n];
|
|
320
|
+
if (ne(n)) {
|
|
321
|
+
const { x: o, y: t, z: e } = n;
|
|
322
|
+
return [o, t, e];
|
|
422
323
|
}
|
|
423
|
-
return
|
|
324
|
+
return n;
|
|
424
325
|
}
|
|
425
|
-
function
|
|
426
|
-
return
|
|
326
|
+
function Re(n) {
|
|
327
|
+
return n && typeof n.x == "number" && typeof n.y == "number" && typeof n.z > "u";
|
|
427
328
|
}
|
|
428
|
-
function
|
|
429
|
-
return
|
|
329
|
+
function ne(n) {
|
|
330
|
+
return n && typeof n.x == "number" && typeof n.y == "number" && typeof n.z == "number";
|
|
430
331
|
}
|
|
431
|
-
const
|
|
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-
|
|
434
|
-
},
|
|
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(
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
},
|
|
445
|
-
|
|
446
|
-
},
|
|
447
|
-
function
|
|
448
|
-
const { value:
|
|
449
|
-
|
|
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
|
|
452
|
-
if (
|
|
453
|
-
const
|
|
454
|
-
|
|
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
|
-
}), (
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
(
|
|
460
|
-
key:
|
|
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
|
-
|
|
464
|
-
|
|
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:
|
|
467
|
-
value:
|
|
468
|
-
onInput: (
|
|
469
|
-
onMousedown: (
|
|
470
|
-
onMouseup: (
|
|
471
|
-
}, null, 42,
|
|
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
|
-
}),
|
|
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(
|
|
525
|
-
const o =
|
|
526
|
-
let
|
|
527
|
-
return
|
|
528
|
-
|
|
529
|
-
(
|
|
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
|
-
}), (
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
(
|
|
536
|
-
width:
|
|
537
|
-
height:
|
|
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
|
-
|
|
542
|
-
points:
|
|
400
|
+
c("polyline", {
|
|
401
|
+
points: t.value,
|
|
543
402
|
fill: "none",
|
|
544
403
|
stroke: "lightgray",
|
|
545
|
-
"stroke-width":
|
|
404
|
+
"stroke-width": z,
|
|
546
405
|
"stroke-linecap": "round",
|
|
547
406
|
"stroke-linejoin": "round"
|
|
548
|
-
}, null, 8,
|
|
407
|
+
}, null, 8, rn)
|
|
549
408
|
]))
|
|
550
409
|
])
|
|
551
410
|
]));
|
|
552
411
|
}
|
|
553
|
-
}),
|
|
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(
|
|
561
|
-
function e
|
|
562
|
-
o("change",
|
|
419
|
+
setup(n, { emit: o }) {
|
|
420
|
+
function t(e) {
|
|
421
|
+
o("change", e.target.value);
|
|
563
422
|
}
|
|
564
|
-
return (
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
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:
|
|
428
|
+
onChange: t
|
|
570
429
|
}, [
|
|
571
|
-
(
|
|
572
|
-
key:
|
|
573
|
-
value:
|
|
574
|
-
},
|
|
575
|
-
], 40,
|
|
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__ */
|
|
437
|
+
}), te = /* @__PURE__ */ M({
|
|
579
438
|
__name: "ControlInput",
|
|
580
439
|
props: {
|
|
581
440
|
control: {}
|
|
582
441
|
},
|
|
583
442
|
emits: ["change"],
|
|
584
|
-
setup(
|
|
585
|
-
function e
|
|
586
|
-
o("change",
|
|
443
|
+
setup(n, { emit: o }) {
|
|
444
|
+
function t(e) {
|
|
445
|
+
o("change", e);
|
|
587
446
|
}
|
|
588
|
-
return (
|
|
589
|
-
|
|
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:
|
|
592
|
-
control:
|
|
593
|
-
onChange:
|
|
594
|
-
}, null, 8, ["label", "control"])) :
|
|
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:
|
|
597
|
-
control:
|
|
598
|
-
onChange:
|
|
599
|
-
}, null, 8, ["label", "control"])) :
|
|
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:
|
|
602
|
-
control:
|
|
603
|
-
onChange:
|
|
604
|
-
}, null, 8, ["label", "control"])) :
|
|
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:
|
|
607
|
-
control:
|
|
608
|
-
|
|
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:
|
|
611
|
-
control:
|
|
612
|
-
}, null, 8, ["label", "control"])) :
|
|
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:
|
|
615
|
-
control:
|
|
616
|
-
onChange:
|
|
617
|
-
}, null, 8, ["label", "control"])) :
|
|
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:
|
|
620
|
-
control:
|
|
621
|
-
onChange:
|
|
622
|
-
}, null, 8, ["label", "control"])) :
|
|
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:
|
|
625
|
-
control:
|
|
626
|
-
onChange:
|
|
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)) :
|
|
488
|
+
], 64)) : L("", !0);
|
|
634
489
|
}
|
|
635
|
-
}),
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
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
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
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
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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
|
-
|
|
657
|
-
|
|
609
|
+
c("div", bn, [
|
|
610
|
+
c("header", {
|
|
658
611
|
ref_key: "handle",
|
|
659
|
-
ref:
|
|
612
|
+
ref: l,
|
|
660
613
|
class: "relative cursor-grabbing p-4 flex justify-between text-gray-200 relative"
|
|
661
|
-
},
|
|
662
|
-
(
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
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
|
-
|
|
675
|
-
|
|
634
|
+
Tn as TresLeches,
|
|
635
|
+
Mn as useControls,
|
|
636
|
+
yn as useControlsProvider
|
|
676
637
|
};
|