@tomorrowevening/hermes 0.1.39 → 0.1.41

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.
Files changed (67) hide show
  1. package/dist/{ThreeEditor-CTkjs-SY.js → ThreeEditor-jkqfXLb4.js} +16 -16
  2. package/dist/core/Application.js +77 -0
  3. package/dist/core/remote/BaseRemote.js +33 -0
  4. package/dist/core/remote/RemoteTheatre.js +253 -0
  5. package/dist/core/remote/RemoteThree.js +451 -0
  6. package/dist/core/types.js +7 -0
  7. package/dist/editor/Editor.js +12 -0
  8. package/dist/editor/HermesApp.js +24 -0
  9. package/dist/editor/ThreeEditor.js +25 -0
  10. package/dist/editor/components/Draggable.js +40 -0
  11. package/dist/editor/components/DraggableItem.js +25 -0
  12. package/dist/editor/components/Dropdown.js +32 -0
  13. package/dist/editor/components/DropdownItem.js +50 -0
  14. package/dist/editor/components/NavButton.js +7 -0
  15. package/dist/editor/components/content.js +4 -0
  16. package/dist/editor/components/icons/CloseIcon.js +9 -0
  17. package/dist/editor/components/icons/DragIcon.js +12 -0
  18. package/dist/editor/multiView/CameraWindow.js +64 -0
  19. package/dist/editor/multiView/DepthNodeMaterial.js +12 -0
  20. package/dist/editor/multiView/InfiniteGridHelper.js +31 -0
  21. package/dist/editor/multiView/InfiniteGridHelperGPU.js +31 -0
  22. package/dist/editor/multiView/InfiniteGridMaterial.js +137 -0
  23. package/dist/editor/multiView/InfiniteGridNodeMaterial.js +63 -0
  24. package/dist/editor/multiView/MultiView.js +890 -0
  25. package/dist/editor/multiView/Toggle.js +25 -0
  26. package/dist/editor/multiView/UVMaterial.js +60 -0
  27. package/dist/editor/multiView/UVNodeMaterial.js +10 -0
  28. package/dist/editor/sidePanel/Accordion.js +56 -0
  29. package/dist/editor/sidePanel/ChildObject.js +78 -0
  30. package/dist/editor/sidePanel/ContainerObject.js +11 -0
  31. package/dist/editor/sidePanel/DebugData.js +133 -0
  32. package/dist/editor/sidePanel/SidePanel.js +91 -0
  33. package/dist/editor/sidePanel/inspector/InspectGrid3.js +82 -0
  34. package/dist/editor/sidePanel/inspector/InspectGrid4.js +58 -0
  35. package/dist/editor/sidePanel/inspector/InspectImage.js +100 -0
  36. package/dist/editor/sidePanel/inspector/InspectNumber.js +76 -0
  37. package/dist/editor/sidePanel/inspector/InspectVector2.js +154 -0
  38. package/dist/editor/sidePanel/inspector/Inspector.js +95 -0
  39. package/dist/editor/sidePanel/inspector/InspectorField.js +128 -0
  40. package/dist/editor/sidePanel/inspector/InspectorGroup.js +110 -0
  41. package/dist/editor/sidePanel/inspector/utils/DragNumber.js +27 -0
  42. package/dist/editor/sidePanel/inspector/utils/InspectAnimation.js +99 -0
  43. package/dist/editor/sidePanel/inspector/utils/InspectCamera.js +91 -0
  44. package/dist/editor/sidePanel/inspector/utils/InspectLight.js +85 -0
  45. package/dist/editor/sidePanel/inspector/utils/InspectMaterial.js +861 -0
  46. package/dist/editor/sidePanel/inspector/utils/InspectTransform.js +93 -0
  47. package/dist/editor/sidePanel/utils.js +259 -0
  48. package/dist/editor/tools/Transform.js +77 -0
  49. package/dist/editor/tools/splineEditor/Spline.js +348 -0
  50. package/dist/editor/tools/splineEditor/index.js +193 -0
  51. package/dist/editor/utils.js +27 -0
  52. package/dist/hermes.cjs.js +8 -30
  53. package/dist/{index-BpKOzCuX.js → index-DZmiM5y-.js} +617 -617
  54. package/dist/index.html +1 -1
  55. package/dist/index.js +125 -0
  56. package/dist/utils/ImageSequenceCapturer.js +148 -0
  57. package/dist/utils/detectSettings.js +46 -0
  58. package/dist/utils/math.js +68 -0
  59. package/dist/utils/post.js +206 -0
  60. package/dist/utils/theatre.js +316 -0
  61. package/dist/utils/three.js +199 -0
  62. package/dist/webworkers/EventHandling.js +115 -0
  63. package/dist/webworkers/ProxyManager.js +76 -0
  64. package/package.json +13 -7
  65. package/types/core/remote/RemoteThree.d.ts +10 -1
  66. package/dist/.vite/manifest.json +0 -12
  67. package/dist/hermes.es.js +0 -8077
@@ -0,0 +1,451 @@
1
+ import { Color as l, ColorManagement as p, WebGPURenderer as g, RenderTarget as v, WebGLRenderTarget as f } from "three/webgpu";
2
+ import E from "./BaseRemote.js";
3
+ import { clamp as S } from "../../utils/math.js";
4
+ import { dispose as u, hierarchyUUID as o, ExportTexture as h, resetThreeObjects as c } from "../../utils/three.js";
5
+ var b = /* @__PURE__ */ ((a) => (a.CUSTOM = "ToolEvents::custom", a.SELECT_DROPDOWN = "ToolEvents::selectDropdown", a.DRAG_UPDATE = "ToolEvents::dragUpdate", a.ADD_SCENE = "ToolEvents::addScene", a.REFRESH_SCENE = "ToolEvents::refreshScene", a.REMOVE_SCENE = "ToolEvents::removeScene", a.SET_SCENE = "ToolEvents::setScene", a.SET_OBJECT = "ToolEvents::setObject", a.CLEAR_OBJECT = "ToolEvents::clearObject", a.ADD_CAMERA = "ToolEvents::addCamera", a.REMOVE_CAMERA = "ToolEvents::removeCamera", a.ADD_GROUP = "ToolEvents::addGroup", a.REMOVE_GROUP = "ToolEvents::removeGroup", a.ADD_SPLINE = "ToolEvents::addSpline", a.ADD_RENDERER = "ToolEvents::addRenderer", a.UPDATE_RENDERER = "ToolEvents::updateRenderer", a))(b || {});
6
+ class O extends E {
7
+ name;
8
+ canvas = null;
9
+ // Canvas or OffscreenCanvas
10
+ inputElement = null;
11
+ // reference this to receive events
12
+ scene = void 0;
13
+ scenes = /* @__PURE__ */ new Map();
14
+ // scene instances
15
+ renderer = void 0;
16
+ renderTargets = /* @__PURE__ */ new Map();
17
+ renderTargetsResize = /* @__PURE__ */ new Map();
18
+ groups = /* @__PURE__ */ new Map();
19
+ _listeners = {};
20
+ editorUtils;
21
+ constructor(e, t = !1, r = !1) {
22
+ super("RemoteThree", t, r), this.name = e;
23
+ }
24
+ setEditorUtils(e) {
25
+ this.editorUtils = e;
26
+ }
27
+ dispose() {
28
+ this.scenes.forEach((e) => {
29
+ u(e);
30
+ }), this.scenes.clear(), this.scene && u(this.scene), this.renderTargets.forEach((e) => {
31
+ e.dispose();
32
+ }), this.renderTargets.clear(), this.renderer?.dispose();
33
+ }
34
+ // Event Dispatching (used for editor only)
35
+ addEventListener(e, t) {
36
+ this._listeners === void 0 && (this._listeners = {});
37
+ const r = this._listeners;
38
+ r[e] === void 0 && (r[e] = []), r[e].indexOf(t) === -1 && r[e].push(t);
39
+ }
40
+ hasEventListener(e, t) {
41
+ const r = this._listeners;
42
+ return r === void 0 ? !1 : r[e] !== void 0 && r[e].indexOf(t) !== -1;
43
+ }
44
+ removeEventListener(e, t) {
45
+ const r = this._listeners;
46
+ if (r === void 0) return;
47
+ const s = r[e];
48
+ if (s !== void 0) {
49
+ const d = s.indexOf(t);
50
+ d !== -1 && s.splice(d, 1);
51
+ }
52
+ }
53
+ dispatchEvent(e) {
54
+ const t = this._listeners;
55
+ if (t === void 0) return;
56
+ const r = t[e.type];
57
+ if (r !== void 0) {
58
+ const s = { ...e, target: this }, d = r.slice(0);
59
+ for (let i = 0, n = d.length; i < n; i++)
60
+ d[i].call(this, s);
61
+ }
62
+ }
63
+ // Objects
64
+ /**
65
+ * Searches ALL active scenes
66
+ */
67
+ getObjectByUUID(e) {
68
+ const t = e.split(".")[0], r = this.scenes.get(t);
69
+ if (r !== void 0)
70
+ return r.getObjectByProperty("uuid", e);
71
+ }
72
+ getObject(e) {
73
+ if (!this.debug) return;
74
+ this.renderer !== void 0 && (h.renderer = this.renderer);
75
+ const t = this.getObjectByUUID(e);
76
+ t && this.setObject(t);
77
+ }
78
+ setObject(e) {
79
+ if (!this.editorUtils) return;
80
+ this.renderer !== void 0 && (h.renderer = this.renderer);
81
+ const t = this.editorUtils.stripObject(e);
82
+ this.dispatchEvent({ type: "ToolEvents::setObject", value: t });
83
+ }
84
+ requestMethod(e, t, r, s) {
85
+ const d = this.getObjectByUUID(e);
86
+ if (d)
87
+ try {
88
+ if (s !== void 0) {
89
+ const i = this.editorUtils?.getSubItem(d, s);
90
+ i !== void 0 && i[t](r);
91
+ } else
92
+ d[t](r);
93
+ } catch (i) {
94
+ console.log("Hermes - Error requesting method:", e, t, r), console.log(i);
95
+ }
96
+ }
97
+ updateObject(e, t, r) {
98
+ this.send({
99
+ event: "updateObject",
100
+ target: "app",
101
+ // used by both
102
+ data: {
103
+ uuid: e,
104
+ key: t,
105
+ value: r
106
+ }
107
+ });
108
+ }
109
+ createTexture(e, t, r) {
110
+ this.send({
111
+ event: "createTexture",
112
+ target: "app",
113
+ // used by both
114
+ data: {
115
+ uuid: e,
116
+ key: t,
117
+ value: r
118
+ }
119
+ });
120
+ }
121
+ onUpdateObject(e, t, r) {
122
+ const s = this.getObjectByUUID(e);
123
+ s && this.editorUtils?.setItemProps(s, t, r);
124
+ }
125
+ onCreateTexture(e, t, r) {
126
+ if (!this.editorUtils) return;
127
+ const s = this.getObjectByUUID(e);
128
+ if (s) {
129
+ const d = (i) => {
130
+ const n = t.split(".");
131
+ switch (n.length) {
132
+ case 1:
133
+ s[n[0]] = i;
134
+ break;
135
+ case 2:
136
+ s[n[0]][n[1]] = i;
137
+ break;
138
+ case 3:
139
+ s[n[0]][n[1]][n[2]] = i;
140
+ break;
141
+ case 4:
142
+ s[n[0]][n[1]][n[2]][n[3]] = i;
143
+ break;
144
+ case 5:
145
+ s[n[0]][n[1]][n[2]][n[3]][n[4]] = i;
146
+ break;
147
+ }
148
+ s.material.needsUpdate = !0;
149
+ };
150
+ r.src.length > 0 ? this.editorUtils.textureFromSrc(r.src).then((i) => {
151
+ i.offset.set(r.offset[0], r.offset[1]), i.repeat.set(r.repeat[0], r.repeat[1]), d(i);
152
+ }) : d(null);
153
+ }
154
+ }
155
+ // Groups
156
+ addGroup(e) {
157
+ this.groups.get(e.title) === void 0 && (this.groups.set(e.title, {
158
+ title: e.title,
159
+ onUpdate: e.onUpdate
160
+ }), this.send({
161
+ event: "addGroup",
162
+ target: "editor",
163
+ data: JSON.stringify(e)
164
+ }));
165
+ }
166
+ removeGroup(e) {
167
+ this.groups.get(e) !== void 0 && (this.groups.delete(e), this.send({
168
+ event: "removeGroup",
169
+ target: "editor",
170
+ data: e
171
+ }));
172
+ }
173
+ updateGroup(e, t, r) {
174
+ this.send({
175
+ event: "updateGroup",
176
+ target: "app",
177
+ data: JSON.stringify({ group: e, prop: t, value: r })
178
+ });
179
+ }
180
+ addSplineCurve(e) {
181
+ setTimeout(() => {
182
+ this.send({
183
+ event: "addSpline",
184
+ target: "editor",
185
+ data: JSON.stringify(e.toJSON())
186
+ });
187
+ }, 1);
188
+ }
189
+ addSplineObject(e) {
190
+ setTimeout(() => {
191
+ this.send({
192
+ event: "addSpline",
193
+ target: "editor",
194
+ data: JSON.stringify(e)
195
+ });
196
+ }, 1);
197
+ }
198
+ // Renderer
199
+ setRenderer(e, t = null) {
200
+ if (this.renderer = e, this.canvas = e.domElement, this.inputElement = t !== null ? t : this.canvas, !this.debug) return;
201
+ const r = `#${e.getClearColor(new l()).getHexString()}`;
202
+ this.send({
203
+ event: "addRenderer",
204
+ target: "editor",
205
+ data: {
206
+ autoClearColor: e.autoClearColor,
207
+ outputColorSpace: e.outputColorSpace,
208
+ clearColor: r,
209
+ clearAlpha: e.getClearAlpha(),
210
+ colorManagement: p.enabled,
211
+ toneMapping: e.toneMapping,
212
+ toneMappingExposure: e.toneMappingExposure,
213
+ type: e.isWebGLRenderer ? "WebGLRenderer" : "WebGPURenderer"
214
+ }
215
+ });
216
+ }
217
+ updateRenderer(e) {
218
+ this.send({
219
+ event: "updateRenderer",
220
+ target: "app",
221
+ data: e
222
+ });
223
+ }
224
+ // Scenes
225
+ addScene(e) {
226
+ if (e === void 0 || (this.scenes.set(e.name, e), !this.debug || !this.editorUtils)) return;
227
+ c(), o(e);
228
+ const t = this.editorUtils.stripScene(e);
229
+ this.send({
230
+ event: "addScene",
231
+ target: "editor",
232
+ data: t
233
+ });
234
+ }
235
+ refreshScene(e) {
236
+ if (!this.debug || !this.editorUtils) return;
237
+ const t = this.scenes.get(e);
238
+ if (t !== void 0) {
239
+ const r = this.editorUtils.stripScene(t);
240
+ this.send({
241
+ event: "refreshScene",
242
+ target: "app",
243
+ data: r
244
+ });
245
+ }
246
+ }
247
+ removeScene(e) {
248
+ if (e === void 0 || (this.scenes.delete(e.name), !this.debug || !this.editorUtils)) return;
249
+ const t = this.editorUtils.stripScene(e);
250
+ this.send({
251
+ event: "removeScene",
252
+ target: "editor",
253
+ data: t
254
+ });
255
+ }
256
+ removeAllScenes() {
257
+ this.scenes.forEach((e) => this.removeScene(e));
258
+ }
259
+ getScene(e) {
260
+ let t = null;
261
+ return this.scene !== void 0 && this.scene.uuid.search(e) > -1 ? this.scene : (this.scenes.forEach((r, s) => {
262
+ e.search(s) > -1 && (t = r);
263
+ }), t);
264
+ }
265
+ setScene(e) {
266
+ if (e === void 0 || (this.scene = e, !this.debug || !this.editorUtils)) return;
267
+ this.renderer !== void 0 && (h.renderer = this.renderer), c(), o(e);
268
+ const t = this.editorUtils.stripScene(e);
269
+ this.send({
270
+ event: "setScene",
271
+ target: "editor",
272
+ data: t
273
+ });
274
+ }
275
+ requestSize() {
276
+ this.send({
277
+ event: "requestSize",
278
+ target: "app"
279
+ });
280
+ }
281
+ requestRenderer() {
282
+ this.send({
283
+ event: "requestRenderer",
284
+ target: "app"
285
+ });
286
+ }
287
+ requestScene() {
288
+ this.send({
289
+ event: "requestScene",
290
+ target: "app"
291
+ });
292
+ }
293
+ // Cameras
294
+ addCamera(e) {
295
+ if (!this.debug || !this.editorUtils) return;
296
+ const t = this.editorUtils.stripObject(e);
297
+ this.send({
298
+ event: "addCamera",
299
+ target: "editor",
300
+ data: t
301
+ });
302
+ }
303
+ removeCamera(e) {
304
+ if (!this.debug || !this.editorUtils) return;
305
+ const t = this.editorUtils.stripObject(e);
306
+ this.send({
307
+ event: "removeCamera",
308
+ target: "editor",
309
+ data: t
310
+ });
311
+ }
312
+ handleApp(e) {
313
+ switch (e.event) {
314
+ case "refreshScene":
315
+ this.editorUtils && this.send({
316
+ event: "refreshScene",
317
+ target: "editor",
318
+ data: this.editorUtils.stripScene(this.scenes.get(e.data.name))
319
+ });
320
+ break;
321
+ case "updateRenderer":
322
+ this.renderer && (this.renderer.autoClearColor = e.data.autoClearColor, this.renderer.outputColorSpace = e.data.outputColorSpace, this.renderer.setClearColor(e.data.clearColor, e.data.clearAlpha), this.renderer.toneMapping = e.data.toneMapping, this.renderer.toneMappingExposure = e.data.toneMappingExposure, p.enabled = e.data.colorManagement);
323
+ break;
324
+ case "requestRenderer":
325
+ if (this.renderer !== void 0) {
326
+ const t = `#${this.renderer.getClearColor(new l()).getHexString()}`;
327
+ this.send({
328
+ event: "addRenderer",
329
+ target: "editor",
330
+ data: {
331
+ autoClearColor: this.renderer.autoClearColor,
332
+ outputColorSpace: this.renderer.outputColorSpace,
333
+ clearColor: t,
334
+ clearAlpha: this.renderer.getClearAlpha(),
335
+ colorManagement: p.enabled,
336
+ toneMapping: this.renderer.toneMapping,
337
+ toneMappingExposure: this.renderer.toneMappingExposure,
338
+ type: this.renderer.isWebGLRenderer ? "WebGLRenderer" : "WebGPURenderer"
339
+ }
340
+ });
341
+ }
342
+ break;
343
+ case "requestScene":
344
+ this.editorUtils && (this.scenes.forEach((t) => {
345
+ c(), o(t), this.send({
346
+ event: "addScene",
347
+ target: "editor",
348
+ data: this.editorUtils.stripScene(t)
349
+ });
350
+ }), this.scene !== void 0 && (this.renderer !== void 0 && (h.renderer = this.renderer), c(), o(this.scene), this.send({
351
+ event: "setScene",
352
+ target: "editor",
353
+ data: this.editorUtils.stripScene(this.scene)
354
+ })));
355
+ break;
356
+ }
357
+ if (e.event === "updateGroup") {
358
+ const t = JSON.parse(e.data);
359
+ this.groups.get(t.group)?.onUpdate(t.prop, t.value);
360
+ }
361
+ }
362
+ handleEditor(e) {
363
+ switch (e.event) {
364
+ case "addScene":
365
+ this.dispatchEvent({ type: "ToolEvents::addScene", value: e.data });
366
+ break;
367
+ case "refreshScene":
368
+ this.dispatchEvent({ type: "ToolEvents::refreshScene", value: e.data });
369
+ break;
370
+ case "removeScene":
371
+ this.dispatchEvent({ type: "ToolEvents::removeScene", value: e.data });
372
+ break;
373
+ case "setScene":
374
+ this.dispatchEvent({ type: "ToolEvents::setScene", value: e.data });
375
+ break;
376
+ case "addCamera":
377
+ this.dispatchEvent({ type: "ToolEvents::addCamera", value: e.data });
378
+ break;
379
+ case "removeCamera":
380
+ this.dispatchEvent({ type: "ToolEvents::removeCamera", value: e.data });
381
+ break;
382
+ case "addGroup":
383
+ this.dispatchEvent({ type: "ToolEvents::addGroup", value: e.data });
384
+ break;
385
+ case "removeGroup":
386
+ this.dispatchEvent({ type: "ToolEvents::removeGroup", value: e.data });
387
+ break;
388
+ case "addSpline":
389
+ this.dispatchEvent({ type: "ToolEvents::addSpline", value: e.data });
390
+ break;
391
+ case "addRenderer":
392
+ this.dispatchEvent({ type: "ToolEvents::addRenderer", value: e.data });
393
+ }
394
+ }
395
+ messageHandler(e) {
396
+ const t = e.data;
397
+ if (t.event === "updateObject") {
398
+ this.onUpdateObject(t.data.uuid, t.data.key, t.data.value);
399
+ return;
400
+ } else if (t.event === "createTexture") {
401
+ this.onCreateTexture(t.data.uuid, t.data.key, t.data.value);
402
+ return;
403
+ } else if (t.event === "requestSize") {
404
+ t.target === "app" ? this.send({
405
+ event: "requestSize",
406
+ target: "editor",
407
+ data: {
408
+ width: this.width,
409
+ height: this.height
410
+ }
411
+ }) : this.scenes.forEach((r) => {
412
+ r.resize !== void 0 && r.resize(t.data.width, t.data.height);
413
+ });
414
+ return;
415
+ }
416
+ t.target === "app" ? this.handleApp(t) : this.handleEditor(t);
417
+ }
418
+ // Renderer
419
+ addRT(e, t = !0, r) {
420
+ if (!this.renderer) return;
421
+ let s;
422
+ this.renderer instanceof g ? s = new v(32, 32, r) : s = new f(32, 32, r), s.texture.name = e, this.renderTargets.set(e, s), this.renderTargetsResize.set(e, t);
423
+ }
424
+ removeRT(e) {
425
+ this.renderTargets.delete(e), this.renderTargetsResize.delete(e);
426
+ }
427
+ resize(e, t) {
428
+ const r = this.dpr;
429
+ this.renderTargets.forEach((d, i) => {
430
+ this.renderTargetsResize.get(i) && d.setSize(e * r, t * r);
431
+ });
432
+ const s = !(this.renderer?.domElement instanceof OffscreenCanvas);
433
+ this.renderer?.setSize(e, t, s);
434
+ }
435
+ set dpr(e) {
436
+ this.renderer?.setPixelRatio(S(1, 2, e));
437
+ }
438
+ get dpr() {
439
+ return this.renderer !== void 0 ? this.renderer?.getPixelRatio() : 1;
440
+ }
441
+ get width() {
442
+ return this.renderer !== void 0 ? this.renderer.domElement.width / this.dpr : 0;
443
+ }
444
+ get height() {
445
+ return this.renderer !== void 0 ? this.renderer.domElement.height / this.dpr : 0;
446
+ }
447
+ }
448
+ export {
449
+ b as ToolEvents,
450
+ O as default
451
+ };
@@ -0,0 +1,7 @@
1
+ const o = () => {
2
+ }, t = () => {
3
+ };
4
+ export {
5
+ t as defaultTheatreCallback,
6
+ o as noop
7
+ };
@@ -0,0 +1,12 @@
1
+ import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as a } from "react";
3
+ /* empty css */
4
+ const i = a((e, d) => /* @__PURE__ */ t("div", { className: "editor", ref: d, style: e.style, children: [
5
+ e.header && /* @__PURE__ */ r("div", { className: "header", children: e.header }),
6
+ e.children,
7
+ e.footer && /* @__PURE__ */ r("div", { className: "footer", children: e.footer })
8
+ ] }));
9
+ i.displayName = "Editor";
10
+ export {
11
+ i as default
12
+ };
@@ -0,0 +1,24 @@
1
+ import { jsx as t, Fragment as r } from "react/jsx-runtime";
2
+ import { useState as u, useEffect as l } from "react";
3
+ function m(i) {
4
+ const {
5
+ app: e,
6
+ renderEditor: n,
7
+ onLoad: o,
8
+ renderLoading: s = null,
9
+ children: c
10
+ } = i, [a, d] = u(!1);
11
+ if (l(() => {
12
+ e.detectSettings().then(() => {
13
+ o ? o(e).then(() => d(!0)) : d(!0);
14
+ });
15
+ }, []), !a) return /* @__PURE__ */ t(r, { children: s });
16
+ if (e.editor && n) {
17
+ const f = e.components.get("three");
18
+ return /* @__PURE__ */ t(r, { children: n(f) });
19
+ }
20
+ return /* @__PURE__ */ t(r, { children: c?.(e) });
21
+ }
22
+ export {
23
+ m as default
24
+ };
@@ -0,0 +1,25 @@
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { useEffect as i } from "react";
3
+ import n from "./Editor.js";
4
+ import o from "./multiView/MultiView.js";
5
+ import c from "./sidePanel/SidePanel.js";
6
+ import { textureFromSrc as m, setItemProps as d, getSubItem as s, stripScene as S, stripObject as f } from "./sidePanel/utils.js";
7
+ const h = { stripObject: f, stripScene: S, getSubItem: s, setItemProps: d, textureFromSrc: m };
8
+ function I(e) {
9
+ return i(() => (e.three.setEditorUtils(h), () => e.three.setEditorUtils(void 0)), [e.three]), /* @__PURE__ */ r(n, { children: [
10
+ /* @__PURE__ */ t(
11
+ o,
12
+ {
13
+ three: e.three,
14
+ scenes: e.scenes,
15
+ onSceneAdd: e.onSceneAdd,
16
+ onSceneResize: e.onSceneResize,
17
+ onSceneUpdate: e.onSceneUpdate
18
+ }
19
+ ),
20
+ /* @__PURE__ */ t(c, { three: e.three })
21
+ ] });
22
+ }
23
+ export {
24
+ I as default
25
+ };
@@ -0,0 +1,40 @@
1
+ import { jsxs as x, jsx as r } from "react/jsx-runtime";
2
+ import { useState as l } from "react";
3
+ import I from "./NavButton.js";
4
+ import v from "./DraggableItem.js";
5
+ function E(n) {
6
+ const [g, d] = l(!1), [o, i] = l(n.options), [s, a] = l(null), m = (e) => {
7
+ n.onDragComplete(e), i(e);
8
+ }, u = (e) => {
9
+ const t = [...o];
10
+ t.splice(e, 1), m(t);
11
+ }, p = (e) => {
12
+ a(e);
13
+ }, f = (e) => {
14
+ if (s === e || s === null) return;
15
+ const t = [...o], b = t.splice(s, 1)[0];
16
+ t.splice(e, 0, b), a(e), i(t);
17
+ }, D = () => {
18
+ n.onDragComplete(o), a(null);
19
+ };
20
+ let c = "dropdown draggable";
21
+ return n.subdropdown && (c += " subdropdown"), /* @__PURE__ */ x("div", { className: c, onMouseEnter: () => d(!0), onMouseLeave: () => d(!1), children: [
22
+ /* @__PURE__ */ r(I, { title: n.title }),
23
+ /* @__PURE__ */ r("ul", { className: "reorder-list", style: { display: g ? "block" : "none" }, children: o.map((e, t) => /* @__PURE__ */ r(
24
+ v,
25
+ {
26
+ title: e,
27
+ index: t,
28
+ draggingIndex: s,
29
+ onDelete: u,
30
+ onDragStart: p,
31
+ onDragOver: f,
32
+ onDragEnd: D
33
+ },
34
+ e
35
+ )) })
36
+ ] });
37
+ }
38
+ export {
39
+ E as default
40
+ };
@@ -0,0 +1,25 @@
1
+ import { jsx as n, jsxs as a } from "react/jsx-runtime";
2
+ import t from "./icons/CloseIcon.js";
3
+ import i from "./icons/DragIcon.js";
4
+ function o(e) {
5
+ return /* @__PURE__ */ n(
6
+ "li",
7
+ {
8
+ className: `reorder-item ${e.draggingIndex === e.index ? "dragging" : ""}`,
9
+ draggable: !0,
10
+ onDragStart: () => e.onDragStart(e.index),
11
+ onDragOver: (r) => {
12
+ r.preventDefault(), e.onDragOver(e.index);
13
+ },
14
+ onDragEnd: e.onDragEnd,
15
+ children: /* @__PURE__ */ a("div", { children: [
16
+ i,
17
+ /* @__PURE__ */ n("span", { children: e.title }),
18
+ /* @__PURE__ */ n("button", { className: "closeIcon", onClick: () => e.onDelete(e.index), children: t })
19
+ ] })
20
+ }
21
+ );
22
+ }
23
+ export {
24
+ o as default
25
+ };
@@ -0,0 +1,32 @@
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { useState as a } from "react";
3
+ import m from "./NavButton.js";
4
+ import u from "./DropdownItem.js";
5
+ function w(e) {
6
+ const [s, o] = a(!1), n = [];
7
+ e.options.map((i, l) => {
8
+ e.onSelect !== void 0 && (i.onSelect = e.onSelect), n.push(/* @__PURE__ */ t(u, { option: i }, l));
9
+ });
10
+ let d = "dropdown";
11
+ return e.subdropdown && (d += " subdropdown"), /* @__PURE__ */ r(
12
+ "div",
13
+ {
14
+ className: d,
15
+ onMouseEnter: () => o(!0),
16
+ onMouseLeave: () => o(!1),
17
+ children: [
18
+ /* @__PURE__ */ t(m, { title: e.title }),
19
+ /* @__PURE__ */ t(
20
+ "ul",
21
+ {
22
+ style: { visibility: s ? "visible" : "hidden" },
23
+ children: n
24
+ }
25
+ )
26
+ ]
27
+ }
28
+ );
29
+ }
30
+ export {
31
+ w as default
32
+ };
@@ -0,0 +1,50 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useState as a } from "react";
3
+ import s from "./Draggable.js";
4
+ import c from "./Dropdown.js";
5
+ import { randomID as p } from "../utils.js";
6
+ function g(i) {
7
+ const { option: e } = i, [l, r] = a("");
8
+ let t;
9
+ switch (e.type) {
10
+ case "draggable":
11
+ t = /* @__PURE__ */ o(
12
+ s,
13
+ {
14
+ title: e.title,
15
+ options: e.value,
16
+ onDragComplete: (n) => {
17
+ e.onDragComplete !== void 0 && e.onDragComplete(n);
18
+ },
19
+ subdropdown: !0
20
+ }
21
+ );
22
+ break;
23
+ case "dropdown":
24
+ t = /* @__PURE__ */ o(
25
+ c,
26
+ {
27
+ title: e.title,
28
+ options: e.value,
29
+ onSelect: e.onSelect,
30
+ subdropdown: !0
31
+ }
32
+ );
33
+ break;
34
+ case "option":
35
+ t = /* @__PURE__ */ o(
36
+ "button",
37
+ {
38
+ onClick: () => {
39
+ e.onSelect !== void 0 && e.onSelect(e.value), e.selectable && (l !== e.title ? r(e.title) : r(""));
40
+ },
41
+ children: e.title
42
+ }
43
+ );
44
+ break;
45
+ }
46
+ return /* @__PURE__ */ o("li", { className: l === e.title ? "selected" : "", children: t }, p());
47
+ }
48
+ export {
49
+ g as default
50
+ };
@@ -0,0 +1,7 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ function l(t) {
3
+ return t.title.search("<") > -1 ? /* @__PURE__ */ e("button", { className: "svg", dangerouslySetInnerHTML: { __html: t.title } }) : /* @__PURE__ */ e("button", { children: t.title });
4
+ }
5
+ export {
6
+ l as default
7
+ };
@@ -0,0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