@tomorrowevening/hermes 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +10 -0
- package/dist/hermes.js +1202 -0
- package/dist/hermes.umd.cjs +29 -0
- package/dist/images/debug/icon_camera.png +0 -0
- package/dist/images/debug/icon_folder.png +0 -0
- package/dist/images/debug/icon_interactive.png +0 -0
- package/dist/images/debug/icon_lights.png +0 -0
- package/dist/images/debug/icon_refresh.png +0 -0
- package/dist/images/debug/icon_ui.png +0 -0
- package/dist/images/debug/icon_utils.png +0 -0
- package/dist/images/debug/icon_world.png +0 -0
- package/dist/style.css +1 -0
- package/package.json +63 -0
- package/src/core/Application.ts +69 -0
- package/src/core/RemoteController.ts +135 -0
- package/src/core/remote/BaseRemote.ts +16 -0
- package/src/core/remote/RemoteComponents.ts +32 -0
- package/src/core/remote/RemoteTheatre.ts +117 -0
- package/src/core/remote/RemoteTweakpane.ts +176 -0
- package/src/core/types.ts +43 -0
- package/src/editor/Editor.tsx +15 -0
- package/src/editor/components/Draggable.tsx +40 -0
- package/src/editor/components/DraggableItem.tsx +22 -0
- package/src/editor/components/Dropdown.tsx +30 -0
- package/src/editor/components/DropdownItem.tsx +64 -0
- package/src/editor/components/NavButton.tsx +11 -0
- package/src/editor/components/icons/CloseIcon.tsx +7 -0
- package/src/editor/components/icons/DragIcon.tsx +9 -0
- package/src/editor/components/types.ts +41 -0
- package/src/editor/global.ts +13 -0
- package/src/editor/sceneHierarchy/ChildObject.tsx +56 -0
- package/src/editor/sceneHierarchy/ContainerObject.tsx +12 -0
- package/src/editor/sceneHierarchy/SceneHierarchy.tsx +77 -0
- package/src/editor/sceneHierarchy/types.ts +10 -0
- package/src/editor/sceneHierarchy/utils.ts +25 -0
- package/src/editor/scss/_debug.scss +68 -0
- package/src/editor/scss/_draggable.scss +43 -0
- package/src/editor/scss/_dropdown.scss +83 -0
- package/src/editor/scss/_sceneHierarchy.scss +170 -0
- package/src/editor/scss/_theme.scss +9 -0
- package/src/editor/scss/index.scss +58 -0
- package/src/editor/utils.ts +20 -0
- package/src/example/App.css +6 -0
- package/src/example/App.tsx +88 -0
- package/src/example/constants.ts +13 -0
- package/src/example/index.scss +37 -0
- package/src/example/main.tsx +75 -0
- package/src/library.ts +16 -0
- package/src/vite-env.d.ts +1 -0
- package/types/core/Application.d.ts +21 -0
- package/types/core/RemoteController.d.ts +2 -0
- package/types/core/remote/BaseRemote.d.ts +6 -0
- package/types/core/remote/RemoteComponents.d.ts +7 -0
- package/types/core/remote/RemoteDebug.d.ts +23 -0
- package/types/core/remote/RemoteTheatre.d.ts +16 -0
- package/types/core/remote/RemoteTweakpane.d.ts +23 -0
- package/types/core/types.d.ts +13 -0
- package/types/debug/Editor.d.ts +8 -0
- package/types/debug/components/Draggable.d.ts +2 -0
- package/types/debug/components/DraggableItem.d.ts +2 -0
- package/types/debug/components/Dropdown.d.ts +2 -0
- package/types/debug/components/DropdownItem.d.ts +2 -0
- package/types/debug/components/NavButton.d.ts +5 -0
- package/types/debug/components/icons/CloseIcon.d.ts +2 -0
- package/types/debug/components/icons/DragIcon.d.ts +2 -0
- package/types/debug/components/types.d.ts +31 -0
- package/types/debug/global.d.ts +9 -0
- package/types/debug/sceneHierarchy/ChildObject.d.ts +2 -0
- package/types/debug/sceneHierarchy/ContainerObject.d.ts +2 -0
- package/types/debug/sceneHierarchy/SceneHierarchy.d.ts +13 -0
- package/types/debug/sceneHierarchy/types.d.ts +8 -0
- package/types/debug/sceneHierarchy/utils.d.ts +2 -0
- package/types/debug/utils.d.ts +4 -0
- package/types/editor/Editor.d.ts +8 -0
- package/types/editor/components/Draggable.d.ts +2 -0
- package/types/editor/components/DraggableItem.d.ts +2 -0
- package/types/editor/components/Dropdown.d.ts +2 -0
- package/types/editor/components/DropdownItem.d.ts +2 -0
- package/types/editor/components/NavButton.d.ts +5 -0
- package/types/editor/components/icons/CloseIcon.d.ts +2 -0
- package/types/editor/components/icons/DragIcon.d.ts +2 -0
- package/types/editor/components/types.d.ts +31 -0
- package/types/editor/global.d.ts +9 -0
- package/types/editor/sceneHierarchy/ChildObject.d.ts +2 -0
- package/types/editor/sceneHierarchy/ContainerObject.d.ts +2 -0
- package/types/editor/sceneHierarchy/SceneHierarchy.d.ts +13 -0
- package/types/editor/sceneHierarchy/types.d.ts +8 -0
- package/types/editor/sceneHierarchy/utils.d.ts +2 -0
- package/types/editor/utils.d.ts +4 -0
- package/types/example/App.d.ts +3 -0
- package/types/example/constants.d.ts +3 -0
- package/types/example/main.d.ts +1 -0
- package/types/library.d.ts +14 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { IProjectConfig } from '@theatre/core';
|
2
|
+
import RemoteComponents from './remote/RemoteComponents';
|
3
|
+
import RemoteTheatre from './remote/RemoteTheatre';
|
4
|
+
import RemoteTweakpane from './remote/RemoteTweakpane';
|
5
|
+
import type { ApplicationMode, BroadcastCallback, BroadcastData } from './types';
|
6
|
+
export default class Application {
|
7
|
+
components?: RemoteComponents;
|
8
|
+
debug?: RemoteTweakpane;
|
9
|
+
theatre?: RemoteTheatre;
|
10
|
+
protected mode: ApplicationMode;
|
11
|
+
protected channel?: BroadcastChannel | undefined;
|
12
|
+
constructor(debugEnabled: boolean, editorHashtag: string);
|
13
|
+
setupComponents(): void;
|
14
|
+
setupGUI(): void;
|
15
|
+
setupTheatre(projectName: string, projectConfig?: IProjectConfig | undefined): void;
|
16
|
+
dispose(): void;
|
17
|
+
send(data: BroadcastData): void;
|
18
|
+
listen(callback: BroadcastCallback): void;
|
19
|
+
get editor(): boolean;
|
20
|
+
set editor(value: boolean);
|
21
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import Application from '../Application';
|
2
|
+
import BaseRemote from './BaseRemote';
|
3
|
+
export default class RemoteComponents extends BaseRemote {
|
4
|
+
constructor(app: Application);
|
5
|
+
selectDropdown(dropdown: string, value: any): void;
|
6
|
+
updateDropdown(dropdown: string, list: string[]): void;
|
7
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { Pane } from 'tweakpane';
|
2
|
+
import Application from '../Application';
|
3
|
+
import BaseRemote from './BaseRemote';
|
4
|
+
import type { DataUpdateCallback, VoidCallback } from '../types';
|
5
|
+
export default class RemoteDebug extends BaseRemote {
|
6
|
+
appTab: any;
|
7
|
+
systemTab: any;
|
8
|
+
utilsTab: any;
|
9
|
+
bindCBs: Map<string, DataUpdateCallback>;
|
10
|
+
buttonCBs: Map<string, VoidCallback>;
|
11
|
+
protected pane?: Pane | undefined;
|
12
|
+
protected appCallbacks: number;
|
13
|
+
protected editorCallbacks: number;
|
14
|
+
constructor(app: Application);
|
15
|
+
protected createGUI(): void;
|
16
|
+
dispose(): void;
|
17
|
+
addFolder(name: string, params?: any, parent?: any): any;
|
18
|
+
get bindID(): string;
|
19
|
+
bind(obj: any, name: string, params: any, parent?: any): void;
|
20
|
+
triggerBind(id: string, data: any): void;
|
21
|
+
button(name: string, callback: VoidCallback, parent?: any): void;
|
22
|
+
triggerButton(id: string): void;
|
23
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { IProject, IProjectConfig, ISheet, ISheetObject } from '@theatre/core';
|
2
|
+
import Application from '../Application';
|
3
|
+
import BaseRemote from './BaseRemote';
|
4
|
+
import type { DataUpdateCallback, VoidCallback } from '../types';
|
5
|
+
export default class RemoteTheatre extends BaseRemote {
|
6
|
+
project: IProject | undefined;
|
7
|
+
sheets: Map<string, ISheet>;
|
8
|
+
sheetObjects: Map<string, ISheetObject>;
|
9
|
+
sheetObjectCBs: Map<string, DataUpdateCallback>;
|
10
|
+
sheetObjectUnsubscribe: Map<string, VoidCallback>;
|
11
|
+
constructor(app: Application, projectName: string, projectConfig?: IProjectConfig | undefined);
|
12
|
+
dispose(): void;
|
13
|
+
sheet(name: string): ISheet | undefined;
|
14
|
+
sheetObject(sheetName: string, key: string, props: any, onUpdate?: DataUpdateCallback): ISheetObject | undefined;
|
15
|
+
unsubscribe(sheet: ISheetObject): undefined;
|
16
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { Pane } from 'tweakpane';
|
2
|
+
import Application from '../Application';
|
3
|
+
import BaseRemote from './BaseRemote';
|
4
|
+
import type { DataUpdateCallback, VoidCallback } from '../types';
|
5
|
+
export default class RemoteTweakpane extends BaseRemote {
|
6
|
+
appTab: any;
|
7
|
+
systemTab: any;
|
8
|
+
utilsTab: any;
|
9
|
+
bindCBs: Map<string, DataUpdateCallback>;
|
10
|
+
buttonCBs: Map<string, VoidCallback>;
|
11
|
+
protected pane?: Pane | undefined;
|
12
|
+
protected appCallbacks: number;
|
13
|
+
protected editorCallbacks: number;
|
14
|
+
constructor(app: Application);
|
15
|
+
protected createGUI(): void;
|
16
|
+
dispose(): void;
|
17
|
+
addFolder(name: string, params?: any, parent?: any): any;
|
18
|
+
get bindID(): string;
|
19
|
+
bind(obj: any, name: string, params: any, parent?: any): void;
|
20
|
+
triggerBind(id: string, data: any): void;
|
21
|
+
button(name: string, callback: VoidCallback, parent?: any): void;
|
22
|
+
triggerButton(id: string): void;
|
23
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export interface BroadcastData {
|
2
|
+
event: EditorEvent;
|
3
|
+
data: any;
|
4
|
+
}
|
5
|
+
export type ApplicationMode = 'listener' | 'editor';
|
6
|
+
export type VoidCallback = () => void;
|
7
|
+
export type DataUpdateCallback = (data: any) => void;
|
8
|
+
export type EditorEvent = 'setSheet' | 'setSheetObject' | 'updateSheetObject' | 'updateTimeline' | 'addFolder' | 'bindObject' | 'updateBind' | 'addButton' | 'clickButton' | 'selectComponent' | 'draggableListUpdate';
|
9
|
+
export type VoidFunc = () => void;
|
10
|
+
export type BroadcastCallback = (data: BroadcastData) => void;
|
11
|
+
export type TheatreUpdateCallback = (data: any) => void;
|
12
|
+
export declare const noop: () => void;
|
13
|
+
export declare const defaultTheatreCallback: TheatreUpdateCallback;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import './scss/index.scss';
|
3
|
+
type EditorProps = {
|
4
|
+
components?: JSX.Element | JSX.Element[];
|
5
|
+
children?: JSX.Element | JSX.Element[];
|
6
|
+
};
|
7
|
+
export default function Editor(props: EditorProps): import("react/jsx-runtime").JSX.Element;
|
8
|
+
export {};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export type DropdownType = 'option' | 'dropdown' | 'draggable';
|
2
|
+
export interface DropdownOption {
|
3
|
+
title: string;
|
4
|
+
value: any | Array<DropdownOption>;
|
5
|
+
type: DropdownType;
|
6
|
+
onSelect?: (value: any) => void;
|
7
|
+
selectable?: boolean;
|
8
|
+
onDragComplete?: (options: Array<string>) => void;
|
9
|
+
}
|
10
|
+
export interface DropdownProps {
|
11
|
+
title: string;
|
12
|
+
options: Array<DropdownOption>;
|
13
|
+
onSelect?: (value: any) => void;
|
14
|
+
subdropdown?: boolean;
|
15
|
+
}
|
16
|
+
export interface DropdownItemProps {
|
17
|
+
option: DropdownOption;
|
18
|
+
onSelect?: (value: any) => void;
|
19
|
+
onDragComplete?: (options: Array<string>) => void;
|
20
|
+
}
|
21
|
+
export interface DraggableItemProps {
|
22
|
+
index: number;
|
23
|
+
title: string;
|
24
|
+
onDelete: (index: number) => void;
|
25
|
+
}
|
26
|
+
export interface DraggableProps {
|
27
|
+
title: string;
|
28
|
+
options: Array<string>;
|
29
|
+
onDragComplete: (options: Array<string>) => void;
|
30
|
+
subdropdown?: boolean;
|
31
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { EventDispatcher } from 'three';
|
2
|
+
export declare const debugDispatcher: EventDispatcher<import("three").Event>;
|
3
|
+
export declare const ToolEvents: {
|
4
|
+
SELECT_DROPDOWN: string;
|
5
|
+
DRAG_UPDATE: string;
|
6
|
+
INSPECT_ITEM: string;
|
7
|
+
REFRESH_SCENE: string;
|
8
|
+
SET_SCENE: string;
|
9
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
2
|
+
import '../scss/_sceneHierarchy.scss';
|
3
|
+
import { SceneHierarchyState } from './types';
|
4
|
+
export default class SceneHierarchy extends Component {
|
5
|
+
constructor(props: object | SceneHierarchyState);
|
6
|
+
componentWillUnmount(): void;
|
7
|
+
render(): ReactNode;
|
8
|
+
private onUpdate;
|
9
|
+
private toggleOpen;
|
10
|
+
private onRefresh;
|
11
|
+
private onSetScene;
|
12
|
+
get componentState(): SceneHierarchyState;
|
13
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import './scss/index.scss';
|
3
|
+
type EditorProps = {
|
4
|
+
components?: JSX.Element | JSX.Element[];
|
5
|
+
children?: JSX.Element | JSX.Element[];
|
6
|
+
};
|
7
|
+
export default function Editor(props: EditorProps): import("react/jsx-runtime").JSX.Element;
|
8
|
+
export {};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export type DropdownType = 'option' | 'dropdown' | 'draggable';
|
2
|
+
export interface DropdownOption {
|
3
|
+
title: string;
|
4
|
+
value: any | Array<DropdownOption>;
|
5
|
+
type: DropdownType;
|
6
|
+
onSelect?: (value: any) => void;
|
7
|
+
selectable?: boolean;
|
8
|
+
onDragComplete?: (options: Array<string>) => void;
|
9
|
+
}
|
10
|
+
export interface DropdownProps {
|
11
|
+
title: string;
|
12
|
+
options: Array<DropdownOption>;
|
13
|
+
onSelect?: (value: any) => void;
|
14
|
+
subdropdown?: boolean;
|
15
|
+
}
|
16
|
+
export interface DropdownItemProps {
|
17
|
+
option: DropdownOption;
|
18
|
+
onSelect?: (value: any) => void;
|
19
|
+
onDragComplete?: (options: Array<string>) => void;
|
20
|
+
}
|
21
|
+
export interface DraggableItemProps {
|
22
|
+
index: number;
|
23
|
+
title: string;
|
24
|
+
onDelete: (index: number) => void;
|
25
|
+
}
|
26
|
+
export interface DraggableProps {
|
27
|
+
title: string;
|
28
|
+
options: Array<string>;
|
29
|
+
onDragComplete: (options: Array<string>) => void;
|
30
|
+
subdropdown?: boolean;
|
31
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { EventDispatcher } from 'three';
|
2
|
+
export declare const debugDispatcher: EventDispatcher<import("three").Event>;
|
3
|
+
export declare const ToolEvents: {
|
4
|
+
SELECT_DROPDOWN: string;
|
5
|
+
DRAG_UPDATE: string;
|
6
|
+
INSPECT_ITEM: string;
|
7
|
+
REFRESH_SCENE: string;
|
8
|
+
SET_SCENE: string;
|
9
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Component, ReactNode } from 'react';
|
2
|
+
import '../scss/_sceneHierarchy.scss';
|
3
|
+
import { SceneHierarchyState } from './types';
|
4
|
+
export default class SceneHierarchy extends Component {
|
5
|
+
constructor(props: object | SceneHierarchyState);
|
6
|
+
componentWillUnmount(): void;
|
7
|
+
render(): ReactNode;
|
8
|
+
private onUpdate;
|
9
|
+
private toggleOpen;
|
10
|
+
private onRefresh;
|
11
|
+
private onSetScene;
|
12
|
+
get componentState(): SceneHierarchyState;
|
13
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
import './index.scss';
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export { default as Application } from './core/Application';
|
2
|
+
export { debugDispatcher, ToolEvents } from './editor/global';
|
3
|
+
export { default as BaseRemote } from './core/remote/BaseRemote';
|
4
|
+
export { default as RemoteComponents } from './core/remote/RemoteComponents';
|
5
|
+
export { default as RemoteTheatre } from './core/remote/RemoteTheatre';
|
6
|
+
export { default as RemoteTweakpane } from './core/remote/RemoteTweakpane';
|
7
|
+
export { default as NavButton } from './editor/components/NavButton';
|
8
|
+
export { default as DraggableItem } from './editor/components/DraggableItem';
|
9
|
+
export { default as Draggable } from './editor/components/Draggable';
|
10
|
+
export { default as DropdownItem } from './editor/components/DropdownItem';
|
11
|
+
export { default as Dropdown } from './editor/components/Dropdown';
|
12
|
+
export { default as RemoteController } from './core/RemoteController';
|
13
|
+
export { default as SceneHierarchy } from './editor/sceneHierarchy/SceneHierarchy';
|
14
|
+
export { default as Editor } from './editor/Editor';
|