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