@tomorrowevening/hermes 0.0.152 → 0.0.153

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/README.md CHANGED
@@ -1,9 +1,85 @@
1
1
  # Hermes
2
2
 
3
- An extendable set of Web Tools controlled via a separate window for non-intereference with content.
3
+ An extendable set of Web Tools controlled over a separate window for non-intereference with content (like a remote controller!)
4
4
 
5
5
  Open the [Application](https://hermes-lovat.vercel.app/) and [editor](https://hermes-lovat.vercel.app/#editor) side-by-side.
6
6
 
7
+ ## Setup
8
+
9
+ This example uses [React](https://react.dev/), [ThreeJS](https://threejs.org/), and [TheatreJS](https://theatrejs.com/), and will default to using `BroadcastChannel` instead of `WebSocket` for simplicity.
10
+
11
+ ### Create an `Application`
12
+
13
+ This acts as the Remote Controller between all components.
14
+
15
+ The `CustomEditor` is used as a multi-view editor for [ThreeJS](https://threejs.org/), and should be limited to only the Editor app.
16
+
17
+ ```
18
+ export default function AppWrapper() {
19
+ const [app, setApp] = useState<Application | null>(null);
20
+
21
+ useEffect(() => {
22
+ const IS_DEV = true;
23
+ const IS_EDITOR = IS_DEV && document.location.hash.search('editor') > -1;
24
+ const instance = new Application('My App');
25
+ instance.detectSettings(IS_DEV, IS_EDITOR).then(() => {
26
+ if (IS_DEV) instance.setupRemote();
27
+ instance.addComponent('theatre', new RemoteTheatre(instance));
28
+ instance.addComponent('three', new RemoteThree(instance));
29
+ setApp(instance);
30
+ });
31
+ }, []);
32
+
33
+ return (
34
+ <>
35
+ {app !== null && (
36
+ <>
37
+ {app.debugEnabled && <RemoteSetup app={app} />}
38
+ {app.editor && <CustomEditor app={app} />}
39
+ <Wrapper app={app} />
40
+ </>
41
+ )}
42
+ </>
43
+ );
44
+ }
45
+ ```
46
+
47
+ ### Custom remote commands
48
+
49
+ This component is added only in debug-mode to add extra support for remote-components.
50
+
51
+ In this example it's added to add custom Remote Component support for:
52
+
53
+ - [ThreeJS](https://threejs.org/) - `SceneInspector` communicates with the Multi-view editor
54
+ - [TheatreJS](https://theatrejs.com/) - Communicates with the `studio` instance
55
+
56
+ ```
57
+ type RemoteProps = {
58
+ app: Application
59
+ }
60
+
61
+ export default function RemoteSetup(props: RemoteProps) {
62
+ const app = props.app;
63
+ const three = app.components.get('three') as RemoteThree;
64
+
65
+ // Remote Theatre setup
66
+ const theatre = app.components.get('theatre') as RemoteTheatre;
67
+ theatre.studio = studio;
68
+ theatre.handleEditorApp();
69
+
70
+ // Custom component support (optional)
71
+ app.addComponent('components', new RemoteComponents(app));
72
+
73
+ return (
74
+ <>
75
+ {app.debugEnabled ? <SceneInspector app={app} three={three} /> : null}
76
+ </>
77
+ );
78
+ }
79
+ ```
80
+
81
+ ## Editor
82
+
7
83
  ### Tools for:
8
84
 
9
85
  - Customizable Navigation Dropdowns + Draggable components for Triggers/Event Dispatching
@@ -11,7 +87,7 @@ Open the [Application](https://hermes-lovat.vercel.app/) and [editor](https://he
11
87
  - [ThreeJS](https://threejs.org/)
12
88
  - Custom ThreeJS Scene + Object Inspector
13
89
 
14
- ### MultiView
90
+ ### ThreeJS Editor
15
91
 
16
92
  | Action | Keys |
17
93
  | ------ | ------ |