@tomorrowevening/hermes 0.1.38 → 0.1.40
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/{ThreeEditor-BjAFHK3t.js → ThreeEditor-CB5dBR7Q.js} +11 -11
- package/dist/core/Application.js +77 -0
- package/dist/core/remote/BaseRemote.js +33 -0
- package/dist/core/remote/RemoteTheatre.js +253 -0
- package/dist/core/remote/RemoteThree.js +442 -0
- package/dist/core/types.js +7 -0
- package/dist/editor/Editor.js +12 -0
- package/dist/editor/HermesApp.js +24 -0
- package/dist/editor/ThreeEditor.js +22 -0
- package/dist/editor/components/Draggable.js +40 -0
- package/dist/editor/components/DraggableItem.js +25 -0
- package/dist/editor/components/Dropdown.js +32 -0
- package/dist/editor/components/DropdownItem.js +50 -0
- package/dist/editor/components/NavButton.js +7 -0
- package/dist/editor/components/content.js +4 -0
- package/dist/editor/components/icons/CloseIcon.js +9 -0
- package/dist/editor/components/icons/DragIcon.js +12 -0
- package/dist/editor/multiView/CameraWindow.js +64 -0
- package/dist/editor/multiView/DepthNodeMaterial.js +12 -0
- package/dist/editor/multiView/InfiniteGridHelper.js +31 -0
- package/dist/editor/multiView/InfiniteGridHelperGPU.js +31 -0
- package/dist/editor/multiView/InfiniteGridMaterial.js +137 -0
- package/dist/editor/multiView/InfiniteGridNodeMaterial.js +63 -0
- package/dist/editor/multiView/MultiView.js +890 -0
- package/dist/editor/multiView/Toggle.js +25 -0
- package/dist/editor/multiView/UVMaterial.js +60 -0
- package/dist/editor/multiView/UVNodeMaterial.js +10 -0
- package/dist/editor/sidePanel/Accordion.js +56 -0
- package/dist/editor/sidePanel/ChildObject.js +78 -0
- package/dist/editor/sidePanel/ContainerObject.js +11 -0
- package/dist/editor/sidePanel/DebugData.js +133 -0
- package/dist/editor/sidePanel/SidePanel.js +91 -0
- package/dist/editor/sidePanel/inspector/InspectGrid3.js +82 -0
- package/dist/editor/sidePanel/inspector/InspectGrid4.js +58 -0
- package/dist/editor/sidePanel/inspector/InspectImage.js +100 -0
- package/dist/editor/sidePanel/inspector/InspectNumber.js +76 -0
- package/dist/editor/sidePanel/inspector/InspectVector2.js +154 -0
- package/dist/editor/sidePanel/inspector/Inspector.js +95 -0
- package/dist/editor/sidePanel/inspector/InspectorField.js +128 -0
- package/dist/editor/sidePanel/inspector/InspectorGroup.js +110 -0
- package/dist/editor/sidePanel/inspector/utils/DragNumber.js +27 -0
- package/dist/editor/sidePanel/inspector/utils/InspectAnimation.js +99 -0
- package/dist/editor/sidePanel/inspector/utils/InspectCamera.js +91 -0
- package/dist/editor/sidePanel/inspector/utils/InspectLight.js +85 -0
- package/dist/editor/sidePanel/inspector/utils/InspectMaterial.js +861 -0
- package/dist/editor/sidePanel/inspector/utils/InspectTransform.js +93 -0
- package/dist/editor/sidePanel/utils.js +259 -0
- package/dist/editor/tools/Transform.js +77 -0
- package/dist/editor/tools/splineEditor/Spline.js +348 -0
- package/dist/editor/tools/splineEditor/index.js +193 -0
- package/dist/editor/utils.js +27 -0
- package/dist/hermes.cjs.js +8 -30
- package/dist/{index-dfUv_VcA.js → index-DepTXu6T.js} +454 -454
- package/dist/index.html +1 -1
- package/dist/index.js +125 -0
- package/dist/utils/ImageSequenceCapturer.js +148 -0
- package/dist/utils/detectSettings.js +46 -0
- package/dist/utils/math.js +68 -0
- package/dist/utils/post.js +206 -0
- package/dist/utils/theatre.js +316 -0
- package/dist/utils/three.js +199 -0
- package/dist/webworkers/EventHandling.js +115 -0
- package/dist/webworkers/ProxyManager.js +76 -0
- package/package.json +13 -7
- package/dist/.vite/manifest.json +0 -12
- package/dist/hermes.es.js +0 -8266
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsxs as g, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as u, useState as i } from "react";
|
|
3
|
+
import { uploadLocalImage as w } from "./utils/InspectMaterial.js";
|
|
4
|
+
import { noImage as I } from "../../components/content.js";
|
|
5
|
+
import { randomID as v } from "../../utils.js";
|
|
6
|
+
function q(e) {
|
|
7
|
+
const m = e.step !== void 0 ? e.step : 0.01, d = u(null), p = u(null), C = u(null), R = u(null), b = u(null), [k] = i(e.value), [r, X] = i(e.value.offset[0]), [c, Y] = i(e.value.offset[1]), [f, y] = i(e.value.repeat[0]), [l, x] = i(e.value.repeat[1]);
|
|
8
|
+
function s(a, o, t, O, j) {
|
|
9
|
+
if (e.onChange !== void 0) {
|
|
10
|
+
const N = e.prop !== void 0 ? e.prop : e.title;
|
|
11
|
+
e.onChange(N, {
|
|
12
|
+
src: a,
|
|
13
|
+
offset: [o, t],
|
|
14
|
+
repeat: [O, j]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function h(a) {
|
|
19
|
+
const o = d.current.src, t = a.target.value;
|
|
20
|
+
switch (a.target) {
|
|
21
|
+
case p.current:
|
|
22
|
+
X(t), s(o, t, c, f, l);
|
|
23
|
+
break;
|
|
24
|
+
case C.current:
|
|
25
|
+
Y(t), s(o, r, t, f, l);
|
|
26
|
+
break;
|
|
27
|
+
case R.current:
|
|
28
|
+
y(t), s(o, r, c, t, l);
|
|
29
|
+
break;
|
|
30
|
+
case b.current:
|
|
31
|
+
x(t), s(o, r, c, f, t);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ g("div", { className: "imageField", children: [
|
|
36
|
+
/* @__PURE__ */ n("img", { alt: e.title, ref: d, onClick: () => {
|
|
37
|
+
w().then((a) => {
|
|
38
|
+
d.current.src = a, s(a, r, c, f, l);
|
|
39
|
+
});
|
|
40
|
+
}, src: k.src.length > 0 ? k.src : I }),
|
|
41
|
+
/* @__PURE__ */ g("div", { className: "fields", children: [
|
|
42
|
+
/* @__PURE__ */ g("div", { children: [
|
|
43
|
+
/* @__PURE__ */ n("span", { children: "Offset:" }),
|
|
44
|
+
/* @__PURE__ */ n(
|
|
45
|
+
"input",
|
|
46
|
+
{
|
|
47
|
+
ref: p,
|
|
48
|
+
type: "number",
|
|
49
|
+
value: r,
|
|
50
|
+
step: m,
|
|
51
|
+
name: v(),
|
|
52
|
+
onChange: h
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ n(
|
|
56
|
+
"input",
|
|
57
|
+
{
|
|
58
|
+
ref: C,
|
|
59
|
+
type: "number",
|
|
60
|
+
value: c,
|
|
61
|
+
step: m,
|
|
62
|
+
name: v(),
|
|
63
|
+
onChange: h
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ g("div", { children: [
|
|
68
|
+
/* @__PURE__ */ n("span", { children: "Repeat:" }),
|
|
69
|
+
/* @__PURE__ */ n(
|
|
70
|
+
"input",
|
|
71
|
+
{
|
|
72
|
+
ref: R,
|
|
73
|
+
type: "number",
|
|
74
|
+
value: f,
|
|
75
|
+
step: m,
|
|
76
|
+
name: v(),
|
|
77
|
+
onChange: h
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ n(
|
|
81
|
+
"input",
|
|
82
|
+
{
|
|
83
|
+
ref: b,
|
|
84
|
+
type: "number",
|
|
85
|
+
value: l,
|
|
86
|
+
step: m,
|
|
87
|
+
name: v(),
|
|
88
|
+
onChange: h
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ n("button", { onClick: () => {
|
|
93
|
+
s("", r, c, f, l), d.current.src = I;
|
|
94
|
+
}, children: "Clear" })
|
|
95
|
+
] })
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
q as default
|
|
100
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs as f, Fragment as g, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as r, useState as b } from "react";
|
|
3
|
+
import h from "./utils/DragNumber.js";
|
|
4
|
+
import { noop as c } from "../../../core/types.js";
|
|
5
|
+
import { randomID as u } from "../../utils.js";
|
|
6
|
+
function s(e) {
|
|
7
|
+
const i = r(null), d = r(null), [t, l] = b(e.value);
|
|
8
|
+
return h({
|
|
9
|
+
label: e.labelRef,
|
|
10
|
+
input: i,
|
|
11
|
+
sliderRef: d,
|
|
12
|
+
defaultValue: t,
|
|
13
|
+
min: e.min,
|
|
14
|
+
max: e.max,
|
|
15
|
+
step: e.step,
|
|
16
|
+
onChange: (a) => {
|
|
17
|
+
l(a), e.onChange !== void 0 && e.onChange(e.prop, a);
|
|
18
|
+
}
|
|
19
|
+
}), /* @__PURE__ */ f(g, { children: [
|
|
20
|
+
e.type === "number" && /* @__PURE__ */ m(
|
|
21
|
+
"input",
|
|
22
|
+
{
|
|
23
|
+
alt: e.alt,
|
|
24
|
+
className: e.className,
|
|
25
|
+
ref: i,
|
|
26
|
+
type: "number",
|
|
27
|
+
value: t,
|
|
28
|
+
min: e.min,
|
|
29
|
+
max: e.max,
|
|
30
|
+
step: e.step,
|
|
31
|
+
disabled: e.disabled,
|
|
32
|
+
name: u(),
|
|
33
|
+
onChange: (a) => {
|
|
34
|
+
if (l(a.target.value), a.target.value.length === 0) return;
|
|
35
|
+
const n = Number(a.target.value);
|
|
36
|
+
isNaN(n) || e.onChange !== void 0 && e.onChange(e.prop, n);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
e.type === "range" && /* @__PURE__ */ f(g, { children: [
|
|
41
|
+
/* @__PURE__ */ m(
|
|
42
|
+
"input",
|
|
43
|
+
{
|
|
44
|
+
type: "text",
|
|
45
|
+
value: t.toString(),
|
|
46
|
+
disabled: e.disabled,
|
|
47
|
+
ref: i,
|
|
48
|
+
className: "min",
|
|
49
|
+
name: u(),
|
|
50
|
+
onChange: (a) => {
|
|
51
|
+
if (a.target.value.length === 0) return;
|
|
52
|
+
const n = Number(a.target.value);
|
|
53
|
+
isNaN(n) || (l(n), e.onChange !== void 0 && e.onChange(e.prop, n));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ m(
|
|
58
|
+
"input",
|
|
59
|
+
{
|
|
60
|
+
disabled: e.disabled,
|
|
61
|
+
type: "range",
|
|
62
|
+
value: t,
|
|
63
|
+
min: e.min,
|
|
64
|
+
max: e.max,
|
|
65
|
+
step: e.step,
|
|
66
|
+
ref: d,
|
|
67
|
+
name: u(),
|
|
68
|
+
onChange: c
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
s as default
|
|
76
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsxs as o, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as l, useState as d, useEffect as k } from "react";
|
|
3
|
+
import { normalize as Y, clamp as s, roundTo as j, mix as I } from "../../../utils/math.js";
|
|
4
|
+
import v from "./utils/DragNumber.js";
|
|
5
|
+
import { randomID as h } from "../../utils.js";
|
|
6
|
+
function J(a) {
|
|
7
|
+
const C = l(null), M = l(null), g = l(null), b = l(null), R = l(null), y = l(null), p = l(null), w = l(null), L = l(null), D = l(null), [i, c] = d(a.value.x), [u, f] = d(a.value.y), [e, r] = d({
|
|
8
|
+
min: Math.min(a.min, Math.min(a.value.x, a.value.y)),
|
|
9
|
+
max: Math.max(a.max, Math.max(a.value.x, a.value.y))
|
|
10
|
+
}), [P, E] = d(!1);
|
|
11
|
+
v({
|
|
12
|
+
label: p,
|
|
13
|
+
input: C,
|
|
14
|
+
defaultValue: i,
|
|
15
|
+
min: e.min,
|
|
16
|
+
max: e.max,
|
|
17
|
+
step: 0.01,
|
|
18
|
+
onChange: (n) => {
|
|
19
|
+
c(n), a.onChange({ target: { value: { x: n, y: u } } });
|
|
20
|
+
}
|
|
21
|
+
}), v({
|
|
22
|
+
label: w,
|
|
23
|
+
input: M,
|
|
24
|
+
defaultValue: u,
|
|
25
|
+
min: e.min,
|
|
26
|
+
max: e.max,
|
|
27
|
+
step: 0.01,
|
|
28
|
+
onChange: (n) => {
|
|
29
|
+
f(n), a.onChange({ target: { value: { x: i, y: n } } });
|
|
30
|
+
}
|
|
31
|
+
}), v({
|
|
32
|
+
label: L,
|
|
33
|
+
input: g,
|
|
34
|
+
defaultValue: e.min,
|
|
35
|
+
min: e.min - 1,
|
|
36
|
+
max: e.max + 1,
|
|
37
|
+
step: 0.01,
|
|
38
|
+
onChange: (n) => {
|
|
39
|
+
r({ min: n, max: e.max });
|
|
40
|
+
}
|
|
41
|
+
}), v({
|
|
42
|
+
label: D,
|
|
43
|
+
input: b,
|
|
44
|
+
defaultValue: e.max,
|
|
45
|
+
min: e.min - 1,
|
|
46
|
+
max: e.max + 1,
|
|
47
|
+
step: 0.01,
|
|
48
|
+
onChange: (n) => {
|
|
49
|
+
r({ min: e.min, max: n });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
function $() {
|
|
53
|
+
P || (window.addEventListener("mousemove", V), window.addEventListener("mouseup", N), E(!0));
|
|
54
|
+
}
|
|
55
|
+
function N() {
|
|
56
|
+
window.removeEventListener("mousemove", V), window.removeEventListener("mouseup", N), E(!1);
|
|
57
|
+
}
|
|
58
|
+
function V(n) {
|
|
59
|
+
const t = R.current.getBoundingClientRect(), T = s(0, 99, n.clientX - t.left) / 99, U = 1 - s(0, 99, n.clientY - t.top) / 99, B = j(I(e.min, e.max, T), 3), X = j(I(e.min, e.max, U), 3);
|
|
60
|
+
a.onChange({ target: { value: { x: B, y: X } } }), c(B), f(X);
|
|
61
|
+
}
|
|
62
|
+
function z() {
|
|
63
|
+
const n = Number(g.current.value);
|
|
64
|
+
r({ min: n, max: e.max }), i < n && c(s(n, e.max, i)), u < n && f(s(n, e.max, u));
|
|
65
|
+
}
|
|
66
|
+
function S() {
|
|
67
|
+
const n = Number(b.current.value);
|
|
68
|
+
r({ min: e.min, max: n }), i > n && c(s(e.min, n, i)), u > n && f(s(e.min, n, u));
|
|
69
|
+
}
|
|
70
|
+
k(() => {
|
|
71
|
+
y.current.style.left = `${Y(e.min, e.max, i) * 100}%`, y.current.style.top = `${(1 - Y(e.min, e.max, u)) * 100}%`;
|
|
72
|
+
}, [e, i, u]);
|
|
73
|
+
const x = a.step !== void 0 ? a.step : 0.01;
|
|
74
|
+
return /* @__PURE__ */ o("div", { className: "vector2", children: [
|
|
75
|
+
/* @__PURE__ */ o("div", { className: "fields", children: [
|
|
76
|
+
/* @__PURE__ */ o("div", { children: [
|
|
77
|
+
/* @__PURE__ */ m("span", { ref: p, children: "X" }),
|
|
78
|
+
/* @__PURE__ */ m(
|
|
79
|
+
"input",
|
|
80
|
+
{
|
|
81
|
+
ref: C,
|
|
82
|
+
type: "number",
|
|
83
|
+
value: i,
|
|
84
|
+
min: e.min,
|
|
85
|
+
max: e.max,
|
|
86
|
+
step: x,
|
|
87
|
+
name: h(),
|
|
88
|
+
onChange: (n) => {
|
|
89
|
+
if (c(n.target.value), n.target.value.length === 0) return;
|
|
90
|
+
const t = Number(n.target.value);
|
|
91
|
+
isNaN(t) || (a.onChange({ target: { value: { x: t, y: u } } }), t < e.min && r({ min: t, max: e.max }));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ o("div", { children: [
|
|
97
|
+
/* @__PURE__ */ m("span", { ref: w, children: "Y" }),
|
|
98
|
+
/* @__PURE__ */ m(
|
|
99
|
+
"input",
|
|
100
|
+
{
|
|
101
|
+
ref: M,
|
|
102
|
+
type: "number",
|
|
103
|
+
value: u,
|
|
104
|
+
min: e.min,
|
|
105
|
+
max: e.max,
|
|
106
|
+
step: x,
|
|
107
|
+
name: h(),
|
|
108
|
+
onChange: (n) => {
|
|
109
|
+
if (f(n.target.value), n.target.value.length === 0) return;
|
|
110
|
+
const t = Number(n.target.value);
|
|
111
|
+
isNaN(t) || (a.onChange({ target: { value: { x: i, y: t } } }), t > e.max && r({ min: e.min, max: t }));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ o("div", { children: [
|
|
117
|
+
/* @__PURE__ */ m("span", { ref: L, children: "Min" }),
|
|
118
|
+
/* @__PURE__ */ m(
|
|
119
|
+
"input",
|
|
120
|
+
{
|
|
121
|
+
ref: g,
|
|
122
|
+
type: "number",
|
|
123
|
+
value: e.min,
|
|
124
|
+
step: x,
|
|
125
|
+
name: h(),
|
|
126
|
+
onChange: z
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ o("div", { children: [
|
|
131
|
+
/* @__PURE__ */ m("span", { ref: D, children: "Max" }),
|
|
132
|
+
/* @__PURE__ */ m(
|
|
133
|
+
"input",
|
|
134
|
+
{
|
|
135
|
+
ref: b,
|
|
136
|
+
type: "number",
|
|
137
|
+
value: e.max,
|
|
138
|
+
step: x,
|
|
139
|
+
name: h(),
|
|
140
|
+
onChange: S
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] })
|
|
144
|
+
] }),
|
|
145
|
+
/* @__PURE__ */ o("div", { className: "input", ref: R, onMouseDown: $, onMouseUp: N, children: [
|
|
146
|
+
/* @__PURE__ */ m("div", { className: "x" }),
|
|
147
|
+
/* @__PURE__ */ m("div", { className: "y" }),
|
|
148
|
+
/* @__PURE__ */ m("div", { className: "pt", ref: y })
|
|
149
|
+
] })
|
|
150
|
+
] });
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
J as default
|
|
154
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as r, jsxs as m, Fragment as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useEffect as E } from "react";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import p from "../Accordion.js";
|
|
5
|
+
import s from "./InspectorField.js";
|
|
6
|
+
import { InspectCamera as I } from "./utils/InspectCamera.js";
|
|
7
|
+
import { InspectMaterial as C } from "./utils/InspectMaterial.js";
|
|
8
|
+
import { InspectTransform as b } from "./utils/InspectTransform.js";
|
|
9
|
+
import { InspectLight as T } from "./utils/InspectLight.js";
|
|
10
|
+
import g from "./utils/InspectAnimation.js";
|
|
11
|
+
import L from "../../tools/Transform.js";
|
|
12
|
+
import { ToolEvents as n } from "../../../core/remote/RemoteThree.js";
|
|
13
|
+
const l = {
|
|
14
|
+
name: "",
|
|
15
|
+
uuid: "",
|
|
16
|
+
type: "",
|
|
17
|
+
visible: !1,
|
|
18
|
+
matrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
19
|
+
animations: [],
|
|
20
|
+
material: void 0,
|
|
21
|
+
perspectiveCameraInfo: void 0,
|
|
22
|
+
orthographicCameraInfo: void 0,
|
|
23
|
+
lightInfo: void 0,
|
|
24
|
+
children: []
|
|
25
|
+
};
|
|
26
|
+
function R(t) {
|
|
27
|
+
const [e, a] = f(l);
|
|
28
|
+
E(() => {
|
|
29
|
+
function h(v) {
|
|
30
|
+
a(v.value);
|
|
31
|
+
}
|
|
32
|
+
function o() {
|
|
33
|
+
a(l);
|
|
34
|
+
}
|
|
35
|
+
return t.three.addEventListener(n.CLEAR_OBJECT, o), t.three.addEventListener(n.SET_SCENE, o), t.three.addEventListener(n.SET_OBJECT, h), () => {
|
|
36
|
+
t.three.removeEventListener(n.CLEAR_OBJECT, o), t.three.removeEventListener(n.SET_SCENE, o), t.three.removeEventListener(n.SET_OBJECT, h);
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const i = e.type.toLowerCase(), d = e.animations.length > 0 || e.mixer !== void 0, u = i.search("mesh") > -1 || i.search("line") > -1 || i.search("points") > -1;
|
|
40
|
+
return /* @__PURE__ */ r(
|
|
41
|
+
p,
|
|
42
|
+
{
|
|
43
|
+
three: t.three,
|
|
44
|
+
label: "Inspector",
|
|
45
|
+
button: e.uuid.length > 0 ? /* @__PURE__ */ r("button", { className: "remove", onClick: () => {
|
|
46
|
+
L.instance.remove(e.name), a(l);
|
|
47
|
+
} }) : void 0,
|
|
48
|
+
children: /* @__PURE__ */ r("div", { id: "Inspector", className: t.class, children: e.uuid.length > 0 && /* @__PURE__ */ m(c, { children: [
|
|
49
|
+
/* @__PURE__ */ m(c, { children: [
|
|
50
|
+
/* @__PURE__ */ r(
|
|
51
|
+
s,
|
|
52
|
+
{
|
|
53
|
+
type: "string",
|
|
54
|
+
title: "Name",
|
|
55
|
+
prop: "name",
|
|
56
|
+
value: e.name,
|
|
57
|
+
disabled: !0
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ r(
|
|
61
|
+
s,
|
|
62
|
+
{
|
|
63
|
+
type: "string",
|
|
64
|
+
title: "Type",
|
|
65
|
+
prop: "type",
|
|
66
|
+
value: e.type,
|
|
67
|
+
disabled: !0
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ r(
|
|
71
|
+
s,
|
|
72
|
+
{
|
|
73
|
+
type: "string",
|
|
74
|
+
title: "UUID",
|
|
75
|
+
prop: "uuid",
|
|
76
|
+
value: e.uuid,
|
|
77
|
+
disabled: !0
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ m(c, { children: [
|
|
82
|
+
/* @__PURE__ */ r(b, { object: e, three: t.three }),
|
|
83
|
+
d ? /* @__PURE__ */ r(g, { object: e, three: t.three }) : null,
|
|
84
|
+
i.search("camera") > -1 ? I(e, t.three) : null,
|
|
85
|
+
i.search("light") > -1 ? T(e, t.three) : null,
|
|
86
|
+
u ? C(e, t.three) : null
|
|
87
|
+
] })
|
|
88
|
+
] }) })
|
|
89
|
+
},
|
|
90
|
+
"Inspector"
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
R as default
|
|
95
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsxs as v, jsx as t, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { colorToHex as h, capitalize as C, randomID as o } from "../../utils.js";
|
|
3
|
+
import { useState as w, useRef as N, useEffect as V } from "react";
|
|
4
|
+
import x from "./InspectNumber.js";
|
|
5
|
+
import r from "./InspectVector2.js";
|
|
6
|
+
import I from "./InspectGrid3.js";
|
|
7
|
+
import D from "./InspectGrid4.js";
|
|
8
|
+
import F from "./InspectImage.js";
|
|
9
|
+
import { Color as j, LinearSRGBColorSpace as G } from "three";
|
|
10
|
+
function T(e) {
|
|
11
|
+
let n = e.value;
|
|
12
|
+
n !== void 0 && (n.isColor !== void 0 ? n = h(e.value) : e.type === "color" && (n = h(new j().setStyle(e.value, G))));
|
|
13
|
+
const [i, f] = w(n), c = N(null);
|
|
14
|
+
V(() => {
|
|
15
|
+
f(n);
|
|
16
|
+
}, [n]);
|
|
17
|
+
const a = (d) => {
|
|
18
|
+
let l = d.target.value;
|
|
19
|
+
if (e.type === "boolean")
|
|
20
|
+
l = d.target.checked;
|
|
21
|
+
else if (e.type === "option" && (typeof e.value == "number" ? l = Number(l) : typeof e.value == "boolean" ? l = !!l : typeof e.value == "object" && (l = JSON.parse(l)), e.options !== void 0)) {
|
|
22
|
+
const S = e.options.length;
|
|
23
|
+
for (let m = 0; m < S && e.options[m].value !== l; m++)
|
|
24
|
+
;
|
|
25
|
+
}
|
|
26
|
+
f(l), e.onChange !== void 0 && e.onChange(e.prop !== void 0 ? e.prop : e.title, l);
|
|
27
|
+
}, y = {};
|
|
28
|
+
e.disabled && (y.opacity = 0.8);
|
|
29
|
+
const b = typeof i == "string" ? i : String(i ?? ""), u = e.type === "field" || e.type === "string" && (b.length > 100 || b.search(`
|
|
30
|
+
`) > -1), k = u || e.type === "image" || e.type === "vector2";
|
|
31
|
+
return /* @__PURE__ */ v("div", { className: `field ${k ? "block" : ""}`, style: y, children: [
|
|
32
|
+
e.type !== "button" && /* @__PURE__ */ t("span", { ref: c, children: C(e.title) }, "fieldLabel"),
|
|
33
|
+
e.type === "string" && !u && /* @__PURE__ */ t(
|
|
34
|
+
"input",
|
|
35
|
+
{
|
|
36
|
+
type: "text",
|
|
37
|
+
disabled: e.disabled,
|
|
38
|
+
onChange: a,
|
|
39
|
+
value: i,
|
|
40
|
+
name: o()
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
(e.type === "field" || e.type === "string" && u) && /* @__PURE__ */ t(
|
|
44
|
+
"textarea",
|
|
45
|
+
{
|
|
46
|
+
cols: 50,
|
|
47
|
+
rows: 10,
|
|
48
|
+
disabled: e.disabled !== void 0 ? e.disabled : !0,
|
|
49
|
+
onChange: a,
|
|
50
|
+
onKeyDown: (d) => {
|
|
51
|
+
e.onKeyDown !== void 0 && e.onKeyDown(d);
|
|
52
|
+
},
|
|
53
|
+
value: i,
|
|
54
|
+
name: o()
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
e.type === "boolean" && /* @__PURE__ */ t(
|
|
58
|
+
"input",
|
|
59
|
+
{
|
|
60
|
+
type: "checkbox",
|
|
61
|
+
disabled: e.disabled,
|
|
62
|
+
onChange: a,
|
|
63
|
+
checked: i,
|
|
64
|
+
name: o()
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
e.type === "number" && /* @__PURE__ */ t(
|
|
68
|
+
x,
|
|
69
|
+
{
|
|
70
|
+
value: i,
|
|
71
|
+
type: e.type,
|
|
72
|
+
prop: e.prop !== void 0 ? e.prop : e.title,
|
|
73
|
+
min: e.min,
|
|
74
|
+
max: e.max,
|
|
75
|
+
step: e.step,
|
|
76
|
+
disabled: e.disabled,
|
|
77
|
+
labelRef: c,
|
|
78
|
+
onChange: e.onChange
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
e.type === "range" && /* @__PURE__ */ t(
|
|
82
|
+
x,
|
|
83
|
+
{
|
|
84
|
+
value: i,
|
|
85
|
+
type: e.type,
|
|
86
|
+
prop: e.prop !== void 0 ? e.prop : e.title,
|
|
87
|
+
min: e.min,
|
|
88
|
+
max: e.max,
|
|
89
|
+
step: e.step,
|
|
90
|
+
disabled: e.disabled,
|
|
91
|
+
labelRef: c,
|
|
92
|
+
onChange: e.onChange
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
e.type === "color" && /* @__PURE__ */ v(g, { children: [
|
|
96
|
+
/* @__PURE__ */ t("input", { type: "text", value: i.toString(), onChange: a, disabled: e.disabled, className: "color", name: o() }),
|
|
97
|
+
/* @__PURE__ */ t("input", { type: "color", value: i, onChange: a, disabled: e.disabled, name: o() })
|
|
98
|
+
] }),
|
|
99
|
+
e.type === "button" && /* @__PURE__ */ t(
|
|
100
|
+
"button",
|
|
101
|
+
{
|
|
102
|
+
disabled: e.disabled,
|
|
103
|
+
onClick: () => {
|
|
104
|
+
e.onChange !== void 0 && e.onChange(e.prop !== void 0 ? e.prop : e.title, !0);
|
|
105
|
+
},
|
|
106
|
+
children: e.title
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
e.type === "image" && /* @__PURE__ */ t(F, { title: e.title, prop: e.prop, value: e.value, onChange: e.onChange }),
|
|
110
|
+
e.type === "option" && /* @__PURE__ */ t(g, { children: /* @__PURE__ */ t(
|
|
111
|
+
"select",
|
|
112
|
+
{
|
|
113
|
+
onChange: a,
|
|
114
|
+
disabled: e.disabled,
|
|
115
|
+
value: i,
|
|
116
|
+
name: o(),
|
|
117
|
+
children: e.options?.map((d, l) => /* @__PURE__ */ t("option", { value: d.value, children: C(d.title) }, l))
|
|
118
|
+
}
|
|
119
|
+
) }),
|
|
120
|
+
e.type === "vector2" && /* @__PURE__ */ t(r, { step: e.step, value: i, min: 0, max: 1, onChange: a }),
|
|
121
|
+
e.type === "grid3" && /* @__PURE__ */ t(I, { step: e.step, value: i, onChange: a }),
|
|
122
|
+
e.type === "grid4" && /* @__PURE__ */ t(D, { step: e.step, value: i, onChange: a }),
|
|
123
|
+
e.type === "euler" && /* @__PURE__ */ t(I, { step: e.step, value: i, onChange: a })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
T as default
|
|
128
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { Component as l, createRef as h } from "react";
|
|
3
|
+
import m from "../Accordion.js";
|
|
4
|
+
import g from "./InspectorField.js";
|
|
5
|
+
import { capitalize as f } from "../../utils.js";
|
|
6
|
+
function v(a) {
|
|
7
|
+
return "items" in a;
|
|
8
|
+
}
|
|
9
|
+
class i extends l {
|
|
10
|
+
subgroupNames = [];
|
|
11
|
+
subgroupElements = [];
|
|
12
|
+
valueOverrides = /* @__PURE__ */ new Map();
|
|
13
|
+
three;
|
|
14
|
+
constructor(t) {
|
|
15
|
+
super(t), this.three = t.three, this.state = { lastUpdated: Date.now() };
|
|
16
|
+
}
|
|
17
|
+
addGroup(t) {
|
|
18
|
+
const e = [];
|
|
19
|
+
t.items.forEach((s) => {
|
|
20
|
+
e.push({
|
|
21
|
+
type: s.type,
|
|
22
|
+
prop: s.prop,
|
|
23
|
+
title: s.title !== void 0 ? s.title : s.prop,
|
|
24
|
+
value: s.value,
|
|
25
|
+
min: s.min,
|
|
26
|
+
max: s.max,
|
|
27
|
+
step: s.step,
|
|
28
|
+
options: s.options,
|
|
29
|
+
disabled: s.disabled,
|
|
30
|
+
onChange: (n, u) => {
|
|
31
|
+
t.onUpdate(n, u);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
const o = h(), r = /* @__PURE__ */ p(
|
|
36
|
+
i,
|
|
37
|
+
{
|
|
38
|
+
three: this.props.three,
|
|
39
|
+
ref: o,
|
|
40
|
+
title: t.title,
|
|
41
|
+
expanded: t.expanded,
|
|
42
|
+
items: e
|
|
43
|
+
},
|
|
44
|
+
t.title
|
|
45
|
+
);
|
|
46
|
+
return this.subgroupNames.push(t.title), this.subgroupElements.push(r), this.setState({ lastUpdated: Date.now() }), o;
|
|
47
|
+
}
|
|
48
|
+
removeGroup(t) {
|
|
49
|
+
const e = this.subgroupNames.length;
|
|
50
|
+
for (let o = 0; o < e; o++) {
|
|
51
|
+
const r = this.subgroupNames[o];
|
|
52
|
+
if (t === r) {
|
|
53
|
+
this.subgroupNames.splice(o, 1), this.subgroupElements.splice(o, 1), this.setState({ lastUpdated: Date.now() });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
setField(t, e) {
|
|
59
|
+
this.valueOverrides.set(t, e), this.setState({ lastUpdated: Date.now() });
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
const t = [];
|
|
63
|
+
return this.props.items.forEach((e) => {
|
|
64
|
+
if (v(e))
|
|
65
|
+
t.push(
|
|
66
|
+
/* @__PURE__ */ p(i, { three: this.props.three, title: f(e.title), items: e.items }, e.title)
|
|
67
|
+
);
|
|
68
|
+
else {
|
|
69
|
+
const o = this.valueOverrides.get(e.title), r = o !== void 0 ? o : e.value;
|
|
70
|
+
t.push(
|
|
71
|
+
/* @__PURE__ */ p(
|
|
72
|
+
g,
|
|
73
|
+
{
|
|
74
|
+
title: e.title,
|
|
75
|
+
prop: e.prop,
|
|
76
|
+
value: r,
|
|
77
|
+
type: e.type,
|
|
78
|
+
min: e.min,
|
|
79
|
+
max: e.max,
|
|
80
|
+
step: e.step,
|
|
81
|
+
disabled: e.disabled,
|
|
82
|
+
options: e.options,
|
|
83
|
+
onChange: (s, n) => {
|
|
84
|
+
e.onChange !== void 0 && (this.valueOverrides.delete(e.title), e.onChange(s, n));
|
|
85
|
+
},
|
|
86
|
+
onKeyDown: (s) => {
|
|
87
|
+
e.onKeyDown !== void 0 && e.onKeyDown(s);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
e.title
|
|
91
|
+
)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}), this.subgroupElements.forEach((e) => t.push(e)), /* @__PURE__ */ p(
|
|
95
|
+
m,
|
|
96
|
+
{
|
|
97
|
+
three: this.props.three,
|
|
98
|
+
label: this.props.title,
|
|
99
|
+
open: this.props.expanded === !0,
|
|
100
|
+
onToggle: (e) => {
|
|
101
|
+
this.props.onToggle && this.props?.onToggle(e);
|
|
102
|
+
},
|
|
103
|
+
children: t
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
i as default
|
|
110
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useState as L, useEffect as x } from "react";
|
|
2
|
+
function y(e) {
|
|
3
|
+
const [f, a] = L(e.defaultValue);
|
|
4
|
+
return x(() => {
|
|
5
|
+
let m = !1, l = -1, v = 0, t = e.defaultValue, r = !1;
|
|
6
|
+
const o = (n) => {
|
|
7
|
+
r = n.ctrlKey;
|
|
8
|
+
}, s = (n) => {
|
|
9
|
+
m = !0, v = Number(e.input.current?.value), l = n.clientX, document.addEventListener("mouseup", u, !1), document.addEventListener("mousemove", i, !1), document.addEventListener("contextmenu", u, !1);
|
|
10
|
+
}, i = (n) => {
|
|
11
|
+
if (!m) return;
|
|
12
|
+
const d = e.step !== void 0 ? e.step : 1, E = (n.clientX - l) * d * (r ? 10 : 1);
|
|
13
|
+
t = Number((v + E).toFixed(4)), e.min !== void 0 && (t = Math.max(t, e.min)), e.max !== void 0 && (t = Math.min(t, e.max)), e.onChange !== void 0 && e.onChange(t), a(t);
|
|
14
|
+
}, u = () => {
|
|
15
|
+
m = !1, document.removeEventListener("mouseup", u), document.removeEventListener("mousemove", i), document.removeEventListener("contextmenu", u);
|
|
16
|
+
}, c = (n) => {
|
|
17
|
+
const d = Number(n.target.value);
|
|
18
|
+
e.onChange !== void 0 && e.onChange(d), a(d);
|
|
19
|
+
};
|
|
20
|
+
return e.label.current?.addEventListener("mousedown", s, !1), e.sliderRef !== void 0 && e.sliderRef.current?.addEventListener("input", c), document.addEventListener("keydown", o, !1), document.addEventListener("keyup", o, !1), () => {
|
|
21
|
+
e.label.current?.removeEventListener("mousedown", s), e.sliderRef !== void 0 && e.sliderRef.current?.removeEventListener("input", c), document.removeEventListener("mouseup", u), document.removeEventListener("mousemove", i), document.removeEventListener("contextmenu", u), document.removeEventListener("keydown", o), document.addEventListener("keyup", o, !1);
|
|
22
|
+
};
|
|
23
|
+
}, []), f;
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
y as default
|
|
27
|
+
};
|